aliyun-rtc-sdk 6.11.6-beta.1 → 6.11.6-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aliyun-rtc-sdk.js +41 -17
- package/dist/plugins/beautyPlugin.d.ts +9 -9
- package/dist/plugins/beautyPlugin.js +1 -1
- package/dist/types/index.d.ts +557 -557
- package/package.json +6 -3
package/dist/aliyun-rtc-sdk.js
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);s=n.reduce(function(o,c){var u=c.split(": ");return o[u[0]]=u[1],o},{})}catch(o){s={}}return s},getQuerys:function(r){if(!r)return"";var s={},n=[],o="",c="";try{var u=[];if(r.indexOf("?")>=0&&(u=r.substring(r.indexOf("?")+1,r.length).split("&")),u.length>0)for(var h in u)o=(n=u[h].split("="))[0],c=n[1],s[o]=c}catch(l){s={}}return s},getURL:function(r){if(!r)return null;var s={},n=r.length,o=r.indexOf("://");if(o<0)return null;s.protocol=r.substring(0,o+1);var c=r.indexOf("#"),u=r.indexOf("?");c<0&&(c=n),u<0&&(u=c),s.search=r.substring(u,c).substring(0,1e3);var h=r.substring(o+3,u),l=h.indexOf("/");return l<0&&(l=h.length),s.domain=h.substring(0,l).split(":")[0],s.path=h.substring(l,h.length).substring(0,1e3),s},getResType:function(r,s){if(["script","img","other"].indexOf(r)>-1)return r;if(["video"].indexOf(r)>-1)return"media";if(["document","iframe"].indexOf(r)>-1)return"doc";var n=s?this.getURL(s):null,o=n&&n.path?n.path.lastIndexOf("."):-1,c=(o>0?n.path.substr(o+1):"").toLowerCase();if(c){if(["eot","woff","woff2","ttf"].indexOf(c)>-1)return"font";if(c==="css")return"css";if(c==="js")return"script"}return["fetch","xmlhttprequest","beacon"].indexOf(r)>-1?"api":"others"},areInOrder:function(){for(var r=1;r<arguments.length;r+=1)if(arguments[r-1]>arguments[r])return!1;return!0},getFetchSnapshot:function(r,s,n){var o,c;try{var u=(r&&typeof r[0]!="string"?r[0].url:r[0])||"",h=(r&&typeof r[0]!="string"?r[0]:r[1])||{},l=h.method.toUpperCase()==="POST"?h.body:this.getQuerys(u);o={originApi:u,method:h.method||"unknown",params:l,response:s||"",reqHeaders:this.parseFetchHeaders(h.headers||null),resHeaders:this.parseFetchHeaders(n)},c=JSON&&JSON.stringify(o)||"{}"}catch(d){c="{}"}return c},getXhrSnapshot:function(r,s,n){if(!r||!s||!n)return{};var o,c;try{var u="";n.responseType===""||n.responseType==="text"?u=n.responseText:n.responseType==="document"&&(u=n.responseXML),o={originApi:r,method:s,params:this.getQuerys(r),response:u,reqHeaders:{},resHeaders:this.parseXhrHeaders(typeof n.getAllResponseHeaders=="function"&&n.getAllResponseHeaders()||"")},c=JSON&&JSON.stringify(o)||"{}"}catch(h){c="{}"}return c},isRobot:function(){var r=["nuhk","googlebot/","googlebot-image","yammybot","openbot","slurp","msnbot","ask jeeves/teoma","ia_archiver","baiduspider","bingbot/","adsbot"];if(!navigator||typeof navigator.userAgent!="string")return!1;try{for(var s=navigator.userAgent.toLowerCase(),n=0;n<r.length;n++){var o=r[n];if(s.lastIndexOf(o)>=0)return!0}}catch(c){this.warn("[arms] useragent parse error")}return!1},isFunction:function(r){return typeof r=="function"},isPlainObject:function(r){return Object.prototype.toString.call(r)==="[object Object]"},isString:function(r){return Object.prototype.toString.call(r)==="[object String]"},isArray:function(r){return Object.prototype.toString.call(r)==="[object Array]"},joinRegExp:function(r){for(var s,n=[],o=0,c=r.length;o<c;o++)s=r[o],this.isString(s)?n.push(s.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):s&&s.source&&n.push(s.source);return new RegExp(n.join("|"),"i")},reWriteMethod:function(r,s,n){if(r!==null){var o=r[s];r[s]=n(o)}},checkSDKError:function(r,s){return!r&&!s?!1:new RegExp(this.selfErrKey,"i").test(r)?!0:!!this.ignoreByRule(s,[/retcode.alicdn.com\/retcode\/bl.js/,/g.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/laz-g-cdn.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/local.taobao.com:8880\/build\/bl/])},sdkError:function(r){return{msg:r,message:this.selfErrKey}},dealParam:function(r,s,n){var o={};try{o=this.isPlainObject(r)?this.ext({key:r.key||"default",val:r.val||r.value||n},r,{begin:Date.now()}):{key:r||"default",val:s||n,begin:Date.now()}}catch(c){this.warn("[retcode] baseLog error: "+c)}return o}};return vi=t,vi}var yi={exports:{}},wi={exports:{}},_i,vr;function ia(){if(vr)return _i;vr=1;var i=Se();return _i=function(a,e,t){typeof a=="object"&&(a=i.serialize(a));var r=e+a+(t?"&post_res=":"");window&&window.navigator&&typeof window.navigator.sendBeacon=="function"?window.navigator.sendBeacon(r,t||"&post_res="):i.warn("[arms] navigator.sendBeacon not surported")},_i}var yr;function ra(){if(yr)return wi.exports;yr=1;var i=Se(),a=ia(),e="aokcdqn3ly@e629dabd48a9933",t=function(s,n){var o;if(n.t==="error"&&(o=s.requestQueue[0])&&o.t==="error"&&n.msg===o.msg)return n.times=o.times+1,void(s.requestQueue[0]=n);if(n.t==="behavior"){var c=s.requestQueue&&s.requestQueue.length;if(c>0&&s.requestQueue[c-1].t==="behavior"){var u=n.behavior||[];s.requestQueue[c-1].behavior.concat(u)}else s.requestQueue.push(n)}else s.requestQueue.unshift(n);return s.onReady(function(){s.requestTimmer=i.delay(function(){s.clear()},s.requestQueue[0]&&s.requestQueue[0].t==="error"?3e3:-1)}),!0},r=function(s){return this.ver="1.8.36-beta.12",this._conf=i.ext({},r.dftCon),this.sampleCache={},this.requestQueue=[],this.selfQueue=[],this.sdkFlag=!0,this.hash=i.seq(),this.resetPageview(),this.setConfig(s),this.rip=i.getRandIP(),this.record=999,this["EagleEye-TraceID"]=this.getTraceId()["EagleEye-TraceID"],this._common={},this};return r.dftCon={sample:1,pvSample:1,tag:"",imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",region:null,ignore:{ignoreUrls:[],ignoreApis:[],ignoreErrors:[/^Script error\.?$/],ignoreResErrors:[],ignoreResources:[/\/(bl|wl)(.debug)?.js$/]},release:void 0,environment:"prod",beforeReport:null,parseTraceId:null},r.prototype={constructor:r,onReady:function(s){return s()},getPage:function(){var s=this._conf.page;return i.safetyCall(s,[],s+"")},setPage:function(){},setConfig:function(s){s&&typeof s=="object"&&(i.verifyConfig(s),s=this.setImgUrl(s),this._conf=i.ext({},this._conf,s))},setImgUrl:function(s){var n=s.region,o=s.imgUrl;if(n){var c=i.regionMap[n];return s.imgUrl=c||i.defaultImgUrl,s}return o&&(s.imgUrl=o),s},checkImgUrl:function(){return!0},sendRequest:function(){},sendBeacon:function(s,n,o){a(s,n||this.getConfig("imgUrl"),o)},postData:function(){},commonInfo:function(){return{}},setCommonInfo:function(s){s&&typeof s=="object"&&(this._common=i.ext({},this._common,s))},resetPageview:function(){this.pageview=i.uu(),this.sBegin=Date.now()},getUsername:function(){if(this.username)return this.username;var s=this._conf,n=s&&s.setUsername;if(typeof n=="function")try{var o=n();typeof o=="string"&&(o=o.substr(0,40),this.username=o)}catch(c){i.warn("[arms] setUsername fail",c)}return this.username},getTraceId:function(){var s=this.rip,n=Date.now(),o=i.getSortNum(this.record),c=s+n+o+i.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=c,this.record=o,{"EagleEye-TraceID":c}},getUberTraceId:function(s){var n=this.rip,o=Date.now(),c=i.getSortNum(this.record),u=i.getRandNum(this._conf.pid),h=n+o+c+i.getNum(2)+u,l=h.substring(0,16);return s=s?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{"uber-trace-id":h+":"+l+":0:"+s,traceId:h}},getB3TraceId:function(s){var n=this.rip,o=Date.now(),c=i.getSortNum(this.record),u=i.getRandNum(this._conf.pid),h=n+o+c+i.getNum(2)+u,l=h.substring(0,16);return s=s?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{b3:h+"-"+l+"-"+s+"-0","X-B3-TraceId":h,"X-B3-ParentSpanId":"0","X-B3-SpanId":l,"X-B3-Sampled":s}},getPageviewId:function(){return{"EagleEye-SessionID":this.pageview}},getConfig:function(s){return s?this._conf[s]:i.ext({},this._conf)},sampling:function(s){return s===1||(typeof this.sampleCache[s]=="boolean"?this.sampleCache[s]:(this.sampleCache[s]=i.pick(s),this.sampleCache[s]))},clear:function(s){var n;clearTimeout(this.requestTimmer),this.requestTimmer=null;for(var o=this._conf&&typeof this._conf.sendRequest=="function";n=this.requestQueue.pop();)if(n.t==="res")this.postData(n,"res");else if(n.t==="error")this.postData(n,"err");else if(n.t==="api")this.postData(n,"apiSnapshot");else if(n.t==="behavior")this.postData(n,"behavior");else if(n.t==="health"&&!o&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function")this.sendBeacon(n);else if(n.t==="resource"&&!o&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function"){var c=JSON.stringify({resource:n.resource});delete n.resource,this.sendBeacon(n,null,c)}else n.t==="resource"?this.postData(n,"resource"):this.sendRequest(n);return s&&this.clearSelf(),this},clearSelf:function(){var s;for(clearTimeout(this.Timmer),this.Timmer=null;s=this.selfQueue.pop();)this.postData(s,"err");return this},_lg:function(s,n,o,c){var u=this,h=u._conf,l=u.getPage(),d=h.ignore||{},f=d.ignoreErrors,m=d.ignoreResErrors,g=d.ignoreUrls,S=d.ignoreApis;if(u._isRobot||i.ignoreByRule(l,g)||i.ignoreByRule(i.decode(l),g)||s==="error"&&(i.ignoreByRule(n.msg,f)||i.ignoreByRule(i.decode(n.msg),f))||s==="resourceError"&&(i.ignoreByRule(n.src,m)||i.ignoreByRule(i.decode(n.src),m))||s==="api"&&(i.ignoreByRule(n.api,S)||i.ignoreByRule(i.decode(n.api),S))||!u.checkImgUrl(h.imgUrl)||!n||h.disabled||!h.pid||c===0)return u;var b=n.dl;if(delete n.dl,n=i.ext({t:s,times:1,page:l,tag:h.tag||"",release:h.release||"",environment:h.environment,begin:Date.now(),c1:h.c1,c2:h.c2,c3:h.c3},n,u.commonInfo(),u._common,{pid:h.pid,_v:u.ver,pv_id:u.pageview,username:u.getUsername(),sampling:o||1,dl:b,z:i.seq()}),i.T(h.beforeReport)==="Function")try{if(!(n=h.beforeReport(n)))return u}catch(w){return u}return c===1?t(u,n):o&&!u.sampling(o)?u:t(u,n)},_self:function(s,n,o){var c=this,u=c._conf;if(s!=="error"||!c.checkImgUrl(u.imgUrl)||!n||u.disabled||!u.pid||!e||o&&!c.sampling(o))return c;n=i.ext({t:s,times:1,page:i.selfErrPage,tag:u.pid,begin:Date.now()},n,{pid:e,_v:c.ver,sampling:o||1,z:i.seq()});var h=c.selfQueue[0];if(h){h.times++;try{h.err&&n.err&&h.err.msg_raw&&n.err.msg_raw&&h.err.msg_raw.split("&").indexOf(n.err.msg_raw)<0&&h.err.msg_raw.length<1e3&&(h.err.msg_raw+="&"+n.err.msg_raw)}catch(l){}}else c.selfQueue.unshift(n),c.onReady(function(){c.sdkFlag&&(c.sdkFlag=!1,c.Timmer=i.delay(function(){c.clearSelf()},1e4))})},custom:function(s,n){if(!s||typeof s!="object")return this;var o=!1,c={begin:Date.now()};return i.each(s,function(u,h){return!(o=h&&h.length<=20)&&i.warn("[retcode] invalid key: "+h),c["x-"+h]=u,o}),o?this._lg("custom",c,n||1):this}},wi.exports=r,wi.exports}var wr;function sa(){if(wr)return yi.exports;wr=1;var i=Se(),a=ra(),e=["api","success","time","code","msg","trace","traceId","begin","pv_id","sid","seq","domain","flag","apiSnapshot","tag","c1","c2","c3"],t=function(s){var n=(s.key||"default").split("::");return n.length>1?i.ext(s,{group:n[0],key:n[1]}):i.ext(s,{group:"default_group",key:n[0]})},r=function(s){a.call(this,s);var n;try{n=typeof performance=="object"?performance.timing.fetchStart:Date.now()}catch(o){n=Date.now()}return this._startTime=n,this};return r.prototype=i.createObject(a.prototype),i.ext(a.dftCon,{startTime:null}),i.ext(r.prototype,{constructor:r,_super:a,sum:function(s,n,o){try{var c=i.dealParam(s,n,1);return this._lg("sum",t(c),o)}catch(u){i.warn("[retcode] can not get parseStatData: "+u)}},avg:function(s,n,o){try{var c=i.dealParam(s,n,0);return this._lg("avg",t(c),o)}catch(u){i.warn("[retcode] can not get parseStatData: "+u)}},percent:function(s,n,o,c){try{return this._lg("percent",t({key:s,subkey:n,val:o||0,begin:Date.now()}),c)}catch(u){i.warn("[retcode] can not get parseStatData: "+u)}},msg:function(s,n){if(s&&!(s.length>180))return this.custom({msg:s},n)},error:function(s,n){if(!s)return i.warn("[retcode] invalid param e: "+s),this;arguments.length===1?(typeof s=="string"&&(s={message:s},n={}),typeof s=="object"&&(n=s=s.error||s)):(typeof s=="string"&&(s={message:s}),typeof n!="object"&&(n={}));var o=s.name||"CustomError",c=s.message||"",u=s.stack||"";n=n||{};var h=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"";if(i.checkSDKError(c,n.filename)){var l=/^Script error\.?$/,d=s.msg||s.message;if(i.ignoreByRule(d,l)||i.ignoreByRule(i.decode(d),l))return this;var f={msg:i.selfErrKey,err:{msg_raw:i.encode(s.msg||s.message)}};return this._self("error",f,1)}for(var m={begin:Date.now(),cate:o,msg:c&&c.substring(0,1e3),stack:u&&u.substring(0,1e3),file:i.removeUrlSearch(n.filename||""),line:n.lineno||"",col:n.colno||"",err:{msg_raw:i.encode(c),stack_raw:i.encode(u)},dl:h},g=["tag","c1","c2","c3"],S=0;S<g.length;S++){var b=g[S];n[b]&&(m[b]=n[b])}var w=(this.getConfig("ignore")||{}).ignoreErrors;return i.ignoreByRule(m.msg,w)||i.ignoreByRule(i.decode(m.msg),w)?this:(this.beforeSend&&this.beforeSend("error",m),this._lg("error",m,1))},behavior:function(s){if(s){var n=typeof s=="object"&&s.behavior?s:{behavior:s};return this.beforeSend&&this.beforeSend("behavior",n),this._lg("behavior",n,1)}},api:function(s,n,o,c,u,h,l,d,f,m,g,S,b,w,_,R){if(!s)return i.warn("[retcode] api is null"),this;if(s=typeof s=="string"?{api:s,success:n,time:o,code:c,msg:u,begin:h,traceId:l,pv_id:d,apiSnapshot:f,domain:m,flag:S,tag:b,c1:w,c2:_,c3:R}:i.sub(s,e),!i.checkAPI(s.api,!0))return this;s.code=s.code||"";var V=s.msg||"";if(V=typeof V=="string"?V.substring(0,1e3):V,s.msg=V,s.success=s.success?1:0,s.time=+s.time,s.begin=s.begin,s.traceId=s.traceId||"",s.pv_id=s.pv_id||"",s.domain=s.domain||"",s.flag=s.flag,s.dl=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"",s.apiSnapshot&&(typeof s.apiSnapshot=="object"&&(s.apiSnapshot=JSON.stringify(s.apiSnapshot)),typeof s.apiSnapshot!="string"&&delete s.apiSnapshot,s.apiSnapshot.length>2e3&&(s.apiSnapshot=s.apiSnapshot.substring(0,2e3))),g&&(s.traceOrigin=g),!s.api||isNaN(s.time))return i.warn("[retcode] invalid time or api"),this;var K=(this.getConfig("ignore")||{}).ignoreApis;return i.ignoreByRule(s.api,K)||i.ignoreByRule(i.decode(s.api),K)?this:s.time<0?this:(this.beforeSend&&this.beforeSend("api",s),this._lg("api",s,s.success&&this.getConfig("sample"),s.flag))},speed:function(s,n,o){var c=this,u=this.getConfig("startTime")||this._startTime;return/^s(\d|1[0])$/.test(s)?(n=typeof n!="number"?Date.now()-u:n>=u?n-u:n,c.speedCache=c.speedCache||{},c.speedCache[s]=n,c.speedCache.begin=u,clearTimeout(c.speedTimmer),c.speedTimmer=setTimeout(function(){o||(c.speedCache.page=c.getPage(!0)),c._lg("speed",c.speedCache),c.speedCache=null},5e3),c):(i.warn("[retcode] invalid point: "+s),c)},performance:function(s){if(s&&typeof s=="object"&&!this.hasSendPerf){var n={},o={},c=this.getConfig("autoSendPerf");if(s.autoSend&&c)return o=i.ext(this.perfData||{},s),this.hasSendPerf=!0,this._lg("perf",o,this.getConfig("sample"));if(s.autoSend&&!c)return delete s.autoSend,this.perfData?(o=i.ext(this.perfData||{},s),this.hasSendPerf=!0,this._lg("perf",o,this.getConfig("sample"))):void(this.perfData=s);for(var u in s)(/^t([1-9]|1[0])$/.test(u)||u==="ctti"||u==="cfpt")&&(n[u]=s[u]);if(s.autoSend===!0||!c&&(c||this.perfData))return s.autoSend!==!0&&c===!1&&this.perfData?(n=i.ext(this.perfData||{},n),this.hasSendPerf=!0,this._lg("perf",n,this.getConfig("sample"))):void 0;this.perfData=i.ext(this.perfData||{},n)}},resource:function(s,n){if(!s||!i.isPlainObject(s))return i.warn("[arms] invalid param data: "+s),this;var o=Object.keys(s),c=["begin","dom","load","res","dl"],u=!1;for(var h in c)if(o.indexOf(c[h])<0){u=!0;break}if(u)return i.warn("[arms] lack param data: "+s),this;var l={begin:s.begin||Date.now(),dom:s.dom||"",load:s.load||"",res:i.isArray(s.res)?JSON.stringify(s.res):JSON.stringify([]),dl:s.dl||""};return this._lg("res",l,n)},event:function(s,n){if(typeof s=="object"&&s&&s.key){var o={},c=["key","success","time","c1","c2","c3"];for(var u in s)c.indexOf(u)>-1&&(o[u]=s[u]);o.success=s.success===!1?0:1,this._lg("event",o,n)}}}),r._super=a,r._root=a,a.Reporter=r,yi.exports=r,yi.exports}var Ri={exports:{}},_r;function aa(){if(_r)return Ri.exports;_r=1;var i=Se(),a=typeof window=="object"?window:{},e="catch",t=a.__oFetch_||a.fetch;return t=typeof t=="function"?t:void 0,Ri.exports=function(r,s){var n=-1;typeof r=="object"&&(n=r.z,r=i.serialize(r));var o=s+r;if(t)return t(o,{method:"HEAD",mode:"no-cors"})[e](i.noop);if(a.document&&a.document.createElement){var c="__request_hold_"+n,u=a[c]=new Image;u.onload=u.onerror=function(){a[c]=void 0},u.src=o,u=null}},Ri.exports}var Ii={exports:{}},Rr;function na(){if(Rr)return Ii.exports;Rr=1;var i=Se(),a=typeof window=="object"?window:{},e=a.__oXMLHttpRequest_||a.XMLHttpRequest;return e=typeof e=="function"?e:void 0,Ii.exports=function(t,r){try{var s=new e;s.open("POST",r,!0),s.setRequestHeader("Content-Type","text/plain"),s.send(JSON.stringify(t))}catch(n){i.warn(`[retcode] Failed to log, exception is :
|
|
3
|
-
`+n)}},Ii.exports}var Ei,Ir;function oa(){if(Ir)return Ei;Ir=1;var i=Se();return Ei=function(a,e){var t=[],r=null,s=e&&e.location&&e.location.href,n=void 0,o=null,c=function(d,f,m){if(d!==null){var g=d[f];d[f]=m(g)}},u=function(d){var f,m,g,S,b,w=[];if(!d||typeof d.tagName!="string")return"";if(w.push(d.tagName.toLowerCase()),typeof d.id=="string"&&w.push("#".concat(d.id)),typeof(f=d.className)=="string")for(m=f.split(/\s+/),b=0;b<m.length;b++)w.push(".".concat(m[b]));var _=["type","name","title","alt","data-arms-attr"];for(b=0;b<_.length;b++)g=_[b],typeof(S=d.getAttribute(g))=="string"&&w.push("[".concat(g,'="').concat(S,'"]'));return w.join("")},h=function(d,f){return function(m){if(m&&m!==o){o=m;var g;try{g=m.target}catch(b){g="<unknown>"}if(g.length!==0){var S={type:"ui.".concat(d),data:{message:function(b){if(!b||b.nodeType!==1)return"";for(var w=b||null,_=[],R=0,V=0,K=3,F="";w&&R++<5&&!((F=u(w))==="html"||R>1&&V+_.length*K+F.length>=80);)_.push(F),V+=F.length,w=w.parentNode;return _.reverse().join(" > ")}(g)},timestamp:Date.now()};d==="click"?r&&r.addBehavior(S):d==="keypress"&&(n||r&&r.addBehavior(S),clearTimeout(n),n=setTimeout(function(){n=void 0},100))}}}},l=function(){if(function(){var g=e&&e.chrome,S=g&&g.app&&g.app.runtime,b="history"in e&&!!e.history.pushState&&!!e.history.replaceState;return!S&&b}()){var d=function(g,S){var b={type:"navigation",data:{from:g,to:S}};r&&r.addBehavior(b),s=S},f=e.onpopstate;e.onpopstate=function(){for(var g=arguments.length,S=new Array(g),b=0;b<g;b++)S[b]=arguments[b];var w=e.location.href;if(d(s,w),f)return f.apply(this,S)};var m=function(g){return function(){for(var S=arguments.length,b=new Array(S),w=0;w<S;w++)b[w]=arguments[w];var _=b.length>2?b[2]:void 0;return _&&d(s,String(_)),g.apply(this,b)}};c(e.history,"pushState",m),c(e.history,"replaceState",m)}};i.ext(a.prototype,{addBehavior:function(d){if(this.getConfig("behavior")&&d&&typeof d=="object"){var f={},m=d.data||{};if(d.type)f=m;else{if(typeof m.name!="string"||typeof m.message!="string")return;f.name=m.name.substr(0,20),f.message=m.message.substr(0,200)}f.message&&(f.message=i.encode(f.message));var g={type:d.type||"custom",data:f||{},timestamp:d.timestamp||Date.now(),page:d.page||e&&e.location&&e.location.pathname};return t.push(g),t=t.slice(-100)}},getBehavior:function(){return t||[]},setBehavior:function(d){return d&&(t=d),t},reportBehavior:function(d){var f=this;f.getConfig("behavior")&&(f.sendBhTimer&&(clearTimeout(f.sendBhTimer),f.sendBhTimer=void 0),f.sendBhTimer=setTimeout(function(){t&&t.length>0&&(f.behavior(t),t=[],f.sendBhTimer=void 0,d&&typeof d=="function"&&d())},0))},initBehavior:function(){if(!this.hasInitBehavior&&!r){try{(function(){if(document&&document.referrer&&document.location){var f=document.referrer,m=document.location.href;if(f!==""){var g={type:"navigation",data:{from:f,to:m}};s=m,r&&r.addBehavior(g)}}})(),e&&e.document&&e.document.addEventListener&&(e.document.addEventListener("click",h("click"),!1),e.document.addEventListener("keypress",h("keypress"),!1)),l();var d=this.getConfig("enableConsole");d&&function(f){if(e&&e.console){var m=["debug","info","warn","log","error","assert"];i.isArray(f)&&(m=f);for(var g=0;g<m.length;g++){var S=m[g];S&&i.isString(S)&&e.console[S]&&typeof e.console[S]=="function"&&c(e.console,S,function(b){var w=S;return function(){for(var _=arguments.length,R=new Array(_),V=0;V<_;V++)R[V]=arguments[V];var K={type:"console",data:{level:w,message:R}};if(r&&r.addBehavior(K),w==="error")for(var F=0;F<R.length;F++){var O=R[F];O&&O.message&&O.stack&&r&&r.errorHandler(new ErrorEvent("error",{error:O,message:O.message}))}b&&Function.prototype.apply.call(b,e.console,R)}})}}}(d)}catch(f){i.warn("[arms] error in initBehavior",f)}r=this,this.hasInitBehavior=!0}return this}})},Ei}var Er={},Ar;function Ai(){return Ar||(Ar=1,Er.TIMING_KEYS=["startTime","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","","domInteractive","","domContentLoadedEventEnd","","loadEventStart","","msFirstPaint","secureConnectionStart","redirectStart","redirectEnd"]),Er}var Ti,Tr;function ca(){if(Tr)return Ti;Tr=1;var i=Se(),a=Ai(),e=a.TIMING_KEYS;return Ti=function(){var t=i.win||{},r=t.performance;if(!r||typeof r!="object"||typeof r.getEntriesByType!="function")return null;var s={},n=r.timing||{},o=r.getEntriesByType("resource")||[];if(s.begin=n[e[1]]||Date.now(),typeof t.PerformanceNavigationTiming=="function"){var c=r.getEntriesByType("navigation")[0];c&&(n=c)}return i.each({dom:[10,8],load:[14,1]},function(u,h){var l=n[e[u[1]]],d=n[e[u[0]]];if(l>0&&d>0){var f=Math.round(d-l);f>=0&&f<6e5&&(s[h]=f)}}),s.res=JSON.stringify(o),s},Ti}var Pi,Pr;function ua(){if(Pr)return Pi;Pr=1;var i=Se(),a=Ai(),e=a.TIMING_KEYS;return Pi=function(){var t=i.win||{},r=t.performance;if(!r||typeof r!="object")return null;var s={},n=r.timing||{},o=Date.now(),c=1;if(typeof t.PerformanceNavigationTiming=="function"){var u=r.getEntriesByType("navigation")[0];u&&(n=u,c=2)}i.each({dns:[3,2],tcp:[5,4],ssl:[5,17],ttfb:[7,6],trans:[8,7],dom:[10,8],res:[14,12],firstbyte:[7,2],fpt:[8,1],tti:[10,1],ready:[12,1],load:[14,1]},function(m,g){var S=n[e[m[1]]],b=n[e[m[0]]];if(c===2||S>0&&b>0){var w=Math.round(b-S);w>=0&&w<6e5&&(s[g]=w)}});var h=t.navigator.connection,l=r.navigation||{};s.ct=h?h.effectiveType||h.type:"";var d=h&&(h.downlink||h.downlinkMax||h.bandwidth)||null;if((d=d>999?999:d)&&(s.bandwidth=d),s.navtype=l.type===1?"Reload":"Other",c===1&&n[e[16]]>0&&n[e[1]]>0){var f=n[e[16]]-n[e[1]];f>=0&&f<36e5&&(s.fpt=f)}return c===1&&n[e[1]]>0?s.begin=n[e[1]]:c===2&&s.load>0?s.begin=o-s.load:s.begin=o,s},Pi}var kr,Cr;function ha(){return Cr||(Cr=1,kr=function(i,a,e){var t=Se(),r=ca(),s=ua(),n=null,o=e.documentElement,c=a.innerWidth||o.clientWidth||e.body.clientWidth,u=a.innerHeight||o.clientHeight||e.body.clientHeight,h=a.navigator.connection,l={sr:screen.width+"x"+screen.height,vp:c+"x"+u,ct:h?h.effectiveType||h.type:""},d={},f=function(g,S,b,w,_){if(S===void 0){var R,V;if(!d[g]){R=new RegExp(g+"=([^;]+)");try{V=R.exec(e.cookie)}catch(F){return t.warn("[retcode] can not get cookie:",F),null}V&&(d[g]=V[1])}return d[g]}var K=g+"="+S;K+="; path=/",b&&(K+="; max-age="+b);try{return e.cookie=K,!!e.cookie}catch(F){return t.warn("[retcode] can not set cookie: ",F),!1}},m=function(g){var S=g._conf.uid||f("_nk_")||f("_bl_uid");return!S&&(S=t.uu(),!f("_bl_uid",S,15552e3))?null:S};return t.ext(i.prototype,{activeErrHandler:function(g){return n&&!g?this:(n=this,this)},errorHandler:function(g){if(!g)return this;var S=g.type;if(S==="error"){var b=g.target||g.srcElement;!b||!b.tagName||g.message||g.filename||g.lineno||g.colno?this.error(g.error||{message:g.message},g):this.resourceErrorHandler(g)}else S==="unhandledrejection"&&t.T(g.reason,"Error")&&t.checkAutoError(g.reason)&&this.error(g.reason);try{this.getConfig("behavior")&&this.reportBehavior&&this.reportBehavior()}catch(w){}return this},resourceErrorHandler:function(g){var S=this,b=g.target||g.srcElement;try{var w=S.getSrc(b),_=typeof b.tagName=="string"?b.tagName.toLowerCase():"",R=S.getXPath(b,5),V=t.getURL(w),K={src:w&&w.substring(0,1e3),node_name:_,xpath:R,res_type:t.getResType(_,w),res_name:V.path,domain:V.domain};return S._conf.enableResource&&S.fixResourceStatus&&g.timeStamp&&S.fixResourceStatus({src:w,node_name:_,res_type:t.getResType(_,w),timeStamp:g.timeStamp,domain:V.domain}),S._lg("resourceError",K),S}catch(F){return t.warn("[ARMS] resourceErrorHandler error :",F),S}},getSrc:function(g){var S=g.src||g.href;try{if(!S){var b=(typeof g.tagName=="string"?g.tagName.toLowerCase():"")==="object",w=g.getAttribute("classid")&&g.getAttribute("classid").toLowerCase()==="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"||g.getAttribute("type")==="application/x-shockwave-flash";b&&w&&(S=g.getAttribute("data")||g.getAttribute("codebase")),S||(S=g.outerHTML||g.innerHTML)}}catch(_){S=""}return S},getXPath:function(g,S){var b=g.id?"#"+g.id:"",w=typeof g.className=="string"?"."+g.className.split(" ").join("."):"",_=(typeof g.tagName=="string"?g.tagName.toLowerCase():"")+b+w;return g.parentNode&&g.parentNode.tagName&&S-1!=0?this.getXPath(g.parentNode,S-1)+" > "+_:_},sendPerformance:function(g){var S=this;S.onReady(function(){var b=s();b&&b.load&&b.load>0&&(b.page=S.getPage(!0),g&&(b=t.ext(b,g)),b.autoSend=!0,S.performance(b))})},sendResources:function(g){var S=this;S.onReady(function(){var b=r();b&&b.load&&b.load>0&&(b.load&&b.load<=2e3||b.load&&b.load<=8e3&&Math.random()>.05||(b.page=S.getPage(!0),b.dl=location.href,g&&(b=t.ext(b,g)),S._lg("res",b,S.getConfig("sample"))))})},sendPV:function(){var g=this;g.onReady(function(){var S=function(b){var w=m(b),_=a.devicePixelRatio||1;return{uid:w,dt:e.title,dl:location.href,dr:e.referrer,dpr:_.toFixed(2),de:(e.characterSet||e.defaultCharset||"").toLowerCase(),ul:o.lang,begin:Date.now()}}(g);S&&S.uid&&g._lg("pv",S,g.getConfig("pvSample"))})},commonInfo:function(){return l.uid=m(this),l.sid=function(g){if(g.session)return g.session;var S;try{if(typeof window=="object"&&typeof sessionStorage=="object"&&typeof sessionStorage.getItem=="function")return typeof(S=sessionStorage.getItem("_bl_sid"))=="string"?(g.session=S,S):(S=t.uu(),g.session=S,typeof sessionStorage.setItem=="function"&&sessionStorage.setItem("_bl_sid",S),S)}catch(b){t.warn("[ARMS] getSid error :",b)}return g.session=S=t.uu(),S}(this),l},handleUnload:function(g){var S=Date.now();if(S-this._lastUnload<200)return this;this._lastUnload=S,this.sendHealth(g),this.speedCache&&(this._lg("speed",this.speedCache),this.speedCache=null,clearTimeout(this.speedTimmer)),this._conf&&this._conf.enableResource&&this.resourceComboReport(),this.clear(!0)},bindHashChange:function(g){var S=this;if(!g^S.hashChangeHandler)return S;g?(S.hackHistoryState(),S.hashChangeHandler=function(b){var w=S._conf.parseHash(location.hash);w&&S.setPage(w,b!==!1)},S.stateChangeHandler=function(b){var w=S._conf.parseHash(b.detail);w&&S.setPage(w)},t.on(a,"hashchange",S.hashChangeHandler),t.on(a,"historystatechange",S.stateChangeHandler),S.hashChangeHandler(!1)):(t.off(a,"hashchange",S.hashChangeHandler),t.off(a,"historystatechange",S.stateChangeHandler),S.hashChangeHandler=null,S.stateChangeHandler=null)},initHandler:function(){var g=this;if(g.hasInitHandler)return g;var S=g._conf;return t.on(a,"beforeunload",function(){g.handleUnload(0)}),g.bindHashChange(S.enableSPA),g.activeErrHandler(!1),g.hasInitHandler=!0,g}}),t.on(a,"error",function(g){n&&n.errorHandler(g)},!1,!0).on(a,"unhandledrejection",function(g){n&&n.errorHandler(g)}),i}),kr}var ki,Mr;function la(){if(Mr)return ki;Mr=1;var i=Se(),a=500;return ki=function(e,t,r){function s(l,d,f){var m=0,g=l.tagName;if(g!=="SCRIPT"&&g!=="STYLE"&&g!=="META"&&g!=="HEAD"){var S=l.children?l.children.length:0;if(S>0)for(var b=l.children,w=S-1;w>=0;w--)m+=s(b[w],d+1,m>0);if(m<=0&&!f&&!(l.getBoundingClientRect&&l.getBoundingClientRect().top<o))return 0;m+=1+.5*d}return m}function n(l){for(var d=1;d<l.length;d++)if(l[d].score<l[d-1].score)return l.splice(d,1),n(l);return l}var o=t.innerHeight||0,c=[],u=null,h=0;i.ext(e.prototype,{initFmpObserver:function(l){var d=this;if(!d._conf||!d._conf.useFmp)return null;if(!t.MutationObserver)return i.warn("[retcode] first meaningful paint can not be retrieved"),d.sendPerformance(),null;i.on(t,"beforeunload",function(){d.endObserving(0,!0)});var f=t.MutationObserver;return(u=new f(function(){(function(m){var g=Date.now()-m,S=r.querySelector("body");if(S){var b=0;b+=s(S,1,!1),c.push({score:b,t:g})}else c.push({score:0,t:g})})(d._startTime)})).observe(document,{childList:!0,subtree:!0}),h=1,d.onReady(function(){d.endObserving(l)}),u},endObserving:function(l,d){var f=this;if(u&&h)if(f.fmpTimmer&&(clearTimeout(f.fmpTimmer),f.fmpTimmer=null),d||!function(b,w){var _=Date.now()-b;return!(_>w||_-(c&&c.length&&c[c.length-1].t||0)>2*a)}(f._startTime,l)){u.disconnect(),h=0,c=n(c);for(var m=null,g=1;g<c.length;g++)if(c[g].t>=c[g-1].t){var S=c[g].score-c[g-1].score;(!m||m.rate<=S)&&(m={t:c[g].t,rate:S})}m&&m.t>0&&m.t<36e5?f.sendPerformance({fmp:m.t}):f.sendPerformance()}else f.fmpTimmer=i.delay(function(){f.endObserving(l)},a)}})},ki}var Nr,Lr;function da(){return Lr||(Lr=1,Nr=function(i,a){var e=Se(),t=null,r=e.getCurDomain(),s=function(h,l,d,f,m,g,S,b,w,_,R,V,K){var F=e.J(m)||null,O=e.safetyCall(l,[F,f],null);if(!O)return!1;var ee=O.code||g,Re=!("success"in O)||O.success;h.api(d,Re,S,ee,O.msg,b,w,_,Re?{}:R,r,V,K)},n="fetch",o="__oFetch_",c="__oXMLHttpRequest_",u="XMLHttpRequest";return e.ext(i.prototype,{removeHook:function(h,l){return t&&(l||this===t)?(a[o]&&(a[n]=a[o],delete a[o]),a[c]&&(a[u]=a[c],delete a[c]),t=null,this):this},addHook:function(h){return!h&&t?this:(t||(function(){if(typeof a[n]=="function"){var l=a[n];a[o]=l,a[n]=function(d,f){var m=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),g=t;if(!g||!g.api||f&&(f.method==="HEAD"||f.mode==="no-cors"))return l.apply(a,m);f||(f={});var S=Date.now(),b=g._conf,w=e.duration(),_=(d&&typeof d!="string"?d.url:d)||"",R=_;_=e.cutUrlSearch(_);var V=(b.ignore||{}).ignoreApis,K=b.parseTraceId;if(!e.checkAPI(_,!0)||e.ignoreByRule(_,V))return l.apply(a,m);_=e.filterByRule(_,R,b.ignoreApiPath?b.ignoreApiPath:b.apiHelper);var F=b.enableLinkTrace,O="",ee="",Re=g.getConfig("pid"),st=null,he=g.getConfig("sample"),le=g.getConfig("linkType"),ye=1;if(he&&!g.sampling(he)&&(ye=0),F){var $e="";try{$e=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(Y){$e=""}var Ge=e.checkSameOrigin(R,$e);if(g.getConfig("enableApiCors")||Ge)if(d&&typeof d!="string")try{if(m[0].headers&&typeof m[0].headers.get=="function"&&typeof m[0].headers.append=="function")switch(le){case"arms":var ze=m[0].headers.get("EagleEye-TraceID"),Ne=m[0].headers.get("EagleEye-SessionID"),Pe=m[0].headers.get("EagleEye-pAppName");ze?O=ze:(O=g.getTraceId()["EagleEye-TraceID"],m[0].headers.append("EagleEye-TraceID",O)),Ne?ee=Ne:(ee=g.getPageviewId()["EagleEye-SessionID"],m[0].headers.append("EagleEye-SessionID",ee)),Pe||m[0].headers.append("EagleEye-pAppName",Re);break;case"b3":var xe=m[0].headers.get("X-B3-TraceId");if(xe)O=xe;else{var Ie=g.getB3TraceId(ye);m[0].headers.append("X-B3-TraceId",Ie["X-B3-TraceId"]),m[0].headers.append("X-B3-ParentSpanId",Ie["X-B3-ParentSpanId"]),m[0].headers.append("X-B3-SpanId",Ie["X-B3-SpanId"]),m[0].headers.append("X-B3-Sampled",Ie["X-B3-Sampled"]),m[0].headers.append("X-Request-ID",e.guid()),O=Ie["X-B3-TraceId"]}ee=g.pageview;break;case"tracing":default:var fe=m[0].headers.get("uber-trace-id");fe?O=fe.split(":")[0]:(fe=g.getUberTraceId(ye),m[0].headers.append("uber-trace-id",fe["uber-trace-id"]),O=fe.traceId),ee=g.pageview}}catch(Y){e.warn(`[retcode] fetch failed to set header, exception is :
|
|
4
|
-
`+Y)}else switch(f.headers=f.headers?f.headers:{},le){case"arms":f.headers["EagleEye-TraceID"]?O=f.headers["EagleEye-TraceID"]:(O=g.getTraceId()["EagleEye-TraceID"],f.headers["EagleEye-TraceID"]=O),f.headers["EagleEye-SessionID"]?ee=f.headers["EagleEye-SessionID"]:(ee=g.getPageviewId()["EagleEye-SessionID"],f.headers["EagleEye-SessionID"]=ee),f.headers["EagleEye-pAppName"]||(f.headers["EagleEye-pAppName"]=Re);break;case"b3":if(f.headers["X-B3-TraceId"])O=f.headers["X-B3-TraceId"];else{var me=g.getB3TraceId(ye);f.headers["X-B3-TraceId"]=me["X-B3-TraceId"],f.headers["X-B3-ParentSpanId"]=me["X-B3-ParentSpanId"],f.headers["X-B3-SpanId"]=me["X-B3-SpanId"],f.headers["X-B3-Sampled"]=me["X-B3-Sampled"],f.headers["X-Request-ID"]=e.guid(),O=me["X-B3-TraceId"]}ee=g.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(f.headers["uber-trace-id"])O=f.headers["uber-trace-id"].split(":")[0];else{var We=g.getUberTraceId(ye);f.headers["uber-trace-id"]=We["uber-trace-id"],O=We.traceId}ee=g.getPageviewId()["EagleEye-SessionID"]}}return l.apply(a,m).then(function(Y){if(!g||!g.api)return Y;try{if(!Y||typeof Y.clone!="function")return Y;var de=Y.clone(),Ke=de.headers;if(Ke&&typeof Ke.get=="function"){var Ut=Ke.get("content-type");if(Ut&&!/(text)|(json)/.test(Ut))return Y;if(!O){var yt=e.parseFetchHeaders(Ke);typeof yt=="object"&&yt["eagleeye-traceid"]&&(O=yt["eagleeye-traceid"],st="response")}}var Bt=w();return de.text().then(function(gt){if(!O&&e.isFunction(K)){var at=K(de,gt);at&&e.isString(at)&&(O=at)}var Ht=e.getFetchSnapshot(m,gt,Ke);de.ok?s(g,b.parseResponse,_,R,gt,de.status||200,Bt,S,O,ee,Ht,st,ye):(g.api(_,!1,Bt,de.status||404,de.statusText,S,O,ee,Ht,r,st,ye),b.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:de.url,res_type:"api"}))}),Y}catch(gt){return e.warn("[ARMS] fetch response error :",gt),Y}}).catch(function(Y){if(!g||!g.api)throw Y;var de=w();throw g.api(_,!1,de,Y.name||"Error",Y.message,S,O,ee,{},r),b.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:R,res_type:"api"}),Y})},a[n].toString=e.createFakeToString(n)}}(),function(){if(typeof a[u]=="function"){var l,d=a[u];a[c]=d;var f=function(m){var g=new d(m),S=t;if(!S||!S.api||!g.addEventListener)return g;var b,w,_,R,V=g.send,K=g.open,F=g.setRequestHeader,O=S._conf,ee=(O.ignore||{}).ignoreApis,Re=O.parseTraceId,st=S.getConfig("enableLinkTrace"),he="",le="",ye="",$e=null,Ge=S.getConfig("sample"),ze=S.getConfig("linkType"),Ne=1;return Ge&&!S.sampling(Ge)&&(Ne=0),g.open=function(Pe,xe){l=Pe;var Ie=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);K.apply(g,Ie),R=xe||"",_=e.cutUrlSearch(R);var fe=!e.checkAPI(_,!0)||e.ignoreByRule(_,ee);if(_=_?e.filterByRule(_,R,O.ignoreApiPath?O.ignoreApiPath:O.apiHelper):"",!fe&&st){var me="";try{me=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(Ke){me=""}var We=e.checkSameOrigin(R,me);if((S.getConfig("enableApiCors")||We)&&F&&typeof F=="function")switch(ze){case"arms":he=S.getTraceId()["EagleEye-TraceID"],F.apply(g,["EagleEye-TraceID",he]),le=S.getPageviewId()["EagleEye-SessionID"],F.apply(g,["EagleEye-SessionID",le]),ye=S.getConfig("pid"),F.apply(g,["EagleEye-pAppName",ye]);break;case"b3":var Y=S.getB3TraceId(Ne);F.apply(g,["X-B3-TraceId",Y["X-B3-TraceId"]]),F.apply(g,["X-B3-ParentSpanId",Y["X-B3-ParentSpanId"]]),F.apply(g,["X-B3-SpanId",Y["X-B3-SpanId"]]),F.apply(g,["X-B3-Sampled",Y["X-B3-Sampled"]]),F.apply(g,["X-Request-ID",e.guid()]),he=Y["X-B3-TraceId"],le=S.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var de=S.getUberTraceId(Ne);F.apply(g,["uber-trace-id",de["uber-trace-id"]]),he=de.traceId,le=S.getPageviewId()["EagleEye-SessionID"]}}},g.send=function(){b=Date.now(),w=e.duration();var Pe=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);V.apply(g,Pe)},e.on(g,"readystatechange",function(){if(_&&g.readyState===4){var Pe=w(),xe=e.getXhrSnapshot(R,l,g);if(!he){var Ie=e.parseXhrHeaders(typeof g.getAllResponseHeaders=="function"&&g.getAllResponseHeaders()||"");typeof Ie=="object"&&Ie["eagleeye-traceid"]&&(he=Ie["eagleeye-traceid"],$e="response")}if(!he&&e.isFunction(Re)){var fe=Re(g);fe&&e.isString(fe)&&(he=fe)}if(g.status>=200&&g.status<=299){var me=g.status||200;if(typeof g.getResponseHeader=="function"){var We=g.getResponseHeader("Content-Type");if(We&&!/(text)|(json)/.test(We))return}g.responseType&&g.responseType!=="text"?S.api(_,!0,Pe,me,"",b,he,le,{},r,$e,Ne):s(S,O.parseResponse,_,R,g.responseText,me,Pe,b,he,le,xe,$e,Ne)}else S.api(_,!1,Pe,g.status||"FAILED",g.statusText,b,he,le,xe,r,$e,Ne),O.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:g.responseURL||R,res_type:"api"})}}),g};f.prototype=d.prototype,e.each(Object.keys(d),function(m){f[m]=d[m]}),a[u]=f,a[u].toString=e.createFakeToString(u)}}()),t=this,this)},initHook:function(){return this.hasInitHook?this:(this.getConfig("disableHook")||this.addHook(),this.hasInitHook=!0,this)}}),i}),Nr}var Or,Vr;function pa(){return Vr||(Vr=1,Or=function(i,a){var e=Se(),t=a.history||{},r=a.document,s=function(o,c){var u;a.CustomEvent?u=new CustomEvent(o,{detail:c}):((u=r.createEvent("HTMLEvents")).initEvent(o,!1,!0),u.detail=c),a.dispatchEvent(u)},n=function(o){var c=t[o];typeof c=="function"&&(t[o]=function(u,h,l){var d=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),f=location.href,m=c.apply(t,d);if(!l||typeof l!="string"||l===f)return m;try{var g=f.split("#"),S=l.split("#"),b=e.cutUrlSearch(g[0]),w=e.cutUrlSearch(S[0]),_=g[1]&&g[1].replace(/^\/?(.*)/,"$1"),R=S[1]&&S[1].replace(/^\/?(.*)/,"$1");_!==R?s("historystatechange",R):b!==w&&s("historystatechange",w)}catch(V){e.warn("[retcode] error in "+o+": "+V)}return m},t[o].toString=e.createFakeToString(o))};e.ext(i.prototype,{hackHistoryState:function(){return this.hasHackedHistoryState?this:(n("pushState"),n("replaceState"),this.hasHackedHistoryState=!0,this)}})}),Or}var Ci,Dr;function ga(){if(Dr)return Ci;Dr=1;var i=Se(),a=Ai(),e=a.TIMING_KEYS;return Ci=function(t,r){function s(c,u,h){if(c instanceof r.PerformanceResourceTiming&&c.initiatorType){var l=i.getResType(c.initiatorType,c.name),d=u.resourceTypes||[],f=(u.ignore||{}).ignoreResources;if(l&&d.includes(l)&&!i.ignoreByRule(c.name,f)&&!i.ignoreByRule(i.decode(c.name),f)){var m=c[e[0]],g=c[e[1]],S=c[e[2]],b=c[e[3]],w=c[e[4]],_=c[e[5]],R=c[e[6]],V=c[e[7]],K=c[e[8]],F=c[e[18]],O=c[e[19]];if(!h.has(c)&&(!i.areInOrder(m,g,S,b,w,_,R,V,K)||m>V))return;if(F<m&&(F=m),O<m&&(O=g),i.areInOrder(m,F,O,g))return{domain:i.getURL(c.name).domain,res_type:l,src_type:i.getSrcType(c.name,u.cdnHostList),success:1,size:Math.round(c.decodedBodySize),duration:Math.round(c.duration),timeStamp:c.responseEnd,timing:c}}}}var n="_resource-"+Date.now(),o="_resource_error-"+Date.now();i.ext(t.prototype,{initResource:function(){var c=this,u=r.performance,h=r.PerformanceObserver;if(c[o]||(c[o]=new WeakMap),!u||!h||typeof u!="object"||typeof u.getEntriesByType!="function")return null;var l=u.getEntriesByType("resource")||[];return setTimeout(function(){c.setResource(l)},10),new h(function(d){setTimeout(function(){c.setResource(d.getEntries())},10)}).observe({entryTypes:["resource"]}),this.onReady(function(){setTimeout(c.resourceComboReport.bind(c),5e3)}),c},setResource:function(c){var u=this._conf,h=this[o];if(i.isArray(c)&&c.length){this[n]||(this[n]={});for(var l=this[n],d=0,f=c.length;d<f;d+=1){var m=c[d];if(i.checkAPI(m.name,!1)){var g=s(m,u,h);if(g){var S=g.res_type+"-"+g.domain;S in l||(l[S]=[]),l[S].push(g)}}}return this}},fixResourceStatus:function(c){var u=r.performance;if(!u||typeof u.getEntriesByName!="function")return null;var h=this[o];if(!c.src||!i.checkAPI(c.src,!1))return this;var l=c.timeStamp||u.now(),d=u.getEntriesByName(c.src,"resource");return i.each(d,function(f){h.has(f)||l-f.responseEnd<100&&h.set(f,{success:0})}),this},resourceComboReport:function(){var c=this[n]||{},u=this._conf.resourceSlow||2e3,h=this[o];this[n]={};var l=Object.keys(c);if(l.length!==0){var d=[];i.each(l,function(S){var b=c[S],w={domain:"",res_type:"",src_type:"",size:0,duration:0,count:0,err_count:0,err_duration:0,slow_count:0,slow_duration:0,timings:[]};i.each(b,function(_){var R=_.timing||{},V=h.get(_.timing),K=V?V.success:1,F=_.duration>u?1:0;w.domain=_.domain,w.res_type=_.res_type,w.src_type=_.src_type,w.count+=1,w.duration+=_.duration,w.size+=_.size,K||(w.err_count+=1,w.err_duration+=_.duration),F&&(w.slow_count+=1,w.slow_duration+=_.duration);try{var O=JSON.parse(JSON.stringify(R));O.success=K,O.resourceSlow=u,O.isSlow=F,w.timings.push(O)}catch(ee){}}),w.count&&(w.size=Math.round(w.size/w.count),w.duration=Math.round(w.duration/w.count)),w.slow_count&&(w.slow_duration=Math.round(w.slow_duration/w.slow_count)),w.err_count&&(w.err_duration=Math.round(w.err_duration/w.err_count)),w.timings.length>20&&(w.timings.sort(function(_,R){return R.duration-_.duration}),w.timings.length=20),w.timings=encodeURIComponent(JSON.stringify(w.timings)),d.push(w)});var f={_combo:1,resource:JSON.stringify(d)},m=r.navigator.connection;f.ct=m?m.effectiveType||m.type:"";var g=m&&(m.downlink||m.downlinkMax||m.bandwidth)||null;(g=g>999?999:g)&&(f.bandwidth=g),this._lg("resource",f,this.getConfig("sample"))}}})},Ci}var xr;function fa(){if(xr)return ot.exports;xr=1;var i=Se(),a=sa(),e=aa(),t=na(),r=i.win,s=r.document,n=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,o=function(c){var u=this;return a.call(u,c),u._initialPage=c.page&&i.safetyCall(c.page,[],c.page+"")||null,u._isRobot=i.isRobot(),u._health={errcount:0,apisucc:0,apifail:0},u.beforeSend=function(h,l){h==="error"?u._health.errcount++:h==="api"&&u._health[l.success?"apisucc":"apifail"]++},c.enableInstanceAutoSend!==!1&&(u.initHandler(),u.initHook(),u.initFmpObserver(1e4),u._conf&&u._conf.behavior&&typeof u.initBehavior=="function"&&u.initBehavior(),u._conf&&u._conf.enableResource&&typeof u.initResource=="function"&&u.initResource()),Object.defineProperty&&r.addEventListener&&Object.defineProperty(u,"pipe",{set:u.sendPipe}),u};return o.prototype=i.createObject(a.prototype),i.ext(a._root.dftCon,{uid:null,setUsername:null,ignoreUrlPath:null,ignoreApiPath:null,urlHelper:[{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},/\/$/],resourceHelper:[],apiHelper:{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},ignoreUrlCase:!0,imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",cdnHostList:[],resourceTypes:["css","script","img","font"],resourceSlow:2e3,disableHook:!1,autoSendPv:!0,autoSendPerf:!0,enableSPA:!1,enableLinkTrace:!1,linkType:"arms",enableApiCors:!1,sendResource:!0,behavior:!0,enableConsole:!1,parseHash:function(c){return(c?i.cutUrlSearch(c.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(c){if(!c||typeof c!="object")return{};var u=c.code,h=c.msg||c.message||c.subMsg||c.errorMsg||c.ret||c.errorResponse||"";return typeof h=="object"&&(u=u||h.code,h=h.msg||h.message||h.info||h.ret||JSON.stringify(h)),{msg:h,code:u,success:!0}}}),i.ext(o.prototype,{constructor:o,_super:a,onReady:function(c){var u=this;if(u.hasReady)return c();s.readyState==="complete"?(u.hasReady=!0,c()):i.on(r,"load",function(){u.hasReady=!0,c()},!0)},getPage:function(c){var u=this._conf,h=u.page,l=location,d=l.host+l.pathname;return h&&!c?i.safetyCall(h,[],h+""):this._initialPage||i.filterByRule(u.ignoreUrlCase?d.toLowerCase():d,l.href,u.ignoreUrlPath?u.ignoreUrlPath:u.urlHelper)},setPage:function(c,u){var h=this,l=h.prevPage;if(u!==!1){if(!c||c===l)return h;h.prevPage=c,clearTimeout(h.sendPVTimmer),h.handleUnload(1),h.resetPageview(),h.sendPVTimmer=setTimeout(function(){h.sendPV()},10)}else h.prevPage=c;return h._conf.page=c,h},setConfig:function(c,u){if(c&&typeof c=="object"){i.verifyConfig(c),c=this.setImgUrl(c);var h=this._conf;if(this._conf=i.ext({},h,c),!u){var l="disableHook";l in c&&h[l]!==c[l]&&(c[l]?this.removeHook():this.addHook()),(l="enableSPA")in c&&h[l]!==c[l]&&this.bindHashChange(c[l])}}},sendRequest:function(c){e(c,this.getConfig("imgUrl"))},postData:function(c,u){var h={};h[u]=c[u],delete c[u];var l="";typeof c=="object"&&(l=i.serialize(c)),t(h,this.getConfig("imgUrl")+l+"&post_res=")},sendPipe:function(c){var u=this;if(!c||!c.length)return u;try{if(i.T(c[0])==="Array")return i.each(c,function(l){return u.sendPipe(l)});if(i.T(c)!=="Array")return u;var h=c.shift();if(!n.test(h))return u;u[h].apply(u,c)}catch(l){return i.warn("[retcode] error in sendPipe",l),u}},sendHealth:function(){var c=i.ext({},this._health);c.healthy=c.errcount>0?0:1,c.begin=Date.now();var u=c.begin-this.sBegin;c.stay=u,this._lg("health",c,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(c){c=i.ext({pid:this._conf.pid},c);var u=this.__proto__.constructor(c);return c.page&&u.sendPV(),u}}),oa()(o,r),ha()(o,r,s),la()(o,r,s),da()(o,r),pa()(o,r),ga()(o,r),o._super=a,o._root=a._root,a.Browser=o,ot.exports=o,ot.exports}var Ur;function ma(){if(Ur)return Le.exports;Ur=1;function i(o,c){var u=e[r]=new t(o);u.sendPipe(c);var h=u._conf;return h.autoSendPv!==!1&&u.sendPV(),h&&h.useFmp||u.sendPerformance(),h&&h.sendResource&&u.sendResources(),e[s]=!0,u}function a(){if(e[s])return e[r];var o={},c=[];return r in e&&(o=e[r].config||{},c=e[r].pipe||[]),i(o,c)}var e=window,t=e.BrowserLogger=fa(),r=Se().key,s="__hasInitBlSdk";t.singleton=function(o,c){return e[s]?e[r]:i(o,c)},t.createExtraInstance=function(o){o&&typeof o=="object"&&o.enableInstanceAutoSend!==!0&&(o.enableInstanceAutoSend=!1);var c=new t(o),u=c._conf;return u.enableInstanceAutoSend&&(u.autoSendPv!==!1&&c.sendPV(),u&&u.useFmp||c.sendPerformance(),u&&u.sendResource&&c.sendResources()),c};var n=typeof window=="object"&&!!window.navigator;return n&&e[r]&&(t.bl=a()),Le.exports=t,Le.exports}function Sa(){return ma()}var ba={getArmsLogger:Sa};function va(i,a){const e=[],t=typeof Object.getOwnPropertyDescriptors=="function"?Object.getOwnPropertyDescriptors(Object.getPrototypeOf(i)):{};for(const s of Object.keys(t))t[s].get&&e.push(s);const r={MediaboxWrapperObjectGetter(s,n){if(typeof n=="string"&&e.indexOf(n)>-1)return He(s[n],a+1);const o={MediaboxWrapperObjectMethod(...c){return He(s[n](...c),a+1)}};return typeof s[n]=="function"?o.MediaboxWrapperObjectMethod:a>10?s[n]:He(s[n],a+1)},MediaboxWrapperObjectSetter(s,n,o){return s[n]=He(o,a+1),!0}};return new Proxy(i,{get:r.MediaboxWrapperObjectGetter,set:r.MediaboxWrapperObjectSetter})}function ya(i,a){const e={MediaboxWrapperFunctionApply(t,r,s){const n=t.apply(r,s);return He(n,a+1)},MediaboxWrapperFunctionGet(t,r){const s=Object.getOwnPropertyDescriptor(t,r);if(s&&!s.writable&&!s.configurable)return t[r];const n={MediaboxWrapperFunctionGet(...o){const c=t[r](...o);return He(c,a+1)}};return typeof t[r]=="function"?n.MediaboxWrapperFunctionGet:He(t[r],a+1)},MediaboxWrapperClassConstructor(t,r){const s=new t(...r);return He(s,a+1)}};return new Proxy(i,{apply:e.MediaboxWrapperFunctionApply,get:e.MediaboxWrapperFunctionGet,construct:e.MediaboxWrapperClassConstructor})}function wa(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp)&&!(i instanceof Function)}function He(i,a){return typeof i=="function"?ya(i,a+1):i instanceof Promise?i.then(e=>He(e,a+1)).catch(e=>(e instanceof Error&&typeof e.stack=="string"&&e.stack.indexOf("MediaboxWrapper")>-1&&setTimeout(()=>{throw e},0),Promise.reject(e))):wa(i)?va(i,a+1):i}const _a="https://arms-retcode-sg.aliyuncs.com/r.png?",Ra="https://arms-retcode.aliyuncs.com/r.png?",Ia="https://retcode-us-west-1.arms.aliyuncs.com/r.png?",Ea={cn:Ra,sg:_a,usw:Ia};class Mi{constructor(a){Be(this,"armsLogger"),Be(this,"isReady",!1),Be(this,"isDestroyed",!1),Be(this,"options"),Be(this,"queue",[]),Be(this,"helper",{MediaboxWrapperQueue(n){return new Error(n)},MediaboxWrapperInitiative(n){return new Error(n)}}),this.options=a;const{region:e="cn",env:t="prod"}=a,r=n=>{var o;if(this.isDestroyed)return!1;if(n.c1=(o=this.options.cid)!=null?o:window.location.host,n.c2=Mi.version,this.options.customData&&(n.c3=new URLSearchParams(this.options.customData).toString()),n.t==="error"){if(n.file.indexOf("g.alicdn.com/apsara-media-")>-1||n.file.indexOf("g.alicdn.com/thor-server")>-1||n.stack.indexOf("MediaboxWrapper")>-1){let c=n;return this.options.beforeSend&&(c=this.options.beforeSend(n)),this.isReady?c:(c&&this.queue.push(c),!1)}return!1}return n},s=ba.getArmsLogger();this.armsLogger=s.singleton({pid:"e1iftji1w7@7ec1cef2cc88733",tag:a.businessName,release:`${a.businessName}_${a.version}`,imgUrl:Ea[e],behavior:!0,sample:1,disableHook:!0,environment:t,beforeReport:r})}static get version(){return"0.9.0"}wrap(a){return this.options.disabled||typeof Proxy>"u"?a:He(a,0)}updateOptions(a){this.options=W(W({},this.options),a)}setReady(){this.isReady=!0,this.queue.length&&this.queue.forEach(a=>{this.armsLogger.error(this.helper.MediaboxWrapperQueue(a.msg),{filename:a.file,lineno:a.line,colno:a.col})})}report(a,e){this.armsLogger.error(this.helper.MediaboxWrapperInitiative(a),e)}destroy(){this.isDestroyed=!0}}var J=(i=>(i.PullStreamStats="remoteStat",i.RtsSubscribeExceeds="rtsSubscribeExceeds",i.UserJoined="userJoined",i.UserLeft="userLeft",i.Bye="bye",i.MuteAudio="muteAudio",i.UnmuteAudio="unmuteAudio",i.MuteVideo="muteVideo",i.UnmuteVideo="unmuteVideo",i.MuteScreen="muteScreen",i.UnmuteScreen="unmuteScreen",i.Error="error",i))(J||{}),be=(i=>(i.Local="local-device-status-change",i.Remote="remote-device-status-change",i))(be||{}),M=(i=>(i.Audio="sophon_audio",i.VideoLarge="sophon_video_camera_large",i.VideoSmall="sophon_video_camera_small",i.Screen="sophon_video_screen_share",i))(M||{}),Ni=(i=>(i.Audio="rts audio",i.VideoLarge="rts video",i))(Ni||{}),ft=(i=>(i[i.Camera=0]="Camera",i[i.Screen=1]="Screen",i[i.Image=2]="Image",i))(ft||{}),Wt=(i=>(i[i.Microphone=0]="Microphone",i[i.Screen=1]="Screen",i[i.Mixed=2]="Mixed",i))(Wt||{}),Kt=(i=>(i.prod="rs.rtn.aliyuncs.com",i.pre="prs.rtn.aliyuncs.com",i))(Kt||{});const Rt="6.11.6-beta.1",Br="web";class Ye{static getVersionNumber(){let a=Rt.split("."),e="";return a.forEach(t=>{t.length===1?e+="0"+t:e+=t}),parseInt(e)}static queryingParam(a){let e=[];if(a)for(let t in a)e.push(t+"="+a[t]);return e.join("&")}static getQueryParams(a){const t=window.location.search.substring(1).split("&");for(let r=0;r<t.length;r++){const s=t[r].split("=");if(decodeURIComponent(s[0])===a)return decodeURIComponent(s[1])}}static createCallid(){return x.Guid.create(8)+"-"+x.Guid.create(4)+"-4"+x.Guid.create(3)+"-"+x.Guid.create(4)}static checkSubOptionsValid(a){if(a){const{audio:e,video:t,screen:r}=a;if(e===!1&&t===!1&&r===!1)return!1}return!0}static isNetworkAvailable(){return v(this,null,function*(){const a=Kt.prod,{onLine:e}=navigator;if(!e)return!1;try{return yield fetch(`https://${a}/roomserver/v1/ws/version`),!0}catch(t){return!1}})}}var Li=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.API=2]="API",i[i.WARNING=3]="WARNING",i[i.ERROR=4]="ERROR",i[i.NONE=5]="NONE",i))(Li||{});class ke{constructor(a,e,t){p(this,"logLevel");p(this,"outputToConsole");p(this,"maxLogLength");p(this,"maxlogCache");p(this,"uri");p(this,"requestTimeout");p(this,"delay");p(this,"rate");p(this,"hugeBatchCount");p(this,"checkInterval");p(this,"flushModecheckInterval");p(this,"recordOverheadLength");p(this,"httpRequest");p(this,"traceId");p(this,"traceIdPostfix");p(this,"flushMode");p(this,"outputToServer");p(this,"batchCount");p(this,"msgCounter");p(this,"lastRequestTime");p(this,"enable");p(this,"retx");p(this,"lastProfilingTime");p(this,"bytesOut");p(this,"dropped");p(this,"networkdropped");p(this,"lastLogTime",0);p(this,"logArray");p(this,"onTimer",()=>{if(!this.enable)return;this.processCachedLogs();let a=Date.now(),e=a-this.lastLogTime>1e4;if(a-this.lastProfilingTime>=5e3&&!e){let r=this.getProfiling();this.logInternal("[logger] profiling result: "+ke.toString(r))}let t=this.flushMode?this.flushModecheckInterval:this.checkInterval;e&&(t=this.checkInterval),setTimeout(this.onTimer,t)});this.logLevel=3,this.maxLogLength=12e3,this.requestTimeout=5e3,this.delay=2e3,this.rate=3,this.maxlogCache=1e3,this.hugeBatchCount=100,this.outputToConsole=!0,this.outputToServer=!1,this.checkInterval=1e3,this.flushModecheckInterval=200,this.recordOverheadLength=120,this.flushMode=!1,this.batchCount=0,this.retx=[],this.lastProfilingTime=Date.now(),this.bytesOut=0,this.dropped=0,this.networkdropped=0,window&&window.location&&window.location.protocol&&window.location.protocol==="http:"?this.uri="http://"+e+"."+a+"/logstores/"+t+"/track":this.uri="https://"+e+"."+a+"/logstores/"+t+"/track",this.httpRequest=null,this.msgCounter=0,this.traceIdPostfix=x.LocalStorage.uuid+"-"+Date.now(),this.traceId="",this.logArray=[],this.enable=!0,this.lastRequestTime=0,this.onTimer()}static toString(a){let e;if(a instanceof Error)e=a.message;else if(typeof a=="string")e=a;else try{e=JSON.stringify(a)}catch(t){e="undefined"}return e}changeConfig(a){a.enable!==void 0&&(this.enable=a.enable,this.enable||this.clear()),a.logLevel!==void 0&&a.logLevel>=0&&a.logLevel<=5&&(this.logLevel=a.logLevel),a.logToConsole!==void 0&&(this.outputToConsole=a.logToConsole),a.logToServer!==void 0&&(this.outputToServer=a.logToServer),a.maxLogLength!==void 0&&a.maxLogLength>10&&(this.maxLogLength=a.maxLogLength),a.maxlogCache!==void 0&&a.maxlogCache>10&&a.maxlogCache<2e4&&(this.maxlogCache=a.maxlogCache),a.requestTimeout!==void 0&&a.requestTimeout>100&&a.requestTimeout<1e5&&(this.requestTimeout=a.requestTimeout),a.delay!==void 0&&a.delay>0&&a.delay<1e5&&(this.delay=a.delay),a.rate!==void 0&&a.rate>0&&a.rate<1e4&&(this.rate=a.rate)}getProfiling(){let a={enable:this.enable,flush:this.flushMode,cache:this.logArray.length,drop:this.dropped,dropNw:this.networkdropped,kbps:0},e=Date.now();return e-this.lastProfilingTime>500?(a.kbps=Math.round(this.bytesOut*8/(e-this.lastProfilingTime)),this.lastProfilingTime=e,this.bytesOut=0):a.kbps=-1,a}clear(){this.retx=[],this.logArray=[]}setFlushMode(a){this.enable&&(this.flushMode=a,this.flushMode&&this.processCachedLogs())}setTraceID(a){a&&(a.length>64&&(a=a.substring(0,64)),this.traceId=a)}d(...a){if(!this.enable||this.logLevel>0)return;let e=this.getCurrentTime();this.outputToConsole&&console.debug(e,...a);let t=ke.paramArrayToString(a);this.addLog(0,t,!1,e)}i(...a){if(!this.enable||this.logLevel>1)return;let e=this.getCurrentTime();this.outputToConsole&&console.log(e,...a);let t=ke.paramArrayToString(a);this.addLog(1,t,!1,e)}w(...a){if(!this.enable||this.logLevel>3)return;let e=this.getCurrentTime();this.outputToConsole&&console.warn(e,...a);let t=ke.paramArrayToString(a);this.addLog(3,t,!1,e)}e(...a){if(!this.enable||this.logLevel>4)return;let e=this.getCurrentTime();this.outputToConsole&&console.error(e,...a);let t=ke.paramArrayToString(a);t="<error> "+t,this.addLog(4,t,!1,e)}ev(...a){if(!this.enable||this.logLevel>2)return;let e=this.getCurrentTime();this.outputToConsole&&console.log(e,...a);let t=ke.paramArrayToString(a);this.addLog(2,t,!1,e)}a(...a){if(!this.enable||this.logLevel>2)return;let e=this.getCurrentTime();if(this.outputToConsole){if(a.length>2){const r=`${a[1]}`;r.startsWith("__g__")&&console.group(`${r.substring(5)}_${a[2]}`)}console.log(e,...a)}let t=ke.paramArrayToString(a);this.addLog(2,t,!1,e)}ar(...a){if(!this.enable||this.logLevel>2)return;let e=this.getCurrentTime();this.outputToConsole&&(console.log(e,...a),a.length>2&&`${a[1]}`.startsWith("__g__")&&console.groupEnd());let t=ke.paramArrayToString(a);this.addLog(2,t,!1,e)}ae(...a){if(!this.enable||this.logLevel>4)return;let e=this.getCurrentTime();this.outputToConsole&&(console.error(e,...a),this.logLevel>2&&a.length>2&&console.groupEnd());let t=ke.paramArrayToString(a);t="<error> "+t,this.addLog(4,t,!1,e)}logInternal(a){if(!this.enable||this.logLevel>3)return;let e=this.getCurrentTime();this.addLog(2,a,!0,e)}addLog(a,e,t,r){e=r+" "+e,e.length>this.maxLogLength&&(e=e.substring(0,this.maxLogLength));let s=Date.now();t||(this.lastLogTime=s);let n={tm:s.toString(),level:a.toString(),msg:e,count:this.msgCounter.toString(),trace:this.traceId+"-"+this.traceIdPostfix};this.logArray.push(n),this.msgCounter++,this.logArray.length>this.maxlogCache&&this.saveMemory(this.maxlogCache-5)}saveMemory(a){let e=0,t=0;for(;this.logArray.length>a&&e<=4;){for(;t<this.logArray.length;)if(parseInt(this.logArray[t].level)===e){if(this.logArray.splice(t,1),this.dropped++,this.logArray.length<=a)break}else t++;t===this.logArray.length&&(t=0,e++)}}processCachedLogs(){if(!this.outputToServer||this.logArray.length===0&&this.retx.length===0||this.isHttpRequesting()||!this.flushMode&&Date.now()-this.lastRequestTime<this.delay)return;if(this.retx&&this.retx.length>0){let o=this.retx[0].tries?parseInt(this.retx[0].tries)+1:1;if(this.flushMode||this.retx.length<this.hugeBatchCount||o<4){let c=o.toString();for(let u=0;u<this.retx.length;u++)this.retx[u].tries=c;this.batchSend(this.retx);return}else this.retx=[],this.dropped+=this.retx.length,this.networkdropped+=this.retx.length}if(this.logArray.length===0)return;let a=this.flushMode?1.5*1024*1024:this.delay*this.rate,e=0,t=0,r=this.recordOverheadLength;for(let o=0;o<this.logArray.length&&(t+=this.logArray[o].msg.length+r,!(t>a));o++)e=o+1;e===0&&(e=1);let s=this.logArray.splice(0,e);this.batchCount++;let n=this.batchCount.toString();for(let o=0;o<s.length;o++)s[o].batch=n,s[o].tries="0";this.retx=s,this.batchSend(s)}createHttpRequest(){this.httpRequest||window.XMLHttpRequest&&(this.httpRequest=new XMLHttpRequest)}isHttpRequesting(){return this.httpRequest!==null}batchSend(a){if(this.isHttpRequesting())return;this.lastRequestTime=Date.now();let e=this.uri,t=JSON.stringify(a);t='{"__logs__":'+t+"}",this.createHttpRequest(),this.isHttpRequesting()&&(this.bytesOut+=t.length,this.httpRequest.open("POST",e,!0),this.httpRequest.timeout=this.requestTimeout,this.httpRequest.setRequestHeader("x-log-apiversion","0.6.0"),this.httpRequest.setRequestHeader("x-log-bodyrawsize",t.length),this.httpRequest.onload=()=>{this.httpRequest.status!==200&&console.log("Error: failed to post log ",this.httpRequest),this.retx=[],this.lastRequestTime=Date.now(),this.httpRequest=null},this.httpRequest.onerror=()=>{console.log("Error: post log failed"),this.lastRequestTime=Date.now(),this.httpRequest=null},this.httpRequest.onabort=()=>{console.log("Error: post log aborted"),this.lastRequestTime=Date.now(),this.httpRequest=null},this.httpRequest.send(t))}getCurrentTime(){let a=new Date;return("00"+a.getHours()).slice(-2)+":"+("00"+a.getMinutes()).slice(-2)+":"+("00"+a.getSeconds()).slice(-2)+"."+("000"+a.getMilliseconds()).slice(-3)}static paramArrayToString(a){let e="";for(let t=0;t<a.length;t++){e!==""&&(e+=",");let r=ke.toString(a[t]);e+=r}return e}}class A{static getLogger(){return this.logger||(this.logger=new ke("cn-shanghai.log.aliyuncs.com","alirtc","client_h5")),this.logger}static setLogLevel(a){this.getLogger().changeConfig({logLevel:a})}static config(a){this.getLogger().changeConfig(a)}static setTraceID(a){this.getLogger().setTraceID(a)}static setFlushMode(a){this.getLogger().setFlushMode(a)}static interface(...a){this.getLogger().a("[API]",...a)}static interfaceResult(a,e,t,...r){t?this.getLogger().ar("[ARE]",a,e,...r):this.getLogger().ae("[ARE]",a,e,...r)}static event(...a){this.getLogger().ev("[EVT]",...a)}static debug(...a){this.getLogger().d("[DBG]",...a)}static info(...a){this.getLogger().i("[INF]",...a)}static warn(...a){this.getLogger().w("[WARN]",...a)}static error(...a){this.getLogger().e("[ERR]",...a)}}p(A,"logger");const Aa=i=>v(this,null,function*(){const a=new D.AliRTS.SupportUtil;let e={support:!1,detail:{isWebRTCSupported:a.checkMediaDevices()&&a.checkWebRtcSupport(),isH264DecodeSupported:!1,isH264EncodeSupported:!1,isScreenShareSupported:!1,isSendMediaExtensionMsgSupported:!1,isBrowserSupported:a.checkBrowser({errorCode:0,message:""})}};if(e.support=e.detail.isWebRTCSupported&&e.detail.isBrowserSupported,a.checkWebRtcSupport()&&i!=="sendonly"){const t=yield a.checkH264Decode();e.detail.isH264DecodeSupported=t,e.support=e.support&&t}if(a.checkWebRtcSupport()&&i!=="recvonly"){const t=yield a.checkH264Encode();e.detail.isH264EncodeSupported=t,e.support=e.support&&t}return e.detail.isScreenShareSupported=a.checkWebRtcSupport()&&a.checkScreenCapture()&&!D.AliRTS.SystenUtil.isAndroid&&!D.AliRTS.SystenUtil.isIos,e.detail.isSendMediaExtensionMsgSupported=a.checkWebRtcSupport()&&a.checkEncodedTransformSupport(),e});var ae=(i=>(i[i.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",i[i.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen",i))(ae||{}),Hr=(i=>(i[i.PRE_PROCESSOR=0]="PRE_PROCESSOR",i[i.POST_PROCESSOR=1]="POST_PROCESSOR",i))(Hr||{}),Jt=(i=>(i[i.AUDIO=0]="AUDIO",i[i.VIDEO=1]="VIDEO",i[i.BOTH=2]="BOTH",i))(Jt||{});class mt extends X{constructor(e,t=ae.AliRtcSdkStreamTypeCapture,r=1){super();p(this,"name");p(this,"options");p(this,"type",0);p(this,"streamType");p(this,"trackType");p(this,"zIndex",1);p(this,"_isEnable",!0);p(this,"lastInputAudioTrack");p(this,"lastOutputAudioTrack");p(this,"lastInputVideoTrack");p(this,"lastOutputVideoTrack");this.name=e,this.streamType=t,this.trackType=r,this.options=this.initOptions}get initOptions(){return{}}getOptions(){return this.options}init(){return v(this,null,function*(){})}enable(){this._isEnable||(this._isEnable=!0,this.init(),this.emit("enabled"))}disable(){this._isEnable&&(this._isEnable=!1,this.clear(),this.emit("disabled"))}get isEnable(){return this._isEnable}audioUpdated(e){var t,r;return((t=this.lastInputAudioTrack)==null?void 0:t.id)!==((r=e.currentAudioTrack)==null?void 0:r.id)}videoUpdated(e){var t,r;return((t=this.lastInputVideoTrack)==null?void 0:t.id)!==((r=e.currentVideoTrack)==null?void 0:r.id)}execute(e,t){return v(this,null,function*(){const r=this.shouldUpdate(e,t);this.lastInputAudioTrack=e.currentAudioTrack,this.lastInputVideoTrack=e.currentVideoTrack,r?yield this.process(e,t):(this.lastOutputAudioTrack&&(this.trackType===2||this.trackType===0)&&this.lastOutputAudioTrack&&e.updateAudioTrack(this.lastOutputAudioTrack),this.lastOutputVideoTrack&&(this.trackType===2||this.trackType===1)&&this.lastOutputVideoTrack&&e.updateVideoTrack(this.lastOutputVideoTrack)),this.lastOutputAudioTrack=e.currentAudioTrack,this.lastOutputVideoTrack=e.currentVideoTrack})}clear(e){this.lastInputAudioTrack=void 0,this.lastInputVideoTrack=void 0,this.lastOutputAudioTrack=void 0,this.lastOutputVideoTrack=void 0}}var It=(i=>(i[i.LiveTranscodingSingle=0]="LiveTranscodingSingle",i[i.LiveTranscodingMix=1]="LiveTranscodingMix",i))(It||{}),Oi=(i=>(i[i.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",i[i.LiveTranscodingAudio=1]="LiveTranscodingAudio",i[i.LiveTranscodingVideo=2]="LiveTranscodingVideo",i))(Oi||{}),St=(i=>(i[i.LiveTranscodingCamera=0]="LiveTranscodingCamera",i[i.LiveTranscodingShareScreen=1]="LiveTranscodingShareScreen",i))(St||{});const Et={0:"camera",1:"shareScreen"};var Vi=(i=>(i[i.LiveTranscoding_Profile_1IN_1080P=0]="LiveTranscoding_Profile_1IN_1080P",i[i.LiveTranscoding_Profile_1IN_720P=1]="LiveTranscoding_Profile_1IN_720P",i[i.LiveTranscoding_Profile_1IN_360P=2]="LiveTranscoding_Profile_1IN_360P",i[i.LiveTranscoding_Profile_2IN_1080P=3]="LiveTranscoding_Profile_2IN_1080P",i[i.LiveTranscoding_Profile_2IN_720P=4]="LiveTranscoding_Profile_2IN_720P",i[i.LiveTranscoding_Profile_2IN_360P=5]="LiveTranscoding_Profile_2IN_360P",i[i.LiveTranscoding_Profile_4IN_1080P=6]="LiveTranscoding_Profile_4IN_1080P",i[i.LiveTranscoding_Profile_4IN_720P=7]="LiveTranscoding_Profile_4IN_720P",i[i.LiveTranscoding_Profile_4IN_360P=8]="LiveTranscoding_Profile_4IN_360P",i[i.LiveTranscoding_Profile_9IN_1080P=9]="LiveTranscoding_Profile_9IN_1080P",i[i.LiveTranscoding_Profile_9IN_720P=10]="LiveTranscoding_Profile_9IN_720P",i[i.LiveTranscoding_Profile_9IN_360P=11]="LiveTranscoding_Profile_9IN_360P",i[i.LiveTranscoding_Profile_12IN_1080P=12]="LiveTranscoding_Profile_12IN_1080P",i[i.LiveTranscoding_Profile_12IN_720P=13]="LiveTranscoding_Profile_12IN_720P",i[i.LiveTranscoding_Profile_12IN_360P=14]="LiveTranscoding_Profile_12IN_360P",i[i.LiveTranscoding_Profile_16IN_1080P=15]="LiveTranscoding_Profile_16IN_1080P",i[i.LiveTranscoding_Profile_16IN_720P=16]="LiveTranscoding_Profile_16IN_720P",i[i.LiveTranscoding_Profile_16IN_360P=17]="LiveTranscoding_Profile_16IN_360P",i[i.LiveTranscoding_Profile_Mixed=9999]="LiveTranscoding_Profile_Mixed",i))(Vi||{});const Ta={0:"1IN_1080P",1:"1IN_720P",2:"1IN_360P",3:"2IN_1080P",4:"2IN_720P",5:"2IN_360P",6:"4IN_1080P",7:"4IN_720P",8:"4IN_360P",9:"9IN_1080P",10:"9IN_720P",11:"9IN_360P",12:"12IN_1080P",13:"12IN_720P",14:"12IN_360P",15:"16IN_1080P",16:"16IN_720P",17:"16IN_360P",9999:"Mixed_Audio"};var qt=(i=>(i[i.LiveTranscoding_HZ_48000=48e3]="LiveTranscoding_HZ_48000",i[i.LiveTranscoding_HZ_44100=44100]="LiveTranscoding_HZ_44100",i[i.LiveTranscoding_HZ_32000=32e3]="LiveTranscoding_HZ_32000",i[i.LiveTranscoding_HZ_16000=16e3]="LiveTranscoding_HZ_16000",i[i.LiveTranscoding_HZ_8000=8e3]="LiveTranscoding_HZ_8000",i))(qt||{}),At=(i=>(i[i.LiveTranscodingNoBody=0]="LiveTranscodingNoBody",i[i.LiveTranscodingBody=1]="LiveTranscodingBody",i))(At||{}),Tt=(i=>(i[i.NOTO_SERIF_CJKSC_REGULAR=0]="NOTO_SERIF_CJKSC_REGULAR",i[i.ALIBABA_PUHUITI_REGULAR=1]="ALIBABA_PUHUITI_REGULAR",i[i.ALIBABA_PUHUITI_BOLD=2]="ALIBABA_PUHUITI_BOLD",i[i.ALIBABA_PUHUITI_Heavy=3]="ALIBABA_PUHUITI_Heavy",i[i.ALIBABA_PUHUITI_LIGHT=4]="ALIBABA_PUHUITI_LIGHT",i[i.ALIBABA_PUHUITI_MEDIUM=5]="ALIBABA_PUHUITI_MEDIUM",i))(Tt||{}),Di=(i=>(i[i.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",i[i.LiveTranscodingCrop=1]="LiveTranscodingCrop",i[i.LiveTranscodingFill=2]="LiveTranscodingFill",i))(Di||{}),Gt=(i=>(i[i.LiveTranscodingNormal=0]="LiveTranscodingNormal",i[i.LiveTranscodingVirtualBackground=1]="LiveTranscodingVirtualBackground",i))(Gt||{}),xi=(i=>(i[i.LiveTranscodingState_IDLE=0]="LiveTranscodingState_IDLE",i[i.LiveTranscodingState_CONNNECT=1]="LiveTranscodingState_CONNNECT",i[i.LiveTranscodingState_RUNNING=2]="LiveTranscodingState_RUNNING",i[i.LiveTranscodingState_RECOVERING=3]="LiveTranscodingState_RECOVERING",i[i.LiveTranscodingState_FAILURE=4]="LiveTranscodingState_FAILURE",i[i.LiveTranscodingState_END=5]="LiveTranscodingState_END",i))(xi||{}),Fe=(i=>(i[i.LiveTranscodingErrorPublishOk=0]="LiveTranscodingErrorPublishOk",i[i.LiveTranscodingErrorStreamNotFound=17825793]="LiveTranscodingErrorStreamNotFound",i[i.LiveTranscodingErrorStreamAlreadyExist=17825794]="LiveTranscodingErrorStreamAlreadyExist",i[i.LiveTranscodingErrorInvalidParam=17825795]="LiveTranscodingErrorInvalidParam",i[i.LiveTranscodingErrorInternalError=17825796]="LiveTranscodingErrorInternalError",i[i.LiveTranscodingErrorRtmpServerError=17825797]="LiveTranscodingErrorRtmpServerError",i[i.LiveTranscodingErrorRtmpStreamUrlError=17825798]="LiveTranscodingErrorRtmpStreamUrlError",i[i.LiveTranscodingErrorPublishTimeout=17825799]="LiveTranscodingErrorPublishTimeout",i[i.LiveTranscodingErrorNotAuthorized=17825800]="LiveTranscodingErrorNotAuthorized",i))(Fe||{}),Ui=(i=>(i[i.TrascodingPublishTaskStatusStart=0]="TrascodingPublishTaskStatusStart",i[i.TrascodingPublishTaskStatusUpdate=1]="TrascodingPublishTaskStatusUpdate",i[i.TrascodingPublishTaskStatusStop=2]="TrascodingPublishTaskStatusStop",i))(Ui||{}),we=(i=>(i[i.MPU_TASK_TRANSACTION_START=0]="MPU_TASK_TRANSACTION_START",i[i.MPU_TASK_TRANSACTION_UPDATE=1]="MPU_TASK_TRANSACTION_UPDATE",i[i.MPU_TASK_TRANSACTION_STOP=2]="MPU_TASK_TRANSACTION_STOP",i[i.MPU_TASK_TRANSACTION_LIST=3]="MPU_TASK_TRANSACTION_LIST",i[i.MPU_TASK_TRANSACTION_POLLING=4]="MPU_TASK_TRANSACTION_POLLING",i[i.MPU_TASK_TRANSACTION_ACKNOWLEDGE=5]="MPU_TASK_TRANSACTION_ACKNOWLEDGE",i[i.MPU_TASK_TRANSACTION_END=6]="MPU_TASK_TRANSACTION_END",i))(we||{});const Pa={0:"/libra/v1/sdk/start-task",1:"/libra/v1/sdk/update-task",2:"/libra/v1/sdk/stop-task",3:"/libra/v1/sdk/list-task",4:"/libra/v1/sdk/polling",5:"/libra/v1/sdk/acknowledge",6:"/"};class Bi{constructor(a,e,t,r,s,n,o,c){p(this,"videoWidth");p(this,"videoHeight");p(this,"videoFramerate",20);p(this,"videoBitrate",2e3);p(this,"videoGop",30);p(this,"audioSamplerate",qt.LiveTranscoding_HZ_44100);p(this,"audioBitrate",500);p(this,"audioChannels",1);this.videoWidth=a,this.videoHeight=e,t&&(this.videoFramerate=t),r&&(this.videoBitrate=r),s&&(this.videoGop=s),n&&(this.audioSamplerate=n),o&&(this.audioBitrate=o),c&&(this.audioChannels=c)}}const Hi=i=>((i&16711680)>>16)+(i&65280)+((i&255)<<16),Ce=(i=0,a)=>{if(a==0)return 0;let e=i/a;return e<0&&(e=0),e>1&&(e=1),e};class zt{constructor(a,e,t){p(this,"mixMode",It.LiveTranscodingSingle);p(this,"singleParam");p(this,"mixParam");a&&(this.mixMode=a),e&&(this.singleParam=e),t&&(this.mixParam=t)}toJson(a,e,t,r,s){const n={appid:e.appId,channelid:e.channelId};if(a===we.MPU_TASK_TRANSACTION_POLLING||a===we.MPU_TASK_TRANSACTION_LIST||a===we.MPU_TASK_TRANSACTION_ACKNOWLEDGE)return a===we.MPU_TASK_TRANSACTION_ACKNOWLEDGE&&(n.messageid=s),n;if(n.taskid=t,a!==we.MPU_TASK_TRANSACTION_STOP){if(n.mixmode=this.mixMode,r&&(n.streamurl=r),this.mixMode===It.LiveTranscodingSingle){const o=this.singleParam;if(o){n.streamtype=o.streamType,o.sourceType===St.LiveTranscodingShareScreen?n.sourcetype=Et[o.sourceType]:n.sourcetype=Et[St.LiveTranscodingCamera];const c=[];o.userId&&c.push(o.userId),n.subspecusers=c}}else if(a===we.MPU_TASK_TRANSACTION_START||a===we.MPU_TASK_TRANSACTION_UPDATE){const o=this.mixParam;if(o){o.taskProfile&&(n.taskprofile=Ta[o.taskProfile]);const c=o.encodeParam||new Bi(1280,720);let u=c.videoWidth,h=c.videoHeight;const l={};Object.keys(c).forEach(f=>{const m=c[f];m>0&&(l[f.toLowerCase()]=m)}),l.lowbitratehighquality=0,n.encodeparam=l,n.backgrounds=o.backgrounds.map(f=>f.toJson(u,h)),n.watermarks=o.watermarks.map(f=>f.toJson(u,h)),n.clockwidgets=o.clockWidgets.map(f=>f.toJson(u,h));const d=o.users.map(f=>f.userId);n.subspecusers=[...new Set(d)],n.layouts=[{audiomixcount:o.users.length,panes:o.users.map((f,m)=>f.toJson(m,u,h,o.mediaProcessMode))}],n.layoutids=["0"],n.cropmode=o.cropMode,n.backgroundcolor=Hi(o.backgroundColor),n.taskmode=o.mediaProcessMode}}}return n}}var Qe=(i=>(i.pre="pre",i.prod="prod",i))(Qe||{}),qe=(i=>(i.AliRtcSdkCommunication="communication",i.AliRtcSdkInteractiveLive="interactive_live",i.AliRtcSdkInteractiveWithLowLatencyLive="cdn_live",i))(qe||{}),Ze=(i=>(i.AliRtcSdkInteractive="interactive",i.AliRtcSdkLive="live",i))(Ze||{}),je=(i=>(i[i.AliEngineLocalDeviceTypeUnknown=0]="AliEngineLocalDeviceTypeUnknown",i[i.AliEngineLocalDeviceTypeMic=1]="AliEngineLocalDeviceTypeMic",i[i.AliEngineLocalDeviceTypeSpeaker=2]="AliEngineLocalDeviceTypeSpeaker",i[i.AliEngineLocalDeviceTypeAudioDevice=3]="AliEngineLocalDeviceTypeAudioDevice",i[i.AliEngineLocalDeviceTypeCamera=4]="AliEngineLocalDeviceTypeCamera",i[i.AliEngineLocalDeviceTypeDisplay=5]="AliEngineLocalDeviceTypeDisplay",i[i.AliEngineLocalDeviceTypeVideoDevice=6]="AliEngineLocalDeviceTypeVideoDevice",i))(je||{}),te=(i=>(i[i.AliEngineLocalDeviceExceptionTypeUnknown=0]="AliEngineLocalDeviceExceptionTypeUnknown",i[i.AliEngineLocalDeviceExceptionTypeMicOpenFail=1]="AliEngineLocalDeviceExceptionTypeMicOpenFail",i[i.AliEngineLocalDeviceExceptionTypeMicInterrupt=2]="AliEngineLocalDeviceExceptionTypeMicInterrupt",i[i.AliEngineLocalDeviceExceptionTypeMicAuthFail=3]="AliEngineLocalDeviceExceptionTypeMicAuthFail",i[i.AliEngineLocalDeviceExceptionTypeMicNotAvailable=4]="AliEngineLocalDeviceExceptionTypeMicNotAvailable",i[i.AliEngineLocalDeviceExceptionTypeSpeakerOpenFail=5]="AliEngineLocalDeviceExceptionTypeSpeakerOpenFail",i[i.AliEngineLocalDeviceExceptionTypeSpeakerInterrupt=6]="AliEngineLocalDeviceExceptionTypeSpeakerInterrupt",i[i.AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable=7]="AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable",i[i.AliEngineLocalDeviceExceptionTypeAudioDeviceException=8]="AliEngineLocalDeviceExceptionTypeAudioDeviceException",i[i.AliEngineLocalDeviceExceptionTypeCameraOpenFail=9]="AliEngineLocalDeviceExceptionTypeCameraOpenFail",i[i.AliEngineLocalDeviceExceptionTypeCameraInterrupt=10]="AliEngineLocalDeviceExceptionTypeCameraInterrupt",i[i.AliEngineLocalDeviceExceptionTypeCameraAuthFail=11]="AliEngineLocalDeviceExceptionTypeCameraAuthFail",i[i.AliEngineLocalDeviceExceptionTypeDisplayException=12]="AliEngineLocalDeviceExceptionTypeDisplayException",i[i.AliEngineLocalDeviceExceptionTypeVideoDeviceException=13]="AliEngineLocalDeviceExceptionTypeVideoDeviceException",i))(te||{}),q=(i=>(i[i.AliRtcConnectionStatusInit=0]="AliRtcConnectionStatusInit",i[i.AliRtcConnectionStatusDisconnected=1]="AliRtcConnectionStatusDisconnected",i[i.AliRtcConnectionStatusConnecting=2]="AliRtcConnectionStatusConnecting",i[i.AliRtcConnectionStatusConnected=3]="AliRtcConnectionStatusConnected",i[i.AliRtcConnectionStatusReconnecting=4]="AliRtcConnectionStatusReconnecting",i[i.AliRtcConnectionStatusFailed=5]="AliRtcConnectionStatusFailed",i))(q||{}),ct=(i=>(i[i.AliRtcConnectionChangedDummyReason=0]="AliRtcConnectionChangedDummyReason",i[i.AliRtcConnectionMediaPathChanged=1]="AliRtcConnectionMediaPathChanged",i[i.AliRtcConnectionSignalingHeartbeatTimeout=2]="AliRtcConnectionSignalingHeartbeatTimeout",i[i.AliRtcConnectionSignalingHeartbeatAlive=3]="AliRtcConnectionSignalingHeartbeatAlive",i[i.AliRtcConnectionSignalingHttpDnsResolved=4]="AliRtcConnectionSignalingHttpDnsResolved",i[i.AliRtcConnectionSignalingHttpDnsFailure=5]="AliRtcConnectionSignalingHttpDnsFailure",i[i.AliRtcConnectionSignalingGslbFailure=6]="AliRtcConnectionSignalingGslbFailure",i[i.AliRtcConnectionSignalingGslbSuccess=7]="AliRtcConnectionSignalingGslbSuccess",i[i.AliRtcConnectionSignalingJoinRoomFailure=8]="AliRtcConnectionSignalingJoinRoomFailure",i[i.AliRtcConnectionSignalingJoinRoomSuccess=9]="AliRtcConnectionSignalingJoinRoomSuccess",i[i.AliRtcConnectionSignalingLeaveRoom=10]="AliRtcConnectionSignalingLeaveRoom",i[i.AliRtcConnectionSignalingConnecting=11]="AliRtcConnectionSignalingConnecting",i[i.AliRtcConnectionChangedNetworkInterrupted=12]="AliRtcConnectionChangedNetworkInterrupted",i))(ct||{}),Fi=(i=>(i[i.AliRtcUserOfflineQuit=0]="AliRtcUserOfflineQuit",i[i.AliRtcUserOfflineDropped=1]="AliRtcUserOfflineDropped",i[i.AliRtcUserOfflineBecomeAudience=2]="AliRtcUserOfflineBecomeAudience",i))(Fi||{}),bt=(i=>(i[i.AliRtcAudioTrackNo=0]="AliRtcAudioTrackNo",i[i.AliRtcAudioTrackMic=1]="AliRtcAudioTrackMic",i[i.AliRtcAudioTrackDual=2]="AliRtcAudioTrackDual",i))(bt||{}),j=(i=>(i[i.AliRtcVideoTrackNo=0]="AliRtcVideoTrackNo",i[i.AliRtcVideoTrackCamera=1]="AliRtcVideoTrackCamera",i[i.AliRtcVideoTrackScreen=2]="AliRtcVideoTrackScreen",i[i.AliRtcVideoTrackBoth=3]="AliRtcVideoTrackBoth",i))(j||{}),B=(i=>(i[i.AliRtcStatePublishIdle=0]="AliRtcStatePublishIdle",i[i.AliRtcStateNoPublish=1]="AliRtcStateNoPublish",i[i.AliRtcStatePublishing=2]="AliRtcStatePublishing",i[i.AliRtcStatePublished=3]="AliRtcStatePublished",i))(B||{}),Z=(i=>(i[i.AliRtcStateSubscribeIdle=0]="AliRtcStateSubscribeIdle",i[i.AliRtcStateNoSubscribe=1]="AliRtcStateNoSubscribe",i[i.AliRtcStateSubscribing=2]="AliRtcStateSubscribing",i[i.AliRtcStateSubscribed=3]="AliRtcStateSubscribed",i))(Z||{}),oe=(i=>(i[i.AliRtcVideoStreamTypeNone=0]="AliRtcVideoStreamTypeNone",i[i.AliRtcVideoStreamTypeHigh=1]="AliRtcVideoStreamTypeHigh",i[i.AliRtcVideoStreamTypeLow=2]="AliRtcVideoStreamTypeLow",i))(oe||{}),Pt=(i=>(i[i.CAMERA_INVALID=-1]="CAMERA_INVALID",i[i.CAMERA_REAR=0]="CAMERA_REAR",i[i.CAMERA_FRONT=1]="CAMERA_FRONT",i))(Pt||{});const Fr=10,jr=5e3,pi=class pi extends X{constructor(e){super();p(this,"ws");p(this,"socketStatus",0);p(this,"wsUrl","");p(this,"lastConnectStartTime",0);p(this,"maxConnectRetryCount",Fr);p(this,"connectRetryCount",0);p(this,"gotErr",!1);p(this,"closedByInvoke",!0);p(this,"isReconnecting",!1);p(this,"networkAvailableChecked",!0);this.maxConnectRetryCount=e!=null?e:Fr,this.onOpen=this.onOpen.bind(this),this.onMessage=this.onMessage.bind(this),this.onError=this.onError.bind(this),this.onClose=this.onClose.bind(this)}get connectUrl(){return this.wsUrl}get connectStatus(){return this.socketStatus}start(e){this.wsUrl=e,this.initWebSocket()}send(e){return this.ws&&this.socketStatus===2?(this.ws.send(JSON.stringify(e)),!0):!1}close(){this.closedByInvoke=!0,this.uninitWebscoket()}reconnect(){this.emit("onReconnectStart"),this.isReconnecting=!0,this.initWebSocket()}onOpen(e){this.socketStatus=2,this.connectRetryCount=0,this.networkAvailableChecked=!1,this.closedByInvoke=!1,this.gotErr=!1,this.isReconnecting=!1,this.emit("onOpen",e)}onMessage(e){this.emit("onMessage",e)}onError(e){this.isReconnecting&&this.emit("onReconnectFail",e),this.emit("onError",e),this.isReconnecting=!1,this.gotErr=!0}onClose(e){return v(this,null,function*(){const t=this.socketStatus;if(A.info(pi.logName,`onClose, status: ${t}, retryCount: ${this.connectRetryCount}`),t!==0||this.connectRetryCount)if(yield Ye.isNetworkAvailable()){if(!this.networkAvailableChecked&&!this.closedByInvoke&&!this.gotErr){this.reconnect();return}this.networkAvailableChecked=!0,this.emit("onAuthInvalid")}else{if(this.connectRetryCount||this.emit("onNetworkError"),this.closedByInvoke)return;this.connectRetryCount+=1,this.connectRetryCount>this.maxConnectRetryCount?this.emit("onConnectFail"):Date.now()-this.lastConnectStartTime>=jr?this.reconnect():window.setTimeout(()=>{this.reconnect()},jr)}this.socketStatus=0,this.emit("onClose",e)})}initWebSocket(){this.uninitWebscoket(),this.socketStatus=1,this.lastConnectStartTime=Date.now(),this.ws=new WebSocket(this.wsUrl),this.ws.addEventListener("open",this.onOpen),this.ws.addEventListener("message",this.onMessage),this.ws.addEventListener("error",this.onError),this.ws.addEventListener("close",this.onClose)}uninitWebscoket(){this.ws&&(this.ws.removeEventListener("open",this.onOpen),this.ws.removeEventListener("message",this.onMessage),this.ws.removeEventListener("error",this.onError),this.ws.removeEventListener("close",this.onClose),this.ws.close(),this.ws=void 0,this.socketStatus=0)}};p(pi,"logName","Socket");let ji=pi;var ne=(i=>(i.KEEPALIVE="keepalive",i.JOINCHANNEL="joinchannel",i.NOTIFYJOIN="notifyjoin",i.NOTIFYSTATUS="notifystatus",i.STATUSREPORT="statusreport",i.LEAVECHANNEL="leavechannel",i.NOTIFYLEAVE="notifyleave",i.NOTIFYPUBLISH="notifypublish",i.BYE="bye",i.RECONNECT="reconnect",i.PUBLISH="publish",i.REFRESHURL="refreshurl",i.UNSUBSCRIBE="unsubscribe",i.ROLEUPDATE="roleupdate",i))(ne||{});class ka{constructor(a,e){p(this,"authInfo");p(this,"userName");p(this,"seqIndex",0);this.authInfo=a,this.userName=e}get roleAuth(){if(this.authInfo.role){const{timestamp:a,nonce:e,token:t,role:r}=this.authInfo;return{timestamp:a,nonce:e,token:t,tokenrole:r}}}refreshAuthInfo(a){this.authInfo=a}getSeqIndex(){return this.seqIndex}createKeepAlivePackage(){return this.createBaseSendPackage("keepalive")}createJoinPackage(){let a=this.createBaseSendPackage("joinchannel");return a.header.displayName=this.userName,a.header.clientversion=Ye.getVersionNumber().toString(),a.header.platform=Br,this.roleAuth&&(a.data.auth=this.roleAuth),a}crateLeavePackage(){return this.createBaseSendPackage("leavechannel")}createStatusPackage(a){let e=this.createBaseSendPackage("statusreport");return e.header.displayName=this.userName,e.data.status=a,e}createPublishPackage(){let a=this.createBaseSendPackage("publish");return a.data.users=[{}],this.roleAuth&&(a.data.auth=this.roleAuth),a}createRoleUpdatePackage(){let a=this.createBaseSendPackage("roleupdate");return a.header.displayName=this.userName,a}createReconnectPackage(a){let e=this.createBaseSendPackage("reconnect");return e.header.displayName=this.userName,e.header.clientversion=Ye.getVersionNumber().toString(),e.header.platform=Br,e.data=W(W({},e.data),a!=null?a:{}),this.roleAuth&&(e.data.auth=this.roleAuth),e}createRefreshUrlPackage(){let a=this.createBaseSendPackage("refreshurl");return a.header.displayName=this.userName,a}createResponsePackage(a,e){return{version:1,code:200,tid:a,msgtype:e}}createBaseSendPackage(a){var t;return++this.seqIndex,{version:1,msgtype:a,tid:x.Guid.create(32),header:{appid:this.authInfo.appId,channelid:this.authInfo.channelId,sessionid:(t=this.authInfo.callid)!=null?t:"",userid:this.authInfo.userId},data:{seq:this.seqIndex}}}}var T=(i=>(i[i.ERR_JOIN_ALREADY_JOINED=16843521]="ERR_JOIN_ALREADY_JOINED",i[i.ERR_JOIN_BAD_APPID=33620481]="ERR_JOIN_BAD_APPID",i[i.ERR_JOIN_INVALID_APPID=33620482]="ERR_JOIN_INVALID_APPID",i[i.ERR_JOIN_BAD_CHANNEL=33620484]="ERR_JOIN_BAD_CHANNEL",i[i.ERR_JOIN_INVALID_CHANNEL=33620483]="ERR_JOIN_INVALID_CHANNEL",i[i.ERR_JOIN_BAD_TOKEN=33620485]="ERR_JOIN_BAD_TOKEN",i[i.ERR_JOIN_TIMEOUT=16908804]="ERR_JOIN_TIMEOUT",i[i.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD=16974081]="ERR_JOIN_ERR_JOIN_BAD_PARAMBAD",i[i.ERR_JOIN_CHANNEL_FAILED=16974338]="ERR_JOIN_CHANNEL_FAILED",i[i.ERR_LOG_ALREADY_INIT=16974085]="ERR_LOG_ALREADY_INIT",i[i.ERR_LOG_ROOT_PATH_ERROR=16974086]="ERR_LOG_ROOT_PATH_ERROR",i[i.ERR_MIC_OPEN_FAIL=17040388]="ERR_MIC_OPEN_FAIL",i[i.ERR_SPEAKER_OPEN_FAIL=17040389]="ERR_SPEAKER_OPEN_FAIL",i[i.ERR_MIC_INTERRUPT=17040390]="ERR_MIC_INTERRUPT",i[i.ERR_SPEAKER_INTERRUPT=17040391]="ERR_SPEAKER_INTERRUPT",i[i.ERR_MIC_AUTH_FAIL=17040392]="ERR_MIC_AUTH_FAIL",i[i.ERR_MIC_NOT_AVAILABLE=17040393]="ERR_MIC_NOT_AVAILABLE",i[i.ERR_SPEAKER_NO_AVAILABLE=17040400]="ERR_SPEAKER_NO_AVAILABLE",i[i.ERR_CAMERA_OPEN_FAIL=17039620]="ERR_CAMERA_OPEN_FAIL",i[i.ERR_CAMERA_INTERRUPT=17039622]="ERR_CAMERA_INTERRUPT",i[i.ERR_VIDEO_DISPLAY_OPEN_FAIL=17039873]="ERR_VIDEO_DISPLAY_OPEN_FAIL",i[i.ERR_VIDEO_DISPLAY_INTERRUPT=1064992]="ERR_VIDEO_DISPLAY_INTERRUPT",i[i.ERR_ICE_CONNECTION_CONNECT_FAIL=17105409]="ERR_ICE_CONNECTION_CONNECT_FAIL",i[i.ERR_ICE_CONNECTION_RECONNECT_FAI=17105410]="ERR_ICE_CONNECTION_RECONNECT_FAI",i[i.ERR_ICE_CONNECTION_MOBILITY_FAIL=17105411]="ERR_ICE_CONNECTION_MOBILITY_FAIL",i[i.ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT=16908812]="ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT",i[i.ERR_LATENCY_LIVE_COMMUNICATION_FAILED=17235971]="ERR_LATENCY_LIVE_COMMUNICATION_FAILED",i[i.ERR_LATENCY_LIVE_MEIDASETTING_FAILED=17235972]="ERR_LATENCY_LIVE_MEIDASETTING_FAILED",i[i.ERR_LATENCY_LIVE_NONE_BROADCASTER=17235973]="ERR_LATENCY_LIVE_NONE_BROADCASTER",i[i.ERR_LATENCY_LIVE_NEED_RESTART=17235974]="ERR_LATENCY_LIVE_NEED_RESTART",i[i.ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER=17235975]="ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER",i[i.ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE=17235976]="ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE",i[i.ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION=17235977]="ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION",i[i.ERR_SDK_PUBLISH_INVAILD=16974597]="ERR_SDK_PUBLISH_INVAILD",i[i.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL=16843782]="ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL",i[i.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED=16843856]="ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED",i[i.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED=16843857]="ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED",i[i.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED=16843858]="ERR_SDK_PUBLISH_DUAL_STRAM_FAILED",i[i.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED=16843859]="ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED",i[i.ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR=16843860]="ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR",i[i.ERR_SDK_SUBSCRIBE_INVAILD=16974852]="ERR_SDK_SUBSCRIBE_INVAILD",i[i.ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL=16844112]="ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL",i[i.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED=16844113]="ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED",i[i.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED=16844114]="ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED",i[i.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED=16844115]="ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED",i[i.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED=16844116]="ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED",i[i.ERR_SDK_INVALID_STATE=16974340]="ERR_SDK_INVALID_STATE",i[i.ERR_INVALID_ARGUMENTS=16974083]="ERR_INVALID_ARGUMENTS",i[i.ERR_SESSION_REMOVED=33620229]="ERR_SESSION_REMOVED",i[i.ERR_SDK_UPDATE_ROLE_CHANNEL=16908801]="ERR_SDK_UPDATE_ROLE_CHANNEL",i[i.ERR_INNER=-1]="ERR_INNER",i[i.ERR_SDK_MPU_TASK_PUBLISH_OK=0]="ERR_SDK_MPU_TASK_PUBLISH_OK",i[i.ERR_SDK_MPU_TASK_STREAM_NOT_FOUND=17825793]="ERR_SDK_MPU_TASK_STREAM_NOT_FOUND",i[i.ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST=17825794]="ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST",i[i.ERR_SDK_MPU_TASK_INVALID_PARAM=17825795]="ERR_SDK_MPU_TASK_INVALID_PARAM",i[i.ERR_SDK_MPU_TASK_INTERNAL_ERROR=17825796]="ERR_SDK_MPU_TASK_INTERNAL_ERROR",i[i.ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR=17825797]="ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR",i[i.ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR=17825798]="ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR",i[i.ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT=17825799]="ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT",i[i.ERR_SDK_MPU_TASK_NOT_AUTHORIZED=17825800]="ERR_SDK_MPU_TASK_NOT_AUTHORIZED",i[i.ERR_SDK_CHANNEL_RELAY_STATE_ERROR=18874369]="ERR_SDK_CHANNEL_RELAY_STATE_ERROR",i[i.ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW=18874370]="ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW",i[i.ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED=18874371]="ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED",i[i.ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID=18874372]="ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID",i[i.ERR_SDK_CHANNEL_RELAY_ROLE_ERROR=18874373]="ERR_SDK_CHANNEL_RELAY_ROLE_ERROR",i[i.ERR_SDK_CHANNEL_RELAY_INVALID_PARAM=18874374]="ERR_SDK_CHANNEL_RELAY_INVALID_PARAM",i[i.ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR=18874375]="ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR",i))(T||{});class E extends Error{constructor(e,t,r){super(t);p(this,"_code");p(this,"_extra");this._code=e,this._extra=r}static fromError(e,t=-1,r=""){return new E(t,e.message||e.reason||r||"error",e.extraInfo)}get code(){return this._code}set code(e){this._code=e}get reason(){return this.message}get extra(){return this._extra}}const Ca=3e4,Ae=class Ae extends X{constructor(e,t,r,s,n){super();p(this,"authInfo");p(this,"userName");p(this,"channelProfile");p(this,"clientRole");p(this,"wsClient");p(this,"packageCreater");p(this,"keepAliveTimer",0);p(this,"packageCache",new Map);p(this,"isFirstConnect",!0);p(this,"aliveChecker",0);p(this,"reconnectData");this.authInfo=e,this.userName=t,this.packageCreater=new ka(e,t),this.channelProfile=r,this.clientRole=s,this.wsClient=new ji(n),this.wsClient.on("onOpen",this.onOpen.bind(this)),this.wsClient.on("onMessage",this.onMessage.bind(this)),this.wsClient.on("onError",this.onError.bind(this)),this.wsClient.on("onClose",this.onClose.bind(this)),this.wsClient.on("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.on("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.on("onNetworkError",this.onNetworkError.bind(this)),this.wsClient.on("onReconnectStart",this.onReconnectStart.bind(this)),this.wsClient.on("onReconnectFail",this.onReconnectFail.bind(this))}start(e){this.wsClient.start(e)}startKeepAlive(){this.keepAliveTimer===0&&(this.keepAliveTimer=window.setInterval(()=>{let e=this.packageCreater.createKeepAlivePackage();this.sendPackage(e)},5e3)),this.checkAlive()}stopKeepAlive(){this.keepAliveTimer!==0&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=0),this.aliveChecker&&(window.clearTimeout(this.aliveChecker),this.aliveChecker=0)}sendPkgCache(){this.packageCache.forEach(e=>{this.wsClient.send(e)})}leave(){let e=this.packageCreater.crateLeavePackage();this.sendPackage(e)}reportStatus(e){let t=this.packageCreater.createStatusPackage(e);this.sendPackage(t)}publish(e){let t=this.packageCreater.createPublishPackage();t.data.users=[],e.subscribe.signal=this.wsClient.connectUrl;const{tracks:r,resume:s}=e;r.forEach(n=>{const{codec:o,ssrc:c}=n;n.userdata=JSON.stringify({codec:o}),n.ssrc=`${c}`,s&&(n.attr={reason:"reconnect"})}),t.data.users.push(e),this.sendPackage(t)}roleUpdate(e){let t=this.packageCreater.createRoleUpdatePackage();t.data.clientrole=e,this.sendPackage(t)}refreshUrl(e){const t=this.packageCreater.createRefreshUrlPackage();t.data=W(_t(W({},t.data),{sessionid:t.header.sessionid}),e),this.sendPackage(t)}refreshAuthInfo(e){this.authInfo=e,this.packageCreater.refreshAuthInfo(e)}close(){A.info(`[${Ae.logName}] close`),this.stopKeepAlive(),this.wsClient.off("onOpen",this.onOpen.bind(this)),this.wsClient.off("onMessage",this.onMessage.bind(this)),this.wsClient.off("onError",this.onError.bind(this)),this.wsClient.off("onClose",this.onClose.bind(this)),this.wsClient.off("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.off("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.off("onReconnectStart"),this.wsClient.off("onReconnectFail"),this.wsClient.close()}sendPackage(e){[ne.KEEPALIVE,ne.RECONNECT,ne.JOINCHANNEL].includes(e.msgtype)||this.packageCache.set(e.tid,e),this.wsClient.send(e)}updateReconnectData(e){this.reconnectData=e}onOpen(){if(A.info(`[${Ae.logName}] onOpen`),this.isFirstConnect){let e=this.packageCreater.createJoinPackage();e.data.configure={channelprofile:this.channelProfile},(this.channelProfile===qe.AliRtcSdkInteractiveLive||this.channelProfile===qe.AliRtcSdkInteractiveWithLowLatencyLive)&&(e.data.configure.clientrole=this.clientRole),this.sendPackage(e)}else{this.stopKeepAlive();const e=this.packageCreater.createReconnectPackage(this.reconnectData);this.sendPackage(e)}}onMessage(e){try{let t=JSON.parse(e.data);this.packageCache.delete(t.tid),this.onRecvMessage(t)}catch(t){A.warn(`[${Ae.logName}] onMessage err`,t,e)}}onError(e){A.warn(`[${Ae.logName}] onError`,e),this.isFirstConnect&&this.onConnectFail()}onConnectFail(){A.warn(`[${Ae.logName}] onConnectFail`);const e=new E(T.ERR_INNER,"Signaling connect failed.");this.isFirstConnect?this.emit("onJoinChannelResult",e):this.emit("onConnectFail",e)}onAuthInvalid(){A.warn(`[${Ae.logName}] onAuthInvalid`),this.isFirstConnect&&this.emit("onAuthInvalid")}onNetworkError(){A.warn(`[${Ae.logName}] onNetworkError`);const e=new E(T.ERR_INNER,"Network error, signaling connect failed.");this.emit("onNetworkError",e)}onClose(e){A.info(`[${Ae.logName}] onClose`,e),this.stopKeepAlive()}onKeepAliveRsp(){this.emit("onKeepAliveRsp"),this.checkAlive()}onReconnectStart(){this.emit("onReconnectStart")}onReconnectFail(){this.emit("onReconnectFail",new E(T.ERR_INNER,"signaling reconnect failed."))}checkAlive(){window.clearTimeout(this.aliveChecker),this.aliveChecker=window.setTimeout(()=>{A.info(`[${Ae.logName}] not alive, reconnect`),this.stopKeepAlive(),this.emit("onReconnectStart"),this.wsClient.reconnect()},Ca)}onRecvMessage(e){switch(e.msgtype!==ne.KEEPALIVE&&A.info(`[${Ae.logName}] recv msg: ${e.msgtype}`),e.msgtype){case ne.JOINCHANNEL:this.onJoinResult(e);break;case ne.KEEPALIVE:this.onKeepAliveRsp();break;case ne.PUBLISH:this.onPublishResult(e);break;case ne.NOTIFYJOIN:this.onNotifyJoin(e);break;case ne.NOTIFYSTATUS:this.onNotifyStatus(e);break;case ne.LEAVECHANNEL:this.onLeaveResult(e);break;case ne.NOTIFYLEAVE:this.onNotifyLeave(e);break;case ne.NOTIFYPUBLISH:this.onNotifyPublish(e);break;case ne.STATUSREPORT:this.onStatusReport(e);break;case ne.BYE:this.onBye(e);break;case ne.ROLEUPDATE:this.onRoleUpdateResult(e);break;case ne.REFRESHURL:this.onRefreshUrlResult(e);break;case ne.RECONNECT:this.onReconnectResult(e);break}}onJoinResult(e){this.isFirstConnect=!1,this.emit("onJoinChannelResult",e)}onLeaveResult(e){this.emit("onLeaveResult",e.code,e.tid)}onPublishResult(e){this.emit("onPublishResult",e.code,e.tid,e.description)}onRoleUpdateResult(e){this.emit("onRoleUpdateResult",e.code,e.tid,e.description)}onRefreshUrlResult(e){this.emit("onRefreshUrlResult",e)}onReconnectResult(e){if(e.code===200)this.sendPkgCache(),this.startKeepAlive(),this.emit("onReconnectSuccess",e.data.users);else{const t=new E(T.ERR_INNER,`reconnect failed, code: ${e.code};description: ${e.description}`);e.code===403&&(t.code=403),this.emit("onReconnectFail",t),this.close()}}onNotifyJoin(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e&&e.data&&e.data.users&&this.emit("onNotifyJoin",e.data.users)}onNotifyStatus(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.status&&e.data.status.length&&this.emit("onNotifyStatus",e.data.status)}onNotifyLeave(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.users&&e.data.users.length&&this.emit("onNotifyLeave",e.data.users)}onNotifyPublish(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.users&&e.data.users.length&&this.emit("onNotifyPublish",e.data.users)}onStatusReport(e){this.emit("onStatusReport",e.code,e.tid,e.description)}onBye(e){this.stopKeepAlive(),this.emit("onBye",e.reason,e.description)}};p(Ae,"logName","RSMessageCenter");let $i=Ae;const y=(i,a)=>(e,t,r)=>{const s=r.value;return r.value=function(...n){var l;const o=`[${((l=e.constructor)==null?void 0:l.logName)||""}]`,c=Date.now();let u=[];i&&(u=i(n)),A.interface(o,t,...u);const h=s.apply(this,n);return Promise.resolve(h).then(d=>d).catch(d=>d).then(d=>{var S;let f="";const m=d instanceof Error,g=m&&((S=e.constructor)==null?void 0:S.logError);if(!(!a&&!m)){if(g)f=d;else if(m)f=d.message||"";else if(a)d===void 0?f="":f=a(d);else return;A.interfaceResult(o,t,!(m&&g),`${Date.now()-c}ms`,f)}}),h},r},I=i=>i;var Ma=Object.defineProperty,Na=Object.getOwnPropertyDescriptor,Wi=(i,a,e,t)=>{for(var r=t>1?void 0:t?Na(a,e):a,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(t?n(a,e,r):n(r))||r);return t&&r&&Ma(a,e,r),r};const Xt=(_e=class extends X{constructor(e,t,r=Qe.prod){super();p(this,"messageCenter");p(this,"authInfo");p(this,"userName");p(this,"channelProfile");p(this,"clientRole");p(this,"reconnectData");p(this,"roomServerUri","");this.channelProfile=e,this.clientRole=t,this.reconnectData={role:{channelprofile:e,clientrole:t}};const s=r===Qe.pre?Kt.pre:Kt.prod;this.roomServerUri=`wss://${s}/roomserver/v1/ws`}updateReconnectData(e){var t;this.reconnectData=e,(t=this.messageCenter)==null||t.updateReconnectData(this.reconnectData)}reset(){A.info("[roomsig] reset"),this.messageCenter&&(this.messageCenter.close(),this.messageCenter=void 0),this.authInfo=void 0}join(e,t,r){return v(this,null,function*(){return new Promise((s,n)=>{A.setTraceID(e.channelId+"-"+e.callid),this.authInfo=e,this.userName=t,this.messageCenter=new $i(e,t,this.channelProfile,this.clientRole,r),this.initMessageCenter(),this.messageCenter.once("onJoinChannelResult",c=>{var u,h;if(A.info("join result: ",c),c.code==200){(u=this.messageCenter)==null||u.sendPkgCache(),(h=this.messageCenter)==null||h.startKeepAlive();let l=c.data;l.tid=c.tid,l.users=c.data.users,l.timestamp=c.timestamp,s(l)}else this.reset(),n(this.handleSignalError(c.code,c.reason,T.ERR_JOIN_CHANNEL_FAILED))}),this.messageCenter.once("onAuthInvalid",()=>{this.reset(),n(new E(T.ERR_JOIN_BAD_TOKEN,"join failed because authentication failed"))}),A.info(`[${_e.logName}]`,"start ws connecting roomserver and auto join when connected");const o={appid:this.authInfo.appId,callid:this.authInfo.callid,channelid:this.authInfo.channelId,userid:this.authInfo.userId,nonce:this.authInfo.nonce||"",timestamp:this.authInfo.timestamp,token:this.authInfo.token,authtype:"app",tid:x.Guid.create(32)};e.role&&(o.tokenrole=e.role),this.messageCenter.start(this.roomServerUri+"?"+Ye.queryingParam(o))})})}leave(){return A.info("[roomsig] leave .."),new Promise((e,t)=>{this.messageCenter?(this.messageCenter.on("onLeaveResult",(r,s)=>{A.info(`[${_e.logName}]`,"recv leave response "+r),r===200?(this.updateReconnectData(),this.reset(),e({tid:s})):t(this.handleSignalError(r,"leave error"))}),A.info(`[${_e.logName}]`,"send leave request"),this.messageCenter.leave()):(A.info(`[${_e.logName}]`,"no message center, ok to leave"),e({tid:""}))})}publish(e){return new Promise((t,r)=>{var s;this.messageCenter?(this.messageCenter.once("onPublishResult",(n,o,c)=>{A.info(`[${_e.logName}]`,"recv pubish response "+n),n===200?(this.updateReconnectData(_t(W({},this.reconnectData),{publish:{users:[e]}})),t({tid:o})):r(this.handleSignalError(n,`publish error, ${c}`))}),this.authInfo&&(e.sessionid=(s=this.authInfo.callid)!=null?s:""),e.callid=x.Guid.create(32),A.info(`[${_e.logName}]`,"assign callid "+e.callid+" and send publish request"),this.messageCenter.publish(e)):r(this.handleSignalError(-1,"publish error, no message center"))})}roleUpdate(e){return new Promise((t,r)=>{if(!this.messageCenter){r(this.handleSignalError(-1,"role update error, no message center"));return}this.messageCenter.on("onRoleUpdateResult",(s,n,o)=>{var c,u;A.info(`[${_e.logName}]`,"recv role update response "+s),s===200?((u=(c=this.reconnectData)==null?void 0:c.role)!=null&&u.clientrole&&(this.reconnectData.role.clientrole=e,this.updateReconnectData(this.reconnectData)),t({tid:n})):r(this.handleSignalError(s,`role update error, ${o}`))}),this.messageCenter.roleUpdate(e)})}setChannelProfile(e){this.channelProfile=e}refreshUrl(e){return A.info(`[${_e.logName}]`,"refreshUrl .."),new Promise((t,r)=>{if(!this.messageCenter){r(this.handleSignalError(-1,"refresh url error, no message center"));return}this.messageCenter.on("onRefreshUrlResult",s=>{const{code:n,description:o,data:c={}}=s||{};A.info("recv refresh url response "+n),n===200?t(c):r(this.handleSignalError(n,`refresh url error, ${o}`))}),A.info("send refresh url request"),this.messageCenter.refreshUrl(e)})}reportStatus(e){return A.info(`[${_e.logName}]`,"reportStatus "+e),new Promise((t,r)=>{this.messageCenter?(this.messageCenter.once("onStatusReport",(s,n)=>{s===200?t():r(new E(s,n))}),this.messageCenter.reportStatus(e)):r(new E(-1,"No messageCenter"))})}handleSignalError(e,t,r=T.ERR_INNER){const s=`signal error: code - ${e}; description - ${t}`;return new E(r,s)}refreshAuthInfo(e){return v(this,null,function*(){var t;this.authInfo&&(this.authInfo=e,(t=this.messageCenter)==null||t.refreshAuthInfo(this.authInfo))})}initMessageCenter(){var e,t,r,s,n,o,c,u,h,l,d,f;(e=this.messageCenter)==null||e.on("onKeepAliveRsp",()=>{this.emit("onKeepAliveRsp")}),(t=this.messageCenter)==null||t.on("onNotifyJoin",m=>{this.emit("onNotifyJoin",m)}),(r=this.messageCenter)==null||r.on("onNotifyStatus",m=>{this.emit("onNotifyStatus",m)}),(s=this.messageCenter)==null||s.on("onNotifyLeave",m=>{this.emit("onNotifyLeave",m)}),(n=this.messageCenter)==null||n.on("onNotifyPublish",m=>{this.emit("onNotifyPublish",m)}),(o=this.messageCenter)==null||o.on("onBye",(m,g)=>{this.emit("onBye",m,g)}),(c=this.messageCenter)==null||c.on("onReconnectStart",()=>{this.emit("onReconnectStart")}),(u=this.messageCenter)==null||u.on("onReconnectSuccess",m=>{this.emit("onReconnectSuccess",m)}),(h=this.messageCenter)==null||h.on("onReconnectFail",m=>{this.emit("onReconnectFail",m)}),(l=this.messageCenter)==null||l.on("onConnectFail",m=>{this.emit("onConnectFail",m),this.reset()}),(d=this.messageCenter)==null||d.on("onNetworkError",m=>{this.emit("onNetworkError",m)}),(f=this.messageCenter)==null||f.on("onAuthInvalid",()=>{this.emit("onAuthInvalid")})}},p(_e,"logName","RoomServerSignaling"),_e);Wi([y()],Xt.prototype,"join",1),Wi([y()],Xt.prototype,"publish",1),Wi([y()],Xt.prototype,"roleUpdate",1);let La=Xt;class Oa extends X{constructor(e,t,r=Qe.prod){super();p(this,"signaling");p(this,"authInfo");p(this,"userName");p(this,"channelProfile");p(this,"clientRole");p(this,"env",Qe.prod);p(this,"maxConnectRetryCount");this.channelProfile=e,this.clientRole=t,this.env=r}reset(){var e;A.info("[signalingmanager] reset"),(e=this.signaling)==null||e.reset(),this.signaling=void 0,this.authInfo=void 0}join(e,t=e.userId,r){return this.maxConnectRetryCount=r,this.userName=t,new Promise((s,n)=>{this.signaling?n(new E(T.ERR_JOIN_ALREADY_JOINED,"already joined")):(A.info("[signalingmanager] create signaling"),this.signaling=new La(this.channelProfile,this.clientRole,this.env),this.initSignaling(),this.signaling.join(e,t,r).then(o=>{this.authInfo=e,s(o)}).catch(o=>{this.reset(),n(o)}))})}retryJoin(){const e=this.authInfo;this.reset(),e&&this.join(e,this.userName,this.maxConnectRetryCount)}leave(){return new Promise((e,t)=>{this.signaling?this.signaling.leave().then(r=>{this.reset(),e(r)}).catch(r=>{t(r)}):e({tid:""})})}publish(e){return new Promise((t,r)=>{var s;this.signaling&&this.authInfo?(e.userid=this.authInfo.userId,e.displayname=(s=this.userName)!=null?s:this.authInfo.userId,this.signaling.publish(e).then(n=>{t(n)}).catch(n=>{r(n)})):r(new E(T.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL,"no signaling"))})}reportStatus(e){return new Promise((t,r)=>{this.signaling?this.signaling.reportStatus(e).then(()=>{t()}).catch(s=>{r(s)}):r(new E(-1,"no signaling"))})}setClientRole(e){return v(this,null,function*(){if(!this.signaling){this.clientRole=e;return}return yield this.signaling.roleUpdate(e)})}setChannelProfile(e){this.signaling?this.signaling.setChannelProfile(e):this.channelProfile=e}refreshUrl(e){return this.signaling?this.signaling.refreshUrl(e):Promise.reject(new E(T.ERR_SDK_INVALID_STATE,"should join first"))}refreshAuthInfo(e){return v(this,null,function*(){var t;try{this.authInfo&&(this.authInfo=W(W({},this.authInfo),e),(t=this.signaling)==null||t.refreshAuthInfo(this.authInfo))}catch(r){throw r}})}initSignaling(){var e,t,r,s,n,o,c,u,h,l,d,f,m;(e=this.signaling)==null||e.on("onKeepAliveRsp",this.onKeepAliveRsp.bind(this)),(t=this.signaling)==null||t.on("onNotifyJoin",this.onNotifyJoin.bind(this)),(r=this.signaling)==null||r.on("onNotifyStatus",this.onNotifyStatus.bind(this)),(s=this.signaling)==null||s.on("onNotifyLeave",this.onNotifyLeave.bind(this)),(n=this.signaling)==null||n.on("onNotifyPublish",this.onNotifyPublish.bind(this)),(o=this.signaling)==null||o.on("onBye",this.onBye.bind(this)),(c=this.signaling)==null||c.on("onReconnectStart",this.onReconnectStart.bind(this)),(u=this.signaling)==null||u.on("onReconnectSuccess",this.onReconnectSuccess.bind(this)),(h=this.signaling)==null||h.on("onReconnectFail",this.onReconnectFail.bind(this)),(l=this.signaling)==null||l.on("onConnectFail",this.onConnectFail.bind(this)),(d=this.signaling)==null||d.on("onNetworkError",this.onNetworkError.bind(this)),(f=this.signaling)==null||f.on("onAuthInvalid",this.onAuthInvalid.bind(this)),(m=this.signaling)==null||m.on("onError",this.onError.bind(this))}onKeepAliveRsp(){this.emit("onKeepAliveRsp")}onNotifyJoin(e){this.emit("onNotifyJoin",e)}onNotifyStatus(e){this.emit("onNotifyStatus",e)}onNotifyLeave(e){this.emit("onNotifyLeave",e)}onNotifyPublish(e){this.emit("onNotifyPublish",e)}onBye(e,t){this.emit("onBye",e,t)}onConnectFail(e){this.reset(),this.emit("onConnectFail",e)}onNetworkError(e){this.emit("onNetworkError",e)}onAuthInvalid(e){}onReconnectStart(){this.emit("onReconnectStart")}onReconnectSuccess(e){this.emit("onReconnectSuccess",e)}onReconnectFail(e){this.emit("onReconnectFail",e)}onError(e){this.emit("onError",e)}}const pt=class pt{static getInstance(){return pt.instance||(pt.instance=new AudioContext),pt.instance.resume(),pt.instance}};p(pt,"instance");let Ki=pt;function Va(i,a,e,t,r){let s=t,n=0,o;const c=i.createAnalyser();c.fftSize=256;const u=new Uint8Array(c.frequencyBinCount);a.connect(c),c.connect(e);const h=()=>{o&&window.clearInterval(o)},l=()=>{o=window.setInterval(()=>{c.getByteFrequencyData(u);let d=Math.round(u.reduce((f,m)=>f+m)/u.length);d=Math.min(100,d),n=d,r&&r(d)},s)};return l(),{updateInterval:d=>{h(),s=d,l()},getLevel:()=>n,dispose:()=>{h(),a.disconnect(),c.disconnect()}}}class Da extends X{constructor(){super();p(this,"audioContext");p(this,"stream");p(this,"sourceNode");p(this,"analyser");this.audioContext=Ki.getInstance(),this.stream=new MediaStream}getLevel(){return this.analyser?this.analyser.getLevel():0}start(e,t=1e3){this.sourceNode&&this.stop(),this.stream.addTrack(e),this.sourceNode=this.audioContext.createMediaStreamSource(this.stream);const r=this.audioContext.createMediaStreamDestination();this.analyser=Va(this.audioContext,this.sourceNode,r,t,s=>{this.emit("audioLevel",s)})}stop(){this.analyser&&this.analyser.dispose(),this.analyser=void 0,this.sourceNode=void 0,this.stream.getAudioTracks().forEach(e=>{this.stream.removeTrack(e)})}dispose(){this.stop()}}class $r extends X{constructor(e,t,r,s){super();p(this,"uid");p(this,"name");p(this,"rtsManager");p(this,"callid","");p(this,"audioLevelMonitor");p(this,"audioVolumeIndicationInterval",0);this.uid=e,this.name=t,this.rtsManager=r,this.audioVolumeIndicationInterval=s,this.audioLevelMonitor=new Da}get userId(){return this.uid}get displayname(){return this.name}setUserInfo(e,t){this.uid=e,this.name=t}refreshUserInfo(e){this.uid=e}getAudioLevel(){return this.audioLevelMonitor.getLevel()}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval=e}clear(){this.audioLevelMonitor.dispose()}}class Wr{static getCurrentStatus(a){let e=0;a.micOpen&&(e+=1),a.micInterrupted&&(e+=2),a.cameraOpen&&(e+=4),a.screenShare&&(e+=128),a.audioDisable&&(e+=8),a.videoDisable&&(e+=16),a.screenDisable&&(e+=256);let t=e.toString(16);for(;t.length<16;)t="0"+t;return t}static parseStatus(a){let e=parseInt(a,16);return{micOpen:!!(e&1),micInterrupted:!!(e&2),cameraOpen:!!(e&4),screenShare:!!(e&128),audioDisable:!!(e&8),videoDisable:!!(e&16),screenDisable:!!(e&256),backgroundMode:!!(e&32),accompanyPlaying:!!(e&64)}}}const Kr="customVideoProfile",Jr="customScreenProfile",kt={width:1280,height:720,frameRate:30,maxBitrate:2e3},Ct={width:1920,height:1080,frameRate:30,maxBitrate:2600},xa={1e4:te.AliEngineLocalDeviceExceptionTypeUnknown,2e4:te.AliEngineLocalDeviceExceptionTypeUnknown,10001:te.AliEngineLocalDeviceExceptionTypeMicNotAvailable,10002:te.AliEngineLocalDeviceExceptionTypeMicAuthFail,10003:te.AliEngineLocalDeviceExceptionTypeMicOpenFail,10005:te.AliEngineLocalDeviceExceptionTypeCameraAuthFail,10004:te.AliEngineLocalDeviceExceptionTypeVideoDeviceException,10006:te.AliEngineLocalDeviceExceptionTypeCameraOpenFail,10010:te.AliEngineLocalDeviceExceptionTypeDisplayException,10011:te.AliEngineLocalDeviceExceptionTypeDisplayException,10012:te.AliEngineLocalDeviceExceptionTypeDisplayException,10013:te.AliEngineLocalDeviceExceptionTypeDisplayException,10014:te.AliEngineLocalDeviceExceptionTypeDisplayException,10019:te.AliEngineLocalDeviceExceptionTypeDisplayException},Ua=i=>i.getAudioTracks()[0];function qr(i){var a;if(((a=i==null?void 0:i.nodeName)==null?void 0:a.toLowerCase())==="video")return i.setAttribute("playsinline",""),i;if(typeof i=="string"){let e=document.getElementById(i);if(e){if(e.nodeName.toLocaleLowerCase()==="video")return e.setAttribute("playsinline",""),e;throw new E(T.ERR_INVALID_ARGUMENTS,"element should be HtmlVideoElement")}else throw new E(T.ERR_INVALID_ARGUMENTS,"element not founded")}else throw new E(T.ERR_INVALID_ARGUMENTS,"element id should be string")}function Ji(i){var e;const a=[];if(Array.isArray(i))i.forEach(t=>{try{a.push(qr(t))}catch(r){}});else if(typeof i=="string"||((e=i==null?void 0:i.nodeName)==null?void 0:e.toLowerCase())==="video")try{a.push(qr(i))}catch(t){}return a}function et(i){return new Promise(a=>setTimeout(a,i))}const Gr=(i,a)=>{const e=()=>(i.muted=!0,Promise.race([et(500),i._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{let t;return i.srcObject!==a?(i.load(),i.srcObject=a,t=i.play(),i._playPromise=t):t=Promise.resolve(),t}));return new Promise(t=>{if(x.BrowserUtil.isMicroMessenger){const r=window.top!==window.self,s=window.WeixinJSBridge||window.top.WeixinJSBridge;s?s.invoke("getNetworkType",{},()=>{t(e())}):(r?window.top.document:document).addEventListener("WeixinJSBridgeReady",()=>{s.invoke("getNetworkType",{},()=>{t(e())})}),setTimeout(()=>{t(e())},1e3)}else t(e())})},tt=i=>{Promise.race([et(100),i._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{i.srcObject=null,i._playPromise=void 0})};var Ba=Object.defineProperty,Ha=Object.getOwnPropertyDescriptor,se=(i,a,e,t)=>{for(var r=t>1?void 0:t?Ha(a,e):a,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(t?n(a,e,r):n(r))||r);return t&&r&&Ba(a,e,r),r};class Yt extends X{constructor(){super();p(this,"state");p(this,"time");this.state=B.AliRtcStatePublishIdle,this.time=Date.now()}setState(e){const t=this.state,r=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-r)/1e3))}}const ie=(rt=class extends $r{constructor(e){const{rtsManager:t,localStreamManager:r,reporter:s,webTrackingClient:n,signalingManager:o,audioVolumeIndicationInterval:c}=e;super("","",t,c);p(this,"url","");p(this,"_isPublishing",!1);p(this,"publishPromise",Promise.resolve(""));p(this,"previewElements",[]);p(this,"screenPreviewElements",[]);p(this,"streamManager");p(this,"streamTracks");p(this,"publishId",x.Guid.create(16));p(this,"signalingManager");p(this,"traceId","");p(this,"monitorTimerId");p(this,"reporter");p(this,"webTrackingClient");p(this,"audioPubState");p(this,"videoPubState");p(this,"videoSmallPubState");p(this,"screenPubState");p(this,"onTrackEnd",e=>{this.emit(e)});this.streamManager=r,this.signalingManager=o,this.reporter=s,this.webTrackingClient=n,this.streamManager.on("trackended",u=>{this.onTrackEnd(u)}),this.streamManager.on("publishupdate",()=>{this.publishUpdate()}),this.audioPubState=new Yt,this.audioPubState.on("change",(u,h,l)=>{this.emit("audioPublishStateChanged",u,h,l)}),this.videoPubState=new Yt,this.videoPubState.on("change",(u,h,l)=>{this.emit("videoPublishStateChanged",u,h,l)}),this.videoSmallPubState=new Yt,this.videoSmallPubState.on("change",(u,h,l)=>{this.emit("dualStreamPublishStateChanged",u,h,l)}),this.screenPubState=new Yt,this.screenPubState.on("change",(u,h,l)=>{this.emit("screenPublishStateChanged",u,h,l)})}get joined(){return!!this.uid}get isPublishing(){return this._isPublishing}get publishStreams(){return this.streamManager.publishStreams}get cameraTrack(){return this.streamManager.cameraStreamInfo.originVideoTrack}get screenTrack(){return this.streamManager.screenStreamInfo.originVideoTrack}get audioTrack(){return this.streamManager.cameraStreamInfo.originAudioTrack}get hasCamera(){return!!this.streamManager.cameraStreamInfo.originVideoTrack}get hasMicrophone(){return!!this.streamManager.cameraStreamInfo.originAudioTrack}get hasScreenShare(){return!!this.streamManager.screenStreamInfo.originVideoTrack}get hasCameraTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:s})=>r==="video"&&t&&s===M.VideoLarge))}get hasCameraDualTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:s})=>r==="video"&&t&&s===M.VideoSmall))}get hasScreenTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:s})=>r==="video"&&t&&s===M.Screen))}get hasAudioTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:s})=>r==="audio"&&t&&s===M.Audio))}get cameraDirection(){var e,t;return(t=(e=this.streamManager.cameraStreamInfo)==null?void 0:e.cameraVideoConstraints)==null?void 0:t.facingMode}get audioCaptureDisabled(){return this.streamManager.audioCaptureDisabled}get cameraCaptureDisabled(){return this.streamManager.cameraCaptureDisabled}get publishLocalVideoStreamEnabled(){return this.streamManager.publishLocalVideoStreamEnabled}get publishLocalAudioStreamEnabled(){return this.streamManager.publishLocalAudioStreamEnabled}get publishLocalScreenStreamEnabled(){return this.streamManager.publishLocalScreenStreamEnabled}setPublishLocalAudioStreamEnabled(e){this.streamManager.publishLocalAudioStreamEnabled=e}setPublishLocalVideoStreamEnabled(e){this.streamManager.publishLocalVideoStreamEnabled=e}setPublishLocalScreenStreamEnabled(e){this.streamManager.publishLocalScreenStreamEnabled=e}initInfo(e,t){var r;this.setUserInfo(e.userId,e.userId),this.url=t,this.callid=(r=e.callid)!=null?r:"",this.updatePubId()}setVideoProfile(e,t){return v(this,null,function*(){yield this.streamManager.setVideoProfile(e,t)})}setVideoContentHint(e){this.streamManager.setVideoContentHint(e)}setScreenContentHint(e){this.streamManager.setScreenContentHint(e)}setAudioProfile(e){return v(this,null,function*(){yield this.streamManager.setAudioProfile(e)})}setScreenProfile(e,t){return v(this,null,function*(){yield this.streamManager.setScreenProfile(e,t)})}setCameraDirection(e){if(e===Pt.CAMERA_FRONT)this.streamManager.setCameraVideoConstraints({facingMode:"user"});else if(e===Pt.CAMERA_REAR)this.streamManager.setCameraVideoConstraints({facingMode:"environment"});else throw new E(T.ERR_CAMERA_OPEN_FAIL,`camera direction set to ${e} failed`)}setCameraDeviceId(e){this.streamManager.setCameraVideoConstraints({deviceId:e})}muteLocalCamera(e){this.streamManager.setCameraMuted(e)}muteLocalMic(e){this.streamManager.setAudioMuted(e)}muteLocalScreen(e){this.streamManager.setScreenMuted(e)}setMicrophoneDeviceId(e){this.streamManager.setMicAudioConstraints({deviceId:e})}updatePubId(){this.publishId=x.Guid.create(16)}clearPublishState(){this.streamTracks=void 0}clear(){return v(this,null,function*(){Sr(rt.prototype,this,"clear").call(this),this._isPublishing&&(yield this.unPublish()),this.stopPreview(),this.resetPreviewElements(),this.resetSecondayPreviewElements(),this.clearStream(),this.stopStreamMonitor(),this.streamManager.cameraCaptureDisabled=!1})}resetElement(e){this.previewElements.includes(e)&&(tt(e),this.previewElements.splice(this.previewElements.indexOf(e),1)),this.screenPreviewElements.includes(e)&&(tt(e),this.screenPreviewElements.splice(this.screenPreviewElements.indexOf(e),1))}setPreviewElement(e){const{videoElement:t,screen:r}=e;r?this.screenPreviewElements.includes(t)||this.screenPreviewElements.push(t):this.previewElements.includes(t)||this.previewElements.push(t)}setViewConfig(e,t){if(!e){t===j.AliRtcVideoTrackCamera?this.stopPreview({primary:!0,screen:!1}):this.stopPreview({primary:!1,screen:!0});return}if(![j.AliRtcVideoTrackCamera,j.AliRtcVideoTrackScreen].includes(t))throw new E(T.ERR_INVALID_ARGUMENTS,"set view config invalid track",{track:t});e.forEach(r=>{this.setPreviewElement({videoElement:r,screen:t===j.AliRtcVideoTrackScreen})})}startCameraCapture(e){return v(this,null,function*(){return this.streamManager.cameraCaptureDisabled=!1,yield this.createLocalStream(e)})}stopCameraCapture(){return v(this,null,function*(){this.streamManager.cameraCaptureDisabled=!0,yield this.stopLocalStream({video:!0})})}stopAudioCapture(){return v(this,null,function*(){this.streamManager.audioCaptureDisabled=!0,yield this.stopLocalStream({audio:!0})})}preview(e){return v(this,null,function*(){const{videoElement:t,screen:r}=e!=null?e:{};try{let s=r?this.streamManager.screenStreamInfo.previewStream:this.streamManager.cameraStreamInfo.previewStream;if(!t)throw new E(T.ERR_INVALID_ARGUMENTS,"no video element found",{videoElement:t});if(!s){A.info(`[${rt.logName}]`,"preview no stream founded");return}return Gr(t,s.mediaStream),this.setPreviewElement(e),s.mediaStream}catch(s){const n=T.ERR_INNER;throw E.fromError(s,n,"preview failed")}})}previewAll(e){return v(this,null,function*(){const{primary:t=!0,screen:r=!0}=e!=null?e:{};if(t&&this.previewElements.length)for(let s=0;s<this.previewElements.length;s++){const n=this.previewElements[s];yield this.preview({videoElement:n})}if(r&&this.screenPreviewElements.length)for(let s=0;s<this.screenPreviewElements.length;s++){const n=this.screenPreviewElements[s];yield this.preview({videoElement:n,screen:!0})}})}stopPreview(e){const{videoElement:t,primary:r=!0,screen:s=!0}=e||{};if(!t)r&&(this.previewElements.forEach(n=>{tt(n)}),this.previewElements=[]),s&&(this.screenPreviewElements.forEach(n=>{tt(n)}),this.screenPreviewElements=[]);else{const n=this.previewElements.findIndex(o=>o===t);if(n>=0)this.previewElements.splice(n,1),tt(t);else{const o=this.screenPreviewElements.findIndex(c=>c===t);o>=0&&(this.screenPreviewElements.splice(o,1),tt(t))}}}resumePublish(){return v(this,null,function*(){this._isPublishing=!1,yield this.startPublish(!0)})}createLocalStream(e){return v(this,null,function*(){try{const t=yield this.streamManager.createLocalStream(e);return t!=null&&t.audioTrack&&this.audioVolumeIndicationInterval>0&&this.audioLevelMonitor.start(t.audioTrack,this.audioVolumeIndicationInterval),e.video?this.previewAll({primary:!0}):e.screen&&this.previewAll({screen:!0}),t}catch(t){const r=xa[t.errorCode];throw r&&(e.audio?this.emit("localDeviceException",je.AliEngineLocalDeviceTypeMic,r,""):e.video?this.emit("localDeviceException",je.AliEngineLocalDeviceTypeCamera,r,""):e.screen?this.emit("localDeviceException",je.AliEngineLocalDeviceTypeDisplay,r,""):this.emit("localDeviceException",je.AliEngineLocalDeviceTypeUnknown,r,"")),t}})}stopLocalStream(e){return v(this,null,function*(){e.audio&&this.audioLevelMonitor.stop(),yield this.streamManager.stopLocalStream(e)})}compareAndPublish(e,t,r){return v(this,null,function*(){var n,o;if(!e&&!t)return;if(e&&!t){const c={};return r===M.Audio?c.audio=!0:r===M.VideoLarge||r===M.VideoSmall?(c.video=!0,c.vMsid=r):r===M.Screen&&(c.screen=!0),yield this.publishDeleteTracks(c)}const s={};if(t!=null&&t.hasVideo&&(s.isScreen=r===M.Screen,s.vMsid=r),t!=null&&t.hasAudio&&(s.aMsid=r),!e&&t)return yield this.publishAdd(t,s,!1);if(e&&t){const c=e.trackId,u=((n=t.videoTrack)==null?void 0:n.id)||((o=t.audioTrack)==null?void 0:o.id);if(c!==u)return yield this.publishReplace(t,s)}})}startPublish(e=!1){return v(this,null,function*(){if(!this.joined)return;const t=yield this.streamManager.publishStreams,{audio:r,video:s,videoSmall:n,screen:o}=t;try{const c=new Date().getTime();r&&this.audioPubState.setState(B.AliRtcStatePublishing),s&&this.videoPubState.setState(B.AliRtcStatePublishing),n&&this.videoSmallPubState.setState(B.AliRtcStatePublishing),o&&this.screenPubState.setState(B.AliRtcStatePublishing),this.publishPromise=this.rtsManager.publish(this.url,e);const u=yield this.publishPromise;this._isPublishing=!0,this.streamTracks=this.rtsManager.publishingTracks,this.traceId=u;const h={userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:e,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callid,tracks:this.streamTracks,traceId:u};yield this.syncPublishToRoomServer(h,t,c),r&&this.audioPubState.setState(B.AliRtcStatePublished),s&&this.videoPubState.setState(B.AliRtcStatePublished),n&&this.videoSmallPubState.setState(B.AliRtcStatePublished),o&&this.screenPubState.setState(B.AliRtcStatePublished)}catch(c){throw r&&this.audioPubState.setState(B.AliRtcStateNoPublish),s&&this.videoPubState.setState(B.AliRtcStateNoPublish),n&&this.videoSmallPubState.setState(B.AliRtcStateNoPublish),o&&this.screenPubState.setState(B.AliRtcStateNoPublish),c}})}publishUpdate(){return v(this,null,function*(){var s,n,o,c;if(!this._isPublishing)return;yield this.publishPromise;const e=yield this.streamManager.publishStreams;let t;const r=new Date().getTime();try{const u=(s=this.streamTracks)==null?void 0:s.find(({ssrc:b,type:w,msid:_})=>w==="audio"&&b&&_===M.Audio),h=yield this.compareAndPublish(u,e.audio,M.Audio);h&&(t=h);const l=(n=this.streamTracks)==null?void 0:n.find(({ssrc:b,type:w,msid:_})=>w==="video"&&b&&_===M.VideoLarge),d=yield this.compareAndPublish(l,e.video,M.VideoLarge);d&&(t=d);const f=(o=this.streamTracks)==null?void 0:o.find(({ssrc:b,type:w,msid:_})=>w==="video"&&b&&_===M.VideoSmall),m=yield this.compareAndPublish(f,e.videoSmall,M.VideoSmall);m&&(t=m);const g=(c=this.streamTracks)==null?void 0:c.find(({ssrc:b,type:w,msid:_})=>w==="video"&&b&&_===M.Screen),S=yield this.compareAndPublish(g,e.screen,M.Screen);if(S&&(t=S),!t)return;yield this.syncPublishToRoomServer(t,e,r)}catch(u){const{code:h}=u!=null?u:{},l=this.url;throw h===403&&l&&(yield this.refreshPushStreamUrl(),t=yield this.publishUpdate()),u}return t})}syncPublishToRoomServer(e,t,r){return v(this,null,function*(){var l;if(!e)throw new E(T.ERR_INNER,"sync publish to room server failed because no publishInfo");const s=yield this.signalingManager.publish(e);e.signaltid=s.tid;const n=new Date().getTime()-r,o=!!t.video,c=!1,u=!!t.screen,h=!!t.audio;this.reporter.reportPublish(this.callid||"",o,c,u,h,0,s.tid,n),this.webTrackingClient.reportPush(this.callid||"",o,c,u,h,0,s.tid,n,r,e.traceid||"",this.traceId,(l=this.url)!=null?l:"")})}refreshPushStreamUrl(){return v(this,null,function*(){const e=new E(T.ERR_INNER,"refresh push stream url error"),t=this.url;if(!t)throw e;const r=yield this.signalingManager.refreshUrl({pushstreamurl:t});if(!(r!=null&&r.pushstreamurl))throw e;this.url=r==null?void 0:r.pushstreamurl})}publishAdd(e,t,r=!1,s=0){return v(this,null,function*(){const n=(t==null?void 0:t.aMsid)===M.Audio,o=(t==null?void 0:t.vMsid)===M.VideoLarge,c=(t==null?void 0:t.vMsid)===M.VideoSmall,u=(t==null?void 0:t.vMsid)===M.Screen;n&&this.audioPubState.setState(B.AliRtcStatePublishing),o&&this.videoPubState.setState(B.AliRtcStatePublishing),c&&this.videoSmallPubState.setState(B.AliRtcStatePublishing),u&&this.screenPubState.setState(B.AliRtcStatePublishing);try{const h=yield this.rtsManager.publishAdd(this.url,e,t,!1,0,!0);n&&this.audioPubState.setState(B.AliRtcStatePublished),o&&this.videoPubState.setState(B.AliRtcStatePublished),c&&this.videoSmallPubState.setState(B.AliRtcStatePublished),u&&this.screenPubState.setState(B.AliRtcStatePublished),this.streamTracks=this.rtsManager.publishingTracks;const l={userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:r,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callid,tracks:this.streamTracks,traceid:h};return this.reportSelfDeviceStatus(),l}catch(h){let l=T.ERR_SDK_PUBLISH_INVAILD;if(n&&(this.audioPubState.setState(B.AliRtcStateNoPublish),l=T.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED),o&&(this.videoPubState.setState(B.AliRtcStateNoPublish),l=T.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED),c&&(this.videoSmallPubState.setState(B.AliRtcStateNoPublish),l=T.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED),u&&(this.screenPubState.setState(B.AliRtcStateNoPublish),l=T.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED),h.errorCode===15006&&s<3)return this.publishAdd(e,t,r,s+1);throw E.fromError(h,l,"publish add failed")}})}publishReplace(e,t){return v(this,null,function*(){try{yield this.rtsManager.publishReplace(this.url,e,t),this.traceId="",this.streamTracks=this.rtsManager.publishingTracks;const r={userid:this.userId,sessionid:"",pubid:this.publishId,displayname:this.name,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callid,tracks:this.streamTracks};return this.reportSelfDeviceStatus(),r}catch(r){throw E.fromError(r,T.ERR_INNER,`publish replace failed, vMsid: ${t==null?void 0:t.vMsid} aMsid: ${t==null?void 0:t.aMsid}`)}})}publishDeleteTracks(e){return v(this,null,function*(){const t={userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callid,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{return yield this.rtsManager.publishDelete(this.url,e),this.streamTracks=this.rtsManager.publishingTracks,e.audio&&this.audioPubState.setState(B.AliRtcStateNoPublish),e.video&&(e.vMsid===M.VideoSmall?this.videoSmallPubState.setState(B.AliRtcStateNoPublish):this.videoPubState.setState(B.AliRtcStateNoPublish)),e.screen&&this.screenPubState.setState(B.AliRtcStateNoPublish),this.traceId="",t.tracks=this.streamTracks,this.reportSelfDeviceStatus(),t}catch(r){throw E.fromError(r,T.ERR_INNER,"publish delete tracks failed")}})}publishStop(){return v(this,null,function*(){if(!this._isPublishing)throw new E(T.ERR_INNER,"publish stop failed, previous localStream is required for publishing stopping");A.info(`[${rt.logName}]`,"publishStop",{url:this.url});const e=new Date().getTime();try{const t=this.hasAudioTrackInMS,r=this.hasCameraTrackInMS,s=this.hasCameraDualTrackInMS,n=this.hasScreenTrackInMS;yield this.rtsManager.publishStop(this.url),t&&this.audioPubState.setState(B.AliRtcStateNoPublish),r&&this.videoPubState.setState(B.AliRtcStateNoPublish),s&&this.videoSmallPubState.setState(B.AliRtcStateNoPublish),n&&this.screenPubState.setState(B.AliRtcStateNoPublish),this.traceId="",this.streamTracks=[];const o={userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callid,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};return this.syncPublishToRoomServer(o,{},e),o}catch(t){throw E.fromError(t,T.ERR_INNER,"publish stop failed")}})}unPublish(){return v(this,null,function*(){const e=new Date().getTime();let t={userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callid,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{if(this._isPublishing){const r=this.hasAudioTrackInMS,s=this.hasCameraTrackInMS,n=this.hasCameraDualTrackInMS,o=this.hasScreenTrackInMS;yield this.rtsManager.unpublish(),r&&this.audioPubState.setState(B.AliRtcStateNoPublish),s&&this.videoPubState.setState(B.AliRtcStateNoPublish),n&&this.videoSmallPubState.setState(B.AliRtcStateNoPublish),o&&this.screenPubState.setState(B.AliRtcStateNoPublish),this._isPublishing=!1,this.traceId="",this.clearStream()}return this.reporter.reportUnpublish(this.callid||"",e,0,""),t}catch(r){throw E.fromError(r,T.ERR_INNER,"unpublish failed")}})}reportSelfDeviceStatus(){this.emit(be.Local,this.getDeviceStatus())}getDeviceStatus(){var t,r,s,n;let e={micOpen:!1,micInterrupted:!1,cameraOpen:!1,screenShare:!1,audioDisable:!0,videoDisable:!0,screenDisable:!0,backgroundMode:!1,accompanyPlaying:!1};return e.cameraOpen=this.hasCamera,e.micOpen=this.hasMicrophone,e.screenShare=this.hasScreenShare,e.audioDisable=!((t=this.streamManager.cameraStreamInfo.originAudioTrack)!=null&&t.enabled),e.videoDisable=!((r=this.streamManager.cameraStreamInfo.originVideoTrack)!=null&&r.enabled),e.screenDisable=!this.hasScreenShare||!((n=(s=this.streamManager.screenStreamInfo)==null?void 0:s.originVideoTrack)!=null&&n.enabled),Wr.getCurrentStatus(e)}resetPreviewElements(){this.previewElements=[]}resetSecondayPreviewElements(){this.screenPreviewElements=[]}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0)}clearStream(){this.streamManager.stop(),this.audioPubState.setState(B.AliRtcStatePublishIdle),this.videoPubState.setState(B.AliRtcStatePublishIdle),this.videoSmallPubState.setState(B.AliRtcStatePublishIdle),this.screenPubState.setState(B.AliRtcStatePublishIdle)}getCurrentCameraDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originVideoTrack)==null?void 0:e.getSettings().deviceId}getCurrentMicDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originAudioTrack)==null?void 0:e.getSettings().deviceId}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.streamManager.cameraStreamInfo.originAudioTrack&&this.audioLevelMonitor.start(this.streamManager.cameraStreamInfo.originAudioTrack,e),this.audioVolumeIndicationInterval=e)}sendSEI(e,t,r){return v(this,null,function*(){if(!this.url)return;let s=0;return!t||t<1?s=1:s=t-1,this.rtsManager.sendSEI(this.url,e,s,r)})}getStats(){return v(this,null,function*(){const e=[];if(this.hasAudioTrackInMS){const r=yield this.rtsManager.getPublishAudioStats(this.url);r&&e.push({stats:r,track:bt.AliRtcAudioTrackMic})}const t=[];if(this.hasCameraTrackInMS){const r=yield this.rtsManager.getPublishVideoStats(this.url,M.VideoLarge);r&&t.push({track:j.AliRtcVideoTrackCamera,streamType:oe.AliRtcVideoStreamTypeHigh,stats:r})}if(this.hasCameraDualTrackInMS){const r=yield this.rtsManager.getPublishVideoStats(this.url,M.VideoSmall);r&&t.push({track:j.AliRtcVideoTrackCamera,streamType:oe.AliRtcVideoStreamTypeLow,stats:r})}if(this.hasScreenTrackInMS){const r=yield this.rtsManager.getPublishVideoStats(this.url,M.Screen);r&&t.push({track:j.AliRtcVideoTrackScreen,stats:r})}return{audio:e,video:t}})}},p(rt,"logName","LocalUser"),rt);se([y()],ie.prototype,"clearPublishState",1),se([y()],ie.prototype,"clear",1),se([y()],ie.prototype,"setViewConfig",1),se([y()],ie.prototype,"startCameraCapture",1),se([y()],ie.prototype,"stopCameraCapture",1),se([y()],ie.prototype,"stopAudioCapture",1),se([y()],ie.prototype,"stopPreview",1),se([y()],ie.prototype,"resumePublish",1),se([y()],ie.prototype,"createLocalStream",1),se([y()],ie.prototype,"stopLocalStream",1),se([y(I)],ie.prototype,"startPublish",1),se([y(([i])=>[i])],ie.prototype,"syncPublishToRoomServer",1),se([y()],ie.prototype,"refreshPushStreamUrl",1),se([y(([i,a,e])=>[JSON.stringify(e)])],ie.prototype,"publishAdd",1),se([y(([i,a])=>[JSON.stringify(a)])],ie.prototype,"publishReplace",1),se([y(I)],ie.prototype,"publishDeleteTracks",1),se([y()],ie.prototype,"publishStop",1),se([y()],ie.prototype,"unPublish",1),se([y(([i,a,e])=>[i.length,a,e])],ie.prototype,"sendSEI",1);let zr=ie;var ut=(i=>(i.OPUS="opus",i.H264="H264",i.UNKONWN="",i))(ut||{}),ht=(i=>(i.VideoTrackEnded="videoTrackEnded",i.AudioTrackEnded="audioTrackEnded",i.ScreenTrackEnded="screenTrackEnded",i))(ht||{});const Fa=i=>{const a=new MediaStream;return a.addTrack(i),a},Xr=i=>v(this,null,function*(){return yield D.AliRTS.createStream({custom:!0,mediaStream:i})}),Mt=i=>v(this,null,function*(){const a=Fa(i);return yield Xr(a)}),ja=i=>{const{audio:a,video:e,screen:t}=i;if(e&&t)throw new E(T.ERR_INNER,"create stream error, cannot create video && screen together");return!(!e&&!a&&!t)},$a=i=>i===M.Audio||i===Ni.Audio,Wa=i=>i===M.VideoLarge||i===Ni.VideoLarge,Ka=i=>i===M.VideoSmall,Ja=i=>i===M.Screen;var qa=Object.defineProperty,Ga=Object.getOwnPropertyDescriptor,za=(i,a,e,t)=>{for(var r=t>1?void 0:t?Ga(a,e):a,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(t?n(a,e,r):n(r))||r);return t&&r&&qa(a,e,r),r};class Qt extends X{constructor(){super();p(this,"audioInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:ut.UNKONWN});p(this,"videoLargeInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:ut.UNKONWN});p(this,"videoSmallInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:ut.UNKONWN});p(this,"screenInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:ut.UNKONWN});p(this,"audioVolume",1);p(this,"audioMuted",!1);p(this,"userStatus")}getAudioInfo(){return this.audioInfo}getVideoSmallInfo(){return this.videoSmallInfo}getVideoLargeInfo(){return this.videoLargeInfo}getScreenInfo(){return this.screenInfo}get hasAudio(){return this.audioInfo.ssrc!==""}get hasVideo(){return this.videoLargeInfo.ssrc!==""||this.videoSmallInfo.ssrc!==""}get hasVideoLarge(){return this.videoLargeInfo.ssrc!==""}get hasVideoSmall(){return this.videoSmallInfo.ssrc!==""}get hasScreen(){return this.screenInfo.ssrc!==""}get isAudioSubscribing(){return!!this.audioInfo.subscribed}get isVideoSubscribing(){return!!this.videoLargeInfo.subscribed||!!this.videoSmallInfo.subscribed}get isVideoLargeSubscribing(){return!!this.videoLargeInfo.subscribed}get isVideoSmallSubscribing(){return!!this.videoSmallInfo.subscribed}get isScreenSubscribing(){return!!this.screenInfo.subscribed}get audioCodec(){return this.audioInfo.codec}get videoCodec(){return this.hasVideoLarge?this.videoLargeInfo.codec:this.hasVideoSmall?this.videoSmallInfo.codec:this.hasScreen?this.screenInfo.codec:ut.UNKONWN}get audioTrackInfo(){return this.hasAudio?bt.AliRtcAudioTrackMic:bt.AliRtcAudioTrackNo}get videoTrackInfo(){return this.hasVideo&&this.hasScreen?j.AliRtcVideoTrackBoth:this.hasVideo?j.AliRtcVideoTrackCamera:this.hasScreen?j.AliRtcVideoTrackScreen:j.AliRtcVideoTrackNo}updateTracks(e){let t="",r="",s="",n="";return e?(e.forEach(o=>{var h;let c=ut.UNKONWN;const u=((h=o==null?void 0:o.attr)==null?void 0:h.reason)==="reconnect";if(o.userdata){const{codec:l}=JSON.parse(o.userdata);l&&(c=l)}$a(o.msid)?(t=o.ssrc,this.audioInfo.msid=o.msid,this.audioInfo.codec=c,u&&(this.audioInfo.subscribed=!1)):Ka(o.msid)?(s=o.ssrc,this.videoSmallInfo.msid=o.msid,this.videoSmallInfo.codec=c,u&&(this.videoSmallInfo.subscribed=!1)):Wa(o.msid)?(r=o.ssrc,this.videoLargeInfo.msid=o.msid,this.videoLargeInfo.codec=c,u&&(this.videoLargeInfo.subscribed=!1)):Ja(o.msid)&&(n=o.ssrc,this.screenInfo.msid=o.msid,this.screenInfo.codec=c,u&&(this.screenInfo.subscribed=!1))}),this.updateRemoteTrackSsrc(t,r,s,n)):this.updateRemoteTrackSsrc(t,r,s,n),{}}updateRemoteTrackSsrc(e,t,r,s){this.audioInfo.ssrc=e,this.videoSmallInfo.ssrc=r,this.videoLargeInfo.ssrc=t,this.screenInfo.ssrc=s}updateRemoteTrackSubState(e){return e.video!==void 0&&((e.vMsid===this.videoSmallInfo.msid||!e.vMsid)&&(this.videoSmallInfo.subscribed=e.video),(e.vMsid===this.videoLargeInfo.msid||!e.vMsid)&&(this.videoLargeInfo.subscribed=e.video)),e.screen!==void 0&&(this.screenInfo.subscribed=e.screen),e.audio!==void 0&&(this.audioInfo.subscribed=e.audio),{audioInfo:this.audioInfo,videoLargeInfo:this.videoLargeInfo,videoSmallInfo:this.videoSmallInfo,screenInfo:this.screenInfo}}updateRemoteUserDeviceStatus(e){let t=Wr.parseStatus(e);const{audioDisable:r,videoDisable:s,screenDisable:n}=t;return this.userStatus?(this.userStatus.audioDisable!=r&&(this.userStatus.audioDisable=r,this.emit(be.Remote,r?J.MuteAudio:J.UnmuteAudio)),this.userStatus.videoDisable!=s&&(this.userStatus.videoDisable=s,this.emit(be.Remote,s?J.MuteVideo:J.UnmuteVideo)),this.userStatus.screenDisable!=n&&(this.userStatus.screenDisable=n,this.emit(be.Remote,n?J.MuteScreen:J.UnmuteScreen))):(this.userStatus=t,this.emit(be.Remote,r?J.MuteAudio:J.UnmuteAudio),this.emit(be.Remote,s?J.MuteVideo:J.UnmuteVideo),this.emit(be.Remote,n?J.MuteScreen:J.UnmuteScreen)),!1}}p(Qt,"logName","RemoteStreamInfo"),za([y()],Qt.prototype,"updateRemoteTrackSubState",1);class Yr{constructor(a){p(this,"remoteUser");this.remoteUser=a}get userId(){return this.remoteUser.userId}get displayName(){return this.remoteUser.displayname}get isMuteAudioPlaying(){return this.remoteUser.getAudioMuted()}get hasAudio(){return this.remoteUser.hasAudioTrack}get hasCamera(){return this.remoteUser.hasVideoTrack}get hasCameraLarge(){return this.remoteUser.hasVideoLargeTrack}get hasCameraSmall(){return this.remoteUser.hasVideoSmallTrack}get hasScreenShare(){return this.remoteUser.hasScreenTrack}get isAudioSubscribing(){return this.remoteUser.isAudioSubscribing}get isVideoSubscribing(){return this.remoteUser.isVideoSubscribing}get isVideoLargeSubscribing(){return this.remoteUser.isVideoLargeSubscribing}get isVideoSmallSubscribing(){return this.remoteUser.isVideoSmallSubscribing}get isScreenSubscribing(){return this.remoteUser.isScreenSubscribing}}var Xa=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,ce=(i,a,e,t)=>{for(var r=t>1?void 0:t?Ya(a,e):a,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(t?n(a,e,r):n(r))||r);return t&&r&&Xa(a,e,r),r};class Nt extends X{constructor(){super();p(this,"state");p(this,"time");p(this,"_enabled");this.state=Z.AliRtcStateSubscribeIdle,this.time=Date.now(),this._enabled=!0}setState(e){if(this.state===e)return;const t=this.state,r=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-r)/1e3))}get currentState(){return this.state}getEnabled(){return this._enabled}setEnabled(e){this._enabled=e}}const gi=class gi extends $r{constructor(e){var f;const{userId:t,displayName:r,rtsManager:s,usersViewMap:n,reporter:o,webTrackingClient:c,signalingManager:u,localUserId:h,audioVolumeIndicationInterval:l,playoutVolume:d}=e;super(t,r,s,l);p(this,"remoteCallid","");p(this,"remoteUserInfo");p(this,"localUserId");p(this,"lastPubId","");p(this,"stream");p(this,"screenStream");p(this,"viewMap");p(this,"audioTrack");p(this,"audioElement");p(this,"subscribed",!1);p(this,"mediaStream");p(this,"secondaryMediaStream");p(this,"prevSubConfig");p(this,"signalingManager");p(this,"reporter");p(this,"webTrackingClient");p(this,"wantSubAudio",!1);p(this,"wantSubVideo",!1);p(this,"wantSubScreen",!1);p(this,"defaultVideoStreamType",oe.AliRtcVideoStreamTypeHigh);p(this,"audioMuted",!1);p(this,"audioSubState");p(this,"videoSubState");p(this,"videoLargeSubState",new Nt);p(this,"videoSmallSubState",new Nt);p(this,"screenSubState");p(this,"streamInfo");p(this,"streamUrl","");p(this,"playoutVolume",1);this.streamInfo=new Qt,this.remoteUserInfo=new Yr(this),this.streamInfo.on(be.Remote,m=>{this.emit(be.Remote,m,this.userId)}),this.signalingManager=u,this.viewMap=(f=n[t])!=null?f:{cameraViews:[],screenViews:[]},n[t]=this.viewMap,this.reporter=o,this.webTrackingClient=c,this.localUserId=h,this.audioSubState=new Nt,this.audioSubState.on("change",(m,g,S)=>{this.emit("audioSubscribeStateChanged",this.uid,m,g,S)}),this.videoSubState=new Nt,this.videoSubState.on("change",(m,g,S)=>{this.emit("videoSubscribeStateChanged",this.uid,m,g,S)}),this.screenSubState=new Nt,this.screenSubState.on("change",(m,g,S)=>{this.emit("screenSubscribeStateChanged",this.uid,m,g,S)}),this.playoutVolume=d}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e}setRemoteDefaultVideoStreamType(e){e!==this.defaultVideoStreamType&&(this.defaultVideoStreamType=e,this.updateSubscribe())}setAudioMuted(e){this.audioMuted=e,this.toggleAudio(!e)}setPlayoutVolume(e){this.playoutVolume=e,this.audioElement&&(this.audioElement.volume=e)}getAudioMuted(){return this.audioMuted}get hasAudioTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasAudio)}get hasVideoTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideo)}get hasVideoLargeTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideoLarge)}get hasVideoSmallTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideoSmall)}get hasScreenTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasScreen)}get isAudioSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isAudioSubscribing)}get isVideoSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoSubscribing)}get isVideoLargeSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoLargeSubscribing)}get isVideoSmallSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoSmallSubscribing)}get isScreenSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isScreenSubscribing)}get audioEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.audioTrack)!=null&&t.enabled)}get videoEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get screenEnabled(){var e,t;return!!((t=(e=this.screenStream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get getAudioTrack(){return this.audioTrack}get getCameraStream(){return this.stream}get getScreenStream(){return this.screenStream}setViewConfig(e,t){if(t!==j.AliRtcVideoTrackScreen&&t!==j.AliRtcVideoTrackCamera)throw new E(T.ERR_INVALID_ARGUMENTS,"track is not AliRtcVideoTrackScreen or AliRtcVideoTrackCamera");e?Ji(e).forEach(s=>{s.setAttribute("playsinline",""),x.BrowserUtil.isMicroMessenger&&(s.setAttribute("x5-video-player-type","h5-page"),s.setAttribute("x5-playsinline",""),x.SystemUtil.isAndroid||x.SystemUtil.isIos&&s.setAttribute("x-webkit-airplay","allow")),t===j.AliRtcVideoTrackScreen?this.viewMap.screenViews.push(s):this.viewMap.cameraViews.push(s),this.play(s,t===j.AliRtcVideoTrackScreen)}):(this.stopPlayAll(t===j.AliRtcVideoTrackScreen),t===j.AliRtcVideoTrackScreen?this.viewMap.screenViews=[]:this.viewMap.cameraViews=[])}clear(e=!0){return v(this,null,function*(){var t;e&&this.doStopSubscribe(this.streamUrl),Sr(gi.prototype,this,"clear").call(this),this.clearStream(),this.clearScreenStream(),(t=this.streamInfo)==null||t.removeAllListeners(be.Remote)})}updateRemoteUserDeviceStatus(e){var t;(t=this.streamInfo)==null||t.updateRemoteUserDeviceStatus(e)}updateRemoteTracks(e,t,r,s){return v(this,null,function*(){var o;return this.remoteCallid=e,this.streamUrl=t!=null?t:"",this.callid=e!=null?e:"",this.streamInfo||(this.streamInfo=new Qt),(o=this.streamInfo)==null?void 0:o.updateTracks(s)})}subscribe(e){return v(this,null,function*(){var u;e?this.reporter.reportSubscribeInvoked(this.userId,e.video,!1,e.screen,e.audio):this.reporter.reportSubscribeInvoked(this.userId);let t=e;if(!t){const{hasAudio:h,hasVideo:l,hasScreen:d}=(u=this.streamInfo)!=null?u:{};t={audio:this.wantSubAudio&&h,video:this.wantSubVideo&&l,screen:this.wantSubScreen&&d}}const{screen:r,audio:s,video:n,vMsid:o}=t,c=[];(n||s)&&c.push({audio:s,video:n,vMsid:o}),r&&c.push({screen:r}),c.length!==0&&(yield Promise.all(c.map(h=>this.subscribeProxy(h))))})}subscribeProxy(e){return v(this,null,function*(){var n,o;let t=new Date().getTime(),r="",s="";try{e.audio&&this.audioSubState.setState(Z.AliRtcStateSubscribing),e.video&&(this.videoSubState.currentState===Z.AliRtcStateSubscribeIdle||this.videoSubState.currentState===Z.AliRtcStateNoSubscribe)&&this.videoSubState.setState(Z.AliRtcStateSubscribing),e.screen&&this.screenSubState.setState(Z.AliRtcStateSubscribing);const c=yield this.rtsManager.subscribe({remoteUser:this,options:e});this.streamInfo.updateRemoteTrackSubState(e),r=c;const{stream:u}=c;if(e.audio){const l=u.audioTrack;l&&(this.audioTrack=l,(n=u.mediaStream)==null||n.removeTrack(l),this.playAudio(),this.audioVolumeIndicationInterval&&this.audioLevelMonitor.start(l,this.audioVolumeIndicationInterval)),this.audioSubState.setState(Z.AliRtcStateSubscribed),this.audioSubState.getEnabled()||this.toggleAudio(!1)}e.video&&(e.vMsid===M.VideoSmall?this.videoSmallSubState.setState(Z.AliRtcStateSubscribed):this.videoLargeSubState.setState(Z.AliRtcStateSubscribed),this.videoSubState.setState(Z.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleVideo(!1),this.updateStream(u,this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing)),e.screen&&(this.screenSubState.setState(Z.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleScreen(!1),this.updateScreenStream(u));const h=new Date().getTime()-t;this.webTrackingClient.reportPull(c.callid,c.remoteCallid,c.isVideoLargeSubscribing,c.isVideoSmallSubscribing,c.isScreenSubscribing,c.isAudioSubscribing,0,h,s,r,this.streamUrl,t)}catch(c){const u=new Date().getTime()-t;this.webTrackingClient.reportPull("","",!1,!1,!1,!1,c.code,u,s,r,(o=this.streamUrl)!=null?o:"",t),c&&(c.message=`user(${this.uid}) subscribe error, ${(c==null?void 0:c.message)||""}`);let h=T.ERR_INNER;e.audio&&(h=T.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED),e.video&&(e.vMsid===M.VideoSmall?h=T.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED:h=T.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED),e.screen&&(h=T.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED);const l=E.fromError(c,h);throw this.emit("remoteSubscribeError",l),l}})}subscribeDeleteTracks(e){return v(this,null,function*(){const{audio:t,video:r,screen:s,vMsid:n}=e,o=[];(t||r)&&o.push({audio:t,video:r,vMsid:n}),s&&o.push({screen:s}),o.length!==0&&(yield Promise.all(o.map(c=>this.subscribeDeleteProxy(c))))})}subscribeDeleteProxy(e){return v(this,null,function*(){try{const t=yield this.rtsManager.subscibeDelete({remoteUser:this,options:e}),{stream:r}=t!=null?t:{},s={};e.audio===!0&&(s.audio=!1,this.audioSubState.setState(Z.AliRtcStateNoSubscribe)),e.video===!0&&(s.video=!1,e.vMsid===M.VideoSmall?(this.videoSmallSubState.setState(Z.AliRtcStateNoSubscribe),(this.videoLargeSubState.currentState===Z.AliRtcStateNoSubscribe||this.videoLargeSubState.currentState===Z.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Z.AliRtcStateNoSubscribe)):(this.videoLargeSubState.setState(Z.AliRtcStateNoSubscribe),(this.videoSmallSubState.currentState===Z.AliRtcStateNoSubscribe||this.videoSmallSubState.currentState===Z.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Z.AliRtcStateNoSubscribe))),e.screen===!0&&(s.screen=!1,this.screenSubState.setState(Z.AliRtcStateNoSubscribe));const{callid:n,remoteCallid:o}=this,c={callid:n,remoteCallid:o,remoteStream:r};return e.audio&&(this.audioLevelMonitor.stop(),this.stopPlayAudio(),this.audioTrack=void 0),this.streamInfo.updateRemoteTrackSubState({audio:e.audio===!0?!1:void 0,video:e.video===!0?!1:void 0,screen:e.screen===!0?!1:void 0,vMsid:e.vMsid}),c}catch(t){throw E.fromError(t,T.ERR_INNER,"subscribe delete failed")}})}restore(){this.clearStream(),this.clearScreenStream(),this.audioTrack=void 0,this.streamInfo.updateRemoteTrackSubState({audio:!1,video:!1,screen:!1})}resumeAudio(){return v(this,null,function*(){var e;return(e=this.audioElement)==null?void 0:e.play()})}resumeVideo(e){return v(this,null,function*(){if(!e||e===j.AliRtcVideoTrackCamera||e===j.AliRtcVideoTrackBoth)return this.playAll();if(!e||e===j.AliRtcVideoTrackScreen||e===j.AliRtcVideoTrackBoth)return this.playAll(!0)})}resumePlay(){this.playAudio(),this.playAll(),this.playAll(!0)}stopSubscribe(e){return v(this,null,function*(){var l,d,f,m,g,S,b;const{isAudioSubscribing:t=!1,isVideoSubscribing:r=!1,isScreenSubscribing:s=!1}=this,n=t&&!((l=e==null?void 0:e.audio)==null||l),o=r&&!((d=e==null?void 0:e.video)==null||d),c=!1,u=s&&!((f=e==null?void 0:e.screen)==null||f);e?this.reporter.reportSubscribeInvoked(this.userId,o,c,u,n):this.reporter.reportUnsubscribeInvoked(this.userId);let h=new Date().getTime();try{let w;e?w=yield this.subscribeDeleteTracks(e):w=yield this.doStopSubscribe(this.streamUrl),e?this.reporter.reportSubscribe((m=w==null?void 0:w.callid)!=null?m:"",this.userId,o,c,u,n,0,"",new Date().getTime()-h,(g=this.localUserId)!=null?g:""):this.reporter.reportUnsubscribe((S=w==null?void 0:w.callid)!=null?S:"",this.userId,new Date().getTime()-h,0,"")}catch(w){throw e?this.reporter.reportSubscribe("",this.userId,o,c,u,n,w.code,"",new Date().getTime()-h,(b=this.localUserId)!=null?b:""):this.reporter.reportUnsubscribe("",this.userId,new Date().getTime()-h,0,""),w}})}doStopSubscribe(e){return v(this,null,function*(){var s,n,o,c;const{callid:t,remoteCallid:r}=this;if((this.isAudioSubscribing||this.isVideoSubscribing||this.isScreenSubscribing)&&e)try{return yield this.rtsManager.subscibeStop(e),this.restore(),{callid:t,remoteCallid:r,remoteStream:this.stream}}catch(u){if(((c=(o=(n=(s=u==null?void 0:u.extraInfo)==null?void 0:s.parsedData)==null?void 0:n.streams)==null?void 0:o[0])==null?void 0:c.res_code)!==404)throw E.fromError(u,T.ERR_INNER,"subscribe stop failed")}})}updateStream(e,t=!1){return v(this,null,function*(){this.stream&&this.stream.videoTrack&&e.mediaStream&&t&&(yield new Promise(r=>{let s,n;if(e.mediaStream){n=document.createElement("video");const o=()=>{A.event(`uid: ${this.userId} new mediaStream canplay`),n&&n.removeEventListener("canplaythrough",o,!1),n=void 0,clearTimeout(s),r(!0)};n.addEventListener("canplaythrough",o,!1),(n._playPromise||Promise.resolve()).then(()=>{n&&e.mediaStream&&(n.srcObject=e.mediaStream)})}else r(!0);s=window.setTimeout(()=>{A.event(`uid: ${this.userId} new mediaStream timeout`),n=void 0,r(!0)},3e3)}),this.updateSubscribe()),this.stream=e,this.playAll(),!this.subscribed&&e&&(this.subscribed=!0),e.hasAudio&&this.isAudioSubscribing&&e.enableAudio(),e.hasVideo&&this.isVideoSubscribing&&e.enableVideo()})}updateScreenStream(e){this.screenStream=e,this.playAll(!0),!this.subscribed&&e&&(this.subscribed=!0),e.hasVideo&&this.isScreenSubscribing&&e.enableVideo()}clearStream(){var e;(e=this.stream)==null||e.stop(),this.stream=void 0}clearScreenStream(){var e;(e=this.screenStream)==null||e.stop(),this.screenStream=void 0}updateSubscribe(){var r,s,n,o,c,u,h,l;const e={},t={};return this.wantSubAudio&&!this.isAudioSubscribing&&((r=this.streamInfo)!=null&&r.hasAudio)?e.audio=!0:(!this.wantSubAudio||!((s=this.streamInfo)!=null&&s.hasAudio))&&this.isAudioSubscribing&&(t.audio=!0),this.wantSubVideo&&((n=this.streamInfo)!=null&&n.hasVideo)?(this.defaultVideoStreamType===oe.AliRtcVideoStreamTypeLow&&!this.isVideoSmallSubscribing&&((o=this.streamInfo)!=null&&o.hasVideoSmall)?(e.video=!0,e.vMsid=M.VideoSmall):!this.isVideoLargeSubscribing&&((c=this.streamInfo)!=null&&c.hasVideoLarge)&&!(this.defaultVideoStreamType===oe.AliRtcVideoStreamTypeLow&&this.isVideoSmallSubscribing)&&(e.video=!0,e.vMsid=M.VideoLarge),this.defaultVideoStreamType===oe.AliRtcVideoStreamTypeLow&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&this.streamInfo.hasVideoSmall?(t.video=!0,t.vMsid=M.VideoLarge):this.defaultVideoStreamType===oe.AliRtcVideoStreamTypeHigh&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&(t.video=!0,t.vMsid=M.VideoSmall)):(!this.wantSubVideo||!((u=this.streamInfo)!=null&&u.hasVideo))&&this.isVideoSubscribing&&(t.video=!0,t.vMsid=this.streamInfo.isVideoSmallSubscribing?M.VideoSmall:M.VideoLarge),this.wantSubScreen&&!this.isScreenSubscribing&&((h=this.streamInfo)!=null&&h.hasScreen)?e.screen=!0:(!this.wantSubScreen||!((l=this.streamInfo)!=null&&l.hasScreen))&&this.isScreenSubscribing&&(t.screen=!0),(e.audio||e.video||e.screen)&&this.subscribe(e),t.audio&&t.video&&t.screen?this.stopSubscribe():(t.audio||t.video||t.screen)&&this.subscribeDeleteTracks(t),{addOption:e,deleteOption:t}}handleAutoPlayFailed(){this.emit("remoteAudioAutoPlayFail",this.uid);const e=()=>{this.resumeAudio().then(()=>{document.removeEventListener("click",e,!1),document.removeEventListener("touchstart",e,!1)})};document.addEventListener("click",e,!1),document.addEventListener("touchstart",e,!1)}handleVideoPlayFailded(e,t){this.emit("remoteVideoAutoPlayFail",this.uid,t);const r=()=>{var n;const s=(n=t===j.AliRtcVideoTrackScreen?this.screenStream:this.stream)==null?void 0:n.mediaStream;e.srcObject===s&&this.play(e,t===j.AliRtcVideoTrackScreen),document.removeEventListener("click",r,!1),document.removeEventListener("touchstart",r,!1)};document.addEventListener("click",r,!1),document.addEventListener("touchstart",r,!1)}playAudio(){return v(this,null,function*(){var t,r;if(!this.audioTrack)return;if(this.toggleAudio(!this.audioMuted),this.audioElement||(this.audioElement=document.createElement("audio"),this.audioElement.volume=this.playoutVolume),((r=(t=this.audioElement.srcObject)==null?void 0:t.getAudioTracks())==null?void 0:r[0])!==this.audioTrack){let s=this.audioElement.srcObject;s?s.getAudioTracks().forEach(n=>{s.removeTrack(n)}):(s=new MediaStream,this.audioElement.srcObject=s),s.addTrack(this.audioTrack)}this.audioElement.play().catch(()=>{this.handleAutoPlayFailed()});const e=this.audioElement;this.audioElement.addEventListener("playing",function s(){e.removeEventListener("playing",s),x.SystemUtil.isIos&&parseInt(x.SystemUtil.systemVersion)<=14&&(e.muted||(e.pause(),e.play()))})})}stopPlayAudio(){this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null)}playAll(e=!1){e?(this.viewMap.screenViews||[]).forEach(t=>{this.play(t,e)}):(this.viewMap.cameraViews||[]).forEach(t=>{this.play(t,e)})}play(e,t=!1){const r=t?this.screenStream:this.stream;!e||!r||!r.mediaStream||Gr(e,r.mediaStream).catch(s=>{s.code===20||s.name==="AbortError"||this.handleVideoPlayFailded(e,t?j.AliRtcVideoTrackScreen:j.AliRtcVideoTrackCamera)})}stopPlayAll(e=!1){e?this.viewMap.screenViews.forEach(t=>{tt(t)}):this.viewMap.cameraViews.forEach(t=>{tt(t)})}toggleAudio(e=!0){this.audioSubState.setEnabled(e),this.audioTrack&&(this.audioTrack.enabled=e)}toggleVideo(e=!0){this.videoSubState.setEnabled(e),this.stream&&(e?this.stream.enableVideo():this.stream.disableVideo())}toggleScreen(e=!0){this.screenSubState.setEnabled(e),this.screenStream&&(e?this.screenStream.enableVideo():this.screenStream.disableVideo())}getStats(){return v(this,null,function*(){var r,s;const e=[];if(this.isAudioSubscribing){const n=yield this.rtsManager.getSubscribeAudioStats(this.streamUrl);n&&e.push({uid:this.uid,track:bt.AliRtcAudioTrackMic,stats:n})}const t=[];if((r=this.streamInfo)!=null&&r.isVideoLargeSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,M.VideoLarge);n&&t.push({uid:this.uid,track:j.AliRtcVideoTrackCamera,streamType:oe.AliRtcVideoStreamTypeHigh,stats:n})}if((s=this.streamInfo)!=null&&s.isVideoSmallSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,M.VideoSmall);n&&t.push({uid:this.uid,track:j.AliRtcVideoTrackCamera,streamType:oe.AliRtcVideoStreamTypeLow,stats:n})}if(this.isScreenSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,M.Screen);n&&t.push({uid:this.uid,track:j.AliRtcVideoTrackScreen,stats:n})}return{audio:e,video:t}})}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.audioTrack&&this.audioLevelMonitor.start(this.audioTrack,e),this.audioVolumeIndicationInterval=e)}};p(gi,"logName","RemoteUser");let re=gi;ce([y()],re.prototype,"clear",1),ce([y()],re.prototype,"updateRemoteUserDeviceStatus",1),ce([y()],re.prototype,"updateRemoteTracks",1),ce([y(I)],re.prototype,"subscribe",1),ce([y()],re.prototype,"subscribeProxy",1),ce([y(I)],re.prototype,"subscribeDeleteProxy",1),ce([y()],re.prototype,"restore",1),ce([y(I)],re.prototype,"stopSubscribe",1),ce([y(I)],re.prototype,"doStopSubscribe",1),ce([y()],re.prototype,"clearStream",1),ce([y()],re.prototype,"clearScreenStream",1),ce([y()],re.prototype,"updateSubscribe",1),ce([y()],re.prototype,"playAudio",1),ce([y()],re.prototype,"stopPlayAudio",1),ce([y(I)],re.prototype,"playAll",1),ce([y()],re.prototype,"play",1),ce([y()],re.prototype,"stopPlayAll",1);var it=(i=>(i[i.AliRtcPluginErrorCodeSuccess=0]="AliRtcPluginErrorCodeSuccess",i[i.AliRtcPluginErrorCodeFailed=-1]="AliRtcPluginErrorCodeFailed",i[i.AliRtcPluginErrorNoFindPlugin=-2]="AliRtcPluginErrorNoFindPlugin",i[i.AliRtcPluginErrorParameterError=-3]="AliRtcPluginErrorParameterError",i[i.AliRtcPluginErrorLoadError=-4]="AliRtcPluginErrorLoadError",i[i.AliRtcPluginErrorCreateError=-5]="AliRtcPluginErrorCreateError",i[i.AliRtcPluginErrorInitError=-6]="AliRtcPluginErrorInitError",i[i.AliRtcPluginErrorInitTokenError=-7]="AliRtcPluginErrorInitTokenError",i))(it||{});class Qa extends X{constructor(){super(...arguments);p(this,"plugins",new Map)}add(e,t){if(this.plugins.has(e.name))throw new E(it.AliRtcPluginErrorCreateError,`Plugin ${e.name} already exists`);this.plugins.set(e.name,e),t&&e.setOptions(t),this.emit("added",e),e.on("enabled",()=>this.emit("added",e)),e.on("disabled",()=>this.emit("removed",e)),e.on("updated",()=>this.emit("updated",e))}remove(e){const t=this.plugins.get(e);if(!t)throw new E(it.AliRtcPluginErrorNoFindPlugin,`Plugin ${e} not founded`);this.plugins.delete(e),t.removeAllListeners(),this.emit("removed",t)}get(e){return this.plugins.get(e)}has(e){return!!this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}}var Za=Object.defineProperty,en=Object.getOwnPropertyDescriptor,ve=(i,a,e,t)=>{for(var r=t>1?void 0:t?en(a,e):a,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(t?n(a,e,r):n(r))||r);return t&&r&&Za(a,e,r),r};const Zt=([i])=>{const{remoteUser:a,options:e}=i;return[`user(${a.userId})`,e]},pe=(Te=class extends X{constructor(e){super();p(this,"rts");p(this,"encodedInsertableStreams",!0);p(this,"audioRedEnabled",!1);p(this,"localStreamManager");p(this,"connecting",!1);p(this,"connected",!1);p(this,"connectionResolve");p(this,"connectingPromise");p(this,"dcResolve");p(this,"dcConnectingPromise");p(this,"_publishingTracks",[]);this.rts=D.AliRTS.createClient(),this.localStreamManager=e,this.rts.on("connectStatusChange",t=>{var r,s,n,o;if(A.event(`[${Te.logName}]`,"rts connectStatusChange to:",t.status),t.status===D.EConnectStatus.CONNECT_STATUS_DISCONNECTED)this.emit("disconnected"),this.setConnected(!1);else if(t.status===D.EConnectStatus.CONNECT_STATUS_RECONNECTING)this.emit("reconnecting"),this.setConnected(!1);else if(t.status===D.EConnectStatus.CONNECT_STATUS_CONNECTED){this.setConnected(!0);const c=(o=(n=(s=(r=this.rts.commonController)==null?void 0:r.peerCore)==null?void 0:s.getSignal())==null?void 0:n.getDatachannelCore())==null?void 0:o.readyState;A.event(Te.logName,"dcReadyState:",c),c==="open"&&this.dcResolve&&this.dcResolve(!0),this.emit("connected")}}),this.rts.on("datachannelStatusChange",t=>{A.event(`[${Te.logName}]`,"rts datachannelStatusChange to:",t.status),t.status===D.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?this.dcResolve&&this.dcResolve(!0):t.status===D.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&(this.dcConnectingPromise=new Promise(r=>{this.dcResolve=r}),console.warn("DC DisConnected"))}),this.rts.on("receivedSEI",t=>{this.emit("seimessage",t.url,t.sei.payloadType,t.sei.data)})}setEncodedInsertableStreams(e){this.encodedInsertableStreams=e}setAudioRedEnabled(e){var t;if(e!==this.audioRedEnabled){try{const s=[...((t=RTCRtpReceiver.getCapabilities("audio"))==null?void 0:t.codecs)||[]];if(s.length>0){if(e){const n=s.findIndex(c=>c.mimeType==="audio/red"),o=s.findIndex(c=>c.mimeType==="audio/opus");if(n>-1&&o>-1&&n>o){const c=s[o];s[o]=s[n],s[n]=c}}this.rts.setSenderCodecPreferences({audio:s}),this.rts.setReceiverCodecPreferences({audio:s})}}catch(r){}this.audioRedEnabled=e}}destroy(){this.rts.unpublish()}startConnect(){this.connecting=!0,this.connectingPromise=new Promise(e=>{this.connectionResolve=e}),this.dcConnectingPromise=new Promise(e=>{this.dcResolve=e})}setConnected(e){var t;this.connected=e,this.connecting=!1,(t=this.connectionResolve)==null||t.call(this,!0),e||(this.dcConnectingPromise=new Promise(r=>{this.dcResolve=r}))}get isConnecting(){return this.connecting}get isConnected(){return this.connected}get publishingTracks(){return this._publishingTracks}getPubMsid(e,t){const{aMsid:r,vMsid:s}=t!=null?t:{},n={};return e.hasAudio&&(n.aMsid=[r!=null?r:M.Audio]),e.hasScreen&&(n.vMsid=[M.Screen]),e.hasVideo&&(n.vMsid=[s!=null?s:t!=null&&t.isScreen?M.Screen:M.VideoLarge]),n}updatePublishingTracks(e){e&&(this._publishingTracks=e.map(({msid:t,from:r,ssrc:s,codec:n,type:o,trackId:c})=>({msid:t,from:r,type:o,ssrc:`${s}`,codec:n!=null?n:"",trackId:c})))}httpPublish(e,t=!1){return v(this,null,function*(){const{publishStream:r,videoSmallStream:s,screenStream:n,vMsid:o}=yield this.localStreamManager.createHTTPPublishStream();if(!r)return"";const c=this.getPubMsid(r,{vMsid:o});c.retryTimes=0,this.encodedInsertableStreams&&(c.encodedInsertableStreams=!0);let u=!r.hasVideo,h=o;try{this.startConnect();const l=yield this.rts.publish(e,r,c);return this.setConnected(!0),this._publishingTracks=this.rts.getPublishTrackInfoList(),s&&(yield this.publishAdd(e,s,{vMsid:M.VideoSmall},t),u=!1,h=M.VideoSmall),n&&(yield this.publishAdd(e,n,{vMsid:M.Screen},t),u=!1,h=M.Screen),yield this.waitPublishSender(e,u,h),l}catch(l){throw this.setConnected(!1),l}})}waitPublishSender(e,t=!1,r){return v(this,null,function*(){const s=(n,o)=>{let c=0;const u=()=>(t?this.rts.getPublishAudioStats(e,r):this.rts.getPublishVideoStats(e,r)).then(l=>!(l.bytesSent>0)&&c<n?(c++,new Promise(f=>setTimeout(()=>f(u()),o))):Promise.resolve());return u()};return Promise.race([et(1e3),s(5,100)]).catch(()=>{})})}checkSubscribeStats(e,t){return v(this,null,function*(){const r=(s,n)=>{let o=0;const c=()=>{const u=this.rts.getSubscribeVideoStats(e,t);return this.rts.getSubscribeAudioStats(e).then(l=>{var d;A.event(`[${Te.logName}]`,"AudioLevel",((d=l.audioLevel)!=null?d:0).toFixed(2))}),u.then(l=>(A.event(`[${Te.logName}]`,"VideoFramesDecoded",l.framesDecoded),!(l.framesDecoded>0)&&o<s?(o++,new Promise(f=>setTimeout(()=>f(c()),n))):Promise.resolve()))};return c()};return Promise.race([et(1200),r(10,100)]).catch(()=>{})})}getPublishVideoStats(e,t){return v(this,null,function*(){return yield this.rts.getPublishVideoStats(e,t)})}getPublishAudioStats(e,t){return v(this,null,function*(){return yield this.rts.getPublishAudioStats(e,t)})}publishAdd(e,t,r,s=!1,n=0,o=!1){return v(this,null,function*(){try{yield this.dcConnectingPromise;const c=yield this.rts.publishAdd([W({url:e,stream:t,updateSourceStream:!1},this.getPubMsid(t,r))]);if(c){const[u]=c;return this.updatePublishingTracks(u.trackInfoList),o&&(yield this.waitPublishSender(e,!t.hasVideo,t.hasVideo?r==null?void 0:r.vMsid:r==null?void 0:r.aMsid)),u.traceId||""}}catch(c){if(c.errorCode===15006&&n<3)return yield this.publishAdd(e,t,r,s,n+1);throw c}return""})}publishDelete(e,t){return v(this,null,function*(){var h,l,d,f,m,g,S,b;yield this.dcConnectingPromise;const r=(l=(h=this.publishingTracks)==null?void 0:h.find(({msid:w})=>w===M.Audio))==null?void 0:l.msid,s=(f=(d=this.publishingTracks)==null?void 0:d.find(({msid:w})=>w===M.VideoLarge))==null?void 0:f.msid,n=(g=(m=this.publishingTracks)==null?void 0:m.find(({msid:w})=>w===M.Screen))==null?void 0:g.msid,o=[];t.screen&&n?o.push(n):t.video&&o.push(t.vMsid||s);const c=[];t.audio&&r&&c.push(r),A.event(Te.logName,"publishDelete",{streamUrl:e,aMsid:c,vMsid:o});const[u]=(yield this.rts.publishDeleteTracks([{url:e,aMsid:c,vMsid:o}]))||[];return A.event(Te.logName,"publishDelete",{result:u}),u&&this.updatePublishingTracks(u.trackInfoList),((b=(S=u==null?void 0:u.trackInfoList)==null?void 0:S[0])==null?void 0:b.trackId)||""})}publishReplace(e,t,r){return v(this,null,function*(){var u,h;yield this.dcConnectingPromise;const{vMsid:s,aMsid:n}=r!=null?r:{},o=yield this.rts.publishReplaceTracks([{url:e,stream:t,updateSourceStream:!1,vMsid:s,aMsid:n}]),[c]=o;return this.updatePublishingTracks(c.trackInfoList),((h=(u=c==null?void 0:c.trackInfoList)==null?void 0:u[0])==null?void 0:h.trackId)||""})}publishStop(e){return v(this,null,function*(){return yield this.rts.publishStop([{url:e}]),this._publishingTracks=[],""})}unpublish(){return v(this,null,function*(){yield this.rts.unpublish(),this.connecting=!1,this.connected=!1})}getSubConfig(e,t){let r=t!=null?t:{};t||(r={audio:!0,video:!0,screen:!0});const s={};return r.audio&&(s.aMsid=[(e==null?void 0:e.getAudioInfo().msid)||M.Audio]),r.video?r.vMsid?s.vMsid=[r.vMsid]:e!=null&&e.hasVideoLarge?s.vMsid=[(e==null?void 0:e.getVideoLargeInfo().msid)||M.VideoLarge]:e!=null&&e.hasVideoSmall?s.vMsid=[(e==null?void 0:e.getVideoSmallInfo().msid)||M.VideoSmall]:s.vMsid=[M.VideoLarge]:r.screen&&e!=null&&e.hasScreen&&(s.vMsid=[(e==null?void 0:e.getScreenInfo().msid)||M.Screen]),s}httpSubscribe(e){return v(this,null,function*(){const{remoteUser:t,options:r}=e;let s=t.streamUrl;r.video||r.screen?r!=null&&r.audio||(s+="@subaudio=no"):s+="@subvideo=no";const n=this.getSubConfig(t.streamInfo,r);n.retryTimes=0,this.encodedInsertableStreams&&(n.encodedInsertableStreams=!0);try{this.startConnect();const o=yield this.rts.subscribe(s,n);return this.setConnected(!0),{traceId:o.traceId,stream:o}}catch(o){throw this.setConnected(!1),o}})}subscribeAdd(e){return v(this,null,function*(){var n,o,c,u,h;yield this.dcConnectingPromise;const{remoteUser:t,options:r}=e,s=_t(W({url:t.streamUrl,subAudio:!!r.audio,subVideo:!!(r.screen||r.video)},this.getSubConfig(t.streamInfo,r)),{targetStream:r.screen?t.getScreenStream:t.getCameraStream});try{const l=yield this.rts.subscribeAdd([s]);return s.subVideo&&this.checkSubscribeStats(t.streamUrl,(n=s.vMsid)==null?void 0:n[0]).then(()=>{var d;A.info(Te.logName,"checkSubscribeStats",{streamUrl:t.streamUrl,msid:(d=s.vMsid)==null?void 0:d[0]})}),l[0]}catch(l){if(((h=(u=(c=(o=l==null?void 0:l.extraInfo)==null?void 0:o.parsedData)==null?void 0:c.streams)==null?void 0:u[0])==null?void 0:h.res_code)===508)return this.emit("subscribeexceeds"),null;throw E.fromError(l)}return null})}subscibeDelete(e){return v(this,null,function*(){var n,o,c,u;yield this.dcConnectingPromise;const{remoteUser:t,options:r}=e,s=_t(W({url:t.streamUrl,subAudio:!!r.audio,subVideo:!!(r.screen||r.video)},this.getSubConfig(t.streamInfo,r)),{targetStream:r.screen?t.getScreenStream:t.getCameraStream});try{return(yield this.rts.subscribeDeleteTracks([s]))[0]}catch(h){if(((u=(c=(o=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:o.streams)==null?void 0:c[0])==null?void 0:u.res_code)===404)return;throw h}})}subscibeStop(e){return v(this,null,function*(){var t,r,s,n;try{yield this.rts.subscribeStop([{url:e}])}catch(o){if(((n=(s=(r=(t=o==null?void 0:o.extraInfo)==null?void 0:t.parsedData)==null?void 0:r.streams)==null?void 0:s[0])==null?void 0:n.res_code)===404)return;throw o}})}publish(e,t=!1){return v(this,null,function*(){let r="";if(this.connecting&&(yield this.connectingPromise),this.connected){yield this.dcConnectingPromise;let s=!1,n;const{audio:o,video:c,videoSmall:u,screen:h}=this.localStreamManager.publishStreams;o&&(r=yield this.publishAdd(e,o,{aMsid:M.Audio},t),s=!0,n=M.Audio,yield et(100)),c&&(r=yield this.publishAdd(e,c,{vMsid:M.VideoLarge},t),s=!1,n=M.VideoLarge,yield et(100)),u&&(r=yield this.publishAdd(e,u,{vMsid:M.VideoSmall},t),s=!1,n=M.VideoSmall,yield et(100)),h&&(r=yield this.publishAdd(e,h,{isScreen:!0,vMsid:M.Screen},t),s=!1,n=M.Screen),n&&(yield this.waitPublishSender(e,s,n))}else r=yield this.httpPublish(e,t);return r})}subscribe(e){return v(this,null,function*(){const{options:t}=e;if(t.video&&t.screen)throw new E(T.ERR_INNER,"subscribe error, video and screen cannot be subscribed at the same time");this.connecting&&(yield this.connectingPromise);let r;return this.connected?(yield this.dcConnectingPromise,r=yield this.subscribeAdd(e)):r=yield this.httpSubscribe(e),r})}getSubscribeVideoStats(e,t){return v(this,null,function*(){return yield this.rts.getSubscribeVideoStats(e,t)})}getSubscribeAudioStats(e,t){return v(this,null,function*(){return yield this.rts.getSubscribeAudioStats(e,t)})}sendSEI(e,t,r,s){return v(this,null,function*(){return this.rts.sendSEI({url:e,vMsid:M.VideoLarge,data:t,repeatCount:r,payloadType:s})})}},p(Te,"logName","RtsManager"),Te);ve([y()],pe.prototype,"updatePublishingTracks",1),ve([y(I,I)],pe.prototype,"httpPublish",1),ve([y(I,I)],pe.prototype,"waitPublishSender",1),ve([y(([i,a,e])=>[i,JSON.stringify(e)],I)],pe.prototype,"publishAdd",1),ve([y(I,I)],pe.prototype,"publishDelete",1),ve([y(([i,a,e])=>[i,JSON.stringify(e)])],pe.prototype,"publishReplace",1),ve([y(I)],pe.prototype,"publishStop",1),ve([y()],pe.prototype,"unpublish",1),ve([y(Zt,({traceId:i})=>i)],pe.prototype,"httpSubscribe",1),ve([y(Zt,({traceId:i})=>i)],pe.prototype,"subscribeAdd",1),ve([y(Zt)],pe.prototype,"subscibeDelete",1),ve([y(I)],pe.prototype,"subscibeStop",1),ve([y(I)],pe.prototype,"publish",1),ve([y(Zt)],pe.prototype,"subscribe",1),ve([y()],pe.prototype,"sendSEI",1);let tn=pe;class qi{constructor(){p(this,"profile");p(this,"profileMap",new Map);p(this,"audioProfile");p(this,"contentHint")}updateProfile(a,e){e&&this.profileMap.set(a,e),this.profile=a}get videoProfile(){return this.profile}updateAudioProfile(a){this.audioProfile=a}setContentHint(a,e){e&&(this.contentHint=e),this.contentHint&&a&&(a.contentHint=this.contentHint)}setVideoProfile(a,e,t=!1){return v(this,null,function*(){if(!this.profile)return;const r=this.profileMap.get(this.profile)||(e==null?void 0:e.VideoProfileMap.get(this.profile));if(r){if(!t&&a&&a.applyConstraints)try{yield a.applyConstraints(r)}catch(s){}e&&(e==null||e.VideoProfileMap.set(this.profile,r),yield e.setVideoProfile(this.profile))}})}}class Gi extends X{constructor(e){super();p(this,"type");p(this,"originVideoTrack");p(this,"videoSource");p(this,"_videoMuted",!1);p(this,"originAudioTrack");p(this,"audioSource");p(this,"_audioMuted",!1);p(this,"_targetVideoTrack");p(this,"_targetDualVideoTrack");p(this,"_targetAudioTrack");p(this,"_publishVideoStream");p(this,"_publishDualVideoStream");p(this,"_publishAudioStream");p(this,"_previewStream");p(this,"plugins",[]);p(this,"_profileManager");p(this,"cameraVideoConstraints");p(this,"micAudioConstraints");p(this,"onVideoTrackEnded",()=>{this.emit("videotrackended")});p(this,"onAudioTrackEnded",()=>{this.emit("audiotrackended")});this.type=e}get profileManager(){return this._profileManager}get audioProfile(){var e;return(e=this.profileManager)==null?void 0:e.audioProfile}updateSource(e,t,r){return v(this,null,function*(){var o,c,u,h,l,d;const{videoTrack:s,audioTrack:n}=e;s&&((o=this.originVideoTrack)==null||o.removeEventListener("ended",this.onVideoTrackEnded)),n&&((c=this.originAudioTrack)==null||c.removeEventListener("ended",this.onAudioTrackEnded)),this.type===ae.AliRtcSdkStreamTypeScreen?this.stop():(s&&((u=this.originVideoTrack)==null||u.stop()),n&&((h=this.originAudioTrack)==null||h.stop())),s&&(this.originVideoTrack=s,(l=this.originVideoTrack)==null||l.addEventListener("ended",this.onVideoTrackEnded),this.videoSource=t||ft.Camera,this.updateVideoTrack(s)),n&&(this.originAudioTrack=n,(d=this.originAudioTrack)==null||d.addEventListener("ended",this.onAudioTrackEnded),this.audioSource=r||Wt.Microphone,this.updateAudioTrack(n))})}get currentProfile(){var e;return(e=this.profileManager)==null?void 0:e.profile}get currentVideoTrack(){return this._targetVideoTrack}get currentDualVideoTrack(){return this._targetDualVideoTrack}get publishVideoStream(){return this._publishVideoStream}get publishDualVideoStream(){return this._publishDualVideoStream}get currentAudioTrack(){return this._targetAudioTrack}get publishAudioStream(){return this._publishAudioStream}get previewStream(){return this._previewStream}updateVideoTrack(e,t=!1){return v(this,null,function*(){(this._targetVideoTrack!==e||t)&&(this._targetVideoTrack=e)})}updateDualVideoTrack(e,t=!1){return v(this,null,function*(){(this._targetDualVideoTrack!==e||t)&&(this._targetDualVideoTrack=e)})}updateAudioTrack(e,t=!1){return v(this,null,function*(){(this._targetAudioTrack!==e||t)&&(this._targetAudioTrack=e)})}setAudioMuted(e){var t,r;this._audioMuted=e,e?(t=this.publishAudioStream)==null||t.disableAudio():(r=this.publishAudioStream)==null||r.enableAudio()}get isAudioMuted(){return this._audioMuted}setVideoMuted(e){var t,r;this._videoMuted=e,e?(t=this.publishVideoStream)==null||t.disableVideo():(r=this.publishVideoStream)==null||r.enableVideo()}get isVideoMuted(){return this._videoMuted}process(e){return v(this,null,function*(){var t,r,s,n,o,c,u,h,l,d,f,m;this._targetAudioTrack=this.originAudioTrack,this._targetVideoTrack=this.originVideoTrack;for(const g of this.plugins)try{yield g.execute(this,e)}catch(S){console.error(`error in plugin-${g.name}, error: ${S}`)}this._targetVideoTrack?((r=(t=this._publishVideoStream)==null?void 0:t.videoTrack)==null?void 0:r.id)!==this._targetVideoTrack.id&&(this._publishVideoStream=yield Mt(this._targetVideoTrack),this.setVideoMuted(this._videoMuted),(s=this.profileManager)==null||s.setVideoProfile(this.originVideoTrack,this._publishVideoStream,!0),(n=this.profileManager)==null||n.setContentHint(this._targetVideoTrack),this.previewStream?(o=this.previewStream)==null||o.mergeStream(this._publishVideoStream):this._previewStream=yield Mt(this._targetVideoTrack)):(this._publishVideoStream=void 0,(c=this.previewStream)==null||c.deleteTracks({video:!0})),this._targetDualVideoTrack?((h=(u=this._publishDualVideoStream)==null?void 0:u.videoTrack)==null?void 0:h.id)!==this._targetDualVideoTrack.id&&(this._publishDualVideoStream=yield Mt(this._targetDualVideoTrack),this._videoMuted?this._publishDualVideoStream.disableVideo():this._publishDualVideoStream.enableVideo()):this._publishDualVideoStream=void 0,this._targetAudioTrack?((d=(l=this._publishAudioStream)==null?void 0:l.audioTrack)==null?void 0:d.id)!==this._targetAudioTrack.id&&(this._publishAudioStream=yield Mt(this._targetAudioTrack),this.setAudioMuted(this._audioMuted),this.previewStream?(f=this.previewStream)==null||f.mergeStream(this._publishAudioStream):this._previewStream=yield Mt(this._targetAudioTrack)):(this._publishAudioStream=void 0,(m=this.previewStream)==null||m.deleteTracks({audio:!0}))})}stopVideo(){var e,t;this.originVideoTrack&&((e=this.originVideoTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(t=this.originVideoTrack)==null||t.stop(),this.originVideoTrack=void 0),this.updateVideoTrack(void 0)}stopAudio(){var e,t;this.originAudioTrack&&((e=this.originAudioTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(t=this.originAudioTrack)==null||t.stop(),this.originAudioTrack=void 0),this.updateAudioTrack(void 0)}stop(){this.stopVideo(),this.stopAudio()}updateVideoProfile(e,t){return v(this,null,function*(){this._profileManager||(this._profileManager=new qi),e&&this._profileManager.updateProfile(e,t),yield this._profileManager.setVideoProfile(this.originVideoTrack,this._publishVideoStream,this.type===ae.AliRtcSdkStreamTypeScreen)})}get videoProfile(){var e;return(e=this.profileManager)==null?void 0:e.videoProfile}setVideoContentHint(e){this._profileManager||(this._profileManager=new qi),this._profileManager.setContentHint(this.currentVideoTrack,e)}updateAudioProfile(e){return v(this,null,function*(){this._profileManager||(this._profileManager=new qi),this._profileManager.updateAudioProfile(e)})}cloneVideoProfile(e){return v(this,null,function*(){var t;yield(t=this.profileManager)==null?void 0:t.setVideoProfile(void 0,e)})}addPlugin(e){const t=this.plugins.findIndex(r=>r.zIndex>e.zIndex);t>-1?this.plugins.splice(t,0,e):this.plugins.push(e)}removePlugin(e){const t=this.plugins.indexOf(e);return t>-1?(e.clear(this),this.plugins.splice(t,1),!0):!1}}var rn=Object.defineProperty,sn=Object.getOwnPropertyDescriptor,Oe=(i,a,e,t)=>{for(var r=t>1?void 0:t?sn(a,e):a,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(t?n(a,e,r):n(r))||r);return t&&r&&rn(a,e,r),r};const Me=(vt=class extends X{constructor(e){super();p(this,"pluginManager");p(this,"publishingCameraVideoStream");p(this,"publishingScreenVideoStream");p(this,"cameraStreamInfo",new Gi(ae.AliRtcSdkStreamTypeCapture));p(this,"screenStreamInfo",new Gi(ae.AliRtcSdkStreamTypeScreen));p(this,"streamInfos",[this.cameraStreamInfo,this.screenStreamInfo]);p(this,"_audioCaptureDisabled",!1);p(this,"_cameraCaptureDisabled",!1);p(this,"_publishLocalAudioStreamEnabled",!0);p(this,"_publishLocalVideoStreamEnabled",!0);p(this,"_publishLocalScreenStreamEnabled",!0);this.screenStreamInfo.setVideoContentHint("motion"),this.pluginManager=e;const t=r=>v(this,null,function*(){if(A.info(`[${vt.logName}]`,"plugin added",r.name),!r.isSupported("6.11.6-beta.1")){console.warn(`${r.name} is not supported!!!`),r.emit("unsupported");return}try{yield r.init()}catch(s){r.emit("error",E.fromError(s,it.AliRtcPluginErrorInitError))}r.streamType===ae.AliRtcSdkStreamTypeCapture&&(this.cameraStreamInfo.addPlugin(r),yield this.cameraStreamInfo.process(this.streamInfos)),r.streamType===ae.AliRtcSdkStreamTypeScreen&&(this.screenStreamInfo.addPlugin(r),yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")});this.cameraStreamInfo.updateVideoProfile(Kr,kt),this.cameraStreamInfo.on("videotrackended",()=>v(this,null,function*(){yield this.stopLocalStream({video:!0}),this.emit("trackended",ht.VideoTrackEnded)})),this.cameraStreamInfo.on("audiotrackended",()=>v(this,null,function*(){yield this.stopLocalStream({audio:!0}),this.emit("trackended",ht.AudioTrackEnded)})),this.screenStreamInfo.updateVideoProfile(Jr,Ct),this.screenStreamInfo.on("videotrackended",()=>v(this,null,function*(){yield this.stopLocalStream({screen:!0}),this.emit("trackended",ht.ScreenTrackEnded)})),this.pluginManager.on("added",t),this.pluginManager.on("removed",r=>v(this,null,function*(){this.cameraStreamInfo.removePlugin(r)&&(yield this.cameraStreamInfo.process(this.streamInfos)),this.screenStreamInfo.removePlugin(r)&&(yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")})),this.pluginManager.on("updated",()=>v(this,null,function*(){yield this.updateStreams()}))}get hasCamera(){return!!this.cameraStreamInfo.originVideoTrack}get audioCaptureDisabled(){return this._audioCaptureDisabled}set audioCaptureDisabled(e){this._audioCaptureDisabled=e}get cameraCaptureDisabled(){return this._cameraCaptureDisabled}setAudioMuted(e){this.cameraStreamInfo.setAudioMuted(e)}get isAudioMuted(){return this.cameraStreamInfo.isAudioMuted}setCameraMuted(e){this.cameraStreamInfo.setVideoMuted(e)}get isCameraMuted(){return this.cameraStreamInfo.isVideoMuted}setScreenMuted(e){this.screenStreamInfo.setVideoMuted(e)}get isScreenMuted(){return this.screenStreamInfo.isVideoMuted}set cameraCaptureDisabled(e){this._cameraCaptureDisabled=e}get publishLocalAudioStreamEnabled(){return this._publishLocalAudioStreamEnabled}set publishLocalAudioStreamEnabled(e){this._publishLocalAudioStreamEnabled=e}get publishLocalVideoStreamEnabled(){return this._publishLocalVideoStreamEnabled}set publishLocalVideoStreamEnabled(e){this._publishLocalVideoStreamEnabled=e}get publishLocalScreenStreamEnabled(){return this._publishLocalScreenStreamEnabled}set publishLocalScreenStreamEnabled(e){this._publishLocalScreenStreamEnabled=e}updateStreams(){return v(this,null,function*(){yield this.cameraStreamInfo.process(this.streamInfos),yield this.screenStreamInfo.process(this.streamInfos),this.emit("publishupdate")})}setAvailableCameraDeviceId(){return v(this,null,function*(){var e,t,r,s;if((e=this.cameraStreamInfo.cameraVideoConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.cameraVideoConstraints)==null?void 0:t.deviceId;const o=yield D.AliRTS.getCameraList();o.find(c=>c.deviceId===n)||(n=(s=(r=o.find(c=>!!c.deviceId))==null?void 0:r.deviceId)!=null?s:""),this.cameraStreamInfo.cameraVideoConstraints.deviceId=n}})}setAvailableMicrophoneDeviceId(){return v(this,null,function*(){var e,t,r,s;if((e=this.cameraStreamInfo.micAudioConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.micAudioConstraints)==null?void 0:t.deviceId;const o=yield D.AliRTS.getMicList();o.find(c=>c.deviceId===n)||(n=(s=(r=o.find(c=>!!c.deviceId))==null?void 0:r.deviceId)!=null?s:""),this.cameraStreamInfo.micAudioConstraints.deviceId=n}})}createLocalStream(e){return v(this,null,function*(){const{screen:t,mediaStream:r,videoProfile:s,screenProfile:n}=e;let{video:o,audio:c}=e;const u=ja(e);let h;if(u){if(r||(o===!0&&this.cameraStreamInfo.cameraVideoConstraints?(yield this.setAvailableCameraDeviceId(),o=W({},this.cameraStreamInfo.cameraVideoConstraints)):typeof o=="object"&&(yield this.setAvailableCameraDeviceId(),o=W(W({},o),this.cameraStreamInfo.cameraVideoConstraints)),c===void 0&&this.audioCaptureDisabled?c=!1:c&&(c===!0&&this.cameraStreamInfo.micAudioConstraints?(yield this.setAvailableMicrophoneDeviceId(),c=W({},this.cameraStreamInfo.micAudioConstraints)):typeof c=="object"&&(yield this.setAvailableMicrophoneDeviceId(),c=W(W({},c),this.cameraStreamInfo.micAudioConstraints)),this._audioCaptureDisabled=!1)),h=yield D.AliRTS.createStream({audio:c,video:o,screen:t,custom:!!r,mediaStream:r,skipProfile:!0}),t)yield this.screenStreamInfo.updateSource(h,ft.Screen,Wt.Screen),yield this.setScreenProfile(n),this.setScreenContentHint(),this.publishingScreenVideoStream=void 0;else if(yield this.cameraStreamInfo.updateSource(h,ft.Camera,Wt.Microphone),h.hasVideo&&(yield this.setVideoProfile(s),this.setVideoContentHint(),this.publishingCameraVideoStream=void 0),h.hasAudio&&typeof c=="boolean"){const l=this.cameraStreamInfo.audioProfile;l&&(yield h.setAudioProfile(l))}}return D.AliRTS.SystenUtil.isIos&&D.AliRTS.SystenUtil.compareVersion("15.1")&&!D.AliRTS.SystenUtil.compareVersion("15.2")&&(yield et(1e3)),yield this.updateStreams(),h})}stopLocalStream(e){return v(this,null,function*(){const{screen:t,video:r,audio:s}=e!=null?e:{};let n=!1;r&&this.cameraStreamInfo.originVideoTrack&&(n=!0,this.cameraStreamInfo.stopVideo(),this.publishingCameraVideoStream=void 0),s&&this.cameraStreamInfo.originAudioTrack&&(n=!0,this.cameraStreamInfo.stopAudio()),t&&this.screenStreamInfo.originVideoTrack&&(n=!0,this.screenStreamInfo.stop(),this.publishingScreenVideoStream=void 0),n&&(yield this.updateStreams())})}get publishStreams(){const{publishLocalVideoStreamEnabled:e,publishLocalAudioStreamEnabled:t,publishLocalScreenStreamEnabled:r}=this;return{video:e?this.cameraStreamInfo.publishVideoStream:void 0,videoSmall:e?this.cameraStreamInfo.publishDualVideoStream:void 0,audio:t?this.cameraStreamInfo.publishAudioStream:void 0,screen:r?this.screenStreamInfo.publishVideoStream:void 0}}createHTTPPublishStream(){return v(this,null,function*(){var c,u,h,l;let e,t=!1,r,s,n;const o=yield this.publishStreams;try{if(!o.audio&&!o.video&&!o.videoSmall&&!o.screen)throw new E(T.ERR_SDK_PUBLISH_INVAILD,"no tracks founded");const d=new MediaStream;(c=o.audio)!=null&&c.audioTrack&&d.addTrack(o.audio.audioTrack),(u=o.video)!=null&&u.videoTrack?(d.addTrack(o.video.videoTrack),s=o.videoSmall,n=o.screen):(h=o.screen)!=null&&h.videoTrack&&(r=M.Screen,d.addTrack((l=o.screen)==null?void 0:l.videoTrack),t=!0),e=yield Xr(d),t?(this.screenStreamInfo.cloneVideoProfile(e),this.publishingScreenVideoStream=e):(this.cameraStreamInfo.cloneVideoProfile(e),this.publishingCameraVideoStream=e)}catch(d){}return{publishStream:e,videoSmallStream:s,screenStream:n,vMsid:r}})}stop(){this.cameraStreamInfo.stop(),this.screenStreamInfo.stop()}setVideoProfile(e,t){return v(this,null,function*(){yield this.cameraStreamInfo.updateVideoProfile(e,t),this.publishingCameraVideoStream&&this.cameraStreamInfo.cloneVideoProfile(this.publishingCameraVideoStream)})}setVideoContentHint(e){this.cameraStreamInfo.setVideoContentHint(e)}setAudioProfile(e){return v(this,null,function*(){var t;yield this.cameraStreamInfo.updateAudioProfile(e),yield(t=this.publishingCameraVideoStream)==null?void 0:t.setAudioProfile(e)})}setScreenProfile(e,t){return v(this,null,function*(){yield this.screenStreamInfo.updateVideoProfile(e,t),this.publishingScreenVideoStream&&this.screenStreamInfo.cloneVideoProfile(this.publishingScreenVideoStream)})}setScreenContentHint(e){this.screenStreamInfo.setVideoContentHint(e)}setCameraVideoConstraints(e){var t;this.cameraStreamInfo.cameraVideoConstraints=W(W({},(t=this.cameraStreamInfo.cameraVideoConstraints)!=null?t:{}),e)}setMicAudioConstraints(e){var t;this.cameraStreamInfo.micAudioConstraints=W(W({},(t=this.cameraStreamInfo.micAudioConstraints)!=null?t:{}),e)}},p(vt,"logName","LocalStreamManager"),vt);Oe([y(([i])=>{const{audio:a,video:e,screen:t,custom:r,skipProfile:s,videoProfile:n,screenProfile:o}=i;return[{audio:a,video:e,screen:t,custom:r,skipProfile:s,videoProfile:n,screenProfile:o}]})],Me.prototype,"createLocalStream",1),Oe([y(I)],Me.prototype,"stopLocalStream",1),Oe([y()],Me.prototype,"createHTTPPublishStream",1),Oe([y()],Me.prototype,"stop",1),Oe([y(I)],Me.prototype,"setVideoProfile",1),Oe([y(I)],Me.prototype,"setVideoContentHint",1),Oe([y(I)],Me.prototype,"setAudioProfile",1),Oe([y(I)],Me.prototype,"setScreenProfile",1),Oe([y(I)],Me.prototype,"setScreenContentHint",1),Oe([y(I)],Me.prototype,"setCameraVideoConstraints",1),Oe([y(I)],Me.prototype,"setMicAudioConstraints",1);let an=Me;var nn=Object.defineProperty,on=Object.getOwnPropertyDescriptor,Ve=(i,a,e,t)=>{for(var r=t>1?void 0:t?on(a,e):a,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(t?n(a,e,r):n(r))||r);return t&&r&&nn(a,e,r),r};class Ee extends X{constructor(e){super();p(this,"self");p(this,"userMap",{});p(this,"usersViewMap",{});p(this,"rtsManager");p(this,"localStreamManager");p(this,"authInfo");p(this,"signalingManager");p(this,"pluginManager");p(this,"reporter");p(this,"webTrackingClient");p(this,"statsMonitorId");p(this,"autoSubAudio",!0);p(this,"autoSubVideo",!0);p(this,"autoSubScreen",!0);p(this,"wantSubAudio",!0);p(this,"wantSubVideo",!0);p(this,"wantSubScreen",!0);p(this,"defaultStreamType",oe.AliRtcVideoStreamTypeHigh);p(this,"audioMuted",!1);p(this,"playoutVolume",1);p(this,"audioVolumeIndicationInterval",0);p(this,"indicationTimer",0);const{signalingManager:t,reporter:r,webTrackingClient:s}=e;this.signalingManager=t,this.addSignalingManagerListener(),this.reporter=r,this.webTrackingClient=s,this.pluginManager=new Qa,this.localStreamManager=new an(this.pluginManager),this.rtsManager=new tn(this.localStreamManager),this.self=new zr({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,reporter:this.reporter,webTrackingClient:this.webTrackingClient,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval})}addSignalingManagerListener(){this.signalingManager.on("onNotifyPublish",e=>{A.event("[Signaling] Notify Publish ",e),e.forEach(t=>{this.onRemotePublishStateChange(t)})})}isAutoSubAudio(){return this.autoSubAudio}setAutoSubAudio(e){this.autoSubAudio=e}isAutoSubVideo(){return this.autoSubVideo}setAutoSubVideo(e){this.autoSubVideo=e}isAutoSubScreen(){return this.autoSubScreen}setAutoSubScreen(e){this.autoSubScreen=e}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e,this.remoteUsers.forEach(t=>{t.setWantSubAudio(e),t.updateSubscribe()})}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e,this.remoteUsers.forEach(t=>{t.setWantSubVideo(e),t.updateSubscribe()})}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e,this.remoteUsers.forEach(t=>{t.setWantSubScreen(e),t.updateSubscribe()})}setRemoteDefaultVideoStreamType(e){this.defaultStreamType=e,this.remoteUsers.forEach(t=>{t.setRemoteDefaultVideoStreamType(e)})}setRemoteUserVideoStreamType(e,t){var r;(r=this.getRemoteUser(e))==null||r.setRemoteDefaultVideoStreamType(t)}setAudioMuted(e){this.audioMuted=e,this.remoteUsers.forEach(t=>{t.setAudioMuted(e)})}setLocalViewConfig(e,t){var s;if(!e)return(s=this.publisher)==null?void 0:s.setViewConfig(null,t);const r=Ji(e);r.length!==0&&r.forEach(n=>{var o,c;(o=this.publisher)==null||o.resetElement(n),Object.values(this.usersViewMap).forEach(({cameraViews:u=[],screenViews:h=[]})=>{u.includes(n)&&u.splice(u.indexOf(n),1),h.includes(n)&&h.splice(h.indexOf(n),1)}),(c=this.publisher)==null||c.setViewConfig(r,t)})}setRemoteViewConfig(e,t,r){var n,o;if(!t)return(n=this.userMap[e])==null?void 0:n.setViewConfig(null,r);const s=Ji(t);s.length!==0&&(s.forEach(c=>{var u;(u=this.publisher)==null||u.resetElement(c),Object.values(this.usersViewMap).forEach(({cameraViews:h=[],screenViews:l=[]})=>{h.includes(c)&&h.splice(h.indexOf(c),1),l.includes(c)&&l.splice(l.indexOf(c),1)})}),(o=this.userMap[e])==null||o.setViewConfig(s,r))}get channel(){var e;return(e=this.authInfo)==null?void 0:e.channelId}get userId(){var e;return(e=this.authInfo)==null?void 0:e.userId}get remoteUsers(){return Object.values(this.userMap)}get publisher(){return this.self}get isSubscribing(){var e;return((e=this.remoteUsers)!=null?e:[]).some(t=>{var c;const{isAudioSubscribing:r,isVideoLargeSubscribing:s,isVideoSmallSubscribing:n,isScreenSubscribing:o}=(c=t.streamInfo)!=null?c:{};return r||s||n||o})}onRemotePublishStateChange(e){var d;const{userid:t,callid:r,subscribe:s,pubid:n="",tracks:o}=e,c=(d=s==null?void 0:s.pullstreamurl)!=null?d:"";let u=this.getRemoteUser(t);if(!u)return;const h=u.streamInfo.audioTrackInfo,l=u.streamInfo.videoTrackInfo;u.updateRemoteTracks(r,c,n,o),u.updateSubscribe(),(h!==u.streamInfo.audioTrackInfo||l!==u.streamInfo.videoTrackInfo)&&this.emit("remoteTrackAvailableChange",t,u.streamInfo.audioTrackInfo,u.streamInfo.videoTrackInfo)}init(e,t){var r;this.authInfo=e,this.self||(this.self=new zr({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,reporter:this.reporter,webTrackingClient:this.webTrackingClient,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval})),this.self.enableAudioVolumeIndication(this.audioVolumeIndicationInterval),(r=this.self)==null||r.initInfo(e,t.pushstreamurl),t.users.forEach(s=>{const n=s.userid;if(n){const o=this.addUser(n,s.displayname),{callid:c,subscribe:u,tracks:h}=s;o.updateRemoteTracks(c,(u==null?void 0:u.pullstreamurl)||"","",h),this.emit("remoteTrackAvailableChange",n,o.streamInfo.audioTrackInfo,o.streamInfo.videoTrackInfo)}}),this.startStatsMonitor()}clear(){return v(this,null,function*(){var e;this.stopStatsMonitor();for(let t in this.userMap)this.userMap[t]&&(yield this.userMap[t].clear(),delete this.userMap[t]);yield(e=this.self)==null?void 0:e.clear(),this.authInfo=void 0})}startStatsMonitor(){this.statsMonitorId=window.setInterval(()=>v(this,null,function*(){if(this.publisher){const{audio:r,video:s}=yield this.publisher.getStats();r&&r.length>0&&this.emit("rtcLocalAudioStats",r),s&&s.length>0&&this.emit("rtcLocalVideoStats",s)}const e=[],t=[];for(const r of this.remoteUsers){const{audio:s,video:n}=yield r.getStats();s&&s.forEach(o=>{e.push(o)}),n&&n.forEach(o=>{t.push(o)})}e.length>0&&this.emit("rtcRemoteAudioStats",e),t.length>0&&this.emit("rtcRemoteVideoStats",t)}),2e3)}stopStatsMonitor(){this.statsMonitorId&&clearInterval(this.statsMonitorId)}getUser(e,t){return this.addUser(e,t),this.userMap[e]}addUser(e,t){return this.userMap[e]||(this.userMap[e]=this.executeAddUser(e,t)),this.userMap[e]}executeAddUser(e,t){var s;const r=new re({userId:e,displayName:t,rtsManager:this.rtsManager,signalingManager:this.signalingManager,usersViewMap:this.usersViewMap,reporter:this.reporter,webTrackingClient:this.webTrackingClient,localUserId:(s=this.userId)!=null?s:"",audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,playoutVolume:this.playoutVolume});return r.on(be.Remote,this.onRemoteDeviceStatusChange.bind(this)),r.on(J.PullStreamStats,this.onRemoteStatReport.bind(this)),r.on(J.RtsSubscribeExceeds,this.onSubscribeExceeds.bind(this)),r.on("audioSubscribeStateChanged",(n,o,c,u)=>{this.emit("audioSubscribeStateChanged",n,o,c,u,this.channel||"")}),r.on("videoSubscribeStateChanged",(n,o,c,u)=>{this.emit("videoSubscribeStateChanged",n,o,c,u,this.channel||"")}),r.on("screenSubscribeStateChanged",(n,o,c,u)=>{this.emit("screenSubscribeStateChanged",n,o,c,u,this.channel||"")}),r.on("remoteAudioAutoPlayFail",n=>{this.emit("remoteAudioAutoPlayFail",n)}),r.on("remoteVideoAutoPlayFail",(n,o)=>{this.emit("remoteVideoAutoPlayFail",n,o)}),r.on("remoteSubscribeError",n=>{this.emit("remoteSubscribeError",n)}),r.setWantSubAudio(this.autoSubAudio&&this.wantSubAudio),r.setWantSubVideo(this.autoSubVideo&&this.wantSubVideo),r.setWantSubScreen(this.autoSubScreen&&this.wantSubScreen),r.setRemoteDefaultVideoStreamType(this.defaultStreamType),r.setAudioMuted(this.audioMuted),(this.autoSubAudio||this.autoSubVideo||this.autoSubScreen)&&r.updateSubscribe(),r}onRemoteDeviceStatusChange(e,t){e===J.MuteAudio?this.emit("userAudioMuted",t,!0):e===J.UnmuteAudio?this.emit("userAudioMuted",t,!1):e===J.MuteVideo?this.emit("userVideoMuted",t,!0):e===J.UnmuteVideo?this.emit("userVideoMuted",t,!1):e===J.MuteScreen?this.emit("userScreenMuted",t,!0):e===J.UnmuteScreen&&this.emit("userScreenMuted",t,!1)}onRemoteStatReport(e,t,r){this.emit(J.PullStreamStats,e,t,r)}onSubscribeExceeds(e,t){this.emit(J.RtsSubscribeExceeds,e,t)}removeLeftUser(e){return v(this,null,function*(){e.userid&&this.userMap[e.userid]&&(yield this.userMap[e.userid].clear(!1),delete this.userMap[e.userid])})}updateUsers(e){const t=[],r=[],s={};e.forEach(c=>{c.userid&&(this.userMap[c.userid]?(r.push(c),s[c.userid]=this.userMap[c.userid]):(t.push(c),s[c.userid]=this.executeAddUser(c.userid,c.displayname)))});const n=Object.keys(this.userMap),o=[];return n.forEach(c=>{s[c]||o.push({userid:c,reason:"",leavecode:Fi.AliRtcUserOfflineQuit})}),this.userMap=s,{joinList:t,leaveList:o,presentList:r}}getRemoteUser(e){return this.userMap[e]}updateRemoteUserDeviceStatus(e){e&&e.userid&&this.userMap[e.userid]&&this.userMap[e.userid].updateRemoteUserDeviceStatus(e.status)}updateAudioWant(e,t){const r=this.userMap[e];if(!r)throw new E(T.ERR_INNER,`no remote user(${e}) founded`);r.setWantSubAudio(t),t?r.updateSubscribe():r.stopSubscribe({audio:!0})}updateVideoWant(e,t){const r=this.userMap[e];if(!r)throw new E(T.ERR_INNER,`no remote user(${e}) founded`);r.setWantSubVideo(t),t?r.updateSubscribe():r.stopSubscribe({video:!0})}updateScreenWant(e,t){const r=this.userMap[e];if(!r)throw new E(T.ERR_INNER,`no remote user(${e}) founded`);r.setWantSubScreen(t),t?r.updateSubscribe():r.stopSubscribe({screen:!0})}stopIndication(){this.indicationTimer&&window.clearInterval(this.indicationTimer)}startIndication(e){this.stopIndication(),this.indicationTimer=window.setInterval(()=>{var r;const t=this.remoteUsers.map(s=>({userId:s.userId,volume:s.getAudioLevel()||0}));t.unshift({userId:"",volume:((r=this.self)==null?void 0:r.getAudioLevel())||0}),this.emit("audioVolume",t)},e)}enableAudioVolumeIndication(e){var t;this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.stopIndication(),e>0&&this.startIndication(e),this.audioVolumeIndicationInterval=e,this.remoteUsers.forEach(r=>{r.enableAudioVolumeIndication(e)}),(t=this.self)==null||t.enableAudioVolumeIndication(e))}setPlayoutVolume(e){this.playoutVolume=e,this.remoteUsers.forEach(t=>{t.setPlayoutVolume(e)})}refreshAuthInfo(e){var t;this.authInfo&&(this.authInfo=W(W({},this.authInfo),e)),e.userId&&((t=this.self)==null||t.refreshUserInfo(e.userId))}setEnableMediaExtensionMsg(e){this.rtsManager.setEncodedInsertableStreams(e)}setAudioRedEnabled(e){this.rtsManager.setAudioRedEnabled(e)}}p(Ee,"logName","UserManager"),Ve([y()],Ee.prototype,"init",1),Ve([y()],Ee.prototype,"clear",1),Ve([y(I)],Ee.prototype,"addUser",1),Ve([y()],Ee.prototype,"removeLeftUser",1),Ve([y()],Ee.prototype,"updateUsers",1),Ve([y(I)],Ee.prototype,"updateAudioWant",1),Ve([y(I)],Ee.prototype,"updateVideoWant",1),Ve([y(I)],Ee.prototype,"updateScreenWant",1),Ve([y()],Ee.prototype,"stopIndication",1),Ve([y()],Ee.prototype,"startIndication",1),Ve([y()],Ee.prototype,"enableAudioVolumeIndication",1);const zi=i=>v(this,null,function*(){const a=new Uint8Array(160).fill(170),e=new TextEncoder().encode(i),t=yield window.crypto.subtle.importKey("raw",a,{name:"HMAC",hash:{name:"SHA-1"}},!1,["sign"]),r=yield window.crypto.subtle.sign("HMAC",t,e);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")});class cn{constructor(){p(this,"authInfo")}doRequest(a,e){var u;const t=this.authInfo;if(!t)return Promise.reject(Fe.LiveTranscodingErrorInvalidParam);const r="https://gw.rtn.aliyuncs.com",s=Pa[a],n={appid:t.appId,userid:t.userId,channelid:t.channelId,timestamp:t.timestamp,token:t.token,nonce:t.nonce?t.nonce:"",requestid:Ye.createCallid(),tokensid:!1,session:(u=t.callid)!=null?u:Ye.createCallid()},o=Object.keys(n).map(h=>`${h}=${encodeURIComponent(n[h])}`).join("&"),c=`${r}${s}?${o}`;return fetch(c,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:e}).then(h=>h.status!==200?Promise.reject(new E(T.ERR_INNER,`transcoding request failed, status: ${h.status}`)):h)}setAuthInfo(a){this.authInfo=a}clear(){this.authInfo=void 0}startPublishLiveStream(a,e){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(Fe.LiveTranscodingErrorInvalidParam);const t=yield zi(a.split("?")[0]),r=we.MPU_TASK_TRANSACTION_UPDATE,s=e.toJson(r,this.authInfo,t,a);return this.doRequest(r,JSON.stringify(s))})}startPublishLiveStreamWithTaskId(a,e){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(Fe.LiveTranscodingErrorInvalidParam);const t=we.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(t,this.authInfo,a);return this.doRequest(t,JSON.stringify(r))})}updatePublishLiveStream(a,e){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(Fe.LiveTranscodingErrorInvalidParam);const t=yield zi(a.split("?")[0]),r=we.MPU_TASK_TRANSACTION_UPDATE,s=e.toJson(r,this.authInfo,t,a);return this.doRequest(r,JSON.stringify(s))})}updatePublishLiveStreamWithTaskId(a,e){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(Fe.LiveTranscodingErrorInvalidParam);const t=we.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(t,this.authInfo,a);return this.doRequest(t,JSON.stringify(r))})}stopPublishLiveStream(a){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(Fe.LiveTranscodingErrorInvalidParam);const e=yield zi(a.split("?")[0]),t=we.MPU_TASK_TRANSACTION_STOP,r=new zt().toJson(t,this.authInfo,e,a);return this.doRequest(t,JSON.stringify(r))})}stopPublishLiveStreamWithTaskId(a){if(!this.authInfo)return Promise.reject(Fe.LiveTranscodingErrorInvalidParam);const e=we.MPU_TASK_TRANSACTION_STOP,t=new zt().toJson(e,this.authInfo,a);return this.doRequest(e,JSON.stringify(t))}refreshAuthInfo(a){this.authInfo&&this.setAuthInfo(W(W({},this.authInfo),a))}}var Qr=(i,a,e)=>{if(!a.has(i))throw TypeError("Cannot "+e)},ei=(i,a,e)=>(Qr(i,a,"read from private field"),e?e.call(i):a.get(i)),Xi=(i,a,e)=>{if(a.has(i))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(i):a.set(i,e)},Yi=(i,a,e,t)=>(Qr(i,a,"write to private field"),t?t.call(i,e):a.set(i,e),e),un=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},N={},lt={};const hn="SLS_CLIENT";var Zr=(i=>(i.ERROR="error",i.LOG="log",i.LOCATION="pv",i.API="api",i.RESOURCE="res",i.RESOURCE_ERROR="res_err",i.PERF="perf",i.CONSOLE_LOG="console",i))(Zr||{}),es=(i=>(i.LOG_SEND="LOG_SEND",i.BROWSER_SEND="BROWSER_SEND",i.BASE_TRANSFORM="BASE_TRANSFORM",i.BROWSER_BASE_TRANSFORM="BROWSER_BASE_TRANSFORM",i.BROWSER_FETCH="BROWSER_FETCH",i.BROWSER_XHR="BROWSER_XHR",i.BROWSER_LOCATION="BROWSER_LOCATION",i.BROWSER_RUNTIME_ERROR="BROWSER_RUNTIME_ERROR",i.BROWSER_CUSTOM_ERROR="BROWSER_CUSTOM_ERROR",i.BROWSER_RESOURCE_ERROR="BROWSER_RESOURCE_ERROR",i.BROWSER_CONSOLE="BROWSER_CONSOLE",i.BROWSER_PERF="BROWSER_PERF",i.BROWSER_RESOURSE="BROWSER_RESOURSE",i.MINI_SEND="MINI_SEND",i.MINI_REQUEST="MINI_REQUEST",i.MINI_BASE_TRANSFORM="MINI_BASE_TRANSFORM",i.MINI_ROUTE="MINI_ROUTE",i))(es||{});const ln={BROWSER_SEND:-1,MINI_SEND:-2,BASE_TRANSFORM:100,BROWSER_BASE_TRANSFORM:100*2,MINI_BASE_TRANSFORM:100*2+1,BROWSER_PERF:100*3+1,BROWSER_FETCH:100*4,BROWSER_XHR:100*4+1,MINI_REQUEST:100*4+2,BROWSER_RUNTIME_ERROR:100*5},dn="sls-trace-uid";var ts=(i=>(i.OK="OK",i.ERROR="ERROR",i.UNSET="UNSET",i))(ts||{});lt.InternalPlugin=es,lt.InternalPluginPriority=ln,lt.OTStatusCode=ts,lt.SLS_CLIENT_NAME=hn,lt.SLS_TRACE_UID_KEY=dn,lt.WebEventType=Zr;var De=lt;function Qi(i,a,e){Object.defineProperty(i,a,{writable:!0,enumerable:!0,configurable:!0,value:e})}function pn(i,a,e,t){t?t(()=>{Qi(i,a,e)}):Qi(i,a,e)}class gn{constructor(a){this.onFirstSubscribe=a,this.observers=[]}subscribe(a){return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(a),{unsubscribe:()=>{this.observers=this.observers.filter(e=>a!==e),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(a){this.observers.forEach(e=>e(a))}}function Lt(i,a,e){try{return i.apply(a,e)}catch(t){return}}function fn(i){return function(){return Lt(i,this,arguments)}}let mn=!1;function Sn(){return mn}function is(...i){}var bn=Object.defineProperty,vn=Object.defineProperties,yn=Object.getOwnPropertyDescriptors,rs=Object.getOwnPropertySymbols,wn=Object.prototype.hasOwnProperty,_n=Object.prototype.propertyIsEnumerable,ss=(i,a,e)=>a in i?bn(i,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[a]=e,Rn=(i,a)=>{for(var e in a||(a={}))wn.call(a,e)&&ss(i,e,a[e]);if(rs)for(var e of rs(a))_n.call(a,e)&&ss(i,e,a[e]);return i},In=(i,a)=>vn(i,yn(a));const as=1e3,ns=60*as,os=60*ns,cs=24*os,us=365*cs,En=1024,hs="0.1.0";function An(){}function ls(i){return typeof i=="number"}function Tn(i){return Object.prototype.toString.call(i)==="[object String]"}function Pn(i){return Object.prototype.toString.call(i)==="[object Error]"}function ds(i,a){return+i.toFixed(a)}function kn(i,a){return i.indexOf(a)!==-1}function Cn(i,a){return i==null?a:!!i}function ti(i){return i?(parseInt(i,10)^Math.random()*16>>parseInt(i,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,ti)}function ps(i=20){var a,e;const t=new Array(i),r=Date.now().toString(36).split("");for(;i-- >0;)e=(a=36*Math.random()|0).toString(36),t[i]=a%3?e:e.toUpperCase();for(var s=0;s<8;s++)t.splice(3*s+2,0,r[s]);return t.join("")}function Mn(i){return i!==0&&Math.random()<=i}function ii(i,a){return(...e)=>{try{return i(...e)}catch(t){console.error(a,t)}}}function gs(i){return"https://"+i.project+"."+i.host+"/logstores/"+i.logstore+"/track"}function Nn(i,a){return a?i.includes(gs(a)):i.includes("/track?APIVersion=0.6.0")}const fs=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;function Ln(i){try{return decodeURIComponent(i)}catch(a){return unescape(i)}}function On(i){return typeof i=="string"&&fs.test(i)}function Vn(i){var a=Ln(i||"").match(fs);if(a==null)return null;var e=(a[3]||"").split(":"),t=e.length?(a[2]||"").replace(/(.*\@)/,""):a[2];return{uri:a[0],protocol:a[1],host:t,hostname:a[4],port:a[5],auth:a[3],user:e[0],password:e[1],path:a[6],search:a[7],hash:a[8]}}function Dn(i,a,e,t){const r={url:i,method:a,status_code:e};return t==null?r:In(Rn({},r),{host:t.host,scheme:t.protocol})}function xn(i,a,...e){return a==null||!Array.isArray(a)?!1:a.some(t=>{if(typeof t=="function")try{return t(i,...e)}catch(r){return console.error("user function callback threw an error:",r),!1}return typeof t=="string"?i.includes(t):Object.prototype.toString.call(t)==="[object RegExp]"?t.test(i):!1})}function Un(i,a,e){return i===!1?!1:i===!0||i==="error"&&!e?!0:typeof i=="function"?ii(i,"call shouldTrackBody failed")(a):!1}function Bn(i){return{relative:i,timeStamp:ms(i)}}function ms(i){const a=Date.now()-performance.now();return a>Ot()?Math.round(a+i):bs(i)}function Hn(){return Math.round(Date.now()-(Ot()+performance.now()))}function Fn(i){return ls(i)?ds(i*1e6,0):i}function Zi(){return Date.now()}function Ss(){return performance.now()}function jn(){return{relative:Ss(),timeStamp:Zi()}}function $n(){return{relative:0,timeStamp:Ot()}}function Wn(i,a){return a-i}function Kn(i){return i-Ot()}function bs(i){return Math.round(Ot()+i)}function Jn(i){return i<us}let ri;function Ot(){return ri===void 0&&(ri=performance.timing.navigationStart),ri}function qn(){ri=void 0}const dt="?";function Vt(i,a){let e;const t=a===void 0?0:+a;try{if(e=zn(i),e)return e}catch(r){}try{if(e=Gn(i),e)return e}catch(r){}try{if(e=Xn(i),e)return e}catch(r){}try{if(e=vs(i,t+1),e)return e}catch(r){}return{message:ge(i,"message"),name:ge(i,"name"),stack:[]}}function Gn(i){const a=ge(i,"stack");if(!a)return;const e=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,t=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,r=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;let s;const n=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,o=/\((\S*)(?::(\d+))(?::(\d+))\)/,c=a.split(`
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
at ${t}${r} @ ${e.url}${s}${n}`}),encodeURIComponent(a)}function so(i,a,e,t=!0){var r;if(!i||i.message===void 0&&!(a instanceof Error))return{message:`${e} ${JSON.stringify(a)}`,stacktrace:"",type:i&&i.name,id:ti()};i!=null&&i.stack&&t&&(i.stack=_s(i.stack));const s=(r=i==null?void 0:i.stack)==null?void 0:r[0];return{message:encodeURIComponent(i.message||"Empty message"),stacktrace:tr(i),type:i.name,col:s?s.column:void 0,line:s?s.line:void 0,file:encodeURIComponent(s&&s.url?s.url:""),id:ti()}}function ao(){const i=new Error;let a;return Lt(()=>{const e=Vt(i);e!=null&&e.stack&&(e.stack=_s(e.stack)),a=tr(e)}),a}const no=8,oo=16,ir="b3",rr="traceparent",sr="uber-trace-id",si=Array(32);function Rs(i){for(let a=0;a<i*2;a++)si[a]=Math.floor(Math.random()*16)+48,si[a]>=58&&(si[a]+=39);return String.fromCharCode.apply(null,si.slice(0,i*2))}function Is(){return Rs(oo)}function ar(){return Rs(no)}function ai(i,a){return`${i}-${a}-1`}function ni(i,a){return`00-${i}-${a}-01`}function oi(i,a){return`${i}:${a}:0:1`}const ci={b3:{name:ir,getter:ai},traceparent:{name:rr,getter:ni},uber:{name:sr,getter:oi}};function co(i,a,e,t){var r;const s=t!=null?t:{};s.headers=(r=s.headers)!=null?r:{},s.headers[ir]=ai(i,a),s.headers[rr]=ni(i,a),s.headers[sr]=oi(i,a);try{if(e)for(const[n,o]of Object.entries(e))ci[o]&&(s.headers[n]=ci[o].getter(i,a))}catch(n){}return s}function uo(i,a,e,t){i.setRequestHeader(ir,ai(a,e)),i.setRequestHeader(rr,ni(a,e)),i.setRequestHeader(sr,oi(a,e));try{if(t)for(const[r,s]of Object.entries(t))ci[s]&&i.setRequestHeader(r,ci[s].getter(a,e))}catch(r){}}function Dt(i,a,e){i!=null&&Object.keys(i).map(t=>{e==null||e==""?a[t]=i[t]:a[`${e}.${t}`]=i[t]})}var ho=Object.defineProperty,lo=Object.defineProperties,po=Object.getOwnPropertyDescriptors,Es=Object.getOwnPropertySymbols,go=Object.prototype.hasOwnProperty,fo=Object.prototype.propertyIsEnumerable,As=(i,a,e)=>a in i?ho(i,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[a]=e,mo=(i,a)=>{for(var e in a||(a={}))go.call(a,e)&&As(i,e,a[e]);if(Es)for(var e of Es(a))fo.call(a,e)&&As(i,e,a[e]);return i},So=(i,a)=>lo(i,po(a));function bo(){return{name:De.InternalPlugin.BASE_TRANSFORM,run:function(){this.subscribe("*",(i,a)=>{const{otBase:e,extra:t}=i;e.attribute=So(mo({},e.attribute),{sid:this.session.getSessionId(),pid:this.session.getPageId(),uid:this.options.uid,service:this.options.service}),this.options.nickname&&(e.attribute.nickname=this.options.nickname),Dt(this.options.custom,e.attribute,"custom"),Dt({env:this.options.env,version:this.options.version},e.attribute),Dt({sdk_version:hs,workspace:this.options.workspace},e.resource);const r={otBase:e,extra:t};is(De.InternalPlugin.BASE_TRANSFORM,r),a(r)},De.InternalPluginPriority[De.InternalPlugin.BASE_TRANSFORM])}}}function vo(){return{name:De.InternalPlugin.LOG_SEND,run:function(){}}}function Ts(i,a,e){if(a<0)return;const t=s=>{Ts(i,a-1,s)},r=i[a];ii(()=>{r.callback.call(void 0,e,t)},"plugin notify run error")()}class yo{constructor(a){this.subscribeMap={},this.allNotifiers=[],this.allNotifiers=a}subscribeOne(a,e,t,r){var s;const n=(s=this.subscribeMap[e])!=null?s:[];this.subscribeMap[e]=n,n.push({name:a,priority:r,callback:t}),n.sort((o,c)=>o.priority-c.priority)}notify(a,e){var t;const r=(t=this.subscribeMap[a])!=null?t:[];Ts(r,r.length-1,e)}subscribe(a,e,t,r){if(e==="*")for(let s=0;s<this.allNotifiers.length;s++){const n=this.allNotifiers[s];this.subscribeOne(a,n,t,r)}else this.subscribeOne(a,e,t,r)}getSubscribeMap(){return this.subscribeMap}}function wo(){const i=Is();let a=ar();return{getSessionId:()=>i,getPageId:()=>a,refreshPageId:()=>{a=ar()}}}var _o=Object.defineProperty,Ro=Object.defineProperties,Io=Object.getOwnPropertyDescriptors,Ps=Object.getOwnPropertySymbols,Eo=Object.prototype.hasOwnProperty,Ao=Object.prototype.propertyIsEnumerable,ks=(i,a,e)=>a in i?_o(i,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[a]=e,To=(i,a)=>{for(var e in a||(a={}))Eo.call(a,e)&&ks(i,e,a[e]);if(Ps)for(var e of Ps(a))Ao.call(a,e)&&ks(i,e,a[e]);return i},Po=(i,a)=>Ro(i,Io(a));const ko=["uid","nickname","env","service","version","custom"];class Co{constructor(a){this.isInit=!1,this.pendingPlugins=[],this.pluginMap={},this.session=wo();var e,t;this.options=a,this.use(vo()),this.use(bo()),this.options.env=(e=a.env)!=null?e:"prod",this.options.version=(t=a.version)!=null?t:"-"}initPlugin(a){if(a==null||typeof a!="object"){console.error("plugin is not a object");return}if(a.name==null||a.name===""){console.error("plugin name is required.");return}if(this.pluginMap[a.name]){console.error(`plugin name: ${a.name} is conflict`);return}if(typeof a.run!="function"){console.error("plugin.run is not a function");return}const e=Po(To({},this.context),{subscribe:(t,r,s)=>{this.sub.subscribe(a.name,t,r,s)},notify:t=>{this.sub.notify(a.name,t)}});ii(()=>a.run.call(e),`plugin ${a.name} init failed`)()}addLog(a){if(this.isInit){const e={t:De.WebEventType.LOG};Dt(a,e,De.WebEventType.LOG);const t={start:Zi()*1e3,attribute:e,resource:{}};this.sub.notify(De.InternalPlugin.LOG_SEND,{otBase:t,extra:{}})}else console.error("log should call after start")}setOptions(a){this.isInit?ko.forEach(e=>{a[e]!==this.options[e]&&a[e]!=null&&a[e]!=""&&(this.options[e]=a[e],e==="uid"&&typeof this.setLocalStorage=="function"&&this.setLocalStorage(De.SLS_TRACE_UID_KEY,a[e]))}):console.error("setOptions should call after start")}start(){if(!this.isInit){this.isInit=!0;let a=this.options.uid;(a==null||a==="")&&(typeof this.getLocalStorage=="function"&&(a=this.getLocalStorage(De.SLS_TRACE_UID_KEY)),(a==null||a==="")&&(a=ps())),this.options.uid=a,typeof this.setLocalStorage=="function"&&this.setLocalStorage(De.SLS_TRACE_UID_KEY,a);const e=this.pendingPlugins.map(t=>t==null?void 0:t.name).filter(t=>t!=null);this.sub=new yo(e),this.context={options:this.options,session:this.session};for(const t of this.pendingPlugins)this.initPlugin(t)}}use(a){this.isInit?console.error(`plugin: ${a==null?void 0:a.name} use should run before start`):this.pendingPlugins.push(a)}}var Mo=Object.defineProperty,Cs=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,Lo=Object.prototype.propertyIsEnumerable,Ms=(i,a,e)=>a in i?Mo(i,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[a]=e,Oo=(i,a)=>{for(var e in a||(a={}))No.call(a,e)&&Ms(i,e,a[e]);if(Cs)for(var e of Cs(a))Lo.call(a,e)&&Ms(i,e,a[e]);return i};function Vo(i,a){var e;const t={current:void 0},r=[];let s={};return typeof a=="function"&&(s=(e=a(t))!=null?e:{}),Oo({init:n=>{if(t.current!=null)return;t.current=i(n);const o=t.current;r.forEach(c=>{o.use(c)}),o.start()},use:n=>{r.push(n)},addLog:n=>{t.current.addLog(n)},onReady(n){n()},setOptions:n=>{t.current.setOptions(n)}},s)}class Do{constructor(){this.dep=new Map}subscribe(a,e){const t=this.dep.get(a);if(t){this.dep.set(a,t.concat(e));return}this.dep.set(a,[e])}notify(a,e){const t=this.dep.get(a);!a||!t||t.forEach(r=>{try{r(e)}catch(s){console.error(s)}})}}N.ONE_DAY=cs,N.ONE_HOUR=os,N.ONE_KILO_BYTE=En,N.ONE_MINUTE=ns,N.ONE_SECOND=as,N.ONE_YEAR=us,N.Observable=gn,N.SDK_VERSION=hs,N.SLSClient=Co,N.Subscribe=Do,N.assembleOTAttribute=Dt,N.buildHttpInfo=Dn,N.callMonitored=Lt,N.catchUserErrors=ii,N.clocksNow=jn,N.clocksOrigin=$n,N.computeStackTrace=Vt,N.createHandlingStack=ao,N.currentDrift=Hn,N.debugLog=is,N.defineGlobal=pn,N.defineGlobalValue=Qi,N.elapsed=Wn,N.formatErrorMessage=ws,N.formatUnknownError=so,N.genUid=ps,N.generateSpanId=ar,N.generateTraceId=Is,N.generateUUID=ti,N.getB3Header=ai,N.getConsoleLogStatus=Sn,N.getCorrectedTimeStamp=ms,N.getJaegerTraceHeaderr=oi,N.getRelativeTime=Kn,N.getTimeStamp=bs,N.getTrackUrl=gs,N.getW3CTraceHeader=ni,N.includes=kn,N.instrumentMethod=ys,N.instrumentMethodAndCallOriginal=er,N.isError=Pn,N.isInternalUrl=Nn,N.isNumber=ls,N.isString=Tn,N.isURL=On,N.looksLikeRelativeTime=Jn,N.makeWebPublicApi=Vo,N.matchCondition=xn,N.matchSample=Mn,N.matchWithDefault=Cn,N.monitor=fn,N.noop=An,N.parseUri=Vn,N.patchHeaderOnRequest=co,N.patchHeaderOnXhr=uo,N.relativeNow=Ss,N.relativeToClocks=Bn,N.resetNavigationStart=qn,N.round=ds,N.shouldTrackBody=Un,N.startUnhandledErrorCollection=to,N.timeStampNow=Zi,N.toServerDuration=Fn,N.toStackTraceString=tr;var xo=class{constructor(i){this.timer=null,this.time=10,this.count=10,this.arr=[];var a,e;this.time=(a=i.time)!=null?a:10,this.count=(e=i.count)!=null?e:10,this.url="https://"+i.project+"."+i.host+"/logstores/"+i.logstore+"/track",this.opt=i,i.installUnloadHook&&typeof i.installUnloadHook=="function"&&i.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(i=this.arr){const a={__logs__:i};return this.opt.tags&&(a.__tags__=this.opt.tags),this.opt.topic&&(a.__topic__=this.opt.topic),this.opt.source&&(a.__source__=this.opt.source),JSON.stringify(a)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const i=this.assemblePayload();this.opt.sendPayload(this.url,i)}}transString(i){let a={};for(let e in i)typeof i[e]=="object"?a[e]=JSON.stringify(i[e]):a[e]=String(i[e]);return a}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const i=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){i.sendImmediateInner()},this.time*1e3)}}send(i){const a=this.transString(i);this.arr.push(a),this.sendInner()}sendImmediate(i){const a=this.transString(i);this.arr.push(a),this.sendImmediateInner()}sendBatchLogs(i){const a=i.map(e=>this.transString(e));this.arr.push(...a),this.sendInner()}sendBatchLogsImmediate(i){const a=i.map(e=>this.transString(e));this.arr.push(...a),this.sendImmediateInner()}},Uo=N,Bo=xo;function Ho(i,a){return navigator&&navigator.sendBeacon?navigator.sendBeacon(`${i}?APIVersion=0.6.0`,a):!1}function Fo(i,a){const e=new window.XMLHttpRequest;e.open("POST",i,!0),e.setRequestHeader("x-log-apiversion","0.6.0"),e.setRequestHeader("x-log-bodyrawsize",a.length.toString());const t=new Blob([a],{type:"application/x-protobuf"});e.send(t)}function jo(i,a){try{Ho(i,a)||Fo(i,a)}catch(e){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
|
|
9
|
-
`+e),console.error("Failed log data:",i))}}class Ns extends Bo{constructor(a){const e=Object.assign({},a,{installUnloadHook:t=>{window.addEventListener("beforeunload",()=>{t()})},sendPayload:(t,r)=>{jo(t,r)}});super(e)}}Uo.defineGlobal(window,"SLS_Tracker",Ns);var $o=Ns,ui={},Wo={get exports(){return ui},set exports(i){ui=i}};(function(i,a){(function(e,t){var r="1.0.35",s="",n="?",o="function",c="undefined",u="object",h="string",l="major",d="model",f="name",m="type",g="vendor",S="version",b="architecture",w="console",_="mobile",R="tablet",V="smarttv",K="wearable",F="embedded",O=350,ee="Amazon",Re="Apple",st="ASUS",he="BlackBerry",le="Browser",ye="Chrome",$e="Edge",Ge="Firefox",ze="Google",Ne="Huawei",Pe="LG",xe="Microsoft",Ie="Motorola",fe="Opera",me="Samsung",We="Sharp",Y="Sony",de="Xiaomi",Ke="Zebra",Ut="Facebook",yt="Chromium OS",Bt="Mac OS",gt=function($,z){var H={};for(var Q in $)z[Q]&&z[Q].length%2===0?H[Q]=z[Q].concat($[Q]):H[Q]=$[Q];return H},at=function($){for(var z={},H=0;H<$.length;H++)z[$[H].toUpperCase()]=$[H];return z},Ht=function($,z){return typeof $===h?Ft(z).indexOf(Ft($))!==-1:!1},Ft=function($){return $.toLowerCase()},wc=function($){return typeof $===h?$.replace(/[^\d\.]/g,s).split(".")[0]:t},pr=function($,z){if(typeof $===h)return $=$.replace(/^\s\s*/,s),typeof z===c?$:$.substring(0,O)},jt=function($,z){for(var H=0,Q,nt,Je,G,U,Xe;H<z.length&&!U;){var fr=z[H],Qs=z[H+1];for(Q=nt=0;Q<fr.length&&!U&&fr[Q];)if(U=fr[Q++].exec($),U)for(Je=0;Je<Qs.length;Je++)Xe=U[++nt],G=Qs[Je],typeof G===u&&G.length>0?G.length===2?typeof G[1]==o?this[G[0]]=G[1].call(this,Xe):this[G[0]]=G[1]:G.length===3?typeof G[1]===o&&!(G[1].exec&&G[1].test)?this[G[0]]=Xe?G[1].call(this,Xe,G[2]):t:this[G[0]]=Xe?Xe.replace(G[1],G[2]):t:G.length===4&&(this[G[0]]=Xe?G[3].call(this,Xe.replace(G[1],G[2])):t):this[G]=Xe||t;H+=2}},gr=function($,z){for(var H in z)if(typeof z[H]===u&&z[H].length>0){for(var Q=0;Q<z[H].length;Q++)if(Ht(z[H][Q],$))return H===n?t:H}else if(Ht(z[H],$))return H===n?t:H;return $},_c={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Xs={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Ys={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[S,[f,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[S,[f,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[f,S],[/opios[\/ ]+([\w\.]+)/i],[S,[f,fe+" Mini"]],[/\bopr\/([\w\.]+)/i],[S,[f,fe]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[f,S],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[S,[f,"UC"+le]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[S,[f,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[S,[f,"WeChat"]],[/konqueror\/([\w\.]+)/i],[S,[f,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[S,[f,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[S,[f,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[f,/(.+)/,"$1 Secure "+le],S],[/\bfocus\/([\w\.]+)/i],[S,[f,Ge+" Focus"]],[/\bopt\/([\w\.]+)/i],[S,[f,fe+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[S,[f,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[S,[f,"Dolphin"]],[/coast\/([\w\.]+)/i],[S,[f,fe+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[S,[f,"MIUI "+le]],[/fxios\/([-\w\.]+)/i],[S,[f,Ge]],[/\bqihu|(qi?ho?o?|360)browser/i],[[f,"360 "+le]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[f,/(.+)/,"$1 "+le],S],[/(comodo_dragon)\/([\w\.]+)/i],[[f,/_/g," "],S],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[f,S],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[f],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[f,Ut],S],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[f,S],[/\bgsa\/([\w\.]+) .*safari\//i],[S,[f,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[S,[f,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[S,[f,ye+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[f,ye+" WebView"],S],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[S,[f,"Android "+le]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[f,S],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[S,[f,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[S,f],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[f,[S,gr,_c]],[/(webkit|khtml)\/([\w\.]+)/i],[f,S],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[f,"Netscape"],S],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[S,[f,Ge+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[f,S],[/(cobalt)\/([\w\.]+)/i],[f,[S,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[b,"amd64"]],[/(ia32(?=;))/i],[[b,Ft]],[/((?:i[346]|x)86)[;\)]/i],[[b,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[b,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[b,"armhf"]],[/windows (ce|mobile); ppc;/i],[[b,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[b,/ower/,s,Ft]],[/(sun4\w)[;\)]/i],[[b,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[b,Ft]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[g,me],[m,R]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[g,me],[m,_]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[d,[g,Re],[m,_]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[g,Re],[m,R]],[/(macintosh);/i],[d,[g,Re]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[g,We],[m,_]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[g,Ne],[m,R]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[g,Ne],[m,_]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[g,de],[m,_]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[g,de],[m,R]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[g,"OPPO"],[m,_]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[g,"Vivo"],[m,_]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[g,"Realme"],[m,_]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[g,Ie],[m,_]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[g,Ie],[m,R]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[g,Pe],[m,R]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[g,Pe],[m,_]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[g,"Lenovo"],[m,R]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[g,"Nokia"],[m,_]],[/(pixel c)\b/i],[d,[g,ze],[m,R]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[g,ze],[m,_]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[g,Y],[m,_]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[g,Y],[m,R]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[g,"OnePlus"],[m,_]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[g,ee],[m,R]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[g,ee],[m,_]],[/(playbook);[-\w\),; ]+(rim)/i],[d,g,[m,R]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[g,he],[m,_]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[g,st],[m,R]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[g,st],[m,_]],[/(nexus 9)/i],[d,[g,"HTC"],[m,R]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[g,[d,/_/g," "],[m,_]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[g,"Acer"],[m,R]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[g,"Meizu"],[m,_]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[g,d,[m,_]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[g,d,[m,R]],[/(surface duo)/i],[d,[g,xe],[m,R]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[g,"Fairphone"],[m,_]],[/(u304aa)/i],[d,[g,"AT&T"],[m,_]],[/\bsie-(\w*)/i],[d,[g,"Siemens"],[m,_]],[/\b(rct\w+) b/i],[d,[g,"RCA"],[m,R]],[/\b(venue[\d ]{2,7}) b/i],[d,[g,"Dell"],[m,R]],[/\b(q(?:mv|ta)\w+) b/i],[d,[g,"Verizon"],[m,R]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[g,"Barnes & Noble"],[m,R]],[/\b(tm\d{3}\w+) b/i],[d,[g,"NuVision"],[m,R]],[/\b(k88) b/i],[d,[g,"ZTE"],[m,R]],[/\b(nx\d{3}j) b/i],[d,[g,"ZTE"],[m,_]],[/\b(gen\d{3}) b.+49h/i],[d,[g,"Swiss"],[m,_]],[/\b(zur\d{3}) b/i],[d,[g,"Swiss"],[m,R]],[/\b((zeki)?tb.*\b) b/i],[d,[g,"Zeki"],[m,R]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[g,"Dragon Touch"],d,[m,R]],[/\b(ns-?\w{0,9}) b/i],[d,[g,"Insignia"],[m,R]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[g,"NextBook"],[m,R]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[g,"Voice"],d,[m,_]],[/\b(lvtel\-)?(v1[12]) b/i],[[g,"LvTel"],d,[m,_]],[/\b(ph-1) /i],[d,[g,"Essential"],[m,_]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[g,"Envizen"],[m,R]],[/\b(trio[-\w\. ]+) b/i],[d,[g,"MachSpeed"],[m,R]],[/\btu_(1491) b/i],[d,[g,"Rotor"],[m,R]],[/(shield[\w ]+) b/i],[d,[g,"Nvidia"],[m,R]],[/(sprint) (\w+)/i],[g,d,[m,_]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[g,xe],[m,_]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[g,Ke],[m,R]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[g,Ke],[m,_]],[/smart-tv.+(samsung)/i],[g,[m,V]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[g,me],[m,V]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[g,Pe],[m,V]],[/(apple) ?tv/i],[g,[d,Re+" TV"],[m,V]],[/crkey/i],[[d,ye+"cast"],[g,ze],[m,V]],[/droid.+aft(\w)( bui|\))/i],[d,[g,ee],[m,V]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[g,We],[m,V]],[/(bravia[\w ]+)( bui|\))/i],[d,[g,Y],[m,V]],[/(mitv-\w{5}) bui/i],[d,[g,de],[m,V]],[/Hbbtv.*(technisat) (.*);/i],[g,d,[m,V]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[g,pr],[d,pr],[m,V]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[m,V]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[g,d,[m,w]],[/droid.+; (shield) bui/i],[d,[g,"Nvidia"],[m,w]],[/(playstation [345portablevi]+)/i],[d,[g,Y],[m,w]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[g,xe],[m,w]],[/((pebble))app/i],[g,d,[m,K]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[g,Re],[m,K]],[/droid.+; (glass) \d/i],[d,[g,ze],[m,K]],[/droid.+; (wt63?0{2,3})\)/i],[d,[g,Ke],[m,K]],[/(quest( 2| pro)?)/i],[d,[g,Ut],[m,K]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[g,[m,F]],[/(aeobc)\b/i],[d,[g,ee],[m,F]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[m,_]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[m,R]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[m,R]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[m,_]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[g,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[S,[f,$e+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[S,[f,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[f,S],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[S,f]],os:[[/microsoft (windows) (vista|xp)/i],[f,S],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[f,[S,gr,Xs]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,"Windows"],[S,gr,Xs]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[S,/_/g,"."],[f,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[f,Bt],[S,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[S,f],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[f,S],[/\(bb(10);/i],[S,[f,he]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[S,[f,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[S,[f,Ge+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[S,[f,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[S,[f,"watchOS"]],[/crkey\/([\d\.]+)/i],[S,[f,ye+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[f,yt],S],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[f,S],[/(sunos) ?([\w\.\d]*)/i],[[f,"Solaris"],S],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[f,S]]},Ue=function($,z){if(typeof $===u&&(z=$,$=t),!(this instanceof Ue))return new Ue($,z).getResult();var H=typeof e!==c&&e.navigator?e.navigator:t,Q=$||(H&&H.userAgent?H.userAgent:s),nt=H&&H.userAgentData?H.userAgentData:t,Je=z?gt(Ys,z):Ys,G=H&&H.userAgent==Q;return this.getBrowser=function(){var U={};return U[f]=t,U[S]=t,jt.call(U,Q,Je.browser),U[l]=wc(U[S]),G&&H&&H.brave&&typeof H.brave.isBrave==o&&(U[f]="Brave"),U},this.getCPU=function(){var U={};return U[b]=t,jt.call(U,Q,Je.cpu),U},this.getDevice=function(){var U={};return U[g]=t,U[d]=t,U[m]=t,jt.call(U,Q,Je.device),G&&!U[m]&&nt&&nt.mobile&&(U[m]=_),G&&U[d]=="Macintosh"&&H&&typeof H.standalone!==c&&H.maxTouchPoints&&H.maxTouchPoints>2&&(U[d]="iPad",U[m]=R),U},this.getEngine=function(){var U={};return U[f]=t,U[S]=t,jt.call(U,Q,Je.engine),U},this.getOS=function(){var U={};return U[f]=t,U[S]=t,jt.call(U,Q,Je.os),G&&!U[f]&&nt&&nt.platform!="Unknown"&&(U[f]=nt.platform.replace(/chrome os/i,yt).replace(/macos/i,Bt)),U},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return Q},this.setUA=function(U){return Q=typeof U===h&&U.length>O?pr(U,O):U,this},this.setUA(Q),this};Ue.VERSION=r,Ue.BROWSER=at([f,S,l]),Ue.CPU=at([b]),Ue.DEVICE=at([d,g,m,w,_,V,R,K,F]),Ue.ENGINE=Ue.OS=at([f,S]),i.exports&&(a=i.exports=Ue),a.UAParser=Ue;var wt=typeof e!==c&&(e.jQuery||e.Zepto);if(wt&&!wt.ua){var fi=new Ue;wt.ua=fi.getResult(),wt.ua.get=function(){return fi.getUA()},wt.ua.set=function($){fi.setUA($);var z=fi.getResult();for(var H in z)wt.ua[H]=z[H]}}})(typeof window=="object"?window:un)})(Wo,ui);let hi;const Ko=new Uint8Array(16);function Jo(){if(!hi&&(hi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hi(Ko)}const ue=[];for(let i=0;i<256;++i)ue.push((i+256).toString(16).slice(1));function qo(i,a=0){return(ue[i[a+0]]+ue[i[a+1]]+ue[i[a+2]]+ue[i[a+3]]+"-"+ue[i[a+4]]+ue[i[a+5]]+"-"+ue[i[a+6]]+ue[i[a+7]]+"-"+ue[i[a+8]]+ue[i[a+9]]+"-"+ue[i[a+10]]+ue[i[a+11]]+ue[i[a+12]]+ue[i[a+13]]+ue[i[a+14]]+ue[i[a+15]]).toLowerCase()}const Go=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ls={randomUUID:Go};function zo(i,a,e){if(Ls.randomUUID&&!a&&!i)return Ls.randomUUID();i=i||{};const t=i.random||(i.rng||Jo)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,a){e=e||0;for(let r=0;r<16;++r)a[e+r]=t[r];return a}return qo(t)}var nr={},Xo={get exports(){return nr},set exports(i){nr=i}},or={},Yo={get exports(){return or},set exports(i){or=i}};(function(){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return a.rotl(e,8)&16711935|a.rotl(e,24)&4278255360;for(var t=0;t<e.length;t++)e[t]=a.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(Math.random()*256));return t},bytesToWords:function(e){for(var t=[],r=0,s=0;r<e.length;r++,s+=8)t[s>>>5]|=e[r]<<24-s%32;return t},wordsToBytes:function(e){for(var t=[],r=0;r<e.length*32;r+=8)t.push(e[r>>>5]>>>24-r%32&255);return t},bytesToHex:function(e){for(var t=[],r=0;r<e.length;r++)t.push((e[r]>>>4).toString(16)),t.push((e[r]&15).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},bytesToBase64:function(e){for(var t=[],r=0;r<e.length;r+=3)for(var s=e[r]<<16|e[r+1]<<8|e[r+2],n=0;n<4;n++)r*8+n*6<=e.length*8?t.push(i.charAt(s>>>6*(3-n)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/ig,"");for(var t=[],r=0,s=0;r<e.length;s=++r%4)s!=0&&t.push((i.indexOf(e.charAt(r-1))&Math.pow(2,-2*s+8)-1)<<s*2|i.indexOf(e.charAt(r))>>>6-s*2);return t}};Yo.exports=a})();var cr={utf8:{stringToBytes:function(i){return cr.bin.stringToBytes(unescape(encodeURIComponent(i)))},bytesToString:function(i){return decodeURIComponent(escape(cr.bin.bytesToString(i)))}},bin:{stringToBytes:function(i){for(var a=[],e=0;e<i.length;e++)a.push(i.charCodeAt(e)&255);return a},bytesToString:function(i){for(var a=[],e=0;e<i.length;e++)a.push(String.fromCharCode(i[e]));return a.join("")}}},Os=cr;/*!
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/var Qo=function(i){return i!=null&&(Vs(i)||Zo(i)||!!i._isBuffer)};function Vs(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function Zo(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&Vs(i.slice(0,0))}(function(){var i=or,a=Os.utf8,e=Qo,t=Os.bin,r=function(s,n){s.constructor==String?n&&n.encoding==="binary"?s=t.stringToBytes(s):s=a.stringToBytes(s):e(s)?s=Array.prototype.slice.call(s,0):!Array.isArray(s)&&s.constructor!==Uint8Array&&(s=s.toString());for(var o=i.bytesToWords(s),c=s.length*8,u=1732584193,h=-271733879,l=-1732584194,d=271733878,f=0;f<o.length;f++)o[f]=(o[f]<<8|o[f]>>>24)&16711935|(o[f]<<24|o[f]>>>8)&4278255360;o[c>>>5]|=128<<c%32,o[(c+64>>>9<<4)+14]=c;for(var m=r._ff,g=r._gg,S=r._hh,b=r._ii,f=0;f<o.length;f+=16){var w=u,_=h,R=l,V=d;u=m(u,h,l,d,o[f+0],7,-680876936),d=m(d,u,h,l,o[f+1],12,-389564586),l=m(l,d,u,h,o[f+2],17,606105819),h=m(h,l,d,u,o[f+3],22,-1044525330),u=m(u,h,l,d,o[f+4],7,-176418897),d=m(d,u,h,l,o[f+5],12,1200080426),l=m(l,d,u,h,o[f+6],17,-1473231341),h=m(h,l,d,u,o[f+7],22,-45705983),u=m(u,h,l,d,o[f+8],7,1770035416),d=m(d,u,h,l,o[f+9],12,-1958414417),l=m(l,d,u,h,o[f+10],17,-42063),h=m(h,l,d,u,o[f+11],22,-1990404162),u=m(u,h,l,d,o[f+12],7,1804603682),d=m(d,u,h,l,o[f+13],12,-40341101),l=m(l,d,u,h,o[f+14],17,-1502002290),h=m(h,l,d,u,o[f+15],22,1236535329),u=g(u,h,l,d,o[f+1],5,-165796510),d=g(d,u,h,l,o[f+6],9,-1069501632),l=g(l,d,u,h,o[f+11],14,643717713),h=g(h,l,d,u,o[f+0],20,-373897302),u=g(u,h,l,d,o[f+5],5,-701558691),d=g(d,u,h,l,o[f+10],9,38016083),l=g(l,d,u,h,o[f+15],14,-660478335),h=g(h,l,d,u,o[f+4],20,-405537848),u=g(u,h,l,d,o[f+9],5,568446438),d=g(d,u,h,l,o[f+14],9,-1019803690),l=g(l,d,u,h,o[f+3],14,-187363961),h=g(h,l,d,u,o[f+8],20,1163531501),u=g(u,h,l,d,o[f+13],5,-1444681467),d=g(d,u,h,l,o[f+2],9,-51403784),l=g(l,d,u,h,o[f+7],14,1735328473),h=g(h,l,d,u,o[f+12],20,-1926607734),u=S(u,h,l,d,o[f+5],4,-378558),d=S(d,u,h,l,o[f+8],11,-2022574463),l=S(l,d,u,h,o[f+11],16,1839030562),h=S(h,l,d,u,o[f+14],23,-35309556),u=S(u,h,l,d,o[f+1],4,-1530992060),d=S(d,u,h,l,o[f+4],11,1272893353),l=S(l,d,u,h,o[f+7],16,-155497632),h=S(h,l,d,u,o[f+10],23,-1094730640),u=S(u,h,l,d,o[f+13],4,681279174),d=S(d,u,h,l,o[f+0],11,-358537222),l=S(l,d,u,h,o[f+3],16,-722521979),h=S(h,l,d,u,o[f+6],23,76029189),u=S(u,h,l,d,o[f+9],4,-640364487),d=S(d,u,h,l,o[f+12],11,-421815835),l=S(l,d,u,h,o[f+15],16,530742520),h=S(h,l,d,u,o[f+2],23,-995338651),u=b(u,h,l,d,o[f+0],6,-198630844),d=b(d,u,h,l,o[f+7],10,1126891415),l=b(l,d,u,h,o[f+14],15,-1416354905),h=b(h,l,d,u,o[f+5],21,-57434055),u=b(u,h,l,d,o[f+12],6,1700485571),d=b(d,u,h,l,o[f+3],10,-1894986606),l=b(l,d,u,h,o[f+10],15,-1051523),h=b(h,l,d,u,o[f+1],21,-2054922799),u=b(u,h,l,d,o[f+8],6,1873313359),d=b(d,u,h,l,o[f+15],10,-30611744),l=b(l,d,u,h,o[f+6],15,-1560198380),h=b(h,l,d,u,o[f+13],21,1309151649),u=b(u,h,l,d,o[f+4],6,-145523070),d=b(d,u,h,l,o[f+11],10,-1120210379),l=b(l,d,u,h,o[f+2],15,718787259),h=b(h,l,d,u,o[f+9],21,-343485551),u=u+w>>>0,h=h+_>>>0,l=l+R>>>0,d=d+V>>>0}return i.endian([u,h,l,d])};r._ff=function(s,n,o,c,u,h,l){var d=s+(n&o|~n&c)+(u>>>0)+l;return(d<<h|d>>>32-h)+n},r._gg=function(s,n,o,c,u,h,l){var d=s+(n&c|o&~c)+(u>>>0)+l;return(d<<h|d>>>32-h)+n},r._hh=function(s,n,o,c,u,h,l){var d=s+(n^o^c)+(u>>>0)+l;return(d<<h|d>>>32-h)+n},r._ii=function(s,n,o,c,u,h,l){var d=s+(o^(n|~c))+(u>>>0)+l;return(d<<h|d>>>32-h)+n},r._blocksize=16,r._digestsize=16,Xo.exports=function(s,n){if(s==null)throw new Error("Illegal argument "+s);var o=i.wordsToBytes(r(s,n));return n&&n.asBytes?o:n&&n.asString?t.bytesToString(o):i.bytesToHex(o)}})();function ec(i){return i?i.toLowerCase().indexOf("android")>=0||i.toLowerCase().indexOf("ios")>=0?"h5":"pc":"unknown"}function tc(i){const a=nr(i),e=localStorage.getItem(a);if(e&&e.length===36)return e;const t=zo();return localStorage.setItem(a,t),t}var li,di,xt;class Ds{constructor(a){Xi(this,li,void 0),Xi(this,di,void 0),Xi(this,xt,void 0);const c=a,{commonParams:e,version:t}=c,r=ta(c,["commonParams","version"]);Yi(this,li,new $o(r)),Yi(this,xt,tc(r.project));const s=new ui;s.setUA(window.navigator.userAgent);const n=s.getResult(),o=W({av:t,os:n.os.name,ov:n.os.version,bt:n.browser.name,bv:n.browser.version,tt:ec(n.os.name),uuid:ei(this,xt),host:window.location.host},e);Yi(this,di,o)}getUUID(){return ei(this,xt)}send(a,e,t){ei(this,li).send(W(W({msgId:String(a),args:typeof e=="string"?e:new URLSearchParams(e).toString(),pu:window.location.href,ct:Date.now().toString()},ei(this,di)),t))}}li=new WeakMap,di=new WeakMap,xt=new WeakMap;class ic{constructor(a){p(this,"index",0);p(this,"tracker");p(this,"enable",!0);p(this,"commonParams",{});if(a===!1){this.enable=!1;return}if(typeof a=="object"&&a.extraParams&&typeof a.extraParams=="string")try{this.commonParams={extra:a.extraParams}}catch(e){}this.tracker=new Ds({version:Rt,host:"cn-hangzhou.log.aliyuncs.com",project:"web-rtc-grtn",logstore:"client",time:5,count:10,source:typeof a=="object"?a.biz:""})}updateAuthInfo(a){var e,t,r;this.commonParams=_t(W({},this.commonParams),{apid:(e=a==null?void 0:a.appId)!=null?e:"",usrid:(t=a==null?void 0:a.userId)!=null?t:"",channelid:(r=a==null?void 0:a.channelId)!=null?r:""})}reportJoinChannel(a){var t,r,s;const e={jnnonce:(t=a==null?void 0:a.nonce)!=null?t:"",jntoken:(r=a==null?void 0:a.token)!=null?r:"",jntm:(s=a==null?void 0:a.timestamp)!=null?s:""};this.report(70012,e)}reportJoinChannelRes(a,e,t){this.report(70013,{rslt:a,message:e,ct:t})}reportLeaveChannel(){this.report(70015)}reportPush(a,e,t,r,s,n,o,c,u,h,l,d){this.report(10030,{calid:a,isvl:e?1:0,isvs:t?1:0,isvss:r?1:0,isaudio:s?1:0,rslt:n,tid:o,pubtm:c,est:u,dctid:h,httptid:l,url:d})}reportPull(a,e,t,r,s,n,o,c,u,h,l,d){this.report(10050,{calid:a,rmtid:e,isvl:t?1:0,isvs:r?1:0,isvss:s?1:0,isaudio:n?1:0,rslt:o,tid:"",subtm:c,dctid:u,httptid:h,ajsub:1,url:l,est:d})}reportSubscribeAudioStats(a,e){const{ssrc:t,bytesReceived:r,packetsReceived:s,packetsLost:n,jitterBufferDelay:o,trackIdentifier:c,totalSamplesDuration:u,codec:h}=e,l=u,d=r/l,f=s/l,m=n/l,g=n/s;this.report(10080,{calid:"",rmtid:a,tckid:c,ssrc:t,codec:h,rbr:d,pr:f,pl:m,plr:g,jd:o})}reportSubscribeVideoStats(a,e){const{ssrc:t,bytesReceived:r,trackIdentifier:s,framesDecoded:n,framesReceived:o,frameHeight:c,frameWidth:u,nackCount:h,jitterBufferDelay:l,packetsReceived:d,packetsLost:f,totalInterFrameDelay:m,codec:g}=e,S=m,b=r/S,w=n/S,_=o/S,R=d/S,V=f/S,K=f/d;this.report(10080,{calid:"",rmtid:a,tckid:s,ssrc:t,codec:g,rbr:b,dfps:w,rfps:_,rh:c,rw:u,ns:h,jd:l,pr:R,pl:V,plr:K})}report(a,e,t){var r;this.enable&&((r=this.tracker)==null||r.send(a,e,W(W({},this.commonParams),t!=null?t:{})))}static reportCheck(a,e){new Ds({version:Rt,host:"cn-hangzhou.log.aliyuncs.com",project:"web-rtc-grtn",logstore:"client",time:5,count:10,source:e!=null?e:""}).send(100001,a)}}class rc{constructor(){p(this,"reporter");p(this,"param");p(this,"msgCacheArr",[]);p(this,"index",0)}start(a){this.initParam(a),this.reporter=new $t.LogReporter({wsUrl:"wss://logprod.aliyuncs.com/binlog",webtrackingUrl:"",wsConfig:{product:1}});let e=window.setInterval(()=>{this.msgCacheArr.length?this.realSendReport(this.msgCacheArr.shift()):(clearInterval(e),e=0)},200)}stop(){this.reporter&&(this.reporter.close(),this.reporter=void 0)}sendReport(a){A.info("[LogClient]",a),this.msgCacheArr.length===0&&this.param?this.realSendReport(a):this.msgCacheArr.push(a)}initParam(a){this.param||(this.param={osn:x.SystemUtil.systemName,osv:x.SystemUtil.systemVersion,udid:x.LocalStorage.uuid,statsvrs:"0.6.1",sdkvrs:Rt,dm:x.BrowserUtil.domain,bt:x.BrowserUtil.browserName,bv:x.BrowserUtil.browserVersion,envir:"PRODUCT",apid:a.appId,usrid:a.userId,channelid:a.channelId,evetid:0,args:""})}realSendReport(a){var t;let e={};for(let r in this.param)e[r]=this.param[r];for(let r in a)e[r]=a[r];e.idx=this.index,++this.index,(t=this.reporter)==null||t.send(e)}}class sc{constructor(){p(this,"logClient");this.logClient=new rc}start(a){this.logClient.start(a)}stop(){this.logClient.stop()}reportJoin(a,e,t){this.log({evetid:10010,args:this.data2String({joitm:a,rslt:e,mode:"wss",tid:t,gslbtm:0})})}reportJoinInvoked(a,e,t){this.log({evetid:60010,args:this.data2String({usrid:a,usrn:e,channelid:t,ua:navigator.userAgent})})}reportIceState(a,e,t){this.log({evetid:10011,args:this.data2String({calid:a,icestate:e,evt_seq:t})})}reportLeave(a,e,t){this.log({evetid:10020,args:this.data2String({lvetm:a,rslt:e,tid:t})})}reportLeaveInvoked(){this.log({evetid:60020})}reportPublish(a,e,t,r,s,n,o,c){this.log({evetid:10030,args:this.data2String({callid:a,isvl:e?1:0,isvs:t?1:0,isvss:r?1:0,isaudio:s?1:0,rslt:n,tid:o,pubtm:c})})}reportPublishInvoked(a,e,t,r){this.log({evetid:60030,args:this.data2String({isvl:typeof a=="boolean"?a?1:0:a,isvs:typeof e=="boolean"?e?1:0:e,isvss:typeof t=="boolean"?t?1:0:t,isaudio:typeof r=="boolean"?r?1:0:r})})}reportRepublish(a,e,t,r,s,n,o,c){this.log({evetid:10032,args:this.data2String({calid:a,isvl:e?1:0,isvs:0,isvss:t?1:0,isaudio:r?1:0,rslt:s,tid:n,repubtm:o,msg:c})})}reportRepublishInvoked(a,e,t){this.log({evetid:60032,args:this.data2String({callid:a,st:t,tp:e})})}reportUnpublish(a,e,t,r){this.log({evetid:10040,args:this.data2String({calid:a,unpubtm:e,rslt:t,tid:r})})}reportUnpublishInvoked(){this.log({evetid:60040})}reportSubscribe(a,e,t,r,s,n,o,c,u,h){this.log({evetid:10050,args:this.data2String({calid:a,rmtid:e,isvl:t?1:0,isvs:r?1:0,isvss:s?1:0,isaudio:n?1:0,rslt:o,tid:c,subtm:u,rmtuid:h})})}reportSubscribeInvoked(a="",e,t,r,s){this.log({evetid:60050,args:this.data2String({rmtid:a,isvl:typeof e=="boolean"?e?1:0:e,isvs:typeof t=="boolean"?t?1:0:t,isvss:typeof r=="boolean"?r?1:0:r,isaudio:typeof s=="boolean"?s?1:0:s})})}reportUnsubscribe(a,e,t,r,s){this.log({evetid:10060,args:this.data2String({calid:a,rmtid:e,unsubtm:t,rslt:r,tid:s})})}reportUnsubscribeInvoked(a=""){this.log({evetid:60060,args:this.data2String({rmtid:a})})}reportRoleUpdate(a,e,t,r){this.log({evetid:11040,args:this.data2String({or:a,nr:e,ctm:t,rslt:r})})}reportRoleUpdateInvoked(a){this.log({evetid:61040,args:this.data2String({nr:a})})}reportVideoProfile(a){this.log({evetid:20074,args:this.data2String({pf:a,tckid:"sophon_camera_large"})})}reportScreenProfile(a){this.log({evetid:20074,args:this.data2String({pf:a,tckid:"sophon_screenshare"})})}reportError(a){this.log({evetid:20090,args:this.data2String(a)})}log(a){a&&(a.tm=new Date().getTime()),this.logClient.sendReport(a)}data2String(a){let e="";for(let t in a)e.length&&(e+="&"),e+=t+"="+a[t];return e}}class xs{constructor(a){p(this,"name","COMMON");this.name=a||this.name}info(...a){}warn(...a){}print(a,...e){const t=a.toLowerCase();t&&console[t](`[${a}][${this.name}]`,...e)}}p(xs,"LEVEL",0);class ac{constructor(){p(this,"logger",new xs("AudioMixer"));p(this,"audioContext",new AudioContext);p(this,"audioDestination",this.audioContext.createMediaStreamDestination());p(this,"audioTrack",Ua(this.audioDestination.stream));p(this,"sourceNodeMap",{})}get sourceNodeList(){return Object.values(this.sourceNodeMap).map(a=>a.sourceNode).filter(a=>!!a)}get gainNodeList(){return Object.values(this.sourceNodeMap).map(a=>a.gainNode).filter(a=>!!a)}get sourceCount(){return this.sourceNodeList.length}resume(){var a;return(a=this.audioContext)==null?void 0:a.resume()}addTrack(a){this.connectTrack(a)}hasTrack(a){return!!this.sourceNodeMap[a]}removeTrack(a){const{sourceNode:e,gainNode:t}=this.sourceNodeMap[a]||{};t==null||t.disconnect(),e==null||e.disconnect(),delete this.sourceNodeMap[a],e?this.logger.info("SourceNode disconnected. Active source node:",this.sourceNodeList.length):this.logger.warn(`SourceNode ${a} does not exit. Active source node: ${this.sourceNodeList.length}`)}getAudioTrack(){return this.audioTrack}setVolume(a,e){const{gainNode:t}=this.sourceNodeMap[e]||{};t?(this.logger.info(`Setting node(${e}) volume to ${this.scale(a)}`),t.gain.value=this.scale(a)):this.logger.warn(`GainNode ${e} does not exit.`)}reset(){this.disconnectSourceNode(),this.sourceNodeMap={}}dispose(){var a;this.reset(),(a=this.audioTrack)==null||a.stop(),this.audioDestination.disconnect(),this.audioContext.close()}connectTrack(a){if(!this.audioContext)return this.logger.warn("AudioContext not initialized");let e=new MediaStream;e.addTrack(a);const t=this.audioContext.createMediaStreamSource(e),r=this.audioContext.createGain();r.gain.value=1,t.connect(r),r.connect(this.audioDestination),this.sourceNodeMap[a.id]={track:a,sourceNode:t,gainNode:r},this.logger.info("New sourceNode connected. Active source node:",this.sourceNodeList.length)}disconnectSourceNode(){this.sourceNodeList.forEach(a=>a.disconnect()),this.gainNodeList.forEach(a=>a.disconnect())}scale(a){return a/100}}const nc=4;class oc extends mt{constructor(){super("audioMixer",ae.AliRtcSdkStreamTypeCapture,Jt.AUDIO);p(this,"audioMixer");p(this,"primaryAudioTrackId");p(this,"screenAudioTrackId");p(this,"dirty",!1);this.zIndex=8}get initOptions(){return{audio:1,screen:1}}setOptions(e){Object.entries(e).forEach(([t,r])=>{this.isValidVolume(r)&&(this.options[t]=r)}),this.dirty=!0,this.emit("updated")}isSupported(){return"AudioContext"in window}shouldUpdate(e,t){var n,o;if(e.type!==ae.AliRtcSdkStreamTypeCapture)return!1;const r=t.find(c=>c.type===ae.AliRtcSdkStreamTypeCapture),s=t.find(c=>c.type===ae.AliRtcSdkStreamTypeScreen);return!(this.primaryAudioTrackId===((n=r==null?void 0:r.currentAudioTrack)==null?void 0:n.id)&&this.screenAudioTrackId===((o=s==null?void 0:s.currentAudioTrack)==null?void 0:o.id)&&!this.dirty)}process(e,t){return v(this,null,function*(){var o,c;this.dirty=!1;const r=t.find(u=>u.type===ae.AliRtcSdkStreamTypeScreen),s=e.currentAudioTrack,n=r==null?void 0:r.currentAudioTrack;if(!n&&this.options.audio===1){this.audioMixer&&(this.audioMixer.dispose(),this.audioMixer=void 0),this.primaryAudioTrackId=s==null?void 0:s.id,e.updateAudioTrack(s);return}this.audioMixer||(this.audioMixer=new ac),yield this.audioMixer.resume(),this.primaryAudioTrackId&&(s==null?void 0:s.id)!==this.primaryAudioTrackId&&((o=this.audioMixer)==null||o.removeTrack(this.primaryAudioTrackId)),s&&!this.audioMixer.hasTrack(s==null?void 0:s.id)&&this.audioMixer.addTrack(s),this.primaryAudioTrackId=s==null?void 0:s.id,this.screenAudioTrackId&&(n==null?void 0:n.id)!==this.screenAudioTrackId&&((c=this.audioMixer)==null||c.removeTrack(this.screenAudioTrackId)),n&&!this.audioMixer.hasTrack(n==null?void 0:n.id)&&this.audioMixer.addTrack(n),this.screenAudioTrackId=n==null?void 0:n.id,this.updateVolume(),e.updateAudioTrack(this.audioMixer.getAudioTrack())})}isValidVolume(e){return e!==void 0&&e>=0&&e<=nc}updateVolume(){this.audioMixer&&(this.primaryAudioTrackId&&this.audioMixer.setVolume(this.options.audio*100,this.primaryAudioTrackId),this.screenAudioTrackId&&this.audioMixer.setVolume(this.options.screen*100,this.screenAudioTrackId))}clear(e){var t;(t=this.audioMixer)==null||t.dispose(),super.clear(e)}}class ur{constructor(a,e){p(this,"originTrack");p(this,"originVideo");p(this,"targetWidth");p(this,"targetHeight");p(this,"targetFrameRate");p(this,"targetCanvas");p(this,"animationFrameId");p(this,"resultTrack");this.targetWidth=e.width,this.targetHeight=e.height,this.targetFrameRate=e.frameRate,this.originTrack=a,this.originVideo=document.createElement("video"),this.originVideo.muted=!0,this.originVideo.autoplay=!0,this.originVideo.controls=!1,this.targetCanvas=document.createElement("canvas"),this.targetCanvas.width=this.targetWidth,this.targetCanvas.height=this.targetHeight}updateOptions(a){this.targetWidth=a.width,this.targetHeight=a.height,this.targetFrameRate=a.frameRate,this.targetCanvas.width=this.targetWidth,this.targetCanvas.height=this.targetHeight,this.resultTrack&&this.resultTrack.applyConstraints({frameRate:this.targetFrameRate})}dispose(){}getVideoTrack(){return this.resultTrack||(this.resultTrack=this.targetCanvas.captureStream().getVideoTracks()[0],this.resultTrack.applyConstraints({frameRate:this.targetFrameRate})),this.resultTrack}cancelAnimation(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}getPositionAndSize(a,e,t,r){const s=e/a,n=r/t;let o=t,c=r,u=0,h=0;return n>s?(o=Math.round(c/s),u=Math.round((t-o)/2)):n<s&&(c=Math.round(o*s),h=Math.round((r-c)/2)),{x:u,y:h,width:o,height:c}}}class cc extends ur{constructor(e,t){super(e,t);p(this,"targetCtx");this.targetCtx=this.targetCanvas.getContext("2d"),this.startRender=this.startRender.bind(this),this.stopRender=this.startRender.bind(this),this.initStream(e)}initStream(e){const t=new MediaStream;t.addTrack(e),this.originVideo.srcObject=t,this.originVideo.play(),this.originVideo.addEventListener("canplay",this.startRender),this.originVideo.addEventListener("pause",this.stopRender),this.originVideo.addEventListener("ended",this.stopRender)}startRender(){this.cancelAnimation();const e=()=>{if(!this.targetCtx)return;const t=this.getPositionAndSize(this.originVideo.videoWidth,this.originVideo.videoHeight,this.targetWidth,this.targetHeight);this.targetCtx.drawImage(this.originVideo,0,0,this.originVideo.videoWidth,this.originVideo.videoHeight,t.x,t.y,t.width,t.height),!this.originVideo.paused&&!this.originVideo.ended&&(this.animationFrameId=requestAnimationFrame(e))};e()}stopRender(){this.cancelAnimation()}dispose(){this.stopRender(),this.originVideo.removeEventListener("play",this.startRender),this.originVideo.removeEventListener("pause",this.stopRender),this.originVideo.removeEventListener("ended",this.stopRender),this.originVideo.pause(),this.originVideo.srcObject=null}}const uc=`
|
|
1
|
+
var U0=Object.defineProperty,z0=Object.defineProperties;var H0=Object.getOwnPropertyDescriptors;var Wi=Object.getOwnPropertySymbols,j0=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty,Pa=Object.prototype.propertyIsEnumerable,W0=Reflect.get;var ys=(he,me,ve)=>me in he?U0(he,me,{enumerable:!0,configurable:!0,writable:!0,value:ve}):he[me]=ve,Se=(he,me)=>{for(var ve in me||(me={}))Ba.call(me,ve)&&ys(he,ve,me[ve]);if(Wi)for(var ve of Wi(me))Pa.call(me,ve)&&ys(he,ve,me[ve]);return he},Rt=(he,me)=>z0(he,H0(me));var Ki=(he,me)=>{var ve={};for(var $e in he)Ba.call(he,$e)&&me.indexOf($e)<0&&(ve[$e]=he[$e]);if(he!=null&&Wi)for(var $e of Wi(he))me.indexOf($e)<0&&Pa.call(he,$e)&&(ve[$e]=he[$e]);return ve};var A=(he,me,ve)=>(ys(he,typeof me!="symbol"?me+"":me,ve),ve);var As=(he,me,ve)=>W0(j0(he),ve,me);var z=(he,me,ve)=>new Promise(($e,kt)=>{var nt=qe=>{try{Qe(ve.next(qe))}catch(dt){kt(dt)}},lt=qe=>{try{Qe(ve.throw(qe))}catch(dt){kt(dt)}},Qe=qe=>qe.done?$e(qe.value):Promise.resolve(qe.value).then(nt,lt);Qe((ve=ve.apply(he,me)).next())}),$i=function(he,me){this[0]=he,this[1]=me},La=(he,me,ve)=>{var $e=(lt,Qe,qe,dt)=>{try{var je=ve[lt](Qe),Zt=(Qe=je.value)instanceof $i,ai=je.done;Promise.resolve(Zt?Qe[0]:Qe).then(ft=>Zt?$e(lt==="return"?lt:"next",Qe[1]?{done:ft.done,value:ft.value}:ft,qe,dt):qe({value:ft,done:ai})).catch(ft=>$e("throw",ft,qe,dt))}catch(ft){dt(ft)}},kt=lt=>nt[lt]=Qe=>new Promise((qe,dt)=>$e(lt,Qe,qe,dt)),nt={};return ve=ve.apply(he,me),nt[Symbol.asyncIterator]=()=>nt,kt("next"),kt("throw"),kt("return"),nt};(function(he,me){typeof exports=="object"&&typeof module!="undefined"?me(exports,require("aliyun-rts-sdk"),require("eventemitter3")):typeof define=="function"&&define.amd?define(["exports","aliyun-rts-sdk","eventemitter3"],me):(he=typeof globalThis!="undefined"?globalThis:he||self,me(he.AliRtcEngine={},he.AliyunRts,he.EventEmitter))})(this,function(he,me,ve){var it,Lt,St,ri,fe,Ia;"use strict";var $e=Object.defineProperty,kt=(s,c,e)=>c in s?$e(s,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[c]=e,nt=(s,c,e)=>(kt(s,typeof c!="symbol"?c+"":c,e),e),lt={exports:{}},Qe={exports:{}},qe,dt;function je(){if(dt)return qe;dt=1,Date.now=Date.now||function(){return new Date().getTime()};var s=Date.now(),c=function(){},e=function(){var r=typeof console=="object"?console.warn:c;try{var i={warn:r};i.warn.call(i)}catch(n){return c}return r},t={noop:c,warn:e(),key:"__bl",selfErrKey:"ARMS_SDK_ERROR",selfErrPage:"ARMSSDK",win:typeof window=="object"&&window.document?window:void 0,regionMap:{cn:"https://arms-retcode.aliyuncs.com/r.png?",sg:"https://arms-retcode-sg.aliyuncs.com/r.png?",sg_2:"https://retcode-sg-lazada.arms.aliyuncs.com/r.png?",daily:"http://arms-retcode-daily.alibaba.net/r.png?",daily_2:"https://arms-retcode-daily.alibaba.net/r.png?",daily_3:"http://arms-retcode-daily.aliyun.test/r.png?",us:"https://retcode-us-west-1.arms.aliyuncs.com/r.png?",tw:"https://arms-retcode.orientalgame.com.tw/r.png?",tw_sg:"https://arms-retcode-sg.orientalgame.com.tw/r.png?",hz_finance:"https://arms-retcode-hz-finance.aliyuncs.com/r.png?"},defaultImgUrl:"https://arms-retcode.aliyuncs.com/r.png?",createObject:function(r){if(Object.create)return Object.create(r);var i=function(){};return i.prototype=r,new i},each:function(r,i){var n=0,a=r.length;if(this.T(r,"Array"))for(;n<a&&i.call(r[n],r[n],n)!==!1;n++);else for(n in r)if(i.call(r[n],r[n],n)===!1)break;return r},safetyCall:function(r,i,n){if(typeof r!="function")return n;try{return r.apply(this,i)}catch(a){return n}},T:function(r,i){var n=Object.prototype.toString.call(r).substring(8).replace("]","");return i?n===i:n},duration:function(){var r=Date;try{performance&&this.T(performance.now,"Function")&&(r=performance)}catch(n){r=Date}var i=r.now();return function(){return Math.round(r.now()-i)}},filterByRule:function(){var r=[].slice.call(arguments),i=r.length;if(i<2)return r[0];var n=r[i-1],a=r[0];if(!a)return"";if(!n)return a;var o=this,u=o.T(n),h=r.slice(0,i-1);return u==="Function"?o.safetyCall(n,h,a):u==="Array"?(this.each(n,function(v){h[0]=a=o.filterByRule.apply(o,[].concat(h,v))}),a):u==="Object"?a.replace(n.rule,n.target||""):a.replace(n,"")},ignoreByRule:function(r,i){if(!r||!i)return!1;if((this.isString(i)||i.source||this.T(i)==="Function")&&(i=[i]),!this.isArray(i))return this.warn("[arms] invalid rules of ignore config, (list of) String/RegExp/Funcitons are available"),!1;for(var n,a=[],o=0,u=i.length;o<u;o++)if(n=i[o],this.isString(n))a.push(n.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"));else if(n&&n.source)a.push(n.source);else if(n&&this.T(n)==="Function"&&this.safetyCall(n,[r],!1)===!0)return!0;var h=new RegExp(a.join("|"),"i");return!!(a.length&&h.test&&h.test(r))},J:function(r){if(!r||typeof r!="string")return r;var i=null;try{i=JSON.parse(r)}catch(n){}return i},pick:function(r){return r===1||Math.ceil(Math.random()*r)===1},verifyConfig:function(r){if("sample"in r){var i=r.sample,n=i;i&&/^\d+(\.\d+)?%$/.test(i)&&(n=parseInt(100/parseFloat(i))),0<n&&1>n&&(n=parseInt(1/n)),n>=1&&n<=100?r.sample=n:delete r.sample}return r},on:function(r,i,n,a,o){return r.addEventListener?(o=o||!1,r.addEventListener(i,function u(h){a&&r.removeEventListener(i,u,o),n.call(this,h)},o)):r.attachEvent&&r.attachEvent("on"+i,function u(h){a&&r.detachEvent("on"+i,u),n.call(this,h)}),this},off:function(r,i,n){return n?(r.removeEventListener?r.removeEventListener(i,n):r.detachEvent&&r.detachEvent(i,n),this):this},delay:function(r,i){return i===-1?(r(),null):setTimeout(r,i||0)},ext:function(r){for(var i=1,n=arguments.length;i<n;i++){var a=arguments[i];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])}return r},sub:function(r,i){var n={};return this.each(r,function(a,o){i.indexOf(o)!==-1&&(n[o]=a)}),n},uu:function(){for(var r,i,n=20,a=new Array(n),o=Date.now().toString(36).split("");n-- >0;)i=(r=36*Math.random()|0).toString(36),a[n]=r%3?i:i.toUpperCase();for(var u=0;u<8;u++)a.splice(3*u+2,0,o[u]);return a.join("")},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){var i=16*Math.random()|0;return(r==="x"?i:3&i|8).toString(16)})},seq:function(){return(s++).toString(36)},decode:function(r){try{r=decodeURIComponent(r)}catch(i){}return r},encode:function(r,i){try{r=i?encodeURIComponent(r).replace(/\(/g,"%28").replace(/\)/g,"%29"):encodeURIComponent(r)}catch(n){}return r},serialize:function(r){r=r||{};var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&r[n]!==void 0&&i.push(n+"="+this.encode(r[n],n==="msg"));return i.join("&")},checkAPI:function(r,i){if(!r||typeof r!="string")return!1;var n=/arms-retcode[\w-]*\.aliyuncs/.test(r);return!n&&i&&(n=/(alicdn\.com)|(mmstat\.com)/.test(r)),!n},checkAutoError:function(r){return!(!r||!r.message)&&!/failed[\w\s]+fetch/i.test(r.message)},cutUrlSearch:function(r){return r&&typeof r=="string"?r.replace(/^(https?:)?\/\//,"").replace(/\?.*$/,""):""},removeUrlSearch:function(r){return r&&typeof r=="string"?r.replace(/\?.*$/,""):""},createFakeToString:function(r){return function(){return r+"() { [native code] }"}},checkSameOrigin:function(r,i){if(!i||!r)return!1;var n="//"+i.split("/")[2];return r===i||r.slice(0,i.length+1)===i+"/"||r===n||r.slice(0,n.length+1)===n+"/"||!/^(\/\/|http:|https:).*/.test(r)},getRandIP:function(){for(var r=[],i=0;i<4;i++){var n=Math.floor(256*Math.random());r[i]=(n>15?"":"0")+n.toString(16)}return r.join("").replace(/^0/,"1")},getSortNum:function(r){return r?(r+=1)>=1e3&&r<=9999?r:r<1e3?r+1e3:r%1e4+1e3:1e3},getRandNum:function(r){return r&&typeof r=="string"?r.length<5?this.getNum(5):r.substring(r.length-5):this.getNum(5)},getNum:function(r){for(var i=[],n=0;n<r;n++){var a=Math.floor(16*Math.random());i[n]=a.toString(16)}return i.join("")},getCurDomain:function(){return location&&location.hostname||""},getSrcType:function(r,i){var n=location&&location.host||"";if(!n)return"";var a=new URL(r).host;if(a===n)return"self";for(var o=0;o<i.length;o+=1)if(a.includes(i[o]))return"cdn";return"others"},parseFetchHeaders:function(r){if(!r)return{};var i={};try{if(typeof r.keys=="function")for(var n=r.keys(),a=n.next();!a.done;){var o=a.value;i[o]=r.get(o),a=n.next()}else i=r}catch(u){i={}}return i},parseXhrHeaders:function(r){if(!r&&typeof r!="string")return{};var i={};try{var n=r.split(`\r
|
|
2
|
+
`);i=n.reduce(function(a,o){var u=o.split(": ");return a[u[0]]=u[1],a},{})}catch(a){i={}}return i},getQuerys:function(r){if(!r)return"";var i={},n=[],a="",o="";try{var u=[];if(r.indexOf("?")>=0&&(u=r.substring(r.indexOf("?")+1,r.length).split("&")),u.length>0)for(var h in u)a=(n=u[h].split("="))[0],o=n[1],i[a]=o}catch(v){i={}}return i},getURL:function(r){if(!r)return null;var i={},n=r.length,a=r.indexOf("://");if(a<0)return null;i.protocol=r.substring(0,a+1);var o=r.indexOf("#"),u=r.indexOf("?");o<0&&(o=n),u<0&&(u=o),i.search=r.substring(u,o).substring(0,1e3);var h=r.substring(a+3,u),v=h.indexOf("/");return v<0&&(v=h.length),i.domain=h.substring(0,v).split(":")[0],i.path=h.substring(v,h.length).substring(0,1e3),i},getResType:function(r,i){if(["script","img","other"].indexOf(r)>-1)return r;if(["video"].indexOf(r)>-1)return"media";if(["document","iframe"].indexOf(r)>-1)return"doc";var n=i?this.getURL(i):null,a=n&&n.path?n.path.lastIndexOf("."):-1,o=(a>0?n.path.substr(a+1):"").toLowerCase();if(o){if(["eot","woff","woff2","ttf"].indexOf(o)>-1)return"font";if(o==="css")return"css";if(o==="js")return"script"}return["fetch","xmlhttprequest","beacon"].indexOf(r)>-1?"api":"others"},areInOrder:function(){for(var r=1;r<arguments.length;r+=1)if(arguments[r-1]>arguments[r])return!1;return!0},getFetchSnapshot:function(r,i,n){var a,o;try{var u=(r&&typeof r[0]!="string"?r[0].url:r[0])||"",h=(r&&typeof r[0]!="string"?r[0]:r[1])||{},v=h.method.toUpperCase()==="POST"?h.body:this.getQuerys(u);a={originApi:u,method:h.method||"unknown",params:v,response:i||"",reqHeaders:this.parseFetchHeaders(h.headers||null),resHeaders:this.parseFetchHeaders(n)},o=JSON&&JSON.stringify(a)||"{}"}catch(f){o="{}"}return o},getXhrSnapshot:function(r,i,n){if(!r||!i||!n)return{};var a,o;try{var u="";n.responseType===""||n.responseType==="text"?u=n.responseText:n.responseType==="document"&&(u=n.responseXML),a={originApi:r,method:i,params:this.getQuerys(r),response:u,reqHeaders:{},resHeaders:this.parseXhrHeaders(typeof n.getAllResponseHeaders=="function"&&n.getAllResponseHeaders()||"")},o=JSON&&JSON.stringify(a)||"{}"}catch(h){o="{}"}return o},isRobot:function(){var r=["nuhk","googlebot/","googlebot-image","yammybot","openbot","slurp","msnbot","ask jeeves/teoma","ia_archiver","baiduspider","bingbot/","adsbot"];if(!navigator||typeof navigator.userAgent!="string")return!1;try{for(var i=navigator.userAgent.toLowerCase(),n=0;n<r.length;n++){var a=r[n];if(i.lastIndexOf(a)>=0)return!0}}catch(o){this.warn("[arms] useragent parse error")}return!1},isFunction:function(r){return typeof r=="function"},isPlainObject:function(r){return Object.prototype.toString.call(r)==="[object Object]"},isString:function(r){return Object.prototype.toString.call(r)==="[object String]"},isArray:function(r){return Object.prototype.toString.call(r)==="[object Array]"},joinRegExp:function(r){for(var i,n=[],a=0,o=r.length;a<o;a++)i=r[a],this.isString(i)?n.push(i.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):i&&i.source&&n.push(i.source);return new RegExp(n.join("|"),"i")},reWriteMethod:function(r,i,n){if(r!==null){var a=r[i];r[i]=n(a)}},checkSDKError:function(r,i){return!r&&!i?!1:new RegExp(this.selfErrKey,"i").test(r)?!0:!!this.ignoreByRule(i,[/retcode.alicdn.com\/retcode\/bl.js/,/g.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/laz-g-cdn.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/local.taobao.com:8880\/build\/bl/])},sdkError:function(r){return{msg:r,message:this.selfErrKey}},dealParam:function(r,i,n){var a={};try{a=this.isPlainObject(r)?this.ext({key:r.key||"default",val:r.val||r.value||n},r,{begin:Date.now()}):{key:r||"default",val:i||n,begin:Date.now()}}catch(o){this.warn("[retcode] baseLog error: "+o)}return a}};return qe=t,qe}var Zt={exports:{}},ai={exports:{}},ft,Es;function Na(){if(Es)return ft;Es=1;var s=je();return ft=function(c,e,t){typeof c=="object"&&(c=s.serialize(c));var r=e+c+(t?"&post_res=":"");window&&window.navigator&&typeof window.navigator.sendBeacon=="function"?window.navigator.sendBeacon(r,t||"&post_res="):s.warn("[arms] navigator.sendBeacon not surported")},ft}var ws;function Ma(){if(ws)return ai.exports;ws=1;var s=je(),c=Na(),e="aokcdqn3ly@e629dabd48a9933",t=function(i,n){var a;if(n.t==="error"&&(a=i.requestQueue[0])&&a.t==="error"&&n.msg===a.msg)return n.times=a.times+1,void(i.requestQueue[0]=n);if(n.t==="behavior"){var o=i.requestQueue&&i.requestQueue.length;if(o>0&&i.requestQueue[o-1].t==="behavior"){var u=n.behavior||[];i.requestQueue[o-1].behavior.concat(u)}else i.requestQueue.push(n)}else i.requestQueue.unshift(n);return i.onReady(function(){i.requestTimmer=s.delay(function(){i.clear()},i.requestQueue[0]&&i.requestQueue[0].t==="error"?3e3:-1)}),!0},r=function(i){return this.ver="1.8.36-beta.12",this._conf=s.ext({},r.dftCon),this.sampleCache={},this.requestQueue=[],this.selfQueue=[],this.sdkFlag=!0,this.hash=s.seq(),this.resetPageview(),this.setConfig(i),this.rip=s.getRandIP(),this.record=999,this["EagleEye-TraceID"]=this.getTraceId()["EagleEye-TraceID"],this._common={},this};return r.dftCon={sample:1,pvSample:1,tag:"",imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",region:null,ignore:{ignoreUrls:[],ignoreApis:[],ignoreErrors:[/^Script error\.?$/],ignoreResErrors:[],ignoreResources:[/\/(bl|wl)(.debug)?.js$/]},release:void 0,environment:"prod",beforeReport:null,parseTraceId:null},r.prototype={constructor:r,onReady:function(i){return i()},getPage:function(){var i=this._conf.page;return s.safetyCall(i,[],i+"")},setPage:function(){},setConfig:function(i){i&&typeof i=="object"&&(s.verifyConfig(i),i=this.setImgUrl(i),this._conf=s.ext({},this._conf,i))},setImgUrl:function(i){var n=i.region,a=i.imgUrl;if(n){var o=s.regionMap[n];return i.imgUrl=o||s.defaultImgUrl,i}return a&&(i.imgUrl=a),i},checkImgUrl:function(){return!0},sendRequest:function(){},sendBeacon:function(i,n,a){c(i,n||this.getConfig("imgUrl"),a)},postData:function(){},commonInfo:function(){return{}},setCommonInfo:function(i){i&&typeof i=="object"&&(this._common=s.ext({},this._common,i))},resetPageview:function(){this.pageview=s.uu(),this.sBegin=Date.now()},getUsername:function(){if(this.username)return this.username;var i=this._conf,n=i&&i.setUsername;if(typeof n=="function")try{var a=n();typeof a=="string"&&(a=a.substr(0,40),this.username=a)}catch(o){s.warn("[arms] setUsername fail",o)}return this.username},getTraceId:function(){var i=this.rip,n=Date.now(),a=s.getSortNum(this.record),o=i+n+a+s.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=o,this.record=a,{"EagleEye-TraceID":o}},getUberTraceId:function(i){var n=this.rip,a=Date.now(),o=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+a+o+s.getNum(2)+u,v=h.substring(0,16);return i=i?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{"uber-trace-id":h+":"+v+":0:"+i,traceId:h}},getB3TraceId:function(i){var n=this.rip,a=Date.now(),o=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+a+o+s.getNum(2)+u,v=h.substring(0,16);return i=i?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{b3:h+"-"+v+"-"+i+"-0","X-B3-TraceId":h,"X-B3-ParentSpanId":"0","X-B3-SpanId":v,"X-B3-Sampled":i}},getPageviewId:function(){return{"EagleEye-SessionID":this.pageview}},getConfig:function(i){return i?this._conf[i]:s.ext({},this._conf)},sampling:function(i){return i===1||(typeof this.sampleCache[i]=="boolean"?this.sampleCache[i]:(this.sampleCache[i]=s.pick(i),this.sampleCache[i]))},clear:function(i){var n;clearTimeout(this.requestTimmer),this.requestTimmer=null;for(var a=this._conf&&typeof this._conf.sendRequest=="function";n=this.requestQueue.pop();)if(n.t==="res")this.postData(n,"res");else if(n.t==="error")this.postData(n,"err");else if(n.t==="api")this.postData(n,"apiSnapshot");else if(n.t==="behavior")this.postData(n,"behavior");else if(n.t==="health"&&!a&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function")this.sendBeacon(n);else if(n.t==="resource"&&!a&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function"){var o=JSON.stringify({resource:n.resource});delete n.resource,this.sendBeacon(n,null,o)}else n.t==="resource"?this.postData(n,"resource"):this.sendRequest(n);return i&&this.clearSelf(),this},clearSelf:function(){var i;for(clearTimeout(this.Timmer),this.Timmer=null;i=this.selfQueue.pop();)this.postData(i,"err");return this},_lg:function(i,n,a,o){var u=this,h=u._conf,v=u.getPage(),f=h.ignore||{},d=f.ignoreErrors,p=f.ignoreResErrors,l=f.ignoreUrls,m=f.ignoreApis;if(u._isRobot||s.ignoreByRule(v,l)||s.ignoreByRule(s.decode(v),l)||i==="error"&&(s.ignoreByRule(n.msg,d)||s.ignoreByRule(s.decode(n.msg),d))||i==="resourceError"&&(s.ignoreByRule(n.src,p)||s.ignoreByRule(s.decode(n.src),p))||i==="api"&&(s.ignoreByRule(n.api,m)||s.ignoreByRule(s.decode(n.api),m))||!u.checkImgUrl(h.imgUrl)||!n||h.disabled||!h.pid||o===0)return u;var x=n.dl;if(delete n.dl,n=s.ext({t:i,times:1,page:v,tag:h.tag||"",release:h.release||"",environment:h.environment,begin:Date.now(),c1:h.c1,c2:h.c2,c3:h.c3},n,u.commonInfo(),u._common,{pid:h.pid,_v:u.ver,pv_id:u.pageview,username:u.getUsername(),sampling:a||1,dl:x,z:s.seq()}),s.T(h.beforeReport)==="Function")try{if(!(n=h.beforeReport(n)))return u}catch(g){return u}return o===1?t(u,n):a&&!u.sampling(a)?u:t(u,n)},_self:function(i,n,a){var o=this,u=o._conf;if(i!=="error"||!o.checkImgUrl(u.imgUrl)||!n||u.disabled||!u.pid||!e||a&&!o.sampling(a))return o;n=s.ext({t:i,times:1,page:s.selfErrPage,tag:u.pid,begin:Date.now()},n,{pid:e,_v:o.ver,sampling:a||1,z:s.seq()});var h=o.selfQueue[0];if(h){h.times++;try{h.err&&n.err&&h.err.msg_raw&&n.err.msg_raw&&h.err.msg_raw.split("&").indexOf(n.err.msg_raw)<0&&h.err.msg_raw.length<1e3&&(h.err.msg_raw+="&"+n.err.msg_raw)}catch(v){}}else o.selfQueue.unshift(n),o.onReady(function(){o.sdkFlag&&(o.sdkFlag=!1,o.Timmer=s.delay(function(){o.clearSelf()},1e4))})},custom:function(i,n){if(!i||typeof i!="object")return this;var a=!1,o={begin:Date.now()};return s.each(i,function(u,h){return!(a=h&&h.length<=20)&&s.warn("[retcode] invalid key: "+h),o["x-"+h]=u,a}),a?this._lg("custom",o,n||1):this}},ai.exports=r,ai.exports}var Cs;function Fa(){if(Cs)return Zt.exports;Cs=1;var s=je(),c=Ma(),e=["api","success","time","code","msg","trace","traceId","begin","pv_id","sid","seq","domain","flag","apiSnapshot","tag","c1","c2","c3"],t=function(i){var n=(i.key||"default").split("::");return n.length>1?s.ext(i,{group:n[0],key:n[1]}):s.ext(i,{group:"default_group",key:n[0]})},r=function(i){c.call(this,i);var n;try{n=typeof performance=="object"?performance.timing.fetchStart:Date.now()}catch(a){n=Date.now()}return this._startTime=n,this};return r.prototype=s.createObject(c.prototype),s.ext(c.dftCon,{startTime:null}),s.ext(r.prototype,{constructor:r,_super:c,sum:function(i,n,a){try{var o=s.dealParam(i,n,1);return this._lg("sum",t(o),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},avg:function(i,n,a){try{var o=s.dealParam(i,n,0);return this._lg("avg",t(o),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},percent:function(i,n,a,o){try{return this._lg("percent",t({key:i,subkey:n,val:a||0,begin:Date.now()}),o)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},msg:function(i,n){if(i&&!(i.length>180))return this.custom({msg:i},n)},error:function(i,n){if(!i)return s.warn("[retcode] invalid param e: "+i),this;arguments.length===1?(typeof i=="string"&&(i={message:i},n={}),typeof i=="object"&&(n=i=i.error||i)):(typeof i=="string"&&(i={message:i}),typeof n!="object"&&(n={}));var a=i.name||"CustomError",o=i.message||"",u=i.stack||"";n=n||{};var h=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"";if(s.checkSDKError(o,n.filename)){var v=/^Script error\.?$/,f=i.msg||i.message;if(s.ignoreByRule(f,v)||s.ignoreByRule(s.decode(f),v))return this;var d={msg:s.selfErrKey,err:{msg_raw:s.encode(i.msg||i.message)}};return this._self("error",d,1)}for(var p={begin:Date.now(),cate:a,msg:o&&o.substring(0,1e3),stack:u&&u.substring(0,1e3),file:s.removeUrlSearch(n.filename||""),line:n.lineno||"",col:n.colno||"",err:{msg_raw:s.encode(o),stack_raw:s.encode(u)},dl:h},l=["tag","c1","c2","c3"],m=0;m<l.length;m++){var x=l[m];n[x]&&(p[x]=n[x])}var g=(this.getConfig("ignore")||{}).ignoreErrors;return s.ignoreByRule(p.msg,g)||s.ignoreByRule(s.decode(p.msg),g)?this:(this.beforeSend&&this.beforeSend("error",p),this._lg("error",p,1))},behavior:function(i){if(i){var n=typeof i=="object"&&i.behavior?i:{behavior:i};return this.beforeSend&&this.beforeSend("behavior",n),this._lg("behavior",n,1)}},api:function(i,n,a,o,u,h,v,f,d,p,l,m,x,g,b,y){if(!i)return s.warn("[retcode] api is null"),this;if(i=typeof i=="string"?{api:i,success:n,time:a,code:o,msg:u,begin:h,traceId:v,pv_id:f,apiSnapshot:d,domain:p,flag:m,tag:x,c1:g,c2:b,c3:y}:s.sub(i,e),!s.checkAPI(i.api,!0))return this;i.code=i.code||"";var E=i.msg||"";if(E=typeof E=="string"?E.substring(0,1e3):E,i.msg=E,i.success=i.success?1:0,i.time=+i.time,i.begin=i.begin,i.traceId=i.traceId||"",i.pv_id=i.pv_id||"",i.domain=i.domain||"",i.flag=i.flag,i.dl=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"",i.apiSnapshot&&(typeof i.apiSnapshot=="object"&&(i.apiSnapshot=JSON.stringify(i.apiSnapshot)),typeof i.apiSnapshot!="string"&&delete i.apiSnapshot,i.apiSnapshot.length>2e3&&(i.apiSnapshot=i.apiSnapshot.substring(0,2e3))),l&&(i.traceOrigin=l),!i.api||isNaN(i.time))return s.warn("[retcode] invalid time or api"),this;var I=(this.getConfig("ignore")||{}).ignoreApis;return s.ignoreByRule(i.api,I)||s.ignoreByRule(s.decode(i.api),I)?this:i.time<0?this:(this.beforeSend&&this.beforeSend("api",i),this._lg("api",i,i.success&&this.getConfig("sample"),i.flag))},speed:function(i,n,a){var o=this,u=this.getConfig("startTime")||this._startTime;return/^s(\d|1[0])$/.test(i)?(n=typeof n!="number"?Date.now()-u:n>=u?n-u:n,o.speedCache=o.speedCache||{},o.speedCache[i]=n,o.speedCache.begin=u,clearTimeout(o.speedTimmer),o.speedTimmer=setTimeout(function(){a||(o.speedCache.page=o.getPage(!0)),o._lg("speed",o.speedCache),o.speedCache=null},5e3),o):(s.warn("[retcode] invalid point: "+i),o)},performance:function(i){if(i&&typeof i=="object"&&!this.hasSendPerf){var n={},a={},o=this.getConfig("autoSendPerf");if(i.autoSend&&o)return a=s.ext(this.perfData||{},i),this.hasSendPerf=!0,this._lg("perf",a,this.getConfig("sample"));if(i.autoSend&&!o)return delete i.autoSend,this.perfData?(a=s.ext(this.perfData||{},i),this.hasSendPerf=!0,this._lg("perf",a,this.getConfig("sample"))):void(this.perfData=i);for(var u in i)(/^t([1-9]|1[0])$/.test(u)||u==="ctti"||u==="cfpt")&&(n[u]=i[u]);if(i.autoSend===!0||!o&&(o||this.perfData))return i.autoSend!==!0&&o===!1&&this.perfData?(n=s.ext(this.perfData||{},n),this.hasSendPerf=!0,this._lg("perf",n,this.getConfig("sample"))):void 0;this.perfData=s.ext(this.perfData||{},n)}},resource:function(i,n){if(!i||!s.isPlainObject(i))return s.warn("[arms] invalid param data: "+i),this;var a=Object.keys(i),o=["begin","dom","load","res","dl"],u=!1;for(var h in o)if(a.indexOf(o[h])<0){u=!0;break}if(u)return s.warn("[arms] lack param data: "+i),this;var v={begin:i.begin||Date.now(),dom:i.dom||"",load:i.load||"",res:s.isArray(i.res)?JSON.stringify(i.res):JSON.stringify([]),dl:i.dl||""};return this._lg("res",v,n)},event:function(i,n){if(typeof i=="object"&&i&&i.key){var a={},o=["key","success","time","c1","c2","c3"];for(var u in i)o.indexOf(u)>-1&&(a[u]=i[u]);a.success=i.success===!1?0:1,this._lg("event",a,n)}}}),r._super=c,r._root=c,c.Reporter=r,Zt.exports=r,Zt.exports}var qi={exports:{}},Is;function Oa(){if(Is)return qi.exports;Is=1;var s=je(),c=typeof window=="object"?window:{},e="catch",t=c.__oFetch_||c.fetch;return t=typeof t=="function"?t:void 0,qi.exports=function(r,i){var n=-1;typeof r=="object"&&(n=r.z,r=s.serialize(r));var a=i+r;if(t)return t(a,{method:"HEAD",mode:"no-cors"})[e](s.noop);if(c.document&&c.document.createElement){var o="__request_hold_"+n,u=c[o]=new Image;u.onload=u.onerror=function(){c[o]=void 0},u.src=a,u=null}},qi.exports}var Gi={exports:{}},Rs;function Va(){if(Rs)return Gi.exports;Rs=1;var s=je(),c=typeof window=="object"?window:{},e=c.__oXMLHttpRequest_||c.XMLHttpRequest;return e=typeof e=="function"?e:void 0,Gi.exports=function(t,r){try{var i=new e;i.open("POST",r,!0),i.setRequestHeader("Content-Type","text/plain"),i.send(JSON.stringify(t))}catch(n){s.warn(`[retcode] Failed to log, exception is :
|
|
3
|
+
`+n)}},Gi.exports}var Ji,ks;function Ua(){if(ks)return Ji;ks=1;var s=je();return Ji=function(c,e){var t=[],r=null,i=e&&e.location&&e.location.href,n=void 0,a=null,o=function(f,d,p){if(f!==null){var l=f[d];f[d]=p(l)}},u=function(f){var d,p,l,m,x,g=[];if(!f||typeof f.tagName!="string")return"";if(g.push(f.tagName.toLowerCase()),typeof f.id=="string"&&g.push("#".concat(f.id)),typeof(d=f.className)=="string")for(p=d.split(/\s+/),x=0;x<p.length;x++)g.push(".".concat(p[x]));var b=["type","name","title","alt","data-arms-attr"];for(x=0;x<b.length;x++)l=b[x],typeof(m=f.getAttribute(l))=="string"&&g.push("[".concat(l,'="').concat(m,'"]'));return g.join("")},h=function(f,d){return function(p){if(p&&p!==a){a=p;var l;try{l=p.target}catch(x){l="<unknown>"}if(l.length!==0){var m={type:"ui.".concat(f),data:{message:function(x){if(!x||x.nodeType!==1)return"";for(var g=x||null,b=[],y=0,E=0,I=3,C="";g&&y++<5&&!((C=u(g))==="html"||y>1&&E+b.length*I+C.length>=80);)b.push(C),E+=C.length,g=g.parentNode;return b.reverse().join(" > ")}(l)},timestamp:Date.now()};f==="click"?r&&r.addBehavior(m):f==="keypress"&&(n||r&&r.addBehavior(m),clearTimeout(n),n=setTimeout(function(){n=void 0},100))}}}},v=function(){if(function(){var l=e&&e.chrome,m=l&&l.app&&l.app.runtime,x="history"in e&&!!e.history.pushState&&!!e.history.replaceState;return!m&&x}()){var f=function(l,m){var x={type:"navigation",data:{from:l,to:m}};r&&r.addBehavior(x),i=m},d=e.onpopstate;e.onpopstate=function(){for(var l=arguments.length,m=new Array(l),x=0;x<l;x++)m[x]=arguments[x];var g=e.location.href;if(f(i,g),d)return d.apply(this,m)};var p=function(l){return function(){for(var m=arguments.length,x=new Array(m),g=0;g<m;g++)x[g]=arguments[g];var b=x.length>2?x[2]:void 0;return b&&f(i,String(b)),l.apply(this,x)}};o(e.history,"pushState",p),o(e.history,"replaceState",p)}};s.ext(c.prototype,{addBehavior:function(f){if(this.getConfig("behavior")&&f&&typeof f=="object"){var d={},p=f.data||{};if(f.type)d=p;else{if(typeof p.name!="string"||typeof p.message!="string")return;d.name=p.name.substr(0,20),d.message=p.message.substr(0,200)}d.message&&(d.message=s.encode(d.message));var l={type:f.type||"custom",data:d||{},timestamp:f.timestamp||Date.now(),page:f.page||e&&e.location&&e.location.pathname};return t.push(l),t=t.slice(-100)}},getBehavior:function(){return t||[]},setBehavior:function(f){return f&&(t=f),t},reportBehavior:function(f){var d=this;d.getConfig("behavior")&&(d.sendBhTimer&&(clearTimeout(d.sendBhTimer),d.sendBhTimer=void 0),d.sendBhTimer=setTimeout(function(){t&&t.length>0&&(d.behavior(t),t=[],d.sendBhTimer=void 0,f&&typeof f=="function"&&f())},0))},initBehavior:function(){if(!this.hasInitBehavior&&!r){try{(function(){if(document&&document.referrer&&document.location){var d=document.referrer,p=document.location.href;if(d!==""){var l={type:"navigation",data:{from:d,to:p}};i=p,r&&r.addBehavior(l)}}})(),e&&e.document&&e.document.addEventListener&&(e.document.addEventListener("click",h("click"),!1),e.document.addEventListener("keypress",h("keypress"),!1)),v();var f=this.getConfig("enableConsole");f&&function(d){if(e&&e.console){var p=["debug","info","warn","log","error","assert"];s.isArray(d)&&(p=d);for(var l=0;l<p.length;l++){var m=p[l];m&&s.isString(m)&&e.console[m]&&typeof e.console[m]=="function"&&o(e.console,m,function(x){var g=m;return function(){for(var b=arguments.length,y=new Array(b),E=0;E<b;E++)y[E]=arguments[E];var I={type:"console",data:{level:g,message:y}};if(r&&r.addBehavior(I),g==="error")for(var C=0;C<y.length;C++){var R=y[C];R&&R.message&&R.stack&&r&&r.errorHandler(new ErrorEvent("error",{error:R,message:R.message}))}x&&Function.prototype.apply.call(x,e.console,y)}})}}}(f)}catch(d){s.warn("[arms] error in initBehavior",d)}r=this,this.hasInitBehavior=!0}return this}})},Ji}var Ts={},Ds;function Xi(){return Ds||(Ds=1,Ts.TIMING_KEYS=["startTime","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","","domInteractive","","domContentLoadedEventEnd","","loadEventStart","","msFirstPaint","secureConnectionStart","redirectStart","redirectEnd"]),Ts}var Zi,Bs;function za(){if(Bs)return Zi;Bs=1;var s=je(),c=Xi(),e=c.TIMING_KEYS;return Zi=function(){var t=s.win||{},r=t.performance;if(!r||typeof r!="object"||typeof r.getEntriesByType!="function")return null;var i={},n=r.timing||{},a=r.getEntriesByType("resource")||[];if(i.begin=n[e[1]]||Date.now(),typeof t.PerformanceNavigationTiming=="function"){var o=r.getEntriesByType("navigation")[0];o&&(n=o)}return s.each({dom:[10,8],load:[14,1]},function(u,h){var v=n[e[u[1]]],f=n[e[u[0]]];if(v>0&&f>0){var d=Math.round(f-v);d>=0&&d<6e5&&(i[h]=d)}}),i.res=JSON.stringify(a),i},Zi}var Yi,Ps;function Ha(){if(Ps)return Yi;Ps=1;var s=je(),c=Xi(),e=c.TIMING_KEYS;return Yi=function(){var t=s.win||{},r=t.performance;if(!r||typeof r!="object")return null;var i={},n=r.timing||{},a=Date.now(),o=1;if(typeof t.PerformanceNavigationTiming=="function"){var u=r.getEntriesByType("navigation")[0];u&&(n=u,o=2)}s.each({dns:[3,2],tcp:[5,4],ssl:[5,17],ttfb:[7,6],trans:[8,7],dom:[10,8],res:[14,12],firstbyte:[7,2],fpt:[8,1],tti:[10,1],ready:[12,1],load:[14,1]},function(p,l){var m=n[e[p[1]]],x=n[e[p[0]]];if(o===2||m>0&&x>0){var g=Math.round(x-m);g>=0&&g<6e5&&(i[l]=g)}});var h=t.navigator.connection,v=r.navigation||{};i.ct=h?h.effectiveType||h.type:"";var f=h&&(h.downlink||h.downlinkMax||h.bandwidth)||null;if((f=f>999?999:f)&&(i.bandwidth=f),i.navtype=v.type===1?"Reload":"Other",o===1&&n[e[16]]>0&&n[e[1]]>0){var d=n[e[16]]-n[e[1]];d>=0&&d<36e5&&(i.fpt=d)}return o===1&&n[e[1]]>0?i.begin=n[e[1]]:o===2&&i.load>0?i.begin=a-i.load:i.begin=a,i},Yi}var Ls,Ns;function ja(){return Ns||(Ns=1,Ls=function(s,c,e){var t=je(),r=za(),i=Ha(),n=null,a=e.documentElement,o=c.innerWidth||a.clientWidth||e.body.clientWidth,u=c.innerHeight||a.clientHeight||e.body.clientHeight,h=c.navigator.connection,v={sr:screen.width+"x"+screen.height,vp:o+"x"+u,ct:h?h.effectiveType||h.type:""},f={},d=function(l,m,x,g,b){if(m===void 0){var y,E;if(!f[l]){y=new RegExp(l+"=([^;]+)");try{E=y.exec(e.cookie)}catch(C){return t.warn("[retcode] can not get cookie:",C),null}E&&(f[l]=E[1])}return f[l]}var I=l+"="+m;I+="; path=/",x&&(I+="; max-age="+x);try{return e.cookie=I,!!e.cookie}catch(C){return t.warn("[retcode] can not set cookie: ",C),!1}},p=function(l){var m=l._conf.uid||d("_nk_")||d("_bl_uid");return!m&&(m=t.uu(),!d("_bl_uid",m,15552e3))?null:m};return t.ext(s.prototype,{activeErrHandler:function(l){return n&&!l?this:(n=this,this)},errorHandler:function(l){if(!l)return this;var m=l.type;if(m==="error"){var x=l.target||l.srcElement;!x||!x.tagName||l.message||l.filename||l.lineno||l.colno?this.error(l.error||{message:l.message},l):this.resourceErrorHandler(l)}else m==="unhandledrejection"&&t.T(l.reason,"Error")&&t.checkAutoError(l.reason)&&this.error(l.reason);try{this.getConfig("behavior")&&this.reportBehavior&&this.reportBehavior()}catch(g){}return this},resourceErrorHandler:function(l){var m=this,x=l.target||l.srcElement;try{var g=m.getSrc(x),b=typeof x.tagName=="string"?x.tagName.toLowerCase():"",y=m.getXPath(x,5),E=t.getURL(g),I={src:g&&g.substring(0,1e3),node_name:b,xpath:y,res_type:t.getResType(b,g),res_name:E.path,domain:E.domain};return m._conf.enableResource&&m.fixResourceStatus&&l.timeStamp&&m.fixResourceStatus({src:g,node_name:b,res_type:t.getResType(b,g),timeStamp:l.timeStamp,domain:E.domain}),m._lg("resourceError",I),m}catch(C){return t.warn("[ARMS] resourceErrorHandler error :",C),m}},getSrc:function(l){var m=l.src||l.href;try{if(!m){var x=(typeof l.tagName=="string"?l.tagName.toLowerCase():"")==="object",g=l.getAttribute("classid")&&l.getAttribute("classid").toLowerCase()==="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"||l.getAttribute("type")==="application/x-shockwave-flash";x&&g&&(m=l.getAttribute("data")||l.getAttribute("codebase")),m||(m=l.outerHTML||l.innerHTML)}}catch(b){m=""}return m},getXPath:function(l,m){var x=l.id?"#"+l.id:"",g=typeof l.className=="string"?"."+l.className.split(" ").join("."):"",b=(typeof l.tagName=="string"?l.tagName.toLowerCase():"")+x+g;return l.parentNode&&l.parentNode.tagName&&m-1!=0?this.getXPath(l.parentNode,m-1)+" > "+b:b},sendPerformance:function(l){var m=this;m.onReady(function(){var x=i();x&&x.load&&x.load>0&&(x.page=m.getPage(!0),l&&(x=t.ext(x,l)),x.autoSend=!0,m.performance(x))})},sendResources:function(l){var m=this;m.onReady(function(){var x=r();x&&x.load&&x.load>0&&(x.load&&x.load<=2e3||x.load&&x.load<=8e3&&Math.random()>.05||(x.page=m.getPage(!0),x.dl=location.href,l&&(x=t.ext(x,l)),m._lg("res",x,m.getConfig("sample"))))})},sendPV:function(){var l=this;l.onReady(function(){var m=function(x){var g=p(x),b=c.devicePixelRatio||1;return{uid:g,dt:e.title,dl:location.href,dr:e.referrer,dpr:b.toFixed(2),de:(e.characterSet||e.defaultCharset||"").toLowerCase(),ul:a.lang,begin:Date.now()}}(l);m&&m.uid&&l._lg("pv",m,l.getConfig("pvSample"))})},commonInfo:function(){return v.uid=p(this),v.sid=function(l){if(l.session)return l.session;var m;try{if(typeof window=="object"&&typeof sessionStorage=="object"&&typeof sessionStorage.getItem=="function")return typeof(m=sessionStorage.getItem("_bl_sid"))=="string"?(l.session=m,m):(m=t.uu(),l.session=m,typeof sessionStorage.setItem=="function"&&sessionStorage.setItem("_bl_sid",m),m)}catch(x){t.warn("[ARMS] getSid error :",x)}return l.session=m=t.uu(),m}(this),v},handleUnload:function(l){var m=Date.now();if(m-this._lastUnload<200)return this;this._lastUnload=m,this.sendHealth(l),this.speedCache&&(this._lg("speed",this.speedCache),this.speedCache=null,clearTimeout(this.speedTimmer)),this._conf&&this._conf.enableResource&&this.resourceComboReport(),this.clear(!0)},bindHashChange:function(l){var m=this;if(!l^m.hashChangeHandler)return m;l?(m.hackHistoryState(),m.hashChangeHandler=function(x){var g=m._conf.parseHash(location.hash);g&&m.setPage(g,x!==!1)},m.stateChangeHandler=function(x){var g=m._conf.parseHash(x.detail);g&&m.setPage(g)},t.on(c,"hashchange",m.hashChangeHandler),t.on(c,"historystatechange",m.stateChangeHandler),m.hashChangeHandler(!1)):(t.off(c,"hashchange",m.hashChangeHandler),t.off(c,"historystatechange",m.stateChangeHandler),m.hashChangeHandler=null,m.stateChangeHandler=null)},initHandler:function(){var l=this;if(l.hasInitHandler)return l;var m=l._conf;return t.on(c,"beforeunload",function(){l.handleUnload(0)}),l.bindHashChange(m.enableSPA),l.activeErrHandler(!1),l.hasInitHandler=!0,l}}),t.on(c,"error",function(l){n&&n.errorHandler(l)},!1,!0).on(c,"unhandledrejection",function(l){n&&n.errorHandler(l)}),s}),Ls}var Qi,Ms;function Wa(){if(Ms)return Qi;Ms=1;var s=je(),c=500;return Qi=function(e,t,r){function i(v,f,d){var p=0,l=v.tagName;if(l!=="SCRIPT"&&l!=="STYLE"&&l!=="META"&&l!=="HEAD"){var m=v.children?v.children.length:0;if(m>0)for(var x=v.children,g=m-1;g>=0;g--)p+=i(x[g],f+1,p>0);if(p<=0&&!d&&!(v.getBoundingClientRect&&v.getBoundingClientRect().top<a))return 0;p+=1+.5*f}return p}function n(v){for(var f=1;f<v.length;f++)if(v[f].score<v[f-1].score)return v.splice(f,1),n(v);return v}var a=t.innerHeight||0,o=[],u=null,h=0;s.ext(e.prototype,{initFmpObserver:function(v){var f=this;if(!f._conf||!f._conf.useFmp)return null;if(!t.MutationObserver)return s.warn("[retcode] first meaningful paint can not be retrieved"),f.sendPerformance(),null;s.on(t,"beforeunload",function(){f.endObserving(0,!0)});var d=t.MutationObserver;return(u=new d(function(){(function(p){var l=Date.now()-p,m=r.querySelector("body");if(m){var x=0;x+=i(m,1,!1),o.push({score:x,t:l})}else o.push({score:0,t:l})})(f._startTime)})).observe(document,{childList:!0,subtree:!0}),h=1,f.onReady(function(){f.endObserving(v)}),u},endObserving:function(v,f){var d=this;if(u&&h)if(d.fmpTimmer&&(clearTimeout(d.fmpTimmer),d.fmpTimmer=null),f||!function(x,g){var b=Date.now()-x;return!(b>g||b-(o&&o.length&&o[o.length-1].t||0)>2*c)}(d._startTime,v)){u.disconnect(),h=0,o=n(o);for(var p=null,l=1;l<o.length;l++)if(o[l].t>=o[l-1].t){var m=o[l].score-o[l-1].score;(!p||p.rate<=m)&&(p={t:o[l].t,rate:m})}p&&p.t>0&&p.t<36e5?d.sendPerformance({fmp:p.t}):d.sendPerformance()}else d.fmpTimmer=s.delay(function(){d.endObserving(v)},c)}})},Qi}var Fs,Os;function Ka(){return Os||(Os=1,Fs=function(s,c){var e=je(),t=null,r=e.getCurDomain(),i=function(h,v,f,d,p,l,m,x,g,b,y,E,I){var C=e.J(p)||null,R=e.safetyCall(v,[C,d],null);if(!R)return!1;var L=R.code||l,k=!("success"in R)||R.success;h.api(f,k,m,L,R.msg,x,g,b,k?{}:y,r,E,I)},n="fetch",a="__oFetch_",o="__oXMLHttpRequest_",u="XMLHttpRequest";return e.ext(s.prototype,{removeHook:function(h,v){return t&&(v||this===t)?(c[a]&&(c[n]=c[a],delete c[a]),c[o]&&(c[u]=c[o],delete c[o]),t=null,this):this},addHook:function(h){return!h&&t?this:(t||(function(){if(typeof c[n]=="function"){var v=c[n];c[a]=v,c[n]=function(f,d){var p=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),l=t;if(!l||!l.api||d&&(d.method==="HEAD"||d.mode==="no-cors"))return v.apply(c,p);d||(d={});var m=Date.now(),x=l._conf,g=e.duration(),b=(f&&typeof f!="string"?f.url:f)||"",y=b;b=e.cutUrlSearch(b);var E=(x.ignore||{}).ignoreApis,I=x.parseTraceId;if(!e.checkAPI(b,!0)||e.ignoreByRule(b,E))return v.apply(c,p);b=e.filterByRule(b,y,x.ignoreApiPath?x.ignoreApiPath:x.apiHelper);var C=x.enableLinkTrace,R="",L="",k=l.getConfig("pid"),M=null,w=l.getConfig("sample"),N=l.getConfig("linkType"),_=1;if(w&&!l.sampling(w)&&(_=0),C){var V="";try{V=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(K){V=""}var ee=e.checkSameOrigin(y,V);if(l.getConfig("enableApiCors")||ee)if(f&&typeof f!="string")try{if(p[0].headers&&typeof p[0].headers.get=="function"&&typeof p[0].headers.append=="function")switch(N){case"arms":var q=p[0].headers.get("EagleEye-TraceID"),re=p[0].headers.get("EagleEye-SessionID"),$=p[0].headers.get("EagleEye-pAppName");q?R=q:(R=l.getTraceId()["EagleEye-TraceID"],p[0].headers.append("EagleEye-TraceID",R)),re?L=re:(L=l.getPageviewId()["EagleEye-SessionID"],p[0].headers.append("EagleEye-SessionID",L)),$||p[0].headers.append("EagleEye-pAppName",k);break;case"b3":var ie=p[0].headers.get("X-B3-TraceId");if(ie)R=ie;else{var D=l.getB3TraceId(_);p[0].headers.append("X-B3-TraceId",D["X-B3-TraceId"]),p[0].headers.append("X-B3-ParentSpanId",D["X-B3-ParentSpanId"]),p[0].headers.append("X-B3-SpanId",D["X-B3-SpanId"]),p[0].headers.append("X-B3-Sampled",D["X-B3-Sampled"]),p[0].headers.append("X-Request-ID",e.guid()),R=D["X-B3-TraceId"]}L=l.pageview;break;case"tracing":default:var B=p[0].headers.get("uber-trace-id");B?R=B.split(":")[0]:(B=l.getUberTraceId(_),p[0].headers.append("uber-trace-id",B["uber-trace-id"]),R=B.traceId),L=l.pageview}}catch(K){e.warn(`[retcode] fetch failed to set header, exception is :
|
|
4
|
+
`+K)}else switch(d.headers=d.headers?d.headers:{},N){case"arms":d.headers["EagleEye-TraceID"]?R=d.headers["EagleEye-TraceID"]:(R=l.getTraceId()["EagleEye-TraceID"],d.headers["EagleEye-TraceID"]=R),d.headers["EagleEye-SessionID"]?L=d.headers["EagleEye-SessionID"]:(L=l.getPageviewId()["EagleEye-SessionID"],d.headers["EagleEye-SessionID"]=L),d.headers["EagleEye-pAppName"]||(d.headers["EagleEye-pAppName"]=k);break;case"b3":if(d.headers["X-B3-TraceId"])R=d.headers["X-B3-TraceId"];else{var H=l.getB3TraceId(_);d.headers["X-B3-TraceId"]=H["X-B3-TraceId"],d.headers["X-B3-ParentSpanId"]=H["X-B3-ParentSpanId"],d.headers["X-B3-SpanId"]=H["X-B3-SpanId"],d.headers["X-B3-Sampled"]=H["X-B3-Sampled"],d.headers["X-Request-ID"]=e.guid(),R=H["X-B3-TraceId"]}L=l.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(d.headers["uber-trace-id"])R=d.headers["uber-trace-id"].split(":")[0];else{var F=l.getUberTraceId(_);d.headers["uber-trace-id"]=F["uber-trace-id"],R=F.traceId}L=l.getPageviewId()["EagleEye-SessionID"]}}return v.apply(c,p).then(function(K){if(!l||!l.api)return K;try{if(!K||typeof K.clone!="function")return K;var Y=K.clone(),ge=Y.headers;if(ge&&typeof ge.get=="function"){var se=ge.get("content-type");if(se&&!/(text)|(json)/.test(se))return K;if(!R){var xe=e.parseFetchHeaders(ge);typeof xe=="object"&&xe["eagleeye-traceid"]&&(R=xe["eagleeye-traceid"],M="response")}}var Re=g();return Y.text().then(function(Ce){if(!R&&e.isFunction(I)){var Me=I(Y,Ce);Me&&e.isString(Me)&&(R=Me)}var ke=e.getFetchSnapshot(p,Ce,ge);Y.ok?i(l,x.parseResponse,b,y,Ce,Y.status||200,Re,m,R,L,ke,M,_):(l.api(b,!1,Re,Y.status||404,Y.statusText,m,R,L,ke,r,M,_),x.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:Y.url,res_type:"api"}))}),K}catch(Ce){return e.warn("[ARMS] fetch response error :",Ce),K}}).catch(function(K){if(!l||!l.api)throw K;var Y=g();throw l.api(b,!1,Y,K.name||"Error",K.message,m,R,L,{},r),x.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:y,res_type:"api"}),K})},c[n].toString=e.createFakeToString(n)}}(),function(){if(typeof c[u]=="function"){var v,f=c[u];c[o]=f;var d=function(p){var l=new f(p),m=t;if(!m||!m.api||!l.addEventListener)return l;var x,g,b,y,E=l.send,I=l.open,C=l.setRequestHeader,R=m._conf,L=(R.ignore||{}).ignoreApis,k=R.parseTraceId,M=m.getConfig("enableLinkTrace"),w="",N="",_="",V=null,ee=m.getConfig("sample"),q=m.getConfig("linkType"),re=1;return ee&&!m.sampling(ee)&&(re=0),l.open=function($,ie){v=$;var D=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);I.apply(l,D),y=ie||"",b=e.cutUrlSearch(y);var B=!e.checkAPI(b,!0)||e.ignoreByRule(b,L);if(b=b?e.filterByRule(b,y,R.ignoreApiPath?R.ignoreApiPath:R.apiHelper):"",!B&&M){var H="";try{H=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(ge){H=""}var F=e.checkSameOrigin(y,H);if((m.getConfig("enableApiCors")||F)&&C&&typeof C=="function")switch(q){case"arms":w=m.getTraceId()["EagleEye-TraceID"],C.apply(l,["EagleEye-TraceID",w]),N=m.getPageviewId()["EagleEye-SessionID"],C.apply(l,["EagleEye-SessionID",N]),_=m.getConfig("pid"),C.apply(l,["EagleEye-pAppName",_]);break;case"b3":var K=m.getB3TraceId(re);C.apply(l,["X-B3-TraceId",K["X-B3-TraceId"]]),C.apply(l,["X-B3-ParentSpanId",K["X-B3-ParentSpanId"]]),C.apply(l,["X-B3-SpanId",K["X-B3-SpanId"]]),C.apply(l,["X-B3-Sampled",K["X-B3-Sampled"]]),C.apply(l,["X-Request-ID",e.guid()]),w=K["X-B3-TraceId"],N=m.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var Y=m.getUberTraceId(re);C.apply(l,["uber-trace-id",Y["uber-trace-id"]]),w=Y.traceId,N=m.getPageviewId()["EagleEye-SessionID"]}}},l.send=function(){x=Date.now(),g=e.duration();var $=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);E.apply(l,$)},e.on(l,"readystatechange",function(){if(b&&l.readyState===4){var $=g(),ie=e.getXhrSnapshot(y,v,l);if(!w){var D=e.parseXhrHeaders(typeof l.getAllResponseHeaders=="function"&&l.getAllResponseHeaders()||"");typeof D=="object"&&D["eagleeye-traceid"]&&(w=D["eagleeye-traceid"],V="response")}if(!w&&e.isFunction(k)){var B=k(l);B&&e.isString(B)&&(w=B)}if(l.status>=200&&l.status<=299){var H=l.status||200;if(typeof l.getResponseHeader=="function"){var F=l.getResponseHeader("Content-Type");if(F&&!/(text)|(json)/.test(F))return}l.responseType&&l.responseType!=="text"?m.api(b,!0,$,H,"",x,w,N,{},r,V,re):i(m,R.parseResponse,b,y,l.responseText,H,$,x,w,N,ie,V,re)}else m.api(b,!1,$,l.status||"FAILED",l.statusText,x,w,N,ie,r,V,re),R.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:l.responseURL||y,res_type:"api"})}}),l};d.prototype=f.prototype,e.each(Object.keys(f),function(p){d[p]=f[p]}),c[u]=d,c[u].toString=e.createFakeToString(u)}}()),t=this,this)},initHook:function(){return this.hasInitHook?this:(this.getConfig("disableHook")||this.addHook(),this.hasInitHook=!0,this)}}),s}),Fs}var Vs,Us;function $a(){return Us||(Us=1,Vs=function(s,c){var e=je(),t=c.history||{},r=c.document,i=function(a,o){var u;c.CustomEvent?u=new CustomEvent(a,{detail:o}):((u=r.createEvent("HTMLEvents")).initEvent(a,!1,!0),u.detail=o),c.dispatchEvent(u)},n=function(a){var o=t[a];typeof o=="function"&&(t[a]=function(u,h,v){var f=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),d=location.href,p=o.apply(t,f);if(!v||typeof v!="string"||v===d)return p;try{var l=d.split("#"),m=v.split("#"),x=e.cutUrlSearch(l[0]),g=e.cutUrlSearch(m[0]),b=l[1]&&l[1].replace(/^\/?(.*)/,"$1"),y=m[1]&&m[1].replace(/^\/?(.*)/,"$1");b!==y?i("historystatechange",y):x!==g&&i("historystatechange",g)}catch(E){e.warn("[retcode] error in "+a+": "+E)}return p},t[a].toString=e.createFakeToString(a))};e.ext(s.prototype,{hackHistoryState:function(){return this.hasHackedHistoryState?this:(n("pushState"),n("replaceState"),this.hasHackedHistoryState=!0,this)}})}),Vs}var er,zs;function qa(){if(zs)return er;zs=1;var s=je(),c=Xi(),e=c.TIMING_KEYS;return er=function(t,r){function i(o,u,h){if(o instanceof r.PerformanceResourceTiming&&o.initiatorType){var v=s.getResType(o.initiatorType,o.name),f=u.resourceTypes||[],d=(u.ignore||{}).ignoreResources;if(v&&f.includes(v)&&!s.ignoreByRule(o.name,d)&&!s.ignoreByRule(s.decode(o.name),d)){var p=o[e[0]],l=o[e[1]],m=o[e[2]],x=o[e[3]],g=o[e[4]],b=o[e[5]],y=o[e[6]],E=o[e[7]],I=o[e[8]],C=o[e[18]],R=o[e[19]];if(!h.has(o)&&(!s.areInOrder(p,l,m,x,g,b,y,E,I)||p>E))return;if(C<p&&(C=p),R<p&&(R=l),s.areInOrder(p,C,R,l))return{domain:s.getURL(o.name).domain,res_type:v,src_type:s.getSrcType(o.name,u.cdnHostList),success:1,size:Math.round(o.decodedBodySize),duration:Math.round(o.duration),timeStamp:o.responseEnd,timing:o}}}}var n="_resource-"+Date.now(),a="_resource_error-"+Date.now();s.ext(t.prototype,{initResource:function(){var o=this,u=r.performance,h=r.PerformanceObserver;if(o[a]||(o[a]=new WeakMap),!u||!h||typeof u!="object"||typeof u.getEntriesByType!="function")return null;var v=u.getEntriesByType("resource")||[];return setTimeout(function(){o.setResource(v)},10),new h(function(f){setTimeout(function(){o.setResource(f.getEntries())},10)}).observe({entryTypes:["resource"]}),this.onReady(function(){setTimeout(o.resourceComboReport.bind(o),5e3)}),o},setResource:function(o){var u=this._conf,h=this[a];if(s.isArray(o)&&o.length){this[n]||(this[n]={});for(var v=this[n],f=0,d=o.length;f<d;f+=1){var p=o[f];if(s.checkAPI(p.name,!1)){var l=i(p,u,h);if(l){var m=l.res_type+"-"+l.domain;m in v||(v[m]=[]),v[m].push(l)}}}return this}},fixResourceStatus:function(o){var u=r.performance;if(!u||typeof u.getEntriesByName!="function")return null;var h=this[a];if(!o.src||!s.checkAPI(o.src,!1))return this;var v=o.timeStamp||u.now(),f=u.getEntriesByName(o.src,"resource");return s.each(f,function(d){h.has(d)||v-d.responseEnd<100&&h.set(d,{success:0})}),this},resourceComboReport:function(){var o=this[n]||{},u=this._conf.resourceSlow||2e3,h=this[a];this[n]={};var v=Object.keys(o);if(v.length!==0){var f=[];s.each(v,function(m){var x=o[m],g={domain:"",res_type:"",src_type:"",size:0,duration:0,count:0,err_count:0,err_duration:0,slow_count:0,slow_duration:0,timings:[]};s.each(x,function(b){var y=b.timing||{},E=h.get(b.timing),I=E?E.success:1,C=b.duration>u?1:0;g.domain=b.domain,g.res_type=b.res_type,g.src_type=b.src_type,g.count+=1,g.duration+=b.duration,g.size+=b.size,I||(g.err_count+=1,g.err_duration+=b.duration),C&&(g.slow_count+=1,g.slow_duration+=b.duration);try{var R=JSON.parse(JSON.stringify(y));R.success=I,R.resourceSlow=u,R.isSlow=C,g.timings.push(R)}catch(L){}}),g.count&&(g.size=Math.round(g.size/g.count),g.duration=Math.round(g.duration/g.count)),g.slow_count&&(g.slow_duration=Math.round(g.slow_duration/g.slow_count)),g.err_count&&(g.err_duration=Math.round(g.err_duration/g.err_count)),g.timings.length>20&&(g.timings.sort(function(b,y){return y.duration-b.duration}),g.timings.length=20),g.timings=encodeURIComponent(JSON.stringify(g.timings)),f.push(g)});var d={_combo:1,resource:JSON.stringify(f)},p=r.navigator.connection;d.ct=p?p.effectiveType||p.type:"";var l=p&&(p.downlink||p.downlinkMax||p.bandwidth)||null;(l=l>999?999:l)&&(d.bandwidth=l),this._lg("resource",d,this.getConfig("sample"))}}})},er}var Hs;function Ga(){if(Hs)return Qe.exports;Hs=1;var s=je(),c=Fa(),e=Oa(),t=Va(),r=s.win,i=r.document,n=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,a=function(o){var u=this;return c.call(u,o),u._initialPage=o.page&&s.safetyCall(o.page,[],o.page+"")||null,u._isRobot=s.isRobot(),u._health={errcount:0,apisucc:0,apifail:0},u.beforeSend=function(h,v){h==="error"?u._health.errcount++:h==="api"&&u._health[v.success?"apisucc":"apifail"]++},o.enableInstanceAutoSend!==!1&&(u.initHandler(),u.initHook(),u.initFmpObserver(1e4),u._conf&&u._conf.behavior&&typeof u.initBehavior=="function"&&u.initBehavior(),u._conf&&u._conf.enableResource&&typeof u.initResource=="function"&&u.initResource()),Object.defineProperty&&r.addEventListener&&Object.defineProperty(u,"pipe",{set:u.sendPipe}),u};return a.prototype=s.createObject(c.prototype),s.ext(c._root.dftCon,{uid:null,setUsername:null,ignoreUrlPath:null,ignoreApiPath:null,urlHelper:[{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},/\/$/],resourceHelper:[],apiHelper:{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},ignoreUrlCase:!0,imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",cdnHostList:[],resourceTypes:["css","script","img","font"],resourceSlow:2e3,disableHook:!1,autoSendPv:!0,autoSendPerf:!0,enableSPA:!1,enableLinkTrace:!1,linkType:"arms",enableApiCors:!1,sendResource:!0,behavior:!0,enableConsole:!1,parseHash:function(o){return(o?s.cutUrlSearch(o.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(o){if(!o||typeof o!="object")return{};var u=o.code,h=o.msg||o.message||o.subMsg||o.errorMsg||o.ret||o.errorResponse||"";return typeof h=="object"&&(u=u||h.code,h=h.msg||h.message||h.info||h.ret||JSON.stringify(h)),{msg:h,code:u,success:!0}}}),s.ext(a.prototype,{constructor:a,_super:c,onReady:function(o){var u=this;if(u.hasReady)return o();i.readyState==="complete"?(u.hasReady=!0,o()):s.on(r,"load",function(){u.hasReady=!0,o()},!0)},getPage:function(o){var u=this._conf,h=u.page,v=location,f=v.host+v.pathname;return h&&!o?s.safetyCall(h,[],h+""):this._initialPage||s.filterByRule(u.ignoreUrlCase?f.toLowerCase():f,v.href,u.ignoreUrlPath?u.ignoreUrlPath:u.urlHelper)},setPage:function(o,u){var h=this,v=h.prevPage;if(u!==!1){if(!o||o===v)return h;h.prevPage=o,clearTimeout(h.sendPVTimmer),h.handleUnload(1),h.resetPageview(),h.sendPVTimmer=setTimeout(function(){h.sendPV()},10)}else h.prevPage=o;return h._conf.page=o,h},setConfig:function(o,u){if(o&&typeof o=="object"){s.verifyConfig(o),o=this.setImgUrl(o);var h=this._conf;if(this._conf=s.ext({},h,o),!u){var v="disableHook";v in o&&h[v]!==o[v]&&(o[v]?this.removeHook():this.addHook()),(v="enableSPA")in o&&h[v]!==o[v]&&this.bindHashChange(o[v])}}},sendRequest:function(o){e(o,this.getConfig("imgUrl"))},postData:function(o,u){var h={};h[u]=o[u],delete o[u];var v="";typeof o=="object"&&(v=s.serialize(o)),t(h,this.getConfig("imgUrl")+v+"&post_res=")},sendPipe:function(o){var u=this;if(!o||!o.length)return u;try{if(s.T(o[0])==="Array")return s.each(o,function(v){return u.sendPipe(v)});if(s.T(o)!=="Array")return u;var h=o.shift();if(!n.test(h))return u;u[h].apply(u,o)}catch(v){return s.warn("[retcode] error in sendPipe",v),u}},sendHealth:function(){var o=s.ext({},this._health);o.healthy=o.errcount>0?0:1,o.begin=Date.now();var u=o.begin-this.sBegin;o.stay=u,this._lg("health",o,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(o){o=s.ext({pid:this._conf.pid},o);var u=this.__proto__.constructor(o);return o.page&&u.sendPV(),u}}),Ua()(a,r),ja()(a,r,i),Wa()(a,r,i),Ka()(a,r),$a()(a,r),qa()(a,r),a._super=c,a._root=c._root,c.Browser=a,Qe.exports=a,Qe.exports}var js;function Ja(){if(js)return lt.exports;js=1;function s(a,o){var u=e[r]=new t(a);u.sendPipe(o);var h=u._conf;return h.autoSendPv!==!1&&u.sendPV(),h&&h.useFmp||u.sendPerformance(),h&&h.sendResource&&u.sendResources(),e[i]=!0,u}function c(){if(e[i])return e[r];var a={},o=[];return r in e&&(a=e[r].config||{},o=e[r].pipe||[]),s(a,o)}var e=window,t=e.BrowserLogger=Ga(),r=je().key,i="__hasInitBlSdk";t.singleton=function(a,o){return e[i]?e[r]:s(a,o)},t.createExtraInstance=function(a){a&&typeof a=="object"&&a.enableInstanceAutoSend!==!0&&(a.enableInstanceAutoSend=!1);var o=new t(a),u=o._conf;return u.enableInstanceAutoSend&&(u.autoSendPv!==!1&&o.sendPV(),u&&u.useFmp||o.sendPerformance(),u&&u.sendResource&&o.sendResources()),o};var n=typeof window=="object"&&!!window.navigator;return n&&e[r]&&(t.bl=c()),lt.exports=t,lt.exports}function Xa(){return Ja()}var Za={getArmsLogger:Xa};function Ya(s,c,e){const t=[],r=typeof Object.getOwnPropertyDescriptors=="function"?Object.getOwnPropertyDescriptors(Object.getPrototypeOf(s)):{};for(const n of Object.keys(r))r[n].get&&t.push(n);const i={MediaboxWrapperObjectGetter(n,a){if(typeof a=="string"&&t.indexOf(a)>-1)return yt(n[a],c+1,e);const o={MediaboxWrapperObjectMethod(...u){return yt(n[a](...u),c+1,e)}};return typeof n[a]=="function"?o.MediaboxWrapperObjectMethod:c>10?n[a]:yt(n[a],c+1,e)},MediaboxWrapperObjectSetter(n,a,o){return n[a]=yt(o,c+1,e),!0}};return new Proxy(s,{get:i.MediaboxWrapperObjectGetter,set:i.MediaboxWrapperObjectSetter})}function Qa(s,c,e){const t={MediaboxWrapperFunctionApply(r,i,n){const a=r.apply(i,n);return yt(a,c+1,e)},MediaboxWrapperFunctionGet(r,i){const n=Object.getOwnPropertyDescriptor(r,i);if(n&&!n.writable&&!n.configurable)return r[i];const a={MediaboxWrapperFunctionGet(...o){const u=r[i](...o);return yt(u,c+1,e)}};return typeof r[i]=="function"?a.MediaboxWrapperFunctionGet:yt(r[i],c+1,e)},MediaboxWrapperClassConstructor(r,i){const n=new r(...i);return yt(n,c+1,e)}};return new Proxy(s,{apply:t.MediaboxWrapperFunctionApply,get:t.MediaboxWrapperFunctionGet,construct:t.MediaboxWrapperClassConstructor})}function eo(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp)&&!(s instanceof Function)}function yt(s,c,e){return typeof s=="function"?Qa(s,c+1,e):s instanceof Promise?s.then(t=>yt(t,c+1,e)).catch(t=>(t instanceof Error&&typeof t.stack=="string"&&t.stack.indexOf("MediaboxWrapper")>-1&&e(t),Promise.reject(t))):eo(s)?Ya(s,c+1,e):s}const to="https://arms-retcode-sg.aliyuncs.com/r.png?",io="https://arms-retcode.aliyuncs.com/r.png?",ro="https://retcode-us-west-1.arms.aliyuncs.com/r.png?",so={cn:io,sg:to,usw:ro};class tr{constructor(c){nt(this,"armsLogger"),nt(this,"isReady",!1),nt(this,"isDestroyed",!1),nt(this,"options"),nt(this,"queue",[]),nt(this,"helper",{MediaboxWrapperQueue(n){return new Error(n)},MediaboxWrapperInitiative(n){return new Error(n)}}),this.options=c;const{region:e="cn",env:t="prod"}=c,r=n=>{var a;if(this.isDestroyed)return!1;if(n.c1=(a=this.options.cid)!=null?a:window.location.host,n.c2=tr.version,this.options.customData&&(n.c3=new URLSearchParams(this.options.customData).toString()),n.t==="error"){if(n.file.indexOf("g.alicdn.com/apsara-media-")>-1||n.file.indexOf("g.alicdn.com/thor-server")>-1||n.stack.indexOf("MediaboxWrapper")>-1){let o=n;return this.options.beforeSend&&(o=this.options.beforeSend(n)),this.isReady?o:(o&&this.queue.push(o),!1)}return!1}return n},i=Za.getArmsLogger();this.armsLogger=i.singleton({pid:"e1iftji1w7@7ec1cef2cc88733",tag:c.businessName,release:`${c.businessName}_${c.version}`,imgUrl:so[e],behavior:!0,sample:1,disableHook:!0,environment:t,beforeReport:r})}static get version(){return"0.10.0"}wrap(c){return this.options.disabled||typeof Proxy>"u"?c:yt(c,0,e=>this.armsLogger.error(e))}updateOptions(c){this.options=Se(Se({},this.options),c)}setReady(){this.isReady=!0,this.queue.length&&this.queue.forEach(c=>{this.armsLogger.error(this.helper.MediaboxWrapperQueue(c.msg),{filename:c.file,lineno:c.line,colno:c.col})})}report(c,e){this.armsLogger.error(this.helper.MediaboxWrapperInitiative(c),e)}destroy(){this.isDestroyed=!0}}for(var Ie=(s=>(s.PullStreamStats="remoteStat",s.RtsSubscribeExceeds="rtsSubscribeExceeds",s.UserJoined="userJoined",s.UserLeft="userLeft",s.Bye="bye",s.MuteAudio="muteAudio",s.UnmuteAudio="unmuteAudio",s.MuteVideo="muteVideo",s.UnmuteVideo="unmuteVideo",s.MuteScreen="muteScreen",s.UnmuteScreen="unmuteScreen",s.Error="error",s))(Ie||{}),et=(s=>(s.Local="local-device-status-change",s.Remote="remote-device-status-change",s))(et||{}),Z=(s=>(s.Audio="sophon_audio",s.VideoLarge="sophon_video_camera_large",s.VideoSmall="sophon_video_camera_small",s.Screen="sophon_video_screen_share",s))(Z||{}),ir=(s=>(s.Audio="rts audio",s.VideoLarge="rts video",s))(ir||{}),Ft=(s=>(s.Add="add",s.Delete="delete",s.Replace="replace",s.Stop="stop",s.UnPublish="unpublish",s))(Ft||{}),Yt=(s=>(s[s.Camera=0]="Camera",s[s.Screen=1]="Screen",s[s.Image=2]="Image",s))(Yt||{}),_i=(s=>(s[s.Microphone=0]="Microphone",s[s.Screen=1]="Screen",s[s.Mixed=2]="Mixed",s))(_i||{}),Be=(s=>(s.InRoom="inRoom",s.Join="join",s.Publish="publish",s.User="user",s.Resume="resume",s))(Be||{}),Ot=(s=>(s[s.MANUAL=0]="MANUAL",s[s.JOINCHANNEL=1]="JOINCHANNEL",s))(Ot||{}),Ge=[],rr=0;rr<256;++rr)Ge.push((rr+256).toString(16).slice(1));function no(s,c=0){return(Ge[s[c+0]]+Ge[s[c+1]]+Ge[s[c+2]]+Ge[s[c+3]]+"-"+Ge[s[c+4]]+Ge[s[c+5]]+"-"+Ge[s[c+6]]+Ge[s[c+7]]+"-"+Ge[s[c+8]]+Ge[s[c+9]]+"-"+Ge[s[c+10]]+Ge[s[c+11]]+Ge[s[c+12]]+Ge[s[c+13]]+Ge[s[c+14]]+Ge[s[c+15]]).toLowerCase()}var yi,ao=new Uint8Array(16);function oo(){if(!yi&&(yi=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yi(ao)}var co=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ws={randomUUID:co};function Vt(s,c,e){if(Ws.randomUUID&&!c&&!s)return Ws.randomUUID();s=s||{};var t=s.random||(s.rng||oo)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,c){e=e||0;for(var r=0;r<16;++r)c[e+r]=t[r];return c}return no(t)}var Ai=(s=>(s.prod="rs.rtn.aliyuncs.com",s.pre="prs.rtn.aliyuncs.com",s))(Ai||{});const sr="6.11.6-beta.2",Ks="web";class At{static getVersionNumber(){let c=sr.split("."),e="";return c.forEach(t=>{t.length===1?e+="0"+t:e+=t}),parseInt(e)}static queryingParam(c){let e=[];if(c)for(let t in c)e.push(t+"="+c[t]);return e.join("&")}static getQueryParams(c){const t=window.location.search.substring(1).split("&");for(let r=0;r<t.length;r++){const i=t[r].split("=");if(decodeURIComponent(i[0])===c)return decodeURIComponent(i[1])}}static createCallid(c=""){const e=Vt();return c&&e&&e.length>c.length?`${c}${e.substring(c.length)}`:e}static checkSubOptionsValid(c){if(c){const{audio:e,video:t,screen:r}=c;if(e===!1&&t===!1&&r===!1)return!1}return!0}static isNetworkAvailable(){return z(this,null,function*(){const c=Ai.prod,{onLine:e}=navigator;if(!e)return!1;try{return yield fetch(`https://${c}/roomserver/v1/ws/version`),!0}catch(t){return!1}})}}var _e=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function $s(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function uo(s){if(s.__esModule)return s;var c=s.default;if(typeof c=="function"){var e=function t(){return this instanceof t?Reflect.construct(c,arguments,this.constructor):c.apply(this,arguments)};e.prototype=c.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(s).forEach(function(t){var r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:function(){return s[t]}})}),e}function oi(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var qs={exports:{}};/*!
|
|
5
|
+
|
|
6
|
+
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
7
|
+
<http://stuartk.com/jszip>
|
|
8
|
+
|
|
9
|
+
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
10
|
+
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
11
|
+
|
|
12
|
+
JSZip uses the library pako released under the MIT license :
|
|
13
|
+
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
14
|
+
*/(function(s,c){(function(e){s.exports=e()})(function(){return function e(t,r,i){function n(u,h){if(!r[u]){if(!t[u]){var v=typeof oi=="function"&&oi;if(!h&&v)return v(u,!0);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var d=r[u]={exports:{}};t[u][0].call(d.exports,function(p){var l=t[u][1][p];return n(l||p)},d,d.exports,e,t,r,i)}return r[u].exports}for(var a=typeof oi=="function"&&oi,o=0;o<i.length;o++)n(i[o]);return n}({1:[function(e,t,r){var i=e("./utils"),n=e("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(o){for(var u,h,v,f,d,p,l,m=[],x=0,g=o.length,b=g,y=i.getTypeOf(o)!=="string";x<o.length;)b=g-x,v=y?(u=o[x++],h=x<g?o[x++]:0,x<g?o[x++]:0):(u=o.charCodeAt(x++),h=x<g?o.charCodeAt(x++):0,x<g?o.charCodeAt(x++):0),f=u>>2,d=(3&u)<<4|h>>4,p=1<b?(15&h)<<2|v>>6:64,l=2<b?63&v:64,m.push(a.charAt(f)+a.charAt(d)+a.charAt(p)+a.charAt(l));return m.join("")},r.decode=function(o){var u,h,v,f,d,p,l=0,m=0,x="data:";if(o.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");var g,b=3*(o=o.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(o.charAt(o.length-1)===a.charAt(64)&&b--,o.charAt(o.length-2)===a.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(g=n.uint8array?new Uint8Array(0|b):new Array(0|b);l<o.length;)u=a.indexOf(o.charAt(l++))<<2|(f=a.indexOf(o.charAt(l++)))>>4,h=(15&f)<<4|(d=a.indexOf(o.charAt(l++)))>>2,v=(3&d)<<6|(p=a.indexOf(o.charAt(l++))),g[m++]=u,d!==64&&(g[m++]=h),p!==64&&(g[m++]=v);return g}},{"./support":30,"./utils":32}],2:[function(e,t,r){var i=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function u(h,v,f,d,p){this.compressedSize=h,this.uncompressedSize=v,this.crc32=f,this.compression=d,this.compressedContent=p}u.prototype={getContentWorker:function(){var h=new n(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),v=this;return h.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new n(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(h,v,f){return h.pipe(new a).pipe(new o("uncompressedSize")).pipe(v.compressWorker(f)).pipe(new o("compressedSize")).withStreamInfo("compression",v)},t.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){var i=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){var i=e("./utils"),n=function(){for(var a,o=[],u=0;u<256;u++){a=u;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;o[u]=a}return o}();t.exports=function(a,o){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?function(u,h,v,f){var d=n,p=f+v;u^=-1;for(var l=f;l<p;l++)u=u>>>8^d[255&(u^h[l])];return-1^u}(0|o,a,a.length,0):function(u,h,v,f){var d=n,p=f+v;u^=-1;for(var l=f;l<p;l++)u=u>>>8^d[255&(u^h.charCodeAt(l))];return-1^u}(0|o,a,a.length,0):0}},{"./utils":32}],5:[function(e,t,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){var i=null;i=typeof Promise!="undefined"?Promise:e("lie"),t.exports={Promise:i}},{lie:37}],7:[function(e,t,r){var i=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",n=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),u=i?"uint8array":"array";function h(v,f){o.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=f,this.meta={}}r.magic="\b\0",a.inherits(h,o),h.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,v.data),!1)},h.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(f){v.push({data:f,meta:v.meta})}},r.compressWorker=function(v){return new h("Deflate",v)},r.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){function i(d,p){var l,m="";for(l=0;l<p;l++)m+=String.fromCharCode(255&d),d>>>=8;return m}function n(d,p,l,m,x,g){var b,y,E=d.file,I=d.compression,C=g!==u.utf8encode,R=a.transformTo("string",g(E.name)),L=a.transformTo("string",u.utf8encode(E.name)),k=E.comment,M=a.transformTo("string",g(k)),w=a.transformTo("string",u.utf8encode(k)),N=L.length!==E.name.length,_=w.length!==k.length,V="",ee="",q="",re=E.dir,$=E.date,ie={crc32:0,compressedSize:0,uncompressedSize:0};p&&!l||(ie.crc32=d.crc32,ie.compressedSize=d.compressedSize,ie.uncompressedSize=d.uncompressedSize);var D=0;p&&(D|=8),C||!N&&!_||(D|=2048);var B=0,H=0;re&&(B|=16),x==="UNIX"?(H=798,B|=function(K,Y){var ge=K;return K||(ge=Y?16893:33204),(65535&ge)<<16}(E.unixPermissions,re)):(H=20,B|=function(K){return 63&(K||0)}(E.dosPermissions)),b=$.getUTCHours(),b<<=6,b|=$.getUTCMinutes(),b<<=5,b|=$.getUTCSeconds()/2,y=$.getUTCFullYear()-1980,y<<=4,y|=$.getUTCMonth()+1,y<<=5,y|=$.getUTCDate(),N&&(ee=i(1,1)+i(h(R),4)+L,V+="up"+i(ee.length,2)+ee),_&&(q=i(1,1)+i(h(M),4)+w,V+="uc"+i(q.length,2)+q);var F="";return F+=`
|
|
15
|
+
\0`,F+=i(D,2),F+=I.magic,F+=i(b,2),F+=i(y,2),F+=i(ie.crc32,4),F+=i(ie.compressedSize,4),F+=i(ie.uncompressedSize,4),F+=i(R.length,2),F+=i(V.length,2),{fileRecord:v.LOCAL_FILE_HEADER+F+R+V,dirRecord:v.CENTRAL_FILE_HEADER+i(H,2)+F+i(M.length,2)+"\0\0\0\0"+i(B,4)+i(m,4)+R+V+M}}var a=e("../utils"),o=e("../stream/GenericWorker"),u=e("../utf8"),h=e("../crc32"),v=e("../signature");function f(d,p,l,m){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=l,this.encodeFileName=m,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,o),f.prototype.push=function(d){var p=d.meta.percent||0,l=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,o.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:l?(p+100*(l-m-1))/l:100}}))},f.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var p=this.streamFiles&&!d.file.dir;if(p){var l=n(d,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:l.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(d){this.accumulate=!1;var p=this.streamFiles&&!d.file.dir,l=n(d,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(l.dirRecord),p)this.push({data:function(m){return v.DATA_DESCRIPTOR+i(m.crc32,4)+i(m.compressedSize,4)+i(m.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:l.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var d=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var l=this.bytesWritten-d,m=function(x,g,b,y,E){var I=a.transformTo("string",E(y));return v.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(x,2)+i(x,2)+i(g,4)+i(b,4)+i(I.length,2)+I}(this.dirRecords.length,l,d,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(d){this._sources.push(d);var p=this;return d.on("data",function(l){p.processChunk(l)}),d.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),d.on("error",function(l){p.error(l)}),this},f.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(d){var p=this._sources;if(!o.prototype.error.call(this,d))return!1;for(var l=0;l<p.length;l++)try{p[l].error(d)}catch(m){}return!0},f.prototype.lock=function(){o.prototype.lock.call(this);for(var d=this._sources,p=0;p<d.length;p++)d[p].lock()},t.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){var i=e("../compressions"),n=e("./ZipFileWorker");r.generateWorker=function(a,o,u){var h=new n(o.streamFiles,u,o.platform,o.encodeFileName),v=0;try{a.forEach(function(f,d){v++;var p=function(g,b){var y=g||b,E=i[y];if(!E)throw new Error(y+" is not a valid compression method !");return E}(d.options.compression,o.compression),l=d.options.compressionOptions||o.compressionOptions||{},m=d.dir,x=d.date;d._compressWorker(p,l).withStreamInfo("file",{name:f,dir:m,date:x,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(h)}),h.entriesCount=v}catch(f){h.error(f)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var n=new i;for(var a in this)typeof this[a]!="function"&&(n[a]=this[a]);return n}}(i.prototype=e("./object")).loadAsync=e("./load"),i.support=e("./support"),i.defaults=e("./defaults"),i.version="3.10.1",i.loadAsync=function(n,a){return new i().loadAsync(n,a)},i.external=e("./external"),t.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){var i=e("./utils"),n=e("./external"),a=e("./utf8"),o=e("./zipEntries"),u=e("./stream/Crc32Probe"),h=e("./nodejsUtils");function v(f){return new n.Promise(function(d,p){var l=f.decompressed.getContentWorker().pipe(new u);l.on("error",function(m){p(m)}).on("end",function(){l.streamInfo.crc32!==f.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}t.exports=function(f,d){var p=this;return d=i.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(f)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",f,!0,d.optimizedBinaryString,d.base64).then(function(l){var m=new o(d);return m.load(l),m}).then(function(l){var m=[n.Promise.resolve(l)],x=l.files;if(d.checkCRC32)for(var g=0;g<x.length;g++)m.push(v(x[g]));return n.Promise.all(m)}).then(function(l){for(var m=l.shift(),x=m.files,g=0;g<x.length;g++){var b=x[g],y=b.fileNameStr,E=i.resolve(b.fileNameStr);p.file(E,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:d.createFolders}),b.dir||(p.file(E).unsafeOriginalName=y)}return m.zipComment.length&&(p.comment=m.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){var i=e("../utils"),n=e("../stream/GenericWorker");function a(o,u){n.call(this,"Nodejs stream input adapter for "+o),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,n),a.prototype._bindStream=function(o){var u=this;(this._stream=o).pause(),o.on("data",function(h){u.push({data:h,meta:{percent:0}})}).on("error",function(h){u.isPaused?this.generatedError=h:u.error(h)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){var i=e("readable-stream").Readable;function n(a,o,u){i.call(this,o),this._helper=a;var h=this;a.on("data",function(v,f){h.push(v)||h._helper.pause(),u&&u(f)}).on("error",function(v){h.emit("error",v)}).on("end",function(){h.push(null)})}e("../utils").inherits(n,i),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){t.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(i,n){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,n);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,n)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var n=new Buffer(i);return n.fill(0),n},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(e,t,r){function i(E,I,C){var R,L=a.getTypeOf(I),k=a.extend(C||{},h);k.date=k.date||new Date,k.compression!==null&&(k.compression=k.compression.toUpperCase()),typeof k.unixPermissions=="string"&&(k.unixPermissions=parseInt(k.unixPermissions,8)),k.unixPermissions&&16384&k.unixPermissions&&(k.dir=!0),k.dosPermissions&&16&k.dosPermissions&&(k.dir=!0),k.dir&&(E=x(E)),k.createFolders&&(R=m(E))&&g.call(this,R,!0);var M=L==="string"&&k.binary===!1&&k.base64===!1;C&&C.binary!==void 0||(k.binary=!M),(I instanceof v&&I.uncompressedSize===0||k.dir||!I||I.length===0)&&(k.base64=!1,k.binary=!0,I="",k.compression="STORE",L="string");var w=null;w=I instanceof v||I instanceof o?I:p.isNode&&p.isStream(I)?new l(E,I):a.prepareContent(E,I,k.binary,k.optimizedBinaryString,k.base64);var N=new f(E,w,k);this.files[E]=N}var n=e("./utf8"),a=e("./utils"),o=e("./stream/GenericWorker"),u=e("./stream/StreamHelper"),h=e("./defaults"),v=e("./compressedObject"),f=e("./zipObject"),d=e("./generate"),p=e("./nodejsUtils"),l=e("./nodejs/NodejsStreamInputAdapter"),m=function(E){E.slice(-1)==="/"&&(E=E.substring(0,E.length-1));var I=E.lastIndexOf("/");return 0<I?E.substring(0,I):""},x=function(E){return E.slice(-1)!=="/"&&(E+="/"),E},g=function(E,I){return I=I!==void 0?I:h.createFolders,E=x(E),this.files[E]||i.call(this,E,null,{dir:!0,createFolders:I}),this.files[E]};function b(E){return Object.prototype.toString.call(E)==="[object RegExp]"}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(E){var I,C,R;for(I in this.files)R=this.files[I],(C=I.slice(this.root.length,I.length))&&I.slice(0,this.root.length)===this.root&&E(C,R)},filter:function(E){var I=[];return this.forEach(function(C,R){E(C,R)&&I.push(R)}),I},file:function(E,I,C){if(arguments.length!==1)return E=this.root+E,i.call(this,E,I,C),this;if(b(E)){var R=E;return this.filter(function(k,M){return!M.dir&&R.test(k)})}var L=this.files[this.root+E];return L&&!L.dir?L:null},folder:function(E){if(!E)return this;if(b(E))return this.filter(function(L,k){return k.dir&&E.test(L)});var I=this.root+E,C=g.call(this,I),R=this.clone();return R.root=C.name,R},remove:function(E){E=this.root+E;var I=this.files[E];if(I||(E.slice(-1)!=="/"&&(E+="/"),I=this.files[E]),I&&!I.dir)delete this.files[E];else for(var C=this.filter(function(L,k){return k.name.slice(0,E.length)===E}),R=0;R<C.length;R++)delete this.files[C[R].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(E){var I,C={};try{if((C=a.extend(E||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");a.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var R=C.comment||this.comment||"";I=d.generateWorker(this,C,R)}catch(L){(I=new o("error")).error(L)}return new u(I,C.type||"string",C.mimeType)},generateAsync:function(E,I){return this.generateInternalStream(E).accumulate(I)},generateNodeStream:function(E,I){return(E=E||{}).type||(E.type="nodebuffer"),this.generateInternalStream(E).toNodejsStream(I)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){var i=e("./DataReader");function n(a){i.call(this,a);for(var o=0;o<this.data.length;o++)a[o]=255&a[o]}e("../utils").inherits(n,i),n.prototype.byteAt=function(a){return this.data[this.zero+a]},n.prototype.lastIndexOfSignature=function(a){for(var o=a.charCodeAt(0),u=a.charCodeAt(1),h=a.charCodeAt(2),v=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===o&&this.data[f+1]===u&&this.data[f+2]===h&&this.data[f+3]===v)return f-this.zero;return-1},n.prototype.readAndCheckSignature=function(a){var o=a.charCodeAt(0),u=a.charCodeAt(1),h=a.charCodeAt(2),v=a.charCodeAt(3),f=this.readData(4);return o===f[0]&&u===f[1]&&h===f[2]&&v===f[3]},n.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){var i=e("../utils");function n(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var o,u=0;for(this.checkOffset(a),o=this.index+a-1;o>=this.index;o--)u=(u<<8)+this.byteAt(o);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,r){var i=e("./Uint8ArrayReader");function n(a){i.call(this,a)}e("../utils").inherits(n,i),n.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){var i=e("./DataReader");function n(a){i.call(this,a)}e("../utils").inherits(n,i),n.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},n.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},n.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},n.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){var i=e("./ArrayReader");function n(a){i.call(this,a)}e("../utils").inherits(n,i),n.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var o=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){var i=e("../utils"),n=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),u=e("./NodeBufferReader"),h=e("./Uint8ArrayReader");t.exports=function(v){var f=i.getTypeOf(v);return i.checkSupport(f),f!=="string"||n.uint8array?f==="nodebuffer"?new u(v):n.uint8array?new h(i.transformTo("uint8array",v)):new a(i.transformTo("array",v)):new o(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,r){var i=e("./GenericWorker"),n=e("../utils");function a(o){i.call(this,"ConvertWorker to "+o),this.destType=o}n.inherits(a,i),a.prototype.processChunk=function(o){this.push({data:n.transformTo(this.destType,o.data),meta:o.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){var i=e("./GenericWorker"),n=e("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,i),a.prototype.processChunk=function(o){this.streamInfo.crc32=n(o.data,this.streamInfo.crc32||0),this.push(o)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){var i=e("../utils"),n=e("./GenericWorker");function a(o){n.call(this,"DataLengthProbe for "+o),this.propName=o,this.withStreamInfo(o,0)}i.inherits(a,n),a.prototype.processChunk=function(o){if(o){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+o.data.length}n.prototype.processChunk.call(this,o)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){var i=e("../utils"),n=e("./GenericWorker");function a(o){n.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,o.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=i.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}i.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var o=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":o=this.data.substring(this.index,u);break;case"uint8array":o=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":o=this.data.slice(this.index,u)}return this.index=u,this.push({data:o,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){function i(n){this.name=n||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(n){this.emit("data",n)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(n){this.emit("error",n)}return!0},error:function(n){return!this.isFinished&&(this.isPaused?this.generatedError=n:(this.isFinished=!0,this.emit("error",n),this.previous&&this.previous.error(n),this.cleanUp()),!0)},on:function(n,a){return this._listeners[n].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(n,a){if(this._listeners[n])for(var o=0;o<this._listeners[n].length;o++)this._listeners[n][o].call(this,a)},pipe:function(n){return n.registerPrevious(this)},registerPrevious:function(n){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=n.streamInfo,this.mergeStreamInfo(),this.previous=n;var a=this;return n.on("data",function(o){a.processChunk(o)}),n.on("end",function(){a.end()}),n.on("error",function(o){a.error(o)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var n=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),n=!0),this.previous&&this.previous.resume(),!n},flush:function(){},processChunk:function(n){this.push(n)},withStreamInfo:function(n,a){return this.extraStreamInfo[n]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var n in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,n)&&(this.streamInfo[n]=this.extraStreamInfo[n])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var n="Worker "+this.name;return this.previous?this.previous+" -> "+n:n}},t.exports=i},{}],29:[function(e,t,r){var i=e("../utils"),n=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),u=e("../support"),h=e("../external"),v=null;if(u.nodestream)try{v=e("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function f(p,l){return new h.Promise(function(m,x){var g=[],b=p._internalType,y=p._outputType,E=p._mimeType;p.on("data",function(I,C){g.push(I),l&&l(C)}).on("error",function(I){g=[],x(I)}).on("end",function(){try{var I=function(C,R,L){switch(C){case"blob":return i.newBlob(i.transformTo("arraybuffer",R),L);case"base64":return o.encode(R);default:return i.transformTo(C,R)}}(y,function(C,R){var L,k=0,M=null,w=0;for(L=0;L<R.length;L++)w+=R[L].length;switch(C){case"string":return R.join("");case"array":return Array.prototype.concat.apply([],R);case"uint8array":for(M=new Uint8Array(w),L=0;L<R.length;L++)M.set(R[L],k),k+=R[L].length;return M;case"nodebuffer":return Buffer.concat(R);default:throw new Error("concat : unsupported type '"+C+"'")}}(b,g),E);m(I)}catch(C){x(C)}g=[]}).resume()})}function d(p,l,m){var x=l;switch(l){case"blob":case"arraybuffer":x="uint8array";break;case"base64":x="string"}try{this._internalType=x,this._outputType=l,this._mimeType=m,i.checkSupport(x),this._worker=p.pipe(new n(x)),p.lock()}catch(g){this._worker=new a("error"),this._worker.error(g)}}d.prototype={accumulate:function(p){return f(this,p)},on:function(p,l){var m=this;return p==="data"?this._worker.on(p,function(x){l.call(m,x.data,x.meta)}):this._worker.on(p,function(){i.delay(l,arguments,m)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new v(this,{objectMode:this._outputType!=="nodebuffer"},p)}},t.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",r.nodebuffer=typeof Buffer!="undefined",r.uint8array=typeof Uint8Array!="undefined",typeof ArrayBuffer=="undefined")r.blob=!1;else{var i=new ArrayBuffer(0);try{r.blob=new Blob([i],{type:"application/zip"}).size===0}catch(a){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(i),r.blob=n.getBlob("application/zip").size===0}catch(o){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(a){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){for(var i=e("./utils"),n=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),u=new Array(256),h=0;h<256;h++)u[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;u[254]=u[254]=1;function v(){o.call(this,"utf-8 decode"),this.leftOver=null}function f(){o.call(this,"utf-8 encode")}r.utf8encode=function(d){return n.nodebuffer?a.newBufferFrom(d,"utf-8"):function(p){var l,m,x,g,b,y=p.length,E=0;for(g=0;g<y;g++)(64512&(m=p.charCodeAt(g)))==55296&&g+1<y&&(64512&(x=p.charCodeAt(g+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),g++),E+=m<128?1:m<2048?2:m<65536?3:4;for(l=n.uint8array?new Uint8Array(E):new Array(E),g=b=0;b<E;g++)(64512&(m=p.charCodeAt(g)))==55296&&g+1<y&&(64512&(x=p.charCodeAt(g+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),g++),m<128?l[b++]=m:(m<2048?l[b++]=192|m>>>6:(m<65536?l[b++]=224|m>>>12:(l[b++]=240|m>>>18,l[b++]=128|m>>>12&63),l[b++]=128|m>>>6&63),l[b++]=128|63&m);return l}(d)},r.utf8decode=function(d){return n.nodebuffer?i.transformTo("nodebuffer",d).toString("utf-8"):function(p){var l,m,x,g,b=p.length,y=new Array(2*b);for(l=m=0;l<b;)if((x=p[l++])<128)y[m++]=x;else if(4<(g=u[x]))y[m++]=65533,l+=g-1;else{for(x&=g===2?31:g===3?15:7;1<g&&l<b;)x=x<<6|63&p[l++],g--;1<g?y[m++]=65533:x<65536?y[m++]=x:(x-=65536,y[m++]=55296|x>>10&1023,y[m++]=56320|1023&x)}return y.length!==m&&(y.subarray?y=y.subarray(0,m):y.length=m),i.applyFromCharCode(y)}(d=i.transformTo(n.uint8array?"uint8array":"array",d))},i.inherits(v,o),v.prototype.processChunk=function(d){var p=i.transformTo(n.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var l=p;(p=new Uint8Array(l.length+this.leftOver.length)).set(this.leftOver,0),p.set(l,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var m=function(g,b){var y;for((b=b||g.length)>g.length&&(b=g.length),y=b-1;0<=y&&(192&g[y])==128;)y--;return y<0||y===0?b:y+u[g[y]]>b?y:b}(p),x=p;m!==p.length&&(n.uint8array?(x=p.subarray(0,m),this.leftOver=p.subarray(m,p.length)):(x=p.slice(0,m),this.leftOver=p.slice(m,p.length))),this.push({data:r.utf8decode(x),meta:d.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=v,i.inherits(f,o),f.prototype.processChunk=function(d){this.push({data:r.utf8encode(d.data),meta:d.meta})},r.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){var i=e("./support"),n=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function u(l){return l}function h(l,m){for(var x=0;x<l.length;++x)m[x]=255&l.charCodeAt(x);return m}e("setimmediate"),r.newBlob=function(l,m){r.checkSupport("blob");try{return new Blob([l],{type:m})}catch(g){try{var x=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return x.append(l),x.getBlob(m)}catch(b){throw new Error("Bug : can't construct the Blob.")}}};var v={stringifyByChunk:function(l,m,x){var g=[],b=0,y=l.length;if(y<=x)return String.fromCharCode.apply(null,l);for(;b<y;)m==="array"||m==="nodebuffer"?g.push(String.fromCharCode.apply(null,l.slice(b,Math.min(b+x,y)))):g.push(String.fromCharCode.apply(null,l.subarray(b,Math.min(b+x,y)))),b+=x;return g.join("")},stringifyByChar:function(l){for(var m="",x=0;x<l.length;x++)m+=String.fromCharCode(l[x]);return m},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(l){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch(l){return!1}}()}};function f(l){var m=65536,x=r.getTypeOf(l),g=!0;if(x==="uint8array"?g=v.applyCanBeUsed.uint8array:x==="nodebuffer"&&(g=v.applyCanBeUsed.nodebuffer),g)for(;1<m;)try{return v.stringifyByChunk(l,x,m)}catch(b){m=Math.floor(m/2)}return v.stringifyByChar(l)}function d(l,m){for(var x=0;x<l.length;x++)m[x]=l[x];return m}r.applyFromCharCode=f;var p={};p.string={string:u,array:function(l){return h(l,new Array(l.length))},arraybuffer:function(l){return p.string.uint8array(l).buffer},uint8array:function(l){return h(l,new Uint8Array(l.length))},nodebuffer:function(l){return h(l,a.allocBuffer(l.length))}},p.array={string:f,array:u,arraybuffer:function(l){return new Uint8Array(l).buffer},uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return a.newBufferFrom(l)}},p.arraybuffer={string:function(l){return f(new Uint8Array(l))},array:function(l){return d(new Uint8Array(l),new Array(l.byteLength))},arraybuffer:u,uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return a.newBufferFrom(new Uint8Array(l))}},p.uint8array={string:f,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return l.buffer},uint8array:u,nodebuffer:function(l){return a.newBufferFrom(l)}},p.nodebuffer={string:f,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return p.nodebuffer.uint8array(l).buffer},uint8array:function(l){return d(l,new Uint8Array(l.length))},nodebuffer:u},r.transformTo=function(l,m){if(m=m||"",!l)return m;r.checkSupport(l);var x=r.getTypeOf(m);return p[x][l](m)},r.resolve=function(l){for(var m=l.split("/"),x=[],g=0;g<m.length;g++){var b=m[g];b==="."||b===""&&g!==0&&g!==m.length-1||(b===".."?x.pop():x.push(b))}return x.join("/")},r.getTypeOf=function(l){return typeof l=="string"?"string":Object.prototype.toString.call(l)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(l)?"nodebuffer":i.uint8array&&l instanceof Uint8Array?"uint8array":i.arraybuffer&&l instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(l){if(!i[l.toLowerCase()])throw new Error(l+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(l){var m,x,g="";for(x=0;x<(l||"").length;x++)g+="\\x"+((m=l.charCodeAt(x))<16?"0":"")+m.toString(16).toUpperCase();return g},r.delay=function(l,m,x){setImmediate(function(){l.apply(x||null,m||[])})},r.inherits=function(l,m){function x(){}x.prototype=m.prototype,l.prototype=new x},r.extend=function(){var l,m,x={};for(l=0;l<arguments.length;l++)for(m in arguments[l])Object.prototype.hasOwnProperty.call(arguments[l],m)&&x[m]===void 0&&(x[m]=arguments[l][m]);return x},r.prepareContent=function(l,m,x,g,b){return o.Promise.resolve(m).then(function(y){return i.blob&&(y instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(y))!==-1)&&typeof FileReader!="undefined"?new o.Promise(function(E,I){var C=new FileReader;C.onload=function(R){E(R.target.result)},C.onerror=function(R){I(R.target.error)},C.readAsArrayBuffer(y)}):y}).then(function(y){var E=r.getTypeOf(y);return E?(E==="arraybuffer"?y=r.transformTo("uint8array",y):E==="string"&&(b?y=n.decode(y):x&&g!==!0&&(y=function(I){return h(I,i.uint8array?new Uint8Array(I.length):new Array(I.length))}(y))),y):o.Promise.reject(new Error("Can't read the data of '"+l+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){var i=e("./reader/readerFor"),n=e("./utils"),a=e("./signature"),o=e("./zipEntry"),u=e("./support");function h(v){this.files=[],this.loadOptions=v}h.prototype={checkSignature:function(v){if(!this.reader.readAndCheckSignature(v)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(f)+", expected "+n.pretty(v)+")")}},isSignature:function(v,f){var d=this.reader.index;this.reader.setIndex(v);var p=this.reader.readString(4)===f;return this.reader.setIndex(d),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var v=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",d=n.transformTo(f,v);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var v,f,d,p=this.zip64EndOfCentralSize-44;0<p;)v=this.reader.readInt(2),f=this.reader.readInt(4),d=this.reader.readData(f),this.zip64ExtensibleData[v]={id:v,length:f,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var v,f;for(v=0;v<this.files.length;v++)f=this.files[v],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var v;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(v=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(v);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var v=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(v<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(v);var f=v;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(v=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(v),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var p=f-d;if(0<p)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(v){this.reader=i(v)},load:function(v){this.prepareReader(v),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){var i=e("./reader/readerFor"),n=e("./utils"),a=e("./compressedObject"),o=e("./crc32"),u=e("./utf8"),h=e("./compressions"),v=e("./support");function f(d,p){this.options=d,this.loadOptions=p}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var p,l;if(d.skip(22),this.fileNameLength=d.readInt(2),l=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(l),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=function(m){for(var x in h)if(Object.prototype.hasOwnProperty.call(h,x)&&h[x].magic===m)return h[x];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var p=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(p),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=i(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var p,l,m,x=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<x;)p=d.readInt(2),l=d.readInt(2),m=d.readData(l),this.extraFields[p]={id:p,length:l,value:m};d.setIndex(x)},handleUTF8:function(){var d=v.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var l=n.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(l)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var x=n.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(x)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var p=i(d.value);return p.readInt(1)!==1||o(this.fileName)!==p.readInt(4)?null:u.utf8decode(p.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var p=i(d.value);return p.readInt(1)!==1||o(this.fileComment)!==p.readInt(4)?null:u.utf8decode(p.readData(d.length-5))}return null}},t.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){function i(p,l,m){this.name=p,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=l,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var n=e("./stream/StreamHelper"),a=e("./stream/DataWorker"),o=e("./utf8"),u=e("./compressedObject"),h=e("./stream/GenericWorker");i.prototype={internalStream:function(p){var l=null,m="string";try{if(!p)throw new Error("No output type specified.");var x=(m=p.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),l=this._decompressWorker();var g=!this._dataBinary;g&&!x&&(l=l.pipe(new o.Utf8EncodeWorker)),!g&&x&&(l=l.pipe(new o.Utf8DecodeWorker))}catch(b){(l=new h("error")).error(b)}return new n(l,m,"")},async:function(p,l){return this.internalStream(p).accumulate(l)},nodeStream:function(p,l){return this.internalStream(p||"nodebuffer").toNodejsStream(l)},_compressWorker:function(p,l){if(this._data instanceof u&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new o.Utf8EncodeWorker)),u.createWorkerFrom(m,p,l)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof h?this._data:new a(this._data)}};for(var v=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<v.length;d++)i.prototype[v[d]]=f;t.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,r){(function(i){var n,a,o=i.MutationObserver||i.WebKitMutationObserver;if(o){var u=0,h=new o(p),v=i.document.createTextNode("");h.observe(v,{characterData:!0}),n=function(){v.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)n="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var l=i.document.createElement("script");l.onreadystatechange=function(){p(),l.onreadystatechange=null,l.parentNode.removeChild(l),l=null},i.document.documentElement.appendChild(l)}:function(){setTimeout(p,0)};else{var f=new i.MessageChannel;f.port1.onmessage=p,n=function(){f.port2.postMessage(0)}}var d=[];function p(){var l,m;a=!0;for(var x=d.length;x;){for(m=d,d=[],l=-1;++l<x;)m[l]();x=d.length}a=!1}t.exports=function(l){d.push(l)!==1||a||n()}}).call(this,typeof _e!="undefined"?_e:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(e,t,r){var i=e("immediate");function n(){}var a={},o=["REJECTED"],u=["FULFILLED"],h=["PENDING"];function v(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,x!==n&&l(this,x)}function f(x,g,b){this.promise=x,typeof g=="function"&&(this.onFulfilled=g,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function d(x,g,b){i(function(){var y;try{y=g(b)}catch(E){return a.reject(x,E)}y===x?a.reject(x,new TypeError("Cannot resolve promise with itself")):a.resolve(x,y)})}function p(x){var g=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof g=="function")return function(){g.apply(x,arguments)}}function l(x,g){var b=!1;function y(C){b||(b=!0,a.reject(x,C))}function E(C){b||(b=!0,a.resolve(x,C))}var I=m(function(){g(E,y)});I.status==="error"&&y(I.value)}function m(x,g){var b={};try{b.value=x(g),b.status="success"}catch(y){b.status="error",b.value=y}return b}(t.exports=v).prototype.finally=function(x){if(typeof x!="function")return this;var g=this.constructor;return this.then(function(b){return g.resolve(x()).then(function(){return b})},function(b){return g.resolve(x()).then(function(){throw b})})},v.prototype.catch=function(x){return this.then(null,x)},v.prototype.then=function(x,g){if(typeof x!="function"&&this.state===u||typeof g!="function"&&this.state===o)return this;var b=new this.constructor(n);return this.state!==h?d(b,this.state===u?x:g,this.outcome):this.queue.push(new f(b,x,g)),b},f.prototype.callFulfilled=function(x){a.resolve(this.promise,x)},f.prototype.otherCallFulfilled=function(x){d(this.promise,this.onFulfilled,x)},f.prototype.callRejected=function(x){a.reject(this.promise,x)},f.prototype.otherCallRejected=function(x){d(this.promise,this.onRejected,x)},a.resolve=function(x,g){var b=m(p,g);if(b.status==="error")return a.reject(x,b.value);var y=b.value;if(y)l(x,y);else{x.state=u,x.outcome=g;for(var E=-1,I=x.queue.length;++E<I;)x.queue[E].callFulfilled(g)}return x},a.reject=function(x,g){x.state=o,x.outcome=g;for(var b=-1,y=x.queue.length;++b<y;)x.queue[b].callRejected(g);return x},v.resolve=function(x){return x instanceof this?x:a.resolve(new this(n),x)},v.reject=function(x){var g=new this(n);return a.reject(g,x)},v.all=function(x){var g=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=x.length,y=!1;if(!b)return this.resolve([]);for(var E=new Array(b),I=0,C=-1,R=new this(n);++C<b;)L(x[C],C);return R;function L(k,M){g.resolve(k).then(function(w){E[M]=w,++I!==b||y||(y=!0,a.resolve(R,E))},function(w){y||(y=!0,a.reject(R,w))})}},v.race=function(x){var g=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=x.length,y=!1;if(!b)return this.resolve([]);for(var E=-1,I=new this(n);++E<b;)C=x[E],g.resolve(C).then(function(R){y||(y=!0,a.resolve(I,R))},function(R){y||(y=!0,a.reject(I,R))});var C;return I}},{immediate:36}],38:[function(e,t,r){var i={};(0,e("./lib/utils/common").assign)(i,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){var i=e("./zlib/deflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/messages"),u=e("./zlib/zstream"),h=Object.prototype.toString,v=0,f=-1,d=0,p=8;function l(x){if(!(this instanceof l))return new l(x);this.options=n.assign({level:f,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},x||{});var g=this.options;g.raw&&0<g.windowBits?g.windowBits=-g.windowBits:g.gzip&&0<g.windowBits&&g.windowBits<16&&(g.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=i.deflateInit2(this.strm,g.level,g.method,g.windowBits,g.memLevel,g.strategy);if(b!==v)throw new Error(o[b]);if(g.header&&i.deflateSetHeader(this.strm,g.header),g.dictionary){var y;if(y=typeof g.dictionary=="string"?a.string2buf(g.dictionary):h.call(g.dictionary)==="[object ArrayBuffer]"?new Uint8Array(g.dictionary):g.dictionary,(b=i.deflateSetDictionary(this.strm,y))!==v)throw new Error(o[b]);this._dict_set=!0}}function m(x,g){var b=new l(g);if(b.push(x,!0),b.err)throw b.msg||o[b.err];return b.result}l.prototype.push=function(x,g){var b,y,E=this.strm,I=this.options.chunkSize;if(this.ended)return!1;y=g===~~g?g:g===!0?4:0,typeof x=="string"?E.input=a.string2buf(x):h.call(x)==="[object ArrayBuffer]"?E.input=new Uint8Array(x):E.input=x,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new n.Buf8(I),E.next_out=0,E.avail_out=I),(b=i.deflate(E,y))!==1&&b!==v)return this.onEnd(b),!(this.ended=!0);E.avail_out!==0&&(E.avail_in!==0||y!==4&&y!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(n.shrinkBuf(E.output,E.next_out))):this.onData(n.shrinkBuf(E.output,E.next_out)))}while((0<E.avail_in||E.avail_out===0)&&b!==1);return y===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===v):y!==2||(this.onEnd(v),!(E.avail_out=0))},l.prototype.onData=function(x){this.chunks.push(x)},l.prototype.onEnd=function(x){x===v&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=x,this.msg=this.strm.msg},r.Deflate=l,r.deflate=m,r.deflateRaw=function(x,g){return(g=g||{}).raw=!0,m(x,g)},r.gzip=function(x,g){return(g=g||{}).gzip=!0,m(x,g)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){var i=e("./zlib/inflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/constants"),u=e("./zlib/messages"),h=e("./zlib/zstream"),v=e("./zlib/gzheader"),f=Object.prototype.toString;function d(l){if(!(this instanceof d))return new d(l);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},l||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||l&&l.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&!(15&m.windowBits)&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var x=i.inflateInit2(this.strm,m.windowBits);if(x!==o.Z_OK)throw new Error(u[x]);this.header=new v,i.inflateGetHeader(this.strm,this.header)}function p(l,m){var x=new d(m);if(x.push(l,!0),x.err)throw x.msg||u[x.err];return x.result}d.prototype.push=function(l,m){var x,g,b,y,E,I,C=this.strm,R=this.options.chunkSize,L=this.options.dictionary,k=!1;if(this.ended)return!1;g=m===~~m?m:m===!0?o.Z_FINISH:o.Z_NO_FLUSH,typeof l=="string"?C.input=a.binstring2buf(l):f.call(l)==="[object ArrayBuffer]"?C.input=new Uint8Array(l):C.input=l,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new n.Buf8(R),C.next_out=0,C.avail_out=R),(x=i.inflate(C,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&L&&(I=typeof L=="string"?a.string2buf(L):f.call(L)==="[object ArrayBuffer]"?new Uint8Array(L):L,x=i.inflateSetDictionary(this.strm,I)),x===o.Z_BUF_ERROR&&k===!0&&(x=o.Z_OK,k=!1),x!==o.Z_STREAM_END&&x!==o.Z_OK)return this.onEnd(x),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&x!==o.Z_STREAM_END&&(C.avail_in!==0||g!==o.Z_FINISH&&g!==o.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=a.utf8border(C.output,C.next_out),y=C.next_out-b,E=a.buf2string(C.output,b),C.next_out=y,C.avail_out=R-y,y&&n.arraySet(C.output,C.output,b,y,0),this.onData(E)):this.onData(n.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(k=!0)}while((0<C.avail_in||C.avail_out===0)&&x!==o.Z_STREAM_END);return x===o.Z_STREAM_END&&(g=o.Z_FINISH),g===o.Z_FINISH?(x=i.inflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===o.Z_OK):g!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(C.avail_out=0))},d.prototype.onData=function(l){this.chunks.push(l)},d.prototype.onEnd=function(l){l===o.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=l,this.msg=this.strm.msg},r.Inflate=d,r.inflate=p,r.inflateRaw=function(l,m){return(m=m||{}).raw=!0,p(l,m)},r.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){var i=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";r.assign=function(o){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var h=u.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var v in h)h.hasOwnProperty(v)&&(o[v]=h[v])}}return o},r.shrinkBuf=function(o,u){return o.length===u?o:o.subarray?o.subarray(0,u):(o.length=u,o)};var n={arraySet:function(o,u,h,v,f){if(u.subarray&&o.subarray)o.set(u.subarray(h,h+v),f);else for(var d=0;d<v;d++)o[f+d]=u[h+d]},flattenChunks:function(o){var u,h,v,f,d,p;for(u=v=0,h=o.length;u<h;u++)v+=o[u].length;for(p=new Uint8Array(v),u=f=0,h=o.length;u<h;u++)d=o[u],p.set(d,f),f+=d.length;return p}},a={arraySet:function(o,u,h,v,f){for(var d=0;d<v;d++)o[f+d]=u[h+d]},flattenChunks:function(o){return[].concat.apply([],o)}};r.setTyped=function(o){o?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,n)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,a))},r.setTyped(i)},{}],42:[function(e,t,r){var i=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(v){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(v){a=!1}for(var o=new i.Buf8(256),u=0;u<256;u++)o[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function h(v,f){if(f<65537&&(v.subarray&&a||!v.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(v,f));for(var d="",p=0;p<f;p++)d+=String.fromCharCode(v[p]);return d}o[254]=o[254]=1,r.string2buf=function(v){var f,d,p,l,m,x=v.length,g=0;for(l=0;l<x;l++)(64512&(d=v.charCodeAt(l)))==55296&&l+1<x&&(64512&(p=v.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),l++),g+=d<128?1:d<2048?2:d<65536?3:4;for(f=new i.Buf8(g),l=m=0;m<g;l++)(64512&(d=v.charCodeAt(l)))==55296&&l+1<x&&(64512&(p=v.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),l++),d<128?f[m++]=d:(d<2048?f[m++]=192|d>>>6:(d<65536?f[m++]=224|d>>>12:(f[m++]=240|d>>>18,f[m++]=128|d>>>12&63),f[m++]=128|d>>>6&63),f[m++]=128|63&d);return f},r.buf2binstring=function(v){return h(v,v.length)},r.binstring2buf=function(v){for(var f=new i.Buf8(v.length),d=0,p=f.length;d<p;d++)f[d]=v.charCodeAt(d);return f},r.buf2string=function(v,f){var d,p,l,m,x=f||v.length,g=new Array(2*x);for(d=p=0;d<x;)if((l=v[d++])<128)g[p++]=l;else if(4<(m=o[l]))g[p++]=65533,d+=m-1;else{for(l&=m===2?31:m===3?15:7;1<m&&d<x;)l=l<<6|63&v[d++],m--;1<m?g[p++]=65533:l<65536?g[p++]=l:(l-=65536,g[p++]=55296|l>>10&1023,g[p++]=56320|1023&l)}return h(g,p)},r.utf8border=function(v,f){var d;for((f=f||v.length)>v.length&&(f=v.length),d=f-1;0<=d&&(192&v[d])==128;)d--;return d<0||d===0?f:d+o[v[d]]>f?d:f}},{"./common":41}],43:[function(e,t,r){t.exports=function(i,n,a,o){for(var u=65535&i|0,h=i>>>16&65535|0,v=0;a!==0;){for(a-=v=2e3<a?2e3:a;h=h+(u=u+n[o++]|0)|0,--v;);u%=65521,h%=65521}return u|h<<16|0}},{}],44:[function(e,t,r){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){var i=function(){for(var n,a=[],o=0;o<256;o++){n=o;for(var u=0;u<8;u++)n=1&n?3988292384^n>>>1:n>>>1;a[o]=n}return a}();t.exports=function(n,a,o,u){var h=i,v=u+o;n^=-1;for(var f=u;f<v;f++)n=n>>>8^h[255&(n^a[f])];return-1^n}},{}],46:[function(e,t,r){var i,n=e("../utils/common"),a=e("./trees"),o=e("./adler32"),u=e("./crc32"),h=e("./messages"),v=0,f=4,d=0,p=-2,l=-1,m=4,x=2,g=8,b=9,y=286,E=30,I=19,C=2*y+1,R=15,L=3,k=258,M=k+L+1,w=42,N=113,_=1,V=2,ee=3,q=4;function re(S,G){return S.msg=h[G],G}function $(S){return(S<<1)-(4<S?9:0)}function ie(S){for(var G=S.length;0<=--G;)S[G]=0}function D(S){var G=S.state,W=G.pending;W>S.avail_out&&(W=S.avail_out),W!==0&&(n.arraySet(S.output,G.pending_buf,G.pending_out,W,S.next_out),S.next_out+=W,G.pending_out+=W,S.total_out+=W,S.avail_out-=W,G.pending-=W,G.pending===0&&(G.pending_out=0))}function B(S,G){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,G),S.block_start=S.strstart,D(S.strm)}function H(S,G){S.pending_buf[S.pending++]=G}function F(S,G){S.pending_buf[S.pending++]=G>>>8&255,S.pending_buf[S.pending++]=255&G}function K(S,G){var W,P,T=S.max_chain_length,O=S.strstart,X=S.prev_length,J=S.nice_match,U=S.strstart>S.w_size-M?S.strstart-(S.w_size-M):0,Q=S.window,ue=S.w_mask,te=S.prev,pe=S.strstart+k,we=Q[O+X-1],ye=Q[O+X];S.prev_length>=S.good_match&&(T>>=2),J>S.lookahead&&(J=S.lookahead);do if(Q[(W=G)+X]===ye&&Q[W+X-1]===we&&Q[W]===Q[O]&&Q[++W]===Q[O+1]){O+=2,W++;do;while(Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&Q[++O]===Q[++W]&&O<pe);if(P=k-(pe-O),O=pe-k,X<P){if(S.match_start=G,J<=(X=P))break;we=Q[O+X-1],ye=Q[O+X]}}while((G=te[G&ue])>U&&--T!=0);return X<=S.lookahead?X:S.lookahead}function Y(S){var G,W,P,T,O,X,J,U,Q,ue,te=S.w_size;do{if(T=S.window_size-S.lookahead-S.strstart,S.strstart>=te+(te-M)){for(n.arraySet(S.window,S.window,te,te,0),S.match_start-=te,S.strstart-=te,S.block_start-=te,G=W=S.hash_size;P=S.head[--G],S.head[G]=te<=P?P-te:0,--W;);for(G=W=te;P=S.prev[--G],S.prev[G]=te<=P?P-te:0,--W;);T+=te}if(S.strm.avail_in===0)break;if(X=S.strm,J=S.window,U=S.strstart+S.lookahead,Q=T,ue=void 0,ue=X.avail_in,Q<ue&&(ue=Q),W=ue===0?0:(X.avail_in-=ue,n.arraySet(J,X.input,X.next_in,ue,U),X.state.wrap===1?X.adler=o(X.adler,J,ue,U):X.state.wrap===2&&(X.adler=u(X.adler,J,ue,U)),X.next_in+=ue,X.total_in+=ue,ue),S.lookahead+=W,S.lookahead+S.insert>=L)for(O=S.strstart-S.insert,S.ins_h=S.window[O],S.ins_h=(S.ins_h<<S.hash_shift^S.window[O+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[O+L-1])&S.hash_mask,S.prev[O&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=O,O++,S.insert--,!(S.lookahead+S.insert<L)););}while(S.lookahead<M&&S.strm.avail_in!==0)}function ge(S,G){for(var W,P;;){if(S.lookahead<M){if(Y(S),S.lookahead<M&&G===v)return _;if(S.lookahead===0)break}if(W=0,S.lookahead>=L&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),W!==0&&S.strstart-W<=S.w_size-M&&(S.match_length=K(S,W)),S.match_length>=L)if(P=a._tr_tally(S,S.strstart-S.match_start,S.match_length-L),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=L){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else P=a._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(P&&(B(S,!1),S.strm.avail_out===0))return _}return S.insert=S.strstart<L-1?S.strstart:L-1,G===f?(B(S,!0),S.strm.avail_out===0?ee:q):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?_:V}function se(S,G){for(var W,P,T;;){if(S.lookahead<M){if(Y(S),S.lookahead<M&&G===v)return _;if(S.lookahead===0)break}if(W=0,S.lookahead>=L&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),S.prev_length=S.match_length,S.prev_match=S.match_start,S.match_length=L-1,W!==0&&S.prev_length<S.max_lazy_match&&S.strstart-W<=S.w_size-M&&(S.match_length=K(S,W),S.match_length<=5&&(S.strategy===1||S.match_length===L&&4096<S.strstart-S.match_start)&&(S.match_length=L-1)),S.prev_length>=L&&S.match_length<=S.prev_length){for(T=S.strstart+S.lookahead-L,P=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-L),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=T&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=L-1,S.strstart++,P&&(B(S,!1),S.strm.avail_out===0))return _}else if(S.match_available){if((P=a._tr_tally(S,0,S.window[S.strstart-1]))&&B(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return _}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(P=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<L-1?S.strstart:L-1,G===f?(B(S,!0),S.strm.avail_out===0?ee:q):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?_:V}function xe(S,G,W,P,T){this.good_length=S,this.max_lazy=G,this.nice_length=W,this.max_chain=P,this.func=T}function Re(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(2*C),this.dyn_dtree=new n.Buf16(2*(2*E+1)),this.bl_tree=new n.Buf16(2*(2*I+1)),ie(this.dyn_ltree),ie(this.dyn_dtree),ie(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(R+1),this.heap=new n.Buf16(2*y+1),ie(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*y+1),ie(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ce(S){var G;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=x,(G=S.state).pending=0,G.pending_out=0,G.wrap<0&&(G.wrap=-G.wrap),G.status=G.wrap?w:N,S.adler=G.wrap===2?0:1,G.last_flush=v,a._tr_init(G),d):re(S,p)}function Me(S){var G=Ce(S);return G===d&&function(W){W.window_size=2*W.w_size,ie(W.head),W.max_lazy_match=i[W.level].max_lazy,W.good_match=i[W.level].good_length,W.nice_match=i[W.level].nice_length,W.max_chain_length=i[W.level].max_chain,W.strstart=0,W.block_start=0,W.lookahead=0,W.insert=0,W.match_length=W.prev_length=L-1,W.match_available=0,W.ins_h=0}(S.state),G}function ke(S,G,W,P,T,O){if(!S)return p;var X=1;if(G===l&&(G=6),P<0?(X=0,P=-P):15<P&&(X=2,P-=16),T<1||b<T||W!==g||P<8||15<P||G<0||9<G||O<0||m<O)return re(S,p);P===8&&(P=9);var J=new Re;return(S.state=J).strm=S,J.wrap=X,J.gzhead=null,J.w_bits=P,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=T+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+L-1)/L),J.window=new n.Buf8(2*J.w_size),J.head=new n.Buf16(J.hash_size),J.prev=new n.Buf16(J.w_size),J.lit_bufsize=1<<T+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new n.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=G,J.strategy=O,J.method=W,Me(S)}i=[new xe(0,0,0,0,function(S,G){var W=65535;for(W>S.pending_buf_size-5&&(W=S.pending_buf_size-5);;){if(S.lookahead<=1){if(Y(S),S.lookahead===0&&G===v)return _;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var P=S.block_start+W;if((S.strstart===0||S.strstart>=P)&&(S.lookahead=S.strstart-P,S.strstart=P,B(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-M&&(B(S,!1),S.strm.avail_out===0))return _}return S.insert=0,G===f?(B(S,!0),S.strm.avail_out===0?ee:q):(S.strstart>S.block_start&&(B(S,!1),S.strm.avail_out),_)}),new xe(4,4,8,4,ge),new xe(4,5,16,8,ge),new xe(4,6,32,32,ge),new xe(4,4,16,16,se),new xe(8,16,32,32,se),new xe(8,16,128,128,se),new xe(8,32,128,256,se),new xe(32,128,258,1024,se),new xe(32,258,258,4096,se)],r.deflateInit=function(S,G){return ke(S,G,g,15,8,0)},r.deflateInit2=ke,r.deflateReset=Me,r.deflateResetKeep=Ce,r.deflateSetHeader=function(S,G){return S&&S.state?S.state.wrap!==2?p:(S.state.gzhead=G,d):p},r.deflate=function(S,G){var W,P,T,O;if(!S||!S.state||5<G||G<0)return S?re(S,p):p;if(P=S.state,!S.output||!S.input&&S.avail_in!==0||P.status===666&&G!==f)return re(S,S.avail_out===0?-5:p);if(P.strm=S,W=P.last_flush,P.last_flush=G,P.status===w)if(P.wrap===2)S.adler=0,H(P,31),H(P,139),H(P,8),P.gzhead?(H(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),H(P,255&P.gzhead.time),H(P,P.gzhead.time>>8&255),H(P,P.gzhead.time>>16&255),H(P,P.gzhead.time>>24&255),H(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),H(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(H(P,255&P.gzhead.extra.length),H(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(S.adler=u(S.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(H(P,0),H(P,0),H(P,0),H(P,0),H(P,0),H(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),H(P,3),P.status=N);else{var X=g+(P.w_bits-8<<4)<<8;X|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(X|=32),X+=31-X%31,P.status=N,F(P,X),P.strstart!==0&&(F(P,S.adler>>>16),F(P,65535&S.adler)),S.adler=1}if(P.status===69)if(P.gzhead.extra){for(T=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),D(S),T=P.pending,P.pending!==P.pending_buf_size));)H(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){T=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),D(S),T=P.pending,P.pending===P.pending_buf_size)){O=1;break}O=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,H(P,O)}while(O!==0);P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),O===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){T=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),D(S),T=P.pending,P.pending===P.pending_buf_size)){O=1;break}O=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,H(P,O)}while(O!==0);P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),O===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&D(S),P.pending+2<=P.pending_buf_size&&(H(P,255&S.adler),H(P,S.adler>>8&255),S.adler=0,P.status=N)):P.status=N),P.pending!==0){if(D(S),S.avail_out===0)return P.last_flush=-1,d}else if(S.avail_in===0&&$(G)<=$(W)&&G!==f)return re(S,-5);if(P.status===666&&S.avail_in!==0)return re(S,-5);if(S.avail_in!==0||P.lookahead!==0||G!==v&&P.status!==666){var J=P.strategy===2?function(U,Q){for(var ue;;){if(U.lookahead===0&&(Y(U),U.lookahead===0)){if(Q===v)return _;break}if(U.match_length=0,ue=a._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++,ue&&(B(U,!1),U.strm.avail_out===0))return _}return U.insert=0,Q===f?(B(U,!0),U.strm.avail_out===0?ee:q):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?_:V}(P,G):P.strategy===3?function(U,Q){for(var ue,te,pe,we,ye=U.window;;){if(U.lookahead<=k){if(Y(U),U.lookahead<=k&&Q===v)return _;if(U.lookahead===0)break}if(U.match_length=0,U.lookahead>=L&&0<U.strstart&&(te=ye[pe=U.strstart-1])===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]){we=U.strstart+k;do;while(te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&te===ye[++pe]&&pe<we);U.match_length=k-(we-pe),U.match_length>U.lookahead&&(U.match_length=U.lookahead)}if(U.match_length>=L?(ue=a._tr_tally(U,1,U.match_length-L),U.lookahead-=U.match_length,U.strstart+=U.match_length,U.match_length=0):(ue=a._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++),ue&&(B(U,!1),U.strm.avail_out===0))return _}return U.insert=0,Q===f?(B(U,!0),U.strm.avail_out===0?ee:q):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?_:V}(P,G):i[P.level].func(P,G);if(J!==ee&&J!==q||(P.status=666),J===_||J===ee)return S.avail_out===0&&(P.last_flush=-1),d;if(J===V&&(G===1?a._tr_align(P):G!==5&&(a._tr_stored_block(P,0,0,!1),G===3&&(ie(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),D(S),S.avail_out===0))return P.last_flush=-1,d}return G!==f?d:P.wrap<=0?1:(P.wrap===2?(H(P,255&S.adler),H(P,S.adler>>8&255),H(P,S.adler>>16&255),H(P,S.adler>>24&255),H(P,255&S.total_in),H(P,S.total_in>>8&255),H(P,S.total_in>>16&255),H(P,S.total_in>>24&255)):(F(P,S.adler>>>16),F(P,65535&S.adler)),D(S),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?d:1)},r.deflateEnd=function(S){var G;return S&&S.state?(G=S.state.status)!==w&&G!==69&&G!==73&&G!==91&&G!==103&&G!==N&&G!==666?re(S,p):(S.state=null,G===N?re(S,-3):d):p},r.deflateSetDictionary=function(S,G){var W,P,T,O,X,J,U,Q,ue=G.length;if(!S||!S.state||(O=(W=S.state).wrap)===2||O===1&&W.status!==w||W.lookahead)return p;for(O===1&&(S.adler=o(S.adler,G,ue,0)),W.wrap=0,ue>=W.w_size&&(O===0&&(ie(W.head),W.strstart=0,W.block_start=0,W.insert=0),Q=new n.Buf8(W.w_size),n.arraySet(Q,G,ue-W.w_size,W.w_size,0),G=Q,ue=W.w_size),X=S.avail_in,J=S.next_in,U=S.input,S.avail_in=ue,S.next_in=0,S.input=G,Y(W);W.lookahead>=L;){for(P=W.strstart,T=W.lookahead-(L-1);W.ins_h=(W.ins_h<<W.hash_shift^W.window[P+L-1])&W.hash_mask,W.prev[P&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=P,P++,--T;);W.strstart=P,W.lookahead=L-1,Y(W)}return W.strstart+=W.lookahead,W.block_start=W.strstart,W.insert=W.lookahead,W.lookahead=0,W.match_length=W.prev_length=L-1,W.match_available=0,S.next_in=J,S.input=U,S.avail_in=X,W.wrap=O,d},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){t.exports=function(i,n){var a,o,u,h,v,f,d,p,l,m,x,g,b,y,E,I,C,R,L,k,M,w,N,_,V;a=i.state,o=i.next_in,_=i.input,u=o+(i.avail_in-5),h=i.next_out,V=i.output,v=h-(n-i.avail_out),f=h+(i.avail_out-257),d=a.dmax,p=a.wsize,l=a.whave,m=a.wnext,x=a.window,g=a.hold,b=a.bits,y=a.lencode,E=a.distcode,I=(1<<a.lenbits)-1,C=(1<<a.distbits)-1;e:do{b<15&&(g+=_[o++]<<b,b+=8,g+=_[o++]<<b,b+=8),R=y[g&I];t:for(;;){if(g>>>=L=R>>>24,b-=L,(L=R>>>16&255)===0)V[h++]=65535&R;else{if(!(16&L)){if(!(64&L)){R=y[(65535&R)+(g&(1<<L)-1)];continue t}if(32&L){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}k=65535&R,(L&=15)&&(b<L&&(g+=_[o++]<<b,b+=8),k+=g&(1<<L)-1,g>>>=L,b-=L),b<15&&(g+=_[o++]<<b,b+=8,g+=_[o++]<<b,b+=8),R=E[g&C];i:for(;;){if(g>>>=L=R>>>24,b-=L,!(16&(L=R>>>16&255))){if(!(64&L)){R=E[(65535&R)+(g&(1<<L)-1)];continue i}i.msg="invalid distance code",a.mode=30;break e}if(M=65535&R,b<(L&=15)&&(g+=_[o++]<<b,(b+=8)<L&&(g+=_[o++]<<b,b+=8)),d<(M+=g&(1<<L)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(g>>>=L,b-=L,(L=h-v)<M){if(l<(L=M-L)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(N=x,(w=0)===m){if(w+=p-L,L<k){for(k-=L;V[h++]=x[w++],--L;);w=h-M,N=V}}else if(m<L){if(w+=p+m-L,(L-=m)<k){for(k-=L;V[h++]=x[w++],--L;);if(w=0,m<k){for(k-=L=m;V[h++]=x[w++],--L;);w=h-M,N=V}}}else if(w+=m-L,L<k){for(k-=L;V[h++]=x[w++],--L;);w=h-M,N=V}for(;2<k;)V[h++]=N[w++],V[h++]=N[w++],V[h++]=N[w++],k-=3;k&&(V[h++]=N[w++],1<k&&(V[h++]=N[w++]))}else{for(w=h-M;V[h++]=V[w++],V[h++]=V[w++],V[h++]=V[w++],2<(k-=3););k&&(V[h++]=V[w++],1<k&&(V[h++]=V[w++]))}break}}break}}while(o<u&&h<f);o-=k=b>>3,g&=(1<<(b-=k<<3))-1,i.next_in=o,i.next_out=h,i.avail_in=o<u?u-o+5:5-(o-u),i.avail_out=h<f?f-h+257:257-(h-f),a.hold=g,a.bits=b}},{}],49:[function(e,t,r){var i=e("../utils/common"),n=e("./adler32"),a=e("./crc32"),o=e("./inffast"),u=e("./inftrees"),h=1,v=2,f=0,d=-2,p=1,l=852,m=592;function x(w){return(w>>>24&255)+(w>>>8&65280)+((65280&w)<<8)+((255&w)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(w){var N;return w&&w.state?(N=w.state,w.total_in=w.total_out=N.total=0,w.msg="",N.wrap&&(w.adler=1&N.wrap),N.mode=p,N.last=0,N.havedict=0,N.dmax=32768,N.head=null,N.hold=0,N.bits=0,N.lencode=N.lendyn=new i.Buf32(l),N.distcode=N.distdyn=new i.Buf32(m),N.sane=1,N.back=-1,f):d}function y(w){var N;return w&&w.state?((N=w.state).wsize=0,N.whave=0,N.wnext=0,b(w)):d}function E(w,N){var _,V;return w&&w.state?(V=w.state,N<0?(_=0,N=-N):(_=1+(N>>4),N<48&&(N&=15)),N&&(N<8||15<N)?d:(V.window!==null&&V.wbits!==N&&(V.window=null),V.wrap=_,V.wbits=N,y(w))):d}function I(w,N){var _,V;return w?(V=new g,(w.state=V).window=null,(_=E(w,N))!==f&&(w.state=null),_):d}var C,R,L=!0;function k(w){if(L){var N;for(C=new i.Buf32(512),R=new i.Buf32(32),N=0;N<144;)w.lens[N++]=8;for(;N<256;)w.lens[N++]=9;for(;N<280;)w.lens[N++]=7;for(;N<288;)w.lens[N++]=8;for(u(h,w.lens,0,288,C,0,w.work,{bits:9}),N=0;N<32;)w.lens[N++]=5;u(v,w.lens,0,32,R,0,w.work,{bits:5}),L=!1}w.lencode=C,w.lenbits=9,w.distcode=R,w.distbits=5}function M(w,N,_,V){var ee,q=w.state;return q.window===null&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new i.Buf8(q.wsize)),V>=q.wsize?(i.arraySet(q.window,N,_-q.wsize,q.wsize,0),q.wnext=0,q.whave=q.wsize):(V<(ee=q.wsize-q.wnext)&&(ee=V),i.arraySet(q.window,N,_-V,ee,q.wnext),(V-=ee)?(i.arraySet(q.window,N,_-V,V,0),q.wnext=V,q.whave=q.wsize):(q.wnext+=ee,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=ee))),0}r.inflateReset=y,r.inflateReset2=E,r.inflateResetKeep=b,r.inflateInit=function(w){return I(w,15)},r.inflateInit2=I,r.inflate=function(w,N){var _,V,ee,q,re,$,ie,D,B,H,F,K,Y,ge,se,xe,Re,Ce,Me,ke,S,G,W,P,T=0,O=new i.Buf8(4),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!w||!w.state||!w.output||!w.input&&w.avail_in!==0)return d;(_=w.state).mode===12&&(_.mode=13),re=w.next_out,ee=w.output,ie=w.avail_out,q=w.next_in,V=w.input,$=w.avail_in,D=_.hold,B=_.bits,H=$,F=ie,G=f;e:for(;;)switch(_.mode){case p:if(_.wrap===0){_.mode=13;break}for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(2&_.wrap&&D===35615){O[_.check=0]=255&D,O[1]=D>>>8&255,_.check=a(_.check,O,2,0),B=D=0,_.mode=2;break}if(_.flags=0,_.head&&(_.head.done=!1),!(1&_.wrap)||(((255&D)<<8)+(D>>8))%31){w.msg="incorrect header check",_.mode=30;break}if((15&D)!=8){w.msg="unknown compression method",_.mode=30;break}if(B-=4,S=8+(15&(D>>>=4)),_.wbits===0)_.wbits=S;else if(S>_.wbits){w.msg="invalid window size",_.mode=30;break}_.dmax=1<<S,w.adler=_.check=1,_.mode=512&D?10:12,B=D=0;break;case 2:for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(_.flags=D,(255&_.flags)!=8){w.msg="unknown compression method",_.mode=30;break}if(57344&_.flags){w.msg="unknown header flags set",_.mode=30;break}_.head&&(_.head.text=D>>8&1),512&_.flags&&(O[0]=255&D,O[1]=D>>>8&255,_.check=a(_.check,O,2,0)),B=D=0,_.mode=3;case 3:for(;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}_.head&&(_.head.time=D),512&_.flags&&(O[0]=255&D,O[1]=D>>>8&255,O[2]=D>>>16&255,O[3]=D>>>24&255,_.check=a(_.check,O,4,0)),B=D=0,_.mode=4;case 4:for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}_.head&&(_.head.xflags=255&D,_.head.os=D>>8),512&_.flags&&(O[0]=255&D,O[1]=D>>>8&255,_.check=a(_.check,O,2,0)),B=D=0,_.mode=5;case 5:if(1024&_.flags){for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}_.length=D,_.head&&(_.head.extra_len=D),512&_.flags&&(O[0]=255&D,O[1]=D>>>8&255,_.check=a(_.check,O,2,0)),B=D=0}else _.head&&(_.head.extra=null);_.mode=6;case 6:if(1024&_.flags&&($<(K=_.length)&&(K=$),K&&(_.head&&(S=_.head.extra_len-_.length,_.head.extra||(_.head.extra=new Array(_.head.extra_len)),i.arraySet(_.head.extra,V,q,K,S)),512&_.flags&&(_.check=a(_.check,V,K,q)),$-=K,q+=K,_.length-=K),_.length))break e;_.length=0,_.mode=7;case 7:if(2048&_.flags){if($===0)break e;for(K=0;S=V[q+K++],_.head&&S&&_.length<65536&&(_.head.name+=String.fromCharCode(S)),S&&K<$;);if(512&_.flags&&(_.check=a(_.check,V,K,q)),$-=K,q+=K,S)break e}else _.head&&(_.head.name=null);_.length=0,_.mode=8;case 8:if(4096&_.flags){if($===0)break e;for(K=0;S=V[q+K++],_.head&&S&&_.length<65536&&(_.head.comment+=String.fromCharCode(S)),S&&K<$;);if(512&_.flags&&(_.check=a(_.check,V,K,q)),$-=K,q+=K,S)break e}else _.head&&(_.head.comment=null);_.mode=9;case 9:if(512&_.flags){for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(D!==(65535&_.check)){w.msg="header crc mismatch",_.mode=30;break}B=D=0}_.head&&(_.head.hcrc=_.flags>>9&1,_.head.done=!0),w.adler=_.check=0,_.mode=12;break;case 10:for(;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}w.adler=_.check=x(D),B=D=0,_.mode=11;case 11:if(_.havedict===0)return w.next_out=re,w.avail_out=ie,w.next_in=q,w.avail_in=$,_.hold=D,_.bits=B,2;w.adler=_.check=1,_.mode=12;case 12:if(N===5||N===6)break e;case 13:if(_.last){D>>>=7&B,B-=7&B,_.mode=27;break}for(;B<3;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}switch(_.last=1&D,B-=1,3&(D>>>=1)){case 0:_.mode=14;break;case 1:if(k(_),_.mode=20,N!==6)break;D>>>=2,B-=2;break e;case 2:_.mode=17;break;case 3:w.msg="invalid block type",_.mode=30}D>>>=2,B-=2;break;case 14:for(D>>>=7&B,B-=7&B;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if((65535&D)!=(D>>>16^65535)){w.msg="invalid stored block lengths",_.mode=30;break}if(_.length=65535&D,B=D=0,_.mode=15,N===6)break e;case 15:_.mode=16;case 16:if(K=_.length){if($<K&&(K=$),ie<K&&(K=ie),K===0)break e;i.arraySet(ee,V,q,K,re),$-=K,q+=K,ie-=K,re+=K,_.length-=K;break}_.mode=12;break;case 17:for(;B<14;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(_.nlen=257+(31&D),D>>>=5,B-=5,_.ndist=1+(31&D),D>>>=5,B-=5,_.ncode=4+(15&D),D>>>=4,B-=4,286<_.nlen||30<_.ndist){w.msg="too many length or distance symbols",_.mode=30;break}_.have=0,_.mode=18;case 18:for(;_.have<_.ncode;){for(;B<3;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}_.lens[X[_.have++]]=7&D,D>>>=3,B-=3}for(;_.have<19;)_.lens[X[_.have++]]=0;if(_.lencode=_.lendyn,_.lenbits=7,W={bits:_.lenbits},G=u(0,_.lens,0,19,_.lencode,0,_.work,W),_.lenbits=W.bits,G){w.msg="invalid code lengths set",_.mode=30;break}_.have=0,_.mode=19;case 19:for(;_.have<_.nlen+_.ndist;){for(;xe=(T=_.lencode[D&(1<<_.lenbits)-1])>>>16&255,Re=65535&T,!((se=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(Re<16)D>>>=se,B-=se,_.lens[_.have++]=Re;else{if(Re===16){for(P=se+2;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(D>>>=se,B-=se,_.have===0){w.msg="invalid bit length repeat",_.mode=30;break}S=_.lens[_.have-1],K=3+(3&D),D>>>=2,B-=2}else if(Re===17){for(P=se+3;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}B-=se,S=0,K=3+(7&(D>>>=se)),D>>>=3,B-=3}else{for(P=se+7;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}B-=se,S=0,K=11+(127&(D>>>=se)),D>>>=7,B-=7}if(_.have+K>_.nlen+_.ndist){w.msg="invalid bit length repeat",_.mode=30;break}for(;K--;)_.lens[_.have++]=S}}if(_.mode===30)break;if(_.lens[256]===0){w.msg="invalid code -- missing end-of-block",_.mode=30;break}if(_.lenbits=9,W={bits:_.lenbits},G=u(h,_.lens,0,_.nlen,_.lencode,0,_.work,W),_.lenbits=W.bits,G){w.msg="invalid literal/lengths set",_.mode=30;break}if(_.distbits=6,_.distcode=_.distdyn,W={bits:_.distbits},G=u(v,_.lens,_.nlen,_.ndist,_.distcode,0,_.work,W),_.distbits=W.bits,G){w.msg="invalid distances set",_.mode=30;break}if(_.mode=20,N===6)break e;case 20:_.mode=21;case 21:if(6<=$&&258<=ie){w.next_out=re,w.avail_out=ie,w.next_in=q,w.avail_in=$,_.hold=D,_.bits=B,o(w,F),re=w.next_out,ee=w.output,ie=w.avail_out,q=w.next_in,V=w.input,$=w.avail_in,D=_.hold,B=_.bits,_.mode===12&&(_.back=-1);break}for(_.back=0;xe=(T=_.lencode[D&(1<<_.lenbits)-1])>>>16&255,Re=65535&T,!((se=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(xe&&!(240&xe)){for(Ce=se,Me=xe,ke=Re;xe=(T=_.lencode[ke+((D&(1<<Ce+Me)-1)>>Ce)])>>>16&255,Re=65535&T,!(Ce+(se=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}D>>>=Ce,B-=Ce,_.back+=Ce}if(D>>>=se,B-=se,_.back+=se,_.length=Re,xe===0){_.mode=26;break}if(32&xe){_.back=-1,_.mode=12;break}if(64&xe){w.msg="invalid literal/length code",_.mode=30;break}_.extra=15&xe,_.mode=22;case 22:if(_.extra){for(P=_.extra;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}_.length+=D&(1<<_.extra)-1,D>>>=_.extra,B-=_.extra,_.back+=_.extra}_.was=_.length,_.mode=23;case 23:for(;xe=(T=_.distcode[D&(1<<_.distbits)-1])>>>16&255,Re=65535&T,!((se=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(!(240&xe)){for(Ce=se,Me=xe,ke=Re;xe=(T=_.distcode[ke+((D&(1<<Ce+Me)-1)>>Ce)])>>>16&255,Re=65535&T,!(Ce+(se=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}D>>>=Ce,B-=Ce,_.back+=Ce}if(D>>>=se,B-=se,_.back+=se,64&xe){w.msg="invalid distance code",_.mode=30;break}_.offset=Re,_.extra=15&xe,_.mode=24;case 24:if(_.extra){for(P=_.extra;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}_.offset+=D&(1<<_.extra)-1,D>>>=_.extra,B-=_.extra,_.back+=_.extra}if(_.offset>_.dmax){w.msg="invalid distance too far back",_.mode=30;break}_.mode=25;case 25:if(ie===0)break e;if(K=F-ie,_.offset>K){if((K=_.offset-K)>_.whave&&_.sane){w.msg="invalid distance too far back",_.mode=30;break}Y=K>_.wnext?(K-=_.wnext,_.wsize-K):_.wnext-K,K>_.length&&(K=_.length),ge=_.window}else ge=ee,Y=re-_.offset,K=_.length;for(ie<K&&(K=ie),ie-=K,_.length-=K;ee[re++]=ge[Y++],--K;);_.length===0&&(_.mode=21);break;case 26:if(ie===0)break e;ee[re++]=_.length,ie--,_.mode=21;break;case 27:if(_.wrap){for(;B<32;){if($===0)break e;$--,D|=V[q++]<<B,B+=8}if(F-=ie,w.total_out+=F,_.total+=F,F&&(w.adler=_.check=_.flags?a(_.check,ee,F,re-F):n(_.check,ee,F,re-F)),F=ie,(_.flags?D:x(D))!==_.check){w.msg="incorrect data check",_.mode=30;break}B=D=0}_.mode=28;case 28:if(_.wrap&&_.flags){for(;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(D!==(4294967295&_.total)){w.msg="incorrect length check",_.mode=30;break}B=D=0}_.mode=29;case 29:G=1;break e;case 30:G=-3;break e;case 31:return-4;case 32:default:return d}return w.next_out=re,w.avail_out=ie,w.next_in=q,w.avail_in=$,_.hold=D,_.bits=B,(_.wsize||F!==w.avail_out&&_.mode<30&&(_.mode<27||N!==4))&&M(w,w.output,w.next_out,F-w.avail_out)?(_.mode=31,-4):(H-=w.avail_in,F-=w.avail_out,w.total_in+=H,w.total_out+=F,_.total+=F,_.wrap&&F&&(w.adler=_.check=_.flags?a(_.check,ee,F,w.next_out-F):n(_.check,ee,F,w.next_out-F)),w.data_type=_.bits+(_.last?64:0)+(_.mode===12?128:0)+(_.mode===20||_.mode===15?256:0),(H==0&&F===0||N===4)&&G===f&&(G=-5),G)},r.inflateEnd=function(w){if(!w||!w.state)return d;var N=w.state;return N.window&&(N.window=null),w.state=null,f},r.inflateGetHeader=function(w,N){var _;return w&&w.state&&2&(_=w.state).wrap?((_.head=N).done=!1,f):d},r.inflateSetDictionary=function(w,N){var _,V=N.length;return w&&w.state?(_=w.state).wrap!==0&&_.mode!==11?d:_.mode===11&&n(1,N,V,0)!==_.check?-3:M(w,N,V,V)?(_.mode=31,-4):(_.havedict=1,f):d},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){var i=e("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(h,v,f,d,p,l,m,x){var g,b,y,E,I,C,R,L,k,M=x.bits,w=0,N=0,_=0,V=0,ee=0,q=0,re=0,$=0,ie=0,D=0,B=null,H=0,F=new i.Buf16(16),K=new i.Buf16(16),Y=null,ge=0;for(w=0;w<=15;w++)F[w]=0;for(N=0;N<d;N++)F[v[f+N]]++;for(ee=M,V=15;1<=V&&F[V]===0;V--);if(V<ee&&(ee=V),V===0)return p[l++]=20971520,p[l++]=20971520,x.bits=1,0;for(_=1;_<V&&F[_]===0;_++);for(ee<_&&(ee=_),w=$=1;w<=15;w++)if($<<=1,($-=F[w])<0)return-1;if(0<$&&(h===0||V!==1))return-1;for(K[1]=0,w=1;w<15;w++)K[w+1]=K[w]+F[w];for(N=0;N<d;N++)v[f+N]!==0&&(m[K[v[f+N]]++]=N);if(C=h===0?(B=Y=m,19):h===1?(B=n,H-=257,Y=a,ge-=257,256):(B=o,Y=u,-1),w=_,I=l,re=N=D=0,y=-1,E=(ie=1<<(q=ee))-1,h===1&&852<ie||h===2&&592<ie)return 1;for(;;){for(R=w-re,k=m[N]<C?(L=0,m[N]):m[N]>C?(L=Y[ge+m[N]],B[H+m[N]]):(L=96,0),g=1<<w-re,_=b=1<<q;p[I+(D>>re)+(b-=g)]=R<<24|L<<16|k|0,b!==0;);for(g=1<<w-1;D&g;)g>>=1;if(g!==0?(D&=g-1,D+=g):D=0,N++,--F[w]==0){if(w===V)break;w=v[f+m[N]]}if(ee<w&&(D&E)!==y){for(re===0&&(re=ee),I+=_,$=1<<(q=w-re);q+re<V&&!(($-=F[q+re])<=0);)q++,$<<=1;if(ie+=1<<q,h===1&&852<ie||h===2&&592<ie)return 1;p[y=D&E]=ee<<24|q<<16|I-l|0}}return D!==0&&(p[I+D]=w-re<<24|64<<16|0),x.bits=ee,0}},{"../utils/common":41}],51:[function(e,t,r){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){var i=e("../utils/common"),n=0,a=1;function o(T){for(var O=T.length;0<=--O;)T[O]=0}var u=0,h=29,v=256,f=v+1+h,d=30,p=19,l=2*f+1,m=15,x=16,g=7,b=256,y=16,E=17,I=18,C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],R=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],M=new Array(2*(f+2));o(M);var w=new Array(2*d);o(w);var N=new Array(512);o(N);var _=new Array(256);o(_);var V=new Array(h);o(V);var ee,q,re,$=new Array(d);function ie(T,O,X,J,U){this.static_tree=T,this.extra_bits=O,this.extra_base=X,this.elems=J,this.max_length=U,this.has_stree=T&&T.length}function D(T,O){this.dyn_tree=T,this.max_code=0,this.stat_desc=O}function B(T){return T<256?N[T]:N[256+(T>>>7)]}function H(T,O){T.pending_buf[T.pending++]=255&O,T.pending_buf[T.pending++]=O>>>8&255}function F(T,O,X){T.bi_valid>x-X?(T.bi_buf|=O<<T.bi_valid&65535,H(T,T.bi_buf),T.bi_buf=O>>x-T.bi_valid,T.bi_valid+=X-x):(T.bi_buf|=O<<T.bi_valid&65535,T.bi_valid+=X)}function K(T,O,X){F(T,X[2*O],X[2*O+1])}function Y(T,O){for(var X=0;X|=1&T,T>>>=1,X<<=1,0<--O;);return X>>>1}function ge(T,O,X){var J,U,Q=new Array(m+1),ue=0;for(J=1;J<=m;J++)Q[J]=ue=ue+X[J-1]<<1;for(U=0;U<=O;U++){var te=T[2*U+1];te!==0&&(T[2*U]=Y(Q[te]++,te))}}function se(T){var O;for(O=0;O<f;O++)T.dyn_ltree[2*O]=0;for(O=0;O<d;O++)T.dyn_dtree[2*O]=0;for(O=0;O<p;O++)T.bl_tree[2*O]=0;T.dyn_ltree[2*b]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function xe(T){8<T.bi_valid?H(T,T.bi_buf):0<T.bi_valid&&(T.pending_buf[T.pending++]=T.bi_buf),T.bi_buf=0,T.bi_valid=0}function Re(T,O,X,J){var U=2*O,Q=2*X;return T[U]<T[Q]||T[U]===T[Q]&&J[O]<=J[X]}function Ce(T,O,X){for(var J=T.heap[X],U=X<<1;U<=T.heap_len&&(U<T.heap_len&&Re(O,T.heap[U+1],T.heap[U],T.depth)&&U++,!Re(O,J,T.heap[U],T.depth));)T.heap[X]=T.heap[U],X=U,U<<=1;T.heap[X]=J}function Me(T,O,X){var J,U,Q,ue,te=0;if(T.last_lit!==0)for(;J=T.pending_buf[T.d_buf+2*te]<<8|T.pending_buf[T.d_buf+2*te+1],U=T.pending_buf[T.l_buf+te],te++,J===0?K(T,U,O):(K(T,(Q=_[U])+v+1,O),(ue=C[Q])!==0&&F(T,U-=V[Q],ue),K(T,Q=B(--J),X),(ue=R[Q])!==0&&F(T,J-=$[Q],ue)),te<T.last_lit;);K(T,b,O)}function ke(T,O){var X,J,U,Q=O.dyn_tree,ue=O.stat_desc.static_tree,te=O.stat_desc.has_stree,pe=O.stat_desc.elems,we=-1;for(T.heap_len=0,T.heap_max=l,X=0;X<pe;X++)Q[2*X]!==0?(T.heap[++T.heap_len]=we=X,T.depth[X]=0):Q[2*X+1]=0;for(;T.heap_len<2;)Q[2*(U=T.heap[++T.heap_len]=we<2?++we:0)]=1,T.depth[U]=0,T.opt_len--,te&&(T.static_len-=ue[2*U+1]);for(O.max_code=we,X=T.heap_len>>1;1<=X;X--)Ce(T,Q,X);for(U=pe;X=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Ce(T,Q,1),J=T.heap[1],T.heap[--T.heap_max]=X,T.heap[--T.heap_max]=J,Q[2*U]=Q[2*X]+Q[2*J],T.depth[U]=(T.depth[X]>=T.depth[J]?T.depth[X]:T.depth[J])+1,Q[2*X+1]=Q[2*J+1]=U,T.heap[1]=U++,Ce(T,Q,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],function(ye,Ze){var vt,He,ut,Pe,Xt,si,_t=Ze.dyn_tree,Ui=Ze.max_code,zi=Ze.stat_desc.static_tree,_s=Ze.stat_desc.has_stree,Hi=Ze.stat_desc.extra_bits,ji=Ze.stat_desc.extra_base,Nt=Ze.stat_desc.max_length,ni=0;for(Pe=0;Pe<=m;Pe++)ye.bl_count[Pe]=0;for(_t[2*ye.heap[ye.heap_max]+1]=0,vt=ye.heap_max+1;vt<l;vt++)Nt<(Pe=_t[2*_t[2*(He=ye.heap[vt])+1]+1]+1)&&(Pe=Nt,ni++),_t[2*He+1]=Pe,Ui<He||(ye.bl_count[Pe]++,Xt=0,ji<=He&&(Xt=Hi[He-ji]),si=_t[2*He],ye.opt_len+=si*(Pe+Xt),_s&&(ye.static_len+=si*(zi[2*He+1]+Xt)));if(ni!==0){do{for(Pe=Nt-1;ye.bl_count[Pe]===0;)Pe--;ye.bl_count[Pe]--,ye.bl_count[Pe+1]+=2,ye.bl_count[Nt]--,ni-=2}while(0<ni);for(Pe=Nt;Pe!==0;Pe--)for(He=ye.bl_count[Pe];He!==0;)Ui<(ut=ye.heap[--vt])||(_t[2*ut+1]!==Pe&&(ye.opt_len+=(Pe-_t[2*ut+1])*_t[2*ut],_t[2*ut+1]=Pe),He--)}}(T,O),ge(Q,we,T.bl_count)}function S(T,O,X){var J,U,Q=-1,ue=O[1],te=0,pe=7,we=4;for(ue===0&&(pe=138,we=3),O[2*(X+1)+1]=65535,J=0;J<=X;J++)U=ue,ue=O[2*(J+1)+1],++te<pe&&U===ue||(te<we?T.bl_tree[2*U]+=te:U!==0?(U!==Q&&T.bl_tree[2*U]++,T.bl_tree[2*y]++):te<=10?T.bl_tree[2*E]++:T.bl_tree[2*I]++,Q=U,we=(te=0)===ue?(pe=138,3):U===ue?(pe=6,3):(pe=7,4))}function G(T,O,X){var J,U,Q=-1,ue=O[1],te=0,pe=7,we=4;for(ue===0&&(pe=138,we=3),J=0;J<=X;J++)if(U=ue,ue=O[2*(J+1)+1],!(++te<pe&&U===ue)){if(te<we)for(;K(T,U,T.bl_tree),--te!=0;);else U!==0?(U!==Q&&(K(T,U,T.bl_tree),te--),K(T,y,T.bl_tree),F(T,te-3,2)):te<=10?(K(T,E,T.bl_tree),F(T,te-3,3)):(K(T,I,T.bl_tree),F(T,te-11,7));Q=U,we=(te=0)===ue?(pe=138,3):U===ue?(pe=6,3):(pe=7,4)}}o($);var W=!1;function P(T,O,X,J){F(T,(u<<1)+(J?1:0),3),function(U,Q,ue,te){xe(U),te&&(H(U,ue),H(U,~ue)),i.arraySet(U.pending_buf,U.window,Q,ue,U.pending),U.pending+=ue}(T,O,X,!0)}r._tr_init=function(T){W||(function(){var O,X,J,U,Q,ue=new Array(m+1);for(U=J=0;U<h-1;U++)for(V[U]=J,O=0;O<1<<C[U];O++)_[J++]=U;for(_[J-1]=U,U=Q=0;U<16;U++)for($[U]=Q,O=0;O<1<<R[U];O++)N[Q++]=U;for(Q>>=7;U<d;U++)for($[U]=Q<<7,O=0;O<1<<R[U]-7;O++)N[256+Q++]=U;for(X=0;X<=m;X++)ue[X]=0;for(O=0;O<=143;)M[2*O+1]=8,O++,ue[8]++;for(;O<=255;)M[2*O+1]=9,O++,ue[9]++;for(;O<=279;)M[2*O+1]=7,O++,ue[7]++;for(;O<=287;)M[2*O+1]=8,O++,ue[8]++;for(ge(M,f+1,ue),O=0;O<d;O++)w[2*O+1]=5,w[2*O]=Y(O,5);ee=new ie(M,C,v+1,f,m),q=new ie(w,R,0,d,m),re=new ie(new Array(0),L,0,p,g)}(),W=!0),T.l_desc=new D(T.dyn_ltree,ee),T.d_desc=new D(T.dyn_dtree,q),T.bl_desc=new D(T.bl_tree,re),T.bi_buf=0,T.bi_valid=0,se(T)},r._tr_stored_block=P,r._tr_flush_block=function(T,O,X,J){var U,Q,ue=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=function(te){var pe,we=4093624447;for(pe=0;pe<=31;pe++,we>>>=1)if(1&we&&te.dyn_ltree[2*pe]!==0)return n;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return a;for(pe=32;pe<v;pe++)if(te.dyn_ltree[2*pe]!==0)return a;return n}(T)),ke(T,T.l_desc),ke(T,T.d_desc),ue=function(te){var pe;for(S(te,te.dyn_ltree,te.l_desc.max_code),S(te,te.dyn_dtree,te.d_desc.max_code),ke(te,te.bl_desc),pe=p-1;3<=pe&&te.bl_tree[2*k[pe]+1]===0;pe--);return te.opt_len+=3*(pe+1)+5+5+4,pe}(T),U=T.opt_len+3+7>>>3,(Q=T.static_len+3+7>>>3)<=U&&(U=Q)):U=Q=X+5,X+4<=U&&O!==-1?P(T,O,X,J):T.strategy===4||Q===U?(F(T,2+(J?1:0),3),Me(T,M,w)):(F(T,4+(J?1:0),3),function(te,pe,we,ye){var Ze;for(F(te,pe-257,5),F(te,we-1,5),F(te,ye-4,4),Ze=0;Ze<ye;Ze++)F(te,te.bl_tree[2*k[Ze]+1],3);G(te,te.dyn_ltree,pe-1),G(te,te.dyn_dtree,we-1)}(T,T.l_desc.max_code+1,T.d_desc.max_code+1,ue+1),Me(T,T.dyn_ltree,T.dyn_dtree)),se(T),J&&xe(T)},r._tr_tally=function(T,O,X){return T.pending_buf[T.d_buf+2*T.last_lit]=O>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&O,T.pending_buf[T.l_buf+T.last_lit]=255&X,T.last_lit++,O===0?T.dyn_ltree[2*X]++:(T.matches++,O--,T.dyn_ltree[2*(_[X]+v+1)]++,T.dyn_dtree[2*B(O)]++),T.last_lit===T.lit_bufsize-1},r._tr_align=function(T){F(T,2,3),K(T,b,M),function(O){O.bi_valid===16?(H(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(T)}},{"../utils/common":41}],53:[function(e,t,r){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(i){(function(n,a){if(!n.setImmediate){var o,u,h,v,f=1,d={},p=!1,l=n.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(n);m=m&&m.setTimeout?m:n,o={}.toString.call(n.process)==="[object process]"?function(y){process.nextTick(function(){g(y)})}:function(){if(n.postMessage&&!n.importScripts){var y=!0,E=n.onmessage;return n.onmessage=function(){y=!1},n.postMessage("","*"),n.onmessage=E,y}}()?(v="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",b,!1):n.attachEvent("onmessage",b),function(y){n.postMessage(v+y,"*")}):n.MessageChannel?((h=new MessageChannel).port1.onmessage=function(y){g(y.data)},function(y){h.port2.postMessage(y)}):l&&"onreadystatechange"in l.createElement("script")?(u=l.documentElement,function(y){var E=l.createElement("script");E.onreadystatechange=function(){g(y),E.onreadystatechange=null,u.removeChild(E),E=null},u.appendChild(E)}):function(y){setTimeout(g,0,y)},m.setImmediate=function(y){typeof y!="function"&&(y=new Function(""+y));for(var E=new Array(arguments.length-1),I=0;I<E.length;I++)E[I]=arguments[I+1];var C={callback:y,args:E};return d[f]=C,o(f),f++},m.clearImmediate=x}function x(y){delete d[y]}function g(y){if(p)setTimeout(g,0,y);else{var E=d[y];if(E){p=!0;try{(function(I){var C=I.callback,R=I.args;switch(R.length){case 0:C();break;case 1:C(R[0]);break;case 2:C(R[0],R[1]);break;case 3:C(R[0],R[1],R[2]);break;default:C.apply(a,R)}})(E)}finally{x(y),p=!1}}}}function b(y){y.source===n&&typeof y.data=="string"&&y.data.indexOf(v)===0&&g(+y.data.slice(v.length))}})(typeof self=="undefined"?i===void 0?this:i:self)}).call(this,typeof _e!="undefined"?_e:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[10])(10)})})(qs);var ho=qs.exports;const lo=$s(ho),nr=(s,c)=>c.some(e=>s instanceof e);let Gs,Js;function fo(){return Gs||(Gs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function po(){return Js||(Js=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const ar=new WeakMap,or=new WeakMap,Ei=new WeakMap;function mo(s){const c=new Promise((e,t)=>{const r=()=>{s.removeEventListener("success",i),s.removeEventListener("error",n)},i=()=>{e(Ut(s.result)),r()},n=()=>{t(s.error),r()};s.addEventListener("success",i),s.addEventListener("error",n)});return Ei.set(c,s),c}function go(s){if(ar.has(s))return;const c=new Promise((e,t)=>{const r=()=>{s.removeEventListener("complete",i),s.removeEventListener("error",n),s.removeEventListener("abort",n)},i=()=>{e(),r()},n=()=>{t(s.error||new DOMException("AbortError","AbortError")),r()};s.addEventListener("complete",i),s.addEventListener("error",n),s.addEventListener("abort",n)});ar.set(s,c)}let cr={get(s,c,e){if(s instanceof IDBTransaction){if(c==="done")return ar.get(s);if(c==="store")return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return Ut(s[c])},set(s,c,e){return s[c]=e,!0},has(s,c){return s instanceof IDBTransaction&&(c==="done"||c==="store")?!0:c in s}};function Xs(s){cr=s(cr)}function vo(s){return po().includes(s)?function(...c){return s.apply(ur(this),c),Ut(this.request)}:function(...c){return Ut(s.apply(ur(this),c))}}function xo(s){return typeof s=="function"?vo(s):(s instanceof IDBTransaction&&go(s),nr(s,fo())?new Proxy(s,cr):s)}function Ut(s){if(s instanceof IDBRequest)return mo(s);if(or.has(s))return or.get(s);const c=xo(s);return c!==s&&(or.set(s,c),Ei.set(c,s)),c}const ur=s=>Ei.get(s);function bo(s,c,{blocked:e,upgrade:t,blocking:r,terminated:i}={}){const n=indexedDB.open(s,c),a=Ut(n);return t&&n.addEventListener("upgradeneeded",o=>{t(Ut(n.result),o.oldVersion,o.newVersion,Ut(n.transaction),o)}),e&&n.addEventListener("blocked",o=>e(o.oldVersion,o.newVersion,o)),a.then(o=>{i&&o.addEventListener("close",()=>i()),r&&o.addEventListener("versionchange",u=>r(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const So=["get","getKey","getAll","getAllKeys","count"],_o=["put","add","delete","clear"],hr=new Map;function Zs(s,c){if(!(s instanceof IDBDatabase&&!(c in s)&&typeof c=="string"))return;if(hr.get(c))return hr.get(c);const e=c.replace(/FromIndex$/,""),t=c!==e,r=_o.includes(e);if(!(e in(t?IDBIndex:IDBObjectStore).prototype)||!(r||So.includes(e)))return;const i=function(n,...a){return z(this,null,function*(){const o=this.transaction(n,r?"readwrite":"readonly");let u=o.store;return t&&(u=u.index(a.shift())),(yield Promise.all([u[e](...a),r&&o.done]))[0]})};return hr.set(c,i),i}Xs(s=>Rt(Se({},s),{get:(c,e,t)=>Zs(c,e)||s.get(c,e,t),has:(c,e)=>!!Zs(c,e)||s.has(c,e)}));const yo=["continue","continuePrimaryKey","advance"],Ys={},lr=new WeakMap,Qs=new WeakMap,Ao={get(s,c){if(!yo.includes(c))return s[c];let e=Ys[c];return e||(e=Ys[c]=function(...t){lr.set(this,Qs.get(this)[c](...t))}),e}};function Eo(...s){return La(this,null,function*(){let c=this;if(c instanceof IDBCursor||(c=yield new $i(c.openCursor(...s))),!c)return;c=c;const e=new Proxy(c,Ao);for(Qs.set(e,c),Ei.set(e,ur(c));c;)yield e,c=yield new $i(lr.get(e)||c.continue()),lr.delete(e)})}function en(s,c){return c===Symbol.asyncIterator&&nr(s,[IDBIndex,IDBObjectStore,IDBCursor])||c==="iterate"&&nr(s,[IDBIndex,IDBObjectStore])}Xs(s=>Rt(Se({},s),{get(c,e,t){return en(c,e)?Eo:s.get(c,e,t)},has(c,e){return en(c,e)||s.has(c,e)}}));const wo="AliRTCLog",wi="AliRTCSessiones",Ci="AliRTCLogs",Co=()=>z(this,null,function*(){return yield bo(wo,1,{upgrade:c=>{c.createObjectStore(wi,{keyPath:"sid"}).createIndex("sid","sid",{unique:!0});const t=c.createObjectStore(Ci,{keyPath:"id",autoIncrement:!0});t.createIndex("sid","sid",{unique:!1}),t.createIndex("date","date",{unique:!1})}})}),Io=(s,c)=>z(this,null,function*(){yield s.add(wi,{sid:c})}),tn=(s,c,e,t)=>z(this,null,function*(){yield s.add(Ci,{sid:c,log:t,date:e})}),rn=(s,c)=>z(this,null,function*(){return yield s.getAllFromIndex(Ci,"sid",c)}),Ro=s=>z(this,null,function*(){return yield s.getAllFromIndex(wi,"sid")}),sn=(s,c)=>z(this,null,function*(){yield s.delete(Ci,c)}),ko=(s,c)=>z(this,null,function*(){yield s.delete(wi,c)});var nn={exports:{}},dr={exports:{}};const To=uo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var an;function Ee(){return an||(an=1,function(s,c){(function(e,t){s.exports=t()})(_e,function(){var e=e||function(t,r){var i;if(typeof window!="undefined"&&window.crypto&&(i=window.crypto),typeof self!="undefined"&&self.crypto&&(i=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window!="undefined"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof _e!="undefined"&&_e.crypto&&(i=_e.crypto),!i&&typeof oi=="function")try{i=To}catch(g){}var n=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch(g){}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch(g){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function g(){}return function(b){var y;return g.prototype=b,y=new g,g.prototype=null,y}}(),o={},u=o.lib={},h=u.Base=function(){return{extend:function(g){var b=a(this);return g&&b.mixIn(g),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var b in g)g.hasOwnProperty(b)&&(this[b]=g[b]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),v=u.WordArray=h.extend({init:function(g,b){g=this.words=g||[],b!=r?this.sigBytes=b:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var b=this.words,y=g.words,E=this.sigBytes,I=g.sigBytes;if(this.clamp(),E%4)for(var C=0;C<I;C++){var R=y[C>>>2]>>>24-C%4*8&255;b[E+C>>>2]|=R<<24-(E+C)%4*8}else for(var L=0;L<I;L+=4)b[E+L>>>2]=y[L>>>2];return this.sigBytes+=I,this},clamp:function(){var g=this.words,b=this.sigBytes;g[b>>>2]&=4294967295<<32-b%4*8,g.length=t.ceil(b/4)},clone:function(){var g=h.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var b=[],y=0;y<g;y+=4)b.push(n());return new v.init(b,g)}}),f=o.enc={},d=f.Hex={stringify:function(g){for(var b=g.words,y=g.sigBytes,E=[],I=0;I<y;I++){var C=b[I>>>2]>>>24-I%4*8&255;E.push((C>>>4).toString(16)),E.push((C&15).toString(16))}return E.join("")},parse:function(g){for(var b=g.length,y=[],E=0;E<b;E+=2)y[E>>>3]|=parseInt(g.substr(E,2),16)<<24-E%8*4;return new v.init(y,b/2)}},p=f.Latin1={stringify:function(g){for(var b=g.words,y=g.sigBytes,E=[],I=0;I<y;I++){var C=b[I>>>2]>>>24-I%4*8&255;E.push(String.fromCharCode(C))}return E.join("")},parse:function(g){for(var b=g.length,y=[],E=0;E<b;E++)y[E>>>2]|=(g.charCodeAt(E)&255)<<24-E%4*8;return new v.init(y,b)}},l=f.Utf8={stringify:function(g){try{return decodeURIComponent(escape(p.stringify(g)))}catch(b){throw new Error("Malformed UTF-8 data")}},parse:function(g){return p.parse(unescape(encodeURIComponent(g)))}},m=u.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new v.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=l.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var b,y=this._data,E=y.words,I=y.sigBytes,C=this.blockSize,R=C*4,L=I/R;g?L=t.ceil(L):L=t.max((L|0)-this._minBufferSize,0);var k=L*C,M=t.min(k*4,I);if(k){for(var w=0;w<k;w+=C)this._doProcessBlock(E,w);b=E.splice(0,k),y.sigBytes-=M}return new v.init(b,M)},clone:function(){var g=h.clone.call(this);return g._data=this._data.clone(),g},_minBufferSize:0});u.Hasher=m.extend({cfg:h.extend(),init:function(g){this.cfg=this.cfg.extend(g),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(g){return this._append(g),this._process(),this},finalize:function(g){g&&this._append(g);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(g){return function(b,y){return new g.init(y).finalize(b)}},_createHmacHelper:function(g){return function(b,y){return new x.HMAC.init(g,y).finalize(b)}}});var x=o.algo={};return o}(Math);return e})}(dr)),dr.exports}var fr={exports:{}},on;function Ii(){return on||(on=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.Base,a=i.WordArray,o=r.x64={};o.Word=n.extend({init:function(u,h){this.high=u,this.low=h}}),o.WordArray=n.extend({init:function(u,h){u=this.words=u||[],h!=t?this.sigBytes=h:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,h=u.length,v=[],f=0;f<h;f++){var d=u[f];v.push(d.high),v.push(d.low)}return a.create(v,this.sigBytes)},clone:function(){for(var u=n.clone.call(this),h=u.words=this.words.slice(0),v=h.length,f=0;f<v;f++)h[f]=h[f].clone();return u}})}(),e})}(fr)),fr.exports}var pr={exports:{}},cn;function Do(){return cn||(cn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){if(typeof ArrayBuffer=="function"){var t=e,r=t.lib,i=r.WordArray,n=i.init,a=i.init=function(o){if(o instanceof ArrayBuffer&&(o=new Uint8Array(o)),(o instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&o instanceof Uint8ClampedArray||o instanceof Int16Array||o instanceof Uint16Array||o instanceof Int32Array||o instanceof Uint32Array||o instanceof Float32Array||o instanceof Float64Array)&&(o=new Uint8Array(o.buffer,o.byteOffset,o.byteLength)),o instanceof Uint8Array){for(var u=o.byteLength,h=[],v=0;v<u;v++)h[v>>>2]|=o[v]<<24-v%4*8;n.call(this,h,u)}else n.apply(this,arguments)};a.prototype=i}}(),e.lib.WordArray})}(pr)),pr.exports}var mr={exports:{}},un;function Bo(){return un||(un=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=t.enc;n.Utf16=n.Utf16BE={stringify:function(o){for(var u=o.words,h=o.sigBytes,v=[],f=0;f<h;f+=2){var d=u[f>>>2]>>>16-f%4*8&65535;v.push(String.fromCharCode(d))}return v.join("")},parse:function(o){for(var u=o.length,h=[],v=0;v<u;v++)h[v>>>1]|=o.charCodeAt(v)<<16-v%2*16;return i.create(h,u*2)}},n.Utf16LE={stringify:function(o){for(var u=o.words,h=o.sigBytes,v=[],f=0;f<h;f+=2){var d=a(u[f>>>2]>>>16-f%4*8&65535);v.push(String.fromCharCode(d))}return v.join("")},parse:function(o){for(var u=o.length,h=[],v=0;v<u;v++)h[v>>>1]|=a(o.charCodeAt(v)<<16-v%2*16);return i.create(h,u*2)}};function a(o){return o<<8&4278255360|o>>>8&16711935}}(),e.enc.Utf16})}(mr)),mr.exports}var gr={exports:{}},hn;function zt(){return hn||(hn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=t.enc;n.Base64={stringify:function(o){var u=o.words,h=o.sigBytes,v=this._map;o.clamp();for(var f=[],d=0;d<h;d+=3)for(var p=u[d>>>2]>>>24-d%4*8&255,l=u[d+1>>>2]>>>24-(d+1)%4*8&255,m=u[d+2>>>2]>>>24-(d+2)%4*8&255,x=p<<16|l<<8|m,g=0;g<4&&d+g*.75<h;g++)f.push(v.charAt(x>>>6*(3-g)&63));var b=v.charAt(64);if(b)for(;f.length%4;)f.push(b);return f.join("")},parse:function(o){var u=o.length,h=this._map,v=this._reverseMap;if(!v){v=this._reverseMap=[];for(var f=0;f<h.length;f++)v[h.charCodeAt(f)]=f}var d=h.charAt(64);if(d){var p=o.indexOf(d);p!==-1&&(u=p)}return a(o,u,v)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(o,u,h){for(var v=[],f=0,d=0;d<u;d++)if(d%4){var p=h[o.charCodeAt(d-1)]<<d%4*2,l=h[o.charCodeAt(d)]>>>6-d%4*2,m=p|l;v[f>>>2]|=m<<24-f%4*8,f++}return i.create(v,f)}}(),e.enc.Base64})}(gr)),gr.exports}var vr={exports:{}},ln;function Po(){return ln||(ln=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=t.enc;n.Base64url={stringify:function(o,u){u===void 0&&(u=!0);var h=o.words,v=o.sigBytes,f=u?this._safe_map:this._map;o.clamp();for(var d=[],p=0;p<v;p+=3)for(var l=h[p>>>2]>>>24-p%4*8&255,m=h[p+1>>>2]>>>24-(p+1)%4*8&255,x=h[p+2>>>2]>>>24-(p+2)%4*8&255,g=l<<16|m<<8|x,b=0;b<4&&p+b*.75<v;b++)d.push(f.charAt(g>>>6*(3-b)&63));var y=f.charAt(64);if(y)for(;d.length%4;)d.push(y);return d.join("")},parse:function(o,u){u===void 0&&(u=!0);var h=o.length,v=u?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var d=0;d<v.length;d++)f[v.charCodeAt(d)]=d}var p=v.charAt(64);if(p){var l=o.indexOf(p);l!==-1&&(h=l)}return a(o,h,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(o,u,h){for(var v=[],f=0,d=0;d<u;d++)if(d%4){var p=h[o.charCodeAt(d-1)]<<d%4*2,l=h[o.charCodeAt(d)]>>>6-d%4*2,m=p|l;v[f>>>2]|=m<<24-f%4*8,f++}return i.create(v,f)}}(),e.enc.Base64url})}(vr)),vr.exports}var xr={exports:{}},dn;function Ht(){return dn||(dn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.algo,u=[];(function(){for(var l=0;l<64;l++)u[l]=t.abs(t.sin(l+1))*4294967296|0})();var h=o.MD5=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(l,m){for(var x=0;x<16;x++){var g=m+x,b=l[g];l[g]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}var y=this._hash.words,E=l[m+0],I=l[m+1],C=l[m+2],R=l[m+3],L=l[m+4],k=l[m+5],M=l[m+6],w=l[m+7],N=l[m+8],_=l[m+9],V=l[m+10],ee=l[m+11],q=l[m+12],re=l[m+13],$=l[m+14],ie=l[m+15],D=y[0],B=y[1],H=y[2],F=y[3];D=v(D,B,H,F,E,7,u[0]),F=v(F,D,B,H,I,12,u[1]),H=v(H,F,D,B,C,17,u[2]),B=v(B,H,F,D,R,22,u[3]),D=v(D,B,H,F,L,7,u[4]),F=v(F,D,B,H,k,12,u[5]),H=v(H,F,D,B,M,17,u[6]),B=v(B,H,F,D,w,22,u[7]),D=v(D,B,H,F,N,7,u[8]),F=v(F,D,B,H,_,12,u[9]),H=v(H,F,D,B,V,17,u[10]),B=v(B,H,F,D,ee,22,u[11]),D=v(D,B,H,F,q,7,u[12]),F=v(F,D,B,H,re,12,u[13]),H=v(H,F,D,B,$,17,u[14]),B=v(B,H,F,D,ie,22,u[15]),D=f(D,B,H,F,I,5,u[16]),F=f(F,D,B,H,M,9,u[17]),H=f(H,F,D,B,ee,14,u[18]),B=f(B,H,F,D,E,20,u[19]),D=f(D,B,H,F,k,5,u[20]),F=f(F,D,B,H,V,9,u[21]),H=f(H,F,D,B,ie,14,u[22]),B=f(B,H,F,D,L,20,u[23]),D=f(D,B,H,F,_,5,u[24]),F=f(F,D,B,H,$,9,u[25]),H=f(H,F,D,B,R,14,u[26]),B=f(B,H,F,D,N,20,u[27]),D=f(D,B,H,F,re,5,u[28]),F=f(F,D,B,H,C,9,u[29]),H=f(H,F,D,B,w,14,u[30]),B=f(B,H,F,D,q,20,u[31]),D=d(D,B,H,F,k,4,u[32]),F=d(F,D,B,H,N,11,u[33]),H=d(H,F,D,B,ee,16,u[34]),B=d(B,H,F,D,$,23,u[35]),D=d(D,B,H,F,I,4,u[36]),F=d(F,D,B,H,L,11,u[37]),H=d(H,F,D,B,w,16,u[38]),B=d(B,H,F,D,V,23,u[39]),D=d(D,B,H,F,re,4,u[40]),F=d(F,D,B,H,E,11,u[41]),H=d(H,F,D,B,R,16,u[42]),B=d(B,H,F,D,M,23,u[43]),D=d(D,B,H,F,_,4,u[44]),F=d(F,D,B,H,q,11,u[45]),H=d(H,F,D,B,ie,16,u[46]),B=d(B,H,F,D,C,23,u[47]),D=p(D,B,H,F,E,6,u[48]),F=p(F,D,B,H,w,10,u[49]),H=p(H,F,D,B,$,15,u[50]),B=p(B,H,F,D,k,21,u[51]),D=p(D,B,H,F,q,6,u[52]),F=p(F,D,B,H,R,10,u[53]),H=p(H,F,D,B,V,15,u[54]),B=p(B,H,F,D,I,21,u[55]),D=p(D,B,H,F,N,6,u[56]),F=p(F,D,B,H,ie,10,u[57]),H=p(H,F,D,B,M,15,u[58]),B=p(B,H,F,D,re,21,u[59]),D=p(D,B,H,F,L,6,u[60]),F=p(F,D,B,H,ee,10,u[61]),H=p(H,F,D,B,C,15,u[62]),B=p(B,H,F,D,_,21,u[63]),y[0]=y[0]+D|0,y[1]=y[1]+B|0,y[2]=y[2]+H|0,y[3]=y[3]+F|0},_doFinalize:function(){var l=this._data,m=l.words,x=this._nDataBytes*8,g=l.sigBytes*8;m[g>>>5]|=128<<24-g%32;var b=t.floor(x/4294967296),y=x;m[(g+64>>>9<<4)+15]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,m[(g+64>>>9<<4)+14]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,l.sigBytes=(m.length+1)*4,this._process();for(var E=this._hash,I=E.words,C=0;C<4;C++){var R=I[C];I[C]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360}return E},clone:function(){var l=a.clone.call(this);return l._hash=this._hash.clone(),l}});function v(l,m,x,g,b,y,E){var I=l+(m&x|~m&g)+b+E;return(I<<y|I>>>32-y)+m}function f(l,m,x,g,b,y,E){var I=l+(m&g|x&~g)+b+E;return(I<<y|I>>>32-y)+m}function d(l,m,x,g,b,y,E){var I=l+(m^x^g)+b+E;return(I<<y|I>>>32-y)+m}function p(l,m,x,g,b,y,E){var I=l+(x^(m|~g))+b+E;return(I<<y|I>>>32-y)+m}r.MD5=a._createHelper(h),r.HmacMD5=a._createHmacHelper(h)}(Math),e.MD5})}(xr)),xr.exports}var br={exports:{}},fn;function pn(){return fn||(fn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=r.Hasher,a=t.algo,o=[],u=a.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,v){for(var f=this._hash.words,d=f[0],p=f[1],l=f[2],m=f[3],x=f[4],g=0;g<80;g++){if(g<16)o[g]=h[v+g]|0;else{var b=o[g-3]^o[g-8]^o[g-14]^o[g-16];o[g]=b<<1|b>>>31}var y=(d<<5|d>>>27)+x+o[g];g<20?y+=(p&l|~p&m)+1518500249:g<40?y+=(p^l^m)+1859775393:g<60?y+=(p&l|p&m|l&m)-1894007588:y+=(p^l^m)-899497514,x=m,m=l,l=p<<30|p>>>2,p=d,d=y}f[0]=f[0]+d|0,f[1]=f[1]+p|0,f[2]=f[2]+l|0,f[3]=f[3]+m|0,f[4]=f[4]+x|0},_doFinalize:function(){var h=this._data,v=h.words,f=this._nDataBytes*8,d=h.sigBytes*8;return v[d>>>5]|=128<<24-d%32,v[(d+64>>>9<<4)+14]=Math.floor(f/4294967296),v[(d+64>>>9<<4)+15]=f,h.sigBytes=v.length*4,this._process(),this._hash},clone:function(){var h=n.clone.call(this);return h._hash=this._hash.clone(),h}});t.SHA1=n._createHelper(u),t.HmacSHA1=n._createHmacHelper(u)}(),e.SHA1})}(br)),br.exports}var Sr={exports:{}},mn;function _r(){return mn||(mn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.algo,u=[],h=[];(function(){function d(x){for(var g=t.sqrt(x),b=2;b<=g;b++)if(!(x%b))return!1;return!0}function p(x){return(x-(x|0))*4294967296|0}for(var l=2,m=0;m<64;)d(l)&&(m<8&&(u[m]=p(t.pow(l,1/2))),h[m]=p(t.pow(l,1/3)),m++),l++})();var v=[],f=o.SHA256=a.extend({_doReset:function(){this._hash=new n.init(u.slice(0))},_doProcessBlock:function(d,p){for(var l=this._hash.words,m=l[0],x=l[1],g=l[2],b=l[3],y=l[4],E=l[5],I=l[6],C=l[7],R=0;R<64;R++){if(R<16)v[R]=d[p+R]|0;else{var L=v[R-15],k=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,M=v[R-2],w=(M<<15|M>>>17)^(M<<13|M>>>19)^M>>>10;v[R]=k+v[R-7]+w+v[R-16]}var N=y&E^~y&I,_=m&x^m&g^x&g,V=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),ee=(y<<26|y>>>6)^(y<<21|y>>>11)^(y<<7|y>>>25),q=C+ee+N+h[R]+v[R],re=V+_;C=I,I=E,E=y,y=b+q|0,b=g,g=x,x=m,m=q+re|0}l[0]=l[0]+m|0,l[1]=l[1]+x|0,l[2]=l[2]+g|0,l[3]=l[3]+b|0,l[4]=l[4]+y|0,l[5]=l[5]+E|0,l[6]=l[6]+I|0,l[7]=l[7]+C|0},_doFinalize:function(){var d=this._data,p=d.words,l=this._nDataBytes*8,m=d.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=t.floor(l/4294967296),p[(m+64>>>9<<4)+15]=l,d.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=a._createHelper(f),r.HmacSHA256=a._createHmacHelper(f)}(Math),e.SHA256})}(Sr)),Sr.exports}var yr={exports:{}},gn;function Lo(){return gn||(gn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),_r())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=t.algo,a=n.SHA256,o=n.SHA224=a.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=a._doFinalize.call(this);return u.sigBytes-=4,u}});t.SHA224=a._createHelper(o),t.HmacSHA224=a._createHmacHelper(o)}(),e.SHA224})}(yr)),yr.exports}var Ar={exports:{}},vn;function xn(){return vn||(vn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),Ii())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.Hasher,n=t.x64,a=n.Word,o=n.WordArray,u=t.algo;function h(){return a.create.apply(a,arguments)}var v=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],f=[];(function(){for(var p=0;p<80;p++)f[p]=h()})();var d=u.SHA512=i.extend({_doReset:function(){this._hash=new o.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(p,l){for(var m=this._hash.words,x=m[0],g=m[1],b=m[2],y=m[3],E=m[4],I=m[5],C=m[6],R=m[7],L=x.high,k=x.low,M=g.high,w=g.low,N=b.high,_=b.low,V=y.high,ee=y.low,q=E.high,re=E.low,$=I.high,ie=I.low,D=C.high,B=C.low,H=R.high,F=R.low,K=L,Y=k,ge=M,se=w,xe=N,Re=_,Ce=V,Me=ee,ke=q,S=re,G=$,W=ie,P=D,T=B,O=H,X=F,J=0;J<80;J++){var U,Q,ue=f[J];if(J<16)Q=ue.high=p[l+J*2]|0,U=ue.low=p[l+J*2+1]|0;else{var te=f[J-15],pe=te.high,we=te.low,ye=(pe>>>1|we<<31)^(pe>>>8|we<<24)^pe>>>7,Ze=(we>>>1|pe<<31)^(we>>>8|pe<<24)^(we>>>7|pe<<25),vt=f[J-2],He=vt.high,ut=vt.low,Pe=(He>>>19|ut<<13)^(He<<3|ut>>>29)^He>>>6,Xt=(ut>>>19|He<<13)^(ut<<3|He>>>29)^(ut>>>6|He<<26),si=f[J-7],_t=si.high,Ui=si.low,zi=f[J-16],_s=zi.high,Hi=zi.low;U=Ze+Ui,Q=ye+_t+(U>>>0<Ze>>>0?1:0),U=U+Xt,Q=Q+Pe+(U>>>0<Xt>>>0?1:0),U=U+Hi,Q=Q+_s+(U>>>0<Hi>>>0?1:0),ue.high=Q,ue.low=U}var ji=ke&G^~ke&P,Nt=S&W^~S&T,ni=K&ge^K&xe^ge&xe,L0=Y&se^Y&Re^se&Re,N0=(K>>>28|Y<<4)^(K<<30|Y>>>2)^(K<<25|Y>>>7),Ra=(Y>>>28|K<<4)^(Y<<30|K>>>2)^(Y<<25|K>>>7),M0=(ke>>>14|S<<18)^(ke>>>18|S<<14)^(ke<<23|S>>>9),F0=(S>>>14|ke<<18)^(S>>>18|ke<<14)^(S<<23|ke>>>9),ka=v[J],O0=ka.high,Ta=ka.low,ht=X+F0,Mt=O+M0+(ht>>>0<X>>>0?1:0),ht=ht+Nt,Mt=Mt+ji+(ht>>>0<Nt>>>0?1:0),ht=ht+Ta,Mt=Mt+O0+(ht>>>0<Ta>>>0?1:0),ht=ht+U,Mt=Mt+Q+(ht>>>0<U>>>0?1:0),Da=Ra+L0,V0=N0+ni+(Da>>>0<Ra>>>0?1:0);O=P,X=T,P=G,T=W,G=ke,W=S,S=Me+ht|0,ke=Ce+Mt+(S>>>0<Me>>>0?1:0)|0,Ce=xe,Me=Re,xe=ge,Re=se,ge=K,se=Y,Y=ht+Da|0,K=Mt+V0+(Y>>>0<ht>>>0?1:0)|0}k=x.low=k+Y,x.high=L+K+(k>>>0<Y>>>0?1:0),w=g.low=w+se,g.high=M+ge+(w>>>0<se>>>0?1:0),_=b.low=_+Re,b.high=N+xe+(_>>>0<Re>>>0?1:0),ee=y.low=ee+Me,y.high=V+Ce+(ee>>>0<Me>>>0?1:0),re=E.low=re+S,E.high=q+ke+(re>>>0<S>>>0?1:0),ie=I.low=ie+W,I.high=$+G+(ie>>>0<W>>>0?1:0),B=C.low=B+T,C.high=D+P+(B>>>0<T>>>0?1:0),F=R.low=F+X,R.high=H+O+(F>>>0<X>>>0?1:0)},_doFinalize:function(){var p=this._data,l=p.words,m=this._nDataBytes*8,x=p.sigBytes*8;l[x>>>5]|=128<<24-x%32,l[(x+128>>>10<<5)+30]=Math.floor(m/4294967296),l[(x+128>>>10<<5)+31]=m,p.sigBytes=l.length*4,this._process();var g=this._hash.toX32();return g},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p},blockSize:1024/32});t.SHA512=i._createHelper(d),t.HmacSHA512=i._createHmacHelper(d)}(),e.SHA512})}(Ar)),Ar.exports}var Er={exports:{}},bn;function No(){return bn||(bn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),Ii(),xn())})(_e,function(e){return function(){var t=e,r=t.x64,i=r.Word,n=r.WordArray,a=t.algo,o=a.SHA512,u=a.SHA384=o.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var h=o._doFinalize.call(this);return h.sigBytes-=16,h}});t.SHA384=o._createHelper(u),t.HmacSHA384=o._createHmacHelper(u)}(),e.SHA384})}(Er)),Er.exports}var wr={exports:{}},Sn;function Mo(){return Sn||(Sn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),Ii())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.x64,u=o.Word,h=r.algo,v=[],f=[],d=[];(function(){for(var m=1,x=0,g=0;g<24;g++){v[m+5*x]=(g+1)*(g+2)/2%64;var b=x%5,y=(2*m+3*x)%5;m=b,x=y}for(var m=0;m<5;m++)for(var x=0;x<5;x++)f[m+5*x]=x+(2*m+3*x)%5*5;for(var E=1,I=0;I<24;I++){for(var C=0,R=0,L=0;L<7;L++){if(E&1){var k=(1<<L)-1;k<32?R^=1<<k:C^=1<<k-32}E&128?E=E<<1^113:E<<=1}d[I]=u.create(C,R)}})();var p=[];(function(){for(var m=0;m<25;m++)p[m]=u.create()})();var l=h.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],x=0;x<25;x++)m[x]=new u.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,x){for(var g=this._state,b=this.blockSize/2,y=0;y<b;y++){var E=m[x+2*y],I=m[x+2*y+1];E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360;var C=g[y];C.high^=I,C.low^=E}for(var R=0;R<24;R++){for(var L=0;L<5;L++){for(var k=0,M=0,w=0;w<5;w++){var C=g[L+5*w];k^=C.high,M^=C.low}var N=p[L];N.high=k,N.low=M}for(var L=0;L<5;L++)for(var _=p[(L+4)%5],V=p[(L+1)%5],ee=V.high,q=V.low,k=_.high^(ee<<1|q>>>31),M=_.low^(q<<1|ee>>>31),w=0;w<5;w++){var C=g[L+5*w];C.high^=k,C.low^=M}for(var re=1;re<25;re++){var k,M,C=g[re],$=C.high,ie=C.low,D=v[re];D<32?(k=$<<D|ie>>>32-D,M=ie<<D|$>>>32-D):(k=ie<<D-32|$>>>64-D,M=$<<D-32|ie>>>64-D);var B=p[f[re]];B.high=k,B.low=M}var H=p[0],F=g[0];H.high=F.high,H.low=F.low;for(var L=0;L<5;L++)for(var w=0;w<5;w++){var re=L+5*w,C=g[re],K=p[re],Y=p[(L+1)%5+5*w],ge=p[(L+2)%5+5*w];C.high=K.high^~Y.high&ge.high,C.low=K.low^~Y.low&ge.low}var C=g[0],se=d[R];C.high^=se.high,C.low^=se.low}},_doFinalize:function(){var m=this._data,x=m.words;this._nDataBytes*8;var g=m.sigBytes*8,b=this.blockSize*32;x[g>>>5]|=1<<24-g%32,x[(t.ceil((g+1)/b)*b>>>5)-1]|=128,m.sigBytes=x.length*4,this._process();for(var y=this._state,E=this.cfg.outputLength/8,I=E/8,C=[],R=0;R<I;R++){var L=y[R],k=L.high,M=L.low;k=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,M=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360,C.push(M),C.push(k)}return new n.init(C,E)},clone:function(){for(var m=a.clone.call(this),x=m._state=this._state.slice(0),g=0;g<25;g++)x[g]=x[g].clone();return m}});r.SHA3=a._createHelper(l),r.HmacSHA3=a._createHmacHelper(l)}(Math),e.SHA3})}(wr)),wr.exports}var Cr={exports:{}},_n;function Fo(){return _n||(_n=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){/** @preserve
|
|
16
|
+
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
17
|
+
|
|
18
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
19
|
+
|
|
20
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
21
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
22
|
+
|
|
23
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/return function(t){var r=e,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.algo,u=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),v=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=n.create([0,1518500249,1859775393,2400959708,2840853838]),p=n.create([1352829926,1548603684,1836072691,2053994217,0]),l=o.RIPEMD160=a.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(I,C){for(var R=0;R<16;R++){var L=C+R,k=I[L];I[L]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}var M=this._hash.words,w=d.words,N=p.words,_=u.words,V=h.words,ee=v.words,q=f.words,re,$,ie,D,B,H,F,K,Y,ge;H=re=M[0],F=$=M[1],K=ie=M[2],Y=D=M[3],ge=B=M[4];for(var se,R=0;R<80;R+=1)se=re+I[C+_[R]]|0,R<16?se+=m($,ie,D)+w[0]:R<32?se+=x($,ie,D)+w[1]:R<48?se+=g($,ie,D)+w[2]:R<64?se+=b($,ie,D)+w[3]:se+=y($,ie,D)+w[4],se=se|0,se=E(se,ee[R]),se=se+B|0,re=B,B=D,D=E(ie,10),ie=$,$=se,se=H+I[C+V[R]]|0,R<16?se+=y(F,K,Y)+N[0]:R<32?se+=b(F,K,Y)+N[1]:R<48?se+=g(F,K,Y)+N[2]:R<64?se+=x(F,K,Y)+N[3]:se+=m(F,K,Y)+N[4],se=se|0,se=E(se,q[R]),se=se+ge|0,H=ge,ge=Y,Y=E(K,10),K=F,F=se;se=M[1]+ie+Y|0,M[1]=M[2]+D+ge|0,M[2]=M[3]+B+H|0,M[3]=M[4]+re+F|0,M[4]=M[0]+$+K|0,M[0]=se},_doFinalize:function(){var I=this._data,C=I.words,R=this._nDataBytes*8,L=I.sigBytes*8;C[L>>>5]|=128<<24-L%32,C[(L+64>>>9<<4)+14]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,I.sigBytes=(C.length+1)*4,this._process();for(var k=this._hash,M=k.words,w=0;w<5;w++){var N=M[w];M[w]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return k},clone:function(){var I=a.clone.call(this);return I._hash=this._hash.clone(),I}});function m(I,C,R){return I^C^R}function x(I,C,R){return I&C|~I&R}function g(I,C,R){return(I|~C)^R}function b(I,C,R){return I&R|C&~R}function y(I,C,R){return I^(C|~R)}function E(I,C){return I<<C|I>>>32-C}r.RIPEMD160=a._createHelper(l),r.HmacRIPEMD160=a._createHmacHelper(l)}(),e.RIPEMD160})}(Cr)),Cr.exports}var Ir={exports:{}},yn;function Rr(){return yn||(yn=1,function(s,c){(function(e,t){s.exports=t(Ee())})(_e,function(e){(function(){var t=e,r=t.lib,i=r.Base,n=t.enc,a=n.Utf8,o=t.algo;o.HMAC=i.extend({init:function(u,h){u=this._hasher=new u.init,typeof h=="string"&&(h=a.parse(h));var v=u.blockSize,f=v*4;h.sigBytes>f&&(h=u.finalize(h)),h.clamp();for(var d=this._oKey=h.clone(),p=this._iKey=h.clone(),l=d.words,m=p.words,x=0;x<v;x++)l[x]^=1549556828,m[x]^=909522486;d.sigBytes=p.sigBytes=f,this.reset()},reset:function(){var u=this._hasher;u.reset(),u.update(this._iKey)},update:function(u){return this._hasher.update(u),this},finalize:function(u){var h=this._hasher,v=h.finalize(u);h.reset();var f=h.finalize(this._oKey.clone().concat(v));return f}})})()})}(Ir)),Ir.exports}var kr={exports:{}},An;function Oo(){return An||(An=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),_r(),Rr())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.Base,n=r.WordArray,a=t.algo,o=a.SHA256,u=a.HMAC,h=a.PBKDF2=i.extend({cfg:i.extend({keySize:128/32,hasher:o,iterations:25e4}),init:function(v){this.cfg=this.cfg.extend(v)},compute:function(v,f){for(var d=this.cfg,p=u.create(d.hasher,v),l=n.create(),m=n.create([1]),x=l.words,g=m.words,b=d.keySize,y=d.iterations;x.length<b;){var E=p.update(f).finalize(m);p.reset();for(var I=E.words,C=I.length,R=E,L=1;L<y;L++){R=p.finalize(R),p.reset();for(var k=R.words,M=0;M<C;M++)I[M]^=k[M]}l.concat(E),g[0]++}return l.sigBytes=b*4,l}});t.PBKDF2=function(v,f,d){return h.create(d).compute(v,f)}}(),e.PBKDF2})}(kr)),kr.exports}var Tr={exports:{}},En;function Tt(){return En||(En=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),pn(),Rr())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.Base,n=r.WordArray,a=t.algo,o=a.MD5,u=a.EvpKDF=i.extend({cfg:i.extend({keySize:128/32,hasher:o,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,v){for(var f,d=this.cfg,p=d.hasher.create(),l=n.create(),m=l.words,x=d.keySize,g=d.iterations;m.length<x;){f&&p.update(f),f=p.update(h).finalize(v),p.reset();for(var b=1;b<g;b++)f=p.finalize(f),p.reset();l.concat(f)}return l.sigBytes=x*4,l}});t.EvpKDF=function(h,v,f){return u.create(f).compute(h,v)}}(),e.EvpKDF})}(Tr)),Tr.exports}var Dr={exports:{}},wn;function We(){return wn||(wn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),Tt())})(_e,function(e){e.lib.Cipher||function(t){var r=e,i=r.lib,n=i.Base,a=i.WordArray,o=i.BufferedBlockAlgorithm,u=r.enc;u.Utf8;var h=u.Base64,v=r.algo,f=v.EvpKDF,d=i.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(k,M){return this.create(this._ENC_XFORM_MODE,k,M)},createDecryptor:function(k,M){return this.create(this._DEC_XFORM_MODE,k,M)},init:function(k,M,w){this.cfg=this.cfg.extend(w),this._xformMode=k,this._key=M,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(k){return this._append(k),this._process()},finalize:function(k){k&&this._append(k);var M=this._doFinalize();return M},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function k(M){return typeof M=="string"?L:I}return function(M){return{encrypt:function(w,N,_){return k(N).encrypt(M,w,N,_)},decrypt:function(w,N,_){return k(N).decrypt(M,w,N,_)}}}}()});i.StreamCipher=d.extend({_doFinalize:function(){var k=this._process(!0);return k},blockSize:1});var p=r.mode={},l=i.BlockCipherMode=n.extend({createEncryptor:function(k,M){return this.Encryptor.create(k,M)},createDecryptor:function(k,M){return this.Decryptor.create(k,M)},init:function(k,M){this._cipher=k,this._iv=M}}),m=p.CBC=function(){var k=l.extend();k.Encryptor=k.extend({processBlock:function(w,N){var _=this._cipher,V=_.blockSize;M.call(this,w,N,V),_.encryptBlock(w,N),this._prevBlock=w.slice(N,N+V)}}),k.Decryptor=k.extend({processBlock:function(w,N){var _=this._cipher,V=_.blockSize,ee=w.slice(N,N+V);_.decryptBlock(w,N),M.call(this,w,N,V),this._prevBlock=ee}});function M(w,N,_){var V,ee=this._iv;ee?(V=ee,this._iv=t):V=this._prevBlock;for(var q=0;q<_;q++)w[N+q]^=V[q]}return k}(),x=r.pad={},g=x.Pkcs7={pad:function(k,M){for(var w=M*4,N=w-k.sigBytes%w,_=N<<24|N<<16|N<<8|N,V=[],ee=0;ee<N;ee+=4)V.push(_);var q=a.create(V,N);k.concat(q)},unpad:function(k){var M=k.words[k.sigBytes-1>>>2]&255;k.sigBytes-=M}};i.BlockCipher=d.extend({cfg:d.cfg.extend({mode:m,padding:g}),reset:function(){var k;d.reset.call(this);var M=this.cfg,w=M.iv,N=M.mode;this._xformMode==this._ENC_XFORM_MODE?k=N.createEncryptor:(k=N.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==k?this._mode.init(this,w&&w.words):(this._mode=k.call(N,this,w&&w.words),this._mode.__creator=k)},_doProcessBlock:function(k,M){this._mode.processBlock(k,M)},_doFinalize:function(){var k,M=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(M.pad(this._data,this.blockSize),k=this._process(!0)):(k=this._process(!0),M.unpad(k)),k},blockSize:128/32});var b=i.CipherParams=n.extend({init:function(k){this.mixIn(k)},toString:function(k){return(k||this.formatter).stringify(this)}}),y=r.format={},E=y.OpenSSL={stringify:function(k){var M,w=k.ciphertext,N=k.salt;return N?M=a.create([1398893684,1701076831]).concat(N).concat(w):M=w,M.toString(h)},parse:function(k){var M,w=h.parse(k),N=w.words;return N[0]==1398893684&&N[1]==1701076831&&(M=a.create(N.slice(2,4)),N.splice(0,4),w.sigBytes-=16),b.create({ciphertext:w,salt:M})}},I=i.SerializableCipher=n.extend({cfg:n.extend({format:E}),encrypt:function(k,M,w,N){N=this.cfg.extend(N);var _=k.createEncryptor(w,N),V=_.finalize(M),ee=_.cfg;return b.create({ciphertext:V,key:w,iv:ee.iv,algorithm:k,mode:ee.mode,padding:ee.padding,blockSize:k.blockSize,formatter:N.format})},decrypt:function(k,M,w,N){N=this.cfg.extend(N),M=this._parse(M,N.format);var _=k.createDecryptor(w,N).finalize(M.ciphertext);return _},_parse:function(k,M){return typeof k=="string"?M.parse(k,this):k}}),C=r.kdf={},R=C.OpenSSL={execute:function(k,M,w,N,_){if(N||(N=a.random(64/8)),_)var V=f.create({keySize:M+w,hasher:_}).compute(k,N);else var V=f.create({keySize:M+w}).compute(k,N);var ee=a.create(V.words.slice(M),w*4);return V.sigBytes=M*4,b.create({key:V,iv:ee,salt:N})}},L=i.PasswordBasedCipher=I.extend({cfg:I.cfg.extend({kdf:R}),encrypt:function(k,M,w,N){N=this.cfg.extend(N);var _=N.kdf.execute(w,k.keySize,k.ivSize,N.salt,N.hasher);N.iv=_.iv;var V=I.encrypt.call(this,k,M,_.key,N);return V.mixIn(_),V},decrypt:function(k,M,w,N){N=this.cfg.extend(N),M=this._parse(M,N.format);var _=N.kdf.execute(w,k.keySize,k.ivSize,M.salt,N.hasher);N.iv=_.iv;var V=I.decrypt.call(this,k,M,_.key,N);return V}})}()})}(Dr)),Dr.exports}var Br={exports:{}},Cn;function Vo(){return Cn||(Cn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();t.Encryptor=t.extend({processBlock:function(i,n){var a=this._cipher,o=a.blockSize;r.call(this,i,n,o,a),this._prevBlock=i.slice(n,n+o)}}),t.Decryptor=t.extend({processBlock:function(i,n){var a=this._cipher,o=a.blockSize,u=i.slice(n,n+o);r.call(this,i,n,o,a),this._prevBlock=u}});function r(i,n,a,o){var u,h=this._iv;h?(u=h.slice(0),this._iv=void 0):u=this._prevBlock,o.encryptBlock(u,0);for(var v=0;v<a;v++)i[n+v]^=u[v]}return t}(),e.mode.CFB})}(Br)),Br.exports}var Pr={exports:{}},In;function Uo(){return In||(In=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.mode.CTR=function(){var t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(i,n){var a=this._cipher,o=a.blockSize,u=this._iv,h=this._counter;u&&(h=this._counter=u.slice(0),this._iv=void 0);var v=h.slice(0);a.encryptBlock(v,0),h[o-1]=h[o-1]+1|0;for(var f=0;f<o;f++)i[n+f]^=v[f]}});return t.Decryptor=r,t}(),e.mode.CTR})}(Pr)),Pr.exports}var Lr={exports:{}},Rn;function zo(){return Rn||(Rn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){/** @preserve
|
|
25
|
+
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
26
|
+
* derived from CryptoJS.mode.CTR
|
|
27
|
+
* Jan Hruby jhruby.web@gmail.com
|
|
28
|
+
*/return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(a){if((a>>24&255)===255){var o=a>>16&255,u=a>>8&255,h=a&255;o===255?(o=0,u===255?(u=0,h===255?h=0:++h):++u):++o,a=0,a+=o<<16,a+=u<<8,a+=h}else a+=1<<24;return a}function i(a){return(a[0]=r(a[0]))===0&&(a[1]=r(a[1])),a}var n=t.Encryptor=t.extend({processBlock:function(a,o){var u=this._cipher,h=u.blockSize,v=this._iv,f=this._counter;v&&(f=this._counter=v.slice(0),this._iv=void 0),i(f);var d=f.slice(0);u.encryptBlock(d,0);for(var p=0;p<h;p++)a[o+p]^=d[p]}});return t.Decryptor=n,t}(),e.mode.CTRGladman})}(Lr)),Lr.exports}var Nr={exports:{}},kn;function Ho(){return kn||(kn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.mode.OFB=function(){var t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(i,n){var a=this._cipher,o=a.blockSize,u=this._iv,h=this._keystream;u&&(h=this._keystream=u.slice(0),this._iv=void 0),a.encryptBlock(h,0);for(var v=0;v<o;v++)i[n+v]^=h[v]}});return t.Decryptor=r,t}(),e.mode.OFB})}(Nr)),Nr.exports}var Mr={exports:{}},Tn;function jo(){return Tn||(Tn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.mode.ECB=function(){var t=e.lib.BlockCipherMode.extend();return t.Encryptor=t.extend({processBlock:function(r,i){this._cipher.encryptBlock(r,i)}}),t.Decryptor=t.extend({processBlock:function(r,i){this._cipher.decryptBlock(r,i)}}),t}(),e.mode.ECB})}(Mr)),Mr.exports}var Fr={exports:{}},Dn;function Wo(){return Dn||(Dn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.AnsiX923={pad:function(t,r){var i=t.sigBytes,n=r*4,a=n-i%n,o=i+a-1;t.clamp(),t.words[o>>>2]|=a<<24-o%4*8,t.sigBytes+=a},unpad:function(t){var r=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=r}},e.pad.Ansix923})}(Fr)),Fr.exports}var Or={exports:{}},Bn;function Ko(){return Bn||(Bn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.Iso10126={pad:function(t,r){var i=r*4,n=i-t.sigBytes%i;t.concat(e.lib.WordArray.random(n-1)).concat(e.lib.WordArray.create([n<<24],1))},unpad:function(t){var r=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=r}},e.pad.Iso10126})}(Or)),Or.exports}var Vr={exports:{}},Pn;function $o(){return Pn||(Pn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971})}(Vr)),Vr.exports}var Ur={exports:{}},Ln;function qo(){return Ln||(Ln=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.ZeroPadding={pad:function(t,r){var i=r*4;t.clamp(),t.sigBytes+=i-(t.sigBytes%i||i)},unpad:function(t){for(var r=t.words,i=t.sigBytes-1,i=t.sigBytes-1;i>=0;i--)if(r[i>>>2]>>>24-i%4*8&255){t.sigBytes=i+1;break}}},e.pad.ZeroPadding})}(Ur)),Ur.exports}var zr={exports:{}},Nn;function Go(){return Nn||(Nn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})}(zr)),zr.exports}var Hr={exports:{}},Mn;function Jo(){return Mn||(Mn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),We())})(_e,function(e){return function(t){var r=e,i=r.lib,n=i.CipherParams,a=r.enc,o=a.Hex,u=r.format;u.Hex={stringify:function(h){return h.ciphertext.toString(o)},parse:function(h){var v=o.parse(h);return n.create({ciphertext:v})}}}(),e.format.Hex})}(Hr)),Hr.exports}var jr={exports:{}},Fn;function Xo(){return Fn||(Fn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Tt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.BlockCipher,n=t.algo,a=[],o=[],u=[],h=[],v=[],f=[],d=[],p=[],l=[],m=[];(function(){for(var b=[],y=0;y<256;y++)y<128?b[y]=y<<1:b[y]=y<<1^283;for(var E=0,I=0,y=0;y<256;y++){var C=I^I<<1^I<<2^I<<3^I<<4;C=C>>>8^C&255^99,a[E]=C,o[C]=E;var R=b[E],L=b[R],k=b[L],M=b[C]*257^C*16843008;u[E]=M<<24|M>>>8,h[E]=M<<16|M>>>16,v[E]=M<<8|M>>>24,f[E]=M;var M=k*16843009^L*65537^R*257^E*16843008;d[C]=M<<24|M>>>8,p[C]=M<<16|M>>>16,l[C]=M<<8|M>>>24,m[C]=M,E?(E=R^b[b[b[k^R]]],I^=b[b[I]]):E=I=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],g=n.AES=i.extend({_doReset:function(){var b;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var y=this._keyPriorReset=this._key,E=y.words,I=y.sigBytes/4,C=this._nRounds=I+6,R=(C+1)*4,L=this._keySchedule=[],k=0;k<R;k++)k<I?L[k]=E[k]:(b=L[k-1],k%I?I>6&&k%I==4&&(b=a[b>>>24]<<24|a[b>>>16&255]<<16|a[b>>>8&255]<<8|a[b&255]):(b=b<<8|b>>>24,b=a[b>>>24]<<24|a[b>>>16&255]<<16|a[b>>>8&255]<<8|a[b&255],b^=x[k/I|0]<<24),L[k]=L[k-I]^b);for(var M=this._invKeySchedule=[],w=0;w<R;w++){var k=R-w;if(w%4)var b=L[k];else var b=L[k-4];w<4||k<=4?M[w]=b:M[w]=d[a[b>>>24]]^p[a[b>>>16&255]]^l[a[b>>>8&255]]^m[a[b&255]]}}},encryptBlock:function(b,y){this._doCryptBlock(b,y,this._keySchedule,u,h,v,f,a)},decryptBlock:function(b,y){var E=b[y+1];b[y+1]=b[y+3],b[y+3]=E,this._doCryptBlock(b,y,this._invKeySchedule,d,p,l,m,o);var E=b[y+1];b[y+1]=b[y+3],b[y+3]=E},_doCryptBlock:function(b,y,E,I,C,R,L,k){for(var M=this._nRounds,w=b[y]^E[0],N=b[y+1]^E[1],_=b[y+2]^E[2],V=b[y+3]^E[3],ee=4,q=1;q<M;q++){var re=I[w>>>24]^C[N>>>16&255]^R[_>>>8&255]^L[V&255]^E[ee++],$=I[N>>>24]^C[_>>>16&255]^R[V>>>8&255]^L[w&255]^E[ee++],ie=I[_>>>24]^C[V>>>16&255]^R[w>>>8&255]^L[N&255]^E[ee++],D=I[V>>>24]^C[w>>>16&255]^R[N>>>8&255]^L[_&255]^E[ee++];w=re,N=$,_=ie,V=D}var re=(k[w>>>24]<<24|k[N>>>16&255]<<16|k[_>>>8&255]<<8|k[V&255])^E[ee++],$=(k[N>>>24]<<24|k[_>>>16&255]<<16|k[V>>>8&255]<<8|k[w&255])^E[ee++],ie=(k[_>>>24]<<24|k[V>>>16&255]<<16|k[w>>>8&255]<<8|k[N&255])^E[ee++],D=(k[V>>>24]<<24|k[w>>>16&255]<<16|k[N>>>8&255]<<8|k[_&255])^E[ee++];b[y]=re,b[y+1]=$,b[y+2]=ie,b[y+3]=D},keySize:256/32});t.AES=i._createHelper(g)}(),e.AES})}(jr)),jr.exports}var Wr={exports:{}},On;function Zo(){return On||(On=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Tt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=r.BlockCipher,a=t.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],u=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],v=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=a.DES=n.extend({_doReset:function(){for(var x=this._key,g=x.words,b=[],y=0;y<56;y++){var E=o[y]-1;b[y]=g[E>>>5]>>>31-E%32&1}for(var I=this._subKeys=[],C=0;C<16;C++){for(var R=I[C]=[],L=h[C],y=0;y<24;y++)R[y/6|0]|=b[(u[y]-1+L)%28]<<31-y%6,R[4+(y/6|0)]|=b[28+(u[y+24]-1+L)%28]<<31-y%6;R[0]=R[0]<<1|R[0]>>>31;for(var y=1;y<7;y++)R[y]=R[y]>>>(y-1)*4+3;R[7]=R[7]<<5|R[7]>>>27}for(var k=this._invSubKeys=[],y=0;y<16;y++)k[y]=I[15-y]},encryptBlock:function(x,g){this._doCryptBlock(x,g,this._subKeys)},decryptBlock:function(x,g){this._doCryptBlock(x,g,this._invSubKeys)},_doCryptBlock:function(x,g,b){this._lBlock=x[g],this._rBlock=x[g+1],p.call(this,4,252645135),p.call(this,16,65535),l.call(this,2,858993459),l.call(this,8,16711935),p.call(this,1,1431655765);for(var y=0;y<16;y++){for(var E=b[y],I=this._lBlock,C=this._rBlock,R=0,L=0;L<8;L++)R|=v[L][((C^E[L])&f[L])>>>0];this._lBlock=C,this._rBlock=I^R}var k=this._lBlock;this._lBlock=this._rBlock,this._rBlock=k,p.call(this,1,1431655765),l.call(this,8,16711935),l.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),x[g]=this._lBlock,x[g+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function p(x,g){var b=(this._lBlock>>>x^this._rBlock)&g;this._rBlock^=b,this._lBlock^=b<<x}function l(x,g){var b=(this._rBlock>>>x^this._lBlock)&g;this._lBlock^=b,this._rBlock^=b<<x}t.DES=n._createHelper(d);var m=a.TripleDES=n.extend({_doReset:function(){var x=this._key,g=x.words;if(g.length!==2&&g.length!==4&&g.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var b=g.slice(0,2),y=g.length<4?g.slice(0,2):g.slice(2,4),E=g.length<6?g.slice(0,2):g.slice(4,6);this._des1=d.createEncryptor(i.create(b)),this._des2=d.createEncryptor(i.create(y)),this._des3=d.createEncryptor(i.create(E))},encryptBlock:function(x,g){this._des1.encryptBlock(x,g),this._des2.decryptBlock(x,g),this._des3.encryptBlock(x,g)},decryptBlock:function(x,g){this._des3.decryptBlock(x,g),this._des2.encryptBlock(x,g),this._des1.decryptBlock(x,g)},keySize:192/32,ivSize:64/32,blockSize:64/32});t.TripleDES=n._createHelper(m)}(),e.TripleDES})}(Wr)),Wr.exports}var Kr={exports:{}},Vn;function Yo(){return Vn||(Vn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Tt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.StreamCipher,n=t.algo,a=n.RC4=i.extend({_doReset:function(){for(var h=this._key,v=h.words,f=h.sigBytes,d=this._S=[],p=0;p<256;p++)d[p]=p;for(var p=0,l=0;p<256;p++){var m=p%f,x=v[m>>>2]>>>24-m%4*8&255;l=(l+d[p]+x)%256;var g=d[p];d[p]=d[l],d[l]=g}this._i=this._j=0},_doProcessBlock:function(h,v){h[v]^=o.call(this)},keySize:256/32,ivSize:0});function o(){for(var h=this._S,v=this._i,f=this._j,d=0,p=0;p<4;p++){v=(v+1)%256,f=(f+h[v])%256;var l=h[v];h[v]=h[f],h[f]=l,d|=h[(h[v]+h[f])%256]<<24-p*8}return this._i=v,this._j=f,d}t.RC4=i._createHelper(a);var u=n.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)o.call(this)}});t.RC4Drop=i._createHelper(u)}(),e.RC4})}(Kr)),Kr.exports}var $r={exports:{}},Un;function Qo(){return Un||(Un=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Tt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.StreamCipher,n=t.algo,a=[],o=[],u=[],h=n.Rabbit=i.extend({_doReset:function(){for(var f=this._key.words,d=this.cfg.iv,p=0;p<4;p++)f[p]=(f[p]<<8|f[p]>>>24)&16711935|(f[p]<<24|f[p]>>>8)&4278255360;var l=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],m=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var p=0;p<4;p++)v.call(this);for(var p=0;p<8;p++)m[p]^=l[p+4&7];if(d){var x=d.words,g=x[0],b=x[1],y=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,E=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,I=y>>>16|E&4294901760,C=E<<16|y&65535;m[0]^=y,m[1]^=I,m[2]^=E,m[3]^=C,m[4]^=y,m[5]^=I,m[6]^=E,m[7]^=C;for(var p=0;p<4;p++)v.call(this)}},_doProcessBlock:function(f,d){var p=this._X;v.call(this),a[0]=p[0]^p[5]>>>16^p[3]<<16,a[1]=p[2]^p[7]>>>16^p[5]<<16,a[2]=p[4]^p[1]>>>16^p[7]<<16,a[3]=p[6]^p[3]>>>16^p[1]<<16;for(var l=0;l<4;l++)a[l]=(a[l]<<8|a[l]>>>24)&16711935|(a[l]<<24|a[l]>>>8)&4278255360,f[d+l]^=a[l]},blockSize:128/32,ivSize:64/32});function v(){for(var f=this._X,d=this._C,p=0;p<8;p++)o[p]=d[p];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<o[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<o[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<o[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<o[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<o[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<o[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<o[6]>>>0?1:0)|0,this._b=d[7]>>>0<o[7]>>>0?1:0;for(var p=0;p<8;p++){var l=f[p]+d[p],m=l&65535,x=l>>>16,g=((m*m>>>17)+m*x>>>15)+x*x,b=((l&4294901760)*l|0)+((l&65535)*l|0);u[p]=g^b}f[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,f[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,f[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,f[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,f[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,f[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,f[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,f[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}t.Rabbit=i._createHelper(h)}(),e.Rabbit})}($r)),$r.exports}var qr={exports:{}},zn;function ec(){return zn||(zn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Tt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.StreamCipher,n=t.algo,a=[],o=[],u=[],h=n.RabbitLegacy=i.extend({_doReset:function(){var f=this._key.words,d=this.cfg.iv,p=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],l=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var m=0;m<4;m++)v.call(this);for(var m=0;m<8;m++)l[m]^=p[m+4&7];if(d){var x=d.words,g=x[0],b=x[1],y=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,E=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,I=y>>>16|E&4294901760,C=E<<16|y&65535;l[0]^=y,l[1]^=I,l[2]^=E,l[3]^=C,l[4]^=y,l[5]^=I,l[6]^=E,l[7]^=C;for(var m=0;m<4;m++)v.call(this)}},_doProcessBlock:function(f,d){var p=this._X;v.call(this),a[0]=p[0]^p[5]>>>16^p[3]<<16,a[1]=p[2]^p[7]>>>16^p[5]<<16,a[2]=p[4]^p[1]>>>16^p[7]<<16,a[3]=p[6]^p[3]>>>16^p[1]<<16;for(var l=0;l<4;l++)a[l]=(a[l]<<8|a[l]>>>24)&16711935|(a[l]<<24|a[l]>>>8)&4278255360,f[d+l]^=a[l]},blockSize:128/32,ivSize:64/32});function v(){for(var f=this._X,d=this._C,p=0;p<8;p++)o[p]=d[p];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<o[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<o[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<o[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<o[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<o[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<o[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<o[6]>>>0?1:0)|0,this._b=d[7]>>>0<o[7]>>>0?1:0;for(var p=0;p<8;p++){var l=f[p]+d[p],m=l&65535,x=l>>>16,g=((m*m>>>17)+m*x>>>15)+x*x,b=((l&4294901760)*l|0)+((l&65535)*l|0);u[p]=g^b}f[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,f[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,f[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,f[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,f[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,f[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,f[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,f[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}t.RabbitLegacy=i._createHelper(h)}(),e.RabbitLegacy})}(qr)),qr.exports}var Gr={exports:{}},Hn;function tc(){return Hn||(Hn=1,function(s,c){(function(e,t,r){s.exports=t(Ee(),zt(),Ht(),Tt(),We())})(_e,function(e){return function(){var t=e,r=t.lib,i=r.BlockCipher,n=t.algo;const a=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],u=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function v(m,x){let g=x>>24&255,b=x>>16&255,y=x>>8&255,E=x&255,I=m.sbox[0][g]+m.sbox[1][b];return I=I^m.sbox[2][y],I=I+m.sbox[3][E],I}function f(m,x,g){let b=x,y=g,E;for(let I=0;I<a;++I)b=b^m.pbox[I],y=v(m,b)^y,E=b,b=y,y=E;return E=b,b=y,y=E,y=y^m.pbox[a],b=b^m.pbox[a+1],{left:b,right:y}}function d(m,x,g){let b=x,y=g,E;for(let I=a+1;I>1;--I)b=b^m.pbox[I],y=v(m,b)^y,E=b,b=y,y=E;return E=b,b=y,y=E,y=y^m.pbox[1],b=b^m.pbox[0],{left:b,right:y}}function p(m,x,g){for(let C=0;C<4;C++){m.sbox[C]=[];for(let R=0;R<256;R++)m.sbox[C][R]=u[C][R]}let b=0;for(let C=0;C<a+2;C++)m.pbox[C]=o[C]^x[b],b++,b>=g&&(b=0);let y=0,E=0,I=0;for(let C=0;C<a+2;C+=2)I=f(m,y,E),y=I.left,E=I.right,m.pbox[C]=y,m.pbox[C+1]=E;for(let C=0;C<4;C++)for(let R=0;R<256;R+=2)I=f(m,y,E),y=I.left,E=I.right,m.sbox[C][R]=y,m.sbox[C][R+1]=E;return!0}var l=n.Blowfish=i.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,x=m.words,g=m.sigBytes/4;p(h,x,g)}},encryptBlock:function(m,x){var g=f(h,m[x],m[x+1]);m[x]=g.left,m[x+1]=g.right},decryptBlock:function(m,x){var g=d(h,m[x],m[x+1]);m[x]=g.left,m[x+1]=g.right},blockSize:64/32,keySize:128/32,ivSize:64/32});t.Blowfish=i._createHelper(l)}(),e.Blowfish})}(Gr)),Gr.exports}(function(s,c){(function(e,t,r){s.exports=t(Ee(),Ii(),Do(),Bo(),zt(),Po(),Ht(),pn(),_r(),Lo(),xn(),No(),Mo(),Fo(),Rr(),Oo(),Tt(),We(),Vo(),Uo(),zo(),Ho(),jo(),Wo(),Ko(),$o(),qo(),Go(),Jo(),Xo(),Zo(),Yo(),Qo(),ec(),tc())})(_e,function(e){return e})})(nn);var Jr=nn.exports;const ci=$s(Jr),jn=ci.enc.Base64,ic=ci.lib.WordArray,rc=s=>z(this,null,function*(){const c=yield s.arrayBuffer(),e=Jr.MD5(ic.create(c));return jn.stringify(e)}),sc=function(c,e,t){const r="x-oss-",i={};let n=[c.toUpperCase(),e["content-md5"]||"",e["content-type"],e["x-oss-date"]];return Object.keys(e).forEach(a=>{const o=a.toLowerCase();o.indexOf(r)===0&&(i[o]=String(e[a]).trim())}),Object.keys(i).sort().forEach(a=>{n.push(`${a}:${i[a]}`)}),n.push(t),n.join(`
|
|
29
|
+
`)},nc=(s,c,e,t)=>z(this,null,function*(){const r=sc("PUT",e,t),i=jn.stringify(Jr.HmacSHA1(r,c));return`OSS ${s}:${i}`});var ac=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,oc=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,cc=/[^-+\dA-Z]/g;function Xr(s,c,e,t){if(arguments.length===1&&typeof s=="string"&&!/\d/.test(s)&&(c=s,s=void 0),s=s||s===0?s:new Date,s instanceof Date||(s=new Date(s)),isNaN(s))throw TypeError("Invalid date");c=String(Wn[c]||c||Wn.default);var r=c.slice(0,4);(r==="UTC:"||r==="GMT:")&&(c=c.slice(4),e=!0,r==="GMT:"&&(t=!0));var i=function(){return e?"getUTC":"get"},n=function(){return s[i()+"Date"]()},a=function(){return s[i()+"Day"]()},o=function(){return s[i()+"Month"]()},u=function(){return s[i()+"FullYear"]()},h=function(){return s[i()+"Hours"]()},v=function(){return s[i()+"Minutes"]()},f=function(){return s[i()+"Seconds"]()},d=function(){return s[i()+"Milliseconds"]()},p=function(){return e?0:s.getTimezoneOffset()},l=function(){return uc(s)},m=function(){return hc(s)},x={d:function(){return n()},dd:function(){return at(n())},ddd:function(){return rt.dayNames[a()]},DDD:function(){return Kn({y:u(),m:o(),d:n(),_:i(),dayName:rt.dayNames[a()],short:!0})},dddd:function(){return rt.dayNames[a()+7]},DDDD:function(){return Kn({y:u(),m:o(),d:n(),_:i(),dayName:rt.dayNames[a()+7]})},m:function(){return o()+1},mm:function(){return at(o()+1)},mmm:function(){return rt.monthNames[o()]},mmmm:function(){return rt.monthNames[o()+12]},yy:function(){return String(u()).slice(2)},yyyy:function(){return at(u(),4)},h:function(){return h()%12||12},hh:function(){return at(h()%12||12)},H:function(){return h()},HH:function(){return at(h())},M:function(){return v()},MM:function(){return at(v())},s:function(){return f()},ss:function(){return at(f())},l:function(){return at(d(),3)},L:function(){return at(Math.floor(d()/10))},t:function(){return h()<12?rt.timeNames[0]:rt.timeNames[1]},tt:function(){return h()<12?rt.timeNames[2]:rt.timeNames[3]},T:function(){return h()<12?rt.timeNames[4]:rt.timeNames[5]},TT:function(){return h()<12?rt.timeNames[6]:rt.timeNames[7]},Z:function(){return t?"GMT":e?"UTC":lc(s)},o:function(){return(p()>0?"-":"+")+at(Math.floor(Math.abs(p())/60)*100+Math.abs(p())%60,4)},p:function(){return(p()>0?"-":"+")+at(Math.floor(Math.abs(p())/60),2)+":"+at(Math.floor(Math.abs(p())%60),2)},S:function(){return["th","st","nd","rd"][n()%10>3?0:(n()%100-n()%10!=10)*n()%10]},W:function(){return l()},WW:function(){return at(l())},N:function(){return m()}};return c.replace(ac,function(g){return g in x?x[g]():g.slice(1,g.length-1)})}var Wn={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},rt={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},at=function(c){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(c).padStart(e,"0")},Kn=function(c){var e=c.y,t=c.m,r=c.d,i=c._,n=c.dayName,a=c.short,o=a===void 0?!1:a,u=new Date,h=new Date;h.setDate(h[i+"Date"]()-1);var v=new Date;v.setDate(v[i+"Date"]()+1);var f=function(){return u[i+"Date"]()},d=function(){return u[i+"Month"]()},p=function(){return u[i+"FullYear"]()},l=function(){return h[i+"Date"]()},m=function(){return h[i+"Month"]()},x=function(){return h[i+"FullYear"]()},g=function(){return v[i+"Date"]()},b=function(){return v[i+"Month"]()},y=function(){return v[i+"FullYear"]()};return p()===e&&d()===t&&f()===r?o?"Tdy":"Today":x()===e&&m()===t&&l()===r?o?"Ysd":"Yesterday":y()===e&&b()===t&&g()===r?o?"Tmw":"Tomorrow":n},uc=function(c){var e=new Date(c.getFullYear(),c.getMonth(),c.getDate());e.setDate(e.getDate()-(e.getDay()+6)%7+3);var t=new Date(e.getFullYear(),0,4);t.setDate(t.getDate()-(t.getDay()+6)%7+3);var r=e.getTimezoneOffset()-t.getTimezoneOffset();e.setHours(e.getHours()-r);var i=(e-t)/(864e5*7);return 1+Math.floor(i)},hc=function(c){var e=c.getDay();return e===0&&(e=7),e},lc=function(c){return(String(c).match(oc)||[""]).pop().replace(cc,"").replace(/GMT\+0000/g,"UTC")};function $n(s,c,e){Object.defineProperty(s,c,{writable:!0,enumerable:!0,configurable:!0,value:e})}function qn(s,c,e,t){t?t(()=>{$n(s,c,e)}):$n(s,c,e)}Array(32);class dc{constructor(c){this.timer=null,this.time=10,this.count=10,this.arr=[];var e,t;this.time=(e=c.time)!=null?e:10,this.count=(t=c.count)!=null?t:10,c.host.startsWith("http://")||c.host.startsWith("https://")?this.url=c.host+"/logstores/"+c.logstore+"/track":this.url="https://"+c.project+"."+c.host+"/logstores/"+c.logstore+"/track",this.opt=c,c.installUnloadHook&&typeof c.installUnloadHook=="function"&&c.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(c){const e={__logs__:c};return this.opt.tags&&(e.__tags__=this.opt.tags),this.opt.topic&&(e.__topic__=this.opt.topic),this.opt.source&&(e.__source__=this.opt.source),JSON.stringify(e)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const c=this.assemblePayload(this.arr);this.opt.sendPayload(this.url,c)}}transString(c){let e={};for(let t in c)typeof c[t]=="object"?e[t]=JSON.stringify(c[t]):e[t]=String(c[t]);return e}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const c=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){c.sendImmediateInner()},this.time*1e3)}}send(c){const e=this.transString(c);this.arr.push(e),this.sendInner()}sendImmediate(c){const e=this.transString(c);this.arr.push(e),this.sendImmediateInner()}sendBatchLogs(c){const e=c.map(t=>this.transString(t));this.arr.push(...e),this.sendInner()}sendBatchLogsImmediate(c){const e=c.map(t=>this.transString(t));this.arr.push(...e),this.sendImmediateInner()}overwriteTransString(c){this.transString=c.transString}getOpt(){return this.opt}}var fc=(s,c,e)=>new Promise((t,r)=>{var i=o=>{try{a(e.next(o))}catch(u){r(u)}},n=o=>{try{a(e.throw(o))}catch(u){r(u)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(i,n);a((e=e.apply(s,c)).next())});function pc(s,c){return navigator&&navigator.sendBeacon?navigator.sendBeacon(`${s}?APIVersion=0.6.0`,c):!1}function Gn(s,c){const e=new window.XMLHttpRequest;e.open("POST",`${s}?APIVersion=0.6.0`,!0),e.send(c)}function mc(s,c){try{if(c.length>=32768){Gn(s,c);return}pc(s,c)||Gn(s,c)}catch(e){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
|
|
30
|
+
`+e),console.error("Failed log data:",s))}}function gc(s,c,e){return fc(this,null,function*(){try{s=s.slice(0,-6);const{data:t,header:r}=yield e.process(s,c),i=new window.XMLHttpRequest;i.open("POST",s,!0);for(let n in r)i.setRequestHeader(n,r[n]);i.send(t)}catch(t){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
|
|
31
|
+
`+t),console.error("Failed log data:",s))}})}class Jn extends dc{constructor(c){const e=Object.assign({},c,{installUnloadHook:t=>{window.addEventListener("beforeunload",()=>{t()})},sendPayload:(t,r)=>{mc(t,r)}});super(e)}useStsPlugin(c){this.getOpt().sendPayload=(e,t)=>{gc(e,t,c)},this.overwriteTransString(c)}}qn(window,"SLS_Tracker",Jn);function vc(s){return ci.MD5(s).toString().toUpperCase()}function xc(s,c,e,t,r,i,n,a){var o;let u="";i.set("x-log-apiversion","0.6.0"),i.set("x-log-signaturemethod","hmac-sha1"),u+=s+`
|
|
32
|
+
`+n+`
|
|
33
|
+
`+((o=i.get("Content-Type"))!=null?o:"")+`
|
|
34
|
+
`+a+`
|
|
35
|
+
`;const h=(p,l)=>p[0].localeCompare(l[0]),v=p=>p[0].startsWith("x-log-")||p[0].startsWith("x-acs-");try{const p=[...i.entries()].filter(v).sort(h).map(l=>l[0]+":"+l[1]+`
|
|
36
|
+
`).join("");u+=p}catch(p){}u+=c,r.size>0&&(u+="?");try{u+=[...r.entries()].sort(h).map(p=>p[0]+"="+p[1]).join("&")}catch(p){}const f=ci.HmacSHA1(u,t).toString(ci.enc.Base64),d="LOG "+e+":"+f;return i.set("Authorization",d),i.set("x-log-date",a),d}var bc=(s,c,e)=>new Promise((t,r)=>{var i=o=>{try{a(e.next(o))}catch(u){r(u)}},n=o=>{try{a(e.throw(o))}catch(u){r(u)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(i,n);a((e=e.apply(s,c)).next())});function Sc(s){return bc(this,null,function*(){const c=new Date;if(s.refreshSTSTokenInterval||(s.refreshSTSTokenInterval=3e5),!s.stsTokenFreshTime||+c-s.stsTokenFreshTime>=s.refreshSTSTokenInterval){s.stsTokenFreshTime=c;try{yield s.refreshSTSToken()}catch(e){typeof console.error=="function"&&console.error(`Some error occured during excuting refreshSTSToken, see:
|
|
37
|
+
`+e)}}return null})}var _c=(s,c,e)=>new Promise((t,r)=>{var i=o=>{try{a(e.next(o))}catch(u){r(u)}},n=o=>{try{a(e.throw(o))}catch(u){r(u)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(i,n);a((e=e.apply(s,c)).next())});function Xn(s){return{transString:function(c){let e={},t=0,r=!1;for(let i in c){if((i==="time"||i==="__time__")&&typeof c[i]=="number"){t=c[i],r=!0;continue}typeof c[i]=="object"?e[i]=JSON.stringify(c[i]):e[i]=String(c[i])}return e.__time__=r?t:Math.floor(new Date().getTime()/1e3),e},process:function(c,e){return _c(this,null,function*(){yield Sc(s);let t=c.slice(c.indexOf("/logstores")),r=e.length,i=vc(e),n=new Date().toUTCString(),a=new Map,o=new Map([["Content-Type","application/json"],["Content-MD5",i],["x-log-bodyrawsize",r.toString()]]);s.securityToken&&o.set("x-acs-security-token",s.securityToken),xc("POST",t,s.accessKeyId,s.accessKeySecret,a,o,i,n);let u=Object.fromEntries(o);return{data:e,header:u}})}}}typeof window!="undefined"&&qn(window,"stsPlugin",Xn);const{BrowserUtil:yc}=me.AliRTS,Qt={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Gecko:"Gecko",WebKit:"WebKit"},Ri=(s,c)=>{const e=c.match(s);return e&&e.length>0&&e[1]||""},Ac=[{test:[/\sedg\//i,[/edg([ea]|ios)/i]],describe(s){if(/\sedg\//i.test(s))return{name:Qt.Blink};const e=Ri(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:Qt.EdgeHTML,version:e}}},{test:[/trident/i],describe(s){const c={name:Qt.Trident},e=Ri(/trident\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}},{test(s){const c=/gecko/i.test(s),e=/like gecko/i.test(s);return c&&!e},describe(s){const c={name:Qt.Gecko},e=Ri(/gecko\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Qt.Blink}}},{test:[/(apple)?webkit/i],describe(s){const c={name:Qt.WebKit},e=Ri(/webkit\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}}],Zr=(s,c)=>s.find(e=>{if(typeof e.test=="function")return e.test(c);if(Array.isArray(e.test))return e.test.some(t=>typeof t=="string"?c.indexOf(t)>-1:t instanceof RegExp?t.test(c):!1)}),Ec=()=>{try{const s=navigator.userAgent||"",c=Zr(Ac,s);if(c){const e=c.describe(s);return`${e.name}/${e.version||yc.browserVersion}`}}catch(s){}return navigator.userAgent},wc=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],Cc=()=>{let s="unknown";try{const c=navigator.userAgent||"",e=Zr(wc,c);if(!e)return s;s=e.describe(c)}catch(c){}return s},Ic=[{test:[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],describe(){return"Samsung"}},{test:[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i,/\((ipad);[-\w\),; ]+apple/i,/(macintosh);/i],describe(){return"Apple"}},{test:[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],describe(){return"Huawei"}},{test:[/(?:honor)([-\w ]+)[;\)]/i],describe(){return"Honor"}},{test:[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],describe(){return"Xiaomi"}},{test:[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],describe(){return"Oppo"}},{test:[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],describe(){return"Vivo"}},{test:[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],describe(){return"Realme"}},{test:[/(pixel c)\b/i,/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],describe(){return"Google"}},{test:[/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],describe(){return"ZTE"}},{test:[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],describe(){return"Meizu"}}],Rc=()=>{let s="Unknown";try{const c=navigator.userAgent||"",e=Zr(Ic,c);if(!e)return s;s=e.describe(c)}catch(c){}return s},{BrowserUtil:Yr,SystenUtil:Zn}=me.AliRTS;class Yn{constructor(){A(this,"tracker");A(this,"param");A(this,"msgCacheArr",[]);A(this,"index",0);A(this,"stsOpt");A(this,"slsToken");A(this,"ossToken")}createTracker(){if(!this.tracker&&this.slsToken&&this.param){const c=this.slsToken;this.ossToken&&(this.param.ossbn=this.ossToken.bucket_name,this.param.ossep=this.ossToken.region_endpoint);const e=new Jn({host:c.region_endpoint,project:c.project,logstore:c.log_store_stats}),t={accessKeyId:c.access_key_id,accessKeySecret:c.access_key_secret,securityToken:c.security_token,refreshSTSToken:()=>{this.slsToken&&(t.accessKeyId=this.slsToken.access_key_id,t.accessKeySecret=this.slsToken.access_key_secret,t.securityToken=this.slsToken.security_token)}};this.stsOpt=t;const r=Xn(t);e.useStsPlugin(r),this.tracker=e,this.msgCacheArr.forEach((i,n)=>{var a,o;(o=this.tracker)==null||o.send(Se(Rt(Se({},this.param),{stat_log_id:`${((a=this.param)==null?void 0:a.sesid)||"nosession"}-${n}`}),i))}),this.index=this.index+this.msgCacheArr.length,this.msgCacheArr=[]}}start(c){this.initParam(c),this.createTracker()}updateToken(c,e){this.slsToken=c,this.ossToken=e,this.createTracker()}stop(){this.tracker=void 0}sendReport(c){var e,t;if(c.tm=Date.now(),!this.tracker){this.msgCacheArr.push(c);return}(t=this.tracker)==null||t.send(Se(Rt(Se({bt:Yr.browserName||"unknown"},this.param),{stat_log_id:`${((e=this.param)==null?void 0:e.sesid)||"nosession"}-${this.index}`}),c)),this.index++}initParam(c){let e=localStorage.getItem("AliRtcUUID");e||(e=Vt(),localStorage.setItem("AliRtcUUID",e)),this.param||(this.param={apid:c.appId,usrid:c.userId,statsvrs:"0.6.1",evetid:0,sesid:c.sessionId,sessionId:c.sessionId,channelid:c.channelId,usrn:c.userId,osn:Zn.systemName,osv:Zn.systemVersion,deb:Rc(),den:Ec(),udid:e,sdkvrs:sr,acs:"Unknown",cput:Cc(),dm:`${window.location.protocol}//${window.location.host}`,bt:Yr.browserName,bv:Yr.browserVersion,envir:"PRODUCT",args:""})}}const De=(s,c=1,e=6e4,t=0)=>{let r=s;return r||(r=0),Math.min(e,Math.max(t,Math.round(r*c)))},pt=(s,c,e=2e7,t=0)=>{let r=c;(!c||c<0||c>1e4)&&(r=1e3);let i=s;return i||(i=0),Math.min(e,Math.max(t,Math.round(i/(r/1e3))))},jt=(s,c)=>{if(c===0)return 0;let e=s;return(!e||e<0)&&(e=0),+((e||0)/c*100).toFixed(2)},Qn=s=>s>=0&&s<=1?De(Math.floor(32767*s),1,32767):0,Ne=(s,c)=>{var t,r,i;let e=((t=s._last)==null?void 0:t[c])||0;return s.ssrc&&((r=s._last)!=null&&r.ssrc)&&s.ssrc!==((i=s._last)==null?void 0:i.ssrc)&&(e=0),((s==null?void 0:s[c])||0)-e},kc=(s,c)=>{var e,t,r;return(((e=s==null?void 0:s._source)==null?void 0:e[c])||0)-(((r=(t=s==null?void 0:s._last)==null?void 0:t._source)==null?void 0:r[c])||0)},ea=(s,c)=>De(Ne(s,c),1e3,1e4),Wt=(s,c=2e7)=>De(s,1,c),bi=class bi{constructor(c){A(this,"engine");A(this,"logClient");A(this,"authInfo");this.logClient=new Yn,this.engine=c}static getLogClient(){return this.staticClient||(this.staticClient=new Yn),this.staticClient}static reportOSSUpload(c,e,t=0){bi.getLogClient().sendReport({errmsg:`${e}/${c}.log`,errtype:t,evetid:70017,sesid:c,sessionId:c,stat_log_id:`${c}-70017`})}start(c){this.authInfo=c,this.logClient.start(c)}updateToken(c,e){this.logClient.updateToken(c,e),bi.getLogClient().updateToken(c,e)}stop(){this.logClient.stop()}reportPublishMonitor(c,e,t,r,i){if(!t||i.length<=0)return;const n=t===Z.Audio,a={ctm:Math.floor(i[0].timestamp||0),src:i[0].ssrc||"",codec:i[0]._codec||""},o=[],u=[],h=[],v=[],f=[],d=[],p=[],l=[],m=[],x=[],g=[],b=[],y=[],E=[],I=[],C=[],R=[],L=[],k=[];try{if(i.forEach(M=>{var H,F,K,Y,ge,se;if(!M||!M.timestamp)return;const w=(H=M._last)!=null&&H.timestamp?M.timestamp-M._last.timestamp:1e3,N=Ne(M,"bytesSent"),_=Ne(M,"headerBytesSent"),V=pt(De(N+_,8,2e7),w);o.push(V);const ee=pt(De(N,8,2e7),w);u.push(ee);const q=pt(De(_,8,2e7),w);h.push(q);const re=Ne(M,"packetsSent"),$=pt(re,w);v.push($);const ie=Ne(M,"packetsLost"),D=pt(ie,w);f.push(D);const B=jt(ie,re);if(d.push(B),n)(F=M._source)!=null&&F.audioLevel&&p.push(Qn(M._source.audioLevel)),l.push(0);else{m.push(ea(M,"totalEncodeTime")),x.push(Wt((K=M._source)==null?void 0:K.framesPerSecond,100)),g.push(Wt((Y=M._source)==null?void 0:Y.framesPerSecond,100)),b.push(Wt(M.framesPerSecond,100)),y.push(Wt((ge=M._source)==null?void 0:ge.height,4400)),E.push(Wt((se=M._source)==null?void 0:se.width,7700)),I.push(Wt(M.frameHeight,4400)),C.push(Wt(M.frameWidth,7700));const xe=Ne(M,"totalPacketSendDelay");R.push(De(xe,1/(ie||1),2e3));const Re=Ne(M,"qpSum");L.push(De(Re,1/(M.framesPerSecond||1),51)),k.push(0)}}),a.sbr=o.join(","),a.mbrs=u.join(","),a.pbrs=h.join(","),a.ps=v.join(","),a.pl=f.join(","),a.plr=d.join(","),n){const M=(r==null?void 0:r.getSettings().sampleRate)||0;a.ailevel=p.join(","),a.arpc=l.join(","),a.arsr=M,a.aesr=M,a.publevel=-90,a.rawlevel=-90}else a.em=m.join(","),a.cfps=x.join(","),a.ifps=g.join(","),a.sfps=b.join(","),a.ih=y.join(","),a.iw=E.join(","),a.sh=I.join(","),a.sw=C.join(","),a.sd=R.join(","),a.aqp=L.join(","),a.caf=k.join(","),a.can=k.join(","),a.cav=u.join(","),a.ifimax=k.join(","),a.ifimin=k.join(","),a.efimax=k.join(","),a.efimin=k.join(","),a.sfimax=k.join(","),a.sfimin=k.join(","),a.apsnr=k.join(",")}catch(M){}this.log({evetid:10070,traceid:e,calid:c,args:this.data2String(Se({calid:c,tckid:t,traceid:e},a))})}reportSubscribeMonitor(c,e,t,r,i){if(!r||!i||i.length<=0)return;const n=r===Z.Audio,a={ctm:Math.floor(i[0].timestamp||0),src:i[0].ssrc||"",codec:i[0]._codec||""},o=[],u=[],h=[],v=[],f=[],d=[],p=[],l=[],m=[],x=[],g=[],b=[],y=[],E=[],I=[],C=[],R=[],L=[],k=[],M=[],w=[],N=[],_=[],V=[],ee=[],q=[],re=[],$=[],ie=[],D=[],B=[],H=[],F=[],K=[];try{i.forEach(Y=>{var U,Q;if(!Y||!Y.timestamp)return;const ge=(U=Y._last)!=null&&U.timestamp?Y.timestamp-Y._last.timestamp:1e3,se=Ne(Y,"bytesReceived"),xe=Ne(Y,"headerBytesReceived"),Re=pt(De(se+xe,8,2e7),ge);o.push(Re);const Ce=pt(De(se,8,2e7),ge);u.push(Ce);const Me=pt(De(xe,8,2e7),ge);h.push(Me);const ke=Ne(Y,"packetsReceived"),S=pt(ke,ge);v.push(S);const G=Ne(Y,"packetsLost"),W=pt(G,ge);f.push(W);const P=jt(G,ke);d.push(P);const T=De(Y.jitterBufferDelay,1e3/Y.jitterBufferEmittedCount,3e4);p.push(T);const O=Ne(Y,"fecPacketsReceived");b.push(jt(O,ke));const X=Ne(Y,"retransmittedPacketsReceived"),J=ke+G-X;if(m.push(jt(ke-X,J)),x.push(jt(G,J)),l.push(jt(X,J)),g.push(J),F.push(0),K.push(""),n){E.push(Qn(Y.audioLevel));const ue=kc(Y,"synthesizedSamplesEvents");I.push(ue);const te=ea(Y,"synthesizedSamplesDuration");C.push(te);const pe=jt(te,ge);y.push(pe),R.push(0)}else{const ue=(Q=Y._last)!=null&&Q.totalInterFrameDelay?Y.totalInterFrameDelay-Y._last.totalInterFrameDelay:0;L.push(De(ue,1e3/(Y.framesDecoded||30),500)),k.push(De(Y.framesPerSecond,1,100)),M.push(De(Y.framesPerSecond,1,100)),w.push(De(Y.frameHeight,1,4400)),N.push(De(Y.frameWidth,1,7700));const te=Ne(Y,"totalProcessingDelay");_.push(De(te,1e3/(Y.framesDecoded||30),12e4));const pe=Ne(Y,"nackCount");ee.push(pe);const we=Ne(Y,"pliCount");V.push(we);const ye=Ne(Y,"qpSum");q.push(De(ye,1/(Y.framesPerSecond||1),51)),re.push(De(Y.framesDropped));const Ze=Ne(Y,"totalFreezesDuration");$.push(De(Ze,1e3,3e4));const vt=Ne(Y,"jitterBufferEmittedCount"),He=Ne(Y,"jitterBufferDelay");ie.push(De(He,1e3/(vt||1),3e4));const ut=Ne(Y,"jitterBufferTargetDelay");D.push(De(ut,1e3/(vt||1),3e4));const Pe=Ne(Y,"jitterBufferMinimumDelay");B.push(De(Pe,1e3/(vt||1),3e4)),H.push(De(Y.framesPerSecond,1,100))}}),a.rbr=o.join(","),a.mbrs=u.join(","),a.pbrs=h.join(","),a.pr=v.join(","),a.pl=f.join(","),a.plr=d.join(","),a.jd=p.join(","),a.fecr=b.join(","),a.retransr=l.join(","),a.baser=m.join(","),a.basel=x.join(","),a.recoverr=F.join(","),a.alll=x.join(","),a.totalc=g.join(","),n?(a.er=y.join(","),a.aolevel=E.join(","),a.asrc=R.join(","),a.scnt=I.join(","),a.sdura=C.join(",")):(a.dm=L.join(","),a.dfps=k.join(","),a.rfps=M.join(","),a.rh=w.join(","),a.rw=N.join(","),a.fpt=K.join(","),a.ns=ee.join(","),a.pliss=V.join(","),a.aqp=q.join(","),a.ofimax=F.join(","),a.ofimin=F.join(","),a.dfimax=F.join(","),a.dfimin=F.join(","),a.rfimax=F.join(","),a.rfimin=F.join(","),a.vrstutter=$.join(","),a.cdm=ie.join(","),a.tdm=D.join(","),a.pdm=B.join(","),a.ofps=H.join(","),a.dfbd=re.join(","))}catch(Y){}this.log({evetid:10080,traceid:t,rmtid:e,calid:c,args:this.data2String(Se({calid:c,rmtid:e,tckid:r,traceid:t},a))})}reportNetworkMonitor(c){if(c.length<=0)return;const e=[],t=[],r=[],i=[],n=[],a=[],o=[],u=[],h=[],v=[];c.forEach((d,p)=>{var m;if(!d.timestamp)return;const l=(m=d._last)!=null&&m.timestamp?d.timestamp-d._last.timestamp:1e3;e.push(De(d.currentRoundTripTime,1e3)),t.push(De(d.availableOutgoingBitrate,8,2e8)),r.push(pt(De(d.bytesSent,8,2e7),l,25e6)),i.push(pt(De(d.bytesReceived,8,2e7),l,25e6)),n.push(0),a.push(0),p%5===0&&(o.push(""),u.push(""),h.push(""),v.push(""))});const f={ctm:Math.floor(c[0].timestamp||0),rtt:e.join(","),bsps:r.join(","),brps:i.join(","),cpu:o.join(","),mem:u.join(","),sysmem:h.join(","),systotalmem:v.join(","),audioonly:this.engine.isAudioOnly()?1:0};this.log({evetid:10071,args:this.data2String(Se({asb:t.join(","),abms:n.join(","),vbms:a.join(",")},f))}),this.log({evetid:10081,args:this.data2String(Se({},f))})}reportJoin(c,e,t=""){var v,f;const{start:r,rs:i=0,re:n=0}=e,a=Date.now()-r,o=n-i;let u=0;i&&(u=i-r);let h=0;n&&(h=n-i),this.log({evetid:10010,args:this.data2String({sesid:((v=this.authInfo)==null?void 0:v.sessionId)||"",joitm:a,rslt:c,gslbtm:0,dnstm:0,avcftm:0,gslbrslt:0,dnsrslt:0,avcfrslt:0,mode:2,jrtc:o,usrn:(f=this.authInfo)==null?void 0:f.userId,mgt:"cdn",cttc:u,iptc:h,ndn:1,gslbloc:1,ccag:0,ucag:0,cpg:0,upg:0,tid:t})})}reportJoinConnection(c){this.log({evetid:20002,args:this.data2String(Se({transretrynum:0,ldnstc:0,tcptc:0,ssltc:0,url:""},c))})}reportLeave(c,e,t){this.log({evetid:10020,args:this.data2String({lvetm:c,rslt:e,tid:t})})}reportPublish(c,e,t,r,i,n,a,o,u,h,v){this.log({evetid:c?10032:10030,calid:t,args:this.data2String({calid:t,url:e,isvl:r?1:0,isvs:i?1:0,isvss:n?1:0,isaudio:a?1:0,rslt:o,tid:"123",pubtm:Date.now()-v,pctid:u,pubtid:h,isvp:0,isarecording:0,isad:0,isdc:0,pubretry:0,pbrttimes:0})})}reportPublishFirstPacket(c,e,t,r,i,n,a,o,u){const h=Date.now();this.log({evetid:c?10033:10031,calid:e,args:this.data2String({calid:e,fpst:h-t,tckid:n,est:t,pctid:a,pubtid:o,totaltm:h-i,jorm:u===Ot.JOINCHANNEL?1:0,cptc:0,sptc:r-t,iptc:0,ipc2fptc:0,dctc:0,patc:0})})}reportUnpublish(c,e,t,r){var i;this.log({evetid:10040,args:this.data2String({calid:c,unpubtm:e,rslt:t,tid:r,sesid:((i=this.authInfo)==null?void 0:i.sessionId)||""})})}reportSubscribe(c,e,t,r,i,n,a,o,u,h){this.log({evetid:10050,calid:c,rmtid:e,args:this.data2String(Se({calid:c,rmtid:e,isvl:t?1:0,isvs:r?1:0,isvss:i?1:0,isaudio:n?1:0,rslt:a,tid:o,subtm:u,isvp:0,isaplaying:0,isad:0,isdc:0,subretry:0,sbrttimes:0},h))})}reportSubscribeFirstPacket(c,e,t,r,i){this.log({evetid:c?10054:10051,calid:e,rmtid:t,args:this.data2String(Se({calid:e,rmtid:t,tckid:r,cptc:0,iptc:0,ipc2fptc:0,dctc:0,patc:0},i))})}reportSubscribeFirstFrame(c,e,t,r,i){this.log({evetid:c?10055:10052,calid:e,rmtid:t,args:this.data2String(Se({calid:e,rmtid:t,tckid:r},i))}),this.log({evetid:c?10058:10057,args:this.data2String(Se({calid:e,rmtid:t,tckid:r},i))})}reportUnsubscribe(c,e,t,r,i){this.log({evetid:10060,calid:c,args:this.data2String({calid:c,rmtid:e,unsubtm:t,rslt:r,tid:i})})}reportMute(c,e,t){this.log({evetid:11030,args:this.data2String({calid:c,rmtid:"",enable:e?1:0,mt:t})})}reportRoleUpdate(c,e){this.log({evetid:11040,args:this.data2String({or:c||"",nr:e,ctm:Date.now(),rslt:0})})}reportRoleUpdateResult(c,e,t,r){this.log({evetid:11041,args:this.data2String({or:c||"",nr:e,ctm:t,rslt:r})})}reportVideoProfile(c){this.log({evetid:20074,args:this.data2String({pf:c,tckid:"sophon_camera_large"})})}reportScreenProfile(c){this.log({evetid:20074,args:this.data2String({pf:c,tckid:"sophon_screenshare"})})}reportError(c){this.log({evetid:10091,args:this.data2String({rslt:c.code||-1})})}reportWarning(c){this.log({evetid:10092,args:this.data2String({rslt:-1,errmsg:c})})}reportRoomServerEvent(c,e,t,r){this.log({evetid:20005,args:this.data2String({calid:"",rmtid:"",rt:c?0:1,dr:c?"s":"r",mt:e,ri:t,cs:1,srt:Date.now(),rspc:r.code||"",mc:JSON.stringify(r)})})}reportTranscodingError(c,e){this.log({evetid:10101,args:this.data2String({rslt:c,taskid:e})})}reportBye(c){var e;this.log({evetid:10093,args:this.data2String({rslt:c,sesid:((e=this.authInfo)==null?void 0:e.sessionId)||""})})}reportAudio(c,e,t){var r;this.log({evetid:80013,args:this.data2String({rslt:c?-1:0,adm:1,adt:0,adr:c?2:0,acms:e,adrpn:t})}),this.log({evetid:80014,args:this.data2String({sesid:((r=this.authInfo)==null?void 0:r.sessionId)||"",rslt:c?-1:0,adm:1,adt:0,adr:c?2:0,acms:e,adrpn:t})})}reportScreen(c,e){var t,r;this.log({evetid:90013,args:this.data2String({rslt:c?-1:0,vcms:e,vde:c.code?c.code:-1,sesid:((t=this.authInfo)==null?void 0:t.sessionId)||""})}),this.log({evetid:90014,args:this.data2String({rslt:c?-1:0,vcms:e,vde:c.code?c.code:-1,sesid:((r=this.authInfo)==null?void 0:r.sessionId)||""})})}reportScreenStop(c){this.log({evetid:90019,args:this.data2String({rslt:c?c.code||-1:0})}),this.log({evetid:90020,args:this.data2String({rslt:c?c.code||-1:0})})}reportSwitchCamera(c){var e;this.log({evetid:90025,args:this.data2String({rslt:0,td:c,sesid:((e=this.authInfo)==null?void 0:e.sessionId)||""})})}reportPublishProfile(c,e){this.log({evetid:10201,args:this.data2String(Se({tckid:c},e))})}reportSDKCreated(c){this.log({evetid:70011,createtm:Date.now()-c,tm:c})}reportJoinInvoked(c){this.log({evetid:70012,jnnonce:c.nonce||"",jntoken:c.token||"",jntm:c.timestamp||""})}reportJoinResult(c){this.log({evetid:70013,rslt:c?c.code||-1:0,dnsrslt:0})}reportSTSResult(c){this.log({evetid:70014,rslt:c,asty:1})}reportLeaveInvoked(){this.log({evetid:70015})}reportSEIMessage(c,e,t,r,i){this.log({evetid:40301,args:this.data2String({tm:Date.now(),sei_pt:c,sei_len:e,sei_rep:t,sei_delay:r,sei_key:i})})}log(c){c&&(c.tm=new Date().getTime(),oe.debug("[ConsoleLogger]","log",c),this.logClient.sendReport(c))}data2String(c){let e="";for(let t in c)e.length&&(e+="&"),e+=t+"="+c[t];return e}};A(bi,"staticClient");let ui=bi;const Tc=1e3*60*60*24*7,Dc=s=>{if(s.length!==8)return new Date;const c=parseInt(s.substring(0,4),10),e=parseInt(s.substring(4,6),10)-1,t=parseInt(s.substring(6,8),10);if(isNaN(c)||isNaN(e)||isNaN(t))return new Date;const r=new Date(c,e,t);return isNaN(r.getTime())?new Date:r};var Qr=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.API=2]="API",s[s.WARNING=3]="WARNING",s[s.ERROR=4]="ERROR",s[s.NONE=5]="NONE",s))(Qr||{});class ki{constructor(){A(this,"dbPromise");A(this,"stsToken");A(this,"logLevel");A(this,"logToConsole");A(this,"logToServer");A(this,"appId");A(this,"sessionId");A(this,"logCache",[]);A(this,"logMethod",(c,e=console.log)=>(...t)=>{if(this.logLevel>c)return;let r=this.getCurrentTime();this.logToConsole&&e(r,...t);let i=ki.paramArrayToString(t);c>0&&this.addLog(i)});A(this,"d",this.logMethod(0,console.debug));A(this,"i",this.logMethod(1));A(this,"w",this.logMethod(3,console.warn));A(this,"e",this.logMethod(4,(...c)=>{const[e,...t]=c;console.error(e,"<error>",t)}));A(this,"ev",this.logMethod(2));A(this,"a",this.logMethod(2,(...c)=>{const[e,...t]=c;if(t.length>2){const r=`${t[1]}`;r.startsWith("__g__")&&console.group(`${r.substring(5)}_${t[2]}`)}console.log(e,...t)}));A(this,"ar",this.logMethod(2,(...c)=>{const[e,...t]=c;console.log(e,...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));A(this,"ae",this.logMethod(2,(...c)=>{const[e,...t]=c;console.error(e,"<error>",...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));this.logLevel=3,this.logToConsole=!0,this.logToServer=!0,this.appId="",this.sessionId="",this.dbPromise=Co()}static toString(c){let e;if(c instanceof Error)e=c.message;else if(typeof c=="string")e=c;else try{e=JSON.stringify(c)}catch(t){e="undefined"}return e}changeConfig(c){c.logLevel!==void 0&&c.logLevel>=0&&c.logLevel<=5&&(this.logLevel=c.logLevel),c.logToConsole!==void 0&&(this.logToConsole=c.logToConsole),c.logToServer!==void 0&&(this.logToServer=c.logToServer)}updateSTSToken(c){const e=!!this.stsToken;this.stsToken=c,!e&&c&&this.tryUploadHistorySessionLog()}uploadSessionDateLog(c,e,t){return z(this,null,function*(){if(!c||!e||!t||t.length===0||!this.stsToken)return;const r=new lo;r.file(`${c}.log`,t.map(f=>f.log||"").join(`
|
|
38
|
+
`));const i=yield r.generateAsync({type:"blob"}),n=yield rc(i),a=Xr(new Date,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),o={"x-oss-date":a,"content-md5":n,"content-type":"application/zip"};o.date=a,o["x-oss-security-token"]=this.stsToken.security_token;const u=`client/${e}/${this.appId}/${c}.zip`;o.authorization=yield nc(this.stsToken.access_key_id,this.stsToken.access_key_secret,o,`/${this.stsToken.bucket_name}/${u}`);const h=`https://${this.stsToken.bucket_name}.${this.stsToken.region_endpoint}/${u}`,v=yield fetch(h,{method:"PUT",headers:o,body:i});if(v.status===200){ui.reportOSSUpload(c,e);const f=yield this.dbPromise;t.forEach(d=>{sn(f,d.id)})}else ui.reportOSSUpload(c,e,v.status)})}uploadSessionLog(c){c&&this.dbPromise.then(e=>z(this,null,function*(){if(!this.stsToken)return;const t=yield rn(e,c),r={},i=[];t.forEach(n=>{const a=n.date;if(Date.now()-Dc(a).getTime()>Tc)try{sn(e,n.id)}catch(o){}else r[a]||(r[a]=[],i.push(a)),r[a].push(n)}),Promise.all(i.map(n=>this.uploadSessionDateLog(c,n,r[n]))).then(()=>z(this,null,function*(){(yield rn(e,c)).length===0&&ko(e,c)}))}))}tryUploadHistorySessionLog(){this.dbPromise.then(c=>z(this,null,function*(){(yield Ro(c)).filter(t=>t.sid!==this.sessionId).forEach(t=>{this.uploadSessionLog(t.sid)})}))}uploadCurrent(){const c=this.sessionId;this.sessionId="",this.uploadSessionLog(c)}setSessionID(c,e){!c||!e||(this.appId=c,this.dbPromise.then(t=>{this.sessionId=e,Io(t,e),this.logCache&&(this.logCache.forEach(r=>{tn(t,this.sessionId,r.date,`${r.log}`)}),this.logCache=[])}))}addLog(c){if(!this.logToServer)return;const e=this.getCurrentTime(),t=this.getCurrentDate(),r=`${e} ${c}`;this.sessionId?this.dbPromise.then(i=>{tn(i,this.sessionId,t,r)}):this.logCache.push({date:t,log:r})}getCurrentTime(){return Xr(new Date,"HH:MM:ss.l")}getCurrentDate(){return Xr(new Date,"yyyymmdd")}static paramArrayToString(c){let e="";for(let t=0;t<c.length;t++){e!==""&&(e+=" ");let r=ki.toString(c[t]);e+=r}return e}}class oe{static getLogger(){return this.logger||(this.logger=new ki),this.logger}static setLogLevel(c){this.getLogger().changeConfig({logLevel:c})}static config(c){this.getLogger().changeConfig(c)}static updateToken(c){this.getLogger().updateSTSToken(c)}static setSessionID(c,e){this.getLogger().setSessionID(c,e)}static uploadLog(){this.getLogger().uploadCurrent()}static interface(...c){this.getLogger().a("[API]",...c)}static interfaceResult(c,e,t,...r){t?this.getLogger().ar("[ARE]",c,e,...r):this.getLogger().ae("[ARE]",c,e,...r)}static event(...c){this.getLogger().ev("[EVT]",...c)}static debug(...c){this.getLogger().d("[DBG]",...c)}static info(...c){this.getLogger().i("[INF]",...c)}static warn(...c){this.getLogger().w("[WARN]",...c)}static error(...c){this.getLogger().e("[ERR]",...c)}}A(oe,"logger");const Bc=s=>z(this,null,function*(){const c=new me.AliRTS.SupportUtil;let e={support:!1,detail:{isWebRTCSupported:c.checkMediaDevices()&&c.checkWebRtcSupport(),isH264DecodeSupported:!1,isH264EncodeSupported:!1,isScreenShareSupported:!1,isSendMediaExtensionMsgSupported:!1,isBrowserSupported:c.checkBrowser({errorCode:0,message:""})}};if(e.support=e.detail.isWebRTCSupported&&e.detail.isBrowserSupported,c.checkWebRtcSupport()&&s!=="sendonly"){const t=yield c.checkH264Decode();e.detail.isH264DecodeSupported=t,e.support=e.support&&t}if(c.checkWebRtcSupport()&&s!=="recvonly"){const t=yield c.checkH264Encode();e.detail.isH264EncodeSupported=t,e.support=e.support&&t}return e.detail.isScreenShareSupported=c.checkWebRtcSupport()&&c.checkScreenCapture()&&!me.AliRTS.SystenUtil.isAndroid&&!me.AliRTS.SystenUtil.isIos,e.detail.isSendMediaExtensionMsgSupported=c.checkWebRtcSupport()&&c.checkEncodedTransformSupport(),e});var Ke=(s=>(s[s.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",s[s.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen",s))(Ke||{}),ta=(s=>(s[s.PRE_PROCESSOR=0]="PRE_PROCESSOR",s[s.POST_PROCESSOR=1]="POST_PROCESSOR",s))(ta||{}),Ti=(s=>(s[s.AUDIO=0]="AUDIO",s[s.VIDEO=1]="VIDEO",s[s.BOTH=2]="BOTH",s))(Ti||{});class ei extends ve{constructor(e,t=Ke.AliRtcSdkStreamTypeCapture,r=1){super();A(this,"name");A(this,"options");A(this,"type",0);A(this,"streamType");A(this,"trackType");A(this,"zIndex",1);A(this,"_isEnable",!0);A(this,"lastInputAudioTrack");A(this,"lastOutputAudioTrack");A(this,"lastInputVideoTrack");A(this,"lastOutputVideoTrack");A(this,"_hasCleared",!0);this.name=e,this.streamType=t,this.trackType=r,this.options=this.initOptions}get initOptions(){return{}}getOptions(){return this.options}init(){return z(this,null,function*(){})}enable(){this._isEnable||(this._isEnable=!0,this.init(),this.emit("enabled"))}disable(){this._isEnable&&(this._isEnable=!1,this.clear(),this.emit("disabled"))}get isEnable(){return this._isEnable}audioUpdated(e){var t,r;return((t=this.lastInputAudioTrack)==null?void 0:t.id)!==((r=e.currentAudioTrack)==null?void 0:r.id)}videoUpdated(e){var t,r;return((t=this.lastInputVideoTrack)==null?void 0:t.id)!==((r=e.currentVideoTrack)==null?void 0:r.id)}execute(e,t){return z(this,null,function*(){const r=this.shouldUpdate(e,t);this.lastInputAudioTrack=e.currentAudioTrack,this.lastInputVideoTrack=e.currentVideoTrack,this._hasCleared||r?(yield this.process(e,t),this._hasCleared=!1):(this.lastOutputAudioTrack&&(this.trackType===2||this.trackType===0)&&this.lastOutputAudioTrack&&e.updateAudioTrack(this.lastOutputAudioTrack),this.lastOutputVideoTrack&&(this.trackType===2||this.trackType===1)&&this.lastOutputVideoTrack&&e.updateVideoTrack(this.lastOutputVideoTrack)),this.lastOutputAudioTrack=e.currentAudioTrack,this.lastOutputVideoTrack=e.currentVideoTrack})}clear(e){this._hasCleared=!0,this.lastInputAudioTrack=void 0,this.lastInputVideoTrack=void 0,this.lastOutputAudioTrack=void 0,this.lastOutputVideoTrack=void 0}}var hi=(s=>(s[s.LiveTranscodingSingle=0]="LiveTranscodingSingle",s[s.LiveTranscodingMix=1]="LiveTranscodingMix",s))(hi||{}),es=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingAudio=1]="LiveTranscodingAudio",s[s.LiveTranscodingVideo=2]="LiveTranscodingVideo",s))(es||{}),ti=(s=>(s[s.LiveTranscodingCamera=0]="LiveTranscodingCamera",s[s.LiveTranscodingShareScreen=1]="LiveTranscodingShareScreen",s))(ti||{});const li={0:"camera",1:"shareScreen"};var ts=(s=>(s[s.LiveTranscoding_Profile_1IN_1080P=0]="LiveTranscoding_Profile_1IN_1080P",s[s.LiveTranscoding_Profile_1IN_720P=1]="LiveTranscoding_Profile_1IN_720P",s[s.LiveTranscoding_Profile_1IN_360P=2]="LiveTranscoding_Profile_1IN_360P",s[s.LiveTranscoding_Profile_2IN_1080P=3]="LiveTranscoding_Profile_2IN_1080P",s[s.LiveTranscoding_Profile_2IN_720P=4]="LiveTranscoding_Profile_2IN_720P",s[s.LiveTranscoding_Profile_2IN_360P=5]="LiveTranscoding_Profile_2IN_360P",s[s.LiveTranscoding_Profile_4IN_1080P=6]="LiveTranscoding_Profile_4IN_1080P",s[s.LiveTranscoding_Profile_4IN_720P=7]="LiveTranscoding_Profile_4IN_720P",s[s.LiveTranscoding_Profile_4IN_360P=8]="LiveTranscoding_Profile_4IN_360P",s[s.LiveTranscoding_Profile_9IN_1080P=9]="LiveTranscoding_Profile_9IN_1080P",s[s.LiveTranscoding_Profile_9IN_720P=10]="LiveTranscoding_Profile_9IN_720P",s[s.LiveTranscoding_Profile_9IN_360P=11]="LiveTranscoding_Profile_9IN_360P",s[s.LiveTranscoding_Profile_12IN_1080P=12]="LiveTranscoding_Profile_12IN_1080P",s[s.LiveTranscoding_Profile_12IN_720P=13]="LiveTranscoding_Profile_12IN_720P",s[s.LiveTranscoding_Profile_12IN_360P=14]="LiveTranscoding_Profile_12IN_360P",s[s.LiveTranscoding_Profile_16IN_1080P=15]="LiveTranscoding_Profile_16IN_1080P",s[s.LiveTranscoding_Profile_16IN_720P=16]="LiveTranscoding_Profile_16IN_720P",s[s.LiveTranscoding_Profile_16IN_360P=17]="LiveTranscoding_Profile_16IN_360P",s[s.LiveTranscoding_Profile_Mixed=9999]="LiveTranscoding_Profile_Mixed",s))(ts||{});const Pc={0:"1IN_1080P",1:"1IN_720P",2:"1IN_360P",3:"2IN_1080P",4:"2IN_720P",5:"2IN_360P",6:"4IN_1080P",7:"4IN_720P",8:"4IN_360P",9:"9IN_1080P",10:"9IN_720P",11:"9IN_360P",12:"12IN_1080P",13:"12IN_720P",14:"12IN_360P",15:"16IN_1080P",16:"16IN_720P",17:"16IN_360P",9999:"Mixed_Audio"};var Di=(s=>(s[s.LiveTranscoding_HZ_48000=48e3]="LiveTranscoding_HZ_48000",s[s.LiveTranscoding_HZ_44100=44100]="LiveTranscoding_HZ_44100",s[s.LiveTranscoding_HZ_32000=32e3]="LiveTranscoding_HZ_32000",s[s.LiveTranscoding_HZ_16000=16e3]="LiveTranscoding_HZ_16000",s[s.LiveTranscoding_HZ_8000=8e3]="LiveTranscoding_HZ_8000",s))(Di||{}),di=(s=>(s[s.LiveTranscodingNoBody=0]="LiveTranscodingNoBody",s[s.LiveTranscodingBody=1]="LiveTranscodingBody",s))(di||{}),fi=(s=>(s[s.NOTO_SERIF_CJKSC_REGULAR=0]="NOTO_SERIF_CJKSC_REGULAR",s[s.ALIBABA_PUHUITI_REGULAR=1]="ALIBABA_PUHUITI_REGULAR",s[s.ALIBABA_PUHUITI_BOLD=2]="ALIBABA_PUHUITI_BOLD",s[s.ALIBABA_PUHUITI_Heavy=3]="ALIBABA_PUHUITI_Heavy",s[s.ALIBABA_PUHUITI_LIGHT=4]="ALIBABA_PUHUITI_LIGHT",s[s.ALIBABA_PUHUITI_MEDIUM=5]="ALIBABA_PUHUITI_MEDIUM",s))(fi||{}),is=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingCrop=1]="LiveTranscodingCrop",s[s.LiveTranscodingFill=2]="LiveTranscodingFill",s))(is||{}),Bi=(s=>(s[s.LiveTranscodingNormal=0]="LiveTranscodingNormal",s[s.LiveTranscodingVirtualBackground=1]="LiveTranscodingVirtualBackground",s))(Bi||{}),rs=(s=>(s[s.LiveTranscodingState_IDLE=0]="LiveTranscodingState_IDLE",s[s.LiveTranscodingState_CONNNECT=1]="LiveTranscodingState_CONNNECT",s[s.LiveTranscodingState_RUNNING=2]="LiveTranscodingState_RUNNING",s[s.LiveTranscodingState_RECOVERING=3]="LiveTranscodingState_RECOVERING",s[s.LiveTranscodingState_FAILURE=4]="LiveTranscodingState_FAILURE",s[s.LiveTranscodingState_END=5]="LiveTranscodingState_END",s))(rs||{}),Et=(s=>(s[s.LiveTranscodingErrorPublishOk=0]="LiveTranscodingErrorPublishOk",s[s.LiveTranscodingErrorStreamNotFound=17825793]="LiveTranscodingErrorStreamNotFound",s[s.LiveTranscodingErrorStreamAlreadyExist=17825794]="LiveTranscodingErrorStreamAlreadyExist",s[s.LiveTranscodingErrorInvalidParam=17825795]="LiveTranscodingErrorInvalidParam",s[s.LiveTranscodingErrorInternalError=17825796]="LiveTranscodingErrorInternalError",s[s.LiveTranscodingErrorRtmpServerError=17825797]="LiveTranscodingErrorRtmpServerError",s[s.LiveTranscodingErrorRtmpStreamUrlError=17825798]="LiveTranscodingErrorRtmpStreamUrlError",s[s.LiveTranscodingErrorPublishTimeout=17825799]="LiveTranscodingErrorPublishTimeout",s[s.LiveTranscodingErrorNotAuthorized=17825800]="LiveTranscodingErrorNotAuthorized",s))(Et||{}),ss=(s=>(s[s.TrascodingPublishTaskStatusStart=0]="TrascodingPublishTaskStatusStart",s[s.TrascodingPublishTaskStatusUpdate=1]="TrascodingPublishTaskStatusUpdate",s[s.TrascodingPublishTaskStatusStop=2]="TrascodingPublishTaskStatusStop",s))(ss||{}),st=(s=>(s[s.MPU_TASK_TRANSACTION_START=0]="MPU_TASK_TRANSACTION_START",s[s.MPU_TASK_TRANSACTION_UPDATE=1]="MPU_TASK_TRANSACTION_UPDATE",s[s.MPU_TASK_TRANSACTION_STOP=2]="MPU_TASK_TRANSACTION_STOP",s[s.MPU_TASK_TRANSACTION_LIST=3]="MPU_TASK_TRANSACTION_LIST",s[s.MPU_TASK_TRANSACTION_POLLING=4]="MPU_TASK_TRANSACTION_POLLING",s[s.MPU_TASK_TRANSACTION_ACKNOWLEDGE=5]="MPU_TASK_TRANSACTION_ACKNOWLEDGE",s[s.MPU_TASK_TRANSACTION_END=6]="MPU_TASK_TRANSACTION_END",s))(st||{});const Lc={0:"/libra/v1/sdk/start-task",1:"/libra/v1/sdk/update-task",2:"/libra/v1/sdk/stop-task",3:"/libra/v1/sdk/list-task",4:"/libra/v1/sdk/polling",5:"/libra/v1/sdk/acknowledge",6:"/"};class ns{constructor(c,e,t,r,i,n,a,o){A(this,"videoWidth");A(this,"videoHeight");A(this,"videoFramerate",20);A(this,"videoBitrate",2e3);A(this,"videoGop",30);A(this,"audioSamplerate",Di.LiveTranscoding_HZ_44100);A(this,"audioBitrate",500);A(this,"audioChannels",1);this.videoWidth=c,this.videoHeight=e,t&&(this.videoFramerate=t),r&&(this.videoBitrate=r),i&&(this.videoGop=i),n&&(this.audioSamplerate=n),a&&(this.audioBitrate=a),o&&(this.audioChannels=o)}}const as=s=>((s&16711680)>>16)+(s&65280)+((s&255)<<16),mt=(s=0,c)=>{if(c==0)return 0;let e=s/c;return e<0&&(e=0),e>1&&(e=1),e};class Pi{constructor(c,e,t){A(this,"mixMode",hi.LiveTranscodingSingle);A(this,"singleParam");A(this,"mixParam");c&&(this.mixMode=c),e&&(this.singleParam=e),t&&(this.mixParam=t)}toJson(c,e,t,r,i){const n={appid:e.appId,channelid:e.channelId};if(c===st.MPU_TASK_TRANSACTION_POLLING||c===st.MPU_TASK_TRANSACTION_LIST||c===st.MPU_TASK_TRANSACTION_ACKNOWLEDGE)return c===st.MPU_TASK_TRANSACTION_ACKNOWLEDGE&&(n.messageid=i),n;if(n.taskid=t,c!==st.MPU_TASK_TRANSACTION_STOP){if(n.mixmode=this.mixMode,r&&(n.streamurl=r),this.mixMode===hi.LiveTranscodingSingle){const a=this.singleParam;if(a){n.streamtype=a.streamType,a.sourceType===ti.LiveTranscodingShareScreen?n.sourcetype=li[a.sourceType]:n.sourcetype=li[ti.LiveTranscodingCamera];const o=[];a.userId&&o.push(a.userId),n.subspecusers=o}}else if(c===st.MPU_TASK_TRANSACTION_START||c===st.MPU_TASK_TRANSACTION_UPDATE){const a=this.mixParam;if(a){a.taskProfile&&(n.taskprofile=Pc[a.taskProfile]);const o=a.encodeParam||new ns(1280,720);let u=o.videoWidth,h=o.videoHeight;const v={};Object.keys(o).forEach(d=>{const p=o[d];p>0&&(v[d.toLowerCase()]=p)}),v.lowbitratehighquality=0,n.encodeparam=v,n.backgrounds=a.backgrounds.map(d=>d.toJson(u,h)),n.watermarks=a.watermarks.map(d=>d.toJson(u,h)),n.clockwidgets=a.clockWidgets.map(d=>d.toJson(u,h));const f=a.users.map(d=>d.userId);n.subspecusers=[...new Set(f)],n.layouts=[{audiomixcount:a.users.length,panes:a.users.map((d,p)=>d.toJson(p,u,h,a.mediaProcessMode))}],n.layoutids=["0"],n.cropmode=a.cropMode,n.backgroundcolor=as(a.backgroundColor),n.taskmode=a.mediaProcessMode}}}return n}}var Ct=(s=>(s.pre="pre",s.prod="prod",s))(Ct||{}),It=(s=>(s.AliRtcSdkCommunication="communication",s.AliRtcSdkInteractiveLive="interactive_live",s.AliRtcSdkInteractiveWithLowLatencyLive="cdn_live",s))(It||{}),Dt=(s=>(s.AliRtcSdkInteractive="interactive",s.AliRtcSdkLive="live",s))(Dt||{}),wt=(s=>(s[s.AliEngineLocalDeviceTypeUnknown=0]="AliEngineLocalDeviceTypeUnknown",s[s.AliEngineLocalDeviceTypeMic=1]="AliEngineLocalDeviceTypeMic",s[s.AliEngineLocalDeviceTypeSpeaker=2]="AliEngineLocalDeviceTypeSpeaker",s[s.AliEngineLocalDeviceTypeAudioDevice=3]="AliEngineLocalDeviceTypeAudioDevice",s[s.AliEngineLocalDeviceTypeCamera=4]="AliEngineLocalDeviceTypeCamera",s[s.AliEngineLocalDeviceTypeDisplay=5]="AliEngineLocalDeviceTypeDisplay",s[s.AliEngineLocalDeviceTypeVideoDevice=6]="AliEngineLocalDeviceTypeVideoDevice",s))(wt||{}),Fe=(s=>(s[s.AliEngineLocalDeviceExceptionTypeUnknown=0]="AliEngineLocalDeviceExceptionTypeUnknown",s[s.AliEngineLocalDeviceExceptionTypeMicOpenFail=1]="AliEngineLocalDeviceExceptionTypeMicOpenFail",s[s.AliEngineLocalDeviceExceptionTypeMicInterrupt=2]="AliEngineLocalDeviceExceptionTypeMicInterrupt",s[s.AliEngineLocalDeviceExceptionTypeMicAuthFail=3]="AliEngineLocalDeviceExceptionTypeMicAuthFail",s[s.AliEngineLocalDeviceExceptionTypeMicNotAvailable=4]="AliEngineLocalDeviceExceptionTypeMicNotAvailable",s[s.AliEngineLocalDeviceExceptionTypeSpeakerOpenFail=5]="AliEngineLocalDeviceExceptionTypeSpeakerOpenFail",s[s.AliEngineLocalDeviceExceptionTypeSpeakerInterrupt=6]="AliEngineLocalDeviceExceptionTypeSpeakerInterrupt",s[s.AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable=7]="AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable",s[s.AliEngineLocalDeviceExceptionTypeAudioDeviceException=8]="AliEngineLocalDeviceExceptionTypeAudioDeviceException",s[s.AliEngineLocalDeviceExceptionTypeCameraOpenFail=9]="AliEngineLocalDeviceExceptionTypeCameraOpenFail",s[s.AliEngineLocalDeviceExceptionTypeCameraInterrupt=10]="AliEngineLocalDeviceExceptionTypeCameraInterrupt",s[s.AliEngineLocalDeviceExceptionTypeCameraAuthFail=11]="AliEngineLocalDeviceExceptionTypeCameraAuthFail",s[s.AliEngineLocalDeviceExceptionTypeDisplayException=12]="AliEngineLocalDeviceExceptionTypeDisplayException",s[s.AliEngineLocalDeviceExceptionTypeVideoDeviceException=13]="AliEngineLocalDeviceExceptionTypeVideoDeviceException",s))(Fe||{}),Te=(s=>(s[s.AliRtcConnectionStatusInit=0]="AliRtcConnectionStatusInit",s[s.AliRtcConnectionStatusDisconnected=1]="AliRtcConnectionStatusDisconnected",s[s.AliRtcConnectionStatusConnecting=2]="AliRtcConnectionStatusConnecting",s[s.AliRtcConnectionStatusConnected=3]="AliRtcConnectionStatusConnected",s[s.AliRtcConnectionStatusReconnecting=4]="AliRtcConnectionStatusReconnecting",s[s.AliRtcConnectionStatusFailed=5]="AliRtcConnectionStatusFailed",s))(Te||{}),Kt=(s=>(s[s.AliRtcConnectionChangedDummyReason=0]="AliRtcConnectionChangedDummyReason",s[s.AliRtcConnectionMediaPathChanged=1]="AliRtcConnectionMediaPathChanged",s[s.AliRtcConnectionSignalingHeartbeatTimeout=2]="AliRtcConnectionSignalingHeartbeatTimeout",s[s.AliRtcConnectionSignalingHeartbeatAlive=3]="AliRtcConnectionSignalingHeartbeatAlive",s[s.AliRtcConnectionSignalingHttpDnsResolved=4]="AliRtcConnectionSignalingHttpDnsResolved",s[s.AliRtcConnectionSignalingHttpDnsFailure=5]="AliRtcConnectionSignalingHttpDnsFailure",s[s.AliRtcConnectionSignalingGslbFailure=6]="AliRtcConnectionSignalingGslbFailure",s[s.AliRtcConnectionSignalingGslbSuccess=7]="AliRtcConnectionSignalingGslbSuccess",s[s.AliRtcConnectionSignalingJoinRoomFailure=8]="AliRtcConnectionSignalingJoinRoomFailure",s[s.AliRtcConnectionSignalingJoinRoomSuccess=9]="AliRtcConnectionSignalingJoinRoomSuccess",s[s.AliRtcConnectionSignalingLeaveRoom=10]="AliRtcConnectionSignalingLeaveRoom",s[s.AliRtcConnectionSignalingConnecting=11]="AliRtcConnectionSignalingConnecting",s[s.AliRtcConnectionChangedNetworkInterrupted=12]="AliRtcConnectionChangedNetworkInterrupted",s))(Kt||{}),os=(s=>(s[s.AliRtcUserOfflineQuit=0]="AliRtcUserOfflineQuit",s[s.AliRtcUserOfflineDropped=1]="AliRtcUserOfflineDropped",s[s.AliRtcUserOfflineBecomeAudience=2]="AliRtcUserOfflineBecomeAudience",s))(os||{}),ii=(s=>(s[s.AliRtcAudioTrackNo=0]="AliRtcAudioTrackNo",s[s.AliRtcAudioTrackMic=1]="AliRtcAudioTrackMic",s[s.AliRtcAudioTrackDual=2]="AliRtcAudioTrackDual",s))(ii||{}),Ae=(s=>(s[s.AliRtcVideoTrackNo=0]="AliRtcVideoTrackNo",s[s.AliRtcVideoTrackCamera=1]="AliRtcVideoTrackCamera",s[s.AliRtcVideoTrackScreen=2]="AliRtcVideoTrackScreen",s[s.AliRtcVideoTrackBoth=3]="AliRtcVideoTrackBoth",s))(Ae||{}),be=(s=>(s[s.AliRtcStatePublishIdle=0]="AliRtcStatePublishIdle",s[s.AliRtcStateNoPublish=1]="AliRtcStateNoPublish",s[s.AliRtcStatePublishing=2]="AliRtcStatePublishing",s[s.AliRtcStatePublished=3]="AliRtcStatePublished",s))(be||{}),Le=(s=>(s[s.AliRtcStateSubscribeIdle=0]="AliRtcStateSubscribeIdle",s[s.AliRtcStateNoSubscribe=1]="AliRtcStateNoSubscribe",s[s.AliRtcStateSubscribing=2]="AliRtcStateSubscribing",s[s.AliRtcStateSubscribed=3]="AliRtcStateSubscribed",s))(Le||{}),Je=(s=>(s[s.AliRtcVideoStreamTypeNone=0]="AliRtcVideoStreamTypeNone",s[s.AliRtcVideoStreamTypeHigh=1]="AliRtcVideoStreamTypeHigh",s[s.AliRtcVideoStreamTypeLow=2]="AliRtcVideoStreamTypeLow",s))(Je||{}),pi=(s=>(s[s.CAMERA_INVALID=-1]="CAMERA_INVALID",s[s.CAMERA_REAR=0]="CAMERA_REAR",s[s.CAMERA_FRONT=1]="CAMERA_FRONT",s))(pi||{});const ia=10,ra=5e3,Oi=class Oi extends ve{constructor(e){super();A(this,"ws");A(this,"socketStatus",0);A(this,"wsUrl","");A(this,"lastConnectStartTime",0);A(this,"maxConnectRetryCount",ia);A(this,"connectRetryCount",0);A(this,"gotErr",!1);A(this,"closedByInvoke",!0);A(this,"isReconnecting",!1);A(this,"networkAvailableChecked",!0);this.maxConnectRetryCount=e!=null?e:ia,this.onOpen=this.onOpen.bind(this),this.onMessage=this.onMessage.bind(this),this.onError=this.onError.bind(this),this.onClose=this.onClose.bind(this)}get connectUrl(){return this.wsUrl}get connectStatus(){return this.socketStatus}start(e){this.wsUrl=e,this.initWebSocket()}send(e){return this.ws&&this.socketStatus===2?(this.ws.send(JSON.stringify(e)),!0):!1}close(){this.closedByInvoke=!0,this.uninitWebscoket()}reconnect(){this.emit("onReconnectStart"),this.isReconnecting=!0,this.initWebSocket()}onOpen(e){this.socketStatus=2,this.connectRetryCount=0,this.networkAvailableChecked=!1,this.closedByInvoke=!1,this.gotErr=!1,this.isReconnecting=!1,this.emit("onOpen",e)}onMessage(e){this.emit("onMessage",e)}onError(e){this.isReconnecting&&this.emit("onReconnectFail",e),this.emit("onError",e),this.isReconnecting=!1,this.gotErr=!0}onClose(e){return z(this,null,function*(){const t=this.socketStatus;if(oe.info(Oi.logName,`onClose, status: ${t}, retryCount: ${this.connectRetryCount}`),t!==0||this.connectRetryCount)if(yield At.isNetworkAvailable()){if(!this.networkAvailableChecked&&!this.closedByInvoke&&!this.gotErr){this.reconnect();return}this.networkAvailableChecked=!0,this.emit("onAuthInvalid")}else{if(this.connectRetryCount||this.emit("onNetworkError"),this.closedByInvoke)return;this.connectRetryCount+=1,this.connectRetryCount>this.maxConnectRetryCount?this.emit("onConnectFail"):Date.now()-this.lastConnectStartTime>=ra?this.reconnect():window.setTimeout(()=>{this.reconnect()},ra)}this.socketStatus=0,this.emit("onClose",e)})}initWebSocket(){this.uninitWebscoket(),this.socketStatus=1,this.lastConnectStartTime=Date.now(),this.ws=new WebSocket(this.wsUrl),this.ws.addEventListener("open",this.onOpen),this.ws.addEventListener("message",this.onMessage),this.ws.addEventListener("error",this.onError),this.ws.addEventListener("close",this.onClose)}uninitWebscoket(){this.ws&&(this.ws.removeEventListener("open",this.onOpen),this.ws.removeEventListener("message",this.onMessage),this.ws.removeEventListener("error",this.onError),this.ws.removeEventListener("close",this.onClose),this.ws.close(),this.ws=void 0,this.socketStatus=0)}};A(Oi,"logName","Socket");let cs=Oi;var Oe=(s=>(s.KEEPALIVE="keepalive",s.JOINCHANNEL="joinchannel",s.NOTIFYJOIN="notifyjoin",s.NOTIFYSTATUS="notifystatus",s.STATUSREPORT="statusreport",s.LEAVECHANNEL="leavechannel",s.NOTIFYLEAVE="notifyleave",s.NOTIFYPUBLISH="notifypublish",s.BYE="bye",s.RECONNECT="reconnect",s.PUBLISH="publish",s.REFRESHURL="refreshurl",s.UNSUBSCRIBE="unsubscribe",s.ROLEUPDATE="roleupdate",s))(Oe||{});class Nc{constructor(c,e){A(this,"authInfo");A(this,"userName");A(this,"seqIndex",0);this.authInfo=c,this.userName=e}get roleAuth(){if(this.authInfo.role){const{timestamp:c,nonce:e,token:t,role:r}=this.authInfo;return{timestamp:c,nonce:e,token:t,tokenrole:r}}}refreshAuthInfo(c){this.authInfo=c}getSeqIndex(){return this.seqIndex}createKeepAlivePackage(){return this.createBaseSendPackage("keepalive")}createJoinPackage(){let c=this.createBaseSendPackage("joinchannel");return c.header.displayName=this.userName,c.header.clientversion=At.getVersionNumber().toString(),c.header.platform=Ks,this.roleAuth&&(c.data.auth=this.roleAuth),c}crateLeavePackage(){return this.createBaseSendPackage("leavechannel")}createStatusPackage(c){let e=this.createBaseSendPackage("statusreport");return e.header.displayName=this.userName,e.data.status=c,e}createPublishPackage(){let c=this.createBaseSendPackage("publish");return c.data.users=[{}],this.roleAuth&&(c.data.auth=this.roleAuth),c}createRoleUpdatePackage(){let c=this.createBaseSendPackage("roleupdate");return c.header.displayName=this.userName,c}createReconnectPackage(c){let e=this.createBaseSendPackage("reconnect");return e.header.displayName=this.userName,e.header.clientversion=At.getVersionNumber().toString(),e.header.platform=Ks,e.data=Se(Se({},e.data),c!=null?c:{}),this.roleAuth&&(e.data.auth=this.roleAuth),e}createRefreshUrlPackage(){let c=this.createBaseSendPackage("refreshurl");return c.header.displayName=this.userName,c}createResponsePackage(c,e){return{version:1,code:200,tid:c,msgtype:e}}createBaseSendPackage(c){var t;return++this.seqIndex,{version:1,msgtype:c,tid:Vt(),header:{appid:this.authInfo.appId,channelid:this.authInfo.channelId,sessionid:(t=this.authInfo.sessionId)!=null?t:"",userid:this.authInfo.userId},data:{seq:this.seqIndex}}}}var ce=(s=>(s[s.ERR_JOIN_ALREADY_JOINED=16843521]="ERR_JOIN_ALREADY_JOINED",s[s.ERR_JOIN_BAD_APPID=33620481]="ERR_JOIN_BAD_APPID",s[s.ERR_JOIN_INVALID_APPID=33620482]="ERR_JOIN_INVALID_APPID",s[s.ERR_JOIN_BAD_CHANNEL=33620484]="ERR_JOIN_BAD_CHANNEL",s[s.ERR_JOIN_INVALID_CHANNEL=33620483]="ERR_JOIN_INVALID_CHANNEL",s[s.ERR_JOIN_BAD_TOKEN=33620485]="ERR_JOIN_BAD_TOKEN",s[s.ERR_JOIN_TIMEOUT=16908804]="ERR_JOIN_TIMEOUT",s[s.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD=16974081]="ERR_JOIN_ERR_JOIN_BAD_PARAMBAD",s[s.ERR_JOIN_CHANNEL_FAILED=16974338]="ERR_JOIN_CHANNEL_FAILED",s[s.ERR_LOG_ALREADY_INIT=16974085]="ERR_LOG_ALREADY_INIT",s[s.ERR_LOG_ROOT_PATH_ERROR=16974086]="ERR_LOG_ROOT_PATH_ERROR",s[s.ERR_MIC_OPEN_FAIL=17040388]="ERR_MIC_OPEN_FAIL",s[s.ERR_SPEAKER_OPEN_FAIL=17040389]="ERR_SPEAKER_OPEN_FAIL",s[s.ERR_MIC_INTERRUPT=17040390]="ERR_MIC_INTERRUPT",s[s.ERR_SPEAKER_INTERRUPT=17040391]="ERR_SPEAKER_INTERRUPT",s[s.ERR_MIC_AUTH_FAIL=17040392]="ERR_MIC_AUTH_FAIL",s[s.ERR_MIC_NOT_AVAILABLE=17040393]="ERR_MIC_NOT_AVAILABLE",s[s.ERR_SPEAKER_NO_AVAILABLE=17040400]="ERR_SPEAKER_NO_AVAILABLE",s[s.ERR_CAMERA_OPEN_FAIL=17039620]="ERR_CAMERA_OPEN_FAIL",s[s.ERR_CAMERA_INTERRUPT=17039622]="ERR_CAMERA_INTERRUPT",s[s.ERR_VIDEO_DISPLAY_OPEN_FAIL=17039873]="ERR_VIDEO_DISPLAY_OPEN_FAIL",s[s.ERR_VIDEO_DISPLAY_INTERRUPT=1064992]="ERR_VIDEO_DISPLAY_INTERRUPT",s[s.ERR_ICE_CONNECTION_CONNECT_FAIL=17105409]="ERR_ICE_CONNECTION_CONNECT_FAIL",s[s.ERR_ICE_CONNECTION_RECONNECT_FAI=17105410]="ERR_ICE_CONNECTION_RECONNECT_FAI",s[s.ERR_ICE_CONNECTION_MOBILITY_FAIL=17105411]="ERR_ICE_CONNECTION_MOBILITY_FAIL",s[s.ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT=16908812]="ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT",s[s.ERR_LATENCY_LIVE_COMMUNICATION_FAILED=17235971]="ERR_LATENCY_LIVE_COMMUNICATION_FAILED",s[s.ERR_LATENCY_LIVE_MEIDASETTING_FAILED=17235972]="ERR_LATENCY_LIVE_MEIDASETTING_FAILED",s[s.ERR_LATENCY_LIVE_NONE_BROADCASTER=17235973]="ERR_LATENCY_LIVE_NONE_BROADCASTER",s[s.ERR_LATENCY_LIVE_NEED_RESTART=17235974]="ERR_LATENCY_LIVE_NEED_RESTART",s[s.ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER=17235975]="ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER",s[s.ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE=17235976]="ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE",s[s.ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION=17235977]="ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION",s[s.ERR_SDK_PUBLISH_INVAILD=16974597]="ERR_SDK_PUBLISH_INVAILD",s[s.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL=16843782]="ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL",s[s.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED=16843856]="ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED",s[s.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED=16843857]="ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED",s[s.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED=16843858]="ERR_SDK_PUBLISH_DUAL_STRAM_FAILED",s[s.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED=16843859]="ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED",s[s.ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR=16843860]="ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR",s[s.ERR_SDK_SUBSCRIBE_INVAILD=16974852]="ERR_SDK_SUBSCRIBE_INVAILD",s[s.ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL=16844112]="ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL",s[s.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED=16844113]="ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED=16844114]="ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED=16844115]="ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED=16844116]="ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED",s[s.ERR_SDK_INVALID_STATE=16974340]="ERR_SDK_INVALID_STATE",s[s.ERR_INVALID_ARGUMENTS=16974083]="ERR_INVALID_ARGUMENTS",s[s.ERR_SESSION_REMOVED=33620229]="ERR_SESSION_REMOVED",s[s.ERR_SDK_UPDATE_ROLE_CHANNEL=16908801]="ERR_SDK_UPDATE_ROLE_CHANNEL",s[s.ERR_INNER=-1]="ERR_INNER",s[s.ERR_SDK_MPU_TASK_PUBLISH_OK=0]="ERR_SDK_MPU_TASK_PUBLISH_OK",s[s.ERR_SDK_MPU_TASK_STREAM_NOT_FOUND=17825793]="ERR_SDK_MPU_TASK_STREAM_NOT_FOUND",s[s.ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST=17825794]="ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST",s[s.ERR_SDK_MPU_TASK_INVALID_PARAM=17825795]="ERR_SDK_MPU_TASK_INVALID_PARAM",s[s.ERR_SDK_MPU_TASK_INTERNAL_ERROR=17825796]="ERR_SDK_MPU_TASK_INTERNAL_ERROR",s[s.ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR=17825797]="ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR",s[s.ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR=17825798]="ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR",s[s.ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT=17825799]="ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT",s[s.ERR_SDK_MPU_TASK_NOT_AUTHORIZED=17825800]="ERR_SDK_MPU_TASK_NOT_AUTHORIZED",s[s.ERR_SDK_CHANNEL_RELAY_STATE_ERROR=18874369]="ERR_SDK_CHANNEL_RELAY_STATE_ERROR",s[s.ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW=18874370]="ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW",s[s.ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED=18874371]="ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED",s[s.ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID=18874372]="ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID",s[s.ERR_SDK_CHANNEL_RELAY_ROLE_ERROR=18874373]="ERR_SDK_CHANNEL_RELAY_ROLE_ERROR",s[s.ERR_SDK_CHANNEL_RELAY_INVALID_PARAM=18874374]="ERR_SDK_CHANNEL_RELAY_INVALID_PARAM",s[s.ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR=18874375]="ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR",s))(ce||{});class ne extends Error{constructor(e,t,r){super(t);A(this,"_code");A(this,"_extra");this._code=e,this._extra=r}static fromError(e,t=-1,r=""){return new ne(t,e.message||e.reason||r||"error",e.extraInfo)}get code(){return this._code}set code(e){this._code=e}get reason(){return this.message}get extra(){return this._extra}}const Mc=3e4,ct=class ct extends ve{constructor(e,t,r,i,n,a){super();A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"slsReporter");A(this,"wsClient");A(this,"packageCreater");A(this,"keepAliveTimer",0);A(this,"packageCache",new Map);A(this,"isFirstConnect",!0);A(this,"aliveChecker",0);A(this,"reconnectData");this.authInfo=e,this.userName=t,this.packageCreater=new Nc(e,t),this.channelProfile=r,this.clientRole=i,this.slsReporter=n,this.wsClient=new cs(a),this.wsClient.on("onOpen",this.onOpen.bind(this)),this.wsClient.on("onMessage",this.onMessage.bind(this)),this.wsClient.on("onError",this.onError.bind(this)),this.wsClient.on("onClose",this.onClose.bind(this)),this.wsClient.on("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.on("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.on("onNetworkError",this.onNetworkError.bind(this)),this.wsClient.on("onReconnectStart",this.onReconnectStart.bind(this)),this.wsClient.on("onReconnectFail",this.onReconnectFail.bind(this))}get retryCount(){return this.wsClient.connectRetryCount}start(e){this.wsClient.start(e)}startKeepAlive(){this.keepAliveTimer===0&&(this.keepAliveTimer=window.setInterval(()=>{let e=this.packageCreater.createKeepAlivePackage();this.sendPackage(e)},5e3)),this.checkAlive()}stopKeepAlive(){this.keepAliveTimer!==0&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=0),this.aliveChecker&&(window.clearTimeout(this.aliveChecker),this.aliveChecker=0)}sendPkgCache(){this.packageCache.forEach(e=>{this.wsClient.send(e)})}leave(){let e=this.packageCreater.crateLeavePackage();this.sendPackage(e)}reportStatus(e){let t=this.packageCreater.createStatusPackage(e);this.sendPackage(t)}publish(e){let t=this.packageCreater.createPublishPackage();t.data.users=[],e.subscribe.signal=this.wsClient.connectUrl;const{tracks:r,resume:i}=e;r.forEach(n=>{const{codec:a,ssrc:o}=n;n.userdata=JSON.stringify({codec:a}),n.ssrc=`${o}`,i&&(n.attr={reason:"reconnect"})}),t.data.users.push(e),this.sendPackage(t)}roleUpdate(e){let t=this.packageCreater.createRoleUpdatePackage();t.data.clientrole=e,this.sendPackage(t)}refreshUrl(e){const t=this.packageCreater.createRefreshUrlPackage();t.data=Se(Rt(Se({},t.data),{sessionid:t.header.sessionid}),e),this.sendPackage(t)}refreshAuthInfo(e){this.authInfo=e,this.packageCreater.refreshAuthInfo(e)}close(){oe.info(`[${ct.logName}] close`),this.stopKeepAlive(),this.wsClient.off("onOpen",this.onOpen.bind(this)),this.wsClient.off("onMessage",this.onMessage.bind(this)),this.wsClient.off("onError",this.onError.bind(this)),this.wsClient.off("onClose",this.onClose.bind(this)),this.wsClient.off("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.off("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.off("onReconnectStart"),this.wsClient.off("onReconnectFail"),this.wsClient.close()}sendPackage(e){[Oe.KEEPALIVE,Oe.RECONNECT,Oe.JOINCHANNEL].includes(e.msgtype)||this.packageCache.set(e.tid,e),this.wsClient.send(e),e.msgtype!==Oe.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!0,e.msgtype,e.tid,e)}updateReconnectData(e){this.reconnectData=e}onOpen(){if(oe.info(`[${ct.logName}] onOpen`),this.isFirstConnect){let e=this.packageCreater.createJoinPackage();e.data.configure={channelprofile:this.channelProfile},(this.channelProfile===It.AliRtcSdkInteractiveLive||this.channelProfile===It.AliRtcSdkInteractiveWithLowLatencyLive)&&(e.data.configure.clientrole=this.clientRole),this.sendPackage(e)}else{this.stopKeepAlive();const e=this.packageCreater.createReconnectPackage(this.reconnectData);this.sendPackage(e)}}onMessage(e){try{let t=JSON.parse(e.data);this.packageCache.delete(t.tid),this.onRecvMessage(t),t!=null&&t.msgtype&&(t==null?void 0:t.msgtype)!==Oe.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!1,t.msgtype,t.tid,t)}catch(t){oe.warn(`[${ct.logName}] onMessage err`,t,e)}}onError(e){oe.warn(`[${ct.logName}] onError`,e),this.isFirstConnect&&this.onConnectFail()}onConnectFail(){oe.warn(`[${ct.logName}] onConnectFail`);const e=new ne(ce.ERR_INNER,"Signaling connect failed.");this.isFirstConnect?this.emit("onJoinChannelResult",e):this.emit("onConnectFail",e)}onAuthInvalid(){oe.warn(`[${ct.logName}] onAuthInvalid`),this.isFirstConnect&&this.emit("onAuthInvalid")}onNetworkError(){oe.warn(`[${ct.logName}] onNetworkError`);const e=new ne(ce.ERR_INNER,"Network error, signaling connect failed.");this.emit("onNetworkError",e)}onClose(e){oe.info(`[${ct.logName}] onClose`,e),this.stopKeepAlive()}onKeepAliveRsp(){this.emit("onKeepAliveRsp"),this.checkAlive()}onReconnectStart(){this.emit("onReconnectStart")}onReconnectFail(){this.emit("onReconnectFail",new ne(ce.ERR_INNER,"signaling reconnect failed."))}checkAlive(){window.clearTimeout(this.aliveChecker),this.aliveChecker=window.setTimeout(()=>{oe.info(`[${ct.logName}] not alive, reconnect`),this.stopKeepAlive(),this.emit("onReconnectStart"),this.wsClient.reconnect()},Mc)}onRecvMessage(e){switch(e.msgtype!==Oe.KEEPALIVE&&oe.info(`[${ct.logName}] recv msg: ${e.msgtype}`),e.msgtype){case Oe.JOINCHANNEL:this.onJoinResult(e);break;case Oe.KEEPALIVE:this.onKeepAliveRsp();break;case Oe.PUBLISH:this.onPublishResult(e);break;case Oe.NOTIFYJOIN:this.onNotifyJoin(e);break;case Oe.NOTIFYSTATUS:this.onNotifyStatus(e);break;case Oe.LEAVECHANNEL:this.onLeaveResult(e);break;case Oe.NOTIFYLEAVE:this.onNotifyLeave(e);break;case Oe.NOTIFYPUBLISH:this.onNotifyPublish(e);break;case Oe.STATUSREPORT:this.onStatusReport(e);break;case Oe.BYE:this.onBye(e);break;case Oe.ROLEUPDATE:this.onRoleUpdateResult(e);break;case Oe.REFRESHURL:this.onRefreshUrlResult(e);break;case Oe.RECONNECT:this.onReconnectResult(e);break}}onJoinResult(e){this.isFirstConnect=!1,this.emit("onJoinChannelResult",e)}onLeaveResult(e){this.emit("onLeaveResult",e.code,e.tid)}onPublishResult(e){this.emit("onPublishResult",e.code,e.tid,e.description)}onRoleUpdateResult(e){this.emit("onRoleUpdateResult",e.code,e.tid,e.description)}onRefreshUrlResult(e){this.emit("onRefreshUrlResult",e)}onReconnectResult(e){if(e.code===200)this.sendPkgCache(),this.startKeepAlive(),this.emit("onReconnectSuccess",e.data.users);else{const t=new ne(ce.ERR_INNER,`reconnect failed, code: ${e.code};description: ${e.description}`);e.code===403&&(t.code=403),this.emit("onReconnectFail",t),this.close()}}onNotifyJoin(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e&&e.data&&e.data.users&&this.emit("onNotifyJoin",e.data.users)}onNotifyStatus(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.status&&e.data.status.length&&this.emit("onNotifyStatus",e.data.status)}onNotifyLeave(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.users&&e.data.users.length&&this.emit("onNotifyLeave",e.data.users)}onNotifyPublish(e){let t=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(t),e.data&&e.data.users&&e.data.users.length&&this.emit("onNotifyPublish",e.data.users)}onStatusReport(e){this.emit("onStatusReport",e.code,e.tid,e.description)}onBye(e){this.stopKeepAlive(),this.emit("onBye",e.reason,e.description)}};A(ct,"logName","RSMessageCenter");let us=ct;const j=(s,c)=>(e,t,r)=>{const i=r.value;return r.value=function(...n){var v;const a=`[${((v=e.constructor)==null?void 0:v.logName)||""}]`,o=Date.now();let u=[];if(s)try{u=s(n)}catch(f){}oe.interface(a,t,...u);const h=i.apply(this,n);return Promise.resolve(h).then(f=>f).catch(f=>f).then(f=>{var m;let d="";const p=f instanceof Error,l=p&&((m=e.constructor)==null?void 0:m.logError);if(!(!c&&!p)){if(l)d=f;else if(p)d=f.message||"";else if(c)if(f===void 0)d="";else try{d=c(f)}catch(x){}else return;oe.interfaceResult(a,t,!(p&&l),`${Date.now()-o}ms`,d)}}),h},r},ae=s=>s;var Fc=Object.defineProperty,Oc=Object.getOwnPropertyDescriptor,hs=(s,c,e,t)=>{for(var r=t>1?void 0:t?Oc(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&Fc(c,e,r),r};const Li=(it=class extends ve{constructor(e,t,r,i=Ct.prod){super();A(this,"messageCenter");A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"slsReporter");A(this,"reconnectData");A(this,"roomServerUri","");this.channelProfile=e,this.clientRole=t,this.slsReporter=r,this.reconnectData={role:{channelprofile:e,clientrole:t}};const n=i===Ct.pre?Ai.pre:Ai.prod;this.roomServerUri=`wss://${n}/roomserver/v1/ws`}updateReconnectData(e){var t;this.reconnectData=e,(t=this.messageCenter)==null||t.updateReconnectData(this.reconnectData)}reset(){oe.info("[roomsig] reset"),this.messageCenter&&(this.messageCenter.close(),this.messageCenter=void 0),this.authInfo=void 0}join(e,t,r){return z(this,null,function*(){return new Promise((i,n)=>{const a={};this.authInfo=e,this.userName=t,this.messageCenter=new us(e,t,this.channelProfile,this.clientRole,this.slsReporter,r),this.initMessageCenter(),this.messageCenter.once("onJoinChannelResult",u=>{var h,v,f;if(oe.info(`[${it.logName}]`,"join result: ",u),a.taskretrynum=((h=this.messageCenter)==null?void 0:h.retryCount)||0,u.code==200){(v=this.messageCenter)==null||v.sendPkgCache(),(f=this.messageCenter)==null||f.startKeepAlive();let d=u.data;d.tid=u.tid,d.users=u.data.users,d.timestamp=u.timestamp,a.est&&(a.joinconnecttc=Date.now()-a.est),this.slsReporter.reportJoinConnection(a),i(d)}else this.reset(),n(this.handleSignalError(u.code,u.reason,ce.ERR_JOIN_CHANNEL_FAILED))}),this.messageCenter.once("onAuthInvalid",()=>{this.reset(),n(new ne(ce.ERR_JOIN_BAD_TOKEN,"join failed because authentication failed"))}),oe.info(`[${it.logName}]`,"start ws connecting roomserver and auto join when connected");const o={appid:this.authInfo.appId,callid:this.authInfo.sessionId,channelid:this.authInfo.channelId,userid:this.authInfo.userId,nonce:this.authInfo.nonce||"",timestamp:this.authInfo.timestamp,token:this.authInfo.token,authtype:"app",tid:Vt()};e.role&&(o.tokenrole=e.role),a.est=Date.now(),this.messageCenter.start(this.roomServerUri+"?"+At.queryingParam(o))})})}leave(){return oe.info("[roomsig] leave .."),new Promise((e,t)=>{this.messageCenter?(this.messageCenter.on("onLeaveResult",(r,i)=>{oe.info(`[${it.logName}]`,"recv leave response "+r),r===200?(this.updateReconnectData(),this.reset(),e({tid:i})):t(this.handleSignalError(r,"leave error"))}),oe.info(`[${it.logName}]`,"send leave request"),this.messageCenter.leave()):(oe.info(`[${it.logName}]`,"no message center, ok to leave"),e({tid:""}))})}publish(e){return new Promise((t,r)=>{var i;this.messageCenter?(this.messageCenter.once("onPublishResult",(n,a,o)=>{oe.info(`[${it.logName}]`,"recv pubish response "+n),n===200?(this.updateReconnectData(Rt(Se({},this.reconnectData),{publish:{users:[e]}})),t({tid:a})):r(this.handleSignalError(n,`publish error, ${o}`))}),this.authInfo&&(e.sessionid=(i=this.authInfo.sessionId)!=null?i:""),e.callid||(e.callid=Vt()),oe.info(`[${it.logName}]`,"assign callid "+e.callid+" and send publish request"),this.messageCenter.publish(e)):r(this.handleSignalError(-1,"publish error, no message center"))})}roleUpdate(e){return new Promise((t,r)=>{if(!this.messageCenter){r(this.handleSignalError(-1,"role update error, no message center"));return}this.messageCenter.on("onRoleUpdateResult",(i,n,a)=>{var o,u;oe.info(`[${it.logName}]`,"recv role update response "+i),i===200?((u=(o=this.reconnectData)==null?void 0:o.role)!=null&&u.clientrole&&(this.reconnectData.role.clientrole=e,this.updateReconnectData(this.reconnectData)),t({tid:n})):r(this.handleSignalError(i,`role update error, ${a}`))}),this.messageCenter.roleUpdate(e)})}setChannelProfile(e){this.channelProfile=e}refreshUrl(e){return oe.info(`[${it.logName}]`,"refreshUrl .."),new Promise((t,r)=>{if(!this.messageCenter){r(this.handleSignalError(-1,"refresh url error, no message center"));return}this.messageCenter.on("onRefreshUrlResult",i=>{const{code:n,description:a,data:o={}}=i||{};oe.info("recv refresh url response "+n),n===200?t(o):r(this.handleSignalError(n,`refresh url error, ${a}`))}),oe.info("send refresh url request"),this.messageCenter.refreshUrl(e)})}reportStatus(e){return oe.info(`[${it.logName}]`,"reportStatus "+e),new Promise((t,r)=>{this.messageCenter?(this.messageCenter.once("onStatusReport",(i,n)=>{i===200?t():r(new ne(i,n))}),this.messageCenter.reportStatus(e)):r(new ne(-1,"No messageCenter"))})}handleSignalError(e,t,r=ce.ERR_INNER){const i=`signal error: code - ${e}; description - ${t}`;return new ne(r,i)}refreshAuthInfo(e){return z(this,null,function*(){var t;this.authInfo&&(this.authInfo=e,(t=this.messageCenter)==null||t.refreshAuthInfo(this.authInfo))})}initMessageCenter(){var e,t,r,i,n,a,o,u,h,v,f,d;(e=this.messageCenter)==null||e.on("onKeepAliveRsp",()=>{this.emit("onKeepAliveRsp")}),(t=this.messageCenter)==null||t.on("onNotifyJoin",p=>{this.emit("onNotifyJoin",p)}),(r=this.messageCenter)==null||r.on("onNotifyStatus",p=>{this.emit("onNotifyStatus",p)}),(i=this.messageCenter)==null||i.on("onNotifyLeave",p=>{this.emit("onNotifyLeave",p)}),(n=this.messageCenter)==null||n.on("onNotifyPublish",p=>{this.emit("onNotifyPublish",p)}),(a=this.messageCenter)==null||a.on("onBye",(p,l)=>{this.emit("onBye",p,l)}),(o=this.messageCenter)==null||o.on("onReconnectStart",()=>{this.emit("onReconnectStart")}),(u=this.messageCenter)==null||u.on("onReconnectSuccess",p=>{this.emit("onReconnectSuccess",p)}),(h=this.messageCenter)==null||h.on("onReconnectFail",p=>{this.emit("onReconnectFail",p)}),(v=this.messageCenter)==null||v.on("onConnectFail",p=>{this.emit("onConnectFail",p),this.reset()}),(f=this.messageCenter)==null||f.on("onNetworkError",p=>{this.emit("onNetworkError",p)}),(d=this.messageCenter)==null||d.on("onAuthInvalid",()=>{this.emit("onAuthInvalid")})}},A(it,"logName","RoomServerSignaling"),it);hs([j()],Li.prototype,"join",1),hs([j()],Li.prototype,"publish",1),hs([j()],Li.prototype,"roleUpdate",1);let Vc=Li;const Uc="https://pgw.rtn.aliyuncs.com",zc="https://gw.rtn.aliyuncs.com",sa=10*60*1e3,Hc=12,Si=class Si extends ve{constructor(e,t){super();A(this,"env");A(this,"authInfo");A(this,"timer");A(this,"slsReporter");A(this,"expiration",0);A(this,"skipTime",0);A(this,"requestToken",()=>z(this,null,function*(){if(this.skipTime=0,!this.authInfo)return;const{appId:e,channelId:t,userId:r,nonce:i="",token:n,timestamp:a,sessionId:o,role:u}=this.authInfo;let h=zc;this.env===Ct.pre&&(h=Uc);const v=`${h}/gslb/v1/stsupdate?appid=${e}&channelid=${t}&userid=${r}&nonce=${i}&token=${n}×tamp=${a}&session=${o}${u?`&tokenrole=${u}`:""}&slstoken=true&osstoken=true&tokensid=false`;fetch(v).then(f=>f.json()).then(f=>{var d,p;if(f.code===0){const l=(d=f.data)==null?void 0:d.oss,m=(p=f.data)==null?void 0:p.sls;return this.expiration=l.expiration||m.expiration,this.emit("onTokenUpdate",l,m),oe.event(`[${Si.logName}]`,"getToken",l,m),f}this.slsReporter.reportSTSResult(200)}).catch(f=>{this.slsReporter.reportSTSResult(-1),oe.error(`[${Si.logName}]`,"getToken",f.message)})}));this.slsReporter=e,this.env=t}refreshAuthInfo(e){this.authInfo=e}startSTSUpdate(e){this.authInfo=e,this.requestToken(),this.timer&&clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.expiration&&Math.floor((Date.now()+sa*1.5)/1e3)<this.expiration&&this.skipTime<Hc){this.skipTime+=1;return}this.requestToken()},sa)}clear(){this.timer&&clearInterval(this.timer)}};A(Si,"logName","StsManager");let ls=Si;class jc extends ve{constructor(e,t,r,i=Ct.prod){super();A(this,"signaling");A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"env",Ct.prod);A(this,"maxConnectRetryCount");A(this,"stsManager");A(this,"slsReporter");this.channelProfile=e,this.clientRole=t,this.env=i,this.slsReporter=r,this.stsManager=new ls(r,i)}reset(){var e;oe.info("[signalingmanager] reset"),(e=this.signaling)==null||e.reset(),this.stsManager.clear(),this.signaling=void 0,this.authInfo=void 0}join(e,t=e.userId,r,i){return this.maxConnectRetryCount=r,this.userName=t,new Promise((n,a)=>{this.signaling?a(new ne(ce.ERR_JOIN_ALREADY_JOINED,"already joined")):(oe.info("[signalingmanager] create signaling"),this.signaling=new Vc(this.channelProfile,this.clientRole,this.slsReporter,this.env),this.initSignaling(),i&&(i.rs=Date.now()),this.signaling.join(e,t,r).then(o=>{this.authInfo=e,i&&(i.re=Date.now()),n(o)}).catch(o=>{this.reset(),a(o)}),this.stsManager.startSTSUpdate(e))})}retryJoin(){const e=this.authInfo;this.reset(),e&&this.join(e,this.userName,this.maxConnectRetryCount)}leave(){return new Promise((e,t)=>{this.signaling?this.signaling.leave().then(r=>{this.reset(),e(r)}).catch(r=>{t(r)}):e({tid:""})})}publish(e){return new Promise((t,r)=>{var i;this.signaling&&this.authInfo?(e.userid=this.authInfo.userId,e.displayname=(i=this.userName)!=null?i:this.authInfo.userId,this.signaling.publish(e).then(n=>{t(n)}).catch(n=>{r(n)})):r(new ne(ce.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL,"no signaling"))})}reportStatus(e){return new Promise((t,r)=>{this.signaling?this.signaling.reportStatus(e).then(()=>{t()}).catch(i=>{r(i)}):r(new ne(-1,"no signaling"))})}setClientRole(e){return z(this,null,function*(){const t=this.clientRole;if(!this.signaling){this.clientRole=e;return}const r=Date.now();try{const i=yield this.signaling.roleUpdate(e);return this.slsReporter.reportRoleUpdateResult(t,e,Date.now()-r,0),i}catch(i){this.slsReporter.reportRoleUpdateResult(t,e,Date.now()-r,i.code||-1)}})}setChannelProfile(e){this.signaling?this.signaling.setChannelProfile(e):this.channelProfile=e}refreshUrl(e){return this.signaling?this.signaling.refreshUrl(e):Promise.reject(new ne(ce.ERR_SDK_INVALID_STATE,"should join first"))}refreshAuthInfo(e){return z(this,null,function*(){var t;try{this.authInfo&&(this.authInfo=Se(Se({},this.authInfo),e),(t=this.signaling)==null||t.refreshAuthInfo(this.authInfo),this.stsManager.refreshAuthInfo(this.authInfo))}catch(r){throw r}})}initSignaling(){var e,t,r,i,n,a,o,u,h,v,f,d,p;(e=this.signaling)==null||e.on("onKeepAliveRsp",this.onKeepAliveRsp.bind(this)),(t=this.signaling)==null||t.on("onNotifyJoin",this.onNotifyJoin.bind(this)),(r=this.signaling)==null||r.on("onNotifyStatus",this.onNotifyStatus.bind(this)),(i=this.signaling)==null||i.on("onNotifyLeave",this.onNotifyLeave.bind(this)),(n=this.signaling)==null||n.on("onNotifyPublish",this.onNotifyPublish.bind(this)),(a=this.signaling)==null||a.on("onBye",this.onBye.bind(this)),(o=this.signaling)==null||o.on("onReconnectStart",this.onReconnectStart.bind(this)),(u=this.signaling)==null||u.on("onReconnectSuccess",this.onReconnectSuccess.bind(this)),(h=this.signaling)==null||h.on("onReconnectFail",this.onReconnectFail.bind(this)),(v=this.signaling)==null||v.on("onConnectFail",this.onConnectFail.bind(this)),(f=this.signaling)==null||f.on("onNetworkError",this.onNetworkError.bind(this)),(d=this.signaling)==null||d.on("onAuthInvalid",this.onAuthInvalid.bind(this)),(p=this.signaling)==null||p.on("onError",this.onError.bind(this))}onKeepAliveRsp(){this.emit("onKeepAliveRsp")}onNotifyJoin(e){this.emit("onNotifyJoin",e)}onNotifyStatus(e){this.emit("onNotifyStatus",e)}onNotifyLeave(e){this.emit("onNotifyLeave",e)}onNotifyPublish(e){this.emit("onNotifyPublish",e)}onBye(e,t){this.emit("onBye",e,t)}onConnectFail(e){this.reset(),this.emit("onConnectFail",e)}onNetworkError(e){this.emit("onNetworkError",e)}onAuthInvalid(e){}onReconnectStart(){this.emit("onReconnectStart")}onReconnectSuccess(e){this.emit("onReconnectSuccess",e)}onReconnectFail(e){this.emit("onReconnectFail",e)}onError(e){this.emit("onError",e)}}const Jt=class Jt{static getInstance(){return Jt.instance||(Jt.instance=new AudioContext),Jt.instance.resume(),Jt.instance}};A(Jt,"instance");let ds=Jt;function Wc(s,c,e,t,r){let i=t,n=0,a;const o=s.createAnalyser();o.fftSize=256;const u=new Uint8Array(o.frequencyBinCount);c.connect(o),o.connect(e);const h=()=>{a&&window.clearInterval(a)},v=()=>{a=window.setInterval(()=>{o.getByteFrequencyData(u);let f=Math.round(u.reduce((d,p)=>d+p)/u.length);f=Math.min(100,f),n=f,r&&r(f)},i)};return v(),{updateInterval:f=>{h(),i=f,v()},getLevel:()=>n,dispose:()=>{h(),c.disconnect(),o.disconnect()}}}class Kc extends ve{constructor(){super();A(this,"audioContext");A(this,"stream");A(this,"sourceNode");A(this,"analyser");this.audioContext=ds.getInstance(),this.stream=new MediaStream}getLevel(){return this.analyser?this.analyser.getLevel():0}start(e,t=1e3){this.sourceNode&&this.stop(),this.stream.addTrack(e),this.sourceNode=this.audioContext.createMediaStreamSource(this.stream);const r=this.audioContext.createMediaStreamDestination();this.analyser=Wc(this.audioContext,this.sourceNode,r,t,i=>{this.emit("audioLevel",i)})}stop(){this.analyser&&this.analyser.dispose(),this.analyser=void 0,this.sourceNode=void 0,this.stream.getAudioTracks().forEach(e=>{this.stream.removeTrack(e)})}dispose(){this.stop()}}class na extends ve{constructor(e,t,r,i){super();A(this,"uid");A(this,"name");A(this,"rtsManager");A(this,"callId","");A(this,"audioLevelMonitor");A(this,"audioVolumeIndicationInterval",0);this.uid=e,this.name=t,this.rtsManager=r,this.audioVolumeIndicationInterval=i,this.audioLevelMonitor=new Kc}get userId(){return this.uid}get displayname(){return this.name}createCallId(){this.callId||(this.callId=At.createCallid())}setUserInfo(e,t){this.uid=e,this.name=t}refreshUserInfo(e){this.uid=e}getAudioLevel(){return this.audioLevelMonitor.getLevel()}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval=e}clear(){this.audioLevelMonitor.dispose()}}class aa{static getCurrentStatus(c){let e=0;c.micOpen&&(e+=1),c.micInterrupted&&(e+=2),c.cameraOpen&&(e+=4),c.screenShare&&(e+=128),c.audioDisable&&(e+=8),c.videoDisable&&(e+=16),c.screenDisable&&(e+=256);let t=e.toString(16);for(;t.length<16;)t="0"+t;return t}static parseStatus(c){let e=parseInt(c,16);return{micOpen:!!(e&1),micInterrupted:!!(e&2),cameraOpen:!!(e&4),screenShare:!!(e&128),audioDisable:!!(e&8),videoDisable:!!(e&16),screenDisable:!!(e&256),backgroundMode:!!(e&32),accompanyPlaying:!!(e&64)}}}const oa="customVideoProfile",ca="customScreenProfile",mi={width:1280,height:720,frameRate:30,maxBitrate:2e3},gi={width:1920,height:1080,frameRate:30,maxBitrate:2600},$c={1e4:Fe.AliEngineLocalDeviceExceptionTypeUnknown,2e4:Fe.AliEngineLocalDeviceExceptionTypeUnknown,10001:Fe.AliEngineLocalDeviceExceptionTypeMicNotAvailable,10002:Fe.AliEngineLocalDeviceExceptionTypeMicAuthFail,10003:Fe.AliEngineLocalDeviceExceptionTypeMicOpenFail,10005:Fe.AliEngineLocalDeviceExceptionTypeCameraAuthFail,10004:Fe.AliEngineLocalDeviceExceptionTypeVideoDeviceException,10006:Fe.AliEngineLocalDeviceExceptionTypeCameraOpenFail,10010:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10011:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10012:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10013:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10014:Fe.AliEngineLocalDeviceExceptionTypeDisplayException,10019:Fe.AliEngineLocalDeviceExceptionTypeDisplayException},qc=s=>s.getAudioTracks()[0];function ua(s){var c;if(((c=s==null?void 0:s.nodeName)==null?void 0:c.toLowerCase())==="video")return s.setAttribute("playsinline",""),s;if(typeof s=="string"){let e=document.getElementById(s);if(e){if(e.nodeName.toLocaleLowerCase()==="video")return e.setAttribute("playsinline",""),e;throw new ne(ce.ERR_INVALID_ARGUMENTS,"element should be HtmlVideoElement")}else throw new ne(ce.ERR_INVALID_ARGUMENTS,"element not founded")}else throw new ne(ce.ERR_INVALID_ARGUMENTS,"element id should be string")}function fs(s){var e;const c=[];if(Array.isArray(s))s.forEach(t=>{try{c.push(ua(t))}catch(r){}});else if(typeof s=="string"||((e=s==null?void 0:s.nodeName)==null?void 0:e.toLowerCase())==="video")try{c.push(ua(s))}catch(t){}return c}function $t(s){return new Promise(c=>setTimeout(c,s))}const ha=(s,c)=>{const e=()=>(s.muted=!0,Promise.race([$t(500),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{let t;return s.srcObject!==c?(s.load(),s.srcObject=c,t=s.play(),s._playPromise=t):t=Promise.resolve(),t}));return new Promise(t=>{if(me.AliRTS.BrowserUtil.isMicroMessenger){const r=window.top!==window.self,i=window.WeixinJSBridge||window.top.WeixinJSBridge;i?i.invoke("getNetworkType",{},()=>{t(e())}):(r?window.top.document:document).addEventListener("WeixinJSBridgeReady",()=>{i.invoke("getNetworkType",{},()=>{t(e())})}),setTimeout(()=>{t(e())},1e3)}else t(e())})},Bt=s=>{Promise.race([$t(100),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{s.srcObject=null,s._playPromise=void 0})};var Gc=Object.defineProperty,Jc=Object.getOwnPropertyDescriptor,ze=(s,c,e,t)=>{for(var r=t>1?void 0:t?Jc(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&Gc(c,e,r),r};const la=30;class Ni extends ve{constructor(){super();A(this,"state");A(this,"time");this.state=be.AliRtcStatePublishIdle,this.time=Date.now()}setState(e){const t=this.state,r=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-r)/1e3))}}const Ve=(Lt=class extends na{constructor(e){const{rtsManager:t,localStreamManager:r,slsReporter:i,signalingManager:n,audioVolumeIndicationInterval:a}=e;super("","",t,a);A(this,"url","");A(this,"joinTime",0);A(this,"_isPublishing",!1);A(this,"publishPromise",Promise.resolve(""));A(this,"previewElements",[]);A(this,"screenPreviewElements",[]);A(this,"streamManager");A(this,"streamTracks");A(this,"publishId",Vt());A(this,"signalingManager");A(this,"traceId","");A(this,"monitorTimerId");A(this,"monitorDataCache",{});A(this,"trackTraceIdMap",{});A(this,"candidateDataCache",[]);A(this,"pcMediaStatsMap",{});A(this,"slsReporter");A(this,"audioPubState");A(this,"videoPubState");A(this,"videoSmallPubState");A(this,"screenPubState");A(this,"onTrackEnd",e=>{this.emit(e)});this.streamManager=r,this.signalingManager=n,this.slsReporter=i,this.streamManager.on("trackended",o=>{this.onTrackEnd(o)}),this.streamManager.on("publishupdate",()=>{this.publishUpdate()}),this.audioPubState=new Ni,this.audioPubState.on("change",(o,u,h)=>{this.emit("audioPublishStateChanged",o,u,h)}),this.videoPubState=new Ni,this.videoPubState.on("change",(o,u,h)=>{this.emit("videoPublishStateChanged",o,u,h)}),this.videoSmallPubState=new Ni,this.videoSmallPubState.on("change",(o,u,h)=>{this.emit("dualStreamPublishStateChanged",o,u,h)}),this.screenPubState=new Ni,this.screenPubState.on("change",(o,u,h)=>{this.emit("screenPublishStateChanged",o,u,h)}),this.startStreamMonitor()}get joined(){return!!this.uid}get isPublishing(){return this._isPublishing}get publishStreams(){return this.streamManager.publishStreams}get cameraTrack(){return this.streamManager.cameraStreamInfo.originVideoTrack}get screenTrack(){return this.streamManager.screenStreamInfo.originVideoTrack}get audioTrack(){return this.streamManager.cameraStreamInfo.originAudioTrack}get hasCamera(){return!!this.streamManager.cameraStreamInfo.originVideoTrack}get hasMicrophone(){return!!this.streamManager.cameraStreamInfo.originAudioTrack}get hasScreenShare(){return!!this.streamManager.screenStreamInfo.originVideoTrack}get hasCameraTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:i})=>r==="video"&&t&&i===Z.VideoLarge))}get hasCameraDualTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:i})=>r==="video"&&t&&i===Z.VideoSmall))}get hasScreenTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:i})=>r==="video"&&t&&i===Z.Screen))}get hasAudioTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:r,msid:i})=>r==="audio"&&t&&i===Z.Audio))}get cameraDirection(){var e,t;return(t=(e=this.streamManager.cameraStreamInfo)==null?void 0:e.cameraVideoConstraints)==null?void 0:t.facingMode}get audioCaptureDisabled(){return this.streamManager.audioCaptureDisabled}get cameraCaptureDisabled(){return this.streamManager.cameraCaptureDisabled}get publishLocalVideoStreamEnabled(){return this.streamManager.publishLocalVideoStreamEnabled}get publishLocalAudioStreamEnabled(){return this.streamManager.publishLocalAudioStreamEnabled}get publishLocalScreenStreamEnabled(){return this.streamManager.publishLocalScreenStreamEnabled}setPublishLocalAudioStreamEnabled(e){this.streamManager.publishLocalAudioStreamEnabled=e}setPublishLocalVideoStreamEnabled(e){this.streamManager.publishLocalVideoStreamEnabled=e}setPublishLocalScreenStreamEnabled(e){this.streamManager.publishLocalScreenStreamEnabled=e}initInfo(e,t){this.joinTime=Date.now(),this.rtsManager.localJoinTime=this.joinTime,this.setUserInfo(e.userId,e.userId),this.url=t,this.callId=e.sessionId||At.createCallid(),this.updatePubId()}setVideoProfile(e,t){return z(this,null,function*(){yield this.streamManager.setVideoProfile(e,t)})}setVideoContentHint(e){this.streamManager.setVideoContentHint(e)}setScreenContentHint(e){this.streamManager.setScreenContentHint(e)}setAudioProfile(e){return z(this,null,function*(){yield this.streamManager.setAudioProfile(e)})}setScreenProfile(e,t){return z(this,null,function*(){yield this.streamManager.setScreenProfile(e,t)})}setCameraDirection(e){if(e===pi.CAMERA_FRONT)this.streamManager.setCameraVideoConstraints({facingMode:"user"});else if(e===pi.CAMERA_REAR)this.streamManager.setCameraVideoConstraints({facingMode:"environment"});else throw new ne(ce.ERR_CAMERA_OPEN_FAIL,`camera direction set to ${e} failed`)}setCameraDeviceId(e){this.streamManager.setCameraVideoConstraints({deviceId:e})}muteLocalCamera(e){this.streamManager.setCameraMuted(e),this.slsReporter.reportMute(this.callId,!e,"video")}muteLocalMic(e){this.streamManager.setAudioMuted(e),this.slsReporter.reportMute(this.callId,!e,"audio")}muteLocalScreen(e){this.streamManager.setScreenMuted(e),this.slsReporter.reportMute(this.callId,!e,"screen")}setMicrophoneDeviceId(e){this.streamManager.setMicAudioConstraints({deviceId:e})}updatePubId(){this.publishId=Vt()}clearPublishState(){this.streamTracks=void 0}clear(){return z(this,null,function*(){As(Lt.prototype,this,"clear").call(this),this._isPublishing&&(yield this.unPublish()),this.stopPreview(),this.resetPreviewElements(),this.resetSecondayPreviewElements(),this.clearStream(),this.streamManager.cameraCaptureDisabled=!1})}resetElement(e){this.previewElements.includes(e)&&(Bt(e),this.previewElements.splice(this.previewElements.indexOf(e),1)),this.screenPreviewElements.includes(e)&&(Bt(e),this.screenPreviewElements.splice(this.screenPreviewElements.indexOf(e),1))}setPreviewElement(e){const{videoElement:t,screen:r}=e;r?this.screenPreviewElements.includes(t)||this.screenPreviewElements.push(t):this.previewElements.includes(t)||this.previewElements.push(t)}setViewConfig(e,t){if(!e){t===Ae.AliRtcVideoTrackCamera?this.stopPreview({primary:!0,screen:!1}):this.stopPreview({primary:!1,screen:!0});return}if(![Ae.AliRtcVideoTrackCamera,Ae.AliRtcVideoTrackScreen].includes(t))throw new ne(ce.ERR_INVALID_ARGUMENTS,"set view config invalid track",{track:t});e.forEach(r=>{this.setPreviewElement({videoElement:r,screen:t===Ae.AliRtcVideoTrackScreen})})}startCameraCapture(e){return z(this,null,function*(){return this.streamManager.cameraCaptureDisabled=!1,yield this.createLocalStream(e)})}stopCameraCapture(){return z(this,null,function*(){this.streamManager.cameraCaptureDisabled=!0,yield this.stopLocalStream({video:!0})})}stopAudioCapture(){return z(this,null,function*(){this.streamManager.audioCaptureDisabled=!0,yield this.stopLocalStream({audio:!0})})}preview(e){return z(this,null,function*(){const{videoElement:t,screen:r}=e!=null?e:{};try{let i=r?this.streamManager.screenStreamInfo.previewStream:this.streamManager.cameraStreamInfo.previewStream;if(!t)throw new ne(ce.ERR_INVALID_ARGUMENTS,"no video element found",{videoElement:t});if(!i){oe.info(`[${Lt.logName}]`,"preview no stream founded");return}return ha(t,i.mediaStream),this.setPreviewElement(e),i.mediaStream}catch(i){const n=ce.ERR_INNER;throw ne.fromError(i,n,"preview failed")}})}previewAll(e){return z(this,null,function*(){const{primary:t=!0,screen:r=!0}=e!=null?e:{};if(t&&this.previewElements.length)for(let i=0;i<this.previewElements.length;i++){const n=this.previewElements[i];yield this.preview({videoElement:n})}if(r&&this.screenPreviewElements.length)for(let i=0;i<this.screenPreviewElements.length;i++){const n=this.screenPreviewElements[i];yield this.preview({videoElement:n,screen:!0})}})}stopPreview(e){const{videoElement:t,primary:r=!0,screen:i=!0}=e||{};if(!t)r&&(this.previewElements.forEach(n=>{Bt(n)}),this.previewElements=[]),i&&(this.screenPreviewElements.forEach(n=>{Bt(n)}),this.screenPreviewElements=[]);else{const n=this.previewElements.findIndex(a=>a===t);if(n>=0)this.previewElements.splice(n,1),Bt(t);else{const a=this.screenPreviewElements.findIndex(o=>o===t);a>=0&&(this.screenPreviewElements.splice(a,1),Bt(t))}}}resumePublish(){return z(this,null,function*(){this._isPublishing=!1,yield this.startPublish(!0)})}createLocalStream(e){return z(this,null,function*(){try{const t=yield this.streamManager.createLocalStream(e);return t!=null&&t.audioTrack&&this.audioVolumeIndicationInterval>0&&this.audioLevelMonitor.start(t.audioTrack,this.audioVolumeIndicationInterval),e.video?this.previewAll({primary:!0}):e.screen&&this.previewAll({screen:!0}),t}catch(t){const r=$c[t.errorCode];throw r&&(e.audio?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeMic,r,""):e.video?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeCamera,r,""):e.screen?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeDisplay,r,""):this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeUnknown,r,"")),t}})}stopLocalStream(e){return z(this,null,function*(){e.audio&&this.audioLevelMonitor.stop(),yield this.streamManager.stopLocalStream(e)})}compareAndPublish(e,t,r){return z(this,null,function*(){var n,a;if(!e&&!t)return;if(e&&!t){const o={};return r===Z.Audio?o.audio=!0:r===Z.VideoLarge||r===Z.VideoSmall?(o.video=!0,o.vMsid=r):r===Z.Screen&&(o.screen=!0),yield this.publishDeleteTracks(o)}const i={};if(t!=null&&t.hasVideo&&(i.isScreen=r===Z.Screen,i.vMsid=r),t!=null&&t.hasAudio&&(i.aMsid=r),!e&&t)return yield this.publishAdd(t,i,!1);if(e&&t){const o=e.trackId,u=((n=t.videoTrack)==null?void 0:n.id)||((a=t.audioTrack)==null?void 0:a.id);if(o!==u)return yield this.publishReplace(t,i)}})}reportAudioProfile(){const e=this.streamManager.cameraStreamInfo.audioProfile||"standard",t=me.AliRTS.AudioProfileMap.get(e);this.slsReporter.reportPublishProfile(Z.Audio,{a_profile:e,bits:(t==null?void 0:t.maxBitrate)||0,samplerate:(t==null?void 0:t.sampleRate)||0,channel:(t==null?void 0:t.channelCount)||0})}reportVideoProfile(){const e=this.streamManager.cameraStreamInfo.videoProfile||"",t=me.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(Z.VideoLarge,{v_profile:e,wdth:(t==null?void 0:t.width)||0,hgt:(t==null?void 0:t.height)||0,fps:(t==null?void 0:t.frameRate)||0,bitrate:(t==null?void 0:t.maxBitrate)||0})}reportScreenProfile(){const e=this.streamManager.screenStreamInfo.videoProfile||"",t=me.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(Z.Screen,{v_profile:e,wdth:(t==null?void 0:t.width)||0,hgt:(t==null?void 0:t.height)||0,fps:(t==null?void 0:t.frameRate)||0,bitrate:(t==null?void 0:t.maxBitrate)||0})}startPublish(){return z(this,arguments,function*(e=!1,t=Ot.MANUAL){if(!this.joined)return;this.createCallId();const r=yield this.streamManager.publishStreams,{audio:i,video:n,videoSmall:a,screen:o}=r;try{const u=new Date().getTime();i&&this.audioPubState.setState(be.AliRtcStatePublishing),n&&this.videoPubState.setState(be.AliRtcStatePublishing),a&&this.videoSmallPubState.setState(be.AliRtcStatePublishing),o&&this.screenPubState.setState(be.AliRtcStatePublishing),this.publishPromise=this.rtsManager.publish(this.url,this.callId,e,t);const h=yield this.publishPromise;this._isPublishing=!0,this.streamTracks=this.rtsManager.publishingTracks,this.traceId=h,i&&(this.trackTraceIdMap[Z.Audio]=h,this.reportAudioProfile()),a&&(this.trackTraceIdMap[Z.VideoSmall]=h),n&&(this.trackTraceIdMap[Z.VideoLarge]=h,this.reportVideoProfile()),o&&(this.trackTraceIdMap[Z.Screen]=h,this.reportScreenProfile());const v={type:Ft.Add,userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:e,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks,traceId:h};yield this.syncPublishToRoomServer(v,r,u),i&&this.audioPubState.setState(be.AliRtcStatePublished),n&&this.videoPubState.setState(be.AliRtcStatePublished),a&&this.videoSmallPubState.setState(be.AliRtcStatePublished),o&&this.screenPubState.setState(be.AliRtcStatePublished)}catch(u){throw i&&this.audioPubState.setState(be.AliRtcStateNoPublish),n&&this.videoPubState.setState(be.AliRtcStateNoPublish),a&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),o&&this.screenPubState.setState(be.AliRtcStateNoPublish),u}})}publishUpdate(){return z(this,null,function*(){var i,n,a,o;if(!this._isPublishing)return;yield this.publishPromise;const e=this.streamManager.publishStreams;let t;const r=new Date().getTime();try{const u=(i=this.streamTracks)==null?void 0:i.find(({ssrc:x,type:g,msid:b})=>g==="audio"&&x&&b===Z.Audio),h=yield this.compareAndPublish(u,e.audio,Z.Audio);h&&(t=h);const v=(n=this.streamTracks)==null?void 0:n.find(({ssrc:x,type:g,msid:b})=>g==="video"&&x&&b===Z.VideoLarge),f=yield this.compareAndPublish(v,e.video,Z.VideoLarge);f&&(t=f);const d=(a=this.streamTracks)==null?void 0:a.find(({ssrc:x,type:g,msid:b})=>g==="video"&&x&&b===Z.VideoSmall),p=yield this.compareAndPublish(d,e.videoSmall,Z.VideoSmall);p&&(t=p);const l=(o=this.streamTracks)==null?void 0:o.find(({ssrc:x,type:g,msid:b})=>g==="video"&&x&&b===Z.Screen),m=yield this.compareAndPublish(l,e.screen,Z.Screen);if(m&&(t=m),!t)return;yield this.syncPublishToRoomServer(t,e,r)}catch(u){const{code:h}=u!=null?u:{},v=this.url;throw h===403&&v&&(yield this.refreshPushStreamUrl(),t=yield this.publishUpdate()),u}return t})}syncPublishToRoomServer(e,t,r){return z(this,null,function*(){if(!e)throw new ne(ce.ERR_INNER,"sync publish to room server failed because no publishInfo");const i=yield this.signalingManager.publish(e);e.signaltid=i.tid})}refreshPushStreamUrl(){return z(this,null,function*(){const e=new ne(ce.ERR_INNER,"refresh push stream url error"),t=this.url;if(!t)throw e;const r=yield this.signalingManager.refreshUrl({pushstreamurl:t});if(!(r!=null&&r.pushstreamurl))throw e;this.url=r==null?void 0:r.pushstreamurl})}publishAdd(e,t,r=!1,i=0){return z(this,null,function*(){this.createCallId();const n=(t==null?void 0:t.aMsid)===Z.Audio,a=(t==null?void 0:t.vMsid)===Z.VideoLarge,o=(t==null?void 0:t.vMsid)===Z.VideoSmall,u=(t==null?void 0:t.vMsid)===Z.Screen;n&&this.audioPubState.setState(be.AliRtcStatePublishing),a&&this.videoPubState.setState(be.AliRtcStatePublishing),o&&this.videoSmallPubState.setState(be.AliRtcStatePublishing),u&&this.screenPubState.setState(be.AliRtcStatePublishing);try{const h=yield this.rtsManager.publishAdd(this.url,e,this.callId,t,!1,0,!0);n&&(this.audioPubState.setState(be.AliRtcStatePublished),this.reportAudioProfile(),this.trackTraceIdMap[Z.Audio]=h),a&&(this.videoPubState.setState(be.AliRtcStatePublished),this.reportVideoProfile(),this.trackTraceIdMap[Z.VideoLarge]=h),o&&(this.videoSmallPubState.setState(be.AliRtcStatePublished),this.trackTraceIdMap[Z.VideoSmall]=h),u&&(this.screenPubState.setState(be.AliRtcStatePublished),this.reportScreenProfile(),this.trackTraceIdMap[Z.Screen]=h),this.streamTracks=this.rtsManager.publishingTracks;const v={type:Ft.Add,userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:r,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks,traceid:h};return this.reportSelfDeviceStatus(),this.monitorTimerId||this.startStreamMonitor(),v}catch(h){let v=ce.ERR_SDK_PUBLISH_INVAILD;if(n&&(this.audioPubState.setState(be.AliRtcStateNoPublish),v=ce.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED),a&&(this.videoPubState.setState(be.AliRtcStateNoPublish),v=ce.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED),o&&(this.videoSmallPubState.setState(be.AliRtcStateNoPublish),v=ce.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED),u&&(this.screenPubState.setState(be.AliRtcStateNoPublish),v=ce.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED),h.errorCode===15006&&i<3)return this.publishAdd(e,t,r,i+1);throw ne.fromError(h,v,"publish add failed")}})}publishReplace(e,t){return z(this,null,function*(){try{yield this.rtsManager.publishReplace(this.url,e,t),this.streamTracks=this.rtsManager.publishingTracks;const r={type:Ft.Replace,userid:this.userId,sessionid:"",pubid:this.publishId,displayname:this.name,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks};return this.reportSelfDeviceStatus(),r}catch(r){throw ne.fromError(r,ce.ERR_INNER,`publish replace failed, vMsid: ${t==null?void 0:t.vMsid} aMsid: ${t==null?void 0:t.aMsid}`)}})}publishDeleteTracks(e){return z(this,null,function*(){const t={type:Ft.Delete,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{return yield this.rtsManager.publishDelete(this.url,e),this.streamTracks=this.rtsManager.publishingTracks,e.audio&&this.audioPubState.setState(be.AliRtcStateNoPublish),e.video&&(e.vMsid===Z.VideoSmall?this.videoSmallPubState.setState(be.AliRtcStateNoPublish):this.videoPubState.setState(be.AliRtcStateNoPublish)),e.screen&&this.screenPubState.setState(be.AliRtcStateNoPublish),t.tracks=this.streamTracks,this.reportSelfDeviceStatus(),t}catch(r){throw ne.fromError(r,ce.ERR_INNER,"publish delete tracks failed")}})}publishStop(){return z(this,null,function*(){if(!this._isPublishing)throw new ne(ce.ERR_INNER,"publish stop failed, previous localStream is required for publishing stopping");oe.info(`[${Lt.logName}]`,"publishStop",{url:this.url});const e=new Date().getTime();try{const t=this.hasAudioTrackInMS,r=this.hasCameraTrackInMS,i=this.hasCameraDualTrackInMS,n=this.hasScreenTrackInMS;yield this.rtsManager.publishStop(this.url),t&&this.audioPubState.setState(be.AliRtcStateNoPublish),r&&this.videoPubState.setState(be.AliRtcStateNoPublish),i&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),n&&this.screenPubState.setState(be.AliRtcStateNoPublish),this.traceId="",Object.keys(this.monitorDataCache).forEach(o=>{this.reportPublishMonitor(o)}),this.streamTracks=[];const a={type:Ft.Stop,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};return this.syncPublishToRoomServer(a,{},e),a}catch(t){throw ne.fromError(t,ce.ERR_INNER,"publish stop failed")}})}unPublish(){return z(this,null,function*(){const e=new Date().getTime();let t={type:Ft.UnPublish,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{if(this._isPublishing){const r=this.hasAudioTrackInMS,i=this.hasCameraTrackInMS,n=this.hasCameraDualTrackInMS,a=this.hasScreenTrackInMS;yield this.rtsManager.unpublish(),this.streamTracks=[],this.stopStreamMonitor(),r&&this.audioPubState.setState(be.AliRtcStateNoPublish),i&&this.videoPubState.setState(be.AliRtcStateNoPublish),n&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),a&&this.screenPubState.setState(be.AliRtcStateNoPublish),this._isPublishing=!1,this.traceId="",this.clearStream()}return this.slsReporter.reportUnpublish(this.callId||"",e,0,""),t}catch(r){throw ne.fromError(r,ce.ERR_INNER,"unpublish failed")}})}reportSelfDeviceStatus(){this.emit(et.Local,this.getDeviceStatus())}getDeviceStatus(){var t,r,i,n;let e={micOpen:!1,micInterrupted:!1,cameraOpen:!1,screenShare:!1,audioDisable:!0,videoDisable:!0,screenDisable:!0,backgroundMode:!1,accompanyPlaying:!1};return e.cameraOpen=this.hasCamera,e.micOpen=this.hasMicrophone,e.screenShare=this.hasScreenShare,e.audioDisable=!((t=this.streamManager.cameraStreamInfo.originAudioTrack)!=null&&t.enabled),e.videoDisable=!((r=this.streamManager.cameraStreamInfo.originVideoTrack)!=null&&r.enabled),e.screenDisable=!this.hasScreenShare||!((n=(i=this.streamManager.screenStreamInfo)==null?void 0:i.originVideoTrack)!=null&&n.enabled),aa.getCurrentStatus(e)}resetPreviewElements(){this.previewElements=[]}resetSecondayPreviewElements(){this.screenPreviewElements=[]}getMediaStats(e){return this.pcMediaStatsMap[e]}reportPublishMonitor(e){if(!e)return;let t;try{e===Z.Audio?t=this.rtsManager.getStreamByMsid({url:this.url,aMsid:e}).audioTrack:t=this.rtsManager.getStreamByMsid({url:this.url,vMsid:e}).videoTrack}catch(r){}this.slsReporter.reportPublishMonitor(this.callId,this.trackTraceIdMap[e]||"",e,t,this.monitorDataCache[e]),this.monitorDataCache[e]=[]}reportNetwork(){this.slsReporter.reportNetworkMonitor(this.candidateDataCache),this.candidateDataCache=[]}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>z(this,null,function*(){var e,r;try{const i=yield this.rtsManager.getPCStats();let n;i==null||i.forEach(u=>{u.type==="media-source"||u.type==="media-playout"?u.id&&(this.pcMediaStatsMap[u.id]=u):u.type==="candidate-pair"&&u.state==="succeeded"&&(n=u)});let a;if(((e=this.candidateDataCache)==null?void 0:e.length)>0){const t=this.candidateDataCache[this.candidateDataCache.length-1]||{},{_last:h}=t;a=Ki(t,["_last"])}((r=this.candidateDataCache)==null?void 0:r.length)>=la&&this.reportNetwork(),n&&(n._last=a,this.candidateDataCache.push(n));let o=Object.keys(this.monitorDataCache).filter(u=>{var h;return((h=this.monitorDataCache[u])==null?void 0:h.length)>0});(this.streamTracks||[]).forEach(u=>{const h=u.msid;if(!h)return;o.includes(h)&&(o=o.filter(d=>d!==h));let v;h===Z.Audio?v=this.rtsManager.getPublishAudioStats(this.url):v=this.rtsManager.getPublishVideoStats(this.url,h),v.then(d=>{if(!d.timestamp)return;this.monitorDataCache[h]||(this.monitorDataCache[h]=[]);const p=this.getMediaStats(d.mediaSourceId);d._source=p;const l=this.monitorDataCache[h];let m;if((l==null?void 0:l.length)>0){const x=l[l.length-1]||{},{_last:b}=x;m=Ki(x,["_last"])}(l==null?void 0:l.length)>=la&&this.reportPublishMonitor(h),d._last=m,d._codec=u.codec||"",this.monitorDataCache[h].push(d)})}),o.forEach(u=>{this.reportPublishMonitor(u)})}catch(i){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0),Object.keys(this.monitorDataCache).forEach(e=>{this.reportPublishMonitor(e)})}clearStream(){this.streamManager.stop(),this.audioPubState.setState(be.AliRtcStatePublishIdle),this.videoPubState.setState(be.AliRtcStatePublishIdle),this.videoSmallPubState.setState(be.AliRtcStatePublishIdle),this.screenPubState.setState(be.AliRtcStatePublishIdle)}getCurrentCameraDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originVideoTrack)==null?void 0:e.getSettings().deviceId}getCurrentMicDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originAudioTrack)==null?void 0:e.getSettings().deviceId}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.streamManager.cameraStreamInfo.originAudioTrack&&this.audioLevelMonitor.start(this.streamManager.cameraStreamInfo.originAudioTrack,e),this.audioVolumeIndicationInterval=e)}sendSEI(e,t,r){return z(this,null,function*(){if(!this.url)return;let i=0;return!t||t<1?i=1:i=t-1,this.rtsManager.sendSEI(this.url,e,i,r)})}getStats(){return z(this,null,function*(){const e=[];if(this.hasAudioTrackInMS){const n=yield this.rtsManager.getPublishAudioStats(this.url);n&&e.push({stats:n,track:ii.AliRtcAudioTrackMic})}const t=[];if(this.hasCameraTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.VideoLarge);n&&t.push({track:Ae.AliRtcVideoTrackCamera,streamType:Je.AliRtcVideoStreamTypeHigh,stats:n})}if(this.hasCameraDualTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.VideoSmall);n&&t.push({track:Ae.AliRtcVideoTrackCamera,streamType:Je.AliRtcVideoStreamTypeLow,stats:n})}if(this.hasScreenTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.Screen);n&&t.push({track:Ae.AliRtcVideoTrackScreen,stats:n})}let r;const i=yield this.rtsManager.getPCStats();return i==null||i.forEach(n=>{n.type==="transport"&&(r=n)}),{audio:e,video:t,transport:r}})}},A(Lt,"logName","LocalUser"),Lt);ze([j()],Ve.prototype,"clearPublishState",1),ze([j()],Ve.prototype,"clear",1),ze([j()],Ve.prototype,"setViewConfig",1),ze([j()],Ve.prototype,"startCameraCapture",1),ze([j()],Ve.prototype,"stopCameraCapture",1),ze([j()],Ve.prototype,"stopAudioCapture",1),ze([j()],Ve.prototype,"stopPreview",1),ze([j()],Ve.prototype,"resumePublish",1),ze([j()],Ve.prototype,"createLocalStream",1),ze([j()],Ve.prototype,"stopLocalStream",1),ze([j(ae)],Ve.prototype,"startPublish",1),ze([j(([s])=>[s])],Ve.prototype,"syncPublishToRoomServer",1),ze([j()],Ve.prototype,"refreshPushStreamUrl",1),ze([j(([s,c,e])=>[JSON.stringify(e)])],Ve.prototype,"publishAdd",1),ze([j(([s,c])=>[JSON.stringify(c)])],Ve.prototype,"publishReplace",1),ze([j(ae)],Ve.prototype,"publishDeleteTracks",1),ze([j()],Ve.prototype,"publishStop",1),ze([j()],Ve.prototype,"unPublish",1),ze([j(([s,c,e])=>[s.length,c,e])],Ve.prototype,"sendSEI",1);let da=Ve;var qt=(s=>(s.OPUS="opus",s.H264="H264",s.UNKONWN="",s))(qt||{}),Gt=(s=>(s.VideoTrackEnded="videoTrackEnded",s.AudioTrackEnded="audioTrackEnded",s.ScreenTrackEnded="screenTrackEnded",s))(Gt||{});const Xc=s=>{const c=new MediaStream;return c.addTrack(s),c},fa=s=>z(this,null,function*(){return yield me.AliRTS.createStream({custom:!0,mediaStream:s})}),vi=s=>z(this,null,function*(){const c=Xc(s);return yield fa(c)}),Zc=s=>{const{audio:c,video:e,screen:t}=s;if(e&&t)throw new ne(ce.ERR_INNER,"create stream error, cannot create video && screen together");return!(!e&&!c&&!t)},Yc=s=>s===Z.Audio||s===ir.Audio,Qc=s=>s===Z.VideoLarge||s===ir.VideoLarge,e0=s=>s===Z.VideoSmall,t0=s=>s===Z.Screen;var i0=Object.defineProperty,r0=Object.getOwnPropertyDescriptor,s0=(s,c,e,t)=>{for(var r=t>1?void 0:t?r0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&i0(c,e,r),r};class Mi extends ve{constructor(){super();A(this,"audioInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:qt.UNKONWN});A(this,"videoLargeInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:qt.UNKONWN});A(this,"videoSmallInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:qt.UNKONWN});A(this,"screenInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:qt.UNKONWN});A(this,"audioVolume",1);A(this,"audioMuted",!1);A(this,"userStatus")}getAudioInfo(){return this.audioInfo}getVideoSmallInfo(){return this.videoSmallInfo}getVideoLargeInfo(){return this.videoLargeInfo}getScreenInfo(){return this.screenInfo}get subscribingInfos(){return[this.audioInfo,this.videoLargeInfo,this.videoSmallInfo,this.screenInfo].filter(e=>e.msid&&e.subscribed)}get hasAudio(){return this.audioInfo.ssrc!==""}get hasVideo(){return this.videoLargeInfo.ssrc!==""||this.videoSmallInfo.ssrc!==""}get hasVideoLarge(){return this.videoLargeInfo.ssrc!==""}get hasVideoSmall(){return this.videoSmallInfo.ssrc!==""}get hasScreen(){return this.screenInfo.ssrc!==""}get isAudioSubscribing(){return!!this.audioInfo.subscribed}get isVideoSubscribing(){return!!this.videoLargeInfo.subscribed||!!this.videoSmallInfo.subscribed}get isVideoLargeSubscribing(){return!!this.videoLargeInfo.subscribed}get isVideoSmallSubscribing(){return!!this.videoSmallInfo.subscribed}get isScreenSubscribing(){return!!this.screenInfo.subscribed}get audioCodec(){return this.audioInfo.codec}get videoCodec(){return this.hasVideoLarge?this.videoLargeInfo.codec:this.hasVideoSmall?this.videoSmallInfo.codec:this.hasScreen?this.screenInfo.codec:qt.UNKONWN}get audioTrackInfo(){return this.hasAudio?ii.AliRtcAudioTrackMic:ii.AliRtcAudioTrackNo}get videoTrackInfo(){return this.hasVideo&&this.hasScreen?Ae.AliRtcVideoTrackBoth:this.hasVideo?Ae.AliRtcVideoTrackCamera:this.hasScreen?Ae.AliRtcVideoTrackScreen:Ae.AliRtcVideoTrackNo}updateTracks(e){let t="",r="",i="",n="";return e?(e.forEach(a=>{var h;let o=qt.UNKONWN;const u=((h=a==null?void 0:a.attr)==null?void 0:h.reason)==="reconnect";if(a.userdata){const{codec:v}=JSON.parse(a.userdata);v&&(o=v)}Yc(a.msid)?(t=a.ssrc,this.audioInfo.msid=a.msid,this.audioInfo.codec=o,u&&(this.audioInfo.subscribed=!1)):e0(a.msid)?(i=a.ssrc,this.videoSmallInfo.msid=a.msid,this.videoSmallInfo.codec=o,u&&(this.videoSmallInfo.subscribed=!1)):Qc(a.msid)?(r=a.ssrc,this.videoLargeInfo.msid=a.msid,this.videoLargeInfo.codec=o,u&&(this.videoLargeInfo.subscribed=!1)):t0(a.msid)&&(n=a.ssrc,this.screenInfo.msid=a.msid,this.screenInfo.codec=o,u&&(this.screenInfo.subscribed=!1))}),this.updateRemoteTrackSsrc(t,r,i,n)):this.updateRemoteTrackSsrc(t,r,i,n),{}}updateRemoteTrackSsrc(e,t,r,i){this.audioInfo.ssrc=e,this.videoSmallInfo.ssrc=r,this.videoLargeInfo.ssrc=t,this.screenInfo.ssrc=i}updateRemoteTrackSubState(e){return e.video!==void 0&&((e.vMsid===this.videoSmallInfo.msid||!e.vMsid)&&(this.videoSmallInfo.subscribed=e.video),(e.vMsid===this.videoLargeInfo.msid||!e.vMsid)&&(this.videoLargeInfo.subscribed=e.video)),e.screen!==void 0&&(this.screenInfo.subscribed=e.screen),e.audio!==void 0&&(this.audioInfo.subscribed=e.audio),{audioInfo:this.audioInfo,videoLargeInfo:this.videoLargeInfo,videoSmallInfo:this.videoSmallInfo,screenInfo:this.screenInfo}}updateRemoteUserDeviceStatus(e){let t=aa.parseStatus(e);const{audioDisable:r,videoDisable:i,screenDisable:n}=t;return this.userStatus?(this.userStatus.audioDisable!=r&&(this.userStatus.audioDisable=r,this.emit(et.Remote,r?Ie.MuteAudio:Ie.UnmuteAudio)),this.userStatus.videoDisable!=i&&(this.userStatus.videoDisable=i,this.emit(et.Remote,i?Ie.MuteVideo:Ie.UnmuteVideo)),this.userStatus.screenDisable!=n&&(this.userStatus.screenDisable=n,this.emit(et.Remote,n?Ie.MuteScreen:Ie.UnmuteScreen))):(this.userStatus=t,this.emit(et.Remote,r?Ie.MuteAudio:Ie.UnmuteAudio),this.emit(et.Remote,i?Ie.MuteVideo:Ie.UnmuteVideo),this.emit(et.Remote,n?Ie.MuteScreen:Ie.UnmuteScreen)),!1}}A(Mi,"logName","RemoteStreamInfo"),s0([j()],Mi.prototype,"updateRemoteTrackSubState",1);class pa{constructor(c){A(this,"remoteUser");this.remoteUser=c}get userId(){return this.remoteUser.userId}get displayName(){return this.remoteUser.displayname}get isMuteAudioPlaying(){return this.remoteUser.getAudioMuted()}get hasAudio(){return this.remoteUser.hasAudioTrack}get hasCamera(){return this.remoteUser.hasVideoTrack}get hasCameraLarge(){return this.remoteUser.hasVideoLargeTrack}get hasCameraSmall(){return this.remoteUser.hasVideoSmallTrack}get hasScreenShare(){return this.remoteUser.hasScreenTrack}get isAudioSubscribing(){return this.remoteUser.isAudioSubscribing}get isVideoSubscribing(){return this.remoteUser.isVideoSubscribing}get isVideoLargeSubscribing(){return this.remoteUser.isVideoLargeSubscribing}get isVideoSmallSubscribing(){return this.remoteUser.isVideoSmallSubscribing}get isScreenSubscribing(){return this.remoteUser.isScreenSubscribing}}var n0=Object.defineProperty,a0=Object.getOwnPropertyDescriptor,Xe=(s,c,e,t)=>{for(var r=t>1?void 0:t?a0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&n0(c,e,r),r};class xi extends ve{constructor(){super();A(this,"state");A(this,"time");A(this,"_enabled");this.state=Le.AliRtcStateSubscribeIdle,this.time=Date.now(),this._enabled=!0}setState(e){if(this.state===e)return;const t=this.state,r=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-r)/1e3))}get currentState(){return this.state}getEnabled(){return this._enabled}setEnabled(e){this._enabled=e}}const o0=30,Vi=class Vi extends na{constructor(e){var f;const{userId:t,displayName:r,rtsManager:i,usersViewMap:n,slsReporter:a,signalingManager:o,localUser:u,audioVolumeIndicationInterval:h,playoutVolume:v}=e;super(t,r,i,h);A(this,"remoteCallid","");A(this,"remoteUserInfo");A(this,"localUser");A(this,"lastPubId","");A(this,"stream");A(this,"screenStream");A(this,"viewMap");A(this,"audioTrack");A(this,"audioElement");A(this,"subscribed",!1);A(this,"mediaStream");A(this,"secondaryMediaStream");A(this,"prevSubConfig");A(this,"signalingManager");A(this,"slsReporter");A(this,"wantSubAudio",!1);A(this,"wantSubVideo",!1);A(this,"wantSubScreen",!1);A(this,"defaultVideoStreamType",Je.AliRtcVideoStreamTypeHigh);A(this,"audioMuted",!1);A(this,"playoutVolume",1);A(this,"audioSubState");A(this,"videoSubState");A(this,"videoLargeSubState",new xi);A(this,"videoSmallSubState",new xi);A(this,"screenSubState");A(this,"streamInfo");A(this,"streamUrl","");A(this,"monitorTimerId");A(this,"monitorDataCache",{});A(this,"trackTraceIdMap",{});this.streamInfo=new Mi,this.remoteUserInfo=new pa(this),this.streamInfo.on(et.Remote,d=>{this.emit(et.Remote,d,this.userId)}),this.signalingManager=o,this.viewMap=(f=n[t])!=null?f:{cameraViews:[],screenViews:[]},n[t]=this.viewMap,this.slsReporter=a,this.localUser=u,this.audioSubState=new xi,this.audioSubState.on("change",(d,p,l)=>{this.emit("audioSubscribeStateChanged",this.uid,d,p,l)}),this.videoSubState=new xi,this.videoSubState.on("change",(d,p,l)=>{this.emit("videoSubscribeStateChanged",this.uid,d,p,l)}),this.screenSubState=new xi,this.screenSubState.on("change",(d,p,l)=>{this.emit("screenSubscribeStateChanged",this.uid,d,p,l)}),this.playoutVolume=v}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e}setRemoteDefaultVideoStreamType(e){e!==this.defaultVideoStreamType&&(this.defaultVideoStreamType=e,this.updateSubscribe(Be.User))}setAudioMuted(e){this.audioMuted=e,this.toggleAudio(!e)}setPlayoutVolume(e){this.playoutVolume=e,this.audioElement&&(this.audioElement.volume=e)}getAudioMuted(){return this.audioMuted}get hasAudioTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasAudio)}get hasVideoTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideo)}get hasVideoLargeTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideoLarge)}get hasVideoSmallTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasVideoSmall)}get hasScreenTrack(){var e;return!!((e=this.streamInfo)!=null&&e.hasScreen)}get isAudioSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isAudioSubscribing)}get isVideoSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoSubscribing)}get isVideoLargeSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoLargeSubscribing)}get isVideoSmallSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isVideoSmallSubscribing)}get isScreenSubscribing(){var e;return!!((e=this.streamInfo)!=null&&e.isScreenSubscribing)}get audioEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.audioTrack)!=null&&t.enabled)}get videoEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get screenEnabled(){var e,t;return!!((t=(e=this.screenStream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get getAudioTrack(){return this.audioTrack}get getCameraStream(){return this.stream}get getScreenStream(){return this.screenStream}setViewConfig(e,t){if(t!==Ae.AliRtcVideoTrackScreen&&t!==Ae.AliRtcVideoTrackCamera)throw new ne(ce.ERR_INVALID_ARGUMENTS,"track is not AliRtcVideoTrackScreen or AliRtcVideoTrackCamera");e?fs(e).forEach(i=>{i.setAttribute("playsinline",""),me.AliRTS.BrowserUtil.isMicroMessenger&&(i.setAttribute("x5-video-player-type","h5-page"),i.setAttribute("x5-playsinline",""),me.AliRTS.SystenUtil.isAndroid||me.AliRTS.SystenUtil.isIos&&i.setAttribute("x-webkit-airplay","allow")),t===Ae.AliRtcVideoTrackScreen?this.viewMap.screenViews.push(i):this.viewMap.cameraViews.push(i),this.play(i,t===Ae.AliRtcVideoTrackScreen)}):(this.stopPlayAll(t===Ae.AliRtcVideoTrackScreen),t===Ae.AliRtcVideoTrackScreen?this.viewMap.screenViews=[]:this.viewMap.cameraViews=[])}clear(e=!0){return z(this,null,function*(){var t;e&&this.doStopSubscribe(this.streamUrl),As(Vi.prototype,this,"clear").call(this),this.clearStream(),this.clearScreenStream(),(t=this.streamInfo)==null||t.removeAllListeners(et.Remote)})}updateRemoteUserDeviceStatus(e){var t;(t=this.streamInfo)==null||t.updateRemoteUserDeviceStatus(e)}updateRemoteTracks(e,t,r,i){return z(this,null,function*(){var a;return this.remoteCallid=e,this.streamUrl=t!=null?t:"",this.callId=e!=null?e:"",this.streamInfo||(this.streamInfo=new Mi),(a=this.streamInfo)==null?void 0:a.updateTracks(i)})}subscribe(i,n){return z(this,arguments,function*(e,t,r=Date.now()){var d;let a=e;if(!a){const{hasAudio:p,hasVideo:l,hasScreen:m}=(d=this.streamInfo)!=null?d:{};a={audio:this.wantSubAudio&&p,video:this.wantSubVideo&&l,screen:this.wantSubScreen&&m}}const{screen:o,audio:u,video:h,vMsid:v}=a,f=[];(h||u)&&f.push({audio:u,video:h,vMsid:v}),o&&f.push({screen:o}),f.length!==0&&(yield Promise.all(f.map(p=>this.subscribeProxy(p,t||Be.User,r))))})}subscribeProxy(e,t,r){return z(this,null,function*(){var a,o,u,h;let i=new Date().getTime(),n="";try{e.audio&&this.audioSubState.setState(Le.AliRtcStateSubscribing),e.video&&(this.videoSubState.currentState===Le.AliRtcStateSubscribeIdle||this.videoSubState.currentState===Le.AliRtcStateNoSubscribe)&&this.videoSubState.setState(Le.AliRtcStateSubscribing),e.screen&&this.screenSubState.setState(Le.AliRtcStateSubscribing);const v=yield this.rtsManager.subscribe({remoteUser:this,options:e},t,((a=this.localUser)==null?void 0:a.callId)||"",this.callId,r);this.streamInfo.updateRemoteTrackSubState(e),n=v.traceId||"";const{stream:f}=v;if(e.audio){this.trackTraceIdMap[Z.Audio]=n;const p=f.audioTrack;p&&(this.audioTrack=p,(o=f.mediaStream)==null||o.removeTrack(p),this.playAudio(),this.audioVolumeIndicationInterval&&this.audioLevelMonitor.start(p,this.audioVolumeIndicationInterval)),this.audioSubState.setState(Le.AliRtcStateSubscribed),this.audioSubState.getEnabled()||this.toggleAudio(!1)}e.video&&(e.vMsid===Z.VideoSmall?(this.trackTraceIdMap[Z.VideoSmall]=n,this.videoSmallSubState.setState(Le.AliRtcStateSubscribed)):(this.trackTraceIdMap[Z.VideoLarge]=n,this.videoLargeSubState.setState(Le.AliRtcStateSubscribed)),this.videoSubState.setState(Le.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleVideo(!1),this.updateStream(f,this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing)),e.screen&&(this.trackTraceIdMap[Z.Screen]=n,this.screenSubState.setState(Le.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleScreen(!1),this.updateScreenStream(f));const d=new Date().getTime()-i;this.slsReporter.reportSubscribe(((u=this.localUser)==null?void 0:u.callId)||"",this.callId,!!e.video&&e.vMsid===Z.VideoLarge,!!e.video&&e.vMsid===Z.VideoSmall,!!e.screen,!!e.audio,0,"",d,{pctid:this.rtsManager.pcTraceId,subtid:n,ajsub:t===Be.Join?1:0,url:this.streamUrl,est:i}),this.startStreamMonitor()}catch(v){const f=new Date().getTime()-i;v&&(v.message=`user(${this.uid}) subscribe error, ${(v==null?void 0:v.message)||""}`);let d=ce.ERR_INNER;e.audio&&(d=ce.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED),e.video&&(e.vMsid===Z.VideoSmall?d=ce.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED:d=ce.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED),e.screen&&(d=ce.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED),this.slsReporter.reportSubscribe(((h=this.localUser)==null?void 0:h.callId)||"",this.callId,!!e.video&&e.vMsid===Z.VideoLarge,!!e.video&&e.vMsid===Z.VideoSmall,!!e.screen,!!e.audio,d,"",f,{pctid:this.rtsManager.pcTraceId,subtid:"",ajsub:t===Be.Join?1:0,url:this.streamUrl,est:i});const p=ne.fromError(v,d);throw this.emit("remoteSubscribeError",p),p}})}subscribeDeleteTracks(e){return z(this,null,function*(){const{audio:t,video:r,screen:i,vMsid:n}=e,a=[];(t||r)&&a.push({audio:t,video:r,vMsid:n}),i&&a.push({screen:i}),a.length!==0&&(yield Promise.all(a.map(o=>this.subscribeDeleteProxy(o))))})}subscribeDeleteProxy(e){return z(this,null,function*(){try{const t=yield this.rtsManager.subscibeDelete({remoteUser:this,options:e}),{stream:r}=t!=null?t:{},i={};e.audio===!0&&(i.audio=!1,this.audioSubState.setState(Le.AliRtcStateNoSubscribe)),e.video===!0&&(i.video=!1,e.vMsid===Z.VideoSmall?(this.videoSmallSubState.setState(Le.AliRtcStateNoSubscribe),(this.videoLargeSubState.currentState===Le.AliRtcStateNoSubscribe||this.videoLargeSubState.currentState===Le.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Le.AliRtcStateNoSubscribe)):(this.videoLargeSubState.setState(Le.AliRtcStateNoSubscribe),(this.videoSmallSubState.currentState===Le.AliRtcStateNoSubscribe||this.videoSmallSubState.currentState===Le.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Le.AliRtcStateNoSubscribe))),e.screen===!0&&(i.screen=!1,this.screenSubState.setState(Le.AliRtcStateNoSubscribe));const{callId:n,remoteCallid:a}=this,o={callid:n,remoteCallid:a,remoteStream:r};return e.audio&&(this.audioLevelMonitor.stop(),this.stopPlayAudio(),this.audioTrack=void 0),this.streamInfo.updateRemoteTrackSubState({audio:e.audio===!0?!1:void 0,video:e.video===!0?!1:void 0,screen:e.screen===!0?!1:void 0,vMsid:e.vMsid}),o}catch(t){throw ne.fromError(t,ce.ERR_INNER,"subscribe delete failed")}})}restore(){this.callId="",this.clearStream(),this.clearScreenStream(),this.audioTrack=void 0,this.streamInfo.updateRemoteTrackSubState({audio:!1,video:!1,screen:!1})}resumeAudio(){return z(this,null,function*(){var e;return(e=this.audioElement)==null?void 0:e.play()})}resumeVideo(e){return z(this,null,function*(){if(!e||e===Ae.AliRtcVideoTrackCamera||e===Ae.AliRtcVideoTrackBoth)return this.playAll();if(!e||e===Ae.AliRtcVideoTrackScreen||e===Ae.AliRtcVideoTrackBoth)return this.playAll(!0)})}resumePlay(){this.playAudio(),this.playAll(),this.playAll(!0)}stopSubscribe(e){return z(this,null,function*(){var r,i;let t=new Date().getTime();try{let n;e?n=yield this.subscribeDeleteTracks(e):n=yield this.doStopSubscribe(this.streamUrl),this.slsReporter.reportUnsubscribe(((r=this.localUser)==null?void 0:r.callId)||(n==null?void 0:n.callid)||"",this.callId,new Date().getTime()-t,0,"")}catch(n){throw this.slsReporter.reportUnsubscribe(((i=this.localUser)==null?void 0:i.callId)||"",this.callId,new Date().getTime()-t,0,""),n}})}doStopSubscribe(e){return z(this,null,function*(){var i,n,a,o;const{callId:t,remoteCallid:r}=this;if((this.isAudioSubscribing||this.isVideoSubscribing||this.isScreenSubscribing)&&e)try{this.stopStreamMonitor(),yield this.rtsManager.subscibeStop(e),this.restore();const u={callid:t,remoteCallid:r,remoteStream:this.stream};return this.callId="",u}catch(u){if(((o=(a=(n=(i=u==null?void 0:u.extraInfo)==null?void 0:i.parsedData)==null?void 0:n.streams)==null?void 0:a[0])==null?void 0:o.res_code)!==404)throw ne.fromError(u,ce.ERR_INNER,"subscribe stop failed")}})}updateStream(e,t=!1){return z(this,null,function*(){this.stream&&this.stream.videoTrack&&e.mediaStream&&t&&(yield new Promise(r=>{let i,n;if(e.mediaStream){n=document.createElement("video");const a=()=>{oe.event(`uid: ${this.userId} new mediaStream canplay`),n&&n.removeEventListener("canplaythrough",a,!1),n=void 0,clearTimeout(i),r(!0)};n.addEventListener("canplaythrough",a,!1),(n._playPromise||Promise.resolve()).then(()=>{n&&e.mediaStream&&(n.srcObject=e.mediaStream)})}else r(!0);i=window.setTimeout(()=>{oe.event(`uid: ${this.userId} new mediaStream timeout`),n=void 0,r(!0)},3e3)}),this.updateSubscribe(Be.User)),this.stream=e,this.playAll(),!this.subscribed&&e&&(this.subscribed=!0),e.hasAudio&&this.isAudioSubscribing&&e.enableAudio(),e.hasVideo&&this.isVideoSubscribing&&e.enableVideo()})}updateScreenStream(e){this.screenStream=e,this.playAll(!0),!this.subscribed&&e&&(this.subscribed=!0),e.hasVideo&&this.isScreenSubscribing&&e.enableVideo()}clearStream(){var e;(e=this.stream)==null||e.stop(),this.stream=void 0}clearScreenStream(){var e;(e=this.screenStream)==null||e.stop(),this.screenStream=void 0}updateSubscribe(e){var n,a,o,u,h,v,f,d;const t=Date.now(),r={},i={};return this.wantSubAudio&&!this.isAudioSubscribing&&((n=this.streamInfo)!=null&&n.hasAudio)?r.audio=!0:(!this.wantSubAudio||!((a=this.streamInfo)!=null&&a.hasAudio))&&this.isAudioSubscribing&&(i.audio=!0),this.wantSubVideo&&((o=this.streamInfo)!=null&&o.hasVideo)?(this.defaultVideoStreamType===Je.AliRtcVideoStreamTypeLow&&!this.isVideoSmallSubscribing&&((u=this.streamInfo)!=null&&u.hasVideoSmall)?(r.video=!0,r.vMsid=Z.VideoSmall):!this.isVideoLargeSubscribing&&((h=this.streamInfo)!=null&&h.hasVideoLarge)&&!(this.defaultVideoStreamType===Je.AliRtcVideoStreamTypeLow&&this.isVideoSmallSubscribing)&&(r.video=!0,r.vMsid=Z.VideoLarge),this.defaultVideoStreamType===Je.AliRtcVideoStreamTypeLow&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&this.streamInfo.hasVideoSmall?(i.video=!0,i.vMsid=Z.VideoLarge):this.defaultVideoStreamType===Je.AliRtcVideoStreamTypeHigh&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&(i.video=!0,i.vMsid=Z.VideoSmall)):(!this.wantSubVideo||!((v=this.streamInfo)!=null&&v.hasVideo))&&this.isVideoSubscribing&&(i.video=!0,i.vMsid=this.streamInfo.isVideoSmallSubscribing?Z.VideoSmall:Z.VideoLarge),this.wantSubScreen&&!this.isScreenSubscribing&&((f=this.streamInfo)!=null&&f.hasScreen)?r.screen=!0:(!this.wantSubScreen||!((d=this.streamInfo)!=null&&d.hasScreen))&&this.isScreenSubscribing&&(i.screen=!0),(r.audio||r.video||r.screen)&&(this.createCallId(),this.subscribe(r,e,t)),i.audio&&i.video&&i.screen?this.stopSubscribe():(i.audio||i.video||i.screen)&&this.subscribeDeleteTracks(i),{addOption:r,deleteOption:i}}handleAutoPlayFailed(){this.emit("remoteAudioAutoPlayFail",this.uid);const e=()=>{this.resumeAudio().then(()=>{document.removeEventListener("click",e,!1),document.removeEventListener("touchstart",e,!1)})};document.addEventListener("click",e,!1),document.addEventListener("touchstart",e,!1)}handleVideoPlayFailded(e,t){this.emit("remoteVideoAutoPlayFail",this.uid,t);const r=()=>{var n;const i=(n=t===Ae.AliRtcVideoTrackScreen?this.screenStream:this.stream)==null?void 0:n.mediaStream;e.srcObject===i&&this.play(e,t===Ae.AliRtcVideoTrackScreen),document.removeEventListener("click",r,!1),document.removeEventListener("touchstart",r,!1)};document.addEventListener("click",r,!1),document.addEventListener("touchstart",r,!1)}playAudio(){return z(this,null,function*(){var t,r;if(!this.audioTrack)return;if(this.toggleAudio(!this.audioMuted),this.audioElement||(this.audioElement=document.createElement("audio"),this.audioElement.volume=this.playoutVolume),((r=(t=this.audioElement.srcObject)==null?void 0:t.getAudioTracks())==null?void 0:r[0])!==this.audioTrack){let i=this.audioElement.srcObject;i?i.getAudioTracks().forEach(n=>{i.removeTrack(n)}):(i=new MediaStream,this.audioElement.srcObject=i),i.addTrack(this.audioTrack)}this.audioElement.play().catch(()=>{this.handleAutoPlayFailed()});const e=this.audioElement;this.audioElement.addEventListener("playing",function i(){e.removeEventListener("playing",i),me.AliRTS.SystenUtil.isIos&&parseInt(me.AliRTS.SystenUtil.systemVersion)<=14&&(e.muted||(e.pause(),e.play()))})})}stopPlayAudio(){this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null)}playAll(e=!1){e?(this.viewMap.screenViews||[]).forEach(t=>{this.play(t,e)}):(this.viewMap.cameraViews||[]).forEach(t=>{this.play(t,e)})}play(e,t=!1){const r=t?this.screenStream:this.stream;!e||!r||!r.mediaStream||ha(e,r.mediaStream).catch(i=>{i.code===20||i.name==="AbortError"||this.handleVideoPlayFailded(e,t?Ae.AliRtcVideoTrackScreen:Ae.AliRtcVideoTrackCamera)})}stopPlayAll(e=!1){e?this.viewMap.screenViews.forEach(t=>{Bt(t)}):this.viewMap.cameraViews.forEach(t=>{Bt(t)})}toggleAudio(e=!0){this.audioSubState.setEnabled(e),this.audioTrack&&(this.audioTrack.enabled=e)}toggleVideo(e=!0){this.videoSubState.setEnabled(e),this.stream&&(e?this.stream.enableVideo():this.stream.disableVideo())}toggleScreen(e=!0){this.screenSubState.setEnabled(e),this.screenStream&&(e?this.screenStream.enableVideo():this.screenStream.disableVideo())}getStats(){return z(this,null,function*(){var r,i;const e=[];if(this.isAudioSubscribing){const n=yield this.rtsManager.getSubscribeAudioStats(this.streamUrl);n&&e.push({uid:this.uid,track:ii.AliRtcAudioTrackMic,stats:n})}const t=[];if((r=this.streamInfo)!=null&&r.isVideoLargeSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.VideoLarge);n&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackCamera,streamType:Je.AliRtcVideoStreamTypeHigh,stats:n})}if((i=this.streamInfo)!=null&&i.isVideoSmallSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.VideoSmall);n&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackCamera,streamType:Je.AliRtcVideoStreamTypeLow,stats:n})}if(this.isScreenSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.Screen);n&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackScreen,stats:n})}return{audio:e,video:t}})}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.audioTrack&&this.audioLevelMonitor.start(this.audioTrack,e),this.audioVolumeIndicationInterval=e)}reportSubscribeMonitor(e){var t;e&&(this.slsReporter.reportSubscribeMonitor(((t=this.localUser)==null?void 0:t.callId)||"",this.callId,this.trackTraceIdMap[e]||"",e,this.monitorDataCache[e]),this.monitorDataCache[e]=[])}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>z(this,null,function*(){try{if(this.streamInfo.subscribingInfos.length===0){this.stopStreamMonitor();return}let e=Object.keys(this.monitorDataCache).filter(t=>{var r;return((r=this.monitorDataCache[t])==null?void 0:r.length)>0});this.streamInfo.subscribingInfos.forEach(t=>{const r=t.msid;if(!r)return;e.includes(r)&&(e=e.filter(a=>a!==r));let i;const n=r===Z.Audio;n?i=this.rtsManager.getSubscribeAudioStats(this.streamUrl):i=this.rtsManager.getSubscribeVideoStats(this.streamUrl,r),i.then(a=>{var v;if(!a.timestamp)return;this.monitorDataCache[r]||(this.monitorDataCache[r]=[]);const o=this.monitorDataCache[r];let u;if((o==null?void 0:o.length)>0){const h=o[o.length-1]||{},{_last:d}=h;u=Ki(h,["_last"])}(o==null?void 0:o.length)>=o0&&this.reportSubscribeMonitor(r),a._last=u,a._codec=t.codec,n&&(a._source=(v=this.localUser)==null?void 0:v.getMediaStats(a.playoutId)),this.monitorDataCache[r].push(a)})}),e.forEach(t=>{this.reportSubscribeMonitor(t)})}catch(e){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0),Object.keys(this.monitorDataCache).forEach(e=>{this.reportSubscribeMonitor(e)})}};A(Vi,"logName","RemoteUser");let Ue=Vi;Xe([j()],Ue.prototype,"clear",1),Xe([j()],Ue.prototype,"updateRemoteUserDeviceStatus",1),Xe([j()],Ue.prototype,"updateRemoteTracks",1),Xe([j(ae)],Ue.prototype,"subscribe",1),Xe([j()],Ue.prototype,"subscribeProxy",1),Xe([j(ae)],Ue.prototype,"subscribeDeleteProxy",1),Xe([j()],Ue.prototype,"restore",1),Xe([j(ae)],Ue.prototype,"stopSubscribe",1),Xe([j(ae)],Ue.prototype,"doStopSubscribe",1),Xe([j()],Ue.prototype,"clearStream",1),Xe([j()],Ue.prototype,"clearScreenStream",1),Xe([j()],Ue.prototype,"updateSubscribe",1),Xe([j()],Ue.prototype,"playAudio",1),Xe([j()],Ue.prototype,"stopPlayAudio",1),Xe([j(ae)],Ue.prototype,"playAll",1),Xe([j()],Ue.prototype,"play",1),Xe([j()],Ue.prototype,"stopPlayAll",1);var Pt=(s=>(s[s.AliRtcPluginErrorCodeSuccess=0]="AliRtcPluginErrorCodeSuccess",s[s.AliRtcPluginErrorCodeFailed=-1]="AliRtcPluginErrorCodeFailed",s[s.AliRtcPluginErrorNoFindPlugin=-2]="AliRtcPluginErrorNoFindPlugin",s[s.AliRtcPluginErrorParameterError=-3]="AliRtcPluginErrorParameterError",s[s.AliRtcPluginErrorLoadError=-4]="AliRtcPluginErrorLoadError",s[s.AliRtcPluginErrorCreateError=-5]="AliRtcPluginErrorCreateError",s[s.AliRtcPluginErrorInitError=-6]="AliRtcPluginErrorInitError",s[s.AliRtcPluginErrorInitTokenError=-7]="AliRtcPluginErrorInitTokenError",s))(Pt||{});class c0 extends ve{constructor(){super(...arguments);A(this,"plugins",new Map)}add(e,t){if(this.plugins.has(e.name))throw new ne(Pt.AliRtcPluginErrorCreateError,`Plugin ${e.name} already exists`);this.plugins.set(e.name,e),t&&e.setOptions(t),this.emit("added",e),e.on("enabled",()=>this.emit("added",e)),e.on("disabled",()=>this.emit("removed",e)),e.on("updated",()=>this.emit("updated",e))}remove(e){const t=this.plugins.get(e);if(!t)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,`Plugin ${e} not founded`);this.plugins.delete(e),t.removeAllListeners(),this.emit("removed",t)}get(e){return this.plugins.get(e)}has(e){return!!this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}}var u0=Object.defineProperty,h0=Object.getOwnPropertyDescriptor,tt=(s,c,e,t)=>{for(var r=t>1?void 0:t?h0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&u0(c,e,r),r};const Fi=([s])=>{const{remoteUser:c,options:e}=s;return[`user(${c.userId})`,e]},Ye=(St=class extends ve{constructor(e,t){super();A(this,"rts");A(this,"encodedInsertableStreams",!0);A(this,"audioRedEnabled",!1);A(this,"localStreamManager");A(this,"slsReporter");A(this,"connecting",!1);A(this,"connected",!1);A(this,"_pcTraceId","");A(this,"_localJoinTime",0);A(this,"connectionResolve");A(this,"connectingPromise");A(this,"dcResolve");A(this,"dcConnectingPromise");A(this,"_publishingTracks",[]);this.rts=me.AliRTS.createClient(),this.localStreamManager=e,this.slsReporter=t,this.rts.on("connectStatusChange",r=>{var i,n,a,o;if(oe.event(`[${St.logName}]`,"rts connectStatusChange to:",r.status),r.status===me.EConnectStatus.CONNECT_STATUS_DISCONNECTED)this.emit("disconnected"),this.setConnected(!1),this.slsReporter.reportWarning("rts disconnected");else if(r.status===me.EConnectStatus.CONNECT_STATUS_RECONNECTING)this.emit("reconnecting"),this.setConnected(!1),this.slsReporter.reportWarning("rts reconnecting");else if(r.status===me.EConnectStatus.CONNECT_STATUS_CONNECTED){this.setConnected(!0);const u=(o=(a=(n=(i=this.rts.commonController)==null?void 0:i.peerCore)==null?void 0:n.getSignal())==null?void 0:a.getDatachannelCore())==null?void 0:o.readyState;oe.event(St.logName,"dcReadyState:",u),u==="open"&&this.dcResolve&&this.dcResolve(!0),this.emit("connected")}}),this.rts.on("datachannelStatusChange",r=>{oe.event(`[${St.logName}]`,"rts datachannelStatusChange to:",r.status),r.status===me.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?this.dcResolve&&this.dcResolve(!0):r.status===me.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&(this.dcConnectingPromise=new Promise(i=>{this.dcResolve=i}),console.warn("DC DisConnected"))}),this.rts.on("receivedSEI",r=>{this.emit("seimessage",r.url,r.sei.payloadType,r.sei.data)})}get pcTraceId(){return this._pcTraceId}set localJoinTime(e){this._localJoinTime=e}setEncodedInsertableStreams(e){this.encodedInsertableStreams=e}setAudioRedEnabled(e){var t;if(e!==this.audioRedEnabled){try{const i=[...((t=RTCRtpReceiver.getCapabilities("audio"))==null?void 0:t.codecs)||[]];if(i.length>0){if(e){const n=i.findIndex(o=>o.mimeType==="audio/red"),a=i.findIndex(o=>o.mimeType==="audio/opus");if(n>-1&&a>-1&&n>a){const o=i[a];i[a]=i[n],i[n]=o}}this.rts.setSenderCodecPreferences({audio:i}),this.rts.setReceiverCodecPreferences({audio:i})}}catch(r){}this.audioRedEnabled=e}}destroy(){this.rts.unpublish()}startConnect(){this.connecting=!0,this.connectingPromise=new Promise(e=>{this.connectionResolve=e}),this.dcConnectingPromise=new Promise(e=>{this.dcResolve=e})}setConnected(e){var t;this.connected=e,this.connecting=!1,(t=this.connectionResolve)==null||t.call(this,!0),e||(this.dcConnectingPromise=new Promise(r=>{this.dcResolve=r}))}get isConnecting(){return this.connecting}get isConnected(){return this.connected}get publishingTracks(){return this._publishingTracks}getPubMsid(e,t){const{aMsid:r,vMsid:i}=t!=null?t:{},n={};return e.hasAudio&&(n.aMsid=[r!=null?r:Z.Audio]),e.hasScreen&&(n.vMsid=[Z.Screen]),e.hasVideo&&(n.vMsid=[i!=null?i:t!=null&&t.isScreen?Z.Screen:Z.VideoLarge]),n}updatePublishingTracks(e){e&&(this._publishingTracks=e.map(({msid:t,from:r,ssrc:i,codec:n,type:a,trackId:o})=>({msid:t,from:r,type:a,ssrc:`${i}`,codec:n!=null?n:"",trackId:o})))}httpPublish(n,a){return z(this,arguments,function*(e,t,r=!1,i=Ot.MANUAL){const{publishStream:o,videoSmallStream:u,screenStream:h,vMsid:v}=yield this.localStreamManager.createHTTPPublishStream();if(!o)return"";const f=this.getPubMsid(o,{vMsid:v});f.retryTimes=0,this.encodedInsertableStreams&&(f.encodedInsertableStreams=!0);let d=!o.hasVideo,p=v;try{this.startConnect();const l=Date.now(),m=yield this.rts.publish(e,o,f);this.slsReporter.reportPublish(r,e,t,o.hasVideo&&(!v||v===Z.VideoLarge),o.hasVideo&&v===Z.VideoSmall,o.hasVideo&&v===Z.Screen,o.hasAudio,0,m,m,l);const x=Date.now();return this._pcTraceId=m,this.setConnected(!0),this._publishingTracks=this.rts.getPublishTrackInfoList(),u&&(yield this.publishAdd(e,u,t,{vMsid:Z.VideoSmall},r),d=!1,p=Z.VideoSmall),h&&(yield this.publishAdd(e,h,t,{vMsid:Z.Screen},r),d=!1,p=Z.Screen),yield this.waitPublishSender(e,d,p),this.slsReporter.reportPublishFirstPacket(r,t,l,x,this._localJoinTime,d?Z.Audio:f.vMsid,m||"",m||"",i),m}catch(l){throw this.setConnected(!1),l}})}waitPublishSender(e,t=!1,r){return z(this,null,function*(){const i=(n,a)=>{let o=0;const u=()=>(t?this.rts.getPublishAudioStats(e,r):this.rts.getPublishVideoStats(e,r)).then(v=>!(v.bytesSent>0)&&o<n?(o++,new Promise(d=>setTimeout(()=>d(u()),a))):Promise.resolve());return u()};return Promise.race([$t(1e3),i(5,100)]).catch(()=>{})})}getPublishVideoStats(e,t){return z(this,null,function*(){return yield this.rts.getPublishVideoStats(e,t)})}getPublishAudioStats(e,t){return z(this,null,function*(){return yield this.rts.getPublishAudioStats(e,t)})}publishAdd(h,v,f,d){return z(this,arguments,function*(e,t,r,i,n=!1,a=0,o=!1,u=Ot.MANUAL){var m,x,g,b,y,E,I,C;yield this.dcConnectingPromise;const p=Date.now(),l=this.getPubMsid(t,i);try{const R=yield this.rts.publishAdd([Se({url:e,stream:t,updateSourceStream:!1},l)]);if(R){const L=Date.now(),[k]=R;return this.slsReporter.reportPublish(!1,e,r,((m=l.vMsid)==null?void 0:m[0])===Z.VideoLarge,((x=l.vMsid)==null?void 0:x[0])===Z.VideoSmall,((g=l.vMsid)==null?void 0:g[0])===Z.Screen,((b=l.aMsid)==null?void 0:b[0])===Z.Audio,0,this.pcTraceId,k.traceId||"",p),this.updatePublishingTracks(k.trackInfoList),o&&(yield this.waitPublishSender(e,!t.hasVideo,t.hasVideo?i==null?void 0:i.vMsid:i==null?void 0:i.aMsid)),this.slsReporter.reportPublishFirstPacket(n||a>0,r,p,L,this._localJoinTime,(t.hasVideo?i==null?void 0:i.vMsid:i==null?void 0:i.aMsid)||"",this.pcTraceId,k.traceId||"",u),k.traceId||""}}catch(R){if(this.slsReporter.reportPublish(!1,e,r,((y=l.vMsid)==null?void 0:y[0])===Z.VideoLarge,((E=l.vMsid)==null?void 0:E[0])===Z.VideoSmall,((I=l.vMsid)==null?void 0:I[0])===Z.Screen,((C=l.aMsid)==null?void 0:C[0])===Z.Audio,R.errorCode||-1,this.pcTraceId,"",p),R.errorCode===15006&&a<3)return yield this.publishAdd(e,t,r,i,n,a+1);throw R}return""})}publishDelete(e,t){return z(this,null,function*(){var h,v,f,d,p,l,m,x;yield this.dcConnectingPromise;const r=(v=(h=this.publishingTracks)==null?void 0:h.find(({msid:g})=>g===Z.Audio))==null?void 0:v.msid,i=(d=(f=this.publishingTracks)==null?void 0:f.find(({msid:g})=>g===Z.VideoLarge))==null?void 0:d.msid,n=(l=(p=this.publishingTracks)==null?void 0:p.find(({msid:g})=>g===Z.Screen))==null?void 0:l.msid,a=[];t.screen&&n?a.push(n):t.video&&a.push(t.vMsid||i);const o=[];t.audio&&r&&o.push(r),oe.event(St.logName,"publishDelete",{streamUrl:e,aMsid:o,vMsid:a});const[u]=(yield this.rts.publishDeleteTracks([{url:e,aMsid:o,vMsid:a}]))||[];return oe.event(St.logName,"publishDelete",{result:u}),u&&this.updatePublishingTracks(u.trackInfoList),((x=(m=u==null?void 0:u.trackInfoList)==null?void 0:m[0])==null?void 0:x.trackId)||""})}publishReplace(e,t,r){return z(this,null,function*(){var u,h;yield this.dcConnectingPromise;const{vMsid:i,aMsid:n}=r!=null?r:{},a=yield this.rts.publishReplaceTracks([{url:e,stream:t,updateSourceStream:!1,vMsid:i,aMsid:n}]),[o]=a;return this.updatePublishingTracks(o.trackInfoList),((h=(u=o==null?void 0:o.trackInfoList)==null?void 0:u[0])==null?void 0:h.trackId)||""})}publishStop(e){return z(this,null,function*(){return yield this.rts.publishStop([{url:e}]),this._publishingTracks=[],""})}unpublish(){return z(this,null,function*(){yield this.rts.unpublish(),this.connecting=!1,this.connected=!1})}getSubConfig(e,t){let r=t!=null?t:{};t||(r={audio:!0,video:!0,screen:!0});const i={};return r.audio&&(i.aMsid=[(e==null?void 0:e.getAudioInfo().msid)||Z.Audio]),r.video?r.vMsid?i.vMsid=[r.vMsid]:e!=null&&e.hasVideoLarge?i.vMsid=[(e==null?void 0:e.getVideoLargeInfo().msid)||Z.VideoLarge]:e!=null&&e.hasVideoSmall?i.vMsid=[(e==null?void 0:e.getVideoSmallInfo().msid)||Z.VideoSmall]:i.vMsid=[Z.VideoLarge]:r.screen&&e!=null&&e.hasScreen&&(i.vMsid=[(e==null?void 0:e.getScreenInfo().msid)||Z.Screen]),i}httpSubscribe(e){return z(this,null,function*(){const{remoteUser:t,options:r}=e;let i=t.streamUrl;r.video||r.screen?r!=null&&r.audio||(i+="@subaudio=no"):i+="@subvideo=no";const n=this.getSubConfig(t.streamInfo,r);n.retryTimes=0,this.encodedInsertableStreams&&(n.encodedInsertableStreams=!0);try{this.startConnect();const a=yield this.rts.subscribe(i,n);return this._pcTraceId=a.traceId,this.setConnected(!0),{traceId:a.traceId,stream:a}}catch(a){throw this.setConnected(!1),a}})}subscribeAdd(e){return z(this,null,function*(){var n,a,o,u;const{remoteUser:t,options:r}=e,i=Rt(Se({url:t.streamUrl,subAudio:!!r.audio,subVideo:!!(r.screen||r.video)},this.getSubConfig(t.streamInfo,r)),{targetStream:r.screen?t.getScreenStream:t.getCameraStream});try{return(yield this.rts.subscribeAdd([i]))[0]}catch(h){if(((u=(o=(a=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:a.streams)==null?void 0:o[0])==null?void 0:u.res_code)===508)return this.emit("subscribeexceeds"),null;throw ne.fromError(h)}})}subscibeDelete(e){return z(this,null,function*(){var n,a,o,u;yield this.dcConnectingPromise;const{remoteUser:t,options:r}=e,i=Rt(Se({url:t.streamUrl,subAudio:!!r.audio,subVideo:!!(r.screen||r.video)},this.getSubConfig(t.streamInfo,r)),{targetStream:r.screen?t.getScreenStream:t.getCameraStream});try{return(yield this.rts.subscribeDeleteTracks([i]))[0]}catch(h){if(((u=(o=(a=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:a.streams)==null?void 0:o[0])==null?void 0:u.res_code)===404)return;throw h}})}subscibeStop(e){return z(this,null,function*(){var t,r,i,n;try{yield this.rts.subscribeStop([{url:e}])}catch(a){if(((n=(i=(r=(t=a==null?void 0:a.extraInfo)==null?void 0:t.parsedData)==null?void 0:r.streams)==null?void 0:i[0])==null?void 0:n.res_code)===404)return;throw a}})}publish(n,a){return z(this,arguments,function*(e,t,r=!1,i=Ot.MANUAL){let o="";if(this.connecting&&(yield this.connectingPromise),this.connected){yield this.dcConnectingPromise;let u=!1,h;const{audio:v,video:f,videoSmall:d,screen:p}=this.localStreamManager.publishStreams;v&&(o=yield this.publishAdd(e,v,t,{aMsid:Z.Audio},r),u=!0,h=Z.Audio,yield $t(100)),f&&(o=yield this.publishAdd(e,f,t,{vMsid:Z.VideoLarge},r),u=!1,h=Z.VideoLarge,yield $t(100)),d&&(o=yield this.publishAdd(e,d,t,{vMsid:Z.VideoSmall},r),u=!1,h=Z.VideoSmall,yield $t(100)),p&&(o=yield this.publishAdd(e,p,t,{isScreen:!0,vMsid:Z.Screen},r),u=!1,h=Z.Screen),h&&(yield this.waitPublishSender(e,u,h))}else o=yield this.httpPublish(e,t,r,i);return o})}subscribe(e,t,r,i,n){return z(this,null,function*(){const{options:a,remoteUser:o}=e;if(a.video&&a.screen)throw new ne(ce.ERR_INNER,"subscribe error, video and screen cannot be subscribed at the same time");this.connecting&&(yield this.connectingPromise);let u,h=Date.now();this.connected?(yield this.dcConnectingPromise,h=Date.now(),u=yield this.subscribeAdd(e)):u=yield this.httpSubscribe(e);const v=Date.now();let f=Z.VideoLarge,d=a.video||a.screen,p=a.audio;a.video&&a.vMsid?f=a.vMsid:a.screen&&(f=Z.Screen);let l=0,m=0,x=0;return((b,y)=>{let E=0;const I=()=>{let C;return p&&!l&&(C=this.rts.getSubscribeAudioStats(o.streamUrl).then(R=>{if(R.packetsReceived>0)l=Date.now();else if(!d)return E<b?(E++,new Promise(L=>setTimeout(()=>L(I()),y))):!1;return!0})),d&&!x&&(C=this.rts.getSubscribeVideoStats(o.streamUrl,f).then(R=>{if(R.packetsReceived>0&&(m=Date.now()),R.framesDecoded>0)x=Date.now();else return E<b?(E++,new Promise(L=>setTimeout(()=>L(I()),y))):(oe.error(`[${St.logName}]`,"checkInStatsWithRetry fail"),!1);return!0})),Promise.resolve(C)};return I()})(20,100).then(()=>{m&&this.slsReporter.reportSubscribeFirstPacket(t===Be.Resume,r,i,f,{fprt:m-h,ifsprtc:x?x-h:0,ajsub:t===Be.Join?1:0,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",sstc:v-h}),x&&this.slsReporter.reportSubscribeFirstFrame(t===Be.Resume,r,i,f,{fvfrt:x-h,fp2fftc:x-m,ajsub:t===Be.Join?1:0,tffrtc:t===Be.Join?x-this.localJoinTime:x-n,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",fvfdtc:x-h}),l&&this.slsReporter.reportSubscribeFirstPacket(t===Be.Resume,r,i,Z.Audio,{fprt:l-h,ifsprtc:l-h,ajsub:t===Be.Join?1:0,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",sstc:v-h})}),u})}getSubscribeVideoStats(e,t){return z(this,null,function*(){return yield this.rts.getSubscribeVideoStats(e,t)})}getSubscribeAudioStats(e,t){return z(this,null,function*(){return yield this.rts.getSubscribeAudioStats(e,t)})}getStreamByMsid(e){return this.rts.commonController.streamManager.getStreamByMsid(e)}getPCStats(){return z(this,null,function*(){var e,t;return(t=(e=this.rts.commonController.peerCore)==null?void 0:e.pc)==null?void 0:t.getStats()})}sendSEI(e,t,r,i){return z(this,null,function*(){return this.rts.sendSEI({url:e,vMsid:Z.VideoLarge,data:t,repeatCount:r,payloadType:i})})}},A(St,"logName","RtsManager"),St);tt([j()],Ye.prototype,"updatePublishingTracks",1),tt([j(ae,ae)],Ye.prototype,"httpPublish",1),tt([j(ae,ae)],Ye.prototype,"waitPublishSender",1),tt([j(([s,c,e])=>[s,JSON.stringify(e)],ae)],Ye.prototype,"publishAdd",1),tt([j(ae,ae)],Ye.prototype,"publishDelete",1),tt([j(([s,c,e])=>[s,JSON.stringify(e)])],Ye.prototype,"publishReplace",1),tt([j(ae)],Ye.prototype,"publishStop",1),tt([j()],Ye.prototype,"unpublish",1),tt([j(Fi,({traceId:s})=>s)],Ye.prototype,"httpSubscribe",1),tt([j(Fi,({traceId:s})=>s)],Ye.prototype,"subscribeAdd",1),tt([j(Fi)],Ye.prototype,"subscibeDelete",1),tt([j(ae)],Ye.prototype,"subscibeStop",1),tt([j(ae)],Ye.prototype,"publish",1),tt([j(Fi)],Ye.prototype,"subscribe",1),tt([j()],Ye.prototype,"sendSEI",1);let l0=Ye;class ps{constructor(){A(this,"profile");A(this,"profileMap",new Map);A(this,"audioProfile");A(this,"contentHint")}updateProfile(c,e){e&&this.profileMap.set(c,e),this.profile=c}get videoProfile(){return this.profile}updateAudioProfile(c){this.audioProfile=c}setContentHint(c,e){e&&(this.contentHint=e),this.contentHint&&c&&(c.contentHint=this.contentHint)}setVideoProfile(c,e,t=!1){return z(this,null,function*(){if(!this.profile)return;const r=this.profileMap.get(this.profile)||(e==null?void 0:e.VideoProfileMap.get(this.profile));if(r){if(!t&&c&&c.applyConstraints)try{yield c.applyConstraints(r)}catch(i){}e&&(e==null||e.VideoProfileMap.set(this.profile,r),yield e.setVideoProfile(this.profile))}})}}class ms extends ve{constructor(e){super();A(this,"type");A(this,"originVideoTrack");A(this,"videoSource");A(this,"_videoMuted",!1);A(this,"originAudioTrack");A(this,"audioSource");A(this,"_audioMuted",!1);A(this,"_targetVideoTrack");A(this,"_targetDualVideoTrack");A(this,"_targetAudioTrack");A(this,"_publishVideoStream");A(this,"_publishDualVideoStream");A(this,"_publishAudioStream");A(this,"_previewStream");A(this,"plugins",[]);A(this,"_profileManager");A(this,"cameraVideoConstraints");A(this,"micAudioConstraints");A(this,"onVideoTrackEnded",()=>{this.emit("videotrackended")});A(this,"onAudioTrackEnded",()=>{this.emit("audiotrackended")});this.type=e}get profileManager(){return this._profileManager}get audioProfile(){var e;return(e=this.profileManager)==null?void 0:e.audioProfile}updateSource(e,t,r){return z(this,null,function*(){var a,o,u,h,v,f;const{videoTrack:i,audioTrack:n}=e;i&&((a=this.originVideoTrack)==null||a.removeEventListener("ended",this.onVideoTrackEnded)),n&&((o=this.originAudioTrack)==null||o.removeEventListener("ended",this.onAudioTrackEnded)),this.type===Ke.AliRtcSdkStreamTypeScreen?this.stop():(i&&((u=this.originVideoTrack)==null||u.stop()),n&&((h=this.originAudioTrack)==null||h.stop())),i&&(this.originVideoTrack=i,(v=this.originVideoTrack)==null||v.addEventListener("ended",this.onVideoTrackEnded),this.videoSource=t||Yt.Camera,this.updateVideoTrack(i)),n&&(this.originAudioTrack=n,(f=this.originAudioTrack)==null||f.addEventListener("ended",this.onAudioTrackEnded),this.audioSource=r||_i.Microphone,this.updateAudioTrack(n))})}get currentProfile(){var e;return(e=this.profileManager)==null?void 0:e.profile}get currentVideoTrack(){return this._targetVideoTrack}get currentDualVideoTrack(){return this._targetDualVideoTrack}get publishVideoStream(){return this._publishVideoStream}get publishDualVideoStream(){return this._publishDualVideoStream}get currentAudioTrack(){return this._targetAudioTrack}get publishAudioStream(){return this._publishAudioStream}get previewStream(){return this._previewStream}updateVideoTrack(e,t=!1){return z(this,null,function*(){(this._targetVideoTrack!==e||t)&&(this._targetVideoTrack=e)})}updateDualVideoTrack(e,t=!1){return z(this,null,function*(){(this._targetDualVideoTrack!==e||t)&&(this._targetDualVideoTrack=e)})}updateAudioTrack(e,t=!1){return z(this,null,function*(){(this._targetAudioTrack!==e||t)&&(this._targetAudioTrack=e)})}setAudioMuted(e){var t,r;this._audioMuted=e,e?(t=this.publishAudioStream)==null||t.disableAudio():(r=this.publishAudioStream)==null||r.enableAudio()}get isAudioMuted(){return this._audioMuted}setVideoMuted(e){var t,r;this._videoMuted=e,e?(t=this.publishVideoStream)==null||t.disableVideo():(r=this.publishVideoStream)==null||r.enableVideo()}get isVideoMuted(){return this._videoMuted}process(e){return z(this,null,function*(){var t,r,i,n,a,o,u,h,v,f,d,p;this._targetAudioTrack=this.originAudioTrack,this._targetVideoTrack=this.originVideoTrack;for(const l of this.plugins)try{yield l.execute(this,e)}catch(m){console.error(`error in plugin-${l.name}, error: ${m}`)}this._targetVideoTrack?((r=(t=this._publishVideoStream)==null?void 0:t.videoTrack)==null?void 0:r.id)!==this._targetVideoTrack.id&&(this._publishVideoStream=yield vi(this._targetVideoTrack),this.setVideoMuted(this._videoMuted),(i=this.profileManager)==null||i.setVideoProfile(this.originVideoTrack,this._publishVideoStream,!0),(n=this.profileManager)==null||n.setContentHint(this._targetVideoTrack),this.previewStream?(a=this.previewStream)==null||a.mergeStream(this._publishVideoStream):this._previewStream=yield vi(this._targetVideoTrack)):(this._publishVideoStream=void 0,(o=this.previewStream)==null||o.deleteTracks({video:!0})),this._targetDualVideoTrack?((h=(u=this._publishDualVideoStream)==null?void 0:u.videoTrack)==null?void 0:h.id)!==this._targetDualVideoTrack.id&&(this._publishDualVideoStream=yield vi(this._targetDualVideoTrack),this._videoMuted?this._publishDualVideoStream.disableVideo():this._publishDualVideoStream.enableVideo()):this._publishDualVideoStream=void 0,this._targetAudioTrack?((f=(v=this._publishAudioStream)==null?void 0:v.audioTrack)==null?void 0:f.id)!==this._targetAudioTrack.id&&(this._publishAudioStream=yield vi(this._targetAudioTrack),this.setAudioMuted(this._audioMuted),this.previewStream?(d=this.previewStream)==null||d.mergeStream(this._publishAudioStream):this._previewStream=yield vi(this._targetAudioTrack)):(this._publishAudioStream=void 0,(p=this.previewStream)==null||p.deleteTracks({audio:!0}))})}stopVideo(){var e,t;this.originVideoTrack&&((e=this.originVideoTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(t=this.originVideoTrack)==null||t.stop(),this.originVideoTrack=void 0),this.updateVideoTrack(void 0)}stopAudio(){var e,t;this.originAudioTrack&&((e=this.originAudioTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(t=this.originAudioTrack)==null||t.stop(),this.originAudioTrack=void 0),this.updateAudioTrack(void 0)}stop(){this.stopVideo(),this.stopAudio()}updateVideoProfile(e,t){return z(this,null,function*(){this._profileManager||(this._profileManager=new ps),e&&this._profileManager.updateProfile(e,t),yield this._profileManager.setVideoProfile(this.originVideoTrack,this._publishVideoStream,this.type===Ke.AliRtcSdkStreamTypeScreen)})}get videoProfile(){var e;return(e=this.profileManager)==null?void 0:e.videoProfile}setVideoContentHint(e){this._profileManager||(this._profileManager=new ps),this._profileManager.setContentHint(this.currentVideoTrack,e)}updateAudioProfile(e){return z(this,null,function*(){this._profileManager||(this._profileManager=new ps),this._profileManager.updateAudioProfile(e)})}cloneVideoProfile(e){return z(this,null,function*(){var t;yield(t=this.profileManager)==null?void 0:t.setVideoProfile(void 0,e)})}addPlugin(e){const t=this.plugins.findIndex(r=>r.zIndex>e.zIndex);t>-1?this.plugins.splice(t,0,e):this.plugins.push(e)}removePlugin(e){const t=this.plugins.indexOf(e);return t>-1?(e.clear(this),this.plugins.splice(t,1),!0):!1}}var d0=Object.defineProperty,f0=Object.getOwnPropertyDescriptor,xt=(s,c,e,t)=>{for(var r=t>1?void 0:t?f0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&d0(c,e,r),r};const gt=(ri=class extends ve{constructor(e,t){super();A(this,"pluginManager");A(this,"slsReporter");A(this,"publishingCameraVideoStream");A(this,"publishingScreenVideoStream");A(this,"cameraStreamInfo",new ms(Ke.AliRtcSdkStreamTypeCapture));A(this,"screenStreamInfo",new ms(Ke.AliRtcSdkStreamTypeScreen));A(this,"streamInfos",[this.cameraStreamInfo,this.screenStreamInfo]);A(this,"_audioCaptureDisabled",!1);A(this,"_cameraCaptureDisabled",!1);A(this,"_publishLocalAudioStreamEnabled",!0);A(this,"_publishLocalVideoStreamEnabled",!0);A(this,"_publishLocalScreenStreamEnabled",!0);this.screenStreamInfo.setVideoContentHint("motion"),this.pluginManager=e,this.slsReporter=t;const r=i=>z(this,null,function*(){if(oe.info(`[${ri.logName}]`,"plugin added",i.name),!i.isSupported("6.11.6-beta.2")){console.warn(`${i.name} is not supported!!!`),i.emit("unsupported");return}try{yield i.init()}catch(n){i.emit("error",ne.fromError(n,Pt.AliRtcPluginErrorInitError))}i.streamType===Ke.AliRtcSdkStreamTypeCapture&&(this.cameraStreamInfo.addPlugin(i),yield this.cameraStreamInfo.process(this.streamInfos)),i.streamType===Ke.AliRtcSdkStreamTypeScreen&&(this.screenStreamInfo.addPlugin(i),yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")});this.cameraStreamInfo.updateVideoProfile(oa,mi),this.cameraStreamInfo.on("videotrackended",()=>z(this,null,function*(){yield this.stopLocalStream({video:!0}),this.emit("trackended",Gt.VideoTrackEnded)})),this.cameraStreamInfo.on("audiotrackended",()=>z(this,null,function*(){yield this.stopLocalStream({audio:!0}),this.emit("trackended",Gt.AudioTrackEnded)})),this.screenStreamInfo.updateVideoProfile(ca,gi),this.screenStreamInfo.on("videotrackended",()=>z(this,null,function*(){yield this.stopLocalStream({screen:!0}),this.emit("trackended",Gt.ScreenTrackEnded)})),this.pluginManager.on("added",r),this.pluginManager.on("removed",i=>z(this,null,function*(){this.cameraStreamInfo.removePlugin(i)&&(yield this.cameraStreamInfo.process(this.streamInfos)),this.screenStreamInfo.removePlugin(i)&&(yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")})),this.pluginManager.on("updated",()=>z(this,null,function*(){yield this.updateStreams()}))}get hasCamera(){return!!this.cameraStreamInfo.originVideoTrack}get audioCaptureDisabled(){return this._audioCaptureDisabled}set audioCaptureDisabled(e){this._audioCaptureDisabled=e}get cameraCaptureDisabled(){return this._cameraCaptureDisabled}setAudioMuted(e){this.cameraStreamInfo.setAudioMuted(e)}get isAudioMuted(){return this.cameraStreamInfo.isAudioMuted}setCameraMuted(e){this.cameraStreamInfo.setVideoMuted(e)}get isCameraMuted(){return this.cameraStreamInfo.isVideoMuted}setScreenMuted(e){this.screenStreamInfo.setVideoMuted(e)}get isScreenMuted(){return this.screenStreamInfo.isVideoMuted}set cameraCaptureDisabled(e){this._cameraCaptureDisabled=e}get publishLocalAudioStreamEnabled(){return this._publishLocalAudioStreamEnabled}set publishLocalAudioStreamEnabled(e){this._publishLocalAudioStreamEnabled=e}get publishLocalVideoStreamEnabled(){return this._publishLocalVideoStreamEnabled}set publishLocalVideoStreamEnabled(e){this._publishLocalVideoStreamEnabled=e}get publishLocalScreenStreamEnabled(){return this._publishLocalScreenStreamEnabled}set publishLocalScreenStreamEnabled(e){this._publishLocalScreenStreamEnabled=e}updateStreams(){return z(this,null,function*(){yield this.cameraStreamInfo.process(this.streamInfos),yield this.screenStreamInfo.process(this.streamInfos),this.emit("publishupdate")})}setAvailableCameraDeviceId(){return z(this,null,function*(){var e,t,r,i;if((e=this.cameraStreamInfo.cameraVideoConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.cameraVideoConstraints)==null?void 0:t.deviceId;const a=yield me.AliRTS.getCameraList();a.find(o=>o.deviceId===n)||(n=(i=(r=a.find(o=>!!o.deviceId))==null?void 0:r.deviceId)!=null?i:""),this.cameraStreamInfo.cameraVideoConstraints.deviceId=n}})}setAvailableMicrophoneDeviceId(){return z(this,null,function*(){var e,t,r,i;if((e=this.cameraStreamInfo.micAudioConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.micAudioConstraints)==null?void 0:t.deviceId;const a=yield me.AliRTS.getMicList();a.find(o=>o.deviceId===n)||(n=(i=(r=a.find(o=>!!o.deviceId))==null?void 0:r.deviceId)!=null?i:""),this.cameraStreamInfo.micAudioConstraints.deviceId=n}})}createLocalStream(e){return z(this,null,function*(){var v;const{screen:t,mediaStream:r,videoProfile:i,screenProfile:n}=e;let{video:a,audio:o}=e;const u=Zc(e);let h;if(u){r||(a===!0&&this.cameraStreamInfo.cameraVideoConstraints?(yield this.setAvailableCameraDeviceId(),a=Se({},this.cameraStreamInfo.cameraVideoConstraints)):typeof a=="object"&&(yield this.setAvailableCameraDeviceId(),a=Se(Se({},a),this.cameraStreamInfo.cameraVideoConstraints)),o===void 0&&this.audioCaptureDisabled?o=!1:o&&(o===!0&&this.cameraStreamInfo.micAudioConstraints?(yield this.setAvailableMicrophoneDeviceId(),o=Se({},this.cameraStreamInfo.micAudioConstraints)):typeof o=="object"&&(yield this.setAvailableMicrophoneDeviceId(),o=Se(Se({},o),this.cameraStreamInfo.micAudioConstraints)),this._audioCaptureDisabled=!1));const f=Date.now();try{h=yield me.AliRTS.createStream({audio:o,video:a,screen:t,custom:!!r,mediaStream:r,skipProfile:!0}),o&&!r&&this.slsReporter.reportAudio(null,Date.now()-f,((v=h==null?void 0:h.audioTrack)==null?void 0:v.label)||""),t&&!r&&this.slsReporter.reportScreen(null,Date.now()-f)}catch(d){throw o&&!r&&this.slsReporter.reportAudio(d,Date.now()-f,""),t&&!r&&this.slsReporter.reportScreen(null,Date.now()-f),d}if(t)yield this.screenStreamInfo.updateSource(h,Yt.Screen,_i.Screen),yield this.setScreenProfile(n),this.setScreenContentHint(),this.publishingScreenVideoStream=void 0;else if(yield this.cameraStreamInfo.updateSource(h,Yt.Camera,_i.Microphone),h.hasVideo&&(yield this.setVideoProfile(i),this.setVideoContentHint(),this.publishingCameraVideoStream=void 0),h.hasAudio&&typeof o=="boolean"){const d=this.cameraStreamInfo.audioProfile;d&&(yield h.setAudioProfile(d))}}return me.AliRTS.SystenUtil.isIos&&me.AliRTS.SystenUtil.compareVersion("15.1")&&!me.AliRTS.SystenUtil.compareVersion("15.2")&&(yield $t(1e3)),yield this.updateStreams(),h})}stopLocalStream(e){return z(this,null,function*(){const{screen:t,video:r,audio:i}=e!=null?e:{};let n=!1;r&&this.cameraStreamInfo.originVideoTrack&&(n=!0,this.cameraStreamInfo.stopVideo(),this.publishingCameraVideoStream=void 0),i&&this.cameraStreamInfo.originAudioTrack&&(n=!0,this.cameraStreamInfo.stopAudio()),t&&this.screenStreamInfo.originVideoTrack&&(n=!0,this.screenStreamInfo.stop(),this.publishingScreenVideoStream=void 0,this.slsReporter.reportScreenStop(null)),n&&(yield this.updateStreams())})}get publishStreams(){const{publishLocalVideoStreamEnabled:e,publishLocalAudioStreamEnabled:t,publishLocalScreenStreamEnabled:r}=this;return{video:e?this.cameraStreamInfo.publishVideoStream:void 0,videoSmall:e?this.cameraStreamInfo.publishDualVideoStream:void 0,audio:t?this.cameraStreamInfo.publishAudioStream:void 0,screen:r?this.screenStreamInfo.publishVideoStream:void 0}}createHTTPPublishStream(){return z(this,null,function*(){var o,u,h,v;let e,t=!1,r,i,n;const a=yield this.publishStreams;try{if(!a.audio&&!a.video&&!a.videoSmall&&!a.screen)throw new ne(ce.ERR_SDK_PUBLISH_INVAILD,"no tracks founded");const f=new MediaStream;(o=a.audio)!=null&&o.audioTrack&&f.addTrack(a.audio.audioTrack),(u=a.video)!=null&&u.videoTrack?(f.addTrack(a.video.videoTrack),i=a.videoSmall,n=a.screen):(h=a.screen)!=null&&h.videoTrack&&(r=Z.Screen,f.addTrack((v=a.screen)==null?void 0:v.videoTrack),t=!0),e=yield fa(f),t?(this.screenStreamInfo.cloneVideoProfile(e),this.publishingScreenVideoStream=e):(this.cameraStreamInfo.cloneVideoProfile(e),this.publishingCameraVideoStream=e)}catch(f){}return{publishStream:e,videoSmallStream:i,screenStream:n,vMsid:r}})}stop(){this.cameraStreamInfo.stop(),this.screenStreamInfo.stop()}setVideoProfile(e,t){return z(this,null,function*(){yield this.cameraStreamInfo.updateVideoProfile(e,t),this.publishingCameraVideoStream&&this.cameraStreamInfo.cloneVideoProfile(this.publishingCameraVideoStream)})}setVideoContentHint(e){this.cameraStreamInfo.setVideoContentHint(e)}setAudioProfile(e){return z(this,null,function*(){var t;yield this.cameraStreamInfo.updateAudioProfile(e),yield(t=this.publishingCameraVideoStream)==null?void 0:t.setAudioProfile(e)})}setScreenProfile(e,t){return z(this,null,function*(){yield this.screenStreamInfo.updateVideoProfile(e,t),this.publishingScreenVideoStream&&this.screenStreamInfo.cloneVideoProfile(this.publishingScreenVideoStream)})}setScreenContentHint(e){this.screenStreamInfo.setVideoContentHint(e)}setCameraVideoConstraints(e){var t;this.cameraStreamInfo.cameraVideoConstraints=Se(Se({},(t=this.cameraStreamInfo.cameraVideoConstraints)!=null?t:{}),e)}setMicAudioConstraints(e){var t;this.cameraStreamInfo.micAudioConstraints=Se(Se({},(t=this.cameraStreamInfo.micAudioConstraints)!=null?t:{}),e)}},A(ri,"logName","LocalStreamManager"),ri);xt([j(([s])=>{const{audio:c,video:e,screen:t,custom:r,skipProfile:i,videoProfile:n,screenProfile:a}=s;return[{audio:c,video:e,screen:t,custom:r,skipProfile:i,videoProfile:n,screenProfile:a}]})],gt.prototype,"createLocalStream",1),xt([j(ae)],gt.prototype,"stopLocalStream",1),xt([j()],gt.prototype,"createHTTPPublishStream",1),xt([j()],gt.prototype,"stop",1),xt([j(ae)],gt.prototype,"setVideoProfile",1),xt([j(ae)],gt.prototype,"setVideoContentHint",1),xt([j(ae)],gt.prototype,"setAudioProfile",1),xt([j(ae)],gt.prototype,"setScreenProfile",1),xt([j(ae)],gt.prototype,"setScreenContentHint",1),xt([j(ae)],gt.prototype,"setCameraVideoConstraints",1),xt([j(ae)],gt.prototype,"setMicAudioConstraints",1);let p0=gt;var m0=Object.defineProperty,g0=Object.getOwnPropertyDescriptor,bt=(s,c,e,t)=>{for(var r=t>1?void 0:t?g0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&m0(c,e,r),r};class ot extends ve{constructor(e){super();A(this,"self");A(this,"userMap",{});A(this,"usersViewMap",{});A(this,"rtsManager");A(this,"localStreamManager");A(this,"authInfo");A(this,"signalingManager");A(this,"pluginManager");A(this,"slsReporter");A(this,"statsMonitorId");A(this,"autoSubAudio",!0);A(this,"autoSubVideo",!0);A(this,"autoSubScreen",!0);A(this,"wantSubAudio",!0);A(this,"wantSubVideo",!0);A(this,"wantSubScreen",!0);A(this,"defaultStreamType",Je.AliRtcVideoStreamTypeHigh);A(this,"audioMuted",!1);A(this,"playoutVolume",1);A(this,"audioVolumeIndicationInterval",0);A(this,"indicationTimer",0);const{signalingManager:t,slsReporter:r}=e;this.signalingManager=t,this.addSignalingManagerListener(),this.slsReporter=r,this.pluginManager=new c0,this.localStreamManager=new p0(this.pluginManager,this.slsReporter),this.rtsManager=new l0(this.localStreamManager,this.slsReporter),this.self=new da({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval})}addSignalingManagerListener(){this.signalingManager.on("onNotifyPublish",e=>{oe.event("[Signaling] Notify Publish ",e),e.forEach(t=>{this.onRemotePublishStateChange(t)})}),this.signalingManager.stsManager.on("onTokenUpdate",(e,t)=>{oe.updateToken(e),this.slsReporter.updateToken(t,e)})}isAutoSubAudio(){return this.autoSubAudio}setAutoSubAudio(e){this.autoSubAudio=e}isAutoSubVideo(){return this.autoSubVideo}setAutoSubVideo(e){this.autoSubVideo=e}isAutoSubScreen(){return this.autoSubScreen}setAutoSubScreen(e){this.autoSubScreen=e}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e,this.remoteUsers.forEach(t=>{t.setWantSubAudio(e),t.updateSubscribe(Be.User)})}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e,this.remoteUsers.forEach(t=>{t.setWantSubVideo(e),t.updateSubscribe(Be.User)})}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e,this.remoteUsers.forEach(t=>{t.setWantSubScreen(e),t.updateSubscribe(Be.User)})}setRemoteDefaultVideoStreamType(e){this.defaultStreamType=e,this.remoteUsers.forEach(t=>{t.setRemoteDefaultVideoStreamType(e)})}setRemoteUserVideoStreamType(e,t){var r;(r=this.getRemoteUser(e))==null||r.setRemoteDefaultVideoStreamType(t)}setAudioMuted(e){this.audioMuted=e,this.remoteUsers.forEach(t=>{t.setAudioMuted(e)})}setLocalViewConfig(e,t){var i;if(!e)return(i=this.publisher)==null?void 0:i.setViewConfig(null,t);const r=fs(e);r.length!==0&&r.forEach(n=>{var a,o;(a=this.publisher)==null||a.resetElement(n),Object.values(this.usersViewMap).forEach(({cameraViews:u=[],screenViews:h=[]})=>{u.includes(n)&&u.splice(u.indexOf(n),1),h.includes(n)&&h.splice(h.indexOf(n),1)}),(o=this.publisher)==null||o.setViewConfig(r,t)})}setRemoteViewConfig(e,t,r){var n,a;if(!t)return(n=this.userMap[e])==null?void 0:n.setViewConfig(null,r);const i=fs(t);i.length!==0&&(i.forEach(o=>{var u;(u=this.publisher)==null||u.resetElement(o),Object.values(this.usersViewMap).forEach(({cameraViews:h=[],screenViews:v=[]})=>{h.includes(o)&&h.splice(h.indexOf(o),1),v.includes(o)&&v.splice(v.indexOf(o),1)})}),(a=this.userMap[e])==null||a.setViewConfig(i,r))}get channel(){var e;return(e=this.authInfo)==null?void 0:e.channelId}get userId(){var e;return(e=this.authInfo)==null?void 0:e.userId}get remoteUsers(){return Object.values(this.userMap)}get publisher(){return this.self}get isSubscribing(){var e;return((e=this.remoteUsers)!=null?e:[]).some(t=>{var o;const{isAudioSubscribing:r,isVideoLargeSubscribing:i,isVideoSmallSubscribing:n,isScreenSubscribing:a}=(o=t.streamInfo)!=null?o:{};return r||i||n||a})}onRemotePublishStateChange(e){var f;const{userid:t,callid:r,subscribe:i,pubid:n="",tracks:a}=e,o=(f=i==null?void 0:i.pullstreamurl)!=null?f:"";let u=this.getRemoteUser(t);if(!u)return;const h=u.streamInfo.audioTrackInfo,v=u.streamInfo.videoTrackInfo;u.updateRemoteTracks(r,o,n,a),u.updateSubscribe(Be.Publish),(h!==u.streamInfo.audioTrackInfo||v!==u.streamInfo.videoTrackInfo)&&this.emit("remoteTrackAvailableChange",t,u.streamInfo.audioTrackInfo,u.streamInfo.videoTrackInfo)}init(e,t){var r;this.authInfo=e,this.self||(this.self=new da({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval})),this.self.enableAudioVolumeIndication(this.audioVolumeIndicationInterval),(r=this.self)==null||r.initInfo(e,t.pushstreamurl),t.users.forEach(i=>{const n=i.userid;if(n){const a=this.addUser(n,i.displayname,Be.InRoom),{callid:o,subscribe:u,tracks:h}=i;a.updateRemoteTracks(o,(u==null?void 0:u.pullstreamurl)||"","",h),this.emit("remoteTrackAvailableChange",n,a.streamInfo.audioTrackInfo,a.streamInfo.videoTrackInfo)}}),this.startStatsMonitor()}clear(){return z(this,null,function*(){var e;this.stopStatsMonitor();for(let t in this.userMap)this.userMap[t]&&(yield this.userMap[t].clear(),delete this.userMap[t]);yield(e=this.self)==null?void 0:e.clear(),this.authInfo=void 0})}startStatsMonitor(){this.statsMonitorId=window.setInterval(()=>z(this,null,function*(){if(this.publisher){const{audio:r,video:i,transport:n}=yield this.publisher.getStats();r&&r.length>0&&this.emit("rtcLocalAudioStats",r),i&&i.length>0&&this.emit("rtcLocalVideoStats",i),n&&this.emit("rtcStats",n)}const e=[],t=[];for(const r of this.remoteUsers){const{audio:i,video:n}=yield r.getStats();i&&i.forEach(a=>{e.push(a)}),n&&n.forEach(a=>{t.push(a)})}e.length>0&&this.emit("rtcRemoteAudioStats",e),t.length>0&&this.emit("rtcRemoteVideoStats",t)}),2e3)}stopStatsMonitor(){this.statsMonitorId&&clearInterval(this.statsMonitorId)}addUser(e,t,r){return this.userMap[e]||(this.userMap[e]=this.executeAddUser(e,t,r)),this.userMap[e]}executeAddUser(e,t,r){const i=new Ue({userId:e,displayName:t,rtsManager:this.rtsManager,signalingManager:this.signalingManager,usersViewMap:this.usersViewMap,slsReporter:this.slsReporter,localUser:this.self,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,playoutVolume:this.playoutVolume});return i.on(et.Remote,this.onRemoteDeviceStatusChange.bind(this)),i.on(Ie.PullStreamStats,this.onRemoteStatReport.bind(this)),i.on(Ie.RtsSubscribeExceeds,this.onSubscribeExceeds.bind(this)),i.on("audioSubscribeStateChanged",(n,a,o,u)=>{this.emit("audioSubscribeStateChanged",n,a,o,u,this.channel||"")}),i.on("videoSubscribeStateChanged",(n,a,o,u)=>{this.emit("videoSubscribeStateChanged",n,a,o,u,this.channel||"")}),i.on("screenSubscribeStateChanged",(n,a,o,u)=>{this.emit("screenSubscribeStateChanged",n,a,o,u,this.channel||"")}),i.on("remoteAudioAutoPlayFail",n=>{this.emit("remoteAudioAutoPlayFail",n)}),i.on("remoteVideoAutoPlayFail",(n,a)=>{this.emit("remoteVideoAutoPlayFail",n,a)}),i.on("remoteSubscribeError",n=>{this.emit("remoteSubscribeError",n)}),i.setWantSubAudio(this.autoSubAudio&&this.wantSubAudio),i.setWantSubVideo(this.autoSubVideo&&this.wantSubVideo),i.setWantSubScreen(this.autoSubScreen&&this.wantSubScreen),i.setRemoteDefaultVideoStreamType(this.defaultStreamType),i.setAudioMuted(this.audioMuted),(this.autoSubAudio||this.autoSubVideo||this.autoSubScreen)&&i.updateSubscribe(r),i}onRemoteDeviceStatusChange(e,t){e===Ie.MuteAudio?this.emit("userAudioMuted",t,!0):e===Ie.UnmuteAudio?this.emit("userAudioMuted",t,!1):e===Ie.MuteVideo?this.emit("userVideoMuted",t,!0):e===Ie.UnmuteVideo?this.emit("userVideoMuted",t,!1):e===Ie.MuteScreen?this.emit("userScreenMuted",t,!0):e===Ie.UnmuteScreen&&this.emit("userScreenMuted",t,!1)}onRemoteStatReport(e,t,r){this.emit(Ie.PullStreamStats,e,t,r)}onSubscribeExceeds(e,t){this.emit(Ie.RtsSubscribeExceeds,e,t)}removeLeftUser(e){return z(this,null,function*(){e.userid&&this.userMap[e.userid]&&(yield this.userMap[e.userid].clear(!1),delete this.userMap[e.userid])})}updateUsers(e){const t=[],r=[],i={};e.forEach(o=>{o.userid&&(this.userMap[o.userid]?(r.push(o),i[o.userid]=this.userMap[o.userid]):(t.push(o),i[o.userid]=this.executeAddUser(o.userid,o.displayname,Be.Resume)))});const n=Object.keys(this.userMap),a=[];return n.forEach(o=>{i[o]||a.push({userid:o,reason:"",leavecode:os.AliRtcUserOfflineQuit})}),this.userMap=i,{joinList:t,leaveList:a,presentList:r}}getRemoteUser(e){return this.userMap[e]}updateRemoteUserDeviceStatus(e){e&&e.userid&&this.userMap[e.userid]&&this.userMap[e.userid].updateRemoteUserDeviceStatus(e.status)}updateAudioWant(e,t){const r=this.userMap[e];if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r.setWantSubAudio(t),t?r.updateSubscribe(Be.User):r.stopSubscribe({audio:!0})}updateVideoWant(e,t){const r=this.userMap[e];if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r.setWantSubVideo(t),t?r.updateSubscribe(Be.User):r.stopSubscribe({video:!0})}updateScreenWant(e,t){const r=this.userMap[e];if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r.setWantSubScreen(t),t?r.updateSubscribe(Be.User):r.stopSubscribe({screen:!0})}stopIndication(){this.indicationTimer&&window.clearInterval(this.indicationTimer)}startIndication(e){this.stopIndication(),this.indicationTimer=window.setInterval(()=>{var r;const t=this.remoteUsers.map(i=>({userId:i.userId,volume:i.getAudioLevel()||0}));t.unshift({userId:"",volume:((r=this.self)==null?void 0:r.getAudioLevel())||0}),this.emit("audioVolume",t)},e)}enableAudioVolumeIndication(e){var t;this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.stopIndication(),e>0&&this.startIndication(e),this.audioVolumeIndicationInterval=e,this.remoteUsers.forEach(r=>{r.enableAudioVolumeIndication(e)}),(t=this.self)==null||t.enableAudioVolumeIndication(e))}setPlayoutVolume(e){this.playoutVolume=e,this.remoteUsers.forEach(t=>{t.setPlayoutVolume(e)})}refreshAuthInfo(e){var t;this.authInfo&&(this.authInfo=Se(Se({},this.authInfo),e)),e.userId&&((t=this.self)==null||t.refreshUserInfo(e.userId))}setEnableMediaExtensionMsg(e){this.rtsManager.setEncodedInsertableStreams(e)}setAudioRedEnabled(e){this.rtsManager.setAudioRedEnabled(e)}}A(ot,"logName","BizControl"),bt([j()],ot.prototype,"init",1),bt([j()],ot.prototype,"clear",1),bt([j(ae)],ot.prototype,"addUser",1),bt([j()],ot.prototype,"removeLeftUser",1),bt([j()],ot.prototype,"updateUsers",1),bt([j(ae)],ot.prototype,"updateAudioWant",1),bt([j(ae)],ot.prototype,"updateVideoWant",1),bt([j(ae)],ot.prototype,"updateScreenWant",1),bt([j()],ot.prototype,"stopIndication",1),bt([j()],ot.prototype,"startIndication",1),bt([j()],ot.prototype,"enableAudioVolumeIndication",1);const gs=s=>z(this,null,function*(){const c=new Uint8Array(160).fill(170),e=new TextEncoder().encode(s),t=yield window.crypto.subtle.importKey("raw",c,{name:"HMAC",hash:{name:"SHA-1"}},!1,["sign"]),r=yield window.crypto.subtle.sign("HMAC",t,e);return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")});class v0{constructor(c){A(this,"authInfo");A(this,"slsReporter");this.slsReporter=c}doRequest(c,e){var u;const t=this.authInfo;if(!t)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const r="https://gw.rtn.aliyuncs.com",i=Lc[c],n={appid:t.appId,userid:t.userId,channelid:t.channelId,timestamp:t.timestamp,token:t.token,nonce:t.nonce?t.nonce:"",requestid:At.createCallid(),tokensid:!1,session:(u=t.sessionId)!=null?u:At.createCallid()},a=Object.keys(n).map(h=>`${h}=${encodeURIComponent(n[h])}`).join("&"),o=`${r}${i}?${a}`;return fetch(o,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(e)}).then(h=>h.status!==200?(this.slsReporter.reportTranscodingError(h.status,e.taskid||""),Promise.reject(new ne(ce.ERR_INNER,`transcoding request failed, status: ${h.status}`))):h).catch(h=>Promise.reject(new ne(ce.ERR_INNER,`transcoding request failed, err: ${h.message}`)))}setAuthInfo(c){this.authInfo=c}clear(){this.authInfo=void 0}startPublishLiveStream(c,e){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=yield gs(c.split("?")[0]),r=st.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(r,this.authInfo,t,c);return this.doRequest(r,i)})}startPublishLiveStreamWithTaskId(c,e){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=st.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(t,this.authInfo,c);return this.doRequest(t,r)})}updatePublishLiveStream(c,e){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=yield gs(c.split("?")[0]),r=st.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(r,this.authInfo,t,c);return this.doRequest(r,i)})}updatePublishLiveStreamWithTaskId(c,e){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=st.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(t,this.authInfo,c);return this.doRequest(t,r)})}stopPublishLiveStream(c){return z(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const e=yield gs(c.split("?")[0]),t=st.MPU_TASK_TRANSACTION_STOP,r=new Pi().toJson(t,this.authInfo,e,c);return this.doRequest(t,r)})}stopPublishLiveStreamWithTaskId(c){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const e=st.MPU_TASK_TRANSACTION_STOP,t=new Pi().toJson(e,this.authInfo,c);return this.doRequest(e,t)}refreshAuthInfo(c){this.authInfo&&this.setAuthInfo(Se(Se({},this.authInfo),c))}}class ma{constructor(c){A(this,"name","COMMON");this.name=c||this.name}info(...c){}warn(...c){}print(c,...e){const t=c.toLowerCase();t&&console[t](`[${c}][${this.name}]`,...e)}}A(ma,"LEVEL",0);class x0{constructor(){A(this,"logger",new ma("AudioMixer"));A(this,"audioContext",new AudioContext);A(this,"audioDestination",this.audioContext.createMediaStreamDestination());A(this,"audioTrack",qc(this.audioDestination.stream));A(this,"sourceNodeMap",{})}get sourceNodeList(){return Object.values(this.sourceNodeMap).map(c=>c.sourceNode).filter(c=>!!c)}get gainNodeList(){return Object.values(this.sourceNodeMap).map(c=>c.gainNode).filter(c=>!!c)}get sourceCount(){return this.sourceNodeList.length}resume(){var c;return(c=this.audioContext)==null?void 0:c.resume()}addTrack(c){this.connectTrack(c)}hasTrack(c){return!!this.sourceNodeMap[c]}removeTrack(c){const{sourceNode:e,gainNode:t}=this.sourceNodeMap[c]||{};t==null||t.disconnect(),e==null||e.disconnect(),delete this.sourceNodeMap[c],e?this.logger.info("SourceNode disconnected. Active source node:",this.sourceNodeList.length):this.logger.warn(`SourceNode ${c} does not exit. Active source node: ${this.sourceNodeList.length}`)}getAudioTrack(){return this.audioTrack}setVolume(c,e){const{gainNode:t}=this.sourceNodeMap[e]||{};t?(this.logger.info(`Setting node(${e}) volume to ${this.scale(c)}`),t.gain.value=this.scale(c)):this.logger.warn(`GainNode ${e} does not exit.`)}reset(){this.disconnectSourceNode(),this.sourceNodeMap={}}dispose(){var c;this.reset(),(c=this.audioTrack)==null||c.stop(),this.audioDestination.disconnect(),this.audioContext.close()}connectTrack(c){if(!this.audioContext)return this.logger.warn("AudioContext not initialized");let e=new MediaStream;e.addTrack(c);const t=this.audioContext.createMediaStreamSource(e),r=this.audioContext.createGain();r.gain.value=1,t.connect(r),r.connect(this.audioDestination),this.sourceNodeMap[c.id]={track:c,sourceNode:t,gainNode:r},this.logger.info("New sourceNode connected. Active source node:",this.sourceNodeList.length)}disconnectSourceNode(){this.sourceNodeList.forEach(c=>c.disconnect()),this.gainNodeList.forEach(c=>c.disconnect())}scale(c){return c/100}}const b0=4;class S0 extends ei{constructor(){super("audioMixer",Ke.AliRtcSdkStreamTypeCapture,Ti.AUDIO);A(this,"audioMixer");A(this,"primaryAudioTrackId");A(this,"screenAudioTrackId");A(this,"dirty",!1);this.zIndex=8}get initOptions(){return{audio:1,screen:1}}setOptions(e){Object.entries(e).forEach(([t,r])=>{this.isValidVolume(r)&&(this.options[t]=r)}),this.dirty=!0,this.emit("updated")}isSupported(){return"AudioContext"in window}shouldUpdate(e,t){var n,a;if(e.type!==Ke.AliRtcSdkStreamTypeCapture)return!1;const r=t.find(o=>o.type===Ke.AliRtcSdkStreamTypeCapture),i=t.find(o=>o.type===Ke.AliRtcSdkStreamTypeScreen);return!(this.primaryAudioTrackId===((n=r==null?void 0:r.currentAudioTrack)==null?void 0:n.id)&&this.screenAudioTrackId===((a=i==null?void 0:i.currentAudioTrack)==null?void 0:a.id)&&!this.dirty)}process(e,t){return z(this,null,function*(){var a,o;this.dirty=!1;const r=t.find(u=>u.type===Ke.AliRtcSdkStreamTypeScreen),i=e.currentAudioTrack,n=r==null?void 0:r.currentAudioTrack;if(!n&&this.options.audio===1){this.audioMixer&&(this.audioMixer.dispose(),this.audioMixer=void 0),this.primaryAudioTrackId=i==null?void 0:i.id,e.updateAudioTrack(i);return}this.audioMixer||(this.audioMixer=new x0),yield this.audioMixer.resume(),this.primaryAudioTrackId&&(i==null?void 0:i.id)!==this.primaryAudioTrackId&&((a=this.audioMixer)==null||a.removeTrack(this.primaryAudioTrackId)),i&&!this.audioMixer.hasTrack(i==null?void 0:i.id)&&this.audioMixer.addTrack(i),this.primaryAudioTrackId=i==null?void 0:i.id,this.screenAudioTrackId&&(n==null?void 0:n.id)!==this.screenAudioTrackId&&((o=this.audioMixer)==null||o.removeTrack(this.screenAudioTrackId)),n&&!this.audioMixer.hasTrack(n==null?void 0:n.id)&&this.audioMixer.addTrack(n),this.screenAudioTrackId=n==null?void 0:n.id,this.updateVolume(),e.updateAudioTrack(this.audioMixer.getAudioTrack())})}isValidVolume(e){return e!==void 0&&e>=0&&e<=b0}updateVolume(){this.audioMixer&&(this.primaryAudioTrackId&&this.audioMixer.setVolume(this.options.audio*100,this.primaryAudioTrackId),this.screenAudioTrackId&&this.audioMixer.setVolume(this.options.screen*100,this.screenAudioTrackId))}clear(e){var t;(t=this.audioMixer)==null||t.dispose(),super.clear(e)}}class vs{constructor(c,e){A(this,"originTrack");A(this,"originVideo");A(this,"targetWidth");A(this,"targetHeight");A(this,"targetFrameRate");A(this,"targetCanvas");A(this,"animationFrameId");A(this,"resultTrack");this.targetWidth=e.width,this.targetHeight=e.height,this.targetFrameRate=e.frameRate,this.originTrack=c,this.originVideo=document.createElement("video"),this.originVideo.muted=!0,this.originVideo.autoplay=!0,this.originVideo.controls=!1,this.targetCanvas=document.createElement("canvas"),this.targetCanvas.width=this.targetWidth,this.targetCanvas.height=this.targetHeight}updateOptions(c){this.targetWidth=c.width,this.targetHeight=c.height,this.targetFrameRate=c.frameRate,this.targetCanvas.width=this.targetWidth,this.targetCanvas.height=this.targetHeight,this.resultTrack&&this.resultTrack.applyConstraints({frameRate:this.targetFrameRate})}dispose(){}getVideoTrack(){return this.resultTrack||(this.resultTrack=this.targetCanvas.captureStream().getVideoTracks()[0],this.resultTrack.applyConstraints({frameRate:this.targetFrameRate})),this.resultTrack}cancelAnimation(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}getPositionAndSize(c,e,t,r){const i=e/c,n=r/t;let a=t,o=r,u=0,h=0;return n>i?(a=Math.round(o/i),u=Math.round((t-a)/2)):n<i&&(o=Math.round(a*i),h=Math.round((r-o)/2)),{x:u,y:h,width:a,height:o}}}class _0 extends vs{constructor(e,t){super(e,t);A(this,"targetCtx");this.targetCtx=this.targetCanvas.getContext("2d"),this.startRender=this.startRender.bind(this),this.stopRender=this.startRender.bind(this),this.initStream(e)}initStream(e){const t=new MediaStream;t.addTrack(e),this.originVideo.srcObject=t,this.originVideo.play(),this.originVideo.addEventListener("canplay",this.startRender),this.originVideo.addEventListener("pause",this.stopRender),this.originVideo.addEventListener("ended",this.stopRender)}startRender(){this.cancelAnimation();const e=()=>{if(!this.targetCtx)return;const t=this.getPositionAndSize(this.originVideo.videoWidth,this.originVideo.videoHeight,this.targetWidth,this.targetHeight);this.targetCtx.drawImage(this.originVideo,0,0,this.originVideo.videoWidth,this.originVideo.videoHeight,t.x,t.y,t.width,t.height),!this.originVideo.paused&&!this.originVideo.ended&&(this.animationFrameId=requestAnimationFrame(e))};e()}stopRender(){this.cancelAnimation()}dispose(){this.stopRender(),this.originVideo.removeEventListener("play",this.startRender),this.originVideo.removeEventListener("pause",this.stopRender),this.originVideo.removeEventListener("ended",this.stopRender),this.originVideo.pause(),this.originVideo.srcObject=null}}const y0=`
|
|
15
39
|
attribute vec2 a_position;
|
|
16
40
|
attribute vec2 a_texCoord;
|
|
17
41
|
|
|
@@ -32,7 +56,7 @@ void main() {
|
|
|
32
56
|
|
|
33
57
|
v_texCoord = a_texCoord;
|
|
34
58
|
}
|
|
35
|
-
`,
|
|
59
|
+
`,A0=`
|
|
36
60
|
precision mediump float;
|
|
37
61
|
|
|
38
62
|
varying lowp vec2 v_texCoord;
|
|
@@ -41,7 +65,7 @@ uniform sampler2D u_texture;
|
|
|
41
65
|
void main() {
|
|
42
66
|
gl_FragColor = texture2D(u_texture, v_texCoord);
|
|
43
67
|
}
|
|
44
|
-
`;function
|
|
68
|
+
`;function E0(){let s;try{const c=document.createElement("canvas");c.width=1,c.height=1;const e={alpha:!1,depth:!1,stencil:!1,antialias:!1,preferLowPowerToHighPerformance:!0};s=c.getContext("webgl2",e)}catch(c){return!1}return!!s}function w0(s){const c=s.createTexture();return s.bindTexture(s.TEXTURE_2D,c),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),c}function ga(s,c,e){const t=s.createShader(c);if(!t){console.error("create shader failed");return}return s.shaderSource(t,e),s.compileShader(t),s.getShaderParameter(t,s.COMPILE_STATUS)?t:(console.error(`An error occurred compiling the shaders: ${s.getShaderInfoLog(t)}`),s.deleteShader(t),null)}function C0(s,c,e){const t=ga(s,s.VERTEX_SHADER,c),r=ga(s,s.FRAGMENT_SHADER,e),i=s.createProgram();if(!(!i||!t||!r))return s.attachShader(i,t),s.attachShader(i,r),s.linkProgram(i),s.getProgramParameter(i,s.LINK_STATUS)?i:(console.error(`Unable to initialize the shader program: ${s.getProgramInfoLog(i)}`),null)}function I0(s,c,e,t=0,r=0){const i=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,i);const n=t,a=r,o=c+t,u=e+r,h=[n,a,o,a,n,u,n,u,o,a,o,u];return s.bufferData(s.ARRAY_BUFFER,new Float32Array(h),s.STATIC_DRAW),i}class va extends vs{constructor(e,t){super(e,t);A(this,"targetCtx");A(this,"targetTexture");A(this,"locationMap");this.targetCtx=this.targetCanvas.getContext("webgl2"),this.locationMap={},this.startRender=this.startRender.bind(this),this.stopRender=this.startRender.bind(this),this.updateBuffer=this.updateBuffer.bind(this),this.initGL(),this.initStream(e)}static isSupport(){return E0()}initGL(){const e=this.targetCtx;if(!e)return;this.targetTexture=w0(e);const t=C0(e,y0,A0);if(!t){console.log("[ScalerWebGL] program is null.");return}e.useProgram(t);const r=e.getAttribLocation(t,"a_position"),i=e.getAttribLocation(t,"a_texCoord"),n=e.getUniformLocation(t,"u_resolution");if(!n){console.log("[ScalerWebGL] resolutionLocation is null.");return}const a=e.getUniformLocation(t,"u_texture");if(!a){console.log("[ScalerWebGL] textureLocation is null.");return}this.locationMap={program:t,positionLocation:r,texCoordLocation:i,resolutionLocation:n,textureLocation:a},this.updateBuffer()}initStream(e){const t=new MediaStream;t.addTrack(e),this.originVideo.srcObject=t,this.originVideo.play(),this.originVideo.addEventListener("canplay",this.startRender),this.originVideo.addEventListener("pause",this.stopRender),this.originVideo.addEventListener("ended",this.stopRender),this.originVideo.addEventListener("resize",this.updateBuffer)}startRender(){this.cancelAnimation();const e=()=>{this.targetCtx&&(this.renderTexture(),!this.originVideo.paused&&!this.originVideo.ended&&(this.animationFrameId=requestAnimationFrame(e)))};e()}updateBuffer(){const e=this.targetCtx,t=this.locationMap.positionLocation,r=this.locationMap.texCoordLocation,i=this.locationMap.resolutionLocation;if(!e||!this.originVideo.videoWidth||!this.originVideo.videoHeight)return;const n=this.getPositionAndSize(this.originVideo.videoWidth,this.originVideo.videoHeight,this.targetWidth,this.targetHeight),a=I0(e,n.width,n.height,n.x,n.y);e.enableVertexAttribArray(t),e.bindBuffer(e.ARRAY_BUFFER,a),e.vertexAttribPointer(t,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(r);const o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(r,2,e.FLOAT,!1,0,0),e.uniform2f(i,this.targetWidth,this.targetHeight)}renderTexture(){const e=this.targetTexture,t=this.targetCtx,r=this.locationMap.textureLocation;!e||!t||(t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.originVideo),t.useProgram(this.locationMap.program),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,e),t.uniform1i(r,0),t.viewport(0,0,t.canvas.width,t.canvas.height),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLES,0,6))}stopRender(){this.cancelAnimation()}updateOptions(e){super.updateOptions(e),this.updateBuffer()}dispose(){this.stopRender(),this.originVideo.removeEventListener("play",this.startRender),this.originVideo.removeEventListener("pause",this.stopRender),this.originVideo.removeEventListener("ended",this.stopRender),this.originVideo.removeEventListener("resize",this.updateBuffer),this.originVideo.pause(),this.originVideo.srcObject=null}}const R0=`
|
|
45
69
|
var targetOptions={
|
|
46
70
|
width: 320,
|
|
47
71
|
height: 180,
|
|
@@ -126,4 +150,4 @@ onmessage = function(evt) {
|
|
|
126
150
|
break;
|
|
127
151
|
}
|
|
128
152
|
}
|
|
129
|
-
`;class Hs extends ur{constructor(e,t){super(e,t);p(this,"processor");p(this,"trackGenerator");p(this,"worker");this.processor=new MediaStreamTrackProcessor({track:e}),this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.startTransform()}static isSupport(){return"MediaStreamTrackProcessor"in window&&"MediaStreamTrackGenerator"in window&&"TransformStream"in window&&"VideoFrame"in window}startTransform(){const e=new Blob([fc],{type:"text/javascript"}),r=(window.URL||window.webkitURL).createObjectURL(e);this.worker=new Worker(r);const{readable:s}=this.processor,{writable:n}=this.trackGenerator;this.worker.postMessage({type:"startRender",readable:s,writable:n,width:this.targetWidth,height:this.targetHeight,frameRate:this.targetFrameRate},[s,n])}updateOptions(e){super.updateOptions(e),this.worker&&this.worker.postMessage(W({type:"updateOptions"},e))}dispose(){try{this.processor.readable.cancel(),this.trackGenerator.writable.close()}catch(e){}}getVideoTrack(){return this.trackGenerator}}class hr{static isSupport(){return typeof HTMLCanvasElement.prototype.captureStream=="function"}static getInstance(a,e){return Hs.isSupport()?new Hs(a,e):Bs.isSupport()?new Bs(a,e):new cc(a,e)}}class mc extends mt{constructor(){super(...arguments);p(this,"hasVideoTrack",!1);p(this,"videoScaler")}get initOptions(){return{width:320,height:180,frameRate:15}}setOptions(e){var t;this.options=e,(t=this.videoScaler)==null||t.updateOptions(e)}isSupported(){return hr.isSupport()}shouldUpdate(e){return this.hasVideoTrack!==!!e.currentVideoTrack}process(e){return v(this,null,function*(){if(e.currentVideoTrack){if(this.hasVideoTrack=!0,!this.videoScaler){const r=this.options||this.initOptions;this.videoScaler=hr.getInstance(e.currentVideoTrack,r)}const t=this.videoScaler.getVideoTrack();t&&e.updateDualVideoTrack(t)}else e.updateDualVideoTrack(),this.emit("updated"),this.videoScaler&&this.videoScaler.dispose()})}clear(e){super.clear(e),e==null||e.updateDualVideoTrack()}}class lr{static checkString(a){return typeof a=="string"}static checkNumber(a){return typeof a=="number"}static checkHtmlVideoElement(a){return a&&a.nodeName==="VIDEO"}static checkHtmlAudioElement(a){return a&&a.nodeName==="AUDIO"}static checkAuthInfo(a){if(!a)return new E(T.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no authInfo founded");if(!a.appId)return new E(T.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no appId founded");if(!a.channelId)return new E(T.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no channelId founded");if(!a.userId)return new E(T.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no userId founded");if(a.timestamp){if(!lr.checkNumber(a.timestamp))return new E(T.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"timestamp is not number")}else return new E(T.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no timestamp founded");return a.token?null:new E(T.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no token founded")}static checkMediaStreamTrack(a){return a instanceof MediaStreamTrack}static checkVideoEncoderConfiguration(a){return a&&(a.width||a.height||a.frameRate||a.bitrateMax)}}class Fs{constructor(a){p(this,"taskProfile");p(this,"encodeParam");p(this,"users",[]);p(this,"backgroundColor",0);p(this,"backgrounds",[]);p(this,"watermarks",[]);p(this,"clockWidgets",[]);p(this,"cropMode");p(this,"mediaProcessMode");this.taskProfile=a}}class js{constructor(a,e,t){p(this,"userId");p(this,"streamType");p(this,"sourceType");this.userId=a,this.streamType=e,this.sourceType=t}}class $s{constructor(a,e,t,r=0,s=16777215,n=Tt.NOTO_SERIF_CJKSC_REGULAR){p(this,"x");p(this,"y");p(this,"fontSize");p(this,"zOrder");p(this,"fontColor");p(this,"fontType");this.x=a,this.y=e,this.fontSize=t,this.zOrder=r,this.fontColor=s,this.fontType=n}toJson(a,e){return{x:Ce(this.x,a),y:Ce(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:Hi(this.fontColor),zorder:this.zOrder}}}var Ws=(i=>(i[i.NOT_DISPLAY=0]="NOT_DISPLAY",i[i.ALWAYS=1]="ALWAYS",i[i.WHEN_NO_VIDEO=2]="WHEN_NO_VIDEO",i))(Ws||{});class dr{constructor(a,e,t,r,s,n=0,o=1,c=1){p(this,"url");p(this,"x");p(this,"y");p(this,"width");p(this,"height");p(this,"alpha");p(this,"display",1);p(this,"zOrder");this.url=a,this.x=e,this.y=t,this.width=r,this.height=s,this.zOrder=n,this.alpha=o,this.display=c}toJson(a,e){return{url:this.url,alpha:this.alpha,display:this.display,x:Ce(this.x,a),y:Ce(this.y,e),width:Ce(this.width,a),height:Ce(this.height,e),zorder:this.zOrder}}}p(dr,"DisplayType",Ws);class Ks{constructor(a,e,t,r,s=0,n=16777215,o=Tt.NOTO_SERIF_CJKSC_REGULAR){p(this,"text");p(this,"x");p(this,"y");p(this,"fontSize");p(this,"zOrder");p(this,"fontColor");p(this,"fontType");this.text=a,this.x=e,this.y=t,this.fontSize=r,this.zOrder=s,this.fontColor=n,this.fontType=o}toJson(a,e){return{text:this.text,x:Ce(this.x,a),y:Ce(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:Hi(this.fontColor),zorder:this.zOrder}}}class Js{constructor(a,e,t,r,s,n=0,o){p(this,"userId");p(this,"x");p(this,"y");p(this,"width");p(this,"height");p(this,"zOrder");p(this,"sourceType");p(this,"segmentType",At.LiveTranscodingNoBody);p(this,"images",[]);p(this,"texts",[]);typeof a=="number"?this.userId=a.toString():this.userId=a,this.x=e,this.y=t,this.width=r,this.height=s,this.zOrder=n,o&&(this.sourceType=o)}toJson(a,e,t,r){const s={paneid:a,majorpane:0,x:Ce(this.x,e),y:Ce(this.y,t),width:Ce(this.width,e),height:Ce(this.height,t),zorder:this.zOrder,userid:this.userId,images:this.images.map(n=>n.toJson(e,t)),texts:this.texts.map(n=>n.toJson(e,t))};return this.sourceType&&Et[this.sourceType]?s.sourcetype=Et[this.sourceType]:s.sourcetype=Et[St.LiveTranscodingCamera],this.segmentType&&r===Gt.LiveTranscodingVirtualBackground?s.segmenttype=this.segmentType:s.segmenttype=At.LiveTranscodingNoBody,s}}class Sc extends mt{constructor(){super("AliRtcScreenStandardize",ae.AliRtcSdkStreamTypeScreen);p(this,"canvas");p(this,"lastWidth");p(this,"lastHeight");p(this,"hasScreenTrack",!1)}get initOptions(){return{base:4}}setOptions(e){this.options=e}isSupported(){return!(typeof TransformStream=="undefined"||typeof MediaStreamTrackProcessor=="undefined"||typeof MediaStreamTrackGenerator=="undefined")}updateProcessCanvas(e,t){if(this.canvas&&this.lastWidth===e&&this.lastHeight===t)return;const r=Math.ceil(e/this.options.base)*this.options.base,s=Math.ceil(t/this.options.base)*this.options.base;if(this.canvas||(this.canvas=document.createElement("canvas")),this.canvas.width=r,this.canvas.height=s,this.lastWidth&&e>this.lastWidth||this.lastHeight&&t>this.lastHeight){const n=this.canvas.getContext("2d");n&&n.clearRect(0,0,r,s)}this.lastWidth=e,this.lastHeight=t}shouldUpdate(e){return this.hasScreenTrack!==(!!e.originVideoTrack&&e.videoSource===ft.Screen)}handleFrame(e,t){return v(this,null,function*(){var o;const{displayWidth:r,displayHeight:s}=e;if(!r||!s||r%this.options.base===0&&s%this.options.base===0)return this.clear(t),e;this.updateProcessCanvas(r,s);const n=(o=this.canvas)==null?void 0:o.getContext("2d");if(this.canvas&&n){n.drawImage(e,0,0,r,s);const c=new VideoFrame(this.canvas,{timestamp:e.timestamp});return e.close(),c}return e})}process(e){return v(this,null,function*(){var h;if(!e.originVideoTrack||e.videoSource!==ft.Screen){this.clear(e),this.hasScreenTrack=!1;return}const t=new MediaStreamTrackProcessor({track:e.originVideoTrack}),r=new MediaStreamTrackGenerator({kind:"video"}),s=new MediaStream([r]),n=this,o=new TransformStream({transform(l,d){return v(this,null,function*(){const f=yield n.handleFrame(l,e);yield d.enqueue(f),f==null||f.close()})}});t.readable.pipeThrough(o).pipeTo(r.writable);const c=(h=s.getVideoTracks())==null?void 0:h[0];e.updateVideoTrack(c),this.hasScreenTrack=!0})}clear(e){this.canvas=void 0,this.lastWidth=void 0,this.lastHeight=void 0,super.clear(e)}}var bc=Object.defineProperty,vc=Object.getOwnPropertyDescriptor,C=(i,a,e,t)=>{for(var r=t>1?void 0:t?vc(a,e):a,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(t?n(a,e,r):n(r))||r);return t&&r&&bc(a,e,r),r};const k=(L=class extends X{constructor(e){super();p(this,"channelProfile");p(this,"clientRole");p(this,"signalingManager");p(this,"userManager");p(this,"liveTranscoding");p(this,"maxSignalingConnectRetryCount");p(this,"reporter");p(this,"webTrackingClient");p(this,"connectState",q.AliRtcConnectionStatusInit);p(this,"networkError",!1);p(this,"audioMixerPlugin");p(this,"dualVideoPlugin");p(this,"_audioOnlyMode",!1);p(this,"_authInfoWillExpireTimer",null);p(this,"_authInfoExpiredTimer",null);p(this,"_serverCheckAuthInfoTimestamp",null);p(this,"_localCheckAuthInfoTimestamp",null);this.webTrackingClient=new ic(e==null?void 0:e.webTrack),this.reporter=new sc,this.channelProfile=qe.AliRtcSdkCommunication,this.clientRole=Ze.AliRtcSdkLive,this.liveTranscoding=new cn,this.signalingManager=new Oa(this.channelProfile,this.clientRole,(e==null?void 0:e.env)===Qe.pre?Qe.pre:Qe.prod),this.addSignalingManagerListeners(),this.maxSignalingConnectRetryCount=e==null?void 0:e.maxSignalingConnectRetryCount,this.userManager=new Ee({reporter:this.reporter,webTrackingClient:this.webTrackingClient,signalingManager:this.signalingManager}),this.addUserManagerListeners(),this.addPublisherListeners(),this.audioMixerPlugin=new oc,this.enablePlugin(this.audioMixerPlugin),this.dualVideoPlugin=new mc("dualVideoPlugin"),this.enablePlugin(new Sc)}static getSdkVersion(){return Rt}static setLogLevel(e){A.setLogLevel(e)}static getInstance(e){return L._instance||(L._instance=new L(e)),L._instance}destroy(){L._instance=void 0}get channel(){return this.userManager.channel}get userId(){return this.userManager.userId}get remoteUsers(){return this.userManager.remoteUsers}get publisher(){return this.userManager.publisher}get publishAudioStream(){var e;return(e=this.publisher)==null?void 0:e.publishStreams.audio}get isPublishing(){const{publisher:e}=this.userManager;return e?e.isPublishing:!1}get currentRoleCanPublish(){return this.channelProfile===qe.AliRtcSdkCommunication||this.clientRole===Ze.AliRtcSdkInteractive}resetState(){return v(this,null,function*(){yield this.userManager.clear(),this.connectState=q.AliRtcConnectionStatusDisconnected,this.networkError=!1,this.signalingManager.reset(),this.liveTranscoding.clear(),this.reporter.stop(),yield this.publishLocalAudioStream(!0),yield this.publishLocalVideoStream(!0),yield this.publishLocalScreenShareStream(!0)})}stopPublish(e){return v(this,null,function*(){var t,r,s;e?yield(t=this.publisher)==null?void 0:t.stopLocalStream(e):(yield(r=this.publisher)==null?void 0:r.publishStop(),(s=this.publisher)==null||s.stopPreview())})}addPublisherListeners(){var e,t,r,s,n,o,c,u,h;(e=this.publisher)==null||e.on(be.Local,l=>{A.event("[Publisher] Device Status Change",l),this.onLocalDeviceStatusChange(l)}),(t=this.publisher)==null||t.on(ht.VideoTrackEnded,()=>{A.event("[Publisher] VideoTrack Ended"),this.emit("localDeviceException",je.AliEngineLocalDeviceTypeCamera,te.AliEngineLocalDeviceExceptionTypeCameraInterrupt,"")}),(r=this.publisher)==null||r.on(ht.ScreenTrackEnded,()=>{A.event("[Publisher] ScreenTrack Ended"),this.emit("localDeviceException",je.AliEngineLocalDeviceTypeDisplay,te.AliEngineLocalDeviceExceptionTypeDisplayException,"")}),(s=this.publisher)==null||s.on(ht.AudioTrackEnded,()=>{A.event("[Publisher] AudioTrack Ended"),this.emit("localDeviceException",je.AliEngineLocalDeviceTypeMic,te.AliEngineLocalDeviceExceptionTypeMicInterrupt,"")}),(n=this.publisher)==null||n.on("localDeviceException",(l,d,f="")=>{this.emit("localDeviceException",l,d,f)}),(o=this.publisher)==null||o.on("audioPublishStateChanged",(l,d,f)=>{var m;this.emit("audioPublishStateChanged",l,d,f,(m=this.channel)!=null?m:"")}),(c=this.publisher)==null||c.on("videoPublishStateChanged",(l,d,f)=>{var m;this.emit("videoPublishStateChanged",l,d,f,(m=this.channel)!=null?m:"")}),(u=this.publisher)==null||u.on("dualStreamPublishStateChanged",(l,d,f)=>{var m;this.emit("dualStreamPublishStateChanged",l,d,f,(m=this.channel)!=null?m:"")}),(h=this.publisher)==null||h.on("screenPublishStateChanged",(l,d,f)=>{var m;this.emit("screenSharePublishStateChanged",l,d,f,(m=this.channel)!=null?m:"")})}addUserManagerListeners(){this.userManager.rtsManager.on("disconnected",()=>v(this,null,function*(){A.event("[UserManager] RTS Disconnected"),(yield Ye.isNetworkAvailable())?this.onNetworkRecovery():this.onNetworkError()})),this.userManager.rtsManager.on("subscribeexceeds",()=>v(this,null,function*(){yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList()})),this.userManager.rtsManager.on("seimessage",(e,t,r)=>{const s=this.remoteUsers.find(n=>n.streamUrl===e);s&&this.emit("mediaExtensionMsgReceived",s.userId,r,t)}),this.userManager.on(be.Remote,(e,t)=>{A.event("[UserManager] RemoteUser Device Status Change",e,t)}),this.userManager.on("remoteTrackAvailableChange",(e,t,r)=>{this.emit("remoteTrackAvailableNotify",e,t,r)}),this.userManager.on("audioSubscribeStateChanged",(e,t,r,s,n)=>{this.emit("audioSubscribeStateChanged",e,t,r,s,n)}),this.userManager.on("videoSubscribeStateChanged",(e,t,r,s,n)=>{this.emit("videoSubscribeStateChanged",e,t,r,s,n)}),this.userManager.on("screenSubscribeStateChanged",(e,t,r,s,n)=>{this.emit("screenShareSubscribeStateChanged",e,t,r,s,n)}),this.userManager.on("userAudioMuted",(e,t)=>{this.emit("userAudioMuted",e,t)}),this.userManager.on("userVideoMuted",(e,t)=>{this.emit("userVideoMuted",e,t)}),this.userManager.on("userScreenMuted",(e,t)=>{this.emit("userScreenMuted",e,t)}),this.userManager.on("audioVolume",e=>{this.emit("audioVolume",e)}),this.userManager.on("remoteAudioAutoPlayFail",e=>{this.emit("remoteAudioAutoPlayFail",e)}),this.userManager.on("remoteVideoAutoPlayFail",(e,t)=>{this.emit("remoteVideoAutoPlayFail",e,t)}),this.userManager.on("rtcLocalAudioStats",e=>{this.emit("rtcLocalAudioStats",e)}),this.userManager.on("rtcLocalVideoStats",e=>{this.emit("rtcLocalVideoStats",e)}),this.userManager.on("rtcRemoteAudioStats",e=>{this.emit("rtcRemoteAudioStats",e)}),this.userManager.on("rtcRemoteVideoStats",e=>{this.emit("rtcRemoteVideoStats",e)}),this.userManager.on("remoteSubscribeError",e=>{this.emit("onOccurError",e)})}addSignalingManagerListeners(){this.signalingManager.on("onKeepAliveRsp",()=>{this.networkError&&(A.event("[Signaling] Receive KeepAlive Response",`networkError: ${this.networkError}`),this.onNetworkRecovery())}),this.signalingManager.on("onNotifyJoin",e=>{A.event("[Signaling] Notify Join ",e),this.handleUsersJoin(e),e.forEach(t=>{this.emit("remoteUserOnLineNotify",t.userid,0)})}),this.signalingManager.on("onNotifyStatus",e=>{A.event("[Signaling] Notify Status ",e),e.forEach(t=>{this.userManager.updateRemoteUserDeviceStatus(t)})}),this.signalingManager.on("onNotifyLeave",e=>{A.event("[Signaling] Notify Leave ",e),e.forEach(t=>{this.emit("remoteUserOffLineNotify",t.userid,t.leavecode),this.userManager.removeLeftUser(t)})}),this.signalingManager.on("onBye",(e,t)=>{A.event("[Signaling] Bye ",e,t),this.reporter.reportError({message:`reason: ${e}, description: ${t}`}),this.emit("bye",e),this.leaveChannel(!0)}),this.signalingManager.on("onConnectFail",e=>{A.event("[Signaling] Connect Failed ",e),this.onError(e),this.backToUnpublishStatus(),this.connectState=q.AliRtcConnectionStatusFailed,this.emit("connectionStatusChange",q.AliRtcConnectionStatusFailed,ct.AliRtcConnectionChangedNetworkInterrupted)}),this.signalingManager.on("onNetworkError",e=>{A.event("[Signaling] Network error ",e),this.onNetworkError()}),this.signalingManager.on("onAuthInvalid",()=>{A.event("[Signaling] Auth Invalid")}),this.signalingManager.on("onReconnectStart",()=>{A.event("[Signaling] Reconnect Start "),this.connectState=q.AliRtcConnectionStatusReconnecting,this.emit("connectionStatusChange",q.AliRtcConnectionStatusReconnecting,ct.AliRtcConnectionSignalingConnecting)}),this.signalingManager.on("onReconnectSuccess",e=>{A.event("[Signaling] Reconnect Success ",e),this.onNetworkRecovery(e)}),this.signalingManager.on("onReconnectFail",e=>{A.event("[Signaling] Reconnect Failed ",e),e.code===403&&this.emit("authInfoExpired")}),this.signalingManager.on("onError",e=>{A.event("[Signaling] Error ",e),this.onError(e)})}backToUnpublishStatus(){var e,t;this.connectState=q.AliRtcConnectionStatusDisconnected,(e=this.publisher)!=null&&e.isPublishing&&((t=this.publisher)==null||t.clearPublishState()),this.networkError=!1}handleUsersJoin(e){e.forEach(t=>{const r=t.userid;if(r){const s=this.userManager.addUser(r,t.displayname);A.event(`[${L.logName}]`,J.UserJoined,s)}})}onLocalDeviceStatusChange(e){A.event(`[${L.logName}]`,be.Local,e),this.signalingManager.reportStatus(e).then(()=>{A.debug("[signaling] reportStatus suc")}).catch(t=>{A.error("[signaling] reportStatus failed",t)})}resumePublishForNetworkRecovery(){return v(this,null,function*(){var e;try{yield(e=this.publisher)==null?void 0:e.resumePublish()}catch(t){const{code:r}=t;if(r===10205){let n=1;try{yield new Promise((o,c)=>{const u=setInterval(()=>v(this,null,function*(){var h;n>1&&(clearInterval(u),c()),n+=1;try{yield(h=this.publisher)==null?void 0:h.resumePublish(),clearInterval(u),o()}catch(l){const{code:d}=l;d!==10205&&(clearInterval(u),c())}}),1e3)})}catch(o){}}}})}onNetworkRecovery(e){return v(this,null,function*(){var t;A.event(L.logName,"onNetworkRecovery",{users:e}),this.networkError&&(this.networkError=!1,(t=this.publisher)==null||t.reportSelfDeviceStatus(),!this.userManager.rtsManager.isConnected&&this.userManager.rtsManager.isConnecting&&(yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList(e)),this.connectState=q.AliRtcConnectionStatusConnected,this.emit("connectionStatusChange",q.AliRtcConnectionStatusConnected,ct.AliRtcConnectionSignalingHeartbeatAlive))})}resumeSubList(e){return v(this,null,function*(){if(e!=null&&e.length){const{joinList:t,leaveList:r,presentList:s}=this.userManager.updateUsers(e);A.info(`[${L.logName}]`,"resumeSubList",{joinList:t,leaveList:r,presentList:s}),this.handleUsersJoin(t),r.forEach(n=>{A.event(L.logName,J.UserLeft,n.userid,n.reason),this.emit("remoteUserOffLineNotify",n.userid,Fi.AliRtcUserOfflineQuit)});for(let n=0;n<s.length;n++){const o=s[n],c=o.userid,u=this.userManager.getRemoteUser(c);this.userManager.onRemotePublishStateChange(o),u==null||u.restore(),u==null||u.updateSubscribe()}}else for(let t=0;t<this.remoteUsers.length;t++){const r=this.remoteUsers[t];try{r.restore(),r.updateSubscribe()}catch(s){}}})}onNetworkError(){this.connectState===q.AliRtcConnectionStatusConnected&&(this.networkError||(this.connectState=q.AliRtcConnectionStatusDisconnected,this.emit("connectionStatusChange",q.AliRtcConnectionStatusDisconnected,ct.AliRtcConnectionChangedNetworkInterrupted)),this.networkError=!0)}onError(e){this.reporter.reportError(e),A.event(L.logName,J.Error,e)}setEnableDualVideoStream(e,t){t&&this.dualVideoPlugin.setOptions(t);const r=this.userManager.pluginManager.has(this.dualVideoPlugin.name);e?!r&&this.enablePlugin(this.dualVideoPlugin):r&&this.removePlugin(this.dualVideoPlugin.name)}hadPushStream(e){if(!(this.publisher&&e))throw new E(T.ERR_INNER,"stream is not publishing")}getCurrentMicDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentMicDeviceId()}setChannelProfile(e){if(![q.AliRtcConnectionStatusInit,q.AliRtcConnectionStatusDisconnected,q.AliRtcConnectionStatusFailed].includes(this.connectState))throw new E(T.ERR_INNER,"cannot set channel profile in call");this.channelProfile=e,this.channelProfile===qe.AliRtcSdkCommunication&&(this.clientRole=Ze.AliRtcSdkLive),this.signalingManager.setChannelProfile(e)}setClientRole(e){return v(this,null,function*(){var t,r,s,n,o;try{if(this.channelProfile===qe.AliRtcSdkCommunication)return;if(!Object.values(Ze).includes(e))throw new E(T.ERR_INVALID_ARGUMENTS,`set client role error, role value(${e}) is invalid`);if(this.clientRole===e)return;this.isInCall()?this.clientRole===Ze.AliRtcSdkInteractive?(this.userManager.isSubscribing?(yield this.stopPublish(),yield(t=this.publisher)==null?void 0:t.clearStream()):yield(r=this.publisher)==null?void 0:r.unPublish(),yield this.signalingManager.setClientRole(e)):(yield this.signalingManager.setClientRole(e),yield this.startDefaultDevicesCapture(),(s=this.publisher)!=null&&s.isPublishing||(yield(n=this.publisher)==null?void 0:n.startPublish()),yield(o=this.publisher)==null?void 0:o.previewAll()):yield this.signalingManager.setClientRole(e),this.clientRole=e}catch(c){throw c.code===403&&this.emit("authInfoExpired"),c}})}getCurrentClientRole(){return this.clientRole}setAudioOnlyMode(e){if(this.isInCall())throw new E(T.ERR_INNER,"can not change audioOnly mode in call");this._audioOnlyMode=e}setAudioRedEnabled(e){if(this.isInCall())throw new E(T.ERR_INNER,"can not change audioRedEnabled in call");this.userManager.setAudioRedEnabled(e)}setCheckAuthInfoTimer(e,t){const r=(e-t)*1e3;this._authInfoExpiredTimer=window.setTimeout(()=>{this.emit("authInfoExpired")},r),this._authInfoWillExpireTimer=window.setTimeout(()=>{this.emit("authInfoWillExpire")},r-3e4),this._serverCheckAuthInfoTimestamp=t,this._localCheckAuthInfoTimestamp=+Date.now()/1e3}clearCheckAuthInfoTimer(){this._authInfoExpiredTimer&&window.clearTimeout(this._authInfoExpiredTimer),this._authInfoWillExpireTimer&&window.clearTimeout(this._authInfoWillExpireTimer)}startDefaultDevicesCapture(){return v(this,null,function*(){var r,s;let e=[],t;try{this._audioOnlyMode||(e=yield L.getCameraList(),e.length||console.warn("No media neither devices can be captured")),t=yield L.getMicrophoneList(),t.length||console.warn("No media neither devices can be captured");const{hasCamera:n,hasMicrophone:o,hasScreenShare:c,audioCaptureDisabled:u,publishLocalAudioStreamEnabled:h,publishLocalVideoStreamEnabled:l}=(r=this.publisher)!=null?r:{};if(n||o||c)return;!n&&l&&!this._audioOnlyMode&&e.length&&!((s=this.publisher)!=null&&s.cameraCaptureDisabled)&&(yield this.enableLocalVideo(!0)),!o&&h&&!u&&t.length&&(yield this.startAudioCapture())}catch(n){throw n}})}joinChannel(e,t,r,s){return v(this,null,function*(){var h,l,d,f,m,g;let n=s,o;if(typeof e=="string"){n=s;try{const S=JSON.parse(window.atob(e));if(o={appId:S.appid,channelId:S.channelid,userId:S.userid,timestamp:S.timestamp,nonce:S.nonce,token:S.token},o.channelId!==t)throw new Error("channelId is not equal");if(o.userId!==r)throw new Error("userId is not equal")}catch(S){throw new E(T.ERR_INVALID_ARGUMENTS,`authInfo is invalid: ${S.message||""}`)}}else o=e,n=t;let c=new Date().getTime(),u=lr.checkAuthInfo(o);if(this.webTrackingClient.updateAuthInfo(o),this.webTrackingClient.reportJoinChannel(o),q.AliRtcConnectionStatusInit===this.connectState||q.AliRtcConnectionStatusDisconnected===this.connectState||q.AliRtcConnectionStatusFailed===this.connectState){if(this.connectState=q.AliRtcConnectionStatusConnecting,u)throw this.connectState=q.AliRtcConnectionStatusFailed,this.webTrackingClient.reportJoinChannelRes(u.code,u.message,0),this.reporter.reportJoin(0,u.code,u.message),u;o.callid=Ye.createCallid(),this.reporter.start(o);try{const S=yield this.signalingManager.join(o,n,this.maxSignalingConnectRetryCount);this.connectState=q.AliRtcConnectionStatusConnected,(h=this.publisher)==null||h.reportSelfDeviceStatus();let b=new Date().getTime()-c;this.webTrackingClient.reportJoinChannelRes(0,"",b),this.reporter.reportJoin(b,0,S.tid),this.userManager.init(o,S),this.setCheckAuthInfoTimer(o.timestamp,S.timestamp),this.currentRoleCanPublish&&(yield this.startDefaultDevicesCapture(),Object.values((d=(l=this.publisher)==null?void 0:l.publishStreams)!=null?d:{}).some(w=>w)&&(yield(f=this.publisher)==null?void 0:f.startPublish(),yield(m=this.publisher)==null?void 0:m.previewAll())),this.remoteUsers.forEach(w=>{w.updateSubscribe()}),this.liveTranscoding.setAuthInfo(o)}catch(S){let b=new Date().getTime()-c;const w=(g=S.code)!=null?g:-1,_=S.reason||S.message||"";throw this.webTrackingClient.reportJoinChannelRes(w,_,b),this.connectState=q.AliRtcConnectionStatusDisconnected,this.reporter.reportJoin(b,w,""),new E(w,_)}}else{const S=new E(T.ERR_JOIN_ALREADY_JOINED,"already joined");throw this.connectState===q.AliRtcConnectionStatusConnecting&&(S.message="Repeated operation during login"),this.webTrackingClient.reportJoinChannelRes(S.code,S.message,0),this.reporter.reportJoin(0,S.code,""),S}})}leaveChannel(e=!1){return v(this,null,function*(){var r;this.reporter.reportLeaveInvoked(),this.webTrackingClient.reportLeaveChannel();let t=new Date().getTime();if(q.AliRtcConnectionStatusConnected===this.connectState)try{let s;e||(s=yield this.signalingManager.leave()),this.clearCheckAuthInfoTimer(),yield this.resetState(),this.reporter.reportLeave(new Date().getTime()-t,0,(r=s==null?void 0:s.tid)!=null?r:""),A.setFlushMode(!0);return}catch(s){throw this.reporter.reportLeave(new Date().getTime()-t,s.code,s.reason),s}else{yield this.resetState(),this.reporter.reportLeave(0,0,""),A.setFlushMode(!0);return}})}isInCall(){return this.connectState===q.AliRtcConnectionStatusConnected}refreshAuthInfo(e){return v(this,null,function*(){const{userId:t,nonce:r,timestamp:s,token:n,role:o}=e,c={userId:t,nonce:r,timestamp:s,token:n,role:o};try{yield this.signalingManager.refreshAuthInfo(c),this.userManager.refreshAuthInfo(c),this.liveTranscoding.refreshAuthInfo(c),this.clearCheckAuthInfoTimer(),this._serverCheckAuthInfoTimestamp&&this._localCheckAuthInfoTimestamp&&e.timestamp&&this.setCheckAuthInfoTimer(e.timestamp,this._serverCheckAuthInfoTimestamp+(Date.now()-this._localCheckAuthInfoTimestamp))}catch(u){throw u}})}isAudioOnly(){return this._audioOnlyMode}publishLocalAudioStream(e){return v(this,null,function*(){var t,r,s;(t=this.publisher)==null||t.setPublishLocalAudioStreamEnabled(e),this.connectState===q.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.hasMicrophone?yield(s=this.publisher)==null?void 0:s.publishUpdate():yield this.startAudioCapture():yield this.stopPublish({audio:!0}))})}isLocalAudioStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalAudioStreamEnabled)!=null?t:!0}setDefaultSubscribeAllRemoteAudioStreams(e){this.userManager.setAutoSubAudio(e)}subscribeAllRemoteAudioStreams(e){this.userManager.setWantSubAudio(e)}subscribeRemoteAudioStream(e,t){if(t&&!this.userManager.isWantSubAudio)throw new E(T.ERR_INVALID_ARGUMENTS,"subscribeAllRemoteAudioStreams(true) must be called first");this.userManager.updateAudioWant(e,t)}resumeRemoteAudioStream(e){const t=this.userManager.getRemoteUser(e);t&&t.resumeAudio()}publishLocalVideoStream(e){return v(this,null,function*(){var t,r,s;(t=this.publisher)==null||t.setPublishLocalVideoStreamEnabled(e),this.connectState===q.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.hasCamera?yield(s=this.publisher)==null?void 0:s.publishUpdate():yield this.enableLocalVideo():yield this.stopPublish({video:!0}))})}isLocalVideoStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalVideoStreamEnabled)!=null?t:!0}setRemoteDefaultVideoStreamType(e){[oe.AliRtcVideoStreamTypeHigh,oe.AliRtcVideoStreamTypeLow].includes(e)&&this.userManager.setRemoteDefaultVideoStreamType(e)}setRemoteUserVideoStreamType(e,t){[oe.AliRtcVideoStreamTypeHigh,oe.AliRtcVideoStreamTypeLow].includes(t)&&this.userManager.setRemoteUserVideoStreamType(e,t)}setDefaultSubscribeAllRemoteVideoStreams(e){this.userManager.setAutoSubVideo(e),this.userManager.setAutoSubScreen(e)}subscribeAllRemoteVideoStreams(e){this.userManager.setWantSubVideo(e),this.userManager.setWantSubScreen(e)}subscribeRemoteMediaStream(e,t,r,s){const n=this.userManager.getRemoteUser(e);if(!n)throw new E(T.ERR_INNER,`no remote user(${e}) founded`);r&&(t===j.AliRtcVideoTrackScreen||t===j.AliRtcVideoTrackBoth)?n.setWantSubScreen(!0):n.setWantSubScreen(!1),r&&(t===j.AliRtcVideoTrackCamera||t===j.AliRtcVideoTrackBoth)?n.setWantSubVideo(!0):n.setWantSubVideo(!1),n.setWantSubAudio(s),n.updateSubscribe()}resumeRemoteMediaStream(e,t){const r=this.userManager.getRemoteUser(e);r&&r.resumeVideo(t)}getOnlineRemoteUsers(){return this.userManager.remoteUsers.map(e=>e.userId)}getUserInfo(e){var t;return(t=this.userManager.getRemoteUser(e))==null?void 0:t.remoteUserInfo}isUserOnline(e){return!!this.userManager.remoteUsers.find(t=>t.userId===e)}startScreenShare(e){return v(this,null,function*(){var o;const t={video:!1,audio:!1},{audio:r=!1,videoTrack:s,audioTrack:n}=e||{};if(s||n){t.screen=!0;const c=new MediaStream;s&&c.addTrack(s),n&&c.addTrack(n),t.mediaStream=c}else t.screen=r?{audio:!0}:!0;yield(o=this.publisher)==null?void 0:o.createLocalStream(t)})}stopScreenShare(){return v(this,null,function*(){var e;(e=this.publisher)==null||e.stopLocalStream({screen:!0})})}setScreenShareConfiguration(e){return v(this,null,function*(){var s;const{frameRate:t=Ct.frameRate,bitrate:r=Ct.maxBitrate}=e;yield(s=this.publisher)==null?void 0:s.setScreenProfile(Jr,{width:Ct.width,height:Ct.height,frameRate:t,maxBitrate:r})})}setScreenShareContentHint(e){return v(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setScreenContentHint(e))})}publishLocalScreenShareStream(e,t){return v(this,null,function*(){var r,s,n;(r=this.publisher)==null||r.setPublishLocalScreenStreamEnabled(e),this.connectState===q.AliRtcConnectionStatusConnected&&(e?(s=this.publisher)!=null&&s.hasScreenShare?yield(n=this.publisher)==null?void 0:n.publishUpdate():yield this.startScreenShare(t):yield this.stopPublish({screen:!0}))})}isScreenSharePublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalScreenStreamEnabled)!=null?t:!0}setAudioShareVolume(e){if(typeof e!="number")throw new E(T.ERR_INVALID_ARGUMENTS,"volume must be a number");this.audioMixerPlugin.setOptions({screen:Math.max(0,Math.min(e,400))/100})}enableAudioVolumeIndication(e){this.userManager.enableAudioVolumeIndication(e)}muteLocalMic(e=!1){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?J.MuteAudio:J.UnmuteAudio),(t=this.publisher)==null||t.muteLocalMic(e)}muteRemoteAudioPlaying(e,t=!1){const r=this.userManager.getRemoteUser(e);if(!r)throw new E(T.ERR_INNER,`no remote user(${e}) founded`);r.setAudioMuted(t)}muteAllRemoteAudioPlaying(e=!1){this.userManager.setAudioMuted(e)}startAudioCapture(e){return v(this,null,function*(){var r;const t={audio:e||!0};yield(r=this.publisher)==null?void 0:r.createLocalStream(t)})}stopAudioCapture(){var e;(e=this.publisher)==null||e.stopAudioCapture()}switchMicrophone(e,t){return v(this,null,function*(){var r,s,n,o;if(yield(r=this.publisher)==null?void 0:r.setMicrophoneDeviceId(e),!((s=this.publisher)!=null&&s.audioCaptureDisabled)){if(t){yield(n=this.publisher)==null?void 0:n.createLocalStream({audio:!0,mediaStream:new MediaStream([t])});return}yield(o=this.publisher)==null?void 0:o.createLocalStream({audio:{deviceId:e}})}})}setRecordingVolume(e){if(typeof e!="number")throw new E(T.ERR_INVALID_ARGUMENTS,"volume must be a number");this.audioMixerPlugin.setOptions({audio:Math.max(0,Math.min(e,400))/100})}setPlayoutVolume(e){if(typeof e!="number")throw new E(T.ERR_INVALID_ARGUMENTS,"volume must be a number");this.userManager.setPlayoutVolume(Math.max(0,Math.min(e,100))/100)}setRemoteAudioVolume(e,t){const r=this.userManager.getRemoteUser(e);if(!r)throw new E(T.ERR_INNER,`no remote user(${e}) founded`);if(typeof t!="number")throw new E(T.ERR_INVALID_ARGUMENTS,"volume must be a number");r.setPlayoutVolume(Math.max(0,Math.min(t,100))/100)}setAudioProfile(e){return v(this,null,function*(){var t;yield(t=this.publisher)==null?void 0:t.setAudioProfile(e)})}getAudioTrack(e){return v(this,null,function*(){var r;if(!e)return(r=this.publisher)==null?void 0:r.audioTrack;const t=this.userManager.getRemoteUser(e);return t==null?void 0:t.getAudioTrack})}setLocalViewConfig(e,t){return v(this,null,function*(){var r,s,n;if(this._audioOnlyMode)throw new E(T.ERR_INNER,"Cannot set local view in audio only mode");(r=this.userManager)==null||r.setLocalViewConfig(e,t),t===j.AliRtcVideoTrackCamera&&((s=this.publisher)!=null&&s.hasCamera)?yield this.startPreview():t===j.AliRtcVideoTrackScreen&&((n=this.publisher)!=null&&n.hasScreenShare)&&(yield this.startPreviewScreen())})}setCameraCapturerConfiguration(e){return v(this,null,function*(){var u,h,l;const{width:t=kt.width,height:r=kt.height,frameRate:s=kt.frameRate,bitrate:n=kt.maxBitrate,cameraDirection:o,deviceId:c}=e;yield(u=this.publisher)==null?void 0:u.setVideoProfile(Kr,{width:t,height:r,frameRate:s,maxBitrate:n}),o!==void 0&&((h=this.publisher)==null||h.setCameraDirection(o)),c&&((l=this.publisher)==null||l.setCameraDeviceId(c))})}setCameraCapturerContentHint(e){return v(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setVideoContentHint(e))})}enableLocalVideo(e=!0){return v(this,null,function*(){var t,r,s,n,o,c,u,h,l,d,f;if(this._audioOnlyMode)throw new E(T.ERR_INNER,"Cannot enable local video in audio only mode");if(e){(r=(t=this.publisher)==null?void 0:t.publishStreams)!=null&&r.video&&((o=(n=(s=this.publisher)==null?void 0:s.publishStreams)==null?void 0:n.video)==null||o.disableVideo(),(l=(h=(u=(c=this.publisher)==null?void 0:c.publishStreams)==null?void 0:u.video)==null?void 0:h.videoTrack)==null||l.stop());const m={video:!0};yield(d=this.publisher)==null?void 0:d.startCameraCapture(m)}else yield(f=this.publisher)==null?void 0:f.stopCameraCapture()})}muteLocalCamera(e){return v(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?J.MuteVideo:J.UnmuteVideo),(t=this.publisher)==null||t.muteLocalCamera(e)})}muteLocalScreen(e){return v(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?J.MuteScreen:J.UnmuteScreen),(t=this.publisher)==null||t.muteLocalScreen(e)})}setRemoteViewConfig(e,t,r){this.userManager.setRemoteViewConfig(t,e,r)}isCameraOn(){var e,t;return(t=(e=this.publisher)==null?void 0:e.hasCamera)!=null?t:!1}switchCamera(e,t){return v(this,null,function*(){var s,n,o,c,u,h,l,d,f,m,g,S;if(this._audioOnlyMode)throw new E(T.ERR_INNER,"Cannot switch camera in audio only mode");const r={};if(e?r.deviceId=e:r.cameraDirection=((s=this.publisher)==null?void 0:s.cameraDirection)==="environment"?Pt.CAMERA_FRONT:Pt.CAMERA_REAR,yield this.setCameraCapturerConfiguration(r),!((n=this.publisher)!=null&&n.cameraCaptureDisabled)){(c=(o=this.publisher)==null?void 0:o.publishStreams)!=null&&c.video&&((l=(h=(u=this.publisher)==null?void 0:u.publishStreams)==null?void 0:h.video)==null||l.disableVideo(),(g=(m=(f=(d=this.publisher)==null?void 0:d.publishStreams)==null?void 0:f.video)==null?void 0:m.videoTrack)==null||g.stop());const b={video:!0};t&&(b.mediaStream=new MediaStream([t])),yield(S=this.publisher)==null?void 0:S.createLocalStream(b)}})}getCurrentCameraDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentCameraDeviceId()}startPreview(){return v(this,null,function*(){var e,t;if(this._audioOnlyMode)throw new E(T.ERR_INNER,"Cannot start preview camera in audio only mode");(e=this.publisher)!=null&&e.hasCamera||(yield this.enableLocalVideo(!0)),yield(t=this.publisher)==null?void 0:t.previewAll({screen:!1})})}startPreviewScreen(e){return v(this,null,function*(){var t,r;if(this._audioOnlyMode)throw new E(T.ERR_INNER,"Cannot start preview screen share in audio only mode");(t=this.publisher)!=null&&t.hasScreenShare||(yield this.startScreenShare(e)),yield(r=this.publisher)==null?void 0:r.previewAll({primary:!1})})}stopPreview(){return v(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!0,screen:!1})})}stopPreviewScreen(){return v(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!1,screen:!0})})}getVideoTrack(e){return v(this,null,function*(){var n,o,c,u;const{userId:t,streamType:r}=e;if(!t)return r===ae.AliRtcSdkStreamTypeCapture?(n=this.publisher)==null?void 0:n.cameraTrack:(o=this.publisher)==null?void 0:o.screenTrack;const s=this.userManager.getRemoteUser(t);return r===ae.AliRtcSdkStreamTypeCapture?(c=s==null?void 0:s.getCameraStream)==null?void 0:c.videoTrack:(u=s==null?void 0:s.getScreenStream)==null?void 0:u.videoTrack})}startPublishLiveStream(e,t){return v(this,null,function*(){return this.liveTranscoding.startPublishLiveStream(e,t)})}updatePublishLiveStream(e,t){return v(this,null,function*(){return this.liveTranscoding.updatePublishLiveStream(e,t)})}updatePublishLiveStreamWithTaskId(e,t){return this.liveTranscoding.updatePublishLiveStreamWithTaskId(e,t)}stopPublishLiveStream(e){return v(this,null,function*(){return this.liveTranscoding.stopPublishLiveStream(e)})}stopPublishLiveStreamWithTaskId(e){return this.liveTranscoding.stopPublishLiveStreamWithTaskId(e)}setEnableMediaExtensionMsg(e){var t;(t=this.userManager)==null||t.setEnableMediaExtensionMsg(!!e)}sendMediaExtensionMsg(e,t){return v(this,null,function*(){return this.sendMediaExtensionMsgEx(e,t,5)})}sendMediaExtensionMsgEx(e,t,r){return v(this,null,function*(){var s;if(!this.publisher||!this.isPublishing)throw new E(T.ERR_INNER,"you should publish first");return(s=this.publisher)==null?void 0:s.sendSEI(e,t,r)})}enablePlugin(e,t){this.userManager.pluginManager.add(e,t)}removePlugin(e){this.userManager.pluginManager.remove(e)}setPluginOption(e,t){const r=this.userManager.pluginManager.get(e);r&&t&&r.setOptions(t)}getPluginOption(e){const t=this.userManager.pluginManager.get(e);return t==null?void 0:t.getOptions()}isBeautyAvailable(){return this.userManager.pluginManager.has("AliRtcBeauty")}isBeautyEnabled(){const e=this.userManager.pluginManager.get("AliRtcBeauty");if(!e)throw new E(it.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");return!!(e!=null&&e.isEnable)}setBeautyEffect(e,t){const r=this.userManager.pluginManager.get("AliRtcBeauty");if(!r)throw new E(it.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");e?r.enable():r.disable(),r.setOptions({basicBeauty:{skinBuffing:Math.max(Math.min(1,+t.smoothnessLevel),0),whitening:Math.max(Math.min(1,+t.whiteningLevel),0)}})}enableBackgroundExchange(e,t){const r=this.userManager.pluginManager.get("AliRtcBeauty");if(!r||!r.isEnable)throw new E(it.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const s={setSegmentBackgroundImage:{backgroundImgUrl:e?t:""}};e&&(s.segmentBackgroundProcess={enable:!1}),r.setOptions(s)}enableBackgroundBlur(e){const t=this.userManager.pluginManager.get("AliRtcBeauty");if(!t||!t.isEnable)throw new E(it.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const r={segmentBackgroundProcess:{type:0,enable:e}};e&&(r.setSegmentBackgroundImage={type:0,backgroundImgUrl:""}),t.setOptions(r)}},p(L,"logName","AliRtcEngine"),p(L,"logError",!0),p(L,"isSupported",Aa),p(L,"isDualVideoStreamSupported",hr.isSupport),p(L,"getCameraList",()=>v(L,null,function*(){return(yield D.AliRTS.getCameraList()).filter(t=>t.deviceId)})),p(L,"getMicrophoneList",()=>v(L,null,function*(){return(yield D.AliRTS.getMicList()).filter(t=>t.deviceId)})),p(L,"getSpeakerList",()=>v(L,null,function*(){return(yield D.AliRTS.getSpeakerList()).filter(t=>t.deviceId)})),p(L,"_instance"),p(L,"AliRtcSdkChannelProfile",qe),p(L,"AliRtcSdkClientRole",Ze),p(L,"AliRtcVideoStreamType",oe),p(L,"AliRtcVideoTrack",j),p(L,"AliRtcAudioTrack",bt),p(L,"AliRtcPublishState",B),p(L,"AliRtcSubscribeState",Z),p(L,"AliRtcRawDataStreamType",ae),p(L,"AliRtcLogLevel",Li),p(L,"AliRtcEngineLocalDeviceType",je),p(L,"AliRtcEngineLocalDeviceExceptionType",te),p(L,"AliRtcConnectionStatus",q),p(L,"AliRtcConnectionStatusChangeReason",ct),p(L,"AliRtcPlugin",mt),p(L,"AliRtcPluginTrackType",Jt),p(L,"AliRtcLiveTranscodingParam",zt),p(L,"AliRtcLiveTranscodingEncodeParam",Bi),p(L,"AliRtcLiveTranscodingMixParam",Fs),p(L,"AliRtcLiveTranscodingSingleParam",js),p(L,"AliRtcTranscodingClockWidget",$s),p(L,"AliRtcTranscodingImage",dr),p(L,"AliRtcTranscodingText",Ks),p(L,"AliRtcTranscodingUser",Js),p(L,"AliRtcLiveTranscodingMixMode",It),p(L,"AliRtcLiveTranscodingStreamType",Oi),p(L,"AliRtcLiveTranscodingSourceType",St),p(L,"AliRtcLiveTranscodingTaskProfile",Vi),p(L,"AliRtcLiveTranscodingAudioSampleRate",qt),p(L,"AliRtcLiveTranscodingSegmentType",At),p(L,"AliRtcLiveTranscodingFontType",Tt),p(L,"AliRtcLiveTranscodingCropMode",Di),p(L,"AliRtcLiveTranscodingMediaProcessMode",Gt),p(L,"AliRtcLiveTranscodingState",xi),p(L,"AliRtcLiveTranscodingErrorCode",Fe),p(L,"AliRtcTrascodingPublishTaskStatus",Ui),p(L,"Plugin",mt),L);C([y()],k.prototype,"destroy",1),C([y()],k.prototype,"resetState",1),C([y(I)],k.prototype,"stopPublish",1),C([y()],k.prototype,"backToUnpublishStatus",1),C([y()],k.prototype,"resumePublishForNetworkRecovery",1),C([y()],k.prototype,"onNetworkRecovery",1),C([y()],k.prototype,"resumeSubList",1),C([y(I)],k.prototype,"setEnableDualVideoStream",1),C([y(I)],k.prototype,"setChannelProfile",1),C([y(I)],k.prototype,"setClientRole",1),C([y(I)],k.prototype,"setAudioOnlyMode",1),C([y(I)],k.prototype,"joinChannel",1),C([y(I)],k.prototype,"leaveChannel",1),C([y(I)],k.prototype,"refreshAuthInfo",1),C([y(I)],k.prototype,"publishLocalAudioStream",1),C([y(I)],k.prototype,"setDefaultSubscribeAllRemoteAudioStreams",1),C([y(I)],k.prototype,"subscribeAllRemoteAudioStreams",1),C([y(I)],k.prototype,"subscribeRemoteAudioStream",1),C([y(I)],k.prototype,"resumeRemoteAudioStream",1),C([y(I)],k.prototype,"publishLocalVideoStream",1),C([y(I)],k.prototype,"setRemoteDefaultVideoStreamType",1),C([y(I)],k.prototype,"setRemoteUserVideoStreamType",1),C([y(I)],k.prototype,"setDefaultSubscribeAllRemoteVideoStreams",1),C([y(I)],k.prototype,"subscribeAllRemoteVideoStreams",1),C([y(I)],k.prototype,"subscribeRemoteMediaStream",1),C([y(I)],k.prototype,"resumeRemoteMediaStream",1),C([y(([i])=>[`${i==null?void 0:i.audio}`])],k.prototype,"startScreenShare",1),C([y()],k.prototype,"stopScreenShare",1),C([y(I)],k.prototype,"setScreenShareConfiguration",1),C([y(I)],k.prototype,"setScreenShareContentHint",1),C([y()],k.prototype,"publishLocalScreenShareStream",1),C([y(I)],k.prototype,"setAudioShareVolume",1),C([y(I)],k.prototype,"enableAudioVolumeIndication",1),C([y(I)],k.prototype,"muteLocalMic",1),C([y(I)],k.prototype,"muteRemoteAudioPlaying",1),C([y(I)],k.prototype,"muteAllRemoteAudioPlaying",1),C([y(I)],k.prototype,"startAudioCapture",1),C([y()],k.prototype,"stopAudioCapture",1),C([y(I)],k.prototype,"switchMicrophone",1),C([y(I)],k.prototype,"setRecordingVolume",1),C([y(I)],k.prototype,"setPlayoutVolume",1),C([y(I)],k.prototype,"setRemoteAudioVolume",1),C([y(I)],k.prototype,"setAudioProfile",1),C([y(I)],k.prototype,"getAudioTrack",1),C([y(I)],k.prototype,"setLocalViewConfig",1),C([y(I)],k.prototype,"setCameraCapturerConfiguration",1),C([y(I)],k.prototype,"setCameraCapturerContentHint",1),C([y(I)],k.prototype,"enableLocalVideo",1),C([y(I)],k.prototype,"muteLocalCamera",1),C([y(I)],k.prototype,"muteLocalScreen",1),C([y(I)],k.prototype,"setRemoteViewConfig",1),C([y(I)],k.prototype,"switchCamera",1),C([y()],k.prototype,"startPreview",1),C([y()],k.prototype,"startPreviewScreen",1),C([y()],k.prototype,"stopPreview",1),C([y()],k.prototype,"stopPreviewScreen",1),C([y()],k.prototype,"startPublishLiveStream",1),C([y()],k.prototype,"updatePublishLiveStream",1),C([y()],k.prototype,"updatePublishLiveStreamWithTaskId",1),C([y()],k.prototype,"stopPublishLiveStream",1),C([y()],k.prototype,"stopPublishLiveStreamWithTaskId",1),C([y(I)],k.prototype,"setEnableMediaExtensionMsg",1),C([y(([i,a,e])=>[i.length,a,e])],k.prototype,"sendMediaExtensionMsgEx",1),C([y(([i,a])=>[i.name||"",a])],k.prototype,"enablePlugin",1),C([y(I)],k.prototype,"removePlugin",1),C([y(I)],k.prototype,"setPluginOption",1),C([y(I)],k.prototype,"getPluginOption",1),C([y(I)],k.prototype,"setBeautyEffect",1),C([y(I)],k.prototype,"enableBackgroundExchange",1),C([y(I)],k.prototype,"enableBackgroundBlur",1),C([y(I)],k,"setLogLevel",1);let qs=k;const Gs=new Mi({businessName:"imp-web-rtc",version:(zs=qs.getSdkVersion())!=null?zs:"unknown",env:"prod"});Gs.setReady();const yc=Gs.wrap(qs);P.AliRtcConnectionStatus=q,P.AliRtcConnectionStatusChangeReason=ct,P.AliRtcEngineLocalDeviceExceptionType=te,P.AliRtcEngineLocalDeviceType=je,P.AliRtcErrorCode=T,P.AliRtcLiveTranscodingAudioSampleRate=qt,P.AliRtcLiveTranscodingCropMode=Di,P.AliRtcLiveTranscodingEncodeParam=Bi,P.AliRtcLiveTranscodingErrorCode=Fe,P.AliRtcLiveTranscodingFontType=Tt,P.AliRtcLiveTranscodingMediaProcessMode=Gt,P.AliRtcLiveTranscodingMixMode=It,P.AliRtcLiveTranscodingMixParam=Fs,P.AliRtcLiveTranscodingParam=zt,P.AliRtcLiveTranscodingSegmentType=At,P.AliRtcLiveTranscodingSingleParam=js,P.AliRtcLiveTranscodingSourceType=St,P.AliRtcLiveTranscodingState=xi,P.AliRtcLiveTranscodingStreamType=Oi,P.AliRtcLiveTranscodingTaskProfile=Vi,P.AliRtcLocalStreamInfo=Gi,P.AliRtcLogLevel=Li,P.AliRtcPlugin=mt,P.AliRtcPluginTrackType=Jt,P.AliRtcPluginType=Hr,P.AliRtcPublishState=B,P.AliRtcRawDataStreamType=ae,P.AliRtcRemoteUserInfo=Yr,P.AliRtcSdkChannelProfile=qe,P.AliRtcSdkClientRole=Ze,P.AliRtcSubscribeState=Z,P.AliRtcTranscodingClockWidget=$s,P.AliRtcTranscodingImage=dr,P.AliRtcTranscodingText=Ks,P.AliRtcTranscodingUser=Js,P.AliRtcTrascodingPublishTaskStatus=Ui,P.AliRtcVideoStreamType=oe,P.AliRtcVideoTrack=j,P.default=yc,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
153
|
+
`;class xa extends vs{constructor(e,t){super(e,t);A(this,"processor");A(this,"trackGenerator");A(this,"worker");this.processor=new MediaStreamTrackProcessor({track:e}),this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.startTransform()}static isSupport(){return"MediaStreamTrackProcessor"in window&&"MediaStreamTrackGenerator"in window&&"TransformStream"in window&&"VideoFrame"in window}startTransform(){const e=new Blob([R0],{type:"text/javascript"}),r=(window.URL||window.webkitURL).createObjectURL(e);this.worker=new Worker(r);const{readable:i}=this.processor,{writable:n}=this.trackGenerator;this.worker.postMessage({type:"startRender",readable:i,writable:n,width:this.targetWidth,height:this.targetHeight,frameRate:this.targetFrameRate},[i,n])}updateOptions(e){super.updateOptions(e),this.worker&&this.worker.postMessage(Se({type:"updateOptions"},e))}dispose(){try{this.processor.readable.cancel(),this.trackGenerator.writable.close()}catch(e){}}getVideoTrack(){return this.trackGenerator}}class xs{static isSupport(){return typeof HTMLCanvasElement.prototype.captureStream=="function"}static getInstance(c,e){return xa.isSupport()?new xa(c,e):va.isSupport()?new va(c,e):new _0(c,e)}}class k0 extends ei{constructor(){super(...arguments);A(this,"hasVideoTrack",!1);A(this,"videoScaler")}get initOptions(){return{width:320,height:180,frameRate:15}}setOptions(e){var t;this.options=e,(t=this.videoScaler)==null||t.updateOptions(e)}isSupported(){return xs.isSupport()}shouldUpdate(e){return this.hasVideoTrack!==!!e.currentVideoTrack}process(e){return z(this,null,function*(){if(e.currentVideoTrack){if(this.hasVideoTrack=!0,!this.videoScaler){const r=this.options||this.initOptions;this.videoScaler=xs.getInstance(e.currentVideoTrack,r)}const t=this.videoScaler.getVideoTrack();t&&e.updateDualVideoTrack(t)}else e.updateDualVideoTrack(),this.emit("updated"),this.videoScaler&&this.videoScaler.dispose()})}clear(e){super.clear(e),this.hasVideoTrack=!1,e==null||e.updateDualVideoTrack()}}class bs{static checkString(c){return typeof c=="string"}static checkNumber(c){return typeof c=="number"}static checkHtmlVideoElement(c){return c&&c.nodeName==="VIDEO"}static checkHtmlAudioElement(c){return c&&c.nodeName==="AUDIO"}static checkAuthInfo(c){if(!c)return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no authInfo founded");if(!c.appId)return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no appId founded");if(!c.channelId)return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no channelId founded");if(!c.userId)return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no userId founded");if(c.timestamp){if(!bs.checkNumber(c.timestamp))return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"timestamp is not number")}else return new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no timestamp founded");return c.token?null:new ne(ce.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no token founded")}static checkMediaStreamTrack(c){return c instanceof MediaStreamTrack}static checkVideoEncoderConfiguration(c){return c&&(c.width||c.height||c.frameRate||c.bitrateMax)}}class ba{constructor(c){A(this,"taskProfile");A(this,"encodeParam");A(this,"users",[]);A(this,"backgroundColor",0);A(this,"backgrounds",[]);A(this,"watermarks",[]);A(this,"clockWidgets",[]);A(this,"cropMode");A(this,"mediaProcessMode");this.taskProfile=c}}class Sa{constructor(c,e,t){A(this,"userId");A(this,"streamType");A(this,"sourceType");this.userId=c,this.streamType=e,this.sourceType=t}}class _a{constructor(c,e,t,r=0,i=16777215,n=fi.NOTO_SERIF_CJKSC_REGULAR){A(this,"x");A(this,"y");A(this,"fontSize");A(this,"zOrder");A(this,"fontColor");A(this,"fontType");this.x=c,this.y=e,this.fontSize=t,this.zOrder=r,this.fontColor=i,this.fontType=n}toJson(c,e){return{x:mt(this.x,c),y:mt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:as(this.fontColor),zorder:this.zOrder}}}var ya=(s=>(s[s.NOT_DISPLAY=0]="NOT_DISPLAY",s[s.ALWAYS=1]="ALWAYS",s[s.WHEN_NO_VIDEO=2]="WHEN_NO_VIDEO",s))(ya||{});class Ss{constructor(c,e,t,r,i,n=0,a=1,o=1){A(this,"url");A(this,"x");A(this,"y");A(this,"width");A(this,"height");A(this,"alpha");A(this,"display",1);A(this,"zOrder");this.url=c,this.x=e,this.y=t,this.width=r,this.height=i,this.zOrder=n,this.alpha=a,this.display=o}toJson(c,e){return{url:this.url,alpha:this.alpha,display:this.display,x:mt(this.x,c),y:mt(this.y,e),width:mt(this.width,c),height:mt(this.height,e),zorder:this.zOrder}}}A(Ss,"DisplayType",ya);class Aa{constructor(c,e,t,r,i=0,n=16777215,a=fi.NOTO_SERIF_CJKSC_REGULAR){A(this,"text");A(this,"x");A(this,"y");A(this,"fontSize");A(this,"zOrder");A(this,"fontColor");A(this,"fontType");this.text=c,this.x=e,this.y=t,this.fontSize=r,this.zOrder=i,this.fontColor=n,this.fontType=a}toJson(c,e){return{text:this.text,x:mt(this.x,c),y:mt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:as(this.fontColor),zorder:this.zOrder}}}class Ea{constructor(c,e,t,r,i,n=0,a){A(this,"userId");A(this,"x");A(this,"y");A(this,"width");A(this,"height");A(this,"zOrder");A(this,"sourceType");A(this,"segmentType",di.LiveTranscodingNoBody);A(this,"images",[]);A(this,"texts",[]);typeof c=="number"?this.userId=c.toString():this.userId=c,this.x=e,this.y=t,this.width=r,this.height=i,this.zOrder=n,a&&(this.sourceType=a)}toJson(c,e,t,r){const i={paneid:c,majorpane:0,x:mt(this.x,e),y:mt(this.y,t),width:mt(this.width,e),height:mt(this.height,t),zorder:this.zOrder,userid:this.userId,images:this.images.map(n=>n.toJson(e,t)),texts:this.texts.map(n=>n.toJson(e,t))};return this.sourceType&&li[this.sourceType]?i.sourcetype=li[this.sourceType]:i.sourcetype=li[ti.LiveTranscodingCamera],this.segmentType&&r===Bi.LiveTranscodingVirtualBackground?i.segmenttype=this.segmentType:i.segmenttype=di.LiveTranscodingNoBody,i}}class T0 extends ei{constructor(){super("AliRtcScreenStandardize",Ke.AliRtcSdkStreamTypeScreen);A(this,"canvas");A(this,"lastWidth");A(this,"lastHeight");A(this,"hasScreenTrack",!1)}get initOptions(){return{base:4}}setOptions(e){this.options=e}isSupported(){return!(typeof TransformStream=="undefined"||typeof MediaStreamTrackProcessor=="undefined"||typeof MediaStreamTrackGenerator=="undefined")}updateProcessCanvas(e,t){if(this.canvas&&this.lastWidth===e&&this.lastHeight===t)return;const r=Math.ceil(e/this.options.base)*this.options.base,i=Math.ceil(t/this.options.base)*this.options.base;if(this.canvas||(this.canvas=document.createElement("canvas")),this.canvas.width=r,this.canvas.height=i,this.lastWidth&&e>this.lastWidth||this.lastHeight&&t>this.lastHeight){const n=this.canvas.getContext("2d");n&&n.clearRect(0,0,r,i)}this.lastWidth=e,this.lastHeight=t}shouldUpdate(e){return this.hasScreenTrack!==(!!e.originVideoTrack&&e.videoSource===Yt.Screen)}handleFrame(e,t){return z(this,null,function*(){var a;const{displayWidth:r,displayHeight:i}=e;if(!r||!i||r%this.options.base===0&&i%this.options.base===0)return this.clear(t),e;this.updateProcessCanvas(r,i);const n=(a=this.canvas)==null?void 0:a.getContext("2d");if(this.canvas&&n){n.drawImage(e,0,0,r,i);const o=new VideoFrame(this.canvas,{timestamp:e.timestamp});return e.close(),o}return e})}process(e){return z(this,null,function*(){var h;if(!e.originVideoTrack||e.videoSource!==Yt.Screen){this.clear(e),this.hasScreenTrack=!1;return}const t=new MediaStreamTrackProcessor({track:e.originVideoTrack}),r=new MediaStreamTrackGenerator({kind:"video"}),i=new MediaStream([r]),n=this,a=new TransformStream({transform(v,f){return z(this,null,function*(){const d=yield n.handleFrame(v,e);yield f.enqueue(d),d==null||d.close()})}});t.readable.pipeThrough(a).pipeTo(r.writable);const o=(h=i.getVideoTracks())==null?void 0:h[0];e.updateVideoTrack(o),this.hasScreenTrack=!0})}clear(e){this.canvas=void 0,this.lastWidth=void 0,this.lastHeight=void 0,super.clear(e)}}var D0=Object.defineProperty,B0=Object.getOwnPropertyDescriptor,de=(s,c,e,t)=>{for(var r=t>1?void 0:t?B0(c,e):c,i=s.length-1,n;i>=0;i--)(n=s[i])&&(r=(t?n(c,e,r):n(r))||r);return t&&r&&D0(c,e,r),r};const le=(fe=class extends ve{constructor(e){super();A(this,"channelProfile");A(this,"clientRole");A(this,"signalingManager");A(this,"bizControl");A(this,"liveTranscoding");A(this,"maxSignalingConnectRetryCount");A(this,"slsReporter");A(this,"connectState",Te.AliRtcConnectionStatusInit);A(this,"networkError",!1);A(this,"audioMixerPlugin");A(this,"dualVideoPlugin");A(this,"_audioOnlyMode",!1);A(this,"_authInfoWillExpireTimer",null);A(this,"_authInfoExpiredTimer",null);A(this,"_serverCheckAuthInfoTimestamp",null);A(this,"_localCheckAuthInfoTimestamp",null);const t=Date.now();this.slsReporter=new ui(this),this.channelProfile=It.AliRtcSdkCommunication,this.clientRole=Dt.AliRtcSdkLive,this.liveTranscoding=new v0(this.slsReporter),this.signalingManager=new jc(this.channelProfile,this.clientRole,this.slsReporter,(e==null?void 0:e.env)===Ct.pre?Ct.pre:Ct.prod),this.addSignalingManagerListeners(),this.maxSignalingConnectRetryCount=e==null?void 0:e.maxSignalingConnectRetryCount,this.bizControl=new ot({slsReporter:this.slsReporter,signalingManager:this.signalingManager}),this.addBizControlListeners(),this.addPublisherListeners(),this.audioMixerPlugin=new S0,this.enablePlugin(this.audioMixerPlugin),this.dualVideoPlugin=new k0("dualVideoPlugin"),this.enablePlugin(new T0),this.slsReporter.reportSDKCreated(t)}static getSdkVersion(){return sr}static setLogLevel(e){oe.setLogLevel(e)}static getInstance(e){return fe._instance||(fe._instance=new fe(e)),fe._instance}destroy(){fe._instance=void 0}get channel(){return this.bizControl.channel}get userId(){return this.bizControl.userId}get remoteUsers(){return this.bizControl.remoteUsers}get publisher(){return this.bizControl.publisher}get publishAudioStream(){var e;return(e=this.publisher)==null?void 0:e.publishStreams.audio}get isPublishing(){const{publisher:e}=this.bizControl;return e?e.isPublishing:!1}get currentRoleCanPublish(){return this.channelProfile===It.AliRtcSdkCommunication||this.clientRole===Dt.AliRtcSdkInteractive}resetState(){return z(this,null,function*(){yield this.bizControl.clear(),this.connectState=Te.AliRtcConnectionStatusDisconnected,this.networkError=!1,this.signalingManager.reset(),this.liveTranscoding.clear(),this.slsReporter.stop(),yield this.publishLocalAudioStream(!0),yield this.publishLocalVideoStream(!0),yield this.publishLocalScreenShareStream(!0)})}stopPublish(e){return z(this,null,function*(){var t,r,i;e?yield(t=this.publisher)==null?void 0:t.stopLocalStream(e):(yield(r=this.publisher)==null?void 0:r.publishStop(),(i=this.publisher)==null||i.stopPreview())})}addPublisherListeners(){var e,t,r,i,n,a,o,u,h;(e=this.publisher)==null||e.on(et.Local,v=>{oe.event("[Publisher] Device Status Change",v),this.onLocalDeviceStatusChange(v)}),(t=this.publisher)==null||t.on(Gt.VideoTrackEnded,()=>{oe.event("[Publisher] VideoTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeCamera,Fe.AliEngineLocalDeviceExceptionTypeCameraInterrupt,"")}),(r=this.publisher)==null||r.on(Gt.ScreenTrackEnded,()=>{oe.event("[Publisher] ScreenTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeDisplay,Fe.AliEngineLocalDeviceExceptionTypeDisplayException,"")}),(i=this.publisher)==null||i.on(Gt.AudioTrackEnded,()=>{oe.event("[Publisher] AudioTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeMic,Fe.AliEngineLocalDeviceExceptionTypeMicInterrupt,"")}),(n=this.publisher)==null||n.on("localDeviceException",(v,f,d="")=>{this.emit("localDeviceException",v,f,d)}),(a=this.publisher)==null||a.on("audioPublishStateChanged",(v,f,d)=>{var p;this.emit("audioPublishStateChanged",v,f,d,(p=this.channel)!=null?p:"")}),(o=this.publisher)==null||o.on("videoPublishStateChanged",(v,f,d)=>{var p;this.emit("videoPublishStateChanged",v,f,d,(p=this.channel)!=null?p:"")}),(u=this.publisher)==null||u.on("dualStreamPublishStateChanged",(v,f,d)=>{var p;this.emit("dualStreamPublishStateChanged",v,f,d,(p=this.channel)!=null?p:"")}),(h=this.publisher)==null||h.on("screenPublishStateChanged",(v,f,d)=>{var p;this.emit("screenSharePublishStateChanged",v,f,d,(p=this.channel)!=null?p:"")})}addBizControlListeners(){this.bizControl.rtsManager.on("disconnected",()=>z(this,null,function*(){oe.event(`[${fe.logName}]`,"RTS Disconnected"),(yield At.isNetworkAvailable())?this.onNetworkRecovery():this.onNetworkError()})),this.bizControl.rtsManager.on("subscribeexceeds",()=>z(this,null,function*(){yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList()})),this.bizControl.rtsManager.on("seimessage",(e,t,r)=>{const i=this.remoteUsers.find(n=>n.streamUrl===e);i&&this.emit("mediaExtensionMsgReceived",i.userId,r,t)}),this.bizControl.on(et.Remote,(e,t)=>{oe.event(`[${fe.logName}]`,"RemoteUser Device Status Change",e,t)}),this.bizControl.on("remoteTrackAvailableChange",(e,t,r)=>{this.emit("remoteTrackAvailableNotify",e,t,r)}),this.bizControl.on("audioSubscribeStateChanged",(e,t,r,i,n)=>{this.emit("audioSubscribeStateChanged",e,t,r,i,n)}),this.bizControl.on("videoSubscribeStateChanged",(e,t,r,i,n)=>{this.emit("videoSubscribeStateChanged",e,t,r,i,n)}),this.bizControl.on("screenSubscribeStateChanged",(e,t,r,i,n)=>{this.emit("screenShareSubscribeStateChanged",e,t,r,i,n)}),this.bizControl.on("userAudioMuted",(e,t)=>{this.emit("userAudioMuted",e,t)}),this.bizControl.on("userVideoMuted",(e,t)=>{this.emit("userVideoMuted",e,t)}),this.bizControl.on("userScreenMuted",(e,t)=>{this.emit("userScreenMuted",e,t)}),this.bizControl.on("audioVolume",e=>{this.emit("audioVolume",e)}),this.bizControl.on("remoteAudioAutoPlayFail",e=>{this.emit("remoteAudioAutoPlayFail",e)}),this.bizControl.on("remoteVideoAutoPlayFail",(e,t)=>{this.emit("remoteVideoAutoPlayFail",e,t)}),this.bizControl.on("rtcStats",e=>{this.emit("rtcStats",e)}),this.bizControl.on("rtcLocalAudioStats",e=>{this.emit("rtcLocalAudioStats",e)}),this.bizControl.on("rtcLocalVideoStats",e=>{this.emit("rtcLocalVideoStats",e)}),this.bizControl.on("rtcRemoteAudioStats",e=>{this.emit("rtcRemoteAudioStats",e)}),this.bizControl.on("rtcRemoteVideoStats",e=>{this.emit("rtcRemoteVideoStats",e)}),this.bizControl.on("remoteSubscribeError",e=>{this.emit("onOccurError",e),this.slsReporter.reportError(e)})}addSignalingManagerListeners(){this.signalingManager.on("onKeepAliveRsp",()=>{this.networkError&&(oe.event("[Signaling] Receive KeepAlive Response",`networkError: ${this.networkError}`),this.onNetworkRecovery())}),this.signalingManager.on("onNotifyJoin",e=>{oe.event("[Signaling] Notify Join ",e),this.handleUsersJoin(e),e.forEach(t=>{this.emit("remoteUserOnLineNotify",t.userid,0)})}),this.signalingManager.on("onNotifyStatus",e=>{oe.event("[Signaling] Notify Status ",e),e.forEach(t=>{this.bizControl.updateRemoteUserDeviceStatus(t)})}),this.signalingManager.on("onNotifyLeave",e=>{oe.event("[Signaling] Notify Leave ",e),e.forEach(t=>{this.emit("remoteUserOffLineNotify",t.userid,t.leavecode),this.bizControl.removeLeftUser(t)})}),this.signalingManager.on("onBye",(e,t)=>{oe.event("[Signaling] Bye ",e,t),this.slsReporter.reportError({message:`reason: ${e}, description: ${t}`}),this.emit("bye",e),this.leaveChannel(!0),this.slsReporter.reportBye(e)}),this.signalingManager.on("onConnectFail",e=>{oe.event("[Signaling] Connect Failed ",e),this.onError(e),this.backToUnpublishStatus(),this.connectState=Te.AliRtcConnectionStatusFailed,this.emit("connectionStatusChange",Te.AliRtcConnectionStatusFailed,Kt.AliRtcConnectionChangedNetworkInterrupted)}),this.signalingManager.on("onNetworkError",e=>{this.slsReporter.reportWarning("signaling network error"),oe.event("[Signaling] Network error ",e),this.onNetworkError()}),this.signalingManager.on("onAuthInvalid",()=>{oe.event("[Signaling] Auth Invalid")}),this.signalingManager.on("onReconnectStart",()=>{oe.event("[Signaling] Reconnect Start "),this.connectState=Te.AliRtcConnectionStatusReconnecting,this.emit("connectionStatusChange",Te.AliRtcConnectionStatusReconnecting,Kt.AliRtcConnectionSignalingConnecting)}),this.signalingManager.on("onReconnectSuccess",e=>{oe.event("[Signaling] Reconnect Success ",e),this.onNetworkRecovery(e)}),this.signalingManager.on("onReconnectFail",e=>{this.slsReporter.reportWarning("signaling reconnect fail: ${err.code}"),oe.event("[Signaling] Reconnect Failed ",e),e.code===403&&this.emit("authInfoExpired")}),this.signalingManager.on("onError",e=>{this.slsReporter.reportWarning("signaling error: ${err.message}"),oe.event("[Signaling] Error ",e),this.onError(e)})}backToUnpublishStatus(){var e,t;this.connectState=Te.AliRtcConnectionStatusDisconnected,(e=this.publisher)!=null&&e.isPublishing&&((t=this.publisher)==null||t.clearPublishState()),this.networkError=!1}handleUsersJoin(e){e.forEach(t=>{const r=t.userid;if(r){const i=this.bizControl.addUser(r,t.displayname,Be.Join);oe.event(`[${fe.logName}]`,Ie.UserJoined,i)}})}onLocalDeviceStatusChange(e){oe.event(`[${fe.logName}]`,et.Local,e),this.signalingManager.reportStatus(e).then(()=>{oe.debug("[signaling] reportStatus suc")}).catch(t=>{oe.error("[signaling] reportStatus failed",t)})}resumePublishForNetworkRecovery(){return z(this,null,function*(){var e;try{yield(e=this.publisher)==null?void 0:e.resumePublish()}catch(t){const{code:r}=t;if(r===10205){let n=1;try{yield new Promise((a,o)=>{const u=setInterval(()=>z(this,null,function*(){var h;n>1&&(clearInterval(u),o()),n+=1;try{yield(h=this.publisher)==null?void 0:h.resumePublish(),clearInterval(u),a()}catch(v){const{code:f}=v;f!==10205&&(clearInterval(u),o())}}),1e3)})}catch(a){}}}})}onNetworkRecovery(e){return z(this,null,function*(){var t;oe.event(fe.logName,"onNetworkRecovery",{users:e}),this.networkError&&(this.networkError=!1,(t=this.publisher)==null||t.reportSelfDeviceStatus(),!this.bizControl.rtsManager.isConnected&&this.bizControl.rtsManager.isConnecting&&(yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList(e)),this.connectState=Te.AliRtcConnectionStatusConnected,this.emit("connectionStatusChange",Te.AliRtcConnectionStatusConnected,Kt.AliRtcConnectionSignalingHeartbeatAlive))})}resumeSubList(e){return z(this,null,function*(){if(e!=null&&e.length){const{joinList:t,leaveList:r,presentList:i}=this.bizControl.updateUsers(e);oe.info(`[${fe.logName}]`,"resumeSubList",{joinList:t,leaveList:r,presentList:i}),this.handleUsersJoin(t),r.forEach(n=>{oe.event(fe.logName,Ie.UserLeft,n.userid,n.reason),this.emit("remoteUserOffLineNotify",n.userid,os.AliRtcUserOfflineQuit)});for(let n=0;n<i.length;n++){const a=i[n],o=a.userid,u=this.bizControl.getRemoteUser(o);this.bizControl.onRemotePublishStateChange(a),u==null||u.restore(),u==null||u.updateSubscribe(Be.Resume)}}else for(let t=0;t<this.remoteUsers.length;t++){const r=this.remoteUsers[t];try{r.restore(),r.updateSubscribe(Be.Resume)}catch(i){}}})}onNetworkError(){this.connectState===Te.AliRtcConnectionStatusConnected&&(this.networkError||(this.connectState=Te.AliRtcConnectionStatusDisconnected,this.emit("connectionStatusChange",Te.AliRtcConnectionStatusDisconnected,Kt.AliRtcConnectionChangedNetworkInterrupted)),this.networkError=!0)}onError(e){this.slsReporter.reportError(e),oe.event(fe.logName,Ie.Error,e)}setEnableDualVideoStream(e,t){t&&this.dualVideoPlugin.setOptions(t);const r=this.bizControl.pluginManager.has(this.dualVideoPlugin.name);e?!r&&this.enablePlugin(this.dualVideoPlugin):r&&this.removePlugin(this.dualVideoPlugin.name)}hadPushStream(e){if(!(this.publisher&&e))throw new ne(ce.ERR_INNER,"stream is not publishing")}getCurrentMicDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentMicDeviceId()}setChannelProfile(e){if(![Te.AliRtcConnectionStatusInit,Te.AliRtcConnectionStatusDisconnected,Te.AliRtcConnectionStatusFailed].includes(this.connectState))throw new ne(ce.ERR_INNER,"cannot set channel profile in call");this.channelProfile=e,this.channelProfile===It.AliRtcSdkCommunication&&(this.clientRole=Dt.AliRtcSdkLive),this.signalingManager.setChannelProfile(e)}setClientRole(e){return z(this,null,function*(){var t,r,i,n,a;try{if(this.channelProfile===It.AliRtcSdkCommunication)return;if(!Object.values(Dt).includes(e))throw new ne(ce.ERR_INVALID_ARGUMENTS,`set client role error, role value(${e}) is invalid`);if(this.clientRole===e)return;this.slsReporter.reportRoleUpdate(this.clientRole,e),this.isInCall()?this.clientRole===Dt.AliRtcSdkInteractive?(this.bizControl.isSubscribing?(yield this.stopPublish(),yield(t=this.publisher)==null?void 0:t.clearStream()):yield(r=this.publisher)==null?void 0:r.unPublish(),yield this.signalingManager.setClientRole(e)):(yield this.signalingManager.setClientRole(e),yield this.startDefaultDevicesCapture(),(i=this.publisher)!=null&&i.isPublishing||(yield(n=this.publisher)==null?void 0:n.startPublish()),yield(a=this.publisher)==null?void 0:a.previewAll()):yield this.signalingManager.setClientRole(e),this.clientRole=e}catch(o){throw o.code===403&&this.emit("authInfoExpired"),o}})}getCurrentClientRole(){return this.clientRole}setAudioOnlyMode(e){if(this.isInCall())throw new ne(ce.ERR_INNER,"can not change audioOnly mode in call");this._audioOnlyMode=e}setAudioRedEnabled(e){if(this.isInCall())throw new ne(ce.ERR_INNER,"can not change audioRedEnabled in call");this.bizControl.setAudioRedEnabled(e)}setCheckAuthInfoTimer(e,t){const r=(e-t)*1e3;this._authInfoExpiredTimer=window.setTimeout(()=>{this.emit("authInfoExpired")},r),this._authInfoWillExpireTimer=window.setTimeout(()=>{this.emit("authInfoWillExpire")},r-3e4),this._serverCheckAuthInfoTimestamp=t,this._localCheckAuthInfoTimestamp=+Date.now()/1e3}clearCheckAuthInfoTimer(){this._authInfoExpiredTimer&&window.clearTimeout(this._authInfoExpiredTimer),this._authInfoWillExpireTimer&&window.clearTimeout(this._authInfoWillExpireTimer)}startDefaultDevicesCapture(){return z(this,null,function*(){var r,i;let e=[],t;try{this._audioOnlyMode||(e=yield fe.getCameraList(),e.length||oe.warn(`${[fe.logName]}`,"No media neither devices can be captured")),t=yield fe.getMicrophoneList(),t.length||oe.warn(`${[fe.logName]}`,"No media neither devices can be captured");const{hasCamera:n,hasMicrophone:a,hasScreenShare:o,audioCaptureDisabled:u,publishLocalAudioStreamEnabled:h,publishLocalVideoStreamEnabled:v}=(r=this.publisher)!=null?r:{};if(n||a||o)return;!n&&v&&!this._audioOnlyMode&&e.length&&!((i=this.publisher)!=null&&i.cameraCaptureDisabled)&&(yield this.enableLocalVideo(!0)),!a&&h&&!u&&t.length&&(yield this.startAudioCapture())}catch(n){throw n}})}joinChannel(e,t,r,i){return z(this,null,function*(){var h,v,f,d,p,l,m,x,g,b;let n=i,a;if(typeof e=="string"){n=i;try{const y=JSON.parse(window.atob(e));if(a={appId:y.appid,channelId:y.channelid,userId:y.userid,timestamp:y.timestamp,nonce:y.nonce,token:y.token},a.channelId!==t)throw new Error("channelId is not equal");if(a.userId!==r)throw new Error("userId is not equal")}catch(y){throw new ne(ce.ERR_INVALID_ARGUMENTS,`authInfo is invalid: ${y.message||""}`)}}else a=e,n=t;const o={start:Date.now()};let u=bs.checkAuthInfo(a);if(Te.AliRtcConnectionStatusInit===this.connectState||Te.AliRtcConnectionStatusDisconnected===this.connectState||Te.AliRtcConnectionStatusFailed===this.connectState){if(this.connectState=Te.AliRtcConnectionStatusConnecting,u)throw this.connectState=Te.AliRtcConnectionStatusFailed,this.slsReporter.reportJoin(u.code,o,""),this.slsReporter.reportJoinResult(u),u;a.sessionId=At.createCallid("web"),oe.setSessionID(a.appId,a.sessionId),this.slsReporter.start(a);try{const I=yield this.signalingManager.join(a,n,this.maxSignalingConnectRetryCount,o);this.connectState=Te.AliRtcConnectionStatusConnected,(h=this.publisher)==null||h.reportSelfDeviceStatus(),this.bizControl.init(a,I),this.setCheckAuthInfoTimer(a.timestamp,I.timestamp),this.liveTranscoding.setAuthInfo(a),this.slsReporter.reportJoin(0,o,I.tid),this.slsReporter.reportJoinResult(null)}catch(I){const C=(v=I.code)!=null?v:-1,R=I.reason||I.message||"";throw this.connectState=Te.AliRtcConnectionStatusDisconnected,this.slsReporter.reportJoin(C,o,""),this.slsReporter.reportJoinResult(I),new ne(C,R)}let y=!1,E=!1;try{this.currentRoleCanPublish&&(yield this.startDefaultDevicesCapture(),y=!!((f=this.publisher)!=null&&f.publishStreams.audio),E=!!((d=this.publisher)!=null&&d.publishStreams.video)||!!((p=this.publisher)!=null&&p.publishStreams.videoSmall)||!!((l=this.publisher)!=null&&l.publishStreams.screen),Object.values((x=(m=this.publisher)==null?void 0:m.publishStreams)!=null?x:{}).some(I=>I)&&(yield(g=this.publisher)==null?void 0:g.startPublish(!1,Ot.JOINCHANNEL),yield(b=this.publisher)==null?void 0:b.previewAll())),this.remoteUsers.forEach(I=>{I.updateSubscribe(Be.Join)})}catch(I){y&&this.emit("onOccurError",new ne(ce.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED,`join channel auto publish audio stream failed, ${I.message||""}`)),E&&this.emit("onOccurError",new ne(ce.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED,`join channel auto publish video stream failed, ${I.message||""}`))}}else{const y=new ne(ce.ERR_JOIN_ALREADY_JOINED,"already joined");throw this.connectState===Te.AliRtcConnectionStatusConnecting&&(y.message="Repeated operation during login"),this.slsReporter.reportJoin(y.code,o,""),y}})}leaveChannel(e=!1){return z(this,null,function*(){var r;this.slsReporter.reportLeaveInvoked();let t=new Date().getTime();if(Te.AliRtcConnectionStatusConnected===this.connectState)try{let i;e||(i=yield this.signalingManager.leave()),this.clearCheckAuthInfoTimer(),yield this.resetState(),this.slsReporter.reportLeave(new Date().getTime()-t,0,(r=i==null?void 0:i.tid)!=null?r:""),oe.uploadLog();return}catch(i){throw this.slsReporter.reportLeave(new Date().getTime()-t,i.code,i.reason),i}else{yield this.resetState(),this.slsReporter.reportLeave(0,0,"");return}})}isInCall(){return this.connectState===Te.AliRtcConnectionStatusConnected}refreshAuthInfo(e){return z(this,null,function*(){const{userId:t,nonce:r,timestamp:i,token:n,role:a}=e,o={userId:t,nonce:r,timestamp:i,token:n,role:a};try{yield this.signalingManager.refreshAuthInfo(o),this.bizControl.refreshAuthInfo(o),this.liveTranscoding.refreshAuthInfo(o),this.clearCheckAuthInfoTimer(),this._serverCheckAuthInfoTimestamp&&this._localCheckAuthInfoTimestamp&&e.timestamp&&this.setCheckAuthInfoTimer(e.timestamp,this._serverCheckAuthInfoTimestamp+(Date.now()-this._localCheckAuthInfoTimestamp))}catch(u){throw u}})}isAudioOnly(){return this._audioOnlyMode}publishLocalAudioStream(e){return z(this,null,function*(){var t,r,i;(t=this.publisher)==null||t.setPublishLocalAudioStreamEnabled(e),this.connectState===Te.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.hasMicrophone?yield(i=this.publisher)==null?void 0:i.publishUpdate():yield this.startAudioCapture():yield this.stopPublish({audio:!0}))})}isLocalAudioStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalAudioStreamEnabled)!=null?t:!0}setDefaultSubscribeAllRemoteAudioStreams(e){this.bizControl.setAutoSubAudio(e)}subscribeAllRemoteAudioStreams(e){this.bizControl.setWantSubAudio(e)}subscribeRemoteAudioStream(e,t){if(t&&!this.bizControl.isWantSubAudio)throw new ne(ce.ERR_INVALID_ARGUMENTS,"subscribeAllRemoteAudioStreams(true) must be called first");this.bizControl.updateAudioWant(e,t)}resumeRemoteAudioStream(e){const t=this.bizControl.getRemoteUser(e);t&&t.resumeAudio()}publishLocalVideoStream(e){return z(this,null,function*(){var t,r,i;(t=this.publisher)==null||t.setPublishLocalVideoStreamEnabled(e),this.connectState===Te.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.hasCamera?yield(i=this.publisher)==null?void 0:i.publishUpdate():yield this.enableLocalVideo():yield this.stopPublish({video:!0}))})}isLocalVideoStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalVideoStreamEnabled)!=null?t:!0}setRemoteDefaultVideoStreamType(e){[Je.AliRtcVideoStreamTypeHigh,Je.AliRtcVideoStreamTypeLow].includes(e)&&this.bizControl.setRemoteDefaultVideoStreamType(e)}setRemoteUserVideoStreamType(e,t){[Je.AliRtcVideoStreamTypeHigh,Je.AliRtcVideoStreamTypeLow].includes(t)&&this.bizControl.setRemoteUserVideoStreamType(e,t)}setDefaultSubscribeAllRemoteVideoStreams(e){this.bizControl.setAutoSubVideo(e),this.bizControl.setAutoSubScreen(e)}subscribeAllRemoteVideoStreams(e){this.bizControl.setWantSubVideo(e),this.bizControl.setWantSubScreen(e)}subscribeRemoteMediaStream(e,t,r,i){const n=this.bizControl.getRemoteUser(e);if(!n)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r&&(t===Ae.AliRtcVideoTrackScreen||t===Ae.AliRtcVideoTrackBoth)?n.setWantSubScreen(!0):n.setWantSubScreen(!1),r&&(t===Ae.AliRtcVideoTrackCamera||t===Ae.AliRtcVideoTrackBoth)?n.setWantSubVideo(!0):n.setWantSubVideo(!1),n.setWantSubAudio(i),n.updateSubscribe(Be.User)}resumeRemoteMediaStream(e,t){const r=this.bizControl.getRemoteUser(e);r&&r.resumeVideo(t)}getOnlineRemoteUsers(){return this.bizControl.remoteUsers.map(e=>e.userId)}getUserInfo(e){var t;return(t=this.bizControl.getRemoteUser(e))==null?void 0:t.remoteUserInfo}isUserOnline(e){return!!this.bizControl.remoteUsers.find(t=>t.userId===e)}startScreenShare(e){return z(this,null,function*(){var a;const t={video:!1,audio:!1},{audio:r=!1,videoTrack:i,audioTrack:n}=e||{};if(i||n){t.screen=!0;const o=new MediaStream;i&&o.addTrack(i),n&&o.addTrack(n),t.mediaStream=o}else t.screen=r?{audio:!0}:!0;yield(a=this.publisher)==null?void 0:a.createLocalStream(t)})}stopScreenShare(){return z(this,null,function*(){var e;(e=this.publisher)==null||e.stopLocalStream({screen:!0})})}setScreenShareConfiguration(e){return z(this,null,function*(){var i;const{frameRate:t=gi.frameRate,bitrate:r=gi.maxBitrate}=e;yield(i=this.publisher)==null?void 0:i.setScreenProfile(ca,{width:gi.width,height:gi.height,frameRate:t,maxBitrate:r})})}setScreenShareContentHint(e){return z(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setScreenContentHint(e))})}publishLocalScreenShareStream(e,t){return z(this,null,function*(){var r,i,n;(r=this.publisher)==null||r.setPublishLocalScreenStreamEnabled(e),this.connectState===Te.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasScreenShare?yield(n=this.publisher)==null?void 0:n.publishUpdate():yield this.startScreenShare(t):yield this.stopPublish({screen:!0}))})}isScreenSharePublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalScreenStreamEnabled)!=null?t:!0}setAudioShareVolume(e){if(typeof e!="number")throw new ne(ce.ERR_INVALID_ARGUMENTS,"volume must be a number");this.audioMixerPlugin.setOptions({screen:Math.max(0,Math.min(e,400))/100})}enableAudioVolumeIndication(e){this.bizControl.enableAudioVolumeIndication(e)}muteLocalMic(e=!1){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Ie.MuteAudio:Ie.UnmuteAudio),(t=this.publisher)==null||t.muteLocalMic(e)}muteRemoteAudioPlaying(e,t=!1){const r=this.bizControl.getRemoteUser(e);if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);r.setAudioMuted(t)}muteAllRemoteAudioPlaying(e=!1){this.bizControl.setAudioMuted(e)}startAudioCapture(e){return z(this,null,function*(){var r;const t={audio:e||!0};yield(r=this.publisher)==null?void 0:r.createLocalStream(t)})}stopAudioCapture(){var e;(e=this.publisher)==null||e.stopAudioCapture()}switchMicrophone(e,t){return z(this,null,function*(){var r,i,n,a;if(yield(r=this.publisher)==null?void 0:r.setMicrophoneDeviceId(e),!((i=this.publisher)!=null&&i.audioCaptureDisabled)){if(t){yield(n=this.publisher)==null?void 0:n.createLocalStream({audio:!0,mediaStream:new MediaStream([t])});return}yield(a=this.publisher)==null?void 0:a.createLocalStream({audio:{deviceId:e}})}})}setRecordingVolume(e){if(typeof e!="number")throw new ne(ce.ERR_INVALID_ARGUMENTS,"volume must be a number");this.audioMixerPlugin.setOptions({audio:Math.max(0,Math.min(e,400))/100})}setPlayoutVolume(e){if(typeof e!="number")throw new ne(ce.ERR_INVALID_ARGUMENTS,"volume must be a number");this.bizControl.setPlayoutVolume(Math.max(0,Math.min(e,100))/100)}setRemoteAudioVolume(e,t){const r=this.bizControl.getRemoteUser(e);if(!r)throw new ne(ce.ERR_INNER,`no remote user(${e}) founded`);if(typeof t!="number")throw new ne(ce.ERR_INVALID_ARGUMENTS,"volume must be a number");r.setPlayoutVolume(Math.max(0,Math.min(t,100))/100)}setAudioProfile(e){return z(this,null,function*(){var t;yield(t=this.publisher)==null?void 0:t.setAudioProfile(e)})}getAudioTrack(e){return z(this,null,function*(){var r;if(!e)return(r=this.publisher)==null?void 0:r.audioTrack;const t=this.bizControl.getRemoteUser(e);return t==null?void 0:t.getAudioTrack})}setLocalViewConfig(e,t){return z(this,null,function*(){var r,i,n;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot set local view in audio only mode");(r=this.bizControl)==null||r.setLocalViewConfig(e,t),t===Ae.AliRtcVideoTrackCamera&&((i=this.publisher)!=null&&i.hasCamera)?yield this.startPreview():t===Ae.AliRtcVideoTrackScreen&&((n=this.publisher)!=null&&n.hasScreenShare)&&(yield this.startPreviewScreen())})}setCameraCapturerConfiguration(e){return z(this,null,function*(){var u,h,v;const{width:t=mi.width,height:r=mi.height,frameRate:i=mi.frameRate,bitrate:n=mi.maxBitrate,cameraDirection:a,deviceId:o}=e;yield(u=this.publisher)==null?void 0:u.setVideoProfile(oa,{width:t,height:r,frameRate:i,maxBitrate:n}),a!==void 0&&((h=this.publisher)==null||h.setCameraDirection(a)),o&&((v=this.publisher)==null||v.setCameraDeviceId(o))})}setCameraCapturerContentHint(e){return z(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setVideoContentHint(e))})}enableLocalVideo(e=!0){return z(this,null,function*(){var t,r,i,n,a,o,u,h,v,f,d;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot enable local video in audio only mode");if(e){(r=(t=this.publisher)==null?void 0:t.publishStreams)!=null&&r.video&&((a=(n=(i=this.publisher)==null?void 0:i.publishStreams)==null?void 0:n.video)==null||a.disableVideo(),(v=(h=(u=(o=this.publisher)==null?void 0:o.publishStreams)==null?void 0:u.video)==null?void 0:h.videoTrack)==null||v.stop());const p={video:!0};yield(f=this.publisher)==null?void 0:f.startCameraCapture(p)}else yield(d=this.publisher)==null?void 0:d.stopCameraCapture()})}muteLocalCamera(e){return z(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Ie.MuteVideo:Ie.UnmuteVideo),(t=this.publisher)==null||t.muteLocalCamera(e)})}muteLocalScreen(e){return z(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Ie.MuteScreen:Ie.UnmuteScreen),(t=this.publisher)==null||t.muteLocalScreen(e)})}setRemoteViewConfig(e,t,r){this.bizControl.setRemoteViewConfig(t,e,r)}isCameraOn(){var e,t;return(t=(e=this.publisher)==null?void 0:e.hasCamera)!=null?t:!1}switchCamera(e,t){return z(this,null,function*(){var i,n,a,o,u,h,v,f,d,p,l,m,x;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot switch camera in audio only mode");const r={};if(e?(r.deviceId=e,this.slsReporter.reportSwitchCamera(e)):(r.cameraDirection=((i=this.publisher)==null?void 0:i.cameraDirection)==="environment"?pi.CAMERA_FRONT:pi.CAMERA_REAR,this.slsReporter.reportSwitchCamera(((n=this.publisher)==null?void 0:n.cameraDirection)||"")),yield this.setCameraCapturerConfiguration(r),!((a=this.publisher)!=null&&a.cameraCaptureDisabled)){(u=(o=this.publisher)==null?void 0:o.publishStreams)!=null&&u.video&&((f=(v=(h=this.publisher)==null?void 0:h.publishStreams)==null?void 0:v.video)==null||f.disableVideo(),(m=(l=(p=(d=this.publisher)==null?void 0:d.publishStreams)==null?void 0:p.video)==null?void 0:l.videoTrack)==null||m.stop());const g={video:!0};t&&(g.mediaStream=new MediaStream([t])),yield(x=this.publisher)==null?void 0:x.createLocalStream(g)}})}getCurrentCameraDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentCameraDeviceId()}startPreview(){return z(this,null,function*(){var e,t;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot start preview camera in audio only mode");(e=this.publisher)!=null&&e.hasCamera||(yield this.enableLocalVideo(!0)),yield(t=this.publisher)==null?void 0:t.previewAll({screen:!1})})}startPreviewScreen(e){return z(this,null,function*(){var t,r;if(this._audioOnlyMode)throw new ne(ce.ERR_INNER,"Cannot start preview screen share in audio only mode");(t=this.publisher)!=null&&t.hasScreenShare||(yield this.startScreenShare(e)),yield(r=this.publisher)==null?void 0:r.previewAll({primary:!1})})}stopPreview(){return z(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!0,screen:!1})})}stopPreviewScreen(){return z(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!1,screen:!0})})}getVideoTrack(e){return z(this,null,function*(){var n,a,o,u;const{userId:t,streamType:r}=e;if(!t)return r===Ke.AliRtcSdkStreamTypeCapture?(n=this.publisher)==null?void 0:n.cameraTrack:(a=this.publisher)==null?void 0:a.screenTrack;const i=this.bizControl.getRemoteUser(t);return r===Ke.AliRtcSdkStreamTypeCapture?(o=i==null?void 0:i.getCameraStream)==null?void 0:o.videoTrack:(u=i==null?void 0:i.getScreenStream)==null?void 0:u.videoTrack})}startPublishLiveStream(e,t){return z(this,null,function*(){return this.liveTranscoding.startPublishLiveStream(e,t)})}updatePublishLiveStream(e,t){return z(this,null,function*(){return this.liveTranscoding.updatePublishLiveStream(e,t)})}updatePublishLiveStreamWithTaskId(e,t){return this.liveTranscoding.updatePublishLiveStreamWithTaskId(e,t)}stopPublishLiveStream(e){return z(this,null,function*(){return this.liveTranscoding.stopPublishLiveStream(e)})}stopPublishLiveStreamWithTaskId(e){return this.liveTranscoding.stopPublishLiveStreamWithTaskId(e)}setEnableMediaExtensionMsg(e){var t;(t=this.bizControl)==null||t.setEnableMediaExtensionMsg(!!e)}sendMediaExtensionMsg(e,t){return z(this,null,function*(){return this.sendMediaExtensionMsgEx(e,t,5)})}sendMediaExtensionMsgEx(e,t,r){return z(this,null,function*(){var i;if(!this.publisher||!this.isPublishing)throw new ne(ce.ERR_INNER,"you should publish first");return this.slsReporter.reportSEIMessage(r,e.byteLength,t,0,!1),(i=this.publisher)==null?void 0:i.sendSEI(e,t,r)})}enablePlugin(e,t){this.bizControl.pluginManager.add(e,t)}removePlugin(e){this.bizControl.pluginManager.remove(e)}setPluginOption(e,t){const r=this.bizControl.pluginManager.get(e);r&&t&&r.setOptions(t)}getPluginOption(e){const t=this.bizControl.pluginManager.get(e);return t==null?void 0:t.getOptions()}isBeautyAvailable(){return this.bizControl.pluginManager.has("AliRtcBeauty")}isBeautyEnabled(){const e=this.bizControl.pluginManager.get("AliRtcBeauty");if(!e)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");return!!(e!=null&&e.isEnable)}setBeautyEffect(e,t){const r=this.bizControl.pluginManager.get("AliRtcBeauty");if(!r)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");e?r.enable():r.disable(),r.setOptions({basicBeauty:{skinBuffing:Math.max(Math.min(1,+t.smoothnessLevel),0),whitening:Math.max(Math.min(1,+t.whiteningLevel),0)}})}enableBackgroundExchange(e,t){const r=this.bizControl.pluginManager.get("AliRtcBeauty");if(!r||!r.isEnable)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const i={setSegmentBackgroundImage:{backgroundImgUrl:e?t:""}};e&&(i.segmentBackgroundProcess={enable:!1}),r.setOptions(i)}enableBackgroundBlur(e){const t=this.bizControl.pluginManager.get("AliRtcBeauty");if(!t||!t.isEnable)throw new ne(Pt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const r={segmentBackgroundProcess:{type:0,enable:e}};e&&(r.setSegmentBackgroundImage={type:0,backgroundImgUrl:""}),t.setOptions(r)}},A(fe,"logName","AliRtcEngine"),A(fe,"logError",!0),A(fe,"isSupported",Bc),A(fe,"isDualVideoStreamSupported",xs.isSupport),A(fe,"getCameraList",()=>z(fe,null,function*(){return(yield me.AliRTS.getCameraList()).filter(t=>t.deviceId)})),A(fe,"getMicrophoneList",()=>z(fe,null,function*(){return(yield me.AliRTS.getMicList()).filter(t=>t.deviceId)})),A(fe,"getSpeakerList",()=>z(fe,null,function*(){return(yield me.AliRTS.getSpeakerList()).filter(t=>t.deviceId)})),A(fe,"_instance"),A(fe,"AliRtcSdkChannelProfile",It),A(fe,"AliRtcSdkClientRole",Dt),A(fe,"AliRtcVideoStreamType",Je),A(fe,"AliRtcVideoTrack",Ae),A(fe,"AliRtcAudioTrack",ii),A(fe,"AliRtcPublishState",be),A(fe,"AliRtcSubscribeState",Le),A(fe,"AliRtcRawDataStreamType",Ke),A(fe,"AliRtcLogLevel",Qr),A(fe,"AliRtcEngineLocalDeviceType",wt),A(fe,"AliRtcEngineLocalDeviceExceptionType",Fe),A(fe,"AliRtcConnectionStatus",Te),A(fe,"AliRtcConnectionStatusChangeReason",Kt),A(fe,"AliRtcPlugin",ei),A(fe,"AliRtcPluginTrackType",Ti),A(fe,"AliRtcLiveTranscodingParam",Pi),A(fe,"AliRtcLiveTranscodingEncodeParam",ns),A(fe,"AliRtcLiveTranscodingMixParam",ba),A(fe,"AliRtcLiveTranscodingSingleParam",Sa),A(fe,"AliRtcTranscodingClockWidget",_a),A(fe,"AliRtcTranscodingImage",Ss),A(fe,"AliRtcTranscodingText",Aa),A(fe,"AliRtcTranscodingUser",Ea),A(fe,"AliRtcLiveTranscodingMixMode",hi),A(fe,"AliRtcLiveTranscodingStreamType",es),A(fe,"AliRtcLiveTranscodingSourceType",ti),A(fe,"AliRtcLiveTranscodingTaskProfile",ts),A(fe,"AliRtcLiveTranscodingAudioSampleRate",Di),A(fe,"AliRtcLiveTranscodingSegmentType",di),A(fe,"AliRtcLiveTranscodingFontType",fi),A(fe,"AliRtcLiveTranscodingCropMode",is),A(fe,"AliRtcLiveTranscodingMediaProcessMode",Bi),A(fe,"AliRtcLiveTranscodingState",rs),A(fe,"AliRtcLiveTranscodingErrorCode",Et),A(fe,"AliRtcTrascodingPublishTaskStatus",ss),A(fe,"Plugin",ei),fe);de([j()],le.prototype,"destroy",1),de([j()],le.prototype,"resetState",1),de([j(ae)],le.prototype,"stopPublish",1),de([j()],le.prototype,"backToUnpublishStatus",1),de([j()],le.prototype,"resumePublishForNetworkRecovery",1),de([j()],le.prototype,"onNetworkRecovery",1),de([j()],le.prototype,"resumeSubList",1),de([j(ae)],le.prototype,"setEnableDualVideoStream",1),de([j(ae)],le.prototype,"setChannelProfile",1),de([j(ae)],le.prototype,"setClientRole",1),de([j(ae)],le.prototype,"setAudioOnlyMode",1),de([j()],le.prototype,"clearCheckAuthInfoTimer",1),de([j(ae)],le.prototype,"joinChannel",1),de([j(ae)],le.prototype,"leaveChannel",1),de([j(ae)],le.prototype,"refreshAuthInfo",1),de([j(ae)],le.prototype,"publishLocalAudioStream",1),de([j(ae)],le.prototype,"setDefaultSubscribeAllRemoteAudioStreams",1),de([j(ae)],le.prototype,"subscribeAllRemoteAudioStreams",1),de([j(ae)],le.prototype,"subscribeRemoteAudioStream",1),de([j(ae)],le.prototype,"resumeRemoteAudioStream",1),de([j(ae)],le.prototype,"publishLocalVideoStream",1),de([j(ae)],le.prototype,"setRemoteDefaultVideoStreamType",1),de([j(ae)],le.prototype,"setRemoteUserVideoStreamType",1),de([j(ae)],le.prototype,"setDefaultSubscribeAllRemoteVideoStreams",1),de([j(ae)],le.prototype,"subscribeAllRemoteVideoStreams",1),de([j(ae)],le.prototype,"subscribeRemoteMediaStream",1),de([j(ae)],le.prototype,"resumeRemoteMediaStream",1),de([j(([s])=>[`${s==null?void 0:s.audio}`])],le.prototype,"startScreenShare",1),de([j()],le.prototype,"stopScreenShare",1),de([j(ae)],le.prototype,"setScreenShareConfiguration",1),de([j(ae)],le.prototype,"setScreenShareContentHint",1),de([j()],le.prototype,"publishLocalScreenShareStream",1),de([j(ae)],le.prototype,"setAudioShareVolume",1),de([j(ae)],le.prototype,"enableAudioVolumeIndication",1),de([j(ae)],le.prototype,"muteLocalMic",1),de([j(ae)],le.prototype,"muteRemoteAudioPlaying",1),de([j(ae)],le.prototype,"muteAllRemoteAudioPlaying",1),de([j(ae)],le.prototype,"startAudioCapture",1),de([j()],le.prototype,"stopAudioCapture",1),de([j(ae)],le.prototype,"switchMicrophone",1),de([j(ae)],le.prototype,"setRecordingVolume",1),de([j(ae)],le.prototype,"setPlayoutVolume",1),de([j(ae)],le.prototype,"setRemoteAudioVolume",1),de([j(ae)],le.prototype,"setAudioProfile",1),de([j(ae)],le.prototype,"getAudioTrack",1),de([j(ae)],le.prototype,"setLocalViewConfig",1),de([j(ae)],le.prototype,"setCameraCapturerConfiguration",1),de([j(ae)],le.prototype,"setCameraCapturerContentHint",1),de([j(ae)],le.prototype,"enableLocalVideo",1),de([j(ae)],le.prototype,"muteLocalCamera",1),de([j(ae)],le.prototype,"muteLocalScreen",1),de([j(ae)],le.prototype,"setRemoteViewConfig",1),de([j(ae)],le.prototype,"switchCamera",1),de([j()],le.prototype,"startPreview",1),de([j()],le.prototype,"startPreviewScreen",1),de([j()],le.prototype,"stopPreview",1),de([j()],le.prototype,"stopPreviewScreen",1),de([j()],le.prototype,"startPublishLiveStream",1),de([j()],le.prototype,"updatePublishLiveStream",1),de([j()],le.prototype,"updatePublishLiveStreamWithTaskId",1),de([j()],le.prototype,"stopPublishLiveStream",1),de([j()],le.prototype,"stopPublishLiveStreamWithTaskId",1),de([j(ae)],le.prototype,"setEnableMediaExtensionMsg",1),de([j(([s,c,e])=>[s.byteLength,c,e])],le.prototype,"sendMediaExtensionMsgEx",1),de([j(([s,c])=>[s.name||"",c])],le.prototype,"enablePlugin",1),de([j(ae)],le.prototype,"removePlugin",1),de([j(ae)],le.prototype,"setPluginOption",1),de([j(ae)],le.prototype,"getPluginOption",1),de([j(ae)],le.prototype,"setBeautyEffect",1),de([j(ae)],le.prototype,"enableBackgroundExchange",1),de([j(ae)],le.prototype,"enableBackgroundBlur",1),de([j(ae)],le,"setLogLevel",1);let wa=le;const Ca=new tr({businessName:"imp-web-rtc",version:(Ia=wa.getSdkVersion())!=null?Ia:"unknown",env:"prod"});Ca.setReady();const P0=Ca.wrap(wa);he.AliRtcConnectionStatus=Te,he.AliRtcConnectionStatusChangeReason=Kt,he.AliRtcEngineLocalDeviceExceptionType=Fe,he.AliRtcEngineLocalDeviceType=wt,he.AliRtcErrorCode=ce,he.AliRtcLiveTranscodingAudioSampleRate=Di,he.AliRtcLiveTranscodingCropMode=is,he.AliRtcLiveTranscodingEncodeParam=ns,he.AliRtcLiveTranscodingErrorCode=Et,he.AliRtcLiveTranscodingFontType=fi,he.AliRtcLiveTranscodingMediaProcessMode=Bi,he.AliRtcLiveTranscodingMixMode=hi,he.AliRtcLiveTranscodingMixParam=ba,he.AliRtcLiveTranscodingParam=Pi,he.AliRtcLiveTranscodingSegmentType=di,he.AliRtcLiveTranscodingSingleParam=Sa,he.AliRtcLiveTranscodingSourceType=ti,he.AliRtcLiveTranscodingState=rs,he.AliRtcLiveTranscodingStreamType=es,he.AliRtcLiveTranscodingTaskProfile=ts,he.AliRtcLocalStreamInfo=ms,he.AliRtcLogLevel=Qr,he.AliRtcPlugin=ei,he.AliRtcPluginTrackType=Ti,he.AliRtcPluginType=ta,he.AliRtcPublishState=be,he.AliRtcRawDataStreamType=Ke,he.AliRtcRemoteUserInfo=pa,he.AliRtcSdkChannelProfile=It,he.AliRtcSdkClientRole=Dt,he.AliRtcSubscribeState=Le,he.AliRtcTranscodingClockWidget=_a,he.AliRtcTranscodingImage=Ss,he.AliRtcTranscodingText=Aa,he.AliRtcTranscodingUser=Ea,he.AliRtcTrascodingPublishTaskStatus=ss,he.AliRtcVideoStreamType=Je,he.AliRtcVideoTrack=Ae,he.default=P0,Object.defineProperties(he,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|