aliyun-rtc-sdk 6.11.5 → 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.
@@ -1,17 +1,41 @@
1
- var zc=Object.defineProperty,Xc=Object.defineProperties;var Yc=Object.getOwnPropertyDescriptors;var Ci=Object.getOwnPropertySymbols,Qc=Object.getPrototypeOf,pa=Object.prototype.hasOwnProperty,ga=Object.prototype.propertyIsEnumerable,Zc=Reflect.get;var Tr=(A,V,D)=>V in A?zc(A,V,{enumerable:!0,configurable:!0,writable:!0,value:D}):A[V]=D,q=(A,V)=>{for(var D in V||(V={}))pa.call(V,D)&&Tr(A,D,V[D]);if(Ci)for(var D of Ci(V))ga.call(V,D)&&Tr(A,D,V[D]);return A},Lt=(A,V)=>Xc(A,Yc(V));var fa=(A,V)=>{var D={};for(var Q in A)pa.call(A,Q)&&V.indexOf(Q)<0&&(D[Q]=A[Q]);if(A!=null&&Ci)for(var Q of Ci(A))V.indexOf(Q)<0&&ga.call(A,Q)&&(D[Q]=A[Q]);return D};var l=(A,V,D)=>(Tr(A,typeof V!="symbol"?V+"":V,D),D);var Pr=(A,V,D)=>Zc(Qc(A),D,V);var v=(A,V,D)=>new Promise((Q,ii)=>{var Mi=Xe=>{try{je(D.next(Xe))}catch(Rt){ii(Rt)}},Ni=Xe=>{try{je(D.throw(Xe))}catch(Rt){ii(Rt)}},je=Xe=>Xe.done?Q(Xe.value):Promise.resolve(Xe.value).then(Mi,Ni);je((D=D.apply(A,V)).next())});(function(A,V){typeof exports=="object"&&typeof module!="undefined"?V(exports,require("aliyun-rts-sdk"),require("useragent-util"),require("eventemitter3"),require("browser-log-reporter")):typeof define=="function"&&define.amd?define(["exports","aliyun-rts-sdk","useragent-util","eventemitter3","browser-log-reporter"],V):(A=typeof globalThis!="undefined"?globalThis:A||self,V(A.AliRtcEngine={},A.AliyunRts,A.UserAgentUtil,A.EventEmitter,A.BrowserLogReporter))})(this,function(A,V,D,Q,ii){var Ee,ct,Ce,Ct,L,ua;"use strict";var Mi=Object.defineProperty,Ni=(t,r,e)=>r in t?Mi(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,je=(t,r,e)=>(Ni(t,typeof r!="symbol"?r+"":r,e),e);function Xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Rt={exports:{}},kr={exports:{}};Date.now=Date.now||function(){return new Date().getTime()};var ma=Date.now(),Li=function(){},Sa=function(){var t=typeof console=="object"?console.warn:Li;try{var r={warn:t};r.warn.call(r)}catch(e){return Li}return t},ba={noop:Li,warn:Sa(),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(t){if(Object.create)return Object.create(t);var r=function(){};return r.prototype=t,new r},each:function(t,r){var e=0,i=t.length;if(this.T(t,"Array"))for(;e<i&&r.call(t[e],t[e],e)!==!1;e++);else for(e in t)if(r.call(t[e],t[e],e)===!1)break;return t},safetyCall:function(t,r,e){if(typeof t!="function")return e;try{return t.apply(this,r)}catch(i){return e}},T:function(t,r){var e=Object.prototype.toString.call(t).substring(8).replace("]","");return r?e===r:e},duration:function(){var t=Date;try{performance&&this.T(performance.now,"Function")&&(t=performance)}catch(e){t=Date}var r=t.now();return function(){return Math.round(t.now()-r)}},filterByRule:function(){var t=[].slice.call(arguments),r=t.length;if(r<2)return t[0];var e=t[r-1],i=t[0];if(!i)return"";if(!e)return i;var s=this,a=s.T(e),n=t.slice(0,r-1);return a==="Function"?s.safetyCall(e,n,i):a==="Array"?(this.each(e,function(o){n[0]=i=s.filterByRule.apply(s,[].concat(n,o))}),i):a==="Object"?i.replace(e.rule,e.target||""):i.replace(e,"")},ignoreByRule:function(t,r){if(!t||!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 e,i=[],s=0,a=r.length;s<a;s++)if(e=r[s],this.isString(e))i.push(e.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"));else if(e&&e.source)i.push(e.source);else if(e&&this.T(e)==="Function"&&this.safetyCall(e,[t],!1)===!0)return!0;var n=new RegExp(i.join("|"),"i");return!!(i.length&&n.test&&n.test(t))},J:function(t){if(!t||typeof t!="string")return t;var r=null;try{r=JSON.parse(t)}catch(e){}return r},pick:function(t){return t===1||Math.ceil(Math.random()*t)===1},verifyConfig:function(t){if("sample"in t){var r=t.sample,e=r;r&&/^\d+(\.\d+)?%$/.test(r)&&(e=parseInt(100/parseFloat(r))),0<e&&1>e&&(e=parseInt(1/e)),e>=1&&e<=100?t.sample=e:delete t.sample}return t},on:function(t,r,e,i,s){return t.addEventListener?(s=s||!1,t.addEventListener(r,function a(n){i&&t.removeEventListener(r,a,s),e.call(this,n)},s)):t.attachEvent&&t.attachEvent("on"+r,function a(n){i&&t.detachEvent("on"+r,a),e.call(this,n)}),this},off:function(t,r,e){return e?(t.removeEventListener?t.removeEventListener(r,e):t.detachEvent&&t.detachEvent(r,e),this):this},delay:function(t,r){return r===-1?(t(),null):setTimeout(t,r||0)},ext:function(t){for(var r=1,e=arguments.length;r<e;r++){var i=arguments[r];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},sub:function(t,r){var e={};return this.each(t,function(i,s){r.indexOf(s)!==-1&&(e[s]=i)}),e},uu:function(){for(var t,r,e=20,i=new Array(e),s=Date.now().toString(36).split("");e-- >0;)r=(t=36*Math.random()|0).toString(36),i[e]=t%3?r:r.toUpperCase();for(var a=0;a<8;a++)i.splice(3*a+2,0,s[a]);return i.join("")},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=16*Math.random()|0;return(t==="x"?r:3&r|8).toString(16)})},seq:function(){return(ma++).toString(36)},decode:function(t){try{t=decodeURIComponent(t)}catch(r){}return t},encode:function(t,r){try{t=r?encodeURIComponent(t).replace(/\(/g,"%28").replace(/\)/g,"%29"):encodeURIComponent(t)}catch(e){}return t},serialize:function(t){t=t||{};var r=[];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==void 0&&r.push(e+"="+this.encode(t[e],e==="msg"));return r.join("&")},checkAPI:function(t,r){if(!t||typeof t!="string")return!1;var e=/arms-retcode[\w-]*\.aliyuncs/.test(t);return!e&&r&&(e=/(alicdn\.com)|(mmstat\.com)/.test(t)),!e},checkAutoError:function(t){return!(!t||!t.message)&&!/failed[\w\s]+fetch/i.test(t.message)},cutUrlSearch:function(t){return t&&typeof t=="string"?t.replace(/^(https?:)?\/\//,"").replace(/\?.*$/,""):""},removeUrlSearch:function(t){return t&&typeof t=="string"?t.replace(/\?.*$/,""):""},createFakeToString:function(t){return function(){return t+"() { [native code] }"}},checkSameOrigin:function(t,r){if(!r||!t)return!1;var e="//"+r.split("/")[2];return t===r||t.slice(0,r.length+1)===r+"/"||t===e||t.slice(0,e.length+1)===e+"/"||!/^(\/\/|http:|https:).*/.test(t)},getRandIP:function(){for(var t=[],r=0;r<4;r++){var e=Math.floor(256*Math.random());t[r]=(e>15?"":"0")+e.toString(16)}return t.join("").replace(/^0/,"1")},getSortNum:function(t){return t?(t+=1)>=1e3&&t<=9999?t:t<1e3?t+1e3:t%1e4+1e3:1e3},getRandNum:function(t){return t&&typeof t=="string"?t.length<5?this.getNum(5):t.substring(t.length-5):this.getNum(5)},getNum:function(t){for(var r=[],e=0;e<t;e++){var i=Math.floor(16*Math.random());r[e]=i.toString(16)}return r.join("")},getCurDomain:function(){return location&&location.hostname||""},getSrcType:function(t,r){var e=location&&location.host||"";if(!e)return"";var i=new URL(t).host;if(i===e)return"self";for(var s=0;s<r.length;s+=1)if(i.includes(r[s]))return"cdn";return"others"},parseFetchHeaders:function(t){if(!t)return{};var r={};try{if(typeof t.keys=="function")for(var e=t.keys(),i=e.next();!i.done;){var s=i.value;r[s]=t.get(s),i=e.next()}else r=t}catch(a){r={}}return r},parseXhrHeaders:function(t){if(!t&&typeof t!="string")return{};var r={};try{var e=t.split(`\r
2
- `);r=e.reduce(function(i,s){var a=s.split(": ");return i[a[0]]=a[1],i},{})}catch(i){r={}}return r},getQuerys:function(t){if(!t)return"";var r={},e=[],i="",s="";try{var a=[];if(t.indexOf("?")>=0&&(a=t.substring(t.indexOf("?")+1,t.length).split("&")),a.length>0)for(var n in a)i=(e=a[n].split("="))[0],s=e[1],r[i]=s}catch(o){r={}}return r},getURL:function(t){if(!t)return null;var r={},e=t.length,i=t.indexOf("://");if(i<0)return null;r.protocol=t.substring(0,i+1);var s=t.indexOf("#"),a=t.indexOf("?");s<0&&(s=e),a<0&&(a=s),r.search=t.substring(a,s).substring(0,1e3);var n=t.substring(i+3,a),o=n.indexOf("/");return o<0&&(o=n.length),r.domain=n.substring(0,o).split(":")[0],r.path=n.substring(o,n.length).substring(0,1e3),r},getResType:function(t,r){if(["script","img","other"].indexOf(t)>-1)return t;if(["video"].indexOf(t)>-1)return"media";if(["document","iframe"].indexOf(t)>-1)return"doc";var e=r?this.getURL(r):null,i=e&&e.path?e.path.lastIndexOf("."):-1,s=(i>0?e.path.substr(i+1):"").toLowerCase();if(s){if(["eot","woff","woff2","ttf"].indexOf(s)>-1)return"font";if(s==="css")return"css";if(s==="js")return"script"}return["fetch","xmlhttprequest","beacon"].indexOf(t)>-1?"api":"others"},areInOrder:function(){for(var t=1;t<arguments.length;t+=1)if(arguments[t-1]>arguments[t])return!1;return!0},getFetchSnapshot:function(t,r,e){var i,s;try{var a=(t&&typeof t[0]!="string"?t[0].url:t[0])||"",n=(t&&typeof t[0]!="string"?t[0]:t[1])||{},o=n.method.toUpperCase()==="POST"?n.body:this.getQuerys(a);i={originApi:a,method:n.method||"unknown",params:o,response:r||"",reqHeaders:this.parseFetchHeaders(n.headers||null),resHeaders:this.parseFetchHeaders(e)},s=JSON&&JSON.stringify(i)||"{}"}catch(c){s="{}"}return s},getXhrSnapshot:function(t,r,e){if(!t||!r||!e)return{};var i,s;try{var a="";e.responseType===""||e.responseType==="text"?a=e.responseText:e.responseType==="document"&&(a=e.responseXML),i={originApi:t,method:r,params:this.getQuerys(t),response:a,reqHeaders:{},resHeaders:this.parseXhrHeaders(typeof e.getAllResponseHeaders=="function"&&e.getAllResponseHeaders()||"")},s=JSON&&JSON.stringify(i)||"{}"}catch(n){s="{}"}return s},isRobot:function(){var t=["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(),e=0;e<t.length;e++){var i=t[e];if(r.lastIndexOf(i)>=0)return!0}}catch(s){this.warn("[arms] useragent parse error")}return!1},isFunction:function(t){return typeof t=="function"},isPlainObject:function(t){return Object.prototype.toString.call(t)==="[object Object]"},isString:function(t){return Object.prototype.toString.call(t)==="[object String]"},isArray:function(t){return Object.prototype.toString.call(t)==="[object Array]"},joinRegExp:function(t){for(var r,e=[],i=0,s=t.length;i<s;i++)r=t[i],this.isString(r)?e.push(r.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):r&&r.source&&e.push(r.source);return new RegExp(e.join("|"),"i")},reWriteMethod:function(t,r,e){if(t!==null){var i=t[r];t[r]=e(i)}},checkSDKError:function(t,r){return!t&&!r?!1:new RegExp(this.selfErrKey,"i").test(t)?!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(t){return{msg:t,message:this.selfErrKey}},dealParam:function(t,r,e){var i={};try{i=this.isPlainObject(t)?this.ext({key:t.key||"default",val:t.val||t.value||e},t,{begin:Date.now()}):{key:t||"default",val:r||e,begin:Date.now()}}catch(s){this.warn("[retcode] baseLog error: "+s)}return i}},ye=ba,Cr={exports:{}},Mr={exports:{}},Nr=ye,va=function(t,r,e){typeof t=="object"&&(t=Nr.serialize(t));var i=r+t+(e?"&post_res=":"");window&&window.navigator&&typeof window.navigator.sendBeacon=="function"?window.navigator.sendBeacon(i,e||"&post_res="):Nr.warn("[arms] navigator.sendBeacon not surported")},H=ye,ya=va,Lr="aokcdqn3ly@e629dabd48a9933",Or=function(t,r){var e;if(r.t==="error"&&(e=t.requestQueue[0])&&e.t==="error"&&r.msg===e.msg)return r.times=e.times+1,void(t.requestQueue[0]=r);if(r.t==="behavior"){var i=t.requestQueue&&t.requestQueue.length;if(i>0&&t.requestQueue[i-1].t==="behavior"){var s=r.behavior||[];t.requestQueue[i-1].behavior.concat(s)}else t.requestQueue.push(r)}else t.requestQueue.unshift(r);return t.onReady(function(){t.requestTimmer=H.delay(function(){t.clear()},t.requestQueue[0]&&t.requestQueue[0].t==="error"?3e3:-1)}),!0},Ot=function(t){return this.ver="1.8.36-beta.12",this._conf=H.ext({},Ot.dftCon),this.sampleCache={},this.requestQueue=[],this.selfQueue=[],this.sdkFlag=!0,this.hash=H.seq(),this.resetPageview(),this.setConfig(t),this.rip=H.getRandIP(),this.record=999,this["EagleEye-TraceID"]=this.getTraceId()["EagleEye-TraceID"],this._common={},this};Ot.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},Ot.prototype={constructor:Ot,onReady:function(t){return t()},getPage:function(){var t=this._conf.page;return H.safetyCall(t,[],t+"")},setPage:function(){},setConfig:function(t){t&&typeof t=="object"&&(H.verifyConfig(t),t=this.setImgUrl(t),this._conf=H.ext({},this._conf,t))},setImgUrl:function(t){var r=t.region,e=t.imgUrl;if(r){var i=H.regionMap[r];return t.imgUrl=i||H.defaultImgUrl,t}return e&&(t.imgUrl=e),t},checkImgUrl:function(){return!0},sendRequest:function(){},sendBeacon:function(t,r,e){ya(t,r||this.getConfig("imgUrl"),e)},postData:function(){},commonInfo:function(){return{}},setCommonInfo:function(t){t&&typeof t=="object"&&(this._common=H.ext({},this._common,t))},resetPageview:function(){this.pageview=H.uu(),this.sBegin=Date.now()},getUsername:function(){if(this.username)return this.username;var t=this._conf,r=t&&t.setUsername;if(typeof r=="function")try{var e=r();typeof e=="string"&&(e=e.substr(0,40),this.username=e)}catch(i){H.warn("[arms] setUsername fail",i)}return this.username},getTraceId:function(){var t=this.rip,r=Date.now(),e=H.getSortNum(this.record),i=t+r+e+H.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=i,this.record=e,{"EagleEye-TraceID":i}},getUberTraceId:function(t){var r=this.rip,e=Date.now(),i=H.getSortNum(this.record),s=H.getRandNum(this._conf.pid),a=r+e+i+H.getNum(2)+s,n=a.substring(0,16);return t=t?"1":"0",a[0]==="0"&&(a[0]="1"),a[16]==="0"&&(a[16]="1"),{"uber-trace-id":a+":"+n+":0:"+t,traceId:a}},getB3TraceId:function(t){var r=this.rip,e=Date.now(),i=H.getSortNum(this.record),s=H.getRandNum(this._conf.pid),a=r+e+i+H.getNum(2)+s,n=a.substring(0,16);return t=t?"1":"0",a[0]==="0"&&(a[0]="1"),a[16]==="0"&&(a[16]="1"),{b3:a+"-"+n+"-"+t+"-0","X-B3-TraceId":a,"X-B3-ParentSpanId":"0","X-B3-SpanId":n,"X-B3-Sampled":t}},getPageviewId:function(){return{"EagleEye-SessionID":this.pageview}},getConfig:function(t){return t?this._conf[t]:H.ext({},this._conf)},sampling:function(t){return t===1||(typeof this.sampleCache[t]=="boolean"?this.sampleCache[t]:(this.sampleCache[t]=H.pick(t),this.sampleCache[t]))},clear:function(t){var r;clearTimeout(this.requestTimmer),this.requestTimmer=null;for(var e=this._conf&&typeof this._conf.sendRequest=="function";r=this.requestQueue.pop();)if(r.t==="res")this.postData(r,"res");else if(r.t==="error")this.postData(r,"err");else if(r.t==="api")this.postData(r,"apiSnapshot");else if(r.t==="behavior")this.postData(r,"behavior");else if(r.t==="health"&&!e&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function")this.sendBeacon(r);else if(r.t==="resource"&&!e&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function"){var i=JSON.stringify({resource:r.resource});delete r.resource,this.sendBeacon(r,null,i)}else r.t==="resource"?this.postData(r,"resource"):this.sendRequest(r);return t&&this.clearSelf(),this},clearSelf:function(){var t;for(clearTimeout(this.Timmer),this.Timmer=null;t=this.selfQueue.pop();)this.postData(t,"err");return this},_lg:function(t,r,e,i){var s=this,a=s._conf,n=s.getPage(),o=a.ignore||{},c=o.ignoreErrors,h=o.ignoreResErrors,f=o.ignoreUrls,p=o.ignoreApis;if(s._isRobot||H.ignoreByRule(n,f)||H.ignoreByRule(H.decode(n),f)||t==="error"&&(H.ignoreByRule(r.msg,c)||H.ignoreByRule(H.decode(r.msg),c))||t==="resourceError"&&(H.ignoreByRule(r.src,h)||H.ignoreByRule(H.decode(r.src),h))||t==="api"&&(H.ignoreByRule(r.api,p)||H.ignoreByRule(H.decode(r.api),p))||!s.checkImgUrl(a.imgUrl)||!r||a.disabled||!a.pid||i===0)return s;var u=r.dl;if(delete r.dl,r=H.ext({t,times:1,page:n,tag:a.tag||"",release:a.release||"",environment:a.environment,begin:Date.now(),c1:a.c1,c2:a.c2,c3:a.c3},r,s.commonInfo(),s._common,{pid:a.pid,_v:s.ver,pv_id:s.pageview,username:s.getUsername(),sampling:e||1,dl:u,z:H.seq()}),H.T(a.beforeReport)==="Function")try{if(!(r=a.beforeReport(r)))return s}catch(g){return s}return i===1?Or(s,r):e&&!s.sampling(e)?s:Or(s,r)},_self:function(t,r,e){var i=this,s=i._conf;if(t!=="error"||!i.checkImgUrl(s.imgUrl)||!r||s.disabled||!s.pid||!Lr||e&&!i.sampling(e))return i;r=H.ext({t,times:1,page:H.selfErrPage,tag:s.pid,begin:Date.now()},r,{pid:Lr,_v:i.ver,sampling:e||1,z:H.seq()});var a=i.selfQueue[0];if(a){a.times++;try{a.err&&r.err&&a.err.msg_raw&&r.err.msg_raw&&a.err.msg_raw.split("&").indexOf(r.err.msg_raw)<0&&a.err.msg_raw.length<1e3&&(a.err.msg_raw+="&"+r.err.msg_raw)}catch(n){}}else i.selfQueue.unshift(r),i.onReady(function(){i.sdkFlag&&(i.sdkFlag=!1,i.Timmer=H.delay(function(){i.clearSelf()},1e4))})},custom:function(t,r){if(!t||typeof t!="object")return this;var e=!1,i={begin:Date.now()};return H.each(t,function(s,a){return!(e=a&&a.length<=20)&&H.warn("[retcode] invalid key: "+a),i["x-"+a]=s,e}),e?this._lg("custom",i,r||1):this}},Mr.exports=Ot;var wa=Mr.exports,$=ye,dt=wa,_a=["api","success","time","code","msg","trace","traceId","begin","pv_id","sid","seq","domain","flag","apiSnapshot","tag","c1","c2","c3"],Oi=function(t){var r=(t.key||"default").split("::");return r.length>1?$.ext(t,{group:r[0],key:r[1]}):$.ext(t,{group:"default_group",key:r[0]})},pt=function(t){dt.call(this,t);var r;try{r=typeof performance=="object"?performance.timing.fetchStart:Date.now()}catch(e){r=Date.now()}return this._startTime=r,this};pt.prototype=$.createObject(dt.prototype),$.ext(dt.dftCon,{startTime:null}),$.ext(pt.prototype,{constructor:pt,_super:dt,sum:function(t,r,e){try{var i=$.dealParam(t,r,1);return this._lg("sum",Oi(i),e)}catch(s){$.warn("[retcode] can not get parseStatData: "+s)}},avg:function(t,r,e){try{var i=$.dealParam(t,r,0);return this._lg("avg",Oi(i),e)}catch(s){$.warn("[retcode] can not get parseStatData: "+s)}},percent:function(t,r,e,i){try{return this._lg("percent",Oi({key:t,subkey:r,val:e||0,begin:Date.now()}),i)}catch(s){$.warn("[retcode] can not get parseStatData: "+s)}},msg:function(t,r){if(t&&!(t.length>180))return this.custom({msg:t},r)},error:function(t,r){if(!t)return $.warn("[retcode] invalid param e: "+t),this;arguments.length===1?(typeof t=="string"&&(t={message:t},r={}),typeof t=="object"&&(r=t=t.error||t)):(typeof t=="string"&&(t={message:t}),typeof r!="object"&&(r={}));var e=t.name||"CustomError",i=t.message||"",s=t.stack||"";r=r||{};var a=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"";if($.checkSDKError(i,r.filename)){var n=/^Script error\.?$/,o=t.msg||t.message;if($.ignoreByRule(o,n)||$.ignoreByRule($.decode(o),n))return this;var c={msg:$.selfErrKey,err:{msg_raw:$.encode(t.msg||t.message)}};return this._self("error",c,1)}for(var h={begin:Date.now(),cate:e,msg:i&&i.substring(0,1e3),stack:s&&s.substring(0,1e3),file:$.removeUrlSearch(r.filename||""),line:r.lineno||"",col:r.colno||"",err:{msg_raw:$.encode(i),stack_raw:$.encode(s)},dl:a},f=["tag","c1","c2","c3"],p=0;p<f.length;p++){var u=f[p];r[u]&&(h[u]=r[u])}var g=(this.getConfig("ignore")||{}).ignoreErrors;return $.ignoreByRule(h.msg,g)||$.ignoreByRule($.decode(h.msg),g)?this:(this.beforeSend&&this.beforeSend("error",h),this._lg("error",h,1))},behavior:function(t){if(t){var r=typeof t=="object"&&t.behavior?t:{behavior:t};return this.beforeSend&&this.beforeSend("behavior",r),this._lg("behavior",r,1)}},api:function(t,r,e,i,s,a,n,o,c,h,f,p,u,g,m,d){if(!t)return $.warn("[retcode] api is null"),this;if(t=typeof t=="string"?{api:t,success:r,time:e,code:i,msg:s,begin:a,traceId:n,pv_id:o,apiSnapshot:c,domain:h,flag:p,tag:u,c1:g,c2:m,c3:d}:$.sub(t,_a),!$.checkAPI(t.api,!0))return this;t.code=t.code||"";var S=t.msg||"";if(S=typeof S=="string"?S.substring(0,1e3):S,t.msg=S,t.success=t.success?1:0,t.time=+t.time,t.begin=t.begin,t.traceId=t.traceId||"",t.pv_id=t.pv_id||"",t.domain=t.domain||"",t.flag=t.flag,t.dl=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"",t.apiSnapshot&&(typeof t.apiSnapshot=="object"&&(t.apiSnapshot=JSON.stringify(t.apiSnapshot)),typeof t.apiSnapshot!="string"&&delete t.apiSnapshot,t.apiSnapshot.length>2e3&&(t.apiSnapshot=t.apiSnapshot.substring(0,2e3))),f&&(t.traceOrigin=f),!t.api||isNaN(t.time))return $.warn("[retcode] invalid time or api"),this;var b=(this.getConfig("ignore")||{}).ignoreApis;return $.ignoreByRule(t.api,b)||$.ignoreByRule($.decode(t.api),b)?this:t.time<0?this:(this.beforeSend&&this.beforeSend("api",t),this._lg("api",t,t.success&&this.getConfig("sample"),t.flag))},speed:function(t,r,e){var i=this,s=this.getConfig("startTime")||this._startTime;return/^s(\d|1[0])$/.test(t)?(r=typeof r!="number"?Date.now()-s:r>=s?r-s:r,i.speedCache=i.speedCache||{},i.speedCache[t]=r,i.speedCache.begin=s,clearTimeout(i.speedTimmer),i.speedTimmer=setTimeout(function(){e||(i.speedCache.page=i.getPage(!0)),i._lg("speed",i.speedCache),i.speedCache=null},5e3),i):($.warn("[retcode] invalid point: "+t),i)},performance:function(t){if(t&&typeof t=="object"&&!this.hasSendPerf){var r={},e={},i=this.getConfig("autoSendPerf");if(t.autoSend&&i)return e=$.ext(this.perfData||{},t),this.hasSendPerf=!0,this._lg("perf",e,this.getConfig("sample"));if(t.autoSend&&!i)return delete t.autoSend,this.perfData?(e=$.ext(this.perfData||{},t),this.hasSendPerf=!0,this._lg("perf",e,this.getConfig("sample"))):void(this.perfData=t);for(var s in t)(/^t([1-9]|1[0])$/.test(s)||s==="ctti"||s==="cfpt")&&(r[s]=t[s]);if(t.autoSend===!0||!i&&(i||this.perfData))return t.autoSend!==!0&&i===!1&&this.perfData?(r=$.ext(this.perfData||{},r),this.hasSendPerf=!0,this._lg("perf",r,this.getConfig("sample"))):void 0;this.perfData=$.ext(this.perfData||{},r)}},resource:function(t,r){if(!t||!$.isPlainObject(t))return $.warn("[arms] invalid param data: "+t),this;var e=Object.keys(t),i=["begin","dom","load","res","dl"],s=!1;for(var a in i)if(e.indexOf(i[a])<0){s=!0;break}if(s)return $.warn("[arms] lack param data: "+t),this;var n={begin:t.begin||Date.now(),dom:t.dom||"",load:t.load||"",res:$.isArray(t.res)?JSON.stringify(t.res):JSON.stringify([]),dl:t.dl||""};return this._lg("res",n,r)},event:function(t,r){if(typeof t=="object"&&t&&t.key){var e={},i=["key","success","time","c1","c2","c3"];for(var s in t)i.indexOf(s)>-1&&(e[s]=t[s]);e.success=t.success===!1?0:1,this._lg("event",e,r)}}}),pt._super=dt,pt._root=dt,dt.Reporter=pt,Cr.exports=pt;var Ra=Cr.exports,Vr={exports:{}},Dr=ye,It=typeof window=="object"?window:{},Ia="catch",Vt=It.__oFetch_||It.fetch;Vt=typeof Vt=="function"?Vt:void 0,Vr.exports=function(t,r){var e=-1;typeof t=="object"&&(e=t.z,t=Dr.serialize(t));var i=r+t;if(Vt)return Vt(i,{method:"HEAD",mode:"no-cors"})[Ia](Dr.noop);if(It.document&&It.document.createElement){var s="__request_hold_"+e,a=It[s]=new Image;a.onload=a.onerror=function(){It[s]=void 0},a.src=i,a=null}};var Ea=Vr.exports,xr={exports:{}},Aa=ye,Ur=typeof window=="object"?window:{},ri=Ur.__oXMLHttpRequest_||Ur.XMLHttpRequest;ri=typeof ri=="function"?ri:void 0,xr.exports=function(t,r){try{var e=new ri;e.open("POST",r,!0),e.setRequestHeader("Content-Type","text/plain"),e.send(JSON.stringify(t))}catch(i){Aa.warn(`[retcode] Failed to log, exception is :
3
- `+i)}};var Ta=xr.exports,Vi,Br;function Pa(){if(Br)return Vi;Br=1;var t=ye;return Vi=function(r,e){var i=[],s=null,a=e&&e.location&&e.location.href,n=void 0,o=null,c=function(u,g,m){if(u!==null){var d=u[g];u[g]=m(d)}},h=function(u){var g,m,d,S,b,w=[];if(!u||typeof u.tagName!="string")return"";if(w.push(u.tagName.toLowerCase()),typeof u.id=="string"&&w.push("#".concat(u.id)),typeof(g=u.className)=="string")for(m=g.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++)d=_[b],typeof(S=u.getAttribute(d))=="string"&&w.push("[".concat(d,'="').concat(S,'"]'));return w.join("")},f=function(u,g){return function(m){if(m&&m!==o){o=m;var d;try{d=m.target}catch(b){d="<unknown>"}if(d.length!==0){var S={type:"ui.".concat(u),data:{message:function(b){if(!b||b.nodeType!==1)return"";for(var w=b||null,_=[],R=0,x=0,z=3,j="";w&&R++<5&&!((j=h(w))==="html"||R>1&&x+_.length*z+j.length>=80);)_.push(j),x+=j.length,w=w.parentNode;return _.reverse().join(" > ")}(d)},timestamp:Date.now()};u==="click"?s&&s.addBehavior(S):u==="keypress"&&(n||s&&s.addBehavior(S),clearTimeout(n),n=setTimeout(function(){n=void 0},100))}}}},p=function(){if(function(){var d=e&&e.chrome,S=d&&d.app&&d.app.runtime,b="history"in e&&!!e.history.pushState&&!!e.history.replaceState;return!S&&b}()){var u=function(d,S){var b={type:"navigation",data:{from:d,to:S}};s&&s.addBehavior(b),a=S},g=e.onpopstate;e.onpopstate=function(){for(var d=arguments.length,S=new Array(d),b=0;b<d;b++)S[b]=arguments[b];var w=e.location.href;if(u(a,w),g)return g.apply(this,S)};var m=function(d){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 _&&u(a,String(_)),d.apply(this,b)}};c(e.history,"pushState",m),c(e.history,"replaceState",m)}};t.ext(r.prototype,{addBehavior:function(u){if(this.getConfig("behavior")&&u&&typeof u=="object"){var g={},m=u.data||{};if(u.type)g=m;else{if(typeof m.name!="string"||typeof m.message!="string")return;g.name=m.name.substr(0,20),g.message=m.message.substr(0,200)}g.message&&(g.message=t.encode(g.message));var d={type:u.type||"custom",data:g||{},timestamp:u.timestamp||Date.now(),page:u.page||e&&e.location&&e.location.pathname};return i.push(d),i=i.slice(-100)}},getBehavior:function(){return i||[]},setBehavior:function(u){return u&&(i=u),i},reportBehavior:function(u){var g=this;g.getConfig("behavior")&&(g.sendBhTimer&&(clearTimeout(g.sendBhTimer),g.sendBhTimer=void 0),g.sendBhTimer=setTimeout(function(){i&&i.length>0&&(g.behavior(i),i=[],g.sendBhTimer=void 0,u&&typeof u=="function"&&u())},0))},initBehavior:function(){if(!this.hasInitBehavior&&!s){try{(function(){if(document&&document.referrer&&document.location){var g=document.referrer,m=document.location.href;if(g!==""){var d={type:"navigation",data:{from:g,to:m}};a=m,s&&s.addBehavior(d)}}})(),e&&e.document&&e.document.addEventListener&&(e.document.addEventListener("click",f("click"),!1),e.document.addEventListener("keypress",f("keypress"),!1)),p();var u=this.getConfig("enableConsole");u&&function(g){if(e&&e.console){var m=["debug","info","warn","log","error","assert"];t.isArray(g)&&(m=g);for(var d=0;d<m.length;d++){var S=m[d];S&&t.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(_),x=0;x<_;x++)R[x]=arguments[x];var z={type:"console",data:{level:w,message:R}};if(s&&s.addBehavior(z),w==="error")for(var j=0;j<R.length;j++){var O=R[j];O&&O.message&&O.stack&&s&&s.errorHandler(new ErrorEvent("error",{error:O,message:O.message}))}b&&Function.prototype.apply.call(b,e.console,R)}})}}}(u)}catch(g){t.warn("[arms] error in initBehavior",g)}s=this,this.hasInitBehavior=!0}return this}})},Vi}var Hr={},Fr;function Di(){return Fr||(Fr=1,Hr.TIMING_KEYS=["startTime","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","","domInteractive","","domContentLoadedEventEnd","","loadEventStart","","msFirstPaint","secureConnectionStart","redirectStart","redirectEnd"]),Hr}var xi,jr;function ka(){if(jr)return xi;jr=1;var t=ye,r=Di(),e=r.TIMING_KEYS;return xi=function(){var i=t.win||{},s=i.performance;if(!s||typeof s!="object"||typeof s.getEntriesByType!="function")return null;var a={},n=s.timing||{},o=s.getEntriesByType("resource")||[];if(a.begin=n[e[1]]||Date.now(),typeof i.PerformanceNavigationTiming=="function"){var c=s.getEntriesByType("navigation")[0];c&&(n=c)}return t.each({dom:[10,8],load:[14,1]},function(h,f){var p=n[e[h[1]]],u=n[e[h[0]]];if(p>0&&u>0){var g=Math.round(u-p);g>=0&&g<6e5&&(a[f]=g)}}),a.res=JSON.stringify(o),a},xi}var Ui,$r;function Ca(){if($r)return Ui;$r=1;var t=ye,r=Di(),e=r.TIMING_KEYS;return Ui=function(){var i=t.win||{},s=i.performance;if(!s||typeof s!="object")return null;var a={},n=s.timing||{},o=Date.now(),c=1;if(typeof i.PerformanceNavigationTiming=="function"){var h=s.getEntriesByType("navigation")[0];h&&(n=h,c=2)}t.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,d){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&&(a[d]=w)}});var f=i.navigator.connection,p=s.navigation||{};a.ct=f?f.effectiveType||f.type:"";var u=f&&(f.downlink||f.downlinkMax||f.bandwidth)||null;if((u=u>999?999:u)&&(a.bandwidth=u),a.navtype=p.type===1?"Reload":"Other",c===1&&n[e[16]]>0&&n[e[1]]>0){var g=n[e[16]]-n[e[1]];g>=0&&g<36e5&&(a.fpt=g)}return c===1&&n[e[1]]>0?a.begin=n[e[1]]:c===2&&a.load>0?a.begin=o-a.load:a.begin=o,a},Ui}var Wr,Kr;function Ma(){return Kr||(Kr=1,Wr=function(t,r,e){var i=ye,s=ka(),a=Ca(),n=null,o=e.documentElement,c=r.innerWidth||o.clientWidth||e.body.clientWidth,h=r.innerHeight||o.clientHeight||e.body.clientHeight,f=r.navigator.connection,p={sr:screen.width+"x"+screen.height,vp:c+"x"+h,ct:f?f.effectiveType||f.type:""},u={},g=function(d,S,b,w,_){if(S===void 0){var R,x;if(!u[d]){R=new RegExp(d+"=([^;]+)");try{x=R.exec(e.cookie)}catch(j){return i.warn("[retcode] can not get cookie:",j),null}x&&(u[d]=x[1])}return u[d]}var z=d+"="+S;z+="; path=/",b&&(z+="; max-age="+b);try{return e.cookie=z,!!e.cookie}catch(j){return i.warn("[retcode] can not set cookie: ",j),!1}},m=function(d){var S=d._conf.uid||g("_nk_")||g("_bl_uid");return!S&&(S=i.uu(),!g("_bl_uid",S,15552e3))?null:S};return i.ext(t.prototype,{activeErrHandler:function(d){return n&&!d?this:(n=this,this)},errorHandler:function(d){if(!d)return this;var S=d.type;if(S==="error"){var b=d.target||d.srcElement;!b||!b.tagName||d.message||d.filename||d.lineno||d.colno?this.error(d.error||{message:d.message},d):this.resourceErrorHandler(d)}else S==="unhandledrejection"&&i.T(d.reason,"Error")&&i.checkAutoError(d.reason)&&this.error(d.reason);try{this.getConfig("behavior")&&this.reportBehavior&&this.reportBehavior()}catch(w){}return this},resourceErrorHandler:function(d){var S=this,b=d.target||d.srcElement;try{var w=S.getSrc(b),_=typeof b.tagName=="string"?b.tagName.toLowerCase():"",R=S.getXPath(b,5),x=i.getURL(w),z={src:w&&w.substring(0,1e3),node_name:_,xpath:R,res_type:i.getResType(_,w),res_name:x.path,domain:x.domain};return S._conf.enableResource&&S.fixResourceStatus&&d.timeStamp&&S.fixResourceStatus({src:w,node_name:_,res_type:i.getResType(_,w),timeStamp:d.timeStamp,domain:x.domain}),S._lg("resourceError",z),S}catch(j){return i.warn("[ARMS] resourceErrorHandler error :",j),S}},getSrc:function(d){var S=d.src||d.href;try{if(!S){var b=(typeof d.tagName=="string"?d.tagName.toLowerCase():"")==="object",w=d.getAttribute("classid")&&d.getAttribute("classid").toLowerCase()==="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"||d.getAttribute("type")==="application/x-shockwave-flash";b&&w&&(S=d.getAttribute("data")||d.getAttribute("codebase")),S||(S=d.outerHTML||d.innerHTML)}}catch(_){S=""}return S},getXPath:function(d,S){var b=d.id?"#"+d.id:"",w=typeof d.className=="string"?"."+d.className.split(" ").join("."):"",_=(typeof d.tagName=="string"?d.tagName.toLowerCase():"")+b+w;return d.parentNode&&d.parentNode.tagName&&S-1!=0?this.getXPath(d.parentNode,S-1)+" > "+_:_},sendPerformance:function(d){var S=this;S.onReady(function(){var b=a();b&&b.load&&b.load>0&&(b.page=S.getPage(!0),d&&(b=i.ext(b,d)),b.autoSend=!0,S.performance(b))})},sendResources:function(d){var S=this;S.onReady(function(){var b=s();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,d&&(b=i.ext(b,d)),S._lg("res",b,S.getConfig("sample"))))})},sendPV:function(){var d=this;d.onReady(function(){var S=function(b){var w=m(b),_=r.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()}}(d);S&&S.uid&&d._lg("pv",S,d.getConfig("pvSample"))})},commonInfo:function(){return p.uid=m(this),p.sid=function(d){if(d.session)return d.session;var S;try{if(typeof window=="object"&&typeof sessionStorage=="object"&&typeof sessionStorage.getItem=="function")return typeof(S=sessionStorage.getItem("_bl_sid"))=="string"?(d.session=S,S):(S=i.uu(),d.session=S,typeof sessionStorage.setItem=="function"&&sessionStorage.setItem("_bl_sid",S),S)}catch(b){i.warn("[ARMS] getSid error :",b)}return d.session=S=i.uu(),S}(this),p},handleUnload:function(d){var S=Date.now();if(S-this._lastUnload<200)return this;this._lastUnload=S,this.sendHealth(d),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(d){var S=this;if(!d^S.hashChangeHandler)return S;d?(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)},i.on(r,"hashchange",S.hashChangeHandler),i.on(r,"historystatechange",S.stateChangeHandler),S.hashChangeHandler(!1)):(i.off(r,"hashchange",S.hashChangeHandler),i.off(r,"historystatechange",S.stateChangeHandler),S.hashChangeHandler=null,S.stateChangeHandler=null)},initHandler:function(){var d=this;if(d.hasInitHandler)return d;var S=d._conf;return i.on(r,"beforeunload",function(){d.handleUnload(0)}),d.bindHashChange(S.enableSPA),d.activeErrHandler(!1),d.hasInitHandler=!0,d}}),i.on(r,"error",function(d){n&&n.errorHandler(d)},!1,!0).on(r,"unhandledrejection",function(d){n&&n.errorHandler(d)}),t}),Wr}var Bi,qr;function Na(){if(qr)return Bi;qr=1;var t=ye,r=500;return Bi=function(e,i,s){function a(p,u,g){var m=0,d=p.tagName;if(d!=="SCRIPT"&&d!=="STYLE"&&d!=="META"&&d!=="HEAD"){var S=p.children?p.children.length:0;if(S>0)for(var b=p.children,w=S-1;w>=0;w--)m+=a(b[w],u+1,m>0);if(m<=0&&!g&&!(p.getBoundingClientRect&&p.getBoundingClientRect().top<o))return 0;m+=1+.5*u}return m}function n(p){for(var u=1;u<p.length;u++)if(p[u].score<p[u-1].score)return p.splice(u,1),n(p);return p}var o=i.innerHeight||0,c=[],h=null,f=0;t.ext(e.prototype,{initFmpObserver:function(p){var u=this;if(!u._conf||!u._conf.useFmp)return null;if(!i.MutationObserver)return t.warn("[retcode] first meaningful paint can not be retrieved"),u.sendPerformance(),null;t.on(i,"beforeunload",function(){u.endObserving(0,!0)});var g=i.MutationObserver;return(h=new g(function(){(function(m){var d=Date.now()-m,S=s.querySelector("body");if(S){var b=0;b+=a(S,1,!1),c.push({score:b,t:d})}else c.push({score:0,t:d})})(u._startTime)})).observe(document,{childList:!0,subtree:!0}),f=1,u.onReady(function(){u.endObserving(p)}),h},endObserving:function(p,u){var g=this;if(h&&f)if(g.fmpTimmer&&(clearTimeout(g.fmpTimmer),g.fmpTimmer=null),u||!function(b,w){var _=Date.now()-b;return!(_>w||_-(c&&c.length&&c[c.length-1].t||0)>2*r)}(g._startTime,p)){h.disconnect(),f=0,c=n(c);for(var m=null,d=1;d<c.length;d++)if(c[d].t>=c[d-1].t){var S=c[d].score-c[d-1].score;(!m||m.rate<=S)&&(m={t:c[d].t,rate:S})}m&&m.t>0&&m.t<36e5?g.sendPerformance({fmp:m.t}):g.sendPerformance()}else g.fmpTimmer=t.delay(function(){g.endObserving(p)},r)}})},Bi}var Jr,Gr;function La(){return Gr||(Gr=1,Jr=function(t,r){var e=ye,i=null,s=e.getCurDomain(),a=function(f,p,u,g,m,d,S,b,w,_,R,x,z){var j=e.J(m)||null,O=e.safetyCall(p,[j,g],null);if(!O)return!1;var ie=O.code||d,Ae=!("success"in O)||O.success;f.api(u,Ae,S,ie,O.msg,b,w,_,Ae?{}:R,s,x,z)},n="fetch",o="__oFetch_",c="__oXMLHttpRequest_",h="XMLHttpRequest";return e.ext(t.prototype,{removeHook:function(f,p){return i&&(p||this===i)?(r[o]&&(r[n]=r[o],delete r[o]),r[c]&&(r[h]=r[c],delete r[c]),i=null,this):this},addHook:function(f){return!f&&i?this:(i||(function(){if(typeof r[n]=="function"){var p=r[n];r[o]=p,r[n]=function(u,g){var m=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),d=i;if(!d||!d.api||g&&(g.method==="HEAD"||g.mode==="no-cors"))return p.apply(r,m);g||(g={});var S=Date.now(),b=d._conf,w=e.duration(),_=(u&&typeof u!="string"?u.url:u)||"",R=_;_=e.cutUrlSearch(_);var x=(b.ignore||{}).ignoreApis,z=b.parseTraceId;if(!e.checkAPI(_,!0)||e.ignoreByRule(_,x))return p.apply(r,m);_=e.filterByRule(_,R,b.ignoreApiPath?b.ignoreApiPath:b.apiHelper);var j=b.enableLinkTrace,O="",ie="",Ae=d.getConfig("pid"),ut=null,pe=d.getConfig("sample"),ge=d.getConfig("linkType"),Re=1;if(pe&&!d.sampling(pe)&&(Re=0),j){var qe="";try{qe=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(Z){qe=""}var Ze=e.checkSameOrigin(R,qe);if(d.getConfig("enableApiCors")||Ze)if(u&&typeof u!="string")try{if(m[0].headers&&typeof m[0].headers.get=="function"&&typeof m[0].headers.append=="function")switch(ge){case"arms":var et=m[0].headers.get("EagleEye-TraceID"),Ve=m[0].headers.get("EagleEye-SessionID"),Me=m[0].headers.get("EagleEye-pAppName");et?O=et:(O=d.getTraceId()["EagleEye-TraceID"],m[0].headers.append("EagleEye-TraceID",O)),Ve?ie=Ve:(ie=d.getPageviewId()["EagleEye-SessionID"],m[0].headers.append("EagleEye-SessionID",ie)),Me||m[0].headers.append("EagleEye-pAppName",Ae);break;case"b3":var He=m[0].headers.get("X-B3-TraceId");if(He)O=He;else{var Te=d.getB3TraceId(Re);m[0].headers.append("X-B3-TraceId",Te["X-B3-TraceId"]),m[0].headers.append("X-B3-ParentSpanId",Te["X-B3-ParentSpanId"]),m[0].headers.append("X-B3-SpanId",Te["X-B3-SpanId"]),m[0].headers.append("X-B3-Sampled",Te["X-B3-Sampled"]),m[0].headers.append("X-Request-ID",e.guid()),O=Te["X-B3-TraceId"]}ie=d.pageview;break;case"tracing":default:var be=m[0].headers.get("uber-trace-id");be?O=be.split(":")[0]:(be=d.getUberTraceId(Re),m[0].headers.append("uber-trace-id",be["uber-trace-id"]),O=be.traceId),ie=d.pageview}}catch(Z){e.warn(`[retcode] fetch failed to set header, exception is :
4
- `+Z)}else switch(g.headers=g.headers?g.headers:{},ge){case"arms":g.headers["EagleEye-TraceID"]?O=g.headers["EagleEye-TraceID"]:(O=d.getTraceId()["EagleEye-TraceID"],g.headers["EagleEye-TraceID"]=O),g.headers["EagleEye-SessionID"]?ie=g.headers["EagleEye-SessionID"]:(ie=d.getPageviewId()["EagleEye-SessionID"],g.headers["EagleEye-SessionID"]=ie),g.headers["EagleEye-pAppName"]||(g.headers["EagleEye-pAppName"]=Ae);break;case"b3":if(g.headers["X-B3-TraceId"])O=g.headers["X-B3-TraceId"];else{var ve=d.getB3TraceId(Re);g.headers["X-B3-TraceId"]=ve["X-B3-TraceId"],g.headers["X-B3-ParentSpanId"]=ve["X-B3-ParentSpanId"],g.headers["X-B3-SpanId"]=ve["X-B3-SpanId"],g.headers["X-B3-Sampled"]=ve["X-B3-Sampled"],g.headers["X-Request-ID"]=e.guid(),O=ve["X-B3-TraceId"]}ie=d.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(g.headers["uber-trace-id"])O=g.headers["uber-trace-id"].split(":")[0];else{var Je=d.getUberTraceId(Re);g.headers["uber-trace-id"]=Je["uber-trace-id"],O=Je.traceId}ie=d.getPageviewId()["EagleEye-SessionID"]}}return p.apply(r,m).then(function(Z){if(!d||!d.api)return Z;try{if(!Z||typeof Z.clone!="function")return Z;var fe=Z.clone(),Ge=fe.headers;if(Ge&&typeof Ge.get=="function"){var Yt=Ge.get("content-type");if(Yt&&!/(text)|(json)/.test(Yt))return Z;if(!O){var Mt=e.parseFetchHeaders(Ge);typeof Mt=="object"&&Mt["eagleeye-traceid"]&&(O=Mt["eagleeye-traceid"],ut="response")}}var Qt=w();return fe.text().then(function(_t){if(!O&&e.isFunction(z)){var ht=z(fe,_t);ht&&e.isString(ht)&&(O=ht)}var Zt=e.getFetchSnapshot(m,_t,Ge);fe.ok?a(d,b.parseResponse,_,R,_t,fe.status||200,Qt,S,O,ie,Zt,ut,Re):(d.api(_,!1,Qt,fe.status||404,fe.statusText,S,O,ie,Zt,s,ut,Re),b.enableResource&&i.fixResourceStatus&&i.fixResourceStatus({src:fe.url,res_type:"api"}))}),Z}catch(_t){return e.warn("[ARMS] fetch response error :",_t),Z}}).catch(function(Z){if(!d||!d.api)throw Z;var fe=w();throw d.api(_,!1,fe,Z.name||"Error",Z.message,S,O,ie,{},s),b.enableResource&&i.fixResourceStatus&&i.fixResourceStatus({src:R,res_type:"api"}),Z})},r[n].toString=e.createFakeToString(n)}}(),function(){if(typeof r[h]=="function"){var p,u=r[h];r[c]=u;var g=function(m){var d=new u(m),S=i;if(!S||!S.api||!d.addEventListener)return d;var b,w,_,R,x=d.send,z=d.open,j=d.setRequestHeader,O=S._conf,ie=(O.ignore||{}).ignoreApis,Ae=O.parseTraceId,ut=S.getConfig("enableLinkTrace"),pe="",ge="",Re="",qe=null,Ze=S.getConfig("sample"),et=S.getConfig("linkType"),Ve=1;return Ze&&!S.sampling(Ze)&&(Ve=0),d.open=function(Me,He){p=Me;var Te=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);z.apply(d,Te),R=He||"",_=e.cutUrlSearch(R);var be=!e.checkAPI(_,!0)||e.ignoreByRule(_,ie);if(_=_?e.filterByRule(_,R,O.ignoreApiPath?O.ignoreApiPath:O.apiHelper):"",!be&&ut){var ve="";try{ve=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(Ge){ve=""}var Je=e.checkSameOrigin(R,ve);if((S.getConfig("enableApiCors")||Je)&&j&&typeof j=="function")switch(et){case"arms":pe=S.getTraceId()["EagleEye-TraceID"],j.apply(d,["EagleEye-TraceID",pe]),ge=S.getPageviewId()["EagleEye-SessionID"],j.apply(d,["EagleEye-SessionID",ge]),Re=S.getConfig("pid"),j.apply(d,["EagleEye-pAppName",Re]);break;case"b3":var Z=S.getB3TraceId(Ve);j.apply(d,["X-B3-TraceId",Z["X-B3-TraceId"]]),j.apply(d,["X-B3-ParentSpanId",Z["X-B3-ParentSpanId"]]),j.apply(d,["X-B3-SpanId",Z["X-B3-SpanId"]]),j.apply(d,["X-B3-Sampled",Z["X-B3-Sampled"]]),j.apply(d,["X-Request-ID",e.guid()]),pe=Z["X-B3-TraceId"],ge=S.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var fe=S.getUberTraceId(Ve);j.apply(d,["uber-trace-id",fe["uber-trace-id"]]),pe=fe.traceId,ge=S.getPageviewId()["EagleEye-SessionID"]}}},d.send=function(){b=Date.now(),w=e.duration();var Me=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);x.apply(d,Me)},e.on(d,"readystatechange",function(){if(_&&d.readyState===4){var Me=w(),He=e.getXhrSnapshot(R,p,d);if(!pe){var Te=e.parseXhrHeaders(typeof d.getAllResponseHeaders=="function"&&d.getAllResponseHeaders()||"");typeof Te=="object"&&Te["eagleeye-traceid"]&&(pe=Te["eagleeye-traceid"],qe="response")}if(!pe&&e.isFunction(Ae)){var be=Ae(d);be&&e.isString(be)&&(pe=be)}if(d.status>=200&&d.status<=299){var ve=d.status||200;if(typeof d.getResponseHeader=="function"){var Je=d.getResponseHeader("Content-Type");if(Je&&!/(text)|(json)/.test(Je))return}d.responseType&&d.responseType!=="text"?S.api(_,!0,Me,ve,"",b,pe,ge,{},s,qe,Ve):a(S,O.parseResponse,_,R,d.responseText,ve,Me,b,pe,ge,He,qe,Ve)}else S.api(_,!1,Me,d.status||"FAILED",d.statusText,b,pe,ge,He,s,qe,Ve),O.enableResource&&i.fixResourceStatus&&i.fixResourceStatus({src:d.responseURL||R,res_type:"api"})}}),d};g.prototype=u.prototype,e.each(Object.keys(u),function(m){g[m]=u[m]}),r[h]=g,r[h].toString=e.createFakeToString(h)}}()),i=this,this)},initHook:function(){return this.hasInitHook?this:(this.getConfig("disableHook")||this.addHook(),this.hasInitHook=!0,this)}}),t}),Jr}var zr,Xr;function Oa(){return Xr||(Xr=1,zr=function(t,r){var e=ye,i=r.history||{},s=r.document,a=function(o,c){var h;r.CustomEvent?h=new CustomEvent(o,{detail:c}):((h=s.createEvent("HTMLEvents")).initEvent(o,!1,!0),h.detail=c),r.dispatchEvent(h)},n=function(o){var c=i[o];typeof c=="function"&&(i[o]=function(h,f,p){var u=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),g=location.href,m=c.apply(i,u);if(!p||typeof p!="string"||p===g)return m;try{var d=g.split("#"),S=p.split("#"),b=e.cutUrlSearch(d[0]),w=e.cutUrlSearch(S[0]),_=d[1]&&d[1].replace(/^\/?(.*)/,"$1"),R=S[1]&&S[1].replace(/^\/?(.*)/,"$1");_!==R?a("historystatechange",R):b!==w&&a("historystatechange",w)}catch(x){e.warn("[retcode] error in "+o+": "+x)}return m},i[o].toString=e.createFakeToString(o))};e.ext(t.prototype,{hackHistoryState:function(){return this.hasHackedHistoryState?this:(n("pushState"),n("replaceState"),this.hasHackedHistoryState=!0,this)}})}),zr}var Hi,Yr;function Va(){if(Yr)return Hi;Yr=1;var t=ye,r=Di(),e=r.TIMING_KEYS;return Hi=function(i,s){function a(c,h,f){if(c instanceof s.PerformanceResourceTiming&&c.initiatorType){var p=t.getResType(c.initiatorType,c.name),u=h.resourceTypes||[],g=(h.ignore||{}).ignoreResources;if(p&&u.includes(p)&&!t.ignoreByRule(c.name,g)&&!t.ignoreByRule(t.decode(c.name),g)){var m=c[e[0]],d=c[e[1]],S=c[e[2]],b=c[e[3]],w=c[e[4]],_=c[e[5]],R=c[e[6]],x=c[e[7]],z=c[e[8]],j=c[e[18]],O=c[e[19]];if(!f.has(c)&&(!t.areInOrder(m,d,S,b,w,_,R,x,z)||m>x))return;if(j<m&&(j=m),O<m&&(O=d),t.areInOrder(m,j,O,d))return{domain:t.getURL(c.name).domain,res_type:p,src_type:t.getSrcType(c.name,h.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();t.ext(i.prototype,{initResource:function(){var c=this,h=s.performance,f=s.PerformanceObserver;if(c[o]||(c[o]=new WeakMap),!h||!f||typeof h!="object"||typeof h.getEntriesByType!="function")return null;var p=h.getEntriesByType("resource")||[];return setTimeout(function(){c.setResource(p)},10),new f(function(u){setTimeout(function(){c.setResource(u.getEntries())},10)}).observe({entryTypes:["resource"]}),this.onReady(function(){setTimeout(c.resourceComboReport.bind(c),5e3)}),c},setResource:function(c){var h=this._conf,f=this[o];if(t.isArray(c)&&c.length){this[n]||(this[n]={});for(var p=this[n],u=0,g=c.length;u<g;u+=1){var m=c[u];if(t.checkAPI(m.name,!1)){var d=a(m,h,f);if(d){var S=d.res_type+"-"+d.domain;S in p||(p[S]=[]),p[S].push(d)}}}return this}},fixResourceStatus:function(c){var h=s.performance;if(!h||typeof h.getEntriesByName!="function")return null;var f=this[o];if(!c.src||!t.checkAPI(c.src,!1))return this;var p=c.timeStamp||h.now(),u=h.getEntriesByName(c.src,"resource");return t.each(u,function(g){f.has(g)||p-g.responseEnd<100&&f.set(g,{success:0})}),this},resourceComboReport:function(){var c=this[n]||{},h=this._conf.resourceSlow||2e3,f=this[o];this[n]={};var p=Object.keys(c);if(p.length!==0){var u=[];t.each(p,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:[]};t.each(b,function(_){var R=_.timing||{},x=f.get(_.timing),z=x?x.success:1,j=_.duration>h?1:0;w.domain=_.domain,w.res_type=_.res_type,w.src_type=_.src_type,w.count+=1,w.duration+=_.duration,w.size+=_.size,z||(w.err_count+=1,w.err_duration+=_.duration),j&&(w.slow_count+=1,w.slow_duration+=_.duration);try{var O=JSON.parse(JSON.stringify(R));O.success=z,O.resourceSlow=h,O.isSlow=j,w.timings.push(O)}catch(ie){}}),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)),u.push(w)});var g={_combo:1,resource:JSON.stringify(u)},m=s.navigator.connection;g.ct=m?m.effectiveType||m.type:"";var d=m&&(m.downlink||m.downlinkMax||m.bandwidth)||null;(d=d>999?999:d)&&(g.bandwidth=d),this._lg("resource",g,this.getConfig("sample"))}}})},Hi}var ne=ye,gt=Ra,Da=Ea,xa=Ta,Ye=ne.win,Fi=Ye.document,Ua=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,Pe=function(t){var r=this;return gt.call(r,t),r._initialPage=t.page&&ne.safetyCall(t.page,[],t.page+"")||null,r._isRobot=ne.isRobot(),r._health={errcount:0,apisucc:0,apifail:0},r.beforeSend=function(e,i){e==="error"?r._health.errcount++:e==="api"&&r._health[i.success?"apisucc":"apifail"]++},t.enableInstanceAutoSend!==!1&&(r.initHandler(),r.initHook(),r.initFmpObserver(1e4),r._conf&&r._conf.behavior&&typeof r.initBehavior=="function"&&r.initBehavior(),r._conf&&r._conf.enableResource&&typeof r.initResource=="function"&&r.initResource()),Object.defineProperty&&Ye.addEventListener&&Object.defineProperty(r,"pipe",{set:r.sendPipe}),r};Pe.prototype=ne.createObject(gt.prototype),ne.ext(gt._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(t){return(t?ne.cutUrlSearch(t.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(t){if(!t||typeof t!="object")return{};var r=t.code,e=t.msg||t.message||t.subMsg||t.errorMsg||t.ret||t.errorResponse||"";return typeof e=="object"&&(r=r||e.code,e=e.msg||e.message||e.info||e.ret||JSON.stringify(e)),{msg:e,code:r,success:!0}}}),ne.ext(Pe.prototype,{constructor:Pe,_super:gt,onReady:function(t){var r=this;if(r.hasReady)return t();Fi.readyState==="complete"?(r.hasReady=!0,t()):ne.on(Ye,"load",function(){r.hasReady=!0,t()},!0)},getPage:function(t){var r=this._conf,e=r.page,i=location,s=i.host+i.pathname;return e&&!t?ne.safetyCall(e,[],e+""):this._initialPage||ne.filterByRule(r.ignoreUrlCase?s.toLowerCase():s,i.href,r.ignoreUrlPath?r.ignoreUrlPath:r.urlHelper)},setPage:function(t,r){var e=this,i=e.prevPage;if(r!==!1){if(!t||t===i)return e;e.prevPage=t,clearTimeout(e.sendPVTimmer),e.handleUnload(1),e.resetPageview(),e.sendPVTimmer=setTimeout(function(){e.sendPV()},10)}else e.prevPage=t;return e._conf.page=t,e},setConfig:function(t,r){if(t&&typeof t=="object"){ne.verifyConfig(t),t=this.setImgUrl(t);var e=this._conf;if(this._conf=ne.ext({},e,t),!r){var i="disableHook";i in t&&e[i]!==t[i]&&(t[i]?this.removeHook():this.addHook()),(i="enableSPA")in t&&e[i]!==t[i]&&this.bindHashChange(t[i])}}},sendRequest:function(t){Da(t,this.getConfig("imgUrl"))},postData:function(t,r){var e={};e[r]=t[r],delete t[r];var i="";typeof t=="object"&&(i=ne.serialize(t)),xa(e,this.getConfig("imgUrl")+i+"&post_res=")},sendPipe:function(t){var r=this;if(!t||!t.length)return r;try{if(ne.T(t[0])==="Array")return ne.each(t,function(i){return r.sendPipe(i)});if(ne.T(t)!=="Array")return r;var e=t.shift();if(!Ua.test(e))return r;r[e].apply(r,t)}catch(i){return ne.warn("[retcode] error in sendPipe",i),r}},sendHealth:function(){var t=ne.ext({},this._health);t.healthy=t.errcount>0?0:1,t.begin=Date.now();var r=t.begin-this.sBegin;t.stay=r,this._lg("health",t,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(t){t=ne.ext({pid:this._conf.pid},t);var r=this.__proto__.constructor(t);return t.page&&r.sendPV(),r}}),Pa()(Pe,Ye),Ma()(Pe,Ye,Fi),Na()(Pe,Ye,Fi),La()(Pe,Ye),Oa()(Pe,Ye),Va()(Pe,Ye),Pe._super=gt,Pe._root=gt._root,gt.Browser=Pe,kr.exports=Pe;var Ba=kr.exports;function Qr(t,r){var e=De[ft]=new Et(t);e.sendPipe(r);var i=e._conf;return i.autoSendPv!==!1&&e.sendPV(),i&&i.useFmp||e.sendPerformance(),i&&i.sendResource&&e.sendResources(),De[ji]=!0,e}function Ha(){if(De[ji])return De[ft];var t={},r=[];return ft in De&&(t=De[ft].config||{},r=De[ft].pipe||[]),Qr(t,r)}var De=window,Et=De.BrowserLogger=Ba,ft=ye.key,ji="__hasInitBlSdk";Et.singleton=function(t,r){return De[ji]?De[ft]:Qr(t,r)},Et.createExtraInstance=function(t){t&&typeof t=="object"&&t.enableInstanceAutoSend!==!0&&(t.enableInstanceAutoSend=!1);var r=new Et(t),e=r._conf;return e.enableInstanceAutoSend&&(e.autoSendPv!==!1&&r.sendPV(),e&&e.useFmp||r.sendPerformance(),e&&e.sendResource&&r.sendResources()),r};var Fa=typeof window=="object"&&!!window.navigator;Fa&&De[ft]&&(Et.bl=Ha()),Rt.exports=Et;var ja=Rt.exports;const $a=Xe(ja);function Wa(t){const r=[],e=Object.getOwnPropertyDescriptors(Object.getPrototypeOf(t));for(const s of Object.keys(e))e[s].get&&r.push(s);const i={MediaboxWrapperObjectGetter(s,a){if(typeof a=="string"&&r.indexOf(a)>-1)return $e(s[a]);const n={MediaboxWrapperObjectMethod(...o){return $e(s[a](...o))}};return typeof s[a]=="function"?n.MediaboxWrapperObjectMethod:$e(s[a])},MediaboxWrapperObjectSetter(s,a,n){return s[a]=$e(n),!0}};return new Proxy(t,{get:i.MediaboxWrapperObjectGetter,set:i.MediaboxWrapperObjectSetter})}function Ka(t){const r={MediaboxWrapperFunctionApply(e,i,s){const a=e.apply(i,s);return $e(a)},MediaboxWrapperFunctionGet(e,i){const s=Object.getOwnPropertyDescriptor(e,i);if(s&&!s.writable&&!s.configurable)return e[i];const a={MediaboxWrapperFunctionGet(...n){const o=e[i](...n);return $e(o)}};return typeof e[i]=="function"?a.MediaboxWrapperFunctionGet:$e(e[i])},MediaboxWrapperClassConstructor(e,i){const s=new e(...i);return $e(s)}};return new Proxy(t,{apply:r.MediaboxWrapperFunctionApply,get:r.MediaboxWrapperFunctionGet,construct:r.MediaboxWrapperClassConstructor})}function qa(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof Date)&&!(t instanceof RegExp)&&!(t instanceof Function)}function $e(t){return typeof t=="function"?Ka(t):t instanceof Promise?t.then($e).catch(r=>(r.stack.indexOf("MediaboxWrapper")>-1&&setTimeout(()=>{throw r},0),Promise.reject(r))):qa(t)?Wa(t):t}const Ja="https://arms-retcode-sg.aliyuncs.com/r.png?",Ga="https://arms-retcode.aliyuncs.com/r.png?",za="https://retcode-us-west-1.arms.aliyuncs.com/r.png?",Xa={cn:Ga,sg:Ja,usw:za};class $i{constructor(r){je(this,"armsLogger"),je(this,"isReady",!1),je(this,"isDestroyed",!1),je(this,"options"),je(this,"queue",[]),je(this,"helper",{MediaboxWrapperQueue(a){return new Error(a)},MediaboxWrapperInitiative(a){return new Error(a)}}),this.options=r;const{region:e="cn",env:i="prod"}=r,s=a=>{var n;if(this.isDestroyed)return!1;if(a.c1=(n=this.options.cid)!=null?n:window.location.host,a.c2=$i.version,this.options.customData&&(a.c3=new URLSearchParams(this.options.customData).toString()),a.t==="error"){if(a.file.indexOf("g.alicdn.com/apsara-media-")>-1||a.file.indexOf("g.alicdn.com/thor-server")>-1||a.stack.indexOf("MediaboxWrapper")>-1){let o=a;return this.options.beforeSend&&(o=this.options.beforeSend(a)),this.isReady?o:(o&&this.queue.push(o),!1)}return!1}return a};this.armsLogger=$a.singleton({pid:"e1iftji1w7@7ec1cef2cc88733",tag:r.businessName,release:`${r.businessName}_${r.version}`,imgUrl:Xa[e],behavior:!0,sample:1,disableHook:!0,environment:i,beforeReport:s})}static get version(){return"0.6.0"}wrap(r){return this.options.disabled?r:$e(r)}updateOptions(r){this.options=q(q({},this.options),r)}setReady(){this.isReady=!0,this.queue.length&&this.queue.forEach(r=>{this.armsLogger.error(this.helper.MediaboxWrapperQueue(r.msg),{filename:r.file,lineno:r.line,colno:r.col})})}report(r,e){this.armsLogger.error(this.helper.MediaboxWrapperInitiative(r),e)}destroy(){this.isDestroyed=!0}}var J=(t=>(t.PullStreamStats="remoteStat",t.RtsSubscribeExceeds="rtsSubscribeExceeds",t.UserJoined="userJoined",t.UserLeft="userLeft",t.Bye="bye",t.MuteAudio="muteAudio",t.UnmuteAudio="unmuteAudio",t.MuteVideo="muteVideo",t.UnmuteVideo="unmuteVideo",t.MuteScreen="muteScreen",t.UnmuteScreen="unmuteScreen",t.Error="error",t))(J||{}),we=(t=>(t.Local="local-device-status-change",t.Remote="remote-device-status-change",t))(we||{}),k=(t=>(t.Audio="sophon_audio",t.VideoLarge="sophon_video_camera_large",t.VideoSmall="sophon_video_camera_small",t.Screen="sophon_video_screen_share",t))(k||{}),Wi=(t=>(t.Audio="rts audio",t.VideoLarge="rts video",t))(Wi||{}),At=(t=>(t[t.Camera=0]="Camera",t[t.Screen=1]="Screen",t[t.Image=2]="Image",t))(At||{}),si=(t=>(t[t.Microphone=0]="Microphone",t[t.Screen=1]="Screen",t[t.Mixed=2]="Mixed",t))(si||{}),ai=(t=>(t.prod="rs.rtn.aliyuncs.com",t.pre="prs.rtn.aliyuncs.com",t))(ai||{});const Dt="6.11.5",Zr="web";class it{static getVersionNumber(){let r=Dt.split("."),e="";return r.forEach(i=>{i.length===1?e+="0"+i:e+=i}),parseInt(e)}static queryingParam(r){let e=[];if(r)for(let i in r)e.push(i+"="+r[i]);return e.join("&")}static getQueryParams(r){const i=window.location.search.substring(1).split("&");for(let s=0;s<i.length;s++){const a=i[s].split("=");if(decodeURIComponent(a[0])===r)return decodeURIComponent(a[1])}}static createCallid(){return D.Guid.create(8)+"-"+D.Guid.create(4)+"-4"+D.Guid.create(3)+"-"+D.Guid.create(4)}static checkSubOptionsValid(r){if(r){const{audio:e,video:i,screen:s}=r;if(e===!1&&i===!1&&s===!1)return!1}return!0}static isNetworkAvailable(){return v(this,null,function*(){const r=ai.prod,{onLine:e}=navigator;if(!e)return!1;try{return yield fetch(`https://${r}/roomserver/v1/ws/version`),!0}catch(i){return!1}})}}var Ki=(t=>(t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.API=2]="API",t[t.WARNING=3]="WARNING",t[t.ERROR=4]="ERROR",t[t.NONE=5]="NONE",t))(Ki||{});class Ne{constructor(r,e,i){l(this,"logLevel");l(this,"outputToConsole");l(this,"maxLogLength");l(this,"maxlogCache");l(this,"uri");l(this,"requestTimeout");l(this,"delay");l(this,"rate");l(this,"hugeBatchCount");l(this,"checkInterval");l(this,"flushModecheckInterval");l(this,"recordOverheadLength");l(this,"httpRequest");l(this,"traceId");l(this,"traceIdPostfix");l(this,"flushMode");l(this,"outputToServer");l(this,"batchCount");l(this,"msgCounter");l(this,"lastRequestTime");l(this,"enable");l(this,"retx");l(this,"lastProfilingTime");l(this,"bytesOut");l(this,"dropped");l(this,"networkdropped");l(this,"lastLogTime",0);l(this,"logArray");l(this,"onTimer",()=>{if(!this.enable)return;this.processCachedLogs();let r=Date.now(),e=r-this.lastLogTime>1e4;if(r-this.lastProfilingTime>=5e3&&!e){let s=this.getProfiling();this.logInternal("[logger] profiling result: "+Ne.toString(s))}let i=this.flushMode?this.flushModecheckInterval:this.checkInterval;e&&(i=this.checkInterval),setTimeout(this.onTimer,i)});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+"."+r+"/logstores/"+i+"/track":this.uri="https://"+e+"."+r+"/logstores/"+i+"/track",this.httpRequest=null,this.msgCounter=0,this.traceIdPostfix=D.LocalStorage.uuid+"-"+Date.now(),this.traceId="",this.logArray=[],this.enable=!0,this.lastRequestTime=0,this.onTimer()}static toString(r){let e;if(r instanceof Error)e=r.message;else if(typeof r=="string")e=r;else try{e=JSON.stringify(r)}catch(i){e="undefined"}return e}changeConfig(r){r.enable!==void 0&&(this.enable=r.enable,this.enable||this.clear()),r.logLevel!==void 0&&r.logLevel>=0&&r.logLevel<=5&&(this.logLevel=r.logLevel),r.logToConsole!==void 0&&(this.outputToConsole=r.logToConsole),r.logToServer!==void 0&&(this.outputToServer=r.logToServer),r.maxLogLength!==void 0&&r.maxLogLength>10&&(this.maxLogLength=r.maxLogLength),r.maxlogCache!==void 0&&r.maxlogCache>10&&r.maxlogCache<2e4&&(this.maxlogCache=r.maxlogCache),r.requestTimeout!==void 0&&r.requestTimeout>100&&r.requestTimeout<1e5&&(this.requestTimeout=r.requestTimeout),r.delay!==void 0&&r.delay>0&&r.delay<1e5&&(this.delay=r.delay),r.rate!==void 0&&r.rate>0&&r.rate<1e4&&(this.rate=r.rate)}getProfiling(){let r={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?(r.kbps=Math.round(this.bytesOut*8/(e-this.lastProfilingTime)),this.lastProfilingTime=e,this.bytesOut=0):r.kbps=-1,r}clear(){this.retx=[],this.logArray=[]}setFlushMode(r){this.enable&&(this.flushMode=r,this.flushMode&&this.processCachedLogs())}setTraceID(r){r&&(r.length>64&&(r=r.substring(0,64)),this.traceId=r)}d(...r){if(!this.enable||this.logLevel>0)return;let e=this.getCurrentTime();this.outputToConsole&&console.debug(e,...r);let i=Ne.paramArrayToString(r);this.addLog(0,i,!1,e)}i(...r){if(!this.enable||this.logLevel>1)return;let e=this.getCurrentTime();this.outputToConsole&&console.log(e,...r);let i=Ne.paramArrayToString(r);this.addLog(1,i,!1,e)}w(...r){if(!this.enable||this.logLevel>3)return;let e=this.getCurrentTime();this.outputToConsole&&console.warn(e,...r);let i=Ne.paramArrayToString(r);this.addLog(3,i,!1,e)}e(...r){if(!this.enable||this.logLevel>4)return;let e=this.getCurrentTime();this.outputToConsole&&console.error(e,...r);let i=Ne.paramArrayToString(r);i="<error> "+i,this.addLog(4,i,!1,e)}ev(...r){if(!this.enable||this.logLevel>2)return;let e=this.getCurrentTime();this.outputToConsole&&console.log(e,...r);let i=Ne.paramArrayToString(r);this.addLog(2,i,!1,e)}a(...r){if(!this.enable||this.logLevel>2)return;let e=this.getCurrentTime();if(this.outputToConsole){if(r.length>2){const s=`${r[1]}`;s.startsWith("__g__")&&console.group(`${s.substring(5)}_${r[2]}`)}console.log(e,...r)}let i=Ne.paramArrayToString(r);this.addLog(2,i,!1,e)}ar(...r){if(!this.enable||this.logLevel>2)return;let e=this.getCurrentTime();this.outputToConsole&&(console.log(e,...r),r.length>2&&`${r[1]}`.startsWith("__g__")&&console.groupEnd());let i=Ne.paramArrayToString(r);this.addLog(2,i,!1,e)}ae(...r){if(!this.enable||this.logLevel>4)return;let e=this.getCurrentTime();this.outputToConsole&&(console.error(e,...r),this.logLevel>2&&r.length>2&&console.groupEnd());let i=Ne.paramArrayToString(r);i="<error> "+i,this.addLog(4,i,!1,e)}logInternal(r){if(!this.enable||this.logLevel>3)return;let e=this.getCurrentTime();this.addLog(2,r,!0,e)}addLog(r,e,i,s){e=s+" "+e,e.length>this.maxLogLength&&(e=e.substring(0,this.maxLogLength));let a=Date.now();i||(this.lastLogTime=a);let n={tm:a.toString(),level:r.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(r){let e=0,i=0;for(;this.logArray.length>r&&e<=4;){for(;i<this.logArray.length;)if(parseInt(this.logArray[i].level)===e){if(this.logArray.splice(i,1),this.dropped++,this.logArray.length<=r)break}else i++;i===this.logArray.length&&(i=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 h=0;h<this.retx.length;h++)this.retx[h].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 r=this.flushMode?1.5*1024*1024:this.delay*this.rate,e=0,i=0,s=this.recordOverheadLength;for(let o=0;o<this.logArray.length&&(i+=this.logArray[o].msg.length+s,!(i>r));o++)e=o+1;e===0&&(e=1);let a=this.logArray.splice(0,e);this.batchCount++;let n=this.batchCount.toString();for(let o=0;o<a.length;o++)a[o].batch=n,a[o].tries="0";this.retx=a,this.batchSend(a)}createHttpRequest(){this.httpRequest||window.XMLHttpRequest&&(this.httpRequest=new XMLHttpRequest)}isHttpRequesting(){return this.httpRequest!==null}batchSend(r){if(this.isHttpRequesting())return;this.lastRequestTime=Date.now();let e=this.uri,i=JSON.stringify(r);i='{"__logs__":'+i+"}",this.createHttpRequest(),this.isHttpRequesting()&&(this.bytesOut+=i.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",i.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(i))}getCurrentTime(){let r=new Date;return("00"+r.getHours()).slice(-2)+":"+("00"+r.getMinutes()).slice(-2)+":"+("00"+r.getSeconds()).slice(-2)+"."+("000"+r.getMilliseconds()).slice(-3)}static paramArrayToString(r){let e="";for(let i=0;i<r.length;i++){e!==""&&(e+=",");let s=Ne.toString(r[i]);e+=s}return e}}class E{static getLogger(){return this.logger||(this.logger=new Ne("cn-shanghai.log.aliyuncs.com","alirtc","client_h5")),this.logger}static setLogLevel(r){this.getLogger().changeConfig({logLevel:r})}static config(r){this.getLogger().changeConfig(r)}static setTraceID(r){this.getLogger().setTraceID(r)}static setFlushMode(r){this.getLogger().setFlushMode(r)}static interface(...r){this.getLogger().a("[API]",...r)}static interfaceResult(r,e,i,...s){i?this.getLogger().ar("[ARE]",r,e,...s):this.getLogger().ae("[ARE]",r,e,...s)}static event(...r){this.getLogger().ev("[EVT]",...r)}static debug(...r){this.getLogger().d("[DBG]",...r)}static info(...r){this.getLogger().i("[INF]",...r)}static warn(...r){this.getLogger().w("[WARN]",...r)}static error(...r){this.getLogger().e("[ERR]",...r)}}l(E,"logger");const Ya=t=>v(this,null,function*(){const r=new V.AliRTS.SupportUtil;let e={support:!1,detail:{isWebRTCSupported:r.checkMediaDevices()&&r.checkWebRtcSupport(),isH264DecodeSupported:!1,isH264EncodeSupported:!1,isScreenShareSupported:!1,isSendMediaExtensionMsgSupported:!1,isBrowserSupported:r.checkBrowser({errorCode:0,message:""})}};if(e.support=e.detail.isWebRTCSupported&&e.detail.isBrowserSupported,r.checkWebRtcSupport()&&t!=="sendonly"){const i=yield r.checkH264Decode();e.detail.isH264DecodeSupported=i,e.support=e.support&&i}if(r.checkWebRtcSupport()&&t!=="recvonly"){const i=yield r.checkH264Encode();e.detail.isH264EncodeSupported=i,e.support=e.support&&i}return e.detail.isScreenShareSupported=r.checkWebRtcSupport()&&r.checkScreenCapture()&&!V.AliRTS.SystenUtil.isAndroid&&!V.AliRTS.SystenUtil.isIos,e.detail.isSendMediaExtensionMsgSupported=r.checkWebRtcSupport()&&r.checkEncodedTransformSupport(),e});var ce=(t=>(t[t.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",t[t.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen",t))(ce||{}),es=(t=>(t[t.PRE_PROCESSOR=0]="PRE_PROCESSOR",t[t.POST_PROCESSOR=1]="POST_PROCESSOR",t))(es||{}),ni=(t=>(t[t.AUDIO=0]="AUDIO",t[t.VIDEO=1]="VIDEO",t[t.BOTH=2]="BOTH",t))(ni||{});class Tt extends Q{constructor(e,i=ce.AliRtcSdkStreamTypeCapture,s=1){super();l(this,"name");l(this,"options");l(this,"type",0);l(this,"streamType");l(this,"trackType");l(this,"zIndex",1);l(this,"_isEnable",!0);l(this,"lastInputAudioTrack");l(this,"lastOutputAudioTrack");l(this,"lastInputVideoTrack");l(this,"lastOutputVideoTrack");this.name=e,this.streamType=i,this.trackType=s,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 i,s;return((i=this.lastInputAudioTrack)==null?void 0:i.id)!==((s=e.currentAudioTrack)==null?void 0:s.id)}videoUpdated(e){var i,s;return((i=this.lastInputVideoTrack)==null?void 0:i.id)!==((s=e.currentVideoTrack)==null?void 0:s.id)}execute(e,i){return v(this,null,function*(){const s=this.shouldUpdate(e,i);this.lastInputAudioTrack=e.currentAudioTrack,this.lastInputVideoTrack=e.currentVideoTrack,s?yield this.process(e,i):(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 xt=(t=>(t[t.LiveTranscodingSingle=0]="LiveTranscodingSingle",t[t.LiveTranscodingMix=1]="LiveTranscodingMix",t))(xt||{}),qi=(t=>(t[t.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",t[t.LiveTranscodingAudio=1]="LiveTranscodingAudio",t[t.LiveTranscodingVideo=2]="LiveTranscodingVideo",t))(qi||{}),Pt=(t=>(t[t.LiveTranscodingCamera=0]="LiveTranscodingCamera",t[t.LiveTranscodingShareScreen=1]="LiveTranscodingShareScreen",t))(Pt||{});const Ut={0:"camera",1:"shareScreen"};var Ji=(t=>(t[t.LiveTranscoding_Profile_1IN_1080P=0]="LiveTranscoding_Profile_1IN_1080P",t[t.LiveTranscoding_Profile_1IN_720P=1]="LiveTranscoding_Profile_1IN_720P",t[t.LiveTranscoding_Profile_1IN_360P=2]="LiveTranscoding_Profile_1IN_360P",t[t.LiveTranscoding_Profile_2IN_1080P=3]="LiveTranscoding_Profile_2IN_1080P",t[t.LiveTranscoding_Profile_2IN_720P=4]="LiveTranscoding_Profile_2IN_720P",t[t.LiveTranscoding_Profile_2IN_360P=5]="LiveTranscoding_Profile_2IN_360P",t[t.LiveTranscoding_Profile_4IN_1080P=6]="LiveTranscoding_Profile_4IN_1080P",t[t.LiveTranscoding_Profile_4IN_720P=7]="LiveTranscoding_Profile_4IN_720P",t[t.LiveTranscoding_Profile_4IN_360P=8]="LiveTranscoding_Profile_4IN_360P",t[t.LiveTranscoding_Profile_9IN_1080P=9]="LiveTranscoding_Profile_9IN_1080P",t[t.LiveTranscoding_Profile_9IN_720P=10]="LiveTranscoding_Profile_9IN_720P",t[t.LiveTranscoding_Profile_9IN_360P=11]="LiveTranscoding_Profile_9IN_360P",t[t.LiveTranscoding_Profile_12IN_1080P=12]="LiveTranscoding_Profile_12IN_1080P",t[t.LiveTranscoding_Profile_12IN_720P=13]="LiveTranscoding_Profile_12IN_720P",t[t.LiveTranscoding_Profile_12IN_360P=14]="LiveTranscoding_Profile_12IN_360P",t[t.LiveTranscoding_Profile_16IN_1080P=15]="LiveTranscoding_Profile_16IN_1080P",t[t.LiveTranscoding_Profile_16IN_720P=16]="LiveTranscoding_Profile_16IN_720P",t[t.LiveTranscoding_Profile_16IN_360P=17]="LiveTranscoding_Profile_16IN_360P",t[t.LiveTranscoding_Profile_Mixed=9999]="LiveTranscoding_Profile_Mixed",t))(Ji||{});const Qa={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 oi=(t=>(t[t.LiveTranscoding_HZ_48000=48e3]="LiveTranscoding_HZ_48000",t[t.LiveTranscoding_HZ_44100=44100]="LiveTranscoding_HZ_44100",t[t.LiveTranscoding_HZ_32000=32e3]="LiveTranscoding_HZ_32000",t[t.LiveTranscoding_HZ_16000=16e3]="LiveTranscoding_HZ_16000",t[t.LiveTranscoding_HZ_8000=8e3]="LiveTranscoding_HZ_8000",t))(oi||{}),Bt=(t=>(t[t.LiveTranscodingNoBody=0]="LiveTranscodingNoBody",t[t.LiveTranscodingBody=1]="LiveTranscodingBody",t))(Bt||{}),Ht=(t=>(t[t.NOTO_SERIF_CJKSC_REGULAR=0]="NOTO_SERIF_CJKSC_REGULAR",t[t.ALIBABA_PUHUITI_REGULAR=1]="ALIBABA_PUHUITI_REGULAR",t[t.ALIBABA_PUHUITI_BOLD=2]="ALIBABA_PUHUITI_BOLD",t[t.ALIBABA_PUHUITI_Heavy=3]="ALIBABA_PUHUITI_Heavy",t[t.ALIBABA_PUHUITI_LIGHT=4]="ALIBABA_PUHUITI_LIGHT",t[t.ALIBABA_PUHUITI_MEDIUM=5]="ALIBABA_PUHUITI_MEDIUM",t))(Ht||{}),Gi=(t=>(t[t.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",t[t.LiveTranscodingCrop=1]="LiveTranscodingCrop",t[t.LiveTranscodingFill=2]="LiveTranscodingFill",t))(Gi||{}),ci=(t=>(t[t.LiveTranscodingNormal=0]="LiveTranscodingNormal",t[t.LiveTranscodingVirtualBackground=1]="LiveTranscodingVirtualBackground",t))(ci||{}),zi=(t=>(t[t.LiveTranscodingState_IDLE=0]="LiveTranscodingState_IDLE",t[t.LiveTranscodingState_CONNNECT=1]="LiveTranscodingState_CONNNECT",t[t.LiveTranscodingState_RUNNING=2]="LiveTranscodingState_RUNNING",t[t.LiveTranscodingState_RECOVERING=3]="LiveTranscodingState_RECOVERING",t[t.LiveTranscodingState_FAILURE=4]="LiveTranscodingState_FAILURE",t[t.LiveTranscodingState_END=5]="LiveTranscodingState_END",t))(zi||{}),We=(t=>(t[t.LiveTranscodingErrorPublishOk=0]="LiveTranscodingErrorPublishOk",t[t.LiveTranscodingErrorStreamNotFound=17825793]="LiveTranscodingErrorStreamNotFound",t[t.LiveTranscodingErrorStreamAlreadyExist=17825794]="LiveTranscodingErrorStreamAlreadyExist",t[t.LiveTranscodingErrorInvalidParam=17825795]="LiveTranscodingErrorInvalidParam",t[t.LiveTranscodingErrorInternalError=17825796]="LiveTranscodingErrorInternalError",t[t.LiveTranscodingErrorRtmpServerError=17825797]="LiveTranscodingErrorRtmpServerError",t[t.LiveTranscodingErrorRtmpStreamUrlError=17825798]="LiveTranscodingErrorRtmpStreamUrlError",t[t.LiveTranscodingErrorPublishTimeout=17825799]="LiveTranscodingErrorPublishTimeout",t[t.LiveTranscodingErrorNotAuthorized=17825800]="LiveTranscodingErrorNotAuthorized",t))(We||{}),Xi=(t=>(t[t.TrascodingPublishTaskStatusStart=0]="TrascodingPublishTaskStatusStart",t[t.TrascodingPublishTaskStatusUpdate=1]="TrascodingPublishTaskStatusUpdate",t[t.TrascodingPublishTaskStatusStop=2]="TrascodingPublishTaskStatusStop",t))(Xi||{}),Ie=(t=>(t[t.MPU_TASK_TRANSACTION_START=0]="MPU_TASK_TRANSACTION_START",t[t.MPU_TASK_TRANSACTION_UPDATE=1]="MPU_TASK_TRANSACTION_UPDATE",t[t.MPU_TASK_TRANSACTION_STOP=2]="MPU_TASK_TRANSACTION_STOP",t[t.MPU_TASK_TRANSACTION_LIST=3]="MPU_TASK_TRANSACTION_LIST",t[t.MPU_TASK_TRANSACTION_POLLING=4]="MPU_TASK_TRANSACTION_POLLING",t[t.MPU_TASK_TRANSACTION_ACKNOWLEDGE=5]="MPU_TASK_TRANSACTION_ACKNOWLEDGE",t[t.MPU_TASK_TRANSACTION_END=6]="MPU_TASK_TRANSACTION_END",t))(Ie||{});const Za={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 Yi{constructor(r,e,i,s,a,n,o,c){l(this,"videoWidth");l(this,"videoHeight");l(this,"videoFramerate",20);l(this,"videoBitrate",2e3);l(this,"videoGop",30);l(this,"audioSamplerate",oi.LiveTranscoding_HZ_44100);l(this,"audioBitrate",500);l(this,"audioChannels",1);this.videoWidth=r,this.videoHeight=e,i&&(this.videoFramerate=i),s&&(this.videoBitrate=s),a&&(this.videoGop=a),n&&(this.audioSamplerate=n),o&&(this.audioBitrate=o),c&&(this.audioChannels=c)}}const Qi=t=>((t&16711680)>>16)+(t&65280)+((t&255)<<16),Le=(t=0,r)=>{if(r==0)return 0;let e=t/r;return e<0&&(e=0),e>1&&(e=1),e};class ui{constructor(r,e,i){l(this,"mixMode",xt.LiveTranscodingSingle);l(this,"singleParam");l(this,"mixParam");r&&(this.mixMode=r),e&&(this.singleParam=e),i&&(this.mixParam=i)}toJson(r,e,i,s,a){const n={appid:e.appId,channelid:e.channelId};if(r===Ie.MPU_TASK_TRANSACTION_POLLING||r===Ie.MPU_TASK_TRANSACTION_LIST||r===Ie.MPU_TASK_TRANSACTION_ACKNOWLEDGE)return r===Ie.MPU_TASK_TRANSACTION_ACKNOWLEDGE&&(n.messageid=a),n;if(n.taskid=i,r!==Ie.MPU_TASK_TRANSACTION_STOP){if(n.mixmode=this.mixMode,s&&(n.streamurl=s),this.mixMode===xt.LiveTranscodingSingle){const o=this.singleParam;if(o){n.streamtype=o.streamType,o.sourceType===Pt.LiveTranscodingShareScreen?n.sourcetype=Ut[o.sourceType]:n.sourcetype=Ut[Pt.LiveTranscodingCamera];const c=[];o.userId&&c.push(o.userId),n.subspecusers=c}}else if(r===Ie.MPU_TASK_TRANSACTION_START||r===Ie.MPU_TASK_TRANSACTION_UPDATE){const o=this.mixParam;if(o){o.taskProfile&&(n.taskprofile=Qa[o.taskProfile]);const c=o.encodeParam||new Yi(1280,720);let h=c.videoWidth,f=c.videoHeight;const p={};Object.keys(c).forEach(g=>{const m=c[g];m>0&&(p[g.toLowerCase()]=m)}),p.lowbitratehighquality=0,n.encodeparam=p,n.backgrounds=o.backgrounds.map(g=>g.toJson(h,f)),n.watermarks=o.watermarks.map(g=>g.toJson(h,f)),n.clockwidgets=o.clockWidgets.map(g=>g.toJson(h,f));const u=o.users.map(g=>g.userId);n.subspecusers=[...new Set(u)],n.layouts=[{audiomixcount:o.users.length,panes:o.users.map((g,m)=>g.toJson(m,h,f,o.mediaProcessMode))}],n.layoutids=["0"],n.cropmode=o.cropMode,n.backgroundcolor=Qi(o.backgroundColor),n.taskmode=o.mediaProcessMode}}}return n}}var rt=(t=>(t.pre="pre",t.prod="prod",t))(rt||{}),Qe=(t=>(t.AliRtcSdkCommunication="communication",t.AliRtcSdkInteractiveLive="interactive_live",t.AliRtcSdkInteractiveWithLowLatencyLive="cdn_live",t))(Qe||{}),st=(t=>(t.AliRtcSdkInteractive="interactive",t.AliRtcSdkLive="live",t))(st||{}),Ke=(t=>(t[t.AliEngineLocalDeviceTypeUnknown=0]="AliEngineLocalDeviceTypeUnknown",t[t.AliEngineLocalDeviceTypeMic=1]="AliEngineLocalDeviceTypeMic",t[t.AliEngineLocalDeviceTypeSpeaker=2]="AliEngineLocalDeviceTypeSpeaker",t[t.AliEngineLocalDeviceTypeAudioDevice=3]="AliEngineLocalDeviceTypeAudioDevice",t[t.AliEngineLocalDeviceTypeCamera=4]="AliEngineLocalDeviceTypeCamera",t[t.AliEngineLocalDeviceTypeDisplay=5]="AliEngineLocalDeviceTypeDisplay",t[t.AliEngineLocalDeviceTypeVideoDevice=6]="AliEngineLocalDeviceTypeVideoDevice",t))(Ke||{}),re=(t=>(t[t.AliEngineLocalDeviceExceptionTypeUnknown=0]="AliEngineLocalDeviceExceptionTypeUnknown",t[t.AliEngineLocalDeviceExceptionTypeMicOpenFail=1]="AliEngineLocalDeviceExceptionTypeMicOpenFail",t[t.AliEngineLocalDeviceExceptionTypeMicInterrupt=2]="AliEngineLocalDeviceExceptionTypeMicInterrupt",t[t.AliEngineLocalDeviceExceptionTypeMicAuthFail=3]="AliEngineLocalDeviceExceptionTypeMicAuthFail",t[t.AliEngineLocalDeviceExceptionTypeMicNotAvailable=4]="AliEngineLocalDeviceExceptionTypeMicNotAvailable",t[t.AliEngineLocalDeviceExceptionTypeSpeakerOpenFail=5]="AliEngineLocalDeviceExceptionTypeSpeakerOpenFail",t[t.AliEngineLocalDeviceExceptionTypeSpeakerInterrupt=6]="AliEngineLocalDeviceExceptionTypeSpeakerInterrupt",t[t.AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable=7]="AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable",t[t.AliEngineLocalDeviceExceptionTypeAudioDeviceException=8]="AliEngineLocalDeviceExceptionTypeAudioDeviceException",t[t.AliEngineLocalDeviceExceptionTypeCameraOpenFail=9]="AliEngineLocalDeviceExceptionTypeCameraOpenFail",t[t.AliEngineLocalDeviceExceptionTypeCameraInterrupt=10]="AliEngineLocalDeviceExceptionTypeCameraInterrupt",t[t.AliEngineLocalDeviceExceptionTypeCameraAuthFail=11]="AliEngineLocalDeviceExceptionTypeCameraAuthFail",t[t.AliEngineLocalDeviceExceptionTypeDisplayException=12]="AliEngineLocalDeviceExceptionTypeDisplayException",t[t.AliEngineLocalDeviceExceptionTypeVideoDeviceException=13]="AliEngineLocalDeviceExceptionTypeVideoDeviceException",t))(re||{}),G=(t=>(t[t.AliRtcConnectionStatusInit=0]="AliRtcConnectionStatusInit",t[t.AliRtcConnectionStatusDisconnected=1]="AliRtcConnectionStatusDisconnected",t[t.AliRtcConnectionStatusConnecting=2]="AliRtcConnectionStatusConnecting",t[t.AliRtcConnectionStatusConnected=3]="AliRtcConnectionStatusConnected",t[t.AliRtcConnectionStatusReconnecting=4]="AliRtcConnectionStatusReconnecting",t[t.AliRtcConnectionStatusFailed=5]="AliRtcConnectionStatusFailed",t))(G||{}),mt=(t=>(t[t.AliRtcConnectionChangedDummyReason=0]="AliRtcConnectionChangedDummyReason",t[t.AliRtcConnectionMediaPathChanged=1]="AliRtcConnectionMediaPathChanged",t[t.AliRtcConnectionSignalingHeartbeatTimeout=2]="AliRtcConnectionSignalingHeartbeatTimeout",t[t.AliRtcConnectionSignalingHeartbeatAlive=3]="AliRtcConnectionSignalingHeartbeatAlive",t[t.AliRtcConnectionSignalingHttpDnsResolved=4]="AliRtcConnectionSignalingHttpDnsResolved",t[t.AliRtcConnectionSignalingHttpDnsFailure=5]="AliRtcConnectionSignalingHttpDnsFailure",t[t.AliRtcConnectionSignalingGslbFailure=6]="AliRtcConnectionSignalingGslbFailure",t[t.AliRtcConnectionSignalingGslbSuccess=7]="AliRtcConnectionSignalingGslbSuccess",t[t.AliRtcConnectionSignalingJoinRoomFailure=8]="AliRtcConnectionSignalingJoinRoomFailure",t[t.AliRtcConnectionSignalingJoinRoomSuccess=9]="AliRtcConnectionSignalingJoinRoomSuccess",t[t.AliRtcConnectionSignalingLeaveRoom=10]="AliRtcConnectionSignalingLeaveRoom",t[t.AliRtcConnectionSignalingConnecting=11]="AliRtcConnectionSignalingConnecting",t[t.AliRtcConnectionChangedNetworkInterrupted=12]="AliRtcConnectionChangedNetworkInterrupted",t))(mt||{}),Zi=(t=>(t[t.AliRtcUserOfflineQuit=0]="AliRtcUserOfflineQuit",t[t.AliRtcUserOfflineDropped=1]="AliRtcUserOfflineDropped",t[t.AliRtcUserOfflineBecomeAudience=2]="AliRtcUserOfflineBecomeAudience",t))(Zi||{}),kt=(t=>(t[t.AliRtcAudioTrackNo=0]="AliRtcAudioTrackNo",t[t.AliRtcAudioTrackMic=1]="AliRtcAudioTrackMic",t[t.AliRtcAudioTrackDual=2]="AliRtcAudioTrackDual",t))(kt||{}),W=(t=>(t[t.AliRtcVideoTrackNo=0]="AliRtcVideoTrackNo",t[t.AliRtcVideoTrackCamera=1]="AliRtcVideoTrackCamera",t[t.AliRtcVideoTrackScreen=2]="AliRtcVideoTrackScreen",t[t.AliRtcVideoTrackBoth=3]="AliRtcVideoTrackBoth",t))(W||{}),B=(t=>(t[t.AliRtcStatePublishIdle=0]="AliRtcStatePublishIdle",t[t.AliRtcStateNoPublish=1]="AliRtcStateNoPublish",t[t.AliRtcStatePublishing=2]="AliRtcStatePublishing",t[t.AliRtcStatePublished=3]="AliRtcStatePublished",t))(B||{}),te=(t=>(t[t.AliRtcStateSubscribeIdle=0]="AliRtcStateSubscribeIdle",t[t.AliRtcStateNoSubscribe=1]="AliRtcStateNoSubscribe",t[t.AliRtcStateSubscribing=2]="AliRtcStateSubscribing",t[t.AliRtcStateSubscribed=3]="AliRtcStateSubscribed",t))(te||{}),he=(t=>(t[t.AliRtcVideoStreamTypeNone=0]="AliRtcVideoStreamTypeNone",t[t.AliRtcVideoStreamTypeHigh=1]="AliRtcVideoStreamTypeHigh",t[t.AliRtcVideoStreamTypeLow=2]="AliRtcVideoStreamTypeLow",t))(he||{}),Ft=(t=>(t[t.CAMERA_INVALID=-1]="CAMERA_INVALID",t[t.CAMERA_REAR=0]="CAMERA_REAR",t[t.CAMERA_FRONT=1]="CAMERA_FRONT",t))(Ft||{});const ts=10,is=5e3,Ti=class Ti extends Q{constructor(e){super();l(this,"ws");l(this,"socketStatus",0);l(this,"wsUrl","");l(this,"lastConnectStartTime",0);l(this,"maxConnectRetryCount",ts);l(this,"connectRetryCount",0);l(this,"gotErr",!1);l(this,"closedByInvoke",!0);l(this,"isReconnecting",!1);l(this,"networkAvailableChecked",!0);this.maxConnectRetryCount=e!=null?e:ts,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 i=this.socketStatus;if(E.info(Ti.logName,`onClose, status: ${i}, retryCount: ${this.connectRetryCount}`),i!==0||this.connectRetryCount)if(yield it.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>=is?this.reconnect():window.setTimeout(()=>{this.reconnect()},is)}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)}};l(Ti,"logName","Socket");let er=Ti;var ue=(t=>(t.KEEPALIVE="keepalive",t.JOINCHANNEL="joinchannel",t.NOTIFYJOIN="notifyjoin",t.NOTIFYSTATUS="notifystatus",t.STATUSREPORT="statusreport",t.LEAVECHANNEL="leavechannel",t.NOTIFYLEAVE="notifyleave",t.NOTIFYPUBLISH="notifypublish",t.BYE="bye",t.RECONNECT="reconnect",t.PUBLISH="publish",t.REFRESHURL="refreshurl",t.UNSUBSCRIBE="unsubscribe",t.ROLEUPDATE="roleupdate",t))(ue||{});class en{constructor(r,e){l(this,"authInfo");l(this,"userName");l(this,"seqIndex",0);this.authInfo=r,this.userName=e}get roleAuth(){if(this.authInfo.role){const{timestamp:r,nonce:e,token:i,role:s}=this.authInfo;return{timestamp:r,nonce:e,token:i,tokenrole:s}}}refreshAuthInfo(r){this.authInfo=r}getSeqIndex(){return this.seqIndex}createKeepAlivePackage(){return this.createBaseSendPackage("keepalive")}createJoinPackage(){let r=this.createBaseSendPackage("joinchannel");return r.header.displayName=this.userName,r.header.clientversion=it.getVersionNumber().toString(),r.header.platform=Zr,this.roleAuth&&(r.data.auth=this.roleAuth),r}crateLeavePackage(){return this.createBaseSendPackage("leavechannel")}createStatusPackage(r){let e=this.createBaseSendPackage("statusreport");return e.header.displayName=this.userName,e.data.status=r,e}createPublishPackage(){let r=this.createBaseSendPackage("publish");return r.data.users=[{}],this.roleAuth&&(r.data.auth=this.roleAuth),r}createRoleUpdatePackage(){let r=this.createBaseSendPackage("roleupdate");return r.header.displayName=this.userName,r}createReconnectPackage(r){let e=this.createBaseSendPackage("reconnect");return e.header.displayName=this.userName,e.header.clientversion=it.getVersionNumber().toString(),e.header.platform=Zr,e.data=q(q({},e.data),r!=null?r:{}),this.roleAuth&&(e.data.auth=this.roleAuth),e}createRefreshUrlPackage(){let r=this.createBaseSendPackage("refreshurl");return r.header.displayName=this.userName,r}createResponsePackage(r,e){return{version:1,code:200,tid:r,msgtype:e}}createBaseSendPackage(r){var i;return++this.seqIndex,{version:1,msgtype:r,tid:D.Guid.create(32),header:{appid:this.authInfo.appId,channelid:this.authInfo.channelId,sessionid:(i=this.authInfo.callid)!=null?i:"",userid:this.authInfo.userId},data:{seq:this.seqIndex}}}}var N=(t=>(t[t.ERR_JOIN_ALREADY_JOINED=16843521]="ERR_JOIN_ALREADY_JOINED",t[t.ERR_JOIN_BAD_APPID=33620481]="ERR_JOIN_BAD_APPID",t[t.ERR_JOIN_INVALID_APPID=33620482]="ERR_JOIN_INVALID_APPID",t[t.ERR_JOIN_BAD_CHANNEL=33620484]="ERR_JOIN_BAD_CHANNEL",t[t.ERR_JOIN_INVALID_CHANNEL=33620483]="ERR_JOIN_INVALID_CHANNEL",t[t.ERR_JOIN_BAD_TOKEN=33620485]="ERR_JOIN_BAD_TOKEN",t[t.ERR_JOIN_TIMEOUT=16908804]="ERR_JOIN_TIMEOUT",t[t.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD=16974081]="ERR_JOIN_ERR_JOIN_BAD_PARAMBAD",t[t.ERR_JOIN_CHANNEL_FAILED=16974338]="ERR_JOIN_CHANNEL_FAILED",t[t.ERR_LOG_ALREADY_INIT=16974085]="ERR_LOG_ALREADY_INIT",t[t.ERR_LOG_ROOT_PATH_ERROR=16974086]="ERR_LOG_ROOT_PATH_ERROR",t[t.ERR_MIC_OPEN_FAIL=17040388]="ERR_MIC_OPEN_FAIL",t[t.ERR_SPEAKER_OPEN_FAIL=17040389]="ERR_SPEAKER_OPEN_FAIL",t[t.ERR_MIC_INTERRUPT=17040390]="ERR_MIC_INTERRUPT",t[t.ERR_SPEAKER_INTERRUPT=17040391]="ERR_SPEAKER_INTERRUPT",t[t.ERR_MIC_AUTH_FAIL=17040392]="ERR_MIC_AUTH_FAIL",t[t.ERR_MIC_NOT_AVAILABLE=17040393]="ERR_MIC_NOT_AVAILABLE",t[t.ERR_SPEAKER_NO_AVAILABLE=17040400]="ERR_SPEAKER_NO_AVAILABLE",t[t.ERR_CAMERA_OPEN_FAIL=17039620]="ERR_CAMERA_OPEN_FAIL",t[t.ERR_CAMERA_INTERRUPT=17039622]="ERR_CAMERA_INTERRUPT",t[t.ERR_VIDEO_DISPLAY_OPEN_FAIL=17039873]="ERR_VIDEO_DISPLAY_OPEN_FAIL",t[t.ERR_VIDEO_DISPLAY_INTERRUPT=1064992]="ERR_VIDEO_DISPLAY_INTERRUPT",t[t.ERR_ICE_CONNECTION_CONNECT_FAIL=17105409]="ERR_ICE_CONNECTION_CONNECT_FAIL",t[t.ERR_ICE_CONNECTION_RECONNECT_FAI=17105410]="ERR_ICE_CONNECTION_RECONNECT_FAI",t[t.ERR_ICE_CONNECTION_MOBILITY_FAIL=17105411]="ERR_ICE_CONNECTION_MOBILITY_FAIL",t[t.ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT=16908812]="ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT",t[t.ERR_LATENCY_LIVE_COMMUNICATION_FAILED=17235971]="ERR_LATENCY_LIVE_COMMUNICATION_FAILED",t[t.ERR_LATENCY_LIVE_MEIDASETTING_FAILED=17235972]="ERR_LATENCY_LIVE_MEIDASETTING_FAILED",t[t.ERR_LATENCY_LIVE_NONE_BROADCASTER=17235973]="ERR_LATENCY_LIVE_NONE_BROADCASTER",t[t.ERR_LATENCY_LIVE_NEED_RESTART=17235974]="ERR_LATENCY_LIVE_NEED_RESTART",t[t.ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER=17235975]="ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER",t[t.ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE=17235976]="ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE",t[t.ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION=17235977]="ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION",t[t.ERR_SDK_PUBLISH_INVAILD=16974597]="ERR_SDK_PUBLISH_INVAILD",t[t.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL=16843782]="ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL",t[t.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED=16843856]="ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED",t[t.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED=16843857]="ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED",t[t.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED=16843858]="ERR_SDK_PUBLISH_DUAL_STRAM_FAILED",t[t.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED=16843859]="ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED",t[t.ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR=16843860]="ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR",t[t.ERR_SDK_SUBSCRIBE_INVAILD=16974852]="ERR_SDK_SUBSCRIBE_INVAILD",t[t.ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL=16844112]="ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL",t[t.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED=16844113]="ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED",t[t.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED=16844114]="ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED",t[t.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED=16844115]="ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED",t[t.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED=16844116]="ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED",t[t.ERR_SDK_INVALID_STATE=16974340]="ERR_SDK_INVALID_STATE",t[t.ERR_INVALID_ARGUMENTS=16974083]="ERR_INVALID_ARGUMENTS",t[t.ERR_SESSION_REMOVED=33620229]="ERR_SESSION_REMOVED",t[t.ERR_SDK_UPDATE_ROLE_CHANNEL=16908801]="ERR_SDK_UPDATE_ROLE_CHANNEL",t[t.ERR_INNER=-1]="ERR_INNER",t[t.ERR_SDK_MPU_TASK_PUBLISH_OK=0]="ERR_SDK_MPU_TASK_PUBLISH_OK",t[t.ERR_SDK_MPU_TASK_STREAM_NOT_FOUND=17825793]="ERR_SDK_MPU_TASK_STREAM_NOT_FOUND",t[t.ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST=17825794]="ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST",t[t.ERR_SDK_MPU_TASK_INVALID_PARAM=17825795]="ERR_SDK_MPU_TASK_INVALID_PARAM",t[t.ERR_SDK_MPU_TASK_INTERNAL_ERROR=17825796]="ERR_SDK_MPU_TASK_INTERNAL_ERROR",t[t.ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR=17825797]="ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR",t[t.ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR=17825798]="ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR",t[t.ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT=17825799]="ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT",t[t.ERR_SDK_MPU_TASK_NOT_AUTHORIZED=17825800]="ERR_SDK_MPU_TASK_NOT_AUTHORIZED",t[t.ERR_SDK_CHANNEL_RELAY_STATE_ERROR=18874369]="ERR_SDK_CHANNEL_RELAY_STATE_ERROR",t[t.ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW=18874370]="ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW",t[t.ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED=18874371]="ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED",t[t.ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID=18874372]="ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID",t[t.ERR_SDK_CHANNEL_RELAY_ROLE_ERROR=18874373]="ERR_SDK_CHANNEL_RELAY_ROLE_ERROR",t[t.ERR_SDK_CHANNEL_RELAY_INVALID_PARAM=18874374]="ERR_SDK_CHANNEL_RELAY_INVALID_PARAM",t[t.ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR=18874375]="ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR",t))(N||{});class C extends Error{constructor(e,i,s){super(i);l(this,"_code");l(this,"_extra");this._code=e,this._extra=s}static fromError(e,i=-1,s=""){return new C(i,e.message||e.reason||s||"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 tn=3e4;class rn extends Q{constructor(e,i,s,a,n){super();l(this,"authInfo");l(this,"userName");l(this,"channelProfile");l(this,"clientRole");l(this,"wsClient");l(this,"packageCreater");l(this,"keepAliveTimer",0);l(this,"packageCache",new Map);l(this,"isFirstConnect",!0);l(this,"aliveChecker",0);l(this,"reconnectData");this.authInfo=e,this.userName=i,this.packageCreater=new en(e,i),this.channelProfile=s,this.clientRole=a,this.wsClient=new er(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 i=this.packageCreater.createStatusPackage(e);this.sendPackage(i)}publish(e){let i=this.packageCreater.createPublishPackage();i.data.users=[],e.subscribe.signal=this.wsClient.connectUrl;const{tracks:s,resume:a}=e;s.forEach(n=>{const{codec:o,ssrc:c}=n;n.userdata=JSON.stringify({codec:o}),n.ssrc=`${c}`,a&&(n.attr={reason:"reconnect"})}),i.data.users.push(e),this.sendPackage(i)}roleUpdate(e){let i=this.packageCreater.createRoleUpdatePackage();i.data.clientrole=e,this.sendPackage(i)}refreshUrl(e){const i=this.packageCreater.createRefreshUrlPackage();i.data=q(Lt(q({},i.data),{sessionid:i.header.sessionid}),e),this.sendPackage(i)}refreshAuthInfo(e){this.authInfo=e,this.packageCreater.refreshAuthInfo(e)}close(){E.info("[roomsigcenter] 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){[ue.KEEPALIVE,ue.RECONNECT,ue.JOINCHANNEL].includes(e.msgtype)||this.packageCache.set(e.tid,e),this.wsClient.send(e)}updateReconnectData(e){this.reconnectData=e}onOpen(){if(E.info("[roomsigcenter] 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 i=JSON.parse(e.data);this.packageCache.delete(i.tid),this.onRecvMessage(i)}catch(i){E.error("[roomsigcenter] onMessage err",i,e)}}onError(e){E.error("[roomsigcenter] onError",e),this.isFirstConnect&&this.onConnectFail()}onConnectFail(){E.error("[roomsigcenter] onConnectFail");const e=new C(N.ERR_INNER,"Signaling connect failed.");this.isFirstConnect?this.emit("onJoinChannelResult",e):this.emit("onConnectFail",e)}onAuthInvalid(){E.error("[roomsigcenter] onAuthInvalid"),this.isFirstConnect&&this.emit("onAuthInvalid")}onNetworkError(){E.error("[roomsigcenter] onNetworkError");const e=new C(N.ERR_INNER,"Network error, signaling connect failed.");this.emit("onNetworkError",e)}onClose(e){E.info("[roomsigcenter] onClose",e),this.stopKeepAlive()}onKeepAliveRsp(){this.emit("onKeepAliveRsp"),this.checkAlive()}onReconnectStart(){this.emit("onReconnectStart")}onReconnectFail(){this.emit("onReconnectFail",new C(N.ERR_INNER,"signaling reconnect failed."))}checkAlive(){window.clearTimeout(this.aliveChecker),this.aliveChecker=window.setTimeout(()=>{E.info("[roomsigcenter] not alive, reconnect"),this.stopKeepAlive(),this.emit("onReconnectStart"),this.wsClient.reconnect()},tn)}onRecvMessage(e){switch(e.msgtype!==ue.KEEPALIVE&&E.info("[roomsigcenter] recv msg "+e.msgtype),e.msgtype){case ue.JOINCHANNEL:this.onJoinResult(e);break;case ue.KEEPALIVE:this.onKeepAliveRsp();break;case ue.PUBLISH:this.onPublishResult(e);break;case ue.NOTIFYJOIN:this.onNotifyJoin(e);break;case ue.NOTIFYSTATUS:this.onNotifyStatus(e);break;case ue.LEAVECHANNEL:this.onLeaveResult(e);break;case ue.NOTIFYLEAVE:this.onNotifyLeave(e);break;case ue.NOTIFYPUBLISH:this.onNotifyPublish(e);break;case ue.STATUSREPORT:this.onStatusReport(e);break;case ue.BYE:this.onBye(e);break;case ue.ROLEUPDATE:this.onRoleUpdateResult(e);break;case ue.REFRESHURL:this.onRefreshUrlResult(e);break;case ue.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 i=new C(N.ERR_INNER,`reconnect failed, code: ${e.code};description: ${e.description}`);e.code===403&&(i.code=403),this.emit("onReconnectFail",i),this.close()}}onNotifyJoin(e){let i=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(i),e&&e.data&&e.data.users&&this.emit("onNotifyJoin",e.data.users)}onNotifyStatus(e){let i=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(i),e.data&&e.data.status&&e.data.status.length&&this.emit("onNotifyStatus",e.data.status)}onNotifyLeave(e){let i=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(i),e.data&&e.data.users&&e.data.users.length&&this.emit("onNotifyLeave",e.data.users)}onNotifyPublish(e){let i=this.packageCreater.createResponsePackage(e.tid,e.msgtype);this.wsClient.send(i),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)}}const y=(t,r)=>(e,i,s)=>{const a=s.value;return s.value=function(...n){var p;const o=`[${((p=e.constructor)==null?void 0:p.logName)||""}]`,c=Date.now();let h=[];t&&(h=t(n)),E.interface(o,i,...h);const f=a.apply(this,n);return Promise.resolve(f).then(u=>u).catch(u=>u).then(u=>{let g="";const m=u instanceof Error;!r&&!m||(m?g=u:r&&(u===void 0?g="":g=r(u)),E.interfaceResult(o,i,!m,`${Date.now()-c}ms`,g))}),f},s},I=t=>t;var sn=Object.defineProperty,an=Object.getOwnPropertyDescriptor,tr=(t,r,e,i)=>{for(var s=i>1?void 0:i?an(r,e):r,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(i?n(r,e,s):n(s))||s);return i&&s&&sn(r,e,s),s};const hi=(Ee=class extends Q{constructor(e,i,s=rt.prod){super();l(this,"messageCenter");l(this,"authInfo");l(this,"userName");l(this,"channelProfile");l(this,"clientRole");l(this,"reconnectData");l(this,"roomServerUri","");this.channelProfile=e,this.clientRole=i,this.reconnectData={role:{channelprofile:e,clientrole:i}};const a=s===rt.pre?ai.pre:ai.prod;this.roomServerUri=`wss://${a}/roomserver/v1/ws`}updateReconnectData(e){var i;this.reconnectData=e,(i=this.messageCenter)==null||i.updateReconnectData(this.reconnectData)}reset(){E.info("[roomsig] reset"),this.messageCenter&&(this.messageCenter.close(),this.messageCenter=void 0),this.authInfo=void 0}join(e,i,s){return v(this,null,function*(){return new Promise((a,n)=>{E.setTraceID(e.channelId+"-"+e.callid),this.authInfo=e,this.userName=i,this.messageCenter=new rn(e,i,this.channelProfile,this.clientRole,s),this.initMessageCenter(),this.messageCenter.once("onJoinChannelResult",c=>{var h,f;if(E.info("join result: ",c),c.code==200){(h=this.messageCenter)==null||h.sendPkgCache(),(f=this.messageCenter)==null||f.startKeepAlive();let p=c.data;p.tid=c.tid,p.users=c.data.users,p.timestamp=c.timestamp,a(p)}else this.reset(),n(this.handleSignalError(c.code,c.reason,N.ERR_JOIN_CHANNEL_FAILED))}),this.messageCenter.once("onAuthInvalid",()=>{this.reset(),n(new C(N.ERR_JOIN_BAD_TOKEN,"join failed because authentication failed"))}),E.info(`[${Ee.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:D.Guid.create(32)};e.role&&(o.tokenrole=e.role),this.messageCenter.start(this.roomServerUri+"?"+it.queryingParam(o))})})}leave(){return E.info("[roomsig] leave .."),new Promise((e,i)=>{this.messageCenter?(this.messageCenter.on("onLeaveResult",(s,a)=>{E.info(`[${Ee.logName}]`,"recv leave response "+s),s===200?(this.updateReconnectData(),this.reset(),e({tid:a})):i(this.handleSignalError(s,"leave error"))}),E.info(`[${Ee.logName}]`,"send leave request"),this.messageCenter.leave()):(E.info(`[${Ee.logName}]`,"no message center, ok to leave"),e({tid:""}))})}publish(e){return new Promise((i,s)=>{var a;this.messageCenter?(this.messageCenter.once("onPublishResult",(n,o,c)=>{E.info(`[${Ee.logName}]`,"recv pubish response "+n),n===200?(this.updateReconnectData(Lt(q({},this.reconnectData),{publish:{users:[e]}})),i({tid:o})):s(this.handleSignalError(n,`publish error, ${c}`))}),this.authInfo&&(e.sessionid=(a=this.authInfo.callid)!=null?a:""),e.callid=D.Guid.create(32),E.info(`[${Ee.logName}]`,"assign callid "+e.callid+" and send publish request"),this.messageCenter.publish(e)):s(this.handleSignalError(-1,"publish error, no message center"))})}roleUpdate(e){return new Promise((i,s)=>{if(!this.messageCenter){s(this.handleSignalError(-1,"role update error, no message center"));return}this.messageCenter.on("onRoleUpdateResult",(a,n,o)=>{var c,h;E.info(`[${Ee.logName}]`,"recv role update response "+a),a===200?((h=(c=this.reconnectData)==null?void 0:c.role)!=null&&h.clientrole&&(this.reconnectData.role.clientrole=e,this.updateReconnectData(this.reconnectData)),i({tid:n})):s(this.handleSignalError(a,`role update error, ${o}`))}),this.messageCenter.roleUpdate(e)})}setChannelProfile(e){this.channelProfile=e}refreshUrl(e){return E.info(`[${Ee.logName}]`,"refreshUrl .."),new Promise((i,s)=>{if(!this.messageCenter){s(this.handleSignalError(-1,"refresh url error, no message center"));return}this.messageCenter.on("onRefreshUrlResult",a=>{const{code:n,description:o,data:c={}}=a||{};E.info("recv refresh url response "+n),n===200?i(c):s(this.handleSignalError(n,`refresh url error, ${o}`))}),E.info("send refresh url request"),this.messageCenter.refreshUrl(e)})}reportStatus(e){return E.info(`[${Ee.logName}]`,"reportStatus "+e),new Promise((i,s)=>{this.messageCenter?(this.messageCenter.once("onStatusReport",(a,n)=>{a===200?i():s(new C(a,n))}),this.messageCenter.reportStatus(e)):s(new C(-1,"No messageCenter"))})}handleSignalError(e,i,s=N.ERR_INNER){const a=`signal error: code - ${e}; description - ${i}`;return new C(s,a)}refreshAuthInfo(e){return v(this,null,function*(){var i;this.authInfo&&(this.authInfo=e,(i=this.messageCenter)==null||i.refreshAuthInfo(this.authInfo))})}initMessageCenter(){var e,i,s,a,n,o,c,h,f,p,u,g;(e=this.messageCenter)==null||e.on("onKeepAliveRsp",()=>{this.emit("onKeepAliveRsp")}),(i=this.messageCenter)==null||i.on("onNotifyJoin",m=>{this.emit("onNotifyJoin",m)}),(s=this.messageCenter)==null||s.on("onNotifyStatus",m=>{this.emit("onNotifyStatus",m)}),(a=this.messageCenter)==null||a.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,d)=>{this.emit("onBye",m,d)}),(c=this.messageCenter)==null||c.on("onReconnectStart",()=>{this.emit("onReconnectStart")}),(h=this.messageCenter)==null||h.on("onReconnectSuccess",m=>{this.emit("onReconnectSuccess",m)}),(f=this.messageCenter)==null||f.on("onReconnectFail",m=>{this.emit("onReconnectFail",m)}),(p=this.messageCenter)==null||p.on("onConnectFail",m=>{this.emit("onConnectFail",m),this.reset()}),(u=this.messageCenter)==null||u.on("onNetworkError",m=>{this.emit("onNetworkError",m)}),(g=this.messageCenter)==null||g.on("onAuthInvalid",()=>{this.emit("onAuthInvalid")})}},l(Ee,"logName","RoomServerSignaling"),Ee);tr([y()],hi.prototype,"join",1),tr([y()],hi.prototype,"publish",1),tr([y()],hi.prototype,"roleUpdate",1);let nn=hi;class on extends Q{constructor(e,i,s=rt.prod){super();l(this,"signaling");l(this,"authInfo");l(this,"userName");l(this,"channelProfile");l(this,"clientRole");l(this,"env",rt.prod);l(this,"maxConnectRetryCount");this.channelProfile=e,this.clientRole=i,this.env=s}reset(){var e;E.info("[signalingmanager] reset"),(e=this.signaling)==null||e.reset(),this.signaling=void 0,this.authInfo=void 0}join(e,i=e.userId,s){return this.maxConnectRetryCount=s,this.userName=i,new Promise((a,n)=>{this.signaling?n(new C(N.ERR_JOIN_ALREADY_JOINED,"already joined")):(E.info("[signalingmanager] create signaling"),this.signaling=new nn(this.channelProfile,this.clientRole,this.env),this.initSignaling(),this.signaling.join(e,i,s).then(o=>{this.authInfo=e,a(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,i)=>{this.signaling?this.signaling.leave().then(s=>{this.reset(),e(s)}).catch(s=>{i(s)}):e({tid:""})})}publish(e){return new Promise((i,s)=>{var a;this.signaling&&this.authInfo?(e.userid=this.authInfo.userId,e.displayname=(a=this.userName)!=null?a:this.authInfo.userId,this.signaling.publish(e).then(n=>{i(n)}).catch(n=>{s(n)})):s(new C(N.ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL,"no signaling"))})}reportStatus(e){return new Promise((i,s)=>{this.signaling?this.signaling.reportStatus(e).then(()=>{i()}).catch(a=>{s(a)}):s(new C(-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 C(N.ERR_SDK_INVALID_STATE,"should join first"))}refreshAuthInfo(e){return v(this,null,function*(){var i;try{this.authInfo&&(this.authInfo=q(q({},this.authInfo),e),(i=this.signaling)==null||i.refreshAuthInfo(this.authInfo))}catch(s){throw s}})}initSignaling(){var e,i,s,a,n,o,c,h,f,p,u,g,m;(e=this.signaling)==null||e.on("onKeepAliveRsp",this.onKeepAliveRsp.bind(this)),(i=this.signaling)==null||i.on("onNotifyJoin",this.onNotifyJoin.bind(this)),(s=this.signaling)==null||s.on("onNotifyStatus",this.onNotifyStatus.bind(this)),(a=this.signaling)==null||a.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)),(h=this.signaling)==null||h.on("onReconnectSuccess",this.onReconnectSuccess.bind(this)),(f=this.signaling)==null||f.on("onReconnectFail",this.onReconnectFail.bind(this)),(p=this.signaling)==null||p.on("onConnectFail",this.onConnectFail.bind(this)),(u=this.signaling)==null||u.on("onNetworkError",this.onNetworkError.bind(this)),(g=this.signaling)==null||g.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,i){this.emit("onBye",e,i)}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 wt=class wt{static getInstance(){return wt.instance||(wt.instance=new AudioContext),wt.instance.resume(),wt.instance}};l(wt,"instance");let ir=wt;function cn(t,r,e,i,s){let a=i,n=0,o;const c=t.createAnalyser();c.fftSize=256;const h=new Uint8Array(c.frequencyBinCount);r.connect(c),c.connect(e);const f=()=>{o&&window.clearInterval(o)},p=()=>{o=window.setInterval(()=>{c.getByteFrequencyData(h);let u=Math.round(h.reduce((g,m)=>g+m)/h.length);u=Math.min(100,u),n=u,s&&s(u)},a)};return p(),{updateInterval:u=>{f(),a=u,p()},getLevel:()=>n,dispose:()=>{f(),r.disconnect(),c.disconnect()}}}class un extends Q{constructor(){super();l(this,"audioContext");l(this,"stream");l(this,"sourceNode");l(this,"analyser");this.audioContext=ir.getInstance(),this.stream=new MediaStream}getLevel(){return this.analyser?this.analyser.getLevel():0}start(e,i=1e3){this.sourceNode&&this.stop(),this.stream.addTrack(e),this.sourceNode=this.audioContext.createMediaStreamSource(this.stream);const s=this.audioContext.createMediaStreamDestination();this.analyser=cn(this.audioContext,this.sourceNode,s,i,a=>{this.emit("audioLevel",a)})}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 rs extends Q{constructor(e,i,s,a){super();l(this,"uid");l(this,"name");l(this,"rtsManager");l(this,"callid","");l(this,"audioLevelMonitor");l(this,"audioVolumeIndicationInterval",0);this.uid=e,this.name=i,this.rtsManager=s,this.audioVolumeIndicationInterval=a,this.audioLevelMonitor=new un}get userId(){return this.uid}get displayname(){return this.name}setUserInfo(e,i){this.uid=e,this.name=i}refreshUserInfo(e){this.uid=e}getAudioLevel(){return this.audioLevelMonitor.getLevel()}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval=e}clear(){this.audioLevelMonitor.dispose()}}class ss{static getCurrentStatus(r){let e=0;r.micOpen&&(e+=1),r.micInterrupted&&(e+=2),r.cameraOpen&&(e+=4),r.screenShare&&(e+=128),r.audioDisable&&(e+=8),r.videoDisable&&(e+=16),r.screenDisable&&(e+=256);let i=e.toString(16);for(;i.length<16;)i="0"+i;return i}static parseStatus(r){let e=parseInt(r,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 as="customVideoProfile",ns="customScreenProfile",jt={width:1280,height:720,frameRate:30,maxBitrate:2e3},$t={width:1920,height:1080,frameRate:30,maxBitrate:2600},hn={1e4:re.AliEngineLocalDeviceExceptionTypeUnknown,2e4:re.AliEngineLocalDeviceExceptionTypeUnknown,10001:re.AliEngineLocalDeviceExceptionTypeMicNotAvailable,10002:re.AliEngineLocalDeviceExceptionTypeMicAuthFail,10003:re.AliEngineLocalDeviceExceptionTypeMicOpenFail,10005:re.AliEngineLocalDeviceExceptionTypeCameraAuthFail,10004:re.AliEngineLocalDeviceExceptionTypeVideoDeviceException,10006:re.AliEngineLocalDeviceExceptionTypeCameraOpenFail,10010:re.AliEngineLocalDeviceExceptionTypeDisplayException,10011:re.AliEngineLocalDeviceExceptionTypeDisplayException,10012:re.AliEngineLocalDeviceExceptionTypeDisplayException,10013:re.AliEngineLocalDeviceExceptionTypeDisplayException,10014:re.AliEngineLocalDeviceExceptionTypeDisplayException,10019:re.AliEngineLocalDeviceExceptionTypeDisplayException},ln=t=>t.getAudioTracks()[0];function os(t){var r;if(((r=t==null?void 0:t.nodeName)==null?void 0:r.toLowerCase())==="video")return t.setAttribute("playsinline",""),t;if(typeof t=="string"){let e=document.getElementById(t);if(e){if(e.nodeName.toLocaleLowerCase()==="video")return e.setAttribute("playsinline",""),e;throw new C(N.ERR_INVALID_ARGUMENTS,"element should be HtmlVideoElement")}else throw new C(N.ERR_INVALID_ARGUMENTS,"element not founded")}else throw new C(N.ERR_INVALID_ARGUMENTS,"element id should be string")}function rr(t){var e;const r=[];if(Array.isArray(t))t.forEach(i=>{try{r.push(os(i))}catch(s){}});else if(typeof t=="string"||((e=t==null?void 0:t.nodeName)==null?void 0:e.toLowerCase())==="video")try{r.push(os(t))}catch(i){}return r}function at(t){return new Promise(r=>setTimeout(r,t))}const cs=(t,r)=>{const e=()=>(t.muted=!0,Promise.race([at(500),t._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{let i;return t.srcObject!==r?(t.load(),t.srcObject=r,i=t.play(),t._playPromise=i):i=Promise.resolve(),i}));return new Promise(i=>{if(D.BrowserUtil.isMicroMessenger){const s=window.top!==window.self,a=window.WeixinJSBridge||window.top.WeixinJSBridge;a?a.invoke("getNetworkType",{},()=>{i(e())}):(s?window.top.document:document).addEventListener("WeixinJSBridgeReady",()=>{a.invoke("getNetworkType",{},()=>{i(e())})}),setTimeout(()=>{i(e())},1e3)}else i(e())})},nt=t=>{Promise.race([at(100),t._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{t.srcObject=null,t._playPromise=void 0})};var dn=Object.defineProperty,pn=Object.getOwnPropertyDescriptor,oe=(t,r,e,i)=>{for(var s=i>1?void 0:i?pn(r,e):r,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(i?n(r,e,s):n(s))||s);return i&&s&&dn(r,e,s),s};class li extends Q{constructor(){super();l(this,"state");l(this,"time");this.state=B.AliRtcStatePublishIdle,this.time=Date.now()}setState(e){const i=this.state,s=this.time;this.state=e,this.time=Date.now(),this.emit("change",i,e,Math.floor((this.time-s)/1e3))}}const se=(ct=class extends rs{constructor(e){const{rtsManager:i,localStreamManager:s,reporter:a,webTrackingClient:n,signalingManager:o,audioVolumeIndicationInterval:c}=e;super("","",i,c);l(this,"url","");l(this,"_isPublishing",!1);l(this,"publishPromise",Promise.resolve(""));l(this,"previewElements",[]);l(this,"screenPreviewElements",[]);l(this,"streamManager");l(this,"streamTracks");l(this,"publishId",D.Guid.create(16));l(this,"signalingManager");l(this,"traceId","");l(this,"monitorTimerId");l(this,"reporter");l(this,"webTrackingClient");l(this,"audioPubState");l(this,"videoPubState");l(this,"videoSmallPubState");l(this,"screenPubState");l(this,"onTrackEnd",e=>{this.emit(e)});this.streamManager=s,this.signalingManager=o,this.reporter=a,this.webTrackingClient=n,this.streamManager.on("trackended",h=>{this.onTrackEnd(h)}),this.streamManager.on("publishupdate",()=>{this.publishUpdate()}),this.audioPubState=new li,this.audioPubState.on("change",(h,f,p)=>{this.emit("audioPublishStateChanged",h,f,p)}),this.videoPubState=new li,this.videoPubState.on("change",(h,f,p)=>{this.emit("videoPublishStateChanged",h,f,p)}),this.videoSmallPubState=new li,this.videoSmallPubState.on("change",(h,f,p)=>{this.emit("dualStreamPublishStateChanged",h,f,p)}),this.screenPubState=new li,this.screenPubState.on("change",(h,f,p)=>{this.emit("screenPublishStateChanged",h,f,p)})}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:i,type:s,msid:a})=>s==="video"&&i&&a===k.VideoLarge))}get hasCameraDualTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:i,type:s,msid:a})=>s==="video"&&i&&a===k.VideoSmall))}get hasScreenTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:i,type:s,msid:a})=>s==="video"&&i&&a===k.Screen))}get hasAudioTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:i,type:s,msid:a})=>s==="audio"&&i&&a===k.Audio))}get cameraDirection(){var e,i;return(i=(e=this.streamManager.cameraStreamInfo)==null?void 0:e.cameraVideoConstraints)==null?void 0:i.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,i){var s;this.setUserInfo(e.userId,e.userId),this.url=i,this.callid=(s=e.callid)!=null?s:"",this.updatePubId()}setVideoProfile(e,i){return v(this,null,function*(){yield this.streamManager.setVideoProfile(e,i)})}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,i){return v(this,null,function*(){yield this.streamManager.setScreenProfile(e,i)})}setCameraDirection(e){if(e===Ft.CAMERA_FRONT)this.streamManager.setCameraVideoConstraints({facingMode:"user"});else if(e===Ft.CAMERA_REAR)this.streamManager.setCameraVideoConstraints({facingMode:"environment"});else throw new C(N.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=D.Guid.create(16)}clearPublishState(){this.streamTracks=void 0}clear(){return v(this,null,function*(){Pr(ct.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)&&(nt(e),this.previewElements.splice(this.previewElements.indexOf(e),1)),this.screenPreviewElements.includes(e)&&(nt(e),this.screenPreviewElements.splice(this.screenPreviewElements.indexOf(e),1))}setPreviewElement(e){const{videoElement:i,screen:s}=e;s?this.screenPreviewElements.includes(i)||this.screenPreviewElements.push(i):this.previewElements.includes(i)||this.previewElements.push(i)}setViewConfig(e,i){if(!e){i===W.AliRtcVideoTrackCamera?this.stopPreview({primary:!0,screen:!1}):this.stopPreview({primary:!1,screen:!0});return}if(![W.AliRtcVideoTrackCamera,W.AliRtcVideoTrackScreen].includes(i))throw new C(N.ERR_INVALID_ARGUMENTS,"set view config invalid track",{track:i});e.forEach(s=>{this.setPreviewElement({videoElement:s,screen:i===W.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:i,screen:s}=e!=null?e:{};try{let a=s?this.streamManager.screenStreamInfo.previewStream:this.streamManager.cameraStreamInfo.previewStream;if(!i)throw new C(N.ERR_INVALID_ARGUMENTS,"no video element found",{videoElement:i});if(!a){E.info(`[${ct.logName}]`,"preview no stream founded");return}return cs(i,a.mediaStream),this.setPreviewElement(e),a.mediaStream}catch(a){const n=N.ERR_INNER;throw C.fromError(a,n,"preview failed")}})}previewAll(e){return v(this,null,function*(){const{primary:i=!0,screen:s=!0}=e!=null?e:{};if(i&&this.previewElements.length)for(let a=0;a<this.previewElements.length;a++){const n=this.previewElements[a];yield this.preview({videoElement:n})}if(s&&this.screenPreviewElements.length)for(let a=0;a<this.screenPreviewElements.length;a++){const n=this.screenPreviewElements[a];yield this.preview({videoElement:n,screen:!0})}})}stopPreview(e){const{videoElement:i,primary:s=!0,screen:a=!0}=e||{};if(!i)s&&(this.previewElements.forEach(n=>{nt(n)}),this.previewElements=[]),a&&(this.screenPreviewElements.forEach(n=>{nt(n)}),this.screenPreviewElements=[]);else{const n=this.previewElements.findIndex(o=>o===i);if(n>=0)this.previewElements.splice(n,1),nt(i);else{const o=this.screenPreviewElements.findIndex(c=>c===i);o>=0&&(this.screenPreviewElements.splice(o,1),nt(i))}}}resumePublish(){return v(this,null,function*(){this._isPublishing=!1,yield this.startPublish(!0)})}createLocalStream(e){return v(this,null,function*(){try{const i=yield this.streamManager.createLocalStream(e);return i!=null&&i.audioTrack&&this.audioVolumeIndicationInterval>0&&this.audioLevelMonitor.start(i.audioTrack,this.audioVolumeIndicationInterval),e.video?this.previewAll({primary:!0}):e.screen&&this.previewAll({screen:!0}),i}catch(i){const s=hn[i.errorCode];throw s&&(e.audio?this.emit("localDeviceException",Ke.AliEngineLocalDeviceTypeMic,s,""):e.video?this.emit("localDeviceException",Ke.AliEngineLocalDeviceTypeCamera,s,""):e.screen?this.emit("localDeviceException",Ke.AliEngineLocalDeviceTypeDisplay,s,""):this.emit("localDeviceException",Ke.AliEngineLocalDeviceTypeUnknown,s,"")),i}})}stopLocalStream(e){return v(this,null,function*(){e.audio&&this.audioLevelMonitor.stop(),yield this.streamManager.stopLocalStream(e)})}compareAndPublish(e,i,s){return v(this,null,function*(){var n,o;if(!e&&!i)return;if(e&&!i){const c={};return s===k.Audio?c.audio=!0:s===k.VideoLarge||s===k.VideoSmall?(c.video=!0,c.vMsid=s):s===k.Screen&&(c.screen=!0),yield this.publishDeleteTracks(c)}const a={};if(i!=null&&i.hasVideo&&(a.isScreen=s===k.Screen,a.vMsid=s),i!=null&&i.hasAudio&&(a.aMsid=s),!e&&i)return yield this.publishAdd(i,a,!1);if(e&&i){const c=e.trackId,h=((n=i.videoTrack)==null?void 0:n.id)||((o=i.audioTrack)==null?void 0:o.id);if(c!==h)return yield this.publishReplace(i,a)}})}startPublish(e=!1){return v(this,null,function*(){if(!this.joined)return;const i=yield this.streamManager.publishStreams,{audio:s,video:a,videoSmall:n,screen:o}=i;try{const c=new Date().getTime();s&&this.audioPubState.setState(B.AliRtcStatePublishing),a&&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 h=yield this.publishPromise;this._isPublishing=!0,this.streamTracks=this.rtsManager.publishingTracks,this.traceId=h;const f={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(f,i,c),s&&this.audioPubState.setState(B.AliRtcStatePublished),a&&this.videoPubState.setState(B.AliRtcStatePublished),n&&this.videoSmallPubState.setState(B.AliRtcStatePublished),o&&this.screenPubState.setState(B.AliRtcStatePublished)}catch(c){throw s&&this.audioPubState.setState(B.AliRtcStateNoPublish),a&&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 a,n,o,c;if(!this._isPublishing)return;yield this.publishPromise;const e=yield this.streamManager.publishStreams;let i;const s=new Date().getTime();try{const h=(a=this.streamTracks)==null?void 0:a.find(({ssrc:b,type:w,msid:_})=>w==="audio"&&b&&_===k.Audio),f=yield this.compareAndPublish(h,e.audio,k.Audio);f&&(i=f);const p=(n=this.streamTracks)==null?void 0:n.find(({ssrc:b,type:w,msid:_})=>w==="video"&&b&&_===k.VideoLarge),u=yield this.compareAndPublish(p,e.video,k.VideoLarge);u&&(i=u);const g=(o=this.streamTracks)==null?void 0:o.find(({ssrc:b,type:w,msid:_})=>w==="video"&&b&&_===k.VideoSmall),m=yield this.compareAndPublish(g,e.videoSmall,k.VideoSmall);m&&(i=m);const d=(c=this.streamTracks)==null?void 0:c.find(({ssrc:b,type:w,msid:_})=>w==="video"&&b&&_===k.Screen),S=yield this.compareAndPublish(d,e.screen,k.Screen);if(S&&(i=S),!i)return;yield this.syncPublishToRoomServer(i,e,s)}catch(h){const{code:f}=h!=null?h:{},p=this.url;throw f===403&&p&&(yield this.refreshPushStreamUrl(),i=yield this.publishUpdate()),h}return i})}syncPublishToRoomServer(e,i,s){return v(this,null,function*(){var p;if(!e)throw new C(N.ERR_INNER,"sync publish to room server failed because no publishInfo");const a=yield this.signalingManager.publish(e);e.signaltid=a.tid;const n=new Date().getTime()-s,o=!!i.video,c=!1,h=!!i.screen,f=!!i.audio;this.reporter.reportPublish(this.callid||"",o,c,h,f,0,a.tid,n),this.webTrackingClient.reportPush(this.callid||"",o,c,h,f,0,a.tid,n,s,e.traceid||"",this.traceId,(p=this.url)!=null?p:"")})}refreshPushStreamUrl(){return v(this,null,function*(){const e=new C(N.ERR_INNER,"refresh push stream url error"),i=this.url;if(!i)throw e;const s=yield this.signalingManager.refreshUrl({pushstreamurl:i});if(!(s!=null&&s.pushstreamurl))throw e;this.url=s==null?void 0:s.pushstreamurl})}publishAdd(e,i,s=!1,a=0){return v(this,null,function*(){const n=(i==null?void 0:i.aMsid)===k.Audio,o=(i==null?void 0:i.vMsid)===k.VideoLarge,c=(i==null?void 0:i.vMsid)===k.VideoSmall,h=(i==null?void 0:i.vMsid)===k.Screen;n&&this.audioPubState.setState(B.AliRtcStatePublishing),o&&this.videoPubState.setState(B.AliRtcStatePublishing),c&&this.videoSmallPubState.setState(B.AliRtcStatePublishing),h&&this.screenPubState.setState(B.AliRtcStatePublishing);try{const f=yield this.rtsManager.publishAdd(this.url,e,i,!1,0,!0);n&&this.audioPubState.setState(B.AliRtcStatePublished),o&&this.videoPubState.setState(B.AliRtcStatePublished),c&&this.videoSmallPubState.setState(B.AliRtcStatePublished),h&&this.screenPubState.setState(B.AliRtcStatePublished),this.streamTracks=this.rtsManager.publishingTracks;const p={userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:s,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callid,tracks:this.streamTracks,traceid:f};return this.reportSelfDeviceStatus(),p}catch(f){let p=N.ERR_SDK_PUBLISH_INVAILD;if(n&&(this.audioPubState.setState(B.AliRtcStateNoPublish),p=N.ERR_SDK_PUBLISH_AUDIO_STRAM_FAILED),o&&(this.videoPubState.setState(B.AliRtcStateNoPublish),p=N.ERR_SDK_PUBLISH_VIDEO_STRAM_FAILED),c&&(this.videoSmallPubState.setState(B.AliRtcStateNoPublish),p=N.ERR_SDK_PUBLISH_DUAL_STRAM_FAILED),h&&(this.screenPubState.setState(B.AliRtcStateNoPublish),p=N.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED),f.errorCode===15006&&a<3)return this.publishAdd(e,i,s,a+1);throw C.fromError(f,p,"publish add failed")}})}publishReplace(e,i){return v(this,null,function*(){try{yield this.rtsManager.publishReplace(this.url,e,i),this.traceId="",this.streamTracks=this.rtsManager.publishingTracks;const s={userid:this.userId,sessionid:"",pubid:this.publishId,displayname:this.name,subscribe:{signal:"",pullstreamurl:this.url},callid:this.callid,tracks:this.streamTracks};return this.reportSelfDeviceStatus(),s}catch(s){throw C.fromError(s,N.ERR_INNER,`publish replace failed, vMsid: ${i==null?void 0:i.vMsid} aMsid: ${i==null?void 0:i.aMsid}`)}})}publishDeleteTracks(e){return v(this,null,function*(){const i={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===k.VideoSmall?this.videoSmallPubState.setState(B.AliRtcStateNoPublish):this.videoPubState.setState(B.AliRtcStateNoPublish)),e.screen&&this.screenPubState.setState(B.AliRtcStateNoPublish),this.traceId="",i.tracks=this.streamTracks,this.reportSelfDeviceStatus(),i}catch(s){throw C.fromError(s,N.ERR_INNER,"publish delete tracks failed")}})}publishStop(){return v(this,null,function*(){if(!this._isPublishing)throw new C(N.ERR_INNER,"publish stop failed, previous localStream is required for publishing stopping");E.info(`[${ct.logName}]`,"publishStop",{url:this.url});const e=new Date().getTime();try{const i=this.hasAudioTrackInMS,s=this.hasCameraTrackInMS,a=this.hasCameraDualTrackInMS,n=this.hasScreenTrackInMS;yield this.rtsManager.publishStop(this.url),i&&this.audioPubState.setState(B.AliRtcStateNoPublish),s&&this.videoPubState.setState(B.AliRtcStateNoPublish),a&&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(i){throw C.fromError(i,N.ERR_INNER,"publish stop failed")}})}unPublish(){return v(this,null,function*(){const e=new Date().getTime();let i={userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callid,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{if(this._isPublishing){const s=this.hasAudioTrackInMS,a=this.hasCameraTrackInMS,n=this.hasCameraDualTrackInMS,o=this.hasScreenTrackInMS;yield this.rtsManager.unpublish(),s&&this.audioPubState.setState(B.AliRtcStateNoPublish),a&&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,""),i}catch(s){throw C.fromError(s,N.ERR_INNER,"unpublish failed")}})}reportSelfDeviceStatus(){this.emit(we.Local,this.getDeviceStatus())}getDeviceStatus(){var i,s,a,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=!((i=this.streamManager.cameraStreamInfo.originAudioTrack)!=null&&i.enabled),e.videoDisable=!((s=this.streamManager.cameraStreamInfo.originVideoTrack)!=null&&s.enabled),e.screenDisable=!this.hasScreenShare||!((n=(a=this.streamManager.screenStreamInfo)==null?void 0:a.originVideoTrack)!=null&&n.enabled),ss.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,i,s){return v(this,null,function*(){if(!this.url)return;let a=0;return!i||i<1?a=1:a=i-1,this.rtsManager.sendSEI(this.url,e,a,s)})}getStats(){return v(this,null,function*(){const e=[];if(this.hasAudioTrackInMS){const s=yield this.rtsManager.getPublishAudioStats(this.url);s&&e.push({stats:s,track:kt.AliRtcAudioTrackMic})}const i=[];if(this.hasCameraTrackInMS){const s=yield this.rtsManager.getPublishVideoStats(this.url,k.VideoLarge);s&&i.push({track:W.AliRtcVideoTrackCamera,streamType:he.AliRtcVideoStreamTypeHigh,stats:s})}if(this.hasCameraDualTrackInMS){const s=yield this.rtsManager.getPublishVideoStats(this.url,k.VideoSmall);s&&i.push({track:W.AliRtcVideoTrackCamera,streamType:he.AliRtcVideoStreamTypeLow,stats:s})}if(this.hasScreenTrackInMS){const s=yield this.rtsManager.getPublishVideoStats(this.url,k.Screen);s&&i.push({track:W.AliRtcVideoTrackScreen,stats:s})}return{audio:e,video:i}})}},l(ct,"logName","LocalUser"),ct);oe([y()],se.prototype,"clearPublishState",1),oe([y()],se.prototype,"clear",1),oe([y()],se.prototype,"setViewConfig",1),oe([y()],se.prototype,"startCameraCapture",1),oe([y()],se.prototype,"stopCameraCapture",1),oe([y()],se.prototype,"stopAudioCapture",1),oe([y()],se.prototype,"stopPreview",1),oe([y()],se.prototype,"resumePublish",1),oe([y()],se.prototype,"createLocalStream",1),oe([y()],se.prototype,"stopLocalStream",1),oe([y(I)],se.prototype,"startPublish",1),oe([y(([t])=>[t])],se.prototype,"syncPublishToRoomServer",1),oe([y()],se.prototype,"refreshPushStreamUrl",1),oe([y(([t,r,e])=>[JSON.stringify(e)])],se.prototype,"publishAdd",1),oe([y(([t,r])=>[JSON.stringify(r)])],se.prototype,"publishReplace",1),oe([y(I)],se.prototype,"publishDeleteTracks",1),oe([y()],se.prototype,"publishStop",1),oe([y()],se.prototype,"unPublish",1),oe([y(([t,r,e])=>[t.length,r,e])],se.prototype,"sendSEI",1);let us=se;var St=(t=>(t.OPUS="opus",t.H264="H264",t.UNKONWN="",t))(St||{}),bt=(t=>(t.VideoTrackEnded="videoTrackEnded",t.AudioTrackEnded="audioTrackEnded",t.ScreenTrackEnded="screenTrackEnded",t))(bt||{});const gn=t=>{const r=new MediaStream;return r.addTrack(t),r},hs=t=>v(this,null,function*(){return yield V.AliRTS.createStream({custom:!0,mediaStream:t})}),Wt=t=>v(this,null,function*(){const r=gn(t);return yield hs(r)}),fn=t=>{const{audio:r,video:e,screen:i}=t;if(e&&i)throw new C(N.ERR_INNER,"create stream error, cannot create video && screen together");return!(!e&&!r&&!i)},mn=t=>t===k.Audio||t===Wi.Audio,Sn=t=>t===k.VideoLarge||t===Wi.VideoLarge,bn=t=>t===k.VideoSmall,vn=t=>t===k.Screen;var yn=Object.defineProperty,wn=Object.getOwnPropertyDescriptor,_n=(t,r,e,i)=>{for(var s=i>1?void 0:i?wn(r,e):r,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(i?n(r,e,s):n(s))||s);return i&&s&&yn(r,e,s),s};class di extends Q{constructor(){super();l(this,"audioInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:St.UNKONWN});l(this,"videoLargeInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:St.UNKONWN});l(this,"videoSmallInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:St.UNKONWN});l(this,"screenInfo",{subscribed:!1,ssrc:"",msid:"",pt:0,red:0,codec:St.UNKONWN});l(this,"audioVolume",1);l(this,"audioMuted",!1);l(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:St.UNKONWN}get audioTrackInfo(){return this.hasAudio?kt.AliRtcAudioTrackMic:kt.AliRtcAudioTrackNo}get videoTrackInfo(){return this.hasVideo&&this.hasScreen?W.AliRtcVideoTrackBoth:this.hasVideo?W.AliRtcVideoTrackCamera:this.hasScreen?W.AliRtcVideoTrackScreen:W.AliRtcVideoTrackNo}updateTracks(e){let i="",s="",a="",n="";return e?(e.forEach(o=>{var f;let c=St.UNKONWN;const h=((f=o==null?void 0:o.attr)==null?void 0:f.reason)==="reconnect";if(o.userdata){const{codec:p}=JSON.parse(o.userdata);p&&(c=p)}mn(o.msid)?(i=o.ssrc,this.audioInfo.msid=o.msid,this.audioInfo.codec=c,h&&(this.audioInfo.subscribed=!1)):bn(o.msid)?(a=o.ssrc,this.videoSmallInfo.msid=o.msid,this.videoSmallInfo.codec=c,h&&(this.videoSmallInfo.subscribed=!1)):Sn(o.msid)?(s=o.ssrc,this.videoLargeInfo.msid=o.msid,this.videoLargeInfo.codec=c,h&&(this.videoLargeInfo.subscribed=!1)):vn(o.msid)&&(n=o.ssrc,this.screenInfo.msid=o.msid,this.screenInfo.codec=c,h&&(this.screenInfo.subscribed=!1))}),this.updateRemoteTrackSsrc(i,s,a,n)):this.updateRemoteTrackSsrc(i,s,a,n),{}}updateRemoteTrackSsrc(e,i,s,a){this.audioInfo.ssrc=e,this.videoSmallInfo.ssrc=s,this.videoLargeInfo.ssrc=i,this.screenInfo.ssrc=a}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 i=ss.parseStatus(e);const{audioDisable:s,videoDisable:a,screenDisable:n}=i;return this.userStatus?(this.userStatus.audioDisable!=s&&(this.userStatus.audioDisable=s,this.emit(we.Remote,s?J.MuteAudio:J.UnmuteAudio)),this.userStatus.videoDisable!=a&&(this.userStatus.videoDisable=a,this.emit(we.Remote,a?J.MuteVideo:J.UnmuteVideo)),this.userStatus.screenDisable!=n&&(this.userStatus.screenDisable=n,this.emit(we.Remote,n?J.MuteScreen:J.UnmuteScreen))):(this.userStatus=i,this.emit(we.Remote,s?J.MuteAudio:J.UnmuteAudio),this.emit(we.Remote,a?J.MuteVideo:J.UnmuteVideo),this.emit(we.Remote,n?J.MuteScreen:J.UnmuteScreen)),!1}}l(di,"logName","RemoteStreamInfo"),_n([y()],di.prototype,"updateRemoteTrackSubState",1);class ls{constructor(r){l(this,"remoteUser");this.remoteUser=r}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 Rn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,le=(t,r,e,i)=>{for(var s=i>1?void 0:i?In(r,e):r,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(i?n(r,e,s):n(s))||s);return i&&s&&Rn(r,e,s),s};class Kt extends Q{constructor(){super();l(this,"state");l(this,"time");l(this,"_enabled");this.state=te.AliRtcStateSubscribeIdle,this.time=Date.now(),this._enabled=!0}setState(e){if(this.state===e)return;const i=this.state,s=this.time;this.state=e,this.time=Date.now(),this.emit("change",i,e,Math.floor((this.time-s)/1e3))}get currentState(){return this.state}getEnabled(){return this._enabled}setEnabled(e){this._enabled=e}}const Pi=class Pi extends rs{constructor(e){var u;const{userId:i,displayName:s,rtsManager:a,usersViewMap:n,reporter:o,webTrackingClient:c,signalingManager:h,localUserId:f,audioVolumeIndicationInterval:p}=e;super(i,s,a,p);l(this,"remoteCallid","");l(this,"remoteUserInfo");l(this,"localUserId");l(this,"lastPubId","");l(this,"stream");l(this,"screenStream");l(this,"viewMap");l(this,"audioTrack");l(this,"audioElement");l(this,"subscribed",!1);l(this,"mediaStream");l(this,"secondaryMediaStream");l(this,"prevSubConfig");l(this,"signalingManager");l(this,"reporter");l(this,"webTrackingClient");l(this,"wantSubAudio",!1);l(this,"wantSubVideo",!1);l(this,"wantSubScreen",!1);l(this,"defaultVideoStreamType",he.AliRtcVideoStreamTypeHigh);l(this,"audioMuted",!1);l(this,"audioSubState");l(this,"videoSubState");l(this,"videoLargeSubState",new Kt);l(this,"videoSmallSubState",new Kt);l(this,"screenSubState");l(this,"streamInfo");l(this,"streamUrl","");this.streamInfo=new di,this.remoteUserInfo=new ls(this),this.streamInfo.on(we.Remote,g=>{this.emit(we.Remote,g,this.userId)}),this.signalingManager=h,this.viewMap=(u=n[i])!=null?u:{cameraViews:[],screenViews:[]},n[i]=this.viewMap,this.reporter=o,this.webTrackingClient=c,this.localUserId=f,this.audioSubState=new Kt,this.audioSubState.on("change",(g,m,d)=>{this.emit("audioSubscribeStateChanged",this.uid,g,m,d)}),this.videoSubState=new Kt,this.videoSubState.on("change",(g,m,d)=>{this.emit("videoSubscribeStateChanged",this.uid,g,m,d)}),this.screenSubState=new Kt,this.screenSubState.on("change",(g,m,d)=>{this.emit("screenSubscribeStateChanged",this.uid,g,m,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)}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,i;return!!((i=(e=this.stream)==null?void 0:e.audioTrack)!=null&&i.enabled)}get videoEnabled(){var e,i;return!!((i=(e=this.stream)==null?void 0:e.videoTrack)!=null&&i.enabled)}get screenEnabled(){var e,i;return!!((i=(e=this.screenStream)==null?void 0:e.videoTrack)!=null&&i.enabled)}get getAudioTrack(){return this.audioTrack}get getCameraStream(){return this.stream}get getScreenStream(){return this.screenStream}setViewConfig(e,i){if(i!==W.AliRtcVideoTrackScreen&&i!==W.AliRtcVideoTrackCamera)throw new C(N.ERR_INVALID_ARGUMENTS,"track is not AliRtcVideoTrackScreen or AliRtcVideoTrackCamera");e?rr(e).forEach(a=>{a.setAttribute("playsinline",""),D.BrowserUtil.isMicroMessenger&&(a.setAttribute("x5-video-player-type","h5-page"),a.setAttribute("x5-playsinline",""),D.SystemUtil.isAndroid||D.SystemUtil.isIos&&a.setAttribute("x-webkit-airplay","allow")),i===W.AliRtcVideoTrackScreen?this.viewMap.screenViews.push(a):this.viewMap.cameraViews.push(a),this.play(a,i===W.AliRtcVideoTrackScreen)}):(this.stopPlayAll(i===W.AliRtcVideoTrackScreen),i===W.AliRtcVideoTrackScreen?this.viewMap.screenViews=[]:this.viewMap.cameraViews=[])}clear(e=!0){return v(this,null,function*(){var i;e&&this.doStopSubscribe(this.streamUrl),Pr(Pi.prototype,this,"clear").call(this),this.clearStream(),this.clearScreenStream(),(i=this.streamInfo)==null||i.removeAllListeners(we.Remote)})}updateRemoteUserDeviceStatus(e){var i;(i=this.streamInfo)==null||i.updateRemoteUserDeviceStatus(e)}updateRemoteTracks(e,i,s,a){return v(this,null,function*(){var o;return this.remoteCallid=e,this.streamUrl=i!=null?i:"",this.callid=e!=null?e:"",this.streamInfo||(this.streamInfo=new di),(o=this.streamInfo)==null?void 0:o.updateTracks(a)})}subscribe(e){return v(this,null,function*(){var h;e?this.reporter.reportSubscribeInvoked(this.userId,e.video,!1,e.screen,e.audio):this.reporter.reportSubscribeInvoked(this.userId);let i=e;if(!i){const{hasAudio:f,hasVideo:p,hasScreen:u}=(h=this.streamInfo)!=null?h:{};i={audio:this.wantSubAudio&&f,video:this.wantSubVideo&&p,screen:this.wantSubScreen&&u}}const{screen:s,audio:a,video:n,vMsid:o}=i,c=[];(n||a)&&c.push({audio:a,video:n,vMsid:o}),s&&c.push({screen:s}),c.length!==0&&(yield Promise.all(c.map(f=>this.subscribeProxy(f))))})}subscribeProxy(e){return v(this,null,function*(){var n,o;let i=new Date().getTime(),s="",a="";try{e.audio&&this.audioSubState.setState(te.AliRtcStateSubscribing),e.video&&(this.videoSubState.currentState===te.AliRtcStateSubscribeIdle||this.videoSubState.currentState===te.AliRtcStateNoSubscribe)&&this.videoSubState.setState(te.AliRtcStateSubscribing),e.screen&&this.screenSubState.setState(te.AliRtcStateSubscribing);const c=yield this.rtsManager.subscribe({remoteUser:this,options:e});this.streamInfo.updateRemoteTrackSubState(e),s=c;const{stream:h}=c;if(e.audio){const p=h.audioTrack;p&&(this.audioTrack=p,(n=h.mediaStream)==null||n.removeTrack(p),this.playAudio(),this.audioVolumeIndicationInterval&&this.audioLevelMonitor.start(p,this.audioVolumeIndicationInterval)),this.audioSubState.setState(te.AliRtcStateSubscribed),this.audioSubState.getEnabled()||this.toggleAudio(!1)}e.video&&(e.vMsid===k.VideoSmall?this.videoSmallSubState.setState(te.AliRtcStateSubscribed):this.videoLargeSubState.setState(te.AliRtcStateSubscribed),this.videoSubState.setState(te.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleVideo(!1),this.updateStream(h,this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing)),e.screen&&(this.screenSubState.setState(te.AliRtcStateSubscribed),this.videoSubState.getEnabled()||this.toggleScreen(!1),this.updateScreenStream(h));const f=new Date().getTime()-i;this.webTrackingClient.reportPull(c.callid,c.remoteCallid,c.isVideoLargeSubscribing,c.isVideoSmallSubscribing,c.isScreenSubscribing,c.isAudioSubscribing,0,f,a,s,this.streamUrl,i)}catch(c){const h=new Date().getTime()-i;this.webTrackingClient.reportPull("","",!1,!1,!1,!1,c.code,h,a,s,(o=this.streamUrl)!=null?o:"",i),c&&(c.message=`user(${this.uid}) subscribe error, ${(c==null?void 0:c.message)||""}`);let f=N.ERR_INNER;e.audio&&(f=N.ERR_SDK_SUBSCRIBE_AUDIO_STRAM_FAILED),e.video&&(e.vMsid===k.VideoSmall?f=N.ERR_SDK_SUBSCRIBE_DUAL_STRAM_FAILED:f=N.ERR_SDK_SUBSCRIBE_VIDEO_STRAM_FAILED),e.screen&&(f=N.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED);const p=C.fromError(c,f);throw this.emit("remoteSubscribeError",p),p}})}subscribeDeleteTracks(e){return v(this,null,function*(){const{audio:i,video:s,screen:a,vMsid:n}=e,o=[];(i||s)&&o.push({audio:i,video:s,vMsid:n}),a&&o.push({screen:a}),o.length!==0&&(yield Promise.all(o.map(c=>this.subscribeDeleteProxy(c))))})}subscribeDeleteProxy(e){return v(this,null,function*(){try{const i=yield this.rtsManager.subscibeDelete({remoteUser:this,options:e}),{stream:s}=i!=null?i:{},a={};e.audio===!0&&(a.audio=!1,this.audioSubState.setState(te.AliRtcStateNoSubscribe)),e.video===!0&&(a.video=!1,e.vMsid===k.VideoSmall?(this.videoSmallSubState.setState(te.AliRtcStateNoSubscribe),(this.videoLargeSubState.currentState===te.AliRtcStateNoSubscribe||this.videoLargeSubState.currentState===te.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(te.AliRtcStateNoSubscribe)):(this.videoLargeSubState.setState(te.AliRtcStateNoSubscribe),(this.videoSmallSubState.currentState===te.AliRtcStateNoSubscribe||this.videoSmallSubState.currentState===te.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(te.AliRtcStateNoSubscribe))),e.screen===!0&&(a.screen=!1,this.screenSubState.setState(te.AliRtcStateNoSubscribe));const{callid:n,remoteCallid:o}=this,c={callid:n,remoteCallid:o,remoteStream:s};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(i){throw C.fromError(i,N.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===W.AliRtcVideoTrackCamera||e===W.AliRtcVideoTrackBoth)return this.playAll();if(!e||e===W.AliRtcVideoTrackScreen||e===W.AliRtcVideoTrackBoth)return this.playAll(!0)})}resumePlay(){this.playAudio(),this.playAll(),this.playAll(!0)}stopSubscribe(e){return v(this,null,function*(){var p,u,g,m,d,S,b;const{isAudioSubscribing:i=!1,isVideoSubscribing:s=!1,isScreenSubscribing:a=!1}=this,n=i&&!((p=e==null?void 0:e.audio)==null||p),o=s&&!((u=e==null?void 0:e.video)==null||u),c=!1,h=a&&!((g=e==null?void 0:e.screen)==null||g);e?this.reporter.reportSubscribeInvoked(this.userId,o,c,h,n):this.reporter.reportUnsubscribeInvoked(this.userId);let f=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,h,n,0,"",new Date().getTime()-f,(d=this.localUserId)!=null?d:""):this.reporter.reportUnsubscribe((S=w==null?void 0:w.callid)!=null?S:"",this.userId,new Date().getTime()-f,0,"")}catch(w){throw e?this.reporter.reportSubscribe("",this.userId,o,c,h,n,w.code,"",new Date().getTime()-f,(b=this.localUserId)!=null?b:""):this.reporter.reportUnsubscribe("",this.userId,new Date().getTime()-f,0,""),w}})}doStopSubscribe(e){return v(this,null,function*(){var a,n,o,c;const{callid:i,remoteCallid:s}=this;if((this.isAudioSubscribing||this.isVideoSubscribing||this.isScreenSubscribing)&&e)try{return yield this.rtsManager.subscibeStop(e),this.restore(),{callid:i,remoteCallid:s,remoteStream:this.stream}}catch(h){if(((c=(o=(n=(a=h==null?void 0:h.extraInfo)==null?void 0:a.parsedData)==null?void 0:n.streams)==null?void 0:o[0])==null?void 0:c.res_code)!==404)throw C.fromError(h,N.ERR_INNER,"subscribe stop failed")}})}updateStream(e,i=!1){return v(this,null,function*(){this.stream&&this.stream.videoTrack&&e.mediaStream&&i&&(yield new Promise(s=>{let a,n;if(e.mediaStream){n=document.createElement("video");const o=()=>{E.event(`uid: ${this.userId} new mediaStream canplay`),n&&n.removeEventListener("canplaythrough",o,!1),n=void 0,clearTimeout(a),s(!0)};n.addEventListener("canplaythrough",o,!1),(n._playPromise||Promise.resolve()).then(()=>{n&&e.mediaStream&&(n.srcObject=e.mediaStream)})}else s(!0);a=window.setTimeout(()=>{E.event(`uid: ${this.userId} new mediaStream timeout`),n=void 0,s(!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 s,a,n,o,c,h,f,p;const e={},i={};return this.wantSubAudio&&!this.isAudioSubscribing&&((s=this.streamInfo)!=null&&s.hasAudio)?e.audio=!0:(!this.wantSubAudio||!((a=this.streamInfo)!=null&&a.hasAudio))&&this.isAudioSubscribing&&(i.audio=!0),this.wantSubVideo&&((n=this.streamInfo)!=null&&n.hasVideo)?(this.defaultVideoStreamType===he.AliRtcVideoStreamTypeLow&&!this.isVideoSmallSubscribing&&((o=this.streamInfo)!=null&&o.hasVideoSmall)?(e.video=!0,e.vMsid=k.VideoSmall):!this.isVideoLargeSubscribing&&((c=this.streamInfo)!=null&&c.hasVideoLarge)&&!(this.defaultVideoStreamType===he.AliRtcVideoStreamTypeLow&&this.isVideoSmallSubscribing)&&(e.video=!0,e.vMsid=k.VideoLarge),this.defaultVideoStreamType===he.AliRtcVideoStreamTypeLow&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&this.streamInfo.hasVideoSmall?(i.video=!0,i.vMsid=k.VideoLarge):this.defaultVideoStreamType===he.AliRtcVideoStreamTypeHigh&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&(i.video=!0,i.vMsid=k.VideoSmall)):(!this.wantSubVideo||!((h=this.streamInfo)!=null&&h.hasVideo))&&this.isVideoSubscribing&&(i.video=!0,i.vMsid=this.streamInfo.isVideoSmallSubscribing?k.VideoSmall:k.VideoLarge),this.wantSubScreen&&!this.isScreenSubscribing&&((f=this.streamInfo)!=null&&f.hasScreen)?e.screen=!0:(!this.wantSubScreen||!((p=this.streamInfo)!=null&&p.hasScreen))&&this.isScreenSubscribing&&(i.screen=!0),(e.audio||e.video||e.screen)&&this.subscribe(e),i.audio&&i.video&&i.screen?this.stopSubscribe():(i.audio||i.video||i.screen)&&this.subscribeDeleteTracks(i),{addOption:e,deleteOption:i}}handleAutoPlayFailed(){this.emit("remoteAudioAutoPlayFail",this.uid);const e=()=>{this.resumeAudio().then(()=>{document.removeEventListener("click",e,!1),document.removeEventListener("touchstart",e,!1)})};document.addEventListener("click",e,!1),document.addEventListener("touchstart",e,!1)}handleVideoPlayFailded(e,i){this.emit("remoteVideoAutoPlayFail",this.uid,i);const s=()=>{var n;const a=(n=i===W.AliRtcVideoTrackScreen?this.screenStream:this.stream)==null?void 0:n.mediaStream;e.srcObject===a&&this.play(e,i===W.AliRtcVideoTrackScreen),document.removeEventListener("click",s,!1),document.removeEventListener("touchstart",s,!1)};document.addEventListener("click",s,!1),document.addEventListener("touchstart",s,!1)}playAudio(){return v(this,null,function*(){var i,s;if(!this.audioTrack)return;if(this.toggleAudio(!this.audioMuted),this.audioElement||(this.audioElement=document.createElement("audio")),((s=(i=this.audioElement.srcObject)==null?void 0:i.getAudioTracks())==null?void 0:s[0])!==this.audioTrack){let a=this.audioElement.srcObject;a?a.getAudioTracks().forEach(n=>{a.removeTrack(n)}):(a=new MediaStream,this.audioElement.srcObject=a),a.addTrack(this.audioTrack)}this.audioElement.play().catch(()=>{this.handleAutoPlayFailed()});const e=this.audioElement;this.audioElement.addEventListener("playing",function a(){e.removeEventListener("playing",a),D.SystemUtil.isIos&&parseInt(D.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(i=>{this.play(i,e)}):(this.viewMap.cameraViews||[]).forEach(i=>{this.play(i,e)})}play(e,i=!1){const s=i?this.screenStream:this.stream;!e||!s||!s.mediaStream||cs(e,s.mediaStream).catch(a=>{a.code===20||a.name==="AbortError"||this.handleVideoPlayFailded(e,i?W.AliRtcVideoTrackScreen:W.AliRtcVideoTrackCamera)})}stopPlayAll(e=!1){e?this.viewMap.screenViews.forEach(i=>{nt(i)}):this.viewMap.cameraViews.forEach(i=>{nt(i)})}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 s,a;const e=[];if(this.isAudioSubscribing){const n=yield this.rtsManager.getSubscribeAudioStats(this.streamUrl);n&&e.push({uid:this.uid,track:kt.AliRtcAudioTrackMic,stats:n})}const i=[];if((s=this.streamInfo)!=null&&s.isVideoLargeSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,k.VideoLarge);n&&i.push({uid:this.uid,track:W.AliRtcVideoTrackCamera,streamType:he.AliRtcVideoStreamTypeHigh,stats:n})}if((a=this.streamInfo)!=null&&a.isVideoSmallSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,k.VideoSmall);n&&i.push({uid:this.uid,track:W.AliRtcVideoTrackCamera,streamType:he.AliRtcVideoStreamTypeLow,stats:n})}if(this.isScreenSubscribing){const n=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,k.Screen);n&&i.push({uid:this.uid,track:W.AliRtcVideoTrackScreen,stats:n})}return{audio:e,video:i}})}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)}};l(Pi,"logName","RemoteUser");let ae=Pi;le([y()],ae.prototype,"clear",1),le([y()],ae.prototype,"updateRemoteUserDeviceStatus",1),le([y()],ae.prototype,"updateRemoteTracks",1),le([y(I)],ae.prototype,"subscribe",1),le([y()],ae.prototype,"subscribeProxy",1),le([y(I)],ae.prototype,"subscribeDeleteProxy",1),le([y()],ae.prototype,"restore",1),le([y(I)],ae.prototype,"stopSubscribe",1),le([y(I)],ae.prototype,"doStopSubscribe",1),le([y()],ae.prototype,"clearStream",1),le([y()],ae.prototype,"clearScreenStream",1),le([y()],ae.prototype,"updateSubscribe",1),le([y()],ae.prototype,"playAudio",1),le([y()],ae.prototype,"stopPlayAudio",1),le([y(I)],ae.prototype,"playAll",1),le([y()],ae.prototype,"play",1),le([y()],ae.prototype,"stopPlayAll",1);var ot=(t=>(t[t.AliRtcPluginErrorCodeSuccess=0]="AliRtcPluginErrorCodeSuccess",t[t.AliRtcPluginErrorCodeFailed=-1]="AliRtcPluginErrorCodeFailed",t[t.AliRtcPluginErrorNoFindPlugin=-2]="AliRtcPluginErrorNoFindPlugin",t[t.AliRtcPluginErrorParameterError=-3]="AliRtcPluginErrorParameterError",t[t.AliRtcPluginErrorLoadError=-4]="AliRtcPluginErrorLoadError",t[t.AliRtcPluginErrorCreateError=-5]="AliRtcPluginErrorCreateError",t[t.AliRtcPluginErrorInitError=-6]="AliRtcPluginErrorInitError",t[t.AliRtcPluginErrorInitTokenError=-7]="AliRtcPluginErrorInitTokenError",t))(ot||{});class En extends Q{constructor(){super(...arguments);l(this,"plugins",new Map)}add(e,i){if(this.plugins.has(e.name))throw new C(ot.AliRtcPluginErrorCreateError,`Plugin ${e.name} already exists`);this.plugins.set(e.name,e),i&&e.setOptions(i),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 i=this.plugins.get(e);if(!i)throw new C(ot.AliRtcPluginErrorNoFindPlugin,`Plugin ${e} not founded`);this.plugins.delete(e),i.removeAllListeners(),this.emit("removed",i)}get(e){return this.plugins.get(e)}has(e){return!!this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}}var An=Object.defineProperty,Tn=Object.getOwnPropertyDescriptor,_e=(t,r,e,i)=>{for(var s=i>1?void 0:i?Tn(r,e):r,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(i?n(r,e,s):n(s))||s);return i&&s&&An(r,e,s),s};const pi=([t])=>{const{remoteUser:r,options:e}=t;return[`user(${r.userId})`,e]},me=(Ce=class extends Q{constructor(e){super();l(this,"rts");l(this,"encodedInsertableStreams",!0);l(this,"audioRedEnabled",!1);l(this,"localStreamManager");l(this,"connecting",!1);l(this,"connected",!1);l(this,"connectionResolve");l(this,"connectingPromise");l(this,"dcResolve");l(this,"dcConnectingPromise");l(this,"_publishingTracks",[]);this.rts=V.AliRTS.createClient(),this.localStreamManager=e,this.rts.on("connectStatusChange",i=>{var s,a,n,o;if(E.event(`[${Ce.logName}]`,"rts connectStatusChange to:",i.status),i.status===V.EConnectStatus.CONNECT_STATUS_DISCONNECTED)this.emit("disconnected"),this.setConnected(!1);else if(i.status===V.EConnectStatus.CONNECT_STATUS_RECONNECTING)this.emit("reconnecting"),this.setConnected(!1);else if(i.status===V.EConnectStatus.CONNECT_STATUS_CONNECTED){this.setConnected(!0);const c=(o=(n=(a=(s=this.rts.commonController)==null?void 0:s.peerCore)==null?void 0:a.getSignal())==null?void 0:n.getDatachannelCore())==null?void 0:o.readyState;E.event(Ce.logName,"dcReadyState:",c),c==="open"&&this.dcResolve&&this.dcResolve(!0),this.emit("connected")}}),this.rts.on("datachannelStatusChange",i=>{E.event(`[${Ce.logName}]`,"rts datachannelStatusChange to:",i.status),i.status===V.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?this.dcResolve&&this.dcResolve(!0):i.status===V.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&(this.dcConnectingPromise=new Promise(s=>{this.dcResolve=s}),console.warn("DC DisConnected"))}),this.rts.on("receivedSEI",i=>{this.emit("seimessage",i.url,i.sei.payloadType,i.sei.data)})}setEncodedInsertableStreams(e){this.encodedInsertableStreams=e}setAudioRedEnabled(e){var i;if(e!==this.audioRedEnabled){try{const a=[...((i=RTCRtpReceiver.getCapabilities("audio"))==null?void 0:i.codecs)||[]];if(a.length>0){if(e){const n=a.findIndex(c=>c.mimeType==="audio/red"),o=a.findIndex(c=>c.mimeType==="audio/opus");if(n>-1&&o>-1&&n>o){const c=a[o];a[o]=a[n],a[n]=c}}this.rts.setSenderCodecPreferences({audio:a}),this.rts.setReceiverCodecPreferences({audio:a})}}catch(s){}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 i;this.connected=e,this.connecting=!1,(i=this.connectionResolve)==null||i.call(this,!0),e||(this.dcConnectingPromise=new Promise(s=>{this.dcResolve=s}))}get isConnecting(){return this.connecting}get isConnected(){return this.connected}get publishingTracks(){return this._publishingTracks}getPubMsid(e,i){const{aMsid:s,vMsid:a}=i!=null?i:{},n={};return e.hasAudio&&(n.aMsid=[s!=null?s:k.Audio]),e.hasScreen&&(n.vMsid=[k.Screen]),e.hasVideo&&(n.vMsid=[a!=null?a:i!=null&&i.isScreen?k.Screen:k.VideoLarge]),n}updatePublishingTracks(e){e&&(this._publishingTracks=e.map(({msid:i,from:s,ssrc:a,codec:n,type:o,trackId:c})=>({msid:i,from:s,type:o,ssrc:`${a}`,codec:n!=null?n:"",trackId:c})))}httpPublish(e,i=!1){return v(this,null,function*(){const{publishStream:s,videoSmallStream:a,screenStream:n,vMsid:o}=yield this.localStreamManager.createHTTPPublishStream();if(!s)return"";const c=this.getPubMsid(s,{vMsid:o});c.retryTimes=0,this.encodedInsertableStreams&&(c.encodedInsertableStreams=!0);let h=!s.hasVideo,f=o;try{this.startConnect();const p=yield this.rts.publish(e,s,c);return this.setConnected(!0),this._publishingTracks=this.rts.getPublishTrackInfoList(),a&&(yield this.publishAdd(e,a,{vMsid:k.VideoSmall},i),h=!1,f=k.VideoSmall),n&&(yield this.publishAdd(e,n,{vMsid:k.Screen},i),h=!1,f=k.Screen),yield this.waitPublishSender(e,h,f),p}catch(p){throw this.setConnected(!1),p}})}waitPublishSender(e,i=!1,s){return v(this,null,function*(){const a=(n,o)=>{let c=0;const h=()=>(i?this.rts.getPublishAudioStats(e,s):this.rts.getPublishVideoStats(e,s)).then(p=>!(p.bytesSent>0)&&c<n?(c++,new Promise(g=>setTimeout(()=>g(h()),o))):Promise.resolve());return h()};return Promise.race([at(1e3),a(5,100)]).catch(()=>{})})}checkSubscribeStats(e,i){return v(this,null,function*(){const s=(a,n)=>{let o=0;const c=()=>{const h=this.rts.getSubscribeVideoStats(e,i);return this.rts.getSubscribeAudioStats(e).then(p=>{var u;E.event(`[${Ce.logName}]`,"AudioLevel",((u=p.audioLevel)!=null?u:0).toFixed(2))}),h.then(p=>(E.event(`[${Ce.logName}]`,"VideoFramesDecoded",p.framesDecoded),!(p.framesDecoded>0)&&o<a?(o++,new Promise(g=>setTimeout(()=>g(c()),n))):Promise.resolve()))};return c()};return Promise.race([at(1200),s(10,100)]).catch(()=>{})})}getPublishVideoStats(e,i){return v(this,null,function*(){return yield this.rts.getPublishVideoStats(e,i)})}getPublishAudioStats(e,i){return v(this,null,function*(){return yield this.rts.getPublishAudioStats(e,i)})}publishAdd(e,i,s,a=!1,n=0,o=!1){return v(this,null,function*(){try{yield this.dcConnectingPromise;const c=yield this.rts.publishAdd([q({url:e,stream:i,updateSourceStream:!1},this.getPubMsid(i,s))]);if(c){const[h]=c;return this.updatePublishingTracks(h.trackInfoList),o&&(yield this.waitPublishSender(e,!i.hasVideo,i.hasVideo?s==null?void 0:s.vMsid:s==null?void 0:s.aMsid)),h.traceId||""}}catch(c){if(c.errorCode===15006&&n<3)return yield this.publishAdd(e,i,s,a,n+1);throw c}return""})}publishDelete(e,i){return v(this,null,function*(){var f,p,u,g,m,d,S,b;yield this.dcConnectingPromise;const s=(p=(f=this.publishingTracks)==null?void 0:f.find(({msid:w})=>w===k.Audio))==null?void 0:p.msid,a=(g=(u=this.publishingTracks)==null?void 0:u.find(({msid:w})=>w===k.VideoLarge))==null?void 0:g.msid,n=(d=(m=this.publishingTracks)==null?void 0:m.find(({msid:w})=>w===k.Screen))==null?void 0:d.msid,o=[];i.screen&&n?o.push(n):i.video&&o.push(i.vMsid||a);const c=[];i.audio&&s&&c.push(s),E.event(Ce.logName,"publishDelete",{streamUrl:e,aMsid:c,vMsid:o});const[h]=(yield this.rts.publishDeleteTracks([{url:e,aMsid:c,vMsid:o}]))||[];return E.event(Ce.logName,"publishDelete",{result:h}),h&&this.updatePublishingTracks(h.trackInfoList),((b=(S=h==null?void 0:h.trackInfoList)==null?void 0:S[0])==null?void 0:b.trackId)||""})}publishReplace(e,i,s){return v(this,null,function*(){var h,f;yield this.dcConnectingPromise;const{vMsid:a,aMsid:n}=s!=null?s:{},o=yield this.rts.publishReplaceTracks([{url:e,stream:i,updateSourceStream:!1,vMsid:a,aMsid:n}]),[c]=o;return this.updatePublishingTracks(c.trackInfoList),((f=(h=c==null?void 0:c.trackInfoList)==null?void 0:h[0])==null?void 0:f.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,i){let s=i!=null?i:{};i||(s={audio:!0,video:!0,screen:!0});const a={};return s.audio&&(a.aMsid=[(e==null?void 0:e.getAudioInfo().msid)||k.Audio]),s.video?s.vMsid?a.vMsid=[s.vMsid]:e!=null&&e.hasVideoLarge?a.vMsid=[(e==null?void 0:e.getVideoLargeInfo().msid)||k.VideoLarge]:e!=null&&e.hasVideoSmall?a.vMsid=[(e==null?void 0:e.getVideoSmallInfo().msid)||k.VideoSmall]:a.vMsid=[k.VideoLarge]:s.screen&&e!=null&&e.hasScreen&&(a.vMsid=[(e==null?void 0:e.getScreenInfo().msid)||k.Screen]),a}httpSubscribe(e){return v(this,null,function*(){const{remoteUser:i,options:s}=e;let a=i.streamUrl;s.video||s.screen?s!=null&&s.audio||(a+="@subaudio=no"):a+="@subvideo=no";const n=this.getSubConfig(i.streamInfo,s);n.retryTimes=0,this.encodedInsertableStreams&&(n.encodedInsertableStreams=!0);try{this.startConnect();const o=yield this.rts.subscribe(a,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,h,f;yield this.dcConnectingPromise;const{remoteUser:i,options:s}=e,a=Lt(q({url:i.streamUrl,subAudio:!!s.audio,subVideo:!!(s.screen||s.video)},this.getSubConfig(i.streamInfo,s)),{targetStream:s.screen?i.getScreenStream:i.getCameraStream});try{const p=yield this.rts.subscribeAdd([a]);return a.subVideo&&this.checkSubscribeStats(i.streamUrl,(n=a.vMsid)==null?void 0:n[0]).then(()=>{var u;E.info(Ce.logName,"checkSubscribeStats",{streamUrl:i.streamUrl,msid:(u=a.vMsid)==null?void 0:u[0]})}),p[0]}catch(p){if(((f=(h=(c=(o=p==null?void 0:p.extraInfo)==null?void 0:o.parsedData)==null?void 0:c.streams)==null?void 0:h[0])==null?void 0:f.res_code)===508)return this.emit("subscribeexceeds"),null;throw C.fromError(p)}return null})}subscibeDelete(e){return v(this,null,function*(){var n,o,c,h;yield this.dcConnectingPromise;const{remoteUser:i,options:s}=e,a=Lt(q({url:i.streamUrl,subAudio:!!s.audio,subVideo:!!(s.screen||s.video)},this.getSubConfig(i.streamInfo,s)),{targetStream:s.screen?i.getScreenStream:i.getCameraStream});try{return(yield this.rts.subscribeDeleteTracks([a]))[0]}catch(f){if(((h=(c=(o=(n=f==null?void 0:f.extraInfo)==null?void 0:n.parsedData)==null?void 0:o.streams)==null?void 0:c[0])==null?void 0:h.res_code)===404)return;throw f}})}subscibeStop(e){return v(this,null,function*(){var i,s,a,n;try{yield this.rts.subscribeStop([{url:e}])}catch(o){if(((n=(a=(s=(i=o==null?void 0:o.extraInfo)==null?void 0:i.parsedData)==null?void 0:s.streams)==null?void 0:a[0])==null?void 0:n.res_code)===404)return;throw o}})}publish(e,i=!1){return v(this,null,function*(){let s="";if(this.connecting&&(yield this.connectingPromise),this.connected){yield this.dcConnectingPromise;let a=!1,n;const{audio:o,video:c,videoSmall:h,screen:f}=this.localStreamManager.publishStreams;o&&(s=yield this.publishAdd(e,o,{aMsid:k.Audio},i),a=!0,n=k.Audio,yield at(100)),c&&(s=yield this.publishAdd(e,c,{vMsid:k.VideoLarge},i),a=!1,n=k.VideoLarge,yield at(100)),h&&(s=yield this.publishAdd(e,h,{vMsid:k.VideoSmall},i),a=!1,n=k.VideoSmall,yield at(100)),f&&(s=yield this.publishAdd(e,f,{isScreen:!0,vMsid:k.Screen},i),a=!1,n=k.Screen),n&&(yield this.waitPublishSender(e,a,n))}else s=yield this.httpPublish(e,i);return s})}subscribe(e){return v(this,null,function*(){const{options:i}=e;if(i.video&&i.screen)throw new C(N.ERR_INNER,"subscribe error, video and screen cannot be subscribed at the same time");this.connecting&&(yield this.connectingPromise);let s;return this.connected?(yield this.dcConnectingPromise,s=yield this.subscribeAdd(e)):s=yield this.httpSubscribe(e),s})}getSubscribeVideoStats(e,i){return v(this,null,function*(){return yield this.rts.getSubscribeVideoStats(e,i)})}getSubscribeAudioStats(e,i){return v(this,null,function*(){return yield this.rts.getSubscribeAudioStats(e,i)})}sendSEI(e,i,s,a){return v(this,null,function*(){return this.rts.sendSEI({url:e,vMsid:k.VideoLarge,data:i,repeatCount:s,payloadType:a})})}},l(Ce,"logName","RtsManager"),Ce);_e([y()],me.prototype,"updatePublishingTracks",1),_e([y(I,I)],me.prototype,"httpPublish",1),_e([y(I,I)],me.prototype,"waitPublishSender",1),_e([y(([t,r,e])=>[t,JSON.stringify(e)],I)],me.prototype,"publishAdd",1),_e([y(I,I)],me.prototype,"publishDelete",1),_e([y(([t,r,e])=>[t,JSON.stringify(e)])],me.prototype,"publishReplace",1),_e([y(I)],me.prototype,"publishStop",1),_e([y()],me.prototype,"unpublish",1),_e([y(pi,({traceId:t})=>t)],me.prototype,"httpSubscribe",1),_e([y(pi,({traceId:t})=>t)],me.prototype,"subscribeAdd",1),_e([y(pi)],me.prototype,"subscibeDelete",1),_e([y(I)],me.prototype,"subscibeStop",1),_e([y(I)],me.prototype,"publish",1),_e([y(pi)],me.prototype,"subscribe",1),_e([y()],me.prototype,"sendSEI",1);let Pn=me;class sr{constructor(){l(this,"profile");l(this,"profileMap",new Map);l(this,"audioProfile");l(this,"contentHint")}updateProfile(r,e){e&&this.profileMap.set(r,e),this.profile=r}get videoProfile(){return this.profile}updateAudioProfile(r){this.audioProfile=r}setContentHint(r,e){e&&(this.contentHint=e),this.contentHint&&r&&(r.contentHint=this.contentHint)}setVideoProfile(r,e,i=!1){return v(this,null,function*(){if(!this.profile)return;const s=this.profileMap.get(this.profile)||(e==null?void 0:e.VideoProfileMap.get(this.profile));if(s){if(!i&&r&&r.applyConstraints)try{yield r.applyConstraints(s)}catch(a){}e&&(e==null||e.VideoProfileMap.set(this.profile,s),yield e.setVideoProfile(this.profile))}})}}class ar extends Q{constructor(e){super();l(this,"type");l(this,"originVideoTrack");l(this,"videoSource");l(this,"_videoMuted",!1);l(this,"originAudioTrack");l(this,"audioSource");l(this,"_audioMuted",!1);l(this,"_targetVideoTrack");l(this,"_targetDualVideoTrack");l(this,"_targetAudioTrack");l(this,"_publishVideoStream");l(this,"_publishDualVideoStream");l(this,"_publishAudioStream");l(this,"_previewStream");l(this,"plugins",[]);l(this,"_profileManager");l(this,"cameraVideoConstraints");l(this,"micAudioConstraints");l(this,"onVideoTrackEnded",()=>{this.emit("videotrackended")});l(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,i,s){return v(this,null,function*(){var o,c,h,f,p,u;const{videoTrack:a,audioTrack:n}=e;a&&((o=this.originVideoTrack)==null||o.removeEventListener("ended",this.onVideoTrackEnded)),n&&((c=this.originAudioTrack)==null||c.removeEventListener("ended",this.onAudioTrackEnded)),this.type===ce.AliRtcSdkStreamTypeScreen?this.stop():(a&&((h=this.originVideoTrack)==null||h.stop()),n&&((f=this.originAudioTrack)==null||f.stop())),a&&(this.originVideoTrack=a,(p=this.originVideoTrack)==null||p.addEventListener("ended",this.onVideoTrackEnded),this.videoSource=i||At.Camera,this.updateVideoTrack(a)),n&&(this.originAudioTrack=n,(u=this.originAudioTrack)==null||u.addEventListener("ended",this.onAudioTrackEnded),this.audioSource=s||si.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,i=!1){return v(this,null,function*(){(this._targetVideoTrack!==e||i)&&(this._targetVideoTrack=e)})}updateDualVideoTrack(e,i=!1){return v(this,null,function*(){(this._targetDualVideoTrack!==e||i)&&(this._targetDualVideoTrack=e)})}updateAudioTrack(e,i=!1){return v(this,null,function*(){(this._targetAudioTrack!==e||i)&&(this._targetAudioTrack=e)})}setAudioMuted(e){var i,s;this._audioMuted=e,e?(i=this.publishAudioStream)==null||i.disableAudio():(s=this.publishAudioStream)==null||s.enableAudio()}get isAudioMuted(){return this._audioMuted}setVideoMuted(e){var i,s;this._videoMuted=e,e?(i=this.publishVideoStream)==null||i.disableVideo():(s=this.publishVideoStream)==null||s.enableVideo()}get isVideoMuted(){return this._videoMuted}process(e){return v(this,null,function*(){var i,s,a,n,o,c,h,f,p,u,g,m;this._targetAudioTrack=this.originAudioTrack,this._targetVideoTrack=this.originVideoTrack;for(const d of this.plugins)try{yield d.execute(this,e)}catch(S){console.error(`error in plugin-${d.name}, error: ${S}`)}this._targetVideoTrack?((s=(i=this._publishVideoStream)==null?void 0:i.videoTrack)==null?void 0:s.id)!==this._targetVideoTrack.id&&(this._publishVideoStream=yield Wt(this._targetVideoTrack),this.setVideoMuted(this._videoMuted),(a=this.profileManager)==null||a.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 Wt(this._targetVideoTrack)):(this._publishVideoStream=void 0,(c=this.previewStream)==null||c.deleteTracks({video:!0})),this._targetDualVideoTrack?((f=(h=this._publishDualVideoStream)==null?void 0:h.videoTrack)==null?void 0:f.id)!==this._targetDualVideoTrack.id&&(this._publishDualVideoStream=yield Wt(this._targetDualVideoTrack),this._videoMuted?this._publishDualVideoStream.disableVideo():this._publishDualVideoStream.enableVideo()):this._publishDualVideoStream=void 0,this._targetAudioTrack?((u=(p=this._publishAudioStream)==null?void 0:p.audioTrack)==null?void 0:u.id)!==this._targetAudioTrack.id&&(this._publishAudioStream=yield Wt(this._targetAudioTrack),this.setAudioMuted(this._audioMuted),this.previewStream?(g=this.previewStream)==null||g.mergeStream(this._publishAudioStream):this._previewStream=yield Wt(this._targetAudioTrack)):(this._publishAudioStream=void 0,(m=this.previewStream)==null||m.deleteTracks({audio:!0}))})}stopVideo(){var e,i;this.originVideoTrack&&((e=this.originVideoTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(i=this.originVideoTrack)==null||i.stop(),this.originVideoTrack=void 0),this.updateVideoTrack(void 0)}stopAudio(){var e,i;this.originAudioTrack&&((e=this.originAudioTrack)==null||e.removeEventListener("ended",this.onAudioTrackEnded),(i=this.originAudioTrack)==null||i.stop(),this.originAudioTrack=void 0),this.updateAudioTrack(void 0)}stop(){this.stopVideo(),this.stopAudio()}updateVideoProfile(e,i){return v(this,null,function*(){this._profileManager||(this._profileManager=new sr),e&&this._profileManager.updateProfile(e,i),yield this._profileManager.setVideoProfile(this.originVideoTrack,this._publishVideoStream,this.type===ce.AliRtcSdkStreamTypeScreen)})}get videoProfile(){var e;return(e=this.profileManager)==null?void 0:e.videoProfile}setVideoContentHint(e){this._profileManager||(this._profileManager=new sr),this._profileManager.setContentHint(this.currentVideoTrack,e)}updateAudioProfile(e){return v(this,null,function*(){this._profileManager||(this._profileManager=new sr),this._profileManager.updateAudioProfile(e)})}cloneVideoProfile(e){return v(this,null,function*(){var i;yield(i=this.profileManager)==null?void 0:i.setVideoProfile(void 0,e)})}addPlugin(e){const i=this.plugins.findIndex(s=>s.zIndex>e.zIndex);i>-1?this.plugins.splice(i,0,e):this.plugins.push(e)}removePlugin(e){const i=this.plugins.indexOf(e);return i>-1?(e.clear(this),this.plugins.splice(i,1),!0):!1}}var kn=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,xe=(t,r,e,i)=>{for(var s=i>1?void 0:i?Cn(r,e):r,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(i?n(r,e,s):n(s))||s);return i&&s&&kn(r,e,s),s};const Oe=(Ct=class extends Q{constructor(e){super();l(this,"pluginManager");l(this,"publishingCameraVideoStream");l(this,"publishingScreenVideoStream");l(this,"cameraStreamInfo",new ar(ce.AliRtcSdkStreamTypeCapture));l(this,"screenStreamInfo",new ar(ce.AliRtcSdkStreamTypeScreen));l(this,"streamInfos",[this.cameraStreamInfo,this.screenStreamInfo]);l(this,"_audioCaptureDisabled",!1);l(this,"_cameraCaptureDisabled",!1);l(this,"_publishLocalAudioStreamEnabled",!0);l(this,"_publishLocalVideoStreamEnabled",!0);l(this,"_publishLocalScreenStreamEnabled",!0);this.screenStreamInfo.setVideoContentHint("motion"),this.pluginManager=e;const i=s=>v(this,null,function*(){if(E.info(`[${Ct.logName}]`,"plugin added",s.name),!s.isSupported("6.11.5")){console.warn(`${s.name} is not supported!!!`),s.emit("unsupported");return}try{yield s.init()}catch(a){s.emit("error",C.fromError(a,ot.AliRtcPluginErrorInitError))}s.streamType===ce.AliRtcSdkStreamTypeCapture&&(this.cameraStreamInfo.addPlugin(s),yield this.cameraStreamInfo.process(this.streamInfos)),s.streamType===ce.AliRtcSdkStreamTypeScreen&&(this.screenStreamInfo.addPlugin(s),yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")});this.cameraStreamInfo.updateVideoProfile(as,jt),this.cameraStreamInfo.on("videotrackended",()=>v(this,null,function*(){yield this.stopLocalStream({video:!0}),this.emit("trackended",bt.VideoTrackEnded)})),this.cameraStreamInfo.on("audiotrackended",()=>v(this,null,function*(){yield this.stopLocalStream({audio:!0}),this.emit("trackended",bt.AudioTrackEnded)})),this.screenStreamInfo.updateVideoProfile(ns,$t),this.screenStreamInfo.on("videotrackended",()=>v(this,null,function*(){yield this.stopLocalStream({screen:!0}),this.emit("trackended",bt.ScreenTrackEnded)})),this.pluginManager.on("added",i),this.pluginManager.on("removed",s=>v(this,null,function*(){this.cameraStreamInfo.removePlugin(s)&&(yield this.cameraStreamInfo.process(this.streamInfos)),this.screenStreamInfo.removePlugin(s)&&(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,i,s,a;if((e=this.cameraStreamInfo.cameraVideoConstraints)!=null&&e.deviceId){let n=(i=this.cameraStreamInfo.cameraVideoConstraints)==null?void 0:i.deviceId;const o=yield V.AliRTS.getCameraList();o.find(c=>c.deviceId===n)||(n=(a=(s=o.find(c=>!!c.deviceId))==null?void 0:s.deviceId)!=null?a:""),this.cameraStreamInfo.cameraVideoConstraints.deviceId=n}})}setAvailableMicrophoneDeviceId(){return v(this,null,function*(){var e,i,s,a;if((e=this.cameraStreamInfo.micAudioConstraints)!=null&&e.deviceId){let n=(i=this.cameraStreamInfo.micAudioConstraints)==null?void 0:i.deviceId;const o=yield V.AliRTS.getMicList();o.find(c=>c.deviceId===n)||(n=(a=(s=o.find(c=>!!c.deviceId))==null?void 0:s.deviceId)!=null?a:""),this.cameraStreamInfo.micAudioConstraints.deviceId=n}})}createLocalStream(e){return v(this,null,function*(){const{screen:i,mediaStream:s,videoProfile:a,screenProfile:n}=e;let{video:o,audio:c}=e;const h=fn(e);let f;if(h){if(s||(o===!0&&this.cameraStreamInfo.cameraVideoConstraints?(yield this.setAvailableCameraDeviceId(),o=q({},this.cameraStreamInfo.cameraVideoConstraints)):typeof o=="object"&&(yield this.setAvailableCameraDeviceId(),o=q(q({},o),this.cameraStreamInfo.cameraVideoConstraints)),c===void 0&&this.audioCaptureDisabled?c=!1:c&&(c===!0&&this.cameraStreamInfo.micAudioConstraints?(yield this.setAvailableMicrophoneDeviceId(),c=q({},this.cameraStreamInfo.micAudioConstraints)):typeof c=="object"&&(yield this.setAvailableMicrophoneDeviceId(),c=q(q({},c),this.cameraStreamInfo.micAudioConstraints)),this._audioCaptureDisabled=!1)),f=yield V.AliRTS.createStream({audio:c,video:o,screen:i,custom:!!s,mediaStream:s,skipProfile:!0}),i)yield this.screenStreamInfo.updateSource(f,At.Screen,si.Screen),yield this.setScreenProfile(n),this.setScreenContentHint(),this.publishingScreenVideoStream=void 0;else if(yield this.cameraStreamInfo.updateSource(f,At.Camera,si.Microphone),f.hasVideo&&(yield this.setVideoProfile(a),this.setVideoContentHint(),this.publishingCameraVideoStream=void 0),f.hasAudio&&typeof c=="boolean"){const p=this.cameraStreamInfo.audioProfile;p&&(yield f.setAudioProfile(p))}}return V.AliRTS.SystenUtil.isIos&&V.AliRTS.SystenUtil.compareVersion("15.1")&&!V.AliRTS.SystenUtil.compareVersion("15.2")&&(yield at(1e3)),yield this.updateStreams(),f})}stopLocalStream(e){return v(this,null,function*(){const{screen:i,video:s,audio:a}=e!=null?e:{};let n=!1;s&&this.cameraStreamInfo.originVideoTrack&&(n=!0,this.cameraStreamInfo.stopVideo(),this.publishingCameraVideoStream=void 0),a&&this.cameraStreamInfo.originAudioTrack&&(n=!0,this.cameraStreamInfo.stopAudio()),i&&this.screenStreamInfo.originVideoTrack&&(n=!0,this.screenStreamInfo.stop(),this.publishingScreenVideoStream=void 0),n&&(yield this.updateStreams())})}get publishStreams(){const{publishLocalVideoStreamEnabled:e,publishLocalAudioStreamEnabled:i,publishLocalScreenStreamEnabled:s}=this;return{video:e?this.cameraStreamInfo.publishVideoStream:void 0,videoSmall:e?this.cameraStreamInfo.publishDualVideoStream:void 0,audio:i?this.cameraStreamInfo.publishAudioStream:void 0,screen:s?this.screenStreamInfo.publishVideoStream:void 0}}createHTTPPublishStream(){return v(this,null,function*(){var c,h,f,p;let e,i=!1,s,a,n;const o=yield this.publishStreams;try{if(!o.audio&&!o.video&&!o.videoSmall&&!o.screen)throw new C(N.ERR_SDK_PUBLISH_INVAILD,"no tracks founded");const u=new MediaStream;(c=o.audio)!=null&&c.audioTrack&&u.addTrack(o.audio.audioTrack),(h=o.video)!=null&&h.videoTrack?(u.addTrack(o.video.videoTrack),a=o.videoSmall,n=o.screen):(f=o.screen)!=null&&f.videoTrack&&(s=k.Screen,u.addTrack((p=o.screen)==null?void 0:p.videoTrack),i=!0),e=yield hs(u),i?(this.screenStreamInfo.cloneVideoProfile(e),this.publishingScreenVideoStream=e):(this.cameraStreamInfo.cloneVideoProfile(e),this.publishingCameraVideoStream=e)}catch(u){}return{publishStream:e,videoSmallStream:a,screenStream:n,vMsid:s}})}stop(){this.cameraStreamInfo.stop(),this.screenStreamInfo.stop()}setVideoProfile(e,i){return v(this,null,function*(){yield this.cameraStreamInfo.updateVideoProfile(e,i),this.publishingCameraVideoStream&&this.cameraStreamInfo.cloneVideoProfile(this.publishingCameraVideoStream)})}setVideoContentHint(e){this.cameraStreamInfo.setVideoContentHint(e)}setAudioProfile(e){return v(this,null,function*(){var i;yield this.cameraStreamInfo.updateAudioProfile(e),yield(i=this.publishingCameraVideoStream)==null?void 0:i.setAudioProfile(e)})}setScreenProfile(e,i){return v(this,null,function*(){yield this.screenStreamInfo.updateVideoProfile(e,i),this.publishingScreenVideoStream&&this.screenStreamInfo.cloneVideoProfile(this.publishingScreenVideoStream)})}setScreenContentHint(e){this.screenStreamInfo.setVideoContentHint(e)}setCameraVideoConstraints(e){var i;this.cameraStreamInfo.cameraVideoConstraints=q(q({},(i=this.cameraStreamInfo.cameraVideoConstraints)!=null?i:{}),e)}setMicAudioConstraints(e){var i;this.cameraStreamInfo.micAudioConstraints=q(q({},(i=this.cameraStreamInfo.micAudioConstraints)!=null?i:{}),e)}},l(Ct,"logName","LocalStreamManager"),Ct);xe([y(([t])=>{const{audio:r,video:e,screen:i,custom:s,skipProfile:a,videoProfile:n,screenProfile:o}=t;return[{audio:r,video:e,screen:i,custom:s,skipProfile:a,videoProfile:n,screenProfile:o}]})],Oe.prototype,"createLocalStream",1),xe([y(I)],Oe.prototype,"stopLocalStream",1),xe([y()],Oe.prototype,"createHTTPPublishStream",1),xe([y()],Oe.prototype,"stop",1),xe([y(I)],Oe.prototype,"setVideoProfile",1),xe([y(I)],Oe.prototype,"setVideoContentHint",1),xe([y(I)],Oe.prototype,"setAudioProfile",1),xe([y(I)],Oe.prototype,"setScreenProfile",1),xe([y(I)],Oe.prototype,"setScreenContentHint",1),xe([y(I)],Oe.prototype,"setCameraVideoConstraints",1),xe([y(I)],Oe.prototype,"setMicAudioConstraints",1);let Mn=Oe;var Nn=Object.defineProperty,Ln=Object.getOwnPropertyDescriptor,Ue=(t,r,e,i)=>{for(var s=i>1?void 0:i?Ln(r,e):r,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(i?n(r,e,s):n(s))||s);return i&&s&&Nn(r,e,s),s};class ke extends Q{constructor(e){super();l(this,"self");l(this,"userMap",{});l(this,"usersViewMap",{});l(this,"rtsManager");l(this,"localStreamManager");l(this,"authInfo");l(this,"signalingManager");l(this,"pluginManager");l(this,"reporter");l(this,"webTrackingClient");l(this,"statsMonitorId");l(this,"autoSubAudio",!0);l(this,"autoSubVideo",!0);l(this,"autoSubScreen",!0);l(this,"wantSubAudio",!0);l(this,"wantSubVideo",!0);l(this,"wantSubScreen",!0);l(this,"defaultStreamType",he.AliRtcVideoStreamTypeHigh);l(this,"audioMuted",!1);l(this,"audioVolumeIndicationInterval",0);l(this,"indicationTimer",0);const{signalingManager:i,reporter:s,webTrackingClient:a}=e;this.signalingManager=i,this.addSignalingManagerListener(),this.reporter=s,this.webTrackingClient=a,this.pluginManager=new En,this.localStreamManager=new Mn(this.pluginManager),this.rtsManager=new Pn(this.localStreamManager),this.self=new us({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=>{E.event("[Signaling] Notify Publish ",e),e.forEach(i=>{this.onRemotePublishStateChange(i)})})}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(i=>{i.setWantSubAudio(e),i.updateSubscribe()})}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e,this.remoteUsers.forEach(i=>{i.setWantSubVideo(e),i.updateSubscribe()})}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e,this.remoteUsers.forEach(i=>{i.setWantSubScreen(e),i.updateSubscribe()})}setRemoteDefaultVideoStreamType(e){this.defaultStreamType=e,this.remoteUsers.forEach(i=>{i.setRemoteDefaultVideoStreamType(e)})}setRemoteUserVideoStreamType(e,i){var s;(s=this.getRemoteUser(e))==null||s.setRemoteDefaultVideoStreamType(i)}setAudioMuted(e){this.audioMuted=e,this.remoteUsers.forEach(i=>{i.setAudioMuted(e)})}setLocalViewConfig(e,i){var a;if(!e)return(a=this.publisher)==null?void 0:a.setViewConfig(null,i);const s=rr(e);s.length!==0&&s.forEach(n=>{var o,c;(o=this.publisher)==null||o.resetElement(n),Object.values(this.usersViewMap).forEach(({cameraViews:h=[],screenViews:f=[]})=>{h.includes(n)&&h.splice(h.indexOf(n),1),f.includes(n)&&f.splice(f.indexOf(n),1)}),(c=this.publisher)==null||c.setViewConfig(s,i)})}setRemoteViewConfig(e,i,s){var n,o;if(!i)return(n=this.userMap[e])==null?void 0:n.setViewConfig(null,s);const a=rr(i);a.length!==0&&(a.forEach(c=>{var h;(h=this.publisher)==null||h.resetElement(c),Object.values(this.usersViewMap).forEach(({cameraViews:f=[],screenViews:p=[]})=>{f.includes(c)&&f.splice(f.indexOf(c),1),p.includes(c)&&p.splice(p.indexOf(c),1)})}),(o=this.userMap[e])==null||o.setViewConfig(a,s))}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(i=>{var c;const{isAudioSubscribing:s,isVideoLargeSubscribing:a,isVideoSmallSubscribing:n,isScreenSubscribing:o}=(c=i.streamInfo)!=null?c:{};return s||a||n||o})}onRemotePublishStateChange(e){var u;const{userid:i,callid:s,subscribe:a,pubid:n="",tracks:o}=e,c=(u=a==null?void 0:a.pullstreamurl)!=null?u:"";let h=this.getRemoteUser(i);if(!h)return;const f=h.streamInfo.audioTrackInfo,p=h.streamInfo.videoTrackInfo;h.updateRemoteTracks(s,c,n,o),h.updateSubscribe(),(f!==h.streamInfo.audioTrackInfo||p!==h.streamInfo.videoTrackInfo)&&this.emit("remoteTrackAvailableChange",i,h.streamInfo.audioTrackInfo,h.streamInfo.videoTrackInfo)}init(e,i){var s;this.authInfo=e,this.self||(this.self=new us({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),(s=this.self)==null||s.initInfo(e,i.pushstreamurl),i.users.forEach(a=>{const n=a.userid;if(n){const o=this.addUser(n,a.displayname),{callid:c,subscribe:h,tracks:f}=a;o.updateRemoteTracks(c,(h==null?void 0:h.pullstreamurl)||"","",f),this.emit("remoteTrackAvailableChange",n,o.streamInfo.audioTrackInfo,o.streamInfo.videoTrackInfo)}}),this.startStatsMonitor()}clear(){return v(this,null,function*(){var e;this.stopStatsMonitor();for(let i in this.userMap)this.userMap[i]&&(yield this.userMap[i].clear(),delete this.userMap[i]);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:s,video:a}=yield this.publisher.getStats();s&&s.length>0&&this.emit("rtcLocalAudioStats",s),a&&a.length>0&&this.emit("rtcLocalVideoStats",a)}const e=[],i=[];for(const s of this.remoteUsers){const{audio:a,video:n}=yield s.getStats();a&&a.forEach(o=>{e.push(o)}),n&&n.forEach(o=>{i.push(o)})}e.length>0&&this.emit("rtcRemoteAudioStats",e),i.length>0&&this.emit("rtcRemoteVideoStats",i)}),2e3)}stopStatsMonitor(){this.statsMonitorId&&clearInterval(this.statsMonitorId)}getUser(e,i){return this.addUser(e,i),this.userMap[e]}addUser(e,i){return this.userMap[e]||(this.userMap[e]=this.executeAddUser(e,i)),this.userMap[e]}executeAddUser(e,i){var a;const s=new ae({userId:e,displayName:i,rtsManager:this.rtsManager,signalingManager:this.signalingManager,usersViewMap:this.usersViewMap,reporter:this.reporter,webTrackingClient:this.webTrackingClient,localUserId:(a=this.userId)!=null?a:"",audioVolumeIndicationInterval:this.audioVolumeIndicationInterval});return s.on(we.Remote,this.onRemoteDeviceStatusChange.bind(this)),s.on(J.PullStreamStats,this.onRemoteStatReport.bind(this)),s.on(J.RtsSubscribeExceeds,this.onSubscribeExceeds.bind(this)),s.on("audioSubscribeStateChanged",(n,o,c,h)=>{this.emit("audioSubscribeStateChanged",n,o,c,h,this.channel||"")}),s.on("videoSubscribeStateChanged",(n,o,c,h)=>{this.emit("videoSubscribeStateChanged",n,o,c,h,this.channel||"")}),s.on("screenSubscribeStateChanged",(n,o,c,h)=>{this.emit("screenSubscribeStateChanged",n,o,c,h,this.channel||"")}),s.on("remoteAudioAutoPlayFail",n=>{this.emit("remoteAudioAutoPlayFail",n)}),s.on("remoteVideoAutoPlayFail",(n,o)=>{this.emit("remoteVideoAutoPlayFail",n,o)}),s.on("remoteSubscribeError",n=>{this.emit("remoteSubscribeError",n)}),s.setWantSubAudio(this.autoSubAudio&&this.wantSubAudio),s.setWantSubVideo(this.autoSubVideo&&this.wantSubVideo),s.setWantSubScreen(this.autoSubScreen&&this.wantSubScreen),s.setRemoteDefaultVideoStreamType(this.defaultStreamType),s.setAudioMuted(this.audioMuted),(this.autoSubAudio||this.autoSubVideo||this.autoSubScreen)&&s.updateSubscribe(),s}onRemoteDeviceStatusChange(e,i){e===J.MuteAudio?this.emit("userAudioMuted",i,!0):e===J.UnmuteAudio?this.emit("userAudioMuted",i,!1):e===J.MuteVideo?this.emit("userVideoMuted",i,!0):e===J.UnmuteVideo?this.emit("userVideoMuted",i,!1):e===J.MuteScreen?this.emit("userScreenMuted",i,!0):e===J.UnmuteScreen&&this.emit("userScreenMuted",i,!1)}onRemoteStatReport(e,i,s){this.emit(J.PullStreamStats,e,i,s)}onSubscribeExceeds(e,i){this.emit(J.RtsSubscribeExceeds,e,i)}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 i=[],s=[],a={};e.forEach(c=>{c.userid&&(this.userMap[c.userid]?(s.push(c),a[c.userid]=this.userMap[c.userid]):(i.push(c),a[c.userid]=this.executeAddUser(c.userid,c.displayname)))});const n=Object.keys(this.userMap),o=[];return n.forEach(c=>{a[c]||o.push({userid:c,reason:"",leavecode:Zi.AliRtcUserOfflineQuit})}),this.userMap=a,{joinList:i,leaveList:o,presentList:s}}getRemoteUser(e){return this.userMap[e]}updateRemoteUserDeviceStatus(e){e&&e.userid&&this.userMap[e.userid]&&this.userMap[e.userid].updateRemoteUserDeviceStatus(e.status)}updateAudioWant(e,i){const s=this.userMap[e];if(!s)throw new C(N.ERR_INNER,`no remote user(${e}) founded`);s.setWantSubAudio(i),i?s.updateSubscribe():s.stopSubscribe({audio:!0})}updateVideoWant(e,i){const s=this.userMap[e];if(!s)throw new C(N.ERR_INNER,`no remote user(${e}) founded`);s.setWantSubVideo(i),i?s.updateSubscribe():s.stopSubscribe({video:!0})}updateScreenWant(e,i){const s=this.userMap[e];if(!s)throw new C(N.ERR_INNER,`no remote user(${e}) founded`);s.setWantSubScreen(i),i?s.updateSubscribe():s.stopSubscribe({screen:!0})}stopIndication(){this.indicationTimer&&window.clearInterval(this.indicationTimer)}startIndication(e){this.stopIndication(),this.indicationTimer=window.setInterval(()=>{var s;const i=this.remoteUsers.map(a=>({userId:a.userId,volume:a.getAudioLevel()||0}));i.unshift({userId:"",volume:((s=this.self)==null?void 0:s.getAudioLevel())||0}),this.emit("audioVolume",i)},e)}enableAudioVolumeIndication(e){var i;this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.stopIndication(),e>0&&this.startIndication(e),this.audioVolumeIndicationInterval=e,this.remoteUsers.forEach(s=>{s.enableAudioVolumeIndication(e)}),(i=this.self)==null||i.enableAudioVolumeIndication(e))}refreshAuthInfo(e){var i;this.authInfo&&(this.authInfo=q(q({},this.authInfo),e)),e.userId&&((i=this.self)==null||i.refreshUserInfo(e.userId))}setEnableMediaExtensionMsg(e){this.rtsManager.setEncodedInsertableStreams(e)}setAudioRedEnabled(e){this.rtsManager.setAudioRedEnabled(e)}}l(ke,"logName","UserManager"),Ue([y()],ke.prototype,"init",1),Ue([y()],ke.prototype,"clear",1),Ue([y(I)],ke.prototype,"addUser",1),Ue([y()],ke.prototype,"removeLeftUser",1),Ue([y()],ke.prototype,"updateUsers",1),Ue([y(I)],ke.prototype,"updateAudioWant",1),Ue([y(I)],ke.prototype,"updateVideoWant",1),Ue([y(I)],ke.prototype,"updateScreenWant",1),Ue([y()],ke.prototype,"stopIndication",1),Ue([y()],ke.prototype,"startIndication",1),Ue([y()],ke.prototype,"enableAudioVolumeIndication",1);const nr=t=>v(this,null,function*(){const r=new Uint8Array(160).fill(170),e=new TextEncoder().encode(t),i=yield window.crypto.subtle.importKey("raw",r,{name:"HMAC",hash:{name:"SHA-1"}},!1,["sign"]),s=yield window.crypto.subtle.sign("HMAC",i,e);return Array.from(new Uint8Array(s)).map(a=>a.toString(16).padStart(2,"0")).join("")});class On{constructor(){l(this,"authInfo")}doRequest(r,e){var h;const i=this.authInfo;if(!i)return Promise.reject(We.LiveTranscodingErrorInvalidParam);const s="https://gw.rtn.aliyuncs.com",a=Za[r],n={appid:i.appId,userid:i.userId,channelid:i.channelId,timestamp:i.timestamp,token:i.token,nonce:i.nonce?i.nonce:"",requestid:it.createCallid(),tokensid:!1,session:(h=i.callid)!=null?h:it.createCallid()},o=Object.keys(n).map(f=>`${f}=${encodeURIComponent(n[f])}`).join("&"),c=`${s}${a}?${o}`;return fetch(c,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:e}).then(f=>f.status!==200?Promise.reject(new C(N.ERR_INNER,`transcoding request failed, status: ${f.status}`)):f)}setAuthInfo(r){this.authInfo=r}clear(){this.authInfo=void 0}startPublishLiveStream(r,e){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(We.LiveTranscodingErrorInvalidParam);const i=yield nr(r.split("?")[0]),s=Ie.MPU_TASK_TRANSACTION_UPDATE,a=e.toJson(s,this.authInfo,i,r);return this.doRequest(s,JSON.stringify(a))})}startPublishLiveStreamWithTaskId(r,e){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(We.LiveTranscodingErrorInvalidParam);const i=Ie.MPU_TASK_TRANSACTION_UPDATE,s=e.toJson(i,this.authInfo,r);return this.doRequest(i,JSON.stringify(s))})}updatePublishLiveStream(r,e){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(We.LiveTranscodingErrorInvalidParam);const i=yield nr(r.split("?")[0]),s=Ie.MPU_TASK_TRANSACTION_UPDATE,a=e.toJson(s,this.authInfo,i,r);return this.doRequest(s,JSON.stringify(a))})}updatePublishLiveStreamWithTaskId(r,e){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(We.LiveTranscodingErrorInvalidParam);const i=Ie.MPU_TASK_TRANSACTION_UPDATE,s=e.toJson(i,this.authInfo,r);return this.doRequest(i,JSON.stringify(s))})}stopPublishLiveStream(r){return v(this,null,function*(){if(!this.authInfo)return Promise.reject(We.LiveTranscodingErrorInvalidParam);const e=yield nr(r.split("?")[0]),i=Ie.MPU_TASK_TRANSACTION_STOP,s=new ui().toJson(i,this.authInfo,e,r);return this.doRequest(i,JSON.stringify(s))})}stopPublishLiveStreamWithTaskId(r){if(!this.authInfo)return Promise.reject(We.LiveTranscodingErrorInvalidParam);const e=Ie.MPU_TASK_TRANSACTION_STOP,i=new ui().toJson(e,this.authInfo,r);return this.doRequest(e,JSON.stringify(i))}refreshAuthInfo(r){this.authInfo&&this.setAuthInfo(q(q({},this.authInfo),r))}}var ds=(t,r,e)=>{if(!r.has(t))throw TypeError("Cannot "+e)},gi=(t,r,e)=>(ds(t,r,"read from private field"),e?e.call(t):r.get(t)),or=(t,r,e)=>{if(r.has(t))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(t):r.set(t,e)},cr=(t,r,e,i)=>(ds(t,r,"write to private field"),i?i.call(t,e):r.set(t,e),e),Vn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},M={},vt={};const Dn="SLS_CLIENT";var ps=(t=>(t.ERROR="error",t.LOG="log",t.LOCATION="pv",t.API="api",t.RESOURCE="res",t.RESOURCE_ERROR="res_err",t.PERF="perf",t.CONSOLE_LOG="console",t))(ps||{}),gs=(t=>(t.LOG_SEND="LOG_SEND",t.BROWSER_SEND="BROWSER_SEND",t.BASE_TRANSFORM="BASE_TRANSFORM",t.BROWSER_BASE_TRANSFORM="BROWSER_BASE_TRANSFORM",t.BROWSER_FETCH="BROWSER_FETCH",t.BROWSER_XHR="BROWSER_XHR",t.BROWSER_LOCATION="BROWSER_LOCATION",t.BROWSER_RUNTIME_ERROR="BROWSER_RUNTIME_ERROR",t.BROWSER_CUSTOM_ERROR="BROWSER_CUSTOM_ERROR",t.BROWSER_RESOURCE_ERROR="BROWSER_RESOURCE_ERROR",t.BROWSER_CONSOLE="BROWSER_CONSOLE",t.BROWSER_PERF="BROWSER_PERF",t.BROWSER_RESOURSE="BROWSER_RESOURSE",t.MINI_SEND="MINI_SEND",t.MINI_REQUEST="MINI_REQUEST",t.MINI_BASE_TRANSFORM="MINI_BASE_TRANSFORM",t.MINI_ROUTE="MINI_ROUTE",t))(gs||{});const xn={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},Un="sls-trace-uid";var fs=(t=>(t.OK="OK",t.ERROR="ERROR",t.UNSET="UNSET",t))(fs||{});vt.InternalPlugin=gs,vt.InternalPluginPriority=xn,vt.OTStatusCode=fs,vt.SLS_CLIENT_NAME=Dn,vt.SLS_TRACE_UID_KEY=Un,vt.WebEventType=ps;var Be=vt;function ur(t,r,e){Object.defineProperty(t,r,{writable:!0,enumerable:!0,configurable:!0,value:e})}function Bn(t,r,e,i){i?i(()=>{ur(t,r,e)}):ur(t,r,e)}class Hn{constructor(r){this.onFirstSubscribe=r,this.observers=[]}subscribe(r){return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(r),{unsubscribe:()=>{this.observers=this.observers.filter(e=>r!==e),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(r){this.observers.forEach(e=>e(r))}}function qt(t,r,e){try{return t.apply(r,e)}catch(i){return}}function Fn(t){return function(){return qt(t,this,arguments)}}let jn=!1;function $n(){return jn}function ms(...t){}var Wn=Object.defineProperty,Kn=Object.defineProperties,qn=Object.getOwnPropertyDescriptors,Ss=Object.getOwnPropertySymbols,Jn=Object.prototype.hasOwnProperty,Gn=Object.prototype.propertyIsEnumerable,bs=(t,r,e)=>r in t?Wn(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,zn=(t,r)=>{for(var e in r||(r={}))Jn.call(r,e)&&bs(t,e,r[e]);if(Ss)for(var e of Ss(r))Gn.call(r,e)&&bs(t,e,r[e]);return t},Xn=(t,r)=>Kn(t,qn(r));const vs=1e3,ys=60*vs,ws=60*ys,_s=24*ws,Rs=365*_s,Yn=1024,Is="0.1.0";function Qn(){}function Es(t){return typeof t=="number"}function Zn(t){return Object.prototype.toString.call(t)==="[object String]"}function eo(t){return Object.prototype.toString.call(t)==="[object Error]"}function As(t,r){return+t.toFixed(r)}function to(t,r){return t.indexOf(r)!==-1}function io(t,r){return t==null?r:!!t}function fi(t){return t?(parseInt(t,10)^Math.random()*16>>parseInt(t,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,fi)}function Ts(t=20){var r,e;const i=new Array(t),s=Date.now().toString(36).split("");for(;t-- >0;)e=(r=36*Math.random()|0).toString(36),i[t]=r%3?e:e.toUpperCase();for(var a=0;a<8;a++)i.splice(3*a+2,0,s[a]);return i.join("")}function ro(t){return t!==0&&Math.random()<=t}function mi(t,r){return(...e)=>{try{return t(...e)}catch(i){console.error(r,i)}}}function Ps(t){return"https://"+t.project+"."+t.host+"/logstores/"+t.logstore+"/track"}function so(t,r){return r?t.includes(Ps(r)):t.includes("/track?APIVersion=0.6.0")}const ks=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;function ao(t){try{return decodeURIComponent(t)}catch(r){return unescape(t)}}function no(t){return typeof t=="string"&&ks.test(t)}function oo(t){var r=ao(t||"").match(ks);if(r==null)return null;var e=(r[3]||"").split(":"),i=e.length?(r[2]||"").replace(/(.*\@)/,""):r[2];return{uri:r[0],protocol:r[1],host:i,hostname:r[4],port:r[5],auth:r[3],user:e[0],password:e[1],path:r[6],search:r[7],hash:r[8]}}function co(t,r,e,i){const s={url:t,method:r,status_code:e};return i==null?s:Xn(zn({},s),{host:i.host,scheme:i.protocol})}function uo(t,r,...e){return r==null||!Array.isArray(r)?!1:r.some(i=>{if(typeof i=="function")try{return i(t,...e)}catch(s){return console.error("user function callback threw an error:",s),!1}return typeof i=="string"?t.includes(i):Object.prototype.toString.call(i)==="[object RegExp]"?i.test(t):!1})}function ho(t,r,e){return t===!1?!1:t===!0||t==="error"&&!e?!0:typeof t=="function"?mi(t,"call shouldTrackBody failed")(r):!1}function lo(t){return{relative:t,timeStamp:Cs(t)}}function Cs(t){const r=Date.now()-performance.now();return r>Jt()?Math.round(r+t):Ns(t)}function po(){return Math.round(Date.now()-(Jt()+performance.now()))}function go(t){return Es(t)?As(t*1e6,0):t}function hr(){return Date.now()}function Ms(){return performance.now()}function fo(){return{relative:Ms(),timeStamp:hr()}}function mo(){return{relative:0,timeStamp:Jt()}}function So(t,r){return r-t}function bo(t){return t-Jt()}function Ns(t){return Math.round(Jt()+t)}function vo(t){return t<Rs}let Si;function Jt(){return Si===void 0&&(Si=performance.timing.navigationStart),Si}function yo(){Si=void 0}const yt="?";function Gt(t,r){let e;const i=r===void 0?0:+r;try{if(e=_o(t),e)return e}catch(s){}try{if(e=wo(t),e)return e}catch(s){}try{if(e=Ro(t),e)return e}catch(s){}try{if(e=Ls(t,i+1),e)return e}catch(s){}return{message:Se(t,"message"),name:Se(t,"name"),stack:[]}}function wo(t){const r=Se(t,"stack");if(!r)return;const e=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,i=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;let a;const n=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,o=/\((\S*)(?::(\d+))(?::(\d+))\)/,c=r.split(`
5
- `),h=[];let f,p,u;for(let g=0,m=c.length;g<m;g+=1){if(e.exec(c[g])){p=e.exec(c[g]);const d=p[2]&&p[2].indexOf("native")===0;a=p[2]&&p[2].indexOf("eval")===0,f=o.exec(p[2]),a&&f&&(p[2]=f[1],p[3]=f[2],p[4]=f[3]),u={args:d?[p[2]]:[],column:p[4]?+p[4]:void 0,func:p[1]||yt,line:p[3]?+p[3]:void 0,url:d?void 0:p[2]}}else if(s.exec(c[g]))p=s.exec(c[g]),u={args:[],column:p[4]?+p[4]:void 0,func:p[1]||yt,line:+p[3],url:p[2]};else if(i.exec(c[g]))p=i.exec(c[g]),a=p[3]&&p[3].indexOf(" > eval")>-1,f=n.exec(p[3]),a&&f?(p[3]=f[1],p[4]=f[2],p[5]=void 0):g===0&&!p[5]&&!Ao(t.columnNumber)&&(h[0].column=t.columnNumber+1),u={args:p[2]?p[2].split(","):[],column:p[5]?+p[5]:void 0,func:p[1]||yt,line:p[4]?+p[4]:void 0,url:p[3]};else continue;!u.func&&u.line&&(u.func=yt),h.push(u)}if(h.length)return{stack:h,message:Se(t,"message"),name:Se(t,"name")}}function _o(t){const r=Se(t,"stacktrace");if(!r)return;const e=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\((.*)\))? in (.*):\s*$/i,s=r.split(`
6
- `),a=[];let n;for(let o=0;o<s.length;o+=2){let c;e.exec(s[o])?(n=e.exec(s[o]),c={args:[],column:void 0,func:n[3],line:+n[1],url:n[2]}):i.exec(s[o])&&(n=i.exec(s[o]),c={args:n[5]?n[5].split(","):[],column:+n[2],func:n[3]||n[4],line:+n[1],url:n[6]}),c&&(!c.func&&c.line&&(c.func=yt),c.context=[s[o+1]],a.push(c))}if(a.length)return{stack:a,message:Se(t,"message"),name:Se(t,"name")}}function Ro(t){const r=Se(t,"message");if(!r)return;const e=r.split(`
7
- `);if(e.length<4)return;const i=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,s=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,a=/^\s*Line (\d+) of function script\s*$/i,n=[],o=window&&window.document&&window.document.getElementsByTagName("script"),c=[];let h;for(const f in o)Eo(o,f)&&!o[f].src&&c.push(o[f]);for(let f=2;f<e.length;f+=2){let p;i.exec(e[f])?(h=i.exec(e[f]),p={args:[],column:void 0,func:h[3],line:+h[1],url:h[2]}):s.exec(e[f])?(h=s.exec(e[f]),p={args:[],column:void 0,func:h[4],line:+h[1],url:h[3]}):a.exec(e[f])&&(h=a.exec(e[f]),p={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+h[1]}),p&&(p.func||(p.func=yt),p.context=[e[f+1]],n.push(p))}if(n.length)return{stack:n,message:e[0],name:Se(t,"name")}}function Io(t,r,e){const i={url:r,line:e?+e:void 0};if(i.url&&i.line){t.incomplete=!1;const s=t.stack;if(s.length>0&&s[0].url===i.url){if(s[0].line===i.line)return!1;if(!s[0].line&&s[0].func===i.func)return s[0].line=i.line,s[0].context=i.context,!1}return s.unshift(i),t.partial=!0,!0}return t.incomplete=!0,!1}function Ls(t,r){const e=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,i=[],s={};let a=!1,n,o;for(let h=Ls.caller;h&&!a;h=h.caller)h!==Gt&&(o={args:[],column:void 0,func:yt,line:void 0,url:void 0},n=e.exec(h.toString()),h.name?o.func=h.name:n&&(o.func=n[1]),typeof o.func>"u"&&(o.func=n?n.input.substring(0,n.input.indexOf("{")):void 0),s[h.toString()]?a=!0:s[h.toString()]=!0,i.push(o));r&&i.splice(0,r);const c={stack:i,message:Se(t,"message"),name:Se(t,"name")};return Io(c,Se(t,"sourceURL")||Se(t,"fileName"),Se(t,"line")||Se(t,"lineNumber")),c}function Se(t,r){if(typeof t!="object"||!t||!(r in t))return;const e=t[r];return typeof e=="string"?e:void 0}function Eo(t,r){return Object.prototype.hasOwnProperty.call(t,r)}function Ao(t){return typeof t>"u"}function Os(t,r,e){const i=t[r];let s=e(i);const a=function(){return s.apply(this,arguments)};return t[r]=a,{stop:()=>{t[r]===a?t[r]=i:s=i}}}function lr(t,r,{before:e,after:i}){return Os(t,r,s=>function(){const a=arguments;let n;return e&&qt(e,this,a),typeof s=="function"&&(n=s.apply(this,a)),i&&qt(i,this,a),n})}const To=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function Po(t){const{stop:r}=ko(t),{stop:e}=Co(t);return{stop:()=>{r(),e()}}}function ko(t){return lr(window,"onerror",{before(r,e,i,s,a){let n;if(a)n=Gt(a),t(n,a);else{const o={url:e,column:s,line:i};let c,h=r;if({}.toString.call(r)==="[object String]"){const f=To.exec(h);f&&(c=f[1],h=f[2])}n={name:c,message:typeof h=="string"?h:void 0,stack:[o]},t(n,r)}}})}function Co(t){return lr(window,"onunhandledrejection",{before(r){const e=r.reason||"Empty reason",i=Gt(e);t(i,e)}})}function Vs(t){return`${t.name||"Error"}: ${t.message}`}function Ds(t){return t.filter(r=>r.url==null||!r.url.includes("sls-rum.js"))}function dr(t){let r=Vs(t);return t.stack.forEach(e=>{const i=e.func==="?"?"<anonymous>":e.func,s=e.args&&e.args.length>0?`(${e.args.join(", ")})`:"",a=e.line?`:${e.line}`:"",n=e.line&&e.column?`:${e.column}`:"";r+=`
8
- at ${i}${s} @ ${e.url}${a}${n}`}),encodeURIComponent(r)}function Mo(t,r,e,i=!0){var s;if(!t||t.message===void 0&&!(r instanceof Error))return{message:`${e} ${JSON.stringify(r)}`,stacktrace:"",type:t&&t.name,id:fi()};t!=null&&t.stack&&i&&(t.stack=Ds(t.stack));const a=(s=t==null?void 0:t.stack)==null?void 0:s[0];return{message:encodeURIComponent(t.message||"Empty message"),stacktrace:dr(t),type:t.name,col:a?a.column:void 0,line:a?a.line:void 0,file:encodeURIComponent(a&&a.url?a.url:""),id:fi()}}function No(){const t=new Error;let r;return qt(()=>{const e=Gt(t);e!=null&&e.stack&&(e.stack=Ds(e.stack)),r=dr(e)}),r}const Lo=8,Oo=16,pr="b3",gr="traceparent",fr="uber-trace-id",bi=Array(32);function xs(t){for(let r=0;r<t*2;r++)bi[r]=Math.floor(Math.random()*16)+48,bi[r]>=58&&(bi[r]+=39);return String.fromCharCode.apply(null,bi.slice(0,t*2))}function Us(){return xs(Oo)}function mr(){return xs(Lo)}function vi(t,r){return`${t}-${r}-1`}function yi(t,r){return`00-${t}-${r}-01`}function wi(t,r){return`${t}:${r}:0:1`}const _i={b3:{name:pr,getter:vi},traceparent:{name:gr,getter:yi},uber:{name:fr,getter:wi}};function Vo(t,r,e,i){var s;const a=i!=null?i:{};a.headers=(s=a.headers)!=null?s:{},a.headers[pr]=vi(t,r),a.headers[gr]=yi(t,r),a.headers[fr]=wi(t,r);try{if(e)for(const[n,o]of Object.entries(e))_i[o]&&(a.headers[n]=_i[o].getter(t,r))}catch(n){}return a}function Do(t,r,e,i){t.setRequestHeader(pr,vi(r,e)),t.setRequestHeader(gr,yi(r,e)),t.setRequestHeader(fr,wi(r,e));try{if(i)for(const[s,a]of Object.entries(i))_i[a]&&t.setRequestHeader(s,_i[a].getter(r,e))}catch(s){}}function zt(t,r,e){t!=null&&Object.keys(t).map(i=>{e==null||e==""?r[i]=t[i]:r[`${e}.${i}`]=t[i]})}var xo=Object.defineProperty,Uo=Object.defineProperties,Bo=Object.getOwnPropertyDescriptors,Bs=Object.getOwnPropertySymbols,Ho=Object.prototype.hasOwnProperty,Fo=Object.prototype.propertyIsEnumerable,Hs=(t,r,e)=>r in t?xo(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,jo=(t,r)=>{for(var e in r||(r={}))Ho.call(r,e)&&Hs(t,e,r[e]);if(Bs)for(var e of Bs(r))Fo.call(r,e)&&Hs(t,e,r[e]);return t},$o=(t,r)=>Uo(t,Bo(r));function Wo(){return{name:Be.InternalPlugin.BASE_TRANSFORM,run:function(){this.subscribe("*",(t,r)=>{const{otBase:e,extra:i}=t;e.attribute=$o(jo({},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),zt(this.options.custom,e.attribute,"custom"),zt({env:this.options.env,version:this.options.version},e.attribute),zt({sdk_version:Is,workspace:this.options.workspace},e.resource);const s={otBase:e,extra:i};ms(Be.InternalPlugin.BASE_TRANSFORM,s),r(s)},Be.InternalPluginPriority[Be.InternalPlugin.BASE_TRANSFORM])}}}function Ko(){return{name:Be.InternalPlugin.LOG_SEND,run:function(){}}}function Fs(t,r,e){if(r<0)return;const i=a=>{Fs(t,r-1,a)},s=t[r];mi(()=>{s.callback.call(void 0,e,i)},"plugin notify run error")()}class qo{constructor(r){this.subscribeMap={},this.allNotifiers=[],this.allNotifiers=r}subscribeOne(r,e,i,s){var a;const n=(a=this.subscribeMap[e])!=null?a:[];this.subscribeMap[e]=n,n.push({name:r,priority:s,callback:i}),n.sort((o,c)=>o.priority-c.priority)}notify(r,e){var i;const s=(i=this.subscribeMap[r])!=null?i:[];Fs(s,s.length-1,e)}subscribe(r,e,i,s){if(e==="*")for(let a=0;a<this.allNotifiers.length;a++){const n=this.allNotifiers[a];this.subscribeOne(r,n,i,s)}else this.subscribeOne(r,e,i,s)}getSubscribeMap(){return this.subscribeMap}}function Jo(){const t=Us();let r=mr();return{getSessionId:()=>t,getPageId:()=>r,refreshPageId:()=>{r=mr()}}}var Go=Object.defineProperty,zo=Object.defineProperties,Xo=Object.getOwnPropertyDescriptors,js=Object.getOwnPropertySymbols,Yo=Object.prototype.hasOwnProperty,Qo=Object.prototype.propertyIsEnumerable,$s=(t,r,e)=>r in t?Go(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,Zo=(t,r)=>{for(var e in r||(r={}))Yo.call(r,e)&&$s(t,e,r[e]);if(js)for(var e of js(r))Qo.call(r,e)&&$s(t,e,r[e]);return t},ec=(t,r)=>zo(t,Xo(r));const tc=["uid","nickname","env","service","version","custom"];class ic{constructor(r){this.isInit=!1,this.pendingPlugins=[],this.pluginMap={},this.session=Jo();var e,i;this.options=r,this.use(Ko()),this.use(Wo()),this.options.env=(e=r.env)!=null?e:"prod",this.options.version=(i=r.version)!=null?i:"-"}initPlugin(r){if(r==null||typeof r!="object"){console.error("plugin is not a object");return}if(r.name==null||r.name===""){console.error("plugin name is required.");return}if(this.pluginMap[r.name]){console.error(`plugin name: ${r.name} is conflict`);return}if(typeof r.run!="function"){console.error("plugin.run is not a function");return}const e=ec(Zo({},this.context),{subscribe:(i,s,a)=>{this.sub.subscribe(r.name,i,s,a)},notify:i=>{this.sub.notify(r.name,i)}});mi(()=>r.run.call(e),`plugin ${r.name} init failed`)()}addLog(r){if(this.isInit){const e={t:Be.WebEventType.LOG};zt(r,e,Be.WebEventType.LOG);const i={start:hr()*1e3,attribute:e,resource:{}};this.sub.notify(Be.InternalPlugin.LOG_SEND,{otBase:i,extra:{}})}else console.error("log should call after start")}setOptions(r){this.isInit?tc.forEach(e=>{r[e]!==this.options[e]&&r[e]!=null&&r[e]!=""&&(this.options[e]=r[e],e==="uid"&&typeof this.setLocalStorage=="function"&&this.setLocalStorage(Be.SLS_TRACE_UID_KEY,r[e]))}):console.error("setOptions should call after start")}start(){if(!this.isInit){this.isInit=!0;let r=this.options.uid;(r==null||r==="")&&(typeof this.getLocalStorage=="function"&&(r=this.getLocalStorage(Be.SLS_TRACE_UID_KEY)),(r==null||r==="")&&(r=Ts())),this.options.uid=r,typeof this.setLocalStorage=="function"&&this.setLocalStorage(Be.SLS_TRACE_UID_KEY,r);const e=this.pendingPlugins.map(i=>i==null?void 0:i.name).filter(i=>i!=null);this.sub=new qo(e),this.context={options:this.options,session:this.session};for(const i of this.pendingPlugins)this.initPlugin(i)}}use(r){this.isInit?console.error(`plugin: ${r==null?void 0:r.name} use should run before start`):this.pendingPlugins.push(r)}}var rc=Object.defineProperty,Ws=Object.getOwnPropertySymbols,sc=Object.prototype.hasOwnProperty,ac=Object.prototype.propertyIsEnumerable,Ks=(t,r,e)=>r in t?rc(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,nc=(t,r)=>{for(var e in r||(r={}))sc.call(r,e)&&Ks(t,e,r[e]);if(Ws)for(var e of Ws(r))ac.call(r,e)&&Ks(t,e,r[e]);return t};function oc(t,r){var e;const i={current:void 0},s=[];let a={};return typeof r=="function"&&(a=(e=r(i))!=null?e:{}),nc({init:n=>{if(i.current!=null)return;i.current=t(n);const o=i.current;s.forEach(c=>{o.use(c)}),o.start()},use:n=>{s.push(n)},addLog:n=>{i.current.addLog(n)},onReady(n){n()},setOptions:n=>{i.current.setOptions(n)}},a)}class cc{constructor(){this.dep=new Map}subscribe(r,e){const i=this.dep.get(r);if(i){this.dep.set(r,i.concat(e));return}this.dep.set(r,[e])}notify(r,e){const i=this.dep.get(r);!r||!i||i.forEach(s=>{try{s(e)}catch(a){console.error(a)}})}}M.ONE_DAY=_s,M.ONE_HOUR=ws,M.ONE_KILO_BYTE=Yn,M.ONE_MINUTE=ys,M.ONE_SECOND=vs,M.ONE_YEAR=Rs,M.Observable=Hn,M.SDK_VERSION=Is,M.SLSClient=ic,M.Subscribe=cc,M.assembleOTAttribute=zt,M.buildHttpInfo=co,M.callMonitored=qt,M.catchUserErrors=mi,M.clocksNow=fo,M.clocksOrigin=mo,M.computeStackTrace=Gt,M.createHandlingStack=No,M.currentDrift=po,M.debugLog=ms,M.defineGlobal=Bn,M.defineGlobalValue=ur,M.elapsed=So,M.formatErrorMessage=Vs,M.formatUnknownError=Mo,M.genUid=Ts,M.generateSpanId=mr,M.generateTraceId=Us,M.generateUUID=fi,M.getB3Header=vi,M.getConsoleLogStatus=$n,M.getCorrectedTimeStamp=Cs,M.getJaegerTraceHeaderr=wi,M.getRelativeTime=bo,M.getTimeStamp=Ns,M.getTrackUrl=Ps,M.getW3CTraceHeader=yi,M.includes=to,M.instrumentMethod=Os,M.instrumentMethodAndCallOriginal=lr,M.isError=eo,M.isInternalUrl=so,M.isNumber=Es,M.isString=Zn,M.isURL=no,M.looksLikeRelativeTime=vo,M.makeWebPublicApi=oc,M.matchCondition=uo,M.matchSample=ro,M.matchWithDefault=io,M.monitor=Fn,M.noop=Qn,M.parseUri=oo,M.patchHeaderOnRequest=Vo,M.patchHeaderOnXhr=Do,M.relativeNow=Ms,M.relativeToClocks=lo,M.resetNavigationStart=yo,M.round=As,M.shouldTrackBody=ho,M.startUnhandledErrorCollection=Po,M.timeStampNow=hr,M.toServerDuration=go,M.toStackTraceString=dr;var uc=class{constructor(t){this.timer=null,this.time=10,this.count=10,this.arr=[];var r,e;this.time=(r=t.time)!=null?r:10,this.count=(e=t.count)!=null?e:10,this.url="https://"+t.project+"."+t.host+"/logstores/"+t.logstore+"/track",this.opt=t,t.installUnloadHook&&typeof t.installUnloadHook=="function"&&t.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(t=this.arr){const r={__logs__:t};return this.opt.tags&&(r.__tags__=this.opt.tags),this.opt.topic&&(r.__topic__=this.opt.topic),this.opt.source&&(r.__source__=this.opt.source),JSON.stringify(r)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const t=this.assemblePayload();this.opt.sendPayload(this.url,t)}}transString(t){let r={};for(let e in t)typeof t[e]=="object"?r[e]=JSON.stringify(t[e]):r[e]=String(t[e]);return r}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 t=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){t.sendImmediateInner()},this.time*1e3)}}send(t){const r=this.transString(t);this.arr.push(r),this.sendInner()}sendImmediate(t){const r=this.transString(t);this.arr.push(r),this.sendImmediateInner()}sendBatchLogs(t){const r=t.map(e=>this.transString(e));this.arr.push(...r),this.sendInner()}sendBatchLogsImmediate(t){const r=t.map(e=>this.transString(e));this.arr.push(...r),this.sendImmediateInner()}},hc=M,lc=uc;function dc(t,r){return navigator&&navigator.sendBeacon?navigator.sendBeacon(`${t}?APIVersion=0.6.0`,r):!1}function pc(t,r){const e=new window.XMLHttpRequest;e.open("POST",t,!0),e.setRequestHeader("x-log-apiversion","0.6.0"),e.setRequestHeader("x-log-bodyrawsize",r.length.toString());const i=new Blob([r],{type:"application/x-protobuf"});e.send(i)}function gc(t,r){try{dc(t,r)||pc(t,r)}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:",t))}}class qs extends lc{constructor(r){const e=Object.assign({},r,{installUnloadHook:i=>{window.addEventListener("beforeunload",()=>{i()})},sendPayload:(i,s)=>{gc(i,s)}});super(e)}}hc.defineGlobal(window,"SLS_Tracker",qs);var fc=qs,Ri={},mc={get exports(){return Ri},set exports(t){Ri=t}};(function(t,r){(function(e,i){var s="1.0.35",a="",n="?",o="function",c="undefined",h="object",f="string",p="major",u="model",g="name",m="type",d="vendor",S="version",b="architecture",w="console",_="mobile",R="tablet",x="smarttv",z="wearable",j="embedded",O=350,ie="Amazon",Ae="Apple",ut="ASUS",pe="BlackBerry",ge="Browser",Re="Chrome",qe="Edge",Ze="Firefox",et="Google",Ve="Huawei",Me="LG",He="Microsoft",Te="Motorola",be="Opera",ve="Samsung",Je="Sharp",Z="Sony",fe="Xiaomi",Ge="Zebra",Yt="Facebook",Mt="Chromium OS",Qt="Mac OS",_t=function(K,Y){var F={};for(var ee in K)Y[ee]&&Y[ee].length%2===0?F[ee]=Y[ee].concat(K[ee]):F[ee]=K[ee];return F},ht=function(K){for(var Y={},F=0;F<K.length;F++)Y[K[F].toUpperCase()]=K[F];return Y},Zt=function(K,Y){return typeof K===f?ei(Y).indexOf(ei(K))!==-1:!1},ei=function(K){return K.toLowerCase()},Jc=function(K){return typeof K===f?K.replace(/[^\d\.]/g,a).split(".")[0]:i},Ir=function(K,Y){if(typeof K===f)return K=K.replace(/^\s\s*/,a),typeof Y===c?K:K.substring(0,O)},ti=function(K,Y){for(var F=0,ee,lt,ze,X,U,tt;F<Y.length&&!U;){var Ar=Y[F],da=Y[F+1];for(ee=lt=0;ee<Ar.length&&!U&&Ar[ee];)if(U=Ar[ee++].exec(K),U)for(ze=0;ze<da.length;ze++)tt=U[++lt],X=da[ze],typeof X===h&&X.length>0?X.length===2?typeof X[1]==o?this[X[0]]=X[1].call(this,tt):this[X[0]]=X[1]:X.length===3?typeof X[1]===o&&!(X[1].exec&&X[1].test)?this[X[0]]=tt?X[1].call(this,tt,X[2]):i:this[X[0]]=tt?tt.replace(X[1],X[2]):i:X.length===4&&(this[X[0]]=tt?X[3].call(this,tt.replace(X[1],X[2])):i):this[X]=tt||i;F+=2}},Er=function(K,Y){for(var F in Y)if(typeof Y[F]===h&&Y[F].length>0){for(var ee=0;ee<Y[F].length;ee++)if(Zt(Y[F][ee],K))return F===n?i:F}else if(Zt(Y[F],K))return F===n?i:F;return K},Gc={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},ha={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"},la={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[S,[g,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[S,[g,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[g,S],[/opios[\/ ]+([\w\.]+)/i],[S,[g,be+" Mini"]],[/\bopr\/([\w\.]+)/i],[S,[g,be]],[/(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],[g,S],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[S,[g,"UC"+ge]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[S,[g,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[S,[g,"WeChat"]],[/konqueror\/([\w\.]+)/i],[S,[g,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[S,[g,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[S,[g,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[g,/(.+)/,"$1 Secure "+ge],S],[/\bfocus\/([\w\.]+)/i],[S,[g,Ze+" Focus"]],[/\bopt\/([\w\.]+)/i],[S,[g,be+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[S,[g,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[S,[g,"Dolphin"]],[/coast\/([\w\.]+)/i],[S,[g,be+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[S,[g,"MIUI "+ge]],[/fxios\/([-\w\.]+)/i],[S,[g,Ze]],[/\bqihu|(qi?ho?o?|360)browser/i],[[g,"360 "+ge]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[g,/(.+)/,"$1 "+ge],S],[/(comodo_dragon)\/([\w\.]+)/i],[[g,/_/g," "],S],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[g,S],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[g],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[g,Yt],S],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[g,S],[/\bgsa\/([\w\.]+) .*safari\//i],[S,[g,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[S,[g,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[S,[g,Re+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[g,Re+" WebView"],S],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[S,[g,"Android "+ge]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[g,S],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[S,[g,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[S,g],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[g,[S,Er,Gc]],[/(webkit|khtml)\/([\w\.]+)/i],[g,S],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[g,"Netscape"],S],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[S,[g,Ze+" 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],[g,S],[/(cobalt)\/([\w\.]+)/i],[g,[S,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[b,"amd64"]],[/(ia32(?=;))/i],[[b,ei]],[/((?: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/,a,ei]],[/(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,ei]]],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],[u,[d,ve],[m,R]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[d,ve],[m,_]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[d,Ae],[m,_]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[d,Ae],[m,R]],[/(macintosh);/i],[u,[d,Ae]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[d,Je],[m,_]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[d,Ve],[m,R]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[d,Ve],[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],[[u,/_/g," "],[d,fe],[m,_]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[d,fe],[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],[u,[d,"OPPO"],[m,_]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[d,"Vivo"],[m,_]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[d,"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],[u,[d,Te],[m,_]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[d,Te],[m,R]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[d,Me],[m,R]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[d,Me],[m,_]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[d,"Lenovo"],[m,R]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[d,"Nokia"],[m,_]],[/(pixel c)\b/i],[u,[d,et],[m,R]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[d,et],[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],[u,[d,Z],[m,_]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[d,Z],[m,R]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[d,"OnePlus"],[m,_]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[d,ie],[m,R]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[d,ie],[m,_]],[/(playbook);[-\w\),; ]+(rim)/i],[u,d,[m,R]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[d,pe],[m,_]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[d,ut],[m,R]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[d,ut],[m,_]],[/(nexus 9)/i],[u,[d,"HTC"],[m,R]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[u,/_/g," "],[m,_]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[d,"Acer"],[m,R]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[d,"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],[d,u,[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],[d,u,[m,R]],[/(surface duo)/i],[u,[d,He],[m,R]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[d,"Fairphone"],[m,_]],[/(u304aa)/i],[u,[d,"AT&T"],[m,_]],[/\bsie-(\w*)/i],[u,[d,"Siemens"],[m,_]],[/\b(rct\w+) b/i],[u,[d,"RCA"],[m,R]],[/\b(venue[\d ]{2,7}) b/i],[u,[d,"Dell"],[m,R]],[/\b(q(?:mv|ta)\w+) b/i],[u,[d,"Verizon"],[m,R]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[d,"Barnes & Noble"],[m,R]],[/\b(tm\d{3}\w+) b/i],[u,[d,"NuVision"],[m,R]],[/\b(k88) b/i],[u,[d,"ZTE"],[m,R]],[/\b(nx\d{3}j) b/i],[u,[d,"ZTE"],[m,_]],[/\b(gen\d{3}) b.+49h/i],[u,[d,"Swiss"],[m,_]],[/\b(zur\d{3}) b/i],[u,[d,"Swiss"],[m,R]],[/\b((zeki)?tb.*\b) b/i],[u,[d,"Zeki"],[m,R]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],u,[m,R]],[/\b(ns-?\w{0,9}) b/i],[u,[d,"Insignia"],[m,R]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[d,"NextBook"],[m,R]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],u,[m,_]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],u,[m,_]],[/\b(ph-1) /i],[u,[d,"Essential"],[m,_]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[d,"Envizen"],[m,R]],[/\b(trio[-\w\. ]+) b/i],[u,[d,"MachSpeed"],[m,R]],[/\btu_(1491) b/i],[u,[d,"Rotor"],[m,R]],[/(shield[\w ]+) b/i],[u,[d,"Nvidia"],[m,R]],[/(sprint) (\w+)/i],[d,u,[m,_]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[d,He],[m,_]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[d,Ge],[m,R]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[d,Ge],[m,_]],[/smart-tv.+(samsung)/i],[d,[m,x]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[d,ve],[m,x]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,Me],[m,x]],[/(apple) ?tv/i],[d,[u,Ae+" TV"],[m,x]],[/crkey/i],[[u,Re+"cast"],[d,et],[m,x]],[/droid.+aft(\w)( bui|\))/i],[u,[d,ie],[m,x]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[d,Je],[m,x]],[/(bravia[\w ]+)( bui|\))/i],[u,[d,Z],[m,x]],[/(mitv-\w{5}) bui/i],[u,[d,fe],[m,x]],[/Hbbtv.*(technisat) (.*);/i],[d,u,[m,x]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[d,Ir],[u,Ir],[m,x]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[m,x]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,u,[m,w]],[/droid.+; (shield) bui/i],[u,[d,"Nvidia"],[m,w]],[/(playstation [345portablevi]+)/i],[u,[d,Z],[m,w]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[d,He],[m,w]],[/((pebble))app/i],[d,u,[m,z]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[d,Ae],[m,z]],[/droid.+; (glass) \d/i],[u,[d,et],[m,z]],[/droid.+; (wt63?0{2,3})\)/i],[u,[d,Ge],[m,z]],[/(quest( 2| pro)?)/i],[u,[d,Yt],[m,z]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[m,j]],[/(aeobc)\b/i],[u,[d,ie],[m,j]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[m,_]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[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],[u,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[S,[g,qe+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[S,[g,"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],[g,S],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[S,g]],os:[[/microsoft (windows) (vista|xp)/i],[g,S],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[g,[S,Er,ha]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,"Windows"],[S,Er,ha]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[S,/_/g,"."],[g,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[g,Qt],[S,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[S,g],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[g,S],[/\(bb(10);/i],[S,[g,pe]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[S,[g,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[S,[g,Ze+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[S,[g,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[S,[g,"watchOS"]],[/crkey\/([\d\.]+)/i],[S,[g,Re+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[g,Mt],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],[g,S],[/(sunos) ?([\w\.\d]*)/i],[[g,"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],[g,S]]},Fe=function(K,Y){if(typeof K===h&&(Y=K,K=i),!(this instanceof Fe))return new Fe(K,Y).getResult();var F=typeof e!==c&&e.navigator?e.navigator:i,ee=K||(F&&F.userAgent?F.userAgent:a),lt=F&&F.userAgentData?F.userAgentData:i,ze=Y?_t(la,Y):la,X=F&&F.userAgent==ee;return this.getBrowser=function(){var U={};return U[g]=i,U[S]=i,ti.call(U,ee,ze.browser),U[p]=Jc(U[S]),X&&F&&F.brave&&typeof F.brave.isBrave==o&&(U[g]="Brave"),U},this.getCPU=function(){var U={};return U[b]=i,ti.call(U,ee,ze.cpu),U},this.getDevice=function(){var U={};return U[d]=i,U[u]=i,U[m]=i,ti.call(U,ee,ze.device),X&&!U[m]&&lt&&lt.mobile&&(U[m]=_),X&&U[u]=="Macintosh"&&F&&typeof F.standalone!==c&&F.maxTouchPoints&&F.maxTouchPoints>2&&(U[u]="iPad",U[m]=R),U},this.getEngine=function(){var U={};return U[g]=i,U[S]=i,ti.call(U,ee,ze.engine),U},this.getOS=function(){var U={};return U[g]=i,U[S]=i,ti.call(U,ee,ze.os),X&&!U[g]&&lt&&lt.platform!="Unknown"&&(U[g]=lt.platform.replace(/chrome os/i,Mt).replace(/macos/i,Qt)),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 ee},this.setUA=function(U){return ee=typeof U===f&&U.length>O?Ir(U,O):U,this},this.setUA(ee),this};Fe.VERSION=s,Fe.BROWSER=ht([g,S,p]),Fe.CPU=ht([b]),Fe.DEVICE=ht([u,d,m,w,_,x,R,z,j]),Fe.ENGINE=Fe.OS=ht([g,S]),t.exports&&(r=t.exports=Fe),r.UAParser=Fe;var Nt=typeof e!==c&&(e.jQuery||e.Zepto);if(Nt&&!Nt.ua){var ki=new Fe;Nt.ua=ki.getResult(),Nt.ua.get=function(){return ki.getUA()},Nt.ua.set=function(K){ki.setUA(K);var Y=ki.getResult();for(var F in Y)Nt.ua[F]=Y[F]}}})(typeof window=="object"?window:Vn)})(mc,Ri);let Ii;const Sc=new Uint8Array(16);function bc(){if(!Ii&&(Ii=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ii))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ii(Sc)}const de=[];for(let t=0;t<256;++t)de.push((t+256).toString(16).slice(1));function vc(t,r=0){return(de[t[r+0]]+de[t[r+1]]+de[t[r+2]]+de[t[r+3]]+"-"+de[t[r+4]]+de[t[r+5]]+"-"+de[t[r+6]]+de[t[r+7]]+"-"+de[t[r+8]]+de[t[r+9]]+"-"+de[t[r+10]]+de[t[r+11]]+de[t[r+12]]+de[t[r+13]]+de[t[r+14]]+de[t[r+15]]).toLowerCase()}const yc=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Js={randomUUID:yc};function wc(t,r,e){if(Js.randomUUID&&!r&&!t)return Js.randomUUID();t=t||{};const i=t.random||(t.rng||bc)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,r){e=e||0;for(let s=0;s<16;++s)r[e+s]=i[s];return r}return vc(i)}var Sr={},_c={get exports(){return Sr},set exports(t){Sr=t}},br={},Rc={get exports(){return br},set exports(t){br=t}};(function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r={rotl:function(e,i){return e<<i|e>>>32-i},rotr:function(e,i){return e<<32-i|e>>>i},endian:function(e){if(e.constructor==Number)return r.rotl(e,8)&16711935|r.rotl(e,24)&4278255360;for(var i=0;i<e.length;i++)e[i]=r.endian(e[i]);return e},randomBytes:function(e){for(var i=[];e>0;e--)i.push(Math.floor(Math.random()*256));return i},bytesToWords:function(e){for(var i=[],s=0,a=0;s<e.length;s++,a+=8)i[a>>>5]|=e[s]<<24-a%32;return i},wordsToBytes:function(e){for(var i=[],s=0;s<e.length*32;s+=8)i.push(e[s>>>5]>>>24-s%32&255);return i},bytesToHex:function(e){for(var i=[],s=0;s<e.length;s++)i.push((e[s]>>>4).toString(16)),i.push((e[s]&15).toString(16));return i.join("")},hexToBytes:function(e){for(var i=[],s=0;s<e.length;s+=2)i.push(parseInt(e.substr(s,2),16));return i},bytesToBase64:function(e){for(var i=[],s=0;s<e.length;s+=3)for(var a=e[s]<<16|e[s+1]<<8|e[s+2],n=0;n<4;n++)s*8+n*6<=e.length*8?i.push(t.charAt(a>>>6*(3-n)&63)):i.push("=");return i.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/ig,"");for(var i=[],s=0,a=0;s<e.length;a=++s%4)a!=0&&i.push((t.indexOf(e.charAt(s-1))&Math.pow(2,-2*a+8)-1)<<a*2|t.indexOf(e.charAt(s))>>>6-a*2);return i}};Rc.exports=r})();var vr={utf8:{stringToBytes:function(t){return vr.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(vr.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var r=[],e=0;e<t.length;e++)r.push(t.charCodeAt(e)&255);return r},bytesToString:function(t){for(var r=[],e=0;e<t.length;e++)r.push(String.fromCharCode(t[e]));return r.join("")}}},Gs=vr;/*!
10
- * Determine if an object is a Buffer
11
- *
12
- * @author Feross Aboukhadijeh <https://feross.org>
13
- * @license MIT
14
- */var Ic=function(t){return t!=null&&(zs(t)||Ec(t)||!!t._isBuffer)};function zs(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Ec(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&zs(t.slice(0,0))}(function(){var t=br,r=Gs.utf8,e=Ic,i=Gs.bin,s=function(a,n){a.constructor==String?n&&n.encoding==="binary"?a=i.stringToBytes(a):a=r.stringToBytes(a):e(a)?a=Array.prototype.slice.call(a,0):!Array.isArray(a)&&a.constructor!==Uint8Array&&(a=a.toString());for(var o=t.bytesToWords(a),c=a.length*8,h=1732584193,f=-271733879,p=-1732584194,u=271733878,g=0;g<o.length;g++)o[g]=(o[g]<<8|o[g]>>>24)&16711935|(o[g]<<24|o[g]>>>8)&4278255360;o[c>>>5]|=128<<c%32,o[(c+64>>>9<<4)+14]=c;for(var m=s._ff,d=s._gg,S=s._hh,b=s._ii,g=0;g<o.length;g+=16){var w=h,_=f,R=p,x=u;h=m(h,f,p,u,o[g+0],7,-680876936),u=m(u,h,f,p,o[g+1],12,-389564586),p=m(p,u,h,f,o[g+2],17,606105819),f=m(f,p,u,h,o[g+3],22,-1044525330),h=m(h,f,p,u,o[g+4],7,-176418897),u=m(u,h,f,p,o[g+5],12,1200080426),p=m(p,u,h,f,o[g+6],17,-1473231341),f=m(f,p,u,h,o[g+7],22,-45705983),h=m(h,f,p,u,o[g+8],7,1770035416),u=m(u,h,f,p,o[g+9],12,-1958414417),p=m(p,u,h,f,o[g+10],17,-42063),f=m(f,p,u,h,o[g+11],22,-1990404162),h=m(h,f,p,u,o[g+12],7,1804603682),u=m(u,h,f,p,o[g+13],12,-40341101),p=m(p,u,h,f,o[g+14],17,-1502002290),f=m(f,p,u,h,o[g+15],22,1236535329),h=d(h,f,p,u,o[g+1],5,-165796510),u=d(u,h,f,p,o[g+6],9,-1069501632),p=d(p,u,h,f,o[g+11],14,643717713),f=d(f,p,u,h,o[g+0],20,-373897302),h=d(h,f,p,u,o[g+5],5,-701558691),u=d(u,h,f,p,o[g+10],9,38016083),p=d(p,u,h,f,o[g+15],14,-660478335),f=d(f,p,u,h,o[g+4],20,-405537848),h=d(h,f,p,u,o[g+9],5,568446438),u=d(u,h,f,p,o[g+14],9,-1019803690),p=d(p,u,h,f,o[g+3],14,-187363961),f=d(f,p,u,h,o[g+8],20,1163531501),h=d(h,f,p,u,o[g+13],5,-1444681467),u=d(u,h,f,p,o[g+2],9,-51403784),p=d(p,u,h,f,o[g+7],14,1735328473),f=d(f,p,u,h,o[g+12],20,-1926607734),h=S(h,f,p,u,o[g+5],4,-378558),u=S(u,h,f,p,o[g+8],11,-2022574463),p=S(p,u,h,f,o[g+11],16,1839030562),f=S(f,p,u,h,o[g+14],23,-35309556),h=S(h,f,p,u,o[g+1],4,-1530992060),u=S(u,h,f,p,o[g+4],11,1272893353),p=S(p,u,h,f,o[g+7],16,-155497632),f=S(f,p,u,h,o[g+10],23,-1094730640),h=S(h,f,p,u,o[g+13],4,681279174),u=S(u,h,f,p,o[g+0],11,-358537222),p=S(p,u,h,f,o[g+3],16,-722521979),f=S(f,p,u,h,o[g+6],23,76029189),h=S(h,f,p,u,o[g+9],4,-640364487),u=S(u,h,f,p,o[g+12],11,-421815835),p=S(p,u,h,f,o[g+15],16,530742520),f=S(f,p,u,h,o[g+2],23,-995338651),h=b(h,f,p,u,o[g+0],6,-198630844),u=b(u,h,f,p,o[g+7],10,1126891415),p=b(p,u,h,f,o[g+14],15,-1416354905),f=b(f,p,u,h,o[g+5],21,-57434055),h=b(h,f,p,u,o[g+12],6,1700485571),u=b(u,h,f,p,o[g+3],10,-1894986606),p=b(p,u,h,f,o[g+10],15,-1051523),f=b(f,p,u,h,o[g+1],21,-2054922799),h=b(h,f,p,u,o[g+8],6,1873313359),u=b(u,h,f,p,o[g+15],10,-30611744),p=b(p,u,h,f,o[g+6],15,-1560198380),f=b(f,p,u,h,o[g+13],21,1309151649),h=b(h,f,p,u,o[g+4],6,-145523070),u=b(u,h,f,p,o[g+11],10,-1120210379),p=b(p,u,h,f,o[g+2],15,718787259),f=b(f,p,u,h,o[g+9],21,-343485551),h=h+w>>>0,f=f+_>>>0,p=p+R>>>0,u=u+x>>>0}return t.endian([h,f,p,u])};s._ff=function(a,n,o,c,h,f,p){var u=a+(n&o|~n&c)+(h>>>0)+p;return(u<<f|u>>>32-f)+n},s._gg=function(a,n,o,c,h,f,p){var u=a+(n&c|o&~c)+(h>>>0)+p;return(u<<f|u>>>32-f)+n},s._hh=function(a,n,o,c,h,f,p){var u=a+(n^o^c)+(h>>>0)+p;return(u<<f|u>>>32-f)+n},s._ii=function(a,n,o,c,h,f,p){var u=a+(o^(n|~c))+(h>>>0)+p;return(u<<f|u>>>32-f)+n},s._blocksize=16,s._digestsize=16,_c.exports=function(a,n){if(a==null)throw new Error("Illegal argument "+a);var o=t.wordsToBytes(s(a,n));return n&&n.asBytes?o:n&&n.asString?i.bytesToString(o):t.bytesToHex(o)}})();function Ac(t){return t?t.toLowerCase().indexOf("android")>=0||t.toLowerCase().indexOf("ios")>=0?"h5":"pc":"unknown"}function Tc(t){const r=Sr(t),e=localStorage.getItem(r);if(e&&e.length===36)return e;const i=wc();return localStorage.setItem(r,i),i}var Ei,Ai,Xt;class Xs{constructor(r){or(this,Ei,void 0),or(this,Ai,void 0),or(this,Xt,void 0);const c=r,{commonParams:e,version:i}=c,s=fa(c,["commonParams","version"]);cr(this,Ei,new fc(s)),cr(this,Xt,Tc(s.project));const a=new Ri;a.setUA(window.navigator.userAgent);const n=a.getResult(),o=q({av:i,os:n.os.name,ov:n.os.version,bt:n.browser.name,bv:n.browser.version,tt:Ac(n.os.name),uuid:gi(this,Xt),host:window.location.host},e);cr(this,Ai,o)}getUUID(){return gi(this,Xt)}send(r,e,i){gi(this,Ei).send(q(q({msgId:String(r),args:typeof e=="string"?e:new URLSearchParams(e).toString(),pu:window.location.href,ct:Date.now().toString()},gi(this,Ai)),i))}}Ei=new WeakMap,Ai=new WeakMap,Xt=new WeakMap;class Pc{constructor(r){l(this,"index",0);l(this,"tracker");l(this,"enable",!0);l(this,"commonParams",{});if(r===!1){this.enable=!1;return}if(typeof r=="object"&&r.extraParams&&typeof r.extraParams=="string")try{this.commonParams={extra:r.extraParams}}catch(e){}this.tracker=new Xs({version:Dt,host:"cn-hangzhou.log.aliyuncs.com",project:"web-rtc-grtn",logstore:"client",time:5,count:10,source:typeof r=="object"?r.biz:""})}updateAuthInfo(r){var e,i,s;this.commonParams=Lt(q({},this.commonParams),{apid:(e=r==null?void 0:r.appId)!=null?e:"",usrid:(i=r==null?void 0:r.userId)!=null?i:"",channelid:(s=r==null?void 0:r.channelId)!=null?s:""})}reportJoinChannel(r){var i,s,a;const e={jnnonce:(i=r==null?void 0:r.nonce)!=null?i:"",jntoken:(s=r==null?void 0:r.token)!=null?s:"",jntm:(a=r==null?void 0:r.timestamp)!=null?a:""};this.report(70012,e)}reportJoinChannelRes(r,e,i){this.report(70013,{rslt:r,message:e,ct:i})}reportLeaveChannel(){this.report(70015)}reportPush(r,e,i,s,a,n,o,c,h,f,p,u){this.report(10030,{calid:r,isvl:e?1:0,isvs:i?1:0,isvss:s?1:0,isaudio:a?1:0,rslt:n,tid:o,pubtm:c,est:h,dctid:f,httptid:p,url:u})}reportPull(r,e,i,s,a,n,o,c,h,f,p,u){this.report(10050,{calid:r,rmtid:e,isvl:i?1:0,isvs:s?1:0,isvss:a?1:0,isaudio:n?1:0,rslt:o,tid:"",subtm:c,dctid:h,httptid:f,ajsub:1,url:p,est:u})}reportSubscribeAudioStats(r,e){const{ssrc:i,bytesReceived:s,packetsReceived:a,packetsLost:n,jitterBufferDelay:o,trackIdentifier:c,totalSamplesDuration:h,codec:f}=e,p=h,u=s/p,g=a/p,m=n/p,d=n/a;this.report(10080,{calid:"",rmtid:r,tckid:c,ssrc:i,codec:f,rbr:u,pr:g,pl:m,plr:d,jd:o})}reportSubscribeVideoStats(r,e){const{ssrc:i,bytesReceived:s,trackIdentifier:a,framesDecoded:n,framesReceived:o,frameHeight:c,frameWidth:h,nackCount:f,jitterBufferDelay:p,packetsReceived:u,packetsLost:g,totalInterFrameDelay:m,codec:d}=e,S=m,b=s/S,w=n/S,_=o/S,R=u/S,x=g/S,z=g/u;this.report(10080,{calid:"",rmtid:r,tckid:a,ssrc:i,codec:d,rbr:b,dfps:w,rfps:_,rh:c,rw:h,ns:f,jd:p,pr:R,pl:x,plr:z})}report(r,e,i){var s;this.enable&&((s=this.tracker)==null||s.send(r,e,q(q({},this.commonParams),i!=null?i:{})))}static reportCheck(r,e){new Xs({version:Dt,host:"cn-hangzhou.log.aliyuncs.com",project:"web-rtc-grtn",logstore:"client",time:5,count:10,source:e!=null?e:""}).send(100001,r)}}class kc{constructor(){l(this,"reporter");l(this,"param");l(this,"msgCacheArr",[]);l(this,"index",0)}start(r){this.initParam(r),this.reporter=new ii.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(r){E.info("[LogClient]",r),this.msgCacheArr.length===0&&this.param?this.realSendReport(r):this.msgCacheArr.push(r)}initParam(r){this.param||(this.param={osn:D.SystemUtil.systemName,osv:D.SystemUtil.systemVersion,udid:D.LocalStorage.uuid,statsvrs:"0.6.1",sdkvrs:Dt,dm:D.BrowserUtil.domain,bt:D.BrowserUtil.browserName,bv:D.BrowserUtil.browserVersion,envir:"PRODUCT",apid:r.appId,usrid:r.userId,channelid:r.channelId,evetid:0,args:""})}realSendReport(r){var i;let e={};for(let s in this.param)e[s]=this.param[s];for(let s in r)e[s]=r[s];e.idx=this.index,++this.index,(i=this.reporter)==null||i.send(e)}}class Cc{constructor(){l(this,"logClient");this.logClient=new kc}start(r){this.logClient.start(r)}stop(){this.logClient.stop()}reportJoin(r,e,i){this.log({evetid:10010,args:this.data2String({joitm:r,rslt:e,mode:"wss",tid:i,gslbtm:0})})}reportJoinInvoked(r,e,i){this.log({evetid:60010,args:this.data2String({usrid:r,usrn:e,channelid:i,ua:navigator.userAgent})})}reportIceState(r,e,i){this.log({evetid:10011,args:this.data2String({calid:r,icestate:e,evt_seq:i})})}reportLeave(r,e,i){this.log({evetid:10020,args:this.data2String({lvetm:r,rslt:e,tid:i})})}reportLeaveInvoked(){this.log({evetid:60020})}reportPublish(r,e,i,s,a,n,o,c){this.log({evetid:10030,args:this.data2String({callid:r,isvl:e?1:0,isvs:i?1:0,isvss:s?1:0,isaudio:a?1:0,rslt:n,tid:o,pubtm:c})})}reportPublishInvoked(r,e,i,s){this.log({evetid:60030,args:this.data2String({isvl:typeof r=="boolean"?r?1:0:r,isvs:typeof e=="boolean"?e?1:0:e,isvss:typeof i=="boolean"?i?1:0:i,isaudio:typeof s=="boolean"?s?1:0:s})})}reportRepublish(r,e,i,s,a,n,o,c){this.log({evetid:10032,args:this.data2String({calid:r,isvl:e?1:0,isvs:0,isvss:i?1:0,isaudio:s?1:0,rslt:a,tid:n,repubtm:o,msg:c})})}reportRepublishInvoked(r,e,i){this.log({evetid:60032,args:this.data2String({callid:r,st:i,tp:e})})}reportUnpublish(r,e,i,s){this.log({evetid:10040,args:this.data2String({calid:r,unpubtm:e,rslt:i,tid:s})})}reportUnpublishInvoked(){this.log({evetid:60040})}reportSubscribe(r,e,i,s,a,n,o,c,h,f){this.log({evetid:10050,args:this.data2String({calid:r,rmtid:e,isvl:i?1:0,isvs:s?1:0,isvss:a?1:0,isaudio:n?1:0,rslt:o,tid:c,subtm:h,rmtuid:f})})}reportSubscribeInvoked(r="",e,i,s,a){this.log({evetid:60050,args:this.data2String({rmtid:r,isvl:typeof e=="boolean"?e?1:0:e,isvs:typeof i=="boolean"?i?1:0:i,isvss:typeof s=="boolean"?s?1:0:s,isaudio:typeof a=="boolean"?a?1:0:a})})}reportUnsubscribe(r,e,i,s,a){this.log({evetid:10060,args:this.data2String({calid:r,rmtid:e,unsubtm:i,rslt:s,tid:a})})}reportUnsubscribeInvoked(r=""){this.log({evetid:60060,args:this.data2String({rmtid:r})})}reportRoleUpdate(r,e,i,s){this.log({evetid:11040,args:this.data2String({or:r,nr:e,ctm:i,rslt:s})})}reportRoleUpdateInvoked(r){this.log({evetid:61040,args:this.data2String({nr:r})})}reportVideoProfile(r){this.log({evetid:20074,args:this.data2String({pf:r,tckid:"sophon_camera_large"})})}reportScreenProfile(r){this.log({evetid:20074,args:this.data2String({pf:r,tckid:"sophon_screenshare"})})}reportError(r){this.log({evetid:20090,args:this.data2String(r)})}log(r){r&&(r.tm=new Date().getTime()),this.logClient.sendReport(r)}data2String(r){let e="";for(let i in r)e.length&&(e+="&"),e+=i+"="+r[i];return e}}class Ys{constructor(r){l(this,"name","COMMON");this.name=r||this.name}info(...r){}warn(...r){}print(r,...e){const i=r.toLowerCase();i&&console[i](`[${r}][${this.name}]`,...e)}}l(Ys,"LEVEL",0);class Mc{constructor(){l(this,"logger",new Ys("AudioMixer"));l(this,"audioContext",new AudioContext);l(this,"audioDestination",this.audioContext.createMediaStreamDestination());l(this,"audioTrack",ln(this.audioDestination.stream));l(this,"sourceNodeMap",{})}get sourceNodeList(){return Object.values(this.sourceNodeMap).map(r=>r.sourceNode).filter(r=>!!r)}get gainNodeList(){return Object.values(this.sourceNodeMap).map(r=>r.gainNode).filter(r=>!!r)}get sourceCount(){return this.sourceNodeList.length}resume(){var r;return(r=this.audioContext)==null?void 0:r.resume()}addTrack(r){this.connectTrack(r)}hasTrack(r){return!!this.sourceNodeMap[r]}removeTrack(r){const{sourceNode:e,gainNode:i}=this.sourceNodeMap[r]||{};i==null||i.disconnect(),e==null||e.disconnect(),delete this.sourceNodeMap[r],e?this.logger.info("SourceNode disconnected. Active source node:",this.sourceNodeList.length):this.logger.warn(`SourceNode ${r} does not exit. Active source node: ${this.sourceNodeList.length}`)}getAudioTrack(){return this.audioTrack}setVolume(r,e){const{gainNode:i}=this.sourceNodeMap[e]||{};i?(this.logger.info(`Setting node(${e}) volume to ${this.scale(r)}`),i.gain.value=this.scale(r)):this.logger.warn(`GainNode ${e} does not exit.`)}reset(){this.disconnectSourceNode(),this.sourceNodeMap={}}dispose(){var r;this.reset(),(r=this.audioTrack)==null||r.stop(),this.audioDestination.disconnect(),this.audioContext.close()}connectTrack(r){if(!this.audioContext)return this.logger.warn("AudioContext not initialized");let e=new MediaStream;e.addTrack(r);const i=this.audioContext.createMediaStreamSource(e),s=this.audioContext.createGain();s.gain.value=1,i.connect(s),s.connect(this.audioDestination),this.sourceNodeMap[r.id]={track:r,sourceNode:i,gainNode:s},this.logger.info("New sourceNode connected. Active source node:",this.sourceNodeList.length)}disconnectSourceNode(){this.sourceNodeList.forEach(r=>r.disconnect()),this.gainNodeList.forEach(r=>r.disconnect())}scale(r){return r/100}}const Nc=4;class Lc extends Tt{constructor(){super("audioMixer",ce.AliRtcSdkStreamTypeCapture,ni.AUDIO);l(this,"audioMixer");l(this,"primaryAudioTrackId");l(this,"screenAudioTrackId");l(this,"dirty",!1);this.zIndex=8}get initOptions(){return{audio:1,screen:1}}setOptions(e){Object.entries(e).forEach(([i,s])=>{this.isValidVolume(s)&&(this.options[i]=s)}),this.dirty=!0,this.emit("updated")}isSupported(){return"AudioContext"in window}shouldUpdate(e,i){var n,o;if(e.type!==ce.AliRtcSdkStreamTypeCapture)return!1;const s=i.find(c=>c.type===ce.AliRtcSdkStreamTypeCapture),a=i.find(c=>c.type===ce.AliRtcSdkStreamTypeScreen);return!(this.primaryAudioTrackId===((n=s==null?void 0:s.currentAudioTrack)==null?void 0:n.id)&&this.screenAudioTrackId===((o=a==null?void 0:a.currentAudioTrack)==null?void 0:o.id)&&!this.dirty)}process(e,i){return v(this,null,function*(){var o,c;this.dirty=!1;const s=i.find(h=>h.type===ce.AliRtcSdkStreamTypeScreen),a=e.currentAudioTrack,n=s==null?void 0:s.currentAudioTrack;if(!n&&this.options.audio===1){this.audioMixer&&(this.audioMixer.dispose(),this.audioMixer=void 0),this.primaryAudioTrackId=a==null?void 0:a.id,e.updateAudioTrack(a);return}this.audioMixer||(this.audioMixer=new Mc),yield this.audioMixer.resume(),this.primaryAudioTrackId&&(a==null?void 0:a.id)!==this.primaryAudioTrackId&&((o=this.audioMixer)==null||o.removeTrack(this.primaryAudioTrackId)),a&&!this.audioMixer.hasTrack(a==null?void 0:a.id)&&this.audioMixer.addTrack(a),this.primaryAudioTrackId=a==null?void 0:a.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 i;(i=this.audioMixer)==null||i.dispose(),super.clear(e)}}class yr{constructor(r,e){l(this,"originTrack");l(this,"originVideo");l(this,"targetWidth");l(this,"targetHeight");l(this,"targetFrameRate");l(this,"targetCanvas");l(this,"animationFrameId");l(this,"resultTrack");this.targetWidth=e.width,this.targetHeight=e.height,this.targetFrameRate=e.frameRate,this.originTrack=r,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(r){this.targetWidth=r.width,this.targetHeight=r.height,this.targetFrameRate=r.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(r,e,i,s){const a=e/r,n=s/i;let o=i,c=s,h=0,f=0;return n>a?(o=Math.round(c/a),h=Math.round((i-o)/2)):n<a&&(c=Math.round(o*a),f=Math.round((s-c)/2)),{x:h,y:f,width:o,height:c}}}class Oc extends yr{constructor(e,i){super(e,i);l(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 i=new MediaStream;i.addTrack(e),this.originVideo.srcObject=i,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 i=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,i.x,i.y,i.width,i.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 Vc=`
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}&timestamp=${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
- `,Dc=`
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 xc(){let t;try{const r=document.createElement("canvas");r.width=1,r.height=1;const e={alpha:!1,depth:!1,stencil:!1,antialias:!1,preferLowPowerToHighPerformance:!0};t=r.getContext("webgl2",e)}catch(r){return!1}return!!t}function Uc(t){const r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),r}function Qs(t,r,e){const i=t.createShader(r);if(!i){console.error("create shader failed");return}return t.shaderSource(i,e),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS)?i:(console.error(`An error occurred compiling the shaders: ${t.getShaderInfoLog(i)}`),t.deleteShader(i),null)}function Bc(t,r,e){const i=Qs(t,t.VERTEX_SHADER,r),s=Qs(t,t.FRAGMENT_SHADER,e),a=t.createProgram();if(!(!a||!i||!s))return t.attachShader(a,i),t.attachShader(a,s),t.linkProgram(a),t.getProgramParameter(a,t.LINK_STATUS)?a:(console.error(`Unable to initialize the shader program: ${t.getProgramInfoLog(a)}`),null)}function Hc(t,r,e,i=0,s=0){const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a);const n=i,o=s,c=r+i,h=e+s,f=[n,o,c,o,n,h,n,h,c,o,c,h];return t.bufferData(t.ARRAY_BUFFER,new Float32Array(f),t.STATIC_DRAW),a}class Zs extends yr{constructor(e,i){super(e,i);l(this,"targetCtx");l(this,"targetTexture");l(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 xc()}initGL(){const e=this.targetCtx;if(!e)return;this.targetTexture=Uc(e);const i=Bc(e,Vc,Dc);if(!i){console.log("[ScalerWebGL] program is null.");return}e.useProgram(i);const s=e.getAttribLocation(i,"a_position"),a=e.getAttribLocation(i,"a_texCoord"),n=e.getUniformLocation(i,"u_resolution");if(!n){console.log("[ScalerWebGL] resolutionLocation is null.");return}const o=e.getUniformLocation(i,"u_texture");if(!o){console.log("[ScalerWebGL] textureLocation is null.");return}this.locationMap={program:i,positionLocation:s,texCoordLocation:a,resolutionLocation:n,textureLocation:o},this.updateBuffer()}initStream(e){const i=new MediaStream;i.addTrack(e),this.originVideo.srcObject=i,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,i=this.locationMap.positionLocation,s=this.locationMap.texCoordLocation,a=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=Hc(e,n.width,n.height,n.x,n.y);e.enableVertexAttribArray(i),e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s);const c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),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,c),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),e.uniform2f(a,this.targetWidth,this.targetHeight)}renderTexture(){const e=this.targetTexture,i=this.targetCtx,s=this.locationMap.textureLocation;!e||!i||(i.bindTexture(i.TEXTURE_2D,e),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,this.originVideo),i.useProgram(this.locationMap.program),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,e),i.uniform1i(s,0),i.viewport(0,0,i.canvas.width,i.canvas.height),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.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 Fc=`
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 ea extends yr{constructor(e,i){super(e,i);l(this,"processor");l(this,"trackGenerator");l(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"}),s=(window.URL||window.webkitURL).createObjectURL(e);this.worker=new Worker(s);const{readable:a}=this.processor,{writable:n}=this.trackGenerator;this.worker.postMessage({type:"startRender",readable:a,writable:n,width:this.targetWidth,height:this.targetHeight,frameRate:this.targetFrameRate},[a,n])}updateOptions(e){super.updateOptions(e),this.worker&&this.worker.postMessage(q({type:"updateOptions"},e))}dispose(){try{this.processor.readable.cancel(),this.trackGenerator.writable.close()}catch(e){}}getVideoTrack(){return this.trackGenerator}}class wr{static isSupport(){return typeof HTMLCanvasElement.prototype.captureStream=="function"}static getInstance(r,e){return ea.isSupport()?new ea(r,e):Zs.isSupport()?new Zs(r,e):new Oc(r,e)}}class jc extends Tt{constructor(){super(...arguments);l(this,"hasVideoTrack",!1);l(this,"videoScaler")}get initOptions(){return{width:320,height:180,frameRate:15}}setOptions(e){var i;this.options=e,(i=this.videoScaler)==null||i.updateOptions(e)}isSupported(){return wr.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 s=this.options||this.initOptions;this.videoScaler=wr.getInstance(e.currentVideoTrack,s)}const i=this.videoScaler.getVideoTrack();i&&e.updateDualVideoTrack(i)}else e.updateDualVideoTrack(),this.emit("updated"),this.videoScaler&&this.videoScaler.dispose()})}clear(e){super.clear(e),e==null||e.updateDualVideoTrack()}}class _r{static checkString(r){return typeof r=="string"}static checkNumber(r){return typeof r=="number"}static checkHtmlVideoElement(r){return r&&r.nodeName==="VIDEO"}static checkHtmlAudioElement(r){return r&&r.nodeName==="AUDIO"}static checkAuthInfo(r){let e=new C(N.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no authInfo");if(r){if(!r.appId)return e.message="no appId founded",e;if(!r.channelId)return e.message="no channelId founded",e;if(r.timestamp){if(!_r.checkNumber(r.timestamp))return e.message="timestamp should be number",e}else return e.message="no timestamp founded",e;return r.token?r.userId?r.role!==void 0&&!["pub","sub","relay"].includes(r.role)?(e.message="role invalid",e):null:(e.message="no userId founded",e):(e.message="no token founded",e)}else return e}static checkMediaStreamTrack(r){return r instanceof MediaStreamTrack}static checkVideoEncoderConfiguration(r){return r&&(r.width||r.height||r.frameRate||r.bitrateMax)}}class ta{constructor(r){l(this,"taskProfile");l(this,"encodeParam");l(this,"users",[]);l(this,"backgroundColor",0);l(this,"backgrounds",[]);l(this,"watermarks",[]);l(this,"clockWidgets",[]);l(this,"cropMode");l(this,"mediaProcessMode");this.taskProfile=r}}class ia{constructor(r,e,i){l(this,"userId");l(this,"streamType");l(this,"sourceType");this.userId=r,this.streamType=e,this.sourceType=i}}class ra{constructor(r,e,i,s=0,a=16777215,n=Ht.NOTO_SERIF_CJKSC_REGULAR){l(this,"x");l(this,"y");l(this,"fontSize");l(this,"zOrder");l(this,"fontColor");l(this,"fontType");this.x=r,this.y=e,this.fontSize=i,this.zOrder=s,this.fontColor=a,this.fontType=n}toJson(r,e){return{x:Le(this.x,r),y:Le(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:Qi(this.fontColor),zorder:this.zOrder}}}var sa=(t=>(t[t.NOT_DISPLAY=0]="NOT_DISPLAY",t[t.ALWAYS=1]="ALWAYS",t[t.WHEN_NO_VIDEO=2]="WHEN_NO_VIDEO",t))(sa||{});class Rr{constructor(r,e,i,s,a,n=0,o=1,c=1){l(this,"url");l(this,"x");l(this,"y");l(this,"width");l(this,"height");l(this,"alpha");l(this,"display",1);l(this,"zOrder");this.url=r,this.x=e,this.y=i,this.width=s,this.height=a,this.zOrder=n,this.alpha=o,this.display=c}toJson(r,e){return{url:this.url,alpha:this.alpha,display:this.display,x:Le(this.x,r),y:Le(this.y,e),width:Le(this.width,r),height:Le(this.height,e),zorder:this.zOrder}}}l(Rr,"DisplayType",sa);class aa{constructor(r,e,i,s,a=0,n=16777215,o=Ht.NOTO_SERIF_CJKSC_REGULAR){l(this,"text");l(this,"x");l(this,"y");l(this,"fontSize");l(this,"zOrder");l(this,"fontColor");l(this,"fontType");this.text=r,this.x=e,this.y=i,this.fontSize=s,this.zOrder=a,this.fontColor=n,this.fontType=o}toJson(r,e){return{text:this.text,x:Le(this.x,r),y:Le(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:Qi(this.fontColor),zorder:this.zOrder}}}class na{constructor(r,e,i,s,a,n=0,o){l(this,"userId");l(this,"x");l(this,"y");l(this,"width");l(this,"height");l(this,"zOrder");l(this,"sourceType");l(this,"segmentType",Bt.LiveTranscodingNoBody);l(this,"images",[]);l(this,"texts",[]);typeof r=="number"?this.userId=r.toString():this.userId=r,this.x=e,this.y=i,this.width=s,this.height=a,this.zOrder=n,o&&(this.sourceType=o)}toJson(r,e,i,s){const a={paneid:r,majorpane:0,x:Le(this.x,e),y:Le(this.y,i),width:Le(this.width,e),height:Le(this.height,i),zorder:this.zOrder,userid:this.userId,images:this.images.map(n=>n.toJson(e,i)),texts:this.texts.map(n=>n.toJson(e,i))};return this.sourceType&&Ut[this.sourceType]?a.sourcetype=Ut[this.sourceType]:a.sourcetype=Ut[Pt.LiveTranscodingCamera],this.segmentType&&s===ci.LiveTranscodingVirtualBackground?a.segmenttype=this.segmentType:a.segmenttype=Bt.LiveTranscodingNoBody,a}}class $c extends Tt{constructor(){super("AliRtcScreenStandardize",ce.AliRtcSdkStreamTypeScreen);l(this,"canvas");l(this,"lastWidth");l(this,"lastHeight");l(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,i){if(this.canvas&&this.lastWidth===e&&this.lastHeight===i)return;const s=Math.ceil(e/this.options.base)*this.options.base,a=Math.ceil(i/this.options.base)*this.options.base;if(this.canvas||(this.canvas=document.createElement("canvas")),this.canvas.width=s,this.canvas.height=a,this.lastWidth&&e>this.lastWidth||this.lastHeight&&i>this.lastHeight){const n=this.canvas.getContext("2d");n&&n.clearRect(0,0,s,a)}this.lastWidth=e,this.lastHeight=i}shouldUpdate(e){return this.hasScreenTrack!==(!!e.originVideoTrack&&e.videoSource===At.Screen)}handleFrame(e,i){return v(this,null,function*(){var o;const{displayWidth:s,displayHeight:a}=e;if(!s||!a||s%this.options.base===0&&a%this.options.base===0)return this.clear(i),e;this.updateProcessCanvas(s,a);const n=(o=this.canvas)==null?void 0:o.getContext("2d");if(this.canvas&&n){n.drawImage(e,0,0,s,a);const c=new VideoFrame(this.canvas,{timestamp:e.timestamp});return e.close(),c}return e})}process(e){return v(this,null,function*(){var f;if(!e.originVideoTrack||e.videoSource!==At.Screen){this.clear(e),this.hasScreenTrack=!1;return}const i=new MediaStreamTrackProcessor({track:e.originVideoTrack}),s=new MediaStreamTrackGenerator({kind:"video"}),a=new MediaStream([s]),n=this,o=new TransformStream({transform(p,u){return v(this,null,function*(){const g=yield n.handleFrame(p,e);yield u.enqueue(g),g==null||g.close()})}});i.readable.pipeThrough(o).pipeTo(s.writable);const c=(f=a.getVideoTracks())==null?void 0:f[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 Wc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,P=(t,r,e,i)=>{for(var s=i>1?void 0:i?Kc(r,e):r,a=t.length-1,n;a>=0;a--)(n=t[a])&&(s=(i?n(r,e,s):n(s))||s);return i&&s&&Wc(r,e,s),s};const T=(L=class extends Q{constructor(e){super();l(this,"channelProfile");l(this,"clientRole");l(this,"signalingManager");l(this,"userManager");l(this,"liveTranscoding");l(this,"maxSignalingConnectRetryCount");l(this,"reporter");l(this,"webTrackingClient");l(this,"connectState",G.AliRtcConnectionStatusInit);l(this,"networkError",!1);l(this,"audioMixerPlugin");l(this,"dualVideoPlugin");l(this,"_audioOnlyMode",!1);l(this,"_authInfoWillExpireTimer",null);l(this,"_authInfoExpiredTimer",null);l(this,"_serverCheckAuthInfoTimestamp",null);l(this,"_localCheckAuthInfoTimestamp",null);this.webTrackingClient=new Pc(e==null?void 0:e.webTrack),this.reporter=new Cc,this.channelProfile=Qe.AliRtcSdkCommunication,this.clientRole=st.AliRtcSdkLive,this.liveTranscoding=new On,this.signalingManager=new on(this.channelProfile,this.clientRole,(e==null?void 0:e.env)===rt.pre?rt.pre:rt.prod),this.addSignalingManagerListeners(),this.maxSignalingConnectRetryCount=e==null?void 0:e.maxSignalingConnectRetryCount,this.userManager=new ke({reporter:this.reporter,webTrackingClient:this.webTrackingClient,signalingManager:this.signalingManager}),this.addUserManagerListeners(),this.addPublisherListeners(),this.audioMixerPlugin=new Lc,this.enablePlugin(this.audioMixerPlugin),this.dualVideoPlugin=new jc("dualVideoPlugin"),this.enablePlugin(new $c)}static getSdkVersion(){return Dt}static setLogLevel(e){E.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===st.AliRtcSdkInteractive}resetState(){return v(this,null,function*(){yield this.userManager.clear(),this.connectState=G.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 i,s,a;e?yield(i=this.publisher)==null?void 0:i.stopLocalStream(e):(yield(s=this.publisher)==null?void 0:s.publishStop(),(a=this.publisher)==null||a.stopPreview())})}addPublisherListeners(){var e,i,s,a,n,o,c,h,f;(e=this.publisher)==null||e.on(we.Local,p=>{E.event("[Publisher] Device Status Change",p),this.onLocalDeviceStatusChange(p)}),(i=this.publisher)==null||i.on(bt.VideoTrackEnded,()=>{E.event("[Publisher] VideoTrack Ended"),this.emit("localDeviceException",Ke.AliEngineLocalDeviceTypeCamera,re.AliEngineLocalDeviceExceptionTypeCameraInterrupt,"")}),(s=this.publisher)==null||s.on(bt.ScreenTrackEnded,()=>{E.event("[Publisher] ScreenTrack Ended"),this.emit("localDeviceException",Ke.AliEngineLocalDeviceTypeDisplay,re.AliEngineLocalDeviceExceptionTypeDisplayException,"")}),(a=this.publisher)==null||a.on(bt.AudioTrackEnded,()=>{E.event("[Publisher] AudioTrack Ended"),this.emit("localDeviceException",Ke.AliEngineLocalDeviceTypeMic,re.AliEngineLocalDeviceExceptionTypeMicInterrupt,"")}),(n=this.publisher)==null||n.on("localDeviceException",(p,u,g="")=>{this.emit("localDeviceException",p,u,g)}),(o=this.publisher)==null||o.on("audioPublishStateChanged",(p,u,g)=>{var m;this.emit("audioPublishStateChanged",p,u,g,(m=this.channel)!=null?m:"")}),(c=this.publisher)==null||c.on("videoPublishStateChanged",(p,u,g)=>{var m;this.emit("videoPublishStateChanged",p,u,g,(m=this.channel)!=null?m:"")}),(h=this.publisher)==null||h.on("dualStreamPublishStateChanged",(p,u,g)=>{var m;this.emit("dualStreamPublishStateChanged",p,u,g,(m=this.channel)!=null?m:"")}),(f=this.publisher)==null||f.on("screenPublishStateChanged",(p,u,g)=>{var m;this.emit("screenSharePublishStateChanged",p,u,g,(m=this.channel)!=null?m:"")})}addUserManagerListeners(){this.userManager.rtsManager.on("disconnected",()=>v(this,null,function*(){E.event("[UserManager] RTS Disconnected"),(yield it.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,i,s)=>{const a=this.remoteUsers.find(n=>n.streamUrl===e);a&&this.emit("mediaExtensionMsgReceived",a.userId,s,i)}),this.userManager.on(we.Remote,(e,i)=>{E.event("[UserManager] RemoteUser Device Status Change",e,i)}),this.userManager.on("remoteTrackAvailableChange",(e,i,s)=>{this.emit("remoteTrackAvailableNotify",e,i,s)}),this.userManager.on("audioSubscribeStateChanged",(e,i,s,a,n)=>{this.emit("audioSubscribeStateChanged",e,i,s,a,n)}),this.userManager.on("videoSubscribeStateChanged",(e,i,s,a,n)=>{this.emit("videoSubscribeStateChanged",e,i,s,a,n)}),this.userManager.on("screenSubscribeStateChanged",(e,i,s,a,n)=>{this.emit("screenShareSubscribeStateChanged",e,i,s,a,n)}),this.userManager.on("userAudioMuted",(e,i)=>{this.emit("userAudioMuted",e,i)}),this.userManager.on("userVideoMuted",(e,i)=>{this.emit("userVideoMuted",e,i)}),this.userManager.on("userScreenMuted",(e,i)=>{this.emit("userScreenMuted",e,i)}),this.userManager.on("audioVolume",e=>{this.emit("audioVolume",e)}),this.userManager.on("remoteAudioAutoPlayFail",e=>{this.emit("remoteAudioAutoPlayFail",e)}),this.userManager.on("remoteVideoAutoPlayFail",(e,i)=>{this.emit("remoteVideoAutoPlayFail",e,i)}),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&&(E.event("[Signaling] Receive KeepAlive Response",`networkError: ${this.networkError}`),this.onNetworkRecovery())}),this.signalingManager.on("onNotifyJoin",e=>{E.event("[Signaling] Notify Join ",e),this.handleUsersJoin(e),e.forEach(i=>{this.emit("remoteUserOnLineNotify",i.userid,0)})}),this.signalingManager.on("onNotifyStatus",e=>{E.event("[Signaling] Notify Status ",e),e.forEach(i=>{this.userManager.updateRemoteUserDeviceStatus(i)})}),this.signalingManager.on("onNotifyLeave",e=>{E.event("[Signaling] Notify Leave ",e),e.forEach(i=>{this.emit("remoteUserOffLineNotify",i.userid,i.leavecode),this.userManager.removeLeftUser(i)})}),this.signalingManager.on("onBye",(e,i)=>{E.event("[Signaling] Bye ",e,i),this.reporter.reportError({message:`reason: ${e}, description: ${i}`}),this.emit("bye",e),this.leaveChannel(!0)}),this.signalingManager.on("onConnectFail",e=>{E.event("[Signaling] Connect Failed ",e),this.onError(e),this.backToUnpublishStatus(),this.connectState=G.AliRtcConnectionStatusFailed,this.emit("connectionStatusChange",G.AliRtcConnectionStatusFailed,mt.AliRtcConnectionChangedNetworkInterrupted)}),this.signalingManager.on("onNetworkError",e=>{E.event("[Signaling] Network error ",e),this.onNetworkError()}),this.signalingManager.on("onAuthInvalid",()=>{E.event("[Signaling] Auth Invalid")}),this.signalingManager.on("onReconnectStart",()=>{E.event("[Signaling] Reconnect Start "),this.connectState=G.AliRtcConnectionStatusReconnecting,this.emit("connectionStatusChange",G.AliRtcConnectionStatusReconnecting,mt.AliRtcConnectionSignalingConnecting)}),this.signalingManager.on("onReconnectSuccess",e=>{E.event("[Signaling] Reconnect Success ",e),this.onNetworkRecovery(e)}),this.signalingManager.on("onReconnectFail",e=>{E.event("[Signaling] Reconnect Failed ",e),e.code===403&&this.emit("authInfoExpired")}),this.signalingManager.on("onError",e=>{E.event("[Signaling] Error ",e),this.onError(e)})}backToUnpublishStatus(){var e,i;this.connectState=G.AliRtcConnectionStatusDisconnected,(e=this.publisher)!=null&&e.isPublishing&&((i=this.publisher)==null||i.clearPublishState()),this.networkError=!1}handleUsersJoin(e){e.forEach(i=>{const s=i.userid;if(s){const a=this.userManager.addUser(s,i.displayname);E.event(`[${L.logName}]`,J.UserJoined,a)}})}onLocalDeviceStatusChange(e){E.event(`[${L.logName}]`,we.Local,e),this.signalingManager.reportStatus(e).then(()=>{E.debug("[signaling] reportStatus suc")}).catch(i=>{E.error("[signaling] reportStatus failed",i)})}resumePublishForNetworkRecovery(){return v(this,null,function*(){var e;try{yield(e=this.publisher)==null?void 0:e.resumePublish()}catch(i){const{code:s}=i;if(s===10205){let n=1;try{yield new Promise((o,c)=>{const h=setInterval(()=>v(this,null,function*(){var f;n>1&&(clearInterval(h),c()),n+=1;try{yield(f=this.publisher)==null?void 0:f.resumePublish(),clearInterval(h),o()}catch(p){const{code:u}=p;u!==10205&&(clearInterval(h),c())}}),1e3)})}catch(o){}}}})}onNetworkRecovery(e){return v(this,null,function*(){var i;E.event(L.logName,"onNetworkRecovery",{users:e}),this.networkError&&(this.networkError=!1,(i=this.publisher)==null||i.reportSelfDeviceStatus(),!this.userManager.rtsManager.isConnected&&this.userManager.rtsManager.isConnecting&&(yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList(e)),this.connectState=G.AliRtcConnectionStatusConnected,this.emit("connectionStatusChange",G.AliRtcConnectionStatusConnected,mt.AliRtcConnectionSignalingHeartbeatAlive))})}resumeSubList(e){return v(this,null,function*(){if(e!=null&&e.length){const{joinList:i,leaveList:s,presentList:a}=this.userManager.updateUsers(e);E.info(`[${L.logName}]`,"resumeSubList",{joinList:i,leaveList:s,presentList:a}),this.handleUsersJoin(i),s.forEach(n=>{E.event(L.logName,J.UserLeft,n.userid,n.reason),this.emit("remoteUserOffLineNotify",n.userid,Zi.AliRtcUserOfflineQuit)});for(let n=0;n<a.length;n++){const o=a[n],c=o.userid,h=this.userManager.getRemoteUser(c);this.userManager.onRemotePublishStateChange(o),h==null||h.restore(),h==null||h.updateSubscribe()}}else for(let i=0;i<this.remoteUsers.length;i++){const s=this.remoteUsers[i];try{s.restore(),s.updateSubscribe()}catch(a){}}})}onNetworkError(){this.connectState===G.AliRtcConnectionStatusConnected&&(this.networkError||(this.connectState=G.AliRtcConnectionStatusDisconnected,this.emit("connectionStatusChange",G.AliRtcConnectionStatusDisconnected,mt.AliRtcConnectionChangedNetworkInterrupted)),this.networkError=!0)}onError(e){this.reporter.reportError(e),E.event(L.logName,J.Error,e)}setEnableDualVideoStream(e,i){i&&this.dualVideoPlugin.setOptions(i);const s=this.userManager.pluginManager.has(this.dualVideoPlugin.name);e?!s&&this.enablePlugin(this.dualVideoPlugin):s&&this.removePlugin(this.dualVideoPlugin.name)}hadPushStream(e){if(!(this.publisher&&e))throw new C(N.ERR_INNER,"stream is not publishing")}getCurrentMicDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentMicDeviceId()}setChannelProfile(e){if(![G.AliRtcConnectionStatusInit,G.AliRtcConnectionStatusDisconnected,G.AliRtcConnectionStatusFailed].includes(this.connectState))throw new C(N.ERR_INNER,"cannot set channel profile in call");this.channelProfile=e,this.channelProfile===Qe.AliRtcSdkCommunication&&(this.clientRole=st.AliRtcSdkLive),this.signalingManager.setChannelProfile(e)}setClientRole(e){return v(this,null,function*(){var i,s,a,n,o;try{if(this.channelProfile===Qe.AliRtcSdkCommunication)return;if(!Object.values(st).includes(e))throw new C(N.ERR_INVALID_ARGUMENTS,`set client role error, role value(${e}) is invalid`);if(this.clientRole===e)return;this.isInCall()?this.clientRole===st.AliRtcSdkInteractive?(this.userManager.isSubscribing?(yield this.stopPublish(),yield(i=this.publisher)==null?void 0:i.clearStream()):yield(s=this.publisher)==null?void 0:s.unPublish(),yield this.signalingManager.setClientRole(e)):(yield this.signalingManager.setClientRole(e),yield this.startDefaultDevicesCapture(),(a=this.publisher)!=null&&a.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 C(N.ERR_INNER,"cannot not change audioOnly mode in call");this._audioOnlyMode=e}setAudioRedEnabled(e){if(this.isInCall())throw new C(N.ERR_INNER,"cannot not change audioRedEnabled in call");this.userManager.setAudioRedEnabled(e)}setCheckAuthInfoTimer(e,i){const s=(e-i)*1e3;this._authInfoExpiredTimer=window.setTimeout(()=>{this.emit("authInfoExpired")},s),this._authInfoWillExpireTimer=window.setTimeout(()=>{this.emit("authInfoWillExpire")},s-3e4),this._serverCheckAuthInfoTimestamp=i,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 s,a;let e=[],i;try{this._audioOnlyMode||(e=yield L.getCameraList(),e.length||console.warn("No media neither devices can be captured")),i=yield L.getMicrophoneList(),i.length||console.warn("No media neither devices can be captured");const{hasCamera:n,hasMicrophone:o,hasScreenShare:c,audioCaptureDisabled:h,publishLocalAudioStreamEnabled:f,publishLocalVideoStreamEnabled:p}=(s=this.publisher)!=null?s:{};if(n||o||c)return;!n&&p&&!this._audioOnlyMode&&e.length&&!((a=this.publisher)!=null&&a.cameraCaptureDisabled)&&(yield this.enableLocalVideo(!0)),!o&&f&&!h&&i.length&&(yield this.startAudioCapture())}catch(n){throw n}})}joinChannel(e,i){return v(this,null,function*(){var n,o,c,h,f,p;let s=new Date().getTime(),a=_r.checkAuthInfo(e);if(this.webTrackingClient.updateAuthInfo(e),this.webTrackingClient.reportJoinChannel(e),G.AliRtcConnectionStatusInit===this.connectState||G.AliRtcConnectionStatusDisconnected===this.connectState||G.AliRtcConnectionStatusFailed===this.connectState){if(this.connectState=G.AliRtcConnectionStatusConnecting,a)throw this.connectState=G.AliRtcConnectionStatusFailed,this.webTrackingClient.reportJoinChannelRes(a.code,a.message,0),this.reporter.reportJoin(0,a.code,a.message),a;e.callid=it.createCallid(),this.reporter.start(e);try{const u=yield this.signalingManager.join(e,i,this.maxSignalingConnectRetryCount);this.connectState=G.AliRtcConnectionStatusConnected,(n=this.publisher)==null||n.reportSelfDeviceStatus();let g=new Date().getTime()-s;this.webTrackingClient.reportJoinChannelRes(0,"",g),this.reporter.reportJoin(g,0,u.tid),this.userManager.init(e,u),this.setCheckAuthInfoTimer(e.timestamp,u.timestamp),this.currentRoleCanPublish&&(yield this.startDefaultDevicesCapture(),Object.values((c=(o=this.publisher)==null?void 0:o.publishStreams)!=null?c:{}).some(m=>m)&&(yield(h=this.publisher)==null?void 0:h.startPublish(),yield(f=this.publisher)==null?void 0:f.previewAll())),this.remoteUsers.forEach(m=>{m.updateSubscribe()}),this.liveTranscoding.setAuthInfo(e)}catch(u){let g=new Date().getTime()-s;const m=(p=u.code)!=null?p:-1,d=u.reason||u.message||"";throw this.webTrackingClient.reportJoinChannelRes(m,d,g),this.connectState=G.AliRtcConnectionStatusDisconnected,this.reporter.reportJoin(g,m,""),new C(m,d)}}else{const u=new C(N.ERR_JOIN_ALREADY_JOINED,"already joined");throw this.connectState===G.AliRtcConnectionStatusConnecting&&(u.message="Repeated operation during login"),this.webTrackingClient.reportJoinChannelRes(u.code,u.message,0),this.reporter.reportJoin(0,u.code,""),u}})}leaveChannel(e=!1){return v(this,null,function*(){var s;this.reporter.reportLeaveInvoked(),this.webTrackingClient.reportLeaveChannel();let i=new Date().getTime();if(G.AliRtcConnectionStatusConnected===this.connectState)try{let a;e||(a=yield this.signalingManager.leave()),this.clearCheckAuthInfoTimer(),yield this.resetState(),this.reporter.reportLeave(new Date().getTime()-i,0,(s=a==null?void 0:a.tid)!=null?s:""),E.setFlushMode(!0);return}catch(a){throw this.reporter.reportLeave(new Date().getTime()-i,a.code,a.reason),a}else{yield this.resetState(),this.reporter.reportLeave(0,0,""),E.setFlushMode(!0);return}})}isInCall(){return this.connectState===G.AliRtcConnectionStatusConnected}refreshAuthInfo(e){return v(this,null,function*(){const{userId:i,nonce:s,timestamp:a,token:n,role:o}=e,c={userId:i,nonce:s,timestamp:a,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(h){throw h}})}isAudioOnly(){return this._audioOnlyMode}publishLocalAudioStream(e){return v(this,null,function*(){var i,s,a;(i=this.publisher)==null||i.setPublishLocalAudioStreamEnabled(e),this.connectState===G.AliRtcConnectionStatusConnected&&(e?(s=this.publisher)!=null&&s.hasMicrophone?yield(a=this.publisher)==null?void 0:a.publishUpdate():yield this.startAudioCapture():yield this.stopPublish({audio:!0}))})}isLocalAudioStreamPublished(){var e,i;return(i=(e=this.publisher)==null?void 0:e.publishLocalAudioStreamEnabled)!=null?i:!0}setDefaultSubscribeAllRemoteAudioStreams(e){this.userManager.setAutoSubAudio(e)}subscribeAllRemoteAudioStreams(e){this.userManager.setWantSubAudio(e)}subscribeRemoteAudioStream(e,i){if(i&&!this.userManager.isWantSubAudio)throw new C(N.ERR_INVALID_ARGUMENTS,"subscribeAllRemoteAudioStreams(true) must be called first");this.userManager.updateAudioWant(e,i)}resumeRemoteAudioStream(e){const i=this.userManager.getRemoteUser(e);i&&i.resumeAudio()}publishLocalVideoStream(e){return v(this,null,function*(){var i,s,a;(i=this.publisher)==null||i.setPublishLocalVideoStreamEnabled(e),this.connectState===G.AliRtcConnectionStatusConnected&&(e?(s=this.publisher)!=null&&s.hasCamera?yield(a=this.publisher)==null?void 0:a.publishUpdate():yield this.enableLocalVideo():yield this.stopPublish({video:!0}))})}isLocalVideoStreamPublished(){var e,i;return(i=(e=this.publisher)==null?void 0:e.publishLocalVideoStreamEnabled)!=null?i:!0}setRemoteDefaultVideoStreamType(e){[he.AliRtcVideoStreamTypeHigh,he.AliRtcVideoStreamTypeLow].includes(e)&&this.userManager.setRemoteDefaultVideoStreamType(e)}setRemoteUserVideoStreamType(e,i){[he.AliRtcVideoStreamTypeHigh,he.AliRtcVideoStreamTypeLow].includes(i)&&this.userManager.setRemoteUserVideoStreamType(e,i)}setDefaultSubscribeAllRemoteVideoStreams(e){this.userManager.setAutoSubVideo(e),this.userManager.setAutoSubScreen(e)}subscribeAllRemoteVideoStreams(e){this.userManager.setWantSubVideo(e),this.userManager.setWantSubScreen(e)}subscribeRemoteMediaStream(e,i,s,a){const n=this.userManager.getRemoteUser(e);if(!n)throw new C(N.ERR_INNER,`no remote user(${e}) founded`);s&&(i===W.AliRtcVideoTrackScreen||i===W.AliRtcVideoTrackBoth)?n.setWantSubScreen(!0):n.setWantSubScreen(!1),s&&(i===W.AliRtcVideoTrackCamera||i===W.AliRtcVideoTrackBoth)?n.setWantSubVideo(!0):n.setWantSubVideo(!1),n.setWantSubAudio(a),n.updateSubscribe()}resumeRemoteMediaStream(e,i){const s=this.userManager.getRemoteUser(e);s&&s.resumeVideo(i)}getOnlineRemoteUsers(){return this.userManager.remoteUsers.map(e=>e.userId)}getUserInfo(e){var i;return(i=this.userManager.getRemoteUser(e))==null?void 0:i.remoteUserInfo}isUserOnline(e){return!!this.userManager.remoteUsers.find(i=>i.userId===e)}startScreenShare(e){return v(this,null,function*(){var o;const i={video:!1,audio:!1},{audio:s=!1,videoTrack:a,audioTrack:n}=e||{};if(a||n){i.screen=!0;const c=new MediaStream;a&&c.addTrack(a),n&&c.addTrack(n),i.mediaStream=c}else i.screen=s?{audio:!0}:!0;yield(o=this.publisher)==null?void 0:o.createLocalStream(i)})}stopScreenShare(){return v(this,null,function*(){var e;(e=this.publisher)==null||e.stopLocalStream({screen:!0})})}setScreenShareConfiguration(e){return v(this,null,function*(){var a;const{frameRate:i=$t.frameRate,bitrate:s=$t.maxBitrate}=e;yield(a=this.publisher)==null?void 0:a.setScreenProfile(ns,{width:$t.width,height:$t.height,frameRate:i,maxBitrate:s})})}setScreenShareContentHint(e){return v(this,null,function*(){var i;e&&((i=this.publisher)==null||i.setScreenContentHint(e))})}publishLocalScreenShareStream(e,i){return v(this,null,function*(){var s,a,n;(s=this.publisher)==null||s.setPublishLocalScreenStreamEnabled(e),this.connectState===G.AliRtcConnectionStatusConnected&&(e?(a=this.publisher)!=null&&a.hasScreenShare?yield(n=this.publisher)==null?void 0:n.publishUpdate():yield this.startScreenShare(i):yield this.stopPublish({screen:!0}))})}isScreenSharePublished(){var e,i;return(i=(e=this.publisher)==null?void 0:e.publishLocalScreenStreamEnabled)!=null?i:!0}setAudioShareVolume(e){if(typeof e!="number")throw new C(N.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 i;this.isPublishing&&this.onLocalDeviceStatusChange(e?J.MuteAudio:J.UnmuteAudio),(i=this.publisher)==null||i.muteLocalMic(e)}muteRemoteAudioPlaying(e,i=!1){const s=this.userManager.getRemoteUser(e);if(!s)throw new C(N.ERR_INNER,`no remote user(${e}) founded`);s.setAudioMuted(i)}muteAllRemoteAudioPlaying(e=!1){this.userManager.setAudioMuted(e)}startAudioCapture(e){return v(this,null,function*(){var s;const i={audio:e||!0};yield(s=this.publisher)==null?void 0:s.createLocalStream(i)})}stopAudioCapture(){var e;(e=this.publisher)==null||e.stopAudioCapture()}switchMicrophone(e,i){return v(this,null,function*(){var s,a,n,o;if(yield(s=this.publisher)==null?void 0:s.setMicrophoneDeviceId(e),!((a=this.publisher)!=null&&a.audioCaptureDisabled)){if(i){yield(n=this.publisher)==null?void 0:n.createLocalStream({audio:!0,mediaStream:new MediaStream([i])});return}yield(o=this.publisher)==null?void 0:o.createLocalStream({audio:{deviceId:e}})}})}setRecordingVolume(e){if(typeof e!="number")throw new C(N.ERR_INVALID_ARGUMENTS,"volume must be a number");this.audioMixerPlugin.setOptions({audio:Math.max(0,Math.min(e,400))/100})}setAudioProfile(e){return v(this,null,function*(){var i;yield(i=this.publisher)==null?void 0:i.setAudioProfile(e)})}getAudioTrack(e){return v(this,null,function*(){var s;if(!e)return(s=this.publisher)==null?void 0:s.audioTrack;const i=this.userManager.getRemoteUser(e);return i==null?void 0:i.getAudioTrack})}setLocalViewConfig(e,i){return v(this,null,function*(){var s,a,n;if(this._audioOnlyMode)throw new C(N.ERR_INNER,"Cannot set local view in audio only mode");(s=this.userManager)==null||s.setLocalViewConfig(e,i),i===W.AliRtcVideoTrackCamera&&((a=this.publisher)!=null&&a.hasCamera)?yield this.startPreview():i===W.AliRtcVideoTrackScreen&&((n=this.publisher)!=null&&n.hasScreenShare)&&(yield this.startPreviewScreen())})}setCameraCapturerConfiguration(e){return v(this,null,function*(){var h,f,p;const{width:i=jt.width,height:s=jt.height,frameRate:a=jt.frameRate,bitrate:n=jt.maxBitrate,cameraDirection:o,deviceId:c}=e;yield(h=this.publisher)==null?void 0:h.setVideoProfile(as,{width:i,height:s,frameRate:a,maxBitrate:n}),o!==void 0&&((f=this.publisher)==null||f.setCameraDirection(o)),c&&((p=this.publisher)==null||p.setCameraDeviceId(c))})}setCameraCapturerContentHint(e){return v(this,null,function*(){var i;e&&((i=this.publisher)==null||i.setVideoContentHint(e))})}enableLocalVideo(e=!0){return v(this,null,function*(){var i,s,a,n,o,c,h,f,p,u,g;if(this._audioOnlyMode)throw new C(N.ERR_INNER,"Cannot enable local video in audio only mode");if(e){(s=(i=this.publisher)==null?void 0:i.publishStreams)!=null&&s.video&&((o=(n=(a=this.publisher)==null?void 0:a.publishStreams)==null?void 0:n.video)==null||o.disableVideo(),(p=(f=(h=(c=this.publisher)==null?void 0:c.publishStreams)==null?void 0:h.video)==null?void 0:f.videoTrack)==null||p.stop());const m={video:!0};yield(u=this.publisher)==null?void 0:u.startCameraCapture(m)}else yield(g=this.publisher)==null?void 0:g.stopCameraCapture()})}muteLocalCamera(e){return v(this,null,function*(){var i;this.isPublishing&&this.onLocalDeviceStatusChange(e?J.MuteVideo:J.UnmuteVideo),(i=this.publisher)==null||i.muteLocalCamera(e)})}muteLocalScreen(e){return v(this,null,function*(){var i;this.isPublishing&&this.onLocalDeviceStatusChange(e?J.MuteScreen:J.UnmuteScreen),(i=this.publisher)==null||i.muteLocalScreen(e)})}setRemoteViewConfig(e,i,s){this.userManager.setRemoteViewConfig(i,e,s)}isCameraOn(){var e,i;return(i=(e=this.publisher)==null?void 0:e.hasCamera)!=null?i:!1}switchCamera(e,i){return v(this,null,function*(){var a,n,o,c,h,f,p,u,g,m,d,S;if(this._audioOnlyMode)throw new C(N.ERR_INNER,"Cannot switch camera in audio only mode");const s={};if(e?s.deviceId=e:s.cameraDirection=((a=this.publisher)==null?void 0:a.cameraDirection)==="environment"?Ft.CAMERA_FRONT:Ft.CAMERA_REAR,yield this.setCameraCapturerConfiguration(s),!((n=this.publisher)!=null&&n.cameraCaptureDisabled)){(c=(o=this.publisher)==null?void 0:o.publishStreams)!=null&&c.video&&((p=(f=(h=this.publisher)==null?void 0:h.publishStreams)==null?void 0:f.video)==null||p.disableVideo(),(d=(m=(g=(u=this.publisher)==null?void 0:u.publishStreams)==null?void 0:g.video)==null?void 0:m.videoTrack)==null||d.stop());const b={video:!0};i&&(b.mediaStream=new MediaStream([i])),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,i;if(this._audioOnlyMode)throw new C(N.ERR_INNER,"Cannot start preview camera in audio only mode");(e=this.publisher)!=null&&e.hasCamera||(yield this.enableLocalVideo(!0)),yield(i=this.publisher)==null?void 0:i.previewAll({screen:!1})})}startPreviewScreen(e){return v(this,null,function*(){var i,s;if(this._audioOnlyMode)throw new C(N.ERR_INNER,"Cannot start preview screen share in audio only mode");(i=this.publisher)!=null&&i.hasScreenShare||(yield this.startScreenShare(e)),yield(s=this.publisher)==null?void 0:s.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,h;const{userId:i,streamType:s}=e;if(!i)return s===ce.AliRtcSdkStreamTypeCapture?(n=this.publisher)==null?void 0:n.cameraTrack:(o=this.publisher)==null?void 0:o.screenTrack;const a=this.userManager.getRemoteUser(i);return s===ce.AliRtcSdkStreamTypeCapture?(c=a==null?void 0:a.getCameraStream)==null?void 0:c.videoTrack:(h=a==null?void 0:a.getScreenStream)==null?void 0:h.videoTrack})}startPublishLiveStream(e,i){return v(this,null,function*(){return this.liveTranscoding.startPublishLiveStream(e,i)})}updatePublishLiveStream(e,i){return v(this,null,function*(){return this.liveTranscoding.updatePublishLiveStream(e,i)})}updatePublishLiveStreamWithTaskId(e,i){return this.liveTranscoding.updatePublishLiveStreamWithTaskId(e,i)}stopPublishLiveStream(e){return v(this,null,function*(){return this.liveTranscoding.stopPublishLiveStream(e)})}stopPublishLiveStreamWithTaskId(e){return this.liveTranscoding.stopPublishLiveStreamWithTaskId(e)}setEnableMediaExtensionMsg(e){var i;(i=this.userManager)==null||i.setEnableMediaExtensionMsg(!!e)}sendMediaExtensionMsg(e,i){return v(this,null,function*(){return this.sendMediaExtensionMsgEx(e,i,5)})}sendMediaExtensionMsgEx(e,i,s){return v(this,null,function*(){var a;if(!this.publisher||!this.isPublishing)throw new C(N.ERR_INNER,"you should publish first");return(a=this.publisher)==null?void 0:a.sendSEI(e,i,s)})}enablePlugin(e,i){this.userManager.pluginManager.add(e,i)}removePlugin(e){this.userManager.pluginManager.remove(e)}setPluginOption(e,i){const s=this.userManager.pluginManager.get(e);s&&i&&s.setOptions(i)}getPluginOption(e){const i=this.userManager.pluginManager.get(e);return i==null?void 0:i.getOptions()}isBeautyAvailable(){return this.userManager.pluginManager.has("AliRtcBeauty")}isBeautyEnabled(){const e=this.userManager.pluginManager.get("AliRtcBeauty");if(!e)throw new C(ot.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");return!!(e!=null&&e.isEnable)}setBeautyEffect(e,i){const s=this.userManager.pluginManager.get("AliRtcBeauty");if(!s)throw new C(ot.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");e?s.enable():s.disable(),s.setOptions({basicBeauty:{skinBuffing:Math.max(Math.min(1,+i.smoothnessLevel),0),whitening:Math.max(Math.min(1,+i.whiteningLevel),0)}})}enableBackgroundExchange(e,i){const s=this.userManager.pluginManager.get("AliRtcBeauty");if(!s||!s.isEnable)throw new C(ot.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const a={setSegmentBackgroundImage:{backgroundImgUrl:e?i:""}};e&&(a.segmentBackgroundProcess={enable:!1}),s.setOptions(a)}enableBackgroundBlur(e){const i=this.userManager.pluginManager.get("AliRtcBeauty");if(!i||!i.isEnable)throw new C(ot.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const s={segmentBackgroundProcess:{type:0,enable:e}};e&&(s.setSegmentBackgroundImage={type:0,backgroundImgUrl:""}),i.setOptions(s)}},l(L,"logName","AliRtcEngine"),l(L,"isSupported",Ya),l(L,"isDualVideoStreamSupported",wr.isSupport),l(L,"getCameraList",()=>v(L,null,function*(){return(yield V.AliRTS.getCameraList()).filter(i=>i.deviceId)})),l(L,"getMicrophoneList",()=>v(L,null,function*(){return(yield V.AliRTS.getMicList()).filter(i=>i.deviceId)})),l(L,"getSpeakerList",()=>v(L,null,function*(){return(yield V.AliRTS.getSpeakerList()).filter(i=>i.deviceId)})),l(L,"_instance"),l(L,"AliRtcSdkChannelProfile",Qe),l(L,"AliRtcSdkClientRole",st),l(L,"AliRtcVideoStreamType",he),l(L,"AliRtcVideoTrack",W),l(L,"AliRtcAudioTrack",kt),l(L,"AliRtcPublishState",B),l(L,"AliRtcSubscribeState",te),l(L,"AliRtcRawDataStreamType",ce),l(L,"AliRtcLogLevel",Ki),l(L,"AliRtcEngineLocalDeviceType",Ke),l(L,"AliRtcEngineLocalDeviceExceptionType",re),l(L,"AliRtcConnectionStatus",G),l(L,"AliRtcConnectionStatusChangeReason",mt),l(L,"AliRtcPlugin",Tt),l(L,"AliRtcPluginTrackType",ni),l(L,"AliRtcLiveTranscodingParam",ui),l(L,"AliRtcLiveTranscodingEncodeParam",Yi),l(L,"AliRtcLiveTranscodingMixParam",ta),l(L,"AliRtcLiveTranscodingSingleParam",ia),l(L,"AliRtcTranscodingClockWidget",ra),l(L,"AliRtcTranscodingImage",Rr),l(L,"AliRtcTranscodingText",aa),l(L,"AliRtcTranscodingUser",na),l(L,"AliRtcLiveTranscodingMixMode",xt),l(L,"AliRtcLiveTranscodingStreamType",qi),l(L,"AliRtcLiveTranscodingSourceType",Pt),l(L,"AliRtcLiveTranscodingTaskProfile",Ji),l(L,"AliRtcLiveTranscodingAudioSampleRate",oi),l(L,"AliRtcLiveTranscodingSegmentType",Bt),l(L,"AliRtcLiveTranscodingFontType",Ht),l(L,"AliRtcLiveTranscodingCropMode",Gi),l(L,"AliRtcLiveTranscodingMediaProcessMode",ci),l(L,"AliRtcLiveTranscodingState",zi),l(L,"AliRtcLiveTranscodingErrorCode",We),l(L,"AliRtcTrascodingPublishTaskStatus",Xi),l(L,"Plugin",Tt),L);P([y()],T.prototype,"destroy",1),P([y()],T.prototype,"resetState",1),P([y(I)],T.prototype,"stopPublish",1),P([y()],T.prototype,"backToUnpublishStatus",1),P([y()],T.prototype,"resumePublishForNetworkRecovery",1),P([y()],T.prototype,"onNetworkRecovery",1),P([y()],T.prototype,"resumeSubList",1),P([y(I)],T.prototype,"setEnableDualVideoStream",1),P([y(I)],T.prototype,"setChannelProfile",1),P([y(I)],T.prototype,"setClientRole",1),P([y(I)],T.prototype,"setAudioOnlyMode",1),P([y(I)],T.prototype,"joinChannel",1),P([y(I)],T.prototype,"leaveChannel",1),P([y(I)],T.prototype,"refreshAuthInfo",1),P([y(I)],T.prototype,"publishLocalAudioStream",1),P([y(I)],T.prototype,"setDefaultSubscribeAllRemoteAudioStreams",1),P([y(I)],T.prototype,"subscribeAllRemoteAudioStreams",1),P([y(I)],T.prototype,"subscribeRemoteAudioStream",1),P([y(I)],T.prototype,"resumeRemoteAudioStream",1),P([y(I)],T.prototype,"publishLocalVideoStream",1),P([y(I)],T.prototype,"setRemoteDefaultVideoStreamType",1),P([y(I)],T.prototype,"setRemoteUserVideoStreamType",1),P([y(I)],T.prototype,"setDefaultSubscribeAllRemoteVideoStreams",1),P([y(I)],T.prototype,"subscribeAllRemoteVideoStreams",1),P([y(I)],T.prototype,"subscribeRemoteMediaStream",1),P([y(I)],T.prototype,"resumeRemoteMediaStream",1),P([y(([t])=>[`${t==null?void 0:t.audio}`])],T.prototype,"startScreenShare",1),P([y()],T.prototype,"stopScreenShare",1),P([y(I)],T.prototype,"setScreenShareConfiguration",1),P([y(I)],T.prototype,"setScreenShareContentHint",1),P([y()],T.prototype,"publishLocalScreenShareStream",1),P([y(I)],T.prototype,"setAudioShareVolume",1),P([y(I)],T.prototype,"enableAudioVolumeIndication",1),P([y(I)],T.prototype,"muteLocalMic",1),P([y(I)],T.prototype,"muteRemoteAudioPlaying",1),P([y(I)],T.prototype,"muteAllRemoteAudioPlaying",1),P([y(I)],T.prototype,"startAudioCapture",1),P([y()],T.prototype,"stopAudioCapture",1),P([y(I)],T.prototype,"switchMicrophone",1),P([y(I)],T.prototype,"setRecordingVolume",1),P([y(I)],T.prototype,"setAudioProfile",1),P([y(I)],T.prototype,"getAudioTrack",1),P([y(I)],T.prototype,"setLocalViewConfig",1),P([y(I)],T.prototype,"setCameraCapturerConfiguration",1),P([y(I)],T.prototype,"setCameraCapturerContentHint",1),P([y(I)],T.prototype,"enableLocalVideo",1),P([y(I)],T.prototype,"muteLocalCamera",1),P([y(I)],T.prototype,"muteLocalScreen",1),P([y(I)],T.prototype,"setRemoteViewConfig",1),P([y(I)],T.prototype,"switchCamera",1),P([y()],T.prototype,"startPreview",1),P([y()],T.prototype,"startPreviewScreen",1),P([y()],T.prototype,"stopPreview",1),P([y()],T.prototype,"stopPreviewScreen",1),P([y()],T.prototype,"startPublishLiveStream",1),P([y()],T.prototype,"updatePublishLiveStream",1),P([y()],T.prototype,"updatePublishLiveStreamWithTaskId",1),P([y()],T.prototype,"stopPublishLiveStream",1),P([y()],T.prototype,"stopPublishLiveStreamWithTaskId",1),P([y(I)],T.prototype,"setEnableMediaExtensionMsg",1),P([y(([t,r,e])=>[t.length,r,e])],T.prototype,"sendMediaExtensionMsgEx",1),P([y(([t,r])=>[t.name||"",r])],T.prototype,"enablePlugin",1),P([y(I)],T.prototype,"removePlugin",1),P([y(I)],T.prototype,"setPluginOption",1),P([y(I)],T.prototype,"getPluginOption",1),P([y(I)],T.prototype,"setBeautyEffect",1),P([y(I)],T.prototype,"enableBackgroundExchange",1),P([y(I)],T.prototype,"enableBackgroundBlur",1),P([y(I)],T,"setLogLevel",1);let oa=T;const ca=new $i({businessName:"imp-web-rtc",version:(ua=oa.getSdkVersion())!=null?ua:"unknown",env:"prod"});ca.setReady();const qc=ca.wrap(oa);A.AliRtcConnectionStatus=G,A.AliRtcConnectionStatusChangeReason=mt,A.AliRtcEngineLocalDeviceExceptionType=re,A.AliRtcEngineLocalDeviceType=Ke,A.AliRtcErrorCode=N,A.AliRtcLiveTranscodingAudioSampleRate=oi,A.AliRtcLiveTranscodingCropMode=Gi,A.AliRtcLiveTranscodingEncodeParam=Yi,A.AliRtcLiveTranscodingErrorCode=We,A.AliRtcLiveTranscodingFontType=Ht,A.AliRtcLiveTranscodingMediaProcessMode=ci,A.AliRtcLiveTranscodingMixMode=xt,A.AliRtcLiveTranscodingMixParam=ta,A.AliRtcLiveTranscodingParam=ui,A.AliRtcLiveTranscodingSegmentType=Bt,A.AliRtcLiveTranscodingSingleParam=ia,A.AliRtcLiveTranscodingSourceType=Pt,A.AliRtcLiveTranscodingState=zi,A.AliRtcLiveTranscodingStreamType=qi,A.AliRtcLiveTranscodingTaskProfile=Ji,A.AliRtcLocalStreamInfo=ar,A.AliRtcLogLevel=Ki,A.AliRtcPlugin=Tt,A.AliRtcPluginTrackType=ni,A.AliRtcPluginType=es,A.AliRtcPublishState=B,A.AliRtcRawDataStreamType=ce,A.AliRtcRemoteUserInfo=ls,A.AliRtcSdkChannelProfile=Qe,A.AliRtcSdkClientRole=st,A.AliRtcSubscribeState=te,A.AliRtcTranscodingClockWidget=ra,A.AliRtcTranscodingImage=Rr,A.AliRtcTranscodingText=aa,A.AliRtcTranscodingUser=na,A.AliRtcTrascodingPublishTaskStatus=Xi,A.AliRtcVideoStreamType=he,A.AliRtcVideoTrack=W,A.default=qc,Object.defineProperties(A,{__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"}})});