zego-express-logger
Version:
zego express log sdk
1 lines • 131 kB
JavaScript
((t,n)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=n(require("protobufjs/minimal"),require("long"));else if("function"==typeof define&&define.amd)define(["protobufjs/minimal","long"],n);else{var i,e="object"==typeof exports?n(require("protobufjs/minimal"),require("long")):n(t["protobufjs/minimal"],t.long);for(i in e)("object"==typeof exports?exports:t)[i]=e[i]}})("undefined"!=typeof self?self:this,function(i,e){return s=[function(t,n){t.exports=i},function(t,n){t.exports=e},function(N,t,n){n.r(t),n.d(t,"ZegoLogger",function(){return vs}),n.d(t,"ZegoDataReport",function(){return M}),n.d(t,"createZegoWebSocket",function(){return F}),n.d(t,"LoggerStateCenter",function(){return D});i.getInstance=function(){return i.instance||(i.instance=new i).u(),i.instance},i.prototype.u=function(){},Object.defineProperty(i.prototype,"testEnvironment",{get:function(){return this.h},set:function(t){this.h=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"ENV",{get:function(){return this.v},set:function(t){this.v=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"debug",{get:function(){return this._},set:function(t){this._=t},enumerable:!1,configurable:!0}),i.instance=new i;var o,r,D=i;function i(){this.h=!1,this.v=0,this._=!1}(t=c=c||{})[t.IE=0]="IE",t[t.FIREFOX=1]="FIREFOX",t[t.CHROME=2]="CHROME",t[t.SAFARI=3]="SAFARI",t[t.OPERA=4]="OPERA",t[t.WEIXIN=5]="WEIXIN",t[t.WEIXINMINI=6]="WEIXINMINI",t[t.UNKOWN=7]="UNKOWN",(c=o=o||{})[c.BROWSER=0]="BROWSER",c[c.WEIXINMINI=1]="WEIXINMINI",(t=r=r||{})[t.DISABLE=0]="DISABLE",t[t.WEBSOCKET=1]="WEBSOCKET",t[t.HTTPS=2]="HTTPS";var Z,U,s={DEBUG:0,INFO:1,WARN:2,ERROR:3,REPORT:99,DISABLE:100,debug:0,info:1,warn:2,error:3,report:99,disable:100},L=(0,0,0,(c=Z=Z||{})[c.IPv4Only=0]="IPv4Only",c[c.IPv4Prefer=1]="IPv4Prefer",c[c.IPv6Prefer=2]="IPv6Prefer",(t=U=U||{})[t.offline=0]="offline",t[t.online=1]="online",P.prototype.init=function(){var n=this;this.g&&(this.readyState=0,this.g.onOpen(function(t){n.readyState=n.g.readyState,"function"==typeof n.onopen&&(n.onopen(t),n.g.onClose(function(t){n.readyState=n.g.readyState,"function"==typeof n.onclose&&n.onclose(t)}),n.g.onMessage(function(t){"function"==typeof n.onmessage&&n.onmessage(t)}))}),this.g.onError(function(t){n.readyState=n.g.readyState,"function"==typeof n.onerror&&n.onerror(t)}))},P.prototype.onopen=function(t){},P.prototype.onerror=function(t){},P.prototype.onclose=function(t){},P.prototype.onmessage=function(t){},P.prototype.send=function(t){this.g&&this.g.send({data:t})},P.prototype.close=function(){this.g&&this.g.close()},P);function P(t,n){this.url=t,this.readyState=3,this.init()}function F(t,n,i){return n%2===o.BROWSER?(n=t,(i=i)?i.createSocket(n,1):new WebSocket(n)):new L(t)}var z=function(){return(z=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},M=(e.prototype.newReport=function(t,n){this.dataStatistics[t]={event_time:Date.now(),time_consumed:0,seq:t,error:0,message:"success",event:n,events:[]}},e.prototype.addMsgExt=function(t,n){this.dataStatistics[t]?this.dataStatistics[t].msg_ext=n:console.warn("".concat(t," not exist"))},e.prototype.addMsgInfo=function(t,n){this.dataStatistics[t]?Object.assign(this.dataStatistics[t],n):console.warn("".concat(t," not exist"))},e.prototype.eventStart=function(t,n){this.dataStatistics[t]?null==this.dataStatistics[t].events?this.logger.warn("zd.es.0 no events"):this.dataStatistics[t].events.push({event:n,event_time:Date.now(),time_consumed:0}):this.logger.warn("zd.es.0 no seq match")},e.prototype.eventEnd=function(t,n,i){if(this.dataStatistics[t]){var e=this.dataStatistics[t].events;if(e&&0!==e.length){for(var r=e.length-1;0<=r;r--)if(e[r].event==n&&0==e[r].time_consumed){e[r].time_consumed=Date.now()-e[r].event_time;break}}else this.logger.info("zd.ee.0 no events")}else this.logger.info("zd.ee.0 no seq match")},e.prototype.eventEndWithMsg=function(t,n,i){if(this.dataStatistics[t]){var e=this.dataStatistics[t].events;if(e){for(var r=e.length-1;0<=r;r--)if(e[r].event==n&&0==e[r].time_consumed){e[r].time_consumed=Date.now()-e[r].event_time,null==e[r].msg_ext&&(e[r].msg_ext={}),e[r].msg_ext=z({},i);break}}else this.logger.warn("zd.ee.0 no events")}else this.logger.warn("zd.ee.0 no seq match")},e.prototype.eventEndWithMsgInfo=function(t,n,i){if(this.dataStatistics[t]){var e=this.dataStatistics[t].events;if(e){for(var r=e.length-1;0<=r;r--)if(e[r].event==n&&0==e[r].time_consumed){e[r].time_consumed=Date.now()-e[r].event_time,Object.assign(e[r],i);break}}else this.logger.warn("zd.ee.0 no events")}else this.logger.warn("zd.ee.0 no seq match")},e.prototype.addEventInfo=function(t,n,i,e){if(this.dataStatistics[t]){var r=this.dataStatistics[t].events;if(null==r)this.logger.warn("zd.aei.0 no events");else for(var s=r.length-1;0<=s;s--)if(r[s].event==n&&null!=r[s].time_consumed){null==r[s].msg_ext?r[s].msg_ext={}:r[s].msg_ext&&(r[s].msg_ext[i]=e);break}}else this.logger.warn("zd.aei.0 no seq match")},e.prototype.addEventMsg=function(t,n,i,e){if(this.dataStatistics[t]){var r=this.dataStatistics[t].events;if(null==r)this.logger.warn("zd.aem.0 no events");else for(var s=r.length-1;0<=s;s--)if(r[s].event==n){r[s][i]=e;break}}else this.logger.warn("zd.aem.0 no seq match")},e.prototype.addEvent=function(t,n,i){this.dataStatistics[t]?this.dataStatistics[t].events&&(i?this.dataStatistics[t].events.push({event:n,event_time:Date.now(),msg_ext:i}):this.dataStatistics[t].events.push({event:n,event_time:Date.now()})):this.logger.warn("zd.ae.0 no seq match")},e.prototype.uploadReport=function(t,n,i,e){var r=this.dataStatistics[t];null!=r&&(n&&(r.event=n),r.time_consumed=Date.now()-r.event_time,i&&this.addMsgInfo(t,{error:i.code,message:i.message||i.msg+" "+(e||"")}),this.logger.report(r),delete this.dataStatistics[t])},e);function e(t){this.dataStatistics={},this.logger=t}var B,C=["00","01","02","03","04","05","06","07","08","09"];function H(){var t=new Date;return[t.getFullYear()+"/",(C[t.getMonth()+1]||t.getMonth()+1)+"/",(C[t.getDate()]||t.getDate())+" ",(C[t.getHours()]||t.getHours())+":",(C[t.getMinutes()]||t.getMinutes())+":",C[t.getSeconds()]||t.getSeconds(),"."+(""+t.getTime()).slice(-3)].join("")}(c=B=B||{}).WEBSOCKET_STATE_CHANGE="zl.net.wsc",c.OPEN_WS="zl.net.opws";var a=n(0),t=n(1);(a=a.default||a).util.Long=t.default||t,a.util.Long.fromBits=a.util.Long.fromBits||function(){return 0};for(var l=a.roots,q=a.types?a.types.basic:{double:1,float:5,int32:0,uint32:0,sint32:0,fixed32:5,sfixed32:5,int64:0,uint64:0,sint64:0,fixed64:1,sfixed64:1,bool:0,string:2,bytes:2},J=a.types?a.types.packed:{double:1,float:5,int32:0,uint32:0,sint32:0,fixed32:5,sfixed32:5,int64:0,uint64:0,sint64:0,fixed64:1,sfixed64:1,bool:0},K=Object.keys(q),Y={$:function(t){return Y[t]?Y[t].call(this):l[t].decode?l[t].decode(this,this.uint32()):Y.$.call(this,"int32")}},Q={$:function(t,n,i){var e=q[t];return void 0===e?l[t].encode?(this.uint32((i<<3|2)>>0).fork(),l[t].encode(n,this).ldelim()):Q.$.call(this,"int32",n,i):Q[t].call(this.uint32(i<<3|e),n)}},V=0;V<K.length;V++)Y[K[V]]=a.Reader.prototype[K[V]],Q[K[V]]=a.Writer.prototype[K[V]];!function s(t,o,n,i){for(var e=0,r=Object.keys(t);e<r.length;e++){var u=r[e];if(t[u].$m&&Object.keys(t[u].$m).every(function(t){return Number(t)})){if(n[u])throw Error(`nested type ${n}.${u} has already exist`);n[u]=((f,t)=>{function h(t){for(var n in f){n=f[n];"{"===n[1].charAt(0)?this[n[0]]={}:"["!==n[1].charAt(0)&&"<"!==n[1].charAt(0)||(this[n[0]]=[])}if(t)for(var i=Object.keys(t),e=0;e<i.length;++e)null!=t[i[e]]&&(this[i[e]]=t[i[e]])}var n,i={};for(n in f){var e=f[n],r=e[1];"{"===r.charAt(0)?(h.prototype[e[0]]=a.util.emptyObject,i[r]={$m:r.substring(1).split(",").map(function(t,n){return["$"+(n+1),t,null]}).reduce(function(t,n,i){return t[i+1]=n,t},{})}):"["===r.charAt(0)||"<"===r.charAt(0)?h.prototype[e[0]]=a.util.emptyArray:"bytes"===r?h.prototype[e[0]]=a.util.newBuffer([]):e[2]&&e[2].hasOwnProperty("low")&&e[2].hasOwnProperty("high")?h.prototype[e[0]]=a.util.Long.fromBits(e[2].low,e[2].high,e[2].unsigned):h.prototype[e[0]]=e[2]}return h.create=function(t){return new h(t)},h.decode=function(t,n){t instanceof a.Reader||(t=a.Reader.create(t));for(var i=void 0===n?t.len:t.pos+n,e=new h;t.pos<i;){var r=t.uint32(),s=r>>>3;if(0<s&&f[s]){var o=f[s][0];if("{"===(u=f[s][1]).charAt(0)){e[o]===a.util.emptyObject&&(e[o]={});s=h.$namespace[u].decode(t,t.uint32());e[o][s.$1]=s.$2}else if("["===u.charAt(0)||"<"===u.charAt(0)){u=u.substring(1),e[o]&&e[o].length||(e[o]=[]);var u,s=!Y[u]&&!l[u].decode;if(void 0!==J[u=s?"int32":u]&&2==(7&r))for(var c=t.uint32()+t.pos;t.pos<c;)e[o].push(Y.$.call(t,u));else e[o].push(Y.$.call(t,u))}else e[o]=Y.$.call(t,u)}else t.skipType(7&r)}return e},h.encode=function(t,n){for(var i in n=n||a.Writer.create(),f){var e=f[i][0];if("{"===(c=f[i][1]).charAt(0)){if(null!=t[e]&&t.hasOwnProperty(e))for(var r=0,s=Object.keys(t[e]);r<s.length;++r)n.uint32((i<<3|2)>>0).fork(),h.$namespace[c].encode({$1:s[r],$2:t[e][s[r]]},n).ldelim()}else if("["===c.charAt(0)||"<"===c.charAt(0)){var o="<"===c.charAt(0),u=(c=c.substring(1),t[e]);if(null!=u&&u.length){var c=void 0===q[c]&&!l[c].encode?"int32":c;if(o&&void 0!==J[c]){n.uint32((i<<3|2)>>0).fork();for(r=0;r<u.length;r++)Q[c].call(n,u[r]);n.ldelim()}else for(r=0;r<u.length;r++)Q.$.call(n,c,u[r],i)}}else null!=t[e]&&t.hasOwnProperty(e)&&Q.$.call(n,c,t[e],i)}return n},Object.keys(i).length&&(h.$namespace=s(i,o+"."+t,h.$namespace||{},!0)),h})(t[u].$m,u)}else t[u].$s?n[u]=((n,r)=>{function s(t,n,i){a.rpc.Service.call(this,t,n,i)}return((s.prototype=Object.create(a.rpc.Service.prototype)).constructor=s).create=function(t,n,i){return new s(t,n,i)},Object.keys(n).forEach(function(t){var i=n[t];function e(t,n){return this.rpcCall(e,l[i[0]],l[i[1]],t,n)}Object.defineProperty(e,"name",{value:t}),Object.defineProperty(e,"path",{value:o+"."+r}),s.prototype[t]=e}),s})(t[u].$s,u):t[u].$e&&Object.values(t[u].$e).every(function(t){return Number(t)===t})&&(n[u]=(t=>{for(var n=Object.keys(t),i={},e=0;e<n.length;e++)i[i[n[e]]=t[n[e]]]=n[e];return i})(t[u].$e));n[u]&&!i&&(l[o+"."+u]=n[u]),delete t[u].$m,delete t[u].$s,delete t[u].$e,n[u]=s(t[u],Boolean(o)?o+"."+u:u,n[u]||{})}return n}({report:{rtcreport:{DetailLogRequest:{$m:{1:["appid","uint32",0],2:["product","uint32",0],3:["id_name","string",""],4:["timestamp","uint64",{low:0,high:0,unsigned:!0}],5:["litesign","string",""],6:["detail_data","bytes",[]]}},DetailLogResponse:{$m:{1:["code","uint32",0]}}}}},"",l,!1);var tt=l.report;let nt=0,it=1;function et(t){let n=t.length;for(;0<=--n;)t[n]=0}let rt=29,st=256,ot=st+1+rt,ut=30,ct=19,ft=2*ot+1,ht=15,at=16,lt=7,vt=256,dt=16,wt=17,bt=18,yt=new Uint8Array([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]),mt=new Uint8Array([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]),_t=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),gt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);let u=new Array(2*(ot+2)),pt=(et(u),new Array(2*ut)),Ot=(et(pt),new Array(512)),St=(et(Ot),new Array(256)),kt=(et(St),new Array(rt)),Et=(et(kt),new Array(ut));function At(t,n,i,e,r){this.static_tree=t,this.extra_bits=n,this.extra_base=i,this.elems=e,this.max_length=r,this.has_stree=t&&t.length}et(Et);let jt,Tt,xt;function Rt(t,n){this.dyn_tree=t,this.max_code=0,this.stat_desc=n}let It=t=>t<256?Ot[t]:Ot[256+(t>>>7)],Nt=(t,n)=>{t.pending_buf[t.pending++]=255&n,t.pending_buf[t.pending++]=n>>>8&255},h=(t,n,i)=>{t.bi_valid>at-i?(t.bi_buf|=n<<t.bi_valid&65535,Nt(t,t.bi_buf),t.bi_buf=n>>at-t.bi_valid,t.bi_valid+=i-at):(t.bi_buf|=n<<t.bi_valid&65535,t.bi_valid+=i)},v=(t,n,i)=>{h(t,i[2*n],i[2*n+1])},Dt=(t,n)=>{let i=0;for(;i|=1&t,t>>>=1,i<<=1,0<--n;);return i>>>1},Zt=(t,n)=>{var i,e=n.dyn_tree,r=n.max_code,s=n.stat_desc.static_tree,o=n.stat_desc.has_stree,u=n.stat_desc.extra_bits,c=n.stat_desc.extra_base,f=n.stat_desc.max_length;let h,a,l,v,d,w=0;for(v=0;v<=ht;v++)t.bl_count[v]=0;for(e[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<ft;h++)a=t.heap[h],(v=e[2*e[2*a+1]+1]+1)>f&&(v=f,w++),e[2*a+1]=v,a>r||(t.bl_count[v]++,d=0,a>=c&&(d=u[a-c]),i=e[2*a],t.opt_len+=i*(v+d),o&&(t.static_len+=i*(s[2*a+1]+d)));if(0!==w){do{for(v=f-1;0===t.bl_count[v];)v--}while(t.bl_count[v]--,t.bl_count[v+1]+=2,t.bl_count[f]--,0<(w-=2));for(v=f;0!==v;v--)for(a=t.bl_count[v];0!==a;)r<(l=t.heap[--h])||(e[2*l+1]!==v&&(t.opt_len+=(v-e[2*l+1])*e[2*l],e[2*l+1]=v),a--)}},Ut=(t,n,i)=>{var e=new Array(ht+1);let r=0,s,o;for(s=1;s<=ht;s++)r=r+i[s-1]<<1,e[s]=r;for(o=0;o<=n;o++){var u=t[2*o+1];0!==u&&(t[2*o]=Dt(e[u]++,u))}},Lt=t=>{let n;for(n=0;n<ot;n++)t.dyn_ltree[2*n]=0;for(n=0;n<ut;n++)t.dyn_dtree[2*n]=0;for(n=0;n<ct;n++)t.bl_tree[2*n]=0;t.dyn_ltree[2*vt]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Pt=t=>{8<t.bi_valid?Nt(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Ft=(t,n,i,e)=>{var r=2*n,s=2*i;return t[r]<t[s]||t[r]===t[s]&&e[n]<=e[i]},zt=(t,n,i)=>{var e=t.heap[i];let r=i<<1;for(;r<=t.heap_len&&(r<t.heap_len&&Ft(n,t.heap[r+1],t.heap[r],t.depth)&&r++,!Ft(n,e,t.heap[r],t.depth));)t.heap[i]=t.heap[r],i=r,r<<=1;t.heap[i]=e},Mt=(t,n,i)=>{var e,r,s,o;let u=0;if(0!==t.sym_next)for(;e=255&t.pending_buf[t.sym_buf+u++],e+=(255&t.pending_buf[t.sym_buf+u++])<<8,r=t.pending_buf[t.sym_buf+u++],0==e?v(t,r,n):(s=St[r],v(t,s+st+1,n),0!==(o=yt[s])&&(r-=kt[s],h(t,r,o)),e--,s=It(e),v(t,s,i),0!==(o=mt[s])&&(e-=Et[s],h(t,e,o))),u<t.sym_next;);v(t,vt,n)},Bt=(t,n)=>{var i=n.dyn_tree,e=n.stat_desc.static_tree,r=n.stat_desc.has_stree,s=n.stat_desc.elems;let o,u,c=-1,f;for(t.heap_len=0,t.heap_max=ft,o=0;o<s;o++)0!==i[2*o]?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):i[2*o+1]=0;for(;t.heap_len<2;)i[2*(f=t.heap[++t.heap_len]=c<2?++c:0)]=1,t.depth[f]=0,t.opt_len--,r&&(t.static_len-=e[2*f+1]);for(n.max_code=c,o=t.heap_len>>1;1<=o;o--)zt(t,i,o);for(f=s;o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],zt(t,i,1),u=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=u,i[2*f]=i[2*o]+i[2*u],t.depth[f]=(t.depth[o]>=t.depth[u]?t.depth[o]:t.depth[u])+1,i[2*o+1]=i[2*u+1]=f,t.heap[1]=f++,zt(t,i,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],Zt(t,n),Ut(i,c,t.bl_count)},Ct=(t,n,i)=>{let e,r=-1;var s;let o=n[1],u=0,c=7,f=4;for(0===o&&(c=138,f=3),n[2*(i+1)+1]=65535,e=0;e<=i;e++)s=o,o=n[2*(e+1)+1],++u<c&&s===o||(u<f?t.bl_tree[2*s]+=u:0!==s?(s!==r&&t.bl_tree[2*s]++,t.bl_tree[2*dt]++):u<=10?t.bl_tree[2*wt]++:t.bl_tree[2*bt]++,u=0,r=s,f=0===o?(c=138,3):s===o?(c=6,3):(c=7,4))},Ht=(t,n,i)=>{let e,r=-1;var s;let o=n[1],u=0,c=7,f=4;for(0===o&&(c=138,f=3),e=0;e<=i;e++)if(s=o,o=n[2*(e+1)+1],!(++u<c&&s===o)){if(u<f)for(;v(t,s,t.bl_tree),0!=--u;);else 0!==s?(s!==r&&(v(t,s,t.bl_tree),u--),v(t,dt,t.bl_tree),h(t,u-3,2)):u<=10?(v(t,wt,t.bl_tree),h(t,u-3,3)):(v(t,bt,t.bl_tree),h(t,u-11,7));u=0,r=s,f=0===o?(c=138,3):s===o?(c=6,3):(c=7,4)}},qt=!1;let Jt=(t,n,i,e)=>{h(t,0+(e?1:0),3),Pt(t),Nt(t,i),Nt(t,~i),i&&t.pending_buf.set(t.window.subarray(n,n+i),t.pending),t.pending+=i};var c={O:t=>{qt||((()=>{let t,n,i,e,r;var s=new Array(ht+1);for(i=0,e=0;e<rt-1;e++)for(kt[e]=i,t=0;t<1<<yt[e];t++)St[i++]=e;for(St[i-1]=e,r=0,e=0;e<16;e++)for(Et[e]=r,t=0;t<1<<mt[e];t++)Ot[r++]=e;for(r>>=7;e<ut;e++)for(Et[e]=r<<7,t=0;t<1<<mt[e]-7;t++)Ot[256+r++]=e;for(n=0;n<=ht;n++)s[n]=0;for(t=0;t<=143;)u[2*t+1]=8,t++,s[8]++;for(;t<=255;)u[2*t+1]=9,t++,s[9]++;for(;t<=279;)u[2*t+1]=7,t++,s[7]++;for(;t<=287;)u[2*t+1]=8,t++,s[8]++;for(Ut(u,ot+1,s),t=0;t<ut;t++)pt[2*t+1]=5,pt[2*t]=Dt(t,5);jt=new At(u,yt,st+1,ot,ht),Tt=new At(pt,mt,0,ut,ht),xt=new At(new Array(0),_t,0,ct,lt)})(),qt=!0),t.l_desc=new Rt(t.dyn_ltree,jt),t.d_desc=new Rt(t.dyn_dtree,Tt),t.bl_desc=new Rt(t.bl_tree,xt),t.bi_buf=0,t.bi_valid=0,Lt(t)},S:Jt,k:(t,n,i,e)=>{let r,s,o=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let n=4093624447,i;for(i=0;i<=31;i++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*i])return nt;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return it;for(i=32;i<st;i++)if(0!==t.dyn_ltree[2*i])return it;return nt})(t)),Bt(t,t.l_desc),Bt(t,t.d_desc),o=(t=>{let n;for(Ct(t,t.dyn_ltree,t.l_desc.max_code),Ct(t,t.dyn_dtree,t.d_desc.max_code),Bt(t,t.bl_desc),n=ct-1;3<=n&&0===t.bl_tree[2*gt[n]+1];n--);return t.opt_len+=3*(n+1)+5+5+4,n})(t),r=t.opt_len+3+7>>>3,(s=t.static_len+3+7>>>3)<=r&&(r=s)):r=s=i+5,i+4<=r&&-1!==n?Jt(t,n,i,e):4===t.strategy||s===r?(h(t,2+(e?1:0),3),Mt(t,u,pt)):(h(t,4+(e?1:0),3),((t,n,i,e)=>{let r;for(h(t,n-257,5),h(t,i-1,5),h(t,e-4,4),r=0;r<e;r++)h(t,t.bl_tree[2*gt[r]+1],3);Ht(t,t.dyn_ltree,n-1),Ht(t,t.dyn_dtree,i-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),Mt(t,t.dyn_ltree,t.dyn_dtree)),Lt(t),e&&Pt(t)},A:(t,n,i)=>(t.pending_buf[t.sym_buf+t.sym_next++]=n,t.pending_buf[t.sym_buf+t.sym_next++]=n>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===n?t.dyn_ltree[2*i]++:(t.matches++,n--,t.dyn_ltree[2*(St[i]+st+1)]++,t.dyn_dtree[2*It(n)]++),t.sym_next===t.sym_end),j:t=>{h(t,2,3),v(t,vt,u),16===(t=t).bi_valid?(Nt(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},Kt=(t,n,i,e)=>{let r=65535&t|0,s=t>>>16&65535|0,o=0;for(;0!==i;){for(i-=o=2e3<i?2e3:i;r=r+n[e++]|0,s=s+r|0,--o;);r%=65521,s%=65521}return r|s<<16|0};let Gt=new Uint32Array((()=>{let t,n=[];for(var i=0;i<256;i++){t=i;for(var e=0;e<8;e++)t=1&t?3988292384^t>>>1:t>>>1;n[i]=t}return n})());var G=(n,i,t,e)=>{var r=Gt,s=e+t;n^=-1;for(let t=e;t<s;t++)n=n>>>8^r[255&(n^i[t])];return-1^n},Wt={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"},n={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_MEM_ERROR:-4,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};let{O:Xt,S:$t,k:Yt,A:Qt,j:Vt}=c,{Z_NO_FLUSH:tn,Z_PARTIAL_FLUSH:nn,Z_FULL_FLUSH:en,Z_FINISH:f,Z_BLOCK:rn,Z_OK:d,Z_STREAM_END:sn,Z_STREAM_ERROR:w,Z_DATA_ERROR:on,Z_BUF_ERROR:un,Z_DEFAULT_COMPRESSION:cn,Z_FILTERED:fn,Z_HUFFMAN_ONLY:hn,Z_RLE:an,Z_FIXED:ln,Z_DEFAULT_STRATEGY:vn,Z_UNKNOWN:dn,Z_DEFLATED:wn}=n,bn=9;let yn=286,mn=30,_n=19,gn=2*yn+1,pn=15,b=3,On=258,y=On+b+1,Sn=42,kn=57,En=69,An=73,jn=91,Tn=103,xn=113,Rn=666,m=1,In=2,Nn=3,Dn=4,Zn=(t,n)=>(t.msg=Wt[n],n),Un=t=>2*t-(4<t?9:0),Ln=t=>{let n=t.length;for(;0<=--n;)t[n]=0},Pn=t=>{let n,i,e;var r=t.w_size;for(n=t.hash_size,e=n;i=t.head[--e],t.head[e]=i>=r?i-r:0,--n;);for(n=r,e=n;i=t.prev[--e],t.prev[e]=i>=r?i-r:0,--n;);};let Fn=(t,n,i)=>(n<<t.hash_shift^i)&t.hash_mask,_=t=>{var n=t.state;let i=n.pending;0!==(i=i>t.avail_out?t.avail_out:i)&&(t.output.set(n.pending_buf.subarray(n.pending_out,n.pending_out+i),t.next_out),t.next_out+=i,n.pending_out+=i,t.total_out+=i,t.avail_out-=i,n.pending-=i,0===n.pending)&&(n.pending_out=0)},g=(t,n)=>{Yt(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,n),t.block_start=t.strstart,_(t.strm)},p=(t,n)=>{t.pending_buf[t.pending++]=n},zn=(t,n)=>{t.pending_buf[t.pending++]=n>>>8&255,t.pending_buf[t.pending++]=255&n},Mn=(t,n,i,e)=>{let r=t.avail_in;return 0===(r=r>e?e:r)?0:(t.avail_in-=r,n.set(t.input.subarray(t.next_in,t.next_in+r),i),1===t.state.wrap?t.adler=Kt(t.adler,n,r,i):2===t.state.wrap&&(t.adler=G(t.adler,n,r,i)),t.next_in+=r,t.total_in+=r,r)},Bn=(t,n)=>{let i=t.max_chain_length,e=t.strstart,r;var s;let o=t.prev_length,u=t.nice_match;var c=t.strstart>t.w_size-y?t.strstart-(t.w_size-y):0,f=t.window,h=t.w_mask,a=t.prev,l=t.strstart+On;let v=f[e+o-1],d=f[e+o];t.good_match<=t.prev_length&&(i>>=2),u>t.lookahead&&(u=t.lookahead);do{if(f[(r=n)+o]===d&&f[r+o-1]===v&&f[r]===f[e]&&f[++r]===f[e+1]){for(e+=2,r++;f[++e]===f[++r]&&f[++e]===f[++r]&&f[++e]===f[++r]&&f[++e]===f[++r]&&f[++e]===f[++r]&&f[++e]===f[++r]&&f[++e]===f[++r]&&f[++e]===f[++r]&&e<l;);if(s=On-(l-e),e=l-On,s>o){if(t.match_start=n,(o=s)>=u)break;v=f[e+o-1],d=f[e+o]}}}while((n=a[n&h])>c&&0!=--i);return o<=t.lookahead?o:t.lookahead},Cn=t=>{var n=t.w_size;let i,e,r;do{if(e=t.window_size-t.lookahead-t.strstart,t.strstart>=n+(n-y)&&(t.window.set(t.window.subarray(n,n+n-e),0),t.match_start-=n,t.strstart-=n,t.block_start-=n,t.strstart<t.insert&&(t.insert=t.strstart),Pn(t),e+=n),0===t.strm.avail_in)break;if(i=Mn(t.strm,t.window,t.strstart+t.lookahead,e),t.lookahead+=i,t.lookahead+t.insert>=b)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=Fn(t,t.ins_h,t.window[r+1]);t.insert&&(t.ins_h=Fn(t,t.ins_h,t.window[r+b-1]),t.prev[r&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=r,r++,t.insert--,!(t.lookahead+t.insert<b)););}while(t.lookahead<y&&0!==t.strm.avail_in)},Hn=(t,n)=>{let i=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,e,r,s,o=0;for(var u=t.strm.avail_in;e=65535,s=t.bi_valid+42>>3,!(t.strm.avail_out<s||(s=t.strm.avail_out-s,r=t.strstart-t.block_start,(e=(e=e>r+t.strm.avail_in?r+t.strm.avail_in:e)>s?s:e)<i&&(0===e&&n!==f||n===tn||e!==r+t.strm.avail_in))||(o=n===f&&e===r+t.strm.avail_in?1:0,$t(t,0,0,o),t.pending_buf[t.pending-4]=e,t.pending_buf[t.pending-3]=e>>8,t.pending_buf[t.pending-2]=~e,t.pending_buf[t.pending-1]=~e>>8,_(t.strm),r&&(r>e&&(r=e),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+r),t.strm.next_out),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r,t.block_start+=r,e-=r),e&&(Mn(t.strm,t.strm.output,t.strm.next_out,e),t.strm.next_out+=e,t.strm.avail_out-=e,t.strm.total_out+=e),0!==o)););return(u-=t.strm.avail_in)&&(u>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=u&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.strstart<t.insert)&&(t.insert=t.strstart),t.window.set(t.strm.input.subarray(t.strm.next_in-u,t.strm.next_in),t.strstart),t.strstart+=u,t.insert+=t.w_size-t.insert<u?t.w_size-t.insert:u),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?Dn:n!==tn&&n!==f&&0===t.strm.avail_in&&t.strstart===t.block_start?In:(s=t.window_size-t.strstart,t.strm.avail_in>s&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.strstart<t.insert)&&(t.insert=t.strstart),(s=s>t.strm.avail_in?t.strm.avail_in:s)&&(Mn(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water<t.strstart&&(t.high_water=t.strstart),s=t.bi_valid+42>>3,s=65535<t.pending_buf_size-s?65535:t.pending_buf_size-s,i=s>t.w_size?t.w_size:s,((r=t.strstart-t.block_start)>=i||(r||n===f)&&n!==tn&&0===t.strm.avail_in&&r<=s)&&(e=r>s?s:r,o=n===f&&0===t.strm.avail_in&&e===r?1:0,$t(t,t.block_start,e,o),t.block_start+=e,_(t.strm)),o?Nn:m)};t=(t,n)=>{let i,e;for(;;){if(t.lookahead<y){if(Cn(t),t.lookahead<y&&n===tn)return m;if(0===t.lookahead)break}if(i=0,t.lookahead>=b&&(t.ins_h=Fn(t,t.ins_h,t.window[t.strstart+b-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-y&&(t.match_length=Bn(t,i)),t.match_length>=b)if(e=Qt(t,t.strstart-t.match_start,t.match_length-b),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=b){for(t.match_length--;t.strstart++,t.ins_h=Fn(t,t.ins_h,t.window[t.strstart+b-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Fn(t,t.ins_h,t.window[t.strstart+1]);else e=Qt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(e&&(g(t,!1),0===t.strm.avail_out))return m}return t.insert=t.strstart<b-1?t.strstart:b-1,n===f?(g(t,!0),0===t.strm.avail_out?Nn:Dn):t.sym_next&&(g(t,!1),0===t.strm.avail_out)?m:In},c=(t,n)=>{let i,e;for(var r;;){if(t.lookahead<y){if(Cn(t),t.lookahead<y&&n===tn)return m;if(0===t.lookahead)break}if(i=0,t.lookahead>=b&&(t.ins_h=Fn(t,t.ins_h,t.window[t.strstart+b-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=b-1,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-y&&(t.match_length=Bn(t,i),t.match_length<=5)&&(t.strategy===fn||t.match_length===b&&4096<t.strstart-t.match_start)&&(t.match_length=b-1),t.prev_length>=b&&t.match_length<=t.prev_length){for(r=t.strstart+t.lookahead-b,e=Qt(t,t.strstart-1-t.prev_match,t.prev_length-b),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=r&&(t.ins_h=Fn(t,t.ins_h,t.window[t.strstart+b-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=b-1,t.strstart++,e&&(g(t,!1),0===t.strm.avail_out))return m}else if(t.match_available){if((e=Qt(t,0,t.window[t.strstart-1]))&&g(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return m}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(e=Qt(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<b-1?t.strstart:b-1,n===f?(g(t,!0),0===t.strm.avail_out?Nn:Dn):t.sym_next&&(g(t,!1),0===t.strm.avail_out)?m:In};function O(t,n,i,e,r){this.good_length=t,this.max_lazy=n,this.nice_length=i,this.max_chain=e,this.func=r}let qn=[new O(0,0,0,0,Hn),new O(4,4,8,4,t),new O(4,5,16,8,t),new O(4,6,32,32,t),new O(4,4,16,16,c),new O(8,16,32,32,c),new O(8,16,128,128,c),new O(8,32,128,256,c),new O(32,128,258,1024,c),new O(32,258,258,4096,c)],Jn=t=>{t.window_size=2*t.w_size,Ln(t.head),t.max_lazy_match=qn[t.level].max_lazy,t.good_match=qn[t.level].good_length,t.nice_match=qn[t.level].nice_length,t.max_chain_length=qn[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=b-1,t.match_available=0,t.ins_h=0};function Kn(){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=wn,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 Uint16Array(2*gn),this.dyn_dtree=new Uint16Array(2*(2*mn+1)),this.bl_tree=new Uint16Array(2*(2*_n+1)),Ln(this.dyn_ltree),Ln(this.dyn_dtree),Ln(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(pn+1),this.heap=new Uint16Array(2*yn+1),Ln(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*yn+1),Ln(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}let Gn=t=>{var n;return!t||!(n=t.state)||n.strm!==t||n.status!==Sn&&n.status!==kn&&n.status!==En&&n.status!==An&&n.status!==jn&&n.status!==Tn&&n.status!==xn&&n.status!==Rn?1:0},Wn=t=>{if(Gn(t))return Zn(t,w);t.total_in=t.total_out=0,t.data_type=dn;var n=t.state;return n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=2===n.wrap?kn:n.wrap?Sn:xn,t.adler=2===n.wrap?0:1,n.last_flush=-2,Xt(n),d},Xn=t=>{var n=Wn(t);return n===d&&Jn(t.state),n};let $n=(t,n,i,e,r,s)=>{if(!t)return w;let o=1;if(n===cn&&(n=6),e<0?(o=0,e=-e):15<e&&(o=2,e-=16),r<1||r>bn||i!==wn||e<8||15<e||n<0||9<n||s<0||s>ln||8===e&&1!==o)return Zn(t,w);8===e&&(e=9);var u=new Kn;return(t.state=u).strm=t,u.status=Sn,u.wrap=o,u.gzhead=null,u.w_bits=e,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=r+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+b-1)/b),u.window=new Uint8Array(2*u.w_size),u.head=new Uint16Array(u.hash_size),u.prev=new Uint16Array(u.w_size),u.lit_bufsize=1<<r+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new Uint8Array(u.pending_buf_size),u.sym_buf=u.lit_bufsize,u.sym_end=3*(u.lit_bufsize-1),u.level=n,u.strategy=s,u.method=i,Xn(t)};var Yn={deflateInit:(t,n)=>$n(t,n,wn,15,8,vn),deflateInit2:$n,deflateReset:Xn,deflateResetKeep:Wn,deflateSetHeader:(t,n)=>Gn(t)||2!==t.state.wrap?w:(t.state.gzhead=n,d),deflate:(i,t)=>{if(Gn(i)||t>rn||t<0)return i?Zn(i,w):w;var e=i.state;if(!i.output||0!==i.avail_in&&!i.input||e.status===Rn&&t!==f)return Zn(i,0===i.avail_out?un:w);var r=e.last_flush;if(e.last_flush=t,0!==e.pending){if(_(i),0===i.avail_out)return e.last_flush=-1,d}else if(0===i.avail_in&&Un(t)<=Un(r)&&t!==f)return Zn(i,un);if(e.status===Rn&&0!==i.avail_in)return Zn(i,un);if(e.status===Sn&&0===e.wrap&&(e.status=xn),e.status===Sn){let t=wn+(e.w_bits-8<<4)<<8,n=-1;if(n=e.strategy>=hn||e.level<2?0:e.level<6?1:6===e.level?2:3,t|=n<<6,0!==e.strstart&&(t|=32),t+=31-t%31,zn(e,t),0!==e.strstart&&(zn(e,i.adler>>>16),zn(e,65535&i.adler)),i.adler=1,e.status=xn,_(i),0!==e.pending)return e.last_flush=-1,d}if(e.status===kn)if(i.adler=0,p(e,31),p(e,139),p(e,8),e.gzhead)p(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),p(e,255&e.gzhead.time),p(e,e.gzhead.time>>8&255),p(e,e.gzhead.time>>16&255),p(e,e.gzhead.time>>24&255),p(e,9===e.level?2:e.strategy>=hn||e.level<2?4:0),p(e,255&e.gzhead.os),e.gzhead.extra&&e.gzhead.extra.length&&(p(e,255&e.gzhead.extra.length),p(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(i.adler=G(i.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=En;else if(p(e,0),p(e,0),p(e,0),p(e,0),p(e,0),p(e,9===e.level?2:e.strategy>=hn||e.level<2?4:0),p(e,3),e.status=xn,_(i),0!==e.pending)return e.last_flush=-1,d;if(e.status===En){if(e.gzhead.extra){let t=e.pending,n=(65535&e.gzhead.extra.length)-e.gzindex;for(;e.pending+n>e.pending_buf_size;){var s=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+s),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>t&&(i.adler=G(i.adler,e.pending_buf,e.pending-t,t)),e.gzindex+=s,_(i),0!==e.pending)return e.last_flush=-1,d;t=0,n-=s}r=new Uint8Array(e.gzhead.extra);e.pending_buf.set(r.subarray(e.gzindex,e.gzindex+n),e.pending),e.pending+=n,e.gzhead.hcrc&&e.pending>t&&(i.adler=G(i.adler,e.pending_buf,e.pending-t,t)),e.gzindex=0}e.status=An}if(e.status===An){if(e.gzhead.name){let t=e.pending,n;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>t&&(i.adler=G(i.adler,e.pending_buf,e.pending-t,t)),_(i),0!==e.pending)return e.last_flush=-1,d;t=0}}while(n=e.gzindex<e.gzhead.name.length?255&e.gzhead.name.charCodeAt(e.gzindex++):0,p(e,n),0!==n);e.gzhead.hcrc&&e.pending>t&&(i.adler=G(i.adler,e.pending_buf,e.pending-t,t)),e.gzindex=0}e.status=jn}if(e.status===jn){if(e.gzhead.comment){let t=e.pending,n;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>t&&(i.adler=G(i.adler,e.pending_buf,e.pending-t,t)),_(i),0!==e.pending)return e.last_flush=-1,d;t=0}}while(n=e.gzindex<e.gzhead.comment.length?255&e.gzhead.comment.charCodeAt(e.gzindex++):0,p(e,n),0!==n);e.gzhead.hcrc&&e.pending>t&&(i.adler=G(i.adler,e.pending_buf,e.pending-t,t))}e.status=Tn}if(e.status===Tn){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(_(i),0!==e.pending))return e.last_flush=-1,d;p(e,255&i.adler),p(e,i.adler>>8&255),i.adler=0}if(e.status=xn,_(i),0!==e.pending)return e.last_flush=-1,d}if(0!==i.avail_in||0!==e.lookahead||t!==tn&&e.status!==Rn){r=0===e.level?Hn(e,t):e.strategy===hn?((t,n)=>{for(var i;;){if(0===t.lookahead&&(Cn(t),0===t.lookahead)){if(n===tn)return m;break}if(t.match_length=0,i=Qt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(g(t,!1),0===t.strm.avail_out))return m}return t.insert=0,n===f?(g(t,!0),0===t.strm.avail_out?Nn:Dn):t.sym_next&&(g(t,!1),0===t.strm.avail_out)?m:In})(e,t):e.strategy===an?((t,n)=>{let i;var e;let r,s;for(var o=t.window;;){if(t.lookahead<=On){if(Cn(t),t.lookahead<=On&&n===tn)return m;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=b&&0<t.strstart&&(e=o[r=t.strstart-1])===o[++r]&&e===o[++r]&&e===o[++r]){for(s=t.strstart+On;e===o[++r]&&e===o[++r]&&e===o[++r]&&e===o[++r]&&e===o[++r]&&e===o[++r]&&e===o[++r]&&e===o[++r]&&r<s;);t.match_length=On-(s-r),t.lookahead<t.match_length&&(t.match_length=t.lookahead)}if(t.match_length>=b?(i=Qt(t,1,t.match_length-b),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=Qt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(g(t,!1),0===t.strm.avail_out))return m}return t.insert=0,n===f?(g(t,!0),0===t.strm.avail_out?Nn:Dn):t.sym_next&&(g(t,!1),0===t.strm.avail_out)?m:In})(e,t):qn[e.level].func(e,t);if(r!==Nn&&r!==Dn||(e.status=Rn),r===m||r===Nn)return 0===i.avail_out&&(e.last_flush=-1),d;if(r===In&&(t===nn?Vt(e):t!==rn&&($t(e,0,0,!1),t===en)&&(Ln(e.head),0===e.lookahead)&&(e.strstart=0,e.block_start=0,e.insert=0),_(i),0===i.avail_out))return e.last_flush=-1,d}return t!==f||!(e.wrap<=0)&&(2===e.wrap?(p(e,255&i.adler),p(e,i.adler>>8&255),p(e,i.adler>>16&255),p(e,i.adler>>24&255),p(e,255&i.total_in),p(e,i.total_in>>8&255),p(e,i.total_in>>16&255),p(e,i.total_in>>24&255)):(zn(e,i.adler>>>16),zn(e,65535&i.adler)),_(i),0<e.wrap&&(e.wrap=-e.wrap),0!==e.pending)?d:sn},deflateEnd:t=>{var n;return Gn(t)?w:(n=t.state.status,t.state=null,n===xn?Zn(t,on):d)},deflateSetDictionary:(t,n)=>{let i=n.length;if(Gn(t))return w;var e=t.state,r=e.wrap;if(2===r||1===r&&e.status!==Sn||e.lookahead)return w;1===r&&(t.adler=Kt(t.adler,n,i,0)),e.wrap=0,i>=e.w_size&&(0===r&&(Ln(e.head),e.strstart=0,e.block_start=0,e.insert=0),(s=new Uint8Array(e.w_size)).set(n.subarray(i-e.w_size,i),0),n=s,i=e.w_size);var s=t.avail_in,o=t.next_in,u=t.input;for(t.avail_in=i,t.next_in=0,t.input=n,Cn(e);e.lookahead>=b;){let t=e.strstart,n=e.lookahead-(b-1);for(;e.ins_h=Fn(e,e.ins_h,e.window[t+b-1]),e.prev[t&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=t,t++,--n;);e.strstart=t,e.lookahead=b-1,Cn(e)}return e.strstart+=e.lookahead,e.block_start=e.strstart,e.insert=e.lookahead,e.lookahead=0,e.match_length=e.prev_length=b-1,e.match_available=0,t.next_in=o,t.input=u,t.avail_in=s,e.wrap=r,d},deflateInfo:"pako deflate (from Nodeca project)"};var Qn=function(t){for(var n,i,e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var s in r)n=r,i=s,Object.prototype.hasOwnProperty.call(n,i)&&(t[s]=r[s])}}return t},Vn=e=>{let i=0;for(let t=0,n=e.length;t<n;t++)i+=e[t].length;var r=new Uint8Array(i);for(let t=0,n=0,i=e.length;t<i;t++){var s=e[t];r.set(s,n),n+=s.length}return r};let ti=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){ti=!1}let ni=new Uint8Array(256);for(let t=0;t<256;t++)ni[t]=252<=t?6:248<=t?5:240<=t?4:224<=t?3:192<=t?2:1;ni[254]=ni[254]=1;var ii=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let n,i,e,r,s,o=t.length,u=0;for(r=0;r<o;r++)55296==(64512&(i=t.charCodeAt(r)))&&r+1<o&&56320==(64512&(e=t.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(e-56320),r++),u+=i<128?1:i<2048?2:i<65536?3:4;for(n=new Uint8Array(u),s=0,r=0;s<u;r++)55296==(64512&(i=t.charCodeAt(r)))&&r+1<o&&56320==(64512&(e=t.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(e-56320),r++),i<128?n[s++]=i:(i<2048?n[s++]=192|i>>>6:(i<65536?n[s++]=224|i>>>12:(n[s++]=240|i>>>18,n[s++]=128|i>>>12&63),n[s++]=128|i>>>6&63),n[s++]=128|63&i);return n},ei=(i,t)=>{var e=t||i.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(i.subarray(0,t));let r,s;var o=new Array(2*e);for(s=0,r=0;r<e;){let n=i[r++];if(n<128)o[s++]=n;else{let t=ni[n];if(4<t)o[s++]=65533,r+=t-1;else{for(n&=2===t?31:3===t?15:7;1<t&&r<e;)n=n<<6|63&i[r++],t--;1<t?o[s++]=65533:n<65536?o[s++]=n:(n-=65536,o[s++]=55296|n>>10&1023,o[s++]=56320|1023&n)}}}return((n,i)=>{if(i<65534&&n.subarray&&ti)return String.fromCharCode.apply(null,n.length===i?n:n.subarray(0,i));let e="";for(let t=0;t<i;t++)e+=String.fromCharCode(n[t]);return e})(o,s)},ri=(t,n)=>{let i=(n=(n=n||t.length)>t.length?t.length:n)-1;for(;0<=i&&128==(192&t[i]);)i--;return!(i<0)&&0!==i&&i+ni[t[i]]>n?i:n};var si=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};let oi=Object.prototype.toString,{Z_NO_FLUSH:ui,Z_SYNC_FLUSH:ci,Z_FULL_FLUSH:fi,Z_FINISH:hi,Z_OK:ai,Z_STREAM_END:li,Z_DEFAULT_COMPRESSION:vi,Z_DEFAULT_STRATEGY:di,Z_DEFLATED:wi}=n;function bi(n){this.options=Qn({level:vi,method:wi,chunkSize:16384,windowBits:15,memLevel:8,strategy:di},n||{});var n=this.options,i=(n.raw&&0<n.windowBits?n.windowBits=-n.windowBits:n.gzip&&0<n.windowBits&&n.windowBits<16&&(n.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new si,this.strm.avail_out=0,Yn.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy));if(i!==ai)throw new Error(Wt[i]);if(n.header&&Yn.deflateSetHeader(this.strm,n.header),n.dictionary){let t;if(t="string"==typeof n.dictionary?ii(n.dictionary):"[object ArrayBuffer]"===oi.call(n.dictionary)?new Uint8Array(n.dictionary):n.dictionary,(i=Yn.deflateSetDictionary(this.strm,t))!==ai)throw new Error(Wt[i]);this.T=!0}}function yi(t,n){n=new bi(n);if(n.push(t,!0),n.err)throw n.msg||Wt[n.err];return n.result}bi.prototype.push=function(t,n){var i=this.strm,e=this.options.chunkSize;let r,s;if(this.ended)return!1;for(s=n===~~n?n:!0===n?hi:ui,"string"==typeof t?i.input=ii(t):"[object ArrayBuffer]"===oi.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(e),i.next_out=0,i.avail_out=e),(s===ci||s===fi)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(Yn.deflate(i,s)===li)return 0<i.next_out&&this.onData(i.output.subarray(0,i.next_out)),r=Yn.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ai;if(0===i.avail_out)this.onData(i.output);else if(0<s&&0<i.next_out)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}return!0},bi.prototype.onData=function(t){this.chunks.push(t)},bi.prototype.onEnd=function(t){t===ai&&(this.result=Vn(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function mi(t,n){return(n=n||{}).raw=!0,yi(t,n)}function _i(t,n){return(n=n||{}).gzip=!0,yi(t,n)}let gi=bi,pi=yi,Oi=n,Si={Deflate:gi,deflate:pi,deflateRaw:mi,gzip:_i,constants:Oi},ki=16209,Ei=16191;let Ai=new Uint16Array([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]),ji=new Uint8Array([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]),Ti=new Uint16Array([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]),xi=new Uint8Array([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]);var Ri=(t,n,i,e,r,s,o,u)=>{var c,f=u.bits;let h=0,a=0,l=0,v=0,d=0,w=0,b=0,y=0,m=0,_=0,g,p,O,S,k=null,E;var A=new Uint16Array(16),j=new Uint16Array(16);let T=null,x,R,I;for(h=0;h<=15;h++)A[h]=0;for(a=0;a<e;a++)A[n[i+a]]++;for(d=f,v=15;1<=v&&0===A[v];v--);if(d>v&&(d=v),0===v)r[s++]=20971520,r[s++]=20971520,u.bits=1;else{for(l=1;l<v&&0===A[l];l++);for(d<l&&(d=l),y=1,h=1;h<=15;h++)if((y=(y<<=1)-A[h])<0)return-1;if(0<y&&(0===t||1!==v))return-1;for(j[1]=0,h=1;h<15;h++)j[h+1]=j[h]+A[h];for(a=0;a<e;a++)0!==n[i+a]&&(o[j[n[i+a]]++]=a);if(E=0===t?(k=T=o,20):1===t?(k=Ai,T=ji,257):(k=Ti,T=xi,0),_=0,a=0,h=l,S=s,w=d,b=0,O=-1,c=(m=1<<d)-1,1===t&&852<m||2===t&&592<m)return 1;for(;;){for(x=h-b,I=o[a]+1<E?(R=0,o[a]):o[a]>=E?(R=T[o[a]-E],k[o[a]-E]):(R=96,0),g=1<<h-b,p=1<<w,l=p;p-=g,r[S+(_>>b)+p]=x<<24|R<<16|I|0,0!==p;);for(g=1<<h-1;_&g;)g>>=1;if(_=0!==g?(_&=g-1)+g:0,a++,0==--A[h]){if(h===v)break;h=n[i+o[a]]}if(h>d&&(_&c)!==O){for(0===b&&(b=d),S+=l,w=h-b,y=1<<w;w+b<v&&!((y-=A[w+b])<=0);)w++,y<<=1;if(m+=1<<w,1===t&&852<m||2===t&&592<m)return 1;r[O=_&c]=d<<24|w<<16|S-s|0}}0!==_&&(r[S+_]=h-b<<24|64<<16|0),u.bits=d}return 0};let Ii=1,Ni=2,{Z_FINISH:Di,Z_BLOCK:Zi,Z_TREES:Ui,Z_OK:Li,Z_STREAM_END:Pi,Z_NEED_DICT:Fi,Z_STREAM_ERROR:W,Z_DATA_ERROR:zi,Z_MEM_ERROR:Mi,Z_BUF_ERROR:Bi,Z_DEFLATED:Ci}=n,Hi=16180,qi=16190,X=16191,Ji=16199,Ki=16200,$=16209,Gi=16211,Wi=852,Xi=592;let $i=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Yi(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}let Qi=t=>{var n;return!t||!(n=t.state)||n.strm!==t||n.mode<Hi||n.mode>Gi?1:0},Vi=t=>{var n;return Qi(t)?W:(n=t.state,t.total_in=t.total_out=n.total=0,t.msg="",n.wrap&&(t.adler=1&n.wrap),n.mode=Hi,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(Wi),n.distcode=n.distdyn=new Int32Array(Xi),n.sane=1,n.back=-1,Li)},te=t=>{var n;return Qi(t)?W:((n=t.state).wsize=0,n.whave=0,n.wnext=0,Vi(t))},ne=(t,n)=>{let i;var e;return Qi(t)||(e=t.state,n<0?(i=0,n=-n):(i=5+(n>>4),n<48&&(n&=15)),n&&(n<8||15<n))?W:(null!==e.window&&e.wbits!==n&&(e.window=null),e.wrap=i,e.wbits=n,te(t))},ie=(t,n)=>{var i;return t?(i=new Yi,(t.state=i).strm=t,i.window=null,i.mode=Hi,(i=ne(t,n))!==Li&&(t.state=null),i):W};let ee=!0,re,se,oe=(t,n,i,e)=>{let r;t=t.state;return null===t.window&&(t.wsize=1<<t.wbits,t.wnext=0,t.whave=0,t.window=new Uint8Array(t.wsize)),t.wsize<=e?(t.window.set(n.subarray(i-t.wsize,i),0),t.wnext=0,t.whave=t.wsize):((r=t.wsize-t.wnext)>e&&(r=e),t.window.set(n.subarray(i-e,i-e+r),t.wnext),(e-=r)?(t.window.set(n.subarray(i-e,i),0),t.wnext=e,t.whave=t.wsize):(t.wnext+=r,t.wnext===t.wsize&&(t.wnext=0),t.whave<t.wsize&&(t.whave+=r))),0};var S={inflateReset:te,inflateReset2:ne,inflateResetKeep:Vi,inflateInit:t=>ie(t,15),inflateInit2:ie,inflate:(f,t)=>{var n;let i,e,r,s,o,u,c,h,a,l,v,L,P,d=0,w,b,y,m,_,g,p,O;var S=new Uint8Array(4);let k,E;var A,F,j,z,T,M,x,R,B,C,H,q,I,N,D,J=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Qi(f)||!f.output||!f.input&&0!==f.avail_in)return W;(n=f.state).mode===X&&(n.mode=16192),s=f.next_out,e=f.output,u=f.avail_out,r=f.next_in,i=f.input,o=f.avail_in,c=n.hold,h=n.bits,a=o,l=u,O=Li;t:for(;;)switch(n.mode){case Hi:if(0===n.wrap)n.mode=16192;else{for(;h<16;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}2&n.wrap&&35615===c?(0===n.wbits&&(n.wbits=15),S[n.check=0]=255&c,S[1]=c>>>8&255,n.check=G(n.check,S,2,0),c=0,h=0,n.mode=16181):(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31?(f.msg="incorrect header check",n.mode=$):(15&c)!==Ci?(f.msg="unknown compression method",n.mode=$):(c>>>=4,h-=4,p=8+(15&c),0===n.wbits&&(n.wbits=p),15<p||p>n.wbits?(f.msg="invalid window size",n.mode=$):(n.dmax=1<<n.wbits,n.flags=0,f.adler=n.check=1,n.mode=512&c?16189:X,c=0,h=0)))}break;case 16181:for(;h<16;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}if(n.flags=c,(255&n.flags)!==Ci){f.msg="unknown compression method",n.mode=$;break}if(57344&n.flags){f.msg="unknown header flags set",n.mode=$;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=G(n.check,S,2,0)),c=0,h=0,n.mode=16182;case 16182:for(;h<32;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}n.head&&(n.head.time=c),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,S[2]=c>>>16&255,S[3]=c>>>24&255,n.check=G(n.check,S,4,0)),c=0,h=0,n.mode=16183;case 16183:for(;h<16;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=G(n.check,S,2,0)),c=0,h=0,n.mode=16184;case 16184:if(1024&n.flags){for(;h<16;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=G(n.check,S,2,0)),c=0,h=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&((v=(v=n.length)>o?o:v)&&(n.head&&(p=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(r,r+v),p)),512&n.flags&&4&n.wrap&&(n.check=G(n.check,i,v,r)),o-=v,r+=v,n.length-=v),n.length))break t;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===o)break t;for(v=0;p=i[r+v++],n.head&&p&&n.length<65536&&(n.head.name+=String.fromCharCode(p)),p&&v<o;);if(512&n.flags&&4&n.wrap&&(n.check=G(n.check,i,v,r)),o-=v,r+=v,p)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===o)break t;for(v=0;p=i[r+v++],n.head&&p&&n.length<65536&&(n.head.comment+=String.fromCharCode(p)),p&&v<o;);if(512&n.flags&&4&n.wrap&&(n.check=G(n.check,i,v,r)),o-=v,r+=v,p)break t}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;h<16;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}if(4&n.wrap&&c!==(65535&n.check)){f.msg="header crc mismatch",n.mode=$;break}c=0,h=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),f.adler=n.check=0,n.mode=X;break;case 16189:for(;h<32;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}f.adler=n.check=$i(c),c=0,h=0,n.mode=qi;case qi:if(0===n.havedict)return f.next_out=s,f.avail_out=u,f.next_in=r,f.avail_in=o,n.hold=c,n.bits=h,Fi;f.adler=n.check=1,n.mode=X;case X:if(t===Zi||t===Ui)break t;case 16192:if(n.last)c>>>=7&h,h-=7&h,n.mode=16206;else{for(;h<3;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}switch(n.last=1&c,c>>>=1,--h,3&c){case 0:n.mode=16193;break;case 1:if((n=>{if(ee){re=new Int32Array(512),se=new Int32Array(32);let t=0;for(;t<144;)n.lens[t++]=8;for(;t<256;)n.lens[t++]=9;for(;t<280;)n.lens[t++]=7;for(;t<288;)n.lens[t++]=8;for(Ri(Ii,n.lens,0,288,re,0,n.work,{bits:9}),t=0;t<32;)n.lens[t++]=5;Ri(Ni,n.lens,0,32,se,0,n.work,{bits:5}),ee=!1}n.lencode=re,n.lenbits=9,n.distcode=se,n.distbits=5})(n),n.mode=Ji,t!==Ui)break;c>>>=2,h-=2;break t;case 2:n.mode=16196;break;case 3:f.msg="invalid block type",n.mode=$}c>>>=2,h-=2}break;case 16193:for(c>>>=7&h,h-=7&h;h<32;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}if((65535&c)!=(c>>>16^65535)){f.msg="invalid stored block lengths",n.mode=$;break}if(n.length=65535&c,c=0,h=0,n.mode=16194,t===Ui)break t;case 16194:n.mode=16195;case 16195:if(v=n.length){if(0===(v=(v=v>o?o:v)>u?u:v))break t;e.set(i.subarray(r,r+v),s),o-=v,r+=v,u-=v,s+=v,n.length-=v}else n.mode=X;break;case 16196:for(;h<14;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}if(n.nlen=257+(31&c),c>>>=5,h-=5,n.ndist=1+(31&c),c>>>=5,h-=5,n.ncode=4+(15&c),c>>>=4,h-=4,286<n.nlen||30<n.ndist){f.msg="too many length or distance symbols",n.mode=$;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;h<3;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}n.lens[J[n.have++]]=7&c,c>>>=3,h-=3}for(;n.have<19;)n.lens[J[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,k={bits:n.lenbits},O=Ri(0,n.lens,0,19,n.lencode,0,n.work,k),n.lenbits=k.bits,O){f.msg="invalid code lengths set",n.mode=$;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;d=n.lencode[c&(1<<n.lenbits)-1],w=d>>>24,b=d>>>16&255,y=65535&d,!(w<=h);){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}if(y<16)c>>>=w,h-=w,n.lens[n.have++]=y;else{if(16===y){for(E=w+2;h<E;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}if(c>>>=w,h-=w,0===n.have){f.msg="invalid bit length repeat",n.mode=$;break}p=n.lens[n.have-1],v=3+(3&c),c>>>=2,h-=2}else if(17===y){for(E=w+3;h<E;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}c>>>=w,h-=w,p=0,v=3+(7&c),c>>>=3,h-=3}else{for(E=w+7;h<E;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}c>>>=w,h-=w,p=0,v=11+(127&c),c>>>=7,h-=7}if(n.have+v>n.nlen+n.ndist){f.msg="invalid bit length repeat",n.mode=$;break}for(;v--;)n.lens[n.have++]=p}}if(n.mode===$)break;if(0===n.lens[256]){f.msg="invalid code -- missing end-of-block",n.mode=$;break}if(n.lenbits=9,k={bits:n.lenbits},O=Ri(Ii,n.lens,0,n.nlen,n.lencode,0,n.work,k),n.lenbits=k.bits,O){f.msg="invalid literal/lengths set",n.mode=$;break}if(n.distbits=6,n.distcode=n.distdyn,k={bits:n.distbits},O=Ri(Ni,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,k),n.distbits=k.bits,O){f.msg="invalid distances set",n.mode=$;break}if(n.mode=Ji,t===Ui)break t;case Ji:n.mode=Ki;case Ki:if(6<=o&&258<=u){f.next_out=s,f.avail_out=u,f.next_in=r,f.avail_in=o,n.hold=c,n.bits=h;{Z=void 0;K=void 0;A=void 0;F=void 0;j=void 0;z=void 0;T=void 0;M=void 0;x=void 0;R=void 0;B=void 0;C=void 0;H=void 0;q=void 0;I=void 0;N=void 0;D=void 0;U=void 0;var Z=f;var K=l;let t;let n,i,e,r,s,o,u,c;var U=Z.state;t=Z.next_in,N=Z.input,A=t+(Z.avail_in-5),n=Z.next_out,D=Z.output,F=n-(K-Z.avail_out),j=n+(Z.avail_out-257),z=U.dmax,T=U.wsize,M=U.whave,x=U.wnext,R=U.window,i=U.hold,e=U.bits,B=U.lencode,C=U.distcode,H=(1<<U.lenbits)-1,q=(1<<U.distbits)-1;n:do{for(e<15&&(i+=N[t++]<<e,e+=8,i+=N[t++]<<e,e+=8),r=B[i&H];;){if(s=r>>>24,i>>>=s,e-=s,0===(s=r>>>16&255))D[n++]=65535&r;else{if(!(16&s)){if(0==(64&s)){r=B[(65535&r)+(i&(1<<s)-1)];continue}if(32&s){U.mode=Ei;break n}Z.msg="invalid literal/length code",U.mode=ki;break n}for(o=65535&r,(s&=15)&&(e<s&&(i+=N[t++]<<e,e+=8),o+=i&(1<<s)-1,i>>>=s,e-=s),e<15&&(i+=N[t++]<<e,e+=8,i+=N[t++]<<e,e+=8),r=C[i&q];;){if(s=r>>>24,i>>>=s,e-=s,!(16&(s=r>>>16&255))){if(0==(64&s)){r=C[(65535&r)+(i&(1<<s)-1)];continue}Z.msg="invalid distance code",U.mode=ki;break n}if(I=65535&r,s&=15,e<s&&(i+=N[t++]<<e,(e+=8)<s)&&(i+=N[t++]<<e,e+=8),z<(I+=i&(1<<s)-1)){Z.msg="invalid distance too far back",U.mode=ki;break n}if(i>>>=s,e-=s,I>(s=n-F)){if((s=I-s)>M&&U.sane){Z.msg="invalid distance too far back",U.mode=ki;break n}if(u=0,c=R,0===x){if(u+=T-s,s<o){for(o-=s;D[n++]=R[u++],--s;);u=n-I,c=D}}else if(x<s){if(u+=T+x-s,(s-=x)<o){for(o-=s;D[n++]=R[u++],--s;);if(u=0,x<o){for(s=x,o-=s;D[n++]=R[u++],--s;);u=n-I,c=D}}}else if(u+=x-s,s<o){for(o-=s;D[n++]=R[u++],--s;);u=n-I,c=D}for(;2<o;)D[n++]=c[u++],D[n++]=c[u++],D[n++]=c[u++],o-=3;o&&(D[n++]=c[u++],1<o)&&(D[n++]=c[u++])}else{for(u=n-I;D[n++]=D[u++],D[n++]=D[u++],D[n++]=D[u++],2<(o-=3););o&&(D[n++]=D[u++],1<o)&&(D[n++]=D[u++])}break}}break}}while(t<A&&n<j);o=e>>3,t-=o,e-=o<<3,i&=(1<<e)-1,Z.next_in=t,Z.next_out=n,Z.avail_in=t<A?A-t+5:5-(t-A),Z.avail_out=n<j?j-n+257:257-(n-j),U.hold=i,U.bits=e}s=f.next_out,e=f.output,u=f.avail_out,r=f.next_in,i=f.input,o=f.avail_in,c=n.hold,h=n.bits,n.mode===X&&(n.back=-1);break}for(n.back=0;d=n.lencode[c&(1<<n.lenbits)-1],w=d>>>24,b=d>>>16&255,y=65535&d,!(w<=h);){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}if(b&&0==(240&b)){for(m=w,_=b,g=y;d=n.lencode[g+((c&(1<<m+_)-1)>>m)],w=d>>>24,b=d>>>16&255,y=65535&d,!(m+w<=h);){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}c>>>=m,h-=m,n.back+=m}if(c>>>=w,h-=w,n.back+=w,n.length=y,0===b){n.mode=16205;break}if(32&b){n.back=-1,n.mode=X;break}if(64&b){f.msg="invalid literal/length code",n.mode=$;break}n.extra=15&b,n.mode=16201;case 16201:if(n.extra){for(E=n.extra;h<E;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;d=n.distcode[c&(1<<n.distbits)-1],w=d>>>24,b=d>>>16&255,y=65535&d,!(w<=h);){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}if(0==(240&b)){for(m=w,_=b,g=y;d=n.distcode[g+((c&(1<<m+_)-1)>>m)],w=d>>>24,b=d>>>16&255,y=65535&d,!(m+w<=h);){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}c>>>=m,h-=m,n.back+=m}if(c>>>=w,h-=w,n.back+=w,64&b){f.msg="invalid distance code",n.mode=$;break}n.offset=y,n.extra=15&b,n.mode=16203;case 16203:if(n.extra){for(E=n.extra;h<E;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){f.msg="invalid distance too far back",n.mode=$;break}n.mode=16204;case 16204:if(0===u)break t;if(v=l-u,n.offset>v){if((v=n.offset-v)>n.whave&&n.sane){f.msg="invalid distance too far back",n.mode=$;break}L=v>n.wnext?(v-=n.wnext,n.wsize-v):n.wnext-v,v>n.length&&(v=n.length),P=n.window}else P=e,L=s-n.offset,v=n.length;for(v>u&&(v=u),u-=v,n.length-=v;e[s++]=P[L++],--v;);0===n.length&&(n.mode=Ki);break;case 16205:if(0===u)break t;e[s++]=n.length,u--,n.mode=Ki;break;case 16206:if(n.wrap){for(;h<32;){if(0===o)break t;o--,c|=i[r++]<<h,h+=8}if(l-=u,f.total_out+=l,n.total+=l,4&n.wrap&&l&&(f.adler=n.check=(n.flags?G:Kt)(n.check,e,l,s-l)),l=u,4&n.wrap&&(n.flags?c:$i(c))!==n.check){f.msg="incorrect data check",n.mode=$;break}c=0,h=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;h<32;){if(0===o)break t;o--,c+=i[r++]<<h,h+=8}if(4&n.wrap&&c!==(4294967295&n.total)){f.msg="incorrect length check",n.mode=$;break}c=0,h=0}n.mode=16208;case 16208:O=Pi;break t;case $:O=zi;break t;case 16210:return Mi;default:Gi;return W}return f.next_out=s,f.avail_out=u,f.next_in=r,f.avail_in=o,n.hold=c,n.bits=h,(n.wsize||l!==f.avail_out&&n.mode<$&&(n.mode<16206||t!==Di))&&oe(f,f.output,f.next_out,l-f.avail_out),a-=f.avail_in,l-=f.avail_out,f.total_in+=a,f.total_out+=l,n.total+=l,4&n.wrap&&l&&(f.adler=n.check=(n.flags?G:Kt)(n.check,e,l,f.next_out-l)),f.data_type=n.bits+(n.last?64:0)+(n.mode===X?128:0)+(n.mode===Ji||16194===n.mode?256:0),O=(0==a&&0===l||t===Di)&&O===Li?Bi:O},inflateEnd:t=>{var n;return Qi(t)?W:((n=t.state).window&&(n.window=null),t.state=null,Li)},inflateGetHeader:(t,n)=>Qi(t)||0==(2&(t=t.state).wrap)?W:((t.head=n).done=!1,Li),inflateSetDictionary:(t,n)=>{var i,e=n.length;return Qi(t)||0!==(i=t.state).wrap&&i.mode!==qi?W:i.mode===qi&&Kt(1,n,e,0)!==i.check?zi:oe(t,n,e,e)?(i.mode=16210,Mi):(i.havedict=1,Li)},inflateInfo:"pako inflate (from Nodeca project)"};var ue=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};let ce=Object.prototype.toString,{Z_NO_FLUSH:fe,Z_FINISH:he,Z_OK:ae,Z_STREAM_END:le,Z_NEED_DICT:ve,Z_STREAM_ERROR:de,Z_DATA_ERROR:we,Z_MEM_ERROR:be}=n;function ye(t){this.options=Qn({chunkSize:65536,windowBits:15,to:""},t||{});var n=this.options,t=(n.raw&&0<=n.windowBits&&n.windowBits<16&&(n.windowBits=-n.windowBits,0===n.windowBits)&&(n.windowBits=-15),!(0<=n.windowBits&&n.windowBits<16)||t&&t.windowBits||(n.windowBits+=32),15<n.windowBits&&n.windowBits<48&&0==(15&n.windowBits)&&(n.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new si,this.strm.avail_out=0,S.inflateInit2(this.strm,n.windowBits));if(t!==ae)throw new Error(Wt[t]);if(this.header=new ue,S.inflateGetHeader(this.strm,this.header),n.dictionary&&("string"==typeof n.dictionary?n.dictionary=ii(n.dictionary):"[object ArrayBuffer]"===ce.call(n.dictionary)&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw)&&(t=S.inflateSetDictionary(this.strm,n.dictionary))!==ae)throw new Error(Wt[t])}function me(t,n){n=new ye(n);if(n.push(t),n.err)throw n.msg||Wt[n.err];return n.result}ye.prototype.push=function(t,n){var i,e,r,s=this.strm,o=this.options.chunkSize,u=this.options.dictionary;let c,f,h;if(this.ended)return!1;for(f=n===~~n?n:!0===n?he:fe,"[object ArrayBuffer]"===ce.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;;){for(0===s.avail_out&&(s.output=new Uint8Array(o),s.next_out=0,s.avail_out=o),(c=S.inflate(s,f))===ve&&u&&((c=S.inflateSetDictionary(s,u))===ae?c=S.inflate(s,f):c===we&&(c=ve));0<s.avail_in&&c===le&&0<s.state.wrap&&0!==t[s.next_in];)S.inflateReset(s),c=S.inflate(s,f);switch(c){case de:case we:case ve:case be:return this.onEnd(c),!(this.ended=!0)}if(h=s.avail_out,!s.next_out||0!==s.avail_out&&c!==le||("string"===this.options.to?(i=ri(s.output,s.next_out),e=s.next_out-i,r=ei(s.output,i),s.next_out=e,s.avail_out=o-e,e&&s.output.set(s.output.subarray(i,i+e),0),this.onData(r)):this.onData(s.output.length===s.next_out?s.output:s.output.subarray(0,s.next_out))),c!==ae||0!==h){if(c===le)return c=S.inflateEnd(this.strm),this.onEnd(c),this.ended=!0;if(0===s.avail_in)break}}return!0},ye.prototype.onData=function(t){this.chunks.push(t)},ye.prototype.onEnd=function(t){t===ae&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Vn(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var t=Si.deflate,c={inflate:me}.inflate,_e=t,ge=c,pe=(Oe.prototype.add=function(t){this.isStarting&&(this.count+=t)},Oe.prototype.stop=function(){return this.isStarting=!1,this.reset()},Oe.prototype.start=function(n){var i=this;void 0===n&&(n=0),this.isStarting=!0,this.count=0,clearInterval(this.timer),n&&(this.timer=window.setInterval(function(){var t=i.count;i.speed=t/n,i.count=0},n))},Oe.prototype.reset=function(){this.count=0,clearInterval(this.timer),this.timer=0,this.speed=0},Oe);function Oe(t){this.R=t=void 0===t?"":t,this.count=0,this.isStarting=!1,this.timer=0,this.lastLogTime=0,this.speed=0,this.lastTime=0}var Se=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},ke=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}};function Ee(r,s,o){return Se(this,void 0,void 0,function(){var n,i,e;return ke(this,function(t){switch(t.label){case 0:return n="",i=(t=>{t=t||32;for(var n="abcdefhijkmnprstwxyz0123456789",i=n.length,e="",r=0;r<t;r++)e+=n.charAt(Math.floor(Math.random()*i));return e})(16),[4,function(e){var r;return Se(this,void 0,void 0,function(){var n,i;return ke(this,function(t){switch(t.label){case 0:return n=(new TextEncoder).encode(e),[4,null==(r=crypto.subtle)?void 0:r.digest("SHA-256",n)];case 1:return n=t.sent(),i=Array.from(new Uint8Array(n)),[2,i.map(function(t){return t.toString(16).padStart(2,"0")}).join("")]}})})}("".concat(r).concat("DPIV9g5X2zvTD4Zj").concat(i).concat(o))];case 1:return(e=(e=t.sent()).toLocaleLowerCase())&&(e={ver:s,hash:e,nonce:i,expire:o},e=JSON.stringify(e),n=btoa(e)),[2,n]}})})}function Ae(e){return Se(this,void 0,void 0,function(){var n,i;return ke(this,function(t){switch(t.label){case 0:return n="",i=Math.floor((Date.now()+7776e6)/1e3),[4,Ee(e,2,i)];case 1:return i=t.sent(),[2,n=0<i.length?i:n]}})})}var je=function(){return(je=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Te=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},xe=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},Re=function(t,n,i){if(i||2===arguments.length)for(var e,r=0,s=n.length;r<s;r++)!e&&r in n||((e=e||Array.prototype.slice.call(n,0,r))[r]=n[r]);return t.concat(e||Array.prototype.slice.call(n))},Ie=(Object.defineProperty(k.prototype,"speed",{get:function(){return this.I.speed},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"url",{get:function(){return this.N.url},set:function(t){this.N.url=t},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"strategy",{get:function(){return this.D.strategy},enumerable:!1,configurable:!0}),k.prototype.setStrategy=function(t){var n;0===t?(this.D.setStrategy(t),null!=(n=this.Z)&&n.destroy(),this.Z=null):this.D.strategy!=t&&(null!=(n=this.Z)&&n.destroy(),this.D.setStrategy(t),this.Z=this.D.build())},k.prototype.addRemoteWsLog=function(t){if(this.N.env!=o.BROWSER)throw new Error("cannot use net strategy on mini program");for(this.U.push(t);this.U.size()>this.U.logCacheMax;)this.U.removeALog();this.connected()&&this.Z&&this.Z.active()},k.prototype.stopWebSocketServer=function(){this.clearHbTimer(),this.L=void 0,this.g&&(this.g.onclose=null,this.g.onerror=null,this.g.close(),this.g=null)},k.prototype.P=function(){this.g&&this.N.useStrategy&&(this.Z=this.D.build())},k.prototype.F=function(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var e=this.M=this.B,r="";switch(t){case"onconnecting":"never_opened"===this.B?this.B="first_connecting":this.B="reconnecting";break;case"onopen":this.B="connected",this.I.start(3e3),this.onSocketConnect();break;case"onclosed":this.B="closed";var s=n[0];s&&(r+=" close code=".concat(s.code)),this.I.stop(),this.onSocketClose();break;case"onerror":this.B="error",this.I.stop(),this.onSocketError()}t=B.WEBSOCKET_STATE_CHANGE+" log ws state change: ".concat(e," -> ").concat(this.B);r&&(t+=r),"error"===this.B?this.C.warn(t):this.C.info(t)},k.prototype.onSocketConnect=function(){},k.prototype.onSocketClose=function(){},k.prototype.onSocketError=function(){},k.prototype.onHeartBeatTimeout=function(){},k.prototype.openWebSocketLogServer=function(t,n,i,e){var r=this;void 0===n&&(n=!1),void 0===i&&(i=!1),""===t||!i&&this.url==t||((this.url&&""!==this.url||"never_opened"===this.B)&&this.C.info(B.OPEN_WS+" log url change to: ".concat(t," , ").concat(this.enabled)),(this.url=t)&&this.enabled&&(i=function(){r.H&&(clearTimeout(r.H),r.H=null),r.stopWebSocketServer(),r.g=F(t,r.N.env,r.q),r.g instanceof WebSocket&&(r.g.binaryType="arraybuffer"),r.P(),r.F("onconnecting"),r.g.onopen=function(){var t;r.J=!1,r.L=void 0,r.N.useStrategy&&null!=(t=r.Z)&&t.active(),r.F("onopen")},r.g.onclose=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r.J=!1,r.F.apply(r,Re(["onclosed"],t,!1))},r.g.onmessage=r.K.bind(r),r.g.onerror=function(){for(var t=0;t<arguments.length;t++)t,0;r.F("onerror")}},n?i():(n="error"===this.B||"error"===this.M,this.H||(this.H=setTimeout(i,e||(n?5e3:3e3))))))},k.prototype.resetSocketTimer=function(){this.H&&(clearTimeout(this.H),this.H=null)},k.prototype.closed=function(){return null==this.g||2==this.g.readyState||3==this.g.readyState},k.prototype.connected=function(){return null!==this.g&&1==this.g.readyState},k.prototype.connecting=function(){return null!==this.g&&0==this.g.readyState},Object.defineProperty(k.prototype,"canSendWs",{get:function(){var t=this.L,t=!t||performance.now()-t<5e3;return!(!this.g||1!==this.g.readyState)&&t},enumerable:!1,configurable:!0}),k.prototype.sendLogFrame=function(i){var e;return Te(this,void 0,void 0,function(){var n;return xe(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.makeLogFrame(i)];case 1:return n=t.sent(),this.I.add(8*n.byteLength),this.connected()?(null!=(e=this.g)&&e.send(n),[2,!0]):[2,!1];case 2:return t.sent(),[2,!0];case 3:return[2]}})})},k.prototype.makeLogFrame=function(o){return Te(this,void 0,void 0,function(){var n,i,e,r,s;return xe(this,function(t){switch(t.label){case 0:return r=_e(o),i=this.N,n=i.appid,i=i.userid,e=this.seq++,r={detail_data:r},this.J?[3,2]:[4,Ae(n)];case 1:if(!(s=t.sent()))throw new Error("litesign error");r=je(je({},r),{appid:n,product:2,id_name:i,timestamp:Math.floor(Date.now()/1e3),litesign:s}),t.label=2;case 2:return s=tt.rtcreport.DetailLogRequest.encode(r).finish(),this.J=!0,[2,this.G(e,7,s)]}})})},k.prototype.G=function(t,n,i){var e=(null==i?void 0:i.length)||0,r=new Uint8Array(10+e);return r[0]=64,r[1]=n,r[2]=t>>24&255,r[3]=t>>16&255,r[4]=t>>8&255,r[5]=255&t,r[6]=e>>24&255,r[7]=e>>16&255,r[8]=e>>8&255,r[9]=255&e,i&&r.set(i,10),r},k.prototype.K=function(t){var t=new Uint8Array(t.data),n=t[0];this.L=performance.now(),this.startHbTimer(),64===n&&8===t[1]&&(t[2],t[3],t[4],t[5],n=t[6]<<24|t[7]<<16|t[8]<<8|t[9],t=new Uint8Array(t.slice(10,10+n)),101===tt.rtcreport.DetailLogResponse.decode(t).code)&&(this.J=!1)},k.prototype.clearLogCacheAndUpload=function(){var n=this;this.connected()&&this.U.clear().forEach(function(t){n.sendLogFrame(t)})},k.prototype.clearHbTimer=function(){this.checkHbTimer&&(clearTimeout(this.checkHbTimer),this.checkHbTimer=void 0)},k.prototype.startHbTimer=function(){var n=this;this.clearHbTimer(),void 0!==this.L&&15e3<performance.now()-this.L?this.onHeartBeatTimeout():this.checkHbTimer=setTimeout(function(){var t;n.g&&(t=n.G(n.seq++,5),n.I.add(8*t.byteLength),n.g.send(t),n.startHbTimer())},5e3)},k.prototype.setUpBitrate=function(t){t/=8,t=2e3<=t?5:200<=t?4:100<=t?3:10<=t?2:1<=t?1:0;return this.setStrategy(t),t},k.prototype.destroy=function(){this.g=null,this.I.stop()},k);function k(t,n,i,e){this.U=t,this.N=n,this.C=i,this.q=e,this.g=null,this.B="never_opened",this.M="never_opened",this.D=new ur(this),this.Z=null,this.J=!1,this.H=null,this.enabled=!0,this.seq=1,this.L=void 0,this.checkHbTimer=void 0,this.I=new pe("detail log"),this.D.setCache(this.U)}De.prototype.active=function(){var i=this;this.W.canSendWs&&0!==this.U.size()&&this.X.canSendLog()&&(this.X.getLog().forEach(function(n){i.W.sendLogFrame(n).then(function(t){!t&&i.W.enabled&&i.X.cacheLog(n)})}),this.X.onSendLog())},De.prototype.destroy=function(){this.X.onCanSendActive=void 0,this.X.destroy()};var Ne=De;function De(t,n,i){this.W=t,this.U=n,this.X=i,this.X.onCanSendActive=this.active.bind(this)}function Ze(t){this.cache=t}Ue=function(t,n){return(Ue=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)};var Ue,Le;(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}Ue(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)})(Pe,Le=Ze),Pe.prototype.getLog=function(){return this.cache.clear()},Pe.prototype.canSendLog=function(){return 0<this.cache.size()},Pe.prototype.onSendLog=function(){},Pe.prototype.cacheLog=function(t){this.cache.push(t)},Pe.prototype.destroy=function(){};function Pe(t){return Le.call(this,t)||this}Fe=function(t,n){return(Fe=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)};(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}Fe(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)})(Me,ze=Ze),Me.prototype.canSendLog=function(){return!this.locked&&0<this.cache.size()},Me.prototype.getLog=function(){for(var t=[],n=0,i=!1;!i;){var e=this.cache.getOneLogPacket(this.maxPacketLen);if(!e||e.length<=0)break;var r=n+(e.length||0);r+this.cache.getOnePackMaxPacketLen(this.maxPacketLen)>this.maxPacketLen&&(i=!0),t.push(e),n=r}return this.lastTime=Date.now(),t},Me.prototype.onSendLog=function(){var t=this;this.locked=!0,this.timer=setTimeout(function(){t.locked=!1,t.onCanSendActive&&t.onCanSendActive()},this.maxDelay)},Me.prototype.cacheLog=function(t){this.cache.cacheLogPacket(t)},Me.prototype.destroy=function(){this.timer&&(clearTimeout(this.timer),this.timer=0)};var Fe,ze,n=Me;function Me(){var t=null!==ze&&ze.apply(this,arguments)||this;return t.name="NetworkFrequency",t.maxDelay=10,t.maxPacketLen=2e4,t.locked=!1,t.lastTime=0,t.timer=0,t}Be=function(t,n){return(Be=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)};(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}Be(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)})(qe,Ce=n);var Be,Ce,He=qe;function qe(t){t=Ce.call(this,t)||this;return t.name="MaxBW",t.maxDelay=10,t.maxPacketLen=2e4,t}Je=function(t,n){return(Je=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)};(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}Je(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)})(We,Ke=n);var Je,Ke,Ge=We;function We(t){t=Ke.call(this,t)||this;return t.name="HighBig",t.maxDelay=100,t.maxPacketLen=2e4,t}Xe=function(t,n){return(Xe=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)};(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}Xe(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)})(Qe,$e=n);var Xe,$e,Ye=Qe;function Qe(t){t=$e.call(this,t)||this;return t.name="HighSmall",t.maxDelay=100,t.maxPacketLen=1e4,t}Ve=function(t,n){return(Ve=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)};(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}Ve(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)})(ir,tr=n);var Ve,tr,nr=ir;function ir(t){t=tr.call(this,t)||this;return t.name="LowBig",t.maxDelay=500,t.maxPacketLen=5e3,t}er=function(t,n){return(er=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)};(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}er(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)})(or,rr=n);var er,rr,sr=or;function or(t){t=rr.call(this,t)||this;return t.name="LowSmall",t.maxDelay=1e3,t.maxPacketLen=1e3,t}Object.defineProperty(cr.prototype,"strategy",{get:function(){return this.X},enumerable:!1,configurable:!0}),cr.prototype.setCache=function(t){this.U=t},cr.prototype.setStrategy=function(t){isNaN(t)||(this.X=t)},cr.prototype.build=function(){if(!this.U)throw new Error("cannot build log sender");switch(this.X){case 1:return new Ne(this.W,this.U,new sr(this.U));case 2:return new Ne(this.W,this.U,new nr(this.U));case 3:return new Ne(this.W,this.U,new Ye(this.U));case 4:return new Ne(this.W,this.U,new Ge(this.U));default:return new Ne(this.W,this.U,new He(this.U))}};var ur=cr;function cr(t){this.W=t,this.X=5}E.Y=function(){return!(!window||!window.localStorage)},E.bin2hex=function(t){for(var n,i="",e=0,r=(t+="").length;e<r;e++)i+=(n=t.charCodeAt(e).toString(16)).length<2?"0"+n:n;return i},E.getCanvasFingerprint=function(t){var n=document.createElement("canvas"),i=n.getContext("2d"),i=(i.textBaseline="top",i.font="14px 'Arial'",i.fillStyle="#f60",i.fillRect(125,1,62,20),i.fillStyle="#069",i.fillText(t,2,15),i.fillStyle="rgba(102, 204, 0, 0.7)",i.fillText(t,4,17),n.toDataURL().replace("data:image/png;base64,","")),t=atob(i);return this.bin2hex(t.slice(-16,-12))},E.generateUUID=function(){var i,t,n=localStorage.getItem(this.V);return n||(i=(new Date).getTime(),n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"==t?n:3&n|8).toString(36)}),t=this.getCanvasFingerprint("hello, zego")+n.slice(8),localStorage.setItem(this.V,t),n)},E.id=function(){var t;return E.Y()?((t=localStorage.getItem(this.V))||(t=E.generateUUID(),localStorage.setItem(this.V,t)),t):""},E.V="z_deviceID";var fr=E;function E(){}var hr=function(){this.url="",this.env=o.BROWSER,this.useStrategy=!0,this.token="",this.deviceid=fr.id(),this.ipStackMode=Z.IPv4Prefer,this.networkState=U.online};Object.defineProperty(ar.prototype,"buffer",{get:function(){return this.queue},set:function(t){this.queue=t},enumerable:!1,configurable:!0}),ar.prototype.push=function(t){if(!t)throw new Error("item null!");this.cacheByteLength+=t.length,t&&this.queue.push(t),this.cacheByteLength+=t.length},ar.prototype.pop=function(){var t=this.queue[0]||"";return this.cacheByteLength-=t.length,this.queue.shift()},ar.prototype.front=function(){return this.queue[0]},ar.prototype.getFrontList=function(t){return this.queue.slice(0,t=void 0===t?1:t)},ar.prototype.removeFrontList=function(t){var n=this.getFrontList(t=void 0===t?1:t).reduce(function(t,n){return t+=n.length},0);return this.cacheByteLength-=n,this.queue.splice(0,t)},ar.prototype.clear=function(){this.timer&&(console.warn("clear cache"+this.name),clearInterval(this.timer)),this.queue=[]};t=ar;function ar(t){this.name=t=void 0===t?"":t,this.queue=[],this.timer=0,this.cacheByteLength=0}lr=function(t,n){return(lr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)};var lr,vr,dr=function(){return(dr=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},wr=function(t,n,i){if(i||2===arguments.length)for(var e,r=0,s=n.length;r<s;r++)!e&&r in n||((e=e||Array.prototype.slice.call(n,0,r))[r]=n[r]);return t.concat(e||Array.prototype.slice.call(n))},br=(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}lr(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}(yr,vr=t),yr.prototype.size=function(){return this.queue.length},yr.prototype.getOnePackMaxPacketLen=function(t){return t&&t<this.tt?t:this.tt},yr.prototype.getOneLogPacket=function(t){var n=[],i=0,e="";if(this.size()){var r=JSON.parse(this.queue[this.queue.length-1]).userid,s=this.N.userid||r;if(s){for(var o=this.getOnePackMaxPacketLen(t);0<this.queue.length&&(!t||0===i||i<t);){var u=this.queue[0].length;if(i&&o<i+u)return e=JSON.stringify(n);var c=JSON.parse(this.queue[0]),c=dr(dr({},c),{userid:c.userid||s,roomid:c.roomid||this.N.roomid});i+=u,n.push(c),this.pop()}return""===(e=JSON.stringify(n))?void 0:e}}},yr.prototype.cacheLogPacket=function(t){var t=JSON.parse(t);this.size()+t.length<this.logCacheMax&&(t=t.map(function(t){return JSON.stringify(t)}),this.queue=wr(wr([],t,!0),this.queue,!0))},yr.prototype.clear=function(){for(var t=[];0<this.queue.length;){var n=this.getOneLogPacket();if(!n)break;t.push(n)}return t},yr.prototype.removeALog=function(){for(var t=this.queue,n=0;n<t.length;n++){var i=void 0;try{i=JSON.parse(t[n])}catch(t){}if(!i||i.level<2)return void(this.queue=wr(wr([],t.slice(0,n),!0),t.slice(n+1),!0))}this.pop()},yr);function yr(t,n){void 0===n&&(n=1/0);var i=vr.call(this,"ws cache")||this;return i.logCacheMax=n,i.tt=64e3,i.N=t,i}var mr=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},_r=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},gr=(A.fetchWhitelist=function(a,l){return mr(this,void 0,void 0,function(){var n,i,e,r,s,o,u,c,f,h;return _r(this,function(t){switch(t.label){case 0:return(s=a.product,n=a.appID,h=a.userID,i=a.token,e=a.deviceID,u=a.bizType,r=(r=this.domains[this.activeIndex])||"detaillog-global.zego.im",r="https://".concat(r,"/zglog/whitelist"),s={product:s,biz_type:""+u,appid:""+n,uin:h,timestamp:""+Date.now(),deviceid:e},i)?(s.token=i,[3,3]):[3,1];case 1:return o=s,[4,Ae(n)];case 2:o.litesign=t.sent(),t.label=3;case 3:return(u=new URLSearchParams(s),c="".concat(r,"?").concat(u.toString()),l)?[4,new Promise(function(n,i){l.startHttpRequest({location:c,method_no:1,serviceType:2},function(t){200===t.status_code?n(t.body):i("request fail. status="+t.status_code)},function(t){i("request fail. result: "+JSON.stringify(t))})})]:[3,5];case 4:return[2,t.sent()];case 5:return t.trys.push([5,10,,14]),[4,fetch(c,{method:"GET"})];case 6:return(f=t.sent()).ok?[4,f.json()]:[3,8];case 7:return[2,t.sent()];case 8:throw"get list fail. status="+f.status+"msg="+f.statusText;case 9:return[3,14];case 10:if(h=t.sent(),A.activeIndex!==A.domains.length-1)return[3,11];throw A.activeIndex=0,"get list fail. error ".concat(h," ").concat(JSON.stringify(h));case 11:return A.activeIndex++,[4,A.fetchWhitelist(a,l)];case 12:return[2,t.sent()];case 13:return[3,14];case 14:return[2]}})})},A.domains=[],A.activeIndex=0,A);function A(){}var pr=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},Or=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},Sr=(kr.prototype.nt=function(t){return"file_"+t},kr.prototype.saveLogs=function(t,n,i,e){n=n.map(function(t){return{log:t,instanceId:i}});return this.it.addList(this.nt(t),n)},kr.prototype.queryList=function(t,n,i){n=[{field:"instanceId",value:n}];return this.it.queryByCursor(this.nt(t),{maxCount:i,conditions:n})},kr.prototype.storedBytesSize=function(s){var t=this;return new Promise(function(e,r){return pr(t,void 0,void 0,function(){var n,i;return Or(this,function(t){return n=this.it.openCursor(this.nt(s)),i=0,n.onsuccess=function(t){var n,t=null==(t=t.target)?void 0:t.result;t?(n=t.value,i+=n.log.length,t.continue()):e(i)},n.onerror=function(t){r(t)},[2]})})})},kr.prototype.lines=function(t,n){return this.it.lines(this.nt(t),isNaN(n)?void 0:[{field:"instanceId",value:n}])},kr.prototype.deleteAll=function(t,n){return this.it.deleteAll(this.nt(t),n)},kr);function kr(t){this.it=t}var Er=function(){return(Er=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Ar=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},jr=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},Tr=(xr.prototype.save=function(t,n){return this.it.save(this.et,t,n)},xr.prototype.queryList=function(t,n){return this.it.getAll(this.et,t,n)},xr.prototype.delete=function(t,n){return this.it.deleteItems(this.et,t,n)},xr.prototype.lines=function(){return this.it.lines(this.et)},xr.prototype.deleteByCount=function(t){return this.it.deleteByCount(this.et,t)},xr.prototype.deleteAll=function(){return this.it.deleteAll(this.et)},xr.prototype.getItem=function(t,n){return this.it.queryById(this.et,t,n)},xr.prototype.update=function(i,e){return Ar(this,void 0,void 0,function(){var n;return jr(this,function(t){switch(t.label){case 0:return[4,this.getItem(i.id,e)];case 1:return(n=t.sent())?(n=Er(Er({},n),i),[2,this.it.update(this.et,n,e)]):[2]}})})},xr);function xr(t){this.it=t,this.et="log_instance"}Ir.prototype.save=function(t,n){return this.it.save(this.et,t,n)},Ir.prototype.update=function(t,n){return this.it.update(this.et,t,n)},Ir.prototype.delete=function(t,n){return this.it.deleteItems(this.et,[t],n)},Ir.prototype.queryList=function(t){return this.it.queryByCursor(this.et,{transaction:t})};var Rr=Ir;function Ir(t){this.it=t,this.et="file_usage"}var Nr=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},Dr=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},Zr=(j.prototype.openDB=function(n,s){return Nr(this,void 0,void 0,function(){var e,r=this;return Dr(this,function(t){switch(t.label){case 0:return e=window.indexedDB.open(s.database+"_"+n,s.version),[4,new Promise(function(i){e.onupgradeneeded=function(t){var i=t.target.result;s.tableList.forEach(function(t){var n;i.objectStoreNames.contains(t.tableName)||(n=i.createObjectStore(t.tableName,{keyPath:"id",autoIncrement:!0}),t.tableItems.forEach(function(t){t.index&&n.createIndex(t.itemName,t.itemName,{unique:t.unique})}))})},e.onsuccess=function(t){var n=null==(t=t.target)?void 0:t.result;(r.rt=n).onclose=function(){r.onDBClose&&r.onDBClose(),r.rt=void 0,e.onsuccess=null,e.onupgradeneeded=null,n.onclose=null},i(e)}})];case 1:return t.sent(),[2]}})})},j.prototype.closeDB=function(){var n;return Nr(this,void 0,void 0,function(){return Dr(this,function(t){return this.rt&&(null!=(n=this.rt)&&n.close(),this.rt=void 0),[2]})})},j.prototype.st=function(){if(!this.rt)throw new Error("indexDB not open")},j.prototype.getTransaction=function(t,n){return void 0===n&&(n=!1),this.st(),this.rt.transaction(t,n?"readwrite":void 0)},j.prototype.save=function(i,e,r){var s=this;return new Promise(function(t){var n=(r=r||s.getTransaction([i],!0)).objectStore(i).add(e);n.onsuccess=function(){return t(n.result)}})},j.prototype.addList=function(i,e,s){return Nr(this,void 0,void 0,function(){var r,n;return Dr(this,function(t){switch(t.label){case 0:return s=s||this.getTransaction([i],!0),r=s.objectStore(i),n=[],e.forEach(function(e){var t=new Promise(function(t,n){var i=r.add(e);i.onsuccess=function(){return t()},i.onerror=function(t){return n(i.error)}});n.push(t)}),[4,Promise.all(n)];case 1:return t.sent(),[2]}})})},j.prototype.update=function(n,i,e){var r=this;return new Promise(function(t){(e=e||r.getTransaction([n],!0)).objectStore(n).put(i).onsuccess=function(){return t()}})},j.prototype.queryById=function(i,e,r){var s=this;return new Promise(function(t){var n=(r=r||s.getTransaction([i])).objectStore(i).get(e);n.onsuccess=function(){return t(n.result||null)}})},j.prototype.queryByCursor=function(c,f){var h=this;return new Promise(function(i,n){var e=f.maxCount,r=f.conditions,t=f.transaction,t=(t||h.getTransaction([c])).objectStore(c),s=[],o=null,u=(o=r&&0<r.length&&(u=r[0],t.indexNames.contains(u.field))?t.index(u.field):o)&&null!=r&&r.length?o.openCursor(h.ot(r[0])):t.openCursor();u.onsuccess=function(t){var n,t=t.target.result;t&&(!e||s.length<e)?(n=t.value,null!=r&&r.length&&!h.ut(n,r)||s.push(n),t.continue()):i(s)},u.onerror=function(t){n(t.target.error)}})},j.prototype.getAll=function(e,r,s){var o=this;return new Promise(function(t,n){var i=(s=s||o.getTransaction([e])).objectStore(e).getAll(void 0,r);i.onsuccess=function(){return t(i.result)},i.onerror=function(t){n(t)}})},j.prototype.lines=function(c,f,h){var a=this;return new Promise(function(i,n){var t,e=(h=h||a.getTransaction([c])).objectStore(c),r=0,s=!(null==f||!f.length),o=void 0,u=null;f&&0<f.length?(o=f[0],(u=(s=e.indexNames.contains(o.field)&&(u=e.index(o.field))&&1===f.length?!1:s)?u&&o?u.openCursor(a.ot(o)):e.openCursor(void 0):u&&o?u.openKeyCursor(a.ot(o)):e.openKeyCursor(void 0)).onsuccess=function(t){var n,t=t.target.result;t?(s&&(n=t.value,null!=f)&&f.length&&!a.ut(n,f)||r++,t.continue()):i(r)},u.onerror=function(t){n(t.target.error)}):((t=e.count()).onsuccess=function(){return i(t.result)},t.onerror=function(){return n(t.error)})})},j.prototype.openCursor=function(t,n){return(n=n||this.getTransaction([t])).objectStore(t).openCursor()},j.prototype.deleteById=function(e,r,s){var o=this;return new Promise(function(t,n){var i=(s=s||o.getTransaction([e],!0)).objectStore(e).delete(r);i.onsuccess=function(){return t()},i.onerror=function(){n()}})},j.prototype.deleteByCount=function(r,s){var n=this;return new Promise(function(e,t){return Nr(n,void 0,void 0,function(){var n,i;return Dr(this,function(t){switch(t.label){case 0:n=8192,t.label=1;case 1:return 0<s?[4,this.queryByCursor(r,{maxCount:Math.min(s,n)})]:[3,4];case 2:return 0===(i=t.sent()).length?[3,4]:(s-=i.length,[4,this.deleteItems(r,i)]);case 3:return t.sent(),[3,1];case 4:return e(),[2]}})})})},j.prototype.deleteAll=function(r,s){var t=this;return new Promise(function(i,e){return Nr(t,void 0,void 0,function(){var n;return Dr(this,function(t){return s=s||this.getTransaction([r],!0),n=s.objectStore(r),(n=n.clear()).onsuccess=function(){return i()},n.onerror=function(t){e()},[2]})})})},j.prototype.deleteItems=function(e,r,s){var t=this;return new Promise(function(n){return Nr(t,void 0,void 0,function(){var i;return Dr(this,function(t){switch(t.label){case 0:return s=s||this.getTransaction([e],!0),i=s.objectStore(e),[4,Promise.all(r.map(function(n){return new Promise(function(t){i.delete(n.id).onsuccess=function(){return t()}})}))];case 1:return t.sent(),n(),[2]}})})})},j.prototype.ut=function(e,t){return t.every(function(t){var n=e[t.field],i=t.value,t=t.operator;switch(void 0===t?1:t){case 1:return n===i;case 2:return n!==i;case 3:return n<i;case 4:return i<n;case 5:return n<=i;case 6:return i<=n;default:return!1}})},j.prototype.ot=function(t){var n=t.value,t=t.operator;switch(void 0===t?1:t){case 1:return IDBKeyRange.only(n);case 3:return IDBKeyRange.upperBound(n,!0);case 5:return IDBKeyRange.upperBound(n);case 4:return IDBKeyRange.lowerBound(n,!0);case 6:return IDBKeyRange.lowerBound(n);default:return}},j);function j(){}var c=function(t,n,i){if(i||2===arguments.length)for(var e,r=0,s=n.length;r<s;r++)!e&&r in n||((e=e||Array.prototype.slice.call(n,0,r))[r]=n[r]);return t.concat(e||Array.prototype.slice.call(n))},Ur={version:1,database:"zego_rtc_logger",tableList:c(c([{tableName:"log_instance",tableItems:[]}],new Array(20).fill(void 0).map(function(t,n){return{tableName:"file_"+(n+1),tableItems:[{itemName:"log",index:!1,unique:!1},{itemName:"instanceId",index:!0,unique:!1}]}}),!0),[{tableName:"file_usage",tableItems:[]}],!1)},Lr=Ur.tableList.map(function(t){return t.tableName});Pr=function(t,n){return(Pr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}))(t,n)};(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}Pr(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)})(Mr,Fr=t),Mr.prototype.size=function(){return this.queue.length};var Pr,Fr,zr=Mr;function Mr(t){void 0===t&&(t=1/0);var n=Fr.call(this,"zzziplog storage_"+Date.now())||this;return n.logCacheMax=t,n}var Br=function(){return(Br=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Cr=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},Hr=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},qr=(Jr.prototype.pushTask=function(t,n,i,e,r){t={task:t};n&&(t=Br(Br({},t),{args:n})),i&&(t=Br(Br({},t),{successCallback:i})),e&&(t=Br(Br({},t),{errorCallback:e})),r&&(t=Br(Br({},t),{completeCallback:r})),this.ct.push(t)},Jr.prototype.ft=function(e,r){return Cr(this,void 0,void 0,function(){var n,i;return Hr(this,function(t){switch(t.label){case 0:n=null,t.label=1;case 1:return(t.trys.push([1,4,5,6]),e&&e.args?n=e.task.apply(e,e.args):e&&(n=e.task()),n instanceof Promise)?[4,n]:[3,3];case 2:n=t.sent(),t.label=3;case 3:return e.successCallback&&e.successCallback(n),[3,6];case 4:if(i=t.sent(),e.errorCallback)return e.errorCallback(i),[3,6];throw i;case 5:return r(),e.completeCallback&&e.completeCallback(),[7];case 6:return[2]}})})},Jr.prototype.runATask=function(){return Cr(this,void 0,void 0,function(){var n,i=this;return Hr(this,function(t){switch(t.label){case 0:return this.ct.length<=0?[2]:(n=this.ct[0],n?[4,this.ft(n,function(){i.ct.shift()})]:[3,2]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},Jr.prototype.runAllTask=function(){return Cr(this,void 0,void 0,function(){return Hr(this,function(t){switch(t.label){case 0:return 0<this.ct.length?[4,this.runATask()]:[3,2];case 1:return t.sent(),[3,0];case 2:return[2]}})})},Jr.prototype.size=function(){return this.ct.length},Jr);function Jr(){this.ct=[]}Gr.prototype.writeLine=function(t){t&&""!==t&&this.ht.push(t)},Gr.prototype.saveAs=function(t,n){var i=document.createElement("a");i.href=URL.createObjectURL(t),i.download=n,i.click()},Gr.prototype.createZip=function(){var t="";0<this.ht.length&&(t=this.ht.join("\n"),this.ht=[]);t=(t=>{for(var n,i=0,e=t.length,r="";i<e;)n=t.subarray(i,Math.min(i+32768,e)),r+=String.fromCharCode.apply(null,Array.from(n)),i+=32768;return btoa(r)})(_e(t));return new Blob([t],{type:"text/plain;charset=utf-8"})};var Kr=Gr;function Gr(){this.ht=[]}var Wr=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},Xr=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},$r=(Yr.prototype.setUploadUrl=function(t){this.lt=t,this.vt=0,this.dt=this.lt[this.vt]},Yr.prototype.sendRequest=function(e,r){return void 0===r&&(r=!1),Wr(this,void 0,void 0,function(){var n,i;return Xr(this,function(t){switch(t.label){case 0:if(!this.dt)throw new Error("upload url is empty");t.label=1;case 1:return t.trys.push([1,3,,7]),[4,ts.post("https://".concat(this.dt,"/log/").concat(r?"userupload":"upload"),e,this.proxyCtrl)];case 2:if(0!==(n=t.sent()).code)throw n;return this.C.info("zl.zlu.sr zip log ".concat(this.dt)),[3,7];case 3:if(101!==(null==(n=t.sent())?void 0:n.code)&&this.lt.length&&this.vt!==this.lt.length-1)return[3,4];throw i=this.dt,this.vt=0,this.dt=this.lt[this.vt],new Error("upload logs ".concat(i," failed, error=").concat(JSON.stringify(n)));case 4:return this.vt<this.lt.length-1&&this.vt++,this.dt=this.lt[this.vt],[4,this.sendRequest(e,r)];case 5:t.sent(),t.label=6;case 6:return[3,7];case 7:return[2]}})})},Yr.prototype.upload=function(i,h,a){return Wr(this,void 0,void 0,function(){var s,o,u,c,f,n=this;return Xr(this,function(t){switch(t.label){case 0:return s=i.appId,o=i.userId,u=i.deviceId,c=i.token,[4,Ae(s)];case 1:if(f=t.sent(),!(!s||!o&&!u||!f&&!c))return[2,new Promise(function(e,r){return Wr(n,void 0,void 0,function(){var n,i=this;return Xr(this,function(t){switch(t.label){case 0:return(n=function(){return Wr(i,void 0,void 0,function(){var n,i,e=this;return Xr(this,function(t){switch(t.label){case 0:this.wt=!0,(n=new FormData).append("logs",h),n.append("appid",s.toString()),o&&n.append("uin",null==o?void 0:o.toString()),n.append("timestamp",(new Date).getTime().toString()),u&&n.append("deviceid",u),f?n.append("litesign",f):c&&n.append("token",c),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,this.sendRequest(n,a)];case 2:return t.sent(),[3,5];case 3:return i=t.sent(),r(i),[3,5];case 4:return setTimeout(function(){return Wr(e,void 0,void 0,function(){return Xr(this,function(t){switch(t.label){case 0:return this.wt=!1,[4,this.bt.runATask()];case 1:return t.sent(),[2]}})})},100),[7];case 5:return[2]}})})},this.wt)?(this.bt.pushTask(n,[],function(){e()},function(t){r(t)}),[3,3]):[3,1];case 1:return[4,n()];case 2:t.sent(),e(),t.label=3;case 3:return[2]}})})})];throw new Error("cannot upload logs, please login room before you upload logs.")}})})},Yr);function Yr(t,n){this.C=t,this.proxyCtrl=n,this.yt="detaillog-global.zego.im",this.dt=this.yt,this.lt=[],this.vt=0,this.bt=new qr,this.wt=!1}var Qr=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},Vr=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},ts=(ns.post=function(r,s,o){var t=this;return new Promise(function(i,e){return Qr(t,void 0,void 0,function(){var n;return Vr(this,function(t){try{o?o.startHttpRequest({location:r,body:s,method_no:2,headers:[{name:"Content-Type",val:"multipart/form-data"}],serviceType:2},function(t){200===t.status_code?i(t.body):e("request fail. status="+t.status_code)},function(t){e("request fail. result: "+JSON.stringify(t))}):((n=new XMLHttpRequest).open("POST",r,!0),n.responseType="json",n.send(s),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&(200===n.status?i(n.response):e("request fail. status="+n.status))})}catch(t){e(t)}return[2]})})})},ns);function ns(){}var is=function(){return(is=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},es=(rs.prototype.build=function(t){for(var n=is({},t),i=[],e=0,r=this._t;e<r.length;e++){var s=r[e];i.push(n[s])}for(var o=0,u=this.gt;o<u.length;o++){var c=n[s=u[o]];c!==this.Ot[s]&&(this.Ot[s]=c,i.push("".concat(s,": ").concat(c)))}return i.join(" @ ")},rs.prototype.buildFullMessageLog=function(t){t=JSON.parse(t),t=is(is({},this.Ot),t);return JSON.stringify(t)},rs);function rs(t){this.N=t,this.Ot={},this._t=["level","time","action","content","streamid"],this.gt=["appid","userid","roomid","sessionid"],this.St=0}var ss=function(){return(ss=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},T=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},x=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},os=new TextEncoder;function us(t){return os.encode(t).length}function cs(t){var t=new Date(t),n=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),e=String(t.getDate()).padStart(2,"0"),r=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),t=String(t.getSeconds()).padStart(2,"0");return"".concat(n).concat(i).concat(e).concat(r).concat(s).concat(t)}R.prototype.setFileConfig=function(t,n){"number"==typeof t&&(t=t<3?3:20<t?20:Math.round(t),this.fileConfig.count=t),"number"==typeof n&&0<=n&&(this.fileConfig.size=n)},Object.defineProperty(R.prototype,"dbOpened",{get:function(){return this.kt},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"Et",{get:function(){return this.N.appid},enumerable:!1,configurable:!0}),R.prototype.At=function(t){return T(this,void 0,void 0,function(){var o,u,n=this;return x(this,function(t){switch(t.label){case 0:return o=[],[4,new Promise(function(r,s){return T(n,void 0,void 0,function(){var n,i,e;return x(this,function(t){switch(t.label){case 0:return(n=this.it.getTransaction(Lr,!0)).oncomplete=function(){r()},n.onerror=function(t){s(n.error)},n.onabort=function(t){s(n.error)},[4,this.jt.queryList(n)];case 1:return i=t.sent(),[4,this.Tt.queryList(void 0,n)];case 2:return e=t.sent(),(u=i[0])&&(e.forEach(function(t){t.lastLogTime<u.lastTime&&o.push(t)}),this.xt.deleteAll(u.fileId,n),this.Tt.delete(o,n)),[2]}})})})];case 1:return t.sent(),[2]}})})},R.prototype.checkUsingFile=function(){return T(this,void 0,void 0,function(){var h,a,l,n,i=this;return x(this,function(t){switch(t.label){case 0:return h=[],l=!(a=[]),[4,new Promise(function(c,f){return T(i,void 0,void 0,function(){var n,i,e,r,s,o,u=this;return x(this,function(t){switch(t.label){case 0:return(n=this.it.getTransaction(Lr,!0)).oncomplete=function(){c()},n.onerror=function(t){f(n.error)},n.onabort=function(t){f(n.error)},[4,this.jt.queryList(n)];case 1:return i=t.sent(),[4,this.Tt.queryList(void 0,n)];case 2:if(e=t.sent(),o=i[i.length-1],0<(s=i.length-this.fileConfig.count)&&(a=i.splice(0,s)),o&&o.byteLength>=this.fileConfig.size?(l=!0,i.length===this.fileConfig.count&&(s=i.shift())&&a.push(s)):o||(l=!0),a.length&&((r=a[a.length-1])&&e.forEach(function(t){(!t.active||3e5<Date.now()-t.lastLogTime)&&t.lastLogTime<r.lastTime&&h.push(t)}),a.forEach(function(t){u.xt.deleteAll(t.fileId,n),u.jt.delete(t,n)}),this.Tt.delete(h,n)),l){if(s=Date.now(),!(o=new Array(20).fill(1).map(function(t,n){return n+1}).find(function(n){return!i.find(function(t){return t.fileId===n})})))throw"not found can use file";this.jt.save({fileId:o,byteLength:0,startTime:s,lastTime:s},n)}return[2]}})})})];case 1:return t.sent(),[4,this.jt.queryList()];case 2:return n=t.sent(),[2,n[n.length-1]]}})})},R.prototype.uploadLegacyLog=function(o,i,s){return void 0===i&&(i=!0),void 0===s&&(s=5),T(this,void 0,void 0,function(){var e,n,r=this;return x(this,function(t){switch(t.label){case 0:return this.Rt?[4,this.Tt.queryList()]:[2];case 1:return n=(n=t.sent()).filter(function(t){return!(t.id===r.It||!t.userIds.length||t.active&&!(3e5<Date.now()-t.lastLogTime)||i&&t.userIds.includes(r.N.userid))}),e=n.reduce(function(t,n){var i=n.userIds[n.userIds.length-1];return i&&(t[i]=t[i]||[],t[i].push(n)),t},{}),n=Object.keys(e),n=n.map(function(i){return T(r,void 0,void 0,function(){var n,r,s=this;return x(this,function(t){return n=e[i],r=function(){return T(s,void 0,void 0,function(){return x(this,function(t){switch(t.label){case 0:return[4,this.Nt(i,o,n)];case 1:return t.sent(),[2]}})})},[2,new Promise(function(i,e){return T(s,void 0,void 0,function(){var n;return x(this,function(t){switch(t.label){case 0:return this.dbOpened?[3,1]:(this.Dt.pushTask(r,[],function(){i()},function(t){e(t)}),[3,5]);case 1:return t.trys.push([1,3,,4]),[4,r()];case 2:return t.sent(),[3,4];case 3:return n=t.sent(),e(n),[2];case 4:i(),t.label=5;case 5:return[2]}})})}).catch(function(t){return{error:t,index:0}})]})})}),s--,[4,Promise.all(n)];case 2:return(n=t.sent(),n.find(function(t){return null==t?void 0:t.error})&&s)?[4,this.uploadLegacyLog(o,i,s)]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}})})},R.prototype.openDB=function(){return T(this,void 0,void 0,function(){var n;return x(this,function(t){switch(t.label){case 0:return n=!1,this.Zt||(this.Zt=this.it.openDB(this.Et,Ur),n=!0),[4,this.Zt];case 1:return t.sent(),[4,this.Ut()];case 2:return(t.sent(),this.Zt=void 0,this.kt=!0,n)?[4,this.Dt.runAllTask()]:[3,5];case 3:return t.sent(),[4,this.Lt.runATask()];case 4:t.sent(),this.Pt(),t.label=5;case 5:return[2]}})})},R.prototype.Ut=function(s){return T(this,void 0,void 0,function(){var n,i,e,r;return x(this,function(t){switch(t.label){case 0:return(n=this.It,i=!1,void 0!==n)?[3,1]:(i=!0,[3,3]);case 1:return[4,this.Tt.getItem(n,s)];case 2:(e=t.sent())?e.active||this.Tt.update({id:e.id,active:1},s):i=!0,t.label=3;case 3:return i?(e=Date.now(),r={appId:this.Et,userIds:this.Ft,active:1,lastLogTime:e,createdAt:e,logQuantity:0,byteLength:0},this.N.userid&&!this.Ft.includes(this.N.userid)&&this.Ft.push(this.N.userid),[4,this.Tt.save(r,s)]):[3,5];case 4:r=t.sent(),this.It=r,t.label=5;case 5:return[2]}})})},R.prototype.zt=function(){return this.Rt&&R.isEnvSupport()&&!this.kt&&!this.Zt},R.prototype.enable=function(){this.Rt||(this.Rt=!0,this.zt()&&this.openDB())},R.prototype.saveLog=function(t){this.zt()&&this.openDB();t=JSON.parse(t);for(this.Ft&&t.userid&&!this.Ft.includes(t.userid)&&(this.Ft.push(t.userid),this.dbOpened)&&this.Tt.update({id:this.It,userIds:this.Ft}),this.U.push(this.Mt.build(t));this.U.size()>this.U.logCacheMax;)this.U.pop();this.Bt||this.Pt()},R.prototype.Pt=function(w){return void 0===w&&(w=!1),T(this,void 0,void 0,function(){var n,i=this;return x(this,function(t){switch(t.label){case 0:return this.Rt?this.dbOpened?(n=!1,this.Bt||(n=!0,this.Bt=new Promise(function(l,v){function d(){T(i,void 0,void 0,function(){var n,i,e,r,s,o,u,c,f,h,a=this;return x(this,function(t){switch(t.label){case 0:if(!(n=this.It))return l(),[2];if(!this.dbOpened||!this.fileConfig.size)return l(),[2];if((i=this.U.getFrontList(100)).length<100&&(s=Date.now(),s=this.Ct&&1e4<=s-this.Ct,h=0!==i.length,!h||!w&&!s))return h?this.Ht||(this.Ht=window.setTimeout(function(){a.Pt()},1e4)):(this.Ht&&window.clearTimeout(this.Ht),this.Ht=void 0),l(),[2];e=function(t){var n="QuotaExceededError";(null==t?void 0:t.name)===n||t+""==n?a.At().finally(function(){setTimeout(function(){d()},5e3)}):v(t)},t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.checkUsingFile()];case 2:return r=t.sent(),[3,4];case 3:return s=t.sent(),e(s),[2];case 4:return(o=r.fileId,u=i.reduce(function(t,n){return t+=us(n)},0),(c=this.it.getTransaction(Lr,!0)).oncomplete=function(){a.U.removeFrontList(i.length),d()},c.onerror=function(t){e(c.error)},c.onabort=function(t){e(c.error)},f=Date.now(),this.It)?[4,this.Tt.getItem(this.It,c)]:[3,6];case 5:(h=t.sent())?(this.Ct=f,i.length,this.Tt.update({id:this.It,byteLength:h.byteLength+u,logQuantity:h.logQuantity+i.length,lastLogTime:f},c)):this.Ut(c),t.label=6;case 6:return this.xt.saveLogs(o,i,n,c),r.byteLength+=u,r.lastTime=f,this.jt.update(r,c),[2]}})})}d()}),this.Bt.finally(function(){i.Bt=void 0})),[4,this.Bt]):[2]:[2];case 1:return t.sent(),!w||n?[3,3]:[4,this.Pt(w)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},R.isEnvSupport=function(){return!!(window&&"indexedDB"in window)},R.prototype.qt=function(a,l,p){return T(this,void 0,void 0,function(){var n,h,d,w,b,y,m,i,_,e,g=this;return x(this,function(t){switch(t.label){case 0:return p?[3,2]:[4,this.Tt.queryList()];case 1:n=t.sent(),p=n.filter(function(t){return t.userIds.includes(a)}),t.label=2;case 2:h=new Kr,d=0,w=[],b=this.fileConfig.size,y=function(){return T(g,void 0,void 0,function(){var n,i,e,r,s,o,u,c,f;return x(this,function(t){switch(t.label){case 0:n=h.createZip(),i={appId:this.Et,deviceId:this.N.deviceid},a===this.N.userid&&(i.token=this.N.token),i.userId=a,s=w.reduce(function(t,n){return n.startTime<e&&(t.startTime=n.startTime),r<n.endTime&&(t.endTime=n.endTime),t},{startTime:0,endTime:0}),e=s.startTime,r=s.endTime,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.Jt.upload(i,n,l)];case 2:return t.sent(),[3,4];case 3:throw s=t.sent(),this.onUploadLog(n.size,"".concat(a,"_").concat(cs(e),"_").concat(cs(r)),{code:-1,message:""+s+JSON.stringify(s)}),s;case 4:h=new Kr,d=0,o=this.it.getTransaction(Lr,!0),u=0,t.label=5;case 5:return u<w.length?(c=w[u],[4,this.Tt.getItem(c.id,o)]):[3,8];case 6:(f=t.sent())&&((f=f.byteLength-c.uploadByteLength)<0&&(f=0),this.Tt.update({id:c.id,lastUploadInfo:{logId:c.logId,usageId:c.usageId},byteLength:f},o)),t.label=7;case 7:return u++,[3,5];case 8:return this.onUploadLog(n.size,"".concat(a,"_").concat(cs(e),"_").concat(cs(r))),w=[],[2]}})})},m=function(t){h.writeLine(t);t=us(t);return b<(d+=t)?{byteLength:t,hasLeft:!1}:{byteLength:t,hasLeft:!0}},i=function(n){var r,i,s,o,e,u,c,f,h,a,l,v;return x(this,function(t){switch(t.label){case 0:return r=p[n],[4,_.Tt.getItem(r.id)];case 1:return i=t.sent(),i=(i||r).lastUploadInfo,s=ss(ss({id:r.id,logId:0,usageId:0},i||{}),{uploadByteLength:0,startTime:r.createdAt,endTime:r.lastLogTime}),w.push(s),o=0,m("#start# "+r.id),m(JSON.stringify(r)),[4,_.jt.queryList()];case 2:e=t.sent(),u=0,t.label=3;case 3:return u<e.length?(c=e[u],c=c.fileId,!i||c>=i.usageId?(s.usageId=c,[4,_.xt.queryList(c,r.id)]):[3,11]):[3,12];case 4:f=t.sent(),h=function(e){return T(g,void 0,void 0,function(){var n,i;return x(this,function(t){switch(t.label){case 0:return(i=m(e.log),n=i.hasLeft,i=i.byteLength,o++,s.logId=e.id,s.uploadByteLength+=i,n)?[3,2]:(m("#end# "+r.id+" "+o),o=0,[4,y()]);case 1:t.sent(),m("#start# "+r.id),t.label=2;case 2:return[2]}})})},a=0,t.label=5;case 5:return a<f.length?(l=f[a],c!==(null==i?void 0:i.usageId)?[3,8]:l.id>i.logId?[4,h(l)]:[3,7]):[3,11];case 6:t.sent(),t.label=7;case 7:return[3,10];case 8:return l.log,[4,h(l)];case 9:t.sent(),t.label=10;case 10:return a++,[3,5];case 11:return u++,[3,3];case 12:return(m("#end# "+r.id+" "+o),o=0,!(v=p[n+1])||0<d&&d+v.byteLength>b)?[4,y()]:[3,14];case 13:t.sent(),t.label=14;case 14:return[2]}})},_=this,e=0,t.label=3;case 3:return e<p.length?[5,i(e)]:[3,6];case 4:t.sent(),t.label=5;case 5:return e++,[3,3];case 6:return[2]}})})},R.prototype.Nt=function(s,o,u){return T(this,void 0,void 0,function(){var n=this;return x(this,function(t){return[2,new Promise(function(e,r){return T(n,void 0,void 0,function(){var n,i=this;return x(this,function(t){return n=function(){return T(i,void 0,void 0,function(){return x(this,function(t){switch(t.label){case 0:return[4,this.qt(s,o,u)];case 1:return t.sent(),[2]}})})},this.Lt.pushTask(n,[],function(){e()},function(t){r(t)},function(){0<i.Lt.size()&&i.Lt.runATask()}),this.dbOpened&&1===this.Lt.size()&&this.Lt.runATask(),[2]})})})]})})},R.prototype.Kt=function(i){return T(this,void 0,void 0,function(){var n;return x(this,function(t){switch(t.label){case 0:return this.It?[4,this.Pt(!0)]:[2];case 1:t.sent(),this.Gt=!1,t.label=2;case 2:return t.trys.push([2,4,,5]),[4,this.Nt(this.N.userid,i)];case 3:return t.sent(),this.Gt=!0,[3,5];case 4:throw n=t.sent(),this.Gt=!1,n;case 5:return[2]}})})},R.prototype.setUploadUrl=function(t){this.Jt.setUploadUrl(t)},R.prototype.startUpload=function(i,e){return void 0===e&&(e=!1),T(this,void 0,void 0,function(){var n;return x(this,function(t){switch(t.label){case 0:if(!this.Rt)throw new Error("zip logs upload is not enabled.");if(!e&&0!==this.Wt&&performance.now()-this.Wt<6e4&&this.Gt||this.Xt)throw new Error("Do not uplaod frequently.");t.label=1;case 1:return t.trys.push([1,6,,7]),this.Wt=performance.now(),this.Xt=!0,this.dbOpened?[3,3]:[4,this.openDB()];case 2:t.sent(),t.label=3;case 3:return[4,this.Kt(i)];case 4:return t.sent(),[4,this.uploadLegacyLog(i)];case 5:return t.sent(),this.Xt=!1,[3,7];case 6:throw n=t.sent(),this.Xt=!1,n;case 7:return[2]}})})},R.prototype.disable=function(){return T(this,void 0,void 0,function(){var n;return x(this,function(t){switch(t.label){case 0:if(n=this.It,!this.Rt||isNaN(n)||!this.kt)return[3,6];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.Tt.update({active:0,id:n})];case 2:return t.sent(),[3,4];case 3:return t.sent(),[3,4];case 4:return[4,this.Pt(!0)];case 5:return t.sent(),this.it.closeDB(),this.kt=!1,this.U.clear(),[2,!(this.Rt=!1)];case 6:return this.U.clear(),[2,this.Rt=!1]}})})},R.prototype.onUploadLog=function(t,n,i){},R.prototype.destroy=function(){this.It?this.disable():(this.Ht&&(window.clearTimeout(this.Ht),this.Ht=void 0),this.U.clear())};var fs=R;function R(t,n,i){var e=this;this.N=t,this.C=n,this.proxyCtrl=i,this.fileConfig={count:3,size:5242880},this.it=new Zr,this.xt=new Sr(this.it),this.Tt=new Tr(this.it),this.jt=new Rr(this.it),this.kt=!1,this.U=new zr(8e3),this.Dt=new qr,this.Lt=new qr,this.Rt=!1,this.Wt=0,this.Gt=!1,this.Xt=!1,this.Ft=[],this.Zt=void 0,this.Jt=new $r(n,i),this.Mt=new es(this.N),this.it.onDBClose=function(){e.kt=!1}}var hs=function(){return(hs=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},as=function(t,o,u,c){return new(u=u||Promise)(function(i,n){function e(t){try{s(c.next(t))}catch(t){n(t)}}function r(t){try{s(c.throw(t))}catch(t){n(t)}}function s(t){var n;t.done?i(t.value):((n=t.value)instanceof u?n:new u(function(t){t(n)})).then(e,r)}s((c=c.apply(t,o||[])).next())})},ls=function(e,r){var s,o,u,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(i){return function(t){var n=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;c=f&&n[f=0]?0:c;)try{if(s=1,o&&(u=2&n[0]?o.return:n[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,n[1])).done)return u;switch(o=0,(n=u?[2&n[0],u.value]:n)[0]){case 0:case 1:u=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3]))c.label=n[1];else if(6===n[0]&&c.label<u[1])c.label=u[1],u=n;else{if(!(u&&c.label<u[2])){u[2]&&c.ops.pop(),c.trys.pop();continue}c.label=u[2],c.ops.push(n)}}n=r.call(e,c)}catch(t){n=[6,t],o=0}finally{s=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}};Object.defineProperty(I.prototype,"url",{get:function(){return this.N.url||""},set:function(t){this.N.url=t},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"logType",{get:function(){return this.N.logType||r.DISABLE},set:function(t){this.N.logType=t},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"env",{get:function(){return this.N.env},set:function(t){this.N.env=t},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"appid",{get:function(){return this.N.appid},set:function(t){this.N.appid=t},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"roomid",{get:function(){return this.N.roomid},set:function(t){this.N.roomid=t},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"sessionid",{get:function(){return this.N.sessionid},set:function(t){this.N.sessionid=t},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"userid",{get:function(){return this.N.userid},set:function(t){this.N.userid=t},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"version",{get:function(){return this.N.version},set:function(t){this.N.version=t},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"wsSpeed",{get:function(){var t;return null!=(t=null==(t=this.$t)?void 0:t.speed)?t:0},enumerable:!1,configurable:!0}),I.prototype.setLogLevel=function(t){t=s[t];return void 0!==t&&(this.logLevel=t,!0)},I.prototype.setRemoteLogLevel=function(t){t=s[t];return void 0!==t&&(this.logRemoteLevel=t,!0)},I.prototype.setSessionInfo=function(t,n,i,e,r,s){this.appid=t,this.roomid=n,this.sessionid=i,this.userid=e,this.version=s},I.prototype.setTokenInfo=function(t,n){this.N.token=t||"",n&&(this.N.userid=n)},I.prototype.setZipLogConfig=function(t,n){var i;void 0===n&&(n=!1),1===t?(!this.Yt&&this.env==o.BROWSER&&fs.isEnvSupport()&&(this.Yt=new fs(this.N,this.C,this.proxyCtrl)),null!=(i=this.Yt)&&i.enable()):0==t&&n&&this.Yt&&(this.Yt.destroy(),this.Yt=null)},I.prototype.setStorageConfig=function(t){this.Yt&&this.Yt.setFileConfig(t.count,t.size)},I.prototype.setZipLogDomains=function(t,n){t=this.getLogUrlsByIPStackMode(t,n);this.Yt&&this.Yt.setUploadUrl(t),gr.domains=t},I.prototype.makeZipLogSpaceUpload=function(){return as(this,void 0,void 0,function(){return ls(this,function(t){switch(t.label){case 0:return this.Yt?[4,this.Yt.uploadLegacyLog(!1,!1)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},I.prototype.uploadStorageLog=function(n){return void 0===n&&(n=!1),as(this,void 0,void 0,function(){return ls(this,function(t){switch(t.label){case 0:return this.Yt?[4,this.Yt.startUpload(n)]:[3,2];case 1:return t.sent(),[3,3];case 2:throw new Error("cannot use zip log module");case 3:return[2]}})})},I.prototype.report=function(t){t=this.Qt(s.REPORT,t);this.logLevel!==s.DISABLE&&this.logLevel<=s.REPORT&&!this.isDestroy&&console.debug(t),this.Vt(s.REPORT,t,!0)},I.prototype.debug=function(t,n){var i={},n=("string"==typeof(n=void 0===n?{}:n)?t=Array.from(arguments).join(""):i=n,this.tn(s.DEBUG,t,i));this.logLevel!==s.DISABLE&&this.logLevel<=s.DEBUG&&!this.isDestroy&&console.debug(n),this.nn(s.DEBUG,n)},I.prototype.info=function(t,n){var i={},n=("string"==typeof(n=void 0===n?{}:n)?t=Array.from(arguments).join(""):i=n,this.tn(s.INFO,t,i));this.logLevel!==s.DISABLE&&this.logLevel<=s.INFO&&!this.isDestroy&&console.info(n),this.nn(s.INFO,n)},I.prototype.warn=function(t,n){var i={},n=("string"==typeof(n=void 0===n?{}:n)?t=Array.from(arguments).join(""):i=n,this.tn(s.WARN,t,i));this.logLevel!==s.DISABLE&&this.logLevel<=s.WARN&&!this.isDestroy&&console.warn(n),this.nn(s.WARN,n)},I.prototype.remoteReport=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.tn(s.INFO,t.join(""));this.nn(s.INFO,i)},I.prototype.error=function(t,n){var i={},n=("string"==typeof(n=void 0===n?{}:n)?t=Array.from(arguments).join(""):i=n,this.tn(s.ERROR,t,i));this.logLevel!==s.DISABLE&&this.logLevel<=s.ERROR&&!this.isDestroy&&(console.error(n),this.env%2===o.BROWSER&&window?this.stateCenter.debug&&window.alert(t.substr(t.indexOf(" ")+1,4500)):(this.env,o.WEIXINMINI)),this.nn(s.ERROR,n)},I.prototype.nn=function(t,n){this.logRemoteLevel!==s.DISABLE&&this.logRemoteLevel<=t&&(this.Vt(t,n),this.Yt)&&this.Yt.saveLog(n)},I.prototype.setSettingConfig=function(t){this.N.ipStackMode=t.ipStackMode},I.prototype.getLogUrlsByIPStackMode=function(t,n){var i=[];switch(this.N.ipStackMode){case Z.IPv4Only:i.push.apply(i,t);break;case Z.IPv4Prefer:i.push.apply(i,t),i.push.apply(i,n);break;case Z.IPv6Prefer:i.push.apply(i,n),i.push.apply(i,t);break;default:i.push.apply(i,t)}return i},I.prototype.onConnected=function(t){},I.prototype.onUploadLog=function(t,n,i){},I.prototype.setLogServer=function(t,n){var i;if(this.isDestroy)return!1;if(this.logConnected)return!1;n=0===this.N.env?(this.N.connectURLs=this.getLogUrlsByIPStackMode(t,n),this.N.connectURLs[this.urlIndex]):(this.N.connectURLs=t,this.url!==this.N.connectURLs[0]&&(this.logConnected=!1),this.N.connectURLs[0]);try{return n.startsWith("wss:")?(this.logType=r.WEBSOCKET,null!=(i=this.$t)&&i.openWebSocketLogServer(n,!0)):n.startsWith("https:")?(this.logType=r.HTTPS,this.en(n)):this.logType=r.DISABLE,!0}catch(t){return this.error(JSON.stringify(t)),!1}},I.prototype.rn=function(){this.logType==r.WEBSOCKET?this.sn():this.logType==r.HTTPS&&(this.on(),this.un()),this.logType=r.DISABLE},I.prototype.sn=function(){var t;null!=(t=this.$t)&&t.stopWebSocketServer()},I.prototype.en=function(t){var n=this;(this.url=t)&&(this.un(),this.logUploadTimer||(this.logUploadTimer=setInterval(function(){n.on()},this.logUploadInterval)))},I.prototype.un=function(){this.logUploadTimer&&(clearInterval(this.logUploadTimer),this.logUploadTimer=null)},I.prototype.Vt=function(n,i,e){return void 0===e&&(e=!1),as(this,void 0,void 0,function(){return ls(this,function(t){if(!this.isDestroy)if(this.logType==r.WEBSOCKET)this.cn&&this.fn(n,i);else if(this.logType==r.HTTPS)this.hn(n,i,e);else if(this.logLevel!==s.DISABLE&&this.logLevel<=n){if(4e3<i.length)return[2];for(this.an.push(i);this.an.size()>this.ln;)this.an.removeALog()}return[2]})})},I.prototype.clearCache=function(){var t;0!==this.an.size()&&null!=(t=this.$t)&&t.clearLogCacheAndUpload()},I.prototype.fn=function(r,n){var s;return as(this,void 0,void 0,function(){var i,e=this;return ls(this,function(t){return"string"==typeof n&&4e3<n.length?((t,n)=>{void 0===n&&(n=2e3);for(var i=[],e=0;e<t.length;)i.push(t.substring(e,e+n)),e+=n;return i})((i=JSON.parse(n)).content,3e3).forEach(function(t,n){3<n||(i.content="s".concat(n+1,": ").concat(t),e.fn(r,JSON.stringify(i)))}):this.N.useStrategy&&this.env==o.BROWSER&&null!=(s=this.$t)&&s.addRemoteWsLog(n),[2]})})},I.prototype.hn=function(t,n,i){this.an.push(n),(this.an.size()>=this.ln||!0===i)&&this.on()},I.prototype.tn=function(t,n,i){void 0===i&&(i={});var e=H(),n=[n.substr(0,n.indexOf(" "))||n,n.substr(n.indexOf(" ")+1,8e3)||n],r=n[0],n=n[1],i=hs(hs({},i),{time:e,level:t,action:r,content:n,appid:this.appid,roomid:this.roomid||void 0,userid:this.userid,sessionid:this.sessionid||void 0});return JSON.stringify(i)},I.prototype.Qt=function(t,n){var i=H(),e="",e=this.env%2===o.BROWSER?"rtc":"ali";return n=hs(hs({},n),{time:i,level:t,console:e,appid:this.appid,room_id:this.roomid,roomid:this.roomid,userid:this.userid,id_name:this.userid,sessionid:this.sessionid,sdk_version:this.version,test_environment:this.stateCenter.testEnvironment,version:this.version,event_id:this.appid+"_"+this.userid+"_"+n.event_time+"_"+n.seq}),JSON.stringify(n)},I.prototype.on=function(){0!=this.an.size()&&(this.env%2===o.BROWSER?this.vn():this.SendHttpsLogWeChatMini())},I.prototype.vn=function(){var n=this,t=this.an.buffer.join("\n"),i=this.an.buffer,e=new XMLHttpRequest;e.onreadystatechange=function(){if(4==e.readyState){if(200==e.status){if(n.logConnected=!0,0==e.responseText.length)return;try{var t=JSON.parse(e.responseText).interval;"number"==typeof t&&n.logUploadInterval!==t&&(n.timeInterval=t,n.en(n.url))}catch(t){n.an.buffer=i.concat(n.an.buffer),console.log("send result failed "+t)}}else n.an.buffer=i.concat(n.an.buffer);i=null}},e.open("POST",this.url,!0),0==this.env?e.send(t):1==this.env&&(e.setRequestHeader("content-type","application/json"),e.send(JSON.stringify({user_id:this.userid,log:t}))),this.an.buffer=[]},I.prototype.SendHttpsLogWeChatMini=function(){},I.prototype.retryConnectSocket=function(){var t,n;100<performance.now()-this.wsConnectFailTime&&(this.tryIndex++,t=this.N.networkState===U.offline,n=void this.C.info("zl.rcs.0 ".concat(JSON.stringify(this.N.connectURLs)," ").concat(this.tryIndex," ").concat(this.urlIndex)),n=this.tryIndex<this.urlTryMaxCount?this.url:(this.tryIndex=0,this.urlIndex++,this.N.connectURLs[this.urlIndex%this.N.connectURLs.length]),t?null!=(t=this.$t)&&t.openWebSocketLogServer(n,!1,!0,this.dn):null!=(t=this.$t)&&t.openWebSocketLogServer(n,!1,!0,this.wn)),this.wsConnectFailTime=performance.now()},I.prototype.listener=function(){var t=this;this.env==o.BROWSER&&(window.addEventListener("online",function(){t.N.networkState=U.online,t.reconnectLogServer()}),window.addEventListener("offline",function(){t.N.networkState=U.offline})),this.$t&&(this.$t.onSocketConnect=function(){t.logConnected=!0,t.N.networkState=U.online,t.onConnected({url:t.url})},this.$t.onSocketClose=function(){t.retryConnectSocket()},this.$t.onSocketError=function(){t.retryConnectSocket()},this.$t.onHeartBeatTimeout=function(){t.reconnectLogServer()})},I.prototype.reconnectLogServer=function(){var t,n;this.logType===r.WEBSOCKET&&(this.C.info("zl.rcs.1 call"),this.tryIndex=0,this.urlIndex=0,n=this.N.connectURLs[this.urlIndex],this.url="",null!=(t=this.$t)&&t.resetSocketTimer(),null!=(t=this.$t))&&t.openWebSocketLogServer(n,!1,!0,this.wn)},I.prototype.enableWebSocketLog=function(t){this.$t&&t!==this.$t.enabled&&(t?(this.$t.enabled=!0,this.$t.openWebSocketLogServer(this.url,!0,!0)):(this.$t.enabled=!1,this.sn(),this.an.clear()))},I.prototype.stopStorageLog=function(){return as(this,void 0,void 0,function(){return ls(this,function(t){return this.Yt?[2,this.Yt.disable()]:[2,!1]})})},I.prototype.setUpBitrate=function(t){var n;return null==(n=this.$t)||!n.enabled||null==(n=this.$t)?void 0:n.setUpBitrate(t)},I.prototype.setUploadStrategy=function(t){var n;null!=(n=this.$t)&&n.enabled&&this.$t.setStrategy(t)},I.prototype.getWhiteList=function(t,n){return gr.fetchWhitelist({appID:this.appid,product:t=void 0===t?"rtc":t,userID:this.N.userid,token:this.N.token,deviceID:this.N.deviceid,bizType:n=void 0===n?0:n},this.proxyCtrl)},Object.defineProperty(I.prototype,"cn",{get:function(){var t;return!(null==(t=this.$t)||!t.enabled)},enumerable:!1,configurable:!0}),I.prototype.destroy=function(){var t;this.rn(),this.logUploadTimer&&clearTimeout(this.logUploadTimer),D.instance=void 0,null!=(t=this.$t)&&t.destroy(),this.Yt&&this.Yt.destroy(),this.url="",this.isDestroy=!0,this.tryIndex=0,this.urlIndex=0},I.logVersion="1.4.15";var vs=I;function I(t,n){var e=this;this.proxyCtrl=n,this.logLevel=s.INFO,this.logRemoteLevel=0,this.logUploadTimer=null,this.logUploadInterval=1e4,this.existUserID=!1,this.isDestroy=!1,this.ln=8192,this.wn=2e3,this.dn=5e3,this.C={debug:this.debug.bind(this),info:this.info.bind(this),warn:this.warn.bind(this),error:this.error.bind(this)},this.logConnected=!1,this.tryIndex=0,this.urlIndex=0,this.urlTryMaxCount=3,this.wsConnectFailTime=0,this.urlGroups={v4:[],v6:[]},this.inflate=ge,this.deflate=_e,this.stateCenter=D.getInstance(),this.N=new hr,this.N.env=t,this.an=new br(this.N,this.ln),this.$t=new Ie(this.an,this.N,this.C,this.proxyCtrl),this.listener(),this.env==o.BROWSER&&fs.isEnvSupport()&&(this.Yt=new fs(this.N,this.C,this.proxyCtrl),this.Yt.onUploadLog=function(t,n,i){e.onUploadLog(t,n,i)})}}],o={},r.m=s,r.c=o,r.d=function(t,n,i){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"bn",{value:!0})},r.t=function(n,t){if(1&t&&(n=r(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.bn)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var e in n)r.d(i,e,function(t){return n[t]}.bind(null,e));return i},r.n=function(t){var n=t&&t.bn?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=2);function r(t){var n;return(o[t]||(n=o[t]={i:t,l:!1,exports:{}},s[t].call(n.exports,n,n.exports,r),n.l=!0,n)).exports}var s,o});