aliyun-rtc-sdk 6.13.2-beta.0 → 6.13.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- var vu=Object.defineProperty,xu=Object.defineProperties;var Su=Object.getOwnPropertyDescriptors;var er=Object.getOwnPropertySymbols,_u=Object.getPrototypeOf,so=Object.prototype.hasOwnProperty,no=Object.prototype.propertyIsEnumerable,yu=Reflect.get;var Ns=(ue,pe,xe)=>pe in ue?vu(ue,pe,{enumerable:!0,configurable:!0,writable:!0,value:xe}):ue[pe]=xe,ve=(ue,pe)=>{for(var xe in pe||(pe={}))so.call(pe,xe)&&Ns(ue,xe,pe[xe]);if(er)for(var xe of er(pe))no.call(pe,xe)&&Ns(ue,xe,pe[xe]);return ue},Rt=(ue,pe)=>xu(ue,Su(pe));var pi=(ue,pe)=>{var xe={};for(var Je in ue)so.call(ue,Je)&&pe.indexOf(Je)<0&&(xe[Je]=ue[Je]);if(ue!=null&&er)for(var Je of er(ue))pe.indexOf(Je)<0&&no.call(ue,Je)&&(xe[Je]=ue[Je]);return xe};var _=(ue,pe,xe)=>(Ns(ue,typeof pe!="symbol"?pe+"":pe,xe),xe);var Fs=(ue,pe,xe)=>yu(_u(ue),xe,pe);var O=(ue,pe,xe)=>new Promise((Je,Pt)=>{var ht=Xe=>{try{it(xe.next(Xe))}catch(mt){Pt(mt)}},pt=Xe=>{try{it(xe.throw(Xe))}catch(mt){Pt(mt)}},it=Xe=>Xe.done?Je(Xe.value):Promise.resolve(Xe.value).then(ht,pt);it((xe=xe.apply(ue,pe)).next())}),tr=function(ue,pe){this[0]=ue,this[1]=pe},ao=(ue,pe,xe)=>{var Je=(pt,it,Xe,mt)=>{try{var $e=xe[pt](it),si=(it=$e.value)instanceof tr,mi=$e.done;Promise.resolve(si?it[0]:it).then(gt=>si?Je(pt==="return"?pt:"next",it[1]?{done:gt.done,value:gt.value}:gt,Xe,mt):Xe({value:gt,done:mi})).catch(gt=>Je("throw",gt,Xe,mt))}catch(gt){mt(gt)}},Pt=pt=>ht[pt]=it=>new Promise((Xe,mt)=>Je(pt,it,Xe,mt)),ht={};return xe=xe.apply(ue,pe),ht[Symbol.asyncIterator]=()=>ht,Pt("next"),Pt("throw"),Pt("return"),ht};(function(ue,pe){typeof exports=="object"&&typeof module!="undefined"?pe(exports,require("aliyun-rts-sdk"),require("eventemitter3")):typeof define=="function"&&define.amd?define(["exports","aliyun-rts-sdk","eventemitter3"],pe):(ue=typeof globalThis!="undefined"?globalThis:ue||self,pe(ue.AliRtcEngine={},ue.AliyunRts,ue.EventEmitter))})(this,function(ue,pe,xe){var st,Ut,kt,nt,ri,fe,Qa;"use strict";var Je=Object.defineProperty,Pt=(s,c,e)=>c in s?Je(s,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[c]=e,ht=(s,c,e)=>(Pt(s,typeof c!="symbol"?c+"":c,e),e),pt={exports:{}},it={exports:{}},Xe,mt;function $e(){if(mt)return Xe;mt=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,a=i.length;if(this.T(i,"Array"))for(;n<a&&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(a){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],a=i[0];if(!a)return"";if(!n)return a;var o=this,u=o.T(n),h=i.slice(0,r-1);return u==="Function"?o.safetyCall(n,h,a):u==="Array"?(this.each(n,function(g){h[0]=a=o.filterByRule.apply(o,[].concat(h,g))}),a):u==="Object"?a.replace(n.rule,n.target||""):a.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,a=[],o=0,u=r.length;o<u;o++)if(n=r[o],this.isString(n))a.push(n.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"));else if(n&&n.source)a.push(n.source);else if(n&&this.T(n)==="Function"&&this.safetyCall(n,[i],!1)===!0)return!0;var h=new RegExp(a.join("|"),"i");return!!(a.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,a,o){return i.addEventListener?(o=o||!1,i.addEventListener(r,function u(h){a&&i.removeEventListener(r,u,o),n.call(this,h)},o)):i.attachEvent&&i.attachEvent("on"+r,function u(h){a&&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 a=arguments[r];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])}return i},sub:function(i,r){var n={};return this.each(i,function(a,o){r.indexOf(o)!==-1&&(n[o]=a)}),n},uu:function(){for(var i,r,n=20,a=new Array(n),o=Date.now().toString(36).split("");n-- >0;)r=(i=36*Math.random()|0).toString(36),a[n]=i%3?r:r.toUpperCase();for(var u=0;u<8;u++)a.splice(3*u+2,0,o[u]);return a.join("")},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(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 a=Math.floor(16*Math.random());r[n]=a.toString(16)}return r.join("")},getCurDomain:function(){return location&&location.hostname||""},getSrcType:function(i,r){var n=location&&location.host||"";if(!n)return"";var a=new URL(i).host;if(a===n)return"self";for(var o=0;o<r.length;o+=1)if(a.includes(r[o]))return"cdn";return"others"},parseFetchHeaders:function(i){if(!i)return{};var r={};try{if(typeof i.keys=="function")for(var n=i.keys(),a=n.next();!a.done;){var o=a.value;r[o]=i.get(o),a=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(a,o){var u=o.split(": ");return a[u[0]]=u[1],a},{})}catch(a){r={}}return r},getQuerys:function(i){if(!i)return"";var r={},n=[],a="",o="";try{var u=[];if(i.indexOf("?")>=0&&(u=i.substring(i.indexOf("?")+1,i.length).split("&")),u.length>0)for(var h in u)a=(n=u[h].split("="))[0],o=n[1],r[a]=o}catch(g){r={}}return r},getURL:function(i){if(!i)return null;var r={},n=i.length,a=i.indexOf("://");if(a<0)return null;r.protocol=i.substring(0,a+1);var o=i.indexOf("#"),u=i.indexOf("?");o<0&&(o=n),u<0&&(u=o),r.search=i.substring(u,o).substring(0,1e3);var h=i.substring(a+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,a=n&&n.path?n.path.lastIndexOf("."):-1,o=(a>0?n.path.substr(a+1):"").toLowerCase();if(o){if(["eot","woff","woff2","ttf"].indexOf(o)>-1)return"font";if(o==="css")return"css";if(o==="js")return"script"}return["fetch","xmlhttprequest","beacon"].indexOf(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 a,o;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);a={originApi:u,method:h.method||"unknown",params:g,response:r||"",reqHeaders:this.parseFetchHeaders(h.headers||null),resHeaders:this.parseFetchHeaders(n)},o=JSON&&JSON.stringify(a)||"{}"}catch(f){o="{}"}return o},getXhrSnapshot:function(i,r,n){if(!i||!r||!n)return{};var a,o;try{var u="";n.responseType===""||n.responseType==="text"?u=n.responseText:n.responseType==="document"&&(u=n.responseXML),a={originApi:i,method:r,params:this.getQuerys(i),response:u,reqHeaders:{},resHeaders:this.parseXhrHeaders(typeof n.getAllResponseHeaders=="function"&&n.getAllResponseHeaders()||"")},o=JSON&&JSON.stringify(a)||"{}"}catch(h){o="{}"}return o},isRobot:function(){var 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 a=i[n];if(r.lastIndexOf(a)>=0)return!0}}catch(o){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=[],a=0,o=i.length;a<o;a++)r=i[a],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 a=i[r];i[r]=n(a)}},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 a={};try{a=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(o){this.warn("[retcode] baseLog error: "+o)}return a}};return Xe=t,Xe}var si={exports:{}},mi={exports:{}},gt,Os;function oo(){if(Os)return gt;Os=1;var s=$e();return gt=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")},gt}var Vs;function co(){if(Vs)return mi.exports;Vs=1;var s=$e(),c=oo(),e="aokcdqn3ly@e629dabd48a9933",t=function(r,n){var a;if(n.t==="error"&&(a=r.requestQueue[0])&&a.t==="error"&&n.msg===a.msg)return n.times=a.times+1,void(r.requestQueue[0]=n);if(n.t==="behavior"){var o=r.requestQueue&&r.requestQueue.length;if(o>0&&r.requestQueue[o-1].t==="behavior"){var u=n.behavior||[];r.requestQueue[o-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,a=r.imgUrl;if(n){var o=s.regionMap[n];return r.imgUrl=o||s.defaultImgUrl,r}return a&&(r.imgUrl=a),r},checkImgUrl:function(){return!0},sendRequest:function(){},sendBeacon:function(r,n,a){c(r,n||this.getConfig("imgUrl"),a)},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 a=n();typeof a=="string"&&(a=a.substr(0,40),this.username=a)}catch(o){s.warn("[arms] setUsername fail",o)}return this.username},getTraceId:function(){var r=this.rip,n=Date.now(),a=s.getSortNum(this.record),o=r+n+a+s.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=o,this.record=a,{"EagleEye-TraceID":o}},getUberTraceId:function(r){var n=this.rip,a=Date.now(),o=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+a+o+s.getNum(2)+u,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,a=Date.now(),o=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+a+o+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 a=this._conf&&typeof this._conf.sendRequest=="function";n=this.requestQueue.pop();)if(n.t==="res")this.postData(n,"res");else if(n.t==="error")this.postData(n,"err");else if(n.t==="api")this.postData(n,"apiSnapshot");else if(n.t==="behavior")this.postData(n,"behavior");else if(n.t==="health"&&!a&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function")this.sendBeacon(n);else if(n.t==="resource"&&!a&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function"){var o=JSON.stringify({resource:n.resource});delete n.resource,this.sendBeacon(n,null,o)}else n.t==="resource"?this.postData(n,"resource"):this.sendRequest(n);return 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,a,o){var u=this,h=u._conf,g=u.getPage(),f=h.ignore||{},l=f.ignoreErrors,p=f.ignoreResErrors,d=f.ignoreUrls,m=f.ignoreApis;if(u._isRobot||s.ignoreByRule(g,d)||s.ignoreByRule(s.decode(g),d)||r==="error"&&(s.ignoreByRule(n.msg,l)||s.ignoreByRule(s.decode(n.msg),l))||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||o===0)return u;var v=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:a||1,dl:v,z:s.seq()}),s.T(h.beforeReport)==="Function")try{if(!(n=h.beforeReport(n)))return u}catch(b){return u}return o===1?t(u,n):a&&!u.sampling(a)?u:t(u,n)},_self:function(r,n,a){var o=this,u=o._conf;if(r!=="error"||!o.checkImgUrl(u.imgUrl)||!n||u.disabled||!u.pid||!e||a&&!o.sampling(a))return o;n=s.ext({t:r,times:1,page:s.selfErrPage,tag:u.pid,begin:Date.now()},n,{pid:e,_v:o.ver,sampling:a||1,z:s.seq()});var h=o.selfQueue[0];if(h){h.times++;try{h.err&&n.err&&h.err.msg_raw&&n.err.msg_raw&&h.err.msg_raw.split("&").indexOf(n.err.msg_raw)<0&&h.err.msg_raw.length<1e3&&(h.err.msg_raw+="&"+n.err.msg_raw)}catch(g){}}else o.selfQueue.unshift(n),o.onReady(function(){o.sdkFlag&&(o.sdkFlag=!1,o.Timmer=s.delay(function(){o.clearSelf()},1e4))})},custom:function(r,n){if(!r||typeof r!="object")return this;var a=!1,o={begin:Date.now()};return s.each(r,function(u,h){return!(a=h&&h.length<=20)&&s.warn("[retcode] invalid key: "+h),o["x-"+h]=u,a}),a?this._lg("custom",o,n||1):this}},mi.exports=i,mi.exports}var Us;function uo(){if(Us)return si.exports;Us=1;var s=$e(),c=co(),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(a){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,a){try{var o=s.dealParam(r,n,1);return this._lg("sum",t(o),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},avg:function(r,n,a){try{var o=s.dealParam(r,n,0);return this._lg("avg",t(o),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},percent:function(r,n,a,o){try{return this._lg("percent",t({key:r,subkey:n,val:a||0,begin:Date.now()}),o)}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 a=r.name||"CustomError",o=r.message||"",u=r.stack||"";n=n||{};var h=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"";if(s.checkSDKError(o,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 l={msg:s.selfErrKey,err:{msg_raw:s.encode(r.msg||r.message)}};return this._self("error",l,1)}for(var p={begin:Date.now(),cate:a,msg:o&&o.substring(0,1e3),stack:u&&u.substring(0,1e3),file:s.removeUrlSearch(n.filename||""),line:n.lineno||"",col:n.colno||"",err:{msg_raw:s.encode(o),stack_raw:s.encode(u)},dl:h},d=["tag","c1","c2","c3"],m=0;m<d.length;m++){var v=d[m];n[v]&&(p[v]=n[v])}var b=(this.getConfig("ignore")||{}).ignoreErrors;return s.ignoreByRule(p.msg,b)||s.ignoreByRule(s.decode(p.msg),b)?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,a,o,u,h,g,f,l,p,d,m,v,b,x,y){if(!r)return s.warn("[retcode] api is null"),this;if(r=typeof r=="string"?{api:r,success:n,time:a,code:o,msg:u,begin:h,traceId:g,pv_id:f,apiSnapshot:l,domain:p,flag:m,tag:v,c1:b,c2:x,c3:y}:s.sub(r,e),!s.checkAPI(r.api,!0))return this;r.code=r.code||"";var E=r.msg||"";if(E=typeof E=="string"?E.substring(0,1e3):E,r.msg=E,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))),d&&(r.traceOrigin=d),!r.api||isNaN(r.time))return s.warn("[retcode] invalid time or api"),this;var I=(this.getConfig("ignore")||{}).ignoreApis;return s.ignoreByRule(r.api,I)||s.ignoreByRule(s.decode(r.api),I)?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,a){var o=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,o.speedCache=o.speedCache||{},o.speedCache[r]=n,o.speedCache.begin=u,clearTimeout(o.speedTimmer),o.speedTimmer=setTimeout(function(){a||(o.speedCache.page=o.getPage(!0)),o._lg("speed",o.speedCache),o.speedCache=null},5e3),o):(s.warn("[retcode] invalid point: "+r),o)},performance:function(r){if(r&&typeof r=="object"&&!this.hasSendPerf){var n={},a={},o=this.getConfig("autoSendPerf");if(r.autoSend&&o)return a=s.ext(this.perfData||{},r),this.hasSendPerf=!0,this._lg("perf",a,this.getConfig("sample"));if(r.autoSend&&!o)return delete r.autoSend,this.perfData?(a=s.ext(this.perfData||{},r),this.hasSendPerf=!0,this._lg("perf",a,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||!o&&(o||this.perfData))return r.autoSend!==!0&&o===!1&&this.perfData?(n=s.ext(this.perfData||{},n),this.hasSendPerf=!0,this._lg("perf",n,this.getConfig("sample"))):void 0;this.perfData=s.ext(this.perfData||{},n)}},resource:function(r,n){if(!r||!s.isPlainObject(r))return s.warn("[arms] invalid param data: "+r),this;var a=Object.keys(r),o=["begin","dom","load","res","dl"],u=!1;for(var h in o)if(a.indexOf(o[h])<0){u=!0;break}if(u)return s.warn("[arms] lack param data: "+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 a={},o=["key","success","time","c1","c2","c3"];for(var u in r)o.indexOf(u)>-1&&(a[u]=r[u]);a.success=r.success===!1?0:1,this._lg("event",a,n)}}}),i._super=c,i._root=c,c.Reporter=i,si.exports=i,si.exports}var ir={exports:{}},Hs;function ho(){if(Hs)return ir.exports;Hs=1;var s=$e(),c=typeof window=="object"?window:{},e="catch",t=c.__oFetch_||c.fetch;return t=typeof t=="function"?t:void 0,ir.exports=function(i,r){var n=-1;typeof i=="object"&&(n=i.z,i=s.serialize(i));var a=r+i;if(t)return t(a,{method:"HEAD",mode:"no-cors"})[e](s.noop);if(c.document&&c.document.createElement){var o="__request_hold_"+n,u=c[o]=new Image;u.onload=u.onerror=function(){c[o]=void 0},u.src=a,u=null}},ir.exports}var rr={exports:{}},zs;function lo(){if(zs)return rr.exports;zs=1;var s=$e(),c=typeof window=="object"?window:{},e=c.__oXMLHttpRequest_||c.XMLHttpRequest;return e=typeof e=="function"?e:void 0,rr.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 :
1
+ var vu=Object.defineProperty,xu=Object.defineProperties;var Su=Object.getOwnPropertyDescriptors;var er=Object.getOwnPropertySymbols,_u=Object.getPrototypeOf,so=Object.prototype.hasOwnProperty,no=Object.prototype.propertyIsEnumerable,yu=Reflect.get;var Ns=(ue,pe,xe)=>pe in ue?vu(ue,pe,{enumerable:!0,configurable:!0,writable:!0,value:xe}):ue[pe]=xe,ve=(ue,pe)=>{for(var xe in pe||(pe={}))so.call(pe,xe)&&Ns(ue,xe,pe[xe]);if(er)for(var xe of er(pe))no.call(pe,xe)&&Ns(ue,xe,pe[xe]);return ue},Rt=(ue,pe)=>xu(ue,Su(pe));var pi=(ue,pe)=>{var xe={};for(var Xe in ue)so.call(ue,Xe)&&pe.indexOf(Xe)<0&&(xe[Xe]=ue[Xe]);if(ue!=null&&er)for(var Xe of er(ue))pe.indexOf(Xe)<0&&no.call(ue,Xe)&&(xe[Xe]=ue[Xe]);return xe};var _=(ue,pe,xe)=>(Ns(ue,typeof pe!="symbol"?pe+"":pe,xe),xe);var Fs=(ue,pe,xe)=>yu(_u(ue),xe,pe);var O=(ue,pe,xe)=>new Promise((Xe,Pt)=>{var ht=Ze=>{try{it(xe.next(Ze))}catch(mt){Pt(mt)}},pt=Ze=>{try{it(xe.throw(Ze))}catch(mt){Pt(mt)}},it=Ze=>Ze.done?Xe(Ze.value):Promise.resolve(Ze.value).then(ht,pt);it((xe=xe.apply(ue,pe)).next())}),tr=function(ue,pe){this[0]=ue,this[1]=pe},ao=(ue,pe,xe)=>{var Xe=(pt,it,Ze,mt)=>{try{var $e=xe[pt](it),si=(it=$e.value)instanceof tr,mi=$e.done;Promise.resolve(si?it[0]:it).then(gt=>si?Xe(pt==="return"?pt:"next",it[1]?{done:gt.done,value:gt.value}:gt,Ze,mt):Ze({value:gt,done:mi})).catch(gt=>Xe("throw",gt,Ze,mt))}catch(gt){mt(gt)}},Pt=pt=>ht[pt]=it=>new Promise((Ze,mt)=>Xe(pt,it,Ze,mt)),ht={};return xe=xe.apply(ue,pe),ht[Symbol.asyncIterator]=()=>ht,Pt("next"),Pt("throw"),Pt("return"),ht};(function(ue,pe){typeof exports=="object"&&typeof module!="undefined"?pe(exports,require("aliyun-rts-sdk"),require("eventemitter3")):typeof define=="function"&&define.amd?define(["exports","aliyun-rts-sdk","eventemitter3"],pe):(ue=typeof globalThis!="undefined"?globalThis:ue||self,pe(ue.AliRtcEngine={},ue.AliyunRts,ue.EventEmitter))})(this,function(ue,pe,xe){var st,Ut,kt,nt,ri,fe,Qa;"use strict";var Xe=Object.defineProperty,Pt=(s,c,e)=>c in s?Xe(s,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[c]=e,ht=(s,c,e)=>(Pt(s,typeof c!="symbol"?c+"":c,e),e),pt={exports:{}},it={exports:{}},Ze,mt;function $e(){if(mt)return Ze;mt=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,a=i.length;if(this.T(i,"Array"))for(;n<a&&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(a){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],a=i[0];if(!a)return"";if(!n)return a;var o=this,u=o.T(n),h=i.slice(0,r-1);return u==="Function"?o.safetyCall(n,h,a):u==="Array"?(this.each(n,function(g){h[0]=a=o.filterByRule.apply(o,[].concat(h,g))}),a):u==="Object"?a.replace(n.rule,n.target||""):a.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,a=[],o=0,u=r.length;o<u;o++)if(n=r[o],this.isString(n))a.push(n.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"));else if(n&&n.source)a.push(n.source);else if(n&&this.T(n)==="Function"&&this.safetyCall(n,[i],!1)===!0)return!0;var h=new RegExp(a.join("|"),"i");return!!(a.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,a,o){return i.addEventListener?(o=o||!1,i.addEventListener(r,function u(h){a&&i.removeEventListener(r,u,o),n.call(this,h)},o)):i.attachEvent&&i.attachEvent("on"+r,function u(h){a&&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 a=arguments[r];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])}return i},sub:function(i,r){var n={};return this.each(i,function(a,o){r.indexOf(o)!==-1&&(n[o]=a)}),n},uu:function(){for(var i,r,n=20,a=new Array(n),o=Date.now().toString(36).split("");n-- >0;)r=(i=36*Math.random()|0).toString(36),a[n]=i%3?r:r.toUpperCase();for(var u=0;u<8;u++)a.splice(3*u+2,0,o[u]);return a.join("")},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(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 a=Math.floor(16*Math.random());r[n]=a.toString(16)}return r.join("")},getCurDomain:function(){return location&&location.hostname||""},getSrcType:function(i,r){var n=location&&location.host||"";if(!n)return"";var a=new URL(i).host;if(a===n)return"self";for(var o=0;o<r.length;o+=1)if(a.includes(r[o]))return"cdn";return"others"},parseFetchHeaders:function(i){if(!i)return{};var r={};try{if(typeof i.keys=="function")for(var n=i.keys(),a=n.next();!a.done;){var o=a.value;r[o]=i.get(o),a=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(a,o){var u=o.split(": ");return a[u[0]]=u[1],a},{})}catch(a){r={}}return r},getQuerys:function(i){if(!i)return"";var r={},n=[],a="",o="";try{var u=[];if(i.indexOf("?")>=0&&(u=i.substring(i.indexOf("?")+1,i.length).split("&")),u.length>0)for(var h in u)a=(n=u[h].split("="))[0],o=n[1],r[a]=o}catch(g){r={}}return r},getURL:function(i){if(!i)return null;var r={},n=i.length,a=i.indexOf("://");if(a<0)return null;r.protocol=i.substring(0,a+1);var o=i.indexOf("#"),u=i.indexOf("?");o<0&&(o=n),u<0&&(u=o),r.search=i.substring(u,o).substring(0,1e3);var h=i.substring(a+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,a=n&&n.path?n.path.lastIndexOf("."):-1,o=(a>0?n.path.substr(a+1):"").toLowerCase();if(o){if(["eot","woff","woff2","ttf"].indexOf(o)>-1)return"font";if(o==="css")return"css";if(o==="js")return"script"}return["fetch","xmlhttprequest","beacon"].indexOf(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 a,o;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);a={originApi:u,method:h.method||"unknown",params:g,response:r||"",reqHeaders:this.parseFetchHeaders(h.headers||null),resHeaders:this.parseFetchHeaders(n)},o=JSON&&JSON.stringify(a)||"{}"}catch(f){o="{}"}return o},getXhrSnapshot:function(i,r,n){if(!i||!r||!n)return{};var a,o;try{var u="";n.responseType===""||n.responseType==="text"?u=n.responseText:n.responseType==="document"&&(u=n.responseXML),a={originApi:i,method:r,params:this.getQuerys(i),response:u,reqHeaders:{},resHeaders:this.parseXhrHeaders(typeof n.getAllResponseHeaders=="function"&&n.getAllResponseHeaders()||"")},o=JSON&&JSON.stringify(a)||"{}"}catch(h){o="{}"}return o},isRobot:function(){var 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 a=i[n];if(r.lastIndexOf(a)>=0)return!0}}catch(o){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=[],a=0,o=i.length;a<o;a++)r=i[a],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 a=i[r];i[r]=n(a)}},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 a={};try{a=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(o){this.warn("[retcode] baseLog error: "+o)}return a}};return Ze=t,Ze}var si={exports:{}},mi={exports:{}},gt,Os;function oo(){if(Os)return gt;Os=1;var s=$e();return gt=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")},gt}var Vs;function co(){if(Vs)return mi.exports;Vs=1;var s=$e(),c=oo(),e="aokcdqn3ly@e629dabd48a9933",t=function(r,n){var a;if(n.t==="error"&&(a=r.requestQueue[0])&&a.t==="error"&&n.msg===a.msg)return n.times=a.times+1,void(r.requestQueue[0]=n);if(n.t==="behavior"){var o=r.requestQueue&&r.requestQueue.length;if(o>0&&r.requestQueue[o-1].t==="behavior"){var u=n.behavior||[];r.requestQueue[o-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,a=r.imgUrl;if(n){var o=s.regionMap[n];return r.imgUrl=o||s.defaultImgUrl,r}return a&&(r.imgUrl=a),r},checkImgUrl:function(){return!0},sendRequest:function(){},sendBeacon:function(r,n,a){c(r,n||this.getConfig("imgUrl"),a)},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 a=n();typeof a=="string"&&(a=a.substr(0,40),this.username=a)}catch(o){s.warn("[arms] setUsername fail",o)}return this.username},getTraceId:function(){var r=this.rip,n=Date.now(),a=s.getSortNum(this.record),o=r+n+a+s.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=o,this.record=a,{"EagleEye-TraceID":o}},getUberTraceId:function(r){var n=this.rip,a=Date.now(),o=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+a+o+s.getNum(2)+u,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,a=Date.now(),o=s.getSortNum(this.record),u=s.getRandNum(this._conf.pid),h=n+a+o+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 a=this._conf&&typeof this._conf.sendRequest=="function";n=this.requestQueue.pop();)if(n.t==="res")this.postData(n,"res");else if(n.t==="error")this.postData(n,"err");else if(n.t==="api")this.postData(n,"apiSnapshot");else if(n.t==="behavior")this.postData(n,"behavior");else if(n.t==="health"&&!a&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function")this.sendBeacon(n);else if(n.t==="resource"&&!a&&window&&window.navigator&&typeof window.navigator.sendBeacon=="function"){var o=JSON.stringify({resource:n.resource});delete n.resource,this.sendBeacon(n,null,o)}else n.t==="resource"?this.postData(n,"resource"):this.sendRequest(n);return 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,a,o){var u=this,h=u._conf,g=u.getPage(),f=h.ignore||{},l=f.ignoreErrors,p=f.ignoreResErrors,d=f.ignoreUrls,m=f.ignoreApis;if(u._isRobot||s.ignoreByRule(g,d)||s.ignoreByRule(s.decode(g),d)||r==="error"&&(s.ignoreByRule(n.msg,l)||s.ignoreByRule(s.decode(n.msg),l))||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||o===0)return u;var v=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:a||1,dl:v,z:s.seq()}),s.T(h.beforeReport)==="Function")try{if(!(n=h.beforeReport(n)))return u}catch(b){return u}return o===1?t(u,n):a&&!u.sampling(a)?u:t(u,n)},_self:function(r,n,a){var o=this,u=o._conf;if(r!=="error"||!o.checkImgUrl(u.imgUrl)||!n||u.disabled||!u.pid||!e||a&&!o.sampling(a))return o;n=s.ext({t:r,times:1,page:s.selfErrPage,tag:u.pid,begin:Date.now()},n,{pid:e,_v:o.ver,sampling:a||1,z:s.seq()});var h=o.selfQueue[0];if(h){h.times++;try{h.err&&n.err&&h.err.msg_raw&&n.err.msg_raw&&h.err.msg_raw.split("&").indexOf(n.err.msg_raw)<0&&h.err.msg_raw.length<1e3&&(h.err.msg_raw+="&"+n.err.msg_raw)}catch(g){}}else o.selfQueue.unshift(n),o.onReady(function(){o.sdkFlag&&(o.sdkFlag=!1,o.Timmer=s.delay(function(){o.clearSelf()},1e4))})},custom:function(r,n){if(!r||typeof r!="object")return this;var a=!1,o={begin:Date.now()};return s.each(r,function(u,h){return!(a=h&&h.length<=20)&&s.warn("[retcode] invalid key: "+h),o["x-"+h]=u,a}),a?this._lg("custom",o,n||1):this}},mi.exports=i,mi.exports}var Us;function uo(){if(Us)return si.exports;Us=1;var s=$e(),c=co(),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(a){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,a){try{var o=s.dealParam(r,n,1);return this._lg("sum",t(o),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},avg:function(r,n,a){try{var o=s.dealParam(r,n,0);return this._lg("avg",t(o),a)}catch(u){s.warn("[retcode] can not get parseStatData: "+u)}},percent:function(r,n,a,o){try{return this._lg("percent",t({key:r,subkey:n,val:a||0,begin:Date.now()}),o)}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 a=r.name||"CustomError",o=r.message||"",u=r.stack||"";n=n||{};var h=typeof location=="object"&&typeof location.href=="string"&&location.href.substring(0,500)||"";if(s.checkSDKError(o,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 l={msg:s.selfErrKey,err:{msg_raw:s.encode(r.msg||r.message)}};return this._self("error",l,1)}for(var p={begin:Date.now(),cate:a,msg:o&&o.substring(0,1e3),stack:u&&u.substring(0,1e3),file:s.removeUrlSearch(n.filename||""),line:n.lineno||"",col:n.colno||"",err:{msg_raw:s.encode(o),stack_raw:s.encode(u)},dl:h},d=["tag","c1","c2","c3"],m=0;m<d.length;m++){var v=d[m];n[v]&&(p[v]=n[v])}var b=(this.getConfig("ignore")||{}).ignoreErrors;return s.ignoreByRule(p.msg,b)||s.ignoreByRule(s.decode(p.msg),b)?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,a,o,u,h,g,f,l,p,d,m,v,b,x,y){if(!r)return s.warn("[retcode] api is null"),this;if(r=typeof r=="string"?{api:r,success:n,time:a,code:o,msg:u,begin:h,traceId:g,pv_id:f,apiSnapshot:l,domain:p,flag:m,tag:v,c1:b,c2:x,c3:y}:s.sub(r,e),!s.checkAPI(r.api,!0))return this;r.code=r.code||"";var E=r.msg||"";if(E=typeof E=="string"?E.substring(0,1e3):E,r.msg=E,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))),d&&(r.traceOrigin=d),!r.api||isNaN(r.time))return s.warn("[retcode] invalid time or api"),this;var I=(this.getConfig("ignore")||{}).ignoreApis;return s.ignoreByRule(r.api,I)||s.ignoreByRule(s.decode(r.api),I)?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,a){var o=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,o.speedCache=o.speedCache||{},o.speedCache[r]=n,o.speedCache.begin=u,clearTimeout(o.speedTimmer),o.speedTimmer=setTimeout(function(){a||(o.speedCache.page=o.getPage(!0)),o._lg("speed",o.speedCache),o.speedCache=null},5e3),o):(s.warn("[retcode] invalid point: "+r),o)},performance:function(r){if(r&&typeof r=="object"&&!this.hasSendPerf){var n={},a={},o=this.getConfig("autoSendPerf");if(r.autoSend&&o)return a=s.ext(this.perfData||{},r),this.hasSendPerf=!0,this._lg("perf",a,this.getConfig("sample"));if(r.autoSend&&!o)return delete r.autoSend,this.perfData?(a=s.ext(this.perfData||{},r),this.hasSendPerf=!0,this._lg("perf",a,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||!o&&(o||this.perfData))return r.autoSend!==!0&&o===!1&&this.perfData?(n=s.ext(this.perfData||{},n),this.hasSendPerf=!0,this._lg("perf",n,this.getConfig("sample"))):void 0;this.perfData=s.ext(this.perfData||{},n)}},resource:function(r,n){if(!r||!s.isPlainObject(r))return s.warn("[arms] invalid param data: "+r),this;var a=Object.keys(r),o=["begin","dom","load","res","dl"],u=!1;for(var h in o)if(a.indexOf(o[h])<0){u=!0;break}if(u)return s.warn("[arms] lack param data: "+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 a={},o=["key","success","time","c1","c2","c3"];for(var u in r)o.indexOf(u)>-1&&(a[u]=r[u]);a.success=r.success===!1?0:1,this._lg("event",a,n)}}}),i._super=c,i._root=c,c.Reporter=i,si.exports=i,si.exports}var ir={exports:{}},Hs;function ho(){if(Hs)return ir.exports;Hs=1;var s=$e(),c=typeof window=="object"?window:{},e="catch",t=c.__oFetch_||c.fetch;return t=typeof t=="function"?t:void 0,ir.exports=function(i,r){var n=-1;typeof i=="object"&&(n=i.z,i=s.serialize(i));var a=r+i;if(t)return t(a,{method:"HEAD",mode:"no-cors"})[e](s.noop);if(c.document&&c.document.createElement){var o="__request_hold_"+n,u=c[o]=new Image;u.onload=u.onerror=function(){c[o]=void 0},u.src=a,u=null}},ir.exports}var rr={exports:{}},zs;function lo(){if(zs)return rr.exports;zs=1;var s=$e(),c=typeof window=="object"?window:{},e=c.__oXMLHttpRequest_||c.XMLHttpRequest;return e=typeof e=="function"?e:void 0,rr.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
3
  `+n)}},rr.exports}var sr,js;function fo(){if(js)return sr;js=1;var s=$e();return sr=function(c,e){var t=[],i=null,r=e&&e.location&&e.location.href,n=void 0,a=null,o=function(f,l,p){if(f!==null){var d=f[l];f[l]=p(d)}},u=function(f){var l,p,d,m,v,b=[];if(!f||typeof f.tagName!="string")return"";if(b.push(f.tagName.toLowerCase()),typeof f.id=="string"&&b.push("#".concat(f.id)),typeof(l=f.className)=="string")for(p=l.split(/\s+/),v=0;v<p.length;v++)b.push(".".concat(p[v]));var x=["type","name","title","alt","data-arms-attr"];for(v=0;v<x.length;v++)d=x[v],typeof(m=f.getAttribute(d))=="string"&&b.push("[".concat(d,'="').concat(m,'"]'));return b.join("")},h=function(f,l){return function(p){if(p&&p!==a){a=p;var d;try{d=p.target}catch(v){d="<unknown>"}if(d.length!==0){var m={type:"ui.".concat(f),data:{message:function(v){if(!v||v.nodeType!==1)return"";for(var b=v||null,x=[],y=0,E=0,I=3,w="";b&&y++<5&&!((w=u(b))==="html"||y>1&&E+x.length*I+w.length>=80);)x.push(w),E+=w.length,b=b.parentNode;return x.reverse().join(" > ")}(d)},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 d=e&&e.chrome,m=d&&d.app&&d.app.runtime,v="history"in e&&!!e.history.pushState&&!!e.history.replaceState;return!m&&v}()){var f=function(d,m){var v={type:"navigation",data:{from:d,to:m}};i&&i.addBehavior(v),r=m},l=e.onpopstate;e.onpopstate=function(){for(var d=arguments.length,m=new Array(d),v=0;v<d;v++)m[v]=arguments[v];var b=e.location.href;if(f(r,b),l)return l.apply(this,m)};var p=function(d){return function(){for(var m=arguments.length,v=new Array(m),b=0;b<m;b++)v[b]=arguments[b];var x=v.length>2?v[2]:void 0;return x&&f(r,String(x)),d.apply(this,v)}};o(e.history,"pushState",p),o(e.history,"replaceState",p)}};s.ext(c.prototype,{addBehavior:function(f){if(this.getConfig("behavior")&&f&&typeof f=="object"){var l={},p=f.data||{};if(f.type)l=p;else{if(typeof p.name!="string"||typeof p.message!="string")return;l.name=p.name.substr(0,20),l.message=p.message.substr(0,200)}l.message&&(l.message=s.encode(l.message));var d={type:f.type||"custom",data:l||{},timestamp:f.timestamp||Date.now(),page:f.page||e&&e.location&&e.location.pathname};return t.push(d),t=t.slice(-100)}},getBehavior:function(){return t||[]},setBehavior:function(f){return f&&(t=f),t},reportBehavior:function(f){var l=this;l.getConfig("behavior")&&(l.sendBhTimer&&(clearTimeout(l.sendBhTimer),l.sendBhTimer=void 0),l.sendBhTimer=setTimeout(function(){t&&t.length>0&&(l.behavior(t),t=[],l.sendBhTimer=void 0,f&&typeof f=="function"&&f())},0))},initBehavior:function(){if(!this.hasInitBehavior&&!i){try{(function(){if(document&&document.referrer&&document.location){var l=document.referrer,p=document.location.href;if(l!==""){var d={type:"navigation",data:{from:l,to:p}};r=p,i&&i.addBehavior(d)}}})(),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(l){if(e&&e.console){var p=["debug","info","warn","log","error","assert"];s.isArray(l)&&(p=l);for(var d=0;d<p.length;d++){var m=p[d];m&&s.isString(m)&&e.console[m]&&typeof e.console[m]=="function"&&o(e.console,m,function(v){var b=m;return function(){for(var x=arguments.length,y=new Array(x),E=0;E<x;E++)y[E]=arguments[E];var I={type:"console",data:{level:b,message:y}};if(i&&i.addBehavior(I),b==="error")for(var w=0;w<y.length;w++){var R=y[w];R&&R.message&&R.stack&&i&&i.errorHandler(new ErrorEvent("error",{error:R,message:R.message}))}v&&Function.prototype.apply.call(v,e.console,y)}})}}}(f)}catch(l){s.warn("[arms] error in initBehavior",l)}i=this,this.hasInitBehavior=!0}return this}})},sr}var Ws={},Ks;function nr(){return Ks||(Ks=1,Ws.TIMING_KEYS=["startTime","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","","domInteractive","","domContentLoadedEventEnd","","loadEventStart","","msFirstPaint","secureConnectionStart","redirectStart","redirectEnd"]),Ws}var ar,$s;function po(){if($s)return ar;$s=1;var s=$e(),c=nr(),e=c.TIMING_KEYS;return ar=function(){var t=s.win||{},i=t.performance;if(!i||typeof i!="object"||typeof i.getEntriesByType!="function")return null;var r={},n=i.timing||{},a=i.getEntriesByType("resource")||[];if(r.begin=n[e[1]]||Date.now(),typeof t.PerformanceNavigationTiming=="function"){var o=i.getEntriesByType("navigation")[0];o&&(n=o)}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 l=Math.round(f-g);l>=0&&l<6e5&&(r[h]=l)}}),r.res=JSON.stringify(a),r},ar}var or,qs;function mo(){if(qs)return or;qs=1;var s=$e(),c=nr(),e=c.TIMING_KEYS;return or=function(){var t=s.win||{},i=t.performance;if(!i||typeof i!="object")return null;var r={},n=i.timing||{},a=Date.now(),o=1;if(typeof t.PerformanceNavigationTiming=="function"){var u=i.getEntriesByType("navigation")[0];u&&(n=u,o=2)}s.each({dns:[3,2],tcp:[5,4],ssl:[5,17],ttfb:[7,6],trans:[8,7],dom:[10,8],res:[14,12],firstbyte:[7,2],fpt:[8,1],tti:[10,1],ready:[12,1],load:[14,1]},function(p,d){var m=n[e[p[1]]],v=n[e[p[0]]];if(o===2||m>0&&v>0){var b=Math.round(v-m);b>=0&&b<6e5&&(r[d]=b)}});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",o===1&&n[e[16]]>0&&n[e[1]]>0){var l=n[e[16]]-n[e[1]];l>=0&&l<36e5&&(r.fpt=l)}return o===1&&n[e[1]]>0?r.begin=n[e[1]]:o===2&&r.load>0?r.begin=a-r.load:r.begin=a,r},or}var Gs,Js;function go(){return Js||(Js=1,Gs=function(s,c,e){var t=$e(),i=po(),r=mo(),n=null,a=e.documentElement,o=c.innerWidth||a.clientWidth||e.body.clientWidth,u=c.innerHeight||a.clientHeight||e.body.clientHeight,h=c.navigator.connection,g={sr:screen.width+"x"+screen.height,vp:o+"x"+u,ct:h?h.effectiveType||h.type:""},f={},l=function(d,m,v,b,x){if(m===void 0){var y,E;if(!f[d]){y=new RegExp(d+"=([^;]+)");try{E=y.exec(e.cookie)}catch(w){return t.warn("[retcode] can not get cookie:",w),null}E&&(f[d]=E[1])}return f[d]}var I=d+"="+m;I+="; path=/",v&&(I+="; max-age="+v);try{return e.cookie=I,!!e.cookie}catch(w){return t.warn("[retcode] can not set cookie: ",w),!1}},p=function(d){var m=d._conf.uid||l("_nk_")||l("_bl_uid");return!m&&(m=t.uu(),!l("_bl_uid",m,15552e3))?null:m};return t.ext(s.prototype,{activeErrHandler:function(d){return n&&!d?this:(n=this,this)},errorHandler:function(d){if(!d)return this;var m=d.type;if(m==="error"){var v=d.target||d.srcElement;!v||!v.tagName||d.message||d.filename||d.lineno||d.colno?this.error(d.error||{message:d.message},d):this.resourceErrorHandler(d)}else m==="unhandledrejection"&&t.T(d.reason,"Error")&&t.checkAutoError(d.reason)&&this.error(d.reason);try{this.getConfig("behavior")&&this.reportBehavior&&this.reportBehavior()}catch(b){}return this},resourceErrorHandler:function(d){var m=this,v=d.target||d.srcElement;try{var b=m.getSrc(v),x=typeof v.tagName=="string"?v.tagName.toLowerCase():"",y=m.getXPath(v,5),E=t.getURL(b),I={src:b&&b.substring(0,1e3),node_name:x,xpath:y,res_type:t.getResType(x,b),res_name:E.path,domain:E.domain};return m._conf.enableResource&&m.fixResourceStatus&&d.timeStamp&&m.fixResourceStatus({src:b,node_name:x,res_type:t.getResType(x,b),timeStamp:d.timeStamp,domain:E.domain}),m._lg("resourceError",I),m}catch(w){return t.warn("[ARMS] resourceErrorHandler error :",w),m}},getSrc:function(d){var m=d.src||d.href;try{if(!m){var v=(typeof d.tagName=="string"?d.tagName.toLowerCase():"")==="object",b=d.getAttribute("classid")&&d.getAttribute("classid").toLowerCase()==="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"||d.getAttribute("type")==="application/x-shockwave-flash";v&&b&&(m=d.getAttribute("data")||d.getAttribute("codebase")),m||(m=d.outerHTML||d.innerHTML)}}catch(x){m=""}return m},getXPath:function(d,m){var v=d.id?"#"+d.id:"",b=typeof d.className=="string"?"."+d.className.split(" ").join("."):"",x=(typeof d.tagName=="string"?d.tagName.toLowerCase():"")+v+b;return d.parentNode&&d.parentNode.tagName&&m-1!=0?this.getXPath(d.parentNode,m-1)+" > "+x:x},sendPerformance:function(d){var m=this;m.onReady(function(){var v=r();v&&v.load&&v.load>0&&(v.page=m.getPage(!0),d&&(v=t.ext(v,d)),v.autoSend=!0,m.performance(v))})},sendResources:function(d){var m=this;m.onReady(function(){var v=i();v&&v.load&&v.load>0&&(v.load&&v.load<=2e3||v.load&&v.load<=8e3&&Math.random()>.05||(v.page=m.getPage(!0),v.dl=location.href,d&&(v=t.ext(v,d)),m._lg("res",v,m.getConfig("sample"))))})},sendPV:function(){var d=this;d.onReady(function(){var m=function(v){var b=p(v),x=c.devicePixelRatio||1;return{uid:b,dt:e.title,dl:location.href,dr:e.referrer,dpr:x.toFixed(2),de:(e.characterSet||e.defaultCharset||"").toLowerCase(),ul:a.lang,begin:Date.now()}}(d);m&&m.uid&&d._lg("pv",m,d.getConfig("pvSample"))})},commonInfo:function(){return g.uid=p(this),g.sid=function(d){if(d.session)return d.session;var m;try{if(typeof window=="object"&&typeof sessionStorage=="object"&&typeof sessionStorage.getItem=="function")return typeof(m=sessionStorage.getItem("_bl_sid"))=="string"?(d.session=m,m):(m=t.uu(),d.session=m,typeof sessionStorage.setItem=="function"&&sessionStorage.setItem("_bl_sid",m),m)}catch(v){t.warn("[ARMS] getSid error :",v)}return d.session=m=t.uu(),m}(this),g},handleUnload:function(d){var m=Date.now();if(m-this._lastUnload<200)return this;this._lastUnload=m,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 m=this;if(!d^m.hashChangeHandler)return m;d?(m.hackHistoryState(),m.hashChangeHandler=function(v){var b=m._conf.parseHash(location.hash);b&&m.setPage(b,v!==!1)},m.stateChangeHandler=function(v){var b=m._conf.parseHash(v.detail);b&&m.setPage(b)},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 d=this;if(d.hasInitHandler)return d;var m=d._conf;return t.on(c,"beforeunload",function(){d.handleUnload(0)}),d.bindHashChange(m.enableSPA),d.activeErrHandler(!1),d.hasInitHandler=!0,d}}),t.on(c,"error",function(d){n&&n.errorHandler(d)},!1,!0).on(c,"unhandledrejection",function(d){n&&n.errorHandler(d)}),s}),Gs}var cr,Xs;function bo(){if(Xs)return cr;Xs=1;var s=$e(),c=500;return cr=function(e,t,i){function r(g,f,l){var p=0,d=g.tagName;if(d!=="SCRIPT"&&d!=="STYLE"&&d!=="META"&&d!=="HEAD"){var m=g.children?g.children.length:0;if(m>0)for(var v=g.children,b=m-1;b>=0;b--)p+=r(v[b],f+1,p>0);if(p<=0&&!l&&!(g.getBoundingClientRect&&g.getBoundingClientRect().top<a))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 a=t.innerHeight||0,o=[],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 l=t.MutationObserver;return(u=new l(function(){(function(p){var d=Date.now()-p,m=i.querySelector("body");if(m){var v=0;v+=r(m,1,!1),o.push({score:v,t:d})}else o.push({score:0,t:d})})(f._startTime)})).observe(document,{childList:!0,subtree:!0}),h=1,f.onReady(function(){f.endObserving(g)}),u},endObserving:function(g,f){var l=this;if(u&&h)if(l.fmpTimmer&&(clearTimeout(l.fmpTimmer),l.fmpTimmer=null),f||!function(v,b){var x=Date.now()-v;return!(x>b||x-(o&&o.length&&o[o.length-1].t||0)>2*c)}(l._startTime,g)){u.disconnect(),h=0,o=n(o);for(var p=null,d=1;d<o.length;d++)if(o[d].t>=o[d-1].t){var m=o[d].score-o[d-1].score;(!p||p.rate<=m)&&(p={t:o[d].t,rate:m})}p&&p.t>0&&p.t<36e5?l.sendPerformance({fmp:p.t}):l.sendPerformance()}else l.fmpTimmer=s.delay(function(){l.endObserving(g)},c)}})},cr}var Zs,Ys;function vo(){return Ys||(Ys=1,Zs=function(s,c){var e=$e(),t=null,i=e.getCurDomain(),r=function(h,g,f,l,p,d,m,v,b,x,y,E,I){var w=e.J(p)||null,R=e.safetyCall(g,[w,l],null);if(!R)return!1;var L=R.code||d,D=!("success"in R)||R.success;h.api(f,D,m,L,R.msg,v,b,x,D?{}:y,i,E,I)},n="fetch",a="__oFetch_",o="__oXMLHttpRequest_",u="XMLHttpRequest";return e.ext(s.prototype,{removeHook:function(h,g){return t&&(g||this===t)?(c[a]&&(c[n]=c[a],delete c[a]),c[o]&&(c[u]=c[o],delete c[o]),t=null,this):this},addHook:function(h){return!h&&t?this:(t||(function(){if(typeof c[n]=="function"){var g=c[n];c[a]=g,c[n]=function(f,l){var p=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),d=t;if(!d||!d.api||l&&(l.method==="HEAD"||l.mode==="no-cors"))return g.apply(c,p);l||(l={});var m=Date.now(),v=d._conf,b=e.duration(),x=(f&&typeof f!="string"?f.url:f)||"",y=x;x=e.cutUrlSearch(x);var E=(v.ignore||{}).ignoreApis,I=v.parseTraceId;if(!e.checkAPI(x,!0)||e.ignoreByRule(x,E))return g.apply(c,p);x=e.filterByRule(x,y,v.ignoreApiPath?v.ignoreApiPath:v.apiHelper);var w=v.enableLinkTrace,R="",L="",D=d.getConfig("pid"),N=null,C=d.getConfig("sample"),M=d.getConfig("linkType"),A=1;if(C&&!d.sampling(C)&&(A=0),w){var U="";try{U=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(K){U=""}var ie=e.checkSameOrigin(y,U);if(d.getConfig("enableApiCors")||ie)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"),oe=p[0].headers.get("EagleEye-SessionID"),$=p[0].headers.get("EagleEye-pAppName");q?R=q:(R=d.getTraceId()["EagleEye-TraceID"],p[0].headers.append("EagleEye-TraceID",R)),oe?L=oe:(L=d.getPageviewId()["EagleEye-SessionID"],p[0].headers.append("EagleEye-SessionID",L)),$||p[0].headers.append("EagleEye-pAppName",D);break;case"b3":var se=p[0].headers.get("X-B3-TraceId");if(se)R=se;else{var k=d.getB3TraceId(A);p[0].headers.append("X-B3-TraceId",k["X-B3-TraceId"]),p[0].headers.append("X-B3-ParentSpanId",k["X-B3-ParentSpanId"]),p[0].headers.append("X-B3-SpanId",k["X-B3-SpanId"]),p[0].headers.append("X-B3-Sampled",k["X-B3-Sampled"]),p[0].headers.append("X-Request-ID",e.guid()),R=k["X-B3-TraceId"]}L=d.pageview;break;case"tracing":default:var P=p[0].headers.get("uber-trace-id");P?R=P.split(":")[0]:(P=d.getUberTraceId(A),p[0].headers.append("uber-trace-id",P["uber-trace-id"]),R=P.traceId),L=d.pageview}}catch(K){e.warn(`[retcode] fetch failed to set header, exception is :
4
- `+K)}else switch(l.headers=l.headers?l.headers:{},M){case"arms":l.headers["EagleEye-TraceID"]?R=l.headers["EagleEye-TraceID"]:(R=d.getTraceId()["EagleEye-TraceID"],l.headers["EagleEye-TraceID"]=R),l.headers["EagleEye-SessionID"]?L=l.headers["EagleEye-SessionID"]:(L=d.getPageviewId()["EagleEye-SessionID"],l.headers["EagleEye-SessionID"]=L),l.headers["EagleEye-pAppName"]||(l.headers["EagleEye-pAppName"]=D);break;case"b3":if(l.headers["X-B3-TraceId"])R=l.headers["X-B3-TraceId"];else{var z=d.getB3TraceId(A);l.headers["X-B3-TraceId"]=z["X-B3-TraceId"],l.headers["X-B3-ParentSpanId"]=z["X-B3-ParentSpanId"],l.headers["X-B3-SpanId"]=z["X-B3-SpanId"],l.headers["X-B3-Sampled"]=z["X-B3-Sampled"],l.headers["X-Request-ID"]=e.guid(),R=z["X-B3-TraceId"]}L=d.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(l.headers["uber-trace-id"])R=l.headers["uber-trace-id"].split(":")[0];else{var F=d.getUberTraceId(A);l.headers["uber-trace-id"]=F["uber-trace-id"],R=F.traceId}L=d.getPageviewId()["EagleEye-SessionID"]}}return g.apply(c,p).then(function(K){if(!d||!d.api)return K;try{if(!K||typeof K.clone!="function")return K;var Q=K.clone(),ge=Q.headers;if(ge&&typeof ge.get=="function"){var ce=ge.get("content-type");if(ce&&!/(text)|(json)/.test(ce))return K;if(!R){var Se=e.parseFetchHeaders(ge);typeof Se=="object"&&Se["eagleeye-traceid"]&&(R=Se["eagleeye-traceid"],N="response")}}var De=b();return Q.text().then(function(Ie){if(!R&&e.isFunction(I)){var Ue=I(Q,Ie);Ue&&e.isString(Ue)&&(R=Ue)}var Te=e.getFetchSnapshot(p,Ie,ge);Q.ok?r(d,v.parseResponse,x,y,Ie,Q.status||200,De,m,R,L,Te,N,A):(d.api(x,!1,De,Q.status||404,Q.statusText,m,R,L,Te,i,N,A),v.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:Q.url,res_type:"api"}))}),K}catch(Ie){return e.warn("[ARMS] fetch response error :",Ie),K}}).catch(function(K){if(!d||!d.api)throw K;var Q=b();throw d.api(x,!1,Q,K.name||"Error",K.message,m,R,L,{},i),v.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:y,res_type:"api"}),K})},c[n].toString=e.createFakeToString(n)}}(),function(){if(typeof c[u]=="function"){var g,f=c[u];c[o]=f;var l=function(p){var d=new f(p),m=t;if(!m||!m.api||!d.addEventListener)return d;var v,b,x,y,E=d.send,I=d.open,w=d.setRequestHeader,R=m._conf,L=(R.ignore||{}).ignoreApis,D=R.parseTraceId,N=m.getConfig("enableLinkTrace"),C="",M="",A="",U=null,ie=m.getConfig("sample"),q=m.getConfig("linkType"),oe=1;return ie&&!m.sampling(ie)&&(oe=0),d.open=function($,se){g=$;var k=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);I.apply(d,k),y=se||"",x=e.cutUrlSearch(y);var P=!e.checkAPI(x,!0)||e.ignoreByRule(x,L);if(x=x?e.filterByRule(x,y,R.ignoreApiPath?R.ignoreApiPath:R.apiHelper):"",!P&&N){var z="";try{z=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(ge){z=""}var F=e.checkSameOrigin(y,z);if((m.getConfig("enableApiCors")||F)&&w&&typeof w=="function")switch(q){case"arms":C=m.getTraceId()["EagleEye-TraceID"],w.apply(d,["EagleEye-TraceID",C]),M=m.getPageviewId()["EagleEye-SessionID"],w.apply(d,["EagleEye-SessionID",M]),A=m.getConfig("pid"),w.apply(d,["EagleEye-pAppName",A]);break;case"b3":var K=m.getB3TraceId(oe);w.apply(d,["X-B3-TraceId",K["X-B3-TraceId"]]),w.apply(d,["X-B3-ParentSpanId",K["X-B3-ParentSpanId"]]),w.apply(d,["X-B3-SpanId",K["X-B3-SpanId"]]),w.apply(d,["X-B3-Sampled",K["X-B3-Sampled"]]),w.apply(d,["X-Request-ID",e.guid()]),C=K["X-B3-TraceId"],M=m.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var Q=m.getUberTraceId(oe);w.apply(d,["uber-trace-id",Q["uber-trace-id"]]),C=Q.traceId,M=m.getPageviewId()["EagleEye-SessionID"]}}},d.send=function(){v=Date.now(),b=e.duration();var $=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);E.apply(d,$)},e.on(d,"readystatechange",function(){if(x&&d.readyState===4){var $=b(),se=e.getXhrSnapshot(y,g,d);if(!C){var k=e.parseXhrHeaders(typeof d.getAllResponseHeaders=="function"&&d.getAllResponseHeaders()||"");typeof k=="object"&&k["eagleeye-traceid"]&&(C=k["eagleeye-traceid"],U="response")}if(!C&&e.isFunction(D)){var P=D(d);P&&e.isString(P)&&(C=P)}if(d.status>=200&&d.status<=299){var z=d.status||200;if(typeof d.getResponseHeader=="function"){var F=d.getResponseHeader("Content-Type");if(F&&!/(text)|(json)/.test(F))return}d.responseType&&d.responseType!=="text"?m.api(x,!0,$,z,"",v,C,M,{},i,U,oe):r(m,R.parseResponse,x,y,d.responseText,z,$,v,C,M,se,U,oe)}else m.api(x,!1,$,d.status||"FAILED",d.statusText,v,C,M,se,i,U,oe),R.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:d.responseURL||y,res_type:"api"})}}),d};l.prototype=f.prototype,e.each(Object.keys(f),function(p){l[p]=f[p]}),c[u]=l,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}),Zs}var Qs,en;function xo(){return en||(en=1,Qs=function(s,c){var e=$e(),t=c.history||{},i=c.document,r=function(a,o){var u;c.CustomEvent?u=new CustomEvent(a,{detail:o}):((u=i.createEvent("HTMLEvents")).initEvent(a,!1,!0),u.detail=o),c.dispatchEvent(u)},n=function(a){var o=t[a];typeof o=="function"&&(t[a]=function(u,h,g){var f=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),l=location.href,p=o.apply(t,f);if(!g||typeof g!="string"||g===l)return p;try{var d=l.split("#"),m=g.split("#"),v=e.cutUrlSearch(d[0]),b=e.cutUrlSearch(m[0]),x=d[1]&&d[1].replace(/^\/?(.*)/,"$1"),y=m[1]&&m[1].replace(/^\/?(.*)/,"$1");x!==y?r("historystatechange",y):v!==b&&r("historystatechange",b)}catch(E){e.warn("[retcode] error in "+a+": "+E)}return p},t[a].toString=e.createFakeToString(a))};e.ext(s.prototype,{hackHistoryState:function(){return this.hasHackedHistoryState?this:(n("pushState"),n("replaceState"),this.hasHackedHistoryState=!0,this)}})}),Qs}var ur,tn;function So(){if(tn)return ur;tn=1;var s=$e(),c=nr(),e=c.TIMING_KEYS;return ur=function(t,i){function r(o,u,h){if(o instanceof i.PerformanceResourceTiming&&o.initiatorType){var g=s.getResType(o.initiatorType,o.name),f=u.resourceTypes||[],l=(u.ignore||{}).ignoreResources;if(g&&f.includes(g)&&!s.ignoreByRule(o.name,l)&&!s.ignoreByRule(s.decode(o.name),l)){var p=o[e[0]],d=o[e[1]],m=o[e[2]],v=o[e[3]],b=o[e[4]],x=o[e[5]],y=o[e[6]],E=o[e[7]],I=o[e[8]],w=o[e[18]],R=o[e[19]];if(!h.has(o)&&(!s.areInOrder(p,d,m,v,b,x,y,E,I)||p>E))return;if(w<p&&(w=p),R<p&&(R=d),s.areInOrder(p,w,R,d))return{domain:s.getURL(o.name).domain,res_type:g,src_type:s.getSrcType(o.name,u.cdnHostList),success:1,size:Math.round(o.decodedBodySize),duration:Math.round(o.duration),timeStamp:o.responseEnd,timing:o}}}}var n="_resource-"+Date.now(),a="_resource_error-"+Date.now();s.ext(t.prototype,{initResource:function(){var o=this,u=i.performance,h=i.PerformanceObserver;if(o[a]||(o[a]=new WeakMap),!u||!h||typeof u!="object"||typeof u.getEntriesByType!="function")return null;var g=u.getEntriesByType("resource")||[];return setTimeout(function(){o.setResource(g)},10),new h(function(f){setTimeout(function(){o.setResource(f.getEntries())},10)}).observe({entryTypes:["resource"]}),this.onReady(function(){setTimeout(o.resourceComboReport.bind(o),5e3)}),o},setResource:function(o){var u=this._conf,h=this[a];if(s.isArray(o)&&o.length){this[n]||(this[n]={});for(var g=this[n],f=0,l=o.length;f<l;f+=1){var p=o[f];if(s.checkAPI(p.name,!1)){var d=r(p,u,h);if(d){var m=d.res_type+"-"+d.domain;m in g||(g[m]=[]),g[m].push(d)}}}return this}},fixResourceStatus:function(o){var u=i.performance;if(!u||typeof u.getEntriesByName!="function")return null;var h=this[a];if(!o.src||!s.checkAPI(o.src,!1))return this;var g=o.timeStamp||u.now(),f=u.getEntriesByName(o.src,"resource");return s.each(f,function(l){h.has(l)||g-l.responseEnd<100&&h.set(l,{success:0})}),this},resourceComboReport:function(){var o=this[n]||{},u=this._conf.resourceSlow||2e3,h=this[a];this[n]={};var g=Object.keys(o);if(g.length!==0){var f=[];s.each(g,function(m){var v=o[m],b={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(v,function(x){var y=x.timing||{},E=h.get(x.timing),I=E?E.success:1,w=x.duration>u?1:0;b.domain=x.domain,b.res_type=x.res_type,b.src_type=x.src_type,b.count+=1,b.duration+=x.duration,b.size+=x.size,I||(b.err_count+=1,b.err_duration+=x.duration),w&&(b.slow_count+=1,b.slow_duration+=x.duration);try{var R=JSON.parse(JSON.stringify(y));R.success=I,R.resourceSlow=u,R.isSlow=w,b.timings.push(R)}catch(L){}}),b.count&&(b.size=Math.round(b.size/b.count),b.duration=Math.round(b.duration/b.count)),b.slow_count&&(b.slow_duration=Math.round(b.slow_duration/b.slow_count)),b.err_count&&(b.err_duration=Math.round(b.err_duration/b.err_count)),b.timings.length>20&&(b.timings.sort(function(x,y){return y.duration-x.duration}),b.timings.length=20),b.timings=encodeURIComponent(JSON.stringify(b.timings)),f.push(b)});var l={_combo:1,resource:JSON.stringify(f)},p=i.navigator.connection;l.ct=p?p.effectiveType||p.type:"";var d=p&&(p.downlink||p.downlinkMax||p.bandwidth)||null;(d=d>999?999:d)&&(l.bandwidth=d),this._lg("resource",l,this.getConfig("sample"))}}})},ur}var rn;function _o(){if(rn)return it.exports;rn=1;var s=$e(),c=uo(),e=ho(),t=lo(),i=s.win,r=i.document,n=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,a=function(o){var u=this;return c.call(u,o),u._initialPage=o.page&&s.safetyCall(o.page,[],o.page+"")||null,u._isRobot=s.isRobot(),u._health={errcount:0,apisucc:0,apifail:0},u.beforeSend=function(h,g){h==="error"?u._health.errcount++:h==="api"&&u._health[g.success?"apisucc":"apifail"]++},o.enableInstanceAutoSend!==!1&&(u.initHandler(),u.initHook(),u.initFmpObserver(1e4),u._conf&&u._conf.behavior&&typeof u.initBehavior=="function"&&u.initBehavior(),u._conf&&u._conf.enableResource&&typeof u.initResource=="function"&&u.initResource()),Object.defineProperty&&i.addEventListener&&Object.defineProperty(u,"pipe",{set:u.sendPipe}),u};return a.prototype=s.createObject(c.prototype),s.ext(c._root.dftCon,{uid:null,setUsername:null,ignoreUrlPath:null,ignoreApiPath:null,urlHelper:[{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},/\/$/],resourceHelper:[],apiHelper:{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},ignoreUrlCase:!0,imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",cdnHostList:[],resourceTypes:["css","script","img","font"],resourceSlow:2e3,disableHook:!1,autoSendPv:!0,autoSendPerf:!0,enableSPA:!1,enableLinkTrace:!1,linkType:"arms",enableApiCors:!1,sendResource:!0,behavior:!0,enableConsole:!1,parseHash:function(o){return(o?s.cutUrlSearch(o.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(o){if(!o||typeof o!="object")return{};var u=o.code,h=o.msg||o.message||o.subMsg||o.errorMsg||o.ret||o.errorResponse||"";return typeof h=="object"&&(u=u||h.code,h=h.msg||h.message||h.info||h.ret||JSON.stringify(h)),{msg:h,code:u,success:!0}}}),s.ext(a.prototype,{constructor:a,_super:c,onReady:function(o){var u=this;if(u.hasReady)return o();r.readyState==="complete"?(u.hasReady=!0,o()):s.on(i,"load",function(){u.hasReady=!0,o()},!0)},getPage:function(o){var u=this._conf,h=u.page,g=location,f=g.host+g.pathname;return h&&!o?s.safetyCall(h,[],h+""):this._initialPage||s.filterByRule(u.ignoreUrlCase?f.toLowerCase():f,g.href,u.ignoreUrlPath?u.ignoreUrlPath:u.urlHelper)},setPage:function(o,u){var h=this,g=h.prevPage;if(u!==!1){if(!o||o===g)return h;h.prevPage=o,clearTimeout(h.sendPVTimmer),h.handleUnload(1),h.resetPageview(),h.sendPVTimmer=setTimeout(function(){h.sendPV()},10)}else h.prevPage=o;return h._conf.page=o,h},setConfig:function(o,u){if(o&&typeof o=="object"){s.verifyConfig(o),o=this.setImgUrl(o);var h=this._conf;if(this._conf=s.ext({},h,o),!u){var g="disableHook";g in o&&h[g]!==o[g]&&(o[g]?this.removeHook():this.addHook()),(g="enableSPA")in o&&h[g]!==o[g]&&this.bindHashChange(o[g])}}},sendRequest:function(o){e(o,this.getConfig("imgUrl"))},postData:function(o,u){var h={};h[u]=o[u],delete o[u];var g="";typeof o=="object"&&(g=s.serialize(o)),t(h,this.getConfig("imgUrl")+g+"&post_res=")},sendPipe:function(o){var u=this;if(!o||!o.length)return u;try{if(s.T(o[0])==="Array")return s.each(o,function(g){return u.sendPipe(g)});if(s.T(o)!=="Array")return u;var h=o.shift();if(!n.test(h))return u;u[h].apply(u,o)}catch(g){return s.warn("[retcode] error in sendPipe",g),u}},sendHealth:function(){var o=s.ext({},this._health);o.healthy=o.errcount>0?0:1,o.begin=Date.now();var u=o.begin-this.sBegin;o.stay=u,this._lg("health",o,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(o){o=s.ext({pid:this._conf.pid},o);var u=this.__proto__.constructor(o);return o.page&&u.sendPV(),u}}),fo()(a,i),go()(a,i,r),bo()(a,i,r),vo()(a,i),xo()(a,i),So()(a,i),a._super=c,a._root=c._root,c.Browser=a,it.exports=a,it.exports}var sn;function yo(){if(sn)return pt.exports;sn=1;function s(a,o){var u=e[i]=new t(a);u.sendPipe(o);var h=u._conf;return h.autoSendPv!==!1&&u.sendPV(),h&&h.useFmp||u.sendPerformance(),h&&h.sendResource&&u.sendResources(),e[r]=!0,u}function c(){if(e[r])return e[i];var a={},o=[];return i in e&&(a=e[i].config||{},o=e[i].pipe||[]),s(a,o)}var e=window,t=e.BrowserLogger=_o(),i=$e().key,r="__hasInitBlSdk";t.singleton=function(a,o){return e[r]?e[i]:s(a,o)},t.createExtraInstance=function(a){a&&typeof a=="object"&&a.enableInstanceAutoSend!==!0&&(a.enableInstanceAutoSend=!1);var o=new t(a),u=o._conf;return u.enableInstanceAutoSend&&(u.autoSendPv!==!1&&o.sendPV(),u&&u.useFmp||o.sendPerformance(),u&&u.sendResource&&o.sendResources()),o};var n=typeof window=="object"&&!!window.navigator;return n&&e[i]&&(t.bl=c()),pt.exports=t,pt.exports}function Ao(){return yo()}var Eo={getArmsLogger:Ao};const nn="https://arms-retcode.aliyuncs.com/r.png?",an="https://arms-retcode-sg.aliyuncs.com/r.png?",on="https://retcode-us-west-1.arms.aliyuncs.com/r.png?",cn="e1iftji1w7@7ec1cef2cc88733",un="e1iftji1w7@10a06d1ec260adc",hn="e1iftji1w7@10a06d1ec260adc",hr={cn:{reportUrl:nn,pid:cn},"cn-hangzhou":{reportUrl:nn,pid:cn},sg:{reportUrl:an,pid:un},"ap-southeast-1":{reportUrl:an,pid:un},usw:{reportUrl:on,pid:hn},"us-west-1":{reportUrl:on,pid:hn}},dn=s=>s!==null&&typeof s=="object",wo=s=>Object.prototype.toString.call(s).slice(8,-1),ln=s=>Object.isExtensible(s)?wo(s)==="Object":!1;function Co(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,a){if(typeof a=="string"&&t.indexOf(a)>-1){let h;try{h=n[a]}catch(g){throw e(g),g}return At(h,c+1,e)}let o=()=>{};typeof n[a]=="function"&&(o=n[a].bind(n));const u={MediaboxWrapperObjectMethod(...h){let g;try{g=o(...h)}catch(f){throw e(f),f}return At(g,c+1,e)}};return typeof n[a]=="function"?u.MediaboxWrapperObjectMethod:c>10?n[a]:At(n[a],c+1,e)},MediaboxWrapperObjectSetter(n,a,o){return n[a]=At(o,c+1,e),!0}};return new Proxy(s,{get:r.MediaboxWrapperObjectGetter,set:r.MediaboxWrapperObjectSetter})}function Io(s,c,e){const t={MediaboxWrapperFunctionApply(i,r,n){let a;try{a=i.apply(r,n),dn(a)&&ln(a)&&(a.__v_skip=!0)}catch(o){throw e(o),o}return At(a,c+1,e)},MediaboxWrapperFunctionGet(i,r){const n=Object.getOwnPropertyDescriptor(i,r);return n&&!n.writable&&!n.configurable?i[r]:At(i[r],c+1,e)},MediaboxWrapperClassConstructor(i,r){let n;try{n=new i(...r),n.__v_skip=!0}catch(a){throw e(a),a}return At(n,c+1,e)}};return new Proxy(s,{apply:t.MediaboxWrapperFunctionApply,get:t.MediaboxWrapperFunctionGet,construct:t.MediaboxWrapperClassConstructor})}const jt="-c-";function Ro(s){if(typeof s!="string")return jt;if(dr(s))return s;const c=s.indexOf(`
4
+ `+K)}else switch(l.headers=l.headers?l.headers:{},M){case"arms":l.headers["EagleEye-TraceID"]?R=l.headers["EagleEye-TraceID"]:(R=d.getTraceId()["EagleEye-TraceID"],l.headers["EagleEye-TraceID"]=R),l.headers["EagleEye-SessionID"]?L=l.headers["EagleEye-SessionID"]:(L=d.getPageviewId()["EagleEye-SessionID"],l.headers["EagleEye-SessionID"]=L),l.headers["EagleEye-pAppName"]||(l.headers["EagleEye-pAppName"]=D);break;case"b3":if(l.headers["X-B3-TraceId"])R=l.headers["X-B3-TraceId"];else{var j=d.getB3TraceId(A);l.headers["X-B3-TraceId"]=j["X-B3-TraceId"],l.headers["X-B3-ParentSpanId"]=j["X-B3-ParentSpanId"],l.headers["X-B3-SpanId"]=j["X-B3-SpanId"],l.headers["X-B3-Sampled"]=j["X-B3-Sampled"],l.headers["X-Request-ID"]=e.guid(),R=j["X-B3-TraceId"]}L=d.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(l.headers["uber-trace-id"])R=l.headers["uber-trace-id"].split(":")[0];else{var F=d.getUberTraceId(A);l.headers["uber-trace-id"]=F["uber-trace-id"],R=F.traceId}L=d.getPageviewId()["EagleEye-SessionID"]}}return g.apply(c,p).then(function(K){if(!d||!d.api)return K;try{if(!K||typeof K.clone!="function")return K;var Q=K.clone(),ge=Q.headers;if(ge&&typeof ge.get=="function"){var ce=ge.get("content-type");if(ce&&!/(text)|(json)/.test(ce))return K;if(!R){var Se=e.parseFetchHeaders(ge);typeof Se=="object"&&Se["eagleeye-traceid"]&&(R=Se["eagleeye-traceid"],N="response")}}var De=b();return Q.text().then(function(Ie){if(!R&&e.isFunction(I)){var Ue=I(Q,Ie);Ue&&e.isString(Ue)&&(R=Ue)}var Te=e.getFetchSnapshot(p,Ie,ge);Q.ok?r(d,v.parseResponse,x,y,Ie,Q.status||200,De,m,R,L,Te,N,A):(d.api(x,!1,De,Q.status||404,Q.statusText,m,R,L,Te,i,N,A),v.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:Q.url,res_type:"api"}))}),K}catch(Ie){return e.warn("[ARMS] fetch response error :",Ie),K}}).catch(function(K){if(!d||!d.api)throw K;var Q=b();throw d.api(x,!1,Q,K.name||"Error",K.message,m,R,L,{},i),v.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:y,res_type:"api"}),K})},c[n].toString=e.createFakeToString(n)}}(),function(){if(typeof c[u]=="function"){var g,f=c[u];c[o]=f;var l=function(p){var d=new f(p),m=t;if(!m||!m.api||!d.addEventListener)return d;var v,b,x,y,E=d.send,I=d.open,w=d.setRequestHeader,R=m._conf,L=(R.ignore||{}).ignoreApis,D=R.parseTraceId,N=m.getConfig("enableLinkTrace"),C="",M="",A="",U=null,ie=m.getConfig("sample"),q=m.getConfig("linkType"),oe=1;return ie&&!m.sampling(ie)&&(oe=0),d.open=function($,se){g=$;var k=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);I.apply(d,k),y=se||"",x=e.cutUrlSearch(y);var P=!e.checkAPI(x,!0)||e.ignoreByRule(x,L);if(x=x?e.filterByRule(x,y,R.ignoreApiPath?R.ignoreApiPath:R.apiHelper):"",!P&&N){var j="";try{j=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(ge){j=""}var F=e.checkSameOrigin(y,j);if((m.getConfig("enableApiCors")||F)&&w&&typeof w=="function")switch(q){case"arms":C=m.getTraceId()["EagleEye-TraceID"],w.apply(d,["EagleEye-TraceID",C]),M=m.getPageviewId()["EagleEye-SessionID"],w.apply(d,["EagleEye-SessionID",M]),A=m.getConfig("pid"),w.apply(d,["EagleEye-pAppName",A]);break;case"b3":var K=m.getB3TraceId(oe);w.apply(d,["X-B3-TraceId",K["X-B3-TraceId"]]),w.apply(d,["X-B3-ParentSpanId",K["X-B3-ParentSpanId"]]),w.apply(d,["X-B3-SpanId",K["X-B3-SpanId"]]),w.apply(d,["X-B3-Sampled",K["X-B3-Sampled"]]),w.apply(d,["X-Request-ID",e.guid()]),C=K["X-B3-TraceId"],M=m.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var Q=m.getUberTraceId(oe);w.apply(d,["uber-trace-id",Q["uber-trace-id"]]),C=Q.traceId,M=m.getPageviewId()["EagleEye-SessionID"]}}},d.send=function(){v=Date.now(),b=e.duration();var $=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);E.apply(d,$)},e.on(d,"readystatechange",function(){if(x&&d.readyState===4){var $=b(),se=e.getXhrSnapshot(y,g,d);if(!C){var k=e.parseXhrHeaders(typeof d.getAllResponseHeaders=="function"&&d.getAllResponseHeaders()||"");typeof k=="object"&&k["eagleeye-traceid"]&&(C=k["eagleeye-traceid"],U="response")}if(!C&&e.isFunction(D)){var P=D(d);P&&e.isString(P)&&(C=P)}if(d.status>=200&&d.status<=299){var j=d.status||200;if(typeof d.getResponseHeader=="function"){var F=d.getResponseHeader("Content-Type");if(F&&!/(text)|(json)/.test(F))return}d.responseType&&d.responseType!=="text"?m.api(x,!0,$,j,"",v,C,M,{},i,U,oe):r(m,R.parseResponse,x,y,d.responseText,j,$,v,C,M,se,U,oe)}else m.api(x,!1,$,d.status||"FAILED",d.statusText,v,C,M,se,i,U,oe),R.enableResource&&t.fixResourceStatus&&t.fixResourceStatus({src:d.responseURL||y,res_type:"api"})}}),d};l.prototype=f.prototype,e.each(Object.keys(f),function(p){l[p]=f[p]}),c[u]=l,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}),Zs}var Qs,en;function xo(){return en||(en=1,Qs=function(s,c){var e=$e(),t=c.history||{},i=c.document,r=function(a,o){var u;c.CustomEvent?u=new CustomEvent(a,{detail:o}):((u=i.createEvent("HTMLEvents")).initEvent(a,!1,!0),u.detail=o),c.dispatchEvent(u)},n=function(a){var o=t[a];typeof o=="function"&&(t[a]=function(u,h,g){var f=arguments.length===1?[arguments[0]]:Array.apply(null,arguments),l=location.href,p=o.apply(t,f);if(!g||typeof g!="string"||g===l)return p;try{var d=l.split("#"),m=g.split("#"),v=e.cutUrlSearch(d[0]),b=e.cutUrlSearch(m[0]),x=d[1]&&d[1].replace(/^\/?(.*)/,"$1"),y=m[1]&&m[1].replace(/^\/?(.*)/,"$1");x!==y?r("historystatechange",y):v!==b&&r("historystatechange",b)}catch(E){e.warn("[retcode] error in "+a+": "+E)}return p},t[a].toString=e.createFakeToString(a))};e.ext(s.prototype,{hackHistoryState:function(){return this.hasHackedHistoryState?this:(n("pushState"),n("replaceState"),this.hasHackedHistoryState=!0,this)}})}),Qs}var ur,tn;function So(){if(tn)return ur;tn=1;var s=$e(),c=nr(),e=c.TIMING_KEYS;return ur=function(t,i){function r(o,u,h){if(o instanceof i.PerformanceResourceTiming&&o.initiatorType){var g=s.getResType(o.initiatorType,o.name),f=u.resourceTypes||[],l=(u.ignore||{}).ignoreResources;if(g&&f.includes(g)&&!s.ignoreByRule(o.name,l)&&!s.ignoreByRule(s.decode(o.name),l)){var p=o[e[0]],d=o[e[1]],m=o[e[2]],v=o[e[3]],b=o[e[4]],x=o[e[5]],y=o[e[6]],E=o[e[7]],I=o[e[8]],w=o[e[18]],R=o[e[19]];if(!h.has(o)&&(!s.areInOrder(p,d,m,v,b,x,y,E,I)||p>E))return;if(w<p&&(w=p),R<p&&(R=d),s.areInOrder(p,w,R,d))return{domain:s.getURL(o.name).domain,res_type:g,src_type:s.getSrcType(o.name,u.cdnHostList),success:1,size:Math.round(o.decodedBodySize),duration:Math.round(o.duration),timeStamp:o.responseEnd,timing:o}}}}var n="_resource-"+Date.now(),a="_resource_error-"+Date.now();s.ext(t.prototype,{initResource:function(){var o=this,u=i.performance,h=i.PerformanceObserver;if(o[a]||(o[a]=new WeakMap),!u||!h||typeof u!="object"||typeof u.getEntriesByType!="function")return null;var g=u.getEntriesByType("resource")||[];return setTimeout(function(){o.setResource(g)},10),new h(function(f){setTimeout(function(){o.setResource(f.getEntries())},10)}).observe({entryTypes:["resource"]}),this.onReady(function(){setTimeout(o.resourceComboReport.bind(o),5e3)}),o},setResource:function(o){var u=this._conf,h=this[a];if(s.isArray(o)&&o.length){this[n]||(this[n]={});for(var g=this[n],f=0,l=o.length;f<l;f+=1){var p=o[f];if(s.checkAPI(p.name,!1)){var d=r(p,u,h);if(d){var m=d.res_type+"-"+d.domain;m in g||(g[m]=[]),g[m].push(d)}}}return this}},fixResourceStatus:function(o){var u=i.performance;if(!u||typeof u.getEntriesByName!="function")return null;var h=this[a];if(!o.src||!s.checkAPI(o.src,!1))return this;var g=o.timeStamp||u.now(),f=u.getEntriesByName(o.src,"resource");return s.each(f,function(l){h.has(l)||g-l.responseEnd<100&&h.set(l,{success:0})}),this},resourceComboReport:function(){var o=this[n]||{},u=this._conf.resourceSlow||2e3,h=this[a];this[n]={};var g=Object.keys(o);if(g.length!==0){var f=[];s.each(g,function(m){var v=o[m],b={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(v,function(x){var y=x.timing||{},E=h.get(x.timing),I=E?E.success:1,w=x.duration>u?1:0;b.domain=x.domain,b.res_type=x.res_type,b.src_type=x.src_type,b.count+=1,b.duration+=x.duration,b.size+=x.size,I||(b.err_count+=1,b.err_duration+=x.duration),w&&(b.slow_count+=1,b.slow_duration+=x.duration);try{var R=JSON.parse(JSON.stringify(y));R.success=I,R.resourceSlow=u,R.isSlow=w,b.timings.push(R)}catch(L){}}),b.count&&(b.size=Math.round(b.size/b.count),b.duration=Math.round(b.duration/b.count)),b.slow_count&&(b.slow_duration=Math.round(b.slow_duration/b.slow_count)),b.err_count&&(b.err_duration=Math.round(b.err_duration/b.err_count)),b.timings.length>20&&(b.timings.sort(function(x,y){return y.duration-x.duration}),b.timings.length=20),b.timings=encodeURIComponent(JSON.stringify(b.timings)),f.push(b)});var l={_combo:1,resource:JSON.stringify(f)},p=i.navigator.connection;l.ct=p?p.effectiveType||p.type:"";var d=p&&(p.downlink||p.downlinkMax||p.bandwidth)||null;(d=d>999?999:d)&&(l.bandwidth=d),this._lg("resource",l,this.getConfig("sample"))}}})},ur}var rn;function _o(){if(rn)return it.exports;rn=1;var s=$e(),c=uo(),e=ho(),t=lo(),i=s.win,r=i.document,n=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,a=function(o){var u=this;return c.call(u,o),u._initialPage=o.page&&s.safetyCall(o.page,[],o.page+"")||null,u._isRobot=s.isRobot(),u._health={errcount:0,apisucc:0,apifail:0},u.beforeSend=function(h,g){h==="error"?u._health.errcount++:h==="api"&&u._health[g.success?"apisucc":"apifail"]++},o.enableInstanceAutoSend!==!1&&(u.initHandler(),u.initHook(),u.initFmpObserver(1e4),u._conf&&u._conf.behavior&&typeof u.initBehavior=="function"&&u.initBehavior(),u._conf&&u._conf.enableResource&&typeof u.initResource=="function"&&u.initResource()),Object.defineProperty&&i.addEventListener&&Object.defineProperty(u,"pipe",{set:u.sendPipe}),u};return a.prototype=s.createObject(c.prototype),s.ext(c._root.dftCon,{uid:null,setUsername:null,ignoreUrlPath:null,ignoreApiPath:null,urlHelper:[{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},/\/$/],resourceHelper:[],apiHelper:{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},ignoreUrlCase:!0,imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",cdnHostList:[],resourceTypes:["css","script","img","font"],resourceSlow:2e3,disableHook:!1,autoSendPv:!0,autoSendPerf:!0,enableSPA:!1,enableLinkTrace:!1,linkType:"arms",enableApiCors:!1,sendResource:!0,behavior:!0,enableConsole:!1,parseHash:function(o){return(o?s.cutUrlSearch(o.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(o){if(!o||typeof o!="object")return{};var u=o.code,h=o.msg||o.message||o.subMsg||o.errorMsg||o.ret||o.errorResponse||"";return typeof h=="object"&&(u=u||h.code,h=h.msg||h.message||h.info||h.ret||JSON.stringify(h)),{msg:h,code:u,success:!0}}}),s.ext(a.prototype,{constructor:a,_super:c,onReady:function(o){var u=this;if(u.hasReady)return o();r.readyState==="complete"?(u.hasReady=!0,o()):s.on(i,"load",function(){u.hasReady=!0,o()},!0)},getPage:function(o){var u=this._conf,h=u.page,g=location,f=g.host+g.pathname;return h&&!o?s.safetyCall(h,[],h+""):this._initialPage||s.filterByRule(u.ignoreUrlCase?f.toLowerCase():f,g.href,u.ignoreUrlPath?u.ignoreUrlPath:u.urlHelper)},setPage:function(o,u){var h=this,g=h.prevPage;if(u!==!1){if(!o||o===g)return h;h.prevPage=o,clearTimeout(h.sendPVTimmer),h.handleUnload(1),h.resetPageview(),h.sendPVTimmer=setTimeout(function(){h.sendPV()},10)}else h.prevPage=o;return h._conf.page=o,h},setConfig:function(o,u){if(o&&typeof o=="object"){s.verifyConfig(o),o=this.setImgUrl(o);var h=this._conf;if(this._conf=s.ext({},h,o),!u){var g="disableHook";g in o&&h[g]!==o[g]&&(o[g]?this.removeHook():this.addHook()),(g="enableSPA")in o&&h[g]!==o[g]&&this.bindHashChange(o[g])}}},sendRequest:function(o){e(o,this.getConfig("imgUrl"))},postData:function(o,u){var h={};h[u]=o[u],delete o[u];var g="";typeof o=="object"&&(g=s.serialize(o)),t(h,this.getConfig("imgUrl")+g+"&post_res=")},sendPipe:function(o){var u=this;if(!o||!o.length)return u;try{if(s.T(o[0])==="Array")return s.each(o,function(g){return u.sendPipe(g)});if(s.T(o)!=="Array")return u;var h=o.shift();if(!n.test(h))return u;u[h].apply(u,o)}catch(g){return s.warn("[retcode] error in sendPipe",g),u}},sendHealth:function(){var o=s.ext({},this._health);o.healthy=o.errcount>0?0:1,o.begin=Date.now();var u=o.begin-this.sBegin;o.stay=u,this._lg("health",o,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(o){o=s.ext({pid:this._conf.pid},o);var u=this.__proto__.constructor(o);return o.page&&u.sendPV(),u}}),fo()(a,i),go()(a,i,r),bo()(a,i,r),vo()(a,i),xo()(a,i),So()(a,i),a._super=c,a._root=c._root,c.Browser=a,it.exports=a,it.exports}var sn;function yo(){if(sn)return pt.exports;sn=1;function s(a,o){var u=e[i]=new t(a);u.sendPipe(o);var h=u._conf;return h.autoSendPv!==!1&&u.sendPV(),h&&h.useFmp||u.sendPerformance(),h&&h.sendResource&&u.sendResources(),e[r]=!0,u}function c(){if(e[r])return e[i];var a={},o=[];return i in e&&(a=e[i].config||{},o=e[i].pipe||[]),s(a,o)}var e=window,t=e.BrowserLogger=_o(),i=$e().key,r="__hasInitBlSdk";t.singleton=function(a,o){return e[r]?e[i]:s(a,o)},t.createExtraInstance=function(a){a&&typeof a=="object"&&a.enableInstanceAutoSend!==!0&&(a.enableInstanceAutoSend=!1);var o=new t(a),u=o._conf;return u.enableInstanceAutoSend&&(u.autoSendPv!==!1&&o.sendPV(),u&&u.useFmp||o.sendPerformance(),u&&u.sendResource&&o.sendResources()),o};var n=typeof window=="object"&&!!window.navigator;return n&&e[i]&&(t.bl=c()),pt.exports=t,pt.exports}function Ao(){return yo()}var Eo={getArmsLogger:Ao};const nn="https://arms-retcode.aliyuncs.com/r.png?",an="https://arms-retcode-sg.aliyuncs.com/r.png?",on="https://retcode-us-west-1.arms.aliyuncs.com/r.png?",cn="e1iftji1w7@7ec1cef2cc88733",un="e1iftji1w7@10a06d1ec260adc",hn="e1iftji1w7@10a06d1ec260adc",hr={cn:{reportUrl:nn,pid:cn},"cn-hangzhou":{reportUrl:nn,pid:cn},sg:{reportUrl:an,pid:un},"ap-southeast-1":{reportUrl:an,pid:un},usw:{reportUrl:on,pid:hn},"us-west-1":{reportUrl:on,pid:hn}},dn=s=>s!==null&&typeof s=="object",wo=s=>Object.prototype.toString.call(s).slice(8,-1),ln=s=>Object.isExtensible(s)?wo(s)==="Object":!1;function Co(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,a){if(typeof a=="string"&&t.indexOf(a)>-1){let h;try{h=n[a]}catch(g){throw e(g),g}return At(h,c+1,e)}let o=()=>{};typeof n[a]=="function"&&(o=n[a].bind(n));const u={MediaboxWrapperObjectMethod(...h){let g;try{g=o(...h)}catch(f){throw e(f),f}return At(g,c+1,e)}};return typeof n[a]=="function"?u.MediaboxWrapperObjectMethod:c>10?n[a]:At(n[a],c+1,e)},MediaboxWrapperObjectSetter(n,a,o){return n[a]=At(o,c+1,e),!0}};return new Proxy(s,{get:r.MediaboxWrapperObjectGetter,set:r.MediaboxWrapperObjectSetter})}function Io(s,c,e){const t={MediaboxWrapperFunctionApply(i,r,n){let a;try{a=i.apply(r,n),dn(a)&&ln(a)&&(a.__v_skip=!0)}catch(o){throw e(o),o}return At(a,c+1,e)},MediaboxWrapperFunctionGet(i,r){const n=Object.getOwnPropertyDescriptor(i,r);return n&&!n.writable&&!n.configurable?i[r]:At(i[r],c+1,e)},MediaboxWrapperClassConstructor(i,r){let n;try{n=new i(...r),n.__v_skip=!0}catch(a){throw e(a),a}return At(n,c+1,e)}};return new Proxy(s,{apply:t.MediaboxWrapperFunctionApply,get:t.MediaboxWrapperFunctionGet,construct:t.MediaboxWrapperClassConstructor})}const jt="-c-";function Ro(s){if(typeof s!="string")return jt;if(dr(s))return s;const c=s.indexOf(`
5
5
  `);return c<0?`${s}${jt}`:`${s.slice(0,c)}${jt}${s.slice(c)}`}function Do(s){return typeof s!="string"?"":dr(s)?s.replace(jt,""):s}function dr(s){if(typeof s!="string")return!1;const c=s.indexOf(jt);if(c<0)return!1;const e=s.indexOf(`
6
- `);return e<0?c===s.length-jt.length:c===e-jt.length}function At(s,c,e){return typeof s=="function"?Io(s,c+1,e):s instanceof Promise?s.then(t=>At(t,c+1,e)).catch(t=>(e(t),Promise.reject(t))):Array.isArray(s)?s.map(t=>At(t,c+1,e)):dn(s)&&ln(s)?Co(s,c+1,e):s}function To(s){return typeof s!="string"?!1:s.indexOf("g.alicdn.com/apsara-media-")>-1||s.indexOf("g.alicdn.com/thor-server")>-1}function fn(s){return typeof s!="string"?!1:s.indexOf("g.alicdn.com/apsara-media-")>-1||s.indexOf("g.alicdn.com/thor-server")>-1||s.indexOf("MediaboxWrapper")>-1}class pn extends Error{constructor(c){super(c),this.name="MQTError"}}class lr{constructor(c){ht(this,"armsLogger"),ht(this,"isReady",!1),ht(this,"isDestroyed",!1),ht(this,"options"),ht(this,"queue",[]),ht(this,"helper",{MediaboxWrapperQueue(n){return new pn(n)},MediaboxWrapperInitiative(n){return new pn(n)}}),this.options=c;const{region:e="cn",env:t="prod"}=c;if(!hr[e])throw new Error(`region ${e} is not supported`);const i=n=>{var a;if(this.isDestroyed||dr(n.stack)||n.t!=="pv"&&n.t!=="error")return!1;if(n.c1=(a=this.options.cid)!=null?a:window.location.host,n.c2=lr.version,this.options.customData&&(n.c3=new URLSearchParams(this.options.customData).toString()),n.t==="error"){if(To(n.file)||fn(n.stack)){let o=n;return this.options.beforeSend&&(o=this.options.beforeSend(n)),this.isReady?o:(o&&this.queue.push(o),!1)}return!1}return n},r=Eo.getArmsLogger();this.armsLogger=r.createExtraInstance({enableInstanceAutoSend:!0,pid:hr[e].pid,tag:c.businessName,release:`${c.businessName}_${c.version}`,imgUrl:hr[e].reportUrl,behavior:!0,sample:1,disableHook:!0,environment:t,beforeReport:i})}static get version(){return"0.19.0"}wrap(c){return this.options.disabled||typeof Proxy>"u"?c:At(c,0,e=>{e instanceof Error&&typeof e.stack=="string"&&fn(e.stack)&&(e.stack=Do(e.stack),this.armsLogger.error(e),e.stack=Ro(e.stack))})}updateOptions(c){this.options=ve(ve({},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 Re=(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))(Re||{}),rt=(s=>(s.Local="local-device-status-change",s.Remote="remote-device-status-change",s))(rt||{}),G=(s=>(s.Audio="sophon_audio",s.VideoLarge="sophon_video_camera_large",s.VideoSmall="sophon_video_camera_small",s.Screen="sophon_video_screen_share",s.Data="sophon_data",s))(G||{}),fr=(s=>(s.Audio="rts audio",s.VideoLarge="rts video",s))(fr||{}),Wt=(s=>(s.Add="add",s.Delete="delete",s.Replace="replace",s.Stop="stop",s.UnPublish="unpublish",s))(Wt||{}),ni=(s=>(s[s.Camera=0]="Camera",s[s.Screen=1]="Screen",s[s.Image=2]="Image",s))(ni||{}),Pi=(s=>(s[s.Microphone=0]="Microphone",s[s.Screen=1]="Screen",s[s.Mixed=2]="Mixed",s))(Pi||{}),Be=(s=>(s.InRoom="inRoom",s.Join="join",s.Publish="publish",s.User="user",s.Resume="resume",s.Retry="retry",s.Reconnect="reconnect",s))(Be||{}),Bt=(s=>(s[s.MANUAL=0]="MANUAL",s[s.JOIN_CHANNEL=1]="JOIN_CHANNEL",s[s.ROLE_CHANGE=2]="ROLE_CHANGE",s))(Bt||{}),Ze=[],pr=0;pr<256;++pr)Ze.push((pr+256).toString(16).slice(1));function ko(s,c=0){return(Ze[s[c+0]]+Ze[s[c+1]]+Ze[s[c+2]]+Ze[s[c+3]]+"-"+Ze[s[c+4]]+Ze[s[c+5]]+"-"+Ze[s[c+6]]+Ze[s[c+7]]+"-"+Ze[s[c+8]]+Ze[s[c+9]]+"-"+Ze[s[c+10]]+Ze[s[c+11]]+Ze[s[c+12]]+Ze[s[c+13]]+Ze[s[c+14]]+Ze[s[c+15]]).toLowerCase()}var Bi,Po=new Uint8Array(16);function Bo(){if(!Bi&&(Bi=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Bi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Bi(Po)}var Lo=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const mn={randomUUID:Lo};function Kt(s,c,e){if(mn.randomUUID&&!c&&!s)return mn.randomUUID();s=s||{};var t=s.random||(s.rng||Bo)();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 ko(t)}var Li=(s=>(s.prod="rs.rtn.aliyuncs.com",s.pre="prs.rtn.aliyuncs.com",s))(Li||{});const mr="6.13.2-beta.0",gn="web";class St{static getVersionNumber(){let c=mr.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=Kt();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 O(this,null,function*(){const c=Li.prod,{onLine:e}=navigator;if(!e)return!1;try{return yield fetch(`https://${c}/roomserver/v1/ws/version`),!0}catch(t){return!1}})}}var _e=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function bn(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Mo(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 gi(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 vn={exports:{}};/*!
6
+ `);return e<0?c===s.length-jt.length:c===e-jt.length}function At(s,c,e){return typeof s=="function"?Io(s,c+1,e):s instanceof Promise?s.then(t=>At(t,c+1,e)).catch(t=>(e(t),Promise.reject(t))):Array.isArray(s)?s.map(t=>At(t,c+1,e)):dn(s)&&ln(s)?Co(s,c+1,e):s}function To(s){return typeof s!="string"?!1:s.indexOf("g.alicdn.com/apsara-media-")>-1||s.indexOf("g.alicdn.com/thor-server")>-1}function fn(s){return typeof s!="string"?!1:s.indexOf("g.alicdn.com/apsara-media-")>-1||s.indexOf("g.alicdn.com/thor-server")>-1||s.indexOf("MediaboxWrapper")>-1}class pn extends Error{constructor(c){super(c),this.name="MQTError"}}class lr{constructor(c){ht(this,"armsLogger"),ht(this,"isReady",!1),ht(this,"isDestroyed",!1),ht(this,"options"),ht(this,"queue",[]),ht(this,"helper",{MediaboxWrapperQueue(n){return new pn(n)},MediaboxWrapperInitiative(n){return new pn(n)}}),this.options=c;const{region:e="cn",env:t="prod"}=c;if(!hr[e])throw new Error(`region ${e} is not supported`);const i=n=>{var a;if(this.isDestroyed||dr(n.stack)||n.t!=="pv"&&n.t!=="error")return!1;if(n.c1=(a=this.options.cid)!=null?a:window.location.host,n.c2=lr.version,this.options.customData&&(n.c3=new URLSearchParams(this.options.customData).toString()),n.t==="error"){if(To(n.file)||fn(n.stack)){let o=n;return this.options.beforeSend&&(o=this.options.beforeSend(n)),this.isReady?o:(o&&this.queue.push(o),!1)}return!1}return n},r=Eo.getArmsLogger();this.armsLogger=r.createExtraInstance({enableInstanceAutoSend:!0,pid:hr[e].pid,tag:c.businessName,release:`${c.businessName}_${c.version}`,imgUrl:hr[e].reportUrl,behavior:!0,sample:1,disableHook:!0,environment:t,beforeReport:i})}static get version(){return"0.19.0"}wrap(c){return this.options.disabled||typeof Proxy>"u"?c:At(c,0,e=>{e instanceof Error&&typeof e.stack=="string"&&fn(e.stack)&&(e.stack=Do(e.stack),this.armsLogger.error(e),e.stack=Ro(e.stack))})}updateOptions(c){this.options=ve(ve({},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 Re=(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))(Re||{}),rt=(s=>(s.Local="local-device-status-change",s.Remote="remote-device-status-change",s))(rt||{}),G=(s=>(s.Audio="sophon_audio",s.VideoLarge="sophon_video_camera_large",s.VideoSmall="sophon_video_camera_small",s.Screen="sophon_video_screen_share",s.Data="sophon_data",s))(G||{}),fr=(s=>(s.Audio="rts audio",s.VideoLarge="rts video",s))(fr||{}),Wt=(s=>(s.Add="add",s.Delete="delete",s.Replace="replace",s.Stop="stop",s.UnPublish="unpublish",s))(Wt||{}),ni=(s=>(s[s.Camera=0]="Camera",s[s.Screen=1]="Screen",s[s.Image=2]="Image",s))(ni||{}),Pi=(s=>(s[s.Microphone=0]="Microphone",s[s.Screen=1]="Screen",s[s.Mixed=2]="Mixed",s))(Pi||{}),Be=(s=>(s.InRoom="inRoom",s.Join="join",s.Publish="publish",s.User="user",s.Resume="resume",s.Retry="retry",s.Reconnect="reconnect",s))(Be||{}),Bt=(s=>(s[s.MANUAL=0]="MANUAL",s[s.JOIN_CHANNEL=1]="JOIN_CHANNEL",s[s.ROLE_CHANGE=2]="ROLE_CHANGE",s))(Bt||{}),Ye=[],pr=0;pr<256;++pr)Ye.push((pr+256).toString(16).slice(1));function ko(s,c=0){return(Ye[s[c+0]]+Ye[s[c+1]]+Ye[s[c+2]]+Ye[s[c+3]]+"-"+Ye[s[c+4]]+Ye[s[c+5]]+"-"+Ye[s[c+6]]+Ye[s[c+7]]+"-"+Ye[s[c+8]]+Ye[s[c+9]]+"-"+Ye[s[c+10]]+Ye[s[c+11]]+Ye[s[c+12]]+Ye[s[c+13]]+Ye[s[c+14]]+Ye[s[c+15]]).toLowerCase()}var Bi,Po=new Uint8Array(16);function Bo(){if(!Bi&&(Bi=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Bi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Bi(Po)}var Lo=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const mn={randomUUID:Lo};function Kt(s,c,e){if(mn.randomUUID&&!c&&!s)return mn.randomUUID();s=s||{};var t=s.random||(s.rng||Bo)();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 ko(t)}var Li=(s=>(s.prod="rs.rtn.aliyuncs.com",s.pre="prs.rtn.aliyuncs.com",s))(Li||{});const mr="6.13.2-beta.2",gn="web";class St{static getVersionNumber(){let c=mr.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=Kt();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 O(this,null,function*(){const c=Li.prod,{onLine:e}=navigator;if(!e)return!1;try{return yield fetch(`https://${c}/roomserver/v1/ws/version`),!0}catch(t){return!1}})}}var _e=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function bn(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Mo(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 gi(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 vn={exports:{}};/*!
7
7
 
8
8
  JSZip v3.10.1 - A JavaScript class for generating and reading zip files
9
9
  <http://stuartk.com/jszip>
@@ -13,8 +13,8 @@ var vu=Object.defineProperty,xu=Object.defineProperties;var Su=Object.getOwnProp
13
13
 
14
14
  JSZip uses the library pako released under the MIT license :
15
15
  https://github.com/nodeca/pako/blob/main/LICENSE
16
- */(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 gi=="function"&&gi;if(!h&&g)return g(u,!0);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var l=i[u]={exports:{}};t[u][0].call(l.exports,function(p){var d=t[u][1][p];return n(d||p)},l,l.exports,e,t,i,r)}return i[u].exports}for(var a=typeof gi=="function"&&gi,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(o){for(var u,h,g,f,l,p,d,m=[],v=0,b=o.length,x=b,y=r.getTypeOf(o)!=="string";v<o.length;)x=b-v,g=y?(u=o[v++],h=v<b?o[v++]:0,v<b?o[v++]:0):(u=o.charCodeAt(v++),h=v<b?o.charCodeAt(v++):0,v<b?o.charCodeAt(v++):0),f=u>>2,l=(3&u)<<4|h>>4,p=1<x?(15&h)<<2|g>>6:64,d=2<x?63&g:64,m.push(a.charAt(f)+a.charAt(l)+a.charAt(p)+a.charAt(d));return m.join("")},i.decode=function(o){var u,h,g,f,l,p,d=0,m=0,v="data:";if(o.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var b,x=3*(o=o.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(o.charAt(o.length-1)===a.charAt(64)&&x--,o.charAt(o.length-2)===a.charAt(64)&&x--,x%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=n.uint8array?new Uint8Array(0|x):new Array(0|x);d<o.length;)u=a.indexOf(o.charAt(d++))<<2|(f=a.indexOf(o.charAt(d++)))>>4,h=(15&f)<<4|(l=a.indexOf(o.charAt(d++)))>>2,g=(3&l)<<6|(p=a.indexOf(o.charAt(d++))),b[m++]=u,l!==64&&(b[m++]=h),p!==64&&(b[m++]=g);return b}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function u(h,g,f,l,p){this.compressedSize=h,this.uncompressedSize=g,this.crc32=f,this.compression=l,this.compressedContent=p}u.prototype={getContentWorker:function(){var h=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("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 a).pipe(new o("uncompressedSize")).pipe(g.compressWorker(f)).pipe(new o("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 a,o=[],u=0;u<256;u++){a=u;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;o[u]=a}return o}();t.exports=function(a,o){return a!==void 0&&a.length?r.getTypeOf(a)!=="string"?function(u,h,g,f){var l=n,p=f+g;u^=-1;for(var d=f;d<p;d++)u=u>>>8^l[255&(u^h[d])];return-1^u}(0|o,a,a.length,0):function(u,h,g,f){var l=n,p=f+g;u^=-1;for(var d=f;d<p;d++)u=u>>>8^l[255&(u^h.charCodeAt(d))];return-1^u}(0|o,a,a.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"),a=e("./utils"),o=e("./stream/GenericWorker"),u=r?"uint8array":"array";function h(g,f){o.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(h,o),h.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,g.data),!1)},h.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var 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(l,p){var d,m="";for(d=0;d<p;d++)m+=String.fromCharCode(255&l),l>>>=8;return m}function n(l,p,d,m,v,b){var x,y,E=l.file,I=l.compression,w=b!==u.utf8encode,R=a.transformTo("string",b(E.name)),L=a.transformTo("string",u.utf8encode(E.name)),D=E.comment,N=a.transformTo("string",b(D)),C=a.transformTo("string",u.utf8encode(D)),M=L.length!==E.name.length,A=C.length!==D.length,U="",ie="",q="",oe=E.dir,$=E.date,se={crc32:0,compressedSize:0,uncompressedSize:0};p&&!d||(se.crc32=l.crc32,se.compressedSize=l.compressedSize,se.uncompressedSize=l.uncompressedSize);var k=0;p&&(k|=8),w||!M&&!A||(k|=2048);var P=0,z=0;oe&&(P|=16),v==="UNIX"?(z=798,P|=function(K,Q){var ge=K;return K||(ge=Q?16893:33204),(65535&ge)<<16}(E.unixPermissions,oe)):(z=20,P|=function(K){return 63&(K||0)}(E.dosPermissions)),x=$.getUTCHours(),x<<=6,x|=$.getUTCMinutes(),x<<=5,x|=$.getUTCSeconds()/2,y=$.getUTCFullYear()-1980,y<<=4,y|=$.getUTCMonth()+1,y<<=5,y|=$.getUTCDate(),M&&(ie=r(1,1)+r(h(R),4)+L,U+="up"+r(ie.length,2)+ie),A&&(q=r(1,1)+r(h(N),4)+C,U+="uc"+r(q.length,2)+q);var F="";return F+=`
17
- \0`,F+=r(k,2),F+=I.magic,F+=r(x,2),F+=r(y,2),F+=r(se.crc32,4),F+=r(se.compressedSize,4),F+=r(se.uncompressedSize,4),F+=r(R.length,2),F+=r(U.length,2),{fileRecord:g.LOCAL_FILE_HEADER+F+R+U,dirRecord:g.CENTRAL_FILE_HEADER+r(z,2)+F+r(N.length,2)+"\0\0\0\0"+r(P,4)+r(m,4)+R+U+N}}var a=e("../utils"),o=e("../stream/GenericWorker"),u=e("../utf8"),h=e("../crc32"),g=e("../signature");function f(l,p,d,m){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=d,this.encodeFileName=m,this.streamFiles=l,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,o),f.prototype.push=function(l){var p=l.meta.percent||0,d=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(l):(this.bytesWritten+=l.data.length,o.prototype.push.call(this,{data:l.data,meta:{currentFile:this.currentFile,percent:d?(p+100*(d-m-1))/d:100}}))},f.prototype.openedSource=function(l){this.currentSourceOffset=this.bytesWritten,this.currentFile=l.file.name;var p=this.streamFiles&&!l.file.dir;if(p){var d=n(l,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(l){this.accumulate=!1;var p=this.streamFiles&&!l.file.dir,d=n(l,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),p)this.push({data:function(m){return g.DATA_DESCRIPTOR+r(m.crc32,4)+r(m.compressedSize,4)+r(m.uncompressedSize,4)}(l),meta:{percent:100}});else for(this.push({data:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var l=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var d=this.bytesWritten-l,m=function(v,b,x,y,E){var I=a.transformTo("string",E(y));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(v,2)+r(v,2)+r(b,4)+r(x,4)+r(I.length,2)+I}(this.dirRecords.length,d,l,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(l){this._sources.push(l);var p=this;return l.on("data",function(d){p.processChunk(d)}),l.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),l.on("error",function(d){p.error(d)}),this},f.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(l){var p=this._sources;if(!o.prototype.error.call(this,l))return!1;for(var d=0;d<p.length;d++)try{p[d].error(l)}catch(m){}return!0},f.prototype.lock=function(){o.prototype.lock.call(this);for(var l=this._sources,p=0;p<l.length;p++)l[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(a,o,u){var h=new n(o.streamFiles,u,o.platform,o.encodeFileName),g=0;try{a.forEach(function(f,l){g++;var p=function(b,x){var y=b||x,E=r[y];if(!E)throw new Error(y+" is not a valid compression method !");return E}(l.options.compression,o.compression),d=l.options.compressionOptions||o.compressionOptions||{},m=l.dir,v=l.date;l._compressWorker(p,d).withStreamInfo("file",{name:f,dir:m,date:v,comment:l.comment||"",unixPermissions:l.unixPermissions,dosPermissions:l.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 a in this)typeof this[a]!="function"&&(n[a]=this[a]);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,a){return new r().loadAsync(n,a)},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"),a=e("./utf8"),o=e("./zipEntries"),u=e("./stream/Crc32Probe"),h=e("./nodejsUtils");function g(f){return new n.Promise(function(l,p){var d=f.decompressed.getContentWorker().pipe(new u);d.on("error",function(m){p(m)}).on("end",function(){d.streamInfo.crc32!==f.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):l()}).resume()})}t.exports=function(f,l){var p=this;return l=r.extend(l||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(f)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",f,!0,l.optimizedBinaryString,l.base64).then(function(d){var m=new o(l);return m.load(d),m}).then(function(d){var m=[n.Promise.resolve(d)],v=d.files;if(l.checkCRC32)for(var b=0;b<v.length;b++)m.push(g(v[b]));return n.Promise.all(m)}).then(function(d){for(var m=d.shift(),v=m.files,b=0;b<v.length;b++){var x=v[b],y=x.fileNameStr,E=r.resolve(x.fileNameStr);p.file(E,x.decompressed,{binary:!0,optimizedBinaryString:!0,date:x.date,dir:x.dir,comment:x.fileCommentStr.length?x.fileCommentStr:null,unixPermissions:x.unixPermissions,dosPermissions:x.dosPermissions,createFolders:l.createFolders}),x.dir||(p.file(E).unsafeOriginalName=y)}return m.zipComment.length&&(p.comment=m.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function a(o,u){n.call(this,"Nodejs stream input adapter for "+o),this._upstreamEnded=!1,this._bindStream(u)}r.inherits(a,n),a.prototype._bindStream=function(o){var u=this;(this._stream=o).pause(),o.on("data",function(h){u.push({data:h,meta:{percent:0}})}).on("error",function(h){u.isPaused?this.generatedError=h:u.error(h)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(a,o,u){r.call(this,o),this._helper=a;var h=this;a.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(E,I,w){var R,L=a.getTypeOf(I),D=a.extend(w||{},h);D.date=D.date||new Date,D.compression!==null&&(D.compression=D.compression.toUpperCase()),typeof D.unixPermissions=="string"&&(D.unixPermissions=parseInt(D.unixPermissions,8)),D.unixPermissions&&16384&D.unixPermissions&&(D.dir=!0),D.dosPermissions&&16&D.dosPermissions&&(D.dir=!0),D.dir&&(E=v(E)),D.createFolders&&(R=m(E))&&b.call(this,R,!0);var N=L==="string"&&D.binary===!1&&D.base64===!1;w&&w.binary!==void 0||(D.binary=!N),(I instanceof g&&I.uncompressedSize===0||D.dir||!I||I.length===0)&&(D.base64=!1,D.binary=!0,I="",D.compression="STORE",L="string");var C=null;C=I instanceof g||I instanceof o?I:p.isNode&&p.isStream(I)?new d(E,I):a.prepareContent(E,I,D.binary,D.optimizedBinaryString,D.base64);var M=new f(E,C,D);this.files[E]=M}var n=e("./utf8"),a=e("./utils"),o=e("./stream/GenericWorker"),u=e("./stream/StreamHelper"),h=e("./defaults"),g=e("./compressedObject"),f=e("./zipObject"),l=e("./generate"),p=e("./nodejsUtils"),d=e("./nodejs/NodejsStreamInputAdapter"),m=function(E){E.slice(-1)==="/"&&(E=E.substring(0,E.length-1));var I=E.lastIndexOf("/");return 0<I?E.substring(0,I):""},v=function(E){return E.slice(-1)!=="/"&&(E+="/"),E},b=function(E,I){return I=I!==void 0?I:h.createFolders,E=v(E),this.files[E]||r.call(this,E,null,{dir:!0,createFolders:I}),this.files[E]};function x(E){return Object.prototype.toString.call(E)==="[object RegExp]"}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(E){var I,w,R;for(I in this.files)R=this.files[I],(w=I.slice(this.root.length,I.length))&&I.slice(0,this.root.length)===this.root&&E(w,R)},filter:function(E){var I=[];return this.forEach(function(w,R){E(w,R)&&I.push(R)}),I},file:function(E,I,w){if(arguments.length!==1)return E=this.root+E,r.call(this,E,I,w),this;if(x(E)){var R=E;return this.filter(function(D,N){return!N.dir&&R.test(D)})}var L=this.files[this.root+E];return L&&!L.dir?L:null},folder:function(E){if(!E)return this;if(x(E))return this.filter(function(L,D){return D.dir&&E.test(L)});var I=this.root+E,w=b.call(this,I),R=this.clone();return R.root=w.name,R},remove:function(E){E=this.root+E;var I=this.files[E];if(I||(E.slice(-1)!=="/"&&(E+="/"),I=this.files[E]),I&&!I.dir)delete this.files[E];else for(var w=this.filter(function(L,D){return D.name.slice(0,E.length)===E}),R=0;R<w.length;R++)delete this.files[w[R].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(E){var I,w={};try{if((w=a.extend(E||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=w.type.toLowerCase(),w.compression=w.compression.toUpperCase(),w.type==="binarystring"&&(w.type="string"),!w.type)throw new Error("No output type specified.");a.checkSupport(w.type),w.platform!=="darwin"&&w.platform!=="freebsd"&&w.platform!=="linux"&&w.platform!=="sunos"||(w.platform="UNIX"),w.platform==="win32"&&(w.platform="DOS");var R=w.comment||this.comment||"";I=l.generateWorker(this,w,R)}catch(L){(I=new o("error")).error(L)}return new u(I,w.type||"string",w.mimeType)},generateAsync:function(E,I){return this.generateInternalStream(E).accumulate(I)},generateNodeStream:function(E,I){return(E=E||{}).type||(E.type="nodebuffer"),this.generateInternalStream(E).toNodejsStream(I)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(a){r.call(this,a);for(var o=0;o<this.data.length;o++)a[o]=255&a[o]}e("../utils").inherits(n,r),n.prototype.byteAt=function(a){return this.data[this.zero+a]},n.prototype.lastIndexOfSignature=function(a){for(var o=a.charCodeAt(0),u=a.charCodeAt(1),h=a.charCodeAt(2),g=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===o&&this.data[f+1]===u&&this.data[f+2]===h&&this.data[f+3]===g)return f-this.zero;return-1},n.prototype.readAndCheckSignature=function(a){var o=a.charCodeAt(0),u=a.charCodeAt(1),h=a.charCodeAt(2),g=a.charCodeAt(3),f=this.readData(4);return o===f[0]&&u===f[1]&&h===f[2]&&g===f[3]},n.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var o,u=0;for(this.checkOffset(a),o=this.index+a-1;o>=this.index;o--)u=(u<<8)+this.byteAt(o);return this.index+=a,u},readString:function(a){return r.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(a){r.call(this,a)}e("../utils").inherits(n,r),n.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(a){r.call(this,a)}e("../utils").inherits(n,r),n.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},n.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},n.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},n.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(a){r.call(this,a)}e("../utils").inherits(n,r),n.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var o=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),a=e("./ArrayReader"),o=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 a(r.transformTo("array",g)):new o(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 a(o){r.call(this,"ConvertWorker to "+o),this.destType=o}n.inherits(a,r),a.prototype.processChunk=function(o){this.push({data:n.transformTo(this.destType,o.data),meta:o.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(o){this.streamInfo.crc32=n(o.data,this.streamInfo.crc32||0),this.push(o)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(o){n.call(this,"DataLengthProbe for "+o),this.propName=o,this.withStreamInfo(o,0)}r.inherits(a,n),a.prototype.processChunk=function(o){if(o){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+o.data.length}n.prototype.processChunk.call(this,o)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(o){n.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,o.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=r.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}r.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var o=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":o=this.data.substring(this.index,u);break;case"uint8array":o=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":o=this.data.slice(this.index,u)}return this.index=u,this.push({data:o,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,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,a){return this._listeners[n].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(n,a){if(this._listeners[n])for(var o=0;o<this._listeners[n].length;o++)this._listeners[n][o].call(this,a)},pipe:function(n){return n.registerPrevious(this)},registerPrevious:function(n){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=n.streamInfo,this.mergeStreamInfo(),this.previous=n;var a=this;return n.on("data",function(o){a.processChunk(o)}),n.on("end",function(){a.end()}),n.on("error",function(o){a.error(o)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var n=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),n=!0),this.previous&&this.previous.resume(),!n},flush:function(){},processChunk:function(n){this.push(n)},withStreamInfo:function(n,a){return this.extraStreamInfo[n]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var n in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,n)&&(this.streamInfo[n]=this.extraStreamInfo[n])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var n="Worker "+this.name;return this.previous?this.previous+" -> "+n:n}},t.exports=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),u=e("../support"),h=e("../external"),g=null;if(u.nodestream)try{g=e("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function f(p,d){return new h.Promise(function(m,v){var b=[],x=p._internalType,y=p._outputType,E=p._mimeType;p.on("data",function(I,w){b.push(I),d&&d(w)}).on("error",function(I){b=[],v(I)}).on("end",function(){try{var I=function(w,R,L){switch(w){case"blob":return r.newBlob(r.transformTo("arraybuffer",R),L);case"base64":return o.encode(R);default:return r.transformTo(w,R)}}(y,function(w,R){var L,D=0,N=null,C=0;for(L=0;L<R.length;L++)C+=R[L].length;switch(w){case"string":return R.join("");case"array":return Array.prototype.concat.apply([],R);case"uint8array":for(N=new Uint8Array(C),L=0;L<R.length;L++)N.set(R[L],D),D+=R[L].length;return N;case"nodebuffer":return Buffer.concat(R);default:throw new Error("concat : unsupported type '"+w+"'")}}(x,b),E);m(I)}catch(w){v(w)}b=[]}).resume()})}function l(p,d,m){var v=d;switch(d){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=d,this._mimeType=m,r.checkSupport(v),this._worker=p.pipe(new n(v)),p.lock()}catch(b){this._worker=new a("error"),this._worker.error(b)}}l.prototype={accumulate:function(p){return f(this,p)},on:function(p,d){var m=this;return p==="data"?this._worker.on(p,function(v){d.call(m,v.data,v.meta)}):this._worker.on(p,function(){r.delay(d,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=l},{"../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(a){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=n.getBlob("application/zip").size===0}catch(o){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(a){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),u=new Array(256),h=0;h<256;h++)u[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;u[254]=u[254]=1;function g(){o.call(this,"utf-8 decode"),this.leftOver=null}function f(){o.call(this,"utf-8 encode")}i.utf8encode=function(l){return n.nodebuffer?a.newBufferFrom(l,"utf-8"):function(p){var d,m,v,b,x,y=p.length,E=0;for(b=0;b<y;b++)(64512&(m=p.charCodeAt(b)))==55296&&b+1<y&&(64512&(v=p.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(v-56320),b++),E+=m<128?1:m<2048?2:m<65536?3:4;for(d=n.uint8array?new Uint8Array(E):new Array(E),b=x=0;x<E;b++)(64512&(m=p.charCodeAt(b)))==55296&&b+1<y&&(64512&(v=p.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(v-56320),b++),m<128?d[x++]=m:(m<2048?d[x++]=192|m>>>6:(m<65536?d[x++]=224|m>>>12:(d[x++]=240|m>>>18,d[x++]=128|m>>>12&63),d[x++]=128|m>>>6&63),d[x++]=128|63&m);return d}(l)},i.utf8decode=function(l){return n.nodebuffer?r.transformTo("nodebuffer",l).toString("utf-8"):function(p){var d,m,v,b,x=p.length,y=new Array(2*x);for(d=m=0;d<x;)if((v=p[d++])<128)y[m++]=v;else if(4<(b=u[v]))y[m++]=65533,d+=b-1;else{for(v&=b===2?31:b===3?15:7;1<b&&d<x;)v=v<<6|63&p[d++],b--;1<b?y[m++]=65533:v<65536?y[m++]=v:(v-=65536,y[m++]=55296|v>>10&1023,y[m++]=56320|1023&v)}return y.length!==m&&(y.subarray?y=y.subarray(0,m):y.length=m),r.applyFromCharCode(y)}(l=r.transformTo(n.uint8array?"uint8array":"array",l))},r.inherits(g,o),g.prototype.processChunk=function(l){var p=r.transformTo(n.uint8array?"uint8array":"array",l.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var d=p;(p=new Uint8Array(d.length+this.leftOver.length)).set(this.leftOver,0),p.set(d,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var m=function(b,x){var y;for((x=x||b.length)>b.length&&(x=b.length),y=x-1;0<=y&&(192&b[y])==128;)y--;return y<0||y===0?x:y+u[b[y]]>x?y:x}(p),v=p;m!==p.length&&(n.uint8array?(v=p.subarray(0,m),this.leftOver=p.subarray(m,p.length)):(v=p.slice(0,m),this.leftOver=p.slice(m,p.length))),this.push({data:i.utf8decode(v),meta:l.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,o),f.prototype.processChunk=function(l){this.push({data:i.utf8encode(l.data),meta:l.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"),a=e("./nodejsUtils"),o=e("./external");function u(d){return d}function h(d,m){for(var v=0;v<d.length;++v)m[v]=255&d.charCodeAt(v);return m}e("setimmediate"),i.newBlob=function(d,m){i.checkSupport("blob");try{return new Blob([d],{type:m})}catch(b){try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(d),v.getBlob(m)}catch(x){throw new Error("Bug : can't construct the Blob.")}}};var g={stringifyByChunk:function(d,m,v){var b=[],x=0,y=d.length;if(y<=v)return String.fromCharCode.apply(null,d);for(;x<y;)m==="array"||m==="nodebuffer"?b.push(String.fromCharCode.apply(null,d.slice(x,Math.min(x+v,y)))):b.push(String.fromCharCode.apply(null,d.subarray(x,Math.min(x+v,y)))),x+=v;return b.join("")},stringifyByChar:function(d){for(var m="",v=0;v<d.length;v++)m+=String.fromCharCode(d[v]);return m},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(d){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch(d){return!1}}()}};function f(d){var m=65536,v=i.getTypeOf(d),b=!0;if(v==="uint8array"?b=g.applyCanBeUsed.uint8array:v==="nodebuffer"&&(b=g.applyCanBeUsed.nodebuffer),b)for(;1<m;)try{return g.stringifyByChunk(d,v,m)}catch(x){m=Math.floor(m/2)}return g.stringifyByChar(d)}function l(d,m){for(var v=0;v<d.length;v++)m[v]=d[v];return m}i.applyFromCharCode=f;var p={};p.string={string:u,array:function(d){return h(d,new Array(d.length))},arraybuffer:function(d){return p.string.uint8array(d).buffer},uint8array:function(d){return h(d,new Uint8Array(d.length))},nodebuffer:function(d){return h(d,a.allocBuffer(d.length))}},p.array={string:f,array:u,arraybuffer:function(d){return new Uint8Array(d).buffer},uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return a.newBufferFrom(d)}},p.arraybuffer={string:function(d){return f(new Uint8Array(d))},array:function(d){return l(new Uint8Array(d),new Array(d.byteLength))},arraybuffer:u,uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return a.newBufferFrom(new Uint8Array(d))}},p.uint8array={string:f,array:function(d){return l(d,new Array(d.length))},arraybuffer:function(d){return d.buffer},uint8array:u,nodebuffer:function(d){return a.newBufferFrom(d)}},p.nodebuffer={string:f,array:function(d){return l(d,new Array(d.length))},arraybuffer:function(d){return p.nodebuffer.uint8array(d).buffer},uint8array:function(d){return l(d,new Uint8Array(d.length))},nodebuffer:u},i.transformTo=function(d,m){if(m=m||"",!d)return m;i.checkSupport(d);var v=i.getTypeOf(m);return p[v][d](m)},i.resolve=function(d){for(var m=d.split("/"),v=[],b=0;b<m.length;b++){var x=m[b];x==="."||x===""&&b!==0&&b!==m.length-1||(x===".."?v.pop():v.push(x))}return v.join("/")},i.getTypeOf=function(d){return typeof d=="string"?"string":Object.prototype.toString.call(d)==="[object Array]"?"array":r.nodebuffer&&a.isBuffer(d)?"nodebuffer":r.uint8array&&d instanceof Uint8Array?"uint8array":r.arraybuffer&&d instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(d){if(!r[d.toLowerCase()])throw new Error(d+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(d){var m,v,b="";for(v=0;v<(d||"").length;v++)b+="\\x"+((m=d.charCodeAt(v))<16?"0":"")+m.toString(16).toUpperCase();return b},i.delay=function(d,m,v){setImmediate(function(){d.apply(v||null,m||[])})},i.inherits=function(d,m){function v(){}v.prototype=m.prototype,d.prototype=new v},i.extend=function(){var d,m,v={};for(d=0;d<arguments.length;d++)for(m in arguments[d])Object.prototype.hasOwnProperty.call(arguments[d],m)&&v[m]===void 0&&(v[m]=arguments[d][m]);return v},i.prepareContent=function(d,m,v,b,x){return o.Promise.resolve(m).then(function(y){return r.blob&&(y instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(y))!==-1)&&typeof FileReader!="undefined"?new o.Promise(function(E,I){var w=new FileReader;w.onload=function(R){E(R.target.result)},w.onerror=function(R){I(R.target.error)},w.readAsArrayBuffer(y)}):y}).then(function(y){var E=i.getTypeOf(y);return E?(E==="arraybuffer"?y=i.transformTo("uint8array",y):E==="string"&&(x?y=n.decode(y):v&&b!==!0&&(y=function(I){return h(I,r.uint8array?new Uint8Array(I.length):new Array(I.length))}(y))),y):o.Promise.reject(new Error("Can't read the data of '"+d+"'. 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"),a=e("./signature"),o=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 l=this.reader.index;this.reader.setIndex(g);var p=this.reader.readString(4)===f;return this.reader.setIndex(l),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",l=n.transformTo(f,g);this.zipComment=this.loadOptions.decodeFileName(l)},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,l,p=this.zip64EndOfCentralSize-44;0<p;)g=this.reader.readInt(2),f=this.reader.readInt(4),l=this.reader.readData(f),this.zip64ExtensibleData[g]={id:g,length:f,value:l}},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(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(g=new o({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(a.CENTRAL_DIRECTORY_END);if(g<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(g);var f=g;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(g=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(g),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var l=this.centralDirOffset+this.centralDirSize;this.zip64&&(l+=20,l+=12+this.zip64EndOfCentralSize);var p=f-l;if(0<p)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(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"),a=e("./compressedObject"),o=e("./crc32"),u=e("./utf8"),h=e("./compressions"),g=e("./support");function f(l,p){this.options=l,this.loadOptions=p}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(l){var p,d;if(l.skip(22),this.fileNameLength=l.readInt(2),d=l.readInt(2),this.fileName=l.readData(this.fileNameLength),l.skip(d),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 v in h)if(Object.prototype.hasOwnProperty.call(h,v)&&h[v].magic===m)return h[v];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,l.readData(this.compressedSize))},readCentralPart:function(l){this.versionMadeBy=l.readInt(2),l.skip(2),this.bitFlag=l.readInt(2),this.compressionMethod=l.readString(2),this.date=l.readDate(),this.crc32=l.readInt(4),this.compressedSize=l.readInt(4),this.uncompressedSize=l.readInt(4);var p=l.readInt(2);if(this.extraFieldsLength=l.readInt(2),this.fileCommentLength=l.readInt(2),this.diskNumberStart=l.readInt(2),this.internalFileAttributes=l.readInt(2),this.externalFileAttributes=l.readInt(4),this.localHeaderOffset=l.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");l.skip(p),this.readExtraFields(l),this.parseZIP64ExtraField(l),this.fileComment=l.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var l=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),l==0&&(this.dosPermissions=63&this.externalFileAttributes),l==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var l=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=l.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=l.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=l.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=l.readInt(4))}},readExtraFields:function(l){var p,d,m,v=l.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});l.index+4<v;)p=l.readInt(2),d=l.readInt(2),m=l.readData(d),this.extraFields[p]={id:p,length:d,value:m};l.setIndex(v)},handleUTF8:function(){var l=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 d=n.transformTo(l,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(d)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var v=n.transformTo(l,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var l=this.extraFields[28789];if(l){var p=r(l.value);return p.readInt(1)!==1||o(this.fileName)!==p.readInt(4)?null:u.utf8decode(p.readData(l.length-5))}return null},findExtraFieldUnicodeComment:function(){var l=this.extraFields[25461];if(l){var p=r(l.value);return p.readInt(1)!==1||o(this.fileComment)!==p.readInt(4)?null:u.utf8decode(p.readData(l.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,d,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=d,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var n=e("./stream/StreamHelper"),a=e("./stream/DataWorker"),o=e("./utf8"),u=e("./compressedObject"),h=e("./stream/GenericWorker");r.prototype={internalStream:function(p){var d=null,m="string";try{if(!p)throw new Error("No output type specified.");var v=(m=p.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),d=this._decompressWorker();var b=!this._dataBinary;b&&!v&&(d=d.pipe(new o.Utf8EncodeWorker)),!b&&v&&(d=d.pipe(new o.Utf8DecodeWorker))}catch(x){(d=new h("error")).error(x)}return new n(d,m,"")},async:function(p,d){return this.internalStream(p).accumulate(d)},nodeStream:function(p,d){return this.internalStream(p||"nodebuffer").toNodejsStream(d)},_compressWorker:function(p,d){if(this._data instanceof u&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new o.Utf8EncodeWorker)),u.createWorkerFrom(m,p,d)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof h?this._data:new a(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.")},l=0;l<g.length;l++)r.prototype[g[l]]=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,a,o=r.MutationObserver||r.WebKitMutationObserver;if(o){var u=0,h=new o(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 d=r.document.createElement("script");d.onreadystatechange=function(){p(),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},r.document.documentElement.appendChild(d)}:function(){setTimeout(p,0)};else{var f=new r.MessageChannel;f.port1.onmessage=p,n=function(){f.port2.postMessage(0)}}var l=[];function p(){var d,m;a=!0;for(var v=l.length;v;){for(m=l,l=[],d=-1;++d<v;)m[d]();v=l.length}a=!1}t.exports=function(d){l.push(d)!==1||a||n()}}).call(this,typeof _e!="undefined"?_e:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var a={},o=["REJECTED"],u=["FULFILLED"],h=["PENDING"];function g(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,v!==n&&d(this,v)}function f(v,b,x){this.promise=v,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof x=="function"&&(this.onRejected=x,this.callRejected=this.otherCallRejected)}function l(v,b,x){r(function(){var y;try{y=b(x)}catch(E){return a.reject(v,E)}y===v?a.reject(v,new TypeError("Cannot resolve promise with itself")):a.resolve(v,y)})}function p(v){var b=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof b=="function")return function(){b.apply(v,arguments)}}function d(v,b){var x=!1;function y(w){x||(x=!0,a.reject(v,w))}function E(w){x||(x=!0,a.resolve(v,w))}var I=m(function(){b(E,y)});I.status==="error"&&y(I.value)}function m(v,b){var x={};try{x.value=v(b),x.status="success"}catch(y){x.status="error",x.value=y}return x}(t.exports=g).prototype.finally=function(v){if(typeof v!="function")return this;var b=this.constructor;return this.then(function(x){return b.resolve(v()).then(function(){return x})},function(x){return b.resolve(v()).then(function(){throw x})})},g.prototype.catch=function(v){return this.then(null,v)},g.prototype.then=function(v,b){if(typeof v!="function"&&this.state===u||typeof b!="function"&&this.state===o)return this;var x=new this.constructor(n);return this.state!==h?l(x,this.state===u?v:b,this.outcome):this.queue.push(new f(x,v,b)),x},f.prototype.callFulfilled=function(v){a.resolve(this.promise,v)},f.prototype.otherCallFulfilled=function(v){l(this.promise,this.onFulfilled,v)},f.prototype.callRejected=function(v){a.reject(this.promise,v)},f.prototype.otherCallRejected=function(v){l(this.promise,this.onRejected,v)},a.resolve=function(v,b){var x=m(p,b);if(x.status==="error")return a.reject(v,x.value);var y=x.value;if(y)d(v,y);else{v.state=u,v.outcome=b;for(var E=-1,I=v.queue.length;++E<I;)v.queue[E].callFulfilled(b)}return v},a.reject=function(v,b){v.state=o,v.outcome=b;for(var x=-1,y=v.queue.length;++x<y;)v.queue[x].callRejected(b);return v},g.resolve=function(v){return v instanceof this?v:a.resolve(new this(n),v)},g.reject=function(v){var b=new this(n);return a.reject(b,v)},g.all=function(v){var b=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=v.length,y=!1;if(!x)return this.resolve([]);for(var E=new Array(x),I=0,w=-1,R=new this(n);++w<x;)L(v[w],w);return R;function L(D,N){b.resolve(D).then(function(C){E[N]=C,++I!==x||y||(y=!0,a.resolve(R,E))},function(C){y||(y=!0,a.reject(R,C))})}},g.race=function(v){var b=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=v.length,y=!1;if(!x)return this.resolve([]);for(var E=-1,I=new this(n);++E<x;)w=v[E],b.resolve(w).then(function(R){y||(y=!0,a.resolve(I,R))},function(R){y||(y=!0,a.reject(I,R))});var w;return I}},{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"),a=e("./utils/strings"),o=e("./zlib/messages"),u=e("./zlib/zstream"),h=Object.prototype.toString,g=0,f=-1,l=0,p=8;function d(v){if(!(this instanceof d))return new d(v);this.options=n.assign({level:f,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:l,to:""},v||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var x=r.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(x!==g)throw new Error(o[x]);if(b.header&&r.deflateSetHeader(this.strm,b.header),b.dictionary){var y;if(y=typeof b.dictionary=="string"?a.string2buf(b.dictionary):h.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(x=r.deflateSetDictionary(this.strm,y))!==g)throw new Error(o[x]);this._dict_set=!0}}function m(v,b){var x=new d(b);if(x.push(v,!0),x.err)throw x.msg||o[x.err];return x.result}d.prototype.push=function(v,b){var x,y,E=this.strm,I=this.options.chunkSize;if(this.ended)return!1;y=b===~~b?b:b===!0?4:0,typeof v=="string"?E.input=a.string2buf(v):h.call(v)==="[object ArrayBuffer]"?E.input=new Uint8Array(v):E.input=v,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.deflate(E,y))!==1&&x!==g)return this.onEnd(x),!(this.ended=!0);E.avail_out!==0&&(E.avail_in!==0||y!==4&&y!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(n.shrinkBuf(E.output,E.next_out))):this.onData(n.shrinkBuf(E.output,E.next_out)))}while((0<E.avail_in||E.avail_out===0)&&x!==1);return y===4?(x=r.deflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===g):y!==2||(this.onEnd(g),!(E.avail_out=0))},d.prototype.onData=function(v){this.chunks.push(v)},d.prototype.onEnd=function(v){v===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},i.Deflate=d,i.deflate=m,i.deflateRaw=function(v,b){return(b=b||{}).raw=!0,m(v,b)},i.gzip=function(v,b){return(b=b||{}).gzip=!0,m(v,b)}},{"./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"),a=e("./utils/strings"),o=e("./zlib/constants"),u=e("./zlib/messages"),h=e("./zlib/zstream"),g=e("./zlib/gzheader"),f=Object.prototype.toString;function l(d){if(!(this instanceof l))return new l(d);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},d||{});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)||d&&d.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 v=r.inflateInit2(this.strm,m.windowBits);if(v!==o.Z_OK)throw new Error(u[v]);this.header=new g,r.inflateGetHeader(this.strm,this.header)}function p(d,m){var v=new l(m);if(v.push(d,!0),v.err)throw v.msg||u[v.err];return v.result}l.prototype.push=function(d,m){var v,b,x,y,E,I,w=this.strm,R=this.options.chunkSize,L=this.options.dictionary,D=!1;if(this.ended)return!1;b=m===~~m?m:m===!0?o.Z_FINISH:o.Z_NO_FLUSH,typeof d=="string"?w.input=a.binstring2buf(d):f.call(d)==="[object ArrayBuffer]"?w.input=new Uint8Array(d):w.input=d,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new n.Buf8(R),w.next_out=0,w.avail_out=R),(v=r.inflate(w,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&L&&(I=typeof L=="string"?a.string2buf(L):f.call(L)==="[object ArrayBuffer]"?new Uint8Array(L):L,v=r.inflateSetDictionary(this.strm,I)),v===o.Z_BUF_ERROR&&D===!0&&(v=o.Z_OK,D=!1),v!==o.Z_STREAM_END&&v!==o.Z_OK)return this.onEnd(v),!(this.ended=!0);w.next_out&&(w.avail_out!==0&&v!==o.Z_STREAM_END&&(w.avail_in!==0||b!==o.Z_FINISH&&b!==o.Z_SYNC_FLUSH)||(this.options.to==="string"?(x=a.utf8border(w.output,w.next_out),y=w.next_out-x,E=a.buf2string(w.output,x),w.next_out=y,w.avail_out=R-y,y&&n.arraySet(w.output,w.output,x,y,0),this.onData(E)):this.onData(n.shrinkBuf(w.output,w.next_out)))),w.avail_in===0&&w.avail_out===0&&(D=!0)}while((0<w.avail_in||w.avail_out===0)&&v!==o.Z_STREAM_END);return v===o.Z_STREAM_END&&(b=o.Z_FINISH),b===o.Z_FINISH?(v=r.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===o.Z_OK):b!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(w.avail_out=0))},l.prototype.onData=function(d){this.chunks.push(d)},l.prototype.onEnd=function(d){d===o.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=d,this.msg=this.strm.msg},i.Inflate=l,i.inflate=p,i.inflateRaw=function(d,m){return(m=m||{}).raw=!0,p(d,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(o){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var h=u.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var g in h)h.hasOwnProperty(g)&&(o[g]=h[g])}}return o},i.shrinkBuf=function(o,u){return o.length===u?o:o.subarray?o.subarray(0,u):(o.length=u,o)};var n={arraySet:function(o,u,h,g,f){if(u.subarray&&o.subarray)o.set(u.subarray(h,h+g),f);else for(var l=0;l<g;l++)o[f+l]=u[h+l]},flattenChunks:function(o){var u,h,g,f,l,p;for(u=g=0,h=o.length;u<h;u++)g+=o[u].length;for(p=new Uint8Array(g),u=f=0,h=o.length;u<h;u++)l=o[u],p.set(l,f),f+=l.length;return p}},a={arraySet:function(o,u,h,g,f){for(var l=0;l<g;l++)o[f+l]=u[h+l]},flattenChunks:function(o){return[].concat.apply([],o)}};i.setTyped=function(o){o?(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,a))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(g){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(g){a=!1}for(var o=new r.Buf8(256),u=0;u<256;u++)o[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function h(g,f){if(f<65537&&(g.subarray&&a||!g.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(g,f));for(var l="",p=0;p<f;p++)l+=String.fromCharCode(g[p]);return l}o[254]=o[254]=1,i.string2buf=function(g){var f,l,p,d,m,v=g.length,b=0;for(d=0;d<v;d++)(64512&(l=g.charCodeAt(d)))==55296&&d+1<v&&(64512&(p=g.charCodeAt(d+1)))==56320&&(l=65536+(l-55296<<10)+(p-56320),d++),b+=l<128?1:l<2048?2:l<65536?3:4;for(f=new r.Buf8(b),d=m=0;m<b;d++)(64512&(l=g.charCodeAt(d)))==55296&&d+1<v&&(64512&(p=g.charCodeAt(d+1)))==56320&&(l=65536+(l-55296<<10)+(p-56320),d++),l<128?f[m++]=l:(l<2048?f[m++]=192|l>>>6:(l<65536?f[m++]=224|l>>>12:(f[m++]=240|l>>>18,f[m++]=128|l>>>12&63),f[m++]=128|l>>>6&63),f[m++]=128|63&l);return f},i.buf2binstring=function(g){return h(g,g.length)},i.binstring2buf=function(g){for(var f=new r.Buf8(g.length),l=0,p=f.length;l<p;l++)f[l]=g.charCodeAt(l);return f},i.buf2string=function(g,f){var l,p,d,m,v=f||g.length,b=new Array(2*v);for(l=p=0;l<v;)if((d=g[l++])<128)b[p++]=d;else if(4<(m=o[d]))b[p++]=65533,l+=m-1;else{for(d&=m===2?31:m===3?15:7;1<m&&l<v;)d=d<<6|63&g[l++],m--;1<m?b[p++]=65533:d<65536?b[p++]=d:(d-=65536,b[p++]=55296|d>>10&1023,b[p++]=56320|1023&d)}return h(b,p)},i.utf8border=function(g,f){var l;for((f=f||g.length)>g.length&&(f=g.length),l=f-1;0<=l&&(192&g[l])==128;)l--;return l<0||l===0?f:l+o[g[l]]>f?l:f}},{"./common":41}],43:[function(e,t,i){t.exports=function(r,n,a,o){for(var u=65535&r|0,h=r>>>16&65535|0,g=0;a!==0;){for(a-=g=2e3<a?2e3:a;h=h+(u=u+n[o++]|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,a=[],o=0;o<256;o++){n=o;for(var u=0;u<8;u++)n=1&n?3988292384^n>>>1:n>>>1;a[o]=n}return a}();t.exports=function(n,a,o,u){var h=r,g=u+o;n^=-1;for(var f=u;f<g;f++)n=n>>>8^h[255&(n^a[f])];return-1^n}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),a=e("./trees"),o=e("./adler32"),u=e("./crc32"),h=e("./messages"),g=0,f=4,l=0,p=-2,d=-1,m=4,v=2,b=8,x=9,y=286,E=30,I=19,w=2*y+1,R=15,L=3,D=258,N=D+L+1,C=42,M=113,A=1,U=2,ie=3,q=4;function oe(S,J){return S.msg=h[J],J}function $(S){return(S<<1)-(4<S?9:0)}function se(S){for(var J=S.length;0<=--J;)S[J]=0}function k(S){var J=S.state,W=J.pending;W>S.avail_out&&(W=S.avail_out),W!==0&&(n.arraySet(S.output,J.pending_buf,J.pending_out,W,S.next_out),S.next_out+=W,J.pending_out+=W,S.total_out+=W,S.avail_out-=W,J.pending-=W,J.pending===0&&(J.pending_out=0))}function P(S,J){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,J),S.block_start=S.strstart,k(S.strm)}function z(S,J){S.pending_buf[S.pending++]=J}function F(S,J){S.pending_buf[S.pending++]=J>>>8&255,S.pending_buf[S.pending++]=255&J}function K(S,J){var W,B,T=S.max_chain_length,V=S.strstart,Z=S.prev_length,X=S.nice_match,H=S.strstart>S.w_size-N?S.strstart-(S.w_size-N):0,ee=S.window,le=S.w_mask,re=S.prev,me=S.strstart+D,we=ee[V+Z-1],ye=ee[V+Z];S.prev_length>=S.good_match&&(T>>=2),X>S.lookahead&&(X=S.lookahead);do if(ee[(W=J)+Z]===ye&&ee[W+Z-1]===we&&ee[W]===ee[V]&&ee[++W]===ee[V+1]){V+=2,W++;do;while(ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&V<me);if(B=D-(me-V),V=me-D,Z<B){if(S.match_start=J,X<=(Z=B))break;we=ee[V+Z-1],ye=ee[V+Z]}}while((J=re[J&le])>H&&--T!=0);return Z<=S.lookahead?Z:S.lookahead}function Q(S){var J,W,B,T,V,Z,X,H,ee,le,re=S.w_size;do{if(T=S.window_size-S.lookahead-S.strstart,S.strstart>=re+(re-N)){for(n.arraySet(S.window,S.window,re,re,0),S.match_start-=re,S.strstart-=re,S.block_start-=re,J=W=S.hash_size;B=S.head[--J],S.head[J]=re<=B?B-re:0,--W;);for(J=W=re;B=S.prev[--J],S.prev[J]=re<=B?B-re:0,--W;);T+=re}if(S.strm.avail_in===0)break;if(Z=S.strm,X=S.window,H=S.strstart+S.lookahead,ee=T,le=void 0,le=Z.avail_in,ee<le&&(le=ee),W=le===0?0:(Z.avail_in-=le,n.arraySet(X,Z.input,Z.next_in,le,H),Z.state.wrap===1?Z.adler=o(Z.adler,X,le,H):Z.state.wrap===2&&(Z.adler=u(Z.adler,X,le,H)),Z.next_in+=le,Z.total_in+=le,le),S.lookahead+=W,S.lookahead+S.insert>=L)for(V=S.strstart-S.insert,S.ins_h=S.window[V],S.ins_h=(S.ins_h<<S.hash_shift^S.window[V+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[V+L-1])&S.hash_mask,S.prev[V&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=V,V++,S.insert--,!(S.lookahead+S.insert<L)););}while(S.lookahead<N&&S.strm.avail_in!==0)}function ge(S,J){for(var W,B;;){if(S.lookahead<N){if(Q(S),S.lookahead<N&&J===g)return A;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(B=a._tr_tally(S,S.strstart-S.match_start,S.match_length-L),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=L){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else B=a._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(B&&(P(S,!1),S.strm.avail_out===0))return A}return S.insert=S.strstart<L-1?S.strstart:L-1,J===f?(P(S,!0),S.strm.avail_out===0?ie:q):S.last_lit&&(P(S,!1),S.strm.avail_out===0)?A:U}function ce(S,J){for(var W,B,T;;){if(S.lookahead<N){if(Q(S),S.lookahead<N&&J===g)return A;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,B=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-L),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=T&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=L-1,S.strstart++,B&&(P(S,!1),S.strm.avail_out===0))return A}else if(S.match_available){if((B=a._tr_tally(S,0,S.window[S.strstart-1]))&&P(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return A}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(B=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<L-1?S.strstart:L-1,J===f?(P(S,!0),S.strm.avail_out===0?ie:q):S.last_lit&&(P(S,!1),S.strm.avail_out===0)?A:U}function Se(S,J,W,B,T){this.good_length=S,this.max_lazy=J,this.nice_length=W,this.max_chain=B,this.func=T}function De(){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=b,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*w),this.dyn_dtree=new n.Buf16(2*(2*E+1)),this.bl_tree=new n.Buf16(2*(2*I+1)),se(this.dyn_ltree),se(this.dyn_dtree),se(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(R+1),this.heap=new n.Buf16(2*y+1),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*y+1),se(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 Ie(S){var J;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=v,(J=S.state).pending=0,J.pending_out=0,J.wrap<0&&(J.wrap=-J.wrap),J.status=J.wrap?C:M,S.adler=J.wrap===2?0:1,J.last_flush=g,a._tr_init(J),l):oe(S,p)}function Ue(S){var J=Ie(S);return J===l&&function(W){W.window_size=2*W.w_size,se(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),J}function Te(S,J,W,B,T,V){if(!S)return p;var Z=1;if(J===d&&(J=6),B<0?(Z=0,B=-B):15<B&&(Z=2,B-=16),T<1||x<T||W!==b||B<8||15<B||J<0||9<J||V<0||m<V)return oe(S,p);B===8&&(B=9);var X=new De;return(S.state=X).strm=S,X.wrap=Z,X.gzhead=null,X.w_bits=B,X.w_size=1<<X.w_bits,X.w_mask=X.w_size-1,X.hash_bits=T+7,X.hash_size=1<<X.hash_bits,X.hash_mask=X.hash_size-1,X.hash_shift=~~((X.hash_bits+L-1)/L),X.window=new n.Buf8(2*X.w_size),X.head=new n.Buf16(X.hash_size),X.prev=new n.Buf16(X.w_size),X.lit_bufsize=1<<T+6,X.pending_buf_size=4*X.lit_bufsize,X.pending_buf=new n.Buf8(X.pending_buf_size),X.d_buf=1*X.lit_bufsize,X.l_buf=3*X.lit_bufsize,X.level=J,X.strategy=V,X.method=W,Ue(S)}r=[new Se(0,0,0,0,function(S,J){var W=65535;for(W>S.pending_buf_size-5&&(W=S.pending_buf_size-5);;){if(S.lookahead<=1){if(Q(S),S.lookahead===0&&J===g)return A;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var B=S.block_start+W;if((S.strstart===0||S.strstart>=B)&&(S.lookahead=S.strstart-B,S.strstart=B,P(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-N&&(P(S,!1),S.strm.avail_out===0))return A}return S.insert=0,J===f?(P(S,!0),S.strm.avail_out===0?ie:q):(S.strstart>S.block_start&&(P(S,!1),S.strm.avail_out),A)}),new Se(4,4,8,4,ge),new Se(4,5,16,8,ge),new Se(4,6,32,32,ge),new Se(4,4,16,16,ce),new Se(8,16,32,32,ce),new Se(8,16,128,128,ce),new Se(8,32,128,256,ce),new Se(32,128,258,1024,ce),new Se(32,258,258,4096,ce)],i.deflateInit=function(S,J){return Te(S,J,b,15,8,0)},i.deflateInit2=Te,i.deflateReset=Ue,i.deflateResetKeep=Ie,i.deflateSetHeader=function(S,J){return S&&S.state?S.state.wrap!==2?p:(S.state.gzhead=J,l):p},i.deflate=function(S,J){var W,B,T,V;if(!S||!S.state||5<J||J<0)return S?oe(S,p):p;if(B=S.state,!S.output||!S.input&&S.avail_in!==0||B.status===666&&J!==f)return oe(S,S.avail_out===0?-5:p);if(B.strm=S,W=B.last_flush,B.last_flush=J,B.status===C)if(B.wrap===2)S.adler=0,z(B,31),z(B,139),z(B,8),B.gzhead?(z(B,(B.gzhead.text?1:0)+(B.gzhead.hcrc?2:0)+(B.gzhead.extra?4:0)+(B.gzhead.name?8:0)+(B.gzhead.comment?16:0)),z(B,255&B.gzhead.time),z(B,B.gzhead.time>>8&255),z(B,B.gzhead.time>>16&255),z(B,B.gzhead.time>>24&255),z(B,B.level===9?2:2<=B.strategy||B.level<2?4:0),z(B,255&B.gzhead.os),B.gzhead.extra&&B.gzhead.extra.length&&(z(B,255&B.gzhead.extra.length),z(B,B.gzhead.extra.length>>8&255)),B.gzhead.hcrc&&(S.adler=u(S.adler,B.pending_buf,B.pending,0)),B.gzindex=0,B.status=69):(z(B,0),z(B,0),z(B,0),z(B,0),z(B,0),z(B,B.level===9?2:2<=B.strategy||B.level<2?4:0),z(B,3),B.status=M);else{var Z=b+(B.w_bits-8<<4)<<8;Z|=(2<=B.strategy||B.level<2?0:B.level<6?1:B.level===6?2:3)<<6,B.strstart!==0&&(Z|=32),Z+=31-Z%31,B.status=M,F(B,Z),B.strstart!==0&&(F(B,S.adler>>>16),F(B,65535&S.adler)),S.adler=1}if(B.status===69)if(B.gzhead.extra){for(T=B.pending;B.gzindex<(65535&B.gzhead.extra.length)&&(B.pending!==B.pending_buf_size||(B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),k(S),T=B.pending,B.pending!==B.pending_buf_size));)z(B,255&B.gzhead.extra[B.gzindex]),B.gzindex++;B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),B.gzindex===B.gzhead.extra.length&&(B.gzindex=0,B.status=73)}else B.status=73;if(B.status===73)if(B.gzhead.name){T=B.pending;do{if(B.pending===B.pending_buf_size&&(B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),k(S),T=B.pending,B.pending===B.pending_buf_size)){V=1;break}V=B.gzindex<B.gzhead.name.length?255&B.gzhead.name.charCodeAt(B.gzindex++):0,z(B,V)}while(V!==0);B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),V===0&&(B.gzindex=0,B.status=91)}else B.status=91;if(B.status===91)if(B.gzhead.comment){T=B.pending;do{if(B.pending===B.pending_buf_size&&(B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),k(S),T=B.pending,B.pending===B.pending_buf_size)){V=1;break}V=B.gzindex<B.gzhead.comment.length?255&B.gzhead.comment.charCodeAt(B.gzindex++):0,z(B,V)}while(V!==0);B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),V===0&&(B.status=103)}else B.status=103;if(B.status===103&&(B.gzhead.hcrc?(B.pending+2>B.pending_buf_size&&k(S),B.pending+2<=B.pending_buf_size&&(z(B,255&S.adler),z(B,S.adler>>8&255),S.adler=0,B.status=M)):B.status=M),B.pending!==0){if(k(S),S.avail_out===0)return B.last_flush=-1,l}else if(S.avail_in===0&&$(J)<=$(W)&&J!==f)return oe(S,-5);if(B.status===666&&S.avail_in!==0)return oe(S,-5);if(S.avail_in!==0||B.lookahead!==0||J!==g&&B.status!==666){var X=B.strategy===2?function(H,ee){for(var le;;){if(H.lookahead===0&&(Q(H),H.lookahead===0)){if(ee===g)return A;break}if(H.match_length=0,le=a._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++,le&&(P(H,!1),H.strm.avail_out===0))return A}return H.insert=0,ee===f?(P(H,!0),H.strm.avail_out===0?ie:q):H.last_lit&&(P(H,!1),H.strm.avail_out===0)?A:U}(B,J):B.strategy===3?function(H,ee){for(var le,re,me,we,ye=H.window;;){if(H.lookahead<=D){if(Q(H),H.lookahead<=D&&ee===g)return A;if(H.lookahead===0)break}if(H.match_length=0,H.lookahead>=L&&0<H.strstart&&(re=ye[me=H.strstart-1])===ye[++me]&&re===ye[++me]&&re===ye[++me]){we=H.strstart+D;do;while(re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&me<we);H.match_length=D-(we-me),H.match_length>H.lookahead&&(H.match_length=H.lookahead)}if(H.match_length>=L?(le=a._tr_tally(H,1,H.match_length-L),H.lookahead-=H.match_length,H.strstart+=H.match_length,H.match_length=0):(le=a._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++),le&&(P(H,!1),H.strm.avail_out===0))return A}return H.insert=0,ee===f?(P(H,!0),H.strm.avail_out===0?ie:q):H.last_lit&&(P(H,!1),H.strm.avail_out===0)?A:U}(B,J):r[B.level].func(B,J);if(X!==ie&&X!==q||(B.status=666),X===A||X===ie)return S.avail_out===0&&(B.last_flush=-1),l;if(X===U&&(J===1?a._tr_align(B):J!==5&&(a._tr_stored_block(B,0,0,!1),J===3&&(se(B.head),B.lookahead===0&&(B.strstart=0,B.block_start=0,B.insert=0))),k(S),S.avail_out===0))return B.last_flush=-1,l}return J!==f?l:B.wrap<=0?1:(B.wrap===2?(z(B,255&S.adler),z(B,S.adler>>8&255),z(B,S.adler>>16&255),z(B,S.adler>>24&255),z(B,255&S.total_in),z(B,S.total_in>>8&255),z(B,S.total_in>>16&255),z(B,S.total_in>>24&255)):(F(B,S.adler>>>16),F(B,65535&S.adler)),k(S),0<B.wrap&&(B.wrap=-B.wrap),B.pending!==0?l:1)},i.deflateEnd=function(S){var J;return S&&S.state?(J=S.state.status)!==C&&J!==69&&J!==73&&J!==91&&J!==103&&J!==M&&J!==666?oe(S,p):(S.state=null,J===M?oe(S,-3):l):p},i.deflateSetDictionary=function(S,J){var W,B,T,V,Z,X,H,ee,le=J.length;if(!S||!S.state||(V=(W=S.state).wrap)===2||V===1&&W.status!==C||W.lookahead)return p;for(V===1&&(S.adler=o(S.adler,J,le,0)),W.wrap=0,le>=W.w_size&&(V===0&&(se(W.head),W.strstart=0,W.block_start=0,W.insert=0),ee=new n.Buf8(W.w_size),n.arraySet(ee,J,le-W.w_size,W.w_size,0),J=ee,le=W.w_size),Z=S.avail_in,X=S.next_in,H=S.input,S.avail_in=le,S.next_in=0,S.input=J,Q(W);W.lookahead>=L;){for(B=W.strstart,T=W.lookahead-(L-1);W.ins_h=(W.ins_h<<W.hash_shift^W.window[B+L-1])&W.hash_mask,W.prev[B&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=B,B++,--T;);W.strstart=B,W.lookahead=L-1,Q(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=X,S.input=H,S.avail_in=Z,W.wrap=V,l},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 a,o,u,h,g,f,l,p,d,m,v,b,x,y,E,I,w,R,L,D,N,C,M,A,U;a=r.state,o=r.next_in,A=r.input,u=o+(r.avail_in-5),h=r.next_out,U=r.output,g=h-(n-r.avail_out),f=h+(r.avail_out-257),l=a.dmax,p=a.wsize,d=a.whave,m=a.wnext,v=a.window,b=a.hold,x=a.bits,y=a.lencode,E=a.distcode,I=(1<<a.lenbits)-1,w=(1<<a.distbits)-1;e:do{x<15&&(b+=A[o++]<<x,x+=8,b+=A[o++]<<x,x+=8),R=y[b&I];t:for(;;){if(b>>>=L=R>>>24,x-=L,(L=R>>>16&255)===0)U[h++]=65535&R;else{if(!(16&L)){if(!(64&L)){R=y[(65535&R)+(b&(1<<L)-1)];continue t}if(32&L){a.mode=12;break e}r.msg="invalid literal/length code",a.mode=30;break e}D=65535&R,(L&=15)&&(x<L&&(b+=A[o++]<<x,x+=8),D+=b&(1<<L)-1,b>>>=L,x-=L),x<15&&(b+=A[o++]<<x,x+=8,b+=A[o++]<<x,x+=8),R=E[b&w];i:for(;;){if(b>>>=L=R>>>24,x-=L,!(16&(L=R>>>16&255))){if(!(64&L)){R=E[(65535&R)+(b&(1<<L)-1)];continue i}r.msg="invalid distance code",a.mode=30;break e}if(N=65535&R,x<(L&=15)&&(b+=A[o++]<<x,(x+=8)<L&&(b+=A[o++]<<x,x+=8)),l<(N+=b&(1<<L)-1)){r.msg="invalid distance too far back",a.mode=30;break e}if(b>>>=L,x-=L,(L=h-g)<N){if(d<(L=N-L)&&a.sane){r.msg="invalid distance too far back",a.mode=30;break e}if(M=v,(C=0)===m){if(C+=p-L,L<D){for(D-=L;U[h++]=v[C++],--L;);C=h-N,M=U}}else if(m<L){if(C+=p+m-L,(L-=m)<D){for(D-=L;U[h++]=v[C++],--L;);if(C=0,m<D){for(D-=L=m;U[h++]=v[C++],--L;);C=h-N,M=U}}}else if(C+=m-L,L<D){for(D-=L;U[h++]=v[C++],--L;);C=h-N,M=U}for(;2<D;)U[h++]=M[C++],U[h++]=M[C++],U[h++]=M[C++],D-=3;D&&(U[h++]=M[C++],1<D&&(U[h++]=M[C++]))}else{for(C=h-N;U[h++]=U[C++],U[h++]=U[C++],U[h++]=U[C++],2<(D-=3););D&&(U[h++]=U[C++],1<D&&(U[h++]=U[C++]))}break}}break}}while(o<u&&h<f);o-=D=x>>3,b&=(1<<(x-=D<<3))-1,r.next_in=o,r.next_out=h,r.avail_in=o<u?u-o+5:5-(o-u),r.avail_out=h<f?f-h+257:257-(h-f),a.hold=b,a.bits=x}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),a=e("./crc32"),o=e("./inffast"),u=e("./inftrees"),h=1,g=2,f=0,l=-2,p=1,d=852,m=592;function v(C){return(C>>>24&255)+(C>>>8&65280)+((65280&C)<<8)+((255&C)<<24)}function b(){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 x(C){var M;return C&&C.state?(M=C.state,C.total_in=C.total_out=M.total=0,C.msg="",M.wrap&&(C.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(d),M.distcode=M.distdyn=new r.Buf32(m),M.sane=1,M.back=-1,f):l}function y(C){var M;return C&&C.state?((M=C.state).wsize=0,M.whave=0,M.wnext=0,x(C)):l}function E(C,M){var A,U;return C&&C.state?(U=C.state,M<0?(A=0,M=-M):(A=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15<M)?l:(U.window!==null&&U.wbits!==M&&(U.window=null),U.wrap=A,U.wbits=M,y(C))):l}function I(C,M){var A,U;return C?(U=new b,(C.state=U).window=null,(A=E(C,M))!==f&&(C.state=null),A):l}var w,R,L=!0;function D(C){if(L){var M;for(w=new r.Buf32(512),R=new r.Buf32(32),M=0;M<144;)C.lens[M++]=8;for(;M<256;)C.lens[M++]=9;for(;M<280;)C.lens[M++]=7;for(;M<288;)C.lens[M++]=8;for(u(h,C.lens,0,288,w,0,C.work,{bits:9}),M=0;M<32;)C.lens[M++]=5;u(g,C.lens,0,32,R,0,C.work,{bits:5}),L=!1}C.lencode=w,C.lenbits=9,C.distcode=R,C.distbits=5}function N(C,M,A,U){var ie,q=C.state;return q.window===null&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new r.Buf8(q.wsize)),U>=q.wsize?(r.arraySet(q.window,M,A-q.wsize,q.wsize,0),q.wnext=0,q.whave=q.wsize):(U<(ie=q.wsize-q.wnext)&&(ie=U),r.arraySet(q.window,M,A-U,ie,q.wnext),(U-=ie)?(r.arraySet(q.window,M,A-U,U,0),q.wnext=U,q.whave=q.wsize):(q.wnext+=ie,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=ie))),0}i.inflateReset=y,i.inflateReset2=E,i.inflateResetKeep=x,i.inflateInit=function(C){return I(C,15)},i.inflateInit2=I,i.inflate=function(C,M){var A,U,ie,q,oe,$,se,k,P,z,F,K,Q,ge,ce,Se,De,Ie,Ue,Te,S,J,W,B,T=0,V=new r.Buf8(4),Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!C||!C.state||!C.output||!C.input&&C.avail_in!==0)return l;(A=C.state).mode===12&&(A.mode=13),oe=C.next_out,ie=C.output,se=C.avail_out,q=C.next_in,U=C.input,$=C.avail_in,k=A.hold,P=A.bits,z=$,F=se,J=f;e:for(;;)switch(A.mode){case p:if(A.wrap===0){A.mode=13;break}for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(2&A.wrap&&k===35615){V[A.check=0]=255&k,V[1]=k>>>8&255,A.check=a(A.check,V,2,0),P=k=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&k)<<8)+(k>>8))%31){C.msg="incorrect header check",A.mode=30;break}if((15&k)!=8){C.msg="unknown compression method",A.mode=30;break}if(P-=4,S=8+(15&(k>>>=4)),A.wbits===0)A.wbits=S;else if(S>A.wbits){C.msg="invalid window size",A.mode=30;break}A.dmax=1<<S,C.adler=A.check=1,A.mode=512&k?10:12,P=k=0;break;case 2:for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(A.flags=k,(255&A.flags)!=8){C.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){C.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=k>>8&1),512&A.flags&&(V[0]=255&k,V[1]=k>>>8&255,A.check=a(A.check,V,2,0)),P=k=0,A.mode=3;case 3:for(;P<32;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.head&&(A.head.time=k),512&A.flags&&(V[0]=255&k,V[1]=k>>>8&255,V[2]=k>>>16&255,V[3]=k>>>24&255,A.check=a(A.check,V,4,0)),P=k=0,A.mode=4;case 4:for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.head&&(A.head.xflags=255&k,A.head.os=k>>8),512&A.flags&&(V[0]=255&k,V[1]=k>>>8&255,A.check=a(A.check,V,2,0)),P=k=0,A.mode=5;case 5:if(1024&A.flags){for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.length=k,A.head&&(A.head.extra_len=k),512&A.flags&&(V[0]=255&k,V[1]=k>>>8&255,A.check=a(A.check,V,2,0)),P=k=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&($<(K=A.length)&&(K=$),K&&(A.head&&(S=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),r.arraySet(A.head.extra,U,q,K,S)),512&A.flags&&(A.check=a(A.check,U,K,q)),$-=K,q+=K,A.length-=K),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if($===0)break e;for(K=0;S=U[q+K++],A.head&&S&&A.length<65536&&(A.head.name+=String.fromCharCode(S)),S&&K<$;);if(512&A.flags&&(A.check=a(A.check,U,K,q)),$-=K,q+=K,S)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if($===0)break e;for(K=0;S=U[q+K++],A.head&&S&&A.length<65536&&(A.head.comment+=String.fromCharCode(S)),S&&K<$;);if(512&A.flags&&(A.check=a(A.check,U,K,q)),$-=K,q+=K,S)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(k!==(65535&A.check)){C.msg="header crc mismatch",A.mode=30;break}P=k=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),C.adler=A.check=0,A.mode=12;break;case 10:for(;P<32;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}C.adler=A.check=v(k),P=k=0,A.mode=11;case 11:if(A.havedict===0)return C.next_out=oe,C.avail_out=se,C.next_in=q,C.avail_in=$,A.hold=k,A.bits=P,2;C.adler=A.check=1,A.mode=12;case 12:if(M===5||M===6)break e;case 13:if(A.last){k>>>=7&P,P-=7&P,A.mode=27;break}for(;P<3;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}switch(A.last=1&k,P-=1,3&(k>>>=1)){case 0:A.mode=14;break;case 1:if(D(A),A.mode=20,M!==6)break;k>>>=2,P-=2;break e;case 2:A.mode=17;break;case 3:C.msg="invalid block type",A.mode=30}k>>>=2,P-=2;break;case 14:for(k>>>=7&P,P-=7&P;P<32;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if((65535&k)!=(k>>>16^65535)){C.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&k,P=k=0,A.mode=15,M===6)break e;case 15:A.mode=16;case 16:if(K=A.length){if($<K&&(K=$),se<K&&(K=se),K===0)break e;r.arraySet(ie,U,q,K,oe),$-=K,q+=K,se-=K,oe+=K,A.length-=K;break}A.mode=12;break;case 17:for(;P<14;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(A.nlen=257+(31&k),k>>>=5,P-=5,A.ndist=1+(31&k),k>>>=5,P-=5,A.ncode=4+(15&k),k>>>=4,P-=4,286<A.nlen||30<A.ndist){C.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;P<3;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.lens[Z[A.have++]]=7&k,k>>>=3,P-=3}for(;A.have<19;)A.lens[Z[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,W={bits:A.lenbits},J=u(0,A.lens,0,19,A.lencode,0,A.work,W),A.lenbits=W.bits,J){C.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;Se=(T=A.lencode[k&(1<<A.lenbits)-1])>>>16&255,De=65535&T,!((ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(De<16)k>>>=ce,P-=ce,A.lens[A.have++]=De;else{if(De===16){for(B=ce+2;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(k>>>=ce,P-=ce,A.have===0){C.msg="invalid bit length repeat",A.mode=30;break}S=A.lens[A.have-1],K=3+(3&k),k>>>=2,P-=2}else if(De===17){for(B=ce+3;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}P-=ce,S=0,K=3+(7&(k>>>=ce)),k>>>=3,P-=3}else{for(B=ce+7;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}P-=ce,S=0,K=11+(127&(k>>>=ce)),k>>>=7,P-=7}if(A.have+K>A.nlen+A.ndist){C.msg="invalid bit length repeat",A.mode=30;break}for(;K--;)A.lens[A.have++]=S}}if(A.mode===30)break;if(A.lens[256]===0){C.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,W={bits:A.lenbits},J=u(h,A.lens,0,A.nlen,A.lencode,0,A.work,W),A.lenbits=W.bits,J){C.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,W={bits:A.distbits},J=u(g,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,W),A.distbits=W.bits,J){C.msg="invalid distances set",A.mode=30;break}if(A.mode=20,M===6)break e;case 20:A.mode=21;case 21:if(6<=$&&258<=se){C.next_out=oe,C.avail_out=se,C.next_in=q,C.avail_in=$,A.hold=k,A.bits=P,o(C,F),oe=C.next_out,ie=C.output,se=C.avail_out,q=C.next_in,U=C.input,$=C.avail_in,k=A.hold,P=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;Se=(T=A.lencode[k&(1<<A.lenbits)-1])>>>16&255,De=65535&T,!((ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(Se&&!(240&Se)){for(Ie=ce,Ue=Se,Te=De;Se=(T=A.lencode[Te+((k&(1<<Ie+Ue)-1)>>Ie)])>>>16&255,De=65535&T,!(Ie+(ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}k>>>=Ie,P-=Ie,A.back+=Ie}if(k>>>=ce,P-=ce,A.back+=ce,A.length=De,Se===0){A.mode=26;break}if(32&Se){A.back=-1,A.mode=12;break}if(64&Se){C.msg="invalid literal/length code",A.mode=30;break}A.extra=15&Se,A.mode=22;case 22:if(A.extra){for(B=A.extra;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.length+=k&(1<<A.extra)-1,k>>>=A.extra,P-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;Se=(T=A.distcode[k&(1<<A.distbits)-1])>>>16&255,De=65535&T,!((ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(!(240&Se)){for(Ie=ce,Ue=Se,Te=De;Se=(T=A.distcode[Te+((k&(1<<Ie+Ue)-1)>>Ie)])>>>16&255,De=65535&T,!(Ie+(ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}k>>>=Ie,P-=Ie,A.back+=Ie}if(k>>>=ce,P-=ce,A.back+=ce,64&Se){C.msg="invalid distance code",A.mode=30;break}A.offset=De,A.extra=15&Se,A.mode=24;case 24:if(A.extra){for(B=A.extra;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.offset+=k&(1<<A.extra)-1,k>>>=A.extra,P-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){C.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(se===0)break e;if(K=F-se,A.offset>K){if((K=A.offset-K)>A.whave&&A.sane){C.msg="invalid distance too far back",A.mode=30;break}Q=K>A.wnext?(K-=A.wnext,A.wsize-K):A.wnext-K,K>A.length&&(K=A.length),ge=A.window}else ge=ie,Q=oe-A.offset,K=A.length;for(se<K&&(K=se),se-=K,A.length-=K;ie[oe++]=ge[Q++],--K;);A.length===0&&(A.mode=21);break;case 26:if(se===0)break e;ie[oe++]=A.length,se--,A.mode=21;break;case 27:if(A.wrap){for(;P<32;){if($===0)break e;$--,k|=U[q++]<<P,P+=8}if(F-=se,C.total_out+=F,A.total+=F,F&&(C.adler=A.check=A.flags?a(A.check,ie,F,oe-F):n(A.check,ie,F,oe-F)),F=se,(A.flags?k:v(k))!==A.check){C.msg="incorrect data check",A.mode=30;break}P=k=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;P<32;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(k!==(4294967295&A.total)){C.msg="incorrect length check",A.mode=30;break}P=k=0}A.mode=29;case 29:J=1;break e;case 30:J=-3;break e;case 31:return-4;case 32:default:return l}return C.next_out=oe,C.avail_out=se,C.next_in=q,C.avail_in=$,A.hold=k,A.bits=P,(A.wsize||F!==C.avail_out&&A.mode<30&&(A.mode<27||M!==4))&&N(C,C.output,C.next_out,F-C.avail_out)?(A.mode=31,-4):(z-=C.avail_in,F-=C.avail_out,C.total_in+=z,C.total_out+=F,A.total+=F,A.wrap&&F&&(C.adler=A.check=A.flags?a(A.check,ie,F,C.next_out-F):n(A.check,ie,F,C.next_out-F)),C.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(z==0&&F===0||M===4)&&J===f&&(J=-5),J)},i.inflateEnd=function(C){if(!C||!C.state)return l;var M=C.state;return M.window&&(M.window=null),C.state=null,f},i.inflateGetHeader=function(C,M){var A;return C&&C.state&&2&(A=C.state).wrap?((A.head=M).done=!1,f):l},i.inflateSetDictionary=function(C,M){var A,U=M.length;return C&&C.state?(A=C.state).wrap!==0&&A.mode!==11?l:A.mode===11&&n(1,M,U,0)!==A.check?-3:N(C,M,U,U)?(A.mode=31,-4):(A.havedict=1,f):l},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],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(h,g,f,l,p,d,m,v){var b,x,y,E,I,w,R,L,D,N=v.bits,C=0,M=0,A=0,U=0,ie=0,q=0,oe=0,$=0,se=0,k=0,P=null,z=0,F=new r.Buf16(16),K=new r.Buf16(16),Q=null,ge=0;for(C=0;C<=15;C++)F[C]=0;for(M=0;M<l;M++)F[g[f+M]]++;for(ie=N,U=15;1<=U&&F[U]===0;U--);if(U<ie&&(ie=U),U===0)return p[d++]=20971520,p[d++]=20971520,v.bits=1,0;for(A=1;A<U&&F[A]===0;A++);for(ie<A&&(ie=A),C=$=1;C<=15;C++)if($<<=1,($-=F[C])<0)return-1;if(0<$&&(h===0||U!==1))return-1;for(K[1]=0,C=1;C<15;C++)K[C+1]=K[C]+F[C];for(M=0;M<l;M++)g[f+M]!==0&&(m[K[g[f+M]]++]=M);if(w=h===0?(P=Q=m,19):h===1?(P=n,z-=257,Q=a,ge-=257,256):(P=o,Q=u,-1),C=A,I=d,oe=M=k=0,y=-1,E=(se=1<<(q=ie))-1,h===1&&852<se||h===2&&592<se)return 1;for(;;){for(R=C-oe,D=m[M]<w?(L=0,m[M]):m[M]>w?(L=Q[ge+m[M]],P[z+m[M]]):(L=96,0),b=1<<C-oe,A=x=1<<q;p[I+(k>>oe)+(x-=b)]=R<<24|L<<16|D|0,x!==0;);for(b=1<<C-1;k&b;)b>>=1;if(b!==0?(k&=b-1,k+=b):k=0,M++,--F[C]==0){if(C===U)break;C=g[f+m[M]]}if(ie<C&&(k&E)!==y){for(oe===0&&(oe=ie),I+=A,$=1<<(q=C-oe);q+oe<U&&!(($-=F[q+oe])<=0);)q++,$<<=1;if(se+=1<<q,h===1&&852<se||h===2&&592<se)return 1;p[y=k&E]=ie<<24|q<<16|I-d|0}}return k!==0&&(p[I+k]=C-oe<<24|64<<16|0),v.bits=ie,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,a=1;function o(T){for(var V=T.length;0<=--V;)T[V]=0}var u=0,h=29,g=256,f=g+1+h,l=30,p=19,d=2*f+1,m=15,v=16,b=7,x=256,y=16,E=17,I=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],R=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],D=[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));o(N);var C=new Array(2*l);o(C);var M=new Array(512);o(M);var A=new Array(256);o(A);var U=new Array(h);o(U);var ie,q,oe,$=new Array(l);function se(T,V,Z,X,H){this.static_tree=T,this.extra_bits=V,this.extra_base=Z,this.elems=X,this.max_length=H,this.has_stree=T&&T.length}function k(T,V){this.dyn_tree=T,this.max_code=0,this.stat_desc=V}function P(T){return T<256?M[T]:M[256+(T>>>7)]}function z(T,V){T.pending_buf[T.pending++]=255&V,T.pending_buf[T.pending++]=V>>>8&255}function F(T,V,Z){T.bi_valid>v-Z?(T.bi_buf|=V<<T.bi_valid&65535,z(T,T.bi_buf),T.bi_buf=V>>v-T.bi_valid,T.bi_valid+=Z-v):(T.bi_buf|=V<<T.bi_valid&65535,T.bi_valid+=Z)}function K(T,V,Z){F(T,Z[2*V],Z[2*V+1])}function Q(T,V){for(var Z=0;Z|=1&T,T>>>=1,Z<<=1,0<--V;);return Z>>>1}function ge(T,V,Z){var X,H,ee=new Array(m+1),le=0;for(X=1;X<=m;X++)ee[X]=le=le+Z[X-1]<<1;for(H=0;H<=V;H++){var re=T[2*H+1];re!==0&&(T[2*H]=Q(ee[re]++,re))}}function ce(T){var V;for(V=0;V<f;V++)T.dyn_ltree[2*V]=0;for(V=0;V<l;V++)T.dyn_dtree[2*V]=0;for(V=0;V<p;V++)T.bl_tree[2*V]=0;T.dyn_ltree[2*x]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function Se(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 De(T,V,Z,X){var H=2*V,ee=2*Z;return T[H]<T[ee]||T[H]===T[ee]&&X[V]<=X[Z]}function Ie(T,V,Z){for(var X=T.heap[Z],H=Z<<1;H<=T.heap_len&&(H<T.heap_len&&De(V,T.heap[H+1],T.heap[H],T.depth)&&H++,!De(V,X,T.heap[H],T.depth));)T.heap[Z]=T.heap[H],Z=H,H<<=1;T.heap[Z]=X}function Ue(T,V,Z){var X,H,ee,le,re=0;if(T.last_lit!==0)for(;X=T.pending_buf[T.d_buf+2*re]<<8|T.pending_buf[T.d_buf+2*re+1],H=T.pending_buf[T.l_buf+re],re++,X===0?K(T,H,V):(K(T,(ee=A[H])+g+1,V),(le=w[ee])!==0&&F(T,H-=U[ee],le),K(T,ee=P(--X),Z),(le=R[ee])!==0&&F(T,X-=$[ee],le)),re<T.last_lit;);K(T,x,V)}function Te(T,V){var Z,X,H,ee=V.dyn_tree,le=V.stat_desc.static_tree,re=V.stat_desc.has_stree,me=V.stat_desc.elems,we=-1;for(T.heap_len=0,T.heap_max=d,Z=0;Z<me;Z++)ee[2*Z]!==0?(T.heap[++T.heap_len]=we=Z,T.depth[Z]=0):ee[2*Z+1]=0;for(;T.heap_len<2;)ee[2*(H=T.heap[++T.heap_len]=we<2?++we:0)]=1,T.depth[H]=0,T.opt_len--,re&&(T.static_len-=le[2*H+1]);for(V.max_code=we,Z=T.heap_len>>1;1<=Z;Z--)Ie(T,ee,Z);for(H=me;Z=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Ie(T,ee,1),X=T.heap[1],T.heap[--T.heap_max]=Z,T.heap[--T.heap_max]=X,ee[2*H]=ee[2*Z]+ee[2*X],T.depth[H]=(T.depth[Z]>=T.depth[X]?T.depth[Z]:T.depth[X])+1,ee[2*Z+1]=ee[2*X+1]=H,T.heap[1]=H++,Ie(T,ee,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],function(ye,Qe){var Ct,Fe,ut,Ne,It,li,yt=Qe.dyn_tree,Xi=Qe.max_code,Zi=Qe.stat_desc.static_tree,Ms=Qe.stat_desc.has_stree,Yi=Qe.stat_desc.extra_bits,Qi=Qe.stat_desc.extra_base,Ht=Qe.stat_desc.max_length,fi=0;for(Ne=0;Ne<=m;Ne++)ye.bl_count[Ne]=0;for(yt[2*ye.heap[ye.heap_max]+1]=0,Ct=ye.heap_max+1;Ct<d;Ct++)Ht<(Ne=yt[2*yt[2*(Fe=ye.heap[Ct])+1]+1]+1)&&(Ne=Ht,fi++),yt[2*Fe+1]=Ne,Xi<Fe||(ye.bl_count[Ne]++,It=0,Qi<=Fe&&(It=Yi[Fe-Qi]),li=yt[2*Fe],ye.opt_len+=li*(Ne+It),Ms&&(ye.static_len+=li*(Zi[2*Fe+1]+It)));if(fi!==0){do{for(Ne=Ht-1;ye.bl_count[Ne]===0;)Ne--;ye.bl_count[Ne]--,ye.bl_count[Ne+1]+=2,ye.bl_count[Ht]--,fi-=2}while(0<fi);for(Ne=Ht;Ne!==0;Ne--)for(Fe=ye.bl_count[Ne];Fe!==0;)Xi<(ut=ye.heap[--Ct])||(yt[2*ut+1]!==Ne&&(ye.opt_len+=(Ne-yt[2*ut+1])*yt[2*ut],yt[2*ut+1]=Ne),Fe--)}}(T,V),ge(ee,we,T.bl_count)}function S(T,V,Z){var X,H,ee=-1,le=V[1],re=0,me=7,we=4;for(le===0&&(me=138,we=3),V[2*(Z+1)+1]=65535,X=0;X<=Z;X++)H=le,le=V[2*(X+1)+1],++re<me&&H===le||(re<we?T.bl_tree[2*H]+=re:H!==0?(H!==ee&&T.bl_tree[2*H]++,T.bl_tree[2*y]++):re<=10?T.bl_tree[2*E]++:T.bl_tree[2*I]++,ee=H,we=(re=0)===le?(me=138,3):H===le?(me=6,3):(me=7,4))}function J(T,V,Z){var X,H,ee=-1,le=V[1],re=0,me=7,we=4;for(le===0&&(me=138,we=3),X=0;X<=Z;X++)if(H=le,le=V[2*(X+1)+1],!(++re<me&&H===le)){if(re<we)for(;K(T,H,T.bl_tree),--re!=0;);else H!==0?(H!==ee&&(K(T,H,T.bl_tree),re--),K(T,y,T.bl_tree),F(T,re-3,2)):re<=10?(K(T,E,T.bl_tree),F(T,re-3,3)):(K(T,I,T.bl_tree),F(T,re-11,7));ee=H,we=(re=0)===le?(me=138,3):H===le?(me=6,3):(me=7,4)}}o($);var W=!1;function B(T,V,Z,X){F(T,(u<<1)+(X?1:0),3),function(H,ee,le,re){Se(H),re&&(z(H,le),z(H,~le)),r.arraySet(H.pending_buf,H.window,ee,le,H.pending),H.pending+=le}(T,V,Z,!0)}i._tr_init=function(T){W||(function(){var V,Z,X,H,ee,le=new Array(m+1);for(H=X=0;H<h-1;H++)for(U[H]=X,V=0;V<1<<w[H];V++)A[X++]=H;for(A[X-1]=H,H=ee=0;H<16;H++)for($[H]=ee,V=0;V<1<<R[H];V++)M[ee++]=H;for(ee>>=7;H<l;H++)for($[H]=ee<<7,V=0;V<1<<R[H]-7;V++)M[256+ee++]=H;for(Z=0;Z<=m;Z++)le[Z]=0;for(V=0;V<=143;)N[2*V+1]=8,V++,le[8]++;for(;V<=255;)N[2*V+1]=9,V++,le[9]++;for(;V<=279;)N[2*V+1]=7,V++,le[7]++;for(;V<=287;)N[2*V+1]=8,V++,le[8]++;for(ge(N,f+1,le),V=0;V<l;V++)C[2*V+1]=5,C[2*V]=Q(V,5);ie=new se(N,w,g+1,f,m),q=new se(C,R,0,l,m),oe=new se(new Array(0),L,0,p,b)}(),W=!0),T.l_desc=new k(T.dyn_ltree,ie),T.d_desc=new k(T.dyn_dtree,q),T.bl_desc=new k(T.bl_tree,oe),T.bi_buf=0,T.bi_valid=0,ce(T)},i._tr_stored_block=B,i._tr_flush_block=function(T,V,Z,X){var H,ee,le=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=function(re){var me,we=4093624447;for(me=0;me<=31;me++,we>>>=1)if(1&we&&re.dyn_ltree[2*me]!==0)return n;if(re.dyn_ltree[18]!==0||re.dyn_ltree[20]!==0||re.dyn_ltree[26]!==0)return a;for(me=32;me<g;me++)if(re.dyn_ltree[2*me]!==0)return a;return n}(T)),Te(T,T.l_desc),Te(T,T.d_desc),le=function(re){var me;for(S(re,re.dyn_ltree,re.l_desc.max_code),S(re,re.dyn_dtree,re.d_desc.max_code),Te(re,re.bl_desc),me=p-1;3<=me&&re.bl_tree[2*D[me]+1]===0;me--);return re.opt_len+=3*(me+1)+5+5+4,me}(T),H=T.opt_len+3+7>>>3,(ee=T.static_len+3+7>>>3)<=H&&(H=ee)):H=ee=Z+5,Z+4<=H&&V!==-1?B(T,V,Z,X):T.strategy===4||ee===H?(F(T,2+(X?1:0),3),Ue(T,N,C)):(F(T,4+(X?1:0),3),function(re,me,we,ye){var Qe;for(F(re,me-257,5),F(re,we-1,5),F(re,ye-4,4),Qe=0;Qe<ye;Qe++)F(re,re.bl_tree[2*D[Qe]+1],3);J(re,re.dyn_ltree,me-1),J(re,re.dyn_dtree,we-1)}(T,T.l_desc.max_code+1,T.d_desc.max_code+1,le+1),Ue(T,T.dyn_ltree,T.dyn_dtree)),ce(T),X&&Se(T)},i._tr_tally=function(T,V,Z){return T.pending_buf[T.d_buf+2*T.last_lit]=V>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&V,T.pending_buf[T.l_buf+T.last_lit]=255&Z,T.last_lit++,V===0?T.dyn_ltree[2*Z]++:(T.matches++,V--,T.dyn_ltree[2*(A[Z]+g+1)]++,T.dyn_dtree[2*P(V)]++),T.last_lit===T.lit_bufsize-1},i._tr_align=function(T){F(T,2,3),K(T,x,N),function(V){V.bi_valid===16?(z(V,V.bi_buf),V.bi_buf=0,V.bi_valid=0):8<=V.bi_valid&&(V.pending_buf[V.pending++]=255&V.bi_buf,V.bi_buf>>=8,V.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,a){if(!n.setImmediate){var o,u,h,g,f=1,l={},p=!1,d=n.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(n);m=m&&m.setTimeout?m:n,o={}.toString.call(n.process)==="[object process]"?function(y){process.nextTick(function(){b(y)})}:function(){if(n.postMessage&&!n.importScripts){var y=!0,E=n.onmessage;return n.onmessage=function(){y=!1},n.postMessage("","*"),n.onmessage=E,y}}()?(g="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",x,!1):n.attachEvent("onmessage",x),function(y){n.postMessage(g+y,"*")}):n.MessageChannel?((h=new MessageChannel).port1.onmessage=function(y){b(y.data)},function(y){h.port2.postMessage(y)}):d&&"onreadystatechange"in d.createElement("script")?(u=d.documentElement,function(y){var E=d.createElement("script");E.onreadystatechange=function(){b(y),E.onreadystatechange=null,u.removeChild(E),E=null},u.appendChild(E)}):function(y){setTimeout(b,0,y)},m.setImmediate=function(y){typeof y!="function"&&(y=new Function(""+y));for(var E=new Array(arguments.length-1),I=0;I<E.length;I++)E[I]=arguments[I+1];var w={callback:y,args:E};return l[f]=w,o(f),f++},m.clearImmediate=v}function v(y){delete l[y]}function b(y){if(p)setTimeout(b,0,y);else{var E=l[y];if(E){p=!0;try{(function(I){var w=I.callback,R=I.args;switch(R.length){case 0:w();break;case 1:w(R[0]);break;case 2:w(R[0],R[1]);break;case 3:w(R[0],R[1],R[2]);break;default:w.apply(a,R)}})(E)}finally{v(y),p=!1}}}}function x(y){y.source===n&&typeof y.data=="string"&&y.data.indexOf(g)===0&&b(+y.data.slice(g.length))}})(typeof self=="undefined"?r===void 0?this:r:self)}).call(this,typeof _e!="undefined"?_e:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[10])(10)})})(vn);var No=vn.exports;const Fo=bn(No),gr=(s,c)=>c.some(e=>s instanceof e);let xn,Sn;function Oo(){return xn||(xn=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Vo(){return Sn||(Sn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const br=new WeakMap,vr=new WeakMap,Mi=new WeakMap;function Uo(s){const c=new Promise((e,t)=>{const i=()=>{s.removeEventListener("success",r),s.removeEventListener("error",n)},r=()=>{e($t(s.result)),i()},n=()=>{t(s.error),i()};s.addEventListener("success",r),s.addEventListener("error",n)});return Mi.set(c,s),c}function Ho(s){if(br.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)});br.set(s,c)}let xr={get(s,c,e){if(s instanceof IDBTransaction){if(c==="done")return br.get(s);if(c==="store")return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return $t(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 _n(s){xr=s(xr)}function zo(s){return Vo().includes(s)?function(...c){return s.apply(Sr(this),c),$t(this.request)}:function(...c){return $t(s.apply(Sr(this),c))}}function jo(s){return typeof s=="function"?zo(s):(s instanceof IDBTransaction&&Ho(s),gr(s,Oo())?new Proxy(s,xr):s)}function $t(s){if(s instanceof IDBRequest)return Uo(s);if(vr.has(s))return vr.get(s);const c=jo(s);return c!==s&&(vr.set(s,c),Mi.set(c,s)),c}const Sr=s=>Mi.get(s);function Wo(s,c,{blocked:e,upgrade:t,blocking:i,terminated:r}={}){const n=indexedDB.open(s,c),a=$t(n);return t&&n.addEventListener("upgradeneeded",o=>{t($t(n.result),o.oldVersion,o.newVersion,$t(n.transaction),o)}),e&&n.addEventListener("blocked",o=>e(o.oldVersion,o.newVersion,o)),a.then(o=>{r&&o.addEventListener("close",()=>r()),i&&o.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const Ko=["get","getKey","getAll","getAllKeys","count"],$o=["put","add","delete","clear"],_r=new Map;function yn(s,c){if(!(s instanceof IDBDatabase&&!(c in s)&&typeof c=="string"))return;if(_r.get(c))return _r.get(c);const e=c.replace(/FromIndex$/,""),t=c!==e,i=$o.includes(e);if(!(e in(t?IDBIndex:IDBObjectStore).prototype)||!(i||Ko.includes(e)))return;const r=function(n,...a){return O(this,null,function*(){const o=this.transaction(n,i?"readwrite":"readonly");let u=o.store;return t&&(u=u.index(a.shift())),(yield Promise.all([u[e](...a),i&&o.done]))[0]})};return _r.set(c,r),r}_n(s=>Rt(ve({},s),{get:(c,e,t)=>yn(c,e)||s.get(c,e,t),has:(c,e)=>!!yn(c,e)||s.has(c,e)}));const qo=["continue","continuePrimaryKey","advance"],An={},yr=new WeakMap,En=new WeakMap,Go={get(s,c){if(!qo.includes(c))return s[c];let e=An[c];return e||(e=An[c]=function(...t){yr.set(this,En.get(this)[c](...t))}),e}};function Jo(...s){return ao(this,null,function*(){let c=this;if(c instanceof IDBCursor||(c=yield new tr(c.openCursor(...s))),!c)return;c=c;const e=new Proxy(c,Go);for(En.set(e,c),Mi.set(e,Sr(c));c;)yield e,c=yield new tr(yr.get(e)||c.continue()),yr.delete(e)})}function wn(s,c){return c===Symbol.asyncIterator&&gr(s,[IDBIndex,IDBObjectStore,IDBCursor])||c==="iterate"&&gr(s,[IDBIndex,IDBObjectStore])}_n(s=>Rt(ve({},s),{get(c,e,t){return wn(c,e)?Jo:s.get(c,e,t)},has(c,e){return wn(c,e)||s.has(c,e)}}));const Xo="AliRTCLog",Ni="AliRTCSessiones",Fi="AliRTCLogs",Zo=()=>O(this,null,function*(){return yield Wo(Xo,1,{upgrade:c=>{c.createObjectStore(Ni,{keyPath:"sid"}).createIndex("sid","sid",{unique:!0});const t=c.createObjectStore(Fi,{keyPath:"id",autoIncrement:!0});t.createIndex("sid","sid",{unique:!1}),t.createIndex("date","date",{unique:!1})}})}),Yo=(s,c)=>O(this,null,function*(){yield s.add(Ni,{sid:c})}),Cn=(s,c,e,t)=>O(this,null,function*(){yield s.add(Fi,{sid:c,log:t,date:e})}),In=(s,c)=>O(this,null,function*(){return yield s.getAllFromIndex(Fi,"sid",c)}),Qo=s=>O(this,null,function*(){return yield s.getAllFromIndex(Ni,"sid")}),Ar=(s,c)=>O(this,null,function*(){yield s.delete(Fi,c)}),ec=(s,c)=>O(this,null,function*(){yield s.delete(Ni,c)});var Rn={exports:{}},Er={exports:{}};const tc=Mo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Dn;function Ce(){return Dn||(Dn=1,function(s,c){(function(e,t){s.exports=t()})(_e,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 _e!="undefined"&&_e.crypto&&(r=_e.crypto),!r&&typeof gi=="function")try{r=tc}catch(b){}var n=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch(b){}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch(b){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function b(){}return function(x){var y;return b.prototype=x,y=new b,b.prototype=null,y}}(),o={},u=o.lib={},h=u.Base=function(){return{extend:function(b){var x=a(this);return b&&x.mixIn(b),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var b=this.extend();return b.init.apply(b,arguments),b},init:function(){},mixIn:function(b){for(var x in b)b.hasOwnProperty(x)&&(this[x]=b[x]);b.hasOwnProperty("toString")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=u.WordArray=h.extend({init:function(b,x){b=this.words=b||[],x!=i?this.sigBytes=x:this.sigBytes=b.length*4},toString:function(b){return(b||l).stringify(this)},concat:function(b){var x=this.words,y=b.words,E=this.sigBytes,I=b.sigBytes;if(this.clamp(),E%4)for(var w=0;w<I;w++){var R=y[w>>>2]>>>24-w%4*8&255;x[E+w>>>2]|=R<<24-(E+w)%4*8}else for(var L=0;L<I;L+=4)x[E+L>>>2]=y[L>>>2];return this.sigBytes+=I,this},clamp:function(){var b=this.words,x=this.sigBytes;b[x>>>2]&=4294967295<<32-x%4*8,b.length=t.ceil(x/4)},clone:function(){var b=h.clone.call(this);return b.words=this.words.slice(0),b},random:function(b){for(var x=[],y=0;y<b;y+=4)x.push(n());return new g.init(x,b)}}),f=o.enc={},l=f.Hex={stringify:function(b){for(var x=b.words,y=b.sigBytes,E=[],I=0;I<y;I++){var w=x[I>>>2]>>>24-I%4*8&255;E.push((w>>>4).toString(16)),E.push((w&15).toString(16))}return E.join("")},parse:function(b){for(var x=b.length,y=[],E=0;E<x;E+=2)y[E>>>3]|=parseInt(b.substr(E,2),16)<<24-E%8*4;return new g.init(y,x/2)}},p=f.Latin1={stringify:function(b){for(var x=b.words,y=b.sigBytes,E=[],I=0;I<y;I++){var w=x[I>>>2]>>>24-I%4*8&255;E.push(String.fromCharCode(w))}return E.join("")},parse:function(b){for(var x=b.length,y=[],E=0;E<x;E++)y[E>>>2]|=(b.charCodeAt(E)&255)<<24-E%4*8;return new g.init(y,x)}},d=f.Utf8={stringify:function(b){try{return decodeURIComponent(escape(p.stringify(b)))}catch(x){throw new Error("Malformed UTF-8 data")}},parse:function(b){return p.parse(unescape(encodeURIComponent(b)))}},m=u.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(b){typeof b=="string"&&(b=d.parse(b)),this._data.concat(b),this._nDataBytes+=b.sigBytes},_process:function(b){var x,y=this._data,E=y.words,I=y.sigBytes,w=this.blockSize,R=w*4,L=I/R;b?L=t.ceil(L):L=t.max((L|0)-this._minBufferSize,0);var D=L*w,N=t.min(D*4,I);if(D){for(var C=0;C<D;C+=w)this._doProcessBlock(E,C);x=E.splice(0,D),y.sigBytes-=N}return new g.init(x,N)},clone:function(){var b=h.clone.call(this);return b._data=this._data.clone(),b},_minBufferSize:0});u.Hasher=m.extend({cfg:h.extend(),init:function(b){this.cfg=this.cfg.extend(b),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(b){return this._append(b),this._process(),this},finalize:function(b){b&&this._append(b);var x=this._doFinalize();return x},blockSize:16,_createHelper:function(b){return function(x,y){return new b.init(y).finalize(x)}},_createHmacHelper:function(b){return function(x,y){return new v.HMAC.init(b,y).finalize(x)}}});var v=o.algo={};return o}(Math);return e})}(Er)),Er.exports}var wr={exports:{}},Tn;function Oi(){return Tn||(Tn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(t){var i=e,r=i.lib,n=r.Base,a=r.WordArray,o=i.x64={};o.Word=n.extend({init:function(u,h){this.high=u,this.low=h}}),o.WordArray=n.extend({init:function(u,h){u=this.words=u||[],h!=t?this.sigBytes=h:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,h=u.length,g=[],f=0;f<h;f++){var l=u[f];g.push(l.high),g.push(l.low)}return a.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})}(wr)),wr.exports}var Cr={exports:{}},kn;function ic(){return kn||(kn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){if(typeof ArrayBuffer=="function"){var t=e,i=t.lib,r=i.WordArray,n=r.init,a=r.init=function(o){if(o instanceof ArrayBuffer&&(o=new Uint8Array(o)),(o instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&o instanceof Uint8ClampedArray||o instanceof Int16Array||o instanceof Uint16Array||o instanceof Int32Array||o instanceof Uint32Array||o instanceof Float32Array||o instanceof Float64Array)&&(o=new Uint8Array(o.buffer,o.byteOffset,o.byteLength)),o instanceof Uint8Array){for(var u=o.byteLength,h=[],g=0;g<u;g++)h[g>>>2]|=o[g]<<24-g%4*8;n.call(this,h,u)}else n.apply(this,arguments)};a.prototype=r}}(),e.lib.WordArray})}(Cr)),Cr.exports}var Ir={exports:{}},Pn;function rc(){return Pn||(Pn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Utf16=n.Utf16BE={stringify:function(o){for(var u=o.words,h=o.sigBytes,g=[],f=0;f<h;f+=2){var l=u[f>>>2]>>>16-f%4*8&65535;g.push(String.fromCharCode(l))}return g.join("")},parse:function(o){for(var u=o.length,h=[],g=0;g<u;g++)h[g>>>1]|=o.charCodeAt(g)<<16-g%2*16;return r.create(h,u*2)}},n.Utf16LE={stringify:function(o){for(var u=o.words,h=o.sigBytes,g=[],f=0;f<h;f+=2){var l=a(u[f>>>2]>>>16-f%4*8&65535);g.push(String.fromCharCode(l))}return g.join("")},parse:function(o){for(var u=o.length,h=[],g=0;g<u;g++)h[g>>>1]|=a(o.charCodeAt(g)<<16-g%2*16);return r.create(h,u*2)}};function a(o){return o<<8&4278255360|o>>>8&16711935}}(),e.enc.Utf16})}(Ir)),Ir.exports}var Rr={exports:{}},Bn;function qt(){return Bn||(Bn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Base64={stringify:function(o){var u=o.words,h=o.sigBytes,g=this._map;o.clamp();for(var f=[],l=0;l<h;l+=3)for(var p=u[l>>>2]>>>24-l%4*8&255,d=u[l+1>>>2]>>>24-(l+1)%4*8&255,m=u[l+2>>>2]>>>24-(l+2)%4*8&255,v=p<<16|d<<8|m,b=0;b<4&&l+b*.75<h;b++)f.push(g.charAt(v>>>6*(3-b)&63));var x=g.charAt(64);if(x)for(;f.length%4;)f.push(x);return f.join("")},parse:function(o){var u=o.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 l=h.charAt(64);if(l){var p=o.indexOf(l);p!==-1&&(u=p)}return a(o,u,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(o,u,h){for(var g=[],f=0,l=0;l<u;l++)if(l%4){var p=h[o.charCodeAt(l-1)]<<l%4*2,d=h[o.charCodeAt(l)]>>>6-l%4*2,m=p|d;g[f>>>2]|=m<<24-f%4*8,f++}return r.create(g,f)}}(),e.enc.Base64})}(Rr)),Rr.exports}var Dr={exports:{}},Ln;function sc(){return Ln||(Ln=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Base64url={stringify:function(o,u){u===void 0&&(u=!0);var h=o.words,g=o.sigBytes,f=u?this._safe_map:this._map;o.clamp();for(var l=[],p=0;p<g;p+=3)for(var d=h[p>>>2]>>>24-p%4*8&255,m=h[p+1>>>2]>>>24-(p+1)%4*8&255,v=h[p+2>>>2]>>>24-(p+2)%4*8&255,b=d<<16|m<<8|v,x=0;x<4&&p+x*.75<g;x++)l.push(f.charAt(b>>>6*(3-x)&63));var y=f.charAt(64);if(y)for(;l.length%4;)l.push(y);return l.join("")},parse:function(o,u){u===void 0&&(u=!0);var h=o.length,g=u?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var l=0;l<g.length;l++)f[g.charCodeAt(l)]=l}var p=g.charAt(64);if(p){var d=o.indexOf(p);d!==-1&&(h=d)}return a(o,h,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(o,u,h){for(var g=[],f=0,l=0;l<u;l++)if(l%4){var p=h[o.charCodeAt(l-1)]<<l%4*2,d=h[o.charCodeAt(l)]>>>6-l%4*2,m=p|d;g[f>>>2]|=m<<24-f%4*8,f++}return r.create(g,f)}}(),e.enc.Base64url})}(Dr)),Dr.exports}var Tr={exports:{}},Mn;function Gt(){return Mn||(Mn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,a=r.Hasher,o=i.algo,u=[];(function(){for(var d=0;d<64;d++)u[d]=t.abs(t.sin(d+1))*4294967296|0})();var h=o.MD5=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(d,m){for(var v=0;v<16;v++){var b=m+v,x=d[b];d[b]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}var y=this._hash.words,E=d[m+0],I=d[m+1],w=d[m+2],R=d[m+3],L=d[m+4],D=d[m+5],N=d[m+6],C=d[m+7],M=d[m+8],A=d[m+9],U=d[m+10],ie=d[m+11],q=d[m+12],oe=d[m+13],$=d[m+14],se=d[m+15],k=y[0],P=y[1],z=y[2],F=y[3];k=g(k,P,z,F,E,7,u[0]),F=g(F,k,P,z,I,12,u[1]),z=g(z,F,k,P,w,17,u[2]),P=g(P,z,F,k,R,22,u[3]),k=g(k,P,z,F,L,7,u[4]),F=g(F,k,P,z,D,12,u[5]),z=g(z,F,k,P,N,17,u[6]),P=g(P,z,F,k,C,22,u[7]),k=g(k,P,z,F,M,7,u[8]),F=g(F,k,P,z,A,12,u[9]),z=g(z,F,k,P,U,17,u[10]),P=g(P,z,F,k,ie,22,u[11]),k=g(k,P,z,F,q,7,u[12]),F=g(F,k,P,z,oe,12,u[13]),z=g(z,F,k,P,$,17,u[14]),P=g(P,z,F,k,se,22,u[15]),k=f(k,P,z,F,I,5,u[16]),F=f(F,k,P,z,N,9,u[17]),z=f(z,F,k,P,ie,14,u[18]),P=f(P,z,F,k,E,20,u[19]),k=f(k,P,z,F,D,5,u[20]),F=f(F,k,P,z,U,9,u[21]),z=f(z,F,k,P,se,14,u[22]),P=f(P,z,F,k,L,20,u[23]),k=f(k,P,z,F,A,5,u[24]),F=f(F,k,P,z,$,9,u[25]),z=f(z,F,k,P,R,14,u[26]),P=f(P,z,F,k,M,20,u[27]),k=f(k,P,z,F,oe,5,u[28]),F=f(F,k,P,z,w,9,u[29]),z=f(z,F,k,P,C,14,u[30]),P=f(P,z,F,k,q,20,u[31]),k=l(k,P,z,F,D,4,u[32]),F=l(F,k,P,z,M,11,u[33]),z=l(z,F,k,P,ie,16,u[34]),P=l(P,z,F,k,$,23,u[35]),k=l(k,P,z,F,I,4,u[36]),F=l(F,k,P,z,L,11,u[37]),z=l(z,F,k,P,C,16,u[38]),P=l(P,z,F,k,U,23,u[39]),k=l(k,P,z,F,oe,4,u[40]),F=l(F,k,P,z,E,11,u[41]),z=l(z,F,k,P,R,16,u[42]),P=l(P,z,F,k,N,23,u[43]),k=l(k,P,z,F,A,4,u[44]),F=l(F,k,P,z,q,11,u[45]),z=l(z,F,k,P,se,16,u[46]),P=l(P,z,F,k,w,23,u[47]),k=p(k,P,z,F,E,6,u[48]),F=p(F,k,P,z,C,10,u[49]),z=p(z,F,k,P,$,15,u[50]),P=p(P,z,F,k,D,21,u[51]),k=p(k,P,z,F,q,6,u[52]),F=p(F,k,P,z,R,10,u[53]),z=p(z,F,k,P,U,15,u[54]),P=p(P,z,F,k,I,21,u[55]),k=p(k,P,z,F,M,6,u[56]),F=p(F,k,P,z,se,10,u[57]),z=p(z,F,k,P,N,15,u[58]),P=p(P,z,F,k,oe,21,u[59]),k=p(k,P,z,F,L,6,u[60]),F=p(F,k,P,z,ie,10,u[61]),z=p(z,F,k,P,w,15,u[62]),P=p(P,z,F,k,A,21,u[63]),y[0]=y[0]+k|0,y[1]=y[1]+P|0,y[2]=y[2]+z|0,y[3]=y[3]+F|0},_doFinalize:function(){var d=this._data,m=d.words,v=this._nDataBytes*8,b=d.sigBytes*8;m[b>>>5]|=128<<24-b%32;var x=t.floor(v/4294967296),y=v;m[(b+64>>>9<<4)+15]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,m[(b+64>>>9<<4)+14]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,d.sigBytes=(m.length+1)*4,this._process();for(var E=this._hash,I=E.words,w=0;w<4;w++){var R=I[w];I[w]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360}return E},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});function g(d,m,v,b,x,y,E){var I=d+(m&v|~m&b)+x+E;return(I<<y|I>>>32-y)+m}function f(d,m,v,b,x,y,E){var I=d+(m&b|v&~b)+x+E;return(I<<y|I>>>32-y)+m}function l(d,m,v,b,x,y,E){var I=d+(m^v^b)+x+E;return(I<<y|I>>>32-y)+m}function p(d,m,v,b,x,y,E){var I=d+(v^(m|~b))+x+E;return(I<<y|I>>>32-y)+m}i.MD5=a._createHelper(h),i.HmacMD5=a._createHmacHelper(h)}(Math),e.MD5})}(Tr)),Tr.exports}var kr={exports:{}},Nn;function Fn(){return Nn||(Nn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=i.Hasher,a=t.algo,o=[],u=a.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,l=f[0],p=f[1],d=f[2],m=f[3],v=f[4],b=0;b<80;b++){if(b<16)o[b]=h[g+b]|0;else{var x=o[b-3]^o[b-8]^o[b-14]^o[b-16];o[b]=x<<1|x>>>31}var y=(l<<5|l>>>27)+v+o[b];b<20?y+=(p&d|~p&m)+1518500249:b<40?y+=(p^d^m)+1859775393:b<60?y+=(p&d|p&m|d&m)-1894007588:y+=(p^d^m)-899497514,v=m,m=d,d=p<<30|p>>>2,p=l,l=y}f[0]=f[0]+l|0,f[1]=f[1]+p|0,f[2]=f[2]+d|0,f[3]=f[3]+m|0,f[4]=f[4]+v|0},_doFinalize:function(){var h=this._data,g=h.words,f=this._nDataBytes*8,l=h.sigBytes*8;return g[l>>>5]|=128<<24-l%32,g[(l+64>>>9<<4)+14]=Math.floor(f/4294967296),g[(l+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})}(kr)),kr.exports}var Pr={exports:{}},On;function Br(){return On||(On=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,a=r.Hasher,o=i.algo,u=[],h=[];(function(){function l(v){for(var b=t.sqrt(v),x=2;x<=b;x++)if(!(v%x))return!1;return!0}function p(v){return(v-(v|0))*4294967296|0}for(var d=2,m=0;m<64;)l(d)&&(m<8&&(u[m]=p(t.pow(d,1/2))),h[m]=p(t.pow(d,1/3)),m++),d++})();var g=[],f=o.SHA256=a.extend({_doReset:function(){this._hash=new n.init(u.slice(0))},_doProcessBlock:function(l,p){for(var d=this._hash.words,m=d[0],v=d[1],b=d[2],x=d[3],y=d[4],E=d[5],I=d[6],w=d[7],R=0;R<64;R++){if(R<16)g[R]=l[p+R]|0;else{var L=g[R-15],D=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,N=g[R-2],C=(N<<15|N>>>17)^(N<<13|N>>>19)^N>>>10;g[R]=D+g[R-7]+C+g[R-16]}var M=y&E^~y&I,A=m&v^m&b^v&b,U=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),ie=(y<<26|y>>>6)^(y<<21|y>>>11)^(y<<7|y>>>25),q=w+ie+M+h[R]+g[R],oe=U+A;w=I,I=E,E=y,y=x+q|0,x=b,b=v,v=m,m=q+oe|0}d[0]=d[0]+m|0,d[1]=d[1]+v|0,d[2]=d[2]+b|0,d[3]=d[3]+x|0,d[4]=d[4]+y|0,d[5]=d[5]+E|0,d[6]=d[6]+I|0,d[7]=d[7]+w|0},_doFinalize:function(){var l=this._data,p=l.words,d=this._nDataBytes*8,m=l.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=t.floor(d/4294967296),p[(m+64>>>9<<4)+15]=d,l.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var l=a.clone.call(this);return l._hash=this._hash.clone(),l}});i.SHA256=a._createHelper(f),i.HmacSHA256=a._createHmacHelper(f)}(Math),e.SHA256})}(Pr)),Pr.exports}var Lr={exports:{}},Vn;function nc(){return Vn||(Vn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Br())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.algo,a=n.SHA256,o=n.SHA224=a.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=a._doFinalize.call(this);return u.sigBytes-=4,u}});t.SHA224=a._createHelper(o),t.HmacSHA224=a._createHmacHelper(o)}(),e.SHA224})}(Lr)),Lr.exports}var Mr={exports:{}},Un;function Hn(){return Un||(Un=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Oi())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.Hasher,n=t.x64,a=n.Word,o=n.WordArray,u=t.algo;function h(){return a.create.apply(a,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 l=u.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(p,d){for(var m=this._hash.words,v=m[0],b=m[1],x=m[2],y=m[3],E=m[4],I=m[5],w=m[6],R=m[7],L=v.high,D=v.low,N=b.high,C=b.low,M=x.high,A=x.low,U=y.high,ie=y.low,q=E.high,oe=E.low,$=I.high,se=I.low,k=w.high,P=w.low,z=R.high,F=R.low,K=L,Q=D,ge=N,ce=C,Se=M,De=A,Ie=U,Ue=ie,Te=q,S=oe,J=$,W=se,B=k,T=P,V=z,Z=F,X=0;X<80;X++){var H,ee,le=f[X];if(X<16)ee=le.high=p[d+X*2]|0,H=le.low=p[d+X*2+1]|0;else{var re=f[X-15],me=re.high,we=re.low,ye=(me>>>1|we<<31)^(me>>>8|we<<24)^me>>>7,Qe=(we>>>1|me<<31)^(we>>>8|me<<24)^(we>>>7|me<<25),Ct=f[X-2],Fe=Ct.high,ut=Ct.low,Ne=(Fe>>>19|ut<<13)^(Fe<<3|ut>>>29)^Fe>>>6,It=(ut>>>19|Fe<<13)^(ut<<3|Fe>>>29)^(ut>>>6|Fe<<26),li=f[X-7],yt=li.high,Xi=li.low,Zi=f[X-16],Ms=Zi.high,Yi=Zi.low;H=Qe+Xi,ee=ye+yt+(H>>>0<Qe>>>0?1:0),H=H+It,ee=ee+Ne+(H>>>0<It>>>0?1:0),H=H+Yi,ee=ee+Ms+(H>>>0<Yi>>>0?1:0),le.high=ee,le.low=H}var Qi=Te&J^~Te&B,Ht=S&W^~S&T,fi=K&ge^K&Se^ge&Se,lu=Q&ce^Q&De^ce&De,fu=(K>>>28|Q<<4)^(K<<30|Q>>>2)^(K<<25|Q>>>7),eo=(Q>>>28|K<<4)^(Q<<30|K>>>2)^(Q<<25|K>>>7),pu=(Te>>>14|S<<18)^(Te>>>18|S<<14)^(Te<<23|S>>>9),mu=(S>>>14|Te<<18)^(S>>>18|Te<<14)^(S<<23|Te>>>9),to=g[X],gu=to.high,io=to.low,ft=Z+mu,zt=V+pu+(ft>>>0<Z>>>0?1:0),ft=ft+Ht,zt=zt+Qi+(ft>>>0<Ht>>>0?1:0),ft=ft+io,zt=zt+gu+(ft>>>0<io>>>0?1:0),ft=ft+H,zt=zt+ee+(ft>>>0<H>>>0?1:0),ro=eo+lu,bu=fu+fi+(ro>>>0<eo>>>0?1:0);V=B,Z=T,B=J,T=W,J=Te,W=S,S=Ue+ft|0,Te=Ie+zt+(S>>>0<Ue>>>0?1:0)|0,Ie=Se,Ue=De,Se=ge,De=ce,ge=K,ce=Q,Q=ft+ro|0,K=zt+bu+(Q>>>0<ft>>>0?1:0)|0}D=v.low=D+Q,v.high=L+K+(D>>>0<Q>>>0?1:0),C=b.low=C+ce,b.high=N+ge+(C>>>0<ce>>>0?1:0),A=x.low=A+De,x.high=M+Se+(A>>>0<De>>>0?1:0),ie=y.low=ie+Ue,y.high=U+Ie+(ie>>>0<Ue>>>0?1:0),oe=E.low=oe+S,E.high=q+Te+(oe>>>0<S>>>0?1:0),se=I.low=se+W,I.high=$+J+(se>>>0<W>>>0?1:0),P=w.low=P+T,w.high=k+B+(P>>>0<T>>>0?1:0),F=R.low=F+Z,R.high=z+V+(F>>>0<Z>>>0?1:0)},_doFinalize:function(){var p=this._data,d=p.words,m=this._nDataBytes*8,v=p.sigBytes*8;d[v>>>5]|=128<<24-v%32,d[(v+128>>>10<<5)+30]=Math.floor(m/4294967296),d[(v+128>>>10<<5)+31]=m,p.sigBytes=d.length*4,this._process();var b=this._hash.toX32();return b},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p},blockSize:1024/32});t.SHA512=r._createHelper(l),t.HmacSHA512=r._createHmacHelper(l)}(),e.SHA512})}(Mr)),Mr.exports}var Nr={exports:{}},zn;function ac(){return zn||(zn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Oi(),Hn())})(_e,function(e){return function(){var t=e,i=t.x64,r=i.Word,n=i.WordArray,a=t.algo,o=a.SHA512,u=a.SHA384=o.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=o._doFinalize.call(this);return h.sigBytes-=16,h}});t.SHA384=o._createHelper(u),t.HmacSHA384=o._createHmacHelper(u)}(),e.SHA384})}(Nr)),Nr.exports}var Fr={exports:{}},jn;function oc(){return jn||(jn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Oi())})(_e,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,a=r.Hasher,o=i.x64,u=o.Word,h=i.algo,g=[],f=[],l=[];(function(){for(var m=1,v=0,b=0;b<24;b++){g[m+5*v]=(b+1)*(b+2)/2%64;var x=v%5,y=(2*m+3*v)%5;m=x,v=y}for(var m=0;m<5;m++)for(var v=0;v<5;v++)f[m+5*v]=v+(2*m+3*v)%5*5;for(var E=1,I=0;I<24;I++){for(var w=0,R=0,L=0;L<7;L++){if(E&1){var D=(1<<L)-1;D<32?R^=1<<D:w^=1<<D-32}E&128?E=E<<1^113:E<<=1}l[I]=u.create(w,R)}})();var p=[];(function(){for(var m=0;m<25;m++)p[m]=u.create()})();var d=h.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],v=0;v<25;v++)m[v]=new u.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,v){for(var b=this._state,x=this.blockSize/2,y=0;y<x;y++){var E=m[v+2*y],I=m[v+2*y+1];E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360;var w=b[y];w.high^=I,w.low^=E}for(var R=0;R<24;R++){for(var L=0;L<5;L++){for(var D=0,N=0,C=0;C<5;C++){var w=b[L+5*C];D^=w.high,N^=w.low}var M=p[L];M.high=D,M.low=N}for(var L=0;L<5;L++)for(var A=p[(L+4)%5],U=p[(L+1)%5],ie=U.high,q=U.low,D=A.high^(ie<<1|q>>>31),N=A.low^(q<<1|ie>>>31),C=0;C<5;C++){var w=b[L+5*C];w.high^=D,w.low^=N}for(var oe=1;oe<25;oe++){var D,N,w=b[oe],$=w.high,se=w.low,k=g[oe];k<32?(D=$<<k|se>>>32-k,N=se<<k|$>>>32-k):(D=se<<k-32|$>>>64-k,N=$<<k-32|se>>>64-k);var P=p[f[oe]];P.high=D,P.low=N}var z=p[0],F=b[0];z.high=F.high,z.low=F.low;for(var L=0;L<5;L++)for(var C=0;C<5;C++){var oe=L+5*C,w=b[oe],K=p[oe],Q=p[(L+1)%5+5*C],ge=p[(L+2)%5+5*C];w.high=K.high^~Q.high&ge.high,w.low=K.low^~Q.low&ge.low}var w=b[0],ce=l[R];w.high^=ce.high,w.low^=ce.low}},_doFinalize:function(){var m=this._data,v=m.words;this._nDataBytes*8;var b=m.sigBytes*8,x=this.blockSize*32;v[b>>>5]|=1<<24-b%32,v[(t.ceil((b+1)/x)*x>>>5)-1]|=128,m.sigBytes=v.length*4,this._process();for(var y=this._state,E=this.cfg.outputLength/8,I=E/8,w=[],R=0;R<I;R++){var L=y[R],D=L.high,N=L.low;D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,w.push(N),w.push(D)}return new n.init(w,E)},clone:function(){for(var m=a.clone.call(this),v=m._state=this._state.slice(0),b=0;b<25;b++)v[b]=v[b].clone();return m}});i.SHA3=a._createHelper(d),i.HmacSHA3=a._createHmacHelper(d)}(Math),e.SHA3})}(Fr)),Fr.exports}var Or={exports:{}},Wn;function cc(){return Wn||(Wn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){/** @preserve
16
+ */(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 gi=="function"&&gi;if(!h&&g)return g(u,!0);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var l=i[u]={exports:{}};t[u][0].call(l.exports,function(p){var d=t[u][1][p];return n(d||p)},l,l.exports,e,t,i,r)}return i[u].exports}for(var a=typeof gi=="function"&&gi,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(o){for(var u,h,g,f,l,p,d,m=[],v=0,b=o.length,x=b,y=r.getTypeOf(o)!=="string";v<o.length;)x=b-v,g=y?(u=o[v++],h=v<b?o[v++]:0,v<b?o[v++]:0):(u=o.charCodeAt(v++),h=v<b?o.charCodeAt(v++):0,v<b?o.charCodeAt(v++):0),f=u>>2,l=(3&u)<<4|h>>4,p=1<x?(15&h)<<2|g>>6:64,d=2<x?63&g:64,m.push(a.charAt(f)+a.charAt(l)+a.charAt(p)+a.charAt(d));return m.join("")},i.decode=function(o){var u,h,g,f,l,p,d=0,m=0,v="data:";if(o.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var b,x=3*(o=o.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(o.charAt(o.length-1)===a.charAt(64)&&x--,o.charAt(o.length-2)===a.charAt(64)&&x--,x%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=n.uint8array?new Uint8Array(0|x):new Array(0|x);d<o.length;)u=a.indexOf(o.charAt(d++))<<2|(f=a.indexOf(o.charAt(d++)))>>4,h=(15&f)<<4|(l=a.indexOf(o.charAt(d++)))>>2,g=(3&l)<<6|(p=a.indexOf(o.charAt(d++))),b[m++]=u,l!==64&&(b[m++]=h),p!==64&&(b[m++]=g);return b}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function u(h,g,f,l,p){this.compressedSize=h,this.uncompressedSize=g,this.crc32=f,this.compression=l,this.compressedContent=p}u.prototype={getContentWorker:function(){var h=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("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 a).pipe(new o("uncompressedSize")).pipe(g.compressWorker(f)).pipe(new o("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 a,o=[],u=0;u<256;u++){a=u;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;o[u]=a}return o}();t.exports=function(a,o){return a!==void 0&&a.length?r.getTypeOf(a)!=="string"?function(u,h,g,f){var l=n,p=f+g;u^=-1;for(var d=f;d<p;d++)u=u>>>8^l[255&(u^h[d])];return-1^u}(0|o,a,a.length,0):function(u,h,g,f){var l=n,p=f+g;u^=-1;for(var d=f;d<p;d++)u=u>>>8^l[255&(u^h.charCodeAt(d))];return-1^u}(0|o,a,a.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"),a=e("./utils"),o=e("./stream/GenericWorker"),u=r?"uint8array":"array";function h(g,f){o.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(h,o),h.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,g.data),!1)},h.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var 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(l,p){var d,m="";for(d=0;d<p;d++)m+=String.fromCharCode(255&l),l>>>=8;return m}function n(l,p,d,m,v,b){var x,y,E=l.file,I=l.compression,w=b!==u.utf8encode,R=a.transformTo("string",b(E.name)),L=a.transformTo("string",u.utf8encode(E.name)),D=E.comment,N=a.transformTo("string",b(D)),C=a.transformTo("string",u.utf8encode(D)),M=L.length!==E.name.length,A=C.length!==D.length,U="",ie="",q="",oe=E.dir,$=E.date,se={crc32:0,compressedSize:0,uncompressedSize:0};p&&!d||(se.crc32=l.crc32,se.compressedSize=l.compressedSize,se.uncompressedSize=l.uncompressedSize);var k=0;p&&(k|=8),w||!M&&!A||(k|=2048);var P=0,j=0;oe&&(P|=16),v==="UNIX"?(j=798,P|=function(K,Q){var ge=K;return K||(ge=Q?16893:33204),(65535&ge)<<16}(E.unixPermissions,oe)):(j=20,P|=function(K){return 63&(K||0)}(E.dosPermissions)),x=$.getUTCHours(),x<<=6,x|=$.getUTCMinutes(),x<<=5,x|=$.getUTCSeconds()/2,y=$.getUTCFullYear()-1980,y<<=4,y|=$.getUTCMonth()+1,y<<=5,y|=$.getUTCDate(),M&&(ie=r(1,1)+r(h(R),4)+L,U+="up"+r(ie.length,2)+ie),A&&(q=r(1,1)+r(h(N),4)+C,U+="uc"+r(q.length,2)+q);var F="";return F+=`
17
+ \0`,F+=r(k,2),F+=I.magic,F+=r(x,2),F+=r(y,2),F+=r(se.crc32,4),F+=r(se.compressedSize,4),F+=r(se.uncompressedSize,4),F+=r(R.length,2),F+=r(U.length,2),{fileRecord:g.LOCAL_FILE_HEADER+F+R+U,dirRecord:g.CENTRAL_FILE_HEADER+r(j,2)+F+r(N.length,2)+"\0\0\0\0"+r(P,4)+r(m,4)+R+U+N}}var a=e("../utils"),o=e("../stream/GenericWorker"),u=e("../utf8"),h=e("../crc32"),g=e("../signature");function f(l,p,d,m){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=d,this.encodeFileName=m,this.streamFiles=l,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,o),f.prototype.push=function(l){var p=l.meta.percent||0,d=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(l):(this.bytesWritten+=l.data.length,o.prototype.push.call(this,{data:l.data,meta:{currentFile:this.currentFile,percent:d?(p+100*(d-m-1))/d:100}}))},f.prototype.openedSource=function(l){this.currentSourceOffset=this.bytesWritten,this.currentFile=l.file.name;var p=this.streamFiles&&!l.file.dir;if(p){var d=n(l,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(l){this.accumulate=!1;var p=this.streamFiles&&!l.file.dir,d=n(l,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),p)this.push({data:function(m){return g.DATA_DESCRIPTOR+r(m.crc32,4)+r(m.compressedSize,4)+r(m.uncompressedSize,4)}(l),meta:{percent:100}});else for(this.push({data:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var l=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var d=this.bytesWritten-l,m=function(v,b,x,y,E){var I=a.transformTo("string",E(y));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(v,2)+r(v,2)+r(b,4)+r(x,4)+r(I.length,2)+I}(this.dirRecords.length,d,l,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(l){this._sources.push(l);var p=this;return l.on("data",function(d){p.processChunk(d)}),l.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),l.on("error",function(d){p.error(d)}),this},f.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(l){var p=this._sources;if(!o.prototype.error.call(this,l))return!1;for(var d=0;d<p.length;d++)try{p[d].error(l)}catch(m){}return!0},f.prototype.lock=function(){o.prototype.lock.call(this);for(var l=this._sources,p=0;p<l.length;p++)l[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(a,o,u){var h=new n(o.streamFiles,u,o.platform,o.encodeFileName),g=0;try{a.forEach(function(f,l){g++;var p=function(b,x){var y=b||x,E=r[y];if(!E)throw new Error(y+" is not a valid compression method !");return E}(l.options.compression,o.compression),d=l.options.compressionOptions||o.compressionOptions||{},m=l.dir,v=l.date;l._compressWorker(p,d).withStreamInfo("file",{name:f,dir:m,date:v,comment:l.comment||"",unixPermissions:l.unixPermissions,dosPermissions:l.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 a in this)typeof this[a]!="function"&&(n[a]=this[a]);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,a){return new r().loadAsync(n,a)},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"),a=e("./utf8"),o=e("./zipEntries"),u=e("./stream/Crc32Probe"),h=e("./nodejsUtils");function g(f){return new n.Promise(function(l,p){var d=f.decompressed.getContentWorker().pipe(new u);d.on("error",function(m){p(m)}).on("end",function(){d.streamInfo.crc32!==f.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):l()}).resume()})}t.exports=function(f,l){var p=this;return l=r.extend(l||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(f)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",f,!0,l.optimizedBinaryString,l.base64).then(function(d){var m=new o(l);return m.load(d),m}).then(function(d){var m=[n.Promise.resolve(d)],v=d.files;if(l.checkCRC32)for(var b=0;b<v.length;b++)m.push(g(v[b]));return n.Promise.all(m)}).then(function(d){for(var m=d.shift(),v=m.files,b=0;b<v.length;b++){var x=v[b],y=x.fileNameStr,E=r.resolve(x.fileNameStr);p.file(E,x.decompressed,{binary:!0,optimizedBinaryString:!0,date:x.date,dir:x.dir,comment:x.fileCommentStr.length?x.fileCommentStr:null,unixPermissions:x.unixPermissions,dosPermissions:x.dosPermissions,createFolders:l.createFolders}),x.dir||(p.file(E).unsafeOriginalName=y)}return m.zipComment.length&&(p.comment=m.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function a(o,u){n.call(this,"Nodejs stream input adapter for "+o),this._upstreamEnded=!1,this._bindStream(u)}r.inherits(a,n),a.prototype._bindStream=function(o){var u=this;(this._stream=o).pause(),o.on("data",function(h){u.push({data:h,meta:{percent:0}})}).on("error",function(h){u.isPaused?this.generatedError=h:u.error(h)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(a,o,u){r.call(this,o),this._helper=a;var h=this;a.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(E,I,w){var R,L=a.getTypeOf(I),D=a.extend(w||{},h);D.date=D.date||new Date,D.compression!==null&&(D.compression=D.compression.toUpperCase()),typeof D.unixPermissions=="string"&&(D.unixPermissions=parseInt(D.unixPermissions,8)),D.unixPermissions&&16384&D.unixPermissions&&(D.dir=!0),D.dosPermissions&&16&D.dosPermissions&&(D.dir=!0),D.dir&&(E=v(E)),D.createFolders&&(R=m(E))&&b.call(this,R,!0);var N=L==="string"&&D.binary===!1&&D.base64===!1;w&&w.binary!==void 0||(D.binary=!N),(I instanceof g&&I.uncompressedSize===0||D.dir||!I||I.length===0)&&(D.base64=!1,D.binary=!0,I="",D.compression="STORE",L="string");var C=null;C=I instanceof g||I instanceof o?I:p.isNode&&p.isStream(I)?new d(E,I):a.prepareContent(E,I,D.binary,D.optimizedBinaryString,D.base64);var M=new f(E,C,D);this.files[E]=M}var n=e("./utf8"),a=e("./utils"),o=e("./stream/GenericWorker"),u=e("./stream/StreamHelper"),h=e("./defaults"),g=e("./compressedObject"),f=e("./zipObject"),l=e("./generate"),p=e("./nodejsUtils"),d=e("./nodejs/NodejsStreamInputAdapter"),m=function(E){E.slice(-1)==="/"&&(E=E.substring(0,E.length-1));var I=E.lastIndexOf("/");return 0<I?E.substring(0,I):""},v=function(E){return E.slice(-1)!=="/"&&(E+="/"),E},b=function(E,I){return I=I!==void 0?I:h.createFolders,E=v(E),this.files[E]||r.call(this,E,null,{dir:!0,createFolders:I}),this.files[E]};function x(E){return Object.prototype.toString.call(E)==="[object RegExp]"}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(E){var I,w,R;for(I in this.files)R=this.files[I],(w=I.slice(this.root.length,I.length))&&I.slice(0,this.root.length)===this.root&&E(w,R)},filter:function(E){var I=[];return this.forEach(function(w,R){E(w,R)&&I.push(R)}),I},file:function(E,I,w){if(arguments.length!==1)return E=this.root+E,r.call(this,E,I,w),this;if(x(E)){var R=E;return this.filter(function(D,N){return!N.dir&&R.test(D)})}var L=this.files[this.root+E];return L&&!L.dir?L:null},folder:function(E){if(!E)return this;if(x(E))return this.filter(function(L,D){return D.dir&&E.test(L)});var I=this.root+E,w=b.call(this,I),R=this.clone();return R.root=w.name,R},remove:function(E){E=this.root+E;var I=this.files[E];if(I||(E.slice(-1)!=="/"&&(E+="/"),I=this.files[E]),I&&!I.dir)delete this.files[E];else for(var w=this.filter(function(L,D){return D.name.slice(0,E.length)===E}),R=0;R<w.length;R++)delete this.files[w[R].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(E){var I,w={};try{if((w=a.extend(E||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=w.type.toLowerCase(),w.compression=w.compression.toUpperCase(),w.type==="binarystring"&&(w.type="string"),!w.type)throw new Error("No output type specified.");a.checkSupport(w.type),w.platform!=="darwin"&&w.platform!=="freebsd"&&w.platform!=="linux"&&w.platform!=="sunos"||(w.platform="UNIX"),w.platform==="win32"&&(w.platform="DOS");var R=w.comment||this.comment||"";I=l.generateWorker(this,w,R)}catch(L){(I=new o("error")).error(L)}return new u(I,w.type||"string",w.mimeType)},generateAsync:function(E,I){return this.generateInternalStream(E).accumulate(I)},generateNodeStream:function(E,I){return(E=E||{}).type||(E.type="nodebuffer"),this.generateInternalStream(E).toNodejsStream(I)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(a){r.call(this,a);for(var o=0;o<this.data.length;o++)a[o]=255&a[o]}e("../utils").inherits(n,r),n.prototype.byteAt=function(a){return this.data[this.zero+a]},n.prototype.lastIndexOfSignature=function(a){for(var o=a.charCodeAt(0),u=a.charCodeAt(1),h=a.charCodeAt(2),g=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===o&&this.data[f+1]===u&&this.data[f+2]===h&&this.data[f+3]===g)return f-this.zero;return-1},n.prototype.readAndCheckSignature=function(a){var o=a.charCodeAt(0),u=a.charCodeAt(1),h=a.charCodeAt(2),g=a.charCodeAt(3),f=this.readData(4);return o===f[0]&&u===f[1]&&h===f[2]&&g===f[3]},n.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var o,u=0;for(this.checkOffset(a),o=this.index+a-1;o>=this.index;o--)u=(u<<8)+this.byteAt(o);return this.index+=a,u},readString:function(a){return r.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(a){r.call(this,a)}e("../utils").inherits(n,r),n.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(a){r.call(this,a)}e("../utils").inherits(n,r),n.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},n.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},n.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},n.prototype.readData=function(a){this.checkOffset(a);var o=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(a){r.call(this,a)}e("../utils").inherits(n,r),n.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var o=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,o},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),a=e("./ArrayReader"),o=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 a(r.transformTo("array",g)):new o(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 a(o){r.call(this,"ConvertWorker to "+o),this.destType=o}n.inherits(a,r),a.prototype.processChunk=function(o){this.push({data:n.transformTo(this.destType,o.data),meta:o.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(o){this.streamInfo.crc32=n(o.data,this.streamInfo.crc32||0),this.push(o)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(o){n.call(this,"DataLengthProbe for "+o),this.propName=o,this.withStreamInfo(o,0)}r.inherits(a,n),a.prototype.processChunk=function(o){if(o){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+o.data.length}n.prototype.processChunk.call(this,o)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(o){n.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,o.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=r.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}r.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var o=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":o=this.data.substring(this.index,u);break;case"uint8array":o=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":o=this.data.slice(this.index,u)}return this.index=u,this.push({data:o,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,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,a){return this._listeners[n].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(n,a){if(this._listeners[n])for(var o=0;o<this._listeners[n].length;o++)this._listeners[n][o].call(this,a)},pipe:function(n){return n.registerPrevious(this)},registerPrevious:function(n){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=n.streamInfo,this.mergeStreamInfo(),this.previous=n;var a=this;return n.on("data",function(o){a.processChunk(o)}),n.on("end",function(){a.end()}),n.on("error",function(o){a.error(o)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var n=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),n=!0),this.previous&&this.previous.resume(),!n},flush:function(){},processChunk:function(n){this.push(n)},withStreamInfo:function(n,a){return this.extraStreamInfo[n]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var n in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,n)&&(this.streamInfo[n]=this.extraStreamInfo[n])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var n="Worker "+this.name;return this.previous?this.previous+" -> "+n:n}},t.exports=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),u=e("../support"),h=e("../external"),g=null;if(u.nodestream)try{g=e("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function f(p,d){return new h.Promise(function(m,v){var b=[],x=p._internalType,y=p._outputType,E=p._mimeType;p.on("data",function(I,w){b.push(I),d&&d(w)}).on("error",function(I){b=[],v(I)}).on("end",function(){try{var I=function(w,R,L){switch(w){case"blob":return r.newBlob(r.transformTo("arraybuffer",R),L);case"base64":return o.encode(R);default:return r.transformTo(w,R)}}(y,function(w,R){var L,D=0,N=null,C=0;for(L=0;L<R.length;L++)C+=R[L].length;switch(w){case"string":return R.join("");case"array":return Array.prototype.concat.apply([],R);case"uint8array":for(N=new Uint8Array(C),L=0;L<R.length;L++)N.set(R[L],D),D+=R[L].length;return N;case"nodebuffer":return Buffer.concat(R);default:throw new Error("concat : unsupported type '"+w+"'")}}(x,b),E);m(I)}catch(w){v(w)}b=[]}).resume()})}function l(p,d,m){var v=d;switch(d){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=d,this._mimeType=m,r.checkSupport(v),this._worker=p.pipe(new n(v)),p.lock()}catch(b){this._worker=new a("error"),this._worker.error(b)}}l.prototype={accumulate:function(p){return f(this,p)},on:function(p,d){var m=this;return p==="data"?this._worker.on(p,function(v){d.call(m,v.data,v.meta)}):this._worker.on(p,function(){r.delay(d,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=l},{"../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(a){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=n.getBlob("application/zip").size===0}catch(o){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(a){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),u=new Array(256),h=0;h<256;h++)u[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;u[254]=u[254]=1;function g(){o.call(this,"utf-8 decode"),this.leftOver=null}function f(){o.call(this,"utf-8 encode")}i.utf8encode=function(l){return n.nodebuffer?a.newBufferFrom(l,"utf-8"):function(p){var d,m,v,b,x,y=p.length,E=0;for(b=0;b<y;b++)(64512&(m=p.charCodeAt(b)))==55296&&b+1<y&&(64512&(v=p.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(v-56320),b++),E+=m<128?1:m<2048?2:m<65536?3:4;for(d=n.uint8array?new Uint8Array(E):new Array(E),b=x=0;x<E;b++)(64512&(m=p.charCodeAt(b)))==55296&&b+1<y&&(64512&(v=p.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(v-56320),b++),m<128?d[x++]=m:(m<2048?d[x++]=192|m>>>6:(m<65536?d[x++]=224|m>>>12:(d[x++]=240|m>>>18,d[x++]=128|m>>>12&63),d[x++]=128|m>>>6&63),d[x++]=128|63&m);return d}(l)},i.utf8decode=function(l){return n.nodebuffer?r.transformTo("nodebuffer",l).toString("utf-8"):function(p){var d,m,v,b,x=p.length,y=new Array(2*x);for(d=m=0;d<x;)if((v=p[d++])<128)y[m++]=v;else if(4<(b=u[v]))y[m++]=65533,d+=b-1;else{for(v&=b===2?31:b===3?15:7;1<b&&d<x;)v=v<<6|63&p[d++],b--;1<b?y[m++]=65533:v<65536?y[m++]=v:(v-=65536,y[m++]=55296|v>>10&1023,y[m++]=56320|1023&v)}return y.length!==m&&(y.subarray?y=y.subarray(0,m):y.length=m),r.applyFromCharCode(y)}(l=r.transformTo(n.uint8array?"uint8array":"array",l))},r.inherits(g,o),g.prototype.processChunk=function(l){var p=r.transformTo(n.uint8array?"uint8array":"array",l.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var d=p;(p=new Uint8Array(d.length+this.leftOver.length)).set(this.leftOver,0),p.set(d,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var m=function(b,x){var y;for((x=x||b.length)>b.length&&(x=b.length),y=x-1;0<=y&&(192&b[y])==128;)y--;return y<0||y===0?x:y+u[b[y]]>x?y:x}(p),v=p;m!==p.length&&(n.uint8array?(v=p.subarray(0,m),this.leftOver=p.subarray(m,p.length)):(v=p.slice(0,m),this.leftOver=p.slice(m,p.length))),this.push({data:i.utf8decode(v),meta:l.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,o),f.prototype.processChunk=function(l){this.push({data:i.utf8encode(l.data),meta:l.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"),a=e("./nodejsUtils"),o=e("./external");function u(d){return d}function h(d,m){for(var v=0;v<d.length;++v)m[v]=255&d.charCodeAt(v);return m}e("setimmediate"),i.newBlob=function(d,m){i.checkSupport("blob");try{return new Blob([d],{type:m})}catch(b){try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(d),v.getBlob(m)}catch(x){throw new Error("Bug : can't construct the Blob.")}}};var g={stringifyByChunk:function(d,m,v){var b=[],x=0,y=d.length;if(y<=v)return String.fromCharCode.apply(null,d);for(;x<y;)m==="array"||m==="nodebuffer"?b.push(String.fromCharCode.apply(null,d.slice(x,Math.min(x+v,y)))):b.push(String.fromCharCode.apply(null,d.subarray(x,Math.min(x+v,y)))),x+=v;return b.join("")},stringifyByChar:function(d){for(var m="",v=0;v<d.length;v++)m+=String.fromCharCode(d[v]);return m},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(d){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch(d){return!1}}()}};function f(d){var m=65536,v=i.getTypeOf(d),b=!0;if(v==="uint8array"?b=g.applyCanBeUsed.uint8array:v==="nodebuffer"&&(b=g.applyCanBeUsed.nodebuffer),b)for(;1<m;)try{return g.stringifyByChunk(d,v,m)}catch(x){m=Math.floor(m/2)}return g.stringifyByChar(d)}function l(d,m){for(var v=0;v<d.length;v++)m[v]=d[v];return m}i.applyFromCharCode=f;var p={};p.string={string:u,array:function(d){return h(d,new Array(d.length))},arraybuffer:function(d){return p.string.uint8array(d).buffer},uint8array:function(d){return h(d,new Uint8Array(d.length))},nodebuffer:function(d){return h(d,a.allocBuffer(d.length))}},p.array={string:f,array:u,arraybuffer:function(d){return new Uint8Array(d).buffer},uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return a.newBufferFrom(d)}},p.arraybuffer={string:function(d){return f(new Uint8Array(d))},array:function(d){return l(new Uint8Array(d),new Array(d.byteLength))},arraybuffer:u,uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return a.newBufferFrom(new Uint8Array(d))}},p.uint8array={string:f,array:function(d){return l(d,new Array(d.length))},arraybuffer:function(d){return d.buffer},uint8array:u,nodebuffer:function(d){return a.newBufferFrom(d)}},p.nodebuffer={string:f,array:function(d){return l(d,new Array(d.length))},arraybuffer:function(d){return p.nodebuffer.uint8array(d).buffer},uint8array:function(d){return l(d,new Uint8Array(d.length))},nodebuffer:u},i.transformTo=function(d,m){if(m=m||"",!d)return m;i.checkSupport(d);var v=i.getTypeOf(m);return p[v][d](m)},i.resolve=function(d){for(var m=d.split("/"),v=[],b=0;b<m.length;b++){var x=m[b];x==="."||x===""&&b!==0&&b!==m.length-1||(x===".."?v.pop():v.push(x))}return v.join("/")},i.getTypeOf=function(d){return typeof d=="string"?"string":Object.prototype.toString.call(d)==="[object Array]"?"array":r.nodebuffer&&a.isBuffer(d)?"nodebuffer":r.uint8array&&d instanceof Uint8Array?"uint8array":r.arraybuffer&&d instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(d){if(!r[d.toLowerCase()])throw new Error(d+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(d){var m,v,b="";for(v=0;v<(d||"").length;v++)b+="\\x"+((m=d.charCodeAt(v))<16?"0":"")+m.toString(16).toUpperCase();return b},i.delay=function(d,m,v){setImmediate(function(){d.apply(v||null,m||[])})},i.inherits=function(d,m){function v(){}v.prototype=m.prototype,d.prototype=new v},i.extend=function(){var d,m,v={};for(d=0;d<arguments.length;d++)for(m in arguments[d])Object.prototype.hasOwnProperty.call(arguments[d],m)&&v[m]===void 0&&(v[m]=arguments[d][m]);return v},i.prepareContent=function(d,m,v,b,x){return o.Promise.resolve(m).then(function(y){return r.blob&&(y instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(y))!==-1)&&typeof FileReader!="undefined"?new o.Promise(function(E,I){var w=new FileReader;w.onload=function(R){E(R.target.result)},w.onerror=function(R){I(R.target.error)},w.readAsArrayBuffer(y)}):y}).then(function(y){var E=i.getTypeOf(y);return E?(E==="arraybuffer"?y=i.transformTo("uint8array",y):E==="string"&&(x?y=n.decode(y):v&&b!==!0&&(y=function(I){return h(I,r.uint8array?new Uint8Array(I.length):new Array(I.length))}(y))),y):o.Promise.reject(new Error("Can't read the data of '"+d+"'. 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"),a=e("./signature"),o=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 l=this.reader.index;this.reader.setIndex(g);var p=this.reader.readString(4)===f;return this.reader.setIndex(l),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",l=n.transformTo(f,g);this.zipComment=this.loadOptions.decodeFileName(l)},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,l,p=this.zip64EndOfCentralSize-44;0<p;)g=this.reader.readInt(2),f=this.reader.readInt(4),l=this.reader.readData(f),this.zip64ExtensibleData[g]={id:g,length:f,value:l}},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(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(g=new o({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(a.CENTRAL_DIRECTORY_END);if(g<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(g);var f=g;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(g=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(g),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var l=this.centralDirOffset+this.centralDirSize;this.zip64&&(l+=20,l+=12+this.zip64EndOfCentralSize);var p=f-l;if(0<p)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(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"),a=e("./compressedObject"),o=e("./crc32"),u=e("./utf8"),h=e("./compressions"),g=e("./support");function f(l,p){this.options=l,this.loadOptions=p}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(l){var p,d;if(l.skip(22),this.fileNameLength=l.readInt(2),d=l.readInt(2),this.fileName=l.readData(this.fileNameLength),l.skip(d),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 v in h)if(Object.prototype.hasOwnProperty.call(h,v)&&h[v].magic===m)return h[v];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,l.readData(this.compressedSize))},readCentralPart:function(l){this.versionMadeBy=l.readInt(2),l.skip(2),this.bitFlag=l.readInt(2),this.compressionMethod=l.readString(2),this.date=l.readDate(),this.crc32=l.readInt(4),this.compressedSize=l.readInt(4),this.uncompressedSize=l.readInt(4);var p=l.readInt(2);if(this.extraFieldsLength=l.readInt(2),this.fileCommentLength=l.readInt(2),this.diskNumberStart=l.readInt(2),this.internalFileAttributes=l.readInt(2),this.externalFileAttributes=l.readInt(4),this.localHeaderOffset=l.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");l.skip(p),this.readExtraFields(l),this.parseZIP64ExtraField(l),this.fileComment=l.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var l=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),l==0&&(this.dosPermissions=63&this.externalFileAttributes),l==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var l=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=l.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=l.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=l.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=l.readInt(4))}},readExtraFields:function(l){var p,d,m,v=l.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});l.index+4<v;)p=l.readInt(2),d=l.readInt(2),m=l.readData(d),this.extraFields[p]={id:p,length:d,value:m};l.setIndex(v)},handleUTF8:function(){var l=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 d=n.transformTo(l,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(d)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var v=n.transformTo(l,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var l=this.extraFields[28789];if(l){var p=r(l.value);return p.readInt(1)!==1||o(this.fileName)!==p.readInt(4)?null:u.utf8decode(p.readData(l.length-5))}return null},findExtraFieldUnicodeComment:function(){var l=this.extraFields[25461];if(l){var p=r(l.value);return p.readInt(1)!==1||o(this.fileComment)!==p.readInt(4)?null:u.utf8decode(p.readData(l.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,d,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=d,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var n=e("./stream/StreamHelper"),a=e("./stream/DataWorker"),o=e("./utf8"),u=e("./compressedObject"),h=e("./stream/GenericWorker");r.prototype={internalStream:function(p){var d=null,m="string";try{if(!p)throw new Error("No output type specified.");var v=(m=p.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),d=this._decompressWorker();var b=!this._dataBinary;b&&!v&&(d=d.pipe(new o.Utf8EncodeWorker)),!b&&v&&(d=d.pipe(new o.Utf8DecodeWorker))}catch(x){(d=new h("error")).error(x)}return new n(d,m,"")},async:function(p,d){return this.internalStream(p).accumulate(d)},nodeStream:function(p,d){return this.internalStream(p||"nodebuffer").toNodejsStream(d)},_compressWorker:function(p,d){if(this._data instanceof u&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new o.Utf8EncodeWorker)),u.createWorkerFrom(m,p,d)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof h?this._data:new a(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.")},l=0;l<g.length;l++)r.prototype[g[l]]=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,a,o=r.MutationObserver||r.WebKitMutationObserver;if(o){var u=0,h=new o(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 d=r.document.createElement("script");d.onreadystatechange=function(){p(),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},r.document.documentElement.appendChild(d)}:function(){setTimeout(p,0)};else{var f=new r.MessageChannel;f.port1.onmessage=p,n=function(){f.port2.postMessage(0)}}var l=[];function p(){var d,m;a=!0;for(var v=l.length;v;){for(m=l,l=[],d=-1;++d<v;)m[d]();v=l.length}a=!1}t.exports=function(d){l.push(d)!==1||a||n()}}).call(this,typeof _e!="undefined"?_e:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var a={},o=["REJECTED"],u=["FULFILLED"],h=["PENDING"];function g(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,v!==n&&d(this,v)}function f(v,b,x){this.promise=v,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof x=="function"&&(this.onRejected=x,this.callRejected=this.otherCallRejected)}function l(v,b,x){r(function(){var y;try{y=b(x)}catch(E){return a.reject(v,E)}y===v?a.reject(v,new TypeError("Cannot resolve promise with itself")):a.resolve(v,y)})}function p(v){var b=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof b=="function")return function(){b.apply(v,arguments)}}function d(v,b){var x=!1;function y(w){x||(x=!0,a.reject(v,w))}function E(w){x||(x=!0,a.resolve(v,w))}var I=m(function(){b(E,y)});I.status==="error"&&y(I.value)}function m(v,b){var x={};try{x.value=v(b),x.status="success"}catch(y){x.status="error",x.value=y}return x}(t.exports=g).prototype.finally=function(v){if(typeof v!="function")return this;var b=this.constructor;return this.then(function(x){return b.resolve(v()).then(function(){return x})},function(x){return b.resolve(v()).then(function(){throw x})})},g.prototype.catch=function(v){return this.then(null,v)},g.prototype.then=function(v,b){if(typeof v!="function"&&this.state===u||typeof b!="function"&&this.state===o)return this;var x=new this.constructor(n);return this.state!==h?l(x,this.state===u?v:b,this.outcome):this.queue.push(new f(x,v,b)),x},f.prototype.callFulfilled=function(v){a.resolve(this.promise,v)},f.prototype.otherCallFulfilled=function(v){l(this.promise,this.onFulfilled,v)},f.prototype.callRejected=function(v){a.reject(this.promise,v)},f.prototype.otherCallRejected=function(v){l(this.promise,this.onRejected,v)},a.resolve=function(v,b){var x=m(p,b);if(x.status==="error")return a.reject(v,x.value);var y=x.value;if(y)d(v,y);else{v.state=u,v.outcome=b;for(var E=-1,I=v.queue.length;++E<I;)v.queue[E].callFulfilled(b)}return v},a.reject=function(v,b){v.state=o,v.outcome=b;for(var x=-1,y=v.queue.length;++x<y;)v.queue[x].callRejected(b);return v},g.resolve=function(v){return v instanceof this?v:a.resolve(new this(n),v)},g.reject=function(v){var b=new this(n);return a.reject(b,v)},g.all=function(v){var b=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=v.length,y=!1;if(!x)return this.resolve([]);for(var E=new Array(x),I=0,w=-1,R=new this(n);++w<x;)L(v[w],w);return R;function L(D,N){b.resolve(D).then(function(C){E[N]=C,++I!==x||y||(y=!0,a.resolve(R,E))},function(C){y||(y=!0,a.reject(R,C))})}},g.race=function(v){var b=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=v.length,y=!1;if(!x)return this.resolve([]);for(var E=-1,I=new this(n);++E<x;)w=v[E],b.resolve(w).then(function(R){y||(y=!0,a.resolve(I,R))},function(R){y||(y=!0,a.reject(I,R))});var w;return I}},{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"),a=e("./utils/strings"),o=e("./zlib/messages"),u=e("./zlib/zstream"),h=Object.prototype.toString,g=0,f=-1,l=0,p=8;function d(v){if(!(this instanceof d))return new d(v);this.options=n.assign({level:f,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:l,to:""},v||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var x=r.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(x!==g)throw new Error(o[x]);if(b.header&&r.deflateSetHeader(this.strm,b.header),b.dictionary){var y;if(y=typeof b.dictionary=="string"?a.string2buf(b.dictionary):h.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(x=r.deflateSetDictionary(this.strm,y))!==g)throw new Error(o[x]);this._dict_set=!0}}function m(v,b){var x=new d(b);if(x.push(v,!0),x.err)throw x.msg||o[x.err];return x.result}d.prototype.push=function(v,b){var x,y,E=this.strm,I=this.options.chunkSize;if(this.ended)return!1;y=b===~~b?b:b===!0?4:0,typeof v=="string"?E.input=a.string2buf(v):h.call(v)==="[object ArrayBuffer]"?E.input=new Uint8Array(v):E.input=v,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.deflate(E,y))!==1&&x!==g)return this.onEnd(x),!(this.ended=!0);E.avail_out!==0&&(E.avail_in!==0||y!==4&&y!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(n.shrinkBuf(E.output,E.next_out))):this.onData(n.shrinkBuf(E.output,E.next_out)))}while((0<E.avail_in||E.avail_out===0)&&x!==1);return y===4?(x=r.deflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===g):y!==2||(this.onEnd(g),!(E.avail_out=0))},d.prototype.onData=function(v){this.chunks.push(v)},d.prototype.onEnd=function(v){v===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},i.Deflate=d,i.deflate=m,i.deflateRaw=function(v,b){return(b=b||{}).raw=!0,m(v,b)},i.gzip=function(v,b){return(b=b||{}).gzip=!0,m(v,b)}},{"./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"),a=e("./utils/strings"),o=e("./zlib/constants"),u=e("./zlib/messages"),h=e("./zlib/zstream"),g=e("./zlib/gzheader"),f=Object.prototype.toString;function l(d){if(!(this instanceof l))return new l(d);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},d||{});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)||d&&d.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 v=r.inflateInit2(this.strm,m.windowBits);if(v!==o.Z_OK)throw new Error(u[v]);this.header=new g,r.inflateGetHeader(this.strm,this.header)}function p(d,m){var v=new l(m);if(v.push(d,!0),v.err)throw v.msg||u[v.err];return v.result}l.prototype.push=function(d,m){var v,b,x,y,E,I,w=this.strm,R=this.options.chunkSize,L=this.options.dictionary,D=!1;if(this.ended)return!1;b=m===~~m?m:m===!0?o.Z_FINISH:o.Z_NO_FLUSH,typeof d=="string"?w.input=a.binstring2buf(d):f.call(d)==="[object ArrayBuffer]"?w.input=new Uint8Array(d):w.input=d,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new n.Buf8(R),w.next_out=0,w.avail_out=R),(v=r.inflate(w,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&L&&(I=typeof L=="string"?a.string2buf(L):f.call(L)==="[object ArrayBuffer]"?new Uint8Array(L):L,v=r.inflateSetDictionary(this.strm,I)),v===o.Z_BUF_ERROR&&D===!0&&(v=o.Z_OK,D=!1),v!==o.Z_STREAM_END&&v!==o.Z_OK)return this.onEnd(v),!(this.ended=!0);w.next_out&&(w.avail_out!==0&&v!==o.Z_STREAM_END&&(w.avail_in!==0||b!==o.Z_FINISH&&b!==o.Z_SYNC_FLUSH)||(this.options.to==="string"?(x=a.utf8border(w.output,w.next_out),y=w.next_out-x,E=a.buf2string(w.output,x),w.next_out=y,w.avail_out=R-y,y&&n.arraySet(w.output,w.output,x,y,0),this.onData(E)):this.onData(n.shrinkBuf(w.output,w.next_out)))),w.avail_in===0&&w.avail_out===0&&(D=!0)}while((0<w.avail_in||w.avail_out===0)&&v!==o.Z_STREAM_END);return v===o.Z_STREAM_END&&(b=o.Z_FINISH),b===o.Z_FINISH?(v=r.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===o.Z_OK):b!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(w.avail_out=0))},l.prototype.onData=function(d){this.chunks.push(d)},l.prototype.onEnd=function(d){d===o.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=d,this.msg=this.strm.msg},i.Inflate=l,i.inflate=p,i.inflateRaw=function(d,m){return(m=m||{}).raw=!0,p(d,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(o){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var h=u.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var g in h)h.hasOwnProperty(g)&&(o[g]=h[g])}}return o},i.shrinkBuf=function(o,u){return o.length===u?o:o.subarray?o.subarray(0,u):(o.length=u,o)};var n={arraySet:function(o,u,h,g,f){if(u.subarray&&o.subarray)o.set(u.subarray(h,h+g),f);else for(var l=0;l<g;l++)o[f+l]=u[h+l]},flattenChunks:function(o){var u,h,g,f,l,p;for(u=g=0,h=o.length;u<h;u++)g+=o[u].length;for(p=new Uint8Array(g),u=f=0,h=o.length;u<h;u++)l=o[u],p.set(l,f),f+=l.length;return p}},a={arraySet:function(o,u,h,g,f){for(var l=0;l<g;l++)o[f+l]=u[h+l]},flattenChunks:function(o){return[].concat.apply([],o)}};i.setTyped=function(o){o?(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,a))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(g){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(g){a=!1}for(var o=new r.Buf8(256),u=0;u<256;u++)o[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function h(g,f){if(f<65537&&(g.subarray&&a||!g.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(g,f));for(var l="",p=0;p<f;p++)l+=String.fromCharCode(g[p]);return l}o[254]=o[254]=1,i.string2buf=function(g){var f,l,p,d,m,v=g.length,b=0;for(d=0;d<v;d++)(64512&(l=g.charCodeAt(d)))==55296&&d+1<v&&(64512&(p=g.charCodeAt(d+1)))==56320&&(l=65536+(l-55296<<10)+(p-56320),d++),b+=l<128?1:l<2048?2:l<65536?3:4;for(f=new r.Buf8(b),d=m=0;m<b;d++)(64512&(l=g.charCodeAt(d)))==55296&&d+1<v&&(64512&(p=g.charCodeAt(d+1)))==56320&&(l=65536+(l-55296<<10)+(p-56320),d++),l<128?f[m++]=l:(l<2048?f[m++]=192|l>>>6:(l<65536?f[m++]=224|l>>>12:(f[m++]=240|l>>>18,f[m++]=128|l>>>12&63),f[m++]=128|l>>>6&63),f[m++]=128|63&l);return f},i.buf2binstring=function(g){return h(g,g.length)},i.binstring2buf=function(g){for(var f=new r.Buf8(g.length),l=0,p=f.length;l<p;l++)f[l]=g.charCodeAt(l);return f},i.buf2string=function(g,f){var l,p,d,m,v=f||g.length,b=new Array(2*v);for(l=p=0;l<v;)if((d=g[l++])<128)b[p++]=d;else if(4<(m=o[d]))b[p++]=65533,l+=m-1;else{for(d&=m===2?31:m===3?15:7;1<m&&l<v;)d=d<<6|63&g[l++],m--;1<m?b[p++]=65533:d<65536?b[p++]=d:(d-=65536,b[p++]=55296|d>>10&1023,b[p++]=56320|1023&d)}return h(b,p)},i.utf8border=function(g,f){var l;for((f=f||g.length)>g.length&&(f=g.length),l=f-1;0<=l&&(192&g[l])==128;)l--;return l<0||l===0?f:l+o[g[l]]>f?l:f}},{"./common":41}],43:[function(e,t,i){t.exports=function(r,n,a,o){for(var u=65535&r|0,h=r>>>16&65535|0,g=0;a!==0;){for(a-=g=2e3<a?2e3:a;h=h+(u=u+n[o++]|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,a=[],o=0;o<256;o++){n=o;for(var u=0;u<8;u++)n=1&n?3988292384^n>>>1:n>>>1;a[o]=n}return a}();t.exports=function(n,a,o,u){var h=r,g=u+o;n^=-1;for(var f=u;f<g;f++)n=n>>>8^h[255&(n^a[f])];return-1^n}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),a=e("./trees"),o=e("./adler32"),u=e("./crc32"),h=e("./messages"),g=0,f=4,l=0,p=-2,d=-1,m=4,v=2,b=8,x=9,y=286,E=30,I=19,w=2*y+1,R=15,L=3,D=258,N=D+L+1,C=42,M=113,A=1,U=2,ie=3,q=4;function oe(S,J){return S.msg=h[J],J}function $(S){return(S<<1)-(4<S?9:0)}function se(S){for(var J=S.length;0<=--J;)S[J]=0}function k(S){var J=S.state,W=J.pending;W>S.avail_out&&(W=S.avail_out),W!==0&&(n.arraySet(S.output,J.pending_buf,J.pending_out,W,S.next_out),S.next_out+=W,J.pending_out+=W,S.total_out+=W,S.avail_out-=W,J.pending-=W,J.pending===0&&(J.pending_out=0))}function P(S,J){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,J),S.block_start=S.strstart,k(S.strm)}function j(S,J){S.pending_buf[S.pending++]=J}function F(S,J){S.pending_buf[S.pending++]=J>>>8&255,S.pending_buf[S.pending++]=255&J}function K(S,J){var W,B,T=S.max_chain_length,V=S.strstart,Z=S.prev_length,X=S.nice_match,H=S.strstart>S.w_size-N?S.strstart-(S.w_size-N):0,ee=S.window,le=S.w_mask,re=S.prev,me=S.strstart+D,we=ee[V+Z-1],ye=ee[V+Z];S.prev_length>=S.good_match&&(T>>=2),X>S.lookahead&&(X=S.lookahead);do if(ee[(W=J)+Z]===ye&&ee[W+Z-1]===we&&ee[W]===ee[V]&&ee[++W]===ee[V+1]){V+=2,W++;do;while(ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&ee[++V]===ee[++W]&&V<me);if(B=D-(me-V),V=me-D,Z<B){if(S.match_start=J,X<=(Z=B))break;we=ee[V+Z-1],ye=ee[V+Z]}}while((J=re[J&le])>H&&--T!=0);return Z<=S.lookahead?Z:S.lookahead}function Q(S){var J,W,B,T,V,Z,X,H,ee,le,re=S.w_size;do{if(T=S.window_size-S.lookahead-S.strstart,S.strstart>=re+(re-N)){for(n.arraySet(S.window,S.window,re,re,0),S.match_start-=re,S.strstart-=re,S.block_start-=re,J=W=S.hash_size;B=S.head[--J],S.head[J]=re<=B?B-re:0,--W;);for(J=W=re;B=S.prev[--J],S.prev[J]=re<=B?B-re:0,--W;);T+=re}if(S.strm.avail_in===0)break;if(Z=S.strm,X=S.window,H=S.strstart+S.lookahead,ee=T,le=void 0,le=Z.avail_in,ee<le&&(le=ee),W=le===0?0:(Z.avail_in-=le,n.arraySet(X,Z.input,Z.next_in,le,H),Z.state.wrap===1?Z.adler=o(Z.adler,X,le,H):Z.state.wrap===2&&(Z.adler=u(Z.adler,X,le,H)),Z.next_in+=le,Z.total_in+=le,le),S.lookahead+=W,S.lookahead+S.insert>=L)for(V=S.strstart-S.insert,S.ins_h=S.window[V],S.ins_h=(S.ins_h<<S.hash_shift^S.window[V+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[V+L-1])&S.hash_mask,S.prev[V&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=V,V++,S.insert--,!(S.lookahead+S.insert<L)););}while(S.lookahead<N&&S.strm.avail_in!==0)}function ge(S,J){for(var W,B;;){if(S.lookahead<N){if(Q(S),S.lookahead<N&&J===g)return A;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(B=a._tr_tally(S,S.strstart-S.match_start,S.match_length-L),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=L){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else B=a._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(B&&(P(S,!1),S.strm.avail_out===0))return A}return S.insert=S.strstart<L-1?S.strstart:L-1,J===f?(P(S,!0),S.strm.avail_out===0?ie:q):S.last_lit&&(P(S,!1),S.strm.avail_out===0)?A:U}function ce(S,J){for(var W,B,T;;){if(S.lookahead<N){if(Q(S),S.lookahead<N&&J===g)return A;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,B=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-L),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=T&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+L-1])&S.hash_mask,W=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=L-1,S.strstart++,B&&(P(S,!1),S.strm.avail_out===0))return A}else if(S.match_available){if((B=a._tr_tally(S,0,S.window[S.strstart-1]))&&P(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return A}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(B=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<L-1?S.strstart:L-1,J===f?(P(S,!0),S.strm.avail_out===0?ie:q):S.last_lit&&(P(S,!1),S.strm.avail_out===0)?A:U}function Se(S,J,W,B,T){this.good_length=S,this.max_lazy=J,this.nice_length=W,this.max_chain=B,this.func=T}function De(){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=b,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*w),this.dyn_dtree=new n.Buf16(2*(2*E+1)),this.bl_tree=new n.Buf16(2*(2*I+1)),se(this.dyn_ltree),se(this.dyn_dtree),se(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(R+1),this.heap=new n.Buf16(2*y+1),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*y+1),se(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 Ie(S){var J;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=v,(J=S.state).pending=0,J.pending_out=0,J.wrap<0&&(J.wrap=-J.wrap),J.status=J.wrap?C:M,S.adler=J.wrap===2?0:1,J.last_flush=g,a._tr_init(J),l):oe(S,p)}function Ue(S){var J=Ie(S);return J===l&&function(W){W.window_size=2*W.w_size,se(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),J}function Te(S,J,W,B,T,V){if(!S)return p;var Z=1;if(J===d&&(J=6),B<0?(Z=0,B=-B):15<B&&(Z=2,B-=16),T<1||x<T||W!==b||B<8||15<B||J<0||9<J||V<0||m<V)return oe(S,p);B===8&&(B=9);var X=new De;return(S.state=X).strm=S,X.wrap=Z,X.gzhead=null,X.w_bits=B,X.w_size=1<<X.w_bits,X.w_mask=X.w_size-1,X.hash_bits=T+7,X.hash_size=1<<X.hash_bits,X.hash_mask=X.hash_size-1,X.hash_shift=~~((X.hash_bits+L-1)/L),X.window=new n.Buf8(2*X.w_size),X.head=new n.Buf16(X.hash_size),X.prev=new n.Buf16(X.w_size),X.lit_bufsize=1<<T+6,X.pending_buf_size=4*X.lit_bufsize,X.pending_buf=new n.Buf8(X.pending_buf_size),X.d_buf=1*X.lit_bufsize,X.l_buf=3*X.lit_bufsize,X.level=J,X.strategy=V,X.method=W,Ue(S)}r=[new Se(0,0,0,0,function(S,J){var W=65535;for(W>S.pending_buf_size-5&&(W=S.pending_buf_size-5);;){if(S.lookahead<=1){if(Q(S),S.lookahead===0&&J===g)return A;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var B=S.block_start+W;if((S.strstart===0||S.strstart>=B)&&(S.lookahead=S.strstart-B,S.strstart=B,P(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-N&&(P(S,!1),S.strm.avail_out===0))return A}return S.insert=0,J===f?(P(S,!0),S.strm.avail_out===0?ie:q):(S.strstart>S.block_start&&(P(S,!1),S.strm.avail_out),A)}),new Se(4,4,8,4,ge),new Se(4,5,16,8,ge),new Se(4,6,32,32,ge),new Se(4,4,16,16,ce),new Se(8,16,32,32,ce),new Se(8,16,128,128,ce),new Se(8,32,128,256,ce),new Se(32,128,258,1024,ce),new Se(32,258,258,4096,ce)],i.deflateInit=function(S,J){return Te(S,J,b,15,8,0)},i.deflateInit2=Te,i.deflateReset=Ue,i.deflateResetKeep=Ie,i.deflateSetHeader=function(S,J){return S&&S.state?S.state.wrap!==2?p:(S.state.gzhead=J,l):p},i.deflate=function(S,J){var W,B,T,V;if(!S||!S.state||5<J||J<0)return S?oe(S,p):p;if(B=S.state,!S.output||!S.input&&S.avail_in!==0||B.status===666&&J!==f)return oe(S,S.avail_out===0?-5:p);if(B.strm=S,W=B.last_flush,B.last_flush=J,B.status===C)if(B.wrap===2)S.adler=0,j(B,31),j(B,139),j(B,8),B.gzhead?(j(B,(B.gzhead.text?1:0)+(B.gzhead.hcrc?2:0)+(B.gzhead.extra?4:0)+(B.gzhead.name?8:0)+(B.gzhead.comment?16:0)),j(B,255&B.gzhead.time),j(B,B.gzhead.time>>8&255),j(B,B.gzhead.time>>16&255),j(B,B.gzhead.time>>24&255),j(B,B.level===9?2:2<=B.strategy||B.level<2?4:0),j(B,255&B.gzhead.os),B.gzhead.extra&&B.gzhead.extra.length&&(j(B,255&B.gzhead.extra.length),j(B,B.gzhead.extra.length>>8&255)),B.gzhead.hcrc&&(S.adler=u(S.adler,B.pending_buf,B.pending,0)),B.gzindex=0,B.status=69):(j(B,0),j(B,0),j(B,0),j(B,0),j(B,0),j(B,B.level===9?2:2<=B.strategy||B.level<2?4:0),j(B,3),B.status=M);else{var Z=b+(B.w_bits-8<<4)<<8;Z|=(2<=B.strategy||B.level<2?0:B.level<6?1:B.level===6?2:3)<<6,B.strstart!==0&&(Z|=32),Z+=31-Z%31,B.status=M,F(B,Z),B.strstart!==0&&(F(B,S.adler>>>16),F(B,65535&S.adler)),S.adler=1}if(B.status===69)if(B.gzhead.extra){for(T=B.pending;B.gzindex<(65535&B.gzhead.extra.length)&&(B.pending!==B.pending_buf_size||(B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),k(S),T=B.pending,B.pending!==B.pending_buf_size));)j(B,255&B.gzhead.extra[B.gzindex]),B.gzindex++;B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),B.gzindex===B.gzhead.extra.length&&(B.gzindex=0,B.status=73)}else B.status=73;if(B.status===73)if(B.gzhead.name){T=B.pending;do{if(B.pending===B.pending_buf_size&&(B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),k(S),T=B.pending,B.pending===B.pending_buf_size)){V=1;break}V=B.gzindex<B.gzhead.name.length?255&B.gzhead.name.charCodeAt(B.gzindex++):0,j(B,V)}while(V!==0);B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),V===0&&(B.gzindex=0,B.status=91)}else B.status=91;if(B.status===91)if(B.gzhead.comment){T=B.pending;do{if(B.pending===B.pending_buf_size&&(B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),k(S),T=B.pending,B.pending===B.pending_buf_size)){V=1;break}V=B.gzindex<B.gzhead.comment.length?255&B.gzhead.comment.charCodeAt(B.gzindex++):0,j(B,V)}while(V!==0);B.gzhead.hcrc&&B.pending>T&&(S.adler=u(S.adler,B.pending_buf,B.pending-T,T)),V===0&&(B.status=103)}else B.status=103;if(B.status===103&&(B.gzhead.hcrc?(B.pending+2>B.pending_buf_size&&k(S),B.pending+2<=B.pending_buf_size&&(j(B,255&S.adler),j(B,S.adler>>8&255),S.adler=0,B.status=M)):B.status=M),B.pending!==0){if(k(S),S.avail_out===0)return B.last_flush=-1,l}else if(S.avail_in===0&&$(J)<=$(W)&&J!==f)return oe(S,-5);if(B.status===666&&S.avail_in!==0)return oe(S,-5);if(S.avail_in!==0||B.lookahead!==0||J!==g&&B.status!==666){var X=B.strategy===2?function(H,ee){for(var le;;){if(H.lookahead===0&&(Q(H),H.lookahead===0)){if(ee===g)return A;break}if(H.match_length=0,le=a._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++,le&&(P(H,!1),H.strm.avail_out===0))return A}return H.insert=0,ee===f?(P(H,!0),H.strm.avail_out===0?ie:q):H.last_lit&&(P(H,!1),H.strm.avail_out===0)?A:U}(B,J):B.strategy===3?function(H,ee){for(var le,re,me,we,ye=H.window;;){if(H.lookahead<=D){if(Q(H),H.lookahead<=D&&ee===g)return A;if(H.lookahead===0)break}if(H.match_length=0,H.lookahead>=L&&0<H.strstart&&(re=ye[me=H.strstart-1])===ye[++me]&&re===ye[++me]&&re===ye[++me]){we=H.strstart+D;do;while(re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&re===ye[++me]&&me<we);H.match_length=D-(we-me),H.match_length>H.lookahead&&(H.match_length=H.lookahead)}if(H.match_length>=L?(le=a._tr_tally(H,1,H.match_length-L),H.lookahead-=H.match_length,H.strstart+=H.match_length,H.match_length=0):(le=a._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++),le&&(P(H,!1),H.strm.avail_out===0))return A}return H.insert=0,ee===f?(P(H,!0),H.strm.avail_out===0?ie:q):H.last_lit&&(P(H,!1),H.strm.avail_out===0)?A:U}(B,J):r[B.level].func(B,J);if(X!==ie&&X!==q||(B.status=666),X===A||X===ie)return S.avail_out===0&&(B.last_flush=-1),l;if(X===U&&(J===1?a._tr_align(B):J!==5&&(a._tr_stored_block(B,0,0,!1),J===3&&(se(B.head),B.lookahead===0&&(B.strstart=0,B.block_start=0,B.insert=0))),k(S),S.avail_out===0))return B.last_flush=-1,l}return J!==f?l:B.wrap<=0?1:(B.wrap===2?(j(B,255&S.adler),j(B,S.adler>>8&255),j(B,S.adler>>16&255),j(B,S.adler>>24&255),j(B,255&S.total_in),j(B,S.total_in>>8&255),j(B,S.total_in>>16&255),j(B,S.total_in>>24&255)):(F(B,S.adler>>>16),F(B,65535&S.adler)),k(S),0<B.wrap&&(B.wrap=-B.wrap),B.pending!==0?l:1)},i.deflateEnd=function(S){var J;return S&&S.state?(J=S.state.status)!==C&&J!==69&&J!==73&&J!==91&&J!==103&&J!==M&&J!==666?oe(S,p):(S.state=null,J===M?oe(S,-3):l):p},i.deflateSetDictionary=function(S,J){var W,B,T,V,Z,X,H,ee,le=J.length;if(!S||!S.state||(V=(W=S.state).wrap)===2||V===1&&W.status!==C||W.lookahead)return p;for(V===1&&(S.adler=o(S.adler,J,le,0)),W.wrap=0,le>=W.w_size&&(V===0&&(se(W.head),W.strstart=0,W.block_start=0,W.insert=0),ee=new n.Buf8(W.w_size),n.arraySet(ee,J,le-W.w_size,W.w_size,0),J=ee,le=W.w_size),Z=S.avail_in,X=S.next_in,H=S.input,S.avail_in=le,S.next_in=0,S.input=J,Q(W);W.lookahead>=L;){for(B=W.strstart,T=W.lookahead-(L-1);W.ins_h=(W.ins_h<<W.hash_shift^W.window[B+L-1])&W.hash_mask,W.prev[B&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=B,B++,--T;);W.strstart=B,W.lookahead=L-1,Q(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=X,S.input=H,S.avail_in=Z,W.wrap=V,l},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 a,o,u,h,g,f,l,p,d,m,v,b,x,y,E,I,w,R,L,D,N,C,M,A,U;a=r.state,o=r.next_in,A=r.input,u=o+(r.avail_in-5),h=r.next_out,U=r.output,g=h-(n-r.avail_out),f=h+(r.avail_out-257),l=a.dmax,p=a.wsize,d=a.whave,m=a.wnext,v=a.window,b=a.hold,x=a.bits,y=a.lencode,E=a.distcode,I=(1<<a.lenbits)-1,w=(1<<a.distbits)-1;e:do{x<15&&(b+=A[o++]<<x,x+=8,b+=A[o++]<<x,x+=8),R=y[b&I];t:for(;;){if(b>>>=L=R>>>24,x-=L,(L=R>>>16&255)===0)U[h++]=65535&R;else{if(!(16&L)){if(!(64&L)){R=y[(65535&R)+(b&(1<<L)-1)];continue t}if(32&L){a.mode=12;break e}r.msg="invalid literal/length code",a.mode=30;break e}D=65535&R,(L&=15)&&(x<L&&(b+=A[o++]<<x,x+=8),D+=b&(1<<L)-1,b>>>=L,x-=L),x<15&&(b+=A[o++]<<x,x+=8,b+=A[o++]<<x,x+=8),R=E[b&w];i:for(;;){if(b>>>=L=R>>>24,x-=L,!(16&(L=R>>>16&255))){if(!(64&L)){R=E[(65535&R)+(b&(1<<L)-1)];continue i}r.msg="invalid distance code",a.mode=30;break e}if(N=65535&R,x<(L&=15)&&(b+=A[o++]<<x,(x+=8)<L&&(b+=A[o++]<<x,x+=8)),l<(N+=b&(1<<L)-1)){r.msg="invalid distance too far back",a.mode=30;break e}if(b>>>=L,x-=L,(L=h-g)<N){if(d<(L=N-L)&&a.sane){r.msg="invalid distance too far back",a.mode=30;break e}if(M=v,(C=0)===m){if(C+=p-L,L<D){for(D-=L;U[h++]=v[C++],--L;);C=h-N,M=U}}else if(m<L){if(C+=p+m-L,(L-=m)<D){for(D-=L;U[h++]=v[C++],--L;);if(C=0,m<D){for(D-=L=m;U[h++]=v[C++],--L;);C=h-N,M=U}}}else if(C+=m-L,L<D){for(D-=L;U[h++]=v[C++],--L;);C=h-N,M=U}for(;2<D;)U[h++]=M[C++],U[h++]=M[C++],U[h++]=M[C++],D-=3;D&&(U[h++]=M[C++],1<D&&(U[h++]=M[C++]))}else{for(C=h-N;U[h++]=U[C++],U[h++]=U[C++],U[h++]=U[C++],2<(D-=3););D&&(U[h++]=U[C++],1<D&&(U[h++]=U[C++]))}break}}break}}while(o<u&&h<f);o-=D=x>>3,b&=(1<<(x-=D<<3))-1,r.next_in=o,r.next_out=h,r.avail_in=o<u?u-o+5:5-(o-u),r.avail_out=h<f?f-h+257:257-(h-f),a.hold=b,a.bits=x}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),a=e("./crc32"),o=e("./inffast"),u=e("./inftrees"),h=1,g=2,f=0,l=-2,p=1,d=852,m=592;function v(C){return(C>>>24&255)+(C>>>8&65280)+((65280&C)<<8)+((255&C)<<24)}function b(){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 x(C){var M;return C&&C.state?(M=C.state,C.total_in=C.total_out=M.total=0,C.msg="",M.wrap&&(C.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(d),M.distcode=M.distdyn=new r.Buf32(m),M.sane=1,M.back=-1,f):l}function y(C){var M;return C&&C.state?((M=C.state).wsize=0,M.whave=0,M.wnext=0,x(C)):l}function E(C,M){var A,U;return C&&C.state?(U=C.state,M<0?(A=0,M=-M):(A=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15<M)?l:(U.window!==null&&U.wbits!==M&&(U.window=null),U.wrap=A,U.wbits=M,y(C))):l}function I(C,M){var A,U;return C?(U=new b,(C.state=U).window=null,(A=E(C,M))!==f&&(C.state=null),A):l}var w,R,L=!0;function D(C){if(L){var M;for(w=new r.Buf32(512),R=new r.Buf32(32),M=0;M<144;)C.lens[M++]=8;for(;M<256;)C.lens[M++]=9;for(;M<280;)C.lens[M++]=7;for(;M<288;)C.lens[M++]=8;for(u(h,C.lens,0,288,w,0,C.work,{bits:9}),M=0;M<32;)C.lens[M++]=5;u(g,C.lens,0,32,R,0,C.work,{bits:5}),L=!1}C.lencode=w,C.lenbits=9,C.distcode=R,C.distbits=5}function N(C,M,A,U){var ie,q=C.state;return q.window===null&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new r.Buf8(q.wsize)),U>=q.wsize?(r.arraySet(q.window,M,A-q.wsize,q.wsize,0),q.wnext=0,q.whave=q.wsize):(U<(ie=q.wsize-q.wnext)&&(ie=U),r.arraySet(q.window,M,A-U,ie,q.wnext),(U-=ie)?(r.arraySet(q.window,M,A-U,U,0),q.wnext=U,q.whave=q.wsize):(q.wnext+=ie,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=ie))),0}i.inflateReset=y,i.inflateReset2=E,i.inflateResetKeep=x,i.inflateInit=function(C){return I(C,15)},i.inflateInit2=I,i.inflate=function(C,M){var A,U,ie,q,oe,$,se,k,P,j,F,K,Q,ge,ce,Se,De,Ie,Ue,Te,S,J,W,B,T=0,V=new r.Buf8(4),Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!C||!C.state||!C.output||!C.input&&C.avail_in!==0)return l;(A=C.state).mode===12&&(A.mode=13),oe=C.next_out,ie=C.output,se=C.avail_out,q=C.next_in,U=C.input,$=C.avail_in,k=A.hold,P=A.bits,j=$,F=se,J=f;e:for(;;)switch(A.mode){case p:if(A.wrap===0){A.mode=13;break}for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(2&A.wrap&&k===35615){V[A.check=0]=255&k,V[1]=k>>>8&255,A.check=a(A.check,V,2,0),P=k=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&k)<<8)+(k>>8))%31){C.msg="incorrect header check",A.mode=30;break}if((15&k)!=8){C.msg="unknown compression method",A.mode=30;break}if(P-=4,S=8+(15&(k>>>=4)),A.wbits===0)A.wbits=S;else if(S>A.wbits){C.msg="invalid window size",A.mode=30;break}A.dmax=1<<S,C.adler=A.check=1,A.mode=512&k?10:12,P=k=0;break;case 2:for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(A.flags=k,(255&A.flags)!=8){C.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){C.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=k>>8&1),512&A.flags&&(V[0]=255&k,V[1]=k>>>8&255,A.check=a(A.check,V,2,0)),P=k=0,A.mode=3;case 3:for(;P<32;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.head&&(A.head.time=k),512&A.flags&&(V[0]=255&k,V[1]=k>>>8&255,V[2]=k>>>16&255,V[3]=k>>>24&255,A.check=a(A.check,V,4,0)),P=k=0,A.mode=4;case 4:for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.head&&(A.head.xflags=255&k,A.head.os=k>>8),512&A.flags&&(V[0]=255&k,V[1]=k>>>8&255,A.check=a(A.check,V,2,0)),P=k=0,A.mode=5;case 5:if(1024&A.flags){for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.length=k,A.head&&(A.head.extra_len=k),512&A.flags&&(V[0]=255&k,V[1]=k>>>8&255,A.check=a(A.check,V,2,0)),P=k=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&($<(K=A.length)&&(K=$),K&&(A.head&&(S=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),r.arraySet(A.head.extra,U,q,K,S)),512&A.flags&&(A.check=a(A.check,U,K,q)),$-=K,q+=K,A.length-=K),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if($===0)break e;for(K=0;S=U[q+K++],A.head&&S&&A.length<65536&&(A.head.name+=String.fromCharCode(S)),S&&K<$;);if(512&A.flags&&(A.check=a(A.check,U,K,q)),$-=K,q+=K,S)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if($===0)break e;for(K=0;S=U[q+K++],A.head&&S&&A.length<65536&&(A.head.comment+=String.fromCharCode(S)),S&&K<$;);if(512&A.flags&&(A.check=a(A.check,U,K,q)),$-=K,q+=K,S)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;P<16;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(k!==(65535&A.check)){C.msg="header crc mismatch",A.mode=30;break}P=k=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),C.adler=A.check=0,A.mode=12;break;case 10:for(;P<32;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}C.adler=A.check=v(k),P=k=0,A.mode=11;case 11:if(A.havedict===0)return C.next_out=oe,C.avail_out=se,C.next_in=q,C.avail_in=$,A.hold=k,A.bits=P,2;C.adler=A.check=1,A.mode=12;case 12:if(M===5||M===6)break e;case 13:if(A.last){k>>>=7&P,P-=7&P,A.mode=27;break}for(;P<3;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}switch(A.last=1&k,P-=1,3&(k>>>=1)){case 0:A.mode=14;break;case 1:if(D(A),A.mode=20,M!==6)break;k>>>=2,P-=2;break e;case 2:A.mode=17;break;case 3:C.msg="invalid block type",A.mode=30}k>>>=2,P-=2;break;case 14:for(k>>>=7&P,P-=7&P;P<32;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if((65535&k)!=(k>>>16^65535)){C.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&k,P=k=0,A.mode=15,M===6)break e;case 15:A.mode=16;case 16:if(K=A.length){if($<K&&(K=$),se<K&&(K=se),K===0)break e;r.arraySet(ie,U,q,K,oe),$-=K,q+=K,se-=K,oe+=K,A.length-=K;break}A.mode=12;break;case 17:for(;P<14;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(A.nlen=257+(31&k),k>>>=5,P-=5,A.ndist=1+(31&k),k>>>=5,P-=5,A.ncode=4+(15&k),k>>>=4,P-=4,286<A.nlen||30<A.ndist){C.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;P<3;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.lens[Z[A.have++]]=7&k,k>>>=3,P-=3}for(;A.have<19;)A.lens[Z[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,W={bits:A.lenbits},J=u(0,A.lens,0,19,A.lencode,0,A.work,W),A.lenbits=W.bits,J){C.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;Se=(T=A.lencode[k&(1<<A.lenbits)-1])>>>16&255,De=65535&T,!((ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(De<16)k>>>=ce,P-=ce,A.lens[A.have++]=De;else{if(De===16){for(B=ce+2;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(k>>>=ce,P-=ce,A.have===0){C.msg="invalid bit length repeat",A.mode=30;break}S=A.lens[A.have-1],K=3+(3&k),k>>>=2,P-=2}else if(De===17){for(B=ce+3;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}P-=ce,S=0,K=3+(7&(k>>>=ce)),k>>>=3,P-=3}else{for(B=ce+7;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}P-=ce,S=0,K=11+(127&(k>>>=ce)),k>>>=7,P-=7}if(A.have+K>A.nlen+A.ndist){C.msg="invalid bit length repeat",A.mode=30;break}for(;K--;)A.lens[A.have++]=S}}if(A.mode===30)break;if(A.lens[256]===0){C.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,W={bits:A.lenbits},J=u(h,A.lens,0,A.nlen,A.lencode,0,A.work,W),A.lenbits=W.bits,J){C.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,W={bits:A.distbits},J=u(g,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,W),A.distbits=W.bits,J){C.msg="invalid distances set",A.mode=30;break}if(A.mode=20,M===6)break e;case 20:A.mode=21;case 21:if(6<=$&&258<=se){C.next_out=oe,C.avail_out=se,C.next_in=q,C.avail_in=$,A.hold=k,A.bits=P,o(C,F),oe=C.next_out,ie=C.output,se=C.avail_out,q=C.next_in,U=C.input,$=C.avail_in,k=A.hold,P=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;Se=(T=A.lencode[k&(1<<A.lenbits)-1])>>>16&255,De=65535&T,!((ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(Se&&!(240&Se)){for(Ie=ce,Ue=Se,Te=De;Se=(T=A.lencode[Te+((k&(1<<Ie+Ue)-1)>>Ie)])>>>16&255,De=65535&T,!(Ie+(ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}k>>>=Ie,P-=Ie,A.back+=Ie}if(k>>>=ce,P-=ce,A.back+=ce,A.length=De,Se===0){A.mode=26;break}if(32&Se){A.back=-1,A.mode=12;break}if(64&Se){C.msg="invalid literal/length code",A.mode=30;break}A.extra=15&Se,A.mode=22;case 22:if(A.extra){for(B=A.extra;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.length+=k&(1<<A.extra)-1,k>>>=A.extra,P-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;Se=(T=A.distcode[k&(1<<A.distbits)-1])>>>16&255,De=65535&T,!((ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(!(240&Se)){for(Ie=ce,Ue=Se,Te=De;Se=(T=A.distcode[Te+((k&(1<<Ie+Ue)-1)>>Ie)])>>>16&255,De=65535&T,!(Ie+(ce=T>>>24)<=P);){if($===0)break e;$--,k+=U[q++]<<P,P+=8}k>>>=Ie,P-=Ie,A.back+=Ie}if(k>>>=ce,P-=ce,A.back+=ce,64&Se){C.msg="invalid distance code",A.mode=30;break}A.offset=De,A.extra=15&Se,A.mode=24;case 24:if(A.extra){for(B=A.extra;P<B;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}A.offset+=k&(1<<A.extra)-1,k>>>=A.extra,P-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){C.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(se===0)break e;if(K=F-se,A.offset>K){if((K=A.offset-K)>A.whave&&A.sane){C.msg="invalid distance too far back",A.mode=30;break}Q=K>A.wnext?(K-=A.wnext,A.wsize-K):A.wnext-K,K>A.length&&(K=A.length),ge=A.window}else ge=ie,Q=oe-A.offset,K=A.length;for(se<K&&(K=se),se-=K,A.length-=K;ie[oe++]=ge[Q++],--K;);A.length===0&&(A.mode=21);break;case 26:if(se===0)break e;ie[oe++]=A.length,se--,A.mode=21;break;case 27:if(A.wrap){for(;P<32;){if($===0)break e;$--,k|=U[q++]<<P,P+=8}if(F-=se,C.total_out+=F,A.total+=F,F&&(C.adler=A.check=A.flags?a(A.check,ie,F,oe-F):n(A.check,ie,F,oe-F)),F=se,(A.flags?k:v(k))!==A.check){C.msg="incorrect data check",A.mode=30;break}P=k=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;P<32;){if($===0)break e;$--,k+=U[q++]<<P,P+=8}if(k!==(4294967295&A.total)){C.msg="incorrect length check",A.mode=30;break}P=k=0}A.mode=29;case 29:J=1;break e;case 30:J=-3;break e;case 31:return-4;case 32:default:return l}return C.next_out=oe,C.avail_out=se,C.next_in=q,C.avail_in=$,A.hold=k,A.bits=P,(A.wsize||F!==C.avail_out&&A.mode<30&&(A.mode<27||M!==4))&&N(C,C.output,C.next_out,F-C.avail_out)?(A.mode=31,-4):(j-=C.avail_in,F-=C.avail_out,C.total_in+=j,C.total_out+=F,A.total+=F,A.wrap&&F&&(C.adler=A.check=A.flags?a(A.check,ie,F,C.next_out-F):n(A.check,ie,F,C.next_out-F)),C.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(j==0&&F===0||M===4)&&J===f&&(J=-5),J)},i.inflateEnd=function(C){if(!C||!C.state)return l;var M=C.state;return M.window&&(M.window=null),C.state=null,f},i.inflateGetHeader=function(C,M){var A;return C&&C.state&&2&(A=C.state).wrap?((A.head=M).done=!1,f):l},i.inflateSetDictionary=function(C,M){var A,U=M.length;return C&&C.state?(A=C.state).wrap!==0&&A.mode!==11?l:A.mode===11&&n(1,M,U,0)!==A.check?-3:N(C,M,U,U)?(A.mode=31,-4):(A.havedict=1,f):l},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],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(h,g,f,l,p,d,m,v){var b,x,y,E,I,w,R,L,D,N=v.bits,C=0,M=0,A=0,U=0,ie=0,q=0,oe=0,$=0,se=0,k=0,P=null,j=0,F=new r.Buf16(16),K=new r.Buf16(16),Q=null,ge=0;for(C=0;C<=15;C++)F[C]=0;for(M=0;M<l;M++)F[g[f+M]]++;for(ie=N,U=15;1<=U&&F[U]===0;U--);if(U<ie&&(ie=U),U===0)return p[d++]=20971520,p[d++]=20971520,v.bits=1,0;for(A=1;A<U&&F[A]===0;A++);for(ie<A&&(ie=A),C=$=1;C<=15;C++)if($<<=1,($-=F[C])<0)return-1;if(0<$&&(h===0||U!==1))return-1;for(K[1]=0,C=1;C<15;C++)K[C+1]=K[C]+F[C];for(M=0;M<l;M++)g[f+M]!==0&&(m[K[g[f+M]]++]=M);if(w=h===0?(P=Q=m,19):h===1?(P=n,j-=257,Q=a,ge-=257,256):(P=o,Q=u,-1),C=A,I=d,oe=M=k=0,y=-1,E=(se=1<<(q=ie))-1,h===1&&852<se||h===2&&592<se)return 1;for(;;){for(R=C-oe,D=m[M]<w?(L=0,m[M]):m[M]>w?(L=Q[ge+m[M]],P[j+m[M]]):(L=96,0),b=1<<C-oe,A=x=1<<q;p[I+(k>>oe)+(x-=b)]=R<<24|L<<16|D|0,x!==0;);for(b=1<<C-1;k&b;)b>>=1;if(b!==0?(k&=b-1,k+=b):k=0,M++,--F[C]==0){if(C===U)break;C=g[f+m[M]]}if(ie<C&&(k&E)!==y){for(oe===0&&(oe=ie),I+=A,$=1<<(q=C-oe);q+oe<U&&!(($-=F[q+oe])<=0);)q++,$<<=1;if(se+=1<<q,h===1&&852<se||h===2&&592<se)return 1;p[y=k&E]=ie<<24|q<<16|I-d|0}}return k!==0&&(p[I+k]=C-oe<<24|64<<16|0),v.bits=ie,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,a=1;function o(T){for(var V=T.length;0<=--V;)T[V]=0}var u=0,h=29,g=256,f=g+1+h,l=30,p=19,d=2*f+1,m=15,v=16,b=7,x=256,y=16,E=17,I=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],R=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],D=[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));o(N);var C=new Array(2*l);o(C);var M=new Array(512);o(M);var A=new Array(256);o(A);var U=new Array(h);o(U);var ie,q,oe,$=new Array(l);function se(T,V,Z,X,H){this.static_tree=T,this.extra_bits=V,this.extra_base=Z,this.elems=X,this.max_length=H,this.has_stree=T&&T.length}function k(T,V){this.dyn_tree=T,this.max_code=0,this.stat_desc=V}function P(T){return T<256?M[T]:M[256+(T>>>7)]}function j(T,V){T.pending_buf[T.pending++]=255&V,T.pending_buf[T.pending++]=V>>>8&255}function F(T,V,Z){T.bi_valid>v-Z?(T.bi_buf|=V<<T.bi_valid&65535,j(T,T.bi_buf),T.bi_buf=V>>v-T.bi_valid,T.bi_valid+=Z-v):(T.bi_buf|=V<<T.bi_valid&65535,T.bi_valid+=Z)}function K(T,V,Z){F(T,Z[2*V],Z[2*V+1])}function Q(T,V){for(var Z=0;Z|=1&T,T>>>=1,Z<<=1,0<--V;);return Z>>>1}function ge(T,V,Z){var X,H,ee=new Array(m+1),le=0;for(X=1;X<=m;X++)ee[X]=le=le+Z[X-1]<<1;for(H=0;H<=V;H++){var re=T[2*H+1];re!==0&&(T[2*H]=Q(ee[re]++,re))}}function ce(T){var V;for(V=0;V<f;V++)T.dyn_ltree[2*V]=0;for(V=0;V<l;V++)T.dyn_dtree[2*V]=0;for(V=0;V<p;V++)T.bl_tree[2*V]=0;T.dyn_ltree[2*x]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function Se(T){8<T.bi_valid?j(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 De(T,V,Z,X){var H=2*V,ee=2*Z;return T[H]<T[ee]||T[H]===T[ee]&&X[V]<=X[Z]}function Ie(T,V,Z){for(var X=T.heap[Z],H=Z<<1;H<=T.heap_len&&(H<T.heap_len&&De(V,T.heap[H+1],T.heap[H],T.depth)&&H++,!De(V,X,T.heap[H],T.depth));)T.heap[Z]=T.heap[H],Z=H,H<<=1;T.heap[Z]=X}function Ue(T,V,Z){var X,H,ee,le,re=0;if(T.last_lit!==0)for(;X=T.pending_buf[T.d_buf+2*re]<<8|T.pending_buf[T.d_buf+2*re+1],H=T.pending_buf[T.l_buf+re],re++,X===0?K(T,H,V):(K(T,(ee=A[H])+g+1,V),(le=w[ee])!==0&&F(T,H-=U[ee],le),K(T,ee=P(--X),Z),(le=R[ee])!==0&&F(T,X-=$[ee],le)),re<T.last_lit;);K(T,x,V)}function Te(T,V){var Z,X,H,ee=V.dyn_tree,le=V.stat_desc.static_tree,re=V.stat_desc.has_stree,me=V.stat_desc.elems,we=-1;for(T.heap_len=0,T.heap_max=d,Z=0;Z<me;Z++)ee[2*Z]!==0?(T.heap[++T.heap_len]=we=Z,T.depth[Z]=0):ee[2*Z+1]=0;for(;T.heap_len<2;)ee[2*(H=T.heap[++T.heap_len]=we<2?++we:0)]=1,T.depth[H]=0,T.opt_len--,re&&(T.static_len-=le[2*H+1]);for(V.max_code=we,Z=T.heap_len>>1;1<=Z;Z--)Ie(T,ee,Z);for(H=me;Z=T.heap[1],T.heap[1]=T.heap[T.heap_len--],Ie(T,ee,1),X=T.heap[1],T.heap[--T.heap_max]=Z,T.heap[--T.heap_max]=X,ee[2*H]=ee[2*Z]+ee[2*X],T.depth[H]=(T.depth[Z]>=T.depth[X]?T.depth[Z]:T.depth[X])+1,ee[2*Z+1]=ee[2*X+1]=H,T.heap[1]=H++,Ie(T,ee,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],function(ye,et){var Ct,Fe,ut,Ne,It,li,yt=et.dyn_tree,Xi=et.max_code,Zi=et.stat_desc.static_tree,Ms=et.stat_desc.has_stree,Yi=et.stat_desc.extra_bits,Qi=et.stat_desc.extra_base,Ht=et.stat_desc.max_length,fi=0;for(Ne=0;Ne<=m;Ne++)ye.bl_count[Ne]=0;for(yt[2*ye.heap[ye.heap_max]+1]=0,Ct=ye.heap_max+1;Ct<d;Ct++)Ht<(Ne=yt[2*yt[2*(Fe=ye.heap[Ct])+1]+1]+1)&&(Ne=Ht,fi++),yt[2*Fe+1]=Ne,Xi<Fe||(ye.bl_count[Ne]++,It=0,Qi<=Fe&&(It=Yi[Fe-Qi]),li=yt[2*Fe],ye.opt_len+=li*(Ne+It),Ms&&(ye.static_len+=li*(Zi[2*Fe+1]+It)));if(fi!==0){do{for(Ne=Ht-1;ye.bl_count[Ne]===0;)Ne--;ye.bl_count[Ne]--,ye.bl_count[Ne+1]+=2,ye.bl_count[Ht]--,fi-=2}while(0<fi);for(Ne=Ht;Ne!==0;Ne--)for(Fe=ye.bl_count[Ne];Fe!==0;)Xi<(ut=ye.heap[--Ct])||(yt[2*ut+1]!==Ne&&(ye.opt_len+=(Ne-yt[2*ut+1])*yt[2*ut],yt[2*ut+1]=Ne),Fe--)}}(T,V),ge(ee,we,T.bl_count)}function S(T,V,Z){var X,H,ee=-1,le=V[1],re=0,me=7,we=4;for(le===0&&(me=138,we=3),V[2*(Z+1)+1]=65535,X=0;X<=Z;X++)H=le,le=V[2*(X+1)+1],++re<me&&H===le||(re<we?T.bl_tree[2*H]+=re:H!==0?(H!==ee&&T.bl_tree[2*H]++,T.bl_tree[2*y]++):re<=10?T.bl_tree[2*E]++:T.bl_tree[2*I]++,ee=H,we=(re=0)===le?(me=138,3):H===le?(me=6,3):(me=7,4))}function J(T,V,Z){var X,H,ee=-1,le=V[1],re=0,me=7,we=4;for(le===0&&(me=138,we=3),X=0;X<=Z;X++)if(H=le,le=V[2*(X+1)+1],!(++re<me&&H===le)){if(re<we)for(;K(T,H,T.bl_tree),--re!=0;);else H!==0?(H!==ee&&(K(T,H,T.bl_tree),re--),K(T,y,T.bl_tree),F(T,re-3,2)):re<=10?(K(T,E,T.bl_tree),F(T,re-3,3)):(K(T,I,T.bl_tree),F(T,re-11,7));ee=H,we=(re=0)===le?(me=138,3):H===le?(me=6,3):(me=7,4)}}o($);var W=!1;function B(T,V,Z,X){F(T,(u<<1)+(X?1:0),3),function(H,ee,le,re){Se(H),re&&(j(H,le),j(H,~le)),r.arraySet(H.pending_buf,H.window,ee,le,H.pending),H.pending+=le}(T,V,Z,!0)}i._tr_init=function(T){W||(function(){var V,Z,X,H,ee,le=new Array(m+1);for(H=X=0;H<h-1;H++)for(U[H]=X,V=0;V<1<<w[H];V++)A[X++]=H;for(A[X-1]=H,H=ee=0;H<16;H++)for($[H]=ee,V=0;V<1<<R[H];V++)M[ee++]=H;for(ee>>=7;H<l;H++)for($[H]=ee<<7,V=0;V<1<<R[H]-7;V++)M[256+ee++]=H;for(Z=0;Z<=m;Z++)le[Z]=0;for(V=0;V<=143;)N[2*V+1]=8,V++,le[8]++;for(;V<=255;)N[2*V+1]=9,V++,le[9]++;for(;V<=279;)N[2*V+1]=7,V++,le[7]++;for(;V<=287;)N[2*V+1]=8,V++,le[8]++;for(ge(N,f+1,le),V=0;V<l;V++)C[2*V+1]=5,C[2*V]=Q(V,5);ie=new se(N,w,g+1,f,m),q=new se(C,R,0,l,m),oe=new se(new Array(0),L,0,p,b)}(),W=!0),T.l_desc=new k(T.dyn_ltree,ie),T.d_desc=new k(T.dyn_dtree,q),T.bl_desc=new k(T.bl_tree,oe),T.bi_buf=0,T.bi_valid=0,ce(T)},i._tr_stored_block=B,i._tr_flush_block=function(T,V,Z,X){var H,ee,le=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=function(re){var me,we=4093624447;for(me=0;me<=31;me++,we>>>=1)if(1&we&&re.dyn_ltree[2*me]!==0)return n;if(re.dyn_ltree[18]!==0||re.dyn_ltree[20]!==0||re.dyn_ltree[26]!==0)return a;for(me=32;me<g;me++)if(re.dyn_ltree[2*me]!==0)return a;return n}(T)),Te(T,T.l_desc),Te(T,T.d_desc),le=function(re){var me;for(S(re,re.dyn_ltree,re.l_desc.max_code),S(re,re.dyn_dtree,re.d_desc.max_code),Te(re,re.bl_desc),me=p-1;3<=me&&re.bl_tree[2*D[me]+1]===0;me--);return re.opt_len+=3*(me+1)+5+5+4,me}(T),H=T.opt_len+3+7>>>3,(ee=T.static_len+3+7>>>3)<=H&&(H=ee)):H=ee=Z+5,Z+4<=H&&V!==-1?B(T,V,Z,X):T.strategy===4||ee===H?(F(T,2+(X?1:0),3),Ue(T,N,C)):(F(T,4+(X?1:0),3),function(re,me,we,ye){var et;for(F(re,me-257,5),F(re,we-1,5),F(re,ye-4,4),et=0;et<ye;et++)F(re,re.bl_tree[2*D[et]+1],3);J(re,re.dyn_ltree,me-1),J(re,re.dyn_dtree,we-1)}(T,T.l_desc.max_code+1,T.d_desc.max_code+1,le+1),Ue(T,T.dyn_ltree,T.dyn_dtree)),ce(T),X&&Se(T)},i._tr_tally=function(T,V,Z){return T.pending_buf[T.d_buf+2*T.last_lit]=V>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&V,T.pending_buf[T.l_buf+T.last_lit]=255&Z,T.last_lit++,V===0?T.dyn_ltree[2*Z]++:(T.matches++,V--,T.dyn_ltree[2*(A[Z]+g+1)]++,T.dyn_dtree[2*P(V)]++),T.last_lit===T.lit_bufsize-1},i._tr_align=function(T){F(T,2,3),K(T,x,N),function(V){V.bi_valid===16?(j(V,V.bi_buf),V.bi_buf=0,V.bi_valid=0):8<=V.bi_valid&&(V.pending_buf[V.pending++]=255&V.bi_buf,V.bi_buf>>=8,V.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,a){if(!n.setImmediate){var o,u,h,g,f=1,l={},p=!1,d=n.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(n);m=m&&m.setTimeout?m:n,o={}.toString.call(n.process)==="[object process]"?function(y){process.nextTick(function(){b(y)})}:function(){if(n.postMessage&&!n.importScripts){var y=!0,E=n.onmessage;return n.onmessage=function(){y=!1},n.postMessage("","*"),n.onmessage=E,y}}()?(g="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",x,!1):n.attachEvent("onmessage",x),function(y){n.postMessage(g+y,"*")}):n.MessageChannel?((h=new MessageChannel).port1.onmessage=function(y){b(y.data)},function(y){h.port2.postMessage(y)}):d&&"onreadystatechange"in d.createElement("script")?(u=d.documentElement,function(y){var E=d.createElement("script");E.onreadystatechange=function(){b(y),E.onreadystatechange=null,u.removeChild(E),E=null},u.appendChild(E)}):function(y){setTimeout(b,0,y)},m.setImmediate=function(y){typeof y!="function"&&(y=new Function(""+y));for(var E=new Array(arguments.length-1),I=0;I<E.length;I++)E[I]=arguments[I+1];var w={callback:y,args:E};return l[f]=w,o(f),f++},m.clearImmediate=v}function v(y){delete l[y]}function b(y){if(p)setTimeout(b,0,y);else{var E=l[y];if(E){p=!0;try{(function(I){var w=I.callback,R=I.args;switch(R.length){case 0:w();break;case 1:w(R[0]);break;case 2:w(R[0],R[1]);break;case 3:w(R[0],R[1],R[2]);break;default:w.apply(a,R)}})(E)}finally{v(y),p=!1}}}}function x(y){y.source===n&&typeof y.data=="string"&&y.data.indexOf(g)===0&&b(+y.data.slice(g.length))}})(typeof self=="undefined"?r===void 0?this:r:self)}).call(this,typeof _e!="undefined"?_e:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[10])(10)})})(vn);var No=vn.exports;const Fo=bn(No),gr=(s,c)=>c.some(e=>s instanceof e);let xn,Sn;function Oo(){return xn||(xn=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Vo(){return Sn||(Sn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const br=new WeakMap,vr=new WeakMap,Mi=new WeakMap;function Uo(s){const c=new Promise((e,t)=>{const i=()=>{s.removeEventListener("success",r),s.removeEventListener("error",n)},r=()=>{e($t(s.result)),i()},n=()=>{t(s.error),i()};s.addEventListener("success",r),s.addEventListener("error",n)});return Mi.set(c,s),c}function Ho(s){if(br.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)});br.set(s,c)}let xr={get(s,c,e){if(s instanceof IDBTransaction){if(c==="done")return br.get(s);if(c==="store")return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return $t(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 _n(s){xr=s(xr)}function zo(s){return Vo().includes(s)?function(...c){return s.apply(Sr(this),c),$t(this.request)}:function(...c){return $t(s.apply(Sr(this),c))}}function jo(s){return typeof s=="function"?zo(s):(s instanceof IDBTransaction&&Ho(s),gr(s,Oo())?new Proxy(s,xr):s)}function $t(s){if(s instanceof IDBRequest)return Uo(s);if(vr.has(s))return vr.get(s);const c=jo(s);return c!==s&&(vr.set(s,c),Mi.set(c,s)),c}const Sr=s=>Mi.get(s);function Wo(s,c,{blocked:e,upgrade:t,blocking:i,terminated:r}={}){const n=indexedDB.open(s,c),a=$t(n);return t&&n.addEventListener("upgradeneeded",o=>{t($t(n.result),o.oldVersion,o.newVersion,$t(n.transaction),o)}),e&&n.addEventListener("blocked",o=>e(o.oldVersion,o.newVersion,o)),a.then(o=>{r&&o.addEventListener("close",()=>r()),i&&o.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const Ko=["get","getKey","getAll","getAllKeys","count"],$o=["put","add","delete","clear"],_r=new Map;function yn(s,c){if(!(s instanceof IDBDatabase&&!(c in s)&&typeof c=="string"))return;if(_r.get(c))return _r.get(c);const e=c.replace(/FromIndex$/,""),t=c!==e,i=$o.includes(e);if(!(e in(t?IDBIndex:IDBObjectStore).prototype)||!(i||Ko.includes(e)))return;const r=function(n,...a){return O(this,null,function*(){const o=this.transaction(n,i?"readwrite":"readonly");let u=o.store;return t&&(u=u.index(a.shift())),(yield Promise.all([u[e](...a),i&&o.done]))[0]})};return _r.set(c,r),r}_n(s=>Rt(ve({},s),{get:(c,e,t)=>yn(c,e)||s.get(c,e,t),has:(c,e)=>!!yn(c,e)||s.has(c,e)}));const qo=["continue","continuePrimaryKey","advance"],An={},yr=new WeakMap,En=new WeakMap,Go={get(s,c){if(!qo.includes(c))return s[c];let e=An[c];return e||(e=An[c]=function(...t){yr.set(this,En.get(this)[c](...t))}),e}};function Jo(...s){return ao(this,null,function*(){let c=this;if(c instanceof IDBCursor||(c=yield new tr(c.openCursor(...s))),!c)return;c=c;const e=new Proxy(c,Go);for(En.set(e,c),Mi.set(e,Sr(c));c;)yield e,c=yield new tr(yr.get(e)||c.continue()),yr.delete(e)})}function wn(s,c){return c===Symbol.asyncIterator&&gr(s,[IDBIndex,IDBObjectStore,IDBCursor])||c==="iterate"&&gr(s,[IDBIndex,IDBObjectStore])}_n(s=>Rt(ve({},s),{get(c,e,t){return wn(c,e)?Jo:s.get(c,e,t)},has(c,e){return wn(c,e)||s.has(c,e)}}));const Xo="AliRTCLog",Ni="AliRTCSessiones",Fi="AliRTCLogs",Zo=()=>O(this,null,function*(){return yield Wo(Xo,1,{upgrade:c=>{c.createObjectStore(Ni,{keyPath:"sid"}).createIndex("sid","sid",{unique:!0});const t=c.createObjectStore(Fi,{keyPath:"id",autoIncrement:!0});t.createIndex("sid","sid",{unique:!1}),t.createIndex("date","date",{unique:!1})}})}),Yo=(s,c)=>O(this,null,function*(){yield s.add(Ni,{sid:c})}),Cn=(s,c,e,t)=>O(this,null,function*(){yield s.add(Fi,{sid:c,log:t,date:e})}),In=(s,c)=>O(this,null,function*(){return yield s.getAllFromIndex(Fi,"sid",c)}),Qo=s=>O(this,null,function*(){return yield s.getAllFromIndex(Ni,"sid")}),Ar=(s,c)=>O(this,null,function*(){yield s.delete(Fi,c)}),ec=(s,c)=>O(this,null,function*(){yield s.delete(Ni,c)});var Rn={exports:{}},Er={exports:{}};const tc=Mo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Dn;function Ce(){return Dn||(Dn=1,function(s,c){(function(e,t){s.exports=t()})(_e,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 _e!="undefined"&&_e.crypto&&(r=_e.crypto),!r&&typeof gi=="function")try{r=tc}catch(b){}var n=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch(b){}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch(b){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function b(){}return function(x){var y;return b.prototype=x,y=new b,b.prototype=null,y}}(),o={},u=o.lib={},h=u.Base=function(){return{extend:function(b){var x=a(this);return b&&x.mixIn(b),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var b=this.extend();return b.init.apply(b,arguments),b},init:function(){},mixIn:function(b){for(var x in b)b.hasOwnProperty(x)&&(this[x]=b[x]);b.hasOwnProperty("toString")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=u.WordArray=h.extend({init:function(b,x){b=this.words=b||[],x!=i?this.sigBytes=x:this.sigBytes=b.length*4},toString:function(b){return(b||l).stringify(this)},concat:function(b){var x=this.words,y=b.words,E=this.sigBytes,I=b.sigBytes;if(this.clamp(),E%4)for(var w=0;w<I;w++){var R=y[w>>>2]>>>24-w%4*8&255;x[E+w>>>2]|=R<<24-(E+w)%4*8}else for(var L=0;L<I;L+=4)x[E+L>>>2]=y[L>>>2];return this.sigBytes+=I,this},clamp:function(){var b=this.words,x=this.sigBytes;b[x>>>2]&=4294967295<<32-x%4*8,b.length=t.ceil(x/4)},clone:function(){var b=h.clone.call(this);return b.words=this.words.slice(0),b},random:function(b){for(var x=[],y=0;y<b;y+=4)x.push(n());return new g.init(x,b)}}),f=o.enc={},l=f.Hex={stringify:function(b){for(var x=b.words,y=b.sigBytes,E=[],I=0;I<y;I++){var w=x[I>>>2]>>>24-I%4*8&255;E.push((w>>>4).toString(16)),E.push((w&15).toString(16))}return E.join("")},parse:function(b){for(var x=b.length,y=[],E=0;E<x;E+=2)y[E>>>3]|=parseInt(b.substr(E,2),16)<<24-E%8*4;return new g.init(y,x/2)}},p=f.Latin1={stringify:function(b){for(var x=b.words,y=b.sigBytes,E=[],I=0;I<y;I++){var w=x[I>>>2]>>>24-I%4*8&255;E.push(String.fromCharCode(w))}return E.join("")},parse:function(b){for(var x=b.length,y=[],E=0;E<x;E++)y[E>>>2]|=(b.charCodeAt(E)&255)<<24-E%4*8;return new g.init(y,x)}},d=f.Utf8={stringify:function(b){try{return decodeURIComponent(escape(p.stringify(b)))}catch(x){throw new Error("Malformed UTF-8 data")}},parse:function(b){return p.parse(unescape(encodeURIComponent(b)))}},m=u.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(b){typeof b=="string"&&(b=d.parse(b)),this._data.concat(b),this._nDataBytes+=b.sigBytes},_process:function(b){var x,y=this._data,E=y.words,I=y.sigBytes,w=this.blockSize,R=w*4,L=I/R;b?L=t.ceil(L):L=t.max((L|0)-this._minBufferSize,0);var D=L*w,N=t.min(D*4,I);if(D){for(var C=0;C<D;C+=w)this._doProcessBlock(E,C);x=E.splice(0,D),y.sigBytes-=N}return new g.init(x,N)},clone:function(){var b=h.clone.call(this);return b._data=this._data.clone(),b},_minBufferSize:0});u.Hasher=m.extend({cfg:h.extend(),init:function(b){this.cfg=this.cfg.extend(b),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(b){return this._append(b),this._process(),this},finalize:function(b){b&&this._append(b);var x=this._doFinalize();return x},blockSize:16,_createHelper:function(b){return function(x,y){return new b.init(y).finalize(x)}},_createHmacHelper:function(b){return function(x,y){return new v.HMAC.init(b,y).finalize(x)}}});var v=o.algo={};return o}(Math);return e})}(Er)),Er.exports}var wr={exports:{}},Tn;function Oi(){return Tn||(Tn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(t){var i=e,r=i.lib,n=r.Base,a=r.WordArray,o=i.x64={};o.Word=n.extend({init:function(u,h){this.high=u,this.low=h}}),o.WordArray=n.extend({init:function(u,h){u=this.words=u||[],h!=t?this.sigBytes=h:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,h=u.length,g=[],f=0;f<h;f++){var l=u[f];g.push(l.high),g.push(l.low)}return a.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})}(wr)),wr.exports}var Cr={exports:{}},kn;function ic(){return kn||(kn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){if(typeof ArrayBuffer=="function"){var t=e,i=t.lib,r=i.WordArray,n=r.init,a=r.init=function(o){if(o instanceof ArrayBuffer&&(o=new Uint8Array(o)),(o instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&o instanceof Uint8ClampedArray||o instanceof Int16Array||o instanceof Uint16Array||o instanceof Int32Array||o instanceof Uint32Array||o instanceof Float32Array||o instanceof Float64Array)&&(o=new Uint8Array(o.buffer,o.byteOffset,o.byteLength)),o instanceof Uint8Array){for(var u=o.byteLength,h=[],g=0;g<u;g++)h[g>>>2]|=o[g]<<24-g%4*8;n.call(this,h,u)}else n.apply(this,arguments)};a.prototype=r}}(),e.lib.WordArray})}(Cr)),Cr.exports}var Ir={exports:{}},Pn;function rc(){return Pn||(Pn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Utf16=n.Utf16BE={stringify:function(o){for(var u=o.words,h=o.sigBytes,g=[],f=0;f<h;f+=2){var l=u[f>>>2]>>>16-f%4*8&65535;g.push(String.fromCharCode(l))}return g.join("")},parse:function(o){for(var u=o.length,h=[],g=0;g<u;g++)h[g>>>1]|=o.charCodeAt(g)<<16-g%2*16;return r.create(h,u*2)}},n.Utf16LE={stringify:function(o){for(var u=o.words,h=o.sigBytes,g=[],f=0;f<h;f+=2){var l=a(u[f>>>2]>>>16-f%4*8&65535);g.push(String.fromCharCode(l))}return g.join("")},parse:function(o){for(var u=o.length,h=[],g=0;g<u;g++)h[g>>>1]|=a(o.charCodeAt(g)<<16-g%2*16);return r.create(h,u*2)}};function a(o){return o<<8&4278255360|o>>>8&16711935}}(),e.enc.Utf16})}(Ir)),Ir.exports}var Rr={exports:{}},Bn;function qt(){return Bn||(Bn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Base64={stringify:function(o){var u=o.words,h=o.sigBytes,g=this._map;o.clamp();for(var f=[],l=0;l<h;l+=3)for(var p=u[l>>>2]>>>24-l%4*8&255,d=u[l+1>>>2]>>>24-(l+1)%4*8&255,m=u[l+2>>>2]>>>24-(l+2)%4*8&255,v=p<<16|d<<8|m,b=0;b<4&&l+b*.75<h;b++)f.push(g.charAt(v>>>6*(3-b)&63));var x=g.charAt(64);if(x)for(;f.length%4;)f.push(x);return f.join("")},parse:function(o){var u=o.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 l=h.charAt(64);if(l){var p=o.indexOf(l);p!==-1&&(u=p)}return a(o,u,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(o,u,h){for(var g=[],f=0,l=0;l<u;l++)if(l%4){var p=h[o.charCodeAt(l-1)]<<l%4*2,d=h[o.charCodeAt(l)]>>>6-l%4*2,m=p|d;g[f>>>2]|=m<<24-f%4*8,f++}return r.create(g,f)}}(),e.enc.Base64})}(Rr)),Rr.exports}var Dr={exports:{}},Ln;function sc(){return Ln||(Ln=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.enc;n.Base64url={stringify:function(o,u){u===void 0&&(u=!0);var h=o.words,g=o.sigBytes,f=u?this._safe_map:this._map;o.clamp();for(var l=[],p=0;p<g;p+=3)for(var d=h[p>>>2]>>>24-p%4*8&255,m=h[p+1>>>2]>>>24-(p+1)%4*8&255,v=h[p+2>>>2]>>>24-(p+2)%4*8&255,b=d<<16|m<<8|v,x=0;x<4&&p+x*.75<g;x++)l.push(f.charAt(b>>>6*(3-x)&63));var y=f.charAt(64);if(y)for(;l.length%4;)l.push(y);return l.join("")},parse:function(o,u){u===void 0&&(u=!0);var h=o.length,g=u?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var l=0;l<g.length;l++)f[g.charCodeAt(l)]=l}var p=g.charAt(64);if(p){var d=o.indexOf(p);d!==-1&&(h=d)}return a(o,h,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(o,u,h){for(var g=[],f=0,l=0;l<u;l++)if(l%4){var p=h[o.charCodeAt(l-1)]<<l%4*2,d=h[o.charCodeAt(l)]>>>6-l%4*2,m=p|d;g[f>>>2]|=m<<24-f%4*8,f++}return r.create(g,f)}}(),e.enc.Base64url})}(Dr)),Dr.exports}var Tr={exports:{}},Mn;function Gt(){return Mn||(Mn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,a=r.Hasher,o=i.algo,u=[];(function(){for(var d=0;d<64;d++)u[d]=t.abs(t.sin(d+1))*4294967296|0})();var h=o.MD5=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(d,m){for(var v=0;v<16;v++){var b=m+v,x=d[b];d[b]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}var y=this._hash.words,E=d[m+0],I=d[m+1],w=d[m+2],R=d[m+3],L=d[m+4],D=d[m+5],N=d[m+6],C=d[m+7],M=d[m+8],A=d[m+9],U=d[m+10],ie=d[m+11],q=d[m+12],oe=d[m+13],$=d[m+14],se=d[m+15],k=y[0],P=y[1],j=y[2],F=y[3];k=g(k,P,j,F,E,7,u[0]),F=g(F,k,P,j,I,12,u[1]),j=g(j,F,k,P,w,17,u[2]),P=g(P,j,F,k,R,22,u[3]),k=g(k,P,j,F,L,7,u[4]),F=g(F,k,P,j,D,12,u[5]),j=g(j,F,k,P,N,17,u[6]),P=g(P,j,F,k,C,22,u[7]),k=g(k,P,j,F,M,7,u[8]),F=g(F,k,P,j,A,12,u[9]),j=g(j,F,k,P,U,17,u[10]),P=g(P,j,F,k,ie,22,u[11]),k=g(k,P,j,F,q,7,u[12]),F=g(F,k,P,j,oe,12,u[13]),j=g(j,F,k,P,$,17,u[14]),P=g(P,j,F,k,se,22,u[15]),k=f(k,P,j,F,I,5,u[16]),F=f(F,k,P,j,N,9,u[17]),j=f(j,F,k,P,ie,14,u[18]),P=f(P,j,F,k,E,20,u[19]),k=f(k,P,j,F,D,5,u[20]),F=f(F,k,P,j,U,9,u[21]),j=f(j,F,k,P,se,14,u[22]),P=f(P,j,F,k,L,20,u[23]),k=f(k,P,j,F,A,5,u[24]),F=f(F,k,P,j,$,9,u[25]),j=f(j,F,k,P,R,14,u[26]),P=f(P,j,F,k,M,20,u[27]),k=f(k,P,j,F,oe,5,u[28]),F=f(F,k,P,j,w,9,u[29]),j=f(j,F,k,P,C,14,u[30]),P=f(P,j,F,k,q,20,u[31]),k=l(k,P,j,F,D,4,u[32]),F=l(F,k,P,j,M,11,u[33]),j=l(j,F,k,P,ie,16,u[34]),P=l(P,j,F,k,$,23,u[35]),k=l(k,P,j,F,I,4,u[36]),F=l(F,k,P,j,L,11,u[37]),j=l(j,F,k,P,C,16,u[38]),P=l(P,j,F,k,U,23,u[39]),k=l(k,P,j,F,oe,4,u[40]),F=l(F,k,P,j,E,11,u[41]),j=l(j,F,k,P,R,16,u[42]),P=l(P,j,F,k,N,23,u[43]),k=l(k,P,j,F,A,4,u[44]),F=l(F,k,P,j,q,11,u[45]),j=l(j,F,k,P,se,16,u[46]),P=l(P,j,F,k,w,23,u[47]),k=p(k,P,j,F,E,6,u[48]),F=p(F,k,P,j,C,10,u[49]),j=p(j,F,k,P,$,15,u[50]),P=p(P,j,F,k,D,21,u[51]),k=p(k,P,j,F,q,6,u[52]),F=p(F,k,P,j,R,10,u[53]),j=p(j,F,k,P,U,15,u[54]),P=p(P,j,F,k,I,21,u[55]),k=p(k,P,j,F,M,6,u[56]),F=p(F,k,P,j,se,10,u[57]),j=p(j,F,k,P,N,15,u[58]),P=p(P,j,F,k,oe,21,u[59]),k=p(k,P,j,F,L,6,u[60]),F=p(F,k,P,j,ie,10,u[61]),j=p(j,F,k,P,w,15,u[62]),P=p(P,j,F,k,A,21,u[63]),y[0]=y[0]+k|0,y[1]=y[1]+P|0,y[2]=y[2]+j|0,y[3]=y[3]+F|0},_doFinalize:function(){var d=this._data,m=d.words,v=this._nDataBytes*8,b=d.sigBytes*8;m[b>>>5]|=128<<24-b%32;var x=t.floor(v/4294967296),y=v;m[(b+64>>>9<<4)+15]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,m[(b+64>>>9<<4)+14]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,d.sigBytes=(m.length+1)*4,this._process();for(var E=this._hash,I=E.words,w=0;w<4;w++){var R=I[w];I[w]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360}return E},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});function g(d,m,v,b,x,y,E){var I=d+(m&v|~m&b)+x+E;return(I<<y|I>>>32-y)+m}function f(d,m,v,b,x,y,E){var I=d+(m&b|v&~b)+x+E;return(I<<y|I>>>32-y)+m}function l(d,m,v,b,x,y,E){var I=d+(m^v^b)+x+E;return(I<<y|I>>>32-y)+m}function p(d,m,v,b,x,y,E){var I=d+(v^(m|~b))+x+E;return(I<<y|I>>>32-y)+m}i.MD5=a._createHelper(h),i.HmacMD5=a._createHmacHelper(h)}(Math),e.MD5})}(Tr)),Tr.exports}var kr={exports:{}},Nn;function Fn(){return Nn||(Nn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=i.Hasher,a=t.algo,o=[],u=a.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,l=f[0],p=f[1],d=f[2],m=f[3],v=f[4],b=0;b<80;b++){if(b<16)o[b]=h[g+b]|0;else{var x=o[b-3]^o[b-8]^o[b-14]^o[b-16];o[b]=x<<1|x>>>31}var y=(l<<5|l>>>27)+v+o[b];b<20?y+=(p&d|~p&m)+1518500249:b<40?y+=(p^d^m)+1859775393:b<60?y+=(p&d|p&m|d&m)-1894007588:y+=(p^d^m)-899497514,v=m,m=d,d=p<<30|p>>>2,p=l,l=y}f[0]=f[0]+l|0,f[1]=f[1]+p|0,f[2]=f[2]+d|0,f[3]=f[3]+m|0,f[4]=f[4]+v|0},_doFinalize:function(){var h=this._data,g=h.words,f=this._nDataBytes*8,l=h.sigBytes*8;return g[l>>>5]|=128<<24-l%32,g[(l+64>>>9<<4)+14]=Math.floor(f/4294967296),g[(l+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})}(kr)),kr.exports}var Pr={exports:{}},On;function Br(){return On||(On=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,a=r.Hasher,o=i.algo,u=[],h=[];(function(){function l(v){for(var b=t.sqrt(v),x=2;x<=b;x++)if(!(v%x))return!1;return!0}function p(v){return(v-(v|0))*4294967296|0}for(var d=2,m=0;m<64;)l(d)&&(m<8&&(u[m]=p(t.pow(d,1/2))),h[m]=p(t.pow(d,1/3)),m++),d++})();var g=[],f=o.SHA256=a.extend({_doReset:function(){this._hash=new n.init(u.slice(0))},_doProcessBlock:function(l,p){for(var d=this._hash.words,m=d[0],v=d[1],b=d[2],x=d[3],y=d[4],E=d[5],I=d[6],w=d[7],R=0;R<64;R++){if(R<16)g[R]=l[p+R]|0;else{var L=g[R-15],D=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,N=g[R-2],C=(N<<15|N>>>17)^(N<<13|N>>>19)^N>>>10;g[R]=D+g[R-7]+C+g[R-16]}var M=y&E^~y&I,A=m&v^m&b^v&b,U=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),ie=(y<<26|y>>>6)^(y<<21|y>>>11)^(y<<7|y>>>25),q=w+ie+M+h[R]+g[R],oe=U+A;w=I,I=E,E=y,y=x+q|0,x=b,b=v,v=m,m=q+oe|0}d[0]=d[0]+m|0,d[1]=d[1]+v|0,d[2]=d[2]+b|0,d[3]=d[3]+x|0,d[4]=d[4]+y|0,d[5]=d[5]+E|0,d[6]=d[6]+I|0,d[7]=d[7]+w|0},_doFinalize:function(){var l=this._data,p=l.words,d=this._nDataBytes*8,m=l.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=t.floor(d/4294967296),p[(m+64>>>9<<4)+15]=d,l.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var l=a.clone.call(this);return l._hash=this._hash.clone(),l}});i.SHA256=a._createHelper(f),i.HmacSHA256=a._createHmacHelper(f)}(Math),e.SHA256})}(Pr)),Pr.exports}var Lr={exports:{}},Vn;function nc(){return Vn||(Vn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Br())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=t.algo,a=n.SHA256,o=n.SHA224=a.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=a._doFinalize.call(this);return u.sigBytes-=4,u}});t.SHA224=a._createHelper(o),t.HmacSHA224=a._createHmacHelper(o)}(),e.SHA224})}(Lr)),Lr.exports}var Mr={exports:{}},Un;function Hn(){return Un||(Un=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Oi())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.Hasher,n=t.x64,a=n.Word,o=n.WordArray,u=t.algo;function h(){return a.create.apply(a,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 l=u.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(p,d){for(var m=this._hash.words,v=m[0],b=m[1],x=m[2],y=m[3],E=m[4],I=m[5],w=m[6],R=m[7],L=v.high,D=v.low,N=b.high,C=b.low,M=x.high,A=x.low,U=y.high,ie=y.low,q=E.high,oe=E.low,$=I.high,se=I.low,k=w.high,P=w.low,j=R.high,F=R.low,K=L,Q=D,ge=N,ce=C,Se=M,De=A,Ie=U,Ue=ie,Te=q,S=oe,J=$,W=se,B=k,T=P,V=j,Z=F,X=0;X<80;X++){var H,ee,le=f[X];if(X<16)ee=le.high=p[d+X*2]|0,H=le.low=p[d+X*2+1]|0;else{var re=f[X-15],me=re.high,we=re.low,ye=(me>>>1|we<<31)^(me>>>8|we<<24)^me>>>7,et=(we>>>1|me<<31)^(we>>>8|me<<24)^(we>>>7|me<<25),Ct=f[X-2],Fe=Ct.high,ut=Ct.low,Ne=(Fe>>>19|ut<<13)^(Fe<<3|ut>>>29)^Fe>>>6,It=(ut>>>19|Fe<<13)^(ut<<3|Fe>>>29)^(ut>>>6|Fe<<26),li=f[X-7],yt=li.high,Xi=li.low,Zi=f[X-16],Ms=Zi.high,Yi=Zi.low;H=et+Xi,ee=ye+yt+(H>>>0<et>>>0?1:0),H=H+It,ee=ee+Ne+(H>>>0<It>>>0?1:0),H=H+Yi,ee=ee+Ms+(H>>>0<Yi>>>0?1:0),le.high=ee,le.low=H}var Qi=Te&J^~Te&B,Ht=S&W^~S&T,fi=K&ge^K&Se^ge&Se,lu=Q&ce^Q&De^ce&De,fu=(K>>>28|Q<<4)^(K<<30|Q>>>2)^(K<<25|Q>>>7),eo=(Q>>>28|K<<4)^(Q<<30|K>>>2)^(Q<<25|K>>>7),pu=(Te>>>14|S<<18)^(Te>>>18|S<<14)^(Te<<23|S>>>9),mu=(S>>>14|Te<<18)^(S>>>18|Te<<14)^(S<<23|Te>>>9),to=g[X],gu=to.high,io=to.low,ft=Z+mu,zt=V+pu+(ft>>>0<Z>>>0?1:0),ft=ft+Ht,zt=zt+Qi+(ft>>>0<Ht>>>0?1:0),ft=ft+io,zt=zt+gu+(ft>>>0<io>>>0?1:0),ft=ft+H,zt=zt+ee+(ft>>>0<H>>>0?1:0),ro=eo+lu,bu=fu+fi+(ro>>>0<eo>>>0?1:0);V=B,Z=T,B=J,T=W,J=Te,W=S,S=Ue+ft|0,Te=Ie+zt+(S>>>0<Ue>>>0?1:0)|0,Ie=Se,Ue=De,Se=ge,De=ce,ge=K,ce=Q,Q=ft+ro|0,K=zt+bu+(Q>>>0<ft>>>0?1:0)|0}D=v.low=D+Q,v.high=L+K+(D>>>0<Q>>>0?1:0),C=b.low=C+ce,b.high=N+ge+(C>>>0<ce>>>0?1:0),A=x.low=A+De,x.high=M+Se+(A>>>0<De>>>0?1:0),ie=y.low=ie+Ue,y.high=U+Ie+(ie>>>0<Ue>>>0?1:0),oe=E.low=oe+S,E.high=q+Te+(oe>>>0<S>>>0?1:0),se=I.low=se+W,I.high=$+J+(se>>>0<W>>>0?1:0),P=w.low=P+T,w.high=k+B+(P>>>0<T>>>0?1:0),F=R.low=F+Z,R.high=j+V+(F>>>0<Z>>>0?1:0)},_doFinalize:function(){var p=this._data,d=p.words,m=this._nDataBytes*8,v=p.sigBytes*8;d[v>>>5]|=128<<24-v%32,d[(v+128>>>10<<5)+30]=Math.floor(m/4294967296),d[(v+128>>>10<<5)+31]=m,p.sigBytes=d.length*4,this._process();var b=this._hash.toX32();return b},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p},blockSize:1024/32});t.SHA512=r._createHelper(l),t.HmacSHA512=r._createHmacHelper(l)}(),e.SHA512})}(Mr)),Mr.exports}var Nr={exports:{}},zn;function ac(){return zn||(zn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Oi(),Hn())})(_e,function(e){return function(){var t=e,i=t.x64,r=i.Word,n=i.WordArray,a=t.algo,o=a.SHA512,u=a.SHA384=o.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=o._doFinalize.call(this);return h.sigBytes-=16,h}});t.SHA384=o._createHelper(u),t.HmacSHA384=o._createHmacHelper(u)}(),e.SHA384})}(Nr)),Nr.exports}var Fr={exports:{}},jn;function oc(){return jn||(jn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Oi())})(_e,function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,a=r.Hasher,o=i.x64,u=o.Word,h=i.algo,g=[],f=[],l=[];(function(){for(var m=1,v=0,b=0;b<24;b++){g[m+5*v]=(b+1)*(b+2)/2%64;var x=v%5,y=(2*m+3*v)%5;m=x,v=y}for(var m=0;m<5;m++)for(var v=0;v<5;v++)f[m+5*v]=v+(2*m+3*v)%5*5;for(var E=1,I=0;I<24;I++){for(var w=0,R=0,L=0;L<7;L++){if(E&1){var D=(1<<L)-1;D<32?R^=1<<D:w^=1<<D-32}E&128?E=E<<1^113:E<<=1}l[I]=u.create(w,R)}})();var p=[];(function(){for(var m=0;m<25;m++)p[m]=u.create()})();var d=h.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],v=0;v<25;v++)m[v]=new u.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,v){for(var b=this._state,x=this.blockSize/2,y=0;y<x;y++){var E=m[v+2*y],I=m[v+2*y+1];E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360;var w=b[y];w.high^=I,w.low^=E}for(var R=0;R<24;R++){for(var L=0;L<5;L++){for(var D=0,N=0,C=0;C<5;C++){var w=b[L+5*C];D^=w.high,N^=w.low}var M=p[L];M.high=D,M.low=N}for(var L=0;L<5;L++)for(var A=p[(L+4)%5],U=p[(L+1)%5],ie=U.high,q=U.low,D=A.high^(ie<<1|q>>>31),N=A.low^(q<<1|ie>>>31),C=0;C<5;C++){var w=b[L+5*C];w.high^=D,w.low^=N}for(var oe=1;oe<25;oe++){var D,N,w=b[oe],$=w.high,se=w.low,k=g[oe];k<32?(D=$<<k|se>>>32-k,N=se<<k|$>>>32-k):(D=se<<k-32|$>>>64-k,N=$<<k-32|se>>>64-k);var P=p[f[oe]];P.high=D,P.low=N}var j=p[0],F=b[0];j.high=F.high,j.low=F.low;for(var L=0;L<5;L++)for(var C=0;C<5;C++){var oe=L+5*C,w=b[oe],K=p[oe],Q=p[(L+1)%5+5*C],ge=p[(L+2)%5+5*C];w.high=K.high^~Q.high&ge.high,w.low=K.low^~Q.low&ge.low}var w=b[0],ce=l[R];w.high^=ce.high,w.low^=ce.low}},_doFinalize:function(){var m=this._data,v=m.words;this._nDataBytes*8;var b=m.sigBytes*8,x=this.blockSize*32;v[b>>>5]|=1<<24-b%32,v[(t.ceil((b+1)/x)*x>>>5)-1]|=128,m.sigBytes=v.length*4,this._process();for(var y=this._state,E=this.cfg.outputLength/8,I=E/8,w=[],R=0;R<I;R++){var L=y[R],D=L.high,N=L.low;D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,w.push(N),w.push(D)}return new n.init(w,E)},clone:function(){for(var m=a.clone.call(this),v=m._state=this._state.slice(0),b=0;b<25;b++)v[b]=v[b].clone();return m}});i.SHA3=a._createHelper(d),i.HmacSHA3=a._createHmacHelper(d)}(Math),e.SHA3})}(Fr)),Fr.exports}var Or={exports:{}},Wn;function cc(){return Wn||(Wn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){/** @preserve
18
18
  (c) 2012 by Cédric Mesnil. All rights reserved.
19
19
 
20
20
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -23,7 +23,7 @@ var vu=Object.defineProperty,xu=Object.defineProperties;var Su=Object.getOwnProp
23
23
  - 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.
24
24
 
25
25
  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.
26
- */return function(t){var i=e,r=i.lib,n=r.WordArray,a=r.Hasher,o=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]),l=n.create([0,1518500249,1859775393,2400959708,2840853838]),p=n.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=a.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(I,w){for(var R=0;R<16;R++){var L=w+R,D=I[L];I[L]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var N=this._hash.words,C=l.words,M=p.words,A=u.words,U=h.words,ie=g.words,q=f.words,oe,$,se,k,P,z,F,K,Q,ge;z=oe=N[0],F=$=N[1],K=se=N[2],Q=k=N[3],ge=P=N[4];for(var ce,R=0;R<80;R+=1)ce=oe+I[w+A[R]]|0,R<16?ce+=m($,se,k)+C[0]:R<32?ce+=v($,se,k)+C[1]:R<48?ce+=b($,se,k)+C[2]:R<64?ce+=x($,se,k)+C[3]:ce+=y($,se,k)+C[4],ce=ce|0,ce=E(ce,ie[R]),ce=ce+P|0,oe=P,P=k,k=E(se,10),se=$,$=ce,ce=z+I[w+U[R]]|0,R<16?ce+=y(F,K,Q)+M[0]:R<32?ce+=x(F,K,Q)+M[1]:R<48?ce+=b(F,K,Q)+M[2]:R<64?ce+=v(F,K,Q)+M[3]:ce+=m(F,K,Q)+M[4],ce=ce|0,ce=E(ce,q[R]),ce=ce+ge|0,z=ge,ge=Q,Q=E(K,10),K=F,F=ce;ce=N[1]+se+Q|0,N[1]=N[2]+k+ge|0,N[2]=N[3]+P+z|0,N[3]=N[4]+oe+F|0,N[4]=N[0]+$+K|0,N[0]=ce},_doFinalize:function(){var I=this._data,w=I.words,R=this._nDataBytes*8,L=I.sigBytes*8;w[L>>>5]|=128<<24-L%32,w[(L+64>>>9<<4)+14]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,I.sigBytes=(w.length+1)*4,this._process();for(var D=this._hash,N=D.words,C=0;C<5;C++){var M=N[C];N[C]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return D},clone:function(){var I=a.clone.call(this);return I._hash=this._hash.clone(),I}});function m(I,w,R){return I^w^R}function v(I,w,R){return I&w|~I&R}function b(I,w,R){return(I|~w)^R}function x(I,w,R){return I&R|w&~R}function y(I,w,R){return I^(w|~R)}function E(I,w){return I<<w|I>>>32-w}i.RIPEMD160=a._createHelper(d),i.HmacRIPEMD160=a._createHmacHelper(d)}(),e.RIPEMD160})}(Or)),Or.exports}var Vr={exports:{}},Kn;function Ur(){return Kn||(Kn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){(function(){var t=e,i=t.lib,r=i.Base,n=t.enc,a=n.Utf8,o=t.algo;o.HMAC=r.extend({init:function(u,h){u=this._hasher=new u.init,typeof h=="string"&&(h=a.parse(h));var g=u.blockSize,f=g*4;h.sigBytes>f&&(h=u.finalize(h)),h.clamp();for(var l=this._oKey=h.clone(),p=this._iKey=h.clone(),d=l.words,m=p.words,v=0;v<g;v++)d[v]^=1549556828,m[v]^=909522486;l.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}})})()})}(Vr)),Vr.exports}var Hr={exports:{}},$n;function uc(){return $n||($n=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Br(),Ur())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,a=t.algo,o=a.SHA256,u=a.HMAC,h=a.PBKDF2=r.extend({cfg:r.extend({keySize:128/32,hasher:o,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,f){for(var l=this.cfg,p=u.create(l.hasher,g),d=n.create(),m=n.create([1]),v=d.words,b=m.words,x=l.keySize,y=l.iterations;v.length<x;){var E=p.update(f).finalize(m);p.reset();for(var I=E.words,w=I.length,R=E,L=1;L<y;L++){R=p.finalize(R),p.reset();for(var D=R.words,N=0;N<w;N++)I[N]^=D[N]}d.concat(E),b[0]++}return d.sigBytes=x*4,d}});t.PBKDF2=function(g,f,l){return h.create(l).compute(g,f)}}(),e.PBKDF2})}(Hr)),Hr.exports}var zr={exports:{}},qn;function Lt(){return qn||(qn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Fn(),Ur())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,a=t.algo,o=a.MD5,u=a.EvpKDF=r.extend({cfg:r.extend({keySize:128/32,hasher:o,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,g){for(var f,l=this.cfg,p=l.hasher.create(),d=n.create(),m=d.words,v=l.keySize,b=l.iterations;m.length<v;){f&&p.update(f),f=p.update(h).finalize(g),p.reset();for(var x=1;x<b;x++)f=p.finalize(f),p.reset();d.concat(f)}return d.sigBytes=v*4,d}});t.EvpKDF=function(h,g,f){return u.create(f).compute(h,g)}}(),e.EvpKDF})}(zr)),zr.exports}var jr={exports:{}},Gn;function qe(){return Gn||(Gn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Lt())})(_e,function(e){e.lib.Cipher||function(t){var i=e,r=i.lib,n=r.Base,a=r.WordArray,o=r.BufferedBlockAlgorithm,u=i.enc;u.Utf8;var h=u.Base64,g=i.algo,f=g.EvpKDF,l=r.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(D,N){return this.create(this._ENC_XFORM_MODE,D,N)},createDecryptor:function(D,N){return this.create(this._DEC_XFORM_MODE,D,N)},init:function(D,N,C){this.cfg=this.cfg.extend(C),this._xformMode=D,this._key=N,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(D){return this._append(D),this._process()},finalize:function(D){D&&this._append(D);var N=this._doFinalize();return N},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function D(N){return typeof N=="string"?L:I}return function(N){return{encrypt:function(C,M,A){return D(M).encrypt(N,C,M,A)},decrypt:function(C,M,A){return D(M).decrypt(N,C,M,A)}}}}()});r.StreamCipher=l.extend({_doFinalize:function(){var D=this._process(!0);return D},blockSize:1});var p=i.mode={},d=r.BlockCipherMode=n.extend({createEncryptor:function(D,N){return this.Encryptor.create(D,N)},createDecryptor:function(D,N){return this.Decryptor.create(D,N)},init:function(D,N){this._cipher=D,this._iv=N}}),m=p.CBC=function(){var D=d.extend();D.Encryptor=D.extend({processBlock:function(C,M){var A=this._cipher,U=A.blockSize;N.call(this,C,M,U),A.encryptBlock(C,M),this._prevBlock=C.slice(M,M+U)}}),D.Decryptor=D.extend({processBlock:function(C,M){var A=this._cipher,U=A.blockSize,ie=C.slice(M,M+U);A.decryptBlock(C,M),N.call(this,C,M,U),this._prevBlock=ie}});function N(C,M,A){var U,ie=this._iv;ie?(U=ie,this._iv=t):U=this._prevBlock;for(var q=0;q<A;q++)C[M+q]^=U[q]}return D}(),v=i.pad={},b=v.Pkcs7={pad:function(D,N){for(var C=N*4,M=C-D.sigBytes%C,A=M<<24|M<<16|M<<8|M,U=[],ie=0;ie<M;ie+=4)U.push(A);var q=a.create(U,M);D.concat(q)},unpad:function(D){var N=D.words[D.sigBytes-1>>>2]&255;D.sigBytes-=N}};r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:m,padding:b}),reset:function(){var D;l.reset.call(this);var N=this.cfg,C=N.iv,M=N.mode;this._xformMode==this._ENC_XFORM_MODE?D=M.createEncryptor:(D=M.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==D?this._mode.init(this,C&&C.words):(this._mode=D.call(M,this,C&&C.words),this._mode.__creator=D)},_doProcessBlock:function(D,N){this._mode.processBlock(D,N)},_doFinalize:function(){var D,N=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(N.pad(this._data,this.blockSize),D=this._process(!0)):(D=this._process(!0),N.unpad(D)),D},blockSize:128/32});var x=r.CipherParams=n.extend({init:function(D){this.mixIn(D)},toString:function(D){return(D||this.formatter).stringify(this)}}),y=i.format={},E=y.OpenSSL={stringify:function(D){var N,C=D.ciphertext,M=D.salt;return M?N=a.create([1398893684,1701076831]).concat(M).concat(C):N=C,N.toString(h)},parse:function(D){var N,C=h.parse(D),M=C.words;return M[0]==1398893684&&M[1]==1701076831&&(N=a.create(M.slice(2,4)),M.splice(0,4),C.sigBytes-=16),x.create({ciphertext:C,salt:N})}},I=r.SerializableCipher=n.extend({cfg:n.extend({format:E}),encrypt:function(D,N,C,M){M=this.cfg.extend(M);var A=D.createEncryptor(C,M),U=A.finalize(N),ie=A.cfg;return x.create({ciphertext:U,key:C,iv:ie.iv,algorithm:D,mode:ie.mode,padding:ie.padding,blockSize:D.blockSize,formatter:M.format})},decrypt:function(D,N,C,M){M=this.cfg.extend(M),N=this._parse(N,M.format);var A=D.createDecryptor(C,M).finalize(N.ciphertext);return A},_parse:function(D,N){return typeof D=="string"?N.parse(D,this):D}}),w=i.kdf={},R=w.OpenSSL={execute:function(D,N,C,M,A){if(M||(M=a.random(64/8)),A)var U=f.create({keySize:N+C,hasher:A}).compute(D,M);else var U=f.create({keySize:N+C}).compute(D,M);var ie=a.create(U.words.slice(N),C*4);return U.sigBytes=N*4,x.create({key:U,iv:ie,salt:M})}},L=r.PasswordBasedCipher=I.extend({cfg:I.cfg.extend({kdf:R}),encrypt:function(D,N,C,M){M=this.cfg.extend(M);var A=M.kdf.execute(C,D.keySize,D.ivSize,M.salt,M.hasher);M.iv=A.iv;var U=I.encrypt.call(this,D,N,A.key,M);return U.mixIn(A),U},decrypt:function(D,N,C,M){M=this.cfg.extend(M),N=this._parse(N,M.format);var A=M.kdf.execute(C,D.keySize,D.ivSize,N.salt,M.hasher);M.iv=A.iv;var U=I.decrypt.call(this,D,N,A.key,M);return U}})}()})}(jr)),jr.exports}var Wr={exports:{}},Jn;function hc(){return Jn||(Jn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),qe())})(_e,function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();t.Encryptor=t.extend({processBlock:function(r,n){var a=this._cipher,o=a.blockSize;i.call(this,r,n,o,a),this._prevBlock=r.slice(n,n+o)}}),t.Decryptor=t.extend({processBlock:function(r,n){var a=this._cipher,o=a.blockSize,u=r.slice(n,n+o);i.call(this,r,n,o,a),this._prevBlock=u}});function i(r,n,a,o){var u,h=this._iv;h?(u=h.slice(0),this._iv=void 0):u=this._prevBlock,o.encryptBlock(u,0);for(var g=0;g<a;g++)r[n+g]^=u[g]}return t}(),e.mode.CFB})}(Wr)),Wr.exports}var Kr={exports:{}},Xn;function dc(){return Xn||(Xn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),qe())})(_e,function(e){return e.mode.CTR=function(){var t=e.lib.BlockCipherMode.extend(),i=t.Encryptor=t.extend({processBlock:function(r,n){var a=this._cipher,o=a.blockSize,u=this._iv,h=this._counter;u&&(h=this._counter=u.slice(0),this._iv=void 0);var g=h.slice(0);a.encryptBlock(g,0),h[o-1]=h[o-1]+1|0;for(var f=0;f<o;f++)r[n+f]^=g[f]}});return t.Decryptor=i,t}(),e.mode.CTR})}(Kr)),Kr.exports}var $r={exports:{}},Zn;function lc(){return Zn||(Zn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),qe())})(_e,function(e){/** @preserve
26
+ */return function(t){var i=e,r=i.lib,n=r.WordArray,a=r.Hasher,o=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]),l=n.create([0,1518500249,1859775393,2400959708,2840853838]),p=n.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=a.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(I,w){for(var R=0;R<16;R++){var L=w+R,D=I[L];I[L]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var N=this._hash.words,C=l.words,M=p.words,A=u.words,U=h.words,ie=g.words,q=f.words,oe,$,se,k,P,j,F,K,Q,ge;j=oe=N[0],F=$=N[1],K=se=N[2],Q=k=N[3],ge=P=N[4];for(var ce,R=0;R<80;R+=1)ce=oe+I[w+A[R]]|0,R<16?ce+=m($,se,k)+C[0]:R<32?ce+=v($,se,k)+C[1]:R<48?ce+=b($,se,k)+C[2]:R<64?ce+=x($,se,k)+C[3]:ce+=y($,se,k)+C[4],ce=ce|0,ce=E(ce,ie[R]),ce=ce+P|0,oe=P,P=k,k=E(se,10),se=$,$=ce,ce=j+I[w+U[R]]|0,R<16?ce+=y(F,K,Q)+M[0]:R<32?ce+=x(F,K,Q)+M[1]:R<48?ce+=b(F,K,Q)+M[2]:R<64?ce+=v(F,K,Q)+M[3]:ce+=m(F,K,Q)+M[4],ce=ce|0,ce=E(ce,q[R]),ce=ce+ge|0,j=ge,ge=Q,Q=E(K,10),K=F,F=ce;ce=N[1]+se+Q|0,N[1]=N[2]+k+ge|0,N[2]=N[3]+P+j|0,N[3]=N[4]+oe+F|0,N[4]=N[0]+$+K|0,N[0]=ce},_doFinalize:function(){var I=this._data,w=I.words,R=this._nDataBytes*8,L=I.sigBytes*8;w[L>>>5]|=128<<24-L%32,w[(L+64>>>9<<4)+14]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,I.sigBytes=(w.length+1)*4,this._process();for(var D=this._hash,N=D.words,C=0;C<5;C++){var M=N[C];N[C]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return D},clone:function(){var I=a.clone.call(this);return I._hash=this._hash.clone(),I}});function m(I,w,R){return I^w^R}function v(I,w,R){return I&w|~I&R}function b(I,w,R){return(I|~w)^R}function x(I,w,R){return I&R|w&~R}function y(I,w,R){return I^(w|~R)}function E(I,w){return I<<w|I>>>32-w}i.RIPEMD160=a._createHelper(d),i.HmacRIPEMD160=a._createHmacHelper(d)}(),e.RIPEMD160})}(Or)),Or.exports}var Vr={exports:{}},Kn;function Ur(){return Kn||(Kn=1,function(s,c){(function(e,t){s.exports=t(Ce())})(_e,function(e){(function(){var t=e,i=t.lib,r=i.Base,n=t.enc,a=n.Utf8,o=t.algo;o.HMAC=r.extend({init:function(u,h){u=this._hasher=new u.init,typeof h=="string"&&(h=a.parse(h));var g=u.blockSize,f=g*4;h.sigBytes>f&&(h=u.finalize(h)),h.clamp();for(var l=this._oKey=h.clone(),p=this._iKey=h.clone(),d=l.words,m=p.words,v=0;v<g;v++)d[v]^=1549556828,m[v]^=909522486;l.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}})})()})}(Vr)),Vr.exports}var Hr={exports:{}},$n;function uc(){return $n||($n=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Br(),Ur())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,a=t.algo,o=a.SHA256,u=a.HMAC,h=a.PBKDF2=r.extend({cfg:r.extend({keySize:128/32,hasher:o,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,f){for(var l=this.cfg,p=u.create(l.hasher,g),d=n.create(),m=n.create([1]),v=d.words,b=m.words,x=l.keySize,y=l.iterations;v.length<x;){var E=p.update(f).finalize(m);p.reset();for(var I=E.words,w=I.length,R=E,L=1;L<y;L++){R=p.finalize(R),p.reset();for(var D=R.words,N=0;N<w;N++)I[N]^=D[N]}d.concat(E),b[0]++}return d.sigBytes=x*4,d}});t.PBKDF2=function(g,f,l){return h.create(l).compute(g,f)}}(),e.PBKDF2})}(Hr)),Hr.exports}var zr={exports:{}},qn;function Lt(){return qn||(qn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Fn(),Ur())})(_e,function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,a=t.algo,o=a.MD5,u=a.EvpKDF=r.extend({cfg:r.extend({keySize:128/32,hasher:o,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,g){for(var f,l=this.cfg,p=l.hasher.create(),d=n.create(),m=d.words,v=l.keySize,b=l.iterations;m.length<v;){f&&p.update(f),f=p.update(h).finalize(g),p.reset();for(var x=1;x<b;x++)f=p.finalize(f),p.reset();d.concat(f)}return d.sigBytes=v*4,d}});t.EvpKDF=function(h,g,f){return u.create(f).compute(h,g)}}(),e.EvpKDF})}(zr)),zr.exports}var jr={exports:{}},Gn;function qe(){return Gn||(Gn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),Lt())})(_e,function(e){e.lib.Cipher||function(t){var i=e,r=i.lib,n=r.Base,a=r.WordArray,o=r.BufferedBlockAlgorithm,u=i.enc;u.Utf8;var h=u.Base64,g=i.algo,f=g.EvpKDF,l=r.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(D,N){return this.create(this._ENC_XFORM_MODE,D,N)},createDecryptor:function(D,N){return this.create(this._DEC_XFORM_MODE,D,N)},init:function(D,N,C){this.cfg=this.cfg.extend(C),this._xformMode=D,this._key=N,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(D){return this._append(D),this._process()},finalize:function(D){D&&this._append(D);var N=this._doFinalize();return N},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function D(N){return typeof N=="string"?L:I}return function(N){return{encrypt:function(C,M,A){return D(M).encrypt(N,C,M,A)},decrypt:function(C,M,A){return D(M).decrypt(N,C,M,A)}}}}()});r.StreamCipher=l.extend({_doFinalize:function(){var D=this._process(!0);return D},blockSize:1});var p=i.mode={},d=r.BlockCipherMode=n.extend({createEncryptor:function(D,N){return this.Encryptor.create(D,N)},createDecryptor:function(D,N){return this.Decryptor.create(D,N)},init:function(D,N){this._cipher=D,this._iv=N}}),m=p.CBC=function(){var D=d.extend();D.Encryptor=D.extend({processBlock:function(C,M){var A=this._cipher,U=A.blockSize;N.call(this,C,M,U),A.encryptBlock(C,M),this._prevBlock=C.slice(M,M+U)}}),D.Decryptor=D.extend({processBlock:function(C,M){var A=this._cipher,U=A.blockSize,ie=C.slice(M,M+U);A.decryptBlock(C,M),N.call(this,C,M,U),this._prevBlock=ie}});function N(C,M,A){var U,ie=this._iv;ie?(U=ie,this._iv=t):U=this._prevBlock;for(var q=0;q<A;q++)C[M+q]^=U[q]}return D}(),v=i.pad={},b=v.Pkcs7={pad:function(D,N){for(var C=N*4,M=C-D.sigBytes%C,A=M<<24|M<<16|M<<8|M,U=[],ie=0;ie<M;ie+=4)U.push(A);var q=a.create(U,M);D.concat(q)},unpad:function(D){var N=D.words[D.sigBytes-1>>>2]&255;D.sigBytes-=N}};r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:m,padding:b}),reset:function(){var D;l.reset.call(this);var N=this.cfg,C=N.iv,M=N.mode;this._xformMode==this._ENC_XFORM_MODE?D=M.createEncryptor:(D=M.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==D?this._mode.init(this,C&&C.words):(this._mode=D.call(M,this,C&&C.words),this._mode.__creator=D)},_doProcessBlock:function(D,N){this._mode.processBlock(D,N)},_doFinalize:function(){var D,N=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(N.pad(this._data,this.blockSize),D=this._process(!0)):(D=this._process(!0),N.unpad(D)),D},blockSize:128/32});var x=r.CipherParams=n.extend({init:function(D){this.mixIn(D)},toString:function(D){return(D||this.formatter).stringify(this)}}),y=i.format={},E=y.OpenSSL={stringify:function(D){var N,C=D.ciphertext,M=D.salt;return M?N=a.create([1398893684,1701076831]).concat(M).concat(C):N=C,N.toString(h)},parse:function(D){var N,C=h.parse(D),M=C.words;return M[0]==1398893684&&M[1]==1701076831&&(N=a.create(M.slice(2,4)),M.splice(0,4),C.sigBytes-=16),x.create({ciphertext:C,salt:N})}},I=r.SerializableCipher=n.extend({cfg:n.extend({format:E}),encrypt:function(D,N,C,M){M=this.cfg.extend(M);var A=D.createEncryptor(C,M),U=A.finalize(N),ie=A.cfg;return x.create({ciphertext:U,key:C,iv:ie.iv,algorithm:D,mode:ie.mode,padding:ie.padding,blockSize:D.blockSize,formatter:M.format})},decrypt:function(D,N,C,M){M=this.cfg.extend(M),N=this._parse(N,M.format);var A=D.createDecryptor(C,M).finalize(N.ciphertext);return A},_parse:function(D,N){return typeof D=="string"?N.parse(D,this):D}}),w=i.kdf={},R=w.OpenSSL={execute:function(D,N,C,M,A){if(M||(M=a.random(64/8)),A)var U=f.create({keySize:N+C,hasher:A}).compute(D,M);else var U=f.create({keySize:N+C}).compute(D,M);var ie=a.create(U.words.slice(N),C*4);return U.sigBytes=N*4,x.create({key:U,iv:ie,salt:M})}},L=r.PasswordBasedCipher=I.extend({cfg:I.cfg.extend({kdf:R}),encrypt:function(D,N,C,M){M=this.cfg.extend(M);var A=M.kdf.execute(C,D.keySize,D.ivSize,M.salt,M.hasher);M.iv=A.iv;var U=I.encrypt.call(this,D,N,A.key,M);return U.mixIn(A),U},decrypt:function(D,N,C,M){M=this.cfg.extend(M),N=this._parse(N,M.format);var A=M.kdf.execute(C,D.keySize,D.ivSize,N.salt,M.hasher);M.iv=A.iv;var U=I.decrypt.call(this,D,N,A.key,M);return U}})}()})}(jr)),jr.exports}var Wr={exports:{}},Jn;function hc(){return Jn||(Jn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),qe())})(_e,function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();t.Encryptor=t.extend({processBlock:function(r,n){var a=this._cipher,o=a.blockSize;i.call(this,r,n,o,a),this._prevBlock=r.slice(n,n+o)}}),t.Decryptor=t.extend({processBlock:function(r,n){var a=this._cipher,o=a.blockSize,u=r.slice(n,n+o);i.call(this,r,n,o,a),this._prevBlock=u}});function i(r,n,a,o){var u,h=this._iv;h?(u=h.slice(0),this._iv=void 0):u=this._prevBlock,o.encryptBlock(u,0);for(var g=0;g<a;g++)r[n+g]^=u[g]}return t}(),e.mode.CFB})}(Wr)),Wr.exports}var Kr={exports:{}},Xn;function dc(){return Xn||(Xn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),qe())})(_e,function(e){return e.mode.CTR=function(){var t=e.lib.BlockCipherMode.extend(),i=t.Encryptor=t.extend({processBlock:function(r,n){var a=this._cipher,o=a.blockSize,u=this._iv,h=this._counter;u&&(h=this._counter=u.slice(0),this._iv=void 0);var g=h.slice(0);a.encryptBlock(g,0),h[o-1]=h[o-1]+1|0;for(var f=0;f<o;f++)r[n+f]^=g[f]}});return t.Decryptor=i,t}(),e.mode.CTR})}(Kr)),Kr.exports}var $r={exports:{}},Zn;function lc(){return Zn||(Zn=1,function(s,c){(function(e,t,i){s.exports=t(Ce(),qe())})(_e,function(e){/** @preserve
27
27
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
28
28
  * derived from CryptoJS.mode.CTR
29
29
  * Jan Hruby jhruby.web@gmail.com
@@ -36,8 +36,8 @@ var vu=Object.defineProperty,xu=Object.defineProperties;var Su=Object.getOwnProp
36
36
  `+a+`
37
37
  `;const h=(p,d)=>p[0].localeCompare(d[0]),g=p=>p[0].startsWith("x-log-")||p[0].startsWith("x-acs-");try{const p=[...r.entries()].filter(g).sort(h).map(d=>d[0]+":"+d[1]+`
38
38
  `).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=bi.HmacSHA1(u,t).toString(bi.enc.Base64),l="LOG "+e+":"+f;return r.set("Authorization",l),r.set("x-log-date",a),l}var Wc=(s,c,e)=>new Promise((t,i)=>{var r=o=>{try{a(e.next(o))}catch(u){i(u)}},n=o=>{try{a(e.throw(o))}catch(u){i(u)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(r,n);a((e=e.apply(s,c)).next())});function Kc(s){return Wc(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:
39
- `+e)}}return null})}var $c=(s,c,e)=>new Promise((t,i)=>{var r=o=>{try{a(e.next(o))}catch(u){i(u)}},n=o=>{try{a(e.throw(o))}catch(u){i(u)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(r,n);a((e=e.apply(s,c)).next())});function xa(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 $c(this,null,function*(){yield Kc(s);let t=c.slice(c.indexOf("/logstores")),i=e.length,r=zc(e),n=new Date().toUTCString(),a=new Map,o=new Map([["Content-Type","application/json"],["Content-MD5",r],["x-log-bodyrawsize",i.toString()]]);s.securityToken&&o.set("x-acs-security-token",s.securityToken),jc("POST",t,s.accessKeyId,s.accessKeySecret,a,o,r,n);let u=Object.fromEntries(o);return{data:e,header:u}})}}}typeof window!="undefined"&&ga(window,"stsPlugin",xa);const{BrowserUtil:qc}=pe.AliRTS,ai={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Gecko:"Gecko",WebKit:"WebKit"},Vi=(s,c)=>{const e=c.match(s);return e&&e.length>0&&e[1]||""},Gc=[{test:[/\sedg\//i,[/edg([ea]|ios)/i]],describe(s){if(/\sedg\//i.test(s))return{name:ai.Blink};const e=Vi(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:ai.EdgeHTML,version:e}}},{test:[/trident/i],describe(s){const c={name:ai.Trident},e=Vi(/trident\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}},{test(s){const c=/gecko/i.test(s),e=/like gecko/i.test(s);return c&&!e},describe(s){const c={name:ai.Gecko},e=Vi(/gecko\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:ai.Blink}}},{test:[/(apple)?webkit/i],describe(s){const c={name:ai.WebKit},e=Vi(/webkit\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}}],us=(s,c)=>s.find(e=>{if(typeof e.test=="function")return e.test(c);if(Array.isArray(e.test))return e.test.some(t=>typeof t=="string"?c.indexOf(t)>-1:t instanceof RegExp?t.test(c):!1)}),Jc=()=>{try{const s=navigator.userAgent||"",c=us(Gc,s);if(c){const e=c.describe(s);return`${e.name}/${e.version||qc.browserVersion}`}}catch(s){}return navigator.userAgent},Xc=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],Zc=()=>{let s="unknown";try{const c=navigator.userAgent||"",e=us(Xc,c);if(!e)return s;s=e.describe(c)}catch(c){}return s},Yc=[{test:[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],describe(){return"Samsung"}},{test:[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i,/\((ipad);[-\w\),; ]+apple/i,/(macintosh);/i],describe(){return"Apple"}},{test:[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],describe(){return"Huawei"}},{test:[/(?:honor)([-\w ]+)[;\)]/i],describe(){return"Honor"}},{test:[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],describe(){return"Xiaomi"}},{test:[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],describe(){return"Oppo"}},{test:[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],describe(){return"Vivo"}},{test:[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],describe(){return"Realme"}},{test:[/(pixel c)\b/i,/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],describe(){return"Google"}},{test:[/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],describe(){return"ZTE"}},{test:[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],describe(){return"Meizu"}}],Qc=()=>{let s="Unknown";try{const c=navigator.userAgent||"",e=us(Yc,c);if(!e)return s;s=e.describe(c)}catch(c){}return s},{BrowserUtil:hs,SystenUtil:Sa}=pe.AliRTS;class _a{constructor(){_(this,"tracker");_(this,"param");_(this,"msgCacheArr",[]);_(this,"index",0);_(this,"stsOpt");_(this,"slsToken");_(this,"ossToken")}createTracker(){if(!this.tracker&&this.slsToken&&this.param){const c=this.slsToken;this.ossToken&&(this.param.ossbn=this.ossToken.bucket_name,this.param.ossep=this.ossToken.region_endpoint);const e=new va({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=xa(t);e.useStsPlugin(i),this.tracker=e,this.msgCacheArr.forEach((r,n)=>{var a,o;(o=this.tracker)==null||o.send(ve(Rt(ve({},this.param),{stat_log_id:`${((a=this.param)==null?void 0:a.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 t,i;c.tm=Date.now();let e;try{e=JSON.parse(JSON.stringify(ve(Rt(ve({bt:hs.browserName||"unknown"},this.param),{stat_log_id:`${((t=this.param)==null?void 0:t.sesid)||"nosession"}-${this.index}`}),c)))}catch(r){}if(e){if(!this.tracker){this.msgCacheArr.push(e);return}(i=this.tracker)==null||i.send(e),this.index++}}initParam(c){let e=localStorage==null?void 0:localStorage.getItem("AliRtcUUID");e||(e=Kt(),localStorage==null||localStorage.setItem("AliRtcUUID",e)),this.param||(this.param={apid:c.appId,usrid:c.userId,statsvrs:"0.6.1",evetid:0,sesid:c.sessionId,sessionId:c.sessionId,channelid:c.channelId,usrn:c.userId,osn:Sa.systemName,osv:Sa.systemVersion,deb:Qc(),den:Jc(),udid:e,sdkvrs:mr,acs:"Unknown",cput:Zc(),dm:`${window.location.protocol}//${window.location.host}`,bt:hs.browserName,bv:hs.browserVersion,envir:"PRODUCT",args:""})}}const Le=(s,c=1,e=6e4,t=0)=>{let i=s;return i||(i=0),Math.min(e,Math.max(t,Math.round(i*c)))},bt=(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))))},Jt=(s,c)=>{if(c===0||!c)return"0.00";let e=s;return(!e||e<0)&&(e=0),(e/c*100).toFixed(2)},ya=s=>s>=0&&s<=1?Le(Math.floor(32767*s),1,32767):0,Me=(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},e0=(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)},Aa=(s,c)=>Le(Me(s,c),1e3,1e4),Xt=(s,c=2e7)=>Le(s,1,c),Ti=class Ti{constructor(c){_(this,"engine");_(this,"logClient");_(this,"authInfo");this.logClient=new _a,this.engine=c}static getLogClient(){return this.staticClient||(this.staticClient=new _a),this.staticClient}static reportOSSUpload(c,e,t=0){Ti.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),Ti.getLogClient().updateToken(c,e)}stop(){this.logClient.stop()}reportPublishMonitor(c,e,t,i,r){if(!t||r.length<=0)return;const n=t===G.Audio,a={ctm:Math.floor(r[0].timestamp||0),src:r[0].ssrc||"",codec:r[0]._codec||""},o=[],u=[],h=[],g=[],f=[],l=[],p=[],d=[],m=[],v=[],b=[],x=[],y=[],E=[],I=[],w=[],R=[],L=[],D=[];try{if(r.forEach(N=>{var z,F,K,Q,ge,ce;if(!N||!N.timestamp)return;const C=(z=N._last)!=null&&z.timestamp?N.timestamp-N._last.timestamp:1e3,M=Me(N,"bytesSent"),A=Me(N,"headerBytesSent"),U=bt(Le(M+A,8,2e7),C);o.push(U);const ie=bt(Le(M,8,2e7),C);u.push(ie);const q=bt(Le(A,8,2e7),C);h.push(q);const oe=Me(N,"packetsSent"),$=bt(oe,C);g.push($);const se=Me(N,"packetsLost"),k=bt(se,C);f.push(k);const P=Jt(se,oe);if(l.push(P),n)(F=N._source)!=null&&F.audioLevel&&p.push(ya(N._source.audioLevel)),d.push(0);else{m.push(Aa(N,"totalEncodeTime")),v.push(Xt((K=N._source)==null?void 0:K.framesPerSecond,100)),b.push(Xt((Q=N._source)==null?void 0:Q.framesPerSecond,100)),x.push(Xt(N.framesPerSecond,100)),y.push(Xt((ge=N._source)==null?void 0:ge.height,4400)),E.push(Xt((ce=N._source)==null?void 0:ce.width,7700)),I.push(Xt(N.frameHeight,4400)),w.push(Xt(N.frameWidth,7700));const Se=Me(N,"totalPacketSendDelay");R.push(Le(Se,1/(se||1),2e3));const De=Me(N,"qpSum");L.push(Le(De,1/(N.framesPerSecond||1),51)),D.push(0)}}),a.sbr=o.join(","),a.mbrs=u.join(","),a.pbrs=h.join(","),a.ps=g.join(","),a.pl=f.join(","),a.plr=l.join(","),n){const N=(i==null?void 0:i.getSettings().sampleRate)||0;a.ailevel=p.join(","),a.arpc=d.join(","),a.arsr=N,a.aesr=N,a.publevel=-90,a.rawlevel=-90}else a.em=m.join(","),a.cfps=v.join(","),a.ifps=b.join(","),a.sfps=x.join(","),a.ih=y.join(","),a.iw=E.join(","),a.sh=I.join(","),a.sw=w.join(","),a.sd=R.join(","),a.aqp=L.join(","),a.caf=D.join(","),a.can=D.join(","),a.cav=u.join(","),a.ifimax=D.join(","),a.ifimin=D.join(","),a.efimax=D.join(","),a.efimin=D.join(","),a.sfimax=D.join(","),a.sfimin=D.join(","),a.apsnr=D.join(",")}catch(N){}this.log({evetid:10070,traceid:e,calid:c,args:this.data2String(ve({calid:c,tckid:t,traceid:e},a))})}reportSubscribeMonitor(c,e,t,i,r){if(!i||!r||r.length<=0)return;const n=i===G.Audio,a={ctm:Math.floor(r[0].timestamp||0),src:r[0].ssrc||"",codec:r[0]._codec||""},o=[],u=[],h=[],g=[],f=[],l=[],p=[],d=[],m=[],v=[],b=[],x=[],y=[],E=[],I=[],w=[],R=[],L=[],D=[],N=[],C=[],M=[],A=[],U=[],ie=[],q=[],oe=[],$=[],se=[],k=[],P=[],z=[],F=[],K=[];try{r.forEach(Q=>{var ee,le;if(!Q||!Q.timestamp)return;const ge=(ee=Q._last)!=null&&ee.timestamp?Q.timestamp-Q._last.timestamp:1e3,ce=Me(Q,"bytesReceived"),Se=Me(Q,"headerBytesReceived"),De=bt(Le(ce+Se,8,2e7),ge);o.push(De);const Ie=bt(Le(ce,8,2e7),ge);u.push(Ie);const Ue=bt(Le(Se,8,2e7),ge);h.push(Ue);const Te=Me(Q,"packetsReceived"),S=bt(Te,ge);g.push(S);const J=Me(Q,"packetsLost"),W=bt(J,ge);f.push(W);const B=Jt(J,Te);l.push(B);const T=Me(Q,"jitterBufferDelay"),V=Me(Q,"jitterBufferEmittedCount");if(Q.jitterBufferDelay&&Q.jitterBufferEmittedCount){const re=Le(T,1e3/V,1e4);p.push(re)}else p.push(0);const Z=Me(Q,"fecPacketsReceived");x.push(Jt(Z,Te));const X=Me(Q,"retransmittedPacketsReceived"),H=Te+J-X;if(m.push(Jt(Te-X,H)),v.push(Jt(J,H)),d.push(Jt(X,H)),b.push(H),F.push(0),K.push(""),n){E.push(ya(Q.audioLevel));const re=e0(Q,"synthesizedSamplesEvents");I.push(re);const me=Aa(Q,"synthesizedSamplesDuration");w.push(me);const we=Jt(me,ge);y.push(we),R.push(0)}else{const re=(le=Q._last)!=null&&le.totalInterFrameDelay?Q.totalInterFrameDelay-Q._last.totalInterFrameDelay:0;L.push(Le(re,1e3/(Q.framesDecoded||30),500)),D.push(Le(Q.framesPerSecond,1,100)),N.push(Me(Q,"framesReceived")),z.push(Me(Q,"framesRendered")),C.push(Le(Q.frameHeight,1,4400)),M.push(Le(Q.frameWidth,1,7700));const me=Me(Q,"totalProcessingDelay");A.push(Le(me,1e3/(Q.framesDecoded||30),12e4));const we=Me(Q,"nackCount");ie.push(we);const ye=Me(Q,"pliCount");U.push(ye);const Qe=Me(Q,"qpSum");q.push(Le(Qe,1/(Q.framesPerSecond||1),51)),oe.push(Le(Q.framesDropped));const Ct=Me(Q,"totalFreezesDuration");$.push(Le(Ct,1e3,3e4));const Fe=Me(Q,"jitterBufferEmittedCount"),ut=Me(Q,"jitterBufferDelay");ut&&Fe?se.push(Le(ut,1e3/Fe,3e4)):se.push(0);const Ne=Me(Q,"jitterBufferTargetDelay");Ne&&Fe?k.push(Le(Ne,1e3/Fe,3e4)):k.push(0);const It=Me(Q,"jitterBufferMinimumDelay");It&&Fe?P.push(Le(It,1e3/Fe,3e4)):P.push(0)}}),a.rbr=o.join(","),a.mbrs=u.join(","),a.pbrs=h.join(","),a.pr=g.join(","),a.pl=f.join(","),a.plr=l.join(","),a.jd=p.join(","),a.fecr=x.join(","),a.retransr=d.join(","),a.baser=m.join(","),a.basel=v.join(","),a.recoverr=F.join(","),a.alll=v.join(","),a.totalc=b.join(","),n?(a.er=y.join(","),a.aolevel=E.join(","),a.asrc=R.join(","),a.scnt=I.join(","),a.sdura=w.join(",")):(a.dm=L.join(","),a.dfps=D.join(","),a.rfps=N.join(","),a.rh=C.join(","),a.rw=M.join(","),a.fpt=K.join(","),a.ns=ie.join(","),a.pliss=U.join(","),a.aqp=q.join(","),a.ofimax=F.join(","),a.ofimin=F.join(","),a.dfimax=F.join(","),a.dfimin=F.join(","),a.rfimax=F.join(","),a.rfimin=F.join(","),a.vrstutter=$.join(","),a.cdm=se.join(","),a.tdm=k.join(","),a.pdm=P.join(","),a.ofps=z.join(","),a.dfbd=oe.join(","))}catch(Q){}this.log({evetid:10080,traceid:t,rmtid:e,calid:c,args:this.data2String(ve({calid:c,rmtid:e,tckid:i,traceid:t},a))})}reportNetworkMonitor(c){if(c.length<=0)return;const e=[],t=[],i=[],r=[],n=[],a=[],o=[],u=[],h=[],g=[];c.forEach((l,p)=>{var m;if(!l.timestamp)return;const d=(m=l._last)!=null&&m.timestamp?l.timestamp-l._last.timestamp:1e3;e.push(Le(l.currentRoundTripTime,1e3)),t.push(Le(l.availableOutgoingBitrate,8,2e8)),i.push(bt(Le(l.bytesSent,8,2e7),d,25e6)),r.push(bt(Le(l.bytesReceived,8,2e7),d,25e6)),n.push(0),a.push(0),p%5===0&&(o.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:o.join(","),mem:u.join(","),sysmem:h.join(","),systotalmem:g.join(","),audioonly:this.engine.isAudioOnly()?1:0};this.log({evetid:10071,args:this.data2String(ve({asb:t.join(","),abms:n.join(","),vbms:a.join(",")},f))}),this.log({evetid:10081,args:this.data2String(ve({},f))})}reportJoin(c,e,t=""){var g,f;const{start:i,rs:r=0,re:n=0}=e,a=Date.now()-i,o=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:a,rslt:c,gslbtm:0,dnstm:0,avcftm:0,gslbrslt:0,dnsrslt:0,avcfrslt:0,mode:2,jrtc:o,usrn:(f=this.authInfo)==null?void 0:f.userId,mgt:"cdn",cttc:u,iptc:h,ndn:1,gslbloc:1,ccag:0,ucag:0,cpg:0,upg:0,tid:t})})}reportJoinConnection(c){this.log({evetid:20002,args:this.data2String(ve({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,a,o,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:a?1:0,rslt:o,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,a,o,u){const h=Date.now();this.log({evetid:c?10033:10031,calid:e,args:this.data2String({calid:e,fpst:h-t,tckid:n,est:t,pctid:a,pubtid:o,totaltm:h-r,jorm:u===Bt.JOIN_CHANNEL?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,a,o,u,h){this.log({evetid:10050,calid:c,rmtid:e,args:this.data2String(ve({calid:c,rmtid:e,isvl:t?1:0,isvs:i?1:0,isvss:r?1:0,isaudio:n?1:0,rslt:a,tid:o,subtm:u,isvp:0,isaplaying:0,isad:0,isdc:0,subretry:0,sbrttimes:0},h))})}reportSubscribeFirstPacket(c,e,t,i,r){this.log({evetid:c?10054:10051,calid:e,rmtid:t,args:this.data2String(ve({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(ve({calid:e,rmtid:t,tckid:i},r))}),this.log({evetid:c?10058:10057,args:this.data2String(ve({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==null?void 0: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==null?void 0: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,r,n;this.log({evetid:90013,args:this.data2String({rslt:c?-1:0,vcms:e,vde:(t=c==null?void 0:c.code)!=null?t:-1,sesid:((i=this.authInfo)==null?void 0:i.sessionId)||""})}),this.log({evetid:90014,args:this.data2String({rslt:c?-1:0,vcms:e,vde:(r=c==null?void 0:c.code)!=null?r:-1,sesid:((n=this.authInfo)==null?void 0:n.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(ve({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,e){this.log({evetid:70014,rslt:c,asty:1,reqtm:Date.now()-e})}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(),ae.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}};_(Ti,"staticClient");let vi=Ti;const t0=1e3*60*60*24*7,i0=s=>{if(!s||s.length!==8)return new Date;const c=parseInt(s.substring(0,4),10),e=parseInt(s.substring(4,6),10)-1,t=parseInt(s.substring(6,8),10);if(isNaN(c)||isNaN(e)||isNaN(t))return new Date;const i=new Date(c,e,t);return isNaN(i.getTime())?new Date:i};var ds=(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))(ds||{});class Ui{constructor(){_(this,"dbPromise");_(this,"stsToken");_(this,"logLevel");_(this,"logToConsole");_(this,"logToServer");_(this,"appId");_(this,"sessionId");_(this,"logCache",[]);_(this,"logMethod",(c,e=console.log)=>(...t)=>{if(this.logLevel>c)return;let i=this.getCurrentTime();this.logToConsole&&e(i,...t);let r=Ui.paramArrayToString(t);c>0&&this.addLog(r)});_(this,"d",this.logMethod(0,console.debug));_(this,"i",this.logMethod(1));_(this,"w",this.logMethod(3,console.warn));_(this,"e",this.logMethod(4,(...c)=>{const[e,...t]=c;console.error(e,"<error>",t)}));_(this,"ev",this.logMethod(2));_(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)}));_(this,"ar",this.logMethod(2,(...c)=>{const[e,...t]=c;console.log(e,...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));_(this,"ae",this.logMethod(2,(...c)=>{const[e,...t]=c;console.error(e,"<error>",...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));this.logLevel=3,this.logToConsole=!0,this.logToServer=!0,this.appId="",this.sessionId="",this.dbPromise=Zo()}static toString(c){let e;if(c instanceof Error)e=c.message;else if(typeof c=="string")e=c;else try{e=JSON.stringify(c)}catch(t){e="undefined"}return e}changeConfig(c){c.logLevel!==void 0&&c.logLevel>=0&&c.logLevel<=5&&(this.logLevel=c.logLevel),c.logToConsole!==void 0&&(this.logToConsole=c.logToConsole),c.logToServer!==void 0&&(this.logToServer=c.logToServer)}updateSTSToken(c){const e=!!this.stsToken;this.stsToken=c,!e&&c&&this.tryUploadHistorySessionLog()}uploadSessionDateLog(c,e,t){return O(this,null,function*(){if(!c||!e||!t||t.length===0||!this.stsToken)return;const i=new Fo;i.file(`${c}.log`,t.map(f=>f.log||"").join(`
40
- `));const r=yield i.generateAsync({type:"blob"}),n=yield Rc(r),a=cs(new Date,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),o={"x-oss-date":a,"content-md5":n,"content-type":"application/zip"};o.date=a,o["x-oss-security-token"]=this.stsToken.security_token;const u=`client/${e}/${this.appId}/${c}.zip`;o.authorization=yield Tc(this.stsToken.access_key_id,this.stsToken.access_key_secret,o,`/${this.stsToken.bucket_name}/${u}`);const h=`https://${this.stsToken.bucket_name}.${this.stsToken.region_endpoint}/${u}`,g=yield fetch(h,{method:"PUT",headers:o,body:r});if(g.status===200){vi.reportOSSUpload(c,e);const f=yield this.dbPromise;t.forEach(l=>{Ar(f,l.id)})}else vi.reportOSSUpload(c,e,g.status)})}uploadSessionLog(c){c&&this.dbPromise.then(e=>O(this,null,function*(){if(!this.stsToken)return;const t=yield In(e,c),i={},r=[];t.forEach(n=>{if(!n.date||!n.log){try{Ar(e,n.id)}catch(o){}return}const a=n.date;if(Date.now()-i0(a).getTime()>t0)try{Ar(e,n.id)}catch(o){}else i[a]||(i[a]=[],r.push(a)),i[a].push(n)}),Promise.all(r.map(n=>this.uploadSessionDateLog(c,n,i[n]))).then(()=>O(this,null,function*(){(yield In(e,c)).length===0&&ec(e,c)}))}))}tryUploadHistorySessionLog(){this.dbPromise.then(c=>O(this,null,function*(){(yield Qo(c)).filter(t=>(t==null?void 0:t.sid)!==this.sessionId).forEach(t=>{this.uploadSessionLog(t.sid)})}))}uploadCurrent(){const c=this.sessionId;this.sessionId="",this.uploadSessionLog(c)}setSessionID(c,e){!c||!e||(this.appId=c,this.dbPromise.then(t=>{this.sessionId=e,Yo(t,e),this.logCache&&(this.logCache.forEach(i=>{i.date&&i.log&&Cn(t,this.sessionId,i.date,`${i.log}`)}),this.logCache=[])}))}addLog(c){if(!this.logToServer)return;const e=this.getCurrentTime(),t=this.getCurrentDate(),i=`${e} ${c}`;this.sessionId?this.dbPromise.then(r=>{Cn(r,this.sessionId,t,i)}):this.logCache.push({date:t,log:i})}getCurrentTime(){return cs(new Date,"HH:MM:ss.l")}getCurrentDate(){return cs(new Date,"yyyymmdd")}static paramArrayToString(c){let e="";for(let t=0;t<c.length;t++){e!==""&&(e+=" ");let i=Ui.toString(c[t]);e+=i}return e}}class ae{static getLogger(){return this.logger||(this.logger=new Ui),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)}}_(ae,"logger");const r0=s=>O(this,null,function*(){const c=new pe.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()&&!pe.AliRTS.SystenUtil.isAndroid&&!pe.AliRTS.SystenUtil.isIos,e.detail.isSendMediaExtensionMsgSupported=c.checkWebRtcSupport()&&c.checkEncodedTransformSupport(),e}),s0=()=>new pe.AliRTS.SupportUtil().checkScreenCapture();var We=(s=>(s[s.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",s[s.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen",s))(We||{}),Ea=(s=>(s[s.PRE_PROCESSOR=0]="PRE_PROCESSOR",s[s.POST_PROCESSOR=1]="POST_PROCESSOR",s))(Ea||{}),xi=(s=>(s[s.AUDIO=0]="AUDIO",s[s.VIDEO=1]="VIDEO",s[s.BOTH=2]="BOTH",s))(xi||{});class Zt extends xe{constructor(e,t=We.AliRtcSdkStreamTypeCapture,i=1){super();_(this,"name");_(this,"options");_(this,"type",0);_(this,"streamType");_(this,"trackType");_(this,"zIndex",1);_(this,"_isEnable",!0);_(this,"lastInputAudioTrack");_(this,"lastOutputAudioTrack");_(this,"lastInputVideoTrack");_(this,"lastOutputVideoTrack");_(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 O(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 O(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 Si=(s=>(s[s.LiveTranscodingSingle=0]="LiveTranscodingSingle",s[s.LiveTranscodingMix=1]="LiveTranscodingMix",s))(Si||{}),ls=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingAudio=1]="LiveTranscodingAudio",s[s.LiveTranscodingVideo=2]="LiveTranscodingVideo",s))(ls||{}),oi=(s=>(s[s.LiveTranscodingCamera=0]="LiveTranscodingCamera",s[s.LiveTranscodingShareScreen=1]="LiveTranscodingShareScreen",s))(oi||{});const _i={0:"camera",1:"shareScreen"};var fs=(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))(fs||{});const n0={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 Hi=(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))(Hi||{}),yi=(s=>(s[s.LiveTranscodingNoBody=0]="LiveTranscodingNoBody",s[s.LiveTranscodingBody=1]="LiveTranscodingBody",s))(yi||{}),Ai=(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))(Ai||{}),ps=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingCrop=1]="LiveTranscodingCrop",s[s.LiveTranscodingFill=2]="LiveTranscodingFill",s))(ps||{}),zi=(s=>(s[s.LiveTranscodingNormal=0]="LiveTranscodingNormal",s[s.LiveTranscodingVirtualBackground=1]="LiveTranscodingVirtualBackground",s))(zi||{}),ms=(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))(ms||{}),Et=(s=>(s[s.LiveTranscodingErrorPublishOk=0]="LiveTranscodingErrorPublishOk",s[s.LiveTranscodingErrorStreamNotFound=17825793]="LiveTranscodingErrorStreamNotFound",s[s.LiveTranscodingErrorStreamAlreadyExist=17825794]="LiveTranscodingErrorStreamAlreadyExist",s[s.LiveTranscodingErrorInvalidParam=17825795]="LiveTranscodingErrorInvalidParam",s[s.LiveTranscodingErrorInternalError=17825796]="LiveTranscodingErrorInternalError",s[s.LiveTranscodingErrorRtmpServerError=17825797]="LiveTranscodingErrorRtmpServerError",s[s.LiveTranscodingErrorRtmpStreamUrlError=17825798]="LiveTranscodingErrorRtmpStreamUrlError",s[s.LiveTranscodingErrorPublishTimeout=17825799]="LiveTranscodingErrorPublishTimeout",s[s.LiveTranscodingErrorNotAuthorized=17825800]="LiveTranscodingErrorNotAuthorized",s))(Et||{}),gs=(s=>(s[s.TrascodingPublishTaskStatusStart=0]="TrascodingPublishTaskStatusStart",s[s.TrascodingPublishTaskStatusUpdate=1]="TrascodingPublishTaskStatusUpdate",s[s.TrascodingPublishTaskStatusStop=2]="TrascodingPublishTaskStatusStop",s))(gs||{}),ot=(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))(ot||{});const a0={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 bs{constructor(c,e,t,i,r,n,a,o){_(this,"videoWidth");_(this,"videoHeight");_(this,"videoFramerate",20);_(this,"videoBitrate",2e3);_(this,"videoGop",30);_(this,"audioSamplerate",Hi.LiveTranscoding_HZ_44100);_(this,"audioBitrate",500);_(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),a&&(this.audioBitrate=a),o&&(this.audioChannels=o)}}const vs=s=>((s&16711680)>>16)+(s&65280)+((s&255)<<16),vt=(s=0,c)=>{if(c==0)return 0;let e=s/c;return e<0&&(e=0),e>1&&(e=1),e};class ji{constructor(c,e,t){_(this,"mixMode",Si.LiveTranscodingSingle);_(this,"singleParam");_(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===ot.MPU_TASK_TRANSACTION_POLLING||c===ot.MPU_TASK_TRANSACTION_LIST||c===ot.MPU_TASK_TRANSACTION_ACKNOWLEDGE)return c===ot.MPU_TASK_TRANSACTION_ACKNOWLEDGE&&(n.messageid=r),n;if(n.taskid=t,c!==ot.MPU_TASK_TRANSACTION_STOP){if(n.mixmode=this.mixMode,i&&(n.streamurl=i),this.mixMode===Si.LiveTranscodingSingle){const a=this.singleParam;if(a){n.streamtype=a.streamType,a.sourceType===oi.LiveTranscodingShareScreen?n.sourcetype=_i[a.sourceType]:n.sourcetype=_i[oi.LiveTranscodingCamera];const o=[];a.userId&&o.push(a.userId),n.subspecusers=o}}else if(c===ot.MPU_TASK_TRANSACTION_START||c===ot.MPU_TASK_TRANSACTION_UPDATE){const a=this.mixParam;if(a){a.taskProfile&&(n.taskprofile=n0[a.taskProfile]);const o=a.encodeParam||new bs(1280,720);let u=o.videoWidth,h=o.videoHeight;const g={};Object.keys(o).forEach(l=>{const p=o[l];p>0&&(g[l.toLowerCase()]=p)}),g.lowbitratehighquality=0,n.encodeparam=g,n.backgrounds=a.backgrounds.map(l=>l.toJson(u,h)),n.watermarks=a.watermarks.map(l=>l.toJson(u,h)),n.clockwidgets=a.clockWidgets.map(l=>l.toJson(u,h));const f=a.users.map(l=>l.userId);n.subspecusers=[...new Set(f)],n.layouts=[{audiomixcount:a.users.length,panes:a.users.map((l,p)=>l.toJson(p,u,h,a.mediaProcessMode))}],n.layoutids=["0"],n.cropmode=a.cropMode,n.backgroundcolor=vs(a.backgroundColor),n.taskmode=a.mediaProcessMode}}}return n}}var Dt=(s=>(s.pre="pre",s.prod="prod",s))(Dt||{}),Tt=(s=>(s.AliRtcSdkCommunication="communication",s.AliRtcSdkInteractiveLive="interactive_live",s.AliRtcSdkInteractiveWithLowLatencyLive="cdn_live",s))(Tt||{}),Mt=(s=>(s.AliRtcSdkInteractive="interactive",s.AliRtcSdkLive="live",s))(Mt||{}),wt=(s=>(s[s.AliEngineLocalDeviceTypeUnknown=0]="AliEngineLocalDeviceTypeUnknown",s[s.AliEngineLocalDeviceTypeMic=1]="AliEngineLocalDeviceTypeMic",s[s.AliEngineLocalDeviceTypeSpeaker=2]="AliEngineLocalDeviceTypeSpeaker",s[s.AliEngineLocalDeviceTypeAudioDevice=3]="AliEngineLocalDeviceTypeAudioDevice",s[s.AliEngineLocalDeviceTypeCamera=4]="AliEngineLocalDeviceTypeCamera",s[s.AliEngineLocalDeviceTypeDisplay=5]="AliEngineLocalDeviceTypeDisplay",s[s.AliEngineLocalDeviceTypeVideoDevice=6]="AliEngineLocalDeviceTypeVideoDevice",s))(wt||{}),He=(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))(He||{}),ke=(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))(ke||{}),Yt=(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))(Yt||{}),xs=(s=>(s[s.AliRtcUserOfflineQuit=0]="AliRtcUserOfflineQuit",s[s.AliRtcUserOfflineDropped=1]="AliRtcUserOfflineDropped",s[s.AliRtcUserOfflineBecomeAudience=2]="AliRtcUserOfflineBecomeAudience",s))(xs||{}),ci=(s=>(s[s.AliRtcAudioTrackNo=0]="AliRtcAudioTrackNo",s[s.AliRtcAudioTrackMic=1]="AliRtcAudioTrackMic",s[s.AliRtcAudioTrackDual=2]="AliRtcAudioTrackDual",s))(ci||{}),Ae=(s=>(s[s.AliRtcVideoTrackNo=0]="AliRtcVideoTrackNo",s[s.AliRtcVideoTrackCamera=1]="AliRtcVideoTrackCamera",s[s.AliRtcVideoTrackScreen=2]="AliRtcVideoTrackScreen",s[s.AliRtcVideoTrackBoth=3]="AliRtcVideoTrackBoth",s))(Ae||{}),be=(s=>(s[s.AliRtcStatePublishIdle=0]="AliRtcStatePublishIdle",s[s.AliRtcStateNoPublish=1]="AliRtcStateNoPublish",s[s.AliRtcStatePublishing=2]="AliRtcStatePublishing",s[s.AliRtcStatePublished=3]="AliRtcStatePublished",s))(be||{}),Pe=(s=>(s[s.AliRtcStateSubscribeIdle=0]="AliRtcStateSubscribeIdle",s[s.AliRtcStateNoSubscribe=1]="AliRtcStateNoSubscribe",s[s.AliRtcStateSubscribing=2]="AliRtcStateSubscribing",s[s.AliRtcStateSubscribed=3]="AliRtcStateSubscribed",s))(Pe||{}),Ge=(s=>(s[s.AliRtcVideoStreamTypeNone=0]="AliRtcVideoStreamTypeNone",s[s.AliRtcVideoStreamTypeHigh=1]="AliRtcVideoStreamTypeHigh",s[s.AliRtcVideoStreamTypeLow=2]="AliRtcVideoStreamTypeLow",s))(Ge||{}),Ei=(s=>(s[s.CAMERA_INVALID=-1]="CAMERA_INVALID",s[s.CAMERA_REAR=0]="CAMERA_REAR",s[s.CAMERA_FRONT=1]="CAMERA_FRONT",s))(Ei||{});const wa=10,Ca=5e3,di=class di extends xe{constructor(e){super();_(this,"ws");_(this,"socketStatus",0);_(this,"wsUrl","");_(this,"lastConnectStartTime",0);_(this,"maxConnectRetryCount",wa);_(this,"connectRetryCount",0);_(this,"gotErr",!1);_(this,"closedByInvoke",!0);_(this,"isReconnecting",!1);_(this,"networkAvailableChecked",!0);_(this,"reconnectTimeoutId",0);this.maxConnectRetryCount=e!=null?e:wa,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.reconnectTimeoutId&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=0),this.emit("onReconnectStart"),this.isReconnecting=!0,this.initWebSocket()}onOpen(e){ae.info(`[${di.logName}]`,"onOpen"),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.socketStatus!==2&&St.isNetworkAvailable().then(t=>{t&&console.error(di.logName,"onError, Network is available, token may be invalid")})}onClose(e){return O(this,null,function*(){if(this.closedByInvoke){this.socketStatus=0;return}if(ae.info(`[${di.logName}]`,`onClose, code: ${e.code}, reason: ${e.reason}, status: ${status}, retryCount: ${this.connectRetryCount}`),(yield St.isNetworkAvailable())&&!this.networkAvailableChecked){this.reconnect(),this.networkAvailableChecked=!0;return}else this.connectRetryCount||this.emit("onNetworkError"),this.reconnectTimeoutId||(this.connectRetryCount+=1,this.connectRetryCount>this.maxConnectRetryCount?this.emit("onConnectFail"):Date.now()-this.lastConnectStartTime>=Ca?this.reconnect():this.reconnectTimeoutId=window.setTimeout(()=>{this.reconnect()},Ca));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.readyState!==WebSocket.CLOSED&&this.ws.close(),this.ws=void 0,this.socketStatus=0)}};_(di,"logName","Socket");let Ss=di;var ze=(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))(ze||{});class o0{constructor(c,e){_(this,"authInfo");_(this,"userName");_(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=St.getVersionNumber().toString(),c.header.platform=gn,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=St.getVersionNumber().toString(),e.header.platform=gn,e.data=ve(ve({},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:Kt(),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 te=(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_NOT_AVAILABLE=17040400]="ERR_SPEAKER_NOT_AVAILABLE",s[s.ERR_CAMERA_OPEN_FAIL=17039620]="ERR_CAMERA_OPEN_FAIL",s[s.ERR_CAMERA_AUTH_FAIL=17039621]="ERR_CAMERA_AUTH_FAIL",s[s.ERR_CAMERA_INTERRUPT=17039622]="ERR_CAMERA_INTERRUPT",s[s.ERR_CAMERA_NOT_AVAILABLE=17039623]="ERR_CAMERA_NOT_AVAILABLE",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_STREAM_FAILED=16843856]="ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED",s[s.ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED=16843857]="ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED",s[s.ERR_SDK_PUBLISH_DUAL_STREAM_FAILED=16843858]="ERR_SDK_PUBLISH_DUAL_STREAM_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_STREAM_FAILED=16844113]="ERR_SDK_SUBSCRIBE_AUDIO_STREAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_VIDEO_STREAM_FAILED=16844114]="ERR_SDK_SUBSCRIBE_VIDEO_STREAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_DUAL_STREAM_FAILED=16844115]="ERR_SDK_SUBSCRIBE_DUAL_STREAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED=16844116]="ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED",s[s.ERR_SDK_SUBSCRIBE_DATA_FAILED=16844117]="ERR_SDK_SUBSCRIBE_DATA_FAILED",s[s.ERR_SDK_SUBSCRIBE_DATA_ERROR=16844118]="ERR_SDK_SUBSCRIBE_DATA_ERROR",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))(te||{});class Y extends Error{constructor(e,t,i){super(t);_(this,"_code");_(this,"_extra");this._code=e,this._extra=i}static fromRtsError(e){return e instanceof Y?e:new Y((e==null?void 0:e.errorCode)||-1,(e==null?void 0:e.message)||(e==null?void 0:e.errorCodeName)||"rts error",e)}static fromError(e,t=-1,i=""){return new Y(t,(e==null?void 0:e.message)||(e==null?void 0:e.reason)||i||"error",e)}get code(){return this._code}set code(e){this._code=e}get reason(){return this.message}get extra(){return this._extra}}const c0=3e4,lt=class lt extends xe{constructor(e,t,i,r,n,a){super();_(this,"authInfo");_(this,"userName");_(this,"channelProfile");_(this,"clientRole");_(this,"slsReporter");_(this,"wsClient");_(this,"packageCreater");_(this,"keepAliveTimer",0);_(this,"packageCache",new Map);_(this,"isFirstConnect",!0);_(this,"aliveChecker",0);_(this,"reconnectData");this.authInfo=e,this.userName=t,this.packageCreater=new o0(e,t),this.channelProfile=i,this.clientRole=r,this.slsReporter=n,this.wsClient=new Ss(a),this.wsClient.on("onOpen",this.onOpen.bind(this)),this.wsClient.on("onMessage",this.onMessage.bind(this)),this.wsClient.on("onError",this.onError.bind(this)),this.wsClient.on("onClose",this.onClose.bind(this)),this.wsClient.on("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.on("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.on("onNetworkError",this.onNetworkError.bind(this)),this.wsClient.on("onReconnectStart",this.onReconnectStart.bind(this)),this.wsClient.on("onReconnectFail",this.onReconnectFail.bind(this))}get retryCount(){return this.wsClient.connectRetryCount}start(e){this.wsClient.start(e)}startKeepAlive(){this.keepAliveTimer===0&&(this.keepAliveTimer=window.setInterval(()=>{let e=this.packageCreater.createKeepAlivePackage();this.sendPackage(e)},5e3)),this.checkAlive()}stopKeepAlive(){this.keepAliveTimer!==0&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=0),this.aliveChecker&&(window.clearTimeout(this.aliveChecker),this.aliveChecker=0)}sendPkgCache(){this.packageCache.forEach(e=>{this.wsClient.send(e)})}leave(){let e=this.packageCreater.crateLeavePackage();this.sendPackage(e)}reportStatus(e){let t=this.packageCreater.createStatusPackage(e);this.sendPackage(t)}publish(e){const o=e,{l1ip:t}=o,i=pi(o,["l1ip"]);let r=this.packageCreater.createPublishPackage();r.data.users=[],r.data.l1ip=t,i.subscribe.signal=this.wsClient.connectUrl;const{tracks:n,resume:a}=i;n.forEach(u=>{const{codec:h,ssrc:g}=u;u.userdata=JSON.stringify({codec:h}),u.ssrc=`${g}`,a&&(u.attr={reason:"reconnect"})}),r.data.users.push(i),this.sendPackage(r)}roleUpdate(e){let t=this.packageCreater.createRoleUpdatePackage();t.data.clientrole=e,this.sendPackage(t)}refreshUrl(e){const t=this.packageCreater.createRefreshUrlPackage();t.data=ve(Rt(ve({},t.data),{sessionid:t.header.sessionid}),e),this.sendPackage(t)}refreshAuthInfo(e){this.authInfo=e,this.packageCreater.refreshAuthInfo(e)}close(){ae.info(`[${lt.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){[ze.KEEPALIVE,ze.RECONNECT,ze.JOINCHANNEL].includes(e.msgtype)||this.packageCache.set(e.tid,e),this.wsClient.send(e),e.msgtype!==ze.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!0,e.msgtype,e.tid,e)}updateReconnectData(e){this.reconnectData=e}onOpen(){if(ae.info(`[${lt.logName}] onOpen`),this.isFirstConnect){let e=this.packageCreater.createJoinPackage();e.data.configure={channelprofile:this.channelProfile},(this.channelProfile===Tt.AliRtcSdkInteractiveLive||this.channelProfile===Tt.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)!==ze.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!1,t.msgtype,t.tid,t)}catch(t){ae.warn(`[${lt.logName}] onMessage err`,t,e)}}onError(e){ae.warn(`[${lt.logName}] onError`,e),this.isFirstConnect&&this.onConnectFail()}onConnectFail(){ae.warn(`[${lt.logName}] onConnectFail`);const e=new Y(te.ERR_INNER,"Signaling connect failed.");this.isFirstConnect?this.emit("onJoinChannelResult",e):this.emit("onConnectFail",e)}onAuthInvalid(){ae.warn(`[${lt.logName}] onAuthInvalid`),this.isFirstConnect&&this.emit("onAuthInvalid")}onNetworkError(){ae.warn(`[${lt.logName}] onNetworkError`);const e=new Y(te.ERR_INNER,"Network error, signaling connect failed.");this.emit("onNetworkError",e)}onClose(e){ae.info(`[${lt.logName}] onClose`,e),this.stopKeepAlive()}onKeepAliveRsp(){this.emit("onKeepAliveRsp"),this.checkAlive()}onReconnectStart(){this.emit("onReconnectStart")}onReconnectFail(){this.emit("onReconnectFail",new Y(te.ERR_INNER,"signaling reconnect failed."))}checkAlive(){window.clearTimeout(this.aliveChecker),this.aliveChecker=window.setTimeout(()=>{ae.info(`[${lt.logName}] not alive, reconnect`),this.stopKeepAlive(),this.emit("onReconnectStart"),this.wsClient.reconnect()},c0)}onRecvMessage(e){switch(e.msgtype!==ze.KEEPALIVE&&ae.info(`[${lt.logName}] recv msg: ${e.msgtype}`),e.msgtype){case ze.JOINCHANNEL:this.onJoinResult(e);break;case ze.KEEPALIVE:this.onKeepAliveRsp();break;case ze.PUBLISH:this.onPublishResult(e);break;case ze.NOTIFYJOIN:this.onNotifyJoin(e);break;case ze.NOTIFYSTATUS:this.onNotifyStatus(e);break;case ze.LEAVECHANNEL:this.onLeaveResult(e);break;case ze.NOTIFYLEAVE:this.onNotifyLeave(e);break;case ze.NOTIFYPUBLISH:this.onNotifyPublish(e);break;case ze.STATUSREPORT:this.onStatusReport(e);break;case ze.BYE:this.onBye(e);break;case ze.ROLEUPDATE:this.onRoleUpdateResult(e);break;case ze.REFRESHURL:this.onRefreshUrlResult(e);break;case ze.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 Y(te.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)}};_(lt,"logName","RSMessageCenter");let _s=lt;const j=(s,c)=>(e,t,i)=>{const r=i.value;return i.value=function(...n){var g;const a=`[${((g=e.constructor)==null?void 0:g.logName)||""}]`,o=Date.now();let u=[];if(s)try{u=s(n)}catch(f){}ae.interface(a,t,...u);const h=r.apply(this,n);return Promise.resolve(h).then(f=>f).catch(f=>f).then(f=>{var m;let l="";const p=f instanceof Error,d=p&&((m=e.constructor)==null?void 0:m.logError);if(!(!c&&!p)){if(d)l=f;else if(p)l=f.message||"";else if(c)if(f===void 0)l="";else try{l=c(f)}catch(v){}else return;ae.interfaceResult(a,t,!(p&&d),`${Date.now()-o}ms`,l)}}),h},i},ne=s=>s;var u0=Object.defineProperty,h0=Object.getOwnPropertyDescriptor,ys=(s,c,e,t)=>{for(var i=t>1?void 0:t?h0(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&&u0(c,e,i),i};const Wi=(st=class extends xe{constructor(e,t,i,r=Dt.prod){super();_(this,"messageCenter");_(this,"authInfo");_(this,"userName");_(this,"channelProfile");_(this,"clientRole");_(this,"slsReporter");_(this,"reconnectData");_(this,"roomServerUri","");this.channelProfile=e,this.clientRole=t,this.slsReporter=i,this.reconnectData={role:{channelprofile:e,clientrole:t}};const n=r===Dt.pre?Li.pre:Li.prod;this.roomServerUri=`wss://${n}/roomserver/v1/ws`}updateReconnectData(e){var t;this.reconnectData=e,(t=this.messageCenter)==null||t.updateReconnectData(this.reconnectData)}reset(){ae.info("[roomsig] reset"),this.messageCenter&&(this.messageCenter.close(),this.messageCenter=void 0),this.authInfo=void 0}join(e,t,i){return O(this,null,function*(){return new Promise((r,n)=>{const a={};this.authInfo=e,this.userName=t,this.messageCenter=new _s(e,t,this.channelProfile,this.clientRole,this.slsReporter,i),this.initMessageCenter(),this.messageCenter.once("onJoinChannelResult",u=>{var h,g,f;if(ae.info(`[${st.logName}]`,"join result: ",u),a.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 l=u.data;l.tid=u.tid,l.users=u.data.users,l.timestamp=u.timestamp,a.est&&(a.joinconnecttc=Date.now()-a.est),this.slsReporter.reportJoinConnection(a),r(l)}else this.reset(),n(this.handleSignalError(u.code,u.reason,te.ERR_JOIN_CHANNEL_FAILED))}),this.messageCenter.once("onAuthInvalid",()=>{this.reset(),n(new Y(te.ERR_JOIN_BAD_TOKEN,"join failed because authentication failed"))}),ae.info(`[${st.logName}]`,"start ws connecting roomserver and auto join when connected");const o={appid:this.authInfo.appId,callid:this.authInfo.sessionId,channelid:this.authInfo.channelId,userid:this.authInfo.userId,nonce:this.authInfo.nonce||"",timestamp:this.authInfo.timestamp,token:this.authInfo.token,authtype:"app",tid:Kt()};e.role&&(o.tokenrole=e.role),a.est=Date.now(),this.messageCenter.start(this.roomServerUri+"?"+St.queryingParam(o))})})}leave(){return ae.info("[roomsig] leave .."),new Promise((e,t)=>{this.messageCenter?(this.messageCenter.on("onLeaveResult",(i,r)=>{ae.info(`[${st.logName}]`,"recv leave response "+i),i===200?(this.updateReconnectData(),this.reset(),e({tid:r})):t(this.handleSignalError(i,"leave error"))}),ae.info(`[${st.logName}]`,"send leave request"),this.messageCenter.leave()):(ae.info(`[${st.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,a,o)=>{ae.info(`[${st.logName}]`,"recv pubish response "+n),n===200?(this.updateReconnectData(Rt(ve({},this.reconnectData),{publish:{users:[e]}})),t({tid:a})):i(this.handleSignalError(n,`publish error, ${o}`))}),this.authInfo&&(e.sessionid=(r=this.authInfo.sessionId)!=null?r:""),e.callid||(e.callid=Kt()),ae.info(`[${st.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,a)=>{var o,u;ae.info(`[${st.logName}]`,"recv role update response "+r),r===200?((u=(o=this.reconnectData)==null?void 0:o.role)!=null&&u.clientrole&&(this.reconnectData.role.clientrole=e,this.updateReconnectData(this.reconnectData)),t({tid:n})):i(this.handleSignalError(r,`role update error, ${a}`))}),this.messageCenter.roleUpdate(e)})}setChannelProfile(e){this.channelProfile=e}refreshUrl(e){return ae.info(`[${st.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:a,data:o={}}=r||{};ae.info("recv refresh url response "+n),n===200?t(o):i(this.handleSignalError(n,`refresh url error, ${a}`))}),ae.info("send refresh url request"),this.messageCenter.refreshUrl(e)})}reportStatus(e){return ae.info(`[${st.logName}]`,"reportStatus "+e),new Promise((t,i)=>{this.messageCenter?(this.messageCenter.once("onStatusReport",(r,n)=>{r===200?t():i(new Y(r,n))}),this.messageCenter.reportStatus(e)):i(new Y(-1,"No messageCenter"))})}handleSignalError(e,t,i=te.ERR_INNER){const r=`signal error: code - ${e}; description - ${t}`;return new Y(i,r)}refreshAuthInfo(e){return O(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,a,o,u,h,g,f,l;(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)}),(a=this.messageCenter)==null||a.on("onBye",(p,d)=>{this.emit("onBye",p,d)}),(o=this.messageCenter)==null||o.on("onReconnectStart",()=>{this.emit("onReconnectStart")}),(u=this.messageCenter)==null||u.on("onReconnectSuccess",p=>{this.emit("onReconnectSuccess",p)}),(h=this.messageCenter)==null||h.on("onReconnectFail",p=>{this.emit("onReconnectFail",p)}),(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)}),(l=this.messageCenter)==null||l.on("onAuthInvalid",()=>{this.emit("onAuthInvalid")})}},_(st,"logName","RoomServerSignaling"),st);ys([j()],Wi.prototype,"join",1),ys([j()],Wi.prototype,"publish",1),ys([j()],Wi.prototype,"roleUpdate",1);let d0=Wi;const l0="https://pgw.rtn.aliyuncs.com",f0="https://gw.rtn.aliyuncs.com",Ia=10*60*1e3,p0=12,ki=class ki extends xe{constructor(e,t){super();_(this,"env");_(this,"authInfo");_(this,"timer");_(this,"slsReporter");_(this,"expiration",0);_(this,"skipTime",0);_(this,"requestToken",()=>O(this,null,function*(){if(this.skipTime=0,!this.authInfo)return;const{appId:e,channelId:t,userId:i,nonce:r="",token:n,timestamp:a,sessionId:o,role:u}=this.authInfo;let h=f0;this.env===Dt.pre&&(h=l0);const g=`${h}/gslb/v1/stsupdate?appid=${e}&channelid=${t}&userid=${i}&nonce=${r}&token=${n}&timestamp=${a}&session=${o}${u?`&tokenrole=${u}`:""}&slstoken=true&osstoken=true&tokensid=false`,f=Date.now();fetch(g).then(l=>l.json()).then(l=>{var p,d;if(l.code===0){const m=(p=l.data)==null?void 0:p.oss,v=(d=l.data)==null?void 0:d.sls;this.expiration=m.expiration||v.expiration,this.emit("onTokenUpdate",m,v),ae.event(`[${ki.logName}]`,"getToken",m,v)}else throw new Error;this.slsReporter.reportSTSResult(200,f)}).catch(l=>{this.slsReporter.reportSTSResult(-1,f),ae.error(`[${ki.logName}]`,"getToken",l.message)})}));this.slsReporter=e,this.env=t}refreshAuthInfo(e){this.authInfo=e}startSTSUpdate(e){this.authInfo=e,this.requestToken(),this.timer&&clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.expiration&&Math.floor((Date.now()+Ia*1.5)/1e3)<this.expiration&&this.skipTime<p0){this.skipTime+=1;return}this.requestToken()},Ia)}clear(){this.timer&&clearInterval(this.timer)}};_(ki,"logName","StsManager");let As=ki;var m0=Object.defineProperty,g0=Object.getOwnPropertyDescriptor,b0=(s,c,e,t)=>{for(var i=t>1?void 0:t?g0(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&&m0(c,e,i),i};class Es extends xe{constructor(e,t,i,r=Dt.prod){super();_(this,"signaling");_(this,"authInfo");_(this,"userName");_(this,"channelProfile");_(this,"clientRole");_(this,"env",Dt.prod);_(this,"maxConnectRetryCount");_(this,"stsManager");_(this,"slsReporter");this.channelProfile=e,this.clientRole=t,this.env=r,this.slsReporter=i,this.stsManager=new As(i,r)}reset(){var e;ae.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,a)=>{this.signaling?a(new Y(te.ERR_JOIN_ALREADY_JOINED,"already joined")):(ae.info("[signalingmanager] create signaling"),this.signaling=new d0(this.channelProfile,this.clientRole,this.slsReporter,this.env),this.initSignaling(),r&&(r.rs=Date.now()),this.signaling.join(e,t,i).then(o=>{this.authInfo=e,r&&(r.re=Date.now()),n(o)}).catch(o=>{this.reset(),a(o)}),this.stsManager.startSTSUpdate(e))})}retryJoin(){const e=this.authInfo;this.reset(),e&&this.join(e,this.userName,this.maxConnectRetryCount)}leave(){return new Promise((e,t)=>{this.signaling?this.signaling.leave().then(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 Y(te.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 Y(-1,"no signaling"))})}setClientRole(e){return O(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 Y(te.ERR_SDK_INVALID_STATE,"should join first"))}refreshAuthInfo(e){return O(this,null,function*(){var t;try{this.authInfo&&(this.authInfo=ve(ve({},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,a,o,u,h,g,f,l,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)),(a=this.signaling)==null||a.on("onBye",this.onBye.bind(this)),(o=this.signaling)==null||o.on("onReconnectStart",this.onReconnectStart.bind(this)),(u=this.signaling)==null||u.on("onReconnectSuccess",this.onReconnectSuccess.bind(this)),(h=this.signaling)==null||h.on("onReconnectFail",this.onReconnectFail.bind(this)),(g=this.signaling)==null||g.on("onConnectFail",this.onConnectFail.bind(this)),(f=this.signaling)==null||f.on("onNetworkError",this.onNetworkError.bind(this)),(l=this.signaling)==null||l.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)}}_(Es,"logName","SignalingManager"),b0([j(ne)],Es.prototype,"publish",1);const ii=class ii{static getInstance(){return ii.instance||(ii.instance=new AudioContext),ii.instance.resume(),ii.instance}};_(ii,"instance");let ui=ii;function v0(s,c,e,t,i){let r=t,n=0,a;const o=s.createAnalyser();o.fftSize=256;const u=new Uint8Array(o.frequencyBinCount);c.connect(o),o.connect(e);const h=()=>{a&&window.clearInterval(a)},g=()=>{a=window.setInterval(()=>{o.getByteFrequencyData(u);let f=Math.round(u.reduce((l,p)=>l+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(),o.disconnect()}}}class x0 extends xe{constructor(){super();_(this,"audioContext");_(this,"stream");_(this,"sourceNode");_(this,"analyser");this.audioContext=ui.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=v0(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 Ra extends xe{constructor(e,t,i,r){super();_(this,"uid");_(this,"name");_(this,"rtsManager");_(this,"callId","");_(this,"audioLevelMonitor");_(this,"audioVolumeIndicationInterval",0);this.uid=e,this.name=t,this.rtsManager=i,this.audioVolumeIndicationInterval=r,this.audioLevelMonitor=new x0}get userId(){return this.uid}get displayname(){return this.name}createCallId(){this.callId||(this.callId=St.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 Da{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 Ta="customVideoProfile",ka="customScreenProfile",wi={width:1280,height:720,frameRate:30,maxBitrate:2e3},Ci={width:1920,height:1080,frameRate:30,maxBitrate:2600},S0={1e4:He.AliEngineLocalDeviceExceptionTypeUnknown,2e4:He.AliEngineLocalDeviceExceptionTypeUnknown,10001:He.AliEngineLocalDeviceExceptionTypeMicNotAvailable,10002:He.AliEngineLocalDeviceExceptionTypeMicAuthFail,10003:He.AliEngineLocalDeviceExceptionTypeMicOpenFail,10005:He.AliEngineLocalDeviceExceptionTypeCameraAuthFail,10004:He.AliEngineLocalDeviceExceptionTypeVideoDeviceException,10006:He.AliEngineLocalDeviceExceptionTypeCameraOpenFail,10010:He.AliEngineLocalDeviceExceptionTypeDisplayException,10011:He.AliEngineLocalDeviceExceptionTypeDisplayException,10012:He.AliEngineLocalDeviceExceptionTypeDisplayException,10013:He.AliEngineLocalDeviceExceptionTypeDisplayException,10014:He.AliEngineLocalDeviceExceptionTypeDisplayException,10019:He.AliEngineLocalDeviceExceptionTypeDisplayException},_0=s=>s.getAudioTracks()[0];function Pa(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 Y(te.ERR_INVALID_ARGUMENTS,"element should be HtmlVideoElement")}else throw new Y(te.ERR_INVALID_ARGUMENTS,"element not founded")}else throw new Y(te.ERR_INVALID_ARGUMENTS,"element id should be string")}function ws(s){var e;const c=[];if(Array.isArray(s))s.forEach(t=>{try{c.push(Pa(t))}catch(i){}});else if(typeof s=="string"||((e=s==null?void 0:s.nodeName)==null?void 0:e.toLowerCase())==="video")try{c.push(Pa(s))}catch(t){}return c}function Nt(s){return new Promise(c=>setTimeout(c,s))}function Ba(s,c,e=1e3,t=i=>!0){return O(this,null,function*(){let i=0,r;for(;i<c;)try{return yield s(i)}catch(n){if(i++,i>=c||!t(n))throw n||r;yield new Promise(a=>setTimeout(a,e))}})}function y0(s,c){let e=0;const t=[];for(;e<s.byteLength;){const i=Math.min(c,s.byteLength-e),r=s.slice(e,e+i);t.push(r),e+=i}return t}const La=(s,c,e=!1)=>{const t=()=>(s.muted=!0,Promise.race([Nt(500),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{let i;return e&&s.srcObject===c?i=Promise.resolve():(s.load(),s.srcObject=c,i=s.play(),s._playPromise=i),i}));return new Promise(i=>{if(pe.AliRTS.BrowserUtil.isMicroMessenger){const r=window.top!==window.self,n=window.WeixinJSBridge||window.top.WeixinJSBridge;n?n.invoke("getNetworkType",{},()=>{i(t())}):(r?window.top.document:document).addEventListener("WeixinJSBridgeReady",()=>{n.invoke("getNetworkType",{},()=>{i(t())})}),setTimeout(()=>{i(t())},1e3)}else setTimeout(()=>{i(t())},0)})},Ft=s=>{Promise.race([Nt(100),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{s.srcObject=null,s._playPromise=void 0})};var Cs=(s=>(s[s.AliEngineDataMsgNone=0]="AliEngineDataMsgNone",s[s.AliEngineDataMsgMusicProgress=1]="AliEngineDataMsgMusicProgress",s[s.AliEngineDataMsgCustom=2]="AliEngineDataMsgCustom",s))(Cs||{});class Ki{constructor(c,e,t,i=0){_(this,"msgType");_(this,"msgId");_(this,"protocolVersion");_(this,"tlvVersion");this.msgType=c,this.msgId=e,this.protocolVersion=t,this.tlvVersion=i}build(){const c=new Uint8Array(4);return c.set(Uint8Array.from([this.protocolVersion,this.tlvVersion<<4|this.msgType&15]),0),c.set(Uint16Array.from([this.msgId]),2),c}static parse(c){const e=new DataView(c),t=e.getUint8(0),i=e.getUint8(1)>>4,r=e.getUint8(1)&15,n=e.getUint16(2);return new Ki(r,n,t,i)}}const Qt=5;class $i{constructor(c,e,t){_(this,"_byteArray");if(this._byteArray=new Uint8Array(0),c!==void 0&&e!==void 0&&t!==void 0){const r=new Ki(c,e,t).build();this._byteArray=new Uint8Array(r.byteLength+this._byteArray.byteLength),this._byteArray.set(r,0)}}write(c,e){const t=this._byteArray,i=new ArrayBuffer(Qt),r=new DataView(i);r.setUint8(0,c),r.setUint32(1,e.byteLength);const n=new Uint8Array(t.byteLength+Qt+e.byteLength);n.set(t,0),n.set(new Uint8Array(i),t.byteLength),n.set(new Uint8Array(e),t.byteLength+Qt),this._byteArray=n}static parse(c){const e={},t=new DataView(c);let i=0;for(;i<c.byteLength;){const r=t.getUint8(i),n=t.getUint32(i+1);if(i+Qt+n<=c.byteLength){const a=c.slice(i+Qt,i+Qt+n);e[r]=a,i+=Qt+n}else break}return e}get buffer(){return this._byteArray.buffer}}class Ii{constructor(c=0,e=!0,t=1,i=!1,r=0,n=!1,a=!1,o=3){_(this,"_fin",!0);_(this,"_hasExtension",!1);_(this,"_version",0);_(this,"_frameType",1);_(this,"_isEncrypted",!1);_(this,"_isCompressed",!1);_(this,"_signalType",3);_(this,"_payloadLength",0);this._fin=e,this._hasExtension=i,this._version=r,this._frameType=t,this._isEncrypted=n,this._isCompressed=a,this._signalType=o,this._payloadLength=c}get fin(){return this._fin}get hasExtension(){return this._hasExtension}get version(){return this._version}get frameType(){return this._frameType}get isEncrypted(){return this._isEncrypted}get isCompressed(){return this._isCompressed}get signalType(){return this._signalType}get payloadLength(){return this._payloadLength}toBuffer(){const c=new ArrayBuffer(4),e=new DataView(c);return e.setUint8(0,(this._fin?1:0)<<7|(this._hasExtension?1:0)<<6|this._version<<4|this._frameType&15),e.setUint8(1,(this._isEncrypted?1:0)<<7|(this._isCompressed?1:0)<<6|this._signalType&15),e.setUint16(2,this._payloadLength),c}static parse(c){const e=new DataView(c),t=e.getUint8(0)>>7===1,i=(e.getUint8(0)&64)>>6===1,r=(e.getUint8(0)&48)>>4,n=e.getUint8(0)&15,a=e.getUint8(1)>>7===1,o=(e.getUint8(1)&64)>>6===1,u=e.getUint8(1)&15,h=e.getUint16(2);return new Ii(h,t,n,i,r,a,o,u)}}class qi{constructor(c,e){_(this,"_body");_(this,"_header",new Ii);this._header=c,this._body=e}get header(){return this._header}get isFin(){return this._header.fin}get body(){return this._body}toGRTNBuffer(){const c=this._header.toBuffer(),e=this._body,t=new ArrayBuffer(4);new DataView(t).setUint8(0,1*Math.pow(2,4));const i=new Uint8Array(t.byteLength+c.byteLength+e.byteLength);return i.set(new Uint8Array(t),0),i.set(new Uint8Array(c),t.byteLength),i.set(new Uint8Array(e),t.byteLength+c.byteLength),i.buffer}static parse(c){const e=c.slice(0,4),t=Ii.parse(e);let i=new ArrayBuffer(0);return c.byteLength-4>=t.payloadLength&&(i=c.slice(4,4+t.payloadLength)),new qi(t,i)}}const Is=s=>{const c=s.byteLength,e=new DataView(s);let t=0;for(let i=0;i<c;i++)t=t*256+e.getUint8(i);return t};let Ma=0;class ei{constructor(c,e=0,t=0,i=0){_(this,"data");_(this,"networkTime");_(this,"futureOrProgress");_(this,"type");this.data=c,this.type=e,this.networkTime=t,this.futureOrProgress=i}toBuffer(){const c=new $i(0,0,0);c.write(1,Uint8Array.from([0]).buffer),c.write(2,Uint16Array.from([0]).buffer),Ma++,c.write(3,Uint32Array.from([Ma]).buffer);const e=new $i;return e.write(1,Uint8Array.from([0]).buffer),e.write(2,Uint8Array.from([this.type]).buffer),e.write(3,Uint32Array.from([this.futureOrProgress]).buffer),e.write(4,Uint32Array.from([Number(this.networkTime>>32&4294967295),Number(this.networkTime&4294967295)]).buffer),e.write(5,this.data),c.write(30,e.buffer),c.buffer}static parse(c){if(!c||c.byteLength<4)return;Ki.parse(c.slice(0,4));const t=$i.parse(c.slice(4))[30];if(!t)return;const i=$i.parse(t),r=i[2],n=i[3],a=i[4],o=i[5];if(o.byteLength!==0)return new ei(o,Is(r),Is(a),Is(n))}}var A0=Object.defineProperty,E0=Object.getOwnPropertyDescriptor,Ve=(s,c,e,t)=>{for(var i=t>1?void 0:t?E0(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&&A0(c,e,i),i};const Na=30;class Ri extends xe{constructor(){super();_(this,"state");_(this,"time");this.state=be.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 Oe=(Ut=class extends Ra{constructor(e){const{rtsManager:t,localStreamManager:i,slsReporter:r,signalingManager:n,audioVolumeIndicationInterval:a,parameter:o}=e;super("","",t,a);_(this,"url","");_(this,"joinTime",0);_(this,"_isPublishing",!1);_(this,"publishPromise",Promise.resolve({traceId:"",l1ip:void 0}));_(this,"previewElements",[]);_(this,"screenPreviewElements",[]);_(this,"streamManager");_(this,"dc");_(this,"streamTracks");_(this,"publishId",Kt());_(this,"signalingManager");_(this,"traceId","");_(this,"monitorTimerId");_(this,"monitorDataCache",{});_(this,"trackTraceIdMap",{});_(this,"candidateDataCache",[]);_(this,"pcMediaStatsMap",{});_(this,"slsReporter");_(this,"audioPubState");_(this,"videoPubState");_(this,"videoSmallPubState");_(this,"screenPubState");_(this,"dataPubState");_(this,"parameter",{});_(this,"onTrackEnd",e=>{this.emit(e)});this.streamManager=i,this.signalingManager=n,this.slsReporter=r,this.parameter=o,this.streamManager.on("trackended",u=>{this.onTrackEnd(u)}),this.streamManager.on("publishupdate",()=>{this.publishUpdate()}),this.audioPubState=new Ri,this.audioPubState.on("change",(u,h,g)=>{this.emit("audioPublishStateChanged",u,h,g)}),this.videoPubState=new Ri,this.videoPubState.on("change",(u,h,g)=>{this.emit("videoPublishStateChanged",u,h,g)}),this.videoSmallPubState=new Ri,this.videoSmallPubState.on("change",(u,h,g)=>{this.emit("dualStreamPublishStateChanged",u,h,g)}),this.screenPubState=new Ri,this.screenPubState.on("change",(u,h,g)=>{this.emit("screenPublishStateChanged",u,h,g)}),this.dataPubState=new Ri,this.dataPubState.on("change",(u,h,g)=>{this.emit("dataPublishStateChanged",u,h,g)}),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===G.VideoLarge))}get hasCameraDualTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="video"&&t&&r===G.VideoSmall))}get hasScreenTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="video"&&t&&r===G.Screen))}get hasAudioTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="audio"&&t&&r===G.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||St.createCallid(),this.updatePubId()}setVideoProfile(e,t){return O(this,null,function*(){yield this.streamManager.setVideoProfile(e,t)})}setVideoContentHint(e){this.streamManager.setVideoContentHint(e)}setScreenContentHint(e){this.streamManager.setScreenContentHint(e)}setAudioProfile(e){return O(this,null,function*(){yield this.streamManager.setAudioProfile(e)})}setScreenProfile(e,t){return O(this,null,function*(){yield this.streamManager.setScreenProfile(e,t)})}setCameraDirection(e){if(e===Ei.CAMERA_FRONT)this.streamManager.setCameraVideoConstraints({facingMode:"user"});else if(e===Ei.CAMERA_REAR)this.streamManager.setCameraVideoConstraints({facingMode:"environment"});else throw new Y(te.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=Kt()}clearPublishState(){this.streamTracks=void 0}leave(){return O(this,null,function*(){this._isPublishing&&(this._isPublishing=!1,yield this.unPublish())})}clear(){return O(this,null,function*(){Fs(Ut.prototype,this,"clear").call(this),this.stopPreview(),this.resetPreviewElements(),this.resetSecondayPreviewElements(),this.clearStream(),yield this.leave(),this.streamManager.cameraCaptureDisabled=!1})}resetElement(e){this.previewElements.includes(e)&&(Ft(e),this.previewElements.splice(this.previewElements.indexOf(e),1)),this.screenPreviewElements.includes(e)&&(Ft(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)}startDefaultCamera(e){return O(this,null,function*(){const{hasCamera:t,cameraCaptureDisabled:i,publishLocalVideoStreamEnabled:r}=this;let n=[];if(!t&&!e&&!i&&r){try{n=yield pe.AliRTS.getCameraList(),n.length&&(yield this.startCameraCapture())}catch(a){throw a.code===pe.AliRTS.ErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED?new Y(te.ERR_CAMERA_AUTH_FAIL,"camera auth fail"):new Y(te.ERR_CAMERA_OPEN_FAIL,`camera open fail: ${a.message}`)}if(!n.length)throw new Y(te.ERR_CAMERA_NOT_AVAILABLE,"No camera device can be captured")}})}startDefaultAudio(){return O(this,null,function*(){const{hasMicrophone:e,audioCaptureDisabled:t,publishLocalAudioStreamEnabled:i}=this;let r=[];if(!e&&!t&&i){try{r=yield pe.AliRTS.getMicList(),r.length&&(yield this.startAudioCapture())}catch(n){throw n.code===pe.AliRTS.ErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED?new Y(te.ERR_MIC_AUTH_FAIL,"microphone auth fail"):new Y(te.ERR_MIC_OPEN_FAIL,`microphone open fail: ${n.message}`)}if(!r.length)throw new Y(te.ERR_MIC_NOT_AVAILABLE,"No microphone device can be captured")}})}setViewConfig(e,t){if(!e){t===Ae.AliRtcVideoTrackCamera?this.stopPreview({primary:!0,screen:!1}):this.stopPreview({primary:!1,screen:!0});return}if(![Ae.AliRtcVideoTrackCamera,Ae.AliRtcVideoTrackScreen].includes(t))throw new Y(te.ERR_INVALID_ARGUMENTS,"set view config invalid track",{track:t});e.forEach(i=>{this.setPreviewElement({videoElement:i,screen:t===Ae.AliRtcVideoTrackScreen})})}startCameraCapture(){return O(this,null,function*(){return this.streamManager.cameraCaptureDisabled=!1,yield this.createLocalStream({video:!0})})}stopCameraCapture(){return O(this,null,function*(){this.streamManager.cameraCaptureDisabled=!0,yield this.stopLocalStream({video:!0})})}startAudioCapture(){return O(this,null,function*(){return this.streamManager.audioCaptureDisabled=!1,yield this.createLocalStream({audio:!0})})}stopAudioCapture(){return O(this,null,function*(){this.streamManager.audioCaptureDisabled=!0,yield this.stopLocalStream({audio:!0})})}preview(e){return O(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 Y(te.ERR_INVALID_ARGUMENTS,"no video element found",{videoElement:t});if(!r){ae.info(`[${Ut.logName}]`,"preview no stream founded");return}return La(t,r.mediaStream),this.setPreviewElement(e),r.mediaStream}catch(r){const n=te.ERR_INNER;throw Y.fromError(r,n,"preview failed")}})}previewAll(e){return O(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=>{Ft(n)}),this.previewElements=[]),r&&(this.screenPreviewElements.forEach(n=>{Ft(n)}),this.screenPreviewElements=[]);else{const n=this.previewElements.findIndex(a=>a===t);if(n>=0)this.previewElements.splice(n,1),Ft(t);else{const a=this.screenPreviewElements.findIndex(o=>o===t);a>=0&&(this.screenPreviewElements.splice(a,1),Ft(t))}}}resumePublish(){return O(this,null,function*(){this._isPublishing=!1,yield this.startPublish(!0)})}createLocalStream(e){return O(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=S0[t.errorCode];throw i&&(e.audio?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeMic,i,""):e.video?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeCamera,i,""):e.screen?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeDisplay,i,""):this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeUnknown,i,"")),t}})}stopLocalStream(e){return O(this,null,function*(){e.audio&&this.audioLevelMonitor.stop(),yield this.streamManager.stopLocalStream(e)})}compareAndPublish(e,t,i){return O(this,null,function*(){var n,a;if(!e&&!t)return;if(e&&!t){const o={};return i===G.Audio?o.audio=!0:i===G.VideoLarge||i===G.VideoSmall?(o.video=!0,o.vMsid=i):i===G.Screen&&(o.screen=!0),yield this.publishDeleteTracks(o)}const r={};if(t!=null&&t.hasVideo&&(r.isScreen=i===G.Screen,r.vMsid=i),t!=null&&t.hasAudio&&(r.aMsid=i),!e&&t)return yield this.publishAdd(t,r,!1);if(e&&t){const o=e.trackId,u=((n=t.videoTrack)==null?void 0:n.id)||((a=t.audioTrack)==null?void 0:a.id);if(o!==u)return yield this.publishReplace(t,r)}})}reportAudioProfile(){const e=this.streamManager.cameraStreamInfo.audioProfile||"standard",t=pe.AliRTS.AudioProfileMap.get(e);this.slsReporter.reportPublishProfile(G.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=pe.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(G.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=pe.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(G.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 O(this,arguments,function*(e=!1,t=Bt.MANUAL){var u;if(!this.joined)return;this.createCallId();const i=yield this.streamManager.publishStreams,{audio:r,video:n,videoSmall:a,screen:o}=i;try{const h=new Date().getTime();r&&this.audioPubState.setState(be.AliRtcStatePublishing),n&&this.videoPubState.setState(be.AliRtcStatePublishing),a&&this.videoSmallPubState.setState(be.AliRtcStatePublishing),o&&this.screenPubState.setState(be.AliRtcStatePublishing),this.publishPromise=this.rtsManager.publish(this.url,this.callId,e,t);const{traceId:g,l1ip:f}=yield this.publishPromise;if(this._isPublishing=!0,this.streamTracks=this.rtsManager.publishingTracks,this.traceId=g,(u=this.parameter.data)!=null&&u.enablePubDataChannel){this.dataPubState.setState(be.AliRtcStatePublishing);const p=yield this.rtsManager.publishAddDataChannel(this.url);p?(this.dc=p,this.dc.datachannel&&(this.dc.datachannel.binaryType="arraybuffer"),this.dataPubState.setState(be.AliRtcStatePublished)):this.emit("publishDataError",new Y(te.ERR_INNER,"publishDataError"))}r&&(this.trackTraceIdMap[G.Audio]=g,this.reportAudioProfile()),a&&(this.trackTraceIdMap[G.VideoSmall]=g),n&&(this.trackTraceIdMap[G.VideoLarge]=g,this.reportVideoProfile()),o&&(this.trackTraceIdMap[G.Screen]=g,this.reportScreenProfile());const l={type:Wt.Add,userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:e,subscribe:{signal:"",pullstreamurl:this.url},l1ip:this.parameter.reportL1IP?f:void 0,callid:this.callId,tracks:this.streamTracks,traceid:g};yield this.syncPublishToRoomServer(l,i,h),r&&this.audioPubState.setState(be.AliRtcStatePublished),n&&this.videoPubState.setState(be.AliRtcStatePublished),a&&this.videoSmallPubState.setState(be.AliRtcStatePublished),o&&this.screenPubState.setState(be.AliRtcStatePublished)}catch(h){throw r&&this.audioPubState.setState(be.AliRtcStateNoPublish),n&&this.videoPubState.setState(be.AliRtcStateNoPublish),a&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),o&&this.screenPubState.setState(be.AliRtcStateNoPublish),h}})}updateStreams(){return O(this,null,function*(){yield this.streamManager.updateStreams()})}publishUpdate(){return O(this,null,function*(){var r,n,a,o;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:v,type:b,msid:x})=>b==="audio"&&v&&x===G.Audio),h=yield this.compareAndPublish(u,e.audio,G.Audio);h&&(t=h);const g=(n=this.streamTracks)==null?void 0:n.find(({ssrc:v,type:b,msid:x})=>b==="video"&&v&&x===G.VideoLarge),f=yield this.compareAndPublish(g,e.video,G.VideoLarge);f&&(t=f);const l=(a=this.streamTracks)==null?void 0:a.find(({ssrc:v,type:b,msid:x})=>b==="video"&&v&&x===G.VideoSmall),p=yield this.compareAndPublish(l,e.videoSmall,G.VideoSmall);p&&(t=p);const d=(o=this.streamTracks)==null?void 0:o.find(({ssrc:v,type:b,msid:x})=>b==="video"&&v&&x===G.Screen),m=yield this.compareAndPublish(d,e.screen,G.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 O(this,null,function*(){var o;if(!e)throw new Y(te.ERR_INNER,"sync publish to room server failed because no publishInfo");let r=e;if(this.dc){const a=e,{tracks:u}=a,h=pi(a,["tracks"]);r=Rt(ve({},h),{tracks:[...u,{type:"data",msid:G.Data,ssrc:`${((o=this.callId)==null?void 0:o.length)>8?this.callId.substring(0,8):"web"}${this.dc.datachannel.id||"0"}`,codec:"text"}]})}const n=yield this.signalingManager.publish(r);e.signaltid=n.tid})}refreshPushStreamUrl(){return O(this,null,function*(){const e=new Y(te.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 O(this,null,function*(){this.createCallId();const n=(t==null?void 0:t.aMsid)===G.Audio,a=(t==null?void 0:t.vMsid)===G.VideoLarge,o=(t==null?void 0:t.vMsid)===G.VideoSmall,u=(t==null?void 0:t.vMsid)===G.Screen;n&&this.audioPubState.setState(be.AliRtcStatePublishing),a&&this.videoPubState.setState(be.AliRtcStatePublishing),o&&this.videoSmallPubState.setState(be.AliRtcStatePublishing),u&&this.screenPubState.setState(be.AliRtcStatePublishing);try{const h=yield this.rtsManager.publishAdd(this.url,e,this.callId,t,!1,!0);n&&(this.audioPubState.setState(be.AliRtcStatePublished),this.reportAudioProfile(),this.trackTraceIdMap[G.Audio]=h),a&&(this.videoPubState.setState(be.AliRtcStatePublished),this.reportVideoProfile(),this.trackTraceIdMap[G.VideoLarge]=h),o&&(this.videoSmallPubState.setState(be.AliRtcStatePublished),this.trackTraceIdMap[G.VideoSmall]=h),u&&(this.screenPubState.setState(be.AliRtcStatePublished),this.reportScreenProfile(),this.trackTraceIdMap[G.Screen]=h),this.streamTracks=this.rtsManager.publishingTracks;const g={type:Wt.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=te.ERR_SDK_PUBLISH_INVAILD;if(n&&(this.audioPubState.setState(be.AliRtcStateNoPublish),g=te.ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED),a&&(this.videoPubState.setState(be.AliRtcStateNoPublish),g=te.ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED),o&&(this.videoSmallPubState.setState(be.AliRtcStateNoPublish),g=te.ERR_SDK_PUBLISH_DUAL_STREAM_FAILED),u&&(this.screenPubState.setState(be.AliRtcStateNoPublish),g=te.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED),h.errorCode===15006&&r<3)return this.publishAdd(e,t,i,r+1);throw Y.fromError(h,g,"publish add failed")}})}publishReplace(e,t){return O(this,null,function*(){try{yield this.rtsManager.publishReplace(this.url,e,t),this.streamTracks=this.rtsManager.publishingTracks;const i={type:Wt.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 Y.fromError(i,te.ERR_INNER,`publish replace failed, vMsid: ${t==null?void 0:t.vMsid} aMsid: ${t==null?void 0:t.aMsid}`)}})}publishDeleteTracks(e){return O(this,null,function*(){const t={type:Wt.Delete,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{return yield this.rtsManager.publishDelete(this.url,e),this.streamTracks=this.rtsManager.publishingTracks,e.audio&&this.audioPubState.setState(be.AliRtcStateNoPublish),e.video&&(e.vMsid===G.VideoSmall?this.videoSmallPubState.setState(be.AliRtcStateNoPublish):this.videoPubState.setState(be.AliRtcStateNoPublish)),e.screen&&this.screenPubState.setState(be.AliRtcStateNoPublish),t.tracks=this.streamTracks,this.reportSelfDeviceStatus(),t}catch(i){throw Y.fromError(i,te.ERR_INNER,"publish delete tracks failed")}})}publishStop(){return O(this,null,function*(){if(!this._isPublishing)throw new Y(te.ERR_INNER,"publish stop failed, previous localStream is required for publishing stopping");ae.info(`[${Ut.logName}]`,"publishStop",{url:this.url});const e=new Date().getTime();try{const t=this.hasAudioTrackInMS,i=this.hasCameraTrackInMS,r=this.hasCameraDualTrackInMS,n=this.hasScreenTrackInMS;yield this.rtsManager.publishStop(this.url),t&&this.audioPubState.setState(be.AliRtcStateNoPublish),i&&this.videoPubState.setState(be.AliRtcStateNoPublish),r&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),n&&this.screenPubState.setState(be.AliRtcStateNoPublish),this.traceId="",Object.keys(this.monitorDataCache).forEach(o=>{this.reportPublishMonitor(o)}),this.streamTracks=[];const a={type:Wt.Stop,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};return this.syncPublishToRoomServer(a,{},e),a}catch(t){throw Y.fromError(t,te.ERR_INNER,"publish stop failed")}})}unPublish(){return O(this,null,function*(){const e=new Date().getTime();let t={type:Wt.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 i=this.hasAudioTrackInMS,r=this.hasCameraTrackInMS,n=this.hasCameraDualTrackInMS,a=this.hasScreenTrackInMS;yield this.rtsManager.unpublish(),this.streamTracks=[],this.stopStreamMonitor(),i&&this.audioPubState.setState(be.AliRtcStateNoPublish),r&&this.videoPubState.setState(be.AliRtcStateNoPublish),n&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),a&&this.screenPubState.setState(be.AliRtcStateNoPublish),this._isPublishing=!1,this.traceId="",this.clearStream()}return this.dc&&(this.rtsManager.publishStopDataChannel(this.url,this.dc),this.dataPubState.setState(be.AliRtcStateNoPublish),this.dc=void 0),this.slsReporter.reportUnpublish(this.callId||"",e,0,""),t}catch(i){throw Y.fromError(i,te.ERR_INNER,"unpublish failed")}})}reportSelfDeviceStatus(){this.emit(rt.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),Da.getCurrentStatus(e)}resetPreviewElements(){this.previewElements.forEach(e=>{e.srcObject=null,e._playPromise=void 0},[]),this.previewElements=[]}resetSecondayPreviewElements(){this.screenPreviewElements.forEach(e=>{e.srcObject=null,e._playPromise=void 0},[]),this.screenPreviewElements=[]}getMediaStats(e){return this.pcMediaStatsMap[e]}reportPublishMonitor(e){if(!e)return;let t;try{e===G.Audio?t=this.rtsManager.getStreamByMsid({url:this.url,aMsid:e}).audioTrack:t=this.rtsManager.getStreamByMsid({url:this.url,vMsid:e}).videoTrack}catch(i){}this.slsReporter.reportPublishMonitor(this.callId,this.trackTraceIdMap[e]||"",e,t,this.monitorDataCache[e]),this.monitorDataCache[e]=[]}reportNetwork(){this.slsReporter.reportNetworkMonitor(this.candidateDataCache),this.candidateDataCache=[]}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>O(this,null,function*(){var e,i;try{const r=yield this.rtsManager.getPCStats();let n;r==null||r.forEach(u=>{u.type==="media-source"||u.type==="media-playout"?u.id&&(this.pcMediaStatsMap[u.id]=u):u.type==="candidate-pair"&&u.state==="succeeded"&&(n=u)});let a;if(((e=this.candidateDataCache)==null?void 0:e.length)>0){const t=this.candidateDataCache[this.candidateDataCache.length-1]||{},{_last:h}=t;a=pi(t,["_last"])}((i=this.candidateDataCache)==null?void 0:i.length)>=Na&&this.reportNetwork(),n&&(n._last=a,this.candidateDataCache.push(n));let o=Object.keys(this.monitorDataCache).filter(u=>{var h;return((h=this.monitorDataCache[u])==null?void 0:h.length)>0});(this.streamTracks||[]).forEach(u=>{const h=u.msid;if(!h)return;o.includes(h)&&(o=o.filter(l=>l!==h));let g;h===G.Audio?g=this.rtsManager.getPublishAudioStats(this.url):g=this.rtsManager.getPublishVideoStats(this.url,h),g.then(l=>{if(!l.timestamp)return;this.monitorDataCache[h]||(this.monitorDataCache[h]=[]);const p=this.getMediaStats(l.mediaSourceId);l._source=p;const d=this.monitorDataCache[h];let m;if((d==null?void 0:d.length)>0){const v=d[d.length-1]||{},{_last:x}=v;m=pi(v,["_last"])}(d==null?void 0:d.length)>=Na&&this.reportPublishMonitor(h),l._last=m,l._codec=u.codec||"",this.monitorDataCache[h].push(l)})}),o.forEach(u=>{this.reportPublishMonitor(u)})}catch(r){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0),Object.keys(this.monitorDataCache).forEach(e=>{this.reportPublishMonitor(e)})}clearStream(){this.streamManager.stop(),this.audioPubState.setState(be.AliRtcStatePublishIdle),this.videoPubState.setState(be.AliRtcStatePublishIdle),this.videoSmallPubState.setState(be.AliRtcStatePublishIdle),this.screenPubState.setState(be.AliRtcStatePublishIdle)}getCurrentCameraDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originVideoTrack)==null?void 0:e.getSettings().deviceId}getCurrentMicDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originAudioTrack)==null?void 0:e.getSettings().deviceId}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.streamManager.cameraStreamInfo.originAudioTrack&&this.audioLevelMonitor.start(this.streamManager.cameraStreamInfo.originAudioTrack,e),this.audioVolumeIndicationInterval=e)}sendSEI(e,t,i){return O(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)})}sendDataChannelMessage(e){return O(this,null,function*(){var r;if(!((r=this.parameter.data)!=null&&r.enablePubDataChannel))throw new Y(te.ERR_INNER,"data channel publish is not enabled");if(!this.dc)throw new Y(te.ERR_INNER,"data channel is not ready");const t=e.toBuffer(),i=y0(t,1156);i.forEach((n,a)=>{const o=new qi(new Ii(n.byteLength,a===i.length-1,a===0?1:0),n);this.dc.send(o.toGRTNBuffer())})})}getStats(){return O(this,null,function*(){const e=[];if(this.hasAudioTrackInMS){const n=yield this.rtsManager.getPublishAudioStats(this.url);n&&e.push({stats:n,track:ci.AliRtcAudioTrackMic})}const t=[];if(this.hasCameraTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,G.VideoLarge);n&&t.push({track:Ae.AliRtcVideoTrackCamera,streamType:Ge.AliRtcVideoStreamTypeHigh,stats:n})}if(this.hasCameraDualTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,G.VideoSmall);n&&t.push({track:Ae.AliRtcVideoTrackCamera,streamType:Ge.AliRtcVideoStreamTypeLow,stats:n})}if(this.hasScreenTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,G.Screen);n&&t.push({track:Ae.AliRtcVideoTrackScreen,stats:n})}let i;const r=yield this.rtsManager.getPCStats();return r==null||r.forEach(n=>{n.type==="candidate-pair"&&n.state==="succeeded"&&(i=n)}),{audio:e,video:t,candidate:i}})}},_(Ut,"logName","LocalUser"),Ut);Ve([j()],Oe.prototype,"clearPublishState",1),Ve([j()],Oe.prototype,"clear",1),Ve([j(ne)],Oe.prototype,"startDefaultCamera",1),Ve([j(ne)],Oe.prototype,"startDefaultAudio",1),Ve([j()],Oe.prototype,"setViewConfig",1),Ve([j()],Oe.prototype,"startCameraCapture",1),Ve([j()],Oe.prototype,"stopCameraCapture",1),Ve([j()],Oe.prototype,"startAudioCapture",1),Ve([j()],Oe.prototype,"stopAudioCapture",1),Ve([j()],Oe.prototype,"stopPreview",1),Ve([j()],Oe.prototype,"resumePublish",1),Ve([j()],Oe.prototype,"createLocalStream",1),Ve([j()],Oe.prototype,"stopLocalStream",1),Ve([j(ne)],Oe.prototype,"startPublish",1),Ve([j(([s])=>[s])],Oe.prototype,"syncPublishToRoomServer",1),Ve([j()],Oe.prototype,"refreshPushStreamUrl",1),Ve([j(([s,c,e])=>[JSON.stringify(e)])],Oe.prototype,"publishAdd",1),Ve([j(([s,c])=>[JSON.stringify(c)])],Oe.prototype,"publishReplace",1),Ve([j(ne)],Oe.prototype,"publishDeleteTracks",1),Ve([j()],Oe.prototype,"publishStop",1),Ve([j()],Oe.prototype,"unPublish",1),Ve([j(([s,c,e])=>[s.length,c,e])],Oe.prototype,"sendSEI",1);let Fa=Oe;var Ot=(s=>(s.OPUS="opus",s.H264="H264",s.UNKNOWN="",s))(Ot||{}),Ee=(s=>(s[s.NotSubscribe=0]="NotSubscribe",s[s.Subscribing=1]="Subscribing",s[s.Subscribed=2]="Subscribed",s))(Ee||{}),ti=(s=>(s.VideoTrackEnded="videoTrackEnded",s.AudioTrackEnded="audioTrackEnded",s.ScreenTrackEnded="screenTrackEnded",s))(ti||{});const w0=s=>{const c=new MediaStream;return c.addTrack(s),c},Oa=s=>O(this,null,function*(){return yield pe.AliRTS.createStream({custom:!0,mediaStream:s})}),Di=s=>O(this,null,function*(){const c=w0(s);return yield Oa(c)}),C0=s=>{const{audio:c,video:e,screen:t}=s;if(e&&t)throw new Y(te.ERR_INNER,"create stream error, cannot create video && screen together");return!(!e&&!c&&!t)},I0=s=>s===G.Audio||s===fr.Audio,R0=s=>s===G.VideoLarge||s===fr.VideoLarge,D0=s=>s===G.VideoSmall,T0=s=>s===G.Screen,k0=s=>s===G.Data;var P0=Object.defineProperty,B0=Object.getOwnPropertyDescriptor,L0=(s,c,e,t)=>{for(var i=t>1?void 0:t?B0(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&&P0(c,e,i),i};class Gi extends xe{constructor(){super();_(this,"audioInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"videoLargeInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"videoSmallInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"screenInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"dataInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"audioVolume",1);_(this,"audioMuted",!1);_(this,"userStatus")}getAudioInfo(){return this.audioInfo}getVideoSmallInfo(){return this.videoSmallInfo}getVideoLargeInfo(){return this.videoLargeInfo}getScreenInfo(){return this.screenInfo}getDataInfo(){return this.dataInfo}get subscribingInfos(){return[this.audioInfo,this.videoLargeInfo,this.videoSmallInfo,this.screenInfo].filter(e=>e.msid&&e.subscribeState===Ee.Subscribed)}get hasTrack(){return this.hasAudio||this.hasVideo||this.hasScreen||this.hasData}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 hasData(){return this.dataInfo.ssrc!==""}get isAudioSubscribed(){return this.audioInfo.subscribeState===Ee.Subscribed}get isAudioSubscribing(){return this.audioInfo.subscribeState===Ee.Subscribing}get isVideoSubscribed(){return this.isVideoLargeSubscribed||this.isVideoSmallSubscribed}get isVideoSubscribing(){return this.isVideoLargeSubscribing||this.isVideoSmallSubscribing}get isVideoLargeSubscribed(){return this.videoLargeInfo.subscribeState===Ee.Subscribed}get isVideoLargeSubscribing(){return this.videoLargeInfo.subscribeState===Ee.Subscribing}get isVideoSmallSubscribed(){return this.videoSmallInfo.subscribeState===Ee.Subscribed}get isVideoSmallSubscribing(){return this.videoSmallInfo.subscribeState===Ee.Subscribing}get isScreenSubscribed(){return this.screenInfo.subscribeState===Ee.Subscribed}get isScreenSubscribing(){return this.screenInfo.subscribeState===Ee.Subscribing}get isDataSubscribed(){return this.dataInfo.subscribeState===Ee.Subscribed}get isDataSubscribing(){return this.dataInfo.subscribeState===Ee.Subscribing}get audioCodec(){return this.audioInfo.codec}get videoCodec(){return this.hasVideoLarge?this.videoLargeInfo.codec:this.hasVideoSmall?this.videoSmallInfo.codec:this.hasScreen?this.screenInfo.codec:Ot.UNKNOWN}get audioTrackInfo(){return this.hasAudio?ci.AliRtcAudioTrackMic:ci.AliRtcAudioTrackNo}get videoTrackInfo(){return this.hasVideo&&this.hasScreen?Ae.AliRtcVideoTrackBoth:this.hasVideo?Ae.AliRtcVideoTrackCamera:this.hasScreen?Ae.AliRtcVideoTrackScreen:Ae.AliRtcVideoTrackNo}updateTracks(e){let t="",i="",r="",n="",a="";return e?(e.forEach(o=>{var g;let u=Ot.UNKNOWN;const h=((g=o==null?void 0:o.attr)==null?void 0:g.reason)==="reconnect";if(o.userdata){const{codec:f}=JSON.parse(o.userdata);f&&(u=f)}I0(o.msid)?(t=o.ssrc,this.audioInfo.msid=o.msid,this.audioInfo.codec=u,(h||this.audioInfo.ssrc!==t)&&(this.audioInfo.subscribeState=Ee.NotSubscribe)):D0(o.msid)?(r=o.ssrc,this.videoSmallInfo.msid=o.msid,this.videoSmallInfo.codec=u,(h||this.videoSmallInfo.ssrc!==r)&&(this.videoSmallInfo.subscribeState=Ee.NotSubscribe)):R0(o.msid)?(i=o.ssrc,this.videoLargeInfo.msid=o.msid,this.videoLargeInfo.codec=u,(h||this.videoLargeInfo.ssrc!==i)&&(this.videoLargeInfo.subscribeState=Ee.NotSubscribe)):T0(o.msid)?(n=o.ssrc,this.screenInfo.msid=o.msid,this.screenInfo.codec=u,(h||this.screenInfo.ssrc!==n)&&(this.screenInfo.subscribeState=Ee.NotSubscribe)):k0(o.msid)&&(a=o.ssrc,this.dataInfo.msid=o.msid,this.dataInfo.codec=u,(h||this.dataInfo.ssrc!==a)&&(this.dataInfo.subscribeState=Ee.NotSubscribe))}),this.updateRemoteTrackSsrc(t,i,r,n,a)):this.updateRemoteTrackSsrc(t,i,r,n,a),{}}updateRemoteTrackSsrc(e,t,i,r,n){this.audioInfo.ssrc=e,this.videoSmallInfo.ssrc=i,this.videoLargeInfo.ssrc=t,this.screenInfo.ssrc=r,this.dataInfo.ssrc=n}markRemoteTrackSubscribing(e){return e.video&&(e.vMsid===this.videoSmallInfo.msid&&(this.videoSmallInfo.subscribeState=Ee.Subscribing),(e.vMsid===this.videoLargeInfo.msid||!e.vMsid)&&(this.videoLargeInfo.subscribeState=Ee.Subscribing)),e.screen&&(this.screenInfo.subscribeState=Ee.Subscribing),e.audio&&(this.audioInfo.subscribeState=Ee.Subscribing),e.data&&(this.dataInfo.subscribeState=Ee.Subscribing),{videoLargeInfo:this.videoLargeInfo,videoSmallInfo:this.videoSmallInfo}}updateRemoteTrackSubState(e){return e.video!==void 0&&((e.vMsid===this.videoSmallInfo.msid||!e.vMsid)&&(this.videoSmallInfo.subscribeState=e.video?Ee.Subscribed:Ee.NotSubscribe),(e.vMsid===this.videoLargeInfo.msid||!e.vMsid)&&(this.videoLargeInfo.subscribeState=e.video?Ee.Subscribed:Ee.NotSubscribe)),e.screen!==void 0&&(this.screenInfo.subscribeState=e.screen?Ee.Subscribed:Ee.NotSubscribe),e.audio!==void 0&&(this.audioInfo.subscribeState=e.audio?Ee.Subscribed:Ee.NotSubscribe),e.data!==void 0&&(this.dataInfo.subscribeState=e.data?Ee.Subscribed:Ee.NotSubscribe),{audioInfo:this.audioInfo,videoLargeInfo:this.videoLargeInfo,videoSmallInfo:this.videoSmallInfo,screenInfo:this.screenInfo,dataInfo:this.dataInfo}}updateRemoteUserDeviceStatus(e){let t=Da.parseStatus(e);const{audioDisable:i,videoDisable:r,screenDisable:n}=t;return this.userStatus?(this.userStatus.audioDisable!=i&&(this.userStatus.audioDisable=i,this.emit(rt.Remote,i?Re.MuteAudio:Re.UnmuteAudio)),this.userStatus.videoDisable!=r&&(this.userStatus.videoDisable=r,this.emit(rt.Remote,r?Re.MuteVideo:Re.UnmuteVideo)),this.userStatus.screenDisable!=n&&(this.userStatus.screenDisable=n,this.emit(rt.Remote,n?Re.MuteScreen:Re.UnmuteScreen))):(this.userStatus=t,this.emit(rt.Remote,i?Re.MuteAudio:Re.UnmuteAudio),this.emit(rt.Remote,r?Re.MuteVideo:Re.UnmuteVideo),this.emit(rt.Remote,n?Re.MuteScreen:Re.UnmuteScreen)),!1}}_(Gi,"logName","RemoteStreamInfo"),L0([j()],Gi.prototype,"updateRemoteTrackSubState",1);class Va{constructor(c){_(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}get audioElement(){return this.remoteUser.getAudioElement()}}var M0=Object.defineProperty,N0=Object.getOwnPropertyDescriptor,et=(s,c,e,t)=>{for(var i=t>1?void 0:t?N0(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&&M0(c,e,i),i};class hi extends xe{constructor(){super();_(this,"state");_(this,"time");_(this,"_enabled");this.state=Pe.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 F0=30,Ye=(kt=class extends Ra{constructor(e){var l;const{userId:t,displayName:i,rtsManager:r,usersViewMap:n,slsReporter:a,signalingManager:o,localUser:u,audioVolumeIndicationInterval:h,playoutVolume:g,parameter:f}=e;super(t,i,r,h);_(this,"remoteCallid","");_(this,"remoteUserInfo");_(this,"localUser");_(this,"lastPubId","");_(this,"stream");_(this,"screenStream");_(this,"viewMap");_(this,"audioTrack");_(this,"audioElement");_(this,"subscribed",!1);_(this,"mediaStream");_(this,"secondaryMediaStream");_(this,"prevSubConfig");_(this,"signalingManager");_(this,"slsReporter");_(this,"wantSubAudio",!1);_(this,"wantSubVideo",!1);_(this,"wantSubScreen",!1);_(this,"defaultVideoStreamType",Ge.AliRtcVideoStreamTypeHigh);_(this,"audioMuted",!1);_(this,"playoutVolume",1);_(this,"playoutGainNode");_(this,"audioSubState");_(this,"videoSubState");_(this,"videoLargeSubState",new hi);_(this,"videoSmallSubState",new hi);_(this,"screenSubState");_(this,"dataSubState");_(this,"dc");_(this,"dcMsgWaitingPieces",[]);_(this,"streamInfo");_(this,"streamUrl","");_(this,"parameter",{});_(this,"monitorTimerId");_(this,"monitorDataCache",{});_(this,"trackTraceIdMap",{});_(this,"handleAudioContextSuspended",e=>{e.target.state==="suspended"&&this.emit("remoteAudioPlayError",this.uid,"AudioContext suspended")});_(this,"onDataChannelMessage",e=>{var r;const t=qi.parse(e.slice(4));let i;if(t.body)if(t.isFin){if(this.dcMsgWaitingPieces.length>0){const n=this.dcMsgWaitingPieces.reduce((a,o)=>a+o.byteLength,t.body.byteLength);try{const a=new ArrayBuffer(n);let o=0;for(let h=0;h<this.dcMsgWaitingPieces.length;h++){const g=this.dcMsgWaitingPieces[h];new Uint8Array(a,o,g.byteLength).set(new Uint8Array(g)),o+=g.byteLength}new Uint8Array(a,o,t.body.byteLength).set(new Uint8Array(t.body)),i=ei.parse(a)}catch(a){}this.dcMsgWaitingPieces=[],i||(i=ei.parse(t.body))}else i=ei.parse(t.body);i||ae.event(`[${kt.logName}]`,`parse data channel message fail, piece count: ${this.dcMsgWaitingPieces.length+1}`)}else{t.header.frameType===1&&(this.dcMsgWaitingPieces=[]),this.dcMsgWaitingPieces.push(t.body);return}i&&(ae.event(`[${kt.logName}]`,`receive data channel message, length: ${(r=i.data)==null?void 0:r.byteLength}`),this.emit("remoteDataChannelMessage",this.uid,i))});_(this,"onDataChannelError",e=>{this.emit("occurError",Y.fromError(e,te.ERR_SDK_SUBSCRIBE_DATA_ERROR))});_(this,"handleAudioPaused",()=>{this.emit("remoteAudioPlayError","paused")});this.streamInfo=new Gi,this.remoteUserInfo=new Va(this),this.parameter=f,this.streamInfo.on(rt.Remote,p=>{this.emit(rt.Remote,p,this.userId)}),this.signalingManager=o,this.viewMap=(l=n[t])!=null?l:{cameraViews:[],screenViews:[]},n[t]=this.viewMap,this.slsReporter=a,this.localUser=u,this.audioSubState=new hi,this.audioSubState.on("change",(p,d,m)=>{this.emit("audioSubscribeStateChanged",this.uid,p,d,m)}),this.videoSubState=new hi,this.videoSubState.on("change",(p,d,m)=>{this.emit("videoSubscribeStateChanged",this.uid,p,d,m)}),this.screenSubState=new hi,this.screenSubState.on("change",(p,d,m)=>{this.emit("screenSubscribeStateChanged",this.uid,p,d,m)}),this.dataSubState=new hi,this.dataSubState.on("change",(p,d,m)=>{this.emit("dataSubscribeStateChanged",this.uid,p,d,m)}),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(Be.User))}setAudioMuted(e){this.audioMuted=e,this.toggleAudio(!e)}getAudioElement(){return this.audioElement}setPlayoutVolume(e){if(this.playoutVolume=e,this.audioElement)if(this.parameter.enableAudioContextPlayoutVolume)if(this.playoutGainNode)this.playoutGainNode.gain.value=e;else{const t=this.audioElement.srcObject;if(t){const i=ui.getInstance();i.addEventListener("statechange",this.handleAudioContextSuspended);const r=i.createMediaStreamSource(t);this.audioElement.muted=!0,this.playoutGainNode=i.createGain(),r.connect(this.playoutGainNode),this.playoutGainNode.gain.value=e,this.playoutGainNode.connect(i.destination)}}else 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,t;return!!((e=this.streamInfo)!=null&&e.isAudioSubscribed)||!!((t=this.streamInfo)!=null&&t.isAudioSubscribing)}get isVideoSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isVideoSubscribed)||!!((t=this.streamInfo)!=null&&t.isVideoSubscribing)}get isVideoLargeSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isVideoLargeSubscribed)||!!((t=this.streamInfo)!=null&&t.isVideoLargeSubscribing)}get isVideoSmallSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isVideoSmallSubscribed)||!!((t=this.streamInfo)!=null&&t.isVideoSmallSubscribing)}get isScreenSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isScreenSubscribed)||!!((t=this.streamInfo)!=null&&t.isScreenSubscribing)}get isDataSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isDataSubscribed)||!!((t=this.streamInfo)!=null&&t.isDataSubscribing)}get audioEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.audioTrack)!=null&&t.enabled)}get videoEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get screenEnabled(){var e,t;return!!((t=(e=this.screenStream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get getAudioTrack(){return this.audioTrack}get getCameraStream(){return this.stream}get getScreenStream(){return this.screenStream}setViewConfig(e,t){if(t!==Ae.AliRtcVideoTrackScreen&&t!==Ae.AliRtcVideoTrackCamera)throw new Y(te.ERR_INVALID_ARGUMENTS,"track is not AliRtcVideoTrackScreen or AliRtcVideoTrackCamera");e?ws(e).forEach(r=>{r.setAttribute("playsinline",""),pe.AliRTS.BrowserUtil.isMicroMessenger&&(r.setAttribute("x5-video-player-type","h5-page"),r.setAttribute("x5-playsinline",""),pe.AliRTS.SystenUtil.isAndroid||pe.AliRTS.SystenUtil.isIos&&r.setAttribute("x-webkit-airplay","allow")),t===Ae.AliRtcVideoTrackScreen?this.viewMap.screenViews.push(r):this.viewMap.cameraViews.push(r),this.play(r,t===Ae.AliRtcVideoTrackScreen)}):(this.stopPlayAll(t===Ae.AliRtcVideoTrackScreen),t===Ae.AliRtcVideoTrackScreen?this.viewMap.screenViews=[]:this.viewMap.cameraViews=[])}clear(e=!0){return O(this,null,function*(){var t;this.subscribeStopDataChannel(),e&&this.doStopSubscribe(this.streamUrl),Fs(kt.prototype,this,"clear").call(this),this.clearStream(),this.clearScreenStream(),this.playoutGainNode&&(this.playoutGainNode.disconnect(),this.playoutGainNode=void 0,ui.getInstance().removeEventListener("statechange",this.handleAudioContextSuspended)),(t=this.streamInfo)==null||t.removeAllListeners(rt.Remote)})}updateRemoteUserDeviceStatus(e){var t;(t=this.streamInfo)==null||t.updateRemoteUserDeviceStatus(e)}updateRemoteTracks(e,t,i,r){return O(this,null,function*(){var a;return this.remoteCallid=e,(!this.streamUrl||!this.streamInfo.hasTrack)&&(this.streamUrl=t!=null?t:""),this.callId=e!=null?e:"",this.streamInfo||(this.streamInfo=new Gi),(a=this.streamInfo)==null?void 0:a.updateTracks(r)})}subscribe(r,n){return O(this,arguments,function*(e,t,i=Date.now()){var l,p;let a=e;if(!a){const{hasAudio:d,hasVideo:m,hasScreen:v,hasData:b}=(l=this.streamInfo)!=null?l:{};a={audio:this.wantSubAudio&&d,video:this.wantSubVideo&&m,screen:this.wantSubScreen&&v,data:((p=this.parameter.data)==null?void 0:p.enableSubDataChannel)&&b}}this.streamInfo.markRemoteTrackSubscribing(a);const{screen:o,audio:u,video:h,vMsid:g}=a,f=[];(h||u)&&f.push({audio:u,video:h,vMsid:g}),o&&f.push({screen:o}),!(f.length===0&&!(e!=null&&e.data))&&(yield Promise.all(f.map(d=>this.subscribeProxy(d,t||Be.User,i))),e!=null&&e.data&&this.subscribeDataChannel())})}subscribeProxy(e,t,i){return O(this,null,function*(){var a,o,u,h;let r=new Date().getTime(),n="";try{e.audio&&this.audioSubState.setState(Pe.AliRtcStateSubscribing),e.video&&(this.videoSubState.currentState===Pe.AliRtcStateSubscribeIdle||this.videoSubState.currentState===Pe.AliRtcStateNoSubscribe)&&this.videoSubState.setState(Pe.AliRtcStateSubscribing),e.screen&&this.screenSubState.setState(Pe.AliRtcStateSubscribing);const g=yield this.rtsManager.subscribe({remoteUser:this,options:e},t,((a=this.localUser)==null?void 0:a.callId)||"",this.callId,i);this.streamInfo.updateRemoteTrackSubState(e),n=g.traceId||"";const{stream:f}=g;if(e.audio){this.trackTraceIdMap[G.Audio]=n;const p=f.audioTrack;p&&(this.audioTrack=p,(o=f.mediaStream)==null||o.removeTrack(p),this.playAudio(),this.audioVolumeIndicationInterval&&this.audioLevelMonitor.start(p,this.audioVolumeIndicationInterval)),this.audioSubState.setState(Pe.AliRtcStateSubscribed),this.audioSubState.getEnabled()||this.toggleAudio(!1)}e.video&&(this.videoSubState.setState(Pe.AliRtcStateSubscribed),e.vMsid===G.VideoSmall?(this.trackTraceIdMap[G.VideoSmall]=n,this.videoSmallSubState.setState(Pe.AliRtcStateSubscribed)):(this.trackTraceIdMap[G.VideoLarge]=n,this.videoLargeSubState.setState(Pe.AliRtcStateSubscribed)),this.videoSubState.getEnabled()||this.toggleVideo(!1),this.updateStream(f,this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing)),e.screen&&(this.screenSubState.setState(Pe.AliRtcStateSubscribed),this.trackTraceIdMap[G.Screen]=n,this.videoSubState.getEnabled()||this.toggleScreen(!1),this.updateScreenStream(f));const l=new Date().getTime()-r;this.slsReporter.reportSubscribe(((u=this.localUser)==null?void 0:u.callId)||"",this.callId,!!e.video&&e.vMsid===G.VideoLarge,!!e.video&&e.vMsid===G.VideoSmall,!!e.screen,!!e.audio,0,"",l,{pctid:this.rtsManager.pcTraceId,subtid:n,ajsub:t===Be.Join?1:0,url:this.streamUrl,est:r}),this.startStreamMonitor()}catch(g){const f=new Date().getTime()-r;e.audio&&this.audioSubState.setState(Pe.AliRtcStateNoSubscribe),e.video&&this.videoSubState.setState(Pe.AliRtcStateNoSubscribe),e.screen&&this.screenSubState.setState(Pe.AliRtcStateNoSubscribe),g&&(g.message=`user(${this.uid}) subscribe error, ${(g==null?void 0:g.message)||""}`);let l=te.ERR_INNER;e.audio&&(l=te.ERR_SDK_SUBSCRIBE_AUDIO_STREAM_FAILED),e.video&&(e.vMsid===G.VideoSmall?l=te.ERR_SDK_SUBSCRIBE_DUAL_STREAM_FAILED:l=te.ERR_SDK_SUBSCRIBE_VIDEO_STREAM_FAILED),e.screen&&(l=te.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED),this.slsReporter.reportSubscribe(((h=this.localUser)==null?void 0:h.callId)||"",this.callId,!!e.video&&e.vMsid===G.VideoLarge,!!e.video&&e.vMsid===G.VideoSmall,!!e.screen,!!e.audio,l,"",f,{pctid:this.rtsManager.pcTraceId,subtid:"",ajsub:t===Be.Join?1:0,url:this.streamUrl,est:r});const p=Y.fromError(g,l);throw this.emit("remoteSubscribeError",p),p}})}subscribeDeleteTracks(e){return O(this,null,function*(){const{audio:t,video:i,screen:r,data:n,vMsid:a}=e,o=[];(t||i||n)&&o.push({audio:t,video:i,vMsid:a}),r&&o.push({screen:r}),o.length!==0&&(yield Promise.all(o.map(u=>this.subscribeDeleteProxy(u))),e.data&&this.subscribeStopDataChannel())})}subscribeDeleteProxy(e){return O(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(Pe.AliRtcStateNoSubscribe)),e.video===!0&&(r.video=!1,e.vMsid===G.VideoSmall?(this.videoSmallSubState.setState(Pe.AliRtcStateNoSubscribe),(this.videoLargeSubState.currentState===Pe.AliRtcStateNoSubscribe||this.videoLargeSubState.currentState===Pe.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Pe.AliRtcStateNoSubscribe)):(this.videoLargeSubState.setState(Pe.AliRtcStateNoSubscribe),(this.videoSmallSubState.currentState===Pe.AliRtcStateNoSubscribe||this.videoSmallSubState.currentState===Pe.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Pe.AliRtcStateNoSubscribe))),e.screen===!0&&(r.screen=!1,this.screenSubState.setState(Pe.AliRtcStateNoSubscribe));const{callId:n,remoteCallid:a}=this,o={callid:n,remoteCallid:a,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}),o}catch(t){throw Y.fromError(t,te.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,data:!1}),this.audioElement&&this.audioElement.removeEventListener("pause",this.handleAudioPaused)}resumeAudio(){return O(this,null,function*(){const e=ui.getInstance();return e.state!=="running"&&e.resume(),this.audioElement?this.audioElement.play():this.playAudio()})}resumeVideo(e){return O(this,null,function*(){if(!e||e===Ae.AliRtcVideoTrackCamera||e===Ae.AliRtcVideoTrackBoth)return this.playAll();if(!e||e===Ae.AliRtcVideoTrackScreen||e===Ae.AliRtcVideoTrackBoth)return this.playAll(!0)})}resumePlay(){this.playAudio(),this.playAll(),this.playAll(!0)}stopSubscribe(e){return O(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 O(this,null,function*(){var r,n,a,o;const{callId:t,remoteCallid:i}=this;if((this.isAudioSubscribing||this.isVideoSubscribing||this.isScreenSubscribing)&&e)try{this.stopStreamMonitor(),yield this.rtsManager.subscibeStop(e),this.restore();const u={callid:t,remoteCallid:i,remoteStream:this.stream};return this.callId="",u}catch(u){if(((o=(a=(n=(r=u==null?void 0:u.extraInfo)==null?void 0:r.parsedData)==null?void 0:n.streams)==null?void 0:a[0])==null?void 0:o.res_code)!==404)throw Y.fromError(u,te.ERR_INNER,"subscribe stop failed")}})}updateStream(e,t=!1){return O(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 a=()=>{ae.event(`uid: ${this.userId} new mediaStream canplay`),n&&n.removeEventListener("canplaythrough",a,!1),n=void 0,clearTimeout(r),i(!0)};n.addEventListener("canplaythrough",a,!1),(n._playPromise||Promise.resolve()).then(()=>{n&&e.mediaStream&&(n.srcObject=e.mediaStream)})}else i(!0);r=window.setTimeout(()=>{ae.event(`uid: ${this.userId} new mediaStream timeout`),n=void 0,i(!0)},3e3)}),this.updateSubscribe(Be.User)),this.stream=e,this.playAll(!1,t),!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}subscribeDataChannel(){if(this.dc)try{this.dc.dispose(),this.dcMsgWaitingPieces=[],this.dc.off("message",this.onDataChannelMessage),this.dc=void 0}catch(e){}!this.streamInfo.hasAudio&&!this.streamInfo.hasVideo&&!this.streamInfo.hasScreen||(this.dataSubState.setState(Pe.AliRtcStateSubscribing),this.rtsManager.subscribeAddDataChannel(this.streamUrl).then(e=>{if(e){this.dc=e,this.dc.datachannel&&(this.dc.datachannel.binaryType="arraybuffer"),this.dc.on("message",this.onDataChannelMessage),this.dc.on("error",this.onDataChannelError),this.dataSubState.setState(Pe.AliRtcStateSubscribed),this.streamInfo.updateRemoteTrackSubState({data:!0});return}else throw new Error("no dc founded")}).catch(e=>{const t=Y.fromError(e,te.ERR_INNER,"subscribe data failed");this.emit("remoteSubscribeError",t),this.dataSubState.setState(Pe.AliRtcStateNoSubscribe)}))}subscribeStopDataChannel(){if(this.dc){try{this.rtsManager.subscribeStopDatachannel(this.streamUrl,this.dc)}catch(e){}this.dcMsgWaitingPieces=[],this.dc.off("message",this.onDataChannelMessage),this.dc.off("error",this.onDataChannelError),this.dataSubState.setState(Pe.AliRtcStateNoSubscribe),this.dc=void 0,this.streamInfo.updateRemoteTrackSubState({data:!1})}}getRetryOptions(){var i,r,n,a,o,u,h;const e={};this.wantSubAudio&&((i=this.streamInfo)!=null&&i.hasAudio)&&(e.audio=!0,e.aMsid=((r=this.streamInfo.getAudioInfo())==null?void 0:r.msid)||G.Audio),this.wantSubVideo&&((n=this.streamInfo)!=null&&n.hasVideo)&&(this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeLow&&((a=this.streamInfo)!=null&&a.hasVideoSmall)?(e.video=!0,e.vMsid=G.VideoSmall):(o=this.streamInfo)!=null&&o.hasVideoLarge&&(e.video=!0,e.vMsid=((u=this.streamInfo.getVideoLargeInfo())==null?void 0:u.msid)||G.VideoLarge)),this.wantSubScreen&&((h=this.streamInfo)!=null&&h.hasScreen)&&(e.screen=!0);let t={};if(e.audio||e.video)t={audio:e.audio,video:e.video},this.streamInfo.updateRemoteTrackSubState({screen:!1,data:!1});else if(e.screen)t={screen:e.screen},this.streamInfo.updateRemoteTrackSubState({data:!1});else return;return{remoteUser:this,options:t}}updateSubscribe(e){var n,a,o,u,h,g,f,l,p,d,m,v,b,x,y,E,I;const t=Date.now(),i={},r={};if(this.wantSubAudio&&!this.isAudioSubscribing&&((n=this.streamInfo)!=null&&n.hasAudio)?(i.audio=!0,i.aMsid=((a=this.streamInfo.getAudioInfo())==null?void 0:a.msid)||G.Audio):(!this.wantSubAudio||!((o=this.streamInfo)!=null&&o.hasAudio))&&this.isAudioSubscribing&&(r.audio=!0,r.aMsid=((u=this.streamInfo.getAudioInfo())==null?void 0:u.msid)||G.Audio),this.wantSubVideo&&((h=this.streamInfo)!=null&&h.hasVideo)?(this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeLow&&!this.isVideoSmallSubscribing&&((g=this.streamInfo)!=null&&g.hasVideoSmall)?(i.video=!0,i.vMsid=G.VideoSmall):!this.isVideoLargeSubscribing&&((f=this.streamInfo)!=null&&f.hasVideoLarge)&&!(this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeLow&&this.isVideoSmallSubscribing)&&(i.video=!0,i.vMsid=((l=this.streamInfo.getVideoLargeInfo())==null?void 0:l.msid)||G.VideoLarge),this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeLow&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&this.streamInfo.hasVideoSmall?(r.video=!0,r.vMsid=G.VideoLarge):this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeHigh&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&(r.video=!0,r.vMsid=G.VideoSmall)):(!this.wantSubVideo||!((p=this.streamInfo)!=null&&p.hasVideo))&&this.isVideoSubscribing&&(r.video=!0,r.vMsid=this.streamInfo.isVideoSmallSubscribed||this.streamInfo.isVideoSmallSubscribing?G.VideoSmall:((d=this.streamInfo.getVideoLargeInfo())==null?void 0:d.msid)||G.VideoLarge),this.wantSubScreen&&!this.isScreenSubscribing&&((m=this.streamInfo)!=null&&m.hasScreen)?i.screen=!0:(!this.wantSubScreen||!((v=this.streamInfo)!=null&&v.hasScreen))&&this.isScreenSubscribing&&(r.screen=!0),(b=this.parameter.data)!=null&&b.enableSubDataChannel&&!this.isDataSubscribing&&((x=this.streamInfo)!=null&&x.hasData)?i.data=!0:(!((y=this.parameter.data)!=null&&y.enableSubDataChannel)||!((E=this.streamInfo)!=null&&E.hasData))&&this.isDataSubscribing&&(r.data=!0),(i.audio||i.video||i.screen||i.data)&&(this.createCallId(),this.subscribe(i,e,t)),(r.audio||r.video||r.screen)&&this.subscribeDeleteTracks(r),e===Be.Reconnect){if(ae.event(`[${kt.logName}]`,"reconnect, try to resume"),this.streamInfo.hasAudio&&!i.audio){const w=this.rtsManager.getStreamByMsid({url:this.streamUrl,aMsid:this.streamInfo.getAudioInfo().msid||G.Audio}).audioTrack;w&&(this.audioTrack=w,this.playAudio())}if(this.streamInfo.hasVideo&&!i.video){const w=this.rtsManager.getStreamByMsid({url:this.streamUrl,vMsid:this.streamInfo.isVideoSmallSubscribed||this.streamInfo.isVideoSmallSubscribing?G.VideoSmall:((I=this.streamInfo.getVideoLargeInfo())==null?void 0:I.msid)||G.VideoLarge});w&&w.mediaStream&&(this.stream=w,this.playAll(!1))}if(this.streamInfo.hasScreen&&!i.screen){const w=this.rtsManager.getStreamByMsid({url:this.streamUrl,sMsid:this.streamInfo.getScreenInfo().msid||G.Screen});w&&w.mediaStream&&(this.screenStream=w,this.playAll(!0))}}return{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===Ae.AliRtcVideoTrackScreen?this.screenStream:this.stream)==null?void 0:n.mediaStream;e.srcObject===r&&this.play(e,t===Ae.AliRtcVideoTrackScreen),document.removeEventListener("click",i,!1),document.removeEventListener("touchstart",i,!1)};document.addEventListener("click",i,!1),document.addEventListener("touchstart",i,!1)}playAudio(){return O(this,null,function*(){var t,i;if(!this.audioTrack)return;if(this.toggleAudio(!this.audioMuted),this.audioElement||(this.audioElement=document.createElement("audio"),this.audioElement.addEventListener("pause",this.handleAudioPaused),this.setPlayoutVolume(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),pe.AliRTS.SystenUtil.isIos&&parseInt(pe.AliRTS.SystenUtil.systemVersion)<=14&&(e.muted||(e.pause(),e.play()))})})}stopPlayAudio(){this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null,this.audioElement.removeEventListener("pause",this.handleAudioPaused))}playAll(e=!1,t=!1){e?(this.viewMap.screenViews||[]).forEach(i=>{this.play(i,e,t)}):(this.viewMap.cameraViews||[]).forEach(i=>{this.play(i,e,t)})}play(e,t=!1,i=!1){const r=t?this.screenStream:this.stream;!e||!r||!r.mediaStream||La(e,r.mediaStream,i).catch(n=>{n.code===20||n.name==="AbortError"||this.handleVideoPlayFailded(e,t?Ae.AliRtcVideoTrackScreen:Ae.AliRtcVideoTrackCamera)})}stopPlayAll(e=!1){e?this.viewMap.screenViews.forEach(t=>{Ft(t)}):this.viewMap.cameraViews.forEach(t=>{Ft(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 O(this,null,function*(){var i,r,n,a,o;const e=[];if(this.isAudioSubscribing){const u=yield this.rtsManager.getSubscribeAudioStats(this.streamUrl);u&&e.push({uid:this.uid,track:ci.AliRtcAudioTrackMic,stats:u})}const t=[];if((i=this.streamInfo)!=null&&i.isVideoLargeSubscribed){const u=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,((r=this.streamInfo.getVideoLargeInfo())==null?void 0:r.msid)||G.VideoLarge);u&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackCamera,streamType:Ge.AliRtcVideoStreamTypeHigh,stats:u})}if((n=this.streamInfo)!=null&&n.isVideoSmallSubscribed){const u=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,((a=this.streamInfo.getVideoSmallInfo())==null?void 0:a.msid)||G.VideoSmall);u&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackCamera,streamType:Ge.AliRtcVideoStreamTypeLow,stats:u})}if(this.isScreenSubscribing){const u=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,((o=this.streamInfo.getScreenInfo())==null?void 0:o.msid)||G.Screen);u&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackScreen,stats:u})}return{audio:e,video:t}})}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.audioTrack&&this.audioLevelMonitor.start(this.audioTrack,e),this.audioVolumeIndicationInterval=e)}reportSubscribeMonitor(e){var t;e&&(this.slsReporter.reportSubscribeMonitor(((t=this.localUser)==null?void 0:t.callId)||"",this.callId,this.trackTraceIdMap[e]||"",e,this.monitorDataCache[e]),this.monitorDataCache[e]=[])}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>O(this,null,function*(){try{if(this.streamInfo.subscribingInfos.length===0){this.stopStreamMonitor();return}let e=Object.keys(this.monitorDataCache).filter(t=>{var i;return((i=this.monitorDataCache[t])==null?void 0:i.length)>0});this.streamInfo.subscribingInfos.forEach(t=>{const i=t.msid;if(!i)return;e.includes(i)&&(e=e.filter(a=>a!==i));let r;const n=i===G.Audio;n?r=this.rtsManager.getSubscribeAudioStats(this.streamUrl):r=this.rtsManager.getSubscribeVideoStats(this.streamUrl,i),r.then(a=>{var g;if(!a.timestamp)return;this.monitorDataCache[i]||(this.monitorDataCache[i]=[]);const o=this.monitorDataCache[i];let u;if((o==null?void 0:o.length)>0){const h=o[o.length-1]||{},{_last:l}=h;u=pi(h,["_last"])}(o==null?void 0:o.length)>=F0&&this.reportSubscribeMonitor(i),a._last=u,a._codec=t.codec,n&&(a._source=(g=this.localUser)==null?void 0:g.getMediaStats(a.playoutId)),this.monitorDataCache[i].push(a)})}),e.forEach(t=>{this.reportSubscribeMonitor(t)})}catch(e){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0),Object.keys(this.monitorDataCache).forEach(e=>{this.reportSubscribeMonitor(e)})}},_(kt,"logName","RemoteUser"),kt);et([j()],Ye.prototype,"clear",1),et([j()],Ye.prototype,"updateRemoteUserDeviceStatus",1),et([j()],Ye.prototype,"updateRemoteTracks",1),et([j(ne)],Ye.prototype,"subscribe",1),et([j()],Ye.prototype,"subscribeProxy",1),et([j(ne)],Ye.prototype,"subscribeDeleteProxy",1),et([j()],Ye.prototype,"restore",1),et([j(ne)],Ye.prototype,"stopSubscribe",1),et([j(ne)],Ye.prototype,"doStopSubscribe",1),et([j()],Ye.prototype,"clearStream",1),et([j()],Ye.prototype,"clearScreenStream",1),et([j()],Ye.prototype,"updateSubscribe",1),et([j()],Ye.prototype,"playAudio",1),et([j()],Ye.prototype,"stopPlayAudio",1),et([j((s,c,e)=>[typeof s=="string"?s:s==null?void 0:s.nodeType,c,e])],Ye.prototype,"play",1),et([j()],Ye.prototype,"stopPlayAll",1);let O0=Ye;var Vt=(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))(Vt||{});class V0 extends xe{constructor(){super(...arguments);_(this,"plugins",new Map)}add(e,t){if(this.plugins.has(e.name))throw new Y(Vt.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 Y(Vt.AliRtcPluginErrorNoFindPlugin,`Plugin ${e} not founded`);this.plugins.delete(e),t.removeAllListeners(),this.emit("removed",t)}removeAll(){this.plugins.forEach(e=>{this.remove(e.name)})}get(e){return this.plugins.get(e)}has(e){return!!this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}}var U0=Object.defineProperty,H0=Object.getOwnPropertyDescriptor,Ke=(s,c,e,t)=>{for(var i=t>1?void 0:t?H0(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&&U0(c,e,i),i};const Ji=([s])=>{const{remoteUser:c,options:e}=s;return[`user(${c.userId})`,e]},Ua=5,je=(nt=class extends xe{constructor(e,t,i,r,n){super();_(this,"rts");_(this,"encodedInsertableStreams",!0);_(this,"audioRedEnabled",!1);_(this,"localStreamManager");_(this,"slsReporter");_(this,"_rtsReconnecting",!1);_(this,"_rtsPeerConnectionType","publish");_(this,"connecting",!1);_(this,"connected",!1);_(this,"_pcTraceId","");_(this,"_localJoinTime",0);_(this,"publishRetryHook");_(this,"subscribeRetryOptionsHook");_(this,"connectionResolve");_(this,"connectingPromise");_(this,"dcResolve");_(this,"dcConnectingPromise");_(this,"_publishingTracks",[]);_(this,"parameter",{});this.localStreamManager=e,this.slsReporter=t,this.publishRetryHook=i,this.subscribeRetryOptionsHook=r,this.parameter=n,this.rts=pe.AliRTS.createClient(),this.addRTSListener()}addRTSListener(){this.rts.on("connectStatusChange",e=>{var t,i,r,n;if(ae.event(`[${nt.logName}]`,"rts connectStatusChange to:",e.status),e.status===pe.EConnectStatus.CONNECT_STATUS_DISCONNECTED)this.setConnected(!1),this.slsReporter.reportWarning("rts disconnected"),this.emit("disconnected");else if(e.status===pe.EConnectStatus.CONNECT_STATUS_CONNECTED){const a=(n=(r=(i=(t=this.rts.commonController)==null?void 0:t.peerCore)==null?void 0:i.getSignal())==null?void 0:r.getDatachannelCore())==null?void 0:n.readyState;ae.event(`[${nt.logName}]`,"dcReadyState:",a),a==="open"&&this.dcResolve&&this.dcResolve(!0),this._rtsReconnecting&&this._rtsPeerConnectionType==="publish"&&(this._publishingTracks=this.rts.getPublishTrackInfoList());try{this.emit("connected",this._rtsReconnecting,this._rtsPeerConnectionType)}catch(o){}this.setConnected(!0)}}),this.rts.on("datachannelStatusChange",e=>{ae.event(`[${nt.logName}]`,"rts datachannelStatusChange to:",e.status),e.status===pe.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?this.dcResolve&&this.dcResolve(!0):e.status===pe.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&(this.dcConnectingPromise=new Promise(t=>{this.dcResolve=t}))}),this.rts.on("receivedSEI",e=>{this.emit("seimessage",e.url,e.sei.payloadType,e.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(o=>o.mimeType==="audio/red"),a=r.findIndex(o=>o.mimeType==="audio/opus");if(n>-1&&a>-1&&n>a){const o=r[a];r[a]=r[n],r[n]=o}}this.rts.setSenderCodecPreferences({audio:r}),this.rts.setReceiverCodecPreferences({audio:r})}}catch(i){}this.audioRedEnabled=e}}clear(){this.setConnected(!1);try{this.rts.unpublish()}catch(e){}this.rts=pe.AliRTS.createClient(),this.addRTSListener()}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,this._rtsReconnecting=!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:G.Audio]),e.hasScreen&&(n.vMsid=[G.Screen]),e.hasVideo&&(n.vMsid=[r!=null?r:t!=null&&t.isScreen?G.Screen:G.VideoLarge]),n}updatePublishingTracks(e){e&&(this._publishingTracks=e.map(({msid:t,from:i,ssrc:r,codec:n,type:a,trackId:o})=>({msid:t,from:i,type:a,ssrc:`${r}`,codec:n!=null?n:"",trackId:o})))}httpPublish(n,a){return O(this,arguments,function*(e,t,i=!1,r=Bt.MANUAL){var b,x;let o;const{publishStream:u,videoSmallStream:h,screenStream:g,vMsid:f}=yield this.localStreamManager.createHTTPPublishStream();if(!u)return ae.warn(`[${nt.logName}]`,"publishStream is null"),{traceId:"",l1ip:o};const l=this.getPubMsid(u,{vMsid:f});this.encodedInsertableStreams&&(l.encodedInsertableStreams=!0),l.answerSdpHook=y=>{const E=/\d+\.\d+\.\d+\.\d+(?=\s+1106|\s+8000)/.exec(y);return E!=null&&E[0]&&(o=E[0]),y},(x=(b=this.parameter)==null?void 0:b.net)!=null&&x.useTCP&&(l.tcpOnly=!0),l.beforeRetry=y=>O(this,null,function*(){this._rtsReconnecting=!0,this.publishRetryHook&&this.publishRetryHook();const{publishStream:E,vMsid:I}=yield this.localStreamManager.createHTTPPublishStream();if(!E)return;const w=this.getPubMsid(E,{vMsid:I});return y.stream=E,w.aMsid?y.aMsid=w.aMsid:y.aMsid=[],w.vMsid?y.vMsid=w.vMsid:y.vMsid=[],y}),this._rtsPeerConnectionType="publish";let p=!u.hasVideo,d=f,m="";this.startConnect();const v=Date.now();try{m=yield this.rts.publish(e,u,l)}catch(y){this.setConnected(!1);const E=2e3-(Date.now()-v);throw E<=0?this.emit("disconnected"):setTimeout(()=>{this.emit("disconnected")},E),this.slsReporter.reportPublish(i,e,t,u.hasVideo&&(!f||f===G.VideoLarge),u.hasVideo&&f===G.VideoSmall,u.hasVideo&&f===G.Screen,u.hasAudio,(y==null?void 0:y.errorCode)||-1,this.pcTraceId,"",v),Y.fromRtsError(y)}ae.event(`[${nt.logName}]`,"rts publish success",m),this.slsReporter.reportPublish(i,e,t,u.hasVideo&&(!f||f===G.VideoLarge),u.hasVideo&&f===G.VideoSmall,u.hasVideo&&f===G.Screen,u.hasAudio,0,m,m,v);try{const y=Date.now();return this._pcTraceId=m,this.setConnected(!0),this._publishingTracks=this.rts.getPublishTrackInfoList(),h&&(yield this.publishAdd(e,h,t,{vMsid:G.VideoSmall},i),p=!1,d=G.VideoSmall),g&&(yield this.publishAdd(e,g,t,{vMsid:G.Screen},i),p=!1,d=G.Screen),yield this.waitPublishSender(e,p,d),this.slsReporter.reportPublishFirstPacket(i,t,v,y,this._localJoinTime,p?G.Audio:l.vMsid,m||"",m||"",r),{traceId:m,l1ip:o}}catch(y){throw this.setConnected(!1),Y.fromError(y)}})}waitPublishSender(e,t=!1,i){return O(this,null,function*(){const r=(n,a)=>{let o=0;const u=()=>(t?this.rts.getPublishAudioStats(e,i):this.rts.getPublishVideoStats(e,i)).then(g=>!(g.bytesSent>0)&&o<n?(o++,new Promise(l=>setTimeout(()=>l(u()),a))):Promise.resolve());return u()};return Promise.race([Nt(1e3),r(5,100)]).catch(()=>{})})}getPublishVideoStats(e,t){return O(this,null,function*(){return yield this.rts.getPublishVideoStats(e,t)})}getPublishAudioStats(e,t){return O(this,null,function*(){return yield this.rts.getPublishAudioStats(e,t)})}publishAdd(u,h,g,f){return O(this,arguments,function*(e,t,i,r,n=!1,a=!1,o=Bt.MANUAL){var d,m,v,b,x,y,E,I;const l=Date.now(),p=this.getPubMsid(t,r);try{const w=yield Ba(R=>O(this,null,function*(){return R>0&&ae.event(`[${nt.logName}]`,`publishAdd retry times: ${R}`),this.isConnected?(yield this.dcConnectingPromise,this.rts.publishAdd([ve({url:e,stream:t,updateSourceStream:!1},p)])):Promise.reject(new Y(te.ERR_INNER,"rts not connected"))}),Ua,0,R=>(R==null?void 0:R.errorCode)===15006);if(w){const R=Date.now(),[L]=w;return this.slsReporter.reportPublish(!1,e,i,((d=p.vMsid)==null?void 0:d[0])===G.VideoLarge,((m=p.vMsid)==null?void 0:m[0])===G.VideoSmall,((v=p.vMsid)==null?void 0:v[0])===G.Screen,((b=p.aMsid)==null?void 0:b[0])===G.Audio,0,this.pcTraceId,L.traceId||"",l),this.updatePublishingTracks(L.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,i,l,R,this._localJoinTime,(t.hasVideo?r==null?void 0:r.vMsid:r==null?void 0:r.aMsid)||"",this.pcTraceId,L.traceId||"",o),L.traceId||""}}catch(w){throw this.slsReporter.reportPublish(!1,e,i,((x=p.vMsid)==null?void 0:x[0])===G.VideoLarge,((y=p.vMsid)==null?void 0:y[0])===G.VideoSmall,((E=p.vMsid)==null?void 0:E[0])===G.Screen,((I=p.aMsid)==null?void 0:I[0])===G.Audio,(w==null?void 0:w.errorCode)||-1,this.pcTraceId,"",l),w!=null&&w.errorCode?Y.fromRtsError(w):Y.fromError(w)}return""})}publishDelete(e,t){return O(this,null,function*(){var u,h,g,f,l,p,d,m;yield this.dcConnectingPromise;const i=(h=(u=this.publishingTracks)==null?void 0:u.find(({msid:v})=>v===G.Audio))==null?void 0:h.msid,r=(f=(g=this.publishingTracks)==null?void 0:g.find(({msid:v})=>v===G.VideoLarge))==null?void 0:f.msid,n=(p=(l=this.publishingTracks)==null?void 0:l.find(({msid:v})=>v===G.Screen))==null?void 0:p.msid,a=[];t.screen&&n?a.push(n):t.video&&a.push(t.vMsid||r);const o=[];t.audio&&i&&o.push(i),ae.event(nt.logName,"publishDelete",{streamUrl:e,aMsid:o,vMsid:a});try{const[v]=(yield this.rts.publishDeleteTracks([{url:e,aMsid:o,vMsid:a}]))||[];return ae.event(nt.logName,"publishDelete",{result:v}),v&&this.updatePublishingTracks(v.trackInfoList),((m=(d=v==null?void 0:v.trackInfoList)==null?void 0:d[0])==null?void 0:m.trackId)||""}catch(v){throw Y.fromRtsError(v)}})}publishReplace(e,t,i){return O(this,null,function*(){var a,o;yield this.dcConnectingPromise;const{vMsid:r,aMsid:n}=i!=null?i:{};try{const u=yield this.rts.publishReplaceTracks([{url:e,stream:t,updateSourceStream:!1,vMsid:r,aMsid:n}]),[h]=u;return this.updatePublishingTracks(h.trackInfoList),((o=(a=h==null?void 0:h.trackInfoList)==null?void 0:a[0])==null?void 0:o.trackId)||""}catch(u){throw Y.fromRtsError(u)}})}publishStop(e){return O(this,null,function*(){return yield this.rts.publishStop([{url:e}]),this._publishingTracks=[],""})}publishAddDataChannel(e){return O(this,null,function*(){yield this.dcConnectingPromise;const t=yield this.rts.publishAddDatachannel({signalUrl:e,url:e,label:G.Data,msid:G.Data}),i=t==null?void 0:t.datachannel;if(i&&i.send){const r=new ArrayBuffer(4);new DataView(r).setUint8(0,240),i.datachannel.send(r)}return i})}publishStopDataChannel(e,t){return O(this,null,function*(){return yield this.rts.publishStopDatachannel({url:e,datachannel:t})})}unpublish(){return O(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)||G.Audio]),i.video?i.vMsid?r.vMsid=[i.vMsid]:e!=null&&e.hasVideoLarge?r.vMsid=[(e==null?void 0:e.getVideoLargeInfo().msid)||G.VideoLarge]:e!=null&&e.hasVideoSmall?r.vMsid=[(e==null?void 0:e.getVideoSmallInfo().msid)||G.VideoSmall]:r.vMsid=[G.VideoLarge]:i.screen&&e!=null&&e.hasScreen&&(r.vMsid=[(e==null?void 0:e.getScreenInfo().msid)||G.Screen]),r}httpSubscribe(e){return O(this,null,function*(){var a,o;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);this.encodedInsertableStreams&&(n.encodedInsertableStreams=!0),(o=(a=this.parameter)==null?void 0:a.net)!=null&&o.useTCP&&(n.tcpOnly=!0),n.beforeRetry=u=>O(this,null,function*(){this._rtsReconnecting=!0;try{this.emit("reconnecting","subscribe")}catch(h){}if(this._publishingTracks=[],this.subscribeRetryOptionsHook){const h=this.subscribeRetryOptionsHook();if(h){let g=t.streamUrl;i.video||i.screen?i!=null&&i.audio||(g+="@subaudio=no"):g+="@subvideo=no",u.url=g;const f=this.getSubConfig(h.remoteUser.streamInfo,h.options);f.aMsid&&(u.aMsid=f.aMsid),f.vMsid&&(u.vMsid=f.vMsid)}else return}return u}),this._rtsPeerConnectionType="subscribe";try{this.startConnect();const u=yield this.rts.subscribe(r,n);return this._pcTraceId=u.traceId,this.setConnected(!0),{traceId:u.traceId,stream:u}}catch(u){throw this.setConnected(!1),this.emit("disconnected"),Y.fromRtsError(u)}})}subscribeAdd(e){return O(this,null,function*(){var n,a,o,u;const{remoteUser:t,options:i}=e,r=Rt(ve({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 Ba(g=>O(this,null,function*(){return yield this.dcConnectingPromise,g>0&&ae.event(`[${nt.logName}]`,`subscribeAdd retry times: ${g}`),this.isConnected?this.rts.subscribeAdd([r]):Promise.reject()}),Ua,0,g=>(g==null?void 0:g.errorCode)===15006))[0]}catch(h){if(((u=(o=(a=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:a.streams)==null?void 0:o[0])==null?void 0:u.res_code)===508)return this.emit("subscribeexceeds"),null;throw Y.fromRtsError(h)}})}subscibeDelete(e){return O(this,null,function*(){var n,a,o,u;yield this.dcConnectingPromise;const{remoteUser:t,options:i}=e,r=Rt(ve({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=(o=(a=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:a.streams)==null?void 0:o[0])==null?void 0:u.res_code)===404)return;throw Y.fromRtsError(h)}})}subscibeStop(e){return O(this,null,function*(){var t,i,r,n;try{yield this.rts.subscribeStop([{url:e}])}catch(a){if(((n=(r=(i=(t=a==null?void 0:a.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 Y.fromRtsError(a)}})}subscribeAddDataChannel(e){return O(this,null,function*(){yield this.dcConnectingPromise;const t=yield this.rts.subscribeAddDatachannel({signalUrl:e,url:e,label:G.Data,msid:G.Data}),i=t==null?void 0:t.datachannel;if(i&&i.send){const r=new ArrayBuffer(4);new DataView(r).setUint8(0,240),i.send(r)}return i})}subscribeStopDatachannel(e,t){return O(this,null,function*(){let i;try{i=yield this.rts.subscribeStopDatachannel({url:e,datachannel:t})}catch(r){}return t==null||t.dispose(),i})}publish(n,a){return O(this,arguments,function*(e,t,i=!1,r=Bt.MANUAL){let o="",u;if(this.connecting&&(yield this.connectingPromise),this.connected){yield this.dcConnectingPromise;let h=!1,g;const{audio:f,video:l,videoSmall:p,screen:d}=this.localStreamManager.publishStreams;f&&(o=yield this.publishAdd(e,f,t,{aMsid:G.Audio},i),h=!0,g=G.Audio,yield Nt(100)),l&&(o=yield this.publishAdd(e,l,t,{vMsid:G.VideoLarge},i),h=!1,g=G.VideoLarge,yield Nt(100)),p&&(o=yield this.publishAdd(e,p,t,{vMsid:G.VideoSmall},i),h=!1,g=G.VideoSmall,yield Nt(100)),d&&(o=yield this.publishAdd(e,d,t,{isScreen:!0,vMsid:G.Screen},i),h=!1,g=G.Screen),g&&(yield this.waitPublishSender(e,h,g))}else{const h=yield this.httpPublish(e,t,i,r);o=h.traceId,u=h.l1ip}return{traceId:o,l1ip:u}})}subscribe(e,t,i,r,n){return O(this,null,function*(){let a=!1;const{options:o,remoteUser:u}=e;if(o.video&&o.screen)throw new Y(te.ERR_INNER,"subscribe error, video and screen cannot be subscribed at the same time");this.connecting&&(yield this.connectingPromise);let h,g=Date.now();this.connected?(g=Date.now(),h=yield this.subscribeAdd(e)):(a=!0,h=yield this.httpSubscribe(e));const f=Date.now();let l=G.VideoLarge,p=o.video||o.screen,d=o.audio;o.video&&o.vMsid?l=o.vMsid:o.screen&&(l=G.Screen);let m=0,v=0,b=0;const y=((E,I)=>{let w=0;const R=()=>{let L;return d&&!m&&(L=this.rts.getSubscribeAudioStats(u.streamUrl).then(D=>{if(D.packetsReceived>0)m=Date.now();else if(!p)return w<E?(w++,new Promise(N=>setTimeout(()=>N(R()),I))):!1;return!0})),p&&!b&&(L=this.rts.getSubscribeVideoStats(u.streamUrl,l).then(D=>{if(D.packetsReceived>0&&(v=Date.now()),D.framesDecoded>0)b=Date.now();else return w<E?(w++,new Promise(N=>setTimeout(()=>N(R()),I))):(ae.error(`[${nt.logName}]`,u.userId,"尝试获取首帧数据失败"),!1);return!0})),Promise.resolve(L)};return R()})(40,100);return y.then(()=>{v&&this.slsReporter.reportSubscribeFirstPacket(t===Be.Resume,i,r,l,{fprt:v-g,ifsprtc:b?b-g:0,ajsub:t===Be.Join?1:0,pctid:this.pcTraceId,subtid:(h==null?void 0:h.traceId)||"",sstc:f-g}),b&&this.slsReporter.reportSubscribeFirstFrame(t===Be.Resume,i,r,l,{fvfrt:b-g,fp2fftc:b-v,ajsub:t===Be.Join?1:0,tffrtc:t===Be.Join?b-this.localJoinTime:b-n,pctid:this.pcTraceId,subtid:(h==null?void 0:h.traceId)||"",fvfdtc:b-g}),m&&this.slsReporter.reportSubscribeFirstPacket(t===Be.Resume,i,r,G.Audio,{fprt:m-g,ifsprtc:m-g,ajsub:t===Be.Join?1:0,pctid:this.pcTraceId,subtid:(h==null?void 0:h.traceId)||"",sstc:f-g})}),a&&(yield Promise.race([y,Nt(1500)])),h})}getSubscribeVideoStats(e,t){return O(this,null,function*(){return yield this.rts.getSubscribeVideoStats(e,t)})}getSubscribeAudioStats(e,t){return O(this,null,function*(){return yield this.rts.getSubscribeAudioStats(e,t)})}getStreamByMsid(e){return this.rts.commonController.streamManager.getStreamByMsid(e)}getPCStats(){return O(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 O(this,null,function*(){return this.rts.sendSEI({url:e,vMsid:G.VideoLarge,data:t,repeatCount:i,payloadType:r})})}},_(nt,"logName","RtsManager"),nt);Ke([j()],je.prototype,"updatePublishingTracks",1),Ke([j(ne,ne)],je.prototype,"httpPublish",1),Ke([j(ne,ne)],je.prototype,"waitPublishSender",1),Ke([j(([s,c,e])=>[s,JSON.stringify(e)],ne)],je.prototype,"publishAdd",1),Ke([j(ne,ne)],je.prototype,"publishDelete",1),Ke([j(([s,c,e])=>[s,JSON.stringify(e)])],je.prototype,"publishReplace",1),Ke([j(ne)],je.prototype,"publishStop",1),Ke([j(ne)],je.prototype,"publishAddDataChannel",1),Ke([j(ne)],je.prototype,"publishStopDataChannel",1),Ke([j()],je.prototype,"unpublish",1),Ke([j(Ji,({traceId:s})=>s)],je.prototype,"httpSubscribe",1),Ke([j(Ji,({traceId:s})=>s)],je.prototype,"subscribeAdd",1),Ke([j(Ji)],je.prototype,"subscibeDelete",1),Ke([j(ne)],je.prototype,"subscibeStop",1),Ke([j(ne)],je.prototype,"subscribeAddDataChannel",1),Ke([j(ne)],je.prototype,"subscribeStopDatachannel",1),Ke([j(ne)],je.prototype,"publish",1),Ke([j(Ji)],je.prototype,"subscribe",1),Ke([j()],je.prototype,"sendSEI",1);let z0=je;class Rs{constructor(){_(this,"profile");_(this,"profileMap",new Map);_(this,"audioProfile");_(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 O(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 Ds extends xe{constructor(e){super();_(this,"type");_(this,"originVideoTrack");_(this,"videoSource");_(this,"_videoMuted",!1);_(this,"originAudioTrack");_(this,"audioSource");_(this,"_audioMuted",!1);_(this,"_targetVideoTrack");_(this,"_targetDualVideoTrack");_(this,"_targetAudioTrack");_(this,"_publishVideoStream");_(this,"_publishDualVideoStream");_(this,"_publishAudioStream");_(this,"_previewStream");_(this,"plugins",[]);_(this,"_profileManager");_(this,"cameraVideoConstraints");_(this,"micAudioConstraints");_(this,"onVideoTrackEnded",()=>{this.emit("videotrackended")});_(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 O(this,null,function*(){var a,o,u,h,g,f;const{videoTrack:r,audioTrack:n}=e;r&&((a=this.originVideoTrack)==null||a.removeEventListener("ended",this.onVideoTrackEnded)),n&&((o=this.originAudioTrack)==null||o.removeEventListener("ended",this.onAudioTrackEnded)),this.type===We.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||ni.Camera,this.updateVideoTrack(r)),n&&(this.originAudioTrack=n,(f=this.originAudioTrack)==null||f.addEventListener("ended",this.onAudioTrackEnded),this.audioSource=i||Pi.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 O(this,null,function*(){(this._targetVideoTrack!==e||t)&&(this._targetVideoTrack=e)})}updateDualVideoTrack(e,t=!1){return O(this,null,function*(){(this._targetDualVideoTrack!==e||t)&&(this._targetDualVideoTrack=e)})}updateAudioTrack(e,t=!1){return O(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 O(this,null,function*(){var t,i,r,n,a,o,u,h,g,f,l,p;this._targetAudioTrack=this.originAudioTrack,this._targetVideoTrack=this.originVideoTrack;for(const d of this.plugins)try{yield d.execute(this,e)}catch(m){console.error(`error in plugin-${d.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 Di(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?(a=this.previewStream)==null||a.mergeStream(this._publishVideoStream):this._previewStream=yield Di(this._targetVideoTrack)):(this._publishVideoStream=void 0,(o=this.previewStream)==null||o.deleteTracks({video:!0})),this._targetDualVideoTrack?((h=(u=this._publishDualVideoStream)==null?void 0:u.videoTrack)==null?void 0:h.id)!==this._targetDualVideoTrack.id&&(this._publishDualVideoStream=yield Di(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 Di(this._targetAudioTrack),this.setAudioMuted(this._audioMuted),this.previewStream?(l=this.previewStream)==null||l.mergeStream(this._publishAudioStream):this._previewStream=yield Di(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 O(this,null,function*(){this._profileManager||(this._profileManager=new Rs),e&&this._profileManager.updateProfile(e,t),yield this._profileManager.setVideoProfile(this.originVideoTrack,this._publishVideoStream,this.type===We.AliRtcSdkStreamTypeScreen)})}get videoProfile(){var e;return(e=this.profileManager)==null?void 0:e.videoProfile}setVideoContentHint(e){this._profileManager||(this._profileManager=new Rs),this._profileManager.setContentHint(this.currentVideoTrack,e)}updateAudioProfile(e){return O(this,null,function*(){this._profileManager||(this._profileManager=new Rs),this._profileManager.updateAudioProfile(e)})}cloneVideoProfile(e){return O(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 j0=Object.defineProperty,W0=Object.getOwnPropertyDescriptor,_t=(s,c,e,t)=>{for(var i=t>1?void 0:t?W0(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&&j0(c,e,i),i};const xt=(ri=class extends xe{constructor(e,t){super();_(this,"pluginManager");_(this,"slsReporter");_(this,"publishingCameraVideoStream");_(this,"publishingScreenVideoStream");_(this,"cameraStreamInfo",new Ds(We.AliRtcSdkStreamTypeCapture));_(this,"screenStreamInfo",new Ds(We.AliRtcSdkStreamTypeScreen));_(this,"streamInfos",[this.cameraStreamInfo,this.screenStreamInfo]);_(this,"_audioCaptureDisabled",!1);_(this,"_cameraCaptureDisabled",!1);_(this,"_publishLocalAudioStreamEnabled",!0);_(this,"_publishLocalVideoStreamEnabled",!0);_(this,"_publishLocalScreenStreamEnabled",!0);this.screenStreamInfo.setVideoContentHint("motion"),this.pluginManager=e,this.slsReporter=t;const i=r=>O(this,null,function*(){if(ae.info(`[${ri.logName}]`,"plugin added",r.name),!r.isSupported("6.13.2-beta.0")){console.warn(`${r.name} is not supported!!!`),r.emit("unsupported");return}try{yield r.init()}catch(n){r.emit("error",Y.fromError(n,Vt.AliRtcPluginErrorInitError))}r.streamType===We.AliRtcSdkStreamTypeCapture&&(this.cameraStreamInfo.addPlugin(r),yield this.cameraStreamInfo.process(this.streamInfos)),r.streamType===We.AliRtcSdkStreamTypeScreen&&(this.screenStreamInfo.addPlugin(r),yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")});this.cameraStreamInfo.updateVideoProfile(Ta,wi),this.cameraStreamInfo.on("videotrackended",()=>O(this,null,function*(){yield this.stopLocalStream({video:!0}),this.emit("trackended",ti.VideoTrackEnded)})),this.cameraStreamInfo.on("audiotrackended",()=>O(this,null,function*(){yield this.stopLocalStream({audio:!0}),this.emit("trackended",ti.AudioTrackEnded)})),this.screenStreamInfo.updateVideoProfile(ka,Ci),this.screenStreamInfo.on("videotrackended",()=>O(this,null,function*(){yield this.stopLocalStream({screen:!0}),this.emit("trackended",ti.ScreenTrackEnded)})),this.pluginManager.on("added",i),this.pluginManager.on("removed",r=>O(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",()=>O(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}set cameraCaptureDisabled(e){this._cameraCaptureDisabled=e}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}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 O(this,null,function*(){yield this.cameraStreamInfo.process(this.streamInfos),yield this.screenStreamInfo.process(this.streamInfos),this.emit("publishupdate")})}setAvailableCameraDeviceId(){return O(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 a=yield pe.AliRTS.getCameraList();a.find(o=>o.deviceId===n)||(n=(r=(i=a.find(o=>!!o.deviceId))==null?void 0:i.deviceId)!=null?r:""),this.cameraStreamInfo.cameraVideoConstraints.deviceId=n}})}setAvailableMicrophoneDeviceId(){return O(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 a=yield pe.AliRTS.getMicList();a.find(o=>o.deviceId===n)||(n=(r=(i=a.find(o=>!!o.deviceId))==null?void 0:i.deviceId)!=null?r:""),this.cameraStreamInfo.micAudioConstraints.deviceId=n}})}createLocalStream(e){return O(this,null,function*(){var g;const{screen:t,mediaStream:i,videoProfile:r,screenProfile:n}=e;let{video:a,audio:o}=e;const u=C0(e);let h;if(u){i||(a===!0&&this.cameraStreamInfo.cameraVideoConstraints?(yield this.setAvailableCameraDeviceId(),a=ve({},this.cameraStreamInfo.cameraVideoConstraints)):typeof a=="object"&&(yield this.setAvailableCameraDeviceId(),a=ve(ve({},a),this.cameraStreamInfo.cameraVideoConstraints)),o===void 0&&this.audioCaptureDisabled?o=!1:o&&(o===!0&&this.cameraStreamInfo.micAudioConstraints?(yield this.setAvailableMicrophoneDeviceId(),o=ve({},this.cameraStreamInfo.micAudioConstraints)):typeof o=="object"&&(yield this.setAvailableMicrophoneDeviceId(),o=ve(ve({},o),this.cameraStreamInfo.micAudioConstraints)),this._audioCaptureDisabled=!1));const f=Date.now();try{h=yield pe.AliRTS.createStream({audio:o,video:a,screen:t,custom:!!i,mediaStream:i,skipProfile:!0}),o&&!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(l){throw o&&!i&&this.slsReporter.reportAudio(l,Date.now()-f,""),t&&!i&&this.slsReporter.reportScreen(null,Date.now()-f),l}if(t)yield this.screenStreamInfo.updateSource(h,ni.Screen,Pi.Screen),yield this.setScreenProfile(n),this.setScreenContentHint(),this.publishingScreenVideoStream=void 0;else if(yield this.cameraStreamInfo.updateSource(h,ni.Camera,Pi.Microphone),h.hasVideo&&(yield this.setVideoProfile(r),this.setVideoContentHint(),this.publishingCameraVideoStream=void 0),h.hasAudio&&typeof o=="boolean"){const l=this.cameraStreamInfo.audioProfile;l&&(yield h.setAudioProfile(l))}}return pe.AliRTS.SystenUtil.isIos&&pe.AliRTS.SystenUtil.compareVersion("15.1")&&!pe.AliRTS.SystenUtil.compareVersion("15.2")&&(yield Nt(1e3)),yield this.updateStreams(),h})}stopLocalStream(e){return O(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 O(this,null,function*(){var o,u,h,g;let e,t=!1,i,r,n;const a=yield this.publishStreams;try{if(!a.audio&&!a.video&&!a.videoSmall&&!a.screen)throw ae.error(`[${ri.logName}]`,"no tracks founded"),new Y(te.ERR_SDK_PUBLISH_INVAILD,"no tracks founded");const f=new MediaStream;(o=a.audio)!=null&&o.audioTrack&&f.addTrack(a.audio.audioTrack),(u=a.video)!=null&&u.videoTrack?(f.addTrack(a.video.videoTrack),r=a.videoSmall,n=a.screen):(h=a.screen)!=null&&h.videoTrack&&(i=G.Screen,f.addTrack((g=a.screen)==null?void 0:g.videoTrack),t=!0),e=yield Oa(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(),this.updateStreams()}setVideoProfile(e,t){return O(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 O(this,null,function*(){var t;yield this.cameraStreamInfo.updateAudioProfile(e),yield(t=this.publishingCameraVideoStream)==null?void 0:t.setAudioProfile(e)})}setScreenProfile(e,t){return O(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=ve(ve({},(t=this.cameraStreamInfo.cameraVideoConstraints)!=null?t:{}),e)}setMicAudioConstraints(e){var t;this.cameraStreamInfo.micAudioConstraints=ve(ve({},(t=this.cameraStreamInfo.micAudioConstraints)!=null?t:{}),e)}},_(ri,"logName","LocalStreamManager"),ri);_t([j(([s])=>{const{audio:c,video:e,screen:t,custom:i,skipProfile:r,videoProfile:n,screenProfile:a}=s;return[{audio:c,video:e,screen:t,custom:i,skipProfile:r,videoProfile:n,screenProfile:a}]})],xt.prototype,"createLocalStream",1),_t([j(ne)],xt.prototype,"stopLocalStream",1),_t([j()],xt.prototype,"createHTTPPublishStream",1),_t([j()],xt.prototype,"stop",1),_t([j(ne)],xt.prototype,"setVideoProfile",1),_t([j(ne)],xt.prototype,"setVideoContentHint",1),_t([j(ne)],xt.prototype,"setAudioProfile",1),_t([j(ne)],xt.prototype,"setScreenProfile",1),_t([j(ne)],xt.prototype,"setScreenContentHint",1),_t([j(ne)],xt.prototype,"setCameraVideoConstraints",1),_t([j(ne)],xt.prototype,"setMicAudioConstraints",1);let K0=xt;class $0 extends Zt{constructor(){super("AliRtcScreenStandardize",We.AliRtcSdkStreamTypeScreen);_(this,"canvas");_(this,"lastWidth");_(this,"lastHeight");_(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===ni.Screen)}handleFrame(e,t){return O(this,null,function*(){var a;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=(a=this.canvas)==null?void 0:a.getContext("2d");if(this.canvas&&n){n.drawImage(e,0,0,i,r);const o=new VideoFrame(this.canvas,{timestamp:e.timestamp});return e.close(),o}return e})}process(e){return O(this,null,function*(){var h;if(!e.originVideoTrack||e.videoSource!==ni.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,a=new TransformStream({transform(g,f){return O(this,null,function*(){const l=yield n.handleFrame(g,e);yield f.enqueue(l),l==null||l.close()})}});t.readable.pipeThrough(a).pipeTo(i.writable);const o=(h=r.getVideoTracks())==null?void 0:h[0];e.updateVideoTrack(o),this.hasScreenTrack=!0})}clear(e){this.canvas=void 0,this.lastWidth=void 0,this.lastHeight=void 0,super.clear(e)}}class q0 extends Zt{constructor(){super("blankAudio",We.AliRtcSdkStreamTypeCapture,xi.BOTH);_(this,"hasTrack",!1);_(this,"oscillator",null);_(this,"audioTrack",null);_(this,"createAudioTrack",()=>{const e=new AudioContext;this.oscillator=e.createOscillator();const t=e.createGain();t.gain.value=0;const i=e.createMediaStreamDestination();this.oscillator.connect(t),t.connect(i),this.oscillator.start();const r=i.stream;return this.audioTrack=r.getAudioTracks()[0],this.audioTrack});this.zIndex=9}isSupported(){return!0}setOptions(){throw new Error("Method not implemented.")}shouldUpdate(e,t){return this.hasTrack!==t.some(i=>i.originVideoTrack||i.originAudioTrack)}process(e,t){return O(this,null,function*(){var r;const i=t.some(n=>n.originVideoTrack||n.originAudioTrack);this.hasTrack=i,i?this.audioTrack&&((r=this.oscillator)==null||r.stop(),this.oscillator=null,this.audioTrack.stop(),this.audioTrack=null):(this.audioTrack||(this.audioTrack=this.createAudioTrack()),e.updateAudioTrack(this.audioTrack))})}}class Ha{constructor(c){_(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)}}_(Ha,"LEVEL",0);class G0{constructor(){_(this,"logger",new Ha("AudioMixer"));_(this,"audioContext",new AudioContext);_(this,"audioDestination",this.audioContext.createMediaStreamDestination());_(this,"audioTrack",_0(this.audioDestination.stream));_(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 J0=4;class X0 extends Zt{constructor(){super("audioMixer",We.AliRtcSdkStreamTypeCapture,xi.AUDIO);_(this,"audioMixer");_(this,"primaryAudioTrackId");_(this,"screenAudioTrackId");_(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,a;if(e.type!==We.AliRtcSdkStreamTypeCapture)return!1;const i=t.find(o=>o.type===We.AliRtcSdkStreamTypeCapture),r=t.find(o=>o.type===We.AliRtcSdkStreamTypeScreen);return!(this.primaryAudioTrackId===((n=i==null?void 0:i.currentAudioTrack)==null?void 0:n.id)&&this.screenAudioTrackId===((a=r==null?void 0:r.currentAudioTrack)==null?void 0:a.id)&&!this.dirty)}process(e,t){return O(this,null,function*(){var a,o;this.dirty=!1;const i=t.find(u=>u.type===We.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 G0),yield this.audioMixer.resume(),this.primaryAudioTrackId&&(r==null?void 0:r.id)!==this.primaryAudioTrackId&&((a=this.audioMixer)==null||a.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&&((o=this.audioMixer)==null||o.removeTrack(this.screenAudioTrackId)),n&&!this.audioMixer.hasTrack(n==null?void 0:n.id)&&this.audioMixer.addTrack(n),this.screenAudioTrackId=n==null?void 0:n.id,this.updateVolume(),e.updateAudioTrack(this.audioMixer.getAudioTrack())})}isValidVolume(e){return e!==void 0&&e>=0&&e<=J0}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 Ts{constructor(c,e){_(this,"originTrack");_(this,"originVideo");_(this,"targetWidth");_(this,"targetHeight");_(this,"targetFrameRate");_(this,"targetCanvas");_(this,"animationFrameId");_(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 a=t,o=i,u=0,h=0;return n>r?(a=Math.round(o/r),u=Math.round((t-a)/2)):n<r&&(o=Math.round(a*r),h=Math.round((i-o)/2)),{x:u,y:h,width:a,height:o}}}class Z0 extends Ts{constructor(e,t){super(e,t);_(this,"targetCtx");this.targetCtx=this.targetCanvas.getContext("2d"),this.startRender=this.startRender.bind(this),this.stopRender=this.startRender.bind(this),this.initStream(e)}initStream(e){const t=new MediaStream;t.addTrack(e),this.originVideo.srcObject=t,this.originVideo.play(),this.originVideo.addEventListener("canplay",this.startRender),this.originVideo.addEventListener("pause",this.stopRender),this.originVideo.addEventListener("ended",this.stopRender)}startRender(){this.cancelAnimation();const e=()=>{if(!this.targetCtx)return;const t=this.getPositionAndSize(this.originVideo.videoWidth,this.originVideo.videoHeight,this.targetWidth,this.targetHeight);this.targetCtx.drawImage(this.originVideo,0,0,this.originVideo.videoWidth,this.originVideo.videoHeight,t.x,t.y,t.width,t.height),!this.originVideo.paused&&!this.originVideo.ended&&(this.animationFrameId=requestAnimationFrame(e))};e()}stopRender(){this.cancelAnimation()}dispose(){this.stopRender(),this.originVideo.removeEventListener("play",this.startRender),this.originVideo.removeEventListener("pause",this.stopRender),this.originVideo.removeEventListener("ended",this.stopRender),this.originVideo.pause(),this.originVideo.srcObject=null}}const Y0=`
39
+ `+e)}}return null})}var $c=(s,c,e)=>new Promise((t,i)=>{var r=o=>{try{a(e.next(o))}catch(u){i(u)}},n=o=>{try{a(e.throw(o))}catch(u){i(u)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(r,n);a((e=e.apply(s,c)).next())});function xa(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 $c(this,null,function*(){yield Kc(s);let t=c.slice(c.indexOf("/logstores")),i=e.length,r=zc(e),n=new Date().toUTCString(),a=new Map,o=new Map([["Content-Type","application/json"],["Content-MD5",r],["x-log-bodyrawsize",i.toString()]]);s.securityToken&&o.set("x-acs-security-token",s.securityToken),jc("POST",t,s.accessKeyId,s.accessKeySecret,a,o,r,n);let u=Object.fromEntries(o);return{data:e,header:u}})}}}typeof window!="undefined"&&ga(window,"stsPlugin",xa);const{BrowserUtil:qc}=pe.AliRTS,ai={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Gecko:"Gecko",WebKit:"WebKit"},Vi=(s,c)=>{const e=c.match(s);return e&&e.length>0&&e[1]||""},Gc=[{test:[/\sedg\//i,[/edg([ea]|ios)/i]],describe(s){if(/\sedg\//i.test(s))return{name:ai.Blink};const e=Vi(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:ai.EdgeHTML,version:e}}},{test:[/trident/i],describe(s){const c={name:ai.Trident},e=Vi(/trident\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}},{test(s){const c=/gecko/i.test(s),e=/like gecko/i.test(s);return c&&!e},describe(s){const c={name:ai.Gecko},e=Vi(/gecko\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:ai.Blink}}},{test:[/(apple)?webkit/i],describe(s){const c={name:ai.WebKit},e=Vi(/webkit\/(\d+(\.?_?\d+)+)/i,s);return e&&(c.version=e),c}}],us=(s,c)=>s.find(e=>{if(typeof e.test=="function")return e.test(c);if(Array.isArray(e.test))return e.test.some(t=>typeof t=="string"?c.indexOf(t)>-1:t instanceof RegExp?t.test(c):!1)}),Jc=()=>{try{const s=navigator.userAgent||"",c=us(Gc,s);if(c){const e=c.describe(s);return`${e.name}/${e.version||qc.browserVersion}`}}catch(s){}return navigator.userAgent},Xc=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],Zc=()=>{let s="unknown";try{const c=navigator.userAgent||"",e=us(Xc,c);if(!e)return s;s=e.describe(c)}catch(c){}return s},Yc=[{test:[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],describe(){return"Samsung"}},{test:[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i,/\((ipad);[-\w\),; ]+apple/i,/(macintosh);/i],describe(){return"Apple"}},{test:[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],describe(){return"Huawei"}},{test:[/(?:honor)([-\w ]+)[;\)]/i],describe(){return"Honor"}},{test:[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],describe(){return"Xiaomi"}},{test:[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],describe(){return"Oppo"}},{test:[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],describe(){return"Vivo"}},{test:[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],describe(){return"Realme"}},{test:[/(pixel c)\b/i,/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],describe(){return"Google"}},{test:[/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],describe(){return"ZTE"}},{test:[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],describe(){return"Meizu"}}],Qc=()=>{let s="Unknown";try{const c=navigator.userAgent||"",e=us(Yc,c);if(!e)return s;s=e.describe(c)}catch(c){}return s},{BrowserUtil:hs,SystenUtil:Sa}=pe.AliRTS;class _a{constructor(){_(this,"tracker");_(this,"param");_(this,"msgCacheArr",[]);_(this,"index",0);_(this,"stsOpt");_(this,"slsToken");_(this,"ossToken")}createTracker(){if(!this.tracker&&this.slsToken&&this.param){const c=this.slsToken;this.ossToken&&(this.param.ossbn=this.ossToken.bucket_name,this.param.ossep=this.ossToken.region_endpoint);const e=new va({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=xa(t);e.useStsPlugin(i),this.tracker=e,this.msgCacheArr.forEach((r,n)=>{var a,o;(o=this.tracker)==null||o.send(ve(Rt(ve({},this.param),{stat_log_id:`${((a=this.param)==null?void 0:a.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 t,i;c.tm=Date.now();let e;try{e=JSON.parse(JSON.stringify(ve(Rt(ve({bt:hs.browserName||"unknown"},this.param),{stat_log_id:`${((t=this.param)==null?void 0:t.sesid)||"nosession"}-${this.index}`}),c)))}catch(r){}if(e){if(!this.tracker){this.msgCacheArr.push(e);return}(i=this.tracker)==null||i.send(e),this.index++}}initParam(c){let e=localStorage==null?void 0:localStorage.getItem("AliRtcUUID");e||(e=Kt(),localStorage==null||localStorage.setItem("AliRtcUUID",e)),this.param||(this.param={apid:c.appId,usrid:c.userId,statsvrs:"0.6.1",evetid:0,sesid:c.sessionId,sessionId:c.sessionId,channelid:c.channelId,usrn:c.userId,osn:Sa.systemName,osv:Sa.systemVersion,deb:Qc(),den:Jc(),udid:e,sdkvrs:mr,acs:"Unknown",cput:Zc(),dm:`${window.location.protocol}//${window.location.host}`,bt:hs.browserName,bv:hs.browserVersion,envir:"PRODUCT",args:""})}}const Le=(s,c=1,e=6e4,t=0)=>{let i=s;return i||(i=0),Math.min(e,Math.max(t,Math.round(i*c)))},bt=(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))))},Jt=(s,c)=>{if(c===0||!c)return"0.00";let e=s;return(!e||e<0)&&(e=0),(e/c*100).toFixed(2)},ya=s=>s>=0&&s<=1?Le(Math.floor(32767*s),1,32767):0,Me=(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},e0=(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)},Aa=(s,c)=>Le(Me(s,c),1e3,1e4),Xt=(s,c=2e7)=>Le(s,1,c),Ti=class Ti{constructor(c){_(this,"engine");_(this,"logClient");_(this,"authInfo");this.logClient=new _a,this.engine=c}static getLogClient(){return this.staticClient||(this.staticClient=new _a),this.staticClient}static reportOSSUpload(c,e,t=0){Ti.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),Ti.getLogClient().updateToken(c,e)}stop(){this.logClient.stop()}reportPublishMonitor(c,e,t,i,r){if(!t||r.length<=0)return;const n=t===G.Audio,a={ctm:Math.floor(r[0].timestamp||0),src:r[0].ssrc||"",codec:r[0]._codec||""},o=[],u=[],h=[],g=[],f=[],l=[],p=[],d=[],m=[],v=[],b=[],x=[],y=[],E=[],I=[],w=[],R=[],L=[],D=[];try{if(r.forEach(N=>{var j,F,K,Q,ge,ce;if(!N||!N.timestamp)return;const C=(j=N._last)!=null&&j.timestamp?N.timestamp-N._last.timestamp:1e3,M=Me(N,"bytesSent"),A=Me(N,"headerBytesSent"),U=bt(Le(M+A,8,2e7),C);o.push(U);const ie=bt(Le(M,8,2e7),C);u.push(ie);const q=bt(Le(A,8,2e7),C);h.push(q);const oe=Me(N,"packetsSent"),$=bt(oe,C);g.push($);const se=Me(N,"packetsLost"),k=bt(se,C);f.push(k);const P=Jt(se,oe);if(l.push(P),n)(F=N._source)!=null&&F.audioLevel&&p.push(ya(N._source.audioLevel)),d.push(0);else{m.push(Aa(N,"totalEncodeTime")),v.push(Xt((K=N._source)==null?void 0:K.framesPerSecond,100)),b.push(Xt((Q=N._source)==null?void 0:Q.framesPerSecond,100)),x.push(Xt(N.framesPerSecond,100)),y.push(Xt((ge=N._source)==null?void 0:ge.height,4400)),E.push(Xt((ce=N._source)==null?void 0:ce.width,7700)),I.push(Xt(N.frameHeight,4400)),w.push(Xt(N.frameWidth,7700));const Se=Me(N,"totalPacketSendDelay");R.push(Le(Se,1/(se||1),2e3));const De=Me(N,"qpSum");L.push(Le(De,1/(N.framesPerSecond||1),51)),D.push(0)}}),a.sbr=o.join(","),a.mbrs=u.join(","),a.pbrs=h.join(","),a.ps=g.join(","),a.pl=f.join(","),a.plr=l.join(","),n){const N=(i==null?void 0:i.getSettings().sampleRate)||0;a.ailevel=p.join(","),a.arpc=d.join(","),a.arsr=N,a.aesr=N,a.publevel=-90,a.rawlevel=-90}else a.em=m.join(","),a.cfps=v.join(","),a.ifps=b.join(","),a.sfps=x.join(","),a.ih=y.join(","),a.iw=E.join(","),a.sh=I.join(","),a.sw=w.join(","),a.sd=R.join(","),a.aqp=L.join(","),a.caf=D.join(","),a.can=D.join(","),a.cav=u.join(","),a.ifimax=D.join(","),a.ifimin=D.join(","),a.efimax=D.join(","),a.efimin=D.join(","),a.sfimax=D.join(","),a.sfimin=D.join(","),a.apsnr=D.join(",")}catch(N){}this.log({evetid:10070,traceid:e,calid:c,args:this.data2String(ve({calid:c,tckid:t,traceid:e},a))})}reportSubscribeMonitor(c,e,t,i,r){if(!i||!r||r.length<=0)return;const n=i===G.Audio,a={ctm:Math.floor(r[0].timestamp||0),src:r[0].ssrc||"",codec:r[0]._codec||""},o=[],u=[],h=[],g=[],f=[],l=[],p=[],d=[],m=[],v=[],b=[],x=[],y=[],E=[],I=[],w=[],R=[],L=[],D=[],N=[],C=[],M=[],A=[],U=[],ie=[],q=[],oe=[],$=[],se=[],k=[],P=[],j=[],F=[],K=[];try{r.forEach(Q=>{var ee,le;if(!Q||!Q.timestamp)return;const ge=(ee=Q._last)!=null&&ee.timestamp?Q.timestamp-Q._last.timestamp:1e3,ce=Me(Q,"bytesReceived"),Se=Me(Q,"headerBytesReceived"),De=bt(Le(ce+Se,8,2e7),ge);o.push(De);const Ie=bt(Le(ce,8,2e7),ge);u.push(Ie);const Ue=bt(Le(Se,8,2e7),ge);h.push(Ue);const Te=Me(Q,"packetsReceived"),S=bt(Te,ge);g.push(S);const J=Me(Q,"packetsLost"),W=bt(J,ge);f.push(W);const B=Jt(J,Te);l.push(B);const T=Me(Q,"jitterBufferDelay"),V=Me(Q,"jitterBufferEmittedCount");if(Q.jitterBufferDelay&&Q.jitterBufferEmittedCount){const re=Le(T,1e3/V,1e4);p.push(re)}else p.push(0);const Z=Me(Q,"fecPacketsReceived");x.push(Jt(Z,Te));const X=Me(Q,"retransmittedPacketsReceived"),H=Te+J-X;if(m.push(Jt(Te-X,H)),v.push(Jt(J,H)),d.push(Jt(X,H)),b.push(H),F.push(0),K.push(""),n){E.push(ya(Q.audioLevel));const re=e0(Q,"synthesizedSamplesEvents");I.push(re);const me=Aa(Q,"synthesizedSamplesDuration");w.push(me);const we=Jt(me,ge);y.push(we),R.push(0)}else{const re=(le=Q._last)!=null&&le.totalInterFrameDelay?Q.totalInterFrameDelay-Q._last.totalInterFrameDelay:0;L.push(Le(re,1e3/(Q.framesDecoded||30),500)),D.push(Le(Q.framesPerSecond,1,100)),N.push(Me(Q,"framesReceived")),j.push(Me(Q,"framesRendered")),C.push(Le(Q.frameHeight,1,4400)),M.push(Le(Q.frameWidth,1,7700));const me=Me(Q,"totalProcessingDelay");A.push(Le(me,1e3/(Q.framesDecoded||30),12e4));const we=Me(Q,"nackCount");ie.push(we);const ye=Me(Q,"pliCount");U.push(ye);const et=Me(Q,"qpSum");q.push(Le(et,1/(Q.framesPerSecond||1),51)),oe.push(Le(Q.framesDropped));const Ct=Me(Q,"totalFreezesDuration");$.push(Le(Ct,1e3,3e4));const Fe=Me(Q,"jitterBufferEmittedCount"),ut=Me(Q,"jitterBufferDelay");ut&&Fe?se.push(Le(ut,1e3/Fe,3e4)):se.push(0);const Ne=Me(Q,"jitterBufferTargetDelay");Ne&&Fe?k.push(Le(Ne,1e3/Fe,3e4)):k.push(0);const It=Me(Q,"jitterBufferMinimumDelay");It&&Fe?P.push(Le(It,1e3/Fe,3e4)):P.push(0)}}),a.rbr=o.join(","),a.mbrs=u.join(","),a.pbrs=h.join(","),a.pr=g.join(","),a.pl=f.join(","),a.plr=l.join(","),a.jd=p.join(","),a.fecr=x.join(","),a.retransr=d.join(","),a.baser=m.join(","),a.basel=v.join(","),a.recoverr=F.join(","),a.alll=v.join(","),a.totalc=b.join(","),n?(a.er=y.join(","),a.aolevel=E.join(","),a.asrc=R.join(","),a.scnt=I.join(","),a.sdura=w.join(",")):(a.dm=L.join(","),a.dfps=D.join(","),a.rfps=N.join(","),a.rh=C.join(","),a.rw=M.join(","),a.fpt=K.join(","),a.ns=ie.join(","),a.pliss=U.join(","),a.aqp=q.join(","),a.ofimax=F.join(","),a.ofimin=F.join(","),a.dfimax=F.join(","),a.dfimin=F.join(","),a.rfimax=F.join(","),a.rfimin=F.join(","),a.vrstutter=$.join(","),a.cdm=se.join(","),a.tdm=k.join(","),a.pdm=P.join(","),a.ofps=j.join(","),a.dfbd=oe.join(","))}catch(Q){}this.log({evetid:10080,traceid:t,rmtid:e,calid:c,args:this.data2String(ve({calid:c,rmtid:e,tckid:i,traceid:t},a))})}reportNetworkMonitor(c){if(c.length<=0)return;const e=[],t=[],i=[],r=[],n=[],a=[],o=[],u=[],h=[],g=[];c.forEach((l,p)=>{var m;if(!l.timestamp)return;const d=(m=l._last)!=null&&m.timestamp?l.timestamp-l._last.timestamp:1e3;e.push(Le(l.currentRoundTripTime,1e3)),t.push(Le(l.availableOutgoingBitrate,8,2e8)),i.push(bt(Le(l.bytesSent,8,2e7),d,25e6)),r.push(bt(Le(l.bytesReceived,8,2e7),d,25e6)),n.push(0),a.push(0),p%5===0&&(o.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:o.join(","),mem:u.join(","),sysmem:h.join(","),systotalmem:g.join(","),audioonly:this.engine.isAudioOnly()?1:0};this.log({evetid:10071,args:this.data2String(ve({asb:t.join(","),abms:n.join(","),vbms:a.join(",")},f))}),this.log({evetid:10081,args:this.data2String(ve({},f))})}reportJoin(c,e,t=""){var g,f;const{start:i,rs:r=0,re:n=0}=e,a=Date.now()-i,o=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:a,rslt:c,gslbtm:0,dnstm:0,avcftm:0,gslbrslt:0,dnsrslt:0,avcfrslt:0,mode:2,jrtc:o,usrn:(f=this.authInfo)==null?void 0:f.userId,mgt:"cdn",cttc:u,iptc:h,ndn:1,gslbloc:1,ccag:0,ucag:0,cpg:0,upg:0,tid:t})})}reportJoinConnection(c){this.log({evetid:20002,args:this.data2String(ve({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,a,o,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:a?1:0,rslt:o,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,a,o,u){const h=Date.now();this.log({evetid:c?10033:10031,calid:e,args:this.data2String({calid:e,fpst:h-t,tckid:n,est:t,pctid:a,pubtid:o,totaltm:h-r,jorm:u===Bt.JOIN_CHANNEL?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,a,o,u,h){this.log({evetid:10050,calid:c,rmtid:e,args:this.data2String(ve({calid:c,rmtid:e,isvl:t?1:0,isvs:i?1:0,isvss:r?1:0,isaudio:n?1:0,rslt:a,tid:o,subtm:u,isvp:0,isaplaying:0,isad:0,isdc:0,subretry:0,sbrttimes:0},h))})}reportSubscribeFirstPacket(c,e,t,i,r){this.log({evetid:c?10054:10051,calid:e,rmtid:t,args:this.data2String(ve({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(ve({calid:e,rmtid:t,tckid:i},r))}),this.log({evetid:c?10058:10057,args:this.data2String(ve({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==null?void 0: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==null?void 0: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,r,n;this.log({evetid:90013,args:this.data2String({rslt:c?-1:0,vcms:e,vde:(t=c==null?void 0:c.code)!=null?t:-1,sesid:((i=this.authInfo)==null?void 0:i.sessionId)||""})}),this.log({evetid:90014,args:this.data2String({rslt:c?-1:0,vcms:e,vde:(r=c==null?void 0:c.code)!=null?r:-1,sesid:((n=this.authInfo)==null?void 0:n.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(ve({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,e){this.log({evetid:70014,rslt:c,asty:1,reqtm:Date.now()-e})}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(),ae.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}};_(Ti,"staticClient");let vi=Ti;const t0=1e3*60*60*24*7,i0=s=>{if(!s||s.length!==8)return new Date;const c=parseInt(s.substring(0,4),10),e=parseInt(s.substring(4,6),10)-1,t=parseInt(s.substring(6,8),10);if(isNaN(c)||isNaN(e)||isNaN(t))return new Date;const i=new Date(c,e,t);return isNaN(i.getTime())?new Date:i};var ds=(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))(ds||{});class Ui{constructor(){_(this,"dbPromise");_(this,"stsToken");_(this,"logLevel");_(this,"logToConsole");_(this,"logToServer");_(this,"appId");_(this,"sessionId");_(this,"logCache",[]);_(this,"logMethod",(c,e=console.log)=>(...t)=>{if(this.logLevel>c)return;let i=this.getCurrentTime();this.logToConsole&&e(i,...t);let r=Ui.paramArrayToString(t);c>0&&this.addLog(r)});_(this,"d",this.logMethod(0,console.debug));_(this,"i",this.logMethod(1));_(this,"w",this.logMethod(3,console.warn));_(this,"e",this.logMethod(4,(...c)=>{const[e,...t]=c;console.error(e,"<error>",t)}));_(this,"ev",this.logMethod(2));_(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)}));_(this,"ar",this.logMethod(2,(...c)=>{const[e,...t]=c;console.log(e,...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));_(this,"ae",this.logMethod(2,(...c)=>{const[e,...t]=c;console.error(e,"<error>",...t),t.length>2&&`${t[1]}`.startsWith("__g__")&&console.groupEnd()}));this.logLevel=3,this.logToConsole=!0,this.logToServer=!0,this.appId="",this.sessionId="",this.dbPromise=Zo()}static toString(c){let e;if(c instanceof Error)e=c.message;else if(typeof c=="string")e=c;else try{e=JSON.stringify(c)}catch(t){e="undefined"}return e}changeConfig(c){c.logLevel!==void 0&&c.logLevel>=0&&c.logLevel<=5&&(this.logLevel=c.logLevel),c.logToConsole!==void 0&&(this.logToConsole=c.logToConsole),c.logToServer!==void 0&&(this.logToServer=c.logToServer)}updateSTSToken(c){const e=!!this.stsToken;this.stsToken=c,!e&&c&&this.tryUploadHistorySessionLog()}uploadSessionDateLog(c,e,t){return O(this,null,function*(){if(!c||!e||!t||t.length===0||!this.stsToken)return;const i=new Fo;i.file(`${c}.log`,t.map(f=>f.log||"").join(`
40
+ `));const r=yield i.generateAsync({type:"blob"}),n=yield Rc(r),a=cs(new Date,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),o={"x-oss-date":a,"content-md5":n,"content-type":"application/zip"};o.date=a,o["x-oss-security-token"]=this.stsToken.security_token;const u=`client/${e}/${this.appId}/${c}.zip`;o.authorization=yield Tc(this.stsToken.access_key_id,this.stsToken.access_key_secret,o,`/${this.stsToken.bucket_name}/${u}`);const h=`https://${this.stsToken.bucket_name}.${this.stsToken.region_endpoint}/${u}`,g=yield fetch(h,{method:"PUT",headers:o,body:r});if(g.status===200){vi.reportOSSUpload(c,e);const f=yield this.dbPromise;t.forEach(l=>{Ar(f,l.id)})}else vi.reportOSSUpload(c,e,g.status)})}uploadSessionLog(c){c&&this.dbPromise.then(e=>O(this,null,function*(){if(!this.stsToken)return;const t=yield In(e,c),i={},r=[];t.forEach(n=>{if(!n.date||!n.log){try{Ar(e,n.id)}catch(o){}return}const a=n.date;if(Date.now()-i0(a).getTime()>t0)try{Ar(e,n.id)}catch(o){}else i[a]||(i[a]=[],r.push(a)),i[a].push(n)}),Promise.all(r.map(n=>this.uploadSessionDateLog(c,n,i[n]))).then(()=>O(this,null,function*(){(yield In(e,c)).length===0&&ec(e,c)}))}))}tryUploadHistorySessionLog(){this.dbPromise.then(c=>O(this,null,function*(){(yield Qo(c)).filter(t=>(t==null?void 0:t.sid)!==this.sessionId).forEach(t=>{this.uploadSessionLog(t.sid)})}))}uploadCurrent(){const c=this.sessionId;this.sessionId="",this.uploadSessionLog(c)}setSessionID(c,e){!c||!e||(this.appId=c,this.dbPromise.then(t=>{this.sessionId=e,Yo(t,e),this.logCache&&(this.logCache.forEach(i=>{i.date&&i.log&&Cn(t,this.sessionId,i.date,`${i.log}`)}),this.logCache=[])}))}addLog(c){if(!this.logToServer)return;const e=this.getCurrentTime(),t=this.getCurrentDate(),i=`${e} ${c}`;this.sessionId?this.dbPromise.then(r=>{Cn(r,this.sessionId,t,i)}):this.logCache.push({date:t,log:i})}getCurrentTime(){return cs(new Date,"HH:MM:ss.l")}getCurrentDate(){return cs(new Date,"yyyymmdd")}static paramArrayToString(c){let e="";for(let t=0;t<c.length;t++){e!==""&&(e+=" ");let i=Ui.toString(c[t]);e+=i}return e}}class ae{static getLogger(){return this.logger||(this.logger=new Ui),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)}}_(ae,"logger");const r0=s=>O(this,null,function*(){const c=new pe.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()&&!pe.AliRTS.SystenUtil.isAndroid&&!pe.AliRTS.SystenUtil.isIos,e.detail.isSendMediaExtensionMsgSupported=c.checkWebRtcSupport()&&c.checkEncodedTransformSupport(),e}),s0=()=>new pe.AliRTS.SupportUtil().checkScreenCapture();var We=(s=>(s[s.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",s[s.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen",s))(We||{}),Ea=(s=>(s[s.PRE_PROCESSOR=0]="PRE_PROCESSOR",s[s.POST_PROCESSOR=1]="POST_PROCESSOR",s))(Ea||{}),xi=(s=>(s[s.AUDIO=0]="AUDIO",s[s.VIDEO=1]="VIDEO",s[s.BOTH=2]="BOTH",s))(xi||{});class Zt extends xe{constructor(e,t=We.AliRtcSdkStreamTypeCapture,i=1){super();_(this,"name");_(this,"options");_(this,"type",0);_(this,"streamType");_(this,"trackType");_(this,"zIndex",1);_(this,"_isEnable",!0);_(this,"lastInputAudioTrack");_(this,"lastOutputAudioTrack");_(this,"lastInputVideoTrack");_(this,"lastOutputVideoTrack");_(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 O(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 O(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 Si=(s=>(s[s.LiveTranscodingSingle=0]="LiveTranscodingSingle",s[s.LiveTranscodingMix=1]="LiveTranscodingMix",s))(Si||{}),ls=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingAudio=1]="LiveTranscodingAudio",s[s.LiveTranscodingVideo=2]="LiveTranscodingVideo",s))(ls||{}),oi=(s=>(s[s.LiveTranscodingCamera=0]="LiveTranscodingCamera",s[s.LiveTranscodingShareScreen=1]="LiveTranscodingShareScreen",s))(oi||{});const _i={0:"camera",1:"shareScreen"};var fs=(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))(fs||{});const n0={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 Hi=(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))(Hi||{}),yi=(s=>(s[s.LiveTranscodingNoBody=0]="LiveTranscodingNoBody",s[s.LiveTranscodingBody=1]="LiveTranscodingBody",s))(yi||{}),Ai=(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))(Ai||{}),ps=(s=>(s[s.LiveTranscodingOrigin=0]="LiveTranscodingOrigin",s[s.LiveTranscodingCrop=1]="LiveTranscodingCrop",s[s.LiveTranscodingFill=2]="LiveTranscodingFill",s))(ps||{}),zi=(s=>(s[s.LiveTranscodingNormal=0]="LiveTranscodingNormal",s[s.LiveTranscodingVirtualBackground=1]="LiveTranscodingVirtualBackground",s))(zi||{}),ms=(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))(ms||{}),Et=(s=>(s[s.LiveTranscodingErrorPublishOk=0]="LiveTranscodingErrorPublishOk",s[s.LiveTranscodingErrorStreamNotFound=17825793]="LiveTranscodingErrorStreamNotFound",s[s.LiveTranscodingErrorStreamAlreadyExist=17825794]="LiveTranscodingErrorStreamAlreadyExist",s[s.LiveTranscodingErrorInvalidParam=17825795]="LiveTranscodingErrorInvalidParam",s[s.LiveTranscodingErrorInternalError=17825796]="LiveTranscodingErrorInternalError",s[s.LiveTranscodingErrorRtmpServerError=17825797]="LiveTranscodingErrorRtmpServerError",s[s.LiveTranscodingErrorRtmpStreamUrlError=17825798]="LiveTranscodingErrorRtmpStreamUrlError",s[s.LiveTranscodingErrorPublishTimeout=17825799]="LiveTranscodingErrorPublishTimeout",s[s.LiveTranscodingErrorNotAuthorized=17825800]="LiveTranscodingErrorNotAuthorized",s))(Et||{}),gs=(s=>(s[s.TrascodingPublishTaskStatusStart=0]="TrascodingPublishTaskStatusStart",s[s.TrascodingPublishTaskStatusUpdate=1]="TrascodingPublishTaskStatusUpdate",s[s.TrascodingPublishTaskStatusStop=2]="TrascodingPublishTaskStatusStop",s))(gs||{}),ot=(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))(ot||{});const a0={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 bs{constructor(c,e,t,i,r,n,a,o){_(this,"videoWidth");_(this,"videoHeight");_(this,"videoFramerate",20);_(this,"videoBitrate",2e3);_(this,"videoGop",30);_(this,"audioSamplerate",Hi.LiveTranscoding_HZ_44100);_(this,"audioBitrate",500);_(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),a&&(this.audioBitrate=a),o&&(this.audioChannels=o)}}const vs=s=>((s&16711680)>>16)+(s&65280)+((s&255)<<16),vt=(s=0,c)=>{if(c==0)return 0;let e=s/c;return e<0&&(e=0),e>1&&(e=1),e};class ji{constructor(c,e,t){_(this,"mixMode",Si.LiveTranscodingSingle);_(this,"singleParam");_(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===ot.MPU_TASK_TRANSACTION_POLLING||c===ot.MPU_TASK_TRANSACTION_LIST||c===ot.MPU_TASK_TRANSACTION_ACKNOWLEDGE)return c===ot.MPU_TASK_TRANSACTION_ACKNOWLEDGE&&(n.messageid=r),n;if(n.taskid=t,c!==ot.MPU_TASK_TRANSACTION_STOP){if(n.mixmode=this.mixMode,i&&(n.streamurl=i),this.mixMode===Si.LiveTranscodingSingle){const a=this.singleParam;if(a){n.streamtype=a.streamType,a.sourceType===oi.LiveTranscodingShareScreen?n.sourcetype=_i[a.sourceType]:n.sourcetype=_i[oi.LiveTranscodingCamera];const o=[];a.userId&&o.push(a.userId),n.subspecusers=o}}else if(c===ot.MPU_TASK_TRANSACTION_START||c===ot.MPU_TASK_TRANSACTION_UPDATE){const a=this.mixParam;if(a){a.taskProfile&&(n.taskprofile=n0[a.taskProfile]);const o=a.encodeParam||new bs(1280,720);let u=o.videoWidth,h=o.videoHeight;const g={};Object.keys(o).forEach(l=>{const p=o[l];p>0&&(g[l.toLowerCase()]=p)}),g.lowbitratehighquality=0,n.encodeparam=g,n.backgrounds=a.backgrounds.map(l=>l.toJson(u,h)),n.watermarks=a.watermarks.map(l=>l.toJson(u,h)),n.clockwidgets=a.clockWidgets.map(l=>l.toJson(u,h));const f=a.users.map(l=>l.userId);n.subspecusers=[...new Set(f)],n.layouts=[{audiomixcount:a.users.length,panes:a.users.map((l,p)=>l.toJson(p,u,h,a.mediaProcessMode))}],n.layoutids=["0"],n.cropmode=a.cropMode,n.backgroundcolor=vs(a.backgroundColor),n.taskmode=a.mediaProcessMode}}}return n}}var Dt=(s=>(s.pre="pre",s.prod="prod",s))(Dt||{}),Tt=(s=>(s.AliRtcSdkCommunication="communication",s.AliRtcSdkInteractiveLive="interactive_live",s.AliRtcSdkInteractiveWithLowLatencyLive="cdn_live",s))(Tt||{}),Mt=(s=>(s.AliRtcSdkInteractive="interactive",s.AliRtcSdkLive="live",s))(Mt||{}),wt=(s=>(s[s.AliEngineLocalDeviceTypeUnknown=0]="AliEngineLocalDeviceTypeUnknown",s[s.AliEngineLocalDeviceTypeMic=1]="AliEngineLocalDeviceTypeMic",s[s.AliEngineLocalDeviceTypeSpeaker=2]="AliEngineLocalDeviceTypeSpeaker",s[s.AliEngineLocalDeviceTypeAudioDevice=3]="AliEngineLocalDeviceTypeAudioDevice",s[s.AliEngineLocalDeviceTypeCamera=4]="AliEngineLocalDeviceTypeCamera",s[s.AliEngineLocalDeviceTypeDisplay=5]="AliEngineLocalDeviceTypeDisplay",s[s.AliEngineLocalDeviceTypeVideoDevice=6]="AliEngineLocalDeviceTypeVideoDevice",s))(wt||{}),He=(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))(He||{}),ke=(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))(ke||{}),Yt=(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))(Yt||{}),xs=(s=>(s[s.AliRtcUserOfflineQuit=0]="AliRtcUserOfflineQuit",s[s.AliRtcUserOfflineDropped=1]="AliRtcUserOfflineDropped",s[s.AliRtcUserOfflineBecomeAudience=2]="AliRtcUserOfflineBecomeAudience",s))(xs||{}),ci=(s=>(s[s.AliRtcAudioTrackNo=0]="AliRtcAudioTrackNo",s[s.AliRtcAudioTrackMic=1]="AliRtcAudioTrackMic",s[s.AliRtcAudioTrackDual=2]="AliRtcAudioTrackDual",s))(ci||{}),Ae=(s=>(s[s.AliRtcVideoTrackNo=0]="AliRtcVideoTrackNo",s[s.AliRtcVideoTrackCamera=1]="AliRtcVideoTrackCamera",s[s.AliRtcVideoTrackScreen=2]="AliRtcVideoTrackScreen",s[s.AliRtcVideoTrackBoth=3]="AliRtcVideoTrackBoth",s))(Ae||{}),be=(s=>(s[s.AliRtcStatePublishIdle=0]="AliRtcStatePublishIdle",s[s.AliRtcStateNoPublish=1]="AliRtcStateNoPublish",s[s.AliRtcStatePublishing=2]="AliRtcStatePublishing",s[s.AliRtcStatePublished=3]="AliRtcStatePublished",s))(be||{}),Pe=(s=>(s[s.AliRtcStateSubscribeIdle=0]="AliRtcStateSubscribeIdle",s[s.AliRtcStateNoSubscribe=1]="AliRtcStateNoSubscribe",s[s.AliRtcStateSubscribing=2]="AliRtcStateSubscribing",s[s.AliRtcStateSubscribed=3]="AliRtcStateSubscribed",s))(Pe||{}),Ge=(s=>(s[s.AliRtcVideoStreamTypeNone=0]="AliRtcVideoStreamTypeNone",s[s.AliRtcVideoStreamTypeHigh=1]="AliRtcVideoStreamTypeHigh",s[s.AliRtcVideoStreamTypeLow=2]="AliRtcVideoStreamTypeLow",s))(Ge||{}),Ei=(s=>(s[s.CAMERA_INVALID=-1]="CAMERA_INVALID",s[s.CAMERA_REAR=0]="CAMERA_REAR",s[s.CAMERA_FRONT=1]="CAMERA_FRONT",s))(Ei||{});const wa=10,Ca=5e3,di=class di extends xe{constructor(e){super();_(this,"ws");_(this,"socketStatus",0);_(this,"wsUrl","");_(this,"lastConnectStartTime",0);_(this,"maxConnectRetryCount",wa);_(this,"connectRetryCount",0);_(this,"gotErr",!1);_(this,"closedByInvoke",!0);_(this,"isReconnecting",!1);_(this,"networkAvailableChecked",!0);_(this,"reconnectTimeoutId",0);this.maxConnectRetryCount=e!=null?e:wa,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.reconnectTimeoutId&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=0),this.emit("onReconnectStart"),this.isReconnecting=!0,this.initWebSocket()}onOpen(e){ae.info(`[${di.logName}]`,"onOpen"),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.socketStatus!==2&&St.isNetworkAvailable().then(t=>{t&&console.error(di.logName,"onError, Network is available, token may be invalid")})}onClose(e){return O(this,null,function*(){if(this.closedByInvoke){this.socketStatus=0;return}if(ae.info(`[${di.logName}]`,`onClose, code: ${e.code}, reason: ${e.reason}, status: ${status}, retryCount: ${this.connectRetryCount}`),(yield St.isNetworkAvailable())&&!this.networkAvailableChecked){this.reconnect(),this.networkAvailableChecked=!0;return}else this.connectRetryCount||this.emit("onNetworkError"),this.reconnectTimeoutId||(this.connectRetryCount+=1,this.connectRetryCount>this.maxConnectRetryCount?this.emit("onConnectFail"):Date.now()-this.lastConnectStartTime>=Ca?this.reconnect():this.reconnectTimeoutId=window.setTimeout(()=>{this.reconnect()},Ca));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.readyState!==WebSocket.CLOSED&&this.ws.close(),this.ws=void 0,this.socketStatus=0)}};_(di,"logName","Socket");let Ss=di;var ze=(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))(ze||{});class o0{constructor(c,e){_(this,"authInfo");_(this,"userName");_(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=St.getVersionNumber().toString(),c.header.platform=gn,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=St.getVersionNumber().toString(),e.header.platform=gn,e.data=ve(ve({},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:Kt(),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 te=(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_NOT_AVAILABLE=17040400]="ERR_SPEAKER_NOT_AVAILABLE",s[s.ERR_CAMERA_OPEN_FAIL=17039620]="ERR_CAMERA_OPEN_FAIL",s[s.ERR_CAMERA_AUTH_FAIL=17039621]="ERR_CAMERA_AUTH_FAIL",s[s.ERR_CAMERA_INTERRUPT=17039622]="ERR_CAMERA_INTERRUPT",s[s.ERR_CAMERA_NOT_AVAILABLE=17039623]="ERR_CAMERA_NOT_AVAILABLE",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_STREAM_FAILED=16843856]="ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED",s[s.ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED=16843857]="ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED",s[s.ERR_SDK_PUBLISH_DUAL_STREAM_FAILED=16843858]="ERR_SDK_PUBLISH_DUAL_STREAM_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_STREAM_FAILED=16844113]="ERR_SDK_SUBSCRIBE_AUDIO_STREAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_VIDEO_STREAM_FAILED=16844114]="ERR_SDK_SUBSCRIBE_VIDEO_STREAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_DUAL_STREAM_FAILED=16844115]="ERR_SDK_SUBSCRIBE_DUAL_STREAM_FAILED",s[s.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED=16844116]="ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED",s[s.ERR_SDK_SUBSCRIBE_DATA_FAILED=16844117]="ERR_SDK_SUBSCRIBE_DATA_FAILED",s[s.ERR_SDK_SUBSCRIBE_DATA_ERROR=16844118]="ERR_SDK_SUBSCRIBE_DATA_ERROR",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))(te||{});class Y extends Error{constructor(e,t,i){super(t);_(this,"_code");_(this,"_extra");this._code=e,this._extra=i}static fromRtsError(e){return e instanceof Y?e:new Y((e==null?void 0:e.errorCode)||-1,(e==null?void 0:e.message)||(e==null?void 0:e.errorCodeName)||"rts error",e)}static fromError(e,t=-1,i=""){return new Y(t,(e==null?void 0:e.message)||(e==null?void 0:e.reason)||i||"error",e)}get code(){return this._code}set code(e){this._code=e}get reason(){return this.message}get extra(){return this._extra}}const c0=3e4,lt=class lt extends xe{constructor(e,t,i,r,n,a){super();_(this,"authInfo");_(this,"userName");_(this,"channelProfile");_(this,"clientRole");_(this,"slsReporter");_(this,"wsClient");_(this,"packageCreater");_(this,"keepAliveTimer",0);_(this,"packageCache",new Map);_(this,"isFirstConnect",!0);_(this,"aliveChecker",0);_(this,"reconnectData");this.authInfo=e,this.userName=t,this.packageCreater=new o0(e,t),this.channelProfile=i,this.clientRole=r,this.slsReporter=n,this.wsClient=new Ss(a),this.wsClient.on("onOpen",this.onOpen.bind(this)),this.wsClient.on("onMessage",this.onMessage.bind(this)),this.wsClient.on("onError",this.onError.bind(this)),this.wsClient.on("onClose",this.onClose.bind(this)),this.wsClient.on("onConnectFail",this.onConnectFail.bind(this)),this.wsClient.on("onAuthInvalid",this.onAuthInvalid.bind(this)),this.wsClient.on("onNetworkError",this.onNetworkError.bind(this)),this.wsClient.on("onReconnectStart",this.onReconnectStart.bind(this)),this.wsClient.on("onReconnectFail",this.onReconnectFail.bind(this))}get retryCount(){return this.wsClient.connectRetryCount}start(e){this.wsClient.start(e)}startKeepAlive(){this.keepAliveTimer===0&&(this.keepAliveTimer=window.setInterval(()=>{let e=this.packageCreater.createKeepAlivePackage();this.sendPackage(e)},5e3)),this.checkAlive()}stopKeepAlive(){this.keepAliveTimer!==0&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=0),this.aliveChecker&&(window.clearTimeout(this.aliveChecker),this.aliveChecker=0)}sendPkgCache(){this.packageCache.forEach(e=>{this.wsClient.send(e)})}leave(){let e=this.packageCreater.crateLeavePackage();this.sendPackage(e)}reportStatus(e){let t=this.packageCreater.createStatusPackage(e);this.sendPackage(t)}publish(e){const o=e,{l1ip:t}=o,i=pi(o,["l1ip"]);let r=this.packageCreater.createPublishPackage();r.data.users=[],r.data.l1ip=t,i.subscribe.signal=this.wsClient.connectUrl;const{tracks:n,resume:a}=i;n.forEach(u=>{const{codec:h,ssrc:g}=u;u.userdata=JSON.stringify({codec:h}),u.ssrc=`${g}`,a&&(u.attr={reason:"reconnect"})}),r.data.users.push(i),this.sendPackage(r)}roleUpdate(e){let t=this.packageCreater.createRoleUpdatePackage();t.data.clientrole=e,this.sendPackage(t)}refreshUrl(e){const t=this.packageCreater.createRefreshUrlPackage();t.data=ve(Rt(ve({},t.data),{sessionid:t.header.sessionid}),e),this.sendPackage(t)}refreshAuthInfo(e){this.authInfo=e,this.packageCreater.refreshAuthInfo(e)}close(){ae.info(`[${lt.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){[ze.KEEPALIVE,ze.RECONNECT,ze.JOINCHANNEL].includes(e.msgtype)||this.packageCache.set(e.tid,e),this.wsClient.send(e),e.msgtype!==ze.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!0,e.msgtype,e.tid,e)}updateReconnectData(e){this.reconnectData=e}onOpen(){if(ae.info(`[${lt.logName}] onOpen`),this.isFirstConnect){let e=this.packageCreater.createJoinPackage();e.data.configure={channelprofile:this.channelProfile},(this.channelProfile===Tt.AliRtcSdkInteractiveLive||this.channelProfile===Tt.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)!==ze.KEEPALIVE&&this.slsReporter.reportRoomServerEvent(!1,t.msgtype,t.tid,t)}catch(t){ae.warn(`[${lt.logName}] onMessage err`,t,e)}}onError(e){ae.warn(`[${lt.logName}] onError`,e),this.isFirstConnect&&this.onConnectFail()}onConnectFail(){ae.warn(`[${lt.logName}] onConnectFail`);const e=new Y(te.ERR_INNER,"Signaling connect failed.");this.isFirstConnect?this.emit("onJoinChannelResult",e):this.emit("onConnectFail",e)}onAuthInvalid(){ae.warn(`[${lt.logName}] onAuthInvalid`),this.isFirstConnect&&this.emit("onAuthInvalid")}onNetworkError(){ae.warn(`[${lt.logName}] onNetworkError`);const e=new Y(te.ERR_INNER,"Network error, signaling connect failed.");this.emit("onNetworkError",e)}onClose(e){ae.info(`[${lt.logName}] onClose`,e),this.stopKeepAlive()}onKeepAliveRsp(){this.emit("onKeepAliveRsp"),this.checkAlive()}onReconnectStart(){this.emit("onReconnectStart")}onReconnectFail(){this.emit("onReconnectFail",new Y(te.ERR_INNER,"signaling reconnect failed."))}checkAlive(){window.clearTimeout(this.aliveChecker),this.aliveChecker=window.setTimeout(()=>{ae.info(`[${lt.logName}] not alive, reconnect`),this.stopKeepAlive(),this.emit("onReconnectStart"),this.wsClient.reconnect()},c0)}onRecvMessage(e){switch(e.msgtype!==ze.KEEPALIVE&&ae.info(`[${lt.logName}] recv msg: ${e.msgtype}`),e.msgtype){case ze.JOINCHANNEL:this.onJoinResult(e);break;case ze.KEEPALIVE:this.onKeepAliveRsp();break;case ze.PUBLISH:this.onPublishResult(e);break;case ze.NOTIFYJOIN:this.onNotifyJoin(e);break;case ze.NOTIFYSTATUS:this.onNotifyStatus(e);break;case ze.LEAVECHANNEL:this.onLeaveResult(e);break;case ze.NOTIFYLEAVE:this.onNotifyLeave(e);break;case ze.NOTIFYPUBLISH:this.onNotifyPublish(e);break;case ze.STATUSREPORT:this.onStatusReport(e);break;case ze.BYE:this.onBye(e);break;case ze.ROLEUPDATE:this.onRoleUpdateResult(e);break;case ze.REFRESHURL:this.onRefreshUrlResult(e);break;case ze.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 Y(te.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)}};_(lt,"logName","RSMessageCenter");let _s=lt;const z=(s,c)=>(e,t,i)=>{const r=i.value;return i.value=function(...n){var g;const a=`[${((g=e.constructor)==null?void 0:g.logName)||""}]`,o=Date.now();let u=[];if(s)try{u=s(n)}catch(f){}ae.interface(a,t,...u);const h=r.apply(this,n);return Promise.resolve(h).then(f=>f).catch(f=>f).then(f=>{var m;let l="";const p=f instanceof Error,d=p&&((m=e.constructor)==null?void 0:m.logError);if(!(!c&&!p)){if(d)l=f;else if(p)l=f.message||"";else if(c)if(f===void 0)l="";else try{l=c(f)}catch(v){}else return;ae.interfaceResult(a,t,!(p&&d),`${Date.now()-o}ms`,l)}}),h},i},ne=s=>s;var u0=Object.defineProperty,h0=Object.getOwnPropertyDescriptor,ys=(s,c,e,t)=>{for(var i=t>1?void 0:t?h0(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&&u0(c,e,i),i};const Wi=(st=class extends xe{constructor(e,t,i,r=Dt.prod){super();_(this,"messageCenter");_(this,"authInfo");_(this,"userName");_(this,"channelProfile");_(this,"clientRole");_(this,"slsReporter");_(this,"reconnectData");_(this,"roomServerUri","");this.channelProfile=e,this.clientRole=t,this.slsReporter=i,this.reconnectData={role:{channelprofile:e,clientrole:t}};const n=r===Dt.pre?Li.pre:Li.prod;this.roomServerUri=`wss://${n}/roomserver/v1/ws`}updateReconnectData(e){var t;this.reconnectData=e,(t=this.messageCenter)==null||t.updateReconnectData(this.reconnectData)}reset(){ae.info("[roomsig] reset"),this.messageCenter&&(this.messageCenter.close(),this.messageCenter=void 0),this.authInfo=void 0}join(e,t,i){return O(this,null,function*(){return new Promise((r,n)=>{const a={};this.authInfo=e,this.userName=t,this.messageCenter=new _s(e,t,this.channelProfile,this.clientRole,this.slsReporter,i),this.initMessageCenter(),this.messageCenter.once("onJoinChannelResult",u=>{var h,g,f;if(ae.info(`[${st.logName}]`,"join result: ",u),a.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 l=u.data;l.tid=u.tid,l.users=u.data.users,l.timestamp=u.timestamp,a.est&&(a.joinconnecttc=Date.now()-a.est),this.slsReporter.reportJoinConnection(a),r(l)}else this.reset(),n(this.handleSignalError(u.code,u.reason,te.ERR_JOIN_CHANNEL_FAILED))}),this.messageCenter.once("onAuthInvalid",()=>{this.reset(),n(new Y(te.ERR_JOIN_BAD_TOKEN,"join failed because authentication failed"))}),ae.info(`[${st.logName}]`,"start ws connecting roomserver and auto join when connected");const o={appid:this.authInfo.appId,callid:this.authInfo.sessionId,channelid:this.authInfo.channelId,userid:this.authInfo.userId,nonce:this.authInfo.nonce||"",timestamp:this.authInfo.timestamp,token:this.authInfo.token,authtype:"app",tid:Kt()};e.role&&(o.tokenrole=e.role),a.est=Date.now(),this.messageCenter.start(this.roomServerUri+"?"+St.queryingParam(o))})})}leave(){return ae.info("[roomsig] leave .."),new Promise((e,t)=>{this.messageCenter?(this.messageCenter.on("onLeaveResult",(i,r)=>{ae.info(`[${st.logName}]`,"recv leave response "+i),i===200?(this.updateReconnectData(),this.reset(),e({tid:r})):t(this.handleSignalError(i,"leave error"))}),ae.info(`[${st.logName}]`,"send leave request"),this.messageCenter.leave()):(ae.info(`[${st.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,a,o)=>{ae.info(`[${st.logName}]`,"recv pubish response "+n),n===200?(this.updateReconnectData(Rt(ve({},this.reconnectData),{publish:{users:[e]}})),t({tid:a})):i(this.handleSignalError(n,`publish error, ${o}`))}),this.authInfo&&(e.sessionid=(r=this.authInfo.sessionId)!=null?r:""),e.callid||(e.callid=Kt()),ae.info(`[${st.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,a)=>{var o,u;ae.info(`[${st.logName}]`,"recv role update response "+r),r===200?((u=(o=this.reconnectData)==null?void 0:o.role)!=null&&u.clientrole&&(this.reconnectData.role.clientrole=e,this.updateReconnectData(this.reconnectData)),t({tid:n})):i(this.handleSignalError(r,`role update error, ${a}`))}),this.messageCenter.roleUpdate(e)})}setChannelProfile(e){this.channelProfile=e}refreshUrl(e){return ae.info(`[${st.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:a,data:o={}}=r||{};ae.info("recv refresh url response "+n),n===200?t(o):i(this.handleSignalError(n,`refresh url error, ${a}`))}),ae.info("send refresh url request"),this.messageCenter.refreshUrl(e)})}reportStatus(e){return ae.info(`[${st.logName}]`,"reportStatus "+e),new Promise((t,i)=>{this.messageCenter?(this.messageCenter.once("onStatusReport",(r,n)=>{r===200?t():i(new Y(r,n))}),this.messageCenter.reportStatus(e)):i(new Y(-1,"No messageCenter"))})}handleSignalError(e,t,i=te.ERR_INNER){const r=`signal error: code - ${e}; description - ${t}`;return new Y(i,r)}refreshAuthInfo(e){return O(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,a,o,u,h,g,f,l;(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)}),(a=this.messageCenter)==null||a.on("onBye",(p,d)=>{this.emit("onBye",p,d)}),(o=this.messageCenter)==null||o.on("onReconnectStart",()=>{this.emit("onReconnectStart")}),(u=this.messageCenter)==null||u.on("onReconnectSuccess",p=>{this.emit("onReconnectSuccess",p)}),(h=this.messageCenter)==null||h.on("onReconnectFail",p=>{this.emit("onReconnectFail",p)}),(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)}),(l=this.messageCenter)==null||l.on("onAuthInvalid",()=>{this.emit("onAuthInvalid")})}},_(st,"logName","RoomServerSignaling"),st);ys([z()],Wi.prototype,"join",1),ys([z()],Wi.prototype,"publish",1),ys([z()],Wi.prototype,"roleUpdate",1);let d0=Wi;const l0="https://pgw.rtn.aliyuncs.com",f0="https://gw.rtn.aliyuncs.com",Ia=10*60*1e3,p0=12,ki=class ki extends xe{constructor(e,t){super();_(this,"env");_(this,"authInfo");_(this,"timer");_(this,"slsReporter");_(this,"expiration",0);_(this,"skipTime",0);_(this,"requestToken",()=>O(this,null,function*(){if(this.skipTime=0,!this.authInfo)return;const{appId:e,channelId:t,userId:i,nonce:r="",token:n,timestamp:a,sessionId:o,role:u}=this.authInfo;let h=f0;this.env===Dt.pre&&(h=l0);const g=`${h}/gslb/v1/stsupdate?appid=${e}&channelid=${t}&userid=${i}&nonce=${r}&token=${n}&timestamp=${a}&session=${o}${u?`&tokenrole=${u}`:""}&slstoken=true&osstoken=true&tokensid=false`,f=Date.now();fetch(g).then(l=>l.json()).then(l=>{var p,d;if(l.code===0){const m=(p=l.data)==null?void 0:p.oss,v=(d=l.data)==null?void 0:d.sls;this.expiration=m.expiration||v.expiration,this.emit("onTokenUpdate",m,v),ae.event(`[${ki.logName}]`,"getToken",m,v)}else throw new Error;this.slsReporter.reportSTSResult(200,f)}).catch(l=>{this.slsReporter.reportSTSResult(-1,f),ae.error(`[${ki.logName}]`,"getToken",l.message)})}));this.slsReporter=e,this.env=t}refreshAuthInfo(e){this.authInfo=e}startSTSUpdate(e){this.authInfo=e,this.requestToken(),this.timer&&clearInterval(this.timer),this.timer=window.setInterval(()=>{if(this.expiration&&Math.floor((Date.now()+Ia*1.5)/1e3)<this.expiration&&this.skipTime<p0){this.skipTime+=1;return}this.requestToken()},Ia)}clear(){this.timer&&clearInterval(this.timer)}};_(ki,"logName","StsManager");let As=ki;var m0=Object.defineProperty,g0=Object.getOwnPropertyDescriptor,b0=(s,c,e,t)=>{for(var i=t>1?void 0:t?g0(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&&m0(c,e,i),i};class Es extends xe{constructor(e,t,i,r=Dt.prod){super();_(this,"signaling");_(this,"authInfo");_(this,"userName");_(this,"channelProfile");_(this,"clientRole");_(this,"env",Dt.prod);_(this,"maxConnectRetryCount");_(this,"stsManager");_(this,"slsReporter");this.channelProfile=e,this.clientRole=t,this.env=r,this.slsReporter=i,this.stsManager=new As(i,r)}reset(){var e;ae.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,a)=>{this.signaling?a(new Y(te.ERR_JOIN_ALREADY_JOINED,"already joined")):(ae.info("[signalingmanager] create signaling"),this.signaling=new d0(this.channelProfile,this.clientRole,this.slsReporter,this.env),this.initSignaling(),r&&(r.rs=Date.now()),this.signaling.join(e,t,i).then(o=>{this.authInfo=e,r&&(r.re=Date.now()),n(o)}).catch(o=>{this.reset(),a(o)}),this.stsManager.startSTSUpdate(e))})}retryJoin(){const e=this.authInfo;this.reset(),e&&this.join(e,this.userName,this.maxConnectRetryCount)}leave(){return new Promise((e,t)=>{this.signaling?this.signaling.leave().then(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 Y(te.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 Y(-1,"no signaling"))})}setClientRole(e){return O(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 Y(te.ERR_SDK_INVALID_STATE,"should join first"))}refreshAuthInfo(e){return O(this,null,function*(){var t;try{this.authInfo&&(this.authInfo=ve(ve({},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,a,o,u,h,g,f,l,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)),(a=this.signaling)==null||a.on("onBye",this.onBye.bind(this)),(o=this.signaling)==null||o.on("onReconnectStart",this.onReconnectStart.bind(this)),(u=this.signaling)==null||u.on("onReconnectSuccess",this.onReconnectSuccess.bind(this)),(h=this.signaling)==null||h.on("onReconnectFail",this.onReconnectFail.bind(this)),(g=this.signaling)==null||g.on("onConnectFail",this.onConnectFail.bind(this)),(f=this.signaling)==null||f.on("onNetworkError",this.onNetworkError.bind(this)),(l=this.signaling)==null||l.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)}}_(Es,"logName","SignalingManager"),b0([z(ne)],Es.prototype,"publish",1);const ii=class ii{static getInstance(){return ii.instance||(ii.instance=new AudioContext),ii.instance.resume(),ii.instance}};_(ii,"instance");let ui=ii;function v0(s,c,e,t,i){let r=t,n=0,a;const o=s.createAnalyser();o.fftSize=256;const u=new Uint8Array(o.frequencyBinCount);c.connect(o),o.connect(e);const h=()=>{a&&window.clearInterval(a)},g=()=>{a=window.setInterval(()=>{o.getByteFrequencyData(u);let f=Math.round(u.reduce((l,p)=>l+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(),o.disconnect()}}}class x0 extends xe{constructor(){super();_(this,"audioContext");_(this,"stream");_(this,"sourceNode");_(this,"analyser");this.audioContext=ui.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=v0(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 Ra extends xe{constructor(e,t,i,r){super();_(this,"uid");_(this,"name");_(this,"rtsManager");_(this,"callId","");_(this,"audioLevelMonitor");_(this,"audioVolumeIndicationInterval",0);this.uid=e,this.name=t,this.rtsManager=i,this.audioVolumeIndicationInterval=r,this.audioLevelMonitor=new x0}get userId(){return this.uid}get displayname(){return this.name}createCallId(){this.callId||(this.callId=St.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 Da{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 Ta="customVideoProfile",ka="customScreenProfile",wi={width:1280,height:720,frameRate:30,maxBitrate:2e3},Ci={width:1920,height:1080,frameRate:30,maxBitrate:2600},S0={1e4:He.AliEngineLocalDeviceExceptionTypeUnknown,2e4:He.AliEngineLocalDeviceExceptionTypeUnknown,10001:He.AliEngineLocalDeviceExceptionTypeMicNotAvailable,10002:He.AliEngineLocalDeviceExceptionTypeMicAuthFail,10003:He.AliEngineLocalDeviceExceptionTypeMicOpenFail,10005:He.AliEngineLocalDeviceExceptionTypeCameraAuthFail,10004:He.AliEngineLocalDeviceExceptionTypeVideoDeviceException,10006:He.AliEngineLocalDeviceExceptionTypeCameraOpenFail,10010:He.AliEngineLocalDeviceExceptionTypeDisplayException,10011:He.AliEngineLocalDeviceExceptionTypeDisplayException,10012:He.AliEngineLocalDeviceExceptionTypeDisplayException,10013:He.AliEngineLocalDeviceExceptionTypeDisplayException,10014:He.AliEngineLocalDeviceExceptionTypeDisplayException,10019:He.AliEngineLocalDeviceExceptionTypeDisplayException},_0=s=>s.getAudioTracks()[0];function Pa(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 Y(te.ERR_INVALID_ARGUMENTS,"element should be HtmlVideoElement")}else throw new Y(te.ERR_INVALID_ARGUMENTS,"element not founded")}else throw new Y(te.ERR_INVALID_ARGUMENTS,"element id should be string")}function ws(s){var e;const c=[];if(Array.isArray(s))s.forEach(t=>{try{c.push(Pa(t))}catch(i){}});else if(typeof s=="string"||((e=s==null?void 0:s.nodeName)==null?void 0:e.toLowerCase())==="video")try{c.push(Pa(s))}catch(t){}return c}function Nt(s){return new Promise(c=>setTimeout(c,s))}function Ba(s,c,e=1e3,t=i=>!0){return O(this,null,function*(){let i=0,r;for(;i<c;)try{return yield s(i)}catch(n){if(i++,i>=c||!t(n))throw n||r;yield new Promise(a=>setTimeout(a,e))}})}function y0(s,c){let e=0;const t=[];for(;e<s.byteLength;){const i=Math.min(c,s.byteLength-e),r=s.slice(e,e+i);t.push(r),e+=i}return t}const La=(s,c,e=!1)=>{const t=()=>(s.muted=!0,Promise.race([Nt(500),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{let i;return e&&s.srcObject===c?i=Promise.resolve():(s.load(),s.srcObject=c,i=s.play(),s._playPromise=i),i}));return new Promise(i=>{if(pe.AliRTS.BrowserUtil.isMicroMessenger){const r=window.top!==window.self,n=window.WeixinJSBridge||window.top.WeixinJSBridge;n?n.invoke("getNetworkType",{},()=>{i(t())}):(r?window.top.document:document).addEventListener("WeixinJSBridgeReady",()=>{n.invoke("getNetworkType",{},()=>{i(t())})}),setTimeout(()=>{i(t())},1e3)}else setTimeout(()=>{i(t())},0)})},Ft=s=>{Promise.race([Nt(100),s._playPromise||Promise.resolve()]).catch(()=>{}).then(()=>{s.srcObject=null,s._playPromise=void 0})};var Cs=(s=>(s[s.AliEngineDataMsgNone=0]="AliEngineDataMsgNone",s[s.AliEngineDataMsgMusicProgress=1]="AliEngineDataMsgMusicProgress",s[s.AliEngineDataMsgCustom=2]="AliEngineDataMsgCustom",s))(Cs||{});class Ki{constructor(c,e,t,i=0){_(this,"msgType");_(this,"msgId");_(this,"protocolVersion");_(this,"tlvVersion");this.msgType=c,this.msgId=e,this.protocolVersion=t,this.tlvVersion=i}build(){const c=new Uint8Array(4);return c.set(Uint8Array.from([this.protocolVersion,this.tlvVersion<<4|this.msgType&15]),0),c.set(Uint16Array.from([this.msgId]),2),c}static parse(c){const e=new DataView(c),t=e.getUint8(0),i=e.getUint8(1)>>4,r=e.getUint8(1)&15,n=e.getUint16(2);return new Ki(r,n,t,i)}}const Qt=5;class $i{constructor(c,e,t){_(this,"_byteArray");if(this._byteArray=new Uint8Array(0),c!==void 0&&e!==void 0&&t!==void 0){const r=new Ki(c,e,t).build();this._byteArray=new Uint8Array(r.byteLength+this._byteArray.byteLength),this._byteArray.set(r,0)}}write(c,e){const t=this._byteArray,i=new ArrayBuffer(Qt),r=new DataView(i);r.setUint8(0,c),r.setUint32(1,e.byteLength);const n=new Uint8Array(t.byteLength+Qt+e.byteLength);n.set(t,0),n.set(new Uint8Array(i),t.byteLength),n.set(new Uint8Array(e),t.byteLength+Qt),this._byteArray=n}static parse(c){const e={},t=new DataView(c);let i=0;for(;i<c.byteLength;){const r=t.getUint8(i),n=t.getUint32(i+1);if(i+Qt+n<=c.byteLength){const a=c.slice(i+Qt,i+Qt+n);e[r]=a,i+=Qt+n}else break}return e}get buffer(){return this._byteArray.buffer}}class Ii{constructor(c=0,e=!0,t=1,i=!1,r=0,n=!1,a=!1,o=3){_(this,"_fin",!0);_(this,"_hasExtension",!1);_(this,"_version",0);_(this,"_frameType",1);_(this,"_isEncrypted",!1);_(this,"_isCompressed",!1);_(this,"_signalType",3);_(this,"_payloadLength",0);this._fin=e,this._hasExtension=i,this._version=r,this._frameType=t,this._isEncrypted=n,this._isCompressed=a,this._signalType=o,this._payloadLength=c}get fin(){return this._fin}get hasExtension(){return this._hasExtension}get version(){return this._version}get frameType(){return this._frameType}get isEncrypted(){return this._isEncrypted}get isCompressed(){return this._isCompressed}get signalType(){return this._signalType}get payloadLength(){return this._payloadLength}toBuffer(){const c=new ArrayBuffer(4),e=new DataView(c);return e.setUint8(0,(this._fin?1:0)<<7|(this._hasExtension?1:0)<<6|this._version<<4|this._frameType&15),e.setUint8(1,(this._isEncrypted?1:0)<<7|(this._isCompressed?1:0)<<6|this._signalType&15),e.setUint16(2,this._payloadLength),c}static parse(c){const e=new DataView(c),t=e.getUint8(0)>>7===1,i=(e.getUint8(0)&64)>>6===1,r=(e.getUint8(0)&48)>>4,n=e.getUint8(0)&15,a=e.getUint8(1)>>7===1,o=(e.getUint8(1)&64)>>6===1,u=e.getUint8(1)&15,h=e.getUint16(2);return new Ii(h,t,n,i,r,a,o,u)}}class qi{constructor(c,e){_(this,"_body");_(this,"_header",new Ii);this._header=c,this._body=e}get header(){return this._header}get isFin(){return this._header.fin}get body(){return this._body}toGRTNBuffer(){const c=this._header.toBuffer(),e=this._body,t=new ArrayBuffer(4);new DataView(t).setUint8(0,1*Math.pow(2,4));const i=new Uint8Array(t.byteLength+c.byteLength+e.byteLength);return i.set(new Uint8Array(t),0),i.set(new Uint8Array(c),t.byteLength),i.set(new Uint8Array(e),t.byteLength+c.byteLength),i.buffer}static parse(c){const e=c.slice(0,4),t=Ii.parse(e);let i=new ArrayBuffer(0);return c.byteLength-4>=t.payloadLength&&(i=c.slice(4,4+t.payloadLength)),new qi(t,i)}}const Is=s=>{const c=s.byteLength,e=new DataView(s);let t=0;for(let i=0;i<c;i++)t=t*256+e.getUint8(i);return t};let Ma=0;class ei{constructor(c,e=0,t=0,i=0){_(this,"data");_(this,"networkTime");_(this,"futureOrProgress");_(this,"type");this.data=c,this.type=e,this.networkTime=t,this.futureOrProgress=i}toBuffer(){const c=new $i(0,0,0);c.write(1,Uint8Array.from([0]).buffer),c.write(2,Uint16Array.from([0]).buffer),Ma++,c.write(3,Uint32Array.from([Ma]).buffer);const e=new $i;return e.write(1,Uint8Array.from([0]).buffer),e.write(2,Uint8Array.from([this.type]).buffer),e.write(3,Uint32Array.from([this.futureOrProgress]).buffer),e.write(4,Uint32Array.from([Number(this.networkTime>>32&4294967295),Number(this.networkTime&4294967295)]).buffer),e.write(5,this.data),c.write(30,e.buffer),c.buffer}static parse(c){if(!c||c.byteLength<4)return;Ki.parse(c.slice(0,4));const t=$i.parse(c.slice(4))[30];if(!t)return;const i=$i.parse(t),r=i[2],n=i[3],a=i[4],o=i[5];if(o.byteLength!==0)return new ei(o,Is(r),Is(a),Is(n))}}var A0=Object.defineProperty,E0=Object.getOwnPropertyDescriptor,Ve=(s,c,e,t)=>{for(var i=t>1?void 0:t?E0(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&&A0(c,e,i),i};const Na=30;class Ri extends xe{constructor(){super();_(this,"state");_(this,"time");this.state=be.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 Oe=(Ut=class extends Ra{constructor(e){const{rtsManager:t,localStreamManager:i,slsReporter:r,signalingManager:n,audioVolumeIndicationInterval:a,parameter:o}=e;super("","",t,a);_(this,"url","");_(this,"joinTime",0);_(this,"_isPublishing",!1);_(this,"publishPromise",Promise.resolve({traceId:"",l1ip:void 0}));_(this,"previewElements",[]);_(this,"screenPreviewElements",[]);_(this,"streamManager");_(this,"dc");_(this,"streamTracks");_(this,"publishId",Kt());_(this,"signalingManager");_(this,"traceId","");_(this,"monitorTimerId");_(this,"monitorDataCache",{});_(this,"trackTraceIdMap",{});_(this,"candidateDataCache",[]);_(this,"pcMediaStatsMap",{});_(this,"slsReporter");_(this,"audioPubState");_(this,"videoPubState");_(this,"videoSmallPubState");_(this,"screenPubState");_(this,"dataPubState");_(this,"parameter",{});_(this,"onTrackEnd",e=>{this.emit(e)});this.streamManager=i,this.signalingManager=n,this.slsReporter=r,this.parameter=o,this.streamManager.on("trackended",u=>{this.onTrackEnd(u)}),this.streamManager.on("publishupdate",()=>{this.publishUpdate()}),this.audioPubState=new Ri,this.audioPubState.on("change",(u,h,g)=>{this.emit("audioPublishStateChanged",u,h,g)}),this.videoPubState=new Ri,this.videoPubState.on("change",(u,h,g)=>{this.emit("videoPublishStateChanged",u,h,g)}),this.videoSmallPubState=new Ri,this.videoSmallPubState.on("change",(u,h,g)=>{this.emit("dualStreamPublishStateChanged",u,h,g)}),this.screenPubState=new Ri,this.screenPubState.on("change",(u,h,g)=>{this.emit("screenPublishStateChanged",u,h,g)}),this.dataPubState=new Ri,this.dataPubState.on("change",(u,h,g)=>{this.emit("dataPublishStateChanged",u,h,g)}),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===G.VideoLarge))}get hasCameraDualTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="video"&&t&&r===G.VideoSmall))}get hasScreenTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="video"&&t&&r===G.Screen))}get hasAudioTrackInMS(){var e;return!!((e=this.streamTracks)!=null&&e.find(({ssrc:t,type:i,msid:r})=>i==="audio"&&t&&r===G.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||St.createCallid(),this.updatePubId()}setVideoProfile(e,t){return O(this,null,function*(){yield this.streamManager.setVideoProfile(e,t)})}setVideoContentHint(e){this.streamManager.setVideoContentHint(e)}setScreenContentHint(e){this.streamManager.setScreenContentHint(e)}setAudioProfile(e){return O(this,null,function*(){yield this.streamManager.setAudioProfile(e)})}setScreenProfile(e,t){return O(this,null,function*(){yield this.streamManager.setScreenProfile(e,t)})}setCameraDirection(e){if(e===Ei.CAMERA_FRONT)this.streamManager.setCameraVideoConstraints({facingMode:"user"});else if(e===Ei.CAMERA_REAR)this.streamManager.setCameraVideoConstraints({facingMode:"environment"});else throw new Y(te.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=Kt()}clearPublishState(){this.streamTracks=void 0}leave(){return O(this,null,function*(){this._isPublishing&&(this._isPublishing=!1,yield this.unPublish())})}clear(){return O(this,null,function*(){Fs(Ut.prototype,this,"clear").call(this),this.stopPreview(),this.resetPreviewElements(),this.resetSecondayPreviewElements(),this.clearStream(),yield this.leave(),this.streamManager.cameraCaptureDisabled=!1})}resetElement(e){this.previewElements.includes(e)&&(Ft(e),this.previewElements.splice(this.previewElements.indexOf(e),1)),this.screenPreviewElements.includes(e)&&(Ft(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)}startDefaultCamera(e){return O(this,null,function*(){const{hasCamera:t,cameraCaptureDisabled:i,publishLocalVideoStreamEnabled:r}=this;let n=[];if(!t&&!e&&!i&&r){try{n=yield pe.AliRTS.getCameraList(),n.length&&(yield this.startCameraCapture())}catch(a){throw a.code===pe.AliRTS.ErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED?new Y(te.ERR_CAMERA_AUTH_FAIL,"camera auth fail"):new Y(te.ERR_CAMERA_OPEN_FAIL,`camera open fail: ${a.message}`)}if(!n.length)throw new Y(te.ERR_CAMERA_NOT_AVAILABLE,"No camera device can be captured")}})}startDefaultAudio(){return O(this,null,function*(){const{hasMicrophone:e,audioCaptureDisabled:t,publishLocalAudioStreamEnabled:i}=this;let r=[];if(!e&&!t&&i){try{r=yield pe.AliRTS.getMicList(),r.length&&(yield this.startAudioCapture())}catch(n){throw n.code===pe.AliRTS.ErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED?new Y(te.ERR_MIC_AUTH_FAIL,"microphone auth fail"):new Y(te.ERR_MIC_OPEN_FAIL,`microphone open fail: ${n.message}`)}if(!r.length)throw new Y(te.ERR_MIC_NOT_AVAILABLE,"No microphone device can be captured")}})}setViewConfig(e,t){if(!e){t===Ae.AliRtcVideoTrackCamera?this.stopPreview({primary:!0,screen:!1}):this.stopPreview({primary:!1,screen:!0});return}if(![Ae.AliRtcVideoTrackCamera,Ae.AliRtcVideoTrackScreen].includes(t))throw new Y(te.ERR_INVALID_ARGUMENTS,"set view config invalid track",{track:t});e.forEach(i=>{this.setPreviewElement({videoElement:i,screen:t===Ae.AliRtcVideoTrackScreen})})}startCameraCapture(){return O(this,null,function*(){return this.streamManager.cameraCaptureDisabled=!1,yield this.createLocalStream({video:!0})})}stopCameraCapture(){return O(this,null,function*(){this.streamManager.cameraCaptureDisabled=!0,yield this.stopLocalStream({video:!0})})}startAudioCapture(){return O(this,null,function*(){return this.streamManager.audioCaptureDisabled=!1,yield this.createLocalStream({audio:!0})})}stopAudioCapture(){return O(this,null,function*(){this.streamManager.audioCaptureDisabled=!0,yield this.stopLocalStream({audio:!0})})}preview(e){return O(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 Y(te.ERR_INVALID_ARGUMENTS,"no video element found",{videoElement:t});if(!r){ae.info(`[${Ut.logName}]`,"preview no stream founded");return}return La(t,r.mediaStream),this.setPreviewElement(e),r.mediaStream}catch(r){const n=te.ERR_INNER;throw Y.fromError(r,n,"preview failed")}})}previewAll(e){return O(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=>{Ft(n)}),this.previewElements=[]),r&&(this.screenPreviewElements.forEach(n=>{Ft(n)}),this.screenPreviewElements=[]);else{const n=this.previewElements.findIndex(a=>a===t);if(n>=0)this.previewElements.splice(n,1),Ft(t);else{const a=this.screenPreviewElements.findIndex(o=>o===t);a>=0&&(this.screenPreviewElements.splice(a,1),Ft(t))}}}resumePublish(){return O(this,null,function*(){this._isPublishing=!1,yield this.startPublish(!0)})}createLocalStream(e){return O(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=S0[t.errorCode];throw i&&(e.audio?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeMic,i,""):e.video?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeCamera,i,""):e.screen?this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeDisplay,i,""):this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeUnknown,i,"")),t}})}stopLocalStream(e){return O(this,null,function*(){e.audio&&this.audioLevelMonitor.stop(),yield this.streamManager.stopLocalStream(e)})}compareAndPublish(e,t,i){return O(this,null,function*(){var n,a;if(!e&&!t)return;if(e&&!t){const o={};return i===G.Audio?o.audio=!0:i===G.VideoLarge||i===G.VideoSmall?(o.video=!0,o.vMsid=i):i===G.Screen&&(o.screen=!0),yield this.publishDeleteTracks(o)}const r={};if(t!=null&&t.hasVideo&&(r.isScreen=i===G.Screen,r.vMsid=i),t!=null&&t.hasAudio&&(r.aMsid=i),!e&&t)return yield this.publishAdd(t,r,!1);if(e&&t){const o=e.trackId,u=((n=t.videoTrack)==null?void 0:n.id)||((a=t.audioTrack)==null?void 0:a.id);if(o!==u)return yield this.publishReplace(t,r)}})}reportAudioProfile(){const e=this.streamManager.cameraStreamInfo.audioProfile||"standard",t=pe.AliRTS.AudioProfileMap.get(e);this.slsReporter.reportPublishProfile(G.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=pe.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(G.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=pe.AliRTS.VideoProfileMap.get(e);t&&this.slsReporter.reportPublishProfile(G.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 O(this,arguments,function*(e=!1,t=Bt.MANUAL){var u;if(!this.joined)return;this.createCallId();const i=yield this.streamManager.publishStreams,{audio:r,video:n,videoSmall:a,screen:o}=i;try{const h=new Date().getTime();r&&this.audioPubState.setState(be.AliRtcStatePublishing),n&&this.videoPubState.setState(be.AliRtcStatePublishing),a&&this.videoSmallPubState.setState(be.AliRtcStatePublishing),o&&this.screenPubState.setState(be.AliRtcStatePublishing),this.publishPromise=this.rtsManager.publish(this.url,this.callId,e,t);const{traceId:g,l1ip:f}=yield this.publishPromise;if(this._isPublishing=!0,this.streamTracks=this.rtsManager.publishingTracks,this.traceId=g,(u=this.parameter.data)!=null&&u.enablePubDataChannel){this.dataPubState.setState(be.AliRtcStatePublishing);const p=yield this.rtsManager.publishAddDataChannel(this.url);p?(this.dc=p,this.dc.datachannel&&(this.dc.datachannel.binaryType="arraybuffer"),this.dataPubState.setState(be.AliRtcStatePublished)):this.emit("publishDataError",new Y(te.ERR_INNER,"publishDataError"))}r&&(this.trackTraceIdMap[G.Audio]=g,this.reportAudioProfile()),a&&(this.trackTraceIdMap[G.VideoSmall]=g),n&&(this.trackTraceIdMap[G.VideoLarge]=g,this.reportVideoProfile()),o&&(this.trackTraceIdMap[G.Screen]=g,this.reportScreenProfile());const l={type:Wt.Add,userid:this.userId,sessionid:"",displayname:this.name,pubid:this.publishId,resume:e,subscribe:{signal:"",pullstreamurl:this.url},l1ip:this.parameter.reportL1IP?f:void 0,callid:this.callId,tracks:this.streamTracks,traceid:g};yield this.syncPublishToRoomServer(l,i,h),r&&this.audioPubState.setState(be.AliRtcStatePublished),n&&this.videoPubState.setState(be.AliRtcStatePublished),a&&this.videoSmallPubState.setState(be.AliRtcStatePublished),o&&this.screenPubState.setState(be.AliRtcStatePublished)}catch(h){throw r&&this.audioPubState.setState(be.AliRtcStateNoPublish),n&&this.videoPubState.setState(be.AliRtcStateNoPublish),a&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),o&&this.screenPubState.setState(be.AliRtcStateNoPublish),h}})}updateStreams(){return O(this,null,function*(){yield this.streamManager.updateStreams()})}publishUpdate(){return O(this,null,function*(){var r,n,a,o;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:v,type:b,msid:x})=>b==="audio"&&v&&x===G.Audio),h=yield this.compareAndPublish(u,e.audio,G.Audio);h&&(t=h);const g=(n=this.streamTracks)==null?void 0:n.find(({ssrc:v,type:b,msid:x})=>b==="video"&&v&&x===G.VideoLarge),f=yield this.compareAndPublish(g,e.video,G.VideoLarge);f&&(t=f);const l=(a=this.streamTracks)==null?void 0:a.find(({ssrc:v,type:b,msid:x})=>b==="video"&&v&&x===G.VideoSmall),p=yield this.compareAndPublish(l,e.videoSmall,G.VideoSmall);p&&(t=p);const d=(o=this.streamTracks)==null?void 0:o.find(({ssrc:v,type:b,msid:x})=>b==="video"&&v&&x===G.Screen),m=yield this.compareAndPublish(d,e.screen,G.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 O(this,null,function*(){var o;if(!e)throw new Y(te.ERR_INNER,"sync publish to room server failed because no publishInfo");let r=e;if(this.dc){const a=e,{tracks:u}=a,h=pi(a,["tracks"]);r=Rt(ve({},h),{tracks:[...u,{type:"data",msid:G.Data,ssrc:`${((o=this.callId)==null?void 0:o.length)>8?this.callId.substring(0,8):"web"}${this.dc.datachannel.id||"0"}`,codec:"text"}]})}const n=yield this.signalingManager.publish(r);e.signaltid=n.tid})}refreshPushStreamUrl(){return O(this,null,function*(){const e=new Y(te.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 O(this,null,function*(){this.createCallId();const n=(t==null?void 0:t.aMsid)===G.Audio,a=(t==null?void 0:t.vMsid)===G.VideoLarge,o=(t==null?void 0:t.vMsid)===G.VideoSmall,u=(t==null?void 0:t.vMsid)===G.Screen;n&&this.audioPubState.setState(be.AliRtcStatePublishing),a&&this.videoPubState.setState(be.AliRtcStatePublishing),o&&this.videoSmallPubState.setState(be.AliRtcStatePublishing),u&&this.screenPubState.setState(be.AliRtcStatePublishing);try{const h=yield this.rtsManager.publishAdd(this.url,e,this.callId,t,!1,!0);n&&(this.audioPubState.setState(be.AliRtcStatePublished),this.reportAudioProfile(),this.trackTraceIdMap[G.Audio]=h),a&&(this.videoPubState.setState(be.AliRtcStatePublished),this.reportVideoProfile(),this.trackTraceIdMap[G.VideoLarge]=h),o&&(this.videoSmallPubState.setState(be.AliRtcStatePublished),this.trackTraceIdMap[G.VideoSmall]=h),u&&(this.screenPubState.setState(be.AliRtcStatePublished),this.reportScreenProfile(),this.trackTraceIdMap[G.Screen]=h),this.streamTracks=this.rtsManager.publishingTracks;const g={type:Wt.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=te.ERR_SDK_PUBLISH_INVAILD;if(n&&(this.audioPubState.setState(be.AliRtcStateNoPublish),g=te.ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED),a&&(this.videoPubState.setState(be.AliRtcStateNoPublish),g=te.ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED),o&&(this.videoSmallPubState.setState(be.AliRtcStateNoPublish),g=te.ERR_SDK_PUBLISH_DUAL_STREAM_FAILED),u&&(this.screenPubState.setState(be.AliRtcStateNoPublish),g=te.ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED),h.errorCode===15006&&r<3)return this.publishAdd(e,t,i,r+1);throw Y.fromError(h,g,"publish add failed")}})}publishReplace(e,t){return O(this,null,function*(){try{yield this.rtsManager.publishReplace(this.url,e,t),this.streamTracks=this.rtsManager.publishingTracks;const i={type:Wt.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 Y.fromError(i,te.ERR_INNER,`publish replace failed, vMsid: ${t==null?void 0:t.vMsid} aMsid: ${t==null?void 0:t.aMsid}`)}})}publishDeleteTracks(e){return O(this,null,function*(){const t={type:Wt.Delete,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};try{return yield this.rtsManager.publishDelete(this.url,e),this.streamTracks=this.rtsManager.publishingTracks,e.audio&&this.audioPubState.setState(be.AliRtcStateNoPublish),e.video&&(e.vMsid===G.VideoSmall?this.videoSmallPubState.setState(be.AliRtcStateNoPublish):this.videoPubState.setState(be.AliRtcStateNoPublish)),e.screen&&this.screenPubState.setState(be.AliRtcStateNoPublish),t.tracks=this.streamTracks,this.reportSelfDeviceStatus(),t}catch(i){throw Y.fromError(i,te.ERR_INNER,"publish delete tracks failed")}})}publishStop(){return O(this,null,function*(){if(!this._isPublishing)throw new Y(te.ERR_INNER,"publish stop failed, previous localStream is required for publishing stopping");ae.info(`[${Ut.logName}]`,"publishStop",{url:this.url});const e=new Date().getTime();try{const t=this.hasAudioTrackInMS,i=this.hasCameraTrackInMS,r=this.hasCameraDualTrackInMS,n=this.hasScreenTrackInMS;yield this.rtsManager.publishStop(this.url),t&&this.audioPubState.setState(be.AliRtcStateNoPublish),i&&this.videoPubState.setState(be.AliRtcStateNoPublish),r&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),n&&this.screenPubState.setState(be.AliRtcStateNoPublish),this.traceId="",Object.keys(this.monitorDataCache).forEach(o=>{this.reportPublishMonitor(o)}),this.streamTracks=[];const a={type:Wt.Stop,userid:this.userId,sessionid:"",displayname:this.displayname,callid:this.callId,pubid:this.publishId,subscribe:{signal:"",pullstreamurl:this.url},tracks:[]};return this.syncPublishToRoomServer(a,{},e),a}catch(t){throw Y.fromError(t,te.ERR_INNER,"publish stop failed")}})}unPublish(){return O(this,null,function*(){const e=new Date().getTime();let t={type:Wt.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 i=this.hasAudioTrackInMS,r=this.hasCameraTrackInMS,n=this.hasCameraDualTrackInMS,a=this.hasScreenTrackInMS;yield this.rtsManager.unpublish(),this.streamTracks=[],this.stopStreamMonitor(),i&&this.audioPubState.setState(be.AliRtcStateNoPublish),r&&this.videoPubState.setState(be.AliRtcStateNoPublish),n&&this.videoSmallPubState.setState(be.AliRtcStateNoPublish),a&&this.screenPubState.setState(be.AliRtcStateNoPublish),this._isPublishing=!1,this.traceId="",this.clearStream()}return this.dc&&(this.rtsManager.publishStopDataChannel(this.url,this.dc),this.dataPubState.setState(be.AliRtcStateNoPublish),this.dc=void 0),this.slsReporter.reportUnpublish(this.callId||"",e,0,""),t}catch(i){throw Y.fromError(i,te.ERR_INNER,"unpublish failed")}})}reportSelfDeviceStatus(){this.emit(rt.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),Da.getCurrentStatus(e)}resetPreviewElements(){this.previewElements.forEach(e=>{e.srcObject=null,e._playPromise=void 0},[]),this.previewElements=[]}resetSecondayPreviewElements(){this.screenPreviewElements.forEach(e=>{e.srcObject=null,e._playPromise=void 0},[]),this.screenPreviewElements=[]}getMediaStats(e){return this.pcMediaStatsMap[e]}reportPublishMonitor(e){if(!e)return;let t;try{e===G.Audio?t=this.rtsManager.getStreamByMsid({url:this.url,aMsid:e}).audioTrack:t=this.rtsManager.getStreamByMsid({url:this.url,vMsid:e}).videoTrack}catch(i){}this.slsReporter.reportPublishMonitor(this.callId,this.trackTraceIdMap[e]||"",e,t,this.monitorDataCache[e]),this.monitorDataCache[e]=[]}reportNetwork(){this.slsReporter.reportNetworkMonitor(this.candidateDataCache),this.candidateDataCache=[]}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>O(this,null,function*(){var e,i;try{const r=yield this.rtsManager.getPCStats();let n;r==null||r.forEach(u=>{u.type==="media-source"||u.type==="media-playout"?u.id&&(this.pcMediaStatsMap[u.id]=u):u.type==="candidate-pair"&&u.state==="succeeded"&&(n=u)});let a;if(((e=this.candidateDataCache)==null?void 0:e.length)>0){const t=this.candidateDataCache[this.candidateDataCache.length-1]||{},{_last:h}=t;a=pi(t,["_last"])}((i=this.candidateDataCache)==null?void 0:i.length)>=Na&&this.reportNetwork(),n&&(n._last=a,this.candidateDataCache.push(n));let o=Object.keys(this.monitorDataCache).filter(u=>{var h;return((h=this.monitorDataCache[u])==null?void 0:h.length)>0});(this.streamTracks||[]).forEach(u=>{const h=u.msid;if(!h)return;o.includes(h)&&(o=o.filter(l=>l!==h));let g;h===G.Audio?g=this.rtsManager.getPublishAudioStats(this.url):g=this.rtsManager.getPublishVideoStats(this.url,h),g.then(l=>{if(!l.timestamp)return;this.monitorDataCache[h]||(this.monitorDataCache[h]=[]);const p=this.getMediaStats(l.mediaSourceId);l._source=p;const d=this.monitorDataCache[h];let m;if((d==null?void 0:d.length)>0){const v=d[d.length-1]||{},{_last:x}=v;m=pi(v,["_last"])}(d==null?void 0:d.length)>=Na&&this.reportPublishMonitor(h),l._last=m,l._codec=u.codec||"",this.monitorDataCache[h].push(l)})}),o.forEach(u=>{this.reportPublishMonitor(u)})}catch(r){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0),Object.keys(this.monitorDataCache).forEach(e=>{this.reportPublishMonitor(e)})}clearStream(){this.streamManager.stop(),this.audioPubState.setState(be.AliRtcStatePublishIdle),this.videoPubState.setState(be.AliRtcStatePublishIdle),this.videoSmallPubState.setState(be.AliRtcStatePublishIdle),this.screenPubState.setState(be.AliRtcStatePublishIdle)}getCurrentCameraDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originVideoTrack)==null?void 0:e.getSettings().deviceId}getCurrentMicDeviceId(){var e;return(e=this.streamManager.cameraStreamInfo.originAudioTrack)==null?void 0:e.getSettings().deviceId}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.streamManager.cameraStreamInfo.originAudioTrack&&this.audioLevelMonitor.start(this.streamManager.cameraStreamInfo.originAudioTrack,e),this.audioVolumeIndicationInterval=e)}sendSEI(e,t,i){return O(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)})}sendDataChannelMessage(e){return O(this,null,function*(){var r;if(!((r=this.parameter.data)!=null&&r.enablePubDataChannel))throw new Y(te.ERR_INNER,"data channel publish is not enabled");if(!this.dc)throw new Y(te.ERR_INNER,"data channel is not ready");const t=e.toBuffer(),i=y0(t,1156);i.forEach((n,a)=>{const o=new qi(new Ii(n.byteLength,a===i.length-1,a===0?1:0),n);this.dc.send(o.toGRTNBuffer())})})}getStats(){return O(this,null,function*(){const e=[];if(this.hasAudioTrackInMS){const n=yield this.rtsManager.getPublishAudioStats(this.url);n&&e.push({stats:n,track:ci.AliRtcAudioTrackMic})}const t=[];if(this.hasCameraTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,G.VideoLarge);n&&t.push({track:Ae.AliRtcVideoTrackCamera,streamType:Ge.AliRtcVideoStreamTypeHigh,stats:n})}if(this.hasCameraDualTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,G.VideoSmall);n&&t.push({track:Ae.AliRtcVideoTrackCamera,streamType:Ge.AliRtcVideoStreamTypeLow,stats:n})}if(this.hasScreenTrackInMS){const n=yield this.rtsManager.getPublishVideoStats(this.url,G.Screen);n&&t.push({track:Ae.AliRtcVideoTrackScreen,stats:n})}let i;const r=yield this.rtsManager.getPCStats();return r==null||r.forEach(n=>{n.type==="candidate-pair"&&n.state==="succeeded"&&(i=n)}),{audio:e,video:t,candidate:i}})}},_(Ut,"logName","LocalUser"),Ut);Ve([z()],Oe.prototype,"clearPublishState",1),Ve([z()],Oe.prototype,"clear",1),Ve([z(ne)],Oe.prototype,"startDefaultCamera",1),Ve([z(ne)],Oe.prototype,"startDefaultAudio",1),Ve([z()],Oe.prototype,"setViewConfig",1),Ve([z()],Oe.prototype,"startCameraCapture",1),Ve([z()],Oe.prototype,"stopCameraCapture",1),Ve([z()],Oe.prototype,"startAudioCapture",1),Ve([z()],Oe.prototype,"stopAudioCapture",1),Ve([z()],Oe.prototype,"stopPreview",1),Ve([z()],Oe.prototype,"resumePublish",1),Ve([z()],Oe.prototype,"createLocalStream",1),Ve([z()],Oe.prototype,"stopLocalStream",1),Ve([z(ne)],Oe.prototype,"startPublish",1),Ve([z(([s])=>[s])],Oe.prototype,"syncPublishToRoomServer",1),Ve([z()],Oe.prototype,"refreshPushStreamUrl",1),Ve([z(([s,c,e])=>[JSON.stringify(e)])],Oe.prototype,"publishAdd",1),Ve([z(([s,c])=>[JSON.stringify(c)])],Oe.prototype,"publishReplace",1),Ve([z(ne)],Oe.prototype,"publishDeleteTracks",1),Ve([z()],Oe.prototype,"publishStop",1),Ve([z()],Oe.prototype,"unPublish",1),Ve([z(([s,c,e])=>[s.length,c,e])],Oe.prototype,"sendSEI",1);let Fa=Oe;var Ot=(s=>(s.OPUS="opus",s.H264="H264",s.UNKNOWN="",s))(Ot||{}),Ee=(s=>(s[s.NotSubscribe=0]="NotSubscribe",s[s.Subscribing=1]="Subscribing",s[s.Subscribed=2]="Subscribed",s))(Ee||{}),ti=(s=>(s.VideoTrackEnded="videoTrackEnded",s.AudioTrackEnded="audioTrackEnded",s.ScreenTrackEnded="screenTrackEnded",s))(ti||{});const w0=s=>{const c=new MediaStream;return c.addTrack(s),c},Oa=s=>O(this,null,function*(){return yield pe.AliRTS.createStream({custom:!0,mediaStream:s})}),Di=s=>O(this,null,function*(){const c=w0(s);return yield Oa(c)}),C0=s=>{const{audio:c,video:e,screen:t}=s;if(e&&t)throw new Y(te.ERR_INNER,"create stream error, cannot create video && screen together");return!(!e&&!c&&!t)},I0=s=>s===G.Audio||s===fr.Audio,R0=s=>s===G.VideoLarge||s===fr.VideoLarge,D0=s=>s===G.VideoSmall,T0=s=>s===G.Screen,k0=s=>s===G.Data;var P0=Object.defineProperty,B0=Object.getOwnPropertyDescriptor,L0=(s,c,e,t)=>{for(var i=t>1?void 0:t?B0(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&&P0(c,e,i),i};class Gi extends xe{constructor(){super();_(this,"audioInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"videoLargeInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"videoSmallInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"screenInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"dataInfo",{subscribeState:Ee.NotSubscribe,ssrc:"",msid:"",pt:0,red:0,codec:Ot.UNKNOWN});_(this,"audioVolume",1);_(this,"audioMuted",!1);_(this,"userStatus")}getAudioInfo(){return this.audioInfo}getVideoSmallInfo(){return this.videoSmallInfo}getVideoLargeInfo(){return this.videoLargeInfo}getScreenInfo(){return this.screenInfo}getDataInfo(){return this.dataInfo}get subscribingInfos(){return[this.audioInfo,this.videoLargeInfo,this.videoSmallInfo,this.screenInfo].filter(e=>e.msid&&e.subscribeState===Ee.Subscribed)}get hasTrack(){return this.hasAudio||this.hasVideo||this.hasScreen||this.hasData}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 hasData(){return this.dataInfo.ssrc!==""}get isAudioSubscribed(){return this.audioInfo.subscribeState===Ee.Subscribed}get isAudioSubscribing(){return this.audioInfo.subscribeState===Ee.Subscribing}get isVideoSubscribed(){return this.isVideoLargeSubscribed||this.isVideoSmallSubscribed}get isVideoSubscribing(){return this.isVideoLargeSubscribing||this.isVideoSmallSubscribing}get isVideoLargeSubscribed(){return this.videoLargeInfo.subscribeState===Ee.Subscribed}get isVideoLargeSubscribing(){return this.videoLargeInfo.subscribeState===Ee.Subscribing}get isVideoSmallSubscribed(){return this.videoSmallInfo.subscribeState===Ee.Subscribed}get isVideoSmallSubscribing(){return this.videoSmallInfo.subscribeState===Ee.Subscribing}get isScreenSubscribed(){return this.screenInfo.subscribeState===Ee.Subscribed}get isScreenSubscribing(){return this.screenInfo.subscribeState===Ee.Subscribing}get isDataSubscribed(){return this.dataInfo.subscribeState===Ee.Subscribed}get isDataSubscribing(){return this.dataInfo.subscribeState===Ee.Subscribing}get audioCodec(){return this.audioInfo.codec}get videoCodec(){return this.hasVideoLarge?this.videoLargeInfo.codec:this.hasVideoSmall?this.videoSmallInfo.codec:this.hasScreen?this.screenInfo.codec:Ot.UNKNOWN}get audioTrackInfo(){return this.hasAudio?ci.AliRtcAudioTrackMic:ci.AliRtcAudioTrackNo}get videoTrackInfo(){return this.hasVideo&&this.hasScreen?Ae.AliRtcVideoTrackBoth:this.hasVideo?Ae.AliRtcVideoTrackCamera:this.hasScreen?Ae.AliRtcVideoTrackScreen:Ae.AliRtcVideoTrackNo}updateTracks(e){let t="",i="",r="",n="",a="";return e?(e.forEach(o=>{var g;let u=Ot.UNKNOWN;const h=((g=o==null?void 0:o.attr)==null?void 0:g.reason)==="reconnect";if(o.userdata){const{codec:f}=JSON.parse(o.userdata);f&&(u=f)}I0(o.msid)?(t=o.ssrc,this.audioInfo.msid=o.msid,this.audioInfo.codec=u,(h||this.audioInfo.ssrc!==t)&&(this.audioInfo.subscribeState=Ee.NotSubscribe)):D0(o.msid)?(r=o.ssrc,this.videoSmallInfo.msid=o.msid,this.videoSmallInfo.codec=u,(h||this.videoSmallInfo.ssrc!==r)&&(this.videoSmallInfo.subscribeState=Ee.NotSubscribe)):R0(o.msid)?(i=o.ssrc,this.videoLargeInfo.msid=o.msid,this.videoLargeInfo.codec=u,(h||this.videoLargeInfo.ssrc!==i)&&(this.videoLargeInfo.subscribeState=Ee.NotSubscribe)):T0(o.msid)?(n=o.ssrc,this.screenInfo.msid=o.msid,this.screenInfo.codec=u,(h||this.screenInfo.ssrc!==n)&&(this.screenInfo.subscribeState=Ee.NotSubscribe)):k0(o.msid)&&(a=o.ssrc,this.dataInfo.msid=o.msid,this.dataInfo.codec=u,(h||this.dataInfo.ssrc!==a)&&(this.dataInfo.subscribeState=Ee.NotSubscribe))}),this.updateRemoteTrackSsrc(t,i,r,n,a)):this.updateRemoteTrackSsrc(t,i,r,n,a),{}}updateRemoteTrackSsrc(e,t,i,r,n){this.audioInfo.ssrc=e,this.videoSmallInfo.ssrc=i,this.videoLargeInfo.ssrc=t,this.screenInfo.ssrc=r,this.dataInfo.ssrc=n}markRemoteTrackSubscribing(e){return e.video&&(e.vMsid===this.videoSmallInfo.msid&&(this.videoSmallInfo.subscribeState=Ee.Subscribing),(e.vMsid===this.videoLargeInfo.msid||!e.vMsid)&&(this.videoLargeInfo.subscribeState=Ee.Subscribing)),e.screen&&(this.screenInfo.subscribeState=Ee.Subscribing),e.audio&&(this.audioInfo.subscribeState=Ee.Subscribing),e.data&&(this.dataInfo.subscribeState=Ee.Subscribing),{videoLargeInfo:this.videoLargeInfo,videoSmallInfo:this.videoSmallInfo}}updateRemoteTrackSubState(e){return e.video!==void 0&&((e.vMsid===this.videoSmallInfo.msid||!e.vMsid)&&(this.videoSmallInfo.subscribeState=e.video?Ee.Subscribed:Ee.NotSubscribe),(e.vMsid===this.videoLargeInfo.msid||!e.vMsid)&&(this.videoLargeInfo.subscribeState=e.video?Ee.Subscribed:Ee.NotSubscribe)),e.screen!==void 0&&(this.screenInfo.subscribeState=e.screen?Ee.Subscribed:Ee.NotSubscribe),e.audio!==void 0&&(this.audioInfo.subscribeState=e.audio?Ee.Subscribed:Ee.NotSubscribe),e.data!==void 0&&(this.dataInfo.subscribeState=e.data?Ee.Subscribed:Ee.NotSubscribe),{audioInfo:this.audioInfo,videoLargeInfo:this.videoLargeInfo,videoSmallInfo:this.videoSmallInfo,screenInfo:this.screenInfo,dataInfo:this.dataInfo}}updateRemoteUserDeviceStatus(e){let t=Da.parseStatus(e);const{audioDisable:i,videoDisable:r,screenDisable:n}=t;return this.userStatus?(this.userStatus.audioDisable!=i&&(this.userStatus.audioDisable=i,this.emit(rt.Remote,i?Re.MuteAudio:Re.UnmuteAudio)),this.userStatus.videoDisable!=r&&(this.userStatus.videoDisable=r,this.emit(rt.Remote,r?Re.MuteVideo:Re.UnmuteVideo)),this.userStatus.screenDisable!=n&&(this.userStatus.screenDisable=n,this.emit(rt.Remote,n?Re.MuteScreen:Re.UnmuteScreen))):(this.userStatus=t,this.emit(rt.Remote,i?Re.MuteAudio:Re.UnmuteAudio),this.emit(rt.Remote,r?Re.MuteVideo:Re.UnmuteVideo),this.emit(rt.Remote,n?Re.MuteScreen:Re.UnmuteScreen)),!1}}_(Gi,"logName","RemoteStreamInfo"),L0([z()],Gi.prototype,"updateRemoteTrackSubState",1);class Va{constructor(c){_(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}get audioElement(){return this.remoteUser.getAudioElement()}}var M0=Object.defineProperty,N0=Object.getOwnPropertyDescriptor,Qe=(s,c,e,t)=>{for(var i=t>1?void 0:t?N0(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&&M0(c,e,i),i};class hi extends xe{constructor(){super();_(this,"state");_(this,"time");_(this,"_enabled");this.state=Pe.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 F0=30,Je=(kt=class extends Ra{constructor(e){var l;const{userId:t,displayName:i,rtsManager:r,usersViewMap:n,slsReporter:a,signalingManager:o,localUser:u,audioVolumeIndicationInterval:h,playoutVolume:g,parameter:f}=e;super(t,i,r,h);_(this,"remoteCallid","");_(this,"remoteUserInfo");_(this,"localUser");_(this,"lastPubId","");_(this,"stream");_(this,"screenStream");_(this,"viewMap");_(this,"audioTrack");_(this,"audioElement");_(this,"subscribed",!1);_(this,"mediaStream");_(this,"secondaryMediaStream");_(this,"prevSubConfig");_(this,"signalingManager");_(this,"slsReporter");_(this,"wantSubAudio",!1);_(this,"wantSubVideo",!1);_(this,"wantSubScreen",!1);_(this,"defaultVideoStreamType",Ge.AliRtcVideoStreamTypeHigh);_(this,"audioMuted",!1);_(this,"playoutVolume",1);_(this,"playoutGainNode");_(this,"audioSubState");_(this,"videoSubState");_(this,"videoLargeSubState",new hi);_(this,"videoSmallSubState",new hi);_(this,"screenSubState");_(this,"dataSubState");_(this,"dc");_(this,"dcMsgWaitingPieces",[]);_(this,"streamInfo");_(this,"streamUrl","");_(this,"parameter",{});_(this,"monitorTimerId");_(this,"monitorDataCache",{});_(this,"trackTraceIdMap",{});_(this,"handleAudioContextSuspended",e=>{e.target.state==="suspended"&&this.emit("remoteAudioPlayError",this.uid,"AudioContext suspended")});_(this,"onDataChannelMessage",e=>{var r;const t=qi.parse(e.slice(4));let i;if(t.body)if(t.isFin){if(this.dcMsgWaitingPieces.length>0){const n=this.dcMsgWaitingPieces.reduce((a,o)=>a+o.byteLength,t.body.byteLength);try{const a=new ArrayBuffer(n);let o=0;for(let h=0;h<this.dcMsgWaitingPieces.length;h++){const g=this.dcMsgWaitingPieces[h];new Uint8Array(a,o,g.byteLength).set(new Uint8Array(g)),o+=g.byteLength}new Uint8Array(a,o,t.body.byteLength).set(new Uint8Array(t.body)),i=ei.parse(a)}catch(a){}this.dcMsgWaitingPieces=[],i||(i=ei.parse(t.body))}else i=ei.parse(t.body);i||ae.event(`[${kt.logName}]`,`parse data channel message fail, piece count: ${this.dcMsgWaitingPieces.length+1}`)}else{t.header.frameType===1&&(this.dcMsgWaitingPieces=[]),this.dcMsgWaitingPieces.push(t.body);return}i&&(ae.event(`[${kt.logName}]`,`receive data channel message, length: ${(r=i.data)==null?void 0:r.byteLength}`),this.emit("remoteDataChannelMessage",this.uid,i))});_(this,"onDataChannelError",e=>{this.emit("occurError",Y.fromError(e,te.ERR_SDK_SUBSCRIBE_DATA_ERROR))});_(this,"handleAudioPaused",()=>{this.emit("remoteAudioPlayError","paused")});this.streamInfo=new Gi,this.remoteUserInfo=new Va(this),this.parameter=f,this.streamInfo.on(rt.Remote,p=>{this.emit(rt.Remote,p,this.userId)}),this.signalingManager=o,this.viewMap=(l=n[t])!=null?l:{cameraViews:[],screenViews:[]},n[t]=this.viewMap,this.slsReporter=a,this.localUser=u,this.audioSubState=new hi,this.audioSubState.on("change",(p,d,m)=>{this.emit("audioSubscribeStateChanged",this.uid,p,d,m)}),this.videoSubState=new hi,this.videoSubState.on("change",(p,d,m)=>{this.emit("videoSubscribeStateChanged",this.uid,p,d,m)}),this.screenSubState=new hi,this.screenSubState.on("change",(p,d,m)=>{this.emit("screenSubscribeStateChanged",this.uid,p,d,m)}),this.dataSubState=new hi,this.dataSubState.on("change",(p,d,m)=>{this.emit("dataSubscribeStateChanged",this.uid,p,d,m)}),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(Be.User))}setAudioMuted(e){this.audioMuted=e,this.toggleAudio(!e)}getAudioElement(){return this.audioElement}setPlayoutVolume(e){if(this.playoutVolume=e,this.audioElement)if(this.parameter.enableAudioContextPlayoutVolume)if(this.playoutGainNode)this.playoutGainNode.gain.value=e;else{const t=this.audioElement.srcObject;if(t){const i=ui.getInstance();i.addEventListener("statechange",this.handleAudioContextSuspended);const r=i.createMediaStreamSource(t);this.audioElement.muted=!0,this.playoutGainNode=i.createGain(),r.connect(this.playoutGainNode),this.playoutGainNode.gain.value=e,this.playoutGainNode.connect(i.destination)}}else 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,t;return!!((e=this.streamInfo)!=null&&e.isAudioSubscribed)||!!((t=this.streamInfo)!=null&&t.isAudioSubscribing)}get isVideoSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isVideoSubscribed)||!!((t=this.streamInfo)!=null&&t.isVideoSubscribing)}get isVideoLargeSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isVideoLargeSubscribed)||!!((t=this.streamInfo)!=null&&t.isVideoLargeSubscribing)}get isVideoSmallSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isVideoSmallSubscribed)||!!((t=this.streamInfo)!=null&&t.isVideoSmallSubscribing)}get isScreenSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isScreenSubscribed)||!!((t=this.streamInfo)!=null&&t.isScreenSubscribing)}get isDataSubscribing(){var e,t;return!!((e=this.streamInfo)!=null&&e.isDataSubscribed)||!!((t=this.streamInfo)!=null&&t.isDataSubscribing)}get audioEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.audioTrack)!=null&&t.enabled)}get videoEnabled(){var e,t;return!!((t=(e=this.stream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get screenEnabled(){var e,t;return!!((t=(e=this.screenStream)==null?void 0:e.videoTrack)!=null&&t.enabled)}get getAudioTrack(){return this.audioTrack}get getCameraStream(){return this.stream}get getScreenStream(){return this.screenStream}setViewConfig(e,t){if(t!==Ae.AliRtcVideoTrackScreen&&t!==Ae.AliRtcVideoTrackCamera)throw new Y(te.ERR_INVALID_ARGUMENTS,"track is not AliRtcVideoTrackScreen or AliRtcVideoTrackCamera");e?ws(e).forEach(r=>{r.setAttribute("playsinline",""),pe.AliRTS.BrowserUtil.isMicroMessenger&&(r.setAttribute("x5-video-player-type","h5-page"),r.setAttribute("x5-playsinline",""),pe.AliRTS.SystenUtil.isAndroid||pe.AliRTS.SystenUtil.isIos&&r.setAttribute("x-webkit-airplay","allow")),t===Ae.AliRtcVideoTrackScreen?this.viewMap.screenViews.push(r):this.viewMap.cameraViews.push(r),this.play(r,t===Ae.AliRtcVideoTrackScreen)}):(this.stopPlayAll(t===Ae.AliRtcVideoTrackScreen),t===Ae.AliRtcVideoTrackScreen?this.viewMap.screenViews=[]:this.viewMap.cameraViews=[])}clear(e=!0){return O(this,null,function*(){var t;this.subscribeStopDataChannel(),e&&this.doStopSubscribe(this.streamUrl),Fs(kt.prototype,this,"clear").call(this),this.clearStream(),this.clearScreenStream(),this.playoutGainNode&&(this.playoutGainNode.disconnect(),this.playoutGainNode=void 0,ui.getInstance().removeEventListener("statechange",this.handleAudioContextSuspended)),(t=this.streamInfo)==null||t.removeAllListeners(rt.Remote)})}updateRemoteUserDeviceStatus(e){var t;(t=this.streamInfo)==null||t.updateRemoteUserDeviceStatus(e)}updateRemoteTracks(e,t,i,r){return O(this,null,function*(){var a;return this.remoteCallid=e,(!this.streamUrl||!this.streamInfo.hasTrack)&&(this.streamUrl=t!=null?t:""),this.callId=e!=null?e:"",this.streamInfo||(this.streamInfo=new Gi),(a=this.streamInfo)==null?void 0:a.updateTracks(r)})}subscribe(r,n){return O(this,arguments,function*(e,t,i=Date.now()){var l,p;let a=e;if(!a){const{hasAudio:d,hasVideo:m,hasScreen:v,hasData:b}=(l=this.streamInfo)!=null?l:{};a={audio:this.wantSubAudio&&d,video:this.wantSubVideo&&m,screen:this.wantSubScreen&&v,data:((p=this.parameter.data)==null?void 0:p.enableSubDataChannel)&&b}}this.streamInfo.markRemoteTrackSubscribing(a);const{screen:o,audio:u,video:h,vMsid:g}=a,f=[];(h||u)&&f.push({audio:u,video:h,vMsid:g}),o&&f.push({screen:o}),!(f.length===0&&!(e!=null&&e.data))&&(yield Promise.all(f.map(d=>this.subscribeProxy(d,t||Be.User,i))),e!=null&&e.data&&this.subscribeDataChannel())})}subscribeProxy(e,t,i){return O(this,null,function*(){var a,o,u,h;let r=new Date().getTime(),n="";try{e.audio&&this.audioSubState.setState(Pe.AliRtcStateSubscribing),e.video&&(this.videoSubState.currentState===Pe.AliRtcStateSubscribeIdle||this.videoSubState.currentState===Pe.AliRtcStateNoSubscribe)&&this.videoSubState.setState(Pe.AliRtcStateSubscribing),e.screen&&this.screenSubState.setState(Pe.AliRtcStateSubscribing);const g=yield this.rtsManager.subscribe({remoteUser:this,options:e},t,((a=this.localUser)==null?void 0:a.callId)||"",this.callId,i);this.streamInfo.updateRemoteTrackSubState(e),n=g.traceId||"";const{stream:f}=g;if(e.audio){this.trackTraceIdMap[G.Audio]=n;const p=f.audioTrack;p&&(this.audioTrack=p,(o=f.mediaStream)==null||o.removeTrack(p),this.playAudio(),this.audioVolumeIndicationInterval&&this.audioLevelMonitor.start(p,this.audioVolumeIndicationInterval)),this.audioSubState.setState(Pe.AliRtcStateSubscribed),this.audioSubState.getEnabled()||this.toggleAudio(!1)}e.video&&(this.videoSubState.setState(Pe.AliRtcStateSubscribed),e.vMsid===G.VideoSmall?(this.trackTraceIdMap[G.VideoSmall]=n,this.videoSmallSubState.setState(Pe.AliRtcStateSubscribed)):(this.trackTraceIdMap[G.VideoLarge]=n,this.videoLargeSubState.setState(Pe.AliRtcStateSubscribed)),this.videoSubState.getEnabled()||this.toggleVideo(!1),this.updateStream(f,this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing)),e.screen&&(this.screenSubState.setState(Pe.AliRtcStateSubscribed),this.trackTraceIdMap[G.Screen]=n,this.videoSubState.getEnabled()||this.toggleScreen(!1),this.updateScreenStream(f));const l=new Date().getTime()-r;this.slsReporter.reportSubscribe(((u=this.localUser)==null?void 0:u.callId)||"",this.callId,!!e.video&&e.vMsid===G.VideoLarge,!!e.video&&e.vMsid===G.VideoSmall,!!e.screen,!!e.audio,0,"",l,{pctid:this.rtsManager.pcTraceId,subtid:n,ajsub:t===Be.Join?1:0,url:this.streamUrl,est:r}),this.startStreamMonitor()}catch(g){const f=new Date().getTime()-r;e.audio&&this.audioSubState.setState(Pe.AliRtcStateNoSubscribe),e.video&&this.videoSubState.setState(Pe.AliRtcStateNoSubscribe),e.screen&&this.screenSubState.setState(Pe.AliRtcStateNoSubscribe),g&&(g.message=`user(${this.uid}) subscribe error, ${(g==null?void 0:g.message)||""}`);let l=te.ERR_INNER;e.audio&&(l=te.ERR_SDK_SUBSCRIBE_AUDIO_STREAM_FAILED),e.video&&(e.vMsid===G.VideoSmall?l=te.ERR_SDK_SUBSCRIBE_DUAL_STREAM_FAILED:l=te.ERR_SDK_SUBSCRIBE_VIDEO_STREAM_FAILED),e.screen&&(l=te.ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED),this.slsReporter.reportSubscribe(((h=this.localUser)==null?void 0:h.callId)||"",this.callId,!!e.video&&e.vMsid===G.VideoLarge,!!e.video&&e.vMsid===G.VideoSmall,!!e.screen,!!e.audio,l,"",f,{pctid:this.rtsManager.pcTraceId,subtid:"",ajsub:t===Be.Join?1:0,url:this.streamUrl,est:r});const p=Y.fromError(g,l);throw this.emit("remoteSubscribeError",p),p}})}subscribeDeleteTracks(e){return O(this,null,function*(){const{audio:t,video:i,screen:r,data:n,vMsid:a}=e,o=[];(t||i||n)&&o.push({audio:t,video:i,vMsid:a}),r&&o.push({screen:r}),o.length!==0&&(yield Promise.all(o.map(u=>this.subscribeDeleteProxy(u))),e.data&&this.subscribeStopDataChannel())})}subscribeDeleteProxy(e){return O(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(Pe.AliRtcStateNoSubscribe)),e.video===!0&&(r.video=!1,e.vMsid===G.VideoSmall?(this.videoSmallSubState.setState(Pe.AliRtcStateNoSubscribe),(this.videoLargeSubState.currentState===Pe.AliRtcStateNoSubscribe||this.videoLargeSubState.currentState===Pe.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Pe.AliRtcStateNoSubscribe)):(this.videoLargeSubState.setState(Pe.AliRtcStateNoSubscribe),(this.videoSmallSubState.currentState===Pe.AliRtcStateNoSubscribe||this.videoSmallSubState.currentState===Pe.AliRtcStateSubscribeIdle)&&this.videoSubState.setState(Pe.AliRtcStateNoSubscribe))),e.screen===!0&&(r.screen=!1,this.screenSubState.setState(Pe.AliRtcStateNoSubscribe));const{callId:n,remoteCallid:a}=this,o={callid:n,remoteCallid:a,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}),o}catch(t){throw Y.fromError(t,te.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,data:!1}),this.audioElement&&this.audioElement.removeEventListener("pause",this.handleAudioPaused)}resumeAudio(){return O(this,null,function*(){const e=ui.getInstance();return e.state!=="running"&&e.resume(),this.audioElement?this.audioElement.play():this.playAudio()})}resumeVideo(e){return O(this,null,function*(){if(!e||e===Ae.AliRtcVideoTrackCamera||e===Ae.AliRtcVideoTrackBoth)return this.playAll();if(!e||e===Ae.AliRtcVideoTrackScreen||e===Ae.AliRtcVideoTrackBoth)return this.playAll(!0)})}resumePlay(){this.playAudio(),this.playAll(),this.playAll(!0)}stopSubscribe(e){return O(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 O(this,null,function*(){var r,n,a,o;const{callId:t,remoteCallid:i}=this;if((this.isAudioSubscribing||this.isVideoSubscribing||this.isScreenSubscribing)&&e)try{this.stopStreamMonitor(),yield this.rtsManager.subscibeStop(e),this.restore();const u={callid:t,remoteCallid:i,remoteStream:this.stream};return this.callId="",u}catch(u){if(((o=(a=(n=(r=u==null?void 0:u.extraInfo)==null?void 0:r.parsedData)==null?void 0:n.streams)==null?void 0:a[0])==null?void 0:o.res_code)!==404)throw Y.fromError(u,te.ERR_INNER,"subscribe stop failed")}})}updateStream(e,t=!1){return O(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 a=()=>{ae.event(`uid: ${this.userId} new mediaStream canplay`),n&&n.removeEventListener("canplaythrough",a,!1),n=void 0,clearTimeout(r),i(!0)};n.addEventListener("canplaythrough",a,!1),(n._playPromise||Promise.resolve()).then(()=>{n&&e.mediaStream&&(n.srcObject=e.mediaStream)})}else i(!0);r=window.setTimeout(()=>{ae.event(`uid: ${this.userId} new mediaStream timeout`),n=void 0,i(!0)},3e3)}),this.updateSubscribe(Be.User)),this.stream=e,this.playAll(!1,t),!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}subscribeDataChannel(){if(this.dc)try{this.dc.dispose(),this.dcMsgWaitingPieces=[],this.dc.off("message",this.onDataChannelMessage),this.dc=void 0}catch(e){}!this.streamInfo.hasAudio&&!this.streamInfo.hasVideo&&!this.streamInfo.hasScreen||(this.dataSubState.setState(Pe.AliRtcStateSubscribing),this.rtsManager.subscribeAddDataChannel(this.streamUrl).then(e=>{if(e){this.dc=e,this.dc.datachannel&&(this.dc.datachannel.binaryType="arraybuffer"),this.dc.on("message",this.onDataChannelMessage),this.dc.on("error",this.onDataChannelError),this.dataSubState.setState(Pe.AliRtcStateSubscribed),this.streamInfo.updateRemoteTrackSubState({data:!0});return}else throw new Error("no dc founded")}).catch(e=>{const t=Y.fromError(e,te.ERR_INNER,"subscribe data failed");this.emit("remoteSubscribeError",t),this.dataSubState.setState(Pe.AliRtcStateNoSubscribe)}))}subscribeStopDataChannel(){if(this.dc){try{this.rtsManager.subscribeStopDatachannel(this.streamUrl,this.dc)}catch(e){}this.dcMsgWaitingPieces=[],this.dc.off("message",this.onDataChannelMessage),this.dc.off("error",this.onDataChannelError),this.dataSubState.setState(Pe.AliRtcStateNoSubscribe),this.dc=void 0,this.streamInfo.updateRemoteTrackSubState({data:!1})}}getRetryOptions(){var i,r,n,a,o,u,h;const e={};this.wantSubAudio&&((i=this.streamInfo)!=null&&i.hasAudio)&&(e.audio=!0,e.aMsid=((r=this.streamInfo.getAudioInfo())==null?void 0:r.msid)||G.Audio),this.wantSubVideo&&((n=this.streamInfo)!=null&&n.hasVideo)&&(this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeLow&&((a=this.streamInfo)!=null&&a.hasVideoSmall)?(e.video=!0,e.vMsid=G.VideoSmall):(o=this.streamInfo)!=null&&o.hasVideoLarge&&(e.video=!0,e.vMsid=((u=this.streamInfo.getVideoLargeInfo())==null?void 0:u.msid)||G.VideoLarge)),this.wantSubScreen&&((h=this.streamInfo)!=null&&h.hasScreen)&&(e.screen=!0);let t={};if(e.audio||e.video)t={audio:e.audio,video:e.video},this.streamInfo.updateRemoteTrackSubState({screen:!1,data:!1});else if(e.screen)t={screen:e.screen},this.streamInfo.updateRemoteTrackSubState({data:!1});else return;return{remoteUser:this,options:t}}updateSubscribe(e){var n,a,o,u,h,g,f,l,p,d,m,v,b,x,y,E,I;const t=Date.now(),i={},r={};if(this.wantSubAudio&&!this.isAudioSubscribing&&((n=this.streamInfo)!=null&&n.hasAudio)?(i.audio=!0,i.aMsid=((a=this.streamInfo.getAudioInfo())==null?void 0:a.msid)||G.Audio):(!this.wantSubAudio||!((o=this.streamInfo)!=null&&o.hasAudio))&&this.isAudioSubscribing&&(r.audio=!0,r.aMsid=((u=this.streamInfo.getAudioInfo())==null?void 0:u.msid)||G.Audio),this.wantSubVideo&&((h=this.streamInfo)!=null&&h.hasVideo)?(this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeLow&&!this.isVideoSmallSubscribing&&((g=this.streamInfo)!=null&&g.hasVideoSmall)?(i.video=!0,i.vMsid=G.VideoSmall):!this.isVideoLargeSubscribing&&((f=this.streamInfo)!=null&&f.hasVideoLarge)&&!(this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeLow&&this.isVideoSmallSubscribing)&&(i.video=!0,i.vMsid=((l=this.streamInfo.getVideoLargeInfo())==null?void 0:l.msid)||G.VideoLarge),this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeLow&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&this.streamInfo.hasVideoSmall?(r.video=!0,r.vMsid=G.VideoLarge):this.defaultVideoStreamType===Ge.AliRtcVideoStreamTypeHigh&&this.isVideoLargeSubscribing&&this.isVideoSmallSubscribing&&(r.video=!0,r.vMsid=G.VideoSmall)):(!this.wantSubVideo||!((p=this.streamInfo)!=null&&p.hasVideo))&&this.isVideoSubscribing&&(r.video=!0,r.vMsid=this.streamInfo.isVideoSmallSubscribed||this.streamInfo.isVideoSmallSubscribing?G.VideoSmall:((d=this.streamInfo.getVideoLargeInfo())==null?void 0:d.msid)||G.VideoLarge),this.wantSubScreen&&!this.isScreenSubscribing&&((m=this.streamInfo)!=null&&m.hasScreen)?i.screen=!0:(!this.wantSubScreen||!((v=this.streamInfo)!=null&&v.hasScreen))&&this.isScreenSubscribing&&(r.screen=!0),(b=this.parameter.data)!=null&&b.enableSubDataChannel&&!this.isDataSubscribing&&((x=this.streamInfo)!=null&&x.hasData)?i.data=!0:(!((y=this.parameter.data)!=null&&y.enableSubDataChannel)||!((E=this.streamInfo)!=null&&E.hasData))&&this.isDataSubscribing&&(r.data=!0),(i.audio||i.video||i.screen||i.data)&&(this.createCallId(),this.subscribe(i,e,t)),(r.audio||r.video||r.screen)&&this.subscribeDeleteTracks(r),e===Be.Reconnect){if(ae.event(`[${kt.logName}]`,"reconnect, try to resume"),this.streamInfo.hasAudio&&!i.audio){const w=this.rtsManager.getStreamByMsid({url:this.streamUrl,aMsid:this.streamInfo.getAudioInfo().msid||G.Audio}).audioTrack;w&&(this.audioTrack=w,this.playAudio())}if(this.streamInfo.hasVideo&&!i.video){const w=this.rtsManager.getStreamByMsid({url:this.streamUrl,vMsid:this.streamInfo.isVideoSmallSubscribed||this.streamInfo.isVideoSmallSubscribing?G.VideoSmall:((I=this.streamInfo.getVideoLargeInfo())==null?void 0:I.msid)||G.VideoLarge});w&&w.mediaStream&&(this.stream=w,this.playAll(!1))}if(this.streamInfo.hasScreen&&!i.screen){const w=this.rtsManager.getStreamByMsid({url:this.streamUrl,sMsid:this.streamInfo.getScreenInfo().msid||G.Screen});w&&w.mediaStream&&(this.screenStream=w,this.playAll(!0))}}return{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===Ae.AliRtcVideoTrackScreen?this.screenStream:this.stream)==null?void 0:n.mediaStream;e.srcObject===r&&this.play(e,t===Ae.AliRtcVideoTrackScreen),document.removeEventListener("click",i,!1),document.removeEventListener("touchstart",i,!1)};document.addEventListener("click",i,!1),document.addEventListener("touchstart",i,!1)}playAudio(){return O(this,null,function*(){var e,t;if(this.audioTrack){if(this.toggleAudio(!this.audioMuted),this.audioElement||(this.audioElement=document.createElement("audio"),this.audioElement.addEventListener("pause",this.handleAudioPaused),this.setPlayoutVolume(this.playoutVolume)),((t=(e=this.audioElement.srcObject)==null?void 0:e.getAudioTracks())==null?void 0:t[0])!==this.audioTrack){let i=this.audioElement.srcObject;i?i.getAudioTracks().forEach(r=>{i.removeTrack(r)}):(i=new MediaStream,this.audioElement.srcObject=i),i.addTrack(this.audioTrack)}if(pe.AliRTS.SystenUtil.isIos&&parseInt(pe.AliRTS.SystenUtil.systemVersion)<=14){const i=this.audioElement;i.setAttribute("autoplay","");const r=()=>{i.removeEventListener("playing",r),i.pause(),i.play().catch(()=>{this.handleAutoPlayFailed()})};this.audioElement.addEventListener("playing",r)}else this.audioElement.play().catch(()=>{this.handleAutoPlayFailed()})}})}stopPlayAudio(){this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null,this.audioElement.removeEventListener("pause",this.handleAudioPaused))}playAll(e=!1,t=!1){e?(this.viewMap.screenViews||[]).forEach(i=>{this.play(i,e,t)}):(this.viewMap.cameraViews||[]).forEach(i=>{this.play(i,e,t)})}play(e,t=!1,i=!1){const r=t?this.screenStream:this.stream;!e||!r||!r.mediaStream||La(e,r.mediaStream,i).catch(n=>{n.code===20||n.name==="AbortError"||this.handleVideoPlayFailded(e,t?Ae.AliRtcVideoTrackScreen:Ae.AliRtcVideoTrackCamera)})}stopPlayAll(e=!1){e?this.viewMap.screenViews.forEach(t=>{Ft(t)}):this.viewMap.cameraViews.forEach(t=>{Ft(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 O(this,null,function*(){var i,r,n,a,o;const e=[];if(this.isAudioSubscribing){const u=yield this.rtsManager.getSubscribeAudioStats(this.streamUrl);u&&e.push({uid:this.uid,track:ci.AliRtcAudioTrackMic,stats:u})}const t=[];if((i=this.streamInfo)!=null&&i.isVideoLargeSubscribed){const u=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,((r=this.streamInfo.getVideoLargeInfo())==null?void 0:r.msid)||G.VideoLarge);u&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackCamera,streamType:Ge.AliRtcVideoStreamTypeHigh,stats:u})}if((n=this.streamInfo)!=null&&n.isVideoSmallSubscribed){const u=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,((a=this.streamInfo.getVideoSmallInfo())==null?void 0:a.msid)||G.VideoSmall);u&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackCamera,streamType:Ge.AliRtcVideoStreamTypeLow,stats:u})}if(this.isScreenSubscribing){const u=yield this.rtsManager.getSubscribeVideoStats(this.streamUrl,((o=this.streamInfo.getScreenInfo())==null?void 0:o.msid)||G.Screen);u&&t.push({uid:this.uid,track:Ae.AliRtcVideoTrackScreen,stats:u})}return{audio:e,video:t}})}enableAudioVolumeIndication(e){this.audioVolumeIndicationInterval!==e&&(this.audioVolumeIndicationInterval>0&&e<=0&&this.audioLevelMonitor.stop(),e>0&&this.audioTrack&&this.audioLevelMonitor.start(this.audioTrack,e),this.audioVolumeIndicationInterval=e)}reportSubscribeMonitor(e){var t;e&&(this.slsReporter.reportSubscribeMonitor(((t=this.localUser)==null?void 0:t.callId)||"",this.callId,this.trackTraceIdMap[e]||"",e,this.monitorDataCache[e]),this.monitorDataCache[e]=[])}startStreamMonitor(){this.monitorTimerId||(this.monitorTimerId=window.setInterval(()=>O(this,null,function*(){try{if(this.streamInfo.subscribingInfos.length===0){this.stopStreamMonitor();return}let e=Object.keys(this.monitorDataCache).filter(t=>{var i;return((i=this.monitorDataCache[t])==null?void 0:i.length)>0});this.streamInfo.subscribingInfos.forEach(t=>{const i=t.msid;if(!i)return;e.includes(i)&&(e=e.filter(a=>a!==i));let r;const n=i===G.Audio;n?r=this.rtsManager.getSubscribeAudioStats(this.streamUrl):r=this.rtsManager.getSubscribeVideoStats(this.streamUrl,i),r.then(a=>{var g;if(!a.timestamp)return;this.monitorDataCache[i]||(this.monitorDataCache[i]=[]);const o=this.monitorDataCache[i];let u;if((o==null?void 0:o.length)>0){const h=o[o.length-1]||{},{_last:l}=h;u=pi(h,["_last"])}(o==null?void 0:o.length)>=F0&&this.reportSubscribeMonitor(i),a._last=u,a._codec=t.codec,n&&(a._source=(g=this.localUser)==null?void 0:g.getMediaStats(a.playoutId)),this.monitorDataCache[i].push(a)})}),e.forEach(t=>{this.reportSubscribeMonitor(t)})}catch(e){}}),1e3))}stopStreamMonitor(){this.monitorTimerId&&(clearInterval(this.monitorTimerId),this.monitorTimerId=void 0),Object.keys(this.monitorDataCache).forEach(e=>{this.reportSubscribeMonitor(e)})}},_(kt,"logName","RemoteUser"),kt);Qe([z()],Je.prototype,"clear",1),Qe([z()],Je.prototype,"updateRemoteUserDeviceStatus",1),Qe([z()],Je.prototype,"updateRemoteTracks",1),Qe([z(ne)],Je.prototype,"subscribe",1),Qe([z()],Je.prototype,"subscribeProxy",1),Qe([z(ne)],Je.prototype,"subscribeDeleteProxy",1),Qe([z()],Je.prototype,"restore",1),Qe([z(ne)],Je.prototype,"resumeAudio",1),Qe([z(ne)],Je.prototype,"stopSubscribe",1),Qe([z(ne)],Je.prototype,"doStopSubscribe",1),Qe([z()],Je.prototype,"clearStream",1),Qe([z()],Je.prototype,"clearScreenStream",1),Qe([z()],Je.prototype,"updateSubscribe",1),Qe([z()],Je.prototype,"playAudio",1),Qe([z()],Je.prototype,"stopPlayAudio",1),Qe([z((s,c,e)=>[typeof s=="string"?s:s==null?void 0:s.nodeType,c,e])],Je.prototype,"play",1),Qe([z()],Je.prototype,"stopPlayAll",1);let O0=Je;var Vt=(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))(Vt||{});class V0 extends xe{constructor(){super(...arguments);_(this,"plugins",new Map)}add(e,t){if(this.plugins.has(e.name))throw new Y(Vt.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 Y(Vt.AliRtcPluginErrorNoFindPlugin,`Plugin ${e} not founded`);this.plugins.delete(e),t.removeAllListeners(),this.emit("removed",t)}removeAll(){this.plugins.forEach(e=>{this.remove(e.name)})}get(e){return this.plugins.get(e)}has(e){return!!this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}}var U0=Object.defineProperty,H0=Object.getOwnPropertyDescriptor,Ke=(s,c,e,t)=>{for(var i=t>1?void 0:t?H0(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&&U0(c,e,i),i};const Ji=([s])=>{const{remoteUser:c,options:e}=s;return[`user(${c.userId})`,e]},Ua=5,je=(nt=class extends xe{constructor(e,t,i,r,n){super();_(this,"rts");_(this,"encodedInsertableStreams",!0);_(this,"audioRedEnabled",!1);_(this,"localStreamManager");_(this,"slsReporter");_(this,"_rtsReconnecting",!1);_(this,"_rtsPeerConnectionType","publish");_(this,"connecting",!1);_(this,"connected",!1);_(this,"_pcTraceId","");_(this,"_localJoinTime",0);_(this,"publishRetryHook");_(this,"subscribeRetryOptionsHook");_(this,"connectionResolve");_(this,"connectingPromise");_(this,"dcResolve");_(this,"dcConnectingPromise");_(this,"_publishingTracks",[]);_(this,"parameter",{});this.localStreamManager=e,this.slsReporter=t,this.publishRetryHook=i,this.subscribeRetryOptionsHook=r,this.parameter=n,this.rts=pe.AliRTS.createClient(),this.addRTSListener()}addRTSListener(){this.rts.on("connectStatusChange",e=>{var t,i,r,n;if(ae.event(`[${nt.logName}]`,"rts connectStatusChange to:",e.status),e.status===pe.EConnectStatus.CONNECT_STATUS_DISCONNECTED)this.setConnected(!1),this.slsReporter.reportWarning("rts disconnected"),this.emit("disconnected");else if(e.status===pe.EConnectStatus.CONNECT_STATUS_CONNECTED){const a=(n=(r=(i=(t=this.rts.commonController)==null?void 0:t.peerCore)==null?void 0:i.getSignal())==null?void 0:r.getDatachannelCore())==null?void 0:n.readyState;ae.event(`[${nt.logName}]`,"dcReadyState:",a),a==="open"&&this.dcResolve&&this.dcResolve(!0),this._rtsReconnecting&&this._rtsPeerConnectionType==="publish"&&(this._publishingTracks=this.rts.getPublishTrackInfoList());try{this.emit("connected",this._rtsReconnecting,this._rtsPeerConnectionType)}catch(o){}this.setConnected(!0)}}),this.rts.on("datachannelStatusChange",e=>{ae.event(`[${nt.logName}]`,"rts datachannelStatusChange to:",e.status),e.status===pe.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?this.dcResolve&&this.dcResolve(!0):e.status===pe.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&(this.dcConnectingPromise=new Promise(t=>{this.dcResolve=t}))}),this.rts.on("receivedSEI",e=>{this.emit("seimessage",e.url,e.sei.payloadType,e.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(o=>o.mimeType==="audio/red"),a=r.findIndex(o=>o.mimeType==="audio/opus");if(n>-1&&a>-1&&n>a){const o=r[a];r[a]=r[n],r[n]=o}}this.rts.setSenderCodecPreferences({audio:r}),this.rts.setReceiverCodecPreferences({audio:r})}}catch(i){}this.audioRedEnabled=e}}clear(){this.setConnected(!1);try{this.rts.unpublish()}catch(e){}this.rts=pe.AliRTS.createClient(),this.addRTSListener()}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,this._rtsReconnecting=!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:G.Audio]),e.hasScreen&&(n.vMsid=[G.Screen]),e.hasVideo&&(n.vMsid=[r!=null?r:t!=null&&t.isScreen?G.Screen:G.VideoLarge]),n}updatePublishingTracks(e){e&&(this._publishingTracks=e.map(({msid:t,from:i,ssrc:r,codec:n,type:a,trackId:o})=>({msid:t,from:i,type:a,ssrc:`${r}`,codec:n!=null?n:"",trackId:o})))}httpPublish(n,a){return O(this,arguments,function*(e,t,i=!1,r=Bt.MANUAL){var b,x;let o;const{publishStream:u,videoSmallStream:h,screenStream:g,vMsid:f}=yield this.localStreamManager.createHTTPPublishStream();if(!u)return ae.warn(`[${nt.logName}]`,"publishStream is null"),{traceId:"",l1ip:o};const l=this.getPubMsid(u,{vMsid:f});this.encodedInsertableStreams&&(l.encodedInsertableStreams=!0),l.answerSdpHook=y=>{const E=/\d+\.\d+\.\d+\.\d+(?=\s+1106|\s+8000)/.exec(y);return E!=null&&E[0]&&(o=E[0]),y},(x=(b=this.parameter)==null?void 0:b.net)!=null&&x.useTCP&&(l.tcpOnly=!0),l.beforeRetry=y=>O(this,null,function*(){this._rtsReconnecting=!0,this.publishRetryHook&&this.publishRetryHook();const{publishStream:E,vMsid:I}=yield this.localStreamManager.createHTTPPublishStream();if(!E)return;const w=this.getPubMsid(E,{vMsid:I});return y.stream=E,w.aMsid?y.aMsid=w.aMsid:y.aMsid=[],w.vMsid?y.vMsid=w.vMsid:y.vMsid=[],y}),this._rtsPeerConnectionType="publish";let p=!u.hasVideo,d=f,m="";this.startConnect();const v=Date.now();try{m=yield this.rts.publish(e,u,l)}catch(y){this.setConnected(!1);const E=2e3-(Date.now()-v);throw E<=0?this.emit("disconnected"):setTimeout(()=>{this.emit("disconnected")},E),this.slsReporter.reportPublish(i,e,t,u.hasVideo&&(!f||f===G.VideoLarge),u.hasVideo&&f===G.VideoSmall,u.hasVideo&&f===G.Screen,u.hasAudio,(y==null?void 0:y.errorCode)||-1,this.pcTraceId,"",v),Y.fromRtsError(y)}ae.event(`[${nt.logName}]`,"rts publish success",m),this.slsReporter.reportPublish(i,e,t,u.hasVideo&&(!f||f===G.VideoLarge),u.hasVideo&&f===G.VideoSmall,u.hasVideo&&f===G.Screen,u.hasAudio,0,m,m,v);try{const y=Date.now();return this._pcTraceId=m,this.setConnected(!0),this._publishingTracks=this.rts.getPublishTrackInfoList(),h&&(yield this.publishAdd(e,h,t,{vMsid:G.VideoSmall},i),p=!1,d=G.VideoSmall),g&&(yield this.publishAdd(e,g,t,{vMsid:G.Screen},i),p=!1,d=G.Screen),yield this.waitPublishSender(e,p,d),this.slsReporter.reportPublishFirstPacket(i,t,v,y,this._localJoinTime,p?G.Audio:l.vMsid,m||"",m||"",r),{traceId:m,l1ip:o}}catch(y){throw this.setConnected(!1),Y.fromError(y)}})}waitPublishSender(e,t=!1,i){return O(this,null,function*(){const r=(n,a)=>{let o=0;const u=()=>(t?this.rts.getPublishAudioStats(e,i):this.rts.getPublishVideoStats(e,i)).then(g=>!(g.bytesSent>0)&&o<n?(o++,new Promise(l=>setTimeout(()=>l(u()),a))):Promise.resolve());return u()};return Promise.race([Nt(1e3),r(5,100)]).catch(()=>{})})}getPublishVideoStats(e,t){return O(this,null,function*(){return yield this.rts.getPublishVideoStats(e,t)})}getPublishAudioStats(e,t){return O(this,null,function*(){return yield this.rts.getPublishAudioStats(e,t)})}publishAdd(u,h,g,f){return O(this,arguments,function*(e,t,i,r,n=!1,a=!1,o=Bt.MANUAL){var d,m,v,b,x,y,E,I;const l=Date.now(),p=this.getPubMsid(t,r);try{const w=yield Ba(R=>O(this,null,function*(){return R>0&&ae.event(`[${nt.logName}]`,`publishAdd retry times: ${R}`),this.isConnected?(yield this.dcConnectingPromise,this.rts.publishAdd([ve({url:e,stream:t,updateSourceStream:!1},p)])):Promise.reject(new Y(te.ERR_INNER,"rts not connected"))}),Ua,0,R=>(R==null?void 0:R.errorCode)===15006);if(w){const R=Date.now(),[L]=w;return this.slsReporter.reportPublish(!1,e,i,((d=p.vMsid)==null?void 0:d[0])===G.VideoLarge,((m=p.vMsid)==null?void 0:m[0])===G.VideoSmall,((v=p.vMsid)==null?void 0:v[0])===G.Screen,((b=p.aMsid)==null?void 0:b[0])===G.Audio,0,this.pcTraceId,L.traceId||"",l),this.updatePublishingTracks(L.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,i,l,R,this._localJoinTime,(t.hasVideo?r==null?void 0:r.vMsid:r==null?void 0:r.aMsid)||"",this.pcTraceId,L.traceId||"",o),L.traceId||""}}catch(w){throw this.slsReporter.reportPublish(!1,e,i,((x=p.vMsid)==null?void 0:x[0])===G.VideoLarge,((y=p.vMsid)==null?void 0:y[0])===G.VideoSmall,((E=p.vMsid)==null?void 0:E[0])===G.Screen,((I=p.aMsid)==null?void 0:I[0])===G.Audio,(w==null?void 0:w.errorCode)||-1,this.pcTraceId,"",l),w!=null&&w.errorCode?Y.fromRtsError(w):Y.fromError(w)}return""})}publishDelete(e,t){return O(this,null,function*(){var u,h,g,f,l,p,d,m;yield this.dcConnectingPromise;const i=(h=(u=this.publishingTracks)==null?void 0:u.find(({msid:v})=>v===G.Audio))==null?void 0:h.msid,r=(f=(g=this.publishingTracks)==null?void 0:g.find(({msid:v})=>v===G.VideoLarge))==null?void 0:f.msid,n=(p=(l=this.publishingTracks)==null?void 0:l.find(({msid:v})=>v===G.Screen))==null?void 0:p.msid,a=[];t.screen&&n?a.push(n):t.video&&a.push(t.vMsid||r);const o=[];t.audio&&i&&o.push(i),ae.event(nt.logName,"publishDelete",{streamUrl:e,aMsid:o,vMsid:a});try{const[v]=(yield this.rts.publishDeleteTracks([{url:e,aMsid:o,vMsid:a}]))||[];return ae.event(nt.logName,"publishDelete",{result:v}),v&&this.updatePublishingTracks(v.trackInfoList),((m=(d=v==null?void 0:v.trackInfoList)==null?void 0:d[0])==null?void 0:m.trackId)||""}catch(v){throw Y.fromRtsError(v)}})}publishReplace(e,t,i){return O(this,null,function*(){var a,o;yield this.dcConnectingPromise;const{vMsid:r,aMsid:n}=i!=null?i:{};try{const u=yield this.rts.publishReplaceTracks([{url:e,stream:t,updateSourceStream:!1,vMsid:r,aMsid:n}]),[h]=u;return this.updatePublishingTracks(h.trackInfoList),((o=(a=h==null?void 0:h.trackInfoList)==null?void 0:a[0])==null?void 0:o.trackId)||""}catch(u){throw Y.fromRtsError(u)}})}publishStop(e){return O(this,null,function*(){return yield this.rts.publishStop([{url:e}]),this._publishingTracks=[],""})}publishAddDataChannel(e){return O(this,null,function*(){yield this.dcConnectingPromise;const t=yield this.rts.publishAddDatachannel({signalUrl:e,url:e,label:G.Data,msid:G.Data}),i=t==null?void 0:t.datachannel;if(i&&i.send){const r=new ArrayBuffer(4);new DataView(r).setUint8(0,240),i.datachannel.send(r)}return i})}publishStopDataChannel(e,t){return O(this,null,function*(){return yield this.rts.publishStopDatachannel({url:e,datachannel:t})})}unpublish(){return O(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)||G.Audio]),i.video?i.vMsid?r.vMsid=[i.vMsid]:e!=null&&e.hasVideoLarge?r.vMsid=[(e==null?void 0:e.getVideoLargeInfo().msid)||G.VideoLarge]:e!=null&&e.hasVideoSmall?r.vMsid=[(e==null?void 0:e.getVideoSmallInfo().msid)||G.VideoSmall]:r.vMsid=[G.VideoLarge]:i.screen&&e!=null&&e.hasScreen&&(r.vMsid=[(e==null?void 0:e.getScreenInfo().msid)||G.Screen]),r}httpSubscribe(e){return O(this,null,function*(){var a,o;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);this.encodedInsertableStreams&&(n.encodedInsertableStreams=!0),(o=(a=this.parameter)==null?void 0:a.net)!=null&&o.useTCP&&(n.tcpOnly=!0),n.beforeRetry=u=>O(this,null,function*(){this._rtsReconnecting=!0;try{this.emit("reconnecting","subscribe")}catch(h){}if(this._publishingTracks=[],this.subscribeRetryOptionsHook){const h=this.subscribeRetryOptionsHook();if(h){let g=t.streamUrl;i.video||i.screen?i!=null&&i.audio||(g+="@subaudio=no"):g+="@subvideo=no",u.url=g;const f=this.getSubConfig(h.remoteUser.streamInfo,h.options);f.aMsid&&(u.aMsid=f.aMsid),f.vMsid&&(u.vMsid=f.vMsid)}else return}return u}),this._rtsPeerConnectionType="subscribe";try{this.startConnect();const u=yield this.rts.subscribe(r,n);return this._pcTraceId=u.traceId,this.setConnected(!0),{traceId:u.traceId,stream:u}}catch(u){throw this.setConnected(!1),this.emit("disconnected"),Y.fromRtsError(u)}})}subscribeAdd(e){return O(this,null,function*(){var n,a,o,u;const{remoteUser:t,options:i}=e,r=Rt(ve({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 Ba(g=>O(this,null,function*(){return yield this.dcConnectingPromise,g>0&&ae.event(`[${nt.logName}]`,`subscribeAdd retry times: ${g}`),this.isConnected?this.rts.subscribeAdd([r]):Promise.reject()}),Ua,0,g=>(g==null?void 0:g.errorCode)===15006))[0]}catch(h){if(((u=(o=(a=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:a.streams)==null?void 0:o[0])==null?void 0:u.res_code)===508)return this.emit("subscribeexceeds"),null;throw Y.fromRtsError(h)}})}subscibeDelete(e){return O(this,null,function*(){var n,a,o,u;yield this.dcConnectingPromise;const{remoteUser:t,options:i}=e,r=Rt(ve({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=(o=(a=(n=h==null?void 0:h.extraInfo)==null?void 0:n.parsedData)==null?void 0:a.streams)==null?void 0:o[0])==null?void 0:u.res_code)===404)return;throw Y.fromRtsError(h)}})}subscibeStop(e){return O(this,null,function*(){var t,i,r,n;try{yield this.rts.subscribeStop([{url:e}])}catch(a){if(((n=(r=(i=(t=a==null?void 0:a.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 Y.fromRtsError(a)}})}subscribeAddDataChannel(e){return O(this,null,function*(){yield this.dcConnectingPromise;const t=yield this.rts.subscribeAddDatachannel({signalUrl:e,url:e,label:G.Data,msid:G.Data}),i=t==null?void 0:t.datachannel;if(i&&i.send){const r=new ArrayBuffer(4);new DataView(r).setUint8(0,240),i.send(r)}return i})}subscribeStopDatachannel(e,t){return O(this,null,function*(){let i;try{i=yield this.rts.subscribeStopDatachannel({url:e,datachannel:t})}catch(r){}return t==null||t.dispose(),i})}publish(n,a){return O(this,arguments,function*(e,t,i=!1,r=Bt.MANUAL){let o="",u;if(this.connecting&&(yield this.connectingPromise),this.connected){yield this.dcConnectingPromise;let h=!1,g;const{audio:f,video:l,videoSmall:p,screen:d}=this.localStreamManager.publishStreams;f&&(o=yield this.publishAdd(e,f,t,{aMsid:G.Audio},i),h=!0,g=G.Audio,yield Nt(100)),l&&(o=yield this.publishAdd(e,l,t,{vMsid:G.VideoLarge},i),h=!1,g=G.VideoLarge,yield Nt(100)),p&&(o=yield this.publishAdd(e,p,t,{vMsid:G.VideoSmall},i),h=!1,g=G.VideoSmall,yield Nt(100)),d&&(o=yield this.publishAdd(e,d,t,{isScreen:!0,vMsid:G.Screen},i),h=!1,g=G.Screen),g&&(yield this.waitPublishSender(e,h,g))}else{const h=yield this.httpPublish(e,t,i,r);o=h.traceId,u=h.l1ip}return{traceId:o,l1ip:u}})}subscribe(e,t,i,r,n){return O(this,null,function*(){let a=!1;const{options:o,remoteUser:u}=e;if(o.video&&o.screen)throw new Y(te.ERR_INNER,"subscribe error, video and screen cannot be subscribed at the same time");this.connecting&&(yield this.connectingPromise);let h,g=Date.now();this.connected?(g=Date.now(),h=yield this.subscribeAdd(e)):(a=!0,h=yield this.httpSubscribe(e));const f=Date.now();let l=G.VideoLarge,p=o.video||o.screen,d=o.audio;o.video&&o.vMsid?l=o.vMsid:o.screen&&(l=G.Screen);let m=0,v=0,b=0;const y=((E,I)=>{let w=0;const R=()=>{let L;return d&&!m&&(L=this.rts.getSubscribeAudioStats(u.streamUrl).then(D=>{if(D.packetsReceived>0)m=Date.now();else if(!p)return w<E?(w++,new Promise(N=>setTimeout(()=>N(R()),I))):!1;return!0})),p&&!b&&(L=this.rts.getSubscribeVideoStats(u.streamUrl,l).then(D=>{if(D.packetsReceived>0&&(v=Date.now()),D.framesDecoded>0)b=Date.now();else return w<E?(w++,new Promise(N=>setTimeout(()=>N(R()),I))):(ae.error(`[${nt.logName}]`,u.userId,"尝试获取首帧数据失败"),!1);return!0})),Promise.resolve(L)};return R()})(40,100);return y.then(()=>{v&&this.slsReporter.reportSubscribeFirstPacket(t===Be.Resume,i,r,l,{fprt:v-g,ifsprtc:b?b-g:0,ajsub:t===Be.Join?1:0,pctid:this.pcTraceId,subtid:(h==null?void 0:h.traceId)||"",sstc:f-g}),b&&this.slsReporter.reportSubscribeFirstFrame(t===Be.Resume,i,r,l,{fvfrt:b-g,fp2fftc:b-v,ajsub:t===Be.Join?1:0,tffrtc:t===Be.Join?b-this.localJoinTime:b-n,pctid:this.pcTraceId,subtid:(h==null?void 0:h.traceId)||"",fvfdtc:b-g}),m&&this.slsReporter.reportSubscribeFirstPacket(t===Be.Resume,i,r,G.Audio,{fprt:m-g,ifsprtc:m-g,ajsub:t===Be.Join?1:0,pctid:this.pcTraceId,subtid:(h==null?void 0:h.traceId)||"",sstc:f-g})}),a&&(yield Promise.race([y,Nt(1500)])),h})}getSubscribeVideoStats(e,t){return O(this,null,function*(){return yield this.rts.getSubscribeVideoStats(e,t)})}getSubscribeAudioStats(e,t){return O(this,null,function*(){return yield this.rts.getSubscribeAudioStats(e,t)})}getStreamByMsid(e){return this.rts.commonController.streamManager.getStreamByMsid(e)}getPCStats(){return O(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 O(this,null,function*(){return this.rts.sendSEI({url:e,vMsid:G.VideoLarge,data:t,repeatCount:i,payloadType:r})})}},_(nt,"logName","RtsManager"),nt);Ke([z()],je.prototype,"updatePublishingTracks",1),Ke([z(ne,ne)],je.prototype,"httpPublish",1),Ke([z(ne,ne)],je.prototype,"waitPublishSender",1),Ke([z(([s,c,e])=>[s,JSON.stringify(e)],ne)],je.prototype,"publishAdd",1),Ke([z(ne,ne)],je.prototype,"publishDelete",1),Ke([z(([s,c,e])=>[s,JSON.stringify(e)])],je.prototype,"publishReplace",1),Ke([z(ne)],je.prototype,"publishStop",1),Ke([z(ne)],je.prototype,"publishAddDataChannel",1),Ke([z(ne)],je.prototype,"publishStopDataChannel",1),Ke([z()],je.prototype,"unpublish",1),Ke([z(Ji,({traceId:s})=>s)],je.prototype,"httpSubscribe",1),Ke([z(Ji,({traceId:s})=>s)],je.prototype,"subscribeAdd",1),Ke([z(Ji)],je.prototype,"subscibeDelete",1),Ke([z(ne)],je.prototype,"subscibeStop",1),Ke([z(ne)],je.prototype,"subscribeAddDataChannel",1),Ke([z(ne)],je.prototype,"subscribeStopDatachannel",1),Ke([z(ne)],je.prototype,"publish",1),Ke([z(Ji)],je.prototype,"subscribe",1),Ke([z()],je.prototype,"sendSEI",1);let z0=je;class Rs{constructor(){_(this,"profile");_(this,"profileMap",new Map);_(this,"audioProfile");_(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 O(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 Ds extends xe{constructor(e){super();_(this,"type");_(this,"originVideoTrack");_(this,"videoSource");_(this,"_videoMuted",!1);_(this,"originAudioTrack");_(this,"audioSource");_(this,"_audioMuted",!1);_(this,"_targetVideoTrack");_(this,"_targetDualVideoTrack");_(this,"_targetAudioTrack");_(this,"_publishVideoStream");_(this,"_publishDualVideoStream");_(this,"_publishAudioStream");_(this,"_previewStream");_(this,"plugins",[]);_(this,"_profileManager");_(this,"cameraVideoConstraints");_(this,"micAudioConstraints");_(this,"onVideoTrackEnded",()=>{this.emit("videotrackended")});_(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 O(this,null,function*(){var a,o,u,h,g,f;const{videoTrack:r,audioTrack:n}=e;r&&((a=this.originVideoTrack)==null||a.removeEventListener("ended",this.onVideoTrackEnded)),n&&((o=this.originAudioTrack)==null||o.removeEventListener("ended",this.onAudioTrackEnded)),this.type===We.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||ni.Camera,this.updateVideoTrack(r)),n&&(this.originAudioTrack=n,(f=this.originAudioTrack)==null||f.addEventListener("ended",this.onAudioTrackEnded),this.audioSource=i||Pi.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 O(this,null,function*(){(this._targetVideoTrack!==e||t)&&(this._targetVideoTrack=e)})}updateDualVideoTrack(e,t=!1){return O(this,null,function*(){(this._targetDualVideoTrack!==e||t)&&(this._targetDualVideoTrack=e)})}updateAudioTrack(e,t=!1){return O(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 O(this,null,function*(){var t,i,r,n,a,o,u,h,g,f,l,p;this._targetAudioTrack=this.originAudioTrack,this._targetVideoTrack=this.originVideoTrack;for(const d of this.plugins)try{yield d.execute(this,e)}catch(m){console.error(`error in plugin-${d.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 Di(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?(a=this.previewStream)==null||a.mergeStream(this._publishVideoStream):this._previewStream=yield Di(this._targetVideoTrack)):(this._publishVideoStream=void 0,(o=this.previewStream)==null||o.deleteTracks({video:!0})),this._targetDualVideoTrack?((h=(u=this._publishDualVideoStream)==null?void 0:u.videoTrack)==null?void 0:h.id)!==this._targetDualVideoTrack.id&&(this._publishDualVideoStream=yield Di(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 Di(this._targetAudioTrack),this.setAudioMuted(this._audioMuted),this.previewStream?(l=this.previewStream)==null||l.mergeStream(this._publishAudioStream):this._previewStream=yield Di(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 O(this,null,function*(){this._profileManager||(this._profileManager=new Rs),e&&this._profileManager.updateProfile(e,t),yield this._profileManager.setVideoProfile(this.originVideoTrack,this._publishVideoStream,this.type===We.AliRtcSdkStreamTypeScreen)})}get videoProfile(){var e;return(e=this.profileManager)==null?void 0:e.videoProfile}setVideoContentHint(e){this._profileManager||(this._profileManager=new Rs),this._profileManager.setContentHint(this.currentVideoTrack,e)}updateAudioProfile(e){return O(this,null,function*(){this._profileManager||(this._profileManager=new Rs),this._profileManager.updateAudioProfile(e)})}cloneVideoProfile(e){return O(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 j0=Object.defineProperty,W0=Object.getOwnPropertyDescriptor,_t=(s,c,e,t)=>{for(var i=t>1?void 0:t?W0(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&&j0(c,e,i),i};const xt=(ri=class extends xe{constructor(e,t){super();_(this,"pluginManager");_(this,"slsReporter");_(this,"publishingCameraVideoStream");_(this,"publishingScreenVideoStream");_(this,"cameraStreamInfo",new Ds(We.AliRtcSdkStreamTypeCapture));_(this,"screenStreamInfo",new Ds(We.AliRtcSdkStreamTypeScreen));_(this,"streamInfos",[this.cameraStreamInfo,this.screenStreamInfo]);_(this,"_audioCaptureDisabled",!1);_(this,"_cameraCaptureDisabled",!1);_(this,"_publishLocalAudioStreamEnabled",!0);_(this,"_publishLocalVideoStreamEnabled",!0);_(this,"_publishLocalScreenStreamEnabled",!0);this.screenStreamInfo.setVideoContentHint("motion"),this.pluginManager=e,this.slsReporter=t;const i=r=>O(this,null,function*(){if(ae.info(`[${ri.logName}]`,"plugin added",r.name),!r.isSupported("6.13.2-beta.2")){console.warn(`${r.name} is not supported!!!`),r.emit("unsupported");return}try{yield r.init()}catch(n){r.emit("error",Y.fromError(n,Vt.AliRtcPluginErrorInitError))}r.streamType===We.AliRtcSdkStreamTypeCapture&&(this.cameraStreamInfo.addPlugin(r),yield this.cameraStreamInfo.process(this.streamInfos)),r.streamType===We.AliRtcSdkStreamTypeScreen&&(this.screenStreamInfo.addPlugin(r),yield this.screenStreamInfo.process(this.streamInfos)),this.emit("publishupdate")});this.cameraStreamInfo.updateVideoProfile(Ta,wi),this.cameraStreamInfo.on("videotrackended",()=>O(this,null,function*(){yield this.stopLocalStream({video:!0}),this.emit("trackended",ti.VideoTrackEnded)})),this.cameraStreamInfo.on("audiotrackended",()=>O(this,null,function*(){yield this.stopLocalStream({audio:!0}),this.emit("trackended",ti.AudioTrackEnded)})),this.screenStreamInfo.updateVideoProfile(ka,Ci),this.screenStreamInfo.on("videotrackended",()=>O(this,null,function*(){yield this.stopLocalStream({screen:!0}),this.emit("trackended",ti.ScreenTrackEnded)})),this.pluginManager.on("added",i),this.pluginManager.on("removed",r=>O(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",()=>O(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}set cameraCaptureDisabled(e){this._cameraCaptureDisabled=e}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}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 O(this,null,function*(){yield this.cameraStreamInfo.process(this.streamInfos),yield this.screenStreamInfo.process(this.streamInfos),this.emit("publishupdate")})}setAvailableCameraDeviceId(){return O(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 a=yield pe.AliRTS.getCameraList();a.find(o=>o.deviceId===n)||(n=(r=(i=a.find(o=>!!o.deviceId))==null?void 0:i.deviceId)!=null?r:""),this.cameraStreamInfo.cameraVideoConstraints.deviceId=n}})}setAvailableMicrophoneDeviceId(){return O(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 a=yield pe.AliRTS.getMicList();a.find(o=>o.deviceId===n)||(n=(r=(i=a.find(o=>!!o.deviceId))==null?void 0:i.deviceId)!=null?r:""),this.cameraStreamInfo.micAudioConstraints.deviceId=n}})}createLocalStream(e){return O(this,null,function*(){var g;const{screen:t,mediaStream:i,videoProfile:r,screenProfile:n}=e;let{video:a,audio:o}=e;const u=C0(e);let h;if(u){i||(a===!0&&this.cameraStreamInfo.cameraVideoConstraints?(yield this.setAvailableCameraDeviceId(),a=ve({},this.cameraStreamInfo.cameraVideoConstraints)):typeof a=="object"&&(yield this.setAvailableCameraDeviceId(),a=ve(ve({},a),this.cameraStreamInfo.cameraVideoConstraints)),o===void 0&&this.audioCaptureDisabled?o=!1:o&&(o===!0&&this.cameraStreamInfo.micAudioConstraints?(yield this.setAvailableMicrophoneDeviceId(),o=ve({},this.cameraStreamInfo.micAudioConstraints)):typeof o=="object"&&(yield this.setAvailableMicrophoneDeviceId(),o=ve(ve({},o),this.cameraStreamInfo.micAudioConstraints)),this._audioCaptureDisabled=!1));const f=Date.now();try{h=yield pe.AliRTS.createStream({audio:o,video:a,screen:t,custom:!!i,mediaStream:i,skipProfile:!0}),o&&!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(l){throw o&&!i&&this.slsReporter.reportAudio(l,Date.now()-f,""),t&&!i&&this.slsReporter.reportScreen(null,Date.now()-f),l}if(t)yield this.screenStreamInfo.updateSource(h,ni.Screen,Pi.Screen),yield this.setScreenProfile(n),this.setScreenContentHint(),this.publishingScreenVideoStream=void 0;else if(yield this.cameraStreamInfo.updateSource(h,ni.Camera,Pi.Microphone),h.hasVideo&&(yield this.setVideoProfile(r),this.setVideoContentHint(),this.publishingCameraVideoStream=void 0),h.hasAudio&&typeof o=="boolean"){const l=this.cameraStreamInfo.audioProfile;l&&(yield h.setAudioProfile(l))}}return pe.AliRTS.SystenUtil.isIos&&pe.AliRTS.SystenUtil.compareVersion("15.1")&&!pe.AliRTS.SystenUtil.compareVersion("15.2")&&(yield Nt(1e3)),yield this.updateStreams(),h})}stopLocalStream(e){return O(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 O(this,null,function*(){var o,u,h,g;let e,t=!1,i,r,n;const a=yield this.publishStreams;try{if(!a.audio&&!a.video&&!a.videoSmall&&!a.screen)throw ae.error(`[${ri.logName}]`,"no tracks founded"),new Y(te.ERR_SDK_PUBLISH_INVAILD,"no tracks founded");const f=new MediaStream;(o=a.audio)!=null&&o.audioTrack&&f.addTrack(a.audio.audioTrack),(u=a.video)!=null&&u.videoTrack?(f.addTrack(a.video.videoTrack),r=a.videoSmall,n=a.screen):(h=a.screen)!=null&&h.videoTrack&&(i=G.Screen,f.addTrack((g=a.screen)==null?void 0:g.videoTrack),t=!0),e=yield Oa(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(),this.updateStreams()}setVideoProfile(e,t){return O(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 O(this,null,function*(){var t;yield this.cameraStreamInfo.updateAudioProfile(e),yield(t=this.publishingCameraVideoStream)==null?void 0:t.setAudioProfile(e)})}setScreenProfile(e,t){return O(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=ve(ve({},(t=this.cameraStreamInfo.cameraVideoConstraints)!=null?t:{}),e)}setMicAudioConstraints(e){var t;this.cameraStreamInfo.micAudioConstraints=ve(ve({},(t=this.cameraStreamInfo.micAudioConstraints)!=null?t:{}),e)}},_(ri,"logName","LocalStreamManager"),ri);_t([z(([s])=>{const{audio:c,video:e,screen:t,custom:i,skipProfile:r,videoProfile:n,screenProfile:a}=s;return[{audio:c,video:e,screen:t,custom:i,skipProfile:r,videoProfile:n,screenProfile:a}]})],xt.prototype,"createLocalStream",1),_t([z(ne)],xt.prototype,"stopLocalStream",1),_t([z()],xt.prototype,"createHTTPPublishStream",1),_t([z()],xt.prototype,"stop",1),_t([z(ne)],xt.prototype,"setVideoProfile",1),_t([z(ne)],xt.prototype,"setVideoContentHint",1),_t([z(ne)],xt.prototype,"setAudioProfile",1),_t([z(ne)],xt.prototype,"setScreenProfile",1),_t([z(ne)],xt.prototype,"setScreenContentHint",1),_t([z(ne)],xt.prototype,"setCameraVideoConstraints",1),_t([z(ne)],xt.prototype,"setMicAudioConstraints",1);let K0=xt;class $0 extends Zt{constructor(){super("AliRtcScreenStandardize",We.AliRtcSdkStreamTypeScreen);_(this,"canvas");_(this,"lastWidth");_(this,"lastHeight");_(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===ni.Screen)}handleFrame(e,t){return O(this,null,function*(){var a;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=(a=this.canvas)==null?void 0:a.getContext("2d");if(this.canvas&&n){n.drawImage(e,0,0,i,r);const o=new VideoFrame(this.canvas,{timestamp:e.timestamp});return e.close(),o}return e})}process(e){return O(this,null,function*(){var h;if(!e.originVideoTrack||e.videoSource!==ni.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,a=new TransformStream({transform(g,f){return O(this,null,function*(){const l=yield n.handleFrame(g,e);yield f.enqueue(l),l==null||l.close()})}});t.readable.pipeThrough(a).pipeTo(i.writable);const o=(h=r.getVideoTracks())==null?void 0:h[0];e.updateVideoTrack(o),this.hasScreenTrack=!0})}clear(e){this.canvas=void 0,this.lastWidth=void 0,this.lastHeight=void 0,super.clear(e)}}class q0 extends Zt{constructor(){super("blankAudio",We.AliRtcSdkStreamTypeCapture,xi.BOTH);_(this,"hasTrack",!1);_(this,"oscillator",null);_(this,"audioTrack",null);_(this,"createAudioTrack",()=>{const e=new AudioContext;this.oscillator=e.createOscillator();const t=e.createGain();t.gain.value=0;const i=e.createMediaStreamDestination();this.oscillator.connect(t),t.connect(i),this.oscillator.start();const r=i.stream;return this.audioTrack=r.getAudioTracks()[0],this.audioTrack});this.zIndex=9}isSupported(){return!0}setOptions(){throw new Error("Method not implemented.")}shouldUpdate(e,t){return this.hasTrack!==t.some(i=>i.originVideoTrack||i.originAudioTrack)}process(e,t){return O(this,null,function*(){var r;const i=t.some(n=>n.originVideoTrack||n.originAudioTrack);this.hasTrack=i,i?this.audioTrack&&((r=this.oscillator)==null||r.stop(),this.oscillator=null,this.audioTrack.stop(),this.audioTrack=null):(this.audioTrack||(this.audioTrack=this.createAudioTrack()),e.updateAudioTrack(this.audioTrack))})}}class Ha{constructor(c){_(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)}}_(Ha,"LEVEL",0);class G0{constructor(){_(this,"logger",new Ha("AudioMixer"));_(this,"audioContext",new AudioContext);_(this,"audioDestination",this.audioContext.createMediaStreamDestination());_(this,"audioTrack",_0(this.audioDestination.stream));_(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 J0=4;class X0 extends Zt{constructor(){super("audioMixer",We.AliRtcSdkStreamTypeCapture,xi.AUDIO);_(this,"audioMixer");_(this,"primaryAudioTrackId");_(this,"screenAudioTrackId");_(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,a;if(e.type!==We.AliRtcSdkStreamTypeCapture)return!1;const i=t.find(o=>o.type===We.AliRtcSdkStreamTypeCapture),r=t.find(o=>o.type===We.AliRtcSdkStreamTypeScreen);return!(this.primaryAudioTrackId===((n=i==null?void 0:i.currentAudioTrack)==null?void 0:n.id)&&this.screenAudioTrackId===((a=r==null?void 0:r.currentAudioTrack)==null?void 0:a.id)&&!this.dirty)}process(e,t){return O(this,null,function*(){var a,o;this.dirty=!1;const i=t.find(u=>u.type===We.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 G0),yield this.audioMixer.resume(),this.primaryAudioTrackId&&(r==null?void 0:r.id)!==this.primaryAudioTrackId&&((a=this.audioMixer)==null||a.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&&((o=this.audioMixer)==null||o.removeTrack(this.screenAudioTrackId)),n&&!this.audioMixer.hasTrack(n==null?void 0:n.id)&&this.audioMixer.addTrack(n),this.screenAudioTrackId=n==null?void 0:n.id,this.updateVolume(),e.updateAudioTrack(this.audioMixer.getAudioTrack())})}isValidVolume(e){return e!==void 0&&e>=0&&e<=J0}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 Ts{constructor(c,e){_(this,"originTrack");_(this,"originVideo");_(this,"targetWidth");_(this,"targetHeight");_(this,"targetFrameRate");_(this,"targetCanvas");_(this,"animationFrameId");_(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 a=t,o=i,u=0,h=0;return n>r?(a=Math.round(o/r),u=Math.round((t-a)/2)):n<r&&(o=Math.round(a*r),h=Math.round((i-o)/2)),{x:u,y:h,width:a,height:o}}}class Z0 extends Ts{constructor(e,t){super(e,t);_(this,"targetCtx");this.targetCtx=this.targetCanvas.getContext("2d"),this.startRender=this.startRender.bind(this),this.stopRender=this.startRender.bind(this),this.initStream(e)}initStream(e){const t=new MediaStream;t.addTrack(e),this.originVideo.srcObject=t,this.originVideo.play(),this.originVideo.addEventListener("canplay",this.startRender),this.originVideo.addEventListener("pause",this.stopRender),this.originVideo.addEventListener("ended",this.stopRender)}startRender(){this.cancelAnimation();const e=()=>{if(!this.targetCtx)return;const t=this.getPositionAndSize(this.originVideo.videoWidth,this.originVideo.videoHeight,this.targetWidth,this.targetHeight);this.targetCtx.drawImage(this.originVideo,0,0,this.originVideo.videoWidth,this.originVideo.videoHeight,t.x,t.y,t.width,t.height),!this.originVideo.paused&&!this.originVideo.ended&&(this.animationFrameId=requestAnimationFrame(e))};e()}stopRender(){this.cancelAnimation()}dispose(){this.stopRender(),this.originVideo.removeEventListener("play",this.startRender),this.originVideo.removeEventListener("pause",this.stopRender),this.originVideo.removeEventListener("ended",this.stopRender),this.originVideo.pause(),this.originVideo.srcObject=null}}const Y0=`
41
41
  attribute vec2 a_position;
42
42
  attribute vec2 a_texCoord;
43
43
 
@@ -152,4 +152,4 @@ onmessage = function(evt) {
152
152
  break;
153
153
  }
154
154
  }
155
- `;class Wa extends Ts{constructor(e,t){super(e,t);_(this,"processor");_(this,"trackGenerator");_(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([su],{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(ve({type:"updateOptions"},e))}dispose(){try{this.processor.readable.cancel(),this.trackGenerator.writable.close()}catch(e){}}getVideoTrack(){return this.trackGenerator}}class ks{static isSupport(){return typeof HTMLCanvasElement.prototype.captureStream=="function"}static getInstance(c,e){return Wa.isSupport()?new Wa(c,e):ja.isSupport()?new ja(c,e):new Z0(c,e)}}class nu extends Zt{constructor(){super(...arguments);_(this,"hasVideoTrack",!1);_(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 ks.isSupport()}shouldUpdate(e){return this.hasVideoTrack!==!!e.currentVideoTrack}process(e){return O(this,null,function*(){if(e.currentVideoTrack){if(this.hasVideoTrack=!0,!this.videoScaler){const i=this.options||this.initOptions;this.videoScaler=ks.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()}}var au=Object.defineProperty,ou=Object.getOwnPropertyDescriptor,ct=(s,c,e,t)=>{for(var i=t>1?void 0:t?ou(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&&au(c,e,i),i};class tt extends xe{constructor(e){super();_(this,"self");_(this,"userMap",{});_(this,"usersViewMap",{});_(this,"rtsManager");_(this,"localStreamManager");_(this,"authInfo");_(this,"signalingManager");_(this,"pluginManager");_(this,"audioMixerPlugin");_(this,"dualVideoPlugin");_(this,"blankAudioPlugin");_(this,"slsReporter");_(this,"statsMonitorId");_(this,"autoSubAudio",!0);_(this,"autoSubVideo",!0);_(this,"autoSubScreen",!0);_(this,"wantSubAudio",!0);_(this,"wantSubVideo",!0);_(this,"wantSubScreen",!0);_(this,"defaultStreamType",Ge.AliRtcVideoStreamTypeHigh);_(this,"audioMuted",!1);_(this,"playoutVolume",1);_(this,"audioVolumeIndicationInterval",0);_(this,"indicationTimer",0);_(this,"parameter",{});_(this,"publishRetryOptionsHook",()=>{for(const e of this.remoteUsers)e.restore()});_(this,"subscribeRetryOptionsHook",()=>{let e=!1,t;for(const i of this.remoteUsers)if(e)i.restore();else{const r=i.getRetryOptions();r&&(t=r,e=!0)}return t});const{signalingManager:t,slsReporter:i}=e;this.signalingManager=t,this.addSignalingManagerListener(),this.slsReporter=i,this.pluginManager=new V0,this.localStreamManager=new K0(this.pluginManager,this.slsReporter),this.rtsManager=new z0(this.localStreamManager,this.slsReporter,this.publishRetryOptionsHook,this.subscribeRetryOptionsHook,this.parameter),this.self=new Fa({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,parameter:this.parameter}),this.audioMixerPlugin=new X0,this.pluginManager.add(this.audioMixerPlugin),this.dualVideoPlugin=new nu("dualVideoPlugin"),s0()&&this.pluginManager.add(new $0)}addSignalingManagerListener(){this.signalingManager.on("onNotifyPublish",e=>{ae.event("[Signaling] Notify Publish ",e),e.forEach(t=>{this.onRemotePublishStateChange(t)})}),this.signalingManager.stsManager.on("onTokenUpdate",(e,t)=>{ae.updateToken(e),this.slsReporter.updateToken(t,e)})}isAutoSubAudio(){return this.autoSubAudio}setAutoSubAudio(e){this.autoSubAudio=e}isAutoSubVideo(){return this.autoSubVideo}setAutoSubVideo(e){this.autoSubVideo=e}isAutoSubScreen(){return this.autoSubScreen}setAutoSubScreen(e){this.autoSubScreen=e}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e,this.remoteUsers.forEach(t=>{t.setWantSubAudio(e),t.updateSubscribe(Be.User)})}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e,this.remoteUsers.forEach(t=>{t.setWantSubVideo(e),t.updateSubscribe(Be.User)})}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e,this.remoteUsers.forEach(t=>{t.setWantSubScreen(e),t.updateSubscribe(Be.User)})}setRemoteDefaultVideoStreamType(e){this.defaultStreamType=e,this.remoteUsers.forEach(t=>{t.setRemoteDefaultVideoStreamType(e)})}setRemoteUserVideoStreamType(e,t){var 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=ws(e);i.length!==0&&i.forEach(n=>{var a,o;(a=this.publisher)==null||a.resetElement(n),Object.values(this.usersViewMap).forEach(({cameraViews:u=[],screenViews:h=[]})=>{u.includes(n)&&u.splice(u.indexOf(n),1),h.includes(n)&&h.splice(h.indexOf(n),1)}),(o=this.publisher)==null||o.setViewConfig(i,t)})}setRemoteViewConfig(e,t,i){var n,a;if(!t)return(n=this.userMap[e])==null?void 0:n.setViewConfig(null,i);const r=ws(t);r.length!==0&&(r.forEach(o=>{var u;(u=this.publisher)==null||u.resetElement(o),Object.values(this.usersViewMap).forEach(({cameraViews:h=[],screenViews:g=[]})=>{h.includes(o)&&h.splice(h.indexOf(o),1),g.includes(o)&&g.splice(g.indexOf(o),1)})}),(a=this.userMap[e])==null||a.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=>{const{isAudioSubscribing:i,isVideoSubscribing:r,isScreenSubscribing:n}=t;return i||r||n})}onRemotePublishStateChange(e){var f;const{userid:t,callid:i,subscribe:r,pubid:n="",tracks:a}=e,o=(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,o,n,a),u.updateSubscribe(Be.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 Fa({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,parameter:this.parameter})),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 a=this.addUser(n,r.displayname,Be.InRoom),{callid:o,subscribe:u,tracks:h}=r;a.updateRemoteTracks(o,(u==null?void 0:u.pullstreamurl)||"","",h),this.emit("remoteTrackAvailableChange",n,a.streamInfo.audioTrackInfo,a.streamInfo.videoTrackInfo)}}),this.startStatsMonitor()}leave(){return O(this,null,function*(){var e;this.stopStatsMonitor(),Object.values(this.usersViewMap).forEach(({cameraViews:t=[],screenViews:i=[]})=>{t.forEach(r=>{r.srcObject=null,r._playPromise=void 0}),i.forEach(r=>{r.srcObject=null,r._playPromise=void 0})}),this.usersViewMap={};for(let t in this.userMap)this.userMap[t]&&(this.userMap[t].clear(),delete this.userMap[t]);(e=this.self)==null||e.leave(),this.localStreamManager.stop(),this.rtsManager.clear(),this.authInfo=void 0})}clear(){return O(this,null,function*(){var e;yield this.leave(),(e=this.self)==null||e.clear(),this.pluginManager.removeAll()})}startStatsMonitor(){this.statsMonitorId=window.setInterval(()=>O(this,null,function*(){if(this.publisher){const{audio:i,video:r,candidate: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(a=>{e.push(a)}),n&&n.forEach(a=>{t.push(a)})}e.length>0&&this.emit("rtcRemoteAudioStats",e),t.length>0&&this.emit("rtcRemoteVideoStats",t)}),2e3)}stopStatsMonitor(){this.statsMonitorId&&clearInterval(this.statsMonitorId)}addUser(e,t,i){return this.userMap[e]||(this.userMap[e]=this.executeAddUser(e,t,i)),this.userMap[e]}executeAddUser(e,t,i){const r=new O0({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,parameter:this.parameter});return r.on(rt.Remote,this.onRemoteDeviceStatusChange.bind(this)),r.on(Re.PullStreamStats,this.onRemoteStatReport.bind(this)),r.on(Re.RtsSubscribeExceeds,this.onSubscribeExceeds.bind(this)),r.on("audioSubscribeStateChanged",(n,a,o,u)=>{this.emit("audioSubscribeStateChanged",n,a,o,u,this.channel||"")}),r.on("videoSubscribeStateChanged",(n,a,o,u)=>{this.emit("videoSubscribeStateChanged",n,a,o,u,this.channel||"")}),r.on("screenSubscribeStateChanged",(n,a,o,u)=>{this.emit("screenSubscribeStateChanged",n,a,o,u,this.channel||"")}),r.on("dataSubscribeStateChanged",(n,a,o,u)=>{this.emit("dataSubscribeStateChanged",n,a,o,u,this.channel||"")}),r.on("remoteAudioAutoPlayFail",n=>{this.emit("remoteAudioAutoPlayFail",n)}),r.on("remoteVideoAutoPlayFail",(n,a)=>{this.emit("remoteVideoAutoPlayFail",n,a)}),r.on("remoteAudioPlayError",(n,a)=>{this.emit("remoteAudioPlayError",n,a)}),r.on("remoteVideoPlayError",(n,a)=>{this.emit("remoteVideoPlayError",n,a)}),r.on("remoteSubscribeError",n=>{this.emit("remoteSubscribeError",n,r.userId)}),r.on("occurError",n=>{this.emit("occurError",n,r.userId)}),r.on("remoteDataChannelMessage",(n,a)=>{this.emit("remoteDataChannelMessage",n,a)}),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===Re.MuteAudio?this.emit("userAudioMuted",t,!0):e===Re.UnmuteAudio?this.emit("userAudioMuted",t,!1):e===Re.MuteVideo?this.emit("userVideoMuted",t,!0):e===Re.UnmuteVideo?this.emit("userVideoMuted",t,!1):e===Re.MuteScreen?this.emit("userScreenMuted",t,!0):e===Re.UnmuteScreen&&this.emit("userScreenMuted",t,!1)}onRemoteStatReport(e,t,i){this.emit(Re.PullStreamStats,e,t,i)}onSubscribeExceeds(e,t){this.emit(Re.RtsSubscribeExceeds,e,t)}removeLeftUser(e){return O(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(o=>{o.userid&&(this.userMap[o.userid]?(i.push(o),r[o.userid]=this.userMap[o.userid]):(t.push(o),r[o.userid]=this.executeAddUser(o.userid,o.displayname,Be.Resume)))});const n=Object.keys(this.userMap),a=[];return n.forEach(o=>{r[o]||a.push({userid:o,reason:"",leavecode:xs.AliRtcUserOfflineQuit})}),this.userMap=r,{joinList:t,leaveList:a,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 Y(te.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubAudio(t),t?i.updateSubscribe(Be.User):i.stopSubscribe({audio:!0})}updateVideoWant(e,t){const i=this.userMap[e];if(!i)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubVideo(t),t?i.updateSubscribe(Be.User):i.stopSubscribe({video:!0})}updateScreenWant(e,t){const i=this.userMap[e];if(!i)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubScreen(t),t?i.updateSubscribe(Be.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)}setEnableDualVideoStream(e,t){if(!this.dualVideoPlugin)return;t&&this.dualVideoPlugin.setOptions(t);const i=this.pluginManager.has(this.dualVideoPlugin.name);e?!i&&this.pluginManager.add(this.dualVideoPlugin):i&&this.pluginManager.remove(this.dualVideoPlugin.name)}setAudioVolume(e){var t;(t=this.audioMixerPlugin)==null||t.setOptions(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=ve(ve({},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)}setParameter(e){var i,r,n;const t=JSON.parse(e);Object.keys(t).forEach(a=>{const o=this.parameter[a],u=t[a];typeof o=="object"&&typeof u=="object"?this.parameter[a]=ve(ve({},o),u):this.parameter[a]=u}),t.enableBlankAudio===!0?(this.blankAudioPlugin||(this.blankAudioPlugin=new q0),this.pluginManager.has((i=this.blankAudioPlugin)==null?void 0:i.name)||this.pluginManager.add(this.blankAudioPlugin)):t.enableBlankAudio===!1&&(this.blankAudioPlugin&&this.pluginManager.remove((r=this.blankAudioPlugin)==null?void 0:r.name),(n=this.blankAudioPlugin)==null||n.clear(),this.blankAudioPlugin=void 0)}getParameter(){return JSON.stringify(this.parameter)}sendDataChannelMessage(e){var t;return(t=this.self)==null?void 0:t.sendDataChannelMessage(e)}}_(tt,"logName","BizControl"),ct([j()],tt.prototype,"init",1),ct([j()],tt.prototype,"leave",1),ct([j()],tt.prototype,"clear",1),ct([j(ne)],tt.prototype,"addUser",1),ct([j()],tt.prototype,"removeLeftUser",1),ct([j()],tt.prototype,"updateUsers",1),ct([j(ne)],tt.prototype,"updateAudioWant",1),ct([j(ne)],tt.prototype,"updateVideoWant",1),ct([j(ne)],tt.prototype,"updateScreenWant",1),ct([j()],tt.prototype,"stopIndication",1),ct([j()],tt.prototype,"startIndication",1),ct([j(ne)],tt.prototype,"setEnableDualVideoStream",1),ct([j(ne)],tt.prototype,"setAudioVolume",1),ct([j()],tt.prototype,"enableAudioVolumeIndication",1);const Ps=s=>O(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 cu{constructor(c){_(this,"authInfo");_(this,"slsReporter");this.slsReporter=c}doRequest(c,e){var u;const t=this.authInfo;if(!t)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const i="https://gw.rtn.aliyuncs.com",r=a0[c],n={appid:t.appId,userid:t.userId,channelid:t.channelId,timestamp:t.timestamp,token:t.token,nonce:t.nonce?t.nonce:"",requestid:St.createCallid(),tokensid:!1,session:(u=t.sessionId)!=null?u:St.createCallid()},a=Object.keys(n).map(h=>`${h}=${encodeURIComponent(n[h])}`).join("&"),o=`${i}${r}?${a}`;return fetch(o,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(e)}).then(h=>h.status!==200?(this.slsReporter.reportTranscodingError(h.status,e.taskid||""),Promise.reject(new Y(te.ERR_INNER,`transcoding request failed, status: ${h.status}`))):h).catch(h=>Promise.reject(new Y(te.ERR_INNER,`transcoding request failed, err: ${h.message}`)))}setAuthInfo(c){this.authInfo=c}clear(){this.authInfo=void 0}startPublishLiveStream(c,e){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=yield Ps(c.split("?")[0]),i=ot.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(i,this.authInfo,t,c);return this.doRequest(i,r)})}startPublishLiveStreamWithTaskId(c,e){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=ot.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(t,this.authInfo,c);return this.doRequest(t,i)})}updatePublishLiveStream(c,e){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=yield Ps(c.split("?")[0]),i=ot.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(i,this.authInfo,t,c);return this.doRequest(i,r)})}updatePublishLiveStreamWithTaskId(c,e){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=ot.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(t,this.authInfo,c);return this.doRequest(t,i)})}stopPublishLiveStream(c){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const e=yield Ps(c.split("?")[0]),t=ot.MPU_TASK_TRANSACTION_STOP,i=new ji().toJson(t,this.authInfo,e,c);return this.doRequest(t,i)})}stopPublishLiveStreamWithTaskId(c){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const e=ot.MPU_TASK_TRANSACTION_STOP,t=new ji().toJson(e,this.authInfo,c);return this.doRequest(e,t)}refreshAuthInfo(c){this.authInfo&&this.setAuthInfo(ve(ve({},this.authInfo),c))}}class Bs{static checkString(c){return typeof c=="string"}static checkNumber(c){return typeof c=="number"}static checkHtmlVideoElement(c){return c&&c.nodeName==="VIDEO"}static checkHtmlAudioElement(c){return c&&c.nodeName==="AUDIO"}static checkAuthInfo(c){if(!c)return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no authInfo founded");if(!c.appId)return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no appId founded");if(!c.channelId)return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no channelId founded");if(!c.userId)return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no userId founded");if(c.timestamp){if(!Bs.checkNumber(c.timestamp))return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"timestamp is not number")}else return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no timestamp founded");return c.token?null:new Y(te.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 Ka{constructor(c){_(this,"taskProfile");_(this,"encodeParam");_(this,"users",[]);_(this,"backgroundColor",0);_(this,"backgrounds",[]);_(this,"watermarks",[]);_(this,"clockWidgets",[]);_(this,"cropMode");_(this,"mediaProcessMode");this.taskProfile=c}}class $a{constructor(c,e,t){_(this,"userId");_(this,"streamType");_(this,"sourceType");this.userId=c,this.streamType=e,this.sourceType=t}}class qa{constructor(c,e,t,i=0,r=16777215,n=Ai.NOTO_SERIF_CJKSC_REGULAR){_(this,"x");_(this,"y");_(this,"fontSize");_(this,"zOrder");_(this,"fontColor");_(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:vt(this.x,c),y:vt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:vs(this.fontColor),zorder:this.zOrder}}}var Ga=(s=>(s[s.NOT_DISPLAY=0]="NOT_DISPLAY",s[s.ALWAYS=1]="ALWAYS",s[s.WHEN_NO_VIDEO=2]="WHEN_NO_VIDEO",s))(Ga||{});class Ls{constructor(c,e,t,i,r,n=0,a=1,o=1){_(this,"url");_(this,"x");_(this,"y");_(this,"width");_(this,"height");_(this,"alpha");_(this,"display",1);_(this,"zOrder");this.url=c,this.x=e,this.y=t,this.width=i,this.height=r,this.zOrder=n,this.alpha=a,this.display=o}toJson(c,e){return{url:this.url,alpha:this.alpha,display:this.display,x:vt(this.x,c),y:vt(this.y,e),width:vt(this.width,c),height:vt(this.height,e),zorder:this.zOrder}}}_(Ls,"DisplayType",Ga);class Ja{constructor(c,e,t,i,r=0,n=16777215,a=Ai.NOTO_SERIF_CJKSC_REGULAR){_(this,"text");_(this,"x");_(this,"y");_(this,"fontSize");_(this,"zOrder");_(this,"fontColor");_(this,"fontType");this.text=c,this.x=e,this.y=t,this.fontSize=i,this.zOrder=r,this.fontColor=n,this.fontType=a}toJson(c,e){return{text:this.text,x:vt(this.x,c),y:vt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:vs(this.fontColor),zorder:this.zOrder}}}class Xa{constructor(c,e,t,i,r,n=0,a){_(this,"userId");_(this,"x");_(this,"y");_(this,"width");_(this,"height");_(this,"zOrder");_(this,"sourceType");_(this,"segmentType",yi.LiveTranscodingNoBody);_(this,"images",[]);_(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,a&&(this.sourceType=a)}toJson(c,e,t,i){const r={paneid:c,majorpane:0,x:vt(this.x,e),y:vt(this.y,t),width:vt(this.width,e),height:vt(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&&_i[this.sourceType]?r.sourcetype=_i[this.sourceType]:r.sourcetype=_i[oi.LiveTranscodingCamera],this.segmentType&&i===zi.LiveTranscodingVirtualBackground?r.segmenttype=this.segmentType:r.segmenttype=yi.LiveTranscodingNoBody,r}}var uu=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,de=(s,c,e,t)=>{for(var i=t>1?void 0:t?hu(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&&uu(c,e,i),i};const he=(fe=class extends xe{constructor(e){super();_(this,"channelProfile");_(this,"clientRole");_(this,"signalingManager");_(this,"bizControl");_(this,"liveTranscoding");_(this,"maxSignalingConnectRetryCount");_(this,"slsReporter");_(this,"connectState",ke.AliRtcConnectionStatusInit);_(this,"networkError",!1);_(this,"_audioOnlyMode",!1);_(this,"_authInfoWillExpireTimer",null);_(this,"_authInfoExpiredTimer",null);_(this,"_serverCheckAuthInfoTimestamp",null);_(this,"_localCheckAuthInfoTimestamp",null);const t=Date.now();this.slsReporter=new vi(this),this.channelProfile=Tt.AliRtcSdkCommunication,this.clientRole=Mt.AliRtcSdkLive,this.liveTranscoding=new cu(this.slsReporter),this.signalingManager=new Es(this.channelProfile,this.clientRole,this.slsReporter,(e==null?void 0:e.env)===Dt.pre?Dt.pre:Dt.prod),this.addSignalingManagerListeners(),this.maxSignalingConnectRetryCount=e==null?void 0:e.maxSignalingConnectRetryCount,this.bizControl=new tt({slsReporter:this.slsReporter,signalingManager:this.signalingManager}),this.addBizControlListeners(),this.addPublisherListeners(),this.slsReporter.reportSDKCreated(t)}static getSdkVersion(){return mr}static setLogLevel(e){ae.setLogLevel(e)}static getInstance(e){return fe._instance||(fe._instance=new fe(e)),fe._instance}destroy(){return O(this,null,function*(){fe._instance=void 0,yield this.leaveChannel(),yield this.bizControl.clear()})}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===Tt.AliRtcSdkCommunication||this.clientRole===Mt.AliRtcSdkInteractive}addPublisherListeners(){var e,t,i,r,n,a,o,u,h,g;(e=this.publisher)==null||e.on(rt.Local,f=>{ae.event("[Publisher] Device Status Change",f),this.onLocalDeviceStatusChange(f)}),(t=this.publisher)==null||t.on(ti.VideoTrackEnded,()=>{ae.event("[Publisher] VideoTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeCamera,He.AliEngineLocalDeviceExceptionTypeCameraInterrupt,"")}),(i=this.publisher)==null||i.on(ti.ScreenTrackEnded,()=>{ae.event("[Publisher] ScreenTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeDisplay,He.AliEngineLocalDeviceExceptionTypeDisplayException,"")}),(r=this.publisher)==null||r.on(ti.AudioTrackEnded,()=>{ae.event("[Publisher] AudioTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeMic,He.AliEngineLocalDeviceExceptionTypeMicInterrupt,"")}),(n=this.publisher)==null||n.on("localDeviceException",(f,l,p="")=>{this.emit("localDeviceException",f,l,p)}),(a=this.publisher)==null||a.on("audioPublishStateChanged",(f,l,p)=>{var d;this.emit("audioPublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")}),(o=this.publisher)==null||o.on("videoPublishStateChanged",(f,l,p)=>{var d;this.emit("videoPublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")}),(u=this.publisher)==null||u.on("dualStreamPublishStateChanged",(f,l,p)=>{var d;this.emit("dualStreamPublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")}),(h=this.publisher)==null||h.on("screenPublishStateChanged",(f,l,p)=>{var d;this.emit("screenSharePublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")}),(g=this.publisher)==null||g.on("dataPublishStateChanged",(f,l,p)=>{var d;this.emit("dataPublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")})}occurError(e,t){this.emit("onOccurError",e,t),this.emit("occurError",e,t)}addBizControlListeners(){this.bizControl.rtsManager.on("connected",e=>{var t;e&&((t=this.publisher)==null||t.publishUpdate(),this.remoteUsers.forEach(i=>{i.updateSubscribe(Be.Reconnect)}))}),this.bizControl.rtsManager.on("disconnected",()=>O(this,null,function*(){ae.event(`[${fe.logName}]`,"RTS Disconnected"),(yield St.isNetworkAvailable())?this.onNetworkRecovery():this.onNetworkError()})),this.bizControl.rtsManager.on("subscribeexceeds",()=>O(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(rt.Remote,(e,t)=>{ae.event(`[${fe.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("dataSubscribeStateChanged",(e,t,i,r,n)=>{this.emit("dataSubscribeStateChanged",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("remoteAudioPlayError",(e,t)=>{this.emit("remoteAudioPlayError",e,t)}),this.bizControl.on("remoteVideoPlayError",(e,t)=>{this.emit("remoteVideoPlayError",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,t)=>{this.occurError(e,t),this.slsReporter.reportError(e)}),this.bizControl.on("occurError",(e,t)=>{this.occurError(e,t),this.slsReporter.reportError(e)}),this.bizControl.on("remoteDataChannelMessage",(e,t)=>{this.emit("dataChannelMsg",e,t)})}addSignalingManagerListeners(){this.signalingManager.on("onKeepAliveRsp",()=>{this.networkError&&(ae.event("[Signaling] Receive KeepAlive Response",`networkError: ${this.networkError}`),this.onNetworkRecovery())}),this.signalingManager.on("onNotifyJoin",e=>{ae.event("[Signaling] Notify Join ",e),this.handleUsersJoin(e),e.forEach(t=>{this.emit("remoteUserOnLineNotify",t.userid,0)})}),this.signalingManager.on("onNotifyStatus",e=>{ae.event("[Signaling] Notify Status ",e),e.forEach(t=>{this.bizControl.updateRemoteUserDeviceStatus(t)})}),this.signalingManager.on("onNotifyLeave",e=>{ae.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)=>{ae.event("[Signaling] Bye ",e,t),this.slsReporter.reportError({message:`reason: ${e}, description: ${t}`}),this.emit("bye",e),this.leaveChannel(),this.slsReporter.reportBye(e)}),this.signalingManager.on("onConnectFail",e=>{ae.event("[Signaling] Connect Failed ",e),this.onError(e),this.backToUnpublishStatus(),this.connectState=ke.AliRtcConnectionStatusFailed,this.emit("connectionStatusChange",ke.AliRtcConnectionStatusFailed,Yt.AliRtcConnectionChangedNetworkInterrupted)}),this.signalingManager.on("onNetworkError",e=>{this.slsReporter.reportWarning("signaling network error"),ae.event("[Signaling] Network error ",e),this.onNetworkError()}),this.signalingManager.on("onAuthInvalid",()=>{ae.event("[Signaling] Auth Invalid")}),this.signalingManager.on("onReconnectStart",()=>{ae.event("[Signaling] Reconnect Start "),this.connectState=ke.AliRtcConnectionStatusReconnecting,this.emit("connectionStatusChange",ke.AliRtcConnectionStatusReconnecting,Yt.AliRtcConnectionSignalingConnecting)}),this.signalingManager.on("onReconnectSuccess",e=>{ae.event("[Signaling] Reconnect Success ",e),this.onNetworkRecovery(e)}),this.signalingManager.on("onReconnectFail",e=>{this.slsReporter.reportWarning("signaling reconnect fail: ${err.code}"),ae.event("[Signaling] Reconnect Failed ",e),e.code===403&&this.emit("authInfoExpired")}),this.signalingManager.on("onError",e=>{this.slsReporter.reportWarning("signaling error: ${err.message}"),ae.event("[Signaling] Error ",e),this.onError(e)})}backToUnpublishStatus(){var e,t;this.connectState=ke.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,Be.Join);ae.event(`[${fe.logName}]`,Re.UserJoined,r)}})}onLocalDeviceStatusChange(e){ae.event(`[${fe.logName}]`,rt.Local,e),this.signalingManager.reportStatus(e).then(()=>{ae.debug("[signaling] reportStatus suc")}).catch(t=>{ae.error("[signaling] reportStatus failed",t)})}resumePublishForNetworkRecovery(){return O(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((a,o)=>{const u=setInterval(()=>O(this,null,function*(){var h;n>1&&(clearInterval(u),o()),n+=1;try{yield(h=this.publisher)==null?void 0:h.resumePublish(),clearInterval(u),a()}catch(g){const{code:f}=g;f!==10205&&(clearInterval(u),o())}}),1e3)})}catch(a){}}throw t}})}onNetworkRecovery(e){return O(this,null,function*(){var t;ae.event(fe.logName,"onNetworkRecovery",`rts isConnected: ${this.bizControl.rtsManager.isConnected}; rts isConnecting: ${this.bizControl.rtsManager.isConnecting}`,{users:e}),!this.bizControl.rtsManager.isConnected&&!this.bizControl.rtsManager.isConnecting&&(yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList(e)),this.networkError&&(this.networkError=!1,(t=this.publisher)==null||t.reportSelfDeviceStatus(),this.connectState=ke.AliRtcConnectionStatusConnected,this.emit("connectionStatusChange",ke.AliRtcConnectionStatusConnected,Yt.AliRtcConnectionSignalingHeartbeatAlive))})}resumeSubList(e){return O(this,null,function*(){if(e!=null&&e.length){const{joinList:t,leaveList:i,presentList:r}=this.bizControl.updateUsers(e);ae.info(`[${fe.logName}]`,"resumeSubList",{joinList:t,leaveList:i,presentList:r}),this.handleUsersJoin(t),i.forEach(n=>{ae.event(fe.logName,Re.UserLeft,n.userid,n.reason),this.emit("remoteUserOffLineNotify",n.userid,xs.AliRtcUserOfflineQuit)});for(let n=0;n<r.length;n++){const a=r[n],o=a.userid,u=this.bizControl.getRemoteUser(o);this.bizControl.onRemotePublishStateChange(a),u==null||u.restore(),u==null||u.updateSubscribe(Be.Resume)}}else for(let t=0;t<this.remoteUsers.length;t++){const i=this.remoteUsers[t];try{i.restore(),i.updateSubscribe(Be.Resume)}catch(r){}}})}retrySubscribe(e){return O(this,null,function*(){const t=this.bizControl.getRemoteUser(e);if(!t)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);t.restore(),t.updateSubscribe(Be.Retry)})}onNetworkError(){this.connectState===ke.AliRtcConnectionStatusConnected&&(this.networkError||(this.connectState=ke.AliRtcConnectionStatusDisconnected,this.emit("connectionStatusChange",ke.AliRtcConnectionStatusDisconnected,Yt.AliRtcConnectionChangedNetworkInterrupted)),this.networkError=!0)}onError(e){this.slsReporter.reportError(e),ae.event(fe.logName,Re.Error,e)}setEnableDualVideoStream(e,t){this.bizControl.setEnableDualVideoStream(e,t)}hadPushStream(e){if(!(this.publisher&&e))throw new Y(te.ERR_INNER,"stream is not publishing")}getCurrentMicDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentMicDeviceId()}setChannelProfile(e){if(![ke.AliRtcConnectionStatusInit,ke.AliRtcConnectionStatusDisconnected,ke.AliRtcConnectionStatusFailed].includes(this.connectState))throw new Y(te.ERR_INNER,"cannot set channel profile in call");this.channelProfile=e,this.channelProfile===Tt.AliRtcSdkCommunication&&(this.clientRole=Mt.AliRtcSdkLive),this.signalingManager.setChannelProfile(e)}startAndPublishDefaultDevices(e){return O(this,null,function*(){var a,o,u,h,g;if(!this.publisher)return;const{hasCamera:t,hasMicrophone:i,hasScreenShare:r}=this.publisher;if(t||i||r)return;try{yield(a=this.publisher)==null?void 0:a.startDefaultCamera(this._audioOnlyMode)}catch(f){ae.warn(`[${fe.logName}]`,"startDefaultCamera failed",f.code,f.message),f instanceof Y&&this.occurError(f),this.occurError(new Y(te.ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED,`auto start video failed, ${f.message||""}`))}try{yield(o=this.publisher)==null?void 0:o.startDefaultAudio()}catch(f){ae.warn(`[${fe.logName}]`,"startDefaultAUdio failed",f.code,f.message),f instanceof Y&&this.occurError(f),this.occurError(new Y(te.ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED,`auto start audio failed, ${f.message||""}`))}yield(u=this.publisher)==null?void 0:u.previewAll();const n=((h=this.publisher)==null?void 0:h.publishStreams)||{};if(Object.values(n).some(f=>f))try{yield(g=this.publisher)==null?void 0:g.startPublish(!1,e)}catch(f){const l=[];n!=null&&n.audio&&l.push(te.ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED),n!=null&&n.video&&l.push(te.ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED),l.forEach(p=>{this.occurError(new Y(p,`auto publish stream failed, ${f.message||""}`))})}})}setClientRole(e){return O(this,null,function*(){var t,i;try{if(this.channelProfile===Tt.AliRtcSdkCommunication)return;if(!Object.values(Mt).includes(e))throw new Y(te.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===Mt.AliRtcSdkInteractive?(this.bizControl.isSubscribing?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.startAndPublishDefaultDevices(Bt.JOIN_CHANNEL)):yield this.signalingManager.setClientRole(e),this.clientRole=e}catch(r){throw r.code===403&&this.emit("authInfoExpired"),r}})}getCurrentClientRole(){return this.clientRole}setAudioOnlyMode(e){if(this.isInCall())throw new Y(te.ERR_INNER,"can not change audioOnly mode in call");this._audioOnlyMode=e}setAudioRedEnabled(e){if(this.isInCall())throw new Y(te.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)}joinChannel(e,t){return O(this,null,function*(){var o,u;let i,r=t;if(typeof e=="string")try{const h=JSON.parse(window.atob(e));i={appId:h.appid,channelId:h.channelid,userId:h.userid,timestamp:h.timestamp,nonce:h.nonce,token:h.token}}catch(h){throw new Y(te.ERR_INVALID_ARGUMENTS,`authInfo is invalid: ${h.message||""}`)}else i=e;r||(r=i.userId);const n={start:Date.now()};let a=Bs.checkAuthInfo(i);if(ke.AliRtcConnectionStatusInit===this.connectState||ke.AliRtcConnectionStatusDisconnected===this.connectState||ke.AliRtcConnectionStatusFailed===this.connectState){if(this.connectState=ke.AliRtcConnectionStatusConnecting,a)throw this.connectState=ke.AliRtcConnectionStatusFailed,this.slsReporter.reportJoin(a.code,n,""),this.slsReporter.reportJoinResult(a),a;i.sessionId=St.createCallid("web"),ae.setSessionID(i.appId,i.sessionId),this.slsReporter.start(i);try{const h=yield this.signalingManager.join(i,r,this.maxSignalingConnectRetryCount,n);this.connectState=ke.AliRtcConnectionStatusConnected,(o=this.publisher)==null||o.reportSelfDeviceStatus(),this.bizControl.init(i,h),this.setCheckAuthInfoTimer(i.timestamp,h.timestamp),this.liveTranscoding.setAuthInfo(i),this.slsReporter.reportJoin(0,n,h.tid),this.slsReporter.reportJoinResult(null)}catch(h){const g=(u=h.code)!=null?u:-1,f=h.reason||h.message||"";throw this.connectState=ke.AliRtcConnectionStatusDisconnected,this.slsReporter.reportJoin(g,n,""),this.slsReporter.reportJoinResult(h),new Y(g,f)}this.currentRoleCanPublish&&(yield this.startAndPublishDefaultDevices(Bt.ROLE_CHANGE)),this.remoteUsers.forEach(h=>{h.updateSubscribe(Be.Join)})}else{const h=new Y(te.ERR_JOIN_ALREADY_JOINED,"already joined");throw this.connectState===ke.AliRtcConnectionStatusConnecting&&(h.message="Repeated operation during login"),this.slsReporter.reportJoin(h.code,n,""),h}})}leaveChannel(){return O(this,null,function*(){var t;this.slsReporter.reportLeaveInvoked();let e=new Date().getTime();if(ke.AliRtcConnectionStatusConnected===this.connectState)try{let i;i=yield this.signalingManager.leave(),this.slsReporter.reportLeave(new Date().getTime()-e,0,(t=i==null?void 0:i.tid)!=null?t:""),ae.uploadLog()}catch(i){this.slsReporter.reportLeave(new Date().getTime()-e,i.code,i.reason)}else this.slsReporter.reportLeave(0,0,"");this.networkError=!1,this.connectState=ke.AliRtcConnectionStatusDisconnected,this.clearCheckAuthInfoTimer(),yield this.bizControl.leave(),this.liveTranscoding.clear(),this.slsReporter.stop(),this.signalingManager.reset()})}isInCall(){return this.connectState===ke.AliRtcConnectionStatusConnected}refreshAuthInfo(e){return O(this,null,function*(){let t;if(typeof e=="string")try{const h=JSON.parse(window.atob(e));t={userId:h.userid,timestamp:h.timestamp,nonce:h.nonce,token:h.token}}catch(h){throw new Y(te.ERR_INVALID_ARGUMENTS,`authInfo is invalid: ${h.message||""}`)}else t=e;const{userId:i,nonce:r,timestamp:n,token:a,role:o}=t,u={userId:i,nonce:r,timestamp:n,token:a,role:o};try{yield this.signalingManager.refreshAuthInfo(u),this.bizControl.refreshAuthInfo(u),this.liveTranscoding.refreshAuthInfo(u),this.clearCheckAuthInfoTimer(),this._serverCheckAuthInfoTimestamp&&this._localCheckAuthInfoTimestamp&&t.timestamp&&this.setCheckAuthInfoTimer(t.timestamp,this._serverCheckAuthInfoTimestamp+(Date.now()-this._localCheckAuthInfoTimestamp))}catch(h){throw h}})}isAudioOnly(){return this._audioOnlyMode}publishLocalAudioStream(e){return O(this,null,function*(){var t,i,r,n;(t=this.publisher)==null||t.setPublishLocalAudioStreamEnabled(e),this.connectState===ke.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasMicrophone?yield(r=this.publisher)==null?void 0:r.updateStreams():yield this.startAudioCapture():yield(n=this.publisher)==null?void 0:n.publishUpdate())})}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 Y(te.ERR_INVALID_ARGUMENTS,"subscribeAllRemoteAudioStreams(true) must be called first");this.bizControl.updateAudioWant(e,t)}resumeRemoteAudioStream(e){const t=this.bizControl.getRemoteUser(e);if(!t)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);t.resumeAudio()}stopRemoteAudioPlay(e){const t=this.bizControl.getRemoteUser(e);if(!t)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);t.stopPlayAudio()}publishLocalVideoStream(e){return O(this,null,function*(){var t,i,r,n;(t=this.publisher)==null||t.setPublishLocalVideoStreamEnabled(e),this.connectState===ke.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasCamera?yield(r=this.publisher)==null?void 0:r.updateStreams():yield this.enableLocalVideo():yield(n=this.publisher)==null?void 0:n.publishUpdate())})}isLocalVideoStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalVideoStreamEnabled)!=null?t:!0}setRemoteDefaultVideoStreamType(e){[Ge.AliRtcVideoStreamTypeHigh,Ge.AliRtcVideoStreamTypeLow].includes(e)&&this.bizControl.setRemoteDefaultVideoStreamType(e)}setRemoteUserVideoStreamType(e,t){[Ge.AliRtcVideoStreamTypeHigh,Ge.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 Y(te.ERR_INNER,`no remote user(${e}) founded`);i&&(t===Ae.AliRtcVideoTrackScreen||t===Ae.AliRtcVideoTrackBoth)?n.setWantSubScreen(!0):n.setWantSubScreen(!1),i&&(t===Ae.AliRtcVideoTrackCamera||t===Ae.AliRtcVideoTrackBoth)?n.setWantSubVideo(!0):n.setWantSubVideo(!1),n.setWantSubAudio(r),n.updateSubscribe(Be.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 O(this,null,function*(){var a;const t={video:!1,audio:!1},{audio:i=!1,videoTrack:r,audioTrack:n}=e||{};if(r||n){t.screen=!0;const o=new MediaStream;r&&o.addTrack(r),n&&o.addTrack(n),t.mediaStream=o}else t.screen=i?{audio:!0}:!0;yield(a=this.publisher)==null?void 0:a.createLocalStream(t)})}stopScreenShare(){return O(this,null,function*(){var e;(e=this.publisher)==null||e.stopLocalStream({screen:!0})})}setScreenShareConfiguration(e){return O(this,null,function*(){var r;const{frameRate:t=Ci.frameRate,bitrate:i=Ci.maxBitrate}=e;yield(r=this.publisher)==null?void 0:r.setScreenProfile(ka,{width:Ci.width,height:Ci.height,frameRate:t,maxBitrate:i})})}setScreenShareContentHint(e){return O(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setScreenContentHint(e))})}publishLocalScreenShareStream(e,t){return O(this,null,function*(){var i,r,n;(i=this.publisher)==null||i.setPublishLocalScreenStreamEnabled(e),this.connectState===ke.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.hasScreenShare?yield this.publisher.updateStreams():yield this.startScreenShare(t):yield(n=this.publisher)==null?void 0:n.publishUpdate())})}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 Y(te.ERR_INVALID_ARGUMENTS,"volume must be a number");this.bizControl.setAudioVolume({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?Re.MuteAudio:Re.UnmuteAudio),(t=this.publisher)==null||t.muteLocalMic(e)}muteRemoteAudioPlaying(e,t=!1){const i=this.bizControl.getRemoteUser(e);if(!i)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);i.setAudioMuted(t)}muteAllRemoteAudioPlaying(e=!1){this.bizControl.setAudioMuted(e)}startAudioCapture(e){return O(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 O(this,null,function*(){var i,r,n,a;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(a=this.publisher)==null?void 0:a.createLocalStream({audio:{deviceId:e}})}})}setRecordingVolume(e){if(typeof e!="number")throw new Y(te.ERR_INVALID_ARGUMENTS,"volume must be a number");this.bizControl.setAudioVolume({audio:Math.max(0,Math.min(e,400))/100})}setPlayoutVolume(e){if(typeof e!="number")throw new Y(te.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 Y(te.ERR_INNER,`no remote user(${e}) founded`);if(typeof t!="number")throw new Y(te.ERR_INVALID_ARGUMENTS,"volume must be a number");i.setPlayoutVolume(Math.max(0,Math.min(t,100))/100)}setAudioProfile(e){return O(this,null,function*(){var t;yield(t=this.publisher)==null?void 0:t.setAudioProfile(e)})}getAudioTrack(e){return O(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 O(this,null,function*(){var i,r,n;if(this._audioOnlyMode)throw new Y(te.ERR_INNER,"Cannot set local view in audio only mode");(i=this.bizControl)==null||i.setLocalViewConfig(e,t),t===Ae.AliRtcVideoTrackCamera&&((r=this.publisher)!=null&&r.hasCamera)?yield this.startPreview():t===Ae.AliRtcVideoTrackScreen&&((n=this.publisher)!=null&&n.hasScreenShare)&&(yield this.startPreviewScreen())})}setCameraCapturerConfiguration(e){return O(this,null,function*(){var u,h,g;const{width:t=wi.width,height:i=wi.height,frameRate:r=wi.frameRate,bitrate:n=wi.maxBitrate,cameraDirection:a,deviceId:o}=e;yield(u=this.publisher)==null?void 0:u.setVideoProfile(Ta,{width:t,height:i,frameRate:r,maxBitrate:n}),a!==void 0&&((h=this.publisher)==null||h.setCameraDirection(a)),o&&((g=this.publisher)==null||g.setCameraDeviceId(o))})}setCameraCapturerContentHint(e){return O(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setVideoContentHint(e))})}enableLocalVideo(e=!0){return O(this,null,function*(){var t,i,r,n,a,o,u,h,g,f,l;if(this._audioOnlyMode)throw new Y(te.ERR_INNER,"Cannot enable local video in audio only mode");e?((i=(t=this.publisher)==null?void 0:t.publishStreams)!=null&&i.video&&((a=(n=(r=this.publisher)==null?void 0:r.publishStreams)==null?void 0:n.video)==null||a.disableVideo(),(g=(h=(u=(o=this.publisher)==null?void 0:o.publishStreams)==null?void 0:u.video)==null?void 0:h.videoTrack)==null||g.stop()),yield(f=this.publisher)==null?void 0:f.startCameraCapture()):yield(l=this.publisher)==null?void 0:l.stopCameraCapture()})}muteLocalCamera(e){return O(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Re.MuteVideo:Re.UnmuteVideo),(t=this.publisher)==null||t.muteLocalCamera(e)})}muteLocalScreen(e){return O(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Re.MuteScreen:Re.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 O(this,null,function*(){var r,n,a,o,u,h,g,f,l,p,d,m,v;if(this._audioOnlyMode)throw new Y(te.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"?Ei.CAMERA_FRONT:Ei.CAMERA_REAR,this.slsReporter.reportSwitchCamera(((n=this.publisher)==null?void 0:n.cameraDirection)||"")),yield this.setCameraCapturerConfiguration(i),!((a=this.publisher)!=null&&a.cameraCaptureDisabled)){(u=(o=this.publisher)==null?void 0:o.publishStreams)!=null&&u.video&&((f=(g=(h=this.publisher)==null?void 0:h.publishStreams)==null?void 0:g.video)==null||f.disableVideo(),(m=(d=(p=(l=this.publisher)==null?void 0:l.publishStreams)==null?void 0:p.video)==null?void 0:d.videoTrack)==null||m.stop());const b={video:!0};t&&(b.mediaStream=new MediaStream([t])),yield(v=this.publisher)==null?void 0:v.createLocalStream(b)}})}getCurrentCameraDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentCameraDeviceId()}startPreview(){return O(this,null,function*(){var e,t;if(this._audioOnlyMode)throw new Y(te.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 O(this,null,function*(){var t,i;if(this._audioOnlyMode)throw new Y(te.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 O(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!0,screen:!1})})}stopPreviewScreen(){return O(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!1,screen:!0})})}getVideoTrack(e){return O(this,null,function*(){var n,a,o,u;const{userId:t,streamType:i}=e;if(!t)return i===We.AliRtcSdkStreamTypeCapture?(n=this.publisher)==null?void 0:n.cameraTrack:(a=this.publisher)==null?void 0:a.screenTrack;const r=this.bizControl.getRemoteUser(t);return i===We.AliRtcSdkStreamTypeCapture?(o=r==null?void 0:r.getCameraStream)==null?void 0:o.videoTrack:(u=r==null?void 0:r.getScreenStream)==null?void 0:u.videoTrack})}startPublishLiveStream(e,t){return O(this,null,function*(){return this.liveTranscoding.startPublishLiveStream(e,t)})}updatePublishLiveStream(e,t){return O(this,null,function*(){return this.liveTranscoding.updatePublishLiveStream(e,t)})}updatePublishLiveStreamWithTaskId(e,t){return this.liveTranscoding.updatePublishLiveStreamWithTaskId(e,t)}stopPublishLiveStream(e){return O(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 O(this,null,function*(){return this.sendMediaExtensionMsgEx(e,t,5)})}sendMediaExtensionMsgEx(e,t,i){return O(this,null,function*(){var r;if(!this.publisher||!this.isPublishing)throw new Y(te.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 Y(Vt.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 Y(Vt.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 Y(Vt.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 Y(Vt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const i={segmentBackgroundProcess:{type:0,enable:e}};e&&(i.setSegmentBackgroundImage={type:0,backgroundImgUrl:""}),t.setOptions(i)}setParameter(e){this.bizControl.setParameter(e)}getParameter(){return this.bizControl.getParameter()}sendDataChannelMessage(e){this.bizControl.sendDataChannelMessage(e)}},_(fe,"logName","AliRtcEngine"),_(fe,"logError",!0),_(fe,"isSupported",r0),_(fe,"isDualVideoStreamSupported",ks.isSupport),_(fe,"getCameraList",()=>O(fe,null,function*(){return(yield pe.AliRTS.getCameraList()).filter(t=>t.deviceId)})),_(fe,"getMicrophoneList",()=>O(fe,null,function*(){return(yield pe.AliRTS.getMicList()).filter(t=>t.deviceId)})),_(fe,"getSpeakerList",()=>O(fe,null,function*(){return(yield pe.AliRTS.getSpeakerList()).filter(t=>t.deviceId)})),_(fe,"_instance"),_(fe,"AliRtcSdkChannelProfile",Tt),_(fe,"AliRtcSdkClientRole",Mt),_(fe,"AliRtcVideoStreamType",Ge),_(fe,"AliRtcVideoTrack",Ae),_(fe,"AliRtcAudioTrack",ci),_(fe,"AliRtcPublishState",be),_(fe,"AliRtcSubscribeState",Pe),_(fe,"AliRtcRawDataStreamType",We),_(fe,"AliRtcLogLevel",ds),_(fe,"AliRtcEngineLocalDeviceType",wt),_(fe,"AliRtcEngineLocalDeviceExceptionType",He),_(fe,"AliRtcConnectionStatus",ke),_(fe,"AliRtcConnectionStatusChangeReason",Yt),_(fe,"AliRtcPlugin",Zt),_(fe,"AliRtcPluginTrackType",xi),_(fe,"AliRtcLiveTranscodingParam",ji),_(fe,"AliRtcLiveTranscodingEncodeParam",bs),_(fe,"AliRtcLiveTranscodingMixParam",Ka),_(fe,"AliRtcLiveTranscodingSingleParam",$a),_(fe,"AliRtcTranscodingClockWidget",qa),_(fe,"AliRtcTranscodingImage",Ls),_(fe,"AliRtcTranscodingText",Ja),_(fe,"AliRtcTranscodingUser",Xa),_(fe,"AliRtcLiveTranscodingMixMode",Si),_(fe,"AliRtcLiveTranscodingStreamType",ls),_(fe,"AliRtcLiveTranscodingSourceType",oi),_(fe,"AliRtcLiveTranscodingTaskProfile",fs),_(fe,"AliRtcLiveTranscodingAudioSampleRate",Hi),_(fe,"AliRtcLiveTranscodingSegmentType",yi),_(fe,"AliRtcLiveTranscodingFontType",Ai),_(fe,"AliRtcLiveTranscodingCropMode",ps),_(fe,"AliRtcLiveTranscodingMediaProcessMode",zi),_(fe,"AliRtcLiveTranscodingState",ms),_(fe,"AliRtcLiveTranscodingErrorCode",Et),_(fe,"AliRtcTrascodingPublishTaskStatus",gs),_(fe,"AliRtcDataChannelMsg",ei),_(fe,"AliRtcDataMsgType",Cs),_(fe,"Plugin",Zt),fe);de([j()],he.prototype,"destroy",1),de([j()],he.prototype,"backToUnpublishStatus",1),de([j()],he.prototype,"resumePublishForNetworkRecovery",1),de([j()],he.prototype,"onNetworkRecovery",1),de([j()],he.prototype,"resumeSubList",1),de([j(ne)],he.prototype,"retrySubscribe",1),de([j(ne)],he.prototype,"setEnableDualVideoStream",1),de([j(ne)],he.prototype,"setChannelProfile",1),de([j(ne)],he.prototype,"setClientRole",1),de([j(ne)],he.prototype,"setAudioOnlyMode",1),de([j()],he.prototype,"clearCheckAuthInfoTimer",1),de([j(ne)],he.prototype,"joinChannel",1),de([j(ne)],he.prototype,"leaveChannel",1),de([j(ne)],he.prototype,"refreshAuthInfo",1),de([j(ne)],he.prototype,"publishLocalAudioStream",1),de([j(ne)],he.prototype,"setDefaultSubscribeAllRemoteAudioStreams",1),de([j(ne)],he.prototype,"subscribeAllRemoteAudioStreams",1),de([j(ne)],he.prototype,"subscribeRemoteAudioStream",1),de([j(ne)],he.prototype,"resumeRemoteAudioStream",1),de([j(ne)],he.prototype,"stopRemoteAudioPlay",1),de([j(ne)],he.prototype,"publishLocalVideoStream",1),de([j(ne)],he.prototype,"setRemoteDefaultVideoStreamType",1),de([j(ne)],he.prototype,"setRemoteUserVideoStreamType",1),de([j(ne)],he.prototype,"setDefaultSubscribeAllRemoteVideoStreams",1),de([j(ne)],he.prototype,"subscribeAllRemoteVideoStreams",1),de([j(ne)],he.prototype,"subscribeRemoteMediaStream",1),de([j(ne)],he.prototype,"resumeRemoteMediaStream",1),de([j(([s])=>[`${s==null?void 0:s.audio}`])],he.prototype,"startScreenShare",1),de([j()],he.prototype,"stopScreenShare",1),de([j(ne)],he.prototype,"setScreenShareConfiguration",1),de([j(ne)],he.prototype,"setScreenShareContentHint",1),de([j()],he.prototype,"publishLocalScreenShareStream",1),de([j(ne)],he.prototype,"setAudioShareVolume",1),de([j(ne)],he.prototype,"enableAudioVolumeIndication",1),de([j(ne)],he.prototype,"muteLocalMic",1),de([j(ne)],he.prototype,"muteRemoteAudioPlaying",1),de([j(ne)],he.prototype,"muteAllRemoteAudioPlaying",1),de([j(ne)],he.prototype,"startAudioCapture",1),de([j()],he.prototype,"stopAudioCapture",1),de([j(ne)],he.prototype,"switchMicrophone",1),de([j(ne)],he.prototype,"setRecordingVolume",1),de([j(ne)],he.prototype,"setPlayoutVolume",1),de([j(ne)],he.prototype,"setRemoteAudioVolume",1),de([j(ne)],he.prototype,"setAudioProfile",1),de([j(ne)],he.prototype,"getAudioTrack",1),de([j(ne)],he.prototype,"setLocalViewConfig",1),de([j(ne)],he.prototype,"setCameraCapturerConfiguration",1),de([j(ne)],he.prototype,"setCameraCapturerContentHint",1),de([j(ne)],he.prototype,"enableLocalVideo",1),de([j(ne)],he.prototype,"muteLocalCamera",1),de([j(ne)],he.prototype,"muteLocalScreen",1),de([j(ne)],he.prototype,"setRemoteViewConfig",1),de([j(ne)],he.prototype,"switchCamera",1),de([j()],he.prototype,"startPreview",1),de([j()],he.prototype,"startPreviewScreen",1),de([j()],he.prototype,"stopPreview",1),de([j()],he.prototype,"stopPreviewScreen",1),de([j()],he.prototype,"startPublishLiveStream",1),de([j()],he.prototype,"updatePublishLiveStream",1),de([j()],he.prototype,"updatePublishLiveStreamWithTaskId",1),de([j()],he.prototype,"stopPublishLiveStream",1),de([j()],he.prototype,"stopPublishLiveStreamWithTaskId",1),de([j(ne)],he.prototype,"setEnableMediaExtensionMsg",1),de([j(([s,c,e])=>[s.byteLength,c,e])],he.prototype,"sendMediaExtensionMsgEx",1),de([j(([s,c])=>[s.name||"",c])],he.prototype,"enablePlugin",1),de([j(ne)],he.prototype,"removePlugin",1),de([j(ne)],he.prototype,"setPluginOption",1),de([j(ne)],he.prototype,"getPluginOption",1),de([j(ne)],he.prototype,"setBeautyEffect",1),de([j(ne)],he.prototype,"enableBackgroundExchange",1),de([j(ne)],he.prototype,"enableBackgroundBlur",1),de([j(ne)],he.prototype,"setParameter",1),de([j(([s])=>{var c;return[(c=s.data)==null?void 0:c.byteLength]})],he.prototype,"sendDataChannelMessage",1),de([j(ne)],he,"setLogLevel",1);let Za=he;const Ya=new lr({businessName:"imp-web-rtc",version:(Qa=Za.getSdkVersion())!=null?Qa:"unknown",env:"prod",disabled:window.AliRtcOptionsDisableProxy===!0});Ya.setReady();const du=Ya.wrap(Za);ue.AliRtcConnectionStatus=ke,ue.AliRtcConnectionStatusChangeReason=Yt,ue.AliRtcDataChannelMsg=ei,ue.AliRtcDataMsgType=Cs,ue.AliRtcEngineLocalDeviceExceptionType=He,ue.AliRtcEngineLocalDeviceType=wt,ue.AliRtcErrorCode=te,ue.AliRtcLiveTranscodingAudioSampleRate=Hi,ue.AliRtcLiveTranscodingCropMode=ps,ue.AliRtcLiveTranscodingEncodeParam=bs,ue.AliRtcLiveTranscodingErrorCode=Et,ue.AliRtcLiveTranscodingFontType=Ai,ue.AliRtcLiveTranscodingMediaProcessMode=zi,ue.AliRtcLiveTranscodingMixMode=Si,ue.AliRtcLiveTranscodingMixParam=Ka,ue.AliRtcLiveTranscodingParam=ji,ue.AliRtcLiveTranscodingSegmentType=yi,ue.AliRtcLiveTranscodingSingleParam=$a,ue.AliRtcLiveTranscodingSourceType=oi,ue.AliRtcLiveTranscodingState=ms,ue.AliRtcLiveTranscodingStreamType=ls,ue.AliRtcLiveTranscodingTaskProfile=fs,ue.AliRtcLocalStreamInfo=Ds,ue.AliRtcLogLevel=ds,ue.AliRtcPlugin=Zt,ue.AliRtcPluginTrackType=xi,ue.AliRtcPluginType=Ea,ue.AliRtcPublishState=be,ue.AliRtcRawDataStreamType=We,ue.AliRtcRemoteUserInfo=Va,ue.AliRtcSdkChannelProfile=Tt,ue.AliRtcSdkClientRole=Mt,ue.AliRtcSubscribeState=Pe,ue.AliRtcTranscodingClockWidget=qa,ue.AliRtcTranscodingImage=Ls,ue.AliRtcTranscodingText=Ja,ue.AliRtcTranscodingUser=Xa,ue.AliRtcTrascodingPublishTaskStatus=gs,ue.AliRtcVideoStreamType=Ge,ue.AliRtcVideoTrack=Ae,ue.default=du,Object.defineProperties(ue,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
155
+ `;class Wa extends Ts{constructor(e,t){super(e,t);_(this,"processor");_(this,"trackGenerator");_(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([su],{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(ve({type:"updateOptions"},e))}dispose(){try{this.processor.readable.cancel(),this.trackGenerator.writable.close()}catch(e){}}getVideoTrack(){return this.trackGenerator}}class ks{static isSupport(){return typeof HTMLCanvasElement.prototype.captureStream=="function"}static getInstance(c,e){return Wa.isSupport()?new Wa(c,e):ja.isSupport()?new ja(c,e):new Z0(c,e)}}class nu extends Zt{constructor(){super(...arguments);_(this,"hasVideoTrack",!1);_(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 ks.isSupport()}shouldUpdate(e){return this.hasVideoTrack!==!!e.currentVideoTrack}process(e){return O(this,null,function*(){if(e.currentVideoTrack){if(this.hasVideoTrack=!0,!this.videoScaler){const i=this.options||this.initOptions;this.videoScaler=ks.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()}}var au=Object.defineProperty,ou=Object.getOwnPropertyDescriptor,ct=(s,c,e,t)=>{for(var i=t>1?void 0:t?ou(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&&au(c,e,i),i};class tt extends xe{constructor(e){super();_(this,"self");_(this,"userMap",{});_(this,"usersViewMap",{});_(this,"rtsManager");_(this,"localStreamManager");_(this,"authInfo");_(this,"signalingManager");_(this,"pluginManager");_(this,"audioMixerPlugin");_(this,"dualVideoPlugin");_(this,"blankAudioPlugin");_(this,"slsReporter");_(this,"statsMonitorId");_(this,"autoSubAudio",!0);_(this,"autoSubVideo",!0);_(this,"autoSubScreen",!0);_(this,"wantSubAudio",!0);_(this,"wantSubVideo",!0);_(this,"wantSubScreen",!0);_(this,"defaultStreamType",Ge.AliRtcVideoStreamTypeHigh);_(this,"audioMuted",!1);_(this,"playoutVolume",1);_(this,"audioVolumeIndicationInterval",0);_(this,"indicationTimer",0);_(this,"parameter",{});_(this,"publishRetryOptionsHook",()=>{for(const e of this.remoteUsers)e.restore()});_(this,"subscribeRetryOptionsHook",()=>{let e=!1,t;for(const i of this.remoteUsers)if(e)i.restore();else{const r=i.getRetryOptions();r&&(t=r,e=!0)}return t});const{signalingManager:t,slsReporter:i}=e;this.signalingManager=t,this.addSignalingManagerListener(),this.slsReporter=i,this.pluginManager=new V0,this.localStreamManager=new K0(this.pluginManager,this.slsReporter),this.rtsManager=new z0(this.localStreamManager,this.slsReporter,this.publishRetryOptionsHook,this.subscribeRetryOptionsHook,this.parameter),this.self=new Fa({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,parameter:this.parameter}),this.audioMixerPlugin=new X0,this.pluginManager.add(this.audioMixerPlugin),this.dualVideoPlugin=new nu("dualVideoPlugin"),s0()&&this.pluginManager.add(new $0)}addSignalingManagerListener(){this.signalingManager.on("onNotifyPublish",e=>{ae.event("[Signaling] Notify Publish ",e),e.forEach(t=>{this.onRemotePublishStateChange(t)})}),this.signalingManager.stsManager.on("onTokenUpdate",(e,t)=>{ae.updateToken(e),this.slsReporter.updateToken(t,e)})}isAutoSubAudio(){return this.autoSubAudio}setAutoSubAudio(e){this.autoSubAudio=e}isAutoSubVideo(){return this.autoSubVideo}setAutoSubVideo(e){this.autoSubVideo=e}isAutoSubScreen(){return this.autoSubScreen}setAutoSubScreen(e){this.autoSubScreen=e}isWantSubAudio(){return this.wantSubAudio}setWantSubAudio(e){this.wantSubAudio=e,this.remoteUsers.forEach(t=>{t.setWantSubAudio(e),t.updateSubscribe(Be.User)})}isWantSubVideo(){return this.wantSubVideo}setWantSubVideo(e){this.wantSubVideo=e,this.remoteUsers.forEach(t=>{t.setWantSubVideo(e),t.updateSubscribe(Be.User)})}isWantSubScreen(){return this.wantSubScreen}setWantSubScreen(e){this.wantSubScreen=e,this.remoteUsers.forEach(t=>{t.setWantSubScreen(e),t.updateSubscribe(Be.User)})}setRemoteDefaultVideoStreamType(e){this.defaultStreamType=e,this.remoteUsers.forEach(t=>{t.setRemoteDefaultVideoStreamType(e)})}setRemoteUserVideoStreamType(e,t){var 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=ws(e);i.length!==0&&i.forEach(n=>{var a,o;(a=this.publisher)==null||a.resetElement(n),Object.values(this.usersViewMap).forEach(({cameraViews:u=[],screenViews:h=[]})=>{u.includes(n)&&u.splice(u.indexOf(n),1),h.includes(n)&&h.splice(h.indexOf(n),1)}),(o=this.publisher)==null||o.setViewConfig(i,t)})}setRemoteViewConfig(e,t,i){var n,a;if(!t)return(n=this.userMap[e])==null?void 0:n.setViewConfig(null,i);const r=ws(t);r.length!==0&&(r.forEach(o=>{var u;(u=this.publisher)==null||u.resetElement(o),Object.values(this.usersViewMap).forEach(({cameraViews:h=[],screenViews:g=[]})=>{h.includes(o)&&h.splice(h.indexOf(o),1),g.includes(o)&&g.splice(g.indexOf(o),1)})}),(a=this.userMap[e])==null||a.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=>{const{isAudioSubscribing:i,isVideoSubscribing:r,isScreenSubscribing:n}=t;return i||r||n})}onRemotePublishStateChange(e){var f;const{userid:t,callid:i,subscribe:r,pubid:n="",tracks:a}=e,o=(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,o,n,a),u.updateSubscribe(Be.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 Fa({rtsManager:this.rtsManager,localStreamManager:this.localStreamManager,slsReporter:this.slsReporter,signalingManager:this.signalingManager,pluginManager:this.pluginManager,audioVolumeIndicationInterval:this.audioVolumeIndicationInterval,parameter:this.parameter})),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 a=this.addUser(n,r.displayname,Be.InRoom),{callid:o,subscribe:u,tracks:h}=r;a.updateRemoteTracks(o,(u==null?void 0:u.pullstreamurl)||"","",h),this.emit("remoteTrackAvailableChange",n,a.streamInfo.audioTrackInfo,a.streamInfo.videoTrackInfo)}}),this.startStatsMonitor()}leave(){return O(this,null,function*(){var e;this.stopStatsMonitor(),Object.values(this.usersViewMap).forEach(({cameraViews:t=[],screenViews:i=[]})=>{t.forEach(r=>{r.srcObject=null,r._playPromise=void 0}),i.forEach(r=>{r.srcObject=null,r._playPromise=void 0})}),this.usersViewMap={};for(let t in this.userMap)this.userMap[t]&&(this.userMap[t].clear(),delete this.userMap[t]);(e=this.self)==null||e.leave(),this.localStreamManager.stop(),this.rtsManager.clear(),this.authInfo=void 0})}clear(){return O(this,null,function*(){var e;yield this.leave(),(e=this.self)==null||e.clear(),this.pluginManager.removeAll()})}startStatsMonitor(){this.statsMonitorId=window.setInterval(()=>O(this,null,function*(){if(this.publisher){const{audio:i,video:r,candidate: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(a=>{e.push(a)}),n&&n.forEach(a=>{t.push(a)})}e.length>0&&this.emit("rtcRemoteAudioStats",e),t.length>0&&this.emit("rtcRemoteVideoStats",t)}),2e3)}stopStatsMonitor(){this.statsMonitorId&&clearInterval(this.statsMonitorId)}addUser(e,t,i){return this.userMap[e]||(this.userMap[e]=this.executeAddUser(e,t,i)),this.userMap[e]}executeAddUser(e,t,i){const r=new O0({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,parameter:this.parameter});return r.on(rt.Remote,this.onRemoteDeviceStatusChange.bind(this)),r.on(Re.PullStreamStats,this.onRemoteStatReport.bind(this)),r.on(Re.RtsSubscribeExceeds,this.onSubscribeExceeds.bind(this)),r.on("audioSubscribeStateChanged",(n,a,o,u)=>{this.emit("audioSubscribeStateChanged",n,a,o,u,this.channel||"")}),r.on("videoSubscribeStateChanged",(n,a,o,u)=>{this.emit("videoSubscribeStateChanged",n,a,o,u,this.channel||"")}),r.on("screenSubscribeStateChanged",(n,a,o,u)=>{this.emit("screenSubscribeStateChanged",n,a,o,u,this.channel||"")}),r.on("dataSubscribeStateChanged",(n,a,o,u)=>{this.emit("dataSubscribeStateChanged",n,a,o,u,this.channel||"")}),r.on("remoteAudioAutoPlayFail",n=>{this.emit("remoteAudioAutoPlayFail",n)}),r.on("remoteVideoAutoPlayFail",(n,a)=>{this.emit("remoteVideoAutoPlayFail",n,a)}),r.on("remoteAudioPlayError",(n,a)=>{this.emit("remoteAudioPlayError",n,a)}),r.on("remoteVideoPlayError",(n,a)=>{this.emit("remoteVideoPlayError",n,a)}),r.on("remoteSubscribeError",n=>{this.emit("remoteSubscribeError",n,r.userId)}),r.on("occurError",n=>{this.emit("occurError",n,r.userId)}),r.on("remoteDataChannelMessage",(n,a)=>{this.emit("remoteDataChannelMessage",n,a)}),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===Re.MuteAudio?this.emit("userAudioMuted",t,!0):e===Re.UnmuteAudio?this.emit("userAudioMuted",t,!1):e===Re.MuteVideo?this.emit("userVideoMuted",t,!0):e===Re.UnmuteVideo?this.emit("userVideoMuted",t,!1):e===Re.MuteScreen?this.emit("userScreenMuted",t,!0):e===Re.UnmuteScreen&&this.emit("userScreenMuted",t,!1)}onRemoteStatReport(e,t,i){this.emit(Re.PullStreamStats,e,t,i)}onSubscribeExceeds(e,t){this.emit(Re.RtsSubscribeExceeds,e,t)}removeLeftUser(e){return O(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(o=>{o.userid&&(this.userMap[o.userid]?(i.push(o),r[o.userid]=this.userMap[o.userid]):(t.push(o),r[o.userid]=this.executeAddUser(o.userid,o.displayname,Be.Resume)))});const n=Object.keys(this.userMap),a=[];return n.forEach(o=>{r[o]||a.push({userid:o,reason:"",leavecode:xs.AliRtcUserOfflineQuit})}),this.userMap=r,{joinList:t,leaveList:a,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 Y(te.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubAudio(t),t?i.updateSubscribe(Be.User):i.stopSubscribe({audio:!0})}updateVideoWant(e,t){const i=this.userMap[e];if(!i)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubVideo(t),t?i.updateSubscribe(Be.User):i.stopSubscribe({video:!0})}updateScreenWant(e,t){const i=this.userMap[e];if(!i)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);i.setWantSubScreen(t),t?i.updateSubscribe(Be.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)}setEnableDualVideoStream(e,t){if(!this.dualVideoPlugin)return;t&&this.dualVideoPlugin.setOptions(t);const i=this.pluginManager.has(this.dualVideoPlugin.name);e?!i&&this.pluginManager.add(this.dualVideoPlugin):i&&this.pluginManager.remove(this.dualVideoPlugin.name)}setAudioVolume(e){var t;(t=this.audioMixerPlugin)==null||t.setOptions(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=ve(ve({},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)}setParameter(e){var i,r,n;const t=JSON.parse(e);Object.keys(t).forEach(a=>{const o=this.parameter[a],u=t[a];typeof o=="object"&&typeof u=="object"?this.parameter[a]=ve(ve({},o),u):this.parameter[a]=u}),t.enableBlankAudio===!0?(this.blankAudioPlugin||(this.blankAudioPlugin=new q0),this.pluginManager.has((i=this.blankAudioPlugin)==null?void 0:i.name)||this.pluginManager.add(this.blankAudioPlugin)):t.enableBlankAudio===!1&&(this.blankAudioPlugin&&this.pluginManager.remove((r=this.blankAudioPlugin)==null?void 0:r.name),(n=this.blankAudioPlugin)==null||n.clear(),this.blankAudioPlugin=void 0)}getParameter(){return JSON.stringify(this.parameter)}sendDataChannelMessage(e){var t;return(t=this.self)==null?void 0:t.sendDataChannelMessage(e)}}_(tt,"logName","BizControl"),ct([z()],tt.prototype,"init",1),ct([z()],tt.prototype,"leave",1),ct([z()],tt.prototype,"clear",1),ct([z(ne)],tt.prototype,"addUser",1),ct([z()],tt.prototype,"removeLeftUser",1),ct([z()],tt.prototype,"updateUsers",1),ct([z(ne)],tt.prototype,"updateAudioWant",1),ct([z(ne)],tt.prototype,"updateVideoWant",1),ct([z(ne)],tt.prototype,"updateScreenWant",1),ct([z()],tt.prototype,"stopIndication",1),ct([z()],tt.prototype,"startIndication",1),ct([z(ne)],tt.prototype,"setEnableDualVideoStream",1),ct([z(ne)],tt.prototype,"setAudioVolume",1),ct([z()],tt.prototype,"enableAudioVolumeIndication",1);const Ps=s=>O(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 cu{constructor(c){_(this,"authInfo");_(this,"slsReporter");this.slsReporter=c}doRequest(c,e){var u;const t=this.authInfo;if(!t)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const i="https://gw.rtn.aliyuncs.com",r=a0[c],n={appid:t.appId,userid:t.userId,channelid:t.channelId,timestamp:t.timestamp,token:t.token,nonce:t.nonce?t.nonce:"",requestid:St.createCallid(),tokensid:!1,session:(u=t.sessionId)!=null?u:St.createCallid()},a=Object.keys(n).map(h=>`${h}=${encodeURIComponent(n[h])}`).join("&"),o=`${i}${r}?${a}`;return fetch(o,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(e)}).then(h=>h.status!==200?(this.slsReporter.reportTranscodingError(h.status,e.taskid||""),Promise.reject(new Y(te.ERR_INNER,`transcoding request failed, status: ${h.status}`))):h).catch(h=>Promise.reject(new Y(te.ERR_INNER,`transcoding request failed, err: ${h.message}`)))}setAuthInfo(c){this.authInfo=c}clear(){this.authInfo=void 0}startPublishLiveStream(c,e){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=yield Ps(c.split("?")[0]),i=ot.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(i,this.authInfo,t,c);return this.doRequest(i,r)})}startPublishLiveStreamWithTaskId(c,e){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=ot.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(t,this.authInfo,c);return this.doRequest(t,i)})}updatePublishLiveStream(c,e){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=yield Ps(c.split("?")[0]),i=ot.MPU_TASK_TRANSACTION_UPDATE,r=e.toJson(i,this.authInfo,t,c);return this.doRequest(i,r)})}updatePublishLiveStreamWithTaskId(c,e){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const t=ot.MPU_TASK_TRANSACTION_UPDATE,i=e.toJson(t,this.authInfo,c);return this.doRequest(t,i)})}stopPublishLiveStream(c){return O(this,null,function*(){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const e=yield Ps(c.split("?")[0]),t=ot.MPU_TASK_TRANSACTION_STOP,i=new ji().toJson(t,this.authInfo,e,c);return this.doRequest(t,i)})}stopPublishLiveStreamWithTaskId(c){if(!this.authInfo)return Promise.reject(Et.LiveTranscodingErrorInvalidParam);const e=ot.MPU_TASK_TRANSACTION_STOP,t=new ji().toJson(e,this.authInfo,c);return this.doRequest(e,t)}refreshAuthInfo(c){this.authInfo&&this.setAuthInfo(ve(ve({},this.authInfo),c))}}class Bs{static checkString(c){return typeof c=="string"}static checkNumber(c){return typeof c=="number"}static checkHtmlVideoElement(c){return c&&c.nodeName==="VIDEO"}static checkHtmlAudioElement(c){return c&&c.nodeName==="AUDIO"}static checkAuthInfo(c){if(!c)return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no authInfo founded");if(!c.appId)return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no appId founded");if(!c.channelId)return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no channelId founded");if(!c.userId)return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no userId founded");if(c.timestamp){if(!Bs.checkNumber(c.timestamp))return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"timestamp is not number")}else return new Y(te.ERR_JOIN_ERR_JOIN_BAD_PARAMBAD,"no timestamp founded");return c.token?null:new Y(te.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 Ka{constructor(c){_(this,"taskProfile");_(this,"encodeParam");_(this,"users",[]);_(this,"backgroundColor",0);_(this,"backgrounds",[]);_(this,"watermarks",[]);_(this,"clockWidgets",[]);_(this,"cropMode");_(this,"mediaProcessMode");this.taskProfile=c}}class $a{constructor(c,e,t){_(this,"userId");_(this,"streamType");_(this,"sourceType");this.userId=c,this.streamType=e,this.sourceType=t}}class qa{constructor(c,e,t,i=0,r=16777215,n=Ai.NOTO_SERIF_CJKSC_REGULAR){_(this,"x");_(this,"y");_(this,"fontSize");_(this,"zOrder");_(this,"fontColor");_(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:vt(this.x,c),y:vt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:vs(this.fontColor),zorder:this.zOrder}}}var Ga=(s=>(s[s.NOT_DISPLAY=0]="NOT_DISPLAY",s[s.ALWAYS=1]="ALWAYS",s[s.WHEN_NO_VIDEO=2]="WHEN_NO_VIDEO",s))(Ga||{});class Ls{constructor(c,e,t,i,r,n=0,a=1,o=1){_(this,"url");_(this,"x");_(this,"y");_(this,"width");_(this,"height");_(this,"alpha");_(this,"display",1);_(this,"zOrder");this.url=c,this.x=e,this.y=t,this.width=i,this.height=r,this.zOrder=n,this.alpha=a,this.display=o}toJson(c,e){return{url:this.url,alpha:this.alpha,display:this.display,x:vt(this.x,c),y:vt(this.y,e),width:vt(this.width,c),height:vt(this.height,e),zorder:this.zOrder}}}_(Ls,"DisplayType",Ga);class Ja{constructor(c,e,t,i,r=0,n=16777215,a=Ai.NOTO_SERIF_CJKSC_REGULAR){_(this,"text");_(this,"x");_(this,"y");_(this,"fontSize");_(this,"zOrder");_(this,"fontColor");_(this,"fontType");this.text=c,this.x=e,this.y=t,this.fontSize=i,this.zOrder=r,this.fontColor=n,this.fontType=a}toJson(c,e){return{text:this.text,x:vt(this.x,c),y:vt(this.y,e),fonttype:this.fontType,fontsize:this.fontSize,fontcolor:vs(this.fontColor),zorder:this.zOrder}}}class Xa{constructor(c,e,t,i,r,n=0,a){_(this,"userId");_(this,"x");_(this,"y");_(this,"width");_(this,"height");_(this,"zOrder");_(this,"sourceType");_(this,"segmentType",yi.LiveTranscodingNoBody);_(this,"images",[]);_(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,a&&(this.sourceType=a)}toJson(c,e,t,i){const r={paneid:c,majorpane:0,x:vt(this.x,e),y:vt(this.y,t),width:vt(this.width,e),height:vt(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&&_i[this.sourceType]?r.sourcetype=_i[this.sourceType]:r.sourcetype=_i[oi.LiveTranscodingCamera],this.segmentType&&i===zi.LiveTranscodingVirtualBackground?r.segmenttype=this.segmentType:r.segmenttype=yi.LiveTranscodingNoBody,r}}var uu=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,de=(s,c,e,t)=>{for(var i=t>1?void 0:t?hu(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&&uu(c,e,i),i};const he=(fe=class extends xe{constructor(e){super();_(this,"channelProfile");_(this,"clientRole");_(this,"signalingManager");_(this,"bizControl");_(this,"liveTranscoding");_(this,"maxSignalingConnectRetryCount");_(this,"slsReporter");_(this,"connectState",ke.AliRtcConnectionStatusInit);_(this,"networkError",!1);_(this,"_audioOnlyMode",!1);_(this,"_authInfoWillExpireTimer",null);_(this,"_authInfoExpiredTimer",null);_(this,"_serverCheckAuthInfoTimestamp",null);_(this,"_localCheckAuthInfoTimestamp",null);const t=Date.now();this.slsReporter=new vi(this),this.channelProfile=Tt.AliRtcSdkCommunication,this.clientRole=Mt.AliRtcSdkLive,this.liveTranscoding=new cu(this.slsReporter),this.signalingManager=new Es(this.channelProfile,this.clientRole,this.slsReporter,(e==null?void 0:e.env)===Dt.pre?Dt.pre:Dt.prod),this.addSignalingManagerListeners(),this.maxSignalingConnectRetryCount=e==null?void 0:e.maxSignalingConnectRetryCount,this.bizControl=new tt({slsReporter:this.slsReporter,signalingManager:this.signalingManager}),this.addBizControlListeners(),this.addPublisherListeners(),this.slsReporter.reportSDKCreated(t)}static getSdkVersion(){return mr}static setLogLevel(e){ae.setLogLevel(e)}static getInstance(e){return fe._instance||(fe._instance=new fe(e)),fe._instance}destroy(){return O(this,null,function*(){fe._instance=void 0,yield this.leaveChannel(),yield this.bizControl.clear()})}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===Tt.AliRtcSdkCommunication||this.clientRole===Mt.AliRtcSdkInteractive}addPublisherListeners(){var e,t,i,r,n,a,o,u,h,g;(e=this.publisher)==null||e.on(rt.Local,f=>{ae.event("[Publisher] Device Status Change",f),this.onLocalDeviceStatusChange(f)}),(t=this.publisher)==null||t.on(ti.VideoTrackEnded,()=>{ae.event("[Publisher] VideoTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeCamera,He.AliEngineLocalDeviceExceptionTypeCameraInterrupt,"")}),(i=this.publisher)==null||i.on(ti.ScreenTrackEnded,()=>{ae.event("[Publisher] ScreenTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeDisplay,He.AliEngineLocalDeviceExceptionTypeDisplayException,"")}),(r=this.publisher)==null||r.on(ti.AudioTrackEnded,()=>{ae.event("[Publisher] AudioTrack Ended"),this.emit("localDeviceException",wt.AliEngineLocalDeviceTypeMic,He.AliEngineLocalDeviceExceptionTypeMicInterrupt,"")}),(n=this.publisher)==null||n.on("localDeviceException",(f,l,p="")=>{this.emit("localDeviceException",f,l,p)}),(a=this.publisher)==null||a.on("audioPublishStateChanged",(f,l,p)=>{var d;this.emit("audioPublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")}),(o=this.publisher)==null||o.on("videoPublishStateChanged",(f,l,p)=>{var d;this.emit("videoPublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")}),(u=this.publisher)==null||u.on("dualStreamPublishStateChanged",(f,l,p)=>{var d;this.emit("dualStreamPublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")}),(h=this.publisher)==null||h.on("screenPublishStateChanged",(f,l,p)=>{var d;this.emit("screenSharePublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")}),(g=this.publisher)==null||g.on("dataPublishStateChanged",(f,l,p)=>{var d;this.emit("dataPublishStateChanged",f,l,p,(d=this.channel)!=null?d:"")})}occurError(e,t){this.emit("onOccurError",e,t),this.emit("occurError",e,t)}addBizControlListeners(){this.bizControl.rtsManager.on("connected",e=>{var t;e&&((t=this.publisher)==null||t.publishUpdate(),this.remoteUsers.forEach(i=>{i.updateSubscribe(Be.Reconnect)}))}),this.bizControl.rtsManager.on("disconnected",()=>O(this,null,function*(){ae.event(`[${fe.logName}]`,"RTS Disconnected"),(yield St.isNetworkAvailable())?this.onNetworkRecovery():this.onNetworkError()})),this.bizControl.rtsManager.on("subscribeexceeds",()=>O(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(rt.Remote,(e,t)=>{ae.event(`[${fe.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("dataSubscribeStateChanged",(e,t,i,r,n)=>{this.emit("dataSubscribeStateChanged",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("remoteAudioPlayError",(e,t)=>{this.emit("remoteAudioPlayError",e,t)}),this.bizControl.on("remoteVideoPlayError",(e,t)=>{this.emit("remoteVideoPlayError",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,t)=>{this.occurError(e,t),this.slsReporter.reportError(e)}),this.bizControl.on("occurError",(e,t)=>{this.occurError(e,t),this.slsReporter.reportError(e)}),this.bizControl.on("remoteDataChannelMessage",(e,t)=>{this.emit("dataChannelMsg",e,t)})}addSignalingManagerListeners(){this.signalingManager.on("onKeepAliveRsp",()=>{this.networkError&&(ae.event("[Signaling] Receive KeepAlive Response",`networkError: ${this.networkError}`),this.onNetworkRecovery())}),this.signalingManager.on("onNotifyJoin",e=>{ae.event("[Signaling] Notify Join ",e),this.handleUsersJoin(e),e.forEach(t=>{this.emit("remoteUserOnLineNotify",t.userid,0)})}),this.signalingManager.on("onNotifyStatus",e=>{ae.event("[Signaling] Notify Status ",e),e.forEach(t=>{this.bizControl.updateRemoteUserDeviceStatus(t)})}),this.signalingManager.on("onNotifyLeave",e=>{ae.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)=>{ae.event("[Signaling] Bye ",e,t),this.slsReporter.reportError({message:`reason: ${e}, description: ${t}`}),this.emit("bye",e),this.leaveChannel(),this.slsReporter.reportBye(e)}),this.signalingManager.on("onConnectFail",e=>{ae.event("[Signaling] Connect Failed ",e),this.onError(e),this.backToUnpublishStatus(),this.connectState=ke.AliRtcConnectionStatusFailed,this.emit("connectionStatusChange",ke.AliRtcConnectionStatusFailed,Yt.AliRtcConnectionChangedNetworkInterrupted)}),this.signalingManager.on("onNetworkError",e=>{this.slsReporter.reportWarning("signaling network error"),ae.event("[Signaling] Network error ",e),this.onNetworkError()}),this.signalingManager.on("onAuthInvalid",()=>{ae.event("[Signaling] Auth Invalid")}),this.signalingManager.on("onReconnectStart",()=>{ae.event("[Signaling] Reconnect Start "),this.connectState=ke.AliRtcConnectionStatusReconnecting,this.emit("connectionStatusChange",ke.AliRtcConnectionStatusReconnecting,Yt.AliRtcConnectionSignalingConnecting)}),this.signalingManager.on("onReconnectSuccess",e=>{ae.event("[Signaling] Reconnect Success ",e),this.onNetworkRecovery(e)}),this.signalingManager.on("onReconnectFail",e=>{this.slsReporter.reportWarning("signaling reconnect fail: ${err.code}"),ae.event("[Signaling] Reconnect Failed ",e),e.code===403&&this.emit("authInfoExpired")}),this.signalingManager.on("onError",e=>{this.slsReporter.reportWarning("signaling error: ${err.message}"),ae.event("[Signaling] Error ",e),this.onError(e)})}backToUnpublishStatus(){var e,t;this.connectState=ke.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,Be.Join);ae.event(`[${fe.logName}]`,Re.UserJoined,r)}})}onLocalDeviceStatusChange(e){ae.event(`[${fe.logName}]`,rt.Local,e),this.signalingManager.reportStatus(e).then(()=>{ae.debug("[signaling] reportStatus suc")}).catch(t=>{ae.error("[signaling] reportStatus failed",t)})}resumePublishForNetworkRecovery(){return O(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((a,o)=>{const u=setInterval(()=>O(this,null,function*(){var h;n>1&&(clearInterval(u),o()),n+=1;try{yield(h=this.publisher)==null?void 0:h.resumePublish(),clearInterval(u),a()}catch(g){const{code:f}=g;f!==10205&&(clearInterval(u),o())}}),1e3)})}catch(a){}}throw t}})}onNetworkRecovery(e){return O(this,null,function*(){var t;ae.event(fe.logName,"onNetworkRecovery",`rts isConnected: ${this.bizControl.rtsManager.isConnected}; rts isConnecting: ${this.bizControl.rtsManager.isConnecting}`,{users:e}),!this.bizControl.rtsManager.isConnected&&!this.bizControl.rtsManager.isConnecting&&(yield this.resumePublishForNetworkRecovery(),yield this.resumeSubList(e)),this.networkError&&(this.networkError=!1,(t=this.publisher)==null||t.reportSelfDeviceStatus(),this.connectState=ke.AliRtcConnectionStatusConnected,this.emit("connectionStatusChange",ke.AliRtcConnectionStatusConnected,Yt.AliRtcConnectionSignalingHeartbeatAlive))})}resumeSubList(e){return O(this,null,function*(){if(e!=null&&e.length){const{joinList:t,leaveList:i,presentList:r}=this.bizControl.updateUsers(e);ae.info(`[${fe.logName}]`,"resumeSubList",{joinList:t,leaveList:i,presentList:r}),this.handleUsersJoin(t),i.forEach(n=>{ae.event(fe.logName,Re.UserLeft,n.userid,n.reason),this.emit("remoteUserOffLineNotify",n.userid,xs.AliRtcUserOfflineQuit)});for(let n=0;n<r.length;n++){const a=r[n],o=a.userid,u=this.bizControl.getRemoteUser(o);this.bizControl.onRemotePublishStateChange(a),u==null||u.restore(),u==null||u.updateSubscribe(Be.Resume)}}else for(let t=0;t<this.remoteUsers.length;t++){const i=this.remoteUsers[t];try{i.restore(),i.updateSubscribe(Be.Resume)}catch(r){}}})}retrySubscribe(e){return O(this,null,function*(){const t=this.bizControl.getRemoteUser(e);if(!t)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);t.restore(),t.updateSubscribe(Be.Retry)})}onNetworkError(){this.connectState===ke.AliRtcConnectionStatusConnected&&(this.networkError||(this.connectState=ke.AliRtcConnectionStatusDisconnected,this.emit("connectionStatusChange",ke.AliRtcConnectionStatusDisconnected,Yt.AliRtcConnectionChangedNetworkInterrupted)),this.networkError=!0)}onError(e){this.slsReporter.reportError(e),ae.event(fe.logName,Re.Error,e)}setEnableDualVideoStream(e,t){this.bizControl.setEnableDualVideoStream(e,t)}hadPushStream(e){if(!(this.publisher&&e))throw new Y(te.ERR_INNER,"stream is not publishing")}getCurrentMicDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentMicDeviceId()}setChannelProfile(e){if(![ke.AliRtcConnectionStatusInit,ke.AliRtcConnectionStatusDisconnected,ke.AliRtcConnectionStatusFailed].includes(this.connectState))throw new Y(te.ERR_INNER,"cannot set channel profile in call");this.channelProfile=e,this.channelProfile===Tt.AliRtcSdkCommunication&&(this.clientRole=Mt.AliRtcSdkLive),this.signalingManager.setChannelProfile(e)}startAndPublishDefaultDevices(e){return O(this,null,function*(){var a,o,u,h,g;if(!this.publisher)return;const{hasCamera:t,hasMicrophone:i,hasScreenShare:r}=this.publisher;if(t||i||r)return;try{yield(a=this.publisher)==null?void 0:a.startDefaultCamera(this._audioOnlyMode)}catch(f){ae.warn(`[${fe.logName}]`,"startDefaultCamera failed",f.code,f.message),f instanceof Y&&this.occurError(f),this.occurError(new Y(te.ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED,`auto start video failed, ${f.message||""}`))}try{yield(o=this.publisher)==null?void 0:o.startDefaultAudio()}catch(f){ae.warn(`[${fe.logName}]`,"startDefaultAUdio failed",f.code,f.message),f instanceof Y&&this.occurError(f),this.occurError(new Y(te.ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED,`auto start audio failed, ${f.message||""}`))}yield(u=this.publisher)==null?void 0:u.previewAll();const n=((h=this.publisher)==null?void 0:h.publishStreams)||{};if(Object.values(n).some(f=>f))try{yield(g=this.publisher)==null?void 0:g.startPublish(!1,e)}catch(f){const l=[];n!=null&&n.audio&&l.push(te.ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED),n!=null&&n.video&&l.push(te.ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED),l.forEach(p=>{this.occurError(new Y(p,`auto publish stream failed, ${f.message||""}`))})}})}setClientRole(e){return O(this,null,function*(){var t,i;try{if(this.channelProfile===Tt.AliRtcSdkCommunication)return;if(!Object.values(Mt).includes(e))throw new Y(te.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===Mt.AliRtcSdkInteractive?(this.bizControl.isSubscribing?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.startAndPublishDefaultDevices(Bt.JOIN_CHANNEL)):yield this.signalingManager.setClientRole(e),this.clientRole=e}catch(r){throw r.code===403&&this.emit("authInfoExpired"),r}})}getCurrentClientRole(){return this.clientRole}setAudioOnlyMode(e){if(this.isInCall())throw new Y(te.ERR_INNER,"can not change audioOnly mode in call");this._audioOnlyMode=e}setAudioRedEnabled(e){if(this.isInCall())throw new Y(te.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)}joinChannel(e,t){return O(this,null,function*(){var o,u;let i,r=t;if(typeof e=="string")try{const h=JSON.parse(window.atob(e));i={appId:h.appid,channelId:h.channelid,userId:h.userid,timestamp:h.timestamp,nonce:h.nonce,token:h.token}}catch(h){throw new Y(te.ERR_INVALID_ARGUMENTS,`authInfo is invalid: ${h.message||""}`)}else i=e;r||(r=i.userId);const n={start:Date.now()};let a=Bs.checkAuthInfo(i);if(ke.AliRtcConnectionStatusInit===this.connectState||ke.AliRtcConnectionStatusDisconnected===this.connectState||ke.AliRtcConnectionStatusFailed===this.connectState){if(this.connectState=ke.AliRtcConnectionStatusConnecting,a)throw this.connectState=ke.AliRtcConnectionStatusFailed,this.slsReporter.reportJoin(a.code,n,""),this.slsReporter.reportJoinResult(a),a;i.sessionId=St.createCallid("web"),ae.setSessionID(i.appId,i.sessionId),this.slsReporter.start(i);try{const h=yield this.signalingManager.join(i,r,this.maxSignalingConnectRetryCount,n);this.connectState=ke.AliRtcConnectionStatusConnected,(o=this.publisher)==null||o.reportSelfDeviceStatus(),this.bizControl.init(i,h),this.setCheckAuthInfoTimer(i.timestamp,h.timestamp),this.liveTranscoding.setAuthInfo(i),this.slsReporter.reportJoin(0,n,h.tid),this.slsReporter.reportJoinResult(null)}catch(h){const g=(u=h.code)!=null?u:-1,f=h.reason||h.message||"";throw this.connectState=ke.AliRtcConnectionStatusDisconnected,this.slsReporter.reportJoin(g,n,""),this.slsReporter.reportJoinResult(h),new Y(g,f)}this.currentRoleCanPublish&&(yield this.startAndPublishDefaultDevices(Bt.ROLE_CHANGE)),this.remoteUsers.forEach(h=>{h.updateSubscribe(Be.Join)})}else{const h=new Y(te.ERR_JOIN_ALREADY_JOINED,"already joined");throw this.connectState===ke.AliRtcConnectionStatusConnecting&&(h.message="Repeated operation during login"),this.slsReporter.reportJoin(h.code,n,""),h}})}leaveChannel(){return O(this,null,function*(){var t;this.slsReporter.reportLeaveInvoked();let e=new Date().getTime();if(ke.AliRtcConnectionStatusConnected===this.connectState)try{let i;i=yield this.signalingManager.leave(),this.slsReporter.reportLeave(new Date().getTime()-e,0,(t=i==null?void 0:i.tid)!=null?t:""),ae.uploadLog()}catch(i){this.slsReporter.reportLeave(new Date().getTime()-e,i.code,i.reason)}else this.slsReporter.reportLeave(0,0,"");this.networkError=!1,this.connectState=ke.AliRtcConnectionStatusDisconnected,this.clearCheckAuthInfoTimer(),yield this.bizControl.leave(),this.liveTranscoding.clear(),this.slsReporter.stop(),this.signalingManager.reset()})}isInCall(){return this.connectState===ke.AliRtcConnectionStatusConnected}refreshAuthInfo(e){return O(this,null,function*(){let t;if(typeof e=="string")try{const h=JSON.parse(window.atob(e));t={userId:h.userid,timestamp:h.timestamp,nonce:h.nonce,token:h.token}}catch(h){throw new Y(te.ERR_INVALID_ARGUMENTS,`authInfo is invalid: ${h.message||""}`)}else t=e;const{userId:i,nonce:r,timestamp:n,token:a,role:o}=t,u={userId:i,nonce:r,timestamp:n,token:a,role:o};try{yield this.signalingManager.refreshAuthInfo(u),this.bizControl.refreshAuthInfo(u),this.liveTranscoding.refreshAuthInfo(u),this.clearCheckAuthInfoTimer(),this._serverCheckAuthInfoTimestamp&&this._localCheckAuthInfoTimestamp&&t.timestamp&&this.setCheckAuthInfoTimer(t.timestamp,this._serverCheckAuthInfoTimestamp+(Date.now()-this._localCheckAuthInfoTimestamp))}catch(h){throw h}})}isAudioOnly(){return this._audioOnlyMode}publishLocalAudioStream(e){return O(this,null,function*(){var t,i,r,n;(t=this.publisher)==null||t.setPublishLocalAudioStreamEnabled(e),this.connectState===ke.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasMicrophone?yield(r=this.publisher)==null?void 0:r.updateStreams():yield this.startAudioCapture():yield(n=this.publisher)==null?void 0:n.publishUpdate())})}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 Y(te.ERR_INVALID_ARGUMENTS,"subscribeAllRemoteAudioStreams(true) must be called first");this.bizControl.updateAudioWant(e,t)}resumeRemoteAudioStream(e){const t=this.bizControl.getRemoteUser(e);if(!t)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);t.resumeAudio()}stopRemoteAudioPlay(e){const t=this.bizControl.getRemoteUser(e);if(!t)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);t.stopPlayAudio()}publishLocalVideoStream(e){return O(this,null,function*(){var t,i,r,n;(t=this.publisher)==null||t.setPublishLocalVideoStreamEnabled(e),this.connectState===ke.AliRtcConnectionStatusConnected&&(e?(i=this.publisher)!=null&&i.hasCamera?yield(r=this.publisher)==null?void 0:r.updateStreams():yield this.enableLocalVideo():yield(n=this.publisher)==null?void 0:n.publishUpdate())})}isLocalVideoStreamPublished(){var e,t;return(t=(e=this.publisher)==null?void 0:e.publishLocalVideoStreamEnabled)!=null?t:!0}setRemoteDefaultVideoStreamType(e){[Ge.AliRtcVideoStreamTypeHigh,Ge.AliRtcVideoStreamTypeLow].includes(e)&&this.bizControl.setRemoteDefaultVideoStreamType(e)}setRemoteUserVideoStreamType(e,t){[Ge.AliRtcVideoStreamTypeHigh,Ge.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 Y(te.ERR_INNER,`no remote user(${e}) founded`);i&&(t===Ae.AliRtcVideoTrackScreen||t===Ae.AliRtcVideoTrackBoth)?n.setWantSubScreen(!0):n.setWantSubScreen(!1),i&&(t===Ae.AliRtcVideoTrackCamera||t===Ae.AliRtcVideoTrackBoth)?n.setWantSubVideo(!0):n.setWantSubVideo(!1),n.setWantSubAudio(r),n.updateSubscribe(Be.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 O(this,null,function*(){var a;const t={video:!1,audio:!1},{audio:i=!1,videoTrack:r,audioTrack:n}=e||{};if(r||n){t.screen=!0;const o=new MediaStream;r&&o.addTrack(r),n&&o.addTrack(n),t.mediaStream=o}else t.screen=i?{audio:!0}:!0;yield(a=this.publisher)==null?void 0:a.createLocalStream(t)})}stopScreenShare(){return O(this,null,function*(){var e;(e=this.publisher)==null||e.stopLocalStream({screen:!0})})}setScreenShareConfiguration(e){return O(this,null,function*(){var r;const{frameRate:t=Ci.frameRate,bitrate:i=Ci.maxBitrate}=e;yield(r=this.publisher)==null?void 0:r.setScreenProfile(ka,{width:Ci.width,height:Ci.height,frameRate:t,maxBitrate:i})})}setScreenShareContentHint(e){return O(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setScreenContentHint(e))})}publishLocalScreenShareStream(e,t){return O(this,null,function*(){var i,r,n;(i=this.publisher)==null||i.setPublishLocalScreenStreamEnabled(e),this.connectState===ke.AliRtcConnectionStatusConnected&&(e?(r=this.publisher)!=null&&r.hasScreenShare?yield this.publisher.updateStreams():yield this.startScreenShare(t):yield(n=this.publisher)==null?void 0:n.publishUpdate())})}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 Y(te.ERR_INVALID_ARGUMENTS,"volume must be a number");this.bizControl.setAudioVolume({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?Re.MuteAudio:Re.UnmuteAudio),(t=this.publisher)==null||t.muteLocalMic(e)}muteRemoteAudioPlaying(e,t=!1){const i=this.bizControl.getRemoteUser(e);if(!i)throw new Y(te.ERR_INNER,`no remote user(${e}) founded`);i.setAudioMuted(t)}muteAllRemoteAudioPlaying(e=!1){this.bizControl.setAudioMuted(e)}startAudioCapture(e){return O(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 O(this,null,function*(){var i,r,n,a;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(a=this.publisher)==null?void 0:a.createLocalStream({audio:{deviceId:e}})}})}setRecordingVolume(e){if(typeof e!="number")throw new Y(te.ERR_INVALID_ARGUMENTS,"volume must be a number");this.bizControl.setAudioVolume({audio:Math.max(0,Math.min(e,400))/100})}setPlayoutVolume(e){if(typeof e!="number")throw new Y(te.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 Y(te.ERR_INNER,`no remote user(${e}) founded`);if(typeof t!="number")throw new Y(te.ERR_INVALID_ARGUMENTS,"volume must be a number");i.setPlayoutVolume(Math.max(0,Math.min(t,100))/100)}setAudioProfile(e){return O(this,null,function*(){var t;yield(t=this.publisher)==null?void 0:t.setAudioProfile(e)})}getAudioTrack(e){return O(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 O(this,null,function*(){var i,r,n;if(this._audioOnlyMode)throw new Y(te.ERR_INNER,"Cannot set local view in audio only mode");(i=this.bizControl)==null||i.setLocalViewConfig(e,t),t===Ae.AliRtcVideoTrackCamera&&((r=this.publisher)!=null&&r.hasCamera)?yield this.startPreview():t===Ae.AliRtcVideoTrackScreen&&((n=this.publisher)!=null&&n.hasScreenShare)&&(yield this.startPreviewScreen())})}setCameraCapturerConfiguration(e){return O(this,null,function*(){var u,h,g;const{width:t=wi.width,height:i=wi.height,frameRate:r=wi.frameRate,bitrate:n=wi.maxBitrate,cameraDirection:a,deviceId:o}=e;yield(u=this.publisher)==null?void 0:u.setVideoProfile(Ta,{width:t,height:i,frameRate:r,maxBitrate:n}),a!==void 0&&((h=this.publisher)==null||h.setCameraDirection(a)),o&&((g=this.publisher)==null||g.setCameraDeviceId(o))})}setCameraCapturerContentHint(e){return O(this,null,function*(){var t;e&&((t=this.publisher)==null||t.setVideoContentHint(e))})}enableLocalVideo(e=!0){return O(this,null,function*(){var t,i,r,n,a,o,u,h,g,f,l;if(this._audioOnlyMode)throw new Y(te.ERR_INNER,"Cannot enable local video in audio only mode");e?((i=(t=this.publisher)==null?void 0:t.publishStreams)!=null&&i.video&&((a=(n=(r=this.publisher)==null?void 0:r.publishStreams)==null?void 0:n.video)==null||a.disableVideo(),(g=(h=(u=(o=this.publisher)==null?void 0:o.publishStreams)==null?void 0:u.video)==null?void 0:h.videoTrack)==null||g.stop()),yield(f=this.publisher)==null?void 0:f.startCameraCapture()):yield(l=this.publisher)==null?void 0:l.stopCameraCapture()})}muteLocalCamera(e){return O(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Re.MuteVideo:Re.UnmuteVideo),(t=this.publisher)==null||t.muteLocalCamera(e)})}muteLocalScreen(e){return O(this,null,function*(){var t;this.isPublishing&&this.onLocalDeviceStatusChange(e?Re.MuteScreen:Re.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 O(this,null,function*(){var r,n,a,o,u,h,g,f,l,p,d,m,v;if(this._audioOnlyMode)throw new Y(te.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"?Ei.CAMERA_FRONT:Ei.CAMERA_REAR,this.slsReporter.reportSwitchCamera(((n=this.publisher)==null?void 0:n.cameraDirection)||"")),yield this.setCameraCapturerConfiguration(i),!((a=this.publisher)!=null&&a.cameraCaptureDisabled)){(u=(o=this.publisher)==null?void 0:o.publishStreams)!=null&&u.video&&((f=(g=(h=this.publisher)==null?void 0:h.publishStreams)==null?void 0:g.video)==null||f.disableVideo(),(m=(d=(p=(l=this.publisher)==null?void 0:l.publishStreams)==null?void 0:p.video)==null?void 0:d.videoTrack)==null||m.stop());const b={video:!0};t&&(b.mediaStream=new MediaStream([t])),yield(v=this.publisher)==null?void 0:v.createLocalStream(b)}})}getCurrentCameraDeviceId(){var e;return(e=this.publisher)==null?void 0:e.getCurrentCameraDeviceId()}startPreview(){return O(this,null,function*(){var e,t;if(this._audioOnlyMode)throw new Y(te.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 O(this,null,function*(){var t,i;if(this._audioOnlyMode)throw new Y(te.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 O(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!0,screen:!1})})}stopPreviewScreen(){return O(this,null,function*(){var e;yield(e=this.publisher)==null?void 0:e.stopPreview({primary:!1,screen:!0})})}getVideoTrack(e){return O(this,null,function*(){var n,a,o,u;const{userId:t,streamType:i}=e;if(!t)return i===We.AliRtcSdkStreamTypeCapture?(n=this.publisher)==null?void 0:n.cameraTrack:(a=this.publisher)==null?void 0:a.screenTrack;const r=this.bizControl.getRemoteUser(t);return i===We.AliRtcSdkStreamTypeCapture?(o=r==null?void 0:r.getCameraStream)==null?void 0:o.videoTrack:(u=r==null?void 0:r.getScreenStream)==null?void 0:u.videoTrack})}startPublishLiveStream(e,t){return O(this,null,function*(){return this.liveTranscoding.startPublishLiveStream(e,t)})}updatePublishLiveStream(e,t){return O(this,null,function*(){return this.liveTranscoding.updatePublishLiveStream(e,t)})}updatePublishLiveStreamWithTaskId(e,t){return this.liveTranscoding.updatePublishLiveStreamWithTaskId(e,t)}stopPublishLiveStream(e){return O(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 O(this,null,function*(){return this.sendMediaExtensionMsgEx(e,t,5)})}sendMediaExtensionMsgEx(e,t,i){return O(this,null,function*(){var r;if(!this.publisher||!this.isPublishing)throw new Y(te.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 Y(Vt.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 Y(Vt.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 Y(Vt.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 Y(Vt.AliRtcPluginErrorNoFindPlugin,"you should enable beautyPlugin first");const i={segmentBackgroundProcess:{type:0,enable:e}};e&&(i.setSegmentBackgroundImage={type:0,backgroundImgUrl:""}),t.setOptions(i)}setParameter(e){this.bizControl.setParameter(e)}getParameter(){return this.bizControl.getParameter()}sendDataChannelMessage(e){this.bizControl.sendDataChannelMessage(e)}},_(fe,"logName","AliRtcEngine"),_(fe,"logError",!0),_(fe,"isSupported",r0),_(fe,"isDualVideoStreamSupported",ks.isSupport),_(fe,"getCameraList",()=>O(fe,null,function*(){return(yield pe.AliRTS.getCameraList()).filter(t=>t.deviceId)})),_(fe,"getMicrophoneList",()=>O(fe,null,function*(){return(yield pe.AliRTS.getMicList()).filter(t=>t.deviceId)})),_(fe,"getSpeakerList",()=>O(fe,null,function*(){return(yield pe.AliRTS.getSpeakerList()).filter(t=>t.deviceId)})),_(fe,"_instance"),_(fe,"AliRtcSdkChannelProfile",Tt),_(fe,"AliRtcSdkClientRole",Mt),_(fe,"AliRtcVideoStreamType",Ge),_(fe,"AliRtcVideoTrack",Ae),_(fe,"AliRtcAudioTrack",ci),_(fe,"AliRtcPublishState",be),_(fe,"AliRtcSubscribeState",Pe),_(fe,"AliRtcRawDataStreamType",We),_(fe,"AliRtcLogLevel",ds),_(fe,"AliRtcEngineLocalDeviceType",wt),_(fe,"AliRtcEngineLocalDeviceExceptionType",He),_(fe,"AliRtcConnectionStatus",ke),_(fe,"AliRtcConnectionStatusChangeReason",Yt),_(fe,"AliRtcPlugin",Zt),_(fe,"AliRtcPluginTrackType",xi),_(fe,"AliRtcLiveTranscodingParam",ji),_(fe,"AliRtcLiveTranscodingEncodeParam",bs),_(fe,"AliRtcLiveTranscodingMixParam",Ka),_(fe,"AliRtcLiveTranscodingSingleParam",$a),_(fe,"AliRtcTranscodingClockWidget",qa),_(fe,"AliRtcTranscodingImage",Ls),_(fe,"AliRtcTranscodingText",Ja),_(fe,"AliRtcTranscodingUser",Xa),_(fe,"AliRtcLiveTranscodingMixMode",Si),_(fe,"AliRtcLiveTranscodingStreamType",ls),_(fe,"AliRtcLiveTranscodingSourceType",oi),_(fe,"AliRtcLiveTranscodingTaskProfile",fs),_(fe,"AliRtcLiveTranscodingAudioSampleRate",Hi),_(fe,"AliRtcLiveTranscodingSegmentType",yi),_(fe,"AliRtcLiveTranscodingFontType",Ai),_(fe,"AliRtcLiveTranscodingCropMode",ps),_(fe,"AliRtcLiveTranscodingMediaProcessMode",zi),_(fe,"AliRtcLiveTranscodingState",ms),_(fe,"AliRtcLiveTranscodingErrorCode",Et),_(fe,"AliRtcTrascodingPublishTaskStatus",gs),_(fe,"AliRtcDataChannelMsg",ei),_(fe,"AliRtcDataMsgType",Cs),_(fe,"Plugin",Zt),fe);de([z()],he.prototype,"destroy",1),de([z()],he.prototype,"backToUnpublishStatus",1),de([z()],he.prototype,"resumePublishForNetworkRecovery",1),de([z()],he.prototype,"onNetworkRecovery",1),de([z()],he.prototype,"resumeSubList",1),de([z(ne)],he.prototype,"retrySubscribe",1),de([z(ne)],he.prototype,"setEnableDualVideoStream",1),de([z(ne)],he.prototype,"setChannelProfile",1),de([z(ne)],he.prototype,"setClientRole",1),de([z(ne)],he.prototype,"setAudioOnlyMode",1),de([z()],he.prototype,"clearCheckAuthInfoTimer",1),de([z(ne)],he.prototype,"joinChannel",1),de([z(ne)],he.prototype,"leaveChannel",1),de([z(ne)],he.prototype,"refreshAuthInfo",1),de([z(ne)],he.prototype,"publishLocalAudioStream",1),de([z(ne)],he.prototype,"setDefaultSubscribeAllRemoteAudioStreams",1),de([z(ne)],he.prototype,"subscribeAllRemoteAudioStreams",1),de([z(ne)],he.prototype,"subscribeRemoteAudioStream",1),de([z(ne)],he.prototype,"resumeRemoteAudioStream",1),de([z(ne)],he.prototype,"stopRemoteAudioPlay",1),de([z(ne)],he.prototype,"publishLocalVideoStream",1),de([z(ne)],he.prototype,"setRemoteDefaultVideoStreamType",1),de([z(ne)],he.prototype,"setRemoteUserVideoStreamType",1),de([z(ne)],he.prototype,"setDefaultSubscribeAllRemoteVideoStreams",1),de([z(ne)],he.prototype,"subscribeAllRemoteVideoStreams",1),de([z(ne)],he.prototype,"subscribeRemoteMediaStream",1),de([z(ne)],he.prototype,"resumeRemoteMediaStream",1),de([z(([s])=>[`${s==null?void 0:s.audio}`])],he.prototype,"startScreenShare",1),de([z()],he.prototype,"stopScreenShare",1),de([z(ne)],he.prototype,"setScreenShareConfiguration",1),de([z(ne)],he.prototype,"setScreenShareContentHint",1),de([z()],he.prototype,"publishLocalScreenShareStream",1),de([z(ne)],he.prototype,"setAudioShareVolume",1),de([z(ne)],he.prototype,"enableAudioVolumeIndication",1),de([z(ne)],he.prototype,"muteLocalMic",1),de([z(ne)],he.prototype,"muteRemoteAudioPlaying",1),de([z(ne)],he.prototype,"muteAllRemoteAudioPlaying",1),de([z(ne)],he.prototype,"startAudioCapture",1),de([z()],he.prototype,"stopAudioCapture",1),de([z(ne)],he.prototype,"switchMicrophone",1),de([z(ne)],he.prototype,"setRecordingVolume",1),de([z(ne)],he.prototype,"setPlayoutVolume",1),de([z(ne)],he.prototype,"setRemoteAudioVolume",1),de([z(ne)],he.prototype,"setAudioProfile",1),de([z(ne)],he.prototype,"getAudioTrack",1),de([z(ne)],he.prototype,"setLocalViewConfig",1),de([z(ne)],he.prototype,"setCameraCapturerConfiguration",1),de([z(ne)],he.prototype,"setCameraCapturerContentHint",1),de([z(ne)],he.prototype,"enableLocalVideo",1),de([z(ne)],he.prototype,"muteLocalCamera",1),de([z(ne)],he.prototype,"muteLocalScreen",1),de([z(ne)],he.prototype,"setRemoteViewConfig",1),de([z(ne)],he.prototype,"switchCamera",1),de([z()],he.prototype,"startPreview",1),de([z()],he.prototype,"startPreviewScreen",1),de([z()],he.prototype,"stopPreview",1),de([z()],he.prototype,"stopPreviewScreen",1),de([z()],he.prototype,"startPublishLiveStream",1),de([z()],he.prototype,"updatePublishLiveStream",1),de([z()],he.prototype,"updatePublishLiveStreamWithTaskId",1),de([z()],he.prototype,"stopPublishLiveStream",1),de([z()],he.prototype,"stopPublishLiveStreamWithTaskId",1),de([z(ne)],he.prototype,"setEnableMediaExtensionMsg",1),de([z(([s,c,e])=>[s.byteLength,c,e])],he.prototype,"sendMediaExtensionMsgEx",1),de([z(([s,c])=>[s.name||"",c])],he.prototype,"enablePlugin",1),de([z(ne)],he.prototype,"removePlugin",1),de([z(ne)],he.prototype,"setPluginOption",1),de([z(ne)],he.prototype,"getPluginOption",1),de([z(ne)],he.prototype,"setBeautyEffect",1),de([z(ne)],he.prototype,"enableBackgroundExchange",1),de([z(ne)],he.prototype,"enableBackgroundBlur",1),de([z(ne)],he.prototype,"setParameter",1),de([z(([s])=>{var c;return[(c=s.data)==null?void 0:c.byteLength]})],he.prototype,"sendDataChannelMessage",1),de([z(ne)],he,"setLogLevel",1);let Za=he;const Ya=new lr({businessName:"imp-web-rtc",version:(Qa=Za.getSdkVersion())!=null?Qa:"unknown",env:"prod",disabled:window.AliRtcOptionsDisableProxy===!0});Ya.setReady();const du=Ya.wrap(Za);ue.AliRtcConnectionStatus=ke,ue.AliRtcConnectionStatusChangeReason=Yt,ue.AliRtcDataChannelMsg=ei,ue.AliRtcDataMsgType=Cs,ue.AliRtcEngineLocalDeviceExceptionType=He,ue.AliRtcEngineLocalDeviceType=wt,ue.AliRtcErrorCode=te,ue.AliRtcLiveTranscodingAudioSampleRate=Hi,ue.AliRtcLiveTranscodingCropMode=ps,ue.AliRtcLiveTranscodingEncodeParam=bs,ue.AliRtcLiveTranscodingErrorCode=Et,ue.AliRtcLiveTranscodingFontType=Ai,ue.AliRtcLiveTranscodingMediaProcessMode=zi,ue.AliRtcLiveTranscodingMixMode=Si,ue.AliRtcLiveTranscodingMixParam=Ka,ue.AliRtcLiveTranscodingParam=ji,ue.AliRtcLiveTranscodingSegmentType=yi,ue.AliRtcLiveTranscodingSingleParam=$a,ue.AliRtcLiveTranscodingSourceType=oi,ue.AliRtcLiveTranscodingState=ms,ue.AliRtcLiveTranscodingStreamType=ls,ue.AliRtcLiveTranscodingTaskProfile=fs,ue.AliRtcLocalStreamInfo=Ds,ue.AliRtcLogLevel=ds,ue.AliRtcPlugin=Zt,ue.AliRtcPluginTrackType=xi,ue.AliRtcPluginType=Ea,ue.AliRtcPublishState=be,ue.AliRtcRawDataStreamType=We,ue.AliRtcRemoteUserInfo=Va,ue.AliRtcSdkChannelProfile=Tt,ue.AliRtcSdkClientRole=Mt,ue.AliRtcSubscribeState=Pe,ue.AliRtcTranscodingClockWidget=qa,ue.AliRtcTranscodingImage=Ls,ue.AliRtcTranscodingText=Ja,ue.AliRtcTranscodingUser=Xa,ue.AliRtcTrascodingPublishTaskStatus=gs,ue.AliRtcVideoStreamType=Ge,ue.AliRtcVideoTrack=Ae,ue.default=du,Object.defineProperties(ue,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});