aliyun-rtc-sdk 6.11.6-beta.1 → 6.11.7-beta.0
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 +8 -7
- package/dist/plugins/beautyPlugin.js +1 -1
- package/dist/types/index.d.ts +550 -553
- package/package.json +7 -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 Oh=Object.defineProperty,Vh=Object.defineProperties;var Uh=Object.getOwnPropertyDescriptors;var Kr=Object.getOwnPropertySymbols,Hh=Object.getPrototypeOf,Sc=Object.prototype.hasOwnProperty,_c=Object.prototype.propertyIsEnumerable,zh=Reflect.get;var On=(fe,ye,we)=>ye in fe?Oh(fe,ye,{enumerable:!0,configurable:!0,writable:!0,value:we}):fe[ye]=we,Ce=(fe,ye)=>{for(var we in ye||(ye={}))Sc.call(ye,we)&&On(fe,we,ye[we]);if(Kr)for(var we of Kr(ye))_c.call(ye,we)&&On(fe,we,ye[we]);return fe},Yt=(fe,ye)=>Vh(fe,Uh(ye));var $r=(fe,ye)=>{var we={};for(var et in fe)Sc.call(fe,et)&&ye.indexOf(et)<0&&(we[et]=fe[et]);if(fe!=null&&Kr)for(var et of Kr(fe))ye.indexOf(et)<0&&_c.call(fe,et)&&(we[et]=fe[et]);return we};var A=(fe,ye,we)=>(On(fe,typeof ye!="symbol"?ye+"":ye,we),we);var Vn=(fe,ye,we)=>zh(Hh(fe),we,ye);var H=(fe,ye,we)=>new Promise((et,Qt)=>{var bt=tt=>{try{lt(we.next(tt))}catch(Rt){Qt(Rt)}},It=tt=>{try{lt(we.throw(tt))}catch(Rt){Qt(Rt)}},lt=tt=>tt.done?et(tt.value):Promise.resolve(tt.value).then(bt,It);lt((we=we.apply(fe,ye)).next())}),qr=function(fe,ye){this[0]=fe,this[1]=ye},yc=(fe,ye,we)=>{var et=(It,lt,tt,Rt)=>{try{var Ze=we[It](lt),Ii=(lt=Ze.value)instanceof qr,ji=Ze.done;Promise.resolve(Ii?lt[0]:lt).then(kt=>Ii?et(It==="return"?It:"next",lt[1]?{done:kt.done,value:kt.value}:kt,tt,Rt):tt({value:kt,done:ji})).catch(kt=>et("throw",kt,tt,Rt))}catch(kt){Rt(kt)}},Qt=It=>bt[It]=lt=>new Promise((tt,Rt)=>et(It,lt,tt,Rt)),bt={};return we=we.apply(fe,ye),bt[Symbol.asyncIterator]=()=>bt,Qt("next"),Qt("throw"),Qt("return"),bt};(function(fe,ye){typeof exports=="object"&&typeof module!="undefined"?ye(exports,require("aliyun-rts-sdk"),require("eventemitter3")):typeof define=="function"&&define.amd?define(["exports","aliyun-rts-sdk","eventemitter3"],ye):(fe=typeof globalThis!="undefined"?globalThis:fe||self,ye(fe.AliRtcEngine={},fe.AliyunRts,fe.EventEmitter))})(this,function(fe,ye,we){var uc,hc,lc,dc,fc,pc,pt,ci,Ft,Ui,xe,mc;"use strict";var et=Object.defineProperty,Qt=(s,c,e)=>c in s?et(s,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[c]=e,bt=(s,c,e)=>(Qt(s,typeof c!="symbol"?c+"":c,e),e),It={exports:{}},lt={exports:{}},tt,Rt;function Ze(){if(Rt)return tt;Rt=1,Date.now=Date.now||function(){return new Date().getTime()};var s=Date.now(),c=function(){},e=function(){var i=typeof console=="object"?console.warn:c;try{var r={warn:i};r.warn.call(r)}catch(n){return c}return i},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(i){if(Object.create)return Object.create(i);var r=function(){};return r.prototype=i,new r},each:function(i,r){var n=0,o=i.length;if(this.T(i,"Array"))for(;n<o&&r.call(i[n],i[n],n)!==!1;n++);else for(n in i)if(r.call(i[n],i[n],n)===!1)break;return i},safetyCall:function(i,r,n){if(typeof i!="function")return n;try{return i.apply(this,r)}catch(o){return n}},T:function(i,r){var n=Object.prototype.toString.call(i).substring(8).replace("]","");return r?n===r:n},duration:function(){var i=Date;try{performance&&this.T(performance.now,"Function")&&(i=performance)}catch(n){i=Date}var r=i.now();return function(){return Math.round(i.now()-r)}},filterByRule:function(){var i=[].slice.call(arguments),r=i.length;if(r<2)return i[0];var n=i[r-1],o=i[0];if(!o)return"";if(!n)return o;var a=this,u=a.T(n),h=i.slice(0,r-1);return u==="Function"?a.safetyCall(n,h,o):u==="Array"?(this.each(n,function(g){h[0]=o=a.filterByRule.apply(a,[].concat(h,g))}),o):u==="Object"?o.replace(n.rule,n.target||""):o.replace(n,"")},ignoreByRule:function(i,r){if(!i||!r)return!1;if((this.isString(r)||r.source||this.T(r)==="Function")&&(r=[r]),!this.isArray(r))return this.warn("[arms] invalid rules of ignore config, (list of) String/RegExp/Funcitons are available"),!1;for(var n,o=[],a=0,u=r.length;a<u;a++)if(n=r[a],this.isString(n))o.push(n.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"));else if(n&&n.source)o.push(n.source);else if(n&&this.T(n)==="Function"&&this.safetyCall(n,[i],!1)===!0)return!0;var h=new RegExp(o.join("|"),"i");return!!(o.length&&h.test&&h.test(i))},J:function(i){if(!i||typeof i!="string")return i;var r=null;try{r=JSON.parse(i)}catch(n){}return r},pick:function(i){return i===1||Math.ceil(Math.random()*i)===1},verifyConfig:function(i){if("sample"in i){var r=i.sample,n=r;r&&/^\d+(\.\d+)?%$/.test(r)&&(n=parseInt(100/parseFloat(r))),0<n&&1>n&&(n=parseInt(1/n)),n>=1&&n<=100?i.sample=n:delete i.sample}return i},on:function(i,r,n,o,a){return i.addEventListener?(a=a||!1,i.addEventListener(r,function u(h){o&&i.removeEventListener(r,u,a),n.call(this,h)},a)):i.attachEvent&&i.attachEvent("on"+r,function u(h){o&&i.detachEvent("on"+r,u),n.call(this,h)}),this},off:function(i,r,n){return n?(i.removeEventListener?i.removeEventListener(r,n):i.detachEvent&&i.detachEvent(r,n),this):this},delay:function(i,r){return r===-1?(i(),null):setTimeout(i,r||0)},ext:function(i){for(var r=1,n=arguments.length;r<n;r++){var o=arguments[r];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(i[a]=o[a])}return i},sub:function(i,r){var n={};return this.each(i,function(o,a){r.indexOf(a)!==-1&&(n[a]=o)}),n},uu:function(){for(var i,r,n=20,o=new Array(n),a=Date.now().toString(36).split("");n-- >0;)r=(i=36*Math.random()|0).toString(36),o[n]=i%3?r:r.toUpperCase();for(var u=0;u<8;u++)o.splice(3*u+2,0,a[u]);return o.join("")},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var r=16*Math.random()|0;return(i==="x"?r:3&r|8).toString(16)})},seq:function(){return(s++).toString(36)},decode:function(i){try{i=decodeURIComponent(i)}catch(r){}return i},encode:function(i,r){try{i=r?encodeURIComponent(i).replace(/\(/g,"%28").replace(/\)/g,"%29"):encodeURIComponent(i)}catch(n){}return i},serialize:function(i){i=i||{};var r=[];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&i[n]!==void 0&&r.push(n+"="+this.encode(i[n],n==="msg"));return r.join("&")},checkAPI:function(i,r){if(!i||typeof i!="string")return!1;var n=/arms-retcode[\w-]*\.aliyuncs/.test(i);return!n&&r&&(n=/(alicdn\.com)|(mmstat\.com)/.test(i)),!n},checkAutoError:function(i){return!(!i||!i.message)&&!/failed[\w\s]+fetch/i.test(i.message)},cutUrlSearch:function(i){return i&&typeof i=="string"?i.replace(/^(https?:)?\/\//,"").replace(/\?.*$/,""):""},removeUrlSearch:function(i){return i&&typeof i=="string"?i.replace(/\?.*$/,""):""},createFakeToString:function(i){return function(){return i+"() { [native code] }"}},checkSameOrigin:function(i,r){if(!r||!i)return!1;var n="//"+r.split("/")[2];return i===r||i.slice(0,r.length+1)===r+"/"||i===n||i.slice(0,n.length+1)===n+"/"||!/^(\/\/|http:|https:).*/.test(i)},getRandIP:function(){for(var i=[],r=0;r<4;r++){var n=Math.floor(256*Math.random());i[r]=(n>15?"":"0")+n.toString(16)}return i.join("").replace(/^0/,"1")},getSortNum:function(i){return i?(i+=1)>=1e3&&i<=9999?i:i<1e3?i+1e3:i%1e4+1e3:1e3},getRandNum:function(i){return i&&typeof i=="string"?i.length<5?this.getNum(5):i.substring(i.length-5):this.getNum(5)},getNum:function(i){for(var r=[],n=0;n<i;n++){var o=Math.floor(16*Math.random());r[n]=o.toString(16)}return r.join("")},getCurDomain:function(){return location&&location.hostname||""},getSrcType:function(i,r){var n=location&&location.host||"";if(!n)return"";var o=new URL(i).host;if(o===n)return"self";for(var a=0;a<r.length;a+=1)if(o.includes(r[a]))return"cdn";return"others"},parseFetchHeaders:function(i){if(!i)return{};var r={};try{if(typeof i.keys=="function")for(var n=i.keys(),o=n.next();!o.done;){var a=o.value;r[a]=i.get(a),o=n.next()}else r=i}catch(u){r={}}return r},parseXhrHeaders:function(i){if(!i&&typeof i!="string")return{};var r={};try{var n=i.split(`\r
|
|
2
|
+
`);r=n.reduce(function(o,a){var u=a.split(": ");return o[u[0]]=u[1],o},{})}catch(o){r={}}return r},getQuerys:function(i){if(!i)return"";var r={},n=[],o="",a="";try{var u=[];if(i.indexOf("?")>=0&&(u=i.substring(i.indexOf("?")+1,i.length).split("&")),u.length>0)for(var h in u)o=(n=u[h].split("="))[0],a=n[1],r[o]=a}catch(g){r={}}return r},getURL:function(i){if(!i)return null;var r={},n=i.length,o=i.indexOf("://");if(o<0)return null;r.protocol=i.substring(0,o+1);var a=i.indexOf("#"),u=i.indexOf("?");a<0&&(a=n),u<0&&(u=a),r.search=i.substring(u,a).substring(0,1e3);var h=i.substring(o+3,u),g=h.indexOf("/");return g<0&&(g=h.length),r.domain=h.substring(0,g).split(":")[0],r.path=h.substring(g,h.length).substring(0,1e3),r},getResType:function(i,r){if(["script","img","other"].indexOf(i)>-1)return i;if(["video"].indexOf(i)>-1)return"media";if(["document","iframe"].indexOf(i)>-1)return"doc";var n=r?this.getURL(r):null,o=n&&n.path?n.path.lastIndexOf("."):-1,a=(o>0?n.path.substr(o+1):"").toLowerCase();if(a){if(["eot","woff","woff2","ttf"].indexOf(a)>-1)return"font";if(a==="css")return"css";if(a==="js")return"script"}return["fetch","xmlhttprequest","beacon"].indexOf(i)>-1?"api":"others"},areInOrder:function(){for(var i=1;i<arguments.length;i+=1)if(arguments[i-1]>arguments[i])return!1;return!0},getFetchSnapshot:function(i,r,n){var o,a;try{var u=(i&&typeof i[0]!="string"?i[0].url:i[0])||"",h=(i&&typeof i[0]!="string"?i[0]:i[1])||{},g=h.method.toUpperCase()==="POST"?h.body:this.getQuerys(u);o={originApi:u,method:h.method||"unknown",params:g,response:r||"",reqHeaders:this.parseFetchHeaders(h.headers||null),resHeaders:this.parseFetchHeaders(n)},a=JSON&&JSON.stringify(o)||"{}"}catch(f){a="{}"}return a},getXhrSnapshot:function(i,r,n){if(!i||!r||!n)return{};var o,a;try{var u="";n.responseType===""||n.responseType==="text"?u=n.responseText:n.responseType==="document"&&(u=n.responseXML),o={originApi:i,method:r,params:this.getQuerys(i),response:u,reqHeaders:{},resHeaders:this.parseXhrHeaders(typeof n.getAllResponseHeaders=="function"&&n.getAllResponseHeaders()||"")},a=JSON&&JSON.stringify(o)||"{}"}catch(h){a="{}"}return a},isRobot:function(){var i=["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 r=navigator.userAgent.toLowerCase(),n=0;n<i.length;n++){var o=i[n];if(r.lastIndexOf(o)>=0)return!0}}catch(a){this.warn("[arms] useragent parse error")}return!1},isFunction:function(i){return typeof i=="function"},isPlainObject:function(i){return Object.prototype.toString.call(i)==="[object Object]"},isString:function(i){return Object.prototype.toString.call(i)==="[object String]"},isArray:function(i){return Object.prototype.toString.call(i)==="[object Array]"},joinRegExp:function(i){for(var r,n=[],o=0,a=i.length;o<a;o++)r=i[o],this.isString(r)?n.push(r.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):r&&r.source&&n.push(r.source);return new RegExp(n.join("|"),"i")},reWriteMethod:function(i,r,n){if(i!==null){var o=i[r];i[r]=n(o)}},checkSDKError:function(i,r){return!i&&!r?!1:new RegExp(this.selfErrKey,"i").test(i)?!0:!!this.ignoreByRule(r,[/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(i){return{msg:i,message:this.selfErrKey}},dealParam:function(i,r,n){var o={};try{o=this.isPlainObject(i)?this.ext({key:i.key||"default",val:i.val||i.value||n},i,{begin:Date.now()}):{key:i||"default",val:r||n,begin:Date.now()}}catch(a){this.warn("[retcode] baseLog error: "+a)}return o}};return tt=t,tt}var Ii={exports:{}},ji={exports:{}},kt,Un;function wc(){if(Un)return kt;Un=1;var s=Ze();return kt=function(c,e,t){typeof c=="object"&&(c=s.serialize(c));var i=e+c+(t?"&post_res=":"");window&&window.navigator&&typeof window.navigator.sendBeacon=="function"?window.navigator.sendBeacon(i,t||"&post_res="):s.warn("[arms] navigator.sendBeacon not surported")},kt}var Hn;function Ac(){if(Hn)return ji.exports;Hn=1;var s=Ze(),c=wc(),e="aokcdqn3ly@e629dabd48a9933",t=function(r,n){var o;if(n.t==="error"&&(o=r.requestQueue[0])&&o.t==="error"&&n.msg===o.msg)return n.times=o.times+1,void(r.requestQueue[0]=n);if(n.t==="behavior"){var a=r.requestQueue&&r.requestQueue.length;if(a>0&&r.requestQueue[a-1].t==="behavior"){var u=n.behavior||[];r.requestQueue[a-1].behavior.concat(u)}else r.requestQueue.push(n)}else r.requestQueue.unshift(n);return r.onReady(function(){r.requestTimmer=s.delay(function(){r.clear()},r.requestQueue[0]&&r.requestQueue[0].t==="error"?3e3:-1)}),!0},i=function(r){return this.ver="1.8.36-beta.12",this._conf=s.ext({},i.dftCon),this.sampleCache={},this.requestQueue=[],this.selfQueue=[],this.sdkFlag=!0,this.hash=s.seq(),this.resetPageview(),this.setConfig(r),this.rip=s.getRandIP(),this.record=999,this["EagleEye-TraceID"]=this.getTraceId()["EagleEye-TraceID"],this._common={},this};return i.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},i.prototype={constructor:i,onReady:function(r){return r()},getPage:function(){var r=this._conf.page;return s.safetyCall(r,[],r+"")},setPage:function(){},setConfig:function(r){r&&typeof r=="object"&&(s.verifyConfig(r),r=this.setImgUrl(r),this._conf=s.ext({},this._conf,r))},setImgUrl:function(r){var n=r.region,o=r.imgUrl;if(n){var a=s.regionMap[n];return r.imgUrl=a||s.defaultImgUrl,r}return o&&(r.imgUrl=o),r},checkImgUrl:function(){return!0},sendRequest:function(){},sendBeacon:function(r,n,o){c(r,n||this.getConfig("imgUrl"),o)},postData:function(){},commonInfo:function(){return{}},setCommonInfo:function(r){r&&typeof r=="object"&&(this._common=s.ext({},this._common,r))},resetPageview:function(){this.pageview=s.uu(),this.sBegin=Date.now()},getUsername:function(){if(this.username)return this.username;var r=this._conf,n=r&&r.setUsername;if(typeof n=="function")try{var o=n();typeof o=="string"&&(o=o.substr(0,40),this.username=o)}catch(a){s.warn("[arms] setUsername fail",a)}return this.username},getTraceId:function(){var r=this.rip,n=Date.now(),o=s.getSortNum(this.record),a=r+n+o+s.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=a,this.record=o,{"EagleEye-TraceID":a}},getUberTraceId:function(r){var n=this.rip,o=Date.now(),a=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+o+a+s.getNum(2)+u,g=h.substring(0,16);return r=r?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{"uber-trace-id":h+":"+g+":0:"+r,traceId:h}},getB3TraceId:function(r){var n=this.rip,o=Date.now(),a=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+o+a+s.getNum(2)+u,g=h.substring(0,16);return r=r?"1":"0",h[0]==="0"&&(h[0]="1"),h[16]==="0"&&(h[16]="1"),{b3:h+"-"+g+"-"+r+"-0","X-B3-TraceId":h,"X-B3-ParentSpanId":"0","X-B3-SpanId":g,"X-B3-Sampled":r}},getPageviewId:function(){return{"EagleEye-SessionID":this.pageview}},getConfig:function(r){return r?this._conf[r]:s.ext({},this._conf)},sampling:function(r){return r===1||(typeof this.sampleCache[r]=="boolean"?this.sampleCache[r]:(this.sampleCache[r]=s.pick(r),this.sampleCache[r]))},clear:function(r){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 a=JSON.stringify({resource:n.resource});delete n.resource,this.sendBeacon(n,null,a)}else n.t==="resource"?this.postData(n,"resource"):this.sendRequest(n);return r&&this.clearSelf(),this},clearSelf:function(){var r;for(clearTimeout(this.Timmer),this.Timmer=null;r=this.selfQueue.pop();)this.postData(r,"err");return this},_lg:function(r,n,o,a){var u=this,h=u._conf,g=u.getPage(),f=h.ignore||{},d=f.ignoreErrors,p=f.ignoreResErrors,l=f.ignoreUrls,m=f.ignoreApis;if(u._isRobot||s.ignoreByRule(g,l)||s.ignoreByRule(s.decode(g),l)||r==="error"&&(s.ignoreByRule(n.msg,d)||s.ignoreByRule(s.decode(n.msg),d))||r==="resourceError"&&(s.ignoreByRule(n.src,p)||s.ignoreByRule(s.decode(n.src),p))||r==="api"&&(s.ignoreByRule(n.api,m)||s.ignoreByRule(s.decode(n.api),m))||!u.checkImgUrl(h.imgUrl)||!n||h.disabled||!h.pid||a===0)return u;var x=n.dl;if(delete n.dl,n=s.ext({t:r,times:1,page:g,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:x,z:s.seq()}),s.T(h.beforeReport)==="Function")try{if(!(n=h.beforeReport(n)))return u}catch(v){return u}return a===1?t(u,n):o&&!u.sampling(o)?u:t(u,n)},_self:function(r,n,o){var a=this,u=a._conf;if(r!=="error"||!a.checkImgUrl(u.imgUrl)||!n||u.disabled||!u.pid||!e||o&&!a.sampling(o))return a;n=s.ext({t:r,times:1,page:s.selfErrPage,tag:u.pid,begin:Date.now()},n,{pid:e,_v:a.ver,sampling:o||1,z:s.seq()});var h=a.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(g){}}else a.selfQueue.unshift(n),a.onReady(function(){a.sdkFlag&&(a.sdkFlag=!1,a.Timmer=s.delay(function(){a.clearSelf()},1e4))})},custom:function(r,n){if(!r||typeof r!="object")return this;var o=!1,a={begin:Date.now()};return s.each(r,function(u,h){return!(o=h&&h.length<=20)&&s.warn("[retcode] invalid key: "+h),a["x-"+h]=u,o}),o?this._lg("custom",a,n||1):this}},ji.exports=i,ji.exports}var zn;function Ec(){if(zn)return Ii.exports;zn=1;var s=Ze(),c=Ac(),e=["api","success","time","code","msg","trace","traceId","begin","pv_id","sid","seq","domain","flag","apiSnapshot","tag","c1","c2","c3"],t=function(r){var n=(r.key||"default").split("::");return n.length>1?s.ext(r,{group:n[0],key:n[1]}):s.ext(r,{group:"default_group",key:n[0]})},i=function(r){c.call(this,r);var n;try{n=typeof performance=="object"?performance.timing.fetchStart:Date.now()}catch(o){n=Date.now()}return this._startTime=n,this};return i.prototype=s.createObject(c.prototype),s.ext(c.dftCon,{startTime:null}),s.ext(i.prototype,{constructor:i,_super:c,sum:function(r,n,o){try{var a=s.dealParam(r,n,1);return this._lg("sum",t(a),o)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},avg:function(r,n,o){try{var a=s.dealParam(r,n,0);return this._lg("avg",t(a),o)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},percent:function(r,n,o,a){try{return this._lg("percent",t({key:r,subkey:n,val:o||0,begin:Date.now()}),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},msg:function(r,n){if(r&&!(r.length>180))return this.custom({msg:r},n)},error:function(r,n){if(!r)return s.warn("[retcode] invalid param e: "+r),this;arguments.length===1?(typeof r=="string"&&(r={message:r},n={}),typeof r=="object"&&(n=r=r.error||r)):(typeof r=="string"&&(r={message:r}),typeof n!="object"&&(n={}));var o=r.name||"CustomError",a=r.message||"",u=r.stack||"";n=n||{};var h=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"";if(s.checkSDKError(a,n.filename)){var g=/^Script error\.?$/,f=r.msg||r.message;if(s.ignoreByRule(f,g)||s.ignoreByRule(s.decode(f),g))return this;var d={msg:s.selfErrKey,err:{msg_raw:s.encode(r.msg||r.message)}};return this._self("error",d,1)}for(var p={begin:Date.now(),cate:o,msg:a&&a.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(a),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 v=(this.getConfig("ignore")||{}).ignoreErrors;return s.ignoreByRule(p.msg,v)||s.ignoreByRule(s.decode(p.msg),v)?this:(this.beforeSend&&this.beforeSend("error",p),this._lg("error",p,1))},behavior:function(r){if(r){var n=typeof r=="object"&&r.behavior?r:{behavior:r};return this.beforeSend&&this.beforeSend("behavior",n),this._lg("behavior",n,1)}},api:function(r,n,o,a,u,h,g,f,d,p,l,m,x,v,b,w){if(!r)return s.warn("[retcode] api is null"),this;if(r=typeof r=="string"?{api:r,success:n,time:o,code:a,msg:u,begin:h,traceId:g,pv_id:f,apiSnapshot:d,domain:p,flag:m,tag:x,c1:v,c2:b,c3:w}:s.sub(r,e),!s.checkAPI(r.api,!0))return this;r.code=r.code||"";var _=r.msg||"";if(_=typeof _=="string"?_.substring(0,1e3):_,r.msg=_,r.success=r.success?1:0,r.time=+r.time,r.begin=r.begin,r.traceId=r.traceId||"",r.pv_id=r.pv_id||"",r.domain=r.domain||"",r.flag=r.flag,r.dl=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"",r.apiSnapshot&&(typeof r.apiSnapshot=="object"&&(r.apiSnapshot=JSON.stringify(r.apiSnapshot)),typeof r.apiSnapshot!="string"&&delete r.apiSnapshot,r.apiSnapshot.length>2e3&&(r.apiSnapshot=r.apiSnapshot.substring(0,2e3))),l&&(r.traceOrigin=l),!r.api||isNaN(r.time))return s.warn("[retcode] invalid time or api"),this;var C=(this.getConfig("ignore")||{}).ignoreApis;return s.ignoreByRule(r.api,C)||s.ignoreByRule(s.decode(r.api),C)?this:r.time<0?this:(this.beforeSend&&this.beforeSend("api",r),this._lg("api",r,r.success&&this.getConfig("sample"),r.flag))},speed:function(r,n,o){var a=this,u=this.getConfig("startTime")||this._startTime;return/^s(\d|1[0])$/.test(r)?(n=typeof n!="number"?Date.now()-u:n>=u?n-u:n,a.speedCache=a.speedCache||{},a.speedCache[r]=n,a.speedCache.begin=u,clearTimeout(a.speedTimmer),a.speedTimmer=setTimeout(function(){o||(a.speedCache.page=a.getPage(!0)),a._lg("speed",a.speedCache),a.speedCache=null},5e3),a):(s.warn("[retcode] invalid point: "+r),a)},performance:function(r){if(r&&typeof r=="object"&&!this.hasSendPerf){var n={},o={},a=this.getConfig("autoSendPerf");if(r.autoSend&&a)return o=s.ext(this.perfData||{},r),this.hasSendPerf=!0,this._lg("perf",o,this.getConfig("sample"));if(r.autoSend&&!a)return delete r.autoSend,this.perfData?(o=s.ext(this.perfData||{},r),this.hasSendPerf=!0,this._lg("perf",o,this.getConfig("sample"))):void(this.perfData=r);for(var u in r)(/^t([1-9]|1[0])$/.test(u)||u==="ctti"||u==="cfpt")&&(n[u]=r[u]);if(r.autoSend===!0||!a&&(a||this.perfData))return r.autoSend!==!0&&a===!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(r,n){if(!r||!s.isPlainObject(r))return s.warn("[arms] invalid param data: "+r),this;var o=Object.keys(r),a=["begin","dom","load","res","dl"],u=!1;for(var h in a)if(o.indexOf(a[h])<0){u=!0;break}if(u)return s.warn("[arms] lack param data: "+r),this;var g={begin:r.begin||Date.now(),dom:r.dom||"",load:r.load||"",res:s.isArray(r.res)?JSON.stringify(r.res):JSON.stringify([]),dl:r.dl||""};return this._lg("res",g,n)},event:function(r,n){if(typeof r=="object"&&r&&r.key){var o={},a=["key","success","time","c1","c2","c3"];for(var u in r)a.indexOf(u)>-1&&(o[u]=r[u]);o.success=r.success===!1?0:1,this._lg("event",o,n)}}}),i._super=c,i._root=c,c.Reporter=i,Ii.exports=i,Ii.exports}var Gr={exports:{}},jn;function Cc(){if(jn)return Gr.exports;jn=1;var s=Ze(),c=typeof window=="object"?window:{},e="catch",t=c.__oFetch_||c.fetch;return t=typeof t=="function"?t:void 0,Gr.exports=function(i,r){var n=-1;typeof i=="object"&&(n=i.z,i=s.serialize(i));var o=r+i;if(t)return t(o,{method:"HEAD",mode:"no-cors"})[e](s.noop);if(c.document&&c.document.createElement){var a="__request_hold_"+n,u=c[a]=new Image;u.onload=u.onerror=function(){c[a]=void 0},u.src=o,u=null}},Gr.exports}var Jr={exports:{}},Wn;function Ic(){if(Wn)return Jr.exports;Wn=1;var s=Ze(),c=typeof window=="object"?window:{},e=c.__oXMLHttpRequest_||c.XMLHttpRequest;return e=typeof e=="function"?e:void 0,Jr.exports=function(t,i){try{var r=new e;r.open("POST",i,!0),r.setRequestHeader("Content-Type","text/plain"),r.send(JSON.stringify(t))}catch(n){s.warn(`[retcode] Failed to log, exception is :
|
|
3
|
+
`+n)}},Jr.exports}var Xr,Kn;function Rc(){if(Kn)return Xr;Kn=1;var s=Ze();return Xr=function(c,e){var t=[],i=null,r=e&&e.location&&e.location.href,n=void 0,o=null,a=function(f,d,p){if(f!==null){var l=f[d];f[d]=p(l)}},u=function(f){var d,p,l,m,x,v=[];if(!f||typeof f.tagName!="string")return"";if(v.push(f.tagName.toLowerCase()),typeof f.id=="string"&&v.push("#".concat(f.id)),typeof(d=f.className)=="string")for(p=d.split(/\s+/),x=0;x<p.length;x++)v.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"&&v.push("[".concat(l,'="').concat(m,'"]'));return v.join("")},h=function(f,d){return function(p){if(p&&p!==o){o=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 v=x||null,b=[],w=0,_=0,C=3,E="";v&&w++<5&&!((E=u(v))==="html"||w>1&&_+b.length*C+E.length>=80);)b.push(E),_+=E.length,v=v.parentNode;return b.reverse().join(" > ")}(l)},timestamp:Date.now()};f==="click"?i&&i.addBehavior(m):f==="keypress"&&(n||i&&i.addBehavior(m),clearTimeout(n),n=setTimeout(function(){n=void 0},100))}}}},g=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}};i&&i.addBehavior(x),r=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 v=e.location.href;if(f(r,v),d)return d.apply(this,m)};var p=function(l){return function(){for(var m=arguments.length,x=new Array(m),v=0;v<m;v++)x[v]=arguments[v];var b=x.length>2?x[2]:void 0;return b&&f(r,String(b)),l.apply(this,x)}};a(e.history,"pushState",p),a(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&&!i){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}};r=p,i&&i.addBehavior(l)}}})(),e&&e.document&&e.document.addEventListener&&(e.document.addEventListener("click",h("click"),!1),e.document.addEventListener("keypress",h("keypress"),!1)),g();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"&&a(e.console,m,function(x){var v=m;return function(){for(var b=arguments.length,w=new Array(b),_=0;_<b;_++)w[_]=arguments[_];var C={type:"console",data:{level:v,message:w}};if(i&&i.addBehavior(C),v==="error")for(var E=0;E<w.length;E++){var I=w[E];I&&I.message&&I.stack&&i&&i.errorHandler(new ErrorEvent("error",{error:I,message:I.message}))}x&&Function.prototype.apply.call(x,e.console,w)}})}}}(f)}catch(d){s.warn("[arms] error in initBehavior",d)}i=this,this.hasInitBehavior=!0}return this}})},Xr}var $n={},qn;function Zr(){return qn||(qn=1,$n.TIMING_KEYS=["startTime","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","","domInteractive","","domContentLoadedEventEnd","","loadEventStart","","msFirstPaint","secureConnectionStart","redirectStart","redirectEnd"]),$n}var Yr,Gn;function kc(){if(Gn)return Yr;Gn=1;var s=Ze(),c=Zr(),e=c.TIMING_KEYS;return Yr=function(){var t=s.win||{},i=t.performance;if(!i||typeof i!="object"||typeof i.getEntriesByType!="function")return null;var r={},n=i.timing||{},o=i.getEntriesByType("resource")||[];if(r.begin=n[e[1]]||Date.now(),typeof t.PerformanceNavigationTiming=="function"){var a=i.getEntriesByType("navigation")[0];a&&(n=a)}return s.each({dom:[10,8],load:[14,1]},function(u,h){var g=n[e[u[1]]],f=n[e[u[0]]];if(g>0&&f>0){var d=Math.round(f-g);d>=0&&d<6e5&&(r[h]=d)}}),r.res=JSON.stringify(o),r},Yr}var Qr,Jn;function Tc(){if(Jn)return Qr;Jn=1;var s=Ze(),c=Zr(),e=c.TIMING_KEYS;return Qr=function(){var t=s.win||{},i=t.performance;if(!i||typeof i!="object")return null;var r={},n=i.timing||{},o=Date.now(),a=1;if(typeof t.PerformanceNavigationTiming=="function"){var u=i.getEntriesByType("navigation")[0];u&&(n=u,a=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(a===2||m>0&&x>0){var v=Math.round(x-m);v>=0&&v<6e5&&(r[l]=v)}});var h=t.navigator.connection,g=i.navigation||{};r.ct=h?h.effectiveType||h.type:"";var f=h&&(h.downlink||h.downlinkMax||h.bandwidth)||null;if((f=f>999?999:f)&&(r.bandwidth=f),r.navtype=g.type===1?"Reload":"Other",a===1&&n[e[16]]>0&&n[e[1]]>0){var d=n[e[16]]-n[e[1]];d>=0&&d<36e5&&(r.fpt=d)}return a===1&&n[e[1]]>0?r.begin=n[e[1]]:a===2&&r.load>0?r.begin=o-r.load:r.begin=o,r},Qr}var Xn,Zn;function Dc(){return Zn||(Zn=1,Xn=function(s,c,e){var t=Ze(),i=kc(),r=Tc(),n=null,o=e.documentElement,a=c.innerWidth||o.clientWidth||e.body.clientWidth,u=c.innerHeight||o.clientHeight||e.body.clientHeight,h=c.navigator.connection,g={sr:screen.width+"x"+screen.height,vp:a+"x"+u,ct:h?h.effectiveType||h.type:""},f={},d=function(l,m,x,v,b){if(m===void 0){var w,_;if(!f[l]){w=new RegExp(l+"=([^;]+)");try{_=w.exec(e.cookie)}catch(E){return t.warn("[retcode] can not get cookie:",E),null}_&&(f[l]=_[1])}return f[l]}var C=l+"="+m;C+="; path=/",x&&(C+="; max-age="+x);try{return e.cookie=C,!!e.cookie}catch(E){return t.warn("[retcode] can not set cookie: ",E),!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(v){}return this},resourceErrorHandler:function(l){var m=this,x=l.target||l.srcElement;try{var v=m.getSrc(x),b=typeof x.tagName=="string"?x.tagName.toLowerCase():"",w=m.getXPath(x,5),_=t.getURL(v),C={src:v&&v.substring(0,1e3),node_name:b,xpath:w,res_type:t.getResType(b,v),res_name:_.path,domain:_.domain};return m._conf.enableResource&&m.fixResourceStatus&&l.timeStamp&&m.fixResourceStatus({src:v,node_name:b,res_type:t.getResType(b,v),timeStamp:l.timeStamp,domain:_.domain}),m._lg("resourceError",C),m}catch(E){return t.warn("[ARMS] resourceErrorHandler error :",E),m}},getSrc:function(l){var m=l.src||l.href;try{if(!m){var x=(typeof l.tagName=="string"?l.tagName.toLowerCase():"")==="object",v=l.getAttribute("classid")&&l.getAttribute("classid").toLowerCase()==="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"||l.getAttribute("type")==="application/x-shockwave-flash";x&&v&&(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:"",v=typeof l.className=="string"?"."+l.className.split(" ").join("."):"",b=(typeof l.tagName=="string"?l.tagName.toLowerCase():"")+x+v;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=r();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=i();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 v=p(x),b=c.devicePixelRatio||1;return{uid:v,dt:e.title,dl:location.href,dr:e.referrer,dpr:b.toFixed(2),de:(e.characterSet||e.defaultCharset||"").toLowerCase(),ul:o.lang,begin:Date.now()}}(l);m&&m.uid&&l._lg("pv",m,l.getConfig("pvSample"))})},commonInfo:function(){return g.uid=p(this),g.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),g},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 v=m._conf.parseHash(location.hash);v&&m.setPage(v,x!==!1)},m.stateChangeHandler=function(x){var v=m._conf.parseHash(x.detail);v&&m.setPage(v)},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}),Xn}var es,Yn;function Bc(){if(Yn)return es;Yn=1;var s=Ze(),c=500;return es=function(e,t,i){function r(g,f,d){var p=0,l=g.tagName;if(l!=="SCRIPT"&&l!=="STYLE"&&l!=="META"&&l!=="HEAD"){var m=g.children?g.children.length:0;if(m>0)for(var x=g.children,v=m-1;v>=0;v--)p+=r(x[v],f+1,p>0);if(p<=0&&!d&&!(g.getBoundingClientRect&&g.getBoundingClientRect().top<o))return 0;p+=1+.5*f}return p}function n(g){for(var f=1;f<g.length;f++)if(g[f].score<g[f-1].score)return g.splice(f,1),n(g);return g}var o=t.innerHeight||0,a=[],u=null,h=0;s.ext(e.prototype,{initFmpObserver:function(g){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=i.querySelector("body");if(m){var x=0;x+=r(m,1,!1),a.push({score:x,t:l})}else a.push({score:0,t:l})})(f._startTime)})).observe(document,{childList:!0,subtree:!0}),h=1,f.onReady(function(){f.endObserving(g)}),u},endObserving:function(g,f){var d=this;if(u&&h)if(d.fmpTimmer&&(clearTimeout(d.fmpTimmer),d.fmpTimmer=null),f||!function(x,v){var b=Date.now()-x;return!(b>v||b-(a&&a.length&&a[a.length-1].t||0)>2*c)}(d._startTime,g)){u.disconnect(),h=0,a=n(a);for(var p=null,l=1;l<a.length;l++)if(a[l].t>=a[l-1].t){var m=a[l].score-a[l-1].score;(!p||p.rate<=m)&&(p={t:a[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(g)},c)}})},es}var Qn,ea;function Pc(){return ea||(ea=1,Qn=function(s,c){var e=Ze(),t=null,i=e.getCurDomain(),r=function(h,g,f,d,p,l,m,x,v,b,w,_,C){var E=e.J(p)||null,I=e.safetyCall(g,[E,d],null);if(!I)return!1;var L=I.code||l,k=!("success"in I)||I.success;h.api(f,k,m,L,I.msg,x,v,b,k?{}:w,i,_,C)},n="fetch",o="__oFetch_",a="__oXMLHttpRequest_",u="XMLHttpRequest";return e.ext(s.prototype,{removeHook:function(h,g){return t&&(g||this===t)?(c[o]&&(c[n]=c[o],delete c[o]),c[a]&&(c[u]=c[a],delete c[a]),t=null,this):this},addHook:function(h){return!h&&t?this:(t||(function(){if(typeof c[n]=="function"){var g=c[n];c[o]=g,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 g.apply(c,p);d||(d={});var m=Date.now(),x=l._conf,v=e.duration(),b=(f&&typeof f!="string"?f.url:f)||"",w=b;b=e.cutUrlSearch(b);var _=(x.ignore||{}).ignoreApis,C=x.parseTraceId;if(!e.checkAPI(b,!0)||e.ignoreByRule(b,_))return g.apply(c,p);b=e.filterByRule(b,w,x.ignoreApiPath?x.ignoreApiPath:x.apiHelper);var E=x.enableLinkTrace,I="",L="",k=l.getConfig("pid"),N=null,R=l.getConfig("sample"),M=l.getConfig("linkType"),y=1;if(R&&!l.sampling(R)&&(y=0),E){var V="";try{V=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(K){V=""}var Q=e.checkSameOrigin(w,V);if(l.getConfig("enableApiCors")||Q)if(f&&typeof f!="string")try{if(p[0].headers&&typeof p[0].headers.get=="function"&&typeof p[0].headers.append=="function")switch(M){case"arms":var q=p[0].headers.get("EagleEye-TraceID"),ne=p[0].headers.get("EagleEye-SessionID"),$=p[0].headers.get("EagleEye-pAppName");q?I=q:(I=l.getTraceId()["EagleEye-TraceID"],p[0].headers.append("EagleEye-TraceID",I)),ne?L=ne:(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)I=ie;else{var D=l.getB3TraceId(y);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()),I=D["X-B3-TraceId"]}L=l.pageview;break;case"tracing":default:var B=p[0].headers.get("uber-trace-id");B?I=B.split(":")[0]:(B=l.getUberTraceId(y),p[0].headers.append("uber-trace-id",B["uber-trace-id"]),I=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:{},M){case"arms":d.headers["EagleEye-TraceID"]?I=d.headers["EagleEye-TraceID"]:(I=l.getTraceId()["EagleEye-TraceID"],d.headers["EagleEye-TraceID"]=I),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"])I=d.headers["X-B3-TraceId"];else{var z=l.getB3TraceId(y);d.headers["X-B3-TraceId"]=z["X-B3-TraceId"],d.headers["X-B3-ParentSpanId"]=z["X-B3-ParentSpanId"],d.headers["X-B3-SpanId"]=z["X-B3-SpanId"],d.headers["X-B3-Sampled"]=z["X-B3-Sampled"],d.headers["X-Request-ID"]=e.guid(),I=z["X-B3-TraceId"]}L=l.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(d.headers["uber-trace-id"])I=d.headers["uber-trace-id"].split(":")[0];else{var O=l.getUberTraceId(y);d.headers["uber-trace-id"]=O["uber-trace-id"],I=O.traceId}L=l.getPageviewId()["EagleEye-SessionID"]}}return g.apply(c,p).then(function(K){if(!l||!l.api)return K;try{if(!K||typeof K.clone!="function")return K;var be=K.clone(),he=be.headers;if(he&&typeof he.get=="function"){var re=he.get("content-type");if(re&&!/(text)|(json)/.test(re))return K;if(!I){var Ae=e.parseFetchHeaders(he);typeof Ae=="object"&&Ae["eagleeye-traceid"]&&(I=Ae["eagleeye-traceid"],N="response")}}var Le=v();return be.text().then(function(Pe){if(!I&&e.isFunction(C)){var We=C(be,Pe);We&&e.isString(We)&&(I=We)}var Oe=e.getFetchSnapshot(p,Pe,he);be.ok?r(l,x.parseResponse,b,w,Pe,be.status||200,Le,m,I,L,Oe,N,y):(l.api(b,!1,Le,be.status||404,be.statusText,m,I,L,Oe,i,N,y),x.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:be.url,res_type:"api"}))}),K}catch(Pe){return e.warn("[ARMS] fetch response error :",Pe),K}}).catch(function(K){if(!l||!l.api)throw K;var be=v();throw l.api(b,!1,be,K.name||"Error",K.message,m,I,L,{},i),x.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:w,res_type:"api"}),K})},c[n].toString=e.createFakeToString(n)}}(),function(){if(typeof c[u]=="function"){var g,f=c[u];c[a]=f;var d=function(p){var l=new f(p),m=t;if(!m||!m.api||!l.addEventListener)return l;var x,v,b,w,_=l.send,C=l.open,E=l.setRequestHeader,I=m._conf,L=(I.ignore||{}).ignoreApis,k=I.parseTraceId,N=m.getConfig("enableLinkTrace"),R="",M="",y="",V=null,Q=m.getConfig("sample"),q=m.getConfig("linkType"),ne=1;return Q&&!m.sampling(Q)&&(ne=0),l.open=function($,ie){g=$;var D=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);C.apply(l,D),w=ie||"",b=e.cutUrlSearch(w);var B=!e.checkAPI(b,!0)||e.ignoreByRule(b,L);if(b=b?e.filterByRule(b,w,I.ignoreApiPath?I.ignoreApiPath:I.apiHelper):"",!B&&N){var z="";try{z=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(he){z=""}var O=e.checkSameOrigin(w,z);if((m.getConfig("enableApiCors")||O)&&E&&typeof E=="function")switch(q){case"arms":R=m.getTraceId()["EagleEye-TraceID"],E.apply(l,["EagleEye-TraceID",R]),M=m.getPageviewId()["EagleEye-SessionID"],E.apply(l,["EagleEye-SessionID",M]),y=m.getConfig("pid"),E.apply(l,["EagleEye-pAppName",y]);break;case"b3":var K=m.getB3TraceId(ne);E.apply(l,["X-B3-TraceId",K["X-B3-TraceId"]]),E.apply(l,["X-B3-ParentSpanId",K["X-B3-ParentSpanId"]]),E.apply(l,["X-B3-SpanId",K["X-B3-SpanId"]]),E.apply(l,["X-B3-Sampled",K["X-B3-Sampled"]]),E.apply(l,["X-Request-ID",e.guid()]),R=K["X-B3-TraceId"],M=m.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var be=m.getUberTraceId(ne);E.apply(l,["uber-trace-id",be["uber-trace-id"]]),R=be.traceId,M=m.getPageviewId()["EagleEye-SessionID"]}}},l.send=function(){x=Date.now(),v=e.duration();var $=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);_.apply(l,$)},e.on(l,"readystatechange",function(){if(b&&l.readyState===4){var $=v(),ie=e.getXhrSnapshot(w,g,l);if(!R){var D=e.parseXhrHeaders(typeof l.getAllResponseHeaders=="function"&&l.getAllResponseHeaders()||"");typeof D=="object"&&D["eagleeye-traceid"]&&(R=D["eagleeye-traceid"],V="response")}if(!R&&e.isFunction(k)){var B=k(l);B&&e.isString(B)&&(R=B)}if(l.status>=200&&l.status<=299){var z=l.status||200;if(typeof l.getResponseHeader=="function"){var O=l.getResponseHeader("Content-Type");if(O&&!/(text)|(json)/.test(O))return}l.responseType&&l.responseType!=="text"?m.api(b,!0,$,z,"",x,R,M,{},i,V,ne):r(m,I.parseResponse,b,w,l.responseText,z,$,x,R,M,ie,V,ne)}else m.api(b,!1,$,l.status||"FAILED",l.statusText,x,R,M,ie,i,V,ne),I.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:l.responseURL||w,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}),Qn}var ta,ia;function Lc(){return ia||(ia=1,ta=function(s,c){var e=Ze(),t=c.history||{},i=c.document,r=function(o,a){var u;c.CustomEvent?u=new CustomEvent(o,{detail:a}):((u=i.createEvent("HTMLEvents")).initEvent(o,!1,!0),u.detail=a),c.dispatchEvent(u)},n=function(o){var a=t[o];typeof a=="function"&&(t[o]=function(u,h,g){var f=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),d=location.href,p=a.apply(t,f);if(!g||typeof g!="string"||g===d)return p;try{var l=d.split("#"),m=g.split("#"),x=e.cutUrlSearch(l[0]),v=e.cutUrlSearch(m[0]),b=l[1]&&l[1].replace(/^\/?(.*)/,"$1"),w=m[1]&&m[1].replace(/^\/?(.*)/,"$1");b!==w?r("historystatechange",w):x!==v&&r("historystatechange",v)}catch(_){e.warn("[retcode] error in "+o+": "+_)}return p},t[o].toString=e.createFakeToString(o))};e.ext(s.prototype,{hackHistoryState:function(){return this.hasHackedHistoryState?this:(n("pushState"),n("replaceState"),this.hasHackedHistoryState=!0,this)}})}),ta}var ts,ra;function Mc(){if(ra)return ts;ra=1;var s=Ze(),c=Zr(),e=c.TIMING_KEYS;return ts=function(t,i){function r(a,u,h){if(a instanceof i.PerformanceResourceTiming&&a.initiatorType){var g=s.getResType(a.initiatorType,a.name),f=u.resourceTypes||[],d=(u.ignore||{}).ignoreResources;if(g&&f.includes(g)&&!s.ignoreByRule(a.name,d)&&!s.ignoreByRule(s.decode(a.name),d)){var p=a[e[0]],l=a[e[1]],m=a[e[2]],x=a[e[3]],v=a[e[4]],b=a[e[5]],w=a[e[6]],_=a[e[7]],C=a[e[8]],E=a[e[18]],I=a[e[19]];if(!h.has(a)&&(!s.areInOrder(p,l,m,x,v,b,w,_,C)||p>_))return;if(E<p&&(E=p),I<p&&(I=l),s.areInOrder(p,E,I,l))return{domain:s.getURL(a.name).domain,res_type:g,src_type:s.getSrcType(a.name,u.cdnHostList),success:1,size:Math.round(a.decodedBodySize),duration:Math.round(a.duration),timeStamp:a.responseEnd,timing:a}}}}var n="_resource-"+Date.now(),o="_resource_error-"+Date.now();s.ext(t.prototype,{initResource:function(){var a=this,u=i.performance,h=i.PerformanceObserver;if(a[o]||(a[o]=new WeakMap),!u||!h||typeof u!="object"||typeof u.getEntriesByType!="function")return null;var g=u.getEntriesByType("resource")||[];return setTimeout(function(){a.setResource(g)},10),new h(function(f){setTimeout(function(){a.setResource(f.getEntries())},10)}).observe({entryTypes:["resource"]}),this.onReady(function(){setTimeout(a.resourceComboReport.bind(a),5e3)}),a},setResource:function(a){var u=this._conf,h=this[o];if(s.isArray(a)&&a.length){this[n]||(this[n]={});for(var g=this[n],f=0,d=a.length;f<d;f+=1){var p=a[f];if(s.checkAPI(p.name,!1)){var l=r(p,u,h);if(l){var m=l.res_type+"-"+l.domain;m in g||(g[m]=[]),g[m].push(l)}}}return this}},fixResourceStatus:function(a){var u=i.performance;if(!u||typeof u.getEntriesByName!="function")return null;var h=this[o];if(!a.src||!s.checkAPI(a.src,!1))return this;var g=a.timeStamp||u.now(),f=u.getEntriesByName(a.src,"resource");return s.each(f,function(d){h.has(d)||g-d.responseEnd<100&&h.set(d,{success:0})}),this},resourceComboReport:function(){var a=this[n]||{},u=this._conf.resourceSlow||2e3,h=this[o];this[n]={};var g=Object.keys(a);if(g.length!==0){var f=[];s.each(g,function(m){var x=a[m],v={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 w=b.timing||{},_=h.get(b.timing),C=_?_.success:1,E=b.duration>u?1:0;v.domain=b.domain,v.res_type=b.res_type,v.src_type=b.src_type,v.count+=1,v.duration+=b.duration,v.size+=b.size,C||(v.err_count+=1,v.err_duration+=b.duration),E&&(v.slow_count+=1,v.slow_duration+=b.duration);try{var I=JSON.parse(JSON.stringify(w));I.success=C,I.resourceSlow=u,I.isSlow=E,v.timings.push(I)}catch(L){}}),v.count&&(v.size=Math.round(v.size/v.count),v.duration=Math.round(v.duration/v.count)),v.slow_count&&(v.slow_duration=Math.round(v.slow_duration/v.slow_count)),v.err_count&&(v.err_duration=Math.round(v.err_duration/v.err_count)),v.timings.length>20&&(v.timings.sort(function(b,w){return w.duration-b.duration}),v.timings.length=20),v.timings=encodeURIComponent(JSON.stringify(v.timings)),f.push(v)});var d={_combo:1,resource:JSON.stringify(f)},p=i.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"))}}})},ts}var sa;function Nc(){if(sa)return lt.exports;sa=1;var s=Ze(),c=Ec(),e=Cc(),t=Ic(),i=s.win,r=i.document,n=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,o=function(a){var u=this;return c.call(u,a),u._initialPage=a.page&&s.safetyCall(a.page,[],a.page+"")||null,u._isRobot=s.isRobot(),u._health={errcount:0,apisucc:0,apifail:0},u.beforeSend=function(h,g){h==="error"?u._health.errcount++:h==="api"&&u._health[g.success?"apisucc":"apifail"]++},a.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&&i.addEventListener&&Object.defineProperty(u,"pipe",{set:u.sendPipe}),u};return o.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(a){return(a?s.cutUrlSearch(a.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(a){if(!a||typeof a!="object")return{};var u=a.code,h=a.msg||a.message||a.subMsg||a.errorMsg||a.ret||a.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(o.prototype,{constructor:o,_super:c,onReady:function(a){var u=this;if(u.hasReady)return a();r.readyState==="complete"?(u.hasReady=!0,a()):s.on(i,"load",function(){u.hasReady=!0,a()},!0)},getPage:function(a){var u=this._conf,h=u.page,g=location,f=g.host+g.pathname;return h&&!a?s.safetyCall(h,[],h+""):this._initialPage||s.filterByRule(u.ignoreUrlCase?f.toLowerCase():f,g.href,u.ignoreUrlPath?u.ignoreUrlPath:u.urlHelper)},setPage:function(a,u){var h=this,g=h.prevPage;if(u!==!1){if(!a||a===g)return h;h.prevPage=a,clearTimeout(h.sendPVTimmer),h.handleUnload(1),h.resetPageview(),h.sendPVTimmer=setTimeout(function(){h.sendPV()},10)}else h.prevPage=a;return h._conf.page=a,h},setConfig:function(a,u){if(a&&typeof a=="object"){s.verifyConfig(a),a=this.setImgUrl(a);var h=this._conf;if(this._conf=s.ext({},h,a),!u){var g="disableHook";g in a&&h[g]!==a[g]&&(a[g]?this.removeHook():this.addHook()),(g="enableSPA")in a&&h[g]!==a[g]&&this.bindHashChange(a[g])}}},sendRequest:function(a){e(a,this.getConfig("imgUrl"))},postData:function(a,u){var h={};h[u]=a[u],delete a[u];var g="";typeof a=="object"&&(g=s.serialize(a)),t(h,this.getConfig("imgUrl")+g+"&post_res=")},sendPipe:function(a){var u=this;if(!a||!a.length)return u;try{if(s.T(a[0])==="Array")return s.each(a,function(g){return u.sendPipe(g)});if(s.T(a)!=="Array")return u;var h=a.shift();if(!n.test(h))return u;u[h].apply(u,a)}catch(g){return s.warn("[retcode] error in sendPipe",g),u}},sendHealth:function(){var a=s.ext({},this._health);a.healthy=a.errcount>0?0:1,a.begin=Date.now();var u=a.begin-this.sBegin;a.stay=u,this._lg("health",a,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(a){a=s.ext({pid:this._conf.pid},a);var u=this.__proto__.constructor(a);return a.page&&u.sendPV(),u}}),Rc()(o,i),Dc()(o,i,r),Bc()(o,i,r),Pc()(o,i),Lc()(o,i),Mc()(o,i),o._super=c,o._root=c._root,c.Browser=o,lt.exports=o,lt.exports}var na;function Fc(){if(na)return It.exports;na=1;function s(o,a){var u=e[i]=new t(o);u.sendPipe(a);var h=u._conf;return h.autoSendPv!==!1&&u.sendPV(),h&&h.useFmp||u.sendPerformance(),h&&h.sendResource&&u.sendResources(),e[r]=!0,u}function c(){if(e[r])return e[i];var o={},a=[];return i in e&&(o=e[i].config||{},a=e[i].pipe||[]),s(o,a)}var e=window,t=e.BrowserLogger=Nc(),i=Ze().key,r="__hasInitBlSdk";t.singleton=function(o,a){return e[r]?e[i]:s(o,a)},t.createExtraInstance=function(o){o&&typeof o=="object"&&o.enableInstanceAutoSend!==!0&&(o.enableInstanceAutoSend=!1);var a=new t(o),u=a._conf;return u.enableInstanceAutoSend&&(u.autoSendPv!==!1&&a.sendPV(),u&&u.useFmp||a.sendPerformance(),u&&u.sendResource&&a.sendResources()),a};var n=typeof window=="object"&&!!window.navigator;return n&&e[i]&&(t.bl=c()),It.exports=t,It.exports}function Oc(){return Fc()}var Vc={getArmsLogger:Oc};function Uc(s,c,e){const t=[],i=typeof Object.getOwnPropertyDescriptors=="function"?Object.getOwnPropertyDescriptors(Object.getPrototypeOf(s)):{};for(const n of Object.keys(i))i[n].get&&t.push(n);const r={MediaboxWrapperObjectGetter(n,o){if(typeof o=="string"&&t.indexOf(o)>-1)return Vt(n[o],c+1,e);const a={MediaboxWrapperObjectMethod(...u){return Vt(n[o](...u),c+1,e)}};return typeof n[o]=="function"?a.MediaboxWrapperObjectMethod:c>10?n[o]:Vt(n[o],c+1,e)},MediaboxWrapperObjectSetter(n,o,a){return n[o]=Vt(a,c+1,e),!0}};return new Proxy(s,{get:r.MediaboxWrapperObjectGetter,set:r.MediaboxWrapperObjectSetter})}function Hc(s,c,e){const t={MediaboxWrapperFunctionApply(i,r,n){const o=i.apply(r,n);return Vt(o,c+1,e)},MediaboxWrapperFunctionGet(i,r){const n=Object.getOwnPropertyDescriptor(i,r);if(n&&!n.writable&&!n.configurable)return i[r];const o={MediaboxWrapperFunctionGet(...a){const u=i[r](...a);return Vt(u,c+1,e)}};return typeof i[r]=="function"?o.MediaboxWrapperFunctionGet:Vt(i[r],c+1,e)},MediaboxWrapperClassConstructor(i,r){const n=new i(...r);return Vt(n,c+1,e)}};return new Proxy(s,{apply:t.MediaboxWrapperFunctionApply,get:t.MediaboxWrapperFunctionGet,construct:t.MediaboxWrapperClassConstructor})}function zc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp)&&!(s instanceof Function)}function Vt(s,c,e){return typeof s=="function"?Hc(s,c+1,e):s instanceof Promise?s.then(t=>Vt(t,c+1,e)).catch(t=>(t instanceof Error&&typeof t.stack=="string"&&t.stack.indexOf("MediaboxWrapper")>-1&&e(t),Promise.reject(t))):zc(s)?Uc(s,c+1,e):s}const jc="https://arms-retcode-sg.aliyuncs.com/r.png?",Wc="https://arms-retcode.aliyuncs.com/r.png?",Kc="https://retcode-us-west-1.arms.aliyuncs.com/r.png?",$c={cn:Wc,sg:jc,usw:Kc};class is{constructor(c){bt(this,"armsLogger"),bt(this,"isReady",!1),bt(this,"isDestroyed",!1),bt(this,"options"),bt(this,"queue",[]),bt(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,i=n=>{var o;if(this.isDestroyed)return!1;if(n.c1=(o=this.options.cid)!=null?o:window.location.host,n.c2=is.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 a=n;return this.options.beforeSend&&(a=this.options.beforeSend(n)),this.isReady?a:(a&&this.queue.push(a),!1)}return!1}return n},r=Vc.getArmsLogger();this.armsLogger=r.singleton({pid:"e1iftji1w7@7ec1cef2cc88733",tag:c.businessName,release:`${c.businessName}_${c.version}`,imgUrl:$c[e],behavior:!0,sample:1,disableHook:!0,environment:t,beforeReport:i})}static get version(){return"0.10.0"}wrap(c){return this.options.disabled||typeof Proxy>"u"?c:Vt(c,0,e=>this.armsLogger.error(e))}updateOptions(c){this.options=Ce(Ce({},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 Me=(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))(Me||{}),dt=(s=>(s.Local="local-device-status-change",s.Remote="remote-device-status-change",s))(dt||{}),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||{}),rs=(s=>(s.Audio="rts audio",s.VideoLarge="rts video",s))(rs||{}),li=(s=>(s.Add="add",s.Delete="delete",s.Replace="replace",s.Stop="stop",s.UnPublish="unpublish",s))(li||{}),Ri=(s=>(s[s.Camera=0]="Camera",s[s.Screen=1]="Screen",s[s.Image=2]="Image",s))(Ri||{}),ur=(s=>(s[s.Microphone=0]="Microphone",s[s.Screen=1]="Screen",s[s.Mixed=2]="Mixed",s))(ur||{}),Ve=(s=>(s.InRoom="inRoom",s.Join="join",s.Publish="publish",s.User="user",s.Resume="resume",s))(Ve||{}),di=(s=>(s[s.MANUAL=0]="MANUAL",s[s.JOINCHANNEL=1]="JOINCHANNEL",s))(di||{}),it=[],ss=0;ss<256;++ss)it.push((ss+256).toString(16).slice(1));function qc(s,c=0){return(it[s[c+0]]+it[s[c+1]]+it[s[c+2]]+it[s[c+3]]+"-"+it[s[c+4]]+it[s[c+5]]+"-"+it[s[c+6]]+it[s[c+7]]+"-"+it[s[c+8]]+it[s[c+9]]+"-"+it[s[c+10]]+it[s[c+11]]+it[s[c+12]]+it[s[c+13]]+it[s[c+14]]+it[s[c+15]]).toLowerCase()}var hr,Gc=new Uint8Array(16);function Jc(){if(!hr&&(hr=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hr(Gc)}var Xc=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const aa={randomUUID:Xc};function fi(s,c,e){if(aa.randomUUID&&!c&&!s)return aa.randomUUID();s=s||{};var t=s.random||(s.rng||Jc)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,c){e=e||0;for(var i=0;i<16;++i)c[e+i]=t[i];return c}return qc(t)}var lr=(s=>(s.prod="rs.rtn.aliyuncs.com",s.pre="prs.rtn.aliyuncs.com",s))(lr||{});const ns="6.11.7-beta.0",oa="web";class Ut{static getVersionNumber(){let c=ns.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 i=0;i<t.length;i++){const r=t[i].split("=");if(decodeURIComponent(r[0])===c)return decodeURIComponent(r[1])}}static createCallid(c=""){const e=fi();return c&&e&&e.length>c.length?`${c}${e.substring(c.length)}`:e}static checkSubOptionsValid(c){if(c){const{audio:e,video:t,screen:i}=c;if(e===!1&&t===!1&&i===!1)return!1}return!0}static isNetworkAvailable(){return H(this,null,function*(){const c=lr.prod,{onLine:e}=navigator;if(!e)return!1;try{return yield fetch(`https://${c}/roomserver/v1/ws/version`),!0}catch(t){return!1}})}}var Ie=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ca(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Zc(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 i=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return s[t]}})}),e}function Wi(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 ua={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,i,r){function n(u,h){if(!i[u]){if(!t[u]){var g=typeof Wi=="function"&&Wi;if(!h&&g)return g(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[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,i,r)}return i[u].exports}for(var o=typeof Wi=="function"&&Wi,a=0;a<r.length;a++)n(r[a]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(a){for(var u,h,g,f,d,p,l,m=[],x=0,v=a.length,b=v,w=r.getTypeOf(a)!=="string";x<a.length;)b=v-x,g=w?(u=a[x++],h=x<v?a[x++]:0,x<v?a[x++]:0):(u=a.charCodeAt(x++),h=x<v?a.charCodeAt(x++):0,x<v?a.charCodeAt(x++):0),f=u>>2,d=(3&u)<<4|h>>4,p=1<b?(15&h)<<2|g>>6:64,l=2<b?63&g:64,m.push(o.charAt(f)+o.charAt(d)+o.charAt(p)+o.charAt(l));return m.join("")},i.decode=function(a){var u,h,g,f,d,p,l=0,m=0,x="data:";if(a.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");var v,b=3*(a=a.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(a.charAt(a.length-1)===o.charAt(64)&&b--,a.charAt(a.length-2)===o.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=n.uint8array?new Uint8Array(0|b):new Array(0|b);l<a.length;)u=o.indexOf(a.charAt(l++))<<2|(f=o.indexOf(a.charAt(l++)))>>4,h=(15&f)<<4|(d=o.indexOf(a.charAt(l++)))>>2,g=(3&d)<<6|(p=o.indexOf(a.charAt(l++))),v[m++]=u,d!==64&&(v[m++]=h),p!==64&&(v[m++]=g);return v}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function u(h,g,f,d,p){this.compressedSize=h,this.uncompressedSize=g,this.crc32=f,this.compression=d,this.compressedContent=p}u.prototype={getContentWorker:function(){var h=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),g=this;return h.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(h,g,f){return h.pipe(new o).pipe(new a("uncompressedSize")).pipe(g.compressWorker(f)).pipe(new a("compressedSize")).withStreamInfo("compression",g)},t.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var r=e("./utils"),n=function(){for(var o,a=[],u=0;u<256;u++){o=u;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;a[u]=o}return a}();t.exports=function(o,a){return o!==void 0&&o.length?r.getTypeOf(o)!=="string"?function(u,h,g,f){var d=n,p=f+g;u^=-1;for(var l=f;l<p;l++)u=u>>>8^d[255&(u^h[l])];return-1^u}(0|a,o,o.length,0):function(u,h,g,f){var d=n,p=f+g;u^=-1;for(var l=f;l<p;l++)u=u>>>8^d[255&(u^h.charCodeAt(l))];return-1^u}(0|a,o,o.length,0):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var r=null;r=typeof Promise!="undefined"?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,i){var r=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",n=e("pako"),o=e("./utils"),a=e("./stream/GenericWorker"),u=r?"uint8array":"array";function h(g,f){a.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=f,this.meta={}}i.magic="\b\0",o.inherits(h,a),h.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(u,g.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.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 g=this;this._pako.onData=function(f){g.push({data:f,meta:g.meta})}},i.compressWorker=function(g){return new h("Deflate",g)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function r(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,v){var b,w,_=d.file,C=d.compression,E=v!==u.utf8encode,I=o.transformTo("string",v(_.name)),L=o.transformTo("string",u.utf8encode(_.name)),k=_.comment,N=o.transformTo("string",v(k)),R=o.transformTo("string",u.utf8encode(k)),M=L.length!==_.name.length,y=R.length!==k.length,V="",Q="",q="",ne=_.dir,$=_.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),E||!M&&!y||(D|=2048);var B=0,z=0;ne&&(B|=16),x==="UNIX"?(z=798,B|=function(K,be){var he=K;return K||(he=be?16893:33204),(65535&he)<<16}(_.unixPermissions,ne)):(z=20,B|=function(K){return 63&(K||0)}(_.dosPermissions)),b=$.getUTCHours(),b<<=6,b|=$.getUTCMinutes(),b<<=5,b|=$.getUTCSeconds()/2,w=$.getUTCFullYear()-1980,w<<=4,w|=$.getUTCMonth()+1,w<<=5,w|=$.getUTCDate(),M&&(Q=r(1,1)+r(h(I),4)+L,V+="up"+r(Q.length,2)+Q),y&&(q=r(1,1)+r(h(N),4)+R,V+="uc"+r(q.length,2)+q);var O="";return O+=`
|
|
15
|
+
\0`,O+=r(D,2),O+=C.magic,O+=r(b,2),O+=r(w,2),O+=r(ie.crc32,4),O+=r(ie.compressedSize,4),O+=r(ie.uncompressedSize,4),O+=r(I.length,2),O+=r(V.length,2),{fileRecord:g.LOCAL_FILE_HEADER+O+I+V,dirRecord:g.CENTRAL_FILE_HEADER+r(z,2)+O+r(N.length,2)+"\0\0\0\0"+r(B,4)+r(m,4)+I+V+N}}var o=e("../utils"),a=e("../stream/GenericWorker"),u=e("../utf8"),h=e("../crc32"),g=e("../signature");function f(d,p,l,m){a.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=[]}o.inherits(f,a),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,a.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 g.DATA_DESCRIPTOR+r(m.crc32,4)+r(m.compressedSize,4)+r(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,v,b,w,_){var C=o.transformTo("string",_(w));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(x,2)+r(x,2)+r(v,4)+r(b,4)+r(C.length,2)+C}(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!!a.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(!a.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(){a.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,i){var r=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(o,a,u){var h=new n(a.streamFiles,u,a.platform,a.encodeFileName),g=0;try{o.forEach(function(f,d){g++;var p=function(v,b){var w=v||b,_=r[w];if(!_)throw new Error(w+" is not a valid compression method !");return _}(d.options.compression,a.compression),l=d.options.compressionOptions||a.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=g}catch(f){h.error(f)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function r(){if(!(this instanceof r))return new r;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 r;for(var o in this)typeof this[o]!="function"&&(n[o]=this[o]);return n}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(n,o){return new r().loadAsync(n,o)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var r=e("./utils"),n=e("./external"),o=e("./utf8"),a=e("./zipEntries"),u=e("./stream/Crc32Probe"),h=e("./nodejsUtils");function g(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=r.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),h.isNode&&h.isStream(f)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",f,!0,d.optimizedBinaryString,d.base64).then(function(l){var m=new a(d);return m.load(l),m}).then(function(l){var m=[n.Promise.resolve(l)],x=l.files;if(d.checkCRC32)for(var v=0;v<x.length;v++)m.push(g(x[v]));return n.Promise.all(m)}).then(function(l){for(var m=l.shift(),x=m.files,v=0;v<x.length;v++){var b=x[v],w=b.fileNameStr,_=r.resolve(b.fileNameStr);p.file(_,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(_).unsafeOriginalName=w)}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,i){var r=e("../utils"),n=e("../stream/GenericWorker");function o(a,u){n.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(u)}r.inherits(o,n),o.prototype._bindStream=function(a){var u=this;(this._stream=a).pause(),a.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()})},o.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(o,a,u){r.call(this,a),this._helper=o;var h=this;o.on("data",function(g,f){h.push(g)||h._helper.pause(),u&&u(f)}).on("error",function(g){h.emit("error",g)}).on("end",function(){h.push(null)})}e("../utils").inherits(n,r),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(r,n){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,n);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,n)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var n=new Buffer(r);return n.fill(0),n},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(e,t,i){function r(_,C,E){var I,L=o.getTypeOf(C),k=o.extend(E||{},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&&(_=x(_)),k.createFolders&&(I=m(_))&&v.call(this,I,!0);var N=L==="string"&&k.binary===!1&&k.base64===!1;E&&E.binary!==void 0||(k.binary=!N),(C instanceof g&&C.uncompressedSize===0||k.dir||!C||C.length===0)&&(k.base64=!1,k.binary=!0,C="",k.compression="STORE",L="string");var R=null;R=C instanceof g||C instanceof a?C:p.isNode&&p.isStream(C)?new l(_,C):o.prepareContent(_,C,k.binary,k.optimizedBinaryString,k.base64);var M=new f(_,R,k);this.files[_]=M}var n=e("./utf8"),o=e("./utils"),a=e("./stream/GenericWorker"),u=e("./stream/StreamHelper"),h=e("./defaults"),g=e("./compressedObject"),f=e("./zipObject"),d=e("./generate"),p=e("./nodejsUtils"),l=e("./nodejs/NodejsStreamInputAdapter"),m=function(_){_.slice(-1)==="/"&&(_=_.substring(0,_.length-1));var C=_.lastIndexOf("/");return 0<C?_.substring(0,C):""},x=function(_){return _.slice(-1)!=="/"&&(_+="/"),_},v=function(_,C){return C=C!==void 0?C:h.createFolders,_=x(_),this.files[_]||r.call(this,_,null,{dir:!0,createFolders:C}),this.files[_]};function b(_){return Object.prototype.toString.call(_)==="[object RegExp]"}var w={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(_){var C,E,I;for(C in this.files)I=this.files[C],(E=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&_(E,I)},filter:function(_){var C=[];return this.forEach(function(E,I){_(E,I)&&C.push(I)}),C},file:function(_,C,E){if(arguments.length!==1)return _=this.root+_,r.call(this,_,C,E),this;if(b(_)){var I=_;return this.filter(function(k,N){return!N.dir&&I.test(k)})}var L=this.files[this.root+_];return L&&!L.dir?L:null},folder:function(_){if(!_)return this;if(b(_))return this.filter(function(L,k){return k.dir&&_.test(L)});var C=this.root+_,E=v.call(this,C),I=this.clone();return I.root=E.name,I},remove:function(_){_=this.root+_;var C=this.files[_];if(C||(_.slice(-1)!=="/"&&(_+="/"),C=this.files[_]),C&&!C.dir)delete this.files[_];else for(var E=this.filter(function(L,k){return k.name.slice(0,_.length)===_}),I=0;I<E.length;I++)delete this.files[E[I].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(_){var C,E={};try{if((E=o.extend(_||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");o.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var I=E.comment||this.comment||"";C=d.generateWorker(this,E,I)}catch(L){(C=new a("error")).error(L)}return new u(C,E.type||"string",E.mimeType)},generateAsync:function(_,C){return this.generateInternalStream(_).accumulate(C)},generateNodeStream:function(_,C){return(_=_||{}).type||(_.type="nodebuffer"),this.generateInternalStream(_).toNodejsStream(C)}};t.exports=w},{"./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,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(o){r.call(this,o);for(var a=0;a<this.data.length;a++)o[a]=255&o[a]}e("../utils").inherits(n,r),n.prototype.byteAt=function(o){return this.data[this.zero+o]},n.prototype.lastIndexOfSignature=function(o){for(var a=o.charCodeAt(0),u=o.charCodeAt(1),h=o.charCodeAt(2),g=o.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===a&&this.data[f+1]===u&&this.data[f+2]===h&&this.data[f+3]===g)return f-this.zero;return-1},n.prototype.readAndCheckSignature=function(o){var a=o.charCodeAt(0),u=o.charCodeAt(1),h=o.charCodeAt(2),g=o.charCodeAt(3),f=this.readData(4);return a===f[0]&&u===f[1]&&h===f[2]&&g===f[3]},n.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var a,u=0;for(this.checkOffset(o),a=this.index+o-1;a>=this.index;a--)u=(u<<8)+this.byteAt(a);return this.index+=o,u},readString:function(o){return r.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(o){r.call(this,o)}e("../utils").inherits(n,r),n.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(o){r.call(this,o)}e("../utils").inherits(n,r),n.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},n.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},n.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},n.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(o){r.call(this,o)}e("../utils").inherits(n,r),n.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),o=e("./ArrayReader"),a=e("./StringReader"),u=e("./NodeBufferReader"),h=e("./Uint8ArrayReader");t.exports=function(g){var f=r.getTypeOf(g);return r.checkSupport(f),f!=="string"||n.uint8array?f==="nodebuffer"?new u(g):n.uint8array?new h(r.transformTo("uint8array",g)):new o(r.transformTo("array",g)):new a(g)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,i){var r=e("./GenericWorker"),n=e("../utils");function o(a){r.call(this,"ConvertWorker to "+a),this.destType=a}n.inherits(o,r),o.prototype.processChunk=function(a){this.push({data:n.transformTo(this.destType,a.data),meta:a.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,r),o.prototype.processChunk=function(a){this.streamInfo.crc32=n(a.data,this.streamInfo.crc32||0),this.push(a)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function o(a){n.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}r.inherits(o,n),o.prototype.processChunk=function(a){if(a){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+a.data.length}n.prototype.processChunk.call(this,a)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function o(a){n.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=r.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}r.inherits(o,n),o.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,u);break;case"uint8array":a=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":a=this.data.slice(this.index,u)}return this.index=u,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function r(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}r.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,o){return this._listeners[n].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(n,o){if(this._listeners[n])for(var a=0;a<this._listeners[n].length;a++)this._listeners[n][a].call(this,o)},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 o=this;return n.on("data",function(a){o.processChunk(a)}),n.on("end",function(){o.end()}),n.on("error",function(a){o.error(a)}),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,o){return this.extraStreamInfo[n]=o,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=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),o=e("./GenericWorker"),a=e("../base64"),u=e("../support"),h=e("../external"),g=null;if(u.nodestream)try{g=e("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function f(p,l){return new h.Promise(function(m,x){var v=[],b=p._internalType,w=p._outputType,_=p._mimeType;p.on("data",function(C,E){v.push(C),l&&l(E)}).on("error",function(C){v=[],x(C)}).on("end",function(){try{var C=function(E,I,L){switch(E){case"blob":return r.newBlob(r.transformTo("arraybuffer",I),L);case"base64":return a.encode(I);default:return r.transformTo(E,I)}}(w,function(E,I){var L,k=0,N=null,R=0;for(L=0;L<I.length;L++)R+=I[L].length;switch(E){case"string":return I.join("");case"array":return Array.prototype.concat.apply([],I);case"uint8array":for(N=new Uint8Array(R),L=0;L<I.length;L++)N.set(I[L],k),k+=I[L].length;return N;case"nodebuffer":return Buffer.concat(I);default:throw new Error("concat : unsupported type '"+E+"'")}}(b,v),_);m(C)}catch(E){x(E)}v=[]}).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,r.checkSupport(x),this._worker=p.pipe(new n(x)),p.lock()}catch(v){this._worker=new o("error"),this._worker.error(v)}}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(){r.delay(l,arguments,m)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new g(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,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",i.nodebuffer=typeof Buffer!="undefined",i.uint8array=typeof Uint8Array!="undefined",typeof ArrayBuffer=="undefined")i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=new Blob([r],{type:"application/zip"}).size===0}catch(o){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=n.getBlob("application/zip").size===0}catch(a){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(o){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),o=e("./nodejsUtils"),a=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 g(){a.call(this,"utf-8 decode"),this.leftOver=null}function f(){a.call(this,"utf-8 encode")}i.utf8encode=function(d){return n.nodebuffer?o.newBufferFrom(d,"utf-8"):function(p){var l,m,x,v,b,w=p.length,_=0;for(v=0;v<w;v++)(64512&(m=p.charCodeAt(v)))==55296&&v+1<w&&(64512&(x=p.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),v++),_+=m<128?1:m<2048?2:m<65536?3:4;for(l=n.uint8array?new Uint8Array(_):new Array(_),v=b=0;b<_;v++)(64512&(m=p.charCodeAt(v)))==55296&&v+1<w&&(64512&(x=p.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),v++),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)},i.utf8decode=function(d){return n.nodebuffer?r.transformTo("nodebuffer",d).toString("utf-8"):function(p){var l,m,x,v,b=p.length,w=new Array(2*b);for(l=m=0;l<b;)if((x=p[l++])<128)w[m++]=x;else if(4<(v=u[x]))w[m++]=65533,l+=v-1;else{for(x&=v===2?31:v===3?15:7;1<v&&l<b;)x=x<<6|63&p[l++],v--;1<v?w[m++]=65533:x<65536?w[m++]=x:(x-=65536,w[m++]=55296|x>>10&1023,w[m++]=56320|1023&x)}return w.length!==m&&(w.subarray?w=w.subarray(0,m):w.length=m),r.applyFromCharCode(w)}(d=r.transformTo(n.uint8array?"uint8array":"array",d))},r.inherits(g,a),g.prototype.processChunk=function(d){var p=r.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(v,b){var w;for((b=b||v.length)>v.length&&(b=v.length),w=b-1;0<=w&&(192&v[w])==128;)w--;return w<0||w===0?b:w+u[v[w]]>b?w: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:i.utf8decode(x),meta:d.meta})},g.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=g,r.inherits(f,a),f.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var r=e("./support"),n=e("./base64"),o=e("./nodejsUtils"),a=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"),i.newBlob=function(l,m){i.checkSupport("blob");try{return new Blob([l],{type:m})}catch(v){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 g={stringifyByChunk:function(l,m,x){var v=[],b=0,w=l.length;if(w<=x)return String.fromCharCode.apply(null,l);for(;b<w;)m==="array"||m==="nodebuffer"?v.push(String.fromCharCode.apply(null,l.slice(b,Math.min(b+x,w)))):v.push(String.fromCharCode.apply(null,l.subarray(b,Math.min(b+x,w)))),b+=x;return v.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 r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(l){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch(l){return!1}}()}};function f(l){var m=65536,x=i.getTypeOf(l),v=!0;if(x==="uint8array"?v=g.applyCanBeUsed.uint8array:x==="nodebuffer"&&(v=g.applyCanBeUsed.nodebuffer),v)for(;1<m;)try{return g.stringifyByChunk(l,x,m)}catch(b){m=Math.floor(m/2)}return g.stringifyByChar(l)}function d(l,m){for(var x=0;x<l.length;x++)m[x]=l[x];return m}i.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,o.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 o.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 o.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 o.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},i.transformTo=function(l,m){if(m=m||"",!l)return m;i.checkSupport(l);var x=i.getTypeOf(m);return p[x][l](m)},i.resolve=function(l){for(var m=l.split("/"),x=[],v=0;v<m.length;v++){var b=m[v];b==="."||b===""&&v!==0&&v!==m.length-1||(b===".."?x.pop():x.push(b))}return x.join("/")},i.getTypeOf=function(l){return typeof l=="string"?"string":Object.prototype.toString.call(l)==="[object Array]"?"array":r.nodebuffer&&o.isBuffer(l)?"nodebuffer":r.uint8array&&l instanceof Uint8Array?"uint8array":r.arraybuffer&&l instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(l){if(!r[l.toLowerCase()])throw new Error(l+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(l){var m,x,v="";for(x=0;x<(l||"").length;x++)v+="\\x"+((m=l.charCodeAt(x))<16?"0":"")+m.toString(16).toUpperCase();return v},i.delay=function(l,m,x){setImmediate(function(){l.apply(x||null,m||[])})},i.inherits=function(l,m){function x(){}x.prototype=m.prototype,l.prototype=new x},i.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},i.prepareContent=function(l,m,x,v,b){return a.Promise.resolve(m).then(function(w){return r.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader!="undefined"?new a.Promise(function(_,C){var E=new FileReader;E.onload=function(I){_(I.target.result)},E.onerror=function(I){C(I.target.error)},E.readAsArrayBuffer(w)}):w}).then(function(w){var _=i.getTypeOf(w);return _?(_==="arraybuffer"?w=i.transformTo("uint8array",w):_==="string"&&(b?w=n.decode(w):x&&v!==!0&&(w=function(C){return h(C,r.uint8array?new Uint8Array(C.length):new Array(C.length))}(w))),w):a.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,i){var r=e("./reader/readerFor"),n=e("./utils"),o=e("./signature"),a=e("./zipEntry"),u=e("./support");function h(g){this.files=[],this.loadOptions=g}h.prototype={checkSignature:function(g){if(!this.reader.readAndCheckSignature(g)){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(g)+")")}},isSignature:function(g,f){var d=this.reader.index;this.reader.setIndex(g);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 g=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",d=n.transformTo(f,g);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 g,f,d,p=this.zip64EndOfCentralSize-44;0<p;)g=this.reader.readInt(2),f=this.reader.readInt(4),d=this.reader.readData(f),this.zip64ExtensibleData[g]={id:g,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 g,f;for(g=0;g<this.files.length;g++)f=this.files[g],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(g=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(g);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 g=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(g<0)throw this.isSignature(0,o.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(g);var f=g;if(this.checkSignature(o.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,(g=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(g),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.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(o.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,o.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(g){this.reader=r(g)},load:function(g){this.prepareReader(g),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),o=e("./compressedObject"),a=e("./crc32"),u=e("./utf8"),h=e("./compressions"),g=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 o(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=r(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=g.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=r(d.value);return p.readInt(1)!==1||a(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=r(d.value);return p.readInt(1)!==1||a(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,i){function r(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"),o=e("./stream/DataWorker"),a=e("./utf8"),u=e("./compressedObject"),h=e("./stream/GenericWorker");r.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 v=!this._dataBinary;v&&!x&&(l=l.pipe(new a.Utf8EncodeWorker)),!v&&x&&(l=l.pipe(new a.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 a.Utf8EncodeWorker)),u.createWorkerFrom(m,p,l)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof h?this._data:new o(this._data)}};for(var g=["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<g.length;d++)r.prototype[g[d]]=f;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(r){var n,o,a=r.MutationObserver||r.WebKitMutationObserver;if(a){var u=0,h=new a(p),g=r.document.createTextNode("");h.observe(g,{characterData:!0}),n=function(){g.data=u=++u%2}}else if(r.setImmediate||r.MessageChannel===void 0)n="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var l=r.document.createElement("script");l.onreadystatechange=function(){p(),l.onreadystatechange=null,l.parentNode.removeChild(l),l=null},r.document.documentElement.appendChild(l)}:function(){setTimeout(p,0)};else{var f=new r.MessageChannel;f.port1.onmessage=p,n=function(){f.port2.postMessage(0)}}var d=[];function p(){var l,m;o=!0;for(var x=d.length;x;){for(m=d,d=[],l=-1;++l<x;)m[l]();x=d.length}o=!1}t.exports=function(l){d.push(l)!==1||o||n()}}).call(this,typeof Ie!="undefined"?Ie:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var o={},a=["REJECTED"],u=["FULFILLED"],h=["PENDING"];function g(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,v,b){this.promise=x,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function d(x,v,b){r(function(){var w;try{w=v(b)}catch(_){return o.reject(x,_)}w===x?o.reject(x,new TypeError("Cannot resolve promise with itself")):o.resolve(x,w)})}function p(x){var v=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof v=="function")return function(){v.apply(x,arguments)}}function l(x,v){var b=!1;function w(E){b||(b=!0,o.reject(x,E))}function _(E){b||(b=!0,o.resolve(x,E))}var C=m(function(){v(_,w)});C.status==="error"&&w(C.value)}function m(x,v){var b={};try{b.value=x(v),b.status="success"}catch(w){b.status="error",b.value=w}return b}(t.exports=g).prototype.finally=function(x){if(typeof x!="function")return this;var v=this.constructor;return this.then(function(b){return v.resolve(x()).then(function(){return b})},function(b){return v.resolve(x()).then(function(){throw b})})},g.prototype.catch=function(x){return this.then(null,x)},g.prototype.then=function(x,v){if(typeof x!="function"&&this.state===u||typeof v!="function"&&this.state===a)return this;var b=new this.constructor(n);return this.state!==h?d(b,this.state===u?x:v,this.outcome):this.queue.push(new f(b,x,v)),b},f.prototype.callFulfilled=function(x){o.resolve(this.promise,x)},f.prototype.otherCallFulfilled=function(x){d(this.promise,this.onFulfilled,x)},f.prototype.callRejected=function(x){o.reject(this.promise,x)},f.prototype.otherCallRejected=function(x){d(this.promise,this.onRejected,x)},o.resolve=function(x,v){var b=m(p,v);if(b.status==="error")return o.reject(x,b.value);var w=b.value;if(w)l(x,w);else{x.state=u,x.outcome=v;for(var _=-1,C=x.queue.length;++_<C;)x.queue[_].callFulfilled(v)}return x},o.reject=function(x,v){x.state=a,x.outcome=v;for(var b=-1,w=x.queue.length;++b<w;)x.queue[b].callRejected(v);return x},g.resolve=function(x){return x instanceof this?x:o.resolve(new this(n),x)},g.reject=function(x){var v=new this(n);return o.reject(v,x)},g.all=function(x){var v=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=x.length,w=!1;if(!b)return this.resolve([]);for(var _=new Array(b),C=0,E=-1,I=new this(n);++E<b;)L(x[E],E);return I;function L(k,N){v.resolve(k).then(function(R){_[N]=R,++C!==b||w||(w=!0,o.resolve(I,_))},function(R){w||(w=!0,o.reject(I,R))})}},g.race=function(x){var v=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=x.length,w=!1;if(!b)return this.resolve([]);for(var _=-1,C=new this(n);++_<b;)E=x[_],v.resolve(E).then(function(I){w||(w=!0,o.resolve(C,I))},function(I){w||(w=!0,o.reject(C,I))});var E;return C}},{immediate:36}],38:[function(e,t,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var r=e("./zlib/deflate"),n=e("./utils/common"),o=e("./utils/strings"),a=e("./zlib/messages"),u=e("./zlib/zstream"),h=Object.prototype.toString,g=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 v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=r.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(b!==g)throw new Error(a[b]);if(v.header&&r.deflateSetHeader(this.strm,v.header),v.dictionary){var w;if(w=typeof v.dictionary=="string"?o.string2buf(v.dictionary):h.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(b=r.deflateSetDictionary(this.strm,w))!==g)throw new Error(a[b]);this._dict_set=!0}}function m(x,v){var b=new l(v);if(b.push(x,!0),b.err)throw b.msg||a[b.err];return b.result}l.prototype.push=function(x,v){var b,w,_=this.strm,C=this.options.chunkSize;if(this.ended)return!1;w=v===~~v?v:v===!0?4:0,typeof x=="string"?_.input=o.string2buf(x):h.call(x)==="[object ArrayBuffer]"?_.input=new Uint8Array(x):_.input=x,_.next_in=0,_.avail_in=_.input.length;do{if(_.avail_out===0&&(_.output=new n.Buf8(C),_.next_out=0,_.avail_out=C),(b=r.deflate(_,w))!==1&&b!==g)return this.onEnd(b),!(this.ended=!0);_.avail_out!==0&&(_.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(n.shrinkBuf(_.output,_.next_out))):this.onData(n.shrinkBuf(_.output,_.next_out)))}while((0<_.avail_in||_.avail_out===0)&&b!==1);return w===4?(b=r.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===g):w!==2||(this.onEnd(g),!(_.avail_out=0))},l.prototype.onData=function(x){this.chunks.push(x)},l.prototype.onEnd=function(x){x===g&&(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},i.Deflate=l,i.deflate=m,i.deflateRaw=function(x,v){return(v=v||{}).raw=!0,m(x,v)},i.gzip=function(x,v){return(v=v||{}).gzip=!0,m(x,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var r=e("./zlib/inflate"),n=e("./utils/common"),o=e("./utils/strings"),a=e("./zlib/constants"),u=e("./zlib/messages"),h=e("./zlib/zstream"),g=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=r.inflateInit2(this.strm,m.windowBits);if(x!==a.Z_OK)throw new Error(u[x]);this.header=new g,r.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,v,b,w,_,C,E=this.strm,I=this.options.chunkSize,L=this.options.dictionary,k=!1;if(this.ended)return!1;v=m===~~m?m:m===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof l=="string"?E.input=o.binstring2buf(l):f.call(l)==="[object ArrayBuffer]"?E.input=new Uint8Array(l):E.input=l,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),(x=r.inflate(E,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&L&&(C=typeof L=="string"?o.string2buf(L):f.call(L)==="[object ArrayBuffer]"?new Uint8Array(L):L,x=r.inflateSetDictionary(this.strm,C)),x===a.Z_BUF_ERROR&&k===!0&&(x=a.Z_OK,k=!1),x!==a.Z_STREAM_END&&x!==a.Z_OK)return this.onEnd(x),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&x!==a.Z_STREAM_END&&(E.avail_in!==0||v!==a.Z_FINISH&&v!==a.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=o.utf8border(E.output,E.next_out),w=E.next_out-b,_=o.buf2string(E.output,b),E.next_out=w,E.avail_out=I-w,w&&n.arraySet(E.output,E.output,b,w,0),this.onData(_)):this.onData(n.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(k=!0)}while((0<E.avail_in||E.avail_out===0)&&x!==a.Z_STREAM_END);return x===a.Z_STREAM_END&&(v=a.Z_FINISH),v===a.Z_FINISH?(x=r.inflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===a.Z_OK):v!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),!(E.avail_out=0))},d.prototype.onData=function(l){this.chunks.push(l)},d.prototype.onEnd=function(l){l===a.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},i.Inflate=d,i.inflate=p,i.inflateRaw=function(l,m){return(m=m||{}).raw=!0,p(l,m)},i.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,i){var r=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";i.assign=function(a){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 g in h)h.hasOwnProperty(g)&&(a[g]=h[g])}}return a},i.shrinkBuf=function(a,u){return a.length===u?a:a.subarray?a.subarray(0,u):(a.length=u,a)};var n={arraySet:function(a,u,h,g,f){if(u.subarray&&a.subarray)a.set(u.subarray(h,h+g),f);else for(var d=0;d<g;d++)a[f+d]=u[h+d]},flattenChunks:function(a){var u,h,g,f,d,p;for(u=g=0,h=a.length;u<h;u++)g+=a[u].length;for(p=new Uint8Array(g),u=f=0,h=a.length;u<h;u++)d=a[u],p.set(d,f),f+=d.length;return p}},o={arraySet:function(a,u,h,g,f){for(var d=0;d<g;d++)a[f+d]=u[h+d]},flattenChunks:function(a){return[].concat.apply([],a)}};i.setTyped=function(a){a?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(g){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(g){o=!1}for(var a=new r.Buf8(256),u=0;u<256;u++)a[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function h(g,f){if(f<65537&&(g.subarray&&o||!g.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(g,f));for(var d="",p=0;p<f;p++)d+=String.fromCharCode(g[p]);return d}a[254]=a[254]=1,i.string2buf=function(g){var f,d,p,l,m,x=g.length,v=0;for(l=0;l<x;l++)(64512&(d=g.charCodeAt(l)))==55296&&l+1<x&&(64512&(p=g.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),l++),v+=d<128?1:d<2048?2:d<65536?3:4;for(f=new r.Buf8(v),l=m=0;m<v;l++)(64512&(d=g.charCodeAt(l)))==55296&&l+1<x&&(64512&(p=g.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},i.buf2binstring=function(g){return h(g,g.length)},i.binstring2buf=function(g){for(var f=new r.Buf8(g.length),d=0,p=f.length;d<p;d++)f[d]=g.charCodeAt(d);return f},i.buf2string=function(g,f){var d,p,l,m,x=f||g.length,v=new Array(2*x);for(d=p=0;d<x;)if((l=g[d++])<128)v[p++]=l;else if(4<(m=a[l]))v[p++]=65533,d+=m-1;else{for(l&=m===2?31:m===3?15:7;1<m&&d<x;)l=l<<6|63&g[d++],m--;1<m?v[p++]=65533:l<65536?v[p++]=l:(l-=65536,v[p++]=55296|l>>10&1023,v[p++]=56320|1023&l)}return h(v,p)},i.utf8border=function(g,f){var d;for((f=f||g.length)>g.length&&(f=g.length),d=f-1;0<=d&&(192&g[d])==128;)d--;return d<0||d===0?f:d+a[g[d]]>f?d:f}},{"./common":41}],43:[function(e,t,i){t.exports=function(r,n,o,a){for(var u=65535&r|0,h=r>>>16&65535|0,g=0;o!==0;){for(o-=g=2e3<o?2e3:o;h=h+(u=u+n[a++]|0)|0,--g;);u%=65521,h%=65521}return u|h<<16|0}},{}],44:[function(e,t,i){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,i){var r=function(){for(var n,o=[],a=0;a<256;a++){n=a;for(var u=0;u<8;u++)n=1&n?3988292384^n>>>1:n>>>1;o[a]=n}return o}();t.exports=function(n,o,a,u){var h=r,g=u+a;n^=-1;for(var f=u;f<g;f++)n=n>>>8^h[255&(n^o[f])];return-1^n}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),o=e("./trees"),a=e("./adler32"),u=e("./crc32"),h=e("./messages"),g=0,f=4,d=0,p=-2,l=-1,m=4,x=2,v=8,b=9,w=286,_=30,C=19,E=2*w+1,I=15,L=3,k=258,N=k+L+1,R=42,M=113,y=1,V=2,Q=3,q=4;function ne(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){o._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 z(S,G){S.pending_buf[S.pending++]=G}function O(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,F=S.strstart,X=S.prev_length,J=S.nice_match,U=S.strstart>S.w_size-N?S.strstart-(S.w_size-N):0,Y=S.window,pe=S.w_mask,ee=S.prev,_e=S.strstart+k,Te=Y[F+X-1],Re=Y[F+X];S.prev_length>=S.good_match&&(T>>=2),J>S.lookahead&&(J=S.lookahead);do if(Y[(W=G)+X]===Re&&Y[W+X-1]===Te&&Y[W]===Y[F]&&Y[++W]===Y[F+1]){F+=2,W++;do;while(Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&Y[++F]===Y[++W]&&F<_e);if(P=k-(_e-F),F=_e-k,X<P){if(S.match_start=G,J<=(X=P))break;Te=Y[F+X-1],Re=Y[F+X]}}while((G=ee[G&pe])>U&&--T!=0);return X<=S.lookahead?X:S.lookahead}function be(S){var G,W,P,T,F,X,J,U,Y,pe,ee=S.w_size;do{if(T=S.window_size-S.lookahead-S.strstart,S.strstart>=ee+(ee-N)){for(n.arraySet(S.window,S.window,ee,ee,0),S.match_start-=ee,S.strstart-=ee,S.block_start-=ee,G=W=S.hash_size;P=S.head[--G],S.head[G]=ee<=P?P-ee:0,--W;);for(G=W=ee;P=S.prev[--G],S.prev[G]=ee<=P?P-ee:0,--W;);T+=ee}if(S.strm.avail_in===0)break;if(X=S.strm,J=S.window,U=S.strstart+S.lookahead,Y=T,pe=void 0,pe=X.avail_in,Y<pe&&(pe=Y),W=pe===0?0:(X.avail_in-=pe,n.arraySet(J,X.input,X.next_in,pe,U),X.state.wrap===1?X.adler=a(X.adler,J,pe,U):X.state.wrap===2&&(X.adler=u(X.adler,J,pe,U)),X.next_in+=pe,X.total_in+=pe,pe),S.lookahead+=W,S.lookahead+S.insert>=L)for(F=S.strstart-S.insert,S.ins_h=S.window[F],S.ins_h=(S.ins_h<<S.hash_shift^S.window[F+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[F+L-1])&S.hash_mask,S.prev[F&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=F,F++,S.insert--,!(S.lookahead+S.insert<L)););}while(S.lookahead<N&&S.strm.avail_in!==0)}function he(S,G){for(var W,P;;){if(S.lookahead<N){if(be(S),S.lookahead<N&&G===g)return y;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-N&&(S.match_length=K(S,W)),S.match_length>=L)if(P=o._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=o._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(P&&(B(S,!1),S.strm.avail_out===0))return y}return S.insert=S.strstart<L-1?S.strstart:L-1,G===f?(B(S,!0),S.strm.avail_out===0?Q:q):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?y:V}function re(S,G){for(var W,P,T;;){if(S.lookahead<N){if(be(S),S.lookahead<N&&G===g)return y;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-N&&(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=o._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 y}else if(S.match_available){if((P=o._tr_tally(S,0,S.window[S.strstart-1]))&&B(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return y}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(P=o._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?Q:q):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?y:V}function Ae(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 Le(){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=v,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*E),this.dyn_dtree=new n.Buf16(2*(2*_+1)),this.bl_tree=new n.Buf16(2*(2*C+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(I+1),this.heap=new n.Buf16(2*w+1),ie(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*w+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 Pe(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?R:M,S.adler=G.wrap===2?0:1,G.last_flush=g,o._tr_init(G),d):ne(S,p)}function We(S){var G=Pe(S);return G===d&&function(W){W.window_size=2*W.w_size,ie(W.head),W.max_lazy_match=r[W.level].max_lazy,W.good_match=r[W.level].good_length,W.nice_match=r[W.level].nice_length,W.max_chain_length=r[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 Oe(S,G,W,P,T,F){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!==v||P<8||15<P||G<0||9<G||F<0||m<F)return ne(S,p);P===8&&(P=9);var J=new Le;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=F,J.method=W,We(S)}r=[new Ae(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(be(S),S.lookahead===0&&G===g)return y;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-N&&(B(S,!1),S.strm.avail_out===0))return y}return S.insert=0,G===f?(B(S,!0),S.strm.avail_out===0?Q:q):(S.strstart>S.block_start&&(B(S,!1),S.strm.avail_out),y)}),new Ae(4,4,8,4,he),new Ae(4,5,16,8,he),new Ae(4,6,32,32,he),new Ae(4,4,16,16,re),new Ae(8,16,32,32,re),new Ae(8,16,128,128,re),new Ae(8,32,128,256,re),new Ae(32,128,258,1024,re),new Ae(32,258,258,4096,re)],i.deflateInit=function(S,G){return Oe(S,G,v,15,8,0)},i.deflateInit2=Oe,i.deflateReset=We,i.deflateResetKeep=Pe,i.deflateSetHeader=function(S,G){return S&&S.state?S.state.wrap!==2?p:(S.state.gzhead=G,d):p},i.deflate=function(S,G){var W,P,T,F;if(!S||!S.state||5<G||G<0)return S?ne(S,p):p;if(P=S.state,!S.output||!S.input&&S.avail_in!==0||P.status===666&&G!==f)return ne(S,S.avail_out===0?-5:p);if(P.strm=S,W=P.last_flush,P.last_flush=G,P.status===R)if(P.wrap===2)S.adler=0,z(P,31),z(P,139),z(P,8),P.gzhead?(z(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)),z(P,255&P.gzhead.time),z(P,P.gzhead.time>>8&255),z(P,P.gzhead.time>>16&255),z(P,P.gzhead.time>>24&255),z(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),z(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(z(P,255&P.gzhead.extra.length),z(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):(z(P,0),z(P,0),z(P,0),z(P,0),z(P,0),z(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),z(P,3),P.status=M);else{var X=v+(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=M,O(P,X),P.strstart!==0&&(O(P,S.adler>>>16),O(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));)z(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)){F=1;break}F=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,z(P,F)}while(F!==0);P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),F===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)){F=1;break}F=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,z(P,F)}while(F!==0);P.gzhead.hcrc&&P.pending>T&&(S.adler=u(S.adler,P.pending_buf,P.pending-T,T)),F===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&&(z(P,255&S.adler),z(P,S.adler>>8&255),S.adler=0,P.status=M)):P.status=M),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 ne(S,-5);if(P.status===666&&S.avail_in!==0)return ne(S,-5);if(S.avail_in!==0||P.lookahead!==0||G!==g&&P.status!==666){var J=P.strategy===2?function(U,Y){for(var pe;;){if(U.lookahead===0&&(be(U),U.lookahead===0)){if(Y===g)return y;break}if(U.match_length=0,pe=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++,pe&&(B(U,!1),U.strm.avail_out===0))return y}return U.insert=0,Y===f?(B(U,!0),U.strm.avail_out===0?Q:q):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?y:V}(P,G):P.strategy===3?function(U,Y){for(var pe,ee,_e,Te,Re=U.window;;){if(U.lookahead<=k){if(be(U),U.lookahead<=k&&Y===g)return y;if(U.lookahead===0)break}if(U.match_length=0,U.lookahead>=L&&0<U.strstart&&(ee=Re[_e=U.strstart-1])===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]){Te=U.strstart+k;do;while(ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&ee===Re[++_e]&&_e<Te);U.match_length=k-(Te-_e),U.match_length>U.lookahead&&(U.match_length=U.lookahead)}if(U.match_length>=L?(pe=o._tr_tally(U,1,U.match_length-L),U.lookahead-=U.match_length,U.strstart+=U.match_length,U.match_length=0):(pe=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++),pe&&(B(U,!1),U.strm.avail_out===0))return y}return U.insert=0,Y===f?(B(U,!0),U.strm.avail_out===0?Q:q):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?y:V}(P,G):r[P.level].func(P,G);if(J!==Q&&J!==q||(P.status=666),J===y||J===Q)return S.avail_out===0&&(P.last_flush=-1),d;if(J===V&&(G===1?o._tr_align(P):G!==5&&(o._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?(z(P,255&S.adler),z(P,S.adler>>8&255),z(P,S.adler>>16&255),z(P,S.adler>>24&255),z(P,255&S.total_in),z(P,S.total_in>>8&255),z(P,S.total_in>>16&255),z(P,S.total_in>>24&255)):(O(P,S.adler>>>16),O(P,65535&S.adler)),D(S),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?d:1)},i.deflateEnd=function(S){var G;return S&&S.state?(G=S.state.status)!==R&&G!==69&&G!==73&&G!==91&&G!==103&&G!==M&&G!==666?ne(S,p):(S.state=null,G===M?ne(S,-3):d):p},i.deflateSetDictionary=function(S,G){var W,P,T,F,X,J,U,Y,pe=G.length;if(!S||!S.state||(F=(W=S.state).wrap)===2||F===1&&W.status!==R||W.lookahead)return p;for(F===1&&(S.adler=a(S.adler,G,pe,0)),W.wrap=0,pe>=W.w_size&&(F===0&&(ie(W.head),W.strstart=0,W.block_start=0,W.insert=0),Y=new n.Buf8(W.w_size),n.arraySet(Y,G,pe-W.w_size,W.w_size,0),G=Y,pe=W.w_size),X=S.avail_in,J=S.next_in,U=S.input,S.avail_in=pe,S.next_in=0,S.input=G,be(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,be(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=F,d},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){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,i){t.exports=function(r,n){var o,a,u,h,g,f,d,p,l,m,x,v,b,w,_,C,E,I,L,k,N,R,M,y,V;o=r.state,a=r.next_in,y=r.input,u=a+(r.avail_in-5),h=r.next_out,V=r.output,g=h-(n-r.avail_out),f=h+(r.avail_out-257),d=o.dmax,p=o.wsize,l=o.whave,m=o.wnext,x=o.window,v=o.hold,b=o.bits,w=o.lencode,_=o.distcode,C=(1<<o.lenbits)-1,E=(1<<o.distbits)-1;e:do{b<15&&(v+=y[a++]<<b,b+=8,v+=y[a++]<<b,b+=8),I=w[v&C];t:for(;;){if(v>>>=L=I>>>24,b-=L,(L=I>>>16&255)===0)V[h++]=65535&I;else{if(!(16&L)){if(!(64&L)){I=w[(65535&I)+(v&(1<<L)-1)];continue t}if(32&L){o.mode=12;break e}r.msg="invalid literal/length code",o.mode=30;break e}k=65535&I,(L&=15)&&(b<L&&(v+=y[a++]<<b,b+=8),k+=v&(1<<L)-1,v>>>=L,b-=L),b<15&&(v+=y[a++]<<b,b+=8,v+=y[a++]<<b,b+=8),I=_[v&E];i:for(;;){if(v>>>=L=I>>>24,b-=L,!(16&(L=I>>>16&255))){if(!(64&L)){I=_[(65535&I)+(v&(1<<L)-1)];continue i}r.msg="invalid distance code",o.mode=30;break e}if(N=65535&I,b<(L&=15)&&(v+=y[a++]<<b,(b+=8)<L&&(v+=y[a++]<<b,b+=8)),d<(N+=v&(1<<L)-1)){r.msg="invalid distance too far back",o.mode=30;break e}if(v>>>=L,b-=L,(L=h-g)<N){if(l<(L=N-L)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break e}if(M=x,(R=0)===m){if(R+=p-L,L<k){for(k-=L;V[h++]=x[R++],--L;);R=h-N,M=V}}else if(m<L){if(R+=p+m-L,(L-=m)<k){for(k-=L;V[h++]=x[R++],--L;);if(R=0,m<k){for(k-=L=m;V[h++]=x[R++],--L;);R=h-N,M=V}}}else if(R+=m-L,L<k){for(k-=L;V[h++]=x[R++],--L;);R=h-N,M=V}for(;2<k;)V[h++]=M[R++],V[h++]=M[R++],V[h++]=M[R++],k-=3;k&&(V[h++]=M[R++],1<k&&(V[h++]=M[R++]))}else{for(R=h-N;V[h++]=V[R++],V[h++]=V[R++],V[h++]=V[R++],2<(k-=3););k&&(V[h++]=V[R++],1<k&&(V[h++]=V[R++]))}break}}break}}while(a<u&&h<f);a-=k=b>>3,v&=(1<<(b-=k<<3))-1,r.next_in=a,r.next_out=h,r.avail_in=a<u?u-a+5:5-(a-u),r.avail_out=h<f?f-h+257:257-(h-f),o.hold=v,o.bits=b}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),o=e("./crc32"),a=e("./inffast"),u=e("./inftrees"),h=1,g=2,f=0,d=-2,p=1,l=852,m=592;function x(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function v(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(R){var M;return R&&R.state?(M=R.state,R.total_in=R.total_out=M.total=0,R.msg="",M.wrap&&(R.adler=1&M.wrap),M.mode=p,M.last=0,M.havedict=0,M.dmax=32768,M.head=null,M.hold=0,M.bits=0,M.lencode=M.lendyn=new r.Buf32(l),M.distcode=M.distdyn=new r.Buf32(m),M.sane=1,M.back=-1,f):d}function w(R){var M;return R&&R.state?((M=R.state).wsize=0,M.whave=0,M.wnext=0,b(R)):d}function _(R,M){var y,V;return R&&R.state?(V=R.state,M<0?(y=0,M=-M):(y=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15<M)?d:(V.window!==null&&V.wbits!==M&&(V.window=null),V.wrap=y,V.wbits=M,w(R))):d}function C(R,M){var y,V;return R?(V=new v,(R.state=V).window=null,(y=_(R,M))!==f&&(R.state=null),y):d}var E,I,L=!0;function k(R){if(L){var M;for(E=new r.Buf32(512),I=new r.Buf32(32),M=0;M<144;)R.lens[M++]=8;for(;M<256;)R.lens[M++]=9;for(;M<280;)R.lens[M++]=7;for(;M<288;)R.lens[M++]=8;for(u(h,R.lens,0,288,E,0,R.work,{bits:9}),M=0;M<32;)R.lens[M++]=5;u(g,R.lens,0,32,I,0,R.work,{bits:5}),L=!1}R.lencode=E,R.lenbits=9,R.distcode=I,R.distbits=5}function N(R,M,y,V){var Q,q=R.state;return q.window===null&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new r.Buf8(q.wsize)),V>=q.wsize?(r.arraySet(q.window,M,y-q.wsize,q.wsize,0),q.wnext=0,q.whave=q.wsize):(V<(Q=q.wsize-q.wnext)&&(Q=V),r.arraySet(q.window,M,y-V,Q,q.wnext),(V-=Q)?(r.arraySet(q.window,M,y-V,V,0),q.wnext=V,q.whave=q.wsize):(q.wnext+=Q,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=Q))),0}i.inflateReset=w,i.inflateReset2=_,i.inflateResetKeep=b,i.inflateInit=function(R){return C(R,15)},i.inflateInit2=C,i.inflate=function(R,M){var y,V,Q,q,ne,$,ie,D,B,z,O,K,be,he,re,Ae,Le,Pe,We,Oe,S,G,W,P,T=0,F=new r.Buf8(4),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return d;(y=R.state).mode===12&&(y.mode=13),ne=R.next_out,Q=R.output,ie=R.avail_out,q=R.next_in,V=R.input,$=R.avail_in,D=y.hold,B=y.bits,z=$,O=ie,G=f;e:for(;;)switch(y.mode){case p:if(y.wrap===0){y.mode=13;break}for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(2&y.wrap&&D===35615){F[y.check=0]=255&D,F[1]=D>>>8&255,y.check=o(y.check,F,2,0),B=D=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&D)<<8)+(D>>8))%31){R.msg="incorrect header check",y.mode=30;break}if((15&D)!=8){R.msg="unknown compression method",y.mode=30;break}if(B-=4,S=8+(15&(D>>>=4)),y.wbits===0)y.wbits=S;else if(S>y.wbits){R.msg="invalid window size",y.mode=30;break}y.dmax=1<<S,R.adler=y.check=1,y.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(y.flags=D,(255&y.flags)!=8){R.msg="unknown compression method",y.mode=30;break}if(57344&y.flags){R.msg="unknown header flags set",y.mode=30;break}y.head&&(y.head.text=D>>8&1),512&y.flags&&(F[0]=255&D,F[1]=D>>>8&255,y.check=o(y.check,F,2,0)),B=D=0,y.mode=3;case 3:for(;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.head&&(y.head.time=D),512&y.flags&&(F[0]=255&D,F[1]=D>>>8&255,F[2]=D>>>16&255,F[3]=D>>>24&255,y.check=o(y.check,F,4,0)),B=D=0,y.mode=4;case 4:for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.head&&(y.head.xflags=255&D,y.head.os=D>>8),512&y.flags&&(F[0]=255&D,F[1]=D>>>8&255,y.check=o(y.check,F,2,0)),B=D=0,y.mode=5;case 5:if(1024&y.flags){for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.length=D,y.head&&(y.head.extra_len=D),512&y.flags&&(F[0]=255&D,F[1]=D>>>8&255,y.check=o(y.check,F,2,0)),B=D=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&($<(K=y.length)&&(K=$),K&&(y.head&&(S=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),r.arraySet(y.head.extra,V,q,K,S)),512&y.flags&&(y.check=o(y.check,V,K,q)),$-=K,q+=K,y.length-=K),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if($===0)break e;for(K=0;S=V[q+K++],y.head&&S&&y.length<65536&&(y.head.name+=String.fromCharCode(S)),S&&K<$;);if(512&y.flags&&(y.check=o(y.check,V,K,q)),$-=K,q+=K,S)break e}else y.head&&(y.head.name=null);y.length=0,y.mode=8;case 8:if(4096&y.flags){if($===0)break e;for(K=0;S=V[q+K++],y.head&&S&&y.length<65536&&(y.head.comment+=String.fromCharCode(S)),S&&K<$;);if(512&y.flags&&(y.check=o(y.check,V,K,q)),$-=K,q+=K,S)break e}else y.head&&(y.head.comment=null);y.mode=9;case 9:if(512&y.flags){for(;B<16;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(D!==(65535&y.check)){R.msg="header crc mismatch",y.mode=30;break}B=D=0}y.head&&(y.head.hcrc=y.flags>>9&1,y.head.done=!0),R.adler=y.check=0,y.mode=12;break;case 10:for(;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}R.adler=y.check=x(D),B=D=0,y.mode=11;case 11:if(y.havedict===0)return R.next_out=ne,R.avail_out=ie,R.next_in=q,R.avail_in=$,y.hold=D,y.bits=B,2;R.adler=y.check=1,y.mode=12;case 12:if(M===5||M===6)break e;case 13:if(y.last){D>>>=7&B,B-=7&B,y.mode=27;break}for(;B<3;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}switch(y.last=1&D,B-=1,3&(D>>>=1)){case 0:y.mode=14;break;case 1:if(k(y),y.mode=20,M!==6)break;D>>>=2,B-=2;break e;case 2:y.mode=17;break;case 3:R.msg="invalid block type",y.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)){R.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&D,B=D=0,y.mode=15,M===6)break e;case 15:y.mode=16;case 16:if(K=y.length){if($<K&&(K=$),ie<K&&(K=ie),K===0)break e;r.arraySet(Q,V,q,K,ne),$-=K,q+=K,ie-=K,ne+=K,y.length-=K;break}y.mode=12;break;case 17:for(;B<14;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(y.nlen=257+(31&D),D>>>=5,B-=5,y.ndist=1+(31&D),D>>>=5,B-=5,y.ncode=4+(15&D),D>>>=4,B-=4,286<y.nlen||30<y.ndist){R.msg="too many length or distance symbols",y.mode=30;break}y.have=0,y.mode=18;case 18:for(;y.have<y.ncode;){for(;B<3;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.lens[X[y.have++]]=7&D,D>>>=3,B-=3}for(;y.have<19;)y.lens[X[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,W={bits:y.lenbits},G=u(0,y.lens,0,19,y.lencode,0,y.work,W),y.lenbits=W.bits,G){R.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have<y.nlen+y.ndist;){for(;Ae=(T=y.lencode[D&(1<<y.lenbits)-1])>>>16&255,Le=65535&T,!((re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(Le<16)D>>>=re,B-=re,y.lens[y.have++]=Le;else{if(Le===16){for(P=re+2;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(D>>>=re,B-=re,y.have===0){R.msg="invalid bit length repeat",y.mode=30;break}S=y.lens[y.have-1],K=3+(3&D),D>>>=2,B-=2}else if(Le===17){for(P=re+3;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}B-=re,S=0,K=3+(7&(D>>>=re)),D>>>=3,B-=3}else{for(P=re+7;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}B-=re,S=0,K=11+(127&(D>>>=re)),D>>>=7,B-=7}if(y.have+K>y.nlen+y.ndist){R.msg="invalid bit length repeat",y.mode=30;break}for(;K--;)y.lens[y.have++]=S}}if(y.mode===30)break;if(y.lens[256]===0){R.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,W={bits:y.lenbits},G=u(h,y.lens,0,y.nlen,y.lencode,0,y.work,W),y.lenbits=W.bits,G){R.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,W={bits:y.distbits},G=u(g,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,W),y.distbits=W.bits,G){R.msg="invalid distances set",y.mode=30;break}if(y.mode=20,M===6)break e;case 20:y.mode=21;case 21:if(6<=$&&258<=ie){R.next_out=ne,R.avail_out=ie,R.next_in=q,R.avail_in=$,y.hold=D,y.bits=B,a(R,O),ne=R.next_out,Q=R.output,ie=R.avail_out,q=R.next_in,V=R.input,$=R.avail_in,D=y.hold,B=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;Ae=(T=y.lencode[D&(1<<y.lenbits)-1])>>>16&255,Le=65535&T,!((re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(Ae&&!(240&Ae)){for(Pe=re,We=Ae,Oe=Le;Ae=(T=y.lencode[Oe+((D&(1<<Pe+We)-1)>>Pe)])>>>16&255,Le=65535&T,!(Pe+(re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}D>>>=Pe,B-=Pe,y.back+=Pe}if(D>>>=re,B-=re,y.back+=re,y.length=Le,Ae===0){y.mode=26;break}if(32&Ae){y.back=-1,y.mode=12;break}if(64&Ae){R.msg="invalid literal/length code",y.mode=30;break}y.extra=15&Ae,y.mode=22;case 22:if(y.extra){for(P=y.extra;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.length+=D&(1<<y.extra)-1,D>>>=y.extra,B-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;Ae=(T=y.distcode[D&(1<<y.distbits)-1])>>>16&255,Le=65535&T,!((re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(!(240&Ae)){for(Pe=re,We=Ae,Oe=Le;Ae=(T=y.distcode[Oe+((D&(1<<Pe+We)-1)>>Pe)])>>>16&255,Le=65535&T,!(Pe+(re=T>>>24)<=B);){if($===0)break e;$--,D+=V[q++]<<B,B+=8}D>>>=Pe,B-=Pe,y.back+=Pe}if(D>>>=re,B-=re,y.back+=re,64&Ae){R.msg="invalid distance code",y.mode=30;break}y.offset=Le,y.extra=15&Ae,y.mode=24;case 24:if(y.extra){for(P=y.extra;B<P;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}y.offset+=D&(1<<y.extra)-1,D>>>=y.extra,B-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){R.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(ie===0)break e;if(K=O-ie,y.offset>K){if((K=y.offset-K)>y.whave&&y.sane){R.msg="invalid distance too far back",y.mode=30;break}be=K>y.wnext?(K-=y.wnext,y.wsize-K):y.wnext-K,K>y.length&&(K=y.length),he=y.window}else he=Q,be=ne-y.offset,K=y.length;for(ie<K&&(K=ie),ie-=K,y.length-=K;Q[ne++]=he[be++],--K;);y.length===0&&(y.mode=21);break;case 26:if(ie===0)break e;Q[ne++]=y.length,ie--,y.mode=21;break;case 27:if(y.wrap){for(;B<32;){if($===0)break e;$--,D|=V[q++]<<B,B+=8}if(O-=ie,R.total_out+=O,y.total+=O,O&&(R.adler=y.check=y.flags?o(y.check,Q,O,ne-O):n(y.check,Q,O,ne-O)),O=ie,(y.flags?D:x(D))!==y.check){R.msg="incorrect data check",y.mode=30;break}B=D=0}y.mode=28;case 28:if(y.wrap&&y.flags){for(;B<32;){if($===0)break e;$--,D+=V[q++]<<B,B+=8}if(D!==(4294967295&y.total)){R.msg="incorrect length check",y.mode=30;break}B=D=0}y.mode=29;case 29:G=1;break e;case 30:G=-3;break e;case 31:return-4;case 32:default:return d}return R.next_out=ne,R.avail_out=ie,R.next_in=q,R.avail_in=$,y.hold=D,y.bits=B,(y.wsize||O!==R.avail_out&&y.mode<30&&(y.mode<27||M!==4))&&N(R,R.output,R.next_out,O-R.avail_out)?(y.mode=31,-4):(z-=R.avail_in,O-=R.avail_out,R.total_in+=z,R.total_out+=O,y.total+=O,y.wrap&&O&&(R.adler=y.check=y.flags?o(y.check,Q,O,R.next_out-O):n(y.check,Q,O,R.next_out-O)),R.data_type=y.bits+(y.last?64:0)+(y.mode===12?128:0)+(y.mode===20||y.mode===15?256:0),(z==0&&O===0||M===4)&&G===f&&(G=-5),G)},i.inflateEnd=function(R){if(!R||!R.state)return d;var M=R.state;return M.window&&(M.window=null),R.state=null,f},i.inflateGetHeader=function(R,M){var y;return R&&R.state&&2&(y=R.state).wrap?((y.head=M).done=!1,f):d},i.inflateSetDictionary=function(R,M){var y,V=M.length;return R&&R.state?(y=R.state).wrap!==0&&y.mode!==11?d:y.mode===11&&n(1,M,V,0)!==y.check?-3:N(R,M,V,V)?(y.mode=31,-4):(y.havedict=1,f):d},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var r=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],o=[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],a=[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,g,f,d,p,l,m,x){var v,b,w,_,C,E,I,L,k,N=x.bits,R=0,M=0,y=0,V=0,Q=0,q=0,ne=0,$=0,ie=0,D=0,B=null,z=0,O=new r.Buf16(16),K=new r.Buf16(16),be=null,he=0;for(R=0;R<=15;R++)O[R]=0;for(M=0;M<d;M++)O[g[f+M]]++;for(Q=N,V=15;1<=V&&O[V]===0;V--);if(V<Q&&(Q=V),V===0)return p[l++]=20971520,p[l++]=20971520,x.bits=1,0;for(y=1;y<V&&O[y]===0;y++);for(Q<y&&(Q=y),R=$=1;R<=15;R++)if($<<=1,($-=O[R])<0)return-1;if(0<$&&(h===0||V!==1))return-1;for(K[1]=0,R=1;R<15;R++)K[R+1]=K[R]+O[R];for(M=0;M<d;M++)g[f+M]!==0&&(m[K[g[f+M]]++]=M);if(E=h===0?(B=be=m,19):h===1?(B=n,z-=257,be=o,he-=257,256):(B=a,be=u,-1),R=y,C=l,ne=M=D=0,w=-1,_=(ie=1<<(q=Q))-1,h===1&&852<ie||h===2&&592<ie)return 1;for(;;){for(I=R-ne,k=m[M]<E?(L=0,m[M]):m[M]>E?(L=be[he+m[M]],B[z+m[M]]):(L=96,0),v=1<<R-ne,y=b=1<<q;p[C+(D>>ne)+(b-=v)]=I<<24|L<<16|k|0,b!==0;);for(v=1<<R-1;D&v;)v>>=1;if(v!==0?(D&=v-1,D+=v):D=0,M++,--O[R]==0){if(R===V)break;R=g[f+m[M]]}if(Q<R&&(D&_)!==w){for(ne===0&&(ne=Q),C+=y,$=1<<(q=R-ne);q+ne<V&&!(($-=O[q+ne])<=0);)q++,$<<=1;if(ie+=1<<q,h===1&&852<ie||h===2&&592<ie)return 1;p[w=D&_]=Q<<24|q<<16|C-l|0}}return D!==0&&(p[C+D]=R-ne<<24|64<<16|0),x.bits=Q,0}},{"../utils/common":41}],51:[function(e,t,i){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,i){var r=e("../utils/common"),n=0,o=1;function a(T){for(var F=T.length;0<=--F;)T[F]=0}var u=0,h=29,g=256,f=g+1+h,d=30,p=19,l=2*f+1,m=15,x=16,v=7,b=256,w=16,_=17,C=18,E=[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],I=[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],N=new Array(2*(f+2));a(N);var R=new Array(2*d);a(R);var M=new Array(512);a(M);var y=new Array(256);a(y);var V=new Array(h);a(V);var Q,q,ne,$=new Array(d);function ie(T,F,X,J,U){this.static_tree=T,this.extra_bits=F,this.extra_base=X,this.elems=J,this.max_length=U,this.has_stree=T&&T.length}function D(T,F){this.dyn_tree=T,this.max_code=0,this.stat_desc=F}function B(T){return T<256?M[T]:M[256+(T>>>7)]}function z(T,F){T.pending_buf[T.pending++]=255&F,T.pending_buf[T.pending++]=F>>>8&255}function O(T,F,X){T.bi_valid>x-X?(T.bi_buf|=F<<T.bi_valid&65535,z(T,T.bi_buf),T.bi_buf=F>>x-T.bi_valid,T.bi_valid+=X-x):(T.bi_buf|=F<<T.bi_valid&65535,T.bi_valid+=X)}function K(T,F,X){O(T,X[2*F],X[2*F+1])}function be(T,F){for(var X=0;X|=1&T,T>>>=1,X<<=1,0<--F;);return X>>>1}function he(T,F,X){var J,U,Y=new Array(m+1),pe=0;for(J=1;J<=m;J++)Y[J]=pe=pe+X[J-1]<<1;for(U=0;U<=F;U++){var ee=T[2*U+1];ee!==0&&(T[2*U]=be(Y[ee]++,ee))}}function re(T){var F;for(F=0;F<f;F++)T.dyn_ltree[2*F]=0;for(F=0;F<d;F++)T.dyn_dtree[2*F]=0;for(F=0;F<p;F++)T.bl_tree[2*F]=0;T.dyn_ltree[2*b]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function Ae(T){8<T.bi_valid?z(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 Le(T,F,X,J){var U=2*F,Y=2*X;return T[U]<T[Y]||T[U]===T[Y]&&J[F]<=J[X]}function Pe(T,F,X){for(var J=T.heap[X],U=X<<1;U<=T.heap_len&&(U<T.heap_len&&Le(F,T.heap[U+1],T.heap[U],T.depth)&&U++,!Le(F,J,T.heap[U],T.depth));)T.heap[X]=T.heap[U],X=U,U<<=1;T.heap[X]=J}function We(T,F,X){var J,U,Y,pe,ee=0;if(T.last_lit!==0)for(;J=T.pending_buf[T.d_buf+2*ee]<<8|T.pending_buf[T.d_buf+2*ee+1],U=T.pending_buf[T.l_buf+ee],ee++,J===0?K(T,U,F):(K(T,(Y=y[U])+g+1,F),(pe=E[Y])!==0&&O(T,U-=V[Y],pe),K(T,Y=B(--J),X),(pe=I[Y])!==0&&O(T,J-=$[Y],pe)),ee<T.last_lit;);K(T,b,F)}function Oe(T,F){var X,J,U,Y=F.dyn_tree,pe=F.stat_desc.static_tree,ee=F.stat_desc.has_stree,_e=F.stat_desc.elems,Te=-1;for(T.heap_len=0,T.heap_max=l,X=0;X<_e;X++)Y[2*X]!==0?(T.heap[++T.heap_len]=Te=X,T.depth[X]=0):Y[2*X+1]=0;for(;T.heap_len<2;)Y[2*(U=T.heap[++T.heap_len]=Te<2?++Te:0)]=1,T.depth[U]=0,T.opt_len--,ee&&(T.static_len-=pe[2*U+1]);for(F.max_code=Te,X=T.heap_len>>1;1<=X;X--)Pe(T,Y,X);for(U=_e;X=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Pe(T,Y,1),J=T.heap[1],T.heap[--T.heap_max]=X,T.heap[--T.heap_max]=J,Y[2*U]=Y[2*X]+Y[2*J],T.depth[U]=(T.depth[X]>=T.depth[J]?T.depth[X]:T.depth[J])+1,Y[2*X+1]=Y[2*J+1]=U,T.heap[1]=U++,Pe(T,Y,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],function(Re,nt){var Wt,Ke,Et,Ue,Zt,Hi,Ot=nt.dyn_tree,Hr=nt.max_code,zr=nt.stat_desc.static_tree,Fn=nt.stat_desc.has_stree,jr=nt.stat_desc.extra_bits,Wr=nt.stat_desc.extra_base,ui=nt.stat_desc.max_length,zi=0;for(Ue=0;Ue<=m;Ue++)Re.bl_count[Ue]=0;for(Ot[2*Re.heap[Re.heap_max]+1]=0,Wt=Re.heap_max+1;Wt<l;Wt++)ui<(Ue=Ot[2*Ot[2*(Ke=Re.heap[Wt])+1]+1]+1)&&(Ue=ui,zi++),Ot[2*Ke+1]=Ue,Hr<Ke||(Re.bl_count[Ue]++,Zt=0,Wr<=Ke&&(Zt=jr[Ke-Wr]),Hi=Ot[2*Ke],Re.opt_len+=Hi*(Ue+Zt),Fn&&(Re.static_len+=Hi*(zr[2*Ke+1]+Zt)));if(zi!==0){do{for(Ue=ui-1;Re.bl_count[Ue]===0;)Ue--;Re.bl_count[Ue]--,Re.bl_count[Ue+1]+=2,Re.bl_count[ui]--,zi-=2}while(0<zi);for(Ue=ui;Ue!==0;Ue--)for(Ke=Re.bl_count[Ue];Ke!==0;)Hr<(Et=Re.heap[--Wt])||(Ot[2*Et+1]!==Ue&&(Re.opt_len+=(Ue-Ot[2*Et+1])*Ot[2*Et],Ot[2*Et+1]=Ue),Ke--)}}(T,F),he(Y,Te,T.bl_count)}function S(T,F,X){var J,U,Y=-1,pe=F[1],ee=0,_e=7,Te=4;for(pe===0&&(_e=138,Te=3),F[2*(X+1)+1]=65535,J=0;J<=X;J++)U=pe,pe=F[2*(J+1)+1],++ee<_e&&U===pe||(ee<Te?T.bl_tree[2*U]+=ee:U!==0?(U!==Y&&T.bl_tree[2*U]++,T.bl_tree[2*w]++):ee<=10?T.bl_tree[2*_]++:T.bl_tree[2*C]++,Y=U,Te=(ee=0)===pe?(_e=138,3):U===pe?(_e=6,3):(_e=7,4))}function G(T,F,X){var J,U,Y=-1,pe=F[1],ee=0,_e=7,Te=4;for(pe===0&&(_e=138,Te=3),J=0;J<=X;J++)if(U=pe,pe=F[2*(J+1)+1],!(++ee<_e&&U===pe)){if(ee<Te)for(;K(T,U,T.bl_tree),--ee!=0;);else U!==0?(U!==Y&&(K(T,U,T.bl_tree),ee--),K(T,w,T.bl_tree),O(T,ee-3,2)):ee<=10?(K(T,_,T.bl_tree),O(T,ee-3,3)):(K(T,C,T.bl_tree),O(T,ee-11,7));Y=U,Te=(ee=0)===pe?(_e=138,3):U===pe?(_e=6,3):(_e=7,4)}}a($);var W=!1;function P(T,F,X,J){O(T,(u<<1)+(J?1:0),3),function(U,Y,pe,ee){Ae(U),ee&&(z(U,pe),z(U,~pe)),r.arraySet(U.pending_buf,U.window,Y,pe,U.pending),U.pending+=pe}(T,F,X,!0)}i._tr_init=function(T){W||(function(){var F,X,J,U,Y,pe=new Array(m+1);for(U=J=0;U<h-1;U++)for(V[U]=J,F=0;F<1<<E[U];F++)y[J++]=U;for(y[J-1]=U,U=Y=0;U<16;U++)for($[U]=Y,F=0;F<1<<I[U];F++)M[Y++]=U;for(Y>>=7;U<d;U++)for($[U]=Y<<7,F=0;F<1<<I[U]-7;F++)M[256+Y++]=U;for(X=0;X<=m;X++)pe[X]=0;for(F=0;F<=143;)N[2*F+1]=8,F++,pe[8]++;for(;F<=255;)N[2*F+1]=9,F++,pe[9]++;for(;F<=279;)N[2*F+1]=7,F++,pe[7]++;for(;F<=287;)N[2*F+1]=8,F++,pe[8]++;for(he(N,f+1,pe),F=0;F<d;F++)R[2*F+1]=5,R[2*F]=be(F,5);Q=new ie(N,E,g+1,f,m),q=new ie(R,I,0,d,m),ne=new ie(new Array(0),L,0,p,v)}(),W=!0),T.l_desc=new D(T.dyn_ltree,Q),T.d_desc=new D(T.dyn_dtree,q),T.bl_desc=new D(T.bl_tree,ne),T.bi_buf=0,T.bi_valid=0,re(T)},i._tr_stored_block=P,i._tr_flush_block=function(T,F,X,J){var U,Y,pe=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=function(ee){var _e,Te=4093624447;for(_e=0;_e<=31;_e++,Te>>>=1)if(1&Te&&ee.dyn_ltree[2*_e]!==0)return n;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return o;for(_e=32;_e<g;_e++)if(ee.dyn_ltree[2*_e]!==0)return o;return n}(T)),Oe(T,T.l_desc),Oe(T,T.d_desc),pe=function(ee){var _e;for(S(ee,ee.dyn_ltree,ee.l_desc.max_code),S(ee,ee.dyn_dtree,ee.d_desc.max_code),Oe(ee,ee.bl_desc),_e=p-1;3<=_e&&ee.bl_tree[2*k[_e]+1]===0;_e--);return ee.opt_len+=3*(_e+1)+5+5+4,_e}(T),U=T.opt_len+3+7>>>3,(Y=T.static_len+3+7>>>3)<=U&&(U=Y)):U=Y=X+5,X+4<=U&&F!==-1?P(T,F,X,J):T.strategy===4||Y===U?(O(T,2+(J?1:0),3),We(T,N,R)):(O(T,4+(J?1:0),3),function(ee,_e,Te,Re){var nt;for(O(ee,_e-257,5),O(ee,Te-1,5),O(ee,Re-4,4),nt=0;nt<Re;nt++)O(ee,ee.bl_tree[2*k[nt]+1],3);G(ee,ee.dyn_ltree,_e-1),G(ee,ee.dyn_dtree,Te-1)}(T,T.l_desc.max_code+1,T.d_desc.max_code+1,pe+1),We(T,T.dyn_ltree,T.dyn_dtree)),re(T),J&&Ae(T)},i._tr_tally=function(T,F,X){return T.pending_buf[T.d_buf+2*T.last_lit]=F>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&F,T.pending_buf[T.l_buf+T.last_lit]=255&X,T.last_lit++,F===0?T.dyn_ltree[2*X]++:(T.matches++,F--,T.dyn_ltree[2*(y[X]+g+1)]++,T.dyn_dtree[2*B(F)]++),T.last_lit===T.lit_bufsize-1},i._tr_align=function(T){O(T,2,3),K(T,b,N),function(F){F.bi_valid===16?(z(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)}(T)}},{"../utils/common":41}],53:[function(e,t,i){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,i){(function(r){(function(n,o){if(!n.setImmediate){var a,u,h,g,f=1,d={},p=!1,l=n.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(n);m=m&&m.setTimeout?m:n,a={}.toString.call(n.process)==="[object process]"?function(w){process.nextTick(function(){v(w)})}:function(){if(n.postMessage&&!n.importScripts){var w=!0,_=n.onmessage;return n.onmessage=function(){w=!1},n.postMessage("","*"),n.onmessage=_,w}}()?(g="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",b,!1):n.attachEvent("onmessage",b),function(w){n.postMessage(g+w,"*")}):n.MessageChannel?((h=new MessageChannel).port1.onmessage=function(w){v(w.data)},function(w){h.port2.postMessage(w)}):l&&"onreadystatechange"in l.createElement("script")?(u=l.documentElement,function(w){var _=l.createElement("script");_.onreadystatechange=function(){v(w),_.onreadystatechange=null,u.removeChild(_),_=null},u.appendChild(_)}):function(w){setTimeout(v,0,w)},m.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var _=new Array(arguments.length-1),C=0;C<_.length;C++)_[C]=arguments[C+1];var E={callback:w,args:_};return d[f]=E,a(f),f++},m.clearImmediate=x}function x(w){delete d[w]}function v(w){if(p)setTimeout(v,0,w);else{var _=d[w];if(_){p=!0;try{(function(C){var E=C.callback,I=C.args;switch(I.length){case 0:E();break;case 1:E(I[0]);break;case 2:E(I[0],I[1]);break;case 3:E(I[0],I[1],I[2]);break;default:E.apply(o,I)}})(_)}finally{x(w),p=!1}}}}function b(w){w.source===n&&typeof w.data=="string"&&w.data.indexOf(g)===0&&v(+w.data.slice(g.length))}})(typeof self=="undefined"?r===void 0?this:r:self)}).call(this,typeof Ie!="undefined"?Ie:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[10])(10)})})(ua);var Yc=ua.exports;const Qc=ca(Yc),as=(s,c)=>c.some(e=>s instanceof e);let ha,la;function e0(){return ha||(ha=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function t0(){return la||(la=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const os=new WeakMap,cs=new WeakMap,dr=new WeakMap;function i0(s){const c=new Promise((e,t)=>{const i=()=>{s.removeEventListener("success",r),s.removeEventListener("error",n)},r=()=>{e(pi(s.result)),i()},n=()=>{t(s.error),i()};s.addEventListener("success",r),s.addEventListener("error",n)});return dr.set(c,s),c}function r0(s){if(os.has(s))return;const c=new Promise((e,t)=>{const i=()=>{s.removeEventListener("complete",r),s.removeEventListener("error",n),s.removeEventListener("abort",n)},r=()=>{e(),i()},n=()=>{t(s.error||new DOMException("AbortError","AbortError")),i()};s.addEventListener("complete",r),s.addEventListener("error",n),s.addEventListener("abort",n)});os.set(s,c)}let us={get(s,c,e){if(s instanceof IDBTransaction){if(c==="done")return os.get(s);if(c==="store")return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return pi(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 da(s){us=s(us)}function s0(s){return t0().includes(s)?function(...c){return s.apply(hs(this),c),pi(this.request)}:function(...c){return pi(s.apply(hs(this),c))}}function n0(s){return typeof s=="function"?s0(s):(s instanceof IDBTransaction&&r0(s),as(s,e0())?new Proxy(s,us):s)}function pi(s){if(s instanceof IDBRequest)return i0(s);if(cs.has(s))return cs.get(s);const c=n0(s);return c!==s&&(cs.set(s,c),dr.set(c,s)),c}const hs=s=>dr.get(s);function a0(s,c,{blocked:e,upgrade:t,blocking:i,terminated:r}={}){const n=indexedDB.open(s,c),o=pi(n);return t&&n.addEventListener("upgradeneeded",a=>{t(pi(n.result),a.oldVersion,a.newVersion,pi(n.transaction),a)}),e&&n.addEventListener("blocked",a=>e(a.oldVersion,a.newVersion,a)),o.then(a=>{r&&a.addEventListener("close",()=>r()),i&&a.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),o}const o0=["get","getKey","getAll","getAllKeys","count"],c0=["put","add","delete","clear"],ls=new Map;function fa(s,c){if(!(s instanceof IDBDatabase&&!(c in s)&&typeof c=="string"))return;if(ls.get(c))return ls.get(c);const e=c.replace(/FromIndex$/,""),t=c!==e,i=c0.includes(e);if(!(e in(t?IDBIndex:IDBObjectStore).prototype)||!(i||o0.includes(e)))return;const r=function(n,...o){return H(this,null,function*(){const a=this.transaction(n,i?"readwrite":"readonly");let u=a.store;return t&&(u=u.index(o.shift())),(yield Promise.all([u[e](...o),i&&a.done]))[0]})};return ls.set(c,r),r}da(s=>Yt(Ce({},s),{get:(c,e,t)=>fa(c,e)||s.get(c,e,t),has:(c,e)=>!!fa(c,e)||s.has(c,e)}));const u0=["continue","continuePrimaryKey","advance"],pa={},ds=new WeakMap,ma=new WeakMap,h0={get(s,c){if(!u0.includes(c))return s[c];let e=pa[c];return e||(e=pa[c]=function(...t){ds.set(this,ma.get(this)[c](...t))}),e}};function l0(...s){return yc(this,null,function*(){let c=this;if(c instanceof IDBCursor||(c=yield new qr(c.openCursor(...s))),!c)return;c=c;const e=new Proxy(c,h0);for(ma.set(e,c),dr.set(e,hs(c));c;)yield e,c=yield new qr(ds.get(e)||c.continue()),ds.delete(e)})}function ga(s,c){return c===Symbol.asyncIterator&&as(s,[IDBIndex,IDBObjectStore,IDBCursor])||c==="iterate"&&as(s,[IDBIndex,IDBObjectStore])}da(s=>Yt(Ce({},s),{get(c,e,t){return ga(c,e)?l0:s.get(c,e,t)},has(c,e){return ga(c,e)||s.has(c,e)}}));const d0="AliRTCLog",fr="AliRTCSessiones",pr="AliRTCLogs",f0=()=>H(this,null,function*(){return yield a0(d0,1,{upgrade:c=>{c.createObjectStore(fr,{keyPath:"sid"}).createIndex("sid","sid",{unique:!0});const t=c.createObjectStore(pr,{keyPath:"id",autoIncrement:!0});t.createIndex("sid","sid",{unique:!1}),t.createIndex("date","date",{unique:!1})}})}),p0=(s,c)=>H(this,null,function*(){yield s.add(fr,{sid:c})}),va=(s,c,e,t)=>H(this,null,function*(){yield s.add(pr,{sid:c,log:t,date:e})}),xa=(s,c)=>H(this,null,function*(){return yield s.getAllFromIndex(pr,"sid",c)}),m0=s=>H(this,null,function*(){return yield s.getAllFromIndex(fr,"sid")}),g0=(s,c)=>H(this,null,function*(){yield s.delete(pr,c)}),v0=(s,c)=>H(this,null,function*(){yield s.delete(fr,c)}),ba=((uc=typeof globalThis!="undefined"?globalThis:void 0)==null?void 0:uc.crypto)||((hc=typeof global!="undefined"?global:void 0)==null?void 0:hc.crypto)||((lc=typeof window!="undefined"?window:void 0)==null?void 0:lc.crypto)||((dc=typeof self!="undefined"?self:void 0)==null?void 0:dc.crypto)||((pc=(fc=typeof frames!="undefined"?frames:void 0)==null?void 0:fc[0])==null?void 0:pc.crypto);let fs;ba?fs=s=>{const c=[];for(let e=0,t;e<s;e+=4)c.push(ba.getRandomValues(new Uint32Array(1))[0]);return new Lt(c,s)}:fs=s=>{const c=[],e=t=>{let i=t,r=987654321;const n=4294967295;return()=>{r=36969*(r&65535)+(r>>16)&n,i=18e3*(i&65535)+(i>>16)&n;let o=(r<<16)+i&n;return o/=4294967296,o+=.5,o*(Math.random()>.5?1:-1)}};for(let t=0,i;t<s;t+=4){const r=e((i||Math.random())*4294967296);i=r()*987654071,c.push(r()*4294967296|0)}return new Lt(c,s)};class mr{static create(...c){return new this(...c)}mixIn(c){return Object.assign(this,c)}clone(){const c=new this.constructor;return Object.assign(c,this),c}}class Lt extends mr{constructor(c=[],e=c.length*4){super();let t=c;if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){const i=t.byteLength,r=[];for(let n=0;n<i;n+=1)r[n>>>2]|=t[n]<<24-n%4*8;this.words=r,this.sigBytes=i}else this.words=c,this.sigBytes=e}toString(c=x0){return c.stringify(this)}concat(c){const e=this.words,t=c.words,i=this.sigBytes,r=c.sigBytes;if(this.clamp(),i%4)for(let n=0;n<r;n+=1){const o=t[n>>>2]>>>24-n%4*8&255;e[i+n>>>2]|=o<<24-(i+n)%4*8}else for(let n=0;n<r;n+=4)e[i+n>>>2]=t[n>>>2];return this.sigBytes+=r,this}clamp(){const{words:c,sigBytes:e}=this;c[e>>>2]&=4294967295<<32-e%4*8,c.length=Math.ceil(e/4)}clone(){const c=super.clone.call(this);return c.words=this.words.slice(0),c}}A(Lt,"random",fs);const x0={stringify(s){const{words:c,sigBytes:e}=s,t=[];for(let i=0;i<e;i+=1){const r=c[i>>>2]>>>24-i%4*8&255;t.push((r>>>4).toString(16)),t.push((r&15).toString(16))}return t.join("")},parse(s){const c=s.length,e=[];for(let t=0;t<c;t+=2)e[t>>>3]|=parseInt(s.substr(t,2),16)<<24-t%8*4;return new Lt(e,c/2)}},Sa={stringify(s){const{words:c,sigBytes:e}=s,t=[];for(let i=0;i<e;i+=1){const r=c[i>>>2]>>>24-i%4*8&255;t.push(String.fromCharCode(r))}return t.join("")},parse(s){const c=s.length,e=[];for(let t=0;t<c;t+=1)e[t>>>2]|=(s.charCodeAt(t)&255)<<24-t%4*8;return new Lt(e,c)}},_a={stringify(s){try{return decodeURIComponent(escape(Sa.stringify(s)))}catch(c){throw new Error("Malformed UTF-8 data")}},parse(s){return Sa.parse(unescape(encodeURIComponent(s)))}};class b0 extends mr{constructor(){super(),this._minBufferSize=0}reset(){this._data=new Lt,this._nDataBytes=0}_append(c){let e=c;typeof e=="string"&&(e=_a.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(c){let e;const{_data:t,blockSize:i}=this,r=t.words,n=t.sigBytes,o=i*4;let a=n/o;c?a=Math.ceil(a):a=Math.max((a|0)-this._minBufferSize,0);const u=a*i,h=Math.min(u*4,n);if(u){for(let g=0;g<u;g+=i)this._doProcessBlock(r,g);e=r.splice(0,u),t.sigBytes-=h}return new Lt(e,h)}clone(){const c=super.clone.call(this);return c._data=this._data.clone(),c}}class gr extends b0{constructor(c){super(),this.blockSize=512/32,this.cfg=Object.assign(new mr,c),this.reset()}static _createHelper(c){return(e,t)=>new c(t).finalize(e)}static _createHmacHelper(c){return(e,t)=>new S0(c,t).finalize(e)}reset(){super.reset.call(this),this._doReset()}update(c){return this._append(c),this._process(),this}finalize(c){return c&&this._append(c),this._doFinalize()}}class S0 extends mr{constructor(c,e){super();const t=new c;this._hasher=t;let i=e;typeof i=="string"&&(i=_a.parse(i));const r=t.blockSize,n=r*4;i.sigBytes>n&&(i=t.finalize(e)),i.clamp();const o=i.clone();this._oKey=o;const a=i.clone();this._iKey=a;const u=o.words,h=a.words;for(let g=0;g<r;g+=1)u[g]^=1549556828,h[g]^=909522486;o.sigBytes=n,a.sigBytes=n,this.reset()}reset(){const c=this._hasher;c.reset(),c.update(this._iKey)}update(c){return this._hasher.update(c),this}finalize(c){const e=this._hasher,t=e.finalize(c);return e.reset(),e.finalize(this._oKey.clone().concat(t))}}const mi=[];class _0 extends gr{_doReset(){this._hash=new Lt([1732584193,4023233417,2562383102,271733878,3285377520])}_doProcessBlock(c,e){const t=this._hash.words;let i=t[0],r=t[1],n=t[2],o=t[3],a=t[4];for(let u=0;u<80;u+=1){if(u<16)mi[u]=c[e+u]|0;else{const g=mi[u-3]^mi[u-8]^mi[u-14]^mi[u-16];mi[u]=g<<1|g>>>31}let h=(i<<5|i>>>27)+a+mi[u];u<20?h+=(r&n|~r&o)+1518500249:u<40?h+=(r^n^o)+1859775393:u<60?h+=(r&n|r&o|n&o)-1894007588:h+=(r^n^o)-899497514,a=o,o=n,n=r<<30|r>>>2,r=i,i=h}t[0]=t[0]+i|0,t[1]=t[1]+r|0,t[2]=t[2]+n|0,t[3]=t[3]+o|0,t[4]=t[4]+a|0}_doFinalize(){const c=this._data,e=c.words,t=this._nDataBytes*8,i=c.sigBytes*8;return e[i>>>5]|=128<<24-i%32,e[(i+64>>>9<<4)+14]=Math.floor(t/4294967296),e[(i+64>>>9<<4)+15]=t,c.sigBytes=e.length*4,this._process(),this._hash}clone(){const c=super.clone.call(this);return c._hash=this._hash.clone(),c}}const y0=gr._createHmacHelper(_0),Se=[];for(let s=0;s<64;s+=1)Se[s]=Math.abs(Math.sin(s+1))*4294967296|0;const at=(s,c,e,t,i,r,n)=>{const o=s+(c&e|~c&t)+i+n;return(o<<r|o>>>32-r)+c},ot=(s,c,e,t,i,r,n)=>{const o=s+(c&t|e&~t)+i+n;return(o<<r|o>>>32-r)+c},ct=(s,c,e,t,i,r,n)=>{const o=s+(c^e^t)+i+n;return(o<<r|o>>>32-r)+c},ut=(s,c,e,t,i,r,n)=>{const o=s+(e^(c|~t))+i+n;return(o<<r|o>>>32-r)+c};class w0 extends gr{_doReset(){this._hash=new Lt([1732584193,4023233417,2562383102,271733878])}_doProcessBlock(c,e){const t=c;for(let L=0;L<16;L+=1){const k=e+L,N=c[k];t[k]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}const i=this._hash.words,r=t[e+0],n=t[e+1],o=t[e+2],a=t[e+3],u=t[e+4],h=t[e+5],g=t[e+6],f=t[e+7],d=t[e+8],p=t[e+9],l=t[e+10],m=t[e+11],x=t[e+12],v=t[e+13],b=t[e+14],w=t[e+15];let _=i[0],C=i[1],E=i[2],I=i[3];_=at(_,C,E,I,r,7,Se[0]),I=at(I,_,C,E,n,12,Se[1]),E=at(E,I,_,C,o,17,Se[2]),C=at(C,E,I,_,a,22,Se[3]),_=at(_,C,E,I,u,7,Se[4]),I=at(I,_,C,E,h,12,Se[5]),E=at(E,I,_,C,g,17,Se[6]),C=at(C,E,I,_,f,22,Se[7]),_=at(_,C,E,I,d,7,Se[8]),I=at(I,_,C,E,p,12,Se[9]),E=at(E,I,_,C,l,17,Se[10]),C=at(C,E,I,_,m,22,Se[11]),_=at(_,C,E,I,x,7,Se[12]),I=at(I,_,C,E,v,12,Se[13]),E=at(E,I,_,C,b,17,Se[14]),C=at(C,E,I,_,w,22,Se[15]),_=ot(_,C,E,I,n,5,Se[16]),I=ot(I,_,C,E,g,9,Se[17]),E=ot(E,I,_,C,m,14,Se[18]),C=ot(C,E,I,_,r,20,Se[19]),_=ot(_,C,E,I,h,5,Se[20]),I=ot(I,_,C,E,l,9,Se[21]),E=ot(E,I,_,C,w,14,Se[22]),C=ot(C,E,I,_,u,20,Se[23]),_=ot(_,C,E,I,p,5,Se[24]),I=ot(I,_,C,E,b,9,Se[25]),E=ot(E,I,_,C,a,14,Se[26]),C=ot(C,E,I,_,d,20,Se[27]),_=ot(_,C,E,I,v,5,Se[28]),I=ot(I,_,C,E,o,9,Se[29]),E=ot(E,I,_,C,f,14,Se[30]),C=ot(C,E,I,_,x,20,Se[31]),_=ct(_,C,E,I,h,4,Se[32]),I=ct(I,_,C,E,d,11,Se[33]),E=ct(E,I,_,C,m,16,Se[34]),C=ct(C,E,I,_,b,23,Se[35]),_=ct(_,C,E,I,n,4,Se[36]),I=ct(I,_,C,E,u,11,Se[37]),E=ct(E,I,_,C,f,16,Se[38]),C=ct(C,E,I,_,l,23,Se[39]),_=ct(_,C,E,I,v,4,Se[40]),I=ct(I,_,C,E,r,11,Se[41]),E=ct(E,I,_,C,a,16,Se[42]),C=ct(C,E,I,_,g,23,Se[43]),_=ct(_,C,E,I,p,4,Se[44]),I=ct(I,_,C,E,x,11,Se[45]),E=ct(E,I,_,C,w,16,Se[46]),C=ct(C,E,I,_,o,23,Se[47]),_=ut(_,C,E,I,r,6,Se[48]),I=ut(I,_,C,E,f,10,Se[49]),E=ut(E,I,_,C,b,15,Se[50]),C=ut(C,E,I,_,h,21,Se[51]),_=ut(_,C,E,I,x,6,Se[52]),I=ut(I,_,C,E,a,10,Se[53]),E=ut(E,I,_,C,l,15,Se[54]),C=ut(C,E,I,_,n,21,Se[55]),_=ut(_,C,E,I,d,6,Se[56]),I=ut(I,_,C,E,w,10,Se[57]),E=ut(E,I,_,C,g,15,Se[58]),C=ut(C,E,I,_,v,21,Se[59]),_=ut(_,C,E,I,u,6,Se[60]),I=ut(I,_,C,E,m,10,Se[61]),E=ut(E,I,_,C,o,15,Se[62]),C=ut(C,E,I,_,p,21,Se[63]),i[0]=i[0]+_|0,i[1]=i[1]+C|0,i[2]=i[2]+E|0,i[3]=i[3]+I|0}_doFinalize(){const c=this._data,e=c.words,t=this._nDataBytes*8,i=c.sigBytes*8;e[i>>>5]|=128<<24-i%32;const r=Math.floor(t/4294967296),n=t;e[(i+64>>>9<<4)+15]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,e[(i+64>>>9<<4)+14]=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,c.sigBytes=(e.length+1)*4,this._process();const o=this._hash,a=o.words;for(let u=0;u<4;u+=1){const h=a[u];a[u]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}return o}clone(){const c=super.clone.call(this);return c._hash=this._hash.clone(),c}}const A0=gr._createHelper(w0),E0=(s,c,e)=>{const t=[];let i=0;for(let r=0;r<c;r+=1)if(r%4){const n=e[s.charCodeAt(r-1)]<<r%4*2,o=e[s.charCodeAt(r)]>>>6-r%4*2,a=n|o;t[i>>>2]|=a<<24-i%4*8,i+=1}return Lt.create(t,i)},ya={stringify(s){const{words:c,sigBytes:e}=s,t=this._map;s.clamp();const i=[];for(let n=0;n<e;n+=3){const o=c[n>>>2]>>>24-n%4*8&255,a=c[n+1>>>2]>>>24-(n+1)%4*8&255,u=c[n+2>>>2]>>>24-(n+2)%4*8&255,h=o<<16|a<<8|u;for(let g=0;g<4&&n+g*.75<e;g+=1)i.push(t.charAt(h>>>6*(3-g)&63))}const r=t.charAt(64);if(r)for(;i.length%4;)i.push(r);return i.join("")},parse(s){let c=s.length;const e=this._map;let t=this._reverseMap;if(!t){this._reverseMap=[],t=this._reverseMap;for(let r=0;r<e.length;r+=1)t[e.charCodeAt(r)]=r}const i=e.charAt(64);if(i){const r=s.indexOf(i);r!==-1&&(c=r)}return E0(s,c,t)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},C0=s=>H(this,null,function*(){const c=yield s.arrayBuffer(),e=A0(Lt.create(c));return ya.stringify(e)}),I0=function(c,e,t){const i="x-oss-",r={};let n=[c.toUpperCase(),e["content-md5"]||"",e["content-type"],e["x-oss-date"]];return Object.keys(e).forEach(o=>{const a=o.toLowerCase();a.indexOf(i)===0&&(r[a]=String(e[o]).trim())}),Object.keys(r).sort().forEach(o=>{n.push(`${o}:${r[o]}`)}),n.push(t),n.join(`
|
|
16
|
+
`)},R0=(s,c,e,t)=>H(this,null,function*(){const i=I0("PUT",e,t),r=ya.stringify(y0(i,c));return`OSS ${s}:${r}`});var k0=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,T0=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,D0=/[^-+\dA-Z]/g;function ps(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(wa[c]||c||wa.default);var i=c.slice(0,4);(i==="UTC:"||i==="GMT:")&&(c=c.slice(4),e=!0,i==="GMT:"&&(t=!0));var r=function(){return e?"getUTC":"get"},n=function(){return s[r()+"Date"]()},o=function(){return s[r()+"Day"]()},a=function(){return s[r()+"Month"]()},u=function(){return s[r()+"FullYear"]()},h=function(){return s[r()+"Hours"]()},g=function(){return s[r()+"Minutes"]()},f=function(){return s[r()+"Seconds"]()},d=function(){return s[r()+"Milliseconds"]()},p=function(){return e?0:s.getTimezoneOffset()},l=function(){return B0(s)},m=function(){return P0(s)},x={d:function(){return n()},dd:function(){return St(n())},ddd:function(){return mt.dayNames[o()]},DDD:function(){return Aa({y:u(),m:a(),d:n(),_:r(),dayName:mt.dayNames[o()],short:!0})},dddd:function(){return mt.dayNames[o()+7]},DDDD:function(){return Aa({y:u(),m:a(),d:n(),_:r(),dayName:mt.dayNames[o()+7]})},m:function(){return a()+1},mm:function(){return St(a()+1)},mmm:function(){return mt.monthNames[a()]},mmmm:function(){return mt.monthNames[a()+12]},yy:function(){return String(u()).slice(2)},yyyy:function(){return St(u(),4)},h:function(){return h()%12||12},hh:function(){return St(h()%12||12)},H:function(){return h()},HH:function(){return St(h())},M:function(){return g()},MM:function(){return St(g())},s:function(){return f()},ss:function(){return St(f())},l:function(){return St(d(),3)},L:function(){return St(Math.floor(d()/10))},t:function(){return h()<12?mt.timeNames[0]:mt.timeNames[1]},tt:function(){return h()<12?mt.timeNames[2]:mt.timeNames[3]},T:function(){return h()<12?mt.timeNames[4]:mt.timeNames[5]},TT:function(){return h()<12?mt.timeNames[6]:mt.timeNames[7]},Z:function(){return t?"GMT":e?"UTC":L0(s)},o:function(){return(p()>0?"-":"+")+St(Math.floor(Math.abs(p())/60)*100+Math.abs(p())%60,4)},p:function(){return(p()>0?"-":"+")+St(Math.floor(Math.abs(p())/60),2)+":"+St(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 St(l())},N:function(){return m()}};return c.replace(k0,function(v){return v in x?x[v]():v.slice(1,v.length-1)})}var wa={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"},mt={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"]},St=function(c){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(c).padStart(e,"0")},Aa=function(c){var e=c.y,t=c.m,i=c.d,r=c._,n=c.dayName,o=c.short,a=o===void 0?!1:o,u=new Date,h=new Date;h.setDate(h[r+"Date"]()-1);var g=new Date;g.setDate(g[r+"Date"]()+1);var f=function(){return u[r+"Date"]()},d=function(){return u[r+"Month"]()},p=function(){return u[r+"FullYear"]()},l=function(){return h[r+"Date"]()},m=function(){return h[r+"Month"]()},x=function(){return h[r+"FullYear"]()},v=function(){return g[r+"Date"]()},b=function(){return g[r+"Month"]()},w=function(){return g[r+"FullYear"]()};return p()===e&&d()===t&&f()===i?a?"Tdy":"Today":x()===e&&m()===t&&l()===i?a?"Ysd":"Yesterday":w()===e&&b()===t&&v()===i?a?"Tmw":"Tomorrow":n},B0=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 i=e.getTimezoneOffset()-t.getTimezoneOffset();e.setHours(e.getHours()-i);var r=(e-t)/(864e5*7);return 1+Math.floor(r)},P0=function(c){var e=c.getDay();return e===0&&(e=7),e},L0=function(c){return(String(c).match(T0)||[""]).pop().replace(D0,"").replace(/GMT\+0000/g,"UTC")};function Ea(s,c,e){Object.defineProperty(s,c,{writable:!0,enumerable:!0,configurable:!0,value:e})}function Ca(s,c,e,t){t?t(()=>{Ea(s,c,e)}):Ea(s,c,e)}Array(32);class M0{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 N0=(s,c,e)=>new Promise((t,i)=>{var r=a=>{try{o(e.next(a))}catch(u){i(u)}},n=a=>{try{o(e.throw(a))}catch(u){i(u)}},o=a=>a.done?t(a.value):Promise.resolve(a.value).then(r,n);o((e=e.apply(s,c)).next())});function F0(s,c){return navigator&&navigator.sendBeacon?navigator.sendBeacon(`${s}?APIVersion=0.6.0`,c):!1}function Ia(s,c){const e=new window.XMLHttpRequest;e.open("POST",`${s}?APIVersion=0.6.0`,!0),e.send(c)}function O0(s,c){try{if(c.length>=32768){Ia(s,c);return}F0(s,c)||Ia(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:
|
|
17
|
+
`+e),console.error("Failed log data:",s))}}function V0(s,c,e){return N0(this,null,function*(){try{s=s.slice(0,-6);const{data:t,header:i}=yield e.process(s,c),r=new window.XMLHttpRequest;r.open("POST",s,!0);for(let n in i)r.setRequestHeader(n,i[n]);r.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:
|
|
18
|
+
`+t),console.error("Failed log data:",s))}})}class Ra extends M0{constructor(c){const e=Object.assign({},c,{installUnloadHook:t=>{window.addEventListener("beforeunload",()=>{t()})},sendPayload:(t,i)=>{O0(t,i)}});super(e)}useStsPlugin(c){this.getOpt().sendPayload=(e,t)=>{V0(e,t,c)},this.overwriteTransString(c)}}Ca(window,"SLS_Tracker",Ra);var ka={exports:{}},ms={exports:{}};const U0=Zc(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ta;function De(){return Ta||(Ta=1,function(s,c){(function(e,t){s.exports=t()})(Ie,function(){var e=e||function(t,i){var r;if(typeof window!="undefined"&&window.crypto&&(r=window.crypto),typeof self!="undefined"&&self.crypto&&(r=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window!="undefined"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof Ie!="undefined"&&Ie.crypto&&(r=Ie.crypto),!r&&typeof Wi=="function")try{r=U0}catch(v){}var n=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch(v){}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch(v){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function v(){}return function(b){var w;return v.prototype=b,w=new v,v.prototype=null,w}}(),a={},u=a.lib={},h=u.Base=function(){return{extend:function(v){var b=o(this);return v&&b.mixIn(v),(!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 v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var b in v)v.hasOwnProperty(b)&&(this[b]=v[b]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=u.WordArray=h.extend({init:function(v,b){v=this.words=v||[],b!=i?this.sigBytes=b:this.sigBytes=v.length*4},toString:function(v){return(v||d).stringify(this)},concat:function(v){var b=this.words,w=v.words,_=this.sigBytes,C=v.sigBytes;if(this.clamp(),_%4)for(var E=0;E<C;E++){var I=w[E>>>2]>>>24-E%4*8&255;b[_+E>>>2]|=I<<24-(_+E)%4*8}else for(var L=0;L<C;L+=4)b[_+L>>>2]=w[L>>>2];return this.sigBytes+=C,this},clamp:function(){var v=this.words,b=this.sigBytes;v[b>>>2]&=4294967295<<32-b%4*8,v.length=t.ceil(b/4)},clone:function(){var v=h.clone.call(this);return v.words=this.words.slice(0),v},random:function(v){for(var b=[],w=0;w<v;w+=4)b.push(n());return new g.init(b,v)}}),f=a.enc={},d=f.Hex={stringify:function(v){for(var b=v.words,w=v.sigBytes,_=[],C=0;C<w;C++){var E=b[C>>>2]>>>24-C%4*8&255;_.push((E>>>4).toString(16)),_.push((E&15).toString(16))}return _.join("")},parse:function(v){for(var b=v.length,w=[],_=0;_<b;_+=2)w[_>>>3]|=parseInt(v.substr(_,2),16)<<24-_%8*4;return new g.init(w,b/2)}},p=f.Latin1={stringify:function(v){for(var b=v.words,w=v.sigBytes,_=[],C=0;C<w;C++){var E=b[C>>>2]>>>24-C%4*8&255;_.push(String.fromCharCode(E))}return _.join("")},parse:function(v){for(var b=v.length,w=[],_=0;_<b;_++)w[_>>>2]|=(v.charCodeAt(_)&255)<<24-_%4*8;return new g.init(w,b)}},l=f.Utf8={stringify:function(v){try{return decodeURIComponent(escape(p.stringify(v)))}catch(b){throw new Error("Malformed UTF-8 data")}},parse:function(v){return p.parse(unescape(encodeURIComponent(v)))}},m=u.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(v){typeof v=="string"&&(v=l.parse(v)),this._data.concat(v),this._nDataBytes+=v.sigBytes},_process:function(v){var b,w=this._data,_=w.words,C=w.sigBytes,E=this.blockSize,I=E*4,L=C/I;v?L=t.ceil(L):L=t.max((L|0)-this._minBufferSize,0);var k=L*E,N=t.min(k*4,C);if(k){for(var R=0;R<k;R+=E)this._doProcessBlock(_,R);b=_.splice(0,k),w.sigBytes-=N}return new g.init(b,N)},clone:function(){var v=h.clone.call(this);return v._data=this._data.clone(),v},_minBufferSize:0});u.Hasher=m.extend({cfg:h.extend(),init:function(v){this.cfg=this.cfg.extend(v),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(v){return this._append(v),this._process(),this},finalize:function(v){v&&this._append(v);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(v){return function(b,w){return new v.init(w).finalize(b)}},_createHmacHelper:function(v){return function(b,w){return new x.HMAC.init(v,w).finalize(b)}}});var x=a.algo={};return a}(Math);return e})}(ms)),ms.exports}var gs={exports:{}},Da;function vr(){return Da||(Da=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.Base,o=r.WordArray,a=i.x64={};a.Word=n.extend({init:function(u,h){this.high=u,this.low=h}}),a.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,g=[],f=0;f<h;f++){var d=u[f];g.push(d.high),g.push(d.low)}return o.create(g,this.sigBytes)},clone:function(){for(var u=n.clone.call(this),h=u.words=this.words.slice(0),g=h.length,f=0;f<g;f++)h[f]=h[f].clone();return u}})}(),e})}(gs)),gs.exports}var vs={exports:{}},Ba;function H0(){return Ba||(Ba=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){if(typeof ArrayBuffer=="function"){var t=e,i=t.lib,r=i.WordArray,n=r.init,o=r.init=function(a){if(a instanceof ArrayBuffer&&(a=new Uint8Array(a)),(a instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&a instanceof Uint8ClampedArray||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array)&&(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength)),a instanceof Uint8Array){for(var u=a.byteLength,h=[],g=0;g<u;g++)h[g>>>2]|=a[g]<<24-g%4*8;n.call(this,h,u)}else n.apply(this,arguments)};o.prototype=r}}(),e.lib.WordArray})}(vs)),vs.exports}var xs={exports:{}},Pa;function z0(){return Pa||(Pa=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Utf16=n.Utf16BE={stringify:function(a){for(var u=a.words,h=a.sigBytes,g=[],f=0;f<h;f+=2){var d=u[f>>>2]>>>16-f%4*8&65535;g.push(String.fromCharCode(d))}return g.join("")},parse:function(a){for(var u=a.length,h=[],g=0;g<u;g++)h[g>>>1]|=a.charCodeAt(g)<<16-g%2*16;return r.create(h,u*2)}},n.Utf16LE={stringify:function(a){for(var u=a.words,h=a.sigBytes,g=[],f=0;f<h;f+=2){var d=o(u[f>>>2]>>>16-f%4*8&65535);g.push(String.fromCharCode(d))}return g.join("")},parse:function(a){for(var u=a.length,h=[],g=0;g<u;g++)h[g>>>1]|=o(a.charCodeAt(g)<<16-g%2*16);return r.create(h,u*2)}};function o(a){return a<<8&4278255360|a>>>8&16711935}}(),e.enc.Utf16})}(xs)),xs.exports}var bs={exports:{}},La;function gi(){return La||(La=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Base64={stringify:function(a){var u=a.words,h=a.sigBytes,g=this._map;a.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,v=0;v<4&&d+v*.75<h;v++)f.push(g.charAt(x>>>6*(3-v)&63));var b=g.charAt(64);if(b)for(;f.length%4;)f.push(b);return f.join("")},parse:function(a){var u=a.length,h=this._map,g=this._reverseMap;if(!g){g=this._reverseMap=[];for(var f=0;f<h.length;f++)g[h.charCodeAt(f)]=f}var d=h.charAt(64);if(d){var p=a.indexOf(d);p!==-1&&(u=p)}return o(a,u,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(a,u,h){for(var g=[],f=0,d=0;d<u;d++)if(d%4){var p=h[a.charCodeAt(d-1)]<<d%4*2,l=h[a.charCodeAt(d)]>>>6-d%4*2,m=p|l;g[f>>>2]|=m<<24-f%4*8,f++}return r.create(g,f)}}(),e.enc.Base64})}(bs)),bs.exports}var Ss={exports:{}},Ma;function j0(){return Ma||(Ma=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Base64url={stringify:function(a,u){u===void 0&&(u=!0);var h=a.words,g=a.sigBytes,f=u?this._safe_map:this._map;a.clamp();for(var d=[],p=0;p<g;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,v=l<<16|m<<8|x,b=0;b<4&&p+b*.75<g;b++)d.push(f.charAt(v>>>6*(3-b)&63));var w=f.charAt(64);if(w)for(;d.length%4;)d.push(w);return d.join("")},parse:function(a,u){u===void 0&&(u=!0);var h=a.length,g=u?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var d=0;d<g.length;d++)f[g.charCodeAt(d)]=d}var p=g.charAt(64);if(p){var l=a.indexOf(p);l!==-1&&(h=l)}return o(a,h,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function o(a,u,h){for(var g=[],f=0,d=0;d<u;d++)if(d%4){var p=h[a.charCodeAt(d-1)]<<d%4*2,l=h[a.charCodeAt(d)]>>>6-d%4*2,m=p|l;g[f>>>2]|=m<<24-f%4*8,f++}return r.create(g,f)}}(),e.enc.Base64url})}(Ss)),Ss.exports}var _s={exports:{}},Na;function vi(){return Na||(Na=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.algo,u=[];(function(){for(var l=0;l<64;l++)u[l]=t.abs(t.sin(l+1))*4294967296|0})();var h=a.MD5=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(l,m){for(var x=0;x<16;x++){var v=m+x,b=l[v];l[v]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}var w=this._hash.words,_=l[m+0],C=l[m+1],E=l[m+2],I=l[m+3],L=l[m+4],k=l[m+5],N=l[m+6],R=l[m+7],M=l[m+8],y=l[m+9],V=l[m+10],Q=l[m+11],q=l[m+12],ne=l[m+13],$=l[m+14],ie=l[m+15],D=w[0],B=w[1],z=w[2],O=w[3];D=g(D,B,z,O,_,7,u[0]),O=g(O,D,B,z,C,12,u[1]),z=g(z,O,D,B,E,17,u[2]),B=g(B,z,O,D,I,22,u[3]),D=g(D,B,z,O,L,7,u[4]),O=g(O,D,B,z,k,12,u[5]),z=g(z,O,D,B,N,17,u[6]),B=g(B,z,O,D,R,22,u[7]),D=g(D,B,z,O,M,7,u[8]),O=g(O,D,B,z,y,12,u[9]),z=g(z,O,D,B,V,17,u[10]),B=g(B,z,O,D,Q,22,u[11]),D=g(D,B,z,O,q,7,u[12]),O=g(O,D,B,z,ne,12,u[13]),z=g(z,O,D,B,$,17,u[14]),B=g(B,z,O,D,ie,22,u[15]),D=f(D,B,z,O,C,5,u[16]),O=f(O,D,B,z,N,9,u[17]),z=f(z,O,D,B,Q,14,u[18]),B=f(B,z,O,D,_,20,u[19]),D=f(D,B,z,O,k,5,u[20]),O=f(O,D,B,z,V,9,u[21]),z=f(z,O,D,B,ie,14,u[22]),B=f(B,z,O,D,L,20,u[23]),D=f(D,B,z,O,y,5,u[24]),O=f(O,D,B,z,$,9,u[25]),z=f(z,O,D,B,I,14,u[26]),B=f(B,z,O,D,M,20,u[27]),D=f(D,B,z,O,ne,5,u[28]),O=f(O,D,B,z,E,9,u[29]),z=f(z,O,D,B,R,14,u[30]),B=f(B,z,O,D,q,20,u[31]),D=d(D,B,z,O,k,4,u[32]),O=d(O,D,B,z,M,11,u[33]),z=d(z,O,D,B,Q,16,u[34]),B=d(B,z,O,D,$,23,u[35]),D=d(D,B,z,O,C,4,u[36]),O=d(O,D,B,z,L,11,u[37]),z=d(z,O,D,B,R,16,u[38]),B=d(B,z,O,D,V,23,u[39]),D=d(D,B,z,O,ne,4,u[40]),O=d(O,D,B,z,_,11,u[41]),z=d(z,O,D,B,I,16,u[42]),B=d(B,z,O,D,N,23,u[43]),D=d(D,B,z,O,y,4,u[44]),O=d(O,D,B,z,q,11,u[45]),z=d(z,O,D,B,ie,16,u[46]),B=d(B,z,O,D,E,23,u[47]),D=p(D,B,z,O,_,6,u[48]),O=p(O,D,B,z,R,10,u[49]),z=p(z,O,D,B,$,15,u[50]),B=p(B,z,O,D,k,21,u[51]),D=p(D,B,z,O,q,6,u[52]),O=p(O,D,B,z,I,10,u[53]),z=p(z,O,D,B,V,15,u[54]),B=p(B,z,O,D,C,21,u[55]),D=p(D,B,z,O,M,6,u[56]),O=p(O,D,B,z,ie,10,u[57]),z=p(z,O,D,B,N,15,u[58]),B=p(B,z,O,D,ne,21,u[59]),D=p(D,B,z,O,L,6,u[60]),O=p(O,D,B,z,Q,10,u[61]),z=p(z,O,D,B,E,15,u[62]),B=p(B,z,O,D,y,21,u[63]),w[0]=w[0]+D|0,w[1]=w[1]+B|0,w[2]=w[2]+z|0,w[3]=w[3]+O|0},_doFinalize:function(){var l=this._data,m=l.words,x=this._nDataBytes*8,v=l.sigBytes*8;m[v>>>5]|=128<<24-v%32;var b=t.floor(x/4294967296),w=x;m[(v+64>>>9<<4)+15]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,m[(v+64>>>9<<4)+14]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,l.sigBytes=(m.length+1)*4,this._process();for(var _=this._hash,C=_.words,E=0;E<4;E++){var I=C[E];C[E]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360}return _},clone:function(){var l=o.clone.call(this);return l._hash=this._hash.clone(),l}});function g(l,m,x,v,b,w,_){var C=l+(m&x|~m&v)+b+_;return(C<<w|C>>>32-w)+m}function f(l,m,x,v,b,w,_){var C=l+(m&v|x&~v)+b+_;return(C<<w|C>>>32-w)+m}function d(l,m,x,v,b,w,_){var C=l+(m^x^v)+b+_;return(C<<w|C>>>32-w)+m}function p(l,m,x,v,b,w,_){var C=l+(x^(m|~v))+b+_;return(C<<w|C>>>32-w)+m}i.MD5=o._createHelper(h),i.HmacMD5=o._createHmacHelper(h)}(Math),e.MD5})}(_s)),_s.exports}var ys={exports:{}},Fa;function Oa(){return Fa||(Fa=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=i.Hasher,o=t.algo,a=[],u=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,g){for(var f=this._hash.words,d=f[0],p=f[1],l=f[2],m=f[3],x=f[4],v=0;v<80;v++){if(v<16)a[v]=h[g+v]|0;else{var b=a[v-3]^a[v-8]^a[v-14]^a[v-16];a[v]=b<<1|b>>>31}var w=(d<<5|d>>>27)+x+a[v];v<20?w+=(p&l|~p&m)+1518500249:v<40?w+=(p^l^m)+1859775393:v<60?w+=(p&l|p&m|l&m)-1894007588:w+=(p^l^m)-899497514,x=m,m=l,l=p<<30|p>>>2,p=d,d=w}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,g=h.words,f=this._nDataBytes*8,d=h.sigBytes*8;return g[d>>>5]|=128<<24-d%32,g[(d+64>>>9<<4)+14]=Math.floor(f/4294967296),g[(d+64>>>9<<4)+15]=f,h.sigBytes=g.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})}(ys)),ys.exports}var ws={exports:{}},Va;function As(){return Va||(Va=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.algo,u=[],h=[];(function(){function d(x){for(var v=t.sqrt(x),b=2;b<=v;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 g=[],f=a.SHA256=o.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],v=l[2],b=l[3],w=l[4],_=l[5],C=l[6],E=l[7],I=0;I<64;I++){if(I<16)g[I]=d[p+I]|0;else{var L=g[I-15],k=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,N=g[I-2],R=(N<<15|N>>>17)^(N<<13|N>>>19)^N>>>10;g[I]=k+g[I-7]+R+g[I-16]}var M=w&_^~w&C,y=m&x^m&v^x&v,V=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),Q=(w<<26|w>>>6)^(w<<21|w>>>11)^(w<<7|w>>>25),q=E+Q+M+h[I]+g[I],ne=V+y;E=C,C=_,_=w,w=b+q|0,b=v,v=x,x=m,m=q+ne|0}l[0]=l[0]+m|0,l[1]=l[1]+x|0,l[2]=l[2]+v|0,l[3]=l[3]+b|0,l[4]=l[4]+w|0,l[5]=l[5]+_|0,l[6]=l[6]+C|0,l[7]=l[7]+E|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=o.clone.call(this);return d._hash=this._hash.clone(),d}});i.SHA256=o._createHelper(f),i.HmacSHA256=o._createHmacHelper(f)}(Math),e.SHA256})}(ws)),ws.exports}var Es={exports:{}},Ua;function W0(){return Ua||(Ua=1,function(s,c){(function(e,t,i){s.exports=t(De(),As())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.algo,o=n.SHA256,a=n.SHA224=o.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=o._doFinalize.call(this);return u.sigBytes-=4,u}});t.SHA224=o._createHelper(a),t.HmacSHA224=o._createHmacHelper(a)}(),e.SHA224})}(Es)),Es.exports}var Cs={exports:{}},Ha;function za(){return Ha||(Ha=1,function(s,c){(function(e,t,i){s.exports=t(De(),vr())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.Hasher,n=t.x64,o=n.Word,a=n.WordArray,u=t.algo;function h(){return o.create.apply(o,arguments)}var g=[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=r.extend({_doReset:function(){this._hash=new a.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(p,l){for(var m=this._hash.words,x=m[0],v=m[1],b=m[2],w=m[3],_=m[4],C=m[5],E=m[6],I=m[7],L=x.high,k=x.low,N=v.high,R=v.low,M=b.high,y=b.low,V=w.high,Q=w.low,q=_.high,ne=_.low,$=C.high,ie=C.low,D=E.high,B=E.low,z=I.high,O=I.low,K=L,be=k,he=N,re=R,Ae=M,Le=y,Pe=V,We=Q,Oe=q,S=ne,G=$,W=ie,P=D,T=B,F=z,X=O,J=0;J<80;J++){var U,Y,pe=f[J];if(J<16)Y=pe.high=p[l+J*2]|0,U=pe.low=p[l+J*2+1]|0;else{var ee=f[J-15],_e=ee.high,Te=ee.low,Re=(_e>>>1|Te<<31)^(_e>>>8|Te<<24)^_e>>>7,nt=(Te>>>1|_e<<31)^(Te>>>8|_e<<24)^(Te>>>7|_e<<25),Wt=f[J-2],Ke=Wt.high,Et=Wt.low,Ue=(Ke>>>19|Et<<13)^(Ke<<3|Et>>>29)^Ke>>>6,Zt=(Et>>>19|Ke<<13)^(Et<<3|Ke>>>29)^(Et>>>6|Ke<<26),Hi=f[J-7],Ot=Hi.high,Hr=Hi.low,zr=f[J-16],Fn=zr.high,jr=zr.low;U=nt+Hr,Y=Re+Ot+(U>>>0<nt>>>0?1:0),U=U+Zt,Y=Y+Ue+(U>>>0<Zt>>>0?1:0),U=U+jr,Y=Y+Fn+(U>>>0<jr>>>0?1:0),pe.high=Y,pe.low=U}var Wr=Oe&G^~Oe&P,ui=S&W^~S&T,zi=K&he^K&Ae^he&Ae,Bh=be&re^be&Le^re&Le,Ph=(K>>>28|be<<4)^(K<<30|be>>>2)^(K<<25|be>>>7),gc=(be>>>28|K<<4)^(be<<30|K>>>2)^(be<<25|K>>>7),Lh=(Oe>>>14|S<<18)^(Oe>>>18|S<<14)^(Oe<<23|S>>>9),Mh=(S>>>14|Oe<<18)^(S>>>18|Oe<<14)^(S<<23|Oe>>>9),vc=g[J],Nh=vc.high,xc=vc.low,Ct=X+Mh,hi=F+Lh+(Ct>>>0<X>>>0?1:0),Ct=Ct+ui,hi=hi+Wr+(Ct>>>0<ui>>>0?1:0),Ct=Ct+xc,hi=hi+Nh+(Ct>>>0<xc>>>0?1:0),Ct=Ct+U,hi=hi+Y+(Ct>>>0<U>>>0?1:0),bc=gc+Bh,Fh=Ph+zi+(bc>>>0<gc>>>0?1:0);F=P,X=T,P=G,T=W,G=Oe,W=S,S=We+Ct|0,Oe=Pe+hi+(S>>>0<We>>>0?1:0)|0,Pe=Ae,We=Le,Ae=he,Le=re,he=K,re=be,be=Ct+bc|0,K=hi+Fh+(be>>>0<Ct>>>0?1:0)|0}k=x.low=k+be,x.high=L+K+(k>>>0<be>>>0?1:0),R=v.low=R+re,v.high=N+he+(R>>>0<re>>>0?1:0),y=b.low=y+Le,b.high=M+Ae+(y>>>0<Le>>>0?1:0),Q=w.low=Q+We,w.high=V+Pe+(Q>>>0<We>>>0?1:0),ne=_.low=ne+S,_.high=q+Oe+(ne>>>0<S>>>0?1:0),ie=C.low=ie+W,C.high=$+G+(ie>>>0<W>>>0?1:0),B=E.low=B+T,E.high=D+P+(B>>>0<T>>>0?1:0),O=I.low=O+X,I.high=z+F+(O>>>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 v=this._hash.toX32();return v},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p},blockSize:1024/32});t.SHA512=r._createHelper(d),t.HmacSHA512=r._createHmacHelper(d)}(),e.SHA512})}(Cs)),Cs.exports}var Is={exports:{}},ja;function K0(){return ja||(ja=1,function(s,c){(function(e,t,i){s.exports=t(De(),vr(),za())})(Ie,function(e){return function(){var t=e,i=t.x64,r=i.Word,n=i.WordArray,o=t.algo,a=o.SHA512,u=o.SHA384=a.extend({_doReset:function(){this._hash=new n.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var h=a._doFinalize.call(this);return h.sigBytes-=16,h}});t.SHA384=a._createHelper(u),t.HmacSHA384=a._createHmacHelper(u)}(),e.SHA384})}(Is)),Is.exports}var Rs={exports:{}},Wa;function $0(){return Wa||(Wa=1,function(s,c){(function(e,t,i){s.exports=t(De(),vr())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.x64,u=a.Word,h=i.algo,g=[],f=[],d=[];(function(){for(var m=1,x=0,v=0;v<24;v++){g[m+5*x]=(v+1)*(v+2)/2%64;var b=x%5,w=(2*m+3*x)%5;m=b,x=w}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 _=1,C=0;C<24;C++){for(var E=0,I=0,L=0;L<7;L++){if(_&1){var k=(1<<L)-1;k<32?I^=1<<k:E^=1<<k-32}_&128?_=_<<1^113:_<<=1}d[C]=u.create(E,I)}})();var p=[];(function(){for(var m=0;m<25;m++)p[m]=u.create()})();var l=h.SHA3=o.extend({cfg:o.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 v=this._state,b=this.blockSize/2,w=0;w<b;w++){var _=m[x+2*w],C=m[x+2*w+1];_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360;var E=v[w];E.high^=C,E.low^=_}for(var I=0;I<24;I++){for(var L=0;L<5;L++){for(var k=0,N=0,R=0;R<5;R++){var E=v[L+5*R];k^=E.high,N^=E.low}var M=p[L];M.high=k,M.low=N}for(var L=0;L<5;L++)for(var y=p[(L+4)%5],V=p[(L+1)%5],Q=V.high,q=V.low,k=y.high^(Q<<1|q>>>31),N=y.low^(q<<1|Q>>>31),R=0;R<5;R++){var E=v[L+5*R];E.high^=k,E.low^=N}for(var ne=1;ne<25;ne++){var k,N,E=v[ne],$=E.high,ie=E.low,D=g[ne];D<32?(k=$<<D|ie>>>32-D,N=ie<<D|$>>>32-D):(k=ie<<D-32|$>>>64-D,N=$<<D-32|ie>>>64-D);var B=p[f[ne]];B.high=k,B.low=N}var z=p[0],O=v[0];z.high=O.high,z.low=O.low;for(var L=0;L<5;L++)for(var R=0;R<5;R++){var ne=L+5*R,E=v[ne],K=p[ne],be=p[(L+1)%5+5*R],he=p[(L+2)%5+5*R];E.high=K.high^~be.high&he.high,E.low=K.low^~be.low&he.low}var E=v[0],re=d[I];E.high^=re.high,E.low^=re.low}},_doFinalize:function(){var m=this._data,x=m.words;this._nDataBytes*8;var v=m.sigBytes*8,b=this.blockSize*32;x[v>>>5]|=1<<24-v%32,x[(t.ceil((v+1)/b)*b>>>5)-1]|=128,m.sigBytes=x.length*4,this._process();for(var w=this._state,_=this.cfg.outputLength/8,C=_/8,E=[],I=0;I<C;I++){var L=w[I],k=L.high,N=L.low;k=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,E.push(N),E.push(k)}return new n.init(E,_)},clone:function(){for(var m=o.clone.call(this),x=m._state=this._state.slice(0),v=0;v<25;v++)x[v]=x[v].clone();return m}});i.SHA3=o._createHelper(l),i.HmacSHA3=o._createHmacHelper(l)}(Math),e.SHA3})}(Rs)),Rs.exports}var ks={exports:{}},Ka;function q0(){return Ka||(Ka=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){/** @preserve
|
|
19
|
+
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
20
|
+
|
|
21
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
22
|
+
|
|
23
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
24
|
+
- 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.
|
|
25
|
+
|
|
26
|
+
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.
|
|
27
|
+
*/return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.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]),g=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=a.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(C,E){for(var I=0;I<16;I++){var L=E+I,k=C[L];C[L]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}var N=this._hash.words,R=d.words,M=p.words,y=u.words,V=h.words,Q=g.words,q=f.words,ne,$,ie,D,B,z,O,K,be,he;z=ne=N[0],O=$=N[1],K=ie=N[2],be=D=N[3],he=B=N[4];for(var re,I=0;I<80;I+=1)re=ne+C[E+y[I]]|0,I<16?re+=m($,ie,D)+R[0]:I<32?re+=x($,ie,D)+R[1]:I<48?re+=v($,ie,D)+R[2]:I<64?re+=b($,ie,D)+R[3]:re+=w($,ie,D)+R[4],re=re|0,re=_(re,Q[I]),re=re+B|0,ne=B,B=D,D=_(ie,10),ie=$,$=re,re=z+C[E+V[I]]|0,I<16?re+=w(O,K,be)+M[0]:I<32?re+=b(O,K,be)+M[1]:I<48?re+=v(O,K,be)+M[2]:I<64?re+=x(O,K,be)+M[3]:re+=m(O,K,be)+M[4],re=re|0,re=_(re,q[I]),re=re+he|0,z=he,he=be,be=_(K,10),K=O,O=re;re=N[1]+ie+be|0,N[1]=N[2]+D+he|0,N[2]=N[3]+B+z|0,N[3]=N[4]+ne+O|0,N[4]=N[0]+$+K|0,N[0]=re},_doFinalize:function(){var C=this._data,E=C.words,I=this._nDataBytes*8,L=C.sigBytes*8;E[L>>>5]|=128<<24-L%32,E[(L+64>>>9<<4)+14]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,C.sigBytes=(E.length+1)*4,this._process();for(var k=this._hash,N=k.words,R=0;R<5;R++){var M=N[R];N[R]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return k},clone:function(){var C=o.clone.call(this);return C._hash=this._hash.clone(),C}});function m(C,E,I){return C^E^I}function x(C,E,I){return C&E|~C&I}function v(C,E,I){return(C|~E)^I}function b(C,E,I){return C&I|E&~I}function w(C,E,I){return C^(E|~I)}function _(C,E){return C<<E|C>>>32-E}i.RIPEMD160=o._createHelper(l),i.HmacRIPEMD160=o._createHmacHelper(l)}(),e.RIPEMD160})}(ks)),ks.exports}var Ts={exports:{}},$a;function Ds(){return $a||($a=1,function(s,c){(function(e,t){s.exports=t(De())})(Ie,function(e){(function(){var t=e,i=t.lib,r=i.Base,n=t.enc,o=n.Utf8,a=t.algo;a.HMAC=r.extend({init:function(u,h){u=this._hasher=new u.init,typeof h=="string"&&(h=o.parse(h));var g=u.blockSize,f=g*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<g;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,g=h.finalize(u);h.reset();var f=h.finalize(this._oKey.clone().concat(g));return f}})})()})}(Ts)),Ts.exports}var Bs={exports:{}},qa;function G0(){return qa||(qa=1,function(s,c){(function(e,t,i){s.exports=t(De(),As(),Ds())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,o=t.algo,a=o.SHA256,u=o.HMAC,h=o.PBKDF2=r.extend({cfg:r.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,f){for(var d=this.cfg,p=u.create(d.hasher,g),l=n.create(),m=n.create([1]),x=l.words,v=m.words,b=d.keySize,w=d.iterations;x.length<b;){var _=p.update(f).finalize(m);p.reset();for(var C=_.words,E=C.length,I=_,L=1;L<w;L++){I=p.finalize(I),p.reset();for(var k=I.words,N=0;N<E;N++)C[N]^=k[N]}l.concat(_),v[0]++}return l.sigBytes=b*4,l}});t.PBKDF2=function(g,f,d){return h.create(d).compute(g,f)}}(),e.PBKDF2})}(Bs)),Bs.exports}var Ps={exports:{}},Ga;function ei(){return Ga||(Ga=1,function(s,c){(function(e,t,i){s.exports=t(De(),Oa(),Ds())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,o=t.algo,a=o.MD5,u=o.EvpKDF=r.extend({cfg:r.extend({keySize:128/32,hasher:a,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,g){for(var f,d=this.cfg,p=d.hasher.create(),l=n.create(),m=l.words,x=d.keySize,v=d.iterations;m.length<x;){f&&p.update(f),f=p.update(h).finalize(g),p.reset();for(var b=1;b<v;b++)f=p.finalize(f),p.reset();l.concat(f)}return l.sigBytes=x*4,l}});t.EvpKDF=function(h,g,f){return u.create(f).compute(h,g)}}(),e.EvpKDF})}(Ps)),Ps.exports}var Ls={exports:{}},Ja;function Ye(){return Ja||(Ja=1,function(s,c){(function(e,t,i){s.exports=t(De(),ei())})(Ie,function(e){e.lib.Cipher||function(t){var i=e,r=i.lib,n=r.Base,o=r.WordArray,a=r.BufferedBlockAlgorithm,u=i.enc;u.Utf8;var h=u.Base64,g=i.algo,f=g.EvpKDF,d=r.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(k,N){return this.create(this._ENC_XFORM_MODE,k,N)},createDecryptor:function(k,N){return this.create(this._DEC_XFORM_MODE,k,N)},init:function(k,N,R){this.cfg=this.cfg.extend(R),this._xformMode=k,this._key=N,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(k){return this._append(k),this._process()},finalize:function(k){k&&this._append(k);var N=this._doFinalize();return N},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function k(N){return typeof N=="string"?L:C}return function(N){return{encrypt:function(R,M,y){return k(M).encrypt(N,R,M,y)},decrypt:function(R,M,y){return k(M).decrypt(N,R,M,y)}}}}()});r.StreamCipher=d.extend({_doFinalize:function(){var k=this._process(!0);return k},blockSize:1});var p=i.mode={},l=r.BlockCipherMode=n.extend({createEncryptor:function(k,N){return this.Encryptor.create(k,N)},createDecryptor:function(k,N){return this.Decryptor.create(k,N)},init:function(k,N){this._cipher=k,this._iv=N}}),m=p.CBC=function(){var k=l.extend();k.Encryptor=k.extend({processBlock:function(R,M){var y=this._cipher,V=y.blockSize;N.call(this,R,M,V),y.encryptBlock(R,M),this._prevBlock=R.slice(M,M+V)}}),k.Decryptor=k.extend({processBlock:function(R,M){var y=this._cipher,V=y.blockSize,Q=R.slice(M,M+V);y.decryptBlock(R,M),N.call(this,R,M,V),this._prevBlock=Q}});function N(R,M,y){var V,Q=this._iv;Q?(V=Q,this._iv=t):V=this._prevBlock;for(var q=0;q<y;q++)R[M+q]^=V[q]}return k}(),x=i.pad={},v=x.Pkcs7={pad:function(k,N){for(var R=N*4,M=R-k.sigBytes%R,y=M<<24|M<<16|M<<8|M,V=[],Q=0;Q<M;Q+=4)V.push(y);var q=o.create(V,M);k.concat(q)},unpad:function(k){var N=k.words[k.sigBytes-1>>>2]&255;k.sigBytes-=N}};r.BlockCipher=d.extend({cfg:d.cfg.extend({mode:m,padding:v}),reset:function(){var k;d.reset.call(this);var N=this.cfg,R=N.iv,M=N.mode;this._xformMode==this._ENC_XFORM_MODE?k=M.createEncryptor:(k=M.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==k?this._mode.init(this,R&&R.words):(this._mode=k.call(M,this,R&&R.words),this._mode.__creator=k)},_doProcessBlock:function(k,N){this._mode.processBlock(k,N)},_doFinalize:function(){var k,N=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(N.pad(this._data,this.blockSize),k=this._process(!0)):(k=this._process(!0),N.unpad(k)),k},blockSize:128/32});var b=r.CipherParams=n.extend({init:function(k){this.mixIn(k)},toString:function(k){return(k||this.formatter).stringify(this)}}),w=i.format={},_=w.OpenSSL={stringify:function(k){var N,R=k.ciphertext,M=k.salt;return M?N=o.create([1398893684,1701076831]).concat(M).concat(R):N=R,N.toString(h)},parse:function(k){var N,R=h.parse(k),M=R.words;return M[0]==1398893684&&M[1]==1701076831&&(N=o.create(M.slice(2,4)),M.splice(0,4),R.sigBytes-=16),b.create({ciphertext:R,salt:N})}},C=r.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(k,N,R,M){M=this.cfg.extend(M);var y=k.createEncryptor(R,M),V=y.finalize(N),Q=y.cfg;return b.create({ciphertext:V,key:R,iv:Q.iv,algorithm:k,mode:Q.mode,padding:Q.padding,blockSize:k.blockSize,formatter:M.format})},decrypt:function(k,N,R,M){M=this.cfg.extend(M),N=this._parse(N,M.format);var y=k.createDecryptor(R,M).finalize(N.ciphertext);return y},_parse:function(k,N){return typeof k=="string"?N.parse(k,this):k}}),E=i.kdf={},I=E.OpenSSL={execute:function(k,N,R,M,y){if(M||(M=o.random(64/8)),y)var V=f.create({keySize:N+R,hasher:y}).compute(k,M);else var V=f.create({keySize:N+R}).compute(k,M);var Q=o.create(V.words.slice(N),R*4);return V.sigBytes=N*4,b.create({key:V,iv:Q,salt:M})}},L=r.PasswordBasedCipher=C.extend({cfg:C.cfg.extend({kdf:I}),encrypt:function(k,N,R,M){M=this.cfg.extend(M);var y=M.kdf.execute(R,k.keySize,k.ivSize,M.salt,M.hasher);M.iv=y.iv;var V=C.encrypt.call(this,k,N,y.key,M);return V.mixIn(y),V},decrypt:function(k,N,R,M){M=this.cfg.extend(M),N=this._parse(N,M.format);var y=M.kdf.execute(R,k.keySize,k.ivSize,N.salt,M.hasher);M.iv=y.iv;var V=C.decrypt.call(this,k,N,y.key,M);return V}})}()})}(Ls)),Ls.exports}var Ms={exports:{}},Xa;function J0(){return Xa||(Xa=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();t.Encryptor=t.extend({processBlock:function(r,n){var o=this._cipher,a=o.blockSize;i.call(this,r,n,a,o),this._prevBlock=r.slice(n,n+a)}}),t.Decryptor=t.extend({processBlock:function(r,n){var o=this._cipher,a=o.blockSize,u=r.slice(n,n+a);i.call(this,r,n,a,o),this._prevBlock=u}});function i(r,n,o,a){var u,h=this._iv;h?(u=h.slice(0),this._iv=void 0):u=this._prevBlock,a.encryptBlock(u,0);for(var g=0;g<o;g++)r[n+g]^=u[g]}return t}(),e.mode.CFB})}(Ms)),Ms.exports}var Ns={exports:{}},Za;function X0(){return Za||(Za=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.mode.CTR=function(){var t=e.lib.BlockCipherMode.extend(),i=t.Encryptor=t.extend({processBlock:function(r,n){var o=this._cipher,a=o.blockSize,u=this._iv,h=this._counter;u&&(h=this._counter=u.slice(0),this._iv=void 0);var g=h.slice(0);o.encryptBlock(g,0),h[a-1]=h[a-1]+1|0;for(var f=0;f<a;f++)r[n+f]^=g[f]}});return t.Decryptor=i,t}(),e.mode.CTR})}(Ns)),Ns.exports}var Fs={exports:{}},Ya;function Z0(){return Ya||(Ya=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){/** @preserve
|
|
28
|
+
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
29
|
+
* derived from CryptoJS.mode.CTR
|
|
30
|
+
* Jan Hruby jhruby.web@gmail.com
|
|
31
|
+
*/return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function i(o){if((o>>24&255)===255){var a=o>>16&255,u=o>>8&255,h=o&255;a===255?(a=0,u===255?(u=0,h===255?h=0:++h):++u):++a,o=0,o+=a<<16,o+=u<<8,o+=h}else o+=1<<24;return o}function r(o){return(o[0]=i(o[0]))===0&&(o[1]=i(o[1])),o}var n=t.Encryptor=t.extend({processBlock:function(o,a){var u=this._cipher,h=u.blockSize,g=this._iv,f=this._counter;g&&(f=this._counter=g.slice(0),this._iv=void 0),r(f);var d=f.slice(0);u.encryptBlock(d,0);for(var p=0;p<h;p++)o[a+p]^=d[p]}});return t.Decryptor=n,t}(),e.mode.CTRGladman})}(Fs)),Fs.exports}var Os={exports:{}},Qa;function Y0(){return Qa||(Qa=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.mode.OFB=function(){var t=e.lib.BlockCipherMode.extend(),i=t.Encryptor=t.extend({processBlock:function(r,n){var o=this._cipher,a=o.blockSize,u=this._iv,h=this._keystream;u&&(h=this._keystream=u.slice(0),this._iv=void 0),o.encryptBlock(h,0);for(var g=0;g<a;g++)r[n+g]^=h[g]}});return t.Decryptor=i,t}(),e.mode.OFB})}(Os)),Os.exports}var Vs={exports:{}},eo;function Q0(){return eo||(eo=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.mode.ECB=function(){var t=e.lib.BlockCipherMode.extend();return t.Encryptor=t.extend({processBlock:function(i,r){this._cipher.encryptBlock(i,r)}}),t.Decryptor=t.extend({processBlock:function(i,r){this._cipher.decryptBlock(i,r)}}),t}(),e.mode.ECB})}(Vs)),Vs.exports}var Us={exports:{}},to;function eu(){return to||(to=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.AnsiX923={pad:function(t,i){var r=t.sigBytes,n=i*4,o=n-r%n,a=r+o-1;t.clamp(),t.words[a>>>2]|=o<<24-a%4*8,t.sigBytes+=o},unpad:function(t){var i=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=i}},e.pad.Ansix923})}(Us)),Us.exports}var Hs={exports:{}},io;function tu(){return io||(io=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.Iso10126={pad:function(t,i){var r=i*4,n=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(n-1)).concat(e.lib.WordArray.create([n<<24],1))},unpad:function(t){var i=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=i}},e.pad.Iso10126})}(Hs)),Hs.exports}var zs={exports:{}},ro;function iu(){return ro||(ro=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.Iso97971={pad:function(t,i){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,i)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971})}(zs)),zs.exports}var js={exports:{}},so;function ru(){return so||(so=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.ZeroPadding={pad:function(t,i){var r=i*4;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var i=t.words,r=t.sigBytes-1,r=t.sigBytes-1;r>=0;r--)if(i[r>>>2]>>>24-r%4*8&255){t.sigBytes=r+1;break}}},e.pad.ZeroPadding})}(js)),js.exports}var Ws={exports:{}},no;function su(){return no||(no=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})}(Ws)),Ws.exports}var Ks={exports:{}},ao;function nu(){return ao||(ao=1,function(s,c){(function(e,t,i){s.exports=t(De(),Ye())})(Ie,function(e){return function(t){var i=e,r=i.lib,n=r.CipherParams,o=i.enc,a=o.Hex,u=i.format;u.Hex={stringify:function(h){return h.ciphertext.toString(a)},parse:function(h){var g=a.parse(h);return n.create({ciphertext:g})}}}(),e.format.Hex})}(Ks)),Ks.exports}var $s={exports:{}},oo;function au(){return oo||(oo=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.BlockCipher,n=t.algo,o=[],a=[],u=[],h=[],g=[],f=[],d=[],p=[],l=[],m=[];(function(){for(var b=[],w=0;w<256;w++)w<128?b[w]=w<<1:b[w]=w<<1^283;for(var _=0,C=0,w=0;w<256;w++){var E=C^C<<1^C<<2^C<<3^C<<4;E=E>>>8^E&255^99,o[_]=E,a[E]=_;var I=b[_],L=b[I],k=b[L],N=b[E]*257^E*16843008;u[_]=N<<24|N>>>8,h[_]=N<<16|N>>>16,g[_]=N<<8|N>>>24,f[_]=N;var N=k*16843009^L*65537^I*257^_*16843008;d[E]=N<<24|N>>>8,p[E]=N<<16|N>>>16,l[E]=N<<8|N>>>24,m[E]=N,_?(_=I^b[b[b[k^I]]],C^=b[b[C]]):_=C=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],v=n.AES=r.extend({_doReset:function(){var b;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var w=this._keyPriorReset=this._key,_=w.words,C=w.sigBytes/4,E=this._nRounds=C+6,I=(E+1)*4,L=this._keySchedule=[],k=0;k<I;k++)k<C?L[k]=_[k]:(b=L[k-1],k%C?C>6&&k%C==4&&(b=o[b>>>24]<<24|o[b>>>16&255]<<16|o[b>>>8&255]<<8|o[b&255]):(b=b<<8|b>>>24,b=o[b>>>24]<<24|o[b>>>16&255]<<16|o[b>>>8&255]<<8|o[b&255],b^=x[k/C|0]<<24),L[k]=L[k-C]^b);for(var N=this._invKeySchedule=[],R=0;R<I;R++){var k=I-R;if(R%4)var b=L[k];else var b=L[k-4];R<4||k<=4?N[R]=b:N[R]=d[o[b>>>24]]^p[o[b>>>16&255]]^l[o[b>>>8&255]]^m[o[b&255]]}}},encryptBlock:function(b,w){this._doCryptBlock(b,w,this._keySchedule,u,h,g,f,o)},decryptBlock:function(b,w){var _=b[w+1];b[w+1]=b[w+3],b[w+3]=_,this._doCryptBlock(b,w,this._invKeySchedule,d,p,l,m,a);var _=b[w+1];b[w+1]=b[w+3],b[w+3]=_},_doCryptBlock:function(b,w,_,C,E,I,L,k){for(var N=this._nRounds,R=b[w]^_[0],M=b[w+1]^_[1],y=b[w+2]^_[2],V=b[w+3]^_[3],Q=4,q=1;q<N;q++){var ne=C[R>>>24]^E[M>>>16&255]^I[y>>>8&255]^L[V&255]^_[Q++],$=C[M>>>24]^E[y>>>16&255]^I[V>>>8&255]^L[R&255]^_[Q++],ie=C[y>>>24]^E[V>>>16&255]^I[R>>>8&255]^L[M&255]^_[Q++],D=C[V>>>24]^E[R>>>16&255]^I[M>>>8&255]^L[y&255]^_[Q++];R=ne,M=$,y=ie,V=D}var ne=(k[R>>>24]<<24|k[M>>>16&255]<<16|k[y>>>8&255]<<8|k[V&255])^_[Q++],$=(k[M>>>24]<<24|k[y>>>16&255]<<16|k[V>>>8&255]<<8|k[R&255])^_[Q++],ie=(k[y>>>24]<<24|k[V>>>16&255]<<16|k[R>>>8&255]<<8|k[M&255])^_[Q++],D=(k[V>>>24]<<24|k[R>>>16&255]<<16|k[M>>>8&255]<<8|k[y&255])^_[Q++];b[w]=ne,b[w+1]=$,b[w+2]=ie,b[w+3]=D},keySize:256/32});t.AES=r._createHelper(v)}(),e.AES})}($s)),$s.exports}var qs={exports:{}},co;function ou(){return co||(co=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=i.BlockCipher,o=t.algo,a=[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],g=[{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=o.DES=n.extend({_doReset:function(){for(var x=this._key,v=x.words,b=[],w=0;w<56;w++){var _=a[w]-1;b[w]=v[_>>>5]>>>31-_%32&1}for(var C=this._subKeys=[],E=0;E<16;E++){for(var I=C[E]=[],L=h[E],w=0;w<24;w++)I[w/6|0]|=b[(u[w]-1+L)%28]<<31-w%6,I[4+(w/6|0)]|=b[28+(u[w+24]-1+L)%28]<<31-w%6;I[0]=I[0]<<1|I[0]>>>31;for(var w=1;w<7;w++)I[w]=I[w]>>>(w-1)*4+3;I[7]=I[7]<<5|I[7]>>>27}for(var k=this._invSubKeys=[],w=0;w<16;w++)k[w]=C[15-w]},encryptBlock:function(x,v){this._doCryptBlock(x,v,this._subKeys)},decryptBlock:function(x,v){this._doCryptBlock(x,v,this._invSubKeys)},_doCryptBlock:function(x,v,b){this._lBlock=x[v],this._rBlock=x[v+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 w=0;w<16;w++){for(var _=b[w],C=this._lBlock,E=this._rBlock,I=0,L=0;L<8;L++)I|=g[L][((E^_[L])&f[L])>>>0];this._lBlock=E,this._rBlock=C^I}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[v]=this._lBlock,x[v+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function p(x,v){var b=(this._lBlock>>>x^this._rBlock)&v;this._rBlock^=b,this._lBlock^=b<<x}function l(x,v){var b=(this._rBlock>>>x^this._lBlock)&v;this._lBlock^=b,this._rBlock^=b<<x}t.DES=n._createHelper(d);var m=o.TripleDES=n.extend({_doReset:function(){var x=this._key,v=x.words;if(v.length!==2&&v.length!==4&&v.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var b=v.slice(0,2),w=v.length<4?v.slice(0,2):v.slice(2,4),_=v.length<6?v.slice(0,2):v.slice(4,6);this._des1=d.createEncryptor(r.create(b)),this._des2=d.createEncryptor(r.create(w)),this._des3=d.createEncryptor(r.create(_))},encryptBlock:function(x,v){this._des1.encryptBlock(x,v),this._des2.decryptBlock(x,v),this._des3.encryptBlock(x,v)},decryptBlock:function(x,v){this._des3.decryptBlock(x,v),this._des2.encryptBlock(x,v),this._des1.decryptBlock(x,v)},keySize:192/32,ivSize:64/32,blockSize:64/32});t.TripleDES=n._createHelper(m)}(),e.TripleDES})}(qs)),qs.exports}var Gs={exports:{}},uo;function cu(){return uo||(uo=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.StreamCipher,n=t.algo,o=n.RC4=r.extend({_doReset:function(){for(var h=this._key,g=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=g[m>>>2]>>>24-m%4*8&255;l=(l+d[p]+x)%256;var v=d[p];d[p]=d[l],d[l]=v}this._i=this._j=0},_doProcessBlock:function(h,g){h[g]^=a.call(this)},keySize:256/32,ivSize:0});function a(){for(var h=this._S,g=this._i,f=this._j,d=0,p=0;p<4;p++){g=(g+1)%256,f=(f+h[g])%256;var l=h[g];h[g]=h[f],h[f]=l,d|=h[(h[g]+h[f])%256]<<24-p*8}return this._i=g,this._j=f,d}t.RC4=r._createHelper(o);var u=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)a.call(this)}});t.RC4Drop=r._createHelper(u)}(),e.RC4})}(Gs)),Gs.exports}var Js={exports:{}},ho;function uu(){return ho||(ho=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.StreamCipher,n=t.algo,o=[],a=[],u=[],h=n.Rabbit=r.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++)g.call(this);for(var p=0;p<8;p++)m[p]^=l[p+4&7];if(d){var x=d.words,v=x[0],b=x[1],w=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,C=w>>>16|_&4294901760,E=_<<16|w&65535;m[0]^=w,m[1]^=C,m[2]^=_,m[3]^=E,m[4]^=w,m[5]^=C,m[6]^=_,m[7]^=E;for(var p=0;p<4;p++)g.call(this)}},_doProcessBlock:function(f,d){var p=this._X;g.call(this),o[0]=p[0]^p[5]>>>16^p[3]<<16,o[1]=p[2]^p[7]>>>16^p[5]<<16,o[2]=p[4]^p[1]>>>16^p[7]<<16,o[3]=p[6]^p[3]>>>16^p[1]<<16;for(var l=0;l<4;l++)o[l]=(o[l]<<8|o[l]>>>24)&16711935|(o[l]<<24|o[l]>>>8)&4278255360,f[d+l]^=o[l]},blockSize:128/32,ivSize:64/32});function g(){for(var f=this._X,d=this._C,p=0;p<8;p++)a[p]=d[p];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var p=0;p<8;p++){var l=f[p]+d[p],m=l&65535,x=l>>>16,v=((m*m>>>17)+m*x>>>15)+x*x,b=((l&4294901760)*l|0)+((l&65535)*l|0);u[p]=v^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=r._createHelper(h)}(),e.Rabbit})}(Js)),Js.exports}var Xs={exports:{}},lo;function hu(){return lo||(lo=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.StreamCipher,n=t.algo,o=[],a=[],u=[],h=n.RabbitLegacy=r.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++)g.call(this);for(var m=0;m<8;m++)l[m]^=p[m+4&7];if(d){var x=d.words,v=x[0],b=x[1],w=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,C=w>>>16|_&4294901760,E=_<<16|w&65535;l[0]^=w,l[1]^=C,l[2]^=_,l[3]^=E,l[4]^=w,l[5]^=C,l[6]^=_,l[7]^=E;for(var m=0;m<4;m++)g.call(this)}},_doProcessBlock:function(f,d){var p=this._X;g.call(this),o[0]=p[0]^p[5]>>>16^p[3]<<16,o[1]=p[2]^p[7]>>>16^p[5]<<16,o[2]=p[4]^p[1]>>>16^p[7]<<16,o[3]=p[6]^p[3]>>>16^p[1]<<16;for(var l=0;l<4;l++)o[l]=(o[l]<<8|o[l]>>>24)&16711935|(o[l]<<24|o[l]>>>8)&4278255360,f[d+l]^=o[l]},blockSize:128/32,ivSize:64/32});function g(){for(var f=this._X,d=this._C,p=0;p<8;p++)a[p]=d[p];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var p=0;p<8;p++){var l=f[p]+d[p],m=l&65535,x=l>>>16,v=((m*m>>>17)+m*x>>>15)+x*x,b=((l&4294901760)*l|0)+((l&65535)*l|0);u[p]=v^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=r._createHelper(h)}(),e.RabbitLegacy})}(Xs)),Xs.exports}var Zs={exports:{}},fo;function lu(){return fo||(fo=1,function(s,c){(function(e,t,i){s.exports=t(De(),gi(),vi(),ei(),Ye())})(Ie,function(e){return function(){var t=e,i=t.lib,r=i.BlockCipher,n=t.algo;const o=16,a=[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 g(m,x){let v=x>>24&255,b=x>>16&255,w=x>>8&255,_=x&255,C=m.sbox[0][v]+m.sbox[1][b];return C=C^m.sbox[2][w],C=C+m.sbox[3][_],C}function f(m,x,v){let b=x,w=v,_;for(let C=0;C<o;++C)b=b^m.pbox[C],w=g(m,b)^w,_=b,b=w,w=_;return _=b,b=w,w=_,w=w^m.pbox[o],b=b^m.pbox[o+1],{left:b,right:w}}function d(m,x,v){let b=x,w=v,_;for(let C=o+1;C>1;--C)b=b^m.pbox[C],w=g(m,b)^w,_=b,b=w,w=_;return _=b,b=w,w=_,w=w^m.pbox[1],b=b^m.pbox[0],{left:b,right:w}}function p(m,x,v){for(let E=0;E<4;E++){m.sbox[E]=[];for(let I=0;I<256;I++)m.sbox[E][I]=u[E][I]}let b=0;for(let E=0;E<o+2;E++)m.pbox[E]=a[E]^x[b],b++,b>=v&&(b=0);let w=0,_=0,C=0;for(let E=0;E<o+2;E+=2)C=f(m,w,_),w=C.left,_=C.right,m.pbox[E]=w,m.pbox[E+1]=_;for(let E=0;E<4;E++)for(let I=0;I<256;I+=2)C=f(m,w,_),w=C.left,_=C.right,m.sbox[E][I]=w,m.sbox[E][I+1]=_;return!0}var l=n.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,x=m.words,v=m.sigBytes/4;p(h,x,v)}},encryptBlock:function(m,x){var v=f(h,m[x],m[x+1]);m[x]=v.left,m[x+1]=v.right},decryptBlock:function(m,x){var v=d(h,m[x],m[x+1]);m[x]=v.left,m[x+1]=v.right},blockSize:64/32,keySize:128/32,ivSize:64/32});t.Blowfish=r._createHelper(l)}(),e.Blowfish})}(Zs)),Zs.exports}(function(s,c){(function(e,t,i){s.exports=t(De(),vr(),H0(),z0(),gi(),j0(),vi(),Oa(),As(),W0(),za(),K0(),$0(),q0(),Ds(),G0(),ei(),Ye(),J0(),X0(),Z0(),Y0(),Q0(),eu(),tu(),iu(),ru(),su(),nu(),au(),ou(),cu(),uu(),hu(),lu())})(Ie,function(e){return e})})(ka);var du=ka.exports;const Ys=ca(du);function fu(s){return Ys.MD5(s).toString().toUpperCase()}function pu(s,c,e,t,i,r,n,o){var a;let u="";r.set("x-log-apiversion","0.6.0"),r.set("x-log-signaturemethod","hmac-sha1"),u+=s+`
|
|
32
|
+
`+n+`
|
|
33
|
+
`+((a=r.get("Content-Type"))!=null?a:"")+`
|
|
34
|
+
`+o+`
|
|
35
|
+
`;const h=(p,l)=>p[0].localeCompare(l[0]),g=p=>p[0].startsWith("x-log-")||p[0].startsWith("x-acs-");try{const p=[...r.entries()].filter(g).sort(h).map(l=>l[0]+":"+l[1]+`
|
|
36
|
+
`).join("");u+=p}catch(p){}u+=c,i.size>0&&(u+="?");try{u+=[...i.entries()].sort(h).map(p=>p[0]+"="+p[1]).join("&")}catch(p){}const f=Ys.HmacSHA1(u,t).toString(Ys.enc.Base64),d="LOG "+e+":"+f;return r.set("Authorization",d),r.set("x-log-date",o),d}var mu=(s,c,e)=>new Promise((t,i)=>{var r=a=>{try{o(e.next(a))}catch(u){i(u)}},n=a=>{try{o(e.throw(a))}catch(u){i(u)}},o=a=>a.done?t(a.value):Promise.resolve(a.value).then(r,n);o((e=e.apply(s,c)).next())});function gu(s){return mu(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 vu=(s,c,e)=>new Promise((t,i)=>{var r=a=>{try{o(e.next(a))}catch(u){i(u)}},n=a=>{try{o(e.throw(a))}catch(u){i(u)}},o=a=>a.done?t(a.value):Promise.resolve(a.value).then(r,n);o((e=e.apply(s,c)).next())});function po(s){return{transString:function(c){let e={},t=0,i=!1;for(let r in c){if((r==="time"||r==="__time__")&&typeof c[r]=="number"){t=c[r],i=!0;continue}typeof c[r]=="object"?e[r]=JSON.stringify(c[r]):e[r]=String(c[r])}return e.__time__=i?t:Math.floor(new Date().getTime()/1e3),e},process:function(c,e){return vu(this,null,function*(){yield gu(s);let t=c.slice(c.indexOf("/logstores")),i=e.length,r=fu(e),n=new Date().toUTCString(),o=new Map,a=new Map([["Content-Type","application/json"],["Content-MD5",r],["x-log-bodyrawsize",i.toString()]]);s.securityToken&&a.set("x-acs-security-token",s.securityToken),pu("POST",t,s.accessKeyId,s.accessKeySecret,o,a,r,n);let u=Object.fromEntries(a);return{data:e,header:u}})}}}typeof window!="undefined"&&Ca(window,"stsPlugin",po);var xu="2.0.0-beta.3",ki="",mo="?",Qs="function",ti="undefined",Ti="object",en="string",Ki="major",oe="model",te="name",ae="type",ge="vendor",se="version",gt="architecture",Di="console",Be="mobile",ze="tablet",_t="smarttv",xr="wearable",go="xr",tn="embedded",vo="user-agent",rn=500,sn="brands",xi="formFactors",nn="fullVersionList",Bi="platform",an="platformVersion",br="bitness",ii="sec-ch-ua",bu=ii+"-full-version-list",Su=ii+"-arch",_u=ii+"-"+br,yu=ii+"-form-factors",wu=ii+"-"+Be,Au=ii+"-"+oe,xo=ii+"-"+Bi,Eu=xo+"-version",bo=[sn,nn,Be,oe,Bi,an,gt,xi,br],yt="browser",Kt="cpu",Ht="device",$t="engine",Tt="os",Pi="result",Sr="Amazon",$i="Apple",So="ASUS",_o="BlackBerry",_r="Google",yo="Huawei",wo="Lenovo",on="LG",yr="Microsoft",Ao="Motorola",wr="Samsung",Eo="Sharp",Ar="Sony",cn="Xiaomi",un="Zebra",Li="Mobile ",Mi=" Browser",Er="Chrome",Cu="Edge",qi="Firefox",Gi="Opera",Co="Facebook",Io="Sogou",hn="Windows",Iu=typeof window!==ti,vt=Iu&&window.navigator?window.navigator:void 0,ri=vt&&vt.userAgentData?vt.userAgentData:void 0,Ru=function(s,c){var e={},t=c;if(!Ir(c)){t={};for(var i in c)for(var r in c[i])t[r]=c[i][r].concat(t[r]?t[r]:[])}for(var n in s)e[n]=t[n]&&t[n].length%2===0?t[n].concat(s[n]):s[n];return e},Cr=function(s){for(var c={},e=0;e<s.length;e++)c[s[e].toUpperCase()]=s[e];return c},ln=function(s,c){if(typeof s===Ti&&s.length>0){for(var e in s)if(si(s[e])==si(c))return!0;return!1}return Ni(s)?si(c).indexOf(si(s))!==-1:!1},Ir=function(s,c){for(var e in s)return/^(browser|cpu|device|engine|os)$/.test(e)||(c?Ir(s[e]):!1)},Ni=function(s){return typeof s===en},dn=function(s){if(s){for(var c=[],e=bi(/\\?\"/g,s).split(","),t=0;t<e.length;t++)if(e[t].indexOf(";")>-1){var i=Xi(e[t]).split(";v=");c[t]={brand:i[0],version:i[1]}}else c[t]=Xi(e[t]);return c}},si=function(s){return Ni(s)?s.toLowerCase():s},fn=function(s){return Ni(s)?bi(/[^\d\.]/g,s).split(".")[0]:void 0},qt=function(s){for(var c in s){var e=s[c];typeof e==Ti&&e.length==2?this[e[0]]=e[1]:this[e]=void 0}return this},bi=function(s,c){return Ni(c)?c.replace(s,ki):c},Ji=function(s){return bi(/\\?\"/g,s)},Xi=function(s,c){if(Ni(s))return s=bi(/^\s\s*/,s),typeof c===ti?s:s.substring(0,rn)},Ro=function(s,c){if(!(!s||!c))for(var e=0,t,i,r,n,o,a;e<c.length&&!o;){var u=c[e],h=c[e+1];for(t=i=0;t<u.length&&!o&&u[t];)if(o=u[t++].exec(s),o)for(r=0;r<h.length;r++)a=o[++i],n=h[r],typeof n===Ti&&n.length>0?n.length===2?typeof n[1]==Qs?this[n[0]]=n[1].call(this,a):this[n[0]]=n[1]:n.length===3?typeof n[1]===Qs&&!(n[1].exec&&n[1].test)?this[n[0]]=a?n[1].call(this,a,n[2]):void 0:this[n[0]]=a?a.replace(n[1],n[2]):void 0:n.length===4&&(this[n[0]]=a?n[3].call(this,a.replace(n[1],n[2])):void 0):this[n]=a||void 0;e+=2}},Rr=function(s,c){for(var e in c)if(typeof c[e]===Ti&&c[e].length>0){for(var t=0;t<c[e].length;t++)if(ln(c[e][t],s))return e===mo?void 0:e}else if(ln(c[e],s))return e===mo?void 0:e;return c.hasOwnProperty("*")?c["*"]:s},ko={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"},To={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Do={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[se,[te,Li+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[se,[te,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[te,se],[/opios[\/ ]+([\w\.]+)/i],[se,[te,Gi+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[se,[te,Gi+" GX"]],[/\bopr\/([\w\.]+)/i],[se,[te,Gi]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[se,[te,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[te,se],[/\bddg\/([\w\.]+)/i],[se,[te,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[se,[te,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[se,[te,"WeChat"]],[/konqueror\/([\w\.]+)/i],[se,[te,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[se,[te,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[se,[te,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[se,[te,"Smart "+wo+Mi]],[/(avast|avg)\/([\w\.]+)/i],[[te,/(.+)/,"$1 Secure"+Mi],se],[/\bfocus\/([\w\.]+)/i],[se,[te,qi+" Focus"]],[/\bopt\/([\w\.]+)/i],[se,[te,Gi+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[se,[te,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[se,[te,"Dolphin"]],[/coast\/([\w\.]+)/i],[se,[te,Gi+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[se,[te,"MIUI"+Mi]],[/fxios\/([\w\.-]+)/i],[se,[te,Li+qi]],[/\bqihu|(qi?ho?o?|360)browser/i],[[te,"360"+Mi]],[/\b(qq)\/([\w\.]+)/i],[[te,/(.+)/,"$1Browser"],se],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[te,/(.+)/,"$1"+Mi],se],[/samsungbrowser\/([\w\.]+)/i],[se,[te,wr+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[te,/_/g," "],se],[/metasr[\/ ]?([\d\.]+)/i],[se,[te,Io+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[te,Io+" Mobile"],se],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[te,se],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[te],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[te,Co],se],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[te,se],[/\bgsa\/([\w\.]+) .*safari\//i],[se,[te,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[se,[te,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[se,[te,Er+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[te,Er+" WebView"],se],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[se,[te,"Android"+Mi]],[/chrome\/([\w\.]+) mobile/i],[se,[te,Li+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[te,se],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[se,[te,Li+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[te,Li+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[se,te],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[te,[se,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[te,se],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[te,Li+qi],se],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[te,"Netscape"],se],[/(wolvic)\/([\w\.]+)/i],[te,se],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[se,[te,qi+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\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|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[te,[se,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[te,[se,/[^\d\.]+./,ki]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[gt,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[gt,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[gt,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[gt,"armhf"]],[/windows (ce|mobile); ppc;/i],[[gt,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[gt,/ower/,ki,si]],[/(sun4\w)[;\)]/i],[[gt,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[gt,si]]],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],[oe,[ge,wr],[ae,ze]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[oe,[ge,wr],[ae,Be]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[oe,[ge,$i],[ae,Be]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[oe,[ge,$i],[ae,ze]],[/(macintosh);/i],[oe,[ge,$i]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[oe,[ge,Eo],[ae,Be]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[oe,[ge,yo],[ae,ze]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[oe,[ge,yo],[ae,Be]],[/\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],[[oe,/_/g," "],[ge,cn],[ae,Be]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[oe,/_/g," "],[ge,cn],[ae,ze]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[oe,[ge,"OPPO"],[ae,Be]],[/\b(opd2\d{3}a?) bui/i],[oe,[ge,"OPPO"],[ae,ze]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[oe,[ge,"Vivo"],[ae,Be]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[oe,[ge,"Realme"],[ae,Be]],[/\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],[oe,[ge,Ao],[ae,Be]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[oe,[ge,Ao],[ae,ze]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[oe,[ge,on],[ae,ze]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[oe,[ge,on],[ae,Be]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[oe,[ge,wo],[ae,ze]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[oe,/_/g," "],[ge,"Nokia"],[ae,Be]],[/(pixel c)\b/i],[oe,[ge,_r],[ae,ze]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[oe,[ge,_r],[ae,Be]],[/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],[oe,[ge,Ar],[ae,Be]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[oe,"Xperia Tablet"],[ge,Ar],[ae,ze]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[oe,[ge,"OnePlus"],[ae,Be]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[oe,[ge,Sr],[ae,ze]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[oe,/(.+)/g,"Fire Phone $1"],[ge,Sr],[ae,Be]],[/(playbook);[-\w\),; ]+(rim)/i],[oe,ge,[ae,ze]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[oe,[ge,_o],[ae,Be]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[oe,[ge,So],[ae,ze]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[oe,[ge,So],[ae,Be]],[/(nexus 9)/i],[oe,[ge,"HTC"],[ae,ze]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[ge,[oe,/_/g," "],[ae,Be]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[oe,[ge,"Acer"],[ae,ze]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[oe,[ge,"Meizu"],[ae,Be]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[oe,[ge,"Ulefone"],[ae,Be]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[ge,oe,[ae,Be]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[ge,oe,[ae,ze]],[/(surface duo)/i],[oe,[ge,yr],[ae,ze]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[oe,[ge,"Fairphone"],[ae,Be]],[/(shield[\w ]+) b/i],[oe,[ge,"Nvidia"],[ae,ze]],[/(sprint) (\w+)/i],[ge,oe,[ae,Be]],[/(kin\.[onetw]{3})/i],[[oe,/\./g," "],[ge,yr],[ae,Be]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[oe,[ge,un],[ae,ze]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[oe,[ge,un],[ae,Be]],[/smart-tv.+(samsung)/i],[ge,[ae,_t]],[/hbbtv.+maple;(\d+)/i],[[oe,/^/,"SmartTV"],[ge,wr],[ae,_t]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[ge,on],[ae,_t]],[/(apple) ?tv/i],[ge,[oe,$i+" TV"],[ae,_t]],[/crkey/i],[[oe,Er+"cast"],[ge,_r],[ae,_t]],[/droid.+aft(\w+)( bui|\))/i],[oe,[ge,Sr],[ae,_t]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[oe,[ge,Eo],[ae,_t]],[/(bravia[\w ]+)( bui|\))/i],[oe,[ge,Ar],[ae,_t]],[/(mitv-\w{5}) bui/i],[oe,[ge,cn],[ae,_t]],[/Hbbtv.*(technisat) (.*);/i],[ge,oe,[ae,_t]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[ge,Xi],[oe,Xi],[ae,_t]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[ae,_t]],[/(ouya)/i,/(nintendo) (\w+)/i],[ge,oe,[ae,Di]],[/droid.+; (shield) bui/i],[oe,[ge,"Nvidia"],[ae,Di]],[/(playstation \w+)/i],[oe,[ge,Ar],[ae,Di]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[oe,[ge,yr],[ae,Di]],[/((pebble))app/i],[ge,oe,[ae,xr]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[oe,[ge,$i],[ae,xr]],[/droid.+; (wt63?0{2,3})\)/i],[oe,[ge,un],[ae,xr]],[/droid.+; (glass) \d/i],[oe,[ge,_r],[ae,go]],[/(quest( \d| pro)?)/i],[oe,[ge,Co],[ae,go]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[ge,[ae,tn]],[/(aeobc)\b/i],[oe,[ge,Sr],[ae,tn]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[oe,[ae,Be]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[oe,[ae,ze]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[ae,ze]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[ae,Be]],[/(android[-\w\. ]{0,9});.+buil/i],[oe,[ge,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[se,[te,Cu+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[se,[te,"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],[te,se],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[se,te]],os:[[/microsoft (windows) (vista|xp)/i],[te,se],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[te,[se,Rr,ko]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[se,Rr,ko],[te,hn]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[se,/_/g,"."],[te,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[te,"macOS"],[se,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[se,te],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[te,se],[/\(bb(10);/i],[se,[te,_o]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[se,[te,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[se,[te,qi+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[se,[te,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[se,[te,"watchOS"]],[/crkey\/([\d\.]+)/i],[se,[te,Er+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[te,"Chrome OS"],se],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/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],[te,se],[/(sunos) ?([\w\.\d]*)/i],[[te,"Solaris"],se],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[te,se]]},kr=function(){var s={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return qt.call(s.init,[[yt,[te,se,Ki,ae]],[Kt,[gt]],[Ht,[ae,oe,ge]],[$t,[te,se]],[Tt,[te,se]]]),qt.call(s.isIgnore,[[yt,[se,Ki]],[$t,[se]],[Tt,[se]]]),qt.call(s.isIgnoreRgx,[[yt,/ ?browser$/i],[Tt,/ ?os$/i]]),qt.call(s.toString,[[yt,[te,se]],[Kt,[gt]],[Ht,[ge,oe]],[$t,[te,se]],[Tt,[te,se]]]),s}(),ku=function(s,c){var e=kr.init[c],t=kr.isIgnore[c]||0,i=kr.isIgnoreRgx[c]||0,r=kr.toString[c]||0;function n(){qt.call(this,e)}return n.prototype.getItem=function(){return s},n.prototype.withClientHints=function(){return ri?ri.getHighEntropyValues(bo).then(function(o){return s.setCH(new Bo(o,!1)).parseCH().get()}):s.parseCH().get()},n.prototype.withFeatureCheck=function(){return s.detectFeature().get()},c!=Pi&&(n.prototype.is=function(o){var a=!1;for(var u in this)if(this.hasOwnProperty(u)&&!ln(t,u)&&si(i?bi(i,this[u]):this[u])==si(i?bi(i,o):o)){if(a=!0,o!=ti)break}else if(o==ti&&a){a=!a;break}return a},n.prototype.toString=function(){var o=ki;for(var a in r)typeof this[r[a]]!==ti&&(o+=(o?" ":ki)+this[r[a]]);return o||ti}),ri||(n.prototype.then=function(o){var a=this,u=function(){for(var g in a)a.hasOwnProperty(g)&&(this[g]=a[g])};u.prototype={is:n.prototype.is,toString:n.prototype.toString};var h=new u;return o(h),h}),new n};function Bo(s,c){if(s=s||{},qt.call(this,bo),c)qt.call(this,[[sn,dn(s[ii])],[nn,dn(s[bu])],[Be,/\?1/.test(s[wu])],[oe,Ji(s[Au])],[Bi,Ji(s[xo])],[an,Ji(s[Eu])],[gt,Ji(s[Su])],[xi,dn(s[yu])],[br,Ji(s[_u])]]);else for(var e in s)this.hasOwnProperty(e)&&typeof s[e]!==ti&&(this[e]=s[e])}function Po(s,c,e,t){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,r){return this.data[i]=r,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(vt&&vt.userAgent==this.ua)switch(this.itemType){case yt:vt.brave&&typeof vt.brave.isBrave==Qs&&this.set(te,"Brave");break;case Ht:!this.get(ae)&&ri&&ri[Be]&&this.set(ae,Be),this.get(oe)=="Macintosh"&&vt&&typeof vt.standalone!==ti&&vt.maxTouchPoints&&vt.maxTouchPoints>2&&this.set(oe,"iPad").set(ae,ze);break;case Tt:!this.get(te)&&ri&&ri[Bi]&&this.set(te,ri[Bi]);break;case Pi:var i=this.data,r=function(n){return i[n].getItem().detectFeature().get()};this.set(yt,r(yt)).set(Kt,r(Kt)).set(Ht,r(Ht)).set($t,r($t)).set(Tt,r(Tt))}return this},this.parseUA=function(){return this.itemType!=Pi&&Ro.call(this.data,this.ua,this.rgxMap),this.itemType==yt&&this.set(Ki,fn(this.get(se))),this},this.parseCH=function(){var i=this.uaCH,r=this.rgxMap;switch(this.itemType){case yt:var n=i[nn]||i[sn],o;if(n)for(var a in n){var u=bi(/(Google|Microsoft) /,n[a].brand||n[a]),h=n[a].version;!/not.a.brand/i.test(u)&&(!o||/chrom/i.test(o)&&!/chromi/i.test(u))&&(this.set(te,u).set(se,h).set(Ki,fn(h)),o=u)}break;case Kt:var g=i[gt];g&&(g&&i[br]=="64"&&(g+="64"),Ro.call(this.data,g+";",r));break;case Ht:if(i[Be]&&this.set(ae,Be),i[oe]&&this.set(oe,i[oe]),i[oe]=="Xbox"&&this.set(ae,Di).set(ge,yr),i[xi]){var f;if(typeof i[xi]!="string")for(var d=0;!f&&d<i[xi].length;)f=Rr(i[xi][d++],To);else f=Rr(i[xi],To);this.set(ae,f)}break;case Tt:var p=i[Bi];if(p){var l=i[an];p==hn&&(l=parseInt(fn(l),10)>=13?"11":"10"),this.set(te,p).set(se,l)}this.get(te)==hn&&i[oe]=="Xbox"&&this.set(te,"Xbox").set(se,void 0);break;case Pi:var m=this.data,x=function(v){return m[v].getItem().setCH(i).parseCH().get()};this.set(yt,x(yt)).set(Kt,x(Kt)).set(Ht,x(Ht)).set($t,x($t)).set(Tt,x(Tt))}return this},qt.call(this,[["itemType",s],["ua",c],["uaCH",t],["rgxMap",e],["data",ku(this,s)]]),this}function Gt(s,c,e){if(typeof s===Ti?(Ir(s,!0)?(typeof c===Ti&&(e=c),c=s):(e=s,c=void 0),s=void 0):typeof s===en&&!Ir(c,!0)&&(e=c,c=void 0),!(this instanceof Gt))return new Gt(s,c,e).getResult();var t=typeof s===en?s:vt&&vt.userAgent?vt.userAgent:e&&e[vo]?e[vo]:ki,i=new Bo(e,!0),r=c?Ru(Do,c):Do,n=function(o){return o==Pi?function(){return new Po(o,t,r,i).set("ua",t).set(yt,this.getBrowser()).set(Kt,this.getCPU()).set(Ht,this.getDevice()).set($t,this.getEngine()).set(Tt,this.getOS()).get()}:function(){return new Po(o,t,r[o],i).parseUA().get()}};return qt.call(this,[["getBrowser",n(yt)],["getCPU",n(Kt)],["getDevice",n(Ht)],["getEngine",n($t)],["getOS",n(Tt)],["getResult",n(Pi)],["getUA",function(){return t}],["setUA",function(o){return Ni(o)&&(t=o.length>rn?Xi(o,rn):o),this}]]).setUA(t),this}Gt.VERSION=xu,Gt.BROWSER=Cr([te,se,Ki,ae]),Gt.CPU=Cr([gt]),Gt.DEVICE=Cr([oe,ge,ae,Di,Be,_t,ze,xr,tn]),Gt.ENGINE=Gt.OS=Cr([te,se]);const{BrowserUtil:pn,SystenUtil:Lo}=ye.AliRTS;class Mo{constructor(){A(this,"tracker");A(this,"param");A(this,"msgCacheArr",[]);A(this,"index",0);A(this,"stsOpt");A(this,"slsToken");A(this,"ossToken");A(this,"uaParserResult");this.uaParserResult=new Gt().getResult()}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 Ra({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 i=po(t);e.useStsPlugin(i),this.tracker=e,this.msgCacheArr.forEach((r,n)=>{var o,a;(a=this.tracker)==null||a.send(Ce(Yt(Ce({},this.param),{stat_log_id:`${((o=this.param)==null?void 0:o.sesid)||"nosession"}-${n}`}),r))}),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(Ce(Yt(Ce({bt:pn.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=fi(),localStorage.setItem("AliRtcUUID",e)),localStorage.getItem("AliRtcUUID")&&(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:Lo.systemName,osv:Lo.systemVersion,deb:this.uaParserResult.device.vendor,den:`${this.uaParserResult.device.model} ${this.uaParserResult.engine.name}/${this.uaParserResult.engine.version} ${this.uaParserResult.browser.name}/${this.uaParserResult.browser.version}`,udid:e,sdkvrs:ns,acs:"Unknown",cput:this.uaParserResult.cpu.architecture||"",dm:`${window.location.protocol}//${window.location.host}`,bt:pn.browserName,bv:pn.browserVersion,envir:"PRODUCT",args:""}))}}const Fe=(s,c=1,e=6e4,t=0)=>{let i=s;return i||(i=0),Math.min(e,Math.max(t,Math.round(i*c)))},Dt=(s,c,e=2e7,t=0)=>{let i=c;(!c||c<0||c>1e4)&&(i=1e3);let r=s;return r||(r=0),Math.min(e,Math.max(t,Math.round(r/(i/1e3))))},Si=(s,c)=>{if(c===0)return 0;let e=s;return(!e||e<0)&&(e=0),+((e||0)/c*100).toFixed(2)},No=s=>s>=0&&s<=1?Fe(Math.floor(32767*s),1,32767):0,je=(s,c)=>{var t,i,r;let e=((t=s._last)==null?void 0:t[c])||0;return s.ssrc&&((i=s._last)!=null&&i.ssrc)&&s.ssrc!==((r=s._last)==null?void 0:r.ssrc)&&(e=0),((s==null?void 0:s[c])||0)-e},Tu=(s,c)=>{var e,t,i;return(((e=s==null?void 0:s._source)==null?void 0:e[c])||0)-(((i=(t=s==null?void 0:s._last)==null?void 0:t._source)==null?void 0:i[c])||0)},Fo=(s,c)=>Fe(je(s,c),1e3,1e4),_i=(s,c=2e7)=>Fe(s,1,c),or=class or{constructor(c){A(this,"engine");A(this,"logClient");A(this,"authInfo");this.logClient=new Mo,this.engine=c}static getLogClient(){return this.staticClient||(this.staticClient=new Mo),this.staticClient}static reportOSSUpload(c,e,t=0){or.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),or.getLogClient().updateToken(c,e)}stop(){this.logClient.stop()}reportPublishMonitor(c,e,t,i,r){const n=t.msid;if(!n||r.length<=0)return;const o=n===Z.Audio,a={ctm:Math.floor(r[0].timestamp||0)},u=[],h=[],g=[],f=[],d=[],p=[],l=[],m=[],x=[],v=[],b=[],w=[],_=[],C=[],E=[],I=[],L=[],k=[],N=[];try{if(r.forEach(R=>{var O,K,be,he,re,Ae;if(!R)return;const M=(O=R._last)!=null&&O.timestamp?R.timestamp-R._last.timestamp:1e3,y=je(R,"bytesSent"),V=je(R,"headerBytesSent"),Q=Dt(Fe(y+V,8,2e7),M);u.push(Q);const q=Dt(Fe(y,8,2e7),M);h.push(q);const ne=Dt(Fe(V,8,2e7),M);g.push(ne);const $=je(R,"packetsSent"),ie=Dt($,M);f.push(ie);const D=je(R,"packetsLost"),B=Dt(D,M);d.push(B);const z=Si(D,$);if(p.push(z),o)(K=R._source)!=null&&K.audioLevel&&l.push(No(R._source.audioLevel)),m.push(0);else{x.push(Fo(R,"totalEncodeTime")),v.push(_i((be=R._source)==null?void 0:be.framesPerSecond,100)),b.push(_i((he=R._source)==null?void 0:he.framesPerSecond,100)),w.push(_i(R.framesPerSecond,100)),_.push(_i((re=R._source)==null?void 0:re.height,4400)),C.push(_i((Ae=R._source)==null?void 0:Ae.width,7700)),E.push(_i(R.frameHeight,4400)),I.push(_i(R.frameWidth,7700));const Le=je(R,"totalPacketSendDelay");L.push(Fe(Le,1/(D||1),2e3));const Pe=je(R,"qpSum");k.push(Fe(Pe,1/(R.framesPerSecond||1),51)),N.push(0)}}),a.sbr=u.join(","),a.mbrs=h.join(","),a.pbrs=g.join(","),a.ps=f.join(","),a.pl=d.join(","),a.plr=p.join(","),o){const R=(i==null?void 0:i.getSettings().sampleRate)||0;a.ailevel=l.join(","),a.arpc=m.join(","),a.arsr=R,a.aesr=R,a.publevel=-90,a.rawlevel=-90}else a.em=x.join(","),a.cfps=v.join(","),a.ifps=b.join(","),a.sfps=w.join(","),a.ih=_.join(","),a.iw=C.join(","),a.sh=E.join(","),a.sw=I.join(","),a.sd=L.join(","),a.aqp=k.join(","),a.caf=N.join(","),a.can=N.join(","),a.cav=h.join(","),a.ifimax=N.join(","),a.ifimin=N.join(","),a.efimax=N.join(","),a.efimin=N.join(","),a.sfimax=N.join(","),a.sfimin=N.join(","),a.apsnr=N.join(",")}catch(R){}this.log({evetid:10070,traceid:e,calid:c,args:this.data2String(Ce({calid:c,tckid:n,traceid:e,src:t.ssrc,codec:t.codec},a))})}reportSubscribeMonitor(c,e,t,i,r){const n=i.msid;if(!n||r.length<=0)return;const o=n===Z.Audio,a={ctm:Math.floor(r[0].timestamp||0)},u=[],h=[],g=[],f=[],d=[],p=[],l=[],m=[],x=[],v=[],b=[],w=[],_=[],C=[],E=[],I=[],L=[],k=[],N=[],R=[],M=[],y=[],V=[],Q=[],q=[],ne=[],$=[],ie=[],D=[],B=[],z=[],O=[],K=[],be=[];try{r.forEach(he=>{var Y,pe;if(!he)return;const re=(Y=he._last)!=null&&Y.timestamp?he.timestamp-he._last.timestamp:1e3,Ae=je(he,"bytesReceived"),Le=je(he,"headerBytesReceived"),Pe=Dt(Fe(Ae+Le,8,2e7),re);u.push(Pe);const We=Dt(Fe(Ae,8,2e7),re);h.push(We);const Oe=Dt(Fe(Le,8,2e7),re);g.push(Oe);const S=je(he,"packetsReceived"),G=Dt(S,re);f.push(G);const W=je(he,"packetsLost"),P=Dt(W,re);d.push(P);const T=Si(W,S);p.push(T);const F=Fe(he.jitterBufferDelay,1e3/he.jitterBufferEmittedCount,3e4);l.push(F);const X=je(he,"fecPacketsReceived");w.push(Si(X,S));const J=je(he,"retransmittedPacketsReceived"),U=S+W-J;if(x.push(Si(S-J,U)),v.push(Si(W,U)),m.push(Si(J,U)),b.push(U),K.push(0),be.push(""),o){C.push(No(he.audioLevel));const ee=Tu(he,"synthesizedSamplesEvents");E.push(ee);const _e=Fo(he,"synthesizedSamplesDuration");I.push(_e);const Te=Si(_e,re);_.push(Te),L.push(0)}else{const ee=(pe=he._last)!=null&&pe.totalInterFrameDelay?he.totalInterFrameDelay-he._last.totalInterFrameDelay:0;k.push(Fe(ee,1e3/(he.framesDecoded||30),500)),N.push(Fe(he.framesPerSecond,1,100)),R.push(Fe(he.framesPerSecond,1,100)),M.push(Fe(he.frameHeight,1,4400)),y.push(Fe(he.frameWidth,1,7700));const _e=je(he,"totalProcessingDelay");V.push(Fe(_e,1e3/(he.framesDecoded||30),12e4));const Te=je(he,"nackCount");q.push(Te);const Re=je(he,"pliCount");Q.push(Re);const nt=je(he,"qpSum");ne.push(Fe(nt,1/(he.framesPerSecond||1),51)),$.push(Fe(he.framesDropped));const Wt=je(he,"totalFreezesDuration");ie.push(Fe(Wt,1e3,3e4));const Ke=je(he,"jitterBufferEmittedCount"),Et=je(he,"jitterBufferDelay");D.push(Fe(Et,1e3/(Ke||1),3e4));const Ue=je(he,"jitterBufferTargetDelay");B.push(Fe(Ue,1e3/(Ke||1),3e4));const Zt=je(he,"jitterBufferMinimumDelay");z.push(Fe(Zt,1e3/(Ke||1),3e4)),O.push(Fe(he.framesPerSecond,1,100))}}),a.rbr=u.join(","),a.mbrs=h.join(","),a.pbrs=g.join(","),a.pr=f.join(","),a.pl=d.join(","),a.plr=p.join(","),a.jd=l.join(","),a.fecr=w.join(","),a.retransr=m.join(","),a.baser=x.join(","),a.basel=v.join(","),a.recoverr=K.join(","),a.alll=v.join(","),a.totalc=b.join(","),o?(a.er=_.join(","),a.aolevel=C.join(","),a.asrc=L.join(","),a.scnt=E.join(","),a.sdura=I.join(",")):(a.dm=k.join(","),a.dfps=N.join(","),a.rfps=R.join(","),a.rh=M.join(","),a.rw=y.join(","),a.fpt=be.join(","),a.ns=q.join(","),a.pliss=Q.join(","),a.aqp=ne.join(","),a.ofimax=K.join(","),a.ofimin=K.join(","),a.dfimax=K.join(","),a.dfimin=K.join(","),a.rfimax=K.join(","),a.rfimin=K.join(","),a.vrstutter=ie.join(","),a.cdm=D.join(","),a.tdm=B.join(","),a.pdm=z.join(","),a.ofps=O.join(","),a.dfbd=$.join(","))}catch(he){}this.log({evetid:10080,traceid:t,rmtid:e,calid:c,args:this.data2String(Ce({calid:c,rmtid:e,tckid:n,traceid:t,src:i.ssrc,codec:i.codec},a))})}reportNetworkMonitor(c){if(c.length<=0)return;const e=[],t=[],i=[],r=[],n=[],o=[],a=[],u=[],h=[],g=[];c.forEach((d,p)=>{var m;const l=(m=d._last)!=null&&m.timestamp?d.timestamp-d._last.timestamp:1e3;e.push(Fe(d.currentRoundTripTime,1e3)),t.push(Fe(d.availableOutgoingBitrate,8,2e8)),i.push(Dt(Fe(d.bytesSent,8,2e7),l,25e6)),r.push(Dt(Fe(d.bytesReceived,8,2e7),l,25e6)),n.push(0),o.push(0),p%5===0&&(a.push(""),u.push(""),h.push(""),g.push(""))});const f={ctm:Math.floor(c[0].timestamp||0),rtt:e.join(","),bsps:i.join(","),brps:r.join(","),cpu:a.join(","),mem:u.join(","),sysmem:h.join(","),systotalmem:g.join(","),audioonly:this.engine.isAudioOnly()?1:0};this.log({evetid:10071,args:this.data2String(Ce({asb:t.join(","),abms:n.join(","),vbms:o.join(",")},f))}),this.log({evetid:10081,args:this.data2String(Ce({},f))})}reportJoin(c,e,t=""){var g,f;const{start:i,rs:r=0,re:n=0}=e,o=Date.now()-i,a=n-r;let u=0;r&&(u=r-i);let h=0;n&&(h=n-r),this.log({evetid:10010,args:this.data2String({sesid:((g=this.authInfo)==null?void 0:g.sessionId)||"",joitm:o,rslt:c,gslbtm:0,dnstm:0,avcftm:0,gslbrslt:0,dnsrslt:0,avcfrslt:0,mode:2,jrtc:a,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(Ce({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,i,r,n,o,a,u,h,g){this.log({evetid:c?10032:10030,calid:t,args:this.data2String({calid:t,url:e,isvl:i?1:0,isvs:r?1:0,isvss:n?1:0,isaudio:o?1:0,rslt:a,tid:"123",pubtm:Date.now()-g,pctid:u,pubtid:h,isvp:0,isarecording:0,isad:0,isdc:0,pubretry:0,pbrttimes:0})})}reportPublishFirstPacket(c,e,t,i,r,n,o,a,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:o,pubtid:a,totaltm:h-r,jorm:u===di.JOINCHANNEL?1:0,cptc:0,sptc:i-t,iptc:0,ipc2fptc:0,dctc:0,patc:0})})}reportUnpublish(c,e,t,i){var r;this.log({evetid:10040,args:this.data2String({calid:c,unpubtm:e,rslt:t,tid:i,sesid:((r=this.authInfo)==null?void 0:r.sessionId)||""})})}reportSubscribe(c,e,t,i,r,n,o,a,u,h){this.log({evetid:10050,calid:c,rmtid:e,args:this.data2String(Ce({calid:c,rmtid:e,isvl:t?1:0,isvs:i?1:0,isvss:r?1:0,isaudio:n?1:0,rslt:o,tid:a,subtm:u,isvp:0,isaplaying:0,isad:0,isdc:0,subretry:0,sbrttimes:0},h))})}reportSubscribeFirstPacket(c,e,t,i,r){this.log({evetid:c?10054:10051,calid:e,rmtid:t,args:this.data2String(Ce({calid:e,rmtid:t,tckid:i,cptc:0,iptc:0,ipc2fptc:0,dctc:0,patc:0},r))})}reportSubscribeFirstFrame(c,e,t,i,r){this.log({evetid:c?10055:10052,calid:e,rmtid:t,args:this.data2String(Ce({calid:e,rmtid:t,tckid:i},r))}),this.log({evetid:c?10058:10057,args:this.data2String(Ce({calid:e,rmtid:t,tckid:i},r))})}reportUnsubscribe(c,e,t,i,r){this.log({evetid:10060,calid:c,args:this.data2String({calid:c,rmtid:e,unsubtm:t,rslt:i,tid:r})})}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,i){this.log({evetid:11041,args:this.data2String({or:c||"",nr:e,ctm:t,rslt:i})})}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,i){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:i.code||"",mc:JSON.stringify(i)})})}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 i;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:((i=this.authInfo)==null?void 0:i.sessionId)||"",rslt:c?-1:0,adm:1,adt:0,adr:c?2:0,acms:e,adrpn:t})})}reportScreen(c,e){var t,i;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:((i=this.authInfo)==null?void 0:i.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(Ce({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,i,r){this.log({evetid:40301,args:this.data2String({tm:Date.now(),sei_pt:c,sei_len:e,sei_rep:t,sei_delay:i,sei_key:r})})}log(c){c&&(c.tm=new Date().getTime(),le.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(or,"staticClient");let Zi=or;var mn=(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))(mn||{});class Tr{constructor(){A(this,"dbPromise");A(this,"stsToken");A(this,"enable");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.enable||this.logLevel>c)return;let i=this.getCurrentTime();this.logToConsole&&e(i,...t);let r=Tr.paramArrayToString(t);c>0&&this.addLog(r)});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 i=`${t[1]}`;i.startsWith("__g__")&&console.group(`${i.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=!1,this.appId="",this.sessionId="",this.enable=!0,this.dbPromise=f0()}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.enable!==void 0&&(this.enable=c.enable),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()}updateSessionDateLog(c,e,t){return H(this,null,function*(){if(!c||!e||!t||t.length===0||!this.stsToken)return;const i=new Qc;i.file(`${c}.log`,t.map(f=>f.log||"").join(`
|
|
38
|
+
`));const r=yield i.generateAsync({type:"blob"}),n=yield C0(r),o=ps(new Date,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),a={"x-oss-date":o,"content-md5":n,"content-type":"application/zip"};a.date=o,a["x-oss-security-token"]=this.stsToken.security_token;const u=`client/${e}/${this.appId}/${c}.zip`;a.authorization=yield R0(this.stsToken.access_key_id,this.stsToken.access_key_secret,a,`/${this.stsToken.bucket_name}/${u}`);const h=`https://${this.stsToken.bucket_name}.${this.stsToken.region_endpoint}/${u}`,g=yield fetch(h,{method:"PUT",headers:a,body:r});if(g.status===200){Zi.reportOSSUpload(c,e);const f=yield this.dbPromise;t.forEach(d=>{g0(f,d.id)})}else Zi.reportOSSUpload(c,e,g.status)})}uploadSessionLog(c){c&&this.dbPromise.then(e=>H(this,null,function*(){if(!this.stsToken)return;const t=yield xa(e,c),i={},r=[];t.forEach(n=>{const o=n.date;i[o]||(i[o]=[],r.push(o)),i[o].push(n)}),Promise.all(r.map(n=>this.updateSessionDateLog(c,n,i[n]))).then(()=>H(this,null,function*(){(yield xa(e,c)).length===0&&v0(e,c)}))}))}tryUploadHistorySessionLog(){this.dbPromise.then(c=>H(this,null,function*(){(yield m0(c)).filter(t=>t.sid!==this.sessionId).forEach(t=>{this.uploadSessionLog(t.sid)})}))}uploadCurrent(){this.uploadSessionLog(this.sessionId)}setSessionID(c,e){!c||!e||(this.appId=c,this.dbPromise.then(t=>{this.sessionId=e,p0(t,e),this.logCache&&(this.logCache.forEach(i=>{va(t,this.sessionId,i.date,`${i.log}`)}),this.logCache=[])}))}addLog(c){const e=this.getCurrentTime(),t=this.getCurrentDate(),i=`${e} ${c}`;this.sessionId?this.dbPromise.then(r=>{va(r,this.sessionId,t,i)}):this.logCache.push({date:t,log:i})}getCurrentTime(){return ps(new Date,"HH:MM:ss.l")}getCurrentDate(){return ps(new Date,"yyyymmdd")}static paramArrayToString(c){let e="";for(let t=0;t<c.length;t++){e!==""&&(e+=" ");let i=Tr.toString(c[t]);e+=i}return e}}class le{static getLogger(){return this.logger||(this.logger=new Tr),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,...i){t?this.getLogger().ar("[ARE]",c,e,...i):this.getLogger().ae("[ARE]",c,e,...i)}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(le,"logger");const Du=s=>H(this,null,function*(){const c=new ye.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()&&!ye.AliRTS.SystenUtil.isAndroid&&!ye.AliRTS.SystenUtil.isIos,e.detail.isSendMediaExtensionMsgSupported=c.checkWebRtcSupport()&&c.checkEncodedTransformSupport(),e});var Qe=(s=>(s[s.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",s[s.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen",s))(Qe||{}),Oo=(s=>(s[s.PRE_PROCESSOR=0]="PRE_PROCESSOR",s[s.POST_PROCESSOR=1]="POST_PROCESSOR",s))(Oo||{}),Dr=(s=>(s[s.AUDIO=0]="AUDIO",s[s.VIDEO=1]="VIDEO",s[s.BOTH=2]="BOTH",s))(Dr||{});class Fi extends we{constructor(e,t=Qe.AliRtcSdkStreamTypeCapture,i=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=i,this.options=this.initOptions}get initOptions(){return{}}getOptions(){return this.options}init(){return H(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,i;return((t=this.lastInputAudioTrack)==null?void 0:t.id)!==((i=e.currentAudioTrack)==null?void 0:i.id)}videoUpdated(e){var t,i;return((t=this.lastInputVideoTrack)==null?void 0:t.id)!==((i=e.currentVideoTrack)==null?void 0:i.id)}execute(e,t){return H(this,null,function*(){const i=this.shouldUpdate(e,t);this.lastInputAudioTrack=e.currentAudioTrack,this.lastInputVideoTrack=e.currentVideoTrack,this._hasCleared||i?(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 Yi=(s=>(s[s.LiveTranscodingSingle=0]="LiveTranscodingSingle",s[s.LiveTranscodingMix=1]="LiveTranscodingMix",s))(Yi||{}),gn=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingAudio=1]="LiveTranscodingAudio",s[s.LiveTranscodingVideo=2]="LiveTranscodingVideo",s))(gn||{}),Oi=(s=>(s[s.LiveTranscodingCamera=0]="LiveTranscodingCamera",s[s.LiveTranscodingShareScreen=1]="LiveTranscodingShareScreen",s))(Oi||{});const Qi={0:"camera",1:"shareScreen"};var vn=(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))(vn||{});const Bu={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 Br=(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))(Br||{}),er=(s=>(s[s.LiveTranscodingNoBody=0]="LiveTranscodingNoBody",s[s.LiveTranscodingBody=1]="LiveTranscodingBody",s))(er||{}),tr=(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))(tr||{}),xn=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingCrop=1]="LiveTranscodingCrop",s[s.LiveTranscodingFill=2]="LiveTranscodingFill",s))(xn||{}),Pr=(s=>(s[s.LiveTranscodingNormal=0]="LiveTranscodingNormal",s[s.LiveTranscodingVirtualBackground=1]="LiveTranscodingVirtualBackground",s))(Pr||{}),bn=(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))(bn||{}),zt=(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))(zt||{}),Sn=(s=>(s[s.TrascodingPublishTaskStatusStart=0]="TrascodingPublishTaskStatusStart",s[s.TrascodingPublishTaskStatusUpdate=1]="TrascodingPublishTaskStatusUpdate",s[s.TrascodingPublishTaskStatusStop=2]="TrascodingPublishTaskStatusStop",s))(Sn||{}),xt=(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))(xt||{});const Pu={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 _n{constructor(c,e,t,i,r,n,o,a){A(this,"videoWidth");A(this,"videoHeight");A(this,"videoFramerate",20);A(this,"videoBitrate",2e3);A(this,"videoGop",30);A(this,"audioSamplerate",Br.LiveTranscoding_HZ_44100);A(this,"audioBitrate",500);A(this,"audioChannels",1);this.videoWidth=c,this.videoHeight=e,t&&(this.videoFramerate=t),i&&(this.videoBitrate=i),r&&(this.videoGop=r),n&&(this.audioSamplerate=n),o&&(this.audioBitrate=o),a&&(this.audioChannels=a)}}const yn=s=>((s&16711680)>>16)+(s&65280)+((s&255)<<16),Bt=(s=0,c)=>{if(c==0)return 0;let e=s/c;return e<0&&(e=0),e>1&&(e=1),e};class Lr{constructor(c,e,t){A(this,"mixMode",Yi.LiveTranscodingSingle);A(this,"singleParam");A(this,"mixParam");c&&(this.mixMode=c),e&&(this.singleParam=e),t&&(this.mixParam=t)}toJson(c,e,t,i,r){const n={appid:e.appId,channelid:e.channelId};if(c===xt.MPU_TASK_TRANSACTION_POLLING||c===xt.MPU_TASK_TRANSACTION_LIST||c===xt.MPU_TASK_TRANSACTION_ACKNOWLEDGE)return c===xt.MPU_TASK_TRANSACTION_ACKNOWLEDGE&&(n.messageid=r),n;if(n.taskid=t,c!==xt.MPU_TASK_TRANSACTION_STOP){if(n.mixmode=this.mixMode,i&&(n.streamurl=i),this.mixMode===Yi.LiveTranscodingSingle){const o=this.singleParam;if(o){n.streamtype=o.streamType,o.sourceType===Oi.LiveTranscodingShareScreen?n.sourcetype=Qi[o.sourceType]:n.sourcetype=Qi[Oi.LiveTranscodingCamera];const a=[];o.userId&&a.push(o.userId),n.subspecusers=a}}else if(c===xt.MPU_TASK_TRANSACTION_START||c===xt.MPU_TASK_TRANSACTION_UPDATE){const o=this.mixParam;if(o){o.taskProfile&&(n.taskprofile=Bu[o.taskProfile]);const a=o.encodeParam||new _n(1280,720);let u=a.videoWidth,h=a.videoHeight;const g={};Object.keys(a).forEach(d=>{const p=a[d];p>0&&(g[d.toLowerCase()]=p)}),g.lowbitratehighquality=0,n.encodeparam=g,n.backgrounds=o.backgrounds.map(d=>d.toJson(u,h)),n.watermarks=o.watermarks.map(d=>d.toJson(u,h)),n.clockwidgets=o.clockWidgets.map(d=>d.toJson(u,h));const f=o.users.map(d=>d.userId);n.subspecusers=[...new Set(f)],n.layouts=[{audiomixcount:o.users.length,panes:o.users.map((d,p)=>d.toJson(p,u,h,o.mediaProcessMode))}],n.layoutids=["0"],n.cropmode=o.cropMode,n.backgroundcolor=yn(o.backgroundColor),n.taskmode=o.mediaProcessMode}}}return n}}var Jt=(s=>(s.pre="pre",s.prod="prod",s))(Jt||{}),Xt=(s=>(s.AliRtcSdkCommunication="communication",s.AliRtcSdkInteractiveLive="interactive_live",s.AliRtcSdkInteractiveWithLowLatencyLive="cdn_live",s))(Xt||{}),ni=(s=>(s.AliRtcSdkInteractive="interactive",s.AliRtcSdkLive="live",s))(ni||{}),jt=(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))(jt||{}),$e=(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))($e||{}),Ne=(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))(Ne||{}),yi=(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))(yi||{}),wn=(s=>(s[s.AliRtcUserOfflineQuit=0]="AliRtcUserOfflineQuit",s[s.AliRtcUserOfflineDropped=1]="AliRtcUserOfflineDropped",s[s.AliRtcUserOfflineBecomeAudience=2]="AliRtcUserOfflineBecomeAudience",s))(wn||{}),Vi=(s=>(s[s.AliRtcAudioTrackNo=0]="AliRtcAudioTrackNo",s[s.AliRtcAudioTrackMic=1]="AliRtcAudioTrackMic",s[s.AliRtcAudioTrackDual=2]="AliRtcAudioTrackDual",s))(Vi||{}),ke=(s=>(s[s.AliRtcVideoTrackNo=0]="AliRtcVideoTrackNo",s[s.AliRtcVideoTrackCamera=1]="AliRtcVideoTrackCamera",s[s.AliRtcVideoTrackScreen=2]="AliRtcVideoTrackScreen",s[s.AliRtcVideoTrackBoth=3]="AliRtcVideoTrackBoth",s))(ke||{}),Ee=(s=>(s[s.AliRtcStatePublishIdle=0]="AliRtcStatePublishIdle",s[s.AliRtcStateNoPublish=1]="AliRtcStateNoPublish",s[s.AliRtcStatePublishing=2]="AliRtcStatePublishing",s[s.AliRtcStatePublished=3]="AliRtcStatePublished",s))(Ee||{}),He=(s=>(s[s.AliRtcStateSubscribeIdle=0]="AliRtcStateSubscribeIdle",s[s.AliRtcStateNoSubscribe=1]="AliRtcStateNoSubscribe",s[s.AliRtcStateSubscribing=2]="AliRtcStateSubscribing",s[s.AliRtcStateSubscribed=3]="AliRtcStateSubscribed",s))(He||{}),rt=(s=>(s[s.AliRtcVideoStreamTypeNone=0]="AliRtcVideoStreamTypeNone",s[s.AliRtcVideoStreamTypeHigh=1]="AliRtcVideoStreamTypeHigh",s[s.AliRtcVideoStreamTypeLow=2]="AliRtcVideoStreamTypeLow",s))(rt||{}),ir=(s=>(s[s.CAMERA_INVALID=-1]="CAMERA_INVALID",s[s.CAMERA_REAR=0]="CAMERA_REAR",s[s.CAMERA_FRONT=1]="CAMERA_FRONT",s))(ir||{});const Vo=10,Uo=5e3,Vr=class Vr extends we{constructor(e){super();A(this,"ws");A(this,"socketStatus",0);A(this,"wsUrl","");A(this,"lastConnectStartTime",0);A(this,"maxConnectRetryCount",Vo);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:Vo,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 H(this,null,function*(){const t=this.socketStatus;if(le.info(Vr.logName,`onClose, status: ${t}, retryCount: ${this.connectRetryCount}`),t!==0||this.connectRetryCount)if(yield Ut.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>=Uo?this.reconnect():window.setTimeout(()=>{this.reconnect()},Uo)}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(Vr,"logName","Socket");let An=Vr;var qe=(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))(qe||{});class Lu{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:i}=this.authInfo;return{timestamp:c,nonce:e,token:t,tokenrole:i}}}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=Ut.getVersionNumber().toString(),c.header.platform=oa,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=Ut.getVersionNumber().toString(),e.header.platform=oa,e.data=Ce(Ce({},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:fi(),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 de=(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))(de||{});class ce extends Error{constructor(e,t,i){super(t);A(this,"_code");A(this,"_extra");this._code=e,this._extra=i}static fromError(e,t=-1,i=""){return new ce(t,e.message||e.reason||i||"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 Mu=3e4,At=class At extends we{constructor(e,t,i,r,n,o){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 Lu(e,t),this.channelProfile=i,this.clientRole=r,this.slsReporter=n,this.wsClient=new An(o),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:i,resume:r}=e;i.forEach(n=>{const{codec:o,ssrc:a}=n;n.userdata=JSON.stringify({codec:o}),n.ssrc=`${a}`,r&&(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=Ce(Yt(Ce({},t.data),{sessionid:t.header.sessionid}),e),this.sendPackage(t)}refreshAuthInfo(e){this.authInfo=e,this.packageCreater.refreshAuthInfo(e)}close(){le.info(`[${At.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){[qe.KEEPALIVE,qe.RECONNECT,qe.JOINCHANNEL].includes(e.msgtype)||this.packageCache.set(e.tid,e),this.wsClient.send(e),e.msgtype!==qe.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!0,e.msgtype,e.tid,e)}updateReconnectData(e){this.reconnectData=e}onOpen(){if(le.info(`[${At.logName}] onOpen`),this.isFirstConnect){let e=this.packageCreater.createJoinPackage();e.data.configure={channelprofile:this.channelProfile},(this.channelProfile===Xt.AliRtcSdkInteractiveLive||this.channelProfile===Xt.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)!==qe.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!1,t.msgtype,t.tid,t)}catch(t){le.warn(`[${At.logName}] onMessage err`,t,e)}}onError(e){le.warn(`[${At.logName}] onError`,e),this.isFirstConnect&&this.onConnectFail()}onConnectFail(){le.warn(`[${At.logName}] onConnectFail`);const e=new ce(de.ERR_INNER,"Signaling connect failed.");this.isFirstConnect?this.emit("onJoinChannelResult",e):this.emit("onConnectFail",e)}onAuthInvalid(){le.warn(`[${At.logName}] onAuthInvalid`),this.isFirstConnect&&this.emit("onAuthInvalid")}onNetworkError(){le.warn(`[${At.logName}] onNetworkError`);const e=new ce(de.ERR_INNER,"Network error, signaling connect failed.");this.emit("onNetworkError",e)}onClose(e){le.info(`[${At.logName}] onClose`,e),this.stopKeepAlive()}onKeepAliveRsp(){this.emit("onKeepAliveRsp"),this.checkAlive()}onReconnectStart(){this.emit("onReconnectStart")}onReconnectFail(){this.emit("onReconnectFail",new ce(de.ERR_INNER,"signaling reconnect failed."))}checkAlive(){window.clearTimeout(this.aliveChecker),this.aliveChecker=window.setTimeout(()=>{le.info(`[${At.logName}] not alive, reconnect`),this.stopKeepAlive(),this.emit("onReconnectStart"),this.wsClient.reconnect()},Mu)}onRecvMessage(e){switch(e.msgtype!==qe.KEEPALIVE&&le.info(`[${At.logName}] recv msg: ${e.msgtype}`),e.msgtype){case qe.JOINCHANNEL:this.onJoinResult(e);break;case qe.KEEPALIVE:this.onKeepAliveRsp();break;case qe.PUBLISH:this.onPublishResult(e);break;case qe.NOTIFYJOIN:this.onNotifyJoin(e);break;case qe.NOTIFYSTATUS:this.onNotifyStatus(e);break;case qe.LEAVECHANNEL:this.onLeaveResult(e);break;case qe.NOTIFYLEAVE:this.onNotifyLeave(e);break;case qe.NOTIFYPUBLISH:this.onNotifyPublish(e);break;case qe.STATUSREPORT:this.onStatusReport(e);break;case qe.BYE:this.onBye(e);break;case qe.ROLEUPDATE:this.onRoleUpdateResult(e);break;case qe.REFRESHURL:this.onRefreshUrlResult(e);break;case qe.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 ce(de.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(At,"logName","RSMessageCenter");let En=At;const j=(s,c)=>(e,t,i)=>{const r=i.value;return i.value=function(...n){var g;const o=`[${((g=e.constructor)==null?void 0:g.logName)||""}]`,a=Date.now();let u=[];if(s)try{u=s(n)}catch(f){}le.interface(o,t,...u);const h=r.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;le.interfaceResult(o,t,!(p&&l),`${Date.now()-a}ms`,d)}}),h},i},ue=s=>s;var Nu=Object.defineProperty,Fu=Object.getOwnPropertyDescriptor,Cn=(s,c,e,t)=>{for(var i=t>1?void 0:t?Fu(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&Nu(c,e,i),i};const Mr=(pt=class extends we{constructor(e,t,i,r=Jt.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=i,this.reconnectData={role:{channelprofile:e,clientrole:t}};const n=r===Jt.pre?lr.pre:lr.prod;this.roomServerUri=`wss://${n}/roomserver/v1/ws`}updateReconnectData(e){var t;this.reconnectData=e,(t=this.messageCenter)==null||t.updateReconnectData(this.reconnectData)}reset(){le.info("[roomsig] reset"),this.messageCenter&&(this.messageCenter.close(),this.messageCenter=void 0),this.authInfo=void 0}join(e,t,i){return H(this,null,function*(){return new Promise((r,n)=>{const o={};this.authInfo=e,this.userName=t,this.messageCenter=new En(e,t,this.channelProfile,this.clientRole,this.slsReporter,i),this.initMessageCenter(),this.messageCenter.once("onJoinChannelResult",u=>{var h,g,f;if(le.info(`[${pt.logName}]`,"join result: ",u),o.taskretrynum=((h=this.messageCenter)==null?void 0:h.retryCount)||0,u.code==200){(g=this.messageCenter)==null||g.sendPkgCache(),(f=this.messageCenter)==null||f.startKeepAlive();let d=u.data;d.tid=u.tid,d.users=u.data.users,d.timestamp=u.timestamp,o.est&&(o.joinconnecttc=Date.now()-o.est),this.slsReporter.reportJoinConnection(o),r(d)}else this.reset(),n(this.handleSignalError(u.code,u.reason,de.ERR_JOIN_CHANNEL_FAILED))}),this.messageCenter.once("onAuthInvalid",()=>{this.reset(),n(new ce(de.ERR_JOIN_BAD_TOKEN,"join failed because authentication failed"))}),le.info(`[${pt.logName}]`,"start ws connecting roomserver and auto join when connected");const a={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:fi()};e.role&&(a.tokenrole=e.role),o.est=Date.now(),this.messageCenter.start(this.roomServerUri+"?"+Ut.queryingParam(a))})})}leave(){return le.info("[roomsig] leave .."),new Promise((e,t)=>{this.messageCenter?(this.messageCenter.on("onLeaveResult",(i,r)=>{le.info(`[${pt.logName}]`,"recv leave response "+i),i===200?(this.updateReconnectData(),this.reset(),e({tid:r})):t(this.handleSignalError(i,"leave error"))}),le.info(`[${pt.logName}]`,"send leave request"),this.messageCenter.leave()):(le.info(`[${pt.logName}]`,"no message center, ok to leave"),e({tid:""}))})}publish(e){return new Promise((t,i)=>{var r;this.messageCenter?(this.messageCenter.once("onPublishResult",(n,o,a)=>{le.info(`[${pt.logName}]`,"recv pubish response "+n),n===200?(this.updateReconnectData(Yt(Ce({},this.reconnectData),{publish:{users:[e]}})),t({tid:o})):i(this.handleSignalError(n,`publish error, ${a}`))}),this.authInfo&&(e.sessionid=(r=this.authInfo.sessionId)!=null?r:""),e.callid||(e.callid=fi()),le.info(`[${pt.logName}]`,"assign callid "+e.callid+" and send publish request"),this.messageCenter.publish(e)):i(this.handleSignalError(-1,"publish error, no message center"))})}roleUpdate(e){return new Promise((t,i)=>{if(!this.messageCenter){i(this.handleSignalError(-1,"role update error, no message center"));return}this.messageCenter.on("onRoleUpdateResult",(r,n,o)=>{var a,u;le.info(`[${pt.logName}]`,"recv role update response "+r),r===200?((u=(a=this.reconnectData)==null?void 0:a.role)!=null&&u.clientrole&&(this.reconnectData.role.clientrole=e,this.updateReconnectData(this.reconnectData)),t({tid:n})):i(this.handleSignalError(r,`role update error, ${o}`))}),this.messageCenter.roleUpdate(e)})}setChannelProfile(e){this.channelProfile=e}refreshUrl(e){return le.info(`[${pt.logName}]`,"refreshUrl .."),new Promise((t,i)=>{if(!this.messageCenter){i(this.handleSignalError(-1,"refresh url error, no message center"));return}this.messageCenter.on("onRefreshUrlResult",r=>{const{code:n,description:o,data:a={}}=r||{};le.info("recv refresh url response "+n),n===200?t(a):i(this.handleSignalError(n,`refresh url error, ${o}`))}),le.info("send refresh url request"),this.messageCenter.refreshUrl(e)})}reportStatus(e){return le.info(`[${pt.logName}]`,"reportStatus "+e),new Promise((t,i)=>{this.messageCenter?(this.messageCenter.once("onStatusReport",(r,n)=>{r===200?t():i(new ce(r,n))}),this.messageCenter.reportStatus(e)):i(new ce(-1,"No messageCenter"))})}handleSignalError(e,t,i=de.ERR_INNER){const r=`signal error: code - ${e}; description - ${t}`;return new ce(i,r)}refreshAuthInfo(e){return H(this,null,function*(){var t;this.authInfo&&(this.authInfo=e,(t=this.messageCenter)==null||t.refreshAuthInfo(this.authInfo))})}initMessageCenter(){var e,t,i,r,n,o,a,u,h,g,f,d;(e=this.messageCenter)==null||e.on("onKeepAliveRsp",()=>{this.emit("onKeepAliveRsp")}),(t=this.messageCenter)==null||t.on("onNotifyJoin",p=>{this.emit("onNotifyJoin",p)}),(i=this.messageCenter)==null||i.on("onNotifyStatus",p=>{this.emit("onNotifyStatus",p)}),(r=this.messageCenter)==null||r.on("onNotifyLeave",p=>{this.emit("onNotifyLeave",p)}),(n=this.messageCenter)==null||n.on("onNotifyPublish",p=>{this.emit("onNotifyPublish",p)}),(o=this.messageCenter)==null||o.on("onBye",(p,l)=>{this.emit("onBye",p,l)}),(a=this.messageCenter)==null||a.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)}),(g=this.messageCenter)==null||g.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(pt,"logName","RoomServerSignaling"),pt);Cn([j()],Mr.prototype,"join",1),Cn([j()],Mr.prototype,"publish",1),Cn([j()],Mr.prototype,"roleUpdate",1);let Ou=Mr;const Vu="https://pgw.rtn.aliyuncs.com",Uu="https://gw.rtn.aliyuncs.com",cr=class cr extends we{constructor(e,t){super();A(this,"env");A(this,"authInfo");A(this,"timer");A(this,"slsReporter");A(this,"requestToken",()=>H(this,null,function*(){if(!this.authInfo)return;const{appId:e,channelId:t,userId:i,nonce:r="",token:n,timestamp:o,sessionId:a,role:u}=this.authInfo;let h=Uu;this.env===Jt.pre&&(h=Vu);const g=`${h}/gslb/v1/stsupdate?appid=${e}&channelid=${t}&userid=${i}&nonce=${r}&token=${n}×tamp=${o}&session=${a}${u?`&tokenrole=${u}`:""}&slstoken=true&osstoken=true&tokensid=false`;fetch(g).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.emit("onTokenUpdate",l,m),le.event(`[${cr.logName}]`,"getToken",l,m),f}this.slsReporter.reportSTSResult(200)}).catch(f=>{this.slsReporter.reportSTSResult(-1),le.error(`[${cr.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(()=>{this.requestToken()},1e3*60*10)}clear(){this.timer&&clearInterval(this.timer)}};A(cr,"logName","StsManager");let In=cr;class Hu extends we{constructor(e,t,i,r=Jt.prod){super();A(this,"signaling");A(this,"authInfo");A(this,"userName");A(this,"channelProfile");A(this,"clientRole");A(this,"env",Jt.prod);A(this,"maxConnectRetryCount");A(this,"stsManager");A(this,"slsReporter");this.channelProfile=e,this.clientRole=t,this.env=r,this.slsReporter=i,this.stsManager=new In(i,r)}reset(){var e;le.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,i,r){return this.maxConnectRetryCount=i,this.userName=t,new Promise((n,o)=>{this.signaling?o(new ce(de.ERR_JOIN_ALREADY_JOINED,"already joined")):(le.info("[signalingmanager] create signaling"),this.signaling=new Ou(this.channelProfile,this.clientRole,this.slsReporter,this.env),this.initSignaling(),r&&(r.rs=Date.now()),this.signaling.join(e,t,i).then(a=>{this.authInfo=e,r&&(r.re=Date.now()),n(a)}).catch(a=>{this.reset(),o(a)}),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(i=>{this.reset(),e(i)}).catch(i=>{t(i)}):e({tid:""})})}publish(e){return new Promise((t,i)=>{var r;this.signaling&&this.authInfo?(e.userid=this.authInfo.userId,e.displayname=(r=this.userName)!=null?r:this.authInfo.userId,this.signaling.publish(e).then(n=>{t(n)}).catch(n=>{i(n)})):i(new ce(de.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL,"no signaling"))})}reportStatus(e){return new Promise((t,i)=>{this.signaling?this.signaling.reportStatus(e).then(()=>{t()}).catch(r=>{i(r)}):i(new ce(-1,"no signaling"))})}setClientRole(e){return H(this,null,function*(){const t=this.clientRole;if(!this.signaling){this.clientRole=e;return}const i=Date.now();try{const r=yield this.signaling.roleUpdate(e);return this.slsReporter.reportRoleUpdateResult(t,e,Date.now()-i,0),r}catch(r){this.slsReporter.reportRoleUpdateResult(t,e,Date.now()-i,r.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 ce(de.ERR_SDK_INVALID_STATE,"should join first"))}refreshAuthInfo(e){return H(this,null,function*(){var t;try{this.authInfo&&(this.authInfo=Ce(Ce({},this.authInfo),e),(t=this.signaling)==null||t.refreshAuthInfo(this.authInfo),this.stsManager.refreshAuthInfo(this.authInfo))}catch(i){throw i}})}initSignaling(){var e,t,i,r,n,o,a,u,h,g,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)),(i=this.signaling)==null||i.on("onNotifyStatus",this.onNotifyStatus.bind(this)),(r=this.signaling)==null||r.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)),(a=this.signaling)==null||a.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)),(g=this.signaling)==null||g.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 Ci=class Ci{static getInstance(){return Ci.instance||(Ci.instance=new AudioContext),Ci.instance.resume(),Ci.instance}};A(Ci,"instance");let Rn=Ci;function zu(s,c,e,t,i){let r=t,n=0,o;const a=s.createAnalyser();a.fftSize=256;const u=new Uint8Array(a.frequencyBinCount);c.connect(a),a.connect(e);const h=()=>{o&&window.clearInterval(o)},g=()=>{o=window.setInterval(()=>{a.getByteFrequencyData(u);let f=Math.round(u.reduce((d,p)=>d+p)/u.length);f=Math.min(100,f),n=f,i&&i(f)},r)};return g(),{updateInterval:f=>{h(),r=f,g()},getLevel:()=>n,dispose:()=>{h(),c.disconnect(),a.disconnect()}}}class ju extends we{constructor(){super();A(this,"audioContext");A(this,"stream");A(this,"sourceNode");A(this,"analyser");this.audioContext=Rn.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 i=this.audioContext.createMediaStreamDestination();this.analyser=zu(this.audioContext,this.sourceNode,i,t,r=>{this.emit("audioLevel",r)})}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 Ho extends we{constructor(e,t,i,r){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=i,this.audioVolumeIndicationInterval=r,this.audioLevelMonitor=new ju}get userId(){return this.uid}get displayname(){return this.name}createCallId(){this.callId||(this.callId=Ut.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 zo{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 jo="customVideoProfile",Wo="customScreenProfile",rr={width:1280,height:720,frameRate:30,maxBitrate:2e3},sr={width:1920,height:1080,frameRate:30,maxBitrate:2600},Wu={1e4:$e.AliEngineLocalDeviceExceptionTypeUnknown,2e4:$e.AliEngineLocalDeviceExceptionTypeUnknown,10001:$e.AliEngineLocalDeviceExceptionTypeMicNotAvailable,10002:$e.AliEngineLocalDeviceExceptionTypeMicAuthFail,10003:$e.AliEngineLocalDeviceExceptionTypeMicOpenFail,10005:$e.AliEngineLocalDeviceExceptionTypeCameraAuthFail,10004:$e.AliEngineLocalDeviceExceptionTypeVideoDeviceException,10006:$e.AliEngineLocalDeviceExceptionTypeCameraOpenFail,10010:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10011:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10012:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10013:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10014:$e.AliEngineLocalDeviceExceptionTypeDisplayException,10019:$e.AliEngineLocalDeviceExceptionTypeDisplayException},Ku=s=>s.getAudioTracks()[0];function Ko(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 ce(de.ERR_INVALID_ARGUMENTS,"element should be HtmlVideoElement")}else throw new ce(de.ERR_INVALID_ARGUMENTS,"element not founded")}else throw new ce(de.ERR_INVALID_ARGUMENTS,"element id should be string")}function kn(s){var e;const c=[];if(Array.isArray(s))s.forEach(t=>{try{c.push(Ko(t))}catch(i){}});else if(typeof s=="string"||((e=s==null?void 0:s.nodeName)==null?void 0:e.toLowerCase())==="video")try{c.push(Ko(s))}catch(t){}return c}function wi(s){return new Promise(c=>setTimeout(c,s))}const $o=(s,c)=>{const e=()=>(s.muted=!0,Promise.race([wi(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(ye.AliRTS.BrowserUtil.isMicroMessenger){const i=window.top!==window.self,r=window.WeixinJSBridge||window.top.WeixinJSBridge;r?r.invoke("getNetworkType",{},()=>{t(e())}):(i?window.top.document:document).addEventListener("WeixinJSBridgeReady",()=>{r.invoke("getNetworkType",{},()=>{t(e())})}),setTimeout(()=>{t(e())},1e3)}else t(e())})},ai=s=>{Promise.race([wi(100),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{s.srcObject=null,s._playPromise=void 0})};var $u=Object.defineProperty,qu=Object.getOwnPropertyDescriptor,Xe=(s,c,e,t)=>{for(var i=t>1?void 0:t?qu(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&$u(c,e,i),i};const qo=30;class Nr extends we{constructor(){super();A(this,"state");A(this,"time");this.state=Ee.AliRtcStatePublishIdle,this.time=Date.now()}setState(e){const t=this.state,i=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-i)/1e3))}}const Ge=(ci=class extends Ho{constructor(e){const{rtsManager:t,localStreamManager:i,slsReporter:r,signalingManager:n,audioVolumeIndicationInterval:o}=e;super("","",t,o);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",fi());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=i,this.signalingManager=n,this.slsReporter=r,this.streamManager.on("trackended",a=>{this.onTrackEnd(a)}),this.streamManager.on("publishupdate",()=>{this.publishUpdate()}),this.audioPubState=new Nr,this.audioPubState.on("change",(a,u,h)=>{this.emit("audioPublishStateChanged",a,u,h)}),this.videoPubState=new Nr,this.videoPubState.on("change",(a,u,h)=>{this.emit("videoPublishStateChanged",a,u,h)}),this.videoSmallPubState=new Nr,this.videoSmallPubState.on("change",(a,u,h)=>{this.emit("dualStreamPublishStateChanged",a,u,h)}),this.screenPubState=new Nr,this.screenPubState.on("change",(a,u,h)=>{this.emit("screenPublishStateChanged",a,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:i,msid:r})=>i==="video"&&t&&r===Z.VideoLarge))}get hasCameraDualTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="video"&&t&&r===Z.VideoSmall))}get hasScreenTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="video"&&t&&r===Z.Screen))}get hasAudioTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="audio"&&t&&r===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||Ut.createCallid(),this.updatePubId()}setVideoProfile(e,t){return H(this,null,function*(){yield this.streamManager.setVideoProfile(e,t)})}setVideoContentHint(e){this.streamManager.setVideoContentHint(e)}setScreenContentHint(e){this.streamManager.setScreenContentHint(e)}setAudioProfile(e){return H(this,null,function*(){yield this.streamManager.setAudioProfile(e)})}setScreenProfile(e,t){return H(this,null,function*(){yield this.streamManager.setScreenProfile(e,t)})}setCameraDirection(e){if(e===ir.CAMERA_FRONT)this.streamManager.setCameraVideoConstraints({facingMode:"user"});else if(e===ir.CAMERA_REAR)this.streamManager.setCameraVideoConstraints({facingMode:"environment"});else throw new ce(de.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=fi()}clearPublishState(){this.streamTracks=void 0}clear(){return H(this,null,function*(){Vn(ci.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)&&(ai(e),this.previewElements.splice(this.previewElements.indexOf(e),1)),this.screenPreviewElements.includes(e)&&(ai(e),this.screenPreviewElements.splice(this.screenPreviewElements.indexOf(e),1))}setPreviewElement(e){const{videoElement:t,screen:i}=e;i?this.screenPreviewElements.includes(t)||this.screenPreviewElements.push(t):this.previewElements.includes(t)||this.previewElements.push(t)}setViewConfig(e,t){if(!e){t===ke.AliRtcVideoTrackCamera?this.stopPreview({primary:!0,screen:!1}):this.stopPreview({primary:!1,screen:!0});return}if(![ke.AliRtcVideoTrackCamera,ke.AliRtcVideoTrackScreen].includes(t))throw new ce(de.ERR_INVALID_ARGUMENTS,"set view config invalid track",{track:t});e.forEach(i=>{this.setPreviewElement({videoElement:i,screen:t===ke.AliRtcVideoTrackScreen})})}startCameraCapture(e){return H(this,null,function*(){return this.streamManager.cameraCaptureDisabled=!1,yield this.createLocalStream(e)})}stopCameraCapture(){return H(this,null,function*(){this.streamManager.cameraCaptureDisabled=!0,yield this.stopLocalStream({video:!0})})}stopAudioCapture(){return H(this,null,function*(){this.streamManager.audioCaptureDisabled=!0,yield this.stopLocalStream({audio:!0})})}preview(e){return H(this,null,function*(){const{videoElement:t,screen:i}=e!=null?e:{};try{let r=i?this.streamManager.screenStreamInfo.previewStream:this.streamManager.cameraStreamInfo.previewStream;if(!t)throw new ce(de.ERR_INVALID_ARGUMENTS,"no video element found",{videoElement:t});if(!r){le.info(`[${ci.logName}]`,"preview no stream founded");return}return $o(t,r.mediaStream),this.setPreviewElement(e),r.mediaStream}catch(r){const n=de.ERR_INNER;throw ce.fromError(r,n,"preview failed")}})}previewAll(e){return H(this,null,function*(){const{primary:t=!0,screen:i=!0}=e!=null?e:{};if(t&&this.previewElements.length)for(let r=0;r<this.previewElements.length;r++){const n=this.previewElements[r];yield this.preview({videoElement:n})}if(i&&this.screenPreviewElements.length)for(let r=0;r<this.screenPreviewElements.length;r++){const n=this.screenPreviewElements[r];yield this.preview({videoElement:n,screen:!0})}})}stopPreview(e){const{videoElement:t,primary:i=!0,screen:r=!0}=e||{};if(!t)i&&(this.previewElements.forEach(n=>{ai(n)}),this.previewElements=[]),r&&(this.screenPreviewElements.forEach(n=>{ai(n)}),this.screenPreviewElements=[]);else{const n=this.previewElements.findIndex(o=>o===t);if(n>=0)this.previewElements.splice(n,1),ai(t);else{const o=this.screenPreviewElements.findIndex(a=>a===t);o>=0&&(this.screenPreviewElements.splice(o,1),ai(t))}}}resumePublish(){return H(this,null,function*(){this._isPublishing=!1,yield this.startPublish(!0)})}createLocalStream(e){return H(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 i=Wu[t.errorCode];throw i&&(e.audio?this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeMic,i,""):e.video?this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeCamera,i,""):e.screen?this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeDisplay,i,""):this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeUnknown,i,"")),t}})}stopLocalStream(e){return H(this,null,function*(){e.audio&&this.audioLevelMonitor.stop(),yield this.streamManager.stopLocalStream(e)})}compareAndPublish(e,t,i){return H(this,null,function*(){var n,o;if(!e&&!t)return;if(e&&!t){const a={};return i===Z.Audio?a.audio=!0:i===Z.VideoLarge||i===Z.VideoSmall?(a.video=!0,a.vMsid=i):i===Z.Screen&&(a.screen=!0),yield this.publishDeleteTracks(a)}const r={};if(t!=null&&t.hasVideo&&(r.isScreen=i===Z.Screen,r.vMsid=i),t!=null&&t.hasAudio&&(r.aMsid=i),!e&&t)return yield this.publishAdd(t,r,!1);if(e&&t){const a=e.trackId,u=((n=t.videoTrack)==null?void 0:n.id)||((o=t.audioTrack)==null?void 0:o.id);if(a!==u)return yield this.publishReplace(t,r)}})}reportAudioProfile(){const e=this.streamManager.cameraStreamInfo.audioProfile||"standard",t=ye.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=ye.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=ye.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 H(this,arguments,function*(e=!1,t=di.MANUAL){if(!this.joined)return;this.createCallId();const i=yield this.streamManager.publishStreams,{audio:r,video:n,videoSmall:o,screen:a}=i;try{const u=new Date().getTime();r&&this.audioPubState.setState(Ee.AliRtcStatePublishing),n&&this.videoPubState.setState(Ee.AliRtcStatePublishing),o&&this.videoSmallPubState.setState(Ee.AliRtcStatePublishing),a&&this.screenPubState.setState(Ee.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,r&&(this.trackTraceIdMap[Z.Audio]=h,this.reportAudioProfile()),o&&(this.trackTraceIdMap[Z.VideoSmall]=h),n&&(this.trackTraceIdMap[Z.VideoLarge]=h,this.reportVideoProfile()),a&&(this.trackTraceIdMap[Z.Screen]=h,this.reportScreenProfile());const g={type:li.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(g,i,u),r&&this.audioPubState.setState(Ee.AliRtcStatePublished),n&&this.videoPubState.setState(Ee.AliRtcStatePublished),o&&this.videoSmallPubState.setState(Ee.AliRtcStatePublished),a&&this.screenPubState.setState(Ee.AliRtcStatePublished)}catch(u){throw r&&this.audioPubState.setState(Ee.AliRtcStateNoPublish),n&&this.videoPubState.setState(Ee.AliRtcStateNoPublish),o&&this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish),a&&this.screenPubState.setState(Ee.AliRtcStateNoPublish),u}})}publishUpdate(){return H(this,null,function*(){var r,n,o,a;if(!this._isPublishing)return;yield this.publishPromise;const e=this.streamManager.publishStreams;let t;const i=new Date().getTime();try{const u=(r=this.streamTracks)==null?void 0:r.find(({ssrc:x,type:v,msid:b})=>v==="audio"&&x&&b===Z.Audio),h=yield this.compareAndPublish(u,e.audio,Z.Audio);h&&(t=h);const g=(n=this.streamTracks)==null?void 0:n.find(({ssrc:x,type:v,msid:b})=>v==="video"&&x&&b===Z.VideoLarge),f=yield this.compareAndPublish(g,e.video,Z.VideoLarge);f&&(t=f);const d=(o=this.streamTracks)==null?void 0:o.find(({ssrc:x,type:v,msid:b})=>v==="video"&&x&&b===Z.VideoSmall),p=yield this.compareAndPublish(d,e.videoSmall,Z.VideoSmall);p&&(t=p);const l=(a=this.streamTracks)==null?void 0:a.find(({ssrc:x,type:v,msid:b})=>v==="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,i)}catch(u){const{code:h}=u!=null?u:{},g=this.url;throw h===403&&g&&(yield this.refreshPushStreamUrl(),t=yield this.publishUpdate()),u}return t})}syncPublishToRoomServer(e,t,i){return H(this,null,function*(){if(!e)throw new ce(de.ERR_INNER,"sync publish to room server failed because no publishInfo");const r=yield this.signalingManager.publish(e);e.signaltid=r.tid})}refreshPushStreamUrl(){return H(this,null,function*(){const e=new ce(de.ERR_INNER,"refresh push stream url error"),t=this.url;if(!t)throw e;const i=yield this.signalingManager.refreshUrl({pushstreamurl:t});if(!(i!=null&&i.pushstreamurl))throw e;this.url=i==null?void 0:i.pushstreamurl})}publishAdd(e,t,i=!1,r=0){return H(this,null,function*(){this.createCallId();const n=(t==null?void 0:t.aMsid)===Z.Audio,o=(t==null?void 0:t.vMsid)===Z.VideoLarge,a=(t==null?void 0:t.vMsid)===Z.VideoSmall,u=(t==null?void 0:t.vMsid)===Z.Screen;n&&this.audioPubState.setState(Ee.AliRtcStatePublishing),o&&this.videoPubState.setState(Ee.AliRtcStatePublishing),a&&this.videoSmallPubState.setState(Ee.AliRtcStatePublishing),u&&this.screenPubState.setState(Ee.AliRtcStatePublishing);try{const h=yield this.rtsManager.publishAdd(this.url,e,this.callId,t,!1,0,!0);n&&(this.audioPubState.setState(Ee.AliRtcStatePublished),this.reportAudioProfile(),this.trackTraceIdMap[Z.Audio]=h),o&&(this.videoPubState.setState(Ee.AliRtcStatePublished),this.reportVideoProfile(),this.trackTraceIdMap[Z.VideoLarge]=h),a&&(this.videoSmallPubState.setState(Ee.AliRtcStatePublished),this.trackTraceIdMap[Z.VideoSmall]=h),u&&(this.screenPubState.setState(Ee.AliRtcStatePublished),this.reportScreenProfile(),this.trackTraceIdMap[Z.Screen]=h),this.streamTracks=this.rtsManager.publishingTracks;const g={type:li.Add,userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:i,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callId,tracks:this.streamTracks,traceid:h};return this.reportSelfDeviceStatus(),this.monitorTimerId||this.startStreamMonitor(),g}catch(h){let g=de.ERR_SDK_PUBLISH_INVAILD;if(n&&(this.audioPubState.setState(Ee.AliRtcStateNoPublish),g=de.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED),o&&(this.videoPubState.setState(Ee.AliRtcStateNoPublish),g=de.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED),a&&(this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish),g=de.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED),u&&(this.screenPubState.setState(Ee.AliRtcStateNoPublish),g=de.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED),h.errorCode===15006&&r<3)return this.publishAdd(e,t,i,r+1);throw ce.fromError(h,g,"publish add failed")}})}publishReplace(e,t){return H(this,null,function*(){try{yield this.rtsManager.publishReplace(this.url,e,t),this.streamTracks=this.rtsManager.publishingTracks;const i={type:li.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(),i}catch(i){throw ce.fromError(i,de.ERR_INNER,`publish replace failed, vMsid: ${t==null?void 0:t.vMsid} aMsid: ${t==null?void 0:t.aMsid}`)}})}publishDeleteTracks(e){return H(this,null,function*(){const t={type:li.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(Ee.AliRtcStateNoPublish),e.video&&(e.vMsid===Z.VideoSmall?this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish):this.videoPubState.setState(Ee.AliRtcStateNoPublish)),e.screen&&this.screenPubState.setState(Ee.AliRtcStateNoPublish),t.tracks=this.streamTracks,this.reportSelfDeviceStatus(),t}catch(i){throw ce.fromError(i,de.ERR_INNER,"publish delete tracks failed")}})}publishStop(){return H(this,null,function*(){var t;if(!this._isPublishing)throw new ce(de.ERR_INNER,"publish stop failed, previous localStream is required for publishing stopping");le.info(`[${ci.logName}]`,"publishStop",{url:this.url});const e=new Date().getTime();try{const i=this.hasAudioTrackInMS,r=this.hasCameraTrackInMS,n=this.hasCameraDualTrackInMS,o=this.hasScreenTrackInMS;yield this.rtsManager.publishStop(this.url),i&&this.audioPubState.setState(Ee.AliRtcStateNoPublish),r&&this.videoPubState.setState(Ee.AliRtcStateNoPublish),n&&this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish),o&&this.screenPubState.setState(Ee.AliRtcStateNoPublish),this.traceId="",(t=this.streamTracks)==null||t.forEach(u=>{this.reportPublishMonitor(u)}),this.streamTracks=[];const a={type:li.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(i){throw ce.fromError(i,de.ERR_INNER,"publish stop failed")}})}unPublish(){return H(this,null,function*(){var i;const e=new Date().getTime();let t={type:li.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,n=this.hasCameraTrackInMS,o=this.hasCameraDualTrackInMS,a=this.hasScreenTrackInMS;yield this.rtsManager.unpublish(),(i=this.streamTracks)==null||i.forEach(u=>{this.reportPublishMonitor(u)}),this.streamTracks=[],this.stopStreamMonitor(),r&&this.audioPubState.setState(Ee.AliRtcStateNoPublish),n&&this.videoPubState.setState(Ee.AliRtcStateNoPublish),o&&this.videoSmallPubState.setState(Ee.AliRtcStateNoPublish),a&&this.screenPubState.setState(Ee.AliRtcStateNoPublish),this._isPublishing=!1,this.traceId="",this.clearStream()}return this.slsReporter.reportUnpublish(this.callId||"",e,0,""),t}catch(r){throw ce.fromError(r,de.ERR_INNER,"unpublish failed")}})}reportSelfDeviceStatus(){this.emit(dt.Local,this.getDeviceStatus())}getDeviceStatus(){var t,i,r,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=!((i=this.streamManager.cameraStreamInfo.originVideoTrack)!=null&&i.enabled),e.screenDisable=!this.hasScreenShare||!((n=(r=this.streamManager.screenStreamInfo)==null?void 0:r.originVideoTrack)!=null&&n.enabled),zo.getCurrentStatus(e)}resetPreviewElements(){this.previewElements=[]}resetSecondayPreviewElements(){this.screenPreviewElements=[]}getMediaStats(e){return this.pcMediaStatsMap[e]}reportPublishMonitor(e){const t=e.msid;if(!t)return;let i;try{t===Z.Audio?i=this.rtsManager.getStreamByMsid({url:this.url,aMsid:t}).audioTrack:i=this.rtsManager.getStreamByMsid({url:this.url,vMsid:t}).videoTrack}catch(r){}this.slsReporter.reportPublishMonitor(this.callId,this.trackTraceIdMap[t]||"",e,i,this.monitorDataCache[t]),this.monitorDataCache[t]=[]}reportNetwork(){this.slsReporter.reportNetworkMonitor(this.candidateDataCache),this.candidateDataCache=[]}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>H(this,null,function*(){var e,i;try{const r=yield this.rtsManager.getPCStats();let n;r==null||r.forEach(a=>{a.type==="media-source"||a.type==="media-playout"?a.id&&(this.pcMediaStatsMap[a.id]=a):a.type==="candidate-pair"&&a.state==="succeeded"&&(n=a)});let o;if(((e=this.candidateDataCache)==null?void 0:e.length)>0){const t=this.candidateDataCache[this.candidateDataCache.length-1]||{},{_last:u}=t;o=$r(t,["_last"])}((i=this.candidateDataCache)==null?void 0:i.length)>=qo&&this.reportNetwork(),n&&(n._last=o,this.candidateDataCache.push(n)),(this.streamTracks||[]).forEach(a=>{const u=a.msid;if(!u)return;let h;u===Z.Audio?h=this.rtsManager.getPublishAudioStats(this.url):h=this.rtsManager.getPublishVideoStats(this.url,u),h.then(f=>{if(!f.timestamp)return;this.monitorDataCache[u]||(this.monitorDataCache[u]=[]);const d=this.getMediaStats(f.mediaSourceId);f._source=d;const p=this.monitorDataCache[u];let l;if((p==null?void 0:p.length)>0){const m=p[p.length-1]||{},{_last:v}=m;l=$r(m,["_last"])}(p==null?void 0:p.length)>=qo&&this.reportPublishMonitor(a),f._last=l,this.monitorDataCache[u].push(f)})})}catch(r){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0)}clearStream(){this.streamManager.stop(),this.audioPubState.setState(Ee.AliRtcStatePublishIdle),this.videoPubState.setState(Ee.AliRtcStatePublishIdle),this.videoSmallPubState.setState(Ee.AliRtcStatePublishIdle),this.screenPubState.setState(Ee.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,i){return H(this,null,function*(){if(!this.url)return;let r=0;return!t||t<1?r=1:r=t-1,this.rtsManager.sendSEI(this.url,e,r,i)})}getStats(){return H(this,null,function*(){const e=[];if(this.hasAudioTrackInMS){const n=yield this.rtsManager.getPublishAudioStats(this.url);n&&e.push({stats:n,track:Vi.AliRtcAudioTrackMic})}const t=[];if(this.hasCameraTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.VideoLarge);n&&t.push({track:ke.AliRtcVideoTrackCamera,streamType:rt.AliRtcVideoStreamTypeHigh,stats:n})}if(this.hasCameraDualTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.VideoSmall);n&&t.push({track:ke.AliRtcVideoTrackCamera,streamType:rt.AliRtcVideoStreamTypeLow,stats:n})}if(this.hasScreenTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,Z.Screen);n&&t.push({track:ke.AliRtcVideoTrackScreen,stats:n})}let i;const r=yield this.rtsManager.getPCStats();return r==null||r.forEach(n=>{n.type==="transport"&&(i=n)}),{audio:e,video:t,transport:i}})}},A(ci,"logName","LocalUser"),ci);Xe([j()],Ge.prototype,"clearPublishState",1),Xe([j()],Ge.prototype,"clear",1),Xe([j()],Ge.prototype,"setViewConfig",1),Xe([j()],Ge.prototype,"startCameraCapture",1),Xe([j()],Ge.prototype,"stopCameraCapture",1),Xe([j()],Ge.prototype,"stopAudioCapture",1),Xe([j()],Ge.prototype,"stopPreview",1),Xe([j()],Ge.prototype,"resumePublish",1),Xe([j()],Ge.prototype,"createLocalStream",1),Xe([j()],Ge.prototype,"stopLocalStream",1),Xe([j(ue)],Ge.prototype,"startPublish",1),Xe([j(([s])=>[s])],Ge.prototype,"syncPublishToRoomServer",1),Xe([j()],Ge.prototype,"refreshPushStreamUrl",1),Xe([j(([s,c,e])=>[JSON.stringify(e)])],Ge.prototype,"publishAdd",1),Xe([j(([s,c])=>[JSON.stringify(c)])],Ge.prototype,"publishReplace",1),Xe([j(ue)],Ge.prototype,"publishDeleteTracks",1),Xe([j()],Ge.prototype,"publishStop",1),Xe([j()],Ge.prototype,"unPublish",1),Xe([j(([s,c,e])=>[s.length,c,e])],Ge.prototype,"sendSEI",1);let Go=Ge;var Ai=(s=>(s.OPUS="opus",s.H264="H264",s.UNKONWN="",s))(Ai||{}),Ei=(s=>(s.VideoTrackEnded="videoTrackEnded",s.AudioTrackEnded="audioTrackEnded",s.ScreenTrackEnded="screenTrackEnded",s))(Ei||{});const Gu=s=>{const c=new MediaStream;return c.addTrack(s),c},Jo=s=>H(this,null,function*(){return yield ye.AliRTS.createStream({custom:!0,mediaStream:s})}),nr=s=>H(this,null,function*(){const c=Gu(s);return yield Jo(c)}),Ju=s=>{const{audio:c,video:e,screen:t}=s;if(e&&t)throw new ce(de.ERR_INNER,"create stream error, cannot create video && screen together");return!(!e&&!c&&!t)},Xu=s=>s===Z.Audio||s===rs.Audio,Zu=s=>s===Z.VideoLarge||s===rs.VideoLarge,Yu=s=>s===Z.VideoSmall,Qu=s=>s===Z.Screen;var eh=Object.defineProperty,th=Object.getOwnPropertyDescriptor,ih=(s,c,e,t)=>{for(var i=t>1?void 0:t?th(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&eh(c,e,i),i};class Fr extends we{constructor(){super();A(this,"audioInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:Ai.UNKONWN});A(this,"videoLargeInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:Ai.UNKONWN});A(this,"videoSmallInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:Ai.UNKONWN});A(this,"screenInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:Ai.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:Ai.UNKONWN}get audioTrackInfo(){return this.hasAudio?Vi.AliRtcAudioTrackMic:Vi.AliRtcAudioTrackNo}get videoTrackInfo(){return this.hasVideo&&this.hasScreen?ke.AliRtcVideoTrackBoth:this.hasVideo?ke.AliRtcVideoTrackCamera:this.hasScreen?ke.AliRtcVideoTrackScreen:ke.AliRtcVideoTrackNo}updateTracks(e){let t="",i="",r="",n="";return e?(e.forEach(o=>{var h;let a=Ai.UNKONWN;const u=((h=o==null?void 0:o.attr)==null?void 0:h.reason)==="reconnect";if(o.userdata){const{codec:g}=JSON.parse(o.userdata);g&&(a=g)}Xu(o.msid)?(t=o.ssrc,this.audioInfo.msid=o.msid,this.audioInfo.codec=a,u&&(this.audioInfo.subscribed=!1)):Yu(o.msid)?(r=o.ssrc,this.videoSmallInfo.msid=o.msid,this.videoSmallInfo.codec=a,u&&(this.videoSmallInfo.subscribed=!1)):Zu(o.msid)?(i=o.ssrc,this.videoLargeInfo.msid=o.msid,this.videoLargeInfo.codec=a,u&&(this.videoLargeInfo.subscribed=!1)):Qu(o.msid)&&(n=o.ssrc,this.screenInfo.msid=o.msid,this.screenInfo.codec=a,u&&(this.screenInfo.subscribed=!1))}),this.updateRemoteTrackSsrc(t,i,r,n)):this.updateRemoteTrackSsrc(t,i,r,n),{}}updateRemoteTrackSsrc(e,t,i,r){this.audioInfo.ssrc=e,this.videoSmallInfo.ssrc=i,this.videoLargeInfo.ssrc=t,this.screenInfo.ssrc=r}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=zo.parseStatus(e);const{audioDisable:i,videoDisable:r,screenDisable:n}=t;return this.userStatus?(this.userStatus.audioDisable!=i&&(this.userStatus.audioDisable=i,this.emit(dt.Remote,i?Me.MuteAudio:Me.UnmuteAudio)),this.userStatus.videoDisable!=r&&(this.userStatus.videoDisable=r,this.emit(dt.Remote,r?Me.MuteVideo:Me.UnmuteVideo)),this.userStatus.screenDisable!=n&&(this.userStatus.screenDisable=n,this.emit(dt.Remote,n?Me.MuteScreen:Me.UnmuteScreen))):(this.userStatus=t,this.emit(dt.Remote,i?Me.MuteAudio:Me.UnmuteAudio),this.emit(dt.Remote,r?Me.MuteVideo:Me.UnmuteVideo),this.emit(dt.Remote,n?Me.MuteScreen:Me.UnmuteScreen)),!1}}A(Fr,"logName","RemoteStreamInfo"),ih([j()],Fr.prototype,"updateRemoteTrackSubState",1);class Xo{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 rh=Object.defineProperty,sh=Object.getOwnPropertyDescriptor,st=(s,c,e,t)=>{for(var i=t>1?void 0:t?sh(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&rh(c,e,i),i};class ar extends we{constructor(){super();A(this,"state");A(this,"time");A(this,"_enabled");this.state=He.AliRtcStateSubscribeIdle,this.time=Date.now(),this._enabled=!0}setState(e){if(this.state===e)return;const t=this.state,i=this.time;this.state=e,this.time=Date.now(),this.emit("change",t,e,Math.floor((this.time-i)/1e3))}get currentState(){return this.state}getEnabled(){return this._enabled}setEnabled(e){this._enabled=e}}const nh=30,Ur=class Ur extends Ho{constructor(e){var f;const{userId:t,displayName:i,rtsManager:r,usersViewMap:n,slsReporter:o,signalingManager:a,localUser:u,audioVolumeIndicationInterval:h,playoutVolume:g}=e;super(t,i,r,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",rt.AliRtcVideoStreamTypeHigh);A(this,"audioMuted",!1);A(this,"playoutVolume",1);A(this,"audioSubState");A(this,"videoSubState");A(this,"videoLargeSubState",new ar);A(this,"videoSmallSubState",new ar);A(this,"screenSubState");A(this,"streamInfo");A(this,"streamUrl","");A(this,"monitorTimerId");A(this,"monitorDataCache",{});A(this,"trackTraceIdMap",{});this.streamInfo=new Fr,this.remoteUserInfo=new Xo(this),this.streamInfo.on(dt.Remote,d=>{this.emit(dt.Remote,d,this.userId)}),this.signalingManager=a,this.viewMap=(f=n[t])!=null?f:{cameraViews:[],screenViews:[]},n[t]=this.viewMap,this.slsReporter=o,this.localUser=u,this.audioSubState=new ar,this.audioSubState.on("change",(d,p,l)=>{this.emit("audioSubscribeStateChanged",this.uid,d,p,l)}),this.videoSubState=new ar,this.videoSubState.on("change",(d,p,l)=>{this.emit("videoSubscribeStateChanged",this.uid,d,p,l)}),this.screenSubState=new ar,this.screenSubState.on("change",(d,p,l)=>{this.emit("screenSubscribeStateChanged",this.uid,d,p,l)}),this.playoutVolume=g}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(Ve.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!==ke.AliRtcVideoTrackScreen&&t!==ke.AliRtcVideoTrackCamera)throw new ce(de.ERR_INVALID_ARGUMENTS,"track is not AliRtcVideoTrackScreen or AliRtcVideoTrackCamera");e?kn(e).forEach(r=>{r.setAttribute("playsinline",""),ye.AliRTS.BrowserUtil.isMicroMessenger&&(r.setAttribute("x5-video-player-type","h5-page"),r.setAttribute("x5-playsinline",""),ye.AliRTS.SystenUtil.isAndroid||ye.AliRTS.SystenUtil.isIos&&r.setAttribute("x-webkit-airplay","allow")),t===ke.AliRtcVideoTrackScreen?this.viewMap.screenViews.push(r):this.viewMap.cameraViews.push(r),this.play(r,t===ke.AliRtcVideoTrackScreen)}):(this.stopPlayAll(t===ke.AliRtcVideoTrackScreen),t===ke.AliRtcVideoTrackScreen?this.viewMap.screenViews=[]:this.viewMap.cameraViews=[])}clear(e=!0){return H(this,null,function*(){var t;e&&this.doStopSubscribe(this.streamUrl),Vn(Ur.prototype,this,"clear").call(this),this.clearStream(),this.clearScreenStream(),(t=this.streamInfo)==null||t.removeAllListeners(dt.Remote)})}updateRemoteUserDeviceStatus(e){var t;(t=this.streamInfo)==null||t.updateRemoteUserDeviceStatus(e)}updateRemoteTracks(e,t,i,r){return H(this,null,function*(){var o;return this.remoteCallid=e,this.streamUrl=t!=null?t:"",this.callId=e!=null?e:"",this.streamInfo||(this.streamInfo=new Fr),(o=this.streamInfo)==null?void 0:o.updateTracks(r)})}subscribe(r,n){return H(this,arguments,function*(e,t,i=Date.now()){var d;let o=e;if(!o){const{hasAudio:p,hasVideo:l,hasScreen:m}=(d=this.streamInfo)!=null?d:{};o={audio:this.wantSubAudio&&p,video:this.wantSubVideo&&l,screen:this.wantSubScreen&&m}}const{screen:a,audio:u,video:h,vMsid:g}=o,f=[];(h||u)&&f.push({audio:u,video:h,vMsid:g}),a&&f.push({screen:a}),f.length!==0&&(yield Promise.all(f.map(p=>this.subscribeProxy(p,t||Ve.User,i))))})}subscribeProxy(e,t,i){return H(this,null,function*(){var o,a,u,h;let r=new Date().getTime(),n="";try{e.audio&&this.audioSubState.setState(He.AliRtcStateSubscribing),e.video&&(this.videoSubState.currentState===He.AliRtcStateSubscribeIdle||this.videoSubState.currentState===He.AliRtcStateNoSubscribe)&&this.videoSubState.setState(He.AliRtcStateSubscribing),e.screen&&this.screenSubState.setState(He.AliRtcStateSubscribing);const g=yield this.rtsManager.subscribe({remoteUser:this,options:e},t,((o=this.localUser)==null?void 0:o.callId)||"",this.callId,i);this.streamInfo.updateRemoteTrackSubState(e),n=g.traceId||"";const{stream:f}=g;if(e.audio){this.trackTraceIdMap[Z.Audio]=n;const p=f.audioTrack;p&&(this.audioTrack=p,(a=f.mediaStream)==null||a.removeTrack(p),this.playAudio(),this.audioVolumeIndicationInterval&&this.audioLevelMonitor.start(p,this.audioVolumeIndicationInterval)),this.audioSubState.setState(He.AliRtcStateSubscribed),this.audioSubState.getEnabled()||this.toggleAudio(!1)}e.video&&(e.vMsid===Z.VideoSmall?(this.trackTraceIdMap[Z.VideoSmall]=n,this.videoSmallSubState.setState(He.AliRtcStateSubscribed)):(this.trackTraceIdMap[Z.VideoLarge]=n,this.videoLargeSubState.setState(He.AliRtcStateSubscribed)),this.videoSubState.setState(He.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleVideo(!1),this.updateStream(f,this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing)),e.screen&&(this.trackTraceIdMap[Z.Screen]=n,this.screenSubState.setState(He.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleScreen(!1),this.updateScreenStream(f));const d=new Date().getTime()-r;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===Ve.Join?1:0,url:this.streamUrl,est:r}),this.startStreamMonitor()}catch(g){const f=new Date().getTime()-r;g&&(g.message=`user(${this.uid}) subscribe error, ${(g==null?void 0:g.message)||""}`);let d=de.ERR_INNER;e.audio&&(d=de.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED),e.video&&(e.vMsid===Z.VideoSmall?d=de.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED:d=de.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED),e.screen&&(d=de.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===Ve.Join?1:0,url:this.streamUrl,est:r});const p=ce.fromError(g,d);throw this.emit("remoteSubscribeError",p),p}})}subscribeDeleteTracks(e){return H(this,null,function*(){const{audio:t,video:i,screen:r,vMsid:n}=e,o=[];(t||i)&&o.push({audio:t,video:i,vMsid:n}),r&&o.push({screen:r}),o.length!==0&&(yield Promise.all(o.map(a=>this.subscribeDeleteProxy(a))))})}subscribeDeleteProxy(e){return H(this,null,function*(){try{const t=yield this.rtsManager.subscibeDelete({remoteUser:this,options:e}),{stream:i}=t!=null?t:{},r={};e.audio===!0&&(r.audio=!1,this.audioSubState.setState(He.AliRtcStateNoSubscribe)),e.video===!0&&(r.video=!1,e.vMsid===Z.VideoSmall?(this.videoSmallSubState.setState(He.AliRtcStateNoSubscribe),(this.videoLargeSubState.currentState===He.AliRtcStateNoSubscribe||this.videoLargeSubState.currentState===He.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(He.AliRtcStateNoSubscribe)):(this.videoLargeSubState.setState(He.AliRtcStateNoSubscribe),(this.videoSmallSubState.currentState===He.AliRtcStateNoSubscribe||this.videoSmallSubState.currentState===He.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(He.AliRtcStateNoSubscribe))),e.screen===!0&&(r.screen=!1,this.screenSubState.setState(He.AliRtcStateNoSubscribe));const{callId:n,remoteCallid:o}=this,a={callid:n,remoteCallid:o,remoteStream:i};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}),a}catch(t){throw ce.fromError(t,de.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 H(this,null,function*(){var e;return(e=this.audioElement)==null?void 0:e.play()})}resumeVideo(e){return H(this,null,function*(){if(!e||e===ke.AliRtcVideoTrackCamera||e===ke.AliRtcVideoTrackBoth)return this.playAll();if(!e||e===ke.AliRtcVideoTrackScreen||e===ke.AliRtcVideoTrackBoth)return this.playAll(!0)})}resumePlay(){this.playAudio(),this.playAll(),this.playAll(!0)}stopSubscribe(e){return H(this,null,function*(){var i,r;let t=new Date().getTime();try{let n;e?n=yield this.subscribeDeleteTracks(e):n=yield this.doStopSubscribe(this.streamUrl),this.slsReporter.reportUnsubscribe(((i=this.localUser)==null?void 0:i.callId)||(n==null?void 0:n.callid)||"",this.callId,new Date().getTime()-t,0,"")}catch(n){throw this.slsReporter.reportUnsubscribe(((r=this.localUser)==null?void 0:r.callId)||"",this.callId,new Date().getTime()-t,0,""),n}})}doStopSubscribe(e){return H(this,null,function*(){var r,n,o,a;const{callId:t,remoteCallid:i}=this;if((this.isAudioSubscribing||this.isVideoSubscribing||this.isScreenSubscribing)&&e)try{this.stopStreamMonitor(),this.streamInfo.subscribingInfos.forEach(h=>{this.reportSubscribeMonitor(h)}),yield this.rtsManager.subscibeStop(e),this.restore();const u={callid:t,remoteCallid:i,remoteStream:this.stream};return this.callId="",u}catch(u){if(((a=(o=(n=(r=u==null?void 0:u.extraInfo)==null?void 0:r.parsedData)==null?void 0:n.streams)==null?void 0:o[0])==null?void 0:a.res_code)!==404)throw ce.fromError(u,de.ERR_INNER,"subscribe stop failed")}})}updateStream(e,t=!1){return H(this,null,function*(){this.stream&&this.stream.videoTrack&&e.mediaStream&&t&&(yield new Promise(i=>{let r,n;if(e.mediaStream){n=document.createElement("video");const o=()=>{le.event(`uid: ${this.userId} new mediaStream canplay`),n&&n.removeEventListener("canplaythrough",o,!1),n=void 0,clearTimeout(r),i(!0)};n.addEventListener("canplaythrough",o,!1),(n._playPromise||Promise.resolve()).then(()=>{n&&e.mediaStream&&(n.srcObject=e.mediaStream)})}else i(!0);r=window.setTimeout(()=>{le.event(`uid: ${this.userId} new mediaStream timeout`),n=void 0,i(!0)},3e3)}),this.updateSubscribe(Ve.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,o,a,u,h,g,f,d;const t=Date.now(),i={},r={};return this.wantSubAudio&&!this.isAudioSubscribing&&((n=this.streamInfo)!=null&&n.hasAudio)?i.audio=!0:(!this.wantSubAudio||!((o=this.streamInfo)!=null&&o.hasAudio))&&this.isAudioSubscribing&&(r.audio=!0),this.wantSubVideo&&((a=this.streamInfo)!=null&&a.hasVideo)?(this.defaultVideoStreamType===rt.AliRtcVideoStreamTypeLow&&!this.isVideoSmallSubscribing&&((u=this.streamInfo)!=null&&u.hasVideoSmall)?(i.video=!0,i.vMsid=Z.VideoSmall):!this.isVideoLargeSubscribing&&((h=this.streamInfo)!=null&&h.hasVideoLarge)&&!(this.defaultVideoStreamType===rt.AliRtcVideoStreamTypeLow&&this.isVideoSmallSubscribing)&&(i.video=!0,i.vMsid=Z.VideoLarge),this.defaultVideoStreamType===rt.AliRtcVideoStreamTypeLow&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&this.streamInfo.hasVideoSmall?(r.video=!0,r.vMsid=Z.VideoLarge):this.defaultVideoStreamType===rt.AliRtcVideoStreamTypeHigh&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&(r.video=!0,r.vMsid=Z.VideoSmall)):(!this.wantSubVideo||!((g=this.streamInfo)!=null&&g.hasVideo))&&this.isVideoSubscribing&&(r.video=!0,r.vMsid=this.streamInfo.isVideoSmallSubscribing?Z.VideoSmall:Z.VideoLarge),this.wantSubScreen&&!this.isScreenSubscribing&&((f=this.streamInfo)!=null&&f.hasScreen)?i.screen=!0:(!this.wantSubScreen||!((d=this.streamInfo)!=null&&d.hasScreen))&&this.isScreenSubscribing&&(r.screen=!0),(i.audio||i.video||i.screen)&&(this.createCallId(),this.subscribe(i,e,t)),r.audio&&r.video&&r.screen?this.stopSubscribe():(r.audio||r.video||r.screen)&&this.subscribeDeleteTracks(r),{addOption:i,deleteOption:r}}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 i=()=>{var n;const r=(n=t===ke.AliRtcVideoTrackScreen?this.screenStream:this.stream)==null?void 0:n.mediaStream;e.srcObject===r&&this.play(e,t===ke.AliRtcVideoTrackScreen),document.removeEventListener("click",i,!1),document.removeEventListener("touchstart",i,!1)};document.addEventListener("click",i,!1),document.addEventListener("touchstart",i,!1)}playAudio(){return H(this,null,function*(){var t,i;if(!this.audioTrack)return;if(this.toggleAudio(!this.audioMuted),this.audioElement||(this.audioElement=document.createElement("audio"),this.audioElement.volume=this.playoutVolume),((i=(t=this.audioElement.srcObject)==null?void 0:t.getAudioTracks())==null?void 0:i[0])!==this.audioTrack){let r=this.audioElement.srcObject;r?r.getAudioTracks().forEach(n=>{r.removeTrack(n)}):(r=new MediaStream,this.audioElement.srcObject=r),r.addTrack(this.audioTrack)}this.audioElement.play().catch(()=>{this.handleAutoPlayFailed()});const e=this.audioElement;this.audioElement.addEventListener("playing",function r(){e.removeEventListener("playing",r),ye.AliRTS.SystenUtil.isIos&&parseInt(ye.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 i=t?this.screenStream:this.stream;!e||!i||!i.mediaStream||$o(e,i.mediaStream).catch(r=>{r.code===20||r.name==="AbortError"||this.handleVideoPlayFailded(e,t?ke.AliRtcVideoTrackScreen:ke.AliRtcVideoTrackCamera)})}stopPlayAll(e=!1){e?this.viewMap.screenViews.forEach(t=>{ai(t)}):this.viewMap.cameraViews.forEach(t=>{ai(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 H(this,null,function*(){var i,r;const e=[];if(this.isAudioSubscribing){const n=yield this.rtsManager.getSubscribeAudioStats(this.streamUrl);n&&e.push({uid:this.uid,track:Vi.AliRtcAudioTrackMic,stats:n})}const t=[];if((i=this.streamInfo)!=null&&i.isVideoLargeSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.VideoLarge);n&&t.push({uid:this.uid,track:ke.AliRtcVideoTrackCamera,streamType:rt.AliRtcVideoStreamTypeHigh,stats:n})}if((r=this.streamInfo)!=null&&r.isVideoSmallSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.VideoSmall);n&&t.push({uid:this.uid,track:ke.AliRtcVideoTrackCamera,streamType:rt.AliRtcVideoStreamTypeLow,stats:n})}if(this.isScreenSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,Z.Screen);n&&t.push({uid:this.uid,track:ke.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 i;const t=e.msid;t&&(this.slsReporter.reportSubscribeMonitor(((i=this.localUser)==null?void 0:i.callId)||"",this.callId,this.trackTraceIdMap[t]||"",e,this.monitorDataCache[t]),this.monitorDataCache[t]=[])}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>H(this,null,function*(){try{if(this.streamInfo.subscribingInfos.length===0){this.stopStreamMonitor();return}this.streamInfo.subscribingInfos.forEach(e=>{const t=e.msid;if(!t)return;let i;const r=t===Z.Audio;r?i=this.rtsManager.getSubscribeAudioStats(this.streamUrl):i=this.rtsManager.getSubscribeVideoStats(this.streamUrl,t),i.then(n=>{var h;if(!n.timestamp)return;this.monitorDataCache[t]||(this.monitorDataCache[t]=[]);const o=this.monitorDataCache[t];let a;if((o==null?void 0:o.length)>0){const u=o[o.length-1]||{},{_last:f}=u;a=$r(u,["_last"])}(o==null?void 0:o.length)>=nh&&this.reportSubscribeMonitor(e),n._last=a,r&&(n._source=(h=this.localUser)==null?void 0:h.getMediaStats(n.playoutId)),this.monitorDataCache[t].push(n)})})}catch(e){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0)}};A(Ur,"logName","RemoteUser");let Je=Ur;st([j()],Je.prototype,"clear",1),st([j()],Je.prototype,"updateRemoteUserDeviceStatus",1),st([j()],Je.prototype,"updateRemoteTracks",1),st([j(ue)],Je.prototype,"subscribe",1),st([j()],Je.prototype,"subscribeProxy",1),st([j(ue)],Je.prototype,"subscribeDeleteProxy",1),st([j()],Je.prototype,"restore",1),st([j(ue)],Je.prototype,"stopSubscribe",1),st([j(ue)],Je.prototype,"doStopSubscribe",1),st([j()],Je.prototype,"clearStream",1),st([j()],Je.prototype,"clearScreenStream",1),st([j()],Je.prototype,"updateSubscribe",1),st([j()],Je.prototype,"playAudio",1),st([j()],Je.prototype,"stopPlayAudio",1),st([j(ue)],Je.prototype,"playAll",1),st([j()],Je.prototype,"play",1),st([j()],Je.prototype,"stopPlayAll",1);var oi=(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))(oi||{});class ah extends we{constructor(){super(...arguments);A(this,"plugins",new Map)}add(e,t){if(this.plugins.has(e.name))throw new ce(oi.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 ce(oi.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 oh=Object.defineProperty,ch=Object.getOwnPropertyDescriptor,ft=(s,c,e,t)=>{for(var i=t>1?void 0:t?ch(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&oh(c,e,i),i};const Or=([s])=>{const{remoteUser:c,options:e}=s;return[`user(${c.userId})`,e]},ht=(Ft=class extends we{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=ye.AliRTS.createClient(),this.localStreamManager=e,this.slsReporter=t,this.rts.on("connectStatusChange",i=>{var r,n,o,a;if(le.event(`[${Ft.logName}]`,"rts connectStatusChange to:",i.status),i.status===ye.EConnectStatus.CONNECT_STATUS_DISCONNECTED)this.emit("disconnected"),this.setConnected(!1),this.slsReporter.reportWarning("rts disconnected");else if(i.status===ye.EConnectStatus.CONNECT_STATUS_RECONNECTING)this.emit("reconnecting"),this.setConnected(!1),this.slsReporter.reportWarning("rts reconnecting");else if(i.status===ye.EConnectStatus.CONNECT_STATUS_CONNECTED){this.setConnected(!0);const u=(a=(o=(n=(r=this.rts.commonController)==null?void 0:r.peerCore)==null?void 0:n.getSignal())==null?void 0:o.getDatachannelCore())==null?void 0:a.readyState;le.event(Ft.logName,"dcReadyState:",u),u==="open"&&this.dcResolve&&this.dcResolve(!0),this.emit("connected")}}),this.rts.on("datachannelStatusChange",i=>{le.event(`[${Ft.logName}]`,"rts datachannelStatusChange to:",i.status),i.status===ye.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?this.dcResolve&&this.dcResolve(!0):i.status===ye.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&(this.dcConnectingPromise=new Promise(r=>{this.dcResolve=r}),console.warn("DC DisConnected"))}),this.rts.on("receivedSEI",i=>{this.emit("seimessage",i.url,i.sei.payloadType,i.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 r=[...((t=RTCRtpReceiver.getCapabilities("audio"))==null?void 0:t.codecs)||[]];if(r.length>0){if(e){const n=r.findIndex(a=>a.mimeType==="audio/red"),o=r.findIndex(a=>a.mimeType==="audio/opus");if(n>-1&&o>-1&&n>o){const a=r[o];r[o]=r[n],r[n]=a}}this.rts.setSenderCodecPreferences({audio:r}),this.rts.setReceiverCodecPreferences({audio:r})}}catch(i){}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(i=>{this.dcResolve=i}))}get isConnecting(){return this.connecting}get isConnected(){return this.connected}get publishingTracks(){return this._publishingTracks}getPubMsid(e,t){const{aMsid:i,vMsid:r}=t!=null?t:{},n={};return e.hasAudio&&(n.aMsid=[i!=null?i:Z.Audio]),e.hasScreen&&(n.vMsid=[Z.Screen]),e.hasVideo&&(n.vMsid=[r!=null?r:t!=null&&t.isScreen?Z.Screen:Z.VideoLarge]),n}updatePublishingTracks(e){e&&(this._publishingTracks=e.map(({msid:t,from:i,ssrc:r,codec:n,type:o,trackId:a})=>({msid:t,from:i,type:o,ssrc:`${r}`,codec:n!=null?n:"",trackId:a})))}httpPublish(n,o){return H(this,arguments,function*(e,t,i=!1,r=di.MANUAL){const{publishStream:a,videoSmallStream:u,screenStream:h,vMsid:g}=yield this.localStreamManager.createHTTPPublishStream();if(!a)return"";const f=this.getPubMsid(a,{vMsid:g});f.retryTimes=0,this.encodedInsertableStreams&&(f.encodedInsertableStreams=!0);let d=!a.hasVideo,p=g;try{this.startConnect();const l=Date.now(),m=yield this.rts.publish(e,a,f);this.slsReporter.reportPublish(i,e,t,a.hasVideo&&(!g||g===Z.VideoLarge),a.hasVideo&&g===Z.VideoSmall,a.hasVideo&&g===Z.Screen,a.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},i),d=!1,p=Z.VideoSmall),h&&(yield this.publishAdd(e,h,t,{vMsid:Z.Screen},i),d=!1,p=Z.Screen),yield this.waitPublishSender(e,d,p),this.slsReporter.reportPublishFirstPacket(i,t,l,x,this._localJoinTime,d?Z.Audio:f.vMsid,m||"",m||"",r),m}catch(l){throw this.setConnected(!1),l}})}waitPublishSender(e,t=!1,i){return H(this,null,function*(){const r=(n,o)=>{let a=0;const u=()=>(t?this.rts.getPublishAudioStats(e,i):this.rts.getPublishVideoStats(e,i)).then(g=>!(g.bytesSent>0)&&a<n?(a++,new Promise(d=>setTimeout(()=>d(u()),o))):Promise.resolve());return u()};return Promise.race([wi(1e3),r(5,100)]).catch(()=>{})})}getPublishVideoStats(e,t){return H(this,null,function*(){return yield this.rts.getPublishVideoStats(e,t)})}getPublishAudioStats(e,t){return H(this,null,function*(){return yield this.rts.getPublishAudioStats(e,t)})}publishAdd(h,g,f,d){return H(this,arguments,function*(e,t,i,r,n=!1,o=0,a=!1,u=di.MANUAL){var m,x,v,b,w,_,C,E;yield this.dcConnectingPromise;const p=Date.now(),l=this.getPubMsid(t,r);try{const I=yield this.rts.publishAdd([Ce({url:e,stream:t,updateSourceStream:!1},l)]);if(I){const L=Date.now(),[k]=I;return this.slsReporter.reportPublish(!1,e,i,((m=l.vMsid)==null?void 0:m[0])===Z.VideoLarge,((x=l.vMsid)==null?void 0:x[0])===Z.VideoSmall,((v=l.vMsid)==null?void 0:v[0])===Z.Screen,((b=l.aMsid)==null?void 0:b[0])===Z.Audio,0,this.pcTraceId,k.traceId||"",p),this.updatePublishingTracks(k.trackInfoList),a&&(yield this.waitPublishSender(e,!t.hasVideo,t.hasVideo?r==null?void 0:r.vMsid:r==null?void 0:r.aMsid)),this.slsReporter.reportPublishFirstPacket(n||o>0,i,p,L,this._localJoinTime,(t.hasVideo?r==null?void 0:r.vMsid:r==null?void 0:r.aMsid)||"",this.pcTraceId,k.traceId||"",u),k.traceId||""}}catch(I){if(this.slsReporter.reportPublish(!1,e,i,((w=l.vMsid)==null?void 0:w[0])===Z.VideoLarge,((_=l.vMsid)==null?void 0:_[0])===Z.VideoSmall,((C=l.vMsid)==null?void 0:C[0])===Z.Screen,((E=l.aMsid)==null?void 0:E[0])===Z.Audio,I.errorCode||-1,this.pcTraceId,"",p),I.errorCode===15006&&o<3)return yield this.publishAdd(e,t,i,r,n,o+1);throw I}return""})}publishDelete(e,t){return H(this,null,function*(){var h,g,f,d,p,l,m,x;yield this.dcConnectingPromise;const i=(g=(h=this.publishingTracks)==null?void 0:h.find(({msid:v})=>v===Z.Audio))==null?void 0:g.msid,r=(d=(f=this.publishingTracks)==null?void 0:f.find(({msid:v})=>v===Z.VideoLarge))==null?void 0:d.msid,n=(l=(p=this.publishingTracks)==null?void 0:p.find(({msid:v})=>v===Z.Screen))==null?void 0:l.msid,o=[];t.screen&&n?o.push(n):t.video&&o.push(t.vMsid||r);const a=[];t.audio&&i&&a.push(i),le.event(Ft.logName,"publishDelete",{streamUrl:e,aMsid:a,vMsid:o});const[u]=(yield this.rts.publishDeleteTracks([{url:e,aMsid:a,vMsid:o}]))||[];return le.event(Ft.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,i){return H(this,null,function*(){var u,h;yield this.dcConnectingPromise;const{vMsid:r,aMsid:n}=i!=null?i:{},o=yield this.rts.publishReplaceTracks([{url:e,stream:t,updateSourceStream:!1,vMsid:r,aMsid:n}]),[a]=o;return this.updatePublishingTracks(a.trackInfoList),((h=(u=a==null?void 0:a.trackInfoList)==null?void 0:u[0])==null?void 0:h.trackId)||""})}publishStop(e){return H(this,null,function*(){return yield this.rts.publishStop([{url:e}]),this._publishingTracks=[],""})}unpublish(){return H(this,null,function*(){yield this.rts.unpublish(),this.connecting=!1,this.connected=!1})}getSubConfig(e,t){let i=t!=null?t:{};t||(i={audio:!0,video:!0,screen:!0});const r={};return i.audio&&(r.aMsid=[(e==null?void 0:e.getAudioInfo().msid)||Z.Audio]),i.video?i.vMsid?r.vMsid=[i.vMsid]:e!=null&&e.hasVideoLarge?r.vMsid=[(e==null?void 0:e.getVideoLargeInfo().msid)||Z.VideoLarge]:e!=null&&e.hasVideoSmall?r.vMsid=[(e==null?void 0:e.getVideoSmallInfo().msid)||Z.VideoSmall]:r.vMsid=[Z.VideoLarge]:i.screen&&e!=null&&e.hasScreen&&(r.vMsid=[(e==null?void 0:e.getScreenInfo().msid)||Z.Screen]),r}httpSubscribe(e){return H(this,null,function*(){const{remoteUser:t,options:i}=e;let r=t.streamUrl;i.video||i.screen?i!=null&&i.audio||(r+="@subaudio=no"):r+="@subvideo=no";const n=this.getSubConfig(t.streamInfo,i);n.retryTimes=0,this.encodedInsertableStreams&&(n.encodedInsertableStreams=!0);try{this.startConnect();const o=yield this.rts.subscribe(r,n);return this._pcTraceId=o.traceId,this.setConnected(!0),{traceId:o.traceId,stream:o}}catch(o){throw this.setConnected(!1),o}})}subscribeAdd(e){return H(this,null,function*(){var n,o,a,u;const{remoteUser:t,options:i}=e,r=Yt(Ce({url:t.streamUrl,subAudio:!!i.audio,subVideo:!!(i.screen||i.video)},this.getSubConfig(t.streamInfo,i)),{targetStream:i.screen?t.getScreenStream:t.getCameraStream});try{return(yield this.rts.subscribeAdd([r]))[0]}catch(h){if(((u=(a=(o=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:o.streams)==null?void 0:a[0])==null?void 0:u.res_code)===508)return this.emit("subscribeexceeds"),null;throw ce.fromError(h)}})}subscibeDelete(e){return H(this,null,function*(){var n,o,a,u;yield this.dcConnectingPromise;const{remoteUser:t,options:i}=e,r=Yt(Ce({url:t.streamUrl,subAudio:!!i.audio,subVideo:!!(i.screen||i.video)},this.getSubConfig(t.streamInfo,i)),{targetStream:i.screen?t.getScreenStream:t.getCameraStream});try{return(yield this.rts.subscribeDeleteTracks([r]))[0]}catch(h){if(((u=(a=(o=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:o.streams)==null?void 0:a[0])==null?void 0:u.res_code)===404)return;throw h}})}subscibeStop(e){return H(this,null,function*(){var t,i,r,n;try{yield this.rts.subscribeStop([{url:e}])}catch(o){if(((n=(r=(i=(t=o==null?void 0:o.extraInfo)==null?void 0:t.parsedData)==null?void 0:i.streams)==null?void 0:r[0])==null?void 0:n.res_code)===404)return;throw o}})}publish(n,o){return H(this,arguments,function*(e,t,i=!1,r=di.MANUAL){let a="";if(this.connecting&&(yield this.connectingPromise),this.connected){yield this.dcConnectingPromise;let u=!1,h;const{audio:g,video:f,videoSmall:d,screen:p}=this.localStreamManager.publishStreams;g&&(a=yield this.publishAdd(e,g,t,{aMsid:Z.Audio},i),u=!0,h=Z.Audio,yield wi(100)),f&&(a=yield this.publishAdd(e,f,t,{vMsid:Z.VideoLarge},i),u=!1,h=Z.VideoLarge,yield wi(100)),d&&(a=yield this.publishAdd(e,d,t,{vMsid:Z.VideoSmall},i),u=!1,h=Z.VideoSmall,yield wi(100)),p&&(a=yield this.publishAdd(e,p,t,{isScreen:!0,vMsid:Z.Screen},i),u=!1,h=Z.Screen),h&&(yield this.waitPublishSender(e,u,h))}else a=yield this.httpPublish(e,t,i,r);return a})}subscribe(e,t,i,r,n){return H(this,null,function*(){const{options:o,remoteUser:a}=e;if(o.video&&o.screen)throw new ce(de.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 g=Date.now();let f=Z.VideoLarge,d=o.video||o.screen,p=o.audio;o.video&&o.vMsid?f=o.vMsid:o.screen&&(f=Z.Screen);let l=0,m=0,x=0,v=0;return((w,_)=>{let C=0;const E=()=>{let I;return p&&!x&&(I=this.rts.getSubscribeAudioStats(a.streamUrl).then(L=>{if(L.packetsReceived>0&&(l=Date.now()),L.audioLevel>0)x=Date.now();else if(!d)return C<w?(C++,new Promise(k=>setTimeout(()=>k(E()),_))):!1;return!0})),d&&!v&&(I=this.rts.getSubscribeVideoStats(a.streamUrl,f).then(L=>{if(L.packetsReceived>0&&(m=Date.now()),L.framesDecoded>0)v=Date.now();else return C<w?(C++,new Promise(k=>setTimeout(()=>k(E()),_))):(le.error(`[${Ft.logName}]`,"checkInStatsWithRetry fail"),!1);return!0})),Promise.resolve(I)};return E()})(20,100).then(()=>{m&&this.slsReporter.reportSubscribeFirstPacket(t===Ve.Resume,i,r,f,{fprt:m-h,ifsprtc:v?v-h:0,ajsub:t===Ve.Join?1:0,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",sstc:g-h}),v&&this.slsReporter.reportSubscribeFirstFrame(t===Ve.Resume,i,r,f,{fvfrt:v-h,fp2fftc:v-m,ajsub:t===Ve.Join?1:0,tffrtc:t===Ve.Join?v-this.localJoinTime:v-n,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",fvfdtc:v-h}),l&&this.slsReporter.reportSubscribeFirstPacket(t===Ve.Resume,i,r,Z.Audio,{fprt:l-h,ifsprtc:x?x-h:0,ajsub:t===Ve.Join?1:0,pctid:this.pcTraceId,subtid:(u==null?void 0:u.traceId)||"",sstc:g-h})}),u})}getSubscribeVideoStats(e,t){return H(this,null,function*(){return yield this.rts.getSubscribeVideoStats(e,t)})}getSubscribeAudioStats(e,t){return H(this,null,function*(){return yield this.rts.getSubscribeAudioStats(e,t)})}getStreamByMsid(e){return this.rts.commonController.streamManager.getStreamByMsid(e)}getPCStats(){return H(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,i,r){return H(this,null,function*(){return this.rts.sendSEI({url:e,vMsid:Z.VideoLarge,data:t,repeatCount:i,payloadType:r})})}},A(Ft,"logName","RtsManager"),Ft);ft([j()],ht.prototype,"updatePublishingTracks",1),ft([j(ue,ue)],ht.prototype,"httpPublish",1),ft([j(ue,ue)],ht.prototype,"waitPublishSender",1),ft([j(([s,c,e])=>[s,JSON.stringify(e)],ue)],ht.prototype,"publishAdd",1),ft([j(ue,ue)],ht.prototype,"publishDelete",1),ft([j(([s,c,e])=>[s,JSON.stringify(e)])],ht.prototype,"publishReplace",1),ft([j(ue)],ht.prototype,"publishStop",1),ft([j()],ht.prototype,"unpublish",1),ft([j(Or,({traceId:s})=>s)],ht.prototype,"httpSubscribe",1),ft([j(Or,({traceId:s})=>s)],ht.prototype,"subscribeAdd",1),ft([j(Or)],ht.prototype,"subscibeDelete",1),ft([j(ue)],ht.prototype,"subscibeStop",1),ft([j(ue)],ht.prototype,"publish",1),ft([j(Or)],ht.prototype,"subscribe",1),ft([j()],ht.prototype,"sendSEI",1);let uh=ht;class Tn{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 H(this,null,function*(){if(!this.profile)return;const i=this.profileMap.get(this.profile)||(e==null?void 0:e.VideoProfileMap.get(this.profile));if(i){if(!t&&c&&c.applyConstraints)try{yield c.applyConstraints(i)}catch(r){}e&&(e==null||e.VideoProfileMap.set(this.profile,i),yield e.setVideoProfile(this.profile))}})}}class Dn extends we{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,i){return H(this,null,function*(){var o,a,u,h,g,f;const{videoTrack:r,audioTrack:n}=e;r&&((o=this.originVideoTrack)==null||o.removeEventListener("ended",this.onVideoTrackEnded)),n&&((a=this.originAudioTrack)==null||a.removeEventListener("ended",this.onAudioTrackEnded)),this.type===Qe.AliRtcSdkStreamTypeScreen?this.stop():(r&&((u=this.originVideoTrack)==null||u.stop()),n&&((h=this.originAudioTrack)==null||h.stop())),r&&(this.originVideoTrack=r,(g=this.originVideoTrack)==null||g.addEventListener("ended",this.onVideoTrackEnded),this.videoSource=t||Ri.Camera,this.updateVideoTrack(r)),n&&(this.originAudioTrack=n,(f=this.originAudioTrack)==null||f.addEventListener("ended",this.onAudioTrackEnded),this.audioSource=i||ur.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 H(this,null,function*(){(this._targetVideoTrack!==e||t)&&(this._targetVideoTrack=e)})}updateDualVideoTrack(e,t=!1){return H(this,null,function*(){(this._targetDualVideoTrack!==e||t)&&(this._targetDualVideoTrack=e)})}updateAudioTrack(e,t=!1){return H(this,null,function*(){(this._targetAudioTrack!==e||t)&&(this._targetAudioTrack=e)})}setAudioMuted(e){var t,i;this._audioMuted=e,e?(t=this.publishAudioStream)==null||t.disableAudio():(i=this.publishAudioStream)==null||i.enableAudio()}get isAudioMuted(){return this._audioMuted}setVideoMuted(e){var t,i;this._videoMuted=e,e?(t=this.publishVideoStream)==null||t.disableVideo():(i=this.publishVideoStream)==null||i.enableVideo()}get isVideoMuted(){return this._videoMuted}process(e){return H(this,null,function*(){var t,i,r,n,o,a,u,h,g,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?((i=(t=this._publishVideoStream)==null?void 0:t.videoTrack)==null?void 0:i.id)!==this._targetVideoTrack.id&&(this._publishVideoStream=yield nr(this._targetVideoTrack),this.setVideoMuted(this._videoMuted),(r=this.profileManager)==null||r.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 nr(this._targetVideoTrack)):(this._publishVideoStream=void 0,(a=this.previewStream)==null||a.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 nr(this._targetDualVideoTrack),this._videoMuted?this._publishDualVideoStream.disableVideo():this._publishDualVideoStream.enableVideo()):this._publishDualVideoStream=void 0,this._targetAudioTrack?((f=(g=this._publishAudioStream)==null?void 0:g.audioTrack)==null?void 0:f.id)!==this._targetAudioTrack.id&&(this._publishAudioStream=yield nr(this._targetAudioTrack),this.setAudioMuted(this._audioMuted),this.previewStream?(d=this.previewStream)==null||d.mergeStream(this._publishAudioStream):this._previewStream=yield nr(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 H(this,null,function*(){this._profileManager||(this._profileManager=new Tn),e&&this._profileManager.updateProfile(e,t),yield this._profileManager.setVideoProfile(this.originVideoTrack,this._publishVideoStream,this.type===Qe.AliRtcSdkStreamTypeScreen)})}get videoProfile(){var e;return(e=this.profileManager)==null?void 0:e.videoProfile}setVideoContentHint(e){this._profileManager||(this._profileManager=new Tn),this._profileManager.setContentHint(this.currentVideoTrack,e)}updateAudioProfile(e){return H(this,null,function*(){this._profileManager||(this._profileManager=new Tn),this._profileManager.updateAudioProfile(e)})}cloneVideoProfile(e){return H(this,null,function*(){var t;yield(t=this.profileManager)==null?void 0:t.setVideoProfile(void 0,e)})}addPlugin(e){const t=this.plugins.findIndex(i=>i.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 hh=Object.defineProperty,lh=Object.getOwnPropertyDescriptor,Mt=(s,c,e,t)=>{for(var i=t>1?void 0:t?lh(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&hh(c,e,i),i};const Pt=(Ui=class extends we{constructor(e,t){super();A(this,"pluginManager");A(this,"slsReporter");A(this,"publishingCameraVideoStream");A(this,"publishingScreenVideoStream");A(this,"cameraStreamInfo",new Dn(Qe.AliRtcSdkStreamTypeCapture));A(this,"screenStreamInfo",new Dn(Qe.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 i=r=>H(this,null,function*(){if(le.info(`[${Ui.logName}]`,"plugin added",r.name),!r.isSupported("6.11.7-beta.0")){console.warn(`${r.name} is not supported!!!`),r.emit("unsupported");return}try{yield r.init()}catch(n){r.emit("error",ce.fromError(n,oi.AliRtcPluginErrorInitError))}r.streamType===Qe.AliRtcSdkStreamTypeCapture&&(this.cameraStreamInfo.addPlugin(r),yield this.cameraStreamInfo.process(this.streamInfos)),r.streamType===Qe.AliRtcSdkStreamTypeScreen&&(this.screenStreamInfo.addPlugin(r),yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")});this.cameraStreamInfo.updateVideoProfile(jo,rr),this.cameraStreamInfo.on("videotrackended",()=>H(this,null,function*(){yield this.stopLocalStream({video:!0}),this.emit("trackended",Ei.VideoTrackEnded)})),this.cameraStreamInfo.on("audiotrackended",()=>H(this,null,function*(){yield this.stopLocalStream({audio:!0}),this.emit("trackended",Ei.AudioTrackEnded)})),this.screenStreamInfo.updateVideoProfile(Wo,sr),this.screenStreamInfo.on("videotrackended",()=>H(this,null,function*(){yield this.stopLocalStream({screen:!0}),this.emit("trackended",Ei.ScreenTrackEnded)})),this.pluginManager.on("added",i),this.pluginManager.on("removed",r=>H(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",()=>H(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 H(this,null,function*(){yield this.cameraStreamInfo.process(this.streamInfos),yield this.screenStreamInfo.process(this.streamInfos),this.emit("publishupdate")})}setAvailableCameraDeviceId(){return H(this,null,function*(){var e,t,i,r;if((e=this.cameraStreamInfo.cameraVideoConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.cameraVideoConstraints)==null?void 0:t.deviceId;const o=yield ye.AliRTS.getCameraList();o.find(a=>a.deviceId===n)||(n=(r=(i=o.find(a=>!!a.deviceId))==null?void 0:i.deviceId)!=null?r:""),this.cameraStreamInfo.cameraVideoConstraints.deviceId=n}})}setAvailableMicrophoneDeviceId(){return H(this,null,function*(){var e,t,i,r;if((e=this.cameraStreamInfo.micAudioConstraints)!=null&&e.deviceId){let n=(t=this.cameraStreamInfo.micAudioConstraints)==null?void 0:t.deviceId;const o=yield ye.AliRTS.getMicList();o.find(a=>a.deviceId===n)||(n=(r=(i=o.find(a=>!!a.deviceId))==null?void 0:i.deviceId)!=null?r:""),this.cameraStreamInfo.micAudioConstraints.deviceId=n}})}createLocalStream(e){return H(this,null,function*(){var g;const{screen:t,mediaStream:i,videoProfile:r,screenProfile:n}=e;let{video:o,audio:a}=e;const u=Ju(e);let h;if(u){i||(o===!0&&this.cameraStreamInfo.cameraVideoConstraints?(yield this.setAvailableCameraDeviceId(),o=Ce({},this.cameraStreamInfo.cameraVideoConstraints)):typeof o=="object"&&(yield this.setAvailableCameraDeviceId(),o=Ce(Ce({},o),this.cameraStreamInfo.cameraVideoConstraints)),a===void 0&&this.audioCaptureDisabled?a=!1:a&&(a===!0&&this.cameraStreamInfo.micAudioConstraints?(yield this.setAvailableMicrophoneDeviceId(),a=Ce({},this.cameraStreamInfo.micAudioConstraints)):typeof a=="object"&&(yield this.setAvailableMicrophoneDeviceId(),a=Ce(Ce({},a),this.cameraStreamInfo.micAudioConstraints)),this._audioCaptureDisabled=!1));const f=Date.now();try{h=yield ye.AliRTS.createStream({audio:a,video:o,screen:t,custom:!!i,mediaStream:i,skipProfile:!0}),a&&!i&&this.slsReporter.reportAudio(null,Date.now()-f,((g=h==null?void 0:h.audioTrack)==null?void 0:g.label)||""),t&&!i&&this.slsReporter.reportScreen(null,Date.now()-f)}catch(d){throw a&&!i&&this.slsReporter.reportAudio(d,Date.now()-f,""),t&&!i&&this.slsReporter.reportScreen(null,Date.now()-f),d}if(t)yield this.screenStreamInfo.updateSource(h,Ri.Screen,ur.Screen),yield this.setScreenProfile(n),this.setScreenContentHint(),this.publishingScreenVideoStream=void 0;else if(yield this.cameraStreamInfo.updateSource(h,Ri.Camera,ur.Microphone),h.hasVideo&&(yield this.setVideoProfile(r),this.setVideoContentHint(),this.publishingCameraVideoStream=void 0),h.hasAudio&&typeof a=="boolean"){const d=this.cameraStreamInfo.audioProfile;d&&(yield h.setAudioProfile(d))}}return ye.AliRTS.SystenUtil.isIos&&ye.AliRTS.SystenUtil.compareVersion("15.1")&&!ye.AliRTS.SystenUtil.compareVersion("15.2")&&(yield wi(1e3)),yield this.updateStreams(),h})}stopLocalStream(e){return H(this,null,function*(){const{screen:t,video:i,audio:r}=e!=null?e:{};let n=!1;i&&this.cameraStreamInfo.originVideoTrack&&(n=!0,this.cameraStreamInfo.stopVideo(),this.publishingCameraVideoStream=void 0),r&&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:i}=this;return{video:e?this.cameraStreamInfo.publishVideoStream:void 0,videoSmall:e?this.cameraStreamInfo.publishDualVideoStream:void 0,audio:t?this.cameraStreamInfo.publishAudioStream:void 0,screen:i?this.screenStreamInfo.publishVideoStream:void 0}}createHTTPPublishStream(){return H(this,null,function*(){var a,u,h,g;let e,t=!1,i,r,n;const o=yield this.publishStreams;try{if(!o.audio&&!o.video&&!o.videoSmall&&!o.screen)throw new ce(de.ERR_SDK_PUBLISH_INVAILD,"no tracks founded");const f=new MediaStream;(a=o.audio)!=null&&a.audioTrack&&f.addTrack(o.audio.audioTrack),(u=o.video)!=null&&u.videoTrack?(f.addTrack(o.video.videoTrack),r=o.videoSmall,n=o.screen):(h=o.screen)!=null&&h.videoTrack&&(i=Z.Screen,f.addTrack((g=o.screen)==null?void 0:g.videoTrack),t=!0),e=yield Jo(f),t?(this.screenStreamInfo.cloneVideoProfile(e),this.publishingScreenVideoStream=e):(this.cameraStreamInfo.cloneVideoProfile(e),this.publishingCameraVideoStream=e)}catch(f){}return{publishStream:e,videoSmallStream:r,screenStream:n,vMsid:i}})}stop(){this.cameraStreamInfo.stop(),this.screenStreamInfo.stop()}setVideoProfile(e,t){return H(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 H(this,null,function*(){var t;yield this.cameraStreamInfo.updateAudioProfile(e),yield(t=this.publishingCameraVideoStream)==null?void 0:t.setAudioProfile(e)})}setScreenProfile(e,t){return H(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=Ce(Ce({},(t=this.cameraStreamInfo.cameraVideoConstraints)!=null?t:{}),e)}setMicAudioConstraints(e){var t;this.cameraStreamInfo.micAudioConstraints=Ce(Ce({},(t=this.cameraStreamInfo.micAudioConstraints)!=null?t:{}),e)}},A(Ui,"logName","LocalStreamManager"),Ui);Mt([j(([s])=>{const{audio:c,video:e,screen:t,custom:i,skipProfile:r,videoProfile:n,screenProfile:o}=s;return[{audio:c,video:e,screen:t,custom:i,skipProfile:r,videoProfile:n,screenProfile:o}]})],Pt.prototype,"createLocalStream",1),Mt([j(ue)],Pt.prototype,"stopLocalStream",1),Mt([j()],Pt.prototype,"createHTTPPublishStream",1),Mt([j()],Pt.prototype,"stop",1),Mt([j(ue)],Pt.prototype,"setVideoProfile",1),Mt([j(ue)],Pt.prototype,"setVideoContentHint",1),Mt([j(ue)],Pt.prototype,"setAudioProfile",1),Mt([j(ue)],Pt.prototype,"setScreenProfile",1),Mt([j(ue)],Pt.prototype,"setScreenContentHint",1),Mt([j(ue)],Pt.prototype,"setCameraVideoConstraints",1),Mt([j(ue)],Pt.prototype,"setMicAudioConstraints",1);let dh=Pt;var fh=Object.defineProperty,ph=Object.getOwnPropertyDescriptor,Nt=(s,c,e,t)=>{for(var i=t>1?void 0:t?ph(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&fh(c,e,i),i};class wt extends we{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",rt.AliRtcVideoStreamTypeHigh);A(this,"audioMuted",!1);A(this,"playoutVolume",1);A(this,"audioVolumeIndicationInterval",0);A(this,"indicationTimer",0);const{signalingManager:t,slsReporter:i}=e;this.signalingManager=t,this.addSignalingManagerListener(),this.slsReporter=i,this.pluginManager=new ah,this.localStreamManager=new dh(this.pluginManager,this.slsReporter),this.rtsManager=new uh(this.localStreamManager,this.slsReporter),this.self=new Go({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval})}addSignalingManagerListener(){this.signalingManager.on("onNotifyPublish",e=>{le.event("[Signaling] Notify Publish ",e),e.forEach(t=>{this.onRemotePublishStateChange(t)})}),this.signalingManager.stsManager.on("onTokenUpdate",(e,t)=>{le.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(Ve.User)})}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e,this.remoteUsers.forEach(t=>{t.setWantSubVideo(e),t.updateSubscribe(Ve.User)})}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e,this.remoteUsers.forEach(t=>{t.setWantSubScreen(e),t.updateSubscribe(Ve.User)})}setRemoteDefaultVideoStreamType(e){this.defaultStreamType=e,this.remoteUsers.forEach(t=>{t.setRemoteDefaultVideoStreamType(e)})}setRemoteUserVideoStreamType(e,t){var i;(i=this.getRemoteUser(e))==null||i.setRemoteDefaultVideoStreamType(t)}setAudioMuted(e){this.audioMuted=e,this.remoteUsers.forEach(t=>{t.setAudioMuted(e)})}setLocalViewConfig(e,t){var r;if(!e)return(r=this.publisher)==null?void 0:r.setViewConfig(null,t);const i=kn(e);i.length!==0&&i.forEach(n=>{var o,a;(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)}),(a=this.publisher)==null||a.setViewConfig(i,t)})}setRemoteViewConfig(e,t,i){var n,o;if(!t)return(n=this.userMap[e])==null?void 0:n.setViewConfig(null,i);const r=kn(t);r.length!==0&&(r.forEach(a=>{var u;(u=this.publisher)==null||u.resetElement(a),Object.values(this.usersViewMap).forEach(({cameraViews:h=[],screenViews:g=[]})=>{h.includes(a)&&h.splice(h.indexOf(a),1),g.includes(a)&&g.splice(g.indexOf(a),1)})}),(o=this.userMap[e])==null||o.setViewConfig(r,i))}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 a;const{isAudioSubscribing:i,isVideoLargeSubscribing:r,isVideoSmallSubscribing:n,isScreenSubscribing:o}=(a=t.streamInfo)!=null?a:{};return i||r||n||o})}onRemotePublishStateChange(e){var f;const{userid:t,callid:i,subscribe:r,pubid:n="",tracks:o}=e,a=(f=r==null?void 0:r.pullstreamurl)!=null?f:"";let u=this.getRemoteUser(t);if(!u)return;const h=u.streamInfo.audioTrackInfo,g=u.streamInfo.videoTrackInfo;u.updateRemoteTracks(i,a,n,o),u.updateSubscribe(Ve.Publish),(h!==u.streamInfo.audioTrackInfo||g!==u.streamInfo.videoTrackInfo)&&this.emit("remoteTrackAvailableChange",t,u.streamInfo.audioTrackInfo,u.streamInfo.videoTrackInfo)}init(e,t){var i;this.authInfo=e,this.self||(this.self=new Go({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval})),this.self.enableAudioVolumeIndication(this.audioVolumeIndicationInterval),(i=this.self)==null||i.initInfo(e,t.pushstreamurl),t.users.forEach(r=>{const n=r.userid;if(n){const o=this.addUser(n,r.displayname,Ve.InRoom),{callid:a,subscribe:u,tracks:h}=r;o.updateRemoteTracks(a,(u==null?void 0:u.pullstreamurl)||"","",h),this.emit("remoteTrackAvailableChange",n,o.streamInfo.audioTrackInfo,o.streamInfo.videoTrackInfo)}}),this.startStatsMonitor()}clear(){return H(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(()=>H(this,null,function*(){if(this.publisher){const{audio:i,video:r,transport:n}=yield this.publisher.getStats();i&&i.length>0&&this.emit("rtcLocalAudioStats",i),r&&r.length>0&&this.emit("rtcLocalVideoStats",r),n&&this.emit("rtcStats",n)}const e=[],t=[];for(const i of this.remoteUsers){const{audio:r,video:n}=yield i.getStats();r&&r.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)}addUser(e,t,i){return this.userMap[e]||(this.userMap[e]=this.executeAddUser(e,t,i)),this.userMap[e]}executeAddUser(e,t,i){const r=new Je({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 r.on(dt.Remote,this.onRemoteDeviceStatusChange.bind(this)),r.on(Me.PullStreamStats,this.onRemoteStatReport.bind(this)),r.on(Me.RtsSubscribeExceeds,this.onSubscribeExceeds.bind(this)),r.on("audioSubscribeStateChanged",(n,o,a,u)=>{this.emit("audioSubscribeStateChanged",n,o,a,u,this.channel||"")}),r.on("videoSubscribeStateChanged",(n,o,a,u)=>{this.emit("videoSubscribeStateChanged",n,o,a,u,this.channel||"")}),r.on("screenSubscribeStateChanged",(n,o,a,u)=>{this.emit("screenSubscribeStateChanged",n,o,a,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(i),r}onRemoteDeviceStatusChange(e,t){e===Me.MuteAudio?this.emit("userAudioMuted",t,!0):e===Me.UnmuteAudio?this.emit("userAudioMuted",t,!1):e===Me.MuteVideo?this.emit("userVideoMuted",t,!0):e===Me.UnmuteVideo?this.emit("userVideoMuted",t,!1):e===Me.MuteScreen?this.emit("userScreenMuted",t,!0):e===Me.UnmuteScreen&&this.emit("userScreenMuted",t,!1)}onRemoteStatReport(e,t,i){this.emit(Me.PullStreamStats,e,t,i)}onSubscribeExceeds(e,t){this.emit(Me.RtsSubscribeExceeds,e,t)}removeLeftUser(e){return H(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=[],i=[],r={};e.forEach(a=>{a.userid&&(this.userMap[a.userid]?(i.push(a),r[a.userid]=this.userMap[a.userid]):(t.push(a),r[a.userid]=this.executeAddUser(a.userid,a.displayname,Ve.Resume)))});const n=Object.keys(this.userMap),o=[];return n.forEach(a=>{r[a]||o.push({userid:a,reason:"",leavecode:wn.AliRtcUserOfflineQuit})}),this.userMap=r,{joinList:t,leaveList:o,presentList:i}}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 i=this.userMap[e];if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubAudio(t),t?i.updateSubscribe(Ve.User):i.stopSubscribe({audio:!0})}updateVideoWant(e,t){const i=this.userMap[e];if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubVideo(t),t?i.updateSubscribe(Ve.User):i.stopSubscribe({video:!0})}updateScreenWant(e,t){const i=this.userMap[e];if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubScreen(t),t?i.updateSubscribe(Ve.User):i.stopSubscribe({screen:!0})}stopIndication(){this.indicationTimer&&window.clearInterval(this.indicationTimer)}startIndication(e){this.stopIndication(),this.indicationTimer=window.setInterval(()=>{var i;const t=this.remoteUsers.map(r=>({userId:r.userId,volume:r.getAudioLevel()||0}));t.unshift({userId:"",volume:((i=this.self)==null?void 0:i.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(i=>{i.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=Ce(Ce({},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(wt,"logName","BizControl"),Nt([j()],wt.prototype,"init",1),Nt([j()],wt.prototype,"clear",1),Nt([j(ue)],wt.prototype,"addUser",1),Nt([j()],wt.prototype,"removeLeftUser",1),Nt([j()],wt.prototype,"updateUsers",1),Nt([j(ue)],wt.prototype,"updateAudioWant",1),Nt([j(ue)],wt.prototype,"updateVideoWant",1),Nt([j(ue)],wt.prototype,"updateScreenWant",1),Nt([j()],wt.prototype,"stopIndication",1),Nt([j()],wt.prototype,"startIndication",1),Nt([j()],wt.prototype,"enableAudioVolumeIndication",1);const Bn=s=>H(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"]),i=yield window.crypto.subtle.sign("HMAC",t,e);return Array.from(new Uint8Array(i)).map(r=>r.toString(16).padStart(2,"0")).join("")});class mh{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(zt.LiveTranscodingErrorInvalidParam);const i="https://gw.rtn.aliyuncs.com",r=Pu[c],n={appid:t.appId,userid:t.userId,channelid:t.channelId,timestamp:t.timestamp,token:t.token,nonce:t.nonce?t.nonce:"",requestid:Ut.createCallid(),tokensid:!1,session:(u=t.sessionId)!=null?u:Ut.createCallid()},o=Object.keys(n).map(h=>`${h}=${encodeURIComponent(n[h])}`).join("&"),a=`${i}${r}?${o}`;return fetch(a,{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 ce(de.ERR_INNER,`transcoding request failed, status: ${h.status}`))):h).catch(h=>Promise.reject(new ce(de.ERR_INNER,`transcoding request failed, err: ${h.message}`)))}setAuthInfo(c){this.authInfo=c}clear(){this.authInfo=void 0}startPublishLiveStream(c,e){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const t=yield Bn(c.split("?")[0]),i=xt.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(i,this.authInfo,t,c);return this.doRequest(i,r)})}startPublishLiveStreamWithTaskId(c,e){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const t=xt.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(t,this.authInfo,c);return this.doRequest(t,i)})}updatePublishLiveStream(c,e){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const t=yield Bn(c.split("?")[0]),i=xt.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(i,this.authInfo,t,c);return this.doRequest(i,r)})}updatePublishLiveStreamWithTaskId(c,e){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const t=xt.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(t,this.authInfo,c);return this.doRequest(t,i)})}stopPublishLiveStream(c){return H(this,null,function*(){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const e=yield Bn(c.split("?")[0]),t=xt.MPU_TASK_TRANSACTION_STOP,i=new Lr().toJson(t,this.authInfo,e,c);return this.doRequest(t,i)})}stopPublishLiveStreamWithTaskId(c){if(!this.authInfo)return Promise.reject(zt.LiveTranscodingErrorInvalidParam);const e=xt.MPU_TASK_TRANSACTION_STOP,t=new Lr().toJson(e,this.authInfo,c);return this.doRequest(e,t)}refreshAuthInfo(c){this.authInfo&&this.setAuthInfo(Ce(Ce({},this.authInfo),c))}}class Zo{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(Zo,"LEVEL",0);class gh{constructor(){A(this,"logger",new Zo("AudioMixer"));A(this,"audioContext",new AudioContext);A(this,"audioDestination",this.audioContext.createMediaStreamDestination());A(this,"audioTrack",Ku(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),i=this.audioContext.createGain();i.gain.value=1,t.connect(i),i.connect(this.audioDestination),this.sourceNodeMap[c.id]={track:c,sourceNode:t,gainNode:i},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 vh=4;class xh extends Fi{constructor(){super("audioMixer",Qe.AliRtcSdkStreamTypeCapture,Dr.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,i])=>{this.isValidVolume(i)&&(this.options[t]=i)}),this.dirty=!0,this.emit("updated")}isSupported(){return"AudioContext"in window}shouldUpdate(e,t){var n,o;if(e.type!==Qe.AliRtcSdkStreamTypeCapture)return!1;const i=t.find(a=>a.type===Qe.AliRtcSdkStreamTypeCapture),r=t.find(a=>a.type===Qe.AliRtcSdkStreamTypeScreen);return!(this.primaryAudioTrackId===((n=i==null?void 0:i.currentAudioTrack)==null?void 0:n.id)&&this.screenAudioTrackId===((o=r==null?void 0:r.currentAudioTrack)==null?void 0:o.id)&&!this.dirty)}process(e,t){return H(this,null,function*(){var o,a;this.dirty=!1;const i=t.find(u=>u.type===Qe.AliRtcSdkStreamTypeScreen),r=e.currentAudioTrack,n=i==null?void 0:i.currentAudioTrack;if(!n&&this.options.audio===1){this.audioMixer&&(this.audioMixer.dispose(),this.audioMixer=void 0),this.primaryAudioTrackId=r==null?void 0:r.id,e.updateAudioTrack(r);return}this.audioMixer||(this.audioMixer=new gh),yield this.audioMixer.resume(),this.primaryAudioTrackId&&(r==null?void 0:r.id)!==this.primaryAudioTrackId&&((o=this.audioMixer)==null||o.removeTrack(this.primaryAudioTrackId)),r&&!this.audioMixer.hasTrack(r==null?void 0:r.id)&&this.audioMixer.addTrack(r),this.primaryAudioTrackId=r==null?void 0:r.id,this.screenAudioTrackId&&(n==null?void 0:n.id)!==this.screenAudioTrackId&&((a=this.audioMixer)==null||a.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<=vh}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 Pn{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,i){const r=e/c,n=i/t;let o=t,a=i,u=0,h=0;return n>r?(o=Math.round(a/r),u=Math.round((t-o)/2)):n<r&&(a=Math.round(o*r),h=Math.round((i-a)/2)),{x:u,y:h,width:o,height:a}}}class bh extends Pn{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 Sh=`
|
|
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
|
+
`,_h=`
|
|
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 yh(){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 wh(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 Yo(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 Ah(s,c,e){const t=Yo(s,s.VERTEX_SHADER,c),i=Yo(s,s.FRAGMENT_SHADER,e),r=s.createProgram();if(!(!r||!t||!i))return s.attachShader(r,t),s.attachShader(r,i),s.linkProgram(r),s.getProgramParameter(r,s.LINK_STATUS)?r:(console.error(`Unable to initialize the shader program: ${s.getProgramInfoLog(r)}`),null)}function Eh(s,c,e,t=0,i=0){const r=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,r);const n=t,o=i,a=c+t,u=e+i,h=[n,o,a,o,n,u,n,u,a,o,a,u];return s.bufferData(s.ARRAY_BUFFER,new Float32Array(h),s.STATIC_DRAW),r}class Qo extends Pn{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 yh()}initGL(){const e=this.targetCtx;if(!e)return;this.targetTexture=wh(e);const t=Ah(e,Sh,_h);if(!t){console.log("[ScalerWebGL] program is null.");return}e.useProgram(t);const i=e.getAttribLocation(t,"a_position"),r=e.getAttribLocation(t,"a_texCoord"),n=e.getUniformLocation(t,"u_resolution");if(!n){console.log("[ScalerWebGL] resolutionLocation is null.");return}const o=e.getUniformLocation(t,"u_texture");if(!o){console.log("[ScalerWebGL] textureLocation is null.");return}this.locationMap={program:t,positionLocation:i,texCoordLocation:r,resolutionLocation:n,textureLocation:o},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,i=this.locationMap.texCoordLocation,r=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),o=Eh(e,n.width,n.height,n.x,n.y);e.enableVertexAttribArray(t),e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(t,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i);const a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),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,a),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),e.uniform2f(r,this.targetWidth,this.targetHeight)}renderTexture(){const e=this.targetTexture,t=this.targetCtx,i=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(i,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 Ch=`
|
|
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 ec extends Pn{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([Ch],{type:"text/javascript"}),i=(window.URL||window.webkitURL).createObjectURL(e);this.worker=new Worker(i);const{readable:r}=this.processor,{writable:n}=this.trackGenerator;this.worker.postMessage({type:"startRender",readable:r,writable:n,width:this.targetWidth,height:this.targetHeight,frameRate:this.targetFrameRate},[r,n])}updateOptions(e){super.updateOptions(e),this.worker&&this.worker.postMessage(Ce({type:"updateOptions"},e))}dispose(){try{this.processor.readable.cancel(),this.trackGenerator.writable.close()}catch(e){}}getVideoTrack(){return this.trackGenerator}}class Ln{static isSupport(){return typeof HTMLCanvasElement.prototype.captureStream=="function"}static getInstance(c,e){return ec.isSupport()?new ec(c,e):Qo.isSupport()?new Qo(c,e):new bh(c,e)}}class Ih extends Fi{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 Ln.isSupport()}shouldUpdate(e){return this.hasVideoTrack!==!!e.currentVideoTrack}process(e){return H(this,null,function*(){if(e.currentVideoTrack){if(this.hasVideoTrack=!0,!this.videoScaler){const i=this.options||this.initOptions;this.videoScaler=Ln.getInstance(e.currentVideoTrack,i)}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 Mn{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 ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no authInfo founded");if(!c.appId)return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no appId founded");if(!c.channelId)return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no channelId founded");if(!c.userId)return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no userId founded");if(c.timestamp){if(!Mn.checkNumber(c.timestamp))return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"timestamp is not number")}else return new ce(de.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no timestamp founded");return c.token?null:new ce(de.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 tc{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 ic{constructor(c,e,t){A(this,"userId");A(this,"streamType");A(this,"sourceType");this.userId=c,this.streamType=e,this.sourceType=t}}class rc{constructor(c,e,t,i=0,r=16777215,n=tr.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=i,this.fontColor=r,this.fontType=n}toJson(c,e){return{x:Bt(this.x,c),y:Bt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:yn(this.fontColor),zorder:this.zOrder}}}var sc=(s=>(s[s.NOT_DISPLAY=0]="NOT_DISPLAY",s[s.ALWAYS=1]="ALWAYS",s[s.WHEN_NO_VIDEO=2]="WHEN_NO_VIDEO",s))(sc||{});class Nn{constructor(c,e,t,i,r,n=0,o=1,a=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=i,this.height=r,this.zOrder=n,this.alpha=o,this.display=a}toJson(c,e){return{url:this.url,alpha:this.alpha,display:this.display,x:Bt(this.x,c),y:Bt(this.y,e),width:Bt(this.width,c),height:Bt(this.height,e),zorder:this.zOrder}}}A(Nn,"DisplayType",sc);class nc{constructor(c,e,t,i,r=0,n=16777215,o=tr.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=i,this.zOrder=r,this.fontColor=n,this.fontType=o}toJson(c,e){return{text:this.text,x:Bt(this.x,c),y:Bt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:yn(this.fontColor),zorder:this.zOrder}}}class ac{constructor(c,e,t,i,r,n=0,o){A(this,"userId");A(this,"x");A(this,"y");A(this,"width");A(this,"height");A(this,"zOrder");A(this,"sourceType");A(this,"segmentType",er.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=i,this.height=r,this.zOrder=n,o&&(this.sourceType=o)}toJson(c,e,t,i){const r={paneid:c,majorpane:0,x:Bt(this.x,e),y:Bt(this.y,t),width:Bt(this.width,e),height:Bt(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&&Qi[this.sourceType]?r.sourcetype=Qi[this.sourceType]:r.sourcetype=Qi[Oi.LiveTranscodingCamera],this.segmentType&&i===Pr.LiveTranscodingVirtualBackground?r.segmenttype=this.segmentType:r.segmenttype=er.LiveTranscodingNoBody,r}}class Rh extends Fi{constructor(){super("AliRtcScreenStandardize",Qe.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 i=Math.ceil(e/this.options.base)*this.options.base,r=Math.ceil(t/this.options.base)*this.options.base;if(this.canvas||(this.canvas=document.createElement("canvas")),this.canvas.width=i,this.canvas.height=r,this.lastWidth&&e>this.lastWidth||this.lastHeight&&t>this.lastHeight){const n=this.canvas.getContext("2d");n&&n.clearRect(0,0,i,r)}this.lastWidth=e,this.lastHeight=t}shouldUpdate(e){return this.hasScreenTrack!==(!!e.originVideoTrack&&e.videoSource===Ri.Screen)}handleFrame(e,t){return H(this,null,function*(){var o;const{displayWidth:i,displayHeight:r}=e;if(!i||!r||i%this.options.base===0&&r%this.options.base===0)return this.clear(t),e;this.updateProcessCanvas(i,r);const n=(o=this.canvas)==null?void 0:o.getContext("2d");if(this.canvas&&n){n.drawImage(e,0,0,i,r);const a=new VideoFrame(this.canvas,{timestamp:e.timestamp});return e.close(),a}return e})}process(e){return H(this,null,function*(){var h;if(!e.originVideoTrack||e.videoSource!==Ri.Screen){this.clear(e),this.hasScreenTrack=!1;return}const t=new MediaStreamTrackProcessor({track:e.originVideoTrack}),i=new MediaStreamTrackGenerator({kind:"video"}),r=new MediaStream([i]),n=this,o=new TransformStream({transform(g,f){return H(this,null,function*(){const d=yield n.handleFrame(g,e);yield f.enqueue(d),d==null||d.close()})}});t.readable.pipeThrough(o).pipeTo(i.writable);const a=(h=r.getVideoTracks())==null?void 0:h[0];e.updateVideoTrack(a),this.hasScreenTrack=!0})}clear(e){this.canvas=void 0,this.lastWidth=void 0,this.lastHeight=void 0,super.clear(e)}}var kh=Object.defineProperty,Th=Object.getOwnPropertyDescriptor,ve=(s,c,e,t)=>{for(var i=t>1?void 0:t?Th(c,e):c,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(t?n(c,e,i):n(i))||i);return t&&i&&kh(c,e,i),i};const me=(xe=class extends we{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",Ne.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 Zi(this),this.channelProfile=Xt.AliRtcSdkCommunication,this.clientRole=ni.AliRtcSdkLive,this.liveTranscoding=new mh(this.slsReporter),this.signalingManager=new Hu(this.channelProfile,this.clientRole,this.slsReporter,(e==null?void 0:e.env)===Jt.pre?Jt.pre:Jt.prod),this.addSignalingManagerListeners(),this.maxSignalingConnectRetryCount=e==null?void 0:e.maxSignalingConnectRetryCount,this.bizControl=new wt({slsReporter:this.slsReporter,signalingManager:this.signalingManager}),this.addBizControlListeners(),this.addPublisherListeners(),this.audioMixerPlugin=new xh,this.enablePlugin(this.audioMixerPlugin),this.dualVideoPlugin=new Ih("dualVideoPlugin"),this.enablePlugin(new Rh),this.slsReporter.reportSDKCreated(t)}static getSdkVersion(){return ns}static setLogLevel(e){le.setLogLevel(e)}static getInstance(e){return xe._instance||(xe._instance=new xe(e)),xe._instance}destroy(){xe._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===Xt.AliRtcSdkCommunication||this.clientRole===ni.AliRtcSdkInteractive}resetState(){return H(this,null,function*(){yield this.bizControl.clear(),this.connectState=Ne.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 H(this,null,function*(){var t,i,r;e?yield(t=this.publisher)==null?void 0:t.stopLocalStream(e):(yield(i=this.publisher)==null?void 0:i.publishStop(),(r=this.publisher)==null||r.stopPreview())})}addPublisherListeners(){var e,t,i,r,n,o,a,u,h;(e=this.publisher)==null||e.on(dt.Local,g=>{le.event("[Publisher] Device Status Change",g),this.onLocalDeviceStatusChange(g)}),(t=this.publisher)==null||t.on(Ei.VideoTrackEnded,()=>{le.event("[Publisher] VideoTrack Ended"),this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeCamera,$e.AliEngineLocalDeviceExceptionTypeCameraInterrupt,"")}),(i=this.publisher)==null||i.on(Ei.ScreenTrackEnded,()=>{le.event("[Publisher] ScreenTrack Ended"),this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeDisplay,$e.AliEngineLocalDeviceExceptionTypeDisplayException,"")}),(r=this.publisher)==null||r.on(Ei.AudioTrackEnded,()=>{le.event("[Publisher] AudioTrack Ended"),this.emit("localDeviceException",jt.AliEngineLocalDeviceTypeMic,$e.AliEngineLocalDeviceExceptionTypeMicInterrupt,"")}),(n=this.publisher)==null||n.on("localDeviceException",(g,f,d="")=>{this.emit("localDeviceException",g,f,d)}),(o=this.publisher)==null||o.on("audioPublishStateChanged",(g,f,d)=>{var p;this.emit("audioPublishStateChanged",g,f,d,(p=this.channel)!=null?p:"")}),(a=this.publisher)==null||a.on("videoPublishStateChanged",(g,f,d)=>{var p;this.emit("videoPublishStateChanged",g,f,d,(p=this.channel)!=null?p:"")}),(u=this.publisher)==null||u.on("dualStreamPublishStateChanged",(g,f,d)=>{var p;this.emit("dualStreamPublishStateChanged",g,f,d,(p=this.channel)!=null?p:"")}),(h=this.publisher)==null||h.on("screenPublishStateChanged",(g,f,d)=>{var p;this.emit("screenSharePublishStateChanged",g,f,d,(p=this.channel)!=null?p:"")})}addBizControlListeners(){this.bizControl.rtsManager.on("disconnected",()=>H(this,null,function*(){le.event(`[${xe.logName}]`,"RTS Disconnected"),(yield Ut.isNetworkAvailable())?this.onNetworkRecovery():this.onNetworkError()})),this.bizControl.rtsManager.on("subscribeexceeds",()=>H(this,null,function*(){yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList()})),this.bizControl.rtsManager.on("seimessage",(e,t,i)=>{const r=this.remoteUsers.find(n=>n.streamUrl===e);r&&this.emit("mediaExtensionMsgReceived",r.userId,i,t)}),this.bizControl.on(dt.Remote,(e,t)=>{le.event(`[${xe.logName}]`,"RemoteUser Device Status Change",e,t)}),this.bizControl.on("remoteTrackAvailableChange",(e,t,i)=>{this.emit("remoteTrackAvailableNotify",e,t,i)}),this.bizControl.on("audioSubscribeStateChanged",(e,t,i,r,n)=>{this.emit("audioSubscribeStateChanged",e,t,i,r,n)}),this.bizControl.on("videoSubscribeStateChanged",(e,t,i,r,n)=>{this.emit("videoSubscribeStateChanged",e,t,i,r,n)}),this.bizControl.on("screenSubscribeStateChanged",(e,t,i,r,n)=>{this.emit("screenShareSubscribeStateChanged",e,t,i,r,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&&(le.event("[Signaling] Receive KeepAlive Response",`networkError: ${this.networkError}`),this.onNetworkRecovery())}),this.signalingManager.on("onNotifyJoin",e=>{le.event("[Signaling] Notify Join ",e),this.handleUsersJoin(e),e.forEach(t=>{this.emit("remoteUserOnLineNotify",t.userid,0)})}),this.signalingManager.on("onNotifyStatus",e=>{le.event("[Signaling] Notify Status ",e),e.forEach(t=>{this.bizControl.updateRemoteUserDeviceStatus(t)})}),this.signalingManager.on("onNotifyLeave",e=>{le.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)=>{le.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=>{le.event("[Signaling] Connect Failed ",e),this.onError(e),this.backToUnpublishStatus(),this.connectState=Ne.AliRtcConnectionStatusFailed,this.emit("connectionStatusChange",Ne.AliRtcConnectionStatusFailed,yi.AliRtcConnectionChangedNetworkInterrupted)}),this.signalingManager.on("onNetworkError",e=>{this.slsReporter.reportWarning("signaling network error"),le.event("[Signaling] Network error ",e),this.onNetworkError()}),this.signalingManager.on("onAuthInvalid",()=>{le.event("[Signaling] Auth Invalid")}),this.signalingManager.on("onReconnectStart",()=>{le.event("[Signaling] Reconnect Start "),this.connectState=Ne.AliRtcConnectionStatusReconnecting,this.emit("connectionStatusChange",Ne.AliRtcConnectionStatusReconnecting,yi.AliRtcConnectionSignalingConnecting)}),this.signalingManager.on("onReconnectSuccess",e=>{le.event("[Signaling] Reconnect Success ",e),this.onNetworkRecovery(e)}),this.signalingManager.on("onReconnectFail",e=>{this.slsReporter.reportWarning("signaling reconnect fail: ${err.code}"),le.event("[Signaling] Reconnect Failed ",e),e.code===403&&this.emit("authInfoExpired")}),this.signalingManager.on("onError",e=>{this.slsReporter.reportWarning("signaling error: ${err.message}"),le.event("[Signaling] Error ",e),this.onError(e)})}backToUnpublishStatus(){var e,t;this.connectState=Ne.AliRtcConnectionStatusDisconnected,(e=this.publisher)!=null&&e.isPublishing&&((t=this.publisher)==null||t.clearPublishState()),this.networkError=!1}handleUsersJoin(e){e.forEach(t=>{const i=t.userid;if(i){const r=this.bizControl.addUser(i,t.displayname,Ve.Join);le.event(`[${xe.logName}]`,Me.UserJoined,r)}})}onLocalDeviceStatusChange(e){le.event(`[${xe.logName}]`,dt.Local,e),this.signalingManager.reportStatus(e).then(()=>{le.debug("[signaling] reportStatus suc")}).catch(t=>{le.error("[signaling] reportStatus failed",t)})}resumePublishForNetworkRecovery(){return H(this,null,function*(){var e;try{yield(e=this.publisher)==null?void 0:e.resumePublish()}catch(t){const{code:i}=t;if(i===10205){let n=1;try{yield new Promise((o,a)=>{const u=setInterval(()=>H(this,null,function*(){var h;n>1&&(clearInterval(u),a()),n+=1;try{yield(h=this.publisher)==null?void 0:h.resumePublish(),clearInterval(u),o()}catch(g){const{code:f}=g;f!==10205&&(clearInterval(u),a())}}),1e3)})}catch(o){}}}})}onNetworkRecovery(e){return H(this,null,function*(){var t;le.event(xe.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=Ne.AliRtcConnectionStatusConnected,this.emit("connectionStatusChange",Ne.AliRtcConnectionStatusConnected,yi.AliRtcConnectionSignalingHeartbeatAlive))})}resumeSubList(e){return H(this,null,function*(){if(e!=null&&e.length){const{joinList:t,leaveList:i,presentList:r}=this.bizControl.updateUsers(e);le.info(`[${xe.logName}]`,"resumeSubList",{joinList:t,leaveList:i,presentList:r}),this.handleUsersJoin(t),i.forEach(n=>{le.event(xe.logName,Me.UserLeft,n.userid,n.reason),this.emit("remoteUserOffLineNotify",n.userid,wn.AliRtcUserOfflineQuit)});for(let n=0;n<r.length;n++){const o=r[n],a=o.userid,u=this.bizControl.getRemoteUser(a);this.bizControl.onRemotePublishStateChange(o),u==null||u.restore(),u==null||u.updateSubscribe(Ve.Resume)}}else for(let t=0;t<this.remoteUsers.length;t++){const i=this.remoteUsers[t];try{i.restore(),i.updateSubscribe(Ve.Resume)}catch(r){}}})}onNetworkError(){this.connectState===Ne.AliRtcConnectionStatusConnected&&(this.networkError||(this.connectState=Ne.AliRtcConnectionStatusDisconnected,this.emit("connectionStatusChange",Ne.AliRtcConnectionStatusDisconnected,yi.AliRtcConnectionChangedNetworkInterrupted)),this.networkError=!0)}onError(e){this.slsReporter.reportError(e),le.event(xe.logName,Me.Error,e)}setEnableDualVideoStream(e,t){t&&this.dualVideoPlugin.setOptions(t);const i=this.bizControl.pluginManager.has(this.dualVideoPlugin.name);e?!i&&this.enablePlugin(this.dualVideoPlugin):i&&this.removePlugin(this.dualVideoPlugin.name)}hadPushStream(e){if(!(this.publisher&&e))throw new ce(de.ERR_INNER,"stream is not publishing")}getCurrentMicDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentMicDeviceId()}setChannelProfile(e){if(![Ne.AliRtcConnectionStatusInit,Ne.AliRtcConnectionStatusDisconnected,Ne.AliRtcConnectionStatusFailed].includes(this.connectState))throw new ce(de.ERR_INNER,"cannot set channel profile in call");this.channelProfile=e,this.channelProfile===Xt.AliRtcSdkCommunication&&(this.clientRole=ni.AliRtcSdkLive),this.signalingManager.setChannelProfile(e)}setClientRole(e){return H(this,null,function*(){var t,i,r,n,o;try{if(this.channelProfile===Xt.AliRtcSdkCommunication)return;if(!Object.values(ni).includes(e))throw new ce(de.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===ni.AliRtcSdkInteractive?(this.bizControl.isSubscribing?(yield this.stopPublish(),yield(t=this.publisher)==null?void 0:t.clearStream()):yield(i=this.publisher)==null?void 0:i.unPublish(),yield this.signalingManager.setClientRole(e)):(yield this.signalingManager.setClientRole(e),yield this.startDefaultDevicesCapture(),(r=this.publisher)!=null&&r.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(a){throw a.code===403&&this.emit("authInfoExpired"),a}})}getCurrentClientRole(){return this.clientRole}setAudioOnlyMode(e){if(this.isInCall())throw new ce(de.ERR_INNER,"can not change audioOnly mode in call");this._audioOnlyMode=e}setAudioRedEnabled(e){if(this.isInCall())throw new ce(de.ERR_INNER,"can not change audioRedEnabled in call");this.bizControl.setAudioRedEnabled(e)}setCheckAuthInfoTimer(e,t){const i=(e-t)*1e3;this._authInfoExpiredTimer=window.setTimeout(()=>{this.emit("authInfoExpired")},i),this._authInfoWillExpireTimer=window.setTimeout(()=>{this.emit("authInfoWillExpire")},i-3e4),this._serverCheckAuthInfoTimestamp=t,this._localCheckAuthInfoTimestamp=+Date.now()/1e3}clearCheckAuthInfoTimer(){this._authInfoExpiredTimer&&window.clearTimeout(this._authInfoExpiredTimer),this._authInfoWillExpireTimer&&window.clearTimeout(this._authInfoWillExpireTimer)}startDefaultDevicesCapture(){return H(this,null,function*(){var i,r;let e=[],t;try{this._audioOnlyMode||(e=yield xe.getCameraList(),e.length||le.warn(`${[xe.logName]}`,"No media neither devices can be captured")),t=yield xe.getMicrophoneList(),t.length||le.warn(`${[xe.logName]}`,"No media neither devices can be captured");const{hasCamera:n,hasMicrophone:o,hasScreenShare:a,audioCaptureDisabled:u,publishLocalAudioStreamEnabled:h,publishLocalVideoStreamEnabled:g}=(i=this.publisher)!=null?i:{};if(n||o||a)return;!n&&g&&!this._audioOnlyMode&&e.length&&!((r=this.publisher)!=null&&r.cameraCaptureDisabled)&&(yield this.enableLocalVideo(!0)),!o&&h&&!u&&t.length&&(yield this.startAudioCapture())}catch(n){throw n}})}joinChannel(e,t,i,r){return H(this,null,function*(){var h,g,f,d,p,l,m,x,v,b;let n=r,o;if(typeof e=="string"){n=r;try{const w=JSON.parse(window.atob(e));if(o={appId:w.appid,channelId:w.channelid,userId:w.userid,timestamp:w.timestamp,nonce:w.nonce,token:w.token},o.channelId!==t)throw new Error("channelId is not equal");if(o.userId!==i)throw new Error("userId is not equal")}catch(w){throw new ce(de.ERR_INVALID_ARGUMENTS,`authInfo is invalid: ${w.message||""}`)}}else o=e,n=t;const a={start:Date.now()};let u=Mn.checkAuthInfo(o);if(Ne.AliRtcConnectionStatusInit===this.connectState||Ne.AliRtcConnectionStatusDisconnected===this.connectState||Ne.AliRtcConnectionStatusFailed===this.connectState){if(this.connectState=Ne.AliRtcConnectionStatusConnecting,u)throw this.connectState=Ne.AliRtcConnectionStatusFailed,this.slsReporter.reportJoin(u.code,a,""),this.slsReporter.reportJoinResult(u),u;o.sessionId=Ut.createCallid("web"),le.setSessionID(o.appId,o.sessionId),this.slsReporter.start(o);try{const C=yield this.signalingManager.join(o,n,this.maxSignalingConnectRetryCount,a);this.connectState=Ne.AliRtcConnectionStatusConnected,(h=this.publisher)==null||h.reportSelfDeviceStatus(),this.bizControl.init(o,C),this.setCheckAuthInfoTimer(o.timestamp,C.timestamp),this.liveTranscoding.setAuthInfo(o),this.slsReporter.reportJoin(0,a,C.tid),this.slsReporter.reportJoinResult(null)}catch(C){const E=(g=C.code)!=null?g:-1,I=C.reason||C.message||"";throw this.connectState=Ne.AliRtcConnectionStatusDisconnected,this.slsReporter.reportJoin(E,a,""),this.slsReporter.reportJoinResult(C),new ce(E,I)}let w=!1,_=!1;try{this.currentRoleCanPublish&&(yield this.startDefaultDevicesCapture(),w=!!((f=this.publisher)!=null&&f.publishStreams.audio),_=!!((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(C=>C)&&(yield(v=this.publisher)==null?void 0:v.startPublish(!1,di.JOINCHANNEL),yield(b=this.publisher)==null?void 0:b.previewAll())),this.remoteUsers.forEach(C=>{C.updateSubscribe(Ve.Join)})}catch(C){w&&this.emit("onOccurError",new ce(de.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED,`join channel auto publish audio stream failed, ${C.message||""}`)),_&&this.emit("onOccurError",new ce(de.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED,`join channel auto publish video stream failed, ${C.message||""}`))}}else{const w=new ce(de.ERR_JOIN_ALREADY_JOINED,"already joined");throw this.connectState===Ne.AliRtcConnectionStatusConnecting&&(w.message="Repeated operation during login"),this.slsReporter.reportJoin(w.code,a,""),w}})}leaveChannel(e=!1){return H(this,null,function*(){var i;this.slsReporter.reportLeaveInvoked();let t=new Date().getTime();if(Ne.AliRtcConnectionStatusConnected===this.connectState)try{let r;e||(r=yield this.signalingManager.leave()),this.clearCheckAuthInfoTimer(),yield this.resetState(),this.slsReporter.reportLeave(new Date().getTime()-t,0,(i=r==null?void 0:r.tid)!=null?i:""),le.uploadLog();return}catch(r){throw this.slsReporter.reportLeave(new Date().getTime()-t,r.code,r.reason),r}else{yield this.resetState(),this.slsReporter.reportLeave(0,0,"");return}})}isInCall(){return this.connectState===Ne.AliRtcConnectionStatusConnected}refreshAuthInfo(e){return H(this,null,function*(){const{userId:t,nonce:i,timestamp:r,token:n,role:o}=e,a={userId:t,nonce:i,timestamp:r,token:n,role:o};try{yield this.signalingManager.refreshAuthInfo(a),this.bizControl.refreshAuthInfo(a),this.liveTranscoding.refreshAuthInfo(a),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 H(this,null,function*(){var t,i,r;(t=this.publisher)==null||t.setPublishLocalAudioStreamEnabled(e),this.connectState===Ne.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasMicrophone?yield(r=this.publisher)==null?void 0:r.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 ce(de.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 H(this,null,function*(){var t,i,r;(t=this.publisher)==null||t.setPublishLocalVideoStreamEnabled(e),this.connectState===Ne.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasCamera?yield(r=this.publisher)==null?void 0:r.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){[rt.AliRtcVideoStreamTypeHigh,rt.AliRtcVideoStreamTypeLow].includes(e)&&this.bizControl.setRemoteDefaultVideoStreamType(e)}setRemoteUserVideoStreamType(e,t){[rt.AliRtcVideoStreamTypeHigh,rt.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,i,r){const n=this.bizControl.getRemoteUser(e);if(!n)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i&&(t===ke.AliRtcVideoTrackScreen||t===ke.AliRtcVideoTrackBoth)?n.setWantSubScreen(!0):n.setWantSubScreen(!1),i&&(t===ke.AliRtcVideoTrackCamera||t===ke.AliRtcVideoTrackBoth)?n.setWantSubVideo(!0):n.setWantSubVideo(!1),n.setWantSubAudio(r),n.updateSubscribe(Ve.User)}resumeRemoteMediaStream(e,t){const i=this.bizControl.getRemoteUser(e);i&&i.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 H(this,null,function*(){var o;const t={video:!1,audio:!1},{audio:i=!1,videoTrack:r,audioTrack:n}=e||{};if(r||n){t.screen=!0;const a=new MediaStream;r&&a.addTrack(r),n&&a.addTrack(n),t.mediaStream=a}else t.screen=i?{audio:!0}:!0;yield(o=this.publisher)==null?void 0:o.createLocalStream(t)})}stopScreenShare(){return H(this,null,function*(){var e;(e=this.publisher)==null||e.stopLocalStream({screen:!0})})}setScreenShareConfiguration(e){return H(this,null,function*(){var r;const{frameRate:t=sr.frameRate,bitrate:i=sr.maxBitrate}=e;yield(r=this.publisher)==null?void 0:r.setScreenProfile(Wo,{width:sr.width,height:sr.height,frameRate:t,maxBitrate:i})})}setScreenShareContentHint(e){return H(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setScreenContentHint(e))})}publishLocalScreenShareStream(e,t){return H(this,null,function*(){var i,r,n;(i=this.publisher)==null||i.setPublishLocalScreenStreamEnabled(e),this.connectState===Ne.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.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 ce(de.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?Me.MuteAudio:Me.UnmuteAudio),(t=this.publisher)==null||t.muteLocalMic(e)}muteRemoteAudioPlaying(e,t=!1){const i=this.bizControl.getRemoteUser(e);if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);i.setAudioMuted(t)}muteAllRemoteAudioPlaying(e=!1){this.bizControl.setAudioMuted(e)}startAudioCapture(e){return H(this,null,function*(){var i;const t={audio:e||!0};yield(i=this.publisher)==null?void 0:i.createLocalStream(t)})}stopAudioCapture(){var e;(e=this.publisher)==null||e.stopAudioCapture()}switchMicrophone(e,t){return H(this,null,function*(){var i,r,n,o;if(yield(i=this.publisher)==null?void 0:i.setMicrophoneDeviceId(e),!((r=this.publisher)!=null&&r.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 ce(de.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 ce(de.ERR_INVALID_ARGUMENTS,"volume must be a number");this.bizControl.setPlayoutVolume(Math.max(0,Math.min(e,100))/100)}setRemoteAudioVolume(e,t){const i=this.bizControl.getRemoteUser(e);if(!i)throw new ce(de.ERR_INNER,`no remote user(${e}) founded`);if(typeof t!="number")throw new ce(de.ERR_INVALID_ARGUMENTS,"volume must be a number");i.setPlayoutVolume(Math.max(0,Math.min(t,100))/100)}setAudioProfile(e){return H(this,null,function*(){var t;yield(t=this.publisher)==null?void 0:t.setAudioProfile(e)})}getAudioTrack(e){return H(this,null,function*(){var i;if(!e)return(i=this.publisher)==null?void 0:i.audioTrack;const t=this.bizControl.getRemoteUser(e);return t==null?void 0:t.getAudioTrack})}setLocalViewConfig(e,t){return H(this,null,function*(){var i,r,n;if(this._audioOnlyMode)throw new ce(de.ERR_INNER,"Cannot set local view in audio only mode");(i=this.bizControl)==null||i.setLocalViewConfig(e,t),t===ke.AliRtcVideoTrackCamera&&((r=this.publisher)!=null&&r.hasCamera)?yield this.startPreview():t===ke.AliRtcVideoTrackScreen&&((n=this.publisher)!=null&&n.hasScreenShare)&&(yield this.startPreviewScreen())})}setCameraCapturerConfiguration(e){return H(this,null,function*(){var u,h,g;const{width:t=rr.width,height:i=rr.height,frameRate:r=rr.frameRate,bitrate:n=rr.maxBitrate,cameraDirection:o,deviceId:a}=e;yield(u=this.publisher)==null?void 0:u.setVideoProfile(jo,{width:t,height:i,frameRate:r,maxBitrate:n}),o!==void 0&&((h=this.publisher)==null||h.setCameraDirection(o)),a&&((g=this.publisher)==null||g.setCameraDeviceId(a))})}setCameraCapturerContentHint(e){return H(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setVideoContentHint(e))})}enableLocalVideo(e=!0){return H(this,null,function*(){var t,i,r,n,o,a,u,h,g,f,d;if(this._audioOnlyMode)throw new ce(de.ERR_INNER,"Cannot enable local video in audio only mode");if(e){(i=(t=this.publisher)==null?void 0:t.publishStreams)!=null&&i.video&&((o=(n=(r=this.publisher)==null?void 0:r.publishStreams)==null?void 0:n.video)==null||o.disableVideo(),(g=(h=(u=(a=this.publisher)==null?void 0:a.publishStreams)==null?void 0:u.video)==null?void 0:h.videoTrack)==null||g.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 H(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Me.MuteVideo:Me.UnmuteVideo),(t=this.publisher)==null||t.muteLocalCamera(e)})}muteLocalScreen(e){return H(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Me.MuteScreen:Me.UnmuteScreen),(t=this.publisher)==null||t.muteLocalScreen(e)})}setRemoteViewConfig(e,t,i){this.bizControl.setRemoteViewConfig(t,e,i)}isCameraOn(){var e,t;return(t=(e=this.publisher)==null?void 0:e.hasCamera)!=null?t:!1}switchCamera(e,t){return H(this,null,function*(){var r,n,o,a,u,h,g,f,d,p,l,m,x;if(this._audioOnlyMode)throw new ce(de.ERR_INNER,"Cannot switch camera in audio only mode");const i={};if(e?(i.deviceId=e,this.slsReporter.reportSwitchCamera(e)):(i.cameraDirection=((r=this.publisher)==null?void 0:r.cameraDirection)==="environment"?ir.CAMERA_FRONT:ir.CAMERA_REAR,this.slsReporter.reportSwitchCamera(((n=this.publisher)==null?void 0:n.cameraDirection)||"")),yield this.setCameraCapturerConfiguration(i),!((o=this.publisher)!=null&&o.cameraCaptureDisabled)){(u=(a=this.publisher)==null?void 0:a.publishStreams)!=null&&u.video&&((f=(g=(h=this.publisher)==null?void 0:h.publishStreams)==null?void 0:g.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 v={video:!0};t&&(v.mediaStream=new MediaStream([t])),yield(x=this.publisher)==null?void 0:x.createLocalStream(v)}})}getCurrentCameraDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentCameraDeviceId()}startPreview(){return H(this,null,function*(){var e,t;if(this._audioOnlyMode)throw new ce(de.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 H(this,null,function*(){var t,i;if(this._audioOnlyMode)throw new ce(de.ERR_INNER,"Cannot start preview screen share in audio only mode");(t=this.publisher)!=null&&t.hasScreenShare||(yield this.startScreenShare(e)),yield(i=this.publisher)==null?void 0:i.previewAll({primary:!1})})}stopPreview(){return H(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!0,screen:!1})})}stopPreviewScreen(){return H(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!1,screen:!0})})}getVideoTrack(e){return H(this,null,function*(){var n,o,a,u;const{userId:t,streamType:i}=e;if(!t)return i===Qe.AliRtcSdkStreamTypeCapture?(n=this.publisher)==null?void 0:n.cameraTrack:(o=this.publisher)==null?void 0:o.screenTrack;const r=this.bizControl.getRemoteUser(t);return i===Qe.AliRtcSdkStreamTypeCapture?(a=r==null?void 0:r.getCameraStream)==null?void 0:a.videoTrack:(u=r==null?void 0:r.getScreenStream)==null?void 0:u.videoTrack})}startPublishLiveStream(e,t){return H(this,null,function*(){return this.liveTranscoding.startPublishLiveStream(e,t)})}updatePublishLiveStream(e,t){return H(this,null,function*(){return this.liveTranscoding.updatePublishLiveStream(e,t)})}updatePublishLiveStreamWithTaskId(e,t){return this.liveTranscoding.updatePublishLiveStreamWithTaskId(e,t)}stopPublishLiveStream(e){return H(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 H(this,null,function*(){return this.sendMediaExtensionMsgEx(e,t,5)})}sendMediaExtensionMsgEx(e,t,i){return H(this,null,function*(){var r;if(!this.publisher||!this.isPublishing)throw new ce(de.ERR_INNER,"you should publish first");return this.slsReporter.reportSEIMessage(i,e.byteLength,t,0,!1),(r=this.publisher)==null?void 0:r.sendSEI(e,t,i)})}enablePlugin(e,t){this.bizControl.pluginManager.add(e,t)}removePlugin(e){this.bizControl.pluginManager.remove(e)}setPluginOption(e,t){const i=this.bizControl.pluginManager.get(e);i&&t&&i.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 ce(oi.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");return!!(e!=null&&e.isEnable)}setBeautyEffect(e,t){const i=this.bizControl.pluginManager.get("AliRtcBeauty");if(!i)throw new ce(oi.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");e?i.enable():i.disable(),i.setOptions({basicBeauty:{skinBuffing:Math.max(Math.min(1,+t.smoothnessLevel),0),whitening:Math.max(Math.min(1,+t.whiteningLevel),0)}})}enableBackgroundExchange(e,t){const i=this.bizControl.pluginManager.get("AliRtcBeauty");if(!i||!i.isEnable)throw new ce(oi.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const r={setSegmentBackgroundImage:{backgroundImgUrl:e?t:""}};e&&(r.segmentBackgroundProcess={enable:!1}),i.setOptions(r)}enableBackgroundBlur(e){const t=this.bizControl.pluginManager.get("AliRtcBeauty");if(!t||!t.isEnable)throw new ce(oi.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const i={segmentBackgroundProcess:{type:0,enable:e}};e&&(i.setSegmentBackgroundImage={type:0,backgroundImgUrl:""}),t.setOptions(i)}},A(xe,"logName","AliRtcEngine"),A(xe,"logError",!0),A(xe,"isSupported",Du),A(xe,"isDualVideoStreamSupported",Ln.isSupport),A(xe,"getCameraList",()=>H(xe,null,function*(){return(yield ye.AliRTS.getCameraList()).filter(t=>t.deviceId)})),A(xe,"getMicrophoneList",()=>H(xe,null,function*(){return(yield ye.AliRTS.getMicList()).filter(t=>t.deviceId)})),A(xe,"getSpeakerList",()=>H(xe,null,function*(){return(yield ye.AliRTS.getSpeakerList()).filter(t=>t.deviceId)})),A(xe,"_instance"),A(xe,"AliRtcSdkChannelProfile",Xt),A(xe,"AliRtcSdkClientRole",ni),A(xe,"AliRtcVideoStreamType",rt),A(xe,"AliRtcVideoTrack",ke),A(xe,"AliRtcAudioTrack",Vi),A(xe,"AliRtcPublishState",Ee),A(xe,"AliRtcSubscribeState",He),A(xe,"AliRtcRawDataStreamType",Qe),A(xe,"AliRtcLogLevel",mn),A(xe,"AliRtcEngineLocalDeviceType",jt),A(xe,"AliRtcEngineLocalDeviceExceptionType",$e),A(xe,"AliRtcConnectionStatus",Ne),A(xe,"AliRtcConnectionStatusChangeReason",yi),A(xe,"AliRtcPlugin",Fi),A(xe,"AliRtcPluginTrackType",Dr),A(xe,"AliRtcLiveTranscodingParam",Lr),A(xe,"AliRtcLiveTranscodingEncodeParam",_n),A(xe,"AliRtcLiveTranscodingMixParam",tc),A(xe,"AliRtcLiveTranscodingSingleParam",ic),A(xe,"AliRtcTranscodingClockWidget",rc),A(xe,"AliRtcTranscodingImage",Nn),A(xe,"AliRtcTranscodingText",nc),A(xe,"AliRtcTranscodingUser",ac),A(xe,"AliRtcLiveTranscodingMixMode",Yi),A(xe,"AliRtcLiveTranscodingStreamType",gn),A(xe,"AliRtcLiveTranscodingSourceType",Oi),A(xe,"AliRtcLiveTranscodingTaskProfile",vn),A(xe,"AliRtcLiveTranscodingAudioSampleRate",Br),A(xe,"AliRtcLiveTranscodingSegmentType",er),A(xe,"AliRtcLiveTranscodingFontType",tr),A(xe,"AliRtcLiveTranscodingCropMode",xn),A(xe,"AliRtcLiveTranscodingMediaProcessMode",Pr),A(xe,"AliRtcLiveTranscodingState",bn),A(xe,"AliRtcLiveTranscodingErrorCode",zt),A(xe,"AliRtcTrascodingPublishTaskStatus",Sn),A(xe,"Plugin",Fi),xe);ve([j()],me.prototype,"destroy",1),ve([j()],me.prototype,"resetState",1),ve([j(ue)],me.prototype,"stopPublish",1),ve([j()],me.prototype,"backToUnpublishStatus",1),ve([j()],me.prototype,"resumePublishForNetworkRecovery",1),ve([j()],me.prototype,"onNetworkRecovery",1),ve([j()],me.prototype,"resumeSubList",1),ve([j(ue)],me.prototype,"setEnableDualVideoStream",1),ve([j(ue)],me.prototype,"setChannelProfile",1),ve([j(ue)],me.prototype,"setClientRole",1),ve([j(ue)],me.prototype,"setAudioOnlyMode",1),ve([j()],me.prototype,"clearCheckAuthInfoTimer",1),ve([j(ue)],me.prototype,"joinChannel",1),ve([j(ue)],me.prototype,"leaveChannel",1),ve([j(ue)],me.prototype,"refreshAuthInfo",1),ve([j(ue)],me.prototype,"publishLocalAudioStream",1),ve([j(ue)],me.prototype,"setDefaultSubscribeAllRemoteAudioStreams",1),ve([j(ue)],me.prototype,"subscribeAllRemoteAudioStreams",1),ve([j(ue)],me.prototype,"subscribeRemoteAudioStream",1),ve([j(ue)],me.prototype,"resumeRemoteAudioStream",1),ve([j(ue)],me.prototype,"publishLocalVideoStream",1),ve([j(ue)],me.prototype,"setRemoteDefaultVideoStreamType",1),ve([j(ue)],me.prototype,"setRemoteUserVideoStreamType",1),ve([j(ue)],me.prototype,"setDefaultSubscribeAllRemoteVideoStreams",1),ve([j(ue)],me.prototype,"subscribeAllRemoteVideoStreams",1),ve([j(ue)],me.prototype,"subscribeRemoteMediaStream",1),ve([j(ue)],me.prototype,"resumeRemoteMediaStream",1),ve([j(([s])=>[`${s==null?void 0:s.audio}`])],me.prototype,"startScreenShare",1),ve([j()],me.prototype,"stopScreenShare",1),ve([j(ue)],me.prototype,"setScreenShareConfiguration",1),ve([j(ue)],me.prototype,"setScreenShareContentHint",1),ve([j()],me.prototype,"publishLocalScreenShareStream",1),ve([j(ue)],me.prototype,"setAudioShareVolume",1),ve([j(ue)],me.prototype,"enableAudioVolumeIndication",1),ve([j(ue)],me.prototype,"muteLocalMic",1),ve([j(ue)],me.prototype,"muteRemoteAudioPlaying",1),ve([j(ue)],me.prototype,"muteAllRemoteAudioPlaying",1),ve([j(ue)],me.prototype,"startAudioCapture",1),ve([j()],me.prototype,"stopAudioCapture",1),ve([j(ue)],me.prototype,"switchMicrophone",1),ve([j(ue)],me.prototype,"setRecordingVolume",1),ve([j(ue)],me.prototype,"setPlayoutVolume",1),ve([j(ue)],me.prototype,"setRemoteAudioVolume",1),ve([j(ue)],me.prototype,"setAudioProfile",1),ve([j(ue)],me.prototype,"getAudioTrack",1),ve([j(ue)],me.prototype,"setLocalViewConfig",1),ve([j(ue)],me.prototype,"setCameraCapturerConfiguration",1),ve([j(ue)],me.prototype,"setCameraCapturerContentHint",1),ve([j(ue)],me.prototype,"enableLocalVideo",1),ve([j(ue)],me.prototype,"muteLocalCamera",1),ve([j(ue)],me.prototype,"muteLocalScreen",1),ve([j(ue)],me.prototype,"setRemoteViewConfig",1),ve([j(ue)],me.prototype,"switchCamera",1),ve([j()],me.prototype,"startPreview",1),ve([j()],me.prototype,"startPreviewScreen",1),ve([j()],me.prototype,"stopPreview",1),ve([j()],me.prototype,"stopPreviewScreen",1),ve([j()],me.prototype,"startPublishLiveStream",1),ve([j()],me.prototype,"updatePublishLiveStream",1),ve([j()],me.prototype,"updatePublishLiveStreamWithTaskId",1),ve([j()],me.prototype,"stopPublishLiveStream",1),ve([j()],me.prototype,"stopPublishLiveStreamWithTaskId",1),ve([j(ue)],me.prototype,"setEnableMediaExtensionMsg",1),ve([j(([s,c,e])=>[s.byteLength,c,e])],me.prototype,"sendMediaExtensionMsgEx",1),ve([j(([s,c])=>[s.name||"",c])],me.prototype,"enablePlugin",1),ve([j(ue)],me.prototype,"removePlugin",1),ve([j(ue)],me.prototype,"setPluginOption",1),ve([j(ue)],me.prototype,"getPluginOption",1),ve([j(ue)],me.prototype,"setBeautyEffect",1),ve([j(ue)],me.prototype,"enableBackgroundExchange",1),ve([j(ue)],me.prototype,"enableBackgroundBlur",1),ve([j(ue)],me,"setLogLevel",1);let oc=me;const cc=new is({businessName:"imp-web-rtc",version:(mc=oc.getSdkVersion())!=null?mc:"unknown",env:"prod"});cc.setReady();const Dh=cc.wrap(oc);fe.AliRtcConnectionStatus=Ne,fe.AliRtcConnectionStatusChangeReason=yi,fe.AliRtcEngineLocalDeviceExceptionType=$e,fe.AliRtcEngineLocalDeviceType=jt,fe.AliRtcErrorCode=de,fe.AliRtcLiveTranscodingAudioSampleRate=Br,fe.AliRtcLiveTranscodingCropMode=xn,fe.AliRtcLiveTranscodingEncodeParam=_n,fe.AliRtcLiveTranscodingErrorCode=zt,fe.AliRtcLiveTranscodingFontType=tr,fe.AliRtcLiveTranscodingMediaProcessMode=Pr,fe.AliRtcLiveTranscodingMixMode=Yi,fe.AliRtcLiveTranscodingMixParam=tc,fe.AliRtcLiveTranscodingParam=Lr,fe.AliRtcLiveTranscodingSegmentType=er,fe.AliRtcLiveTranscodingSingleParam=ic,fe.AliRtcLiveTranscodingSourceType=Oi,fe.AliRtcLiveTranscodingState=bn,fe.AliRtcLiveTranscodingStreamType=gn,fe.AliRtcLiveTranscodingTaskProfile=vn,fe.AliRtcLocalStreamInfo=Dn,fe.AliRtcLogLevel=mn,fe.AliRtcPlugin=Fi,fe.AliRtcPluginTrackType=Dr,fe.AliRtcPluginType=Oo,fe.AliRtcPublishState=Ee,fe.AliRtcRawDataStreamType=Qe,fe.AliRtcRemoteUserInfo=Xo,fe.AliRtcSdkChannelProfile=Xt,fe.AliRtcSdkClientRole=ni,fe.AliRtcSubscribeState=He,fe.AliRtcTranscodingClockWidget=rc,fe.AliRtcTranscodingImage=Nn,fe.AliRtcTranscodingText=nc,fe.AliRtcTranscodingUser=ac,fe.AliRtcTrascodingPublishTaskStatus=Sn,fe.AliRtcVideoStreamType=rt,fe.AliRtcVideoTrack=ke,fe.default=Dh,Object.defineProperties(fe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|