nim-web-sdk-ng
Version:
Yunxin IM SDK next generation
24 lines • 515 kB
JavaScript
/**
*
* Version: 10.9.71
*
* Git Hash: f2dd8dce716f63985d0823f710605b924090d68b
*
* Created At: 1/5/2026, 9:46:13 AM
*
* Target: QCHAT_BROWSER_SDK.js
*
*/
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).QChat=i()}(this,(function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function createCommonjsModule(t){var i={exports:{}};return t(i,i.exports),i.exports}var i,u,h=getDefaultExportFromCjs(createCommonjsModule((function(t){t.exports=function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports}))),check=function(t){return t&&t.Math==Math&&t},m=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof t&&t)||function(){return this}()||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},v=!fails((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),E=Function.prototype,I=E.apply,M=E.call,S="object"==typeof Reflect&&Reflect.apply||(v?M.bind(I):function(){return M.apply(I,arguments)}),T=Function.prototype,C=T.bind,R=T.call,A=v&&C.bind(R,R),N=v?function(t){return t&&A(t)}:function(t){return t&&function(){return R.apply(t,arguments)}},isCallable=function(t){return"function"==typeof t},O=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=Function.prototype.call,x=v?w.bind(w):function(){return w.apply(w,arguments)},k={}.propertyIsEnumerable,P=Object.getOwnPropertyDescriptor,L={f:P&&!k.call({1:2},1)?function propertyIsEnumerable(t){var i=P(this,t);return!!i&&i.enumerable}:k},createPropertyDescriptor=function(t,i){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:i}},D=N({}.toString),q=N("".slice),classofRaw=function(t){return q(D(t),8,-1)},V=Object,U=N("".split),G=fails((function(){return!V("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?U(t,""):V(t)}:V,isNullOrUndefined=function(t){return null==t},B=TypeError,requireObjectCoercible=function(t){if(isNullOrUndefined(t))throw B("Can't call method on "+t);return t},toIndexedObject=function(t){return G(requireObjectCoercible(t))},j="object"==typeof document&&document.all,Y=void 0===j&&void 0!==j?function(t){return"object"==typeof t?null!==t:isCallable(t)||t===j}:function(t){return"object"==typeof t?null!==t:isCallable(t)},W={},aFunction=function(t){return isCallable(t)?t:void 0},getBuiltIn=function(t,i){return arguments.length<2?aFunction(W[t])||aFunction(m[t]):W[t]&&W[t][i]||m[t]&&m[t][i]},$=N({}.isPrototypeOf),H=getBuiltIn("navigator","userAgent")||"",Q=m.process,K=m.Deno,z=Q&&Q.versions||K&&K.version,J=z&&z.v8;J&&(u=(i=J.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!u&&H&&(!(i=H.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=H.match(/Chrome\/(\d+)/))&&(u=+i[1]);var X,Z=u,ee=!!Object.getOwnPropertySymbols&&!fails((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Z&&Z<41})),te=ee&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,re=Object,ne=te?function(t){return"symbol"==typeof t}:function(t){var i=getBuiltIn("Symbol");return isCallable(i)&&$(i.prototype,re(t))},ae=String,tryToString=function(t){try{return ae(t)}catch(t){return"Object"}},oe=TypeError,aCallable=function(t){if(isCallable(t))return t;throw oe(tryToString(t)+" is not a function")},getMethod=function(t,i){var u=t[i];return isNullOrUndefined(u)?void 0:aCallable(u)},ie=TypeError,se=Object.defineProperty,ce="__core-js_shared__",le=m[ce]||function(t,i){try{se(m,t,{value:i,configurable:!0,writable:!0})}catch(u){m[t]=i}return i}(ce,{}),ue=createCommonjsModule((function(t){(t.exports=function(t,i){return le[t]||(le[t]=void 0!==i?i:{})})("versions",[]).push({version:"3.25.0",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.25.0/LICENSE",source:"https://github.com/zloirock/core-js"})})),de=Object,toObject=function(t){return de(requireObjectCoercible(t))},pe=N({}.hasOwnProperty),he=Object.hasOwn||function hasOwn(t,i){return pe(toObject(t),i)},me=0,fe=Math.random(),ge=N(1..toString),uid=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ge(++me+fe,36)},ve=ue("wks"),_e=m.Symbol,ye=_e&&_e.for,Ee=te?_e:_e&&_e.withoutSetter||uid,wellKnownSymbol=function(t){if(!he(ve,t)||!ee&&"string"!=typeof ve[t]){var i="Symbol."+t;ee&&he(_e,t)?ve[t]=_e[t]:ve[t]=te&&ye?ye(i):Ee(i)}return ve[t]},Ie=TypeError,Me=wellKnownSymbol("toPrimitive"),toPrimitive=function(t,i){if(!Y(t)||ne(t))return t;var u,h=getMethod(t,Me);if(h){if(void 0===i&&(i="default"),u=x(h,t,i),!Y(u)||ne(u))return u;throw Ie("Can't convert object to primitive value")}return void 0===i&&(i="number"),function(t,i){var u,h;if("string"===i&&isCallable(u=t.toString)&&!Y(h=x(u,t)))return h;if(isCallable(u=t.valueOf)&&!Y(h=x(u,t)))return h;if("string"!==i&&isCallable(u=t.toString)&&!Y(h=x(u,t)))return h;throw ie("Can't convert object to primitive value")}(t,i)},toPropertyKey=function(t){var i=toPrimitive(t,"string");return ne(i)?i:i+""},Se=m.document,Te=Y(Se)&&Y(Se.createElement),documentCreateElement=function(t){return Te?Se.createElement(t):{}},Ce=!O&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),be=Object.getOwnPropertyDescriptor,Re={f:O?be:function getOwnPropertyDescriptor(t,i){if(t=toIndexedObject(t),i=toPropertyKey(i),Ce)try{return be(t,i)}catch(t){}if(he(t,i))return createPropertyDescriptor(!x(L.f,t,i),t[i])}},Ae=/#|\.prototype\./,isForced=function(t,i){var u=Oe[Ne(t)];return u==xe||u!=we&&(isCallable(i)?fails(i):!!i)},Ne=isForced.normalize=function(t){return String(t).replace(Ae,".").toLowerCase()},Oe=isForced.data={},we=isForced.NATIVE="N",xe=isForced.POLYFILL="P",ke=isForced,Pe=N(N.bind),functionBindContext=function(t,i){return aCallable(t),void 0===i?t:v?Pe(t,i):function(){return t.apply(i,arguments)}},Le=O&&fails((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),De=String,qe=TypeError,anObject=function(t){if(Y(t))return t;throw qe(De(t)+" is not an object")},Ve=TypeError,Ue=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,Fe="enumerable",Be="configurable",je="writable",Ye={f:O?Le?function defineProperty(t,i,u){if(anObject(t),i=toPropertyKey(i),anObject(u),"function"==typeof t&&"prototype"===i&&"value"in u&&je in u&&!u.writable){var h=Ge(t,i);h&&h.writable&&(t[i]=u.value,u={configurable:Be in u?u.configurable:h.configurable,enumerable:Fe in u?u.enumerable:h.enumerable,writable:!1})}return Ue(t,i,u)}:Ue:function defineProperty(t,i,u){if(anObject(t),i=toPropertyKey(i),anObject(u),Ce)try{return Ue(t,i,u)}catch(t){}if("get"in u||"set"in u)throw Ve("Accessors not supported");return"value"in u&&(t[i]=u.value),t}},We=O?function(t,i,u){return Ye.f(t,i,createPropertyDescriptor(1,u))}:function(t,i,u){return t[i]=u,t},$e=Re.f,wrapConstructor=function(t){var Wrapper=function(i,u,h){if(this instanceof Wrapper){switch(arguments.length){case 0:return new t;case 1:return new t(i);case 2:return new t(i,u)}return new t(i,u,h)}return S(t,this,arguments)};return Wrapper.prototype=t.prototype,Wrapper},_export=function(t,i){var u,h,v,E,I,M,S,T,C=t.target,R=t.global,A=t.stat,O=t.proto,w=R?m:A?m[C]:(m[C]||{}).prototype,x=R?W:W[C]||We(W,C,{})[C],k=x.prototype;for(v in i)u=!ke(R?v:C+(A?".":"#")+v,t.forced)&&w&&he(w,v),I=x[v],u&&(M=t.dontCallGetSet?(T=$e(w,v))&&T.value:w[v]),E=u&&M?M:i[v],u&&typeof I==typeof E||(S=t.bind&&u?functionBindContext(E,m):t.wrap&&u?wrapConstructor(E):O&&isCallable(E)?N(E):E,(t.sham||E&&E.sham||I&&I.sham)&&We(S,"sham",!0),We(x,v,S),O&&(he(W,h=C+"Prototype")||We(W,h,{}),We(W[h],v,E),t.real&&k&&!k[v]&&We(k,v,E)))},He=Math.ceil,Qe=Math.floor,Ke=Math.trunc||function trunc(t){var i=+t;return(i>0?Qe:He)(i)},toIntegerOrInfinity=function(t){var i=+t;return i!=i||0===i?0:Ke(i)},ze=Math.max,Je=Math.min,toAbsoluteIndex=function(t,i){var u=toIntegerOrInfinity(t);return u<0?ze(u+i,0):Je(u,i)},Xe=Math.min,lengthOfArrayLike=function(t){return(i=t.length)>0?Xe(toIntegerOrInfinity(i),9007199254740991):0;var i},createMethod$4=function(t){return function(i,u,h){var m,v=toIndexedObject(i),E=lengthOfArrayLike(v),I=toAbsoluteIndex(h,E);if(t&&u!=u){for(;E>I;)if((m=v[I++])!=m)return!0}else for(;E>I;I++)if((t||I in v)&&v[I]===u)return t||I||0;return!t&&-1}},Ze={includes:createMethod$4(!0),indexOf:createMethod$4(!1)},et={},tt=Ze.indexOf,rt=N([].push),objectKeysInternal=function(t,i){var u,h=toIndexedObject(t),m=0,v=[];for(u in h)!he(et,u)&&he(h,u)&&rt(v,u);for(;i.length>m;)he(h,u=i[m++])&&(~tt(v,u)||rt(v,u));return v},nt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],at=Object.keys||function keys(t){return objectKeysInternal(t,nt)},ot=O&&!Le?Object.defineProperties:function defineProperties(t,i){anObject(t);for(var u,h=toIndexedObject(i),m=at(i),v=m.length,E=0;v>E;)Ye.f(t,u=m[E++],h[u]);return t},it={f:ot},st=getBuiltIn("document","documentElement"),ct=ue("keys"),sharedKey=function(t){return ct[t]||(ct[t]=uid(t))},lt=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"</"+"script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var i=t.parentWindow.Object;return t=null,i},NullProtoObject=function(){try{X=new ActiveXObject("htmlfile")}catch(t){}var t,i;NullProtoObject="undefined"!=typeof document?document.domain&&X?NullProtoObjectViaActiveX(X):((i=documentCreateElement("iframe")).style.display="none",st.appendChild(i),i.src=String("javascript:"),(t=i.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F):NullProtoObjectViaActiveX(X);for(var u=nt.length;u--;)delete NullProtoObject.prototype[nt[u]];return NullProtoObject()};et[lt]=!0;var ut=Object.create||function create(t,i){var u;return null!==t?(EmptyConstructor.prototype=anObject(t),u=new EmptyConstructor,EmptyConstructor.prototype=null,u[lt]=t):u=NullProtoObject(),void 0===i?u:it.f(u,i)};_export({target:"Object",stat:!0,sham:!O},{create:ut});var dt=W.Object,pt=function create(t,i){return dt.create(t,i)},ht=String,mt=TypeError,ft=Object.setPrototypeOf||("__proto__"in{}?function(){var t,i=!1,u={};try{(t=N(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(u,[]),i=u instanceof Array}catch(t){}return function setPrototypeOf(u,h){return anObject(u),function(t){if("object"==typeof t||isCallable(t))return t;throw mt("Can't set "+ht(t)+" as a prototype")}(h),i?t(u,h):u.__proto__=h,u}}():void 0);_export({target:"Object",stat:!0},{setPrototypeOf:ft});var gt=W.Object.setPrototypeOf,vt=N([].slice),_t=Function,yt=N([].concat),Et=N([].join),It={},construct$8=function(t,i,u){if(!he(It,i)){for(var h=[],m=0;m<i;m++)h[m]="a["+m+"]";It[i]=_t("C,a","return new C("+Et(h,",")+")")}return It[i](t,u)},Mt=v?_t.bind:function bind(t){var i=aCallable(this),u=i.prototype,h=vt(arguments,1),m=function bound(){var u=yt(h,vt(arguments));return this instanceof m?construct$8(i,u.length,u):i.apply(t,u)};return Y(u)&&(m.prototype=u),m};_export({target:"Function",proto:!0,forced:Function.bind!==Mt},{bind:Mt});var entryVirtual=function(t){return W[t+"Prototype"]},St=entryVirtual("Function").bind,Tt=Function.prototype,bind$1=function(t){var i=t.bind;return t===Tt||$(Tt,t)&&i===Tt.bind?St:i},Ct=createCommonjsModule((function(t){function _setPrototypeOf(i,u){var h;return t.exports=_setPrototypeOf=gt?bind$1(h=gt).call(h):function _setPrototypeOf(t,i){return t.__proto__=i,t},t.exports.__esModule=!0,t.exports.default=t.exports,_setPrototypeOf(i,u)}t.exports=_setPrototypeOf,t.exports.__esModule=!0,t.exports.default=t.exports})),bt=getDefaultExportFromCjs(createCommonjsModule((function(t){t.exports=function _inheritsLoose(t,i){t.prototype=pt(i.prototype),t.prototype.constructor=t,Ct(t,i)},t.exports.__esModule=!0,t.exports.default=t.exports})));_export({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991});var Rt={f:Object.getOwnPropertySymbols},At=Object.assign,Nt=Object.defineProperty,Ot=N([].concat),wt=!At||fails((function(){if(O&&1!==At({b:1},At(Nt({},"a",{enumerable:!0,get:function(){Nt(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},i={},u=Symbol(),h="abcdefghijklmnopqrst";return t[u]=7,h.split("").forEach((function(t){i[t]=t})),7!=At({},t)[u]||at(At({},i)).join("")!=h}))?function assign(t,i){for(var u=toObject(t),h=arguments.length,m=1,v=Rt.f,E=L.f;h>m;)for(var I,M=G(arguments[m++]),S=v?Ot(at(M),v(M)):at(M),T=S.length,C=0;T>C;)I=S[C++],O&&!x(E,M,I)||(u[I]=M[I]);return u}:At;_export({target:"Object",stat:!0,arity:2,forced:Object.assign!==wt},{assign:wt});var xt=W.Object.assign,kt=!fails((function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype})),Pt=sharedKey("IE_PROTO"),Lt=Object,Dt=Lt.prototype,qt=kt?Lt.getPrototypeOf:function(t){var i=toObject(t);if(he(i,Pt))return i[Pt];var u=i.constructor;return isCallable(u)&&i instanceof u?u.prototype:i instanceof Lt?Dt:null},Vt=nt.concat("length","prototype"),Ut={f:Object.getOwnPropertyNames||function getOwnPropertyNames(t){return objectKeysInternal(t,Vt)}},Gt=N([].concat),Ft=getBuiltIn("Reflect","ownKeys")||function ownKeys(t){var i=Ut.f(anObject(t)),u=Rt.f;return u?Gt(i,u(t)):i},Bt=Error,jt=N("".replace),Yt=String(Bt("zxcasd").stack),Wt=/\n\s*at [^:]*:[^\n]*/,$t=Wt.test(Yt),errorStackClear=function(t,i){if($t&&"string"==typeof t&&!Bt.prepareStackTrace)for(;i--;)t=jt(t,Wt,"");return t},installErrorCause=function(t,i){Y(i)&&"cause"in i&&We(t,"cause",i.cause)},Ht={},Qt=wellKnownSymbol("iterator"),Kt=Array.prototype,isArrayIteratorMethod=function(t){return void 0!==t&&(Ht.Array===t||Kt[Qt]===t)},zt={};zt[wellKnownSymbol("toStringTag")]="z";var Jt="[object z]"===String(zt),Xt=wellKnownSymbol("toStringTag"),Zt=Object,er="Arguments"==classofRaw(function(){return arguments}()),tr=Jt?classofRaw:function(t){var i,u,h;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(u=function(t,i){try{return t[i]}catch(t){}}(i=Zt(t),Xt))?u:er?classofRaw(i):"Object"==(h=classofRaw(i))&&isCallable(i.callee)?"Arguments":h},rr=wellKnownSymbol("iterator"),getIteratorMethod$5=function(t){if(!isNullOrUndefined(t))return getMethod(t,rr)||getMethod(t,"@@iterator")||Ht[tr(t)]},nr=TypeError,getIterator=function(t,i){var u=arguments.length<2?getIteratorMethod$5(t):i;if(aCallable(u))return anObject(x(u,t));throw nr(tryToString(t)+" is not iterable")},iteratorClose=function(t,i,u){var h,m;anObject(t);try{if(!(h=getMethod(t,"return"))){if("throw"===i)throw u;return u}h=x(h,t)}catch(t){m=!0,h=t}if("throw"===i)throw u;if(m)throw h;return anObject(h),u},ar=TypeError,Result=function(t,i){this.stopped=t,this.result=i},or=Result.prototype,iterate=function(t,i,u){var h,m,v,E,I,M,S,T=u&&u.that,C=!(!u||!u.AS_ENTRIES),R=!(!u||!u.IS_RECORD),A=!(!u||!u.IS_ITERATOR),N=!(!u||!u.INTERRUPTED),O=functionBindContext(i,T),stop=function(t){return h&&iteratorClose(h,"normal",t),new Result(!0,t)},callFn=function(t){return C?(anObject(t),N?O(t[0],t[1],stop):O(t[0],t[1])):N?O(t,stop):O(t)};if(R)h=t.iterator;else if(A)h=t;else{if(!(m=getIteratorMethod$5(t)))throw ar(tryToString(t)+" is not iterable");if(isArrayIteratorMethod(m)){for(v=0,E=lengthOfArrayLike(t);E>v;v++)if((I=callFn(t[v]))&&$(or,I))return I;return new Result(!1)}h=getIterator(t,m)}for(M=R?t.next:h.next;!(S=x(M,h)).done;){try{I=callFn(S.value)}catch(t){iteratorClose(h,"throw",t)}if("object"==typeof I&&I&&$(or,I))return I}return new Result(!1)},ir=String,toString=function(t){if("Symbol"===tr(t))throw TypeError("Cannot convert a Symbol value to a string");return ir(t)},normalizeStringArgument=function(t,i){return void 0===t?arguments.length<2?"":i:toString(t)},sr=!fails((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",createPropertyDescriptor(1,7)),7!==t.stack)})),cr=wellKnownSymbol("toStringTag"),lr=Error,ur=[].push,dr=function AggregateError(t,i){var u,h=arguments.length>2?arguments[2]:void 0,m=$(pr,this);ft?u=ft(lr(),m?qt(this):pr):(u=m?this:ut(pr),We(u,cr,"Error")),void 0!==i&&We(u,"message",normalizeStringArgument(i)),sr&&We(u,"stack",errorStackClear(u.stack,1)),installErrorCause(u,h);var v=[];return iterate(t,ur,{that:v}),We(u,"errors",v),u};ft?ft(dr,lr):function(t,i,u){for(var h=Ft(i),m=Ye.f,v=Re.f,E=0;E<h.length;E++){var I=h[E];he(t,I)||u&&he(u,I)||m(t,I,v(i,I))}}(dr,lr,{name:!0});var pr=dr.prototype=ut(lr.prototype,{constructor:createPropertyDescriptor(1,dr),message:createPropertyDescriptor(1,""),name:createPropertyDescriptor(1,"AggregateError")});_export({global:!0,constructor:!0,arity:2},{AggregateError:dr});var hr,mr,fr,gr=m.WeakMap,vr=isCallable(gr)&&/native code/.test(String(gr)),_r="Object already initialized",yr=m.TypeError,Er=m.WeakMap;if(vr||le.state){var Ir=le.state||(le.state=new Er),Mr=N(Ir.get),Sr=N(Ir.has),Tr=N(Ir.set);hr=function(t,i){if(Sr(Ir,t))throw yr(_r);return i.facade=t,Tr(Ir,t,i),i},mr=function(t){return Mr(Ir,t)||{}},fr=function(t){return Sr(Ir,t)}}else{var Cr=sharedKey("state");et[Cr]=!0,hr=function(t,i){if(he(t,Cr))throw yr(_r);return i.facade=t,We(t,Cr,i),i},mr=function(t){return he(t,Cr)?t[Cr]:{}},fr=function(t){return he(t,Cr)}}var br,Rr,Ar,Nr={set:hr,get:mr,has:fr,enforce:function(t){return fr(t)?mr(t):hr(t,{})},getterFor:function(t){return function(i){var u;if(!Y(i)||(u=mr(i)).type!==t)throw yr("Incompatible receiver, "+t+" required");return u}}},Or=Function.prototype,wr=O&&Object.getOwnPropertyDescriptor,xr=he(Or,"name"),kr={EXISTS:xr,PROPER:xr&&"something"===function something(){}.name,CONFIGURABLE:xr&&(!O||O&&wr(Or,"name").configurable)},defineBuiltIn=function(t,i,u,h){return h&&h.enumerable?t[i]=u:We(t,i,u),t},Pr=wellKnownSymbol("iterator"),Lr=!1;[].keys&&("next"in(Ar=[].keys())?(Rr=qt(qt(Ar)))!==Object.prototype&&(br=Rr):Lr=!0);var Dr=!Y(br)||fails((function(){var t={};return br[Pr].call(t)!==t}));br=Dr?{}:ut(br),isCallable(br[Pr])||defineBuiltIn(br,Pr,(function(){return this}));var qr={IteratorPrototype:br,BUGGY_SAFARI_ITERATORS:Lr},Vr=Jt?{}.toString:function toString(){return"[object "+tr(this)+"]"},Ur=Ye.f,Gr=wellKnownSymbol("toStringTag"),setToStringTag=function(t,i,u,h){if(t){var m=u?t:t.prototype;he(m,Gr)||Ur(m,Gr,{configurable:!0,value:i}),h&&!Jt&&We(m,"toString",Vr)}},Fr=qr.IteratorPrototype,returnThis$1=function(){return this},Br=kr.PROPER,jr=qr.BUGGY_SAFARI_ITERATORS,Yr=wellKnownSymbol("iterator"),Wr="keys",$r="values",Hr="entries",returnThis=function(){return this},iteratorDefine=function(t,i,u,h,m,v,E){!function(t,i,u,h){var m=i+" Iterator";t.prototype=ut(Fr,{next:createPropertyDescriptor(+!h,u)}),setToStringTag(t,m,!1,!0),Ht[m]=returnThis$1}(u,i,h);var I,M,S,getIterationMethod=function(t){if(t===m&&N)return N;if(!jr&&t in R)return R[t];switch(t){case Wr:return function keys(){return new u(this,t)};case $r:return function values(){return new u(this,t)};case Hr:return function entries(){return new u(this,t)}}return function(){return new u(this)}},T=i+" Iterator",C=!1,R=t.prototype,A=R[Yr]||R["@@iterator"]||m&&R[m],N=!jr&&A||getIterationMethod(m),O="Array"==i&&R.entries||A;if(O&&(I=qt(O.call(new t)))!==Object.prototype&&I.next&&(setToStringTag(I,T,!0,!0),Ht[T]=returnThis),Br&&m==$r&&A&&A.name!==$r&&(C=!0,N=function values(){return x(A,this)}),m)if(M={values:getIterationMethod($r),keys:v?N:getIterationMethod(Wr),entries:getIterationMethod(Hr)},E)for(S in M)(jr||C||!(S in R))&&defineBuiltIn(R,S,M[S]);else _export({target:i,proto:!0,forced:jr||C},M);return E&&R[Yr]!==N&&defineBuiltIn(R,Yr,N,{name:m}),Ht[i]=N,M};Ye.f;var Qr="Array Iterator",Kr=Nr.set,zr=Nr.getterFor(Qr);iteratorDefine(Array,"Array",(function(t,i){Kr(this,{type:Qr,target:toIndexedObject(t),index:0,kind:i})}),(function(){var t=zr(this),i=t.target,u=t.kind,h=t.index++;return!i||h>=i.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==u?{value:h,done:!1}:"values"==u?{value:i[h],done:!1}:{value:[h,i[h]],done:!1}}),"values"),Ht.Arguments=Ht.Array;var Jr="process"==classofRaw(m.process),Xr=wellKnownSymbol("species"),setSpecies=function(t){var i=getBuiltIn(t),u=Ye.f;O&&i&&!i[Xr]&&u(i,Xr,{configurable:!0,get:function(){return this}})},Zr=TypeError,anInstance=function(t,i){if($(i,t))return t;throw Zr("Incorrect invocation")},en=N(Function.toString);isCallable(le.inspectSource)||(le.inspectSource=function(t){return en(t)});var tn=le.inspectSource,noop=function(){},rn=[],nn=getBuiltIn("Reflect","construct"),an=/^\s*(?:class|function)\b/,sn=N(an.exec),cn=!an.exec(noop),ln=function isConstructor(t){if(!isCallable(t))return!1;try{return nn(noop,rn,t),!0}catch(t){return!1}},un=function isConstructor(t){if(!isCallable(t))return!1;switch(tr(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return cn||!!sn(an,tn(t))}catch(t){return!0}};un.sham=!0;var dn,pn,hn,mn,fn=!nn||fails((function(){var t;return ln(ln.call)||!ln(Object)||!ln((function(){t=!0}))||t}))?un:ln,gn=TypeError,aConstructor=function(t){if(fn(t))return t;throw gn(tryToString(t)+" is not a constructor")},vn=wellKnownSymbol("species"),speciesConstructor=function(t,i){var u,h=anObject(t).constructor;return void 0===h||isNullOrUndefined(u=anObject(h)[vn])?i:aConstructor(u)},_n=TypeError,validateArgumentsLength=function(t,i){if(t<i)throw _n("Not enough arguments");return t},yn=/(?:ipad|iphone|ipod).*applewebkit/i.test(H),En=m.setImmediate,In=m.clearImmediate,Mn=m.process,Sn=m.Dispatch,Tn=m.Function,Cn=m.MessageChannel,bn=m.String,Rn=0,An={},Nn="onreadystatechange";try{dn=m.location}catch(t){}var run=function(t){if(he(An,t)){var i=An[t];delete An[t],i()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){m.postMessage(bn(t),dn.protocol+"//"+dn.host)};En&&In||(En=function setImmediate(t){validateArgumentsLength(arguments.length,1);var i=isCallable(t)?t:Tn(t),u=vt(arguments,1);return An[++Rn]=function(){S(i,void 0,u)},pn(Rn),Rn},In=function clearImmediate(t){delete An[t]},Jr?pn=function(t){Mn.nextTick(runner(t))}:Sn&&Sn.now?pn=function(t){Sn.now(runner(t))}:Cn&&!yn?(mn=(hn=new Cn).port2,hn.port1.onmessage=listener,pn=functionBindContext(mn.postMessage,mn)):m.addEventListener&&isCallable(m.postMessage)&&!m.importScripts&&dn&&"file:"!==dn.protocol&&!fails(post)?(pn=post,m.addEventListener("message",listener,!1)):pn=Nn in documentCreateElement("script")?function(t){st.appendChild(documentCreateElement("script")).onreadystatechange=function(){st.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)});var On,wn,xn,kn,Pn,Ln,Dn,qn,Vn={set:En,clear:In},Un=/ipad|iphone|ipod/i.test(H)&&void 0!==m.Pebble,Gn=/web0s(?!.*chrome)/i.test(H),Fn=Re.f,Bn=Vn.set,jn=m.MutationObserver||m.WebKitMutationObserver,Yn=m.document,Wn=m.process,$n=m.Promise,Hn=Fn(m,"queueMicrotask"),Qn=Hn&&Hn.value;Qn||(On=function(){var t,i;for(Jr&&(t=Wn.domain)&&t.exit();wn;){i=wn.fn,wn=wn.next;try{i()}catch(t){throw wn?kn():xn=void 0,t}}xn=void 0,t&&t.enter()},yn||Jr||Gn||!jn||!Yn?!Un&&$n&&$n.resolve?((Dn=$n.resolve(void 0)).constructor=$n,qn=functionBindContext(Dn.then,Dn),kn=function(){qn(On)}):Jr?kn=function(){Wn.nextTick(On)}:(Bn=functionBindContext(Bn,m),kn=function(){Bn(On)}):(Pn=!0,Ln=Yn.createTextNode(""),new jn(On).observe(Ln,{characterData:!0}),kn=function(){Ln.data=Pn=!Pn}));var Kn=Qn||function(t){var i={fn:t,next:void 0};xn&&(xn.next=i),wn||(wn=i,kn()),xn=i},perform=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},Queue=function(){this.head=null,this.tail=null};Queue.prototype={add:function(t){var i={item:t,next:null};this.head?this.tail.next=i:this.head=i,this.tail=i},get:function(){var t=this.head;if(t)return this.head=t.next,this.tail===t&&(this.tail=null),t.item}};var zn,Jn,Xn=Queue,Zn=m.Promise,ea="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,ta=!ea&&!Jr&&"object"==typeof window&&"object"==typeof document,ra=Zn&&Zn.prototype,na=wellKnownSymbol("species"),aa=!1,oa=isCallable(m.PromiseRejectionEvent),ia=ke("Promise",(function(){var t=tn(Zn),i=t!==String(Zn);if(!i&&66===Z)return!0;if(!ra.catch||!ra.finally)return!0;if(!Z||Z<51||!/native code/.test(t)){var u=new Zn((function(t){t(1)})),FakePromise=function(t){t((function(){}),(function(){}))};if((u.constructor={})[na]=FakePromise,!(aa=u.then((function(){}))instanceof FakePromise))return!0}return!i&&(ta||ea)&&!oa})),sa={CONSTRUCTOR:ia,REJECTION_EVENT:oa,SUBCLASSING:aa},ca=TypeError,PromiseCapability=function(t){var i,u;this.promise=new t((function(t,h){if(void 0!==i||void 0!==u)throw ca("Bad Promise constructor");i=t,u=h})),this.resolve=aCallable(i),this.reject=aCallable(u)},la={f:function(t){return new PromiseCapability(t)}},ua=Vn.set,da="Promise",pa=sa.CONSTRUCTOR,ha=sa.REJECTION_EVENT,ma=Nr.getterFor(da),fa=Nr.set,ga=Zn&&Zn.prototype,va=Zn,_a=ga,ya=m.TypeError,Ea=m.document,Ia=m.process,Ma=la.f,Sa=Ma,Ta=!!(Ea&&Ea.createEvent&&m.dispatchEvent),Ca="unhandledrejection",isThenable=function(t){var i;return!(!Y(t)||!isCallable(i=t.then))&&i},callReaction=function(t,i){var u,h,m,v=i.value,E=1==i.state,I=E?t.ok:t.fail,M=t.resolve,S=t.reject,T=t.domain;try{I?(E||(2===i.rejection&&onHandleUnhandled(i),i.rejection=1),!0===I?u=v:(T&&T.enter(),u=I(v),T&&(T.exit(),m=!0)),u===t.promise?S(ya("Promise-chain cycle")):(h=isThenable(u))?x(h,u,M,S):M(u)):S(v)}catch(t){T&&!m&&T.exit(),S(t)}},notify=function(t,i){t.notified||(t.notified=!0,Kn((function(){for(var u,h=t.reactions;u=h.get();)callReaction(u,t);t.notified=!1,i&&!t.rejection&&onUnhandled(t)})))},dispatchEvent=function(t,i,u){var h,v;Ta?((h=Ea.createEvent("Event")).promise=i,h.reason=u,h.initEvent(t,!1,!0),m.dispatchEvent(h)):h={promise:i,reason:u},!ha&&(v=m["on"+t])?v(h):t===Ca&&function(t,i){var u=m.console;u&&u.error&&(1==arguments.length?u.error(t):u.error(t,i))}("Unhandled promise rejection",u)},onUnhandled=function(t){x(ua,m,(function(){var i,u=t.facade,h=t.value;if(isUnhandled(t)&&(i=perform((function(){Jr?Ia.emit("unhandledRejection",h,u):dispatchEvent(Ca,u,h)})),t.rejection=Jr||isUnhandled(t)?2:1,i.error))throw i.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){x(ua,m,(function(){var i=t.facade;Jr?Ia.emit("rejectionHandled",i):dispatchEvent("rejectionhandled",i,t.value)}))},bind=function(t,i,u){return function(h){t(i,h,u)}},internalReject=function(t,i,u){t.done||(t.done=!0,u&&(t=u),t.value=i,t.state=2,notify(t,!0))},internalResolve=function(t,i,u){if(!t.done){t.done=!0,u&&(t=u);try{if(t.facade===i)throw ya("Promise can't be resolved itself");var h=isThenable(i);h?Kn((function(){var u={done:!1};try{x(h,i,bind(internalResolve,u,t),bind(internalReject,u,t))}catch(i){internalReject(u,i,t)}})):(t.value=i,t.state=1,notify(t,!1))}catch(i){internalReject({done:!1},i,t)}}};pa&&(_a=(va=function Promise(t){anInstance(this,_a),aCallable(t),x(zn,this);var i=ma(this);try{t(bind(internalResolve,i),bind(internalReject,i))}catch(t){internalReject(i,t)}}).prototype,(zn=function Promise(t){fa(this,{type:da,done:!1,notified:!1,parent:!1,reactions:new Xn,rejection:!1,state:0,value:void 0})}).prototype=defineBuiltIn(_a,"then",(function then(t,i){var u=ma(this),h=Ma(speciesConstructor(this,va));return u.parent=!0,h.ok=!isCallable(t)||t,h.fail=isCallable(i)&&i,h.domain=Jr?Ia.domain:void 0,0==u.state?u.reactions.add(h):Kn((function(){callReaction(h,u)})),h.promise})),Jn=function(){var t=new zn,i=ma(t);this.promise=t,this.resolve=bind(internalResolve,i),this.reject=bind(internalReject,i)},la.f=Ma=function(t){return t===va||undefined===t?new Jn(t):Sa(t)}),_export({global:!0,constructor:!0,wrap:!0,forced:pa},{Promise:va}),setToStringTag(va,da,!1,!0),setSpecies(da);var ba=wellKnownSymbol("iterator"),Ra=!1;try{var Aa=0,Na={next:function(){return{done:!!Aa++}},return:function(){Ra=!0}};Na[ba]=function(){return this},Array.from(Na,(function(){throw 2}))}catch(t){}var checkCorrectnessOfIteration=function(t,i){if(!i&&!Ra)return!1;var u=!1;try{var h={};h[ba]=function(){return{next:function(){return{done:u=!0}}}},t(h)}catch(t){}return u},Oa=sa.CONSTRUCTOR||!checkCorrectnessOfIteration((function(t){Zn.all(t).then(void 0,(function(){}))}));_export({target:"Promise",stat:!0,forced:Oa},{all:function all(t){var i=this,u=la.f(i),h=u.resolve,m=u.reject,v=perform((function(){var u=aCallable(i.resolve),v=[],E=0,I=1;iterate(t,(function(t){var M=E++,S=!1;I++,x(u,i,t).then((function(t){S||(S=!0,v[M]=t,--I||h(v))}),m)})),--I||h(v)}));return v.error&&m(v.value),u.promise}});var wa=sa.CONSTRUCTOR;Zn&&Zn.prototype,_export({target:"Promise",proto:!0,forced:wa,real:!0},{catch:function(t){return this.then(void 0,t)}}),_export({target:"Promise",stat:!0,forced:Oa},{race:function race(t){var i=this,u=la.f(i),h=u.reject,m=perform((function(){var m=aCallable(i.resolve);iterate(t,(function(t){x(m,i,t).then(u.resolve,h)}))}));return m.error&&h(m.value),u.promise}}),_export({target:"Promise",stat:!0,forced:sa.CONSTRUCTOR},{reject:function reject(t){var i=la.f(this);return x(i.reject,void 0,t),i.promise}});var promiseResolve=function(t,i){if(anObject(t),Y(i)&&i.constructor===t)return i;var u=la.f(t);return(0,u.resolve)(i),u.promise},xa=sa.CONSTRUCTOR,ka=getBuiltIn("Promise"),Pa=!xa;_export({target:"Promise",stat:!0,forced:!0},{resolve:function resolve(t){return promiseResolve(Pa&&this===ka?Zn:this,t)}}),_export({target:"Promise",stat:!0},{allSettled:function allSettled(t){var i=this,u=la.f(i),h=u.resolve,m=u.reject,v=perform((function(){var u=aCallable(i.resolve),m=[],v=0,E=1;iterate(t,(function(t){var I=v++,M=!1;E++,x(u,i,t).then((function(t){M||(M=!0,m[I]={status:"fulfilled",value:t},--E||h(m))}),(function(t){M||(M=!0,m[I]={status:"rejected",reason:t},--E||h(m))}))})),--E||h(m)}));return v.error&&m(v.value),u.promise}});var La="No one promise resolved";_export({target:"Promise",stat:!0},{any:function any(t){var i=this,u=getBuiltIn("AggregateError"),h=la.f(i),m=h.resolve,v=h.reject,E=perform((function(){var h=aCallable(i.resolve),E=[],I=0,M=1,S=!1;iterate(t,(function(t){var T=I++,C=!1;M++,x(h,i,t).then((function(t){C||S||(S=!0,m(t))}),(function(t){C||S||(C=!0,E[T]=t,--M||v(new u(E,La)))}))})),--M||v(new u(E,La))}));return E.error&&v(E.value),h.promise}});var Da=Zn&&Zn.prototype,qa=!!Zn&&fails((function(){Da.finally.call({then:function(){}},(function(){}))}));_export({target:"Promise",proto:!0,real:!0,forced:qa},{finally:function(t){var i=speciesConstructor(this,getBuiltIn("Promise")),u=isCallable(t);return this.then(u?function(u){return promiseResolve(i,t()).then((function(){return u}))}:t,u?function(u){return promiseResolve(i,t()).then((function(){throw u}))}:t)}});var Va=N("".charAt),Ua=N("".charCodeAt),Ga=N("".slice),createMethod$3=function(t){return function(i,u){var h,m,v=toString(requireObjectCoercible(i)),E=toIntegerOrInfinity(u),I=v.length;return E<0||E>=I?t?"":void 0:(h=Ua(v,E))<55296||h>56319||E+1===I||(m=Ua(v,E+1))<56320||m>57343?t?Va(v,E):h:t?Ga(v,E,E+2):m-56320+(h-55296<<10)+65536}},Fa={codeAt:createMethod$3(!1),charAt:createMethod$3(!0)}.charAt,Ba="String Iterator",ja=Nr.set,Ya=Nr.getterFor(Ba);iteratorDefine(String,"String",(function(t){ja(this,{type:Ba,string:toString(t),index:0})}),(function next(){var t,i=Ya(this),u=i.string,h=i.index;return h>=u.length?{value:void 0,done:!0}:(t=Fa(u,h),i.index+=t.length,{value:t,done:!1})}));var Wa=W.Promise,$a=wellKnownSymbol("toStringTag");for(var Ha in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var Qa=m[Ha],Ka=Qa&&Qa.prototype;Ka&&tr(Ka)!==$a&&We(Ka,$a,Ha),Ht[Ha]=Ht.Array}var za=Wa;_export({target:"Promise",stat:!0,forced:!0},{try:function(t){var i=la.f(this),u=perform(t);return(u.error?i.reject:i.resolve)(u.value),i.promise}});var Ja=za,Xa=Date,Za=N(Xa.prototype.getTime);_export({target:"Date",stat:!0},{now:function now(){return Za(new Xa)}});var eo=W.Date.now,to=Array.isArray||function isArray(t){return"Array"==classofRaw(t)},ro=TypeError,doesNotExceedSafeInteger=function(t){if(t>9007199254740991)throw ro("Maximum allowed index exceeded");return t},createProperty=function(t,i,u){var h=toPropertyKey(i);h in t?Ye.f(t,h,createPropertyDescriptor(0,u)):t[h]=u},no=wellKnownSymbol("species"),ao=Array,arraySpeciesCreate=function(t,i){return new(function(t){var i;return to(t)&&(i=t.constructor,(fn(i)&&(i===ao||to(i.prototype))||Y(i)&&null===(i=i[no]))&&(i=void 0)),void 0===i?ao:i}(t))(0===i?0:i)},oo=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(t){return Z>=51||!fails((function(){var i=[];return(i.constructor={})[oo]=function(){return{foo:1}},1!==i[t](Boolean).foo}))},io=wellKnownSymbol("isConcatSpreadable"),so=Z>=51||!fails((function(){var t=[];return t[io]=!1,t.concat()[0]!==t})),co=arrayMethodHasSpeciesSupport("concat"),isConcatSpreadable=function(t){if(!Y(t))return!1;var i=t[io];return void 0!==i?!!i:to(t)};_export({target:"Array",proto:!0,arity:1,forced:!so||!co},{concat:function concat(t){var i,u,h,m,v,E=toObject(this),I=arraySpeciesCreate(E,0),M=0;for(i=-1,h=arguments.length;i<h;i++)if(isConcatSpreadable(v=-1===i?E:arguments[i]))for(m=lengthOfArrayLike(v),doesNotExceedSafeInteger(M+m),u=0;u<m;u++,M++)u in v&&createProperty(I,M,v[u]);else doesNotExceedSafeInteger(M+1),createProperty(I,M++,v);return I.length=M,I}});var lo=entryVirtual("Array").concat,uo=Array.prototype,concat=function(t){var i=t.concat;return t===uo||$(uo,t)&&i===uo.concat?lo:i},po=/MSIE .\./.test(H),ho=m.Function,wrap$1=function(t){return po?function(i,u){var h=validateArgumentsLength(arguments.length,1)>2,m=isCallable(i)?i:ho(i),v=h?vt(arguments,2):void 0;return t(h?function(){S(m,this,v)}:m,u)}:t},mo={setTimeout:wrap$1(m.setTimeout),setInterval:wrap$1(m.setInterval)},fo=mo.setInterval;_export({global:!0,bind:!0,forced:m.setInterval!==fo},{setInterval:fo});var go=mo.setTimeout;_export({global:!0,bind:!0,forced:m.setTimeout!==go},{setTimeout:go});var vo=W.setTimeout,_o=createCommonjsModule((function(t){var i=Object.prototype.hasOwnProperty,u="~";function Events(){}function EE(t,i,u){this.fn=t,this.context=i,this.once=u||!1}function addListener(t,i,h,m,v){if("function"!=typeof h)throw new TypeError("The listener must be a function");var E=new EE(h,m||t,v),I=u?u+i:i;return t._events[I]?t._events[I].fn?t._events[I]=[t._events[I],E]:t._events[I].push(E):(t._events[I]=E,t._eventsCount++),t}function clearEvent(t,i){0==--t._eventsCount?t._events=new Events:delete t._events[i]}function EventEmitter(){this._events=new Events,this._eventsCount=0}Object.create&&(Events.prototype=Object.create(null),(new Events).__proto__||(u=!1)),EventEmitter.prototype.eventNames=function eventNames(){var t,h,m=[];if(0===this._eventsCount)return m;for(h in t=this._events)i.call(t,h)&&m.push(u?h.slice(1):h);return Object.getOwnPropertySymbols?m.concat(Object.getOwnPropertySymbols(t)):m},EventEmitter.prototype.listeners=function listeners(t){var i=u?u+t:t,h=this._events[i];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,v=h.length,E=new Array(v);m<v;m++)E[m]=h[m].fn;return E},EventEmitter.prototype.listenerCount=function listenerCount(t){var i=u?u+t:t,h=this._events[i];return h?h.fn?1:h.length:0},EventEmitter.prototype.emit=function emit(t,i,h,m,v,E){var I=u?u+t:t;if(!this._events[I])return!1;var M,S,T=this._events[I],C=arguments.length;if(T.fn){switch(T.once&&this.removeListener(t,T.fn,void 0,!0),C){case 1:return T.fn.call(T.context),!0;case 2:return T.fn.call(T.context,i),!0;case 3:return T.fn.call(T.context,i,h),!0;case 4:return T.fn.call(T.context,i,h,m),!0;case 5:return T.fn.call(T.context,i,h,m,v),!0;case 6:return T.fn.call(T.context,i,h,m,v,E),!0}for(S=1,M=new Array(C-1);S<C;S++)M[S-1]=arguments[S];T.fn.apply(T.context,M)}else{var R,A=T.length;for(S=0;S<A;S++)switch(T[S].once&&this.removeListener(t,T[S].fn,void 0,!0),C){case 1:T[S].fn.call(T[S].context);break;case 2:T[S].fn.call(T[S].context,i);break;case 3:T[S].fn.call(T[S].context,i,h);break;case 4:T[S].fn.call(T[S].context,i,h,m);break;default:if(!M)for(R=1,M=new Array(C-1);R<C;R++)M[R-1]=arguments[R];T[S].fn.apply(T[S].context,M)}}return!0},EventEmitter.prototype.on=function on(t,i,u){return addListener(this,t,i,u,!1)},EventEmitter.prototype.once=function once(t,i,u){return addListener(this,t,i,u,!0)},EventEmitter.prototype.removeListener=function removeListener(t,i,h,m){var v=u?u+t:t;if(!this._events[v])return this;if(!i)return clearEvent(this,v),this;var E=this._events[v];if(E.fn)E.fn!==i||m&&!E.once||h&&E.context!==h||clearEvent(this,v);else{for(var I=0,M=[],S=E.length;I<S;I++)(E[I].fn!==i||m&&!E[I].once||h&&E[I].context!==h)&&M.push(E[I]);M.length?this._events[v]=1===M.length?M[0]:M:clearEvent(this,v)}return this},EventEmitter.prototype.removeAllListeners=function removeAllListeners(t){var i;return t?(i=u?u+t:t,this._events[i]&&clearEvent(this,i)):(this._events=new Events,this._eventsCount=0),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prefixed=u,EventEmitter.EventEmitter=EventEmitter,t.exports=EventEmitter}));_export({global:!0},{globalThis:m});var yo=Array,Eo=Math.max,arraySliceSimple=function(t,i,u){for(var h=lengthOfArrayLike(t),m=toAbsoluteIndex(i,h),v=toAbsoluteIndex(void 0===u?h:u,h),E=yo(Eo(v-m,0)),I=0;m<v;m++,I++)createProperty(E,I,t[m]);return E.length=I,E},Io=Ut.f,Mo="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],So={f:function getOwnPropertyNames(t){return Mo&&"Window"==classofRaw(t)?function(t){try{return Io(t)}catch(t){return arraySliceSimple(Mo)}}(t):Io(toIndexedObject(t))}},To={f:wellKnownSymbol},Co=Ye.f,wellKnownSymbolDefine=function(t){var i=W.Symbol||(W.Symbol={});he(i,t)||Co(i,t,{value:To.f(t)})},symbolDefineToPrimitive=function(){var t=getBuiltIn("Symbol"),i=t&&t.prototype,u=i&&i.valueOf,h=wellKnownSymbol("toPrimitive");i&&!i[h]&&defineBuiltIn(i,h,(function(t){return x(u,this)}),{arity:1})},bo=N([].push),createMethod$2=function(t){var i=1==t,u=2==t,h=3==t,m=4==t,v=6==t,E=7==t,I=5==t||v;return function(M,S,T,C){for(var R,A,N=toObject(M),O=G(N),w=functionBindContext(S,T),x=lengthOfArrayLike(O),k=0,P=C||arraySpeciesCreate,L=i?P(M,x):u||E?P(M,0):void 0;x>k;k++)if((I||k in O)&&(A=w(R=O[k],k,N),t))if(i)L[k]=A;else if(A)switch(t){case 3:return!0;case 5:return R;case 6:return k;case 2:bo(L,R)}else switch(t){case 4:return!1;case 7:bo(L,R)}return v?-1:h||m?m:L}},Ro={forEach:createMethod$2(0),map:createMethod$2(1),filter:createMethod$2(2),some:createMethod$2(3),every:createMethod$2(4),find:createMethod$2(5),findIndex:createMethod$2(6),filterReject:createMethod$2(7)},Ao=Ro.forEach,No=sharedKey("hidden"),Oo="Symbol",wo=Nr.set,xo=Nr.getterFor(Oo),ko=Object.prototype,Po=m.Symbol,Lo=Po&&Po.prototype,Do=m.TypeError,qo=m.QObject,Vo=Re.f,Uo=Ye.f,Go=So.f,Fo=L.f,Bo=N([].push),jo=ue("symbols"),Yo=ue("op-symbols"),Wo=ue("wks"),$o=!qo||!qo.prototype||!qo.prototype.findChild,Ho=O&&fails((function(){return 7!=ut(Uo({},"a",{get:function(){return Uo(this,"a",{value:7}).a}})).a}))?function(t,i,u){var h=Vo(ko,i);h&&delete ko[i],Uo(t,i,u),h&&t!==ko&&Uo(ko,i,h)}:Uo,wrap=function(t,i){var u=jo[t]=ut(Lo);return wo(u,{type:Oo,tag:t,description:i}),O||(u.description=i),u},Qo=function defineProperty(t,i,u){t===ko&&Qo(Yo,i,u),anObject(t);var h=toPropertyKey(i);return anObject(u),he(jo,h)?(u.enumerable?(he(t,No)&&t[No][h]&&(t[No][h]=!1),u=ut(u,{enumerable:createPropertyDescriptor(0,!1)})):(he(t,No)||Uo(t,No,createPropertyDescriptor(1,{})),t[No][h]=!0),Ho(t,h,u)):Uo(t,h,u)},Ko=function defineProperties(t,i){anObject(t);var u=toIndexedObject(i),h=at(u).concat($getOwnPropertySymbols(u));return Ao(h,(function(i){O&&!x(zo,u,i)||Qo(t,i,u[i])})),t},zo=function propertyIsEnumerable(t){var i=toPropertyKey(t),u=x(Fo,this,i);return!(this===ko&&he(jo,i)&&!he(Yo,i))&&(!(u||!he(this,i)||!he(jo,i)||he(this,No)&&this[No][i])||u)},Jo=function getOwnPropertyDescriptor(t,i){var u=toIndexedObject(t),h=toPropertyKey(i);if(u!==ko||!he(jo,h)||he(Yo,h)){var m=Vo(u,h);return!m||!he(jo,h)||he(u,No)&&u[No][h]||(m.enumerable=!0),m}},Xo=function getOwnPropertyNames(t){var i=Go(toIndexedObject(t)),u=[];return Ao(i,(function(t){he(jo,t)||he(et,t)||Bo(u,t)})),u},$getOwnPropertySymbols=function(t){var i=t===ko,u=Go(i?Yo:toIndexedObject(t)),h=[];return Ao(u,(function(t){!he(jo,t)||i&&!he(ko,t)||Bo(h,jo[t])})),h};ee||(Po=function Symbol(){if($(Lo,this))throw Do("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?toString(arguments[0]):void 0,i=uid(t),setter=function(t){this===ko&&x(setter,Yo,t),he(this,No)&&he(this[No],i)&&(this[No][i]=!1),Ho(this,i,createPropertyDescriptor(1,t))};return O&&$o&&Ho(ko,i,{configurable:!0,set:setter}),wrap(i,t)},Lo=Po.prototype,defineBuiltIn(Lo,"toString",(function toString(){return xo(this).tag})),defineBuiltIn(Po,"withoutSetter",(function(t){return wrap(uid(t),t)})),L.f=zo,Ye.f=Qo,it.f=Ko,Re.f=Jo,Ut.f=So.f=Xo,Rt.f=$getOwnPropertySymbols,To.f=function(t){return wrap(wellKnownSymbol(t),t)},O&&Uo(Lo,"description",{configurable:!0,get:function description(){return xo(this).description}})),_export({global:!0,constructor:!0,wrap:!0,forced:!ee,sham:!ee},{Symbol:Po}),Ao(at(Wo),(function(t){wellKnownSymbolDefine(t)})),_export({target:Oo,stat:!0,forced:!ee},{useSetter:function(){$o=!0},useSimple:function(){$o=!1}}),_export({target:"Object",stat:!0,forced:!ee,sham:!O},{create:function create(t,i){return void 0===i?ut(t):Ko(ut(t),i)},defineProperty:Qo,defineProperties:Ko,getOwnPropertyDescriptor:Jo}),_export({target:"Object",stat:!0,forced:!ee},{getOwnPropertyNames:Xo}),symbolDefineToPrimitive(),setToStringTag(Po,Oo),et[No]=!0;var Zo=ee&&!!Symbol.for&&!!Symbol.keyFor,ei=ue("string-to-symbol-registry"),ti=ue("symbol-to-string-registry");_export({target:"Symbol",stat:!0,forced:!Zo},{for:function(t){var i=toString(t);if(he(ei,i))return ei[i];var u=getBuiltIn("Symbol")(i);return ei[i]=u,ti[u]=i,u}});var ri=ue("symbol-to-string-registry");_export({target:"Symbol",stat:!0,forced:!Zo},{keyFor:function keyFor(t){if(!ne(t))throw TypeError(tryToString(t)+" is not a symbol");if(he(ri,t))return ri[t]}});var ni=getBuiltIn("JSON","stringify"),ai=N(/./.exec),oi=N("".charAt),ii=N("".charCodeAt),si=N("".replace),ci=N(1..toString),li=/[\uD800-\uDFFF]/g,ui=/^[\uD800-\uDBFF]$/,di=/^[\uDC00-\uDFFF]$/,pi=!ee||fails((function(){var t=getBuiltIn("Symbol")();return"[null]"!=ni([t])||"{}"!=ni({a:t})||"{}"!=ni(Object(t))})),hi=fails((function(){return'"\\udf06\\ud834"'!==ni("\udf06\ud834")||'"\\udead"'!==ni("\udead")})),stringifyWithSymbolsFix=function(t,i){var u=vt(arguments),h=i;if((Y(i)||void 0!==t)&&!ne(t))return to(i)||(i=function(t,i){if(isCallable(h)&&(i=x(h,this,t,i)),!ne(i))return i}),u[1]=i,S(ni,null,u)},fixIllFormed=function(t,i,u){var h=oi(u,i-1),m=oi(u,i+1);return ai(ui,t)&&!ai(di,m)||ai(di,t)&&!ai(ui,h)?"\\u"+ci(ii(t,0),16):t};ni&&_export({target:"JSON",stat:!0,arity:3,forced:pi||hi},{stringify:function stringify(t,i,u){var h=vt(arguments),m=S(pi?stringifyWithSymbolsFix:ni,null,h);return hi&&"string"==typeof m?si(m,li,fixIllFormed):m}});var mi=!ee||fails((function(){Rt.f(1)}));_export({target:"Object",stat:!0,forced:mi},{getOwnPropertySymbols:function getOwnPropertySymbols(t){var i=Rt.f;return i?i(toObject(t)):[]}}),wellKnownSymbolDefine("asyncIterator"),wellKnownSymbolDefine("hasInstance"),wellKnownSymbolDefine("isConcatSpreadable"),wellKnownSymbolDefine("iterator"),wellKnownSymbolDefine("match"),wellKnownSymbolDefine("matchAll"),wellKnownSymbolDefine("replace"),wellKnownSymbolDefine("search"),wellKnownSymbolDefine("species"),wellKnownSymbolDefine("split"),wellKnownSymbolDefine("toPrimitive"),symbolDefineToPrimitive(),wellKnownSymbolDefine("toStringTag"),setToStringTag(getBuiltIn("Symbol"),"Symbol"),wellKnownSymbolDefine("unscopables"),setToStringTag(m.JSON,"JSON",!0);var fi=W.Symbol;wellKnownSymbolDefine("asyncDispose"),wellKnownSymbolDefine("dispose"),wellKnownSymbolDefine("matcher"),wellKnownSymbolDefine("metadataKey"),wellKnownSymbolDefine("observable"),wellKnownSymbolDefine("metadata"),wellKnownSymbolDefine("patternMatch"),wellKnownSymbolDefine("replaceAll");var gi=fi,vi=Ye.f;_export({target:"Object",stat:!0,forced:Object.defineProperty!==vi,sham:!O},{defineProperty:vi});var _i=createCommonjsModule((function(t){var i=W.Object,u=t.exports=function defineProperty(t,u,h){return i.defineProperty(t,u,h)};i.defineProperty.sham&&(u.sham=!0)})),yi=_i,Ei=fails((function(){qt(1)}));_export({target:"Object",stat:!0,forced:Ei,sham:!kt},{getPrototypeOf:function getPrototypeOf(t){return qt(toObject(t))}});var Ii=W.Object.getPrototypeOf,arrayMethodIsStrict=function(t,i){var u=[][t];return!!u&&fails((function(){u.call(null,i||function(){return 1},1)}))},Mi=Ro.forEach,Si=arrayMethodIsStrict("forEach")?[].forEach:function forEach(t){return Mi(this,t,arguments.length>1?arguments[1]:void 0)};_export({target:"Array",proto:!0,forced:[].forEach!=Si},{forEach:Si});var Ti=entryVirtual("Array").forEach,Ci=Array.prototype,bi={DOMTokenList:!0,NodeList:!0},forEach$1=function(t){var i=t.forEach;return t===Ci||$(Ci,t)&&i===Ci.forEach||he(bi,tr(t))?Ti:i},Ri=N([].reverse),Ai=[1,2];_export({target:"Array",proto:!0,forced:String(Ai)===String(Ai.reverse())},{reverse:function reverse(){return to(this)&&(this.length=this.length),Ri(this)}});var Ni=entryVirtual("Array").reverse,Oi=Array.prototype,reverse=function(t){var i=t.reverse;return t===Oi||$(Oi,t)&&i===Oi.reverse?Ni:i},wi=arrayMethodHasSpeciesSupport("slice"),xi=wellKnownSymbol("species"),ki=Array,Pi=Math.max;_export({target:"Array",proto:!0,forced:!wi},{slice:function slice(t,i){var u,h,m,v=toIndexedObject(this),E=lengthOfArrayLike(v),I=toAbsoluteIndex(t,E),M=toAbsoluteIndex(void 0===i?E:i,E);if(to(v)&&(u=v.constructor,(fn(u)&&(u===ki||to(u.prototype))||Y(u)&&null===(u=u[xi]))&&(u=void 0),u===ki||void 0===u))return vt(v,I,M);for(h=new(void 0===u?ki:u)(Pi(M-I,0)),m=0;I<M;I++,m++)I in v&&createProperty(h,m,v[I]);return h.length=m,h}});var Li=entryVirtual("Array").slice,Di=Array.prototype,slice=function(t){var i=t.slice;return t===Di||$(Di,t)&&i===Di.slice?Li:i},qi=To.f("iterator"),Vi=Ro.find,Ui="find",Gi=!0;Ui in[]&&Array(1).find((function(){Gi=!1})),_export({target:"Array",proto:!0,forced:Gi},{find:function find(t){return Vi(this,t,arguments.length>1?arguments[1]:void 0)}});var Fi=entryVirtual("Array").find,Bi=Array.prototype,find=function(t){var i=t.find;return t===Bi||$(Bi,t)&&i===Bi.find?Fi:i},ji=Ze.includes,Yi=fails((function(){return!Array(1).includes()}));_export({target:"Array",proto:!0,forced:Yi},{includes:function includes(t){return ji(this,t,arguments.length>1?arguments[1]:void 0)}});var Wi=entryVirtual("Array").includes,$i=wellKnownSymbol("match"),Hi=TypeError,notARegexp=function(t){if(function(t){var i;return Y(t)&&(void 0!==(i=t[$i])?!!i:"RegExp"==classofRaw(t))}(t))throw Hi("The method doesn't accept regular expressions");return t},Qi=wellKnownSymbol("match"),Ki=N("".indexOf);_export({target:"String",proto:!0,forced:!function(t){var i=/./;try{"/./"[t](i)}catch(u){try{return i[Qi]=!1,"/./"[t](i)}catch(t){}}return!1}("includes")},{includes:function includes(t){return!!~Ki(toString(requireObjectCoercible(this)),toString(notARegexp(t)),arguments.length>1?arguments[1]:void 0)}});var zi=entryVirtual("String").includes,Ji=Array.prototype,Xi=String.prototype,includes=function(t){var i=t.includes;return t===Ji||$(Ji,t)&&i===Ji.includes?Wi:"string"==typeof t||t===Xi||$(Xi,t)&&i===Xi.includes?zi:i},Zi=fails((function(){at(1)}));_export({target:"Object",stat:!0,forced:Zi},{keys:function keys(t){return at(toObject(t))}});var es=W.Object.keys,ts=Ro.map,rs=arrayMethodHasSpeciesSupport("map");_export({target:"Array",proto:!0,forced:!rs},{map:function map(t){return ts(this,t,arguments.length>1?arguments[1]:void 0)}});var ns=entryVirtual("Array").map,as=Array.prototype,map$6=function(t){var i=t.map;return t===as||$(as,t)&&i===as.map?ns:i},os=Ro.filter,is=arrayMethodHasSpeciesSupport("filter");_export({target:"Array",proto:!0,forced:!is},{filter:function filter(t){return os(this,t,arguments.length>1?arguments[1]:void 0)}});var ss=entryVirtual("Array").filter,cs=Array.prototype,filter=function(t){var i=t.filter;return t===cs||$(cs,t)&&i===cs.filter?ss:i},ls=createCommonjsModule((function(t,i){t.exports=function(){function _regeneratorRuntime(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},i=Object.prototype,u=i.hasOwnProperty,h="function"==typeof gi?gi:{},m=h.iterator||"@@iterator",v=h.asyncIterator||"@@asyncIterator",E=h.toStringTag||"@@toStringTag";function define(t,i,u){return yi(t,i,{value:u,enumerable:!0,configurable:!0,writable:!0}),t[i]}try{define({},"")}catch(t){define=function define(t,i,u){return t[i]=u}}function wrap(t,i,u,h){var m=i&&i.prototype instanceof Generator?i:Generator,v=pt(m.prototype),E=new Context(h||[]);return v._invoke=function(t,i,u){var h="suspendedStart";return function(m,v){if("executing"===h)throw new Error("Generator is already running");if("completed"===h){if("throw"===m)throw v;return doneResult()}for(u.method=m,u.arg=v;;){var E=u.delegate;if(E){var M=maybeInvokeDelegate(E,u);if(M){if(M===I)continue;return M}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===h)throw h="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);h="executing";var S=tryCatch(t,i,u);if("normal"===S.type){if(h=u.done?"completed":"suspendedYield",S.arg===I)continue;return{value:S.arg,done:u.done}}"throw"===S.type&&(h="completed",u.method="throw",u.arg=S.arg)}}}(t,u,E),v}function tryCatch(t,i,u){try{return{type:"normal",arg:t.call(i,u)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var I={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var M={};define(M,m,(function(){return this}));var S=Ii&&Ii(Ii(values([])));S&&S!==i&&u.call(S,m)&&(M=S);var T=GeneratorFunctionPrototype.prototype=Generator.prototype=pt(M);function defineIteratorMethods(t){var i;forEach$1(i=["next","throw","return"]).call(i,(function(i){define(t,i,(function(t){return this._invoke(i,t)}))}))}function AsyncIterator(t,i){function invoke(h,m,v,E){var I=tryCatch(t[h],t,m);if("throw"!==I.type){var M=I.arg,S=M.value;return S&&"object"==typeof S&&u.call(S,"__await")?i.resolve(S.__await).then((function(t){invoke("next",t,v,E)}),(function(t){invoke("throw",t,v,E)})):i.resolve(S).then((function(t){M.value=t,v(M)}),(function(t){return invoke("throw",t,v,E)}))}E(I.arg)}var h;this._invoke=function(t,u){function callInvokeWithMethodAndArg(){return new i((function(i,h){invoke(t,u,i,h)}))}return h=h?h.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,i){var u=t.iterator[i.method];if(void 0===u){if(i.delegate=null,"throw"===i.method){if(t.iterator.return&&(i.method="return",i.arg=void 0,maybeInvokeDelegate(t,i),"throw"===i.method))return I;i.method="throw",i.arg=new TypeError("The iterator does not provide a 'throw' method")}return I}var h=tryCatch(u,t.iterator,i.arg);if("throw"===h.type)return i.method="throw",i.arg=h.arg,i.delegate=null,I;var m=h.arg;return m?m.done?(i[t.resultName]=m.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,I):m:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,I)}function pushTryEntry(t){var i={tryLoc:t[0]};1 in t&&(i.catchLoc=t[1]),2 in t&&(i.finallyLoc=t[2],i.afterLoc=t[3]),this.tryEntries.push(i)}function resetTryEntry(t){var i=t.completion||{};i.type="normal",delete i.arg,t.completion=i}function Context(t){this.tryEntries=[{tryLoc:"root"}],forEach$1(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t){var i=t[m];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var h=-1,v=function next(){for(;++h<t.length;)if(u.call(t,h))return next.value=t[h],next.done=!1,next;return next.value=void 0,next.done=!0,next};return v.next=v}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(T,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,E,"GeneratorFunction"),t.isGeneratorFunction=function(t){var i="function"==typeof t&&t.constructor;return!!i&&(i===GeneratorFunction||"GeneratorFunction"===(i.displayName||i.name))},t.mark=function(t){return gt?gt(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,E,"GeneratorFunction")),t.prototype=pt(T),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,v,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(i,u,h,m,v){void 0===v&&(v=Ja);var E=new AsyncIterator(wrap(i,u,h,m),v);return t.isGeneratorFunction(u)?E:E.next().then((function(t){return t.done?t.value:E.next()}))},defineIteratorMethods(T),define(T,E,"Generator"),define(T,m,(function(){return this})),define(T,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var i=[];for(var u in t)i.push(u);return reverse(i).call(i),function next(){for(;i.length;){var u=i.pop();if(u in t)return next.value=u,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){var i;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,forEach$1(i=this.tryEntries).call(i,resetTryEntry),!t)for(var h in this)"t"===h.charAt(0)&&u.call(this,h)&&!isNaN(+slice(h).call(h,1))&&(this[h]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var i=this;function handle(u,h){return v.type="throw",v.arg=t,i.next=u,h&&(i.method="next",i.arg=void 0),!!h}for(var h=this.tryEntries.length-1;h>=0;--h){var m=this.tryEntries[h],v=m.completion;if("root"===m.tryLoc)return handle("end");if(m.tryLoc<=this.prev){var E=u.call(m,"catchLoc"),I=u.call(m,"finallyLoc");if(E&&I){if(this.prev<m.catchLoc)return handle(m.catchLoc,!0);if(this.prev<m.finallyLoc)return handle(m.finallyLoc)}else if(E){if(this.prev<m.catchLoc)return handle(m.catchLoc,!0)}else{if(!I)throw new Error("try statement without catch or finally");if(this.prev<m.finallyLoc)return handle(m.finallyLoc)}}}},abrupt:function abrupt(t,i){for(var h=this.tryEntries.length-1;h>=0;--h){var m=this.tryEntries[h];if(m.tryLoc<=this.prev&&u.call(m,"finallyLoc")&&this.prev<m.finallyLoc){var v=m;break}}v&&("break"===t||"continue"===t)&&v.tryLoc<=i&&i<=v.finallyLoc&&(v=null);var E=v?v.completion:{};return E.type=t,E.arg=i,v?(this.method="next",this.next=v.finallyLoc,I):this.complete(E)},complete:function complete(t,i){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&i&&(this.next=i),I},finish:function finish(t){for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i];if(u.finallyLoc===t)return this.complete(u.completion,u.afterLoc),resetTryEntry(u),I}},catch:function _catch(t){for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i];if(u.tryLoc===t){var h=u.completion;if("throw"===h.type){var m=h.arg;resetTryEntry(u)}return m}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,i,u){return this.delegate={iterator:values(t),resultName:i,nextLoc:u},"next"===this.method&&(this.arg=void 0),I}},t}function _typeof(t){return _typeof="function"==typeof gi&&"symbol"==typeof qi?function(t){return typeof t}:function(t){return t&&"function"==typeof gi&&t.constructor===gi&&t!==gi.prototype?"symbol":typeof t},_typeof(t)}function _classCallCheck(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,i){for(var u=0;u<i.length;u++){var h=i[u];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),yi(t,h.key,h)}}function _createClass(t,i,u){return i&&_defineProperties(t.prototype,i),u&&_defineProperties(t,u),yi(t,"prototype",{writable:!1}),t}function __awaiter(t,i,u,h){function adopt(t){return t instanceof u?t:new u((function(i){i(t)}))}return new(u||(u=Ja))((function(u,m){function fulfilled(t){try{step(h.next(t))}catch(t){m(t)}}function rejected(t){try{step(h.throw(t))}catch(t){m(t)}}function step(t){t.done?u(t.value):adopt(t.value).then(fulfilled,rejected)}step((h=h.apply(t,i||[])).next())}))}var t={isDataReportEnable:!0,maxSize:100,msgListMaxSize:1e3,cacheMaxSize:1e3,maxDelay:3e5,maxInterval:3e4,minInterval:1e4,timeout:5e3,autoStart:!0,loginFailIgnoreInterval:72e5},i=12,u=8e3,h=function emptyFn(){},m=function(){function Reporter(i){_classCallCheck(this,Reporter),this.isUploadEnable=!0,this.serverAllowUpload=!1,this.initConfigLoaded=!1,this.loading=!1,this.isDestroyed=!1,this.reportConfig=t,this.configPath="dispatcher/req",this.dataReportPath="statics/report/common/form",this.traceMsgCache={},this.reqRetryCount=0,this.highPriorityMsgList=[],this.msgList=[],this.lowPriorityMsgList=[],this.cacheMsgList=[],this.lastReportTime=eo(),this.timer=null,this.endedAsyncMsgByModule={},this.lastFailLogin={},this.setConfig(i),this.reportConfig.isDataReportEnable&&this.reportConfig.autoStart&&this.initUploadConfig()}return _createClass(Reporter,[{key:"setConfig",value:function setConfig(t){var i=xt({},this.reportConfig.common,t.common);this.reportConfig=xt({},this.reportConfig,t),this.reportConfig.common=i,this.reportConfig.common.sdk_type||(this.reportConfig.common.sdk_type="im")}},{key:"reportImmediately",value:function reportImmediately(t,i){var u=this;this.reportConfig.isDataReportEnable&&this.reportConfig.request(t,xt({dataType:"json",method:"POST",timeout:this.reportConfig.timeout},i)).catch((function(t){var i,h;null===(h=null===(i=u.reportConfig)||void 0===i?void 0:i.logger)||void 0===h||h.warn("Reporter immediately upload failed",t)}))}},{key:"report",value:function report(i,u){var h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(h.priority||(h.priority=this.getEventPriority(i,u)),this.reportConfig.isDataReportEnable&&i){if("login"===i&&!1===u.succeed&&u.process_id){var m,v=u.extension&&find(m=u.extension).call(m,(function(t){return"TCP"===t.operation_type})),E=v&&v.target||"",I=u.process_id+E,M=this.lastFailLogin[I]||0;if(u.start_time-M<t.loginFailIgnoreInterval)return;this.lastFailLogin[I]=u.start_time}var S=eo();"HIGH"===h.priority?this.highPriorityMsgList.push({module:i,msg:u,createTime:S}):"NORMAL"===h.priority?this.msgList.push({module:i,msg:u,createTime:S}):"LOW"===h.priority&&this.lowPriorityMsgList.push({module:i,msg:u,createTime:S}),this.highPriorityMsgList.length>this.reportConfig.msgListMaxSize&&this.highPriorityMsgList.shift(),this.msgList.length>this.reportConfig.msgListMaxSize&&this.msgList.shift(),this.lowPriorityMsgList.length>this.reportConfig.msgListMaxSize&&this.lowPriorityMsgList.shift(),this.doReport()}}},{key:"reportTraceStart",value:function reportTraceStart(t,i){if(this.reportConfig.isDataReportEnable&&t&&!this.traceMsgCache[t]){var u=xt(xt({start_time:eo()},i),{extension:[]});this.traceMsgCache[t]=u}}},{key:"reportTraceUpdate",value:function reportTraceUpdate(t){}},{key:"reportTraceUpdateV2",value:function reportTraceUpdateV2(t,i,u){var h,m=this;if(this.reportConfig.isDataReportEnable&&this.traceMsgCache[t]){var v=this.traceMsgCache[t].extension,E=v.length,I=(new Date).getTime();0===E?i.duration=I-this.traceMsgCache[t].start_time:v[E-1].end_time?i.duration=I-v[E-1].end_time:i.duration=I-this.traceMsgCache[t].start_time,v.push(xt({end_time:I},i));var M=v.length-1;(null==u?void 0:u.asyncParams)&&((h=this.traceMsgCache[t]).asyncPromiseArray||(h.asyncPromiseArray=[]),this.traceMsgCache[t].asyncPromiseArray.push(u.asyncParams.then((function(i){m.traceMsgCache[t]&&m.traceMsgCache[t].extension[M]&&xt(m.traceMsgCache[t].extension[M],i)}))))}}},{key:"reportTraceEnd",value:function reportTraceEnd(t){var i,u,h=this,m=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.reportConfig.isDataReportEnable&&this.traceMsgCache[t])if("nos"!==t||!1===m){"boolean"==typeof m?this.traceMsgCache[t].succeed=!!m:this.traceMsgCache[t].state=m,this.traceMsgCache[t].duration=eo()-this.traceMsgCache[t].start_time,forEach$1(i=this.traceMsgCache[t].extension).call(i,(function(t){delete t.end_time}));var v=this.traceMsgCache[t];if(this.traceMsgCache[t]=null,v.asyncPromiseArray){(u=this.endedAsyncMsgByModule)[t]||(u[t]=[]),this.endedAsyncMsgByModule[t].push(v);var E=function asyncCallback(){var i;h.endedAsyncMsgByModule[t]&&includes(i=h.endedAsyncMsgByModule[t]).call(i,v)&&(delete v.asyncPromiseArray,h.report(t,v,{priority:h.getEventPriority(t,v)}))};Ja.all(v.asyncPromiseArray).then(E).catch(E)}else this.report(t,v,{priority:this.getEventPriority(t,v)})}else this.traceMsgCache[t]=null}},{key:"getEventPriority",value:function getEventPriority(t,i){if("exceptions"===t){if(0===i.action)return"HIGH";if(2===i.action)return"HIGH";if(1===i.action&&0!==i.exception_service)return"HIGH"}else{if("msgReceive"===t)return"LOW";if("nim_api_trace"===t)return"LOW"}return"NORMAL"}},{key:"reportTraceCancel",value:function reportTraceCancel(t){this.reportConfig.isDataReportEnable&&(this.endedAsyncMsgByModule[t]=[],this.traceMsgCache[t]=null)}},{key:"pause",value:function pause(){this.reportConfig.isDataReportEnable&&(this.isUploadEnable=!1)}},{key:"restore",value:function restore(){this.reportConfig.isDataReportEnable&&(this.isUploadEnable=!0,this.initConfigLoaded||this.initUploadConfig())}},{key:"destroy",value:function destroy(){var t,i=this;this.reportConfig.isDataReportEnable&&(forEach$1(t=es(this.traceMsgCache)).call(t,(function(t){i.reportTraceEnd(t,1)})),null!==this.timer&&clearTimeout(this.timer),this.setConfig=h,this.report=h,this.reportTraceStart=h,this.reportTraceUpdate=h,this.reportTraceEnd=h,this.pause=h,this.restore=h,this.destroy=h,this.reqRetryCount=0,this.cacheMsgList=[],this.traceMsgCache={},this.lowPriorityMsgList=[],this.msgList=[],this.highPriorityMsgList=[],this.reportConfig={},this.isDestroyed=!0)}},{key:"initUploadConfig",value:function initUploadConfig(){var t,h;return __awaiter(this,void 0,void 0,_regeneratorRuntime().mark((function _callee(){var m,v,E,I,M,S=this;return _regeneratorRuntime().wrap((function _callee$(T){for(var C;;)switch(T.prev=T.next){case 0:if(!this.loading){T.next=2;break}return T.abrupt("return");case 2:this.loading=!0,m=this.reportConfig.common||{},v=map$6(C=this.reportConfig.compassDataEndpoint.split(",")).call(C,(function(t){var i;return concat(i="".concat(t,"/")).call(i,S.configPath)})),E=_regeneratorRuntime().mark((function _loop(E){return _regeneratorRuntime().wrap((function _loop$(I){for(;;)switch(I.prev=I.next){case 0:if(!S.initConfigLoaded&&!S.isDestroyed){I.next=2;break}return I.abrupt("return","break");case 2:return I.prev=2,I.next=5,S.reportConfig.request(v[E],{method:"GET",dataType:"json",params:{deviceId:m.dev_id,sdkVer:m.sdk_ver,platform:m.platform,hostEnv:m.host_env,appkey:m.app_key},timeout:S.reportConfig.timeout}).then((function(t){var i,u;if(!S.isDestroyed){if(200===t.status&&t.data&&200===t.data.code){S.initConfigLoaded=!0;var h=t.data.data||{};S.reportConfig.maxSize=h.maxSize>1e3?1e3:h.maxSize,S.reportConfig.maxInterval=h.maxInterval>1e4?1e4:h.maxInterval,S.reportConfig.maxInterval=h.maxInterval<10?10:h.maxInterval,S.reportConfig.minInterval=h.minInterval<2?2:h.minInterval,S.reportConfig.maxDelay=h.maxDelay||300,S.reportConfig.maxInterval=1e3*S.reportConfig.maxInterval,S.reportConfig.minInterval=1e3*S.reportConfig.minInterval,S.reportConfig.maxDelay=1e3*S.reportConfig.maxDelay,h.endpoint?S.dataReportEndpoint=h.endpoint:S.dataReportEndpoint=v[E],S.serverAllowUpload=!0,S.loading=!1,S.reportHeartBeat()}else 200===t.status&&(S.initConfigLoaded=!0);null===(u=null===(i=S.reportConfig)||void 0===i?void 0:i.logger)||void 0===u||u.log("Get reporter upload config success")}})).catch((function(t){var h,m;S.isDestroyed||(S.loading=!1,null===(m=null===(h=S.reportConfig)||void 0===h?void 0:h.logger)||void 0===m||m.error("Get reporter upload config failed",t),S.reqRetryCount<i&&(S.reqRetryCount++,vo((function(){S.isDestroyed||S.initUploadConfig()}),u)))}));case 5:I.next=14;break;case 7:if(I.prev=7,I.t0=I.catch(2),!S.isDestroyed){I.next=11;break}return I.abrupt("return",{v:void 0});case 11:S.loading=!1,null===(h=null===(t=S.reportConfig)||void 0===t?void 0:t.logger)||void 0===h||h.error("Exec reporter request failed",I.t0),S.reqRetryCount<i&&(S.reqRetryCount++,vo((function(){S.isDestroyed||S.initUploadConfig()}),u));case 14:case"end":return I.stop()}}),_loop,null,[[2,7]])})),I=0;case 7:if(!(I<v.length)){T.next=17;break}return T.delegateYield(E(I),"t0",9);case 9:if("break"!==(M=T.t0)){T.next=12;break}return T.abrupt("break",17);case 12:if("object"!==_typeof(M)){T.next=14;break}return T.abrupt("return",M.v);case 14:I++,T.next=7;break;case 17:case"end":return T.stop()}}),_callee,this)})))}},{key:"reportHeartBeat",value:function reportHeartBeat(){var t=this;this.isDestroyed||(this.timer=vo((function(){t.reportHeartBeat()}),this.reportConfig.minInterval),this.doReport())}},{key:"doReport",value:function doReport(){if(!this.isDestroyed){var t=this.highPriorityMsgList.length+this.msgList.length+this.lowPriorityMsgList.length+this.cacheMsgList.length>2*this.reportConfig.maxSize?this.reportConfig.minInterval:this.reportConfig.maxInterval;eo()-this.lastReportTime>=t&&this.upload()}}},{key:"getUploadMsg",value:function getUploadMsg(){var t,i,u,h,m,v,E=this,I={},M=eo();this.highPriorityMsgList=filter(t=this.highPriorityMsgList).call(t,(function(t){return M-t.createTime<E.reportConfig.maxDelay})),this.msgList=filter(i=this.msgList).call(i,(function(t){return M-t.createTime<E.reportConfig.maxDelay})),this.lowPriorityMsgList=filter(u=this.lowPriorityMsgList).call(u,(function(t){return M-t.createTime<E.reportConfig.maxDelay})),this.cacheMsgList=filter(h=this.cacheMsgList).call(h,(function(t){return M-t.createTime<E.reportConfig.maxDelay}));var S=slice(m=this.highPriorityMsgList).call(m,0,this.reportConfig.maxSize);if(this.highPriorityMsgList=slice(v=this.highPriorityMsgList).call(v,S.length),S.length<this.reportConfig.maxSize){var T,C,R=this.reportConfig.maxSize-S.length;S=concat(S).call(S,slice(T=this.msgList).call(T,0,R)),this.msgList=slice(C=this.msgList).call(C,R)}if(S.length<this.reportConfig.maxSize){var A,N,O=this.reportConfig.maxSize-S.length;S=concat(S).call(S,slice(A=this.lowPriorityMsgList).call(A,0,O)),this.lowPriorityMsgList=slice(N=this.lowPriorityMsgList).call(N,O)}if(S.length<this.reportConfig.maxSize){var w,x,k=this.reportConfig.maxSize-S.length;S=concat(S).call(S,slice(w=this.cacheMsgList).call(w,0,k)),this.cacheMsgList=slice(x=this.cacheMsgList).call(x,k)}return forEach$1(S).call(S,(function(t){I[t.module]?I[t.module].push(t.msg):I[t.module]=[t.msg]})),{uploadMsgArr:S,uploadMsg:I}}},{key:"upload",value:function upload(){var t,i,u=this;if(this.isUploadEnable&&this.serverAllowUpload&&!(this.lastReportTime&&eo()-this.lastReportTime<this.reportConfig.minInterval)){var h=this.getUploadMsg(),m=h.uploadMsgArr,v=h.uploadMsg;if(m.length){this.lastReportTime=eo();try{var E,I=concat(E="".concat(this.dataReportEndpoint,"/")).call(E,this.dataReportPath);this.reportConfig.request(I,{dataType:"json",method:"POST",data:{common:this.reportConfig.common,event:v},headers:{sdktype:"im"},timeout:this.reportConfig.timeout}).catch((function(t){var i,h,v,E;u.cacheMsgList=slice(i=concat(h=u.cacheMsgList).call(h,m)).call(i,0,u.reportConfig.cacheMaxSize),null===(E=null===(v=u.reportConfig)||void 0===v?void 0:v.logger)||void 0===E||E.warn("Reporter upload failed",t)}))}catch(u){null===(i=null===(t=this.reportConfig)||void 0===t?void 0:t.logger)||void 0===i||i.warn("Exec reporter request failed",u)}clearTimeout(this.timer),this.reportHeartBeat()}}}}]),Reporter}();return m}()})),us=getDefaultExportFromCjs(createCommonjsModule((function(t){function _defineProperties(t,i){for(var u=0;u<i.length;u++){var h=i[u];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),yi(t,h.key,h)}}t.exports=function _createClass(t,i,u){return i&&_defineProperties(t.prototype,i),u&&_defineProperties(t,u),yi(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports}))),ds=createCommonjsModule((function(t){function _typeof(i){return t.exports=_typeof="function"==typeof gi&&"symbol"==typeof qi?function(t){return typeof t}:function(t){return t&&"function"==typeof gi&&t.constructor===gi&&t!==gi.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,_typeof(i)}t.exports=_typeof,t.exports.__esModule=!0,t.exports.default=t.exports})),ps=createCommonjsModule((function(t){var i=ds.default;function _regeneratorRuntime(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
t.exports=_regeneratorRuntime=function _regeneratorRuntime(){return u},t.exports.__esModule=!0,t.exports.default=t.exports;var u={},h=Object.prototype,m=h.hasOwnProperty,v="function"==typeof gi?gi:{},E=v.iterator||"@@iterator",I=v.asyncIterator||"@@asyncIterator",M=v.toStringTag||"@@toStringTag";function define(t,i,u){return yi(t,i,{value:u,enumerable:!0,configurable:!0,writable:!0}),t[i]}try{define({},"")}catch(t){define=function define(t,i,u){return t[i]=u}}function wrap(t,i,u,h){var m=i&&i.prototype instanceof Generator?i:Generator,v=pt(m.prototype),E=new Context(h||[]);return v._invoke=function(t,i,u){var h="suspendedStart";return function(m,v){if("executing"===h)throw new Error("Generator is already running");if("completed"===h){if("throw"===m)throw v;return doneResult()}for(u.method=m,u.arg=v;;){var E=u.delegate;if(E){var I=maybeInvokeDelegate(E,u);if(I){if(I===S)continue;return I}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===h)throw h="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);h="executing";var M=tryCatch(t,i,u);if("normal"===M.type){if(h=u.done?"completed":"suspendedYield",M.arg===S)continue;return{value:M.arg,done:u.done}}"throw"===M.type&&(h="completed",u.method="throw",u.arg=M.arg)}}}(t,u,E),v}function tryCatch(t,i,u){try{return{type:"normal",arg:t.call(i,u)}}catch(t){return{type:"throw",arg:t}}}u.wrap=wrap;var S={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var T={};define(T,E,(function(){return this}));var C=Ii&&Ii(Ii(values([])));C&&C!==h&&m.call(C,E)&&(T=C);var R=GeneratorFunctionPrototype.prototype=Generator.prototype=pt(T);function defineIteratorMethods(t){var i;forEach$1(i=["next","throw","return"]).call(i,(function(i){define(t,i,(function(t){return this._invoke(i,t)}))}))}function AsyncIterator(t,u){function invoke(h,v,E,I){var M=tryCatch(t[h],t,v);if("throw"!==M.type){var S=M.arg,T=S.value;return T&&"object"==i(T)&&m.call(T,"__await")?u.resolve(T.__await).then((function(t){invoke("next",t,E,I)}),(function(t){invoke("throw",t,E,I)})):u.resolve(T).then((function(t){S.value=t,E(S)}),(function(t){return invoke("throw",t,E,I)}))}I(M.arg)}var h;this._invoke=function(t,i){function callInvokeWithMethodAndArg(){return new u((function(u,h){invoke(t,i,u,h)}))}return h=h?h.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,i){var u=t.iterator[i.method];if(void 0===u){if(i.delegate=null,"throw"===i.method){if(t.iterator.return&&(i.method="return",i.arg=void 0,maybeInvokeDelegate(t,i),"throw"===i.method))return S;i.method="throw",i.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var h=tryCatch(u,t.iterator,i.arg);if("throw"===h.type)return i.method="throw",i.arg=h.arg,i.delegate=null,S;var m=h.arg;return m?m.done?(i[t.resultName]=m.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,S):m:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,S)}function pushTryEntry(t){var i={tryLoc:t[0]};1 in t&&(i.catchLoc=t[1]),2 in t&&(i.finallyLoc=t[2],i.afterLoc=t[3]),this.tryEntries.push(i)}function resetTryEntry(t){var i=t.completion||{};i.type="normal",delete i.arg,t.completion=i}function Context(t){this.tryEntries=[{tryLoc:"root"}],forEach$1(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t){var i=t[E];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var u=-1,h=function next(){for(;++u<t.length;)if(m.call(t,u))return next.value=t[u],next.done=!1,next;return next.value=void 0,next.done=!0,next};return h.next=h}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(R,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,M,"GeneratorFunction"),u.isGeneratorFunction=function(t){var i="function"==typeof t&&t.constructor;return!!i&&(i===GeneratorFunction||"GeneratorFunction"===(i.displayName||i.name))},u.mark=function(t){return gt?gt(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,M,"GeneratorFunction")),t.prototype=pt(R),t},u.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,I,(function(){return this})),u.AsyncIterator=AsyncIterator,u.async=function(t,i,h,m,v){void 0===v&&(v=Ja);var E=new AsyncIterator(wrap(t,i,h,m),v);return u.isGeneratorFunction(i)?E:E.next().then((function(t){return t.done?t.value:E.next()}))},defineIteratorMethods(R),define(R,M,"Generator"),define(R,E,(function(){return this})),define(R,"toString",(function(){return"[object Generator]"})),u.keys=function(t){var i=[];for(var u in t)i.push(u);return reverse(i).call(i),function next(){for(;i.length;){var u=i.pop();if(u in t)return next.value=u,next.done=!1,next}return next.done=!0,next}},u.values=values,Context.prototype={constructor:Context,reset:function reset(t){var i;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,forEach$1(i=this.tryEntries).call(i,resetTryEntry),!t)for(var u in this)"t"===u.charAt(0)&&m.call(this,u)&&!isNaN(+slice(u).call(u,1))&&(this[u]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var i=this;function handle(u,h){return v.type="throw",v.arg=t,i.next=u,h&&(i.method="next",i.arg=void 0),!!h}for(var u=this.tryEntries.length-1;u>=0;--u){var h=this.tryEntries[u],v=h.completion;if("root"===h.tryLoc)return handle("end");if(h.tryLoc<=this.prev){var E=m.call(h,"catchLoc"),I=m.call(h,"finallyLoc");if(E&&I){if(this.prev<h.catchLoc)return handle(h.catchLoc,!0);if(this.prev<h.finallyLoc)return handle(h.finallyLoc)}else if(E){if(this.prev<h.catchLoc)return handle(h.catchLoc,!0)}else{if(!I)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return handle(h.finallyLoc)}}}},abrupt:function abrupt(t,i){for(var u=this.tryEntries.length-1;u>=0;--u){var h=this.tryEntries[u];if(h.tryLoc<=this.prev&&m.call(h,"finallyLoc")&&this.prev<h.finallyLoc){var v=h;break}}v&&("break"===t||"continue"===t)&&v.tryLoc<=i&&i<=v.finallyLoc&&(v=null);var E=v?v.completion:{};return E.type=t,E.arg=i,v?(this.method="next",this.next=v.finallyLoc,S):this.complete(E)},complete:function complete(t,i){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&i&&(this.next=i),S},finish:function finish(t){for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i];if(u.finallyLoc===t)return this.complete(u.completion,u.afterLoc),resetTryEntry(u),S}},catch:function _catch(t){for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i];if(u.tryLoc===t){var h=u.completion;if("throw"===h.type){var m=h.arg;resetTryEntry(u)}return m}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,i,u){return this.delegate={iterator:values(t),resultName:i,nextLoc:u},"next"===this.method&&(this.arg=void 0),S}},u}t.exports=_regeneratorRuntime,t.exports.__esModule=!0,t.exports.default=t.exports})),hs=ps(),ms=hs;try{regeneratorRuntime=hs}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=hs:Function("r","regeneratorRuntime = r")(hs)}var fs=Ze.indexOf,gs=N([].indexOf),vs=!!gs&&1/gs([1],1,-0)<0,_s=arrayMethodIsStrict("indexOf");_export({target:"Array",proto:!0,forced:vs||!_s},{indexOf:function indexOf(t){var i=arguments.length>1?arguments[1]:void 0;return vs?gs(this,t,i)||0:fs(this,t,i)}});var ys=entryVirtual("Array").indexOf,Es=Array.prototype,indexOf=function(t){var i=t.indexOf;return t===Es||$(Es,t)&&i===Es.indexOf?ys:i};W.JSON||(W.JSON={stringify:JSON.stringify});var Is=function stringify(t,i,u){return S(W.JSON.stringify,null,arguments)},Ms=Is,Ss=Ro.some,Ts=arrayMethodIsStrict("some");_export({target:"Array",proto:!0,forced:!Ts},{some:function some(t){return Ss(this,t,arguments.length>1?arguments[1]:void 0)}});var Cs=entryVirtual("Array").some,bs=Array.prototype,some=function(t){var i=t.some;return t===bs||$(bs,t)&&i===bs.some?Cs:i};function __rest(t,i){var u={};for(var h in t)Object.prototype.hasOwnProperty.call(t,h)&&i.indexOf(h)<0&&(u[h]=t[h]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var m=0;for(h=Object.getOwnPropertySymbols(t);m<h.length;m++)i.indexOf(h[m])<0&&Object.prototype.propertyIsEnumerable.call(t,h[m])&&(u[h[m]]=t[h[m]])}return u}function __awaiter(t,i,u,h){return new(u||(u=Promise))((function(m,v){function fulfilled(t){try{step(h.next(t))}catch(t){v(t)}}function rejected(t){try{step(h.throw(t))}catch(t){v(t)}}function step(t){t.done?m(t.value):function adopt(t){return t instanceof u?t:new u((function(i){i(t)}))}(t.value).then(fulfilled,rejected)}step((h=h.apply(t,i||[])).next())}))}var Rs=Math.min,As=[].lastIndexOf,Ns=!!As&&1/[1].lastIndexOf(1,-0)<0,Os=arrayMethodIsStrict("lastIndexOf"),ws=Ns||!Os?function lastIndexOf(t){if(Ns)return S(As,this,arguments)||0;var i=toIndexedObject(this),u=lengthOfArrayLike(i),h=u-1;for(arguments.length>1&&(h=Rs(h,toIntegerOrInfinity(arguments[1]))),h<0&&(h=u+h);h>=0;h--)if(h in i&&i[h]===t)return h||0;return-1}:As;_export({target:"Array",proto:!0,forced:ws!==[].lastIndexOf},{lastIndexOf:ws});var xs,ks=entryVirtual("Array").lastIndexOf,Ps=Array.prototype,lastIndexOf=function(t){var i=t.lastIndexOf;return t===Ps||$(Ps,t)&&i===Ps.lastIndexOf?ks:i},Ls="\t\n\v\f\r \u2028\u2029\ufeff",Ds=N("".replace),qs="["+Ls+"]",Vs=RegExp("^"+qs+qs+"*"),Us=RegExp(qs+qs+"*$"),createMethod$1=function(t){return function(i){var u=toString(requireObjectCoercible(i));return 1&t&&(u=Ds(u,Vs,"")),2&t&&(u=Ds(u,Us,"")),u}},Gs={start:createMethod$1(1),end:createMethod$1(2),trim:createMethod$1(3)},Fs=kr.PROPER,Bs=Gs.trim;_export({target:"String",proto:!0,forced:(xs="trim",fails((function(){return!!Ls[xs]()||"
"!=="
"[xs]()||Fs&&Ls[xs].name!==xs})))},{trim:function trim(){return Bs(this)}}),entryVirtual("String").trim;var js=Ro.findIndex,Ys="findIndex",Ws=!0;Ys in[]&&Array(1).findIndex((function(){Ws=!1})),_export({target:"Array",proto:!0,forced:Ws},{findIndex:function findIndex(t){return js(this,t,arguments.length>1?arguments[1]:void 0)}});var $s=entryVirtual("Array").findIndex,Hs=Array.prototype,findIndex=function(t){var i=t.findIndex;return t===Hs||$(Hs,t)&&i===Hs.findIndex?$s:i};_export({target:"Array",stat:!0},{isArray:to});var Qs=W.Array.isArray;function isPlainObject(t){return null!=t&&"object"==typeof t&&Ii(t)==Object.prototype}function merge$1(t,i){var u=isPlainObject(t)||Qs(t),h=isPlainObject(i)||Qs(i);if(u&&h){for(var m in i){var v=merge$1(t[m],i[m]);void 0!==v&&(t[m]=v)}return t}return i}var Ks={setLogger:function setLogger(t){throw new Error("setLogger not implemented.")},platform:"",WebSocket:function(){function AdapterSocket(t,i){throw this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,this.binaryType="",new Error("Method not implemented.")}var t=AdapterSocket.prototype;return t.close=function close(t,i){throw new Error("Method not implemented.")},t.send=function send(t){throw new Error("Method not implemented.")},t.onclose=function onclose(t){throw new Error("Method not implemented.")},t.onerror=function onerror(t){throw new Error("Method not implemented.")},t.onmessage=function onmessage(t){throw new Error("Method not implemented.")},t.onopen=function onopen(t){throw new Error("Method not implemented.")},AdapterSocket}(),localStorage:{},request:function request(t,i){throw new Error("request not implemented.")},uploadFile:function uploadFile(t){throw new Error("uploadFile not implemented.")},getSystemInfo:function getSystemInfo(){throw new Error("getSystemInfo not implemented.")},getFileUploadInformation:function getFileUploadInformation(t){throw new Error("getFileUploadInformation not implemented.")},envPayload:{},net:{getNetworkStatus:function getNetworkStatus(){return Ja.resolve({net_type:0,net_connect:!0})},onNetworkStatusChange:function onNetworkStatusChange(t){},offNetworkStatusChange:function offNetworkStatusChange(){}},powerMonitor:{isActive:function isActive(){return!0},getStatus:function getStatus(){return 0},setStatus:function setStatus(t){},destroy:function destroy(){}},logStorage:function(){function AdapterLogStorageImpl(t){}var t=AdapterLogStorageImpl.prototype;return t.open=function open(){return Ja.resolve()},t.close=function close(){},t.addLogs=function addLogs(t){return Ja.resolve()},t.extractLogs=function extractLogs(){return Ja.resolve()},t.afterUpload=function afterUpload(){return Ja.resolve()},AdapterLogStorageImpl}()};var zs=fails((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),Js=Object.isExtensible,Xs=fails((function(){Js(1)}))||zs?function isExtensible(t){return!!Y(t)&&((!zs||"ArrayBuffer"!=classofRaw(t))&&(!Js||Js(t)))}:Js,Zs=!fails((function(){return Object.isExtensible(Object.preventExtensions({}))})),ec=createCommonjsModule((function(t){var i=Ye.f,u=!1,h=uid("meta"),m=0,setMetadata=function(t){i(t,h,{value:{objectID:"O"+m++,weakData:{}}})},v=t.exports={enable:function(){v.enable=function(){},u=!0;var t=Ut.f,i=N([].splice),m={};m[h]=1,t(m).length&&(Ut.f=function(u){for(var m=t(u),v=0,E=m.length;v<E;v++)if(m[v]===h){i(m,v,1);break}return m},_export({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:So.f}))},fastKey:function(t,i){if(!Y(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!he(t,h)){if(!Xs(t))return"F";if(!i)return"E";setMetadata(t)}return t[h].objectID},getWeakData:function(t,i){if(!he(t,h)){if(!Xs(t))return!0;if(!i)return!1;setMetadata(t)}return t[h].weakData},onFreeze:function(t){return Zs&&u&&Xs(t)&&!he(t,h)&&setMetadata(t),t}};et[h]=!0})),tc=Ye.f,rc=Ro.forEach,nc=Nr.set,ac=Nr.getterFor,collection=function(t,i,u){var h,v=-1!==t.indexOf("Map"),E=-1!==t.indexOf("Weak"),I=v?"set":"add",M=m[t],S=M&&M.prototype,T={};if(O&&isCallable(M)&&(E||S.forEach&&!fails((function(){(new M).entries().next()})))){var C=(h=i((function(i,u){nc(anInstance(i,C),{type:t,collection:new M}),null!=u&&iterate(u,i[I],{that:i,AS_ENTRIES:v})}))).prototype,R=ac(t);rc(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var i="add"==t||"set"==t;!(t in S)||E&&"clear"==t||We(C,t,(function(u,h){var m=R(this).collection;if(!i&&E&&!Y(u))return"get"==t&&void 0;var v=m[t](0===u?0:u,h);return i?this:v}))})),E||tc(C,"size",{configurable:!0,get:function(){return R(this).collection.size}})}else h=u.getConstructor(i,t,v,I),ec.enable();return setToStringTag(h,t,!1,!0),T[t]=h,_export({global:!0,forced:!0},T),E||u.setStrong(h,t,v),h},defineBuiltIns=function(t,i,u){for(var h in i)u&&u.unsafe&&t[h]?t[h]=i[h]:defineBuiltIn(t,h,i[h],u);return t},oc=Ye.f,ic=ec.fastKey,sc=Nr.set,cc=Nr.getterFor,lc={getConstructor:function(t,i,u,h){var m=t((function(t,m){anInstance(t,v),sc(t,{type:i,index:ut(null),first:void 0,last:void 0,size:0}),O||(t.size=0),isNullOrUndefined(m)||iterate(m,t[h],{that:t,AS_ENTRIES:u})})),v=m.prototype,E=cc(i),define=function(t,i,u){var h,m,v=E(t),I=getEntry(t,i);return I?I.value=u:(v.last=I={index:m=ic(i,!0),key:i,value:u,previous:h=v.last,next:void 0,removed:!1},v.first||(v.first=I),h&&(h.next=I),O?v.size++:t.size++,"F"!==m&&(v.index[m]=I)),t},getEntry=function(t,i){var u,h=E(t),m=ic(i);if("F"!==m)return h.index[m];for(u=h.first;u;u=u.next)if(u.key==i)return u};return defineBuiltIns(v,{clear:function clear(){for(var t=E(this),i=t.index,u=t.first;u;)u.removed=!0,u.previous&&(u.previous=u.previous.next=void 0),delete i[u.index],u=u.next;t.first=t.last=void 0,O?t.size=0:this.size=0},delete:function(t){var i=this,u=E(i),h=getEntry(i,t);if(h){var m=h.next,v=h.previous;delete u.index[h.index],h.removed=!0,v&&(v.next=m),m&&(m.previous=v),u.first==h&&(u.first=m),u.last==h&&(u.last=v),O?u.size--:i.size--}return!!h},forEach:function forEach(t){for(var i,u=E(this),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0);i=i?i.next:u.first;)for(h(i.value,i.key,this);i&&i.removed;)i=i.previous},has:function has(t){return!!getEntry(this,t)}}),defineBuiltIns(v,u?{get:function get(t){var i=getEntry(this,t);return i&&i.value},set:function set(t,i){return define(this,0===t?0:t,i)}}:{add:function add(t){return define(this,t=0===t?0:t,t)}}),O&&oc(v,"size",{get:function(){return E(this).size}}),m},setStrong:function(t,i,u){var h=i+" Iterator",m=cc(i),v=cc(h);iteratorDefine(t,i,(function(t,i){sc(this,{type:h,target:t,state:m(t),kind:i,last:void 0})}),(function(){for(var t=v(this),i=t.kind,u=t.last;u&&u.removed;)u=u.previous;return t.target&&(t.last=u=u?u.next:t.state.first)?"keys"==i?{value:u.key,done:!1}:"values"==i?{value:u.value,done:!1}:{value:[u.key,u.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),u?"entries":"values",!u,!0),setSpecies(i)}};collection("Map",(function(t){return function Map(){return t(this,arguments.length?arguments[0]:void 0)}}),lc);var uc=W.Map,dc=[].push,pc=function from(t){var i,u,h,m,v=arguments.length,E=v>1?arguments[1]:void 0;return aConstructor(this),(i=void 0!==E)&&aCallable(E),isNullOrUndefined(t)?new this:(u=[],i?(h=0,m=functionBindContext(E,v>2?arguments[2]:void 0),iterate(t,(function(t){x(dc,u,m(t,h++))}))):iterate(t,dc,{that:u}),new this(u))};_export({target:"Map",stat:!0,forced:!0},{from:pc});var hc=function of(){return new this(vt(arguments))};_export({target:"Map",stat:!0,forced:!0},{of:hc});var mc=function deleteAll(){for(var t,i=anObject(this),u=aCallable(i.delete),h=!0,m=0,v=arguments.length;m<v;m++)t=x(u,i,arguments[m]),h=h&&t;return!!h};_export({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:mc});_export({target:"Map",proto:!0,real:!0,forced:!0},{emplace:function emplace(t,i){var u,h,m=anObject(this),v=aCallable(m.get),E=aCallable(m.has),I=aCallable(m.set);return x(E,m,t)?(u=x(v,m,t),"update"in i&&(u=i.update(u,t,m),x(I,m,t,u)),u):(h=i.insert(t,m),x(I,m,t,h),h)}});var fc=getIterator;_export({target:"Map",proto:!0,real:!0,forced:!0},{every:function every(t){var i=anObject(this),u=fc(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return!iterate(u,(function(t,u,m){if(!h(u,t,i))return m()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{filter:function filter(t){var i=anObject(this),u=fc(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0),m=new(speciesConstructor(i,getBuiltIn("Map"))),v=aCallable(m.set);return iterate(u,(function(t,u){h(u,t,i)&&x(v,m,t,u)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),m}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{find:function find(t){var i=anObject(this),u=fc(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u,m){if(h(u,t,i))return m(u)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function findKey(t){var i=anObject(this),u=fc(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u,m){if(h(u,t,i))return m(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var gc=N([].push);_export({target:"Map",stat:!0,forced:!0},{groupBy:function groupBy(t,i){aCallable(i);var u=getIterator(t),h=new this,m=aCallable(h.has),v=aCallable(h.get),E=aCallable(h.set);return iterate(u,(function(t){var u=i(t);x(m,h,u)?gc(x(v,h,u),t):x(E,h,u,[t])}),{IS_ITERATOR:!0}),h}});_export({target:"Map",proto:!0,real:!0,forced:!0},{includes:function includes(t){return iterate(fc(anObject(this)),(function(i,u,h){if((m=u)===(v=t)||m!=m&&v!=v)return h();var m,v}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Map",stat:!0,forced:!0},{keyBy:function keyBy(t,i){var u=new this;aCallable(i);var h=aCallable(u.set);return iterate(t,(function(t){x(h,u,i(t),t)})),u}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function keyOf(t){return iterate(fc(anObject(this)),(function(i,u,h){if(u===t)return h(i)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function mapKeys(t){var i=anObject(this),u=fc(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0),m=new(speciesConstructor(i,getBuiltIn("Map"))),v=aCallable(m.set);return iterate(u,(function(t,u){x(v,m,h(u,t,i),u)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),m}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function mapValues(t){var i=anObject(this),u=fc(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0),m=new(speciesConstructor(i,getBuiltIn("Map"))),v=aCallable(m.set);return iterate(u,(function(t,u){x(v,m,t,h(u,t,i))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),m}}),_export({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function merge(t){for(var i=anObject(this),u=aCallable(i.set),h=arguments.length,m=0;m<h;)iterate(arguments[m++],u,{that:i,AS_ENTRIES:!0});return i}});var vc=TypeError;_export({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function reduce(t){var i=anObject(this),u=fc(i),h=arguments.length<2,m=h?void 0:arguments[1];if(aCallable(t),iterate(u,(function(u,v){h?(h=!1,m=v):m=t(m,v,u,i)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),h)throw vc("Reduce of empty map with no initial value");return m}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{some:function some(t){var i=anObject(this),u=fc(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u,m){if(h(u,t,i))return m()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var _c=TypeError;_export({target:"Map",proto:!0,real:!0,forced:!0},{update:function update(t,i){var u=anObject(this),h=aCallable(u.get),m=aCallable(u.has),v=aCallable(u.set),E=arguments.length;aCallable(i);var I=x(m,u,t);if(!I&&E<3)throw _c("Updating absent value");var M=I?x(h,u,t):aCallable(E>2?arguments[2]:void 0)(t,u);return x(v,u,t,i(M,t,u)),u}});var yc=TypeError,Ec=function upsert(t,i){var u,h=anObject(this),m=aCallable(h.get),v=aCallable(h.has),E=aCallable(h.set),I=arguments.length>2?arguments[2]:void 0;if(!isCallable(i)&&!isCallable(I))throw yc("At least one callback required");return x(v,h,t)?(u=x(m,h,t),isCallable(i)&&(u=i(u),x(E,h,t,u))):isCallable(I)&&(u=I(),x(E,h,t,u)),u};_export({target:"Map",proto:!0,real:!0,forced:!0},{upsert:Ec}),_export({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:Ec});var Ic=uc,Mc=createCommonjsModule((function(t){function _getPrototypeOf(i){var u;return t.exports=_getPrototypeOf=gt?bind$1(u=Ii).call(u):function _getPrototypeOf(t){return t.__proto__||Ii(t)},t.exports.__esModule=!0,t.exports.default=t.exports,_getPrototypeOf(i)}t.exports=_getPrototypeOf,t.exports.__esModule=!0,t.exports.default=t.exports})),Sc=createCommonjsModule((function(t){t.exports=function _isNativeFunction(t){var i;return-1!==indexOf(i=Function.toString.call(t)).call(i,"[native code]")},t.exports.__esModule=!0,t.exports.default=t.exports})),Tc=getBuiltIn("Reflect","construct"),Cc=Object.prototype,bc=[].push,Rc=fails((function(){function F(){}return!(Tc((function(){}),[],F)instanceof F)})),Ac=!fails((function(){Tc((function(){}))})),Nc=Rc||Ac;_export({target:"Reflect",stat:!0,forced:Nc,sham:Nc},{construct:function construct(t,i){aConstructor(t),anObject(i);var u=arguments.length<3?t:aConstructor(arguments[2]);if(Ac&&!Rc)return Tc(t,i,u);if(t==u){switch(i.length){case 0:return new t;case 1:return new t(i[0]);case 2:return new t(i[0],i[1]);case 3:return new t(i[0],i[1],i[2]);case 4:return new t(i[0],i[1],i[2],i[3])}var h=[null];return S(bc,h,i),new(S(Mt,t,h))}var m=u.prototype,v=ut(Y(m)?m:Cc),E=S(t,v,i);return Y(E)?E:v}});var Oc=W.Reflect.construct,wc=createCommonjsModule((function(t){t.exports=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Oc)return!1;if(Oc.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Oc(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports.default=t.exports})),xc=createCommonjsModule((function(t){function _construct(i,u,h){var m;wc()?(t.exports=_construct=bind$1(m=Oc).call(m),t.exports.__esModule=!0,t.exports.default=t.exports):(t.exports=_construct=function _construct(t,i,u){var h=[null];h.push.apply(h,i);var m=new(bind$1(Function).apply(t,h));return u&&Ct(m,u.prototype),m},t.exports.__esModule=!0,t.exports.default=t.exports);return _construct.apply(null,arguments)}t.exports=_construct,t.exports.__esModule=!0,t.exports.default=t.exports})),kc=createCommonjsModule((function(t){function _wrapNativeSuper(i){var u="function"==typeof Ic?new Ic:void 0;return t.exports=_wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!Sc(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==u){if(u.has(t))return u.get(t);u.set(t,Wrapper)}function Wrapper(){return xc(t,arguments,Mc(this).constructor)}return Wrapper.prototype=pt(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),Ct(Wrapper,t)},t.exports.__esModule=!0,t.exports.default=t.exports,_wrapNativeSuper(i)}t.exports=_wrapNativeSuper,t.exports.__esModule=!0,t.exports.default=t.exports})),Pc=getDefaultExportFromCjs(kc),Lc=TypeError,createMethod=function(t){return function(i,u,h,m){aCallable(u);var v=toObject(i),E=G(v),I=lengthOfArrayLike(v),M=t?I-1:0,S=t?-1:1;if(h<2)for(;;){if(M in E){m=E[M],M+=S;break}if(M+=S,t?M<0:I<=M)throw Lc("Reduce of empty array with no initial value")}for(;t?M>=0:I>M;M+=S)M in E&&(m=u(m,E[M],M,v));return m}},Dc={left:createMethod(!1),right:createMethod(!0)}.left,qc=arrayMethodIsStrict("reduce");_export({target:"Array",proto:!0,forced:!qc||!Jr&&Z>79&&Z<83},{reduce:function reduce(t){var i=arguments.length;return Dc(this,t,i,i>1?arguments[1]:void 0)}});var Vc,Uc,Gc,Fc,Bc,jc,Yc,Wc,$c,Hc,Qc,Kc,zc,Jc,Xc,Zc,el,tl,rl,nl,al,ol,il,sl,cl,ll,ul,dl,pl,hl,ml,fl,gl,vl,_l,yl,El,Il,Ml,Sl,Tl,Cl,bl,Rl,Al,Nl,Ol,wl,xl,kl,Pl,Ll,Dl,ql,Vl,Ul,Gl,Fl=entryVirtual("Array").reduce,Bl=Array.prototype,reduce=function(t){var i=t.reduce;return t===Bl||$(Bl,t)&&i===Bl.reduce?Fl:i};!function(t){t[t.V2NIM_DATA_SYNC_TYPE_LEVEL_FULL=0]="V2NIM_DATA_SYNC_TYPE_LEVEL_FULL",t[t.V2NIM_DATA_SYNC_TYPE_LEVEL_BASIC=1]="V2NIM_DATA_SYNC_TYPE_LEVEL_BASIC"}(Vc||(Vc={})),function(t){t[t.V2NIM_DATA_SYNC_TYPE_MAIN=1]="V2NIM_DATA_SYNC_TYPE_MAIN",t[t.V2NIM_DATA_SYNC_TYPE_TEAM_MEMBER=2]="V2NIM_DATA_SYNC_TYPE_TEAM_MEMBER",t[t.V2NIM_DATA_SYNC_TYPE_SUPER_TEAM_MEMBER=3]="V2NIM_DATA_SYNC_TYPE_SUPER_TEAM_MEMBER"}(Uc||(Uc={})),function(t){t[t.V2NIM_DATA_SYNC_STATE_WAITING=1]="V2NIM_DATA_SYNC_STATE_WAITING",t[t.V2NIM_DATA_SYNC_STATE_SYNCING=2]="V2NIM_DATA_SYNC_STATE_SYNCING",t[t.V2NIM_DATA_SYNC_STATE_COMPLETED=3]="V2NIM_DATA_SYNC_STATE_COMPLETED"}(Gc||(Gc={})),function(t){t[t.V2NIM_CONVERSATION_TYPE_UNKNOWN=0]="V2NIM_CONVERSATION_TYPE_UNKNOWN",t[t.V2NIM_CONVERSATION_TYPE_P2P=1]="V2NIM_CONVERSATION_TYPE_P2P",t[t.V2NIM_CONVERSATION_TYPE_TEAM=2]="V2NIM_CONVERSATION_TYPE_TEAM",t[t.V2NIM_CONVERSATION_TYPE_SUPER_TEAM=3]="V2NIM_CONVERSATION_TYPE_SUPER_TEAM"}(Fc||(Fc={})),function(t){t[t.V2NIM_MESSAGE_STATUS_DEFAULT=0]="V2NIM_MESSAGE_STATUS_DEFAULT",t[t.V2NIM_MESSAGE_STATUS_REVOKE=1]="V2NIM_MESSAGE_STATUS_REVOKE",t[t.V2NIM_MESSAGE_STATUS_BACKFILL=2]="V2NIM_MESSAGE_STATUS_BACKFILL"}(Bc||(Bc={})),function(t){t[t.V2NIM_FRIEND_MODE_TYPE_ADD=1]="V2NIM_FRIEND_MODE_TYPE_ADD",t[t.V2NIM_FRIEND_MODE_TYPE_APPLY=2]="V2NIM_FRIEND_MODE_TYPE_APPLY"}(jc||(jc={})),function(t){t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_LEGACY=0]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_LEGACY",t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_FROM_SELF=1]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_FROM_SELF",t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_TO_SELF=2]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_TO_SELF",t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_ALL=3]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_ALL"}(Yc||(Yc={})),function(t){t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_INIT=0]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_INIT",t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_AGREED=1]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_AGREED",t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_REJECTED=2]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_REJECTED",t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_EXPIRED=3]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_EXPIRED",t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_DIRECT_ADD=4]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_DIRECT_ADD"}(Wc||(Wc={})),function(t){t[t.V2NIM_FRIEND_DELETION_TYPE_BY_SELF=1]="V2NIM_FRIEND_DELETION_TYPE_BY_SELF",t[t.V2NIM_FRIEND_DELETION_TYPE_BY_PEER=2]="V2NIM_FRIEND_DELETION_TYPE_BY_PEER"}($c||($c={})),function(t){t[t.V2NIM_FRIEND_VERIFY_TYPE_ADD=1]="V2NIM_FRIEND_VERIFY_TYPE_ADD",t[t.V2NIM_FRIEND_VERIFY_TYPE_APPLY=2]="V2NIM_FRIEND_VERIFY_TYPE_APPLY",t[t.V2NIM_FRIEND_VERIFY_TYPE_ACCEPT=3]="V2NIM_FRIEND_VERIFY_TYPE_ACCEPT",t[t.V2NIM_FRIEND_VERIFY_TYPE_REJECT=4]="V2NIM_FRIEND_VERIFY_TYPE_REJECT"}(Hc||(Hc={})),function(t){t[t.V2NIM_LOGIN_AUTH_TYPE_DEFAULT=0]="V2NIM_LOGIN_AUTH_TYPE_DEFAULT",t[t.V2NIM_LOGIN_AUTH_TYPE_DYNAMIC_TOKEN=1]="V2NIM_LOGIN_AUTH_TYPE_DYNAMIC_TOKEN",t[t.V2NIM_LOGIN_AUTH_TYPE_THIRD_PARTY=2]="V2NIM_LOGIN_AUTH_TYPE_THIRD_PARTY"}(Qc||(Qc={})),function(t){t[t.V2NIM_LOGIN_STATUS_LOGOUT=0]="V2NIM_LOGIN_STATUS_LOGOUT",t[t.V2NIM_LOGIN_STATUS_LOGINED=1]="V2NIM_LOGIN_STATUS_LOGINED",t[t.V2NIM_LOGIN_STATUS_LOGINING=2]="V2NIM_LOGIN_STATUS_LOGINING",t[t.V2NIM_LOGIN_STATUS_UNLOGIN=3]="V2NIM_LOGIN_STATUS_UNLOGIN"}(Kc||(Kc={})),function(t){t[t.V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN=0]="V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN",t[t.V2NIM_LOGIN_CLIENT_TYPE_ANDROID=1]="V2NIM_LOGIN_CLIENT_TYPE_ANDROID",t[t.V2NIM_LOGIN_CLIENT_TYPE_IOS=2]="V2NIM_LOGIN_CLIENT_TYPE_IOS",t[t.V2NIM_LOGIN_CLIENT_TYPE_PC=4]="V2NIM_LOGIN_CLIENT_TYPE_PC",t[t.V2NIM_LOGIN_CLIENT_TYPE_WP=8]="V2NIM_LOGIN_CLIENT_TYPE_WP",t[t.V2NIM_LOGIN_CLIENT_TYPE_WEB=16]="V2NIM_LOGIN_CLIENT_TYPE_WEB",t[t.V2NIM_LOGIN_CLIENT_TYPE_RESTFUL=32]="V2NIM_LOGIN_CLIENT_TYPE_RESTFUL",t[t.V2NIM_LOGIN_CLIENT_TYPE_MAC_OS=64]="V2NIM_LOGIN_CLIENT_TYPE_MAC_OS",t[t.V2NIM_LOGIN_CLIENT_TYPE_HARMONY_OS=65]="V2NIM_LOGIN_CLIENT_TYPE_HARMONY_OS"}(zc||(zc={})),function(t){t[t.V2NIM_KICKED_OFFLINE_REASON_CLIENT_EXCLUSIVE=1]="V2NIM_KICKED_OFFLINE_REASON_CLIENT_EXCLUSIVE",t[t.V2NIM_KICKED_OFFLINE_REASON_SERVER=2]="V2NIM_KICKED_OFFLINE_REASON_SERVER",t[t.V2NIM_KICKED_OFFLINE_REASON_CLIENT=3]="V2NIM_KICKED_OFFLINE_REASON_CLIENT",t[t.V2NIM_KICKED_OFFLINE_REASON_CLIENT_QUIETLY=4]="V2NIM_KICKED_OFFLINE_REASON_CLIENT_QUIETLY"}(Jc||(Jc={})),function(t){t[t.V2NIM_LOGIN_CLIENT_CHANGE_LIST=1]="V2NIM_LOGIN_CLIENT_CHANGE_LIST",t[t.V2NIM_LOGIN_CLIENT_CHANGE_LOGIN=2]="V2NIM_LOGIN_CLIENT_CHANGE_LOGIN",t[t.V2NIM_LOGIN_CLIENT_CHANGE_LOGOUT=3]="V2NIM_LOGIN_CLIENT_CHANGE_LOGOUT"}(Xc||(Xc={})),function(t){t[t.V2NIM_CONNECT_STATUS_DISCONNECTED=0]="V2NIM_CONNECT_STATUS_DISCONNECTED",t[t.V2NIM_CONNECT_STATUS_CONNECTED=1]="V2NIM_CONNECT_STATUS_CONNECTED",t[t.V2NIM_CONNECT_STATUS_CONNECTING=2]="V2NIM_CONNECT_STATUS_CONNECTING",t[t.V2NIM_CONNECT_STATUS_WAITING=3]="V2NIM_CONNECT_STATUS_WAITING"}(Zc||(Zc={})),function(t){t[t.NIM_MESSAGE_AI_STREAM_STATUS_STREAMING=-1]="NIM_MESSAGE_AI_STREAM_STATUS_STREAMING",t[t.NIM_MESSAGE_AI_STREAM_STATUS_NONE=0]="NIM_MESSAGE_AI_STREAM_STATUS_NONE",t[t.NIM_MESSAGE_AI_STREAM_STATUS_PLACEHOLDER=1]="NIM_MESSAGE_AI_STREAM_STATUS_PLACEHOLDER",t[t.NIM_MESSAGE_AI_STREAM_STATUS_CANCEL=2]="NIM_MESSAGE_AI_STREAM_STATUS_CANCEL",t[t.NIM_MESSAGE_AI_STREAM_STATUS_UPDATE=3]="NIM_MESSAGE_AI_STREAM_STATUS_UPDATE",t[t.NIM_MESSAGE_AI_STREAM_STATUS_COMPLETE=4]="NIM_MESSAGE_AI_STREAM_STATUS_COMPLETE",t[t.NIM_MESSAGE_AI_STREAM_STATUS_EXCEPTION=5]="NIM_MESSAGE_AI_STREAM_STATUS_EXCEPTION"}(el||(el={})),function(t){t[t.V2NIM_MESSAGE_AI_STREAM_STOP_OP_DEFAULT=0]="V2NIM_MESSAGE_AI_STREAM_STOP_OP_DEFAULT",t[t.V2NIM_MESSAGE_AI_STREAM_STOP_OP_REVOKE=1]="V2NIM_MESSAGE_AI_STREAM_STOP_OP_REVOKE",t[t.V2NIM_MESSAGE_AI_STREAM_STOP_OP_UPDATE=2]="V2NIM_MESSAGE_AI_STREAM_STOP_OP_UPDATE"}(tl||(tl={})),function(t){t[t.V2NIM_MESSAGE_AI_REGEN_OP_UPDATE=1]="V2NIM_MESSAGE_AI_REGEN_OP_UPDATE",t[t.V2NIM_MESSAGE_AI_REGEN_OP_NEW=2]="V2NIM_MESSAGE_AI_REGEN_OP_NEW"}(rl||(rl={})),function(t){t[t.V2NIM_MESSAGE_AI_STATUS_UNKNOW=0]="V2NIM_MESSAGE_AI_STATUS_UNKNOW",t[t.V2NIM_MESSAGE_AI_STATUS_AT=1]="V2NIM_MESSAGE_AI_STATUS_AT",t[t.V2NIM_MESSAGE_AI_STATUS_RESPONSE=2]="V2NIM_MESSAGE_AI_STATUS_RESPONSE"}(nl||(nl={})),function(t){t[t.V2NIM_MESSAGE_TYPE_INVALID=-1]="V2NIM_MESSAGE_TYPE_INVALID",t[t.V2NIM_MESSAGE_TYPE_TEXT=0]="V2NIM_MESSAGE_TYPE_TEXT",t[t.V2NIM_MESSAGE_TYPE_IMAGE=1]="V2NIM_MESSAGE_TYPE_IMAGE",t[t.V2NIM_MESSAGE_TYPE_AUDIO=2]="V2NIM_MESSAGE_TYPE_AUDIO",t[t.V2NIM_MESSAGE_TYPE_VIDEO=3]="V2NIM_MESSAGE_TYPE_VIDEO",t[t.V2NIM_MESSAGE_TYPE_LOCATION=4]="V2NIM_MESSAGE_TYPE_LOCATION",t[t.V2NIM_MESSAGE_TYPE_NOTIFICATION=5]="V2NIM_MESSAGE_TYPE_NOTIFICATION",t[t.V2NIM_MESSAGE_TYPE_FILE=6]="V2NIM_MESSAGE_TYPE_FILE",t[t.V2NIM_MESSAGE_TYPE_AVCHAT=7]="V2NIM_MESSAGE_TYPE_AVCHAT",t[t.V2NIM_MESSAGE_TYPE_TIPS=10]="V2NIM_MESSAGE_TYPE_TIPS",t[t.V2NIM_MESSAGE_TYPE_ROBOT=11]="V2NIM_MESSAGE_TYPE_ROBOT",t[t.V2NIM_MESSAGE_TYPE_CALL=12]="V2NIM_MESSAGE_TYPE_CALL",t[t.V2NIM_MESSAGE_TYPE_CUSTOM=100]="V2NIM_MESSAGE_TYPE_CUSTOM"}(al||(al={})),function(t){t[t.V2NIM_SEARCH_KEYWORD_MATCH_TYPE_OR=0]="V2NIM_SEARCH_KEYWORD_MATCH_TYPE_OR",t[t.V2NIM_SEARCH_KEYWORD_MATCH_TYPE_AND=1]="V2NIM_SEARCH_KEYWORD_MATCH_TYPE_AND"}(ol||(ol={})),function(t){t[t.V2NIM_SEARCH_DIRECTION_BACKWARD=0]="V2NIM_SEARCH_DIRECTION_BACKWARD",t[t.V2NIM_SEARCH_DIRECTION_FORWARD=1]="V2NIM_SEARCH_DIRECTION_FORWARD"}(il||(il={})),function(t){t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_UNDEFINED=-1]="V2NIM_MESSAGE_NOTIFICATION_TYPE_UNDEFINED",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE=0]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_KICK=1]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_KICK",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_LEAVE=2]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_LEAVE",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_UPDATE_TINFO=3]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_UPDATE_TINFO",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_DISMISS=4]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_DISMISS",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_APPLY_PASS=5]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_APPLY_PASS",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_OWNER_TRANSFER=6]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_OWNER_TRANSFER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_ADD_MANAGER=7]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_ADD_MANAGER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_REMOVE_MANAGER=8]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_REMOVE_MANAGER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE_ACCEPT=9]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE_ACCEPT",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_BANNED_TEAM_MEMBER=10]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_BANNED_TEAM_MEMBER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE=401]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_KICK=402]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_KICK",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_LEAVE=403]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_LEAVE",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_UPDATE_TINFO=404]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_UPDATE_TINFO",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_DISMISS=405]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_DISMISS",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_APPLY_PASS=410]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_APPLY_PASS",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_OWNER_TRANSFER=406]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_OWNER_TRANSFER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_ADD_MANAGER=407]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_ADD_MANAGER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_REMOVE_MANAGER=408]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_REMOVE_MANAGER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE_ACCEPT=411]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE_ACCEPT",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_BANNED_TEAM_MEMBER=409]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_BANNED_TEAM_MEMBER"}(sl||(sl={})),function(t){t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UNKNOWN=0]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UNKNOWN",t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_SUCCESS=1]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_SUCCESS",t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_FAILED=2]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_FAILED",t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UPLOADING=3]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UPLOADING"}(cl||(cl={})),function(t){t[t.V2NIM_MESSAGE_SENDING_STATE_UNKNOWN=0]="V2NIM_MESSAGE_SENDING_STATE_UNKNOWN",t[t.V2NIM_MESSAGE_SENDING_STATE_SUCCEEDED=1]="V2NIM_MESSAGE_SENDING_STATE_SUCCEEDED",t[t.V2NIM_MESSAGE_SENDING_STATE_FAILED=2]="V2NIM_MESSAGE_SENDING_STATE_FAILED",t[t.V2NIM_MESSAGE_SENDING_STATE_SENDING=3]="V2NIM_MESSAGE_SENDING_STATE_SENDING"}(ll||(ll={})),function(t){t[t.V2NIM_QUERY_DIRECTION_DESC=0]="V2NIM_QUERY_DIRECTION_DESC",t[t.V2NIM_QUERY_DIRECTION_ASC=1]="V2NIM_QUERY_DIRECTION_ASC"}(ul||(ul={})),function(t){t[t.V2NIM_CLEAR_HISTORY_MODE_ALL=0]="V2NIM_CLEAR_HISTORY_MODE_ALL",t[t.V2NIM_CLEAR_HISTORY_MODE_LOCAL=1]="V2NIM_CLEAR_HISTORY_MODE_LOCAL",t[t.V2NIM_CLEAR_HISTORY_MODE_LOCAL_IRREPARABLY=2]="V2NIM_CLEAR_HISTORY_MODE_LOCAL_IRREPARABLY"}(dl||(dl={})),function(t){t[t.V2NIM_MESSAGE_REVOKE_TYPE_UNDEFINED=0]="V2NIM_MESSAGE_REVOKE_TYPE_UNDEFINED",t[t.V2NIM_MESSAGE_REVOKE_TYPE_P2P_BOTHWAY=1]="V2NIM_MESSAGE_REVOKE_TYPE_P2P_BOTHWAY",t[t.V2NIM_MESSAGE_REVOKE_TYPE_TEAM_BOTHWAY=2]="V2NIM_MESSAGE_REVOKE_TYPE_TEAM_BOTHWAY",t[t.V2NIM_MESSAGE_REVOKE_TYPE_SUPERTEAM_BOTHWAY=3]="V2NIM_MESSAGE_REVOKE_TYPE_SUPERTEAM_BOTHWAY",t[t.V2NIM_MESSAGE_REVOKE_TYPE_P2P_ONEWAY=4]="V2NIM_MESSAGE_REVOKE_TYPE_P2P_ONEWAY",t[t.V2NIM_MESSAGE_REVOKE_TYPE_TEAM_ONEWAY=5]="V2NIM_MESSAGE_REVOKE_TYPE_TEAM_ONEWAY"}(pl||(pl={})),function(t){t[t.V2NIM_MESSAGE_PIN_STATE_NOT_PINNED=0]="V2NIM_MESSAGE_PIN_STATE_NOT_PINNED",t[t.V2NIM_MESSAGE_PIN_STATE_PINNED=1]="V2NIM_MESSAGE_PIN_STATE_PINNED",t[t.V2NIM_MESSAGE_PIN_STATE_UPDATED=2]="V2NIM_MESSAGE_PIN_STATE_UPDATED"}(hl||(hl={})),function(t){t[t.V2NIM_QUICK_COMMENT_STATE_ADD=1]="V2NIM_QUICK_COMMENT_STATE_ADD",t[t.V2NIM_QUICK_COMMENT_STATE_REMOVE=2]="V2NIM_QUICK_COMMENT_STATE_REMOVE"}(ml||(ml={})),function(t){t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_NONE=0]="V2NIM_CLIENT_ANTISPAM_OPERATE_NONE",t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_REPLACE=1]="V2NIM_CLIENT_ANTISPAM_OPERATE_REPLACE",t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_CLIENT_SHIELD=2]="V2NIM_CLIENT_ANTISPAM_OPERATE_CLIENT_SHIELD",t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_SERVER_SHIELD=3]="V2NIM_CLIENT_ANTISPAM_OPERATE_SERVER_SHIELD"}(fl||(fl={})),function(t){t[t.V2NIM_SORT_ORDER_DESC=0]="V2NIM_SORT_ORDER_DESC",t[t.V2NIM_SORT_ORDER_ASC=1]="V2NIM_SORT_ORDER_ASC"}(gl||(gl={})),function(t){t[t.P2P_DELETE_MSG=7]="P2P_DELETE_MSG",t[t.TEAM_DELETE_MSG=8]="TEAM_DELETE_MSG",t[t.SUPERTEAM_DELETE_MSG=12]="SUPERTEAM_DELETE_MSG",t[t.P2P_ONE_WAY_DELETE_MSG=13]="P2P_ONE_WAY_DELETE_MSG",t[t.TEAM_ONE_WAY_DELETE_MSG=14]="TEAM_ONE_WAY_DELETE_MSG",t[t.CUSTOM_P2P_MSG=100]="CUSTOM_P2P_MSG",t[t.CUSTOM_TEAM_MSG=101]="CUSTOM_TEAM_MSG",t[t.CUSTOM_SUPERTEAM_MSG=103]="CUSTOM_SUPERTEAM_MSG"}(vl||(vl={})),function(t){t[t.NIM_MESSAGE_STREAM_STATUS_STREAMING=-1]="NIM_MESSAGE_STREAM_STATUS_STREAMING",t[t.NIM_MESSAGE_STREAM_STATUS_NONE=0]="NIM_MESSAGE_STREAM_STATUS_NONE",t[t.NIM_MESSAGE_STREAM_STATUS_PLACEHOLDER=1]="NIM_MESSAGE_STREAM_STATUS_PLACEHOLDER",t[t.NIM_MESSAGE_STREAM_STATUS_CANCEL=2]="NIM_MESSAGE_STREAM_STATUS_CANCEL",t[t.NIM_MESSAGE_AI_STREAM_STATUS_UPDATE=3]="NIM_MESSAGE_AI_STREAM_STATUS_UPDATE",t[t.NIM_MESSAGE_STREAM_STATUS_COMPLETE=4]="NIM_MESSAGE_STREAM_STATUS_COMPLETE",t[t.NIM_MESSAGE_STREAM_STATUS_EXCEPTION=5]="NIM_MESSAGE_STREAM_STATUS_EXCEPTION"}(_l||(_l={})),function(t){t[t.V2NIM_MESSAGE_SOURCE_UNKNOWN=0]="V2NIM_MESSAGE_SOURCE_UNKNOWN",t[t.V2NIM_MESSAGE_SOURCE_ONLINE=1]="V2NIM_MESSAGE_SOURCE_ONLINE",t[t.V2NIM_MESSAGE_SOURCE_OFFLINE=2]="V2NIM_MESSAGE_SOURCE_OFFLINE",t[t.V2NIM_MESSAGE_SOURCE_ROAMING=3]="V2NIM_MESSAGE_SOURCE_ROAMING"}(yl||(yl={})),function(t){t[t.V2NIM_TEAM_MESSAGE_MUTE_MODE_OFF=0]="V2NIM_TEAM_MESSAGE_MUTE_MODE_OFF",t[t.V2NIM_TEAM_MESSAGE_MUTE_MODE_ON=1]="V2NIM_TEAM_MESSAGE_MUTE_MODE_ON",t[t.V2NIM_TEAM_MESSAGE_MUTE_MODE_NORMAL_ON=2]="V2NIM_TEAM_MESSAGE_MUTE_MODE_NORMAL_ON"}(El||(El={})),function(t){t[t.V2NIM_P2P_MESSAGE_MUTE_MODE_OFF=0]="V2NIM_P2P_MESSAGE_MUTE_MODE_OFF",t[t.V2NIM_P2P_MESSAGE_MUTE_MODE_ON=1]="V2NIM_P2P_MESSAGE_MUTE_MODE_ON"}(Il||(Il={})),function(t){t[t.V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_NORMAL=1]="V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_NORMAL",t[t.V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_SUPER=2]="V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_SUPER",t[t.V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_ALL=3]="V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_ALL"}(Ml||(Ml={})),function(t){t[t.V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_ALL=0]="V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_ALL",t[t.V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_NORMAL=1]="V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_NORMAL",t[t.V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_MANAGER=2]="V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_MANAGER"}(Sl||(Sl={})),function(t){t[t.V2NIM_TEAM_TYPE_INVALID=0]="V2NIM_TEAM_TYPE_INVALID",t[t.V2NIM_TEAM_TYPE_ADVANCED=1]="V2NIM_TEAM_TYPE_ADVANCED",t[t.V2NIM_TEAM_TYPE_SUPER=2]="V2NIM_TEAM_TYPE_SUPER"}(Tl||(Tl={})),function(t){t[t.V2NIM_TEAM_JOIN_MODE_FREE=0]="V2NIM_TEAM_JOIN_MODE_FREE",t[t.V2NIM_TEAM_JOIN_MODE_APPLY=1]="V2NIM_TEAM_JOIN_MODE_APPLY",t[t.V2NIM_TEAM_JOIN_MODE_INVITE=2]="V2NIM_TEAM_JOIN_MODE_INVITE"}(Cl||(Cl={})),function(t){t[t.V2NIM_TEAM_AGREE_MODE_AUTH=0]="V2NIM_TEAM_AGREE_MODE_AUTH",t[t.V2NIM_TEAM_AGREE_MODE_NO_AUTH=1]="V2NIM_TEAM_AGREE_MODE_NO_AUTH"}(bl||(bl={})),function(t){t[t.V2NIM_TEAM_INVITE_MODE_MANAGER=0]="V2NIM_TEAM_INVITE_MODE_MANAGER",t[t.V2NIM_TEAM_INVITE_MODE_ALL=1]="V2NIM_TEAM_INVITE_MODE_ALL"}(Rl||(Rl={})),function(t){t[t.V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER=0]="V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER",t[t.V2NIM_TEAM_UPDATE_INFO_MODE_ALL=1]="V2NIM_TEAM_UPDATE_INFO_MODE_ALL"}(Al||(Al={})),function(t){t[t.V2NIM_TEAM_CHAT_BANNED_MODE_UNBAN=0]="V2NIM_TEAM_CHAT_BANNED_MODE_UNBAN",t[t.V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_NORMAL=1]="V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_NORMAL",t[t.V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_ALL=3]="V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_ALL"}(Nl||(Nl={})),function(t){t[t.V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER=0]="V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER",t[t.V2NIM_TEAM_UPDATE_EXTENSION_MODE_ALL=1]="V2NIM_TEAM_UPDATE_EXTENSION_MODE_ALL"}(Ol||(Ol={})),function(t){t[t.V2NIM_TEAM_MEMBER_ROLE_NORMAL=0]="V2NIM_TEAM_MEMBER_ROLE_NORMAL",t[t.V2NIM_TEAM_MEMBER_ROLE_OWNER=1]="V2NIM_TEAM_MEMBER_ROLE_OWNER",t[t.V2NIM_TEAM_MEMBER_ROLE_MANAGER=2]="V2NIM_TEAM_MEMBER_ROLE_MANAGER"}(wl||(wl={})),function(t){t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_APPLICATION=0]="V2NIM_TEAM_JOIN_ACTION_TYPE_APPLICATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_APPLICATION=1]="V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_APPLICATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_INVITATION=2]="V2NIM_TEAM_JOIN_ACTION_TYPE_INVITATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_INVITATION=3]="V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_INVITATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_ACCEPT_APPLICATION=4]="V2NIM_TEAM_JOIN_ACTION_TYPE_ACCEPT_APPLICATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_ACCEPT_INVITATION=5]="V2NIM_TEAM_JOIN_ACTION_TYPE_ACCEPT_INVITATION"}(xl||(xl={})),function(t){t[t.V2NIM_TEAM_JOIN_ACTION_STATUS_INIT=0]="V2NIM_TEAM_JOIN_ACTION_STATUS_INIT",t[t.V2NIM_TEAM_JOIN_ACTION_STATUS_AGREED=1]="V2NIM_TEAM_JOIN_ACTION_STATUS_AGREED",t[t.V2NIM_TEAM_JOIN_ACTION_STATUS_REJECTED=2]="V2NIM_TEAM_JOIN_ACTION_STATUS_REJECTED",t[t.V2NIM_TEAM_JOIN_ACTION_STATUS_EXPIRED=3]="V2NIM_TEAM_JOIN_ACTION_STATUS_EXPIRED"}(kl||(kl={})),function(t){t[t.teamApply=0]="teamApply",t[t.teamApplyReject=1]="teamApplyReject",t[t.teamInvite=2]="teamInvite",t[t.teamInviteReject=3]="teamInviteReject",t[t.tlistUpdate=4]="tlistUpdate",t[t.superTeamApply=15]="superTeamApply",t[t.superTeamApplyReject=16]="superTeamApplyReject",t[t.superTeamInvite=17]="superTeamInvite",t[t.superTeamInviteReject=18]="superTeamInviteReject"}(Pl||(Pl={})),function(t){t[t.V2NIM_AI_MODEL_TYPE_UNKNOW=0]="V2NIM_AI_MODEL_TYPE_UNKNOW",t[t.V2NIM_AI_MODEL_TYPE_QWEN=1]="V2NIM_AI_MODEL_TYPE_QWEN",t[t.V2NIM_AI_MODEL_TYPE_AZURE=2]="V2NIM_AI_MODEL_TYPE_AZURE",t[t.V2NIM_AI_MODEL_TYPE_PRIVATE=3]="V2NIM_AI_MODEL_TYPE_PRIVATE"}(Ll||(Ll={})),function(t){t[t.V2NIM_AI_MODEL_STREAM_CALL_STATUS_NONE=0]="V2NIM_AI_MODEL_STREAM_CALL_STATUS_NONE",t[t.V2NIM_AI_MODEL_STREAM_CALL_STATUS_CANCEL=2]="V2NIM_AI_MODEL_STREAM_CALL_STATUS_CANCEL",t[t.V2NIM_AI_MODEL_STREAM_CALL_STATUS_COMPLETE=4]="V2NIM_AI_MODEL_STREAM_CALL_STATUS_COMPLETE",t[t.V2NIM_AI_MODEL_STREAM_CALL_STATUS_EXCEPTION=5]="V2NIM_AI_MODEL_STREAM_CALL_STATUS_EXCEPTION"}(Dl||(Dl={})),function(t){t.V2NIM_AI_MODEL_ROLE_TYPE_SYSTEM="system",t.V2NIM_AI_MODEL_ROLE_TYPE_USER="user",t.V2NIM_AI_MODEL_ROLE_TYPE_ASSISTANT="assistant"}(ql||(ql={})),function(t){t[t.V2NIM_SIGNALLING_EVENT_TYPE_UNKNOWN=0]="V2NIM_SIGNALLING_EVENT_TYPE_UNKNOWN",t[t.V2NIM_SIGNALLING_EVENT_TYPE_CLOSE=1]="V2NIM_SIGNALLING_EVENT_TYPE_CLOSE",t[t.V2NIM_SIGNALLING_EVENT_TYPE_JOIN=2]="V2NIM_SIGNALLING_EVENT_TYPE_JOIN",t[t.V2NIM_SIGNALLING_EVENT_TYPE_INVITE=3]="V2NIM_SIGNALLING_EVENT_TYPE_INVITE",t[t.V2NIM_SIGNALLING_EVENT_TYPE_CANCEL_INVITE=4]="V2NIM_SIGNALLING_EVENT_TYPE_CANCEL_INVITE",t[t.V2NIM_SIGNALLING_EVENT_TYPE_REJECT=5]="V2NIM_SIGNALLING_EVENT_TYPE_REJECT",t[t.V2NIM_SIGNALLING_EVENT_TYPE_ACCEPT=6]="V2NIM_SIGNALLING_EVENT_TYPE_ACCEPT",t[t.V2NIM_SIGNALLING_EVENT_TYPE_LEAVE=7]="V2NIM_SIGNALLING_EVENT_TYPE_LEAVE",t[t.V2NIM_SIGNALLING_EVENT_TYPE_CONTROL=8]="V2NIM_SIGNALLING_EVENT_TYPE_CONTROL",t[t.V2NIM_SIGNALLING_EVENT_TYPE_KICK=9]="V2NIM_SIGNALLING_EVENT_TYPE_KICK"}(Vl||(Vl={})),function(t){t[t.V2NIM_SIGNALLING_CHANNEL_TYPE_AUDIO=1]="V2NIM_SIGNALLING_CHANNEL_TYPE_AUDIO",t[t.V2NIM_SIGNALLING_CHANNEL_TYPE_VIDEO=2]="V2NIM_SIGNALLING_CHANNEL_TYPE_VIDEO",t[t.V2NIM_SIGNALLING_CHANNEL_TYPE_CUSTOM=3]="V2NIM_SIGNALLING_CHANNEL_TYPE_CUSTOM"}(Ul||(Ul={})),function(t){t[t.V2NIM_USER_STATUS_TYPE_UNKNOWN=0]="V2NIM_USER_STATUS_TYPE_UNKNOWN",t[t.V2NIM_USER_STATUS_TYPE_LOGIN=1]="V2NIM_USER_STATUS_TYPE_LOGIN",t[t.V2NIM_USER_STATUS_TYPE_LOGOUT=2]="V2NIM_USER_STATUS_TYPE_LOGOUT",t[t.V2NIM_USER_STATUS_TYPE_DISCONNECT=3]="V2NIM_USER_STATUS_TYPE_DISCONNECT"}(Gl||(Gl={}));var jl={V2NIM_ERROR_CODE_UNKNOWN:{code:0,message:"unknown error"},V2NIM_ERROR_CODE_SUCCESS:{code:200,message:"success"},V2NIM_ERROR_CODE_HANDSHAKE:{code:201,message:"handshake error"},V2NIM_ERROR_CODE_REQUEST_TEMPERARY_FORBIDDEN:{code:398,message:"request temprary forbidden"},V2NIM_ERROR_CODE_SERVER_UNIT_ERROR:{code:399,message:"server unit error"},V2NIM_ERROR_CODE_FORBIDDEN:{code:403,message:"forbidden"},V2NIM_ERROR_CODE_NOT_FOUND:{code:404,message:"not found"},V2NIM_ERROR_CODE_PARAMETER_ERROR:{code:414,message:"parameter error"},V2NIM_ERROR_CODE_RATE_LIMIT_REACHED:{code:416,message:"rate limit reached"},V2NIM_ERROR_CODE_MULTI_LOGIN_FORBIDDEN:{code:417,message:"multi login forbidden"},V2NIM_ERROR_CODE_SERVER_INTERNAL_ERROR:{code:500,message:"server internal error"},V2NIM_ERROR_CODE_SERVER_BUSY:{code:503,message:"server busy"},V2NIM_ERROR_CODE_APP_UNREACHABLE:{code:511,message:"app server unreachable"},V2NIM_ERROR_CODE_SERVICE_UNAVAILABLE:{code:514,message:"service unavailable"},V2NIM_ERROR_CODE_PROTOCOL_BLACKHOLE_FILTERED:{code:599,message:"protocol filtered by blackhole rule"},V2NIM_ERROR_CODE_NO_PERMISSION:{code:997,message:"appid has no permission to call the protocol"},V2NIM_ERROR_CODE_UNPACK_ERROR:{code:998,message:"unpack error"},V2NIM_ERROR_CODE_PACK_ERROR:{code:999,message:"pack error"},V2NIM_ERROR_CODE_IM_DISABLED:{code:101301,message:"IM disabled"},V2NIM_ERROR_CODE_SERVICE_ADDRESS_INVALID:{code:101302,message:"service address invalid"},V2NIM_ERROR_CODE_APPKEY_NOT_EXIST:{code:101303,message:"appkey not exist"},V2NIM_ERROR_CODE_BUNDLEID_CHECK_FAILED:{code:101304,message:"bundleid check failed"},V2NIM_ERROR_CODE_APPKEY_BLOCKED:{code:101403,message:"appkey blocked"},V2NIM_ERROR_CODE_INVALID_TOKEN:{code:102302,message:"invalid token"},V2NIM_ERROR_CODE_ROBOT_NOT_ALLOWED:{code:102303,message:"robot not allowed"},V2NIM_ERROR_CODE_ACCOUNT_NOT_EXIST:{code:102404,message:"account not exist"},V2NIM_ERROR_CODE_ACCOUNT_CHAT_BANNED:{code:102421,message:"account chat banned"},V2NIM_ERROR_CODE_ACCOUNT_BANNED:{code:102422,message:"account banned"},V2NIM_ERROR_CODE_ACCOUNT_IN_BLOCK_LIST:{code:102426,message:"account in block list"},V2NIM_ERROR_CODE_USER_PROFILE_NOT_EXIST:{code:103404,message:"user profile not exist"},V2NIM_ERROR_CODE_USER_PROFILE_HIT_ANTISPAM:{code:103451,message:"user profile hit antispam"},V2NIM_ERROR_CODE_PEER_FRIEND_LIMIT:{code:104301,message:"peer friend limit"},V2NIM_ERROR_CODE_FRIEND_APPLICATION_NOT_EXIST:{code:104302,message:"friend application not exist"},V2NIM_ERROR_CODE_FRIEND_NOT_EXIST:{code:104404,message:"friend not exist"},V2NIM_ERROR_CODE_FRIEND_ALREADY_EXIST:{code:104405,message:"friend already exist"},V2NIM_ERROR_CODE_SELF_FRIEND_OPERATION_NOT_ALLOWED:{code:104429,message:"self friend operation not allowed"},V2NIM_ERROR_CODE_FRIEND_LIMIT:{code:104435,message:"friend limit"},V2NIM_ERROR_CODE_FRIEND_OPERATION_RATE_LIMIT:{code:104449,message:"friend operation rate limit"},V2NIM_ERROR_CODE_FRIEND_HIT_ANTISPAM:{code:104451,message:"friend hit antispam"},V2NIM_ERROR_CODE_SELF_MUTE_OPERATION_NOT_ALLOWED:{code:105429,message:"self mute operation not allowed"},V2NIM_ERROR_CODE_MUTE_LIST_LIMIT:{code:105435,message:"mute list limit"},V2NIM_ERROR_CODE_SELF_BLOCK_LIST_OPERATION_NOT_ALLOWED:{code:106429,message:"self block list operation not allowed"},V2NIM_ERROR_CODE_BLOCK_LIST_LIMIT:{code:106435,message:"block list limit"},V2NIM_ERROR_CODE_REVOKE_THIRD_PARTY_MESSAGE_NOT_ALLOWED:{code:107301,message:"revoke third party message not allowed"},V2NIM_ERROR_CODE_SHORT_TO_LONG_URL_FAILED:{code:107307,message:"short to long URL failed"},V2NIM_ERROR_CODE_URL_INVALID:{code:107308,message:"URL invalid"},V2NIM_ERROR_CODE_DURATION_OUT_OF_RANGE:{code:107309,message:"duration out of range"},V2NIM_ERROR_CODE_GET_FILE_META_INFO_FAILED:{code:107310,message:"get file meta info failed"},V2NIM_ERROR_CODE_AUDIO_FILE_SIZE_LIMIT:{code:107311,message:"audio file size limit"},V2NIM_ERROR_CODE_VOICE_TO_TEXT_TIMEOUT:{code:107312,message:"voice to text timeout"},V2NIM_ERROR_CODE_VOICE_TO_TEXT_FAILED:{code:107313,message:"voice to text failed"},V2NIM_ERROR_CODE_REVOKE_EXCEED_TIME_LIMIT:{code:107314,message:"revoke message exceed time limit"},V2NIM_ERROR_CODE_REVOKE_MESSAGE_NOT_ALLOWED:{code:107315,message:"revoke specific message not allowed"},V2NIM_ERROR_CODE_FORCE_PUSH_LIST_LIMIT:{code:107316,message:"force push list limit"},V2NIM_ERROR_CODE_TEAM_MESSAGE_RECEIPT_RATE_LIMIT:{code:107317,message:"team message receipt rate limit"},V2NIM_ERROR_CODE_SNAPSHOT_NOT_EXIST:{code:107318,message:"snapshot not exist"},V2NIM_ERROR_CODE_PIN_LIMIT:{code:107319,message:"pin limit"},V2NIM_ERROR_CODE_PIN_NOT_EXIST:{code:107320,message:"pin not exist"},V2NIM_ERROR_CODE_QUICK_COMMENT_LIMIT:{code:107321,message:"quick comment limit"},V2NIM_ERROR_CODE_PIN_ALREADY_EXIST:{code:107322,message:"pin already exist"},V2NIM_ERROR_CODE_VOICE_TO_TEXT_FUNCTION_DISABLED:{code:107333,message:"voice to text function disabled"},V2NIM_ERROR_CODE_CLOUD_SEARCH_FUNCTION_DISABLED:{code:107334,message:"cloud search function disabled"},V2NIM_ERROR_CODE_ONE_WAY_DELETE_FUNCTION_DISABLED:{code:107335,message:"one-way delete function disabled"},V2NIM_ERRPR_CODE_ONEWAY_DELETION_NOT_ALLOW_FOR_TARGET_MESSAGES:{code:107338,message:"one-way deletion is not allowed for target messages"},V2NIM_ERRPR_CODE_SENDER_CANNOT_INCLUDED_IN_TARGET_LIST:{code:107339,message:"The message sender cannot be included in the target list"},V2NIM_ERROR_CODE_ROBOT_CANNOT_SEND_TARGET_MESSAGE:{code:107340,message:"Robot can not send target message"},V2NIM_ERROR_CODE_PIN_TARGET_MESSAGE_NOT_ALLOWED:{code:107345,message:"Pin target message is not allowed"},V2NIM_ERROR_CODE_TARGET_MESSAGE_NOT_ALLOWED_REPLY:{code:107346,message:"Target message not allowed reply"},V2NIM_ERROR_CODE_TARGET_MESSAGE_NOT_ALLOWED_QUICK_COMMENT:{code:107347,message:"Target message not allowed quick comment"},V2NIM_ERROR_CODE_REVOKE_MESSAGE_TO_SELF_NOT_ALLOWED:{code:107429,message:"revoke message to self not allowed"},V2NIM_ERROR_CODE_APP_CHAT_BANNED:{code:107410,message:"app chat banned"},V2NIM_ERROR_CODE_QUICK_COMMENT_FUNCTION_DISABLED:{code:107326,message:"quick comment function disabled"},V2NIM_ERROR_CODE_PIN_FUNCTION_DISABLED:{code:107327,message:"PIN function disabled"},V2NIM_ERROR_CODE_TEAM_READ_RECEIPT_FUNCTION_DISABLED:{code:107324,message:"read receipt for team messages function disabled"},V2NIM_ERROR_CODE_P2P_READ_RECEIPT_FUNCTION_DISABLED:{code:107325,message:"read receipt for p2p messages function disabled"},V2NIM_ERROR_CODE_RATE_LIMIT_FOR_MESSAGING_REACHED:{code:107323,message:"rate limit for messaging reached"},V2NIM_ERROR_CODE_MESSAGE_HIT_ANTISPAM:{code:107451,message:"message hit antispam"},V2NIM_ERROR_CODE_MESSAGE_NOT_EXIST:{code:107404,message:"message not exist"},V2NIM_ERROR_CODE_UNSENDING_MESSAGE_EXPIRED:{code:107406,message:"unsending message expired"},V2NIM_ERROR_CODE_TEAM_MARK_READ_FAILED:{code:107302,message:"sending message failed for marking message read failed for too many team members"},V2NIM_ERROR_CODE_SENDER_OR_MANAGER_PERMISSION_ONLY_REVOKE:{code:107303,message:"only sender or manager can revoke message"},V2NIM_ERROR_CODE_DELETE_SELF_MESSAGE_NOT_ALLOWED:{code:107328,message:"delete self message not allowed"},V2NIM_ERROR_CODE_NOT_CHATBOT_ACCOUNT:{code:107329,message:"is not chatbot account"},V2NIM_ERROR_CODE_MESSAGE_SENSE_REQUIRED:{code:107330,message:"sender or receiver must sense message"},V2NIM_ERROR_CODE_HIGH_PRIORITY_MESSAGE_RATE_LIMIT:{code:107304,message:"rate limit of high-priority messages exceeded"},ACK_MESSAGE_BE_HIGH_PRIORITY:{code:107305,message:"ack message should be high-priority"},V2NIM_ERROR_CODE_DUPLICATE_CLIENT_MESSAGE_ID:{code:107306,message:"duplicate client message ID"},V2NIM_ERROR_CODE_INVALID_TIME_RANGE:{code:107439,message:"invalid time range"},V2NIM_ERROR_CODE_NOT_ADVANCED_TEAM:{code:108302,message:"not advanced team"},V2NIM_ERROR_CODE_TEAM_MANAGER_LIMIT:{code:108303,message:"team manager limit"},V2NIM_ERROR_CODE_JOINED_TEAM_LIMIT:{code:108305,message:"joined team limit"},V2NIM_ERROR_CODE_TEAM_NORMAL_MEMBER_CHAT_BANNED:{code:108306,message:"team normal member chat banned"},V2NIM_ERROR_CODE_INVITED_ACCOUNT_NOT_FRIEND:{code:108307,message:"invited account not friend"},V2NIM_ERROR_CODE_REJECT_ALL_TEAM_APPLICATIONS:{code:108308,message:"reject all team applications"},V2NIM_ERROR_CODE_TARGETING_MESSAGE_FOR_TEAM_DISABLED:{code:108318,message:"Targeting messages for group chat is disabled"},V2NIM_ERROR_CODE_INCLUSIVE_AS_FALSE_NOT_ALLOWED_FOR_SUPER_TEAM:{code:108319,message:'Setting "inclusive" to false for super teams is not allowed'},V2NIM_ERROR_CODE_CANNOT_MAKE_SUPER_TEAM_MESSAGE_VISIBLE_TO_NEW_MEMBERS:{code:108320,message:"Cannot make super team targeted messages visible to new members"},V2NIM_ERROR_CODE_CANNOT_ALLOW_TARGETED_MESSAGES_INCLUSIVE_TO_NEW_MEMBERS:{code:108321,message:"Cannot allow targeted messages inclusive to new members"},V2NIM_ERROR_CODE_TEAM_NOT_EXIST:{code:108404,message:"team not exist"},V2NIM_ERROR_CODE_TEAM_ALREADY_CHAT_BANNED:{code:108420,message:"team already chat banned"},V2NIM_ERROR_CODE_ALL_TEAM_MEMBER_CHAT_BANNED:{code:108423,message:"all team member chat banned"},V2NIM_ERROR_CODE_EXTENDED_SUPER_TEAM_LIMIT:{code:108434,message:"extended super team limit"},V2NIM_ERROR_CODE_CREATED_TEAM_LIMIT:{code:108435,message:"created team limit"},V2NIM_ERROR_CODE_TEAM_INVITATION_LIMIT:{code:108437,message:"team invitation limit"},V2NIM_ERROR_CODE_TEAM_HIT_ANTISPAM:{code:108451,message:"team hit antispam"},V2NIM_ERROR_CODE_EXTENDED_SUPER_TEAM_LIMIT_NOT_CONFIGURED:{code:108304,message:"extended super team limit not configured"},V2NIM_ERROR_CODE_SUPER_TEAM_SERVICE_DISABLED:{code:108311,message:"super team service disabled"},V2NIM_ERROR_CODE_TEAM_READ_RECEIPT_RECORD_NOT_FOUND:{code:108301,message:"read receipt record for the team message not found"},V2NIM_ERROR_CODE_NOT_MANAGER:{code:108430,message:"unable to assign owner manager"},V2NIM_ERROR_CODE_ONLINE_MEMBER_COUNT_DISABLED:{code:108406,message:"number of online users service disabled"},V2NIM_ERROR_CODE_TRANSFER_DISABLED:{code:108310,message:"unable to transfer the ownership to owner"},V2NIM_ERROR_CODE_CREATE_TEAM_DISABLED:{code:108309,message:"unable to create team with more than %s people"},V2NIM_ERROR_CODE_EXTENDED_SUPER_TEAM_CREATE_FAILED:{code:108313,message:"/ extended super team creation failed,use open api to create the team"},V2NIM_ERROR_CODE_TEAM_MESSAGE_READ_RECEIPT_DISABLED:{code:108312,message:"read receipt for team messages function disabled"},V2NIM_ERROR_CODE_RETRY:{code:108449,message:"an error occurred, try again"},V2NIM_ERROR_CODE_CHAT_BAN_LIST_CONTAIN_NOT_TEAM_MEMBER:{code:109301,message:"list of chat banned users contains non team members"},V2NIM_ERROR_CODE_CHAT_BAN_LIST_CONTAIN_OPERATOR:{code:109303,message:"list of chat banned users contains the operator"},V2NIM_ERROR_CODE_CHAT_BAN_LIST_CONTAIN_TEAM_OWNER:{code:109304,message:"list of chat banned users contains the team owner"},V2NIM_ERROR_CODE_OPERATION_ON_TEAM_MANAGER_NOT_ALLOWED:{code:109305,message:"operation on team manager not allowed"},V2NIM_ERROR_CODE_NO_TEAM_INVITE_PERMISSION:{code:109306,message:"no team invite permission"},V2NIM_ERROR_CODE_TEAM_OWNER_QUIT_NOT_ALLOWED:{code:109307,message:"team owner quit not allowed"},V2NIM_ERROR_CODE_TEAM_OWNER_IN_KICK_LIST:{code:109308,message:"list of kicked user contains the team owner"},V2NIM_ERROR_CODE_INVITE_ROBOT_ACCOUNT_NOT_ALLOWED:{code:109309,message:"invite robot account not allowed"},V2NIM_ERROR_CODE_KICK_OPERATOR_NOT_ALLOWED:{code:109310,message:"kick operator not allowed"},V2NIM_ERROR_CODE_TEAM_MEMBER_ALREADY_EXIST:{code:109311,message:"team member already exist"},V2NIM_ERROR_CODE_TEAM_INVITATION_OR_APPLICATION_NOT_EXIST:{code:109313,message:"team invitation or application not exist"},V2NIM_ERROR_CODE_OPERATION_ON_TEAM_OWNER_NOT_ALLOWED:{code:109314,message:"operation on team owner not allowed"},V2NIM_ERROR_CODE_FORCED_PUSH_LIST_INCLUDES_NON_TARGETED_ACCOUNTS:{code:109318,message:"The forced push list includes non-targeted accounts"},V2NIM_ERROR_CODE_TEAM_MEMBER_NOT_EXIST:{code:109404,message:"team member not exist"},V2NIM_ERROR_CODE_TEAM_MEMBER_CHAT_BANNED:{code:109424,message:"team member chat banned"},V2NIM_ERROR_CODE_TEAM_OWNER_OPERATION_PERMISSION_REQUIRED:{code:109427,message:"team owner operation permission required"},V2NIM_ERROR_CODE_TEAM_OWNER_OR_MANAGER_OPERATION_PERMISSION_REQUIRED:{code:109432,message:"team owner or manager operation permission required"},V2NIM_ERROR_CODE_TEAM_MEMBER_CONCURRENT_OPERATION_FAILED:{code:109449,message:"team member concurrent operation failed"},V2NIM_ERROR_CODE_TEAM_MEMBER_HIT_ANTISPAM:{code:109451,message:"team member hit antispam"},V2NIM_ERROR_CODE_CONVERSATION_AND_ACCOUNT_MISMATCH:{code:110302,message:"conversation and account mismatch"},V2NIM_ERROR_CODE_CONVERSATION_STICK_TOP_LIMIT:{code:110303,message:"conversation stick top limit"},V2NIM_ERROR_CODE_CONVERSATION_BELONGED_GROUP_LIMIT:{code:110304,message:"conversation belonged group limit"},V2NIM_ERROR_CODE_CONVERSATION_IS_NOT_STICK_TOP:{code:110305,message:"conversation is not stick top"},V2NIM_ERROR_CODE_STICK_TOP_DISABLED:{code:110306,message:"conversation stick top disabled"},V2NIM_ERROR_CODE_CONVERSATION_NOT_EXIST:{code:110404,message:"conversation not exist"},V2NIM_ERROR_CODE_CHATROOM_LINK_UNAVAILABLE:{code:113304,message:"chatroom link unavailable"},V2NIM_ERROR_CODE_IM_CONNECTION_ABNORMAL:{code:113305,message:"IM connection abnormal"},V2NIM_ERROR_CODE_CHATROOM_NOT_EXIST:{code:113404,message:"chatroom not exist"},V2NIM_ERROR_CODE_CHATROOM_CLOSED:{code:113406,message:"chatroom closed"},V2NIM_ERROR_CODE_CHATROOM_REPEATED_OPERATION:{code:113409,message:"chatroom repeated operation"},V2NIM_ERROR_CODE_CHATROOM_DISABLED:{code:113410,message:"chatroom disabled"},V2NIM_ERROR_CODE_ALL_CHATROOM_MEMBER_CHAT_BANNED:{code:113423,message:"all chatroom member chat banned"},V2NIM_ERROR_CODE_CHATROOM_HIT_ANTISPAM:{code:113451,message:"chatroom hit antispam"},V2NIM_ERROR_CODE_ANONYMOUS_MEMBER_FORBIDDEN:{code:114303,message:"anonymous member forbidden"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_NOT_EXIST:{code:114404,message:"chatroom member not exist"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_REPEATED_OPERATION:{code:114405,message:"chatroom member repeated operation"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_CHAT_BANNED:{code:114421,message:"chatroom member chat banned"},V2NIM_ERROR_CODE_ACCOUNT_IN_CHATROOM_BLOCK_LIST:{code:114426,message:"account in chatroom block list"},V2NIM_ERROR_CODE_CHATROOM_OWNER_OPERATION_PERMISSION_REQUIRED:{code:114427,message:"chatroom owner operation permission required"},V2NIM_ERROR_CODE_SELF_IN_CHATROOM_MEMBER_OPERATION_LIST:{code:114429,message:"self in chatroom member operation list"},V2NIM_ERROR_CODE_CHATROOM_OWNER_OR_MANAGER_OPERATION_PERMISSION_REQUIRED:{code:114432,message:"chatroom owner or manager operation permission required"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_LIMIT:{code:114437,message:"chatroom member limit"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_CONCURRENT_OPERATION_FAILED:{code:114449,message:"chatroom member concurrent operation failed"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_HIT_ANTISPAM:{code:114451,message:"chatroom member hit antispam"},V2NIM_ERROR_CODE_CONVERSATION_GROUP_NOT_EXIST:{code:116404,message:"conversation group not exist"},V2NIM_ERROR_CODE_CONVERSATION_GROUP_LIMIT:{code:116435,message:"conversation group limit"},V2NIM_ERROR_CODE_CONVERSATIONS_IN_GROUP_LIMIT:{code:116437,message:"conversations in group limit"},V2NIM_ERROR_CODE_COLLECTION_LIMIT:{code:189301,message:"collection limit"},V2NIM_ERROR_CODE_COLLECTION_NOT_EXIST:{code:189302,message:"collection not exist"},V2NIM_ERROR_CODE_COLLECTION_CONCURRENT_OPERATION_FAILED:{code:189449,message:"collection concurrent operation failed"},V2NIM_ERROR_CODE_INTERNAL:{code:190001,message:"internal error"},V2NIM_ERROR_CODE_ILLEGAL_STATE:{code:190002,message:"illegal state"},V2NIM_ERROR_CODE_MISUSE:{code:191001,message:"misuse"},V2NIM_ERROR_CODE_CANCELLED:{code:191002,message:"operation cancelled"},V2NIM_ERROR_CODE_CALLBACK_FAILED:{code:191003,message:"callback failed"},V2NIM_ERROR_CODE_INVALID_PARAMETER:{code:191004,message:"invalid parameter"},V2NIM_ERROR_CODE_TIMEOUT:{code:191005,message:"timeout"},V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST:{code:191006,message:"resource not exist"},V2NIM_ERROR_CODE_RESOURCE_ALREADY_EXIST:{code:191007,message:"resource already exist"},V2NIM_ERROR_CODE_CONNECT_FAILED:{code:192001,message:"connect failed"},V2NIM_ERROR_CODE_CONNECT_TIMEOUT:{code:192002,message:"connect timeout"},V2NIM_ERROR_CODE_DISCONNECT:{code:192003,message:"disconnect"},V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT:{code:192004,message:"protocol timeout"},V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED:{code:192005,message:"protocol send failed"},V2NIM_ERROR_CODE_REQUEST_FAILED:{code:192006,message:"request failed"},V2NIM_ERROR_CODE_FILE_NOT_FOUND:{code:194001,message:"file not found"},V2NIM_ERROR_CODE_FILE_CREATE_FAILED:{code:194002,message:"file create failed"},V2NIM_ERROR_CODE_FILE_OPEN_FAILED:{code:194003,message:"file open failed"},V2NIM_ERROR_CODE_FILE_WRITE_FAILED:{code:194004,message:"file write failed"},V2NIM_ERROR_CODE_FILE_READ_FAILED:{code:194005,message:"file read failed"},V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:{code:194006,message:"file upload failed"},V2NIM_ERROR_CODE_FILE_DOWNLOAD_FAILED:{code:194007,message:"file download failed"},V2NIM_ERROR_CODE_CLIENT_ANTISPAM:{code:195001,message:"client anti-spam"},V2NIM_ERROR_CODE_SERVER_ANTISPAM:{code:195002,message:"server anti-spam"},V2NIM_ERROR_CODE_STREAM_OUTPUT_STOPPED:{code:189318,message:"Streaming text response stopped"},V2NIM_ERROR_CODE_STREAM_OUTPUT_GENERATED:{code:189319,message:"Streaming text response generated"},V2NIM_ERROR_CODE_STREAM_OUTPUT_ABORTED:{code:189320,message:"Streaming text response aborted due to exception"},V2NIM_ERROR_CODE_INTERRUPTION_REJECTED:{code:189321,message:"Non-streaming messages cannot be interrupted"}},Yl=es(jl),Wl=reduce(Yl).call(Yl,(function(t,i){var u=jl[i];return t[i]=u.code,t}),{}),$l=reduce(Yl).call(Yl,(function(t,i){var u=jl[i];return t[u.code]=u.message,t}),{}),Hl=function(t){function V2NIMErrorImpl(i){var u;return(u=t.call(this,i.desc)||this).name="V2NIMError",u.code=i.code||0,u.desc=i.desc||$l[u.code]||Zl[u.code]||"",u.message=u.desc,u.detail=i.detail||{},u}return bt(V2NIMErrorImpl,t),V2NIMErrorImpl.prototype.toString=function toString(){var t,i=this.name+"\n code: "+this.code+'\n message: "'+this.message+'"\n detail: '+(this.detail?Ms(this.detail):"");return(null===(t=null==this?void 0:this.detail)||void 0===t?void 0:t.rawError)&&(i+="\n rawError: "+this.detail.rawError.message),i},V2NIMErrorImpl}(Pc(Error));var Ql=function(t){function ValidateError(i,u,h){var m;return void 0===u&&(u={}),(m=t.call(this,{code:Wl.V2NIM_ERROR_CODE_PARAMETER_ERROR,detail:{reason:i,rules:h,data:u}})||this).name="validateError",m.message=m.message+"\n"+Ms(m.detail,null,2),m.data=u,m.rules=h,m}return bt(ValidateError,t),ValidateError}(Hl),Kl=function(t){function ValidateErrorV2(i){var u,h,m,v;return(u=t.call(this,{code:Wl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:null===(h=i.detail)||void 0===h?void 0:h.reason,rules:null===(m=i.detail)||void 0===m?void 0:m.rules,data:null===(v=i.detail)||void 0===v?void 0:v.data}})||this).name="ValidateErrorV2",u}return bt(ValidateErrorV2,t),ValidateErrorV2}(Hl),zl=function(t){function FormatError(i,u,h){var m;return(m=t.call(this,{code:Wl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:i,key:u,rules:h}})||this).name="formatError",m}return bt(FormatError,t),FormatError}(Hl),Jl=function(t){function UploadError(i){var u;return(u=t.call(this,xt({code:400},i))||this).desc=u.desc||"upload file error",u.message=u.desc,u.name="uploadError",u}return bt(UploadError,t),UploadError}(Hl),Xl=function(t){function CustomError(i,u,h){var m;return void 0===u&&(u={}),void 0===h&&(h=400),(m=t.call(this,{code:h,desc:i,detail:u})||this).name="customError",m.data=u,m}return bt(CustomError,t),CustomError}(Hl),Zl={200:null,406:null,808:null,810:null,302:"The user name or password is incorrect.",405:"Parameter length too long",408:"Client request timed out",415:"Client network unavailable",422:"Account disabled",508:"Expiration date",509:"Invalid",7101:"Be pulled black",700:"Partial failure of batch operation",801:"The number of people in the team has reached the upper limit",802:"No permission",803:"The team does not exist or has not changed",804:"The user is not in the team",805:"Team type mismatch",806:"The number of teams created has reached the limit",807:"Team member not valid",809:"Already in the team",811:"The number of accounts in the forced push list exceeds the limit",812:"The team is muted",813:"Due to the limited number of team, some pull people successfully",814:"Disable team message read service",815:"Maximum number of team administrators",816:"Batch operation partial failure",9102:"Channel failure",9103:"This call has been answered / rejected at another end",10201:"Signaling: target NIM client is offline",10202:"Signaling: push is unreachable",10404:"Signaling: channel not exists",10405:"Signaling: channel already exists",10406:"Signaling: member of channel not exists",10407:"Signaling: member of channel already exists",10408:"Signaling: the invitation request does not exist or has expired",10409:"Signaling: the invitation request has been rejected",10410:"Signaling: the invitation request has been accepted",10414:"Signaling: request parameter error",10417:"Signaling: uid conflict",10419:"Signaling: the number of members of channel exceed the limit",10420:"Signaling: member is already in the channel on other client",10700:"Signaling: phased success",13002:"Abnormal chatroom status",13003:"In the blacklist",13004:"In the mute list",13006:"All members are muted, and only the administrator can speak"};var eu=Gs.trim,tu=m.parseInt,ru=m.Symbol,nu=ru&&ru.iterator,au=/^[+-]?0x/i,ou=N(au.exec),iu=8!==tu(Ls+"08")||22!==tu(Ls+"0x16")||nu&&!fails((function(){tu(Object(nu))}))?function parseInt(t,i){var u=eu(toString(t));return tu(u,i>>>0||(ou(au,u)?16:10))}:tu;_export({global:!0,forced:parseInt!=iu},{parseInt:iu});var su=W.parseInt;function get(t,i){if("object"!=typeof t||null===t)return t;for(var u=(i=i||"").split("."),h=0;h<u.length;h++){var m=u[h],v=t[m],E=indexOf(m).call(m,"["),I=indexOf(m).call(m,"]");if(-1!==E&&-1!==I&&E<I){var M=slice(m).call(m,0,E),S=su(slice(m).call(m,E+1,I));v=t[M],v=Qs(v)?v[S]:void 0}if(null==v)return v;t=v}return t}var cu,lu=(cu=function _s4(){return(65536*(1+Math.random())|0).toString(16).substring(1)},function(){return cu()+cu()+cu()+cu()+cu()+cu()+cu()+cu()});function getEnumKeys(t){var i;return filter(i=es(t)).call(i,(function(t){return!(+t>=0)}))}function getEnumKeyByEnumValue(t,i){var u,h=filter(u=es(t)).call(u,(function(u){return t[u]==i}));return h.length>0?h[0]:void 0}function assignOptions(t,i){return function assignWith(t,i,u,h){for(var m in t=t||{},u=u||{},h=h||function(){},i=i||{}){var v=h(t[m],i[m]);t[m]=void 0===v?i[m]:v}for(var E in u){var I=h(t[E],u[E]);t[E]=void 0===I?u[E]:I}return t}({},t,i,(function(t,i){return void 0===i?t:i}))}function emptyFuncWithPromise(){return Ja.resolve()}var uu,du,pu={file:{md5:"$(Etag)",size:"$(ObjectSize)"},image:{md5:"$(Etag)",size:"$(ObjectSize)",w:"$(ImageInfo.Width)",h:"$(ImageInfo.Height)",orientation:"$(ImageInfo.Orientation)"},audio:{md5:"$(Etag)",size:"$(ObjectSize)",dur:"$(AVinfo.Audio.Duration)"},video:{md5:"$(Etag)",size:"$(ObjectSize)",dur:"$(AVinfo.Video.Duration)",w:"$(AVinfo.Video.Width)",h:"$(AVinfo.Video.Height)"}},hu={accessKeyId:"",secretAccessKey:"",sessionToken:"",region:"",maxRetries:0,bucket:"",objectName:"",token:"",shortUrl:""};function getUploadResponseFormat(t){return void 0===t&&(t="file"),Ms(pu[t]||{}).replace(/"/gi,'\\"')}!function(t){t[t.nos=1]="nos",t[t.s3=2]="s3"}(uu||(uu={})),function(t){t[t.dontNeed=-1]="dontNeed",t[t.time=2]="time",t[t.urls=3]="urls"}(du||(du={}));var mu={chunkUploadHost:"https://wannos-web.127.net",chunkUploadHostBackupList:["https://fileup.chatnos.com","https://oss.chatnos.com"],commonUploadHost:"https://fileup.chatnos.com",commonUploadHostBackupList:["https://upload.chatnos.com","https://oss.chatnos.com"],chunkMaxSize:4194304e4,commonMaxSize:104857600,uploadReplaceFormat:"https://{host}/{object}",cdn:{defaultCdnDomain:"nim-nosdn.netease.im",cdnDomain:"",bucket:"nim",objectNamePrefix:""},downloadUrl:"https://{bucket}-nosdn.netease.im/{object}",downloadHostList:["nos.netease.com"],nosCdnEnable:!0,isNeedToGetUploadPolicyFromServer:!0};function pickBy(t,i){t=t||{},i=i||function(){return!0};var u={};for(var h in t)i(t[h])&&(u[h]=t[h]);return u}var fu=function(){function NOS(t,i){this.nosCdnHostTimer=0,this.nosErrorCount=0,this.core=t,this.cloudStorage=i}var t=NOS.prototype;return t.reset=function reset(){this.nosErrorCount=0},t.getNosAccessToken=function getNosAccessToken(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i,u,h;return ms.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.core.sendCmd("getNosAccessToken",{tag:t});case 2:return i=m.sent,u=get(i,"content.nosAccessTokenTag.token"),h=t.url,m.abrupt("return",{token:u,url:-1!==indexOf(h).call(h,"?")?h+"&token="+u:h+"?token="+u});case 6:case"end":return m.stop()}}),_callee,this)})))},t.deleteNosAccessToken=function deleteNosAccessToken(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){return ms.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.core.sendCmd("deleteNosAccessToken",{tag:t});case 2:case"end":return i.stop()}}),_callee2,this)})))},t.nosUpload=function nosUpload(t,i,u){var h,m,v,E,I,M,S,T,C,R;return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var A,N,O,w,x,k,P,L,D,q,V,U,G,B,j,Y,W,$,H,Q,K,z;return ms.wrap((function _callee3$(J){for(;;)switch(J.prev=J.next){case 0:if(A=get(this.core,"config.cdn.bucket"),N={tag:t.nosScenes||A||"nim"},t.nosSurvivalTime&&(N.expireSec=t.nosSurvivalTime),(O=this.core.adapters.getFileUploadInformation(t))&&O.complete&&i.destroy(),!(!u&&!O)){J.next=20;break}return J.prev=7,J.next=10,this.core.sendCmd("getNosToken",{responseBody:getUploadResponseFormat(t.type),nosToken:N});case 10:w=J.sent,J.next=20;break;case 13:if(J.prev=13,J.t0=J.catch(7),this.core.logger.error("uploadFile:: getNosToken error",J.t0),i.destroy(),!(J.t0 instanceof Hl)){J.next=19;break}throw J.t0;case 19:throw new Jl({code:"v2"===get(this.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"getNosToken error",rawError:J.t0,curProvider:1}});case 20:return x=this.config.uploadReplaceFormat.replace("{bucket}",this.config.cdn.bucket).replace("{host}",this.config.cdn.cdnDomain||this.config.cdn.defaultCdnDomain).replace("{object}",O?null===(h=O.uploadInfo)||void 0===h?void 0:h.objectName:u?null==u?void 0:u.objectName:w.content.nosToken.objectName),k="",u&&u.shortUrl&&(k=u.shortUrl),(null===(E=null===(v=null===(m=null==O?void 0:O.uploadInfo)||void 0===m?void 0:m.payload)||void 0===v?void 0:v.mixStoreToken)||void 0===E?void 0:E.shortUrl)&&(k=O.uploadInfo.payload.mixStoreToken.shortUrl),P=k||x,J.prev=25,D=O?{token:null===(I=null==O?void 0:O.uploadInfo)||void 0===I?void 0:I.token,bucket:null===(M=null==O?void 0:O.uploadInfo)||void 0===M?void 0:M.bucketName,objectName:null===(S=null==O?void 0:O.uploadInfo)||void 0===S?void 0:S.objectName}:u||w.content.nosToken,this.core.logger.log("uploadFile:: uploadFile params",{nosToken:D,chunkUploadHost:this.config.chunkUploadHost,chunkUploadHostBackupList:this.config.chunkUploadHostBackupList,commonUploadHost:this.config.commonUploadHost,commonUploadHostBackupList:this.config.commonUploadHostBackupList,platform:Ks.platform}),q="BROWSER"===Ks.platform?this.config.chunkUploadHost:this.config.commonUploadHost+"/"+(D&&D.bucket),V="UNIAPP"===Ks.platform||"MINIAPP"===(null===(T=Ks.getSystemInfo())||void 0===T?void 0:T.libEnv)?4:u?2:0,U=t.filePath?t.filePath:"object"==typeof t.file?t.file.name:"",i.update({remote_addr:q,operation_type:V}),U&&i.update({local_file:U}),J.next=35,this.core.adapters.uploadFile(xt(xt(xt(xt({},t),{nosToken:D,chunkUploadHost:this.config.chunkUploadHost,chunkUploadHostBackupList:this.config.chunkUploadHostBackupList,commonUploadHost:this.config.commonUploadHost,commonUploadHostBackupList:this.config.commonUploadHostBackupList,maxSize:t.maxSize||this.config.chunkMaxSize}),u?{payload:{mixStoreToken:u}}:{}),{onUploadInfo:function onUploadInfo(t){i.update(xt({},t))}}),i);case 35:L=J.sent,J.next=70;break;case 38:if(J.prev=38,J.t1=J.catch(25),this.core.logger.error("uploadFile::nos uploadFile error:",J.t1),G="v2"===get(this.core,"options.apiVersion"),J.t1.code!==Wl.V2NIM_ERROR_CODE_CANCELLED&&10499!==J.t1.errCode){J.next=44;break}throw new Jl({code:G?Wl.V2NIM_ERROR_CODE_CANCELLED:400,detail:{reason:get(J.t1,"message")||"Request abort",rawError:J.t1,curProvider:1}});case 44:if(!G||J.t1.errCode!==Wl.V2NIM_ERROR_CODE_FILE_OPEN_FAILED){J.next=46;break}throw new Hl({code:Wl.V2NIM_ERROR_CODE_FILE_OPEN_FAILED,detail:{reason:get(J.t1,"message")||"Read file failed",rawError:J.t1,curProvider:1}});case 46:return J.next=48,Ks.net.getNetworkStatus();case 48:if(B=J.sent,!1!==B.net_connect){J.next=52;break}throw new Jl({code:"v2"===get(this.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"No network",rawError:J.t1,curProvider:1}});case 52:if(!u){J.next=69;break}if(!(this.nosErrorCount<=0)){J.next=65;break}J.prev=54,this.cloudStorage.mixStorage._addCircuitTimer(),J.next=61;break;case 58:throw J.prev=58,J.t2=J.catch(54),new Jl({code:"v2"===get(this.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"All upload attempts failed",rawError:J.t2,curProvider:this.cloudStorage.mixStorage.curProvider,mixStorePolicy:this.cloudStorage.mixStorage.mixStorePolicy,file:t.file||t.filePath}});case 61:return this.nosErrorCount=get(this.cloudStorage,"mixStorePolicy.nosPolicy.uploadConfig.retryPolicy.retry"),J.abrupt("return",this.cloudStorage._uploadFile(t,i));case 65:return this.nosErrorCount--,J.abrupt("return",this.nosUpload(t,i,u));case 67:J.next=70;break;case 69:throw new Jl({code:"v2"===get(this.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"NOS attempts failed",rawError:J.t1,curProvider:1}});case 70:if(j=null==L?void 0:L.type,(Y=j&&indexOf(j).call(j,"/")>-1?slice(j).call(j,0,indexOf(j).call(j,"/")):"")||(Y=t.type||""),(W={image:"imageInfo",video:"vinfo",audio:"vinfo"})[Y]){J.next=78;break}return J.abrupt("return",xt({url:P},L));case 78:if(!(L.w&&L.h||L.dur)){J.next=80;break}return J.abrupt("return",xt({url:P},L));case 80:return J.prev=80,J.next=83,this.core.adapters.request(x+"?"+W[Y],{method:"GET",dataType:"json",timeout:5e3},{exception_service:3});case 83:$=J.sent,J.next=92;break;case 86:return J.prev=86,J.t3=J.catch(80),H=J.t3,i.update({exception:"Fetch media info failed;url:"+x+"?"+W[Y]+";errMsg:"+((null===(C=H.detail)||void 0===C?void 0:C.reason)||H.message),external_code:H.code}),this.core.logger.error("uploadFile:: fetch file info error",J.t3),J.abrupt("return",xt({url:P},L));case 92:if(!$){J.next=99;break}return Q=$.data,K="imageInfo"===W[Y]?Q:null===(R=null==Q?void 0:Q.GetVideoInfo)||void 0===R?void 0:R.VideoInfo,z={url:P,name:L.name,size:L.size,ext:L.ext,w:null==K?void 0:K.Width,h:null==K?void 0:K.Height,orientation:null==K?void 0:K.Orientation,dur:null==K?void 0:K.Duration,audioCodec:null==K?void 0:K.AudioCodec,videoCodec:null==K?void 0:K.VideoCodec,container:null==K?void 0:K.Container},J.abrupt("return",pickBy(z,(function(t){return void 0!==t})));case 99:return J.abrupt("return",xt({url:P},L));case 100:case"end":return J.stop()}}),_callee3,this,[[7,13],[25,38],[54,58],[80,86]])})))},t._getNosCdnHost=function _getNosCdnHost(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var i,u,h,m=this;return ms.wrap((function _callee4$(v){for(;;)switch(v.prev=v.next){case 0:return v.prev=0,v.next=3,this.core.sendCmd("getNosCdnHost");case 3:i=v.sent,v.next=10;break;case 6:return v.prev=6,v.t0=v.catch(0),this.core.logger.error("getNosCdnHost::error",v.t0),v.abrupt("return");case 10:if(i){v.next=12;break}return v.abrupt("return");case 12:u=null===(t=null==i?void 0:i.content)||void 0===t?void 0:t.nosConfigTag,0!==(h=su(null==u?void 0:u.expire))&&u.cdnDomain?-1===h?(this.config.cdn.bucket=u.bucket,this.config.cdn.cdnDomain=u.cdnDomain,this.config.cdn.objectNamePrefix=u.objectNamePrefix):(this.config.cdn.bucket=u.bucket,this.config.cdn.cdnDomain=u.cdnDomain,this.config.cdn.objectNamePrefix=u.objectNamePrefix,this.nosCdnHostTimer=this.core.timerManager.addTimer((function(){m._getNosCdnHost()}),1e3*h)):(this.config.cdn.bucket="",this.config.cdn.cdnDomain="",this.config.cdn.objectNamePrefix="");case 15:case"end":return v.stop()}}),_callee4,this,[[0,6]])})))},us(NOS,[{key:"config",get:function get(){return this.cloudStorage.config}}]),NOS}(),gu=entryVirtual("Array").values,vu=Array.prototype,_u={DOMTokenList:!0,NodeList:!0},values=function(t){var i=t.values;return t===vu||$(vu,t)&&i===vu.values||he(_u,tr(t))?gu:i},yu=Ro.every,Eu=arrayMethodIsStrict("every");_export({target:"Array",proto:!0,forced:!Eu},{every:function every(t){return yu(this,t,arguments.length>1?arguments[1]:void 0)}});var Iu=entryVirtual("Array").every,Mu=Array.prototype,every=function(t){var i=t.every;return t===Mu||$(Mu,t)&&i===Mu.every?Iu:i};function difference(t,i){return i=i||[],filter(t=t||[]).call(t,(function(t){return-1===indexOf(i).call(i,t)}))}function replacer(t,i){return i instanceof RegExp?"__REGEXP "+i.toString():i}function validate(t,i,u,h){var m;void 0===i&&(i={}),void 0===h&&(h=!1);var v={};return forEach$1(m=es(t)).call(m,(function(m){var E=t[m].type,I=u?"In "+u+", ":"";if(null==i){var M=I+"param is null or undefined";throw h?new Kl({detail:{reason:M,data:{key:m},rules:"required"}}):new Ql(M,{key:m},"required")}if(void 0===i[m]){if(!1===t[m].required)return void(v[m]=i[m]);var S=I+"param '"+m+"' is required";throw h?new Kl({detail:{reason:S,data:{key:m},rules:"required"}}):new Ql(S,{key:m},"required")}var T=Su[E];if(T&&!T(i,m,t[m],h)){var C=I+"param '"+m+"' unexpected",R={key:m,value:i[m]};throw h?new Kl({detail:{reason:C,data:R,rules:Ms(t[m],replacer)}}):new Ql(C,R,Ms(t[m],replacer))}v[m]=i[m]})),v}var Su={string:function string(t,i,u){var h=u.allowEmpty,m=u.max,v=u.min,E=u.regExp,I=t[i];return"string"==typeof I&&((!1!==h||""!==I)&&(!("number"==typeof m&&I.length>m)&&(!("number"==typeof v&&I.length<v)&&!(function isRegExp(t){return"[object RegExp]"===Object.prototype.toString.call(t)}(E)&&!E.test(I)))))},number:function number(t,i,u){var h=u.min,m=u.max,v=t[i];return"number"==typeof v&&(!("number"==typeof h&&v<h)&&!("number"==typeof m&&v>m))},boolean:function boolean(t,i){return"boolean"==typeof t[i]},file:function file(t,i){return!0},enum:function _enum(t,i,u){var h=values(u),m=t[i];return!h||indexOf(h).call(h,m)>-1},jsonstr:function jsonstr(t,i){try{var u=JSON.parse(t[i]);return"object"==typeof u&&null!==u}catch(t){return!1}},func:function func(t,i){return"function"==typeof t[i]},array:function array(t,i,u,h){void 0===h&&(h=!1);var m=u.itemType,v=u.itemRules,E=u.rules,I=u.min,M=u.max,S=values(u),T=t[i];if(!Qs(T))return!1;if("number"==typeof M&&T.length>M)return!1;if("number"==typeof I&&T.length<I)return!1;if(v)forEach$1(T).call(T,(function(t,u){var m,E;validate(((m={})[u]=v,m),((E={})[u]=t,E),i+"["+u+"]",h)}));else if(E)forEach$1(T).call(T,(function(t,u){return validate(E,t,i+"["+u+"]",h)}));else if("enum"===m){if(S&&difference(T,S).length)return!1}else if(m&&!every(T).call(T,(function(t){return typeof t===m})))return!1;return!0},object:function object(t,i,u,h){void 0===h&&(h=!1);var m=u.rules,v=u.allowEmpty,E=t[i];if("object"!=typeof E||null===E)return!1;if(m){var I=es(m),M=es(E),S=filter(M).call(M,(function(t){return indexOf(I).call(I,t)>-1}));if(!1===v&&0===S.length)return!1;validate(m,E,i,h)}return!0}},callWithSafeIterationClosing=function(t,i,u,h){try{return h?i(anObject(u)[0],u[1]):i(u)}catch(i){iteratorClose(t,"throw",i)}},Tu=Array,Cu=!checkCorrectnessOfIteration((function(t){Array.from(t)}));_export({target:"Array",stat:!0,forced:Cu},{from:function from(t){var i=toObject(t),u=fn(this),h=arguments.length,m=h>1?arguments[1]:void 0,v=void 0!==m;v&&(m=functionBindContext(m,h>2?arguments[2]:void 0));var E,I,M,S,T,C,R=getIteratorMethod$5(i),A=0;if(!R||this===Tu&&isArrayIteratorMethod(R))for(E=lengthOfArrayLike(i),I=u?new this(E):Tu(E);E>A;A++)C=v?m(i[A],A):i[A],createProperty(I,A,C);else for(T=(S=getIterator(i,R)).next,I=u?new this:[];!(M=x(T,S)).done;A++)C=v?callWithSafeIterationClosing(S,m,[M.value,A],!0):M.value,createProperty(I,A,C);return I.length=A,I}});var bu=W.Array.from,Ru=getIteratorMethod$5;function getPromiseWithAbort(t){var i={},u=new Ja((function(t,u){i.abort=u}));return i.promise=Ja.race([t,u]),i}Ja.reject;var Au=function(){function PromiseManager(){this.abortFns=[]}var t=PromiseManager.prototype;return t.add=function add(t){var i=getPromiseWithAbort(t);return this.abortFns.push(i.abort),i.promise},t.clear=function clear(t){var i;forEach$1(i=this.abortFns).call(i,(function(i){return i(t||new Hl({code:Wl.V2NIM_ERROR_CODE_CANCELLED,detail:{reason:"Aborted"}}))})),this.abortFns=[]},t.destroy=function destroy(){this.clear()},PromiseManager}(),Nu={tolerantRTT:3e3,bestRTT:100,maxChances:5,enable:!0},Ou={timestamp:0,rtt:0,baseClock:0,baseTime:0},wu=function(){function TimeOrigin(t,i,u){void 0===u&&(u="getServerTime"),this.serverOrigin=Ou,this.config=Nu,this.isSettingNTP=!1,this.currentChance=0,this.failedDelay=2e3,this.successDelay=3e5,this.timer=0,this.cmdName="getServerTime",this.core=t,this.logger=t.logger,this.promiseManager=new Au,this.cmdName=u,i&&this.setOptions(i)}var t=TimeOrigin.prototype;return t.setOptions=function setOptions(t){this.config=xt({},Nu,this.config,t)},t.reset=function reset(){this.timer&&clearTimeout(this.timer),this.promiseManager.clear(),this.serverOrigin=Ou,this.currentChance=0},t.setOriginTimetick=function setOriginTimetick(){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var t,i,u,h,m,v,E,I,M,S;return ms.wrap((function _callee$(T){for(;;)switch(T.prev=T.next){case 0:if(this.config.enable){T.next=2;break}return T.abrupt("return");case 2:if(!this.isSettingNTP){T.next=4;break}return T.abrupt("return");case 4:if(!(this.currentChance>=this.config.maxChances)){T.next=6;break}return T.abrupt("return");case 6:if(t=get(this.core,"auth.status"),i=get(this.core,"status"),u=get(this.core,"V2NIMLoginService.lifeCycle.loginStatus"),"logined"===t||"logined"===i||1===u){T.next=11;break}return T.abrupt("return");case 11:return this.isSettingNTP=!0,this.currentChance++,this.timer&&clearTimeout(this.timer),this.timer=0,h="TimeOrigin::setOriginTimetick:",m=eo(),this.core.logger.debug(h+" getServerTime start, times "+this.currentChance),T.prev=18,T.next=21,this.promiseManager.add(this.core.sendCmd(this.cmdName));case 21:E=T.sent,v=get(E,"content.time"),this.isSettingNTP=!1,T.next=33;break;case 26:return T.prev=26,T.t0=T.catch(18),I=T.t0,this.isSettingNTP=!1,this.logger.warn(h+" Calculate Delay time, getServerTime error",I),I.code!==Wl.V2NIM_ERROR_CODE_CANCELLED&&(clearTimeout(this.timer),this.timer=vo(bind$1(M=this.setOriginTimetick).call(M,this),this.failedDelay)),T.abrupt("return");case 33:if(v){T.next=37;break}return this.core.logger.warn(h+" Calculate Delay time incorrect format"),this.config.enable=!1,T.abrupt("return");case 37:S=eo()-m,this.doSet(v,S);case 39:case"end":return T.stop()}}),_callee,this,[[18,26]])})))},t.doSet=function doSet(t,i){var u,h="TimeOrigin::setOriginTimetick:";if(i>this.config.tolerantRTT)this.logger.warn(h+" denied RTT:"+i),clearTimeout(this.timer),this.timer=vo(bind$1(u=this.setOriginTimetick).call(u,this),this.failedDelay);else if(i>this.config.bestRTT){var m;this.serverOrigin.rtt&&i>=this.serverOrigin.rtt?this.logger.warn(h+" ignore RTT:"+i):(this.setServerOrigin(i,t),this.logger.log(h+" accept reluctantly RTT:"+i)),clearTimeout(this.timer),this.timer=vo(bind$1(m=this.setOriginTimetick).call(m,this),this.failedDelay)}else{var v;this.setServerOrigin(i,t),this.logger.debug(h+" accept best RTT:"+i),this.currentChance=0,clearTimeout(this.timer),this.timer=vo(bind$1(v=this.setOriginTimetick).call(v,this),this.successDelay)}},t.getNTPTime=function getNTPTime(t){if(void 0===t&&(t=this.getTimeNode()),this.checkNodeReliable(t)){var i=Math.floor(t.time-this.serverOrigin.baseTime);return this.serverOrigin.timestamp+i}return eo()},t.checkNodeReliable=function checkNodeReliable(t){if(void 0===t&&(t=this.getTimeNode()),this.serverOrigin.timestamp){if(0===this.serverOrigin.baseClock)return!0;var i=t.clock-this.serverOrigin.baseClock,u=t.time-this.serverOrigin.baseTime;return Math.abs(u-i)<500}return!1},t.checkPerformance=function checkPerformance(){return"BROWSER"===Ks.platform&&!("undefined"==typeof performance||!performance.now)},TimeOrigin.checkPerformance=function checkPerformance(){return"BROWSER"===Ks.platform&&!("undefined"==typeof performance||!performance.now)},t.getTimeNode=function getTimeNode(){return{clock:this.checkPerformance()?performance.now():0,time:eo()}},TimeOrigin.getTimeNode=function getTimeNode(){return{clock:TimeOrigin.checkPerformance()?performance.now():0,time:eo()}},t.setServerOrigin=function setServerOrigin(t,i){this.serverOrigin={timestamp:i+Math.floor(t/2),rtt:t,baseClock:this.checkPerformance()?performance.now():0,baseTime:eo()}},TimeOrigin}();function _createForOfIteratorHelperLoose$4(t,i){var u,h=void 0!==gi&&Ru(t)||t["@@iterator"];if(h)return bind$1(u=(h=h.call(t)).next).call(u,h);if(Qs(t)||(h=function _unsupportedIterableToArray$4(t,i){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$4(t,i);var h=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===h&&t.constructor&&(h=t.constructor.name),"Map"===h||"Set"===h?bu(t):"Arguments"===h||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?_arrayLikeToArray$4(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){h&&(t=h);var m=0;return function(){return m>=t.length?{done:!0}:{done:!1,value:t[m++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayLikeToArray$4(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,h=Array(i);u<i;u++)h[u]=t[u];return h}var xu={},ku={};function parseEachCmd(t,i,u,h,m){var v,E={cmd:u,raw:t,error:null,service:null==i?void 0:i.service,content:{},__receiveTimeNode:wu.getTimeNode()};(function isV2Sid(t){var i;return includes(i=[18,19,26,27,28,29,30,31,32,33,34,35,36]).call(i,t)})(i.sid)&&(t.code=function toReadableCode(t){if("number"!=typeof t||t!=t)throw new Hl({code:Wl.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"Read code failed",rawData:""+t}});if(t<0||t>=0&&t<1e3||t>=2e4&&t<=20099)return t;var i=(65535&t)>>9;i-=i<=38?1:2;return 1e5+1e3*i+(511&t)}(t.code));var I,M=function genCmdError(t,i){var u=$l[t],h=Zl[t];return null===h?null:new Hl({code:t,desc:u||h||t,detail:{cmd:i,timetag:eo()}})}(t.code,u);if(E.error=M,E.error){if(E.error.detail.cmd=u,!(null===(v=null==i?void 0:i.ignoreErrCodes)||void 0===v?void 0:includes(v).call(v,t.code)))return E;m.warn("parseCmd:: ignore error ",E.error),E.error.detail.ignore=!0}i.response&&forEach$1(I=i.response).call(I,(function(t,i){var u=h[i],m=t.type,v=t.name,I=t.reflectMapper;if(void 0!==u)switch(m){case"Property":E.content[v]=I?deserialize(u,I):u;break;case"PropertyArray":E.content[v]=map$6(u).call(u,(function(t){return I?deserialize(t,I):t}));break;case"Int":case"Long":case"Byte":E.content[v]=+u;break;case"Bool":E.content[v]="true"===u||!0===u||1===u;break;default:E.content[v]=u}}));return E}function serialize(t,i,u){var h={};for(var m in t=function flattenObjByMapper(t,i){var u={};for(var h in i){for(var m,v=i[h],E="number"==typeof v?h:v.access?v.access:h,I=t,M=_createForOfIteratorHelperLoose$4(E.split("."));!(m=M()).done;){var S=m.value;if(void 0===I[S]||null===I[S]){I=void 0;break}I=I[S]}void 0!==I&&(u[E]=I)}return u}(t,i),i){var v=i[m],E="number"==typeof v?m:v.access?v.access:m;if(!u||includes(u).call(u,m))if(E in t){if("number"==typeof v)h[v]=t[E];else if("object"==typeof v)if(v.converter){var I=v.converter(t[E],t);void 0!==I&&(h[v.id]=I)}else h[v.id]=t[E]}else"object"==typeof v&&v.def&&("function"==typeof v.def?h[v.id]=v.def(t):h[v.id]=v.def)}return h}function deserialize(t,i){var u={};for(var h in t){var m=i[h];if("string"==typeof m)u[m]=t[h];else if("object"==typeof m&&"prop"in m){var v=m.access?m.access:m.prop;if(m.converter){var E=m.converter(t[h],t);void 0!==E&&(u[v]=E)}else m.type&&"number"===m.type?u[v]=+t[h]:m.type&&"boolean"===m.type?u[v]=!("0"===t[h]||!t[h]):u[v]=t[h]}}for(var I in i){var M=i[I];if(M&&void 0!==M.def){var S=M.access?M.access:M.prop;S in u||("function"==typeof M.def?u[S]=M.def(t):u[S]=M.def)}}return u=function unflattenObj(t){var i={},u=function _loop(u){var h=u.split(".");reduce(h).call(h,(function(i,m,v){return i[m]||(i[m]=isNaN(Number(h[v+1]))?h.length-1==v?t[u]:{}:[])}),i)};for(var h in t)u(h);return i}(u),u}function registerParser(t){for(var i in xt(xu,t.cmdConfig),t.cmdMap){var u=t.cmdMap[i],h=t.cmdConfig[u];if(h)if(Qs(ku[i])){for(var m,v=!1,E=_createForOfIteratorHelperLoose$4(ku[i]);!(m=E()).done;){var I=m.value;if(I.cmd===u&&I.config.service===h.service){v=!0;break}}v||ku[i].push({config:h,cmd:u})}else ku[i]=[{config:h,cmd:u}]}}function invertSerializeMap(t){var i,u={};return forEach$1(i=es(t)).call(i,(function(i){u[i]=invertSerializeItem(t[i])})),u}function invertSerializeItem(t){var i={};for(var u in t){var h=t[u];"number"==typeof h?i[h]=u:"object"==typeof h&&(i[h.id]={prop:u,type:h.retType,access:h.retAccess?h.retAccess:h.access?h.access:u,def:h.retDef,converter:h.retConverter})}return i}var Pu={"6_2":"getNosToken","6_22":"getOriginUrl","6_24":"getNosAccessToken","6_25":"deleteNosAccessToken","6_26":"getNosCdnHost","6_27":"getGrayscaleConfig","6_28":"getMixStorePolicy","6_29":"getMixStoreToken","6_30":"getFileAuthToken"},Lu={nosToken:{objectName:1,token:2,bucket:3,expireTime:4,expireSec:7,tag:8,shortUrl:9},mixStoreTokenReqTag:{provider:0,tokenCount:1,nosSurvivalTime:2,tag:3,returnBody:4,policyVersion:5},nosConfigTag:{bucket:1,cdnDomain:2,expire:3,objectNamePrefix:4},grayConfigTag:{config:0,ttl:1},mixStorePolicyTag:{providers:0,ttl:1,mixEnable:2,nosPolicy:3,s3Policy:4,policyVersion:5},mixStoreTokenResTag:{provider:0,accessKeyId:1,secretAccessKey:2,sessionToken:3,token:4,expireTime:5,bucket:6,objectName:7,fileExpireSec:8,tag:9,shortUrl:10,region:11},nosSafeUrlTag:{safeUrl:0,originUrl:1},mixStoreAuthTokenReqTag:{type:1,urls:2},mixStoreAuthTokenResTag:{type:1,tokens:2,token:3,ttl:4},nosAccessTokenTag:{token:0,url:1,userAgent:2,ext:3}},Du={getNosToken:{sid:6,cid:2,service:"cloudStorage",params:[{type:"String",name:"responseBody"},{type:"Property",name:"nosToken",entity:"nosToken",reflectMapper:Lu.nosToken}],response:[{type:"Property",name:"nosToken",reflectMapper:invertSerializeItem(Lu.nosToken)}]},getOriginUrl:{sid:6,cid:22,service:"cloudStorage",params:[{type:"Property",name:"nosSafeUrlTag",reflectMapper:Lu.nosSafeUrlTag}],response:[{type:"Property",name:"nosSafeUrlTag",reflectMapper:invertSerializeItem(Lu.nosSafeUrlTag)}]},getNosCdnHost:{sid:6,cid:26,service:"cloudStorage",response:[{type:"Property",name:"nosConfigTag",reflectMapper:invertSerializeItem(Lu.nosConfigTag)}]},getGrayscaleConfig:{sid:6,cid:27,service:"cloudStorage",params:[{type:"Property",name:"config"}],response:[{type:"Property",name:"grayConfigTag",reflectMapper:invertSerializeItem(Lu.grayConfigTag)}]},getMixStorePolicy:{sid:6,cid:28,service:"cloudStorage",params:[{type:"LongArray",name:"supportType"}],response:[{type:"Property",name:"mixStorePolicyTag",reflectMapper:invertSerializeItem(Lu.mixStorePolicyTag)}]},getMixStoreToken:{sid:6,cid:29,service:"cloudStorage",params:[{type:"Property",name:"mixStoreTokenReqTag",reflectMapper:Lu.mixStoreTokenReqTag}],response:[{type:"Property",name:"mixStoreTokenResTag",reflectMapper:invertSerializeItem(Lu.mixStoreTokenResTag)}]},getFileAuthToken:{sid:6,cid:30,service:"cloudStorage",params:[{type:"Property",name:"mixStoreAuthTokenReqTag",reflectMapper:Lu.mixStoreAuthTokenReqTag}],response:[{type:"Property",name:"mixStoreAuthTokenResTag",reflectMapper:invertSerializeItem(Lu.mixStoreAuthTokenResTag)}]},getNosAccessToken:{sid:6,cid:24,service:"cloudStorage",params:[{type:"Property",name:"tag",reflectMapper:Lu.nosAccessTokenTag}],response:[{type:"Property",name:"tag",reflectMapper:invertSerializeItem(Lu.nosAccessTokenTag)}]},deleteNosAccessToken:{sid:6,cid:25,service:"cloudStorage",params:[{type:"Property",name:"tag",reflectMapper:Lu.nosAccessTokenTag}]}},qu=function(){function MixStorage(t,i){this.GRAYKEY="AllGrayscaleConfig",this.MIXSTOREKEY="AllMixStorePolicy",this.grayConfig={mixStoreEnable:!1,timeStamp:0,ttl:0},this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null,policyVersion:void 0},this.curProvider=1,this.mixStoreErrorCount=10,this.circuitTimer=0,this.core=t,this.cloudStorage=i,this.logger=t.logger}var t=MixStorage.prototype;return t.reset=function reset(){this.grayConfig=null,this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null,policyVersion:void 0},this.curProvider=1,this.mixStoreErrorCount=10},t.getGrayscaleConfig=function getGrayscaleConfig(t,i){var u;return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var h,m;return ms.wrap((function _callee$(v){for(;;)switch(v.prev=v.next){case 0:if(Ks.localStorage)try{Ks.localStorage.getItem&&Ks.localStorage.getItem(this.GRAYKEY)&&(this.grayConfig=JSON.parse(Ks.localStorage.getItem(this.GRAYKEY))[t])}catch(t){Ks.localStorage.getItem(this.GRAYKEY)&&this.core.logger.error("uploadFile:: JSON.parse grayscaleConfig error ",t)}if(this.grayConfig&&!(this.grayConfig.timeStamp+1e3*this.grayConfig.ttl<i)){v.next=17;break}return v.next=4,this.core.sendCmd("getGrayscaleConfig",{config:{}});case 4:if(!(h=v.sent).content||!h.content.grayConfigTag){v.next=16;break}this.logger.log("uploadFile::getAppGrayConfigRequest success ");try{this.grayConfig=JSON.parse(h.content.grayConfigTag.config),this.grayConfig.ttl=JSON.parse(h.content.grayConfigTag.ttl)}catch(t){this.logger.error("getGrayscaleConfig error",t)}if(this.grayConfig){v.next=10;break}return v.abrupt("return");case 10:m=Ks.localStorage.getItem(this.GRAYKEY)?JSON.parse(Ks.localStorage.getItem(this.GRAYKEY)):{},this.grayConfig.timeStamp=(new Date).getTime(),m[t]=this.grayConfig,Ks.localStorage.setItem(this.GRAYKEY,Ms(m)),v.next=17;break;case 16:this.logger.log("uploadFile:: result grayConfig:",h.content);case 17:if(!(null===(u=this.grayConfig)||void 0===u?void 0:u.mixStoreEnable)){v.next=20;break}return v.next=20,this._getMixStorePolicy(t);case 20:case"end":return v.stop()}}),_callee,this)})))},t._getMixStorePolicy=function _getMixStorePolicy(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var i,u,h,m,v,E,I;return ms.wrap((function _callee2$(M){for(;;)switch(M.prev=M.next){case 0:if(i=(new Date).getTime(),Ks.localStorage)try{this.mixStorePolicy=JSON.parse(Ks.localStorage.getItem(this.MIXSTOREKEY))[t],this.curProvider=su(this.mixStorePolicy.providers[0]),this.mixStorePolicy.timeStamp&&this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl>i&&(h=this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl-i,this.core.timerManager.addTimer(bind$1(u=this._getMixStorePolicy).call(u,this,t),h))}catch(i){Ks.localStorage.getItem(this.MIXSTOREKEY)&&JSON.parse(Ks.localStorage.getItem(this.MIXSTOREKEY))[t]&&this.core.logger.error("uploadFile:: JSON.parse mixStorePolicy error ",i)}if(this.mixStorePolicy&&!(this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl<=i)){M.next=31;break}return M.prev=3,M.next=6,this.core.sendCmd("getMixStorePolicy",{supportType:this.cloudStorage.aws.s3?[1,2]:[1]});case 6:v=M.sent,E=v.content.mixStorePolicyTag,this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null,policyVersion:void 0},this.mixStorePolicy.policyVersion=E.policyVersion,this.mixStorePolicy.ttl=Number(E.ttl),this.mixStorePolicy.providers=E.providers.split(","),this.circuitTimer&&this.core.timerManager.deleteTimer(this.circuitTimer),this.curProvider=su(this.mixStorePolicy.providers[0]),this.mixStorePolicy.nosPolicy=E.nosPolicy?JSON.parse(E.nosPolicy):null,this.mixStorePolicy.s3Policy=E.s3Policy?JSON.parse(E.s3Policy):null,null===this.mixStorePolicy.s3Policy?this.mixStorePolicy.providers=["1"]:null===this.mixStorePolicy.nosPolicy?this.mixStorePolicy.providers=["2"]:this.mixStorePolicy.providers=this.mixStorePolicy.s3Policy.priority<this.mixStorePolicy.nosPolicy.priority?["2","1"]:["1","2"],this.core.timerManager.addTimer(bind$1(m=this._getMixStorePolicy).call(m,this,t),1e3*this.mixStorePolicy.ttl),I=Ks.localStorage.getItem(this.MIXSTOREKEY)?JSON.parse(Ks.localStorage.getItem(this.MIXSTOREKEY)):{},this.mixStorePolicy.timeStamp=(new Date).getTime(),I[t]=this.mixStorePolicy,Ks.localStorage.setItem(this.MIXSTOREKEY,Ms(I)),M.next=31;break;case 24:if(M.prev=24,M.t0=M.catch(3),this.logger.error("getMixStorePolicy error",M.t0),0!==this.mixStoreErrorCount){M.next=29;break}throw new Error("getMixStorePolicy all count error");case 29:this._getMixStorePolicy(t),this.mixStoreErrorCount--;case 31:this.mixStorePolicy.nosPolicy&&(this.cloudStorage.nos.nosErrorCount=this.mixStorePolicy.nosPolicy.uploadConfig.retryPolicy.retry);case 32:case"end":return M.stop()}}),_callee2,this,[[3,24]])})))},t._addCircuitTimer=function _addCircuitTimer(){var t=this,i=this.mixStorePolicy.providers,u=i[(indexOf(i).call(i,String(this.curProvider))+1)%i.length];if(!u)throw new Error("uploadFile nextProvider error");if(u===i[0])throw new Error("uploadFile all policy fail");if(this.logger.log("uploadFile:: upload policy will change,now policy:"+this.curProvider+" nextProvider:"+u),this.curProvider=su(u),this.mixStorePolicy.nosPolicy&&this.mixStorePolicy.s3Policy){var h=this.mixStorePolicy[1===this.curProvider?"nosPolicy":"s3Policy"].uploadConfig.retryPolicy.circuit;if(!h||0===h)throw new Error("uploadFile circuit error");this.circuitTimer=this.core.timerManager.addTimer((function(){t.logger.log("uploadFile:: upload policy will change,now policy:"+t.curProvider+" nextProvider:"+su(t.mixStorePolicy.providers[0])),t.curProvider=su(t.mixStorePolicy.providers[0]),t.core.timerManager.deleteTimer(t.circuitTimer)}),1e3*h)}throw new Error("uploadFile will not retry again")},t.getFileAuthToken=function getFileAuthToken(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var i;return ms.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.core.sendCmd("getFileAuthToken",{mixStoreAuthTokenReqTag:t});case 2:return i=u.sent,u.abrupt("return",i.content.mixStoreAuthTokenResTag);case 4:case"end":return u.stop()}}),_callee3,this)})))},MixStorage}(),Vu=Gs.trim,Uu=N("".charAt),Gu=m.parseFloat,Fu=m.Symbol,Bu=Fu&&Fu.iterator,ju=1/Gu(Ls+"-0")!=-1/0||Bu&&!fails((function(){Gu(Object(Bu))}))?function parseFloat(t){var i=Vu(toString(t)),u=Gu(i);return 0===u&&"-"==Uu(i,0)?-0:u}:Gu;_export({global:!0,forced:parseFloat!=ju},{parseFloat:ju});var Yu=W.parseFloat,Wu=-1,$u=function(){function AWS(t,i){this.s3=null,this.core=t,this.cloudStorage=i,this.logger=t.logger}var t=AWS.prototype;return t.s3Upload=function s3Upload(t,i,u){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var h,m,v,E,I,M,S,T,C,R,A,N,O,w,x=this;return ms.wrap((function _callee2$(k){for(;;)switch(k.prev=k.next){case 0:if(Wu+=1,!t.file){k.next=5;break}h=t.file,k.next=20;break;case 5:if("string"!=typeof t.fileInput){k.next=15;break}if(this.logger.warn("fileInput will abandon,Please use file or filepath"),!((m=document.getElementById(t.fileInput))&&m.files&&m.files[0])){k.next=12;break}h=m.files[0],k.next=13;break;case 12:throw new Error("Can not get file from fileInput");case 13:k.next=20;break;case 15:if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0])){k.next=19;break}h=t.fileInput.files[0],k.next=20;break;case 19:throw new Error("Can not get file from fileInput "+t.fileInput);case 20:if(this.mixStorePolicy.s3Policy){k.next=22;break}throw new Error("dont get s3 policy");case 22:return v={accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey,sessionToken:u.sessionToken,region:u.region,maxRetries:this.mixStorePolicy.s3Policy.uploadConfig.retryPolicy.retry},E=this.s3,I=decodeURIComponent(u.bucket),M=decodeURIComponent(u.objectName),S=h,T="https://"+I+".s3.amazonaws.com/"+M,C={},(R=this.mixStorePolicy.s3Policy)&&R.uploadConfig&&Qs(R.uploadConfig.uploadUrl)&&R.uploadConfig.uploadUrl.length>0&&(A=R.uploadConfig.uploadUrl.length,Wu%=A,C.endpoint=R.uploadConfig.uploadUrl[Wu],C.s3ForcePathStyle=!0,T=C.endpoint+"/"+I+"/"+M),i.update({local_file:h.name,remote_addr:T,operation_type:1}),(N=new E(C)).config.update(v),O={Bucket:I,Key:M,Body:S,Metadata:{token:u.token},ContentType:S.type||"application/octet-stream"},this.core.logger.log("uploadFile:: s3 upload params:",O),(w=N.upload(O)).on("httpUploadProgress",(function(u){i.update({index:u.part});var h=Yu((u.loaded/u.total).toFixed(2));t.onUploadProgress&&t.onUploadProgress({total:u.total,loaded:u.loaded,percentage:h,percentageText:Math.round(100*h)+"%"})})),k.abrupt("return",new Ja((function(h,m){var v=(new Date).getTime();w.send((function(E,T){return __awaiter(x,void 0,void 0,ms.mark((function _callee(){var C,R,A,N,O,w,x,k;return ms.wrap((function _callee$(P){for(;;)switch(P.prev=P.next){case 0:if(!E||"RequestAbortedError"!==E.code){P.next=6;break}this.logger.error("uploadFile:","api::s3:upload file abort.",E),i.update({http_code:E.statusCode,exception:E}),m(new Jl({code:"v2"===get(this.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_CANCELLED:400,detail:{reason:"S3RequestAbortedError",rawError:E,curProvider:2}})),P.next=43;break;case 6:if(!E){P.next=27;break}return i.update({http_code:E.statusCode,exception:E}),this.core.reporter.reportTraceStart("exceptions",{user_id:this.core.options.account||(null===(R=null===(C=this.core)||void 0===C?void 0:C.auth)||void 0===R?void 0:R.account),trace_id:null===(A=this.core.clientSocket.socket)||void 0===A?void 0:A.sessionId,start_time:v,action:1,exception_service:4}),this.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof E.status?E.status:"number"==typeof E.code?E.code:0,description:E.message||""+E.code,operation_type:1,target:Ms({bucket:I,object:M})},{asyncParams:Ks.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("exceptions",1),P.next=13,Ks.net.getNetworkStatus();case 13:if(N=P.sent,!1!==N.net_connect){P.next=17;break}return P.abrupt("return",m(new Jl({code:"v2"===get(this.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"No network",rawError:E,curProvider:this.cloudStorage.mixStorage.curProvider}})));case 17:P.prev=17,this.cloudStorage.mixStorage._addCircuitTimer(),P.next=24;break;case 21:return P.prev=21,P.t0=P.catch(17),P.abrupt("return",m(new Jl({code:"v2"===get(this.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"All upload attempts failed",rawError:P.t0,curProvider:this.cloudStorage.mixStorage.curProvider,mixStorePolicy:this.mixStorePolicy,file:t.file||t.filePath}})));case 24:h(this.cloudStorage._uploadFile(t,i)),P.next=43;break;case 27:if(i.update({http_code:200}),O=(O=(O=this.mixStorePolicy.s3Policy.cdnSchema).replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn)).replace("{objectName}",T.Key),w={size:S.size,name:S.name,url:u.shortUrl?u.shortUrl:O,ext:S.name.split(".")[1]||"unknown"},x=t.type||"",(k={image:"imageInfo"})[x]){P.next=38;break}return P.abrupt("return",h(w));case 38:return P.t1=h,P.next=41,this.getS3FileInfo({url:O,infoSuffix:k[x],s3Result:w});case 41:return P.t2=P.sent,P.abrupt("return",(0,P.t1)(P.t2));case 43:case"end":return P.stop()}}),_callee,this,[[17,21]])})))})),t.onUploadStart&&t.onUploadStart(w)})));case 39:case"end":return k.stop()}}),_callee2,this)})))},t.getS3FileInfo=function getS3FileInfo(t){var i;return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var u,h,m,v,E,I,M;return ms.wrap((function _callee3$(S){for(;;)switch(S.prev=S.next){case 0:return u=t.url,h=t.infoSuffix,m=t.s3Result,S.prev=1,S.next=4,this.core.adapters.request(u+"?"+h,{method:"GET",dataType:"text",timeout:5e3},{exception_service:3});case 4:v=S.sent,S.next=11;break;case 7:return S.prev=7,S.t0=S.catch(1),this.core.logger.error("uploadFile:: fetch file info error",S.t0),S.abrupt("return",m);case 11:if(!v){S.next=18;break}return E=v.data,I="imageInfo"===h?E:null===(i=null==E?void 0:E.GetVideoInfo)||void 0===i?void 0:i.VideoInfo,M=xt(xt({},m),{w:null==I?void 0:I.Width,h:null==I?void 0:I.Height,orientation:null==I?void 0:I.Orientation,dur:null==I?void 0:I.Duration,audioCodec:null==I?void 0:I.AudioCodec,videoCodec:null==I?void 0:I.VideoCodec,container:null==I?void 0:I.Container}),S.abrupt("return",pickBy(M,(function(t){return void 0!==t})));case 18:return this.core.logger.error("uploadFile:: fetch s3 file info no result",u+"?"+h),S.abrupt("return",m);case 20:case"end":return S.stop()}}),_callee3,this,[[1,7]])})))},us(AWS,[{key:"mixStorePolicy",get:function get(){return this.cloudStorage.mixStorage.mixStorePolicy}}]),AWS}(),Hu={user_id:"",trace_id:"",action:0,state:0,duration:0,start_time:0,offset:0,full_size:0,transferred_size:0,operation_type:0,remote_addr:"",local_file:"",retry_times:0,index:0,part_size:0,transfer_latency:0,http_code:0,exception:"",req_headers:"",rsp_headers:""},Qu="ReporterHook::setMonitorForResources:",Ku=function(){function ReporterHookCloudStorage(t,i){this.traceData=Hu,this.core=t,this.id=Math.round(1e3*Math.random()),this.traceData=xt({},Hu,i)}var t=ReporterHookCloudStorage.prototype;return t.start=function start(){var t,i;this.core&&(this.reset(),this.traceData.user_id=this.core.account,this.traceData.trace_id=(null===(i=null===(t=this.core.clientSocket)||void 0===t?void 0:t.socket)||void 0===i?void 0:i.sessionId)||"",this.traceData.start_time="timeOrigin"in this.core?this.core.timeOrigin.getNTPTime():eo())},t.update=function update(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){return ms.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(this.core){i.next=2;break}return i.abrupt("return");case 2:if(this.traceData.user_id){i.next=4;break}return i.abrupt("return");case 4:if(t.transferred_size&&this.core.logger.log(this.id+"."+Qu+" upload update",t),"object"==typeof t.exception)try{t.exception=Ms(t.exception)}catch(i){t.exception="UnknownObject"}if("object"==typeof t.req_headers)try{t.req_headers=Ms(t.req_headers)}catch(i){t.req_headers="UnknownObject"}if("object"==typeof t.rsp_headers)try{t.rsp_headers=Ms(t.rsp_headers)}catch(i){t.rsp_headers="UnknownObject"}xt(this.traceData,t);case 9:case"end":return i.stop()}}),_callee,this)})))},t.end=function end(t){this.core&&this.traceData.user_id&&(this.core.logger.log(Qu+" upload end cause of "+t),this.traceData.state=t,this.traceData.duration=("timeOrigin"in this.core?this.core.timeOrigin.getNTPTime():eo())-(this.traceData.start_time||0),this.core.reporter.report("nim_sdk_resources",this.traceData),this.traceData=Hu,this.destroy())},t.reset=function reset(){this.traceData=xt({},Hu)},t.destroy=function destroy(){this.core=void 0,this.traceData=Hu},ReporterHookCloudStorage}(),zu=function(){function CloudStorageService(t,i){void 0===i&&(i={}),this.config={},this.uploadTaskMap={},this.name="cloudStorage",this.logger=t.logger,this.core=t,this.nos=new fu(t,this),this.mixStorage=new qu(t,this),this.aws=new $u(t,this),registerParser({cmdMap:Pu,cmdConfig:Du}),this.setOptions(i),this.setListeners()}var t=CloudStorageService.prototype;return t.setOptions=function setOptions(t){void 0===t&&(t={});var i=t.storageKeyPrefix||"NIMClient";this.mixStorage.GRAYKEY=i+"-AllGrayscaleConfig",this.mixStorage.MIXSTOREKEY=i+"-AllMixStorePolicy";var u=t.s3,h=__rest(t,["s3"]),m=xt({},mu,this.config);if(h&&Object.prototype.hasOwnProperty.call(h,"cdn")){var v=xt(xt({},m.cdn),h.cdn);this.config=xt({},m,h),this.config.cdn=v}else this.config=xt({},m,h);u&&(this.aws.s3=u)},t.setListeners=function setListeners(){var t,i,u,h;this.core.eventBus.on("kicked",bind$1(t=this._clearUnCompleteTask).call(t,this)),this.core.eventBus.on("disconnect",bind$1(i=this._clearUnCompleteTask).call(i,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLogout",bind$1(u=this._clearUnCompleteTask).call(u,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleKicked",bind$1(h=this._clearUnCompleteTask).call(h,this))},t._clearUnCompleteTask=function _clearUnCompleteTask(){var t,i=this;forEach$1(t=es(this.uploadTaskMap)).call(t,(function(t){var u=i.uploadTaskMap[t];u&&u.abort&&u.abort()})),this.uploadTaskMap={}},t.init=function init(t){return void 0===t&&(t=eo()),__awaiter(this,void 0,void 0,ms.mark((function _callee(){return ms.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(this.mixStorage.reset(),this.nos.reset(),!this.config.isNeedToGetUploadPolicyFromServer){i.next=5;break}return i.next=5,this.mixStorage.getGrayscaleConfig(this.core.options.appkey,t);case 5:return i.next=7,this.nos._getNosCdnHost();case 7:case"end":return i.stop()}}),_callee,this)})))},t.processCallback=function processCallback(t,i,u){var h=this,m=t.onUploadProgress,v=t.onUploadDone,E=t.onUploadStart;return{onUploadStart:"function"==typeof E?function(t){h.uploadTaskMap[i]=t;try{E(t)}catch(t){h.logger.error("CloudStorage::uploadFile:options.onUploadStart execute error",t)}}:function(t){h.uploadTaskMap[i]=t},onUploadProgress:"function"==typeof m?function(t){u.update({transferred_size:t.loaded,full_size:t.total});try{m(t)}catch(t){h.logger.error("CloudStorage::uploadFile:options.onUploadProgress execute error",t)}}:function(t){u.update({transferred_size:t.loaded,full_size:t.total})},onUploadDone:"function"==typeof v?function(t){u.end(0);try{v(t)}catch(t){h.logger.error("CloudStorage::uploadFile:options.onUploadDone execute error",t)}}:function(){u.end(0)},taskKey:i}},t.uploadFile=function uploadFile(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var i,u,h,m,v,E,I,M,S;return ms.wrap((function _callee2$(T){for(;;)switch(T.prev=T.next){case 0:if(validate({maxSize:{type:"number",required:!1},type:{type:"enum",values:["file","image","audio","video"]}},t),t.fileInput||t.file||t.filePath){T.next=3;break}throw new Error("uploadFile needs target file object or a filePath");case 3:if(!t.type||"file"===t.type){T.next=7;break}if(!(i=get(t,"file.type"))||"string"!=typeof i||-1!==indexOf(i).call(i,t.type)){T.next=7;break}throw new Error('The meta type "'+i+'" does not match "'+t.type+'"');case 7:return(u=new Ku(this.core)).start(),t.file?u.update({full_size:t.file.size,local_file:t.file.name}):"string"==typeof t.fileInput?(h=document.getElementById(t.fileInput))&&h.files&&h.files[0]&&u.update({full_size:h.files[0].size,local_file:h.files[0].name}):t.fileInput&&t.fileInput.files&&t.fileInput.files[0]&&u.update({full_size:t.fileInput.files[0].size,local_file:t.fileInput.files[0].name}),m=lu(),v=this.processCallback(t,m,u),E=v.onUploadStart,I=v.onUploadProgress,M=v.onUploadDone,t.onUploadStart=E,t.onUploadProgress=I,t.onUploadDone=M,S=null,T.prev=16,T.next=19,this._uploadFile(t,u);case 19:S=T.sent,t.md5&&(S.md5=t.md5),delete this.uploadTaskMap[m],T.next=29;break;case 24:throw T.prev=24,T.t0=T.catch(16),delete this.uploadTaskMap[m],u.end((T.t0&&T.t0.code)===Wl.V2NIM_ERROR_CODE_CANCELLED?3:1),T.t0;case 29:return S&&(S.size=void 0===S.size?void 0:Number(S.size),S.w=void 0===S.w?void 0:Number(S.w),S.h=void 0===S.h?void 0:Number(S.h),S.dur=void 0===S.dur?void 0:Number(S.dur)),S.url=decodeURIComponent(S.url),t.onUploadDone({size:S.size,name:S.name,url:S.url,ext:S.name.split(".")[1]||"unknown"}),T.abrupt("return",S);case 33:case"end":return T.stop()}}),_callee2,this,[[16,24]])})))},t._uploadFile=function _uploadFile(t,i){var u,h;return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var m,v,E,I;return ms.wrap((function _callee3$(M){for(;;)switch(M.prev=M.next){case 0:if(get(this.mixStorage,"grayConfig.mixStoreEnable")&&get(this.mixStorage,"mixStorePolicy.providers.length")){M.next=3;break}return this.logger.log("uploadFile:: uploadFile begin, use old nos"),M.abrupt("return",this.nos.nosUpload(t,i));case 3:if(this.logger.log("uploadFile::_uploadFile, grayConfig enable:"+get(this.mixStorage,"grayConfig.mixStoreEnable")+" curProvider:"+get(this.mixStorage,"curProvider")),m=this.core.adapters.getFileUploadInformation(t),v=!0,m?!1===m.complete&&2===this.mixStorage.curProvider?v=!1:m.complete&&i.destroy():v=!1,this.aws.s3||(this.mixStorage.curProvider=1),E=hu,v){M.next=24;break}return M.prev=10,M.next=13,this.core.sendCmd("getMixStoreToken",{mixStoreTokenReqTag:{provider:this.mixStorage.curProvider,tokenCount:1,tag:"qchat",nosSurvivalTime:t.nosSurvivalTime,returnBody:getUploadResponseFormat(t.type),policyVersion:this.mixStorage.mixStorePolicy.policyVersion}});case 13:I=M.sent,E=I.content.mixStoreTokenResTag,M.next=24;break;case 17:if(M.prev=17,M.t0=M.catch(10),this.core.logger.error("uploadFile:: getMixStoreToken error",M.t0),i.destroy(),!(M.t0 instanceof Hl)){M.next=23;break}throw M.t0;case 23:throw new Jl({code:"v2"===get(this.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"getMixStoreToken error",rawError:M.t0,curProvider:this.mixStorage.curProvider,mixStorePolicy:this.mixStorage.mixStorePolicy}});case 24:if(v){M.next=28;break}return M.abrupt("return",2===this.mixStorage.curProvider?this.aws.s3Upload(t,i,E):this.nos.nosUpload(t,i,E));case 28:return M.abrupt("return",this.nos.nosUpload(t,i,null===(h=null===(u=null==m?void 0:m.uploadInfo)||void 0===u?void 0:u.payload)||void 0===h?void 0:h.mixStoreToken));case 29:case"end":return M.stop()}}),_callee3,this,[[10,17]])})))},t.getThumbUrl=function getThumbUrl(t,i){var u,h,m,v,E;if(!new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/).test(t))return this.logger.error("illegal file url:"+t),t;var I=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t);I[0],I[1],I[2],I[3],I[4];var M=I[5];if(I[6],I[7],null===(u=this.grayConfig)||void 0===u?void 0:u.mixStoreEnable){var S=this._getUrlType(t);if(2===S&&this.mixStorePolicy.s3Policy&&get(this.mixStorePolicy,"s3Policy.thumbPolicy.imagethumb"))return(null===(m=null===(h=this.mixStorePolicy.s3Policy)||void 0===h?void 0:h.thumbPolicy)||void 0===m?void 0:m.imagethumb).replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",M).replace("{x}",i.width.toString()).replace("{y}",i.height.toString());if(1===S&&this.mixStorePolicy.nosPolicy&&get(this.mixStorePolicy,"nosPolicy.thumbPolicy.imagethumb"))return(null===(E=null===(v=this.mixStorePolicy.nosPolicy)||void 0===v?void 0:v.thumbPolicy)||void 0===E?void 0:E.imagethumb).replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",M).replace("{x}",i.width.toString()).replace("{y}",i.height.toString())}return includes(t).call(t,"?")?t+"&imageView&thumbnail="+i.width+"x"+i.height:t+"?imageView&thumbnail="+i.width+"x"+i.height},t.getVideoCoverUrl=function getVideoCoverUrl(t,i){var u,h,m,v,E;if(!new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/).test(t))return this.logger.error("illegal file url:"+t),t;var I=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t);I[0],I[1],I[2],I[3],I[4];var M=I[5];if(I[6],I[7],null===(u=this.grayConfig)||void 0===u?void 0:u.mixStoreEnable){var S=this._getUrlType(t);if(2===S&&this.mixStorePolicy.s3Policy&&get(this.mixStorePolicy,"s3Policy.thumbPolicy.vframe"))return(null===(m=null===(h=this.mixStorePolicy.s3Policy)||void 0===h?void 0:h.thumbPolicy)||void 0===m?void 0:m.vframe).replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",M).replace("{x}",i.width.toString()).replace("{y}",i.height.toString()).replace("{offset}","0").replace("{type}","png");if(1===S&&this.mixStorePolicy.nosPolicy&&get(this.mixStorePolicy,"nosPolicy.thumbPolicy.vframe"))return(null===(E=null===(v=this.mixStorePolicy.nosPolicy)||void 0===v?void 0:v.thumbPolicy)||void 0===E?void 0:E.vframe).replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",M).replace("{x}",i.width.toString()).replace("{y}",i.height.toString()).replace("{offset}","0").replace("{type}","png")}return includes(t).call(t,"?")?t+"&vframe&offset=0&resize="+i.width+"x"+i.height+"&type=png":t+"?vframe&offset=0&resize="+i.width+"x"+i.height+"&type=png"},t.getPrivateUrl=function getPrivateUrl(t){var i;if(!new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/).test(t))return this.logger.error("illegal file url:"+t),"";var u=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t);u[0];var h=u[1],m=u[2],v=u[3];u[4];var E=u[5];if(u[6],u[7],null===(i=this.grayConfig)||void 0===i?void 0:i.mixStoreEnable){var I=this._getUrlType(t);return 2===I&&this.mixStorePolicy.s3Policy&&(t=this.mixStorePolicy.s3Policy.cdnSchema.replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",E)),1===I&&this.mixStorePolicy.nosPolicy&&(t=this.mixStorePolicy.nosPolicy.cdnSchema.replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",E)),t}var M=this.config,S=M.downloadUrl,T=M.downloadHostList,C=M.nosCdnEnable,R=this.config.cdn.cdnDomain,A=this.config.cdn.objectNamePrefix?decodeURIComponent(this.config.cdn.objectNamePrefix):"",N=decodeURIComponent(E),O=indexOf(N).call(N,A);if(R&&O>-1&&C)return h+":"+m+R+"/"+slice(N).call(N,O);if(includes(T).call(T,v)&&includes(E).call(E,"/")){var w=indexOf(E).call(E,"/"),x=E.substring(0,w),k=E.substring(w+1);return S.replace("{bucket}",x).replace("{object}",k)}var P=filter(T).call(T,(function(t){return"string"==typeof v&&includes(v).call(v,t)}))[0],L=P?v.replace(P,"").replace(/\W/g,""):null;return L?S.replace("{bucket}",L).replace("{object}",E):t},t.getOriginUrl=function getOriginUrl(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var i;return ms.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:if("string"==typeof t&&includes(t).call(t,"_im_url=1")){u.next=2;break}return u.abrupt("return",t);case 2:return u.next=4,this.core.sendCmd("getOriginUrl",{nosSafeUrlTag:{safeUrl:t}});case 4:return i=u.sent,u.abrupt("return",i.content.nosSafeUrlTag.originUrl);case 6:case"end":return u.stop()}}),_callee4,this)})))},t.getFileToken=function getFileToken(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var i,u,h,m,v,E=this;return ms.wrap((function _callee5$(I){for(;;)switch(I.prev=I.next){case 0:if(validate({type:{type:"number",min:2,max:3},urls:{type:"array",required:!1,itemType:"string"}},t),i=this.mixStorePolicy.nosPolicy?this.mixStorePolicy.nosPolicy.authPolicy.policyType:null,u=this.mixStorePolicy.s3Policy?this.mixStorePolicy.s3Policy.authPolicy.policyType:null,i!==String(-1)||u!==String(-1)){I.next=8;break}throw this.logger.error("don't need token"),new Error("don't need token");case 8:if(2!==t.type){I.next=17;break}if(!(i&&indexOf(i).call(i,String(2))>=0||u&&indexOf(u).call(u,String(2))>0)){I.next=13;break}return I.abrupt("return",this.mixStorage.getFileAuthToken(t));case 13:throw this.logger.error("don't support time token "),new Error("don't support type time token ");case 15:I.next=33;break;case 17:if(t.urls&&t.urls.length){I.next=20;break}throw this.logger.error("urls is required when urls token"),new Error("urls is required when urls token");case 20:if(m=[],v=[],forEach$1(h=t.urls).call(h,(function(t){var i=E._getUrlType(t);1===i&&v.push(t),2===i&&m.push(t)})),(!u||0!==m.length&&indexOf(u).call(u,String(3))<0)&&(this.logger.warn("s3 url don't support url token"),m=[]),(!i||0!==v.length&&indexOf(i).call(i,String(3))<0)&&(this.logger.warn("nos url don't support url token"),v=[]),0!==m.length||0!==v.length){I.next=30;break}throw this.logger.error("not support urls"),new Error("not support urls");case 30:if(0!==m.length&&0!==v.length){I.next=33;break}return t.urls=Ms(t.urls),I.abrupt("return",this.mixStorage.getFileAuthToken(t));case 33:case"end":return I.stop()}}),_callee5,this)})))},t._getUrlType=function _getUrlType(t){var i,u;return this.mixStorePolicy.nosPolicy&&some(i=this.mixStorePolicy.nosPolicy.dlcdns).call(i,(function(i){return indexOf(t).call(t,i)>=0}))?1:this.mixStorePolicy.s3Policy&&some(u=this.mixStorePolicy.s3Policy.dlcdns).call(u,(function(i){return indexOf(t).call(t,i)>=0}))?2:null},t.getNosAccessToken=function getNosAccessToken(t){return validate({url:{type:"string",allowEmpty:!1}},t),this.nos.getNosAccessToken(t)},t.deleteNosAccessToken=function deleteNosAccessToken(t){return validate({token:{type:"string",allowEmpty:!1}},t),this.nos.deleteNosAccessToken(t)},t.process=function process(t){var i=get(t,"error.detail.ignore");return t.error&&!i?Ja.reject(t.error):Ja.resolve(t)},us(CloudStorageService,[{key:"grayConfig",get:function get(){return this.mixStorage.grayConfig}},{key:"mixStorePolicy",get:function get(){return this.mixStorage.mixStorePolicy}}]),CloudStorageService}(),Ju=TypeError,deletePropertyOrThrow=function(t,i){if(!delete t[i])throw Ju("Cannot delete property "+tryToString(i)+" of "+tryToString(t))},Xu=Math.floor,mergeSort=function(t,i){var u=t.length,h=Xu(u/2);return u<8?insertionSort(t,i):merge(t,mergeSort(arraySliceSimple(t,0,h),i),mergeSort(arraySliceSimple(t,h),i),i)},insertionSort=function(t,i){for(var u,h,m=t.length,v=1;v<m;){for(h=v,u=t[v];h&&i(t[h-1],u)>0;)t[h]=t[--h];h!==v++&&(t[h]=u)}return t},merge=function(t,i,u,h){for(var m=i.length,v=u.length,E=0,I=0;E<m||I<v;)t[E+I]=E<m&&I<v?h(i[E],u[I])<=0?i[E++]:u[I++]:E<m?i[E++]:u[I++];return t},Zu=mergeSort,ed=H.match(/firefox\/(\d+)/i),td=!!ed&&+ed[1],rd=/MSIE|Trident/.test(H),nd=H.match(/AppleWebKit\/(\d+)\./),ad=!!nd&&+nd[1],od=[],id=N(od.sort),sd=N(od.push),cd=fails((function(){od.sort(void 0)})),ld=fails((function(){od.sort(null)})),ud=arrayMethodIsStrict("sort"),dd=!fails((function(){if(Z)return Z<70;if(!(td&&td>3)){if(rd)return!0;if(ad)return ad<603;var t,i,u,h,m="";for(t=65;t<76;t++){switch(i=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:u=3;break;case 68:case 71:u=4;break;default:u=2}for(h=0;h<47;h++)od.push({k:i+h,v:u})}for(od.sort((function(t,i){return i.v-t.v})),h=0;h<od.length;h++)i=od[h].k.charAt(0),m.charAt(m.length-1)!==i&&(m+=i);return"DGBEFHACIJK"!==m}}));_export({target:"Array",proto:!0,forced:cd||!ld||!ud||!dd},{sort:function sort(t){void 0!==t&&aCallable(t);var i=toObject(this);if(dd)return void 0===t?id(i):id(i,t);var u,h,m=[],v=lengthOfArrayLike(i);for(h=0;h<v;h++)h in i&&sd(m,i[h]);for(Zu(m,function(t){return function(i,u){return void 0===u?-1:void 0===i?1:void 0!==t?+t(i,u)||0:toString(i)>toString(u)?1:-1}}(t)),u=lengthOfArrayLike(m),h=0;h<u;)i[h]=m[h++];for(;h<v;)deletePropertyOrThrow(i,h++);return i}});var pd,hd,md,fd=entryVirtual("Array").sort,gd=Array.prototype,sort=function(t){var i=t.sort;return t===gd||$(gd,t)&&i===gd.sort?fd:i};!function(t){t[t.ASC=1]="ASC",t[t.DESC=2]="DESC"}(pd||(pd={})),function(t){t[t.reorderWeight=0]="reorderWeight",t[t.createTime=1]="createTime",t[t.totalMember=2]="totalMember"}(hd||(hd={})),function(t){t[t.square=1]="square",t[t.person=2]="person"}(md||(md={}));var vd=function(t){function Service(i,u){var h;return(h=t.call(this)||this).name=i,h.core=u,h.name=i,h.logger=u.logger,h.core=u,h}bt(Service,t);var i=Service.prototype;return i.emit=function emit(i){var u=this;try{for(var h,m,v=arguments.length,E=new Array(v>1?v-1:0),I=1;I<v;I++)E[I-1]=arguments[I];var M=(h=t.prototype.emit).call.apply(h,concat(m=[this,i]).call(m,E));return M}catch(t){return vo((function(){throw u.logger.error(u.name+"::emit throw error in setTimeout. event: "+i.toString()+". Error",t),t}),0),!1}},i.process=function process(t){var i=this[t.cmd+"Handler"];if("function"==typeof i)return i.call(this,t);var u=get(t,"error.detail.ignore");return t.error&&!u?Ja.reject(t.error):Ja.resolve(t)},Service}(_o),_d={"24_15":"qchatSubscribe","24_27":"qchatGetUnreadInfo","24_48":"qchatCreateChannel","24_49":"qchatDeleteChannel","24_50":"qchatUpdateChannel","24_51":"qchatGetChannels","24_52":"qchatGetChannelsByPage","24_53":"qchatGetMembersByPage","24_54":"qchatUpdateWhiteBlackRole","24_55":"qchatGetWhiteBlackRolesPage","24_56":"qchatUpdateWhiteBlackMembers","24_57":"qchatGetWhiteBlackMembersPage","24_58":"qchatGetExistingWhiteBlackRoles","24_59":"qchatGetExistingWhiteBlackMembers","24_60":"qchatUpdateCategoryInfoOfChannel","24_109":"qchatCreateChannelCategory","24_110":"qchatRemoveChannelCategory","24_111":"qchatUpdateChannelCategory","24_112":"qchatGetChannelCategoriesByID","24_113":"qchatUpdateChannelCategoryWhiteBlackRole","24_114":"qchatGetChannelCategoryWhiteBlackRolesPage","24_115":"qchatUpdateChannelCategoryWhiteBlackMembers","24_116":"qchatGetChannelCategoryWhiteBlackMembersPage","24_117":"qchatGetChannelCategoryWhiteBlackRoles","24_118":"qchatGetChannelCategoryWhiteBlackMembers","24_119":"qchatGetChannelCategoriesPage","24_120":"qchatGetChannelCategoryChannelsPage","24_93":"qchatGetChannelSearchByPage","24_95":"qchatChannelMemberSearch","25_8":"qchatGetRoleIdsByServerId","25_9":"qchatSubscribeAsVisitor","25_12":"qchatAutoSubscribe","25_13":"qchatAutoSubscribeNotification"},yd={serverId:1,channelId:2,ackTimestamp:3,unreadCount:4,mentionedCount:5,maxCount:6,lastMsgTime:7},Ed={channelInfo:{channelId:1,serverId:2,name:4,topic:5,ext:6,type:7,validFlag:8,createTime:9,updateTime:10,owner:11,viewMode:12,categoryId:13,syncMode:14,reorderWeight:15,visitorMode:16},antispamTag:{antiSpamBusinessId:1},memberInfo:{serverId:1,accid:3,nick:4,avatar:5,ext:6,type:7,joinTime:8,inviter:9,validFlag:10,createTime:11,updateTime:12},serverRole:{serverId:1,roleId:2,name:3,icon:4,ext:5,auths:6,type:7,memberCount:8,priority:9,createTime:10,updateTime:11},qchatSubReqTag:{type:1,opeType:2},qchatChannelIdInfoTag:{serverId:1,channelId:2},unreadInfo:yd,qchatGetChannelListPageTag:{serverId:1,timetag:2,limit:3},qchatGetMembersByPageTag:{serverId:1,channelId:2,timetag:3,limit:4},qchatUpdateWhiteBlackRoleTag:{serverId:1,channelId:2,type:3,opeType:4,roleId:5},qchatGetWhiteBlackRolesPageTag:{serverId:1,channelId:2,type:3,timetag:4,limit:5},qchatUpdateWhiteBlackMembersTag:{serverId:1,channelId:2,type:3,opeType:4,toAccids:5},qchatGetWhiteBlackMembersPageTag:{serverId:1,channelId:2,type:3,timetag:4,limit:5},qchatGetExistingWhiteBlackRolesTag:{serverId:1,channelId:2,type:3,roleIds:4},qchatGetExistingWhiteBlackMembersTag:{serverId:1,channelId:2,type:3,accids:4},QChatChannelCategoryInfo:{categoryId:1,serverId:2,name:4,ext:5,owner:6,viewMode:7,validFlag:8,createTime:9,updateTime:10,channelNumber:11},qchatUpdateChannelCategoryWhiteBlackRoleTag:{serverId:1,categoryId:2,type:3,opeType:4,roleId:5},qchatGetChannelCategoryWhiteBlackRolesPageTag:{serverId:1,categoryId:2,type:3,timetag:4,limit:5},qchatUpdateChannelCategoryWhiteBlackMembersTag:{serverId:1,categoryId:2,type:3,opeType:4,toAccids:5},qchatGetChannelCategoryWhiteBlackMembersPageTag:{serverId:1,categoryId:2,type:3,timetag:4,limit:5},qchatGetChannelCategoryWhiteBlackRolesTag:{serverId:1,categoryId:2,type:3,roleIds:4},qchatGetChannelCategoryWhiteBlackMembersTag:{serverId:1,categoryId:2,type:3,accids:4},qchatGetChannelCategoriesPageTag:{serverId:1,timetag:2,limit:3},qchatGetChannelCategoryChannelsPageTag:{serverId:1,categoryId:2,timetag:3,limit:4},qchatGetChannelSearchByPageTag:{keyword:1,startTime:2,endTime:3,order:4,limit:5,serverId:6,sort:7,cursor:8},qchatUpdateChannelTag:{channelId:1,name:4,topic:5,ext:6,viewMode:12,visitorMode:16},serverRoles:{serverId:1,roleIds:2,timeTag:3},qchatChannelMemberSearchTag:{serverId:1,channelId:2,keyword:3,limit:4},qchatChannelMemberInfo:{serverId:1,channelId:2,avatar:3,accid:4,nick:5,createTime:6,updateTime:7}},Id=function getDeserializeTag(){return invertSerializeMap(Ed)},Md=function getCmdConfig(){var t=Id();return{qchatCreateChannel:{sid:24,cid:48,service:"qchatChannel",params:[{type:"Property",name:"channelInfo",reflectMapper:Ed.channelInfo},{type:"Property",name:"antispamTag",reflectMapper:Ed.antispamTag}],response:[{type:"Property",name:"channelInfo",reflectMapper:t.channelInfo}]},qchatDeleteChannel:{sid:24,cid:49,service:"qchatChannel",params:[{type:"Long",name:"channelId"}]},qchatUpdateChannel:{sid:24,cid:50,service:"qchatChannel",params:[{type:"Property",name:"channelInfo",reflectMapper:Ed.qchatUpdateChannelTag},{type:"Property",name:"antispamTag",reflectMapper:Ed.antispamTag}],response:[{type:"Property",name:"channelInfo",reflectMapper:t.channelInfo}]},qchatGetChannels:{sid:24,cid:51,service:"qchatChannel",params:[{type:"LongArray",name:"channelIds"}],response:[{type:"PropertyArray",name:"channelList",reflectMapper:t.channelInfo}]},qchatGetChannelsByPage:{sid:24,cid:52,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelListPageTag",reflectMapper:Ed.qchatGetChannelListPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.channelInfo}]},qchatGetMembersByPage:{sid:24,cid:53,service:"qchatChannel",params:[{type:"Property",name:"qchatGetMembersByPageTag",reflectMapper:Ed.qchatGetMembersByPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.memberInfo}]},qchatUpdateWhiteBlackRole:{sid:24,cid:54,service:"qchatChannel",params:[{type:"Property",name:"qchatUpdateWhiteBlackRoleTag",reflectMapper:Ed.qchatUpdateWhiteBlackRoleTag}]},qchatGetWhiteBlackRolesPage:{sid:24,cid:55,service:"qchatChannel",params:[{type:"Property",name:"qchatGetWhiteBlackRolesPageTag",reflectMapper:Ed.qchatGetWhiteBlackRolesPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.serverRole}]},qchatUpdateWhiteBlackMembers:{sid:24,cid:56,service:"qchatChannel",params:[{type:"Property",name:"qchatUpdateWhiteBlackMembersTag",reflectMapper:Ed.qchatUpdateWhiteBlackMembersTag}]},qchatGetWhiteBlackMembersPage:{sid:24,cid:57,service:"qchatChannel",params:[{type:"Property",name:"qchatGetWhiteBlackMembersPageTag",reflectMapper:Ed.qchatGetWhiteBlackMembersPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.memberInfo}]},qchatGetExistingWhiteBlackRoles:{sid:24,cid:58,service:"qchatChannel",params:[{type:"Property",name:"qchatGetExistingWhiteBlackRolesTag",reflectMapper:Ed.qchatGetExistingWhiteBlackRolesTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.serverRole}]},qchatGetExistingWhiteBlackMembers:{sid:24,cid:59,service:"qchatChannel",params:[{type:"Property",name:"qchatGetExistingWhiteBlackMembersTag",reflectMapper:Ed.qchatGetExistingWhiteBlackMembersTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.memberInfo}]},qchatUpdateCategoryInfoOfChannel:{sid:24,cid:60,service:"qchatChannel",params:[{type:"Property",name:"qchatUpdateCategoryInfoOfChannelTag",reflectMapper:Ed.channelInfo}],response:[{type:"Property",name:"channelInfo",reflectMapper:t.channelInfo}]},qchatCreateChannelCategory:{sid:24,cid:109,service:"qchatChannel",params:[{type:"Property",name:"qchatCreateChannelCategoryTag",reflectMapper:Ed.QChatChannelCategoryInfo}],response:[{type:"Property",name:"QChatChannelCategoryInfo",reflectMapper:t.QChatChannelCategoryInfo}]},qchatRemoveChannelCategory:{sid:24,cid:110,service:"qchatChannel",params:[{type:"Long",name:"categoryId"}]},qchatUpdateChannelCategory:{sid:24,cid:111,service:"qchatChannel",params:[{type:"Property",name:"qchatUpdateChannelCategoryTag",reflectMapper:Ed.QChatChannelCategoryInfo}],response:[{type:"Property",name:"QChatChannelCategoryInfo",reflectMapper:t.QChatChannelCategoryInfo}]},qchatGetChannelCategoriesByID:{sid:24,cid:112,service:"qchatChannel",params:[{type:"LongArray",name:"categoryIds"}],response:[{type:"PropertyArray",name:"channelCategoryList",reflectMapper:t.QChatChannelCategoryInfo}]},qchatUpdateChannelCategoryWhiteBlackRole:{sid:24,cid:113,service:"qchatChannel",params:[{type:"Property",name:"qchatUpdateChannelCategoryWhiteBlackRoleTag",reflectMapper:Ed.qchatUpdateChannelCategoryWhiteBlackRoleTag}]},qchatGetChannelCategoryWhiteBlackRolesPage:{sid:24,cid:114,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoryWhiteBlackRolesPageTag",reflectMapper:Ed.qchatGetChannelCategoryWhiteBlackRolesPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.serverRole}]},qchatUpdateChannelCategoryWhiteBlackMembers:{sid:24,cid:115,service:"qchatChannel",params:[{type:"Property",name:"qchatUpdateChannelCategoryWhiteBlackMembersTag",reflectMapper:Ed.qchatUpdateChannelCategoryWhiteBlackMembersTag}]},qchatGetChannelCategoryWhiteBlackMembersPage:{sid:24,cid:116,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoryWhiteBlackMembersPageTag",reflectMapper:Ed.qchatGetChannelCategoryWhiteBlackMembersPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.memberInfo}]},qchatGetChannelCategoryWhiteBlackRoles:{sid:24,cid:117,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoryWhiteBlackRolesTag",reflectMapper:Ed.qchatGetChannelCategoryWhiteBlackRolesTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.serverRole}]},qchatGetChannelCategoryWhiteBlackMembers:{sid:24,cid:118,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoryWhiteBlackMembersTag",reflectMapper:Ed.qchatGetChannelCategoryWhiteBlackMembersTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.memberInfo}]},qchatGetChannelCategoriesPage:{sid:24,cid:119,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoriesPageTag",reflectMapper:Ed.qchatGetChannelCategoriesPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.QChatChannelCategoryInfo}]},qchatGetChannelCategoryChannelsPage:{sid:24,cid:120,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoryChannelsPageTag",reflectMapper:Ed.qchatGetChannelCategoryChannelsPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.channelInfo}]},qchatSubscribe:{sid:24,cid:15,service:"qchatChannel",params:[{type:"Property",name:"qchatSubReqTag",reflectMapper:Ed.qchatSubReqTag},{type:"PropertyArray",name:"channels",reflectMapper:Ed.qchatChannelIdInfoTag}],response:[{type:"PropertyArray",name:"unreadInfos",reflectMapper:t.unreadInfo},{type:"PropertyArray",name:"failedChannels",reflectMapper:t.qchatChannelIdInfoTag}]},qchatAutoSubscribe:{sid:25,cid:12,service:"qchatChannel",hasPacketTimer:!1,params:[{type:"Property",name:"qchatAutoSubReqTag"}],response:[{type:"Property",name:"qchatAutoSubInfo",reflectMapper:{1:"time"}}]},qchatAutoSubscribeNotification:{service:"qchatChannel",sid:25,cid:13,response:[{type:"PropertyArray",name:"serverIds",reflectMapper:t.unreadInfo},{type:"PropertyArray",name:"unreadInfos",reflectMapper:t.unreadInfo}]},qchatGetUnreadInfo:{sid:24,cid:27,service:"qchatChannel",params:[{type:"PropertyArray",name:"channels",reflectMapper:Ed.qchatChannelIdInfoTag}],response:[{type:"PropertyArray",name:"unreadInfos",reflectMapper:t.unreadInfo}]},qchatGetChannelSearchByPage:{sid:24,cid:93,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelSearchByPageTag",reflectMapper:Ed.qchatGetChannelSearchByPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag",3:"cursor"}},{type:"PropertyArray",name:"datas",reflectMapper:t.channelInfo}]},qchatGetRoleIdsByServerId:{sid:25,cid:8,service:"qchatChannel",params:[{type:"Property",name:"qchatGetRoleIdsByServerIdTag",reflectMapper:{serverIdTimeTags:1}}],response:[{type:"PropertyArray",name:"serverRoles",reflectMapper:t.serverRoles},{type:"String",name:"failServerIds"}]},qchatChannelMemberSearch:{sid:24,cid:95,service:"qchatChannel",params:[{type:"Property",name:"qchatChannelMemberSearchTag",reflectMapper:Ed.qchatChannelMemberSearchTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.qchatChannelMemberInfo}]},qchatSubscribeAsVisitor:{sid:25,cid:9,service:"qchatChannel",params:[{type:"Property",name:"tag",reflectMapper:Ed.qchatSubReqTag},{type:"PropertyArray",name:"datas",reflectMapper:Ed.qchatChannelIdInfoTag}],response:[{type:"PropertyArray",name:"failedArr",reflectMapper:t.qchatChannelIdInfoTag}]}}},Sd={"24_31":"qchatCreateServer","24_32":"qchatDeleteServer","24_33":"qchatUpdateServer","24_34":"qchatGetServers","24_35":"qchatGetServersByPage","24_36":"qchatInviteServerMembers","24_37":"qchatAcceptServerInvite","24_38":"qchatRejectInviteServer","24_39":"qchatApplyServerJoin","24_40":"qchatAcceptServerApply","24_41":"qchatRejectServerApply","24_42":"qchatKickServerMembers","24_43":"qchatLeaveServer","24_44":"qchatUpdateMyMemberInfo","24_45":"qchatUpdateServerMemberInfo","24_46":"qchatGetServerMembers","24_47":"qchatGetServerMembersByPage","24_104":"qchatUpdateServerMemberBan","24_105":"qchatGetBannedMembersByPage","24_91":"qchatServerSearchByPage","24_92":"qchatServerMemberSearchByPage","24_122":"qchatGenerateInviteCode","24_123":"qchatJoinByInviteCode","24_124":"qchatGetInviteApplyRecordOfServer","24_125":"qchatGetInviteApplyRecordOfSelf","25_5":"qchatClearServersUnread","25_7":"qchatSubscribeChannelsByServers","25_10":"qchatEnterAsVisitor","25_11":"qchatLeaveAsVisitor"},Td={serverInfo:{serverId:1,name:3,icon:4,ext:5,owner:6,memberNumber:7,inviteMode:8,applyMode:9,validFlag:10,createTime:11,updateTime:12,channelNumber:13,categoryNumber:14,searchType:15,searchEnable:16,reorderWeight:17},antispamTag:{antiSpamBusinessId:1},memberInfo:{serverId:1,accid:3,nick:4,avatar:5,ext:6,type:7,joinTime:8,inviter:9,validFlag:10,createTime:11,updateTime:12},otherMemberInfo:{serverId:1,accid:3,nick:4,avatar:5,type:7,joinTime:8,inviter:9,validFlag:10,createTime:11,updateTime:12},getServerListPageTag:{timestamp:1,limit:2},getServerMemberListPageTag:{serverId:1,timetag:2,limit:3},updateServerMemberBanTag:{serverId:1,opeType:2,accid:3,ext:4},getBannedMembersByPageTag:{serverId:1,timetag:2,limit:3},serverMemberBanInfo:{serverId:1,appid:2,accid:3,ext:4,banTime:5,validFlag:6,createTime:7,updateTime:8},serverSearchByPageTag:{keyword:1,startTime:2,endTime:3,order:4,limit:5,serverType:6,searchType:7,sort:8,cursor:9},serverMemberSearchByPageTag:{serverId:1,keyword:3,limit:4},inviteRespParamTag:{requestId:1},applyRespParamTag:{requestId:1,expireTime:2},inviteApplyRecord:{accid:1,type:2,serverId:3,status:4,requestId:5,createTime:6,updateTime:7,expireTime:8,data:9,recordId:10},clearServersUnreadTag:{successServerIds:1,failServerIds:2,ackTimestamp:3},unreadInfo:yd},Cd=function getDeserializeTag(){return invertSerializeMap(Td)},bd=function getCmdConfig(){var t=Cd();return{qchatCreateServer:{sid:24,cid:31,service:"qchatServer",params:[{type:"Property",name:"serverInfo",reflectMapper:Td.serverInfo},{type:"Property",name:"antispamTag",reflectMapper:Td.antispamTag}],response:[{type:"Property",name:"serverInfo",reflectMapper:t.serverInfo}]},qchatDeleteServer:{sid:24,cid:32,service:"qchatServer",params:[{type:"Long",name:"serverId"}]},qchatUpdateServer:{sid:24,cid:33,service:"qchatServer",params:[{type:"Property",name:"serverInfo",reflectMapper:Td.serverInfo},{type:"Property",name:"antispamTag",reflectMapper:Td.antispamTag}],response:[{type:"Property",name:"serverInfo",reflectMapper:t.serverInfo}]},qchatGetServers:{sid:24,cid:34,service:"qchatServer",params:[{type:"LongArray",name:"serverIds"}],response:[{type:"PropertyArray",name:"serverList",reflectMapper:t.serverInfo}]},qchatGetServersByPage:{sid:24,cid:35,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:Td.getServerListPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.serverInfo}]},qchatInviteServerMembers:{sid:24,cid:36,service:"qchatServer",params:[{type:"Long",name:"serverId"},{type:"StrArray",name:"accids"},{type:"String",name:"ps"},{type:"Property",name:"params",reflectMapper:{ttl:1}}],response:[{type:"StrArray",name:"failByOverAccids"},{type:"StrArray",name:"failByBanAccids"},{type:"Property",name:"record",reflectMapper:t.applyRespParamTag}]},qchatAcceptServerInvite:{sid:24,cid:37,service:"qchatServer",params:[{type:"Long",name:"serverId"},{type:"String",name:"accid"},{type:"Property",name:"recordInfo",reflectMapper:Td.inviteRespParamTag}]},qchatRejectInviteServer:{sid:24,cid:38,service:"qchatServer",params:[{type:"Long",name:"serverId"},{type:"String",name:"accid"},{type:"String",name:"ps"},{type:"Property",name:"recordInfo",reflectMapper:Td.inviteRespParamTag}]},qchatApplyServerJoin:{sid:24,cid:39,service:"qchatServer",params:[{type:"Long",name:"serverId"},{type:"String",name:"ps"},{type:"Property",name:"params",reflectMapper:{ttl:1}}],response:[{type:"Property",name:"data",reflectMapper:t.applyRespParamTag}]},qchatAcceptServerApply:{sid:24,cid:40,service:"qchatServer",params:[{type:"Long",name:"serverId"},{type:"String",name:"accid"},{type:"Property",name:"recordInfo",reflectMapper:Td.applyRespParamTag}]},qchatRejectServerApply:{sid:24,cid:41,service:"qchatServer",params:[{type:"Long",name:"serverId"},{type:"String",name:"accid"},{type:"String",name:"ps"},{type:"Property",name:"recordInfo",reflectMapper:Td.applyRespParamTag}]},qchatKickServerMembers:{sid:24,cid:42,service:"qchatServer",params:[{type:"Long",name:"serverId"},{type:"StrArray",name:"accids"}]},qchatLeaveServer:{sid:24,cid:43,service:"qchatServer",params:[{type:"Long",name:"serverId"}]},qchatUpdateMyMemberInfo:{sid:24,cid:44,service:"qchatServer",params:[{type:"Property",name:"memberInfo",reflectMapper:Td.memberInfo},{type:"Property",name:"antispamTag",reflectMapper:Td.antispamTag}],response:[{type:"Property",name:"memberInfo",reflectMapper:t.memberInfo}]},qchatUpdateServerMemberInfo:{sid:24,cid:45,service:"qchatServer",params:[{type:"Property",name:"memberInfo",reflectMapper:Td.otherMemberInfo},{type:"Property",name:"antispamTag",reflectMapper:Td.antispamTag}],response:[{type:"Property",name:"memberInfo",reflectMapper:t.memberInfo}]},qchatGetServerMembers:{sid:24,cid:46,service:"qchatServer",params:[{type:"StrArray",name:"accids"}],response:[{type:"PropertyArray",name:"accidList",reflectMapper:t.memberInfo}]},qchatGetServerMembersByPage:{sid:24,cid:47,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:Td.getServerMemberListPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.memberInfo}]},qchatUpdateServerMemberBan:{sid:24,cid:104,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:Td.updateServerMemberBanTag}]},qchatGetBannedMembersByPage:{sid:24,cid:105,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:Td.getBannedMembersByPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag"}},{type:"PropertyArray",name:"datas",reflectMapper:t.serverMemberBanInfo}]},qchatServerSearchByPage:{sid:24,cid:91,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:Td.serverSearchByPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:{1:"hasMore",2:"nextTimetag",3:"cursor"}},{type:"PropertyArray",name:"datas",reflectMapper:t.serverInfo}]},qchatServerMemberSearchByPage:{sid:24,cid:92,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:Td.serverMemberSearchByPageTag}],response:[{type:"PropertyArray",name:"members",reflectMapper:t.memberInfo}]},qchatGenerateInviteCode:{sid:24,cid:122,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:{serverId:1,ttl:2}}],response:[{type:"Property",name:"data",reflectMapper:{1:"serverId",2:"requestId",3:"inviteCode",4:"expireTime"}}]},qchatJoinByInviteCode:{sid:24,cid:123,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:{serverId:1,inviteCode:2,ps:3}}]},qchatGetInviteApplyRecordOfServer:{sid:24,cid:124,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:{serverId:1,fromTime:2,toTime:3,reverse:4,limit:5,cursor:6}}],response:[{type:"PropertyArray",name:"data",reflectMapper:t.inviteApplyRecord}]},qchatGetInviteApplyRecordOfSelf:{sid:24,cid:125,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:{fromTime:1,toTime:2,reverse:3,limit:4,cursor:5}}],response:[{type:"PropertyArray",name:"data",reflectMapper:t.inviteApplyRecord}]},qchatClearServersUnread:{sid:25,cid:5,service:"qchatServer",params:[{type:"LongArray",name:"serverIds"}],response:[{type:"Property",name:"clearServersUnreadTag",reflectMapper:t.clearServersUnreadTag}]},qchatSubscribeChannelsByServers:{sid:25,cid:7,service:"qchatServer",params:[{type:"Int",name:"type"},{type:"LongArray",name:"serverIds"}],response:[{type:"PropertyArray",name:"unreadInfos",reflectMapper:t.unreadInfo},{type:"String",name:"failServerIds"}]},qchatEnterAsVisitor:{sid:25,cid:10,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:{serverIds:1}}],response:[{type:"String",name:"failServerIds"}]},qchatLeaveAsVisitor:{sid:25,cid:11,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:{serverIds:1}}],response:[{type:"String",name:"failServerIds"}]}}};function format(t,i){if(!isPlainObject(i))return{};var u=JSON.parse(Ms(i)),h=doFormat(t,u);return JSON.parse(Ms(xt(xt({},u),h)))}function doFormat(t,i){if(!isPlainObject(i))return{};var u={},h=es(t);return forEach$1(h).call(h,(function(h){var m=t[h].type;if("string"!=typeof m){var v=doFormat(t[h],i);es(v).length>0&&(u[h]=v)}else{var E=t[h],I=E.rawKey||h,M=Rd[m](i,I,E);void 0!==M&&(i[I]=void 0,u[h]=M)}})),u}var Rd={number:function number(t,i){if(void 0!==t[i])return+t[i]},string:function string(t,i){if(void 0!==t[i])return t[i]},boolean:function boolean(t,i){return+t[i]>0||0!=+t[i]&&void 0},enum:function _enum(t,i,u){return values(u)[t[i]]},object:function object(t,i){if(void 0!==t[i])try{return JSON.parse(t[i])}catch(t){return{}}}};function formatReverse(t,i){if(!isPlainObject(i))return{};var u=JSON.parse(Ms(i)),h=doFormatReverse(t,u);return JSON.parse(Ms(xt(xt({},u),h)))}function doFormatReverse(t,i){var u;if(!isPlainObject(i))return reduce(u=es(t)).call(u,(function(i,u){return i[t[u].rawKey||u]=void 0,i}),{});var h={},m=es(t);return forEach$1(m).call(m,(function(u){var m=t[u].type;if("string"!=typeof m){var v=doFormatReverse(t[u],i[u]);return xt(h,v),void(i[u]=void 0)}var E=t[u],I=E.rawKey||u,M=Ad[m](i,u,E);i[I]=void 0,h[I]=M})),h}var Ad={number:function number(t,i){return t[i]},string:function string(t,i){return t[i]},boolean:function boolean(t,i){return!0===t[i]?1:!1===t[i]?0:void 0},enum:function _enum(t,i,u){return values(u)[t[i]]},object:function object(t,i){if(void 0!==t[i])try{return Ms(t[i])}catch(t){return""}}},Nd=Ad,Od={serverId:{type:"string"},name:{type:"string"},icon:{type:"string"},ext:{type:"string"},owner:{type:"string"},memberNumber:{type:"number"},inviteMode:{type:"number"},applyMode:{type:"number"},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"},channelNumber:{type:"number"},categoryNumber:{type:"number"},searchType:{type:"number"},searchEnable:{type:"boolean"},reorderWeight:{type:"string"}},wd={serverId:{type:"string"},uid:{type:"string"},accid:{type:"string"},nick:{type:"string"},avatar:{type:"string"},ext:{type:"string"},type:{type:"number"},joinTime:{type:"number"},inviter:{type:"string"},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"}},xd={serverId:{type:"string"},appid:{type:"string"},accid:{type:"string"},ext:{type:"string"},banTime:{type:"number"},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"}};function formatServer(t){return format(Od,t)}function formatServers(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return formatServer(t)})):[]}function formatMember$1(t){return format(wd,t)}function formatMembers$1(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return formatMember$1(t)})):[]}function formatServerMemberBanInfos(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return function formatServerMemberBanInfo(t){return format(xd,t)}(t)})):[]}function generateAntispamTag(t){var i,u,h;if(!t.antispamTag)return{};var m=xt({},t.antispamTag);return(null===(i=t.antispamTag)||void 0===i?void 0:i.antiSpamBusinessId)&&"string"!=typeof(null===(u=t.antispamTag)||void 0===u?void 0:u.antiSpamBusinessId)&&(m.antiSpamBusinessId=Ms(null===(h=t.antispamTag)||void 0===h?void 0:h.antiSpamBusinessId)),m}var kd={accid:{type:"string"},type:{type:"number"},serverId:{type:"string"},status:{type:"number"},requestId:{type:"string"},createTime:{type:"number"},updateTime:{type:"number"},expireTime:{type:"number"},data:{type:"object"}};function formatInviteApplyRecord(t){return format(kd,t)}function formatInviteApplyRecords(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return formatInviteApplyRecord(t)})):[]}var Pd,Ld,Dd,qd,Vd={successServerIds:{type:"object"},failServerIds:{type:"object"},ackTimestamp:{type:"number"}};function formatClearServersUnread(t){return format(Vd,t)}!function(t){t[t.reorderWeight=0]="reorderWeight",t[t.createTime=1]="createTime"}(Pd||(Pd={})),function(t){t[t.white=1]="white",t[t.black=2]="black"}(Ld||(Ld={})),function(t){t[t.add=1]="add",t[t.remove=2]="remove"}(Dd||(Dd={})),function(t){t[t.message=0]="message",t[t.media=1]="media",t[t.ext=100]="ext"}(qd||(qd={}));var Ud={channelId:{type:"string"},serverId:{type:"string"},name:{type:"string"},topic:{type:"string"},ext:{type:"string"},type:{type:"enum",values:qd},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"},viewMode:{type:"number"},categoryId:{type:"string"},syncMode:{type:"number"},visitorMode:{type:"number"},reorderWeight:{type:"string"}},Gd={serverId:{type:"string"},channelId:{type:"string"},ackTimestamp:{type:"number"},unreadCount:{type:"number"},mentionedCount:{type:"number"},maxCount:{type:"number"},lastMsgTime:{type:"number"}},Fd={serverId:{type:"string"},channelId:{type:"string"},type:{type:"enum",values:Ld},opeType:{type:"enum",values:Dd},toAccids:{type:"object"}},Bd={serverId:{type:"string"},channelId:{type:"string"},type:{type:"enum",values:Ld},opeType:{type:"enum",values:Dd},roleId:{type:"string"}},jd={categoryId:{type:"string"},serverId:{type:"string"},name:{type:"string"},ext:{type:"string"},owner:{type:"string"},viewMode:{type:"number"},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"},channelNumber:{type:"number"}},Yd={serverId:{type:"string"},channelId:{type:"string"},accid:{type:"string"},avatar:{type:"string"},nick:{type:"string"},createTime:{type:"number"},updateTime:{type:"number"}};function formatUpdateWhiteBlackRole(t){return format(Bd,t)}function formatChannel(t){return format(Ud,t)}function formatChannels(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return formatChannel(t)})):[]}function formatUnreadInfo(t){return format(Gd,t)}function formatUnreadInfos(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return formatUnreadInfo(t)})):[]}function formatChannelCategory(t){return format(jd,t)}function formatChannelCategorys(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return formatChannelCategory(t)})):[]}function formatChannelMembers(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return function formatChannelMember(t){return format(Yd,t)}(t)})):[]}function formatFailServerIds(t){try{return JSON.parse(t)}catch(t){return[]}}function _createForOfIteratorHelperLoose$3(t,i){var u,h=void 0!==gi&&Ru(t)||t["@@iterator"];if(h)return bind$1(u=(h=h.call(t)).next).call(u,h);if(Qs(t)||(h=function _unsupportedIterableToArray$3(t,i){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$3(t,i);var h=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===h&&t.constructor&&(h=t.constructor.name),"Map"===h||"Set"===h?bu(t):"Arguments"===h||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?_arrayLikeToArray$3(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){h&&(t=h);var m=0;return function(){return m>=t.length?{done:!0}:{done:!1,value:t[m++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayLikeToArray$3(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,h=Array(i);u<i;u++)h[u]=t[u];return h}var Wd,$d,Hd,Qd,Kd=function(t){function QChatServerService(i){var u;return(u=t.call(this,"qchatServer",i)||this).core=i,registerParser({cmdMap:Sd,cmdConfig:bd()}),u}bt(QChatServerService,t);var i=QChatServerService.prototype;return i.createServer=function createServer(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i;return ms.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return validate({icon:{type:"string",required:!1},name:{type:"string",required:!1},ext:{type:"string",required:!1},searchType:{type:"number",required:!1,min:0},searchEnable:{type:"boolean",required:!1},inviteMode:{type:"number",min:0,max:1,required:!1},applyMode:{type:"number",min:0,max:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatCreateServer",{serverInfo:xt(xt({},t),{searchEnable:!1===t.searchEnable?0:1}),antispamTag:generateAntispamTag(t)});case 3:return i=u.sent,u.abrupt("return",formatServer(i.content.serverInfo));case 5:case"end":return u.stop()}}),_callee,this)})))},i.deleteServer=function deleteServer(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){return ms.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",min:1}},t),i.next=3,this.core.sendCmd("qchatDeleteServer",t);case 3:case"end":return i.stop()}}),_callee2,this)})))},i.updateServer=function updateServer(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var i;return ms.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",min:1},icon:{type:"string",required:!1},name:{type:"string",required:!1},ext:{type:"string",required:!1},searchType:{type:"number",required:!1,min:0},searchEnable:{type:"boolean",required:!1},inviteMode:{type:"number",min:0,max:1,required:!1},applyMode:{type:"number",min:0,max:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatUpdateServer",{serverInfo:xt(xt({},t),{searchEnable:!1===t.searchEnable?0:1}),antispamTag:generateAntispamTag(t)});case 3:return i=u.sent,u.abrupt("return",formatServer(i.content.serverInfo));case 5:case"end":return u.stop()}}),_callee3,this)})))},i.getServers=function getServers(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var i;return ms.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverIds:{type:"array",itemType:"string",min:1}},t),u.next=3,this.core.sendCmd("qchatGetServers",t);case 3:return i=u.sent,u.abrupt("return",formatServers(i.content.serverList));case 5:case"end":return u.stop()}}),_callee4,this)})))},i.getServersByPage=function getServersByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var i,u,h,m;return ms.wrap((function _callee5$(v){for(;;)switch(v.prev=v.next){case 0:return validate({timestamp:{type:"number"},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetServersByPage",{tag:t});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatServers(h)});case 6:case"end":return v.stop()}}),_callee5,this)})))},i.inviteServerMembers=function inviteServerMembers(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee6(){var i,u;return ms.wrap((function _callee6$(h){for(;;)switch(h.prev=h.next){case 0:return validate({serverId:{type:"string",min:1},accids:{type:"array",itemType:"string",min:1},ps:{type:"string"},params:{type:"object",rules:{ttl:{type:"number"}},required:!1}},t),h.next=3,this.core.sendCmd("qchatInviteServerMembers",t);case 3:return i=h.sent,u=i.content.record||{},h.abrupt("return",{failByOverAccids:i.content.failByOverAccids,failByBanAccids:i.content.failByBanAccids,recordInfo:formatInviteApplyRecord(u)});case 6:case"end":return h.stop()}}),_callee6,this)})))},i.acceptServerInvite=function acceptServerInvite(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee7(){return ms.wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1},recordInfo:{type:"object",rules:{requestId:{type:"string",allowEmpty:!1}}}},t),i.next=3,this.core.sendCmd("qchatAcceptServerInvite",t);case 3:case"end":return i.stop()}}),_callee7,this)})))},i.rejectInviteServer=function rejectInviteServer(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee8(){return ms.wrap((function _callee8$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",min:1},accid:{type:"string",min:1},ps:{type:"string"},recordInfo:{type:"object",rules:{requestId:{type:"string",allowEmpty:!1}}}},t),i.next=3,this.core.sendCmd("qchatRejectInviteServer",t);case 3:case"end":return i.stop()}}),_callee8,this)})))},i.applyServerJoin=function applyServerJoin(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee9(){var i;return ms.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",min:1},ps:{type:"string"},params:{type:"object",rules:{ttl:{type:"number"}},required:!1}},t),u.next=3,this.core.sendCmd("qchatApplyServerJoin",t);case 3:return i=u.sent,u.abrupt("return",formatInviteApplyRecord(i.content.data));case 5:case"end":return u.stop()}}),_callee9,this)})))},i.acceptServerApply=function acceptServerApply(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee10(){return ms.wrap((function _callee10$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",min:1},accid:{type:"string",min:1},recordInfo:{type:"object",rules:{requestId:{type:"string",allowEmpty:!1}}}},t),i.next=3,this.core.sendCmd("qchatAcceptServerApply",t);case 3:case"end":return i.stop()}}),_callee10,this)})))},i.rejectServerApply=function rejectServerApply(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee11(){return ms.wrap((function _callee11$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",min:1},accid:{type:"string",min:1},ps:{type:"string"},recordInfo:{type:"object",rules:{requestId:{type:"string",allowEmpty:!1}}}},t),i.next=3,this.core.sendCmd("qchatRejectServerApply",t);case 3:case"end":return i.stop()}}),_callee11,this)})))},i.kickServerMembers=function kickServerMembers(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee12(){return ms.wrap((function _callee12$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",min:1},accids:{type:"array",itemType:"string",min:1}},t),i.next=3,this.core.sendCmd("qchatKickServerMembers",t);case 3:case"end":return i.stop()}}),_callee12,this)})))},i.leaveServer=function leaveServer(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee13(){return ms.wrap((function _callee13$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",min:1}},t),i.next=3,this.core.sendCmd("qchatLeaveServer",t);case 3:case"end":return i.stop()}}),_callee13,this)})))},i.updateMyMemberInfo=function updateMyMemberInfo(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee14(){var i;return ms.wrap((function _callee14$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",min:1},accid:{type:"string",required:!1},nick:{type:"string",allowEmpty:!0,required:!1},avatar:{type:"string",required:!1},ext:{type:"string",required:!1}},t),u.next=3,this.core.sendCmd("qchatUpdateMyMemberInfo",{memberInfo:t,antispamTag:generateAntispamTag(t)});case 3:return i=u.sent,u.abrupt("return",formatMember$1(i.content.memberInfo));case 5:case"end":return u.stop()}}),_callee14,this)})))},i.updateServerMemberInfo=function updateServerMemberInfo(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee15(){var i;return ms.wrap((function _callee15$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",min:1},accid:{type:"string",min:1},nick:{type:"string",required:!1},avatar:{type:"string",required:!1}},t),u.next=3,this.core.sendCmd("qchatUpdateServerMemberInfo",{memberInfo:t,antispamTag:generateAntispamTag(t)});case 3:return i=u.sent,u.abrupt("return",formatMember$1(i.content.memberInfo));case 5:case"end":return u.stop()}}),_callee15,this)})))},i.getServerMembers=function getServerMembers(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee16(){var i,u,h,m,v;return ms.wrap((function _callee16$(E){for(;;)switch(E.prev=E.next){case 0:if(validate({accids:{type:"array"}},t),i=[],t.accids.length)for(u=_createForOfIteratorHelperLoose$3(t.accids);!(h=u()).done;)m=h.value,i.push(m.serverId+"|"+m.accid);return E.next=5,this.core.sendCmd("qchatGetServerMembers",{accids:i});case 5:return v=E.sent,E.abrupt("return",formatMembers$1(v.content.accidList));case 7:case"end":return E.stop()}}),_callee16,this)})))},i.getServerMembersByPage=function getServerMembersByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee17(){var i,u,h,m;return ms.wrap((function _callee17$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverId:{type:"string",min:1},timetag:{type:"number"},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetServerMembersByPage",{tag:t});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatMembers$1(h)});case 6:case"end":return v.stop()}}),_callee17,this)})))},i.subscribeServer=function subscribeServer(t){var i,u,h,m;return __awaiter(this,void 0,void 0,ms.mark((function _callee18(){var v,E,I,M;return ms.wrap((function _callee18$(S){for(;;)switch(S.prev=S.next){case 0:if(validate({type:{type:"number",min:4,max:4,required:!1},opeType:{type:"number",min:1,max:2}},t),!(null===(u=null===(i=this.core.qchatChannel)||void 0===i?void 0:i.config)||void 0===u?void 0:u.autoSubscribe)||t.isInternalTrigger){S.next=3;break}throw new Xl("subscribe server failed, manual subscribe is not allowed in auto subscribe mode",{},403);case 3:if(t.type||(t.type=4),!t.servers.length){S.next=12;break}return E=xt(xt({},t),{channels:map$6(v=t.servers).call(v,(function(t){return{serverId:t.serverId,channelId:""}}))}),S.next=8,this.core.qchatChannel.subscribeModuleService.subscribe(E);case 8:return I=S.sent,M=I.failedChannels,(null===(m=null===(h=this.core.qchatChannel)||void 0===h?void 0:h.config)||void 0===m?void 0:m.autoSubscribe)?this.core.qchatChannel.subscribeModuleService.cacheAutoSubscribe(E):this.core.qchatChannel.subscribeModuleService.cacheSubscribe(E),S.abrupt("return",{failedServers:M});case 12:case"end":return S.stop()}}),_callee18,this)})))},i.banServerMember=function banServerMember(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee19(){return ms.wrap((function _callee19$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),i.next=3,this.core.sendCmd("qchatUpdateServerMemberBan",{tag:xt(xt({},t),{opeType:1})});case 3:case"end":return i.stop()}}),_callee19,this)})))},i.unbanServerMember=function unbanServerMember(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee20(){return ms.wrap((function _callee20$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),i.next=3,this.core.sendCmd("qchatUpdateServerMemberBan",{tag:xt(xt({},t),{opeType:2})});case 3:case"end":return i.stop()}}),_callee20,this)})))},i.getBannedMembersByPage=function getBannedMembersByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee21(){var i,u,h,m;return ms.wrap((function _callee21$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},timetag:{type:"number",min:0},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetBannedMembersByPage",{tag:t});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatServerMemberBanInfos(h)});case 6:case"end":return v.stop()}}),_callee21,this)})))},i.serverSearchByPage=function serverSearchByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee22(){var i,u,h,m;return ms.wrap((function _callee22$(v){for(;;)switch(v.prev=v.next){case 0:if(validate({keyword:{type:"string",allowEmpty:!1},startTime:{type:"number",min:0,required:!1},endTime:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1},serverType:{type:"array",itemType:"number",min:0,required:!1},order:{type:"enum",values:getEnumKeys(pd),required:!1},searchType:{type:"enum",values:getEnumKeys(md)},sort:{type:"enum",values:getEnumKeys(hd),required:!1},cursor:{type:"string",allowEmpty:!1,required:!1}},t),!(t.startTime&&t.endTime&&t.startTime>=t.endTime)){v.next=3;break}throw new Ql("startTime more than endTime",t,"timeRule");case 3:return v.next=5,this.core.sendCmd("qchatServerSearchByPage",{tag:xt(xt({},t),{order:t.order&&pd[t.order],searchType:md[t.searchType],sort:sort(t)&&hd[sort(t)],serverType:Ms(t.serverType)})});case 5:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag),cursor:m.cursor},datas:formatServers(h)});case 8:case"end":return v.stop()}}),_callee22,this)})))},i.serverMemberSearchByPage=function serverMemberSearchByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee23(){var i;return ms.wrap((function _callee23$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},keyword:{type:"string",allowEmpty:!1},limit:{type:"number",min:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatServerMemberSearchByPage",{tag:t});case 3:return i=u.sent,u.abrupt("return",formatMembers$1(i.content.members));case 5:case"end":return u.stop()}}),_callee23,this)})))},i.generateInviteCode=function generateInviteCode(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee24(){var i;return ms.wrap((function _callee24$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},ttl:{type:"number",min:0,required:!1}},t),u.next=3,this.core.sendCmd("qchatGenerateInviteCode",{tag:t});case 3:return i=u.sent,u.abrupt("return",format({expireTime:{type:"number"}},i.content.data));case 5:case"end":return u.stop()}}),_callee24,this)})))},i.joinByInviteCode=function joinByInviteCode(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee25(){return ms.wrap((function _callee25$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},inviteCode:{type:"string",allowEmpty:!1},ps:{type:"string",required:!1}},t),i.next=3,this.core.sendCmd("qchatJoinByInviteCode",{tag:t});case 3:case"end":return i.stop()}}),_callee25,this)})))},i.getInviteApplyRecordOfServer=function getInviteApplyRecordOfServer(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee26(){var i;return ms.wrap((function _callee26$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},fromTime:{type:"number",min:0},toTime:{type:"number",min:0},reverse:{type:"boolean",required:!1},limit:{type:"number",min:1,required:!1},cursor:{type:"string",allowEmpty:!1,required:!1}},t),u.next=3,this.core.sendCmd("qchatGetInviteApplyRecordOfServer",{tag:xt(xt({},t),{reverse:reverse(t)?1:0})});case 3:return i=u.sent,u.abrupt("return",formatInviteApplyRecords(i.content.data));case 5:case"end":return u.stop()}}),_callee26,this)})))},i.getInviteApplyRecordOfSelf=function getInviteApplyRecordOfSelf(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee27(){var i;return ms.wrap((function _callee27$(u){for(;;)switch(u.prev=u.next){case 0:return validate({fromTime:{type:"number",min:0},toTime:{type:"number",min:0},reverse:{type:"boolean",required:!1},limit:{type:"number",min:1,required:!1},cursor:{type:"string",allowEmpty:!1,required:!1}},t),u.next=3,this.core.sendCmd("qchatGetInviteApplyRecordOfSelf",{tag:xt(xt({},t),{reverse:reverse(t)?1:0})});case 3:return i=u.sent,u.abrupt("return",formatInviteApplyRecords(i.content.data));case 5:case"end":return u.stop()}}),_callee27,this)})))},i.markRead=function markRead(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee28(){var i,u,h,m;return ms.wrap((function _callee28$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverIds:{type:"array",itemType:"string",required:!0}},t),v.next=3,this.core.sendCmd("qchatClearServersUnread",t);case 3:return i=v.sent,u=formatClearServersUnread(i.content.clearServersUnreadTag),h=u.successServerIds,m=u.ackTimestamp,this.logger.log("qchatServer::clearServersUnread:: begin auto clear servers unreadInfo"),this.core.eventBus.emit("qchatChannel/clearUnreadCountByServers",h,m),v.abrupt("return",u);case 9:case"end":return v.stop()}}),_callee28,this)})))},i.subscribeAllChannel=function subscribeAllChannel(t){var i,u;return __awaiter(this,void 0,void 0,ms.mark((function _callee29(){var h,m,v;return ms.wrap((function _callee29$(E){for(;;)switch(E.prev=E.next){case 0:if(validate({type:{type:"number",required:!0},serverIds:{type:"array",itemType:"string",required:!0,max:10}},t),!(null===(u=null===(i=this.core.qchatChannel)||void 0===i?void 0:i.config)||void 0===u?void 0:u.autoSubscribe)){E.next=3;break}throw new Xl("subscribe channel failed, manual subscribe is not allowed in auto subscribe mode.",{},403);case 3:return E.next=5,this.core.sendCmd("qchatSubscribeChannelsByServers",t,{timeout:3e4});case 5:return(m=E.sent).content.unreadInfos=formatUnreadInfos(m.content.unreadInfos),m.content.failServerIds=formatFailServerIds(m.content.failServerIds),v={type:t.type,opeType:1,channels:map$6(h=m.content.unreadInfos).call(h,(function(t){return{serverId:t.serverId,channelId:t.channelId}}))},this.core.eventBus.emit("qchatChannel/cacheSubscribe",v),this.core.eventBus.emit("qchatChannel/getRoleIdsByServerId",t.serverIds),this.core.eventBus.emit("qchatChannel/updateUnreads",m.content.unreadInfos),E.abrupt("return",m.content);case 13:case"end":return E.stop()}}),_callee29,this)})))},i.enterAsVisitor=function enterAsVisitor(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee30(){var i,u,h;return ms.wrap((function _callee30$(m){for(;;)switch(m.prev=m.next){case 0:return validate({serverIds:{type:"array",itemType:"string",min:1}},t),m.next=3,this.core.sendCmd("qchatEnterAsVisitor",{tag:{serverIds:Ms(t.serverIds)}});case 3:return i=m.sent,u=formatFailServerIds(i.content.failServerIds),h=difference(t.serverIds,u),this.core.qchatChannel.subscribeForVisitorService.cacheServer(h),m.abrupt("return",{failedServers:u});case 8:case"end":return m.stop()}}),_callee30,this)})))},i.leaveAsVisitor=function leaveAsVisitor(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee31(){var i,u,h,m=this;return ms.wrap((function _callee31$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverIds:{type:"array",itemType:"string",min:1}},t),v.next=3,this.core.sendCmd("qchatLeaveAsVisitor",{tag:{serverIds:Ms(t.serverIds)}});case 3:return i=v.sent,u=formatFailServerIds(i.content.failServerIds),h=difference(t.serverIds,u),forEach$1(h).call(h,(function(t){m.core.qchatChannel.subscribeForVisitorService.deleteServer(t)})),v.abrupt("return",{failedServers:u});case 8:case"end":return v.stop()}}),_callee31,this)})))},i.subscribeAsVisitor=function subscribeAsVisitor(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee32(){return ms.wrap((function _callee32$(i){for(;;)switch(i.prev=i.next){case 0:if(validate({opeType:{type:"number",min:1,max:2},type:{type:"number",required:!1},serverIds:{type:"array",itemType:"string",min:1}},t),!t.serverIds.length){i.next=5;break}return i.next=4,this.core.qchatChannel.subscribeForVisitorService.subscribeServerAsVisitor(t);case 4:return i.abrupt("return",i.sent);case 5:return i.abrupt("return",{failedServers:[]});case 6:case"end":return i.stop()}}),_callee32,this)})))},QChatServerService}(vd);!function(t){t[t.everyone=1]="everyone",t[t.custom=2]="custom"}(Wd||(Wd={})),function(t){t[t.normal=0]="normal",t[t.owner=1]="owner"}($d||($d={})),function(t){t[t.ignore=0]="ignore",t[t.deny=-1]="deny",t[t.allow=1]="allow"}(Hd||(Hd={})),function(t){t[t.manageServer=1]="manageServer",t[t.manageChannel=2]="manageChannel",t[t.manageRole=3]="manageRole",t[t.sendMsg=4]="sendMsg",t[t.accountInfoSelf=5]="accountInfoSelf",t[t.inviteServer=6]="inviteServer",t[t.kickServer=7]="kickServer",t[t.accountInfoOther=8]="accountInfoOther",t[t.recallMsg=9]="recallMsg",t[t.deleteMsg=10]="deleteMsg",t[t.remindOther=11]="remindOther",t[t.remindEveryone=12]="remindEveryone",t[t.manageBlackWhiteList=13]="manageBlackWhiteList",t[t.banServerMember=14]="banServerMember",t[t.RTCChannelConnect=15]="RTCChannelConnect",t[t.RTCChannelDisconnectOther=16]="RTCChannelDisconnectOther",t[t.RTCChannelOpenMicrophone=17]="RTCChannelOpenMicrophone",t[t.RTCChannelOpenCamera=18]="RTCChannelOpenCamera",t[t.RTCChannelOpenCloseOtherMicrophone=19]="RTCChannelOpenCloseOtherMicrophone",t[t.RTCChannelOpenCloseOtherCamera=20]="RTCChannelOpenCloseOtherCamera",t[t.RTCChannelOpenCloseEveryoneMicrophone=21]="RTCChannelOpenCloseEveryoneMicrophone",t[t.RTCChannelOpenCloseEveryoneCamera=22]="RTCChannelOpenCloseEveryoneCamera",t[t.RTCChannelOpenShareScreen=23]="RTCChannelOpenShareScreen",t[t.RTCChannelCloseOtherShareScreen=24]="RTCChannelCloseOtherShareScreen",t[t.manageInviteApply=25]="manageInviteApply",t[t.manageInviteApplyHistory=26]="manageInviteApplyHistory",t[t.mentionedRole=27]="mentionedRole"}(Qd||(Qd={}));var zd={type:{type:"enum",values:Wd},memberType:{type:"enum",values:$d},createTime:{type:"number"},updateTime:{type:"number"},priority:{type:"number"},memberCount:{type:"number"},joinTime:{type:"number"}},Jd={roleId:{type:"string"},categoryId:{type:"string"},serverId:{type:"string"},type:{type:"enum",values:Wd},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"},name:{type:"string"},icon:{type:"string"},ext:{type:"string"}},Xd={id:{type:"string"},accid:{type:"string"},categoryId:{type:"string"},serverId:{type:"string"},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"},nick:{type:"string"},avatar:{type:"string"},ext:{type:"string"},memberType:{type:"enum",values:$d},joinTime:{type:"number"},inviter:{type:"string"}};function generatorRoleForCmd(t){var i=xt({},t),u=formatReverse(zd,i);return u.auths&&(u.auths=function generateRoleAuthsForCmd(t){var i,u=reduce(i=es(t)).call(i,(function(i,u){var h=Qd[u];return h?i[h]=Hd[t[u]]:i[u]=Hd[t[u]],i}),{});return Ms(u)}(u.auths)),u}function formatRoleAuths(t){var i;return reduce(i=es(t)).call(i,(function(i,u){var h=getEnumKeyByEnumValue(Qd,u);h?i[h]=Hd[t[u]]:i[su(u)]=Hd[t[u]];return i}),{})}function formatRole(t){var i=format(zd,t);return t.auths&&(i.auths=formatRoleAuths(JSON.parse(i.auths))),i.isMember&&delete i.isMember,i}function formatRoles(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return formatRole(t)})):[]}function formatChannelCategoryRole(t){return t.auths&&(t.auths=formatRoleAuths(JSON.parse(t.auths))),format(Jd,t)}function formatChannelCategoryMemberRole(t){return t.auths&&(t.auths=formatRoleAuths(JSON.parse(t.auths))),format(Xd,t)}collection("Set",(function(t){return function Set(){return t(this,arguments.length?arguments[0]:void 0)}}),lc);var Zd=W.Set;_export({target:"Set",stat:!0,forced:!0},{from:pc}),_export({target:"Set",stat:!0,forced:!0},{of:hc});_export({target:"Set",proto:!0,real:!0,forced:!0},{addAll:function addAll(){for(var t=anObject(this),i=aCallable(t.add),u=0,h=arguments.length;u<h;u++)x(i,t,arguments[u]);return t}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:mc});var ep=getIterator;_export({target:"Set",proto:!0,real:!0,forced:!0},{every:function every(t){var i=anObject(this),u=ep(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return!iterate(u,(function(t,u){if(!h(t,t,i))return u()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{difference:function difference(t){var i=anObject(this),u=new(speciesConstructor(i,getBuiltIn("Set")))(i),h=aCallable(u.delete);return iterate(t,(function(t){x(h,u,t)})),u}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{filter:function filter(t){var i=anObject(this),u=ep(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0),m=new(speciesConstructor(i,getBuiltIn("Set"))),v=aCallable(m.add);return iterate(u,(function(t){h(t,t,i)&&x(v,m,t)}),{IS_ITERATOR:!0}),m}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{find:function find(t){var i=anObject(this),u=ep(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u){if(h(t,t,i))return u(t)}),{IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function intersection(t){var i=anObject(this),u=new(speciesConstructor(i,getBuiltIn("Set"))),h=aCallable(i.has),m=aCallable(u.add);return iterate(t,(function(t){x(h,i,t)&&x(m,u,t)})),u}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function isDisjointFrom(t){var i=anObject(this),u=aCallable(i.has);return!iterate(t,(function(t,h){if(!0===x(u,i,t))return h()}),{INTERRUPTED:!0}).stopped}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function isSubsetOf(t){var i=getIterator(this),u=anObject(t),h=u.has;return isCallable(h)||(u=new(getBuiltIn("Set"))(t),h=aCallable(u.has)),!iterate(i,(function(t,i){if(!1===x(h,u,t))return i()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function isSupersetOf(t){var i=anObject(this),u=aCallable(i.has);return!iterate(t,(function(t,h){if(!1===x(u,i,t))return h()}),{INTERRUPTED:!0}).stopped}});var tp=N([].join),rp=[].push;_export({target:"Set",proto:!0,real:!0,forced:!0},{join:function join(t){var i=anObject(this),u=ep(i),h=void 0===t?",":toString(t),m=[];return iterate(u,rp,{that:m,IS_ITERATOR:!0}),tp(m,h)}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{map:function map(t){var i=anObject(this),u=ep(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0),m=new(speciesConstructor(i,getBuiltIn("Set"))),v=aCallable(m.add);return iterate(u,(function(t){x(v,m,h(t,t,i))}),{IS_ITERATOR:!0}),m}});var np=TypeError;_export({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function reduce(t){var i=anObject(this),u=ep(i),h=arguments.length<2,m=h?void 0:arguments[1];if(aCallable(t),iterate(u,(function(u){h?(h=!1,m=u):m=t(m,u,u,i)}),{IS_ITERATOR:!0}),h)throw np("Reduce of empty set with no initial value");return m}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{some:function some(t){var i=anObject(this),u=ep(i),h=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u){if(h(t,t,i))return u()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function symmetricDifference(t){var i=anObject(this),u=new(speciesConstructor(i,getBuiltIn("Set")))(i),h=aCallable(u.delete),m=aCallable(u.add);return iterate(t,(function(t){x(h,u,t)||x(m,u,t)})),u}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{union:function union(t){var i=anObject(this),u=new(speciesConstructor(i,getBuiltIn("Set")))(i);return iterate(t,aCallable(u.add),{that:u}),u}});var ap,op,ip,sp,cp,lp,up,dp,pp=Zd;function isObject(t){var i=typeof t;return null!=t&&("object"==i||"function"==i)}!function(t){t[t.default=1]="default",t[t.sync=2]="sync"}(ap||(ap={})),function(t){t[t.sendTime=1]="sendTime"}(op||(op={})),function(t){t[t.text=0]="text",t[t.image=1]="image",t[t.audio=2]="audio",t[t.video=3]="video",t[t.geo=4]="geo",t[t.notification=5]="notification",t[t.file=6]="file",t[t.tip=10]="tip",t[t.robot=11]="robot",t[t.g2=12]="g2",t[t.custom=100]="custom"}(ip||(ip={})),function(t){t[t.sending=1]="sending",t[t.success=2]="success",t[t.failed=3]="failed"}(sp||(sp={})),function(t){t[t.notifyAll=1]="notifyAll",t[t.notifySubscribe=2]="notifySubscribe"}(cp||(cp={})),function(t){t[t.unknown=0]="unknown",t[t.server=1]="server",t[t.channel=2]="channel",t[t.serverAccids=3]="serverAccids",t[t.channelAccids=4]="channelAccids",t[t.accids=5]="accids"}(lp||(lp={})),function(t){t[t.serverMemberInvite=1]="serverMemberInvite",t[t.serverMemberInviteReject=2]="serverMemberInviteReject",t[t.serverMemberApply=3]="serverMemberApply",t[t.serverMemberApplyReject=4]="serverMemberApplyReject",t[t.serverCreate=5]="serverCreate",t[t.serverRemove=6]="serverRemove",t[t.serverUpdate=7]="serverUpdate",t[t.serverMemberInviteDone=8]="serverMemberInviteDone",t[t.serverMemberInviteAccept=9]="serverMemberInviteAccept",t[t.serverMemberApplyDone=10]="serverMemberApplyDone",t[t.serverMemberApplyAccept=11]="serverMemberApplyAccept",t[t.serverMemberKick=12]="serverMemberKick",t[t.serverMemberLeave=13]="serverMemberLeave",t[t.serverMemberUpdate=14]="serverMemberUpdate",t[t.channelCreate=15]="channelCreate",t[t.channelRemove=16]="channelRemove",t[t.channelUpdate=17]="channelUpdate",t[t.channelUpdateWhiteBlackIdentify=18]="channelUpdateWhiteBlackIdentify",t[t.channelUpdateWhiteBlackIdentifyUser=19]="channelUpdateWhiteBlackIdentifyUser",t[t.updateQuickComment=20]="updateQuickComment",t[t.channelCategoryCreate=21]="channelCategoryCreate",t[t.channelCategoryRemove=22]="channelCategoryRemove",t[t.channelCategoryUpdate=23]="channelCategoryUpdate",t[t.channelCategoryUpdateWhiteBlackIdentify=24]="channelCategoryUpdateWhiteBlackIdentify",t[t.channelCategoryUpdateWhiteBlackIdentifyUser=25]="channelCategoryUpdateWhiteBlackIdentifyUser",t[t.serverIdentifyAdd=26]="serverIdentifyAdd",t[t.serverIdentifyRemove=27]="serverIdentifyRemove",t[t.serverIdentifyUpdate=28]="serverIdentifyUpdate",t[t.channelIdentifyUpdate=29]="channelIdentifyUpdate",t[t.userIdentifyUpdate=30]="userIdentifyUpdate",t[t.channelVisibilityUpdate=31]="channelVisibilityUpdate",t[t.serverEnterLeave=32]="serverEnterLeave",t[t.serverMemberJoinByInviteCode=33]="serverMemberJoinByInviteCode",t[t.channelVisibilityToVisitorUpdate=34]="channelVisibilityToVisitorUpdate",t[t.myMemberInfoUpdated=35]="myMemberInfoUpdated",t[t.custom=100]="custom",t[t.msgTyping=101]="msgTyping"}(up||(up={})),function(t){t[t.reply=1]="reply",t[t.thread=2]="thread",t[t.all=3]="all"}(dp||(dp={}));var hp=Math.max,mp=Math.min;function debounce(t,i,u){var h,m,v,E,I,M,S=0,T=!1,C=!1,R=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function invokeFunc(i){var u=h,v=m;return h=m=void 0,S=i,E=t.apply(v,u)}function leadingEdge(t){return S=t,I=vo(timerExpired,i),T?invokeFunc(t):E}function shouldInvoke(t){var u=t-M;return void 0===M||u>=i||u<0||C&&t-S>=v}function timerExpired(){var t=eo();if(shouldInvoke(t))return trailingEdge(t);I=vo(timerExpired,function remainingWait(t){var u=i-(t-M);return C?mp(u,v-(t-S)):u}(t))}function trailingEdge(t){return I=void 0,R&&h?invokeFunc(t):(h=m=void 0,E)}function debounced(){var t=eo(),u=shouldInvoke(t);if(h=arguments,m=this,M=t,u){if(void 0===I)return leadingEdge(M);if(C)return clearTimeout(I),I=vo(timerExpired,i),invokeFunc(M)}return void 0===I&&(I=vo(timerExpired,i)),E}return i=Number(i)||0,isObject(u)&&(T=!!u.leading,v=(C="maxWait"in u)?hp(Number(u.maxWait)||0,i):v,R="trailing"in u?!!u.trailing:R),debounced.cancel=function cancel(){void 0!==I&&clearTimeout(I),S=0,h=M=m=I=void 0},debounced.flush=function flush(){return void 0===I?E:trailingEdge(eo())},debounced}var fp;function throttle(t,i,u){var h=!0,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return isObject(u)&&(h="leading"in u?!!u.leading:h,m="trailing"in u?!!u.trailing:m),debounce(t,i,{leading:h,maxWait:i,trailing:m})}function chunk(t,i){t=t||[],i=i||1,i=Math.max(Math.floor(i),1);for(var u=[],h=0;h<t.length;h+=i)u.push(slice(t).call(t,h,h+i));return u}!function(t){t[t.sub=1]="sub",t[t.unSub=2]="unSub"}(fp||(fp={}));var gp=function(){function UnreadInfoModuleService(t){var i=this;this.unreadCount={},this.manualSubscribeUnreadMap={},this.manualSubscribeServerMap={},this.manualSubscribeTypingMap={},this.unreadServerCount={},this.serverRoleIdsMap={},this.autoSubscribeUnreadMap={},this.autoSubscribeServerMap={},this._serverUnreadInfo=throttle((function(t){i.core.emit("serverUnreadInfo",i.getServerUnreadInfo(t)),get(i.core,"qchatServer.emit")&&i.core.qchatServer.emit("serverUnreadInfo",i.getServerUnreadInfo(t))}),100),this.core=t}var t=UnreadInfoModuleService.prototype;return t.changeCacheServerRoleIds=function changeCacheServerRoleIds(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i,u,h,m,v,E,I,M=this;return ms.wrap((function _callee$(S){for(;;)switch(S.prev=S.next){case 0:if(u=t.attach.serverIdentifyInfo,h=u.serverId,m=u.roleId,this.serverRoleIdsMap[h]){S.next=4;break}return S.next=4,this.getRoleIdsByServerId([h]);case 4:if(v=this.serverRoleIdsMap[h],!(t.time<v.timeTag)){S.next=7;break}return S.abrupt("return");case 7:if(t.type===up[up.serverIdentifyAdd]?v.roleIds.add(m):v.roleIds.delete(m),this.core.logger.debug("QChatChannel::qchatChannel/serverIdentifyChange::now "+h+" roleIds is",concat(i=[]).call(i,v.roleIds)),E=this.unreadServerCount[h]){S.next=12;break}return S.abrupt("return");case 12:I=chunk(es(E),100),forEach$1(I).call(I,(function(t){M.core.qchatChannel.getChannelUnreadInfos({channels:map$6(t).call(t,(function(t){return{serverId:h,channelId:t}}))})}));case 14:case"end":return S.stop()}}),_callee,this)})))},t.getRoleIdsByServerId=function getRoleIdsByServerId(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var i,u,h,m,v=this;return ms.wrap((function _callee2$(E){for(;;)switch(E.prev=E.next){case 0:if((u=filter(t).call(t,(function(t){return!v.serverRoleIdsMap[t]}))).length){E.next=3;break}return E.abrupt("return");case 3:return h={serverIdTimeTags:u},E.next=6,this.core.sendCmd("qchatGetRoleIdsByServerId",{qchatGetRoleIdsByServerIdTag:h});case 6:m=E.sent,this.core.logger.debug("QChatChannel:: getRoleIdsByServerId, params is ",h,"result is",m),forEach$1(i=m.content.serverRoles).call(i,(function(t){try{t.roleIds=JSON.parse(t.roleIds)}catch(t){v.core.logger.error("QChatChannel:: getRoleIdsByServerId JSON parse roleIds error",t)}v.serverRoleIdsMap[t.serverId]={roleIds:new pp(t.roleIds),timeTag:t.timeTag}}));case 9:case"end":return E.stop()}}),_callee2,this)})))},t._unSubscribeChannel=function _unSubscribeChannel(t,i){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var u,h,m,v,E;return ms.wrap((function _callee3$(I){for(;;)switch(I.prev=I.next){case 0:if(u=t+"_"+i,h=[],this.manualSubscribeUnreadMap[u]?h.push(this.manualSubscribeUnreadMap[u]):this.autoSubscribeUnreadMap[u]&&h.push(this.autoSubscribeUnreadMap[u]),this.manualSubscribeTypingMap[u]&&h.push(this.manualSubscribeTypingMap[u]),0!==h.length){I.next=6;break}return I.abrupt("return");case 6:for(m=0,v=h;m<v.length;m++)E=v[m],this.subscribe({opeType:fp.unSub,type:E,channels:[{serverId:t,channelId:i}]});this.manualSubscribeUnreadMap[u]?this.manualSubscribeUnreadMap[u]=void 0:this.autoSubscribeUnreadMap[u]&&(this.autoSubscribeUnreadMap[u]=void 0),this.manualSubscribeTypingMap[u]&&(this.manualSubscribeTypingMap[u]=void 0);case 9:case"end":return I.stop()}}),_callee3,this)})))},t._unSubscribeServer=function _unSubscribeServer(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var i,u;return ms.wrap((function _callee4$(h){for(;;)switch(h.prev=h.next){case 0:if(i=t,u=this.manualSubscribeServerMap[i]||this.autoSubscribeServerMap[i]){h.next=4;break}return h.abrupt("return");case 4:this.subscribe({opeType:fp.unSub,type:u,channels:[{serverId:t,channelId:""}]}),this.manualSubscribeServerMap[i]?this.manualSubscribeServerMap[i]=void 0:this.autoSubscribeServerMap[i]&&(this.autoSubscribeServerMap[i]=void 0);case 6:case"end":return h.stop()}}),_callee4,this)})))},t.subscribe=function subscribe(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee6(){var i,u,h,m,v=this;return ms.wrap((function _callee6$(E){for(;;)switch(E.prev=E.next){case 0:return validate({type:{type:"number",min:1,max:5},opeType:{type:"number",min:1,max:2}},t),E.next=3,this.core.sendCmd("qchatSubscribe",{qchatSubReqTag:{type:t.type,opeType:t.opeType},channels:t.channels});case 3:return u=E.sent,h=new pp,forEach$1(i=t.channels).call(i,(function(t){return __awaiter(v,void 0,void 0,ms.mark((function _callee5(){return ms.wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:this.serverRoleIdsMap[t.serverId]||h.add(t.serverId);case 1:case"end":return i.stop()}}),_callee5,this)})))})),m=chunk(bu(h),10),forEach$1(m).call(m,(function(t){v.getRoleIdsByServerId(t)})),E.abrupt("return",u.content);case 9:case"end":return E.stop()}}),_callee6,this)})))},t.autoSubscribe=function autoSubscribe(){return __awaiter(this,void 0,void 0,ms.mark((function _callee7(){return ms.wrap((function _callee7$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.sendCmd("qchatAutoSubscribe",{qchatAutoSubReqTag:{}});case 2:case"end":return t.stop()}}),_callee7,this)})))},t.resumeSubscribe=function resumeSubscribe(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee10(){var i,u,h,m,v,E,I,M=this;return ms.wrap((function _callee10$(S){for(;;)switch(S.prev=S.next){case 0:if(this.serverRoleIdsMap={},v=100,t){S.next=6;break}return this.unreadServerCount={},this.unreadCount={},S.abrupt("return");case 6:return E={},forEach$1(i=es(this.manualSubscribeUnreadMap)).call(i,(function(t){var i=M.manualSubscribeUnreadMap[t];if(i){var u=t.split("_"),h={serverId:u[0],channelId:u[1]};E[i]=E[i]||[],E[i].push(h)}})),E[5]=[],forEach$1(u=es(this.manualSubscribeTypingMap)).call(u,(function(t){return __awaiter(M,void 0,void 0,ms.mark((function _callee8(){var i,u,h,m;return ms.wrap((function _callee8$(v){for(;;)switch(v.prev=v.next){case 0:this.manualSubscribeTypingMap[t]&&(i=t.split("_"),u=i[0],h=i[1],m={serverId:u,channelId:h},E[5].push(m));case 2:case"end":return v.stop()}}),_callee8,this)})))})),E[4]=[],forEach$1(h=es(this.manualSubscribeServerMap)).call(h,(function(t){return __awaiter(M,void 0,void 0,ms.mark((function _callee9(){var i;return ms.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:this.manualSubscribeServerMap[t]&&(i={serverId:t},E[4].push(i));case 2:case"end":return u.stop()}}),_callee9,this)})))})),I=[],forEach$1(m=es(E)).call(m,(function(t){var i=E[t];if(i&&0===i.length)return Ja.resolve();if(i.length>v){var u=chunk(i,100);return forEach$1(u).call(u,(function(i){I.push(M.createSubscribePromise(i,t))}))}I.push(M.createSubscribePromise(i,t))})),S.next=16,Ja.all(I);case 16:case"end":return S.stop()}}),_callee10,this)})))},t.createSubscribePromise=function createSubscribePromise(t,i){var u=this,h={type:su(i),opeType:1,channels:t};return this.core.logger.debug("qchatChannel:: autoSubscribeUnread params",h),this.subscribe(h).then((function(t){var i=t.unreadInfos;i&&i.length>0&&(i=formatUnreadInfos(i),u.updateUnreads(i))})).catch((function(t){u.core.logger.error("qchatChannel:: autoSubscribeUnread error ",t)}))},t.cacheSubscribe=function cacheSubscribe(t){var i,u=this;forEach$1(i=t.channels).call(i,(function(i){var h=i.channelId?i.serverId+"_"+i.channelId:""+i.serverId,m=5===t.type?u.manualSubscribeTypingMap:4===t.type?u.manualSubscribeServerMap:u.manualSubscribeUnreadMap;t.opeType===fp.sub?m[h]=t.type:t.opeType===fp.unSub&&(m[h]=void 0)}))},t.cacheAutoSubscribe=function cacheAutoSubscribe(t){var i,u=this;forEach$1(i=t.channels).call(i,(function(i){var h=i.channelId?i.serverId+"_"+i.channelId:""+i.serverId,m=4===t.type?u.autoSubscribeServerMap:u.autoSubscribeUnreadMap;t.opeType===fp.sub?m[h]=t.type:t.opeType===fp.unSub&&(m[h]=void 0)}))},t.cacheUnreadCount=function cacheUnreadCount(t){var i=this;forEach$1(t).call(t,(function(t){var u=t.serverId+"_"+t.channelId;i.unreadCount[u]=xt({},t),i.unreadServerCount[t.serverId]||(i.unreadServerCount[t.serverId]={}),i.unreadServerCount[t.serverId][t.channelId]=!0}))},t.getServerUnreadInfo=function getServerUnreadInfo(t){var i,u=this,h={serverId:t,unreadCount:0,mentionedCount:0,maxCount:0},m=this.unreadServerCount[t];m&&(forEach$1(i=es(m)).call(i,(function(i){var m=t+"_"+i,v=u.unreadCount[m];h.unreadCount+=v.unreadCount,h.mentionedCount+=v.mentionedCount,void 0!==v.maxCount&&(h.maxCount=v.maxCount)})),h.unreadCount=h.unreadCount>h.maxCount?h.maxCount:h.unreadCount,h.mentionedCount=h.mentionedCount>h.maxCount?h.maxCount:h.mentionedCount);return h},t.getUnreadInfo=function getUnreadInfo(t){validate({serverId:{type:"string"},channelId:{type:"string"}},t);var i=t.serverId+"_"+t.channelId;return this.unreadCount[i]?this.unreadCount[i]:null},t.shouldChangeUnread=function shouldChangeUnread(t,i){if(!t.serverId||!t.channelId)return!1;if(this.core.qchatChannel.subscribeForVisitorService.isInSubscribeChannels(t.serverId,t.channelId))return!1;if(!1===t.historyEnable)return!1;if(!1===t.needBadge)return!1;if(t.fromAccount===this.core.account)return!1;if(i&&2!==(null==t?void 0:t.status))return!1;if(t.notifyReason&&t.notifyReason===getEnumKeyByEnumValue(cp,cp.notifySubscribe)){if(!t.serverId||!t.channelId)return!1;var u=this.getUnreadInfo({serverId:t.serverId,channelId:t.channelId}),h=i?"ackTimestamp":"lastMsgTime";if(!u)return!1;if(t.time&&u[h]&&u[h]>t.time)return!1}return!0},t.shouldChangeMentionedUnread=function shouldChangeMentionedUnread(t,i){return void 0===i&&(i=!1),__awaiter(this,void 0,void 0,ms.mark((function _callee11(){var u,h;return ms.wrap((function _callee11$(m){for(;;)switch(m.prev=m.next){case 0:if(!t.accidsOfMentionedRoles||!includes(u=t.accidsOfMentionedRoles).call(u,this.core.account)){m.next=2;break}return m.abrupt("return",!0);case 2:if(!t.mentionRoleIds||!t.serverId){m.next=16;break}if(this.serverRoleIdsMap[t.serverId]){m.next=9;break}if(i){m.next=7;break}return this.handledRoleMsg(t),m.abrupt("return",!1);case 7:return m.next=9,this.getRoleIdsByServerId([t.serverId]);case 9:h=0;case 10:if(!(h<t.mentionRoleIds.length)){m.next=16;break}if(!this.serverRoleIdsMap[t.serverId].roleIds.has(t.mentionRoleIds[h])){m.next=13;break}return m.abrupt("return",!0);case 13:h++,m.next=10;break;case 16:return m.abrupt("return",!1);case 17:case"end":return m.stop()}}),_callee11,this)})))},t.handledRoleMsg=function handledRoleMsg(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee12(){var i,u,h,m,v,E=this;return ms.wrap((function _callee12$(I){for(;;)switch(I.prev=I.next){case 0:if(t.mentionRoleIds){I.next=2;break}return I.abrupt("return");case 2:if(this.serverRoleIdsMap[t.serverId]){I.next=5;break}return I.next=5,this.getRoleIdsByServerId([t.serverId]);case 5:if(this.serverRoleIdsMap[t.serverId]){I.next=8;break}return this.core.logger.warn("QChatChannel::handledRoleMsg::can not get serverRoleIds,server id",t.serverId),I.abrupt("return");case 8:if(u=!1,forEach$1(i=t.mentionRoleIds).call(i,(function(i){E.serverRoleIdsMap[t.serverId].roleIds.has(i)&&(u=!0,E.core.logger.debug("QChatChannel::handledRoleMsg::will update message mentionedCount,message is ",t))})),u){I.next=12;break}return I.abrupt("return");case 12:if(h=this.unreadCount[t.serverId+"_"+t.channelId],m=2===(null==t?void 0:t.status),h.mentionedCount=m?h.mentionedCount?h.mentionedCount-1:0:h.mentionedCount?h.mentionedCount+1:1,"number"!=typeof h.maxCount){I.next=25;break}if(!((v=(v=h.mentionedCount)>h.maxCount?h.maxCount:v)>h.maxCount)){I.next=21;break}return this.core.logger.debug("QChatChannel::handledRoleMsg::tempUnreadCount more than maxCount"),I.abrupt("return");case 21:this.core.emit("unreadInfo",xt(xt({},h),{mentionedCount:v})),this.core.emit("unreadInfos",[xt(xt({},h),{mentionedCount:v})]),this.core.qchatChannel.emit("unreadInfos",[xt(xt({},h),{mentionedCount:v})]),this._serverUnreadInfo(t.serverId);case 25:case"end":return I.stop()}}),_callee12,this)})))},t.getMentionedFlag=function getMentionedFlag(t,i){return void 0===i&&(i=!1),__awaiter(this,void 0,void 0,ms.mark((function _callee13(){var u;return ms.wrap((function _callee13$(h){for(;;)switch(h.prev=h.next){case 0:if(!t.mentionAll){h.next=4;break}return h.abrupt("return",!0);case 4:if(!t.mentionRoleIds&&!t.accidsOfMentionedRoles){h.next=10;break}return h.next=7,this.shouldChangeMentionedUnread(t,i);case 7:return h.abrupt("return",h.sent);case 10:if(!t.mentionAccids||!includes(u=t.mentionAccids).call(u,this.core.account)){h.next=12;break}return h.abrupt("return",!0);case 12:return h.abrupt("return",!1);case 13:case"end":return h.stop()}}),_callee13,this)})))},t.changeUnread=function changeUnread(t,i){return __awaiter(this,void 0,void 0,ms.mark((function _callee14(){var u,h,m,v,E,I,M;return ms.wrap((function _callee14$(S){for(;;)switch(S.prev=S.next){case 0:if(u=t.serverId,h=t.channelId,m=u+"_"+h,this.shouldChangeUnread(t,i)){S.next=6;break}return this.core.logger.debug("changeUnread: "+m+" does not need to update unreadInfo"),S.abrupt("return");case 6:if(this.unreadCount[m]){S.next=11;break}return S.next=9,this.core.qchatChannel.getChannelUnreadInfos({channels:[{serverId:u,channelId:h}]});case 9:return!this.serverRoleIdsMap[u]&&t.mentionRoleIds&&this.getRoleIdsByServerId([u]),S.abrupt("return");case 11:return v=this.unreadCount[m],E=2===(null==t?void 0:t.status),S.next=15,this.getMentionedFlag(t);case 15:if(I=S.sent,E?(v.unreadCount=v.unreadCount?v.unreadCount-1:0,I&&(v.mentionedCount=v.mentionedCount?v.mentionedCount-1:0),delete v.lastMsgTime,this.core.logger.debug("changeUnread: "+m+" unread reduce ",v)):(v.unreadCount=v.unreadCount?v.unreadCount+1:1,I&&(v.mentionedCount=v.mentionedCount?v.mentionedCount+1:1),t.time&&(v.lastMsgTime=t.time),this.core.logger.debug("changeUnread: "+m+" unread add ",v)),M="number"==typeof v.maxCount?v.maxCount:100,!(v.unreadCount>M)){S.next=21;break}return this.core.logger.debug("QChatChannel::subscribe::tempUnreadCount more than maxCount"),S.abrupt("return");case 21:this.core.logger.warn("unreadInfo event will abandon,please use unreadInfos"),this.core.emit("unreadInfo",xt(xt({},v),{mentionedCount:v.mentionedCount>M?M:v.mentionedCount,unreadCount:v.unreadCount>M?M:v.unreadCount})),this.core.emit("unreadInfos",[xt(xt({},v),{mentionedCount:v.mentionedCount>M?M:v.mentionedCount,unreadCount:v.unreadCount>M?M:v.unreadCount})]),this.core.qchatChannel.emit("unreadInfos",[xt(xt({},v),{mentionedCount:v.mentionedCount>M?M:v.mentionedCount,unreadCount:v.unreadCount>M?M:v.unreadCount})]),this._serverUnreadInfo(u);case 26:case"end":return S.stop()}}),_callee14,this)})))},t.updateUnreads=function updateUnreads(t){var i,u,h=this;if(t&&t.length>0){var m=[],v=[],E=map$6(i=filter(t).call(t,(function(t){var i=t.serverId+"_"+t.channelId,u=h.unreadCount[i],m=get(u,"ackTimestamp"),v=get(t,"ackTimestamp");return!(m&&v&&v<m)&&(get(u,"unreadCount")!==get(t,"unreadCount")||get(u,"mentionedCount")!==get(t,"mentionedCount"))}))).call(i,(function(t){m.push(h.getServerUnreadInfo(t.serverId)),v.push(h.unreadServerCount[t.serverId]);var i=t.serverId,u=t.channelId,E=i+"_"+u;return h.core.logger.debug("qchat channel updateUnread: ",t),h.unreadCount[E]=xt({},t),h.unreadServerCount[i]||(h.unreadServerCount[i]={}),h.unreadServerCount[i][u]=!0,t}));if(0!==E.length){this.core.emit("unreadInfos",E),this.core.qchatChannel.emit("unreadInfos",E);var I={};forEach$1(E).call(E,(function(t,i){h.core.emit("unreadInfo",t);var u=m[i],E=v[i],M=h.getServerUnreadInfo(t.serverId),S=h.unreadServerCount[t.serverId],T=u.unreadCount!==M.unreadCount,C=!E||0===es(E).length,R=S&&es(S).length>0,A=u.mentionedCount!==M.mentionedCount;(T||A||C&&R)&&(I[t.serverId]=!0)})),forEach$1(u=es(I)).call(u,(function(t){h.core.emit("serverUnreadInfo",h.getServerUnreadInfo(t)),get(h.core,"qchatServer.emit")&&h.core.qchatServer.emit("serverUnreadInfo",h.getServerUnreadInfo(t))}))}}},t.clearUnreadCountByServers=function clearUnreadCountByServers(t,i){var u=this,h=[];forEach$1(t).call(t,(function(t){var i;u.unreadServerCount[t]&&forEach$1(i=es(u.unreadServerCount[t])).call(i,(function(i){h.push(t+"_"+i)}))}));var m=[];forEach$1(h).call(h,(function(t){m.push(xt(xt({},u.unreadCount[t]),{unreadCount:0,mentionedCount:0,ackTimestamp:i}))})),this.updateUnreads(m)},UnreadInfoModuleService}(),vp=function(){function SubscribeForVisitorService(t){this.limitForBatchEnter=10,this.limitForBatchSubscribe=100,this.autoServers=new pp,this.autoVisitorSubscribeServer=new pp,this.autoVisitorSubscribeChannel=new pp,this.core=t}var t=SubscribeForVisitorService.prototype;return t.subscribeChannelAsVisitor=function subscribeChannelAsVisitor(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i,u,h,m,v=this;return ms.wrap((function _callee$(E){for(;;)switch(E.prev=E.next){case 0:return E.next=2,this.core.sendCmd("qchatSubscribeAsVisitor",{tag:{type:t.type||6,opeType:t.opeType},datas:t.channels});case 2:return u=E.sent,h=u.content.failedArr,m=filter(i=t.channels).call(i,(function(t){return!some(h).call(h,(function(i){return i.channelId===t.channelId&&i.serverId===t.serverId}))})),forEach$1(m).call(m,(function(i){1===t.opeType?v.autoVisitorSubscribeChannel.add(i.serverId+"&"+i.channelId):v.autoVisitorSubscribeChannel.delete(i.serverId+"&"+i.channelId)})),E.abrupt("return",{failedChannels:h});case 7:case"end":return E.stop()}}),_callee,this)})))},t.subscribeServerAsVisitor=function subscribeServerAsVisitor(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var i,u,h,m,v,E,I=this;return ms.wrap((function _callee2$(M){for(;;)switch(M.prev=M.next){case 0:return M.next=2,this.core.sendCmd("qchatSubscribeAsVisitor",{tag:{type:t.type||7,opeType:t.opeType},datas:map$6(i=t.serverIds).call(i,(function(t){return{serverId:t}}))});case 2:return m=M.sent,v=m.content.failedArr,E=filter(u=t.serverIds).call(u,(function(t){return!some(v).call(v,(function(i){return i.serverId===t}))})),forEach$1(E).call(E,(function(i){1===t.opeType?I.autoVisitorSubscribeServer.add(i):I.autoVisitorSubscribeServer.delete(i)})),M.abrupt("return",{failedServers:map$6(h=m.content.failedArr).call(h,(function(t){return t.serverId}))});case 7:case"end":return M.stop()}}),_callee2,this)})))},t.deleteServer=function deleteServer(t){var i;this.autoServers.delete(t),this.autoVisitorSubscribeServer.has(t)&&this.subscribeServerAsVisitor({opeType:2,serverIds:[t]});var u=[];forEach$1(i=this.autoVisitorSubscribeChannel).call(i,(function(i){if(0===indexOf(i).call(i,t)){var h=i.replace(t+"&","");u.push({serverId:t,channelId:h})}})),u.length>0&&this.subscribeChannelAsVisitor({opeType:2,channels:u})},t.deleteAutoSetInServerId=function deleteAutoSetInServerId(t){var i,u=this;this.autoServers.delete(t),this.autoVisitorSubscribeServer.delete(t),forEach$1(i=this.autoVisitorSubscribeChannel).call(i,(function(i){0===indexOf(i).call(i,t)&&u.autoVisitorSubscribeChannel.delete(i)}))},t.deleteAutoSetInChannel=function deleteAutoSetInChannel(t,i){this.autoVisitorSubscribeChannel.delete(t+"&"+i)},t.unSubscribeChannel=function unSubscribeChannel(t,i){this.subscribeChannelAsVisitor({opeType:2,channels:[{serverId:t,channelId:i}]})},t.isInSubscribeChannels=function isInSubscribeChannels(t,i){return this.autoVisitorSubscribeChannel.has(t+"&"+i)},t.isInAutoServers=function isInAutoServers(t){return this.autoServers.has(t)},t.doAutoSubscribe=function doAutoSubscribe(){var t=this,i=[],u=chunk(bu(this.autoVisitorSubscribeServer),this.limitForBatchSubscribe);forEach$1(u).call(u,(function(u){i.push(t.subscribeServerAsVisitor({opeType:1,serverIds:u}))}));var h=chunk(bu(this.autoVisitorSubscribeChannel),this.limitForBatchSubscribe);return forEach$1(h).call(h,(function(u){i.push(t.subscribeChannelAsVisitor({opeType:1,channels:map$6(u).call(u,(function(t){var i=indexOf(t).call(t,"&");return{serverId:slice(t).call(t,0,i),channelId:slice(t).call(t,i+1)}}))}))})),Ja.all(i)},t.doAutoEnterServer=function doAutoEnterServer(){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var t,i,u,h=this;return ms.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:return t=chunk(bu(this.autoServers),this.limitForBatchEnter),i=[],forEach$1(t).call(t,(function(t){i.push(h.core.qchatServer.enterAsVisitor({serverIds:t}))})),m.next=5,Ja.all(i);case 5:u=m.sent,forEach$1(u).call(u,(function(t){var i;forEach$1(i=t.failedServers).call(i,(function(t){h.deleteAutoSetInServerId(t)}))}));case 7:case"end":return m.stop()}}),_callee3,this)})))},t.resumeSubscribe=function resumeSubscribe(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){return ms.wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:if(!t){i.next=7;break}return i.next=3,this.doAutoEnterServer();case 3:return i.next=5,this.doAutoSubscribe();case 5:i.next=10;break;case 7:this.autoServers.clear(),this.autoVisitorSubscribeChannel.clear(),this.autoVisitorSubscribeServer.clear();case 10:case"end":return i.stop()}}),_callee4,this)})))},t.cacheServer=function cacheServer(t){var i=this;forEach$1(t).call(t,(function(t){return i.autoServers.add(t)}))},SubscribeForVisitorService}();function _createForOfIteratorHelperLoose$2(t,i){var u,h=void 0!==gi&&Ru(t)||t["@@iterator"];if(h)return bind$1(u=(h=h.call(t)).next).call(u,h);if(Qs(t)||(h=function _unsupportedIterableToArray$2(t,i){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$2(t,i);var h=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===h&&t.constructor&&(h=t.constructor.name),"Map"===h||"Set"===h?bu(t):"Arguments"===h||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?_arrayLikeToArray$2(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){h&&(t=h);var m=0;return function(){return m>=t.length?{done:!0}:{done:!1,value:t[m++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayLikeToArray$2(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,h=Array(i);u<i;u++)h[u]=t[u];return h}var _p,yp,Ep=function(t){function QChatChannelService(i,u){var h;return(h=t.call(this,"qchatChannel",i)||this).config={autoSubscribe:!1},h.core=i,registerParser({cmdMap:_d,cmdConfig:Md()}),u&&h.setOptions(u),h.subscribeModuleService=new gp(i),h.subscribeForVisitorService=new vp(i),h.setListener(),h}bt(QChatChannelService,t);var i=QChatChannelService.prototype;return i.setOptions=function setOptions(t){t&&(this.config=xt(this.config,t))},i.setListener=function setListener(){var t,i,u,h,m,v=this;this.core.eventBus.on("logined",(function(t){v.subscribeModuleService.resumeSubscribe(t.isAutoReconnect),v.subscribeForVisitorService.resumeSubscribe(t.isAutoReconnect),v.config.autoSubscribe&&(v.subscribeModuleService.autoSubscribeServerMap={},v.subscribeModuleService.autoSubscribeUnreadMap={},v.subscribeModuleService.autoSubscribe())})),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(t){v.subscribeModuleService.resumeSubscribe(t.isReconnect),v.subscribeForVisitorService.resumeSubscribe(t.isReconnect),v.config.autoSubscribe&&(v.subscribeModuleService.autoSubscribeServerMap={},v.subscribeModuleService.autoSubscribeUnreadMap={},v.subscribeModuleService.autoSubscribe())})),this.core.eventBus.on("qchatChannel/changeUnread",bind$1(t=this.subscribeModuleService.changeUnread).call(t,this.subscribeModuleService)),this.core.eventBus.on("qchatChannel/updateUnreads",bind$1(i=this.subscribeModuleService.updateUnreads).call(i,this.subscribeModuleService)),this.core.eventBus.on("qchatChannel/cacheSubscribe",bind$1(u=this.subscribeModuleService.cacheSubscribe).call(u,this.subscribeModuleService)),this.core.eventBus.on("qchatChannel/clearUnreadCountByServers",bind$1(h=this.subscribeModuleService.clearUnreadCountByServers).call(h,this.subscribeModuleService)),this.core.eventBus.on("qchatChannel/getRoleIdsByServerId",bind$1(m=this.subscribeModuleService.getRoleIdsByServerId).call(m,this.subscribeModuleService)),this.core.eventBus.on("qchatChannel/autoUnSubscribe",(function(t){if(v.logger.log("QChatChannel::enter autoUnSubscribe sysMsg is",t),t.type===up[up.channelVisibilityUpdate])v.logger.log("QChatChannel::begin autoUnSubscribe channel key is",t.serverId+"_"+t.channelId),v.subscribeModuleService._unSubscribeChannel(t.serverId,t.channelId),v.logger.log("QChatChannel::autoUnSubscribe channel done key is",t.serverId+"_"+t.channelId);else if(t.type===up[up.serverEnterLeave]){var i;(v.subscribeModuleService.manualSubscribeServerMap[t.serverId]||v.subscribeModuleService.autoSubscribeServerMap[t.serverId])&&(v.logger.log("QChatChannel::begin autoUnSubscribe server key is",t.serverId),v.subscribeModuleService._unSubscribeServer(t.serverId),v.logger.log("QChatChannel::autoUnSubscribe server done key is",t.serverId));var u=v.subscribeModuleService.unreadServerCount[t.serverId];if(!u)return;v.logger.log("QChatChannel::begin autoUnSubscribe channels key is",es(u)),forEach$1(i=es(u)).call(i,(function(i){v.subscribeModuleService._unSubscribeChannel(t.serverId,i)})),v.logger.log("QChatChannel::autoUnSubscribe channels done key is",es(u))}})),this.core.eventBus.on("qchatChannel/serverIdentifyChange",(function(t){v.subscribeModuleService.changeCacheServerRoleIds(t)}))},i.createChannel=function createChannel(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i;return ms.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(qd)},name:{type:"string",required:!1},topic:{type:"string",required:!1},ext:{type:"string",required:!1},visitorMode:{type:"number",required:!1}},t),u.next=3,this.core.sendCmd("qchatCreateChannel",{channelInfo:xt(xt({},t),{type:qd[t.type]}),antispamTag:generateAntispamTag(t)});case 3:return i=u.sent,u.abrupt("return",formatChannel(i.content.channelInfo));case 5:case"end":return u.stop()}}),_callee,this)})))},i.deleteChannel=function deleteChannel(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){return ms.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1}},t),i.next=3,this.core.sendCmd("qchatDeleteChannel",t);case 3:case"end":return i.stop()}}),_callee2,this)})))},i.updateChannel=function updateChannel(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var i,u;return ms.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return validate({channelId:{type:"string",min:1},serverId:{type:"string",required:!1},type:{type:"enum",values:getEnumKeys(qd),required:!1},name:{type:"string",required:!1},topic:{type:"string",required:!1},ext:{type:"string",required:!1},visitorMode:{type:"number",required:!1}},t),i=t,t.type&&(i.type=qd[t.type]),h.next=5,this.core.sendCmd("qchatUpdateChannel",{channelInfo:i,antispamTag:generateAntispamTag(t)});case 5:return u=h.sent,h.abrupt("return",formatChannel(u.content.channelInfo));case 7:case"end":return h.stop()}}),_callee3,this)})))},i.getChannels=function getChannels(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var i;return ms.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return validate({channelIds:{type:"array",itemType:"string",min:1}},t),u.next=3,this.core.sendCmd("qchatGetChannels",t);case 3:return i=u.sent,u.abrupt("return",formatChannels(i.content.channelList));case 5:case"end":return u.stop()}}),_callee4,this)})))},i.getChannelsByPage=function getChannelsByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var i,u,h,m;return ms.wrap((function _callee5$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverId:{type:"string",min:1},timetag:{type:"number"},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetChannelsByPage",{qchatGetChannelListPageTag:xt({limit:100},t)});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatChannels(h)});case 6:case"end":return v.stop()}}),_callee5,this)})))},i.getMembersByPage=function getMembersByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee6(){var i,u,h,m;return ms.wrap((function _callee6$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},timetag:{type:"number"},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetMembersByPage",{qchatGetMembersByPageTag:t});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatMembers$1(h)});case 6:case"end":return v.stop()}}),_callee6,this)})))},i.updateWhiteBlackRole=function updateWhiteBlackRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee7(){return ms.wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},roleId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(Ld)},opeType:{type:"enum",values:getEnumKeys(Dd)}},t),i.next=3,this.core.sendCmd("qchatUpdateWhiteBlackRole",{qchatUpdateWhiteBlackRoleTag:xt(xt({},t),{type:Ld[t.type],opeType:Dd[t.opeType]})});case 3:case"end":return i.stop()}}),_callee7,this)})))},i.getWhiteBlackRolesPage=function getWhiteBlackRolesPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee8(){var i,u,h,m;return ms.wrap((function _callee8$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(Ld)},timetag:{type:"number"},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetWhiteBlackRolesPage",{qchatGetWhiteBlackRolesPageTag:xt(xt({},t),{type:Ld[t.type]})});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatRoles(h)});case 6:case"end":return v.stop()}}),_callee8,this)})))},i.updateWhiteBlackMembers=function updateWhiteBlackMembers(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee9(){return ms.wrap((function _callee9$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(Ld)},opeType:{type:"enum",values:getEnumKeys(Dd)},toAccids:{type:"array",itemType:"string",min:1}},t),i.next=3,this.core.sendCmd("qchatUpdateWhiteBlackMembers",{qchatUpdateWhiteBlackMembersTag:xt(xt({},t),{type:Ld[t.type],opeType:Dd[t.opeType],toAccids:Ms(t.toAccids)})});case 3:case"end":return i.stop()}}),_callee9,this)})))},i.getWhiteBlackMembersPage=function getWhiteBlackMembersPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee10(){var i,u,h,m;return ms.wrap((function _callee10$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(Ld)},timetag:{type:"number"},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetWhiteBlackMembersPage",{qchatGetWhiteBlackMembersPageTag:xt(xt({limit:100},t),{type:Ld[t.type]})});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatMembers$1(h)});case 6:case"end":return v.stop()}}),_callee10,this)})))},i.getExistingWhiteBlackRoles=function getExistingWhiteBlackRoles(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee11(){var i,u;return ms.wrap((function _callee11$(h){for(;;)switch(h.prev=h.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(Ld)},roleIds:{type:"array",itemType:"string",min:1}},t),h.next=3,this.core.sendCmd("qchatGetExistingWhiteBlackRoles",{qchatGetExistingWhiteBlackRolesTag:xt(xt({},t),{type:Ld[t.type],roleIds:Ms(t.roleIds)})});case 3:return i=h.sent,u=i.content.datas,h.abrupt("return",{datas:formatRoles(u)});case 6:case"end":return h.stop()}}),_callee11,this)})))},i.getExistingWhiteBlackMembers=function getExistingWhiteBlackMembers(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee12(){var i,u;return ms.wrap((function _callee12$(h){for(;;)switch(h.prev=h.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(Ld)},accids:{type:"array",itemType:"string",min:1}},t),h.next=3,this.core.sendCmd("qchatGetExistingWhiteBlackMembers",{qchatGetExistingWhiteBlackMembersTag:xt(xt({},t),{type:Ld[t.type],accids:Ms(t.accids)})});case 3:return i=h.sent,u=i.content.datas,h.abrupt("return",{datas:formatMembers$1(u)});case 6:case"end":return h.stop()}}),_callee12,this)})))},i.updateCategoryInfoOfChannel=function updateCategoryInfoOfChannel(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee13(){var i;return ms.wrap((function _callee13$(u){for(;;)switch(u.prev=u.next){case 0:return validate({channelId:{type:"string",min:1},categoryId:{type:"string",allowEmpty:!1,required:!1},syncMode:{type:"number",min:0,max:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatUpdateCategoryInfoOfChannel",{qchatUpdateCategoryInfoOfChannelTag:t});case 3:return i=u.sent,u.abrupt("return",formatChannel(i.content.channelInfo));case 5:case"end":return u.stop()}}),_callee13,this)})))},i.createChannelCategory=function createChannelCategory(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee14(){var i;return ms.wrap((function _callee14$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},name:{type:"string",allowEmpty:!1,required:!1},ext:{type:"string",required:!1},viewMode:{type:"number",min:0,max:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatCreateChannelCategory",{qchatCreateChannelCategoryTag:t});case 3:return i=u.sent,u.abrupt("return",formatChannelCategory(i.content.QChatChannelCategoryInfo));case 5:case"end":return u.stop()}}),_callee14,this)})))},i.removeChannelCategory=function removeChannelCategory(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee15(){return ms.wrap((function _callee15$(i){for(;;)switch(i.prev=i.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1}},t),i.next=3,this.core.sendCmd("qchatRemoveChannelCategory",t);case 3:case"end":return i.stop()}}),_callee15,this)})))},i.updateChannelCategory=function updateChannelCategory(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee16(){var i;return ms.wrap((function _callee16$(u){for(;;)switch(u.prev=u.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},name:{type:"string",allowEmpty:!1,required:!1},ext:{type:"string",required:!1},viewMode:{type:"number",min:0,max:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatUpdateChannelCategory",{qchatUpdateChannelCategoryTag:t});case 3:return i=u.sent,u.abrupt("return",formatChannelCategory(i.content.QChatChannelCategoryInfo));case 5:case"end":return u.stop()}}),_callee16,this)})))},i.getChannelCategoriesByID=function getChannelCategoriesByID(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee17(){var i;return ms.wrap((function _callee17$(u){for(;;)switch(u.prev=u.next){case 0:return validate({categoryIds:{type:"array",itemType:"string",min:1}},t),u.next=3,this.core.sendCmd("qchatGetChannelCategoriesByID",t);case 3:return i=u.sent,u.abrupt("return",formatChannelCategorys(i.content.channelCategoryList));case 5:case"end":return u.stop()}}),_callee17,this)})))},i.updateChannelCategoryWhiteBlackRole=function updateChannelCategoryWhiteBlackRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee18(){return ms.wrap((function _callee18$(i){for(;;)switch(i.prev=i.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(Ld)},opeType:{type:"enum",values:getEnumKeys(Dd)},roleId:{type:"string",allowEmpty:!1}},t),i.next=3,this.core.sendCmd("qchatUpdateChannelCategoryWhiteBlackRole",{qchatUpdateChannelCategoryWhiteBlackRoleTag:xt(xt({},t),{type:Ld[t.type],opeType:Dd[t.opeType]})});case 3:case"end":return i.stop()}}),_callee18,this)})))},i.getChannelCategoryWhiteBlackRolesPage=function getChannelCategoryWhiteBlackRolesPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee19(){var i,u,h,m;return ms.wrap((function _callee19$(v){for(;;)switch(v.prev=v.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(Ld)},timetag:{type:"number",min:0},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetChannelCategoryWhiteBlackRolesPage",{qchatGetChannelCategoryWhiteBlackRolesPageTag:xt(xt({},t),{type:Ld[t.type]})});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatRoles(h)});case 6:case"end":return v.stop()}}),_callee19,this)})))},i.updateChannelCategoryWhiteBlackMembers=function updateChannelCategoryWhiteBlackMembers(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee20(){return ms.wrap((function _callee20$(i){for(;;)switch(i.prev=i.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(Ld)},opeType:{type:"enum",values:getEnumKeys(Dd)},toAccids:{type:"array",itemType:"string",min:1}},t),i.next=3,this.core.sendCmd("qchatUpdateChannelCategoryWhiteBlackMembers",{qchatUpdateChannelCategoryWhiteBlackMembersTag:xt(xt({},t),{type:Ld[t.type],opeType:Dd[t.opeType],toAccids:Ms(t.toAccids)})});case 3:case"end":return i.stop()}}),_callee20,this)})))},i.getChannelCategoryWhiteBlackMembersPage=function getChannelCategoryWhiteBlackMembersPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee21(){var i,u,h,m;return ms.wrap((function _callee21$(v){for(;;)switch(v.prev=v.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(Ld)},timetag:{type:"number",min:0},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetChannelCategoryWhiteBlackMembersPage",{qchatGetChannelCategoryWhiteBlackMembersPageTag:xt(xt({},t),{type:Ld[t.type]})});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatMembers$1(h)});case 6:case"end":return v.stop()}}),_callee21,this)})))},i.getChannelCategoryWhiteBlackRoles=function getChannelCategoryWhiteBlackRoles(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee22(){var i,u;return ms.wrap((function _callee22$(h){for(;;)switch(h.prev=h.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(Ld)},roleIds:{type:"array",itemType:"string",min:1}},t),h.next=3,this.core.sendCmd("qchatGetChannelCategoryWhiteBlackRoles",{qchatGetChannelCategoryWhiteBlackRolesTag:xt(xt({},t),{type:Ld[t.type],roleIds:Ms(t.roleIds)})});case 3:return i=h.sent,u=i.content.datas,h.abrupt("return",formatRoles(u));case 6:case"end":return h.stop()}}),_callee22,this)})))},i.getChannelCategoryWhiteBlackMembers=function getChannelCategoryWhiteBlackMembers(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee23(){var i,u;return ms.wrap((function _callee23$(h){for(;;)switch(h.prev=h.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(Ld)},accids:{type:"array",itemType:"string",min:1}},t),h.next=3,this.core.sendCmd("qchatGetChannelCategoryWhiteBlackMembers",{qchatGetChannelCategoryWhiteBlackMembersTag:xt(xt({},t),{type:Ld[t.type],accids:Ms(t.accids)})});case 3:return i=h.sent,u=i.content.datas,h.abrupt("return",formatMembers$1(u));case 6:case"end":return h.stop()}}),_callee23,this)})))},i.getChannelCategoriesPage=function getChannelCategoriesPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee24(){var i,u,h,m;return ms.wrap((function _callee24$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},timetag:{type:"number",min:0},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetChannelCategoriesPage",{qchatGetChannelCategoriesPageTag:t});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatChannelCategorys(h)});case 6:case"end":return v.stop()}}),_callee24,this)})))},i.getChannelCategoryChannelsPage=function getChannelCategoryChannelsPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee25(){var i,u,h,m;return ms.wrap((function _callee25$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},timetag:{type:"number",min:0},limit:{type:"number",min:1,required:!1}},t),v.next=3,this.core.sendCmd("qchatGetChannelCategoryChannelsPage",{qchatGetChannelCategoryChannelsPageTag:t});case 3:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag)},datas:formatChannels(h)});case 6:case"end":return v.stop()}}),_callee25,this)})))},i.subscribeChannel=function subscribeChannel(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee26(){var i,u;return ms.wrap((function _callee26$(h){for(;;)switch(h.prev=h.next){case 0:if(validate({type:{type:"number",min:1,max:5},opeType:{type:"number",min:1,max:2}},t),!this.config.autoSubscribe||t.isInternalTrigger||5===t.type){h.next=3;break}throw new Xl("subscribe server failed, manual subscribe is not allowed in auto subscribe mode",{},403);case 3:return h.next=5,this.subscribeModuleService.subscribe(t);case 5:if((i=h.sent).unreadInfos=formatUnreadInfos(i.unreadInfos),5!==t.type){h.next=10;break}return this.subscribeModuleService.cacheSubscribe(t),h.abrupt("return");case 10:return 1===t.opeType&&(t.channels=map$6(u=i.unreadInfos).call(u,(function(t){return{serverId:t.serverId,channelId:t.channelId}}))),this.logger.debug("QChatChannel::subscribeChannel:: cacheSubscribe ",t),this.config.autoSubscribe?this.subscribeModuleService.cacheAutoSubscribe(t):this.subscribeModuleService.cacheSubscribe(t),this.subscribeModuleService.updateUnreads(i.unreadInfos),h.abrupt("return",i);case 15:case"end":return h.stop()}}),_callee26,this)})))},i.getChannelUnreadInfos=function getChannelUnreadInfos(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee27(){var i,u;return ms.wrap((function _callee27$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.core.sendCmd("qchatGetUnreadInfo",t);case 2:return i=h.sent,u=formatUnreadInfos(i.content.unreadInfos),this.subscribeModuleService.updateUnreads(u),h.abrupt("return",u);case 6:case"end":return h.stop()}}),_callee27,this)})))},i.getChannelSearchByPage=function getChannelSearchByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee28(){var i,u,h,m;return ms.wrap((function _callee28$(v){for(;;)switch(v.prev=v.next){case 0:if(validate({keyword:{type:"string",allowEmpty:!1},startTime:{type:"number",min:0,required:!1},endTime:{type:"number",min:1,required:!1},order:{type:"enum",values:getEnumKeys(pd),required:!1},limit:{type:"number",min:1,required:!1},serverId:{type:"string",required:!1},sort:{type:"enum",values:getEnumKeys(Pd),required:!1},cursor:{type:"string",allowEmpty:!1,required:!1}},t),!(t.startTime&&t.endTime&&t.startTime>=t.endTime)){v.next=3;break}throw new Ql("startTime more than endTime",t,"timeRule");case 3:return v.next=5,this.core.sendCmd("qchatGetChannelSearchByPage",{qchatGetChannelSearchByPageTag:xt(xt({},t),{order:t.order&&pd[t.order],sort:sort(t)&&Pd[sort(t)]})});case 5:return i=v.sent,u=i.content,h=u.datas,m=u.listQueryTag,v.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:su(m.nextTimetag),cursor:m.cursor},datas:formatChannels(h)});case 8:case"end":return v.stop()}}),_callee28,this)})))},i.channelMemberSearch=function channelMemberSearch(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee29(){var i;return ms.wrap((function _callee29$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},keyword:{type:"string",allowEmpty:!1},limit:{type:"number",min:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatChannelMemberSearch",{qchatChannelMemberSearchTag:t});case 3:return i=u.sent,u.abrupt("return",formatChannelMembers(i.content.datas));case 5:case"end":return u.stop()}}),_callee29,this)})))},i.subscribeAsVisitor=function subscribeAsVisitor(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee30(){return ms.wrap((function _callee30$(i){for(;;)switch(i.prev=i.next){case 0:return validate({opeType:{type:"number",min:1,max:2},type:{type:"number",required:!1},channels:{type:"array",rules:{serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1}},min:1}},t),i.next=3,this.subscribeForVisitorService.subscribeChannelAsVisitor(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee30,this)})))},i.qchatAutoSubscribeNotificationHandler=function qchatAutoSubscribeNotificationHandler(t){var i=formatUnreadInfos(t.content.unreadInfos),u=t.content.serverIds;this.subscribeModuleService.updateUnreads(i);var h=[];if(u.length){var m={opeType:1};m.channels=map$6(u).call(u,(function(t){return{serverId:t.serverId,channelId:""}})),m.type=4,h.push(m)}if(i.length){var v={opeType:1};v.channels=map$6(i).call(i,(function(t){return{serverId:t.serverId,channelId:t.channelId}})),v.type=1,h.push(v)}if(h.length)for(var E,I=_createForOfIteratorHelperLoose$2(h);!(E=I()).done;){var M=E.value;this.subscribeModuleService.cacheAutoSubscribe(M)}},QChatChannelService}(vd),Ip={"24_61":"qchatCreateServerRole","24_62":"qchatDeleteServerRole","24_63":"qchatUpdateServerRole","24_64":"qchatGetServerRoles","24_65":"qchatAddChannelRole","24_66":"qchatRemoveChannelRole","24_67":"qchatUpdateChannelRole","24_68":"qchatGetChannelRoles","24_69":"qchatAddMemberRole","24_70":"qchatRemoveMemberRole","24_71":"qchatUpdateMemberRole","24_72":"qchatGetMemberRoles","24_73":"qchatAddMembersToServerRole","24_74":"qchatRemoveMembersFromServerRole","24_75":"qchatGetMembersFromServerRole","24_76":"qchatGetServerRolesByAccid","24_77":"qchatGetExistingServerRolesByAccids","24_78":"qchatGetExistingChannelRolesByServerRoleIds","24_79":"qchatGetExistingAccidsOfMemberRoles","24_80":"qchatUpdateServerRolePriorities","24_81":"qchatGetExistingAccidsInServerRole","24_82":"qchatCheckPermission","24_83":"qchatAddChannelCategoryRole","24_84":"qchatRemoveChannelCategoryRole","24_85":"qchatUpdateChannelCategoryRole","24_86":"qchatGetChannelCategoryRole","24_87":"qchatAddChannelCategoryMemberRole","24_88":"qchatRemoveChannelCategoryMemberRole","24_89":"qchatUpdateChannelCategoryMemberRole","24_90":"qchatGetChannelCategoryMemberRole","24_126":"qchatCheckPermissions"},Mp={channelRole:{serverId:1,roleId:2,parentRoleId:3,channelId:4,name:5,icon:6,ext:7,auths:8,type:9,createTime:10,updateTime:11},memberRole:{serverId:1,id:2,accid:3,channelId:4,auths:5,createTime:6,updateTime:7,nick:8,avatar:9,ext:10,memberType:11,joinTime:12,inviter:13},antispamTag:{antiSpamBusinessId:1},serverRole:{serverId:1,roleId:2,name:3,icon:4,ext:5,auths:6,type:7,memberCount:8,priority:9,createTime:10,updateTime:11,isMember:12},getRoleByPagesTag:{serverId:1,channelId:2,time:3,limit:4},checkPermissionTag:{serverId:1,channelId:2,auth:3},member:{serverId:1,roleId:2,accid:3,createTime:4,updateTime:5,nick:6,avatar:7,ext:8,type:9,joinTime:10,inviter:11},qchatAddChannelCategoryRoleTag:{categoryId:3,serverId:4,parentRoleId:5},channelCategoryRole:{roleId:1,categoryId:3,serverId:4,parentRoleId:5,type:6,validFlag:7,createTime:8,updateTime:9,auths:10,name:11,icon:12,ext:13},qchatGetChannelCategoryRoleTag:{serverId:1,categoryId:2,timetag:3,limit:4},channelCategoryMemberRole:{id:1,accid:3,categoryId:4,serverId:5,validFlag:6,createTime:7,updateTime:8,auths:9,nick:10,avatar:11,ext:12,memberType:13,joinTime:14,inviter:15},qchatGetChannelCategoryMemberRoleTag:{serverId:1,categoryId:2,timetag:3,limit:4},checkPermissionsTag:{serverId:1,channelId:2,auths:3}},Sp=function getDeserializeTag(){return invertSerializeMap(Mp)},Tp=function getCmdConfig(){var t=Sp();return{qchatCreateServerRole:{service:"qchatRole",sid:24,cid:61,params:[{type:"Property",name:"serverRole",reflectMapper:Mp.serverRole},{type:"Property",name:"antispamTag",reflectMapper:Mp.antispamTag}],response:[{type:"Property",name:"serverRole",reflectMapper:t.serverRole}]},qchatDeleteServerRole:{service:"qchatRole",sid:24,cid:62,params:[{type:"Long",name:"serverId"},{type:"Long",name:"roleId"}]},qchatUpdateServerRole:{service:"qchatRole",sid:24,cid:63,params:[{type:"Property",name:"updateServerRoleTag",reflectMapper:{serverId:1,roleId:2,name:3,icon:4,ext:5,auths:6,priority:7}},{type:"Property",name:"antispamTag",reflectMapper:Mp.antispamTag}],response:[{type:"Property",name:"serverRole",reflectMapper:t.serverRole}]},qchatGetServerRoles:{service:"qchatRole",sid:24,cid:64,params:[{type:"Property",name:"getServerRolesTag",reflectMapper:{serverId:1,timetag:2,limit:3,priority:4,channelId:5,categoryId:6}}],response:[{type:"PropertyArray",name:"serverRoles",reflectMapper:t.serverRole}]},qchatAddChannelRole:{service:"qchatRole",sid:24,cid:65,params:[{type:"Property",name:"channelRole",reflectMapper:Mp.channelRole}],response:[{type:"Property",name:"channelRole",reflectMapper:t.channelRole}]},qchatRemoveChannelRole:{service:"qchatRole",sid:24,cid:66,params:[{type:"Long",name:"serverId"},{type:"Long",name:"channelId"},{type:"Long",name:"roleId"}]},qchatUpdateChannelRole:{service:"qchatRole",sid:24,cid:67,params:[{type:"Property",name:"updateChannelRoleTag",reflectMapper:{serverId:1,roleId:2,channelId:3,auths:4}}],response:[{type:"Property",name:"channelRole",reflectMapper:t.channelRole}]},qchatGetChannelRoles:{service:"qchatRole",sid:24,cid:68,params:[{type:"Property",name:"getChannelRolesTag",reflectMapper:{serverId:1,channelId:2,timetag:3,limit:4}}],response:[{type:"PropertyArray",name:"channelRoles",reflectMapper:t.channelRole}]},qchatAddMemberRole:{service:"qchatRole",sid:24,cid:69,params:[{type:"Property",name:"memberRole",reflectMapper:Mp.memberRole}],response:[{type:"Property",name:"memberRole",reflectMapper:t.memberRole}]},qchatRemoveMemberRole:{service:"qchatRole",sid:24,cid:70,params:[{type:"Property",name:"memberRole",reflectMapper:Mp.memberRole}]},qchatUpdateMemberRole:{service:"qchatRole",sid:24,cid:71,params:[{type:"Property",name:"updateMemberRoleTag",reflectMapper:{serverId:1,accid:2,channelId:3,auths:4}}],response:[{type:"Property",name:"memberRole",reflectMapper:t.memberRole}]},qchatGetMemberRoles:{service:"qchatRole",sid:24,cid:72,params:[{type:"Property",name:"getMemberRolesTag",reflectMapper:{serverId:1,channelId:2,timetag:3,limit:4}}],response:[{type:"PropertyArray",name:"memberRoles",reflectMapper:t.memberRole}]},qchatAddMembersToServerRole:{service:"qchatRole",sid:24,cid:73,params:[{type:"Long",name:"serverId"},{type:"Long",name:"roleId"},{type:"String",name:"accids"}],response:[{type:"Property",name:"accids",reflectMapper:{1:"successAccids",2:"failedAccids"}}]},qchatRemoveMembersFromServerRole:{service:"qchatRole",sid:24,cid:74,params:[{type:"Long",name:"serverId"},{type:"Long",name:"roleId"},{type:"String",name:"accids"}],response:[{type:"Property",name:"accids",reflectMapper:{1:"successAccids",2:"failedAccids"}}]},qchatGetMembersFromServerRole:{service:"qchatRole",sid:24,cid:75,params:[{type:"Property",name:"getMembersFromServerRoleTag",reflectMapper:{serverId:1,roleId:2,timetag:3,accid:4,limit:5}}],response:[{type:"PropertyArray",name:"members",reflectMapper:t.member}]},qchatGetServerRolesByAccid:{service:"qchatRole",sid:24,cid:76,params:[{type:"Property",name:"getServerRolesByAccidTag",reflectMapper:{serverId:1,accid:2,timetag:3,limit:4}}],response:[{type:"PropertyArray",name:"serverRoles",reflectMapper:t.serverRole}]},qchatGetExistingServerRolesByAccids:{service:"qchatRole",sid:24,cid:77,params:[{type:"Long",name:"serverId"},{type:"String",name:"accids"}],response:[{type:"String",name:"serverRoles"}]},qchatGetExistingChannelRolesByServerRoleIds:{service:"qchatRole",sid:24,cid:78,params:[{type:"Long",name:"serverId"},{type:"Long",name:"channelId"},{type:"String",name:"roleIds"}],response:[{type:"PropertyArray",name:"channelRoles",reflectMapper:t.channelRole}]},qchatGetExistingAccidsOfMemberRoles:{service:"qchatRole",sid:24,cid:79,params:[{type:"Long",name:"serverId"},{type:"Long",name:"channelId"},{type:"String",name:"accids"}],response:[{type:"PropertyArray",name:"memberRoles",reflectMapper:t.memberRole}]},qchatUpdateServerRolePriorities:{service:"qchatRole",sid:24,cid:80,params:[{type:"Long",name:"serverId"},{type:"PropertyArray",name:"serverRoles",reflectMapper:{serverId:1,roleId:2,priority:7}}],response:[{type:"PropertyArray",name:"serverRoles",reflectMapper:t.serverRole}]},qchatGetExistingAccidsInServerRole:{service:"qchatRole",sid:24,cid:81,params:[{type:"Long",name:"serverId"},{type:"Long",name:"roleId"},{type:"String",name:"accids"}],response:[{type:"PropertyArray",name:"members",reflectMapper:t.member}]},qchatCheckPermission:{service:"qchatRole",sid:24,cid:82,params:[{type:"Property",name:"checkPermissionTag",reflectMapper:Mp.checkPermissionTag}],response:[{type:"Bool",name:"checked"}]},qchatAddChannelCategoryRole:{service:"qchatRole",sid:24,cid:83,params:[{type:"Property",name:"qchatAddChannelCategoryRoleTag",reflectMapper:Mp.channelCategoryRole}],response:[{type:"Property",name:"channelCategoryRole",reflectMapper:t.channelCategoryRole}]},qchatRemoveChannelCategoryRole:{service:"qchatRole",sid:24,cid:84,params:[{type:"Long",name:"serverId"},{type:"Long",name:"categoryId"},{type:"Long",name:"roleId"}]},qchatUpdateChannelCategoryRole:{service:"qchatRole",sid:24,cid:85,params:[{type:"Property",name:"qchatUpdateChannelCategoryRoleTag",reflectMapper:Mp.channelCategoryRole}],response:[{type:"Property",name:"channelCategoryRole",reflectMapper:t.channelCategoryRole}]},qchatGetChannelCategoryRole:{service:"qchatRole",sid:24,cid:86,params:[{type:"Property",name:"qchatGetChannelCategoryRoleTag",reflectMapper:Mp.qchatGetChannelCategoryRoleTag}],response:[{type:"PropertyArray",name:"list",reflectMapper:t.channelCategoryRole}]},qchatAddChannelCategoryMemberRole:{service:"qchatRole",sid:24,cid:87,params:[{type:"Property",name:"qchatAddChannelCategoryMemberRoleTag",reflectMapper:Mp.channelCategoryMemberRole}],response:[{type:"Property",name:"channelCategoryMemberRole",reflectMapper:t.channelCategoryMemberRole}]},qchatRemoveChannelCategoryMemberRole:{service:"qchatRole",sid:24,cid:88,params:[{type:"Long",name:"serverId"},{type:"Long",name:"categoryId"},{type:"String",name:"accid"}]},qchatUpdateChannelCategoryMemberRole:{service:"qchatRole",sid:24,cid:89,params:[{type:"Property",name:"qchatUpdateChannelCategoryMemberRoleTag",reflectMapper:Mp.channelCategoryMemberRole}],response:[{type:"Property",name:"channelCategoryMemberRole",reflectMapper:t.channelCategoryMemberRole}]},qchatGetChannelCategoryMemberRole:{service:"qchatRole",sid:24,cid:90,params:[{type:"Property",name:"qchatGetChannelCategoryMemberRoleTag",reflectMapper:Mp.qchatGetChannelCategoryMemberRoleTag}],response:[{type:"PropertyArray",name:"list",reflectMapper:t.channelCategoryMemberRole}]},qchatCheckPermissions:{service:"qchatRole",sid:24,cid:126,params:[{type:"Property",name:"checkPermissionsTag",reflectMapper:Mp.checkPermissionsTag}],response:[{type:"PropertyArray",name:"checkPermissionsResult",reflectMapper:{1:"auth",2:"isAllow"}}]}}},Cp=function(){function CategoryModuleService(t){this.core=t}var t=CategoryModuleService.prototype;return t.addChannelCategoryRole=function addChannelCategoryRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i;return ms.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},parentRoleId:{type:"string",allowEmpty:!1}},t),u.next=3,this.core.sendCmd("qchatAddChannelCategoryRole",{qchatAddChannelCategoryRoleTag:t});case 3:return i=u.sent,u.abrupt("return",formatChannelCategoryRole(i.content.channelCategoryRole));case 5:case"end":return u.stop()}}),_callee,this)})))},t.removeChannelCategoryRole=function removeChannelCategoryRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){return ms.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1}},t),i.next=3,this.core.sendCmd("qchatRemoveChannelCategoryRole",t);case 3:case"end":return i.stop()}}),_callee2,this)})))},t.updateChannelCategoryRole=function updateChannelCategoryRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var i;return ms.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1},auths:{type:"object"}},t),u.next=3,this.core.sendCmd("qchatUpdateChannelCategoryRole",{qchatUpdateChannelCategoryRoleTag:generatorRoleForCmd(t)});case 3:if(406!==(i=u.sent).raw.code){u.next=6;break}throw new Xl("No update required",{},406);case 6:return u.abrupt("return",formatChannelCategoryRole(i.content.channelCategoryRole));case 7:case"end":return u.stop()}}),_callee3,this)})))},t.getChannelCategoryRole=function getChannelCategoryRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var i;return ms.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},timetag:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatGetChannelCategoryRole",{qchatGetChannelCategoryRoleTag:t});case 3:return i=u.sent,u.abrupt("return",(h=i.content.list,Qs(h)&&h.length>0?map$6(h).call(h,(function(t){return formatChannelCategoryRole(t)})):[]));case 5:case"end":return u.stop()}var h}),_callee4,this)})))},t.addChannelCategoryMemberRole=function addChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var i;return ms.wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1}},t),u.next=3,this.core.sendCmd("qchatAddChannelCategoryMemberRole",{qchatAddChannelCategoryMemberRoleTag:t});case 3:return i=u.sent,u.abrupt("return",formatChannelCategoryMemberRole(i.content.channelCategoryMemberRole));case 5:case"end":return u.stop()}}),_callee5,this)})))},t.removeChannelCategoryMemberRole=function removeChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee6(){return ms.wrap((function _callee6$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1}},t),i.next=3,this.core.sendCmd("qchatRemoveChannelCategoryMemberRole",t);case 3:case"end":return i.stop()}}),_callee6,this)})))},t.updateChannelCategoryMemberRole=function updateChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee7(){var i;return ms.wrap((function _callee7$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1},auths:{type:"object"}},t),u.next=3,this.core.sendCmd("qchatUpdateChannelCategoryMemberRole",{qchatUpdateChannelCategoryMemberRoleTag:generatorRoleForCmd(t)});case 3:if(406!==(i=u.sent).raw.code){u.next=6;break}throw new Xl("No update required",{},406);case 6:return u.abrupt("return",formatChannelCategoryMemberRole(i.content.channelCategoryMemberRole));case 7:case"end":return u.stop()}}),_callee7,this)})))},t.getChannelCategoryMemberRole=function getChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee8(){var i;return ms.wrap((function _callee8$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},timetag:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatGetChannelCategoryMemberRole",{qchatGetChannelCategoryMemberRoleTag:t});case 3:return i=u.sent,u.abrupt("return",(h=i.content.list,Qs(h)&&h.length>0?map$6(h).call(h,(function(t){return formatChannelCategoryMemberRole(t)})):[]));case 5:case"end":return u.stop()}var h}),_callee8,this)})))},CategoryModuleService}(),bp=function(t){function QChatRoleService(i){var u;return(u=t.call(this,"qchatRole",i)||this).core=i,registerParser({cmdMap:Ip,cmdConfig:Tp()}),u.category=new Cp(i),u}bt(QChatRoleService,t);var i=QChatRoleService.prototype;return i.createServerRole=function createServerRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i;return ms.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},name:{type:"string",allowEmpty:!1},priority:{type:"number",min:1},icon:{type:"string",required:!1},ext:{type:"string",required:!1}},t),u.next=3,this.core.sendCmd("qchatCreateServerRole",{serverRole:xt(xt({},generatorRoleForCmd(t)),{type:Wd.custom}),antispamTag:generateAntispamTag(t)});case 3:return i=u.sent,u.abrupt("return",formatRole(i.content.serverRole));case 5:case"end":return u.stop()}}),_callee,this)})))},i.updateServerRole=function updateServerRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var i;return ms.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1},name:{type:"string",required:!1},icon:{type:"string",required:!1},ext:{type:"string",required:!1},priority:{type:"number",required:!1},auths:{type:"object",required:!1}},t),u.next=3,this.core.sendCmd("qchatUpdateServerRole",{updateServerRoleTag:generatorRoleForCmd(t),antispamTag:generateAntispamTag(t)});case 3:return i=u.sent,u.abrupt("return",formatRole(i.content.serverRole));case 5:case"end":return u.stop()}}),_callee2,this)})))},i.deleteServerRole=function deleteServerRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){return ms.wrap((function _callee3$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1}},t),i.next=3,this.core.sendCmd("qchatDeleteServerRole",t);case 3:case"end":return i.stop()}}),_callee3,this)})))},i.getServerRoles=function getServerRoles(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var i,u,h;return ms.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1,required:!1},categoryId:{type:"string",allowEmpty:!1,required:!1},limit:{type:"number",min:1,required:!1},priority:{type:"number",required:!1}},t),m.next=3,this.core.sendCmd("qchatGetServerRoles",{getServerRolesTag:generatorRoleForCmd(t)});case 3:return u=m.sent,h=filter(i=u.content.serverRoles).call(i,(function(t){return 1===su(t.isMember)})),h=map$6(h).call(h,(function(t){return t.roleId})),m.abrupt("return",{roles:formatRoles(u.content.serverRoles),isMemberRoles:h});case 7:case"end":return m.stop()}}),_callee4,this)})))},i.addChannelRole=function addChannelRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var i;return ms.wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},parentRoleId:{type:"string",allowEmpty:!1}},t),u.next=3,this.core.sendCmd("qchatAddChannelRole",{channelRole:generatorRoleForCmd(t)});case 3:return i=u.sent,u.abrupt("return",formatRole(i.content.channelRole));case 5:case"end":return u.stop()}}),_callee5,this)})))},i.getChannelRoles=function getChannelRoles(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee6(){var i;return ms.wrap((function _callee6$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},timetag:{type:"number",required:!1},limit:{type:"number",min:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatGetChannelRoles",{getChannelRolesTag:t});case 3:return i=u.sent,u.abrupt("return",formatRoles(i.content.channelRoles));case 5:case"end":return u.stop()}}),_callee6,this)})))},i.removeChannelRole=function removeChannelRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee7(){return ms.wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1}},t),i.next=3,this.core.sendCmd("qchatRemoveChannelRole",t);case 3:case"end":return i.stop()}}),_callee7,this)})))},i.updateChannelRole=function updateChannelRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee8(){var i;return ms.wrap((function _callee8$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1},auths:{type:"object",required:!1}},t),u.next=3,this.core.sendCmd("qchatUpdateChannelRole",{updateChannelRoleTag:generatorRoleForCmd(t)});case 3:if(406!==(i=u.sent).raw.code){u.next=6;break}throw new Xl("No update required",{},406);case 6:return u.abrupt("return",formatRole(i.content.channelRole));case 7:case"end":return u.stop()}}),_callee8,this)})))},i.addMemberRole=function addMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee9(){var i;return ms.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1}},t),u.next=3,this.core.sendCmd("qchatAddMemberRole",{memberRole:t});case 3:return i=u.sent,u.abrupt("return",formatRole(i.content.memberRole));case 5:case"end":return u.stop()}}),_callee9,this)})))},i.getMemberRoles=function getMemberRoles(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee10(){var i;return ms.wrap((function _callee10$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},timetag:{type:"number",required:!1},limit:{type:"number",min:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatGetMemberRoles",{getMemberRolesTag:t});case 3:return i=u.sent,u.abrupt("return",formatRoles(i.content.memberRoles));case 5:case"end":return u.stop()}}),_callee10,this)})))},i.removeMemberRole=function removeMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee11(){return ms.wrap((function _callee11$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1}},t),i.next=3,this.core.sendCmd("qchatRemoveMemberRole",{memberRole:t});case 3:case"end":return i.stop()}}),_callee11,this)})))},i.updateMemberRole=function updateMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee12(){var i;return ms.wrap((function _callee12$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1},auths:{type:"object",required:!1}},t),u.next=3,this.core.sendCmd("qchatUpdateMemberRole",{updateMemberRoleTag:generatorRoleForCmd(t)});case 3:if(406!==(i=u.sent).raw.code){u.next=6;break}throw new Xl("No update required",{},406);case 6:return u.abrupt("return",formatRole(i.content.memberRole));case 7:case"end":return u.stop()}}),_callee12,this)})))},i.addMembersToServerRole=function addMembersToServerRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee13(){var i,u,h;return ms.wrap((function _callee13$(m){for(;;)switch(m.prev=m.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1},accids:{type:"array",itemType:"string",min:1}},t),m.next=3,this.core.sendCmd("qchatAddMembersToServerRole",xt(xt({},t),{accids:Ms(t.accids)}));case 3:return i=m.sent,u=get(i,"content.accids.successAccids"),h=get(i,"content.accids.failedAccids"),m.abrupt("return",{successAccids:u?JSON.parse(u):[],failedAccids:h?JSON.parse(h):[]});case 7:case"end":return m.stop()}}),_callee13,this)})))},i.removeMembersFromServerRole=function removeMembersFromServerRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee14(){var i,u,h;return ms.wrap((function _callee14$(m){for(;;)switch(m.prev=m.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1},accids:{type:"array",itemType:"string",min:1}},t),m.next=3,this.core.sendCmd("qchatRemoveMembersFromServerRole",xt(xt({},t),{accids:Ms(t.accids)}));case 3:return i=m.sent,u=get(i,"content.accids.successAccids"),h=get(i,"content.accids.failedAccids"),m.abrupt("return",{successAccids:u?JSON.parse(u):[],failedAccids:h?JSON.parse(h):[]});case 7:case"end":return m.stop()}}),_callee14,this)})))},i.getMembersFromServerRole=function getMembersFromServerRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee15(){var i;return ms.wrap((function _callee15$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1},timetag:{type:"number",required:!1},accid:{type:"string",allowEmpty:!1,required:!1},limit:{type:"number",min:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatGetMembersFromServerRole",{getMembersFromServerRoleTag:t});case 3:return i=u.sent,u.abrupt("return",formatRoles(i.content.members));case 5:case"end":return u.stop()}}),_callee15,this)})))},i.getServerRolesByAccid=function getServerRolesByAccid(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee16(){var i;return ms.wrap((function _callee16$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1},timetag:{type:"number",required:!1},limit:{type:"number",min:1,required:!1}},t),u.next=3,this.core.sendCmd("qchatGetServerRolesByAccid",{getServerRolesByAccidTag:t});case 3:return i=u.sent,u.abrupt("return",formatRoles(i.content.serverRoles));case 5:case"end":return u.stop()}}),_callee16,this)})))},i.getExistingServerRolesByAccids=function getExistingServerRolesByAccids(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee17(){var i,u,h;return ms.wrap((function _callee17$(m){for(;;)switch(m.prev=m.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},accids:{type:"array",itemType:"string"}},t),m.next=3,this.core.sendCmd("qchatGetExistingServerRolesByAccids",{serverId:t.serverId,accids:Ms(t.accids)});case 3:return i=m.sent,m.prev=4,h=JSON.parse(i.content.serverRoles),forEach$1(u=es(h)).call(u,(function(t){var i;forEach$1(i=h[t]).call(i,(function(i,u){h[t][u]=deserialize(i,Sp().serverRole)})),h[t]=formatRoles(h[t])})),m.abrupt("return",h);case 10:throw m.prev=10,m.t0=m.catch(4),this.logger.error("can not parse serverRolesGroupByAccid from "+t.serverId+" and "+t.accids,i.content.serverRoles),m.t0;case 14:case"end":return m.stop()}}),_callee17,this,[[4,10]])})))},i.getExistingChannelRolesByServerRoleIds=function getExistingChannelRolesByServerRoleIds(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee18(){var i;return ms.wrap((function _callee18$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},roleIds:{type:"array",itemType:"string"}},t),u.next=3,this.core.sendCmd("qchatGetExistingChannelRolesByServerRoleIds",{serverId:t.serverId,channelId:t.channelId,roleIds:Ms(t.roleIds)});case 3:return i=u.sent,u.abrupt("return",formatRoles(i.content.channelRoles));case 5:case"end":return u.stop()}}),_callee18,this)})))},i.getExistingAccidsOfMemberRoles=function getExistingAccidsOfMemberRoles(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee19(){var i,u;return ms.wrap((function _callee19$(h){for(;;)switch(h.prev=h.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},accids:{type:"array",itemType:"string"}},t),h.next=3,this.core.sendCmd("qchatGetExistingAccidsOfMemberRoles",{serverId:t.serverId,channelId:t.channelId,accids:Ms(t.accids)});case 3:return i=h.sent,u=i.content.memberRoles,h.abrupt("return",u&&u.length>0?map$6(u).call(u,(function(t){return t.accid})):[]);case 6:case"end":return h.stop()}}),_callee19,this)})))},i.getExistingAccidsInServerRole=function getExistingAccidsInServerRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee20(){var i,u;return ms.wrap((function _callee20$(h){for(;;)switch(h.prev=h.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1},accids:{type:"array",itemType:"string"}},t),h.next=3,this.core.sendCmd("qchatGetExistingAccidsInServerRole",{serverId:t.serverId,roleId:t.roleId,accids:Ms(t.accids)});case 3:return i=h.sent,u=i.content.members,h.abrupt("return",u&&u.length>0?map$6(u).call(u,(function(t){return t.accid})):[]);case 6:case"end":return h.stop()}}),_callee20,this)})))},i.updateServerRolePriorities=function updateServerRolePriorities(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee21(){var i,u;return ms.wrap((function _callee21$(h){for(;;)switch(h.prev=h.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},serverRoles:{type:"array"}},t),h.next=3,this.core.sendCmd("qchatUpdateServerRolePriorities",{serverId:t.serverId,serverRoles:map$6(i=t.serverRoles).call(i,(function(t){return{serverId:t.serverId,roleId:t.roleId,priority:t.priority}}))});case 3:return u=h.sent,h.abrupt("return",formatRoles(u.content.serverRoles));case 5:case"end":return h.stop()}}),_callee21,this)})))},i.checkPermission=function checkPermission(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee22(){var i;return ms.wrap((function _callee22$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1,required:!1},auth:{type:"string"}},t),u.next=3,this.core.sendCmd("qchatCheckPermission",{checkPermissionTag:xt(xt({},t),{auth:Qd[t.auth]||t.auth})});case 3:return i=u.sent,u.abrupt("return",i.content.checked);case 5:case"end":return u.stop()}}),_callee22,this)})))},i.addChannelCategoryRole=function addChannelCategoryRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee23(){return ms.wrap((function _callee23$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.category.addChannelCategoryRole(t);case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),_callee23,this)})))},i.removeChannelCategoryRole=function removeChannelCategoryRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee24(){return ms.wrap((function _callee24$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.category.removeChannelCategoryRole(t);case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),_callee24,this)})))},i.updateChannelCategoryRole=function updateChannelCategoryRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee25(){return ms.wrap((function _callee25$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.category.updateChannelCategoryRole(t);case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),_callee25,this)})))},i.getChannelCategoryRole=function getChannelCategoryRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee26(){return ms.wrap((function _callee26$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.category.getChannelCategoryRole(t);case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),_callee26,this)})))},i.addChannelCategoryMemberRole=function addChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee27(){return ms.wrap((function _callee27$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.category.addChannelCategoryMemberRole(t);case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),_callee27,this)})))},i.removeChannelCategoryMemberRole=function removeChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee28(){return ms.wrap((function _callee28$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.category.removeChannelCategoryMemberRole(t);case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),_callee28,this)})))},i.updateChannelCategoryMemberRole=function updateChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee29(){return ms.wrap((function _callee29$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.category.updateChannelCategoryMemberRole(t);case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),_callee29,this)})))},i.getChannelCategoryMemberRole=function getChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee30(){return ms.wrap((function _callee30$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.category.getChannelCategoryMemberRole(t);case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}),_callee30,this)})))},i.checkPermissions=function checkPermissions(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee31(){var i,u,h,m;return ms.wrap((function _callee31$(v){for(;;)switch(v.prev=v.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1,required:!1},auths:{type:"array",itemType:"string"}},t),this.core.logger.log("qchatRole::checkPermission options is",t),v.next=4,this.core.sendCmd("qchatCheckPermissions",{checkPermissionsTag:xt(xt({},t),{auths:Ms(map$6(i=t.auths).call(i,(function(t){return Qd[t]||t})))})});case 4:return h=v.sent,this.core.logger.log("qchatRole::checkPermission result is",h.content),m={},forEach$1(u=h.content.checkPermissionsResult).call(u,(function(t){m[t.auth]=t.isAllow})),this.core.logger.log("qchatRole::checkPermission auths is",m),v.abrupt("return",formatRoleAuths(m));case 10:case"end":return v.stop()}}),_callee31,this)})))},QChatRoleService}(vd),Rp={"24_10":"qchatSendMsg","24_11":"qchatOnMsg","24_12":"qchatOnRecvUnreadInfo","24_13":"qchatSendCustomSysMsg","24_14":"qchatOnSysMsg","24_16":"qchatGetHistoryMsg","24_17":"qchatMarkMessageRead","24_18":"qchatMultiSyncMessageRead","24_22":"qchatUpdateSystemNotification","24_23":"qchatMultiSyncSystemNotificationUpdate","24_24":"qchatSyncSystemNotification","24_25":"qchatUpdateMessage","24_26":"qchatRecvMessageUpdate","24_28":"qchatMarkSysMsgRead","24_94":"qchatMessageSearchByPage","24_100":"qchatGetMessageHistoryByIds","24_101":"qchatGetThreadMessages","24_102":"qchatUpdateQuickComment","24_103":"qchatGetQuickComments","24_108":"qchatGetThreadRootMessagesMeta","24_121":"qchatGetLastMessageOfChannels","24_127":"qchatGetMentionedMeMessages","25_6":"qchatMultiSyncServersMessageRead"},Ap={getHistoryMsgTag:{serverId:1,channelId:2,beginTime:3,endTime:4,excludeMsgId:5,limit:6,reverse:7},getThreadHistoryMsgTag:{beginTime:1,endTime:2,excludeMsgId:3,limit:4,reverse:5},qchatMsgTag:{serverId:1,channelId:2,fromAccount:3,fromClientType:4,fromDeviceId:5,fromNick:6,time:7,updateTime:8,type:9,body:10,attach:11,ext:12,msgIdClient:13,msgIdServer:14,resendFlag:15,status:16,pushPayload:17,pushContent:18,mentionAccids:19,mentionAll:20,env:21,callbackExt:22,replyMsgFromAccount:23,replyMsgTime:24,replyMsgIdServer:25,replyMsgIdClient:26,threadMsgFromAccount:27,threadMsgTime:28,threadMsgIdServer:29,threadMsgIdClient:30,useCustomContent:31,antiSpamContent:32,antiSpamBusinessId:33,antiSpamUsingYidun:34,yidunCallback:35,yidunAntiCheating:36,yidunAntiSpamExt:37,yidunAntiSpamRes:38,mentionRoleIds:41,accidsOfMentionedRoles:42,updateContent:39,updateOperatorInfo:40,subType:61,historyEnable:100,pushEnable:101,needBadge:102,needPushNick:103,notifyReason:104,routeEnable:105,isAntispam:106},sysMsg:{toType:1,serverId:2,channelId:3,toAccids:4,fromAccount:5,fromClientType:6,fromDeviceId:7,fromNick:8,time:9,updateTime:10,type:11,msgIdClient:12,msgIdServer:13,body:14,attach:15,ext:16,resendFlag:17,status:18,pushPayload:19,pushContent:20,env:21,callbackExt:22,persistEnable:100,pushEnable:101,needBadge:102,needPushNick:103,routeEnable:104},qchatMsgUpdateTag:{operatorAccount:1,operatorClientType:2,ps:3,ext:4,pushContent:5,pushPayload:6,env:7,routeEnable:100},markMsgReadTag:{serverId:1,channelId:2,time:3},qchatQuickCommentRequestTag:{serverId:1,channelId:2,fromAccount:3,msgIdServer:4,time:5,type:6,opeType:7,opeAccid:8},qchatQuickCommentQueryTag:{serverId:1,channelId:2,msgIdServerList:3},qchatGetLastMessageOfChannelsTag:{serverId:1,channelIdList:2},qchatMultiSyncServersMessageReadTag:{successServerIds:1,failServerIds:2,ackTimestamp:3},qchatMessageSearchByPageTag:{keyword:1,serverId:2,channelId:3,fromAccid:4,fromTime:5,toTime:6,msgTypes:7,subTypes:8,includeSelf:9,order:10,limit:11,sort:12,cursor:13},qchatPageQueryTag:{hasMore:1,nextTimetag:2,cursor:3},unreadInfo:yd},Np=function getDeserializeTag(){return invertSerializeMap(Ap)},Op=function getCmdConfig(){var t=Np();return{qchatSendMsg:{service:"qchatMsg",sid:24,cid:10,params:[{type:"Property",name:"qchatMsg",reflectMapper:Ap.qchatMsgTag}],response:[{type:"Property",name:"qchatMsg",reflectMapper:t.qchatMsgTag}]},qchatOnMsg:{service:"qchatMsg",sid:24,cid:11,response:[{type:"Property",name:"qchatMsg",reflectMapper:t.qchatMsgTag}]},qchatOnRecvUnreadInfo:{service:"qchatMsg",sid:24,cid:12,response:[{type:"Property",name:"qchatMsg",reflectMapper:t.qchatMsgTag}]},qchatSendCustomSysMsg:{service:"qchatMsg",sid:24,cid:13,params:[{type:"Property",name:"sysMsg",reflectMapper:Ap.sysMsg}],response:[{type:"Property",name:"sysMsg",reflectMapper:t.sysMsg}]},qchatOnSysMsg:{service:"qchatMsg",sid:24,cid:14,response:[{type:"Property",name:"sysMsg",reflectMapper:t.sysMsg}]},qchatGetHistoryMsg:{service:"qchatMsg",sid:24,cid:16,params:[{type:"Property",name:"getHistoryMsgTag",reflectMapper:Ap.getHistoryMsgTag}],response:[{type:"PropertyArray",name:"qchatMsgs",reflectMapper:t.qchatMsgTag}]},qchatUpdateMessage:{service:"qchatMsg",sid:24,cid:25,params:[{type:"Property",name:"qchatMsgUpdateTag",reflectMapper:Ap.qchatMsgUpdateTag},{type:"Property",name:"qchatMsg",reflectMapper:Ap.qchatMsgTag}],response:[{type:"Property",name:"qchatMsg",reflectMapper:t.qchatMsgTag}]},qchatRecvMessageUpdate:{service:"qchatMsg",sid:24,cid:26,response:[{type:"Property",name:"qchatMsgUpdateInfo",reflectMapper:t.qchatMsgUpdateTag},{type:"Property",name:"qchatMsg",reflectMapper:t.qchatMsgTag}]},qchatMarkMessageRead:{sid:24,cid:17,service:"qchatMsg",params:[{type:"Property",name:"markMsgReadTag",reflectMapper:Ap.markMsgReadTag}],response:[{type:"Property",name:"unreadInfo",reflectMapper:t.unreadInfo}]},qchatMultiSyncMessageRead:{sid:24,cid:18,service:"qchatMsg",response:[{type:"Property",name:"unreadInfo",reflectMapper:t.unreadInfo}]},qchatUpdateSystemNotification:{service:"qchatMsg",sid:24,cid:22,params:[{type:"Property",name:"qchatMsgUpdateTag",reflectMapper:Ap.qchatMsgUpdateTag},{type:"Property",name:"sysMsg",reflectMapper:Ap.sysMsg}],response:[{type:"Property",name:"sysMsg",reflectMapper:t.sysMsg}]},qchatMultiSyncSystemNotificationUpdate:{service:"qchatMsg",sid:24,cid:23,response:[{type:"Property",name:"qchatMsgUpdateTag",reflectMapper:t.qchatMsgUpdateTag},{type:"Property",name:"sysMsg",reflectMapper:t.sysMsg}]},qchatSyncSystemNotification:{service:"qchatMsg",sid:24,cid:24,response:[{type:"PropertyArray",name:"systemNotifications",reflectMapper:t.sysMsg}]},qchatMarkSysMsgRead:{service:"qchatMsg",sid:24,cid:28,params:[{type:"PropertyArray",name:"sysMsgs",reflectMapper:Ap.sysMsg}]},qchatMessageSearchByPage:{service:"qchatMsg",sid:24,cid:94,params:[{type:"Property",name:"qchatMessageSearchByPageTag",reflectMapper:Ap.qchatMessageSearchByPageTag}],response:[{type:"Property",name:"listQueryTag",reflectMapper:t.qchatPageQueryTag},{type:"PropertyArray",name:"datas",reflectMapper:t.qchatMsgTag}]},qchatGetMessageHistoryByIds:{service:"qchatMsg",sid:24,cid:100,params:[{type:"Property",name:"channelInfo",reflectMapper:{serverId:1,channelId:2}},{type:"PropertyArray",name:"messageReferList",reflectMapper:{msgIdServer:1,time:2}}],response:[{type:"PropertyArray",name:"qchatMsgs",reflectMapper:t.qchatMsgTag}]},qchatGetThreadMessages:{service:"qchatMsg",sid:24,cid:101,params:[{type:"Property",name:"qchatMsg",reflectMapper:Ap.qchatMsgTag},{type:"Property",name:"getThreadHistoryMsgTag",reflectMapper:Ap.getThreadHistoryMsgTag}],response:[{type:"Property",name:"thread",reflectMapper:t.qchatMsgTag},{type:"Property",name:"threadInfo",reflectMapper:{1:"messageCount",2:"lastMessageTimestamp"}},{type:"PropertyArray",name:"qchatMsgs",reflectMapper:t.qchatMsgTag}]},qchatUpdateQuickComment:{service:"qchatMsg",sid:24,cid:102,params:[{type:"Property",name:"tag",reflectMapper:Ap.qchatQuickCommentRequestTag}]},qchatGetQuickComments:{service:"qchatMsg",sid:24,cid:103,params:[{type:"Property",name:"tag",reflectMapper:Ap.qchatQuickCommentQueryTag}],response:[{type:"PropertyArray",name:"quickCommentResponse",reflectMapper:{1:"serverId",2:"channelId",3:"msgIdServer",4:"totalCount",5:"lastUpdateTime",6:"details"}}]},qchatGetThreadRootMessagesMeta:{service:"qchatMsg",sid:24,cid:108,params:[{type:"Property",name:"tag",reflectMapper:{serverId:1,channelId:2}},{type:"PropertyArray",name:"qchatMsgs",reflectMapper:{time:7,msgIdServer:14}}],response:[{type:"PropertyArray",name:"metas",reflectMapper:{1:"total",2:"timestamp",3:"msgIdServer",4:"msgTime"}}]},qchatGetLastMessageOfChannels:{service:"qchatMsg",sid:24,cid:121,params:[{type:"Property",name:"tag",reflectMapper:Ap.qchatGetLastMessageOfChannelsTag}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:t.qchatMsgTag}]},qchatMultiSyncServersMessageRead:{service:"qchatMsg",sid:25,cid:6,response:[{type:"Property",name:"qchatMultiSyncServersMessageReadTag",reflectMapper:t.qchatMultiSyncServersMessageReadTag}]},qchatGetMentionedMeMessages:{service:"qchatMsg",sid:24,cid:127,params:[{type:"Property",name:"tag",reflectMapper:{serverId:1,channelId:2,timestamp:3,limit:4}}],response:[{type:"Property",name:"page",reflectMapper:t.qchatPageQueryTag},{type:"PropertyArray",name:"datas",reflectMapper:t.qchatMsgTag}]}}};function pick(t,i){t=t||{};var u={};return forEach$1(i=i||[]).call(i,(function(i){void 0!==t[i]&&(u[i]=t[i])})),u}!function(t){t[t.Android=1]="Android",t[t.iOS=2]="iOS",t[t.PC=4]="PC",t[t.WindowsPhone=8]="WindowsPhone",t[t.Web=16]="Web",t[t.Server=32]="Server",t[t.Mac=64]="Mac",t[t.HarmonyOS=65]="HarmonyOS"}(_p||(_p={}));var wp=["image","audio","video","file"],xp={time:{type:"number"},updateTime:{type:"number"},resendFlag:{type:"boolean"},persistEnable:{type:"boolean"},routeEnable:{type:"boolean"},pushEnable:{type:"boolean"},needBadge:{type:"boolean"},needPushNick:{type:"boolean"},type:{type:"enum",values:up},fromClientType:{type:"enum",values:_p},status:{type:"number"},toAccids:{type:"object"},toType:{type:"number"},attach:{type:"object"},pushPayload:{type:"object"}};function generatorSysMsgForCmd(t,i){var u=xt({},t),h=xt({type:i||up.custom},formatReverse(xp,u));return h.serverId&&h.channelId&&h.toAccids?h.toType=4:h.serverId&&h.toAccids?h.toType=3:h.serverId&&h.channelId?h.toType=2:h.serverId?h.toType=1:h.toAccids?h.toType=5:h.toType=0,h}function generatorSysMsgMarkersForCmd(t){var i=pick(t,["msgIdServer","type"]);return formatReverse(xp,i)}var kp=((yp={})[up.channelUpdateWhiteBlackIdentify]=function(t){var i=Id();return t.notify=formatUpdateWhiteBlackRole(deserialize(t.notify,i.qchatUpdateWhiteBlackRoleTag)),t},yp[up.channelUpdateWhiteBlackIdentifyUser]=function(t){var i=Id();return t.notify=function formatUpdateWhiteBlackMembers(t){return format(Fd,t)}(deserialize(t.notify,i.qchatUpdateWhiteBlackMembersTag)),t},yp[up.updateQuickComment]=function(t){var i=Np();return t.notify=function formatQuickCommentRequest(t){return format(Dp,t)}(deserialize(t.notify,i.qchatQuickCommentRequestTag)),t},yp[up.channelCategoryCreate]=function(t){var i=Id();return t.categoryInfo=formatChannelCategory(deserialize(t.categoryInfo,i.QChatChannelCategoryInfo)),t},yp[up.channelCategoryUpdate]=function(t){var i=Id();return t.categoryInfo=formatChannelCategory(deserialize(t.categoryInfo,i.QChatChannelCategoryInfo)),t},yp[up.channelCategoryUpdateWhiteBlackIdentify]=function(t){var i=Id();return t.notify=formatUpdateWhiteBlackRole(deserialize(t.notify,i.qchatUpdateChannelCategoryWhiteBlackRoleTag)),t},yp[up.channelCategoryUpdateWhiteBlackIdentifyUser]=function(t){var i=Id();return t.notify=formatUpdateWhiteBlackRole(deserialize(t.notify,i.qchatUpdateChannelCategoryWhiteBlackMembersTag)),t},yp[up.serverIdentifyAdd]=function(t){var i=Sp();return t.serverIdentifyInfo=formatRole(deserialize(t.serverIdentifyInfo,i.serverRole)),t},yp[up.serverIdentifyRemove]=function(t){var i=Sp();return t.serverIdentifyInfo=formatRole(deserialize(t.serverIdentifyInfo,i.serverRole)),t},yp[up.serverIdentifyUpdate]=function(t){var i=Sp();return t.serverIdentifyInfo=formatRole(deserialize(t.serverIdentifyInfo,i.serverRole)),t},yp[up.channelIdentifyUpdate]=function(t){var i=Sp();return t.channelIdentifyInfo=formatRole(deserialize(t.channelIdentifyInfo,i.channelRole)),t},yp[up.userIdentifyUpdate]=function(t){var i=Sp();return t.userIdentifyInfo=formatRole(deserialize(t.userIdentifyInfo,i.memberRole)),t},yp[up.myMemberInfoUpdated]=function(t){var i,u=get(t,"userInfo.name"),h=get(t,"userInfo.icon");return t.updatedInfos=map$6(i=t.reuseServers).call(i,(function(t){var i={serverId:t.serverId};return 1==(1&t.bits)&&"string"==typeof u&&xt(i,{nickChanged:!0,nick:u}),2==(2&t.bits)&&"string"==typeof h&&xt(i,{avatarChanged:!0,avatar:h}),i})),delete t.userInfo,delete t.reuseServers,t},yp);function formatSystemNotification(t,i){var u=format(xp,t);if(!u.attach)return u;var h=Cd(),m=Id();if(u.attach.serverInfo&&(u.attach.serverInfo=formatServer(deserialize(u.attach.serverInfo,h.serverInfo))),u.attach.channelInfo&&(u.attach.channelInfo=formatChannel(deserialize(u.attach.channelInfo,m.channelInfo))),u.attach.serverMember&&(u.attach.serverMember=formatMember$1(deserialize(u.attach.serverMember,h.memberInfo))),kp[u.attach.type]&&(u.attach=kp[u.attach.type](u.attach)),u.attach.updateAuths)try{u.attach.updateAuths=formatRoleAuths(JSON.parse(u.attach.updateAuths))}catch(t){i.error("formatSystemNotification:JSON parse updateAuths error: ",t)}return u.attach.type&&(u.attach.rawType=u.attach.type,u.attach.type=up[u.attach.type]),u}var Pp={type:{type:"enum",values:ip},fromClientType:{type:"enum",values:_p},status:{type:"number"},resendFlag:{type:"boolean"},mentionAll:{type:"boolean"},notifyReason:{type:"enum",values:cp},pushEnable:{type:"boolean"},historyEnable:{type:"boolean"},needBadge:{type:"boolean"},needPushNick:{type:"boolean"},routeEnable:{type:"boolean"},time:{type:"number"},updateTime:{type:"number"},mentionAccids:{type:"object"},mentionRoleIds:{type:"object"},accidsOfMentionedRoles:{type:"object"},attach:{type:"object"},pushPayload:{type:"object"},isAntispam:{type:"boolean"},antiSpamInfo:{useCustomContent:{type:"boolean"},antiSpamContent:{type:"string"},antiSpamBusinessId:{type:"string"},antiSpamUsingYidun:{type:"boolean"},yidunCallback:{type:"string"},yidunAntiCheating:{type:"object"},yidunAntiSpamExt:{type:"object"},yidunAntiSpamRes:{type:"string"}},replyRefer:{fromAccount:{type:"string",rawKey:"replyMsgFromAccount"},time:{type:"number",rawKey:"replyMsgTime"},msgIdServer:{type:"string",rawKey:"replyMsgIdServer"},msgIdClient:{type:"string",rawKey:"replyMsgIdClient"}},threadRefer:{fromAccount:{type:"string",rawKey:"threadMsgFromAccount"},time:{type:"number",rawKey:"threadMsgTime"},msgIdServer:{type:"string",rawKey:"threadMsgIdServer"},msgIdClient:{type:"string",rawKey:"threadMsgIdClient"}}};function generatorMsgForCmd(t){t.onSendBefore,t.onUploadStart,t.onUploadDone,t.onUploadProgress;var i=__rest(t,["onSendBefore","onUploadStart","onUploadDone","onUploadProgress"]),u=formatReverse(Pp,i);if(u.msgIdClient=t.resendFlag?t.msgIdClient:lu(),!u.msgIdClient)throw new zl("msgIdClient is required for resend a message","msgIdClient","required");return t.replyMessage&&t.replyMessage.msgIdServer&&(u.replyMsgFromAccount=t.replyMessage.fromAccount,u.replyMsgTime=+t.replyMessage.time,u.replyMsgIdServer=t.replyMessage.msgIdServer,u.replyMsgIdClient=t.replyMessage.msgIdClient,t.replyMessage.threadRefer&&t.replyMessage.threadRefer.msgIdServer?(u.threadMsgFromAccount=t.replyMessage.threadRefer.fromAccount,u.threadMsgTime=+t.replyMessage.threadRefer.time,u.threadMsgIdServer=t.replyMessage.threadRefer.msgIdServer,u.threadMsgIdClient=t.replyMessage.threadRefer.msgIdClient):(u.threadMsgFromAccount=t.replyMessage.fromAccount,u.threadMsgTime=+t.replyMessage.time,u.threadMsgIdServer=t.replyMessage.msgIdServer,u.threadMsgIdClient=t.replyMessage.msgIdClient),delete u.replyMessage),u}function formatMsgOperatorInfo(t){return format({operatorClientType:{type:"enum",values:_p},pushPayload:{type:"object"}},t)}function formatMsg(t,i,u){var h,m;return void 0===i&&(i={}),__awaiter(this,void 0,void 0,ms.mark((function _callee(){var v,E,I,M;return ms.wrap((function _callee$(S){for(;;)switch(S.prev=S.next){case 0:return(v=format(Pp,t)).deliveryStatus=i.deliveryStatus?sp[i.deliveryStatus]:sp[sp.success],i.time&&(v.time=i.time),E=Np(),v.updateContent&&(I=format({status:{type:"number"}},I=deserialize(I=JSON.parse(v.updateContent),E.qchatMsgTag)),v.updateContent=I),v.updateOperatorInfo&&(M=formatMsgOperatorInfo(deserialize(M=JSON.parse(v.updateOperatorInfo),E.qchatMsgUpdateTag)),v.updateOperatorInfo=M),""===(null===(h=null==v?void 0:v.threadRefer)||void 0===h?void 0:h.fromAccount)&&delete v.threadRefer,""===(null===(m=null==v?void 0:v.replyRefer)||void 0===m?void 0:m.fromAccount)&&delete v.replyRefer,v.attach&&i.attachUrl&&(v.attach.url=i.attachUrl),S.next=11,formatMsgAttach(v,u);case 11:return S.abrupt("return",S.sent);case 12:case"end":return S.stop()}}),_callee)})))}function formatMsgAttach(t,i){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var u;return ms.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:if(includes(wp).call(wp,t.type)&&t.attach&&t.attach.url){h.next=2;break}return h.abrupt("return",t);case 2:if(i&&i.cloudStorage&&"function"==typeof i.cloudStorage.getPrivateUrl&&"function"==typeof i.cloudStorage.getOriginUrl){h.next=4;break}return h.abrupt("return",t);case 4:if(!(indexOf(u=t.attach.url).call(u,"_im_url=1")<0)){h.next=7;break}return t.attach.url=i.cloudStorage.getPrivateUrl(t.attach.url),h.abrupt("return",t);case 7:return h.prev=7,h.next=10,i.cloudStorage.getOriginUrl(t.attach.url);case 10:t.attach.url=h.sent,h.next=16;break;case 13:throw h.prev=13,h.t0=h.catch(7),new zl('url "'+t.attach.url+'" parse error',"message.attach.url","parse error");case 16:return h.abrupt("return",t);case 17:case"end":return h.stop()}}),_callee2,null,[[7,13]])})))}function formatMsgs(t,i,u){return void 0===i&&(i={}),__awaiter(this,void 0,void 0,ms.mark((function _callee3(){var h;return ms.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:if(Qs(t)&&t.length>0){m.next=2;break}return m.abrupt("return",[]);case 2:return h=map$6(t).call(t,(function(t){return formatMsg(t,i,u)})),m.next=5,Ja.all(h);case 5:return m.abrupt("return",m.sent);case 6:case"end":return m.stop()}}),_callee3)})))}var Lp={totalCount:{type:"number"},lastUpdateTime:{type:"number"},details:{type:"object"}};function formatQuickComments(t){var i=map$6(t).call(t,(function(t){var i,u=format(Lp,t);return u.details=map$6(i=u.details).call(i,(function(t){var i=t.createTime?su(t.createTime):0;return i=isNaN(i)?0:i,{count:t.count,hasSelf:t.self,severalAccids:t.topN,type:t.type,createTime:i}})),u})),u={};return forEach$1(i).call(i,(function(t){return u[t.msgIdServer]=t})),u}var Dp={type:{type:"number"},time:{type:"number"},opeType:{type:"number"}};var qp={includeSelf:{type:"number"},order:{type:"enum",values:pd},sort:{type:"enum",values:op},msgTypes:{type:"object"},subTypes:{type:"object"}};var Vp={hasMore:{type:"boolean"},nextTimetag:{type:"number"},cursor:{type:"string"}};var Up={6:function _(t){return this.core.qchatChannel.subscribeForVisitorService.deleteAutoSetInServerId(t.serverId),!0},16:function _(t){return this.core.qchatChannel.subscribeForVisitorService.deleteAutoSetInChannel(t.serverId,t.channelId),!0},26:function _(t){var i=get(t,"attach.addAccids");return i&&includes(i).call(i,this.core.account)&&this.core.eventBus.emit("qchatChannel/serverIdentifyChange",t),!0},27:function _(t){var i=get(t,"attach.deleteAccids");return i&&includes(i).call(i,this.core.account)&&this.core.eventBus.emit("qchatChannel/serverIdentifyChange",t),!0},31:function _(t){var i,u;return 1===t.attach.event?(null===(u=null===(i=this.core.qchatChannel)||void 0===i?void 0:i.config)||void 0===u?void 0:u.autoSubscribe)&&this.core.qchatChannel.subscribeChannel({type:1,opeType:1,channels:[{serverId:t.serverId,channelId:t.channelId}],isInternalTrigger:!0}):2===t.attach.event&&(this.core.eventBus.emit("qchatChannel/autoUnSubscribe",t),this.core.eventBus.emit("qchatMedia/serverOrChannelLeave",t)),!0},32:function _(t){var i,u;return 2===t.attach.event?(this.core.eventBus.emit("qchatChannel/autoUnSubscribe",t),this.core.eventBus.emit("qchatMedia/serverOrChannelLeave",t)):1===t.attach.event&&(this.core.qchatChannel.subscribeForVisitorService.deleteServer(t.serverId),(null===(u=null===(i=this.core.qchatChannel)||void 0===i?void 0:i.config)||void 0===u?void 0:u.autoSubscribe)&&this.core.qchatServer.subscribeServer({type:4,opeType:1,servers:[{serverId:t.serverId}],isInternalTrigger:!0})),!0},34:function _(t){return 2===t.attach.event&&this.core.qchatChannel.subscribeForVisitorService.unSubscribeChannel(t.serverId,t.channelId),!0},101:function _(t){var i=pick(t,["serverId","channelId","ext","fromAccount","fromNick","time"]);return this.logger.log("qchat on recvTypingEvent: ",i),this.core.emit("recvTypingEvent",i),this.core.qchatMsg.emit("recvTypingEvent",i),!1}},Gp=function(){function NotificationModuleService(t){this.core=t,this.logger=t.logger}var t=NotificationModuleService.prototype;return t.sendSystemNotification=function sendSystemNotification(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i,u;return ms.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.core.sendCmd("qchatSendCustomSysMsg",{sysMsg:generatorSysMsgForCmd(t)});case 2:return i=h.sent,u=formatSystemNotification(i.content.sysMsg,this.logger),this.logger.getDebugMode()?this.logger.debug("sendCustomSysMsg success",u):this.logger.log("sendCustomSysMsg success",u.serverId,u.channelId,u.msgIdServer),h.abrupt("return",u);case 6:case"end":return h.stop()}}),_callee,this)})))},t.updateSystemNotification=function updateSystemNotification(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var i,u,h,m,v;return ms.wrap((function _callee2$(E){for(;;)switch(E.prev=E.next){case 0:return i=t.systemNotification,u=__rest(t,["systemNotification"]),h=pick(i,["msgIdServer","type","body","ext","status"]),m=generatorSysMsgForCmd(h),E.next=5,this.core.sendCmd("qchatUpdateSystemNotification",{sysMsg:m,qchatMsgUpdateTag:xt(xt({},u),{operatorAccount:this.core.account,operatorClientType:_p.Web,pushPayload:Ms(t.pushPayload),routeEnable:Nd.boolean(t,"routeEnable")})});case 5:return v=E.sent,E.abrupt("return",formatSystemNotification(v.content.sysMsg,this.logger));case 7:case"end":return E.stop()}}),_callee2,this)})))},t.markSystemNotificationsRead=function markSystemNotificationsRead(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var i;return ms.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.core.sendCmd("qchatMarkSysMsgRead",{sysMsgs:map$6(i=t.systemNotifications).call(i,(function(t){return generatorSysMsgMarkersForCmd(t)}))});case 2:case"end":return u.stop()}}),_callee3,this)})))},t.onSysMsg=function onSysMsg(t){var i=t.content.sysMsg;if(i){var u=formatSystemNotification(i,this.core.logger),h=Up[up[u.type]];if(h)if(!1===h.call(this,u))return;var m={feature:"default",systemNotifications:[u]};this.logger.log("qchat on systemNotification: ",m),this.core.emit("systemNotification",m),this.core.qchatMsg.emit("systemNotification",m)}else this.core.logger.warn("No sysMsg in onSysMsg packet")},t.onMultiSysMsg=function onMultiSysMsg(t){var i=t.content.sysMsg;if(i){var u=formatSystemNotification(i,this.logger);this.core.emit("systemNotificationUpdate",u),this.core.qchatMsg.emit("systemNotificationUpdate",u)}},t.onSyncSysMsg=function onSyncSysMsg(t){var i=this,u=t.content.systemNotifications;if(u&&u.length>0){var h=map$6(u).call(u,(function(t){return formatSystemNotification(t,i.logger)}));this.core.emit("systemNotification",{feature:"sync",systemNotifications:h}),this.core.qchatMsg.emit("systemNotification",{feature:"sync",systemNotifications:h})}else this.logger.warn("sync system notification not exist")},NotificationModuleService}(),Fp=["image","audio","video","file"],Bp=function(){function MessageModuleService(t){var i=this;this.markMessageRead=throttle((function(t){return __awaiter(i,void 0,void 0,ms.mark((function _callee(){var i,u;return ms.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.core.sendCmd("qchatMarkMessageRead",{markMsgReadTag:t});case 2:i=h.sent,u=formatUnreadInfo(i.content.unreadInfo),this.core.eventBus.emit("qchatChannel/updateUnreads",[u]);case 5:case"end":return h.stop()}}),_callee,this)})))}),200),this.core=t,this.logger=t.logger}var t=MessageModuleService.prototype;return t.sendMessage=function sendMessage(t){var i,u,h,m;return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var v,E,I,M,S,T;return ms.wrap((function _callee2$(C){for(;;)switch(C.prev=C.next){case 0:if(!(indexOf(Fp).call(Fp,t.type)>-1)){C.next=4;break}return C.next=3,this.doSendFile(t);case 3:t.attach=C.sent;case 4:return v=generatorMsgForCmd(xt({fromAccount:this.core.account},t)),C.next=7,formatMsg(v,{time:(new Date).getTime(),deliveryStatus:sp.sending},this.core);case 7:E=C.sent;try{t.onSendBefore&&t.onSendBefore(E)}catch(t){this.logger.error("sendMsg: options.onSendBefore error",t)}return C.prev=9,C.next=12,this.core.sendCmd("qchatSendMsg",{qchatMsg:v});case 12:I=C.sent,C.next=22;break;case 15:return C.prev=15,C.t0=C.catch(9),C.next=19,formatMsg(v,{time:(new Date).getTime(),deliveryStatus:sp.failed,attachUrl:null===(i=E.attach)||void 0===i?void 0:i.url},this.core);case 19:throw M=C.sent,C.t0.msg=M,C.t0;case 22:return S=I.content,C.next=25,formatMsg(xt({},S.qchatMsg),{deliveryStatus:sp.success,attachUrl:null===(u=E.attach)||void 0===u?void 0:u.url},this.core);case 25:if(!(T=C.sent).isAntispam){C.next=29;break}throw{code:10403,msg:T,message:(null===(h=null==T?void 0:T.antiSpamInfo)||void 0===h?void 0:h.yidunAntiSpamRes)||"message has be antispam",isAntispam:!0,yidunAntiSpamRes:(null===(m=null==T?void 0:T.antiSpamInfo)||void 0===m?void 0:m.yidunAntiSpamRes)||""};case 29:return C.abrupt("return",T);case 30:case"end":return C.stop()}}),_callee2,this,[[9,15]])})))},t.doSendFile=function doSendFile(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var i;return ms.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:if(validate({type:{type:"enum",values:["image","audio","video","file"]},attach:{type:"object",rules:{url:{type:"string",allowEmpty:!1}},required:!1},maxSize:{type:"number",min:1,required:!1}},t),i=t.attach){u.next=15;break}if(this.core.cloudStorage&&this.core.cloudStorage.uploadFile){u.next=5;break}throw new Error('Service "cloudStorage" does not exist');case 5:return u.prev=5,u.next=8,this.core.cloudStorage.uploadFile(t);case 8:i=u.sent,u.next=15;break;case 11:throw u.prev=11,u.t0=u.catch(5),this.logger.error("sendFile:: upload File error or abort.",u.t0),u.t0;case 15:return u.abrupt("return",i);case 16:case"end":return u.stop()}}),_callee3,this,[[5,11]])})))},t.resendMessage=function resendMessage(t){var i,u;return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var h,m,v,E,I;return ms.wrap((function _callee4$(M){for(;;)switch(M.prev=M.next){case 0:return(h=generatorMsgForCmd(xt(xt({},t),{resendFlag:!0}))).deliveryStatus=sp.sending,M.prev=2,M.next=5,this.core.sendCmd("qchatSendMsg",{qchatMsg:h});case 5:m=M.sent,M.next=15;break;case 8:return M.prev=8,M.t0=M.catch(2),M.next=12,formatMsg(h,{time:(new Date).getTime(),deliveryStatus:sp.failed},this.core);case 12:throw v=M.sent,M.t0.msg=v,M.t0;case 15:return E=m.content,M.next=18,formatMsg(xt({},E.qchatMsg),{deliveryStatus:sp.success},this.core);case 18:if(!(I=M.sent).isAntispam){M.next=22;break}throw{code:10403,msg:I,message:(null===(i=null==I?void 0:I.antiSpamInfo)||void 0===i?void 0:i.yidunAntiSpamRes)||"message has be antispam",isAntispam:!0,yidunAntiSpamRes:(null===(u=null==I?void 0:I.antiSpamInfo)||void 0===u?void 0:u.yidunAntiSpamRes)||""};case 22:return M.abrupt("return",I);case 23:case"end":return M.stop()}}),_callee4,this,[[2,8]])})))},t.doUpdateMessage=function doUpdateMessage(t){var i,u;return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var h,m,v,E,I;return ms.wrap((function _callee5$(M){for(;;)switch(M.prev=M.next){case 0:return h=t.message,m=__rest(t,["message"]),(v=generatorMsgForCmd(h)).msgIdClient=void 0,v.time=h.time,M.next=6,this.core.sendCmd("qchatUpdateMessage",{qchatMsg:v,qchatMsgUpdateTag:xt(xt({},m),{operatorAccount:this.core.account,operatorClientType:_p.Web,pushPayload:Ms(t.pushPayload),routeEnable:Nd.boolean(t,"routeEnable")})});case 6:return E=M.sent,M.next=9,formatMsg(E.content.qchatMsg,{},this.core);case 9:if(I=M.sent,this.core.eventBus.emit("qchatChannel/changeUnread",I,!0),!E.content.qchatMsg.isAntispam){M.next=14;break}throw{code:10403,msg:v,message:(null===(i=E.content.qchatMsg)||void 0===i?void 0:i.yidunAntiSpamRes)||"message has be antispam",isAntispam:!0,yidunAntiSpamRes:(null===(u=E.content.qchatMsg)||void 0===u?void 0:u.yidunAntiSpamRes)||""};case 14:return M.abrupt("return",I);case 15:case"end":return M.stop()}}),_callee5,this)})))},t.getHistoryMessage=function getHistoryMessage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee6(){var i,u,h,m=this;return ms.wrap((function _callee6$(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,this.core.sendCmd("qchatGetHistoryMsg",{getHistoryMsgTag:xt(xt({},t),{reverse:reverse(t)?1:0})});case 2:return u=v.sent,h=u.content,v.next=6,Ja.all(map$6(i=h.qchatMsgs).call(i,(function(t){return formatMsg(t,{},m.core)})));case 6:return v.abrupt("return",v.sent);case 7:case"end":return v.stop()}}),_callee6,this)})))},t.getMentionedMeMessages=function getMentionedMeMessages(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee7(){var i,u,h,m,v,E=this;return ms.wrap((function _callee7$(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,this.core.sendCmd("qchatGetMentionedMeMessages",{tag:t});case 2:return u=I.sent,h=u.content,M=h.page,m=format(Vp,M),I.next=7,Ja.all(map$6(i=h.datas).call(i,(function(t){return formatMsg(t,{},E.core)})));case 7:return v=I.sent,I.abrupt("return",{pageInfo:m,messages:v});case 9:case"end":return I.stop()}var M}),_callee7,this)})))},t.areMentionedMeMessages=function areMentionedMeMessages(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee8(){var i,u,h;return ms.wrap((function _callee8$(m){for(;;)switch(m.prev=m.next){case 0:i={},u=0;case 2:if(!(u<t.length)){m.next=13;break}if((h=t[u]).fromAccount!==this.core.account){m.next=7;break}return i[h.msgIdClient]=!1,m.abrupt("continue",10);case 7:return m.next=9,this.core.qchatChannel.subscribeModuleService.getMentionedFlag(h,!0);case 9:i[h.msgIdClient]=m.sent;case 10:u++,m.next=2;break;case 13:return m.abrupt("return",i);case 14:case"end":return m.stop()}}),_callee8,this)})))},t.getLastMessageOfChannels=function getLastMessageOfChannels(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee9(){var i,u,h;return ms.wrap((function _callee9$(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.core.sendCmd("qchatGetLastMessageOfChannels",{tag:t});case 2:return i=m.sent,u=i.content.msgs,m.next=6,formatMsgs(u,{},this.core);case 6:return h=m.sent,m.abrupt("return",reduce(h).call(h,(function(t,i){return t[i.channelId]=i,t}),{}));case 8:case"end":return m.stop()}}),_callee9,this)})))},t.messageSearchByPage=function messageSearchByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee10(){var i,u,h,m,v;return ms.wrap((function _callee10$(E){for(;;)switch(E.prev=E.next){case 0:return E.next=2,this.core.sendCmd("qchatMessageSearchByPage",{qchatMessageSearchByPageTag:xt(xt({},(I=t,formatReverse(qp,I))),{includeSelf:t.includeSelf?1:""})});case 2:return i=E.sent,u=i.content,h=u.datas,m=u.listQueryTag,E.next=6,formatMsgs(h,{},this.core);case 6:return v=E.sent,E.abrupt("return",{listQueryTag:{hasMore:1==+m.hasMore,nextTimetag:m.nextTimetag?su(m.nextTimetag):0,cursor:m.cursor},datas:v});case 8:case"end":return E.stop()}var I}),_callee10,this)})))},t.onMsg=function onMsg(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee11(){var i,u;return ms.wrap((function _callee11$(h){for(;;)switch(h.prev=h.next){case 0:if(i=t.content.qchatMsg){h.next=4;break}return this.logger.warn("No qchatMsg in qchatMsg packet"),h.abrupt("return");case 4:return h.next=6,formatMsg(i,{},this.core);case 6:u=h.sent,this.core.eventBus.emit("qchatChannel/changeUnread",u,!1),this.core.emit("message",u),this.core.qchatMsg.emit("message",u);case 10:case"end":return h.stop()}}),_callee11,this)})))},t.onRecvUnreadInfo=function onRecvUnreadInfo(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee12(){var i,u;return ms.wrap((function _callee12$(h){for(;;)switch(h.prev=h.next){case 0:if(i=t.content.qchatMsg){h.next=3;break}return h.abrupt("return");case 3:return h.next=5,formatMsg(i);case 5:u=h.sent,this.core.eventBus.emit("qchatChannel/changeUnread",u,!1);case 7:case"end":return h.stop()}}),_callee12,this)})))},t.onMultiSyncRead=function onMultiSyncRead(t){var i=t.content.unreadInfo;if(i){var u=formatUnreadInfo(i);this.core.eventBus.emit("qchatChannel/updateUnreads",[u])}},t.onMultiSyncServersRead=function onMultiSyncServersRead(t){var i=t.content.qchatMultiSyncServersMessageReadTag;if(i){var u=formatClearServersUnread(i),h=u.successServerIds,m=u.ackTimestamp;this.core.eventBus.emit("qchatChannel/clearUnreadCountByServers",h,m)}},t.onRecvMsgUpdate=function onRecvMsgUpdate(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee13(){var i,u,h,m;return ms.wrap((function _callee13$(v){for(;;)switch(v.prev=v.next){case 0:if(i=t.content.qchatMsg,u=t.content.qchatMsgUpdateInfo,i){v.next=4;break}return v.abrupt("return");case 4:return v.next=6,formatMsg(i,{},this.core);case 6:h=v.sent,m=formatMsgOperatorInfo(u),this.core.eventBus.emit("qchatChannel/changeUnread",h,!0),this.core.emit("messageUpdate",h,m),this.core.qchatMsg.emit("messageUpdate",h,m);case 11:case"end":return v.stop()}}),_callee13,this)})))},MessageModuleService}(),jp=function(){function ExtendModuleService(t){var i=this;this._sendTypingEvent=throttle((function(t){return __awaiter(i,void 0,void 0,ms.mark((function _callee(){return ms.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.core.sendCmd("qchatSendCustomSysMsg",{sysMsg:generatorSysMsgForCmd(xt(xt({},t),{resendFlag:!1,persistEnable:!1,routeEnable:!1,pushEnable:!1,needBadge:!1,needPushNick:!1}),up.msgTyping)});case 2:case"end":return i.stop()}}),_callee,this)})))}),3e3),this.core=t,this.logger=t.logger,this.lastChannelIdInTyping=""}var t=ExtendModuleService.prototype;return t.getMessageHistoryByIds=function getMessageHistoryByIds(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var i,u;return ms.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.core.sendCmd("qchatGetMessageHistoryByIds",{channelInfo:{serverId:t.serverId,channelId:t.channelId},messageReferList:t.messageReferList});case 2:return u=h.sent,h.abrupt("return",Ja.all(map$6(i=u.content.qchatMsgs).call(i,(function(t){return formatMsg(t)}))));case 4:case"end":return h.stop()}}),_callee2,this)})))},t.getReferMessages=function getReferMessages(t){var i,u;return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var h;return ms.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:if((null===(i=t.message.replyRefer)||void 0===i?void 0:i.msgIdServer)&&(null===(u=t.message.threadRefer)||void 0===u?void 0:u.msgIdServer)){m.next=2;break}throw new Error("Message has no reply");case 2:return m.next=4,this.getMessageHistoryByIds({serverId:t.message.serverId,channelId:t.message.channelId,messageReferList:[t.message.replyRefer,t.message.threadRefer]});case 4:if(h=m.sent,t.referType!==dp[dp.all]){m.next=9;break}return m.abrupt("return",{replyMessage:h[0],threadMessage:h[1]});case 9:if(t.referType!==dp[dp.reply]){m.next=13;break}return m.abrupt("return",{replyMessage:h[0]});case 13:if(t.referType!==dp[dp.thread]){m.next=15;break}return m.abrupt("return",{threadMessage:h[1]});case 15:return m.abrupt("return",{replyMessage:h[0],threadMessage:h[1]});case 16:case"end":return m.stop()}}),_callee3,this)})))},t.getThreadMessages=function getThreadMessages(t){var i;return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var u,h,m,v,E;return ms.wrap((function _callee4$(I){for(;;)switch(I.prev=I.next){case 0:return h=(null===(i=t.message.threadRefer)||void 0===i?void 0:i.msgIdServer)?xt({serverId:t.message.serverId,channelId:t.message.channelId},t.message.threadRefer):t.message,I.next=3,this.core.sendCmd("qchatGetThreadMessages",{qchatMsg:h,getThreadHistoryMsgTag:xt(xt({},t.messageQueryOption),{reverse:Nd.boolean(t.messageQueryOption,"reverse")})});case 3:return m=I.sent,I.next=6,formatMsg(m.content.thread);case 6:return v=I.sent,I.next=9,Ja.all(map$6(u=m.content.qchatMsgs).call(u,(function(t){return formatMsg(t)})));case 9:return E=I.sent,I.abrupt("return",{thread:v,threadInfo:{messageCount:+m.content.threadInfo.messageCount,lastMessageTimestamp:+m.content.threadInfo.lastMessageTimestamp},messages:E});case 11:case"end":return I.stop()}}),_callee4,this)})))},t.getThreadRootMessagesMeta=function getThreadRootMessagesMeta(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var i,u,h,m;return ms.wrap((function _callee5$(v){for(;;)switch(v.prev=v.next){case 0:return i=t.threadRootMessages,u=__rest(t,["threadRootMessages"]),v.next=3,this.core.sendCmd("qchatGetThreadRootMessagesMeta",{qchatMsgs:i,tag:u});case 3:if(h=v.sent,!((m=h.content.metas)&&m.length>0)){v.next=7;break}return v.abrupt("return",map$6(m).call(m,(function(t){return xt(xt({},t),{total:su(t.total),timestamp:su(t.timestamp),msgTime:su(t.msgTime)})})));case 7:return v.abrupt("return",[]);case 8:case"end":return v.stop()}}),_callee5,this)})))},t.getQuickComments=function getQuickComments(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee6(){var i,u,h;return ms.wrap((function _callee6$(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.core.sendCmd("qchatGetQuickComments",{tag:{serverId:t.serverId,channelId:t.channelId,msgIdServerList:Ms(map$6(i=t.msgList).call(i,(function(t){return t.msgIdServer})))}});case 2:return u=m.sent,h=u.content.quickCommentResponse,m.abrupt("return",formatQuickComments(h));case 5:case"end":return m.stop()}}),_callee6,this)})))},t.updateQuickComment=function updateQuickComment(t,i){return __awaiter(this,void 0,void 0,ms.mark((function _callee7(){var u,h,m,v,E,I;return ms.wrap((function _callee7$(M){for(;;)switch(M.prev=M.next){case 0:return validate({type:{type:"number"},commentMessage:{type:"object",rules:{msgIdServer:{type:"string",allowEmpty:!1}}}},t),u=t.commentMessage,h=u.serverId,m=u.channelId,v=u.fromAccount,E=u.msgIdServer,I=u.time,M.next=4,this.core.sendCmd("qchatUpdateQuickComment",{tag:{serverId:h,channelId:m,fromAccount:v,msgIdServer:E,time:I,type:t.type,opeType:i,opeAccid:this.core.account}});case 4:case"end":return M.stop()}}),_callee7,this)})))},t.sendTypingEvent=function sendTypingEvent(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee8(){return ms.wrap((function _callee8$(i){for(;;)switch(i.prev=i.next){case 0:if(t.channelId!==this.lastChannelIdInTyping){i.next=4;break}return this.logger.log("qchatMsg sendTypingEvent throttle"),this._sendTypingEvent(t),i.abrupt("return");case 4:this.lastChannelIdInTyping=t.channelId,this._sendTypingEvent.flush(),this._sendTypingEvent(t);case 7:case"end":return i.stop()}}),_callee8,this)})))},ExtendModuleService}(),Yp=function(t){function QChatMsgService(i){var u;return(u=t.call(this,"qchatMsg",i)||this).core=i,u.lastChannelIdInMark="",registerParser({cmdMap:Rp,cmdConfig:Op()}),u.notificationModuleService=new Gp(i),u.messageModuleService=new Bp(i),u.extendModuleService=new jp(i),u}bt(QChatMsgService,t);var i=QChatMsgService.prototype;return i.sendMessage=function sendMessage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){return ms.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(ip)},ext:{type:"string",required:!1},mentionAll:{type:"boolean",required:!1},mentionAccids:{type:"array",itemType:"string",required:!1},mentionRoleIds:{type:"array",itemType:"string",required:!1,min:1},historyEnable:{type:"boolean",required:!1},pushEnable:{type:"boolean",required:!1}},t),i.next=3,this.messageModuleService.sendMessage(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee,this)})))},i.updateMessage=function updateMessage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){return ms.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:if(validate({message:{type:"object",rules:{serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},msgIdServer:{type:"string",allowEmpty:!1},time:{type:"number",min:0},body:{type:"string",required:!1},ext:{type:"string",required:!1}}}},t),!("number"==typeof t.message.status&&t.message.status<1e4)){i.next=3;break}throw new Xl("Status should be greater than or equal to 10000");case 3:return i.next=5,this.messageModuleService.doUpdateMessage(t);case 5:return i.abrupt("return",i.sent);case 6:case"end":return i.stop()}}),_callee2,this)})))},i.resendMessage=function resendMessage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){return ms.wrap((function _callee3$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},msgIdClient:{type:"string",allowEmpty:!1}},t),i.next=3,this.messageModuleService.resendMessage(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee3,this)})))},i.deleteMessage=function deleteMessage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var i;return ms.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return validate({message:{type:"object",rules:{serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},msgIdServer:{type:"string",allowEmpty:!1},time:{type:"number",min:0}}}},t),(i=JSON.parse(Ms(t))).message.status=2,u.next=5,this.messageModuleService.doUpdateMessage(i);case 5:return u.abrupt("return",u.sent);case 6:case"end":return u.stop()}}),_callee4,this)})))},i.revokeMessage=function revokeMessage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var i;return ms.wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:return validate({message:{type:"object",rules:{serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},msgIdServer:{type:"string",allowEmpty:!1},time:{type:"number",min:0}}}},t),(i=JSON.parse(Ms(t))).message=pick(i.message,["serverId","channelId","msgIdServer","time"]),i.message.status=1,u.next=6,this.messageModuleService.doUpdateMessage(i);case 6:return u.abrupt("return",u.sent);case 7:case"end":return u.stop()}}),_callee5,this)})))},i.markMessageRead=function markMessageRead(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee6(){return ms.wrap((function _callee6$(i){for(;;)switch(i.prev=i.next){case 0:validate({serverId:{type:"string"},channelId:{type:"string"},time:{type:"number",min:0}},t),t.channelId!==this.lastChannelIdInMark&&this.messageModuleService.markMessageRead.flush(),this.lastChannelIdInMark=t.channelId,this.messageModuleService.markMessageRead(t);case 4:case"end":return i.stop()}}),_callee6,this)})))},i.replyMessage=function replyMessage(t){validate({replyMessage:{type:"object",rules:{msgIdServer:{type:"string",allowEmpty:!1}}}},t);var replyMessage=t.replyMessage;if(t.serverId!==replyMessage.serverId||t.channelId!==replyMessage.channelId)throw new Xl("Forbid replying to message from other server, channel");return this.sendMessage(t)},i.getMessageHistoryByIds=function getMessageHistoryByIds(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee7(){return ms.wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},messageReferList:{type:"array",rules:{msgIdServer:{type:"string",allowEmpty:!1},time:{type:"number"}}}},t),i.next=3,this.extendModuleService.getMessageHistoryByIds(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee7,this)})))},i.getReferMessages=function getReferMessages(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee8(){return ms.wrap((function _callee8$(i){for(;;)switch(i.prev=i.next){case 0:return validate({message:{type:"object",rules:{msgIdServer:{type:"string",allowEmpty:!1},time:{type:"number"}}},referType:{type:"enum",values:getEnumKeys(dp),required:!1}},t),i.next=3,this.extendModuleService.getReferMessages(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee8,this)})))},i.getThreadMessages=function getThreadMessages(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee9(){return ms.wrap((function _callee9$(i){for(;;)switch(i.prev=i.next){case 0:return validate({message:{type:"object",rules:{msgIdServer:{type:"string",allowEmpty:!1},time:{type:"number"}}},messageQueryOption:{type:"object",rules:{beginTime:{type:"number",required:!1},endTime:{type:"number",required:!1},excludeMsgId:{type:"string",required:!1},limit:{type:"number",required:!1},reverse:{type:"boolean",required:!1}}}},t),i.next=3,this.extendModuleService.getThreadMessages(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee9,this)})))},i.getThreadRootMessagesMeta=function getThreadRootMessagesMeta(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee10(){return ms.wrap((function _callee10$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},threadRootMessages:{type:"array",rules:{msgIdServer:{type:"string",allowEmpty:!1},time:{type:"number"}}}},t),i.next=3,this.extendModuleService.getThreadRootMessagesMeta(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee10,this)})))},i.sendSystemNotification=function sendSystemNotification(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee11(){return ms.wrap((function _callee11$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1,required:!1},attach:{type:"object",required:!1}},t),i.next=3,this.notificationModuleService.sendSystemNotification(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee11,this)})))},i.updateSystemNotification=function updateSystemNotification(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee12(){return ms.wrap((function _callee12$(i){for(;;)switch(i.prev=i.next){case 0:return validate({systemNotification:{type:"object",rules:{msgIdServer:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(up)},body:{type:"string",required:!1},ext:{type:"string",required:!1},status:{type:"number",required:!1}}}},t),i.next=3,this.notificationModuleService.updateSystemNotification(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee12,this)})))},i.markSystemNotificationsRead=function markSystemNotificationsRead(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee13(){return ms.wrap((function _callee13$(i){for(;;)switch(i.prev=i.next){case 0:return validate({systemNotifications:{type:"array",rules:{msgIdServer:{type:"string",allowEmpty:!1},type:{type:"string",allowEmpty:!1}},min:1}},t),i.next=3,this.notificationModuleService.markSystemNotificationsRead(t);case 3:case"end":return i.stop()}}),_callee13,this)})))},i.getHistoryMessage=function getHistoryMessage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee14(){return ms.wrap((function _callee14$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},beginTime:{type:"number",min:0,required:!1},endTime:{type:"number",min:0,required:!1},excludeMsgId:{type:"string",allowEmpty:!1,required:!1},limit:{type:"number",min:1,required:!1},reverse:{type:"boolean",required:!1}},t),i.next=3,this.messageModuleService.getHistoryMessage(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee14,this)})))},i.getMentionedMeMessages=function getMentionedMeMessages(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee15(){return ms.wrap((function _callee15$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},timestamp:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1}},t),i.next=3,this.messageModuleService.getMentionedMeMessages(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee15,this)})))},i.areMentionedMeMessages=function areMentionedMeMessages(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee16(){var i;return ms.wrap((function _callee16$(u){for(;;)switch(u.prev=u.next){case 0:if(validate({messages:{type:"array",rules:{serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},msgIdServer:{type:"string",allowEmpty:!1}},min:1}},t),every(i=t.messages).call(i,(function(i){return t.messages[0].serverId===i.serverId}))){u.next=4;break}throw new Xl("Different serverId",t,10414);case 4:if(!this.core.qchatChannel.subscribeForVisitorService.isInAutoServers(t.messages[0].serverId)){u.next=7;break}throw new Xl("Not allowed for visitor",t,10403);case 7:return u.next=9,this.messageModuleService.areMentionedMeMessages(t.messages);case 9:return u.abrupt("return",u.sent);case 10:case"end":return u.stop()}}),_callee16,this)})))},i.addQuickComment=function addQuickComment(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee17(){return ms.wrap((function _callee17$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.extendModuleService.updateQuickComment(t,1);case 2:case"end":return i.stop()}}),_callee17,this)})))},i.removeQuickComment=function removeQuickComment(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee18(){return ms.wrap((function _callee18$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.extendModuleService.updateQuickComment(t,2);case 2:case"end":return i.stop()}}),_callee18,this)})))},i.getQuickComments=function getQuickComments(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee19(){return ms.wrap((function _callee19$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},msgList:{type:"array",rules:{msgIdServer:{type:"string",allowEmpty:!1}},min:1}},t),i.next=3,this.extendModuleService.getQuickComments(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee19,this)})))},i.sendTypingEvent=function sendTypingEvent(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee20(){return ms.wrap((function _callee20$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),i.next=3,this.extendModuleService.sendTypingEvent(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee20,this)})))},i.getLastMessageOfChannels=function getLastMessageOfChannels(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee21(){return ms.wrap((function _callee21$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelIdList:{type:"array",itemType:"string"}},t),i.next=3,this.messageModuleService.getLastMessageOfChannels(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee21,this)})))},i.qchatOnMsgHandler=function qchatOnMsgHandler(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee22(){return ms.wrap((function _callee22$(i){for(;;)switch(i.prev=i.next){case 0:this.messageModuleService.onMsg(t);case 1:case"end":return i.stop()}}),_callee22,this)})))},i.qchatOnRecvUnreadInfoHandler=function qchatOnRecvUnreadInfoHandler(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee23(){return ms.wrap((function _callee23$(i){for(;;)switch(i.prev=i.next){case 0:this.messageModuleService.onRecvUnreadInfo(t);case 1:case"end":return i.stop()}}),_callee23,this)})))},i.qchatOnSysMsgHandler=function qchatOnSysMsgHandler(t){this.notificationModuleService.onSysMsg(t)},i.qchatMultiSyncMessageReadHandler=function qchatMultiSyncMessageReadHandler(t){this.messageModuleService.onMultiSyncRead(t)},i.qchatMultiSyncSystemNotificationUpdateHandler=function qchatMultiSyncSystemNotificationUpdateHandler(t){this.notificationModuleService.onMultiSysMsg(t)},i.qchatSyncSystemNotificationHandler=function qchatSyncSystemNotificationHandler(t){this.notificationModuleService.onSyncSysMsg(t)},i.qchatRecvMessageUpdateHandler=function qchatRecvMessageUpdateHandler(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee24(){return ms.wrap((function _callee24$(i){for(;;)switch(i.prev=i.next){case 0:this.messageModuleService.onRecvMsgUpdate(t);case 1:case"end":return i.stop()}}),_callee24,this)})))},i.searchMsgByPage=function searchMsgByPage(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee25(){return ms.wrap((function _callee25$(i){for(;;)switch(i.prev=i.next){case 0:return validate({keyword:{type:"string",allowEmpty:!1,required:!1},serverId:{type:"string",allowEmpty:!1,required:!0},channelId:{type:"string",allowEmpty:!1,required:!1},fromAccid:{type:"string",allowEmpty:!1,required:!1},fromTime:{type:"number",allowEmpty:!1,required:!1},toTime:{type:"number",allowEmpty:!1,required:!1},msgTypes:{type:"array",itemType:"string",allowEmpty:!1,required:!0},subTypes:{type:"array",itemType:"string",allowEmpty:!1,required:!1},includeSelf:{type:"boolean",allowEmpty:!1,required:!1},order:{type:"enum",values:getEnumKeys(pd),required:!1},limit:{type:"number",min:0,required:!1},sort:{type:"enum",values:getEnumKeys(op),required:!1},cursor:{type:"string",allowEmpty:!1,required:!1}},t),i.next=3,this.messageModuleService.messageSearchByPage(t);case 3:return i.abrupt("return",i.sent);case 4:case"end":return i.stop()}}),_callee25,this)})))},i.qchatMultiSyncServersMessageReadHandler=function qchatMultiSyncServersMessageReadHandler(t){this.messageModuleService.onMultiSyncServersRead(t)},QChatMsgService}(vd),Wp={serverId:{type:"string"},uid:{type:"string"},accid:{type:"string"},nick:{type:"string"},avatar:{type:"string"},ext:{type:"string"},type:{type:"number"},joinTime:{type:"number"},inviter:{type:"string"},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"}},$p={limit:{type:"number"}};function formatMembers(t){return Qs(t)&&t.length>0?map$6(t).call(t,(function(t){return function formatMember(t){return format(Wp,t)}(t)})):[]}function formatRTCChannelConfig(t){try{t.audio&&(t.audio=JSON.parse(t.audio))}catch(t){throw new Ql('result "audio" JSON parse error',{key:"audio"},"JSON parse error")}try{t.video&&(t.video=JSON.parse(t.video))}catch(t){throw new Ql('result "video" JSON parse error',{key:"video"},"JSON parse error")}return format($p,t)}var Hp={"25_1":"qchatGetNeroomToken","25_2":"qchatUpdateRTCChannelConfig","25_3":"qchatGetRTCChannelConfig","25_4":"qchatGetRTCChannelMembers"},Qp={QChatRTCChannelConfigTag:{serverId:1,channelId:2,limit:3,audio:4,video:5},QChatRTCChannelConfigResultTag:{limit:1,audio:2,video:3},QChatGetRTCParams:{serverId:1,channelId:2},qchatGetRTCChannelMembersTag:{serverId:1,channelId:2},memberInfo:{serverId:1,accid:3,nick:4,avatar:5,ext:6,type:7,joinTime:8,inviter:9,validFlag:10,createTime:11,updateTime:12},QChatGetNeroomTokenResultTag:{token:1,expire:2},QChatGetNeroomTokenParams:{neroomDeviceId:1}},Kp=function getCmdConfig(){var t=function getDeserializeTag(){return invertSerializeMap(Qp)}();return{qchatGetNeroomToken:{sid:25,cid:1,service:"qchatMedia",params:[{type:"Property",name:"qchatGetNeroomTokenTag",reflectMapper:Qp.QChatGetNeroomTokenParams}],response:[{type:"Property",name:"neroomToken",reflectMapper:t.QChatGetNeroomTokenResultTag}]},qchatUpdateRTCChannelConfig:{sid:25,cid:2,service:"qchatMedia",params:[{type:"Property",name:"RTCChannelConfig",reflectMapper:Qp.QChatRTCChannelConfigTag}]},qchatGetRTCChannelConfig:{sid:25,cid:3,service:"qchatMedia",params:[{type:"Property",name:"qchatGetRTCChannelConfigTag",reflectMapper:Qp.QChatGetRTCParams}],response:[{type:"Property",name:"RTCChannelConfig",reflectMapper:t.QChatRTCChannelConfigResultTag}]},qchatGetRTCChannelMembers:{sid:25,cid:4,service:"qchatMedia",params:[{type:"Property",name:"qchatGetRTCChannelMembersTag",reflectMapper:Qp.QChatGetRTCParams}],response:[{type:"PropertyArray",name:"memberList",reflectMapper:t.memberInfo}]}}},zp=function(t){function QChatMediaService(i,u){var h;return(h=t.call(this,"qchatMedia",i)||this).config={},h.tokenExpireTime=24e4,h.getTokenState=!1,h.core=i,registerParser({cmdMap:Hp,cmdConfig:Kp()}),u&&h.setOptions(u),h.setListener(),h.tokenExpireTime=24e4,h.channelId="",h.serverId="",h}bt(QChatMediaService,t);var i=QChatMediaService.prototype;return i.setOptions=function setOptions(t){t&&(this.config=xt(this.config,t),(null==t?void 0:t.neroom)&&this.setNeroom(t.neroom))},i.setNeroom=function setNeroom(t){this.neroom=new t},i.setListener=function setListener(){var t,i,u,h,m=this;this.core.eventBus.on("disconnect",bind$1(t=this._existRomm).call(t,this)),this.core.eventBus.on("kicked",bind$1(i=this._existRomm).call(i,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLogout",bind$1(u=this._existRomm).call(u,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleKicked",bind$1(h=this._existRomm).call(h,this)),this.core.eventBus.on("qchatMedia/serverOrChannelLeave",(function(t){return __awaiter(m,void 0,void 0,ms.mark((function _callee(){return ms.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(!(t.type===up[up.channelVisibilityUpdate]&&t.channelId===this.channelId||t.type===up[up.serverEnterLeave]&&t.serverId===this.serverId)){i.next=4;break}if(!this.roomContext||!this.roomContext.roomUuid){i.next=4;break}return i.next=4,this.disconnectChannel();case 4:case"end":return i.stop()}}),_callee,this)})))}))},i._existRomm=function _existRomm(){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){return ms.wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:if(!this.roomContext){t.next=3;break}return t.next=3,this.disconnectChannel();case 3:this.tokenTimer&&(this.core.timerManager.deleteTimer(this.tokenTimer),this.tokenTimer=void 0);case 4:case"end":return t.stop()}}),_callee2,this)})))},i._checkPermission=function _checkPermission(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee3(){var i;return ms.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.core.qchatRole.checkPermission(t);case 2:return i=u.sent,u.abrupt("return",i);case 4:case"end":return u.stop()}}),_callee3,this)})))},i._checkConnectState=function _checkConnectState(){if("connect"!==this.state)throw new Xl("QChatMedia::you should connect first")},i.kickMemberOut=function kickMemberOut(t){var i;return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){return ms.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),u.prev=2,u.next=5,null===(i=this.roomContext)||void 0===i?void 0:i.kickMemberOut(t.accid);case 5:u.next=11;break;case 7:throw u.prev=7,u.t0=u.catch(2),this.logger.error("QChatMedia::kickMemberOut error params is "+Ms(t),u.t0),new Xl("QChatMedia::kickMemberOut error",u.t0);case 11:case"end":return u.stop()}}),_callee4,this,[[2,7]])})))},i.disconnectChannel=function disconnectChannel(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){return ms.wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:return this.logger.debug("QChatMedia::disconnect begin disconnect"),i.prev=1,i.next=4,null===(t=this.roomContext)||void 0===t?void 0:t.leaveRoom();case 4:i.next=9;break;case 6:i.prev=6,i.t0=i.catch(1),this.logger.error("QChatMedia::disconnect error",i.t0);case 9:if(!this.authService){i.next=12;break}return i.next=12,this.authService.logout();case 12:this._setStateInit(),this.core.emit("qchatMediaDisconnect"),this.core.qchatMedia.emit("qchatMediaDisconnect");case 15:case"end":return i.stop()}}),_callee5,this,[[1,6]])})))},i._setStateInit=function _setStateInit(){this.logger.debug("QChatMedia::disconnect end"),this.roomContext=void 0,this.rtcController=void 0,this.state="init",this.tokenTimer&&(this.core.timerManager.deleteTimer(this.tokenTimer),this.tokenTimer=void 0),this.channelId="",this.serverId=""},i.muteAudio=function muteAudio(t){var i,u,h,m,v;return __awaiter(this,void 0,void 0,ms.mark((function _callee6(){var E;return ms.wrap((function _callee6$(I){for(;;)switch(I.prev=I.next){case 0:if(this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),(null===(i=this.roomContext)||void 0===i?void 0:i.localMember.uuid)!==t.accid){I.next=14;break}return I.prev=3,I.next=6,null===(u=this.rtcController)||void 0===u?void 0:u.muteMyAudio();case 6:I.next=12;break;case 8:throw I.prev=8,I.t0=I.catch(3),this.logger.error("QChatMedia::muteAudio error",I.t0),new Xl("QChatMedia::muteAudio error",I.t0);case 12:case 25:I.next=31;break;case 14:if(I.prev=14,!(E=null===(h=this.roomContext)||void 0===h?void 0:h.roomProperties.audioOff)||"offNotAllowSelfOn"!==(null===(m=E.value)||void 0===m?void 0:m.split("_")[0])){I.next=23;break}return I.next=19,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneMicrophone"});case 19:if(I.sent){I.next=23;break}return this.logger.error("QChatMedia::unMuteAudio not allow open auido"),I.abrupt("return");case 23:return I.next=25,null===(v=this.rtcController)||void 0===v?void 0:v.muteMemberAudio(t.accid);case 27:throw I.prev=27,I.t1=I.catch(14),this.logger.error("QChatMedia::muteAudio error params is "+Ms(t),I.t1),new Xl("QChatMedia::muteAudio error",I.t1);case 31:case"end":return I.stop()}}),_callee6,this,[[3,8],[14,27]])})))},i.unMuteAudio=function unMuteAudio(t){var i,u,h,m,v;return __awaiter(this,void 0,void 0,ms.mark((function _callee7(){var E;return ms.wrap((function _callee7$(I){for(;;)switch(I.prev=I.next){case 0:if(this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),!(E=null===(i=this.roomContext)||void 0===i?void 0:i.roomProperties.audioOff)||"offNotAllowSelfOn"!==(null===(u=E.value)||void 0===u?void 0:u.split("_")[0])){I.next=10;break}return I.next=6,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneMicrophone"});case 6:if(I.sent){I.next=10;break}return this.logger.error("QChatMedia::unMuteAudio not allow open auido"),I.abrupt("return");case 10:if((null===(h=this.roomContext)||void 0===h?void 0:h.localMember.uuid)!==t.accid){I.next=22;break}return I.prev=11,I.next=14,null===(m=this.rtcController)||void 0===m?void 0:m.unmuteMyAudio();case 14:I.next=20;break;case 16:throw I.prev=16,I.t0=I.catch(11),this.logger.error("QChatMedia::unMuteAudio error",I.t0),new Xl("QChatMedia::unMuteAudio error",I.t0);case 20:case 25:I.next=31;break;case 22:return I.prev=22,I.next=25,null===(v=this.rtcController)||void 0===v?void 0:v.unmuteMemberAudio(t.accid);case 27:throw I.prev=27,I.t1=I.catch(22),this.logger.error("QChatMedia::unMuteAudio error params is "+Ms(t),I.t1),new Xl("QChatMedia::unMuteAudio error",I.t1);case 31:case"end":return I.stop()}}),_callee7,this,[[11,16],[22,27]])})))},i.muteVideo=function muteVideo(t){var i,u,h,m,v;return __awaiter(this,void 0,void 0,ms.mark((function _callee8(){var E;return ms.wrap((function _callee8$(I){for(;;)switch(I.prev=I.next){case 0:if(this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),(null===(i=this.roomContext)||void 0===i?void 0:i.localMember.uuid)!==t.accid){I.next=14;break}return I.prev=3,I.next=6,null===(u=this.rtcController)||void 0===u?void 0:u.muteMyVideo();case 6:I.next=12;break;case 8:throw I.prev=8,I.t0=I.catch(3),this.logger.error("QChatMedia::muteVideo error",I.t0),new Xl("QChatMedia::muteVideo error",I.t0);case 12:case 25:I.next=31;break;case 14:if(I.prev=14,!(E=null===(h=this.roomContext)||void 0===h?void 0:h.roomProperties.videoOff)||"offNotAllowSelfOn"!==(null===(m=E.value)||void 0===m?void 0:m.split("_")[0])){I.next=23;break}return I.next=19,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneCamera"});case 19:if(I.sent){I.next=23;break}return this.logger.error("QChatMedia::unMuteVideo not allow open video"),I.abrupt("return");case 23:return I.next=25,null===(v=this.rtcController)||void 0===v?void 0:v.muteMemberVideo(t.accid);case 27:throw I.prev=27,I.t1=I.catch(14),this.logger.error("QChatMedia::muteVideo error params is "+Ms(t),I.t1),new Xl("QChatMedia::muteVideo error",I.t1);case 31:case"end":return I.stop()}}),_callee8,this,[[3,8],[14,27]])})))},i.unMuteVideo=function unMuteVideo(t){var i,u,h,m,v;return __awaiter(this,void 0,void 0,ms.mark((function _callee9(){var E;return ms.wrap((function _callee9$(I){for(;;)switch(I.prev=I.next){case 0:if(this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),!(E=null===(i=this.roomContext)||void 0===i?void 0:i.roomProperties.videoOff)||"offNotAllowSelfOn"!==(null===(u=E.value)||void 0===u?void 0:u.split("_")[0])){I.next=10;break}return I.next=6,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneCamera"});case 6:if(I.sent){I.next=10;break}return this.logger.error("QChatMedia::unMuteVideo not allow open video"),I.abrupt("return");case 10:if((null===(h=this.roomContext)||void 0===h?void 0:h.localMember.uuid)!==t.accid){I.next=22;break}return I.prev=11,I.next=14,null===(m=this.rtcController)||void 0===m?void 0:m.unmuteMyVideo();case 14:I.next=20;break;case 16:throw I.prev=16,I.t0=I.catch(11),this.logger.error("QChatMedia::unMuteVideo error",I.t0),new Xl("QChatMedia::unMuteVideo error",I.t0);case 20:I.next=30;break;case 22:I.prev=22,null===(v=this.rtcController)||void 0===v||v.unmuteMemberVideo(t.accid),I.next=30;break;case 26:throw I.prev=26,I.t1=I.catch(22),this.logger.error("QChatMedia::unMuteVideo error",I.t1),new Xl("QChatMedia::unMuteVideo error",I.t1);case 30:case"end":return I.stop()}}),_callee9,this,[[11,16],[22,26]])})))},i.startScreenShare=function startScreenShare(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee10(){return ms.wrap((function _callee10$(i){for(;;)switch(i.prev=i.next){case 0:this._checkConnectState(),i.prev=1,null===(t=this.rtcController)||void 0===t||t.startScreenShare(),i.next=9;break;case 5:throw i.prev=5,i.t0=i.catch(1),this.logger.error("QChatMedia::startScreenShare error",i.t0),new Xl("QChatMedia::startScreenShare error",i.t0);case 9:case"end":return i.stop()}}),_callee10,this,[[1,5]])})))},i.stopScreenShare=function stopScreenShare(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee11(){return ms.wrap((function _callee11$(i){for(;;)switch(i.prev=i.next){case 0:this._checkConnectState(),i.prev=1,null===(t=this.rtcController)||void 0===t||t.stopScreenShare(),i.next=9;break;case 5:throw i.prev=5,i.t0=i.catch(1),this.logger.error("QChatMedia::stopScreenShare error",i.t0),new Xl("QChatMedia::stopScreenShare error",i.t0);case 9:case"end":return i.stop()}}),_callee11,this,[[1,5]])})))},i.stopMemberScreenShare=function stopMemberScreenShare(t){var i;return __awaiter(this,void 0,void 0,ms.mark((function _callee12(){return ms.wrap((function _callee12$(u){for(;;)switch(u.prev=u.next){case 0:this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),u.prev=2,null===(i=this.rtcController)||void 0===i||i.stopMemberScreenShare(t.accid),u.next=10;break;case 6:throw u.prev=6,u.t0=u.catch(2),this.logger.error("QChatMedia::stopMemberScreenShare error",u.t0),new Xl("QChatMedia::stopMemberScreenShare error",u.t0);case 10:case"end":return u.stop()}}),_callee12,this,[[2,6]])})))},i.subscribeRemoteVideoStream=function subscribeRemoteVideoStream(t){var i;return __awaiter(this,void 0,void 0,ms.mark((function _callee13(){return ms.wrap((function _callee13$(u){for(;;)switch(u.prev=u.next){case 0:this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1},streamType:{type:"number",allowEmpty:!1,min:0,max:1}},t),u.prev=2,null===(i=this.rtcController)||void 0===i||i.subscribeRemoteVideoStream(t.accid,t.streamType),u.next=10;break;case 6:throw u.prev=6,u.t0=u.catch(2),this.logger.error("QChatMedia::subscribeRemoteVideoStream error",u.t0),new Xl("QChatMedia::subscribeRemoteVideoStream error",u.t0);case 10:case"end":return u.stop()}}),_callee13,this,[[2,6]])})))},i.unSubscribeRemoteVideoStream=function unSubscribeRemoteVideoStream(t){var i;return __awaiter(this,void 0,void 0,ms.mark((function _callee14(){return ms.wrap((function _callee14$(u){for(;;)switch(u.prev=u.next){case 0:this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1},streamType:{type:"number",allowEmpty:!1,min:0,max:1}},t),u.prev=2,null===(i=this.rtcController)||void 0===i||i.unsubscribeRemoteVideoStream(t.accid,t.streamType),u.next=10;break;case 6:throw u.prev=6,u.t0=u.catch(2),this.logger.error("QChatMedia::unSubscribeRemoteVideoStream error",u.t0),new Xl("QChatMedia::unSubscribeRemoteVideoStream error",u.t0);case 10:case"end":return u.stop()}}),_callee14,this,[[2,6]])})))},i.setupVideoCanvas=function setupVideoCanvas(t){var i;if(this._checkConnectState(),(null===(i=this.roomContext)||void 0===i?void 0:i.localMember.uuid)===t.accid)try{return this.rtcController.setupLocalVideoCanvas(t.videoView)}catch(t){throw this.logger.error("QChatMedia::setupVideoCanvas error",t),new Xl("QChatMedia::setupVideoCanvas error",t)}else try{return this.rtcController.setupRemoteVideoCanvas(t.videoView,t.accid)}catch(t){throw this.logger.error("QChatMedia::setupVideoCanvas error",t),new Xl("QChatMedia::setupVideoCanvas error",t)}},i.setupRemoteVideoSubStreamCanvas=function setupRemoteVideoSubStreamCanvas(t){this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t);try{return this.rtcController.setupRemoteVideoSubStreamCanvas(t.videoView,t.accid)}catch(t){throw this.logger.error("QChatMedia::setupRemoteVideoSubStreamCanvas error",t),new Xl("QChatMedia::setupRemoteVideoSubStreamCanvas error",t)}},i.getScreenSharingUserUuid=function getScreenSharingUserUuid(){this._checkConnectState();try{return this.rtcController.getScreenSharingUserUuid()}catch(t){throw this.logger.error("QChatMedia::getScreenSharingUserUuid error",t),new Xl("QChatMedia::getScreenSharingUserUuid error",t)}},i.initQChatMedia=function initQChatMedia(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee15(){return ms.wrap((function _callee15$(i){for(;;)switch(i.prev=i.next){case 0:if(this.neroom){i.next=3;break}return this.logger.warn("QChatMedia::init::you should import neroom SDK"),i.abrupt("return");case 3:if(void 0===this.state){i.next=6;break}return this.logger.error("QChatMedia::init::you already init QChatMedia"),i.abrupt("return");case 6:i.prev=6,this.neroom.initialize({appKey:this.core.options.appkey,serverConfig:t.serverConfig}),i.next=14;break;case 10:throw i.prev=10,i.t0=i.catch(6),this.logger.error("QChatMedia::initQChatMedia error",i.t0),new Xl("QChatMedia::initQChatMedia error",i.t0);case 14:this.authService=this.neroom.authService,this.roomService=this.neroom.roomService,this.messageChannelService=this.neroom.messageChannelService,this.state="init";case 18:case"end":return i.stop()}}),_callee15,this,[[6,10]])})))},i.loginByIM=function loginByIM(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee16(){var i,u;return ms.wrap((function _callee16$(h){for(;;)switch(h.prev=h.next){case 0:if("init"===this.state){h.next=3;break}return this.logger.error("QChatMedia::connect::you should init before login"),h.abrupt("return");case 3:return h.next=5,this._getToken();case 5:return i=h.sent,u=get(this.core,"options.token")||get(this.core,"V2NIMLoginService.token"),h.prev=7,h.next=10,null===(t=this.authService)||void 0===t?void 0:t.loginByIM(this.core.account,i,u);case 10:h.next=16;break;case 12:throw h.prev=12,h.t0=h.catch(7),this.logger.error("QChatMedia::loginByIM error",h.t0),new Xl("QChatMedia::loginByIM error",h.t0);case 16:this.state="login";case 17:case"end":return h.stop()}}),_callee16,this,[[7,12]])})))},i._getToken=function _getToken(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee18(){var i,u,h,m,v=this;return ms.wrap((function _callee18$(E){for(;;)switch(E.prev=E.next){case 0:return this.logger.log("QChatMedia::getToken begin getToken"),E.next=3,this.core.sendCmd("qchatGetNeroomToken",{qchatGetNeroomTokenTag:{neroomDeviceId:null===(t=this.neroom)||void 0===t?void 0:t.deviceId}});case 3:return i=E.sent,u=i.content.neroomToken,h=u.token,m=u.expire,this.logger.log("QChatMedia::getToken success token is "+h+",expire is "+m+" "),this.tokenTimer||(this.logger.debug("QChatMedia::getToken set token timer,expire is "+(1e3*m-this.tokenExpireTime)+" "),this.tokenTimer=this.core.timerManager.addTimer((function(){return __awaiter(v,void 0,void 0,ms.mark((function _callee17(){var t;return ms.wrap((function _callee17$(i){for(;;)switch(i.prev=i.next){case 0:return this.tokenTimer&&this.core.timerManager.deleteTimer(this.tokenTimer),this.tokenTimer=void 0,i.next=4,this._getToken();case 4:t=i.sent,this.authService&&this.authService.renewToken(t);case 6:case"end":return i.stop()}}),_callee17,this)})))}),1e3*m-this.tokenExpireTime)),E.abrupt("return",h);case 8:case"end":return E.stop()}}),_callee18,this)})))},i.connectChannel=function connectChannel(t){var i,u;return __awaiter(this,void 0,void 0,ms.mark((function _callee19(){var h;return ms.wrap((function _callee19$(m){for(;;)switch(m.prev=m.next){case 0:if(void 0!==this.state){m.next=3;break}return this.logger.error("QChatMedia::connect::you should init before login"),m.abrupt("return");case 3:if("init"!==this.state){m.next=6;break}return m.next=6,this.loginByIM();case 6:return this.serverId=t.serverId,this.channelId=t.channelId,m.prev=8,m.next=11,null===(i=this.roomService)||void 0===i?void 0:i.joinRoom({roomUuid:t.channelId,role:"qchatAudience",userName:this.core.account,initialProperties:{}},{});case 11:m.next=17;break;case 13:throw m.prev=13,m.t0=m.catch(8),this.logger.error("QChatMedia::connectChannel error",m.t0),new Xl("QChatMedia::connectChannel error",m.t0);case 17:if(!(h=null===(u=this.roomService)||void 0===u?void 0:u.getRoomContext(t.channelId))){m.next=28;break}return this.roomContext=h,this.rtcController=this.roomContext.rtcController,this.state="connect",m.next=24,this.rtcController.joinRtcChannel();case 24:this.core.emit("connectChannel"),this.core.qchatMedia.emit("connectChannel"),m.next=29;break;case 28:this.logger.error("QChatMedia::connect room not exited");case 29:case"end":return m.stop()}}),_callee19,this,[[8,13]])})))},i.updateRTCChannelInfo=function updateRTCChannelInfo(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee20(){return ms.wrap((function _callee20$(i){for(;;)switch(i.prev=i.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},limit:{type:"number",allowEmpty:!1}},t),i.next=3,this.core.sendCmd("qchatUpdateRTCChannelConfig",{RTCChannelConfig:xt(xt({},t),{audio:Ms(t.audio),video:Ms(t.video)})});case 3:case"end":return i.stop()}}),_callee20,this)})))},i.getRTCChannelInfo=function getRTCChannelInfo(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee21(){var i;return ms.wrap((function _callee21$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1}},t),u.next=3,this.core.sendCmd("qchatGetRTCChannelConfig",{qchatGetRTCChannelConfigTag:t});case 3:return i=u.sent,u.abrupt("return",formatRTCChannelConfig(i.content.RTCChannelConfig));case 5:case"end":return u.stop()}}),_callee21,this)})))},i.getRTCChannelOnlineMembers=function getRTCChannelOnlineMembers(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee22(){var i;return ms.wrap((function _callee22$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1}},t),u.next=3,this.core.sendCmd("qchatGetRTCChannelMembers",{qchatGetRTCChannelMembersTag:t});case 3:return i=u.sent,u.abrupt("return",formatMembers(i.content.memberList));case 5:case"end":return u.stop()}}),_callee22,this)})))},i.addRTCChannelListener=function addRTCChannelListener(){var t,i,u=this;this._checkConnectState();try{null===(t=this.authService)||void 0===t||t.addAuthListener({onAuthEvent:function onAuthEvent(t){return __awaiter(u,void 0,void 0,ms.mark((function _callee23(){var i;return ms.wrap((function _callee23$(u){for(;;)switch(u.prev=u.next){case 0:if(1026!==t||this.getTokenState){u.next=10;break}return this.logger.log("QChatMedia::loginByIM token expire,begin get new token "),this.getTokenState=!0,u.next=5,this._getToken();case 5:if(i=u.sent,!this.authService){u.next=9;break}return u.next=9,this.authService.renewToken(i);case 9:this.getTokenState=!1;case 10:case"end":return u.stop()}}),_callee23,this)})))}})}catch(t){throw this.getTokenState=!1,this.logger.error("QChatMedia::loginByIM addAuthListener error",t),new Xl("QChatMedia::loginByIM addAuthListener error",t)}null===(i=this.roomContext)||void 0===i||i.addRoomListener({onRoomPropertiesChanged:function onRoomPropertiesChanged(t){var i,h,m,v,E,I;if(u.logger.log("QChatMedia::addRTCChannelListener::onRoomPropertiesChanged",t),t.audioOff){var M=null===(i=t.audioOff.value)||void 0===i?void 0:i.split("_")[0];"offNotAllowSelfOn"!==M&&"offAllowSelfOn"!==M||(null===(h=u.roomContext)||void 0===h?void 0:h.localMember.isAudioOn)&&(null===(m=u.rtcController)||void 0===m||m.muteMyAudio())}else if(t.videoOff){var S=null===(v=t.videoOff.value)||void 0===v?void 0:v.split("_")[0];"offNotAllowSelfOn"!==S&&"offAllowSelfOn"!==S||(null===(E=u.roomContext)||void 0===E?void 0:E.localMember.isVideoOn)&&(null===(I=u.rtcController)||void 0===I||I.muteMyVideo())}},onRoomPropertiesDeleted:function onRoomPropertiesDeleted(t){u.logger.log("QChatMedia::addRTCChannelListener::onRoomPropertiesDeleted",t)},onMemberJoinRtcChannel:function onMemberJoinRtcChannel(t){u.logger.log("QChatMedia::addRTCChannelListener::onMemberJoinRTCChannel",t);var i=map$6(t).call(t,(function(t){return t.uuid}));u.core.emit("memberJoinRTCChannel",i),u.core.qchatMedia.emit("memberJoinRTCChannel",i)},onMemberLeaveRoom:function onMemberLeaveRoom(t){u.logger.log("QChatMedia::addRTCChannelListener::onMemberLeaveRoom",t);var i=map$6(t).call(t,(function(t){return t.uuid}));u.core.emit("memberLeaveRTCChannel",i),u.core.qchatMedia.emit("memberLeaveRTCChannel",i)},onRoomEnded:function onRoomEnded(t){u.authService&&u.authService.logout(),u._setStateInit(),u.logger.log("QChatMedia::addRTCChannelListener::onRoomEnded",t),u.core.emit("RTCChannelEnded",t),u.core.qchatMedia.emit("RTCChannelEnded",t)},onRtcChannelError:function onRtcChannelError(t){u.logger.log("QChatMedia::addRTCChannelListener::onRtcChannelError",t),"SOCKET_ERROR"===t&&u.disconnectChannel(),u.core.emit("RTCChannelError",t),u.core.qchatMedia.emit("RTCChannelError",t)},onRtcAudioVolumeIndication:function onRtcAudioVolumeIndication(t){u.logger.log("QChatMedia::addRTCChannelListener::onRtcAudioVolumeIndication",t),u.core.emit("onRtcAudioVolumeIndication",t),u.core.qchatMedia.emit("onRtcAudioVolumeIndication",t)},onMemberAudioMuteChanged:function onMemberAudioMuteChanged(t,i,h){u.logger.log("QChatMedia::addRTCChannelListener::onMemberAudioMuteChanged",t,i),u.core.emit("memberAudioMuteChanged",{memberAccId:t.uuid,mute:i,operateByAccId:h.uuid}),u.core.qchatMedia.emit("memberAudioMuteChanged",{memberAccId:t.uuid,mute:i,operateByAccId:h.uuid})},onMemberScreenShareStateChanged:function onMemberScreenShareStateChanged(t,i,h){u.logger.log("QChatMedia::addRTCChannelListener::onMemberScreenShareStateChanged",t,i),u.core.emit("memberScreenShareStateChanged",{memberAccId:t.uuid,isSharing:i,operateByAccId:h.uuid}),u.core.qchatMedia.emit("memberScreenShareStateChanged",{memberAccId:t.uuid,isSharing:i,operateByAccId:h.uuid})},onMemberVideoMuteChanged:function onMemberVideoMuteChanged(t,i,h){u.logger.log("QChatMedia::addRTCChannelListener::onMemberVideoMuteChanged",t,i),u.core.emit("memberVideoMuteChanged",{memberAccId:t.uuid,mute:i,operateByAccId:h.uuid}),u.core.qchatMedia.emit("memberVideoMuteChanged",{memberAccId:t.uuid,mute:i,operateByAccId:h.uuid})}})},i.enumCameraDevices=function enumCameraDevices(){var t=this;return this._checkConnectState(),this.rtcController.enumCameraDevices().then((function(t){return t.data}),(function(i){throw t.logger.error("QChatMedia::enumCameraDevices error",i),new Xl("QChatMedia::enumCameraDevices error",i)}))},i.enumPlayoutDevices=function enumPlayoutDevices(){var t=this;return this._checkConnectState(),this.rtcController.enumPlayoutDevices().then((function(t){return t.data}),(function(i){throw t.logger.error("QChatMedia::enumPlayoutDevices error",i),new Xl("QChatMedia::enumPlayoutDevices error",i)}))},i.enumRecordDevices=function enumRecordDevices(){var t=this;return this._checkConnectState(),this.rtcController.enumRecordDevices().then((function(t){return t.data}),(function(i){throw t.logger.error("QChatMedia::enumRecordDevices error",i),new Xl("QChatMedia::enumRecordDevices error",i)}))},i.removeRTCChannelListener=function removeRTCChannelListener(){var t,i;this._checkConnectState(),null===(t=this.roomContext)||void 0===t||t.removeRoomListener({}),null===(i=this.authService)||void 0===i||i.removeAuthListener({})},i.setSelectedCameraDevice=function setSelectedCameraDevice(t){var i=this;return this._checkConnectState(),validate({deviceId:{type:"string",allowEmpty:!1}},t),this.rtcController.setSelectedCameraDevice(t.deviceId).then((function(t){return t.data}),(function(t){throw i.logger.error("QChatMedia::setSelectedCameraDevice error",t),new Xl("QChatMedia::setSelectedCameraDevice error",t)}))},i.setSelectedPlayoutDevice=function setSelectedPlayoutDevice(t){var i=this;return this._checkConnectState(),validate({deviceId:{type:"string",allowEmpty:!1}},t),this.rtcController.setSelectedPlayoutDevice(t.deviceId).then((function(t){return t.data}),(function(t){throw i.logger.error("QChatMedia::setSelectedPlayoutDevice error",t),new Xl("QChatMedia::setSelectedPlayoutDevice error",t)}))},i.setSelectedRecordDevice=function setSelectedRecordDevice(t){var i=this;return this._checkConnectState(),validate({deviceId:{type:"string",allowEmpty:!1}},t),this.rtcController.setSelectedRecordDevice(t.deviceId).then((function(t){return t.data}),(function(t){throw i.logger.error("QChatMedia::setSelectedRecordDevice error",t),new Xl("QChatMedia::setSelectedRecordDevice error",t)}))},i.getRTCMembers=function getRTCMembers(){var t,i;return this._checkConnectState(),map$6(t=filter(i=this.roomContext.remoteMembers).call(i,(function(t){return t.isInRtcChannel}))).call(t,(function(t){return{accid:t.uuid,isAudioOn:!!t.isAudioOn,isVideoOn:!!t.isVideoOn,isSharingScreen:!!t.isSharingScreen,properties:t.properties}}))},i.subscribeRemoteVideoSubStream=function subscribeRemoteVideoSubStream(t){var i;return __awaiter(this,void 0,void 0,ms.mark((function _callee24(){return ms.wrap((function _callee24$(u){for(;;)switch(u.prev=u.next){case 0:this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),u.prev=2,null===(i=this.rtcController)||void 0===i||i.subscribeRemoteVideoSubStream(t.accid),u.next=10;break;case 6:throw u.prev=6,u.t0=u.catch(2),this.logger.error("QChatMedia::subscribeRemoteVideoSubStream error",u.t0),new Xl("QChatMedia::subscribeRemoteVideoSubStream error",u.t0);case 10:case"end":return u.stop()}}),_callee24,this,[[2,6]])})))},i.unsubscribeRemoteVideoSubStream=function unsubscribeRemoteVideoSubStream(t){var i;return __awaiter(this,void 0,void 0,ms.mark((function _callee25(){return ms.wrap((function _callee25$(u){for(;;)switch(u.prev=u.next){case 0:this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),u.prev=2,null===(i=this.rtcController)||void 0===i||i.unsubscribeRemoteVideoSubStream(t.accid),u.next=10;break;case 6:throw u.prev=6,u.t0=u.catch(2),this.logger.error("QChatMedia::unsubscribeRemoteVideoSubStream error",u.t0),new Xl("QChatMedia::unsubscribeRemoteVideoSubStream error",u.t0);case 10:case"end":return u.stop()}}),_callee25,this,[[2,6]])})))},i.muteAllAudio=function muteAllAudio(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee26(){return ms.wrap((function _callee26$(i){for(;;)switch(i.prev=i.next){case 0:return this._checkConnectState(),i.next=3,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneMicrophone"});case 3:if(i.sent){i.next=7;break}return this.logger.error("QChatMedia::connect::auth your have not RTCChannelOpenCloseEveryoneMicrophone auth"),i.abrupt("return");case 7:i.prev=7,null===(t=this.roomContext)||void 0===t||t.updateRoomProperty("audioOff",Ms({value:"offNotAllowSelfOn_"+(new Date).getTime()})),i.next=15;break;case 11:throw i.prev=11,i.t0=i.catch(7),this.logger.error("QChatMedia::muteAllAudio error",i.t0),new Xl("QChatMedia::muteAllAudio error",i.t0);case 15:case"end":return i.stop()}}),_callee26,this,[[7,11]])})))},i.muteAllVideo=function muteAllVideo(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee27(){return ms.wrap((function _callee27$(i){for(;;)switch(i.prev=i.next){case 0:return this._checkConnectState(),i.next=3,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneCamera"});case 3:if(i.sent){i.next=7;break}return this.logger.error("QChatMedia::connect::auth your have not RTCChannelOpenCloseEveryoneCamera auth"),i.abrupt("return");case 7:i.prev=7,null===(t=this.roomContext)||void 0===t||t.updateRoomProperty("videoOff",Ms({value:"offNotAllowSelfOn_"+(new Date).getTime()})),i.next=15;break;case 11:throw i.prev=11,i.t0=i.catch(7),this.logger.error("QChatMedia::muteAllVideo error",i.t0),new Xl("QChatMedia::muteAllVideo error",i.t0);case 15:case"end":return i.stop()}}),_callee27,this,[[7,11]])})))},i.unMuteAllAudio=function unMuteAllAudio(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee28(){return ms.wrap((function _callee28$(i){for(;;)switch(i.prev=i.next){case 0:return this._checkConnectState(),i.next=3,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneMicrophone"});case 3:if(i.sent){i.next=7;break}return this.logger.error("QChatMedia::connect::auth your have not RTCChannelOpenCloseEveryoneMicrophone auth"),i.abrupt("return");case 7:i.prev=7,null===(t=this.roomContext)||void 0===t||t.updateRoomProperty("audioOff",Ms({value:"disable_"+(new Date).getTime()})),i.next=15;break;case 11:throw i.prev=11,i.t0=i.catch(7),this.logger.error("QChatMedia::unMuteAllAudio error",i.t0),new Xl("QChatMedia::unMuteAllAudio error",i.t0);case 15:case"end":return i.stop()}}),_callee28,this,[[7,11]])})))},i.unMuteAllVideo=function unMuteAllVideo(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee29(){return ms.wrap((function _callee29$(i){for(;;)switch(i.prev=i.next){case 0:return this._checkConnectState(),i.next=3,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneCamera"});case 3:if(i.sent){i.next=7;break}return this.logger.error("QChatMedia::connect::auth your have not RTCChannelOpenCloseEveryoneCamera auth"),i.abrupt("return");case 7:i.prev=7,null===(t=this.roomContext)||void 0===t||t.updateRoomProperty("videoOff",Ms({value:"disable_"+(new Date).getTime()})),i.next=15;break;case 11:throw i.prev=11,i.t0=i.catch(7),this.logger.error("QChatMedia::unMuteAllVideo error",i.t0),new Xl("QChatMedia::unMuteAllVideo error",i.t0);case 15:case"end":return i.stop()}}),_callee29,this,[[7,11]])})))},QChatMediaService}(vd),Jp=["error","warn","log","debug"],Xp=function emptyFunc(){},Zp=["off","error","warn","log","debug"],eh=function(){function Logger(t,i){void 0===i&&(i={}),this.storageArr=[],this.debugLevel="off",this.timer=0,this.strategies={debug:{name:"debg",func:console.log},log:{name:"info",func:console.log},warn:{name:"warn",func:console.warn},error:{name:"erro",func:console.error}},this.debug=Xp,this.log=Xp,this.warn=Xp,this.error=Xp,this.iid=Math.round(1e3*Math.random()),this.debugLevel=indexOf(Zp).call(Zp,t)>-1?t:"off",i.debugLevel&&(this.debugLevel=indexOf(Zp).call(Zp,i.debugLevel)>-1?i.debugLevel:this.debugLevel),this.logStorage=!1===i.storageEnable?null:new Ks.logStorage({logDirPath:i.logDirPath||i.storageName||"nim_logs",logRetentionDays:i.logRetentionDays||10,totalLogSizeInMB:i.totalLogSizeInMB||200,maxLogFileSizeInMB:i.maxLogFileSizeInMB||10}),this.setOptions(i),this.setLogFunc(this.debugLevel),this.setTimer(),Ks.setLogger(this),this.open()}var t=Logger.prototype;return t.getDebugMode=function getDebugMode(){return"debug"===this.debugLevel},t.open=function open(){var t=this;this.logStorage&&this.logStorage.open().then((function(){t.log("Logger::open success")})).catch((function(i){t.warn("Logger::open failed",i)}))},t.setOptions=function setOptions(t){if(t&&t.logFunc){var i=t.logFunc;for(var u in i){var h=u,m=i[h];m&&(this.strategies[h].func=m)}}},t.setLogFunc=function setLogFunc(t,i){var u=this;void 0===i&&(i="log");var h=findIndex(Jp).call(Jp,(function(i){return i===t})),m=findIndex(Jp).call(Jp,(function(t){return t===i}));forEach$1(Jp).call(Jp,(function(t,i){u[t]=function(){if(!(i>h&&i>m)){var u=slice(Array.prototype).call(arguments),v=this.strategies[t],E=this.formatArgs(u,v.name);i<=m&&this.logStorage&&this.prepareSaveLog(E,t),i<=h&&v.func(E)}}}))},t.extractLogs=function extractLogs(){var t;return this.logStorage?null===(t=this.logStorage)||void 0===t?void 0:t.extractLogs():Ja.resolve("")},t.afterUpload=function afterUpload(){var t;return this.logStorage?null===(t=this.logStorage)||void 0===t?void 0:t.afterUpload():Ja.resolve("")},t.prepareSaveLog=function prepareSaveLog(t,i){this.storageArr.push({text:t,level:i,time:eo(),iid:this.iid}),this.timer||this.setTimer(),this.storageArr.length>=100&&(this.triggerTimer(),this.storageArr=[])},t.saveLogs=function saveLogs(){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var t;return ms.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(this.logStorage){i.next=2;break}return i.abrupt("return");case 2:return t=this.storageArr,this.storageArr=[],i.prev=4,i.next=7,this.logStorage.addLogs(t);case 7:i.next=11;break;case 9:i.prev=9,i.t0=i.catch(4);case 11:case"end":return i.stop()}}),_callee,this,[[4,9]])})))},t.clearTimer=function clearTimer(){this.timer&&clearTimeout(this.timer),this.timer=0},t.setTimer=function setTimer(){var t;this.clearTimer(),this.timer=vo(bind$1(t=this.triggerTimer).call(t,this),5e3)},t.triggerTimer=function triggerTimer(){this.clearTimer(),this.saveLogs()},t.formatArgs=function formatArgs(t,i){var u=new Date;return"[NIM "+this.iid+" "+i+" "+(u.getMonth()+1+"-"+u.getDate()+" "+u.getHours()+":"+u.getMinutes()+":"+u.getSeconds()+":"+u.getMilliseconds())+"] "+map$6(t).call(t,(function(t){return t instanceof Hl?t.toString():t instanceof Error?t&&t.message?t.message:t:"object"==typeof t?Ms(t):t})).join(" ")},t.destroy=function destroy(){this.debug=Xp,this.log=Xp,this.warn=Xp,this.error=Xp,this.saveLogs(),this.clearTimer(),this.storageArr=[],this.logStorage&&this.logStorage.close()},Logger}(),th=TypeError,rh=Object.getOwnPropertyDescriptor,nh=O&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,i){if(to(t)&&!rh(t,"length").writable)throw th("Cannot set read only .length");return t.length=i}:function(t,i){return t.length=i},ah=arrayMethodHasSpeciesSupport("splice"),oh=Math.max,ih=Math.min;_export({target:"Array",proto:!0,forced:!ah},{splice:function splice(t,i){var u,h,m,v,E,I,M=toObject(this),S=lengthOfArrayLike(M),T=toAbsoluteIndex(t,S),C=arguments.length;for(0===C?u=h=0:1===C?(u=0,h=S-T):(u=C-2,h=ih(oh(toIntegerOrInfinity(i),0),S-T)),doesNotExceedSafeInteger(S+u-h),m=arraySpeciesCreate(M,h),v=0;v<h;v++)(E=T+v)in M&&createProperty(m,v,M[E]);if(m.length=h,u<h){for(v=T;v<S-h;v++)I=v+u,(E=v+h)in M?M[I]=M[E]:deletePropertyOrThrow(M,I);for(v=S;v>S-h+u;v--)deletePropertyOrThrow(M,v-1)}else if(u>h)for(v=S-h;v>T;v--)I=v+u-1,(E=v+h-1)in M?M[I]=M[E]:deletePropertyOrThrow(M,I);for(v=0;v<u;v++)M[v+T]=arguments[v+2];return nh(M,S-h+u),m}});var sh=entryVirtual("Array").splice,ch=Array.prototype,splice=function(t){var i=t.splice;return t===ch||$(ch,t)&&i===ch.splice?sh:i};function _createForOfIteratorHelperLoose$1(t,i){var u,h=void 0!==gi&&Ru(t)||t["@@iterator"];if(h)return bind$1(u=(h=h.call(t)).next).call(u,h);if(Qs(t)||(h=function _unsupportedIterableToArray$1(t,i){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$1(t,i);var h=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===h&&t.constructor&&(h=t.constructor.name),"Map"===h||"Set"===h?bu(t):"Arguments"===h||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?_arrayLikeToArray$1(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){h&&(t=h);var m=0;return function(){return m>=t.length?{done:!0}:{done:!1,value:t[m++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayLikeToArray$1(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,h=Array(i);u<i;u++)h[u]=t[u];return h}var lh,uh=function(){function TimerManager(){this.timerList=[],this.id=1,this.timer=null,this.timeout=0}var t=TimerManager.prototype;return t.addTimer=function addTimer(t,i,u){void 0===i&&(i=0),void 0===u&&(u=1);var h=(new Date).getTime(),m=this.id;return this.timerList.push({id:m,loop:u,count:0,timeout:h+i,interval:i,callback:t}),this.id++,this.checkTimer(h),m},t.checkTimer=function checkTimer(t){if(void 0===t&&(t=(new Date).getTime()),this.removeFinished(),0!==this.timerList.length||null==this.timer){for(var i,u,h=0,m=_createForOfIteratorHelperLoose$1(this.timerList);!(i=m()).done;){var v=i.value;(0===h||h>v.timeout)&&(h=v.timeout)}if(0!==this.timerList.length)if(null===this.timer||h<this.timeout||this.timeout<t)this.timer=vo(bind$1(u=this.nowTime).call(u,this),h-t),this.timeout=h}},t.nowTime=function nowTime(){for(var t,nowTime=(new Date).getTime(),i=_createForOfIteratorHelperLoose$1(this.timerList);!(t=i()).done;){var u=t.value;nowTime>=u.timeout&&(u.callback(),u.count++,u.timeout=nowTime+u.interval)}this.clerTime(),this.checkTimer(nowTime)},t.clerTime=function clerTime(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},t.deleteTimer=function deleteTimer(t){for(var i=this.timerList.length-1;i>=0;i--){var u;if(this.timerList[i].id===t)splice(u=this.timerList).call(u,i,1)}},t.removeFinished=function removeFinished(){for(var t=this.timerList.length-1;t>=0;t--){var i,u=this.timerList[t];if(u.loop>=0&&u.count>=u.loop)splice(i=this.timerList).call(i,t,1)}},t.destroy=function destroy(){this.clerTime(),this.timerList=[],this.id=1,this.timer=null},TimerManager}(),dh=function(){function CoreAdapters(t){this.lastSuccUploadHost="",this.core=t}var t=CoreAdapters.prototype;return t.getFileUploadInformation=function getFileUploadInformation(t){return Ks.getFileUploadInformation(t)},t.request=function request(t,i,u){var h=this,m=(new Date).getTime(),v=(null==u?void 0:u.exception_service)||0;return Ks.request(t,i).catch((function(u){var E,I,M,S,T=u;throw h.core.reporter.reportTraceStart("exceptions",{user_id:h.core.options.account||(null===(I=null===(E=h.core)||void 0===E?void 0:E.auth)||void 0===I?void 0:I.account),trace_id:null===(S=null===(M=h.core.clientSocket)||void 0===M?void 0:M.socket)||void 0===S?void 0:S.sessionId,start_time:m,action:1,exception_service:v}),h.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof T.code?T.code:0,description:T.message||""+T.code,operation_type:0,target:t,context:i?Ms(i):""},{asyncParams:Ks.net.getNetworkStatus()}),h.core.reporter.reportTraceEnd("exceptions",1),u}))},t.uploadFile=function uploadFile(t,i){var u,h,m,v;return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var E,I,M,S,T,C,R,A,N,O,w,x,k,P;return ms.wrap((function _callee$(L){for(;;)switch(L.prev=L.next){case 0:M="BROWSER"===Ks.platform,S=M?t.chunkUploadHostBackupList:t.commonUploadHostBackupList,T=M?t.chunkUploadHost:t.commonUploadHost,C=indexOf(S).call(S,T),R=-1===C?concat(E=[T]).call(E,S):concat(I=[T]).call(I,slice(S).call(S,0,C),slice(S).call(S,C+1)),A=Math.max(indexOf(R).call(R,this.lastSuccUploadHost),0),N=null,O=0;case 8:if(!(O<R.length)){L.next=36;break}return w=(new Date).getTime(),x=R[(O+A)%R.length],null==i||i.update({retry_times:O}),L.prev=12,L.next=15,Ks.uploadFile(xt(xt({},t),M?{chunkUploadHost:x}:{commonUploadHost:x}));case 15:return k=L.sent,this.lastSuccUploadHost=x,"string"==typeof k.size&&(k.size=su(k.size)),"string"==typeof k.dur&&(k.dur=su(k.dur)),"string"==typeof k.w&&(k.w=su(k.w)),"string"==typeof k.h&&(k.h=su(k.h)),L.abrupt("return",k);case 24:L.prev=24,L.t0=L.catch(12),this.core.cloudStorage.nos.nosErrorCount--,N=L.t0,P=L.t0,this.core.reporter.reportTraceStart("exceptions",{user_id:this.core.options.account||(null===(h=null===(u=this.core)||void 0===u?void 0:u.auth)||void 0===h?void 0:h.account),trace_id:null===(v=null===(m=this.core.clientSocket)||void 0===m?void 0:m.socket)||void 0===v?void 0:v.sessionId,start_time:w,action:1,exception_service:3}),this.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof P.code?P.code:0,description:P.message||""+P.code,operation_type:1,target:x},{asyncParams:Ks.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("exceptions",1),this._uploadFileErrHanler(L.t0);case 33:O++,L.next=8;break;case 36:throw N;case 37:case"end":return L.stop()}}),_callee,this,[[12,24]])})))},t._uploadFileErrHanler=function _uploadFileErrHanler(t){if(t&&(t.code>200||t.errCode>200))throw t},CoreAdapters}(),ph="https://abt-online.netease.im/v1/api/abt/client/getExperimentInfo",hh="imElite_sdk_abtest_web",mh=function(){function ABTest(t,i){this.abtInfo={},this.core=t,this.config=assignOptions({isAbtestEnable:!0,abtestUrl:ph,abtestProjectKey:hh},i)}var t=ABTest.prototype;return t.setOptions=function setOptions(t){this.config=assignOptions(this.config,t)},t.abtRequest=function abtRequest(){var t,i;return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var u;return ms.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:if(this.config.isAbtestEnable){h.next=2;break}return h.abrupt("return");case 2:if(!this.abtInfo.experiments){h.next=4;break}return h.abrupt("return");case 4:if(this.config.abtestUrl){h.next=6;break}return h.abrupt("return");case 6:return h.prev=6,h.next=9,this.core.adapters.request(this.config.abtestUrl,{method:"POST",dataType:"json",headers:{sdktype:"ABTest"},data:{clientInfo:{projectKey:this.config.abtestProjectKey,appKey:this.core.options.appkey,osType:"Web",sdkVersion:"10.9.71",deviceId:this.core.config.deviceId},useLocalCache:!0}},{exception_service:7});case 9:u=h.sent,h.next=15;break;case 12:h.prev=12,h.t0=h.catch(6),this.core.logger.warn("ABTest request failed");case 15:this.abtInfo=(null===(i=null===(t=null==u?void 0:u.data)||void 0===t?void 0:t.data)||void 0===i?void 0:i.abtInfo)||{};case 16:case"end":return h.stop()}}),_callee,this,[[6,12]])})))},ABTest}(),fh=function(){function Backoff(t){void 0===t&&(t={}),this.attempts=0,this.ms=t.min||100,this.max=t.max||1e4,this.jitter=t.jitter||0,this.factor=t.factor||2}var t=Backoff.prototype;return t.duration=function duration(){var t,i=Math.pow(this.factor,this.attempts++);if(i===1/0||!isFinite(i))return 0|this.max;if(t=this.ms*i,!isFinite(t)||t>=this.max)return 0|this.max;if(this.jitter){var u=Math.random(),h=Math.floor(u*this.jitter*t);t=0==(1&Math.floor(10*u))?t-h:t+h,t=Math.max(Math.min(t,this.max),this.ms)}return 0|t},t.reset=function reset(){this.attempts=0},t.setMin=function setMin(t){this.ms=t},t.setMax=function setMax(t){this.max=t},t.setJitter=function setJitter(t){this.jitter=t},Backoff}(),gh=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"],vh=["transport not supported","client not handshaken","unauthorized"],_h=["reconnect"],yh=function(t){function BaseWebsocket(i,u,h){var m;return(m=t.call(this)||this).websocket=null,m.socketConnectTimer=0,m.url="",m.linkSSL=!0,m.core=i,m.url=u,m.linkSSL=h,m.status="disconnected",m.logger=i.logger,m.connect(),m}bt(BaseWebsocket,t);var i=BaseWebsocket.prototype;return i.connect=function connect(){var t=this;"connecting"!==this.status&&"connected"!==this.status?(this.status="connecting",this.core.adapters.request((this.linkSSL?"https":"http")+"://"+this.url+"/socket.io/1/?t="+eo(),{method:"GET",dataType:"text",timeout:this.core.options.xhrConnectTimeout||8e3},{exception_service:6}).then((function(i){if("connecting"===t.status){var u=i.data.split(":"),h=u[0];return u[1],t.sessionId=h,t.logger.log("imsocket::XHR success. status "+t.status+", "+("connecting"===t.status?"continue websocket connection":"stop websocket connection")),t._createWebsocket((t.linkSSL?"wss":"ws")+"://"+t.url+"/socket.io/1/websocket/"+h)}})).catch((function(i){if("connecting"===t.status){var u='imsocket::XHR fail. raw message: "'+(i=i||{}).message+'", code: "'+i.code+'"',h=i.code;h="v2"===get(t.core,"options.apiVersion")?i.code===Wl.V2NIM_ERROR_CODE_CONNECT_TIMEOUT?Wl.V2NIM_ERROR_CODE_CONNECT_TIMEOUT:Wl.V2NIM_ERROR_CODE_CONNECT_FAILED:408===i.code?408:415;var m=new Hl({code:h,detail:{reason:u,rawError:i}});t.logger.error(u),t.status="disconnected",t.emit("handshakeFailed",m)}}))):this.logger.warn("imsocket::socket is connecting or connected",this.status)},i.close=function close(){if(this.status="disconnected",this.websocket){this.logger.log("imsocket:: close websocket");try{this.websocket.send(this.encodePacket({type:"disconnect"}))}catch(t){this.logger.warn("imsocket::attempt to send encodePacket error",t)}try{this.websocket.close()}catch(t){this.logger.warn("imsocket::attempt to close websocket error",t)}this.clean(),this.emit("disconnect",{code:0,reason:"Active close websocket"})}},i.clean=function clean(){this.status="disconnected",clearTimeout(this.socketConnectTimer),this.websocket&&(this.socketUrl=void 0,this.websocket.onmessage=null,this.websocket.onopen=null,this.websocket.onerror=null,this.websocket.onclose=null,this.websocket=null)},i.onConnect=function onConnect(){this.status="connected",this.emit("connect"),clearTimeout(this.socketConnectTimer)},i._createWebsocket=function _createWebsocket(t){var i,u=this;this.socketConnectTimer=vo((function(){u.logger.error("imsocket::Websocket connect timeout. url: ",u.socketUrl),u.emit("handshakeFailed",new Hl({code:"v2"===get(u.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_CONNECT_TIMEOUT:415,detail:{reason:"imsocket::Websocket connect timeout. url: "+u.socketUrl}}))}),this.core.options.socketConnectTimeout||8e3),this.socketUrl=t,this.websocket=new Ks.WebSocket(t),this.websocket.onmessage=bind$1(i=this.onMessage).call(i,this),this.websocket.onclose=function(t){t=t||{},u.logger.log("imsocket::Websocket onclose done "+t.wasClean+"/"+t.code+"/"+t.reason),u.clean(),u.emit("disconnect",{code:t.code||0,reason:t.reason})},this.websocket.onerror=function(t){u.logger.error("imsocket::Websocket onerror",t),"logined"===u.core.status&&u.core.clientSocket.ping()}},i.onMessage=function onMessage(t){var i,u=this.decodePacket(t.data);if(u)switch(u.type){case"connect":this.onConnect();break;case"disconnect":this.close(),this.emit("disconnect",{code:0,reason:"MessageEvent type disconnect"});break;case"message":case"json":this.emit("message",u.data);break;case"event":u.name&&this.emit(u.name,u.args);break;case"error":"unauthorized"===u.reason?this.emit("connect_failed",u.reason):this.emit("error",u.reason),this.logger.error("imsocket::Websocket connect failed, onmessage type error. url: ",this.socketUrl),clearTimeout(this.socketConnectTimer),this.emit("handshakeFailed",new Hl({code:"v2"===get(this.core,"options.apiVersion")?Wl.V2NIM_ERROR_CODE_CONNECT_FAILED:408,detail:{reason:"imsocket::Websocket connect failed, onMessage socket error. url: "+this.socketUrl}}));break;case"heartbeat":null===(i=this.websocket)||void 0===i||i.send(this.encodePacket({type:"heartbeat"}));break;default:this.logger.warn("imsocket::Websocket no handler type",u.type)}},i.encodePacket=function encodePacket(t){var i,u,h=t.type,m=t.id,v=void 0===m?"":m,E=t.endpoint,I=void 0===E?"":E,M=t.ack,S=null;if(!h)return"";switch(h){case"error":i=t.reason?indexOf(vh).call(vh,t.reason):"",u=t.advice?indexOf(_h).call(_h,t.advice):"",""===i&&""===u||(S=i+(""!==u?"+"+u:""));break;case"message":""!==t.data&&(S=t.data);break;case"event":i={name:t.name},i=t.args&&t.args.length?{name:t.name,args:t.args}:{name:t.name},S=Ms(i);break;case"json":S=Ms(t.data);break;case"connect":t.qs&&(S=t.qs);break;case"ack":S=t.ackId+(t.args&&t.args.length?"+"+Ms(t.args):"")}var T=[indexOf(gh).call(gh,h),v+("data"===M?"+":""),I];return null!=S&&T.push(S),T.join(":")},i.decodePacket=function decodePacket(t){if(t)if("�"!=t.charAt(0)){var i=t.match(/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/);if(i){var u,h=i[1],m=i[2],v=i[3],E=i[4],I=i[5],M={type:gh[+h],endpoint:E};switch(m&&(M.id=m,M.ack=!v||"data"),M.type){case"error":u=I.split("+"),M.reason=vh[+u[0]]||"";break;case"message":M.data=I||"";break;case"connect":M.qs=I||"";break;case"event":try{var S=JSON.parse(I);M.name=S.name,M.args=S.args}catch(t){this.logger.error("imsocket::parseData::type::event error",t)}M.args=M.args||[];break;case"json":try{M.data=JSON.parse(I)}catch(t){this.logger.error("imsocket::parseData::type::json error",t)}break;case"ack":if((u=I.match(/^([0-9]+)(\+)?(.*)/))&&(M.ackId=u[1],M.args=[],u[3]))try{M.args=u[3]?JSON.parse(u[3]):[]}catch(t){this.logger.error("imsocket::parseData::type::ack error",t)}}return M}}else this.logger.error("imsocket::unrecognize dataStr",slice(t).call(t,0,20))},i.send=function send(t){var i,u={data:t,type:"message",endpoint:""};null===(i=this.websocket)||void 0===i||i.send(this.encodePacket(u))},BaseWebsocket}(_o);function uniq(t){t=t||[];for(var i=[],u=0;u<t.length;u++)-1===indexOf(i).call(i,t[u])&&i.push(t[u]);return i}function _createForOfIteratorHelperLoose(t,i){var u,h=void 0!==gi&&Ru(t)||t["@@iterator"];if(h)return bind$1(u=(h=h.call(t)).next).call(u,h);if(Qs(t)||(h=function _unsupportedIterableToArray(t,i){if(t){var u;if("string"==typeof t)return _arrayLikeToArray(t,i);var h=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===h&&t.constructor&&(h=t.constructor.name),"Map"===h||"Set"===h?bu(t):"Arguments"===h||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?_arrayLikeToArray(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){h&&(t=h);var m=0;return function(){return m>=t.length?{done:!0}:{done:!1,value:t[m++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayLikeToArray(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,h=Array(i);u<i;u++)h[u]=t[u];return h}!function(t){t[t.ACTIVE=1]="ACTIVE",t[t.KICKED=2]="KICKED",t[t.OFFLINE=3]="OFFLINE"}(lh||(lh={}));var Eh=function(){function V1ClientSocket(t,i){this.linkUrls=[],this.isAutoReconnect=!1,this.packetTimeout=3e4,this.linkSSL=!0,this.packetSer=1,this.retryCount=0,this.reconnectTimer=0,this.backoff=new fh({max:8e3,min:1600,jitter:.01}),this.sendingCmdMap=new Ic,this.pingTimer=0,this.hasNetworkListener=!1,this.core=t,i&&(this.auth=i),this.logger=t.logger,this.reporter=t.reporter,this.timerManager=t.timerManager}var t=V1ClientSocket.prototype;return t.setSessionId=function setSessionId(t){},t.setLinkSSL=function setLinkSSL(t){this.linkSSL=t},t.connect=function connect(t,i){return void 0===t&&(t={}),__awaiter(this,void 0,void 0,ms.mark((function _callee(){var u,h,m,v,E,I;return ms.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:if(validate({linkUrls:{type:"array",itemType:"string",required:!1}},t),/^(unconnected|waitReconnect)$/.test(this.core.status)){M.next=5;break}return u="Core socket status is "+this.core.status+", and would not connect",this.logger.warn(u),M.abrupt("return",Ja.reject(u));case 5:this.core.status="connecting",t.linkUrls&&t.linkUrls.length>0&&(this.linkUrls=concat(h=t.linkUrls).call(h,this.linkUrls),this.linkUrls=uniq(this.linkUrls)),0===this.linkUrls.length&&this.linkUrls.push("weblink.netease.im:443"),m=0;case 9:if(!(m<this.linkUrls.length)){M.next=31;break}return v=this.linkUrls[m],E=(new Date).getTime(),M.prev=12,M.next=15,this.doConnect(v);case 15:return this.core.status="connected",this.logger.log("clientsocketV1::connect success with url: "+v),M.abrupt("return",v);case 20:M.prev=20,M.t0=M.catch(12),I=M.t0,i&&i(I,v),this.reporter.reportTraceStart("exceptions",{user_id:this.core.options.account,start_time:E,action:0,exception_service:6}),this.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof I.code?I.code:0,description:I.message||""+I.code,operation_type:0,target:v},{asyncParams:Ks.net.getNetworkStatus()}),this.reporter.reportTraceEnd("exceptions",1),this.logger.warn("clientsocketV1::connect failed with url: "+v,M.t0);case 28:m++,M.next=9;break;case 31:throw 0===this.retryCount?this.doDisconnect(lh.ACTIVE,"SocketHandshakeFailed"):this.doDisconnect(lh.OFFLINE,"ReconnectHadRetryAllLinks"),new Error("clientSocketV1::socket xhr or socket connect failed");case 33:case"end":return M.stop()}}),_callee,this,[[12,20]])})))},t.doConnect=function doConnect(t){var i=this,u=!1;return new Ja((function(h,m){var v;i.socket=new yh(i.core,t,i.linkSSL),i.socket.on("connect",(function(){i.logger.log("clientSocketV1::on connect",t),i.core.reporterHookLinkKeep&&(i.core.reporterHookLinkKeep.start(),i.core.reporterHookLinkKeep.update({code:0,description:"connection begin",operation_type:0,target:t})),u=!0,h()})),i.socket.on("message",bind$1(v=i.onMessage).call(v,i)),i.socket.on("disconnect",(function(h){return __awaiter(i,void 0,void 0,ms.mark((function _callee2(){return ms.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:if(this.logger.log("clientSocketV1::socket on disconnect",h),!this.core.reporterHookLinkKeep){i.next=5;break}return i.next=4,this.core.reporterHookLinkKeep.update({code:(null==h?void 0:h.code)||0,description:(null==h?void 0:h.reason)||"socket on disconnect",operation_type:1,target:t});case 4:this.core.reporterHookLinkKeep.end(!1);case 5:u=!0,this.doDisconnect(lh.OFFLINE,"SocketOnDisconnect");case 7:case"end":return i.stop()}}),_callee2,this)})))})),i.socket.on("handshakeFailed",(function(t){u?i.ping():(i.logger.error('clientsocketV1::handshake failed: "'+(t&&t.message)+'"'),i.cleanSocket()),u=!0,m(t)}))}))},t.cleanSocket=function cleanSocket(){this.socket&&("function"==typeof this.socket.removeAllListeners&&this.socket.removeAllListeners(),"function"==typeof this.socket.close&&this.socket.close(),this.socket=void 0)},t.beforeConnect=function beforeConnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer)},t.resetConnectStatus=function resetConnectStatus(){clearTimeout(this.reconnectTimer),this.backoff.reset(),this.retryCount=0,this.initOnlineListener()},t.doDisconnect=function doDisconnect(t,i,u){var h,m,v,E,I;if(this.logger.log("doDisconnect:type:"+t+",description:"+i),"unconnected"!==this.core.status){var M={1:"close",2:"kicked",3:"broken"}[t]||"";this.markAllCmdInvaild(new Hl({code:415,desc:"Packet timeout due to instance disconnect",detail:{reason:"Packet timeout due to instance disconnect",disconnect_reason:M}})),this.timerManager.destroy(),clearTimeout(this.pingTimer),this.cleanSocket();var S=!this.core.options.needReconnect||this.retryCount>=this.core.options.reconnectionAttempts;if(t===lh.ACTIVE||S)this.logger.log("doDisconnect: emit disconnect, type "+t,S),this.core.status="unconnected",this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.core.eventBus.emit("disconnect"),this.core.emit("disconnect"),null===(h=this.auth)||void 0===h||h.emit("disconnect"),this.destroyOnlineListener();else if(t===lh.KICKED){this.logger.log("doDisconnect: kicked"),this.core.status="unconnected",this.reconnectTimer&&clearTimeout(this.reconnectTimer);var T="string"==typeof i?{reason:"unknow",message:i}:i;this.core.eventBus.emit("kicked",T),this.core.emit("kicked",T),null===(m=this.auth)||void 0===m||m.emit("kicked",T),this.destroyOnlineListener()}else t===lh.OFFLINE&&this.core.V1NIMLoginService.isManualLoginAttempt?(this.logger.log("doDisconnect: offline in manual login phase. no reconnect"),this.core.status="unconnected",this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.destroyOnlineListener()):t===lh.OFFLINE&&(null===(E=null===(v=this.auth)||void 0===v?void 0:v.authenticator)||void 0===E?void 0:E.checkLoginTerminalCode(null==u?void 0:u.code))?(this.logger.log("doDisconnect: login terminal code "+(null==u?void 0:u.code)+", no reconnect"),this.core.status="unconnected",this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.destroyOnlineListener(),this.core.eventBus.emit("disconnect"),this.core.emit("disconnect"),null===(I=this.auth)||void 0===I||I.emit("disconnect")):t===lh.OFFLINE?(this.logger.log("doDisconnect: start to reconnect"),this.attempToReconnect()):this.logger.log("doDisconnect: nothing to do")}else this.logger.warn("doDisconnect:already unconnected")},t.attempToReconnect=function attempToReconnect(){var t,i,u=this;if("waitReconnect"!==this.core.status){0===this.retryCount&&(this.core.eventBus.emit("disconnect"),this.core.emit("disconnect"),null===(t=this.auth)||void 0===t||t.emit("disconnect"));var h=this.backoff.duration();this.retryCount++,this.logger.log("willReconnect "+this.retryCount+" "+h),this.core.eventBus.emit("willReconnect",{retryCount:this.retryCount,duration:h}),this.core.emit("willReconnect",{retryCount:this.retryCount,duration:h}),null===(i=this.auth)||void 0===i||i.emit("willReconnect",{retryCount:this.retryCount,duration:h}),this.core.status="waitReconnect",this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=vo((function(){return __awaiter(u,void 0,void 0,ms.mark((function _callee3(){var t=this;return ms.wrap((function _callee3$(i){for(;;)switch(i.prev=i.next){case 0:if("waitReconnect"===this.core.status){i.next=3;break}return this.logger.warn("doDisconnect: reconnectTimer status is "+this.core.status+", would not go on reconnecting"),i.abrupt("return");case 3:return i.next=5,Ks.net.getNetworkStatus();case 5:!1===i.sent.net_connect?(this.logger.log("doDisconnect: skip this reconnection attempt because network is offline"),this.core.status="connecting",this.retryCount>=this.core.options.reconnectionAttempts?this.doDisconnect(lh.OFFLINE,"MaxReconnectionAttemptExceed"):this.attempToReconnect()):this.core.V1NIMLoginService.login({isAutoReconnect:!0}).catch((function(){t.logger.error("clientsocketV1::attempToReconnect failed "+t.retryCount)}));case 7:case"end":return i.stop()}}),_callee3,this)})))}),h)}else this.logger.warn("doDisconnect: already is waiting reconnect")},t.sendCmd=function sendCmd(t,i,u){var h=this;if("logined"!==this.core.status&&"login"!==t&&"chatroomLogin"!==t&&"qchatLogin"!==t)return this.logger.warn("instance status is "+this.core.status+", so can not sendCmd "+t),Ja.reject({cmd:t,error:{code:"No_connected",message:"Connection not established",timetag:(new Date).getTime()}});if(!this.socket||!this.socket.send)return Ja.reject("No_socket");var m="heartbeat"!==t,v=m?this.packetSer++:0,E=function createCmd(t,i,u,h){var m=xu[t];if(!m)return u.error("createCmd:: can not find cmd config: ",t),null;var v,E={SER:i,SID:m.sid,CID:m.cid,Q:[]};return m.params&&h&&forEach$1(v=m.params).call(v,(function(t){var i=h[t.name];if(null!=i){var u=t.type,m=t.reflectMapper,v=t.select;switch(t.type){case"PropertyArray":u="ArrayMable",i=map$6(i).call(i,(function(t){return{t:"Property",v:m?serialize(t,m,v):t}}));break;case"Property":i=m?serialize(i,m,v):i;break;case"Bool":i=i?"true":"false"}E.Q.push({t:u,v:i})}})),{packet:E,hasPacketResponse:"boolean"!=typeof m.hasPacketResponse||m.hasPacketResponse,hasPacketTimer:"boolean"!=typeof m.hasPacketTimer||m.hasPacketTimer}}(t,v,this.logger,i);if(!E){var I="SendCmd "+v+" "+t+" error";return this.logger.error(I),Ja.reject(new Error(I))}var M=E.packet,S=E.hasPacketResponse,T=E.hasPacketTimer,C=Ms(M);m&&(this.logger.getDebugMode()?this.logger.debug("clientsocketV1::sendCmd",t,"ser:"+v,C):this.logger.log("clientsocketV1::sendCmd",t,"ser:"+v));var R=(new Date).getTime();return new Ja((function(m,E){S&&h.sendingCmdMap.set(v,{cmd:t,params:i,callback:[m,E],timer:T?vo((function(){var i=new Hl({code:408,desc:"Packet Timeout",detail:{reason:"Packet Timeout",cmd:t,ser:v,timetag:eo()}});h.markCmdInvalid(v,i,t)}),u&&u.timeout?u.timeout:h.core.config.timeout):null});try{h.socket.send(C),S||m(M)}catch(i){var I=new Hl({code:415,detail:{reason:i&&i.message||"Unable to send packet",cmd:t,ser:v,timetag:eo(),rawError:i}});h.markCmdInvalid(v,I,t),E(i)}})).catch((function(t){var i,u=[408,415];if(!includes(u).call(u,t.code))return Ja.reject(t);h.reporter.reportTraceStart("exceptions",{user_id:h.core.options.account,trace_id:null===(i=h.socket)||void 0===i?void 0:i.sessionId,start_time:R,action:2,exception_service:6});var m=get(t,"data.disconnect_reason")||"",v=408===t.code?"Send failed due to timeout":"Send failed. Reason unknown";return v=415===t.code?Ms({disconnect_reason:m}):v,h.reporter.reportTraceUpdateV2("exceptions",{code:t.code||415,description:v,operation_type:1,target:M.SID+"-"+M.CID,context:""+M.SER},{asyncParams:Ks.net.getNetworkStatus()}),h.reporter.reportTraceEnd("exceptions",1),Ja.reject(t)}))},t.onMessage=function onMessage(t){var i=function parseCmd(t,i){var u,h;try{h=JSON.parse(t)}catch(u){return void i.error('Parse command error:"'+t+'"')}var m=h.sid+"_"+h.cid,v=h.r;if(includes(u=["4_1","4_2","4_10","4_11"]).call(u,m)){var E=h.r[1].headerPacket;m=E.sid+"_"+E.cid,h.sid=E.sid,h.cid=E.cid,v=h.r[1].body}var I=ku[m],M=[];if(I&&I.length>0){for(var S,T=_createForOfIteratorHelperLoose$4(I);!(S=T()).done;){var C=S.value;M.push(parseEachCmd(h,C.config,C.cmd,v,i))}return M}i.error("parseCmd:: mapper not exist",m,h.code)}(t,this.logger);if(i&&i.length>0){var u=i[0],h=u.raw.ser;u.error&&this.logger.error("core:onMessage packet error",u.raw.sid+"_"+u.raw.cid+", ser:"+h+",",u.error),"heartbeat"!==u.cmd&&(this.logger.getDebugMode()?this.logger.debug("imsocket::recvCmd ser:"+h,u.cmd,u.content):this.logger.log("imsocket::recvCmd ser:"+h,u.cmd));for(var m,v=_createForOfIteratorHelperLoose(i);!(m=v()).done;){var E=m.value;this.packetHandler(E)}}},t.packetHandler=function packetHandler(t){var i,u,h,m,v=this;if(t){var E=t.raw.ser,I=this.sendingCmdMap.get(E);if(I&&I.cmd===t.cmd){var M=I.callback,S=I.timer,T=I.params;if(clearTimeout(S),t.params=T,this.sendingCmdMap.delete(E),"heartbeat"===t.cmd)return void M[0]();var C=null===(u=null===(i=this.core[t.service])||void 0===i?void 0:i.process)||void 0===u?void 0:u.call(i,t);C&&"function"==typeof C.then?C.then((function(t){M[0](t)})).catch((function(t){M[1](t)})):(this.logger.log("imsocket:: handlerFn without promise",t.service,t.cmd),M[0]())}else{var R=null===(m=null===(h=this.core[t.service])||void 0===h?void 0:h.process)||void 0===m?void 0:m.call(h,t);R&&"function"==typeof R.then&&R.catch((function(t){v.logger.error("imsocket::no obj cache, no process handler",t)}))}}},t.markCmdInvalid=function markCmdInvalid(t,i,u){var h=this.sendingCmdMap.get(t);if(h){var m=h.callback,v=h.timer;v&&clearTimeout(v),this.sendingCmdMap.delete(t),this.logger.warn("packet "+t+", "+u+" is invalid:",i),m[1](i)}},t.markAllCmdInvaild=function markAllCmdInvaild(t){var i,u=this;this.logger.log("markAllCmdInvaild",t),forEach$1(i=this.sendingCmdMap).call(i,(function(i){var h=i.callback,m=i.timer,v=i.cmd;u.logger.log('markAllCmdInvaild:: cmd "'+v+'"'),m&&clearTimeout(m),h[1](t)})),this.sendingCmdMap.clear()},t.ping=function ping(){var t;return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){var i=this;return ms.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return clearTimeout(this.pingTimer),u.prev=1,u.next=4,this.sendCmd("heartbeat");case 4:u.next=18;break;case 6:return u.prev=6,u.t0=u.catch(1),u.next=10,this.testHeartBeat5Timeout();case 10:if(!u.sent){u.next=18;break}if(!this.core.reporterHookLinkKeep){u.next=16;break}return u.next=15,this.core.reporterHookLinkKeep.update({code:0,description:"Heartbeat-discovered link failure",operation_type:1,target:null===(t=this.socket)||void 0===t?void 0:t.url});case 15:this.core.reporterHookLinkKeep.end(!0);case 16:return this.doDisconnect(lh.OFFLINE,"PingError"),u.abrupt("return");case 18:this.pingTimer=vo((function(){i.ping()}),3e4);case 19:case"end":return u.stop()}}),_callee4,this,[[1,6]])})))},t.testHeartBeat5Timeout=function testHeartBeat5Timeout(){return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var t;return ms.wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:clearTimeout(this.pingTimer),t=0;case 2:if(!(t<5)){i.next=15;break}return i.prev=3,i.next=6,this.sendCmd("heartbeat",{},{timeout:3e3});case 6:return i.abrupt("return",!1);case 9:i.prev=9,i.t0=i.catch(3),this.logger.log("clientsocketV1:: test heartbeat "+t+" Timeout");case 12:t++,i.next=2;break;case 15:return i.abrupt("return",!0);case 16:case"end":return i.stop()}}),_callee5,this,[[3,9]])})))},t.initOnlineListener=function initOnlineListener(){var t=this;this.hasNetworkListener||(this.logger.log("clientsocketV1::onlineListener:init"),this.hasNetworkListener=!0,Ks.net.onNetworkStatusChange((function(i){t.logger.log("clientsocketV1::onlineListener:network change",i),i.isConnected&&"logined"===t.core.status?t.ping():i.isConnected&&"waitReconnect"===t.core.status?(t.reconnectTimer&&clearTimeout(t.reconnectTimer),t.core.V1NIMLoginService.login({isAutoReconnect:!0}).catch((function(){t.logger.error("clientsocketV1::attempToReconnect failed "+t.retryCount)}))):i.isConnected||t.doDisconnect(lh.OFFLINE,"OfflineListener")})))},t.destroyOnlineListener=function destroyOnlineListener(){this.logger.log("clientsocketV1::onlineListener:destroy"),Ks.net.offNetworkStatusChange(),this.hasNetworkListener=!1},t.disconnect=function disconnect(){switch(this.core.status){case"connected":case"logined":case"connecting":case"waitReconnect":return this.doDisconnect(lh.ACTIVE,"UserActiveDisconnect"),Ja.resolve();default:return Ja.resolve()}},V1ClientSocket}(),Ih={"1_2":"heartbeat","24_2":"qchatLogin","24_4":"qchatExit","24_5":"qchatBeKicked","24_8":"qchatLoginClientChange","24_9":"qchatKick","24_19":"qchatSync"},Mh={qchatLoginTag:{appkey:1,account:2,authType:3,token:4,loginExt:5,clientType:6,clientSession:7,deviceId:8,sdkVersion:9,sdkType:10,userAgent:11,customTag:12,customClientType:13,sdkHumanVersion:14,pushTokenName:20,pushToken:21,pushkitTokenName:22,pushkitToken:23,deviceInfo:24,customPushContentType:25,os:30,mac:31,bundleId:32,simCarrierCode:33,simCountryCode:34,networkCode:35,browser:36,deviceModel:37,androidid:38,imei:39,idfv:40,openuuid:41,pushType:100,hasTokenPreviously:101,consid:102,clientIP:103,clientPort:104,loginTime:105}},Sh=function getCmdConfig(){var t=function getDeserializeTag(){return invertSerializeMap(Mh)}();return{heartbeat:{sid:1,cid:2,service:"qchatAuth"},qchatLogin:{sid:24,cid:2,service:"qchatAuth",params:[{type:"Property",name:"qchatLoginReqTag",reflectMapper:Mh.qchatLoginTag}],response:[{type:"Property",name:"qchatLoginResTag",reflectMapper:t.qchatLoginTag},{type:"PropertyArray",name:"qchatMultiLoginResult",reflectMapper:t.qchatLoginTag}]},qchatExit:{sid:24,cid:4,service:"qchatAuth"},qchatBeKicked:{sid:24,cid:5,service:"qchatAuth",response:[{type:"Property",name:"beKickedTag",reflectMapper:{1:"clientType",2:"reason",3:"ext",4:"customClientType"}}]},qchatLoginClientChange:{sid:24,cid:8,service:"qchatAuth",response:[{type:"Byte",name:"state"},{type:"Property",name:"qchatLoginResTag",reflectMapper:t.qchatLoginTag}]},qchatKick:{sid:24,cid:9,service:"qchatAuth",params:[{type:"StrArray",name:"deviceIds"}],response:[{type:"StrArray",name:"deviceIds"}]},qchatSync:{sid:24,cid:19,service:"qchatAuth",hasPacketTimer:!1,params:[{type:"Property",name:"qchatSyncTag",reflectMapper:{systemNotification:1,pushConfig:2}}],response:[{type:"Long",name:"timetag"}]}}};function formatLoginInfo(t,i){void 0===i&&(i=1);var u=format({clientPort:{type:"number"},clientType:{type:"enum",values:_p},customClientType:{type:"number"},loginTime:{type:"number"},hasTokenPreviously:{type:"boolean"},pushType:{type:"number"}},t);return xt(xt({},u),{online:2!==i})}var Th={1:{reason:"samePlatformKick",message:"The same account is not allowed to multiple login at the same time"},2:{reason:"serverKick",message:"Kicked out by IM server"},3:{reason:"otherPlatformKick",message:"Kicked out by other client of your account"},4:{reason:"silentlyKick",message:"Quietly kicked"}};var Ch={BROWSER:0,RN:2,UNIAPP:3,WECHAT:6},bh=function(){function V1AuthAuthenticatorService(t){this.core=t}return V1AuthAuthenticatorService.prototype.verifyAuthentication=function verifyAuthentication(t){return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,ms.mark((function _callee(){var i,u,h,m,v,E,I;return ms.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:return i=this.core.options,u=Ks.getSystemInfo(),h=xt(xt({},i),{appLogin:t?0:1,clientType:16,clientSession:this.core.config.clientSession,deviceId:this.core.config.deviceId,sdkVersion:100971,sdkType:Ch[Ks.platform]||0,userAgent:"Native/10.9.71",sdkHumanVersion:"10.9.71",os:u.os,browser:u.browser}),M.next=5,this.core.sendCmd("qchatLogin",{qchatLoginReqTag:h});case 5:if(!(m=M.sent).error){M.next=8;break}throw m.error;case 8:return v=m.content,E=v.qchatLoginResTag,I=v.qchatMultiLoginResult,E.isAutoReconnect=t,M.abrupt("return",{loginResult:formatLoginInfo(E),multiLoginResults:map$6(I).call(I,(function(t){return formatLoginInfo(t)}))});case 11:case"end":return M.stop()}}),_callee,this)})))},V1AuthAuthenticatorService}(),Rh=function(t){function QChatAuthService(i){var u;return(u=t.call(this,"qchatAuth",i)||this).account="",u.token="",u.deviceId="",u.isManualLoginAttempt=!1,registerParser({cmdMap:Ih,cmdConfig:Sh()}),u.authenticatorService=new bh(i),u}bt(QChatAuthService,t);var i=QChatAuthService.prototype;return i.login=function login(t){return void 0===t&&(t={}),__awaiter(this,void 0,void 0,ms.mark((function _callee(){return ms.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:return t.isAutoReconnect||(this.isManualLoginAttempt=!0),i.next=3,this._connect(t);case 3:return this.core.abtest.abtRequest(),i.prev=4,i.next=7,this.doLogin(t.isAutoReconnect);case 7:this.isManualLoginAttempt=!1,i.next=14;break;case 10:throw i.prev=10,i.t0=i.catch(4),this.isManualLoginAttempt=!1,i.t0;case 14:case"end":return i.stop()}}),_callee,this,[[4,10]])})))},i._connect=function _connect(t){return void 0===t&&(t={}),__awaiter(this,void 0,void 0,ms.mark((function _callee2(){var i,u;return ms.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:if(/^(unconnected|waitReconnect)$/.test(this.core.status)){h.next=4;break}return i="Instance status is "+this.core.status+", and would not connect",this.logger.warn(i),h.abrupt("return",Ja.reject(i));case 4:return this.core.clientSocket.beforeConnect(),u=t.isAutoReconnect||!1,h.next=8,this.core.clientSocket.connect({linkUrls:this.core.options.linkAddresses,isAutoReconnect:u});case 8:case"end":return h.stop()}}),_callee2,this)})))},i.doLogin=function doLogin(t){var i;return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,ms.mark((function _callee3(){var u;return ms.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return h.prev=0,h.next=3,this.authenticatorService.verifyAuthentication(t);case 3:u=h.sent,this.core.status="logined",h.next=14;break;case 7:if(h.prev=7,h.t0=h.catch(0),this.core.logger.warn("doLogin:: login failed",h.t0),this.core.clientSocket.doDisconnect(lh.OFFLINE,this.isManualLoginAttempt?"FailedToInitializeLogin":"ReconnectLoginFailed"),!this.isManualLoginAttempt){h.next=13;break}throw h.t0;case 13:return h.abrupt("return");case 14:return h.prev=14,h.next=17,this.core.cloudStorage.init(null===(i=u.loginResult)||void 0===i?void 0:i.loginTime);case 17:h.next=22;break;case 19:h.prev=19,h.t1=h.catch(14),this.core.logger.error("doLogin:: cloudStorage init failed ",h.t1);case 22:return this.core.eventBus.emit("logined",u.loginResult),this.core.emit("logined",u.loginResult),u.multiLoginResults&&u.multiLoginResults.length>0&&this.core.emit("multiSpotLogin",u.multiLoginResults),this.core.logger.log("login done"),this.core.clientSocket.resetConnectStatus(),h.next=29,this.sync();case 29:this.core.clientSocket.ping();case 30:case"end":return h.stop()}}),_callee3,this,[[0,7],[14,19]])})))},i.sync=function sync(){return __awaiter(this,void 0,void 0,ms.mark((function _callee4(){return ms.wrap((function _callee4$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.sendCmd("qchatSync",{qchatSyncTag:{systemNotification:this.syncTimeTag||0}});case 2:case"end":return t.stop()}}),_callee4,this)})))},i.kick=function kick(t){var i;return __awaiter(this,void 0,void 0,ms.mark((function _callee5(){var u;return ms.wrap((function _callee5$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.core.sendCmd("qchatKick",t);case 2:return u=h.sent,h.abrupt("return",null===(i=u.content)||void 0===i?void 0:i.deviceIds);case 4:case"end":return h.stop()}}),_callee5,this)})))},i.qchatSyncHandler=function qchatSyncHandler(t){var i,u;this.logger.log("sync: emit syncdone",null===(i=t.content)||void 0===i?void 0:i.timetag),this.core.emit("syncdone"),this.syncTimeTag=(null===(u=t.content)||void 0===u?void 0:u.timetag)||0},i.qchatLoginClientChangeHandler=function qchatLoginClientChangeHandler(t){if(t.error)this.logger.error("qchatLoginClientChangeHandler:: error, ",t.error);else{var i=t.content,u=formatLoginInfo(i.qchatLoginResTag,i.state);this.core.emit("multiSpotLogin",[u])}},i.qchatBeKickedHandler=function qchatBeKickedHandler(t){if(t.error)this.logger.error("qchatBeKickedHandler error, ",t.error);else{var i=function formatBeKickedTag(t){var i=format({clientType:{type:"enum",values:_p},customClientType:{type:"number"}},t),u=Th[i.reason];return xt(i,u=u||{reason:"unknow",message:"Unknown reason"})}(t.content.beKickedTag);this.logger.warn("bekicked::",i),this.core.clientSocket.doDisconnect(lh.KICKED,i)}},QChatAuthService}(vd),Ah={user_id:"",trace_id:"",action:7,exception_service:6,duration:0,start_time:0,state:1,extension:[]},Nh=function(){function ReporterHookLinkKeep(t,i){this.traceData=Ah,this.core=t,this.traceData=xt({},Ah,i),this.traceData.extension=[]}var t=ReporterHookLinkKeep.prototype;return t.reset=function reset(){this.traceData=xt({},Ah),this.traceData.extension=[]},t.start=function start(){var t,i;this.reset(),this.traceData.user_id=this.core.account,this.traceData.trace_id=(null===(i=null===(t=this.core.clientSocket)||void 0===t?void 0:t.socket)||void 0===i?void 0:i.sessionId)||"",this.traceData.start_time=(new Date).getTime()},t.update=function update(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i,u,h;return ms.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,Ks.net.getNetworkStatus();case 2:i=m.sent,u=i.net_type,h=i.net_connect,this.traceData.extension.push(xt({code:0,foreground:!0,foreg_backg_switch:!1,net_type:u,net_connect:h},t));case 6:case"end":return m.stop()}}),_callee,this)})))},t.end=function end(t){var i=this.traceData.extension[0],u=this.traceData.extension[1];if(i&&0===i.operation_type&&u&&1===u.operation_type){var h=i.net_type!==u.net_type||i.net_connect!==u.net_connect;if(t||!h)return this.traceData.duration=(new Date).getTime()-this.traceData.start_time,this.core.reporter.report("exceptions",this.traceData),void this.reset();this.reset()}else this.reset()},ReporterHookLinkKeep}();function getIsDataReportEnable(t){var i,u,h=!0;return"boolean"==typeof(null===(i=null==t?void 0:t.reporterConfig)||void 0===i?void 0:i.enableCompass)?h=t.reporterConfig.enableCompass:"boolean"==typeof(null===(u=null==t?void 0:t.reporterConfig)||void 0===u?void 0:u.isDataReportEnable)&&(h=t.reporterConfig.isDataReportEnable),h}function getCompassDataEndpoint(t,i){var u,h,m=null===(u=null==i?void 0:i.reporterConfig)||void 0===u?void 0:u.compassDataEndpoint,v=null===(h=null==i?void 0:i.reporterConfig)||void 0===h?void 0:h.reportConfigUrl;if(m)return m;if(v){var E=v.match(/^https:\/\/([^/]+)\/*/);if(Qs(E)&&E.length>=1)return"https://"+E[1];t.error("Invalid reportConfigUrl: "+v)}return function pendingIsMiniappEnv(){var t=Ks.getSystemInfo().hostEnvEnum;return 6===t||102===t||103===t||104===t}()?"https://statistic.live.126.net":"https://statistic.live.126.net,https://statistic-overseas.yunxinfw.com"}var Oh={debugLevel:"off",needReconnect:!0,reconnectionAttempts:9007199254740991,isAbtestEnable:!0,abtestUrl:ph,abtestProjectKey:hh},wh=function(t){function QChat(i,u){var m;void 0===u&&(u={cloudStorageConfig:{}}),(m=t.call(this)||this).instanceName="QChat",m.status="unconnected",m.account="",m.eventBus=new _o,m.options={},m.qchatServer={},m.qchatChannel={},m.qchatMsg={},m.qchatRole={},m.qchatMedia={},m.cloudStorage={},m.logger=new eh(i.debugLevel,u.loggerConfig),m.setInitOptions(i),m.otherOptions=u,m.timerManager=new uh,m.adapters=new dh(h(m)),m.abtest=new mh(h(m),{isAbtestEnable:m.options.isAbtestEnable,abtestUrl:m.options.abtestUrl,abtestProjectKey:hh});var v="",E="";m.options.isFixedDeviceId?(v=Ks.localStorage.getItem("__QCHAT_DEVC_ID__")||lu(),E=Ks.localStorage.getItem("__QCHAT_CLIENT_SESSION_ID__")||lu(),Ks.localStorage.setItem("__QCHAT_DEVC_ID__",v),Ks.localStorage.setItem("__QCHAT_CLIENT_SESSION_ID__",E)):(v=lu(),E=lu()),m.config={timeout:8e3,deviceId:v,clientSession:E};var I=Ks.getSystemInfo(),M=getCompassDataEndpoint(m.logger,m.otherOptions);return m.reporter=new ls(xt(xt({},M?{compassDataEndpoint:M}:{}),{isDataReportEnable:getIsDataReportEnable(m.otherOptions),common:{app_key:i.appkey,dev_id:v,platform:"Web",sdk_ver:"10.9.71",env:"online",os_name:I.os,os_ver:I.osVer,model:I.hostEnvVer,manufactor:I.hostEnv,host_env:I.hostEnv,host_env_ver:I.hostEnvVer,v2:!1},request:Ks.request,logger:m.logger,autoStart:!0})),m.reporterHookLinkKeep=new Nh(h(m)),Ks.setLogger(m.logger),m.qchatAuth=new Rh(h(m)),m.auth=m.qchatAuth,m.V1NIMLoginService=m.qchatAuth,m.clientSocket=new Eh(h(m)),m.qchatServer=new Kd(h(m)),m.qchatChannel=new Ep(h(m),u.qchatChannelConfig),m.qchatMsg=new Yp(h(m)),m.qchatRole=new bp(h(m)),m.qchatMedia=new zp(h(m),u.qchatMediaConfig||u.QChatMedia),m.cloudStorage=new zu(h(m),xt({storageKeyPrefix:m.instanceName},u.cloudStorageConfig)),QChat.instance=h(m),m.logger.log("QChat init, version ","10.9.71"," sdk version ",100971," appkey ",i.appkey),m}bt(QChat,t),QChat.getInstance=function getInstance(t,i){if(!QChat.instance){if(t)return new QChat(t,i);throw new Error("Instance not exist, please input options")}if(t){if(QChat.instance.options.account===t.account&&QChat.instance.options.appkey===t.appkey)return QChat.instance.setOptions(t),QChat.instance;throw new Error("Unexpected login")}return QChat.instance};var i=QChat.prototype;return i.connect=function connect(t){return void 0===t&&(t={}),this.auth.login(t)},i.login=function login(t){return void 0===t&&(t={}),this.auth.login(t)},i.setInitOptions=function setInitOptions(t){validate({account:{type:"string"},appkey:{type:"string"},token:{type:"string"},linkAddresses:{type:"array",itemType:"string",min:1},needReconnect:{type:"boolean",required:!1},reconnectionAttempts:{type:"number",required:!1},debugLevel:{type:"enum",values:Zp,required:!1}},t),this.logger.log("QChat::setInitOptions options is",t),this.account=t.account,this.options=xt(xt({},Oh),t)},i.setOptions=function setOptions(t){if("object"==typeof t&&null!==t&&(Object.prototype.hasOwnProperty.call(t,"account")&&t.account!==this.options.account||Object.prototype.hasOwnProperty.call(t,"appkey")&&t.appkey!==this.options.appkey))throw new Error("QChat::setOptions account and appkey is not allowed to reset");validate({token:{type:"string",required:!1},linkAddresses:{type:"array",itemType:"string",min:1,required:!1},needReconnect:{type:"boolean",required:!1},reconnectionAttempts:{type:"number",required:!1},debugLevel:{type:"enum",values:Zp,required:!1}},t),this.logger.log("QChat::setOptions options is",t),this.options=xt(xt({},this.options),t)},i.disconnect=function disconnect(){var t=this;switch(this.status){case"logined":return this.sendCmd("qchatExit",void 0,{timeout:1e3}).then((function(){t.clientSocket.doDisconnect(lh.ACTIVE,"UserActiveDisconnect")})).catch((function(i){t.logger.error("Instance::disconnect sendCmd:logout error",i),t.clientSocket.doDisconnect(lh.ACTIVE,"UserActiveDisconnect")}));case"connected":case"connecting":case"waitReconnect":return this.clientSocket.doDisconnect(lh.ACTIVE,"UserActiveDisconnect"),Ja.resolve();case"unconnected":case"destroyed":return Ja.resolve()}},i.logout=function logout(){return this.disconnect()},i.destroy=function destroy(){var t=this;return QChat.instance=void 0,this.disconnect().then((function(){t.status="destroyed",t.removeAllListeners(),t.eventBus.removeAllListeners(),t.logger.destroy(),t.reporter.destroy(),t.timerManager.destroy(),t.connect=emptyFuncWithPromise,t.disconnect=emptyFuncWithPromise,t.destroy=emptyFuncWithPromise}))},i.kickOtherClients=function kickOtherClients(t){return validate({deviceIds:{type:"array",itemType:"string"}},t),this.auth.kick(t)},i.sendCmd=function sendCmd(t,i,u){return this.clientSocket.sendCmd(t,i,u)},i.emit=function emit(i){var u=this;try{for(var h,m,v=eo(),E=arguments.length,I=new Array(E>1?E-1:0),M=1;M<E;M++)I[M-1]=arguments[M];var S=(h=t.prototype.emit).call.apply(h,concat(m=[this,i]).call(m,I)),T=eo()-v;return T>=10&&this.logger.warn("Core::emit event: "+i+" process takes: "+T+"ms"),S}catch(t){return this.logger.error("Core::emit event: "+i+". Error: "+t),vo((function(){throw u.logger.error("Core::emit throw error in setTimeout. event: "+i+". Error: "+t),t}),0),!1}},QChat}(_o),xh=createCommonjsModule((function(t,i){t.exports=function(){function object2String(t){if(t){var i,u="";return forEach$1(i=es(t)).call(i,(function(i,h){u+=0===h?"?":"&",u+=i+"="+t[i]})),u}return""}var t=function(t){function V2NIMError(i,u,h,m){var v;return(v=t.call(this,h)||this).source=i,v.code=u,v.desc=h,v.detail=m||{},v}return bt(V2NIMError,t),V2NIMError}(Pc(Error));function request(i,u){void 0===u&&(u={dataType:"json",method:"GET",timeout:5e3});var h="text"===u.dataType?"text/plain; charset=UTF-8":"application/json; charset=UTF-8",m="GET"===u.method?object2String(u.params):"";return new Ja((function(v,E){if(window.XMLHttpRequest){var I,M=new XMLHttpRequest;if(M.onreadystatechange=function(){if(4===M.readyState)if(200===M.status){try{I=JSON.parse(M.response||"{}")}catch(t){I=M.response}v({status:M.status,data:I})}else vo((function(){E(new t(1,M.status,"readyState: "+M.readyState+"; statusText: "+M.statusText))}),0)},M.open(u.method,""+i+m),M.timeout=u.timeout||5e3,M.setRequestHeader("Content-Type",h),u.headers)for(var S in u.headers)M.setRequestHeader(S,u.headers[S]);M.ontimeout=function(i){E(new t(1,408,i&&i.message?i.message:"request timeout"))},M.send(Ms(u.data))}else E(new t(2,10400,"request no suppout"))}))}return request}()})),kh=createCommonjsModule((function(t,i){self,t.exports=function(){var t={d:function d(i,u){for(var h in u)t.o(u,h)&&!t.o(i,h)&&yi(i,h,{enumerable:!0,get:u[h]})},o:function o(t,i){return Object.prototype.hasOwnProperty.call(t,i)}},i={};t.d(i,{default:function _default(){return C}});var u=function e(t){for(var i in function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,e),this.directUploadAddr="https://wanproxy-web.127.net",this.retryCount=4,this.trunkSize=4194304,this.trunkUploadTimeout=0,this.getOffsetTimeout=1e4,this.version="1.0",this.enableCache=!0,this.logger=console,this.onError=function(t){},this.onProgress=function(t){},this.onUploadProgress=function(t){},this.onComplete=function(t){},this.onUploadInfo=function(t){},t)this[i]=t[i]};function n(t,i){var u=void 0!==gi&&Ru(t)||t["@@iterator"];if(!u){if(Qs(t)||(u=function(t,i){if(t){var u;if("string"==typeof t)return r(t,i);var h=slice(u=Object.prototype.toString.call(t)).call(u,8,-1);return"Object"===h&&t.constructor&&(h=t.constructor.name),"Map"===h||"Set"===h?bu(t):"Arguments"===h||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?r(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){u&&(t=u);var h=0,m=function a(){};return{s:m,n:function n(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}},e:function e(t){throw t},f:m}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var v,E=!0,I=!1;return{s:function s(){u=u.call(t)},n:function n(){var t=u.next();return E=t.done,t},e:function e(t){I=!0,v=t},f:function f(){try{E||null==u.return||u.return()}finally{if(I)throw v}}}}function r(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,h=new Array(i);u<i;u++)h[u]=t[u];return h}var h={privateObj:{},setItem:function setItem(t,i){h.privateObj[t]=i},getItem:function getItem(t){return h.privateObj[t]},removeItem:function removeItem(t){delete h.privateObj[t]},getKeys:function getKeys(){return es(h.privateObj)}},m={getFileKey:function getFileKey(t){var i=t.size.toString(),u=t.lastModified.toString();return"_NosUploader_"+t.name+slice(i).call(i,i.length-5)+slice(u).call(u,u.length-5)},getFileInfo:function getFileInfo(t){var i=h.getItem(t);if(!i)return null;try{return JSON.parse(i)}catch(t){return null}},initFile:function initFile(t,i,u){m.clearExpiredInfo();var v=this.getFileKey(i),E={ctx:void 0!==t.ctx?t.ctx:"",bucket:t.bucketName,obj:t.objectName,token:t.token,modifyAt:eo(),end:!1};return t.payload&&(E.payload=t.payload),u&&h.setItem(v,Ms(E)),v},setUploadContext:function setUploadContext(t,i,u){var m=this.getFileInfo(t);m&&(m.ctx=i,u&&h.setItem(t,Ms(m)))},setComplete:function setComplete(t,i){var u=this.getFileInfo(t);u&&(u.modifyAt=eo(),u.end=!0,i&&h.setItem(t,Ms(u)))},getUploadContext:function getUploadContext(t){var i=this.getFileInfo(t);return i?i.ctx:""},removeFileInfo:function removeFileInfo(t){0===indexOf(t).call(t,"_NosUploader_")&&h.removeItem(t)},clearExpiredInfo:function clearExpiredInfo(){var t,i="function"==typeof h.getKeys?h.getKeys():es(h),u=eo(),v=[],E=n(i);try{for(E.s();!(t=E.n()).done;){var I=t.value;if(0===indexOf(I).call(I,"_NosUploader_")){var M=m.getFileInfo(I);null===M||u-M.modifyAt>C.expireTime?h.removeItem(I):v.push({fileInfo:M,key:I})}}}catch(t){E.e(t)}finally{E.f()}if(v.length>C.maxFileCache){var S,T,R=n(slice(S=sort(v).call(v,(function(t,i){return i.fileInfo.modifyAt-t.fileInfo.modifyAt}))).call(S,C.maxFileCache));try{for(R.s();!(T=R.n()).done;){var A,N=T.value;0===indexOf(A=N.key).call(A,"_NosUploader_")&&h.removeItem(N.key)}}catch(t){R.e(t)}finally{R.f()}}}},v=m;function c(t){return(c="function"==typeof gi&&"symbol"==typeof qi?function(t){return typeof t}:function(t){return t&&"function"==typeof gi&&t.constructor===gi&&t!==gi.prototype?"symbol":typeof t})(t)}function l(t,i){return!i||"object"!==c(i)&&"function"!=typeof i?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):i}function s(t){var i="function"==typeof Ic?new Ic:void 0;return(s=function s(t){var u,h;if(null===t||(h=t,-1===indexOf(u=Function.toString.call(h)).call(u,"[native code]")))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(t))return i.get(t);i.set(t,n)}function n(){return f(t,arguments,y(this).constructor)}return n.prototype=pt(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function f(t,i,u){return(f=p()?Oc:function(t,i,u){var h=[null];h.push.apply(h,i);var m=new(bind$1(Function).apply(t,h));return u&&d(m,u.prototype),m}).apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Oc)return!1;if(Oc.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Oc(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,i){return(d=gt||function(t,i){return t.__proto__=i,t})(t,i)}function y(t){return(y=gt?Ii:function(t){return t.__proto__||Ii(t)})(t)}var E=function(t){!function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");t.prototype=pt(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&d(t,i)}(r,t);var i,u,h=(i=r,u=p(),function(){var t,h=y(i);if(u){var m=y(this).constructor;t=Oc(h,arguments,m)}else t=h.apply(this,arguments);return l(this,t)});function r(t,i){var u;return function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,r),(u=h.call(this,"NosUploadError:"+t)).errCode=i,u.errMsg=t,u}return r}(s(Error)),I=function e(t,i,u){if("uploading"===t.uploadState){var h=t.config,m=t.param,I=v.getUploadContext(t.fileKey);if(!I)return u(0);var M=new XMLHttpRequest,S=h.directUploadAddr+"/".concat(m.bucketName)+"/".concat(encodeURIComponent(m.objectName))+"?uploadContext"+"&context=".concat(I)+"&version=".concat(h.version);M.onreadystatechange=function(){var m;if("abort"!==t.uploadState&&4===M.readyState){var I,T,C,R;try{R=JSON.parse(M.responseText)}catch(t){R={errMsg:"JsonParseError in getOffset. xhr.status = "+M.status+". xhr.responseText: "+M.responseText,errCode:500}}200===M.status?R.errCode?t.config.onError(new E(R.errMsg,R.errCode)):u(R.offset):M.status.toString().match(/^5/)?e(t,i-1,u):i>0?("function"==typeof(null===(m=h.logger)||void 0===m?void 0:m.error)&&h.logger.error(concat(I="getOffset(".concat(S,") error. retry after 3 seconds. ")).call(I,(new Date).toTimeString())),vo((function(){e(t,i-1,u)}),3500)):M.status?(v.removeFileInfo(t.fileKey),h.onError(new E(concat(T=concat(C="getOffset(".concat(S,") error: ")).call(C,M.status," ")).call(T,M.statusText)))):h.onError(new E("getOffset(".concat(S,") error. no Error Code")))}},M.open("get",S),M.setRequestHeader("x-nos-token",m.token),M.timeout=h.getOffsetTimeout,M.send()}};function g(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,h=new Array(i);u<i;u++)h[u]=t[u];return h}var M=function e(t,i,u,h){if("uploading"===t.uploadState){var m=t.param,I=t.config,M=slice(File.prototype),S=void 0!==m.ctx?m.ctx:"",T=i+I.trunkSize>=t.file.size,C=T?t.file.size:i+I.trunkSize,R=eo(),A=new XMLHttpRequest,N=I.directUploadAddr+"/".concat(m.bucketName)+"/".concat(encodeURIComponent(m.objectName)),O={};A.upload.onprogress=function(u){if("abort"!==t.uploadState){var h=0;if(u.lengthComputable){var m=i+u.loaded;h=m/t.file.size,I.onProgress(h),I.onUploadProgress({loaded:m,total:t.file.size,percentage:h,percentageText:(100*h).toFixed(2)+"%"})}else I.onError(new E("browser does not support query upload progress"))}},A.onload=function(){if(200!==A.status){var t=A.getAllResponseHeaders();if(t){var i,u=reduce(i=t.split("\n")).call(i,(function(t,i){if(0===i.length)return t;var u,h,m=(h=2,function(t){if(Qs(t))return t}(u=i.split(": "))||function(t,i){var u=null==t?null:void 0!==gi&&Ru(t)||t["@@iterator"];if(null!=u){var h,m,v=[],E=!0,I=!1;try{for(u=u.call(t);!(E=(h=u.next()).done)&&(v.push(h.value),!i||v.length!==i);E=!0);}catch(t){I=!0,m=t}finally{try{E||null==u.return||u.return()}finally{if(I)throw m}}return v}}(u,h)||function(t,i){if(t){var u;if("string"==typeof t)return g(t,i);var h=slice(u=Object.prototype.toString.call(t)).call(u,8,-1);return"Object"===h&&t.constructor&&(h=t.constructor.name),"Map"===h||"Set"===h?bu(t):"Arguments"===h||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?g(t,i):void 0}}(u,h)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),v=m[0],E=m[1];return t[v]=E,t}),{});I.onUploadInfo({rsp_headers:u})}}},A.onreadystatechange=function(){var m,M,S;if("abort"!==t.uploadState&&4===A.readyState){var C,w,x,k;if(A.responseText)try{k=JSON.parse(A.responseText)}catch(t){"function"==typeof(null===(m=I.logger)||void 0===m?void 0:m.error)&&I.logger.error("JsonParseError in uploadTrunk. xhr.status = "+A.status+". xhr.responseText: "+A.responseText,t),k={errMsg:"JsonParseError in uploadTrunk. xhr.status = "+A.status+". xhr.responseText: "+A.responseText}}else"function"==typeof(null===(M=I.logger)||void 0===M?void 0:M.error)&&I.logger.error("xhr.status = "+A.status+" and xhr.responseText empty");I.onUploadInfo({transfer_latency:eo()-R}),200===A.status?(I.onUploadInfo({http_code:200}),t.setContext(k.context),T?(h(),t.setComplete()):e(t,k.offset,I.retryCount,h)):A.status.toString().match(/^5/)?(I.onUploadInfo({http_code:A.status,req_headers:O}),u>0?e(t,i,u-1,h):(v.removeFileInfo(t.fileKey),I.onError(new E(k.errMsg,k.errCode)))):(I.onUploadInfo({http_code:A.status||0,req_headers:O}),u>0?("function"==typeof(null===(S=I.logger)||void 0===S?void 0:S.error)&&I.logger.error(concat(C="uploadTrunk(".concat(N,") error. retry after 3 seconds. ")).call(C,(new Date).toTimeString())),vo((function(){e(t,i,u-1,h)}),3500)):A.status?(v.removeFileInfo(t.fileKey),I.onError(new E(concat(w=concat(x="uploadTrunk(".concat(N,") error: ")).call(x,A.status," ")).call(w,A.statusText)))):I.onError(new E("uploadTrunk(".concat(N,") error. no Error Code. Please check your network"))))}};var w=N+"?offset=".concat(i)+"&complete=".concat(T)+"&context=".concat(S)+"&version=".concat(I.version);if(I.onUploadInfo({remote_addr:w,part_size:T?t.file.size-i:I.trunkSize,index:Math.ceil(i/I.trunkSize)}),A.open("post",w),A.setRequestHeader("x-nos-token",m.token),O["x-nos-token"]=m.token,m.md5&&(A.setRequestHeader("content-md5",m.md5),O["content-md5"]=m.md5),t.file.type&&(A.setRequestHeader("content-type",t.file.type),O["content-type"]=t.file.type),I.trunkUploadTimeout&&I.trunkUploadTimeout>0&&(A.timeout=I.trunkUploadTimeout),"undefined"!=typeof FileReader){var x=new FileReader;x.onload=function(t){var i;(null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result)instanceof ArrayBuffer&&t.target.result.byteLength>0?A.send(t.target.result):I.onError(new E("Read ArrayBuffer failed",194003))},x.onerror=function(t){var i=t.target.error;I.onError(new E("Read ArrayBuffer error. ".concat(i.toString()),194003))},x.readAsArrayBuffer(M.call(t.file,i,C))}else A.send(M.call(t.file,i,C))}};function b(t,i){for(var u=0;u<i.length;u++){var h=i[u];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),yi(t,h.key,h)}}var S=function(){function e(t,i,u){!function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,e),this.uploadState="paused",this.config=u,this.file=t,this.param=i,this.fileKey=v.initFile(i,t,this.config.enableCache),this.resume()}var t;return(t=[{key:"resume",value:function value(){var t=this;if("uploading"!==this.uploadState){this.setUploadState("uploading");var i=this.config;I(this,i.retryCount,(function(u){M(t,u,i.retryCount,(function(){t.setUploadState("ended"),"function"==typeof i.onComplete&&i.onComplete(t.param)}))}))}}},{key:"pause",value:function value(){this.setUploadState("paused")}},{key:"abort",value:function value(){"ended"!==this.uploadState&&"abort"!==this.uploadState&&(this.setUploadState("abort"),this.config.onError(new E("Upload Aborted",10499)))}},{key:"setUploadState",value:function value(t){t!==this.uploadState&&(this.uploadState=t)}},{key:"setContext",value:function value(t){v.setUploadContext(this.fileKey,t,this.config.enableCache),this.param.ctx=t}},{key:"setComplete",value:function value(){v.setComplete(this.fileKey,this.config.enableCache),this.setUploadState("ended")}}])&&b(e.prototype,t),e}(),T={maxFileCache:1/0,expireTime:864e5,getFileUploadInformation:function getFileUploadInformation(t){var i=v.getFileKey(t),u=v.getFileInfo(i);return null===u?null:eo()-u.modifyAt>T.expireTime?(v.removeFileInfo(i),null):{uploadInfo:xt({bucketName:u.bucket,objectName:u.obj,token:u.token,ctx:u.ctx},u.payload?{payload:u.payload}:{}),complete:u.end}},setMaxFileCache:function setMaxFileCache(t){T.maxFileCache=t},setExpireTime:function setExpireTime(t){T.expireTime=t},printCaches:function printCaches(){if("undefined"!=typeof localStorage)for(var t=0,i=es(localStorage);t<i.length;t++){var u=i[t],h=v.getFileInfo(u);h&&console.log(h,"modifiedAt",new Date(h.modifyAt).toTimeString())}},createConfig:function createConfig(t){return new u(t)},createTask:function createTask(t,i,u){return new S(t,i,u)}},C=T;return i.default}()})),Ph={debug:function debug(){},log:function log(){},warn:function warn(){},error:function error(){}};function setLogger(t){Ph=t}function getLogger(){return Ph}function isMobile(){if(!navigator||!navigator.userAgent)return!1;var t=[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i];return some(t).call(t,(function(t){return navigator.userAgent.match(t)}))}function isElectron(){var t;return!(!navigator||!navigator.userAgent)&&("object"==typeof navigator&&"string"==typeof navigator.userAgent&&indexOf(t=navigator.userAgent).call(t,"Electron")>=0)}function isBrowser(){return navigator&&navigator.userAgent}function uploadFileFn(t){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var i,u,h,m,v,E,I;return ms.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:if(m=getLogger(),t.fileInput||t.file){M.next=3;break}throw new Error("File not exist");case 3:if(!t.file){M.next=7;break}v=t.file,M.next=21;break;case 7:if("string"!=typeof t.fileInput){M.next=16;break}if(!((E=document.getElementById(t.fileInput))&&E.files&&E.files[0])){M.next=13;break}v=E.files[0],M.next=14;break;case 13:throw new Error("Can not get file from fileInput");case 14:M.next=21;break;case 16:if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0])){M.next=20;break}v=t.fileInput.files[0],M.next=21;break;case 20:throw new Error("Can not get file from fileInput "+t.fileInput);case 21:if(!(t.maxSize&&v.size>t.maxSize)){M.next=23;break}throw new Error("The file exceeds maxSize limit. maxSize: "+t.maxSize+", get "+v.size);case 23:return M.next=25,new Ja((function(i,u){var h,E=kh.getFileUploadInformation(v),I=kh.createConfig({enableCache:!0,retryCount:0,directUploadAddr:t.chunkUploadHost,onError:function onError(t){u(t)},onUploadProgress:t.onUploadProgress||function(){},onComplete:function onComplete(t){i(t)},onUploadInfo:function onUploadInfo(i){t.onUploadInfo&&t.onUploadInfo(i)}});if(E)if(E.complete)t.onUploadProgress&&t.onUploadProgress({total:v.size,loaded:v.size,percentage:1,percentageText:"100%"}),i(E.uploadInfo);else{h=kh.createTask(v,E.uploadInfo,I);try{t.onUploadStart&&t.onUploadStart(h)}catch(t){m.error("Adapter uploadFile: options.onUploadStart error",t&&t.message),h.abort(),u(t)}}else{h=kh.createTask(v,xt(xt({bucketName:t.nosToken.bucket,objectName:decodeURIComponent(t.nosToken.objectName),token:t.nosToken.token},t.md5?{md5:t.md5}:{}),t.payload?{payload:t.payload}:{}),I);try{t.onUploadStart&&t.onUploadStart(h)}catch(t){m.error("Adapter uploadFile: options.onUploadStart error",t&&t.message),h.abort(),u(t)}}}));case 25:return(I=M.sent).name=v.name,I.size=v.size,I.type=v.type,I.ext=lastIndexOf(i=I.name).call(i,".")>-1?slice(u=I.name).call(u,lastIndexOf(h=I.name).call(h,".")+1).toLowerCase():"",M.abrupt("return",I);case 31:case"end":return M.stop()}}),_callee)})))}function getFileUploadInformationFn(t){var i;if(t.file)i=t.file;else if("string"==typeof t.fileInput){var u=document.getElementById(t.fileInput);if(!(u&&u.files&&u.files[0]))throw new Error("Can not get file from fileInput");i=u.files[0]}else{if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0]))throw new Error("Can not get file from fileInput "+t.fileInput);i=t.fileInput.files[0]}return kh.getFileUploadInformation(i)}
/*!
* Platform.js v1.3.6
* Copyright 2014-2020 Benjamin Tan
* Copyright 2011-2013 John-David Dalton
* Available under MIT license
*/var Lh=createCommonjsModule((function(i,u){(function(){var h={function:!0,object:!0}[typeof window]&&window||this,m=u,v=i&&!i.nodeType&&i,E=m&&v&&"object"==typeof t&&t;!E||E.global!==E&&E.window!==E&&E.self!==E||(h=E);var I=Math.pow(2,53)-1,M=/\bOpera/,S=Object.prototype,T=S.hasOwnProperty,C=S.toString;function capitalize(t){return(t=String(t)).charAt(0).toUpperCase()+t.slice(1)}function format(t){return t=trim(t),/^(?:webOS|i(?:OS|P))/.test(t)?t:capitalize(t)}function forOwn(t,i){for(var u in t)T.call(t,u)&&i(t[u],u,t)}function getClassOf(t){return null==t?capitalize(t):C.call(t).slice(8,-1)}function qualify(t){return String(t).replace(/([ -])(?!$)/g,"$1?")}function reduce(t,i){var u=null;return function each(t,i){var u=-1,h=t?t.length:0;if("number"==typeof h&&h>-1&&h<=I)for(;++u<h;)i(t[u],u,t);else forOwn(t,i)}(t,(function(h,m){u=i(u,h,m,t)})),u}function trim(t){return String(t).replace(/^ +| +$/g,"")}var R=function parse(t){var i=h,u=t&&"object"==typeof t&&"String"!=getClassOf(t);u&&(i=t,t=null);var m=i.navigator||{},v=m.userAgent||"";t||(t=v);var E,I,S=u?!!m.likeChrome:/\bChrome\b/.test(t)&&!/internal|\n/i.test(C.toString()),T="Object",R=u?T:"ScriptBridgingProxyObject",A=u?T:"Environment",N=u&&i.java?"JavaPackage":getClassOf(i.java),O=u?T:"RuntimeObject",w=/\bJava/.test(N)&&i.java,x=w&&getClassOf(i.environment)==A,k=w?"a":"α",P=w?"b":"β",L=i.document||{},D=i.operamini||i.opera,q=M.test(q=u&&D?D["[[Class]]"]:getClassOf(D))?q:D=null,V=t,U=[],G=null,B=t==v,j=B&&D&&"function"==typeof D.version&&D.version(),Y=function getLayout(i){return reduce(i,(function(i,u){return i||RegExp("\\b"+(u.pattern||qualify(u))+"\\b","i").exec(t)&&(u.label||u)}))}([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),W=function getName(i){return reduce(i,(function(i,u){return i||RegExp("\\b"+(u.pattern||qualify(u))+"\\b","i").exec(t)&&(u.label||u)}))}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"(?:Edge|Edg|EdgA|EdgiOS)"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Vivaldi","Waterfox","WebPositive",{label:"Yandex Browser",pattern:"YaBrowser"},{label:"UC Browser",pattern:"UCBrowser"},"Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chromium","Chrome",{label:"Chrome",pattern:"(?:HeadlessChrome)"},{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),$=getProduct([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),H=function getManufacturer(i){return reduce(i,(function(i,u,h){return i||(u[$]||u[/^[a-z]+(?: +[a-z]+\b)*/i.exec($)]||RegExp("\\b"+qualify(h)+"(?:\\b|\\w*\\d)","i").exec(t))&&h}))}({Apple:{iPad:1,iPhone:1,iPod:1},Alcatel:{},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},Huawei:{},Lenovo:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Oppo:{},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1},Xiaomi:{Mi:1,Redmi:1}}),Q=function getOS(i){return reduce(i,(function(i,u){var h=u.pattern||qualify(u);return!i&&(i=RegExp("\\b"+h+"(?:/[\\d.]+|[ \\w.]*)","i").exec(t))&&(i=function cleanupOS(t,i,u){var h={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return i&&u&&/^Win/i.test(t)&&!/^Windows Phone /i.test(t)&&(h=h[/[\d.]+$/.exec(t)])&&(t="Windows "+h),t=String(t),i&&u&&(t=t.replace(RegExp(i,"i"),u)),format(t.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}(i,h,u.label||u)),i}))}(["Windows Phone","KaiOS","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian",{label:"DragonFly BSD",pattern:"DragonFly"},"Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function getProduct(i){return reduce(i,(function(i,u){var h=u.pattern||qualify(u);return!i&&(i=RegExp("\\b"+h+" *\\d+[.\\w_]*","i").exec(t)||RegExp("\\b"+h+" *\\w+-[\\w]*","i").exec(t)||RegExp("\\b"+h+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(t))&&((i=String(u.label&&!RegExp(h,"i").test(u.label)?u.label:i).split("/"))[1]&&!/[\d.]+/.test(i[0])&&(i[0]+=" "+i[1]),u=u.label||u,i=format(i[0].replace(RegExp(h,"i"),u).replace(RegExp("; *(?:"+u+"[_-])?","i")," ").replace(RegExp("("+u+")[-_.]?(\\w)","i"),"$1 $2"))),i}))}function getVersion(i){return reduce(i,(function(i,u){return i||(RegExp(u+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(t)||0)[1]||null}))}if(Y&&(Y=[Y]),/\bAndroid\b/.test(Q)&&!$&&(E=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(t))&&($=trim(E[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),H&&!$?$=getProduct([H]):H&&$&&($=$.replace(RegExp("^("+qualify(H)+")[-_.\\s]","i"),H+" ").replace(RegExp("^("+qualify(H)+")[-_.]?(\\w)","i"),H+" $2")),(E=/\bGoogle TV\b/.exec($))&&($=E[0]),/\bSimulator\b/i.test(t)&&($=($?$+" ":"")+"Simulator"),"Opera Mini"==W&&/\bOPiOS\b/.test(t)&&U.push("running in Turbo/Uncompressed mode"),"IE"==W&&/\blike iPhone OS\b/.test(t)?(H=(E=parse(t.replace(/like iPhone OS/,""))).manufacturer,$=E.product):/^iP/.test($)?(W||(W="Safari"),Q="iOS"+((E=/ OS ([\d_]+)/i.exec(t))?" "+E[1].replace(/_/g,"."):"")):"Konqueror"==W&&/^Linux\b/i.test(Q)?Q="Kubuntu":H&&"Google"!=H&&(/Chrome/.test(W)&&!/\bMobile Safari\b/i.test(t)||/\bVita\b/.test($))||/\bAndroid\b/.test(Q)&&/^Chrome/.test(W)&&/\bVersion\//i.test(t)?(W="Android Browser",Q=/\bAndroid\b/.test(Q)?Q:"Android"):"Silk"==W?(/\bMobi/i.test(t)||(Q="Android",U.unshift("desktop mode")),/Accelerated *= *true/i.test(t)&&U.unshift("accelerated")):"UC Browser"==W&&/\bUCWEB\b/.test(t)?U.push("speed mode"):"PaleMoon"==W&&(E=/\bFirefox\/([\d.]+)\b/.exec(t))?U.push("identifying as Firefox "+E[1]):"Firefox"==W&&(E=/\b(Mobile|Tablet|TV)\b/i.exec(t))?(Q||(Q="Firefox OS"),$||($=E[1])):!W||(E=!/\bMinefield\b/i.test(t)&&/\b(?:Firefox|Safari)\b/.exec(W))?(W&&!$&&/[\/,]|^[^(]+?\)/.test(t.slice(t.indexOf(E+"/")+8))&&(W=null),(E=$||H||Q)&&($||H||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(Q))&&(W=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(Q)?Q:E)+" Browser")):"Electron"==W&&(E=(/\bChrome\/([\d.]+)\b/.exec(t)||0)[1])&&U.push("Chromium "+E),j||(j=getVersion(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",qualify(W),"(?:Firefox|Minefield|NetFront)"])),(E=("iCab"==Y&&parseFloat(j)>3?"WebKit":/\bOpera\b/.test(W)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(Y)&&"WebKit"||!Y&&/\bMSIE\b/i.test(t)&&("Mac OS"==Q?"Tasman":"Trident")||"WebKit"==Y&&/\bPlayStation\b(?! Vita\b)/i.test(W)&&"NetFront")&&(Y=[E]),"IE"==W&&(E=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(W+=" Mobile",Q="Windows Phone "+(/\+$/.test(E)?E:E+".x"),U.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(W="IE Mobile",Q="Windows Phone 8.x",U.unshift("desktop mode"),j||(j=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=W&&"Trident"==Y&&(E=/\brv:([\d.]+)/.exec(t))&&(W&&U.push("identifying as "+W+(j?" "+j:"")),W="IE",j=E[1]),B){if(function isHostType(t,i){var u=null!=t?typeof t[i]:"number";return!(/^(?:boolean|number|string|undefined)$/.test(u)||"object"==u&&!t[i])}(i,"global"))if(w&&(V=(E=w.lang.System).getProperty("os.arch"),Q=Q||E.getProperty("os.name")+" "+E.getProperty("os.version")),x){try{j=i.require("ringo/engine").version.join("."),W="RingoJS"}catch(t){(E=i.system)&&E.global.system==i.system&&(W="Narwhal",Q||(Q=E[0].os||null))}W||(W="Rhino")}else"object"==typeof i.process&&!i.process.browser&&(E=i.process)&&("object"==typeof E.versions&&("string"==typeof E.versions.electron?(U.push("Node "+E.versions.node),W="Electron",j=E.versions.electron):"string"==typeof E.versions.nw&&(U.push("Chromium "+j,"Node "+E.versions.node),W="NW.js",j=E.versions.nw)),W||(W="Node.js",V=E.arch,Q=E.platform,j=(j=/[\d.]+/.exec(E.version))?j[0]:null));else getClassOf(E=i.runtime)==R?(W="Adobe AIR",Q=E.flash.system.Capabilities.os):getClassOf(E=i.phantom)==O?(W="PhantomJS",j=(E=E.version||null)&&E.major+"."+E.minor+"."+E.patch):"number"==typeof L.documentMode&&(E=/\bTrident\/(\d+)/i.exec(t))?(j=[j,L.documentMode],(E=+E[1]+4)!=j[1]&&(U.push("IE "+j[1]+" mode"),Y&&(Y[1]=""),j[1]=E),j="IE"==W?String(j[1].toFixed(1)):j[0]):"number"==typeof L.documentMode&&/^(?:Chrome|Firefox)\b/.test(W)&&(U.push("masking as "+W+" "+j),W="IE",j="11.0",Y=["Trident"],Q="Windows");Q=Q&&format(Q)}if(j&&(E=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(j)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(B&&m.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(G=/b/i.test(E)?"beta":"alpha",j=j.replace(RegExp(E+"\\+?$"),"")+("beta"==G?P:k)+(/\d+\+?/.exec(E)||"")),"Fennec"==W||"Firefox"==W&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(Q))W="Firefox Mobile";else if("Maxthon"==W&&j)j=j.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test($))"Xbox 360"==$&&(Q=null),"Xbox 360"==$&&/\bIEMobile\b/.test(t)&&U.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(W)&&(!W||$||/Browser|Mobi/.test(W))||"Windows CE"!=Q&&!/Mobi/i.test(t))if("IE"==W&&B)try{null===i.external&&U.unshift("platform preview")}catch(t){U.unshift("embedded")}else(/\bBlackBerry\b/.test($)||/\bBB10\b/.test(t))&&(E=(RegExp($.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||j)?(Q=((E=[E,/BB10/.test(t)])[1]?($=null,H="BlackBerry"):"Device Software")+" "+E[0],j=null):this!=forOwn&&"Wii"!=$&&(B&&D||/Opera/.test(W)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==W&&/\bOS X (?:\d+\.){2,}/.test(Q)||"IE"==W&&(Q&&!/^Win/.test(Q)&&j>5.5||/\bWindows XP\b/.test(Q)&&j>8||8==j&&!/\bTrident\b/.test(t)))&&!M.test(E=parse.call(forOwn,t.replace(M,"")+";"))&&E.name&&(E="ing as "+E.name+((E=E.version)?" "+E:""),M.test(W)?(/\bIE\b/.test(E)&&"Mac OS"==Q&&(Q=null),E="identify"+E):(E="mask"+E,W=q?format(q.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(E)&&(Q=null),B||(j=null)),Y=["Presto"],U.push(E));else W+=" Mobile";(E=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(E=[parseFloat(E.replace(/\.(\d)$/,".0$1")),E],"Safari"==W&&"+"==E[1].slice(-1)?(W="WebKit Nightly",G="alpha",j=E[1].slice(0,-1)):j!=E[1]&&j!=(E[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(j=null),E[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==E[0]&&537.36==E[2]&&parseFloat(E[1])>=28&&"WebKit"==Y&&(Y=["Blink"]),B&&(S||E[1])?(Y&&(Y[1]="like Chrome"),E=E[1]||((E=E[0])<530?1:E<532?2:E<532.05?3:E<533?4:E<534.03?5:E<534.07?6:E<534.1?7:E<534.13?8:E<534.16?9:E<534.24?10:E<534.3?11:E<535.01?12:E<535.02?"13+":E<535.07?15:E<535.11?16:E<535.19?17:E<536.05?18:E<536.1?19:E<537.01?20:E<537.11?"21+":E<537.13?23:E<537.18?24:E<537.24?25:E<537.36?26:"Blink"!=Y?"27":"28")):(Y&&(Y[1]="like Safari"),E=(E=E[0])<400?1:E<500?2:E<526?3:E<533?4:E<534?"4+":E<535?5:E<537?6:E<538?7:E<601?8:E<602?9:E<604?10:E<606?11:E<608?12:"12"),Y&&(Y[1]+=" "+(E+="number"==typeof E?".x":/[.+]/.test(E)?"":"+")),"Safari"==W&&(!j||parseInt(j)>45)?j=E:"Chrome"==W&&/\bHeadlessChrome/i.test(t)&&U.unshift("headless")),"Opera"==W&&(E=/\bzbov|zvav$/.exec(Q))?(W+=" ",U.unshift("desktop mode"),"zvav"==E?(W+="Mini",j=null):W+="Mobile",Q=Q.replace(RegExp(" *"+E+"$"),"")):"Safari"==W&&/\bChrome\b/.exec(Y&&Y[1])?(U.unshift("desktop mode"),W="Chrome Mobile",j=null,/\bOS X\b/.test(Q)?(H="Apple",Q="iOS 4.3+"):Q=null):/\bSRWare Iron\b/.test(W)&&!j&&(j=getVersion("Chrome")),j&&0==j.indexOf(E=/[\d.]+$/.exec(Q))&&t.indexOf("/"+E+"-")>-1&&(Q=trim(Q.replace(E,""))),Q&&-1!=Q.indexOf(W)&&!RegExp(W+" OS").test(Q)&&(Q=Q.replace(RegExp(" *"+qualify(W)+" *"),"")),Y&&!/\b(?:Avant|Nook)\b/.test(W)&&(/Browser|Lunascape|Maxthon/.test(W)||"Safari"!=W&&/^iOS/.test(Q)&&/\bSafari\b/.test(Y[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(W)&&Y[1])&&(E=Y[Y.length-1])&&U.push(E),U.length&&(U=["("+U.join("; ")+")"]),H&&$&&$.indexOf(H)<0&&U.push("on "+H),$&&U.push((/^on /.test(U[U.length-1])?"":"on ")+$),Q&&(E=/ ([\d.+]+)$/.exec(Q),I=E&&"/"==Q.charAt(Q.length-E[0].length-1),Q={architecture:32,family:E&&!I?Q.replace(E[0],""):Q,version:E?E[1]:null,toString:function(){var t=this.version;return this.family+(t&&!I?" "+t:"")+(64==this.architecture?" 64-bit":"")}}),(E=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(V))&&!/\bi686\b/i.test(V)?(Q&&(Q.architecture=64,Q.family=Q.family.replace(RegExp(" *"+E),"")),W&&(/\bWOW64\b/i.test(t)||B&&/\w(?:86|32)$/.test(m.cpuClass||m.platform)&&!/\bWin64; x64\b/i.test(t))&&U.unshift("32-bit")):Q&&/^OS X/.test(Q.family)&&"Chrome"==W&&parseFloat(j)>=39&&(Q.architecture=64),t||(t=null);var K={};return K.description=t,K.layout=Y&&Y[0],K.manufacturer=H,K.name=W,K.prerelease=G,K.product=$,K.ua=t,K.version=W&&j,K.os=Q||{architecture:null,family:null,version:null,toString:function(){return"null"}},K.parse=parse,K.toString=function toStringPlatform(){return this.description||""},K.version&&U.unshift(j),K.name&&U.unshift(W),Q&&W&&(Q!=String(Q).split(" ")[0]||Q!=W.split(" ")[0]&&!$)&&U.push($?"("+Q+")":"on "+Q),U.length&&(K.description=U.join(" ")),K}();m&&v?forOwn(R,(function(t,i){m[i]=t})):h.platform=R}).call(t)}));function getSystemInfoFn(){var t,i,u=Lh.version||"";if(isElectron())try{var h=navigator.userAgent.match(/Electron\/([\d.]+\d+)/);h&&h[1]&&"string"==typeof h[1]&&(u=h[1])}catch(t){}return{os:(null===(t=Lh.os)||void 0===t?void 0:t.family)||"",osVer:(null===(i=Lh.os)||void 0===i?void 0:i.version)||"",browser:Lh.name||"",browserVer:Lh.version||"",libEnv:"BROWSER",hostEnv:isElectron()?"Electron":isMobile()?"H5":isBrowser()?"BROWSER":"Unset",hostEnvEnum:isElectron()?5:isMobile()?101:isBrowser()?100:0,hostEnvVer:u,userAgent:navigator&&navigator.userAgent,model:u,manufactor:Lh.name||""}}var Dh=null,qh=null,Vh={getNetworkStatus:function getNetworkStatus(){return Ja.resolve({net_type:0,net_connect:"undefined"==typeof navigator||"boolean"!=typeof navigator.onLine||navigator.onLine})},onNetworkStatusChange:function onNetworkStatusChange(t){Dh=function onlineListener(){t({isConnected:!0,networkType:0})},qh=function offlineListener(){t({isConnected:!1,networkType:0})},window.addEventListener("online",Dh),window.addEventListener("offline",qh)},offNetworkStatusChange:function offNetworkStatusChange(){Dh&&window.removeEventListener("online",Dh),qh&&window.removeEventListener("offline",qh),Dh=null,qh=null}},Uh=getLogger(),Gh=function getVisibilityEvent(){var t="hidden",i="visibilitychange";return"undefined"==typeof document||void 0!==document.hidden||(void 0!==document.webkitHidden?(t="webkitHidden",i="webkitvisibilitychange"):void 0!==document.msHidden?(t="msHidden",i="msvisibilitychange"):void 0!==document.mozHidden&&(t="mozHidden",i="mozvisibilitychange")),{hidden:t,visibilityChange:i}},Fh=function(t){function PowerMonitor(){var i;return(i=t.call(this)||this).status=0,i.visibilityListener=null,i.flag=!1,i._initVisibilityListener(),i}bt(PowerMonitor,t);var i=PowerMonitor.prototype;return i.isActive=function isActive(){return 0===this.status},i.getStatus=function getStatus(){return this.status},i.setStatus=function setStatus(t){var i=this.status;t!==i&&(this.status=t,0===t&&1===i&&this.emit("onPowerMonitorTurnActive"),Uh.log("Adapter powerMonitor::setStatus: ",t))},i.destroy=function destroy(){if(this.status=0,this.flag=!1,this._canIUse()&&this.visibilityListener){var t=Gh().visibilityChange;document.removeEventListener(t,this.visibilityListener),this.visibilityListener=null}},i._initVisibilityListener=function _initVisibilityListener(){if(!this.flag)if(!1!==this._canIUse()){var t=Gh(),i=t.hidden,u=t.visibilityChange;i&&void 0!==document[i]&&(this.visibilityListener=function genVisibilityListener(t){return function(){var i=t.status,u=Gh().hidden;u&&document[u]?t.status=1:(t.status=0,1===i&&t.emit("onPowerMonitorTurnActive")),Uh.log("Adapter powerMonitor::visibility change status:",t.status)}}(this),document.addEventListener(u,this.visibilityListener),this.flag=!0,Uh.log("Adapter powerMonitor::_initVisibilityListener success, isHidden:",null===document||void 0===document?void 0:document[i]))}else Uh.warn("Adapter powerMonitor::_initVisibilityListener no document.addEventListener")},i._canIUse=function _canIUse(){return"undefined"!=typeof document&&void 0!==document.addEventListener},PowerMonitor}(_o),Bh="log",jh=function(){function IDB(t,i){this.db=null,this.stores=[],this.name=t,this.version=i}var t=IDB.prototype;return t.getDB=function getDB(){if(!this.db)throw new Error("DB not ready");return this.db},t.getStore=function getStore(t){var i,u=find(i=this.stores).call(i,(function(i){return i.storeName===t}));if(!u)throw new Error("LogStorage: store not found. "+t);return u},t.open=function open(){var t=this,i=window.indexedDB.open(this.name,this.version);return new Ja((function(u,h){i.onerror=function(t){var i=t.target;h(i.error)},i.onsuccess=function(i){var h,m,v=i.target;t.db=v.result,t.db.removeEventListener("close",bind$1(h=t.triggerDBCloseEvt).call(h,t)),t.db.addEventListener("close",bind$1(m=t.triggerDBCloseEvt).call(m,t)),t.stores.push(new Yh(Bh,t)),u()},i.onupgradeneeded=function(i){var u=i.target;t.upgradeDBBySchema(u)}}))},t.triggerDBCloseEvt=function triggerDBCloseEvt(){try{this.db&&this.db.close(),this.db=null}catch(t){}this.open()},t.upgradeDBBySchema=function upgradeDBBySchema(t){var i=t.result,u=t.transaction&&i.objectStoreNames.contains(Bh)?t.transaction.objectStore(Bh):i.createObjectStore(Bh,{keyPath:"id",autoIncrement:!0});try{u.index("time")}catch(t){u.createIndex("time","time",{unique:!1})}},t.close=function close(){var t;this.db&&(this.db.removeEventListener("close",bind$1(t=this.triggerDBCloseEvt).call(t,this)),this.db.close(),this.stores=[],this.db=null)},IDB}(),Yh=function(){function IDBStore(t,i){this.idb=null,this.storeName=t,this.idb=i}var t=IDBStore.prototype;return t.getDB=function getDB(){if(!this.idb)throw new Error("DB not ready");return this.idb.getDB()},t.getStoreName=function getStoreName(){return this.storeName},t.bulkCreate=function bulkCreate(t){var i=this.getDB(),u=this.getStoreName(),h=i.transaction(u,"readwrite"),m=h.objectStore(u);return forEach$1(t).call(t,(function(t){m.add(t)})),new Ja((function(t,i){h.oncomplete=function(){t()},h.onerror=function(t){var u=t.target;i(u.error)},h.onabort=function(t){var u=t.target;u.error instanceof Error?i(u.error):i(new Error("TransactionAborted"))}}))},t.bulkDelete=function bulkDelete(t){var i=t.keyName,u=t.lower,h=t.upper,m=t.lowerOpen,v=void 0!==m&&m,E=t.upperOpen,I=void 0!==E&&E,M=IDBKeyRange.bound(u,h,v,I),S=this.getDB(),T=this.getStoreName(),C=S.transaction(T,"readwrite"),R=C.objectStore(T).index(i).openCursor(M),A=0;return R.onsuccess=function(t){var i=t.target.result;i&&(i.delete(),A++,i.continue())},new Ja((function(t,i){C.oncomplete=function(){t(A)},C.onerror=function(t){var u=t.target;i(u.error)},C.onabort=function(t){var u=t.target;u.error instanceof Error?i(u.error):i(new Error("TransactionAborted"))}}))},t.readAll=function readAll(){var t=this.getDB(),i=this.getStoreName(),u=t.transaction(i,"readonly").objectStore(i);if(!u.getAll)throw new Error("IDBExtract not support");var h=u.getAll();return new Ja((function(t,i){h.onsuccess=function(i){var u=i.target;t(u.result)},h.onerror=function(t){var u=t.target;i(u.error)}}))},IDBStore}(),Wh=function(){function LogStorageImpl(t){this.logRetentionDays=10,this.idb=new jh(t.logDirPath,1),this.logRetentionDays=t.logRetentionDays>=1?t.logRetentionDays:10}var t=LogStorageImpl.prototype;return t.open=function open(){return __awaiter(this,void 0,void 0,ms.mark((function _callee(){var t;return ms.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.idb.open();case 2:return t=this.idb.getStore(Bh),i.prev=3,i.next=6,t.bulkDelete({keyName:"time",lower:0,upper:eo()-24*this.logRetentionDays*60*60*1e3});case 6:i.next=10;break;case 8:i.prev=8,i.t0=i.catch(3);case 10:case"end":return i.stop()}}),_callee,this,[[3,8]])})))},t.close=function close(){this.idb.close()},t.addLogs=function addLogs(t){return this.idb.getStore(Bh).bulkCreate(t)},t.extractLogs=function extractLogs(){return __awaiter(this,void 0,void 0,ms.mark((function _callee2(){var t,i,u,h,m;return ms.wrap((function _callee2$(v){for(;;)switch(v.prev=v.next){case 0:return i=this.idb.getStore(Bh),v.next=3,i.readAll();case 3:if(0!==(u=v.sent).length){v.next=6;break}return v.abrupt("return",void 0);case 6:return h=reduce(u).call(u,(function(t,i){var u=i.iid;return t[u]||(t[u]=[]),t[u].push(i),t}),{}),m=map$6(t=es(h)).call(t,(function(t){var i=h[t];return"==========iid:"+t+"==========\n "+map$6(i).call(i,(function(t){return t.text})).join("\n")})).join("\n"),v.abrupt("return",new File([m],"nim-logs.txt",{type:"text/plain"}));case 9:case"end":return v.stop()}}),_callee2,this)})))},t.afterUpload=function afterUpload(){return Ja.resolve()},LogStorageImpl}();return function setAdapters(t){merge$1(Ks,t())}((function getAdapter(){return{setLogger:setLogger,platform:"BROWSER",localStorage:window.localStorage,request:xh,WebSocket:window.WebSocket,uploadFile:uploadFileFn,getFileUploadInformation:getFileUploadInformationFn,getSystemInfo:getSystemInfoFn,net:Vh,powerMonitor:new Fh,logStorage:Wh}})),wh}));