nim-web-sdk-ng
Version:
Yunxin IM SDK next generation
24 lines • 1.26 MB
JavaScript
/**
*
* Version: 10.9.41
*
* Git Hash: 5b4fa64fd28f6f2c4dc5e957f39887f24696a2ae
*
* Created At: 8/14/2025, 7:20:32 AM
*
* Target: NIM_BROWSER_SDK.js
*
*/
!function(t,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a((t="undefined"!=typeof globalThis?globalThis:t||self).NIM={})}(this,(function(t){"use strict";var a="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 a={exports:{}};return t(a,a.exports),a.exports}var u,m,check=function(t){return t&&t.Math==Math&&t},h=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof a&&a)||function(){return this}()||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},g=!fails((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),M=Function.prototype,I=M.apply,S=M.call,T="object"==typeof Reflect&&Reflect.apply||(g?S.bind(I):function(){return S.apply(I,arguments)}),C=Function.prototype,b=C.bind,E=C.call,k=g&&b.bind(E,E),R=g?function(t){return t&&k(t)}:function(t){return t&&function(){return E.apply(t,arguments)}},isCallable=function(t){return"function"==typeof t},A=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=Function.prototype.call,N=g?w.bind(w):function(){return w.apply(w,arguments)},x={}.propertyIsEnumerable,O=Object.getOwnPropertyDescriptor,P={f:O&&!x.call({1:2},1)?function propertyIsEnumerable(t){var a=O(this,t);return!!a&&a.enumerable}:x},createPropertyDescriptor=function(t,a){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:a}},L=R({}.toString),V=R("".slice),classofRaw=function(t){return V(L(t),8,-1)},U=Object,D=R("".split),q=fails((function(){return!U("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?D(t,""):U(t)}:U,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 q(requireObjectCoercible(t))},G="object"==typeof document&&document.all,H=void 0===G&&void 0!==G?function(t){return"object"==typeof t?null!==t:isCallable(t)||t===G}:function(t){return"object"==typeof t?null!==t:isCallable(t)},j={},aFunction=function(t){return isCallable(t)?t:void 0},getBuiltIn=function(t,a){return arguments.length<2?aFunction(j[t])||aFunction(h[t]):j[t]&&j[t][a]||h[t]&&h[t][a]},$=R({}.isPrototypeOf),z=getBuiltIn("navigator","userAgent")||"",W=h.process,K=h.Deno,Y=W&&W.versions||K&&K.version,Q=Y&&Y.v8;Q&&(m=(u=Q.split("."))[0]>0&&u[0]<4?1:+(u[0]+u[1])),!m&&z&&(!(u=z.match(/Edge\/(\d+)/))||u[1]>=74)&&(u=z.match(/Chrome\/(\d+)/))&&(m=+u[1]);var J=m,X=!!Object.getOwnPropertySymbols&&!fails((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&J&&J<41})),Z=X&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ee=Object,te=Z?function(t){return"symbol"==typeof t}:function(t){var a=getBuiltIn("Symbol");return isCallable(a)&&$(a.prototype,ee(t))},re=String,tryToString=function(t){try{return re(t)}catch(t){return"Object"}},ne=TypeError,aCallable=function(t){if(isCallable(t))return t;throw ne(tryToString(t)+" is not a function")},getMethod=function(t,a){var u=t[a];return isNullOrUndefined(u)?void 0:aCallable(u)},ae=TypeError,ie=Object.defineProperty,oe="__core-js_shared__",se=h[oe]||function(t,a){try{ie(h,t,{value:a,configurable:!0,writable:!0})}catch(u){h[t]=a}return a}(oe,{}),ce=createCommonjsModule((function(t){(t.exports=function(t,a){return se[t]||(se[t]=void 0!==a?a:{})})("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"})})),le=Object,toObject=function(t){return le(requireObjectCoercible(t))},ue=R({}.hasOwnProperty),de=Object.hasOwn||function hasOwn(t,a){return ue(toObject(t),a)},pe=0,me=Math.random(),he=R(1..toString),uid=function(t){return"Symbol("+(void 0===t?"":t)+")_"+he(++pe+me,36)},ge=ce("wks"),ve=h.Symbol,fe=ve&&ve.for,ye=Z?ve:ve&&ve.withoutSetter||uid,wellKnownSymbol=function(t){if(!de(ge,t)||!X&&"string"!=typeof ge[t]){var a="Symbol."+t;X&&de(ve,t)?ge[t]=ve[t]:ge[t]=Z&&fe?fe(a):ye(a)}return ge[t]},Me=TypeError,Ie=wellKnownSymbol("toPrimitive"),toPrimitive=function(t,a){if(!H(t)||te(t))return t;var u,m=getMethod(t,Ie);if(m){if(void 0===a&&(a="default"),u=N(m,t,a),!H(u)||te(u))return u;throw Me("Can't convert object to primitive value")}return void 0===a&&(a="number"),function(t,a){var u,m;if("string"===a&&isCallable(u=t.toString)&&!H(m=N(u,t)))return m;if(isCallable(u=t.valueOf)&&!H(m=N(u,t)))return m;if("string"!==a&&isCallable(u=t.toString)&&!H(m=N(u,t)))return m;throw ae("Can't convert object to primitive value")}(t,a)},toPropertyKey=function(t){var a=toPrimitive(t,"string");return te(a)?a:a+""},_e=h.document,Se=H(_e)&&H(_e.createElement),documentCreateElement=function(t){return Se?_e.createElement(t):{}},Te=!A&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),Ce=Object.getOwnPropertyDescriptor,be={f:A?Ce:function getOwnPropertyDescriptor(t,a){if(t=toIndexedObject(t),a=toPropertyKey(a),Te)try{return Ce(t,a)}catch(t){}if(de(t,a))return createPropertyDescriptor(!N(P.f,t,a),t[a])}},Ee=/#|\.prototype\./,isForced=function(t,a){var u=Re[ke(t)];return u==we||u!=Ae&&(isCallable(a)?fails(a):!!a)},ke=isForced.normalize=function(t){return String(t).replace(Ee,".").toLowerCase()},Re=isForced.data={},Ae=isForced.NATIVE="N",we=isForced.POLYFILL="P",Ne=isForced,xe=R(R.bind),functionBindContext=function(t,a){return aCallable(t),void 0===a?t:g?xe(t,a):function(){return t.apply(a,arguments)}},Oe=A&&fails((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Pe=String,Le=TypeError,anObject=function(t){if(H(t))return t;throw Le(Pe(t)+" is not an object")},Ve=TypeError,Ue=Object.defineProperty,De=Object.getOwnPropertyDescriptor,qe="enumerable",Be="configurable",Fe="writable",Ge={f:A?Oe?function defineProperty(t,a,u){if(anObject(t),a=toPropertyKey(a),anObject(u),"function"==typeof t&&"prototype"===a&&"value"in u&&Fe in u&&!u.writable){var m=De(t,a);m&&m.writable&&(t[a]=u.value,u={configurable:Be in u?u.configurable:m.configurable,enumerable:qe in u?u.enumerable:m.enumerable,writable:!1})}return Ue(t,a,u)}:Ue:function defineProperty(t,a,u){if(anObject(t),a=toPropertyKey(a),anObject(u),Te)try{return Ue(t,a,u)}catch(t){}if("get"in u||"set"in u)throw Ve("Accessors not supported");return"value"in u&&(t[a]=u.value),t}},He=A?function(t,a,u){return Ge.f(t,a,createPropertyDescriptor(1,u))}:function(t,a,u){return t[a]=u,t},je=be.f,wrapConstructor=function(t){var Wrapper=function(a,u,m){if(this instanceof Wrapper){switch(arguments.length){case 0:return new t;case 1:return new t(a);case 2:return new t(a,u)}return new t(a,u,m)}return T(t,this,arguments)};return Wrapper.prototype=t.prototype,Wrapper},_export=function(t,a){var u,m,g,M,I,S,T,C,b=t.target,E=t.global,k=t.stat,A=t.proto,w=E?h:k?h[b]:(h[b]||{}).prototype,N=E?j:j[b]||He(j,b,{})[b],x=N.prototype;for(g in a)u=!Ne(E?g:b+(k?".":"#")+g,t.forced)&&w&&de(w,g),I=N[g],u&&(S=t.dontCallGetSet?(C=je(w,g))&&C.value:w[g]),M=u&&S?S:a[g],u&&typeof I==typeof M||(T=t.bind&&u?functionBindContext(M,h):t.wrap&&u?wrapConstructor(M):A&&isCallable(M)?R(M):M,(t.sham||M&&M.sham||I&&I.sham)&&He(T,"sham",!0),He(N,g,T),A&&(de(j,m=b+"Prototype")||He(j,m,{}),He(j[m],g,M),t.real&&x&&!x[g]&&He(x,g,M)))},$e=Ge.f;_export({target:"Object",stat:!0,forced:Object.defineProperty!==$e,sham:!A},{defineProperty:$e});var ze,We=createCommonjsModule((function(t){var a=j.Object,u=t.exports=function defineProperty(t,u,m){return a.defineProperty(t,u,m)};a.defineProperty.sham&&(u.sham=!0)})),Ke=We,Ye=getDefaultExportFromCjs(createCommonjsModule((function(t){function _defineProperties(t,a){for(var u=0;u<a.length;u++){var m=a[u];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Ke(t,m.key,m)}}t.exports=function _createClass(t,a,u){return a&&_defineProperties(t.prototype,a),u&&_defineProperties(t,u),Ke(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports}))),Qe=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}))),Je=Math.ceil,Xe=Math.floor,Ze=Math.trunc||function trunc(t){var a=+t;return(a>0?Xe:Je)(a)},toIntegerOrInfinity=function(t){var a=+t;return a!=a||0===a?0:Ze(a)},et=Math.max,tt=Math.min,toAbsoluteIndex=function(t,a){var u=toIntegerOrInfinity(t);return u<0?et(u+a,0):tt(u,a)},rt=Math.min,toLength=function(t){return t>0?rt(toIntegerOrInfinity(t),9007199254740991):0},lengthOfArrayLike=function(t){return toLength(t.length)},createMethod$5=function(t){return function(a,u,m){var h,g=toIndexedObject(a),M=lengthOfArrayLike(g),I=toAbsoluteIndex(m,M);if(t&&u!=u){for(;M>I;)if((h=g[I++])!=h)return!0}else for(;M>I;I++)if((t||I in g)&&g[I]===u)return t||I||0;return!t&&-1}},nt={includes:createMethod$5(!0),indexOf:createMethod$5(!1)},at={},it=nt.indexOf,ot=R([].push),objectKeysInternal=function(t,a){var u,m=toIndexedObject(t),h=0,g=[];for(u in m)!de(at,u)&&de(m,u)&&ot(g,u);for(;a.length>h;)de(m,u=a[h++])&&(~it(g,u)||ot(g,u));return g},st=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ct=Object.keys||function keys(t){return objectKeysInternal(t,st)},lt=A&&!Oe?Object.defineProperties:function defineProperties(t,a){anObject(t);for(var u,m=toIndexedObject(a),h=ct(a),g=h.length,M=0;g>M;)Ge.f(t,u=h[M++],m[u]);return t},ut={f:lt},dt=getBuiltIn("document","documentElement"),pt=ce("keys"),sharedKey=function(t){return pt[t]||(pt[t]=uid(t))},mt=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"</"+"script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var a=t.parentWindow.Object;return t=null,a},NullProtoObject=function(){try{ze=new ActiveXObject("htmlfile")}catch(t){}var t,a;NullProtoObject="undefined"!=typeof document?document.domain&&ze?NullProtoObjectViaActiveX(ze):((a=documentCreateElement("iframe")).style.display="none",dt.appendChild(a),a.src=String("javascript:"),(t=a.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F):NullProtoObjectViaActiveX(ze);for(var u=st.length;u--;)delete NullProtoObject.prototype[st[u]];return NullProtoObject()};at[mt]=!0;var ht=Object.create||function create(t,a){var u;return null!==t?(EmptyConstructor.prototype=anObject(t),u=new EmptyConstructor,EmptyConstructor.prototype=null,u[mt]=t):u=NullProtoObject(),void 0===a?u:ut.f(u,a)};_export({target:"Object",stat:!0,sham:!A},{create:ht});var gt=j.Object,vt=function create(t,a){return gt.create(t,a)},ft=String,yt=TypeError,Mt=Object.setPrototypeOf||("__proto__"in{}?function(){var t,a=!1,u={};try{(t=R(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(u,[]),a=u instanceof Array}catch(t){}return function setPrototypeOf(u,m){return anObject(u),function(t){if("object"==typeof t||isCallable(t))return t;throw yt("Can't set "+ft(t)+" as a prototype")}(m),a?t(u,m):u.__proto__=m,u}}():void 0);_export({target:"Object",stat:!0},{setPrototypeOf:Mt});var It=j.Object.setPrototypeOf,_t=R([].slice),St=Function,Tt=R([].concat),Ct=R([].join),bt={},construct$8=function(t,a,u){if(!de(bt,a)){for(var m=[],h=0;h<a;h++)m[h]="a["+h+"]";bt[a]=St("C,a","return new C("+Ct(m,",")+")")}return bt[a](t,u)},Et=g?St.bind:function bind(t){var a=aCallable(this),u=a.prototype,m=_t(arguments,1),h=function bound(){var u=Tt(m,_t(arguments));return this instanceof h?construct$8(a,u.length,u):a.apply(t,u)};return H(u)&&(h.prototype=u),h};_export({target:"Function",proto:!0,forced:Function.bind!==Et},{bind:Et});var entryVirtual=function(t){return j[t+"Prototype"]},kt=entryVirtual("Function").bind,Rt=Function.prototype,bind$1=function(t){var a=t.bind;return t===Rt||$(Rt,t)&&a===Rt.bind?kt:a},At=createCommonjsModule((function(t){function _setPrototypeOf(a,u){var m;return t.exports=_setPrototypeOf=It?bind$1(m=It).call(m):function _setPrototypeOf(t,a){return t.__proto__=a,t},t.exports.__esModule=!0,t.exports.default=t.exports,_setPrototypeOf(a,u)}t.exports=_setPrototypeOf,t.exports.__esModule=!0,t.exports.default=t.exports})),wt=getDefaultExportFromCjs(createCommonjsModule((function(t){t.exports=function _inheritsLoose(t,a){t.prototype=vt(a.prototype),t.prototype.constructor=t,At(t,a)},t.exports.__esModule=!0,t.exports.default=t.exports})));_export({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991});var Nt=9007199254740991,xt={f:Object.getOwnPropertySymbols},Ot=Object.assign,Pt=Object.defineProperty,Lt=R([].concat),Vt=!Ot||fails((function(){if(A&&1!==Ot({b:1},Ot(Pt({},"a",{enumerable:!0,get:function(){Pt(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},a={},u=Symbol(),m="abcdefghijklmnopqrst";return t[u]=7,m.split("").forEach((function(t){a[t]=t})),7!=Ot({},t)[u]||ct(Ot({},a)).join("")!=m}))?function assign(t,a){for(var u=toObject(t),m=arguments.length,h=1,g=xt.f,M=P.f;m>h;)for(var I,S=q(arguments[h++]),T=g?Lt(ct(S),g(S)):ct(S),C=T.length,b=0;C>b;)I=T[b++],A&&!N(M,S,I)||(u[I]=S[I]);return u}:Ot;_export({target:"Object",stat:!0,arity:2,forced:Object.assign!==Vt},{assign:Vt});var Ut=j.Object.assign,Dt=fails((function(){ct(1)}));_export({target:"Object",stat:!0,forced:Dt},{keys:function keys(t){return ct(toObject(t))}});var qt,Bt,Ft,Gt=j.Object.keys,Ht={},jt=h.WeakMap,$t=isCallable(jt)&&/native code/.test(String(jt)),zt="Object already initialized",Wt=h.TypeError,Kt=h.WeakMap;if($t||se.state){var Yt=se.state||(se.state=new Kt),Qt=R(Yt.get),Jt=R(Yt.has),Xt=R(Yt.set);qt=function(t,a){if(Jt(Yt,t))throw Wt(zt);return a.facade=t,Xt(Yt,t,a),a},Bt=function(t){return Qt(Yt,t)||{}},Ft=function(t){return Jt(Yt,t)}}else{var Zt=sharedKey("state");at[Zt]=!0,qt=function(t,a){if(de(t,Zt))throw Wt(zt);return a.facade=t,He(t,Zt,a),a},Bt=function(t){return de(t,Zt)?t[Zt]:{}},Ft=function(t){return de(t,Zt)}}var er,tr,rr,nr={set:qt,get:Bt,has:Ft,enforce:function(t){return Ft(t)?Bt(t):qt(t,{})},getterFor:function(t){return function(a){var u;if(!H(a)||(u=Bt(a)).type!==t)throw Wt("Incompatible receiver, "+t+" required");return u}}},ar=Function.prototype,ir=A&&Object.getOwnPropertyDescriptor,or=de(ar,"name"),sr={EXISTS:or,PROPER:or&&"something"===function something(){}.name,CONFIGURABLE:or&&(!A||A&&ir(ar,"name").configurable)},cr=!fails((function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype})),lr=sharedKey("IE_PROTO"),ur=Object,dr=ur.prototype,pr=cr?ur.getPrototypeOf:function(t){var a=toObject(t);if(de(a,lr))return a[lr];var u=a.constructor;return isCallable(u)&&a instanceof u?u.prototype:a instanceof ur?dr:null},defineBuiltIn=function(t,a,u,m){return m&&m.enumerable?t[a]=u:He(t,a,u),t},mr=wellKnownSymbol("iterator"),hr=!1;[].keys&&("next"in(rr=[].keys())?(tr=pr(pr(rr)))!==Object.prototype&&(er=tr):hr=!0);var gr=!H(er)||fails((function(){var t={};return er[mr].call(t)!==t}));er=gr?{}:ht(er),isCallable(er[mr])||defineBuiltIn(er,mr,(function(){return this}));var vr={IteratorPrototype:er,BUGGY_SAFARI_ITERATORS:hr},fr={};fr[wellKnownSymbol("toStringTag")]="z";var yr="[object z]"===String(fr),Mr=wellKnownSymbol("toStringTag"),Ir=Object,_r="Arguments"==classofRaw(function(){return arguments}()),Sr=yr?classofRaw:function(t){var a,u,m;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(u=function(t,a){try{return t[a]}catch(t){}}(a=Ir(t),Mr))?u:_r?classofRaw(a):"Object"==(m=classofRaw(a))&&isCallable(a.callee)?"Arguments":m},Tr=yr?{}.toString:function toString(){return"[object "+Sr(this)+"]"},Cr=Ge.f,br=wellKnownSymbol("toStringTag"),setToStringTag=function(t,a,u,m){if(t){var h=u?t:t.prototype;de(h,br)||Cr(h,br,{configurable:!0,value:a}),m&&!yr&&He(h,"toString",Tr)}},Er=vr.IteratorPrototype,returnThis$1=function(){return this},kr=sr.PROPER,Rr=vr.BUGGY_SAFARI_ITERATORS,Ar=wellKnownSymbol("iterator"),wr="keys",Nr="values",xr="entries",returnThis=function(){return this},iteratorDefine=function(t,a,u,m,h,g,M){!function(t,a,u,m){var h=a+" Iterator";t.prototype=ht(Er,{next:createPropertyDescriptor(+!m,u)}),setToStringTag(t,h,!1,!0),Ht[h]=returnThis$1}(u,a,m);var I,S,T,getIterationMethod=function(t){if(t===h&&R)return R;if(!Rr&&t in E)return E[t];switch(t){case wr:return function keys(){return new u(this,t)};case Nr:return function values(){return new u(this,t)};case xr:return function entries(){return new u(this,t)}}return function(){return new u(this)}},C=a+" Iterator",b=!1,E=t.prototype,k=E[Ar]||E["@@iterator"]||h&&E[h],R=!Rr&&k||getIterationMethod(h),A="Array"==a&&E.entries||k;if(A&&(I=pr(A.call(new t)))!==Object.prototype&&I.next&&(setToStringTag(I,C,!0,!0),Ht[C]=returnThis),kr&&h==Nr&&k&&k.name!==Nr&&(b=!0,R=function values(){return N(k,this)}),h)if(S={values:getIterationMethod(Nr),keys:g?R:getIterationMethod(wr),entries:getIterationMethod(xr)},M)for(T in S)(Rr||b||!(T in E))&&defineBuiltIn(E,T,S[T]);else _export({target:a,proto:!0,forced:Rr||b},S);return M&&E[Ar]!==R&&defineBuiltIn(E,Ar,R,{name:h}),Ht[a]=R,S};Ge.f;var Or="Array Iterator",Pr=nr.set,Lr=nr.getterFor(Or);iteratorDefine(Array,"Array",(function(t,a){Pr(this,{type:Or,target:toIndexedObject(t),index:0,kind:a})}),(function(){var t=Lr(this),a=t.target,u=t.kind,m=t.index++;return!a||m>=a.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==u?{value:m,done:!1}:"values"==u?{value:a[m],done:!1}:{value:[m,a[m]],done:!1}}),"values"),Ht.Arguments=Ht.Array;var Vr=wellKnownSymbol("toStringTag");for(var Ur 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 Dr=h[Ur],qr=Dr&&Dr.prototype;qr&&Sr(qr)!==Vr&&He(qr,Vr,Ur),Ht[Ur]=Ht.Array}var Br=Array.isArray||function isArray(t){return"Array"==classofRaw(t)},Fr=R(Function.toString);isCallable(se.inspectSource)||(se.inspectSource=function(t){return Fr(t)});var Gr=se.inspectSource,noop=function(){},Hr=[],jr=getBuiltIn("Reflect","construct"),$r=/^\s*(?:class|function)\b/,zr=R($r.exec),Wr=!$r.exec(noop),Kr=function isConstructor(t){if(!isCallable(t))return!1;try{return jr(noop,Hr,t),!0}catch(t){return!1}},Yr=function isConstructor(t){if(!isCallable(t))return!1;switch(Sr(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Wr||!!zr($r,Gr(t))}catch(t){return!0}};Yr.sham=!0;var Qr=!jr||fails((function(){var t;return Kr(Kr.call)||!Kr(Object)||!Kr((function(){t=!0}))||t}))?Yr:Kr,Jr=wellKnownSymbol("species"),Xr=Array,arraySpeciesCreate=function(t,a){return new(function(t){var a;return Br(t)&&(a=t.constructor,(Qr(a)&&(a===Xr||Br(a.prototype))||H(a)&&null===(a=a[Jr]))&&(a=void 0)),void 0===a?Xr:a}(t))(0===a?0:a)},Zr=R([].push),createMethod$4=function(t){var a=1==t,u=2==t,m=3==t,h=4==t,g=6==t,M=7==t,I=5==t||g;return function(S,T,C,b){for(var E,k,R=toObject(S),A=q(R),w=functionBindContext(T,C),N=lengthOfArrayLike(A),x=0,O=b||arraySpeciesCreate,P=a?O(S,N):u||M?O(S,0):void 0;N>x;x++)if((I||x in A)&&(k=w(E=A[x],x,R),t))if(a)P[x]=k;else if(k)switch(t){case 3:return!0;case 5:return E;case 6:return x;case 2:Zr(P,E)}else switch(t){case 4:return!1;case 7:Zr(P,E)}return g?-1:m||h?h:P}},en={forEach:createMethod$4(0),map:createMethod$4(1),filter:createMethod$4(2),some:createMethod$4(3),every:createMethod$4(4),find:createMethod$4(5),findIndex:createMethod$4(6),filterReject:createMethod$4(7)},arrayMethodIsStrict=function(t,a){var u=[][t];return!!u&&fails((function(){u.call(null,a||function(){return 1},1)}))},tn=en.forEach,rn=arrayMethodIsStrict("forEach")?[].forEach:function forEach(t){return tn(this,t,arguments.length>1?arguments[1]:void 0)};_export({target:"Array",proto:!0,forced:[].forEach!=rn},{forEach:rn});var nn=entryVirtual("Array").forEach,an=Array.prototype,sn={DOMTokenList:!0,NodeList:!0},forEach$1=function(t){var a=t.forEach;return t===an||$(an,t)&&a===an.forEach||de(sn,Sr(t))?nn:a},cn=en.findIndex,ln="findIndex",un=!0;ln in[]&&Array(1).findIndex((function(){un=!1})),_export({target:"Array",proto:!0,forced:un},{findIndex:function findIndex(t){return cn(this,t,arguments.length>1?arguments[1]:void 0)}});var dn=entryVirtual("Array").findIndex,pn=Array.prototype,findIndex$1=function(t){var a=t.findIndex;return t===pn||$(pn,t)&&a===pn.findIndex?dn:a},mn=TypeError,hn=Object.getOwnPropertyDescriptor,gn=A&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,a){if(Br(t)&&!hn(t,"length").writable)throw mn("Cannot set read only .length");return t.length=a}:function(t,a){return t.length=a},vn=TypeError,doesNotExceedSafeInteger=function(t){if(t>9007199254740991)throw vn("Maximum allowed index exceeded");return t},createProperty=function(t,a,u){var m=toPropertyKey(a);m in t?Ge.f(t,m,createPropertyDescriptor(0,u)):t[m]=u},fn=TypeError,deletePropertyOrThrow=function(t,a){if(!delete t[a])throw fn("Cannot delete property "+tryToString(a)+" of "+tryToString(t))},yn=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(t){return J>=51||!fails((function(){var a=[];return(a.constructor={})[yn]=function(){return{foo:1}},1!==a[t](Boolean).foo}))},Mn=arrayMethodHasSpeciesSupport("splice"),In=Math.max,_n=Math.min;_export({target:"Array",proto:!0,forced:!Mn},{splice:function splice(t,a){var u,m,h,g,M,I,S=toObject(this),T=lengthOfArrayLike(S),C=toAbsoluteIndex(t,T),b=arguments.length;for(0===b?u=m=0:1===b?(u=0,m=T-C):(u=b-2,m=_n(In(toIntegerOrInfinity(a),0),T-C)),doesNotExceedSafeInteger(T+u-m),h=arraySpeciesCreate(S,m),g=0;g<m;g++)(M=C+g)in S&&createProperty(h,g,S[M]);if(h.length=m,u<m){for(g=C;g<T-m;g++)I=g+u,(M=g+m)in S?S[I]=S[M]:deletePropertyOrThrow(S,I);for(g=T;g>T-m+u;g--)deletePropertyOrThrow(S,g-1)}else if(u>m)for(g=T-m;g>C;g--)I=g+u-1,(M=g+m-1)in S?S[I]=S[M]:deletePropertyOrThrow(S,I);for(g=0;g<u;g++)S[g+C]=arguments[g+2];return gn(S,T-m+u),h}});var Sn=entryVirtual("Array").splice,Tn=Array.prototype,splice=function(t){var a=t.splice;return t===Tn||$(Tn,t)&&a===Tn.splice?Sn:a},Cn=getBuiltIn("JSON","stringify"),bn=R(/./.exec),En=R("".charAt),kn=R("".charCodeAt),Rn=R("".replace),An=R(1..toString),wn=/[\uD800-\uDFFF]/g,Nn=/^[\uD800-\uDBFF]$/,xn=/^[\uDC00-\uDFFF]$/,On=!X||fails((function(){var t=getBuiltIn("Symbol")();return"[null]"!=Cn([t])||"{}"!=Cn({a:t})||"{}"!=Cn(Object(t))})),Pn=fails((function(){return'"\\udf06\\ud834"'!==Cn("\udf06\ud834")||'"\\udead"'!==Cn("\udead")})),stringifyWithSymbolsFix=function(t,a){var u=_t(arguments),m=a;if((H(a)||void 0!==t)&&!te(t))return Br(a)||(a=function(t,a){if(isCallable(m)&&(a=N(m,this,t,a)),!te(a))return a}),u[1]=a,T(Cn,null,u)},fixIllFormed=function(t,a,u){var m=En(u,a-1),h=En(u,a+1);return bn(Nn,t)&&!bn(xn,h)||bn(xn,t)&&!bn(Nn,m)?"\\u"+An(kn(t,0),16):t};Cn&&_export({target:"JSON",stat:!0,arity:3,forced:On||Pn},{stringify:function stringify(t,a,u){var m=_t(arguments),h=T(On?stringifyWithSymbolsFix:Cn,null,m);return Pn&&"string"==typeof h?Rn(h,wn,fixIllFormed):h}}),j.JSON||(j.JSON={stringify:JSON.stringify});var Ln=function stringify(t,a,u){return T(j.JSON.stringify,null,arguments)},Vn=Ln;_export({target:"Array",stat:!0},{isArray:Br});var Un=j.Array.isArray,Dn=st.concat("length","prototype"),qn={f:Object.getOwnPropertyNames||function getOwnPropertyNames(t){return objectKeysInternal(t,Dn)}},Bn=R([].concat),Fn=getBuiltIn("Reflect","ownKeys")||function ownKeys(t){var a=qn.f(anObject(t)),u=xt.f;return u?Bn(a,u(t)):a},Gn=Error,Hn=R("".replace),jn=String(Gn("zxcasd").stack),$n=/\n\s*at [^:]*:[^\n]*/,zn=$n.test(jn),errorStackClear=function(t,a){if(zn&&"string"==typeof t&&!Gn.prepareStackTrace)for(;a--;)t=Hn(t,$n,"");return t},installErrorCause=function(t,a){H(a)&&"cause"in a&&He(t,"cause",a.cause)},Wn=wellKnownSymbol("iterator"),Kn=Array.prototype,isArrayIteratorMethod=function(t){return void 0!==t&&(Ht.Array===t||Kn[Wn]===t)},Yn=wellKnownSymbol("iterator"),getIteratorMethod$5=function(t){if(!isNullOrUndefined(t))return getMethod(t,Yn)||getMethod(t,"@@iterator")||Ht[Sr(t)]},Qn=TypeError,getIterator=function(t,a){var u=arguments.length<2?getIteratorMethod$5(t):a;if(aCallable(u))return anObject(N(u,t));throw Qn(tryToString(t)+" is not iterable")},iteratorClose=function(t,a,u){var m,h;anObject(t);try{if(!(m=getMethod(t,"return"))){if("throw"===a)throw u;return u}m=N(m,t)}catch(t){h=!0,m=t}if("throw"===a)throw u;if(h)throw m;return anObject(m),u},Jn=TypeError,Result=function(t,a){this.stopped=t,this.result=a},Xn=Result.prototype,iterate=function(t,a,u){var m,h,g,M,I,S,T,C=u&&u.that,b=!(!u||!u.AS_ENTRIES),E=!(!u||!u.IS_RECORD),k=!(!u||!u.IS_ITERATOR),R=!(!u||!u.INTERRUPTED),A=functionBindContext(a,C),stop=function(t){return m&&iteratorClose(m,"normal",t),new Result(!0,t)},callFn=function(t){return b?(anObject(t),R?A(t[0],t[1],stop):A(t[0],t[1])):R?A(t,stop):A(t)};if(E)m=t.iterator;else if(k)m=t;else{if(!(h=getIteratorMethod$5(t)))throw Jn(tryToString(t)+" is not iterable");if(isArrayIteratorMethod(h)){for(g=0,M=lengthOfArrayLike(t);M>g;g++)if((I=callFn(t[g]))&&$(Xn,I))return I;return new Result(!1)}m=getIterator(t,h)}for(S=E?t.next:m.next;!(T=N(S,m)).done;){try{I=callFn(T.value)}catch(t){iteratorClose(m,"throw",t)}if("object"==typeof I&&I&&$(Xn,I))return I}return new Result(!1)},Zn=String,toString=function(t){if("Symbol"===Sr(t))throw TypeError("Cannot convert a Symbol value to a string");return Zn(t)},normalizeStringArgument=function(t,a){return void 0===t?arguments.length<2?"":a:toString(t)},ea=!fails((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",createPropertyDescriptor(1,7)),7!==t.stack)})),ta=wellKnownSymbol("toStringTag"),ra=Error,na=[].push,aa=function AggregateError(t,a){var u,m=arguments.length>2?arguments[2]:void 0,h=$(ia,this);Mt?u=Mt(ra(),h?pr(this):ia):(u=h?this:ht(ia),He(u,ta,"Error")),void 0!==a&&He(u,"message",normalizeStringArgument(a)),ea&&He(u,"stack",errorStackClear(u.stack,1)),installErrorCause(u,m);var g=[];return iterate(t,na,{that:g}),He(u,"errors",g),u};Mt?Mt(aa,ra):function(t,a,u){for(var m=Fn(a),h=Ge.f,g=be.f,M=0;M<m.length;M++){var I=m[M];de(t,I)||u&&de(u,I)||h(t,I,g(a,I))}}(aa,ra,{name:!0});var ia=aa.prototype=ht(ra.prototype,{constructor:createPropertyDescriptor(1,aa),message:createPropertyDescriptor(1,""),name:createPropertyDescriptor(1,"AggregateError")});_export({global:!0,constructor:!0,arity:2},{AggregateError:aa});var oa,sa,ca,la,ua="process"==classofRaw(h.process),da=wellKnownSymbol("species"),setSpecies=function(t){var a=getBuiltIn(t),u=Ge.f;A&&a&&!a[da]&&u(a,da,{configurable:!0,get:function(){return this}})},pa=TypeError,anInstance=function(t,a){if($(a,t))return t;throw pa("Incorrect invocation")},ma=TypeError,aConstructor=function(t){if(Qr(t))return t;throw ma(tryToString(t)+" is not a constructor")},ha=wellKnownSymbol("species"),speciesConstructor=function(t,a){var u,m=anObject(t).constructor;return void 0===m||isNullOrUndefined(u=anObject(m)[ha])?a:aConstructor(u)},ga=TypeError,validateArgumentsLength=function(t,a){if(t<a)throw ga("Not enough arguments");return t},va=/(?:ipad|iphone|ipod).*applewebkit/i.test(z),fa=h.setImmediate,ya=h.clearImmediate,Ma=h.process,Ia=h.Dispatch,_a=h.Function,Sa=h.MessageChannel,Ta=h.String,Ca=0,ba={},Ea="onreadystatechange";try{oa=h.location}catch(t){}var run=function(t){if(de(ba,t)){var a=ba[t];delete ba[t],a()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){h.postMessage(Ta(t),oa.protocol+"//"+oa.host)};fa&&ya||(fa=function setImmediate(t){validateArgumentsLength(arguments.length,1);var a=isCallable(t)?t:_a(t),u=_t(arguments,1);return ba[++Ca]=function(){T(a,void 0,u)},sa(Ca),Ca},ya=function clearImmediate(t){delete ba[t]},ua?sa=function(t){Ma.nextTick(runner(t))}:Ia&&Ia.now?sa=function(t){Ia.now(runner(t))}:Sa&&!va?(la=(ca=new Sa).port2,ca.port1.onmessage=listener,sa=functionBindContext(la.postMessage,la)):h.addEventListener&&isCallable(h.postMessage)&&!h.importScripts&&oa&&"file:"!==oa.protocol&&!fails(post)?(sa=post,h.addEventListener("message",listener,!1)):sa=Ea in documentCreateElement("script")?function(t){dt.appendChild(documentCreateElement("script")).onreadystatechange=function(){dt.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)});var ka,Ra,Aa,wa,Na,xa,Oa,Pa,La={set:fa,clear:ya},Va=/ipad|iphone|ipod/i.test(z)&&void 0!==h.Pebble,Ua=/web0s(?!.*chrome)/i.test(z),Da=be.f,qa=La.set,Ba=h.MutationObserver||h.WebKitMutationObserver,Fa=h.document,Ga=h.process,Ha=h.Promise,ja=Da(h,"queueMicrotask"),$a=ja&&ja.value;$a||(ka=function(){var t,a;for(ua&&(t=Ga.domain)&&t.exit();Ra;){a=Ra.fn,Ra=Ra.next;try{a()}catch(t){throw Ra?wa():Aa=void 0,t}}Aa=void 0,t&&t.enter()},va||ua||Ua||!Ba||!Fa?!Va&&Ha&&Ha.resolve?((Oa=Ha.resolve(void 0)).constructor=Ha,Pa=functionBindContext(Oa.then,Oa),wa=function(){Pa(ka)}):ua?wa=function(){Ga.nextTick(ka)}:(qa=functionBindContext(qa,h),wa=function(){qa(ka)}):(Na=!0,xa=Fa.createTextNode(""),new Ba(ka).observe(xa,{characterData:!0}),wa=function(){xa.data=Na=!Na}));var za=$a||function(t){var a={fn:t,next:void 0};Aa&&(Aa.next=a),Ra||(Ra=a,wa()),Aa=a},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 a={item:t,next:null};this.head?this.tail.next=a:this.head=a,this.tail=a},get:function(){var t=this.head;if(t)return this.head=t.next,this.tail===t&&(this.tail=null),t.item}};var Wa,Ka,Ya=Queue,Qa=h.Promise,Ja="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Xa=!Ja&&!ua&&"object"==typeof window&&"object"==typeof document,Za=Qa&&Qa.prototype,ei=wellKnownSymbol("species"),ti=!1,ri=isCallable(h.PromiseRejectionEvent),ni=Ne("Promise",(function(){var t=Gr(Qa),a=t!==String(Qa);if(!a&&66===J)return!0;if(!Za.catch||!Za.finally)return!0;if(!J||J<51||!/native code/.test(t)){var u=new Qa((function(t){t(1)})),FakePromise=function(t){t((function(){}),(function(){}))};if((u.constructor={})[ei]=FakePromise,!(ti=u.then((function(){}))instanceof FakePromise))return!0}return!a&&(Xa||Ja)&&!ri})),ai={CONSTRUCTOR:ni,REJECTION_EVENT:ri,SUBCLASSING:ti},oi=TypeError,PromiseCapability=function(t){var a,u;this.promise=new t((function(t,m){if(void 0!==a||void 0!==u)throw oi("Bad Promise constructor");a=t,u=m})),this.resolve=aCallable(a),this.reject=aCallable(u)},si={f:function(t){return new PromiseCapability(t)}},ci=La.set,li="Promise",ui=ai.CONSTRUCTOR,di=ai.REJECTION_EVENT,pi=nr.getterFor(li),mi=nr.set,hi=Qa&&Qa.prototype,gi=Qa,vi=hi,fi=h.TypeError,yi=h.document,Mi=h.process,Ii=si.f,_i=Ii,Si=!!(yi&&yi.createEvent&&h.dispatchEvent),Ti="unhandledrejection",isThenable=function(t){var a;return!(!H(t)||!isCallable(a=t.then))&&a},callReaction=function(t,a){var u,m,h,g=a.value,M=1==a.state,I=M?t.ok:t.fail,S=t.resolve,T=t.reject,C=t.domain;try{I?(M||(2===a.rejection&&onHandleUnhandled(a),a.rejection=1),!0===I?u=g:(C&&C.enter(),u=I(g),C&&(C.exit(),h=!0)),u===t.promise?T(fi("Promise-chain cycle")):(m=isThenable(u))?N(m,u,S,T):S(u)):T(g)}catch(t){C&&!h&&C.exit(),T(t)}},notify=function(t,a){t.notified||(t.notified=!0,za((function(){for(var u,m=t.reactions;u=m.get();)callReaction(u,t);t.notified=!1,a&&!t.rejection&&onUnhandled(t)})))},dispatchEvent=function(t,a,u){var m,g;Si?((m=yi.createEvent("Event")).promise=a,m.reason=u,m.initEvent(t,!1,!0),h.dispatchEvent(m)):m={promise:a,reason:u},!di&&(g=h["on"+t])?g(m):t===Ti&&function(t,a){var u=h.console;u&&u.error&&(1==arguments.length?u.error(t):u.error(t,a))}("Unhandled promise rejection",u)},onUnhandled=function(t){N(ci,h,(function(){var a,u=t.facade,m=t.value;if(isUnhandled(t)&&(a=perform((function(){ua?Mi.emit("unhandledRejection",m,u):dispatchEvent(Ti,u,m)})),t.rejection=ua||isUnhandled(t)?2:1,a.error))throw a.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){N(ci,h,(function(){var a=t.facade;ua?Mi.emit("rejectionHandled",a):dispatchEvent("rejectionhandled",a,t.value)}))},bind=function(t,a,u){return function(m){t(a,m,u)}},internalReject=function(t,a,u){t.done||(t.done=!0,u&&(t=u),t.value=a,t.state=2,notify(t,!0))},internalResolve=function(t,a,u){if(!t.done){t.done=!0,u&&(t=u);try{if(t.facade===a)throw fi("Promise can't be resolved itself");var m=isThenable(a);m?za((function(){var u={done:!1};try{N(m,a,bind(internalResolve,u,t),bind(internalReject,u,t))}catch(a){internalReject(u,a,t)}})):(t.value=a,t.state=1,notify(t,!1))}catch(a){internalReject({done:!1},a,t)}}};ui&&(vi=(gi=function Promise(t){anInstance(this,vi),aCallable(t),N(Wa,this);var a=pi(this);try{t(bind(internalResolve,a),bind(internalReject,a))}catch(t){internalReject(a,t)}}).prototype,(Wa=function Promise(t){mi(this,{type:li,done:!1,notified:!1,parent:!1,reactions:new Ya,rejection:!1,state:0,value:void 0})}).prototype=defineBuiltIn(vi,"then",(function then(t,a){var u=pi(this),m=Ii(speciesConstructor(this,gi));return u.parent=!0,m.ok=!isCallable(t)||t,m.fail=isCallable(a)&&a,m.domain=ua?Mi.domain:void 0,0==u.state?u.reactions.add(m):za((function(){callReaction(m,u)})),m.promise})),Ka=function(){var t=new Wa,a=pi(t);this.promise=t,this.resolve=bind(internalResolve,a),this.reject=bind(internalReject,a)},si.f=Ii=function(t){return t===gi||undefined===t?new Ka(t):_i(t)}),_export({global:!0,constructor:!0,wrap:!0,forced:ui},{Promise:gi}),setToStringTag(gi,li,!1,!0),setSpecies(li);var Ci=wellKnownSymbol("iterator"),bi=!1;try{var Ei=0,ki={next:function(){return{done:!!Ei++}},return:function(){bi=!0}};ki[Ci]=function(){return this},Array.from(ki,(function(){throw 2}))}catch(t){}var checkCorrectnessOfIteration=function(t,a){if(!a&&!bi)return!1;var u=!1;try{var m={};m[Ci]=function(){return{next:function(){return{done:u=!0}}}},t(m)}catch(t){}return u},Ri=ai.CONSTRUCTOR||!checkCorrectnessOfIteration((function(t){Qa.all(t).then(void 0,(function(){}))}));_export({target:"Promise",stat:!0,forced:Ri},{all:function all(t){var a=this,u=si.f(a),m=u.resolve,h=u.reject,g=perform((function(){var u=aCallable(a.resolve),g=[],M=0,I=1;iterate(t,(function(t){var S=M++,T=!1;I++,N(u,a,t).then((function(t){T||(T=!0,g[S]=t,--I||m(g))}),h)})),--I||m(g)}));return g.error&&h(g.value),u.promise}});var Ai=ai.CONSTRUCTOR;Qa&&Qa.prototype,_export({target:"Promise",proto:!0,forced:Ai,real:!0},{catch:function(t){return this.then(void 0,t)}}),_export({target:"Promise",stat:!0,forced:Ri},{race:function race(t){var a=this,u=si.f(a),m=u.reject,h=perform((function(){var h=aCallable(a.resolve);iterate(t,(function(t){N(h,a,t).then(u.resolve,m)}))}));return h.error&&m(h.value),u.promise}}),_export({target:"Promise",stat:!0,forced:ai.CONSTRUCTOR},{reject:function reject(t){var a=si.f(this);return N(a.reject,void 0,t),a.promise}});var promiseResolve=function(t,a){if(anObject(t),H(a)&&a.constructor===t)return a;var u=si.f(t);return(0,u.resolve)(a),u.promise},wi=ai.CONSTRUCTOR,Ni=getBuiltIn("Promise"),xi=!wi;_export({target:"Promise",stat:!0,forced:!0},{resolve:function resolve(t){return promiseResolve(xi&&this===Ni?Qa:this,t)}}),_export({target:"Promise",stat:!0},{allSettled:function allSettled(t){var a=this,u=si.f(a),m=u.resolve,h=u.reject,g=perform((function(){var u=aCallable(a.resolve),h=[],g=0,M=1;iterate(t,(function(t){var I=g++,S=!1;M++,N(u,a,t).then((function(t){S||(S=!0,h[I]={status:"fulfilled",value:t},--M||m(h))}),(function(t){S||(S=!0,h[I]={status:"rejected",reason:t},--M||m(h))}))})),--M||m(h)}));return g.error&&h(g.value),u.promise}});var Oi="No one promise resolved";_export({target:"Promise",stat:!0},{any:function any(t){var a=this,u=getBuiltIn("AggregateError"),m=si.f(a),h=m.resolve,g=m.reject,M=perform((function(){var m=aCallable(a.resolve),M=[],I=0,S=1,T=!1;iterate(t,(function(t){var C=I++,b=!1;S++,N(m,a,t).then((function(t){b||T||(T=!0,h(t))}),(function(t){b||T||(b=!0,M[C]=t,--S||g(new u(M,Oi)))}))})),--S||g(new u(M,Oi))}));return M.error&&g(M.value),m.promise}});var Pi=Qa&&Qa.prototype,Li=!!Qa&&fails((function(){Pi.finally.call({then:function(){}},(function(){}))}));_export({target:"Promise",proto:!0,real:!0,forced:Li},{finally:function(t){var a=speciesConstructor(this,getBuiltIn("Promise")),u=isCallable(t);return this.then(u?function(u){return promiseResolve(a,t()).then((function(){return u}))}:t,u?function(u){return promiseResolve(a,t()).then((function(){throw u}))}:t)}});var Vi=R("".charAt),Ui=R("".charCodeAt),Di=R("".slice),createMethod$3=function(t){return function(a,u){var m,h,g=toString(requireObjectCoercible(a)),M=toIntegerOrInfinity(u),I=g.length;return M<0||M>=I?t?"":void 0:(m=Ui(g,M))<55296||m>56319||M+1===I||(h=Ui(g,M+1))<56320||h>57343?t?Vi(g,M):m:t?Di(g,M,M+2):h-56320+(m-55296<<10)+65536}},qi={codeAt:createMethod$3(!1),charAt:createMethod$3(!0)},Bi=qi.charAt,Fi="String Iterator",Gi=nr.set,Hi=nr.getterFor(Fi);iteratorDefine(String,"String",(function(t){Gi(this,{type:Fi,string:toString(t),index:0})}),(function next(){var t,a=Hi(this),u=a.string,m=a.index;return m>=u.length?{value:void 0,done:!0}:(t=Bi(u,m),a.index+=t.length,{value:t,done:!1})}));var ji=j.Promise;_export({target:"Promise",stat:!0,forced:!0},{try:function(t){var a=si.f(this),u=perform(t);return(u.error?a.reject:a.resolve)(u.value),a.promise}});var $i=ji,zi=P.f,Wi=R(zi),Ki=R([].push),createMethod$2=function(t){return function(a){for(var u,m=toIndexedObject(a),h=ct(m),g=h.length,M=0,I=[];g>M;)u=h[M++],A&&!Wi(m,u)||Ki(I,t?[u,m[u]]:m[u]);return I}},Yi={entries:createMethod$2(!0),values:createMethod$2(!1)},Qi=Yi.values;_export({target:"Object",stat:!0},{values:function values(t){return Qi(t)}});var Ji=j.Object.values,Xi=Date,Zi=R(Xi.prototype.getTime);_export({target:"Date",stat:!0},{now:function now(){return Zi(new Xi)}});var eo=j.Date.now,to=wellKnownSymbol("isConcatSpreadable"),ro=J>=51||!fails((function(){var t=[];return t[to]=!1,t.concat()[0]!==t})),no=arrayMethodHasSpeciesSupport("concat"),isConcatSpreadable=function(t){if(!H(t))return!1;var a=t[to];return void 0!==a?!!a:Br(t)};_export({target:"Array",proto:!0,arity:1,forced:!ro||!no},{concat:function concat(t){var a,u,m,h,g,M=toObject(this),I=arraySpeciesCreate(M,0),S=0;for(a=-1,m=arguments.length;a<m;a++)if(isConcatSpreadable(g=-1===a?M:arguments[a]))for(h=lengthOfArrayLike(g),doesNotExceedSafeInteger(S+h),u=0;u<h;u++,S++)u in g&&createProperty(I,S,g[u]);else doesNotExceedSafeInteger(S+1),createProperty(I,S++,g);return I.length=S,I}});var ao=entryVirtual("Array").concat,io=Array.prototype,concat=function(t){var a=t.concat;return t===io||$(io,t)&&a===io.concat?ao:a},oo=/MSIE .\./.test(z),so=h.Function,wrap$1=function(t){return oo?function(a,u){var m=validateArgumentsLength(arguments.length,1)>2,h=isCallable(a)?a:so(a),g=m?_t(arguments,2):void 0;return t(m?function(){T(h,this,g)}:h,u)}:t},co={setTimeout:wrap$1(h.setTimeout),setInterval:wrap$1(h.setInterval)},lo=co.setInterval;_export({global:!0,bind:!0,forced:h.setInterval!==lo},{setInterval:lo});var uo=co.setTimeout;_export({global:!0,bind:!0,forced:h.setTimeout!==uo},{setTimeout:uo});var po=j.setTimeout,mo=createCommonjsModule((function(t){var a=Object.prototype.hasOwnProperty,u="~";function Events(){}function EE(t,a,u){this.fn=t,this.context=a,this.once=u||!1}function addListener(t,a,m,h,g){if("function"!=typeof m)throw new TypeError("The listener must be a function");var M=new EE(m,h||t,g),I=u?u+a:a;return t._events[I]?t._events[I].fn?t._events[I]=[t._events[I],M]:t._events[I].push(M):(t._events[I]=M,t._eventsCount++),t}function clearEvent(t,a){0==--t._eventsCount?t._events=new Events:delete t._events[a]}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,m,h=[];if(0===this._eventsCount)return h;for(m in t=this._events)a.call(t,m)&&h.push(u?m.slice(1):m);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(t)):h},EventEmitter.prototype.listeners=function listeners(t){var a=u?u+t:t,m=this._events[a];if(!m)return[];if(m.fn)return[m.fn];for(var h=0,g=m.length,M=new Array(g);h<g;h++)M[h]=m[h].fn;return M},EventEmitter.prototype.listenerCount=function listenerCount(t){var a=u?u+t:t,m=this._events[a];return m?m.fn?1:m.length:0},EventEmitter.prototype.emit=function emit(t,a,m,h,g,M){var I=u?u+t:t;if(!this._events[I])return!1;var S,T,C=this._events[I],b=arguments.length;if(C.fn){switch(C.once&&this.removeListener(t,C.fn,void 0,!0),b){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,a),!0;case 3:return C.fn.call(C.context,a,m),!0;case 4:return C.fn.call(C.context,a,m,h),!0;case 5:return C.fn.call(C.context,a,m,h,g),!0;case 6:return C.fn.call(C.context,a,m,h,g,M),!0}for(T=1,S=new Array(b-1);T<b;T++)S[T-1]=arguments[T];C.fn.apply(C.context,S)}else{var E,k=C.length;for(T=0;T<k;T++)switch(C[T].once&&this.removeListener(t,C[T].fn,void 0,!0),b){case 1:C[T].fn.call(C[T].context);break;case 2:C[T].fn.call(C[T].context,a);break;case 3:C[T].fn.call(C[T].context,a,m);break;case 4:C[T].fn.call(C[T].context,a,m,h);break;default:if(!S)for(E=1,S=new Array(b-1);E<b;E++)S[E-1]=arguments[E];C[T].fn.apply(C[T].context,S)}}return!0},EventEmitter.prototype.on=function on(t,a,u){return addListener(this,t,a,u,!1)},EventEmitter.prototype.once=function once(t,a,u){return addListener(this,t,a,u,!0)},EventEmitter.prototype.removeListener=function removeListener(t,a,m,h){var g=u?u+t:t;if(!this._events[g])return this;if(!a)return clearEvent(this,g),this;var M=this._events[g];if(M.fn)M.fn!==a||h&&!M.once||m&&M.context!==m||clearEvent(this,g);else{for(var I=0,S=[],T=M.length;I<T;I++)(M[I].fn!==a||h&&!M[I].once||m&&M[I].context!==m)&&S.push(M[I]);S.length?this._events[g]=1===S.length?S[0]:S:clearEvent(this,g)}return this},EventEmitter.prototype.removeAllListeners=function removeAllListeners(t){var a;return t?(a=u?u+t:t,this._events[a]&&clearEvent(this,a)):(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:h});var ho=h,go=Array,vo=Math.max,arraySliceSimple=function(t,a,u){for(var m=lengthOfArrayLike(t),h=toAbsoluteIndex(a,m),g=toAbsoluteIndex(void 0===u?m:u,m),M=go(vo(g-h,0)),I=0;h<g;h++,I++)createProperty(M,I,t[h]);return M.length=I,M},fo=qn.f,yo="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Mo={f:function getOwnPropertyNames(t){return yo&&"Window"==classofRaw(t)?function(t){try{return fo(t)}catch(t){return arraySliceSimple(yo)}}(t):fo(toIndexedObject(t))}},Io={f:wellKnownSymbol},_o=Ge.f,wellKnownSymbolDefine=function(t){var a=j.Symbol||(j.Symbol={});de(a,t)||_o(a,t,{value:Io.f(t)})},symbolDefineToPrimitive=function(){var t=getBuiltIn("Symbol"),a=t&&t.prototype,u=a&&a.valueOf,m=wellKnownSymbol("toPrimitive");a&&!a[m]&&defineBuiltIn(a,m,(function(t){return N(u,this)}),{arity:1})},So=en.forEach,To=sharedKey("hidden"),Co="Symbol",bo=nr.set,Eo=nr.getterFor(Co),ko=Object.prototype,Ro=h.Symbol,Ao=Ro&&Ro.prototype,wo=h.TypeError,No=h.QObject,xo=be.f,Oo=Ge.f,Po=Mo.f,Lo=P.f,Vo=R([].push),Uo=ce("symbols"),Do=ce("op-symbols"),qo=ce("wks"),Bo=!No||!No.prototype||!No.prototype.findChild,Fo=A&&fails((function(){return 7!=ht(Oo({},"a",{get:function(){return Oo(this,"a",{value:7}).a}})).a}))?function(t,a,u){var m=xo(ko,a);m&&delete ko[a],Oo(t,a,u),m&&t!==ko&&Oo(ko,a,m)}:Oo,wrap=function(t,a){var u=Uo[t]=ht(Ao);return bo(u,{type:Co,tag:t,description:a}),A||(u.description=a),u},Go=function defineProperty(t,a,u){t===ko&&Go(Do,a,u),anObject(t);var m=toPropertyKey(a);return anObject(u),de(Uo,m)?(u.enumerable?(de(t,To)&&t[To][m]&&(t[To][m]=!1),u=ht(u,{enumerable:createPropertyDescriptor(0,!1)})):(de(t,To)||Oo(t,To,createPropertyDescriptor(1,{})),t[To][m]=!0),Fo(t,m,u)):Oo(t,m,u)},Ho=function defineProperties(t,a){anObject(t);var u=toIndexedObject(a),m=ct(u).concat($getOwnPropertySymbols(u));return So(m,(function(a){A&&!N(jo,u,a)||Go(t,a,u[a])})),t},jo=function propertyIsEnumerable(t){var a=toPropertyKey(t),u=N(Lo,this,a);return!(this===ko&&de(Uo,a)&&!de(Do,a))&&(!(u||!de(this,a)||!de(Uo,a)||de(this,To)&&this[To][a])||u)},$o=function getOwnPropertyDescriptor(t,a){var u=toIndexedObject(t),m=toPropertyKey(a);if(u!==ko||!de(Uo,m)||de(Do,m)){var h=xo(u,m);return!h||!de(Uo,m)||de(u,To)&&u[To][m]||(h.enumerable=!0),h}},zo=function getOwnPropertyNames(t){var a=Po(toIndexedObject(t)),u=[];return So(a,(function(t){de(Uo,t)||de(at,t)||Vo(u,t)})),u},$getOwnPropertySymbols=function(t){var a=t===ko,u=Po(a?Do:toIndexedObject(t)),m=[];return So(u,(function(t){!de(Uo,t)||a&&!de(ko,t)||Vo(m,Uo[t])})),m};X||(Ro=function Symbol(){if($(Ao,this))throw wo("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?toString(arguments[0]):void 0,a=uid(t),setter=function(t){this===ko&&N(setter,Do,t),de(this,To)&&de(this[To],a)&&(this[To][a]=!1),Fo(this,a,createPropertyDescriptor(1,t))};return A&&Bo&&Fo(ko,a,{configurable:!0,set:setter}),wrap(a,t)},Ao=Ro.prototype,defineBuiltIn(Ao,"toString",(function toString(){return Eo(this).tag})),defineBuiltIn(Ro,"withoutSetter",(function(t){return wrap(uid(t),t)})),P.f=jo,Ge.f=Go,ut.f=Ho,be.f=$o,qn.f=Mo.f=zo,xt.f=$getOwnPropertySymbols,Io.f=function(t){return wrap(wellKnownSymbol(t),t)},A&&Oo(Ao,"description",{configurable:!0,get:function description(){return Eo(this).description}})),_export({global:!0,constructor:!0,wrap:!0,forced:!X,sham:!X},{Symbol:Ro}),So(ct(qo),(function(t){wellKnownSymbolDefine(t)})),_export({target:Co,stat:!0,forced:!X},{useSetter:function(){Bo=!0},useSimple:function(){Bo=!1}}),_export({target:"Object",stat:!0,forced:!X,sham:!A},{create:function create(t,a){return void 0===a?ht(t):Ho(ht(t),a)},defineProperty:Go,defineProperties:Ho,getOwnPropertyDescriptor:$o}),_export({target:"Object",stat:!0,forced:!X},{getOwnPropertyNames:zo}),symbolDefineToPrimitive(),setToStringTag(Ro,Co),at[To]=!0;var Wo=X&&!!Symbol.for&&!!Symbol.keyFor,Ko=ce("string-to-symbol-registry"),Yo=ce("symbol-to-string-registry");_export({target:"Symbol",stat:!0,forced:!Wo},{for:function(t){var a=toString(t);if(de(Ko,a))return Ko[a];var u=getBuiltIn("Symbol")(a);return Ko[a]=u,Yo[u]=a,u}});var Qo=ce("symbol-to-string-registry");_export({target:"Symbol",stat:!0,forced:!Wo},{keyFor:function keyFor(t){if(!te(t))throw TypeError(tryToString(t)+" is not a symbol");if(de(Qo,t))return Qo[t]}});var Jo=!X||fails((function(){xt.f(1)}));_export({target:"Object",stat:!0,forced:Jo},{getOwnPropertySymbols:function getOwnPropertySymbols(t){var a=xt.f;return a?a(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(h.JSON,"JSON",!0);var Xo=j.Symbol;wellKnownSymbolDefine("asyncDispose"),wellKnownSymbolDefine("dispose"),wellKnownSymbolDefine("matcher"),wellKnownSymbolDefine("metadataKey"),wellKnownSymbolDefine("observable"),wellKnownSymbolDefine("metadata"),wellKnownSymbolDefine("patternMatch"),wellKnownSymbolDefine("replaceAll");var Zo=Xo,es=fails((function(){pr(1)}));_export({target:"Object",stat:!0,forced:es,sham:!cr},{getPrototypeOf:function getPrototypeOf(t){return pr(toObject(t))}});var ts=j.Object.getPrototypeOf,rs=R([].reverse),ns=[1,2];_export({target:"Array",proto:!0,forced:String(ns)===String(ns.reverse())},{reverse:function reverse(){return Br(this)&&(this.length=this.length),rs(this)}});var as=entryVirtual("Array").reverse,is=Array.prototype,reverse$1=function(t){var a=t.reverse;return t===is||$(is,t)&&a===is.reverse?as:a},os=arrayMethodHasSpeciesSupport("slice"),ss=wellKnownSymbol("species"),cs=Array,ls=Math.max;_export({target:"Array",proto:!0,forced:!os},{slice:function slice(t,a){var u,m,h,g=toIndexedObject(this),M=lengthOfArrayLike(g),I=toAbsoluteIndex(t,M),S=toAbsoluteIndex(void 0===a?M:a,M);if(Br(g)&&(u=g.constructor,(Qr(u)&&(u===cs||Br(u.prototype))||H(u)&&null===(u=u[ss]))&&(u=void 0),u===cs||void 0===u))return _t(g,I,S);for(m=new(void 0===u?cs:u)(ls(S-I,0)),h=0;I<S;I++,h++)I in g&&createProperty(m,h,g[I]);return m.length=h,m}});var us=entryVirtual("Array").slice,ds=Array.prototype,slice=function(t){var a=t.slice;return t===ds||$(ds,t)&&a===ds.slice?us:a},ps=Io.f("iterator"),ms=en.find,hs="find",gs=!0;hs in[]&&Array(1).find((function(){gs=!1})),_export({target:"Array",proto:!0,forced:gs},{find:function find(t){return ms(this,t,arguments.length>1?arguments[1]:void 0)}});var vs=entryVirtual("Array").find,fs=Array.prototype,find=function(t){var a=t.find;return t===fs||$(fs,t)&&a===fs.find?vs:a},ys=nt.includes,Ms=fails((function(){return!Array(1).includes()}));_export({target:"Array",proto:!0,forced:Ms},{includes:function includes(t){return ys(this,t,arguments.length>1?arguments[1]:void 0)}});var Is=entryVirtual("Array").includes,_s=wellKnownSymbol("match"),Ss=TypeError,notARegexp=function(t){if(function(t){var a;return H(t)&&(void 0!==(a=t[_s])?!!a:"RegExp"==classofRaw(t))}(t))throw Ss("The method doesn't accept regular expressions");return t},Ts=wellKnownSymbol("match"),correctIsRegexpLogic=function(t){var a=/./;try{"/./"[t](a)}catch(u){try{return a[Ts]=!1,"/./"[t](a)}catch(t){}}return!1},Cs=R("".indexOf);_export({target:"String",proto:!0,forced:!correctIsRegexpLogic("includes")},{includes:function includes(t){return!!~Cs(toString(requireObjectCoercible(this)),toString(notARegexp(t)),arguments.length>1?arguments[1]:void 0)}});var bs=entryVirtual("String").includes,Es=Array.prototype,ks=String.prototype,includes=function(t){var a=t.includes;return t===Es||$(Es,t)&&a===Es.includes?Is:"string"==typeof t||t===ks||$(ks,t)&&a===ks.includes?bs:a},Rs=en.map,As=arrayMethodHasSpeciesSupport("map");_export({target:"Array",proto:!0,forced:!As},{map:function map(t){return Rs(this,t,arguments.length>1?arguments[1]:void 0)}});var ws=entryVirtual("Array").map,Ns=Array.prototype,map$6=function(t){var a=t.map;return t===Ns||$(Ns,t)&&a===Ns.map?ws:a},xs=en.filter,Os=arrayMethodHasSpeciesSupport("filter");_export({target:"Array",proto:!0,forced:!Os},{filter:function filter(t){return xs(this,t,arguments.length>1?arguments[1]:void 0)}});var Ps=entryVirtual("Array").filter,Ls=Array.prototype,filter=function(t){var a=t.filter;return t===Ls||$(Ls,t)&&a===Ls.filter?Ps:a},Vs=createCommonjsModule((function(t,a){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={},a=Object.prototype,u=a.hasOwnProperty,m="function"==typeof Zo?Zo:{},h=m.iterator||"@@iterator",g=m.asyncIterator||"@@asyncIterator",M=m.toStringTag||"@@toStringTag";function define(t,a,u){return Ke(t,a,{value:u,enumerable:!0,configurable:!0,writable:!0}),t[a]}try{define({},"")}catch(t){define=function define(t,a,u){return t[a]=u}}function wrap(t,a,u,m){var h=a&&a.prototype instanceof Generator?a:Generator,g=vt(h.prototype),M=new Context(m||[]);return g._invoke=function(t,a,u){var m="suspendedStart";return function(h,g){if("executing"===m)throw new Error("Generator is already running");if("completed"===m){if("throw"===h)throw g;return doneResult()}for(u.method=h,u.arg=g;;){var M=u.delegate;if(M){var S=maybeInvokeDelegate(M,u);if(S){if(S===I)continue;return S}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===m)throw m="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);m="executing";var T=tryCatch(t,a,u);if("normal"===T.type){if(m=u.done?"completed":"suspendedYield",T.arg===I)continue;return{value:T.arg,done:u.done}}"throw"===T.type&&(m="completed",u.method="throw",u.arg=T.arg)}}}(t,u,M),g}function tryCatch(t,a,u){try{return{type:"normal",arg:t.call(a,u)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var I={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var S={};define(S,h,(function(){return this}));var T=ts&&ts(ts(values([])));T&&T!==a&&u.call(T,h)&&(S=T);var C=GeneratorFunctionPrototype.prototype=Generator.prototype=vt(S);function defineIteratorMethods(t){var a;forEach$1(a=["next","throw","return"]).call(a,(function(a){define(t,a,(function(t){return this._invoke(a,t)}))}))}function AsyncIterator(t,a){function invoke(m,h,g,M){var I=tryCatch(t[m],t,h);if("throw"!==I.type){var S=I.arg,T=S.value;return T&&"object"==typeof T&&u.call(T,"__await")?a.resolve(T.__await).then((function(t){invoke("next",t,g,M)}),(function(t){invoke("throw",t,g,M)})):a.resolve(T).then((function(t){S.value=t,g(S)}),(function(t){return invoke("throw",t,g,M)}))}M(I.arg)}var m;this._invoke=function(t,u){function callInvokeWithMethodAndArg(){return new a((function(a,m){invoke(t,u,a,m)}))}return m=m?m.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,a){var u=t.iterator[a.method];if(void 0===u){if(a.delegate=null,"throw"===a.method){if(t.iterator.return&&(a.method="return",a.arg=void 0,maybeInvokeDelegate(t,a),"throw"===a.method))return I;a.method="throw",a.arg=new TypeError("The iterator does not provide a 'throw' method")}return I}var m=tryCatch(u,t.iterator,a.arg);if("throw"===m.type)return a.method="throw",a.arg=m.arg,a.delegate=null,I;var h=m.arg;return h?h.done?(a[t.resultName]=h.value,a.next=t.nextLoc,"return"!==a.method&&(a.method="next",a.arg=void 0),a.delegate=null,I):h:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,I)}function pushTryEntry(t){var a={tryLoc:t[0]};1 in t&&(a.catchLoc=t[1]),2 in t&&(a.finallyLoc=t[2],a.afterLoc=t[3]),this.tryEntries.push(a)}function resetTryEntry(t){var a=t.completion||{};a.type="normal",delete a.arg,t.completion=a}function Context(t){this.tryEntries=[{tryLoc:"root"}],forEach$1(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t){var a=t[h];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var m=-1,g=function next(){for(;++m<t.length;)if(u.call(t,m))return next.value=t[m],next.done=!1,next;return next.value=void 0,next.done=!0,next};return g.next=g}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(C,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,M,"GeneratorFunction"),t.isGeneratorFunction=function(t){var a="function"==typeof t&&t.constructor;return!!a&&(a===GeneratorFunction||"GeneratorFunction"===(a.displayName||a.name))},t.mark=function(t){return It?It(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,M,"GeneratorFunction")),t.prototype=vt(C),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,g,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(a,u,m,h,g){void 0===g&&(g=$i);var M=new AsyncIterator(wrap(a,u,m,h),g);return t.isGeneratorFunction(u)?M:M.next().then((function(t){return t.done?t.value:M.next()}))},defineIteratorMethods(C),define(C,M,"Generator"),define(C,h,(function(){return this})),define(C,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var a=[];for(var u in t)a.push(u);return reverse$1(a).call(a),function next(){for(;a.length;){var u=a.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 a;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(a=this.tryEntries).call(a,resetTryEntry),!t)for(var m in this)"t"===m.charAt(0)&&u.call(this,m)&&!isNaN(+slice(m).call(m,1))&&(this[m]=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 a=this;function handle(u,m){return g.type="throw",g.arg=t,a.next=u,m&&(a.method="next",a.arg=void 0),!!m}for(var m=this.tryEntries.length-1;m>=0;--m){var h=this.tryEntries[m],g=h.completion;if("root"===h.tryLoc)return handle("end");if(h.tryLoc<=this.prev){var M=u.call(h,"catchLoc"),I=u.call(h,"finallyLoc");if(M&&I){if(this.prev<h.catchLoc)return handle(h.catchLoc,!0);if(this.prev<h.finallyLoc)return handle(h.finallyLoc)}else if(M){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,a){for(var m=this.tryEntries.length-1;m>=0;--m){var h=this.tryEntries[m];if(h.tryLoc<=this.prev&&u.call(h,"finallyLoc")&&this.prev<h.finallyLoc){var g=h;break}}g&&("break"===t||"continue"===t)&&g.tryLoc<=a&&a<=g.finallyLoc&&(g=null);var M=g?g.completion:{};return M.type=t,M.arg=a,g?(this.method="next",this.next=g.finallyLoc,I):this.complete(M)},complete:function complete(t,a){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&&a&&(this.next=a),I},finish:function finish(t){for(var a=this.tryEntries.length-1;a>=0;--a){var u=this.tryEntries[a];if(u.finallyLoc===t)return this.complete(u.completion,u.afterLoc),resetTryEntry(u),I}},catch:function _catch(t){for(var a=this.tryEntries.length-1;a>=0;--a){var u=this.tryEntries[a];if(u.tryLoc===t){var m=u.completion;if("throw"===m.type){var h=m.arg;resetTryEntry(u)}return h}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,a,u){return this.delegate={iterator:values(t),resultName:a,nextLoc:u},"next"===this.method&&(this.arg=void 0),I}},t}function _typeof(t){return _typeof="function"==typeof Zo&&"symbol"==typeof ps?function(t){return typeof t}:function(t){return t&&"function"==typeof Zo&&t.constructor===Zo&&t!==Zo.prototype?"symbol":typeof t},_typeof(t)}function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,a){for(var u=0;u<a.length;u++){var m=a[u];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Ke(t,m.key,m)}}function _createClass(t,a,u){return a&&_defineProperties(t.prototype,a),u&&_defineProperties(t,u),Ke(t,"prototype",{writable:!1}),t}function __awaiter(t,a,u,m){function adopt(t){return t instanceof u?t:new u((function(a){a(t)}))}return new(u||(u=$i))((function(u,h){function fulfilled(t){try{step(m.next(t))}catch(t){h(t)}}function rejected(t){try{step(m.throw(t))}catch(t){h(t)}}function step(t){t.done?u(t.value):adopt(t.value).then(fulfilled,rejected)}step((m=m.apply(t,a||[])).next())}))}var t={isDataReportEnable:!0,maxSize:100,msgListMaxSize:1e3,cacheMaxSize:1e3,maxDelay:3e5,maxInterval:3e4,minInterval:1e4,timeout:5e3,autoStart:!0,loginFailIgnoreInterval:72e5},a=12,u=8e3,m=function emptyFn(){},h=function(){function Reporter(a){_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(a),this.reportConfig.isDataReportEnable&&this.reportConfig.autoStart&&this.initUploadConfig()}return _createClass(Reporter,[{key:"setConfig",value:function setConfig(t){var a=Ut({},this.reportConfig.common,t.common);this.reportConfig=Ut({},this.reportConfig,t),this.reportConfig.common=a,this.reportConfig.common.sdk_type||(this.reportConfig.common.sdk_type="im")}},{key:"reportImmediately",value:function reportImmediately(t,a){var u=this;this.reportConfig.isDataReportEnable&&this.reportConfig.request(t,Ut({dataType:"json",method:"POST",timeout:this.reportConfig.timeout},a)).catch((function(t){var a,m;null===(m=null===(a=u.reportConfig)||void 0===a?void 0:a.logger)||void 0===m||m.warn("Reporter immediately upload failed",t)}))}},{key:"report",value:function report(a,u){var m=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m.priority||(m.priority=this.getEventPriority(a,u)),this.reportConfig.isDataReportEnable&&a){if("login"===a&&!1===u.succeed&&u.process_id){var h,g=u.extension&&find(h=u.extension).call(h,(function(t){return"TCP"===t.operation_type})),M=g&&g.target||"",I=u.process_id+M,S=this.lastFailLogin[I]||0;if(u.start_time-S<t.loginFailIgnoreInterval)return;this.lastFailLogin[I]=u.start_time}var T=eo();"HIGH"===m.priority?this.highPriorityMsgList.push({module:a,msg:u,createTime:T}):"NORMAL"===m.priority?this.msgList.push({module:a,msg:u,createTime:T}):"LOW"===m.priority&&this.lowPriorityMsgList.push({module:a,msg:u,createTime:T}),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,a){if(this.reportConfig.isDataReportEnable&&t&&!this.traceMsgCache[t]){var u=Ut(Ut({start_time:eo()},a),{extension:[]});this.traceMsgCache[t]=u}}},{key:"reportTraceUpdate",value:function reportTraceUpdate(t){}},{key:"reportTraceUpdateV2",value:function reportTraceUpdateV2(t,a,u){var m,h=this;if(this.reportConfig.isDataReportEnable&&this.traceMsgCache[t]){var g=this.traceMsgCache[t].extension,M=g.length,I=(new Date).getTime();0===M?a.duration=I-this.traceMsgCache[t].start_time:g[M-1].end_time?a.duration=I-g[M-1].end_time:a.duration=I-this.traceMsgCache[t].start_time,g.push(Ut({end_time:I},a));var S=g.length-1;(null==u?void 0:u.asyncParams)&&((m=this.traceMsgCache[t]).asyncPromiseArray||(m.asyncPromiseArray=[]),this.traceMsgCache[t].asyncPromiseArray.push(u.asyncParams.then((function(a){h.traceMsgCache[t]&&h.traceMsgCache[t].extension[S]&&Ut(h.traceMsgCache[t].extension[S],a)}))))}}},{key:"reportTraceEnd",value:function reportTraceEnd(t){var a,u,m=this,h=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.reportConfig.isDataReportEnable&&this.traceMsgCache[t])if("nos"!==t||!1===h){"boolean"==typeof h?this.traceMsgCache[t].succeed=!!h:this.traceMsgCache[t].state=h,this.traceMsgCache[t].duration=eo()-this.traceMsgCache[t].start_time,forEach$1(a=this.traceMsgCache[t].extension).call(a,(function(t){delete t.end_time}));var g=this.traceMsgCache[t];if(this.traceMsgCache[t]=null,g.asyncPromiseArray){(u=this.endedAsyncMsgByModule)[t]||(u[t]=[]),this.endedAsyncMsgByModule[t].push(g);var M=function asyncCallback(){var a;m.endedAsyncMsgByModule[t]&&includes(a=m.endedAsyncMsgByModule[t]).call(a,g)&&(delete g.asyncPromiseArray,m.report(t,g,{priority:m.getEventPriority(t,g)}))};$i.all(g.asyncPromiseArray).then(M).catch(M)}else this.report(t,g,{priority:this.getEventPriority(t,g)})}else this.traceMsgCache[t]=null}},{key:"getEventPriority",value:function getEventPriority(t,a){if("exceptions"===t){if(0===a.action)return"HIGH";if(2===a.action)return"HIGH";if(1===a.action&&0!==a.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,a=this;this.reportConfig.isDataReportEnable&&(forEach$1(t=Gt(this.traceMsgCache)).call(t,(function(t){a.reportTraceEnd(t,1)})),null!==this.timer&&clearTimeout(this.timer),this.setConfig=m,this.report=m,this.reportTraceStart=m,this.reportTraceUpdate=m,this.reportTraceEnd=m,this.pause=m,this.restore=m,this.destroy=m,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,m;return __awaiter(this,void 0,void 0,_regeneratorRuntime().mark((function _callee(){var h,g,M,I,S,T=this;return _regeneratorRuntime().wrap((function _callee$(C){for(var b;;)switch(C.prev=C.next){case 0:if(!this.loading){C.next=2;break}return C.abrupt("return");case 2:this.loading=!0,h=this.reportConfig.common||{},g=map$6(b=this.reportConfig.compassDataEndpoint.split(",")).call(b,(function(t){var a;return concat(a="".concat(t,"/")).call(a,T.configPath)})),M=_regeneratorRuntime().mark((function _loop(M){return _regeneratorRuntime().wrap((function _loop$(I){for(;;)switch(I.prev=I.next){case 0:if(!T.initConfigLoaded&&!T.isDestroyed){I.next=2;break}return I.abrupt("return","break");case 2:return I.prev=2,I.next=5,T.reportConfig.request(g[M],{method:"GET",dataType:"json",params:{deviceId:h.dev_id,sdkVer:h.sdk_ver,platform:h.platform,hostEnv:h.host_env,appkey:h.app_key},timeout:T.reportConfig.timeout}).then((function(t){var a,u;if(!T.isDestroyed){if(200===t.status&&t.data&&200===t.data.code){T.initConfigLoaded=!0;var m=t.data.data||{};T.reportConfig.maxSize=m.maxSize>1e3?1e3:m.maxSize,T.reportConfig.maxInterval=m.maxInterval>1e4?1e4:m.maxInterval,T.reportConfig.maxInterval=m.maxInterval<10?10:m.maxInterval,T.reportConfig.minInterval=m.minInterval<2?2:m.minInterval,T.reportConfig.maxDelay=m.maxDelay||300,T.reportConfig.maxInterval=1e3*T.reportConfig.maxInterval,T.reportConfig.minInterval=1e3*T.reportConfig.minInterval,T.reportConfig.maxDelay=1e3*T.reportConfig.maxDelay,m.endpoint?T.dataReportEndpoint=m.endpoint:T.dataReportEndpoint=g[M],T.serverAllowUpload=!0,T.loading=!1,T.reportHeartBeat()}else 200===t.status&&(T.initConfigLoaded=!0);null===(u=null===(a=T.reportConfig)||void 0===a?void 0:a.logger)||void 0===u||u.log("Get reporter upload config success")}})).catch((function(t){var m,h;T.isDestroyed||(T.loading=!1,null===(h=null===(m=T.reportConfig)||void 0===m?void 0:m.logger)||void 0===h||h.error("Get reporter upload config failed",t),T.reqRetryCount<a&&(T.reqRetryCount++,po((function(){T.isDestroyed||T.initUploadConfig()}),u)))}));case 5:I.next=14;break;case 7:if(I.prev=7,I.t0=I.catch(2),!T.isDestroyed){I.next=11;break}return I.abrupt("return",{v:void 0});case 11:T.loading=!1,null===(m=null===(t=T.reportConfig)||void 0===t?void 0:t.logger)||void 0===m||m.error("Exec reporter request failed",I.t0),T.reqRetryCount<a&&(T.reqRetryCount++,po((function(){T.isDestroyed||T.initUploadConfig()}),u));case 14:case"end":return I.stop()}}),_loop,null,[[2,7]])})),I=0;case 7:if(!(I<g.length)){C.next=17;break}return C.delegateYield(M(I),"t0",9);case 9:if("break"!==(S=C.t0)){C.next=12;break}return C.abrupt("break",17);case 12:if("object"!==_typeof(S)){C.next=14;break}return C.abrupt("return",S.v);case 14:I++,C.next=7;break;case 17:case"end":return C.stop()}}),_callee,this)})))}},{key:"reportHeartBeat",value:function reportHeartBeat(){var t=this;this.isDestroyed||(this.timer=po((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,a,u,m,h,g,M=this,I={},S=eo();this.highPriorityMsgList=filter(t=this.highPriorityMsgList).call(t,(function(t){return S-t.createTime<M.reportConfig.maxDelay})),this.msgList=filter(a=this.msgList).call(a,(function(t){return S-t.createTime<M.reportConfig.maxDelay})),this.lowPriorityMsgList=filter(u=this.lowPriorityMsgList).call(u,(function(t){return S-t.createTime<M.reportConfig.maxDelay})),this.cacheMsgList=filter(m=this.cacheMsgList).call(m,(function(t){return S-t.createTime<M.reportConfig.maxDelay}));var T=slice(h=this.highPriorityMsgList).call(h,0,this.reportConfig.maxSize);if(this.highPriorityMsgList=slice(g=this.highPriorityMsgList).call(g,T.length),T.length<this.reportConfig.maxSize){var C,b,E=this.reportConfig.maxSize-T.length;T=concat(T).call(T,slice(C=this.msgList).call(C,0,E)),this.msgList=slice(b=this.msgList).call(b,E)}if(T.length<this.reportConfig.maxSize){var k,R,A=this.reportConfig.maxSize-T.length;T=concat(T).call(T,slice(k=this.lowPriorityMsgList).call(k,0,A)),this.lowPriorityMsgList=slice(R=this.lowPriorityMsgList).call(R,A)}if(T.length<this.reportConfig.maxSize){var w,N,x=this.reportConfig.maxSize-T.length;T=concat(T).call(T,slice(w=this.cacheMsgList).call(w,0,x)),this.cacheMsgList=slice(N=this.cacheMsgList).call(N,x)}return forEach$1(T).call(T,(function(t){I[t.module]?I[t.module].push(t.msg):I[t.module]=[t.msg]})),{uploadMsgArr:T,uploadMsg:I}}},{key:"upload",value:function upload(){var t,a,u=this;if(this.isUploadEnable&&this.serverAllowUpload&&!(this.lastReportTime&&eo()-this.lastReportTime<this.reportConfig.minInterval)){var m=this.getUploadMsg(),h=m.uploadMsgArr,g=m.uploadMsg;if(h.length){this.lastReportTime=eo();try{var M,I=concat(M="".concat(this.dataReportEndpoint,"/")).call(M,this.dataReportPath);this.reportConfig.request(I,{dataType:"json",method:"POST",data:{common:this.reportConfig.common,event:g},headers:{sdktype:"im"},timeout:this.reportConfig.timeout}).catch((function(t){var a,m,g,M;u.cacheMsgList=slice(a=concat(m=u.cacheMsgList).call(m,h)).call(a,0,u.reportConfig.cacheMaxSize),null===(M=null===(g=u.reportConfig)||void 0===g?void 0:g.logger)||void 0===M||M.warn("Reporter upload failed",t)}))}catch(u){null===(a=null===(t=this.reportConfig)||void 0===t?void 0:t.logger)||void 0===a||a.warn("Exec reporter request failed",u)}clearTimeout(this.timer),this.reportHeartBeat()}}}}]),Reporter}();return h}()})),Us=entryVirtual("Array").values,Ds=Array.prototype,qs={DOMTokenList:!0,NodeList:!0},values=function(t){var a=t.values;return t===Ds||$(Ds,t)&&a===Ds.values||de(qs,Sr(t))?Us:a},Bs=nt.indexOf,Fs=R([].indexOf),Gs=!!Fs&&1/Fs([1],1,-0)<0,Hs=arrayMethodIsStrict("indexOf");_export({target:"Array",proto:!0,forced:Gs||!Hs},{indexOf:function indexOf(t){var a=arguments.length>1?arguments[1]:void 0;return Gs?Fs(this,t,a)||0:Bs(this,t,a)}});var js=entryVirtual("Array").indexOf,$s=Array.prototype,indexOf=function(t){var a=t.indexOf;return t===$s||$($s,t)&&a===$s.indexOf?js:a},zs=en.every,Ws=arrayMethodIsStrict("every");_export({target:"Array",proto:!0,forced:!Ws},{every:function every(t){return zs(this,t,arguments.length>1?arguments[1]:void 0)}});var Ks=entryVirtual("Array").every,Ys=Array.prototype,every=function(t){var a=t.every;return t===Ys||$(Ys,t)&&a===Ys.every?Ks:a};var Qs=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)}))||Qs?function isExtensible(t){return!!H(t)&&((!Qs||"ArrayBuffer"!=classofRaw(t))&&(!Js||Js(t)))}:Js,Zs=!fails((function(){return Object.isExtensible(Object.preventExtensions({}))})),ec=createCommonjsModule((function(t){var a=Ge.f,u=!1,m=uid("meta"),h=0,setMetadata=function(t){a(t,m,{value:{objectID:"O"+h++,weakData:{}}})},g=t.exports={enable:function(){g.enable=function(){},u=!0;var t=qn.f,a=R([].splice),h={};h[m]=1,t(h).length&&(qn.f=function(u){for(var h=t(u),g=0,M=h.length;g<M;g++)if(h[g]===m){a(h,g,1);break}return h},_export({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Mo.f}))},fastKey:function(t,a){if(!H(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!de(t,m)){if(!Xs(t))return"F";if(!a)return"E";setMetadata(t)}return t[m].objectID},getWeakData:function(t,a){if(!de(t,m)){if(!Xs(t))return!0;if(!a)return!1;setMetadata(t)}return t[m].weakData},onFreeze:function(t){return Zs&&u&&Xs(t)&&!de(t,m)&&setMetadata(t),t}};at[m]=!0})),tc=Ge.f,rc=en.forEach,nc=nr.set,ac=nr.getterFor,collection=function(t,a,u){var m,g=-1!==t.indexOf("Map"),M=-1!==t.indexOf("Weak"),I=g?"set":"add",S=h[t],T=S&&S.prototype,C={};if(A&&isCallable(S)&&(M||T.forEach&&!fails((function(){(new S).entries().next()})))){var b=(m=a((function(a,u){nc(anInstance(a,b),{type:t,collection:new S}),null!=u&&iterate(u,a[I],{that:a,AS_ENTRIES:g})}))).prototype,E=ac(t);rc(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var a="add"==t||"set"==t;!(t in T)||M&&"clear"==t||He(b,t,(function(u,m){var h=E(this).collection;if(!a&&M&&!H(u))return"get"==t&&void 0;var g=h[t](0===u?0:u,m);return a?this:g}))})),M||tc(b,"size",{configurable:!0,get:function(){return E(this).collection.size}})}else m=u.getConstructor(a,t,g,I),ec.enable();return setToStringTag(m,t,!1,!0),C[t]=m,_export({global:!0,forced:!0},C),M||u.setStrong(m,t,g),m},defineBuiltIns=function(t,a,u){for(var m in a)u&&u.unsafe&&t[m]?t[m]=a[m]:defineBuiltIn(t,m,a[m],u);return t},ic=Ge.f,oc=ec.fastKey,sc=nr.set,cc=nr.getterFor,lc={getConstructor:function(t,a,u,m){var h=t((function(t,h){anInstance(t,g),sc(t,{type:a,index:ht(null),first:void 0,last:void 0,size:0}),A||(t.size=0),isNullOrUndefined(h)||iterate(h,t[m],{that:t,AS_ENTRIES:u})})),g=h.prototype,M=cc(a),define=function(t,a,u){var m,h,g=M(t),I=getEntry(t,a);return I?I.value=u:(g.last=I={index:h=oc(a,!0),key:a,value:u,previous:m=g.last,next:void 0,removed:!1},g.first||(g.first=I),m&&(m.next=I),A?g.size++:t.size++,"F"!==h&&(g.index[h]=I)),t},getEntry=function(t,a){var u,m=M(t),h=oc(a);if("F"!==h)return m.index[h];for(u=m.first;u;u=u.next)if(u.key==a)return u};return defineBuiltIns(g,{clear:function clear(){for(var t=M(this),a=t.index,u=t.first;u;)u.removed=!0,u.previous&&(u.previous=u.previous.next=void 0),delete a[u.index],u=u.next;t.first=t.last=void 0,A?t.size=0:this.size=0},delete:function(t){var a=this,u=M(a),m=getEntry(a,t);if(m){var h=m.next,g=m.previous;delete u.index[m.index],m.removed=!0,g&&(g.next=h),h&&(h.previous=g),u.first==m&&(u.first=h),u.last==m&&(u.last=g),A?u.size--:a.size--}return!!m},forEach:function forEach(t){for(var a,u=M(this),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0);a=a?a.next:u.first;)for(m(a.value,a.key,this);a&&a.removed;)a=a.previous},has:function has(t){return!!getEntry(this,t)}}),defineBuiltIns(g,u?{get:function get(t){var a=getEntry(this,t);return a&&a.value},set:function set(t,a){return define(this,0===t?0:t,a)}}:{add:function add(t){return define(this,t=0===t?0:t,t)}}),A&&ic(g,"size",{get:function(){return M(this).size}}),h},setStrong:function(t,a,u){var m=a+" Iterator",h=cc(a),g=cc(m);iteratorDefine(t,a,(function(t,a){sc(this,{type:m,target:t,state:h(t),kind:a,last:void 0})}),(function(){for(var t=g(this),a=t.kind,u=t.last;u&&u.removed;)u=u.previous;return t.target&&(t.last=u=u?u.next:t.state.first)?"keys"==a?{value:u.key,done:!1}:"values"==a?{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(a)}};collection("Map",(function(t){return function Map(){return t(this,arguments.length?arguments[0]:void 0)}}),lc);var uc=j.Map,dc=[].push,pc=function from(t){var a,u,m,h,g=arguments.length,M=g>1?arguments[1]:void 0;return aConstructor(this),(a=void 0!==M)&&aCallable(M),isNullOrUndefined(t)?new this:(u=[],a?(m=0,h=functionBindContext(M,g>2?arguments[2]:void 0),iterate(t,(function(t){N(dc,u,h(t,m++))}))):iterate(t,dc,{that:u}),new this(u))};_export({target:"Map",stat:!0,forced:!0},{from:pc});var mc=function of(){return new this(_t(arguments))};_export({target:"Map",stat:!0,forced:!0},{of:mc});var hc=function deleteAll(){for(var t,a=anObject(this),u=aCallable(a.delete),m=!0,h=0,g=arguments.length;h<g;h++)t=N(u,a,arguments[h]),m=m&&t;return!!m};_export({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:hc});_export({target:"Map",proto:!0,real:!0,forced:!0},{emplace:function emplace(t,a){var u,m,h=anObject(this),g=aCallable(h.get),M=aCallable(h.has),I=aCallable(h.set);return N(M,h,t)?(u=N(g,h,t),"update"in a&&(u=a.update(u,t,h),N(I,h,t,u)),u):(m=a.insert(t,h),N(I,h,t,m),m)}});var gc=getIterator;_export({target:"Map",proto:!0,real:!0,forced:!0},{every:function every(t){var a=anObject(this),u=gc(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return!iterate(u,(function(t,u,h){if(!m(u,t,a))return h()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{filter:function filter(t){var a=anObject(this),u=gc(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0),h=new(speciesConstructor(a,getBuiltIn("Map"))),g=aCallable(h.set);return iterate(u,(function(t,u){m(u,t,a)&&N(g,h,t,u)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),h}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{find:function find(t){var a=anObject(this),u=gc(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u,h){if(m(u,t,a))return h(u)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function findKey(t){var a=anObject(this),u=gc(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u,h){if(m(u,t,a))return h(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var vc=R([].push);_export({target:"Map",stat:!0,forced:!0},{groupBy:function groupBy(t,a){aCallable(a);var u=getIterator(t),m=new this,h=aCallable(m.has),g=aCallable(m.get),M=aCallable(m.set);return iterate(u,(function(t){var u=a(t);N(h,m,u)?vc(N(g,m,u),t):N(M,m,u,[t])}),{IS_ITERATOR:!0}),m}});_export({target:"Map",proto:!0,real:!0,forced:!0},{includes:function includes(t){return iterate(gc(anObject(this)),(function(a,u,m){if((h=u)===(g=t)||h!=h&&g!=g)return m();var h,g}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Map",stat:!0,forced:!0},{keyBy:function keyBy(t,a){var u=new this;aCallable(a);var m=aCallable(u.set);return iterate(t,(function(t){N(m,u,a(t),t)})),u}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function keyOf(t){return iterate(gc(anObject(this)),(function(a,u,m){if(u===t)return m(a)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function mapKeys(t){var a=anObject(this),u=gc(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0),h=new(speciesConstructor(a,getBuiltIn("Map"))),g=aCallable(h.set);return iterate(u,(function(t,u){N(g,h,m(u,t,a),u)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),h}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function mapValues(t){var a=anObject(this),u=gc(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0),h=new(speciesConstructor(a,getBuiltIn("Map"))),g=aCallable(h.set);return iterate(u,(function(t,u){N(g,h,t,m(u,t,a))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),h}}),_export({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function merge(t){for(var a=anObject(this),u=aCallable(a.set),m=arguments.length,h=0;h<m;)iterate(arguments[h++],u,{that:a,AS_ENTRIES:!0});return a}});var fc=TypeError;_export({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function reduce(t){var a=anObject(this),u=gc(a),m=arguments.length<2,h=m?void 0:arguments[1];if(aCallable(t),iterate(u,(function(u,g){m?(m=!1,h=g):h=t(h,g,u,a)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),m)throw fc("Reduce of empty map with no initial value");return h}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{some:function some(t){var a=anObject(this),u=gc(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u,h){if(m(u,t,a))return h()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var yc=TypeError;_export({target:"Map",proto:!0,real:!0,forced:!0},{update:function update(t,a){var u=anObject(this),m=aCallable(u.get),h=aCallable(u.has),g=aCallable(u.set),M=arguments.length;aCallable(a);var I=N(h,u,t);if(!I&&M<3)throw yc("Updating absent value");var S=I?N(m,u,t):aCallable(M>2?arguments[2]:void 0)(t,u);return N(g,u,t,a(S,t,u)),u}});var Mc=TypeError,Ic=function upsert(t,a){var u,m=anObject(this),h=aCallable(m.get),g=aCallable(m.has),M=aCallable(m.set),I=arguments.length>2?arguments[2]:void 0;if(!isCallable(a)&&!isCallable(I))throw Mc("At least one callback required");return N(g,m,t)?(u=N(h,m,t),isCallable(a)&&(u=a(u),N(M,m,t,u))):isCallable(I)&&(u=I(),N(M,m,t,u)),u};_export({target:"Map",proto:!0,real:!0,forced:!0},{upsert:Ic}),_export({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:Ic});var _c=uc,Sc=createCommonjsModule((function(t){function _getPrototypeOf(a){var u;return t.exports=_getPrototypeOf=It?bind$1(u=ts).call(u):function _getPrototypeOf(t){return t.__proto__||ts(t)},t.exports.__esModule=!0,t.exports.default=t.exports,_getPrototypeOf(a)}t.exports=_getPrototypeOf,t.exports.__esModule=!0,t.exports.default=t.exports})),Tc=createCommonjsModule((function(t){t.exports=function _isNativeFunction(t){var a;return-1!==indexOf(a=Function.toString.call(t)).call(a,"[native code]")},t.exports.__esModule=!0,t.exports.default=t.exports})),Cc=getBuiltIn("Reflect","construct"),bc=Object.prototype,Ec=[].push,kc=fails((function(){function F(){}return!(Cc((function(){}),[],F)instanceof F)})),Rc=!fails((function(){Cc((function(){}))})),Ac=kc||Rc;_export({target:"Reflect",stat:!0,forced:Ac,sham:Ac},{construct:function construct(t,a){aConstructor(t),anObject(a);var u=arguments.length<3?t:aConstructor(arguments[2]);if(Rc&&!kc)return Cc(t,a,u);if(t==u){switch(a.length){case 0:return new t;case 1:return new t(a[0]);case 2:return new t(a[0],a[1]);case 3:return new t(a[0],a[1],a[2]);case 4:return new t(a[0],a[1],a[2],a[3])}var m=[null];return T(Ec,m,a),new(T(Et,t,m))}var h=u.prototype,g=ht(H(h)?h:bc),M=T(t,g,a);return H(M)?M:g}});var wc=j.Reflect.construct,Nc=createCommonjsModule((function(t){t.exports=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!wc)return!1;if(wc.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(wc(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports.default=t.exports})),xc=createCommonjsModule((function(t){function _construct(a,u,m){var h;Nc()?(t.exports=_construct=bind$1(h=wc).call(h),t.exports.__esModule=!0,t.exports.default=t.exports):(t.exports=_construct=function _construct(t,a,u){var m=[null];m.push.apply(m,a);var h=new(bind$1(Function).apply(t,m));return u&&At(h,u.prototype),h},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})),Oc=createCommonjsModule((function(t){function _wrapNativeSuper(a){var u="function"==typeof _c?new _c:void 0;return t.exports=_wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!Tc(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,Sc(this).constructor)}return Wrapper.prototype=vt(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),At(Wrapper,t)},t.exports.__esModule=!0,t.exports.default=t.exports,_wrapNativeSuper(a)}t.exports=_wrapNativeSuper,t.exports.__esModule=!0,t.exports.default=t.exports})),Pc=getDefaultExportFromCjs(Oc),Lc=TypeError,createMethod$1=function(t){return function(a,u,m,h){aCallable(u);var g=toObject(a),M=q(g),I=lengthOfArrayLike(g),S=t?I-1:0,T=t?-1:1;if(m<2)for(;;){if(S in M){h=M[S],S+=T;break}if(S+=T,t?S<0:I<=S)throw Lc("Reduce of empty array with no initial value")}for(;t?S>=0:I>S;S+=T)S in M&&(h=u(h,M[S],S,g));return h}},Vc={left:createMethod$1(!1),right:createMethod$1(!0)}.left,Uc=arrayMethodIsStrict("reduce");_export({target:"Array",proto:!0,forced:!Uc||!ua&&J>79&&J<83},{reduce:function reduce(t){var a=arguments.length;return Vc(this,t,a,a>1?arguments[1]:void 0)}});var Dc,qc,Bc,Fc,Gc,Hc,jc,$c,zc,Wc,Kc,Yc,Qc,Jc,Xc,Zc,el,tl,rl,nl,al,il,ol,sl,cl,ll,ul,dl,pl,ml,hl,gl,vl,fl,yl,Ml,Il,_l,Sl,Tl,Cl,bl,El,kl,Rl,Al,wl,Nl,xl,Ol,Pl,Ll,Vl,Ul,Dl,ql,Bl=entryVirtual("Array").reduce,Fl=Array.prototype,reduce=function(t){var a=t.reduce;return t===Fl||$(Fl,t)&&a===Fl.reduce?Bl:a};!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"}(Dc||(Dc={})),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"}(qc||(qc={})),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"}(Bc||(Bc={})),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"}(Gc||(Gc={})),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"}(Hc||(Hc={})),function(t){t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_RECEIVED=1]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_RECEIVED",t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_REJECTED=2]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_REJECTED"}(jc||(jc={})),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"}($c||($c={})),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"}(zc||(zc={})),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"}(Wc||(Wc={})),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"}(Kc||(Kc={})),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"}(Yc||(Yc={})),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"}(Qc||(Qc={})),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"}(il||(il={})),function(t){t[t.V2NIM_SEARCH_DIRECTION_BACKWARD=0]="V2NIM_SEARCH_DIRECTION_BACKWARD",t[t.V2NIM_SEARCH_DIRECTION_FORWARD=1]="V2NIM_SEARCH_DIRECTION_FORWARD"}(ol||(ol={})),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"}(ml||(ml={})),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"}(hl||(hl={})),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"}(gl||(gl={})),function(t){t[t.V2NIM_SORT_ORDER_DESC=0]="V2NIM_SORT_ORDER_DESC",t[t.V2NIM_SORT_ORDER_ASC=1]="V2NIM_SORT_ORDER_ASC"}(vl||(vl={})),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"}(fl||(fl={})),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"}(yl||(yl={})),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"}(Ml||(Ml={})),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"}(Il||(Il={})),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"}(_l||(_l={})),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"}(El||(El={})),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"}(kl||(kl={})),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"}(Rl||(Rl={})),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"}(Al||(Al={})),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"}(Nl||(Nl={})),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"}(xl||(xl={})),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"}(Ol||(Ol={})),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"}(Pl||(Pl={})),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"}(Ll||(Ll={})),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"}(Vl||(Vl={})),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"}(Ul||(Ul={})),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"}(Dl||(Dl={})),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"}(ql||(ql={}));var Gl={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"}},Hl=Gt(Gl),jl=reduce(Hl).call(Hl,(function(t,a){var u=Gl[a];return t[a]=u.code,t}),{}),$l=reduce(Hl).call(Hl,(function(t,a){var u=Gl[a];return t[u.code]=u.message,t}),{}),zl=Object.freeze({__proto__:null,V2NIMErrorCode:jl,V2NIMErrorDesc:$l,get V2NIMDataSyncLevel(){return Dc},get V2NIMDataSyncType(){return qc},get V2NIMDataSyncState(){return Bc},get V2NIMConversationType(){return Fc},get V2NIMLastMessageState(){return Gc},get V2NIMFriendAddMode(){return Hc},get V2NIMFriendAddApplicationType(){return jc},get V2NIMFriendAddApplicationStatus(){return $c},get V2NIMFriendDeletionType(){return zc},get V2NIMFriendVerifyType(){return Wc},get V2NIMLoginAuthType(){return Kc},get V2NIMLoginStatus(){return Yc},get V2NIMLoginClientType(){return Qc},get V2NIMKickedOfflineReason(){return Jc},get V2NIMLoginClientChange(){return Xc},get V2NIMConnectStatus(){return Zc},get V2NIMMessageType(){return al},get V2NIMMessageNotificationType(){return sl},get V2NIMMessageAttachmentUploadState(){return cl},get V2NIMMessageSendingState(){return ll},get V2NIMQueryDirection(){return ul},get V2NIMMessageRevokeType(){return pl},get V2NIMMessagePinState(){return ml},get V2NIMMessageQuickCommentType(){return hl},get V2NIMClientAntispamOperateType(){return gl},get V2NIMSortOrder(){return vl},get V2NIMSystemMessageType(){return fl},get V2NIMMessageAIStreamStatus(){return el},get V2NIMMessageAIStreamStopOpType(){return tl},get V2NIMMessageAIRegenOpType(){return rl},get V2NIMMessageAIStatus(){return nl},get V2NIMSearchKeywordMatchType(){return il},get V2NIMClearHistoryMode(){return dl},get V2NIMMessageStreamStatus(){return yl},get V2NIMTeamMessageMuteMode(){return Il},get V2NIMP2PMessageMuteMode(){return _l},get V2NIMTeamMemberRoleQueryType(){return Sl},get V2NIMTeamType(){return Tl},get V2NIMTeamJoinMode(){return Cl},get V2NIMTeamAgreeMode(){return bl},get V2NIMTeamInviteMode(){return El},get V2NIMTeamUpdateInfoMode(){return kl},get V2NIMTeamChatBannedMode(){return Rl},get V2NIMTeamUpdateExtensionMode(){return Al},get V2NIMTeamJoinActionType(){return Nl},get V2NIMTeamJoinActionStatus(){return xl},get V2NIMTeamNotificationType(){return Ol},get V2NIMTeamMemberRole(){return wl},get V2NIMAIModelRoleType(){return Vl},get V2NIMAIModelType(){return Pl},get V2NIMAIModelStreamCallStatus(){return Ll},get V2NIMSignallingChannelType(){return Dl},get V2NIMSignallingEventType(){return Ul},get V2NIMUserStatusType(){return ql}}),Wl=function(t){function V2NIMErrorImpl(a){var u;return(u=t.call(this,a.desc)||this).name="V2NIMError",u.code=a.code||0,u.desc=a.desc||$l[u.code]||Zl[u.code]||"",u.message=u.desc,u.detail=a.detail||{},u}return wt(V2NIMErrorImpl,t),V2NIMErrorImpl.prototype.toString=function toString(){var t,a=this.name+"\n code: "+this.code+'\n message: "'+this.message+'"\n detail: '+(this.detail?Vn(this.detail):"");return(null===(t=null==this?void 0:this.detail)||void 0===t?void 0:t.rawError)&&(a+="\n rawError: "+this.detail.rawError.message),a},V2NIMErrorImpl}(Pc(Error));var Kl=function(t){function ValidateError(a,u,m){var h;return void 0===u&&(u={}),(h=t.call(this,{code:jl.V2NIM_ERROR_CODE_PARAMETER_ERROR,detail:{reason:a,rules:m,data:u}})||this).name="validateError",h.message=h.message+"\n"+Vn(h.detail,null,2),h.data=u,h.rules=m,h}return wt(ValidateError,t),ValidateError}(Wl),Yl=function(t){function ValidateErrorV2(a){var u,m,h,g;return(u=t.call(this,{code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:null===(m=a.detail)||void 0===m?void 0:m.reason,rules:null===(h=a.detail)||void 0===h?void 0:h.rules,data:null===(g=a.detail)||void 0===g?void 0:g.data}})||this).name="ValidateErrorV2",u}return wt(ValidateErrorV2,t),ValidateErrorV2}(Wl),Ql=function(t){function FormatError(a,u,m){var h;return(h=t.call(this,{code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:a,key:u,rules:m}})||this).name="formatError",h}return wt(FormatError,t),FormatError}(Wl),Jl=function(t){function UploadError(a){var u;return(u=t.call(this,Ut({code:400},a))||this).desc=u.desc||"upload file error",u.message=u.desc,u.name="uploadError",u}return wt(UploadError,t),UploadError}(Wl),Xl=function(t){function CustomError(a,u,m){var h;return void 0===u&&(u={}),void 0===m&&(m=400),(h=t.call(this,{code:m,desc:a,detail:u})||this).name="customError",h.data=u,h}return wt(CustomError,t),CustomError}(Wl),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"};function difference(t,a){return a=a||[],filter(t=t||[]).call(t,(function(t){return-1===indexOf(a).call(a,t)}))}function replacer(t,a){return a instanceof RegExp?"__REGEXP "+a.toString():a}function validate(t,a,u,m){var h;void 0===a&&(a={}),void 0===m&&(m=!1);var g={};return forEach$1(h=Gt(t)).call(h,(function(h){var M=t[h].type,I=u?"In "+u+", ":"";if(null==a){var S=I+"param is null or undefined";throw m?new Yl({detail:{reason:S,data:{key:h},rules:"required"}}):new Kl(S,{key:h},"required")}if(void 0===a[h]){if(!1===t[h].required)return void(g[h]=a[h]);var T=I+"param '"+h+"' is required";throw m?new Yl({detail:{reason:T,data:{key:h},rules:"required"}}):new Kl(T,{key:h},"required")}var C=eu[M];if(C&&!C(a,h,t[h],m)){var b=I+"param '"+h+"' unexpected",E={key:h,value:a[h]};throw m?new Yl({detail:{reason:b,data:E,rules:Vn(t[h],replacer)}}):new Kl(b,E,Vn(t[h],replacer))}g[h]=a[h]})),g}var eu={string:function string(t,a,u){var m=u.allowEmpty,h=u.max,g=u.min,M=u.regExp,I=t[a];return"string"==typeof I&&((!1!==m||""!==I)&&(!("number"==typeof h&&I.length>h)&&(!("number"==typeof g&&I.length<g)&&!(function isRegExp(t){return"[object RegExp]"===Object.prototype.toString.call(t)}(M)&&!M.test(I)))))},number:function number(t,a,u){var m=u.min,h=u.max,g=t[a];return"number"==typeof g&&(!("number"==typeof m&&g<m)&&!("number"==typeof h&&g>h))},boolean:function boolean(t,a){return"boolean"==typeof t[a]},file:function file(t,a){return!0},enum:function _enum(t,a,u){var m=values(u),h=t[a];return!m||indexOf(m).call(m,h)>-1},jsonstr:function jsonstr(t,a){try{var u=JSON.parse(t[a]);return"object"==typeof u&&null!==u}catch(t){return!1}},func:function func(t,a){return"function"==typeof t[a]},array:function array(t,a,u,m){void 0===m&&(m=!1);var h=u.itemType,g=u.itemRules,M=u.rules,I=u.min,S=u.max,T=values(u),C=t[a];if(!Un(C))return!1;if("number"==typeof S&&C.length>S)return!1;if("number"==typeof I&&C.length<I)return!1;if(g)forEach$1(C).call(C,(function(t,u){var h,M;validate(((h={})[u]=g,h),((M={})[u]=t,M),a+"["+u+"]",m)}));else if(M)forEach$1(C).call(C,(function(t,u){return validate(M,t,a+"["+u+"]",m)}));else if("enum"===h){if(T&&difference(C,T).length)return!1}else if(h&&!every(C).call(C,(function(t){return typeof t===h})))return!1;return!0},object:function object(t,a,u,m){void 0===m&&(m=!1);var h=u.rules,g=u.allowEmpty,M=t[a];if("object"!=typeof M||null===M)return!1;if(h){var I=Gt(h),S=Gt(M),T=filter(S).call(S,(function(t){return indexOf(I).call(I,t)>-1}));if(!1===g&&0===T.length)return!1;validate(h,M,a,m)}return!0}};function validateConversationId(t,a){if(!t)throw new Wl({code:jl.V2NIM_ERROR_CODE_ILLEGAL_STATE});validate({conversationId:{type:"string",allowEmpty:!1,regExp:new RegExp("^"+t+"\\|[1-3]\\|")}},{conversationId:a},"",!0)}var callWithSafeIterationClosing=function(t,a,u,m){try{return m?a(anObject(u)[0],u[1]):a(u)}catch(a){iteratorClose(t,"throw",a)}},tu=Array,ru=!checkCorrectnessOfIteration((function(t){Array.from(t)}));_export({target:"Array",stat:!0,forced:ru},{from:function from(t){var a=toObject(t),u=Qr(this),m=arguments.length,h=m>1?arguments[1]:void 0,g=void 0!==h;g&&(h=functionBindContext(h,m>2?arguments[2]:void 0));var M,I,S,T,C,b,E=getIteratorMethod$5(a),k=0;if(!E||this===tu&&isArrayIteratorMethod(E))for(M=lengthOfArrayLike(a),I=u?new this(M):tu(M);M>k;k++)b=g?h(a[k],k):a[k],createProperty(I,k,b);else for(C=(T=getIterator(a,E)).next,I=u?new this:[];!(S=N(C,T)).done;k++)b=g?callWithSafeIterationClosing(T,h,[S.value,k],!0):S.value,createProperty(I,k,b);return I.length=k,I}});var nu=j.Array.from,au=getIteratorMethod$5;function _createForOfIteratorHelperLoose$d(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$d(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$d(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$d(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$d(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var iu=function(){function TimerManager(){this.timerList=[],this.id=1,this.timer=null,this.timeout=0}var t=TimerManager.prototype;return t.addTimer=function addTimer(t,a,u){void 0===a&&(a=0),void 0===u&&(u=1);var m=(new Date).getTime(),h=this.id;return this.timerList.push({id:h,loop:u,count:0,timeout:m+a,interval:a,callback:t}),this.id++,this.checkTimer(m),h},t.checkTimer=function checkTimer(t){if(void 0===t&&(t=(new Date).getTime()),this.removeFinished(),0!==this.timerList.length||null==this.timer){for(var a,u,m=0,h=_createForOfIteratorHelperLoose$d(this.timerList);!(a=h()).done;){var g=a.value;(0===m||m>g.timeout)&&(m=g.timeout)}if(0!==this.timerList.length)if(null===this.timer||m<this.timeout||this.timeout<t)this.timer=po(bind$1(u=this.nowTime).call(u,this),m-t),this.timeout=m}},t.nowTime=function nowTime(){for(var t,nowTime=(new Date).getTime(),a=_createForOfIteratorHelperLoose$d(this.timerList);!(t=a()).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 a=this.timerList.length-1;a>=0;a--){var u;if(this.timerList[a].id===t)splice(u=this.timerList).call(u,a,1)}},t.removeFinished=function removeFinished(){for(var t=this.timerList.length-1;t>=0;t--){var a,u=this.timerList[t];if(u.loop>=0&&u.count>=u.loop)splice(a=this.timerList).call(a,t,1)}},t.destroy=function destroy(){this.clerTime(),this.timerList=[],this.id=1,this.timer=null},TimerManager}(),ou=createCommonjsModule((function(t){function _typeof(a){return t.exports=_typeof="function"==typeof Zo&&"symbol"==typeof ps?function(t){return typeof t}:function(t){return t&&"function"==typeof Zo&&t.constructor===Zo&&t!==Zo.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,_typeof(a)}t.exports=_typeof,t.exports.__esModule=!0,t.exports.default=t.exports})),su=createCommonjsModule((function(t){var a=ou.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={},m=Object.prototype,h=m.hasOwnProperty,g="function"==typeof Zo?Zo:{},M=g.iterator||"@@iterator",I=g.asyncIterator||"@@asyncIterator",S=g.toStringTag||"@@toStringTag";function define(t,a,u){return Ke(t,a,{value:u,enumerable:!0,configurable:!0,writable:!0}),t[a]}try{define({},"")}catch(t){define=function define(t,a,u){return t[a]=u}}function wrap(t,a,u,m){var h=a&&a.prototype instanceof Generator?a:Generator,g=vt(h.prototype),M=new Context(m||[]);return g._invoke=function(t,a,u){var m="suspendedStart";return function(h,g){if("executing"===m)throw new Error("Generator is already running");if("completed"===m){if("throw"===h)throw g;return doneResult()}for(u.method=h,u.arg=g;;){var M=u.delegate;if(M){var I=maybeInvokeDelegate(M,u);if(I){if(I===T)continue;return I}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===m)throw m="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);m="executing";var S=tryCatch(t,a,u);if("normal"===S.type){if(m=u.done?"completed":"suspendedYield",S.arg===T)continue;return{value:S.arg,done:u.done}}"throw"===S.type&&(m="completed",u.method="throw",u.arg=S.arg)}}}(t,u,M),g}function tryCatch(t,a,u){try{return{type:"normal",arg:t.call(a,u)}}catch(t){return{type:"throw",arg:t}}}u.wrap=wrap;var T={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var C={};define(C,M,(function(){return this}));var b=ts&&ts(ts(values([])));b&&b!==m&&h.call(b,M)&&(C=b);var E=GeneratorFunctionPrototype.prototype=Generator.prototype=vt(C);function defineIteratorMethods(t){var a;forEach$1(a=["next","throw","return"]).call(a,(function(a){define(t,a,(function(t){return this._invoke(a,t)}))}))}function AsyncIterator(t,u){function invoke(m,g,M,I){var S=tryCatch(t[m],t,g);if("throw"!==S.type){var T=S.arg,C=T.value;return C&&"object"==a(C)&&h.call(C,"__await")?u.resolve(C.__await).then((function(t){invoke("next",t,M,I)}),(function(t){invoke("throw",t,M,I)})):u.resolve(C).then((function(t){T.value=t,M(T)}),(function(t){return invoke("throw",t,M,I)}))}I(S.arg)}var m;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new u((function(u,m){invoke(t,a,u,m)}))}return m=m?m.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,a){var u=t.iterator[a.method];if(void 0===u){if(a.delegate=null,"throw"===a.method){if(t.iterator.return&&(a.method="return",a.arg=void 0,maybeInvokeDelegate(t,a),"throw"===a.method))return T;a.method="throw",a.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var m=tryCatch(u,t.iterator,a.arg);if("throw"===m.type)return a.method="throw",a.arg=m.arg,a.delegate=null,T;var h=m.arg;return h?h.done?(a[t.resultName]=h.value,a.next=t.nextLoc,"return"!==a.method&&(a.method="next",a.arg=void 0),a.delegate=null,T):h:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,T)}function pushTryEntry(t){var a={tryLoc:t[0]};1 in t&&(a.catchLoc=t[1]),2 in t&&(a.finallyLoc=t[2],a.afterLoc=t[3]),this.tryEntries.push(a)}function resetTryEntry(t){var a=t.completion||{};a.type="normal",delete a.arg,t.completion=a}function Context(t){this.tryEntries=[{tryLoc:"root"}],forEach$1(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t){var a=t[M];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var u=-1,m=function next(){for(;++u<t.length;)if(h.call(t,u))return next.value=t[u],next.done=!1,next;return next.value=void 0,next.done=!0,next};return m.next=m}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(E,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,S,"GeneratorFunction"),u.isGeneratorFunction=function(t){var a="function"==typeof t&&t.constructor;return!!a&&(a===GeneratorFunction||"GeneratorFunction"===(a.displayName||a.name))},u.mark=function(t){return It?It(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,S,"GeneratorFunction")),t.prototype=vt(E),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,a,m,h,g){void 0===g&&(g=$i);var M=new AsyncIterator(wrap(t,a,m,h),g);return u.isGeneratorFunction(a)?M:M.next().then((function(t){return t.done?t.value:M.next()}))},defineIteratorMethods(E),define(E,S,"Generator"),define(E,M,(function(){return this})),define(E,"toString",(function(){return"[object Generator]"})),u.keys=function(t){var a=[];for(var u in t)a.push(u);return reverse$1(a).call(a),function next(){for(;a.length;){var u=a.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 a;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(a=this.tryEntries).call(a,resetTryEntry),!t)for(var u in this)"t"===u.charAt(0)&&h.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 a=this;function handle(u,m){return g.type="throw",g.arg=t,a.next=u,m&&(a.method="next",a.arg=void 0),!!m}for(var u=this.tryEntries.length-1;u>=0;--u){var m=this.tryEntries[u],g=m.completion;if("root"===m.tryLoc)return handle("end");if(m.tryLoc<=this.prev){var M=h.call(m,"catchLoc"),I=h.call(m,"finallyLoc");if(M&&I){if(this.prev<m.catchLoc)return handle(m.catchLoc,!0);if(this.prev<m.finallyLoc)return handle(m.finallyLoc)}else if(M){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,a){for(var u=this.tryEntries.length-1;u>=0;--u){var m=this.tryEntries[u];if(m.tryLoc<=this.prev&&h.call(m,"finallyLoc")&&this.prev<m.finallyLoc){var g=m;break}}g&&("break"===t||"continue"===t)&&g.tryLoc<=a&&a<=g.finallyLoc&&(g=null);var M=g?g.completion:{};return M.type=t,M.arg=a,g?(this.method="next",this.next=g.finallyLoc,T):this.complete(M)},complete:function complete(t,a){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&&a&&(this.next=a),T},finish:function finish(t){for(var a=this.tryEntries.length-1;a>=0;--a){var u=this.tryEntries[a];if(u.finallyLoc===t)return this.complete(u.completion,u.afterLoc),resetTryEntry(u),T}},catch:function _catch(t){for(var a=this.tryEntries.length-1;a>=0;--a){var u=this.tryEntries[a];if(u.tryLoc===t){var m=u.completion;if("throw"===m.type){var h=m.arg;resetTryEntry(u)}return h}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,a,u){return this.delegate={iterator:values(t),resultName:a,nextLoc:u},"next"===this.method&&(this.arg=void 0),T}},u}t.exports=_regeneratorRuntime,t.exports.__esModule=!0,t.exports.default=t.exports})),cu=su(),lu=cu;try{regeneratorRuntime=cu}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=cu:Function("r","regeneratorRuntime = r")(cu)}function __rest(t,a){var u={};for(var m in t)Object.prototype.hasOwnProperty.call(t,m)&&a.indexOf(m)<0&&(u[m]=t[m]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(m=Object.getOwnPropertySymbols(t);h<m.length;h++)a.indexOf(m[h])<0&&Object.prototype.propertyIsEnumerable.call(t,m[h])&&(u[m[h]]=t[m[h]])}return u}function __awaiter(t,a,u,m){return new(u||(u=Promise))((function(h,g){function fulfilled(t){try{step(m.next(t))}catch(t){g(t)}}function rejected(t){try{step(m.throw(t))}catch(t){g(t)}}function step(t){t.done?h(t.value):function adopt(t){return t instanceof u?t:new u((function(a){a(t)}))}(t.value).then(fulfilled,rejected)}step((m=m.apply(t,a||[])).next())}))}function isPlainObject(t){return null!=t&&"object"==typeof t&&ts(t)==Object.prototype}function merge$1(t,a){var u=isPlainObject(t)||Un(t),m=isPlainObject(a)||Un(a);if(u&&m){for(var h in a){var g=merge$1(t[h],a[h]);void 0!==g&&(t[h]=g)}return t}return a}var uu={setLogger:function setLogger(t){throw new Error("setLogger not implemented.")},platform:"",WebSocket:function(){function AdapterSocket(t,a){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,a){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,a){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 $i.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 $i.resolve()},t.close=function close(){},t.addLogs=function addLogs(t){return $i.resolve()},t.extractLogs=function extractLogs(){return $i.resolve()},t.afterUpload=function afterUpload(){return $i.resolve()},AdapterLogStorageImpl}()};var du=["error","warn","log","debug"],pu=function emptyFunc(){},mu=["off","error","warn","log","debug"],hu=function(){function Logger(t,a){void 0===a&&(a={}),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=pu,this.log=pu,this.warn=pu,this.error=pu,this.iid=Math.round(1e3*Math.random()),this.debugLevel=includes(mu).call(mu,t)?t:"off",a.debugLevel&&(this.debugLevel=includes(mu).call(mu,a.debugLevel)?a.debugLevel:this.debugLevel),this.logStorage=!1===a.storageEnable?null:new uu.logStorage(null==a?void 0:a.storageName),this.setOptions(a),this.setLogFunc(this.debugLevel),this.setTimer(),uu.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(a){t.warn("Logger::open failed",a)}))},t.setOptions=function setOptions(t){if(t&&t.logFunc){var a=t.logFunc;for(var u in a){var m=u,h=a[m];h&&(this.strategies[m].func=h)}}},t.setLogFunc=function setLogFunc(t,a){var u=this;void 0===a&&(a="log");var m=findIndex$1(du).call(du,(function(a){return a===t})),h=findIndex$1(du).call(du,(function(t){return t===a}));forEach$1(du).call(du,(function(t,a){u[t]=function(){if(!(a>m&&a>h)){var u=slice(Array.prototype).call(arguments),g=this.strategies[t],M=this.formatArgs(u,g.name);a<=h&&this.logStorage&&this.prepareSaveLog(M,t),a<=m&&g.func(M)}}}))},t.extractLogs=function extractLogs(){var t;return this.logStorage?null===(t=this.logStorage)||void 0===t?void 0:t.extractLogs():$i.resolve("")},t.afterUpload=function afterUpload(){var t;return this.logStorage?null===(t=this.logStorage)||void 0===t?void 0:t.afterUpload():$i.resolve("")},t.prepareSaveLog=function prepareSaveLog(t,a){this.storageArr.push({text:t,level:a,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,lu.mark((function _callee(){var t;return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(this.logStorage){a.next=2;break}return a.abrupt("return");case 2:return t=this.storageArr,this.storageArr=[],a.prev=4,a.next=7,this.logStorage.addLogs(t);case 7:a.next=11;break;case 9:a.prev=9,a.t0=a.catch(4);case 11:case"end":return a.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=po(bind$1(t=this.triggerTimer).call(t,this),5e3)},t.triggerTimer=function triggerTimer(){this.clearTimer(),this.saveLogs()},t.formatArgs=function formatArgs(t,a){var u=new Date;return"[NIM "+this.iid+" "+a+" "+(u.getMonth()+1+"-"+u.getDate()+" "+u.getHours()+":"+u.getMinutes()+":"+u.getSeconds()+":"+u.getMilliseconds())+"] "+map$6(t).call(t,(function(t){return t instanceof Wl?t.toString():t instanceof Error?t&&t.message?t.message:t:"object"==typeof t?Vn(t):t})).join(" ")},t.destroy=function destroy(){this.debug=pu,this.log=pu,this.warn=pu,this.error=pu,this.saveLogs(),this.clearTimer(),this.storageArr=[],this.logStorage&&this.logStorage.close()},Logger}(),gu=Math.min,vu=[].lastIndexOf,fu=!!vu&&1/[1].lastIndexOf(1,-0)<0,yu=arrayMethodIsStrict("lastIndexOf"),Mu=fu||!yu?function lastIndexOf(t){if(fu)return T(vu,this,arguments)||0;var a=toIndexedObject(this),u=lengthOfArrayLike(a),m=u-1;for(arguments.length>1&&(m=gu(m,toIntegerOrInfinity(arguments[1]))),m<0&&(m=u+m);m>=0;m--)if(m in a&&a[m]===t)return m||0;return-1}:vu;_export({target:"Array",proto:!0,forced:Mu!==[].lastIndexOf},{lastIndexOf:Mu});var Iu,_u=entryVirtual("Array").lastIndexOf,Su=Array.prototype,lastIndexOf=function(t){var a=t.lastIndexOf;return t===Su||$(Su,t)&&a===Su.lastIndexOf?_u:a},Tu="\t\n\v\f\r \u2028\u2029\ufeff",Cu=R("".replace),bu="["+Tu+"]",Eu=RegExp("^"+bu+bu+"*"),ku=RegExp(bu+bu+"*$"),createMethod=function(t){return function(a){var u=toString(requireObjectCoercible(a));return 1&t&&(u=Cu(u,Eu,"")),2&t&&(u=Cu(u,ku,"")),u}},Ru={start:createMethod(1),end:createMethod(2),trim:createMethod(3)},Au=sr.PROPER,wu=Ru.trim;_export({target:"String",proto:!0,forced:(Iu="trim",fails((function(){return!!Tu[Iu]()||"
"!=="
"[Iu]()||Au&&Tu[Iu].name!==Iu})))},{trim:function trim(){return wu(this)}});var Nu=entryVirtual("String").trim,xu=String.prototype,trim$2=function(t){var a=t.trim;return"string"==typeof t||t===xu||$(xu,t)&&a===xu.trim?Nu:a};var Ou=Ru.trim,Pu=h.parseInt,Lu=h.Symbol,Vu=Lu&&Lu.iterator,Uu=/^[+-]?0x/i,Du=R(Uu.exec),qu=8!==Pu(Tu+"08")||22!==Pu(Tu+"0x16")||Vu&&!fails((function(){Pu(Object(Vu))}))?function parseInt(t,a){var u=Ou(toString(t));return Pu(u,a>>>0||(Du(Uu,u)?16:10))}:Pu;_export({global:!0,forced:parseInt!=qu},{parseInt:qu});var Bu=j.parseInt;function get(t,a){if("object"!=typeof t||null===t)return t;for(var u=(a=a||"").split("."),m=0;m<u.length;m++){var h=u[m],g=t[h],M=indexOf(h).call(h,"["),I=indexOf(h).call(h,"]");if(-1!==M&&-1!==I&&M<I){var S=slice(h).call(h,0,M),T=Bu(slice(h).call(h,M+1,I));g=t[S],g=Un(g)?g[T]:void 0}if(null==g)return g;t=g}return t}var Fu,Gu=(Fu=function _s4(){return(65536*(1+Math.random())|0).toString(16).substring(1)},function(){return Fu()+Fu()+Fu()+Fu()+Fu()+Fu()+Fu()+Fu()});function getEnumKeys(t){var a;return filter(a=Gt(t)).call(a,(function(t){return!(+t>=0)}))}function getEnumKeyByEnumValue(t,a){var u,m=filter(u=Gt(t)).call(u,(function(u){return t[u]==a}));return m.length>0?m[0]:void 0}function getAccountFromSessionId(t,a){if(void 0===a&&(a="-"),!t)throw new Xl("No sessionId",{},400);var u=indexOf(t).call(t,a);if(-1===u)throw new Xl("Can not find conjunctions",{},400);var m=slice(t).call(t,0,u);return{accid:slice(t).call(t,u+1),scene:"super_team"===m?"superTeam":m}}function pendingIsMiniappEnv(){var t=uu.getSystemInfo().hostEnvEnum;return 6===t||102===t||103===t||104===t}function assignOptions(t,a){return function assignWith(t,a,u,m){for(var h in t=t||{},u=u||{},m=m||function(){},a=a||{}){var g=m(t[h],a[h]);t[h]=void 0===g?a[h]:g}for(var M in u){var I=m(t[M],u[M]);t[M]=void 0===I?u[M]:I}return t}({},t,a,(function(t,a){return void 0===a?t:a}))}function emptyFuncWithPromise(){return $i.resolve()}function emptyFunc(){}function getFileExtension(t){var a=lastIndexOf(t).call(t,"."),u=a>-1?slice(t).call(t,a+1):"";return/^\d+$/.test(trim$2(u).call(u))&&(u=""),u}function findIndexWithinTargetValue(t,a,u){return 0===t.length||t[0][a]<=u?0:t[t.length-1][a]>u?t.length:findIndex$1(t).call(t,(function(m,h){if(t[h-1]&&t[h-1][a]>u&&u>=m[a])return!0}))}function fillIdServer(t,a,u,m){var h="number"==typeof get(t,"raw.r[0]")?""+t.raw.r[0]:void 0;return a[u]=a[u]||h||m,a}var Hu=function(){function CoreAdapters(t){this.lastSuccUploadHost="",this.core=t}var t=CoreAdapters.prototype;return t.getFileUploadInformation=function getFileUploadInformation(t){return uu.getFileUploadInformation(t)},t.request=function request(t,a,u){var m=this,h=(new Date).getTime(),g=(null==u?void 0:u.exception_service)||0;return uu.request(t,a).catch((function(u){var M,I,S,T,C=u;throw m.core.reporter.reportTraceStart("exceptions",{user_id:m.core.options.account||(null===(I=null===(M=m.core)||void 0===M?void 0:M.auth)||void 0===I?void 0:I.account),trace_id:null===(T=null===(S=m.core.clientSocket)||void 0===S?void 0:S.socket)||void 0===T?void 0:T.sessionId,start_time:h,action:1,exception_service:g}),m.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof C.code?C.code:0,description:C.message||""+C.code,operation_type:0,target:t,context:a?Vn(a):""},{asyncParams:uu.net.getNetworkStatus()}),m.core.reporter.reportTraceEnd("exceptions",1),u}))},t.uploadFile=function uploadFile(t){var a,u,m,h;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var g,M,I,S,T,C,b,E,k,R,A,w,N,x;return lu.wrap((function _callee$(O){for(;;)switch(O.prev=O.next){case 0:I="BROWSER"===uu.platform,S=I?t.chunkUploadHostBackupList:t.commonUploadHostBackupList,T=I?t.chunkUploadHost:t.commonUploadHost,C=indexOf(S).call(S,T),b=-1===C?concat(g=[T]).call(g,S):concat(M=[T]).call(M,slice(S).call(S,0,C),slice(S).call(S,C+1)),E=Math.max(indexOf(b).call(b,this.lastSuccUploadHost),0),k=null,R=0;case 8:if(!(R<b.length)){O.next=35;break}return A=(new Date).getTime(),w=b[(R+E)%b.length],O.prev=11,O.next=14,uu.uploadFile(Ut(Ut({},t),I?{chunkUploadHost:w}:{commonUploadHost:w}));case 14:return N=O.sent,this.lastSuccUploadHost=w,"string"==typeof N.size&&(N.size=Bu(N.size)),"string"==typeof N.dur&&(N.dur=Bu(N.dur)),"string"==typeof N.w&&(N.w=Bu(N.w)),"string"==typeof N.h&&(N.h=Bu(N.h)),O.abrupt("return",N);case 23:O.prev=23,O.t0=O.catch(11),this.core.cloudStorage.nos.nosErrorCount--,k=O.t0,x=O.t0,this.core.reporter.reportTraceStart("exceptions",{user_id:this.core.options.account||(null===(u=null===(a=this.core)||void 0===a?void 0:a.auth)||void 0===u?void 0:u.account),trace_id:null===(h=null===(m=this.core.clientSocket)||void 0===m?void 0:m.socket)||void 0===h?void 0:h.sessionId,start_time:A,action:1,exception_service:3}),this.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof x.code?x.code:0,description:x.message||""+x.code,operation_type:1,target:w},{asyncParams:uu.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("exceptions",1),this._uploadFileErrHanler(O.t0);case 32:R++,O.next=8;break;case 35:throw k;case 36:case"end":return O.stop()}}),_callee,this,[[11,23]])})))},t._uploadFileErrHanler=function _uploadFileErrHanler(t){if(t&&(t.code>200||t.errCode>200))throw t},CoreAdapters}(),ju="weblink.netease.im:443",$u=["https://lbs.netease.im/lbs/webconf.jsp"],zu="https://abt-online.netease.im/v1/api/abt/client/getExperimentInfo",Wu="imElite_sdk_abtest_web",Ku=function(){function ABTest(t,a){this.abtInfo={},this.core=t,this.config=assignOptions({isAbtestEnable:!0,abtestUrl:zu,abtestProjectKey:Wu},a)}var t=ABTest.prototype;return t.setOptions=function setOptions(t){this.config=assignOptions(this.config,t)},t.abtRequest=function abtRequest(){var t,a;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:if(this.config.isAbtestEnable){m.next=2;break}return m.abrupt("return");case 2:if(!this.abtInfo.experiments){m.next=4;break}return m.abrupt("return");case 4:if(this.config.abtestUrl){m.next=6;break}return m.abrupt("return");case 6:return m.prev=6,m.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.41",deviceId:this.core.config.deviceId},useLocalCache:!0}},{exception_service:7});case 9:u=m.sent,m.next=15;break;case 12:m.prev=12,m.t0=m.catch(6),this.core.logger.warn("ABTest request failed");case 15:this.abtInfo=(null===(a=null===(t=null==u?void 0:u.data)||void 0===t?void 0:t.data)||void 0===a?void 0:a.abtInfo)||{};case 16:case"end":return m.stop()}}),_callee,this,[[6,12]])})))},ABTest}();function getPromiseWithAbort(t){var a={},u=new $i((function(t,u){a.abort=u}));return a.promise=$i.race([t,u]),a}$i.reject;var Yu=function(){function PromiseManager(){this.abortFns=[]}var t=PromiseManager.prototype;return t.add=function add(t){var a=getPromiseWithAbort(t);return this.abortFns.push(a.abort),a.promise},t.clear=function clear(t){var a;forEach$1(a=this.abortFns).call(a,(function(a){return a(t||new Wl({code:jl.V2NIM_ERROR_CODE_CANCELLED,detail:{reason:"Aborted"}}))})),this.abortFns=[]},t.destroy=function destroy(){this.clear()},PromiseManager}(),Qu={tolerantRTT:3e3,bestRTT:100,maxChances:5,enable:!0},Ju={timestamp:0,rtt:0,baseClock:0,baseTime:0},Xu=function(){function TimeOrigin(t,a,u){void 0===u&&(u="getServerTime"),this.serverOrigin=Ju,this.config=Qu,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 Yu,this.cmdName=u,a&&this.setOptions(a)}var t=TimeOrigin.prototype;return t.setOptions=function setOptions(t){this.config=Ut({},Qu,this.config,t)},t.reset=function reset(){this.timer&&clearTimeout(this.timer),this.promiseManager.clear(),this.serverOrigin=Ju,this.currentChance=0},t.setOriginTimetick=function setOriginTimetick(){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var t,a,u,m,h,g,M,I,S,T;return lu.wrap((function _callee$(C){for(;;)switch(C.prev=C.next){case 0:if(this.config.enable){C.next=2;break}return C.abrupt("return");case 2:if(!this.isSettingNTP){C.next=4;break}return C.abrupt("return");case 4:if(!(this.currentChance>=this.config.maxChances)){C.next=6;break}return C.abrupt("return");case 6:if(t=get(this.core,"auth.status"),a=get(this.core,"status"),u=get(this.core,"V2NIMLoginService.lifeCycle.loginStatus"),"logined"===t||"logined"===a||1===u){C.next=11;break}return C.abrupt("return");case 11:return this.isSettingNTP=!0,this.currentChance++,this.timer&&clearTimeout(this.timer),this.timer=0,m="TimeOrigin::setOriginTimetick:",h=eo(),this.core.logger.debug(m+" getServerTime start, times "+this.currentChance),C.prev=18,C.next=21,this.promiseManager.add(this.core.sendCmd(this.cmdName));case 21:M=C.sent,g=get(M,"content.time"),this.isSettingNTP=!1,C.next=33;break;case 26:return C.prev=26,C.t0=C.catch(18),I=C.t0,this.isSettingNTP=!1,this.logger.warn(m+" Calculate Delay time, getServerTime error",I),I.code!==jl.V2NIM_ERROR_CODE_CANCELLED&&(clearTimeout(this.timer),this.timer=po(bind$1(S=this.setOriginTimetick).call(S,this),this.failedDelay)),C.abrupt("return");case 33:if(g){C.next=37;break}return this.core.logger.warn(m+" Calculate Delay time incorrect format"),this.config.enable=!1,C.abrupt("return");case 37:T=eo()-h,this.doSet(g,T);case 39:case"end":return C.stop()}}),_callee,this,[[18,26]])})))},t.doSet=function doSet(t,a){var u,m="TimeOrigin::setOriginTimetick:";if(a>this.config.tolerantRTT)this.logger.warn(m+" denied RTT:"+a),clearTimeout(this.timer),this.timer=po(bind$1(u=this.setOriginTimetick).call(u,this),this.failedDelay);else if(a>this.config.bestRTT){var h;this.serverOrigin.rtt&&a>=this.serverOrigin.rtt?this.logger.warn(m+" ignore RTT:"+a):(this.setServerOrigin(a,t),this.logger.log(m+" accept reluctantly RTT:"+a)),clearTimeout(this.timer),this.timer=po(bind$1(h=this.setOriginTimetick).call(h,this),this.failedDelay)}else{var g;this.setServerOrigin(a,t),this.logger.debug(m+" accept best RTT:"+a),this.currentChance=0,clearTimeout(this.timer),this.timer=po(bind$1(g=this.setOriginTimetick).call(g,this),this.successDelay)}},t.getNTPTime=function getNTPTime(t){if(void 0===t&&(t=this.getTimeNode()),this.checkNodeReliable(t)){var a=Math.floor(t.time-this.serverOrigin.baseTime);return this.serverOrigin.timestamp+a}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 a=t.clock-this.serverOrigin.baseClock,u=t.time-this.serverOrigin.baseTime;return Math.abs(u-a)<500}return!1},t.checkPerformance=function checkPerformance(){return"BROWSER"===uu.platform&&!("undefined"==typeof performance||!performance.now)},TimeOrigin.checkPerformance=function checkPerformance(){return"BROWSER"===uu.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,a){this.serverOrigin={timestamp:a+Math.floor(t/2),rtt:t,baseClock:this.checkPerformance()?performance.now():0,baseTime:eo()}},TimeOrigin}(),Zu={user_id:"",trace_id:"",action:7,exception_service:6,duration:0,start_time:0,state:1,extension:[]},ed=function(){function ReporterHookLinkKeep(t,a){this.traceData=Zu,this.core=t,this.traceData=Ut({},Zu,a),this.traceData.extension=[]}var t=ReporterHookLinkKeep.prototype;return t.reset=function reset(){this.traceData=Ut({},Zu),this.traceData.extension=[]},t.start=function start(){var t,a;this.reset(),this.traceData.user_id=this.core.account,this.traceData.trace_id=(null===(a=null===(t=this.core.clientSocket)||void 0===t?void 0:t.socket)||void 0===a?void 0:a.sessionId)||"",this.traceData.start_time=(new Date).getTime()},t.update=function update(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u,m;return lu.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,uu.net.getNetworkStatus();case 2:a=h.sent,u=a.net_type,m=a.net_connect,this.traceData.extension.push(Ut({code:0,foreground:!0,foreg_backg_switch:!1,net_type:u,net_connect:m},t));case 6:case"end":return h.stop()}}),_callee,this)})))},t.end=function end(t){var a=this.traceData.extension[0],u=this.traceData.extension[1];if(a&&0===a.operation_type&&u&&1===u.operation_type){var m=a.net_type!==u.net_type||a.net_connect!==u.net_connect;if(t||!m)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}(),td={user_id:"",trace_id:"",net_connect:!0,net_type:0,duration:0,start_time:0,history:[],succeed:!1},rd=function(){function ReporterHookLBS(t){this.traceData=td,this.core=t,this.reset()}var t=ReporterHookLBS.prototype;return t.reset=function reset(){this.traceData=Ut({},td),this.traceData.history=[]},t.start=function start(t){this.reset(),this.traceData.user_id=t,this.traceData.start_time=eo()},t.updateBegin=function updateBegin(t){this.traceData.history.push(Ut({head:"",body:"",start_time:eo(),httpdns:!1,index:0},t))},t.updateComplete=function updateComplete(t){var a;forEach$1(a=this.traceData.history).call(a,(function(a){a.target===t.target&&(Ut(a,t),a.duration=eo()-a.start_time)}))},t.end=function end(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u,m,h;return lu.wrap((function _callee$(g){for(;;)switch(g.prev=g.next){case 0:if(this.traceData.succeed=t,this.traceData.history=filter(a=this.traceData.history).call(a,(function(t){return void 0!==t.code})),0!==this.traceData.history.length){g.next=5;break}return this.reset(),g.abrupt("return");case 5:return this.traceData.duration=eo()-this.traceData.start_time,g.next=8,uu.net.getNetworkStatus();case 8:u=g.sent,m=u.net_type,h=u.net_connect,this.traceData.net_type=m,this.traceData.net_connect=h,this.core.reporter.report("nim_sdk_lbs_records",this.traceData),this.reset();case 15:case"end":return g.stop()}}),_callee,this)})))},ReporterHookLBS}();function getIsDataReportEnable(t){var a,u,m=!0;return"boolean"==typeof(null===(a=null==t?void 0:t.reporterConfig)||void 0===a?void 0:a.enableCompass)?m=t.reporterConfig.enableCompass:"boolean"==typeof(null===(u=null==t?void 0:t.reporterConfig)||void 0===u?void 0:u.isDataReportEnable)&&(m=t.reporterConfig.isDataReportEnable),m}var nd={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:""},ad="ReporterHook::setMonitorForResources:",id=function(){function ReporterHookCloudStorage(t,a){this.traceData=nd,this.core=t,this.traceData=Ut({},nd,a)}var t=ReporterHookCloudStorage.prototype;return t.reset=function reset(){this.traceData=Ut({},nd)},t.start=function start(){var t,a;this.reset(),this.traceData.user_id=this.core.account,this.traceData.trace_id=(null===(a=null===(t=this.core.clientSocket)||void 0===t?void 0:t.socket)||void 0===a?void 0:a.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,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(this.traceData.user_id){a.next=2;break}return a.abrupt("return");case 2:this.core.logger.log(ad+" upload update",t),Ut(this.traceData,t);case 4:case"end":return a.stop()}}),_callee,this)})))},t.end=function end(t){this.traceData.user_id&&(this.core.logger.log(ad+" 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,this.core.reporter.report("nim_sdk_resources",this.traceData),this.traceData=nd)},ReporterHookCloudStorage}(),od={},sd={},cd={},ld={apiVersion:"v1",debugLevel:"off",needReconnect:!0,reconnectionAttempts:Nt,lbsUrls:$u,linkUrl:ju,abtestUrl:zu,isAbtestEnable:!0},ud=function(t){function NIM(a,u){var m,h,g;if(void 0===u&&(u={}),(g=t.call(this)||this).instanceName="NIM",g.pluginMap={},g.eventBus=new mo,g.options={},g.V2NIMConversationIdUtil={},g.V2NIMMessageCreator={},g.V2NIMMessageAttachmentCreator={},g.V2NIMClientAntispamUtil={},g.DataStructureConverter={},g.V2NIMMessageConverter={},g.V2NIMMessageLogUtil={},g.V2NIMMessageExtendUtil={},g.V2NIMStorageUtil={},g.V2NIMNotificationService={},g.V2NIMStorageService={},g.auth={},g.V1NIMLoginService={},g.V2NIMLoginService={},g.clientSocket={},g.V2NIMSyncService={},g.V2NIMLocalConversationService={},g.V2NIMConversationService={},g.V2NIMConversationGroupService={},g.V2NIMMessageService={},g.V2NIMTeamService={},g.V2NIMUserService={},g.V2NIMFriendService={},g.V2NIMSettingService={},g.V2NIMAIService={},g.V2NIMSignallingService={},g.V2NIMSubscriptionService={},g.V2NIMPassthroughService={},g.YSFService={},g.offlinePush={},g.sync={},g.msg={},g.msgLog={},g.session={},g.cloudSession={},g.misc={},g.user={},g.friend={},g.systemMessage={},g.team={},g.event={},g.msgExtend={},g.cloudStorage={},g.passThrough={},g.superTeam={},g.plugin={},g.signaling={},g.qchatChannel={},g.qchatMedia={},g.qchatMsg={},g.qchatRole={},g.qchatServer={},g.pluginMap=cd,g.logger=new hu(a.debugLevel,u.loggerConfig),u.privateConf){var M=g.getConfigFromPrivate(u.privateConf),I=M.authConfig,S=M.cloudStorageConfig,T=M.reporterConfig;Ut(a,I),g.setInitOptions(a),g.otherOptions=Ut(Ut({},u),{cloudStorageConfig:Ut(Ut({storageKeyPrefix:"NIM"},u.cloudStorageConfig),S),reporterConfig:Ut(Ut({},u.reporterConfig),T),V1NIMLoginServiceConfig:Ut(Ut(Ut({},a),u.V1NIMLoginServiceConfig),I),V2NIMLoginServiceConfig:Ut(Ut({},u.V2NIMLoginServiceConfig),I)})}else g.setInitOptions(a),g.otherOptions=Ut(Ut({},u),{V1NIMLoginServiceConfig:Ut(Ut({},a),u.V1NIMLoginServiceConfig),cloudStorageConfig:Ut({storageKeyPrefix:"NIM"},u.cloudStorageConfig)});g.timerManager=new iu,g.timeOrigin=new Xu(Qe(g)),g.adapters=new Hu(Qe(g)),g.abtest=new Ku(Qe(g),Ut(Ut({isAbtestEnable:g.options.isAbtestEnable,abtestUrl:g.options.abtestUrl},g.otherOptions.abtestConfig),{abtestProjectKey:Wu}));var C=uu.getSystemInfo(),b=function getCompassDataEndpoint(t,a){var u,m,h=null===(u=null==a?void 0:a.reporterConfig)||void 0===u?void 0:u.compassDataEndpoint,g=null===(m=null==a?void 0:a.reporterConfig)||void 0===m?void 0:m.reportConfigUrl;if(h)return h;if(g){var M=g.match(/^https:\/\/([^/]+)\/*/);if(Un(M)&&M.length>=1)return"https://"+M[1];t.error("Invalid reportConfigUrl: "+g)}return pendingIsMiniappEnv()?"https://statistic.live.126.net":"https://statistic.live.126.net,https://statistic-overseas.yunxinfw.com"}(g.logger,g.otherOptions);g.reporter=new Vs(Ut(Ut({},b?{compassDataEndpoint:b}:{}),{isDataReportEnable:getIsDataReportEnable(g.otherOptions),common:{app_key:a.appkey,dev_id:"",platform:"Web",sdk_ver:"10.9.41",env:"online",os_name:C.os,os_ver:C.osVer,lib_env:C.libEnv,host_env:C.hostEnv,host_env_ver:C.hostEnvVer,manufactor:C.manufactor,model:C.model,v2:"v1"!==g.options.apiVersion},request:uu.request,logger:g.logger,autoStart:!0})),g.reporterHookLinkKeep=new ed(Qe(g)),g.reporterHookCloudStorage=new id(Qe(g)),g.reporterHookLBS=new rd(Qe(g));var E=g.getServiceKeys(Gt(od));return forEach$1(E).call(E,(function(t){if(!g[t]||!g[t].name){var a=od[t];g[t]=new a(Qe(g))}})),forEach$1(m=Gt(od)).call(m,(function(t){g.callSetOptions(t)})),forEach$1(h=Gt(sd)).call(h,(function(t){var a=sd[t];void 0!==a&&(g[t]=new a(Qe(g)))})),NIM.instance=Qe(g),g.logger.log("NIM init, version:10.9.41, sdk version:100941, appkey:"+a.appkey),g}wt(NIM,t);var a=NIM.prototype;return a.getServiceKeys=function getServiceKeys(t){var a=findIndex$1(t).call(t,(function(t){return"V1NIMLoginService"===t}));if(a>-1){var u=t[a];splice(t).call(t,a,1),"v1"===this.options.apiVersion&&t.unshift(u)}var m=findIndex$1(t).call(t,(function(t){return"V2NIMLoginService"===t}));if(m>-1){var h=t[m];splice(t).call(t,m,1),"v2"===this.options.apiVersion&&t.unshift(h)}var g=findIndex$1(t).call(t,(function(t){return"sync"===t}));if(g>-1){var M=t[g];splice(t).call(t,g,1),"v1"===this.options.apiVersion&&t.push(M)}var I=findIndex$1(t).call(t,(function(t){return"V2NIMSyncService"===t}));if(I>-1){var S=t[I];splice(t).call(t,I,1),"v2"===this.options.apiVersion&&t.push(S)}return t},NIM.getInstance=function getInstance(t,a){if(!NIM.instance){if(t)return new NIM(t,a);throw new Error("Instance not exist, please input options")}if(t){if(NIM.instance.options.account===t.account&&NIM.instance.options.appkey===t.appkey)return NIM.instance.setOptions(t),NIM.instance;throw new Error("Unexpected login")}return NIM.instance},a.setInitOptions=function setInitOptions(t){validate({appkey:{type:"string"},apiVersion:{type:"enum",values:["v1","v2"],required:!1},binaryWebsocket:{type:"boolean",required:!1},needReconnect:{type:"boolean",required:!1},reconnectionAttempts:{type:"number",required:!1},customClientType:{type:"number",min:1,required:!1},authType:{type:"number",min:0,max:2,required:!1},lbsUrls:{type:"array",itemType:"string",min:1,required:!1},linkUrl:{type:"string",allowEmpty:!1,required:!1}},t),this.options=Ut(Ut({},ld),t)},a.getConfigFromPrivate=function getConfigFromPrivate(t){var a;return t?{authConfig:JSON.parse(Vn({appkey:t.appkey||void 0,lbsUrls:t.weblbsUrl?[t.weblbsUrl]:void 0,linkUrl:t.link_web||void 0,linkSSL:null!==(a=t.websdkSsl)&&void 0!==a?a:void 0})),cloudStorageConfig:JSON.parse(Vn({chunkUploadHost:t.nos_uploader||void 0,commonUploadHost:t.nos_uploader||void 0,commonUploadHostBackupList:t.nos_uploader?[t.nos_uploader]:void 0,chunkUploadHostBackupList:t.nos_uploader?[t.nos_uploader]:void 0,uploadReplaceFormat:t.nos_downloader_v2?(t.nosSsl?"https://":"http://")+t.nos_downloader_v2:void 0,downloadUrl:void 0!==t.nos_accelerate?t.nos_accelerate:void 0,downloadHostList:""===t.nos_accelerate_host?[]:"string"==typeof t.nos_accelerate_host?[t.nos_accelerate_host]:Un(t.nos_accelerate_host)?t.nos_accelerate_host:void 0})),reporterConfig:JSON.parse(Vn({enableCompass:"boolean"==typeof t.enableCompass?t.enableCompass:void 0,compassDataEndpoint:t.compassDataEndpoint||void 0}))}:{authConfig:{},cloudStorageConfig:{},reporterConfig:{}}},a.connect=function connect(t){return void 0===t&&(t={}),this.V1NIMLoginService.login(t)},a.setOptions=function setOptions(t){if("object"==typeof t&&null!==t){if(Object.prototype.hasOwnProperty.call(t,"account")&&t.account!==this.options.account||Object.prototype.hasOwnProperty.call(t,"appkey")&&t.appkey!==this.options.appkey)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"NIM::setOptions account and appkey is not allowed to reset"}});if(Object.prototype.hasOwnProperty.call(t,"apiVersion")&&t.apiVersion!==this.options.apiVersion)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"NIM::setOptions apiVersion is not allowed to reset"}});if(Object.prototype.hasOwnProperty.call(t,"binaryWebsocket")&&t.binaryWebsocket!==this.options.binaryWebsocket)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"NIM::setOptions binaryWebsocket is not allowed to reset"}});validate({token:{type:"string",required:!1},needReconnect:{type:"boolean",required:!1},reconnectionAttempts:{type:"number",required:!1},customClientType:{type:"number",min:1,required:!1},authType:{type:"number",min:0,max:2,required:!1},lbsUrls:{type:"array",itemType:"string",min:1,required:!1},linkUrl:{type:"string",allowEmpty:!1,required:!1}},t),this.logger.log("NIM::setOptions options is",t),this.options=Ut(Ut({},this.options),t),this.V1NIMLoginService.setOptions&&this.V1NIMLoginService.setOptions(this.options)}},a.getOptions=function getOptions(){return this.options},a.disconnect=function disconnect(){return this.V1NIMLoginService.logout()},a._disconnect=function _disconnect(){return"v1"===this.options.apiVersion?this.V1NIMLoginService.logout():"v2"===this.options.apiVersion?0===get(this.V2NIMLoginService,"lifeCycle.connectStatus")&&0===get(this.V2NIMLoginService,"lifeCycle.loginStatus")?$i.resolve():this.V2NIMLoginService.logout():$i.resolve()},a.destroy=function destroy(){var t=this;return NIM.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._clearModuleData("destroy"),t._removeAllModuleListeners(),t.connect=emptyFuncWithPromise,t.disconnect=emptyFuncWithPromise,t._disconnect=emptyFuncWithPromise,t.destroy=emptyFuncWithPromise}))},a._clearModuleData=function _clearModuleData(t){void 0===t&&(t="logout");var a=Ji(this);forEach$1(a).call(a,(function(a){a&&"function"==typeof a.reset&&a.reset(t)}))},a._removeAllModuleListeners=function _removeAllModuleListeners(){var t=Ji(this);forEach$1(t).call(t,(function(t){t&&"function"==typeof t.removeAllListeners&&t.removeAllListeners()}))},a.kick=function kick(t){return this.V1NIMLoginService.kick(t)},a.sendCmd=function sendCmd(t,a,u){return this.clientSocket.sendCmd(t,a,u)},a.emit=function emit(a){var u=this;try{for(var m,h,g=eo(),M=arguments.length,I=new Array(M>1?M-1:0),S=1;S<M;S++)I[S-1]=arguments[S];var T=(m=t.prototype.emit).call.apply(m,concat(h=[this,a]).call(h,I)),C=eo()-g;return C>=10&&this.logger.warn("Core::emit event: "+a+" process takes: "+C+"ms"),T}catch(t){return this.logger.error("Core::emit event: "+a+". Error: "+t),po((function(){throw u.logger.error("Core::emit throw error in setTimeout. event: "+a+". Error: "+t),t}),0),!1}},a._registerDep=function _registerDep(t,a){this[a]&&this[a].name||(this[a]=new t(this),this.callSetOptions(a))},a.callSetOptions=function callSetOptions(t){var a=t+"Config",u=t+"Options",m=this.otherOptions[a]||this.otherOptions[u]||{},h=get(this,t+".setOptions");"function"==typeof h&&("cloudStorage"===t&&(m=this.otherOptions[a]||this.otherOptions.serverConfig||{}),h.call(this[t],m))},NIM.registerService=function registerService(t,a){od[a]=t},NIM.registerPrivateService=function registerPrivateService(t,a){sd[a]=t},NIM.registerPlugin=function registerPlugin(t,a){cd[a]=t},Ye(NIM,[{key:"account",get:function get(){return this.auth.account}},{key:"status",get:function get(){return this.V1NIMLoginService.status},set:function set(t){this.V1NIMLoginService.status=t}},{key:"config",get:function get(){return{timeout:8e3,deviceId:this.auth.deviceId}}}]),NIM}(mo);ud.sdkVersion=100941,ud.sdkVersionFormat="10.9.41";var dd=createCommonjsModule((function(t,a){t.exports=function(){function object2String(t){if(t){var a,u="";return forEach$1(a=Gt(t)).call(a,(function(a,m){u+=0===m?"?":"&",u+=a+"="+t[a]})),u}return""}var t=function(t){function V2NIMError(a,u,m,h){var g;return(g=t.call(this,m)||this).source=a,g.code=u,g.desc=m,g.detail=h||{},g}return wt(V2NIMError,t),V2NIMError}(Pc(Error));function request(a,u){void 0===u&&(u={dataType:"json",method:"GET",timeout:5e3});var m="text"===u.dataType?"text/plain; charset=UTF-8":"application/json; charset=UTF-8",h="GET"===u.method?object2String(u.params):"";return new $i((function(g,M){if(window.XMLHttpRequest){var I,S=new XMLHttpRequest;if(S.onreadystatechange=function(){if(4===S.readyState)if(200===S.status){try{I=JSON.parse(S.response||"{}")}catch(t){I=S.response}g({status:S.status,data:I})}else po((function(){M(new t(1,S.status,"readyState: "+S.readyState+"; statusText: "+S.statusText))}),0)},S.open(u.method,""+a+h),S.timeout=u.timeout||5e3,S.setRequestHeader("Content-Type",m),u.headers)for(var T in u.headers)S.setRequestHeader(T,u.headers[T]);S.ontimeout=function(a){M(new t(1,408,a&&a.message?a.message:"request timeout"))},S.send(Vn(u.data))}else M(new t(2,10400,"request no suppout"))}))}return request}()})),pd=Math.floor,mergeSort=function(t,a){var u=t.length,m=pd(u/2);return u<8?insertionSort(t,a):merge(t,mergeSort(arraySliceSimple(t,0,m),a),mergeSort(arraySliceSimple(t,m),a),a)},insertionSort=function(t,a){for(var u,m,h=t.length,g=1;g<h;){for(m=g,u=t[g];m&&a(t[m-1],u)>0;)t[m]=t[--m];m!==g++&&(t[m]=u)}return t},merge=function(t,a,u,m){for(var h=a.length,g=u.length,M=0,I=0;M<h||I<g;)t[M+I]=M<h&&I<g?m(a[M],u[I])<=0?a[M++]:u[I++]:M<h?a[M++]:u[I++];return t},md=mergeSort,hd=z.match(/firefox\/(\d+)/i),gd=!!hd&&+hd[1],vd=/MSIE|Trident/.test(z),fd=z.match(/AppleWebKit\/(\d+)\./),yd=!!fd&&+fd[1],Md=[],Id=R(Md.sort),_d=R(Md.push),Sd=fails((function(){Md.sort(void 0)})),Td=fails((function(){Md.sort(null)})),Cd=arrayMethodIsStrict("sort"),bd=!fails((function(){if(J)return J<70;if(!(gd&&gd>3)){if(vd)return!0;if(yd)return yd<603;var t,a,u,m,h="";for(t=65;t<76;t++){switch(a=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(m=0;m<47;m++)Md.push({k:a+m,v:u})}for(Md.sort((function(t,a){return a.v-t.v})),m=0;m<Md.length;m++)a=Md[m].k.charAt(0),h.charAt(h.length-1)!==a&&(h+=a);return"DGBEFHACIJK"!==h}}));_export({target:"Array",proto:!0,forced:Sd||!Td||!Cd||!bd},{sort:function sort(t){void 0!==t&&aCallable(t);var a=toObject(this);if(bd)return void 0===t?Id(a):Id(a,t);var u,m,h=[],g=lengthOfArrayLike(a);for(m=0;m<g;m++)m in a&&_d(h,a[m]);for(md(h,function(t){return function(a,u){return void 0===u?-1:void 0===a?1:void 0!==t?+t(a,u)||0:toString(a)>toString(u)?1:-1}}(t)),u=lengthOfArrayLike(h),m=0;m<u;)a[m]=h[m++];for(;m<g;)deletePropertyOrThrow(a,m++);return a}});var Ed=entryVirtual("Array").sort,kd=Array.prototype,sort=function(t){var a=t.sort;return t===kd||$(kd,t)&&a===kd.sort?Ed:a},Rd=createCommonjsModule((function(t,a){self,t.exports=function(){var t={d:function d(a,u){for(var m in u)t.o(u,m)&&!t.o(a,m)&&Ke(a,m,{enumerable:!0,get:u[m]})},o:function o(t,a){return Object.prototype.hasOwnProperty.call(t,a)}},a={};t.d(a,{default:function _default(){return b}});var u=function e(t){for(var a in function(t,a){if(!(t instanceof a))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=5e4,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){},t)this[a]=t[a]};function n(t,a){var u=void 0!==Zo&&au(t)||t["@@iterator"];if(!u){if(Un(t)||(u=function(t,a){if(t){var u;if("string"==typeof t)return r(t,a);var m=slice(u=Object.prototype.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?r(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){u&&(t=u);var m=0,h=function i(){};return{s:h,n:function n(){return m>=t.length?{done:!0}:{done:!1,value:t[m++]}},e:function e(t){throw t},f:h}}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 g,M=!0,I=!1;return{s:function s(){u=u.call(t)},n:function n(){var t=u.next();return M=t.done,t},e:function e(t){I=!0,g=t},f:function f(){try{M||null==u.return||u.return()}finally{if(I)throw g}}}}function r(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=new Array(a);u<a;u++)m[u]=t[u];return m}var m={privateObj:{},setItem:function setItem(t,a){m.privateObj[t]=a},getItem:function getItem(t){return m.privateObj[t]},removeItem:function removeItem(t){delete m.privateObj[t]},getKeys:function getKeys(){return Gt(m.privateObj)}},h={getFileKey:function getFileKey(t){var a=t.size.toString(),u=t.lastModified.toString();return"_NosUploader_"+t.name+slice(a).call(a,a.length-5)+slice(u).call(u,u.length-5)},getFileInfo:function getFileInfo(t){var a=m.getItem(t);if(!a)return null;try{return JSON.parse(a)}catch(t){return null}},initFile:function initFile(t,a,u){h.clearExpiredInfo();var g=this.getFileKey(a),M={ctx:void 0!==t.ctx?t.ctx:"",bucket:t.bucketName,obj:t.objectName,token:t.token,modifyAt:eo(),end:!1};return t.payload&&(M.payload=t.payload),u&&m.setItem(g,Vn(M)),g},setUploadContext:function setUploadContext(t,a,u){var h=this.getFileInfo(t);h&&(h.ctx=a,u&&m.setItem(t,Vn(h)))},setComplete:function setComplete(t,a){var u=this.getFileInfo(t);u&&(u.modifyAt=eo(),u.end=!0,a&&m.setItem(t,Vn(u)))},getUploadContext:function getUploadContext(t){var a=this.getFileInfo(t);return a?a.ctx:""},removeFileInfo:function removeFileInfo(t){0===indexOf(t).call(t,"_NosUploader_")&&m.removeItem(t)},clearExpiredInfo:function clearExpiredInfo(){var t,a="function"==typeof m.getKeys?m.getKeys():Gt(m),u=eo(),g=[],M=n(a);try{for(M.s();!(t=M.n()).done;){var I=t.value;if(0===indexOf(I).call(I,"_NosUploader_")){var S=h.getFileInfo(I);null===S||u-S.modifyAt>b.expireTime?m.removeItem(I):g.push({fileInfo:S,key:I})}}}catch(t){M.e(t)}finally{M.f()}if(g.length>b.maxFileCache){var T,C,E=n(slice(T=sort(g).call(g,(function(t,a){return a.fileInfo.modifyAt-t.fileInfo.modifyAt}))).call(T,b.maxFileCache));try{for(E.s();!(C=E.n()).done;){var k,R=C.value;0===indexOf(k=R.key).call(k,"_NosUploader_")&&m.removeItem(R.key)}}catch(t){E.e(t)}finally{E.f()}}}},g=h;function c(t){return(c="function"==typeof Zo&&"symbol"==typeof ps?function(t){return typeof t}:function(t){return t&&"function"==typeof Zo&&t.constructor===Zo&&t!==Zo.prototype?"symbol":typeof t})(t)}function s(t,a){return!a||"object"!==c(a)&&"function"!=typeof a?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):a}function f(t){var a="function"==typeof _c?new _c:void 0;return(f=function f(t){var u,m;if(null===t||(m=t,-1===indexOf(u=Function.toString.call(m)).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!==a){if(a.has(t))return a.get(t);a.set(t,n)}function n(){return l(t,arguments,y(this).constructor)}return n.prototype=vt(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function l(t,a,u){return(l=p()?wc:function(t,a,u){var m=[null];m.push.apply(m,a);var h=new(bind$1(Function).apply(t,m));return u&&d(h,u.prototype),h}).apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!wc)return!1;if(wc.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(wc(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,a){return(d=It||function(t,a){return t.__proto__=a,t})(t,a)}function y(t){return(y=It?ts:function(t){return t.__proto__||ts(t)})(t)}var M=function(t){!function(t,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");t.prototype=vt(a&&a.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),a&&d(t,a)}(r,t);var a,u,m=(a=r,u=p(),function(){var t,m=y(a);if(u){var h=y(this).constructor;t=wc(m,arguments,h)}else t=m.apply(this,arguments);return s(this,t)});function r(t,a){var u;return function(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}(this,r),(u=m.call(this,"NosUploadError:"+t)).errCode=a,u.errMsg=t,u}return r}(f(Error)),I=function e(t,a,u){if("uploading"===t.uploadState){var m=t.config,h=t.param,I=g.getUploadContext(t.fileKey);if(!I)return u(0);var S=new XMLHttpRequest,T=m.directUploadAddr+"/".concat(h.bucketName)+"/".concat(encodeURIComponent(h.objectName))+"?uploadContext"+"&context=".concat(I)+"&version=".concat(m.version);S.onreadystatechange=function(){var h;if("abort"!==t.uploadState&&4===S.readyState){var I,C,b,E;try{E=JSON.parse(S.responseText)}catch(t){E={errMsg:"JsonParseError in getOffset. xhr.status = "+S.status+". xhr.responseText: "+S.responseText,errCode:500}}200===S.status?E.errCode?t.config.onError(new M(E.errMsg,E.errCode)):u(E.offset):S.status.toString().match(/^5/)?e(t,a-1,u):a>0?("function"==typeof(null===(h=m.logger)||void 0===h?void 0:h.error)&&m.logger.error(concat(I="getOffset(".concat(T,") error. retry after 3 seconds. ")).call(I,(new Date).toTimeString())),po((function(){e(t,a-1,u)}),3500)):S.status?(g.removeFileInfo(t.fileKey),m.onError(new M(concat(C=concat(b="getOffset(".concat(T,") error: ")).call(b,S.status," ")).call(C,S.statusText)))):m.onError(new M("getOffset(".concat(T,") error. no Error Code")))}},S.open("get",T),S.setRequestHeader("x-nos-token",h.token),S.timeout=m.getOffsetTimeout,S.send()}},S=function e(t,a,u,m){if("uploading"===t.uploadState){var h=t.param,I=t.config,S=slice(File.prototype),T=void 0!==h.ctx?h.ctx:"",C=a+I.trunkSize>=t.file.size,b=C?t.file.size:a+I.trunkSize,E=new XMLHttpRequest,k=I.directUploadAddr+"/".concat(h.bucketName)+"/".concat(encodeURIComponent(h.objectName));if(E.upload.onprogress=function(u){if("abort"!==t.uploadState){var m=0;u.lengthComputable?(m=(a+u.loaded)/t.file.size,I.onProgress(m),I.onUploadProgress({loaded:u.loaded,total:t.file.size,percentage:m,percentageText:(100*m).toFixed(2)+"%"})):I.onError(new M("browser does not support query upload progress"))}},E.onreadystatechange=function(){var h,S;if("abort"!==t.uploadState&&4===E.readyState){var T,b,R,A;try{A=JSON.parse(E.responseText)}catch(t){"function"==typeof(null===(h=I.logger)||void 0===h?void 0:h.error)&&I.logger.error("JsonParseError in uploadTrunk. xhr.status = "+E.status+". xhr.responseText: "+E.responseText,t),A={errMsg:"JsonParseError in uploadTrunk. xhr.status = "+E.status+". xhr.responseText: "+E.responseText}}200===E.status?(t.setContext(A.context),C?(m(),t.setComplete()):e(t,A.offset,I.retryCount,m)):E.status.toString().match(/^5/)?u>0?e(t,a,u-1,m):(g.removeFileInfo(t.fileKey),I.onError(new M(A.errMsg,A.errCode))):u>0?("function"==typeof(null===(S=I.logger)||void 0===S?void 0:S.error)&&I.logger.error(concat(T="uploadTrunk(".concat(k,") error. retry after 3 seconds. ")).call(T,(new Date).toTimeString())),po((function(){e(t,a,u-1,m)}),3500)):E.status?(g.removeFileInfo(t.fileKey),I.onError(new M(concat(b=concat(R="uploadTrunk(".concat(k,") error: ")).call(R,E.status," ")).call(b,E.statusText)))):I.onError(new M("uploadTrunk(".concat(k,") error. no Error Code. Please check your network")))}},E.open("post",k+"?offset=".concat(a)+"&complete=".concat(C)+"&context=".concat(T)+"&version=".concat(I.version)),E.setRequestHeader("x-nos-token",h.token),h.md5&&E.setRequestHeader("content-md5",h.md5),t.file.type&&E.setRequestHeader("content-type",t.file.type),E.timeout=I.trunkUploadTimeout,"undefined"!=typeof FileReader){var R=new FileReader;R.addEventListener("load",(function(t){var a;(null===(a=null==t?void 0:t.target)||void 0===a?void 0:a.result)instanceof ArrayBuffer&&t.target.result.byteLength>0?E.send(t.target.result):I.onError(new M("Read ArrayBuffer failed",194003))})),R.addEventListener("error",(function(t){var a=t.target.error;I.onError(new M("Read ArrayBuffer error. ".concat(a.toString()),194003))})),R.readAsArrayBuffer(S.call(t.file,a,b))}else E.send(S.call(t.file,a,b))}};function v(t,a){for(var u=0;u<a.length;u++){var m=a[u];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Ke(t,m.key,m)}}var T=function(){function e(t,a,u){!function(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}(this,e),this.uploadState="paused",this.config=u,this.file=t,this.param=a,this.fileKey=g.initFile(a,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 a=this.config;I(this,a.retryCount,(function(u){S(t,u,a.retryCount,(function(){t.setUploadState("ended"),"function"==typeof a.onComplete&&a.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 M("Upload Aborted",10499)))}},{key:"setUploadState",value:function value(t){t!==this.uploadState&&(this.uploadState=t)}},{key:"setContext",value:function value(t){g.setUploadContext(this.fileKey,t,this.config.enableCache),this.param.ctx=t}},{key:"setComplete",value:function value(){g.setComplete(this.fileKey,this.config.enableCache),this.setUploadState("ended")}}])&&v(e.prototype,t),e}(),C={maxFileCache:1/0,expireTime:864e5,getFileUploadInformation:function getFileUploadInformation(t){var a=g.getFileKey(t),u=g.getFileInfo(a);return null===u?null:eo()-u.modifyAt>C.expireTime?(g.removeFileInfo(a),null):{uploadInfo:Ut({bucketName:u.bucket,objectName:u.obj,token:u.token,ctx:u.ctx},u.payload?{payload:u.payload}:{}),complete:u.end}},setMaxFileCache:function setMaxFileCache(t){C.maxFileCache=t},setExpireTime:function setExpireTime(t){C.expireTime=t},printCaches:function printCaches(){if("undefined"!=typeof localStorage)for(var t=0,a=Gt(localStorage);t<a.length;t++){var u=a[t],m=g.getFileInfo(u);m&&console.log(m,"modifiedAt",new Date(m.modifyAt).toTimeString())}},createConfig:function createConfig(t){return new u(t)},createTask:function createTask(t,a,u){return new T(t,a,u)}},b=C;return a.default}()})),Ad=en.some,wd=arrayMethodIsStrict("some");_export({target:"Array",proto:!0,forced:!wd},{some:function some(t){return Ad(this,t,arguments.length>1?arguments[1]:void 0)}});var Nd=entryVirtual("Array").some,xd=Array.prototype,some=function(t){var a=t.some;return t===xd||$(xd,t)&&a===xd.some?Nd:a},Od={debug:function debug(){},log:function log(){},warn:function warn(){},error:function error(){}};function setLogger(t){Od=t}function getLogger(){return Od}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,lu.mark((function _callee(){var a,u,m,h,g,M,I;return lu.wrap((function _callee$(S){for(;;)switch(S.prev=S.next){case 0:if(h=getLogger(),t.fileInput||t.file){S.next=3;break}throw new Error("File not exist");case 3:if(!t.file){S.next=7;break}g=t.file,S.next=21;break;case 7:if("string"!=typeof t.fileInput){S.next=16;break}if(!((M=document.getElementById(t.fileInput))&&M.files&&M.files[0])){S.next=13;break}g=M.files[0],S.next=14;break;case 13:throw new Error("Can not get file from fileInput");case 14:S.next=21;break;case 16:if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0])){S.next=20;break}g=t.fileInput.files[0],S.next=21;break;case 20:throw new Error("Can not get file from fileInput "+t.fileInput);case 21:if(!(t.maxSize&&g.size>t.maxSize)){S.next=23;break}throw new Error("The file exceeds maxSize limit. maxSize: "+t.maxSize+", get "+g.size);case 23:return S.next=25,new $i((function(a,u){var m,M=Rd.getFileUploadInformation(g),I=Rd.createConfig({enableCache:!0,retryCount:0,directUploadAddr:t.chunkUploadHost,onError:function onError(t){u(t)},onUploadProgress:t.onUploadProgress||function(){},onComplete:function onComplete(t){a(t)}});if(M)if(M.complete)t.onUploadProgress&&t.onUploadProgress({total:g.size,loaded:g.size,percentage:1,percentageText:"100%"}),a(M.uploadInfo);else{m=Rd.createTask(g,M.uploadInfo,I);try{t.onUploadStart&&t.onUploadStart(m)}catch(t){h.error("Adapter uploadFile: options.onUploadStart error",t&&t.message),m.abort(),u(t)}}else{m=Rd.createTask(g,Ut(Ut({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(m)}catch(t){h.error("Adapter uploadFile: options.onUploadStart error",t&&t.message),m.abort(),u(t)}}}));case 25:return(I=S.sent).name=g.name,I.size=g.size,I.type=g.type,I.ext=lastIndexOf(a=I.name).call(a,".")>-1?slice(u=I.name).call(u,lastIndexOf(m=I.name).call(m,".")+1).toLowerCase():"",S.abrupt("return",I);case 31:case"end":return S.stop()}}),_callee)})))}function getFileUploadInformationFn(t){var a;if(t.file)a=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");a=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);a=t.fileInput.files[0]}return Rd.getFileUploadInformation(a)}
/*!
* Platform.js v1.3.6
* Copyright 2014-2020 Benjamin Tan
* Copyright 2011-2013 John-David Dalton
* Available under MIT license
*/var Pd=createCommonjsModule((function(t,u){(function(){var m={function:!0,object:!0}[typeof window]&&window||this,h=u,g=t&&!t.nodeType&&t,M=h&&g&&"object"==typeof a&&a;!M||M.global!==M&&M.window!==M&&M.self!==M||(m=M);var I=Math.pow(2,53)-1,S=/\bOpera/,T=Object.prototype,C=T.hasOwnProperty,b=T.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,a){for(var u in t)C.call(t,u)&&a(t[u],u,t)}function getClassOf(t){return null==t?capitalize(t):b.call(t).slice(8,-1)}function qualify(t){return String(t).replace(/([ -])(?!$)/g,"$1?")}function reduce(t,a){var u=null;return function each(t,a){var u=-1,m=t?t.length:0;if("number"==typeof m&&m>-1&&m<=I)for(;++u<m;)a(t[u],u,t);else forOwn(t,a)}(t,(function(m,h){u=a(u,m,h,t)})),u}function trim(t){return String(t).replace(/^ +| +$/g,"")}var E=function parse(t){var a=m,u=t&&"object"==typeof t&&"String"!=getClassOf(t);u&&(a=t,t=null);var h=a.navigator||{},g=h.userAgent||"";t||(t=g);var M,I,T=u?!!h.likeChrome:/\bChrome\b/.test(t)&&!/internal|\n/i.test(b.toString()),C="Object",E=u?C:"ScriptBridgingProxyObject",k=u?C:"Environment",R=u&&a.java?"JavaPackage":getClassOf(a.java),A=u?C:"RuntimeObject",w=/\bJava/.test(R)&&a.java,N=w&&getClassOf(a.environment)==k,x=w?"a":"α",O=w?"b":"β",P=a.document||{},L=a.operamini||a.opera,V=S.test(V=u&&L?L["[[Class]]"]:getClassOf(L))?V:L=null,U=t,D=[],q=null,B=t==g,G=B&&L&&"function"==typeof L.version&&L.version(),H=function getLayout(a){return reduce(a,(function(a,u){return a||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"]),j=function getName(a){return reduce(a,(function(a,u){return a||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"]),z=function getManufacturer(a){return reduce(a,(function(a,u,m){return a||(u[$]||u[/^[a-z]+(?: +[a-z]+\b)*/i.exec($)]||RegExp("\\b"+qualify(m)+"(?:\\b|\\w*\\d)","i").exec(t))&&m}))}({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}}),W=function getOS(a){return reduce(a,(function(a,u){var m=u.pattern||qualify(u);return!a&&(a=RegExp("\\b"+m+"(?:/[\\d.]+|[ \\w.]*)","i").exec(t))&&(a=function cleanupOS(t,a,u){var m={"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 a&&u&&/^Win/i.test(t)&&!/^Windows Phone /i.test(t)&&(m=m[/[\d.]+$/.exec(t)])&&(t="Windows "+m),t=String(t),a&&u&&(t=t.replace(RegExp(a,"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])}(a,m,u.label||u)),a}))}(["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(a){return reduce(a,(function(a,u){var m=u.pattern||qualify(u);return!a&&(a=RegExp("\\b"+m+" *\\d+[.\\w_]*","i").exec(t)||RegExp("\\b"+m+" *\\w+-[\\w]*","i").exec(t)||RegExp("\\b"+m+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(t))&&((a=String(u.label&&!RegExp(m,"i").test(u.label)?u.label:a).split("/"))[1]&&!/[\d.]+/.test(a[0])&&(a[0]+=" "+a[1]),u=u.label||u,a=format(a[0].replace(RegExp(m,"i"),u).replace(RegExp("; *(?:"+u+"[_-])?","i")," ").replace(RegExp("("+u+")[-_.]?(\\w)","i"),"$1 $2"))),a}))}function getVersion(a){return reduce(a,(function(a,u){return a||(RegExp(u+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(t)||0)[1]||null}))}if(H&&(H=[H]),/\bAndroid\b/.test(W)&&!$&&(M=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(t))&&($=trim(M[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),z&&!$?$=getProduct([z]):z&&$&&($=$.replace(RegExp("^("+qualify(z)+")[-_.\\s]","i"),z+" ").replace(RegExp("^("+qualify(z)+")[-_.]?(\\w)","i"),z+" $2")),(M=/\bGoogle TV\b/.exec($))&&($=M[0]),/\bSimulator\b/i.test(t)&&($=($?$+" ":"")+"Simulator"),"Opera Mini"==j&&/\bOPiOS\b/.test(t)&&D.push("running in Turbo/Uncompressed mode"),"IE"==j&&/\blike iPhone OS\b/.test(t)?(z=(M=parse(t.replace(/like iPhone OS/,""))).manufacturer,$=M.product):/^iP/.test($)?(j||(j="Safari"),W="iOS"+((M=/ OS ([\d_]+)/i.exec(t))?" "+M[1].replace(/_/g,"."):"")):"Konqueror"==j&&/^Linux\b/i.test(W)?W="Kubuntu":z&&"Google"!=z&&(/Chrome/.test(j)&&!/\bMobile Safari\b/i.test(t)||/\bVita\b/.test($))||/\bAndroid\b/.test(W)&&/^Chrome/.test(j)&&/\bVersion\//i.test(t)?(j="Android Browser",W=/\bAndroid\b/.test(W)?W:"Android"):"Silk"==j?(/\bMobi/i.test(t)||(W="Android",D.unshift("desktop mode")),/Accelerated *= *true/i.test(t)&&D.unshift("accelerated")):"UC Browser"==j&&/\bUCWEB\b/.test(t)?D.push("speed mode"):"PaleMoon"==j&&(M=/\bFirefox\/([\d.]+)\b/.exec(t))?D.push("identifying as Firefox "+M[1]):"Firefox"==j&&(M=/\b(Mobile|Tablet|TV)\b/i.exec(t))?(W||(W="Firefox OS"),$||($=M[1])):!j||(M=!/\bMinefield\b/i.test(t)&&/\b(?:Firefox|Safari)\b/.exec(j))?(j&&!$&&/[\/,]|^[^(]+?\)/.test(t.slice(t.indexOf(M+"/")+8))&&(j=null),(M=$||z||W)&&($||z||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(W))&&(j=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(W)?W:M)+" Browser")):"Electron"==j&&(M=(/\bChrome\/([\d.]+)\b/.exec(t)||0)[1])&&D.push("Chromium "+M),G||(G=getVersion(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",qualify(j),"(?:Firefox|Minefield|NetFront)"])),(M=("iCab"==H&&parseFloat(G)>3?"WebKit":/\bOpera\b/.test(j)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(H)&&"WebKit"||!H&&/\bMSIE\b/i.test(t)&&("Mac OS"==W?"Tasman":"Trident")||"WebKit"==H&&/\bPlayStation\b(?! Vita\b)/i.test(j)&&"NetFront")&&(H=[M]),"IE"==j&&(M=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(j+=" Mobile",W="Windows Phone "+(/\+$/.test(M)?M:M+".x"),D.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(j="IE Mobile",W="Windows Phone 8.x",D.unshift("desktop mode"),G||(G=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=j&&"Trident"==H&&(M=/\brv:([\d.]+)/.exec(t))&&(j&&D.push("identifying as "+j+(G?" "+G:"")),j="IE",G=M[1]),B){if(function isHostType(t,a){var u=null!=t?typeof t[a]:"number";return!(/^(?:boolean|number|string|undefined)$/.test(u)||"object"==u&&!t[a])}(a,"global"))if(w&&(U=(M=w.lang.System).getProperty("os.arch"),W=W||M.getProperty("os.name")+" "+M.getProperty("os.version")),N){try{G=a.require("ringo/engine").version.join("."),j="RingoJS"}catch(t){(M=a.system)&&M.global.system==a.system&&(j="Narwhal",W||(W=M[0].os||null))}j||(j="Rhino")}else"object"==typeof a.process&&!a.process.browser&&(M=a.process)&&("object"==typeof M.versions&&("string"==typeof M.versions.electron?(D.push("Node "+M.versions.node),j="Electron",G=M.versions.electron):"string"==typeof M.versions.nw&&(D.push("Chromium "+G,"Node "+M.versions.node),j="NW.js",G=M.versions.nw)),j||(j="Node.js",U=M.arch,W=M.platform,G=(G=/[\d.]+/.exec(M.version))?G[0]:null));else getClassOf(M=a.runtime)==E?(j="Adobe AIR",W=M.flash.system.Capabilities.os):getClassOf(M=a.phantom)==A?(j="PhantomJS",G=(M=M.version||null)&&M.major+"."+M.minor+"."+M.patch):"number"==typeof P.documentMode&&(M=/\bTrident\/(\d+)/i.exec(t))?(G=[G,P.documentMode],(M=+M[1]+4)!=G[1]&&(D.push("IE "+G[1]+" mode"),H&&(H[1]=""),G[1]=M),G="IE"==j?String(G[1].toFixed(1)):G[0]):"number"==typeof P.documentMode&&/^(?:Chrome|Firefox)\b/.test(j)&&(D.push("masking as "+j+" "+G),j="IE",G="11.0",H=["Trident"],W="Windows");W=W&&format(W)}if(G&&(M=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(G)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(B&&h.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(q=/b/i.test(M)?"beta":"alpha",G=G.replace(RegExp(M+"\\+?$"),"")+("beta"==q?O:x)+(/\d+\+?/.exec(M)||"")),"Fennec"==j||"Firefox"==j&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(W))j="Firefox Mobile";else if("Maxthon"==j&&G)G=G.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test($))"Xbox 360"==$&&(W=null),"Xbox 360"==$&&/\bIEMobile\b/.test(t)&&D.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(j)&&(!j||$||/Browser|Mobi/.test(j))||"Windows CE"!=W&&!/Mobi/i.test(t))if("IE"==j&&B)try{null===a.external&&D.unshift("platform preview")}catch(t){D.unshift("embedded")}else(/\bBlackBerry\b/.test($)||/\bBB10\b/.test(t))&&(M=(RegExp($.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||G)?(W=((M=[M,/BB10/.test(t)])[1]?($=null,z="BlackBerry"):"Device Software")+" "+M[0],G=null):this!=forOwn&&"Wii"!=$&&(B&&L||/Opera/.test(j)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==j&&/\bOS X (?:\d+\.){2,}/.test(W)||"IE"==j&&(W&&!/^Win/.test(W)&&G>5.5||/\bWindows XP\b/.test(W)&&G>8||8==G&&!/\bTrident\b/.test(t)))&&!S.test(M=parse.call(forOwn,t.replace(S,"")+";"))&&M.name&&(M="ing as "+M.name+((M=M.version)?" "+M:""),S.test(j)?(/\bIE\b/.test(M)&&"Mac OS"==W&&(W=null),M="identify"+M):(M="mask"+M,j=V?format(V.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(M)&&(W=null),B||(G=null)),H=["Presto"],D.push(M));else j+=" Mobile";(M=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(M=[parseFloat(M.replace(/\.(\d)$/,".0$1")),M],"Safari"==j&&"+"==M[1].slice(-1)?(j="WebKit Nightly",q="alpha",G=M[1].slice(0,-1)):G!=M[1]&&G!=(M[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(G=null),M[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==M[0]&&537.36==M[2]&&parseFloat(M[1])>=28&&"WebKit"==H&&(H=["Blink"]),B&&(T||M[1])?(H&&(H[1]="like Chrome"),M=M[1]||((M=M[0])<530?1:M<532?2:M<532.05?3:M<533?4:M<534.03?5:M<534.07?6:M<534.1?7:M<534.13?8:M<534.16?9:M<534.24?10:M<534.3?11:M<535.01?12:M<535.02?"13+":M<535.07?15:M<535.11?16:M<535.19?17:M<536.05?18:M<536.1?19:M<537.01?20:M<537.11?"21+":M<537.13?23:M<537.18?24:M<537.24?25:M<537.36?26:"Blink"!=H?"27":"28")):(H&&(H[1]="like Safari"),M=(M=M[0])<400?1:M<500?2:M<526?3:M<533?4:M<534?"4+":M<535?5:M<537?6:M<538?7:M<601?8:M<602?9:M<604?10:M<606?11:M<608?12:"12"),H&&(H[1]+=" "+(M+="number"==typeof M?".x":/[.+]/.test(M)?"":"+")),"Safari"==j&&(!G||parseInt(G)>45)?G=M:"Chrome"==j&&/\bHeadlessChrome/i.test(t)&&D.unshift("headless")),"Opera"==j&&(M=/\bzbov|zvav$/.exec(W))?(j+=" ",D.unshift("desktop mode"),"zvav"==M?(j+="Mini",G=null):j+="Mobile",W=W.replace(RegExp(" *"+M+"$"),"")):"Safari"==j&&/\bChrome\b/.exec(H&&H[1])?(D.unshift("desktop mode"),j="Chrome Mobile",G=null,/\bOS X\b/.test(W)?(z="Apple",W="iOS 4.3+"):W=null):/\bSRWare Iron\b/.test(j)&&!G&&(G=getVersion("Chrome")),G&&0==G.indexOf(M=/[\d.]+$/.exec(W))&&t.indexOf("/"+M+"-")>-1&&(W=trim(W.replace(M,""))),W&&-1!=W.indexOf(j)&&!RegExp(j+" OS").test(W)&&(W=W.replace(RegExp(" *"+qualify(j)+" *"),"")),H&&!/\b(?:Avant|Nook)\b/.test(j)&&(/Browser|Lunascape|Maxthon/.test(j)||"Safari"!=j&&/^iOS/.test(W)&&/\bSafari\b/.test(H[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(j)&&H[1])&&(M=H[H.length-1])&&D.push(M),D.length&&(D=["("+D.join("; ")+")"]),z&&$&&$.indexOf(z)<0&&D.push("on "+z),$&&D.push((/^on /.test(D[D.length-1])?"":"on ")+$),W&&(M=/ ([\d.+]+)$/.exec(W),I=M&&"/"==W.charAt(W.length-M[0].length-1),W={architecture:32,family:M&&!I?W.replace(M[0],""):W,version:M?M[1]:null,toString:function(){var t=this.version;return this.family+(t&&!I?" "+t:"")+(64==this.architecture?" 64-bit":"")}}),(M=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(U))&&!/\bi686\b/i.test(U)?(W&&(W.architecture=64,W.family=W.family.replace(RegExp(" *"+M),"")),j&&(/\bWOW64\b/i.test(t)||B&&/\w(?:86|32)$/.test(h.cpuClass||h.platform)&&!/\bWin64; x64\b/i.test(t))&&D.unshift("32-bit")):W&&/^OS X/.test(W.family)&&"Chrome"==j&&parseFloat(G)>=39&&(W.architecture=64),t||(t=null);var K={};return K.description=t,K.layout=H&&H[0],K.manufacturer=z,K.name=j,K.prerelease=q,K.product=$,K.ua=t,K.version=j&&G,K.os=W||{architecture:null,family:null,version:null,toString:function(){return"null"}},K.parse=parse,K.toString=function toStringPlatform(){return this.description||""},K.version&&D.unshift(G),K.name&&D.unshift(j),W&&j&&(W!=String(W).split(" ")[0]||W!=j.split(" ")[0]&&!$)&&D.push($?"("+W+")":"on "+W),D.length&&(K.description=D.join(" ")),K}();h&&g?forOwn(E,(function(t,a){h[a]=t})):m.platform=E}).call(a)}));function getSystemInfoFn(){var t,a,u=Pd.version||"";if(isElectron())try{var m=navigator.userAgent.match(/Electron\/([\d.]+\d+)/);m&&m[1]&&"string"==typeof m[1]&&(u=m[1])}catch(t){}return{os:(null===(t=Pd.os)||void 0===t?void 0:t.family)||"",osVer:(null===(a=Pd.os)||void 0===a?void 0:a.version)||"",browser:Pd.name||"",browserVer:Pd.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:Pd.name||""}}var Ld=null,Vd=null,Ud={getNetworkStatus:function getNetworkStatus(){return $i.resolve({net_type:0,net_connect:"undefined"==typeof navigator||"boolean"!=typeof navigator.onLine||navigator.onLine})},onNetworkStatusChange:function onNetworkStatusChange(t){Ld=function onlineListener(){t({isConnected:!0,networkType:0})},Vd=function offlineListener(){t({isConnected:!1,networkType:0})},window.addEventListener("online",Ld),window.addEventListener("offline",Vd)},offNetworkStatusChange:function offNetworkStatusChange(){Ld&&window.removeEventListener("online",Ld),Vd&&window.removeEventListener("offline",Vd),Ld=null,Vd=null}},Dd=getLogger(),qd=function getVisibilityEvent(){var t="hidden",a="visibilitychange";return"undefined"==typeof document||void 0!==document.hidden||(void 0!==document.webkitHidden?(t="webkitHidden",a="webkitvisibilitychange"):void 0!==document.msHidden?(t="msHidden",a="msvisibilitychange"):void 0!==document.mozHidden&&(t="mozHidden",a="mozvisibilitychange")),{hidden:t,visibilityChange:a}},Bd=function(t){function PowerMonitor(){var a;return(a=t.call(this)||this).status=0,a.visibilityListener=null,a.flag=!1,a._initVisibilityListener(),a}wt(PowerMonitor,t);var a=PowerMonitor.prototype;return a.isActive=function isActive(){return 0===this.status},a.getStatus=function getStatus(){return this.status},a.setStatus=function setStatus(t){var a=this.status;t!==a&&(this.status=t,0===t&&1===a&&this.emit("onPowerMonitorTurnActive"),Dd.log("Adapter powerMonitor::setStatus: ",t))},a.destroy=function destroy(){if(this.status=0,this.flag=!1,this._canIUse()&&this.visibilityListener){var t=qd().visibilityChange;document.removeEventListener(t,this.visibilityListener),this.visibilityListener=null}},a._initVisibilityListener=function _initVisibilityListener(){if(!this.flag)if(!1!==this._canIUse()){var t=qd(),a=t.hidden,u=t.visibilityChange;a&&void 0!==document[a]&&(this.visibilityListener=function genVisibilityListener(t){return function(){var a=t.status,u=qd().hidden;u&&document[u]?t.status=1:(t.status=0,1===a&&t.emit("onPowerMonitorTurnActive")),Dd.log("Adapter powerMonitor::visibility change status:",t.status)}}(this),document.addEventListener(u,this.visibilityListener),this.flag=!0,Dd.log("Adapter powerMonitor::_initVisibilityListener success, isHidden:",null===document||void 0===document?void 0:document[a]))}else Dd.warn("Adapter powerMonitor::_initVisibilityListener no document.addEventListener")},a._canIUse=function _canIUse(){return"undefined"!=typeof document&&void 0!==document.addEventListener},PowerMonitor}(mo),Fd="log",Gd=function(){function IDB(t,a){this.db=null,this.stores=[],this.name=t,this.version=a}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 a,u=find(a=this.stores).call(a,(function(a){return a.storeName===t}));if(!u)throw new Error("LogStorage: store not found. "+t);return u},t.open=function open(){var t=this,a=window.indexedDB.open(this.name,this.version);return new $i((function(u,m){a.onerror=function(t){var a=t.target;m(a.error)},a.onsuccess=function(a){var m,h,g=a.target;t.db=g.result,t.db.removeEventListener("close",bind$1(m=t.triggerDBCloseEvt).call(m,t)),t.db.addEventListener("close",bind$1(h=t.triggerDBCloseEvt).call(h,t)),t.stores.push(new Hd(Fd,t)),u()},a.onupgradeneeded=function(a){var u=a.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 a=t.result,u=t.transaction&&a.objectStoreNames.contains(Fd)?t.transaction.objectStore(Fd):a.createObjectStore(Fd,{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}(),Hd=function(){function IDBStore(t,a){this.idb=null,this.storeName=t,this.idb=a}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 a=this.getDB(),u=this.getStoreName(),m=a.transaction(u,"readwrite"),h=m.objectStore(u);return forEach$1(t).call(t,(function(t){h.add(t)})),new $i((function(t,a){m.oncomplete=function(){t()},m.onerror=function(t){var u=t.target;a(u.error)},m.onabort=function(t){var u=t.target;u.error instanceof Error?a(u.error):a(new Error("TransactionAborted"))}}))},t.bulkDelete=function bulkDelete(t){var a=t.keyName,u=t.lower,m=t.upper,h=t.lowerOpen,g=void 0!==h&&h,M=t.upperOpen,I=void 0!==M&&M,S=IDBKeyRange.bound(u,m,g,I),T=this.getDB(),C=this.getStoreName(),b=T.transaction(C,"readwrite"),E=b.objectStore(C).index(a).openCursor(S),k=0;return E.onsuccess=function(t){var a=t.target.result;a&&(a.delete(),k++,a.continue())},new $i((function(t,a){b.oncomplete=function(){t(k)},b.onerror=function(t){var u=t.target;a(u.error)},b.onabort=function(t){var u=t.target;u.error instanceof Error?a(u.error):a(new Error("TransactionAborted"))}}))},t.readAll=function readAll(){var t=this.getDB(),a=this.getStoreName(),u=t.transaction(a,"readonly").objectStore(a);if(!u.getAll)throw new Error("IDBExtract not support");var m=u.getAll();return new $i((function(t,a){m.onsuccess=function(a){var u=a.target;t(u.result)},m.onerror=function(t){var u=t.target;a(u.error)}}))},IDBStore}(),jd=function(){function LogStorageImpl(t){void 0===t&&(t="nim_logs"),this.idb=new Gd(t,1)}var t=LogStorageImpl.prototype;return t.open=function open(){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var t;return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.idb.open();case 2:return t=this.idb.getStore(Fd),a.prev=3,a.next=6,t.bulkDelete({keyName:"time",lower:0,upper:eo()-2592e5});case 6:a.next=10;break;case 8:a.prev=8,a.t0=a.catch(3);case 10:case"end":return a.stop()}}),_callee,this,[[3,8]])})))},t.close=function close(){this.idb.close()},t.addLogs=function addLogs(t){return this.idb.getStore(Fd).bulkCreate(t)},t.extractLogs=function extractLogs(){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var t,a,u,m,h;return lu.wrap((function _callee2$(g){for(;;)switch(g.prev=g.next){case 0:return a=this.idb.getStore(Fd),g.next=3,a.readAll();case 3:if(0!==(u=g.sent).length){g.next=6;break}return g.abrupt("return",void 0);case 6:return m=reduce(u).call(u,(function(t,a){var u=a.iid;return t[u]||(t[u]=[]),t[u].push(a),t}),{}),h=map$6(t=Gt(m)).call(t,(function(t){var a=m[t];return"==========iid:"+t+"==========\n "+map$6(a).call(a,(function(t){return t.text})).join("\n")})).join("\n"),g.abrupt("return",new File([h],"nim-logs.txt",{type:"text/plain"}));case 9:case"end":return g.stop()}}),_callee2,this)})))},t.afterUpload=function afterUpload(){return $i.resolve()},LogStorageImpl}();function _createForOfIteratorHelperLoose$c(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$c(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$c(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$c(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$c(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var $d={},zd={};function createCmd(t,a,u,m){var h=$d[t];if(!h)return u.error("createCmd:: can not find cmd config: ",t),null;var g,M={SER:a,SID:h.sid,CID:h.cid,Q:[]};h.params&&m&&forEach$1(g=h.params).call(g,(function(t){var a=m[t.name];if(null!=a){var u=t.type,h=t.reflectMapper,g=t.select;switch(t.type){case"PropertyArray":u="ArrayMable",a=map$6(a).call(a,(function(t){return{t:"Property",v:h?serialize(t,h,g):t}}));break;case"Property":a=h?serialize(a,h,g):a;break;case"Bool":a=a?"true":"false"}M.Q.push({t:u,v:a})}}));return{packet:M,hasPacketResponse:"boolean"!=typeof h.hasPacketResponse||h.hasPacketResponse,hasPacketTimer:"boolean"!=typeof h.hasPacketTimer||h.hasPacketTimer}}function parseCmd(t,a){var u,m;try{m=JSON.parse(t)}catch(u){return void a.error('Parse command error:"'+t+'"')}var h=m.sid+"_"+m.cid,g=m.r;if(includes(u=["4_1","4_2","4_10","4_11"]).call(u,h)){var M=m.r[1].headerPacket;h=M.sid+"_"+M.cid,m.sid=M.sid,m.cid=M.cid,g=m.r[1].body}var I=zd[h],S=[];if(I&&I.length>0){for(var T,C=_createForOfIteratorHelperLoose$c(I);!(T=C()).done;){var b=T.value;S.push(parseEachCmd(m,b.config,b.cmd,g,a))}return S}a.error("parseCmd:: mapper not exist",h,m.code)}function parseEachCmd(t,a,u,m,h){var g,M={cmd:u,raw:t,error:null,service:null==a?void 0:a.service,content:{},__receiveTimeNode:Xu.getTimeNode()};(18===a.sid||a.sid>=26&&a.sid<100)&&(t.code=function toReadableCode(t){if("number"!=typeof t||t!=t)throw new Wl({code:jl.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 a=(65535&t)>>9;a-=a<=38?1:2;return 1e5+1e3*a+(511&t)}(t.code));var I,S=function genCmdError(t,a){var u=$l[t],m=Zl[t];return null===m?null:new Wl({code:t,desc:u||m||t,detail:{cmd:a,timetag:eo()}})}(t.code,u);if(M.error=S,M.error){if(M.error.detail.cmd=u,!(null===(g=null==a?void 0:a.ignoreErrCodes)||void 0===g?void 0:includes(g).call(g,t.code)))return M;h.warn("parseCmd:: ignore error ",M.error),M.error.detail.ignore=!0}a.response&&forEach$1(I=a.response).call(I,(function(t,a){var u=m[a],h=t.type,g=t.name,I=t.reflectMapper;if(void 0!==u)switch(h){case"Property":M.content[g]=I?deserialize(u,I):u;break;case"PropertyArray":M.content[g]=map$6(u).call(u,(function(t){return I?deserialize(t,I):t}));break;case"Int":case"Long":case"Byte":M.content[g]=+u;break;case"Bool":M.content[g]="true"===u||!0===u||1===u;break;default:M.content[g]=u}}));return M}function serialize(t,a,u){var m={};for(var h in t=function flattenObjByMapper(t,a){var u={};for(var m in a){for(var h,g=a[m],M="number"==typeof g?m:g.access?g.access:m,I=t,S=_createForOfIteratorHelperLoose$c(M.split("."));!(h=S()).done;){var T=h.value;if(void 0===I[T]||null===I[T]){I=void 0;break}I=I[T]}void 0!==I&&(u[M]=I)}return u}(t,a),a){var g=a[h],M="number"==typeof g?h:g.access?g.access:h;if(!u||includes(u).call(u,h))if(M in t){if("number"==typeof g)m[g]=t[M];else if("object"==typeof g)if(g.converter){var I=g.converter(t[M],t);void 0!==I&&(m[g.id]=I)}else m[g.id]=t[M]}else"object"==typeof g&&g.def&&("function"==typeof g.def?m[g.id]=g.def(t):m[g.id]=g.def)}return m}function deserialize(t,a){var u={};for(var m in t){var h=a[m];if("string"==typeof h)u[h]=t[m];else if("object"==typeof h&&"prop"in h){var g=h.access?h.access:h.prop;if(h.converter){var M=h.converter(t[m],t);void 0!==M&&(u[g]=M)}else h.type&&"number"===h.type?u[g]=+t[m]:h.type&&"boolean"===h.type?u[g]=!("0"===t[m]||!t[m]):u[g]=t[m]}}for(var I in a){var S=a[I];if(S&&void 0!==S.def){var T=S.access?S.access:S.prop;T in u||("function"==typeof S.def?u[T]=S.def(t):u[T]=S.def)}}return u=function unflattenObj(t){var a={},u=function _loop(u){var m=u.split(".");reduce(m).call(m,(function(a,h,g){return a[h]||(a[h]=isNaN(Number(m[g+1]))?m.length-1==g?t[u]:{}:[])}),a)};for(var m in t)u(m);return a}(u),u}function registerParser(t){for(var a in Ut($d,t.cmdConfig),t.cmdMap){var u=t.cmdMap[a],m=t.cmdConfig[u];if(m)if(Un(zd[a])){for(var h,g=!1,M=_createForOfIteratorHelperLoose$c(zd[a]);!(h=M()).done;){var I=h.value;if(I.cmd===u&&I.config.service===m.service){g=!0;break}}g||zd[a].push({config:m,cmd:u})}else zd[a]=[{config:m,cmd:u}]}}function invertSerializeMap(t){var a,u={};return forEach$1(a=Gt(t)).call(a,(function(a){u[a]=invertSerializeItem(t[a])})),u}function invertSerializeItem(t){var a={};for(var u in t){var m=t[u];"number"==typeof m?a[m]=u:"object"==typeof m&&(a[m.id]={prop:u,type:m.retType,access:m.retAccess?m.retAccess:m.access?m.access:u,def:m.retDef,converter:m.retConverter})}return a}function boolToInt(t){return t?1:0}function intToBool(t){return 1===Bu(t)}function objectToJSONString(t){if(t&&"object"==typeof t)try{return Vn(t)}catch(t){return}}function stringToJSONObject(t){if(t&&"string"==typeof t)try{return JSON.parse(t)}catch(t){return}}var Wd,Kd,Yd,Qd,Jd,Xd={"1_2":"heartbeat","2_3":"login","2_5":"kicked","2_6":"logout","2_7":"nimLoginClientChange","2_8":"kick"},Zd={login:{clientType:3,os:4,sdkVersion:6,appLogin:8,protocolVersion:9,pushTokenName:10,pushToken:11,deviceId:13,appkey:18,account:19,browser:24,clientSession:26,deviceInfo:32,isReactNative:112,token:1e3,customTag:38,customClientType:39,sdkHumanVersion:40,hostEnv:41,userAgent:42,libEnv:44,authType:115,loginExt:116},loginRes:{lastLoginDeviceId:17,customTag:38,connectionId:102,ip:103,port:104,country:106,loginTime:109,hasXMPush:111},loginPort:{type:3,os:4,mac:5,deviceId:13,account:19,deviceInfo:32,customTag:38,customClientType:39,connectionId:102,ip:103,port:104,time:109,pushType:110,hasTokenPreviously:111},aosPushInfo:{pushType:110,hasTokenPreviously:111}},ep=invertSerializeMap(Zd),tp={login:{sid:2,cid:3,service:"auth",params:[{type:"Property",name:"login",reflectMapper:Zd.login}],response:[{type:"Property",name:"loginRes",reflectMapper:ep.loginRes},{type:"PropertyArray",name:"loginPorts",reflectMapper:ep.loginPort},{type:"Property",name:"aosPushInfo",reflectMapper:ep.aosPushInfo}]},logout:{sid:2,cid:6,service:"auth"},heartbeat:{sid:1,cid:2,service:"auth"},kicked:{sid:2,cid:5,service:"auth",response:[{type:"Int",name:"clientType"},{type:"Int",name:"reason"},{type:"String",name:"ext"},{type:"Int",name:"customClientType"}]},nimLoginClientChange:{sid:2,cid:7,service:"auth",response:[{type:"Byte",name:"state"},{type:"PropertyArray",name:"datas",reflectMapper:ep.loginPort}]},kick:{sid:2,cid:8,service:"auth",params:[{type:"StrArray",name:"deviceIds"}],response:[{type:"StrArray",name:"deviceIds"}]}};function format(t,a){if(!isPlainObject(a))return{};var u=JSON.parse(Vn(a)),m=doFormat(t,u);return JSON.parse(Vn(Ut(Ut({},u),m)))}function doFormat(t,a){if(!isPlainObject(a))return{};var u={},m=Gt(t);return forEach$1(m).call(m,(function(m){var h=t[m].type;if("string"!=typeof h){var g=doFormat(t[m],a);Gt(g).length>0&&(u[m]=g)}else{var M=t[m],I=M.rawKey||m,S=rp[h](a,I,M);void 0!==S&&(a[I]=void 0,u[m]=S)}})),u}!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"}(Wd||(Wd={})),function(t){t[t.p2p=0]="p2p",t[t.team=1]="team",t[t.superTeam=5]="superTeam"}(Kd||(Kd={})),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"}(Yd||(Yd={})),function(t){t[t.unread=1]="unread",t[t.read=2]="read",t[t.deleted=3]="deleted",t[t.sending=4]="sending",t[t.sendFailed=5]="sendFailed",t[t.sent=6]="sent",t[t.receipt=7]="receipt",t[t.refused=10]="refused"}(Qd||(Qd={})),function(t){t[t.default=0]="default",t[t.leave=1]="leave",t[t.roam=2]="roam"}(Jd||(Jd={}));var rp={number:function number(t,a){if(void 0!==t[a])return+t[a]},string:function string(t,a){if(void 0!==t[a])return t[a]},boolean:function boolean(t,a){return+t[a]>0||0!=+t[a]&&void 0},enum:function _enum(t,a,u){return values(u)[t[a]]},object:function object(t,a){if(void 0!==t[a])try{return JSON.parse(t[a])}catch(t){return{}}}};function formatReverse(t,a){if(!isPlainObject(a))return{};var u=JSON.parse(Vn(a)),m=doFormatReverse(t,u);return JSON.parse(Vn(Ut(Ut({},u),m)))}function doFormatReverse(t,a){var u;if(!isPlainObject(a))return reduce(u=Gt(t)).call(u,(function(a,u){return a[t[u].rawKey||u]=void 0,a}),{});var m={},h=Gt(t);return forEach$1(h).call(h,(function(u){var h=t[u].type;if("string"!=typeof h){var g=doFormatReverse(t[u],a[u]);return Ut(m,g),void(a[u]=void 0)}var M=t[u],I=M.rawKey||u,S=np[h](a,u,M);a[I]=void 0,m[I]=S})),m}var np={number:function number(t,a){return t[a]},string:function string(t,a){return t[a]},boolean:function boolean(t,a){return!0===t[a]?1:!1===t[a]?0:void 0},enum:function _enum(t,a,u){return values(u)[t[a]]},object:function object(t,a){if(void 0!==t[a])try{return Vn(t[a])}catch(t){return""}}},ap=np;function formatMultiPortLoginInfo(t,a){return t&&t.length>0?map$6(t).call(t,(function(t){return Ut(Ut({},t),{account:t.account,connectionId:t.connectionId,deviceId:t.deviceId,ip:t.ip,mac:t.mac,os:t.os,type:getEnumKeyByEnumValue(Yd,t.type)||t.type,time:Bu(t.time),online:3!==a})})):[]}var ip={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 op=Backoff;function Backoff(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var a=Math.random(),u=Math.floor(a*this.jitter*t);t=0==(1&Math.floor(10*a))?t-u:t+u}return 0|Math.min(t,this.max)},Backoff.prototype.reset=function(){this.attempts=0},Backoff.prototype.setMin=function(t){this.ms=t},Backoff.prototype.setMax=function(t){this.max=t},Backoff.prototype.setJitter=function(t){this.jitter=t};var sp,cp=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"],lp=["transport not supported","client not handshaken","unauthorized"],up=["reconnect"],dp=function(t){function BaseWebsocket(a,u,m){var h;return(h=t.call(this)||this).websocket=null,h.socketConnectTimer=0,h.url="",h.linkSSL=!0,h.core=a,h.url=u,h.linkSSL=m,h.status="disconnected",h.logger=a.logger,h.connect(),h}wt(BaseWebsocket,t);var a=BaseWebsocket.prototype;return a.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(a){if("connecting"===t.status){var u=a.data.split(":"),m=u[0];return u[1],t.sessionId=m,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/"+m)}})).catch((function(a){if("connecting"===t.status){var u='imsocket::XHR fail. raw message: "'+(a=a||{}).message+'", code: "'+a.code+'"',m=a.code;m="v2"===get(t.core,"options.apiVersion")?a.code===jl.V2NIM_ERROR_CODE_CONNECT_TIMEOUT?jl.V2NIM_ERROR_CODE_CONNECT_TIMEOUT:jl.V2NIM_ERROR_CODE_CONNECT_FAILED:408===a.code?408:415;var h=new Wl({code:m,detail:{reason:u,rawError:a}});t.logger.error(u),t.status="disconnected",t.emit("handshakeFailed",h)}}))):this.logger.warn("imsocket::socket is connecting or connected",this.status)},a.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"})}},a.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)},a.onConnect=function onConnect(){this.status="connected",this.emit("connect"),clearTimeout(this.socketConnectTimer)},a._createWebsocket=function _createWebsocket(t){var a,u=this;this.socketConnectTimer=po((function(){u.logger.error("imsocket::Websocket connect timeout. url: ",u.socketUrl),u.emit("handshakeFailed",new Wl({code:"v2"===get(u.core,"options.apiVersion")?jl.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 uu.WebSocket(t),this.websocket.onmessage=bind$1(a=this.onMessage).call(a,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()}},a.onMessage=function onMessage(t){var a,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 Wl({code:"v2"===get(this.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_CONNECT_FAILED:408,detail:{reason:"imsocket::Websocket connect failed, onMessage socket error. url: "+this.socketUrl}}));break;case"heartbeat":null===(a=this.websocket)||void 0===a||a.send(this.encodePacket({type:"heartbeat"}));break;default:this.logger.warn("imsocket::Websocket no handler type",u.type)}},a.encodePacket=function encodePacket(t){var a,u,m=t.type,h=t.id,g=void 0===h?"":h,M=t.endpoint,I=void 0===M?"":M,S=t.ack,T=null;if(!m)return"";switch(m){case"error":a=t.reason?indexOf(lp).call(lp,t.reason):"",u=t.advice?indexOf(up).call(up,t.advice):"",""===a&&""===u||(T=a+(""!==u?"+"+u:""));break;case"message":""!==t.data&&(T=t.data);break;case"event":a={name:t.name},a=t.args&&t.args.length?{name:t.name,args:t.args}:{name:t.name},T=Vn(a);break;case"json":T=Vn(t.data);break;case"connect":t.qs&&(T=t.qs);break;case"ack":T=t.ackId+(t.args&&t.args.length?"+"+Vn(t.args):"")}var C=[indexOf(cp).call(cp,m),g+("data"===S?"+":""),I];return null!=T&&C.push(T),C.join(":")},a.decodePacket=function decodePacket(t){if(t)if("�"!=t.charAt(0)){var a=t.match(/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/);if(a){var u,m=a[1],h=a[2],g=a[3],M=a[4],I=a[5],S={type:cp[+m],endpoint:M};switch(h&&(S.id=h,S.ack=!g||"data"),S.type){case"error":u=I.split("+"),S.reason=lp[+u[0]]||"";break;case"message":S.data=I||"";break;case"connect":S.qs=I||"";break;case"event":try{var T=JSON.parse(I);S.name=T.name,S.args=T.args}catch(t){this.logger.error("imsocket::parseData::type::event error",t)}S.args=S.args||[];break;case"json":try{S.data=JSON.parse(I)}catch(t){this.logger.error("imsocket::parseData::type::json error",t)}break;case"ack":if((u=I.match(/^([0-9]+)(\+)?(.*)/))&&(S.ackId=u[1],S.args=[],u[3]))try{S.args=u[3]?JSON.parse(u[3]):[]}catch(t){this.logger.error("imsocket::parseData::type::ack error",t)}}return S}}else this.logger.error("imsocket::unrecognize dataStr",slice(t).call(t,0,20))},a.send=function send(t){var a,u={data:t,type:"message",endpoint:""};null===(a=this.websocket)||void 0===a||a.send(this.encodePacket(u))},BaseWebsocket}(mo);function uniq(t){t=t||[];for(var a=[],u=0;u<t.length;u++)-1===indexOf(a).call(a,t[u])&&a.push(t[u]);return a}function _createForOfIteratorHelperLoose$b(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$b(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$b(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$b(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$b(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}!function(t){t[t.ACTIVE=1]="ACTIVE",t[t.KICKED=2]="KICKED",t[t.OFFLINE=3]="OFFLINE"}(sp||(sp={}));var pp=function(){function V1ClientSocket(t,a){this.linkUrls=[],this.isAutoReconnect=!1,this.packetTimeout=3e4,this.linkSSL=!0,this.packetSer=1,this.retryCount=0,this.reconnectTimer=0,this.backoff=new op({max:8e3,min:1600,jitter:.01}),this.sendingCmdMap=new _c,this.pingTimer=0,this.hasNetworkListener=!1,this.core=t,a&&(this.auth=a),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,a){return void 0===t&&(t={}),__awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g,M,I;return lu.wrap((function _callee$(S){for(;;)switch(S.prev=S.next){case 0:if(validate({linkUrls:{type:"array",itemType:"string",required:!1}},t),/^(unconnected|waitReconnect)$/.test(this.core.status)){S.next=5;break}return u="Core socket status is "+this.core.status+", and would not connect",this.logger.warn(u),S.abrupt("return",$i.reject(u));case 5:this.core.status="connecting",t.linkUrls&&t.linkUrls.length>0&&(this.linkUrls=concat(m=t.linkUrls).call(m,this.linkUrls),this.linkUrls=uniq(this.linkUrls)),0===this.linkUrls.length&&this.linkUrls.push(ju),h=0;case 9:if(!(h<this.linkUrls.length)){S.next=31;break}return g=this.linkUrls[h],M=(new Date).getTime(),S.prev=12,S.next=15,this.doConnect(g);case 15:return this.core.status="connected",this.logger.log("clientsocketV1::connect success with url: "+g),S.abrupt("return",g);case 20:S.prev=20,S.t0=S.catch(12),I=S.t0,a&&a(I,g),this.reporter.reportTraceStart("exceptions",{user_id:this.core.options.account,start_time:M,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:g},{asyncParams:uu.net.getNetworkStatus()}),this.reporter.reportTraceEnd("exceptions",1),this.logger.warn("clientsocketV1::connect failed with url: "+g,S.t0);case 28:h++,S.next=9;break;case 31:throw 0===this.retryCount?this.doDisconnect(sp.ACTIVE,"SocketHandshakeFailed"):this.doDisconnect(sp.OFFLINE,"ReconnectHadRetryAllLinks"),new Error("clientSocketV1::socket xhr or socket connect failed");case 33:case"end":return S.stop()}}),_callee,this,[[12,20]])})))},t.doConnect=function doConnect(t){var a=this,u=!1;return new $i((function(m,h){var g;a.socket=new dp(a.core,t,a.linkSSL),a.socket.on("connect",(function(){a.logger.log("clientSocketV1::on connect",t),a.core.reporterHookLinkKeep&&(a.core.reporterHookLinkKeep.start(),a.core.reporterHookLinkKeep.update({code:0,description:"connection begin",operation_type:0,target:t})),u=!0,m()})),a.socket.on("message",bind$1(g=a.onMessage).call(g,a)),a.socket.on("disconnect",(function(m){return __awaiter(a,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:if(this.logger.log("clientSocketV1::socket on disconnect",m),!this.core.reporterHookLinkKeep){a.next=5;break}return a.next=4,this.core.reporterHookLinkKeep.update({code:(null==m?void 0:m.code)||0,description:(null==m?void 0:m.reason)||"socket on disconnect",operation_type:1,target:t});case 4:this.core.reporterHookLinkKeep.end(!1);case 5:u=!0,this.doDisconnect(sp.OFFLINE,"SocketOnDisconnect");case 7:case"end":return a.stop()}}),_callee2,this)})))})),a.socket.on("handshakeFailed",(function(t){u?a.ping():(a.logger.error('clientsocketV1::handshake failed: "'+(t&&t.message)+'"'),a.cleanSocket()),u=!0,h(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,a,u){var m,h,g,M,I;if(this.logger.log("doDisconnect:type:"+t+",description:"+a),"unconnected"!==this.core.status){var S={1:"close",2:"kicked",3:"broken"}[t]||"";this.markAllCmdInvaild(new Wl({code:415,desc:"Packet timeout due to instance disconnect",detail:{reason:"Packet timeout due to instance disconnect",disconnect_reason:S}})),this.timerManager.destroy(),clearTimeout(this.pingTimer),this.cleanSocket();var T=!this.core.options.needReconnect||this.retryCount>=this.core.options.reconnectionAttempts;if(t===sp.ACTIVE||T)this.logger.log("doDisconnect: emit disconnect, type "+t,T),this.core.status="unconnected",this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.core.eventBus.emit("disconnect"),this.core.emit("disconnect"),null===(m=this.auth)||void 0===m||m.emit("disconnect"),this.destroyOnlineListener();else if(t===sp.KICKED){this.logger.log("doDisconnect: kicked"),this.core.status="unconnected",this.reconnectTimer&&clearTimeout(this.reconnectTimer);var C="string"==typeof a?{reason:"unknow",message:a}:a;this.core.eventBus.emit("kicked",C),this.core.emit("kicked",C),null===(h=this.auth)||void 0===h||h.emit("kicked",C),this.destroyOnlineListener()}else t===sp.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===sp.OFFLINE&&(null===(M=null===(g=this.auth)||void 0===g?void 0:g.authenticator)||void 0===M?void 0:M.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===sp.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,a,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 m=this.backoff.duration();this.retryCount++,this.logger.log("willReconnect "+this.retryCount+" "+m),this.core.eventBus.emit("willReconnect",{retryCount:this.retryCount,duration:m}),this.core.emit("willReconnect",{retryCount:this.retryCount,duration:m}),null===(a=this.auth)||void 0===a||a.emit("willReconnect",{retryCount:this.retryCount,duration:m}),this.core.status="waitReconnect",this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=po((function(){return __awaiter(u,void 0,void 0,lu.mark((function _callee3(){var t=this;return lu.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:if("waitReconnect"===this.core.status){a.next=3;break}return this.logger.warn("doDisconnect: reconnectTimer status is "+this.core.status+", would not go on reconnecting"),a.abrupt("return");case 3:return a.next=5,uu.net.getNetworkStatus();case 5:!1===a.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(sp.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 a.stop()}}),_callee3,this)})))}),m)}else this.logger.warn("doDisconnect: already is waiting reconnect")},t.sendCmd=function sendCmd(t,a,u){var m=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),$i.reject({cmd:t,error:{code:"No_connected",message:"Connection not established",timetag:(new Date).getTime()}});if(!this.socket||!this.socket.send)return $i.reject("No_socket");var h="heartbeat"!==t,g=h?this.packetSer++:0,M=createCmd(t,g,this.logger,a);if(!M){var I="SendCmd "+g+" "+t+" error";return this.logger.error(I),$i.reject(new Error(I))}var S=M.packet,T=M.hasPacketResponse,C=M.hasPacketTimer,b=Vn(S);h&&(this.logger.getDebugMode()?this.logger.debug("clientsocketV1::sendCmd",t,"ser:"+g,b):this.logger.log("clientsocketV1::sendCmd",t,"ser:"+g));var E=(new Date).getTime();return new $i((function(h,M){T&&m.sendingCmdMap.set(g,{cmd:t,params:a,callback:[h,M],timer:C?po((function(){var a=new Wl({code:408,desc:"Packet Timeout",detail:{reason:"Packet Timeout",cmd:t,ser:g,timetag:eo()}});m.markCmdInvalid(g,a,t)}),u&&u.timeout?u.timeout:m.core.config.timeout):null});try{m.socket.send(b),T||h(S)}catch(a){var I=new Wl({code:415,detail:{reason:a&&a.message||"Unable to send packet",cmd:t,ser:g,timetag:eo(),rawError:a}});m.markCmdInvalid(g,I,t),M(a)}})).catch((function(t){var a,u=[408,415];if(!includes(u).call(u,t.code))return $i.reject(t);m.reporter.reportTraceStart("exceptions",{user_id:m.core.options.account,trace_id:null===(a=m.socket)||void 0===a?void 0:a.sessionId,start_time:E,action:2,exception_service:6});var h=get(t,"data.disconnect_reason")||"",g=408===t.code?"Send failed due to timeout":"Send failed. Reason unknown";return g=415===t.code?Vn({disconnect_reason:h}):g,m.reporter.reportTraceUpdateV2("exceptions",{code:t.code||415,description:g,operation_type:1,target:S.SID+"-"+S.CID,context:""+S.SER},{asyncParams:uu.net.getNetworkStatus()}),m.reporter.reportTraceEnd("exceptions",1),$i.reject(t)}))},t.onMessage=function onMessage(t){var a=parseCmd(t,this.logger);if(a&&a.length>0){var u=a[0],m=u.raw.ser;u.error&&this.logger.error("core:onMessage packet error",u.raw.sid+"_"+u.raw.cid+", ser:"+m+",",u.error),"heartbeat"!==u.cmd&&(this.logger.getDebugMode()?this.logger.debug("imsocket::recvCmd ser:"+m,u.cmd,u.content):this.logger.log("imsocket::recvCmd ser:"+m,u.cmd));for(var h,g=_createForOfIteratorHelperLoose$b(a);!(h=g()).done;){var M=h.value;this.packetHandler(M)}}},t.packetHandler=function packetHandler(t){var a,u,m,h,g=this;if(t){var M=t.raw.ser,I=this.sendingCmdMap.get(M);if(I&&I.cmd===t.cmd){var S=I.callback,T=I.timer,C=I.params;if(clearTimeout(T),t.params=C,this.sendingCmdMap.delete(M),"heartbeat"===t.cmd)return void S[0]();var b=null===(u=null===(a=this.core[t.service])||void 0===a?void 0:a.process)||void 0===u?void 0:u.call(a,t);b&&"function"==typeof b.then?b.then((function(t){S[0](t)})).catch((function(t){S[1](t)})):(this.logger.log("imsocket:: handlerFn without promise",t.service,t.cmd),S[0]())}else{var E=null===(h=null===(m=this.core[t.service])||void 0===m?void 0:m.process)||void 0===h?void 0:h.call(m,t);E&&"function"==typeof E.then&&E.catch((function(t){g.logger.error("imsocket::no obj cache, no process handler",t)}))}}},t.markCmdInvalid=function markCmdInvalid(t,a,u){var m=this.sendingCmdMap.get(t);if(m){var h=m.callback,g=m.timer;g&&clearTimeout(g),this.sendingCmdMap.delete(t),this.logger.warn("packet "+t+", "+u+" is invalid:",a),h[1](a)}},t.markAllCmdInvaild=function markAllCmdInvaild(t){var a,u=this;this.logger.log("markAllCmdInvaild",t),forEach$1(a=this.sendingCmdMap).call(a,(function(a){var m=a.callback,h=a.timer,g=a.cmd;u.logger.log('markAllCmdInvaild:: cmd "'+g+'"'),h&&clearTimeout(h),m[1](t)})),this.sendingCmdMap.clear()},t.ping=function ping(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a=this;return lu.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(sp.OFFLINE,"PingError"),u.abrupt("return");case 18:this.pingTimer=po((function(){a.ping()}),3e4);case 19:case"end":return u.stop()}}),_callee4,this,[[1,6]])})))},t.testHeartBeat5Timeout=function testHeartBeat5Timeout(){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var t;return lu.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:clearTimeout(this.pingTimer),t=0;case 2:if(!(t<5)){a.next=15;break}return a.prev=3,a.next=6,this.sendCmd("heartbeat",{},{timeout:3e3});case 6:return a.abrupt("return",!1);case 9:a.prev=9,a.t0=a.catch(3),this.logger.log("clientsocketV1:: test heartbeat "+t+" Timeout");case 12:t++,a.next=2;break;case 15:return a.abrupt("return",!0);case 16:case"end":return a.stop()}}),_callee5,this,[[3,9]])})))},t.initOnlineListener=function initOnlineListener(){var t=this;this.hasNetworkListener||(this.logger.log("clientsocketV1::onlineListener:init"),this.hasNetworkListener=!0,uu.net.onNetworkStatusChange((function(a){t.logger.log("clientsocketV1::onlineListener:network change",a),a.isConnected&&"logined"===t.core.status?t.ping():a.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)}))):a.isConnected||t.doDisconnect(sp.OFFLINE,"OfflineListener")})))},t.destroyOnlineListener=function destroyOnlineListener(){this.logger.log("clientsocketV1::onlineListener:destroy"),uu.net.offNetworkStatusChange(),this.hasNetworkListener=!1},t.disconnect=function disconnect(){switch(this.core.status){case"connected":case"logined":case"connecting":case"waitReconnect":return this.doDisconnect(sp.ACTIVE,"UserActiveDisconnect"),$i.resolve();default:return $i.resolve()}},V1ClientSocket}(),mp=function(){function V1NIMLoginLbs(t){this.socketLinkUrls=[],this.timer=0,this.failedCount=0,this.core=t,this.auth=t.V1NIMLoginService,this.logger=this.core.logger}var t=V1NIMLoginLbs.prototype;return t.getLbsInfos=function getLbsInfos(){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var t,a,u,m;return lu.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:if(!(this.socketLinkUrls.length>0)){h.next=5;break}return t=this.socketLinkUrls,this.socketLinkUrls=[],this.core.logger.log("V1NIMLoginService::getLbsInfos:use cache link",t),h.abrupt("return",$i.resolve(t));case 5:return this.core.reporterHookLBS.start(this.core.account),a=uniq(this.auth.config.lbsUrls),h.prev=7,h.next=10,this.ladderLoad(a);case 10:if(200===(u=h.sent).status&&u.data){h.next=14;break}throw this.core.logger.error("V1NIMLoginService::getLbsInfos:error status",u.status,u),new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"V1NIMLoginService::getLbsInfos failed, status "+u.status}});case 14:this.success(u),h.next=25;break;case 17:if(h.prev=17,h.t0=h.catch(7),m=h.t0,this.core.logger.error("V1NIMLoginService::lbs getLbsInfos error, use default link: "+this.auth.config.linkUrl+". error:",h.t0),this.reportForFail(a[0],m.code,m.message),!this.checkTerminator(m.code)){h.next=24;break}throw h.t0;case 24:this.socketLinkUrls=[this.auth.config.linkUrl];case 25:return h.abrupt("return",this.socketLinkUrls);case 26:case"end":return h.stop()}}),_callee,this,[[7,17]])})))},t.checkTerminator=function checkTerminator(t){return t===jl.V2NIM_ERROR_CODE_CANCELLED||t===jl.V2NIM_ERROR_CODE_TIMEOUT},t.generateUrl=function generateUrl(t){return(t=this.processLbsUrl(t))+(indexOf(t).call(t,"?")>-1?"&":"?")+"k="+this.core.options.appkey+"&id="+this.core.auth.getLoginUser()+"&sv=180&pv=1&networkType=0&lv=1"},t.processLbsUrl=function processLbsUrl(t){return pendingIsMiniappEnv()?t.replace("/webconf","/wxwebconf"):t},t.requstLbs=function requstLbs(t){return this.auth.doLoginStepsManager.add(this.core.adapters.request(this.generateUrl(t),{method:"GET",dataType:"json",timeout:8e3}))},t.setLadderTimer=function setLadderTimer(t,a,u,m){var h=this;this.timer&&clearTimeout(this.timer);var g=t[a];this.timer=po((function(){g&&(h.setLadderTimer(t,a+1,u,m),h.core.logger.log("V1NIMLoginService::getLbsInfos "+a+":",h.processLbsUrl(g)),h.reportForLbsStart(g,a),h.requstLbs(g).then((function(t){h.reset(),u(Ut(Ut({},t),{url:g}))})).catch((function(u){var M;if(h.core.logger.warn("V1NIMLoginService::getLbsInfos "+a+" failed:",u),h.failedCount+=1,h.reportForFailOnce(g,u.code,(null===(M=u.detail)||void 0===M?void 0:M.reason)||u.message),h.failedCount>=t.length||h.checkTerminator(u.code))return h.reset(),void m(u)})))}),2e3)},t.ladderLoad=function ladderLoad(t){var a=this;return new $i((function(u,m){t.length>1&&a.setLadderTimer(t,1,u,m);var h=t[0];a.core.logger.log("V1NIMLoginService::getLbsInfos 0:",h),a.reportForLbsStart(h,0),a.requstLbs(h).then((function(t){a.reset(),u(Ut(Ut({},t),{url:h}))})).catch((function(u){var g;a.failedCount+=1,a.core.logger.warn("V1NIMLoginService::getLbsInfos 0 failed:",u),a.reportForFailOnce(h,u.code,(null===(g=u.detail)||void 0===g?void 0:g.reason)||u.message),(a.failedCount>=t.length||a.checkTerminator(u.code))&&(a.reset(),m(u))}))}))},t.success=function success(t){var a,u,m,h,g=t.data,M=[this.auth.config.linkUrl];get(g,"common.link")&&(M=concat(h=get(g,"common.link")).call(h,M));get(g,'common["link.default"]')&&(M=concat(M).call(M,get(g,'common["link.default"]'))),this.socketLinkUrls=M,g["nos-chunk"]&&(this.logger.log("getLbsInfos success. lbs.nos-chunk",g["nos-chunk"]),null===(u=this.core.cloudStorage)||void 0===u||u.setOptions({chunkUploadHost:g["nos-chunk"]})),Un(g.nosup)&&g.nosup.length>0&&(this.logger.log("getLbsInfos success. lbs.nosup",g.nosup),null===(m=this.core.cloudStorage)||void 0===m||m.setOptions({commonUploadHostBackupList:g.nosup,commonUploadHost:g.nosup[0]})),this.core.logger.log("V1NIMLoginService::getLbsInfos success, socket link:",slice(a=this.socketLinkUrls).call(a,0),"chunkUploadHost: ",t.data["nos-chunk"]),this.reportForLbsSuccess(t.url,t.data)},t.reportForLbsStart=function reportForLbsStart(t,a){this.core.reporterHookLBS.updateBegin({target:t,index:a})},t.reportForLbsSuccess=function reportForLbsSuccess(t,a){this.core.reporterHookLBS.updateComplete({target:t,code:200,body:Vn(a)}),this.core.reporterHookLBS.end(!0),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"HTTP",target:t,code:200,succeed:!0},{asyncParams:uu.net.getNetworkStatus()})},t.reportForFailOnce=function reportForFailOnce(t,a,u){this.core.reporterHookLBS.updateComplete({target:t,code:a,body:u})},t.reportForFail=function reportForFail(t,a,u){this.core.reporterHookLBS.end(!1),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"HTTP",target:t,description:u,code:a,succeed:!1},{asyncParams:uu.net.getNetworkStatus()})},t.reset=function reset(){this.socketLinkUrls=[],this.failedCount=0,clearTimeout(this.timer)},V1NIMLoginLbs}(),hp=function(){function V1NIMLoginAuthenticator(t){this.core=t}var t=V1NIMLoginAuthenticator.prototype;return t.verifyAuthentication=function verifyAuthentication(t){var a,u,m;return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,lu.mark((function _callee(){var h,g,M,I,S,T,C,b,E,k,R,A;return lu.wrap((function _callee$(w){for(;;)switch(w.prev=w.next){case 0:return g=this.core.options,M=uu.getSystemInfo(),I=Ut(Ut({},g),{appLogin:t?0:1,appkey:g.appkey,account:g.account,token:g.token,deviceId:this.core.auth.deviceId,clientSession:this.core.auth.clientSession,clientType:16,protocolVersion:1,sdkVersion:100941,sdkHumanVersion:"10.9.41",os:M.os,browser:M.browser,userAgent:this.core.options.loginSDKTypeParamCompat?"Native/10.9.41":slice(h=M.userAgent.replace("{{appkey}}",g.appkey)).call(h,0,299),libEnv:this.core.options.loginSDKTypeParamCompat?void 0:M.libEnv,hostEnv:this.core.options.loginSDKTypeParamCompat?0:M.hostEnvEnum}),S=M.os.toLowerCase(),"UNIAPP"!==uu.platform||"ios"!==S&&"android"!==S||(I.isReactNative=1,I.clientType="ios"===S?2:1,T=!!(null===(a=this.core.offlinePush.authConfig)||void 0===a?void 0:a.honorCertificateName),M.pushDeviceInfo&&M.pushDeviceInfo.MANUFACTURER&&(I.deviceInfo=Vn(Ut({IS_SUPPORT_HONOR:T},M.pushDeviceInfo)))),this.core.logger.log("clientSocketV1::do login,accid:"+g.account+";clientSession:"+(null===(m=null===(u=this.core.clientSocket)||void 0===u?void 0:u.socket)||void 0===m?void 0:m.sessionId)),w.next=8,this.core.clientSocket.sendCmd("login",{login:I});case 8:if(!(C=w.sent).error){w.next=11;break}throw C.error;case 11:return b=C.content,E=b.loginRes,k=b.loginPorts,R=b.aosPushInfo,A=formatMultiPortLoginInfo(k,2),(A=filter(A).call(A,(function(t){return t.connectionId!==E.connectionId}))).length>0&&this.core.emit("multiPortLogin",A),w.abrupt("return",Ut(Ut({},E),{aosPushInfo:R}));case 16:case"end":return w.stop()}}),_callee,this)})))},t.checkLoginTerminalCode=function checkLoginTerminalCode(t){if(void 0===t)return!1;var a=[201,302,317,403,404,417,422];return includes(a).call(a,t)},V1NIMLoginAuthenticator}(),gp=function(t){function V2Service(a,u){var m;return(m=t.call(this)||this).name=a,m.logger=u.logger,m.core=u,m}wt(V2Service,t);var a=V2Service.prototype;return a.checkV2=function checkV2(){var t=this.core.options.apiVersion;if("v2"===t)return!0;throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:'The version "'+t+'" of client is not supported.'}})},a.checkLogin=function checkLogin(){if(0===this.core.V2NIMLoginService.getLoginStatus())throw new Wl({code:jl.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:"Client logout."}})},a.emit=function emit(a){for(var u=this,m=arguments.length,h=new Array(m>1?m-1:0),g=1;g<m;g++)h[g-1]=arguments[g];this.logger.debug(this.name+"::emit event: '"+a.toString()+"',",void 0!==h[0]?h[0]:"",void 0!==h[1]?h[1]:"",void 0!==h[2]?h[2]:"");try{var M,I,S=(M=t.prototype.emit).call.apply(M,concat(I=[this,a]).call(I,h));return S}catch(t){return po((function(){throw u.logger.error(u.name+"::emit throw error in setTimeout. event: "+a.toString()+". Error",t),t}),0),!1}},a.process=function process(t){var a=this[t.cmd+"Handler"],u=this.handler&&this.handler[t.cmd+"Handler"];if("function"==typeof a||"function"==typeof u){if(t.error)return this.logger.error(t.cmd+"::recvError",t.error),$i.reject(t.error);try{var m=a?a.call(this,t):u.call(this.handler,t);return $i.resolve(m)}catch(t){return $i.reject(t)}}var h=get(t,"error.detail.ignore");return t.error&&!h?$i.reject(t.error):$i.resolve(t)},V2Service}(mo),vp=function(){function Service(t,a){this.name=t,this.core=a,this.name=t,this.logger=a.logger,this.core=a}return Service.prototype.process=function process(t){var a=this[t.cmd+"Handler"];if("function"==typeof a)return a.call(this,t);var u=get(t,"error.detail.ignore");return t.error&&!u?$i.reject(t.error):$i.resolve(t)},Service}(),fp={"6_3":"notifylog","6_4":"uploadLog","6_23":"getServerTime","6_31":"notifyDetect","6_32":"uploadDetect","6_37":"wsDetect"},yp={type:1,params:2,result:3,t1:100,t2:101,t3:102,t4:103,t5:104,t6:105},Mp={k1:1,k2:2,k3:3,k4:4,k5:5,k6:6,k7:7,k8:8,k9:9,k10:10},Ip={notifylog:{sid:6,cid:3,service:"misc"},uploadLog:{sid:6,cid:4,service:"misc",hasPacketResponse:!1,params:[{type:"String",name:"url"},{type:"Property",name:"data",reflectMapper:{type:1,content:2}}]},getServerTime:{sid:6,cid:23,service:"misc",response:[{type:"Long",name:"time"}]},notifyDetect:{sid:6,cid:31,service:"misc",response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(yp)}]},uploadDetect:{sid:6,cid:32,service:"misc",hasPacketResponse:!1,params:[{type:"Property",name:"data",reflectMapper:yp}]},wsDetect:{sid:6,cid:37,service:"misc",params:[{type:"Property",name:"tag",reflectMapper:Mp}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Mp)}]}},_p={type:{type:"number"},t1:{type:"number"},t2:{type:"number"},t3:{type:"number"},t4:{type:"number"},t5:{type:"number"},t6:{type:"number"}};var Sp=function(t){function MiscService(a){var u;return(u=t.call(this,"misc",a)||this).logLock=!1,u.core=a,registerParser({cmdMap:fp,cmdConfig:Ip}),u.setListener(),u}wt(MiscService,t);var a=MiscService.prototype;return a.setListener=function setListener(){var t,a=this;this.core.eventBus.on("BinaryClientSocket/unpackError",bind$1(t=this.wsDetect).call(t,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(){a.core.timeOrigin.setOriginTimetick()})),this.core.eventBus.on("logined",(function(){a.core.timeOrigin.setOriginTimetick()}))},a.getServerTime=function getServerTime(){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var t;return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.core.clientSocket.sendCmd("getServerTime");case 2:return t=a.sent,a.abrupt("return",Bu(t.content.time));case 4:case"end":return a.stop()}}),_callee,this)})))},a.wsDetect=function wsDetect(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h;return lu.wrap((function _callee2$(g){for(;;)switch(g.prev=g.next){case 0:return a=Ut({k1:"val1",k2:"val2"},t),u=null,g.prev=2,g.next=5,this.core.clientSocket.sendCmd("wsDetect",{tag:a});case 5:m=g.sent,u=m.content.data,g.next=14;break;case 9:return g.prev=9,g.t0=g.catch(2),(h=g.t0).code===jl.V2NIM_ERROR_CODE_UNPACK_ERROR?(this.logger.warn("misc::wsDetect:998"),this.wsDetectUnreliable(),this.reportBinarySocketDetectResult("packet 998")):this.logger.warn("misc::wsDetect:failed "+h.code),g.abrupt("return");case 14:u&&Vn(u)!==Vn(a)?(this.logger.warn("misc::wsDetect:content unreliable"),this.wsDetectUnreliable(),this.reportBinarySocketDetectResult("content unreliable")):this.logger.log("misc::wsDetect:success");case 15:case"end":return g.stop()}}),_callee2,this,[[2,9]])})))},a.wsDetectUnreliable=function wsDetectUnreliable(){this.core.clientSocket.doDisconnect(3,"WSDetectUnreliable")},a.reportBinarySocketDetectResult=function reportBinarySocketDetectResult(t){var a;this.core.reporter.reportTraceStart("exceptions",{user_id:this.core.account,trace_id:null===(a=this.core.clientSocket.socket)||void 0===a?void 0:a.sessionId,start_time:eo(),action:2,exception_service:9}),this.core.reporter.reportTraceUpdateV2("exceptions",{code:998,description:"wsDetect::reconnect cause: "+t,operation_type:"5",target:"6-37"}),this.core.reporter.reportTraceEnd("exceptions",1)},a.notifyDetectHandler=function notifyDetectHandler(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return m=t.content.data,(a=format(_p,m)).t3=t.__receiveTimeNode.time,a.t4=eo(),u.prev=3,u.next=6,this.core.clientSocket.sendCmd("uploadDetect",{data:a});case 6:u.next=11;break;case 8:u.prev=8,u.t0=u.catch(3),this.core.logger.warn("misc::notifyDetectHandler:upload failed",u.t0);case 11:case"end":return u.stop()}var m}),_callee3,this,[[3,8]])})))},a.notifylogHandler=function notifylogHandler(){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var t,a,u;return lu.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:if(t=void 0,!this.logLock){m.next=4;break}return this.core.logger.warn("misc::notifylogHandler:locked"),m.abrupt("return");case 4:return this.logLock=!0,m.prev=5,m.next=8,this.core.logger.extractLogs();case 8:t=m.sent,m.next=15;break;case 11:return m.prev=11,m.t0=m.catch(5),this.logLock=!1,m.abrupt("return");case 15:if(t){m.next=18;break}return this.logLock=!1,m.abrupt("return");case 18:return a="",m.prev=19,m.next=22,this.core.cloudStorage.uploadFile("string"==typeof t?{type:"file",filePath:t}:{type:"file",file:t});case 22:u=m.sent,a=u.url,m.next=30;break;case 26:return m.prev=26,m.t1=m.catch(19),this.logLock=!1,m.abrupt("return");case 30:if(a){m.next=33;break}return this.logLock=!1,m.abrupt("return");case 33:return a+=(indexOf(a).call(a,"?")>0?"&":"?")+"download="+(new Date).getTime()+"_web.log",m.prev=34,m.next=37,this.core.clientSocket.sendCmd("uploadLog",{url:a});case 37:m.next=43;break;case 39:return m.prev=39,m.t2=m.catch(34),this.logLock=!1,m.abrupt("return");case 43:return m.prev=43,m.next=46,this.logger.afterUpload();case 46:m.next=50;break;case 48:m.prev=48,m.t3=m.catch(43);case 50:this.logLock=!1;case 51:case"end":return m.stop()}}),_callee4,this,[[5,11],[19,26],[34,39],[43,48]])})))},MiscService}(vp),Tp={needReconnect:!0,reconnectionAttempts:Nt,lbsUrls:$u,linkUrl:ju,xhrConnectTimeout:8e3,socketConnectTimeout:8e3,linkSSL:!0},Cp=function(t){function V1NIMLoginServiceImpl(a,u){var m;(m=t.call(this,"V1NIMLoginService",a)||this).account="",m.token="",m.deviceId="",m.processId="",m.clientSession="",m.status="unconnected",m.config=Tp,m.isManualLoginAttempt=!1,m.core._registerDep(Sp,"misc"),registerParser({cmdMap:Xd,cmdConfig:tp}),a.V1NIMLoginService=Qe(m),u&&m.setOptions(u);var h=new pp(m.core,Qe(m));return m.clientSocket=h,"v1"===m.core.options.apiVersion&&(m.core.clientSocket=h,m.core.auth=Qe(m)),m.lbs=new mp(a),m.authenticator=new hp(a),m.doLoginStepsManager=new Yu,m}wt(V1NIMLoginServiceImpl,t);var a=V1NIMLoginServiceImpl.prototype;return a.reset=function reset(){this.lbs.reset()},a.setOptions=function setOptions(t){var a,u,m;t&&Gt(t).length>0?(this.config=assignOptions(this.config,t),this.account=t.account||this.core.options.account,this.token=t.token||this.core.options.token,this.core.options=Ut(Ut({},this.core.options),this.config)):(this.config=assignOptions(this.core.options,this.config),this.account=this.core.options.account,this.token=this.core.options.token),null===(u=null===(a=this.core.clientSocket)||void 0===a?void 0:a.setLinkSSL)||void 0===u||u.call(a,null===(m=this.config.linkSSL)||void 0===m||m);var h="",g="";this.config.isFixedDeviceId?(h=uu.localStorage.getItem("__NIM_DEVC_ID__")||Gu(),g=uu.localStorage.getItem("__NIM_CLIENT_SESSION_ID__")||Gu(),uu.localStorage.setItem("__NIM_DEVC_ID__",h),uu.localStorage.setItem("__NIM_CLIENT_SESSION_ID__",g)):(h=Gu(),g=Gu()),this.deviceId=h,this.clientSession=g,this.core.reporter.setConfig({common:{dev_id:h}})},a.connect=function connect(t){return void 0===t&&(t={}),this.login(t)},a.login=function login(t){return void 0===t&&(t={}),__awaiter(this,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return this._checkApiVersion(),t.isAutoReconnect||(this.isManualLoginAttempt=!0,this.processId=Gu()),a.next=4,this._connect(t);case 4:return this.core.abtest.abtRequest(),a.prev=5,a.next=8,this.doLogin(t.isAutoReconnect);case 8:this.processId=Gu(),this.isManualLoginAttempt=!1,a.next=16;break;case 12:throw a.prev=12,a.t0=a.catch(5),this.isManualLoginAttempt=!1,a.t0;case 16:case"end":return a.stop()}}),_callee,this,[[5,12]])})))},a._connect=function _connect(t){return void 0===t&&(t={}),__awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h=this;return lu.wrap((function _callee2$(g){for(;;)switch(g.prev=g.next){case 0:if(/^(unconnected|waitReconnect)$/.test(this.core.status)){g.next=4;break}return a="NIM status is "+this.core.status+", and would not connect",this.logger.warn(a),g.abrupt("return",$i.reject(a));case 4:return this.clientSocket.beforeConnect(),this.core.reporter.reportTraceCancel("login"),this.core.reporter.reportTraceStart("login",{user_id:this.core.options.account,action:t.isAutoReconnect?"auto_login":"manual_login",binary_websocket:!1,process_id:this.processId}),this.core.reporter.reportTraceUpdateV2("login",{code:0,description:Vn(Ut(Ut({},this.core.options),{account:"***",token:"***"})),operation_type:"conf_init",succeed:!0,duration:0,target:""},{asyncParams:uu.net.getNetworkStatus()}),g.next=10,this.lbs.getLbsInfos();case 10:return u=g.sent,g.prev=11,g.next=14,this.clientSocket.connect({linkUrls:u,isAutoReconnect:t.isAutoReconnect},(function(t,a){h.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:a,code:t.code||408,description:"ws_handshake_failed:"+t.message,succeed:!1},{asyncParams:uu.net.getNetworkStatus()})}));case 14:(m=g.sent)&&this.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:m,code:200,succeed:!0},{asyncParams:uu.net.getNetworkStatus()}),g.next=22;break;case 18:throw g.prev=18,g.t0=g.catch(11),this.core.reporter.reportTraceEnd("login",!1),g.t0;case 22:case"end":return g.stop()}}),_callee2,this,[[11,18]])})))},a.doLogin=function doLogin(t){return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m,h,g;return lu.wrap((function _callee3$(M){for(;;)switch(M.prev=M.next){case 0:return M.prev=0,M.next=3,this.authenticator.verifyAuthentication(t);case 3:a=M.sent,this.core.reporter.reportTraceUpdateV2("login",{operation_type:"protocol",target:"2-3",code:200,succeed:!0},{asyncParams:uu.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("login",!0),this.core.status="logined",M.next=21;break;case 9:if(M.prev=9,M.t0=M.catch(0),u=M.t0,m=get(u,"data.disconnect_reason")||"",h=415===u.code?Vn({disconnect_reason:m}):u.message,this.core.logger.warn("nim login:: login failed",M.t0),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"protocol",target:"2-3",code:u.code||0,succeed:!1,description:h},{asyncParams:uu.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("login",!1),this.clientSocket.doDisconnect(sp.OFFLINE,this.isManualLoginAttempt?"FailedToInitializeLogin":"ReconnectLoginFailed",M.t0),!this.isManualLoginAttempt){M.next=20;break}throw M.t0;case 20:return M.abrupt("return");case 21:return M.prev=21,g=a.loginTime?Bu(a.loginTime):eo(),M.next=25,this.core.cloudStorage.init(g);case 25:M.next=30;break;case 27:M.prev=27,M.t1=M.catch(21),this.core.logger.error("NIM:login cloudStorage init failed ",M.t1);case 30:this.core.eventBus.emit("logined",a),this.core.emit("logined",a),this.emit("logined",a),this.core.logger.log("login done"),this.clientSocket.resetConnectStatus(),this.clientSocket.ping();case 36:case"end":return M.stop()}}),_callee3,this,[[0,9],[21,27]])})))},a.disconnect=function disconnect(){return this.logout()},a.logout=function logout(){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.wrap((function _callee4$(t){for(;;)switch(t.prev=t.next){case 0:this._checkApiVersion(),this.doLoginStepsManager.clear(),t.t0=this.status,t.next="logined"===t.t0?5:"connected"===t.t0||"connecting"===t.t0||"waitReconnect"===t.t0?18:"unconnected"===t.t0||"destroyed"===t.t0?21:22;break;case 5:return t.prev=5,t.next=8,this.clientSocket.sendCmd("logout",void 0,{timeout:1e3});case 8:this.clientSocket.doDisconnect(sp.ACTIVE,"UserActiveDisconnect"),this.core._clearModuleData(),t.next=17;break;case 12:t.prev=12,t.t1=t.catch(5),this.logger.error("Instance::disconnect sendCmd:logout error",t.t1),this.clientSocket.doDisconnect(sp.ACTIVE,"UserActiveDisconnect"),this.core._clearModuleData();case 17:return t.abrupt("break",22);case 18:return this.clientSocket.doDisconnect(sp.ACTIVE,"UserActiveDisconnect"),this.core._clearModuleData(),t.abrupt("return",$i.resolve());case 21:return t.abrupt("return",$i.resolve());case 22:case"end":return t.stop()}}),_callee4,this,[[5,12]])})))},a.kick=function kick(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var u;return lu.wrap((function _callee5$(m){for(;;)switch(m.prev=m.next){case 0:return this._checkApiVersion(),m.next=3,this.clientSocket.sendCmd("kick",t);case 3:return u=m.sent,m.abrupt("return",null===(a=u.content)||void 0===a?void 0:a.deviceIds);case 5:case"end":return m.stop()}}),_callee5,this)})))},a._checkApiVersion=function _checkApiVersion(){if("v1"!==this.core.options.apiVersion)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:'apiVersion is not "v1"'}})},a.nimLoginClientChangeHandler=function nimLoginClientChangeHandler(t){if(t.error)this.logger.error("nimLoginClientChangeHandler:: error, ",t.error);else{var a=t.content,u=formatMultiPortLoginInfo(a.datas,a.state);u.length>0&&(this.core.emit("multiPortLogin",u),this.emit("multiPortLogin",u))}},a.kickedHandler=function kickedHandler(t){if(t.error)this.logger.error("kickedHandler:: error, ",t.error);else{var a=function formatBeKickedTag$1(t){var a=format({clientType:{type:"enum",values:Yd},customClientType:{type:"number"}},t),u=ip[a.reason];return Ut(a,u=u||{reason:"unknow",message:"Unknown reason"})}(t.content);this.logger.warn("kicked::",a),this.clientSocket.doDisconnect(sp.KICKED,a),this.core._clearModuleData()}},a.getConnectStatus=function getConnectStatus(){switch(this.core.status){case"unconnected":case"destroyed":default:return 0;case"connecting":return 2;case"connected":case"logined":return 1;case"waitReconnect":return 3}},a.getLoginStatus=function getLoginStatus(){switch(this.core.status){case"unconnected":case"destroyed":case"waitReconnect":default:return 0;case"connecting":case"connected":return 2;case"logined":return 1}},a.getLoginUser=function getLoginUser(){return this.core.options.account},a.emit=function emit(a){for(var u,m,h,g,M=this.name+"::emit "+a.toString(),I=arguments.length,S=new Array(I>1?I-1:0),T=1;T<I;T++)S[T-1]=arguments[T];return(u=this.logger).log.apply(u,concat(m=[""+M]).call(m,S)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,S))},V1NIMLoginServiceImpl}(gp);function formatLoginInfo(t){return format({type:{type:"number"},port:{type:"number"},customClientType:{type:"number"},timestamp:{type:"number"},loginType:{type:"number"}},t)}var bp={"26_3":"v2Login","26_5":"v2Logout","26_8":"v2KickOffline","26_9":"v2BeKicked","26_10":"v2LoginClientChange","36_1":"v2GetChatroomLinkAddress"},Ep={"1_2":"heartbeat","2_7":"nimLoginClientChange","24_8":"qchatLoginClientChange"},kp={webLoginReqTag:{clientType:3,os:4,sdkVersion:6,appLogin:8,protocolVersion:9,pushTokenName:10,pushToken:11,clientId:13,appkey:18,account:19,browser:24,clientSession:26,deviceInfo:32,isReactNative:112,customTag:38,customClientType:39,sdkHumanVersion:40,hostEnv:41,userAgent:42,libEnv:44,authType:115,thirdPartyExtension:116,env:119,isRoutable:120,token:1e3},mixAuthRepTag:{clientId:1,consid:2,clientIP:3,port:4,type:5,customClientType:6,timestamp:7,customTag:8,os:9,pushType:10,hasTokenPreviously:11,loginType:12},nimAuthRepTag:{type:3,os:4,mac:5,clientId:13,account:19,deviceInfo:32,customTag:38,customClientType:39,consid:102,clientIP:103,port:104,timestamp:109,pushType:110,hasTokenPreviously:111},qchatAuthRepTag:{clientId:8,consid:102,clientIP:103,port:104,type:6,customClientType:13,timestamp:105,os:30,pushType:100,hasTokenPreviously:101}},Rp={v2Login:{sid:26,cid:3,service:"auth",params:[{type:"Property",name:"tag",reflectMapper:kp.webLoginReqTag}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(kp.mixAuthRepTag)},{type:"PropertyArray",name:"loginClients",reflectMapper:invertSerializeItem(kp.mixAuthRepTag)}]},v2Logout:{sid:26,cid:5,service:"auth"},v2KickOffline:{sid:26,cid:8,service:"auth",params:[{type:"StrArray",name:"clientIds"}],response:[{type:"StrArray",name:"clientIds"}]},v2BeKicked:{sid:26,cid:9,service:"auth",response:[{type:"Int",name:"clientType"},{type:"Int",name:"reason"},{type:"String",name:"reasonDesc"},{type:"Int",name:"customClientType"}]},v2LoginClientChange:{sid:26,cid:10,service:"auth",response:[{type:"Byte",name:"state"},{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(kp.mixAuthRepTag)}]},v2GetChatroomLinkAddress:{sid:36,cid:1,service:"auth",params:[{type:"Long",name:"roomId"},{type:"Bool",name:"miniProgram"}],response:[{type:"StrArray",name:"linkAddress"}]}},Ap={heartbeat:{sid:1,cid:2,service:"auth"},nimLoginClientChange:{sid:2,cid:7,service:"auth",response:[{type:"Byte",name:"state"},{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(kp.nimAuthRepTag)}]},qchatLoginClientChange:{sid:24,cid:8,service:"auth",response:[{type:"Byte",name:"state"},{type:"Property",name:"data",reflectMapper:invertSerializeItem(kp.qchatAuthRepTag)}]}},wp=qi.codeAt;_export({target:"String",proto:!0},{codePointAt:function codePointAt(t){return wp(this,t)}});var Np=entryVirtual("String").codePointAt,xp=String.prototype,codePointAt=function(t){var a=t.codePointAt;return"string"==typeof t||t===xp||$(xp,t)&&a===xp.codePointAt?Np:a},Op=RangeError,Pp=String.fromCharCode,Lp=String.fromCodePoint,Vp=R([].join),Up=!!Lp&&1!=Lp.length;_export({target:"String",stat:!0,arity:1,forced:Up},{fromCodePoint:function fromCodePoint(t){for(var a,u=[],m=arguments.length,h=0;m>h;){if(a=+arguments[h++],toAbsoluteIndex(a,1114111)!==a)throw Op(a+" is not a valid code point");u[h]=a<65536?Pp(a):Pp(55296+((a-=65536)>>10),a%1024+56320)}return Vp(u,"")}});var Dp=j.String.fromCodePoint,qp=function abs(t){var a;if(void 0!==t)return(a=BigNumber(t)).sign=1,a},Bp=function isArray(t){return"[object Array]"===Object.prototype.toString.call(t)},Fp=function isValidType(t){var a;return some(a=["number"==typeof t,"string"==typeof t&&t.length>0,Bp(t)&&t.length>0,t instanceof BigNumber]).call(a,(function(t){return!0===t}))},Gp="Invalid Number",Hp="Invalid Number - Division By Zero";function BigNumber(t){var a;if(!(this instanceof BigNumber))return new BigNumber(t);if(this.number=[],this.sign=1,this.rest=0,Fp(t)){if(Bp(t)){for((t.length&&"-"===t[0]||"+"===t[0])&&(this.sign="+"===t[0]?1:-1,t.shift(0)),a=t.length-1;a>=0;a--)if(!this.addDigit(t[a]))return}else for("-"!==(t=t.toString()).charAt(0)&&"+"!==t.charAt(0)||(this.sign="+"===t.charAt(0)?1:-1,t=t.substring(1)),a=t.length-1;a>=0;a--)if(!this.addDigit(Bu(t.charAt(a),10)))return}else this.number=Gp}BigNumber.prototype.addDigit=function(t){return function testDigit(t){return/^\d$/.test(t)}(t)?(this.number.push(t),this):(this.number=Gp,!1)},BigNumber.prototype._compare=function(t){var a,u;if(!Fp(t))return null;if(a=BigNumber(t),this.sign!==a.sign)return this.sign;if(this.number.length>a.number.length)return this.sign;if(this.number.length<a.number.length)return-1*this.sign;for(u=this.number.length-1;u>=0;u--){if(this.number[u]>a.number[u])return this.sign;if(this.number[u]<a.number[u])return-1*this.sign}return 0},BigNumber.prototype.gt=function(t){return this._compare(t)>0},BigNumber.prototype.gte=function(t){return this._compare(t)>=0},BigNumber.prototype.equals=function(t){return 0===this._compare(t)},BigNumber.prototype.lte=function(t){return this._compare(t)<=0},BigNumber.prototype.lt=function(t){return this._compare(t)<0},BigNumber.prototype.subtract=function(t){var a;return void 0===t?this:(a=BigNumber(t),this.sign!==a.sign?(this.number=BigNumber._add(this,a),this):(this.sign=this.lt(a)?-1:1,this.number=qp(this).lt(qp(a))?BigNumber._subtract(a,this):BigNumber._subtract(this,a),this))},BigNumber._add=function(t,a){var u,m=0,h=Math.max(t.number.length,a.number.length);for(u=0;u<h||m>0;u++)t.number[u]=(m+=(t.number[u]||0)+(a.number[u]||0))%10,m=Math.floor(m/10);return t.number},BigNumber._subtract=function(t,a){var u,m,h=0,g=t.number.length;for(u=0;u<g;u++)t.number[u]-=(a.number[u]||0)+h,t.number[u]+=10*(h=t.number[u]<0?1:0);for(u=0,g=t.number.length-1;0===t.number[g-u]&&g-u>0;)u++;u>0&&splice(m=t.number).call(m,-u);return t.number},BigNumber.prototype.multiply=function(t){if(void 0===t)return this;var a,u,m=BigNumber(t),h=0,g=[];if(this.isZero()||m.isZero())return BigNumber(0);for(this.sign*=m.sign,a=0;a<this.number.length;a++)for(h=0,u=0;u<m.number.length||h>0;u++)g[a+u]=(h+=(g[a+u]||0)+this.number[a]*(m.number[u]||0))%10,h=Math.floor(h/10);return this.number=g,this},BigNumber.prototype.divide=function(t){if(void 0===t)return this;var a,u,m=BigNumber(t),h=[],g=BigNumber(0);if(m.isZero())return this.number=Hp,this;if(this.isZero())return this.rest=BigNumber(0),this;if(this.sign*=m.sign,m.sign=1,1===m.number.length&&1===m.number[0])return this.rest=BigNumber(0),this;for(a=this.number.length-1;a>=0;a--)for(g.multiply(10),g.number[0]=this.number[a],h[a]=0;m.lte(g);)h[a]++,g.subtract(m);for(a=0,u=h.length-1;0===h[u-a]&&u-a>0;)a++;return a>0&&splice(h).call(h,-a),this.rest=g,this.number=h,this},BigNumber.prototype.mod=function(t){return this.divide(t).rest},BigNumber.prototype.isZero=function(){var t;for(t=0;t<this.number.length;t++)if(0!==this.number[t])return!1;return!0},BigNumber.prototype.toString=function(){var t,a="";if("string"==typeof this.number)return this.number;for(t=this.number.length-1;t>=0;t--)a+=this.number[t];return this.sign>0?a:"-"+a};var jp=Math.pow(2,32);function varintToBytes(t){for(var a=new Uint8Array(5),u=new DataView(a.buffer),m=0;0!=(4294967168&t);)u.setUint8(m++,127&t|128),t>>>=7;return u.setUint8(m++,127&t),slice(a).call(a,0,m)}function encodeText(t){if("function"==typeof TextEncoder)return(new TextEncoder).encode(t);var a=function textEncoder(t){for(var a=[],u=t.length,m=0;m<u;){var h=codePointAt(t).call(t,m),g=0,M=0;for(h<=127?(g=0,M=0):h<=2047?(g=6,M=192):h<=65535?(g=12,M=224):h<=2097151&&(g=18,M=240),a.push(M|h>>g),g-=6;g>=0;)a.push(128|h>>g&63),g-=6;m+=h>=65536?2:1}return a}(t);return new Uint8Array(a)}function decodeText(t){return"function"==typeof TextDecoder?new TextDecoder("utf-8").decode(t):function textDecoder(t){for(var a="",u=0;u<t.length;){var m=t[u],h=0,g=0;if(m<=127?(h=0,g=255&m):m<=223?(h=1,g=31&m):m<=239?(h=2,g=15&m):m<=244&&(h=3,g=7&m),t.length-u-h>0)for(var M=0;M<h;)g=g<<6|63&(m=t[u+M+1]),M+=1;else g=65533,h=t.length-u;a+=Dp(g),u+=h+1}return a}(t)}var $p=function(){function Unpack(t){this.offset=0,this.buffer=new Uint8Array(t),this.view=new DataView(t)}var t=Unpack.prototype;return t.checkBufferBoundaryAccess=function checkBufferBoundaryAccess(){return this.offset>=this.buffer.byteLength},t.length=function length(){var t;return(null===(t=this.view)||void 0===t?void 0:t.byteLength)||0},t.getBuffer=function getBuffer(){return this.view.buffer},t.getOffset=function getOffset(){return this.offset},t.popRaw=function popRaw(t){try{var a,u=slice(a=this.buffer).call(a,this.offset,this.offset+t);return this.offset+=t,u}catch(t){throw new Error("UnpackException raw "+(t&&t.message))}},t.popByte=function popByte(){try{var t=this.view.getUint8(this.offset);return this.offset+=1,t}catch(t){throw new Error("UnpackException byte "+(t&&t.message))}},t.popVarbin=function popVarbin(){return this.popRaw(this.popVarInt())},t.popString=function popString(){try{return decodeText(this.popVarbin())}catch(t){throw new Error("UnpackException string "+(t&&t.message))}},t.popInt=function popInt(){try{var t=this.view.getUint32(this.offset,!0);return this.offset+=4,t}catch(t){throw new Error("UnpackException int "+(t&&t.message))}},t.popVarInt=function popVarInt(){var t=1,a=0,u=0,m=0;do{if(a+=(127&(u=this.popByte()))*t,t*=128,(m+=1)>5)throw new Error("Variable length quantity is too long")}while(0!=(128&u));return a},t.popLong=function popLong(){try{var t,a=function getBigUint64(t,a){void 0===a&&(a=!1);var u=new DataView(t.buffer),m=a?[4,0]:[0,4],h=m[0],g=m[1],M=u.getUint32(h,a),I=u.getUint32(g,a);return M>0?M*jp+I:I}(slice(t=this.buffer).call(t,this.offset,this.offset+8),!0);return this.offset+=8,Number(a)}catch(t){throw new Error("UnpackException long "+(t&&t.message))}},t.popShort=function popShort(){try{var t=this.view.getUint16(this.offset,!0);return this.offset+=2,t}catch(t){throw new Error("UnpackException short "+(t&&t.message))}},t.popBoolean=function popBoolean(){return this.popByte()>0},t.toString=function toString(){return nu(new Uint8Array(this.buffer)).toString()},t.reset=function reset(){this.offset=0,this.buffer=null,this.view=null},Unpack}(),zp=function(){function PacketDecoder(t){this.packetLength=0,this.serviceId=0,this.commandId=0,this.serialId=0,this.tag=0,this.resCode=200,this.innerHeader=null,this.msgId=0,this.bodyArr=[],this.unpack=new $p(t)}var t=PacketDecoder.prototype;return t.reset=function reset(){this.innerHeader=null,this.bodyArr=[],this.unpack.reset()},t.getBodyDetail=function getBodyDetail(){return this.bodyArr.join("")},t.unmarshalHeader=function unmarshalHeader(){var t,a=this._unmarshalHeader();this.packetLength=a.packetLength,this.serviceId=a.serviceId,this.commandId=a.commandId,this.serialId=a.serialId,this.tag=a.tag,this.resCode=a.resCode,4===a.serviceId&&includes(t=[1,2,10,11]).call(t,a.commandId)&&(this.msgId=this.unmarshalLong(),this.innerHeader=this._unmarshalHeader())},t._unmarshalHeader=function _unmarshalHeader(){var t=this.unpack.popVarInt(),a=this.unpack.popByte(),u=this.unpack.popByte(),m=this.unpack.popShort(),h=this.unpack.popByte(),g=200;return this.hasRescode(h)&&(g=this.unpack.popShort()),{packetLength:t,serviceId:a,commandId:u,serialId:m,tag:h,resCode:g}},t.hasRescode=function hasRescode(t){return 0!=((t=t||this.tag)&PacketDecoder.RES_CODE)},t.getHeader=function getHeader(){return{packetLength:this.packetLength,sid:this.serviceId,cid:this.commandId,ser:this.serialId,code:this.resCode}},t.getInnerHeader=function getInnerHeader(){return this.innerHeader?{sid:this.innerHeader.serviceId,cid:this.innerHeader.commandId}:null},t.unmarshalProperty=function unmarshalProperty(){var t=this.unpack.popVarInt(),a={};this.bodyArr.push("\nProperty("+t+") {");for(var u=0;u<t;u++){var m=this.unpack.popVarInt();this.bodyArr.push(m+":");var h=this.unpack.popString();this.bodyArr.push('"'+h.length+" "+this.unpack.getOffset()+'",'),a[m]=h}return this.bodyArr.push("},"),a},t.unmarshalPropertyArray=function unmarshalPropertyArray(){var t=this.unpack.popVarInt(),a=[];this.bodyArr.push("\nPropertyArray("+t+") [");for(var u=0;u<t;u++)a.push(this.unmarshalProperty());return this.bodyArr.push("],"),a},t.unmarshalLong=function unmarshalLong(){var t=this.unpack.popLong();return this.bodyArr.push("\nLong:"+t),t},t.unmarshalLongArray=function unmarshalLongArray(){var t=this.unpack.popVarInt(),a=[];this.bodyArr.push("\nLongArray "+t+":");for(var u=0;u<t;u++){var m=this.unpack.popLong();this.bodyArr.push(m+","),a.push(m)}return a},t.unmarshalStrArray=function unmarshalStrArray(){var t=this.unpack.popVarInt(),a=[];this.bodyArr.push("\nStrArray "+t+":");for(var u=0;u<t;u++){var m=this.unpack.popString();this.bodyArr.push(m+","),a.push(m)}return a},t.unmarshalStrLongMap=function unmarshalStrLongMap(){var t=this.unpack.popVarInt(),a={};this.bodyArr.push("\nStrLongMap "+t+":");for(var u=0;u<t;u++){var m=this.unpack.popString();this.bodyArr.push(m+",");var h=this.unpack.popLong();this.bodyArr.push(h+";"),a[m]=h}return a},t.unmarshalStrStrMap=function unmarshalStrStrMap(){var t=this.unpack.popVarInt(),a={};this.bodyArr.push("\nStrStrMap "+t+":");for(var u=0;u<t;u++){var m=this.unpack.popString();this.bodyArr.push(m+",");var h=this.unpack.popString();this.bodyArr.push(h+";"),a[m]=h}return a},t.unmarshalLongLongMap=function unmarshalLongLongMap(){var t=this.unpack.popVarInt(),a={};this.bodyArr.push("\nStrLongLongMap "+t+":");for(var u=0;u<t;u++){var m=this.unpack.popLong();this.bodyArr.push(m+",");var h=this.unpack.popLong();this.bodyArr.push(h+";"),a[m]=h}return{m_map:a}},t.unmarshalKVArray=function unmarshalKVArray(){var t=this.unpack.popVarInt(),a=[];this.bodyArr.push("\nKVArray "+t+":");for(var u=0;u<t;u++)a.push(this.unmarshalStrStrMap());return a},t.unmarshal=function unmarshal(t){var a,u=this,m=Ut(Ut({},this.getHeader()),{r:[]});if(this.innerHeader&&(m.r[0]=this.msgId,m.r[1]={body:[],headerPacket:this.getInnerHeader()}),!includes(a=[200,406,808,810,7101]).call(a,m.code))return Vn(m);if(this.packetLength>0&&this.packetLength>this.unpack.length())throw new Error("UnpackException packetLength("+this.packetLength+") greater than bufferLength("+this.unpack.length()+")");var h=[];return t&&forEach$1(t).call(t,(function(t){if(!u.unpack.checkBufferBoundaryAccess())switch(t.type){case"PropertyArray":h.push(u.unmarshalPropertyArray());break;case"Property":h.push(u.unmarshalProperty());break;case"Byte":h.push(u.unpack.popByte());break;case"Int":h.push(u.unpack.popInt());break;case"Bool":h.push(u.unpack.popBoolean());break;case"Long":h.push(u.unmarshalLong());break;case"LongArray":h.push(u.unmarshalLongArray());break;case"String":h.push(u.unpack.popString());break;case"StrArray":h.push(u.unmarshalStrArray());break;case"StrStrMap":h.push(u.unmarshalStrStrMap());break;case"StrLongMap":h.push(u.unmarshalStrLongMap());break;case"LongLongMap":h.push(u.unmarshalLongLongMap());break;case"KVArray":h.push(u.unmarshalKVArray())}})),this.innerHeader?m.r[1].body=h:m.r=h,Vn(m)},PacketDecoder}();zp.RES_CODE=2;var Wp=function(){function Pack(){this.offset=0,this.pageSize=1024,this.capacity=1048576,this.buffer=new Uint8Array(this.pageSize),this.view=new DataView(this.buffer.buffer)}var t=Pack.prototype;return t.reset=function reset(){this.offset=0,this.buffer=null,this.view=null},t.size=function size(){return this.offset},t.getBuffer=function getBuffer(){var t;return slice(t=this.buffer).call(t,0,this.offset).buffer},t.ensureCapacity=function ensureCapacity(t){var a=this.offset+t;if(a>this.capacity)throw new Error("PackException over limit");if(a>this.buffer.byteLength){var u=Math.ceil(a/this.pageSize)*this.pageSize,m=new Uint8Array(u);m.set(this.buffer),this.buffer=m,this.view=new DataView(this.buffer.buffer)}},t.putRaw=function putRaw(t){this.ensureCapacity(t.length);try{this.buffer.set(t,this.offset),this.offset+=t.length}catch(t){throw new Error("PackException raw")}},t.putByte=function putByte(t){this.ensureCapacity(1);try{this.view.setUint8(this.offset++,t)}catch(t){throw new Error("PackException byte")}},t.putString=function putString(t){try{var a=encodeText(t);this.putVarbin(a)}catch(t){throw new Error("PackException string")}},t.putInt=function putInt(t){this.ensureCapacity(4);try{this.view.setInt32(this.offset,t,!0),this.offset+=4}catch(t){throw new Error("PackException int")}},t.putVarInt=function putVarInt(t){var a=varintToBytes(t);this.putRaw(a)},t.putBoolean=function putBoolean(t){this.ensureCapacity(1);try{this.view.setUint8(this.offset++,t?1:0)}catch(t){throw new Error("PackException boolean")}},t.putLong=function putLong(t){this.ensureCapacity(8);try{var a=function setBigUint64(t,a){void 0===a&&(a=!1);var u=new Uint8Array(8),m=new DataView(u.buffer),h=Number(t>jp-1?t/jp:0),g=Number(4294967295&t),M=a?[4,0]:[0,4],I=M[0],S=M[1];return m.setUint32(I,h,a),m.setUint32(S,g,a),u}(t,!0);this.buffer.set(a,this.offset),this.offset+=8}catch(t){throw new Error("PackException long")}},t.putStringAsLong=function putStringAsLong(t){this.ensureCapacity(8);try{var a=function setBigUint64ForNumberOverflow(t,a){var u,m;void 0===a&&(a=!1);var h=new Uint8Array(8),g=new DataView(h.buffer),M=reverse$1(u=BigNumber(t).divide(jp).number).call(u).join(""),I=reverse$1(m=BigNumber(t).mod(jp).number).call(m).join(""),S=Number(M),T=Number(I),C=a?[4,0]:[0,4],b=C[0],E=C[1];return g.setUint32(b,S,a),g.setUint32(E,T,a),h}(t,!0);this.buffer.set(a,this.offset),this.offset+=8}catch(t){throw new Error("PackException stringAsLong")}},t.putShort=function putShort(t){this.ensureCapacity(2);try{this.view.setInt16(this.offset,t,!0),this.offset+=2}catch(t){throw new Error("PackException short")}},t.putVarbin=function putVarbin(t){if(!t)return this.ensureCapacity(1),this.putVarInt(0);if(t.byteLength>Math.pow(2,31)-2)throw new Error("PackException varbin. too long");var a=varintToBytes(t.length);this.ensureCapacity(a.length+t.length);try{this.buffer.set(a,this.offset),this.offset+=a.length,this.buffer.set(t,this.offset),this.offset+=t.length}catch(t){throw new Error("PackException varbin")}},Pack}();function isConvertibleToNumber(t){if("number"!=typeof t){if(null==t)return!1;t=Number(t)}if(isNaN(t))throw new Error("Number type conversion error");return!0}function isUndefinedOrNull(t){return null==t}var Kp,Yp=function(){function PacketEncoder(t,a,u){this.pack=new Wp,this.packetLength=0,this.serviceId=0,this.commandId=0,this.serialId=0,this.tag=0,this.serviceId=t,this.commandId=a,this.serialId=u}var t=PacketEncoder.prototype;return t.marshalHeader=function marshalHeader(){this.pack.putVarInt(this.packetLength),this.pack.putByte(this.serviceId),this.pack.putByte(this.commandId),this.pack.putShort(this.serialId),this.pack.putByte(this.tag)},t.marshalProperty=function marshalProperty(t){var a=this,u=Gt(t),m=filter(u).call(u,(function(t){return!isUndefinedOrNull(t)}));this.pack.putVarInt(m.length),forEach$1(m).call(m,(function(u){a.pack.putVarInt(Number(u)),Un(t[u])||"[object Object]"===Object.prototype.toString.call(t[u])?a.pack.putString(Vn(t[u])):a.pack.putString(String(t[u]))}))},t.marshalPropertyArray=function marshalPropertyArray(t){var a=this,u=t.length;this.pack.putVarInt(u),forEach$1(t).call(t,(function(t){a.marshalProperty(null==t?void 0:t.v)}))},t.marshalStrArray=function marshalStrArray(t){var a=this,u=filter(t).call(t,(function(t){return!isUndefinedOrNull(t)})),m=u.length;this.pack.putVarInt(m),forEach$1(u).call(u,(function(t){a.pack.putString(String(t))}))},t.marshalLongArray=function marshalLongArray(t){var a=this,u=filter(t).call(t,(function(t){return isConvertibleToNumber(t)})),m=u.length;this.pack.putVarInt(m),forEach$1(u).call(u,(function(t){a.putLong(t)}))},t.marshalStrStrMap=function marshalStrStrMap(t){var a=this,u=Gt(t),m=filter(u).call(u,(function(a){return!isUndefinedOrNull(t[a])&&!isUndefinedOrNull(a)}));this.pack.putVarInt(m.length),forEach$1(m).call(m,(function(u){a.pack.putString(String(u)),a.pack.putString(String(t[u]))}))},t.marshalStrLongMap=function marshalStrLongMap(t){var a=this,u=Gt(t),m=filter(u).call(u,(function(a){return isConvertibleToNumber(t[a])&&!isUndefinedOrNull(a)}));this.pack.putVarInt(m.length),forEach$1(m).call(m,(function(u){a.pack.putString(String(u)),a.putLong(t[u])}))},t.marshalLongLongMap=function marshalLongLongMap(t){var a=this,u=Gt(t),m=filter(u).call(u,(function(a){var u=Number(a);return isConvertibleToNumber(u)&&isConvertibleToNumber(t[u])}));this.pack.putVarInt(m.length),forEach$1(m).call(m,(function(u){var m=Number(u);a.putLong(m),a.putLong(t[m])}))},t.marshalKVArray=function marshalKVArray(t){var a=this,u=t.length;this.pack.putVarInt(u),forEach$1(t).call(t,(function(t){a.marshalStrStrMap(t)}))},t.putLong=function putLong(t){"string"==typeof t&&t.length>15?this.pack.putStringAsLong(t):this.pack.putLong(Number(t))},t.marshal=function marshal(t,a){var u=this;return this.marshalHeader(),a&&forEach$1(a).call(a,(function(a,m){var h,g=a.type,M=null===(h=t[m])||void 0===h?void 0:h.v;if(!isUndefinedOrNull(M))switch(g){case"PropertyArray":u.marshalPropertyArray(M);break;case"Property":u.marshalProperty(M);break;case"Byte":if(!isConvertibleToNumber(M))return;u.pack.putByte(Number(M));break;case"Int":if(!isConvertibleToNumber(M))return;u.pack.putInt(Number(M));break;case"Bool":"false"===M?M=!1:"true"===M&&(M=!0),u.pack.putBoolean(M);break;case"Long":if(!isConvertibleToNumber(M))return;u.putLong(M);break;case"LongArray":u.marshalLongArray(M);break;case"String":u.pack.putString(String(M));break;case"StrArray":u.marshalStrArray(M);break;case"StrStrMap":u.marshalStrStrMap(M);break;case"StrLongMap":u.marshalStrLongMap(M);break;case"LongLongMap":u.marshalLongLongMap(M);break;case"KVArray":u.marshalKVArray(M)}})),this.pack.getBuffer()},t.reset=function reset(){this.pack.reset()},PacketEncoder}(),Qp=function(t){function BaseWebsocket(a,u,m){var h;return(h=t.call(this)||this).websocket=null,h.socketConnectTimer=0,h.linkSSL=!0,h.url="",h.core=a,h.url=u,h.linkSSL=m,h.status="disconnected",h.logger=a.logger,h.connect(),h}wt(BaseWebsocket,t);var a=BaseWebsocket.prototype;return a.connect=function connect(){"connecting"!==this.status&&"connected"!==this.status?(this.status="connecting",this._createWebsocket((this.linkSSL?"wss":"ws")+"://"+this.url+"/websocket")):this.logger.warn("imsocket::socket is connecting or connected",this.status)},a.close=function close(){if(this.status="disconnected",this.websocket){this.logger.log("imsocket:: close websocket");try{this.websocket.close()}catch(t){this.logger.warn("imsocket::attempt to close websocket error",t)}this.clean(),this.emit("disconnect")}},a.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)},a.onConnect=function onConnect(){this.status="connected",this.emit("connect"),clearTimeout(this.socketConnectTimer)},a._createWebsocket=function _createWebsocket(t){var a,u=this;this.socketConnectTimer=po((function(){u.logger.error("imsocket::Websocket connect timeout. url: ",t),u.emit("connectFailed",new Wl({code:"v2"===get(u.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_CONNECT_TIMEOUT:415,detail:{reason:"imsocket::Websocket connect timeout. url: "+t}}))}),this.core.options.socketConnectTimeout||8e3),this.socketUrl=t,this.websocket=new uu.WebSocket(t),this.websocket.binaryType="arraybuffer",this.websocket.onmessage=bind$1(a=this.onMessage).call(a,this),this.websocket.onclose=function(t){t=t||{},u.logger.log("imsocket::Websocket onclose done "+t.wasClean+"/"+t.code+"/"+t.reason),"connected"===u.status?(u.clean(),u.emit("disconnect")):(u.clean(),u.emit("connectFailed",new Wl({code:"v2"===get(u.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_CONNECT_FAILED:414,detail:{reason:"imsocket::Websocket onclose done"}})))},this.websocket.onerror=function(t){u.logger.error("imsocket::Websocket onerror",t),"connected"===u.status?(u.clean(),u.emit("disconnect")):(u.clean(),u.emit("connectFailed",new Wl({code:"v2"===get(u.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_CONNECT_FAILED:414,detail:{reason:"imsocket::Websocket onerror."}})))},this.websocket.onopen=function(){u.onConnect()}},a.onMessage=function onMessage(t){if(t.data){var a=new zp(t.data),u={sid:-1,cid:-1,ser:-1,packetLength:-1},m=null;try{a.unmarshalHeader(),u=a.getHeader(),m=a.getInnerHeader()}catch(a){this.reportBinaryError({err:a,sid:m?m.sid:null==u?void 0:u.sid,cid:m?m.cid:null==u?void 0:u.cid,rawBuf:t.data,type:"decode"})}var h=m?m.sid:u.sid,g=m?m.cid:u.cid,M=h+"_"+g,I=zd[M];if(I&&I.length>0){var S,T=I[0].config;try{S=a.unmarshal(T.response)}catch(m){var C=a.getBodyDetail();this.reportBinaryError({err:m,rawBuf:t.data,sid:h,cid:g,parseDetail:C,type:"decode"}),a.reset();var b=Ut(Ut({},u),{sid:h,cid:g,code:jl.V2NIM_ERROR_CODE_UNPACK_ERROR});return this.logger.error('imsocket::onMessage "'+b.sid+"_"+b.cid+'", ser '+b.ser+", packetLength "+b.packetLength+" unmarshal error. "+C+" \n",m),void this.emit("message",Vn(b))}this.emit("message",S)}else this.core.logger.warn("imsocket::onMessage cmd not found",M);a.reset()}},a.send=function send(t,a,u,m,h){var g,M,I=new Yp(t,a,u),S=$d[m],T="";try{T=Vn(h),M=I.marshal(JSON.parse(T),S.params)}catch(m){throw this.reportBinaryError({err:m,sid:t,cid:a,rawStr:T,type:"encode"}),I.reset(),new Wl({code:jl.V2NIM_ERROR_CODE_PACK_ERROR,detail:{reason:t+"-"+a+", ser "+u+" marshal error",rawError:m}})}null===(g=this.websocket)||void 0===g||g.send(M),I.reset()},a.reportBinaryError=function reportBinaryError(t){var a,u,m,h=t.err,g=t.rawStr,M=t.sid,I=t.cid,S=t.type,T=t.parseDetail,C=t.rawBuf;if(C){try{m=function arrayBufferToBase64(t){if("function"!=typeof btoa)return"";for(var a="",u=new Uint8Array(t),m=u.byteLength,h=0;h<m;h++)a+=String.fromCharCode(u[h]);return u=null,btoa(a)}(C)}catch(t){m="reportBinaryError::arrayBufferToBase64 parsing failed, error: "+(null==t?void 0:t.message)+", sid: "+M+", cid: "+I,this.core.logger.error(m)}C=null}this.core.reporter.reportTraceStart("exceptions",{user_id:null===(a=this.core.auth)||void 0===a?void 0:a.account,trace_id:null===(u=this.core.clientSocket.socket)||void 0===u?void 0:u.sessionId,start_time:eo(),action:2,exception_service:9});var b=h?(h.message+";;;"||h.code+";;;")+(T?"parseDetail: "+T+";;;":"")+(g?" rawStr: "+g:"")+(m?" rawBuf: "+m:""):"";this.core.reporter.reportTraceUpdateV2("exceptions",{code:"encode"===S?jl.V2NIM_ERROR_CODE_PACK_ERROR:jl.V2NIM_ERROR_CODE_UNPACK_ERROR,description:b,operation_type:"encode"===S?3:4,target:M+"-"+I},{asyncParams:uu.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("exceptions",1)},BaseWebsocket}(mo);function _createForOfIteratorHelperLoose$a(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$a(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$a(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$a(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$a(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}!function(t){t[t.ACTIVE=1]="ACTIVE",t[t.KICKED=2]="KICKED",t[t.OFFLINE=3]="OFFLINE"}(Kp||(Kp={}));var Jp,Xp=function(){function V2BinaryClientSocket(t){this.isReconnect=!1,this.packetTimeout=8e3,this.linkSSL=!0,this.packetSer=1,this.backoff=new op({max:8e3,min:1600,jitter:.01}),this.sendingCmdMap=new _c,this.pingTimer=0,this.hasNetworkListener=!1,this.core=t,this.auth=t.auth,this.logger=t.logger,this.reporter=t.reporter,this.timerManager=t.timerManager,this.eventBus=t.eventBus,this.setListener()}var t=V2BinaryClientSocket.prototype;return t.setListener=function setListener(){var t=this;this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(){t.isReconnect=!0}))},t.setSessionId=function setSessionId(t){this.socket&&(this.socket.sessionId=t)},t.setLinkSSL=function setLinkSSL(t){this.linkSSL=t},t.connect=function connect(t,a){var u,m;return void 0===a&&(a=!1),__awaiter(this,void 0,void 0,lu.mark((function _callee(){var h,g,M,I;return lu.wrap((function _callee$(S){for(;;)switch(S.prev=S.next){case 0:if(this.isReconnect=a,1!==(h=this.core.auth.getConnectStatus())){S.next=7;break}return g="clientSocket::connect status is "+h+", and would not repeat connect",M=new Wl({code:jl.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:g}}),this.logger.warn(g),S.abrupt("return",$i.reject(M));case 7:return this.auth.lifeCycle.processEvent("connect"),S.prev=8,S.next=11,this.auth.doLoginStepsManager.add(this.doConnect(t));case 11:this.logger.log("clientSocketV2:: connect success with link url: "+t+", isReconnect: "+a),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:t,code:200,mixlink:!0,succeed:!0},{asyncParams:uu.net.getNetworkStatus()}),this.auth.lifeCycle.processEvent("connectSucc"),S.next=28;break;case 16:if(S.prev=16,S.t0=S.catch(8),I=S.t0,this.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:t,code:I.code||0,description:"connectFailed:"+I.message,mixlink:!0,succeed:!1},{asyncParams:uu.net.getNetworkStatus()}),I.code!==jl.V2NIM_ERROR_CODE_CANCELLED&&I.code!==jl.V2NIM_ERROR_CODE_TIMEOUT){S.next=25;break}throw null===(u=this.socket)||void 0===u||u.close(),null===(m=this.socket)||void 0===m||m.removeAllListeners(),this.socket=void 0,S.t0;case 25:throw this.logger.warn("clientSocketV2::connect failed with link url: "+t,I),this.auth.lifeCycle.processEvent("connectFail",I),S.t0;case 28:case"end":return S.stop()}}),_callee,this,[[8,16]])})))},t.doConnect=function doConnect(t){var a=this,u=!1;return new $i((function(m,h){var g;a.socket=new Qp(a.core,t,a.linkSSL),a.socket.on("connect",(function(){a.logger.log("clientSocketV2::socket on connect",t),a.core.reporterHookLinkKeep.start(),a.core.reporterHookLinkKeep.update({code:0,description:"connection begin",operation_type:0,target:t}),u=!0,m()})),a.socket.on("message",bind$1(g=a.onMessage).call(g,a)),a.socket.on("disconnect",(function(m){return __awaiter(a,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return u=!0,this.logger.log("clientSocketV2::socket on disconnect "+t,m),a.next=4,this.core.reporterHookLinkKeep.update({code:(null==m?void 0:m.code)||0,description:(null==m?void 0:m.reason)||"socket on disconnect",operation_type:1,target:t});case 4:this.core.reporterHookLinkKeep.end(!1),this.doDisconnect(Kp.OFFLINE,"SocketOnDisconnect");case 6:case"end":return a.stop()}}),_callee2,this)})))})),a.socket.on("connectFailed",(function(m){u?a.ping():(a.logger.error("clientSocketV2::connectFailed:"+t+", reason:"+(m&&m.message)),a.cleanSocket()),u=!0,h(m)}))}))},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.resetSocketConfig=function resetSocketConfig(){this.backoff.reset(),this.initOnlineListener()},t.doDisconnect=function doDisconnect(t,a){if(this.logger.log("clientSocketV2::doDisconnect:type:"+t+",reason:",a),0!==this.core.auth.getConnectStatus()){var u={1:"close",2:"kicked",3:"broken"}[t]||"";this.markAllCmdInvaild(new Wl({code:jl.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"Packet timeout due to instance disconnect",disconnect_reason:u}})),this.timerManager.destroy(),clearTimeout(this.pingTimer),this.cleanSocket(),t===Kp.ACTIVE||t===Kp.KICKED?this.destroyOnlineListener():t===Kp.OFFLINE&&(this.auth.lifeCycle.processEvent("connectionBroken",new Wl({code:jl.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"connection broken due to internal reasons"}})),this.logger.log("clientSocketV2::doDisconnect: pending reconnect "+this.isReconnect),this.isReconnect&&this.auth.lifeCycle.processEvent("waiting"))}else this.logger.warn("clientSocketV2::doDisconnect:already disconnected")},t.sendCmd=function sendCmd(t,a,u){var m=this,h=this.core.auth.getLoginStatus(),g=["v2Login","login","chatroomLogin","v2ChatroomLogin"],M={cmd:t};if(1!==h&&!includes(g).call(g,t))return this.logger.warn("clientSocketV2::NIM login status is "+h+", so can not sendCmd "+t),$i.reject(new Wl({code:jl.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:Ut({reason:"Can not sendCmd due to no logined"},M)}));var I="heartbeat"!==t,S=I?this.packetSer++:0,T=createCmd(t,S,this.logger,a);if(!T){var C=new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:Ut(Ut({},M),{reason:"SendCmd::createCmd error: "+S+" "+t})});return this.logger.error(C),$i.reject(C)}var b=T.packet,E=T.hasPacketResponse,k=T.hasPacketTimer,R=Vn(b);I&&(this.logger.getDebugMode()?this.logger.debug("clientSocketV2::sendCmd: "+b.SID+"_"+b.CID+","+t+",ser:"+S,R):this.logger.log("clientSocketV2::sendCmd: "+b.SID+"_"+b.CID+","+t+",ser:"+S));var A=(new Date).getTime();return new $i((function(h,g){E&&m.sendingCmdMap.set(S,{cmd:t,params:a,callback:[h,g],timer:k?po((function(){var a=new Wl({code:jl.V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT,detail:Ut({ser:S,reason:"Packet Timeout: ser "+S+" cmd "+t,timetag:(new Date).getTime()},M)});m.markCmdInvalid(S,a,t)}),u&&u.timeout?u.timeout:m.packetTimeout):null});try{m.socket.send(b.SID,b.CID,S,t,b.Q),E||h(b)}catch(a){var I=new Wl({code:jl.V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED,detail:Ut({ser:S,reason:"Unable to send packet"+(a&&a.message?": "+a.message:""),timetag:(new Date).getTime(),rawError:a},M)});m.markCmdInvalid(S,I,t),g(I)}})).catch((function(t){return __awaiter(m,void 0,void 0,lu.mark((function _callee3(){var a,u;return lu.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:if(a=t,u=[jl.V2NIM_ERROR_CODE_DISCONNECT,jl.V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT,jl.V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED],includes(u).call(u,a.code)){m.next=4;break}return m.abrupt("return",$i.reject(a));case 4:return this.reportSendCmdFailed(a,{sid:b.SID,cid:b.CID,ser:S},A),m.abrupt("return",$i.reject(a));case 6:case"end":return m.stop()}}),_callee3,this)})))}))},t.reportSendCmdFailed=function reportSendCmdFailed(t,a,u){var m;this.reporter.reportTraceStart("exceptions",{user_id:this.core.auth.getLoginUser(),trace_id:null===(m=this.socket)||void 0===m?void 0:m.sessionId,start_time:u,action:2,exception_service:6});var h=get(t,"detail.disconnect_reason")||"",g=t.code===jl.V2NIM_ERROR_CODE_DISCONNECT?Vn({disconnect_reason:h}):t.detail.reason;this.reporter.reportTraceUpdateV2("exceptions",{code:t.code,description:g,operation_type:1,target:a.sid+"-"+a.cid,context:""+a.ser},{asyncParams:uu.net.getNetworkStatus()}),this.reporter.reportTraceEnd("exceptions",1)},t.onMessage=function onMessage(t){var a=parseCmd(t,this.logger);if(a&&a.length>0){var u=a[0],m=u.raw.ser;u.error&&(this.logger.error("clientSocketV2::onMessage packet error",u.raw.sid+"_"+u.raw.cid+", ser:"+m+",",u.error),u.error.code===jl.V2NIM_ERROR_CODE_UNPACK_ERROR&&this.core.eventBus.emit("BinaryClientSocket/unpackError")),"heartbeat"!==u.cmd&&(this.logger.getDebugMode()?this.logger.debug("clientSocketV2::recvCmd "+u.raw.sid+"_"+u.raw.cid+","+u.cmd+",ser:"+m,t):this.logger.log("clientSocketV2::recvCmd "+u.raw.sid+"_"+u.raw.cid+","+u.cmd+",ser:"+m+",code:"+u.raw.code));for(var h,g=_createForOfIteratorHelperLoose$a(a);!(h=g()).done;){var M=h.value;this.packetHandler(M)}}},t.packetHandler=function packetHandler(t){var a,u,m,h,g=this;if(t){var M=t.raw.ser,I=this.sendingCmdMap.get(M);if(I&&I.cmd===t.cmd){var S=I.callback,T=I.timer,C=I.params;if(clearTimeout(T),t.params=C,this.sendingCmdMap.delete(M),"heartbeat"===t.cmd)return void S[0]();var b=null===(u=null===(a=this.core[t.service])||void 0===a?void 0:a.process)||void 0===u?void 0:u.call(a,t);b&&"function"==typeof b.then?b.then((function(t){S[0](t)})).catch((function(t){S[1](t)})):(this.logger.log("clientSocketV2::handlerFn without promise",t.service,t.cmd),S[0](t))}else{var E=null===(h=null===(m=this.core[t.service])||void 0===m?void 0:m.process)||void 0===h?void 0:h.call(m,t);E&&"function"==typeof E.then&&E.catch((function(t){g.logger.error("clientSocketV2::no obj cache, no process handler",t)}))}}},t.markCmdInvalid=function markCmdInvalid(t,a,u){var m=this.sendingCmdMap.get(t);if(m){var h=m.callback,g=m.timer;g&&clearTimeout(g),this.sendingCmdMap.delete(t),this.logger.warn("clientSocketV2::packet "+t+", "+u+" is invalid:",a),h[1](a)}},t.markAllCmdInvaild=function markAllCmdInvaild(t){var a,u=this;this.logger.log("markAllCmdInvaild",t),forEach$1(a=this.sendingCmdMap).call(a,(function(a){var m=a.callback,h=a.timer,g=a.cmd;u.logger.log("clientSocketV2::markAllCmdInvaild:cmd "+g),h&&clearTimeout(h),m[1](t)})),this.sendingCmdMap.clear()},t.ping=function ping(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a=this;return lu.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=20;break;case 6:if(u.prev=6,u.t0=u.catch(1),u.t0.code!==jl.V2NIM_ERROR_CODE_DISCONNECT){u.next=11;break}return u.abrupt("return");case 11:return u.next=13,this.testHeartBeat5Timeout();case 13:if(!u.sent){u.next=20;break}return u.next=17,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 17:return this.core.reporterHookLinkKeep.end(!0),this.doDisconnect(Kp.OFFLINE,"PingError"),u.abrupt("return");case 20:this.pingTimer=po((function(){a.ping()}),3e4);case 21:case"end":return u.stop()}}),_callee4,this,[[1,6]])})))},t.testHeartBeat5Timeout=function testHeartBeat5Timeout(){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var t;return lu.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:clearTimeout(this.pingTimer),t=0;case 2:if(!(t<5)){a.next=15;break}return a.prev=3,a.next=6,this.sendCmd("heartbeat",{},{timeout:3e3});case 6:return a.abrupt("return",!1);case 9:a.prev=9,a.t0=a.catch(3),this.logger.log("clientSocketV2::test heartbeat "+t+" Timeout");case 12:t++,a.next=2;break;case 15:return a.abrupt("return",!0);case 16:case"end":return a.stop()}}),_callee5,this,[[3,9]])})))},t.initOnlineListener=function initOnlineListener(){var t=this;this.hasNetworkListener||(this.logger.log("clientSocketV2::onlineListener:init"),this.hasNetworkListener=!0,uu.net.onNetworkStatusChange((function(a){t.logger.log("clientSocketV2::onlineListener:network change",a);var u=t.auth.getLoginStatus();a.isConnected&&1===u?t.ping():a.isConnected&&3===u?(t.logger.log("clientSocketV2::onlineListener:online and connectStatus is waiting, do reLogin"),t.auth.reconnect.clearReconnectTimer(),t.auth.reconnect.doReLogin()):a.isConnected||t.doDisconnect(Kp.OFFLINE,"OfflineListener")})))},t.destroyOnlineListener=function destroyOnlineListener(){this.logger.log("clientSocketV2::onlineListener:destroy"),uu.net.offNetworkStatusChange(),this.hasNetworkListener=!1},V2BinaryClientSocket}();function _createForOfIteratorHelperLoose$9(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$9(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$9(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$9(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$9(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}!function(t){t[t.ACTIVE=1]="ACTIVE",t[t.KICKED=2]="KICKED",t[t.OFFLINE=3]="OFFLINE"}(Jp||(Jp={}));var Zp=function(){function V2ClientSocket(t){this.isReconnect=!1,this.packetTimeout=8e3,this.linkSSL=!0,this.packetSer=1,this.backoff=new op({max:8e3,min:1600,jitter:.01}),this.sendingCmdMap=new _c,this.pingTimer=0,this.hasNetworkListener=!1,this.core=t,this.auth=t.auth,this.logger=t.logger,this.reporter=t.reporter,this.timerManager=t.timerManager,this.eventBus=t.eventBus,this.setListener()}var t=V2ClientSocket.prototype;return t.setListener=function setListener(){var t=this;this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(){t.isReconnect=!0}))},t.setSessionId=function setSessionId(t){this.socket&&(this.socket.sessionId=t)},t.setLinkSSL=function setLinkSSL(t){this.linkSSL=t},t.connect=function connect(t,a){var u,m;return void 0===a&&(a=!1),__awaiter(this,void 0,void 0,lu.mark((function _callee(){var h,g,M,I;return lu.wrap((function _callee$(S){for(;;)switch(S.prev=S.next){case 0:if(this.isReconnect=a,1!==(h=this.core.auth.getConnectStatus())){S.next=7;break}return g="clientSocket::connect status is "+h+", and would not repeat connect",M=new Wl({code:jl.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:g}}),this.logger.warn(g),S.abrupt("return",$i.reject(M));case 7:return this.auth.lifeCycle.processEvent("connect"),S.prev=8,S.next=11,this.auth.doLoginStepsManager.add(this.doConnect(t));case 11:this.logger.log("clientSocketV2:: connect success with link url: "+t+", isReconnect: "+a),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:t,code:200,mixlink:!0,succeed:!0},{asyncParams:uu.net.getNetworkStatus()}),this.auth.lifeCycle.processEvent("connectSucc"),S.next=28;break;case 16:if(S.prev=16,S.t0=S.catch(8),I=S.t0,this.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:t,code:I.code||0,description:"connectFailed:"+I.message,mixlink:!0,succeed:!1},{asyncParams:uu.net.getNetworkStatus()}),I.code!==jl.V2NIM_ERROR_CODE_CANCELLED&&I.code!==jl.V2NIM_ERROR_CODE_TIMEOUT){S.next=25;break}throw null===(u=this.socket)||void 0===u||u.close(),null===(m=this.socket)||void 0===m||m.removeAllListeners(),this.socket=void 0,S.t0;case 25:throw this.logger.warn("clientSocketV2::connect failed with link url: "+t,I),this.auth.lifeCycle.processEvent("connectFail",I),S.t0;case 28:case"end":return S.stop()}}),_callee,this,[[8,16]])})))},t.doConnect=function doConnect(t){var a=this,u=!1;return new $i((function(m,h){var g;a.socket=new dp(a.core,t,a.linkSSL),a.socket.on("connect",(function(){a.logger.log("clientSocketV2::socket on connect",t),a.core.reporterHookLinkKeep.start(),a.core.reporterHookLinkKeep.update({code:0,description:"connection begin",operation_type:0,target:t}),u=!0,m()})),a.socket.on("message",bind$1(g=a.onMessage).call(g,a)),a.socket.on("disconnect",(function(m){return __awaiter(a,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return u=!0,this.logger.log("clientSocketV2::socket on disconnect",m),a.next=4,this.core.reporterHookLinkKeep.update({code:(null==m?void 0:m.code)||0,description:(null==m?void 0:m.reason)||"socket on disconnect",operation_type:1,target:t});case 4:this.core.reporterHookLinkKeep.end(!1),this.doDisconnect(Jp.OFFLINE,"SocketOnDisconnect");case 6:case"end":return a.stop()}}),_callee2,this)})))})),a.socket.on("handshakeFailed",(function(t){u?a.ping():(a.logger.error('clientSocketV2::handshake failed: "'+(t&&t.message)+'"'),a.cleanSocket()),u=!0,h(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.resetSocketConfig=function resetSocketConfig(){this.backoff.reset(),this.initOnlineListener()},t.doDisconnect=function doDisconnect(t,a){if(this.logger.log("clientSocketV2::doDisconnect:type:"+t+",reason:",a),0!==this.core.auth.getConnectStatus()){var u={1:"close",2:"kicked",3:"broken"}[t]||"";this.markAllCmdInvaild(new Wl({code:jl.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"Packet timeout due to instance disconnect",disconnect_reason:u}})),this.timerManager.destroy(),clearTimeout(this.pingTimer),this.cleanSocket(),t===Jp.ACTIVE||t===Jp.KICKED?this.destroyOnlineListener():t===Jp.OFFLINE&&(this.auth.lifeCycle.processEvent("connectionBroken",new Wl({code:jl.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"connection broken due to internal reasons"}})),this.logger.log("clientSocketV2::doDisconnect: pending reconnect "+this.isReconnect),this.isReconnect&&this.auth.lifeCycle.processEvent("waiting"))}else this.logger.warn("clientSocketV2::doDisconnect:already disconnected")},t.sendCmd=function sendCmd(t,a,u){var m=this,h=this.core.auth.getLoginStatus(),g=["v2Login","login","chatroomLogin","v2ChatroomLogin"],M={cmd:t};if(1!==h&&!includes(g).call(g,t))return this.logger.warn("clientSocketV2::NIM login status is "+h+", so can not sendCmd "+t),$i.reject(new Wl({code:jl.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:Ut({reason:"Can not sendCmd due to no logined"},M)}));var I="heartbeat"!==t,S=I?this.packetSer++:0,T=createCmd(t,S,this.logger,a);if(!T){var C=new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:Ut(Ut({},M),{reason:"SendCmd::createCmd error: "+S+" "+t})});return this.logger.error(C),$i.reject(C)}var b=T.packet,E=T.hasPacketResponse,k=T.hasPacketTimer,R=Vn(b);I&&(this.logger.getDebugMode()?this.logger.debug("clientSocketV2::sendCmd: "+b.SID+"_"+b.CID+","+t+",ser:"+S,R):this.logger.log("clientSocketV2::sendCmd: "+b.SID+"_"+b.CID+","+t+",ser:"+S));var A=(new Date).getTime();return new $i((function(h,g){E&&m.sendingCmdMap.set(S,{cmd:t,params:a,callback:[h,g],timer:k?po((function(){var a=new Wl({code:jl.V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT,detail:Ut({ser:S,reason:"Packet Timeout: ser "+S+" cmd "+t,timetag:(new Date).getTime()},M)});m.markCmdInvalid(S,a,t)}),u&&u.timeout?u.timeout:m.packetTimeout):null});try{m.socket.send(R),E||h(b)}catch(a){var I=new Wl({code:jl.V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED,detail:Ut({ser:S,reason:"Unable to send packet"+(a&&a.message?": "+a.message:""),timetag:(new Date).getTime(),rawError:a},M)});m.markCmdInvalid(S,I,t),g(I)}})).catch((function(t){return __awaiter(m,void 0,void 0,lu.mark((function _callee3(){var a,u,m,h,g;return lu.wrap((function _callee3$(M){for(;;)switch(M.prev=M.next){case 0:if(u=t,m=[jl.V2NIM_ERROR_CODE_DISCONNECT,jl.V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT,jl.V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED],includes(m).call(m,u.code)){M.next=4;break}return M.abrupt("return",$i.reject(u));case 4:return this.reporter.reportTraceStart("exceptions",{user_id:this.core.auth.getLoginUser(),trace_id:null===(a=this.socket)||void 0===a?void 0:a.sessionId,start_time:A,action:2,exception_service:6}),h=get(u,"detail.disconnect_reason")||"",g=u.code===jl.V2NIM_ERROR_CODE_DISCONNECT?Vn({disconnect_reason:h}):u.detail.reason,this.reporter.reportTraceUpdateV2("exceptions",{code:u.code,description:g,operation_type:1,target:b.SID+"-"+b.CID,context:""+b.SER},{asyncParams:uu.net.getNetworkStatus()}),this.reporter.reportTraceEnd("exceptions",1),M.abrupt("return",$i.reject(u));case 10:case"end":return M.stop()}}),_callee3,this)})))}))},t.onMessage=function onMessage(t){var a=parseCmd(t,this.logger);if(a&&a.length>0){var u=a[0],m=u.raw.ser;u.error&&this.logger.error("clientSocketV2::onMessage packet error",u.raw.sid+"_"+u.raw.cid+", ser:"+m+",",u.error),"heartbeat"!==u.cmd&&(this.logger.getDebugMode()?this.logger.debug("clientSocketV2::recvCmd "+u.raw.sid+"_"+u.raw.cid+","+u.cmd+",ser:"+m,u.content):this.logger.log("clientSocketV2::recvCmd "+u.raw.sid+"_"+u.raw.cid+","+u.cmd+",ser:"+m+";code:"+u.raw.code));for(var h,g=_createForOfIteratorHelperLoose$9(a);!(h=g()).done;){var M=h.value;this.packetHandler(M)}}},t.packetHandler=function packetHandler(t){var a,u,m,h,g=this;if(t){var M=t.raw.ser,I=this.sendingCmdMap.get(M);if(I&&I.cmd===t.cmd){var S=I.callback,T=I.timer,C=I.params;if(clearTimeout(T),t.params=C,this.sendingCmdMap.delete(M),"heartbeat"===t.cmd)return void S[0]();var b=null===(u=null===(a=this.core[t.service])||void 0===a?void 0:a.process)||void 0===u?void 0:u.call(a,t);b&&"function"==typeof b.then?b.then((function(t){S[0](t)})).catch((function(t){S[1](t)})):(this.logger.log("clientSocketV2::handlerFn without promise",t.service,t.cmd),S[0](t))}else{var E=null===(h=null===(m=this.core[t.service])||void 0===m?void 0:m.process)||void 0===h?void 0:h.call(m,t);E&&"function"==typeof E.then&&E.catch((function(t){g.logger.error("clientSocketV2::no obj cache, no process handler",t)}))}}},t.markCmdInvalid=function markCmdInvalid(t,a,u){var m=this.sendingCmdMap.get(t);if(m){var h=m.callback,g=m.timer;g&&clearTimeout(g),this.sendingCmdMap.delete(t),this.logger.warn("clientSocketV2::packet "+t+", "+u+" is invalid:",a),h[1](a)}},t.markAllCmdInvaild=function markAllCmdInvaild(t){var a,u=this;this.logger.log("markAllCmdInvaild",t),forEach$1(a=this.sendingCmdMap).call(a,(function(a){var m=a.callback,h=a.timer,g=a.cmd;u.logger.log("clientSocketV2::markAllCmdInvaild:cmd "+g),h&&clearTimeout(h),m[1](t)})),this.sendingCmdMap.clear()},t.ping=function ping(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a=this;return lu.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=20;break;case 6:if(u.prev=6,u.t0=u.catch(1),u.t0.code!==jl.V2NIM_ERROR_CODE_DISCONNECT){u.next=11;break}return u.abrupt("return");case 11:return u.next=13,this.testHeartBeat5Timeout();case 13:if(!u.sent){u.next=20;break}return u.next=17,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 17:return this.core.reporterHookLinkKeep.end(!0),this.doDisconnect(Jp.OFFLINE,"PingError"),u.abrupt("return");case 20:this.pingTimer=po((function(){a.ping()}),3e4);case 21:case"end":return u.stop()}}),_callee4,this,[[1,6]])})))},t.testHeartBeat5Timeout=function testHeartBeat5Timeout(){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var t;return lu.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:clearTimeout(this.pingTimer),t=0;case 2:if(!(t<5)){a.next=15;break}return a.prev=3,a.next=6,this.sendCmd("heartbeat",{},{timeout:3e3});case 6:return a.abrupt("return",!1);case 9:a.prev=9,a.t0=a.catch(3),this.logger.log("clientSocketV2::test heartbeat "+t+" Timeout");case 12:t++,a.next=2;break;case 15:return a.abrupt("return",!0);case 16:case"end":return a.stop()}}),_callee5,this,[[3,9]])})))},t.initOnlineListener=function initOnlineListener(){var t=this;this.hasNetworkListener||(this.logger.log("clientSocketV2::onlineListener:init"),this.hasNetworkListener=!0,uu.net.onNetworkStatusChange((function(a){t.logger.log("clientSocketV2::onlineListener:network change",a);var u=t.auth.getConnectStatus(),m=t.auth.getLoginStatus();a.isConnected&&1===m?t.ping():a.isConnected&&3===u?(t.logger.log("clientSocketV2::onlineListener:online and connectStatus is waiting, do reLogin"),t.auth.reconnect.clearReconnectTimer(),t.auth.reconnect.doReLogin()):a.isConnected||t.doDisconnect(Jp.OFFLINE,"OfflineListener")})))},t.destroyOnlineListener=function destroyOnlineListener(){this.logger.log("clientSocketV2::onlineListener:destroy"),uu.net.offNetworkStatusChange(),this.hasNetworkListener=!1},V2ClientSocket}(),em=function(){function V2NIMLoginReconnect(t){var a,u,m=this;this.currenRetryCount=0,this.backoff=new op({max:8e3,min:1600,jitter:.01}),this.reconnectTimer=0,this.core=t,this.auth=t.V2NIMLoginService,null===(u=(a=uu.powerMonitor).on)||void 0===u||u.call(a,"onPowerMonitorTurnActive",(function(){m.core.logger.debug("reconnect::powerMonitor turn active"),3===m.auth.getLoginStatus()&&(m.core.logger.log("reconnect::powerMonitor turn active, try to reconnect"),m.auth.reconnect.clearReconnectTimer(),m.auth.reconnect.doReLogin())}))}var t=V2NIMLoginReconnect.prototype;return t.reset=function reset(){this.currenRetryCount=0,this.backoff.reset(),this.reconnectTimer&&clearTimeout(this.reconnectTimer)},t.destroy=function destroy(){var t,a;this.currenRetryCount=0,this.backoff.reset(),this.reconnectTimer&&clearTimeout(this.reconnectTimer),uu.powerMonitor.destroy(),null===(a=(t=uu.powerMonitor).off)||void 0===a||a.call(t,"onPowerMonitorTurnActive")},t.clearReconnectTimer=function clearReconnectTimer(){this.reconnectTimer&&clearTimeout(this.reconnectTimer)},t.attempToReLogin=function attempToReLogin(){var t=this,a=this.backoff.duration();if("function"==typeof this.reconnectDelayProvider)try{var u=this.reconnectDelayProvider(a);"number"==typeof u&&u>=0&&(a=u>=1e3?u:u+200+Math.ceil(300*Math.random()))}catch(t){this.core.logger.error("reconnect::connectDelayProvider excute failed,",t)}return this.currenRetryCount++,this.core.logger.log("reconnect::reconnect timer is about to be set, delay "+a+" ms, current retry count is "+this.currenRetryCount),this.core.reporter.reportTraceStart("login",{user_id:this.auth.getLoginUser(),action:"auto_login",binary_websocket:this.auth.binaryWebsocket}),this.clearReconnectTimer(),this.reconnectTimer=po((function(){t.core.logger.log("reconnect::reconnect timer is now triggered");var a=t.auth.getConnectStatus();3===a?t.doReLogin():t.core.logger.warn("reconnect::reconnect timer is over because connect status now is "+a)}),a),!0},t.doReLogin=function doReLogin(){var t=this;if(!uu.powerMonitor.isActive())return this.core.logger.log("reconnect::reLogin skip, cause app powerMonitor is not active"),void this.auth.lifeCycle.processEvent("waiting");this.auth.loginOption.forceMode=!1,this.auth.originLoginPromise=this.auth.doLogin(!0);var a=this.auth.previousLoginManager.add(this.auth.originLoginPromise);return a.then((function(){t.core.reporter.reportTraceEnd("login",!0)})).catch((function(a){var u=a;if(t.core.logger.warn("reconnect::try login but failed due to",u),t.core.reporter.reportTraceEnd("login",!1),t.auth.checkLoginTerminalCode(u&&u.code))return t.auth.clientSocket.doDisconnect(Kp.ACTIVE,"ReloginTerminated"),void t.auth.lifeCycle.processEvent("exited",u);u&&399===u.code&&t.auth.lbs.reset(),t.auth.lifeCycle.processEvent("waiting")})),a},t._setReconnectDelayProvider=function _setReconnectDelayProvider(t){this.reconnectDelayProvider=t},V2NIMLoginReconnect}(),tm=function(){function V2NIMLoginLbs(t){this.socketLinkUrls=[],this.timer=0,this.failedCount=0,this.core=t,this.auth=t.V2NIMLoginService}var t=V2NIMLoginLbs.prototype;return t.getLbsInfos=function getLbsInfos(){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var t,a,u,m;return lu.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:if(!(this.socketLinkUrls.length>0)){h.next=4;break}return t=this.socketLinkUrls.shift(),this.core.logger.log("V2NIMLoginService::getLbsInfos:use cache link",t),h.abrupt("return",$i.resolve(t));case 4:return this.auth.lifeCycle.processEvent("addressing"),this.core.reporterHookLBS.start(this.core.account),a=uniq(this.auth.config.lbsUrls),h.prev=7,h.next=10,this.ladderLoad(a);case 10:if(200===(u=h.sent).status&&u.data){h.next=14;break}throw this.core.logger.error("V1NIMLoginService::getLbsInfos:error status",u.status,u),new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"V2NIMLoginService::getLbsInfos failed, status "+u.status}});case 14:this.success(u),h.next=25;break;case 17:if(h.prev=17,h.t0=h.catch(7),m=h.t0,this.core.logger.error("V2NIMLoginService::lbs getLbsInfos error, use default link: "+this.auth.config.linkUrl+". error:",h.t0),this.reportForFail(a[0],m.code,m.message),!this.checkTerminator(m.code)){h.next=24;break}throw h.t0;case 24:this.socketLinkUrls=[this.auth.config.linkUrl];case 25:return h.abrupt("return",this.socketLinkUrls.shift());case 26:case"end":return h.stop()}}),_callee,this,[[7,17]])})))},t.checkTerminator=function checkTerminator(t){return t===jl.V2NIM_ERROR_CODE_CANCELLED||t===jl.V2NIM_ERROR_CODE_TIMEOUT},t.generateUrl=function generateUrl(t){return(t=this.processLbsUrl(t))+(indexOf(t).call(t,"?")>-1?"&":"?")+"k="+this.core.options.appkey+"&id="+this.core.auth.getLoginUser()+"&sv=180&pv=1&networkType=0&lv=1"},t.processLbsUrl=function processLbsUrl(t){return pendingIsMiniappEnv()?t.replace("/webconf","/wxwebconf"):t},t.requstLbs=function requstLbs(t){return this.auth.doLoginStepsManager.add(this.core.adapters.request(this.generateUrl(t),{method:"GET",dataType:"json",timeout:8e3}))},t.setLadderTimer=function setLadderTimer(t,a,u,m){var h=this;this.timer&&clearTimeout(this.timer);var g=t[a];this.timer=po((function(){g&&(h.setLadderTimer(t,a+1,u,m),h.core.logger.log("V2NIMLoginService::getLbsInfos "+a+":",h.processLbsUrl(g)),h.reportForLbsStart(g,a),h.requstLbs(g).then((function(t){h.reset(),u(Ut(Ut({},t),{url:g}))})).catch((function(u){var M;if(h.core.logger.warn("V2NIMLoginService::getLbsInfos "+a+" failed:",u),h.failedCount+=1,h.reportForFailOnce(g,u.code,(null===(M=u.detail)||void 0===M?void 0:M.reason)||u.message),h.failedCount>=t.length||h.checkTerminator(u.code))return h.reset(),void m(u)})))}),2e3)},t.ladderLoad=function ladderLoad(t){var a=this;return new $i((function(u,m){t.length>1&&a.setLadderTimer(t,1,u,m);var h=t[0];a.core.logger.log("V2NIMLoginService::getLbsInfos 0:",h),a.reportForLbsStart(h,0),a.requstLbs(h).then((function(t){a.reset(),u(Ut(Ut({},t),{url:h}))})).catch((function(u){var g;a.failedCount+=1,a.core.logger.warn("V2NIMLoginService::getLbsInfos 0 failed:",u),a.reportForFailOnce(h,u.code,(null===(g=u.detail)||void 0===g?void 0:g.reason)||u.message),(a.failedCount>=t.length||a.checkTerminator(u.code))&&(a.reset(),m(u))}))}))},t.success=function success(t){var a,u,m,h,g=t.data.common,M=g["mix.link"]||[],I=g["link.default"]||[];this.socketLinkUrls=concat(a=concat(M).call(M,I)).call(a,this.auth.config.linkUrl),t.data["nos-chunk"]&&(null===(m=this.core.cloudStorage)||void 0===m?void 0:m.setOptions)&&(this.core.logger.log("getLbsInfos success. lbs.nos-chunk",t.data["nos-chunk"]),this.core.cloudStorage.setOptions({chunkUploadHost:t.data["nos-chunk"]})),Un(t.data.nosup)&&t.data.nosup.length>0&&(null===(h=this.core.cloudStorage)||void 0===h?void 0:h.setOptions)&&(this.core.logger.log("getLbsInfos success. lbs.nosup",t.data.nosup),this.core.cloudStorage.setOptions({commonUploadHostBackupList:t.data.nosup,commonUploadHost:t.data.nosup[0]})),this.core.logger.log("V2NIMLoginService::getLbsInfos success, socket link:",slice(u=this.socketLinkUrls).call(u,0),"chunkUploadHost: ",t.data["nos-chunk"]),this.reportForLbsSuccess(t.url,t.data)},t.reportForLbsStart=function reportForLbsStart(t,a){this.core.reporterHookLBS.updateBegin({target:t,index:a})},t.reportForLbsSuccess=function reportForLbsSuccess(t,a){this.core.reporterHookLBS.updateComplete({target:t,code:200,body:Vn(a)}),this.core.reporterHookLBS.end(!0),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"HTTP",target:t,code:200,succeed:!0},{asyncParams:uu.net.getNetworkStatus()})},t.reportForFailOnce=function reportForFailOnce(t,a,u){this.core.reporterHookLBS.updateComplete({target:t,code:a,body:u})},t.reportForFail=function reportForFail(t,a,u){this.core.reporterHookLBS.end(!1),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"HTTP",target:t,description:u,code:a,succeed:!1},{asyncParams:uu.net.getNetworkStatus()})},t.reset=function reset(){this.socketLinkUrls=[],this.failedCount=0,clearTimeout(this.timer)},V2NIMLoginLbs}();var rm=function(){function V2NIMLoginAuthenticator(t){this.lastLoginClientKey="__NIM_LAST_LOGIN_CLIENT__",this.loginClients=[],this.loginClientOfThisConnection={},this.core=t,this.auth=t.V2NIMLoginService}var t=V2NIMLoginAuthenticator.prototype;return t.verifyAuthentication=function verifyAuthentication(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var m,h,g,M,I,S,T,C,b,E,k,R;return lu.wrap((function _callee$(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,this.auth.doLoginStepsManager.add(this.refreshLoginToken(this.auth.account));case 2:return h=A.sent,A.next=5,this.auth.doLoginStepsManager.add(this.refreshThirdPartyExt(this.auth.account));case 5:return g=A.sent,this.auth.token=h,M=uu.getSystemInfo(),I={appkey:this.core.options.appkey,account:this.auth.account,token:h,authType:this.auth.loginOption.authType,appLogin:t?0:1,clientType:16,clientSession:this.auth.clientSession,clientId:this.auth.deviceId,sdkVersion:100941,userAgent:this.core.options.loginSDKTypeParamCompat?"Native/10.9.41":slice(m=M.userAgent.replace("{{appkey}}",this.core.options.appkey)).call(m,0,299),libEnv:this.core.options.flutterSdkVersion?"FLUTTER":this.core.options.loginSDKTypeParamCompat?void 0:M.libEnv,hostEnv:this.core.options.flutterSdkVersion?4:this.core.options.loginSDKTypeParamCompat?0:M.hostEnvEnum,sdkHumanVersion:this.core.options.flutterSdkVersion||"10.9.41",os:M.os,browser:M.browser,protocolVersion:1,customClientType:this.auth.config.customClientType,customTag:this.auth.config.customTag,thirdPartyExtension:g,isRoutable:!1===(null===(a=this.auth.loginOption.routeConfig)||void 0===a?void 0:a.routeEnabled)?0:1,env:null===(u=this.auth.loginOption.routeConfig)||void 0===u?void 0:u.routeEnvironment},S=M.os.toLowerCase(),T=110===M.hostEnvEnum,"UNIAPP"===uu.platform&&T?(I.isReactNative=1,I.clientType="ios"===S?2:"android"===S?1:65,M.pushDeviceInfo&&M.pushDeviceInfo.MANUFACTURER&&(I.deviceInfo=Vn(Ut({IS_SUPPORT_HONOR:!0},M.pushDeviceInfo)))):"React Native"===uu.platform&&(this.core.logger.log("V2NIMLoginService deviceInfo",this.core.V2NIMLoginService.deviceInfo,"os",S),I.isReactNative=1,I.clientType="ios"===S?2:1,I.deviceInfo=Vn(Ut({IS_SUPPORT_HONOR:!0},this.core.V2NIMLoginService.deviceInfo))),this.core.logger.log("V2NIMLoginService::do login,accid:"+I.account+";clientSession:"+I.clientSession+";appLogin:"+I.appLogin),A.prev=13,A.next=16,this.auth.doLoginStepsManager.add(this.auth.clientSocket.sendCmd("v2Login",{tag:I}));case 16:C=A.sent,A.next=27;break;case 19:if(A.prev=19,A.t0=A.catch(13),b=A.t0,this.core.reporter.reportTraceUpdateV2("login",{operation_type:"protocol",target:"26-3",code:b.code||0,succeed:!1,description:b.message},{asyncParams:uu.net.getNetworkStatus()}),b.code!==jl.V2NIM_ERROR_CODE_CANCELLED&&b.code!==jl.V2NIM_ERROR_CODE_TIMEOUT){A.next=25;break}throw b;case 25:throw this.processLoginFailed(b),b;case 27:return E=C.content,k=E.data,R=E.loginClients,this.changeLoginClient(1,R),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"protocol",target:"26-3",code:200,succeed:!0},{asyncParams:uu.net.getNetworkStatus()}),this.loginClientOfThisConnection=formatLoginInfo(k),this.core.clientSocket.setSessionId(k.consid),uu.localStorage.setItem(this.lastLoginClientKey,Vn(Ut({account:this.auth.account},this.loginClientOfThisConnection))),A.abrupt("return",this.loginClientOfThisConnection);case 34:case"end":return A.stop()}}),_callee,this,[[13,19]])})))},t.refreshLoginToken=function refreshLoginToken(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m;return lu.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:if(0!==this.auth.loginOption.authType){h.next=2;break}return h.abrupt("return",this.auth.token);case 2:if("function"==typeof this.auth.loginOption.tokenProvider){h.next=4;break}return h.abrupt("return",this.auth.token);case 4:return h.prev=4,h.next=7,this.auth.loginOption.tokenProvider(t);case 7:if("string"!=typeof(a=h.sent)){h.next=12;break}return h.abrupt("return",a);case 12:throw this.core.logger.error("V2NIMLoginService::excute tokenProvider complete but got Unexpected value:",a),new Wl({code:jl.V2NIM_ERROR_CODE_CALLBACK_FAILED,detail:{reason:"Excute tokenProvider complete but got Unexpected value",rawData:a}});case 14:h.next=23;break;case 16:throw h.prev=16,h.t0=h.catch(4),u=h.t0,m=u,u.code!==jl.V2NIM_ERROR_CODE_CALLBACK_FAILED&&(this.core.logger.error("V2NIMLoginService::excute tokenProvider error:",u),m=new Wl({code:jl.V2NIM_ERROR_CODE_CALLBACK_FAILED,desc:"Excute tokenProvider error",detail:{rawError:h.t0}})),this.processLoginFailed(u),m;case 23:case"end":return h.stop()}}),_callee2,this,[[4,16]])})))},t.refreshThirdPartyExt=function refreshThirdPartyExt(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:if("function"==typeof this.auth.loginOption.loginExtensionProvider){h.next=2;break}return h.abrupt("return","");case 2:return h.prev=2,h.next=5,this.auth.loginOption.loginExtensionProvider(t);case 5:if("string"!=typeof(a=h.sent)){h.next=10;break}return h.abrupt("return",a);case 10:throw this.core.logger.error("V2NIMLoginService::excute loginExtensionProvider complete but got Unexpected value:",a),new Wl({code:jl.V2NIM_ERROR_CODE_CALLBACK_FAILED,detail:{reason:"Excute loginExtensionProvider complete but got Unexpected value",rawData:a}});case 12:h.next=25;break;case 14:if(h.prev=14,h.t0=h.catch(2),u=h.t0,m=u,u.code!==jl.V2NIM_ERROR_CODE_CALLBACK_FAILED&&(this.core.logger.error("V2NIMLoginService::excute loginExtensionProvider error:",u),m=new Wl({code:jl.V2NIM_ERROR_CODE_CALLBACK_FAILED,detail:{reason:"Excute loginExtensionProvider error",rawError:h.t0}})),2!==this.auth.loginOption.authType){h.next=24;break}throw this.processLoginFailed(u),m;case 24:return h.abrupt("return","");case 25:case"end":return h.stop()}}),_callee3,this,[[2,14]])})))},t.processLoginFailed=function processLoginFailed(t){this.auth.clientSocket.doDisconnect(Kp.ACTIVE,t),this.checkLoginTerminalCode(t.code)&&(this.auth.authenticator.reset(),this.auth.authenticator.clearLastLoginClient()),this.auth.lifeCycle.processEvent("loginFail",t)},t.changeLoginClient=function changeLoginClient(t,a){var u=this,m=map$6(a).call(a,(function(t){return formatLoginInfo(t)}));if(1===t)this.loginClients=m,this.auth.emit("onLoginClientChanged",t,this.loginClients);else if(2===t){var h=filter(m).call(m,(function(t){var a,m=filter(a=u.loginClients).call(a,(function(a){return a.clientId===t.clientId}));return u.loginClients.push(t),0===m.length}));h.length>0&&this.auth.emit("onLoginClientChanged",t,h)}else if(3===t){var g=filter(m).call(m,(function(t){var a;return function remove(t,a){a=a||function(){return!0};for(var u=[],m=(t=t||[]).length,h=0,g=0;g<m;g++)a(t[g-h])&&(u.push(splice(t).call(t,g-h,1)[0]),h+=1);return u}(u.loginClients,(function(a){return a.clientId===t.clientId&&a.consid===t.consid})),0===filter(a=u.loginClients).call(a,(function(a){return a.clientId===t.clientId})).length}));g.length>0&&this.auth.emit("onLoginClientChanged",t,g)}},t.checkAutoLogin=function checkAutoLogin(t){if(t)return!1;var a=uu.localStorage.getItem(this.lastLoginClientKey);if(!a)return!1;var u="",m="";try{var h=JSON.parse(a);u=get(h,"clientId"),m=get(h,"account")}catch(t){return!1}return u===this.auth.deviceId&&m===this.auth.account},t.checkLoginTerminalCode=function checkLoginTerminalCode(t){var a=[jl.V2NIM_ERROR_CODE_CANCELLED,jl.V2NIM_ERROR_CODE_TIMEOUT,jl.V2NIM_ERROR_CODE_HANDSHAKE,302,317,jl.V2NIM_ERROR_CODE_FORBIDDEN,jl.V2NIM_ERROR_CODE_NOT_FOUND,jl.V2NIM_ERROR_CODE_PARAMETER_ERROR,jl.V2NIM_ERROR_CODE_MULTI_LOGIN_FORBIDDEN,422,jl.V2NIM_ERROR_CODE_IM_DISABLED,jl.V2NIM_ERROR_CODE_APPKEY_NOT_EXIST,jl.V2NIM_ERROR_CODE_BUNDLEID_CHECK_FAILED,jl.V2NIM_ERROR_CODE_APPKEY_BLOCKED,jl.V2NIM_ERROR_CODE_INVALID_TOKEN,jl.V2NIM_ERROR_CODE_ROBOT_NOT_ALLOWED,jl.V2NIM_ERROR_CODE_ACCOUNT_NOT_EXIST,jl.V2NIM_ERROR_CODE_ACCOUNT_BANNED,jl.V2NIM_ERROR_CODE_USER_PROFILE_NOT_EXIST];return includes(a).call(a,t)},t.reset=function reset(){this.loginClients=[],this.loginClientOfThisConnection={}},t.clearLastLoginClient=function clearLastLoginClient(){uu.localStorage.removeItem(this.lastLoginClientKey)},V2NIMLoginAuthenticator}(),nm=function(){function V2NIMLoginLifeCycle(t){this.name="V2NIMLoginLifeCycle",this.loginStatus=0,this.connectStatus=0,this.core=t,this.auth=t.V2NIMLoginService,this.logger=t.logger}var t=V2NIMLoginLifeCycle.prototype;return t.processEvent=function processEvent(t,a,u){var m=this.getConnectStatus();switch(t){case"addressing":this.logger.log(this.name+"::addressing"),this.setLoginStatus(2),this.setConnectStatus(2);break;case"connect":this.logger.log(this.name+"::connecting"),this.setLoginStatus(2),this.setConnectStatus(2);break;case"connectSucc":this.logger.log(this.name+"::connect success"),this.setLoginStatus(2),this.setConnectStatus(1);break;case"connectFail":this.logger.log(this.name+"::connect fail",a),this.setLoginStatus(3),this.setConnectStatus(0,a);break;case"connectionBroken":this.logger.log(this.name+"::connectionBroken:",a),this.setLoginStatus(3),this.setConnectStatus(0,a),this.core.eventBus.emit("V2NIMLoginService/loginLifeCycleDisconnected",a);break;case"loginSucc":this.logger.log(this.name+"::login success, verify authentication success"),this.setLoginStatus(1),this.core.eventBus.emit("V2NIMLoginService/loginLifeCycleLoginSucc",u);break;case"loginFail":if(this.logger.log(this.name+"::login fail due to verify authentication failed:",a),!a)return;this.setLoginStatus(this.auth.authenticator.checkLoginTerminalCode(a.code)?0:3),this.setConnectStatus(0,a),this.auth.emit("onLoginFailed",a);break;case"logout":this.logger.log(this.name+"::logout"),this.setLoginStatus(0),this.setConnectStatus(0),this.core.eventBus.emit("V2NIMLoginService/loginLifeCycleLogout");break;case"kicked":this.logger.log(this.name+"::kicked",u),this.setLoginStatus(0),this.setConnectStatus(0,a),this.core.eventBus.emit("V2NIMLoginService/loginLifeCycleKicked");break;case"exited":this.logger.log(this.name+"::exited",a),this.setLoginStatus(0),this.setConnectStatus(0,a);break;case"waiting":this.logger.log(this.name+"::waiting to reconnect"),this.setLoginStatus(3),this.setConnectStatus(3),2!==m&&this.auth.reconnect.attempToReLogin()}},t.getConnectStatus=function getConnectStatus(){return this.connectStatus},t.getLoginStatus=function getLoginStatus(){return this.loginStatus},t.setLoginStatus=function setLoginStatus(t){t!==this.loginStatus&&(this.loginStatus=t,this.auth.emit("onLoginStatus",t))},t.setConnectStatus=function setConnectStatus(t,a){if(t!==this.connectStatus){var u=this.connectStatus;this.connectStatus=t,this.auth.emit("onConnectStatus",t),this.delegateConnectEvent(u,t,a)}},t.delegateConnectEvent=function delegateConnectEvent(t,a,u){1===t&&0===a&&u&&this.auth.emit("onDisconnected",u),2===t&&0===a&&u&&this.auth.emit("onConnectFailed",u)},V2NIMLoginLifeCycle}(),am=function(){function V2NIMLoginDataSync(t){this.core=t,this.auth=t.V2NIMLoginService,this.datas=[]}var t=V2NIMLoginDataSync.prototype;return t.switchDataSync=function switchDataSync(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u,m,h,g,M,I,S;return lu.wrap((function _callee$(T){for(;;)switch(T.prev=T.next){case 0:m=t.type,h=t.state,g=t.error,M=t.subType,I=filter(a=this.datas).call(a,(function(t){return t.type===m&&t.subType===M})),I.length>0?(I[0].state=h,I[0].error=g):this.datas.push({type:m,state:h,subType:M}),S=every(u=this.datas).call(u,(function(t){return 3===t.state})),1===m&&(2===h&&"mainSync"===M?(this.core.eventBus.emit("V2NIMLoginService/syncing"),this.auth.emit("onDataSync",m,h)):3===h&&S&&(this.core.eventBus.emit("V2NIMLoginService/syncDone",g),this.auth.emit("onDataSync",m,h,g)));case 5:case"end":return T.stop()}}),_callee,this)})))},t.checkSyncing=function checkSyncing(){var t;return some(t=this.datas).call(t,(function(t){return"mainSync"===t.subType&&2===t.state}))},t.reset=function reset(){this.datas=[]},V2NIMLoginDataSync}();function pick(t,a){t=t||{};var u={};return forEach$1(a=a||[]).call(a,(function(a){void 0!==t[a]&&(u[a]=t[a])})),u}var im={retryCount:{type:"number",min:0,required:!1},forceMode:{type:"boolean",required:!1},authType:{type:"enum",values:[0,1,2],required:!1},syncLevel:{type:"enum",values:[1,0],required:!1},routeConfig:{type:"object",required:!1,rules:{routeEnabled:{type:"boolean",required:!1},routeEnvironment:{type:"string",required:!1}}}},om=["https://lbs.netease.im/lbs/webconf.jsp"],sm={retryCount:3,timeout:6e4,forceMode:!1,authType:0,syncLevel:0},cm=function(t){function V2NIMLoginServiceImpl(a,u){var m,h;return void 0===u&&(u={}),(m=t.call(this,"V2NIMLoginService",a)||this).account="",m.previousLoginAccount="",m.token="",m.deviceId="",m.clientSession="",m.processId="",m.kickedDetail=null,m.binaryWebsocket=!0,m.core._registerDep(Sp,"misc"),registerParser({cmdMap:bp,cmdConfig:Rp}),"v2"===a.options.apiVersion&&(registerParser({cmdMap:Ep,cmdConfig:Ap}),m.core.auth=Qe(m)),m.previousLoginManager=new Yu,m.doLoginStepsManager=new Yu,m.loginTimerManager=new iu,m.loginOption=Ut({},sm),m.config={lbsUrls:om,linkUrl:"weblink.netease.im:443",linkSSL:!0},m.setOptions(u),a.V2NIMLoginService=Qe(m),!1!==m.core.options.binaryWebsocket&&"function"==typeof Uint8Array?(m.binaryWebsocket=!0,h=new Xp(m.core)):(m.binaryWebsocket=!1,h=new Zp(m.core)),m.clientSocket=h,"v2"===m.core.options.apiVersion&&(m.core.clientSocket=h),m.lifeCycle=new nm(a),m.reconnect=new em(a),m.lbs=new tm(a),m.authenticator=new rm(a),m.dataSync=new am(a),m}wt(V2NIMLoginServiceImpl,t);var a=V2NIMLoginServiceImpl.prototype;return a.setOptions=function setOptions(t){var a,u,m;validate({lbsUrls:{type:"array",itemType:"string",min:1,required:!1},linkUrl:{type:"string",allowEmpty:!1,required:!1}},t,"",!0),this.config=assignOptions(this.config,t),null===(u=null===(a=this.core.clientSocket)||void 0===a?void 0:a.setLinkSSL)||void 0===u||u.call(a,null===(m=this.config.linkSSL)||void 0===m||m);var h="",g="";this.config.isFixedDeviceId?(h=uu.localStorage.getItem("__NIM_DEVC_ID__")||Gu(),g=uu.localStorage.getItem("__NIM_CLIENT_SESSION_ID__")||Gu(),uu.localStorage.setItem("__NIM_DEVC_ID__",h),uu.localStorage.setItem("__NIM_CLIENT_SESSION_ID__",g)):(h=Gu(),g=Gu()),this.deviceId=h,this.clientSession=g,this.core.reporter.setConfig({common:{dev_id:h}})},a.reset=function reset(){this.account="",this.token="",this.processId="",this.lbs.reset(),this.reconnect.destroy(),this.authenticator.reset(),this.authenticator.clearLastLoginClient(),this.dataSync.reset()},a.login=function login(t,a,u){return void 0===u&&(u={}),__awaiter(this,void 0,void 0,lu.mark((function _callee(){var m,h,g=this;return lu.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:if(this._checkApiVersion(),m=uu.getSystemInfo()||{},h=m.os?m.os.toLowerCase():"","React Native"!==uu.platform||"android"!==h||!this.hasSettingService||!get(this.core.V2NIMSettingService,"push.offlinePushPlugin")){M.next=13;break}return M.prev=4,M.next=7,this.core.V2NIMSettingService.push.getRNDeviceInfo();case 7:this.deviceInfo=M.sent,M.next=13;break;case 10:M.prev=10,M.t0=M.catch(4),this.logger.error(M.t0);case 13:if("string"==typeof t&&""!==trim$2(t).call(t)){M.next=15;break}throw new Yl({detail:{reason:"Account must be string"}});case 15:if(validate(im,u,"",!0),0!==(u=assignOptions(sm,u)).authType||a){M.next=19;break}throw new Yl({detail:{reason:"When authType is 0, token cannot be empty"}});case 19:if(""!==this.previousLoginAccount&&this.previousLoginAccount!==t&&this.core._clearModuleData(),0!==this.getLoginStatus()){M.next=24;break}this.logger.log("V2NIMLoginService::login:allowLogin:"+t,u),M.next=30;break;case 24:if(1!==this.getLoginStatus()){M.next=28;break}return M.abrupt("return",this.smoothForLogined(t,a,u));case 28:if(2!==this.getLoginStatus()){M.next=30;break}return M.abrupt("return",this.smoothForLogining(t,a,u));case 30:return this.account=t,this.previousLoginAccount=t,this.token=a,this.processId=Gu(),this.loginOption=assignOptions(sm,u),this.kickedDetail=null,this.loginTimerManager.destroy(),this.loginTimerManager.addTimer((function(){var t=new Wl({code:jl.V2NIM_ERROR_CODE_TIMEOUT,detail:{reason:"Login API timeout"}});g.doLoginStepsManager.clear(t),g.previousLoginManager.clear(t),g.originLoginPromise=void 0,g.lifeCycle.processEvent("exited",t)}),this.loginOption.timeout>0?this.loginOption.timeout:6e4,1),M.prev=38,M.next=41,this.multiTryDoLogin();case 41:this.loginTimerManager.destroy(),M.next=48;break;case 44:throw M.prev=44,M.t1=M.catch(38),this.loginTimerManager.destroy(),M.t1;case 48:case"end":return M.stop()}}),_callee,this,[[4,10],[38,44]])})))},a.setAppVisibility=function setAppVisibility(){this.logger.warn("V2NIMLoginService::setAppVisibility is deprecated @v10.9.40")},a.getChatroomLinkAddress=function getChatroomLinkAddress(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u;return lu.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:return validate({roomId:{type:"string",regExp:/^\d+$/,required:!0,allowEmpty:!1},miniProgram:{type:"boolean",required:!1}},{roomId:t,miniProgram:a},"",!0),a=void 0===a?pendingIsMiniappEnv():a,m.next=4,this.clientSocket.sendCmd("v2GetChatroomLinkAddress",{roomId:t,miniProgram:a});case 4:return u=m.sent,m.abrupt("return",u.content.linkAddress);case 6:case"end":return m.stop()}}),_callee2,this)})))},a.multiTryDoLogin=function multiTryDoLogin(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m,h;return lu.wrap((function _callee3$(g){for(;;)switch(g.prev=g.next){case 0:a=new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"loginFailed"}}),u=0;case 2:if(!(u<=this.loginOption.retryCount)){g.next=32;break}return m="V2NIMLoginService::times of login try: "+u,u>0?this.logger.warn(m):this.logger.log(m),g.prev=5,this.originLoginPromise=t||this.doLogin(!1),t=void 0,g.next=10,this.previousLoginManager.add(this.originLoginPromise);case 10:return h=g.sent,this.core.reporter.reportTraceEnd("login",!0),this.doLoginStepsManager.clear(),this.previousLoginManager.clear(),this.originLoginPromise=void 0,g.abrupt("return",h);case 18:if(g.prev=18,g.t0=g.catch(5),a=g.t0||a,this.logger.error("V2NIMLoginService::login failed, times of login try: "+u+", err.code: "+(null==a?void 0:a.code)+', err.message: "'+(null==a?void 0:a.message)+'"'),a.code!==jl.V2NIM_ERROR_CODE_CANCELLED&&this.core.reporter.reportTraceEnd("login",!1),this.reconnect.clearReconnectTimer(),!this.checkLoginTerminalCode(a&&a.code)){g.next=28;break}throw this.lifeCycle.processEvent("exited",a),a;case 28:a&&399===a.code&&this.lbs.reset();case 29:u++,g.next=2;break;case 32:throw this.lifeCycle.processEvent("exited",a),a;case 34:case"end":return g.stop()}}),_callee3,this,[[5,18]])})))},a.doLogin=function doLogin(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var m,h,g;return lu.wrap((function _callee4$(M){for(;;)switch(M.prev=M.next){case 0:return m=!!t||this.authenticator.checkAutoLogin(this.loginOption.forceMode),this.core.reporter.reportTraceCancel("login"),this.core.reporter.reportTraceStart("login",m?{user_id:this.account,action:"auto_login",process_id:this.processId,binary_websocket:this.binaryWebsocket}:{user_id:this.account,action:"manual_login",process_id:this.processId,binary_websocket:this.binaryWebsocket}),this.core.reporter.reportTraceUpdateV2("login",{code:0,description:Vn(this.loginOption),operation_type:"conf_init",succeed:!0,duration:0,target:""},{asyncParams:uu.net.getNetworkStatus()}),M.next=6,this.doLoginStepsManager.add(this.lbs.getLbsInfos());case 6:return h=M.sent,M.next=9,this.doLoginStepsManager.add(this.clientSocket.connect(h,t));case 9:return M.next=11,this.doLoginStepsManager.add(this.authenticator.verifyAuthentication(m));case 11:if(g=M.sent,this.processId=Gu(),this.clientSocket.resetSocketConfig(),this.reconnect.reset(),this.dataSync.reset(),this.lifeCycle.processEvent("loginSucc",void 0,Ut(Ut({},g),{isReconnect:t})),this.clientSocket.ping(),this.core.abtest.abtRequest(),"function"==typeof(null===(a=this.core.V2NIMClientAntispamUtil)||void 0===a?void 0:a.downloadLocalAntiSpamVocabs)&&this.core.V2NIMClientAntispamUtil.downloadLocalAntiSpamVocabs(),"function"!=typeof(null===(u=this.core.cloudStorage)||void 0===u?void 0:u.init)){M.next=29;break}return M.prev=21,M.next=24,this.core.cloudStorage.init(g.timestamp);case 24:M.next=29;break;case 26:M.prev=26,M.t0=M.catch(21),this.logger.warn("doLogin::cloudStorage init error",M.t0);case 29:return M.abrupt("return",g);case 30:case"end":return M.stop()}}),_callee4,this,[[21,26]])})))},a.smoothForLogined=function smoothForLogined(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var m;return lu.wrap((function _callee5$(h){for(;;)switch(h.prev=h.next){case 0:if(m=this.checkIsSameLogin(t,a,u),this.logger.warn("V2NIMLoginService::smoothForLogined:Logined, isSameLogin "+m),!m){h.next=6;break}return h.abrupt("return");case 6:return h.next=8,this.logout();case 8:return h.abrupt("return",this.login(t,a,u));case 9:case"end":return h.stop()}}),_callee5,this)})))},a.smoothForLogining=function smoothForLogining(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var m;return lu.wrap((function _callee6$(h){for(;;)switch(h.prev=h.next){case 0:if(m=this.checkIsSameLogin(t,a,u),this.logger.warn("V2NIMLoginService::smoothForLogining:Logining progress exists, abort the previous login attempt and start next attempt, isSameLogin "+m),this.previousLoginManager.clear(),this.reconnect.reset(),this.account=t,this.previousLoginAccount=t,this.token=a,this.loginOption=assignOptions(this.loginOption,u),!m){h.next=18;break}if(this.originLoginPromise){h.next=11;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"NoPreviousLoginExists"}});case 11:return this.reconnect.reset(),h.next=14,$i.resolve();case 14:return h.next=16,this.multiTryDoLogin(this.originLoginPromise);case 16:h.next=25;break;case 18:return this.doLoginStepsManager.clear(),this.clientSocket.doDisconnect(Kp.ACTIVE,"Aborted"),this.reset(),this.lifeCycle.processEvent("logout"),h.next=24,$i.resolve();case 24:return h.abrupt("return",this.login(t,a,u));case 25:case"end":return h.stop()}}),_callee6,this)})))},a.checkIsSameLogin=function checkIsSameLogin(t,a,u){return this.account===t&&this.loginOption.authType===u.authType&&(0!==u.authType||this.token===a)},a.logout=function logout(){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var t,a;return lu.wrap((function _callee7$(u){for(;;)switch(u.prev=u.next){case 0:this._checkApiVersion(),this.doLoginStepsManager.clear(),this.previousLoginManager.clear(),this.loginTimerManager.destroy(),this.originLoginPromise=void 0,t=this.getConnectStatus(),a=this.getLoginStatus(),u.t0=a,u.next=1===u.t0?10:2===u.t0?25:3===u.t0?29:0===u.t0?33:35;break;case 10:return u.prev=10,u.next=13,this.clientSocket.sendCmd("v2Logout",void 0,{timeout:1e3});case 13:this.clientSocket.doDisconnect(Kp.ACTIVE,"UserActiveDisconnect"),this.core._clearModuleData(),this.lifeCycle.processEvent("logout"),u.next=24;break;case 18:u.prev=18,u.t1=u.catch(10),this.logger.error("Instance::disconnect sendCmd:logout error",u.t1),this.clientSocket.doDisconnect(Kp.ACTIVE,"UserActiveDisconnect"),this.core._clearModuleData(),this.lifeCycle.processEvent("logout");case 24:return u.abrupt("break",37);case 25:case 29:return this.clientSocket.doDisconnect(Kp.ACTIVE,"UserActiveDisconnect"),this.core._clearModuleData(),this.lifeCycle.processEvent("logout"),u.abrupt("break",37);case 33:throw this.core._clearModuleData(),new Wl({code:jl.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:"Illegal logout. loginStatus "+a+". connectStatus "+t}});case 35:throw this.core._clearModuleData(),new Wl({code:jl.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:"Illegal logout. illegal status: loginStatus "+a+". connectStatus "+t}});case 37:case"end":return u.stop()}}),_callee7,this,[[10,18]])})))},a.getConnectStatus=function getConnectStatus(){return this.lifeCycle.getConnectStatus()},a.getLoginStatus=function getLoginStatus(){return this.lifeCycle.getLoginStatus()},a.getLoginUser=function getLoginUser(){return this.account},a.getLoginClients=function getLoginClients(){var t;return map$6(t=function uniqBy(t,a){t=t||[],a=a||"";for(var u=[],m=[],h=0;h<t.length;h++){var g=t[h][a];-1===indexOf(m).call(m,g)&&(m.push(g),u.push(t[h]))}return u}(this.authenticator.loginClients,"clientId")).call(t,(function(t){return pick(t,["type","os","timestamp","customTag","customClientType","clientId","clientIP"])}))},a.getCurrentLoginClient=function getCurrentLoginClient(){var t;if(null===(t=this.authenticator.loginClientOfThisConnection)||void 0===t?void 0:t.clientId)return pick(this.authenticator.loginClientOfThisConnection,["type","os","timestamp","customTag","customClientType","clientId","clientIP"])},a.getDataSync=function getDataSync(){var t=this.dataSync.datas;return t&&t.length>0?map$6(t).call(t,(function(t){return{type:t.type,state:t.state}})):null},a.setReconnectDelayProvider=function setReconnectDelayProvider(t){this.reconnect._setReconnectDelayProvider(t)},a.kickOffline=function kickOffline(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a;return lu.wrap((function _callee8$(u){for(;;)switch(u.prev=u.next){case 0:return this._checkApiVersion(),validate({clientId:{type:"string",allowEmpty:!1}},t,"",!0),u.next=4,this.clientSocket.sendCmd("v2KickOffline",{clientIds:[t.clientId]});case 4:if(a=u.sent,0!==get(a,"content.clientIds.length")){u.next=8;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_REQUEST_FAILED});case 8:case"end":return u.stop()}}),_callee8,this)})))},a.getKickedOfflineDetail=function getKickedOfflineDetail(){return this.kickedDetail},a.checkLoginTerminalCode=function checkLoginTerminalCode(t){return this.authenticator.checkLoginTerminalCode(t)},a.checkIllegalState=function checkIllegalState(){if(!this.getLoginUser())throw new Wl({code:jl.V2NIM_ERROR_CODE_ILLEGAL_STATE})},a._checkApiVersion=function _checkApiVersion(){if("v2"!==this.core.options.apiVersion)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:'apiVersion is not "v2"'}})},a.v2LoginHandler=function v2LoginHandler(t){if(t.error)throw this.clientSocket.doDisconnect(Kp.ACTIVE,t.error),t.error;return t},a.v2LoginClientChangeHandler=function v2LoginClientChangeHandler(t){this.authenticator.changeLoginClient(Bu(t.content.state),t.content.datas)},a.nimLoginClientChangeHandler=function nimLoginClientChangeHandler(t){this.authenticator.changeLoginClient(Bu(t.content.state),t.content.datas)},a.qchatLoginClientChangeHandler=function qchatLoginClientChangeHandler(t){var a=Bu(t.content.state);a=1===a?2:3,this.authenticator.changeLoginClient(a,[t.content.data])},a.v2BeKickedHandler=function v2BeKickedHandler(t){if(t.error)this.core.logger.error("v2BeKickedHandler error, ",t.error);else{var a=function formatBeKickedTag(t){return format({reason:{type:"number"},clientType:{type:"number"},customClientType:{type:"number"}},t)}(t.content);this.core.logger.warn("v2Bekicked::",a),this.kickedDetail=a,this.clientSocket.doDisconnect(Kp.KICKED,a),this.core._clearModuleData(),this.lifeCycle.processEvent("kicked",new Wl({code:jl.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"disconnect due to kicked"}}),a),this.emit("onKickedOffline",a)}},a.emit=function emit(a){for(var u,m,h=this.name+"::emit "+a.toString(),g=arguments.length,M=new Array(g>1?g-1:0),I=1;I<g;I++)M[I-1]=arguments[I];if("onLoginFailed"===a||"onDisconnected"===a||"onConnectFailed"===a){var S=M[0];this.logger.log(""+h,S.toString())}else if("onDataSync"===a){var T=M[2];this.logger.log(""+h,M[0],M[1],T&&T.toString())}else{var C,b;(C=this.logger).log.apply(C,concat(b=[""+h]).call(b,M))}return(u=t.prototype.emit).call.apply(u,concat(m=[this,a]).call(m,M))},Ye(V2NIMLoginServiceImpl,[{key:"hasSettingService",get:function get(){var t;return!!(null===(t=this.core.V2NIMSettingService)||void 0===t?void 0:t.name)}}]),V2NIMLoginServiceImpl}(gp),lm=R("".startsWith),um=R("".slice),dm=Math.min,pm=correctIsRegexpLogic("startsWith");_export({target:"String",proto:!0,forced:!pm},{startsWith:function startsWith(t){var a=toString(requireObjectCoercible(this));notARegexp(t);var u=toLength(dm(arguments.length>1?arguments[1]:void 0,a.length)),m=toString(t);return lm?lm(a,m,u):um(a,u,u+m.length)===m}});var mm=entryVirtual("String").startsWith,hm=String.prototype,startsWith=function(t){var a=t.startsWith;return"string"==typeof t||t===hm||$(hm,t)&&a===hm.startsWith?mm:a},gm=function(){function V2NIMConversationIdUtilImpl(t){this.name="V2NIMConversationIdUtil",this.core=t}var t=V2NIMConversationIdUtilImpl.prototype;return t.conversationId=function conversationId(t,a){return this.core.account+"|"+t+"|"+a},t.p2pConversationId=function p2pConversationId(t){return this.core.account+"|1|"+t},t.teamConversationId=function teamConversationId(t){return this.core.account+"|2|"+t},t.superTeamConversationId=function superTeamConversationId(t){return this.core.account+"|3|"+t},t.messageConversationId=function messageConversationId(t){return 1===t.conversationType?t.senderId===this.core.account?this.p2pConversationId(t.receiverId):this.p2pConversationId(t.senderId):2===t.conversationType?this.teamConversationId(t.receiverId):this.superTeamConversationId(t.receiverId)},t.parseConversationType=function parseConversationType(t){try{if(t&&startsWith(t).call(t,this.core.account+"|")){var a=t.replace(this.core.account+"|","");return Number(a[0])}return this.core.logger.warn("conversationId is not start with "+this.core.account),0}catch(t){return 0}},t.parseConversationTargetId=function parseConversationTargetId(t){try{if(t&&startsWith(t).call(t,this.core.account+"|")){var a=t.replace(this.core.account+"|","");return slice(a).call(a,2)}return this.core.logger.warn("conversationId is not start with "+this.core.account),""}catch(t){return""}},t.convertToV1ConversationId=function convertToV1ConversationId(t){var a=this.parseConversationType(t);return(1===a?"p2p":2===a?"team":"superTeam")+"|"+this.parseConversationTargetId(t)},V2NIMConversationIdUtilImpl}(),vm=entryVirtual("Array").keys,fm=Array.prototype,ym={DOMTokenList:!0,NodeList:!0},keys=function(t){var a=t.keys;return t===fm||$(fm,t)&&a===fm.keys||de(ym,Sr(t))?vm:a},Mm=function(){function V2NIMMessageModelImpl(){this.messages=new _c,this.capacity=1e4}var t=V2NIMMessageModelImpl.prototype;return t.reset=function reset(){this.messages.clear()},t.getMessageById=function getMessageById(t){if(t)return this.messages.get(t)},t.getMessagesByConversationId=function getMessagesByConversationId(t){var a,u=[];return forEach$1(a=this.messages).call(a,(function(a){a.conversationId===t&&u.push(a)})),u},t.getLastMessageOfConversation=function getLastMessageOfConversation(t){var a=this.getMessagesByConversationId(t);if(0!==a.length)return reduce(a).call(a,(function(t,a){return a.createTime>t.createTime?a:t}),a[0])},t.upsertMessages=function upsertMessages(t){var a=this;forEach$1(t).call(t,(function(t){a.setLRU(t.messageClientId,t)}))},t.setLRU=function setLRU(t,a){if(this.messages.has(t))this.messages.delete(t);else if(this.messages.size>=this.capacity){var u,m=keys(u=this.messages).call(u).next().value;m&&this.messages.delete(m)}this.messages.set(t,a)},t.deleteMessage=function deleteMessage(t){this.messages.delete(t)},t.deleteMessages=function deleteMessages(t,a){var u,m=this;forEach$1(u=this.messages).call(u,(function(u){t===u.conversationId&&(!a||a&&u.createTime<a)&&m.messages.delete(u.messageClientId)}))},V2NIMMessageModelImpl}(),Im={accountId:{type:"string",allowEmpty:!1},content:{type:"object",required:!1,rules:{msg:{type:"string",allowEmpty:!1},type:{type:"number",allowEmpty:!1}}},messages:{type:"array",required:!1,rules:{msg:{type:"string",allowEmpty:!1},type:{type:"number"},role:{type:"enum",values:["assistant","user","system"]}}},promptVariables:{type:"jsonstr",required:!1},modelConfigParams:{type:"object",required:!1,rules:{prompt:{type:"string",required:!1},maxTokens:{type:"number",required:!1},topP:{type:"number",required:!1},temperature:{type:"number",required:!1}}},aiStream:{type:"boolean",required:!1}},_m=Ut({requestId:{type:"string",allowEmpty:!1}},Im),Sm={requestId:{type:"string",allowEmpty:!1},accountId:{type:"string",allowEmpty:!1}},Tm=[1,3,2,0],Cm=[2,7,12,100,6,1,-1,4,5,11,0,10,3],bm={routeEnabled:{type:"boolean",required:!1},routeEnvironment:{type:"string",required:!1}},Em={pushEnabled:{type:"boolean",required:!1},pushNickEnabled:{type:"boolean",required:!1},pushContent:{type:"string",required:!1},pushPayload:{type:"string",required:!1},forcePush:{type:"boolean",required:!1},forceContent:{type:"string",required:!1},forcePushAccountIds:{type:"array",required:!1,itemType:"string"}},km={antispamEnabled:{type:"boolean",required:!1},antispamBusinessId:{type:"string",required:!1},antispamCustomMessage:{type:"string",required:!1},antispamCheating:{type:"string",required:!1},antispamExtension:{type:"string",required:!1}},Rm={messageConfig:{type:"object",required:!1,rules:{readReceiptEnabled:{type:"boolean",required:!1},lastMessageUpdateEnabled:{type:"boolean",required:!1},historyEnabled:{type:"boolean",required:!1},roamingEnabled:{type:"boolean",required:!1},onlineSyncEnabled:{type:"boolean",required:!1},offlineEnabled:{type:"boolean",required:!1},unreadEnabled:{type:"boolean",required:!1}}},routeConfig:{type:"object",required:!1,rules:bm},pushConfig:{type:"object",required:!1,rules:Em},antiSpamConfig:{type:"object",required:!1,rules:km},robotConfig:{type:"object",required:!1,rules:{accountId:{type:"string",required:!1},topic:{type:"string",required:!1},function:{type:"string",required:!1},customContent:{type:"string",required:!1}}},aiConfig:{type:"object",required:!1,rules:Im},targetConfig:{type:"object",required:!1,rules:{receiverIds:{type:"array",itemType:"string"},inclusive:{type:"boolean"},newMemberVisible:{type:"boolean",required:!1}}},clientAntispamEnabled:{type:"boolean",required:!1},clientAntispamReplace:{type:"string",required:!1}},Am={message:{type:"object",rules:{text:{type:"string",required:!1},messageType:{type:"enum",values:Cm},messageClientId:{type:"string",allowEmpty:!1}}},params:{type:"object",rules:Rm,required:!1},replyMessage:{type:"object",rules:{conversationType:{type:"enum",values:[1,3,2,0]},receiverId:{type:"string",allowEmpty:!1},senderId:{type:"string",allowEmpty:!1},messageClientId:{type:"string",allowEmpty:!1},messageServerId:{type:"string",allowEmpty:!1},createTime:{type:"number"}}}},wm={conversationId:{type:"string",allowEmpty:!1},message:{type:"object",rules:{text:{type:"string",required:!1},messageType:{type:"enum",values:Cm},messageClientId:{type:"string",allowEmpty:!1},attachment:{type:"object",required:!1,rules:{file:{type:"file",required:!1}}}}},params:{type:"object",required:!1,rules:Rm}},Nm={message:{type:"object",rules:{messageClientId:{type:"string",allowEmpty:!1},messageServerId:{type:"string",allowEmpty:!1},conversationType:{type:"enum",values:Tm},createTime:{type:"number"}}},params:{type:"object",rules:{postscript:{type:"string",required:!1},serverExtension:{type:"string",required:!1},pushContent:{type:"string",required:!1},pushPayload:{type:"string",required:!1},env:{type:"string",required:!1}},required:!1}},xm={conversationId:{type:"string",allowEmpty:!1},messageTypes:{type:"array",required:!1,itemType:"enum",values:Cm},beginTime:{type:"number",required:!1},endTime:{type:"number",required:!1},limit:{type:"number",min:1,required:!1},direction:{type:"enum",values:[1,0],required:!1},anchorMessage:{type:"object",required:!1,rules:{messageServerId:{type:"string",allowEmpty:!1},createTime:{type:"number"}}}},Om={conversationType:{type:"enum",values:Tm},receiverId:{type:"string",allowEmpty:!1},senderId:{type:"string",allowEmpty:!1},messageServerId:{type:"string",allowEmpty:!1},messageClientId:{type:"string",allowEmpty:!1}},Pm={messageRefers:{type:"array",required:!0,rules:Om}},Lm={conversationId:{type:"string",allowEmpty:!1},conversationType:{type:"enum",values:Tm},receiverId:{type:"string",allowEmpty:!1},senderId:{type:"string",allowEmpty:!1},messageClientId:{type:"string",allowEmpty:!1},createTime:{type:"number"}},Vm={messages:{type:"array",rules:Lm}},Um={conversationId:{type:"string",allowEmpty:!1},serverExtension:{type:"string",required:!1},onlineSync:{type:"boolean",required:!1},deleteRoam:{type:"boolean",required:!1},clearMode:{type:"enum",values:[0,1,2],required:!1}},Dm={serverExtension:{type:"string",required:!1}},qm={messageClientId:{type:"string",allowEmpty:!1},conversationType:{type:"enum",values:[1]},receiverId:{type:"string",allowEmpty:!1},createTime:{type:"number"}},Bm={messages:{type:"array",rules:{messageClientId:{type:"string",allowEmpty:!1},conversationType:{type:"enum",values:[2]},receiverId:{type:"string",allowEmpty:!1},createTime:{type:"number"}},min:1}},Fm={voiceUrl:{type:"string",required:!1,allowEmpty:!1},file:{type:"file",required:!1},voicePath:{type:"string",required:!1,allowEmpty:!1},mimeType:{type:"string",required:!1,allowEmpty:!1},sampleRate:{type:"string",required:!1,allowEmpty:!1},duration:{type:"number",required:!0,min:0},sceneName:{type:"string",required:!1}},Gm={message:{type:"object",rules:{conversationType:{type:"enum",values:Tm},receiverId:{type:"string",allowEmpty:!1},senderId:{type:"string",allowEmpty:!1},messageServerId:{type:"string",allowEmpty:!1},messageClientId:{type:"string",allowEmpty:!1},createTime:{type:"number"}}},index:{type:"number",min:1},serverExtension:{type:"string",required:!1},pushConfig:{type:"object",required:!1,rules:{pushEnabled:{type:"boolean",required:!1},needBadge:{type:"boolean",required:!1},title:{type:"string",required:!1,allowEmpty:!1},content:{type:"string",required:!1,allowEmpty:!1},pushPayload:{type:"string",required:!1,allowEmpty:!1}}}},Hm={messages:{type:"array",rules:{conversationType:{type:"enum",values:[1,3,2,0]},receiverId:{type:"string",allowEmpty:!1},senderId:{type:"string",allowEmpty:!1},messageServerId:{type:"string",allowEmpty:!1},messageClientId:{type:"string",allowEmpty:!1},createTime:{type:"number"}}}},jm={params:{type:"object",rules:{collectionType:{type:"number",min:1},collectionData:{type:"string",allowEmpty:!1},serverExtension:{type:"string",required:!1},uniqueId:{type:"string",required:!1}}}},$m={collections:{type:"array",min:1,rules:{collectionId:{type:"string",allowEmpty:!1},createTime:{type:"number"}}}},zm={serverExtension:{type:"string",required:!1},collection:{type:"object",rules:{collectionId:{type:"string",allowEmpty:!1},collectionType:{type:"number"},createTime:{type:"number"}}}},Wm={beginTime:{type:"number",required:!1},endTime:{type:"number",required:!1},limit:{type:"number",min:1,required:!1},direction:{type:"enum",required:!1,values:[1,0]},collectionType:{type:"number",required:!1},anchorCollection:{type:"object",required:!1,rules:{collectionId:{type:"string",allowEmpty:!1,required:!1},createTime:{type:"number",required:!1}}}},Km={keyword:{type:"string",allowEmpty:!1},beginTime:{type:"number",required:!1},endTime:{type:"number",required:!1},sortOrder:{type:"enum",values:[1,0],required:!1},conversationLimit:{type:"number",min:0,required:!1},messageLimit:{type:"number",min:1,required:!1},p2pAccountIds:{type:"array",required:!1,itemType:"string"},teamIds:{type:"array",required:!1,itemType:"string"},senderAccountIds:{type:"array",required:!1,itemType:"string"},messageTypes:{type:"array",required:!1,itemType:"enum",values:Cm},messageSubtypes:{type:"array",required:!1,itemType:"number"}},Ym={conversationId:{type:"string",required:!1,allowEmpty:!1},keywordList:{type:"array",required:!1,itemType:"string"},keywordMatchType:{type:"enum",values:[1,0],required:!1},senderAccountIds:{type:"array",required:!1,itemType:"string"},messageTypes:{type:"array",required:!1,itemType:"enum",values:Cm},messageSubtypes:{type:"array",required:!1,itemType:"number"},searchStartTime:{type:"number",required:!1},searchTimePeriod:{type:"number",required:!1},limit:{type:"number",min:1,required:!1},direction:{type:"enum",values:[0,1],required:!1},pageToken:{type:"string",required:!1}},Qm={message:{type:"object",rules:{receiverId:{type:"string",allowEmpty:!1},messageServerId:{type:"string",allowEmpty:!1},conversationType:{type:"enum",values:[2]}}}},Jm={messages:{type:"array",rules:{receiverId:{type:"string",allowEmpty:!1},messageServerId:{type:"string",allowEmpty:!1},conversationType:{type:"enum",values:[2]}},min:1}},Xm={sceneName:{type:"string",required:!1},name:{type:"string",required:!1}},Zm=Ut(Ut({},Xm),{duration:{type:"number",required:!1}}),eh=Ut(Ut({},Zm),{width:{type:"number",required:!1},height:{type:"number",required:!1}}),th=Ut(Ut({},Xm),{width:{type:"number",required:!1},height:{type:"number",required:!1}}),rh={messageRefer:{type:"object",required:!0,rules:Om},beginTime:{type:"number",required:!1},endTime:{type:"number",required:!1},limit:{type:"number",min:1,required:!1},direction:{type:"enum",values:[1,0],required:!1},excludeMessageServerId:{type:"string",required:!1,allowEmpty:!1}},nh={senderId:{type:"string",allowEmpty:!1},receiverId:{type:"string",allowEmpty:!1},createTime:{type:"number"},messageClientId:{type:"string",allowEmpty:!1},messageServerId:{type:"string",allowEmpty:!1}},ah={subType:{type:"number",min:0,required:!1},text:{type:"string",required:!1},attachment:{type:"object",required:!1},serverExtension:{type:"string",required:!1},routeConfig:{type:"object",required:!1,rules:bm},pushConfig:{type:"object",required:!1,rules:Em},antiSpamConfig:{type:"object",required:!1,rules:km},clientAntispamEnabled:{type:"boolean",required:!1},clientAntispamReplace:{type:"string",required:!1}},ih={messageClientId:{type:"string",allowEmpty:!1},messageServerId:{type:"string",allowEmpty:!1},createTime:{type:"number"},aiConfig:{type:"object",rules:Im}},oh={operationType:{type:"enum",values:[0,1,2]},updateContent:{type:"string",allowEmpty:!0,required:!1}},sh={operationType:{type:"enum",values:[2,1],required:!0}},ch=function(){function ReceiptUtil(t,a){this.p2pMessageReceipts={},this.core=t,this.service=a}var t=ReceiptUtil.prototype;return t.reset=function reset(){this.p2pMessageReceipts={}},t.sendP2PMessageReceipt=function sendP2PMessageReceipt(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(validate(qm,t,"",!0),t.senderId!==this.core.account){a.next=3;break}throw new Yl({detail:{reason:"sendP2PMessageReceipt. sender: "+t.senderId+" is not allowed to send msg receipt"}});case 3:return a.next=5,this.core.sendCmd("v2SendP2PMessageReceipt",{tag:{receiverId:t.senderId,messageClientId:t.messageClientId,createTime:t.createTime}});case 5:case"end":return a.stop()}}),_callee,this)})))},t.isPeerRead=function isPeerRead(t){if(1!==t.conversationType)return!1;if(t.senderId!==this.core.account)return!1;if(t.senderId===this.core.account&&t.receiverId===this.core.account)return!0;var a=this.core.V2NIMConversationIdUtil.messageConversationId(t),u=this.p2pMessageReceipts[a]||0;return t.createTime<=u},t.getP2PMessageReceipt=function getP2PMessageReceipt(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:if(validateConversationId(this.core.account,t),1===this.core.V2NIMConversationIdUtil.parseConversationType(t)){a.next=4;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getP2PMessageReceipt: conversationId is not p2p conversationId"}});case 4:return a.abrupt("return",{conversationId:t,timestamp:this.p2pMessageReceipts[t]||0});case 5:case"end":return a.stop()}}),_callee2,this)})))},t.getTeamMessageReceipts=function getTeamMessageReceipts(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m=this;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:if(validate(Jm,{messages:t},"",!0),!some(t).call(t,(function(t){return t.senderId!==m.core.account}))){h.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getTeamMessageReceipts: exist messages senderId is not current user"}});case 3:if(!some(t).call(t,(function(a){return a.receiverId!==t[0].receiverId}))){h.next=5;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"getTeamMessageReceipts: exist messages receiverId is not same"}});case 5:return h.next=7,this.core.sendCmd("v2GetTeamMessageReceipts",{tag:t});case 7:return u=h.sent,h.abrupt("return",map$6(a=u.content.data).call(a,(function(t){return Ut(Ut({},t),{conversationId:m.core.V2NIMConversationIdUtil.teamConversationId(t.receiverId)})})));case 9:case"end":return h.stop()}}),_callee3,this)})))},t.getTeamMessageReceiptDetail=function getTeamMessageReceiptDetail(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a;return lu.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:if(validate(Qm,{message:t},"",!0),t.senderId===this.core.account){u.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getTeamMessageReceiptDetail::senderId "+t.senderId+" incorrect"}});case 3:return u.next=5,this.core.sendCmd("v2GetTeamMessageReceiptDetail",{tag:t});case 5:return a=u.sent,u.abrupt("return",{readReceipt:{conversationId:this.core.V2NIMConversationIdUtil.teamConversationId(t.receiverId),messageClientId:t.messageClientId,messageServerId:t.messageServerId,readCount:a.content.readAccountList.length,unreadCount:a.content.unreadAccountList.length},readAccountList:a.content.readAccountList,unreadAccountList:a.content.unreadAccountList});case 7:case"end":return u.stop()}}),_callee4,this)})))},t.sendTeamMessageReceipts=function sendTeamMessageReceipts(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a=this;return lu.wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:if(!some(t).call(t,(function(a){return a.conversationId!==t[0].conversationId}))){u.next=2;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"getTeamMessageReceipts: conversationId not same"}});case 2:if(validate(Bm,{messages:t},"",!0),!some(t).call(t,(function(t){return t.senderId===a.core.account}))){u.next=5;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getTeamMessageReceipts: exist messages senderId is not current user"}});case 5:return u.next=7,this.core.sendCmd("v2SendTeamMessageReceipts",{tag:t});case 7:return u.abrupt("return");case 8:case"end":return u.stop()}}),_callee5,this)})))},t.syncP2PMessagReceiptsHandler=function syncP2PMessagReceiptsHandler(t){var a,u=this,m=map$6(a=t.content.data).call(a,(function(t){var a=u.core.V2NIMConversationIdUtil.p2pConversationId(t.senderId),m=t.createTime;return u.p2pMessageReceipts[a]=m,{conversationId:a,timestamp:m}}));this.service.emit("onReceiveP2PMessageReadReceipts",m)},t.onP2PMessageReceiptsHandler=function onP2PMessageReceiptsHandler(t){var a=this.core.V2NIMConversationIdUtil.p2pConversationId(t.content.data.senderId),u=t.content.data.createTime;this.p2pMessageReceipts[a]=u,this.service.emit("onReceiveP2PMessageReadReceipts",[{conversationId:a,timestamp:u}])},t.onTeamMessageReceiptsHandler=function onTeamMessageReceiptsHandler(t){var a,u=this,m=map$6(a=t.content.data).call(a,(function(t){return{conversationId:u.core.V2NIMConversationIdUtil.teamConversationId(t.receiverId),messageServerId:t.messageServerId,messageClientId:t.messageClientId,readCount:t.readCount,unreadCount:t.unreadCount,latestReadAccount:t.latestReadAccount}}));this.service.emit("onReceiveTeamMessageReadReceipts",m)},ReceiptUtil}(),lh={"31_1":"v2TeamCreate","32_1":"v2SuperTeamCreate","31_5":"v2TeamInviteMembers","32_5":"v2SuperTeamInviteMembers","31_6":"v2TeamKickMembers","32_6":"v2SuperTeamKickMembers","31_8":"v2TeamLeave","32_7":"v2SuperTeamLeave","31_7":"v2TeamUpdateInfo","32_8":"v2SuperTeamUpdateInfo","31_9":"v2TeamGetInfo","32_9":"v2SuperTeamGetInfo","31_12":"v2TeamDismiss","32_4":"v2SuperTeamDismiss","31_13":"v2TeamApplyToJoin","32_20":"v2SuperTeamApplyToJoin","31_14":"v2TeamAcceptJoinApplication","32_21":"v2SuperTeamAcceptJoinApplication","31_15":"v2TeamRejectJoinApplication","32_22":"v2SuperTeamRejectJoinApplication","31_16":"v2TeamAddManagers","32_26":"v2SuperTeamAddManagers","31_17":"v2TeamRemoveManagers","32_27":"v2SuperTeamRemoveManagers","31_18":"v2TeamTransferOwner","32_31":"v2SuperTeamTransferOwner","31_19":"v2TeamUpdateSelfMemberInfo","32_10":"v2SuperTeamUpdateSelfMemberInfo","31_20":"v2TeamUpdateMember","32_30":"v2SuperTeamUpdateMember","31_21":"v2TeamAcceptInvitation","32_23":"v2SuperTeamAcceptInvitation","31_22":"v2TeamRejectInvite","32_24":"v2SuperTeamRejectInvite","31_33":"v2TeamGetMemberInvitor","32_35":"v2SuperTeamGetMemberInvitor","31_25":"v2TeamMemberSetChatBannedStatus","32_29":"v2SuperTeamMemberSetChatBannedStatus","31_32":"v2TeamSetChatBannedMode","32_28":"v2SuperTeamSetChatBannedMode","31_34":"v2TeamGetByIds","32_36":"v2SuperTeamGetByIds","31_35":"v2TeamMemberGetListByIds","32_37":"v2SuperTeamMemberGetListByIds","31_36":"v2TeamMemberGetList","8_101":"v2TeamCreateMultiSync","8_109":"v2TeamSync","8_119":"v2TeamMemberUpdateMultiSync","8_126":"v2TeamMembersOfSelfInSync","21_101":"v2SuperTeamCreateMultiSync","21_109":"v2SuperTeamSync","21_110":"v2SuperTeamMemberUpdateMultiSync","21_111":"v2SuperTeamMembersOfSelfInSync"},uh={antispamBusinessId:1},dh="V2NIMTeamService",ph={teamId:1,name:3,teamType:{id:4,retConverter:function retConverter(t){return 0==+t?1:+t}},ownerAccountId:5,memberLimit:{id:6,retType:"number"},isValidTeam:{id:8,retConverter:function retConverter(t,a){return 1==+t&&(void 0===a[13]||1==+a[13])}},memberCount:{id:9,retType:"number"},memberUpdateTime:{id:10,retType:"number"},createTime:{id:11,retType:"number"},updateTime:{id:12,retType:"number"},intro:14,announcement:15,joinMode:{id:16,retType:"number"},serverExtension:18,customerExtension:19,avatar:20,agreeMode:{id:21,retType:"number"},inviteMode:{id:22,retType:"number"},updateInfoMode:{id:23,retType:"number"},updateExtensionMode:{id:24,retType:"number"},chatBannedMode:{id:101,retType:"number"}},mh={teamId:1,accountId:3,memberRole:{id:4,retType:"number"},teamNick:5,bits:{id:7,retType:"number"},inTeam:{id:9,retType:"boolean"},joinTime:{id:10,retType:"number"},updateTime:{id:11,retType:"number"},serverExtension:12,chatBanned:{id:13,retType:"boolean"},invitorAccountId:14,followAccountIds:{id:16,retConverter:function retConverter(t){try{return JSON.parse(t)}catch(t){return[]}}}},gh={teamId:1,accountId:3,memberRole:{id:4,retType:"number"},teamNick:5,bits:{id:7,retType:"number"},inTeam:{id:9,retType:"boolean"},updateTime:{id:11,retType:"number"},serverExtension:12,chatBanned:{id:13,retType:"boolean"},invitorAccountId:14,joinTime:{id:15,retType:"number"},followAccountIds:{id:17,retConverter:function retConverter(t){try{return JSON.parse(t)}catch(t){return[]}}}},vh={accountIds:{id:1,converter:function converter(t){return Vn(t)}},operation:2},fh={v2TeamCreate:{sid:31,cid:1,service:dh,params:[{type:"Property",name:"team",reflectMapper:ph},{type:"StrArray",name:"inviteeAccountIds"},{type:"String",name:"postscript"},{type:"Property",name:"antispamConfig",reflectMapper:uh}],response:[{type:"Property",name:"team",reflectMapper:invertSerializeItem(ph)},{type:"StrArray",name:"failedList"}]},v2SuperTeamCreate:{sid:32,cid:1,service:dh,params:[{type:"Property",name:"team",reflectMapper:ph},{type:"StrArray",name:"inviteeAccountIds"},{type:"String",name:"postscript"},{type:"Property",name:"antispamConfig",reflectMapper:uh}],response:[{type:"Property",name:"team",reflectMapper:invertSerializeItem(ph)},{type:"StrArray",name:"failedList"}]},v2TeamInviteMembers:{sid:31,cid:5,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"},{type:"String",name:"ps"},{type:"String",name:"attach"}],response:[{type:"Long",name:"time"},{type:"StrArray",name:"abortedAccidList"}]},v2SuperTeamInviteMembers:{sid:32,cid:5,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"},{type:"String",name:"ps"},{type:"String",name:"attach"}],response:[{type:"StrArray",name:"abortedAccidList"},{type:"Long",name:"time"}]},v2TeamUpdateInfo:{sid:31,cid:7,service:dh,params:[{type:"Property",name:"team",reflectMapper:ph},{type:"Property",name:"antispamConfig",reflectMapper:uh}],response:[{type:"Long",name:"teamId"},{type:"Long",name:"timestamp"}]},v2SuperTeamUpdateInfo:{sid:32,cid:8,service:dh,params:[{type:"Property",name:"team",reflectMapper:ph},{type:"Property",name:"antispamConfig",reflectMapper:uh}],response:[{type:"Long",name:"timestamp"}]},v2TeamLeave:{sid:31,cid:8,service:dh,params:[{type:"Long",name:"teamId"}]},v2SuperTeamLeave:{sid:32,cid:7,service:dh,params:[{type:"Long",name:"teamId"}]},v2TeamGetInfo:{sid:31,cid:9,service:dh,params:[{type:"Long",name:"teamId"}],response:[{type:"Property",name:"team",reflectMapper:invertSerializeItem(ph)}]},v2SuperTeamGetInfo:{sid:32,cid:9,service:dh,params:[{type:"Long",name:"teamId"}],response:[{type:"Property",name:"team",reflectMapper:invertSerializeItem(ph)}]},v2TeamGetByIds:{sid:31,cid:34,service:dh,params:[{type:"LongArray",name:"teamIds"}],response:[{type:"PropertyArray",name:"teams",reflectMapper:invertSerializeItem(ph)},{type:"LongArray",name:"tids"}]},v2SuperTeamGetByIds:{sid:32,cid:36,service:dh,params:[{type:"LongArray",name:"teamIds"}],response:[{type:"PropertyArray",name:"teams",reflectMapper:invertSerializeItem(ph)},{type:"LongArray",name:"tids"}]},v2TeamDismiss:{sid:31,cid:12,service:dh,params:[{type:"Long",name:"teamId"}]},v2SuperTeamDismiss:{sid:32,cid:4,service:dh,params:[{type:"Long",name:"teamId"}]},v2TeamAcceptInvitation:{sid:31,cid:21,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}],response:[{type:"Property",name:"team",reflectMapper:invertSerializeItem(ph)}]},v2SuperTeamAcceptInvitation:{sid:32,cid:23,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}],response:[{type:"Property",name:"team",reflectMapper:invertSerializeItem(ph)}]},v2TeamRejectInvite:{sid:31,cid:22,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},v2SuperTeamRejectInvite:{sid:32,cid:24,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},v2TeamKickMembers:{sid:31,cid:6,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},v2SuperTeamKickMembers:{sid:32,cid:6,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},v2TeamApplyToJoin:{sid:31,cid:13,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"ps"}],response:[{type:"Property",name:"team",reflectMapper:invertSerializeItem(ph)},{type:"Int",name:"isInTeam"}]},v2SuperTeamApplyToJoin:{sid:32,cid:20,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"ps"}],response:[{type:"Property",name:"team",reflectMapper:invertSerializeItem(ph)},{type:"Int",name:"isInTeam"}]},v2TeamAcceptJoinApplication:{sid:31,cid:14,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},v2SuperTeamAcceptJoinApplication:{sid:32,cid:21,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},v2TeamRejectJoinApplication:{sid:31,cid:15,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},v2SuperTeamRejectJoinApplication:{sid:32,cid:22,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},v2TeamAddManagers:{sid:31,cid:16,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},v2SuperTeamAddManagers:{sid:32,cid:26,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},v2TeamRemoveManagers:{sid:31,cid:17,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},v2SuperTeamRemoveManagers:{sid:32,cid:27,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},v2TeamTransferOwner:{sid:31,cid:18,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"account"},{type:"Bool",name:"leave"}]},v2SuperTeamTransferOwner:{sid:32,cid:31,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"account"},{type:"Bool",name:"leave"}]},v2TeamUpdateSelfMemberInfo:{sid:31,cid:19,service:dh,params:[{type:"Property",name:"teamMember",reflectMapper:mh},{type:"Property",name:"specialFollowUpdate",reflectMapper:vh},{type:"Property",name:"antispam",reflectMapper:uh}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(mh)}]},v2SuperTeamUpdateSelfMemberInfo:{sid:32,cid:10,service:dh,params:[{type:"Property",name:"teamMember",reflectMapper:gh},{type:"Property",name:"specialFollowUpdate",reflectMapper:vh},{type:"Property",name:"antispam",reflectMapper:uh}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(gh)}]},v2TeamUpdateMember:{sid:31,cid:20,service:dh,params:[{type:"Property",name:"teamMember",reflectMapper:mh},{type:"Property",name:"antispam",reflectMapper:uh}]},v2SuperTeamUpdateMember:{sid:32,cid:30,service:dh,params:[{type:"Property",name:"teamMember",reflectMapper:gh},{type:"Property",name:"antispam",reflectMapper:uh}]},v2TeamGetMemberInvitor:{sid:31,cid:33,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}],response:[{type:"StrStrMap",name:"accountsMap"}]},v2SuperTeamGetMemberInvitor:{sid:32,cid:35,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}],response:[{type:"StrStrMap",name:"accountsMap"}]},v2TeamMemberSetChatBannedStatus:{sid:31,cid:25,service:dh,params:[{type:"Long",name:"teamId"},{type:"String",name:"accountId"},{type:"Int",name:"chatBanned"}]},v2SuperTeamMemberSetChatBannedStatus:{sid:32,cid:29,service:dh,params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accountId"},{type:"Int",name:"chatBanned"}]},v2TeamSetChatBannedMode:{sid:31,cid:32,service:dh,params:[{type:"Long",name:"teamId"},{type:"Int",name:"chatBannedMode"}]},v2SuperTeamSetChatBannedMode:{sid:32,cid:28,service:dh,params:[{type:"Long",name:"teamId"},{type:"Int",name:"chatBannedMode"}]},v2TeamMemberGetListByIds:{sid:31,cid:35,service:dh,params:[{type:"StrArray",name:"tag"}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(mh)}]},v2SuperTeamMemberGetListByIds:{sid:32,cid:37,service:dh,params:[{type:"StrArray",name:"tag"}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(gh)}]},v2TeamMemberGetList:{sid:31,cid:36,service:dh,params:[{type:"Property",name:"tag",reflectMapper:{teamId:1,teamType:2,roleQueryType:3,onlyChatBanned:{id:4,converter:function converter(t){return+t}},nextToken:5,limit:6,direction:7}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(mh)},{type:"Property",name:"pageInfo",reflectMapper:{1:"hasMore",2:"nextToken"}}]},v2TeamSync:{sid:8,cid:109,service:dh,response:[{type:"Long",name:"timetag"},{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(ph)}]},v2TeamCreateMultiSync:{sid:8,cid:101,service:dh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(ph)}]},v2TeamMemberUpdateMultiSync:{sid:8,cid:119,service:dh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(mh)}]},v2TeamMembersOfSelfInSync:{sid:8,cid:126,service:dh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(mh)},{type:"Long",name:"timetag"}]},v2SuperTeamSync:{sid:21,cid:109,service:dh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(ph)},{type:"Bool",name:"isAll"},{type:"Long",name:"timetag"}]},v2SuperTeamCreateMultiSync:{sid:21,cid:101,service:dh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(ph)}]},v2SuperTeamMemberUpdateMultiSync:{sid:21,cid:110,service:dh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(gh)}]},v2SuperTeamMembersOfSelfInSync:{sid:21,cid:111,service:dh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(gh)},{type:"Long",name:"timetag"}]}};function formatTeamNotificationAttachData(t,a){if(!t)return{};var u=t;return u.tinfo&&(u.tinfo=function formatTeamFromTinfo(t){return deserialize(t,invertSerializeItem(ph))}(u.tinfo),u.tinfo.teamType=a),u.uinfos,void 0!==u.mute&&(u.mute=Bu(u.mute)),u}function generateTeamByTeamId(t,a,u){return void 0===u&&(u={}),Ut({teamId:t,teamType:a,name:"",ownerAccountId:"",memberLimit:0,memberCount:0,createTime:0,updateTime:0,intro:"",announcement:"",avatar:"",joinMode:0,agreeMode:0,inviteMode:0,updateInfoMode:0,updateExtensionMode:0,chatBannedMode:0,isValidTeam:!0},u)}function generateMemberByTeamId(t,a,u,m){return void 0===m&&(m={}),Ut({teamId:t,teamType:a,accountId:u,joinTime:0,inTeam:!0,memberRole:0,chatBanned:!1},m)}function processTeamMembers(t,a){return void 0===a&&(a=1),map$6(t).call(t,(function(t){return function processTeamMember(t,a){return void 0===a&&(a=1),t.teamType=a,t.chatBanned=void 0!==t.chatBanned&&t.chatBanned,t}(t,a)}))}function completeMessage(t,a,u){var m,h=Ut(Ut({},a),{conversationId:t.V2NIMConversationIdUtil.messageConversationId(a),isSelf:a.senderId===t.account,sendingState:1,messageStatus:{errorCode:(null===(m=null==a?void 0:a.messageStatus)||void 0===m?void 0:m.errorCode)||200},messageSource:u||0});if(h.threadReply&&(h.threadReply=Ut(Ut({},h.threadReply),{conversationType:h.conversationType,conversationId:h.conversationId})),h.threadRoot&&(h.threadRoot=Ut(Ut({},h.threadRoot),{conversationType:h.conversationType,conversationId:h.conversationId})),h.isInBlackList&&(h.sendingState=2,h.messageStatus.errorCode=jl.V2NIM_ERROR_CODE_ACCOUNT_IN_BLOCK_LIST,delete h.isInBlackList),h.streamConfig){var g=get(h.streamConfig,"isStream");if(!1===g)delete h.streamConfig;else if(!0===g&&void 0===h.streamConfig.status)delete h.streamConfig,a.aiConfig&&(a.aiConfig.aiStream=!0,a.aiConfig.aiStreamStatus=0);else if("number"==typeof h.streamConfig.status)return h.streamConfig={status:h.streamConfig.status},function completeMessageStreamConfig(t){t.streamConfig&&t.aiConfig&&(t.aiConfig.aiStream=!0,t.aiConfig.aiStreamStatus=t.streamConfig.status);if(t.attachment&&t.streamConfig){var a=t.attachment;t.streamConfig.lastChunk={content:a.msg,messageTime:t.createTime,chunkTime:a.timestamp,type:a.type,index:a.index},t.aiConfig&&(t.aiConfig.aiStreamLastChunk=t.streamConfig.lastChunk),delete t.attachment}return t}(h)}return formatMessageAttachment(h,t)}function formatMessageAttachment(t,a){return 5===t.messageType?function formatNotificationMessage(t,a){var u,m,h,g,M,I=a.attachment||{};if(a.attachment&&"type"in a.attachment)return a;var S=void 0;if(null===(u=I.data)||void 0===u?void 0:u.tinfo){var T=I.id,C=I.data,b=T>400?2:1,E=formatTeamNotificationAttachData(Ut({},C),b).tinfo;S={},E.teamId,S=__rest(E,["teamId"])}var k=Ut(Ut(Ut(Ut({raw:I.raw,type:convertNotificationType(t,I.id)},S?{updatedTeamInfo:S}:{}),{targetIds:(null===(m=I.data)||void 0===m?void 0:m.ids)||((null===(h=I.data)||void 0===h?void 0:h.id)?[I.data.id]:[])}),"string"==typeof(null===(g=I.data)||void 0===g?void 0:g.attach)?{serverExtension:I.data.attach}:{}),"number"==typeof(null===(M=I.data)||void 0===M?void 0:M.mute)?{chatBanned:0!==I.data.mute}:{});return Ut(Ut({},a),{attachment:k})}(a,t):100===t.messageType?function formatCustomMessage(t,a){var u,m,h;if("string"==typeof(null===(u=a.attachment)||void 0===u?void 0:u.raw)&&(null===(h=null===(m=t.V2NIMMessageService)||void 0===m?void 0:m.customAttachmentParsers)||void 0===h?void 0:h.length)>0){var g=a.subType||0,M=t.V2NIMMessageService.customAttachmentParsers,I=a.attachment.raw;some(M).call(M,(function(u){try{var m=u(g,I);if(isPlainObject(m))return m.raw=I,a.attachment=m,!0}catch(a){return t.logger.warn("customAttachmentParser: subType "+g+", raw: "+I+". parse error with "+a),!1}return!1}))}return a}(a,t):t}function completeMessageRefer(t,a){return Ut(Ut({},a),{conversationId:t.V2NIMConversationIdUtil.messageConversationId(a)})}function formatMessageRefer(t,a){var u=a.createTime,m=a.senderId,h=a.receiverId,g=a.conversationType;return{conversationType:g,conversationId:t.V2NIMConversationIdUtil.messageConversationId({conversationType:g,senderId:m,receiverId:h}),senderId:a.senderId,receiverId:a.receiverId,messageServerId:a.messageServerId,createTime:u,messageClientId:a.messageClientId}}function formatRevokeMessage(t,a){var u={7:1,8:2,12:3,13:1,14:2}[a.sysMsgType];return{postscript:a.postscript,revokeType:{7:1,8:2,12:3,13:4,14:5}[a.sysMsgType]||0,revokeAccountId:a.opeAccount||a.senderId,callbackExtension:a.callbackExtension,serverExtension:a.attach||"",messageRefer:{conversationType:u,conversationId:t.V2NIMConversationIdUtil.messageConversationId(Ut(Ut({},a),{conversationType:u,senderId:a.senderId,receiverId:a.receiverId})),senderId:a.senderId,receiverId:a.receiverId,messageServerId:a.messageServerId,createTime:a.deleteMsgCreatetime,messageClientId:a.messageClientId}}}function formatClearHistoryNotification(t,a){return{conversationId:1===a.conversationType?t.V2NIMConversationIdUtil.p2pConversationId(a.receiverId):2===a.conversationType?t.V2NIMConversationIdUtil.teamConversationId(a.teamId):t.V2NIMConversationIdUtil.superTeamConversationId(a.teamId),deleteTime:a.deleteTime,serverExtension:a.serverExtension}}function convertNotificationType(t,a){var u={0:0,401:401,1:1,402:402,2:2,403:403,3:3,404:404,4:4,405:405,5:5,410:410,6:6,406:406,7:7,407:407,8:8,408:408,9:9,411:411,10:10,409:409};return void 0===u[a]&&t.logger.warn("[V2NIMMessageService] undefined notification type: "+a),"number"==typeof u[a]?u[a]:-1}function formatSearchCloudMessageListEx(t,a){var u=[],m={};for(var h in forEach$1(a).call(a,(function(t){var a=t.conversationId;m[a]||(m[a]={conversationId:a,messages:[],count:0}),m[a].messages.push(t),m[a].count++})),m){var g=m[h];u.push(g)}return u}function attachmentToRaw(t,a){if(!a)return"";switch(t){case 100:return a.raw||"";case 1:case 3:case 2:case 6:return function mediaAttachmentToRaw(t){var a=t,u=a.width,m=a.height,h=a.duration;a.path,a.file,a.raw,a.ctx,a.payload,a.bucketName,a.objectName,a.token;var g=a.ext,M=__rest(a,["width","height","duration","path","file","raw","ctx","payload","bucketName","objectName","token","ext"]),I="string"==typeof g&&"."===g[0]?slice(g).call(g,1):g;return Vn(Ut(Ut(Ut(Ut(Ut({},M),void 0===g?{}:{ext:I}),void 0===u?{}:{w:u}),void 0===m?{}:{h:m}),void 0===h?{}:{dur:h}))}(a);case 4:return function locationAttachmentToRaw(t){return Vn({lat:t.latitude,lng:t.longitude,title:t.address})}(a);case 12:return function callAttachmentToRaw(t){t.raw;var a=__rest(t,["raw"]);try{var u;return Vn(Ut(Ut({},a),{durations:map$6(u=t.durations).call(u,(function(t){return{accid:t.accountId,duration:t.duration}}))}))}catch(a){return Vn(t)}}(a);default:return a.raw||Vn(a)}}function rawToAttachment(t,a){var u;try{switch(u=JSON.parse(t),a){case 100:return{raw:t};case 4:return function locationRawToAttachment(t,a){return{latitude:a.lat,longitude:a.lng,address:a.title,raw:t}}(t,u);case 2:case 3:case 1:case 6:return function mediaRawToAttachment(t,a){var u=a.w,m=a.h,h=a.dur,g=a.ext,M=__rest(a,["w","h","dur","ext"]),I="string"==typeof g&&"."!==g[0]?"."+g:g;return Ut(Ut(Ut(Ut(Ut(Ut({},M),void 0===g?{}:{ext:I}),void 0===u?{}:{width:u}),void 0===m?{}:{height:m}),void 0===h?{}:{duration:h}),{raw:t})}(t,u);case 12:return function callRawToAttachment(t,a){var u;return Ut(Ut({},a),{durations:map$6(u=a.durations).call(u,(function(t){return{accountId:t.accid,duration:t.duration}})),raw:t})}(t,u);default:return"object"==typeof u&&u?Ut(Ut({},u),{raw:t}):{raw:t}}}catch(a){return"object"==typeof u&&u?Ut(Ut({},u),{raw:t}):{raw:t}}}var yh=function(){function FileUtil(t){this.core=t}var t=FileUtil.prototype;return t.doSendFile=function doSendFile(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g,M,I,S,T;return lu.wrap((function _callee$(C){for(;;)switch(C.prev=C.next){case 0:return u=t.attachment,C.prev=1,C.next=4,this.core.V2NIMStorageService._uploadFile({taskId:t.messageClientId,uploadParams:{fileObj:(null==u?void 0:u.file)||(null==u?void 0:u.path),sceneName:null==u?void 0:u.sceneName}},a,{fileType:t.messageType});case 4:for(S in(h=C.sent)[0],g=h[1],M=Ut(Ut({},u),{uploadState:1}),void 0!==g.w&&(M.width=M.width||g.w),void 0!==g.h&&(M.height=M.height||g.h),void 0!==g.dur&&(M.duration=M.duration||g.dur),M.ext=M.ext&&-1===indexOf(m=M.ext).call(m,".")?"."+M.ext:M.ext,I=["w","h","dur","ext","name"],g)includes(I).call(I,S)||(M[S]=g[S]);M.raw,M.file,M.path,T=__rest(M,["raw","file","path"]),t.attachment=JSON.parse(Vn(T)),t.attachment&&(t.attachment.raw=attachmentToRaw(t.messageType,t.attachment)),C.next=23;break;case 19:throw C.prev=19,C.t0=C.catch(1),t.attachment&&(t.attachment.uploadState=2),C.t0;case 23:case"end":return C.stop()}}),_callee,this,[[1,19]])})))},t.cancelMessageAttachmentUpload=function cancelMessageAttachmentUpload(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a;return lu.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:if(validate({messageClientId:{type:"string",allowEmpty:!1}},t,"",!0),includes(a=[2,6,1,3]).call(a,t.messageType)){u.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"cancelMessageAttachmentUpload: messageType "+t.messageType+" incorrect"}});case 3:if(2!==t.sendingState&&1!==t.sendingState){u.next=5;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST,detail:{reason:"cancelMessageAttachmentUpload: message is already failed or succeeded"}});case 5:return u.next=7,this.core.V2NIMStorageService._cancelUploadFile(t.messageClientId);case 7:case"end":return u.stop()}}),_callee2,this)})))},FileUtil}(),Mh="V2NIMMessageService",Ih={"30_1":"v2SendP2pMessage","31_2":"v2SendTeamMessage","30_31":"v2MessageP2pModify","31_37":"v2MessageTeamModify","32_38":"v2MessageSuperTeamModify","7_33":"v2MessageOnModified","4_27":"v2MessageSyncModified","4_28":"v2MessageSuperTeamSyncModified","4_5":"v2BatchMarkRead","4_12":"syncP2PMessagReceipts","30_11":"v2SendP2PMessageReceipt","31_28":"v2SendTeamMessageReceipts","32_2":"v2SendSuperTeamMessage","7_12":"onP2PMessageReceipts","8_31":"onTeamMessageReceipts","31_29":"v2GetTeamMessageReceipts","31_30":"v2GetTeamMessageReceiptDetail","7_2":"onMsg","8_3":"onMsg","7_101":"onMsg","8_102":"onMsg","21_3":"onMsg","21_102":"onMsg","4_4":"syncOfflineMsgs","4_9":"syncRoamingMsgs","4_17":"syncRoamingMsgs","30_13":"v2RevokeMessage","32_17":"v2RevokeSuperTeamMessage","7_14":"onRevokeMessage","7_15":"syncRevokeMessage","21_18":"onRevokeMessage","21_117":"onRevokeMessage","30_23":"v2DeleteMessage","30_24":"v2DeleteMessages","4_21":"syncOnDeleteMessages","7_123":"onDeleteMessage","7_124":"onDeleteMessages","29_17":"v2DownloadLocalAntiSpamVocabs"};var _h={conversationType:{id:0,converter:conversationTypeV2ToV1,retConverter:conversationTypeV1ToV2},receiverId:1,senderId:2,fromClientType:4,fromDeviceId:5,fromNick:6,createTime:{id:7,retType:"number"},messageType:{id:8,retType:"number"},text:9,attachment:{id:10,converter:function converter(t,a){return attachmentToRaw(a.messageType,t)},retConverter:function retConverter(t,a){return rawToAttachment(t,Number(a[8]))}},messageClientId:11,messageServerId:12,resend:{id:13,converter:boolToInt,retType:"boolean"},userUpdateTime:{id:14,retType:"number"},serverExtension:15,pushPayload:{id:16,access:"pushConfig.pushPayload"},pushContent:{id:17,access:"pushConfig.pushContent"},forcePushAccountIds:{id:18,access:"pushConfig.forcePushAccountIds",def:function def(t){if(t["pushConfig.forcePush"])return"#%@all@%#"},converter:function converter(t,a){if(a["pushConfig.forcePush"])return t?Vn(t):"#%@all@%#"},retConverter:function retConverter(t){if("#%@all@%#"!==t&&t)try{return JSON.parse(t)}catch(t){return[]}}},forcePushContent:{id:19,access:"pushConfig.forcePushContent"},forcePush:{id:20,access:"pushConfig.forcePush",converter:boolToInt,retType:"boolean"},antispamCustomMessageEnabled:{id:21,def:function def(t){return get(t,"antispamConfig.antispamCustomMessage")?1:void 0},retConverter:function retConverter(){}},antispamCustomMessage:{id:22,access:"antispamConfig.antispamCustomMessage"},antispamBusinessId:{id:23,access:"antispamConfig.antispamBusinessId"},clientAntispamHit:{id:24,access:"clientAntispamHit",converter:boolToInt,retType:"boolean"},antispamEnabled:{id:25,access:"antispamConfig.antispamEnabled",converter:boolToInt,retType:"boolean"},needAck:{id:26,access:"messageConfig.readReceiptEnabled",converter:boolToInt,retType:"boolean"},lastMessageUpdateEnabled:{id:28,access:"messageConfig.lastMessageUpdateEnabled",converter:boolToInt,retType:"boolean"},threadReplySenderId:{id:29,access:"threadReply.senderId"},threadReplyReceiverId:{id:30,access:"threadReply.receiverId"},threadReplyTime:{id:31,access:"threadReply.createTime",retType:"number"},threadReplyServerId:{id:32,access:"threadReply.messageServerId"},threadReplyClientId:{id:33,access:"threadReply.messageClientId"},threadRootSenderId:{id:34,access:"threadRoot.senderId"},threadRootReceiverId:{id:35,access:"threadRoot.receiverId"},threadRootTime:{id:36,access:"threadRoot.createTime",retType:"number"},threadRootServerId:{id:37,access:"threadRoot.messageServerId"},threadRootClientId:{id:38,access:"threadRoot.messageClientId"},isDeleted:{id:39,converter:boolToInt,retType:"boolean"},callbackExtension:40,subType:{id:41,retType:"number"},antispamCheating:{id:42,access:"antispamConfig.antispamCheating"},routeEnvironment:{id:43,access:"routeConfig.routeEnvironment"},antispamExtension:{id:44,access:"antispamConfig.antispamExtension"},antispamResult:45,__clientExt:{id:46,converter:objectToJSONString,retConverter:stringToJSONObject},robotFunction:{id:47,access:"robotConfig.function"},robotTopic:{id:48,access:"robotConfig.topic"},robotCustomContent:{id:49,access:"robotConfig.customContent"},robotAccount:{id:50,access:"robotConfig.accountId"},_conversationOnlineSyncNotify:{id:51},_conversationOnlineSyncData:{id:52},aiAgentMsgDirection:{id:55,access:"aiConfig.aiStatus",retAccess:"aiConfig.aiStatus",retType:"number"},aiAgentAccount:{id:56,access:"aiConfig.accountId",retAccess:"aiConfig.accountId"},aiAgentContent:{id:57,access:"aiConfig.content",converter:objectToJSONString,retConverter:emptyFunc},aiAgentMessages:{id:58,access:"aiConfig.messages",converter:objectToJSONString,retConverter:emptyFunc},aiAgentPromptVariables:{id:59,access:"aiConfig.promptVariables",retConverter:emptyFunc},aiAgentModelConfigParams:{id:60,access:"aiConfig.modelConfigParams",converter:objectToJSONString,retConverter:emptyFunc},errorCode:{id:61,access:"messageStatus.errorCode",converter:emptyFunc,retType:"number"},modifyTime:{id:62,retType:"number"},modifyAccountId:63,aiStream:{id:65,access:"aiConfig.aiStream",retAccess:"streamConfig.isStream",converter:boolToInt,retConverter:intToBool},aiRAGs:{id:66,access:"aiConfig.aiRAGs",retConverter:function aiAgentStreamAIRAGsRetConverter$1(t){try{var a=JSON.parse(t);return a&&a.length>0?map$6(a).call(a,(function(t){return t.description=t.desc,delete t.desc,t})):[]}catch(t){return[]}}},aiStreamStatus:{id:67,access:"streamConfig.status",retType:"number"},historyEnabled:{id:100,access:"messageConfig.historyEnabled",converter:boolToInt,retType:"boolean"},roamingEnabled:{id:101,access:"messageConfig.roamingEnabled",converter:boolToInt,retType:"boolean"},onlineSyncEnabled:{id:102,access:"messageConfig.onlineSyncEnabled",converter:boolToInt,retType:"boolean"},routeEnabled:{id:105,access:"routeConfig.routeEnabled",converter:boolToInt,retType:"boolean"},isInBlackList:{id:106,access:"isInBlackList",converter:boolToInt,retType:"boolean"},pushEnable:{id:107,access:"pushConfig.pushEnabled",converter:boolToInt,retType:"boolean"},offlineEnabled:{id:108,access:"messageConfig.offlineEnabled",converter:boolToInt,retType:"boolean"},unreadEnabled:{id:109,access:"messageConfig.unreadEnabled",converter:boolToInt,retType:"boolean"},pushNickEnabled:{id:110,access:"pushConfig.pushNickEnabled",converter:boolToInt,retType:"boolean"},msgAckSnapshot:{id:112,retType:"number"},receiverIds:{id:154,access:"targetConfig.receiverIds",converter:objectToJSONString,retConverter:function retConverter(){}},inclusive:{id:155,access:"targetConfig.inclusive",converter:function converter(t){return t?1:2},retConverter:function retConverter(){}},newMemberVisible:{id:156,access:"targetConfig.newMemberVisible",converter:function converter(t){return t?1:2},retConverter:function retConverter(){}}},Sh=invertSerializeItem(_h),Th={conversationType:{id:1,access:"messageRefer.conversationType",retType:"number"},senderId:{id:2,access:"messageRefer.senderId"},receiverId:{id:3,access:"messageRefer.receiverId"},messageServerId:{id:4,access:"messageRefer.messageServerId"},messageClientId:{id:5,access:"messageRefer.messageClientId"},createTime:{id:6,access:"messageRefer.createTime",retType:"number"},deleteTime:{id:7,retType:"number"},serverExtension:8};invertSerializeItem(Th);var Ch={version:1,md5:2,nosurl:3,thesaurus:4},bh={createTime:{id:0,retType:"number"},sysMsgType:1,receiverId:2,senderId:3,postscript:4,attach:5,pushContent:8,pushPayload:9,messageClientId:10,messageServerId:11,deleteMsgCreatetime:{id:14,retType:"number"},opeAccount:16,env:21,callbackExtension:22},Eh={receiverId:0,messageServerId:1,readCount:{id:100,retType:"number"},unreadCount:{id:101,retType:"number"},messageClientId:102,latestReadAccount:103},kh={v2BatchMarkRead:{sid:4,cid:5,service:Mh,hasPacketResponse:!1,params:[{type:"Byte",name:"sid"},{type:"Byte",name:"cid"},{type:"LongArray",name:"ids"}]},v2SendP2pMessage:{sid:30,cid:1,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:_h}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},onMsg:{sid:7,cid:2,service:Mh,response:[{type:"Property",name:"msg",reflectMapper:invertSerializeItem(_h)}]},syncOfflineMsgs:{sid:4,cid:4,service:Mh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(_h)}]},syncRoamingMsgs:{sid:4,cid:9,service:Mh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(_h)}]},v2SendP2PMessageReceipt:{sid:30,cid:11,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:_h}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2RevokeMessage:{sid:30,cid:13,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:bh}]},v2DeleteMessage:{sid:30,cid:23,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:Th}],response:[{type:"Long",name:"timetag"}]},v2DeleteMessages:{sid:30,cid:24,service:Mh,params:[{type:"PropertyArray",name:"tag",reflectMapper:Th}],response:[{type:"Long",name:"timetag"}]},v2SendTeamMessage:{sid:31,cid:2,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:_h}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2SendTeamMessageReceipts:{sid:31,cid:28,service:Mh,params:[{type:"PropertyArray",name:"tag",reflectMapper:Eh}],response:[{type:"PropertyArray",name:"tag",reflectMapper:invertSerializeItem(Eh)}]},v2SendSuperTeamMessage:{sid:32,cid:2,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:_h}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2RevokeSuperTeamMessage:{sid:32,cid:17,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:bh}]},syncP2PMessagReceipts:{sid:4,cid:12,service:Mh,response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(_h)}]},onP2PMessageReceipts:{sid:7,cid:12,service:Mh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2GetTeamMessageReceipts:{sid:31,cid:29,service:Mh,params:[{type:"PropertyArray",name:"tag",reflectMapper:Eh}],response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(Eh)}]},v2GetTeamMessageReceiptDetail:{sid:31,cid:30,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:Eh,select:["receiverId","messageServerId"]}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Eh)},{type:"StrArray",name:"readAccountList"},{type:"StrArray",name:"unreadAccountList"}]},onTeamMessageReceipts:{sid:8,cid:31,service:Mh,response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(Eh)}]},onRevokeMessage:{sid:7,cid:14,service:Mh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(bh)}]},syncRevokeMessage:{sid:7,cid:15,service:Mh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(bh)}]},syncOnDeleteMessages:{sid:4,cid:21,service:Mh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Th)}]},onDeleteMessage:{sid:7,cid:123,service:Mh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Th)}]},onDeleteMessages:{sid:7,cid:124,service:Mh,response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(Th)}]},v2DownloadLocalAntiSpamVocabs:{sid:29,cid:17,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:Ch}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Ch)}]},v2MessageP2pModify:{sid:30,cid:31,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:_h}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2MessageTeamModify:{sid:31,cid:37,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:_h}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2MessageSuperTeamModify:{sid:32,cid:38,service:Mh,params:[{type:"Property",name:"tag",reflectMapper:_h}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2MessageOnModified:{sid:7,cid:33,service:Mh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2MessageSyncModified:{sid:4,cid:27,service:Mh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(_h)},{type:"Long",name:"time"}]},v2MessageSuperTeamSyncModified:{sid:4,cid:28,service:Mh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(_h)},{type:"Long",name:"time"}]}};function conversationTypeV2ToV1(t){return 1===t?0:2===t?1:3===t?5:void 0}function conversationTypeV1ToV2(t){var a=Bu(t);return 0===a?1:1===a?2:5===a?3:0}var Rh="V2NIMNotificationService",Ah={"30_7":"v2SendCustomNotification","32_16":"v2SendCustomNotificationWithSuperTeam","7_3":"onSysNotification","21_19":"onSysNotification","4_6":"v2SyncOfflineSysNotifications","4_18":"v2SyncOfflineSysNotifications","7_14":"v2NotificationRevoke","21_18":"v2NotificationRevoke","21_117":"v2NotificationRevoke","4_19":"v2NotificationSyncRevoke","7_15":"v2NotificationSyncRevoke","4_16":"syncBroadcastMsg","7_17":"onBroadcastMsg"},wh={timestamp:{id:0,retType:"number"},type:{id:1,retType:"number"},receiverId:2,senderId:3,postscript:4,content:5,idServer:6,offlineEnabled:{id:7,converter:boolToInt,retConverter:function retConverter(t,a){return"0"!==a[6]&&!!Bu(t)},access:"notificationConfig.offlineEnabled"},pushContent:{id:8,access:"pushConfig.pushContent"},pushPayload:{id:9,access:"pushConfig.pushPayload"},deletedIdClient:10,deletedIdServer:11,antispamEnabled:{id:12,converter:boolToInt,retType:"boolean",access:"antispamConfig.antispamEnabled"},antispamCustomNotification:{id:13,access:"antispamConfig.antispamCustomNotification"},deletedMsgCreateTime:14,deletedMsgFromNick:15,opeAccount:16,forcePushAccountIds:{id:18,access:"pushConfig.forcePushAccountIds",def:function def(t){if(101===t.type&&t["pushConfig.forcePush"])return"#%@all@%#"},converter:function converter(t,a){if(a["pushConfig.forcePush"])return t?Vn(t):"#%@all@%#"},retConverter:function retConverter(t){if("#%@all@%#"!==t&&t)try{return JSON.parse(t)}catch(t){return[]}}},forcePushContent:{id:19,access:"pushConfig.forcePushContent"},forcePush:{id:20,converter:boolToInt,retType:"boolean",access:"pushConfig.forcePush"},routeEnvironment:{id:21,access:"routeConfig.routeEnvironment"},callbackExt:22,clientNotificationId:{id:23,access:"notificationConfig.clientNotificationId"},conversationOnlineSyncNotify:24,conversationOnlineSyncData:25,routeEnabled:{id:105,converter:boolToInt,retType:"boolean",access:"routeConfig.routeEnabled"},pushEnabled:{id:107,converter:boolToInt,retType:"boolean",access:"pushConfig.pushEnabled"},unreadEnabled:{id:109,converter:boolToInt,retType:"boolean",access:"notificationConfig.unreadEnabled"},pushNickEnabled:{id:110,converter:boolToInt,retType:"boolean",access:"pushConfig.pushNickEnabled"}},Nh={id:1,senderId:2,timestamp:{id:4,retType:"number"},content:5},xh={v2SendCustomNotification:{sid:30,cid:7,service:Rh,params:[{type:"Property",name:"tag",reflectMapper:wh}]},v2SendCustomNotificationWithSuperTeam:{sid:32,cid:16,service:Rh,params:[{type:"Property",name:"tag",reflectMapper:wh}]},onSysNotification:{sid:7,cid:3,service:Rh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(wh)}]},syncBroadcastMsg:{sid:4,cid:16,service:Rh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Nh)}]},onBroadcastMsg:{sid:7,cid:17,service:Rh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Nh)}]},v2SyncOfflineSysNotifications:{sid:4,cid:9,service:Rh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(wh)}]},v2NotificationRevoke:{sid:7,cid:14,service:Rh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(wh)}]},v2NotificationSyncRevoke:{sid:7,cid:15,service:Rh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(wh)},{type:"Long",name:"timetag"},{type:"Byte",name:"type"}]}},Oh="YSFService",Ph={"4_5":"ysfBatchMarkRead","101_1":"ysfSendMessage","101_2":"ysfOnMsg","4_100":"ysfSyncOfflineMsgs","101_3":"ysfOnSysNotification","101_7":"ysfSendCustomNotification","4_101":"ysfSyncSysNotification"},Lh={ysfBatchMarkRead:{sid:4,cid:5,service:Oh,hasPacketResponse:!1,params:[{type:"Byte",name:"sid"},{type:"Byte",name:"cid"},{type:"LongArray",name:"ids"}]},ysfSendMessage:{sid:101,cid:1,service:Oh,params:[{type:"Property",name:"tag",reflectMapper:_h}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},ysfOnMsg:{sid:101,cid:2,service:Oh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(_h)}]},ysfSyncOfflineMsgs:{sid:4,cid:100,service:Oh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(_h)}]},ysfOnSysNotification:{sid:101,cid:3,service:Oh,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(wh)}]},ysfSendCustomNotification:{sid:101,cid:7,service:Oh,params:[{type:"Property",name:"tag",reflectMapper:wh}]},ysfSyncSysNotification:{sid:4,cid:101,service:Oh,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(wh)}]}},Vh={content:{type:"string",allowEmpty:!1},params:{type:"object",required:!1,rules:{notificationConfig:{type:"object",required:!1,rules:{offlineEnabled:{type:"boolean",required:!1},unreadEnabled:{type:"boolean",required:!1}}},pushConfig:{type:"object",required:!1,rules:{pushEnabled:{type:"boolean",required:!1},pushNickEnabled:{type:"boolean",required:!1},pushContent:{type:"string",required:!1},pushPayload:{type:"string",required:!1},forcePush:{type:"boolean",required:!1},forcePushContent:{type:"string",required:!1},forcePushAccountIds:{type:"array",required:!1,itemType:"string"}}},antispamConfig:{type:"object",required:!1,rules:{antispamEnabled:{type:"boolean",required:!1},antispamCustomNotification:{type:"string",required:!1}}},routeConfig:{type:"object",required:!1,rules:{routeEnabled:{type:"boolean",required:!1},routeEnvironment:{type:"string",required:!1}}}}}},Uh=function(){function NotificationUtil(t){this.core=t}return NotificationUtil.prototype.generateNotificationTag=function generateNotificationTag(t,a,u){var m;void 0===u&&(u={});var h=this.core.V2NIMConversationIdUtil.parseConversationType(t),g=this.core.V2NIMConversationIdUtil.parseConversationTargetId(t),M=eo(),I=((m={})[1]=100,m[2]=101,m[3]=103,m);return Ut(Ut({},u),{notificationConfig:Ut({unreadEnabled:!0,offlineEnabled:!0},null==u?void 0:u.notificationConfig),pushConfig:Ut({pushEnabled:!0,pushNickEnabled:!0},null==u?void 0:u.pushConfig),antispamConfig:Ut({antispamEnabled:!0},null==u?void 0:u.antispamConfig),routeConfig:Ut({routeEnabled:!0},null==u?void 0:u.routeConfig),timestamp:M,type:I[h],receiverId:g,content:a})},NotificationUtil}();function getFileOrPath(t){var a="object"==typeof t?t:void 0,u="string"==typeof t?t:void 0;if(!a&&!u)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"getFileOrPath::incorrect file and path"}});if("string"==typeof u)if(0===indexOf(u).call(u,"nim-external")){var m=document.getElementById(u);if(!(m&&m.files&&m.files[0]))throw new Wl({code:jl.V2NIM_ERROR_CODE_FILE_NOT_FOUND,detail:{reason:"getFileOrPath::file not exist: "+u}});a=m.files[0]}else if("BROWSER"===uu.platform)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"getFileOrPath::incorrect path: "+u}});if("object"==typeof a&&void 0===a.size)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"getFileOrPath::file no size"}});return{file:a,path:u}}var Dh,qh,Bh={attachment:{type:"object",rules:{url:{type:"string",allowEmpty:!1}}},thumbSize:{type:"object",rules:{width:{type:"number",required:!1,min:0},height:{type:"number",required:!1,min:0}}}},Fh=function(t){function V2NIMStorageUtil(a){var u;return(u=t.call(this,"V2NIMStorageUtil",a)||this).core=a,u}wt(V2NIMStorageUtil,t);var a=V2NIMStorageUtil.prototype;return a.imageThumbUrl=function imageThumbUrl(t,a){return t+"?imageView&thumbnail="+a+"z"+a},a.videoCoverUrl=function videoCoverUrl(t,a){return t+"?vframe&offset="+a},a.getImageThumbUrl=function getImageThumbUrl(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m;return lu.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validate(Bh,{attachment:u=t,thumbSize:a},"",!0),a.width=a.width||0,a.height=a.height||0,0===a.width&&0===a.height&&(a.width=150),m=u.url,h.prev=7,h.next=10,this.core.V2NIMStorageService.shortUrlToLong(u.url);case 10:m=h.sent,h.next=16;break;case 13:h.prev=13,h.t0=h.catch(7),this.core.logger.warn("shortUrlToLong error:",h.t0);case 16:return h.abrupt("return",{url:this.core.cloudStorage.getThumbUrl(m,a)});case 17:case"end":return h.stop()}}),_callee,this,[[7,13]])})))},a.getVideoCoverUrl=function getVideoCoverUrl(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u,m;return lu.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validate(Bh,{attachment:u=t,thumbSize:a},"",!0),a.width=a.width||0,a.height=a.height||0,0===a.width&&0===a.height&&(a.width=150),m=u.url,h.prev=7,h.next=10,this.core.V2NIMStorageService.shortUrlToLong(u.url);case 10:m=h.sent,h.next=16;break;case 13:h.prev=13,h.t0=h.catch(7),this.core.logger.warn("shortUrlToLong error:",h.t0);case 16:return h.abrupt("return",{url:this.core.cloudStorage.getVideoCoverUrl(m,a)});case 17:case"end":return h.stop()}}),_callee2,this,[[7,13]])})))},V2NIMStorageUtil}(gp),Gh={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)"}},Hh={accessKeyId:"",secretAccessKey:"",sessionToken:"",region:"",maxRetries:0,bucket:"",objectName:"",token:"",shortUrl:""};function getUploadResponseFormat(t){return void 0===t&&(t="file"),Vn(Gh[t]||{}).replace(/"/gi,'\\"')}!function(t){t[t.nos=1]="nos",t[t.s3=2]="s3"}(Dh||(Dh={})),function(t){t[t.dontNeed=-1]="dontNeed",t[t.time=2]="time",t[t.urls=3]="urls"}(qh||(qh={}));var jh={chunkUploadHost:"https://wannos-web.127.net",chunkUploadHostBackupList:["https://fileup.chatnos.com","https://oss.chatnos.com"],commonUploadHost:"https://fileup.chatnos.com",commonUploadHostBackupList:["https://oss.chatnos.com"],chunkMaxSize:4194304e4,commonMaxSize:104857600,uploadReplaceFormat:"https://{host}/{object}",cdn:{defaultCdnDomain:"nim-nosdn.netease.im",cdnDomain:"",bucket:"",objectNamePrefix:""},downloadUrl:"https://{bucket}-nosdn.netease.im/{object}",downloadHostList:["nos.netease.com"],nosCdnEnable:!0,isNeedToGetUploadPolicyFromServer:!0};function pickBy(t,a){t=t||{},a=a||function(){return!0};var u={};for(var m in t)a(t[m])&&(u[m]=t[m]);return u}var $h=function(){function NOS(t,a){this.nosCdnHostTimer=0,this.nosErrorCount=0,this.core=t,this.cloudStorage=a}var t=NOS.prototype;return t.reset=function reset(){this.nosErrorCount=0},t.getNosAccessToken=function getNosAccessToken(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u,m;return lu.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.core.sendCmd("getNosAccessToken",{tag:t});case 2:return a=h.sent,u=get(a,"content.nosAccessTokenTag.token"),m=t.url,h.abrupt("return",{token:u,url:-1!==indexOf(m).call(m,"?")?m+"&token="+u:m+"?token="+u});case 6:case"end":return h.stop()}}),_callee,this)})))},t.deleteNosAccessToken=function deleteNosAccessToken(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.core.sendCmd("deleteNosAccessToken",{tag:t});case 2:case"end":return a.stop()}}),_callee2,this)})))},t.nosUpload=function nosUpload(t,a){var u,m,h,g,M,I,S,T;return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var C,b,E,k,R,A,w,N,x,O,P,L,V,U,D,q,B,G,H;return lu.wrap((function _callee3$(j){for(;;)switch(j.prev=j.next){case 0:if(C=get(this.core,"config.cdn.bucket"),b={tag:t.nosScenes||C||"nim"},t.nosSurvivalTime&&(b.expireSec=t.nosSurvivalTime),E=this.core.adapters.getFileUploadInformation(t),!(!a&&!E)){j.next=18;break}return j.prev=6,j.next=9,this.core.sendCmd("getNosToken",{responseBody:getUploadResponseFormat(t.type),nosToken:b});case 9:k=j.sent,j.next=18;break;case 12:if(j.prev=12,j.t0=j.catch(6),this.core.logger.error("uploadFile:: getNosToken error",j.t0),!(j.t0 instanceof Wl)){j.next=17;break}throw j.t0;case 17:throw new Jl({code:"v2"===get(this.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"getNosToken error",rawError:j.t0,curProvider:1}});case 18:return R=this.config.uploadReplaceFormat.replace("{host}",this.config.cdn.cdnDomain||this.config.cdn.defaultCdnDomain).replace("{object}",E?null===(u=E.uploadInfo)||void 0===u?void 0:u.objectName:a?null==a?void 0:a.objectName:k.content.nosToken.objectName),A="",a&&a.shortUrl&&(A=a.shortUrl),(null===(g=null===(h=null===(m=null==E?void 0:E.uploadInfo)||void 0===m?void 0:m.payload)||void 0===h?void 0:h.mixStoreToken)||void 0===g?void 0:g.shortUrl)&&(A=E.uploadInfo.payload.mixStoreToken.shortUrl),w=A||R,j.prev=23,x=E?{token:null===(M=null==E?void 0:E.uploadInfo)||void 0===M?void 0:M.token,bucket:null===(I=null==E?void 0:E.uploadInfo)||void 0===I?void 0:I.bucketName,objectName:null===(S=null==E?void 0:E.uploadInfo)||void 0===S?void 0:S.objectName}:a||k.content.nosToken,this.core.logger.log("uploadFile:: uploadFile params",{nosToken:x,chunkUploadHost:this.config.chunkUploadHost,chunkUploadHostBackupList:this.config.chunkUploadHostBackupList,commonUploadHost:this.config.commonUploadHost,commonUploadHostBackupList:this.config.commonUploadHostBackupList,platform:uu.platform}),O="BROWSER"===uu.platform?this.config.chunkUploadHost:this.config.commonUploadHost+"/"+(x&&x.bucket),this.core.reporterHookCloudStorage.update({remote_addr:O,operation_type:a?2:0}),j.next=30,this.core.adapters.uploadFile(Ut(Ut(Ut({},t),{nosToken:x,chunkUploadHost:this.config.chunkUploadHost,chunkUploadHostBackupList:this.config.chunkUploadHostBackupList,commonUploadHost:this.config.commonUploadHost,commonUploadHostBackupList:this.config.commonUploadHostBackupList,maxSize:t.maxSize||this.config.chunkMaxSize}),a?{payload:{mixStoreToken:a}}:{}));case 30:N=j.sent,j.next=65;break;case 33:if(j.prev=33,j.t1=j.catch(23),this.core.logger.error("uploadFile::nos uploadFile error:",j.t1),P="v2"===get(this.core,"options.apiVersion"),j.t1.code!==jl.V2NIM_ERROR_CODE_CANCELLED&&10499!==j.t1.errCode){j.next=39;break}throw new Jl({code:P?jl.V2NIM_ERROR_CODE_CANCELLED:400,detail:{reason:get(j.t1,"message")||"Request abort",rawError:j.t1,curProvider:1}});case 39:if(!P||j.t1.errCode!==jl.V2NIM_ERROR_CODE_FILE_OPEN_FAILED){j.next=41;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_FILE_OPEN_FAILED,detail:{reason:get(j.t1,"message")||"Read file failed",rawError:j.t1,curProvider:1}});case 41:return j.next=43,uu.net.getNetworkStatus();case 43:if(L=j.sent,!1!==L.net_connect){j.next=47;break}throw new Jl({code:"v2"===get(this.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"No network",rawError:j.t1,curProvider:1}});case 47:if(!a){j.next=64;break}if(!(this.nosErrorCount<=0)){j.next=60;break}j.prev=49,this.cloudStorage.mixStorage._addCircuitTimer(),j.next=56;break;case 53:throw j.prev=53,j.t2=j.catch(49),new Jl({code:"v2"===get(this.core,"options.apiVersion")?jl.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 56:return this.nosErrorCount=get(this.cloudStorage,"mixStorePolicy.nosPolicy.uploadConfig.retryPolicy.retry"),j.abrupt("return",this.cloudStorage._uploadFile(t));case 60:return this.nosErrorCount--,j.abrupt("return",this.nosUpload(t,a));case 62:j.next=65;break;case 64:throw new Jl({code:"v2"===get(this.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"NOS attempts failed",rawError:j.t1,curProvider:1}});case 65:if(V=null==N?void 0:N.type,(U=V&&indexOf(V).call(V,"/")>-1?slice(V).call(V,0,indexOf(V).call(V,"/")):"")||(U=t.type||""),(D={image:"imageInfo",video:"vinfo",audio:"vinfo"})[U]){j.next=71;break}return j.abrupt("return",Ut({url:w},N));case 71:return j.prev=71,j.next=74,this.core.adapters.request(R+"?"+D[U],{method:"GET",dataType:"json",timeout:5e3},{exception_service:3});case 74:q=j.sent,j.next=81;break;case 77:return j.prev=77,j.t3=j.catch(71),this.core.logger.error("uploadFile:: fetch file info error",j.t3),j.abrupt("return",Ut({url:w},N));case 81:if(!q){j.next=88;break}return B=q.data,G="imageInfo"===D[U]?B:null===(T=null==B?void 0:B.GetVideoInfo)||void 0===T?void 0:T.VideoInfo,H={url:w,name:N.name,size:N.size,ext:N.ext,w:null==G?void 0:G.Width,h:null==G?void 0:G.Height,orientation:null==G?void 0:G.Orientation,dur:null==G?void 0:G.Duration,audioCodec:null==G?void 0:G.AudioCodec,videoCodec:null==G?void 0:G.VideoCodec,container:null==G?void 0:G.Container},j.abrupt("return",pickBy(H,(function(t){return void 0!==t})));case 88:return j.abrupt("return",Ut({url:w},N));case 89:case"end":return j.stop()}}),_callee3,this,[[6,12],[23,33],[49,53],[71,77]])})))},t._getNosCdnHost=function _getNosCdnHost(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a,u,m,h=this;return lu.wrap((function _callee4$(g){for(;;)switch(g.prev=g.next){case 0:return g.prev=0,g.next=3,this.core.sendCmd("getNosCdnHost");case 3:a=g.sent,g.next=10;break;case 6:return g.prev=6,g.t0=g.catch(0),this.core.logger.error("getNosCdnHost::error",g.t0),g.abrupt("return");case 10:if(a){g.next=12;break}return g.abrupt("return");case 12:u=null===(t=null==a?void 0:a.content)||void 0===t?void 0:t.nosConfigTag,0!==(m=Bu(null==u?void 0:u.expire))&&u.cdnDomain?-1===m?(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(){h._getNosCdnHost()}),1e3*m)):(this.config.cdn.bucket="",this.config.cdn.cdnDomain="",this.config.cdn.objectNamePrefix="");case 15:case"end":return g.stop()}}),_callee4,this,[[0,6]])})))},Ye(NOS,[{key:"config",get:function get(){return this.cloudStorage.config}}]),NOS}(),zh={"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"},Wh={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}},Kh={getNosToken:{sid:6,cid:2,service:"cloudStorage",params:[{type:"String",name:"responseBody"},{type:"Property",name:"nosToken",entity:"nosToken",reflectMapper:Wh.nosToken}],response:[{type:"Property",name:"nosToken",reflectMapper:invertSerializeItem(Wh.nosToken)}]},getOriginUrl:{sid:6,cid:22,service:"cloudStorage",params:[{type:"Property",name:"nosSafeUrlTag",reflectMapper:Wh.nosSafeUrlTag}],response:[{type:"Property",name:"nosSafeUrlTag",reflectMapper:invertSerializeItem(Wh.nosSafeUrlTag)}]},getNosCdnHost:{sid:6,cid:26,service:"cloudStorage",response:[{type:"Property",name:"nosConfigTag",reflectMapper:invertSerializeItem(Wh.nosConfigTag)}]},getGrayscaleConfig:{sid:6,cid:27,service:"cloudStorage",params:[{type:"Property",name:"config"}],response:[{type:"Property",name:"grayConfigTag",reflectMapper:invertSerializeItem(Wh.grayConfigTag)}]},getMixStorePolicy:{sid:6,cid:28,service:"cloudStorage",params:[{type:"LongArray",name:"supportType"}],response:[{type:"Property",name:"mixStorePolicyTag",reflectMapper:invertSerializeItem(Wh.mixStorePolicyTag)}]},getMixStoreToken:{sid:6,cid:29,service:"cloudStorage",params:[{type:"Property",name:"mixStoreTokenReqTag",reflectMapper:Wh.mixStoreTokenReqTag}],response:[{type:"Property",name:"mixStoreTokenResTag",reflectMapper:invertSerializeItem(Wh.mixStoreTokenResTag)}]},getFileAuthToken:{sid:6,cid:30,service:"cloudStorage",params:[{type:"Property",name:"mixStoreAuthTokenReqTag",reflectMapper:Wh.mixStoreAuthTokenReqTag}],response:[{type:"Property",name:"mixStoreAuthTokenResTag",reflectMapper:invertSerializeItem(Wh.mixStoreAuthTokenResTag)}]},getNosAccessToken:{sid:6,cid:24,service:"cloudStorage",params:[{type:"Property",name:"tag",reflectMapper:Wh.nosAccessTokenTag}],response:[{type:"Property",name:"tag",reflectMapper:invertSerializeItem(Wh.nosAccessTokenTag)}]},deleteNosAccessToken:{sid:6,cid:25,service:"cloudStorage",params:[{type:"Property",name:"tag",reflectMapper:Wh.nosAccessTokenTag}]}},Yh=function(){function MixStorage(t,a){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=a,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,a){var u;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var m,h;return lu.wrap((function _callee$(g){for(;;)switch(g.prev=g.next){case 0:if(uu.localStorage)try{uu.localStorage.getItem&&uu.localStorage.getItem(this.GRAYKEY)&&(this.grayConfig=JSON.parse(uu.localStorage.getItem(this.GRAYKEY))[t])}catch(t){uu.localStorage.getItem(this.GRAYKEY)&&this.core.logger.error("uploadFile:: JSON.parse grayscaleConfig error ",t)}if(this.grayConfig&&!(this.grayConfig.timeStamp+1e3*this.grayConfig.ttl<a)){g.next=17;break}return g.next=4,this.core.sendCmd("getGrayscaleConfig",{config:{}});case 4:if(!(m=g.sent).content||!m.content.grayConfigTag){g.next=16;break}this.logger.log("uploadFile::getAppGrayConfigRequest success ");try{this.grayConfig=JSON.parse(m.content.grayConfigTag.config),this.grayConfig.ttl=JSON.parse(m.content.grayConfigTag.ttl)}catch(t){this.logger.error("getGrayscaleConfig error",t)}if(this.grayConfig){g.next=10;break}return g.abrupt("return");case 10:h=uu.localStorage.getItem(this.GRAYKEY)?JSON.parse(uu.localStorage.getItem(this.GRAYKEY)):{},this.grayConfig.timeStamp=(new Date).getTime(),h[t]=this.grayConfig,uu.localStorage.setItem(this.GRAYKEY,Vn(h)),g.next=17;break;case 16:this.logger.log("uploadFile:: result grayConfig:",m.content);case 17:if(!(null===(u=this.grayConfig)||void 0===u?void 0:u.mixStoreEnable)){g.next=20;break}return g.next=20,this._getMixStorePolicy(t);case 20:case"end":return g.stop()}}),_callee,this)})))},t._getMixStorePolicy=function _getMixStorePolicy(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h,g,M,I;return lu.wrap((function _callee2$(S){for(;;)switch(S.prev=S.next){case 0:if(a=(new Date).getTime(),uu.localStorage)try{this.mixStorePolicy=JSON.parse(uu.localStorage.getItem(this.MIXSTOREKEY))[t],this.curProvider=Bu(this.mixStorePolicy.providers[0]),this.mixStorePolicy.timeStamp&&this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl>a&&(m=this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl-a,this.core.timerManager.addTimer(bind$1(u=this._getMixStorePolicy).call(u,this,t),m))}catch(a){uu.localStorage.getItem(this.MIXSTOREKEY)&&JSON.parse(uu.localStorage.getItem(this.MIXSTOREKEY))[t]&&this.core.logger.error("uploadFile:: JSON.parse mixStorePolicy error ",a)}if(this.mixStorePolicy&&!(this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl<=a)){S.next=31;break}return S.prev=3,S.next=6,this.core.sendCmd("getMixStorePolicy",{supportType:this.cloudStorage.aws.s3?[1,2]:[1]});case 6:g=S.sent,M=g.content.mixStorePolicyTag,this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null,policyVersion:void 0},this.mixStorePolicy.policyVersion=M.policyVersion,this.mixStorePolicy.ttl=Number(M.ttl),this.mixStorePolicy.providers=M.providers.split(","),this.circuitTimer&&this.core.timerManager.deleteTimer(this.circuitTimer),this.curProvider=Bu(this.mixStorePolicy.providers[0]),this.mixStorePolicy.nosPolicy=M.nosPolicy?JSON.parse(M.nosPolicy):null,this.mixStorePolicy.s3Policy=M.s3Policy?JSON.parse(M.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(h=this._getMixStorePolicy).call(h,this,t),1e3*this.mixStorePolicy.ttl),I=uu.localStorage.getItem(this.MIXSTOREKEY)?JSON.parse(uu.localStorage.getItem(this.MIXSTOREKEY)):{},this.mixStorePolicy.timeStamp=(new Date).getTime(),I[t]=this.mixStorePolicy,uu.localStorage.setItem(this.MIXSTOREKEY,Vn(I)),S.next=31;break;case 24:if(S.prev=24,S.t0=S.catch(3),this.logger.error("getMixStorePolicy error",S.t0),0!==this.mixStoreErrorCount){S.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 S.stop()}}),_callee2,this,[[3,24]])})))},t._addCircuitTimer=function _addCircuitTimer(){var t=this,a=this.mixStorePolicy.providers,u=a[(indexOf(a).call(a,String(this.curProvider))+1)%a.length];if(!u)throw new Error("uploadFile nextProvider error");if(u===a[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=Bu(u),this.mixStorePolicy.nosPolicy&&this.mixStorePolicy.s3Policy){var m=this.mixStorePolicy[1===this.curProvider?"nosPolicy":"s3Policy"].uploadConfig.retryPolicy.circuit;if(!m||0===m)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:"+Bu(t.mixStorePolicy.providers[0])),t.curProvider=Bu(t.mixStorePolicy.providers[0]),t.core.timerManager.deleteTimer(t.circuitTimer)}),1e3*m)}throw new Error("uploadFile will not retry again")},t.getFileAuthToken=function getFileAuthToken(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.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 a=u.sent,u.abrupt("return",a.content.mixStoreAuthTokenResTag);case 4:case"end":return u.stop()}}),_callee3,this)})))},MixStorage}(),Qh=Ru.trim,Jh=R("".charAt),Xh=h.parseFloat,Zh=h.Symbol,eg=Zh&&Zh.iterator,tg=1/Xh(Tu+"-0")!=-1/0||eg&&!fails((function(){Xh(Object(eg))}))?function parseFloat(t){var a=Qh(toString(t)),u=Xh(a);return 0===u&&"-"==Jh(a,0)?-0:u}:Xh;_export({global:!0,forced:parseFloat!=tg},{parseFloat:tg});var rg=j.parseFloat,ng=-1,ag=function(){function AWS(t,a){this.s3=null,this.core=t,this.cloudStorage=a,this.logger=t.logger}var t=AWS.prototype;return t.s3Upload=function s3Upload(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u,m,h,g,M,I,S,T,C,b,E,k,R,A,w=this;return lu.wrap((function _callee2$(N){for(;;)switch(N.prev=N.next){case 0:if(ng+=1,!t.file){N.next=5;break}u=t.file,N.next=20;break;case 5:if("string"!=typeof t.fileInput){N.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])){N.next=12;break}u=m.files[0],N.next=13;break;case 12:throw new Error("Can not get file from fileInput");case 13:N.next=20;break;case 15:if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0])){N.next=19;break}u=t.fileInput.files[0],N.next=20;break;case 19:throw new Error("Can not get file from fileInput "+t.fileInput);case 20:if(this.mixStorePolicy.s3Policy){N.next=22;break}throw new Error("dont get s3 policy");case 22:return h={accessKeyId:a.accessKeyId,secretAccessKey:a.secretAccessKey,sessionToken:a.sessionToken,region:a.region,maxRetries:this.mixStorePolicy.s3Policy.uploadConfig.retryPolicy.retry},g=this.s3,M=decodeURIComponent(a.bucket),I=decodeURIComponent(a.objectName),S=u,T="https://"+M+".s3.amazonaws.com/"+I,C={},(b=this.mixStorePolicy.s3Policy)&&b.uploadConfig&&Un(b.uploadConfig.uploadUrl)&&b.uploadConfig.uploadUrl.length>0&&(E=b.uploadConfig.uploadUrl.length,ng%=E,C.endpoint=b.uploadConfig.uploadUrl[ng],C.s3ForcePathStyle=!0,T=C.endpoint+"/"+M+"/"+I),this.core.reporterHookCloudStorage.update({remote_addr:T,operation_type:1}),(k=new g(C)).config.update(h),R={Bucket:M,Key:I,Body:S,Metadata:{token:a.token},ContentType:S.type||"application/octet-stream"},this.core.logger.log("uploadFile:: s3 upload params:",R),(A=k.upload(R)).on("httpUploadProgress",(function(a){var u=rg((a.loaded/a.total).toFixed(2));t.onUploadProgress&&t.onUploadProgress({total:a.total,loaded:a.loaded,percentage:u,percentageText:Math.round(100*u)+"%"})})),N.abrupt("return",new $i((function(u,m){var h=(new Date).getTime();A.send((function(g,T){return __awaiter(w,void 0,void 0,lu.mark((function _callee(){var C,b,E,k,R,A,w,N;return lu.wrap((function _callee$(x){for(;;)switch(x.prev=x.next){case 0:if(!g||"RequestAbortedError"!==g.code){x.next=5;break}this.logger.error("uploadFile:","api::s3:upload file abort.",g),m(new Jl({code:"v2"===get(this.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_CANCELLED:400,detail:{reason:"S3RequestAbortedError",rawError:g,curProvider:2}})),x.next=41;break;case 5:if(!g){x.next=26;break}return this.logger.error("uploadFile:","api::s3:upload file failed.",g),this.core.reporter.reportTraceStart("exceptions",{user_id:this.core.options.account||(null===(b=null===(C=this.core)||void 0===C?void 0:C.auth)||void 0===b?void 0:b.account),trace_id:null===(E=this.core.clientSocket.socket)||void 0===E?void 0:E.sessionId,start_time:h,action:1,exception_service:4}),this.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof g.status?g.status:"number"==typeof g.code?g.code:0,description:g.message||""+g.code,operation_type:1,target:Vn({bucket:M,object:I})},{asyncParams:uu.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("exceptions",1),x.next=12,uu.net.getNetworkStatus();case 12:if(k=x.sent,!1!==k.net_connect){x.next=16;break}return x.abrupt("return",m(new Jl({code:"v2"===get(this.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"No network",rawError:g,curProvider:this.cloudStorage.mixStorage.curProvider}})));case 16:x.prev=16,this.cloudStorage.mixStorage._addCircuitTimer(),x.next=23;break;case 20:return x.prev=20,x.t0=x.catch(16),x.abrupt("return",m(new Jl({code:"v2"===get(this.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"All upload attempts failed",rawError:x.t0,curProvider:this.cloudStorage.mixStorage.curProvider,mixStorePolicy:this.mixStorePolicy,file:t.file||t.filePath}})));case 23:u(this.cloudStorage._uploadFile(t)),x.next=41;break;case 26:if(R=(R=(R=this.mixStorePolicy.s3Policy.cdnSchema).replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn)).replace("{objectName}",T.Key),A={size:S.size,name:S.name,url:a.shortUrl?a.shortUrl:R,ext:S.name.split(".")[1]||"unknown"},w=t.type||"",(N={image:"imageInfo"})[w]){x.next=36;break}return x.abrupt("return",u(A));case 36:return x.t1=u,x.next=39,this.getS3FileInfo({url:R,infoSuffix:N[w],s3Result:A});case 39:return x.t2=x.sent,x.abrupt("return",(0,x.t1)(x.t2));case 41:case"end":return x.stop()}}),_callee,this,[[16,20]])})))})),t.onUploadStart&&t.onUploadStart(A)})));case 39:case"end":return N.stop()}}),_callee2,this)})))},t.getS3FileInfo=function getS3FileInfo(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var u,m,h,g,M,I,S;return lu.wrap((function _callee3$(T){for(;;)switch(T.prev=T.next){case 0:return u=t.url,m=t.infoSuffix,h=t.s3Result,T.prev=1,T.next=4,this.core.adapters.request(u+"?"+m,{method:"GET",dataType:"text",timeout:5e3},{exception_service:3});case 4:g=T.sent,T.next=11;break;case 7:return T.prev=7,T.t0=T.catch(1),this.core.logger.error("uploadFile:: fetch file info error",T.t0),T.abrupt("return",h);case 11:if(!g){T.next=18;break}return M=g.data,I="imageInfo"===m?M:null===(a=null==M?void 0:M.GetVideoInfo)||void 0===a?void 0:a.VideoInfo,S=Ut(Ut({},h),{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}),T.abrupt("return",pickBy(S,(function(t){return void 0!==t})));case 18:return this.core.logger.error("uploadFile:: fetch s3 file info no result",u+"?"+m),T.abrupt("return",h);case 20:case"end":return T.stop()}}),_callee3,this,[[1,7]])})))},Ye(AWS,[{key:"mixStorePolicy",get:function get(){return this.cloudStorage.mixStorage.mixStorePolicy}}]),AWS}(),ig=function(){function CloudStorageService(t,a){void 0===a&&(a={}),this.config={},this.uploadTaskMap={},this.name="cloudStorage",this.logger=t.logger,this.core=t,this.nos=new $h(t,this),this.mixStorage=new Yh(t,this),this.aws=new ag(t,this),registerParser({cmdMap:zh,cmdConfig:Kh}),this.setOptions(a),this.setListeners()}var t=CloudStorageService.prototype;return t.setOptions=function setOptions(t){void 0===t&&(t={});var a=t.storageKeyPrefix||"NIMClient";this.mixStorage.GRAYKEY=a+"-AllGrayscaleConfig",this.mixStorage.MIXSTOREKEY=a+"-AllMixStorePolicy";var u=t.s3,m=__rest(t,["s3"]),h=Ut({},jh,this.config);if(m&&Object.prototype.hasOwnProperty.call(m,"cdn")){var g=Ut(Ut({},h.cdn),m.cdn);this.config=Ut({},h,m),this.config.cdn=g}else this.config=Ut({},h,m);u&&(this.aws.s3=u)},t.setListeners=function setListeners(){var t,a,u,m;this.core.eventBus.on("kicked",bind$1(t=this._clearUnCompleteTask).call(t,this)),this.core.eventBus.on("disconnect",bind$1(a=this._clearUnCompleteTask).call(a,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLogout",bind$1(u=this._clearUnCompleteTask).call(u,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleKicked",bind$1(m=this._clearUnCompleteTask).call(m,this))},t._clearUnCompleteTask=function _clearUnCompleteTask(){var t,a=this;forEach$1(t=Gt(this.uploadTaskMap)).call(t,(function(t){var u=a.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,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(this.mixStorage.reset(),this.nos.reset(),!this.config.isNeedToGetUploadPolicyFromServer){a.next=5;break}return a.next=5,this.mixStorage.getGrayscaleConfig(this.core.options.appkey,t);case 5:return a.next=7,this.nos._getNosCdnHost();case 7:case"end":return a.stop()}}),_callee,this)})))},t.processCallback=function processCallback(t,a){var u=this,m=t.onUploadProgress,h=t.onUploadDone,g=t.onUploadStart;return{onUploadStart:"function"==typeof g?function(t){u.uploadTaskMap[a]=t;try{g(t)}catch(t){u.logger.error("CloudStorage::uploadFile:options.onUploadStart execute error",t)}}:function(t){u.uploadTaskMap[a]=t},onUploadProgress:"function"==typeof m?function(t){u.core.reporterHookCloudStorage.update({transferred_size:t.loaded,full_size:t.total});try{m(t)}catch(t){u.logger.error("CloudStorage::uploadFile:options.onUploadProgress execute error",t)}}:function(t){u.core.reporterHookCloudStorage.update({transferred_size:t.loaded,full_size:t.total})},onUploadDone:"function"==typeof h?function(t){u.core.reporterHookCloudStorage.end(0);try{h(t)}catch(t){u.logger.error("CloudStorage::uploadFile:options.onUploadDone execute error",t)}}:function(){u.core.reporterHookCloudStorage.end(0)},taskKey:a}},t.uploadFile=function uploadFile(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h,g,M,I,S;return lu.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(!(a=get(t,"file.type"))||"string"!=typeof a||-1!==indexOf(a).call(a,t.type)){T.next=7;break}throw new Error('The meta type "'+a+'" does not match "'+t.type+'"');case 7:return this.core.reporterHookCloudStorage.start(),t.file?this.core.reporterHookCloudStorage.update({full_size:t.file.size}):"string"==typeof t.fileInput?(u=document.getElementById(t.fileInput))&&u.files&&u.files[0]&&this.core.reporterHookCloudStorage.update({full_size:u.files[0].size}):t.fileInput&&t.fileInput.files&&t.fileInput.files[0]&&this.core.reporterHookCloudStorage.update({full_size:t.fileInput.files[0].size}),m=Gu(),h=this.processCallback(t,m),g=h.onUploadStart,M=h.onUploadProgress,I=h.onUploadDone,t.onUploadStart=g,t.onUploadProgress=M,t.onUploadDone=I,S=null,T.prev=15,T.next=18,this._uploadFile(t);case 18:S=T.sent,t.md5&&(S.md5=t.md5),delete this.uploadTaskMap[m],T.next=28;break;case 23:throw T.prev=23,T.t0=T.catch(15),delete this.uploadTaskMap[m],this.core.reporterHookCloudStorage.end((T.t0&&T.t0.code)===jl.V2NIM_ERROR_CODE_CANCELLED?3:1),T.t0;case 28: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 32:case"end":return T.stop()}}),_callee2,this,[[15,23]])})))},t._uploadFile=function _uploadFile(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var m,h,g,M;return lu.wrap((function _callee3$(I){for(;;)switch(I.prev=I.next){case 0:if(get(this.mixStorage,"grayConfig.mixStoreEnable")&&get(this.mixStorage,"mixStorePolicy.providers.length")){I.next=3;break}return this.logger.log("uploadFile:: uploadFile begin, use old nos"),I.abrupt("return",this.nos.nosUpload(t));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),h=!0,m?!1===m.complete&&2===this.mixStorage.curProvider&&(h=!1):h=!1,this.aws.s3||(this.mixStorage.curProvider=1),g=Hh,h){I.next=23;break}return I.prev=10,I.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:M=I.sent,g=M.content.mixStoreTokenResTag,I.next=23;break;case 17:if(I.prev=17,I.t0=I.catch(10),this.core.logger.error("uploadFile:: getMixStoreToken error",I.t0),!(I.t0 instanceof Wl)){I.next=22;break}throw I.t0;case 22:throw new Jl({code:"v2"===get(this.core,"options.apiVersion")?jl.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"getMixStoreToken error",rawError:I.t0,curProvider:this.mixStorage.curProvider,mixStorePolicy:this.mixStorage.mixStorePolicy}});case 23:if(h){I.next=27;break}return I.abrupt("return",2===this.mixStorage.curProvider?this.aws.s3Upload(t,g):this.nos.nosUpload(t,g));case 27:return I.abrupt("return",this.nos.nosUpload(t,null===(u=null===(a=null==m?void 0:m.uploadInfo)||void 0===a?void 0:a.payload)||void 0===u?void 0:u.mixStoreToken));case 28:case"end":return I.stop()}}),_callee3,this,[[10,17]])})))},t.getThumbUrl=function getThumbUrl(t,a){var u,m,h,g,M;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 S=I[5];if(I[6],I[7],null===(u=this.grayConfig)||void 0===u?void 0:u.mixStoreEnable){var T=this._getUrlType(t);if(2===T&&this.mixStorePolicy.s3Policy&&get(this.mixStorePolicy,"s3Policy.thumbPolicy.imagethumb"))return(null===(h=null===(m=this.mixStorePolicy.s3Policy)||void 0===m?void 0:m.thumbPolicy)||void 0===h?void 0:h.imagethumb).replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",S).replace("{x}",a.width.toString()).replace("{y}",a.height.toString());if(1===T&&this.mixStorePolicy.nosPolicy&&get(this.mixStorePolicy,"nosPolicy.thumbPolicy.imagethumb"))return(null===(M=null===(g=this.mixStorePolicy.nosPolicy)||void 0===g?void 0:g.thumbPolicy)||void 0===M?void 0:M.imagethumb).replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",S).replace("{x}",a.width.toString()).replace("{y}",a.height.toString())}return includes(t).call(t,"?")?t+"&imageView&thumbnail="+a.width+"x"+a.height:t+"?imageView&thumbnail="+a.width+"x"+a.height},t.getVideoCoverUrl=function getVideoCoverUrl(t,a){var u,m,h,g,M;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 S=I[5];if(I[6],I[7],null===(u=this.grayConfig)||void 0===u?void 0:u.mixStoreEnable){var T=this._getUrlType(t);if(2===T&&this.mixStorePolicy.s3Policy&&get(this.mixStorePolicy,"s3Policy.thumbPolicy.vframe"))return(null===(h=null===(m=this.mixStorePolicy.s3Policy)||void 0===m?void 0:m.thumbPolicy)||void 0===h?void 0:h.vframe).replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",S).replace("{x}",a.width.toString()).replace("{y}",a.height.toString()).replace("{offset}","0").replace("{type}","png");if(1===T&&this.mixStorePolicy.nosPolicy&&get(this.mixStorePolicy,"nosPolicy.thumbPolicy.vframe"))return(null===(M=null===(g=this.mixStorePolicy.nosPolicy)||void 0===g?void 0:g.thumbPolicy)||void 0===M?void 0:M.vframe).replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",S).replace("{x}",a.width.toString()).replace("{y}",a.height.toString()).replace("{offset}","0").replace("{type}","png")}return includes(t).call(t,"?")?t+"&vframe&offset=0&resize="+a.width+"x"+a.height+"&type=png":t+"?vframe&offset=0&resize="+a.width+"x"+a.height+"&type=png"},t.getPrivateUrl=function getPrivateUrl(t){var a;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 m=u[1];u[2];var h=u[3];u[4];var g=u[5];if(u[6],u[7],null===(a=this.grayConfig)||void 0===a?void 0:a.mixStoreEnable){var M=this._getUrlType(t);return 2===M&&this.mixStorePolicy.s3Policy&&(t=this.mixStorePolicy.s3Policy.cdnSchema.replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",g)),1===M&&this.mixStorePolicy.nosPolicy&&(t=this.mixStorePolicy.nosPolicy.cdnSchema.replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",g)),t}var I=this.config,S=I.downloadUrl,T=I.downloadHostList,C=I.nosCdnEnable,b=this.config.cdn.cdnDomain,E=this.config.cdn.objectNamePrefix?decodeURIComponent(this.config.cdn.objectNamePrefix):"",k=decodeURIComponent(g),R=indexOf(k).call(k,E);if(b&&R>-1&&C)return""+m+b+"/"+slice(k).call(k,R);if(includes(T).call(T,h)&&includes(g).call(g,"/")){var A=indexOf(g).call(g,"/"),w=g.substring(0,A),N=g.substring(A+1);return S.replace("{bucket}",w).replace("{object}",N)}var x=filter(T).call(T,(function(t){return"string"==typeof h&&includes(h).call(h,t)}))[0],O=x?h.replace(x,"").replace(/\W/g,""):null;return O?S.replace("{bucket}",O).replace("{object}",g):t},t.getOriginUrl=function getOriginUrl(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a;return lu.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 a=u.sent,u.abrupt("return",a.content.nosSafeUrlTag.originUrl);case 6:case"end":return u.stop()}}),_callee4,this)})))},t.getFileToken=function getFileToken(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a,u,m,h,g,M=this;return lu.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),a=this.mixStorePolicy.nosPolicy?this.mixStorePolicy.nosPolicy.authPolicy.policyType:null,u=this.mixStorePolicy.s3Policy?this.mixStorePolicy.s3Policy.authPolicy.policyType:null,a!==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(!(a&&indexOf(a).call(a,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(h=[],g=[],forEach$1(m=t.urls).call(m,(function(t){var a=M._getUrlType(t);1===a&&g.push(t),2===a&&h.push(t)})),(!u||0!==h.length&&indexOf(u).call(u,String(3))<0)&&(this.logger.warn("s3 url don't support url token"),h=[]),(!a||0!==g.length&&indexOf(a).call(a,String(3))<0)&&(this.logger.warn("nos url don't support url token"),g=[]),0!==h.length||0!==g.length){I.next=30;break}throw this.logger.error("not support urls"),new Error("not support urls");case 30:if(0!==h.length&&0!==g.length){I.next=33;break}return t.urls=Vn(t.urls),I.abrupt("return",this.mixStorage.getFileAuthToken(t));case 33:case"end":return I.stop()}}),_callee5,this)})))},t._getUrlType=function _getUrlType(t){var a,u;return this.mixStorePolicy.nosPolicy&&some(a=this.mixStorePolicy.nosPolicy.dlcdns).call(a,(function(a){return indexOf(t).call(t,a)>=0}))?1:this.mixStorePolicy.s3Policy&&some(u=this.mixStorePolicy.s3Policy.dlcdns).call(u,(function(a){return indexOf(t).call(t,a)>=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 a=get(t,"error.detail.ignore");return t.error&&!a?$i.reject(t.error):$i.resolve(t)},Ye(CloudStorageService,[{key:"grayConfig",get:function get(){return this.mixStorage.grayConfig}},{key:"mixStorePolicy",get:function get(){return this.mixStorage.mixStorePolicy}}]),CloudStorageService}();var og,sg=function(t){function V2NIMStorageServiceImpl(a){var u;return(u=t.call(this,"V2NIMStorageService",a)||this).sceneMap={nim_default_profile_icon:{sceneName:"nim_default_profile_icon",expireTime:0},nim_default_im:{sceneName:"nim_default_im",expireTime:0},nim_system_nos_scene:{sceneName:"nim_system_nos_scene",expireTime:0},nim_security:{sceneName:"nim_security",expireTime:0}},u.uploadingMessageInfo={},u.core=a,u.core._registerDep(ig,"cloudStorage"),u.core._registerDep(Fh,"V2NIMStorageUtil"),u}wt(V2NIMStorageServiceImpl,t);var a=V2NIMStorageServiceImpl.prototype;return a.addCustomStorageScene=function addCustomStorageScene(t,a){return this.checkV2(),validate({sceneName:{type:"string",allowEmpty:!1},expireTime:{type:"number",min:0}},{sceneName:t,expireTime:a},"",!0),this.sceneMap[t]={sceneName:t,expireTime:a},{sceneName:t,expireTime:a}},a.getStorageSceneList=function getStorageSceneList(){return this.checkV2(),Ji(this.sceneMap)},a.getStorageScene=function getStorageScene(t){return t&&this.sceneMap[t]||this.sceneMap.nim_default_im},a.hasStorageScene=function hasStorageScene(t){return void 0!==this.sceneMap[t]},a.createUploadFileTask=function createUploadFileTask(t){var a;if(this.checkV2(),"string"==typeof t.fileObj&&0===indexOf(a=t.fileObj).call(a,"nim-external")){var u=document.getElementById(t.fileObj);u&&u.files&&u.files[0]&&(t.fileObj=u.files[0])}return{taskId:Gu(),uploadParams:t}},a.uploadFile=function uploadFile(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate({taskId:{type:"string",allowEmpty:!1}},t,"fileTask",!0),m.next=4,this._uploadFile(t,a);case 4:return u=m.sent,m.abrupt("return",u[0]);case 6:case"end":return m.stop()}}),_callee,this)})))},a.uploadFileWithMetaInfo=function uploadFileWithMetaInfo(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u;return lu.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate({taskId:{type:"string",allowEmpty:!1}},t,"fileTask",!0),m.next=4,this._uploadFile(t,a);case 4:return u=m.sent,m.abrupt("return",(h=u[1],g=void 0,M=void 0,I=void 0,S=void 0,T=void 0,C=void 0,b=void 0,E=void 0,k=void 0,R=void 0,A=void 0,w=void 0,g=h.url,M=h.name,I=h.size,S=h.ext,T=h.md5,C=h.h,b=h.w,E=h.orientation,k=h.dur,R=h.audioCodec,A=h.videoCodec,w=h.container,JSON.parse(Vn({url:g,name:M,size:I,ext:S,md5:T,height:C,width:b,orientation:E,duration:k,audioCodec:R,videoCodec:A,container:w}))));case 6:case"end":return m.stop()}var h,g,M,I,S,T,C,b,E,k,R,A,w}),_callee2,this)})))},a._uploadFile=function _uploadFile(t,a,u){var m;return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var h,g,M,I,S,T,C,b,E,k,R=this;return lu.wrap((function _callee3$(A){for(;;)switch(A.prev=A.next){case 0:if(this.core.cloudStorage&&this.core.cloudStorage.uploadFile){A.next=2;break}throw new Error('Service "cloudStorage" does not exist');case 2:if(h=t.uploadParams,g=t.taskId,M=getFileOrPath(h.fileObj),I=M.file,S=M.path,T=(u||{}).fileType,!this.uploadingMessageInfo[g]){A.next=7;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_ALREADY_EXIST,detail:{reason:"V2NIMStorageService.uploadFile: repeat upload"}});case 7:if(A.prev=7,C={},I?C.file=I:S&&(0===(null==S?void 0:indexOf(S).call(S,"nim-external"))?C.fileInput=S:C.filePath=S),b=this.getStorageScene(h.sceneName),C.nosScenes=b.sceneName,C.nosSurvivalTime=b.expireTime,C.type=1===T?"image":2===T?"audio":3===T?"video":"file",!C.file||!this.core.pluginMap["browser-md5-file"]){A.next=19;break}return A.next=17,this.getFileMd5(this.core.pluginMap["browser-md5-file"],g,C.file);case 17:E=A.sent,C.md5=E;case 19:return C.onUploadProgress=function(t){"function"==typeof a&&a(Math.round(100*t.percentage))},C.onUploadStart=function(t){var a;if(null===(a=R.uploadingMessageInfo[g])||void 0===a?void 0:a.abort)return t.abort(),void delete R.uploadingMessageInfo[g];R.uploadingMessageInfo[g]={abort:!1,task:t}},this.uploadingMessageInfo[g]={abort:!1},A.next=24,this.core.cloudStorage.uploadFile(C);case 24:if(k=A.sent,!(null===(m=this.uploadingMessageInfo[g])||void 0===m?void 0:m.abort)){A.next=27;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_CANCELLED,detail:{reason:"upload file aborted"}});case 27:return delete this.uploadingMessageInfo[g],A.abrupt("return",[k.url,k]);case 31:throw A.prev=31,A.t0=A.catch(7),delete this.uploadingMessageInfo[g],this.core.logger.error("sendFile:: upload File error or abort.",A.t0),A.t0;case 36:case"end":return A.stop()}}),_callee3,this,[[7,31]])})))},a.cancelUploadFile=function cancelUploadFile(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),a.next=3,this._cancelUploadFile(t.taskId);case 3:case"end":return a.stop()}}),_callee4,this)})))},a._cancelUploadFile=function _cancelUploadFile(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a;return lu.wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:if(this.checkV2(),!(null==(a=this.uploadingMessageInfo[t])?void 0:a.task)){u.next=16;break}return u.prev=3,this.logger.log("V2NIMStorageService.cancelUploadFile: uploadInfo task exist"),u.next=7,a.task.abort();case 7:delete this.uploadingMessageInfo[t],u.next=14;break;case 10:u.prev=10,u.t0=u.catch(3),delete this.uploadingMessageInfo[t],this.core.logger.error("cancelMessageAttachmentUpload::abort error.",u.t0);case 14:u.next=22;break;case 16:if(!a){u.next=21;break}this.logger.log("V2NIMStorageService.cancelUploadFile: uploadInfo task not exist"),a.abort=!0,u.next=22;break;case 21:throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST,detail:{reason:"V2NIMStorageService.cancelUploadFile: uploadInfo not exist"}});case 22:case"end":return u.stop()}}),_callee5,this,[[3,10]])})))},a.getFileMd5=function getFileMd5(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var m=this;return lu.wrap((function _callee6$(h){for(;;)switch(h.prev=h.next){case 0:return h.abrupt("return",new $i((function(h,g){var M,I=new t;(null===(M=m.uploadingMessageInfo[a])||void 0===M?void 0:M.abort)?g(new Wl({code:jl.V2NIM_ERROR_CODE_CANCELLED,detail:{reason:"upload file aborted"}})):m.uploadingMessageInfo[a]={abort:!1,task:I};try{I.md5(u,(function(t,a){"aborted"===t?g(new Wl({code:jl.V2NIM_ERROR_CODE_CANCELLED,detail:{reason:t}})):t?g(new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"md5 calculate error in callback",rawError:t}})):h(a)}))}catch(t){g(new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"md5 calculate error",rawError:t}}))}})));case 1:case"end":return h.stop()}}),_callee6)})))},a.shortUrlToLong=function shortUrlToLong(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),a.abrupt("return",this.core.cloudStorage.getOriginUrl(t));case 2:case"end":return a.stop()}}),_callee7,this)})))},a.getImageThumbUrl=function getImageThumbUrl(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){return lu.wrap((function _callee8$(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",this.core.V2NIMStorageUtil.getImageThumbUrl(t,a));case 1:case"end":return u.stop()}}),_callee8,this)})))},a.getVideoCoverUrl=function getVideoCoverUrl(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){return lu.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",this.core.V2NIMStorageUtil.getVideoCoverUrl(t,a));case 1:case"end":return u.stop()}}),_callee9,this)})))},V2NIMStorageServiceImpl}(gp),cg=function(t){function V2NIMMessageCreatorImpl(a){var u;return(u=t.call(this,"V2NIMMessageCreator",a)||this).name="V2NIMMessageCreator",u.defaultNosSceneName="nim_default_im",u.core=a,u}wt(V2NIMMessageCreatorImpl,t);var a=V2NIMMessageCreatorImpl.prototype;return a.createMessage=function createMessage(t,a){return Ut(Ut(Ut({messageClientId:Gu(),messageType:t,createTime:this.core.timeOrigin.getNTPTime(),sendingState:0,messageStatus:{errorCode:200},messageSource:0,isSelf:!0},a),a.attachment?{attachment:Ut(Ut({},a.attachment),{raw:attachmentToRaw(t,a.attachment)})}:{}),{senderId:"",receiverId:"",conversationType:0,conversationId:"",messageServerId:"",messageConfig:Ut({unreadEnabled:!0,roamingEnabled:!0,readReceiptEnabled:!1,lastMessageUpdateEnabled:!0,historyEnabled:!0,onlineSyncEnabled:!0,offlineEnabled:!0},a.messageConfig),pushConfig:Ut({pushEnabled:!0,pushNickEnabled:!0,forcePush:!1},a.pushConfig),routeConfig:Ut({routeEnabled:!0},a.routeConfig),antispamConfig:Ut({antispamEnabled:!0},a.antispamConfig)})},a.createTextMessage=function createTextMessage(t){return this.checkV2(),validate({text:{type:"string",allowEmpty:!1}},{text:t},"",!0),this.createMessage(0,{text:t})},a.createImageMessage=function createImageMessage(t,a,u,m,h){this.checkV2(),validate(th,{name:a,sceneName:u,width:m,height:h},"",!0);var g=this.createGenericFileMessageAttachment(t,a,u,void 0,m,h,"jpeg");return this.createMessage(1,{attachment:g,attachmentUploadState:0})},a.createAudioMessage=function createAudioMessage(t,a,u,m){this.checkV2(),validate(Zm,{name:a,sceneName:u,duration:m},"",!0);var h=this.createGenericFileMessageAttachment(t,a,u,m,void 0,void 0,"aac");return this.createMessage(2,{attachment:h,attachmentUploadState:0})},a.createVideoMessage=function createVideoMessage(t,a,u,m,h,g){this.checkV2(),validate(eh,{name:a,sceneName:u,duration:m,width:h,height:g},"",!0);var M=this.createGenericFileMessageAttachment(t,a,u,m,h,g,"mp4");return this.createMessage(3,{attachment:M,attachmentUploadState:0})},a.createFileMessage=function createFileMessage(t,a,u){this.checkV2(),validate(Xm,{name:a,sceneName:u},"",!0);var m=this.createGenericFileMessageAttachment(t,a,u,void 0,void 0,void 0,"txt");return this.createMessage(6,{attachment:m,attachmentUploadState:0})},a.createGenericFileMessageAttachment=function createGenericFileMessageAttachment(t,a,u,m,h,g,M){if(u=u||this.defaultNosSceneName,!this.core.V2NIMStorageService.hasStorageScene)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"V2NIMStorageService not exist"}});if(!this.core.V2NIMStorageService.hasStorageScene(u))throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"sceneName: "+u+" has not been added"}});var I=getFileOrPath(t),S=I.file,T=I.path,C=Ut(Ut(Ut({name:a,uploadState:0,sceneName:u||this.defaultNosSceneName},m?{duration:m}:{}),h?{width:h}:{}),g?{height:g}:{});if(S){var b,E=lastIndexOf(b=S.name).call(b,"."),k=-1===E?S.name:S.name.substring(0,E);C.name=C.name||k,C.size=S.size,C.ext="."+(getFileExtension(S.name)||getFileExtension(a||"")||M)}else if(T){var R=lastIndexOf(T).call(T,"/"),A=lastIndexOf(T).call(T,"."),w=-1===A?T.substring(R+1):T.substring(R+1,A);C.name=C.name||w,C.ext="."+(getFileExtension(T)||getFileExtension(a||"")||M)}return C=JSON.parse(Vn(C)),T?C.path=T:S&&(C.file=S),C},a.createLocationMessage=function createLocationMessage(t,a,u){return this.checkV2(),validate({latitude:{type:"number",allowEmpty:!1},longitude:{type:"number",allowEmpty:!1},address:{type:"string",allowEmpty:!1}},{latitude:t,longitude:a,address:u},"",!0),this.createMessage(4,{attachment:{latitude:t,longitude:a,address:u}})},a.createCustomMessage=function createCustomMessage(t,a){return this.checkV2(),validate({text:{type:"string"}},{text:t},"",!0),validate({rawAttachment:{type:"string"}},{rawAttachment:a},"",!0),this.createMessage(100,{text:t,attachment:{raw:a}})},a.createCustomMessageWithAttachment=function createCustomMessageWithAttachment(t,a){return this.checkV2(),validate({raw:{type:"string"}},t,"attachment",!0),validate({subType:{type:"number",min:0,required:!1}},{subType:a},"",!0),this.createMessage(100,a?{attachment:t,subType:a}:{attachment:t})},a.createCallMessage=function createCallMessage(t,a,u,m,h){return this.checkV2(),validate({type:{type:"number",allowEmpty:!1}},{type:t},"",!0),validate({channelId:{type:"string",allowEmpty:!1}},{channelId:a},"",!0),validate({status:{type:"number",allowEmpty:!1}},{status:u},"",!0),validate({durations:{type:"array",allowEmpty:!1}},{durations:m},"",!0),this.createMessage(12,{text:h||"",attachment:{type:t,channelId:a,durations:m,status:u}})},a.createForwardMessage=function createForwardMessage(t){this.checkV2();var a=[11,5,7,10];if(!t||includes(a).call(a,t.messageType))return null;var u={messageClientId:Gu(),messageType:t.messageType};return t.text&&(u.text=t.text),t.attachment&&(u.attachment=t.attachment),t.attachment&&"uploadState"in t.attachment&&(u.attachmentUploadState=t.attachment.uploadState),this.createMessage(t.messageType,u)},a.createTipsMessage=function createTipsMessage(t){return this.checkV2(),validate({text:{type:"string",allowEmpty:!1}},{text:t},"",!0),this.createMessage(10,{text:t})},V2NIMMessageCreatorImpl}(gp),lg=function(){function V2NIMMessageAttachmentCreatorImpl(){this.name="V2NIMMessageAttachmentCreator"}var t=V2NIMMessageAttachmentCreatorImpl.prototype;return t.createLocationMessageAttachment=function createLocationMessageAttachment(t,a,u){return{latitude:"number"==typeof t?t:0,longitude:"number"==typeof a?a:0,address:"string"==typeof u?u:""}},t.createCustomMessageAttachment=function createCustomMessageAttachment(t){return{raw:"string"==typeof t?t:""}},V2NIMMessageAttachmentCreatorImpl}(),ug=function(){function V2NIMClientAntispamUtilImpl(t){this.config={enable:!1},this.name="V2NIMClientAntispamUtil",this.core=t}var t=V2NIMClientAntispamUtilImpl.prototype;return t.setOptions=function setOptions(t){this.config=Ut(this.config,t)},t.reset=function reset(t){"destroy"===t&&(this.vocabInfo=void 0)},t.downloadLocalAntiSpamVocabs=function downloadLocalAntiSpamVocabs(){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var t;return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(this.config.enable){a.next=2;break}return a.abrupt("return");case 2:if(!this.vocabInfo){a.next=4;break}return a.abrupt("return");case 4:return a.prev=4,a.next=7,this.core.sendCmd("v2DownloadLocalAntiSpamVocabs",{tag:{version:0,md5:""}});case 7:t=a.sent,this.vocabInfo=Ut(Ut({},t.content.data),{thesaurus:JSON.parse(t.content.data.thesaurus).thesaurus}),a.next=14;break;case 11:a.prev=11,a.t0=a.catch(4),this.core.logger.warn("V2NIMLocalAntispamUtil::downloadLocalAntiSpamVocabs error",a.t0);case 14:case"end":return a.stop()}}),_callee,this,[[4,11]])})))},t.checkTextAntispam=function checkTextAntispam(t,a){if(void 0===a&&(a="**"),!this.config.enable)return{operateType:0,replacedText:t};if(validate({text:{type:"string",required:!0,allowEmpty:!1},replace:{type:"string"}},{text:t,replace:a},"",!0),!this.vocabInfo)return{operateType:0,replacedText:t};for(var u=t,m=0;m<this.vocabInfo.thesaurus.length;m++){var h=this.filterContent(u,this.vocabInfo.thesaurus[m],a);if(u=h.replacedText,2===h.operateType||3===h.operateType)return h}return{operateType:u===t?0:1,replacedText:u}},t.filterContent=function filterContent(t,a,u){for(var m=0;m<keys(a).length;m++){var h=keys(a)[m],g=h.match||a.match,M=h.operate||a.operate,I=void 0;try{I=this.matchContent(t,h.key,g,M,u)}catch(t){}if(I&&(t=I.replacedText,2===I.operateType||3===I.operateType))return I}return{operateType:1,replacedText:t}},t.matchContent=function matchContent(t,a,u,m,h){var g=!1,M=null;if(1===u){if(indexOf(t).call(t,a)>=0){g=!0;var I=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");M=new RegExp(I,"g")}}else 2===u&&(M=new RegExp(a,"g")).test(t)&&(g=!0);if(g&&M)switch(m){case 1:return{operateType:1,replacedText:t.replace(M,h)};case 2:return{operateType:2,replacedText:t};case 3:return{operateType:3,replacedText:t}}return{operateType:0,replacedText:t}},V2NIMClientAntispamUtilImpl}(),dg=function(t){function YSFServiceImpl(a){var u;return(u=t.call(this,"YSFService",a)||this).core._registerDep(gm,"V2NIMConversationIdUtil"),u.core._registerDep(cg,"V2NIMMessageCreator"),u.core._registerDep(lg,"V2NIMMessageAttachmentCreator"),u.core._registerDep(ug,"V2NIMClientAntispamUtil"),u.core._registerDep(sg,"V2NIMStorageService"),u.sendUtil=new pg(u.core,Qe(u)),u.fileUtil=new yh(u.core),u.model=new Mm,u.notificationUtil=new Uh(u.core),registerParser({cmdMap:Ph,cmdConfig:Lh}),u}wt(YSFServiceImpl,t);var a=YSFServiceImpl.prototype;return a.emit=function emit(a){for(var u,m,h,g=this.name+"::emit "+a.toString(),M=arguments.length,I=new Array(M>1?M-1:0),S=1;S<M;S++)I[S-1]=arguments[S];if("onSendMessage"===a){var T=I[0];this.logger.log(""+g,T.messageClientId+"/"+T.messageServerId+";createTime:"+T.createTime+";","sendingState:"+T.sendingState+";attachmentUploadState:"+(T.attachmentUploadState||0)+";messageStatus:"+(null===(h=T.messageStatus)||void 0===h?void 0:h.errorCode))}else if("onReceiveMessages"===a){var C=I[0];this.logger.log(""+g,map$6(C).call(C,(function(t){return t.messageClientId+"/"+t.messageServerId+";createTime:"+t.createTime})))}else if("onReceiveCustomNotifications"===a){var b=I[0];this.logger.log(""+g,map$6(b).call(b,(function(t){return"sender:"+t.senderId+";receiver:"+t.receiverId+";ctype:"+t.conversationType+";time:"+t.timestamp})))}else{var E,k;(E=this.logger).log.apply(E,concat(k=[""+g]).call(k,I))}return(u=t.prototype.emit).call.apply(u,concat(m=[this,a]).call(m,I))},a.sendMessage=function sendMessage(t,a,u,m){return void 0===u&&(u={}),__awaiter(this,void 0,void 0,lu.mark((function _callee(){var h,g,M,I,S,T;return lu.wrap((function _callee$(C){for(;;)switch(C.prev=C.next){case 0:return validate({message:{type:"object"}},{message:t},"",!0),t.messageClientId=t.messageClientId||Gu(),validate(wm,{conversationId:a,message:t,params:u},"",!0),validateConversationId(this.core.account,a),h=this.core.timeOrigin.getTimeNode(),g=this.sendUtil.prepareMessage(t,a,u),M=g.messageBeforeSend,I=g.clientAntispamResult,S=g.hiddenParams,C.next=8,this.sendUtil.doSendMessage({apiCallingTimeNode:h,messageBeforeSend:M,clientAntispamResult:I,hiddenParams:S,progress:m});case 8:return(T=C.sent).message.senderId===T.message.receiverId&&this.markMsgsAck([T.message]),C.abrupt("return",T);case 11:case"end":return C.stop()}}),_callee,this)})))},a.sendCustomNotification=function sendCustomNotification(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var m;return lu.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validateConversationId(this.core.account,t),validate(Vh,{content:a,params:u},"",!0),(m=this.notificationUtil.generateNotificationTag(t,a,u)).type=100,h.next=7,this.core.sendCmd("ysfSendCustomNotification",{tag:m});case 7:case"end":return h.stop()}}),_callee2,this)})))},a.sendMessageFn=function sendMessageFn(t){},a.cancelMessageAttachmentUpload=function cancelMessageAttachmentUpload(t){return this.fileUtil.cancelMessageAttachmentUpload(t)},a.markMsgsAck=function markMsgsAck(t){var a;if(t&&t.length>0){var u=filter(a=map$6(t).call(t,(function(t){return t.messageServerId}))).call(a,(function(t){return t&&"0"!==t}));0!==u.length&&this.core.sendCmd("ysfBatchMarkRead",{sid:101,cid:2,ids:u})}},a.markNotificationAck=function markNotificationAck(t){var a;if(t&&t.length>0){var u=filter(a=map$6(t).call(t,(function(t){return t.idServer}))).call(a,(function(t){return t&&"0"!==t}));0!==u.length&&this.core.sendCmd("ysfBatchMarkRead",{sid:101,cid:3,ids:u})}},a.ysfOnMsgHandler=function ysfOnMsgHandler(t){var a=fillIdServer(t,t.content.data,"messageServerId"),u=completeMessage(this.core,a);delete u.__clientExt,this.emit("onReceiveMessages",[u]),this.model.upsertMessages([u]),this.markMsgsAck([u])},a.ysfSyncOfflineMsgsHandler=function ysfSyncOfflineMsgsHandler(t){var a=this,u=t.content.datas;u=map$6(u).call(u,(function(t){return completeMessage(a.core,t)})),this.markMsgsAck(u),this.emit("onReceiveMessages",u),this.model.upsertMessages(u)},a.ysfOnSysNotificationHandler=function ysfOnSysNotificationHandler(t){var a=fillIdServer(t,t.content.data,"idServer");this.markNotificationAck([a]);var u=this.processSystemNotification(a);u&&this.emit("onReceiveCustomNotifications",[u])},a.processSystemNotification=function processSystemNotification(t){var a=Ut(Ut({},t),{conversationType:1});return delete a.type,a},a.ysfSyncSysNotificationHandler=function ysfSyncSysNotificationHandler(t){var a,u,m,h=this;this.markNotificationAck(t.content.datas);var g=filter(a=map$6(u=sort(m=t.content.datas).call(m,(function(t,a){return t.timestamp-a.timestamp}))).call(u,(function(t){return h.processSystemNotification(t)}))).call(a,(function(t){return t}));g&&this.emit("onReceiveCustomNotifications",g)},YSFServiceImpl}(gp),pg=function(){function SendUtil(t,a){this.uploadingMessageInfo={},this.core=t,this.service=a}var t=SendUtil.prototype;return t.prepareMessage=function prepareMessage(t,a,u,m){var h=this.checkIfResend(t),g=this.generateSendMessage({message:t,params:u,resend:h,conversationId:a,replyMessage:m}),M=Ut({},u.targetConfig?{targetConfig:u.targetConfig}:{}),I=this.checkIfAntispam(u,g),S=I.clientAntispamResult,T=I.text;return g.text=T,g.clientAntispamHit=!!S&&3===S.operateType,{messageBeforeSend:g,clientAntispamResult:S,hiddenParams:M}},t.checkIfAntispam=function checkIfAntispam(t,a){var u,m=a.text;if(t.clientAntispamEnabled&&(0===a.messageType||10===a.messageType))if(1===(u=this.core.V2NIMClientAntispamUtil.checkTextAntispam?this.core.V2NIMClientAntispamUtil.checkTextAntispam(a.text||"",t.clientAntispamReplace):{operateType:0,replacedText:""}).operateType)m=u.replacedText;else if(2===u.operateType)throw this.service.emit("onSendMessage",Ut(Ut({},a),{sendingState:2,messageStatus:{errorCode:jl.V2NIM_ERROR_CODE_CLIENT_ANTISPAM}})),new Wl({code:jl.V2NIM_ERROR_CODE_CLIENT_ANTISPAM,detail:{reason:"sendMessage: text intercepted by client antispam"}});return{clientAntispamResult:u,text:m}},t.doMsgReceiveReport=function doMsgReceiveReport(t,a){if(t.senderId!==this.core.account){var u=get(t,"__clientExt.statistics.apiCallingTime")||0,m=get(t,"__clientExt.statistics.sendTime")||0,h=get(t,"__clientExt.statistics.attachUploadDuration")||0,g=this.core.timeOrigin.getNTPTime(),M=t.createTime,I=this.core.timeOrigin.checkNodeReliable(a.__receiveTimeNode)?this.core.timeOrigin.getNTPTime(a.__receiveTimeNode):g;this.core.reporter.report("msgReceive",{msgId:t.messageServerId,clientId:t.messageClientId,serverTime:t.createTime,receiveTime:I,fromAccid:1===t.conversationType?t.senderId:"",toAccid:t.receiverId,type:conversationTypeV2ToV1(t.conversationType),tid:1===t.conversationType?"":t.receiverId,apiCallingTime:u,sendTime:m,attachUploadDuration:h,callbackTime:g,preHandleTime:g,result:200,failReason:"",rt:g-M})}},t.checkIfResend=function checkIfResend(t){var a=this.service.model.getMessageById(t.messageClientId),u=!1;if("messageServerId"in t&&"0"!==t.messageServerId&&""!==t.messageServerId)throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"sendMessage: message has already been sent"}});if(a&&"messageServerId"in a&&"0"!==a.messageServerId&&""!==a.messageServerId)throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"sendMessage: message has already been sent"}});return a&&(u=!0),u},t.doSendMessage=function doSendMessage(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g,M,I,S,T,C,b,E,k,R;return lu.wrap((function _callee$(A){for(;;)switch(A.prev=A.next){case 0:if(u=t.apiCallingTimeNode,m=t.messageBeforeSend,h=t.clientAntispamResult,g=t.hiddenParams,M=t.progress,I={},!(S=this.service instanceof dg)){A.next=7;break}T="ysfSendMessage",A.next=20;break;case 7:if(1!==m.conversationType){A.next=11;break}T="v2SendP2pMessage",A.next=20;break;case 11:if(2!==m.conversationType){A.next=15;break}T="v2SendTeamMessage",A.next=20;break;case 15:if(3!==m.conversationType){A.next=19;break}T="v2SendSuperTeamMessage",A.next=20;break;case 19:throw new Yl({detail:{reason:"conversationType: "+m.conversationType+" is not supported"}});case 20:if(this.service.sendMessageFn(m),!S&&this.core.eventBus.emit("forwardSend/V2NIMMessageService/sendMsg",m),!m.attachment||!("uploadState"in m.attachment)||m.attachment.url||0!==m.attachment.uploadState&&2!==m.attachment.uploadState){A.next=48;break}return C=eo(),A.prev=24,m.attachmentUploadState=3,m.attachment.uploadState=3,this.service.emit("onSendMessage",m),A.next=30,this.service.fileUtil.doSendFile(m,M);case 30:m.attachmentUploadState=1,m.attachment.uploadState=1,this.service.emit("onSendMessage",m),A.next=45;break;case 35:throw A.prev=35,A.t0=A.catch(24),m.attachmentUploadState=2,m.attachment.uploadState=2,m.sendingState=2,m.messageStatus={errorCode:A.t0.code||jl.V2NIM_ERROR_CODE_UNKNOWN},this.service.emit("onSendMessage",m),I.attachUploadDuration=eo()-C,this.doSendMessageFailed(u,I,m,A.t0),A.t0;case 45:I.attachUploadDuration=eo()-C,A.next=49;break;case 48:this.service.emit("onSendMessage",m);case 49:return this.core.timeOrigin.checkNodeReliable(u)&&(I.apiCallingTime=this.core.timeOrigin.getNTPTime(u),I.sendTime=this.core.timeOrigin.getNTPTime(),m.__clientExt={statistics:I}),A.prev=50,A.next=53,this.core.sendCmd(T,{tag:Ut({},m,g)});case 53:b=A.sent,A.next=63;break;case 56:throw A.prev=56,A.t1=A.catch(50),this.doSendMessageFailed(u,I,m,A.t1),m.sendingState=2,m.messageStatus={errorCode:A.t1.code||jl.V2NIM_ERROR_CODE_UNKNOWN},this.service.emit("onSendMessage",m),A.t1;case 63:return E=get(b,"content.data.errorCode"),k=Ut(Ut(Ut(Ut({},m),b.content.data),m.aiConfig?{aiConfig:Ut(Ut({},m.aiConfig),(null===(a=b.content.data)||void 0===a?void 0:a.aiConfig)||{})}:{}),{sendingState:1,messageStatus:{errorCode:E&&200!==E?E:200}}),this.service.sendMessageFn(k),!S&&this.core.eventBus.emit("forwardSend/V2NIMMessageService/sendMsg",k),this.doMsgSendReport(u,I,m),(R=k.antispamResult)&&(k.messageStatus.errorCode=jl.V2NIM_ERROR_CODE_SERVER_ANTISPAM),delete k.antispamResult,this.service.emit("onSendMessage",k),A.abrupt("return",Ut(Ut({message:k},R?{antispamResult:R}:{}),h?{clientAntispamResult:h}:{}));case 73:case"end":return A.stop()}}),_callee,this,[[24,35],[50,56]])})))},t.doSendMessageFailed=function doSendMessageFailed(t,a,u,m){var h=Ut(Ut({},u),{sendingState:2});this.core.eventBus.emit("forwardSend/V2NIMMessageService/sendMsg",h),this.service.sendMessageFn(h),this.doMsgSendReport(t,a,u,m)},t.doMsgSendReport=function doMsgSendReport(t,a,u,m){a.apiCallingTime=this.core.timeOrigin.getNTPTime(t),a.sendTime=this.core.timeOrigin.getNTPTime();var h=this.core.timeOrigin.getNTPTime(),g=get(m,"detail.reason");this.core.reporter.report("msgSend",{msgId:u.messageServerId,clientId:u.messageClientId,msgTime:u.createTime,fromAccid:1===u.conversationType?u.senderId:"",toAccid:u.receiverId,type:conversationTypeV2ToV1(u.conversationType),tid:1===u.conversationType?"":u.receiverId,result:m?m.code:200,failReason:g||(null==m?void 0:m.message)||"",rt:h-a.apiCallingTime,apiCallingTime:a.apiCallingTime,sendTime:a.sendTime,attachUploadDuration:a.attachUploadDuration,apiCallbackTime:h})},t.generateSendMessage=function generateSendMessage(t){var a,u,m=t.conversationId,h=t.replyMessage,g=t.resend,M=t.message,I=t.params,S={};if(h){var T=h.threadRoot;S={threadReply:{senderId:h.senderId,receiverId:h.receiverId,messageServerId:h.messageServerId,createTime:h.createTime,messageClientId:h.messageClientId,conversationType:h.conversationType,conversationId:h.conversationId},threadRoot:{senderId:T?T.senderId:h.senderId,receiverId:T?T.receiverId:h.receiverId,messageServerId:T?T.messageServerId:h.messageServerId,createTime:T?T.createTime:h.createTime,messageClientId:T?T.messageClientId:h.messageClientId,conversationType:T?T.conversationType:h.conversationType,conversationId:T?T.conversationId:h.conversationId}}}var C=this.core.V2NIMConversationIdUtil.parseConversationType(m),b=this.core.V2NIMConversationIdUtil.parseConversationTargetId(m);I.pushConfig&&!0!==I.pushConfig.forcePush&&(delete I.pushConfig.forcePushContent,delete I.pushConfig.forcePushAccountIds);var E={},k={};if(I.aiConfig){var R=get(I,"aiConfig.content.msg"),A=get(I,"aiConfig.content.type")||0;R?k={msg:R,type:A}:void 0===R&&0===M.messageType&&(k={msg:M.text||"",type:A}),(E=Ut({aiStreamStatus:0,aiStream:!1},I.aiConfig)).aiStatus=1,void 0!==k.msg&&(E.content=k)}var w=null===(u=null===(a=this.core.V2NIMUserService)||void 0===a?void 0:a.model)||void 0===u?void 0:u.getUser(this.core.account),N=(null==w?void 0:w.updateTime)||0;return Ut(Ut(Ut(Ut(Ut(Ut(Ut(Ut({},M),S),{messageConfig:Ut(Ut({},M.messageConfig),I.messageConfig),routeConfig:Ut(Ut({},M.routeConfig),I.routeConfig),pushConfig:Ut(Ut({},M.pushConfig),I.pushConfig),antispamConfig:Ut(Ut({},M.antispamConfig),I.antispamConfig),robotConfig:Ut(Ut({},M.robotConfig),I.robotConfig)}),E&&E.accountId?{aiConfig:E}:{}),M.attachment?{attachment:Ut({},M.attachment)}:{}),{resend:g,senderId:this.core.account,conversationType:C,receiverId:b,conversationId:this.core.V2NIMConversationIdUtil.messageConversationId({conversationType:C,senderId:this.core.account,receiverId:b})}),N?{userUpdateTime:N}:{}),{sendingState:3})},SendUtil}(),mg=function(){function ModifyUtil(t,a){this.core=t,this.service=a}var t=ModifyUtil.prototype;return t.checkIfModify=function checkIfModify(t,a){var u,m;if("0"===t.messageServerId)throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"modifyMessage: messageServerId cannot be empty"}});if(!includes(u=[0,1,2,3,4,6,10,12,100]).call(u,t.messageType))throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"modifyMessage: messageType "+t.messageType+" not correct"}});if(includes(m=[0,1,2,3,6,10,12]).call(m,t.messageType)&&a.attachment)throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"modifyMessage: messageType "+t.messageType+" can not modify attachment"}});var h=["subType","text","serverExtension","attachment"];if(!some(h).call(h,(function(t){return void 0!==get(a,t)})))throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"modifyMessage: missing modified params"}});if(every(h).call(h,(function(u){return"attachment"===u?t.attachment&&a.attachment?attachmentToRaw(t.messageType,t.attachment)===attachmentToRaw(t.messageType,a.attachment):!a.attachment:get(t,u)===get(a,u)})))throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"modifyMessage: no change"}})},t.prepareMessage=function prepareMessage(t,a){var u=this.generateSendMessage(t,a),m=this.checkIfAntispam(a,u),h=m.clientAntispamResult,g=m.text;return u.text=g,u.clientAntispamHit=!!h&&3===h.operateType,{messageBeforeSend:u,clientAntispamResult:h}},t.modifyMessage=function modifyMessage(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g,M;return lu.wrap((function _callee$(I){for(;;)switch(I.prev=I.next){case 0:if(1!==t.conversationType){I.next=4;break}u="v2MessageP2pModify",I.next=13;break;case 4:if(2!==t.conversationType){I.next=8;break}u="v2MessageTeamModify",I.next=13;break;case 8:if(3!==t.conversationType){I.next=12;break}u="v2MessageSuperTeamModify",I.next=13;break;case 12:throw new Yl({detail:{reason:"conversationType: "+t.conversationType+" is not supported"}});case 13:return I.next=15,this.core.sendCmd(u,{tag:t});case 15:if(m=I.sent,!a||3!==a.operateType){I.next=18;break}return I.abrupt("return",{errorCode:jl.V2NIM_ERROR_CODE_CLIENT_ANTISPAM,clientAntispamResult:a});case 18:if(h=Ut(Ut({},t),m.content.data),!(g=h.antispamResult)){I.next=22;break}return I.abrupt("return",Ut({errorCode:jl.V2NIM_ERROR_CODE_SERVER_ANTISPAM,antispamResult:g},a?{clientAntispamResult:a}:{}));case 22:return delete h.antispamResult,M=completeMessage(this.core,h),this.service.model.upsertMessages([M]),this.core.eventBus.emit("V2NIMMessageService/modifyMsg",M),this.core.eventBus.emit("forwardSend/V2NIMMessageService/modifyMsg",M),I.abrupt("return",Ut(Ut({errorCode:200,message:M},g?{antispamResult:g}:{}),a?{clientAntispamResult:a}:{}));case 28:case"end":return I.stop()}}),_callee,this)})))},t.checkIfAntispam=function checkIfAntispam(t,a){var u,m=a.text;if(t.clientAntispamEnabled&&(0===a.messageType||10===a.messageType))if(1===(u=this.core.V2NIMClientAntispamUtil.checkTextAntispam?this.core.V2NIMClientAntispamUtil.checkTextAntispam(a.text||"",t.clientAntispamReplace):{operateType:0,replacedText:""}).operateType)m=u.replacedText;else if(2===u.operateType)throw new Wl({code:jl.V2NIM_ERROR_CODE_CLIENT_ANTISPAM,detail:{reason:"sendMessage: text intercepted by client antispam"}});return{clientAntispamResult:u,text:m}},t.generateSendMessage=function generateSendMessage(t,a){var u;return Ut(Ut({messageConfig:{lastMessageUpdateEnabled:null===(u=t.messageConfig)||void 0===u?void 0:u.lastMessageUpdateEnabled},routeConfig:Ut({routeEnabled:!0},a.routeConfig),pushConfig:Ut({pushEnabled:!0,pushNickEnabled:!0,forcePush:!1},a.pushConfig),antispamConfig:Ut({antispamEnabled:!0},a.antispamConfig)},a.attachment?{attachment:a.attachment}:{}),{conversationType:t.conversationType,senderId:t.senderId,receiverId:t.receiverId,createTime:t.createTime,messageClientId:t.messageClientId,messageServerId:t.messageServerId,messageType:t.messageType,subType:a.subType,text:a.text,serverExtension:a.serverExtension})},ModifyUtil}(),hg=function(){function DeleteUtil(t,a){var u=this;this.emitRevokeMessage=function(t){var a=map$6(t).call(t,(function(t){var a=formatRevokeMessage(u.core,t);return 3===a.messageRefer.conversationType?u.core.eventBus.emit("V2NIMSync/updateTimetag",{deleteSuperTeamMsg:t.createTime}):u.core.eventBus.emit("V2NIMSync/updateTimetag",{recallMsg:t.createTime}),a}));forEach$1(a).call(a,(function(t){u.service.model.deleteMessage(t.messageRefer.messageClientId)})),u.service.emit("onMessageRevokeNotifications",a),u.core.eventBus.emit("V2NIMMessageService/revokeMessages",a)},this.core=t,this.service=a,this.logger=t.logger}var t=DeleteUtil.prototype;return t.revokeMessage=function revokeMessage(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g,M,I,S;return lu.wrap((function _callee$(T){for(;;)switch(T.prev=T.next){case 0:if(validate(Nm,{message:t,params:a},"",!0),validateConversationId(this.core.account,t.conversationId),1!==t.conversationType||t.senderId===this.core.account){T.next=6;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"revokeMessage: p2p message senderId is not current user"}});case 6:if(t.messageServerId&&"0"!==t.messageServerId){T.next=8;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"revokeMessage: cannot revoke message with invalid messageServerId: "+t.messageServerId}});case 8:return h=3===t.conversationType?"v2RevokeSuperTeamMessage":"v2RevokeMessage",(u={})[1]=7,u[2]=8,u[3]=12,g=u,M=Ut(Ut(Ut({},t),a),{attach:a&&a.serverExtension,sysMsgType:g[t.conversationType],opeAccount:this.core.account}),T.next=13,this.core.sendCmd(h,{tag:M});case 13:(m={})[1]=1,m[2]=2,m[3]=3,I=m,S=[JSON.parse(Vn({postscript:a&&a.postscript,revokeType:I[t.conversationType],revokeAccountId:this.core.account,serverExtension:a&&a.serverExtension,messageRefer:formatMessageRefer(this.core,t)}))],this.revokeMessagesFn(S),this.core.eventBus.emit("forwardSend/V2NIMMessageService/revokeMessage",M);case 17:case"end":return T.stop()}}),_callee,this)})))},t.deleteMessage=function deleteMessage(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u,m,h,g;return lu.wrap((function _callee2$(M){for(;;)switch(M.prev=M.next){case 0:if(validate(Lm,t,"",!0),3!==t.sendingState){M.next=5;break}this.service.fileUtil.cancelMessageAttachmentUpload(t),M.next=7;break;case 5:if(!t.sendingState||1===t.sendingState){M.next=7;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"deleteMessage: cannot delete unsent message"}});case 7:if(u={messageRefer:formatMessageRefer(this.core,t),serverExtension:a},m=eo(),!t.messageServerId||"0"===t.messageServerId){M.next=14;break}return M.next=12,this.core.sendCmd("v2DeleteMessage",{tag:u});case 12:h=M.sent,m=h.content.timetag;case 14:g=[{serverExtension:a,messageRefer:formatMessageRefer(this.core,t),deleteTime:m}],this.core.eventBus.emit("forwardSend/V2NIMMessageService/deleteSelfMsgs",[Ut(Ut({},u),{deleteTime:m})]),this.deleteMessagesFn(g);case 17:case"end":return M.stop()}}),_callee2,this)})))},t.deleteMessages=function deleteMessages(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var u,m,h,g,M,I,S,T,C,b,E=this;return lu.wrap((function _callee3$(k){for(;;)switch(k.prev=k.next){case 0:if(validate(Vm,{messages:t},"",!0),m=[],h=[],0!==t.length){k.next=7;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"deleteMessages: message array length is 0"}});case 7:g=t[0].conversationId,M=0;case 9:if(!(M<t.length)){k.next=22;break}if(3!==t[M].sendingState){k.next=14;break}this.service.fileUtil.cancelMessageAttachmentUpload(t[M]),k.next=16;break;case 14:if(!t[M].sendingState||1===t[M].sendingState){k.next=16;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"deleteMessage: sendingState should be succeeded, please check message at index: "+M}});case 16:if(!(M>=1&&t[M].conversationId!==g)){k.next=18;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"deleteMessages: only allow to delete messages from same conversation"}});case 18:t[M].messageServerId&&"0"!==t[M].messageServerId?m.push(t[M]):h.push(t[M]);case 19:M++,k.next=9;break;case 22:if(I=eo(),S=concat(u=[]).call(u,h),k.prev=24,!(m.length>0)){k.next=31;break}return k.next=28,this.core.sendCmd("v2DeleteMessages",{tag:map$6(m).call(m,(function(t){return{messageRefer:t,serverExtension:a}}))});case 28:C=k.sent,I=C.content.timetag,S=concat(T=[]).call(T,S,m);case 31:k.next=40;break;case 33:if(k.prev=33,k.t0=k.catch(24),0!==h.length){k.next=39;break}throw k.t0;case 39:this.logger.warn("V2NIMMessageService:deleteMessages: delete messages with serverId failed");case 40:b=map$6(S).call(S,(function(t){return{serverExtension:a,messageRefer:formatMessageRefer(E.core,t),deleteTime:I}})),this.core.eventBus.emit("forwardSend/V2NIMMessageService/deleteSelfMsgs",map$6(S).call(S,(function(t){return{messageRefer:t,serverExtension:a,deleteTime:I}}))),this.deleteMessagesFn(b);case 43:case"end":return k.stop()}}),_callee3,this,[[24,33]])})))},t.revokeMessagesFn=function revokeMessagesFn(t){var a=this;forEach$1(t).call(t,(function(t){a.service.model.deleteMessage(t.messageRefer.messageClientId)})),this.service.emit("onMessageRevokeNotifications",t),this.core.eventBus.emit("V2NIMMessageService/revokeMessages",t)},t.deleteMessagesFn=function deleteMessagesFn(t){var a=this;forEach$1(t).call(t,(function(t){a.service.model.deleteMessage(t.messageRefer.messageClientId),a.core.eventBus.emit("V2NIMSync/updateTimetag",{deleteSelfMsgs:t.deleteTime})})),this.service.emit("onMessageDeletedNotifications",t),this.core.eventBus.emit("V2NIMMessageService/deleteMessages",t)},DeleteUtil}(),vg=function(){function AIUtil(t,a){this.core=t,this.service=a,this.logger=t.logger}var t=AIUtil.prototype;return t.stopAIStreamMessage=function stopAIStreamMessage(t,a){var u;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkAI(),m.next=3,this.core.sendCmd("v2AIStopModelStreamCall",{tag:{serverId:t.messageServerId,clientId:t.messageClientId,type:t.conversationType,from:t.senderId,to:t.receiverId,aiAccount:null===(u=t.aiConfig)||void 0===u?void 0:u.accountId,opeType:a.operationType,updateContent:a.updateContent,messageTime:t.createTime}});case 3:this.logger.log("V2AIUtil::streamMessageStop,clientId:"+t.messageClientId),this.core.V2NIMAIService.model.completeAiStream(t.messageClientId);case 5:case"end":return m.stop()}}),_callee,this)})))},t.regenAIMessage=function regenAIMessage(t,a){var u,m,h,g,M,I,S,T;return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var C;return lu.wrap((function _callee2$(b){for(;;)switch(b.prev=b.next){case 0:if(this.checkAI(),!(C=this.core.V2NIMAIService.model.getAiStream(t.messageClientId))){b.next=7;break}if(null==C?void 0:C.isComplete){b.next=5;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"msg::regenAIMessage streamCache is not complete, msgId:"+t.messageClientId}});case 5:b.next=9;break;case 7:if(-1!==(null===(u=t.streamConfig)||void 0===u?void 0:u.status)&&1!==(null===(m=t.streamConfig)||void 0===m?void 0:m.status)){b.next=9;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"msg::regenAIMessage message streamConfig.status forbidden "+t.streamConfig.status}});case 9:return b.next=11,this.core.sendCmd("v2AIRegenMessage",{tag:{fromAccount:t.senderId,to:t.receiverId,aiAccount:null===(h=t.aiConfig)||void 0===h?void 0:h.accountId,serverId:t.messageServerId,clientId:t.messageClientId,time:t.createTime,type:t.conversationType,opeType:a.operationType,replyMsgFromAccount:null===(g=t.threadReply)||void 0===g?void 0:g.senderId,replyMsgToAccount:null===(M=t.threadReply)||void 0===M?void 0:M.receiverId,replyMsgTime:null===(I=t.threadReply)||void 0===I?void 0:I.createTime,replyMsgIdServer:null===(S=t.threadReply)||void 0===S?void 0:S.messageServerId,replyMsgIdClient:null===(T=t.threadReply)||void 0===T?void 0:T.messageClientId}});case 11:1===a.operationType&&this.core.V2NIMAIService.model.setAiStream(t.messageClientId,{isComplete:!1,queryStatus:0,chunks:[]});case 12:case"end":return b.stop()}}),_callee2,this)})))},t.checkAI=function checkAI(){if(!this.hasAI())throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"V2NIMAIService is not registered"}})},t.hasAI=function hasAI(){var t;return!!(null===(t=this.core.V2NIMAIService)||void 0===t?void 0:t.name)},AIUtil}(),fg=function(){function V2NIMMMessageHandlerImpl(t,a){this.core=t,this.service=a,this.model=a.model,this.receiptUtil=a.receiptUtil,this.logger=this.core.logger}var t=V2NIMMMessageHandlerImpl.prototype;return t.setAIStreamPlaceholder=function setAIStreamPlaceholder(t){var a=this;this.service.aiUtil.hasAI()&&forEach$1(t).call(t,(function(t){var u;1===(null===(u=t.streamConfig)||void 0===u?void 0:u.status)&&a.core.V2NIMAIService.model.setAiStream(t.messageClientId,{isComplete:!1,queryStatus:0,chunks:[],msg:t},!0)}))},t.onMsgHandler=function onMsgHandler(t){var a=fillIdServer(t,t.content.msg,"messageServerId"),u=a._conversationOnlineSyncNotify,m=a._conversationOnlineSyncData,h=__rest(a,["_conversationOnlineSyncNotify","_conversationOnlineSyncData"]),g=completeMessage(this.core,h,1),M=this.service._filterMessage(g);this.logger.log("v2OnMsgHandler::recvMsg "+g.messageClientId+"/"+g.messageServerId+"/"+g.createTime+";isHitFilter:"+M),3===g.conversationType?this.core.eventBus.emit("V2NIMSync/updateTimetag",{superTeamRoamingMsgs:g.createTime,offlineMsgs:g.createTime}):this.core.eventBus.emit("V2NIMSync/updateTimetag",{roamingMsgs:g.createTime,offlineMsgs:g.createTime}),this.service.config.compatibleWithV1||(this.service.markMsgsAck([g]),this.service.sendUtil.doMsgReceiveReport(g,t)),delete g.__clientExt,this.setAIStreamPlaceholder([g]),5!==g.messageType&&this.core.V2NIMUserService.checkUserUpdate&&this.core.V2NIMUserService.checkUserUpdate(g,g.userUpdateTime),5===g.messageType&&this.core.eventBus.emit("V2NIMTeamService/notification",a),M||(this.service.emit("onReceiveMessages",[g]),this.model.upsertMessages([g]),u&&this.core.eventBus.emit("V2NIMConversationService/conversationOnlineSyncNotify",{content:{info:JSON.parse(u),data:JSON.parse(m)}},g),this.core.eventBus.emit("V2NIMMessageService/onMsg",g))},t.syncOfflineMsgsHandler=function syncOfflineMsgsHandler(t){var a=this,u=t.content.datas;u=map$6(u).call(u,(function(t){return completeMessage(a.core,t,2)})),0!==(u=this.service._filterMessagesByFn(u)).length&&(!this.service.config.compatibleWithV1&&this.service.markMsgsAck(u),this.service.emit("onReceiveMessages",u),this.model.upsertMessages(u),this.core.eventBus.emit("V2NIMMessageService/offlineMsgs",u))},t.syncRoamingMsgsHandler=function syncRoamingMsgsHandler(t){var a=this,u=t.content.datas;u=map$6(u).call(u,(function(t){return completeMessage(a.core,t,3)})),this.setAIStreamPlaceholder(u),0!==(u=this.service._filterMessagesByFn(u)).length&&(this.service.emit("onReceiveMessages",u),this.model.upsertMessages(u),this.core.eventBus.emit("V2NIMMessageService/roamingMsgs",u))},t.onP2PMessageReceiptsHandler=function onP2PMessageReceiptsHandler(t){this.receiptUtil.onP2PMessageReceiptsHandler(t)},t.onTeamMessageReceiptsHandler=function onTeamMessageReceiptsHandler(t){this.receiptUtil.onTeamMessageReceiptsHandler(t)},t.syncP2PMessagReceiptsHandler=function syncP2PMessagReceiptsHandler(t){this.receiptUtil.syncP2PMessagReceiptsHandler(t)},t.syncRevokeMessageHandler=function syncRevokeMessageHandler(t){this.service.deleteUtil.emitRevokeMessage(t.content.datas)},t.onRevokeMessageHandler=function onRevokeMessageHandler(t){var a=t.content.data;this.service.deleteUtil.emitRevokeMessage([a])},t.onDeleteMessageHandler=function onDeleteMessageHandler(t){var a=t.content.data,u={serverExtension:a.serverExtension,deleteTime:a.deleteTime,messageRefer:completeMessageRefer(this.core,a.messageRefer)};this.service.deleteUtil.deleteMessagesFn([u])},t.onDeleteMessagesHandler=function onDeleteMessagesHandler(t){var a,u=this,m=map$6(a=t.content.data).call(a,(function(t){return{serverExtension:t.serverExtension,deleteTime:t.deleteTime,messageRefer:completeMessageRefer(u.core,t.messageRefer)}}));this.service.deleteUtil.deleteMessagesFn(m)},t.syncOnDeleteMessagesHandler=function syncOnDeleteMessagesHandler(t){var a=this,u=t.content.datas,m=map$6(u).call(u,(function(t){return{serverExtension:t.serverExtension,deleteTime:t.deleteTime,messageRefer:completeMessageRefer(a.core,t.messageRefer)}}));this.service.emit("onMessageDeletedNotifications",m)},t.v2MessageOnModifiedHandler=function v2MessageOnModifiedHandler(t){var a=completeMessage(this.core,t.content.data);this.model.upsertMessages([a]),this.service.aiUtil.hasAI()&&this.core.V2NIMAIService.model.completeAiStream(a.messageClientId),this.core.eventBus.emit("forwardSend/V2NIMMessageService/modifyMsg",a),this.core.eventBus.emit("V2NIMMessageService/modifyMsg",a),this.core.eventBus.emit("V2NIMSync/updateTimetag",3===a.conversationType?{superTeamModifyMessage:a.modifyTime}:{p2pTeamModifyMessage:a.modifyTime}),this.service.emit("onReceiveMessagesModified",[a])},t.v2MessageSyncModifiedHandler=function v2MessageSyncModifiedHandler(t){var a,u,m=this,h=filter(a=map$6(u=t.content.datas).call(u,(function(t){return completeMessage(m.core,t)}))).call(a,(function(t){var a,u=(null===(a=m.model.getMessageById(t.messageClientId))||void 0===a?void 0:a.modifyTime)||0;return(t.modifyTime||0)>u}));h.length>0&&(this.model.upsertMessages(h),forEach$1(h).call(h,(function(t){m.service.aiUtil.hasAI()&&m.core.V2NIMAIService.model.completeAiStream(t.messageClientId),m.core.eventBus.emit("forwardSend/V2NIMMessageService/modifyMsg",t)})),this.service.emit("onReceiveMessagesModified",h))},t.v2MessageSyncSuperTeamModifiedHandler=function v2MessageSyncSuperTeamModifiedHandler(t){this.v2MessageSyncModifiedHandler(t)},V2NIMMMessageHandlerImpl}(),yg=function(){function V2NIMMessageEventImpl(t,a){this.core=t,this.service=a,this.logger=this.core.logger}var t=V2NIMMessageEventImpl.prototype;return t.setListener=function setListener(){var t,a,u,m=this;this.core.eventBus.on("forwardReceive/V2NIMMessageService/sendMsg",bind$1(t=this.service.sendMessageFn).call(t,this.service)),this.core.eventBus.on("forwardReceive/V2NIMMessageService/revokeMessages",bind$1(a=this.service.deleteUtil.emitRevokeMessage).call(a,this.service.deleteUtil)),this.core.eventBus.on("forwardReceive/V2NIMMessageService/deleteMessages",bind$1(u=this.service.deleteUtil.deleteMessagesFn).call(u,this.service.deleteUtil)),this.core.eventBus.on("V2NIMConversationService/deleteConversation",(function(t){forEach$1(t).call(t,(function(t){return m.service.model.deleteMessages(t)}))})),this.core.eventBus.on("V2NIMAIService/receiveMessagesModified",(function(t){return m.service.emit("onReceiveMessagesModified",t)}))},t.beforeEmit=function beforeEmit(t){for(var a,u,m,h=this.service.name+"::emit "+t.toString(),g=arguments.length,M=new Array(g>1?g-1:0),I=1;I<g;I++)M[I-1]=arguments[I];if("onSendMessage"===t){var S=M[0];this.logger.log(""+h,S.messageClientId+"/"+S.messageServerId+"/"+S.createTime+";","sendingState:"+S.sendingState+";attachmentUploadState:"+(S.attachmentUploadState||0)+";messageStatus:"+(null===(a=S.messageStatus)||void 0===a?void 0:a.errorCode)+";config.lastMsg:"+(null===(u=S.messageConfig)||void 0===u?void 0:u.lastMessageUpdateEnabled)+";config.unread:"+(null===(m=S.messageConfig)||void 0===m?void 0:m.unreadEnabled))}else if("onReceiveMessages"===t||"onReceiveMessagesModified"===t){var T=M[0];this.logger.log(""+h,map$6(T).call(T,(function(t){var a,u;return t.messageClientId+"/"+t.messageServerId+"/"+t.createTime+";config.lastMsg:"+(null===(a=t.messageConfig)||void 0===a?void 0:a.lastMessageUpdateEnabled)+";config.unread:"+(null===(u=t.messageConfig)||void 0===u?void 0:u.unreadEnabled)})))}else if("onMessageRevokeNotifications"===t){var C=M[0];this.logger.log(""+h,map$6(C).call(C,(function(t){return"msg:"+t.messageRefer.messageClientId+"/"+t.messageRefer.messageServerId+";revokeAccountId:"+t.revokeAccountId})))}else if("onMessageDeletedNotifications"===t){var b=M[0];this.logger.log(""+h,map$6(b).call(b,(function(t){return"msg:"+t.messageRefer.messageClientId+"/"+t.messageRefer.messageServerId+";deleteTime:"+t.deleteTime})))}else{var E,k;(E=this.logger).log.apply(E,concat(k=[""+h]).call(k,M))}},V2NIMMessageEventImpl}(),Mg=function(t){function V2NIMMessageServiceImpl(a,u){var m;return void 0===u&&(u={}),(m=t.call(this,"V2NIMMessageService",a)||this).customAttachmentParsers=[],m.config={compatibleWithV1:!0},m.filterFn=void 0,m.core._registerDep(gm,"V2NIMConversationIdUtil"),m.core._registerDep(cg,"V2NIMMessageCreator"),m.core._registerDep(lg,"V2NIMMessageAttachmentCreator"),m.core._registerDep(ug,"V2NIMClientAntispamUtil"),m.receiptUtil=new ch(m.core,Qe(m)),m.fileUtil=new yh(m.core),m.sendUtil=new pg(m.core,Qe(m)),m.modifyUtil=new mg(m.core,Qe(m)),m.deleteUtil=new hg(m.core,Qe(m)),m.aiUtil=new vg(m.core,Qe(m)),m.model=new Mm,m.event=new yg(m.core,Qe(m)),m.handler=new fg(m.core,Qe(m)),"v2"!==m.core.options.apiVersion?Qe(m):(registerParser({cmdMap:Ih,cmdConfig:kh}),m.setOptions(u),m.setListener(),m)}wt(V2NIMMessageServiceImpl,t);var a=V2NIMMessageServiceImpl.prototype;return a.setOptions=function setOptions(t){var a;(null===(a=this.core.msg)||void 0===a?void 0:a.name)?this.config.compatibleWithV1=!0:this.config.compatibleWithV1=!1,this.config=Ut(this.config,t)},a.setListener=function setListener(){this.event.setListener()},a.reset=function reset(){this.model.reset(),this.receiptUtil.reset()},a.emit=function emit(a){for(var u,m,h,g,M=arguments.length,I=new Array(M>1?M-1:0),S=1;S<M;S++)I[S-1]=arguments[S];return(u=this.event).beforeEmit.apply(u,concat(m=[a]).call(m,I)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,I))},a.checkExtendUtil=function checkExtendUtil(){var t;if(!(null===(t=this.core.V2NIMMessageExtendUtil)||void 0===t?void 0:t.name))throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"V2NIMMessageLogUtil is not registered"}})},a.checkLogUtil=function checkLogUtil(){var t;if(!(null===(t=this.core.V2NIMMessageLogUtil)||void 0===t?void 0:t.name))throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"V2NIMMessageExtendUtil is not registered"}})},a.getMessageList=function getMessageList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),this.checkLogUtil(),u.next=4,this.core.V2NIMMessageLogUtil.getMessageList(t);case 4:return a=u.sent,a=this._filterMessageByClearTime(t.conversationId,a),a=this._filterMessagesByFn(a),u.abrupt("return",a);case 8:case"end":return u.stop()}}),_callee,this)})))},a.getMessageListEx=function getMessageListEx(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a;return lu.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),this.checkLogUtil(),u.next=4,this.core.V2NIMMessageLogUtil.getMessageList(t);case 4:return a=u.sent,a=this._filterMessageByClearTime(t.conversationId,a),u.abrupt("return",{messages:this._filterMessagesByFn(a),anchorMessage:a.length>0?a[a.length-1]:null});case 7:case"end":return u.stop()}}),_callee2,this)})))},a.getMessageListByRefers=function getMessageListByRefers(t){return this.checkV2(),this.checkLogUtil(),this.core.V2NIMMessageLogUtil.getMessageListByRefers(t)},a.clearHistoryMessage=function clearHistoryMessage(t){return this.checkV2(),this.checkLogUtil(),this.core.V2NIMMessageLogUtil.clearHistoryMessage(t)},a.clearRoamingMessage=function clearRoamingMessage(t){return this.checkV2(),this.checkLogUtil(),this.core.V2NIMMessageLogUtil.clearRoamingMessage(t)},a.pinMessage=function pinMessage(t,a){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.pinMessage(t,a)},a.unpinMessage=function unpinMessage(t,a){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.unpinMessage(t,a)},a.updatePinMessage=function updatePinMessage(t,a){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.updatePinMessage(t,a)},a.voiceToText=function voiceToText(t){return this.checkV2(),this.checkExtendUtil(),"string"==typeof t.duration&&(t.duration=Number(t.duration)),this.core.V2NIMMessageExtendUtil.voiceToText(t)},a.getPinnedMessageList=function getPinnedMessageList(t){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.getPinnedMessageList(t)},a.addQuickComment=function addQuickComment(t,a,u,m){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.addQuickComment(t,a,u,m)},a.removeQuickComment=function removeQuickComment(t,a,u){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.removeQuickComment(t,a,u)},a.getQuickCommentList=function getQuickCommentList(t){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.getQuickCommentList(t)},a.addCollection=function addCollection(t){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.addCollection(t)},a.removeCollections=function removeCollections(t){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.removeCollections(t)},a.updateCollectionExtension=function updateCollectionExtension(t,a){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.updateCollectionExtension(t,a)},a.getCollectionListByOption=function getCollectionListByOption(t){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.getCollectionListByOption(t)},a.getCollectionListExByOption=function getCollectionListExByOption(t){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.getCollectionListExByOption(t)},a.searchCloudMessages=function searchCloudMessages(t){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.searchCloudMessages(t)},a.searchCloudMessagesEx=function searchCloudMessagesEx(t){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.searchCloudMessagesEx(t)},a.getThreadMessageList=function getThreadMessageList(t){return this.checkV2(),this.checkExtendUtil(),this.core.V2NIMMessageExtendUtil.getThreadMessageList(t)},a.registerCustomAttachmentParser=function registerCustomAttachmentParser(t){var a;"function"==typeof t&&-1===indexOf(a=this.customAttachmentParsers).call(a,t)&&this.customAttachmentParsers.unshift(t)},a.unregisterCustomAttachmentParser=function unregisterCustomAttachmentParser(t){var a,u,m=indexOf(a=this.customAttachmentParsers).call(a,t);m>-1&&splice(u=this.customAttachmentParsers).call(u,m,1)},a.sendP2PMessageReceipt=function sendP2PMessageReceipt(t){return this.checkV2(),this.receiptUtil.sendP2PMessageReceipt(t)},a.isPeerRead=function isPeerRead(t){return this.checkV2(),this.receiptUtil.isPeerRead(t)},a.getP2PMessageReceipt=function getP2PMessageReceipt(t){return this.checkV2(),this.receiptUtil.getP2PMessageReceipt(t)},a.getTeamMessageReceipts=function getTeamMessageReceipts(t){return this.checkV2(),this.receiptUtil.getTeamMessageReceipts(t)},a.getTeamMessageReceiptDetail=function getTeamMessageReceiptDetail(t){return this.checkV2(),this.receiptUtil.getTeamMessageReceiptDetail(t)},a.sendTeamMessageReceipts=function sendTeamMessageReceipts(t){return this.checkV2(),this.receiptUtil.sendTeamMessageReceipts(t)},a.revokeMessage=function revokeMessage(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){return lu.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),u.abrupt("return",this.deleteUtil.revokeMessage(t,a));case 2:case"end":return u.stop()}}),_callee3,this)})))},a.deleteMessage=function deleteMessage(t,a){return this.checkV2(),this.deleteUtil.deleteMessage(t,a)},a.deleteMessages=function deleteMessages(t,a){return this.checkV2(),this.deleteUtil.deleteMessages(t,a)},a.cancelMessageAttachmentUpload=function cancelMessageAttachmentUpload(t){return this.checkV2(),this.fileUtil.cancelMessageAttachmentUpload(t)},a.markMsgsAck=function markMsgsAck(t){var a=this;if(t&&t.length>0){var u=[],m=[];forEach$1(t).call(t,(function(t){t.senderId===a.core.account&&t.senderId!==t.receiverId||(1===t.conversationType?u.push(t):2===t.conversationType&&m.push(t))})),u.length>0&&this.core.sendCmd("v2BatchMarkRead",{sid:7,cid:2,ids:map$6(u).call(u,(function(t){return t.messageServerId}))}),m.length>0&&this.core.sendCmd("v2BatchMarkRead",{sid:8,cid:3,ids:map$6(m).call(m,(function(t){return t.messageServerId}))})}},a.sendMessage=function sendMessage(t,a,u,m){var h;return void 0===u&&(u={}),__awaiter(this,void 0,void 0,lu.mark((function _callee4(){var g,M,I,S,T,C,b,E,k=this;return lu.wrap((function _callee4$(R){for(;;)switch(R.prev=R.next){case 0:if(this.checkV2(),validate({message:{type:"object"}},{message:t},"",!0),t.messageClientId=t.messageClientId||Gu(),!t.conversationId||t.conversationId===a){R.next=5;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"sendMessage: message.conversationId is not equal to conversationId"}});case 5:if(validate(wm,{conversationId:a,message:t,params:u},"",!0),validateConversationId(this.core.account,a),2!==(g=this.core.V2NIMConversationIdUtil.parseConversationType(a))&&3!==g||!u.robotConfig||u.robotConfig.accountId){R.next=10;break}throw new Yl({detail:{reason:"When conversationType is team or superTeam, account is required in robotInfo account is required"}});case 10:if(2!==g&&3!==g||!u.targetConfig){R.next=20;break}if(M=u.targetConfig.receiverIds,3!==g||!1!==u.targetConfig.inclusive){R.next=14;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"setting inclusive to false for super teams is not allowed"}});case 14:if(M=filter(M).call(M,(function(t){return t&&t!==k.core.account})),0!==M.length){R.next=17;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"receiverIds cannot be empty or only contain yourself"}});case 17:u.targetConfig.receiverIds=M,R.next=21;break;case 20:u.targetConfig=void 0;case 21:return(null===(h=u.aiConfig)||void 0===h?void 0:h.aiStream)&&this.aiUtil.checkAI(),I=this.core.timeOrigin.getTimeNode(),S=this.sendUtil.prepareMessage(t,a,u),T=S.messageBeforeSend,C=S.clientAntispamResult,b=S.hiddenParams,this.logger.log("V2SendMessage start:"+T.messageClientId+"/"+T.createTime+";conversation:"+a+";","NTPTime:"+this.core.timeOrigin.getNTPTime(I)),R.prev=25,R.next=28,this.sendUtil.doSendMessage({apiCallingTimeNode:I,messageBeforeSend:T,clientAntispamResult:C,hiddenParams:b,progress:m});case 28:E=R.sent,R.next=35;break;case 31:throw R.prev=31,R.t0=R.catch(25),this.logger.warn("V2SendMessage end:"+T.messageClientId+".",R.t0 instanceof Wl?"failed:"+R.t0.code:"failed"),R.t0;case 35:return E.message.senderId===E.message.receiverId&&this.markMsgsAck([E.message]),this.logger.log("V2SendMessage end:"+E.message.messageClientId+"/"+E.message.messageServerId+"/"+E.message.createTime),R.abrupt("return",E);case 38:case"end":return R.stop()}}),_callee4,this,[[25,31]])})))},a.replyMessage=function replyMessage(t,a,u,m){return void 0===u&&(u={}),__awaiter(this,void 0,void 0,lu.mark((function _callee5(){var h,g,M,I,S,T;return lu.wrap((function _callee5$(C){for(;;)switch(C.prev=C.next){case 0:if(this.checkV2(),validate({message:{type:"object"}},{message:t},"",!0),t.messageClientId=t.messageClientId||Gu(),validate(Am,{message:t,replyMessage:a,params:u},"",!0),validateConversationId(this.core.account,a.conversationId),2!==t.conversationType&&3!==t.conversationType||!u.robotConfig||u.robotConfig.accountId){C.next=7;break}throw new Yl({detail:{reason:"When conversationType is team or superTeam, account is required in robotInfo account is required"}});case 7:return h=this.core.timeOrigin.getTimeNode(),g=this.sendUtil.prepareMessage(t,a.conversationId,u,a),M=g.messageBeforeSend,I=g.clientAntispamResult,S=g.hiddenParams,C.next=11,this.sendUtil.doSendMessage({apiCallingTimeNode:h,messageBeforeSend:M,clientAntispamResult:I,hiddenParams:S,progress:m});case 11:return(T=C.sent).message.senderId===T.message.receiverId&&this.markMsgsAck([T.message]),C.abrupt("return",T);case 14:case"end":return C.stop()}}),_callee5,this)})))},a.modifyMessage=function modifyMessage(t,a){this.checkV2(),this.checkLogin(),validate(nh,t,"message",!0),validate(ah,a,"params",!0),this.modifyUtil.checkIfModify(t,a);var u=this.modifyUtil.prepareMessage(t,a),m=u.messageBeforeSend,h=u.clientAntispamResult;return this.modifyUtil.modifyMessage(m,h)},a.stopAIStreamMessage=function stopAIStreamMessage(t,a){if(this.checkV2(),this.aiUtil.checkAI(),validate(ih,t,"message",!0),validate(oh,a,"params",!0),2===a.operationType&&!a.updateContent)throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"V2NIMMessage::stopAIStreamMessage updateContent empty"}});return this.aiUtil.stopAIStreamMessage(t,a)},a.regenAIMessage=function regenAIMessage(t,a){return this.checkV2(),this.aiUtil.checkAI(),validate(ih,t,"message",!0),validate(sh,a,"params",!0),this.aiUtil.regenAIMessage(t,a)},a.sendMessageFn=function sendMessageFn(t){if(t.msgAckSnapshot){var a=t.msgAckSnapshot,u={conversationId:t.conversationId,messageServerId:t.messageServerId,messageClientId:t.messageClientId,readCount:0,unreadCount:Number(a)};delete t.msgAckSnapshot,this.emit("onReceiveTeamMessageReadReceipts",[u])}t=formatMessageAttachment(t,this.core),this.model.upsertMessages([t]),this.core.eventBus.emit("V2NIMMessageService/sendMessage",t,t.sendingState)},a.setMessageFilter=function setMessageFilter(t){null!=t?t&&"function"==typeof t.shouldIgnore&&(this.filterFn=t.shouldIgnore):this.filterFn=void 0},a._filterMessage=function _filterMessage(t){if("function"==typeof this.filterFn)try{return!0===this.filterFn(t)}catch(a){return this.logger.error("V2NIMMessage::triggerMessageFilter "+t.messageClientId+" error:",a),!1}return!1},a._filterMessagesByFn=function _filterMessagesByFn(t){var a=this;return filter(t).call(t,(function(t){return!a._filterMessage(t)}))},a._filterMessageByClearTime=function _filterMessageByClearTime(t,a){var u=uu.localStorage.getItem("nim_"+this.core.account+"_"+t+"_clearTime"),m=u?Bu(u):0;return m>0?filter(a).call(a,(function(t){return t.createTime>=m})):a},V2NIMMessageServiceImpl}(gp),Ig={super_team:3,p2p:1,team:2},_g=((og={})[3]="super_team",og[1]="p2p",og[0]="p2p",og[2]="team",og);function getConvInfoFromSessionId(t,a){void 0===a&&(a="|");var u=indexOf(t).call(t,a);if(-1===u)return{target:"",type:0};var m=slice(t).call(t,0,u);return{target:slice(t).call(t,u+1),type:Ig[m]||0}}function getSessionIdFromConvInfo(t,a){return _g[t]+"|"+a}var Sg=function(){function V2NIMLocalConversationModelImpl(){this.map=new _c,this.capacity=1e4,this.readTimeMap=new _c,this.stickTopMap=new _c}var t=V2NIMLocalConversationModelImpl.prototype;return t.reset=function reset(){map$6(this).clear(),this.readTimeMap.clear(),this.stickTopMap.clear()},t.count=function count(){return map$6(this).size},t.sort=function sort$1(){var t,a=this,u=nu(values(t=map$6(this)).call(t));sort(u).call(u,(function(t,a){return a.sortOrder-t.sortOrder})),map$6(this).clear(),forEach$1(u).call(u,(function(t){map$6(a).set(t.conversationId,t)}))},t.processConversation=function processConversation(t){return"string"==typeof t.lastMessage&&delete t.lastMessage,void 0===t.localExtension&&(t.localExtension=""),t},t.getById=function getById(t){return map$6(this).get(t)},t.getAll=function getAll(){var t,a=nu(values(t=map$6(this)).call(t));return sort(a).call(a,(function(t,a){return a.sortOrder-t.sortOrder}))},t.getStickTopList=function getStickTopList(){var t,a,u=nu(values(t=map$6(this)).call(t));return sort(a=filter(u).call(u,(function(t){return t.stickTop}))).call(a,(function(t,a){return a.sortOrder-t.sortOrder}))},t.getByOption=function getByOption(t,a,u){var m,h=u.conversationTypes,g=u.onlyUnread,M=[];forEach$1(m=map$6(this)).call(m,(function(t){h&&h.length>0&&!includes(h).call(h,t.type)||g&&!t.unreadCount||u.ignoreMuted&&t.mute||M.push(t)})),M=sort(M).call(M,(function(t,a){return a.sortOrder-t.sortOrder}));var I=0;t>0&&(I=findIndexWithinTargetValue(M,"sortOrder",t),M[I]&&M[I].sortOrder===t&&(I+=1));var S=slice(M).call(M,I).length;return(M=slice(M).call(M,I,I+a)).length>0?{offset:S>a?M[M.length-1].sortOrder:0,finished:!(S>a),conversationList:M}:{offset:0,finished:!0,conversationList:M}},t.upsert=function upsert(t){var a=t.conversationId,u=map$6(this).get(a);if(!u){var m=this.processConversation(Ut({stickTop:this.getStickTop(a),localExtension:"",lastMessage:null,unreadCount:0,sortOrder:0,createTime:0,updateTime:0},t));return this.setLRU(a,m),m.unreadCount>0}var h=t.unreadCount!==u.unreadCount,g=Ut({},u,t);return g=this.processConversation(g),this.setLRU(a,g),h},t.setLRU=function setLRU(t,a){if(map$6(this).has(t))map$6(this).delete(t);else if(map$6(this).size>=this.capacity){var u,m=keys(u=map$6(this)).call(u).next().value;m&&map$6(this).delete(m)}map$6(this).set(t,a)},t.bulkUpsert=function bulkUpsert(t){var a=this,u=!1;return forEach$1(t).call(t,(function(t){a.upsert(t)&&(u=!0)})),u},t.deleteById=function deleteById(t){var a=this.getById(t);if(a)return map$6(this).delete(t),a},t.updateReadTime=function updateReadTime(t,a){this.readTimeMap.set(t,a)},t.getReadTime=function getReadTime(t){return this.readTimeMap.get(t)||0},t.updateStickTop=function updateStickTop(t,a){a?this.stickTopMap.set(t,!0):this.stickTopMap.delete(t)},t.getStickTop=function getStickTop(t){return this.stickTopMap.get(t)||!1},V2NIMLocalConversationModelImpl}(),Tg={"4_14":"v2LocalConvSyncReadTime","4_20":"v2LocalConvSyncSuperTeamReadTime","4_22":"v2LocalConvSyncMoreRoaming","4_23":"v2LocalConvSyncStickTop","4_25":"v2LocalConvSyncReliableInfo","7_16":"v2LocalConvMarkReadTime","7_25":"v2LocalConvMultiMarkReadTime","7_116":"v2LocalConvMultiSyncReadTime","21_25":"v2LocalConvSuperTeamMarkReadTime","21_32":"v2LocalConvSuperTeamMultiMarkReadTime","21_125":"v2LocalConvSuperTeamMultiSyncReadTime","33_12":"v2LocalConvStickTopAdd","33_13":"v2LocalConvStickTopDelete","23_112":"v2LocalConvStickTopMultiSyncAdd","23_113":"v2LocalConvStickTopMultiSyncDelete","23_114":"v2LocalConvStickTopMultiSyncUpdate"},Cg="V2NIMLocalConversationService",bg={id:1,ext:2,createTime:{id:3,retType:"number"},updateTime:{id:4,retType:"number"}},Eg={scene:1,to:2,timetag:3},kg={v2LocalConvSyncReadTime:{sid:4,cid:14,service:Cg,response:[{type:"StrLongMap",name:"p2p"},{type:"LongLongMap",name:"team"},{type:"Long",name:"timetag"}]},v2LocalConvSyncSuperTeamReadTime:{sid:4,cid:20,service:Cg,response:[{type:"LongLongMap",name:"superTeam"}]},v2LocalConvSyncMoreRoaming:{sid:4,cid:22,service:Cg,response:[]},v2LocalConvSyncStickTop:{sid:4,cid:23,service:Cg,response:[{type:"Long",name:"timetag"},{type:"Bool",name:"isThereAnyChange"},{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(bg)}]},v2LocalConvSyncReliableInfo:{sid:4,cid:25,service:Cg,response:[]},v2LocalConvMarkReadTime:{sid:7,cid:16,service:Cg,params:[{type:"Byte",name:"scene"},{type:"String",name:"to"},{type:"Long",name:"timetag"}]},v2LocalConvMultiMarkReadTime:{sid:7,cid:25,service:Cg,ignoreErrCodes:[700],params:[{type:"PropertyArray",name:"tags",reflectMapper:Eg}]},v2LocalConvMultiSyncReadTime:{sid:7,cid:116,service:Cg,response:[{type:"Byte",name:"scene"},{type:"String",name:"to"},{type:"Long",name:"timetag"}]},v2LocalConvSuperTeamMarkReadTime:{sid:21,cid:25,service:Cg,params:[{type:"Long",name:"to"},{type:"Long",name:"timetag"}]},v2LocalConvSuperTeamMultiMarkReadTime:{sid:21,cid:32,service:Cg,ignoreErrCodes:[700],params:[{type:"PropertyArray",name:"tags",reflectMapper:Eg}]},v2LocalConvSuperTeamMultiSyncReadTime:{sid:21,cid:125,service:Cg,response:[{type:"Long",name:"to"},{type:"Long",name:"timetag"}]},v2LocalConvStickTopAdd:{sid:33,cid:12,service:Cg,params:[{type:"Property",name:"tag",reflectMapper:bg}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(bg)}]},v2LocalConvStickTopDelete:{sid:33,cid:13,service:Cg,params:[{type:"Property",name:"tag",reflectMapper:bg}],response:[{type:"Long",name:"timetag"}]},v2LocalConvStickTopMultiSyncAdd:{sid:23,cid:112,service:Cg,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(bg)}]},v2LocalConvStickTopMultiSyncDelete:{sid:23,cid:113,service:Cg,response:[{type:"Long",name:"timetag"},{type:"Property",name:"data",reflectMapper:invertSerializeItem(bg)}]},v2LocalConvStickTopMultiSyncUpdate:{sid:23,cid:114,service:Cg,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(bg)}]}};function chunk(t,a){t=t||[],a=a||1,a=Math.max(Math.floor(a),1);for(var u=[],m=0;m<t.length;m+=a)u.push(slice(t).call(t,m,m+a));return u}function isObject(t){var a=typeof t;return null!=t&&("object"==a||"function"==a)}var Rg=Math.max,Ag=Math.min;function debounce(t,a,u){var m,h,g,M,I,S,T=0,C=!1,b=!1,E=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function invokeFunc(a){var u=m,g=h;return m=h=void 0,T=a,M=t.apply(g,u)}function leadingEdge(t){return T=t,I=po(timerExpired,a),C?invokeFunc(t):M}function shouldInvoke(t){var u=t-S;return void 0===S||u>=a||u<0||b&&t-T>=g}function timerExpired(){var t=eo();if(shouldInvoke(t))return trailingEdge(t);I=po(timerExpired,function remainingWait(t){var u=a-(t-S);return b?Ag(u,g-(t-T)):u}(t))}function trailingEdge(t){return I=void 0,E&&m?invokeFunc(t):(m=h=void 0,M)}function debounced(){var t=eo(),u=shouldInvoke(t);if(m=arguments,h=this,S=t,u){if(void 0===I)return leadingEdge(S);if(b)return clearTimeout(I),I=po(timerExpired,a),invokeFunc(S)}return void 0===I&&(I=po(timerExpired,a)),M}return a=Number(a)||0,isObject(u)&&(C=!!u.leading,g=(b="maxWait"in u)?Rg(Number(u.maxWait)||0,a):g,E="trailing"in u?!!u.trailing:E),debounced.cancel=function cancel(){void 0!==I&&clearTimeout(I),T=0,m=S=h=I=void 0},debounced.flush=function flush(){return void 0===I?M:trailingEdge(eo())},debounced}function throttle(t,a,u){var m=!0,h=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return isObject(u)&&(m="leading"in u?!!u.leading:m,h="trailing"in u?!!u.trailing:h),debounce(t,a,{leading:m,maxWait:a,trailing:h})}function _createForOfIteratorHelperLoose$8(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$8(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$8(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$8(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$8(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var wg,Ng=function(){function V2NIMLocalConversationUnreadImpl(t,a){var u=this;this.totalUnreadCount=void 0,this.unreadCountByFilter={},this.currentConversationId=void 0,this._setCurrConvThrottle=throttle((function(){u.currentConversationId&&u._setCurrConv(u.currentConversationId)}),5e3,{leading:!1}),this.core=t,this.service=a,this.model=a.model,this.logger=a.logger}var t=V2NIMLocalConversationUnreadImpl.prototype;return t.reset=function reset(){this.totalUnreadCount=void 0,this.unreadCountByFilter={},this.currentConversationId=void 0,this._setCurrConvThrottle.flush()},t.getTotalUnreadCount=function getTotalUnreadCount(){return this.totalUnreadCount},t.resetTotalAfterSyncDone=function resetTotalAfterSyncDone(){var t,a=reduce(t=this.service.model.getAll()).call(t,(function(t,a){return t+(a.unreadCount||0)}),0),u=this.totalUnreadCount;return void 0!==u&&u===a||(this.totalUnreadCount=a,this.service.emit("onTotalUnreadCountChanged",a)),a},t.digestUnreadCountChange=function digestUnreadCountChange(){this._digest()},t._digest=function _digest(){var t,a=this,u=this.totalUnreadCount,m=reduce(t=this.service.model.getAll()).call(t,(function(t,a){return t+(a.unreadCount||0)}),0);this.core.logger.log("V2NIMConversation::digestUnreadCountChange:oldUnreadCount "+u+", newUnreadCount "+m),u!==m&&(this.totalUnreadCount=m,this.service.emit("onTotalUnreadCountChanged",m));var h=Gt(this.unreadCountByFilter);forEach$1(h).call(h,(function(t){var u=JSON.parse(t),m=a.getUnreadCountByFilter(u),h=a.unreadCountByFilter[t];a.unreadCountByFilter[t]=m,u.equals=bind$1(equals$1).call(equals$1,u),h!==m&&a.service.emit("onUnreadCountChangedByFilter",u,m)}))},t.clearUnreadCount=function clearUnreadCount(t){var a=this,u=reduce(t).call(t,(function(t,u){return a.service.model.upsert({conversationId:u.conversationId,type:u.type,unreadCount:0})&&t.push(u.conversationId),t}),[]);if(u.length>0){var m=map$6(u).call(u,(function(t){return a.service.model.getById(t)}));this.service.triggerConversationChanged(m),this.digestUnreadCountChange()}},t.getUnreadCountByIds=function getUnreadCountByIds(t){var a=this;return t=uniq(t),reduce(t).call(t,(function(t,u){var m=a.service.model.getById(u);return t+(m&&m.unreadCount||0)}),0)},t.getUnreadCountByFilter=function getUnreadCountByFilter(t){var a,u=this.service.model.count(),m=this.service.model.getByOption(0,u,{conversationTypes:t.conversationTypes,ignoreMuted:t.ignoreMuted});return reduce(a=m.conversationList).call(a,(function(t,a){return t+(a.unreadCount||0)}),0)},t.isMessageUnread=function isMessageUnread(t,a){var u;return void 0===a&&(a=0),t.createTime>a&&t.senderId!==this.core.account&&200===t.messageStatus.errorCode&&!1!==(null===(u=t.messageConfig)||void 0===u?void 0:u.unreadEnabled)},t.isMessageReferUnread=function isMessageReferUnread(t,a){void 0===a&&(a=0);var u=this.core.V2NIMMessageService.model.getMessageById(t.messageClientId);return u?this.isMessageUnread(u,a):t.createTime>a&&t.senderId!==this.core.account},t.countUnreadByMessageInMemory=function countUnreadByMessageInMemory(t,a){var u=this;void 0===a&&(a=0);var m=0,h=this.core.V2NIMMessageService.model.getMessagesByConversationId(t);return forEach$1(h).call(h,(function(t){u.isMessageUnread(t,a)&&m++})),m},t.addFilter=function addFilter(t){var a=generateFilterKey$1(t);if(void 0!==this.unreadCountByFilter[a])throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_ALREADY_EXIST});var u=JSON.parse(a),m=this.getUnreadCountByFilter(u);this.unreadCountByFilter[a]=m,this.service.emit("onUnreadCountChangedByFilter",u,m)},t.deleteFilter=function deleteFilter(t){var a=generateFilterKey$1(t);if(void 0===this.unreadCountByFilter[a])throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST});delete this.unreadCountByFilter[a]},t.markConversationRead=function markConversationRead(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u,m,h,g;return lu.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:if(a=this.model.getById(t),u=this.core.V2NIMConversationIdUtil.parseConversationTargetId(t),m=this.core.V2NIMConversationIdUtil.parseConversationType(t),h=this.model.getReadTime(t),a){M.next=6;break}return M.abrupt("return",h||this.core.timeOrigin.getNTPTime());case 6:if(g=this.service.compute.computeReadTimeForMark(a),!(h>=g)){M.next=10;break}return this.logger.log("V2LocalConv::markConversationRead currentReadTime >= readTime "+t+","+h+","+g),M.abrupt("return",h);case 10:if(3!==m){M.next=15;break}return M.next=13,this.core.sendCmd("v2LocalConvSuperTeamMarkReadTime",{timetag:g,to:u});case 13:M.next=17;break;case 15:return M.next=17,this.core.sendCmd("v2LocalConvMarkReadTime",{scene:1===m?0:2===m?1:2,timetag:g,to:u});case 17:return this.model.updateReadTime(t,g),M.abrupt("return",g);case 19:case"end":return M.stop()}}),_callee,this)})))},t.markMultiConversationRead=function markMultiConversationRead(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h,g,M,I,S,T,C,b=this;return lu.wrap((function _callee2$(E){for(;;)switch(E.prev=E.next){case 0:a={cmd:"v2LocalConvSuperTeamMultiMarkReadTime",params:[]},u={cmd:"v2LocalConvMultiMarkReadTime",params:[]},forEach$1(t).call(t,(function(t){var m=b.model.getById(t);if(m){var h=b.core.V2NIMConversationIdUtil.parseConversationTargetId(t),g=b.core.V2NIMConversationIdUtil.parseConversationType(t),M=b.model.getReadTime(t),I=b.service.compute.computeReadTimeForMark(m);if(!(M>=I)){var S={conversationId:t,scene:1===g?0:2===g?1:2,timetag:I,to:h};3===g?a.params.push(S):u.params.push(S)}}})),m=chunk(a.params,50),h=chunk(u.params,50),g=_createForOfIteratorHelperLoose$8(m);case 6:if((M=g()).done){E.next=19;break}return I=M.value,E.prev=8,E.next=11,this.core.sendCmd(a.cmd,{tags:I});case 11:E.next=16;break;case 13:E.prev=13,E.t0=E.catch(8),this.logger.warn("markMultiConversationRead::error:",map$6(I).call(I,(function(t){return t.conversationId})),E.t0);case 16:forEach$1(I).call(I,(function(t){b.model.updateReadTime(t.conversationId,t.timetag)}));case 17:E.next=6;break;case 19:S=_createForOfIteratorHelperLoose$8(h);case 20:if((T=S()).done){E.next=33;break}return C=T.value,E.prev=22,E.next=25,this.core.sendCmd(u.cmd,{tags:C});case 25:E.next=30;break;case 27:E.prev=27,E.t1=E.catch(22),this.logger.warn("markMultiConversationRead::error:",map$6(C).call(C,(function(t){return t.conversationId})),E.t1);case 30:forEach$1(C).call(C,(function(t){b.model.updateReadTime(t.conversationId,t.timetag)}));case 31:E.next=20;break;case 33:case"end":return E.stop()}}),_callee2,this,[[8,13],[22,27]])})))},t.setCurrentConversation=function setCurrentConversation(t){var a=this.currentConversationId;this.currentConversationId=t,this.currentConversationId&&this._setCurrConv(this.currentConversationId),a&&a!==this.currentConversationId&&(this._setCurrConvThrottle.flush(),this._setCurrConv(a))},t._setCurrConv=function _setCurrConv(t){var a=this,u=this.model.getById(t),m=(null==u?void 0:u.unreadCount)||0;u&&(u.unreadCount=0),u&&m>0&&(this.service.triggerConversationChanged([u]),this._digest()),this.markConversationRead(t).catch((function(t){a.logger.warn("_setConv markRead failed",t)}))},V2NIMLocalConversationUnreadImpl}();function generateFilterKey$1(t){var a=t.conversationTypes;return a&&(a=sort(a).call(a)),Vn({conversationGroupId:t.conversationGroupId,conversationTypes:a,ignoreMuted:t.ignoreMuted})}function equals$1(t){return Vn(this)===generateFilterKey$1(t)}function formatLastMessageFromMessage(t,a,u,m){var h,g;void 0===u&&(u=0);var M=a=formatMessageAttachment(a,t),I=M.messageType,S=M.subType,T=M.text,C=M.attachment,b=M.serverExtension,E="";if(a.senderId!==t.account&&5!==I){E=get(a,"fromNick");var k=null===(g=null===(h=t.V2NIMFriendService)||void 0===h?void 0:h.model)||void 0===g?void 0:g.getFriend(a.senderId);k&&k.alias&&(E=k.alias)}return JSON.parse(Vn({lastMessageState:u,messageRefer:formatMessageRefer(t,a),messageType:I,subType:S,text:T,attachment:C,serverExtension:b,callbackExtension:a.callbackExtension,sendingState:m,senderName:E}))}function formatConversationFields(t,a){return a&&a.length>0?map$6(a).call(a,(function(a){return formatConversationField(t,a)})):[]}function formatConversationField(t,a){var u=a;if("string"==typeof u.lastMessage)if(""===u.lastMessage);else if(1===u.lastMessageState){var m=formatRevokeMessage(t,deserialize(JSON.parse(u.lastMessage),invertSerializeItem(bh)));u.lastMessage=function formatLastMessageFromNotification(t,a){var u=a.messageRefer,m=a.revokeAccountId,h=a.revokeType,g=a.callbackExtension,M=a.serverExtension,I=a.postscript,S=function calcSenderNameFromNotification(t,a,u,m){var h,g,M,I,S,T,C,b;if(a!==t.account){var E=null===(g=null===(h=t.V2NIMFriendService)||void 0===h?void 0:h.model)||void 0===g?void 0:g.getFriend(a);if(E&&E.alias)return E.alias;if(2===u){var k=null===(I=null===(M=t.V2NIMTeamService)||void 0===M?void 0:M.memberModel)||void 0===I?void 0:I.getById(m,1,a);if(k&&k.teamNick)return k.teamNick}else if(3===u){var R=null===(T=null===(S=t.V2NIMTeamService)||void 0===S?void 0:S.memberModel)||void 0===T?void 0:T.getById(m,1,a);if(R&&R.teamNick)return R.teamNick}var A=null===(b=null===(C=t.V2NIMUserService)||void 0===C?void 0:C.model)||void 0===b?void 0:b.getUser(a);return A&&A.name?A.name:void 0}}(t,a.revokeAccountId,a.messageRefer.conversationType,a.messageRefer.receiverId)||"";return JSON.parse(Vn({lastMessageState:1,messageRefer:u,revokeAccountId:m,revokeType:h,callbackExtension:g,serverExtension:M,text:I||"",senderName:S}))}(t,m)}else if(0===u.lastMessageState){var h=deserialize(JSON.parse(u.lastMessage),invertSerializeItem(_h));u.lastMessage=formatLastMessageFromMessage(t,h,u.lastMessageState,h.senderId===t.account?1:void 0)}else 2===u.lastMessageState&&delete u.lastMessage;return u}function formatConversationByField(t){var a=t.version,u=t.deleteFlag;return{conversation:__rest(t,["version","deleteFlag"]),version:a,deleteFlag:u}}!function(t){t[t.createConversation=1]="createConversation",t[t.deleteConversation=2]="deleteConversation",t[t.updateConversation=3]="updateConversation",t[t.setConversationTop=4]="setConversationTop",t[t.clearConversationUnread=5]="clearConversationUnread",t[t.addConversationToGroup=6]="addConversationToGroup",t[t.removeConversationFromGroup=7]="removeConversationFromGroup",t[t.modifyConversationOnSendMessage=8]="modifyConversationOnSendMessage",t[t.modifyConversationOnDeleteMessage=9]="modifyConversationOnDeleteMessage",t[t.modifyConversationOnRecallMessage=10]="modifyConversationOnRecallMessage",t[t.modifyConversationOnClearMessage=11]="modifyConversationOnClearMessage",t[t.oneClickClearConversationUnread=12]="oneClickClearConversationUnread",t[t.modifyConversationOnUpdateMessage=13]="modifyConversationOnUpdateMessage"}(wg||(wg={}));var xg=function(){function V2NIMLocalConversationComputeImpl(t,a){this.core=t,this.service=a}var t=V2NIMLocalConversationComputeImpl.prototype;return t.computeFromExternal=function computeFromExternal(t){var a,u,m;if(0===t.type)return t;var h=this.core.V2NIMConversationIdUtil.parseConversationType(t.conversationId),g=this.core.V2NIMConversationIdUtil.parseConversationTargetId(t.conversationId),M={};if((null===(a=this.core.V2NIMSettingService)||void 0===a?void 0:a.name)&&(M.mute=this.core.V2NIMSettingService.getConversationMuteStatus(t.conversationId)),1===h&&this.hasUserService){var I,S=this.core.V2NIMUserService.model.getUser(g),T=this.hasFriendService?this.core.V2NIMFriendService.model.getFriend(g):void 0;t.conversationId===(null===(u=t.lastMessage)||void 0===u?void 0:u.messageRefer.conversationId)&&(I=null===(m=t.lastMessage)||void 0===m?void 0:m.senderName),M.name=(null==T?void 0:T.alias)||(null==S?void 0:S.name)||I||g,M.avatar=(null==S?void 0:S.avatar)||""}else if(2===h&&this.hasTeamService){var C=this.core.V2NIMTeamService.model.getById(g,1);M.name=(null==C?void 0:C.name)||g,M.avatar=(null==C?void 0:C.avatar)||""}else if(3===h&&this.hasTeamService){var b=this.core.V2NIMTeamService.model.getById(g,2);M.name=(null==b?void 0:b.name)||g,M.avatar=(null==b?void 0:b.avatar)||""}return Ut(t,M),t},t.computeSortOrder=function computeSortOrder(t,a){return a?t?a+1e15:a:t?1e15:0},t.computeReadTimeForMark=function computeReadTimeForMark(t){var a,u,m,h=t.conversationId,g=this.service.model.getReadTime(h);if(null===(u=null===(a=null==t?void 0:t.lastMessage)||void 0===a?void 0:a.messageRefer)||void 0===u?void 0:u.createTime)m=t.lastMessage.messageRefer.createTime;else{if(0===t.unreadCount&&g>0)return g;if(!this.core.timeOrigin.checkNodeReliable())return g||0;m=this.core.timeOrigin.getNTPTime()}return m},t.computeConvWithLastMsg=function computeConvWithLastMsg(t,a){var u,m=a||this.core.V2NIMMessageService.model.getLastMessageOfConversation(t.conversationId);if(m&&!1!==(null===(u=m.messageConfig)||void 0===u?void 0:u.lastMessageUpdateEnabled)){var h=formatLastMessageFromMessage(this.core,m,0,m.sendingState);t.lastMessage=h,t.createTime=t.createTime||m.createTime,t.updateTime=m.createTime,t.sortOrder=this.computeSortOrder(t.stickTop,m.createTime)}return t},t.computeConvWithUnread=function computeConvWithUnread(t,a){var u=this.service.model.getReadTime(t.conversationId),m=this.service.unread.currentConversationId;if(m&&(null==a?void 0:a.conversationId)===m)return t.unreadCount=0,this.service.unread._setCurrConvThrottle(),t;var h=t.unreadCount||0;return a?a&&this.service.unread.isMessageUnread(a)&&(h+=1):h=this.service.unread.countUnreadByMessageInMemory(t.conversationId,u),t.unreadCount=h,t},t.computeConvByMsgsCache=function computeConvByMsgsCache(t,a){var u,m=this.service.model.getById(t),h=this.core.V2NIMConversationIdUtil.parseConversationType(t),g=this.core.V2NIMMessageService.model.getLastMessageOfConversation(t),M=null==a?void 0:a.updateTime,I=0;I=M||(g&&g.createTime?g.createTime:m&&m.updateTime?m.updateTime:this.core.timeOrigin.getNTPTime());var S=this.service.model.getStickTop(t),T=Ut(Ut({conversationId:t,type:h,stickTop:S,localExtension:(null==m?void 0:m.localExtension)||"",lastMessage:null,unreadCount:0},a),{createTime:(null==m?void 0:m.createTime)||I,updateTime:I,sortOrder:this.computeSortOrder(S,I)});if(g&&!1!==(null===(u=g.messageConfig)||void 0===u?void 0:u.lastMessageUpdateEnabled)){var C=formatLastMessageFromMessage(this.core,g,0,g.sendingState);T.lastMessage=C}return T},Ye(V2NIMLocalConversationComputeImpl,[{key:"hasUserService",get:function get(){var t;return!!(null===(t=this.core.V2NIMUserService)||void 0===t?void 0:t.name)}},{key:"hasFriendService",get:function get(){var t;return!!(null===(t=this.core.V2NIMFriendService)||void 0===t?void 0:t.name)}},{key:"hasTeamService",get:function get(){var t;return!!(null===(t=this.core.V2NIMTeamService)||void 0===t?void 0:t.name)}},{key:"hasMessageService",get:function get(){var t;return!!(null===(t=this.core.V2NIMMessageService)||void 0===t?void 0:t.name)}}]),V2NIMLocalConversationComputeImpl}(),Og=function(){function V2NIMLocalConversationHandlerImpl(t,a){this.core=t,this.service=a,this.model=this.service.model,this.logger=this.core.logger}var t=V2NIMLocalConversationHandlerImpl.prototype;return t.v2LocalConvSyncStickTopHandler=function v2LocalConvSyncStickTopHandler(t){var a=this,u=t.content,m=u.timetag,h=u.isThereAnyChange,g=u.datas;if(h){var M=this.model.getAll(),I=map$6(g).call(g,(function(t){var u=getConvInfoFromSessionId(t.id),m=u.target,h=u.type,g=a.core.V2NIMConversationIdUtil.conversationId(h,m);return a.model.updateStickTop(g,!0),g}));forEach$1(M).call(M,(function(t){includes(I).call(I,t.conversationId)?(t.stickTop=!0,t.updateTime=t.updateTime>m?t.updateTime:m):t.stickTop=!1,a.model.updateStickTop(t.conversationId,t.stickTop)})),this.model.bulkUpsert(M)}},t.v2LocalConvSyncReadTimeHandler=function v2LocalConvSyncReadTimeHandler(t){var a,u,m=this,h=t.content.p2p||{},g=t.content.team.m_map||{};this.logger.log("v2SyncLocalConvAck::",h,g),forEach$1(a=Gt(h)).call(a,(function(t){var a=m.core.V2NIMConversationIdUtil.p2pConversationId(t),u=m.model.getReadTime(a);h[t]>u&&(m.model.updateReadTime(a,h[t]),m.service.emit("onConversationReadTimeUpdated",a,h[t]))})),forEach$1(u=Gt(g)).call(u,(function(t){var a=m.core.V2NIMConversationIdUtil.teamConversationId(t),u=m.model.getReadTime(a);g[t]>u&&(m.model.updateReadTime(a,g[t]),m.service.emit("onConversationReadTimeUpdated",a,g[t]))}))},t.v2LocalConvSyncSuperTeamReadTimeHandler=function v2LocalConvSyncSuperTeamReadTimeHandler(t){var a,u=this,m=t.content.superTeam.m_map;this.logger.log("v2SyncLocalSuperTeamConvAck::",m),forEach$1(a=Gt(m)).call(a,(function(t){var a=u.core.V2NIMConversationIdUtil.superTeamConversationId(t),h=u.model.getReadTime(a);m[t]>h&&(u.model.updateReadTime(a,m[t]),u.service.emit("onConversationReadTimeUpdated",a,m[t]))}))},t.v2LocalConvMultiSyncReadTimeHandler=function v2LocalConvMultiSyncReadTimeHandler(t){var a=t.content,u=getConvInfoFromSessionId((0===a.scene?"p2p":1===a.scene?"team":"super_team")+"-"+a.to,"-"),m=u.type,h=u.target,g=this.core.V2NIMConversationIdUtil.conversationId(m,h),M=this.model.getById(g),I=null==M?void 0:M.unreadCount,S=this.model.getReadTime(g);a.timetag<=S?this.logger.warn("v2LocalConvMultiSyncReadTimeHandler: "+g+" do not need update ack "+a.timetag+"/"+S):(this.model.updateReadTime(g,a.timetag),this.service.emit("onConversationReadTimeUpdated",g,a.timetag),M?(M=this.service.compute.computeConvWithUnread(M),this.model.upsert(M),this.service.unread.digestUnreadCountChange(),void 0===I&&M.unreadCount>0?this.service.triggerConversationCreated(M):"number"==typeof I&&M.unreadCount!==I&&this.service.triggerConversationChanged([M])):this.logger.log("v2LocalConvMultiSyncReadTimeHandler: "+g+" not exist"))},t.v2LocalConvSuperTeamMultiSyncReadTimeHandler=function v2LocalConvSuperTeamMultiSyncReadTimeHandler(t){this.v2LocalConvMultiSyncReadTimeHandler(t)},t.v2LocalConvStickTopMultiSyncAddHandler=function v2LocalConvStickTopMultiSyncAddHandler(t){var a=t.content.data,u=getConvInfoFromSessionId(a.id),m=u.target,h=u.type,g=this.core.V2NIMConversationIdUtil.conversationId(h,m);this.model.updateStickTop(g,!0);var M=this.model.getById(g);M&&(M.stickTop=!0,M.updateTime=M.updateTime>a.updateTime?M.updateTime:a.updateTime,M.sortOrder=this.service.compute.computeSortOrder(!0,a.updateTime),this.model.upsert(M),this.service.triggerConversationChanged([M]))},t.v2LocalConvStickTopMultiSyncDeleteHandler=function v2LocalConvStickTopMultiSyncDeleteHandler(t){var a=t.content,u=a.data,m=a.timetag,h=getConvInfoFromSessionId(u.id),g=h.target,M=h.type,I=this.core.V2NIMConversationIdUtil.conversationId(M,g);this.model.updateStickTop(I,!1);var S=this.model.getById(I);S&&(S.stickTop=!1,S.updateTime=S.updateTime>m?S.updateTime:m,S.sortOrder=this.service.compute.computeSortOrder(!1,m),this.model.upsert(S),this.service.triggerConversationChanged([S]))},V2NIMLocalConversationHandlerImpl}();collection("Set",(function(t){return function Set(){return t(this,arguments.length?arguments[0]:void 0)}}),lc);var Pg=j.Set;_export({target:"Set",stat:!0,forced:!0},{from:pc}),_export({target:"Set",stat:!0,forced:!0},{of:mc});_export({target:"Set",proto:!0,real:!0,forced:!0},{addAll:function addAll(){for(var t=anObject(this),a=aCallable(t.add),u=0,m=arguments.length;u<m;u++)N(a,t,arguments[u]);return t}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:hc});var Lg=getIterator;_export({target:"Set",proto:!0,real:!0,forced:!0},{every:function every(t){var a=anObject(this),u=Lg(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return!iterate(u,(function(t,u){if(!m(t,t,a))return u()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{difference:function difference(t){var a=anObject(this),u=new(speciesConstructor(a,getBuiltIn("Set")))(a),m=aCallable(u.delete);return iterate(t,(function(t){N(m,u,t)})),u}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{filter:function filter(t){var a=anObject(this),u=Lg(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0),h=new(speciesConstructor(a,getBuiltIn("Set"))),g=aCallable(h.add);return iterate(u,(function(t){m(t,t,a)&&N(g,h,t)}),{IS_ITERATOR:!0}),h}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{find:function find(t){var a=anObject(this),u=Lg(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u){if(m(t,t,a))return u(t)}),{IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function intersection(t){var a=anObject(this),u=new(speciesConstructor(a,getBuiltIn("Set"))),m=aCallable(a.has),h=aCallable(u.add);return iterate(t,(function(t){N(m,a,t)&&N(h,u,t)})),u}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function isDisjointFrom(t){var a=anObject(this),u=aCallable(a.has);return!iterate(t,(function(t,m){if(!0===N(u,a,t))return m()}),{INTERRUPTED:!0}).stopped}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function isSubsetOf(t){var a=getIterator(this),u=anObject(t),m=u.has;return isCallable(m)||(u=new(getBuiltIn("Set"))(t),m=aCallable(u.has)),!iterate(a,(function(t,a){if(!1===N(m,u,t))return a()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function isSupersetOf(t){var a=anObject(this),u=aCallable(a.has);return!iterate(t,(function(t,m){if(!1===N(u,a,t))return m()}),{INTERRUPTED:!0}).stopped}});var Vg=R([].join),Ug=[].push;_export({target:"Set",proto:!0,real:!0,forced:!0},{join:function join(t){var a=anObject(this),u=Lg(a),m=void 0===t?",":toString(t),h=[];return iterate(u,Ug,{that:h,IS_ITERATOR:!0}),Vg(h,m)}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{map:function map(t){var a=anObject(this),u=Lg(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0),h=new(speciesConstructor(a,getBuiltIn("Set"))),g=aCallable(h.add);return iterate(u,(function(t){N(g,h,m(t,t,a))}),{IS_ITERATOR:!0}),h}});var Dg=TypeError;_export({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function reduce(t){var a=anObject(this),u=Lg(a),m=arguments.length<2,h=m?void 0:arguments[1];if(aCallable(t),iterate(u,(function(u){m?(m=!1,h=u):h=t(h,u,u,a)}),{IS_ITERATOR:!0}),m)throw Dg("Reduce of empty set with no initial value");return h}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{some:function some(t){var a=anObject(this),u=Lg(a),m=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u){if(m(t,t,a))return u()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function symmetricDifference(t){var a=anObject(this),u=new(speciesConstructor(a,getBuiltIn("Set")))(a),m=aCallable(u.delete),h=aCallable(u.add);return iterate(t,(function(t){N(m,u,t)||N(h,u,t)})),u}}),_export({target:"Set",proto:!0,real:!0,forced:!0},{union:function union(t){var a=anObject(this),u=new(speciesConstructor(a,getBuiltIn("Set")))(a);return iterate(t,aCallable(u.add),{that:u}),u}});var qg=Pg,Bg=function(){function V2NIMLocalConversationEventImpl(t,a){this.core=t,this.service=a,this.model=this.service.model,this.compute=this.service.compute,this.logger=this.core.logger}var t=V2NIMLocalConversationEventImpl.prototype;return t.setListener=function setListener(){var t,a,u,m,h,g,M,I,S,T,C=this;this.core.eventBus.on("V2NIMLoginService/syncing",(function(){return C.service.emit("onSyncStarted")})),this.core.eventBus.on("V2NIMLoginService/syncDone",bind$1(t=this.onSyncDone).call(t,this)),this.core.eventBus.on("V2NIMMessageService/sendMessage",bind$1(a=this.sendMsg).call(a,this)),this.core.eventBus.on("V2NIMMessageService/onMsg",bind$1(u=this.recvMsg).call(u,this)),this.core.eventBus.on("V2NIMMessageService/modifyMsg",bind$1(m=this.modifyMsg).call(m,this)),this.core.eventBus.on("V2NIMMessageService/deleteMessages",bind$1(h=this.deleteMessages).call(h,this)),this.core.eventBus.on("V2NIMMessageService/revokeMessages",bind$1(g=this.deleteMessages).call(g,this)),this.core.eventBus.on("V2NIMMessageLogUtil/onClearHistoryNotifications",bind$1(M=this.clearMessages).call(M,this)),this.core.eventBus.on("V2NIMMessageService/roamingMsgs",bind$1(I=this.generateConv).call(I,this)),this.core.eventBus.on("V2NIMMessageService/offlineMsgs",bind$1(S=this.generateConv).call(S,this)),this.core.eventBus.on("V2NIMSettingService/setMute",bind$1(T=this.setMute).call(T,this))},t.beforeEmit=function beforeEmit(t){for(var a,u=this.service.name+"::emit "+t.toString(),m=arguments.length,h=new Array(m>1?m-1:0),g=1;g<m;g++)h[g-1]=arguments[g];if("onConversationCreated"===t){var M=h[0],I=null===(a=M.lastMessage)||void 0===a?void 0:a.messageRefer;this.logger.log(""+u,"id:"+M.conversationId+";unread:"+M.unreadCount+";lastMsg:"+((null==I?void 0:I.messageClientId)||"")+"/"+((null==I?void 0:I.messageServerId)||""))}else if("onConversationChanged"===t){var S=h[0];this.logger.log(""+u,map$6(S).call(S,(function(t){var a,u=null===(a=t.lastMessage)||void 0===a?void 0:a.messageRefer;return"id:"+t.conversationId+";unread:"+t.unreadCount+";lastMsg:"+((null==u?void 0:u.messageClientId)||"")+"/"+((null==u?void 0:u.messageServerId)||"")})))}else{var T,C;(T=this.logger).log.apply(T,concat(C=[""+u]).call(C,h))}},t.onSyncDone=function onSyncDone(t){var a=this;if(t)this.service.emit("onSyncFailed",t);else{var u=this.model.getAll();u=map$6(u).call(u,(function(t){var u=t.conversationId,m=a.compute.computeConvByMsgsCache(u);return m=a.compute.computeConvWithUnread(m),m=a.compute.computeFromExternal(m),a.model.upsert(m),a.model.getById(u)})),u.length>0&&(this.service.triggerConversationChanged(u),this.service.unread.resetTotalAfterSyncDone()),this.service.emit("onSyncFinished")}},t.generateConv=function generateConv(t){var a=this,u=uniq(map$6(t).call(t,(function(t){return t.conversationId})));forEach$1(u).call(u,(function(t){var u=a.compute.computeConvByMsgsCache(t);a.model.upsert(u)}))},t.setMute=function setMute(t,a){var u=this.model.getById(t);u&&u.mute!==a&&(u.mute=a,this.model.upsert(u),this.service.triggerConversationChanged([u]))},t.deleteMessages=function deleteMessages(t){var a=this,u=new qg;forEach$1(t).call(t,(function(t){var m,h=t.messageRefer.conversationId,g=a.model.getById(h);if(g){if(t.messageRefer.messageClientId===(null===(m=g.lastMessage)||void 0===m?void 0:m.messageRefer.messageClientId)){u.add(h);var M=a.core.V2NIMMessageService.model.getLastMessageOfConversation(h);g.lastMessage=M?formatLastMessageFromMessage(a.core,M,0,M.sendingState):void 0}var I=a.model.getReadTime(h);if(g.unreadCount>0&&a.service.unread.isMessageReferUnread(t.messageRefer,I)&&(u.add(h),g.unreadCount--),"deleteTime"in t)t.deleteTime>g.updateTime&&(g.updateTime=t.deleteTime,g.sortOrder=a.compute.computeSortOrder(g.stickTop,g.updateTime));else{var S=a.core.timeOrigin.getNTPTime();g.updateTime=S,g.sortOrder=a.compute.computeSortOrder(g.stickTop,S)}a.model.upsert(g)}}));var m=nu(u);!this.core.V2NIMLoginService.dataSync.checkSyncing()&&m.length>0&&(this.service.triggerConversationChanged(map$6(m).call(m,(function(t){return a.model.getById(t)}))),this.service.unread.digestUnreadCountChange())},t.sendMsg=function sendMsg(t){var a=t.conversationId,u=this.model.getById(a);if(u){var m=u.lastMessage,h=this.updateCauseMessage(u,t);m!==h.lastMessage&&this.service.triggerConversationChanged([h])}else{var g=this.createCauseMessage(a,t);if(!g)return;this.service.triggerConversationCreated(g)}},t.recvMsg=function recvMsg(t){var a=t.conversationId,u=this.model.getById(a);if(u){var m=u.lastMessage,h=u.unreadCount,g=this.updateCauseMessage(u,t);g=this.compute.computeConvWithUnread(g,t);var M=m!==(g=this.compute.computeFromExternal(g)).lastMessage,I=h!==g.unreadCount;this.model.upsert(g),(M||I)&&this.service.triggerConversationChanged([g])}else{var S=this.createCauseMessage(a,t);if(!S)return;S=this.compute.computeConvWithUnread(S,t),S=this.compute.computeFromExternal(S),this.model.upsert(S),this.service.triggerConversationCreated(S)}this.service.unread.digestUnreadCountChange()},t.updateCauseMessage=function updateCauseMessage(t,a){return t=this.compute.computeConvWithLastMsg(t,a),this.model.upsert(t),this.model.getById(t.conversationId)},t.createCauseMessage=function createCauseMessage(t,a){var u,m,h;if(!1!==(null===(u=a.messageConfig)||void 0===u?void 0:u.unreadEnabled)||!1!==(null===(m=a.messageConfig)||void 0===m?void 0:m.lastMessageUpdateEnabled)){var g=this.core.V2NIMConversationIdUtil.parseConversationType(t),M=this.model.getStickTop(t),I=!1===(null===(h=a.messageConfig)||void 0===h?void 0:h.lastMessageUpdateEnabled)?void 0:formatLastMessageFromMessage(this.core,a,0,a.sendingState),S=this.core.timeOrigin.getNTPTime(),T={conversationId:t,type:g,createTime:I?a.createTime:S,updateTime:I?a.createTime:S,sortOrder:this.compute.computeSortOrder(M,I?a.createTime:S),stickTop:M,localExtension:"",lastMessage:I,unreadCount:0};return this.model.upsert(T),T}},t.clearMessages=function clearMessages(t){var a=this,u=new qg;forEach$1(t).call(t,(function(t){var m=t.conversationId,h=t.deleteTime,g=a.model.getById(m);g&&(g.unreadCount>0&&(g.unreadCount=0,u.add(m)),g.lastMessage&&g.lastMessage.messageRefer.createTime<=t.deleteTime&&(g.lastMessage=void 0,u.add(m)),h>g.updateTime&&(g.updateTime=h,g.sortOrder=a.compute.computeSortOrder(g.stickTop,g.updateTime)),a.model.upsert(g))}));var m=nu(u);!this.core.V2NIMLoginService.dataSync.checkSyncing()&&m.length>0&&(this.service.triggerConversationChanged(map$6(m).call(m,(function(t){return a.model.getById(t)}))),this.service.unread.digestUnreadCountChange())},t.modifyMsg=function modifyMsg(t){var a,u=t.conversationId,m=t.messageClientId,h=this.model.getById(u),g=this.core.V2NIMMessageService.model.getMessageById(m);if(h||g)if(h)t.messageClientId===(null===(a=h.lastMessage)||void 0===a?void 0:a.messageRefer.messageClientId)&&(h.lastMessage=formatLastMessageFromMessage(this.core,t,0,t.sendingState),this.service.triggerConversationChanged([h]));else{var M=this.createCauseMessage(u,t);if(!M)return;this.service.triggerConversationCreated(M)}},V2NIMLocalConversationEventImpl}(),Fg={type:"array",itemRules:{type:"enum",values:[1,2,3]},min:1},Gg=function(t){function V2NIMLocalConversationServiceImpl(a,u){var m;return void 0===u&&(u={}),(m=t.call(this,"V2NIMLocalConversationService",a)||this).config={},m.model=new Sg,m.unread=new Ng(m.core,Qe(m)),m.compute=new xg(m.core,Qe(m)),m.event=new Bg(m.core,Qe(m)),m.handler=new Og(m.core,Qe(m)),m.core._registerDep(gm,"V2NIMConversationIdUtil"),m.core._registerDep(Mg,"V2NIMMessageService"),"v2"!==m.core.options.apiVersion?Qe(m):(registerParser({cmdMap:Tg,cmdConfig:kg}),m.setOptions(u),m.setListener(),m)}wt(V2NIMLocalConversationServiceImpl,t);var a=V2NIMLocalConversationServiceImpl.prototype;return a.setOptions=function setOptions(t){this.config=Ut(this.config,t)},a.setListener=function setListener(){this.event.setListener()},a.reset=function reset(){this.model.reset(),this.unread.reset()},a.emit=function emit(a){for(var u,m,h,g,M=arguments.length,I=new Array(M>1?M-1:0),S=1;S<M;S++)I[S-1]=arguments[S];return(u=this.event).beforeEmit.apply(u,concat(m=[a]).call(m,I)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,I))},a.getConversationList=function getConversationList(t,a){var u,m=this;this.checkV2(),validate({offset:{type:"number",min:0}},{offset:t},"",!0),validate({limit:{type:"number",min:1}},{limit:a},"",!0),this.core.V2NIMLoginService.checkIllegalState();var h=this.model.getByOption(t,a,{});return h.conversationList=map$6(u=h.conversationList).call(u,(function(t){return m.compute.computeFromExternal(t)})),$i.resolve(h)},a.getConversationListByOption=function getConversationListByOption(t,a,u){var m,h=this;this.checkV2(),validate({offset:{type:"number",min:0}},{offset:t},"",!0),validate({limit:{type:"number",min:1}},{limit:a},"",!0),validate({conversationTypes:{type:"array",itemType:"number",required:!1},onlyUnread:{type:"boolean",required:!1}},u,"option",!0),this.core.V2NIMLoginService.checkIllegalState();var g=this.model.getByOption(t,a,u);return g.conversationList=map$6(m=g.conversationList).call(m,(function(t){return h.compute.computeFromExternal(t)})),$i.resolve(g)},a.getConversation=function getConversation(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(this.checkV2(),validateConversationId(this.core.account,t),!(a=this.model.getById(t))){u.next=7;break}return u.abrupt("return",this.compute.computeFromExternal(a));case 7:throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST});case 8:case"end":return u.stop()}}),_callee,this)})))},a.getConversationListByIds=function getConversationListByIds(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m=this;return lu.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validate({conversationIds:{type:"array",itemType:"string",min:1}},{conversationIds:t},"",!0),this.core.V2NIMLoginService.checkIllegalState(),u=filter(a=map$6(t).call(t,(function(t){return m.model.getById(t)}))).call(a,(function(t){return!!t})),u=map$6(u).call(u,(function(t){return m.compute.computeFromExternal(t)})),h.abrupt("return",u);case 6:case"end":return h.stop()}}),_callee2,this)})))},a.createConversation=function createConversation(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:if(this.checkV2(),validateConversationId(this.core.account,t),!(a=this.model.getById(t))){h.next=5;break}return h.abrupt("return",this.compute.computeFromExternal(a));case 5:return u=this.compute.computeConvByMsgsCache(t,{updateTime:this.core.timeOrigin.getNTPTime()}),u=this.compute.computeConvWithUnread(u),u=this.compute.computeFromExternal(u),this.model.upsert(u),m=this.model.getById(t),this.triggerConversationCreated(m),h.abrupt("return",m);case 12:case"end":return h.stop()}}),_callee3,this)})))},a.deleteConversation=function deleteConversation(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var u;return lu.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validateConversationId(this.core.account,t),validate({clearMessage:{type:"boolean",required:!1}},{clearMessage:a},"",!0),m.next=5,this.unread.markConversationRead(t);case 5:if(u=this.model.deleteById(t)){m.next=8;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST});case 8:a&&this.core.V2NIMMessageService.model.deleteMessages(t),!!(u&&u.unreadCount>0)&&this.unread.digestUnreadCountChange(),this.emit("onConversationDeleted",[t]);case 12:case"end":return m.stop()}}),_callee4,this)})))},a.deleteConversationListByIds=function deleteConversationListByIds(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var u,m=this;return lu.wrap((function _callee5$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validate({conversationIds:{type:"array",itemType:"string",min:1}},{conversationIds:t},"",!0),validate({clearMessage:{type:"boolean",required:!1}},{clearMessage:a},"",!0),h.next=5,this.unread.markMultiConversationRead(t);case 5:return u=!1,forEach$1(t).call(t,(function(t){a&&m.core.V2NIMMessageService.model.deleteMessages(t),m.model.deleteById(t)&&(u=!0)})),u&&this.unread.digestUnreadCountChange(),this.emit("onConversationDeleted",t),h.abrupt("return",[]);case 10:case"end":return h.stop()}}),_callee5,this)})))},a.getStickTopConversationList=function getStickTopConversationList(){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){return lu.wrap((function _callee6$(t){for(;;)switch(t.prev=t.next){case 0:return this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),t.abrupt("return",this.model.getStickTopList());case 3:case"end":return t.stop()}}),_callee6,this)})))},a.stickTopConversation=function stickTopConversation(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var u,m,h,g,M,I;return lu.wrap((function _callee7$(S){for(;;)switch(S.prev=S.next){case 0:if(this.checkV2(),validateConversationId(this.core.account,t),validate({stickTop:{type:"boolean"}},{stickTop:a},"",!0),(null==(u=this.model.getById(t))?void 0:u.stickTop)!==a){S.next=6;break}return S.abrupt("return");case 6:return m=this.core.V2NIMConversationIdUtil.parseConversationTargetId(t),h=this.core.V2NIMConversationIdUtil.parseConversationType(t),S.next=10,this.core.sendCmd(a?"v2LocalConvStickTopAdd":"v2LocalConvStickTopDelete",{tag:{id:getSessionIdFromConvInfo(h,m)}});case 10:g=S.sent,this.model.updateStickTop(t,a),M=g.content.timetag||g.content.data.updateTime,this.model.upsert({conversationId:t,type:h,stickTop:a,updateTime:M,sortOrder:this.compute.computeSortOrder(a,M)}),I=[this.model.getById(t)],this.triggerConversationChanged(I);case 16:case"end":return S.stop()}}),_callee7,this)})))},a.updateConversationLocalExtension=function updateConversationLocalExtension(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var u,m;return lu.wrap((function _callee8$(h){for(;;)switch(h.prev=h.next){case 0:if(this.checkV2(),validateConversationId(this.core.account,t),validate({localExtension:{type:"string"}},{localExtension:a},"",!0),u=this.model.getById(t)){h.next=6;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST});case 6:if(u.localExtension!==a){h.next=8;break}return h.abrupt("return");case 8:m=Ut(Ut({},u),{localExtension:a}),this.model.upsert(m),this.triggerConversationChanged([m]);case 11:case"end":return h.stop()}}),_callee8,this)})))},a.getTotalUnreadCount=function getTotalUnreadCount(){return this.checkV2(),this.unread.getTotalUnreadCount()||0},a.getUnreadCountByIds=function getUnreadCountByIds(t){this.checkV2(),validate({conversationIds:{type:"array",itemType:"string",min:1}},{conversationIds:t},"",!0);var a=this.unread.getUnreadCountByIds(t);return $i.resolve(a)},a.getUnreadCountByFilter=function getUnreadCountByFilter(t){this.checkV2(),this.valiteFilter(t);var a=this.unread.getUnreadCountByFilter(t);return $i.resolve(a)},a.clearTotalUnreadCount=function clearTotalUnreadCount(){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var t;return lu.wrap((function _callee9$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),this.checkLogin(),t=this.model.getAll(),a.next=5,this.unread.markMultiConversationRead(map$6(t).call(t,(function(t){return t.conversationId})));case 5:this.unread.clearUnreadCount(t);case 6:case"end":return a.stop()}}),_callee9,this)})))},a.clearUnreadCountByIds=function clearUnreadCountByIds(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){var a,u,m,h,g,M=this;return lu.wrap((function _callee10$(I){for(;;)switch(I.prev=I.next){case 0:if(this.checkV2(),this.checkLogin(),validate({conversationIds:{type:"array",itemType:"string",min:1}},{conversationIds:t},"",!0),a=[],u=[],m=new RegExp("^"+this.core.account+"\\|[1-3]\\|"),forEach$1(t).call(t,(function(t){m.test(t)?a.push(t):u.push(t)})),!(a.length>0)){I.next=12;break}return g=filter(h=map$6(a).call(a,(function(t){return M.model.getById(t)}))).call(h,(function(t){return!!t})),I.next=11,this.unread.markMultiConversationRead(a);case 11:this.unread.clearUnreadCount(g);case 12:return I.abrupt("return",map$6(u).call(u,(function(t){return{conversationId:t,error:new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST})}})));case 13:case"end":return I.stop()}}),_callee10,this)})))},a.clearUnreadCountByTypes=function clearUnreadCountByTypes(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){var a,u;return lu.wrap((function _callee11$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),this.checkLogin(),validate({types:Fg},{types:t},"",!0),u=this.model.getByOption(0,1e3,{conversationTypes:t}),m.next=6,this.unread.markMultiConversationRead(map$6(a=u.conversationList).call(a,(function(t){return t.conversationId})));case 6:this.unread.clearUnreadCount(u.conversationList);case 7:case"end":return m.stop()}}),_callee11,this)})))},a.subscribeUnreadCountByFilter=function subscribeUnreadCountByFilter(t){var a;this.checkV2(),this.checkLogin(),this.valiteFilter(t),0===(null===(a=t.conversationTypes)||void 0===a?void 0:a.length)&&delete t.conversationTypes,this.unread.addFilter(t)},a.unsubscribeUnreadCountByFilter=function unsubscribeUnreadCountByFilter(t){var a;this.checkV2(),this.checkLogin(),this.valiteFilter(t),0===(null===(a=t.conversationTypes)||void 0===a?void 0:a.length)&&delete t.conversationTypes,this.unread.deleteFilter(t)},a.getConversationReadTime=function getConversationReadTime(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){return lu.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),validateConversationId(this.core.account,t),a.abrupt("return",this.model.getReadTime(t));case 3:case"end":return a.stop()}}),_callee12,this)})))},a.markConversationRead=function markConversationRead(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){return lu.wrap((function _callee13$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),this.checkLogin(),validateConversationId(this.core.account,t),a.abrupt("return",this.unread.markConversationRead(t));case 4:case"end":return a.stop()}}),_callee13,this)})))},a.setCurrentConversation=function setCurrentConversation(t){this.checkV2(),t&&validateConversationId(this.core.account,t),this.unread.setCurrentConversation(t)},a.valiteFilter=function valiteFilter(t){if(validate({filter:{type:"object",required:!0,rules:{conversationTypes:{type:"array",itemType:"number",required:!1},ignoreMuted:{type:"boolean",required:!1}}}},{filter:t},"",!0),void 0===t.conversationTypes&&!0!==t.ignoreMuted)throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Filter cannot be empty"}})},a.triggerConversationChanged=function triggerConversationChanged(t){var a=this;t=map$6(t).call(t,(function(t){return a.compute.computeFromExternal(t)})),t=JSON.parse(Vn(t)),forEach$1(t).call(t,(function(t){t.lastMessage||(t.lastMessage=void 0),delete t.lastMessageState})),this.emit("onConversationChanged",t)},a.triggerConversationCreated=function triggerConversationCreated(t){t=this.compute.computeFromExternal(t),delete(t=JSON.parse(Vn(t))).lastMessageState,this.emit("onConversationCreated",t)},V2NIMLocalConversationServiceImpl}(gp),Hg=function(){function V2NIMConversationModelImpl(){this.map=new _c,this.readTimeMap=new _c}var t=V2NIMConversationModelImpl.prototype;return t.set=function set(t){var a=this;forEach$1(t).call(t,(function(t){t=a.processConversation(t),map$6(a).set(t.conversationId,t)}))},t.reset=function reset(){map$6(this).clear(),this.readTimeMap.clear()},t.count=function count(){return map$6(this).size},t.sort=function sort$1(){var t,a=this,u=nu(values(t=map$6(this)).call(t));sort(u).call(u,(function(t,a){return a.sortOrder-t.sortOrder})),map$6(this).clear(),forEach$1(u).call(u,(function(t){map$6(a).set(t.conversationId,t)}))},t.processConversation=function processConversation(t){return"string"==typeof t.lastMessage&&delete t.lastMessage,void 0===t.localExtension&&(t.localExtension=""),t},t.getById=function getById(t){return map$6(this).get(t)},t.getStickTopList=function getStickTopList(){var t,a,u=nu(values(t=map$6(this)).call(t));return sort(a=filter(u).call(u,(function(t){return t.stickTop}))).call(a,(function(t,a){return a.sortOrder-t.sortOrder}))},t.getAll=function getAll(){var t,a=nu(values(t=map$6(this)).call(t));return sort(a).call(a,(function(t,a){return a.sortOrder-t.sortOrder}))},t.getByOption=function getByOption(t,a,u){var m,h=u.conversationTypes,g=u.onlyUnread,M=u.conversationGroupIds,I=[];forEach$1(m=map$6(this)).call(m,(function(t){if((!(h&&h.length>0)||includes(h).call(h,t.type))&&(!g||t.unreadCount)&&(!u.ignoreMuted||!t.mute)){if(M){var a=t.groupIds,m=(null==a?void 0:a.length)||0;if(0===M.length&&m>0)return;if(M.length>0&&0===m)return;if(M.length>0&&m>0&&!some(M).call(M,(function(t){return a&&includes(a).call(a,t)})))return}I.push(t)}})),I=sort(I).call(I,(function(t,a){return a.sortOrder-t.sortOrder}));var S=0;t>0&&(S=findIndexWithinTargetValue(I,"sortOrder",t),I[S]&&I[S].sortOrder===t&&(S+=1));var T=slice(I).call(I,S).length;return(I=slice(I).call(I,S,S+a)).length>0?{offset:T>a?I[I.length-1].sortOrder:0,finished:!(T>a),conversationList:I}:{offset:0,finished:!0,conversationList:I}},t.upsert=function upsert(t){var a=t.conversationId,u=map$6(this).get(a);if(!u)return t=this.processConversation(Ut({},t)),map$6(this).set(a,t),t.unreadCount>0;var m=t.unreadCount!==u.unreadCount,h=Ut({},u,t);return h=this.processConversation(h),map$6(this).set(a,h),m},t.bulkUpsert=function bulkUpsert(t){var a=this,u=!1;return forEach$1(t).call(t,(function(t){a.upsert(t)&&(u=!0)})),u},t.deleteById=function deleteById(t){var a=this.getById(t);if(a)return map$6(this).delete(t),a},t.updateReadTime=function updateReadTime(t,a){this.readTimeMap.set(t,a)},t.getReadTime=function getReadTime(t){return this.readTimeMap.get(t)||0},V2NIMConversationModelImpl}();function isEqual(t,a){var u=typeof t;if(u!==typeof a)return!1;if("object"===u){if(Object.prototype.toString.call(t)!==Object.prototype.toString.call(a))return!1;if(Un(t)){if(t.length!==a.length)return!1;for(var m=0;m<t.length;m++)if(!isEqual(t[m],a[m]))return!1;return!0}if(t instanceof RegExp&&a instanceof RegExp)return t.toString()===a.toString();if(t instanceof Date&&a instanceof Date)return t.getTime()===a.getTime();if(null===t&&null===a)return!0;if(Gt(t).length!==Gt(a).length)return!1;for(var h in t)if(!isEqual(t[h],a[h]))return!1;return!0}return t===a}var jg=function(){function V2NIMConversationVersionCacheImpl(t,a){this.fieldVersion={},this.conversationIdsForBackFill={},this.tempPacket=[],this.isSyncing=!1,this.nextCursor=0,this.core=t,this.service=a}var t=V2NIMConversationVersionCacheImpl.prototype;return t.reset=function reset(){this.tempPacket=[],this.fieldVersion={},this.conversationIdsForBackFill={},this.isSyncing=!1,this.nextCursor=0},t.doSync=function doSync(){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var t,a,u,m;return lu.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return this.isSyncing=!0,this.service.emit("onSyncStarted"),this.core.V2NIMLoginService.dataSync.switchDataSync({type:1,state:2,subType:"conversationSync"}),h.prev=3,h.next=6,this.core.sendCmd("v2ConversationSync",{tag:{cursor:this.nextCursor}});case 6:t=h.sent,h.next=19;break;case 9:if(h.prev=9,h.t0=h.catch(3),(a=h.t0).code!==jl.V2NIM_ERROR_CODE_CANCELLED){h.next=14;break}return h.abrupt("return");case 14:return this.isSyncing=!1,this.service.emit("onSyncFailed",a),this.core.V2NIMLoginService.dataSync.switchDataSync({type:1,state:3,error:a,subType:"conversationSync"}),this.processTempPacket(),h.abrupt("return");case 19:u=0===Bu(get(t,"content.info.syncType")),m=get(t,"content.info.nextCursor"),this.doSyncAndSuccess(u,m);case 22:case"end":return h.stop()}}),_callee,this,[[3,9]])})))},t.doSyncAndSuccess=function doSyncAndSuccess(t,a){var u;t&&sort(u=this.service.model).call(u);this.isSyncing=!1,this.nextCursor=Bu(a)||0,this.service.unread.resetTotalAfterSyncDone(),this.service.unread.digestUnreadCountChange(),this.service.emit("onSyncFinished"),this.core.V2NIMLoginService.dataSync.switchDataSync({type:1,state:3,subType:"conversationSync"}),this.processTempPacket()},t.setBackFillIds=function setBackFillIds(t){var a=this;return forEach$1(t).call(t,(function(t){if(2===t.lastMessageState&&a.service.compute.hasMessageService){a.conversationIdsForBackFill[t.conversationId]=!0;var u=a.core.V2NIMMessageService.model.getLastMessageOfConversation(t.conversationId);t.lastMessage=u?formatLastMessageFromMessage(a.core,u,t.lastMessageState,u.sendingState):""}else a.conversationIdsForBackFill[t.conversationId]=!1;delete t.lastMessageState})),t},t.recvConversationFromSyncAction=function recvConversationFromSyncAction(t){var a=this,u=get(t,"content.info").syncType,m=formatConversationFields(this.core,get(t,"content.datas"));0===(u=Bu(u))?(forEach$1(m).call(m,(function(t){a.initFieldVersion(t.conversationId,t.version)})),m=this.setBackFillIds(m),this.setModel(m)):(m=this.setBackFillIds(m),this.recvConversationForCreated(m)<m.length&&this.recvConversationForChanged(m))},t.recvConversation=function recvConversation(t){var a=this;if(this.isSyncing)this.tempPacket.push(t);else{var u=formatConversationFields(this.core,get(t,"content.datas")),m=filter(u).call(u,(function(t){return!!t.conversationId})),h=get(t,"content.info"),g=map$6(m).call(m,(function(t){return"id:"+t.conversationId+", ver:"+t.version})).join(";");if(this.core.logger.getDebugMode()?this.core.logger.debug("V2NIMConversation::recvConversation: "+g+".",h,m):this.core.logger.log("V2NIMConversation::recvConversation: "+g+".",h),2===h.type){var M=map$6(m).call(m,(function(t){return delete a.fieldVersion[t.conversationId],a.service.model.deleteById(t.conversationId),t.conversationId}));return this.service.emit("onConversationDeleted",M),void this.service.unread.digestUnreadCountChange()}if(12!==h.type)h.type,m=this.setBackFillIds(m),this.recvConversationForCreated(m)<m.length&&this.recvConversationForChanged(m);else this.compareAndClearUnreadInModel(h)}},t.recvConversationForCreated=function recvConversationForCreated(t){var a=this,u=filter(t).call(t,(function(t){return!a.fieldVersion[t.conversationId]})),m=reduce(u).call(u,(function(t,u){if(!a.fieldVersion[u.conversationId]){a.initFieldVersion(u.conversationId,u.version),t=!!a.updateModel(u)||t;var m=a.service.model.getById(u.conversationId);return m&&a.service.triggerConversationCreated(m),t}return t}),!1);return m&&this.service.unread.digestUnreadCountChange(),u.length},t.recvConversationForChanged=function recvConversationForChanged(t){var a,u=this,m=this.bulkCompare(t);if(0!==m.length){this.bulkUpdateModel(m);var h=filter(a=map$6(m).call(m,(function(t){return u.service.model.getById(t.conversationId)}))).call(a,(function(t){return!!t}));this.service.triggerConversationChanged(h)}},t.processTempPacket=function processTempPacket(){var t,a=this;forEach$1(t=this.tempPacket).call(t,(function(t){a.recvConversation(t)})),this.tempPacket=[]},t.bulkCompare=function bulkCompare(t){var a,u=this;return filter(a=map$6(t).call(t,(function(t){return u.compare(t)}))).call(a,(function(t){return!!t}))},t.compare=function compare(t){var a=this,u=t.version,m=t.conversationId,h=t.deleteFlag,g=t.type,M=["stickTop","groupIds","serverExtension","localExtension","lastMessage","lastMessageState","unreadCount","sortOrder","createTime","updateTime","lastReadTime"],I={},S=0;return forEach$1(M).call(M,(function(h){var g=h;if(void 0!==t[g]){var M=a.fieldVersion[m];M&&"number"==typeof M[g]&&M[g]>=u||(a.fieldVersion[m]=a.fieldVersion[m]||{},a.fieldVersion[m][g]=u,I[g]=t[g],S+=1)}})),S?Ut(Ut({},I),{conversationId:m,deleteFlag:h,version:u,type:g}):void 0},t.bulkUpdateModel=function bulkUpdateModel(t){var a=this,u=!1;forEach$1(t).call(t,(function(t){a.updateModel(t)&&(u=!0)})),u&&this.service.unread.digestUnreadCountChange()},t.initFieldVersion=function initFieldVersion(t,a){this.fieldVersion[t]={stickTop:a,groupIds:a,serverExtension:a,lastMessage:a,lastMessageState:a,unreadCount:a,sortOrder:a,createTime:a,updateTime:a,lastReadTime:a}},t.initConversation=function initConversation(t,a){var u=eo();return Ut({conversationId:t,type:this.core.V2NIMConversationIdUtil.parseConversationType(t),stickTop:!1,localExtension:"",serverExtension:"",unreadCount:0,lastReadTime:0,createTime:u,updateTime:u,sortOrder:u},a)},t.updateModel=function updateModel(t){var a=formatConversationByField(t),u=a.deleteFlag,m=a.conversation;if(u){var h=this.service.model.deleteById(m.conversationId);return!!(h&&h.unreadCount>0)}return this.service.model.upsert(m)},t.setModel=function setModel(t){var a,u=map$6(a=filter(t).call(t,(function(t){return!t.deleteFlag}))).call(a,(function(t){return formatConversationByField(t).conversation}));this.service.model.set(u)},t.updateModelWithLastMessage=function updateModelWithLastMessage(t,a,u,m){var h=this.service.model.getById(t),g=a?formatLastMessageFromMessage(this.core,a,u,m):void 0;if(!isEqual(null==h?void 0:h.lastMessage,g))if(h){var M=Ut(Ut({},h),{sortOrder:g?h.stickTop?g.messageRefer.createTime+1e15:g.messageRefer.createTime:h.sortOrder,lastMessage:g});this.service.model.upsert(M),this.service.triggerConversationChanged([M])}else{this.initFieldVersion(t,-1);var I=this.initConversation(t,{lastMessage:g});this.service.model.upsert(I),this.service.triggerConversationCreated(I)}},t.updateModelByRevoke=function updateModelByRevoke(t){var a=this,u=[];forEach$1(t).call(t,(function(t){var m=t.postscript,h=t.messageRefer,g=__rest(t,["postscript","messageRefer"]),M=h.conversationId,I=a.service.model.getById(M);I&&I.lastMessage&&I.lastMessage.messageRefer.messageClientId===h.messageClientId&&1!==I.lastMessage.lastMessageState&&(I.lastMessage.lastMessageState=1,m&&(I.lastMessage.text=m),Ut(I.lastMessage,g),a.service.model.upsert(I),u.push(I))})),u.length>0&&this.service.triggerConversationChanged(u)},t.compareAndUpdateModel=function compareAndUpdateModel(t){var a=this;this.core.logger.log("V2NIMConversation::compareAndUpdateModel",map$6(t).call(t,(function(t){return t.conversationId})));var u=!1,m=[];forEach$1(t).call(t,(function(t){var h=a.compare(t);if(h){var g=a.service.model.getById(t.conversationId);a.updateModel(h)&&(u=!0);var M=a.service.model.getById(t.conversationId);M&&(g?m.push(M):a.service.triggerConversationCreated(M))}})),m.length>0&&this.service.triggerConversationChanged(m),u&&this.service.unread.digestUnreadCountChange()},t.compareAndDeleteModel=function compareAndDeleteModel(t){var a=this;this.core.logger.log("V2NIMConversation::compareAndDeleteModel",t);var u=reduce(t).call(t,(function(t,u){delete a.fieldVersion[u];var m=a.service.model.deleteById(u);return!!!!(m&&m.unreadCount>0)||t}),!1);this.service.emit("onConversationDeleted",t),u&&this.service.unread.digestUnreadCountChange()},t.compareAndDeleteGroupInModel=function compareAndDeleteGroupInModel(t,a){var u,m=this;this.core.logger.log("V2NIMConversation::compareAndDeleteGroupInModel",t,a);var h=[];forEach$1(u=Gt(this.fieldVersion)).call(u,(function(u){var g=m.fieldVersion[u];if(void 0===g.groupIds||t>g.groupIds){g.groupIds=t;var M=m.service.model.getById(u);if(M&&M.groupIds&&M.groupIds.length>0){var I,S=filter(I=M.groupIds).call(I,(function(t){return t!==a}));if(S.length!==M.groupIds.length){var T=Ut(Ut({},M),{groupIds:S});m.service.model.upsert(T),T&&h.push(T)}}}})),h.length>0&&this.service.triggerConversationChanged(h)},t.compareAndClearUnreadInModel=function compareAndClearUnreadInModel(t){var a=this,u=t.oneClickClearUnreadType,m=t.oneClickClearUnreadVersion,h=t.oneClickClearUnreadLastReadTime,g=t.oneClickClearUnreadConversationType,M=t.oneClickClearUnreadGroupId;this.core.logger.log("V2NIMConversation::compareAndClearUnreadInModel.ver:"+m+";type:"+u+";lastReadTime:"+h+";filter:"+(g||"")+";grounp:"+(M||""));var I=[],S=[];if(1===u)S=this.service.model.getAll();else if(g||M){var T=this.service.model.count();S=this.service.model.getByOption(0,T,{conversationTypes:g,conversationGroupIds:M?[M]:void 0}).conversationList}forEach$1(S).call(S,(function(t){var u=t.conversationId,g=a.fieldVersion[u];if(void 0===g.unreadCount||m>g.unreadCount){g.unreadCount=m,g.lastReadTime=m;var M=t.unreadCount,S=Ut(Ut({},t),{lastReadTime:h,unreadCount:0});a.service.model.upsert(S),M>0&&I.push(S)}})),I.length>0&&this.service.triggerConversationChanged(I),this.service.unread.digestUnreadCountChange()},t.backfillLastMsg=function backfillLastMsg(t,a){var u=this,m=t=uniq(t);(a||(m=filter(t).call(t,(function(t){return u.conversationIdsForBackFill[t]})),0!==m.length))&&forEach$1(m).call(m,(function(t){var a=get(u.service.model.getById(t),"lastMessage.messageRefer.messageClientId"),m=u.service.compute.hasMessageService?u.core.V2NIMMessageService.model.getLastMessageOfConversation(t):void 0;(m&&m.messageClientId)!==a&&(u.conversationIdsForBackFill[t]=!1,m?u.updateModelWithLastMessage(t,m,2,m.sendingState):u.updateModelWithLastMessage(t,void 0,2,0))}))},V2NIMConversationVersionCacheImpl}(),$g={"28_1":"v2ConversationCreate","28_2":"v2ConversationDelete","28_3":"v2ConversationUpdate","28_4":"v2ConversationSetTop","28_5":"v2ConversationUnreadClear","28_6":"v2ConversationGet","28_7":"v2ConversationGetByIds","28_8":"v2ConversationGetList","28_17":"v2ConversationsDelete","28_18":"v2ConversationsUnreadClear","28_19":"v2ConversationSync","28_20":"v2ConversationNotifySync","28_21":"v2ConversationNotifySyncOnline","28_23":"v2ConversationClearTotalUnread","28_24":"v2ConversationClearTypeUnread","28_25":"v2ConversationClearGroupUnread","4_14":"syncConversationReadTime","4_20":"syncSuperTeamReadTime","4_22":"v2SyncSessionsWithMoreRoaming","4_25":"v2SyncSessionReliableInfo","30_16":"v2MarkConversationReadTime","32_25":"v2MarkSuperTeamReadTime","7_116":"v2MultiDeviceConversationReadTime","21_125":"v2MultiDeviceSuperTeamReadTime"},zg="V2NIMConversationService",Wg={conversationId:1,type:{id:2,retType:"number"},serverExtension:3,groupIds:{id:4,retConverter:function retConverter(t){return t?JSON.parse(t):void 0}},lastMessage:5,lastMessageState:{id:6,retType:"number"},unreadCount:{id:7,retType:"number"},stickTop:{id:8,retType:"boolean"},sortOrder:{id:9,retType:"number"},version:{id:10,retType:"number"},deleteFlag:{id:11,retType:"boolean"},createTime:{id:12,retType:"number"},updateTime:{id:13,retType:"number"},lastReadTime:{id:14,retType:"number"}},Kg={type:{id:1,retType:"number"},oneClickClearUnreadType:{id:2,retType:"number"},oneClickClearUnreadConversationType:{id:3,retConverter:stringToJSONObject},oneClickClearUnreadGroupId:{id:4,retType:"string"},oneClickClearUnreadVersion:{id:5,retType:"number"},oneClickClearUnreadLastReadTime:{id:6,retType:"number"}},Yg={v2ConversationCreate:{sid:28,cid:1,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationId:1}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Wg)}]},v2ConversationDelete:{sid:28,cid:2,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationId:1,clearMessage:2}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Wg)}]},v2ConversationUpdate:{sid:28,cid:3,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationId:1,serverExtension:2}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Wg)}]},v2ConversationSetTop:{sid:28,cid:4,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationId:1,stickTop:2}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Wg)}]},v2ConversationUnreadClear:{sid:28,cid:5,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationId:1}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Wg)}]},v2ConversationGet:{sid:28,cid:6,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationId:1}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Wg)}]},v2ConversationGetByIds:{sid:28,cid:7,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationIds:1}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Wg)},{type:"Property",name:"info",reflectMapper:{1:"failedMap"}}]},v2ConversationGetList:{sid:28,cid:8,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{cursor:1,limit:2}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Wg)},{type:"Property",name:"info",reflectMapper:{1:"hasMore",2:"offset"}}]},v2ConversationsDelete:{sid:28,cid:17,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationIds:1,clearMessage:2}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Wg)},{type:"Property",name:"info",reflectMapper:{1:"failedMap"}}]},v2ConversationsUnreadClear:{sid:28,cid:18,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationIds:1}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Wg)},{type:"Property",name:"info",reflectMapper:{1:"failedMap"}}]},v2ConversationSync:{sid:28,cid:19,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{cursor:1}}],response:[{type:"Property",name:"info",reflectMapper:{1:"nextCursor",2:"syncType"}}]},v2ConversationNotifySync:{sid:28,cid:20,service:zg,response:[{type:"Property",name:"info",reflectMapper:{1:"nextCursor",2:"syncType"}},{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Wg)}]},v2ConversationNotifySyncOnline:{sid:28,cid:21,service:zg,response:[{type:"Property",name:"info",reflectMapper:invertSerializeItem(Kg)},{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Wg)}]},v2ConversationClearTotalUnread:{sid:28,cid:23,service:zg,response:[{type:"Property",name:"info",reflectMapper:invertSerializeItem(Kg)}]},v2ConversationClearTypeUnread:{sid:28,cid:24,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{conversationType:1}}],response:[{type:"Property",name:"info",reflectMapper:invertSerializeItem(Kg)}]},v2ConversationClearGroupUnread:{sid:28,cid:25,service:zg,params:[{type:"Property",name:"tag",reflectMapper:{groupId:1}}],response:[{type:"Property",name:"info",reflectMapper:invertSerializeItem(Kg)}]},syncConversationReadTime:{sid:4,cid:14,service:zg,response:[{type:"StrLongMap",name:"p2p"},{type:"LongLongMap",name:"team"},{type:"Long",name:"timetag"}]},syncSuperTeamReadTime:{sid:4,cid:20,service:zg,response:[{type:"LongLongMap",name:"superTeam"}]},v2SyncSessionsWithMoreRoaming:{sid:4,cid:22,service:zg,response:[]},v2SyncSessionReliableInfo:{sid:4,cid:25,service:zg,response:[]},v2MarkConversationReadTime:{sid:30,cid:16,service:zg,params:[{type:"Byte",name:"scene"},{type:"String",name:"to"},{type:"Long",name:"timetag"}]},v2MarkSuperTeamReadTime:{sid:32,cid:25,service:zg,params:[{type:"Long",name:"to"},{type:"Long",name:"timetag"}]},v2MultiDeviceConversationReadTime:{sid:30,cid:116,service:zg,response:[{type:"Byte",name:"scene"},{type:"String",name:"to"},{type:"Long",name:"timetag"}]},v2MultiDeviceSuperTeamReadTime:{sid:21,cid:125,service:zg,response:[{type:"Long",name:"to"},{type:"Long",name:"timetag"}]}},Qg=function(){function V2NIMConversationUnreadImpl(t,a){this.totalUnreadCount=void 0,this.unreadCountByFilter={},this.core=t,this.service=a}var t=V2NIMConversationUnreadImpl.prototype;return t.reset=function reset(){this.totalUnreadCount=void 0,this.unreadCountByFilter={}},t.getTotalUnreadCount=function getTotalUnreadCount(){return this.totalUnreadCount},t.resetTotalAfterSyncDone=function resetTotalAfterSyncDone(){var t,a=reduce(t=this.service.model.getAll()).call(t,(function(t,a){return t+(a.unreadCount||0)}),0),u=this.totalUnreadCount;return void 0!==u&&u===a||(this.totalUnreadCount=a,this.service.emit("onTotalUnreadCountChanged",a)),a},t.digestUnreadCountChange=function digestUnreadCountChange(){this._digest()},t._digest=function _digest(){var t,a=this,u=this.totalUnreadCount,m=reduce(t=this.service.model.getAll()).call(t,(function(t,a){return t+(a.unreadCount||0)}),0);this.core.logger.log("V2NIMConversation::digestUnreadCountChange:oldUnreadCount "+u+", newUnreadCount "+m),u!==m&&(this.totalUnreadCount=m,this.service.emit("onTotalUnreadCountChanged",m));var h=Gt(this.unreadCountByFilter);forEach$1(h).call(h,(function(t){var u=JSON.parse(t),m=a.getUnreadCountByFilter(u),h=a.unreadCountByFilter[t];a.unreadCountByFilter[t]=m,u.equals=bind$1(equals).call(equals,u),h!==m&&a.service.emit("onUnreadCountChangedByFilter",u,m)}))},t.getUnreadCountByIds=function getUnreadCountByIds(t){var a=this;return reduce(t).call(t,(function(t,u){var m=a.service.model.getById(u);return t+(m&&m.unreadCount||0)}),0)},t.getUnreadCountByFilter=function getUnreadCountByFilter(t){var a,u=this.service.model.count(),m=this.service.model.getByOption(0,u,{conversationTypes:t.conversationTypes,conversationGroupIds:t.conversationGroupId?[t.conversationGroupId]:void 0,ignoreMuted:t.ignoreMuted});return reduce(a=m.conversationList).call(a,(function(t,a){return t+(a.unreadCount||0)}),0)},t.addFilter=function addFilter(t){var a=generateFilterKey(t);if(void 0!==this.unreadCountByFilter[a])throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_ALREADY_EXIST});var u=JSON.parse(a),m=this.getUnreadCountByFilter(u);this.unreadCountByFilter[a]=m,this.service.emit("onUnreadCountChangedByFilter",u,m)},t.deleteFilter=function deleteFilter(t){var a=generateFilterKey(t);if(void 0===this.unreadCountByFilter[a])throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST});delete this.unreadCountByFilter[a]},V2NIMConversationUnreadImpl}();function generateFilterKey(t){var a=t.conversationTypes;return a&&(a=sort(a).call(a)),Vn({conversationGroupId:t.conversationGroupId,conversationTypes:a,ignoreMuted:t.ignoreMuted})}function equals(t){return Vn(this)===generateFilterKey(t)}var Jg={createTime:{type:"number"},updateTime:{type:"number"}};function formatConversationGroups(t){return t&&t.length>0?map$6(t).call(t,(function(t){return formatConversationGroup(t)})):[]}function formatConversationGroup(t){return format(Jg,t)}function formatFailedMap(t){var a,u=JSON.parse(t);return map$6(a=Gt(u)).call(a,(function(t){return{conversationId:t,error:new Wl({code:u[t]})}}))}var Xg,Zg={type:{type:"number"},deleteVersion:{type:"number"},conversationIds:{type:"object"}};function formatConversationGroupNotify(t){return format(Zg,t)}!function(t){t[t.createConversationGroup=1]="createConversationGroup",t[t.deleteConversationGroup=2]="deleteConversationGroup",t[t.updateConversationGroup=3]="updateConversationGroup",t[t.addConversationToGroup=4]="addConversationToGroup",t[t.removeConversationFromGroup=5]="removeConversationFromGroup"}(Xg||(Xg={}));var ev=function(){function V2NIMConversationComputeImpl(t,a){this.core=t,this.service=a}var t=V2NIMConversationComputeImpl.prototype;return t.computeConvs=function computeConvs(t){var a=this;return map$6(t).call(t,(function(t){return a.computeConv(t)}))},t.computeConv=function computeConv(t){var a,u,m,h,g;if(0===t.type)return t;var M=this.core.V2NIMConversationIdUtil.parseConversationType(t.conversationId),I=this.core.V2NIMConversationIdUtil.parseConversationTargetId(t.conversationId),S={};if(t.lastReadTime||(S.lastReadTime=this.service.model.getReadTime(t.conversationId)),(null===(a=this.core.V2NIMSettingService)||void 0===a?void 0:a.name)&&(S.mute=this.core.V2NIMSettingService.getConversationMuteStatus(t.conversationId)),1===M&&this.hasUserService){var T,C=this.core.V2NIMUserService.model.getUser(I),b=this.hasFriendService?this.core.V2NIMFriendService.model.getFriend(I):void 0;t.conversationId!==(null===(u=t.lastMessage)||void 0===u?void 0:u.messageRefer.conversationId)||0!==(null===(m=t.lastMessage)||void 0===m?void 0:m.lastMessageState)&&2!==(null===(h=t.lastMessage)||void 0===h?void 0:h.lastMessageState)||(T=null===(g=t.lastMessage)||void 0===g?void 0:g.senderName),S.name=(null==b?void 0:b.alias)||(null==C?void 0:C.name)||T||I,S.avatar=(null==C?void 0:C.avatar)||""}else if(2===M&&this.hasTeamService){var E=this.core.V2NIMTeamService.model.getById(I,1);S.name=(null==E?void 0:E.name)||I,S.avatar=(null==E?void 0:E.avatar)||""}else if(3===M&&this.hasTeamService){var k=this.core.V2NIMTeamService.model.getById(I,2);S.name=(null==k?void 0:k.name)||I,S.avatar=(null==k?void 0:k.avatar)||""}return Ut(t,S),t},t.computeReadTimeForMark=function computeReadTimeForMark(t){var a,u,m,h=t.conversationId,g=this.service.model.getReadTime(h);if(null===(u=null===(a=null==t?void 0:t.lastMessage)||void 0===a?void 0:a.messageRefer)||void 0===u?void 0:u.createTime)m=t.lastMessage.messageRefer.createTime;else{if(!this.core.timeOrigin.checkNodeReliable())return g||0;m=this.core.timeOrigin.getNTPTime()}return m},Ye(V2NIMConversationComputeImpl,[{key:"hasUserService",get:function get(){var t;return!!(null===(t=this.core.V2NIMUserService)||void 0===t?void 0:t.name)}},{key:"hasFriendService",get:function get(){var t;return!!(null===(t=this.core.V2NIMFriendService)||void 0===t?void 0:t.name)}},{key:"hasTeamService",get:function get(){var t;return!!(null===(t=this.core.V2NIMTeamService)||void 0===t?void 0:t.name)}},{key:"hasMessageService",get:function get(){var t;return!!(null===(t=this.core.V2NIMMessageService)||void 0===t?void 0:t.name)}}]),V2NIMConversationComputeImpl}(),tv=Yi.entries;_export({target:"Object",stat:!0},{entries:function entries(t){return tv(t)}});var rv,nv,av,iv,ov=j.Object.entries,sv=function(){function V2NIMConversationHandlerImpl(t,a){this.core=t,this.service=a,this.model=this.service.model,this.logger=this.core.logger}var t=V2NIMConversationHandlerImpl.prototype;return t.v2ConversationNotifySyncHandler=function v2ConversationNotifySyncHandler(t){this.ifEnabled&&this.service.versionCache.recvConversationFromSyncAction(t)},t.v2ConversationNotifySyncOnlineHandler=function v2ConversationNotifySyncOnlineHandler(t){this.ifEnabled&&this.service.versionCache.recvConversation(t)},t.syncConversationReadTimeHandler=function syncConversationReadTimeHandler(t){var a,u,m;if(this.ifEnabled){if(null===(a=null==t?void 0:t.content)||void 0===a?void 0:a.p2p)for(var h=0,g=ov(t.content.p2p);h<g.length;h++){var M=g[h],I=M[0],S=M[1];this.model.updateReadTime(this.core.V2NIMConversationIdUtil.p2pConversationId(I),S),this.service.emit("onConversationReadTimeUpdated",this.core.V2NIMConversationIdUtil.p2pConversationId(I),S)}if(null===(m=null===(u=null==t?void 0:t.content)||void 0===u?void 0:u.team)||void 0===m?void 0:m.m_map)for(var T=0,C=ov(t.content.team.m_map);T<C.length;T++){var b=C[T],E=b[0],k=b[1];this.model.updateReadTime(this.core.V2NIMConversationIdUtil.teamConversationId(E),k),this.service.emit("onConversationReadTimeUpdated",this.core.V2NIMConversationIdUtil.teamConversationId(E),k)}}},t.syncSuperTeamReadTimeHandler=function syncSuperTeamReadTimeHandler(t){var a,u;if(this.ifEnabled&&(null===(u=null===(a=null==t?void 0:t.content)||void 0===a?void 0:a.superTeam)||void 0===u?void 0:u.m_map))for(var m=0,h=ov(t.content.superTeam.m_map);m<h.length;m++){var g=h[m],M=g[0],I=g[1];this.model.updateReadTime(this.core.V2NIMConversationIdUtil.superTeamConversationId(M),I),this.service.emit("onConversationReadTimeUpdated",this.core.V2NIMConversationIdUtil.superTeamConversationId(M),I)}},t.v2MultiDeviceConversationReadTimeHandler=function v2MultiDeviceConversationReadTimeHandler(t){var a;this.ifEnabled&&(null===(a=null==t?void 0:t.content)||void 0===a?void 0:a.to)&&(0===t.content.scene?(this.model.updateReadTime(this.core.V2NIMConversationIdUtil.p2pConversationId(t.content.to),t.content.timetag),this.service.emit("onConversationReadTimeUpdated",this.core.V2NIMConversationIdUtil.p2pConversationId(t.content.to),t.content.timetag)):(this.model.updateReadTime(this.core.V2NIMConversationIdUtil.teamConversationId(t.content.to),t.content.timetag),this.service.emit("onConversationReadTimeUpdated",this.core.V2NIMConversationIdUtil.teamConversationId(t.content.to),t.content.timetag)))},t.v2MultiDeviceSuperTeamReadTimeHandler=function v2MultiDeviceSuperTeamReadTimeHandler(t){var a;this.ifEnabled&&(null===(a=null==t?void 0:t.content)||void 0===a?void 0:a.to)&&(this.model.updateReadTime(this.core.V2NIMConversationIdUtil.superTeamConversationId(t.content.to),t.content.timetag),this.service.emit("onConversationReadTimeUpdated",this.core.V2NIMConversationIdUtil.superTeamConversationId(t.content.to),t.content.timetag))},Ye(V2NIMConversationHandlerImpl,[{key:"ifEnabled",get:function get(){return!0===this.core.options.enableV2CloudConversation}}]),V2NIMConversationHandlerImpl}(),cv=function(){function V2NIMConversationEventImpl(t,a){this.core=t,this.service=a,this.model=this.service.model,this.versionCache=this.service.versionCache,this.logger=this.core.logger}var t=V2NIMConversationEventImpl.prototype;return t.setListener=function setListener(){var t,a,u,m,h,g,M,I=this;this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(){return I.versionCache.doSync()})),this.core.eventBus.on("V2NIMConversationService/conversationOnlineSyncNotify",bind$1(t=this.conversationOnlineSyncNotify).call(t,this)),this.core.eventBus.on("V2NIMMessageService/sendMessage",bind$1(a=this.sendMessage).call(a,this)),this.core.eventBus.on("V2NIMMessageService/deleteMessages",bind$1(u=this.deleteMessages).call(u,this)),this.core.eventBus.on("V2NIMMessageService/revokeMessages",bind$1(m=this.revokeMessages).call(m,this)),this.core.eventBus.on("V2NIMMessageService/roamingMsgs",bind$1(h=this.roamingOrOfflineMsgs).call(h,this)),this.core.eventBus.on("V2NIMMessageService/offlineMsgs",bind$1(g=this.roamingOrOfflineMsgs).call(g,this)),this.core.eventBus.on("V2NIMSettingService/setMute",bind$1(M=this.setMute).call(M,this))},t.beforeEmit=function beforeEmit(t){for(var a,u,m=this.service.name+"::emit "+t.toString(),h=arguments.length,g=new Array(h>1?h-1:0),M=1;M<h;M++)g[M-1]=arguments[M];if("onConversationCreated"===t){var I=g[0];this.logger.log(""+m,"id:"+I.conversationId+";unread:"+I.unreadCount+";lastMsg:"+(null===(a=I.lastMessage)||void 0===a?void 0:a.messageRefer.messageClientId)+"/"+(null===(u=I.lastMessage)||void 0===u?void 0:u.messageRefer.messageServerId))}else if("onConversationChanged"===t){var S=g[0];this.logger.log(""+m,map$6(S).call(S,(function(t){var a,u;return"id:"+t.conversationId+";unread:"+t.unreadCount+";lastMsg:"+(null===(a=t.lastMessage)||void 0===a?void 0:a.messageRefer.messageClientId)+"/"+(null===(u=t.lastMessage)||void 0===u?void 0:u.messageRefer.messageServerId)})))}else{var T,C;(T=this.logger).log.apply(T,concat(C=[""+m]).call(C,g))}},t.conversationOnlineSyncNotify=function conversationOnlineSyncNotify(t,a){var u;!1!==(null===(u=null==a?void 0:a.messageConfig)||void 0===u?void 0:u.lastMessageUpdateEnabled)&&(t.content.info=deserialize(t.content.info,invertSerializeItem(Kg)),t.content.data=deserialize(t.content.data,invertSerializeItem(Wg)),a&&(t.content.data.lastMessage=formatLastMessageFromMessage(this.core,a,0)),t.content.datas=[t.content.data],this.service.handler.v2ConversationNotifySyncOnlineHandler.call(this,t))},t.sendMessage=function sendMessage(t,a){var u,m;1===a&&!0===(null===(u=t.messageConfig)||void 0===u?void 0:u.historyEnabled)||!1!==(null===(m=null==t?void 0:t.messageConfig)||void 0===m?void 0:m.lastMessageUpdateEnabled)&&this.versionCache.updateModelWithLastMessage(t.conversationId,t,2,a)},t.deleteMessages=function deleteMessages(t){var a=map$6(t).call(t,(function(t){return t.messageRefer.conversationId}));this.versionCache.backfillLastMsg(a,!0)},t.revokeMessages=function revokeMessages(t){this.versionCache.updateModelByRevoke(t)},t.roamingOrOfflineMsgs=function roamingOrOfflineMsgs(t){var a=uniq(map$6(t).call(t,(function(t){return t.conversationId})));this.versionCache.backfillLastMsg(a,!1)},t.setMute=function setMute(t,a){var u=this.model.getById(t);u&&u.mute!==a&&(u.mute=a,this.model.upsert(u),this.service.triggerConversationChanged([u]))},V2NIMConversationEventImpl}(),lv=function(t){function V2NIMConversationServiceImpl(a,u){var m;return void 0===u&&(u={}),(m=t.call(this,"V2NIMConversationService",a)||this).config={},m.model=new Hg,m.versionCache=new jg(m.core,Qe(m)),m.unread=new Qg(m.core,Qe(m)),m.compute=new ev(m.core,Qe(m)),m.event=new cv(m.core,Qe(m)),m.handler=new sv(m.core,Qe(m)),m.core._registerDep(gm,"V2NIMConversationIdUtil"),"v2"!==m.core.options.apiVersion||!0!==m.core.options.enableV2CloudConversation?Qe(m):(registerParser({cmdMap:$g,cmdConfig:Yg}),m.setOptions(u),m.setListener(),m)}wt(V2NIMConversationServiceImpl,t);var a=V2NIMConversationServiceImpl.prototype;return a.setOptions=function setOptions(t){this.config=Ut(this.config,t)},a.setListener=function setListener(){this.event.setListener()},a.reset=function reset(){this.versionCache.reset(),this.model.reset(),this.unread.reset()},a.emit=function emit(a){for(var u,m,h,g,M=arguments.length,I=new Array(M>1?M-1:0),S=1;S<M;S++)I[S-1]=arguments[S];return(u=this.event).beforeEmit.apply(u,concat(m=[a]).call(m,I)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,I))},a.checkEnable=function checkEnable(){if(!0!==this.core.options.enableV2CloudConversation)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"V2CloudConversation is not enabled"}})},a.getConversationList=function getConversationList(t,a){this.checkEnable(),this.checkV2(),validate({offset:{type:"number",min:0}},{offset:t},"",!0),validate({limit:{type:"number",min:1}},{limit:a},"",!0),this.core.V2NIMLoginService.checkIllegalState();var u=this.model.getByOption(t,a,{});return u.conversationList=this.compute.computeConvs(u.conversationList),$i.resolve(u)},a.getConversationListByOption=function getConversationListByOption(t,a,u){this.checkEnable(),this.checkV2(),validate({offset:{type:"number",min:0}},{offset:t},"",!0),validate({limit:{type:"number",min:1}},{limit:a},"",!0),validate({option:{type:"object",required:!0,rules:{conversationTypes:{type:"array",itemType:"number",required:!1},onlyUnread:{type:"boolean",required:!1},conversationGroupIds:{type:"array",itemType:"string",required:!1}}}},{option:u},"",!0),this.core.V2NIMLoginService.checkIllegalState();var m=this.model.getByOption(t,a,u);return m.conversationList=this.compute.computeConvs(m.conversationList),$i.resolve(m)},a.getConversation=function getConversation(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(this.checkEnable(),this.checkV2(),validateConversationId(this.core.account,t),!(a=this.model.getById(t))){u.next=8;break}return u.abrupt("return",this.compute.computeConv(a));case 8:throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST});case 9:case"end":return u.stop()}}),_callee,this)})))},a.getConversationListByIds=function getConversationListByIds(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m=this;return lu.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkEnable(),this.checkV2(),validate({conversationIds:{type:"array",itemType:"string",min:1}},{conversationIds:t},"",!0),this.core.V2NIMLoginService.checkIllegalState(),u=filter(a=map$6(t).call(t,(function(t){return m.model.getById(t)}))).call(a,(function(t){return!!t})),u=this.compute.computeConvs(u),h.abrupt("return",u);case 7:case"end":return h.stop()}}),_callee2,this)})))},a.createConversation=function createConversation(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m,h;return lu.wrap((function _callee3$(g){for(;;)switch(g.prev=g.next){case 0:return this.checkEnable(),this.checkV2(),validateConversationId(this.core.account,t),g.next=5,this.core.sendCmd("v2ConversationCreate",{tag:{conversationId:t}});case 5:if(a=g.sent,u=get(a,"content.data"),m=formatConversationField(this.core,u),this.versionCache.compareAndUpdateModel([m]),!(h=this.model.getById(t))){g.next=14;break}return g.abrupt("return",this.compute.computeConv(h));case 14:throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST});case 15:case"end":return g.stop()}}),_callee3,this)})))},a.deleteConversation=function deleteConversation(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkEnable(),this.checkV2(),validateConversationId(this.core.account,t),validate({clearMessage:{type:"boolean",required:!1}},{clearMessage:a},"",!0),u.prev=4,u.next=7,this.core.sendCmd("v2ConversationDelete",{tag:{conversationId:t,clearMessage:Number(a||!1)}});case 7:u.next=12;break;case 9:u.prev=9,u.t0=u.catch(4),this.logger.warn("V2NIMConversationService:deleteConversation: delete conversation failed: "+t);case 12:this.model.getById(t)&&(a&&this.core.eventBus.emit("V2NIMConversationService/deleteConversation",[t]),this.versionCache.compareAndDeleteModel([t]));case 13:case"end":return u.stop()}}),_callee4,this,[[4,9]])})))},a.deleteConversationListByIds=function deleteConversationListByIds(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var u,m,h,g=this;return lu.wrap((function _callee5$(M){for(;;)switch(M.prev=M.next){case 0:return this.checkEnable(),this.checkV2(),validate({conversationIds:{type:"array",itemType:"string",min:1}},{conversationIds:t},"",!0),validate({clearMessage:{type:"boolean",required:!1}},{clearMessage:a},"",!0),M.next=6,this.core.sendCmd("v2ConversationsDelete",{tag:{conversationIds:Vn(t),clearMessage:Number(a||!1)}});case 6:return u=M.sent,m=formatFailedMap(get(u,"content.info.failedMap")),(h=filter(m).call(m,(function(t){return t.error.code!==jl.V2NIM_ERROR_CODE_CONVERSATION_NOT_EXIST||!g.model.getById(t.conversationId)}))).length<t.length&&(a&&this.core.eventBus.emit("V2NIMConversationService/deleteConversation",t),this.versionCache.compareAndDeleteModel(t)),M.abrupt("return",h);case 11:case"end":return M.stop()}}),_callee5,this)})))},a.getStickTopConversationList=function getStickTopConversationList(){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){return lu.wrap((function _callee6$(t){for(;;)switch(t.prev=t.next){case 0:return this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),t.abrupt("return",this.model.getStickTopList());case 3:case"end":return t.stop()}}),_callee6,this)})))},a.stickTopConversation=function stickTopConversation(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var u,m,h;return lu.wrap((function _callee7$(g){for(;;)switch(g.prev=g.next){case 0:return this.checkEnable(),this.checkV2(),validateConversationId(this.core.account,t),validate({stickTop:{type:"boolean"}},{stickTop:a},"",!0),g.next=6,this.core.sendCmd("v2ConversationSetTop",{tag:{conversationId:t,stickTop:Number(a)}});case 6:u=g.sent,m=get(u,"content.data"),h=formatConversationField(this.core,m),this.versionCache.compareAndUpdateModel([h]);case 10:case"end":return g.stop()}}),_callee7,this)})))},a.updateConversation=function updateConversation(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var u,m,h;return lu.wrap((function _callee8$(g){for(;;)switch(g.prev=g.next){case 0:return this.checkEnable(),this.checkV2(),validateConversationId(this.core.account,t),validate({updateInfo:{type:"object",required:!0,rules:{serverExtension:{type:"string"}}}},{updateInfo:a},"",!0),g.next=6,this.core.sendCmd("v2ConversationUpdate",{tag:Ut({conversationId:t},a)});case 6:u=g.sent,m=get(u,"content.data"),h=formatConversationField(this.core,m),this.versionCache.compareAndUpdateModel([h]);case 10:case"end":return g.stop()}}),_callee8,this)})))},a.updateConversationLocalExtension=function updateConversationLocalExtension(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var u,m;return lu.wrap((function _callee9$(h){for(;;)switch(h.prev=h.next){case 0:if(this.checkEnable(),this.checkV2(),validateConversationId(this.core.account,t),validate({localExtension:{type:"string"}},{localExtension:a},"",!0),u=this.model.getById(t)){h.next=7;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST});case 7:if(u.localExtension!==a){h.next=9;break}return h.abrupt("return");case 9:m=Ut(Ut({},u),{localExtension:a}),this.model.upsert(m),this.triggerConversationChanged([m]);case 12:case"end":return h.stop()}}),_callee9,this)})))},a.getTotalUnreadCount=function getTotalUnreadCount(){return this.checkEnable(),this.checkV2(),this.unread.getTotalUnreadCount()||0},a.getUnreadCountByIds=function getUnreadCountByIds(t){this.checkEnable(),this.checkV2(),validate({conversationIds:{type:"array",itemType:"string",min:1}},{conversationIds:t},"",!0);var a=this.unread.getUnreadCountByIds(t);return $i.resolve(a)},a.getUnreadCountByFilter=function getUnreadCountByFilter(t){this.checkEnable(),this.checkV2(),this.valiteFilter(t);var a=this.unread.getUnreadCountByFilter(t);return $i.resolve(a)},a.clearTotalUnreadCount=function clearTotalUnreadCount(){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){var t,a;return lu.wrap((function _callee10$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkEnable(),this.checkV2(),u.next=4,this.core.sendCmd("v2ConversationClearTotalUnread");case 4:t=u.sent,a=get(t,"content.info"),this.versionCache.compareAndClearUnreadInModel(a);case 7:case"end":return u.stop()}}),_callee10,this)})))},a.clearUnreadCountByIds=function clearUnreadCountByIds(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){var a,u,m;return lu.wrap((function _callee11$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkEnable(),this.checkV2(),validate({conversationIds:{type:"array",itemType:"string",min:1}},{conversationIds:t},"",!0),h.next=5,this.core.sendCmd("v2ConversationsUnreadClear",{tag:{conversationIds:Vn(t)}});case 5:return a=h.sent,u=formatConversationFields(this.core,get(a,"content.datas")),m=formatFailedMap(get(a,"content.info.failedMap")),this.versionCache.compareAndUpdateModel(u),h.abrupt("return",m);case 10:case"end":return h.stop()}}),_callee11,this)})))},a.clearUnreadCountByGroupId=function clearUnreadCountByGroupId(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){return lu.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkEnable(),this.checkV2(),validate({groupId:{type:"string"}},{groupId:t},"",!0),a.next=5,this.core.sendCmd("v2ConversationClearGroupUnread",{tag:{groupId:t}});case 5:case"end":return a.stop()}}),_callee12,this)})))},a.clearUnreadCountByTypes=function clearUnreadCountByTypes(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){var a,u;return lu.wrap((function _callee13$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkEnable(),this.checkV2(),validate({types:Fg},{types:t},"",!0),m.next=5,this.core.sendCmd("v2ConversationClearTypeUnread",{tag:{conversationType:Vn(t)}});case 5:a=m.sent,u=get(a,"content.info"),this.versionCache.compareAndClearUnreadInModel(u);case 8:case"end":return m.stop()}}),_callee13,this)})))},a.markConversationRead=function markConversationRead(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){var a,u,m,h,g;return lu.wrap((function _callee14$(M){for(;;)switch(M.prev=M.next){case 0:if(this.checkEnable(),this.checkV2(),this.checkLogin(),validateConversationId(this.core.account,t),a=this.model.getById(t)){M.next=7;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Conversation not exist"}});case 7:if(u=this.core.V2NIMConversationIdUtil.parseConversationTargetId(t),m=this.core.V2NIMConversationIdUtil.parseConversationType(t),h=this.model.getReadTime(t),g=this.compute.computeReadTimeForMark(a),!(h>=g)){M.next=14;break}return this.logger.log("V2Conv::markConversationRead currentReadTime >= readTime "+t+","+h+","+g),M.abrupt("return",h);case 14:if(3!==m){M.next=19;break}return M.next=17,this.core.sendCmd("v2MarkSuperTeamReadTime",{timetag:g,to:u});case 17:M.next=21;break;case 19:return M.next=21,this.core.sendCmd("v2MarkConversationReadTime",{scene:1===m?0:2===m?1:2,timetag:g,to:u});case 21:return this.model.updateReadTime(t,g),M.abrupt("return",g);case 23:case"end":return M.stop()}}),_callee14,this)})))},a.getConversationReadTime=function getConversationReadTime(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){return lu.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkEnable(),this.checkV2(),validateConversationId(this.core.account,t),a.abrupt("return",this.model.getReadTime(t));case 4:case"end":return a.stop()}}),_callee15,this)})))},a.subscribeUnreadCountByFilter=function subscribeUnreadCountByFilter(t){var a;this.checkEnable(),this.checkV2(),this.checkLogin(),this.valiteFilter(t),0===(null===(a=t.conversationTypes)||void 0===a?void 0:a.length)&&delete t.conversationTypes,this.unread.addFilter(t)},a.unsubscribeUnreadCountByFilter=function unsubscribeUnreadCountByFilter(t){var a;this.checkEnable(),this.checkV2(),this.checkLogin(),this.valiteFilter(t),0===(null===(a=t.conversationTypes)||void 0===a?void 0:a.length)&&delete t.conversationTypes,this.unread.deleteFilter(t)},a.valiteFilter=function valiteFilter(t){if(validate({filter:{type:"object",required:!0,rules:{conversationTypes:{type:"array",itemType:"number",required:!1},conversationGroupId:{type:"string",allowEmpty:!1,required:!1},ignoreMuted:{type:"boolean",required:!1}}}},{filter:t},"",!0),void 0===t.conversationTypes&&void 0===t.conversationGroupId&&!0!==t.ignoreMuted)throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Filter cannot be empty"}})},a.triggerConversationChanged=function triggerConversationChanged(t){t=this.compute.computeConvs(t),t=JSON.parse(Vn(t)),forEach$1(t).call(t,(function(t){t.lastMessage||(t.lastMessage=void 0),delete t.lastMessageState})),this.emit("onConversationChanged",t)},a.triggerConversationCreated=function triggerConversationCreated(t){t=this.compute.computeConv(t),delete(t=JSON.parse(Vn(t))).lastMessageState,this.emit("onConversationCreated",t)},V2NIMConversationServiceImpl}(gp),uv={"28_9":"v2ConversationGroupCreate","28_10":"v2ConversationGroupDelete","28_11":"v2ConversationGroupUpdate","28_12":"v2ConversationGroupGet","28_13":"v2ConversationGroupsGet","28_14":"v2ConversationGroupListGet","28_15":"v2ConversationGroupAddTo","28_16":"v2ConversationGroupRemoveFrom","28_22":"v2ConversationGroupNotifySyncOnline"},dv="V2NIMConversationGroupService",pv={groupId:1,name:2,serverExtension:3,createTime:4,updateTime:5},mv={v2ConversationGroupCreate:{sid:28,cid:9,service:dv,params:[{type:"Property",name:"tag",reflectMapper:{conversationIds:1,name:2,serverExtension:3}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(pv)},{type:"PropertyArray",name:"conversations",reflectMapper:invertSerializeItem(Wg)},{type:"Property",name:"info",reflectMapper:{1:"failedMap"}}]},v2ConversationGroupDelete:{sid:28,cid:10,service:dv,params:[{type:"Property",name:"tag",reflectMapper:{groupId:1}}],response:[{type:"Property",name:"info",reflectMapper:{1:"type",2:"deleteVersion",3:"groupList"}}]},v2ConversationGroupUpdate:{sid:28,cid:11,service:dv,params:[{type:"Property",name:"tag",reflectMapper:{groupId:1,name:2,serverExtension:3}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(pv)}]},v2ConversationGroupGet:{sid:28,cid:12,service:dv,params:[{type:"Property",name:"tag",reflectMapper:{groupId:1}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(pv)}]},v2ConversationGroupsGet:{sid:28,cid:13,service:dv,params:[{type:"Property",name:"tag",reflectMapper:{groupIds:1}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(pv)},{type:"Property",name:"info",reflectMapper:{1:"failedMap"}}]},v2ConversationGroupListGet:{sid:28,cid:14,service:dv,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(pv)}]},v2ConversationGroupAddTo:{sid:28,cid:15,service:dv,params:[{type:"Property",name:"tag",reflectMapper:{groupId:1,conversationIds:2}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Wg)},{type:"Property",name:"info",reflectMapper:{1:"failedMap"}}]},v2ConversationGroupRemoveFrom:{sid:28,cid:16,service:dv,params:[{type:"Property",name:"tag",reflectMapper:{groupId:1,conversationIds:2}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(Wg)},{type:"Property",name:"info",reflectMapper:{1:"failedMap"}}]},v2ConversationGroupNotifySyncOnline:{sid:28,cid:22,service:dv,response:[{type:"Property",name:"info",reflectMapper:{1:"type",2:"deleteVersion",3:"conversationIds"}},{type:"Property",name:"data",reflectMapper:invertSerializeItem(pv)}]}},hv=function(t){function V2NIMConversationGroupServiceImpl(a,u){var m;return void 0===u&&(u={}),(m=t.call(this,"V2NIMConversationGroupService",a)||this).config={},m.core._registerDep(lv,"V2NIMConversationService"),"v2"!==m.core.options.apiVersion||!0!==m.core.options.enableV2CloudConversation?Qe(m):(registerParser({cmdMap:uv,cmdConfig:mv}),m.setOptions(u),m)}wt(V2NIMConversationGroupServiceImpl,t);var a=V2NIMConversationGroupServiceImpl.prototype;return a.setOptions=function setOptions(t){this.config=Ut(this.config,t)},a.emit=function emit(a){for(var u,m,h=this.name+"::emit "+a.toString(),g=arguments.length,M=new Array(g>1?g-1:0),I=1;I<g;I++)M[I-1]=arguments[I];if("onConversationsAddedToGroup"===a){var S=M[0],T=M[1];this.logger.log(""+h,"groupId:"+S,"conversations:"+map$6(T).call(T,(function(t){return t.conversationId})).join(","))}else{var C,b;(C=this.logger).log.apply(C,concat(b=[""+h]).call(b,M))}return(u=t.prototype.emit).call.apply(u,concat(m=[this,a]).call(m,M))},a.checkEnable=function checkEnable(){if(!0!==this.core.options.enableV2CloudConversation)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"V2CloudConversation is not enabled"}})},a.createConversationGroup=function createConversationGroup(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var m,h,g,M,I,S=this;return lu.wrap((function _callee$(T){for(;;)switch(T.prev=T.next){case 0:return this.checkEnable(),this.checkV2(),validate({name:{type:"string",allowEmpty:!1}},{name:t},"",!0),validate({serverExtension:{type:"string",required:!1}},{serverExtension:a},"",!0),validate({conversationIds:{type:"array",itemType:"string",required:!1}},{conversationIds:u},"",!0),T.next=7,this.core.sendCmd("v2ConversationGroupCreate",{tag:{name:t,serverExtension:a||"",conversationIds:u&&Vn(u)}});case 7:return m=T.sent,h=formatConversationGroup(get(m,"content.data")),g=formatConversationFields(this.core,get(m,"content.conversations")),M=formatFailedMap(get(m,"content.info.failedMap")),this.emit("onConversationGroupCreated",h),g.length>0&&(this.core.V2NIMConversationService.versionCache.compareAndUpdateModel(g),this.emit("onConversationsAddedToGroup",h.groupId,filter(I=map$6(g).call(g,(function(t){return S.core.V2NIMConversationService.model.getById(t.conversationId)}))).call(I,(function(t){return!!t})))),T.abrupt("return",{group:h,failedList:M});case 14:case"end":return T.stop()}}),_callee,this)})))},a.deleteConversationGroup=function deleteConversationGroup(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u;return lu.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkEnable(),this.checkV2(),validate({groupId:{type:"string",allowEmpty:!1}},{groupId:t},"",!0),m.next=5,this.core.sendCmd("v2ConversationGroupDelete",{tag:{groupId:t}});case 5:a=m.sent,u=formatConversationGroupNotify(get(a,"content.info")),this.core.V2NIMConversationService.versionCache.compareAndDeleteGroupInModel(u.deleteVersion,t),this.emit("onConversationGroupDeleted",t);case 9:case"end":return m.stop()}}),_callee2,this)})))},a.updateConversationGroup=function updateConversationGroup(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var m,h;return lu.wrap((function _callee3$(g){for(;;)switch(g.prev=g.next){case 0:if(this.checkEnable(),this.checkV2(),validate({groupId:{type:"string",allowEmpty:!1}},{groupId:t},"",!0),validate({name:{type:"string",required:!1}},{name:a},"",!0),validate({serverExtension:{type:"string",required:!1}},{serverExtension:u},"",!0),void 0!==a||void 0!==u){g.next=7;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER});case 7:return g.next=9,this.core.sendCmd("v2ConversationGroupUpdate",{tag:{groupId:t,name:a,serverExtension:u}});case 9:m=g.sent,h=formatConversationGroup(get(m,"content.data")),this.emit("onConversationGroupChanged",h);case 12:case"end":return g.stop()}}),_callee3,this)})))},a.addConversationsToGroup=function addConversationsToGroup(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var u,m,h,g,M,I,S=this;return lu.wrap((function _callee4$(T){for(;;)switch(T.prev=T.next){case 0:return this.checkEnable(),this.checkV2(),validate({groupId:{type:"string",allowEmpty:!1}},{groupId:t},"",!0),validate({conversationIds:{type:"array",itemType:"string",min:1,allowEmpty:!1}},{conversationIds:a},"",!0),T.next=6,this.core.sendCmd("v2ConversationGroupAddTo",{tag:{groupId:t,conversationIds:Vn(a)}});case 6:return m=T.sent,h=get(m,"content.info.failedMap")||"",g=[],h&&(g=formatFailedMap(h)),M=formatConversationFields(this.core,get(m,"content.datas")),this.core.V2NIMConversationService.versionCache.compareAndUpdateModel(M),(I=filter(u=map$6(M).call(M,(function(t){return S.core.V2NIMConversationService.model.getById(t.conversationId)}))).call(u,(function(t){return!!t}))).length>0&&this.emit("onConversationsAddedToGroup",t,I),T.abrupt("return",g);case 15:case"end":return T.stop()}}),_callee4,this)})))},a.removeConversationsFromGroup=function removeConversationsFromGroup(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var u,m,h,g;return lu.wrap((function _callee5$(M){for(;;)switch(M.prev=M.next){case 0:return this.checkEnable(),this.checkV2(),validate({groupId:{type:"string",allowEmpty:!1}},{groupId:t},"",!0),validate({conversationIds:{type:"array",itemType:"string",min:1,allowEmpty:!1}},{conversationIds:a},"",!0),M.next=6,this.core.sendCmd("v2ConversationGroupRemoveFrom",{tag:{groupId:t,conversationIds:Vn(a)}});case 6:return u=M.sent,m=get(u,"content.info.failedMap")||"",h=[],m&&(h=formatFailedMap(m)),g=formatConversationFields(this.core,get(u,"content.datas")),this.core.V2NIMConversationService.versionCache.compareAndUpdateModel(g),this.emit("onConversationsRemovedFromGroup",t,map$6(g).call(g,(function(t){return t.conversationId}))),M.abrupt("return",h);case 14:case"end":return M.stop()}}),_callee5,this)})))},a.getConversationGroup=function getConversationGroup(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var a;return lu.wrap((function _callee6$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkEnable(),this.checkV2(),validate({groupId:{type:"string",allowEmpty:!1}},{groupId:t},"",!0),u.next=5,this.core.sendCmd("v2ConversationGroupGet",{tag:{groupId:t}});case 5:return a=u.sent,u.abrupt("return",formatConversationGroup(get(a,"content.data")));case 7:case"end":return u.stop()}}),_callee6,this)})))},a.getConversationGroupList=function getConversationGroupList(){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var t;return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkEnable(),this.checkV2(),a.next=4,this.core.sendCmd("v2ConversationGroupListGet");case 4:return t=a.sent,a.abrupt("return",formatConversationGroups(get(t,"content.datas")));case 6:case"end":return a.stop()}}),_callee7,this)})))},a.getConversationGroupListByIds=function getConversationGroupListByIds(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a,u,m;return lu.wrap((function _callee8$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkEnable(),this.checkV2(),validate({groupIds:{type:"array",itemType:"string",min:1}},{groupIds:t},"",!0),h.next=5,this.core.sendCmd("v2ConversationGroupsGet",{tag:{groupIds:t&&Vn(t)}});case 5:return u=h.sent,m=formatConversationGroups(get(u,"content.datas")),h.abrupt("return",filter(a=map$6(t).call(t,(function(t){return filter(m).call(m,(function(a){return a.groupId===t}))[0]}))).call(a,(function(t){return!!t})));case 8:case"end":return h.stop()}}),_callee8,this)})))},a.v2ConversationGroupNotifySyncOnlineHandler=function v2ConversationGroupNotifySyncOnlineHandler(t){var a=this;if(this.ifEnabled){var u,m=formatConversationGroupNotify(get(t,"content.info")),h=m.type,g=m.deleteVersion,M=m.conversationIds,I=formatConversationGroup(get(t,"content.data"));if(this.core.logger.log("v2ConversationGroupNotifySyncOnlineHandler",m,I),1===h){if(this.emit("onConversationGroupCreated",I),M&&M.length>0)this.emit("onConversationsAddedToGroup",I.groupId,filter(u=map$6(M).call(M,(function(t){return a.core.V2NIMConversationService.model.getById(t)}))).call(u,(function(t){return!!t})))}else if(2===h)this.emit("onConversationGroupDeleted",I.groupId),this.core.V2NIMConversationService.versionCache.compareAndDeleteGroupInModel(g,I.groupId);else if(3===h)this.emit("onConversationGroupChanged",I);else if(4===h){var S,T=filter(S=map$6(M).call(M,(function(t){return a.core.V2NIMConversationService.model.getById(t)}))).call(S,(function(t){return!!t}));this.emit("onConversationsAddedToGroup",I.groupId,T)}else 5===h&&this.emit("onConversationsRemovedFromGroup",I.groupId,M)}},Ye(V2NIMConversationGroupServiceImpl,[{key:"ifEnabled",get:function get(){return!0===this.core.options.enableV2CloudConversation}}]),V2NIMConversationGroupServiceImpl}(gp),gv="V2NIMMessageLogUtil",vv={"30_6":"v2GetMessageList","33_2":"v2GetMessageListByRefers","30_9":"v2ClearRoamingMessage","30_18":"v2ClearHistoryMessage","7_118":"onClearHistoryMessage","4_24":"syncClearHistoryMessage","31_23":"v2GetTeamMessageList","32_14":"v2GetSuperTeamMessageList"},fv={conversationType:{id:0,retType:"number"},receiverId:1,deleteRoam:{id:2,converter:boolToInt},teamId:3,onlineSync:{id:4,converter:boolToInt},deleteTime:{id:6,retType:"number"},serverExtension:7},yv=[{type:"Long",name:"beginTime"},{type:"Long",name:"endTime"},{type:"Long",name:"lastMsgId"},{type:"Int",name:"limit"},{type:"Bool",name:"direction"},{type:"LongArray",name:"msgTypes"}],Mv={v2GetMessageList:{sid:30,cid:6,service:gv,params:concat(rv=[{type:"String",name:"to"}]).call(rv,yv),response:[{type:"PropertyArray",name:"msgs",reflectMapper:invertSerializeItem(_h)}]},v2GetMessageListByRefers:{sid:33,cid:2,service:gv,params:[{type:"PropertyArray",name:"tag",reflectMapper:_h,select:["conversationType","senderId","receiverId","createTime","messageServerId"]}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:invertSerializeItem(_h)}]},v2ClearRoamingMessage:{sid:30,cid:9,service:gv,params:[{type:"StrArray",name:"conversationIds"}]},v2ClearHistoryMessage:{sid:30,cid:18,service:gv,params:[{type:"Property",name:"tag",reflectMapper:fv}],response:[{type:"Long",name:"timetag"}]},v2GetTeamMessageList:{sid:31,cid:23,service:gv,params:concat(nv=[{type:"Long",name:"to"}]).call(nv,yv),response:[{type:"PropertyArray",name:"msgs",reflectMapper:invertSerializeItem(_h)}]},v2GetSuperTeamMessageList:{sid:32,cid:14,service:gv,params:concat(av=[{type:"Long",name:"to"}]).call(av,yv),response:[{type:"PropertyArray",name:"msgs",reflectMapper:invertSerializeItem(_h)}]},onClearHistoryMessage:{sid:7,cid:118,service:gv,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(fv)}]},syncClearHistoryMessage:{sid:4,cid:24,service:gv,response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(fv)}]}},Iv=function(t){function V2NIMMessageLogUtil(a){var u;return(u=t.call(this,"V2NIMMessageLogUtil",a)||this).clearHistoryMessageFn=function(t){var a=formatClearHistoryNotification(u.core,t);u.emitClearHistoryMessage([a])},u.core=a,u.service=u.core.V2NIMMessageService,"v2"!==u.core.options.apiVersion?Qe(u):(registerParser({cmdMap:vv,cmdConfig:Mv}),u.setListener(),u)}wt(V2NIMMessageLogUtil,t);var a=V2NIMMessageLogUtil.prototype;return a.setListener=function setListener(){this.core.eventBus.on("forwardReceive/V2NIMMessageLogService/clearHistoryMessage",this.clearHistoryMessageFn)},a.getMessageListByRefers=function getMessageListByRefers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u,m,h,g,M=this;return lu.wrap((function _callee$(I){for(;;)switch(I.prev=I.next){case 0:if(this.checkV2(),validate(Pm,{messageRefers:t},"",!0),0!==t.length){I.next=4;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getMessageListByRefers: messageRefers cannot be an empty array"}});case 4:if(u=[],m=map$6(t).call(t,(function(t){var a=M.service.model.getMessageById(t.messageClientId);return!a&&t.messageServerId&&"0"!==t.messageServerId&&u.push(t),a})),h=[],!(u.length>0)){I.next=12;break}return I.next=10,this.core.sendCmd("v2GetMessageListByRefers",{tag:u});case 10:g=I.sent,h=g.content.msgs;case 12:return I.abrupt("return",filter(a=map$6(m).call(m,(function(a,u){if(a)return a;var m=t[u],g=find(h).call(h,(function(t){return t.messageServerId===m.messageServerId}));return g?completeMessage(M.core,g):void 0}))).call(a,(function(t){return void 0!==t&&!M.service._filterMessage(t)})));case 13:case"end":return I.stop()}}),_callee,this)})))},a.getMessageList=function getMessageList(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u,m,h,g,M,I,S,T,C,b,E,k,R=this;return lu.wrap((function _callee2$(A){for(;;)switch(A.prev=A.next){case 0:if(this.checkV2(),validate(xm,t,"",!0),validateConversationId(this.core.account,t.conversationId),h=this.core.V2NIMConversationIdUtil.parseConversationType(t.conversationId),g=this.core.V2NIMConversationIdUtil.parseConversationTargetId(t.conversationId),M=1===h?"v2GetMessageList":2===h?"v2GetTeamMessageList":"v2GetSuperTeamMessageList",I=t.beginTime||0,S=t.endTime||0,!(0!==I&&0!==S&&I>S)){A.next=10;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getMessageList: beginTime cannot be greater than endTime"}});case 10:if(T=void 0===t.direction?0:t.direction,!t.anchorMessage){A.next=27;break}if(0!==T){A.next=21;break}if(0!==S){A.next=17;break}S=t.anchorMessage.createTime,A.next=19;break;case 17:if(S===t.anchorMessage.createTime){A.next=19;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getMessageList: When providing anchorMessage, when sorting in descending order, endTime does not need to be provided, or endTime should be equal to anchorMessage.createTime"}});case 19:A.next=27;break;case 21:if(0!==I){A.next=25;break}I=t.anchorMessage.createTime,A.next=27;break;case 25:if(I===t.anchorMessage.createTime){A.next=27;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getMessageList: When providing anchorMessage, when sorting in ascending order, there is no need to provide beginTime, or beginTime should be equal to anchorMessage.createTime"}});case 27:return C=null===(a=t.anchorMessage)||void 0===a?void 0:a.messageServerId,A.next=30,this.core.sendCmd(M,{beginTime:I,endTime:S,lastMsgId:C||0,limit:t.limit||50,direction:T,msgTypes:t.messageTypes?slice(u=t.messageTypes).call(u):[],to:g});case 30:return b=A.sent,E=b.content,k=map$6(m=E.msgs).call(m,(function(t){return completeMessage(R.core,t)})),C&&(k=filter(k).call(k,(function(t){return t.messageServerId!==C}))),A.abrupt("return",this.getMessageListMonkeyPatch(k,t));case 35:case"end":return A.stop()}}),_callee2,this)})))},a.getMessageListMonkeyPatch=function getMessageListMonkeyPatch(t,a){var u=a.conversationId,m=t,h=reduce(m).call(m,(function(t,a){return t[a.messageClientId]=!0,t}),{}),g=this.service.model.getMessagesByConversationId(u);g=sort(g).call(g,(function(t,u){return 1===a.direction?t.createTime-u.createTime:u.createTime-t.createTime}));var M=0,I=a.beginTime||0,S=a.endTime||0;a.anchorMessage&&(0===a.direction?S=a.anchorMessage.createTime:I=a.anchorMessage.createTime,M=findIndex$1(g).call(g,(function(t){var u;return t.messageClientId===(null===(u=a.anchorMessage)||void 0===u?void 0:u.messageClientId)})),M+=1);for(var T=M;T<g.length;T++){var C,b=g[T],E=!h[b.messageClientId],k=void 0===b.sendingState||1===b.sendingState,R=b.conversationId===u,A=b.createTime>I&&(b.createTime<S||0===S),w=!a.messageTypes||includes(C=a.messageTypes).call(C,b.messageType);E&&k&&R&&A&&w&&m.push(g[T])}return m=sort(m).call(m,(function(t,u){return 1===a.direction?t.createTime-u.createTime:u.createTime-t.createTime})),slice(m).call(m,0,a.limit||50)},a.clearHistoryMessage=function clearHistoryMessage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m,h,g,M,I,S,T;return lu.wrap((function _callee3$(C){for(;;)switch(C.prev=C.next){case 0:if(this.checkV2(),validate(Um,t,"",!0),validateConversationId(this.core.account,t.conversationId),a=t.conversationId,u=t.deleteRoam,m=t.onlineSync,h=t.serverExtension,g=this.core.V2NIMConversationIdUtil.parseConversationType(a),M=this.core.V2NIMConversationIdUtil.parseConversationTargetId(a),I={deleteRoam:u,onlineSync:m,serverExtension:h,conversationType:g},1===g?I.receiverId=M:I.teamId=M,S=this.core.timeOrigin.getNTPTime(),t.clearMode=t.clearMode||0,0!==t.clearMode){C.next=15;break}return C.next=13,this.core.sendCmd("v2ClearHistoryMessage",{tag:I});case 13:T=C.sent,S=T.content.timetag;case 15:2===t.clearMode&&uu.localStorage.setItem("nim_"+this.core.account+"_"+a+"_clearTime",S.toString()),this.core.eventBus.emit("forwardSend/V2NIMMessageLogService/clearHistoryMessage",Ut(Ut({},I),{deleteTime:S})),this.emitClearHistoryMessage([{deleteTime:S,serverExtension:h,conversationId:a}]);case 18:case"end":return C.stop()}}),_callee3,this)})))},a.clearRoamingMessage=function clearRoamingMessage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a,u=this;return lu.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:this.checkV2(),validate({conversationIds:{type:"array",itemType:"string",min:1}},{conversationIds:t},void 0,!0),a=[],m.prev=3,a=map$6(t).call(t,(function(t){var a=u.core.V2NIMConversationIdUtil.parseConversationTargetId(t);return getSessionIdFromConvInfo(u.core.V2NIMConversationIdUtil.parseConversationType(t),a)})),m.next=11;break;case 7:throw m.prev=7,m.t0=m.catch(3),this.logger.error("V2NIMMessage::clearRoamingMessage with "+t,m.t0),new Wl({code:jl.V2NIM_ERROR_CODE_PARAMETER_ERROR,detail:{reason:"Failed to create session",rawData:""+t}});case 11:return m.next=13,this.core.sendCmd("v2ClearRoamingMessage",{conversationIds:a});case 13:case"end":return m.stop()}}),_callee4,this,[[3,7]])})))},a.syncClearHistoryMessageHandler=function syncClearHistoryMessageHandler(t){var a,u=this,m=map$6(a=t.content.data).call(a,(function(t){return formatClearHistoryNotification(u.core,t)}));this.emitClearHistoryMessage(m)},a.onClearHistoryMessageHandler=function onClearHistoryMessageHandler(t){var a=formatClearHistoryNotification(this.core,t.content.data);this.emitClearHistoryMessage([a])},a.emitClearHistoryMessage=function emitClearHistoryMessage(t){var a=this;forEach$1(t).call(t,(function(t){a.service.model.deleteMessages(t.conversationId,t.deleteTime),a.core.eventBus.emit("V2NIMSync/updateTimetag",{sessionHistoryMsgsDelete:t.deleteTime})})),this.core.eventBus.emit("V2NIMMessageLogUtil/onClearHistoryNotifications",t),this.service.emit("onClearHistoryNotifications",t)},V2NIMMessageLogUtil}(gp),_v="V2NIMMessageExtendUtil",Sv={"29_5":"v2VoiceToText","33_15":"v2PinMessage","33_16":"v2UpdatePinMessage","33_17":"v2UnpinMessage","23_18":"onPinMessage","23_19":"onUpdatePinMessage","23_20":"onUnpinMessage","23_115":"onPinMessage","23_116":"onUpdatePinMessage","23_117":"onUnpinMessage","33_21":"v2GetPinMessageList","33_3":"v2AddQuickComment","33_4":"v2RemoveQuickComment","33_7":"v2GetQuickComment","23_5":"onAddQuickComment","23_6":"onRemoveQuickComment","23_103":"onAddQuickComment","23_104":"onRemoveQuickComment","33_8":"v2AddCollection","33_9":"v2RemoveCollections","33_10":"v2UpdateCollectionExtension","33_11":"v2GetCollectionListByOption","30_26":"v2SearchCloudMessagesGroupByConversation","30_27":"v2SearchCloudMessages","30_34":"v2SearchCloudMessagesEx","33_1":"v2GetThreadMessageList"},Tv={conversationType:{id:1,converter:conversationTypeV2ToV1,retConverter:conversationTypeV1ToV2,access:"messageRefer.conversationType"},senderId:{id:2,access:"messageRefer.senderId"},receiverId:{id:3,access:"messageRefer.receiverId"},createTime:{id:4,retType:"number",access:"messageRefer.createTime"},messageServerId:{id:5,access:"messageRefer.messageServerId"},messageClientId:{id:6,access:"messageRefer.messageClientId"},detail:7,modify:{id:8,retType:"number"}},Cv={conversationType:{id:1,access:"messageRefer.conversationType",retConverter:conversationTypeV1ToV2},senderId:{id:2,access:"messageRefer.senderId"},receiverId:{id:3,access:"messageRefer.receiverId"},time:{id:4,access:"messageRefer.createTime",converter:boolToInt,retType:"number"},messageServerId:{id:5,access:"messageRefer.messageServerId"},messageClientId:{id:6,access:"messageRefer.messageClientId"},operatorId:7,serverExtension:8,createTime:{id:9,converter:boolToInt,retType:"number"},updateTime:{id:10,converter:boolToInt,retType:"number"}},bv={operatorId:1,index:{id:2,retType:"number"},createTime:{id:3,retType:"number"},serverExtension:4,pushEnabled:{id:5,access:"pushConfig.pushEnabled",converter:boolToInt},needBadge:{id:6,access:"pushConfig.needBadge",converter:boolToInt},title:{id:7,access:"pushConfig.title"},pushContent:{id:8,access:"pushConfig.pushContent"},pushPayload:{id:9,access:"pushConfig.pushPayload"}},Ev={accid:1,serverExtension:2,createTime:{id:3,retType:"number"},updateTime:{id:4,retType:"number"}},kv={collectionId:1,collectionType:{id:2,retType:"number"},collectionData:3,serverExtension:4,uniqueId:5,createTime:{id:6,retType:"number"},updateTime:{id:7,retType:"number"}},Rv={keyword:1,beginTime:2,endTime:3,messageLimit:5,sortOrder:{id:6,converter:function converter(t){return 0===t?2:1}},p2pAccountIds:{id:7,converter:function converter(t){return t.join(",")}},teamIds:{id:8,converter:function converter(t){return t.join(",")}},senderAccountIds:{id:9,converter:function converter(t){return t.join(",")}},messageTypes:{id:10,converter:function converter(t){return t.join(",")}},messageSubtypes:{id:11,converter:function converter(t){return t.join(",")}}},Av={keywordList:{id:1,converter:function converter(t){return objectToJSONString(t)}},keywordMatchType:2,searchStartTime:3,searchTimePeriod:4,pageToken:5,limit:7,direction:8,conversationId:9,senderAccountIds:{id:12,converter:function converter(t){return t.join(",")}},messageTypes:{id:13,converter:function converter(t){return t.join(",")}},messageSubtypes:{id:14,converter:function converter(t){return t.join(",")}}},wv=Ut(Ut({},Rv),{conversationLimit:4}),Nv={v2PinMessage:{sid:33,cid:15,service:_v,params:[{type:"Property",name:"msg",reflectMapper:_h,select:["conversationType","receiverId","senderId","createTime","messageClientId","messageServerId"]},{type:"Property",name:"msgPin",reflectMapper:Ev}],response:[{type:"Long",name:"timetag"}]},v2UnpinMessage:{sid:33,cid:17,service:_v,params:[{type:"Property",name:"msg",reflectMapper:_h,select:["conversationType","receiverId","senderId","createTime","messageClientId","messageServerId"]},{type:"Property",name:"msgPin",reflectMapper:Ev}],response:[{type:"Long",name:"timetag"}]},v2UpdatePinMessage:{sid:33,cid:16,service:_v,params:[{type:"Property",name:"msg",reflectMapper:_h,select:["conversationType","receiverId","senderId","createTime","messageClientId","messageServerId"]},{type:"Property",name:"msgPin",reflectMapper:Ev}],response:[{type:"Long",name:"timetag"}]},v2GetPinMessageList:{sid:33,cid:21,service:_v,params:[{type:"Property",name:"tag",reflectMapper:{conversationId:1,timetag:2}}],response:[{type:"Long",name:"timetag"},{type:"Bool",name:"changed"},{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(Cv)}]},v2VoiceToText:{sid:29,cid:5,service:_v,params:[{type:"Property",name:"tag",reflectMapper:{mimeType:0,sampleRate:1,voiceUrl:2,duration:3}}],response:[{type:"String",name:"data"}]},v2AddQuickComment:{sid:33,cid:3,service:_v,params:[{type:"Property",name:"message",reflectMapper:_h,select:["conversationType","senderId","receiverId","createTime","messageClientId","messageServerId"]},{type:"Property",name:"quickComment",reflectMapper:bv}],response:[{type:"Long",name:"timetag"}]},v2RemoveQuickComment:{sid:33,cid:4,service:_v,params:[{type:"Property",name:"message",reflectMapper:_h,select:["conversationType","senderId","receiverId","createTime","messageClientId","messageServerId"]},{type:"Property",name:"quickComment",reflectMapper:bv}],response:[{type:"Long",name:"timetag"}]},onAddQuickComment:{sid:23,cid:5,service:_v,response:[{type:"Property",name:"message",reflectMapper:invertSerializeItem(_h)},{type:"Property",name:"quickComment",reflectMapper:invertSerializeItem(bv)}]},onRemoveQuickComment:{sid:23,cid:6,service:_v,response:[{type:"Property",name:"message",reflectMapper:invertSerializeItem(_h)},{type:"Property",name:"quickComment",reflectMapper:invertSerializeItem(bv)}]},v2GetQuickComment:{sid:33,cid:7,service:_v,params:[{type:"PropertyArray",name:"tag",reflectMapper:Tv}],response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(Tv)}]},onPinMessage:{sid:23,cid:18,service:_v,response:[{type:"Property",name:"msg",reflectMapper:invertSerializeItem(_h)},{type:"Property",name:"pinInfo",reflectMapper:invertSerializeItem(Ev)}]},onUpdatePinMessage:{sid:23,cid:19,service:_v,response:[{type:"Property",name:"msg",reflectMapper:invertSerializeItem(_h)},{type:"Property",name:"pinInfo",reflectMapper:invertSerializeItem(Ev)}]},onUnpinMessage:{sid:23,cid:20,service:_v,response:[{type:"Property",name:"msg",reflectMapper:invertSerializeItem(_h)},{type:"Property",name:"pinInfo",reflectMapper:invertSerializeItem(Ev)}]},v2AddCollection:{sid:33,cid:8,service:_v,params:[{type:"Property",name:"tag",reflectMapper:kv}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(kv)}]},v2RemoveCollections:{sid:33,cid:9,service:_v,params:[{type:"PropertyArray",name:"tag",reflectMapper:kv,select:["collectionId","createTime"]}],response:[{type:"Int",name:"data"}]},v2UpdateCollectionExtension:{sid:33,cid:10,service:_v,params:[{type:"Property",name:"tag",reflectMapper:kv}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(kv)}]},v2GetCollectionListByOption:{sid:33,cid:11,service:_v,params:[{type:"Property",name:"tag",reflectMapper:{beginTime:1,endTime:2,excludeId:3,limit:4,direction:5,collectionType:6}}],response:[{type:"Long",name:"total"},{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(kv)}]},v2SearchCloudMessagesGroupByConversation:{sid:30,cid:26,service:_v,params:[{type:"Property",name:"tag",reflectMapper:wv}],response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2SearchCloudMessages:{sid:30,cid:27,service:_v,params:[{type:"Property",name:"tag",reflectMapper:Rv}],response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(_h)}]},v2SearchCloudMessagesEx:{sid:30,cid:34,service:_v,params:[{type:"Property",name:"tag",reflectMapper:Av}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:invertSerializeItem(_h)},{type:"Int",name:"hasMore"},{type:"String",name:"nextPageToken"}]},v2GetThreadMessageList:{sid:33,cid:1,service:_v,params:[{type:"Property",name:"messageRefer",reflectMapper:_h},{type:"Property",name:"tag",reflectMapper:{beginTime:1,endTime:2,excludeMessageServerId:3,limit:4,reverse:5}}],response:[{type:"Property",name:"message",reflectMapper:invertSerializeItem(_h)},{type:"Property",name:"replyResult",reflectMapper:invertSerializeItem({total:{id:1,retType:"number"},timestamp:{id:2,retType:"number"}})},{type:"PropertyArray",name:"replyList",reflectMapper:invertSerializeItem(_h)}]}},xv=function(t){function V2NIMMessageExtendUtil(a){var u;return(u=t.call(this,"V2NIMMessageExtendUtil",a)||this).core=a,u.service=u.core.V2NIMMessageService,"v2"!==u.core.options.apiVersion?Qe(u):(registerParser({cmdMap:Sv,cmdConfig:Nv}),u)}wt(V2NIMMessageExtendUtil,t);var a=V2NIMMessageExtendUtil.prototype;return a.pinMessage=function pinMessage(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate(Om,t,"message",!0),validate(Dm,{serverExtension:a},"",!0),m.next=5,this.core.sendCmd("v2PinMessage",{msg:t,msgPin:{serverExtension:a}});case 5:u=m.sent,this.emitPinNotification({pinState:1,message:t,serverExtension:a,createTime:u.content.timetag,updateTime:u.content.timetag,operatorId:this.core.account});case 7:case"end":return m.stop()}}),_callee,this)})))},a.unpinMessage=function unpinMessage(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u;return lu.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate(Om,t,"messageRefer",!0),validate(Dm,{serverExtension:a},"",!0),m.next=5,this.core.sendCmd("v2UnpinMessage",{msg:t,msgPin:{serverExtension:a}});case 5:u=m.sent,this.emitPinNotification({pinState:0,message:t,serverExtension:a,updateTime:u.content.timetag,operatorId:this.core.account});case 7:case"end":return m.stop()}}),_callee2,this)})))},a.updatePinMessage=function updatePinMessage(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var u;return lu.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate(Om,t,"message",!0),validate(Dm,{serverExtension:a},"",!0),m.next=5,this.core.sendCmd("v2UpdatePinMessage",{msg:t,msgPin:{serverExtension:a}});case 5:u=m.sent,this.emitPinNotification({pinState:2,message:t,serverExtension:a,updateTime:u.content.timetag,operatorId:this.core.account});case 7:case"end":return m.stop()}}),_callee3,this)})))},a.getPinnedMessageList=function getPinnedMessageList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a,u,m,h,g=this;return lu.wrap((function _callee4$(M){for(;;)switch(M.prev=M.next){case 0:if(this.checkV2(),this.core.V2NIMConversationIdUtil&&this.core.V2NIMConversationIdUtil.parseConversationType){M.next=3;break}throw new Error('Service "V2NIMConversationService" does not exist');case 3:return validateConversationId(this.core.account,t),m=(m=this.core.V2NIMConversationIdUtil.convertToV1ConversationId(t)).replace("superTeam","super_team"),M.next=8,this.core.sendCmd("v2GetPinMessageList",{tag:{conversationId:m,timetag:0}});case 8:return h=M.sent,M.abrupt("return",sort(a=map$6(u=h.content.data).call(u,(function(t){return Ut(Ut({},t),{messageRefer:Ut(Ut({},t.messageRefer),{conversationId:g.core.V2NIMConversationIdUtil.messageConversationId(t.messageRefer)})})}))).call(a,(function(t,a){return a.updateTime-t.updateTime})));case 10:case"end":return M.stop()}}),_callee4,this)})))},a.addQuickComment=function addQuickComment(t,a,u,m){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var h,g;return lu.wrap((function _callee5$(M){for(;;)switch(M.prev=M.next){case 0:return this.checkV2(),validate(Gm,{message:t,index:a,serverExtension:u,pushConfig:m},"",!0),M.next=4,this.core.sendCmd("v2AddQuickComment",{message:t,quickComment:{index:a,serverExtension:u,pushConfig:m}});case 4:h=M.sent,g={operationType:1,quickComment:{messageRefer:formatMessageRefer(this.core,t),createTime:h.content.timetag,index:a,serverExtension:u||"",operatorId:this.core.account}},this.core.V2NIMMessageService.emit("onMessageQuickCommentNotification",g);case 7:case"end":return M.stop()}}),_callee5,this)})))},a.removeQuickComment=function removeQuickComment(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var m,h;return lu.wrap((function _callee6$(g){for(;;)switch(g.prev=g.next){case 0:return this.checkV2(),validate(Om,t,"messageRefer",!0),validate({index:{type:"number",min:1}},{index:a},"",!0),validate({serverExtension:{type:"string",required:!1}},{serverExtension:u},"",!0),g.next=6,this.core.sendCmd("v2RemoveQuickComment",{message:t,quickComment:{index:a,serverExtension:u}});case 6:m=g.sent,h={operationType:2,quickComment:{messageRefer:formatMessageRefer(this.core,t),createTime:m.content.timetag,index:a,serverExtension:u||"",operatorId:this.core.account}},this.core.V2NIMMessageService.emit("onMessageQuickCommentNotification",h);case 9:case"end":return g.stop()}}),_callee6,this)})))},a.getQuickCommentList=function getQuickCommentList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var a,u,m,h=this;return lu.wrap((function _callee7$(g){for(;;)switch(g.prev=g.next){case 0:return this.checkV2(),validate(Hm,{messages:t},"",!0),u={},g.next=5,this.core.sendCmd("v2GetQuickComment",{tag:map$6(t).call(t,(function(t){return{messageRefer:t}}))});case 5:return m=g.sent,forEach$1(a=m.content.data).call(a,(function(t){var a,m;try{if(!t.detail)return void(u[a=t.messageRefer.messageClientId]||(u[a]=[]));var g=JSON.parse(t.detail);u[m=t.messageRefer.messageClientId]||(u[m]=[]),forEach$1(g).call(g,(function(a){u[t.messageRefer.messageClientId].push({messageRefer:Ut(Ut({},t.messageRefer),{conversationId:h.core.V2NIMConversationIdUtil.messageConversationId(t.messageRefer)}),operatorId:a[1],index:Bu(a[2]),createTime:Bu(a[3]),serverExtension:a[4]})}))}catch(a){h.logger.error("getQuickCommentList JSON Parse Error",t.detail,a)}})),g.abrupt("return",u);case 8:case"end":return g.stop()}}),_callee7,this)})))},a.voiceToText=function voiceToText(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a,u,m,h,g,M,I,S,T,C,b;return lu.wrap((function _callee8$(E){for(;;)switch(E.prev=E.next){case 0:if(this.checkV2(),validate(Fm,t,"",!0),t.voicePath||t.voiceUrl||t.file){E.next=4;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"voiceToText: voicePath、voiceUrl、file cannot be empty at the same time"}});case 4:if(a=t.voicePath,u=t.file,m=t.mimeType,h=t.sampleRate,g=t.duration,M=t.sceneName,I=M?this.core.V2NIMStorageService.getStorageScene(M):null,S=t.voiceUrl){E.next=14;break}return T={},u?T.file=u:0===(null==a?void 0:indexOf(a).call(a,"nim-external"))?T.fileInput=a:T.filePath=a,E.next=12,this.core.cloudStorage.uploadFile(Ut({type:"audio",nosScenes:I?I.sceneName:void 0,nosSurvivalTime:I?I.expireTime:void 0},T));case 12:C=E.sent,S=C.url;case 14:return E.next=16,this.core.sendCmd("v2VoiceToText",{tag:{voiceUrl:S,mimeType:m,sampleRate:h,duration:g}},{timeout:3e4});case 16:return b=E.sent,E.abrupt("return",b.content.data);case 18:case"end":return E.stop()}}),_callee8,this)})))},a.onPinMessageHandler=function onPinMessageHandler(t){return this.pinMessageChangeHandler(t,1)},a.onUnpinMessageHandler=function onUnpinMessageHandler(t){return this.pinMessageChangeHandler(t,0)},a.onUpdatePinMessageHandler=function onUpdatePinMessageHandler(t){return this.pinMessageChangeHandler(t,2)},a.pinMessageChangeHandler=function pinMessageChangeHandler(t,a){var u=t.content.msg,m=t.content.pinInfo;u.conversationId=this.core.V2NIMConversationIdUtil.messageConversationId(u),this.emitPinNotification({pinState:a,message:u,serverExtension:m.serverExtension,createTime:m.createTime,updateTime:m.updateTime,operatorId:m.accid})},a.emitPinNotification=function emitPinNotification(t){var a={pinState:t.pinState,pin:Ut(Ut({serverExtension:t.serverExtension||"",operatorId:t.operatorId},t.createTime?{createTime:t.createTime}:{}),{updateTime:t.updateTime,messageRefer:formatMessageRefer(this.core,t.message)})};this.core.V2NIMMessageService.emit("onMessagePinNotification",a)},a.onAddQuickCommentHandler=function onAddQuickCommentHandler(t){return this.onQuickCommentNotificationHandler(t,1)},a.onRemoveQuickCommentHandler=function onRemoveQuickCommentHandler(t){return this.onQuickCommentNotificationHandler(t,2)},a.onQuickCommentNotificationHandler=function onQuickCommentNotificationHandler(t,a){var u={operationType:a,quickComment:Ut({messageRefer:Ut(Ut({},t.content.message),{conversationId:this.core.V2NIMConversationIdUtil.messageConversationId(t.content.message)})},t.content.quickComment)};this.core.V2NIMMessageService.emit("onMessageQuickCommentNotification",u)},a.addCollection=function addCollection(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var a;return lu.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),validate(jm,{params:t},"",!0),u.next=4,this.core.sendCmd("v2AddCollection",{tag:t});case 4:return a=u.sent,u.abrupt("return",a.content.data);case 6:case"end":return u.stop()}}),_callee9,this)})))},a.removeCollections=function removeCollections(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){var a;return lu.wrap((function _callee10$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),validate($m,{collections:t},"",!0),u.next=4,this.core.sendCmd("v2RemoveCollections",{tag:t});case 4:return a=u.sent,u.abrupt("return",a.content.data);case 6:case"end":return u.stop()}}),_callee10,this)})))},a.updateCollectionExtension=function updateCollectionExtension(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){var u;return lu.wrap((function _callee11$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate(zm,{collection:t,serverExtension:a},"",!0),m.next=4,this.core.sendCmd("v2UpdateCollectionExtension",{tag:Ut(Ut({},t),{serverExtension:a})});case 4:return u=m.sent,m.abrupt("return",u.content.data);case 6:case"end":return m.stop()}}),_callee11,this)})))},a.getCollectionListByOption=function getCollectionListByOption(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){var a;return lu.wrap((function _callee12$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),validate(Wm,t,"",!0),u.next=4,this.getCollectionListExByOption(t);case 4:return a=u.sent,u.abrupt("return",a.collectionList);case 6:case"end":return u.stop()}}),_callee12,this)})))},a.getCollectionListExByOption=function getCollectionListExByOption(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){var m,h,g,M,I;return lu.wrap((function _callee13$(S){for(;;)switch(S.prev=S.next){case 0:if(this.checkV2(),validate(Wm,t,"",!0),m=t.beginTime||0,h=t.endTime||0,g=void 0===t.direction?0:t.direction,void 0===(null===(a=t.anchorCollection)||void 0===a?void 0:a.collectionId)){S.next=21;break}if(0!==t.direction){S.next=15;break}if(0!==h){S.next=11;break}h=t.anchorCollection.createTime,S.next=13;break;case 11:if(h===t.anchorCollection.createTime){S.next=13;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getCollectionListExByOption: When providing anchorCollection, when sorting in descending order, endTime does not need to be provided, or endTime should be equal to anchorCollection.createTime"}});case 13:S.next=21;break;case 15:if(0!==m){S.next=19;break}m=t.anchorCollection.createTime,S.next=21;break;case 19:if(m===t.anchorCollection.createTime){S.next=21;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getCollectionListExByOption: When providing anchorCollection, when sorting in ascending order, there is no need to provide beginTime, or beginTime should be equal to anchorCollection.createTime"}});case 21:if(!(0!==m&&0!==h&&m>=h)){S.next=23;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getCollectionListExByOption: beginTime cannot be greater than endTime"}});case 23:return(M={beginTime:m,endTime:h,direction:g,limit:t.limit,collectionType:t.collectionType,excludeId:(null===(u=t.anchorCollection)||void 0===u?void 0:u.collectionId)?t.anchorCollection.collectionId:0}).collectionType||delete M.collectionType,S.next=27,this.core.sendCmd("v2GetCollectionListByOption",{tag:M});case 27:return I=S.sent,S.abrupt("return",{totalCount:I.content.total,collectionList:I.content.data});case 29:case"end":return S.stop()}}),_callee13,this)})))},a.searchCloudMessages=function searchCloudMessages(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){var a,u,m,h,g,M,I,S,T=this;return lu.wrap((function _callee14$(C){for(;;)switch(C.prev=C.next){case 0:if(this.checkV2(),validate(Km,t,"",!0),u=t.beginTime||0,m=t.endTime||0,!(0!==u&&0!==m&&u>m)){C.next=6;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"searchCloudMessages: beginTime cannot be greater than endTime"}});case 6:return h=void 0===t.sortOrder?0:t.sortOrder,g=t.conversationLimit||0,M=t.messageLimit||10,I=g>0?"v2SearchCloudMessagesGroupByConversation":"v2SearchCloudMessages",C.next=12,this.core.sendCmd(I,{tag:Ut(Ut({},t),{beginTime:u,endTime:m,sortOrder:h,conversationLimit:g,messageLimit:M})});case 12:return S=C.sent,C.abrupt("return",this.service._filterMessagesByFn(map$6(a=S.content.data).call(a,(function(t){return completeMessage(T.core,t)}))));case 14:case"end":return C.stop()}}),_callee14,this)})))},a.searchCloudMessagesEx=function searchCloudMessagesEx(t){var a,u,m;return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){var h,g,M,I,S,T,C,b=this;return lu.wrap((function _callee15$(E){for(;;)switch(E.prev=E.next){case 0:if(this.checkV2(),validate(Ym,t,"",!0),t.conversationId&&validateConversationId(this.core.account,t.conversationId),(null===(a=t.keywordList)||void 0===a?void 0:a.length)||(null===(u=t.senderAccountIds)||void 0===u?void 0:u.length)||(null===(m=t.messageTypes)||void 0===m?void 0:m.length)){E.next=5;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"searchCloudMessagesEx: keywordList senderAccountIds messageTypes cannot be empty at the same time"}});case 5:return 0===t.searchTimePeriod&&delete t.searchTimePeriod,E.next=8,this.core.sendCmd("v2SearchCloudMessagesEx",{tag:Ut({},t)});case 8:return h=E.sent,g=h.content,M=g.msgs,I=g.hasMore,S=g.nextPageToken,T=this.service._filterMessagesByFn(map$6(M).call(M,(function(t){return completeMessage(b.core,t)}))),C=sort(T).call(T,(function(t,a){return a.createTime-t.createTime})),E.abrupt("return",{count:M.length,items:formatSearchCloudMessageListEx(this.core,C),hasMore:intToBool(I),nextPageToken:S});case 13:case"end":return E.stop()}}),_callee15,this)})))},a.getThreadMessageList=function getThreadMessageList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var a,u,m,h,g,M,I,S=this;return lu.wrap((function _callee16$(T){for(;;)switch(T.prev=T.next){case 0:if(validate(rh,t,"getThreadMessageList",!0),t.beginTime=t.beginTime||0,!(t.endTime&&t.beginTime>t.endTime)){T.next=4;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"getThreadMessageList: beginTime cannot be greater than endTime"}});case 4:return T.next=6,this.core.sendCmd("v2GetThreadMessageList",{messageRefer:t.messageRefer,tag:{beginTime:t.beginTime,endTime:t.endTime,limit:t.limit,reverse:1===t.direction?1:0,excludeMessageServerId:t.excludeMessageServerId}});case 6:return a=T.sent,u=a.content,m=u.message,h=u.replyResult,g=u.replyList,M=completeMessage(this.core,m),I=map$6(g).call(g,(function(t){return completeMessage(S.core,t)})),I=this.service._filterMessagesByFn(I),I=this.service._filterMessageByClearTime(M.conversationId,I),T.abrupt("return",{message:M,timestamp:h.timestamp,replyCount:h.total,replyList:I});case 13:case"end":return T.stop()}}),_callee16,this)})))},V2NIMMessageExtendUtil}(gp),Ov={joinMode:{type:"enum",values:[1,0,2],required:!1},agreeMode:{type:"enum",values:[0,1],required:!1},inviteMode:{type:"enum",values:[1,0],required:!1},updateInfoMode:{type:"enum",values:[1,0],required:!1},updateExtensionMode:{type:"enum",values:[1,0],required:!1},chatBannedMode:{type:"enum",values:[0,1],required:!1}},Pv={type:"object",required:!0,rules:Ut({name:{type:"string",allowEmpty:!1},teamType:{type:"enum",values:[1,2]},memberLimit:{type:"number",min:1,required:!1}},Ov)},Lv={type:"array",min:1,itemType:"string"},Vv={type:"boolean"},Uv={type:"string"},Dv={type:"string",allowEmpty:!1},qv={type:"object",rules:{antispamBusinessId:{type:"string",required:!1}},required:!1},Bv={teamId:{type:"string",regExp:/^[1-9]\d*$/,allowEmpty:!1}},Fv={teamIds:{type:"array",itemRules:{type:"string",allowEmpty:!1,regExp:/^[1-9]\d*$/},min:1}},Gv={teamType:{type:"enum",values:[1,2]}},Hv={teamTypes:{type:"array",itemType:"enum",values:[1,2],required:!1}},jv={inviteeParams:{type:"object",required:!0,rules:{inviteeAccountIds:Lv,postscript:Ut(Ut({},Uv),{required:!1}),serverExtension:Ut(Ut({},Uv),{required:!1})}}},$v={updateTeamInfoParams:{type:"object",required:!0,rules:Ut({name:{type:"string",allowEmpty:!1,required:!1},memberLimit:{type:"number",min:1,required:!1}},Ov)}},zv={type:"enum",values:[0,2]},Wv={memberInfoParams:{type:"object",rules:{teamNick:{type:"string",required:!1},serverExtension:{type:"string",required:!1},antispamConfig:{type:"object",required:!1,rules:{antispamBusinessId:{type:"string",required:!1}}}}}},Kv={chatBannedMode:{type:"enum",values:[0,1]}},Yv={queryOption:{type:"object",rules:{roleQueryType:{type:"enum",values:[0,2,1]},onlyChatBanned:{type:"boolean",required:!1},direction:{type:"enum",values:[1,0],required:!1},limit:{type:"number",min:1,required:!1},nextToken:{type:"string",required:!1}}}},Qv={teamId:Bv.teamId,teamType:{type:"enum",values:[1,2]},operatorAccountId:{type:"string",allowEmpty:!1}},Jv={actionType:{type:"enum",values:[2,0,1,3]}},Xv={actionType:{type:"enum",values:[2]}},Zv={actionType:{type:"enum",values:[0]}},ef={types:{type:"array",itemType:"enum",values:[0,2,1,3],required:!1},status:{type:"array",itemType:"enum",values:[1,3,0,2],required:!1},offset:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1}},tf={teamId:Bv.teamId,teamType:Gv.teamType,accountIds:Lv},rf={accountId:{type:"string",allowEmpty:!1},teamNick:{type:"string"},antispamConfig:{type:"object",required:!1,rules:{antispamBusinessId:{type:"string",required:!1}}}},nf=function(){function V2NIMTeamModelImpl(){this.teamMap=new _c,this.superTeamMap=new _c}var t=V2NIMTeamModelImpl.prototype;return t.set=function set(t){var a=this;forEach$1(t).call(t,(function(t){a.chooseMap(t.teamType).set(t.teamId,t)}))},t.reset=function reset(){this.teamMap.clear(),this.superTeamMap.clear()},t.count=function count(t,a){void 0===a&&(a=!0);var u=this.chooseMap(t),count=0;return forEach$1(u).call(u,(function(t){a&&t.isValidTeam&&count++,a||count++})),count},t.chooseMap=function chooseMap(t){return 2===t?this.superTeamMap:1===t?this.teamMap:new _c},t.getById=function getById(t,a,u){void 0===u&&(u=!0);var m=this.chooseMap(a).get(t);if(m){if(u&&m.isValidTeam)return m;if(!u)return m}},t.getAll=function getAll(t,a){void 0===a&&(a=!0);var u=this.chooseMap(t),m=nu(values(u).call(u)),h=filter(m).call(m,(function(t){return!(!a||!t.isValidTeam)||(!a||void 0)}));return sort(h).call(h,(function(t,a){return a.updateTime-t.updateTime}))},t.upsert=function upsert(t){var a=t.teamId,u=t.teamType,m=this.chooseMap(u),h=m.get(a)||{},g=Ut({},h,t);return m.set(a,g),g},t.deleteById=function deleteById(t,a){var u=this.getById(t,a);if(u)return u.isValidTeam=!1,u},t.searchTeamByKeyword=function searchTeamByKeyword(t){var a,u,m=[];return forEach$1(a=this.teamMap).call(a,(function(a){var u;includes(u=a.name).call(u,t)&&m.push(a)})),forEach$1(u=this.superTeamMap).call(u,(function(a){var u;includes(u=a.name).call(u,t)&&m.push(a)})),m},V2NIMTeamModelImpl}(),af=function(){function V2NIMTeamMemberModelImpl(){this.teamMembers=[],this.superTeamMembers=[],this.maxSize=2e3}var t=V2NIMTeamMemberModelImpl.prototype;return t.reset=function reset(){this.teamMembers=[],this.superTeamMembers=[]},t.setData=function setData(t){var a=this;forEach$1(t).call(t,(function(t){a.chooseList(t.teamType).push(t)}))},t.chooseList=function chooseList(t){return 2===t?this.superTeamMembers:1===t?this.teamMembers:[]},t.getById=function getById(t,a,u){var m=this.chooseList(a);return find(m).call(m,(function(a){return a.teamId===t&&a.accountId===u}))},t.upsert=function upsert(t){var a=t.teamType,u=t.teamId,m=this.chooseList(a),h=findIndex$1(m).call(m,(function(a){return a.teamId===u&&a.accountId===t.accountId}));-1===h?m.push(t):m[h]=Ut(Ut({},m[h]),t),m.length>this.maxSize&&m.shift()},t.deleteByAccount=function deleteByAccount(t,a,u){var m=this.chooseList(a),h=findIndex$1(m).call(m,(function(a){return a.teamId===t&&a.accountId===u}));if(-1!==h){var g=m[h];return g.inTeam=!1,splice(m).call(m,h,1),g}},t.deleteByTeamId=function deleteByTeamId(t,a){var u=this.chooseList(a),m=filter(u).call(u,(function(a){return a.teamId!==t}));2===a?this.superTeamMembers=m:this.teamMembers=m},V2NIMTeamMemberModelImpl}(),sf=function(){function V2NIMTeamNotificationImpl(t,a){this.core=t,this.service=a}var t=V2NIMTeamNotificationImpl.prototype;return t.processNotification=function processNotification(t){var a=this,u=t.attachment,m=t.senderId,h=t.receiverId,g=t.createTime,M=u.id,I=u.data,S=M>400?2:1,T=formatTeamNotificationAttachData(I,S),C=T.id,b=T.ids,E=T.tinfo,k=T.mute,R=this.service.model.getById(h,S);switch(this.core.logger.log("v2Team::processNotification, notificationType:"+M+", teamId:"+h,I),M){case iv.SUPER_TEAM_INVITATION:case iv.TEAM_INVITATION:includes(b).call(b,this.core.account)&&this.onTeamJoined(E),this.onTeamMembersJoined(E,filter(b).call(b,(function(t){return t!==a.core.account})));break;case iv.SUPER_TEAM_INVITE_ACCEPT:case iv.TEAM_INVITE_ACCEPT:m===this.core.account?this.onTeamJoined(E):this.onTeamMemberJoined(E,m);break;case iv.SUPER_TEAM_APPLY_ACCEPT:case iv.TEAM_APPLY_ACCEPT:C===this.core.account?this.onTeamJoined(E):this.onTeamMemberJoined(E,C);break;case iv.SUPER_TEAM_ADD_MANAGER:case iv.TEAM_ADD_MANAGER:this.updateTeamMemberRole(h,S,b,{memberRole:2,updateTime:g});break;case iv.SUPER_TEAM_REMOVE_MANAGER:case iv.TEAM_REMOVE_MANAGER:this.updateTeamMemberRole(h,S,b,{memberRole:0,updateTime:g});break;case iv.SUPER_TEAM_KICK:case iv.TEAM_KICK:this.onTeamInfoUpdated(E),forEach$1(b).call(b,(function(t){t===a.core.account?a.onTeamLeft(h,S,!0):a.onTeamMemberKicked(m,E.teamId,E.teamType,t)}));break;case iv.SUPER_TEAM_LEAVE:case iv.TEAM_LEAVE:E?this.onTeamInfoUpdated(E):R&&m===this.core.account&&(R.isValidTeam=!1,this.onTeamInfoUpdated(R)),m===this.core.account?this.onTeamLeft(h,S,!1):this.onTeamMemberLeft(h,S,m);break;case iv.SUPER_TEAM_DISMISS:case iv.TEAM_DISMISS:this.onTeamDismissed(h,S);break;case iv.SUPER_TEAM_UPDATE:case iv.TEAM_UPDATED:this.onTeamInfoUpdated(E);break;case iv.SUPER_TEAM_TRANSFER_OWNER:case iv.TEAM_TRANSFER_OWNER:this.onTeamInfoUpdated(E),this.updateTeamMemberRole(h,S,[m,E.ownerAccountId],[{memberRole:0,updateTime:g},{memberRole:1,updateTime:g,joinTime:g}],!1);break;case iv.SUPER_TEAM_MEMBER_MUTE:case iv.TEAM_MEMBER_MUTE:this.service.model.upsert(E),this.updateTeamMemberRole(h,S,C?[C]:b,{chatBanned:0!==k,updateTime:g})}},t.onTeamJoined=function onTeamJoined(t){var a=this;this.service.model.upsert(t),this.service.emit("onTeamJoined",t),this.service.getTeamMemberListByIds(t.teamId,t.teamType,[this.core.account]).catch((function(t){a.core.logger.error("Get Member error after onTeamJoined",t)}))},t.onTeamLeft=function onTeamLeft(t,a,u){var m=this.service.model.deleteById(t,a)||generateTeamByTeamId(t,a,{isValidTeam:!1});this.service.memberModel.deleteByAccount(t,a,this.core.account),this.service.emit("onTeamLeft",m,u)},t.onTeamDismissed=function onTeamDismissed(t,a){var u=this.service.model.deleteById(t,a);u||(u=generateTeamByTeamId(t,a,{isValidTeam:!1})),this.service.memberModel.deleteByTeamId(t,a),this.service.emit("onTeamDismissed",u)},t.onTeamInfoUpdated=function onTeamInfoUpdated(t){var a=this.service.model.upsert(t);this.service.emit("onTeamInfoUpdated",a)},t.onTeamMemberJoined=function onTeamMemberJoined(t,a){this.service.model.upsert(t),this.service.emit("onTeamInfoUpdated",t);var u=t.updateTime||t.createTime,m=generateMemberByTeamId(t.teamId,t.teamType,a,{joinTime:u,updateTime:u});this.service.emit("onTeamMemberJoined",[m])},t.onTeamMembersJoined=function onTeamMembersJoined(t,a){var u=t.updateTime||t.createTime,m=map$6(a).call(a,(function(a){return generateMemberByTeamId(t.teamId,t.teamType,a,{joinTime:u,updateTime:u})}));0!==m.length&&(this.service.model.upsert(t),this.service.emit("onTeamInfoUpdated",t),this.service.emit("onTeamMemberJoined",m))},t.onTeamMemberLeft=function onTeamMemberLeft(t,a,u){var m=this.service.memberModel.deleteByAccount(t,a,u);m||(m=generateMemberByTeamId(t,a,u,{inTeam:!1})),this.service.emit("onTeamMemberLeft",[m])},t.onTeamMemberKicked=function onTeamMemberKicked(t,a,u,m){var h=this.service.memberModel.deleteByAccount(a,u,m);h||(h=generateMemberByTeamId(a,u,m,{inTeam:!1})),this.service.emit("onTeamMemberKicked",t,[h])},t.onTeamMemberInfoUpdated=function onTeamMemberInfoUpdated(t){var a=this;forEach$1(t).call(t,(function(t){if(t.accountId===a.core.account&&a.core.V2NIMSettingService.name&&a.core.V2NIMConversationIdUtil.name){var u=1===t.teamType?a.core.V2NIMConversationIdUtil.teamConversationId(t.teamId):a.core.V2NIMConversationIdUtil.superTeamConversationId(t.teamId),m=a.core.V2NIMSettingService.getConversationMuteStatus(u);a.core.eventBus.emit("V2NIMSettingService/setMute",u,m)}})),this.service.emit("onTeamMemberInfoUpdated",t)},t.updateTeamMemberRole=function updateTeamMemberRole(t,a,u,m,h){return void 0===h&&(h=!0),__awaiter(this,void 0,void 0,lu.mark((function _callee(){var g,M,I,S,T=this;return lu.wrap((function _callee$(C){for(;;)switch(C.prev=C.next){case 0:if(M=filter(u).call(u,(function(u,h){var g=T.service.memberModel.getById(t,a,u);return g&&T.service.memberModel.upsert(Ut(Ut({},g),Un(m)?m[h]:m)),!g})),!(h&&M.length>0)){C.next=12;break}return C.prev=2,C.next=5,this.service.getTeamMemberListByIds(t,a,M);case 5:I=C.sent,forEach$1(I).call(I,(function(t){return T.service.memberModel.upsert(t)})),C.next=12;break;case 9:C.prev=9,C.t0=C.catch(2),this.core.logger.warn("v2Team::processNotification, getTeamMemberListByIds failed",C.t0);case 12:(S=filter(g=map$6(u).call(u,(function(u,g){var M=T.service.memberModel.getById(t,a,u);return M||h?M:generateMemberByTeamId(t,a,u,Un(m)?m[g]:m)}))).call(g,(function(t){return!!t}))).length>0&&this.onTeamMemberInfoUpdated(S);case 14:case"end":return C.stop()}}),_callee,this,[[2,9]])})))},t.processSysNotification=function processSysNotification(t){var a=t.receiverId,u=t.postscript,m=t.senderId,h=t.timestamp,g=t.content,M={};try{M=JSON.parse(g)}catch(t){this.core.logger.warn("v2Team::processSysNotification, parse content failed",g)}var I={actionType:{0:0,1:1,2:2,3:3,15:0,16:1,17:2,18:3}[t.type],teamId:a,teamType:t.type>=15?2:1,operatorAccountId:m,postscript:u,timestamp:h,actionStatus:0,read:!1};M.attach&&(I.serverExtension=M.attach),this.core.logger.log("v2Team::processSysNotification, type:",t.type,I),this.service.notificationModel.create(I),this.service.emit("onReceiveTeamJoinActionInfo",I)},t.updateTeamActionStatus=function updateTeamActionStatus(t,a){this.service.notificationModel.update({teamId:t.teamId,teamType:t.teamType,operatorAccountId:t.operatorAccountId,actionType:t.actionType,actionStatus:a})},t.checkIfExpired=function checkIfExpired(t){return!!t&&(509===t||!(t>=500&&t<=599)&&!(t>=19e4))},V2NIMTeamNotificationImpl}();function _createForOfIteratorHelperLoose$7(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$7(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$7(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$7(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$7(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}!function(t){t[t.TEAM_INVITATION=0]="TEAM_INVITATION",t[t.TEAM_KICK=1]="TEAM_KICK",t[t.TEAM_LEAVE=2]="TEAM_LEAVE",t[t.TEAM_UPDATED=3]="TEAM_UPDATED",t[t.TEAM_DISMISS=4]="TEAM_DISMISS",t[t.TEAM_APPLY_ACCEPT=5]="TEAM_APPLY_ACCEPT",t[t.TEAM_TRANSFER_OWNER=6]="TEAM_TRANSFER_OWNER",t[t.TEAM_ADD_MANAGER=7]="TEAM_ADD_MANAGER",t[t.TEAM_REMOVE_MANAGER=8]="TEAM_REMOVE_MANAGER",t[t.TEAM_INVITE_ACCEPT=9]="TEAM_INVITE_ACCEPT",t[t.TEAM_MEMBER_MUTE=10]="TEAM_MEMBER_MUTE",t[t.SUPER_TEAM_INVITATION=401]="SUPER_TEAM_INVITATION",t[t.SUPER_TEAM_KICK=402]="SUPER_TEAM_KICK",t[t.SUPER_TEAM_LEAVE=403]="SUPER_TEAM_LEAVE",t[t.SUPER_TEAM_UPDATE=404]="SUPER_TEAM_UPDATE",t[t.SUPER_TEAM_DISMISS=405]="SUPER_TEAM_DISMISS",t[t.SUPER_TEAM_TRANSFER_OWNER=406]="SUPER_TEAM_TRANSFER_OWNER",t[t.SUPER_TEAM_ADD_MANAGER=407]="SUPER_TEAM_ADD_MANAGER",t[t.SUPER_TEAM_REMOVE_MANAGER=408]="SUPER_TEAM_REMOVE_MANAGER",t[t.SUPER_TEAM_MEMBER_MUTE=409]="SUPER_TEAM_MEMBER_MUTE",t[t.SUPER_TEAM_APPLY_ACCEPT=410]="SUPER_TEAM_APPLY_ACCEPT",t[t.SUPER_TEAM_INVITE_ACCEPT=411]="SUPER_TEAM_INVITE_ACCEPT"}(iv||(iv={}));var cf=function(){function V2NIMTeamNotificationModelImpl(){this.list=[],this.maxCount=1e3}var t=V2NIMTeamNotificationModelImpl.prototype;return t.reset=function reset(){this.list=[]},t.checkSameAction=function checkSameAction(t,a,u){return void 0===u&&(u=!1),t.teamId===a.teamId&&t.teamType===a.teamType&&t.actionType===a.actionType&&t.operatorAccountId===a.operatorAccountId&&(!u||t.timestamp===a.timestamp)},t.create=function create(t){this.list.push(t),this.list.length>this.maxCount&&this.list.shift()},t.update=function update(t){var a,u=this;forEach$1(a=this.list).call(a,(function(a){u.checkSameAction(a,t)&&0===a.actionStatus&&Ut(a,t)}))},t.delete=function _delete(t){var a,u,m=this;this.list=filter(a=map$6(u=this.list).call(u,(function(a){if(!m.checkSameAction(a,t,!1))return a}))).call(a,(function(t){return t}))},t.getByOption=function getByOption(t){var a,u=t.types,m=t.status,h=t.offset,g=void 0===h?0:h,M=t.limit,I=void 0===M?50:M,S=[];forEach$1(a=this.list).call(a,(function(t){u&&u.length>0&&!includes(u).call(u,t.actionType)||m&&m.length>0&&!includes(m).call(m,t.actionStatus)||S.push(t)})),S=sort(S).call(S,(function(t,a){return a.timestamp-t.timestamp}));var T=0;g>0&&(T=findIndexWithinTargetValue(S,"timestamp",g),S[T]&&S[T].timestamp===g&&(T+=1));var C=slice(S).call(S,T).length;return(S=slice(S).call(S,T,T+I)).length>0?{offset:C>I?S[S.length-1].timestamp:0,finished:!(C>I),infos:S}:{offset:0,finished:!0,infos:S}},t.setRead=function setRead(t){for(var a,u=_createForOfIteratorHelperLoose$7(this.list);!(a=u()).done;){var m=a.value;this.checkSameAction(m,t)&&(m.read=!0)}},t.setAllRead=function setAllRead(){for(var t,a=_createForOfIteratorHelperLoose$7(this.list);!(t=a()).done;){t.value.read=!0}},t.getUnreadCount=function getUnreadCount(){for(var t,a=new qg,u=_createForOfIteratorHelperLoose$7(this.list);!(t=u()).done;){var m=t.value;m.read||0!==m.actionStatus||0!==m.actionType&&2!==m.actionType||a.add(m.operatorAccountId+"_"+m.teamType+"_"+m.teamId)}return a.size},V2NIMTeamNotificationModelImpl}(),lf=function(){function V2NIMTeamEventImpl(t,a){this.core=t,this.service=a,this.model=a.model,this.memberModel=a.memberModel,this.notification=a.notification,this.logger=this.core.logger}var t=V2NIMTeamEventImpl.prototype;return t.setListener=function setListener(){var t,a,u,m=this;this.core.eventBus.on("V2NIMTeamService/onSyncStarted",(function(){m.service.emit("onSyncStarted")})),this.core.eventBus.on("V2NIMTeamService/onSyncFinished",(function(){m.service.emit("onSyncFinished")})),this.core.eventBus.on("V2NIMTeamService/onSyncFailed",(function(t){m.service.emit("onSyncFailed",t)})),this.core.eventBus.on("forwardReceive/V2NIMTeamService/created",(function(t){m.model.upsert(t);var a=generateMemberByTeamId(t.teamId,t.teamType,m.core.account,{memberRole:1});m.memberModel.upsert(a),m.service.emit("onTeamCreated",t)})),this.core.eventBus.on("forwardReceive/V2NIMTeamService/updateSelfTeamMemberInfo",(function(t){m.memberModel.upsert(t),m.service.emit("onTeamInfoUpdated",[t])})),this.core.eventBus.on("forwardReceive/V2NIMTeamService/updateTeamActionStatus",bind$1(t=this.notification.updateTeamActionStatus).call(t,this.notification)),this.core.eventBus.on("V2NIMTeamService/sysNotification",bind$1(a=this.notification.processSysNotification).call(a,this.notification)),this.core.eventBus.on("V2NIMTeamService/notification",bind$1(u=this.notification.processNotification).call(u,this.notification))},t.beforeEmit=function beforeEmit(t){for(var a=this.service.name+"::emit "+t.toString(),u=arguments.length,m=new Array(u>1?u-1:0),h=1;h<u;h++)m[h-1]=arguments[h];if("onTeamCreated"===t||"onTeamDismissed"===t||"onTeamJoined"===t||"onTeamLeft"===t||"onTeamInfoUpdated"===t){var g=m[0];this.logger.log(""+a,"team:"+g.teamId+"_"+g.teamType+";updateTime:"+g.updateTime)}else if("onTeamMemberJoined"===t||"onTeamMemberLeft"===t||"onTeamMemberInfoUpdated"===t){var M=m[0];this.logger.log(""+a,map$6(M).call(M,(function(t){return"team:"+t.teamId+"_"+t.teamType+";account:"+t.accountId})))}else if("onTeamMemberKicked"===t){var I=m[0],S=m[1];this.logger.log(""+a,"operator"+I,map$6(S).call(S,(function(t){return"team:"+t.teamId+"_"+t.teamType+";account:"+t.accountId})))}else{var T,C;(T=this.logger).log.apply(T,concat(C=[""+a]).call(C,m))}},t.onSyncDone=function onSyncDone(t){t?this.service.emit("onSyncFailed",t):this.service.emit("onSyncFinished")},V2NIMTeamEventImpl}(),uf=function(){function V2NIMTeamHandlerImpl(t,a){this.core=t,this.service=a,this.model=a.model,this.memberModel=a.memberModel,this.logger=this.core.logger}var t=V2NIMTeamHandlerImpl.prototype;return t.v2TeamSyncHandler=function v2TeamSyncHandler(t){this.model.set(t.content.datas)},t.v2SuperTeamSyncHandler=function v2SuperTeamSyncHandler(t){this.model.set(t.content.datas)},t.v2TeamCreateMultiSyncHandler=function v2TeamCreateMultiSyncHandler(t){var a=t.content.data;this.model.upsert(a);var u=generateMemberByTeamId(a.teamId,a.teamType,this.core.account,{memberRole:1});this.memberModel.upsert(u),this.service.emit("onTeamCreated",a)},t.v2SuperTeamCreateMultiSyncHandler=function v2SuperTeamCreateMultiSyncHandler(t){var a=t.content.data;this.model.upsert(a);var u=generateMemberByTeamId(a.teamId,a.teamType,this.core.account,{memberRole:1});this.memberModel.upsert(u),this.service.emit("onTeamCreated",a)},t.v2TeamMemberUpdateMultiSyncHandler=function v2TeamMemberUpdateMultiSyncHandler(t){var a=t.content.data;a.teamType=1;var u=this.memberModel.getById(a.teamId,a.teamType,a.accountId);this.service.notification.updateTeamMemberRole(a.teamId,a.teamType,[a.accountId],a),a.accountId===this.core.account&&u&&u.bits!==a.bits&&this.core.eventBus.emit("V2NIMSettingService/updateBits",a.teamId,a.teamType,a.bits)},t.v2SuperTeamMemberUpdateMultiSyncHandler=function v2SuperTeamMemberUpdateMultiSyncHandler(t){var a=t.content.data;a.teamType=2;var u=this.memberModel.getById(a.teamId,a.teamType,a.accountId);this.service.notification.updateTeamMemberRole(a.teamId,a.teamType,[a.accountId],a),a.accountId===this.core.account&&u&&u.bits!==a.bits&&this.core.eventBus.emit("V2NIMSettingService/updateBits",a.teamId,a.teamType,a.bits)},t.v2TeamMembersOfSelfInSyncHandler=function v2TeamMembersOfSelfInSyncHandler(t){var a=this,u=t.content.datas;forEach$1(u).call(u,(function(t){t.teamType=1,a.memberModel.upsert(t)}))},t.v2SuperTeamMembersOfSelfInSyncHandler=function v2SuperTeamMembersOfSelfInSyncHandler(t){var a=this,u=t.content.datas;forEach$1(u).call(u,(function(t){t.teamType=2,a.memberModel.upsert(t)}))},V2NIMTeamHandlerImpl}(),df=function(t){function V2NIMTeamServiceImpl(a){var u;return(u=t.call(this,"V2NIMTeamService",a)||this).core._registerDep(gm,"V2NIMConversationIdUtil"),u.model=new nf,u.memberModel=new af,u.notificationModel=new cf,u.notification=new sf(a,Qe(u)),u.event=new lf(a,Qe(u)),u.handler=new uf(a,Qe(u)),"v2"!==u.core.options.apiVersion?Qe(u):(registerParser({cmdMap:lh,cmdConfig:fh}),u.setListener(),u)}wt(V2NIMTeamServiceImpl,t);var a=V2NIMTeamServiceImpl.prototype;return a.setListener=function setListener(){this.event.setListener()},a.reset=function reset(){this.model.reset(),this.memberModel.reset(),this.notificationModel.reset()},a.emit=function emit(a){for(var u,m,h,g,M=arguments.length,I=new Array(M>1?M-1:0),S=1;S<M;S++)I[S-1]=arguments[S];return(u=this.event).beforeEmit.apply(u,concat(m=[a]).call(m,I)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,I))},a.createTeam=function createTeam(t,a,u,m){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var h,g,M,I=this;return lu.wrap((function _callee$(S){for(;;)switch(S.prev=S.next){case 0:return this.checkV2(),validate({createTeamParams:Pv},{createTeamParams:t},"",!0),validate({inviteeAccountIds:Ut(Ut({},Lv),{min:0,required:!1})},{inviteeAccountIds:a},"",!0),validate({antispamConfig:qv},{antispamConfig:m},"",!0),h=2===t.teamType?"v2SuperTeamCreate":"v2TeamCreate",S.next=7,this.core.sendCmd(h,{team:t,inviteeAccountIds:a||[],postscript:u||"",antispamConfig:m});case 7:return g=S.sent,M=g.content.team,this.model.upsert(M),this.getTeamMemberListByIds(M.teamId,M.teamType,[this.core.account]).catch((function(t){I.core.logger.error("Get Member error after createTeam",t)})),this.emit("onTeamCreated",M),S.abrupt("return",{team:M,failedList:g.content.failedList});case 13:case"end":return S.stop()}}),_callee,this)})))},a.updateTeamInfo=function updateTeamInfo(t,a,u,m){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var h,g;return lu.wrap((function _callee2$(M){for(;;)switch(M.prev=M.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate($v,{updateTeamInfoParams:u},"",!0),validate({antispamConfig:qv},{antispamConfig:m},"",!0),h=Ut({teamId:t,teamType:a},u),g=2===a?"v2SuperTeamUpdateInfo":"v2TeamUpdateInfo",M.next=9,this.core.sendCmd(g,{team:h,antispamConfig:m});case 9:this.model.upsert(h);case 10:case"end":return M.stop()}}),_callee2,this)})))},a.leaveTeam=function leaveTeam(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var u;return lu.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),u=2===a?"v2SuperTeamLeave":"v2TeamLeave",m.next=6,this.core.sendCmd(u,{teamId:t});case 6:this.model.deleteById(t,a);case 7:case"end":return m.stop()}}),_callee3,this)})))},a.getTeamInfo=function getTeamInfo(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var u,m,h,g;return lu.wrap((function _callee4$(M){for(;;)switch(M.prev=M.next){case 0:if(this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),u=2===a?"v2SuperTeamGetInfo":"v2TeamGetInfo",!(m=this.model.getById(t,a,!1))){M.next=7;break}return M.abrupt("return",m);case 7:return M.next=9,this.core.sendCmd(u,{teamId:t});case 9:return h=M.sent,g=h.content.team,this.model.upsert(g),M.abrupt("return",g);case 13:case"end":return M.stop()}}),_callee4,this)})))},a.getJoinedTeamList=function getJoinedTeamList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a,u=this;return lu.wrap((function _callee5$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate(Hv,{teamTypes:t},"",!0),this.core.V2NIMLoginService.checkIllegalState(),t&&0!==t.length||(t=[1,2]),a=[],forEach$1(t).call(t,(function(t){a=concat(a).call(a,u.model.getAll(t))})),m.abrupt("return",sort(a).call(a,(function(t,a){return t.createTime-a.createTime})));case 7:case"end":return m.stop()}}),_callee5,this)})))},a.getJoinedTeamCount=function getJoinedTeamCount(t){var a=this;this.checkV2(),validate(Hv,{teamTypes:t},"",!0),this.core.V2NIMLoginService.checkIllegalState(),t&&0!==t.length||(t=[1,2]);var u=0;return forEach$1(t).call(t,(function(t){u+=a.model.count(t)})),u},a.getJoinedTeamMembers=function getJoinedTeamMembers(t){var a=this;this.checkV2(),validate(Hv,{teamTypes:t},"",!0),this.core.V2NIMLoginService.checkIllegalState(),t&&0!==t.length||(t=[1,2]);var u=[];return forEach$1(t).call(t,(function(t){var m=a.memberModel.chooseList(t),h=filter(m).call(m,(function(t){return t.accountId===a.core.account}));u=concat(u).call(u,h)})),$i.resolve(u)},a.getTeamInfoByIds=function getTeamInfoByIds(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var u,m,h,g,M,I,S=this;return lu.wrap((function _callee6$(T){for(;;)switch(T.prev=T.next){case 0:if(this.checkV2(),validate(Fv,{teamIds:t},"",!0),validate(Gv,{teamType:a},"",!0),m=2===a?"v2SuperTeamGetByIds":"v2TeamGetByIds",h=map$6(t).call(t,(function(t){return S.model.getById(t,a,!1)})),0!==(g=filter(t).call(t,(function(t,a){return!h[a]}))).length){T.next=8;break}return T.abrupt("return",h);case 8:return T.next=10,this.core.sendCmd(m,{teamIds:g});case 10:return M=T.sent,I=M.content.teams,T.abrupt("return",filter(u=map$6(h).call(h,(function(a,u){if(a)return a;var m=t[u],h=find(I).call(I,(function(t){return t.teamId===m}));return h&&S.model.upsert(h),h}))).call(u,(function(t){return!!t})));case 13:case"end":return T.stop()}}),_callee6,this)})))},a.dismissTeam=function dismissTeam(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var u;return lu.wrap((function _callee7$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),u=2===a?"v2SuperTeamDismiss":"v2TeamDismiss",m.next=6,this.core.sendCmd(u,{teamId:t});case 6:case"end":return m.stop()}}),_callee7,this)})))},a.inviteMember=function inviteMember(t,a,u,m){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var h,g;return lu.wrap((function _callee8$(M){for(;;)switch(M.prev=M.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate({inviteeAccountIds:Lv},{inviteeAccountIds:u},"",!0),validate({postscript:Ut(Ut({},Uv),{required:!1})},{postscript:m},"",!0),h=2===a?"v2SuperTeamInviteMembers":"v2TeamInviteMembers",M.next=8,this.core.sendCmd(h,{teamId:t,accounts:u,ps:m||""});case 8:return g=M.sent,M.abrupt("return",g.content.abortedAccidList);case 10:case"end":return M.stop()}}),_callee8,this)})))},a.inviteMemberEx=function inviteMemberEx(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var m,h;return lu.wrap((function _callee9$(g){for(;;)switch(g.prev=g.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate(jv,{inviteeParams:u},"",!0),m=2===a?"v2SuperTeamInviteMembers":"v2TeamInviteMembers",g.next=7,this.core.sendCmd(m,{teamId:t,accounts:u.inviteeAccountIds,ps:u.postscript||"",attach:u.serverExtension});case 7:return h=g.sent,g.abrupt("return",h.content.abortedAccidList);case 9:case"end":return g.stop()}}),_callee9,this)})))},a.acceptInvitation=function acceptInvitation(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){var a,u,m,h,g,M;return lu.wrap((function _callee10$(I){for(;;)switch(I.prev=I.next){case 0:return this.checkV2(),validate(Qv,t,"invitationInfo",!0),validate(Xv,t,"invitationInfo",!0),a=t.teamType,u=t.teamId,m=t.operatorAccountId,h=2===a?"v2SuperTeamAcceptInvitation":"v2TeamAcceptInvitation",I.prev=5,I.next=8,this.core.sendCmd(h,{teamId:u,from:m});case 8:return g=I.sent,this.notification.updateTeamActionStatus(t,1),I.abrupt("return",g.content.team);case 13:throw I.prev=13,I.t0=I.catch(5),M=I.t0,this.notification.checkIfExpired(M.code)&&this.notification.updateTeamActionStatus(t,3),I.t0;case 18:case"end":return I.stop()}}),_callee10,this,[[5,13]])})))},a.rejectInvitation=function rejectInvitation(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){var u,m,h,g,M;return lu.wrap((function _callee11$(I){for(;;)switch(I.prev=I.next){case 0:return this.checkV2(),validate(Qv,t,"invitationInfo",!0),validate(Xv,t,"invitationInfo",!0),validate({postscript:Ut(Ut({},Uv),{required:!1})},{postscript:a},"",!0),u=t.teamType,m=t.teamId,h=t.operatorAccountId,g=2===u?"v2SuperTeamRejectInvite":"v2TeamRejectInvite",I.prev=6,I.next=9,this.core.sendCmd(g,{teamId:m,from:h,ps:a||""});case 9:this.notification.updateTeamActionStatus(t,2),I.next=17;break;case 12:throw I.prev=12,I.t0=I.catch(6),M=I.t0,this.notification.checkIfExpired(M.code)&&this.notification.updateTeamActionStatus(t,3),I.t0;case 17:case"end":return I.stop()}}),_callee11,this,[[6,12]])})))},a.kickMember=function kickMember(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){var m;return lu.wrap((function _callee12$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate({memberAccountIds:Lv},{memberAccountIds:u},"",!0),m=2===a?"v2SuperTeamKickMembers":"v2TeamKickMembers",h.next=7,this.core.sendCmd(m,{teamId:t,accounts:u});case 7:case"end":return h.stop()}}),_callee12,this)})))},a.applyJoinTeam=function applyJoinTeam(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){var m,h,g,M;return lu.wrap((function _callee13$(I){for(;;)switch(I.prev=I.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),m=2===a?"v2SuperTeamApplyToJoin":"v2TeamApplyToJoin",I.next=6,this.core.sendCmd(m,{teamId:t,ps:u||""});case 6:return h=I.sent,g=h.content.team,M=h.content.isInTeam,g.isValidTeam=!!g.isValidTeam&&!!M,I.abrupt("return",g);case 11:case"end":return I.stop()}}),_callee13,this)})))},a.acceptJoinApplication=function acceptJoinApplication(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){var a,u,m,h,g;return lu.wrap((function _callee14$(M){for(;;)switch(M.prev=M.next){case 0:return this.checkV2(),validate(Qv,t,"applicationInfo",!0),validate(Zv,t,"applicationInfo",!0),a=t.teamType,u=t.teamId,m=t.operatorAccountId,h=2===a?"v2SuperTeamAcceptJoinApplication":"v2TeamAcceptJoinApplication",M.prev=5,M.next=8,this.core.sendCmd(h,{teamId:u,from:m});case 8:this.notification.updateTeamActionStatus(t,1),M.next=16;break;case 11:throw M.prev=11,M.t0=M.catch(5),g=M.t0,this.notification.checkIfExpired(g.code)&&this.notification.updateTeamActionStatus(t,3),M.t0;case 16:case"end":return M.stop()}}),_callee14,this,[[5,11]])})))},a.rejectJoinApplication=function rejectJoinApplication(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){var u,m,h,g,M;return lu.wrap((function _callee15$(I){for(;;)switch(I.prev=I.next){case 0:return this.checkV2(),validate(Qv,t,"applicationInfo",!0),validate(Zv,t,"applicationInfo",!0),validate({postscript:Ut(Ut({},Uv),{required:!1})},{postscript:a},"",!0),u=t.teamType,m=t.teamId,h=t.operatorAccountId,g=2===u?"v2SuperTeamRejectJoinApplication":"v2TeamRejectJoinApplication",I.prev=6,I.next=9,this.core.sendCmd(g,{teamId:m,from:h,ps:a||""});case 9:this.notification.updateTeamActionStatus(t,2),I.next=17;break;case 12:throw I.prev=12,I.t0=I.catch(6),M=I.t0,this.notification.checkIfExpired(M.code)&&this.notification.updateTeamActionStatus(t,3),I.t0;case 17:case"end":return I.stop()}}),_callee15,this,[[6,12]])})))},a.updateTeamMemberRole=function updateTeamMemberRole(t,a,u,m){return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var h;return lu.wrap((function _callee16$(g){for(;;)switch(g.prev=g.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate({memberAccountIds:Lv},{memberAccountIds:u},"",!0),validate({memberRole:zv},{memberRole:m},"",!0),h=2===m?"AddManagers":"RemoveManagers",h=2===a?"v2SuperTeam"+h:"v2Team"+h,g.next=9,this.core.sendCmd(h,{teamId:t,accounts:uniq(u)});case 9:case"end":return g.stop()}}),_callee16,this)})))},a.transferTeamOwner=function transferTeamOwner(t,a,u,m){return __awaiter(this,void 0,void 0,lu.mark((function _callee17(){var h,g;return lu.wrap((function _callee17$(M){for(;;)switch(M.prev=M.next){case 0:if(this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate({accountId:Dv},{accountId:u},"",!0),validate({leave:{type:"boolean",required:!1}},{leave:m},"",!0),!(h=this.model.getById(t,a))||h.ownerAccountId!==u){M.next=8;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Transfer to self is not allowed"}});case 8:return g=2===a?"v2SuperTeamTransferOwner":"v2TeamTransferOwner",M.next=11,this.core.sendCmd(g,{teamId:t,account:u,leave:m||!1});case 11:case"end":return M.stop()}}),_callee17,this)})))},a.updateSelfTeamMemberInfo=function updateSelfTeamMemberInfo(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee18(){var m,h,g,M,I,S;return lu.wrap((function _callee18$(T){for(;;)switch(T.prev=T.next){case 0:if(this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate(Wv,{memberInfoParams:u},"",!0),void 0!==u.teamNick||void 0!==u.serverExtension){T.next=6;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER});case 6:return m=2===a?"v2SuperTeamUpdateSelfMemberInfo":"v2TeamUpdateSelfMemberInfo",h=Ut(Ut({},u),{teamId:t,accountId:this.core.account}),g=u.antispamConfig?{teamMember:h,specialFollowUpdate:{},antispam:u.antispamConfig}:{teamMember:h},T.next=11,this.core.sendCmd(m,g);case 11:return T.next=13,this.notification.updateTeamMemberRole(t,a,[this.core.account],h);case 13:M=this.memberModel.getById(t,a,this.core.account),this.core.V2NIMSettingService.name&&this.core.V2NIMConversationIdUtil.name&&(I=1===a?this.core.V2NIMConversationIdUtil.teamConversationId(t):this.core.V2NIMConversationIdUtil.superTeamConversationId(t),S=this.core.V2NIMSettingService.getConversationMuteStatus(I),this.core.eventBus.emit("V2NIMSettingService/setMute",I,S)),this.core.eventBus.emit("forwardSend/V2NIMTeamService/updateSelfTeamMemberInfo",M);case 16:case"end":return T.stop()}}),_callee18,this)})))},a.updateTeamMemberNick=function updateTeamMemberNick(t,a,u,m){return __awaiter(this,void 0,void 0,lu.mark((function _callee19(){var h;return lu.wrap((function _callee19$(g){for(;;)switch(g.prev=g.next){case 0:if(this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate({accountId:Dv},{accountId:u},"",!0),validate({nick:Uv},{nick:m},"",!0),u!==this.core.account){g.next=7;break}return g.abrupt("return",this.updateSelfTeamMemberInfo(t,a,{teamNick:m}));case 7:return h=2===a?"v2SuperTeamUpdateMember":"v2TeamUpdateMember",g.next=10,this.core.sendCmd(h,{teamMember:{teamNick:m,teamId:t,accountId:u}});case 10:case"end":return g.stop()}}),_callee19,this)})))},a.updateTeamMemberNickEx=function updateTeamMemberNickEx(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee20(){var m;return lu.wrap((function _callee20$(h){for(;;)switch(h.prev=h.next){case 0:if(this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate(rf,u,"",!0),u.accountId!==this.core.account){h.next=6;break}return h.abrupt("return",this.updateSelfTeamMemberInfo(t,a,{teamNick:u.teamNick,antispamConfig:u.antispamConfig}));case 6:return m=2===a?"v2SuperTeamUpdateMember":"v2TeamUpdateMember",h.next=9,this.core.sendCmd(m,{teamMember:{teamNick:u.teamNick,teamId:t,accountId:u.accountId},antispam:u.antispamConfig});case 9:case"end":return h.stop()}}),_callee20,this)})))},a.setTeamChatBannedMode=function setTeamChatBannedMode(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee21(){var m;return lu.wrap((function _callee21$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate(Kv,{chatBannedMode:u},"",!0),m=2===a?"v2SuperTeamSetChatBannedMode":"v2TeamSetChatBannedMode",h.next=7,this.core.sendCmd(m,{teamId:t,chatBannedMode:u});case 7:this.model.upsert({teamId:t,teamType:a,chatBannedMode:u});case 8:case"end":return h.stop()}}),_callee21,this)})))},a.setTeamMemberChatBannedStatus=function setTeamMemberChatBannedStatus(t,a,u,m){return __awaiter(this,void 0,void 0,lu.mark((function _callee22(){var h;return lu.wrap((function _callee22$(g){for(;;)switch(g.prev=g.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate({accountId:Dv},{accountId:u},"",!0),validate({chatBanned:Vv},{chatBanned:m},"",!0),h=2===a?"v2SuperTeamMemberSetChatBannedStatus":"v2TeamMemberSetChatBannedStatus",g.next=8,this.core.sendCmd(h,{teamId:t,accountId:2===a?[u]:u,chatBanned:m?1:0});case 8:case"end":return g.stop()}}),_callee22,this)})))},a.getTeamMemberList=function getTeamMemberList(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee23(){var m,h,g,M;return lu.wrap((function _callee23$(I){for(;;)switch(I.prev=I.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate(Yv,{queryOption:u},"",!0),m=0===(m=void 0===u.direction?0:u.direction)?1:0,I.next=8,this.core.sendCmd("v2TeamMemberGetList",{tag:Ut(Ut({teamId:t,teamType:a,onlyChatBanned:!1,nextToken:"",limit:100},u),{direction:m})});case 8:return h=I.sent,g=h.content.datas,M=get(h,"raw.r.0"),2===a&&M&&map$6(M)&&(g=map$6(M).call(M,(function(t){return deserialize(t,invertSerializeItem(gh))}))),I.abrupt("return",{nextToken:h.content.pageInfo.nextToken||"",finished:!+h.content.pageInfo.hasMore,memberList:processTeamMembers(g,a)});case 13:case"end":return I.stop()}}),_callee23,this)})))},a.getTeamMemberListByIds=function getTeamMemberListByIds(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee24(){var m,h,g,M,I,S,T=this;return lu.wrap((function _callee24$(C){for(;;)switch(C.prev=C.next){case 0:this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate({accountIds:Lv},{accountIds:u},"",!0),m=2===a?"v2SuperTeamMemberGetListByIds":"v2TeamMemberGetListByIds",h=map$6(u).call(u,(function(a){return t+"|"+a})),g=[],M=0;case 8:if(!(M<h.length)){C.next=18;break}return C.next=11,this.core.sendCmd(m,{tag:slice(h).call(h,M,M+20)});case 11:I=C.sent,S=processTeamMembers(I.content.datas,a),g=concat(g).call(g,S),forEach$1(S).call(S,(function(t){return T.memberModel.upsert(t)}));case 15:M+=20,C.next=8;break;case 18:return C.abrupt("return",g);case 19:case"end":return C.stop()}}),_callee24,this)})))},a.getTeamMemberInvitor=function getTeamMemberInvitor(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee25(){var m,h;return lu.wrap((function _callee25$(g){for(;;)switch(g.prev=g.next){case 0:return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate({accountIds:Lv},{accountIds:u},"",!0),m=2===a?"v2SuperTeamGetMemberInvitor":"v2TeamGetMemberInvitor",g.next=7,this.core.sendCmd(m,{teamId:t,accounts:u});case 7:return h=g.sent,g.abrupt("return",h.content.accountsMap);case 9:case"end":return g.stop()}}),_callee25,this)})))},a.searchTeamByKeyword=function searchTeamByKeyword(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee26(){return lu.wrap((function _callee26$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),this.checkLogin(),validate({keyword:Dv},{keyword:t},"",!0),a.abrupt("return",this.model.searchTeamByKeyword(t));case 4:case"end":return a.stop()}}),_callee26,this)})))},a.addTeamMembersFollow=function addTeamMembersFollow(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee27(){var m,h,g,M,I;return lu.wrap((function _callee27$(S){for(;;)switch(S.prev=S.next){case 0:return this.checkV2(),validate(tf,{teamId:t,teamType:a,accountIds:u},"",!0),m=2===a?"v2SuperTeamUpdateSelfMemberInfo":"v2TeamUpdateSelfMemberInfo",S.next=5,this.getTeamMemberListByIds(t,a,[this.core.account]);case 5:return h=S.sent,g=h[0],S.next=9,this.core.sendCmd(m,{teamMember:{teamId:t},specialFollowUpdate:{accountIds:u,operation:1}});case 9:M=S.sent,I=M.content.data,Gt(I).length>0&&(Ut(g,I),this.emit("onTeamMemberInfoUpdated",[g]),this.memberModel.upsert(g));case 12:case"end":return S.stop()}}),_callee27,this)})))},a.removeTeamMembersFollow=function removeTeamMembersFollow(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee28(){var m,h,g,M,I;return lu.wrap((function _callee28$(S){for(;;)switch(S.prev=S.next){case 0:return this.checkV2(),validate(tf,{teamId:t,teamType:a,accountIds:u},"",!0),S.next=4,this.getTeamMemberListByIds(t,a,[this.core.account]);case 4:return m=S.sent,h=m[0],g=2===a?"v2SuperTeamUpdateSelfMemberInfo":"v2TeamUpdateSelfMemberInfo",S.next=9,this.core.sendCmd(g,{teamMember:{teamId:t},specialFollowUpdate:{accountIds:u,operation:0}});case 9:M=S.sent,I=M.content.data,Gt(I).length>0&&(Ut(h,I),this.emit("onTeamMemberInfoUpdated",[h]),this.memberModel.upsert(h));case 12:case"end":return S.stop()}}),_callee28,this)})))},a.getTeamJoinActionInfoList=function getTeamJoinActionInfoList(t){return this.checkV2(),validate(ef,t,"option",!0),this.core.V2NIMLoginService.checkIllegalState(),$i.resolve(this.notificationModel.getByOption(t))},a.clearAllTeamJoinActionInfo=function clearAllTeamJoinActionInfo(){return __awaiter(this,void 0,void 0,lu.mark((function _callee29(){return lu.wrap((function _callee29$(t){for(;;)switch(t.prev=t.next){case 0:this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),this.notificationModel.reset();case 3:case"end":return t.stop()}}),_callee29,this)})))},a.deleteTeamJoinActionInfo=function deleteTeamJoinActionInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee30(){return lu.wrap((function _callee30$(a){for(;;)switch(a.prev=a.next){case 0:this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),validate(Qv,t,"",!0),validate(Jv,t,"",!0),validate({timestamp:{type:"number",min:1}},t,"",!0),this.notificationModel.delete(t);case 6:case"end":return a.stop()}}),_callee30,this)})))},a.setTeamJoinActionInfoRead=function setTeamJoinActionInfoRead(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee31(){return lu.wrap((function _callee31$(a){for(;;)switch(a.prev=a.next){case 0:this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),t?(validate(Qv,t,"",!0),validate(Jv,t,"",!0),this.notificationModel.setRead(t)):this.notificationModel.setAllRead();case 3:case"end":return a.stop()}}),_callee31,this)})))},a.getTeamJoinActionInfoUnreadCount=function getTeamJoinActionInfoUnreadCount(){return __awaiter(this,void 0,void 0,lu.mark((function _callee32(){return lu.wrap((function _callee32$(t){for(;;)switch(t.prev=t.next){case 0:return this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),t.abrupt("return",this.notificationModel.getUnreadCount());case 3:case"end":return t.stop()}}),_callee32,this)})))},V2NIMTeamServiceImpl}(gp),pf="V2NIMUserService",mf={"34_3":"v2UpdateBlockList","34_7":"v2GetUserList","34_10":"v2UpdateSelfUserProfile","3_109":"v2SyncSelfUserInfo","3_110":"onUpdateUserProfile","3_103":"onUpdateBlockList","3_8":"syncBlockAndMuteList","34_5":"v2SetP2PMessageMuteMode","3_105":"v2OnUpdateMuteList"},hf={accountId:1,name:3,avatar:4,sign:5,gender:{id:6,retType:"number"},email:7,birthday:8,mobile:9,serverExtension:10,createTime:{id:12,retType:"number"},updateTime:{id:13,retType:"number"}},gf={v2UpdateBlockList:{sid:34,cid:3,service:pf,params:[{type:"String",name:"accountId"},{type:"Bool",name:"addToBlockList"}]},v2GetUserList:{sid:34,cid:7,service:pf,params:[{type:"StrArray",name:"accountIds"}],response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(hf)}]},v2UpdateSelfUserProfile:{sid:34,cid:10,service:pf,params:[{type:"Property",name:"tag",reflectMapper:hf}],response:[{type:"Long",name:"updateTime"}]},onUpdateUserProfile:{sid:3,cid:110,service:pf,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(hf)}]},onUpdateBlockList:{sid:3,cid:103,service:pf,response:[{type:"String",name:"accountId"},{type:"Bool",name:"addToBlockList"}]},syncBlockAndMuteList:{sid:3,cid:8,service:pf,response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem({accountId:0,isMute:{id:1,retType:"boolean"},isBlock:{id:2,retType:"boolean"}})},{type:"Long",name:"timetag"}]},v2SyncSelfUserInfo:{sid:3,cid:109,service:pf,response:[{type:"Property",name:"user",reflectMapper:invertSerializeItem(hf)}]},v2SetP2PMessageMuteMode:{sid:34,cid:5,service:pf,params:[{type:"String",name:"accountId"},{type:"Bool",name:"muteMode"}]},v2OnUpdateMuteList:{sid:3,cid:105,service:pf,response:[{type:"String",name:"accountId"},{type:"Bool",name:"mute"}]}},vf=function(){function V2NIMUserModelImpl(){this.muteList=new qg,this.userMap=new _c,this.blockList=[]}var t=V2NIMUserModelImpl.prototype;return t.reset=function reset(){this.muteList.clear(),this.userMap.clear(),this.blockList=[]},t.setAccountMuteMode=function setAccountMuteMode(t,a){1===a?this.muteList.add(t):this.muteList.delete(t)},t.setUser=function setUser(t){this.userMap.set(t.accountId,t)},t.getUser=function getUser(t){return this.userMap.get(t)},t.getUserListBySearchOption=function getUserListBySearchOption(t){var a,u;return filter(a=nu(values(u=this.userMap).call(u))).call(a,(function(a){var u,m,h;return!(void 0!==t.searchName&&!t.searchName||!includes(u=a.name).call(u,t.keyword))||(!(!t.searchAccountId||!includes(m=a.accountId).call(m,t.keyword))||!!(a.mobile&&t.searchMobile&&includes(h=a.mobile).call(h,t.keyword)))}))},t.addToBlockList=function addToBlockList(t){var a=this;forEach$1(t).call(t,(function(t){var u;includes(u=a.blockList).call(u,t)||a.blockList.push(t)}))},t.removeFromBlockList=function removeFromBlockList(t){var a=this;forEach$1(t).call(t,(function(t){var u,m,h=indexOf(u=a.blockList).call(u,t);-1!==h&&splice(m=a.blockList).call(m,h,1)}))},t.checkBlock=function checkBlock(t){var a=this,u={};return forEach$1(t).call(t,(function(t){var m;u[t]=includes(m=a.blockList).call(m,t)})),u},V2NIMUserModelImpl}(),yf={type:"string",required:!0,allowEmpty:!1},Mf={type:"string",required:!1,allowEmpty:!0},If={name:{type:"string",required:!1,allowEmpty:!0},avatar:Mf,sign:Mf,email:Mf,birthday:Mf,mobile:Mf,gender:{type:"number",required:!1},serverExtension:Mf};function _createForOfIteratorHelperLoose$6(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$6(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$6(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$6(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$6(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var _f=function(t){function V2NIMUserServiceImpl(a){var u;return u=t.call(this,"V2NIMUserService",a)||this,registerParser({cmdMap:mf,cmdConfig:gf}),u.model=new vf,"v2"!==u.core.options.apiVersion?Qe(u):(u.setListener(),u)}wt(V2NIMUserServiceImpl,t);var a=V2NIMUserServiceImpl.prototype;return a.reset=function reset(){this.model.reset()},a.setListener=function setListener(){var t=this;this.core.eventBus.on("forwardReceive/V2NIMUserService/updateBlockList",(function(a,u){u?t.model.addToBlockList([a]):t.model.removeFromBlockList([a]),u?t.emitBlockListAdded(a):t.emit("onBlockListRemoved",a)})),this.core.eventBus.on("forwardReceive/V2NIMUserService/updateUserProfile",(function(a){t.updateUserProfileInMemory(a)}))},a.emit=function emit(a){for(var u,m,h=this.name+"::emit "+a.toString(),g=arguments.length,M=new Array(g>1?g-1:0),I=1;I<g;I++)M[I-1]=arguments[I];if("onUserProfileChanged"===a){var S=M[0];this.logger.log(""+h,map$6(S).call(S,(function(t){return"id:"+t.accountId+";name:"+t.name+";updateTime:"+t.updateTime})))}else if("onBlockListAdded"===a){var T=M[0];this.logger.log(""+h,"id:"+T.accountId+";name:"+T.name+";updateTime:"+T.updateTime)}else{var C,b;(C=this.logger).log.apply(C,concat(b=[""+h]).call(b,M))}return(u=t.prototype.emit).call.apply(u,concat(m=[this,a]).call(m,M))},a.getUserList=function getUserList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),a.abrupt("return",this._getUserList(t));case 2:case"end":return a.stop()}}),_callee,this)})))},a._getUserList=function _getUserList(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u,m,h,g,M=this;return lu.wrap((function _callee2$(I){for(;;)switch(I.prev=I.next){case 0:if(validate({accountIds:Lv},{accountIds:t},"",!0),u=[],forEach$1(t).call(t,(function(t){M.model.getUser(t)||u.push(t)})),m=null,!(u.length>0)){I.next=8;break}return I.next=7,this.core.sendCmd("v2GetUserList",{accountIds:u});case 7:m=I.sent;case 8:return h=(null===(a=null==m?void 0:m.content)||void 0===a?void 0:a.data)||[],forEach$1(h).call(h,(function(t){M.model.setUser(t)})),g=[],forEach$1(t).call(t,(function(t){var a=M.model.getUser(t);a&&g.push(a)})),I.abrupt("return",g);case 13:case"end":return I.stop()}}),_callee2,this)})))},a.getUserListFromCloud=function getUserListFromCloud(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m,h,g=this;return lu.wrap((function _callee3$(M){for(;;)switch(M.prev=M.next){case 0:return this.checkV2(),validate({accountIds:{type:"array",min:1,max:500,itemType:"string"}},{accountIds:t},"",!0),M.next=4,this.core.sendCmd("v2GetUserList",{accountIds:t});case 4:return a=M.sent,u=a.content.data||[],m=[],forEach$1(u).call(u,(function(t){var a=g.model.getUser(t.accountId);g.compareUserForUpdate(a,t)&&m.push(t),g.model.setUser(t)})),h=reduce(t).call(t,(function(t,a){var u=g.model.getUser(a);return u&&t.push(u),t}),[]),m.length>0&&this.emit("onUserProfileChanged",m),M.abrupt("return",h);case 11:case"end":return M.stop()}}),_callee3,this)})))},a.compareUserForUpdate=function compareUserForUpdate(t,a){return!t||!("number"==typeof t.updateTime&&"number"==typeof a.updateTime&&t.updateTime>=a.updateTime)},a.updateSelfUserProfile=function updateSelfUserProfile(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a;return lu.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),validate(If,t,"",!0),u.next=4,this.core.sendCmd("v2UpdateSelfUserProfile",{tag:Ut(Ut({},t),{accountId:this.core.account})});case 4:return a=u.sent,u.next=7,this.updateUserProfileInMemory(Ut(Ut({},t),{updateTime:a.content.updateTime}));case 7:case"end":return u.stop()}}),_callee4,this)})))},a.addUserToBlockList=function addUserToBlockList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){return lu.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:if(this.checkV2(),t!==this.core.account){a.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Cannot block yourself"}});case 3:return validate({accountId:yf},{accountId:t},"",!0),a.next=6,this.core.sendCmd("v2UpdateBlockList",{accountId:t,addToBlockList:!0});case 6:this.model.addToBlockList([t]),this.emitBlockListAdded(t);case 8:case"end":return a.stop()}}),_callee5,this)})))},a.removeUserFromBlockList=function removeUserFromBlockList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){return lu.wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:if(this.checkV2(),t!==this.core.account){a.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Cannot unblock yourself"}});case 3:return validate({accountId:yf},{accountId:t},"",!0),a.next=6,this.core.sendCmd("v2UpdateBlockList",{accountId:t,addToBlockList:!1});case 6:this.model.removeFromBlockList([t]),this.emit("onBlockListRemoved",t);case 8:case"end":return a.stop()}}),_callee6,this)})))},a.searchUserByOption=function searchUserByOption(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:if(this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),validate({keyword:{type:"string",allowEmpty:!1},searchName:{type:"boolean",required:!1},searchAccountId:{type:"boolean",required:!1},searchMobile:{type:"boolean",required:!1}},t,"",!0),!1!==(void 0===t.searchName||t.searchName)||t.searchAccountId||t.searchMobile){a.next=6;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"one of searchName, searchAccountId, searchMobile must be true"}});case 6:return a.abrupt("return",this.model.getUserListBySearchOption(t));case 7:case"end":return a.stop()}}),_callee7,this)})))},a.getBlockList=function getBlockList(){return this.checkV2(),$i.resolve(this.model.blockList)},a.checkBlock=function checkBlock(t){return this.checkV2(),validate({accountIds:Lv},{accountIds:t},"",!0),$i.resolve(this.model.checkBlock(t))},a.updateUserProfileInMemory=function updateUserProfileInMemory(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a,u;return lu.wrap((function _callee8$(m){for(;;)switch(m.prev=m.next){case 0:if(!(a=this.model.getUser(this.core.account))){m.next=6;break}Ut(a,t),this.model.setUser(a),m.next=10;break;case 6:return m.next=8,this._getUserList([this.core.account]);case 8:u=m.sent,a=u[0];case 10:a&&this.emit("onUserProfileChanged",[a]);case 11:case"end":return m.stop()}}),_callee8,this)})))},a.onUpdateUserProfileHandler=function onUpdateUserProfileHandler(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var a;return lu.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:return a=t.content.data,u.next=3,this.updateUserProfileInMemory(a);case 3:case"end":return u.stop()}}),_callee9,this)})))},a.onUpdateBlockListHandler=function onUpdateBlockListHandler(t){var a=t.content.accountId;t.content.addToBlockList?(this.model.addToBlockList([a]),this.emitBlockListAdded(a)):(this.model.removeFromBlockList([a]),this.emit("onBlockListRemoved",a))},a.syncBlockAndMuteListHandler=function syncBlockAndMuteListHandler(t){var a=this,u=t.content.data;forEach$1(u).call(u,(function(t){t.isBlock?a.model.addToBlockList([t.accountId]):a.model.setAccountMuteMode(t.accountId,t.isMute?1:0)}))},a.v2SyncSelfUserInfoHandler=function v2SyncSelfUserInfoHandler(t){var a=t.content.user;this.model.setUser(a)},a.checkUserUpdate=function checkUserUpdate(t,a){var u=t.senderId;u!==this.core.account&&this.refreshUserInfo(u,a)},a.refreshUserInfo=function refreshUserInfo(t,a){return void 0===a&&(a=0),__awaiter(this,void 0,void 0,lu.mark((function _callee10(){var u,m,h,g,M,I;return lu.wrap((function _callee10$(S){for(;;)switch(S.prev=S.next){case 0:if(t&&"string"==typeof t){S.next=2;break}return S.abrupt("return");case 2:if(u=this.model.getUser(t),m=[],!(!u||u&&"number"==typeof u.updateTime&&"number"==typeof a&&!isNaN(u.updateTime)&&!isNaN(a)&&u.updateTime<a)){S.next=16;break}return S.prev=5,S.next=8,this.core.sendCmd("v2GetUserList",{accountIds:[t]});case 8:h=S.sent,m=h.content.data,S.next=16;break;case 12:return S.prev=12,S.t0=S.catch(5),this.logger.warn("V2NIMUserService:refreshUserInfo: failed for "+t),S.abrupt("return");case 16:for(g=_createForOfIteratorHelperLoose$6(m);!(M=g()).done;)I=M.value,this.model.setUser(I),this.emit("onUserProfileChanged",[I]);case 17:case"end":return S.stop()}}),_callee10,this,[[5,12]])})))},a.emitBlockListAdded=function emitBlockListAdded(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){var a;return lu.wrap((function _callee11$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this._getUserList([t]);case 2:1===(a=u.sent).length&&this.emit("onBlockListAdded",a[0]);case 4:case"end":return u.stop()}}),_callee11,this)})))},a.v2OnUpdateMuteListHandler=function v2OnUpdateMuteListHandler(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){var a,u,m,h;return lu.wrap((function _callee12$(g){for(;;)switch(g.prev=g.next){case 0:a=t.content,u=a.accountId,m=a.mute,h=m?1:0,this.core.eventBus.emit("v2NIMUserService/updateMuteList",u,h);case 3:case"end":return g.stop()}}),_callee12,this)})))},V2NIMUserServiceImpl}(gp),Sf="V2NIMFriendService",Tf={"35_1":"v2AddFriend","35_2":"v2DeleteFriend","35_3":"v2SetFriendInfo","35_4":"v2IncFriendInfo","12_101":"v2OnAddFriend","12_102":"v2OnDeleteFriend","12_103":"v2OnUpdateFriendInfo","12_5":"v2SyncFriendList","12_6":"v2SyncFriendUserList"},Cf={accountId:4,relationShip:{id:5,retType:"number"},source:{id:7,retType:"number"},alias:8,serverExtension:10,createTime:{id:11,retType:"number"},updateTime:{id:12,retType:"number"},customerExtension:13},bf={v2AddFriend:{sid:35,cid:1,service:Sf,params:[{type:"String",name:"accountId"},{type:"Byte",name:"verifyType"},{type:"String",name:"postscript"}],response:[]},v2DeleteFriend:{sid:35,cid:2,service:Sf,params:[{type:"String",name:"accountId"},{type:"Property",name:"params",reflectMapper:{deleteAlias:{id:1,converter:boolToInt}}}]},v2SetFriendInfo:{sid:35,cid:3,service:Sf,params:[{type:"Property",name:"tag",reflectMapper:Cf}]},v2OnAddFriend:{sid:12,cid:101,service:Sf,response:[{type:"String",name:"accountId"},{type:"Byte",name:"verifyType"},{type:"String",name:"postscript"},{type:"Property",name:"ext",reflectMapper:invertSerializeItem({serverExt:1})}]},v2OnDeleteFriend:{sid:12,cid:102,service:Sf,response:[{type:"String",name:"accountId"}]},v2OnUpdateFriendInfo:{sid:12,cid:103,service:Sf,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Cf)}]},v2SyncFriendList:{sid:12,cid:5,service:Sf,response:[{type:"PropertyArray",name:"friends",reflectMapper:invertSerializeItem(Cf)},{type:"Long",name:"timetag"}]},v2SyncFriendUserList:{sid:12,cid:6,service:Sf,response:[{type:"PropertyArray",name:"users",reflectMapper:invertSerializeItem(hf)}]},v2IncFriendInfo:{sid:35,cid:4,service:Sf,params:[{type:"Long",name:"timetag"}],response:[{type:"PropertyArray",name:"friends",reflectMapper:invertSerializeItem(Cf)},{type:"Long",name:"timetag"}]}},Ef={accountId:{type:"string",required:!0,allowEmpty:!1},params:{type:"object",required:!0,rules:{addMode:{type:"enum",required:!0,values:[1,2]},postscript:{type:"string",required:!1,allowEmpty:!0}}}},kf={accountId:{type:"string",required:!0,allowEmpty:!1},params:{type:"object",required:!1,rules:{deleteAlias:{type:"boolean",required:!1}}}},Rf={accountId:{type:"string",required:!0,allowEmpty:!1},params:{type:"object",required:!1,rules:{alias:{type:"string",required:!1,allowEmpty:!0},serverExtension:{type:"string",required:!1,allowEmpty:!0}}}},Af={applicantAccountId:{type:"string",allowEmpty:!1},recipientAccountId:{type:"string",allowEmpty:!1},operatorAccountId:{type:"string",required:!1,allowEmpty:!1},postscript:{type:"string",required:!1,allowEmpty:!0},status:{type:"enum",values:[1,4,3,0,2]},timestamp:{type:"number",min:1}};function checkApplication(t,a){if(validate(Af,t,"",!0),t&&t.applicantAccountId!==a&&t.recipientAccountId!==a)throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Friend application is not your own"}})}var wf={offset:{type:"number",required:!1},limit:{type:"number",required:!1},status:{type:"array",itemType:"enum",required:!1,values:[1,4,3,0,2]}},Nf=function(){function V2NIMFriendNotificationImpl(t,a){this.core=t,this.service=a}return V2NIMFriendNotificationImpl.prototype.processSysNotification=function processSysNotification(t){if(6===t.type){var a=t.senderId;this.core.V2NIMFriendService.handleDeleteFriend(a,2)}else if(5===t.type)try{var u=JSON.parse(t.content);if(1===(null==u?void 0:u.vt)){this.core.V2NIMFriendService.handleAddFriend(t.senderId,t.timestamp);var m={applicantAccountId:t.senderId,recipientAccountId:t.receiverId,operatorAccountId:t.senderId,postscript:t.postscript,timestamp:t.timestamp,status:4,read:!1};this.service.notificationModel.appendFriendAddApplication(m),this.service.notificationModel.updateFriendAddApplicationStatus(m.applicantAccountId,4,m.applicantAccountId)}else if(2===(null==u?void 0:u.vt)){var h={applicantAccountId:t.senderId,recipientAccountId:t.receiverId,operatorAccountId:t.senderId,postscript:t.postscript,timestamp:t.timestamp,status:0,read:!1};this.service.handleApplyFriend(h),this.service.notificationModel.appendFriendAddApplication(h)}else if(3===(null==u?void 0:u.vt)){this.core.V2NIMFriendService.handleAddFriend(t.senderId,t.timestamp);var g={applicantAccountId:t.receiverId,recipientAccountId:t.senderId,operatorAccountId:t.senderId,timestamp:t.timestamp,postscript:t.postscript,status:1,read:!1};this.service.notificationModel.appendFriendAddApplication(g)}else if(4===(null==u?void 0:u.vt)){var M={applicantAccountId:t.receiverId,recipientAccountId:t.senderId,operatorAccountId:t.senderId,timestamp:t.timestamp,postscript:t.postscript,status:2,read:!1};this.service.notificationModel.appendFriendAddApplication(M),this.service.emit("onFriendAddRejected",M)}}catch(t){this.core.logger.warn("V2NIMFriendNotificationImpl::processSysNotification, parse content error:",t)}},V2NIMFriendNotificationImpl}(),xf=function(){function V2NIMFriendModelImpl(){this.validFriendIds=new qg,this.friendMap=new _c,this.friendTimetag=0}var t=V2NIMFriendModelImpl.prototype;return t.reset=function reset(){this.friendMap.clear(),this.validFriendIds.clear()},t.upsertFriend=function upsertFriend(t,a){delete a.relationShip;var u=this.friendMap.get(t)||{},m=Ut({accountId:t},u,a);return this.friendMap.set(t,m),this.validFriendIds.add(t),m},t.addFriend=function addFriend(t){this.validFriendIds.add(t)},t.deleteFriend=function deleteFriend(t){this.validFriendIds.delete(t)},t.getFriend=function getFriend(t){return this.validFriendIds.has(t)?this.friendMap.get(t):void 0},t.getFriendList=function getFriendList(){var t,a,u,m=this;return filter(t=map$6(a=nu(values(u=this.validFriendIds).call(u))).call(a,(function(t){return m.getFriend(t)}))).call(t,(function(t){return!!t}))},t.getFriendListBySearchOption=function getFriendListBySearchOption(t){var a,u,m,h=this;return filter(a=map$6(u=nu(values(m=this.validFriendIds).call(m))).call(u,(function(t){return h.getFriend(t)}))).call(a,(function(a){var u,m,h=void 0===t.searchAlias||t.searchAlias;return void 0!==a&&(!!(h&&a.alias&&includes(u=a.alias).call(u,t.keyword))||!(!t.searchAccountId||!includes(m=a.accountId).call(m,t.keyword)))}))},t.getFriendByIds=function getFriendByIds(t){var a,u=this;return filter(a=map$6(t).call(t,(function(t){return u.getFriend(t)}))).call(a,(function(t){return!!t}))},t.setFriendTimetag=function setFriendTimetag(t){this.friendTimetag=t},t.getFriendTimetag=function getFriendTimetag(){return this.friendTimetag},V2NIMFriendModelImpl}();function _createForOfIteratorHelperLoose$5(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$5(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$5(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$5(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$5(t,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var Of=function(){function V2NIMFriendNotificationModelImpl(){this.list=[],this.maxCount=1e3}var t=V2NIMFriendNotificationModelImpl.prototype;return t.reset=function reset(){this.list=[]},t.updateFriendAddApplicationStatus=function updateFriendAddApplicationStatus(t,a,u){if(0!==a)for(var m,h=_createForOfIteratorHelperLoose$5(this.list);!(m=h()).done;){var g=m.value;g.applicantAccountId===t&&0===g.status&&(g.status=a,g.operatorAccountId=u)}},t.getAddApplicationList=function getAddApplicationList(t){var a,u,m=void 0===t.offset?0:t.offset,h=reverse$1(a=filter(u=this.list).call(u,(function(a){var u=t.status||[];return 0===u.length||!!includes(u).call(u,a.status)}))).call(a),g=t.limit||50,M=slice(h).call(h,m,m+g),I=m+g>=h.length;return{infos:M,finished:I,offset:I?0:m+g}},t.checkSameApplication=function checkSameApplication(t,a,u){return void 0===u&&(u=!1),t.applicantAccountId===a.applicantAccountId&&t.recipientAccountId===a.recipientAccountId&&(!u||t.timestamp===a.timestamp)},t.setAllApplicationRead=function setAllApplicationRead(){for(var t,a=_createForOfIteratorHelperLoose$5(this.list);!(t=a()).done;){t.value.read=!0}},t.setApplicationRead=function setApplicationRead(t){for(var a,u=_createForOfIteratorHelperLoose$5(this.list);!(a=u()).done;){var m=a.value;this.checkSameApplication(m,t)&&(m.read=!0)}},t.getAddApplicationUnreadCount=function getAddApplicationUnreadCount(){for(var t,a=new qg,u=_createForOfIteratorHelperLoose$5(this.list);!(t=u()).done;){var m=t.value;m.read||0!==m.status||a.add(m.applicantAccountId)}return a.size},t.appendFriendAddApplication=function appendFriendAddApplication(t){this.list.push(t),this.list.length>this.maxCount&&this.list.shift()},t.clearApplicationList=function clearApplicationList(){this.list=[]},t.deleteApplication=function deleteApplication(t){var a,u,m=this;this.list=filter(a=map$6(u=this.list).call(u,(function(a){if(!m.checkSameApplication(a,t,!1))return a}))).call(a,(function(t){return t}))},V2NIMFriendNotificationModelImpl}(),Pf=function(t){function V2NIMUFriendServiceImpl(a){var u;return(u=t.call(this,"V2NIMFriendService",a)||this).notification=new Nf(u.core,Qe(u)),u.model=new xf,u.notificationModel=new Of,u.core._registerDep(_f,"V2NIMUserService"),"v2"!==u.core.options.apiVersion?Qe(u):(registerParser({cmdMap:Tf,cmdConfig:bf}),u.setListener(),u)}wt(V2NIMUFriendServiceImpl,t);var a=V2NIMUFriendServiceImpl.prototype;return a.reset=function reset(){this.model.reset()},a.setListener=function setListener(){var t,a,u,m,h,g;this.core.eventBus.on("V2NIMFriendService/sysNotification",bind$1(t=this.notification.processSysNotification).call(t,this.notification)),this.core.eventBus.on("forwardReceive/V2NIMFriendService/addFriend",bind$1(a=this.handleAddFriend).call(a,this)),this.core.eventBus.on("forwardReceive/V2NIMFriendService/deleteFriend",bind$1(u=this.handleDeleteFriend).call(u,this)),this.core.eventBus.on("forwardReceive/V2NIMFriendService/setFriendInfo",bind$1(m=this.handleSetFriendInfo).call(m,this)),this.core.eventBus.on("forwardReceive/V2NIMFriendService/acceptAddApplication",bind$1(h=this.handlePassFriendApply).call(h,this)),this.core.eventBus.on("forwardReceive/V2NIMFriendService/rejectAddApplication",bind$1(g=this.handleRejectFriendApply).call(g,this))},a.emit=function emit(a){for(var u,m,h=this.name+"::emit "+a.toString(),g=arguments.length,M=new Array(g>1?g-1:0),I=1;I<g;I++)M[I-1]=arguments[I];if("onFriendAdded"===a||"onFriendInfoChanged"===a){var S=M[0];this.logger.log(""+h,S.accountId+";updateTime:"+S.updateTime)}else{var T,C;(T=this.logger).log.apply(T,concat(C=[""+h]).call(C,M))}return(u=t.prototype.emit).call.apply(u,concat(m=[this,a]).call(m,M))},a.addFriend=function addFriend(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(this.checkV2(),t!==this.core.account){u.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Cannot add yourself"}});case 3:return validate(Ef,{accountId:t,params:a},"",!0),u.next=6,this.core.sendCmd("v2AddFriend",{accountId:t,verifyType:a.addMode,postscript:a.postscript||""});case 6:if(1!==a.addMode){u.next=10;break}return u.next=9,this.handleAddFriend(t);case 9:this.notificationModel.updateFriendAddApplicationStatus(t,4,this.core.account);case 10:case"end":return u.stop()}}),_callee,this)})))},a.deleteFriend=function deleteFriend(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:if(this.checkV2(),t!==this.core.account){u.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Cannot delete yourself"}});case 3:return validate(kf,{accountId:t,params:a},"",!0),u.next=6,this.core.sendCmd("v2DeleteFriend",{accountId:t,params:a});case 6:a.deleteAlias&&this.model.upsertFriend(t,{alias:""}),this.handleDeleteFriend(t);case 8:case"end":return u.stop()}}),_callee2,this)})))},a.acceptAddApplication=function acceptAddApplication(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){return lu.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),checkApplication(t,this.core.account),a.prev=2,a.next=5,this.core.sendCmd("v2AddFriend",{accountId:t.applicantAccountId,verifyType:3,postscript:""});case 5:this.handlePassFriendApply(t.applicantAccountId),a.next=12;break;case 8:throw a.prev=8,a.t0=a.catch(2),this.handlePassFriendApply(t.applicantAccountId,a.t0),a.t0;case 12:case"end":return a.stop()}}),_callee3,this,[[2,8]])})))},a.rejectAddApplication=function rejectAddApplication(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),checkApplication(t,this.core.account),u.prev=2,u.next=5,this.core.sendCmd("v2AddFriend",{accountId:t.applicantAccountId,verifyType:4,postscript:a||""});case 5:this.handleRejectFriendApply({applicantAccountId:t.applicantAccountId,recipientAccountId:t.recipientAccountId,operatorAccountId:this.core.account,postscript:a||"",timestamp:this.core.timeOrigin.getNTPTime(),read:!1,status:2}),u.next=12;break;case 8:throw u.prev=8,u.t0=u.catch(2),this.handleRejectFriendApply({applicantAccountId:t.applicantAccountId,recipientAccountId:t.recipientAccountId,operatorAccountId:this.core.account,postscript:a||"",timestamp:this.core.timeOrigin.getNTPTime(),read:!1,status:3},u.t0),u.t0;case 12:case"end":return u.stop()}}),_callee4,this,[[2,8]])})))},a.setFriendInfo=function setFriendInfo(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){return lu.wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:if(this.checkV2(),validate(Rf,{accountId:t,params:a},"",!0),t!==this.core.account){u.next=4;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"Cannot set yourself"}});case 4:return u.next=6,this.core.sendCmd("v2SetFriendInfo",{tag:Ut({accountId:t},a)});case 6:this.handleSetFriendInfo(t,a);case 7:case"end":return u.stop()}}),_callee5,this)})))},a.getFriendList=function getFriendList(){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){return lu.wrap((function _callee6$(t){for(;;)switch(t.prev=t.next){case 0:return this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),t.abrupt("return",this.computedFields(this.model.getFriendList()));case 3:case"end":return t.stop()}}),_callee6,this)})))},a.getFriendByIds=function getFriendByIds(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),validate({accountIds:{type:"array",itemType:"string",required:!0,min:1}},{accountIds:t},"",!0),a.abrupt("return",this.computedFields(this.model.getFriendByIds(t)));case 4:case"end":return a.stop()}}),_callee7,this)})))},a.checkFriend=function checkFriend(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a,u=this;return lu.wrap((function _callee8$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),validate({accountIds:{type:"array",itemType:"string",required:!0,min:1}},{accountIds:t},"",!0),a={},forEach$1(t).call(t,(function(t){a[t]=!!u.model.getFriend(t)})),m.abrupt("return",a);case 6:case"end":return m.stop()}}),_callee8,this)})))},a.getAddApplicationList=function getAddApplicationList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){return lu.wrap((function _callee9$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),validate(wf,t,"",!0),a.abrupt("return",this.notificationModel.getAddApplicationList(t));case 4:case"end":return a.stop()}}),_callee9,this)})))},a.setAddApplicationRead=function setAddApplicationRead(){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){return lu.wrap((function _callee10$(t){for(;;)switch(t.prev=t.next){case 0:this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),this.notificationModel.setAllApplicationRead();case 3:case"end":return t.stop()}}),_callee10,this)})))},a.setAddApplicationReadEx=function setAddApplicationReadEx(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){return lu.wrap((function _callee11$(a){for(;;)switch(a.prev=a.next){case 0:this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),t?(checkApplication(t,this.core.account),this.notificationModel.setApplicationRead(t)):this.notificationModel.setAllApplicationRead();case 3:case"end":return a.stop()}}),_callee11,this)})))},a.getAddApplicationUnreadCount=function getAddApplicationUnreadCount(){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){return lu.wrap((function _callee12$(t){for(;;)switch(t.prev=t.next){case 0:return this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),t.abrupt("return",this.notificationModel.getAddApplicationUnreadCount());case 3:case"end":return t.stop()}}),_callee12,this)})))},a.clearAllAddApplication=function clearAllAddApplication(){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){return lu.wrap((function _callee13$(t){for(;;)switch(t.prev=t.next){case 0:this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),this.notificationModel.clearApplicationList();case 3:case"end":return t.stop()}}),_callee13,this)})))},a.deleteAddApplication=function deleteAddApplication(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){return lu.wrap((function _callee14$(a){for(;;)switch(a.prev=a.next){case 0:this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),checkApplication(t,this.core.account),this.notificationModel.deleteApplication(t);case 4:case"end":return a.stop()}}),_callee14,this)})))},a.searchFriendByOption=function searchFriendByOption(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){return lu.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:if(this.checkV2(),this.core.V2NIMLoginService.checkIllegalState(),validate({keyword:{type:"string",allowEmpty:!1},searchAccountId:{type:"boolean",required:!1}},t,"",!0),void 0===t.searchAlias||t.searchAlias||t.searchAccountId){a.next=6;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"searchAlias and searchAccountId cannot be false at the same time"}});case 6:return a.abrupt("return",this.computedFields(this.model.getFriendListBySearchOption(t)));case 7:case"end":return a.stop()}}),_callee15,this)})))},a.v2OnAddFriendHandler=function v2OnAddFriendHandler(t){var a=t.content,u=a.accountId,m=a.verifyType,h=a.postscript;if(1===m)this.handleAddFriend(u),this.notificationModel.updateFriendAddApplicationStatus(u,4,this.core.account);else if(2===m){var g={applicantAccountId:this.core.account,recipientAccountId:u,operatorAccountId:this.core.account,postscript:h,timestamp:this.core.timeOrigin.getNTPTime(),status:0,read:!1};this.handleApplyFriend(g)}else if(3===m)this.handlePassFriendApply(u);else if(4===m){var M={applicantAccountId:u,recipientAccountId:this.core.account,operatorAccountId:this.core.account,postscript:h,timestamp:this.core.timeOrigin.getNTPTime(),status:2,read:!1};this.handleRejectFriendApply(M)}},a.v2OnDeleteFriendHandler=function v2OnDeleteFriendHandler(t){var a=t.content.accountId;this.handleDeleteFriend(a)},a.v2OnUpdateFriendInfoHandler=function v2OnUpdateFriendInfoHandler(t){var a=t.content.data,u=this.model.upsertFriend(a.accountId,a);this.emit("onFriendInfoChanged",this.computedField(u))},a.v2SyncFriendListHandler=function v2SyncFriendListHandler(t){var a=this,u=t.content,m=u.friends,h=u.timetag;this.model.setFriendTimetag(h),forEach$1(m).call(m,(function(t){t.serverExtension||(t.serverExtension=""),t.customerExtension||(t.customerExtension=""),0===t.relationShip?a.model.deleteFriend(t.accountId):a.model.upsertFriend(t.accountId,t)}))},a.v2SyncFriendUserListHandler=function v2SyncFriendUserListHandler(t){var a=this,u=t.content.users;this.hasUserService&&forEach$1(u).call(u,(function(t){a.core.V2NIMUserService.model.setUser(t)}))},a.handleApplyFriend=function handleApplyFriend(t){this.emit("onFriendAddApplication",t)},a.handleAddFriend=function handleAddFriend(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var a;return lu.wrap((function _callee16$(u){for(;;)switch(u.prev=u.next){case 0:return this.model.addFriend(t),u.next=3,this.incrementSyncFriend();case 3:return u.next=5,this.core.V2NIMUserService.refreshUserInfo(t);case 5:(a=this.model.getFriend(t))&&this.emit("onFriendAdded",this.computedField(a));case 7:case"end":return u.stop()}}),_callee16,this)})))},a.handleDeleteFriend=function handleDeleteFriend(t,a){a=void 0===a?1:a,this.emit("onFriendDeleted",t,a),this.model.deleteFriend(t)},a.handleSetFriendInfo=function handleSetFriendInfo(t,a){var u=this.model.upsertFriend(t,a);this.emit("onFriendInfoChanged",this.computedField(u))},a.handlePassFriendApply=function handlePassFriendApply(t,a){var u=a?null==a?void 0:a.code:200;if(!(u>=19e4||u===jl.V2NIM_ERROR_CODE_FRIEND_OPERATION_RATE_LIMIT))if(200===u||u===jl.V2NIM_ERROR_CODE_FRIEND_ALREADY_EXIST)this.notificationModel.updateFriendAddApplicationStatus(t,1,this.core.account),this.handleAddFriend(t);else{if(u>=500&&u<=599&&509!==u)return;this.notificationModel.updateFriendAddApplicationStatus(t,3,this.core.account)}},a.handleRejectFriendApply=function handleRejectFriendApply(t,a){var u=a?null==a?void 0:a.code:200;if(!(u>=19e4||u===jl.V2NIM_ERROR_CODE_FRIEND_OPERATION_RATE_LIMIT))if(200===u)this.emit("onFriendAddRejected",t),this.notificationModel.updateFriendAddApplicationStatus(t.applicantAccountId,2,this.core.account);else if(u===jl.V2NIM_ERROR_CODE_FRIEND_ALREADY_EXIST)this.notificationModel.updateFriendAddApplicationStatus(t.applicantAccountId,1,this.core.account);else{if(u>=500&&u<=599&&509!==u)return;this.notificationModel.updateFriendAddApplicationStatus(t.applicantAccountId,3,this.core.account)}},a.incrementSyncFriend=function incrementSyncFriend(){return __awaiter(this,void 0,void 0,lu.mark((function _callee17(){var t,a,u,m,h=this;return lu.wrap((function _callee17$(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,this.core.sendCmd("v2IncFriendInfo",{timetag:this.model.getFriendTimetag()});case 2:t=g.sent,a=t.content,u=a.friends,m=a.timetag,this.model.setFriendTimetag(m),forEach$1(u).call(u,(function(t){h.model.upsertFriend(t.accountId,t)}));case 6:case"end":return g.stop()}}),_callee17,this)})))},a.computedFields=function computedFields(t){var a=this;return map$6(t).call(t,(function(t){return a.computedField(t)}))},a.computedField=function computedField(t){var a,u,m=null===(u=null===(a=this.core.V2NIMUserService)||void 0===a?void 0:a.model)||void 0===u?void 0:u.getUser(t.accountId);return m?Ut({},t,{userProfile:m}):t},Ye(V2NIMUFriendServiceImpl,[{key:"hasUserService",get:function get(){var t;return!!(null===(t=this.core.V2NIMUserService)||void 0===t?void 0:t.name)}}]),V2NIMUFriendServiceImpl}(gp),Lf={muteMode:{type:"enum",values:[2,0,1]}},Vf={accountId:{type:"string",required:!0,allowEmpty:!1},muteMode:{type:"enum",required:!0,values:[2,0,1]}},Uf={type:"object",required:!1,rules:{certificateName:{type:"string",required:!0,allowEmpty:!1},appId:{type:"string",required:!1,allowEmpty:!1},appKey:{type:"string",required:!1,allowEmpty:!1},secret:{type:"string",required:!1,allowEmpty:!1}}},Df={config:{type:"object",required:!0,rules:{apns:Uf,hwPush:Uf,miPush:Uf,vivoPush:Uf,oppoPush:Uf,honorPush:Uf,fcmPush:Uf,mzPush:Uf}}},qf="V2NIMSettingService",Bf={"34_1":"v2SetDeviceToken","34_2":"v2SetAppBackground","34_15":"v2SetPushMobileOnDesktopOnline","3_115":"v2SettingMutilSyncDonnop","4_13":"v2SettingSyncDonnop"},Ff={need:{id:1,converter:function converter(t){return t?2:1},retConverter:function retConverter(t){return"2"===t}}},Gf={v2SetDeviceToken:{sid:34,cid:1,service:qf,params:[{type:"String",name:"certificateName"},{type:"String",name:"pushDeviceToken"},{type:"Int",name:"pushkit"}]},v2SetAppBackground:{sid:34,cid:2,service:qf,params:[{type:"Bool",name:"isBackground"},{type:"Int",name:"badge"}]},v2SetPushMobileOnDesktopOnline:{sid:34,cid:15,service:qf,params:[{type:"Property",name:"tag",reflectMapper:Ff}]},v2SettingMutilSyncDonnop:{sid:3,cid:115,service:qf,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Ff)},{type:"Long",name:"timetag"}]},v2SettingSyncDonnop:{sid:4,cid:13,service:qf,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Ff)},{type:"Long",name:"timetag"}]}},Hf=function(){function V2NIMSettingHandlerImpl(t,a){this.core=t,this.service=a}var t=V2NIMSettingHandlerImpl.prototype;return t.v2SettingMutilSyncDonnopHandler=function v2SettingMutilSyncDonnopHandler(t){var a=t.content.data.need;this.service.needToPushMobileOnDesktopOnline=a,this.service.emit("onPushMobileOnDesktopOnline",a)},t.v2SettingSyncDonnopHandler=function v2SettingSyncDonnopHandler(t){var a=t.content.data.need;this.service.needToPushMobileOnDesktopOnline=a,this.service.emit("onPushMobileOnDesktopOnline",a)},V2NIMSettingHandlerImpl}(),jf=jf||function(t){var a;"undefined"!=typeof window&&window.crypto&&(a=window.crypto),"undefined"!=typeof self&&self.crypto&&(a=self.crypto),void 0!==ho&&ho.crypto&&(a=ho.crypto),!a&&"undefined"!=typeof window&&window.msCrypto&&(a=window.msCrypto),!a&&"undefined"!=typeof global&&global.crypto&&(a=global.crypto);var u=function cryptoSecureRandomInt(){if(a){if("function"==typeof a.getRandomValues)try{return a.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof a.randomBytes)try{return a.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},m=vt||function(){function F(){}return function(t){var a;return F.prototype=t,a=new F,F.prototype=null,a}}(),h={},g=h.lib={},M=g.Base={extend:function extend(t){var a=m(this);return t&&a.mixIn(t),a.hasOwnProperty("init")&&this.init!==a.init||(a.init=function(){a.$super.init.apply(this,arguments)}),a.init.prototype=a,a.$super=this,a},create:function create(){var t=this.extend();return t.init.apply(t,arguments),t},init:function init(){},mixIn:function mixIn(t){for(var a in t)t.hasOwnProperty(a)&&(this[a]=t[a]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function clone(){return this.init.prototype.extend(this)}},I=g.WordArray=M.extend({init:function init(t,a){t=this.words=t||[],this.sigBytes=null!=a?a:4*t.length},toString:function toString(t){return(t||T).stringify(this)},concat:function concat(t){var a=this.words,u=t.words,m=this.sigBytes,h=t.sigBytes;if(this.clamp(),m%4)for(var g=0;g<h;g++){var M=u[g>>>2]>>>24-g%4*8&255;a[m+g>>>2]|=M<<24-(m+g)%4*8}else for(var I=0;I<h;I+=4)a[m+I>>>2]=u[I>>>2];return this.sigBytes+=h,this},clamp:function clamp(){var a=this.words,u=this.sigBytes;a[u>>>2]&=4294967295<<32-u%4*8,a.length=t.ceil(u/4)},clone:function clone(){var t,clone=M.clone.call(this);return clone.words=slice(t=this.words).call(t,0),clone},random:function random(t){for(var a=[],m=0;m<t;m+=4)a.push(u());return new I.init(a,t)}}),S=h.enc={},T=S.Hex={stringify:function stringify(t){for(var a=t.words,u=t.sigBytes,m=[],h=0;h<u;h++){var g=a[h>>>2]>>>24-h%4*8&255;m.push((g>>>4).toString(16)),m.push((15&g).toString(16))}return m.join("")},parse:function parse(t){for(var a=t.length,u=[],m=0;m<a;m+=2)u[m>>>3]|=Bu(t.substr(m,2),16)<<24-m%8*4;return new I.init(u,a/2)}},C=S.Latin1={stringify:function stringify(t){for(var a=t.words,u=t.sigBytes,m=[],h=0;h<u;h++){var g=a[h>>>2]>>>24-h%4*8&255;m.push(String.fromCharCode(g))}return m.join("")},parse:function parse(t){for(var a=t.length,u=[],m=0;m<a;m++)u[m>>>2]|=(255&t.charCodeAt(m))<<24-m%4*8;return new I.init(u,a)}},b=S.Utf8={stringify:function stringify(t){try{return decodeURIComponent(escape(C.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function parse(t){return C.parse(unescape(encodeURIComponent(t)))}},E=g.BufferedBlockAlgorithm=M.extend({reset:function reset(){this._data=new I.init,this._nDataBytes=0},_append:function _append(t){var a;"string"==typeof t&&(t=b.parse(t)),concat(a=this._data).call(a,t),this._nDataBytes+=t.sigBytes},_process:function _process(a){var u,m=this._data,h=m.words,g=m.sigBytes,M=this.blockSize,S=g/(4*M),T=(S=a?t.ceil(S):t.max((0|S)-this._minBufferSize,0))*M,C=t.min(4*T,g);if(T){for(var b=0;b<T;b+=M)this._doProcessBlock(h,b);u=splice(h).call(h,0,T),m.sigBytes-=C}return new I.init(u,C)},clone:function clone(){var clone=M.clone.call(this);return clone._data=this._data.clone(),clone},_minBufferSize:0});g.Hasher=E.extend({cfg:M.extend(),init:function init(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function reset(){E.reset.call(this),this._doReset()},update:function update(t){return this._append(t),this._process(),this},finalize:function finalize(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function _createHelper(t){return function(a,u){return new t.init(u).finalize(a)}},_createHmacHelper:function _createHmacHelper(t){return function(a,u){return new k.HMAC.init(t,u).finalize(a)}}});var k=h.algo={};return h}(Math),$f=jf.enc.Utf8,zf=jf,Wf=zf.lib,Kf=Wf.Base,Yf=Wf.WordArray,Qf=zf.algo,Jf=Qf.MD5,Xf=Qf.EvpKDF=Kf.extend({cfg:Kf.extend({keySize:4,hasher:Jf,iterations:1}),init:function init(t){this.cfg=this.cfg.extend(t)},compute:function compute(t,a){for(var u,m=this.cfg,h=m.hasher.create(),g=Yf.create(),M=g.words,I=m.keySize,S=m.iterations;M.length<I;){u&&h.update(u),u=h.update(t).finalize(a),h.reset();for(var T=1;T<S;T++)u=h.finalize(u),h.reset();concat(g).call(g,u)}return g.sigBytes=4*I,g}});zf.EvpKDF=function(t,a,u){return Xf.create(u).compute(t,a)},jf.EvpKDF;var Zf=jf,ey=Zf.lib.WordArray;Zf.enc.Base64={stringify:function stringify(t){var a=t.words,u=t.sigBytes,m=this._map;t.clamp();for(var h=[],g=0;g<u;g+=3)for(var M=(a[g>>>2]>>>24-g%4*8&255)<<16|(a[g+1>>>2]>>>24-(g+1)%4*8&255)<<8|a[g+2>>>2]>>>24-(g+2)%4*8&255,I=0;I<4&&g+.75*I<u;I++)h.push(m.charAt(M>>>6*(3-I)&63));var S=m.charAt(64);if(S)for(;h.length%4;)h.push(S);return h.join("")},parse:function parse(t){var a=t.length,u=this._map,m=this._reverseMap;if(!m){m=this._reverseMap=[];for(var h=0;h<u.length;h++)m[u.charCodeAt(h)]=h}var g=u.charAt(64);if(g){var M=indexOf(t).call(t,g);-1!==M&&(a=M)}return function parseLoop(t,a,u){for(var m=[],h=0,g=0;g<a;g++)if(g%4){var M=u[t.charCodeAt(g-1)]<<g%4*2|u[t.charCodeAt(g)]>>>6-g%4*2;m[h>>>2]|=M<<24-h%4*8,h++}return ey.create(m,h)}(t,a,m)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},jf.enc.Base64,function(t){t.lib.Cipher||function(){var a=t,u=a.lib,m=u.Base,h=u.WordArray,g=u.BufferedBlockAlgorithm,M=a.enc;M.Utf8;var I=M.Base64,S=a.algo.EvpKDF,T=u.Cipher=g.extend({cfg:m.extend(),createEncryptor:function createEncryptor(t,a){return this.create(this._ENC_XFORM_MODE,t,a)},createDecryptor:function createDecryptor(t,a){return this.create(this._DEC_XFORM_MODE,t,a)},init:function init(t,a,u){this.cfg=this.cfg.extend(u),this._xformMode=t,this._key=a,this.reset()},reset:function reset(){g.reset.call(this),this._doReset()},process:function process(t){return this._append(t),this._process()},finalize:function finalize(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function selectCipherStrategy(t){return"string"==typeof t?x:w}return function(t){return{encrypt:function encrypt(a,u,m){return selectCipherStrategy(u).encrypt(t,a,u,m)},decrypt:function decrypt(a,u,m){return selectCipherStrategy(u).decrypt(t,a,u,m)}}}}()});u.StreamCipher=T.extend({_doFinalize:function _doFinalize(){return this._process(!0)},blockSize:1});var C=a.mode={},b=u.BlockCipherMode=m.extend({createEncryptor:function createEncryptor(t,a){return this.Encryptor.create(t,a)},createDecryptor:function createDecryptor(t,a){return this.Decryptor.create(t,a)},init:function init(t,a){this._cipher=t,this._iv=a}}),E=C.CBC=function(){var t=b.extend();function xorBlock(t,a,u){var m,h=this._iv;h?(m=h,this._iv=void 0):m=this._prevBlock;for(var g=0;g<u;g++)t[a+g]^=m[g]}return t.Encryptor=t.extend({processBlock:function processBlock(t,a){var u=this._cipher,m=u.blockSize;xorBlock.call(this,t,a,m),u.encryptBlock(t,a),this._prevBlock=slice(t).call(t,a,a+m)}}),t.Decryptor=t.extend({processBlock:function processBlock(t,a){var u=this._cipher,m=u.blockSize,h=slice(t).call(t,a,a+m);u.decryptBlock(t,a),xorBlock.call(this,t,a,m),this._prevBlock=h}}),t}(),k=(a.pad={}).Pkcs7={pad:function pad(t,a){for(var u=4*a,m=u-t.sigBytes%u,g=m<<24|m<<16|m<<8|m,M=[],I=0;I<m;I+=4)M.push(g);var S=h.create(M,m);concat(t).call(t,S)},unpad:function unpad(t){var a=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=a}};u.BlockCipher=T.extend({cfg:T.cfg.extend({mode:E,padding:k}),reset:function reset(){var t;T.reset.call(this);var a=this.cfg,u=a.iv,m=a.mode;this._xformMode==this._ENC_XFORM_MODE?t=m.createEncryptor:(t=m.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,u&&u.words):(this._mode=t.call(m,this,u&&u.words),this._mode.__creator=t)},_doProcessBlock:function _doProcessBlock(t,a){this._mode.processBlock(t,a)},_doFinalize:function _doFinalize(){var t,a=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(a.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),a.unpad(t)),t},blockSize:4});var R=u.CipherParams=m.extend({init:function init(t){this.mixIn(t)},toString:function toString(t){return(t||this.formatter).stringify(this)}}),A=(a.format={}).OpenSSL={stringify:function stringify(t){var a,u,m,g=t.ciphertext,M=t.salt;M?a=concat(u=concat(m=h.create([1398893684,1701076831])).call(m,M)).call(u,g):a=g;return a.toString(I)},parse:function parse(t){var a,u=I.parse(t),m=u.words;return 1398893684==m[0]&&1701076831==m[1]&&(a=h.create(slice(m).call(m,2,4)),splice(m).call(m,0,4),u.sigBytes-=16),R.create({ciphertext:u,salt:a})}},w=u.SerializableCipher=m.extend({cfg:m.extend({format:A}),encrypt:function encrypt(t,a,u,m){m=this.cfg.extend(m);var h=t.createEncryptor(u,m),g=h.finalize(a),M=h.cfg;return R.create({ciphertext:g,key:u,iv:M.iv,algorithm:t,mode:M.mode,padding:M.padding,blockSize:t.blockSize,formatter:m.format})},decrypt:function decrypt(t,a,u,m){return m=this.cfg.extend(m),a=this._parse(a,m.format),t.createDecryptor(u,m).finalize(a.ciphertext)},_parse:function _parse(t,a){return"string"==typeof t?a.parse(t,this):t}}),N=(a.kdf={}).OpenSSL={execute:function execute(t,a,u,m){var g;m||(m=h.random(8));var M=S.create({keySize:a+u}).compute(t,m),I=h.create(slice(g=M.words).call(g,a),4*u);return M.sigBytes=4*a,R.create({key:M,iv:I,salt:m})}},x=u.PasswordBasedCipher=w.extend({cfg:w.cfg.extend({kdf:N}),encrypt:function encrypt(t,a,u,m){var h=(m=this.cfg.extend(m)).kdf.execute(u,t.keySize,t.ivSize);m.iv=h.iv;var g=w.encrypt.call(this,t,a,h.key,m);return g.mixIn(h),g},decrypt:function decrypt(t,a,u,m){m=this.cfg.extend(m),a=this._parse(a,m.format);var h=m.kdf.execute(u,t.keySize,t.ivSize,a.salt);return m.iv=h.iv,w.decrypt.call(this,t,a,h.key,m)}})}()}(jf);var ty=jf,ry=ty.lib.StreamCipher,ny=ty.algo,ay=ny.RC4=ry.extend({_doReset:function _doReset(){for(var t=this._key,a=t.words,u=t.sigBytes,m=this._S=[],h=0;h<256;h++)m[h]=h;h=0;for(var g=0;h<256;h++){var M=h%u,I=a[M>>>2]>>>24-M%4*8&255;g=(g+m[h]+I)%256;var S=m[h];m[h]=m[g],m[g]=S}this._i=this._j=0},_doProcessBlock:function _doProcessBlock(t,a){t[a]^=generateKeystreamWord.call(this)},keySize:8,ivSize:0});function generateKeystreamWord(){for(var t=this._S,a=this._i,u=this._j,m=0,h=0;h<4;h++){u=(u+t[a=(a+1)%256])%256;var g=t[a];t[a]=t[u],t[u]=g,m|=t[(t[a]+t[u])%256]<<24-8*h}return this._i=a,this._j=u,m}ty.RC4=ry._createHelper(ay);var iy=ny.RC4Drop=ay.extend({cfg:ay.cfg.extend({drop:192}),_doReset:function _doReset(){ay._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)generateKeystreamWord.call(this)}});ty.RC4Drop=ry._createHelper(iy);var oy=jf.RC4,sy=function(){function V2NIMSettingPushImpl(t,a){var u=this;this.offlinePushPlugin=void 0,this.offlinePushConfig=void 0,this.authConfig=void 0,this.aosPushInfo=void 0,this.appBackgroundOptions={badge:0,isBackground:!1},this.setTokenAndBackgroundStateAfterLogin=function(t){u.aosPushInfo=t,u.logger.log("OfflinePushService: setToken, deviceClientId:",null==t?void 0:t.clientId),u.offlinePushPlugin&&(u.logger.log("OfflinePushService: setToken plugin is provided"),u.logger.log("OfflinePushService: setToken pushType is: ",t&&t.pushType),u.regToken(),u.core.sendCmd("v2SetAppBackground",{isBackground:u.appBackgroundOptions.isBackground,badge:u.appBackgroundOptions.badge||0}))},this.core=t,this.service=a,this.logger=t.logger}var t=V2NIMSettingPushImpl.prototype;return t.getRNDeviceInfo=function getRNDeviceInfo(){var t,a=this;return this.logger.log("OfflinePushService:getDeviceInfo start"),null===(t=this.offlinePushPlugin)||void 0===t||t.init(Vn(this.authConfig),(function(t,u,m){if(a.logger.log("OfflinePushService:: type: "+t+", tokenName: "+u+", token: "+m),m){var h="",g=uu.getSystemInfo()||{},M=g.os?g.os.toLowerCase():"";a.aosPushInfo&&a.aosPushInfo.pushType?h=a.aosPushInfo.pushType:"ios"===M?h="":"android"===M&&(h="8"),a.pushTokenToServer(h,m)}else a.logger.warn("OfflinePushService:: token is empty. Please check your parameters")})),new $i((function(t,u){var m;null===(m=a.offlinePushPlugin)||void 0===m||m.getDeviceInfo((function(m){try{a.logger.log("OfflinePushService:getDeviceInfo result "+(m?Vn(m):"")),t(JSON.parse(m))}catch(t){u(new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"OfflinePushService:getDeviceInfo error"}}))}})),po((function(){u(new Wl({code:jl.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"OfflinePushService:getDeviceInfo timeout"}}))}),2e3)}))},t.pushTokenToServer=function pushTokenToServer(t,a){var u,m,h,g,M,I,S,T,C="",b=this.offlinePushConfig;switch(t){case"5":C=null===(u=null==b?void 0:b.miPush)||void 0===u?void 0:u.certificateName;break;case"6":C=null===(m=null==b?void 0:b.hwPush)||void 0===m?void 0:m.certificateName;break;case"7":C=null===(h=null==b?void 0:b.mzPush)||void 0===h?void 0:h.certificateName;break;case"8":C=null===(g=null==b?void 0:b.fcmPush)||void 0===g?void 0:g.certificateName;break;case"9":C=null===(M=null==b?void 0:b.vivoPush)||void 0===M?void 0:M.certificateName;break;case"10":C=null===(I=null==b?void 0:b.oppoPush)||void 0===I?void 0:I.certificateName;break;case"11":C=null===(S=null==b?void 0:b.honorPush)||void 0===S?void 0:S.certificateName;break;default:C=null===(T=null==b?void 0:b.apns)||void 0===T?void 0:T.certificateName}if(""===C||void 0===C)this.logger.warn("OfflinePushService:: certificate name is empty for push type: ",t);else try{if("UNIAPP"===uu.platform){var E=$f.parse("557d1e3cafa43e2589a588270c53d56f"),k=$f.stringify(oy.decrypt(a,E));this.logger.log("OfflinePushService:: token",k),this.core.sendCmd("v2SetDeviceToken",{certificateName:C,pushDeviceToken:k,pushkit:0})}else this.core.sendCmd("v2SetDeviceToken",{certificateName:C,pushDeviceToken:a,pushkit:0})}catch(t){return this.logger.log("OfflinePushService:: decrypt error",t),void this.logger.warn("OfflinePushService:: token before decrypt",a)}},t.regToken=function regToken(){var t=this,a=uu.getSystemInfo()||{},u=a.os?a.os.toLowerCase():"";if(this.logger.log("OfflinePushService: os",u),"ios"===u||"android"===u)if(!this.offlinePushPlugin||"UNIAPP"===uu.platform&&"function"!=typeof this.offlinePushPlugin.getDeviceToken||"React Native"===uu.platform&&"android"===u&&"function"!=typeof this.offlinePushPlugin.init||"React Native"===uu.platform&&"ios"===u&&"function"!=typeof this.offlinePushPlugin.checkPermissions)this.logger.warn("OfflinePushService: plugin is not correct, please check your plugin according to Yunxin Official Documentation");else{var m;if("React Native"===uu.platform&&uu.envPayload.AppState)uu.envPayload.AppState.addEventListener("change",bind$1(m=this.handleRNAppStateChange).call(m,this));var h="";this.aosPushInfo&&this.aosPushInfo.pushType?h=this.aosPushInfo.pushType:"ios"===u?h="":"android"===u&&(h="8"),this.logger.log("OfflinePushService:: prepare to get device token. suggestPushType: "+h),this.logger.log("OfflinePushService push config",Vn(this.authConfig,null,2),"platform",uu.platform),"UNIAPP"===uu.platform?this.offlinePushPlugin.getDeviceToken({suggestPushType:h,config:this.authConfig},(function(a){a?(t.logger.log("OfflinePushService:: token is :"+a),t.pushTokenToServer(h,a)):t.logger.warn("OfflinePushService:: token is empty. Please check your parameters")})):"React Native"===uu.platform&&"android"===u?(this.logger.log("OfflinePushService:: onLogin",this.core.account,typeof h,h),this.offlinePushPlugin.onLogin(this.core.account,Bu(h),!1,"")):"React Native"===uu.platform&&"ios"===u?this.offlinePushPlugin.checkPermissions((function(){t.logger.log("OfflinePushService addEventListener requestPermissions");try{t.offlinePushPlugin.requestPermissions()}catch(a){t.logger.log("OfflinePushService:: requestPermissions error",a)}t.offlinePushPlugin.addEventListener("register",(function(a){t.logger.log("OfflinePushService:: ios token: "+a),t.pushTokenToServer(h,a)})),t.offlinePushPlugin.addEventListener("registrationError",(function(a){t.logger.log("OfflinePushService:: ios registerError",a)}))})):this.logger.error("OfflinePushService:: platform is not supported. Please check your parameters. Platform: "+uu.platform+". os: "+u)}else this.logger.warn("OfflinePushService: only Android or IOS support offline push")},t.handleRNAppStateChange=function handleRNAppStateChange(t){this.logger.log("push::handleAppStateChange: pushConfig ios/aos; state: "+t),this.appBackgroundOptions={badge:this.core.V2NIMConversationService.getTotalUnreadCount(),isBackground:"background"===t||"inactive"===t},this.setAppBackground(this.appBackgroundOptions.isBackground,this.appBackgroundOptions.badge)},t.setOfflinePushConfig=function setOfflinePushConfig(t,a){var u,m,h,g,M,I,S,T,C,b,E,k,R,A,w,N,x,O,P,L,V,U,D,q,B,G,H,j,$,z,W,K,Y,Q,J,X;this.logger.log("setOfflinePushConfig","plugin",t,"config",a),this.offlinePushPlugin=t,this.offlinePushConfig=a,this.authConfig={xmAppId:null===(m=null===(u=this.offlinePushConfig)||void 0===u?void 0:u.miPush)||void 0===m?void 0:m.appId,xmAppKey:null===(g=null===(h=this.offlinePushConfig)||void 0===h?void 0:h.miPush)||void 0===g?void 0:g.appKey,xmCertificateName:null===(I=null===(M=this.offlinePushConfig)||void 0===M?void 0:M.miPush)||void 0===I?void 0:I.certificateName,hwAppId:null===(T=null===(S=this.offlinePushConfig)||void 0===S?void 0:S.hwPush)||void 0===T?void 0:T.appId,hwCertificateName:null===(b=null===(C=this.offlinePushConfig)||void 0===C?void 0:C.hwPush)||void 0===b?void 0:b.certificateName,oppoAppId:null===(k=null===(E=this.offlinePushConfig)||void 0===E?void 0:E.oppoPush)||void 0===k?void 0:k.appId,oppoAppKey:null===(A=null===(R=this.offlinePushConfig)||void 0===R?void 0:R.oppoPush)||void 0===A?void 0:A.appKey,oppoAppSecret:null===(N=null===(w=this.offlinePushConfig)||void 0===w?void 0:w.oppoPush)||void 0===N?void 0:N.secret,oppoCertificateName:null===(O=null===(x=this.offlinePushConfig)||void 0===x?void 0:x.oppoPush)||void 0===O?void 0:O.certificateName,vivoAppId:null===(L=null===(P=this.offlinePushConfig)||void 0===P?void 0:P.vivoPush)||void 0===L?void 0:L.appId,vivoAppKey:null===(U=null===(V=this.offlinePushConfig)||void 0===V?void 0:V.vivoPush)||void 0===U?void 0:U.appKey,vivoCertificateName:null===(q=null===(D=this.offlinePushConfig)||void 0===D?void 0:D.vivoPush)||void 0===q?void 0:q.certificateName,fcmCertificateName:null===(G=null===(B=this.offlinePushConfig)||void 0===B?void 0:B.fcmPush)||void 0===G?void 0:G.certificateName,mzAppId:null===(j=null===(H=this.offlinePushConfig)||void 0===H?void 0:H.mzPush)||void 0===j?void 0:j.appId,mzAppKey:null===(z=null===($=this.offlinePushConfig)||void 0===$?void 0:$.mzPush)||void 0===z?void 0:z.appKey,mzCertificateName:null===(K=null===(W=this.offlinePushConfig)||void 0===W?void 0:W.mzPush)||void 0===K?void 0:K.certificateName,apnsCertificateName:null===(Q=null===(Y=this.offlinePushConfig)||void 0===Y?void 0:Y.apns)||void 0===Q?void 0:Q.certificateName,honorCertificateName:null===(X=null===(J=this.offlinePushConfig)||void 0===J?void 0:J.honorPush)||void 0===X?void 0:X.certificateName}},t.setAppBackground=function setAppBackground(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return this.appBackgroundOptions={isBackground:t,badge:a||0},u.next=3,this.core.sendCmd("v2SetAppBackground",{isBackground:t,badge:a||0});case 3:case"end":return u.stop()}}),_callee,this)})))},V2NIMSettingPushImpl}(),cy=function(){function V2NIMSettingMuteImpl(t,a){var u=this;this.p2pMessageMuteModeChangeHandler=function(t,a){u.service.emit("onP2PMessageMuteModeChanged",t,a),u.hasUserService&&u.core.V2NIMUserService.model.setAccountMuteMode(t,a);var m=u.core.V2NIMConversationIdUtil.p2pConversationId(t),h=1===a;u.core.eventBus.emit("V2NIMSettingService/setMute",m,h)},this.core=t,this.service=a}var t=V2NIMSettingMuteImpl.prototype;return t.getConversationMuteStatus=function getConversationMuteStatus(t){if("string"!=typeof t)return!1;var a=this.core.V2NIMConversationIdUtil.parseConversationType(t),u=this.core.V2NIMConversationIdUtil.parseConversationTargetId(t);return 3===a?0!==this.getTeamMessageMuteMode(u,2):2===a?0!==this.getTeamMessageMuteMode(u,1):!(1!==a||!this.hasUserService)&&!!this.core.V2NIMUserService.model.muteList.has(u)},t.setTeamMessageMuteMode=function setTeamMessageMuteMode(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var m,h,g,M;return lu.wrap((function _callee$(I){for(;;)switch(I.prev=I.next){case 0:return m=2===a?"v2SuperTeamUpdateSelfMemberInfo":"v2TeamUpdateSelfMemberInfo",h={teamId:t,teamType:a,accountId:this.core.account,bits:u},I.next=4,this.core.sendCmd(m,{teamMember:h});case 4:this.core.V2NIMTeamService.memberModel.upsert(h),this.service.emit("onTeamMessageMuteModeChanged",t,a,u),g=1===a?this.core.V2NIMConversationIdUtil.teamConversationId(t):this.core.V2NIMConversationIdUtil.superTeamConversationId(t),M=this.getConversationMuteStatus(g),this.core.eventBus.emit("V2NIMSettingService/setMute",g,M);case 9:case"end":return I.stop()}}),_callee,this)})))},t.getTeamMessageMuteMode=function getTeamMessageMuteMode(t,a){var u;return"string"!=typeof t||"number"!=typeof a?0:this.hasTeamService?3&((null===(u=this.core.V2NIMTeamService.memberModel.getById(t,a,this.core.account))||void 0===u?void 0:u.bits)||0):0},t.getAllTeamMessageMuteMode=function getAllTeamMessageMuteMode(t){var a=this;if(!this.hasTeamService)return $i.resolve({});var u=this.core.V2NIMTeamService.memberModel.chooseList(t),m={};return forEach$1(u).call(u,(function(t){if(t.accountId===a.core.account){var u=t.bits||0;m[t.teamId]=3&u}})),$i.resolve(m)},t.setP2PMessageMuteMode=function setP2PMessageMuteMode(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.core.sendCmd("v2SetP2PMessageMuteMode",{accountId:t,muteMode:1===a});case 2:this.p2pMessageMuteModeChangeHandler(t,a);case 3:case"end":return u.stop()}}),_callee2,this)})))},t.getP2PMessageMuteMode=function getP2PMessageMuteMode(t){return this.hasUserService&&this.core.V2NIMUserService.model.muteList.has(t)?1:0},t.getP2PMessageMuteList=function getP2PMessageMuteList(){return this.hasUserService?$i.resolve(nu(this.core.V2NIMUserService.model.muteList)):$i.resolve([])},Ye(V2NIMSettingMuteImpl,[{key:"hasUserService",get:function get(){var t;return!!(null===(t=this.core.V2NIMUserService)||void 0===t?void 0:t.name)}},{key:"hasTeamService",get:function get(){var t;return!!(null===(t=this.core.V2NIMTeamService)||void 0===t?void 0:t.name)}}]),V2NIMSettingMuteImpl}(),ly=function(){function V2NIMSettingEventImpl(t,a){this.core=t,this.service=a,this.push=a.push,this.mute=a.mute}return V2NIMSettingEventImpl.prototype.setListener=function setListener(){var t,a,u,m=this;this.core.eventBus.on("V2NIMSettingService/updateBits",(function(t,a,u){m.service.emit("onTeamMessageMuteModeChanged",t,a,u)})),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",bind$1(t=this.push.setTokenAndBackgroundStateAfterLogin).call(t,this.push)),this.core.eventBus.on("v2NIMUserService/updateMuteList",bind$1(a=this.mute.p2pMessageMuteModeChangeHandler).call(a,this.mute)),this.core.eventBus.on("forwardReceive/v2NIMSettingService/setP2PMessageMuteMode",bind$1(u=this.mute.p2pMessageMuteModeChangeHandler).call(u,this.mute))},V2NIMSettingEventImpl}(),uy=function(t){function V2NIMSettingServiceImpl(a){var u;return(u=t.call(this,"V2NIMSettingService",a)||this).needToPushMobileOnDesktopOnline=!0,u.core._registerDep(gm,"V2NIMConversationIdUtil"),u.push=new sy(a,Qe(u)),u.mute=new cy(a,Qe(u)),u.event=new ly(a,Qe(u)),u.handler=new Hf(a,Qe(u)),"v2"!==u.core.options.apiVersion?Qe(u):(u.setListener(),registerParser({cmdMap:Bf,cmdConfig:Gf}),u)}wt(V2NIMSettingServiceImpl,t);var a=V2NIMSettingServiceImpl.prototype;return a.setListener=function setListener(){this.event.setListener()},a.emit=function emit(a){for(var u,m,h,g,M=this.name+"::emit "+a.toString(),I=arguments.length,S=new Array(I>1?I-1:0),T=1;T<I;T++)S[T-1]=arguments[T];return(u=this.logger).log.apply(u,concat(m=[""+M]).call(m,S)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,S))},a.getConversationMuteStatus=function getConversationMuteStatus(t){return this.mute.getConversationMuteStatus(t)},a.setTeamMessageMuteMode=function setTeamMessageMuteMode(t,a,u){if(!this.hasTeamService)throw new Wl({code:jl.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"setTeamMessageMuteMode: no team service"}});return this.checkV2(),validate(Bv,{teamId:t},"",!0),validate(Gv,{teamType:a},"",!0),validate(Lf,{muteMode:u},"",!0),this.mute.setTeamMessageMuteMode(t,a,u)},a.getTeamMessageMuteMode=function getTeamMessageMuteMode(t,a){return this.mute.getTeamMessageMuteMode(t,a)},a.getAllTeamMessageMuteMode=function getAllTeamMessageMuteMode(t){return this.checkV2(),this.checkLogin(),validate(Gv,{teamType:t},"",!0),this.mute.getAllTeamMessageMuteMode(t)},a.setP2PMessageMuteMode=function setP2PMessageMuteMode(t,a){if(this.checkV2(),validate(Vf,{accountId:t,muteMode:a},"",!0),t===this.core.account)throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"can not set mute mode for self"}});return this.mute.setP2PMessageMuteMode(t,a)},a.getP2PMessageMuteMode=function getP2PMessageMuteMode(t){return validate({accountId:{type:"string",required:!0,allowEmpty:!1}},{accountId:t},"",!0),this.mute.getP2PMessageMuteMode(t)},a.getP2PMessageMuteList=function getP2PMessageMuteList(){return this.mute.getP2PMessageMuteList()},a.setAppBackground=function setAppBackground(t,a){return this.checkV2(),validate({isBackground:{type:"boolean"},badge:{type:"number",required:!1}},{isBackground:t,badge:a},"",!0),this.push.setAppBackground(t,a)},a.setOfflinePushConfig=function setOfflinePushConfig(t,a){validate(Df,{config:a},"",!0),this.push.setOfflinePushConfig(t,a)},a.setPushMobileOnDesktopOnline=function setPushMobileOnDesktopOnline(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),validate({need:{type:"boolean",required:!1}},{need:t},"",!0),t=void 0===t||t,a.next=5,this.core.sendCmd("v2SetPushMobileOnDesktopOnline",{tag:{need:t}});case 5:this.needToPushMobileOnDesktopOnline=t,this.emit("onPushMobileOnDesktopOnline",t);case 7:case"end":return a.stop()}}),_callee,this)})))},a.getPushMobileOnDesktopOnline=function getPushMobileOnDesktopOnline(){return this.checkLogin(),$i.resolve(this.needToPushMobileOnDesktopOnline)},Ye(V2NIMSettingServiceImpl,[{key:"hasUserService",get:function get(){var t;return!!(null===(t=this.core.V2NIMUserService)||void 0===t?void 0:t.name)}},{key:"hasTeamService",get:function get(){var t;return!!(null===(t=this.core.V2NIMTeamService)||void 0===t?void 0:t.name)}}]),V2NIMSettingServiceImpl}(gp);_export({target:"Number",stat:!0},{isNaN:function isNaN(t){return t!=t}});var dy=j.Number.isNaN;function invert(t){t=t||{};var a={};for(var u in t)a[t[u]]=u;return a}var py,my=invert({none:0,normal:1,all:3}),hy={normal:0,advanced:1},gy=invert(hy),vy=invert({normal:0,owner:1,manager:2}),fy={noVerify:0,needVerify:1,rejectAll:2},yy=invert(fy),My={needVerify:0,noVerify:1},Iy=invert(My),_y={manager:0,all:1},Sy=invert(_y),Ty={manager:0,all:1},Cy=invert(Ty),by={manager:0,all:1},Ey=invert(by);function formatTeam(t){var a,u=["teamId"],m=["level","memberNum","memberUpdateTime","createTime","updateTime"],h=["valid","validToCurrentUser","mute"],g={type:gy,muteType:my,joinMode:yy,beInviteMode:Iy,inviteMode:Sy,updateTeamMode:Cy,updateExtMode:Ey};t.bits;var M=__rest(t,["bits"]);return forEach$1(u).call(u,(function(t){M[t]&&(M[t]=M[t].toString())})),forEach$1(m).call(m,(function(t){void 0!==M[t]&&(M[t]=Bu(M[t]))})),forEach$1(h).call(h,(function(t){void 0!==M[t]&&(M[t]=1===Bu(M[t]))})),forEach$1(a=Gt(g)).call(a,(function(t){void 0!==M[t]&&(M[t]=g[t][M[t]]||M[t])})),M}function formatTeams(t){return t&&t.length>0?map$6(t).call(t,(function(t){return formatTeam(t)})):[]}function generateTeam(t){var a,u=Ut({},t),m=["avatar","name","intro","announcement","ext"],h={type:hy,joinMode:fy,beInviteMode:My,inviteMode:_y,updateTeamMode:Ty,updateExtMode:by};return forEach$1(m).call(m,(function(t){void 0!==u[t]&&(u[t]=u[t].toString())})),forEach$1(a=Gt(h)).call(a,(function(t){void 0!==u[t]&&(u[t]=h[t][u[t]])})),u}function generatorTeamMemberForCmd(t){var a=["teamId","ext","account","nickInTeam"],u={};return void 0!==t.bitConfigMask&&(u.bits=Bu(t.bitConfigMask)),forEach$1(a).call(a,(function(a){t[a]&&(u[a]=t[a].toString())})),Object.prototype.hasOwnProperty.call(t,"nickInTeam")&&(u.nickInTeam=t.nickInTeam),u}function formatTeamMember(t){var a,u=["teamId"],m=["joinTime","updateTime","bitConfigMask"],h=["active","valid","mute"],g={type:vy},M=t.bits,I=__rest(t,["bits"]);return void 0!==M&&(I.muteTeam=1===Bu(M),I.bitConfigMask=M),I.id=I.teamId+"-"+I.account,forEach$1(u).call(u,(function(t){I[t]&&(I[t]=I[t].toString())})),forEach$1(m).call(m,(function(t){void 0!==I[t]&&(I[t]=Bu(I[t]))})),forEach$1(h).call(h,(function(t){void 0!==I[t]&&(I[t]=1===Bu(I[t]))})),forEach$1(a=Gt(g)).call(a,(function(t){void 0!==I[t]&&(I[t]=g[t][I[t]]||I[t])})),I}function formatTeamMembers(t){return t&&t.length>0?map$6(t).call(t,(function(t){return formatTeamMember(t)})):[]}function generatorMemberByTeam(t,a,u){return void 0===u&&(u="normal"),{id:t.teamId+"-"+a,teamId:t.teamId,account:a,type:u,nickInTeam:"",muteTeam:!1,mute:!1,joinTime:t.memberUpdateTime,updateTime:t.memberUpdateTime,active:!0,valid:!0}}function generatorMembersByTeam(t,a,u){return void 0===u&&(u="normal"),a&&a.length>0?map$6(a).call(a,(function(a){return generatorMemberByTeam(t,a,u)})):[]}function formatUser(t){var a=Ut({},t);return a.createTime&&(a.createTime=+a.createTime),a.updateTime&&(a.updateTime=+a.updateTime),a.gender&&(a.gender=py[+a.gender]),a}!function(t){t[t.unknown=0]="unknown",t[t.male=1]="male",t[t.female=2]="female"}(py||(py={}));var ky={"8_1":"createTeam","8_5":"addTeamMembers","8_6":"removeTeamMembers","8_7":"updateTeamInfo","8_8":"leaveTeam","8_9":"getTeamInfo","8_10":"getTeams","8_11":"getTeamMembers","8_12":"dismissTeam","8_13":"applyTeam","8_14":"passTeamApply","8_15":"rejectTeamApply","8_16":"addTeamManagers","8_17":"removeTeamManagers","8_18":"transferTeam","8_19":"updateMyMemberInfo","8_20":"updateNickInTeam","8_21":"acceptTeamInvite","8_22":"rejectTeamInvite","8_25":"muteTeamMember","8_27":"getMutedTeamMembers","8_28":"sendTeamMsgReceipt","8_29":"getTeamMsgReads","8_30":"getTeamMsgReadAccounts","8_31":"notifyTeamMsgReceipts","8_32":"muteTeam","8_33":"getTeamMemberInvitorAccid","8_34":"getTeamsById","8_101":"syncCreateTeam","8_109":"syncTeams","8_119":"syncUpdateTeamMember","8_126":"syncMyTeamMembers"},Ry={team:{teamId:1,name:3,type:4,owner:5,level:6,selfCustom:7,valid:8,memberNum:9,memberUpdateTime:10,createTime:11,updateTime:12,validToCurrentUser:13,intro:14,announcement:15,joinMode:16,bits:17,ext:18,serverExt:19,avatar:20,beInviteMode:21,inviteMode:22,updateTeamMode:23,updateExtMode:24,mute:100,muteType:101},teamMsgReceiptTag:{teamId:0,idServer:1,read:100,unread:101,idClient:102,account:103},teamMember:{teamId:1,account:3,type:4,nickInTeam:5,bits:7,active:8,valid:9,joinTime:10,updateTime:11,ext:12,mute:13,invitorAccid:14}},Ay=invertSerializeMap(Ry),wy={getTeamInfo:{sid:8,cid:9,service:"team",params:[{type:"Long",name:"teamId"}],response:[{type:"Property",name:"team",reflectMapper:Ay.team}]},getTeams:{sid:8,cid:10,service:"team",params:[{type:"Long",name:"timetag"}],response:[{type:"PropertyArray",name:"teams",reflectMapper:Ay.team},{type:"Long",name:"timetag"}],ignoreErrCodes:[803]},createTeam:{sid:8,cid:1,service:"team",params:[{type:"Property",name:"team",reflectMapper:Ry.team},{type:"StrArray",name:"accounts"},{type:"String",name:"ps"}],response:[{type:"Property",name:"team",reflectMapper:Ay.team},{type:"StrArray",name:"abortedAccidList"}]},sendTeamMsgReceipt:{sid:8,cid:28,service:"team",params:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:Ry.teamMsgReceiptTag}],response:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:Ay.teamMsgReceiptTag}]},getTeamMsgReads:{sid:8,cid:29,service:"team",params:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:Ry.teamMsgReceiptTag}],response:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:Ay.teamMsgReceiptTag}]},getTeamMsgReadAccounts:{sid:8,cid:30,service:"team",params:[{type:"Property",name:"teamMsgReceiptTag",reflectMapper:Ry.teamMsgReceiptTag}],response:[{type:"Property",name:"teamMsgReceipt",reflectMapper:Ay.teamMsgReceiptTag},{type:"StrArray",name:"readAccounts"},{type:"StrArray",name:"unreadAccounts"}]},notifyTeamMsgReceipts:{sid:8,cid:31,service:"team",response:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:Ay.teamMsgReceiptTag}]},dismissTeam:{sid:8,cid:12,service:"team",params:[{type:"Long",name:"teamId"}]},leaveTeam:{sid:8,cid:8,service:"team",params:[{type:"Long",name:"teamId"}]},transferTeam:{sid:8,cid:18,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"account"},{type:"Bool",name:"leave"}]},updateTeamInfo:{sid:8,cid:7,service:"team",params:[{type:"Property",name:"team",reflectMapper:Ry.team}],response:[{type:"Long",name:"id"},{type:"Long",name:"time"}]},getTeamsById:{sid:8,cid:34,service:"team",params:[{type:"LongArray",name:"teamIds"}],response:[{type:"PropertyArray",name:"teams",reflectMapper:Ay.team},{type:"LongArray",name:"tids"}],ignoreErrCodes:[816]},getTeamMembers:{sid:8,cid:11,service:"team",params:[{type:"Long",name:"teamId"},{type:"Long",name:"timetag"}],response:[{type:"Long",name:"teamId"},{type:"PropertyArray",name:"teamMembers",reflectMapper:Ay.teamMember},{type:"Long",name:"timetag"}]},getMutedTeamMembers:{sid:8,cid:27,service:"team",params:[{type:"Long",name:"teamId"}],response:[{type:"Long",name:"teamId"},{type:"PropertyArray",name:"teamMembers",reflectMapper:Ay.teamMember}]},addTeamMembers:{sid:8,cid:5,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"},{type:"String",name:"ps"},{type:"String",name:"attach"}],response:[{type:"Long",name:"time"},{type:"StrArray",name:"abortedAccidList"}]},removeTeamMembers:{sid:8,cid:6,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},applyTeam:{sid:8,cid:13,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"ps"}],response:[{type:"Property",name:"team",reflectMapper:Ay.team}]},addTeamManagers:{sid:8,cid:16,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},removeTeamManagers:{sid:8,cid:17,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},updateMyMemberInfo:{sid:8,cid:19,service:"team",params:[{type:"Property",name:"teamMember",reflectMapper:Ry.teamMember}]},updateNickInTeam:{sid:8,cid:20,service:"team",params:[{type:"Property",name:"teamMember",reflectMapper:Ry.teamMember}]},muteTeamMember:{sid:8,cid:25,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"account"},{type:"Int",name:"mute"}]},getTeamMemberInvitorAccid:{sid:8,cid:33,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}],response:[{type:"StrStrMap",name:"accountsMap"}]},muteTeam:{sid:8,cid:32,service:"team",params:[{type:"Long",name:"teamId"},{type:"Int",name:"mute"}]},passTeamApply:{sid:8,cid:14,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},rejectTeamApply:{sid:8,cid:15,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},acceptTeamInvite:{sid:8,cid:21,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},rejectTeamInvite:{sid:8,cid:22,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},syncTeams:{sid:8,cid:109,service:"team",response:[{type:"Long",name:"timetag"},{type:"PropertyArray",name:"teams",reflectMapper:Ay.team}]},syncCreateTeam:{sid:8,cid:101,service:"team",response:[{type:"Property",name:"team",reflectMapper:Ay.team}]},syncUpdateTeamMember:{sid:8,cid:119,service:"team",response:[{type:"Property",name:"teamMember",reflectMapper:Ay.teamMember}]},syncMyTeamMembers:{sid:8,cid:126,ext:"sync",service:"team",response:[{type:"PropertyArray",name:"teamMembers",entity:"teamMember",reflectMapper:Ay.teamMember},{type:"Long",name:"timetag"}]}},Ny={"3_7":"getUsersNameCardFromServer","3_10":"updateMyNameCard","3_109":"syncMyNameCard","3_110":"onUpdateMyNameCard","3_3":"setBlack","3_103":"onUpdateBlackList","3_5":"setMute","3_105":"onUpdateMuteList","3_8":"syncRelations"},xy={user:{account:1,nick:3,avatar:4,signature:5,gender:6,email:7,birth:8,tel:9,ext:10,createTime:12,updateTime:13},relationMember:{account:0,isMuted:1,isBlack:2,createTime:3,updateTime:4}},Oy=invertSerializeMap(xy),Py={syncMyNameCard:{sid:3,cid:109,service:"user",response:[{type:"Property",name:"user",reflectMapper:Oy.user},{type:"Long",name:"timetag"}]},setBlack:{service:"user",sid:3,cid:3,params:[{type:"String",name:"account"},{type:"Bool",name:"isAdd"}]},onUpdateBlackList:{service:"user",sid:3,cid:103,response:[{type:"String",name:"account"},{type:"Bool",name:"isAdd"}]},setMute:{service:"user",sid:3,cid:5,params:[{type:"String",name:"account"},{type:"Bool",name:"isAdd"}]},onUpdateMuteList:{service:"user",sid:3,cid:105,response:[{type:"String",name:"account"},{type:"Bool",name:"isAdd"}]},syncRelations:{service:"user",sid:3,cid:8,params:[{type:"Long",name:"timetag"}],response:[{type:"PropertyArray",name:"list",reflectMapper:Oy.relationMember},{type:"Long",name:"timetag"}]},getUsersNameCardFromServer:{service:"user",sid:3,cid:7,params:[{type:"StrArray",name:"accounts"}],response:[{type:"PropertyArray",name:"users",reflectMapper:Oy.user}]},updateMyNameCard:{service:"user",sid:3,cid:10,params:[{type:"Property",name:"user",reflectMapper:xy.user}],response:[{type:"Long",name:"timetag"}]},onUpdateMyNameCard:{service:"user",sid:3,cid:110,response:[{type:"Property",name:"user",reflectMapper:Oy.user}]}},Ly={needPush:{type:"boolean",required:!1},needPushBadge:{type:"boolean",required:!1},needPushNick:{type:"boolean",required:!1},pushContent:{type:"string",required:!1},pushPayload:{type:"string",required:!1},needForcePush:{type:"boolean",required:!1},forcePushIDsList:{type:"string",allowEmpty:!1,required:!1},forcePushContent:{type:"string",allowEmpty:!1,required:!1}},Vy={function:{type:"string",required:!1},topic:{type:"string",required:!1},customContent:{type:"string",required:!1},account:{type:"string",required:!1}};function _createForOfIteratorHelperLoose$4(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$4(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$4(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$4(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var Uy={subType:{type:"string"},setting:{resendFlag:{type:"boolean"},envConfig:{type:"string"},needSaveHistory:{type:"boolean"},needRoaming:{type:"boolean"},needOffline:{type:"boolean"},needSelfSync:{type:"boolean"},needRouted:{type:"boolean"},needUpdateSession:{type:"boolean"},isMuted:{type:"boolean"}},antiSpamInfo:{needAntiSpam:{type:"boolean"},antiSpamContent:{type:"string"},antiSpamBIZID:{type:"string"},clientAntispamHitting:{type:"boolean"},antiSpamUsingYidun:{type:"boolean"},yidunCallbackURL:{type:"string"},yidunAntiCheating:{type:"string"},yidunAntiSpamExtension:{type:"string"},yidunAntiSpamResult:{type:"string"}},pushInfo:Ly,robotInfo:Vy,teamSpecializationInfo:{needACK:{type:"boolean"},isACKSent:{type:"boolean"},ackSnapshot:{type:"number"}},threadMessageInfo:{replyMsgFromAccount:{type:"string"},replyMsgToAccount:{type:"string"},replyMsgTime:{type:"number"},replyMsgIdServer:{type:"string"},replyMsgIdClient:{type:"string"},threadMsgFromAccount:{type:"string"},threadMsgToAccount:{type:"string"},threadMsgTime:{type:"number"},threadMsgIdServer:{type:"string"},threadMsgIdClient:{type:"string"}}},Dy={0:"addTeamMembers",1:"removeTeamMembers",2:"leaveTeam",3:"updateTeam",4:"dismissTeam",5:"passTeamApply",6:"transferTeam",7:"addTeamManagers",8:"removeTeamManagers",9:"acceptTeamInvite",10:"updateTeamMemberMute",101:"netcallMiss",102:"netcallBill",103:"netcallReject",401:"addSuperTeamMembers",402:"removeSuperTeamMembers",403:"leaveSuperTeam",404:"updateSuperTeam",405:"dismissSuperTeam",406:"transferSuperTeam",407:"addSuperTeamManagers",408:"removeSuperTeamManagers",409:"updateSuperTeamMembersMute",410:"passSuperTeamApply",411:"acceptSuperTeamInvite"};function getSessionId(t,a){return Kd[t.scene]+"-"+(t.to===a?t.from:t.to)}function msgFlow(t,a){return t.from===a?t.to===a?"in":"out":"in"}function formatMsg$1(t,a){var u=a.account,m=a.featureValue,h=a.statusValue,g=a.sessionAck,M=a.msgReceiptTime,I=Kd[t.scene],S=t.to===u?t.from:t.to,T=Jd.default,C=Qd.unread;Bu(t.isInBlackList)>0?(C=Qd.refused,delete t.isInBlackList):C=t.from===u?M&&M>=+t.time?Qd.receipt:Qd.sent:g&&g>=+t.time?Qd.read:Qd.unread;var b=Ut(Ut({},format(Uy,t)),{scene:I,type:Wd[t.type],fromClientType:Yd[t.fromClientType],flow:msgFlow(t,u),target:S,to:t.to,from:t.from,time:t.time?+t.time:void 0,userUpdateTime:t.userUpdateTime?+t.userUpdateTime:void 0,idClient:t.idClient,sessionId:I+"-"+S,status:Qd[h||C],feature:Jd[m||T]});if("string"==typeof b.attach)try{b.attach=JSON.parse(b.attach)}catch(t){}return"notification"===b.type&&(b.attach=b.attach?function formatNotificationAttach(t){var a,u={};if(u.type=Dy[t.id]||t.id,!t.data)return u;var m,h={ids:"accounts",id:"account",attach:"custom",channel:"channelId",calltype:"netcallType",mute:"mute",duration:"duration",time:"time",from:"from",ext:"ext"},g=t.data;return forEach$1(a=Gt(h)).call(a,(function(t){void 0!==g[t]&&(u[h[t]]=g[t])})),g.tinfo&&(u.team=formatTeam(deserialize(g.tinfo,Ay.team))),g.uinfos&&(u.users=map$6(m=g.uinfos).call(m,(function(t){return formatUser(deserialize(t,Oy.user))}))),void 0!==g.mute&&(u.mute=1===Bu(g.mute)),u}(b.attach):{}),b}function formatMsgs$1(t,a){return t&&t.length>0?removeDupMsgsByIdClient(map$6(t).call(t,(function(t){return formatMsg$1(t,a)}))):[]}function removeDupMsgsByIdClient(t){for(var a,u,m={},h=_createForOfIteratorHelperLoose$4(t);!(u=h()).done;){var g=u.value,M=m[g.idClient];M&&M.time>g.time||(m[g.idClient]=g)}return map$6(a=Gt(m)).call(a,(function(t){return m[t]}))}function processPushInfoInMsg(t,a){void 0===a&&(a=!0);var u=Ut({},t);if(u.pushInfo&&a){for(var m in u.pushInfo)"boolean"==typeof u.pushInfo[m]?u[m]=u.pushInfo[m]?1:0:u[m]=u.pushInfo[m];delete u.pushInfo}return u.scene===Kd.team&&u.needForcePush&&(u.forcePushContent=u.forcePushContent||u.pushContent,u.forcePushIDsList=u.forcePushIDsList?u.forcePushIDsList:"#%@all@%#"),u}function generatorMsgForCmd$1(t,a,u,m){t.onSendBefore,t.onUploadStart,t.onUploadDone;var h=t.replyMsg,g=__rest(t,["onSendBefore","onUploadStart","onUploadDone","replyMsg"]),M=Ut(Ut({},formatReverse(Uy,g)),{scene:Kd[t.scene],type:Wd[t.type],from:a,fromClientType:16,fromDeviceId:u,fromNick:null==m?void 0:m.nick,userUpdateTime:null==m?void 0:m.updateTime,status:Qd[Qd.sending]});if(M.idClient=M.resendFlag?t.idClient:Gu(),!M.idClient)throw new Ql("idClient is required to resend a message","idClient","required");return M=processPushInfoInMsg(M,!1),h&&(M.replyMsgFromAccount=h.from,M.replyMsgToAccount=h.to,M.replyMsgTime=+h.time,M.replyMsgIdServer=h.idServer,M.replyMsgIdClient=h.idClient,M.threadMsgFromAccount=h.from,M.threadMsgToAccount=h.to,M.threadMsgTime=+h.time,M.threadMsgIdServer=h.idServer,M.threadMsgIdClient=h.idClient,h.threadMessageInfo&&h.threadMessageInfo.threadMsgIdServer&&(M.threadMsgFromAccount=h.threadMessageInfo.threadMsgFromAccount,M.threadMsgToAccount=h.threadMessageInfo.threadMsgToAccount,M.threadMsgTime=h.threadMessageInfo.threadMsgTime,M.threadMsgIdServer=h.threadMessageInfo.threadMsgIdServer,M.threadMsgIdClient=h.threadMessageInfo.threadMsgIdClient)),M}function formatDeletedMsgs(t,a){return map$6(t).call(t,(function(t){var u;return u=a||(dy(Bu(t.scene))?t.scene:1===Bu(t.scene)?"p2p":"team"),{deletedTime:Bu(t.time),from:t.from,idClient:t.deletedIdClient||t.idClient,idServer:t.deletedIdServer||t.idServer,scene:u,time:Bu(t.deletedMsgCreateTime),to:t.to,ext:"string"==typeof t.ext?t.ext:null}}))}function reverse(t){for(var a=[],u=(t=t||[]).length-1;u>=0;u--)a.push(t[u]);return a}var qy,By,Fy,Gy=function(){function ModuleService(t){this.core=t}return ModuleService.prototype.processBroadcastMsg=function processBroadcastMsg(t){var a=map$6(t).call(t,(function(t){return Ut(Ut({},t),{time:Bu(t.time)})}));return this.core.sendCmd("batchMarkRead",{sid:7,cid:17,ids:map$6(a).call(a,(function(t){return t.id}))}),a},ModuleService}(),Hy={needPush:{type:"boolean",required:!1},needPushBadge:{type:"boolean",required:!1},needPushNick:{type:"boolean",required:!1},pushContent:{type:"string",allowEmpty:!1,required:!1},pushPayload:{type:"string",allowEmpty:!1,required:!1}},jy={pushContent:8,pushPayload:9,needPush:107,needPushBadge:109,needPushNick:110},$y={"4_4":"syncOfflineMsgs","4_9":"syncRoamingMsgs","4_17":"syncRoamingMsgs","4_21":"syncDeleteSelfMsgs","7_1":"sendMsg","8_23":"getHistoryTeamMsgs","21_14":"getHistorySuperTeamMsgs","8_2":"sendTeamMsg","21_2":"sendSuperTeamMsg","7_11":"sendMsgReceipt","7_13":"recallMsg","7_24":"deleteSelfMsgs","21_17":"recallSuperTeamMsg","7_2":"onMsg","8_3":"onMsg","21_3":"onMsg","7_101":"onMsg","8_102":"onMsg","21_102":"onMsg","8_4":"nimOnTeamMsgs","4_16":"syncBroadcastMsg","7_17":"onBroadcastMsg","7_123":"onDeleteSelfMsg","7_124":"onDeleteSelfMsgs"},zy=Ut(Ut({scene:0,to:1,from:2,fromClientType:4,fromDeviceId:5,fromNick:6,time:7,type:8,body:9,attach:10,idClient:11,idServer:12,resendFlag:13,userUpdateTime:14,ext:15,needAntiSpam:21,antiSpamContent:22,antiSpamBIZID:23,clientAntispamHitting:24,antiSpamUsingYidun:25,needACK:26,yidunCallbackURL:27,needUpdateSession:28,replyMsgFromAccount:29,replyMsgToAccount:30,replyMsgTime:31,replyMsgIdServer:32,replyMsgIdClient:33,threadMsgFromAccount:34,threadMsgToAccount:35,threadMsgTime:36,threadMsgIdServer:37,threadMsgIdClient:38,isDeleted:39,callbackExt:40,subType:41,yidunAntiCheating:42,envConfig:43,yidunAntiSpamExtension:44,yidunAntiSpamResult:45,__clientExt:{id:46,converter:objectToJSONString,retConverter:stringToJSONObject},needSaveHistory:100,needRoaming:101,needSelfSync:102,isMuted:104,needRouted:105,isInBlackList:106,needOffline:108,isReplyMsg:111,ackSnapshot:112},{pushContent:17,pushPayload:16,forcePushIDsList:18,forcePushContent:19,needForcePush:20,needPush:107,needPushBadge:109,needPushNick:110}),{function:47,topic:48,customContent:49,account:50}),Wy={msg:zy,recallMsgTag:Ut({time:0,type:1,to:2,from:3,ps:4,attach:5,deletedIdClient:10,deletedIdServer:11,deleteMsgCreatetime:14,opeAccount:16,env:21},jy),deleteSelfMsgTag:{scene:1,from:2,to:3,idServer:4,idClient:5,deletedMsgCreateTime:6,time:7,ext:8},msgReceiptTag:{to:1,from:2,time:7,idClient:11},broadcastMsg:{id:1,fromAccid:2,time:4,body:5}},Ky=invertSerializeMap(Wy),Yy={sendMsg:{sid:7,cid:1,service:"msg",params:[{type:"Property",name:"msg",reflectMapper:Wy.msg}],response:[{type:"Property",name:"msg",reflectMapper:Ky.msg}],ignoreErrCodes:[7101]},sendTeamMsg:{sid:8,cid:2,service:"msg",params:[{type:"Property",name:"msg",reflectMapper:Wy.msg}],response:[{type:"Property",name:"msg",reflectMapper:Ky.msg}]},sendSuperTeamMsg:{sid:21,cid:2,service:"msg",params:[{type:"Property",name:"msg",reflectMapper:Wy.msg}],response:[{type:"Property",name:"msg",reflectMapper:Ky.msg}]},onMsg:{sid:7,cid:2,service:"msg",response:[{type:"Property",name:"msg",reflectMapper:Ky.msg}]},nimOnTeamMsgs:{sid:8,cid:4,service:"msg",response:[{type:"PropertyArray",name:"datas",reflectMapper:Ky.msg}]},getHistoryTeamMsgs:{sid:8,cid:23,service:"msg",params:[{type:"Long",name:"to"},{type:"Long",name:"beginTime"},{type:"Long",name:"endTime"},{type:"Long",name:"lastMsgId"},{type:"Int",name:"limit"},{type:"Bool",name:"reverse"},{type:"LongArray",name:"msgTypes"}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:Ky.msg}]},getHistorySuperTeamMsgs:{sid:21,cid:14,params:[{type:"Long",name:"to"},{type:"Long",name:"beginTime"},{type:"Long",name:"endTime"},{type:"Long",name:"lastMsgId"},{type:"Int",name:"limit"},{type:"Bool",name:"reverse"},{type:"LongArray",name:"msgTypes"}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:Ky.msg}],service:"msg"},recallMsg:{sid:7,cid:13,service:"msg",params:[{type:"Property",name:"recallMsgTag",reflectMapper:Wy.recallMsgTag}]},deleteSelfMsgs:{sid:7,cid:24,service:"msg",params:[{type:"PropertyArray",name:"deletedMsgs",reflectMapper:Wy.deleteSelfMsgTag}],response:[{type:"Long",name:"timetag"}]},recallSuperTeamMsg:{sid:21,cid:17,service:"msg",params:[{type:"Property",name:"recallMsgTag",reflectMapper:Wy.recallMsgTag}]},sendMsgReceipt:{sid:7,cid:11,service:"msg",params:[{type:"Property",name:"msgReceiptTag",reflectMapper:Wy.msgReceiptTag}],response:[{type:"Property",name:"msgReceiptTag",reflectMapper:Ky.msgReceiptTag}]},batchMarkRead:{sid:4,cid:5,service:"msg",hasPacketResponse:!1,params:[{type:"Byte",name:"sid"},{type:"Byte",name:"cid"},{type:"LongArray",name:"ids"}]},syncMsgReceipts:{sid:4,cid:12,service:"msg",response:[{type:"PropertyArray",name:"msgReceipts",reflectMapper:Ky.msgReceiptTag},{type:"Long",name:"timetag"}]},syncOfflineMsgs:{sid:4,cid:4,service:"msg",response:[{type:"PropertyArray",name:"msgs",reflectMapper:Ky.msg}]},syncRoamingMsgs:{sid:4,cid:9,service:"msg",response:[{type:"PropertyArray",name:"msgs",reflectMapper:Ky.msg}]},syncBroadcastMsg:{sid:4,cid:16,service:"msg",response:[{type:"PropertyArray",name:"msgs",reflectMapper:Ky.broadcastMsg}]},onBroadcastMsg:{sid:7,cid:17,service:"msg",response:[{type:"Property",name:"msg",reflectMapper:Ky.broadcastMsg}]},onDeleteSelfMsg:{sid:7,cid:123,service:"msg",response:[{type:"Property",name:"deletedMsg",reflectMapper:Ky.deleteSelfMsgTag}]},onDeleteSelfMsgs:{sid:7,cid:124,service:"msg",response:[{type:"PropertyArray",name:"deletedMsgs",reflectMapper:Ky.deleteSelfMsgTag}]},syncDeleteSelfMsgs:{sid:4,cid:21,service:"msg",response:[{type:"PropertyArray",name:"deletedMsgs",reflectMapper:Ky.deleteSelfMsgTag}]}};!function(t){t[t.none=0]="none",t[t.pass=1]="pass",t[t.decline=2]="decline",t[t.read=3]="read",t[t.deleted=4]="deleted",t[t.invalid=5]="invalid"}(qy||(qy={})),function(t){t[t.default=0]="default",t[t.leave=1]="leave",t[t.roam=2]="roam"}(By||(By={})),function(t){t[t.applyTeam=0]="applyTeam",t[t.rejectTeamApply=1]="rejectTeamApply",t[t.teamInvite=2]="teamInvite",t[t.rejectTeamInvite=3]="rejectTeamInvite",t[t.friendRequest=5]="friendRequest",t[t.deleteFriend=6]="deleteFriend",t[t.recallMsgP2p=7]="recallMsgP2p",t[t.recallMsgTeam=8]="recallMsgTeam",t[t.recallMsgSuperTeam=12]="recallMsgSuperTeam",t[t.deleteMsgP2pOneWay=13]="deleteMsgP2pOneWay",t[t.deleteMsgTeamOneWay=14]="deleteMsgTeamOneWay",t[t.applySuperTeam=15]="applySuperTeam",t[t.rejectSuperTeamApply=16]="rejectSuperTeamApply",t[t.superTeamInvite=17]="superTeamInvite",t[t.rejectSuperTeamInvite=18]="rejectSuperTeamInvite",t[t.customP2p=100]="customP2p",t[t.customTeam=101]="customTeam",t[t.customSuperTeam=103]="customSuperTeam"}(Fy||(Fy={}));var Qy={1:"addFriend",2:"applyFriend",3:"passFriendApply",4:"rejectFriendApply"};var Jy={setting:{needSaveOffline:{type:"boolean"},isRoutable:{type:"boolean"},envConfig:{type:"string"}},antiSpamInfo:{needAntiSpam:{type:"boolean"},antiSpamContent:{type:"boolean"}},pushInfo:Hy,recallMessageInfo:{idClient:{type:"string",rawKey:"deletedIdClient"},idServer:{type:"string",rawKey:"deletedIdServer"},createTime:{type:"number",rawKey:"deletedMsgCreateTime"},fromNick:{type:"string",rawKey:"deletedMsgFromNick"},opeAccount:{type:"string"}}};function formatSystemMessage(t,a,u){var m=+t.type,h=getEnumKeyByEnumValue(Fy,m);u=u||By.default;var g=Ut(Ut({},format(Jy,t)),{type:h,time:+t.time,to:t.to,from:t.from,idServer:t.idServer,state:qy[qy.none],feature:By[u]});if("0"===g.idServer&&g.setting&&(g.setting.needSaveOffline=!1),"string"==typeof g.attach)try{g.attach=JSON.parse(g.attach)}catch(t){a.error("formatSystemMessage: "+g.idServer+" parse attach error",t&&t.message)}return 5===m&&g.attach?(g.attach.type=Qy[+g.attach.vt],"passFriendApply"===g.attach.type?g.state=qy[qy.pass]:"rejectFriendApply"===g.attach.type&&(g.state=qy[qy.decline])):m<=3&&g.attach&&(g.attach=function formatTeamAttach(t){var a=t.attach,u=t.tinfo,m=__rest(t,["attach","tinfo"]);return m.ext=a,void 0!==u&&(m.team=formatTeam(deserialize(t.tinfo,Ay.team))),m}(g.attach)),g}function generatorSysMsgForCmd$1(t){var a=Ut({},t);return Ut(Ut({},formatReverse(Jy,a)),{type:Fy[a.type],to:a.to,attach:a.attach})}function getSceneFromRecallSysMsg(t){return t===Fy.recallMsgP2p?"p2p":t===Fy.recallMsgTeam?"team":t===Fy.recallMsgSuperTeam?"superTeam":""}var Xy=function(t){function MsgService(a){var u;return(u=t.call(this,"msg",a)||this).onV2SendMessage=function(t){var a=formatMsg$1(t,{account:u.core.account,featureValue:Jd.default});a.status=t.status,u.core.eventBus.emit("session/updateForNewMsg",a)},u.onV2ModifyMessage=function(t){var a,m=Kd[t.scene]+"-"+(t.to===u.core.account?t.from:t.to),h=null===(a=u.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:m}),g=formatMsg$1(t,h?{account:u.core.account,sessionAck:h.ack,msgReceiptTime:h.msgReceiptTime}:{account:u.core.account});u.core.eventBus.emit("session/updateForModifyMsg",g)},u.onV2RecallMsg=function(t){var a=formatDeletedMsgs([t],getSceneFromRecallSysMsg(+t.type));u.core.eventBus.emit("session/updateForDeletedMsg",a)},u.onV2DeleteSelfMsgs=function(t){var a=formatDeletedMsgs(t);u.core.eventBus.emit("session/updateForDeletedMsg",a)},u.service=new Gy(a),registerParser({cmdMap:$y,cmdConfig:Yy}),u.registerListener(),u}wt(MsgService,t);var a=MsgService.prototype;return a.registerListener=function registerListener(){this.core.eventBus.on("forwardReceive/msg/sendMsg",this.onV2SendMessage),this.core.eventBus.on("forwardReceive/msg/modifyMsg",this.onV2ModifyMessage),this.core.eventBus.on("forwardReceive/msg/recallMsg",this.onV2RecallMsg),this.core.eventBus.on("forwardReceive/msg/deleteSelfMsgs",this.onV2DeleteSelfMsgs)},a.sendTextMsg=function sendTextMsg(t){return validate({body:{type:"string",allowEmpty:!1}},t),this.sendMsg(Ut(Ut({},t),{type:"text"}))},a.sendTipMsg=function sendTipMsg(t){return validate({body:{type:"string",allowEmpty:!1}},t),this.sendMsg(Ut(Ut({},t),{type:"tip"}))},a.sendGeoLocationMsg=function sendGeoLocationMsg(t){return validate({attach:{type:"object",rules:{title:{type:"string",allowEmpty:!1},lat:{type:"number"},lng:{type:"number"}}}},t),this.sendMsg(Ut(Ut({},t),{type:"geo",attach:Vn(t.attach)}))},a.sendCustomMsg=function sendCustomMsg(t){return validate({attach:{type:"string",allowEmpty:!1}},t),this.sendMsg(Ut(Ut({},t),{type:"custom"}))},a.sendMsg=function sendMsg(t){var a,u=this;if(validate({scene:{type:"enum",values:getEnumKeys(Kd)},type:{type:"enum",values:getEnumKeys(Wd)},to:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1},setting:{type:"object",rules:{resendFlag:{type:"boolean",required:!1},needSaveHistory:{type:"boolean",required:!1},needRoaming:{type:"boolean",required:!1},needOffline:{type:"boolean",required:!1},needSelfSync:{type:"boolean",required:!1},needRouted:{type:"boolean",required:!1},needUpdateSession:{type:"boolean",required:!1}},required:!1},antiSpamInfo:{type:"object",required:!1,rules:{clientAntispamHitting:{type:"boolean",required:!1},antiSpamUsingYidun:{type:"boolean",required:!1}}},pushInfo:{type:"object",required:!1,rules:Ly},robotInfo:{type:"object",required:!1,rules:Vy},teamSpecializationInfo:{type:"object",required:!1,rules:{needACK:{type:"boolean",required:!1}}}},t),"team"===t.scene&&t.robotInfo&&!t.robotInfo.account)throw new Kl('When "scene" equals "team", account is required in robotInfo',{key:"account"},"required");var m,h="p2p"===t.scene?"sendMsg":"team"===t.scene?"sendTeamMsg":"sendSuperTeamMsg",g=generatorMsgForCmd$1(t,this.core.account,this.core.config.deviceId,null===(a=this.core.user)||void 0===a?void 0:a.myInfo),M=formatMsg$1(Ut(Ut({},g),{time:(new Date).getTime()}),{account:this.core.account,featureValue:Jd.default,statusValue:Qd.sending});try{t.onSendBefore&&t.onSendBefore(M)}catch(t){this.logger.error("sendMsg: options.onSendBefore error",t)}return this.core.eventBus.emit("session/updateForNewMsg",M),this.core.eventBus.emit("forwardSend/msg/sendMsg",g),this.core.sendCmd(h,{msg:g}).then((function(a){var h=a.content,I=a.error;if(m=h.msg,I)throw I;var S=formatMsg$1(Ut(Ut({},g),h.msg),{account:u.core.account,featureValue:Jd.default,statusValue:Qd.sent});return S.from===S.to&&u.markMsgsAck([S]),u.core.eventBus.emit("session/updateForNewMsg",S),u.core.eventBus.emit("forwardSend/msg/sendMsg",Ut(Ut({},generatorMsgForCmd$1(S,S.from,S.fromDeviceId)),{idClient:S.idClient,status:"sent"})),u.core.reporter.report("msgSend",{msgId:S.idServer,clientId:S.idClient,msgTime:S.time,fromAccid:"p2p"===t.scene?u.core.account:"",toAccid:S.to,type:Kd[S.scene],roomId:"",tid:"p2p"===t.scene?"":S.to,result:200,failReason:"",rt:eo()-M.time}),S})).catch((function(a){var h=formatMsg$1(Ut(Ut(Ut({},g),{time:(new Date).getTime()}),m),{account:u.core.account,featureValue:Jd.default,statusValue:7101===a.code?Qd.refused:Qd.sendFailed});throw a.msg=h,u.core.eventBus.emit("session/updateForNewMsg",h),u.core.eventBus.emit("forwardSend/msg/sendMsg",Ut(Ut({},generatorMsgForCmd$1(h,h.from,h.fromDeviceId)),{status:"sendFailed"})),u.core.reporter.report("msgSend",{msgId:h.idServer,clientId:h.idClient,msgTime:h.time,fromAccid:"p2p"===t.scene?u.core.account:"",toAccid:h.to,type:Kd[h.scene],roomId:"",tid:"p2p"===t.scene?"":h.to,result:null==a?void 0:a.code,failReason:(null==a?void 0:a.message)||"",rt:eo()-M.time}),a}))},a.resendMsg=function resendMsg(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:if(validate({msg:{type:"object",rules:{idClient:{type:"string",allowEmpty:!1}}}},t),a=t.msg,u=Ut(Ut({},a),{attach:a.attach?Vn(a.attach):void 0,setting:{resendFlag:!0}}),a.from===this.core.account){m.next=5;break}throw new Error("You can only resend messages that you sent: "+a.idClient);case 5:return m.abrupt("return",this.sendMsg(u));case 6:case"end":return m.stop()}}),_callee,this)})))},a.forwardMsg=function forwardMsg(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u;return lu.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:return validate({msg:{type:"object",rules:{idClient:{type:"string",allowEmpty:!1}}},scene:{type:"enum",values:getEnumKeys(Kd)},to:{type:"string",allowEmpty:!1}},t),a=t.msg,u=Ut(Ut({},a),{scene:t.scene,to:t.to,attach:a.attach?Vn(a.attach):void 0}),m.abrupt("return",this.sendMsg(u));case 4:case"end":return m.stop()}}),_callee2,this)})))},a.sendImageMsg=function sendImageMsg(t){return this.doSendFile(Ut(Ut({},t),{type:"image"}))},a.sendFileMsg=function sendFileMsg(t){return this.doSendFile(Ut(Ut({},t),{type:"file"}))},a.sendAudioMsg=function sendAudioMsg(t){return this.doSendFile(Ut(Ut({},t),{type:"audio"}))},a.sendVideoMsg=function sendVideoMsg(t){return this.doSendFile(Ut(Ut({},t),{type:"video"}))},a.doSendFile=function doSendFile(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:if(validate({scene:{type:"enum",values:getEnumKeys(Kd)},to:{type:"string",allowEmpty:!1},type:{type:"string",allowEmpty:!1},attach:{type:"object",rules:{url:{type:"string",allowEmpty:!1}},required:!1},maxSize:{type:"number",min:1,required:!1}},t),a=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:a=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",this.sendMsg(Ut(Ut({},t),{attach:Vn(a),type:t.type})));case 16:case"end":return u.stop()}}),_callee3,this,[[5,11]])})))},a.recallMsg=function recallMsg(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a,u,m,h,g,M;return lu.wrap((function _callee4$(I){for(;;)switch(I.prev=I.next){case 0:return validate({msg:{type:"object",rules:{idClient:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1},scene:{type:"enum",values:getEnumKeys(Kd)},time:{type:"number"}}},pushInfo:{type:"object",required:!1,rules:Hy},ps:{type:"string",allowEmpty:!1,required:!1}},t),a=t.msg,u={p2p:"recallMsg",team:"recallMsg",superTeam:"recallSuperTeamMsg"},m={p2p:7,team:8,superTeam:12},h=processPushInfoInMsg({time:a.time,type:m[a.scene],to:a.to,from:a.from,ps:t.ps,attach:t.attach,deletedIdClient:a.idClient,deletedIdServer:a.idServer,opeAccount:a.from,env:t.env,pushInfo:t.pushInfo}),I.next=7,this.core.sendCmd(u[a.scene],{recallMsgTag:h});case 7:return g=Ut({},a,{deletedMsgCreateTime:a.time}),M=formatDeletedMsgs([g]),this.core.eventBus.emit("session/updateForDeletedMsg",M),this.core.eventBus.emit("forwardSend/msg/recallMsg",h),I.abrupt("return",a);case 12:case"end":return I.stop()}}),_callee4,this)})))},a.deleteSelfMsgs=function deleteSelfMsgs(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a,u,m,h,g;return lu.wrap((function _callee5$(M){for(;;)switch(M.prev=M.next){case 0:return validate({msgs:{type:"array",rules:{scene:{type:"enum",values:["p2p","team"]},from:{type:"string",allowEmpty:!1},to:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1},idClient:{type:"string",allowEmpty:!1},time:{type:"number",allowEmpty:!1}}},ext:{type:"string",allowEmpty:!1,required:!1}},t),a=t.msgs,u=map$6(a).call(a,(function(a){return{scene:"p2p"===a.scene?1:2,from:a.from,to:a.to,idServer:a.idServer,idClient:a.idClient,deletedMsgCreateTime:a.time,ext:t.ext}})),M.next=5,this.core.sendCmd("deleteSelfMsgs",{deletedMsgs:u});case 5:return m=M.sent,h=map$6(u).call(u,(function(t){var a;return Ut({},t,{time:null===(a=null==m?void 0:m.content)||void 0===a?void 0:a.timetag})})),g=formatDeletedMsgs(h),this.core.eventBus.emit("session/updateForDeletedMsg",g),this.core.eventBus.emit("forwardSend/msg/deleteSelfMsgs",map$6(u).call(u,(function(t){var a;return Ut(Ut({},t),{time:null===(a=null==m?void 0:m.content)||void 0===a?void 0:a.timetag})}))),M.abrupt("return",g);case 11:case"end":return M.stop()}}),_callee5,this)})))},a.sendMsgReceipt=function sendMsgReceipt(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var m,h,g,M;return lu.wrap((function _callee6$(I){for(;;)switch(I.prev=I.next){case 0:if(validate({msg:{type:"object",rules:{idClient:{type:"string",allowEmpty:!1},target:{type:"string",allowEmpty:!1},time:{type:"number"}}}},t),"p2p"===(m=t.msg).scene&&"in"===m.flow){I.next=5;break}return this.logger.warn("Msg scene: "+m.scene+", flow: "+m.flow+" is not allowed to send msg receipt"),I.abrupt("return",void 0);case 5:return h={to:m.target,idClient:m.idClient,time:m.time},I.next=8,this.core.sendCmd("sendMsgReceipt",{msgReceiptTag:h});case 8:return g=I.sent,M=Bu(null===(u=null===(a=g.content)||void 0===a?void 0:a.msgReceiptTag)||void 0===u?void 0:u.time),I.abrupt("return",Ut(Ut({},h),{time:M?Math.min(M,h.time):h.time}));case 11:case"end":return I.stop()}}),_callee6,this)})))},a.sendTeamMsgReceipt=function sendTeamMsgReceipt(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var a;return lu.wrap((function _callee7$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamMsgReceipts:{type:"array",rules:{teamId:{type:"string",allowEmpty:!1},idClient:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1}},max:50}},t),a=t.teamMsgReceipts,this.core.sendCmd("sendTeamMsgReceipt",{teamMsgReceipts:a}),u.abrupt("return",void 0);case 4:case"end":return u.stop()}}),_callee7,this)})))},a.getTeamMsgReads=function getTeamMsgReads(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var u,m,h;return lu.wrap((function _callee8$(g){for(;;)switch(g.prev=g.next){case 0:return validate({teamMsgReceipts:{type:"array",rules:{teamId:{type:"string",allowEmpty:!1},idClient:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1}}}},t),u=t.teamMsgReceipts,g.next=4,this.core.sendCmd("getTeamMsgReads",{teamMsgReceipts:u});case 4:return m=g.sent,h=(h=null===(a=m.content)||void 0===a?void 0:a.teamMsgReceipts)?map$6(h).call(h,(function(t){return Ut(Ut({},t),{read:Bu(t.read),unread:Bu(t.unread)})})):[],g.abrupt("return",h);case 8:case"end":return g.stop()}}),_callee8,this)})))},a.getTeamMsgReadAccounts=function getTeamMsgReadAccounts(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var a,u;return lu.wrap((function _callee9$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamMsgReceipt:{type:"object",rules:{teamId:{type:"string",allowEmpty:!1},idClient:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1}}}},t),a=t.teamMsgReceipt,m.next=4,this.core.sendCmd("getTeamMsgReadAccounts",{teamMsgReceiptTag:a});case 4:return u=m.sent,m.abrupt("return",u.content);case 6:case"end":return m.stop()}}),_callee9,this)})))},a.markMsgsAck=function markMsgsAck(t){if(t&&t.length>0){var a=[],u=[];forEach$1(t).call(t,(function(t){"p2p"===t.scene&&"in"===t.flow?a.push(t):"team"===t.scene&&"in"===t.flow&&u.push(t)})),a.length>0&&this.core.sendCmd("batchMarkRead",{sid:7,cid:2,ids:map$6(a).call(a,(function(t){return t.idServer}))}),u.length>0&&this.core.sendCmd("batchMarkRead",{sid:8,cid:3,ids:map$6(u).call(u,(function(t){return t.idServer}))})}},a.onMsgHandler=function onMsgHandler(t){var a;if(t.error)this.logger.error("msgHandler::recvError",t.error);else{var u=fillIdServer(t,t.content.msg,"idServer"),m=getSessionId(u,this.core.account),h=null===(a=this.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:m}),g=formatMsg$1(u,h?{account:this.core.account,sessionAck:h.ack,msgReceiptTime:h.msgReceiptTime}:{account:this.core.account});this.logger.getDebugMode()?this.logger.debug("msgHandler::recvMsg",g.idClient,g.idServer,g):this.logger.log("msgHandler::recvMsg",g.idClient,g.idServer),this.markMsgsAck([g]),this.core.eventBus.emit("session/updateForNewMsg",g),"superTeam"===g.scene?this.core.eventBus.emit("sync/updateTimetag",{superTeamRoamingMsgs:g.time}):this.core.eventBus.emit("sync/updateTimetag",{roamingMsgs:g.time}),this.core.emit("msg",g),"notification"===g.type?this.core.eventBus.emit("team/onNotification",g):"out"!==g.flow&&this.doMsgReceiveReport(g,t),"notification"!==g.type&&this.core.user.checkUserUpdate(g)}},a.doMsgReceiveReport=function doMsgReceiveReport(t,a){if(t.from!==this.core.account){var u="p2p"===t.scene,m=get(t,"__clientExt.statistics.apiCallingTime")||0,h=get(t,"__clientExt.statistics.sendTime")||0,g=get(t,"__clientExt.statistics.attachUploadDuration")||0,M=this.core.timeOrigin.getNTPTime(),I=t.time,S=this.core.timeOrigin.checkNodeReliable(a.__receiveTimeNode)?this.core.timeOrigin.getNTPTime(a.__receiveTimeNode):M;this.core.reporter.report("msgReceive",{msgId:t.idServer,clientId:t.idClient,serverTime:I,receiveTime:S,fromAccid:u?t.from:"",toAccid:t.to,type:Kd[t.scene],tid:u?"":t.to,apiCallingTime:m,sendTime:h,attachUploadDuration:g,callbackTime:M,preHandleTime:M,result:200,failReason:"",rt:M-I})}},a.nimOnTeamMsgsHandler=function nimOnTeamMsgsHandler(t){var a,u=this;forEach$1(a=t.content.datas).call(a,(function(a){u.onMsgHandler(Ut({},t,{content:{msg:a}}))}))},a.syncRoamingMsgsHandler=function syncRoamingMsgsHandler(t){var a,u,m=t.content.msgs||[];if(0!==m.length){var h=getSessionId(m[0],this.core.account),g=null===(a=this.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:h}),M=(m=formatMsgs$1(m,g?{account:this.core.account,featureValue:Jd.roam,sessionAck:g.ack,msgReceiptTime:g.msgReceiptTime}:{account:this.core.account,featureValue:Jd.roam}))[0].time,I={timetag:M,sessionId:h,msgs:reverse(m)};"function"!=typeof(null===(u=this.core.sync)||void 0===u?void 0:u.getSyncDoneFlag)||this.core.sync.getSyncDoneFlag()||this.core.eventBus.emit("session/syncMsgs",I),this.core.emit("syncRoamingMsgs",I),"superTeam"===m[0].scene?this.core.eventBus.emit("sync/updateTimetag",{superTeamRoamingMsgs:M}):this.core.eventBus.emit("sync/updateTimetag",{roamingMsgs:M})}},a.syncOfflineMsgsHandler=function syncOfflineMsgsHandler(t){var a,u=this,m=t.content.msgs||[];if(0!==m.length){var h={},g=[];forEach$1(m).call(m,(function(t){var a=getSessionId(t,u.core.account),m=u.core.session.getSessionWithUncomplete({id:a}),M=formatMsg$1(t,m?{account:u.core.account,featureValue:Jd.leave,sessionAck:m.ack,msgReceiptTime:m.msgReceiptTime}:{account:u.core.account,featureValue:Jd.leave});g.push(M),h[M.sessionId]?h[M.sessionId].push(M):h[M.sessionId]=[M]})),this.markMsgsAck(g);var M=0;forEach$1(a=Gt(h)).call(a,(function(t){var a,m=sort(a=h[t]).call(a,(function(t,a){return a.time-t.time}));(m=removeDupMsgsByIdClient(m))[0].time>M&&(M=m[0].time);var g={timetag:m[0].time,sessionId:t,msgs:m};u.core.eventBus.emit("session/syncMsgs",g),u.core.emit("syncOfflineMsgs",g)})),this.core.eventBus.emit("sync/updateTimetag",{offlineMsgs:M})}},a.syncDeleteSelfMsgsHandler=function syncDeleteSelfMsgsHandler(t){var a,u=null===(a=t.content)||void 0===a?void 0:a.deletedMsgs;u&&u.length>0||this.logger.warn("syncDeleteSelfMsgs:: no msgs");var m=u[u.length-1].time;this.core.eventBus.emit("sync/updateTimetag",{deleteSelfMsgs:m})},a.onDeleteSelfMsgHandler=function onDeleteSelfMsgHandler(t){var a=formatDeletedMsgs([t.content.deletedMsg]);this.core.eventBus.emit("session/updateForDeletedMsg",a),this.core.emit("deleteSelfMsgs",a)},a.onDeleteSelfMsgsHandler=function onDeleteSelfMsgsHandler(t){var a=formatDeletedMsgs(t.content.deletedMsgs);this.core.eventBus.emit("session/updateForDeletedMsg",a),this.core.emit("deleteSelfMsgs",a)},a.onBroadcastMsgHandler=function onBroadcastMsgHandler(t){var a=t.content.msg,u=this.service.processBroadcastMsg([a]);this.core.emit("broadcastMsgs",u)},a.syncBroadcastMsgHandler=function syncBroadcastMsgHandler(t){var a=t.content.msgs,u=this.service.processBroadcastMsg(a);this.core.emit("broadcastMsgs",u)},MsgService}(vp),Zy={"5_1":"sync"},eM={sync:{sid:5,cid:1,service:"sync",hasPacketTimer:!1,params:[{type:"Property",name:"sync",reflectMapper:{myInfo:1,offlineMsgs:2,teams:3,roamingMsgs:7,relations:9,friends:11,friendUsers:13,msgReceipts:14,myTeamMembers:15,donnop:16,recallMsg:17,sessionAck:18,broadcastMsgs:20,avSignal:21,superTeams:22,mySuperTeamMembers:23,superTeamRoamingMsgs:24,deleteSuperTeamMsg:25,superTeamSessionAck:26,deleteSelfMsgs:27,stickTopSessions:28,sessionHistoryMsgsDelete:29}}],response:[{type:"Long",name:"timetag"}]}},tM=function(t){function SyncService(a,u){var m;return void 0===u&&(u={}),(m=t.call(this,"sync",a)||this).syncDoneFlag=!1,m.config={myInfo:!!a.user.name,offlineMsgs:!!a.msg.name,teams:!!a.team.name,myTeamMembers:!!a.team.name,roamingMsgs:!!a.msg.name,relations:!!a.user.name,friends:!!a.friend.name,friendUsers:!!a.user.name,msgReceipts:!!a.msg.name,broadcastMsgs:!!a.msg.name,recallMsg:!!a.msg.name,sessionAck:!!a.session.name,superTeamSessionAck:!!a.session.name,superTeams:!!a.superTeam.name,mySuperTeamMembers:!!a.superTeam.name,superTeamRoamingMsgs:!!a.superTeam.name,deleteSuperTeamMsg:!!a.superTeam.name,deleteSelfMsgs:!!a.msg.name,sessionHistoryMsgsDelete:!!a.msgLog.name,avSignal:!!a.signaling.name},m.setOptions(u),m.timetags={},m.initEventListeners(),registerParser({cmdMap:Zy,cmdConfig:eM}),m}wt(SyncService,t);var a=SyncService.prototype;return a.setOptions=function setOptions(t){Ut(this.config,t)},a.reset=function reset(){this.timetags={},this.syncDoneFlag=!1},a.getSyncDoneFlag=function getSyncDoneFlag(){return this.syncDoneFlag},a.doSync=function doSync(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return a=this.genSyncParams(),this.logger.log("sync::doSyncV1: ",a),m.prev=2,m.next=5,this.core.clientSocket.sendCmd("sync",{sync:a});case 5:u=m.sent,this.core.logger.log("sync::doSyncV1 done in",null===(t=u.content)||void 0===t?void 0:t.timetag),this.syncDoneFlag=!0,this.core.emit("syncdone"),m.next=17;break;case 11:return m.prev=11,m.t0=m.catch(2),this.core.logger.error("sync::doSyncV1 error",m.t0),this.syncDoneFlag=!0,this.core.emit("syncdone"),m.abrupt("return");case 17:case"end":return m.stop()}}),_callee,this,[[2,11]])})))},a.initEventListeners=function initEventListeners(){var t=this;this.core.eventBus.on("logined",(function(){t.syncDoneFlag=!1,t.doSync()})),this.core.eventBus.on("sync/updateTimetag",(function(a){var u;forEach$1(u=Gt(a)).call(u,(function(u){a[u]>(t.timetags[u]||0)&&(t.timetags[u]=a[u])}))}))},a.genSyncParams=function genSyncParams(){var t,a,u=this;return reduce(t=filter(a=Gt(this.config)).call(a,(function(t){var a=t;return u.config[a]}))).call(t,(function(t,a){var m=a;return t[m]=u.timetags[m]||0,t}),{})},a.handleImmediate=function handleImmediate(t){return this.core.session&&this.core.session.onSyncDone&&this.core.session.onSyncDone(),$i.resolve(t)},a.delaySyncDone=function delaySyncDone(t){var a=this;return 102===uu.getSystemInfo().hostEnvEnum?(this.core.logger.log("sync: emit ALIAPP sycnHandler, handle later"),new $i((function(u){po((function(){a.handleImmediate(t).then((function(){u(t)}))}),100)}))):this.handleImmediate(t)},a.syncHandler=function syncHandler(t){return this.delaySyncDone(t)},SyncService}(vp);function _createForOfIteratorHelperLoose$3(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$3(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$3(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$3(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var rM=function(t){function UserService(a){var u;return(u=t.call(this,"user",a)||this).userInfoMap=new _c,u.myInfo=formatUser({}),registerParser({cmdMap:Ny,cmdConfig:Py}),u}wt(UserService,t);var a=UserService.prototype;return a.setBlack=function setBlack(t){var a=this;return validate({account:{type:"string",allowEmpty:!1},isAdd:{type:"boolean"}},t),this.core.sendCmd("setBlack",t).then((function(){a.core.eventBus.emit("forwardSend/user/updateBlackList",t.account,t.isAdd)}))},a.setMute=function setMute(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return validate({account:{type:"string",allowEmpty:!1},isAdd:{type:"boolean"}},t),a.next=3,this.core.sendCmd("setMute",t).then((function(){}));case 3:this.core.eventBus.emit("forwardSend/user/setMute",t.account,t.isAdd);case 4:case"end":return a.stop()}}),_callee,this)})))},a.getRelations=function getRelations(){return this.core.sendCmd("syncRelations",{timetag:0})},a.getBlackList=function getBlackList(){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var t;return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.core.sendCmd("syncRelations",{timetag:0});case 2:return t=a.sent,a.abrupt("return",t.blackList||[]);case 4:case"end":return a.stop()}}),_callee2,this)})))},a.getMuteList=function getMuteList(){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var t;return lu.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.core.sendCmd("syncRelations",{timetag:0});case 2:return t=a.sent,a.abrupt("return",t.muteList||[]);case 4:case"end":return a.stop()}}),_callee3,this)})))},a.updatePushToken=function updatePushToken(){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.wrap((function _callee4$(t){for(;;)switch(t.prev=t.next){case 0:this.logger.error("This function is deprecated, please use nim.offlinePush.setOfflinePushConfig instead");case 1:case"end":return t.stop()}}),_callee4,this)})))},a.updateAppBackground=function updateAppBackground(){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){return lu.wrap((function _callee5$(t){for(;;)switch(t.prev=t.next){case 0:this.logger.error("This function is deprecated, please use nim.offlinePush.setOfflinePushConfig instead");case 1:case"end":return t.stop()}}),_callee5,this)})))},a.getUsersNameCardFromServer=function getUsersNameCardFromServer(t){var a=this;return validate({accounts:{type:"array",max:150,itemType:"string"}},t),this.core.sendCmd("getUsersNameCardFromServer",pick(t,["accounts"])).then((function(u){var m,h=u.content;return a.logger.log("user:: getUsers done",t.accounts),h&&h.users?map$6(m=h.users).call(m,(function(t){return formatUser(t)})):[]}))},a.updateMyNameCard=function updateMyNameCard(t){var a=this;if(validate({nick:{type:"string",required:!1},avatar:{type:"string",required:!1},signature:{type:"string",required:!1},gender:{type:"enum",values:getEnumKeys(py),required:!1},email:{type:"string",required:!1},birth:{type:"string",required:!1},tel:{type:"string",required:!1},ext:{type:"string",required:!1}},t),0===Gt(t).length)return $i.resolve(this.myInfo);var u=pick(t,["nick","avatar","signature","email","birth","tel","ext"]);return t.gender&&(u.gender=py[t.gender]),this.core.sendCmd("updateMyNameCard",{user:u}).then((function(m){var h=m.content;return h&&h.timetag&&a.core.eventBus.emit("sync/updateTimetag",{myInfo:+h.timetag}),t.gender&&(u.gender=t.gender),a.myInfo=Ut({},a.myInfo,u),a.core.eventBus.emit("forwardSend/user/updateUserInfo",u),a.myInfo}))},a.checkUserUpdate=function checkUserUpdate(t){var a=t.from;if(a!==this.core.account){var u=this.userInfoMap.get(a);if(u){var m=u.updateTime,h=t.userUpdateTime;!isNaN(m)&&!isNaN(h)&&"number"==typeof m&&"number"==typeof h&&m<h&&this.refreshUserInfo(a)}else this.refreshUserInfo(a)}},a.refreshUserInfo=function refreshUserInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var a,u,m,h;return lu.wrap((function _callee6$(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,this.getUsersNameCardFromServer({accounts:[t]});case 2:for(a=g.sent,u=_createForOfIteratorHelperLoose$3(a);!(m=u()).done;)h=m.value,this.userInfoMap.set(h.account,h),this.core.emit("updateUserInfo",h);case 4:case"end":return g.stop()}}),_callee6,this)})))},a.onUpdateBlackListHandler=function onUpdateBlackListHandler(t){var a=t.content;a.account?this.core.emit("updateBlackList",a):this.logger.warn("onUpdateBlackListHandler: no account")},a.onUpdateMuteListHandler=function onUpdateMuteListHandler(t){var a=t.content;a.account?this.core.emit("updateMuteList",a):this.logger.warn("onUpdateBlackListHandler: no account")},a.syncRelationsHandler=function syncRelationsHandler(t){var a=t.content,u=a.list,m=a.timetag,h={blackList:[],muteList:[]};return m&&this.core.eventBus.emit("sync/updateTimetag",{relations:m}),u&&u.length&&forEach$1(u).call(u,(function(t){var a=function formatRelationMember(t){var a={account:t.account,updateTime:+t.updateTime,createTime:+t.createTime};return"1"===t.isMuted&&(a.isMuted=!0),"1"===t.isBlack&&(a.isBlack=!0),a}(t);a.isBlack&&h.blackList.push(a),a.isMuted&&h.muteList.push(a)})),this.core.emit("relations",h),$i.resolve(h)},a.syncMyNameCardHandler=function syncMyNameCardHandler(t){t.content.user&&(this.myInfo=formatUser(t.content.user),this.core.emit("syncMyNameCard",this.myInfo),this.core.eventBus.emit("sync/updateTimetag",{myInfo:t.content.timetag}))},a.onUpdateMyNameCardHandler=function onUpdateMyNameCardHandler(t){var a=t.content.user;a?(Ut(this.myInfo,formatUser(a)),this.core.emit("updateMyNameCard",this.myInfo)):this.logger.warn("onUpdateMyNameCardHandler no user info")},UserService}(vp);var nM={"4_12":"syncMsgReceipts","4_14":"syncSessionAck","4_20":"syncSuperTeamSessionAck","4_22":"nimSyncSessionsWithMoreRoaming","4_25":"syncSessionReliableInfo","7_12":"multiSyncMsgReceipt","7_16":"markSessionAck","7_25":"markMultSessionsAck","7_116":"syncMarkSessionAck","21_25":"markSuperTeamSessionAck","21_32":"markMultSuperTeamSessionsAck","21_125":"syncMarkSuperTeamSessionAck","4_23":"nimSyncStickTopSessions","23_12":"nimAddStickTopSession","23_13":"nimDeleteStickTopSession","23_14":"nimUpdateStickTopSession","23_112":"nimMultiSyncAddStickTopSession","23_113":"nimMultiSyncDeleteStickTopSession","23_114":"nimMultiSyncUpdateStickTopSession"},aM={msgReceiptTag:{to:1,from:2,time:7,idClient:11},stickTopSessionTag:{id:1,ext:2,createTime:3,updateTime:4},sessionAckTag:{scene:1,to:2,timetag:3},sessionReliableSyncTag:{scene:1,sessionId:2,syncStatus:3,syncEndMsgId:4,syncEndMsgidClient:5,syncEndMsgTime:6,syncStartMsgid:7,syncStartMsgidClient:8,syncStartMsgTime:9,nextMsgid:10,nextMsgidClient:11,nextMsgTime:12,roamMsgSync:13,offlineMsgSync:14,netCallOfflineMsgSync:15}},iM=invertSerializeMap(aM),oM={syncMsgReceipts:{sid:4,cid:12,service:"session",response:[{type:"PropertyArray",name:"msgReceipts",reflectMapper:iM.msgReceiptTag},{type:"Long",name:"timetag"}]},syncSessionAck:{sid:4,cid:14,service:"session",response:[{type:"StrLongMap",name:"p2p"},{type:"LongLongMap",name:"team"},{type:"Long",name:"timetag"}]},syncSuperTeamSessionAck:{sid:4,cid:20,service:"session",response:[{type:"LongLongMap",name:"superTeam"},{type:"Long",name:"timetag"}]},multiSyncMsgReceipt:{sid:7,cid:12,service:"session",response:[{type:"Property",name:"msgReceiptTag",reflectMapper:iM.msgReceiptTag}]},markSessionAck:{sid:7,cid:16,service:"session",params:[{type:"Byte",name:"scene"},{type:"String",name:"to"},{type:"Long",name:"timetag"}]},syncMarkSessionAck:{sid:7,cid:116,service:"session",response:[{type:"Byte",name:"scene"},{type:"String",name:"to"},{type:"Long",name:"timetag"}]},syncMarkSuperTeamSessionAck:{sid:21,cid:125,service:"session",response:[{type:"Long",name:"to"},{type:"Long",name:"timetag"}]},markMultSessionsAck:{sid:7,cid:25,service:"session",ignoreErrCodes:[700],params:[{type:"PropertyArray",name:"datas",reflectMapper:aM.sessionAckTag}]},markSuperTeamSessionAck:{sid:21,cid:25,service:"session",params:[{type:"Long",name:"to"},{type:"Long",name:"timetag"}]},nimAddStickTopSession:{sid:23,cid:12,service:"session",params:[{type:"Property",name:"tag",reflectMapper:aM.stickTopSessionTag}],response:[{type:"Property",name:"data",reflectMapper:iM.stickTopSessionTag}]},nimDeleteStickTopSession:{sid:23,cid:13,service:"session",params:[{type:"Property",name:"tag",reflectMapper:aM.stickTopSessionTag}],response:[{type:"Long",name:"timetag"}]},nimUpdateStickTopSession:{sid:23,cid:14,service:"session",params:[{type:"Property",name:"tag",reflectMapper:aM.stickTopSessionTag}],response:[{type:"Property",name:"data",reflectMapper:iM.stickTopSessionTag}]},nimMultiSyncAddStickTopSession:{sid:23,cid:112,service:"session",response:[{type:"Property",name:"data",reflectMapper:iM.stickTopSessionTag}]},nimMultiSyncDeleteStickTopSession:{sid:23,cid:113,service:"session",response:[{type:"Long",name:"timetag"},{type:"Property",name:"data",reflectMapper:iM.stickTopSessionTag}]},nimMultiSyncUpdateStickTopSession:{sid:23,cid:114,service:"session",response:[{type:"Property",name:"data",reflectMapper:iM.stickTopSessionTag}]},nimSyncStickTopSessions:{sid:4,cid:23,service:"session",response:[{type:"Long",name:"timetag"},{type:"Bool",name:"isThereAnyChange"},{type:"PropertyArray",name:"datas",reflectMapper:iM.stickTopSessionTag}]},markMultSuperTeamSessionsAck:{sid:21,cid:32,service:"session",ignoreErrCodes:[700],params:[{type:"PropertyArray",name:"datas",reflectMapper:aM.sessionAckTag}]},nimSyncSessionsWithMoreRoaming:{sid:4,cid:22,service:"session",response:[]},syncSessionReliableInfo:{sid:4,cid:25,service:"session",response:[]}},sM={id:{type:"string"},ext:{type:"string"},createTime:{type:"number"},updateTime:{type:"number"}};function formatStickTop(t,a,u){void 0===u&&(u=!0);var m=format(sM,t);m.isStickOnTop=u,m.id=a.id,u||(m.ext="");var h=Ut(Ut({},a),{stickTopInfo:a.stickTopInfo?Ut({},a.stickTopInfo,m):m});return void 0===h.lastMsg&&(h.lastMsg=null),h}var cM=function(){function StickTopService(t){this.core=t}var t=StickTopService.prototype;return t.getSession=function getSession(t){return this.core.session.getSessionWithUncomplete({id:t})||this.core.session.createSession(t)},t.addStickTopSession=function addStickTopSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u,m,h,g,M;return lu.wrap((function _callee$(I){for(;;)switch(I.prev=I.next){case 0:return validate({id:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),a=getAccountFromSessionId(t.id),u=a.scene,m=a.accid,I.next=4,this.core.sendCmd("nimAddStickTopSession",{tag:{id:("superTeam"===u?"super_team":u)+"|"+m,ext:t.ext||""}});case 4:return h=I.sent,g=this.getSession(t.id),M=formatStickTop(h.content.data,g),I.abrupt("return",M);case 8:case"end":return I.stop()}}),_callee,this)})))},t.deleteStickTopSession=function deleteStickTopSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h,g,M;return lu.wrap((function _callee2$(I){for(;;)switch(I.prev=I.next){case 0:return validate({id:{type:"string",allowEmpty:!1}},t),a=getAccountFromSessionId(t.id),u=a.scene,m=a.accid,I.next=4,this.core.sendCmd("nimDeleteStickTopSession",{tag:{id:("superTeam"===u?"super_team":u)+"|"+m}});case 4:return h=I.sent,g=this.getSession(t.id),M=formatStickTop({updateTime:h.content.timetag,ext:""},g,!1),I.abrupt("return",M);case 8:case"end":return I.stop()}}),_callee2,this)})))},t.updateStickTopSession=function updateStickTopSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m,h,g,M;return lu.wrap((function _callee3$(I){for(;;)switch(I.prev=I.next){case 0:return validate({id:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),a=getAccountFromSessionId(t.id),u=a.scene,m=a.accid,I.next=4,this.core.sendCmd("nimUpdateStickTopSession",{tag:{id:("superTeam"===u?"super_team":u)+"|"+m,ext:t.ext||""}});case 4:return h=I.sent,g=this.getSession(t.id),M=formatStickTop(h.content.data,g),I.abrupt("return",M);case 8:case"end":return I.stop()}}),_callee3,this)})))},t.stickTopSessionHandler=function stickTopSessionHandler(t,a){void 0===a&&(a=!0);var u=getAccountFromSessionId(t.id,"|"),m=u.scene+"-"+u.accid;return formatStickTop(t,this.getSession(m),a)},StickTopService}(),lM=function(){function UnreadModuleService(t){this.core=t,this.logger=t.logger}var t=UnreadModuleService.prototype;return t.canSessionResetUnreadCount=function canSessionResetUnreadCount(t){var a=t.id;if(void 0===t.lastMsg)throw new Error("Session::canSessionResetUnreadCount: session "+a+" is not completly, lastMsg undefined");return null!==t.lastMsg||t.unread>0?!(t.ack&&t.lastMsg&&t.ack>=t.lastMsg.time)||(this.logger.log("Session::canSessionResetUnreadCount: session "+a+" reset failed, ack time is greater than last message time"),!1):(this.logger.log("Session::canSessionResetUnreadCount: session "+a+" doesn't need to be updated, lastMsg null and unread 0"),!1)},t.filterSessionForResetUnreadCount=function filterSessionForResetUnreadCount(t){var a=this,u={cmd:"markMultSuperTeamSessionsAck",params:[]},m={cmd:"markMultSessionsAck",params:[]};return forEach$1(t).call(t,(function(t){var h;try{if(!a.canSessionResetUnreadCount(t))return;var g=getAccountFromSessionId(t.id),M=g.accid,I=g.scene,S={to:M,sessionId:t.id,timetag:(null===(h=null==t?void 0:t.lastMsg)||void 0===h?void 0:h.time)||t.updateTime||0},T=function generateSceneForCmd(t){return formatReverse({scene:{type:"enum",values:Kd}},t)}({scene:I});"superTeam"===I?u.params.push(S):m.params.push(Ut(Ut({},S),T))}catch(t){a.logger.warn(t)}})),{superTeam:u,p2pOrTeam:m}},UnreadModuleService}();function _createForOfIteratorHelperLoose$2(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$2(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$2(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$2(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var uM=function(t){function SessionService(a,u){var m;return(m=t.call(this,"session",a)||this).list=new _c,m.unreadCountFilterFn=function(t){return!0},m.lastMessageFilterFn=function(t){return!0},m.initEventListeners(),registerParser({cmdMap:nM,cmdConfig:oM}),m.stickTopService=new cM(a),m.unreadModule=new lM(a),u&&m.setOptions(u),m}wt(SessionService,t);var a=SessionService.prototype;return a.setOptions=function setOptions(t){"function"==typeof(null==t?void 0:t.unreadCountFilterFn)&&(this.unreadCountFilterFn=t.unreadCountFilterFn),"function"==typeof(null==t?void 0:t.lastMessageFilterFn)&&(this.lastMessageFilterFn=t.lastMessageFilterFn)},a.reset=function reset(){var t;forEach$1(t=this.list).call(t,(function(t){t.unreadMsgs=[]})),this.list.clear()},a.initEventListeners=function initEventListeners(){var t,a,u,m,h=this;this.core.eventBus.on("session/syncMsgs",bind$1(t=this.onSyncMsgs).call(t,this)),this.core.eventBus.on("session/updateForNewMsg",bind$1(a=this.updateSessionWithMsg).call(a,this)),this.core.eventBus.on("session/updateForModifyMsg",bind$1(u=this.updateSessionByModifyMsg).call(u,this)),this.core.eventBus.on("session/updateForClearMsg",(function(t,a){void 0===a&&(a=!0),t&&t.length>0&&forEach$1(t).call(t,(function(t){h.updateSession({id:t.sessionId,lastMsg:null,unread:0,unreadMsgs:[]},a)}))})),this.core.eventBus.on("session/updateForDeletedMsg",bind$1(m=this.updateSessionForDeletedMsg).call(m,this))},a.createSession=function createSession(t,a){try{var u=getAccountFromSessionId(t);return{id:t,scene:u.scene,to:u.accid,lastMsg:a,updateTime:a?a.time:0,unread:0,unreadMsgs:[],ack:0}}catch(a){throw this.logger.error("Failed to create session with "+t,a),new Error("Failed to create session with "+t)}},a.getSession=function getSession(t){validate({id:{type:"string",allowEmpty:!1}},t);var a=this.list.get(t.id);if(this.isSessionComplete(a))return a},a.getSessionWithUncomplete=function getSessionWithUncomplete(t){return this.list.get(t.id)},a.getAllSessions=function getAllSessions(){for(var t,a=[],u=_createForOfIteratorHelperLoose$2(this.list);!(t=u()).done;){var m=t.value;m[0];var h=m[1];this.isSessionComplete(h)&&a.push(h)}return a},a.getSessions=function getSessions(t){validate({limit:{type:"number",required:!1},lastSessionId:{type:"string",allowEmpty:!1,required:!1},desc:{type:"boolean",required:!1}},t);var a=[],u=t.limit,m=void 0===u?100:u,h=t.desc,g=void 0===h||h,M=t.lastSessionId,I=0;if(g){for(var S,T,C=_createForOfIteratorHelperLoose$2(this.list);!(T=C()).done;){var b=T.value,E=b[0],k=b[1];if(M===E)break;this.isSessionComplete(k)&&a.push(k)}return reverse$1(S=slice(a).call(a,-m)).call(S)}for(var R,A=_createForOfIteratorHelperLoose$2(this.list);!(R=A()).done;){var w=R.value,N=w[0],x=w[1];if(M)N===M&&(M=void 0);else if(this.isSessionComplete(x)){if(++I>m)break;a.push(x)}}return a},a.resetSessionUnreadCount=function resetSessionUnreadCount(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g,M,I,S,T,C=this;return lu.wrap((function _callee$(b){for(;;)switch(b.prev=b.next){case 0:if(validate({id:{type:"string",allowEmpty:!1}},t),validate({id:{type:"string",allowEmpty:!1}},t),u=t.id,m=this.list.get(u)){b.next=7;break}throw this.logger.warn("resetSessionUnreadCount: can not find session "+u),new Error("Session::canSessionResetUnreadCount: can not find session "+u);case 7:h=!1;try{h=this.unreadModule.canSessionResetUnreadCount(m)}catch(t){this.logger.warn(t)}if(!1!==h){b.next=11;break}return b.abrupt("return");case 11:return g=getAccountFromSessionId(u),M=g.accid,I=g.scene,S={to:M,timetag:(null===(a=null==m?void 0:m.lastMsg)||void 0===a?void 0:a.time)||m.updateTime||0},T="markSuperTeamSessionAck","superTeam"!==I&&(S.scene="p2p"===I?0:1,T="markSessionAck"),b.abrupt("return",this.core.sendCmd(T,S).then((function(){var t=C.storeUnreadByAck(u,S.timetag);t&&C.core.emit("updateSession",t)})));case 16:case"end":return b.stop()}}),_callee,this)})))},a.resetMultiSessionUnreadCount=function resetMultiSessionUnreadCount(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h,g,M,I,S,T,C,b,E,k,R,A=this;return lu.wrap((function _callee2$(w){for(;;)switch(w.prev=w.next){case 0:validate({ids:{type:"array",itemType:"string",min:1}},t),m=filter(a=map$6(u=t.ids).call(u,(function(t){return A.list.get(t)}))).call(a,(function(a,u){return!!a||(A.logger.warn("Session::canSessionResetUnreadCount: can not find session "+t.ids[u]),!1)})),h=this.unreadModule.filterSessionForResetUnreadCount(m),g=h.superTeam,M=h.p2pOrTeam,I=chunk(g.params,50),S=chunk(M.params,50),T=_createForOfIteratorHelperLoose$2(I);case 6:if((C=T()).done){w.next=13;break}return b=C.value,w.next=10,this.core.sendCmd(g.cmd,{datas:b});case 10:forEach$1(b).call(b,(function(t){var a=A.storeUnreadByAck(t.sessionId,t.timetag);a&&A.core.emit("updateSession",a)}));case 11:w.next=6;break;case 13:E=_createForOfIteratorHelperLoose$2(S);case 14:if((k=E()).done){w.next=21;break}return R=k.value,w.next=18,this.core.sendCmd(M.cmd,{datas:R});case 18:forEach$1(R).call(R,(function(t){var a=A.storeUnreadByAck(t.sessionId,t.timetag);a&&A.core.emit("updateSession",a)}));case 19:w.next=14;break;case 21:case"end":return w.stop()}}),_callee2,this)})))},a.resetAllSessionsUnreadCount=function resetAllSessionsUnreadCount(){var t,a=[];return forEach$1(t=this.list).call(t,(function(t){a.push(t.id)})),0===a.length?$i.resolve():this.resetMultiSessionUnreadCount({ids:a})},a.deleteSession=function deleteSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){return lu.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:if(validate({id:{type:"string",allowEmpty:!1},isSyncToServer:{type:"boolean",required:!1}},t),this.list.delete(t.id),!this.core.msgLog||!t.isSyncToServer){a.next=5;break}return a.next=5,this.core.msgLog.deleteRoamingMsgs({ids:[t.id]});case 5:case"end":return a.stop()}}),_callee3,this)})))},a.deleteAllSessionsFromLocal=function deleteAllSessionsFromLocal(){this.list.clear()},a.addStickTopSession=function addStickTopSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a;return lu.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.stickTopService.addStickTopSession(t);case 2:return a=u.sent,this.list.set(a.id,a),u.abrupt("return",a);case 5:case"end":return u.stop()}}),_callee4,this)})))},a.deleteStickTopSession=function deleteStickTopSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a;return lu.wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.stickTopService.deleteStickTopSession(t);case 2:return a=u.sent,this.list.set(a.id,a),u.abrupt("return",a);case 5:case"end":return u.stop()}}),_callee5,this)})))},a.updateStickTopSession=function updateStickTopSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var a;return lu.wrap((function _callee6$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.stickTopService.updateStickTopSession(t);case 2:return a=u.sent,this.list.set(a.id,a),u.abrupt("return",a);case 5:case"end":return u.stop()}}),_callee6,this)})))},a.nimMultiSyncAddStickTopSessionHandler=function nimMultiSyncAddStickTopSessionHandler(t){var a=this.stickTopService.stickTopSessionHandler(t.content.data);this.list.set(a.id,a),this.core.emit("updateSession",a)},a.nimMultiSyncDeleteStickTopSessionHandler=function nimMultiSyncDeleteStickTopSessionHandler(t){var a=this.stickTopService.stickTopSessionHandler({id:t.content.data.id,updateTime:t.content.timetag,ext:""},!1);this.list.set(a.id,a),this.core.emit("updateSession",a)},a.nimMultiSyncUpdateStickTopSessionHandler=function nimMultiSyncUpdateStickTopSessionHandler(t){var a=this.stickTopService.stickTopSessionHandler(t.content.data);this.list.set(a.id,a),this.core.emit("updateSession",a)},a.nimSyncStickTopSessionsHandler=function nimSyncStickTopSessionsHandler(t){var a,u=this;if(this.core.eventBus.emit("sync/updateTimetag",{stickTopSessions:t.content.timetag}),t.content.isThereAnyChange){var m=t.content.datas,h=[];forEach$1(a=this.list).call(a,(function(t){var a;t&&(null===(a=null==t?void 0:t.stickTopInfo)||void 0===a?void 0:a.isStickOnTop)&&h.push(t)})),forEach$1(h).call(h,(function(t){var a=t.id;if(!find(m).call(m,(function(t){var u=getAccountFromSessionId(t.id,"|");return u.scene+"-"+u.accid===a}))){var u={},h=getAccountFromSessionId(a,"-"),g=h.scene,M=h.accid;u.id=g+"|"+M,u.ext="",u.isTop=!1,m.push(u)}})),forEach$1(m).call(m,(function(t){var a;!1===t.isTop?(delete t.isTop,a=u.stickTopService.stickTopSessionHandler(t,!1)):a=u.stickTopService.stickTopSessionHandler(t),u.list.set(a.id,a)}))}},a.updateSessionWithMsg=function updateSessionWithMsg(t){var a,u,m=!0,h=!0,g="boolean"!=typeof(null===(a=t.pushInfo)||void 0===a?void 0:a.needPushBadge)||(null===(u=t.pushInfo)||void 0===u?void 0:u.needPushBadge);try{m=!!this.unreadCountFilterFn(t)}catch(t){this.logger.error("session:updateSessionWithMsg, unreadCountFilterFn error",t)}try{h=!!this.lastMessageFilterFn(t)}catch(t){this.logger.error("session:updateSessionWithMsg, lastMessageFilterFn error",t)}var M=this.list.get(t.sessionId)||this.createSession(t.sessionId),I=!1;if(this.logger.log("session:updateSessionWithMsg, pending ",t.sessionId,t.idClient,t.idServer,h,m),h&&(!M.lastMsg||M.lastMsg.time<t.time||t.status===Qd[Qd.sending]||M.lastMsg.status===Qd[Qd.sending])&&(M.lastMsg=t,M.updateTime=t.time,I=!0),m&&g&&t.status===Qd[Qd.unread]&&t.time>(M.ack||0)){M.unread++;var S=M.unreadMsgs||[];S.unshift(t),sort(S).call(S,(function(t,a){return a.time-t.time})),M.unreadMsgs=S,I=!0}I&&(this.logger.log("session:updateSessionWithMsg updating ",M.id,M.unread,M.lastMsg&&M.lastMsg.idClient),this.list.set(M.id,M),this.core.emit("updateSession",M))},a.updateSessionByModifyMsg=function updateSessionByModifyMsg(t){var a=this.list.get(t.sessionId)||this.createSession(t.sessionId),u=a.unreadMsgs||[],m=findIndex$1(u).call(u,(function(a){return a.idClient===t.idClient}));m>-1&&(u[m]=t),a.unreadMsgs=u,this.list.set(a.id,a);var h=!0;try{h=!!this.lastMessageFilterFn(t)}catch(t){this.logger.error("session:updateSessionByModifyMsg, lastMessageFilterFn error",t)}h&&(a.lastMsg&&a.lastMsg.idClient!==t.idClient||(a.lastMsg=t,a.updateTime=t.time,this.logger.log("session:updateSessionByModifyMsg updating ",a.id,a.unread,a.lastMsg&&a.lastMsg.idClient),this.list.set(a.id,a),this.core.emit("updateSession",a)))},a.storeUnreadByAck=function storeUnreadByAck(t,a){var u=this.list.get(t)||this.createSession(t);if(!(u.ack&&a<u.ack)){var m=u.unreadMsgs||[],h=[],g=[],M=0;return u.unreadMsgs=[],m.length>0&&(forEach$1(m).call(m,(function(t){includes(g).call(g,t.idClient)||t.time>a&&(M++,g.push(t.idClient),h.push(t))})),u.unreadMsgs=sort(h).call(h,(function(t,a){return a.time-t.time}))),u.ack=a,u.unread=M,u.lastMsg&&"unread"===u.lastMsg.status&&a>=u.lastMsg.time&&(u.lastMsg.status="read"),this.list.set(t,u),u}this.logger.warn("storeUnreadByAck: not need update ack",t,a,u.ack)},a.updateSession=function updateSession(t,a){void 0===a&&(a=!0);var u=t.id,m=this.list.get(u)||this.createSession(t.id),h=Ut(m,t);return this.list.set(u,h),this.logger.log("updateSession: update",a,pick(t,["id","ack","unread"]),h.lastMsg&&h.lastMsg.idClient),a&&this.core.emit("updateSession",h),h},a.isSessionComplete=function isSessionComplete(t){return!!t&&(!!(t.id&&t.scene&&t.to)&&void 0!==t.lastMsg)},a.syncSessionAckHandler=function syncSessionAckHandler(t){var a,u,m=this,h=t.content.p2p||{},g=t.content.team.m_map||{};this.logger.log("syncSessionAck::",h,g),forEach$1(a=Gt(h)).call(a,(function(t){m.updateSession({id:"p2p-"+t,ack:h[t]},!1)})),forEach$1(u=Gt(g)).call(u,(function(t){m.updateSession({id:"team-"+t,ack:g[t]},!1)}))},a.syncSuperTeamSessionAckHandler=function syncSuperTeamSessionAckHandler(t){var a,u=this,m=t.content.superTeam.m_map;this.logger.log("syncSuperTeamSessionAck::",m),forEach$1(a=Gt(m)).call(a,(function(t){u.updateSession({id:"superTeam-"+t,ack:m[t]},!1)}))},a.syncMarkSessionAckHandler=function syncMarkSessionAckHandler(t){var a=t.content,u=(0===a.scene?"p2p":1===a.scene?"team":"superTeam")+"-"+a.to,m=this.list.get(u);if(m&&m.ack&&a.timetag<m.ack)this.logger.warn("syncMarkSessionAckHandler: "+u+" do not need update ack",m.ack,a.timetag);else{var h=this.storeUnreadByAck(u,a.timetag);h&&this.core.emit("updateSession",h)}},a.syncMarkSuperTeamSessionAckHandler=function syncMarkSuperTeamSessionAckHandler(t){t.content.scene=5,this.syncMarkSessionAckHandler(t)},a.onSyncDone=function onSyncDone(){var t,a,u,m=this,h=[];forEach$1(t=this.list).call(t,(function(t,a){h.push(m.storeUnreadByAck(a,t.ack||0))})),this.list.clear(),forEach$1(a=sort(h).call(h,(function(t,a){return t.updateTime-a.updateTime}))).call(a,(function(t){m.list.set(t.id,t)})),(h=sort(u=filter(h).call(h,(function(t){return m.isSessionComplete(t)}))).call(u,(function(t,a){return a.updateTime-t.updateTime}))).length>0&&this.core.emit("sessions",h)},a.onSyncMsgs=function onSyncMsgs(t){var a,u=this,m=this.list.get(t.sessionId),h=[];try{var g;h=filter(g=t.msgs).call(g,(function(t){var a,m,h="boolean"!=typeof(null===(a=t.pushInfo)||void 0===a?void 0:a.needPushBadge)||(null===(m=t.pushInfo)||void 0===m?void 0:m.needPushBadge);return u.unreadCountFilterFn(JSON.parse(Vn(t)))&&h}))}catch(t){this.logger.error("session:onSyncMsgs, unreadCountFilterFn error ",t)}var M,I=[];try{var S;I=filter(S=t.msgs).call(S,(function(t){return u.lastMessageFilterFn(JSON.parse(Vn(t)))}))}catch(t){this.logger.error("session:onSyncMsgs, lastMessageFilterFn error ",t)}I&&I.length>0&&(M=I[I.length-1],M=I[0].time>M.time?I[0]:M);var T=M?M.time:0;m||(m=M?this.createSession(t.sessionId,M):this.createSession(t.sessionId)),m.unreadMsgs=m.unreadMsgs?filter(a=concat(h).call(h,m.unreadMsgs)).call(a,(function(t){return t.status===Qd[Qd.unread]})):filter(h).call(h,(function(t){return t.status===Qd[Qd.unread]})),m.updateTime&&m.updateTime>=T||(m.updateTime=T),m.lastMsg&&m.lastMsg.time>=T||(m.lastMsg=M),this.list.set(m.id,m)},a.updateSessionForDeletedMsg=function updateSessionForDeletedMsg(t){var a,u=this,m={};forEach$1(t).call(t,(function(t){var a,h=t.to===u.core.account?t.from:t.to,g=t.scene+"-"+h,M=u.list.get(g);if(M){var I=some(a=M.unreadMsgs).call(a,(function(a){return a.idClient===t.idClient})),S=!0;try{S=!!u.unreadCountFilterFn(t)}catch(t){u.logger.error("session:updateSessionForDeletedMsg, unreadCountFilterFn error",t)}var T=M.ack||0;if(S&&I&&T<t.time&&t.from!==u.core.account&&M.unread>0&&(M.unread=M.unread-1,M.unreadMsgs&&M.unreadMsgs.length>0)){var C,b=function findIndex(t,a){t=t||[],a=a||{};for(var u=0;u<t.length;u++){var m=!0;for(var h in a)if(t[u][h]!==a[h]){m=!1;break}if(m)return u}return-1}(M.unreadMsgs,{idClient:t.idClient});b>=0&&splice(C=M.unreadMsgs).call(C,b,1)}M.lastMsg&&M.lastMsg.idClient===t.idClient&&(M.lastMsg=null),m[M.id]=!0}})),forEach$1(a=Gt(m)).call(a,(function(t){var a=u.list.get(t);a&&u.core.emit("updateSession",a)}))},a.multiSyncMsgReceiptHandler=function multiSyncMsgReceiptHandler(t){var a,u=null===(a=t.content)||void 0===a?void 0:a.msgReceiptTag;if(u){this.updateSessionMsgReceiptTime([u],!0),u.msgReceiptTime=u.time,u.sessionId="p2p-"+u.from,u.time,u.from;var m=__rest(u,["time","from"]);this.core.emit("msgReceipts",[m])}},a.syncMsgReceiptsHandler=function syncMsgReceiptsHandler(t){var a,u=null===(a=t.content)||void 0===a?void 0:a.msgReceipts;u&&this.updateSessionMsgReceiptTime(u,!1)},a.updateSessionMsgReceiptTime=function updateSessionMsgReceiptTime(t,a){var u=this;void 0===a&&(a=!0),t&&t.length>0&&forEach$1(t).call(t,(function(t){var m=u.list.get("p2p-"+t.from);m||(m=u.createSession("p2p-"+t.from));var h=Bu(t.time);m.msgReceiptTime&&m.msgReceiptTime>=h||(m.msgReceiptTime=h,m.lastMsg&&"sent"===m.lastMsg.status&&h>=m.lastMsg.time&&(m.lastMsg.status="receipt"),u.logger.log("session: update session "+m.id+" msgReceiptTime: "+m.msgReceiptTime),u.list.set(m.id,m),a&&u.core.emit("updateSession",m))}))},SessionService}(vp),dM=function(){function ModuleService(t){this.core=t}var t=ModuleService.prototype;return t.notifyAddTeamMembers=function notifyAddTeamMembers(t,a){this.core.emit("addTeamMembers",{team:t,accounts:a,members:generatorMembersByTeam(t,a)})},t.notifyUpdateTeamManagers=function notifyUpdateTeamManagers(t,a,u,m){this.core.emit("updateTeamManagers",{team:{teamId:t,memberUpdateTime:m},accounts:a,isManager:u,members:map$6(a).call(a,(function(a){return{id:t+"-"+a,account:a,type:u?"manager":"normal",updateTime:m}}))})},t.notifyRemoveTeamMembers=function notifyRemoveTeamMembers(t,a){this.core.emit("removeTeamMembers",{team:t,accounts:a})},t.notifyTransferTeam=function notifyTransferTeam(t,a,u){this.core.emit("transferTeam",{team:t,from:{id:t.teamId+"-"+a,type:"normal",account:a,updateTime:t.memberUpdateTime},to:{id:t.teamId+"-"+u,type:"owner",account:u,updateTime:t.memberUpdateTime}})},t.notifyUpdateTeamMembersMute=function notifyUpdateTeamMembersMute(t,a,u){this.core.emit("updateTeamMembersMute",{team:t,accounts:a,members:map$6(a).call(a,(function(a){return{id:t.teamId+"-"+a,account:a,teamId:t.teamId,mute:u,updateTime:t.memberUpdateTime}})),mute:u})},ModuleService}();function cloneDeep(t,a){if((a=new _c).get(t))return t;if(t instanceof RegExp)return new RegExp(t);if(t instanceof Date)return new Date(t.getTime());if(Un(t))return a.set(t,!0),map$6(t).call(t,(function(t){return cloneDeep(t,a)}));if("object"==typeof t&&null!==t){var u;a.set(t,!0);var m={};return forEach$1(u=Gt(t)).call(u,(function(u){m[u]=cloneDeep(t[u],a)})),m}return t}var pM=function(t){function TeamService(a){var u;return(u=t.call(this,"team",a)||this).myTeamMembersMap=new _c,u.service=new dM(a),u.setListeners(),registerParser({cmdMap:ky,cmdConfig:wy}),u}wt(TeamService,t);var a=TeamService.prototype;return a.setListeners=function setListeners(){var t=this;this.core.eventBus.on("forwardReceive/team/updateMyMemberInfo",(function(a){t.emitMemberUpdate(a)})),this.core.eventBus.on("team/onNotification",(function(a){return t.notificationHandler(a)}))},a.reset=function reset(){this.myTeamMembersMap.clear()},a.mergeMyTeamMembers=function mergeMyTeamMembers(t){var a=this;forEach$1(t).call(t,(function(t){var u=t.teamId,m=a.myTeamMembersMap.get(u),h=Ut({},m,t);a.myTeamMembersMap.set(u,h)}))},a.getTeamInfo=function getTeamInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),m.next=3,this.core.sendCmd("getTeamInfo",{teamId:t.teamId});case 3:return a=m.sent,u=a.content.team,m.abrupt("return",formatTeam(u));case 6:case"end":return m.stop()}}),_callee,this)})))},a.getTeams=function getTeams(){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var t,a;return lu.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.core.sendCmd("getTeams",{timetag:0});case 2:return t=u.sent,a=t.content.teams,u.abrupt("return",formatTeams(a));case 5:case"end":return u.stop()}}),_callee2,this)})))},a.getTeamsById=function getTeamsById(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u;return lu.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamIds:{type:"array",itemType:"string"}},t),m.next=3,this.core.sendCmd("getTeamsById",{teamIds:t.teamIds});case 3:return a=m.sent,u=formatTeams(a.content.teams),m.abrupt("return",{teams:u,tids:a.content.tids});case 6:case"end":return m.stop()}}),_callee3,this)})))},a.createTeam=function createTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a,u,m;return lu.wrap((function _callee4$(h){for(;;)switch(h.prev=h.next){case 0:return validate({type:{type:"enum",values:["advanced","normal"]},name:{type:"string",allowEmpty:!1},level:{type:"number",required:!1},accounts:{type:"array",itemType:"string",required:!1},ps:{type:"string",allowEmpty:!0,max:5e3,required:!1},joinMode:{type:"enum",values:["noVerify","needVerify","rejectAll"],required:!1},beInviteMode:{type:"enum",values:["noVerify","needVerify"],required:!1},inviteMode:{type:"enum",values:["manager","all"],required:!1},updateTeamMode:{type:"enum",values:["manager","all"],required:!1},updateExtMode:{type:"enum",values:["manager","all"],required:!1},intro:{type:"string",allowEmpty:!0,required:!1},announcement:{type:"string",allowEmpty:!0,required:!1},avatar:{type:"string",allowEmpty:!0,required:!1},ext:{type:"string",allowEmpty:!0,required:!1}},t),a=generateTeam(t),h.next=4,this.core.sendCmd("createTeam",{team:a,accounts:t.accounts||[],ps:t.ps||""});case 4:return u=h.sent,m=formatTeam(u.content.team),this.core.eventBus.emit("forwardSend/team/created",m),h.abrupt("return",m);case 8:case"end":return h.stop()}}),_callee4,this)})))},a.dismissTeam=function dismissTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){return lu.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),a.next=3,this.core.sendCmd("dismissTeam",{teamId:t.teamId});case 3:case"end":return a.stop()}}),_callee5,this)})))},a.leaveTeam=function leaveTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){return lu.wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),a.next=3,this.core.sendCmd("leaveTeam",{teamId:t.teamId});case 3:case"end":return a.stop()}}),_callee6,this)})))},a.transferTeam=function transferTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},leave:{type:"boolean"}},t),a.next=3,this.core.sendCmd("transferTeam",t);case 3:case"end":return a.stop()}}),_callee7,this)})))},a.updateTeamInfo=function updateTeamInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a;return lu.wrap((function _callee8$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},joinMode:{type:"enum",values:["noVerify","needVerify","rejectAll"],required:!1},beInviteMode:{type:"enum",values:["noVerify","needVerify"],required:!1},inviteMode:{type:"enum",values:["manager","all"],required:!1},updateTeamMode:{type:"enum",values:["manager","all"],required:!1},updateExtMode:{type:"enum",values:["manager","all"],required:!1},intro:{type:"string",allowEmpty:!0,required:!1},announcement:{type:"string",allowEmpty:!0,required:!1},avatar:{type:"string",allowEmpty:!0,required:!1},ext:{type:"string",allowEmpty:!0,required:!1}},t),a=generateTeam(t),u.next=4,this.core.sendCmd("updateTeamInfo",{team:a});case 4:return u.abrupt("return",formatTeam(a));case 5:case"end":return u.stop()}}),_callee8,this)})))},a.getTeamMembers=function getTeamMembers(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var u,m;return lu.wrap((function _callee9$(h){for(;;)switch(h.prev=h.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",required:!1}},t),h.next=3,this.core.sendCmd("getTeamMembers",{teamId:t.teamId,timetag:0});case 3:if(u=h.sent,m=formatTeamMembers(null===(a=u.content)||void 0===a?void 0:a.teamMembers),t.accounts&&t.accounts.length>0){h.next=7;break}return h.abrupt("return",m);case 7:return h.abrupt("return",filter(m).call(m,(function(a){var u;return null===(u=t.accounts)||void 0===u?void 0:includes(u).call(u,a.account)})));case 8:case"end":return h.stop()}}),_callee9,this)})))},a.getMutedTeamMembers=function getMutedTeamMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){var a,u;return lu.wrap((function _callee10$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),m.next=3,this.core.sendCmd("getMutedTeamMembers",{teamId:t.teamId});case 3:return a=m.sent,u=a.content,m.abrupt("return",formatTeamMembers(u.teamMembers));case 6:case"end":return m.stop()}}),_callee10,this)})))},a.addTeamMembers=function addTeamMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){return lu.wrap((function _callee11$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",min:1},ps:{type:"string",allowEmpty:!0,max:5e3,required:!1}},t),a.next=3,this.core.sendCmd("addTeamMembers",{teamId:t.teamId,accounts:t.accounts,ps:t.ps||"",attach:t.ext||""});case 3:case"end":return a.stop()}}),_callee11,this)})))},a.removeTeamMembers=function removeTeamMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){return lu.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",min:1}},t),a.next=3,this.core.sendCmd("removeTeamMembers",{teamId:t.teamId,accounts:t.accounts});case 3:case"end":return a.stop()}}),_callee12,this)})))},a.applyTeam=function applyTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){var a;return lu.wrap((function _callee13$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},ps:{type:"string",allowEmpty:!0,max:5e3,required:!1}},t),u.next=3,this.core.sendCmd("applyTeam",{teamId:t.teamId,ps:t.ps||""});case 3:return a=u.sent,u.abrupt("return",formatTeam(a.content.team));case 5:case"end":return u.stop()}}),_callee13,this)})))},a.addTeamManagers=function addTeamManagers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){return lu.wrap((function _callee14$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",min:1,itemType:"string"}},t),a.next=3,this.core.sendCmd("addTeamManagers",t);case 3:case"end":return a.stop()}}),_callee14,this)})))},a.removeTeamManagers=function removeTeamManagers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){return lu.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",min:1,itemType:"string"}},t),a.next=3,this.core.sendCmd("removeTeamManagers",t);case 3:case"end":return a.stop()}}),_callee15,this)})))},a.updateMyMemberInfo=function updateMyMemberInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var a,u,m;return lu.wrap((function _callee16$(h){for(;;)switch(h.prev=h.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},nickInTeam:{type:"string",allowEmpty:!0,required:!1},bitConfigMask:{type:"number",min:0,max:2,required:!1},ext:{type:"string",required:!1}},t),a=generatorTeamMemberForCmd({teamId:t.teamId,nickInTeam:t.nickInTeam,bitConfigMask:t.bitConfigMask,ext:t.ext}),h.next=4,this.core.sendCmd("updateMyMemberInfo",{teamMember:a});case 4:return u=formatTeamMember(Ut({updateTime:(new Date).getTime(),account:this.core.account},a)),m=this.emitMemberUpdate(u),this.core.eventBus.emit("forwardSend/team/updateMyMemberInfo",m),h.abrupt("return",u);case 8:case"end":return h.stop()}}),_callee16,this)})))},a.emitMemberUpdate=function emitMemberUpdate(t){t=formatTeamMember(t),this.mergeMyTeamMembers([t]),this.core.emit("updateTeamMember",t);var a=cloneDeep(this.myTeamMembersMap.get(t.teamId));return this.core.emit("myTeamMembers",[a]),a},a.updateMemberNick=function updateMemberNick(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee17(){var a,u;return lu.wrap((function _callee17$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},nickInTeam:{type:"string",allowEmpty:!0}},t),a=generatorTeamMemberForCmd({teamId:t.teamId,nickInTeam:t.nickInTeam,account:t.account}),m.next=4,this.core.sendCmd("updateNickInTeam",{teamMember:a});case 4:return u=formatTeamMember(Ut({updateTime:(new Date).getTime()},a)),m.abrupt("return",u);case 6:case"end":return m.stop()}}),_callee17,this)})))},a.muteTeamMember=function muteTeamMember(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee18(){return lu.wrap((function _callee18$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},mute:{type:"boolean"}},t),a.next=3,this.core.sendCmd("muteTeamMember",{teamId:t.teamId,account:t.account,mute:t.mute?1:0});case 3:case"end":return a.stop()}}),_callee18,this)})))},a.getTeamMemberInvitorAccid=function getTeamMemberInvitorAccid(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee19(){var u,m;return lu.wrap((function _callee19$(h){for(;;)switch(h.prev=h.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",max:200}},t),u={teamId:t.teamId},t.accounts&&t.accounts.length>0&&(u.accounts=t.accounts),h.next=5,this.core.sendCmd("getTeamMemberInvitorAccid",u);case 5:return m=h.sent,h.abrupt("return",(null===(a=m.content)||void 0===a?void 0:a.accountsMap)||{});case 7:case"end":return h.stop()}}),_callee19,this)})))},a.muteTeam=function muteTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee20(){return lu.wrap((function _callee20$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},mute:{type:"boolean"}},t),a.next=3,this.core.sendCmd("muteTeam",{teamId:t.teamId,mute:t.mute?1:0});case 3:case"end":return a.stop()}}),_callee20,this)})))},a.passTeamApply=function passTeamApply(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee21(){var a;return lu.wrap((function _callee21$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("passTeamApply",t);case 4:this.core.eventBus.emit("forwardSend/team/passTeamApply",t),u.next=12;break;case 7:throw u.prev=7,u.t0=u.catch(1),a=u.t0,this.core.eventBus.emit("forwardSend/team/passTeamApply",t,null==a?void 0:a.code),u.t0;case 12:case"end":return u.stop()}}),_callee21,this,[[1,7]])})))},a.rejectTeamApply=function rejectTeamApply(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee22(){var a;return lu.wrap((function _callee22$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1},ps:{type:"string",max:5e3,required:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("rejectTeamApply",{teamId:t.teamId,from:t.from,ps:t.ps||""});case 4:this.core.eventBus.emit("forwardSend/team/rejectTeamApply",t),u.next=12;break;case 7:throw u.prev=7,u.t0=u.catch(1),a=u.t0,this.core.eventBus.emit("forwardSend/team/rejectTeamApply",t,null==a?void 0:a.code),u.t0;case 12:case"end":return u.stop()}}),_callee22,this,[[1,7]])})))},a.acceptTeamInvite=function acceptTeamInvite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee23(){var a;return lu.wrap((function _callee23$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("acceptTeamInvite",t);case 4:this.core.eventBus.emit("forwardSend/team/acceptTeamInvite",t),u.next=12;break;case 7:throw u.prev=7,u.t0=u.catch(1),a=u.t0,this.core.eventBus.emit("forwardSend/team/acceptTeamInvite",t,null==a?void 0:a.code),u.t0;case 12:case"end":return u.stop()}}),_callee23,this,[[1,7]])})))},a.rejectTeamInvite=function rejectTeamInvite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee24(){var a;return lu.wrap((function _callee24$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1},ps:{type:"string",max:5e3,required:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("rejectTeamInvite",{teamId:t.teamId,from:t.from,ps:t.ps||""});case 4:this.core.eventBus.emit("forwardSend/team/rejectTeamInvite",t),u.next=12;break;case 7:throw u.prev=7,u.t0=u.catch(1),a=u.t0,this.core.eventBus.emit("forwardSend/team/rejectTeamInvite",t,null==a?void 0:a.code),u.t0;case 12:case"end":return u.stop()}}),_callee24,this,[[1,7]])})))},a.notifyTeamMsgReceiptsHandler=function notifyTeamMsgReceiptsHandler(t){var a,u=null===(a=t.content)||void 0===a?void 0:a.teamMsgReceipts;u&&u.length>0&&(this.core.emit("teamMsgReceipts",u),this.core.emit("msgReceipts",u))},a.syncTeamsHandler=function syncTeamsHandler(t){var a=t.content;this.core.eventBus.emit("sync/updateTimetag",{teams:Bu(a.timetag)});var u=null==a?void 0:a.teams;if(u&&u.length){var m=formatTeams(u);this.core.emit("teams",m)}},a.syncCreateTeamHandler=function syncCreateTeamHandler(t){var a=t.content,u=formatTeam(null==a?void 0:a.team),m=generatorMemberByTeam(u,u.owner,"owner");this.core.emit("createTeam",u,m)},a.syncUpdateTeamMemberHandler=function syncUpdateTeamMemberHandler(t){var a=t.content,u=formatTeamMember(null==a?void 0:a.teamMember);u.updateTime||(u.updateTime=(new Date).getTime()),this.mergeMyTeamMembers([u]),this.core.emit("updateTeamMember",u);var m=cloneDeep(this.myTeamMembersMap.get(u.teamId));this.core.emit("myTeamMembers",[m])},a.syncMyTeamMembersHandler=function syncMyTeamMembersHandler(t){var a,u=t.content;this.core.eventBus.emit("sync/updateTimetag",{myTeamMembers:Bu(u.timetag)});var m=null==u?void 0:map$6(a=u.teamMembers).call(a,(function(t){return formatTeamMember(t)}));this.mergeMyTeamMembers(m),this.core.emit("myTeamMembers",cloneDeep(m))},a.notificationHandler=function notificationHandler(t){var a=t.attach,u=t.scene,m=t.from,h=t.to,g=t.time,M=t.idServer,I=t.idClient,S=a.team,T=a.account,C=a.accounts,b=a.type;if("team"===u)switch(this.logger.getDebugMode()?this.logger.debug("team::recvNotification",M,I,a):this.logger.log("team::recvNotification",M,I,h,b,T,C),b){case"updateTeam":S.updateTime=g,this.core.emit("updateTeam",S);break;case"addTeamMembers":this.service.notifyAddTeamMembers(S,C);break;case"acceptTeamInvite":this.service.notifyAddTeamMembers(S,[m]);break;case"passTeamApply":this.service.notifyAddTeamMembers(S,[T]);break;case"addTeamManagers":this.service.notifyUpdateTeamManagers(h,C,!0,g);break;case"removeTeamManagers":this.service.notifyUpdateTeamManagers(h,C,!1,g);break;case"removeTeamMembers":this.service.notifyRemoveTeamMembers(S,C);break;case"leaveTeam":this.service.notifyRemoveTeamMembers(S,[m]);break;case"dismissTeam":this.core.emit("dismissTeam",{teamId:h});break;case"transferTeam":this.service.notifyTransferTeam(S,m,T);break;case"updateTeamMemberMute":this.service.notifyUpdateTeamMembersMute(S,[T],a.mute)}},TeamService}(vp),mM={"4_6":"syncOfflineSysMsgs","4_18":"syncOfflineSysMsgs","4_19":"syncRecallMsgOfflineAndRoaming","7_3":"onSysMsg","7_7":"sendCustomSysMsg","7_14":"onRecallMsg","21_18":"onRecallMsg","21_117":"onRecallMsg","7_15":"syncRecallMsgOfflineAndRoaming","21_19":"onSysMsg","21_16":"sendSuperTeamCustomSysMsg"},hM={sysMsg:Ut({time:0,type:1,to:2,from:3,content:4,attach:5,idServer:6,needSaveOffline:7,deletedIdClient:10,deletedIdServer:11,needcAntiSpam:12,antiSpamContent:13,deletedMsgCreateTime:14,deletedMsgFromNick:15,opeAccount:16,envConfig:21,callbackExt:22,isRoutable:105},jy)},gM=invertSerializeMap(hM),vM={onSysMsg:{service:"systemMessage",sid:7,cid:3,response:[{type:"Property",name:"sysMsg",reflectMapper:gM.sysMsg}]},sendCustomSysMsg:{service:"systemMessage",sid:7,cid:7,params:[{type:"Property",name:"sysMsg",reflectMapper:hM.sysMsg}]},sendSuperTeamCustomSysMsg:{service:"systemMessage",sid:21,cid:16,params:[{type:"Property",name:"sysMsg",reflectMapper:hM.sysMsg}]},sendFilterCustomSysMsg:{service:"systemMessage",sid:101,cid:7,params:[{type:"Property",name:"sysMsg",reflectMapper:hM.sysMsg}]},batchMarkRead:{service:"systemMessage",sid:4,cid:5,hasPacketResponse:!1,params:[{type:"Byte",name:"sid"},{type:"Byte",name:"cid"},{type:"LongArray",name:"ids"}]},onRecallMsg:{sid:7,cid:14,service:"systemMessage",response:[{type:"Property",name:"sysMsg",reflectMapper:gM.sysMsg}]},syncRecallMsgOfflineAndRoaming:{sid:7,cid:15,service:"systemMessage",response:[{type:"PropertyArray",name:"sysMsgs",reflectMapper:gM.sysMsg},{type:"Long",name:"timetag"},{type:"Byte",name:"type"}]},syncOfflineSysMsgs:{sid:4,cid:9,service:"systemMessage",response:[{type:"PropertyArray",name:"sysMsgs",reflectMapper:gM.sysMsg}]}},fM=function(t){function SystemMessageService(a){var u;return(u=t.call(this,"systemMessage",a)||this).sysMsgUnread={total:0,friend:0,msg:0,team:0,superTeam:0},u.core.eventBus.on("logined",(function(){u.initEventListeners()})),registerParser({cmdMap:mM,cmdConfig:vM}),u}wt(SystemMessageService,t);var a=SystemMessageService.prototype;return a.initEventListeners=function initEventListeners(){var t=this;this.core.eventBus.on("systemMessage/passFriendApply",(function(a){t.core.emit("updateSystemMessages",[{idServer:a.idServer,from:a.account,state:"pass",type:"friendRequest"}])})),this.core.eventBus.on("systemMessage/rejectFriendApply",(function(a){t.core.emit("updateSystemMessages",[{idServer:a.idServer,from:a.account,state:"decline",type:"friendRequest"}])}))},a.doMarkSysMsgAck=function doMarkSysMsgAck(t){var a=[],u=[],m=["customSuperTeam"];forEach$1(t).call(t,(function(t){t.idServer&&(includes(m).call(m,t.type)?u.push(t.idServer):a.push(t.idServer))})),a.length>0&&this.core.sendCmd("batchMarkRead",{sid:"7",cid:"3",ids:a}),u.length>0&&this.core.sendCmd("batchMarkRead",{sid:"21",cid:"19",ids:u})},a.sendCustomSysMsg=function sendCustomSysMsg(t){var a=this;validate({to:{type:"string",allowEmpty:!1},type:{type:"enum",values:["customP2p","customTeam","customSuperTeam"]},attach:{type:"string",allowEmpty:!1},setting:{type:"object",rules:{needSaveOffline:{type:"boolean",required:!1},env:{type:"string",allowEmpty:!1,required:!1}},required:!1},pushInfo:{type:"object",required:!1,rules:Hy}},t);var u="customSuperTeam"===t.type?"sendSuperTeamCustomSysMsg":"sendCustomSysMsg";return this.core.sendCmd(u,{sysMsg:generatorSysMsgForCmd$1(t)}).then((function(){a.logger.log("sendCustomSysMsg success")})).catch((function(t){throw a.logger.error("sendCustomSysMsg failed",t.message),t}))},a.onSysMsgHandler=function onSysMsgHandler(t){var a,u=null===(a=t.content)||void 0===a?void 0:a.sysMsg;if(u){var m=formatSystemMessage(u=fillIdServer(t,t.content.sysMsg,"idServer"),this.logger,By.default);this.core.emit("sysMsg",m),this.doMarkSysMsgAck([m])}else this.logger.warn("onSysMsg no content.sysMsg")},a.syncOfflineSysMsgsHandler=function syncOfflineSysMsgsHandler(t){var a,u=this;if(t.content.sysMsgs&&t.content.sysMsgs.length>0){var m=map$6(a=t.content.sysMsgs).call(a,(function(t){return formatSystemMessage(t,u.logger,By.leave)}));this.core.emit("syncSysMsgs",m),this.doMarkSysMsgAck(m)}},a.onRecallMsgHandler=function onRecallMsgHandler(t){var a,u=null===(a=t.content)||void 0===a?void 0:a.sysMsg;if(u){var m=formatDeletedMsgs([u=fillIdServer(t,t.content.sysMsg,"idServer")],getSceneFromRecallSysMsg(+u.type));this.core.eventBus.emit("session/updateForDeletedMsg",m);var h=formatSystemMessage(u,this.logger,By.default);this.core.emit("sysMsg",h),this.doMarkSysMsgAck([h])}else this.logger.warn("onSysMsg no content.sysMsg")},a.syncRecallMsgOfflineAndRoamingHandler=function syncRecallMsgOfflineAndRoamingHandler(t){var a=this,u=t.content,m=u.timetag,h=u.type,g=u.sysMsgs,M=Bu(h),I=1===M?By.leave:By.roam,S=map$6(g).call(g,(function(t){return formatSystemMessage(t,a.logger,I)}));1===M&&this.doMarkSysMsgAck(S),this.core.eventBus.emit("sync/updateTimetag",{recallMsg:m}),this.core.emit("syncSysMsgs",S)},SystemMessageService}(vp);function reverseFriend(t){var a=["bitsExtension","createTime","updateTime","passRelationShip","relationShip","source"],u=Ut({},t);return forEach$1(a).call(a,(function(t){void 0!==u[t]&&(u[t]=Bu(u[t]))})),void 0!==u.relationShip&&(u.valid=1===u.relationShip),u}var yM={1:"addFriend",2:"applyFriend",3:"passFriendApply",4:"rejectFriendApply"};var MM={"12_4":"getFriends","12_1":"friendReuqest","12_2":"deleteFriend","12_3":"updateFriend","12_5":"syncFriends","12_6":"syncFriendUsers","12_101":"syncFriendRequest","12_102":"syncDeleteFriend","12_103":"syncUpdateFriend"},IM={updateFriendTag:{account:4,alias:8,ext:10},delFriendParams:{delAlias:1},friendTag:{account:4,relationShip:5,passRelationShip:6,source:7,alias:8,bitsExtension:9,ext:10,createTime:11,updateTime:12,serverex:13},userTag:{account:1,nick:3,avatar:4,sign:5,gender:6,email:7,birth:8,tel:9,ext:10,createTime:12,updateTime:13}},_M=invertSerializeMap(IM),SM={getFriends:{sid:12,cid:4,service:"friend",params:[{type:"Long",name:"timetag"}],response:[{type:"PropertyArray",name:"friends",reflectMapper:_M.friendTag},{type:"Long",name:"timetag"}]},friendReuqest:{sid:12,cid:1,service:"friend",params:[{type:"String",name:"account"},{type:"Byte",name:"type"},{type:"String",name:"ps"}]},deleteFriend:{sid:12,cid:2,service:"friend",params:[{type:"String",name:"account"},{type:"Property",name:"delFriendParams",reflectMapper:IM.delFriendParams}]},updateFriend:{sid:12,cid:3,service:"friend",params:[{type:"Property",name:"updateFriendTag",reflectMapper:IM.updateFriendTag}]},syncFriends:{sid:12,cid:5,service:"friend",response:[{type:"PropertyArray",name:"friends",entity:"friendTag",reflectMapper:_M.friendTag},{type:"Long",name:"timetag"}]},syncFriendUsers:{sid:12,cid:6,service:"friend",response:[{type:"PropertyArray",name:"users",entity:"userTag",reflectMapper:_M.userTag},{type:"Long",name:"timetag"}]},syncFriendRequest:{sid:12,cid:101,service:"friend",params:[{type:"String",name:"account"},{type:"Byte",name:"type"},{type:"String",name:"ps"}],response:[{type:"String",name:"account"},{type:"Byte",name:"type"},{type:"String",name:"ps"}]},syncDeleteFriend:{sid:12,cid:102,service:"friend",response:[{type:"String",name:"account"}]},syncUpdateFriend:{sid:12,cid:103,service:"friend",response:[{type:"Property",name:"friend",reflectMapper:_M.friendTag}]}},TM=function(t){function FriendService(a){var u;return u=t.call(this,"friend",a)||this,registerParser({cmdMap:MM,cmdConfig:SM}),u}wt(FriendService,t);var a=FriendService.prototype;return a.getFriends=function getFriends(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.core.sendCmd("getFriends",{timetag:0});case 2:return a=m.sent,u=(null===(t=a.content)||void 0===t?void 0:t.friends)||[],u=map$6(u).call(u,(function(t){return reverseFriend(t)})),m.abrupt("return",u);case 6:case"end":return m.stop()}}),_callee,this)})))},a.addFriend=function addFriend(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a;return lu.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return validate({account:{type:"string",allowEmpty:!1},ps:{type:"string",allowEmpty:!1,required:!1}},t),u.next=3,this.core.sendCmd("friendReuqest",{account:t.account,type:1,ps:t.ps||""});case 3:return a=(new Date).getTime(),this.core.eventBus.emit("forwardSend/friend/addFriend",t.account),u.abrupt("return",{account:t.account,createTime:a,updateTime:a,valid:!0,source:0,passRelationShip:1,relationShip:1,bitsExtension:0});case 6:case"end":return u.stop()}}),_callee2,this)})))},a.applyFriend=function applyFriend(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){return lu.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:return validate({account:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("friendReuqest",{account:t.account,type:2,ps:t.ps||""});case 3:case"end":return a.stop()}}),_callee3,this)})))},a.passFriendApply=function passFriendApply(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a=this;return lu.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return validate({account:{type:"string",allowEmpty:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("friendReuqest",{account:t.account,type:3,ps:t.ps||""}).then((function(u){return a.core.eventBus.emit("systemMessage/passFriendApply",t),u}));case 4:this.core.eventBus.emit("forwardSend/friend/passFriendApply",t.account),u.next=11;break;case 7:throw u.prev=7,u.t0=u.catch(1),this.core.eventBus.emit("forwardSend/friend/passFriendApply",t.account,u.t0),u.t0;case 11:case"end":return u.stop()}}),_callee4,this,[[1,7]])})))},a.rejectFriendApply=function rejectFriendApply(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a=this;return lu.wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:return validate({account:{type:"string",allowEmpty:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("friendReuqest",{account:t.account,type:4,ps:t.ps||""}).then((function(u){return a.core.eventBus.emit("systemMessage/rejectFriendApply",t),u}));case 4:this.core.eventBus.emit("forwardSend/friend/rejectFriendApply",t.account,t.ps),u.next=11;break;case 7:throw u.prev=7,u.t0=u.catch(1),this.core.eventBus.emit("forwardSend/friend/rejectFriendApply",t.account,t.ps,u.t0),u.t0;case 11:case"end":return u.stop()}}),_callee5,this,[[1,7]])})))},a.deleteFriend=function deleteFriend(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){return lu.wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:return validate({account:{type:"string",allowEmpty:!1},delAlias:{type:"boolean"}},t),a.next=3,this.core.sendCmd("deleteFriend",{account:t.account,delFriendParams:{delAlias:!0===t.delAlias?1:0}});case 3:this.core.eventBus.emit("forwardSend/friend/deleteFriend",t.account);case 4:case"end":return a.stop()}}),_callee6,this)})))},a.updateFriend=function updateFriend(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return validate({account:{type:"string",allowEmpty:!1},alias:{type:"string"},ext:{type:"string",required:!1}},t),a.next=3,this.core.sendCmd("updateFriend",{updateFriendTag:t});case 3:this.core.eventBus.emit("forwardSend/friend/updateFriend",t);case 4:case"end":return a.stop()}}),_callee7,this)})))},a.syncFriendRequestHandler=function syncFriendRequestHandler(t){var a=function formatFriendRequest(t){var a=Ut({},t);try{a.ps=a.ps&&JSON.parse(a.ps)}catch(t){}if(a.type=yM[a.type],"addFriend"===a.type||"passFriendApply"===a.type){var u=(new Date).getTime();a.friend={account:t.account,alias:"",createTime:u,ext:"",updateTime:u,valid:!0}}return a}(t.content);this.core.emit("syncFriend",a)},a.syncDeleteFriendHandler=function syncDeleteFriendHandler(t){var a=t.content.account;this.logger.log("friend::emit syncFriendAction: deleteFriend "+a),this.core.emit("syncFriend",{type:"deleteFriend",account:a})},a.syncUpdateFriendHandler=function syncUpdateFriendHandler(t){var a=reverseFriend(t.content.friend);this.logger.log("friend::emit syncFriendAction: updateFriend, ",null==a?void 0:a.account),this.core.emit("syncFriend",{type:"updateFriend",friend:a})},a.syncFriendsHandler=function syncFriendsHandler(t){var a=t.content;this.core.eventBus.emit("sync/updateTimetag",{friends:Bu(a.timetag)});var u=null==a?void 0:a.friends;if(u&&u.length){var m=map$6(u).call(u,(function(t){return reverseFriend(t)}));this.core.emit("friends",m)}},a.syncFriendUsersHandler=function syncFriendUsersHandler(t){var a=t.content;this.core.eventBus.emit("sync/updateTimetag",{friendUsers:Bu(a.timetag)});var u=null==a?void 0:a.users;if(u&&u.length){var m=map$6(u).call(u,(function(t){return formatUser(t)}));this.core.emit("users",m)}},FriendService}(vp);function formatSubscribes(t){return t&&t.length>0?map$6(t).call(t,(function(t){return function formatSubscribe(t){var a=Ut({},t),u=["subscribeTime","time"];return forEach$1(u).call(u,(function(t){a[t]&&(a[t]=Bu(a[t]))})),a}(t)})):[]}function formatEvent(t){if(!t)return t;var a=t.serverExt,u=__rest(t,["serverExt"]),m=["time","type","value"];if(forEach$1(m).call(m,(function(t){u[t]&&(u[t]=Bu(u[t]))})),u.clientType&&(u.clientType=getEnumKeyByEnumValue(Yd,u.clientType)||""),a)try{u.ext=JSON.parse(a),"string"==typeof u.ext[0]&&(u.ext=u.ext[0])}catch(t){}return u}var CM={"14_1":"publishEvent","14_2":"pushEvent","14_3":"subscribeEvent","14_4":"unSubscribeEventsByAccounts","14_5":"unSubscribeEventsByType","14_6":"querySubscribeEventsByAccounts","14_7":"querySubscribeEventsByType","14_9":"pushEvents"},bM={msgEvent:{type:1,value:2,idClient:3,ext:4,validTime:5,broadcastType:6,sync:7,validTimeType:8,durable:9,time:10,idServer:11,clientType:12,serverConfig:13,serverExt:14,appid:101,account:103,enableMultiClient:104,consid:106},msgEventSubscribe:{type:1,subscribeTime:2,sync:3,to:102,from:104,time:105}},EM=invertSerializeMap(bM),kM={publishEvent:{sid:14,cid:1,service:"event",params:[{type:"Property",name:"msgEvent",reflectMapper:bM.msgEvent}],response:[{type:"Property",name:"msgEvent",reflectMapper:EM.msgEvent}]},pushEvent:{sid:14,cid:2,service:"event",response:[{type:"Property",name:"msgEvent",reflectMapper:EM.msgEvent}]},subscribeEvent:{sid:14,cid:3,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:bM.msgEventSubscribe},{type:"StrArray",name:"accounts"}],response:[{type:"StrArray",name:"accounts"}]},unSubscribeEventsByAccounts:{sid:14,cid:4,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:bM.msgEventSubscribe},{type:"StrArray",name:"accounts"}],response:[{type:"StrArray",name:"accounts"}]},unSubscribeEventsByType:{sid:14,cid:5,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:bM.msgEventSubscribe}]},querySubscribeEventsByAccounts:{sid:14,cid:6,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:bM.msgEventSubscribe},{type:"StrArray",name:"accounts"}],response:[{type:"PropertyArray",name:"msgEventSubscribes",reflectMapper:EM.msgEventSubscribe}]},querySubscribeEventsByType:{sid:14,cid:7,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:bM.msgEventSubscribe}],response:[{type:"PropertyArray",name:"msgEventSubscribes",reflectMapper:EM.msgEventSubscribe}]},pushEvents:{sid:14,cid:9,service:"event",response:[{type:"PropertyArray",name:"msgEvents",reflectMapper:EM.msgEvent}]}},RM=function(t){function EventService(a){var u;return u=t.call(this,"event",a)||this,registerParser({cmdMap:CM,cmdConfig:kM}),u}wt(EventService,t);var a=EventService.prototype;return a.publishEvent=function publishEvent(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h;return lu.wrap((function _callee$(g){for(;;)switch(g.prev=g.next){case 0:return validate({type:{type:"number"},value:{type:"number"},ext:{type:"string",required:!1},validTime:{type:"number",min:60,max:2592e3,required:!1},broadcastType:{type:"number",required:!1},sync:{type:"boolean",required:!1}},t),u=Ut(Ut({validTime:t.validTime||604800,broadcastType:t.broadcastType||2},t),{idClient:Gu(),sync:!0===t.sync?1:0}),g.next=4,this.core.sendCmd("publishEvent",{msgEvent:u});case 4:return m=g.sent,h=(null===(a=m.content)||void 0===a?void 0:a.msgEvent)||{},g.abrupt("return",formatEvent(h));case 7:case"end":return g.stop()}}),_callee,this)})))},a.subscribeEvent=function subscribeEvent(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u,m,h;return lu.wrap((function _callee2$(g){for(;;)switch(g.prev=g.next){case 0:return validate({type:{type:"number"},accounts:{type:"array",itemType:"string",max:100},subscribeTime:{type:"number",min:60,max:2592e3,required:!1}},t),u=Ut(Ut({subscribeTime:2592e3},t),{sync:!0===t.sync?1:0}),g.next=4,this.core.sendCmd("subscribeEvent",{msgEventSubscribe:u,accounts:t.accounts});case 4:return m=g.sent,h=(null===(a=m.content)||void 0===a?void 0:a.accounts)||[],g.abrupt("return",{failedAccounts:h});case 7:case"end":return g.stop()}}),_callee2,this)})))},a.unSubscribeEvents=function unSubscribeEvents(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var u,m,h;return lu.wrap((function _callee3$(g){for(;;)switch(g.prev=g.next){case 0:if(validate({type:{type:"number"},accounts:{type:"array",itemType:"string",max:100,required:!1}},t),u={type:t.type},!(t.accounts&&t.accounts.length>0)){g.next=9;break}return g.next=5,this.core.sendCmd("unSubscribeEventsByAccounts",{msgEventSubscribe:u,accounts:t.accounts});case 5:h=g.sent,m=(null===(a=h.content)||void 0===a?void 0:a.accounts)||[],g.next=12;break;case 9:return g.next=11,this.core.sendCmd("unSubscribeEventsByType",{msgEventSubscribe:u});case 11:m=[];case 12:return g.abrupt("return",{failedAccounts:m});case 13:case"end":return g.stop()}}),_callee3,this)})))},a.querySubscribeEvents=function querySubscribeEvents(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var u;return lu.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:if(validate({type:{type:"number"},accounts:{type:"array",itemType:"string",max:100,required:!1}},t),!(t.accounts&&t.accounts.length>0)){m.next=7;break}return m.next=4,this.core.sendCmd("querySubscribeEventsByAccounts",{msgEventSubscribe:{type:t.type},accounts:t.accounts});case 4:u=m.sent,m.next=10;break;case 7:return m.next=9,this.core.sendCmd("querySubscribeEventsByType",{msgEventSubscribe:{type:t.type}});case 9:u=m.sent;case 10:return m.abrupt("return",formatSubscribes(null===(a=u.content)||void 0===a?void 0:a.msgEventSubscribes));case 11:case"end":return m.stop()}}),_callee4,this)})))},a.pushEventHandler=function pushEventHandler(t){var a,u=(null===(a=t.content)||void 0===a?void 0:a.msgEvent)||{};this.core.emit("pushEvents",[formatEvent(u)])},a.pushEventsHandler=function pushEventsHandler(t){var a,u=(null===(a=t.content)||void 0===a?void 0:a.msgEvents)||{};this.core.emit("pushEvents",function formatEvents(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return formatEvent(t)})):[]}(u))},EventService}(vp);function generateThreadMsgsParams(t){var a={scene:Kd[t.scene],from:t.threadMsgFromAccount,to:t.threadMsgToAccount,time:t.threadMsgTime,idServer:t.threadMsgIdServer},u={limit:t.limit<100?t.limit:100,beginTime:"number"==typeof t.beginTime?t.beginTime:0,reverse:!0===reverse$1(t)?1:0};return t.lastMsgId&&(u.lastMsgId=t.lastMsgId),{msg:a,threadMsgReq:u}}var AM,wM={"23_1":"getThreadMsgs","23_2":"getMsgsByIdServer"},NM={msg:zy,threadMsgReq:{beginTime:1,endTime:2,lastMsgId:3,limit:4,reverse:5},threadMsgsMeta:{total:1,lastMsgTime:2}},xM=invertSerializeMap(NM),OM={getThreadMsgs:{sid:23,cid:1,service:"msgExtend",params:[{type:"Property",name:"msg",reflectMapper:NM.msg},{type:"Property",name:"threadMsgReq",reflectMapper:NM.threadMsgReq}],response:[{type:"Property",name:"threadMsg",reflectMapper:xM.msg},{type:"Property",name:"threadMsgsMeta",reflectMapper:xM.threadMsgsMeta},{type:"PropertyArray",name:"msgs",reflectMapper:xM.msg}]},getMsgsByIdServer:{sid:23,cid:2,service:"msgExtend",params:[{type:"PropertyArray",name:"reqMsgs",reflectMapper:NM.msg}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:xM.msg}]}},PM=function(t){function MsgExtendService(a){var u;return u=t.call(this,"msgExtend",a)||this,registerParser({cmdMap:wM,cmdConfig:OM}),u}wt(MsgExtendService,t);var a=MsgExtendService.prototype;return a.getThreadMsgs=function getThreadMsgs(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g,M,I,S;return lu.wrap((function _callee$(T){for(;;)switch(T.prev=T.next){case 0:return validate({scene:{type:"enum",values:getEnumKeys(Kd)},threadMsgFromAccount:{type:"string",allowEmpty:!1},threadMsgIdServer:{type:"string",allowEmpty:!1},threadMsgTime:{type:"number"},threadMsgToAccount:{type:"string",allowEmpty:!1},beginTime:{type:"number",required:!1},endTime:{type:"number",required:!1},lastMsgId:{type:"string",allowEmpty:!1,required:!1},limit:{type:"number",min:1,max:100,required:!1},reverse:{type:"boolean",required:!1}},t),T.next=3,this.core.sendCmd("getThreadMsgs",generateThreadMsgsParams(t));case 3:return u=T.sent,m=u.content,h=m.msgs,g=m.threadMsg,M=u.content.threadMsgsMeta,I=getSessionId(g,this.core.account),S=null===(a=this.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:I}),h=formatMsgs$1(h,S?{account:this.core.account,sessionAck:S.ack,msgReceiptTime:S.msgReceiptTime}:{account:this.core.account}),g=formatMsg$1(g,S?{account:this.core.account,sessionAck:S.ack,msgReceiptTime:S.msgReceiptTime}:{account:this.core.account}),T.abrupt("return",{msgs:h,threadMsg:g,total:Bu(M.total),timetag:Bu(M.lastMsgTime)});case 11:case"end":return T.stop()}}),_callee,this)})))},a.getMsgsByIdServer=function getMsgsByIdServer(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h,g=this;return lu.wrap((function _callee2$(M){for(;;)switch(M.prev=M.next){case 0:return validate({reqMsgs:{type:"array",rules:{scene:{type:"enum",values:getEnumKeys(Kd)},from:{type:"string",allowEmpty:!1},to:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1},time:{type:"number"}},min:1,max:100}},t),M.next=3,this.core.sendCmd("getMsgsByIdServer",{reqMsgs:map$6(a=t.reqMsgs).call(a,(function(t){return Ut(Ut({},t),{scene:getEnumKeyByEnumValue(Kd,t.scene)})}))});case 3:return m=M.sent,h=map$6(u=m.content.msgs).call(u,(function(t){var a,u=getSessionId(t,g.core.account),m=null===(a=g.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:u});return formatMsg$1(t,m?{account:g.core.account,sessionAck:m.ack,msgReceiptTime:m.msgReceiptTime}:{account:g.core.account})})),M.abrupt("return",h);case 6:case"end":return M.stop()}}),_callee2,this)})))},MsgExtendService}(vp);!function(t){t[t.ASC=1]="ASC",t[t.DESC=2]="DESC"}(AM||(AM={}));var LM,VM={"7_6":"getHistoryMsgs","7_9":"deleteRoamingMsgs","4_24":"syncClearServerHistoryMsgs","7_18":"clearHistoryMsgsFromServer","7_118":"multiSyncClearServerHistoryMsgs","7_26":"nimFtsCloudMsgLogsAggWithSession","7_27":"nimFtsCloudMsgLogs"},UM={msg:zy,clearHistoryMsgsFromServerReqTag:{type:0,otherAccid:1,isDeleteRoam:2,toTid:3,isSyncSelf:4,time:6,ext:7},clearMsgsParamsWithSync:{type:0,otherAccid:1,isDeleteRoam:2,toTid:3,isSyncSelf:4,fromAccid:5,time:6,ext:7},ftsReqTag:{keyword:1,fromTime:2,toTime:3,sessionLimit:4,msglogsLimit:5,orderRule:6,p2pSessionList:7,teamSessionList:8,senderList:9,msgTypeList:10,msgSubTypeList:11}},DM=invertSerializeMap(UM),qM={deleteRoamingMsgs:{sid:7,cid:9,service:"msgLog",params:[{type:"StrArray",name:"ids"}]},getHistoryMsgs:{sid:7,cid:6,params:[{type:"String",name:"to"},{type:"Long",name:"beginTime"},{type:"Long",name:"endTime"},{type:"Long",name:"lastMsgId"},{type:"Int",name:"limit"},{type:"Bool",name:"reverse"},{type:"LongArray",name:"msgTypes"}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:DM.msg}],service:"msgLog"},clearHistoryMsgsFromServer:{sid:7,cid:18,params:[{type:"Property",name:"clearHistoryMsgsFromServerReqTag",reflectMapper:UM.clearHistoryMsgsFromServerReqTag}],response:[{type:"Long",name:"timetag"}],service:"msgLog"},multiSyncClearServerHistoryMsgs:{sid:7,cid:118,response:[{type:"Property",name:"data",reflectMapper:DM.clearMsgsParamsWithSync}],service:"msgLog"},syncClearServerHistoryMsgs:{sid:4,cid:24,service:"msgLog",response:[{type:"PropertyArray",name:"datas",reflectMapper:DM.clearMsgsParamsWithSync}]},nimFtsCloudMsgLogsAggWithSession:{sid:7,cid:26,service:"msgLog",params:[{type:"Property",name:"tag",reflectMapper:UM.ftsReqTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:DM.msg}]},nimFtsCloudMsgLogs:{sid:7,cid:27,service:"msgLog",params:[{type:"Property",name:"tag",reflectMapper:UM.ftsReqTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:DM.msg}]}};!function(t){t[t.p2p=1]="p2p",t[t.team=2]="team"}(LM||(LM={}));var BM={type:{type:"enum",values:LM},isDeleteRoam:{type:"boolean"},isSyncSelf:{type:"boolean"},time:{type:"number"}};function formatClearResult(t){var a=format(BM,t);return{sessionId:"p2p"===a.type?"p2p-"+a.otherAccid:"team-"+a.toTid,time:a.time}}var FM={orderRule:{type:"enum",values:AM}};function generateFtsTagForCmd(t){var a,u=format(FM,t);Un(u.msgTypeList)&&(u.msgTypeList=map$6(a=u.msgTypeList).call(a,(function(t){return Wd[t]})).join(","));var m=["p2pSessionList","teamSessionList","senderList","msgSubTypeList"];return forEach$1(m).call(m,(function(t){Un(u[t])&&(u[t]=u[t].join(","))})),u}var GM=function(t){function MsgLogService(a){var u;return(u=t.call(this,"msgLog",a)||this).onV2ClearHistoryMessage=function(t){var a=formatClearResult(t);u.core.eventBus.emit("session/updateForClearMsg",[a],!0)},registerParser({cmdMap:VM,cmdConfig:qM}),u.registerListener(),u}wt(MsgLogService,t);var a=MsgLogService.prototype;return a.registerListener=function registerListener(){this.core.eventBus.on("forwardReceive/msgLog/clearHistoryMsgsFromServer",this.onV2ClearHistoryMessage)},a.deleteRoamingMsgs=function deleteRoamingMsgs(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:validate({ids:{type:"array",itemType:"string"}},t),a=[],m.prev=2,a=map$6(u=t.ids).call(u,(function(t){var a=getAccountFromSessionId(t);return a.scene+"|"+a.accid})),m.next=10;break;case 6:throw m.prev=6,m.t0=m.catch(2),this.logger.error("Failed to delete roaming msgs with "+t.ids,m.t0),new Error("Failed to create session with "+t.ids);case 10:return m.next=12,this.core.sendCmd("deleteRoamingMsgs",{ids:a});case 12:case"end":return m.stop()}}),_callee,this,[[2,6]])})))},a.getHistoryMsgs=function getHistoryMsgs(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var m,h,g,M,I,S,T;return lu.wrap((function _callee2$(C){for(;;)switch(C.prev=C.next){case 0:return"function"!=typeof(null===(a=this.core.sync)||void 0===a?void 0:a.getSyncDoneFlag)||this.core.sync.getSyncDoneFlag()||this.logger.warn("Please call getHistoryMsgs after syncdone event"),validate({scene:{type:"enum",values:getEnumKeys(Kd)},to:{type:"string",allowEmpty:!1},beginTime:{type:"number",required:!1},endTime:{type:"number",required:!1},limit:{type:"number",min:1,max:100,required:!1},reverse:{type:"boolean",required:!1},lastMsgId:{type:"string",required:!1,allowEmpty:!1},asc:{type:"boolean",required:!1},msgTypes:{type:"array",itemType:"string",required:!1}},t),h="p2p"===t.scene?"getHistoryMsgs":"team"===t.scene?"getHistoryTeamMsgs":"getHistorySuperTeamMsgs",C.next=5,this.core.sendCmd(h,assignOptions({beginTime:0,endTime:0,lastMsgId:0,limit:100,reverse:!1},Ut(Ut({},t),{msgTypes:t.msgTypes?map$6(m=t.msgTypes).call(m,(function(t){return Wd[t]})):[]})));case 5:if(g=C.sent,(M=g.content).msgs&&M.msgs.length>0){C.next=9;break}return C.abrupt("return",[]);case 9:if(I=getSessionId(M.msgs[0],this.core.account),S=null===(u=this.core.session)||void 0===u?void 0:u.getSessionWithUncomplete({id:I}),T=formatMsgs$1(M.msgs,S?{account:this.core.account,sessionAck:S.ack,msgReceiptTime:S.msgReceiptTime}:{account:this.core.account}),!0!==t.asc){C.next=14;break}return C.abrupt("return",sort(T).call(T,(function(t,a){return t.time-a.time})));case 14:return C.abrupt("return",T);case 15:case"end":return C.stop()}}),_callee2,this)})))},a.clearHistoryMsgsFromServer=function clearHistoryMsgsFromServer(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return validate({scene:{type:"enum",values:["p2p","team"]},to:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1},isSyncSelf:{type:"boolean",required:!1}},t),(a=Ut(Ut({isDeleteRoam:1},t),{type:"team"===t.scene?2:1,isSyncSelf:!0===t.isSyncSelf?1:0}))[2===a.type?"toTid":"otherAccid"]=t.to,h.next=5,this.core.sendCmd("clearHistoryMsgsFromServer",{clearHistoryMsgsFromServerReqTag:a});case 5:return u=h.sent,m=u.content,this.core.eventBus.emit("session/updateForClearMsg",[{sessionId:t.scene+"-"+t.to}],!0),this.core.eventBus.emit("forwardSend/msgLog/clearHistoryMsgsFromServer",Ut(Ut({},a),{time:m.timetag})),h.abrupt("return",m);case 10:case"end":return h.stop()}}),_callee3,this)})))},a.multiSyncClearServerHistoryMsgsHandler=function multiSyncClearServerHistoryMsgsHandler(t){var a=formatClearResult(t.content.data);this.core.eventBus.emit("session/updateForClearMsg",[a],!0),this.core.emit("clearServerHistoryMsgs",[a])},a.ftsCloudMsgLogs=function ftsCloudMsgLogs(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.baseFtsCloudMsgLogs(t,"nimFtsCloudMsgLogs"));case 1:case"end":return a.stop()}}),_callee4,this)})))},a.ftsCloudMsgLogsAggWithSession=function ftsCloudMsgLogsAggWithSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){return lu.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.baseFtsCloudMsgLogs(t,"nimFtsCloudMsgLogsAggWithSession"));case 1:case"end":return a.stop()}}),_callee5,this)})))},a.baseFtsCloudMsgLogs=function baseFtsCloudMsgLogs(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var u,m,h,g=this;return lu.wrap((function _callee6$(M){for(;;)switch(M.prev=M.next){case 0:if(validate({keyword:{type:"string",allowEmpty:!1},fromTime:{type:"number",required:!1},toTime:{type:"number",required:!1},sessionLimit:{type:"number",required:!1},msglogsLimit:{type:"number",required:!1},orderRule:{type:"enum",values:getEnumKeys(AM),required:!1},p2pSessionList:{type:"array",itemType:"string",required:!1},teamSessionList:{type:"array",itemType:"string",required:!1},senderList:{type:"array",itemType:"string",required:!1},msgTypeList:{type:"array",itemType:"enum",values:getEnumKeys(Wd),required:!1},msgSubTypeList:{type:"array",itemType:"number",required:!1}},t),!(t.fromTime&&t.toTime&&t.toTime<t.fromTime)){M.next=3;break}throw new Kl("Request parameter error: toTime should be greater than fromTime",t,"");case 3:return m=generateFtsTagForCmd(t),M.next=6,this.core.sendCmd(a,{tag:m});case 6:return h=M.sent,M.abrupt("return",map$6(u=h.content.datas).call(u,(function(t){var a,u=getSessionId(t,g.core.account),m=null===(a=g.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:u});return formatMsg$1(t,m?{account:g.core.account,sessionAck:m.ack,msgReceiptTime:m.msgReceiptTime}:{account:g.core.account})})));case 8:case"end":return M.stop()}}),_callee6,this)})))},a.syncClearServerHistoryMsgsHandler=function syncClearServerHistoryMsgsHandler(t){var a=function formatClearResults(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return formatClearResult(t)})):[]}(t.content.datas);this.core.emit("clearServerHistoryMsgs",a)},MsgLogService}(vp),HM={"22_1":"requestProxy","22_2":"onRequestProxy"},jM={requestProxyTag:{zone:1,path:2,method:3,header:4,body:5},requestProxyMsgTag:{from:1,body:2,time:3}},$M=invertSerializeMap(jM),zM={requestProxy:{sid:22,cid:1,service:"passThrough",params:[{type:"Property",name:"requestProxyTag",reflectMapper:jM.requestProxyTag}],response:[{type:"Property",name:"requestProxyTag",reflectMapper:$M.requestProxyTag}]},onRequestProxy:{sid:22,cid:2,service:"passThrough",response:[{type:"Property",name:"proxyMsg",reflectMapper:$M.requestProxyMsgTag}]}},WM=function(t){function PassThroughService(a){var u;return(u=t.call(this,"passThrough",a)||this).core=a,registerParser({cmdMap:HM,cmdConfig:zM}),u}wt(PassThroughService,t);var a=PassThroughService.prototype;return a.request=function request(t){return validate({path:{type:"string",allowEmpty:!1}},t),this.core.sendCmd("requestProxy",{requestProxyTag:t}).then((function(t){return t.content.requestProxyTag}))},a.onRequestProxyHandler=function onRequestProxyHandler(t){var a=t.content.proxyMsg;a&&a.time&&(a.time=+a.time),this.core.emit("proxyMsg",a)},PassThroughService}(vp),KM=invert({none:0,normal:1,all:3}),YM=invert({normal:0,advanced:1}),QM=invert({normal:0,owner:1,manager:2}),JM={noVerify:0,needVerify:1,rejectAll:2},XM=invert(JM),ZM={needVerify:0,noVerify:1},eI=invert(ZM),tI={manager:0,all:1},rI=invert(tI),nI={manager:0,all:1},aI=invert(nI),iI={manager:0,all:1},oI=invert(iI);function formatSuperTeam(t){var a,u=["teamId"],m=["level","memberNum","memberUpdateTime","createTime","updateTime"],h=["valid","validToCurrentUser","mute"],g={type:YM,muteType:KM,joinMode:XM,beInviteMode:eI,inviteMode:rI,updateTeamMode:aI,updateExtMode:oI};t.bits;var M=__rest(t,["bits"]);return forEach$1(u).call(u,(function(t){M[t]&&(M[t]=M[t].toString())})),forEach$1(m).call(m,(function(t){void 0!==M[t]&&(M[t]=Bu(M[t]))})),forEach$1(h).call(h,(function(t){void 0!==M[t]&&(M[t]=1===Bu(M[t]))})),forEach$1(a=Gt(g)).call(a,(function(t){void 0!==M[t]&&(M[t]=g[t][M[t]]||M[t])})),M}function formatSuperTeams(t){return t&&t.length>0?map$6(t).call(t,(function(t){return formatSuperTeam(t)})):[]}function generateSuperTeam(t){var a,u=Ut({},t),m=["avatar","name","intro","announcement","ext"],h={joinMode:JM,beInviteMode:ZM,inviteMode:tI,updateTeamMode:nI,updateExtMode:iI};return forEach$1(m).call(m,(function(t){void 0!==u[t]&&(u[t]=u[t].toString())})),forEach$1(a=Gt(h)).call(a,(function(t){void 0!==u[t]&&(u[t]=h[t][u[t]])})),u}function generatorSuperTeamMemberForCmd(t){var a=["teamId","ext","account","nickInTeam"],u={};return void 0!==t.bitConfigMask&&(u.bits=Bu(t.bitConfigMask)),forEach$1(a).call(a,(function(a){t[a]&&(u[a]=t[a].toString())})),Object.prototype.hasOwnProperty.call(t,"nickInTeam")&&(u.nickInTeam=t.nickInTeam),u}function formatSuperTeamMember(t){var a,u=["teamId"],m=["joinTime","updateTime","bitConfigMask"],h=["active","valid","mute"],g={type:QM},M=t.bits,I=__rest(t,["bits"]);return void 0!==M&&(I.muteTeam=1===Bu(M),I.bitConfigMask=M),I.id=I.teamId+"-"+I.account,forEach$1(u).call(u,(function(t){I[t]&&(I[t]=I[t].toString())})),forEach$1(m).call(m,(function(t){void 0!==I[t]&&(I[t]=Bu(I[t]))})),forEach$1(h).call(h,(function(t){void 0!==I[t]&&(I[t]=1===Bu(I[t]))})),forEach$1(a=Gt(g)).call(a,(function(t){void 0!==I[t]&&(I[t]=g[t][I[t]]||I[t])})),I}function formatSuperTeamMembers(t){return t&&t.length>0?map$6(t).call(t,(function(t){return formatSuperTeamMember(t)})):[]}function generatorMemberBySuperTeam(t,a,u){return void 0===u&&(u="normal"),{id:t.teamId+"-"+a,teamId:t.teamId,account:a,type:u,nickInTeam:"",muteTeam:!1,mute:!1,joinTime:t.memberUpdateTime,updateTime:t.memberUpdateTime,active:!0,valid:!0}}function generatorMembersBySuperTeam(t,a,u){return void 0===u&&(u="normal"),a&&a.length>0?map$6(a).call(a,(function(a){return generatorMemberBySuperTeam(t,a,u)})):[]}var sI=function(){function ModuleService(t){this.core=t}var t=ModuleService.prototype;return t.notifyAddSuperTeamMembers=function notifyAddSuperTeamMembers(t,a){this.core.emit("addSuperTeamMembers",{team:t,accounts:a,members:generatorMembersBySuperTeam(t,a)})},t.notifyUpdateSuperTeamManagers=function notifyUpdateSuperTeamManagers(t,a,u,m){this.core.emit("updateSuperTeamManagers",{team:{teamId:t,memberUpdateTime:m},accounts:a,isManager:u,members:map$6(a).call(a,(function(a){return{id:t+"-"+a,type:u?"manager":"normal",account:a,updateTime:m}}))})},t.notifyRemoveSuperTeamMembers=function notifyRemoveSuperTeamMembers(t,a){this.core.emit("removeSuperTeamMembers",{team:t,accounts:a})},t.notifyTransferSuperTeam=function notifyTransferSuperTeam(t,a,u){this.core.emit("transferSuperTeam",{team:t,from:{id:t.teamId+"-"+a,account:a,type:"normal",updateTime:t.memberUpdateTime},to:{id:t.teamId+"-"+u,account:u,type:"owner",updateTime:t.memberUpdateTime}})},t.notifyUpdateSuperTeamMembersMute=function notifyUpdateSuperTeamMembersMute(t,a,u){this.core.emit("updateSuperTeamMembersMute",{team:t,accounts:a,members:map$6(a).call(a,(function(a){return{id:t.teamId+"-"+a,account:a,teamId:t.teamId,mute:u,updateTime:t.memberUpdateTime}})),mute:u})},ModuleService}(),cI={"21_5":"addSuperTeamMembers","21_6":"removeSuperTeamMembers","21_7":"leaveSuperTeam","21_8":"updateSuperTeamInfo","21_9":"getSuperTeamInfo","21_12":"getSuperTeams","21_15":"getSuperTeamMembers","21_10":"updateMySuperTeamMemberInfo","21_20":"applySuperTeam","21_21":"passSuperTeamApply","21_22":"rejectSuperTeamApply","21_23":"acceptSuperTeamInvite","21_24":"rejectSuperTeamInvite","21_26":"addSuperTeamManagers","21_27":"removeSuperTeamManagers","21_28":"muteSuperTeam","21_29":"muteSuperTeamMembers","21_30":"updateSuperTeamMemberNick","21_31":"transferSuperTeam","21_33":"getSuperTeamMembersByAccounts","21_34":"queryMuteSuperTeamMembers","21_101":"syncCreateSuperTeam","21_109":"syncSuperTeams","21_110":"syncUpdateSuperTeamMember","21_111":"syncMySuperTeamMembers"},lI={superTeam:{teamId:1,name:3,type:4,owner:5,level:6,selfCustom:7,valid:8,memberNum:9,memberUpdateTime:10,createTime:11,updateTime:12,validToCurrentUser:13,intro:14,announcement:15,joinMode:16,bits:17,ext:18,serverExt:19,avatar:20,beInviteMode:21,inviteMode:22,updateTeamMode:23,updateExtMode:24,mute:100,muteType:101},superTeamMember:{teamId:1,account:3,type:4,nickInTeam:5,bits:7,active:8,valid:9,updateTime:11,ext:12,mute:13,invitorAccid:14,joinTime:15}},uI=invertSerializeMap(lI),dI={getSuperTeamInfo:{sid:21,cid:9,service:"superTeam",params:[{type:"Long",name:"teamId"}],response:[{type:"Property",name:"superTeam",reflectMapper:uI.superTeam}]},getSuperTeams:{sid:21,cid:12,service:"superTeam",params:[{type:"Long",name:"timetag"}],response:[{type:"PropertyArray",name:"superTeams",reflectMapper:uI.superTeam},{type:"Bool",name:"isAll"},{type:"Long",name:"timetag"}]},updateSuperTeamInfo:{sid:21,cid:8,service:"superTeam",params:[{type:"Property",name:"superTeam",reflectMapper:lI.superTeam}],response:[{type:"Long",name:"time"}]},addSuperTeamMembers:{sid:21,cid:5,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"},{type:"String",name:"ps"}],response:[{type:"StrArray",name:"abortedAccidList"},{type:"Long",name:"time"}]},removeSuperTeamMembers:{sid:21,cid:6,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},addSuperTeamManagers:{sid:21,cid:26,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},removeSuperTeamManagers:{sid:21,cid:27,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},applySuperTeam:{sid:21,cid:20,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"ps"}],response:[{type:"Property",name:"superTeam",reflectMapper:uI.superTeam}]},transferSuperTeam:{sid:21,cid:31,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"account"},{type:"Bool",name:"leave"}]},muteSuperTeam:{sid:21,cid:28,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"Int",name:"mute"}]},muteSuperTeamMembers:{sid:21,cid:29,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"},{type:"Int",name:"mute"}]},updateSuperTeamMemberNick:{sid:21,cid:30,service:"superTeam",params:[{type:"Property",name:"teamMember",reflectMapper:lI.superTeamMember}]},updateMySuperTeamMemberInfo:{sid:21,cid:10,service:"superTeam",params:[{type:"Property",name:"teamMember",reflectMapper:lI.superTeamMember}]},getSuperTeamMembersByAccounts:{sid:21,cid:33,service:"superTeam",params:[{type:"StrArray",name:"memberIds"}],response:[{type:"PropertyArray",name:"superTeamMembers",reflectMapper:uI.superTeamMember}]},getSuperTeamMembers:{sid:21,cid:15,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"Long",name:"joinTime"},{type:"Int",name:"limit"},{type:"Bool",name:"reverse"}],response:[{type:"PropertyArray",name:"superTeamMembers",reflectMapper:uI.superTeamMember}]},queryMuteSuperTeamMembers:{sid:21,cid:34,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"Long",name:"joinTime"},{type:"Int",name:"limit"},{type:"Bool",name:"reverse"}],response:[{type:"PropertyArray",name:"superTeamMembers",reflectMapper:uI.superTeamMember}]},leaveSuperTeam:{sid:21,cid:7,service:"superTeam",params:[{type:"Long",name:"teamId"}]},passSuperTeamApply:{sid:21,cid:21,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},rejectSuperTeamApply:{sid:21,cid:22,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},acceptSuperTeamInvite:{sid:21,cid:23,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},rejectSuperTeamInvite:{sid:21,cid:24,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},syncSuperTeams:{sid:21,cid:109,service:"superTeam",response:[{type:"PropertyArray",name:"teams",reflectMapper:uI.superTeam},{type:"Bool",name:"isAll"},{type:"Long",name:"timetag"}]},syncCreateSuperTeam:{sid:21,cid:101,service:"superTeam",response:[{type:"Property",name:"superTeam",reflectMapper:uI.superTeam}]},syncUpdateSuperTeamMember:{sid:21,cid:110,service:"superTeam",response:[{type:"Property",name:"teamMember",reflectMapper:uI.superTeamMember}]},syncMySuperTeamMembers:{sid:21,cid:111,ext:"sync",service:"superTeam",response:[{type:"PropertyArray",name:"teamMembers",reflectMapper:uI.superTeamMember},{type:"Long",name:"timetag"}]}},pI=function(t){function SuperTeamService(a){var u;return(u=t.call(this,"superTeam",a)||this).mySuperTeamMembersMap=new _c,u.service=new sI(a),registerParser({cmdMap:cI,cmdConfig:dI}),u.setListeners(),u}wt(SuperTeamService,t);var a=SuperTeamService.prototype;return a.setListeners=function setListeners(){var t=this;this.core.eventBus.on("forwardReceive/superTeam/updateMyMemberInfo",(function(a){t.emitMemberUpdate(a)})),this.core.eventBus.on("team/onNotification",(function(a){return t.notificationHandler(a)}))},a.reset=function reset(){this.mySuperTeamMembersMap.clear()},a.mergeMySuperTeamMembers=function mergeMySuperTeamMembers(t){var a=this;forEach$1(t).call(t,(function(t){var u=t.teamId,m=a.mySuperTeamMembersMap.get(u),h=Ut({},m,t);a.mySuperTeamMembersMap.set(u,h)}))},a.getSuperTeamInfo=function getSuperTeamInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),m.next=3,this.core.sendCmd("getSuperTeamInfo",{teamId:t.teamId});case 3:return a=m.sent,u=a.content.superTeam,m.abrupt("return",formatSuperTeam(u));case 6:case"end":return m.stop()}}),_callee,this)})))},a.getSuperTeams=function getSuperTeams(){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var t,a;return lu.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.core.sendCmd("getSuperTeams",{timetag:0});case 2:return t=u.sent,a=t.content.superTeams,u.abrupt("return",formatSuperTeams(a));case 5:case"end":return u.stop()}}),_callee2,this)})))},a.updateSuperTeamInfo=function updateSuperTeamInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},name:{type:"string",allowEmpty:!1,required:!1},joinMode:{type:"enum",values:["noVerify","needVerify","rejectAll"],required:!1},beInviteMode:{type:"enum",values:["noVerify","needVerify"],required:!1},inviteMode:{type:"enum",values:["manager","all"],required:!1},updateTeamMode:{type:"enum",values:["manager","all"],required:!1},updateExtMode:{type:"enum",values:["manager","all"],required:!1},intro:{type:"string",allowEmpty:!0,required:!1},announcement:{type:"string",allowEmpty:!0,required:!1},avatar:{type:"string",allowEmpty:!0,required:!1},ext:{type:"string",allowEmpty:!0,required:!1}},t),a=generateSuperTeam(t),u.next=4,this.core.sendCmd("updateSuperTeamInfo",{superTeam:a});case 4:return u.abrupt("return",formatSuperTeam(a));case 5:case"end":return u.stop()}}),_callee3,this)})))},a.addSuperTeamMembers=function addSuperTeamMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",min:1},ps:{type:"string",allowEmpty:!0,max:5e3,required:!1}},t),a.next=3,this.core.sendCmd("addSuperTeamMembers",{teamId:t.teamId,accounts:t.accounts,ps:t.ps||"",attach:t.ext||""});case 3:case"end":return a.stop()}}),_callee4,this)})))},a.removeSuperTeamMembers=function removeSuperTeamMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){return lu.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",min:1}},t),a.next=3,this.core.sendCmd("removeSuperTeamMembers",{teamId:t.teamId,accounts:t.accounts});case 3:case"end":return a.stop()}}),_callee5,this)})))},a.addSuperTeamManagers=function addSuperTeamManagers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){return lu.wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",min:1,itemType:"string"}},t),a.next=3,this.core.sendCmd("addSuperTeamManagers",t);case 3:case"end":return a.stop()}}),_callee6,this)})))},a.removeSuperTeamManagers=function removeSuperTeamManagers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",min:1,itemType:"string"}},t),a.next=3,this.core.sendCmd("removeSuperTeamManagers",t);case 3:case"end":return a.stop()}}),_callee7,this)})))},a.applySuperTeam=function applySuperTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a;return lu.wrap((function _callee8$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},ps:{type:"string",allowEmpty:!0,max:5e3,required:!1}},t),u.next=3,this.core.sendCmd("applySuperTeam",{teamId:t.teamId,ps:t.ps||""});case 3:return a=u.sent,u.abrupt("return",formatSuperTeam(a.content.superTeam));case 5:case"end":return u.stop()}}),_callee8,this)})))},a.transferSuperTeam=function transferSuperTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){return lu.wrap((function _callee9$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},leave:{type:"boolean"}},t),a.next=3,this.core.sendCmd("transferSuperTeam",t);case 3:case"end":return a.stop()}}),_callee9,this)})))},a.muteSuperTeam=function muteSuperTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){return lu.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},mute:{type:"boolean"}},t),a.next=3,this.core.sendCmd("muteSuperTeam",{teamId:t.teamId,mute:t.mute?1:0});case 3:case"end":return a.stop()}}),_callee10,this)})))},a.muteSuperTeamMembers=function muteSuperTeamMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){return lu.wrap((function _callee11$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string"},mute:{type:"boolean"}},t),a.next=3,this.core.sendCmd("muteSuperTeamMembers",{teamId:t.teamId,accounts:t.accounts,mute:t.mute?1:0});case 3:case"end":return a.stop()}}),_callee11,this)})))},a.updateMemberNick=function updateMemberNick(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){var a,u;return lu.wrap((function _callee12$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},nickInTeam:{type:"string",allowEmpty:!0}},t),a=generatorSuperTeamMemberForCmd({teamId:t.teamId,nickInTeam:t.nickInTeam,account:t.account}),m.next=4,this.core.sendCmd("updateSuperTeamMemberNick",{teamMember:a});case 4:return u=formatSuperTeamMember(Ut({updateTime:(new Date).getTime()},a)),m.abrupt("return",u);case 6:case"end":return m.stop()}}),_callee12,this)})))},a.updateMyMemberInfo=function updateMyMemberInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){var a,u,m;return lu.wrap((function _callee13$(h){for(;;)switch(h.prev=h.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},nickInTeam:{type:"string",allowEmpty:!0,required:!1},bitConfigMask:{type:"number",min:0,max:2,required:!1},ext:{type:"string",required:!1}},t),a=generatorSuperTeamMemberForCmd({teamId:t.teamId,nickInTeam:t.nickInTeam,bitConfigMask:t.bitConfigMask,ext:t.ext}),h.next=4,this.core.sendCmd("updateMySuperTeamMemberInfo",{teamMember:a});case 4:return u=formatSuperTeamMember(Ut({updateTime:(new Date).getTime(),account:this.core.account},a)),m=this.emitMemberUpdate(u),this.core.eventBus.emit("forwardSend/superTeam/updateMyMemberInfo",m),h.abrupt("return",u);case 8:case"end":return h.stop()}}),_callee13,this)})))},a.getSuperTeamMembersByAccounts=function getSuperTeamMembersByAccounts(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){var u,m,h;return lu.wrap((function _callee14$(g){for(;;)switch(g.prev=g.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",max:20,min:1}},t),m=map$6(u=t.accounts).call(u,(function(a){return t.teamId+"|"+a})),g.next=4,this.core.sendCmd("getSuperTeamMembersByAccounts",{memberIds:m});case 4:return h=g.sent,g.abrupt("return",formatSuperTeamMembers(null===(a=h.content)||void 0===a?void 0:a.superTeamMembers));case 6:case"end":return g.stop()}}),_callee14,this)})))},a.getSuperTeamMembers=function getSuperTeamMembers(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){var u;return lu.wrap((function _callee15$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},joinTime:{type:"number",min:0,required:!1},limit:{type:"number",min:1,max:1e3,required:!1},reverse:{type:"boolean",required:!1}},t),m.next=3,this.core.sendCmd("getSuperTeamMembers",Ut({joinTime:0,limit:100,reverse:!1},t));case 3:return u=m.sent,m.abrupt("return",formatSuperTeamMembers(null===(a=u.content)||void 0===a?void 0:a.superTeamMembers));case 5:case"end":return m.stop()}}),_callee15,this)})))},a.queryMuteMembers=function queryMuteMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var a,u;return lu.wrap((function _callee16$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},joinTime:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1},reverse:{type:"boolean",required:!1}},t),m.next=3,this.core.sendCmd("queryMuteSuperTeamMembers",Ut({limit:100,joinTime:0,reverse:!1},t));case 3:return a=m.sent,u=a.content,m.abrupt("return",formatSuperTeamMembers(u.superTeamMembers));case 6:case"end":return m.stop()}}),_callee16,this)})))},a.leaveSuperTeam=function leaveSuperTeam(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee17(){return lu.wrap((function _callee17$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),a.next=3,this.core.sendCmd("leaveSuperTeam",{teamId:t.teamId});case 3:case"end":return a.stop()}}),_callee17,this)})))},a.passSuperTeamApply=function passSuperTeamApply(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee18(){var a;return lu.wrap((function _callee18$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("passSuperTeamApply",t);case 4:this.core.eventBus.emit("forwardSend/superTeam/passTeamApply",t),u.next=12;break;case 7:throw u.prev=7,u.t0=u.catch(1),a=u.t0,this.core.eventBus.emit("forwardSend/superTeam/passTeamApply",t,null==a?void 0:a.code),u.t0;case 12:case"end":return u.stop()}}),_callee18,this,[[1,7]])})))},a.rejectSuperTeamApply=function rejectSuperTeamApply(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee19(){var a;return lu.wrap((function _callee19$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1},ps:{type:"string",max:5e3,required:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("rejectSuperTeamApply",{teamId:t.teamId,from:t.from,ps:t.ps||""});case 4:this.core.eventBus.emit("forwardSend/superTeam/rejectSuperTeamApply",t),u.next=12;break;case 7:throw u.prev=7,u.t0=u.catch(1),a=u.t0,this.core.eventBus.emit("forwardSend/superTeam/rejectSuperTeamApply",t,null==a?void 0:a.code),u.t0;case 12:case"end":return u.stop()}}),_callee19,this,[[1,7]])})))},a.acceptSuperTeamInvite=function acceptSuperTeamInvite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee20(){var a;return lu.wrap((function _callee20$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("acceptSuperTeamInvite",t);case 4:this.core.eventBus.emit("forwardSend/superTeam/acceptSuperTeamInvite",t),u.next=12;break;case 7:throw u.prev=7,u.t0=u.catch(1),a=u.t0,this.core.eventBus.emit("forwardSend/superTeam/acceptSuperTeamInvite",t,null==a?void 0:a.code),u.t0;case 12:case"end":return u.stop()}}),_callee20,this,[[1,7]])})))},a.rejectSuperTeamInvite=function rejectSuperTeamInvite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee21(){var a;return lu.wrap((function _callee21$(u){for(;;)switch(u.prev=u.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1},ps:{type:"string",max:5e3,required:!1}},t),u.prev=1,u.next=4,this.core.sendCmd("rejectSuperTeamInvite",{teamId:t.teamId,from:t.from,ps:t.ps||""});case 4:this.core.eventBus.emit("forwardSend/superTeam/rejectSuperTeamInvite",t),u.next=12;break;case 7:throw u.prev=7,u.t0=u.catch(1),a=u.t0,this.core.eventBus.emit("forwardSend/superTeam/rejectSuperTeamInvite",t,null==a?void 0:a.code),u.t0;case 12:case"end":return u.stop()}}),_callee21,this,[[1,7]])})))},a.emitMemberUpdate=function emitMemberUpdate(t){t=formatSuperTeamMember(t),this.mergeMyTeamMembers([t]),this.core.emit("updateTeamMember",t);var a=cloneDeep(this.mySuperTeamMembersMap.get(t.teamId));return this.core.emit("myTeamMembers",[a]),a},a.mergeMyTeamMembers=function mergeMyTeamMembers(t){var a=this;forEach$1(t).call(t,(function(t){var u=t.teamId,m=a.mySuperTeamMembersMap.get(u),h=Ut({},m,t);a.mySuperTeamMembersMap.set(u,h)}))},a.syncSuperTeamsHandler=function syncSuperTeamsHandler(t){var a=t.content;this.core.eventBus.emit("sync/updateTimetag",{superTeams:Bu(a.timetag)});var u=null==a?void 0:a.teams;if(u&&u.length){var m=formatSuperTeams(u);this.core.emit("superTeams",m)}},a.syncCreateSuperTeamHandler=function syncCreateSuperTeamHandler(t){var a=t.content,u=formatSuperTeam(null==a?void 0:a.superTeam),m=generatorMemberBySuperTeam(u,u.owner,"owner");this.core.emit("createSuperTeam",u,m)},a.syncUpdateSuperTeamMemberHandler=function syncUpdateSuperTeamMemberHandler(t){var a=t.content,u=formatSuperTeamMember(null==a?void 0:a.teamMember);u.updateTime||(u.updateTime=(new Date).getTime()),this.mergeMySuperTeamMembers([u]),this.core.emit("updateSuperTeamMember",u);var m=cloneDeep(this.mySuperTeamMembersMap.get(u.teamId));this.core.emit("mySuperTeamMembers",[m])},a.syncMySuperTeamMembersHandler=function syncMySuperTeamMembersHandler(t){var a,u=t.content;this.core.eventBus.emit("sync/updateTimetag",{mySuperTeamMembers:Bu(u.timetag)});var m=null==u?void 0:map$6(a=u.teamMembers).call(a,(function(t){return formatSuperTeamMember(t)}));this.mergeMySuperTeamMembers(m),this.core.emit("mySuperTeamMembers",cloneDeep(m))},a.notificationHandler=function notificationHandler(t){var a=t.attach,u=t.scene,m=t.from,h=t.to,g=t.time,M=t.idServer,I=t.idClient,S=a.team,T=a.account,C=a.accounts,b=a.type;if("superTeam"===u)switch(this.logger.getDebugMode()?this.logger.debug("superTeam::recvNotification",M,I,a):this.logger.log("superTeam::recvNotification",M,I,h,b,T,C),b){case"updateSuperTeam":S.updateTime=g,this.core.emit("updateSuperTeam",S);break;case"addSuperTeamMembers":this.service.notifyAddSuperTeamMembers(S,C);break;case"acceptSuperTeamInvite":this.service.notifyAddSuperTeamMembers(S,[m]);break;case"passSuperTeamApply":this.service.notifyAddSuperTeamMembers(S,[T]);break;case"addSuperTeamManagers":this.service.notifyUpdateSuperTeamManagers(h,C,!0,g);break;case"removeSuperTeamManagers":this.service.notifyUpdateSuperTeamManagers(h,C,!1,g);break;case"removeSuperTeamMembers":this.service.notifyRemoveSuperTeamMembers(S,C);break;case"leaveSuperTeam":this.service.notifyRemoveSuperTeamMembers(S,[m]);break;case"dismissSuperTeam":this.core.emit("dismissSuperTeam",{teamId:h});break;case"transferSuperTeam":this.service.notifyTransferSuperTeam(S,m,T);break;case"updateSuperTeamMembersMute":this.service.notifyUpdateSuperTeamMembersMute(S,C,a.mute)}},SuperTeamService}(vp),mI={"13_1":"getChatroomAddress","24_1":"getQChatAddress"},hI={getChatroomAddress:{sid:13,cid:1,service:"plugin",params:[{type:"Long",name:"chatroomId"},{type:"Bool",name:"isWeixinApp"},{type:"Int",name:"ipType"}],response:[{type:"StrArray",name:"address"}]},getQChatAddress:{sid:24,cid:1,service:"plugin",params:[{type:"Property",name:"getQChatAddressTag",reflectMapper:{ipType:1}}],response:[{type:"StrArray",name:"address"}]}},gI=function(t){function PluginService(a){var u;return(u=t.call(this,"plugin",a)||this).core=a,registerParser({cmdMap:mI,cmdConfig:hI}),u}wt(PluginService,t);var a=PluginService.prototype;return a.getChatroomAddress=function getChatroomAddress(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return validate({chatroomId:{type:"string",allowEmpty:!1},ipType:{type:"number",required:!1}},t),u.next=3,this.core.sendCmd("getChatroomAddress",{chatroomId:t.chatroomId,isWeixinApp:"WXAPP"===uu.platform,ipType:t.ipType||0});case 3:return a=u.sent,u.abrupt("return",a.content.address);case 5:case"end":return u.stop()}}),_callee,this)})))},a.getQChatAddress=function getQChatAddress(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a;return lu.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return validate({ipType:{type:"number",required:!1}},t),u.next=3,this.core.sendCmd("getQChatAddress",{getQChatAddressTag:{ipType:(null==t?void 0:t.ipType)||0}});case 3:return a=u.sent,u.abrupt("return",a.content.address);case 5:case"end":return u.stop()}}),_callee2,this)})))},PluginService}(vp),vI={"7_19":"nimQueryCloudSessionList","7_20":"nimQueryCloudSession","7_21":"nimUpdateCloudSession","7_22":"nimDeleteCloudSessionList","7_121":"nimMultiSyncUpdateCloudSession"},fI={sessionReqTag:{minTimestamp:1,maxTimestamp:2,includedLastMsg:3,limit:4,hasMore:5},sessionTag:{sessionId:1,updateTime:2,ext:3,lastMsg:4,lastMsgType:5}},yI=invertSerializeMap(fI),MI={nimQueryCloudSessionList:{sid:7,cid:19,service:"cloudSession",params:[{type:"Property",name:"tag",reflectMapper:fI.sessionReqTag}],response:[{type:"Property",name:"tag",reflectMapper:yI.sessionReqTag},{type:"PropertyArray",name:"sessions",reflectMapper:yI.sessionTag}]},nimQueryCloudSession:{sid:7,cid:20,service:"cloudSession",params:[{type:"Property",name:"tag",reflectMapper:fI.sessionTag}],response:[{type:"Property",name:"session",reflectMapper:yI.sessionTag}]},nimUpdateCloudSession:{sid:7,cid:21,service:"cloudSession",params:[{type:"Property",name:"tag",reflectMapper:fI.sessionTag}]},nimDeleteCloudSessionList:{sid:7,cid:22,service:"cloudSession",params:[{type:"PropertyArray",name:"tags",reflectMapper:fI.sessionTag}]},nimMultiSyncUpdateCloudSession:{sid:7,cid:121,service:"cloudSession",response:[{type:"Property",name:"session",reflectMapper:yI.sessionTag}]}},II={sessionId:{type:"string"},updateTime:{type:"number"},ext:{type:"string"},lastMsg:{type:"object"},lastMsgType:{type:"number"}};function formatCloudSession(t,a,u){var m=format(II,t),h=getAccountFromSessionId(m.sessionId,"|"),g=h.accid,M=h.scene;if(m.sessionId=M+"-"+g,m.lastMsg){var I=1===m.lastMsgType;m.lastMsgInfo=I?{isLastMsgRecalled:I,revokedMsg:formatSystemMessage(deserialize(m.lastMsg,gM.sysMsg),u)}:{isLastMsgRecalled:I,lastMsg:formatMsg$1(deserialize(m.lastMsg,Ky.msg),{account:a})}}return delete m.lastMsg,delete m.lastMsgType,m}function formatCloudSessions(t,a,u){return t&&t.length>0?map$6(t).call(t,(function(t){return formatCloudSession(t,a,u)})):[]}var _I=function(t){function CloudSessionService(a){var u;return u=t.call(this,"cloudSession",a)||this,registerParser({cmdMap:vI,cmdConfig:MI}),u}wt(CloudSessionService,t);var a=CloudSessionService.prototype;return a.queryCloudSessionList=function queryCloudSessionList(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g;return lu.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:return validate({minTimestamp:{type:"number",min:0,required:!1},maxTimestamp:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1},includedLastMsg:{type:"boolean",required:!1}},t),(u=Ut({limit:100,includedLastMsg:!0},t)).includedLastMsg=ap.boolean(t,"includedLastMsg"),M.next=5,this.core.sendCmd("nimQueryCloudSessionList",{tag:u});case 5:return m=M.sent,h=(null===(a=m.content)||void 0===a?void 0:a.tag)||{},g=m.content.sessions,M.abrupt("return",{hasMore:+h.hasMore>0,sessionList:formatCloudSessions(g,this.core.account,this.logger)});case 9:case"end":return M.stop()}}),_callee,this)})))},a.queryCloudSession=function queryCloudSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h;return lu.wrap((function _callee2$(g){for(;;)switch(g.prev=g.next){case 0:return validate({sessionId:{type:"string",allowEmpty:!1}},t),a=getAccountFromSessionId(t.sessionId,"-"),u=a.accid,m=a.scene,g.next=4,this.core.sendCmd("nimQueryCloudSession",{tag:{sessionId:"superTeam"===m?"super_team|"+u:m+"|"+u}});case 4:return h=g.sent,g.abrupt("return",formatCloudSession(h.content.session,this.core.account,this.logger));case 6:case"end":return g.stop()}}),_callee2,this)})))},a.updateCloudSession=function updateCloudSession(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u,m;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return validate({sessionId:{type:"string",allowEmpty:!1},ext:{type:"string",allowEmpty:!1,required:!1}},t),a=getAccountFromSessionId(t.sessionId,"-"),u=a.accid,m=a.scene,h.next=4,this.core.sendCmd("nimUpdateCloudSession",{tag:{sessionId:"superTeam"===m?"super_team|"+u:m+"|"+u,ext:t.ext}});case 4:case"end":return h.stop()}}),_callee3,this)})))},a.deleteCloudSessionList=function deleteCloudSessionList(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a,u;return lu.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:return validate({sessionIdList:{type:"array",itemType:"string"}},t),u=map$6(a=t.sessionIdList).call(a,(function(t){var a=getAccountFromSessionId(t,"-"),u=a.accid,m=a.scene;return{sessionId:"superTeam"===m?"super_team|"+u:m+"|"+u}})),m.next=4,this.core.sendCmd("nimDeleteCloudSessionList",{tags:u});case 4:case"end":return m.stop()}}),_callee4,this)})))},a.nimMultiSyncUpdateCloudSessionHandler=function nimMultiSyncUpdateCloudSessionHandler(t){var a=formatCloudSession(t.content.session,this.core.account,this.logger);this.core.emit("multiSyncUpdateCloudSession",a)},CloudSessionService}(vp),SI={needPush:{type:"boolean",required:!1},pushTitle:{type:"string",required:!1},pushContent:{type:"string",required:!1},pushPayload:{type:"string",required:!1},needPushBadge:{type:"boolean",required:!1}},TI={"15_1":"signalingCreate","15_2":"signalingDelay","15_3":"signalingClose","15_4":"signalingJoin","15_5":"signalingLeave","15_6":"signalingInvite","15_7":"signalingCancelInvite","15_8":"signalingReject","15_9":"signalingAccept","15_10":"signalingSendCustomCommand","15_11":"signalingRecvNotification","15_12":"signalingMultiSyncNotification","15_13":"signalingSyncNotification","15_14":"singalingSyncChannels","15_15":"signalingQueryInfo","15_16":"signalingCallEx","15_17":"signalingJoinAndAccept"},CI={avSignalTag:Ut({type:1,name:2,channelId:3,createTime:4,expireTime:5,creatorAccid:6,ext:7,invalid:8,fromAccid:10,toAccid:11,requestId:12,members:18,attach:19,attachExt:20,needOffline:21,msgId:22,uid:23,time:24,nertcChannelName:25,nertcTokenTtl:26,nertcToken:27,nertcJoinRoomQueryParamMap:28,nertcJoinRoomResponse:29,callStatus:30},{needPush:13,pushTitle:14,pushContent:15,pushPayload:16,needPushBadge:17})},bI=invertSerializeMap(CI),EI={signalingCreate:{sid:15,cid:1,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:bI.avSignalTag}]},signalingDelay:{sid:15,cid:2,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:bI.avSignalTag}]},signalingClose:{sid:15,cid:3,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:bI.avSignalTag}]},signalingJoin:{sid:15,cid:4,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:bI.avSignalTag}]},signalingLeave:{sid:15,cid:5,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}]},signalingInvite:{sid:15,cid:6,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}]},signalingCancelInvite:{sid:15,cid:7,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}]},signalingReject:{sid:15,cid:8,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}]},signalingAccept:{sid:15,cid:9,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}]},signalingSendCustomCommand:{sid:15,cid:10,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}]},signalingRecvNotification:{sid:15,cid:11,service:"signaling",response:[{type:"Property",name:"data",reflectMapper:bI.avSignalTag}]},signalingMultiSyncNotification:{sid:15,cid:12,service:"signaling",response:[{type:"Property",name:"data",reflectMapper:bI.avSignalTag}]},signalingSyncNotification:{sid:15,cid:13,service:"signaling",response:[{type:"PropertyArray",name:"datas",reflectMapper:bI.avSignalTag}]},singalingSyncChannels:{sid:15,cid:14,service:"signaling",response:[{type:"PropertyArray",name:"datas",reflectMapper:bI.avSignalTag}]},signalingQueryInfo:{sid:15,cid:15,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:bI.avSignalTag}]},signalingCallEx:{sid:15,cid:16,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:bI.avSignalTag}]},signalingJoinAndAccept:{sid:15,cid:17,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:CI.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:bI.avSignalTag}]},signalingBatchMarkRead:{sid:4,cid:5,hasPacketResponse:!1,service:"signaling",params:[{type:"Byte",name:"sid"},{type:"Byte",name:"cid"},{type:"LongArray",name:"ids"}]}},kI={type:{type:"number"},createTime:{type:"number"},expireTime:{type:"number"},invalid:{type:"boolean"},pushInfo:SI,pluginSetting:{nertcInfo:{nertcChannelName:{type:"string"},nertcTokenTtl:{type:"number"},nertcToken:{type:"string"},nertcJoinRoomQueryParamMap:{type:"string"},callStatus:{type:"number"}}},callStatus:{type:"number"},attach:{type:"object"},members:{type:"object"},needOffline:{type:"boolean"},uid:{type:"number"},time:{type:"number"}};function formatSignalingChannelMember(t){return format(kI,deserialize(t,{1:"accid",2:"uid",3:"createTime",4:"expireTime"}))}function formatSignaling(t){var a,u=format(kI,t),m=[];u.members&&u.members.length>0&&(m=map$6(a=u.members).call(a,(function(t){return formatSignalingChannelMember(t)})),delete u.members);return m.length>0?{channelInfo:u,memberList:m}:{channelInfo:u}}function formatSignalingWithCallStatus(t){var a,u=format(kI,t),m=[];u.members&&u.members.length>0&&(m=map$6(a=u.members).call(a,(function(t){return formatSignalingChannelMember(t)})),delete u.members);var h=200;return t.callStatus&&(h=Number(t.callStatus)),m.length>0?{channelInfo:u,memberList:m,callStatus:h}:{channelInfo:u,callStatus:h}}function generateSignalingForCmd(t){return formatReverse(kI,t)}var RI,AI,wI,NI,xI,OI,PI,LI=function(t){function SignalingService(a){var u;return(u=t.call(this)||this).timer=0,u.pollingInterval=12e4,u.name="signaling",u.logger=a.logger,u.core=a,u.channels={},registerParser({cmdMap:TI,cmdConfig:EI}),u}wt(SignalingService,t);var a=SignalingService.prototype;return a.callEx=function callEx(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g;return lu.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:return validate({type:{type:"number"},toAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},needOffline:{type:"boolean",required:!1},pushInfo:{type:"object",required:!1,rules:SI},pluginSetting:{type:"object",required:!1,rules:{nertcInfo:{type:"object",required:!1}}}},t),M.next=3,this.core.sendCmd("signalingCallEx",{tag:generateSignalingForCmd(t)});case 3:return u=M.sent,m=(null===(a=u.content)||void 0===a?void 0:a.data)||{},h=formatSignalingWithCallStatus(m),this.channels[h.channelInfo.channelId]=cloneDeep(h.channelInfo),this.timer||(this.timer=this.core.timerManager.addTimer(bind$1(g=this.aotoDelay).call(g,this),this.pollingInterval,-1)),M.abrupt("return",h);case 9:case"end":return M.stop()}}),_callee,this)})))},a.joinAndAccept=function joinAndAccept(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u,m,h,g,M,I;return lu.wrap((function _callee2$(S){for(;;)switch(S.prev=S.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},fromAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",required:!1},needOffline:{type:"boolean",required:!1},uid:{type:"number",required:!1},pluginSetting:{type:"object",required:!1,rules:{nertcInfo:{type:"object",required:!1}}}},t),u=t.fromAccid,(m=__rest(t,["fromAccid"])).toAccid=u,S.next=5,this.core.sendCmd("signalingJoinAndAccept",{tag:generateSignalingForCmd(m)});case 5:return h=S.sent,g=(null===(a=h.content)||void 0===a?void 0:a.data)||{},M=formatSignalingWithCallStatus(g),this.channels[M.channelInfo.channelId]=cloneDeep(M.channelInfo),this.timer||(this.timer=this.core.timerManager.addTimer(bind$1(I=this.aotoDelay).call(I,this),this.pollingInterval,-1)),S.abrupt("return",M);case 11:case"end":return S.stop()}}),_callee2,this)})))},a.create=function create(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var u,m;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return validate({type:{type:"number"},ext:{type:"string",required:!1}},t),h.next=3,this.core.sendCmd("signalingCreate",{tag:generateSignalingForCmd(t)});case 3:return u=h.sent,m=(null===(a=u.content)||void 0===a?void 0:a.data)||{},h.abrupt("return",formatSignaling(m));case 6:case"end":return h.stop()}}),_callee3,this)})))},a.close=function close(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1}},t),a.next=3,this.core.sendCmd("signalingClose",{tag:generateSignalingForCmd(t)});case 3:case"end":return a.stop()}}),_callee4,this)})))},a.queryInfo=function queryInfo(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var u,m;return lu.wrap((function _callee5$(h){for(;;)switch(h.prev=h.next){case 0:return validate({name:{type:"string",allowEmpty:!1}},t),h.next=3,this.core.sendCmd("signalingQueryInfo",{tag:t});case 3:return u=h.sent,m=(null===(a=u.content)||void 0===a?void 0:a.data)||{},h.abrupt("return",formatSignaling(m));case 6:case"end":return h.stop()}}),_callee5,this)})))},a.join=function join(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var u,m,h,g;return lu.wrap((function _callee6$(M){for(;;)switch(M.prev=M.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},uid:{type:"number",min:0,required:!1},needOffline:{type:"boolean",required:!1}},t),M.next=3,this.core.sendCmd("signalingJoin",{tag:generateSignalingForCmd(t)});case 3:return u=M.sent,m=(null===(a=u.content)||void 0===a?void 0:a.data)||{},h=formatSignaling(m),this.channels[h.channelInfo.channelId]=cloneDeep(h.channelInfo),this.timer||(this.timer=this.core.timerManager.addTimer(bind$1(g=this.aotoDelay).call(g,this),this.pollingInterval,-1)),M.abrupt("return",h);case 9:case"end":return M.stop()}}),_callee6,this)})))},a.aotoDelay=function aotoDelay(){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var t,a,u,m,h;return lu.wrap((function _callee7$(g){for(;;)switch(g.prev=g.next){case 0:if(0!==(t=Gt(this.channels)).length){g.next=5;break}return this.timer&&this.core.timerManager.deleteTimer(this.timer),this.timer=0,g.abrupt("return");case 5:this.logger.log("signling:autoDelay",t),a=0;case 7:if(!(a<t.length)){g.next=24;break}return u=t[a],g.prev=9,g.next=12,this.core.sendCmd("signalingDelay",{tag:{channelId:u}});case 12:m=g.sent,h=formatSignaling(m.content.data),this.channels[u]=h.channelInfo,g.next=21;break;case 17:g.prev=17,g.t0=g.catch(9),this.logger.warn("signling:autoDelay "+u+" failed",g.t0),delete this.channels[u];case 21:a++,g.next=7;break;case 24:case"end":return g.stop()}}),_callee7,this,[[9,17]])})))},a.leave=function leave(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){return lu.wrap((function _callee8$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1}},t),a.next=3,this.core.sendCmd("signalingLeave",{tag:generateSignalingForCmd(t)});case 3:delete this.channels[t.channelId];case 4:case"end":return a.stop()}}),_callee8,this)})))},a.invite=function invite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){return lu.wrap((function _callee9$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},toAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1},pushInfo:{type:"object",required:!1,rules:SI}},t),a.next=3,this.core.sendCmd("signalingInvite",{tag:generateSignalingForCmd(t)});case 3:case"end":return a.stop()}}),_callee9,this)})))},a.cancelInvite=function cancelInvite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){return lu.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},toAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1}},t),a.next=3,this.core.sendCmd("signalingCancelInvite",{tag:generateSignalingForCmd(t)});case 3:case"end":return a.stop()}}),_callee10,this)})))},a.reject=function reject(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){var a,u;return lu.wrap((function _callee11$(m){for(;;)switch(m.prev=m.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},fromAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1}},t),a=t.fromAccid,(u=__rest(t,["fromAccid"])).toAccid=a,m.next=5,this.core.sendCmd("signalingReject",{tag:generateSignalingForCmd(u)});case 5:case"end":return m.stop()}}),_callee11,this)})))},a.accept=function accept(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){var a,u,m,h,g;return lu.wrap((function _callee12$(M){for(;;)switch(M.prev=M.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},fromAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1},autoJoin:{type:"boolean",required:!1},uid:{type:"number",min:0,required:!1},joinAttachExt:{type:"string",required:!1}},t),a=t.autoJoin,u=t.joinAttachExt,m=t.fromAccid,(h=__rest(t,["autoJoin","joinAttachExt","fromAccid"])).toAccid=m,M.next=5,this.core.sendCmd("signalingAccept",{tag:generateSignalingForCmd(h)});case 5:if(this.logger.log("Signaling:accept, accept success, autoJoin "+t.autoJoin),!a){M.next=10;break}return g={channelId:t.channelId,needOffline:t.needOffline,attachExt:u,uid:t.uid},M.next=10,this.join(g);case 10:case"end":return M.stop()}}),_callee12,this)})))},a.sendCustomCommand=function sendCustomCommand(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){return lu.wrap((function _callee13$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},fromAccid:{type:"string",allowEmpty:!1,required:!1},attachExt:{type:"string",required:!1}},t),a.next=3,this.core.sendCmd("signalingSendCustomCommand",{tag:generateSignalingForCmd(t)});case 3:case"end":return a.stop()}}),_callee13,this)})))},a.signalingRecvNotificationHandler=function signalingRecvNotificationHandler(t){var a=fillIdServer(t,t.content.data,"msgId","0"),u=a.msgId;this.doNotify(a),u&&Bu(u)&&this.core.sendCmd("signalingBatchMarkRead",{sid:15,cid:11,ids:[u]})},a.signalingMultiSyncNotificationHandler=function signalingMultiSyncNotificationHandler(t){this.doNotify(t.content.data,3)},a.doNotify=function doNotify(t,a){void 0===a&&(a=0);var u=function formatSignalingNotification(t,a){void 0===a&&(a=0);var u=format(kI,t),m=u.attach,h=u.attachExt,g=u.time,M=u.msgId;u.fromAccid,u.toAccid,u.members,u.requestId,u.pushInfo;var I=__rest(u,["attach","attachExt","time","msgId","fromAccid","toAccid","members","requestId","pushInfo"]);if(2===m.type)try{u.member={accid:u.attach.member[1],uid:Number(u.attach.member[2]),createTime:Number(u.attach.member[3]),expireTime:Number(u.attach.member[4])}}catch(t){delete u.member}var S=m.type;return delete u.attach,{metaData:{eventType:S,channelInfo:I,feature:a,ext:h||"",time:g,msgId:M},rawData:u}}(t,a),m=u.metaData,h=u.rawData,g=h.fromAccid,M=h.toAccid,I=h.requestId,S=h.pushInfo,T=h.msgId,C=h.member;switch(m.eventType){case 1:this.emit("signalingClose",{fromAccid:g,metaData:m});break;case 2:this.emit("signalingJoin",{fromAccid:g,metaData:m,member:C});break;case 3:this.emit("signalingInvite",{fromAccid:g,toAccid:M,requestId:I,pushInfo:S,metaData:m});break;case 4:this.emit("signalingCancelInvite",{fromAccid:g,toAccid:M,requestId:I,metaData:m});break;case 5:this.emit("signalingReject",{fromAccid:g,toAccid:M,requestId:I,metaData:m});break;case 6:this.emit("signalingAccept",{fromAccid:g,toAccid:M,requestId:I,metaData:m});break;case 7:this.emit("signalingLeave",{fromAccid:g,metaData:m});break;case 8:this.emit("signalingCustomCommand",{fromAccid:g,metaData:m});break;default:this.logger.warn("signaling:notification, no such a type "+m.eventType,h)}return T},a.signalingSyncNotificationHandler=function signalingSyncNotificationHandler(t){var a,u,m=this;if(t.content.datas&&t.content.datas.length>0){var h=filter(a=map$6(u=t.content.datas).call(u,(function(t){return m.doNotify(t,1)}))).call(a,(function(t){return t}));h.length>0&&this.core.sendCmd("signalingBatchMarkRead",{sid:15,cid:11,ids:h})}},a.singalingSyncChannelsHandler=function singalingSyncChannelsHandler(t){var a,u=this;if(this.timer=0,this.channels={},t.content.datas&&t.content.datas.length>0){var m=map$6(a=t.content.datas).call(a,(function(t){return formatSignaling(t)}));forEach$1(m).call(m,(function(t){var a=t.channelInfo.channelId;u.channels[a]=cloneDeep(t.channelInfo)})),this.emit("singalingSyncChannels",m)}},a.process=function process(t){var a=this[t.cmd+"Handler"];if("function"==typeof a)return a.call(this,t),$i.resolve(t);var u=get(t,"error.detail.ignore");return t.error&&!u?$i.reject(t.error):$i.resolve(t)},SignalingService}(mo.EventEmitter),VI=function(t){function Service(a,u){var m;return(m=t.call(this)||this).name=a,m.core=u,m.name=a,m.logger=u.logger,m.core=u,m}wt(Service,t);var a=Service.prototype;return a.emit=function emit(a){var u=this;try{for(var m,h,g=arguments.length,M=new Array(g>1?g-1:0),I=1;I<g;I++)M[I-1]=arguments[I];var S=(m=t.prototype.emit).call.apply(m,concat(h=[this,a]).call(h,M));return S}catch(t){return po((function(){throw u.logger.error(u.name+"::emit throw error in setTimeout. event: "+a.toString()+". Error",t),t}),0),!1}},a.process=function process(t){var a=this[t.cmd+"Handler"];if("function"==typeof a)return a.call(this,t);var u=get(t,"error.detail.ignore");return t.error&&!u?$i.reject(t.error):$i.resolve(t)},Service}(mo),UI={"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"},DI={serverId:1,channelId:2,ackTimestamp:3,unreadCount:4,mentionedCount:5,maxCount:6,lastMsgTime:7},qI={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:DI,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}},BI=function getDeserializeTag(){return invertSerializeMap(qI)},FI=function getCmdConfig(){var t=BI();return{qchatCreateChannel:{sid:24,cid:48,service:"qchatChannel",params:[{type:"Property",name:"channelInfo",reflectMapper:qI.channelInfo},{type:"Property",name:"antispamTag",reflectMapper:qI.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:qI.qchatUpdateChannelTag},{type:"Property",name:"antispamTag",reflectMapper:qI.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:qI.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:qI.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:qI.qchatUpdateWhiteBlackRoleTag}]},qchatGetWhiteBlackRolesPage:{sid:24,cid:55,service:"qchatChannel",params:[{type:"Property",name:"qchatGetWhiteBlackRolesPageTag",reflectMapper:qI.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:qI.qchatUpdateWhiteBlackMembersTag}]},qchatGetWhiteBlackMembersPage:{sid:24,cid:57,service:"qchatChannel",params:[{type:"Property",name:"qchatGetWhiteBlackMembersPageTag",reflectMapper:qI.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:qI.qchatGetExistingWhiteBlackRolesTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.serverRole}]},qchatGetExistingWhiteBlackMembers:{sid:24,cid:59,service:"qchatChannel",params:[{type:"Property",name:"qchatGetExistingWhiteBlackMembersTag",reflectMapper:qI.qchatGetExistingWhiteBlackMembersTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.memberInfo}]},qchatUpdateCategoryInfoOfChannel:{sid:24,cid:60,service:"qchatChannel",params:[{type:"Property",name:"qchatUpdateCategoryInfoOfChannelTag",reflectMapper:qI.channelInfo}],response:[{type:"Property",name:"channelInfo",reflectMapper:t.channelInfo}]},qchatCreateChannelCategory:{sid:24,cid:109,service:"qchatChannel",params:[{type:"Property",name:"qchatCreateChannelCategoryTag",reflectMapper:qI.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:qI.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:qI.qchatUpdateChannelCategoryWhiteBlackRoleTag}]},qchatGetChannelCategoryWhiteBlackRolesPage:{sid:24,cid:114,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoryWhiteBlackRolesPageTag",reflectMapper:qI.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:qI.qchatUpdateChannelCategoryWhiteBlackMembersTag}]},qchatGetChannelCategoryWhiteBlackMembersPage:{sid:24,cid:116,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoryWhiteBlackMembersPageTag",reflectMapper:qI.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:qI.qchatGetChannelCategoryWhiteBlackRolesTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.serverRole}]},qchatGetChannelCategoryWhiteBlackMembers:{sid:24,cid:118,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoryWhiteBlackMembersTag",reflectMapper:qI.qchatGetChannelCategoryWhiteBlackMembersTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.memberInfo}]},qchatGetChannelCategoriesPage:{sid:24,cid:119,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelCategoriesPageTag",reflectMapper:qI.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:qI.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:qI.qchatSubReqTag},{type:"PropertyArray",name:"channels",reflectMapper:qI.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:qI.qchatChannelIdInfoTag}],response:[{type:"PropertyArray",name:"unreadInfos",reflectMapper:t.unreadInfo}]},qchatGetChannelSearchByPage:{sid:24,cid:93,service:"qchatChannel",params:[{type:"Property",name:"qchatGetChannelSearchByPageTag",reflectMapper:qI.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:qI.qchatChannelMemberSearchTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:t.qchatChannelMemberInfo}]},qchatSubscribeAsVisitor:{sid:25,cid:9,service:"qchatChannel",params:[{type:"Property",name:"tag",reflectMapper:qI.qchatSubReqTag},{type:"PropertyArray",name:"datas",reflectMapper:qI.qchatChannelIdInfoTag}],response:[{type:"PropertyArray",name:"failedArr",reflectMapper:t.qchatChannelIdInfoTag}]}}};!function(t){t[t.reorderWeight=0]="reorderWeight",t[t.createTime=1]="createTime"}(RI||(RI={})),function(t){t[t.white=1]="white",t[t.black=2]="black"}(AI||(AI={})),function(t){t[t.add=1]="add",t[t.remove=2]="remove"}(wI||(wI={})),function(t){t[t.message=0]="message",t[t.media=1]="media",t[t.ext=100]="ext"}(NI||(NI={})),function(t){t[t.ASC=1]="ASC",t[t.DESC=2]="DESC"}(xI||(xI={})),function(t){t[t.reorderWeight=0]="reorderWeight",t[t.createTime=1]="createTime",t[t.totalMember=2]="totalMember"}(OI||(OI={})),function(t){t[t.square=1]="square",t[t.person=2]="person"}(PI||(PI={}));var GI={channelId:{type:"string"},serverId:{type:"string"},name:{type:"string"},topic:{type:"string"},ext:{type:"string"},type:{type:"enum",values:NI},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"},viewMode:{type:"number"},categoryId:{type:"string"},syncMode:{type:"number"},visitorMode:{type:"number"},reorderWeight:{type:"string"}},HI={serverId:{type:"string"},channelId:{type:"string"},ackTimestamp:{type:"number"},unreadCount:{type:"number"},mentionedCount:{type:"number"},maxCount:{type:"number"},lastMsgTime:{type:"number"}},jI={serverId:{type:"string"},channelId:{type:"string"},type:{type:"enum",values:AI},opeType:{type:"enum",values:wI},toAccids:{type:"object"}},$I={serverId:{type:"string"},channelId:{type:"string"},type:{type:"enum",values:AI},opeType:{type:"enum",values:wI},roleId:{type:"string"}},zI={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"}},WI={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($I,t)}function formatChannel(t){return format(GI,t)}function formatChannels(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return formatChannel(t)})):[]}function formatUnreadInfo(t){return format(HI,t)}function formatUnreadInfos(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return formatUnreadInfo(t)})):[]}function formatChannelCategory(t){return format(zI,t)}function formatChannelCategorys(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return formatChannelCategory(t)})):[]}function formatChannelMembers(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return function formatChannelMember(t){return format(WI,t)}(t)})):[]}function formatFailServerIds(t){try{return JSON.parse(t)}catch(t){return[]}}var KI={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"}},YI={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"}},QI={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(KI,t)}function formatServers(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return formatServer(t)})):[]}function formatMember$1(t){return format(YI,t)}function formatMembers$1(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return formatMember$1(t)})):[]}function formatServerMemberBanInfos(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return function formatServerMemberBanInfo(t){return format(QI,t)}(t)})):[]}function generateAntispamTag(t){var a,u,m;if(!t.antispamTag)return{};var h=Ut({},t.antispamTag);return(null===(a=t.antispamTag)||void 0===a?void 0:a.antiSpamBusinessId)&&"string"!=typeof(null===(u=t.antispamTag)||void 0===u?void 0:u.antiSpamBusinessId)&&(h.antiSpamBusinessId=Vn(null===(m=t.antispamTag)||void 0===m?void 0:m.antiSpamBusinessId)),h}var JI={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(JI,t)}function formatInviteApplyRecords(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return formatInviteApplyRecord(t)})):[]}var XI,ZI,e_,t_,r_={successServerIds:{type:"object"},failServerIds:{type:"object"},ackTimestamp:{type:"number"}};function formatClearServersUnread(t){return format(r_,t)}!function(t){t[t.everyone=1]="everyone",t[t.custom=2]="custom"}(XI||(XI={})),function(t){t[t.normal=0]="normal",t[t.owner=1]="owner"}(ZI||(ZI={})),function(t){t[t.ignore=0]="ignore",t[t.deny=-1]="deny",t[t.allow=1]="allow"}(e_||(e_={})),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"}(t_||(t_={}));var n_,a_,i_,o_,s_,c_,l_,u_,d_,p_={type:{type:"enum",values:XI},memberType:{type:"enum",values:ZI},createTime:{type:"number"},updateTime:{type:"number"},priority:{type:"number"},memberCount:{type:"number"},joinTime:{type:"number"}},m_={roleId:{type:"string"},categoryId:{type:"string"},serverId:{type:"string"},type:{type:"enum",values:XI},validFlag:{type:"boolean"},createTime:{type:"number"},updateTime:{type:"number"},name:{type:"string"},icon:{type:"string"},ext:{type:"string"}},h_={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:ZI},joinTime:{type:"number"},inviter:{type:"string"}};function generatorRoleForCmd(t){var a=Ut({},t),u=formatReverse(p_,a);return u.auths&&(u.auths=function generateRoleAuthsForCmd(t){var a,u=reduce(a=Gt(t)).call(a,(function(a,u){var m=t_[u];return m?a[m]=e_[t[u]]:a[u]=e_[t[u]],a}),{});return Vn(u)}(u.auths)),u}function formatRoleAuths(t){var a;return reduce(a=Gt(t)).call(a,(function(a,u){var m=getEnumKeyByEnumValue(t_,u);m?a[m]=e_[t[u]]:a[Bu(u)]=e_[t[u]];return a}),{})}function formatRole(t){var a=format(p_,t);return t.auths&&(a.auths=formatRoleAuths(JSON.parse(a.auths))),a.isMember&&delete a.isMember,a}function formatRoles(t){return Un(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(m_,t)}function formatChannelCategoryMemberRole(t){return t.auths&&(t.auths=formatRoleAuths(JSON.parse(t.auths))),format(h_,t)}!function(t){t[t.default=1]="default",t[t.sync=2]="sync"}(n_||(n_={})),function(t){t[t.sendTime=1]="sendTime"}(a_||(a_={})),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"}(i_||(i_={})),function(t){t[t.sending=1]="sending",t[t.success=2]="success",t[t.failed=3]="failed"}(o_||(o_={})),function(t){t[t.notifyAll=1]="notifyAll",t[t.notifySubscribe=2]="notifySubscribe"}(s_||(s_={})),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"}(c_||(c_={})),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"}(l_||(l_={})),function(t){t[t.reply=1]="reply",t[t.thread=2]="thread",t[t.all=3]="all"}(u_||(u_={})),function(t){t[t.sub=1]="sub",t[t.unSub=2]="unSub"}(d_||(d_={}));var g_=function(){function UnreadInfoModuleService(t){var a=this;this.unreadCount={},this.manualSubscribeUnreadMap={},this.manualSubscribeServerMap={},this.manualSubscribeTypingMap={},this.unreadServerCount={},this.serverRoleIdsMap={},this.autoSubscribeUnreadMap={},this.autoSubscribeServerMap={},this._serverUnreadInfo=throttle((function(t){a.core.emit("serverUnreadInfo",a.getServerUnreadInfo(t)),get(a.core,"qchatServer.emit")&&a.core.qchatServer.emit("serverUnreadInfo",a.getServerUnreadInfo(t))}),100),this.core=t}var t=UnreadInfoModuleService.prototype;return t.changeCacheServerRoleIds=function changeCacheServerRoleIds(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u,m,h,g,M,I,S=this;return lu.wrap((function _callee$(T){for(;;)switch(T.prev=T.next){case 0:if(u=t.attach.serverIdentifyInfo,m=u.serverId,h=u.roleId,this.serverRoleIdsMap[m]){T.next=4;break}return T.next=4,this.getRoleIdsByServerId([m]);case 4:if(g=this.serverRoleIdsMap[m],!(t.time<g.timeTag)){T.next=7;break}return T.abrupt("return");case 7:if(t.type===l_[l_.serverIdentifyAdd]?g.roleIds.add(h):g.roleIds.delete(h),this.core.logger.debug("QChatChannel::qchatChannel/serverIdentifyChange::now "+m+" roleIds is",concat(a=[]).call(a,g.roleIds)),M=this.unreadServerCount[m]){T.next=12;break}return T.abrupt("return");case 12:I=chunk(Gt(M),100),forEach$1(I).call(I,(function(t){S.core.qchatChannel.getChannelUnreadInfos({channels:map$6(t).call(t,(function(t){return{serverId:m,channelId:t}}))})}));case 14:case"end":return T.stop()}}),_callee,this)})))},t.getRoleIdsByServerId=function getRoleIdsByServerId(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h,g=this;return lu.wrap((function _callee2$(M){for(;;)switch(M.prev=M.next){case 0:if((u=filter(t).call(t,(function(t){return!g.serverRoleIdsMap[t]}))).length){M.next=3;break}return M.abrupt("return");case 3:return m={serverIdTimeTags:u},M.next=6,this.core.sendCmd("qchatGetRoleIdsByServerId",{qchatGetRoleIdsByServerIdTag:m});case 6:h=M.sent,this.core.logger.debug("QChatChannel:: getRoleIdsByServerId, params is ",m,"result is",h),forEach$1(a=h.content.serverRoles).call(a,(function(t){try{t.roleIds=JSON.parse(t.roleIds)}catch(t){g.core.logger.error("QChatChannel:: getRoleIdsByServerId JSON parse roleIds error",t)}g.serverRoleIdsMap[t.serverId]={roleIds:new qg(t.roleIds),timeTag:t.timeTag}}));case 9:case"end":return M.stop()}}),_callee2,this)})))},t._unSubscribeChannel=function _unSubscribeChannel(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var u,m,h,g,M;return lu.wrap((function _callee3$(I){for(;;)switch(I.prev=I.next){case 0:if(u=t+"_"+a,m=[],this.manualSubscribeUnreadMap[u]?m.push(this.manualSubscribeUnreadMap[u]):this.autoSubscribeUnreadMap[u]&&m.push(this.autoSubscribeUnreadMap[u]),this.manualSubscribeTypingMap[u]&&m.push(this.manualSubscribeTypingMap[u]),0!==m.length){I.next=6;break}return I.abrupt("return");case 6:for(h=0,g=m;h<g.length;h++)M=g[h],this.subscribe({opeType:d_.unSub,type:M,channels:[{serverId:t,channelId:a}]});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,lu.mark((function _callee4(){var a,u;return lu.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:if(a=t,u=this.manualSubscribeServerMap[a]||this.autoSubscribeServerMap[a]){m.next=4;break}return m.abrupt("return");case 4:this.subscribe({opeType:d_.unSub,type:u,channels:[{serverId:t,channelId:""}]}),this.manualSubscribeServerMap[a]?this.manualSubscribeServerMap[a]=void 0:this.autoSubscribeServerMap[a]&&(this.autoSubscribeServerMap[a]=void 0);case 6:case"end":return m.stop()}}),_callee4,this)})))},t.subscribe=function subscribe(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var a,u,m,h,g=this;return lu.wrap((function _callee6$(M){for(;;)switch(M.prev=M.next){case 0:return validate({type:{type:"number",min:1,max:5},opeType:{type:"number",min:1,max:2}},t),M.next=3,this.core.sendCmd("qchatSubscribe",{qchatSubReqTag:{type:t.type,opeType:t.opeType},channels:t.channels});case 3:return u=M.sent,m=new qg,forEach$1(a=t.channels).call(a,(function(t){return __awaiter(g,void 0,void 0,lu.mark((function _callee5(){return lu.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:this.serverRoleIdsMap[t.serverId]||m.add(t.serverId);case 1:case"end":return a.stop()}}),_callee5,this)})))})),h=chunk(nu(m),10),forEach$1(h).call(h,(function(t){g.getRoleIdsByServerId(t)})),M.abrupt("return",u.content);case 9:case"end":return M.stop()}}),_callee6,this)})))},t.autoSubscribe=function autoSubscribe(){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.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,lu.mark((function _callee10(){var a,u,m,h,g,M,I,S=this;return lu.wrap((function _callee10$(T){for(;;)switch(T.prev=T.next){case 0:if(this.serverRoleIdsMap={},g=100,t){T.next=6;break}return this.unreadServerCount={},this.unreadCount={},T.abrupt("return");case 6:return M={},forEach$1(a=Gt(this.manualSubscribeUnreadMap)).call(a,(function(t){var a=S.manualSubscribeUnreadMap[t];if(a){var u=t.split("_"),m={serverId:u[0],channelId:u[1]};M[a]=M[a]||[],M[a].push(m)}})),M[5]=[],forEach$1(u=Gt(this.manualSubscribeTypingMap)).call(u,(function(t){return __awaiter(S,void 0,void 0,lu.mark((function _callee8(){var a,u,m,h;return lu.wrap((function _callee8$(g){for(;;)switch(g.prev=g.next){case 0:this.manualSubscribeTypingMap[t]&&(a=t.split("_"),u=a[0],m=a[1],h={serverId:u,channelId:m},M[5].push(h));case 2:case"end":return g.stop()}}),_callee8,this)})))})),M[4]=[],forEach$1(m=Gt(this.manualSubscribeServerMap)).call(m,(function(t){return __awaiter(S,void 0,void 0,lu.mark((function _callee9(){var a;return lu.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:this.manualSubscribeServerMap[t]&&(a={serverId:t},M[4].push(a));case 2:case"end":return u.stop()}}),_callee9,this)})))})),I=[],forEach$1(h=Gt(M)).call(h,(function(t){var a=M[t];if(a&&0===a.length)return $i.resolve();if(a.length>g){var u=chunk(a,100);return forEach$1(u).call(u,(function(a){I.push(S.createSubscribePromise(a,t))}))}I.push(S.createSubscribePromise(a,t))})),T.next=16,$i.all(I);case 16:case"end":return T.stop()}}),_callee10,this)})))},t.createSubscribePromise=function createSubscribePromise(t,a){var u=this,m={type:Bu(a),opeType:1,channels:t};return this.core.logger.debug("qchatChannel:: autoSubscribeUnread params",m),this.subscribe(m).then((function(t){var a=t.unreadInfos;a&&a.length>0&&(a=formatUnreadInfos(a),u.updateUnreads(a))})).catch((function(t){u.core.logger.error("qchatChannel:: autoSubscribeUnread error ",t)}))},t.cacheSubscribe=function cacheSubscribe(t){var a,u=this;forEach$1(a=t.channels).call(a,(function(a){var m=a.channelId?a.serverId+"_"+a.channelId:""+a.serverId,h=5===t.type?u.manualSubscribeTypingMap:4===t.type?u.manualSubscribeServerMap:u.manualSubscribeUnreadMap;t.opeType===d_.sub?h[m]=t.type:t.opeType===d_.unSub&&(h[m]=void 0)}))},t.cacheAutoSubscribe=function cacheAutoSubscribe(t){var a,u=this;forEach$1(a=t.channels).call(a,(function(a){var m=a.channelId?a.serverId+"_"+a.channelId:""+a.serverId,h=4===t.type?u.autoSubscribeServerMap:u.autoSubscribeUnreadMap;t.opeType===d_.sub?h[m]=t.type:t.opeType===d_.unSub&&(h[m]=void 0)}))},t.cacheUnreadCount=function cacheUnreadCount(t){var a=this;forEach$1(t).call(t,(function(t){var u=t.serverId+"_"+t.channelId;a.unreadCount[u]=Ut({},t),a.unreadServerCount[t.serverId]||(a.unreadServerCount[t.serverId]={}),a.unreadServerCount[t.serverId][t.channelId]=!0}))},t.getServerUnreadInfo=function getServerUnreadInfo(t){var a,u=this,m={serverId:t,unreadCount:0,mentionedCount:0,maxCount:0},h=this.unreadServerCount[t];h&&(forEach$1(a=Gt(h)).call(a,(function(a){var h=t+"_"+a,g=u.unreadCount[h];m.unreadCount+=g.unreadCount,m.mentionedCount+=g.mentionedCount,void 0!==g.maxCount&&(m.maxCount=g.maxCount)})),m.unreadCount=m.unreadCount>m.maxCount?m.maxCount:m.unreadCount,m.mentionedCount=m.mentionedCount>m.maxCount?m.maxCount:m.mentionedCount);return m},t.getUnreadInfo=function getUnreadInfo(t){validate({serverId:{type:"string"},channelId:{type:"string"}},t);var a=t.serverId+"_"+t.channelId;return this.unreadCount[a]?this.unreadCount[a]:null},t.shouldChangeUnread=function shouldChangeUnread(t,a){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(a&&2!==(null==t?void 0:t.status))return!1;if(t.notifyReason&&t.notifyReason===getEnumKeyByEnumValue(s_,s_.notifySubscribe)){if(!t.serverId||!t.channelId)return!1;var u=this.getUnreadInfo({serverId:t.serverId,channelId:t.channelId}),m=a?"ackTimestamp":"lastMsgTime";if(!u)return!1;if(t.time&&u[m]&&u[m]>t.time)return!1}return!0},t.shouldChangeMentionedUnread=function shouldChangeMentionedUnread(t,a){return void 0===a&&(a=!1),__awaiter(this,void 0,void 0,lu.mark((function _callee11(){var u,m;return lu.wrap((function _callee11$(h){for(;;)switch(h.prev=h.next){case 0:if(!t.accidsOfMentionedRoles||!includes(u=t.accidsOfMentionedRoles).call(u,this.core.account)){h.next=2;break}return h.abrupt("return",!0);case 2:if(!t.mentionRoleIds||!t.serverId){h.next=16;break}if(this.serverRoleIdsMap[t.serverId]){h.next=9;break}if(a){h.next=7;break}return this.handledRoleMsg(t),h.abrupt("return",!1);case 7:return h.next=9,this.getRoleIdsByServerId([t.serverId]);case 9:m=0;case 10:if(!(m<t.mentionRoleIds.length)){h.next=16;break}if(!this.serverRoleIdsMap[t.serverId].roleIds.has(t.mentionRoleIds[m])){h.next=13;break}return h.abrupt("return",!0);case 13:m++,h.next=10;break;case 16:return h.abrupt("return",!1);case 17:case"end":return h.stop()}}),_callee11,this)})))},t.handledRoleMsg=function handledRoleMsg(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){var a,u,m,h,g,M=this;return lu.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(a=t.mentionRoleIds).call(a,(function(a){M.serverRoleIdsMap[t.serverId].roleIds.has(a)&&(u=!0,M.core.logger.debug("QChatChannel::handledRoleMsg::will update message mentionedCount,message is ",t))})),u){I.next=12;break}return I.abrupt("return");case 12:if(m=this.unreadCount[t.serverId+"_"+t.channelId],h=2===(null==t?void 0:t.status),m.mentionedCount=h?m.mentionedCount?m.mentionedCount-1:0:m.mentionedCount?m.mentionedCount+1:1,"number"!=typeof m.maxCount){I.next=25;break}if(!((g=(g=m.mentionedCount)>m.maxCount?m.maxCount:g)>m.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",Ut(Ut({},m),{mentionedCount:g})),this.core.emit("unreadInfos",[Ut(Ut({},m),{mentionedCount:g})]),this.core.qchatChannel.emit("unreadInfos",[Ut(Ut({},m),{mentionedCount:g})]),this._serverUnreadInfo(t.serverId);case 25:case"end":return I.stop()}}),_callee12,this)})))},t.getMentionedFlag=function getMentionedFlag(t,a){return void 0===a&&(a=!1),__awaiter(this,void 0,void 0,lu.mark((function _callee13(){var u;return lu.wrap((function _callee13$(m){for(;;)switch(m.prev=m.next){case 0:if(!t.mentionAll){m.next=4;break}return m.abrupt("return",!0);case 4:if(!t.mentionRoleIds&&!t.accidsOfMentionedRoles){m.next=10;break}return m.next=7,this.shouldChangeMentionedUnread(t,a);case 7:return m.abrupt("return",m.sent);case 10:if(!t.mentionAccids||!includes(u=t.mentionAccids).call(u,this.core.account)){m.next=12;break}return m.abrupt("return",!0);case 12:return m.abrupt("return",!1);case 13:case"end":return m.stop()}}),_callee13,this)})))},t.changeUnread=function changeUnread(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){var u,m,h,g,M,I,S;return lu.wrap((function _callee14$(T){for(;;)switch(T.prev=T.next){case 0:if(u=t.serverId,m=t.channelId,h=u+"_"+m,this.shouldChangeUnread(t,a)){T.next=6;break}return this.core.logger.debug("changeUnread: "+h+" does not need to update unreadInfo"),T.abrupt("return");case 6:if(this.unreadCount[h]){T.next=11;break}return T.next=9,this.core.qchatChannel.getChannelUnreadInfos({channels:[{serverId:u,channelId:m}]});case 9:return!this.serverRoleIdsMap[u]&&t.mentionRoleIds&&this.getRoleIdsByServerId([u]),T.abrupt("return");case 11:return g=this.unreadCount[h],M=2===(null==t?void 0:t.status),T.next=15,this.getMentionedFlag(t);case 15:if(I=T.sent,M?(g.unreadCount=g.unreadCount?g.unreadCount-1:0,I&&(g.mentionedCount=g.mentionedCount?g.mentionedCount-1:0),delete g.lastMsgTime,this.core.logger.debug("changeUnread: "+h+" unread reduce ",g)):(g.unreadCount=g.unreadCount?g.unreadCount+1:1,I&&(g.mentionedCount=g.mentionedCount?g.mentionedCount+1:1),t.time&&(g.lastMsgTime=t.time),this.core.logger.debug("changeUnread: "+h+" unread add ",g)),S="number"==typeof g.maxCount?g.maxCount:100,!(g.unreadCount>S)){T.next=21;break}return this.core.logger.debug("QChatChannel::subscribe::tempUnreadCount more than maxCount"),T.abrupt("return");case 21:this.core.logger.warn("unreadInfo event will abandon,please use unreadInfos"),this.core.emit("unreadInfo",Ut(Ut({},g),{mentionedCount:g.mentionedCount>S?S:g.mentionedCount,unreadCount:g.unreadCount>S?S:g.unreadCount})),this.core.emit("unreadInfos",[Ut(Ut({},g),{mentionedCount:g.mentionedCount>S?S:g.mentionedCount,unreadCount:g.unreadCount>S?S:g.unreadCount})]),this.core.qchatChannel.emit("unreadInfos",[Ut(Ut({},g),{mentionedCount:g.mentionedCount>S?S:g.mentionedCount,unreadCount:g.unreadCount>S?S:g.unreadCount})]),this._serverUnreadInfo(u);case 26:case"end":return T.stop()}}),_callee14,this)})))},t.updateUnreads=function updateUnreads(t){var a,u,m=this;if(t&&t.length>0){var h=[],g=[],M=map$6(a=filter(t).call(t,(function(t){var a=t.serverId+"_"+t.channelId,u=m.unreadCount[a],h=get(u,"ackTimestamp"),g=get(t,"ackTimestamp");return!(h&&g&&g<h)&&(get(u,"unreadCount")!==get(t,"unreadCount")||get(u,"mentionedCount")!==get(t,"mentionedCount"))}))).call(a,(function(t){h.push(m.getServerUnreadInfo(t.serverId)),g.push(m.unreadServerCount[t.serverId]);var a=t.serverId,u=t.channelId,M=a+"_"+u;return m.core.logger.debug("qchat channel updateUnread: ",t),m.unreadCount[M]=Ut({},t),m.unreadServerCount[a]||(m.unreadServerCount[a]={}),m.unreadServerCount[a][u]=!0,t}));if(0!==M.length){this.core.emit("unreadInfos",M),this.core.qchatChannel.emit("unreadInfos",M);var I={};forEach$1(M).call(M,(function(t,a){m.core.emit("unreadInfo",t);var u=h[a],M=g[a],S=m.getServerUnreadInfo(t.serverId),T=m.unreadServerCount[t.serverId],C=u.unreadCount!==S.unreadCount,b=!M||0===Gt(M).length,E=T&&Gt(T).length>0,k=u.mentionedCount!==S.mentionedCount;(C||k||b&&E)&&(I[t.serverId]=!0)})),forEach$1(u=Gt(I)).call(u,(function(t){m.core.emit("serverUnreadInfo",m.getServerUnreadInfo(t)),get(m.core,"qchatServer.emit")&&m.core.qchatServer.emit("serverUnreadInfo",m.getServerUnreadInfo(t))}))}}},t.clearUnreadCountByServers=function clearUnreadCountByServers(t,a){var u=this,m=[];forEach$1(t).call(t,(function(t){var a;u.unreadServerCount[t]&&forEach$1(a=Gt(u.unreadServerCount[t])).call(a,(function(a){m.push(t+"_"+a)}))}));var h=[];forEach$1(m).call(m,(function(t){h.push(Ut(Ut({},u.unreadCount[t]),{unreadCount:0,mentionedCount:0,ackTimestamp:a}))})),this.updateUnreads(h)},UnreadInfoModuleService}(),v_=function(){function SubscribeForVisitorService(t){this.limitForBatchEnter=10,this.limitForBatchSubscribe=100,this.autoServers=new qg,this.autoVisitorSubscribeServer=new qg,this.autoVisitorSubscribeChannel=new qg,this.core=t}var t=SubscribeForVisitorService.prototype;return t.subscribeChannelAsVisitor=function subscribeChannelAsVisitor(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a,u,m,h,g=this;return lu.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:return M.next=2,this.core.sendCmd("qchatSubscribeAsVisitor",{tag:{type:t.type||6,opeType:t.opeType},datas:t.channels});case 2:return u=M.sent,m=u.content.failedArr,h=filter(a=t.channels).call(a,(function(t){return!some(m).call(m,(function(a){return a.channelId===t.channelId&&a.serverId===t.serverId}))})),forEach$1(h).call(h,(function(a){1===t.opeType?g.autoVisitorSubscribeChannel.add(a.serverId+"&"+a.channelId):g.autoVisitorSubscribeChannel.delete(a.serverId+"&"+a.channelId)})),M.abrupt("return",{failedChannels:m});case 7:case"end":return M.stop()}}),_callee,this)})))},t.subscribeServerAsVisitor=function subscribeServerAsVisitor(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h,g,M,I=this;return lu.wrap((function _callee2$(S){for(;;)switch(S.prev=S.next){case 0:return S.next=2,this.core.sendCmd("qchatSubscribeAsVisitor",{tag:{type:t.type||7,opeType:t.opeType},datas:map$6(a=t.serverIds).call(a,(function(t){return{serverId:t}}))});case 2:return h=S.sent,g=h.content.failedArr,M=filter(u=t.serverIds).call(u,(function(t){return!some(g).call(g,(function(a){return a.serverId===t}))})),forEach$1(M).call(M,(function(a){1===t.opeType?I.autoVisitorSubscribeServer.add(a):I.autoVisitorSubscribeServer.delete(a)})),S.abrupt("return",{failedServers:map$6(m=h.content.failedArr).call(m,(function(t){return t.serverId}))});case 7:case"end":return S.stop()}}),_callee2,this)})))},t.deleteServer=function deleteServer(t){var a;this.autoServers.delete(t),this.autoVisitorSubscribeServer.has(t)&&this.subscribeServerAsVisitor({opeType:2,serverIds:[t]});var u=[];forEach$1(a=this.autoVisitorSubscribeChannel).call(a,(function(a){if(0===indexOf(a).call(a,t)){var m=a.replace(t+"&","");u.push({serverId:t,channelId:m})}})),u.length>0&&this.subscribeChannelAsVisitor({opeType:2,channels:u})},t.deleteAutoSetInServerId=function deleteAutoSetInServerId(t){var a,u=this;this.autoServers.delete(t),this.autoVisitorSubscribeServer.delete(t),forEach$1(a=this.autoVisitorSubscribeChannel).call(a,(function(a){0===indexOf(a).call(a,t)&&u.autoVisitorSubscribeChannel.delete(a)}))},t.deleteAutoSetInChannel=function deleteAutoSetInChannel(t,a){this.autoVisitorSubscribeChannel.delete(t+"&"+a)},t.unSubscribeChannel=function unSubscribeChannel(t,a){this.subscribeChannelAsVisitor({opeType:2,channels:[{serverId:t,channelId:a}]})},t.isInSubscribeChannels=function isInSubscribeChannels(t,a){return this.autoVisitorSubscribeChannel.has(t+"&"+a)},t.isInAutoServers=function isInAutoServers(t){return this.autoServers.has(t)},t.doAutoSubscribe=function doAutoSubscribe(){var t=this,a=[],u=chunk(nu(this.autoVisitorSubscribeServer),this.limitForBatchSubscribe);forEach$1(u).call(u,(function(u){a.push(t.subscribeServerAsVisitor({opeType:1,serverIds:u}))}));var m=chunk(nu(this.autoVisitorSubscribeChannel),this.limitForBatchSubscribe);return forEach$1(m).call(m,(function(u){a.push(t.subscribeChannelAsVisitor({opeType:1,channels:map$6(u).call(u,(function(t){var a=indexOf(t).call(t,"&");return{serverId:slice(t).call(t,0,a),channelId:slice(t).call(t,a+1)}}))}))})),$i.all(a)},t.doAutoEnterServer=function doAutoEnterServer(){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var t,a,u,m=this;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return t=chunk(nu(this.autoServers),this.limitForBatchEnter),a=[],forEach$1(t).call(t,(function(t){a.push(m.core.qchatServer.enterAsVisitor({serverIds:t}))})),h.next=5,$i.all(a);case 5:u=h.sent,forEach$1(u).call(u,(function(t){var a;forEach$1(a=t.failedServers).call(a,(function(t){m.deleteAutoSetInServerId(t)}))}));case 7:case"end":return h.stop()}}),_callee3,this)})))},t.resumeSubscribe=function resumeSubscribe(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:if(!t){a.next=7;break}return a.next=3,this.doAutoEnterServer();case 3:return a.next=5,this.doAutoSubscribe();case 5:a.next=10;break;case 7:this.autoServers.clear(),this.autoVisitorSubscribeChannel.clear(),this.autoVisitorSubscribeServer.clear();case 10:case"end":return a.stop()}}),_callee4,this)})))},t.cacheServer=function cacheServer(t){var a=this;forEach$1(t).call(t,(function(t){return a.autoServers.add(t)}))},SubscribeForVisitorService}();function _createForOfIteratorHelperLoose$1(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray$1(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$1(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray$1(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var f_=function(t){function QChatChannelService(a,u){var m;return(m=t.call(this,"qchatChannel",a)||this).config={autoSubscribe:!1},m.core=a,registerParser({cmdMap:UI,cmdConfig:FI()}),u&&m.setOptions(u),m.subscribeModuleService=new g_(a),m.subscribeForVisitorService=new v_(a),m.setListener(),m}wt(QChatChannelService,t);var a=QChatChannelService.prototype;return a.setOptions=function setOptions(t){t&&(this.config=Ut(this.config,t))},a.setListener=function setListener(){var t,a,u,m,h,g=this;this.core.eventBus.on("logined",(function(t){g.subscribeModuleService.resumeSubscribe(t.isAutoReconnect),g.subscribeForVisitorService.resumeSubscribe(t.isAutoReconnect),g.config.autoSubscribe&&(g.subscribeModuleService.autoSubscribeServerMap={},g.subscribeModuleService.autoSubscribeUnreadMap={},g.subscribeModuleService.autoSubscribe())})),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(t){g.subscribeModuleService.resumeSubscribe(t.isReconnect),g.subscribeForVisitorService.resumeSubscribe(t.isReconnect),g.config.autoSubscribe&&(g.subscribeModuleService.autoSubscribeServerMap={},g.subscribeModuleService.autoSubscribeUnreadMap={},g.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(a=this.subscribeModuleService.updateUnreads).call(a,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(m=this.subscribeModuleService.clearUnreadCountByServers).call(m,this.subscribeModuleService)),this.core.eventBus.on("qchatChannel/getRoleIdsByServerId",bind$1(h=this.subscribeModuleService.getRoleIdsByServerId).call(h,this.subscribeModuleService)),this.core.eventBus.on("qchatChannel/autoUnSubscribe",(function(t){if(g.logger.log("QChatChannel::enter autoUnSubscribe sysMsg is",t),t.type===l_[l_.channelVisibilityUpdate])g.logger.log("QChatChannel::begin autoUnSubscribe channel key is",t.serverId+"_"+t.channelId),g.subscribeModuleService._unSubscribeChannel(t.serverId,t.channelId),g.logger.log("QChatChannel::autoUnSubscribe channel done key is",t.serverId+"_"+t.channelId);else if(t.type===l_[l_.serverEnterLeave]){var a;(g.subscribeModuleService.manualSubscribeServerMap[t.serverId]||g.subscribeModuleService.autoSubscribeServerMap[t.serverId])&&(g.logger.log("QChatChannel::begin autoUnSubscribe server key is",t.serverId),g.subscribeModuleService._unSubscribeServer(t.serverId),g.logger.log("QChatChannel::autoUnSubscribe server done key is",t.serverId));var u=g.subscribeModuleService.unreadServerCount[t.serverId];if(!u)return;g.logger.log("QChatChannel::begin autoUnSubscribe channels key is",Gt(u)),forEach$1(a=Gt(u)).call(a,(function(a){g.subscribeModuleService._unSubscribeChannel(t.serverId,a)})),g.logger.log("QChatChannel::autoUnSubscribe channels done key is",Gt(u))}})),this.core.eventBus.on("qchatChannel/serverIdentifyChange",(function(t){g.subscribeModuleService.changeCacheServerRoleIds(t)}))},a.createChannel=function createChannel(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return validate({serverId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(NI)},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:Ut(Ut({},t),{type:NI[t.type]}),antispamTag:generateAntispamTag(t)});case 3:return a=u.sent,u.abrupt("return",formatChannel(a.content.channelInfo));case 5:case"end":return u.stop()}}),_callee,this)})))},a.deleteChannel=function deleteChannel(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("qchatDeleteChannel",t);case 3:case"end":return a.stop()}}),_callee2,this)})))},a.updateChannel=function updateChannel(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a,u;return lu.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:return validate({channelId:{type:"string",min:1},serverId:{type:"string",required:!1},type:{type:"enum",values:getEnumKeys(NI),required:!1},name:{type:"string",required:!1},topic:{type:"string",required:!1},ext:{type:"string",required:!1},visitorMode:{type:"number",required:!1}},t),a=t,t.type&&(a.type=NI[t.type]),m.next=5,this.core.sendCmd("qchatUpdateChannel",{channelInfo:a,antispamTag:generateAntispamTag(t)});case 5:return u=m.sent,m.abrupt("return",formatChannel(u.content.channelInfo));case 7:case"end":return m.stop()}}),_callee3,this)})))},a.getChannels=function getChannels(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a;return lu.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 a=u.sent,u.abrupt("return",formatChannels(a.content.channelList));case 5:case"end":return u.stop()}}),_callee4,this)})))},a.getChannelsByPage=function getChannelsByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a,u,m,h;return lu.wrap((function _callee5$(g){for(;;)switch(g.prev=g.next){case 0:return validate({serverId:{type:"string",min:1},timetag:{type:"number"},limit:{type:"number",min:1,required:!1}},t),g.next=3,this.core.sendCmd("qchatGetChannelsByPage",{qchatGetChannelListPageTag:Ut({limit:100},t)});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatChannels(m)});case 6:case"end":return g.stop()}}),_callee5,this)})))},a.getMembersByPage=function getMembersByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var a,u,m,h;return lu.wrap((function _callee6$(g){for(;;)switch(g.prev=g.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),g.next=3,this.core.sendCmd("qchatGetMembersByPage",{qchatGetMembersByPageTag:t});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatMembers$1(m)});case 6:case"end":return g.stop()}}),_callee6,this)})))},a.updateWhiteBlackRole=function updateWhiteBlackRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.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(AI)},opeType:{type:"enum",values:getEnumKeys(wI)}},t),a.next=3,this.core.sendCmd("qchatUpdateWhiteBlackRole",{qchatUpdateWhiteBlackRoleTag:Ut(Ut({},t),{type:AI[t.type],opeType:wI[t.opeType]})});case 3:case"end":return a.stop()}}),_callee7,this)})))},a.getWhiteBlackRolesPage=function getWhiteBlackRolesPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a,u,m,h;return lu.wrap((function _callee8$(g){for(;;)switch(g.prev=g.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(AI)},timetag:{type:"number"},limit:{type:"number",min:1,required:!1}},t),g.next=3,this.core.sendCmd("qchatGetWhiteBlackRolesPage",{qchatGetWhiteBlackRolesPageTag:Ut(Ut({},t),{type:AI[t.type]})});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatRoles(m)});case 6:case"end":return g.stop()}}),_callee8,this)})))},a.updateWhiteBlackMembers=function updateWhiteBlackMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){return lu.wrap((function _callee9$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(AI)},opeType:{type:"enum",values:getEnumKeys(wI)},toAccids:{type:"array",itemType:"string",min:1}},t),a.next=3,this.core.sendCmd("qchatUpdateWhiteBlackMembers",{qchatUpdateWhiteBlackMembersTag:Ut(Ut({},t),{type:AI[t.type],opeType:wI[t.opeType],toAccids:Vn(t.toAccids)})});case 3:case"end":return a.stop()}}),_callee9,this)})))},a.getWhiteBlackMembersPage=function getWhiteBlackMembersPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){var a,u,m,h;return lu.wrap((function _callee10$(g){for(;;)switch(g.prev=g.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(AI)},timetag:{type:"number"},limit:{type:"number",min:1,required:!1}},t),g.next=3,this.core.sendCmd("qchatGetWhiteBlackMembersPage",{qchatGetWhiteBlackMembersPageTag:Ut(Ut({limit:100},t),{type:AI[t.type]})});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatMembers$1(m)});case 6:case"end":return g.stop()}}),_callee10,this)})))},a.getExistingWhiteBlackRoles=function getExistingWhiteBlackRoles(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){var a,u;return lu.wrap((function _callee11$(m){for(;;)switch(m.prev=m.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(AI)},roleIds:{type:"array",itemType:"string",min:1}},t),m.next=3,this.core.sendCmd("qchatGetExistingWhiteBlackRoles",{qchatGetExistingWhiteBlackRolesTag:Ut(Ut({},t),{type:AI[t.type],roleIds:Vn(t.roleIds)})});case 3:return a=m.sent,u=a.content.datas,m.abrupt("return",{datas:formatRoles(u)});case 6:case"end":return m.stop()}}),_callee11,this)})))},a.getExistingWhiteBlackMembers=function getExistingWhiteBlackMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){var a,u;return lu.wrap((function _callee12$(m){for(;;)switch(m.prev=m.next){case 0:return validate({serverId:{type:"string",min:1},channelId:{type:"string",min:1},type:{type:"enum",values:getEnumKeys(AI)},accids:{type:"array",itemType:"string",min:1}},t),m.next=3,this.core.sendCmd("qchatGetExistingWhiteBlackMembers",{qchatGetExistingWhiteBlackMembersTag:Ut(Ut({},t),{type:AI[t.type],accids:Vn(t.accids)})});case 3:return a=m.sent,u=a.content.datas,m.abrupt("return",{datas:formatMembers$1(u)});case 6:case"end":return m.stop()}}),_callee12,this)})))},a.updateCategoryInfoOfChannel=function updateCategoryInfoOfChannel(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){var a;return lu.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 a=u.sent,u.abrupt("return",formatChannel(a.content.channelInfo));case 5:case"end":return u.stop()}}),_callee13,this)})))},a.createChannelCategory=function createChannelCategory(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){var a;return lu.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 a=u.sent,u.abrupt("return",formatChannelCategory(a.content.QChatChannelCategoryInfo));case 5:case"end":return u.stop()}}),_callee14,this)})))},a.removeChannelCategory=function removeChannelCategory(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){return lu.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("qchatRemoveChannelCategory",t);case 3:case"end":return a.stop()}}),_callee15,this)})))},a.updateChannelCategory=function updateChannelCategory(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var a;return lu.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 a=u.sent,u.abrupt("return",formatChannelCategory(a.content.QChatChannelCategoryInfo));case 5:case"end":return u.stop()}}),_callee16,this)})))},a.getChannelCategoriesByID=function getChannelCategoriesByID(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee17(){var a;return lu.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 a=u.sent,u.abrupt("return",formatChannelCategorys(a.content.channelCategoryList));case 5:case"end":return u.stop()}}),_callee17,this)})))},a.updateChannelCategoryWhiteBlackRole=function updateChannelCategoryWhiteBlackRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee18(){return lu.wrap((function _callee18$(a){for(;;)switch(a.prev=a.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(AI)},opeType:{type:"enum",values:getEnumKeys(wI)},roleId:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("qchatUpdateChannelCategoryWhiteBlackRole",{qchatUpdateChannelCategoryWhiteBlackRoleTag:Ut(Ut({},t),{type:AI[t.type],opeType:wI[t.opeType]})});case 3:case"end":return a.stop()}}),_callee18,this)})))},a.getChannelCategoryWhiteBlackRolesPage=function getChannelCategoryWhiteBlackRolesPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee19(){var a,u,m,h;return lu.wrap((function _callee19$(g){for(;;)switch(g.prev=g.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(AI)},timetag:{type:"number",min:0},limit:{type:"number",min:1,required:!1}},t),g.next=3,this.core.sendCmd("qchatGetChannelCategoryWhiteBlackRolesPage",{qchatGetChannelCategoryWhiteBlackRolesPageTag:Ut(Ut({},t),{type:AI[t.type]})});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatRoles(m)});case 6:case"end":return g.stop()}}),_callee19,this)})))},a.updateChannelCategoryWhiteBlackMembers=function updateChannelCategoryWhiteBlackMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee20(){return lu.wrap((function _callee20$(a){for(;;)switch(a.prev=a.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(AI)},opeType:{type:"enum",values:getEnumKeys(wI)},toAccids:{type:"array",itemType:"string",min:1}},t),a.next=3,this.core.sendCmd("qchatUpdateChannelCategoryWhiteBlackMembers",{qchatUpdateChannelCategoryWhiteBlackMembersTag:Ut(Ut({},t),{type:AI[t.type],opeType:wI[t.opeType],toAccids:Vn(t.toAccids)})});case 3:case"end":return a.stop()}}),_callee20,this)})))},a.getChannelCategoryWhiteBlackMembersPage=function getChannelCategoryWhiteBlackMembersPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee21(){var a,u,m,h;return lu.wrap((function _callee21$(g){for(;;)switch(g.prev=g.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(AI)},timetag:{type:"number",min:0},limit:{type:"number",min:1,required:!1}},t),g.next=3,this.core.sendCmd("qchatGetChannelCategoryWhiteBlackMembersPage",{qchatGetChannelCategoryWhiteBlackMembersPageTag:Ut(Ut({},t),{type:AI[t.type]})});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatMembers$1(m)});case 6:case"end":return g.stop()}}),_callee21,this)})))},a.getChannelCategoryWhiteBlackRoles=function getChannelCategoryWhiteBlackRoles(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee22(){var a,u;return lu.wrap((function _callee22$(m){for(;;)switch(m.prev=m.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(AI)},roleIds:{type:"array",itemType:"string",min:1}},t),m.next=3,this.core.sendCmd("qchatGetChannelCategoryWhiteBlackRoles",{qchatGetChannelCategoryWhiteBlackRolesTag:Ut(Ut({},t),{type:AI[t.type],roleIds:Vn(t.roleIds)})});case 3:return a=m.sent,u=a.content.datas,m.abrupt("return",formatRoles(u));case 6:case"end":return m.stop()}}),_callee22,this)})))},a.getChannelCategoryWhiteBlackMembers=function getChannelCategoryWhiteBlackMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee23(){var a,u;return lu.wrap((function _callee23$(m){for(;;)switch(m.prev=m.next){case 0:return validate({categoryId:{type:"string",allowEmpty:!1},serverId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(AI)},accids:{type:"array",itemType:"string",min:1}},t),m.next=3,this.core.sendCmd("qchatGetChannelCategoryWhiteBlackMembers",{qchatGetChannelCategoryWhiteBlackMembersTag:Ut(Ut({},t),{type:AI[t.type],accids:Vn(t.accids)})});case 3:return a=m.sent,u=a.content.datas,m.abrupt("return",formatMembers$1(u));case 6:case"end":return m.stop()}}),_callee23,this)})))},a.getChannelCategoriesPage=function getChannelCategoriesPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee24(){var a,u,m,h;return lu.wrap((function _callee24$(g){for(;;)switch(g.prev=g.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},timetag:{type:"number",min:0},limit:{type:"number",min:1,required:!1}},t),g.next=3,this.core.sendCmd("qchatGetChannelCategoriesPage",{qchatGetChannelCategoriesPageTag:t});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatChannelCategorys(m)});case 6:case"end":return g.stop()}}),_callee24,this)})))},a.getChannelCategoryChannelsPage=function getChannelCategoryChannelsPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee25(){var a,u,m,h;return lu.wrap((function _callee25$(g){for(;;)switch(g.prev=g.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),g.next=3,this.core.sendCmd("qchatGetChannelCategoryChannelsPage",{qchatGetChannelCategoryChannelsPageTag:t});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatChannels(m)});case 6:case"end":return g.stop()}}),_callee25,this)})))},a.subscribeChannel=function subscribeChannel(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee26(){var a,u;return lu.wrap((function _callee26$(m){for(;;)switch(m.prev=m.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){m.next=3;break}throw new Xl("subscribe server failed, manual subscribe is not allowed in auto subscribe mode",{},403);case 3:return m.next=5,this.subscribeModuleService.subscribe(t);case 5:if((a=m.sent).unreadInfos=formatUnreadInfos(a.unreadInfos),5!==t.type){m.next=10;break}return this.subscribeModuleService.cacheSubscribe(t),m.abrupt("return");case 10:return 1===t.opeType&&(t.channels=map$6(u=a.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(a.unreadInfos),m.abrupt("return",a);case 15:case"end":return m.stop()}}),_callee26,this)})))},a.getChannelUnreadInfos=function getChannelUnreadInfos(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee27(){var a,u;return lu.wrap((function _callee27$(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.core.sendCmd("qchatGetUnreadInfo",t);case 2:return a=m.sent,u=formatUnreadInfos(a.content.unreadInfos),this.subscribeModuleService.updateUnreads(u),m.abrupt("return",u);case 6:case"end":return m.stop()}}),_callee27,this)})))},a.getChannelSearchByPage=function getChannelSearchByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee28(){var a,u,m,h;return lu.wrap((function _callee28$(g){for(;;)switch(g.prev=g.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(xI),required:!1},limit:{type:"number",min:1,required:!1},serverId:{type:"string",required:!1},sort:{type:"enum",values:getEnumKeys(RI),required:!1},cursor:{type:"string",allowEmpty:!1,required:!1}},t),!(t.startTime&&t.endTime&&t.startTime>=t.endTime)){g.next=3;break}throw new Kl("startTime more than endTime",t,"timeRule");case 3:return g.next=5,this.core.sendCmd("qchatGetChannelSearchByPage",{qchatGetChannelSearchByPageTag:Ut(Ut({},t),{order:t.order&&xI[t.order],sort:sort(t)&&RI[sort(t)]})});case 5:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag),cursor:h.cursor},datas:formatChannels(m)});case 8:case"end":return g.stop()}}),_callee28,this)})))},a.channelMemberSearch=function channelMemberSearch(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee29(){var a;return lu.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 a=u.sent,u.abrupt("return",formatChannelMembers(a.content.datas));case 5:case"end":return u.stop()}}),_callee29,this)})))},a.subscribeAsVisitor=function subscribeAsVisitor(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee30(){return lu.wrap((function _callee30$(a){for(;;)switch(a.prev=a.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),a.next=3,this.subscribeForVisitorService.subscribeChannelAsVisitor(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee30,this)})))},a.qchatAutoSubscribeNotificationHandler=function qchatAutoSubscribeNotificationHandler(t){var a=formatUnreadInfos(t.content.unreadInfos),u=t.content.serverIds;this.subscribeModuleService.updateUnreads(a);var m=[];if(u.length){var h={opeType:1};h.channels=map$6(u).call(u,(function(t){return{serverId:t.serverId,channelId:""}})),h.type=4,m.push(h)}if(a.length){var g={opeType:1};g.channels=map$6(a).call(a,(function(t){return{serverId:t.serverId,channelId:t.channelId}})),g.type=1,m.push(g)}if(m.length)for(var M,I=_createForOfIteratorHelperLoose$1(m);!(M=I()).done;){var S=M.value;this.subscribeModuleService.cacheAutoSubscribe(S)}},QChatChannelService}(VI),y_={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"}},M_={limit:{type:"number"}};function formatMembers(t){return Un(t)&&t.length>0?map$6(t).call(t,(function(t){return function formatMember(t){return format(y_,t)}(t)})):[]}function formatRTCChannelConfig(t){try{t.audio&&(t.audio=JSON.parse(t.audio))}catch(t){throw new Kl('result "audio" JSON parse error',{key:"audio"},"JSON parse error")}try{t.video&&(t.video=JSON.parse(t.video))}catch(t){throw new Kl('result "video" JSON parse error',{key:"video"},"JSON parse error")}return format(M_,t)}var I_,__={"25_1":"qchatGetNeroomToken","25_2":"qchatUpdateRTCChannelConfig","25_3":"qchatGetRTCChannelConfig","25_4":"qchatGetRTCChannelMembers"},S_={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}},T_=function getCmdConfig(){var t=function getDeserializeTag(){return invertSerializeMap(S_)}();return{qchatGetNeroomToken:{sid:25,cid:1,service:"qchatMedia",params:[{type:"Property",name:"qchatGetNeroomTokenTag",reflectMapper:S_.QChatGetNeroomTokenParams}],response:[{type:"Property",name:"neroomToken",reflectMapper:t.QChatGetNeroomTokenResultTag}]},qchatUpdateRTCChannelConfig:{sid:25,cid:2,service:"qchatMedia",params:[{type:"Property",name:"RTCChannelConfig",reflectMapper:S_.QChatRTCChannelConfigTag}]},qchatGetRTCChannelConfig:{sid:25,cid:3,service:"qchatMedia",params:[{type:"Property",name:"qchatGetRTCChannelConfigTag",reflectMapper:S_.QChatGetRTCParams}],response:[{type:"Property",name:"RTCChannelConfig",reflectMapper:t.QChatRTCChannelConfigResultTag}]},qchatGetRTCChannelMembers:{sid:25,cid:4,service:"qchatMedia",params:[{type:"Property",name:"qchatGetRTCChannelMembersTag",reflectMapper:S_.QChatGetRTCParams}],response:[{type:"PropertyArray",name:"memberList",reflectMapper:t.memberInfo}]}}},C_=function(t){function QChatMediaService(a,u){var m;return(m=t.call(this,"qchatMedia",a)||this).config={},m.tokenExpireTime=24e4,m.getTokenState=!1,m.core=a,registerParser({cmdMap:__,cmdConfig:T_()}),u&&m.setOptions(u),m.setListener(),m.tokenExpireTime=24e4,m.channelId="",m.serverId="",m}wt(QChatMediaService,t);var a=QChatMediaService.prototype;return a.setOptions=function setOptions(t){t&&(this.config=Ut(this.config,t),(null==t?void 0:t.neroom)&&this.setNeroom(t.neroom))},a.setNeroom=function setNeroom(t){this.neroom=new t},a.setListener=function setListener(){var t,a,u,m,h=this;this.core.eventBus.on("disconnect",bind$1(t=this._existRomm).call(t,this)),this.core.eventBus.on("kicked",bind$1(a=this._existRomm).call(a,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLogout",bind$1(u=this._existRomm).call(u,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleKicked",bind$1(m=this._existRomm).call(m,this)),this.core.eventBus.on("qchatMedia/serverOrChannelLeave",(function(t){return __awaiter(h,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(!(t.type===l_[l_.channelVisibilityUpdate]&&t.channelId===this.channelId||t.type===l_[l_.serverEnterLeave]&&t.serverId===this.serverId)){a.next=4;break}if(!this.roomContext||!this.roomContext.roomUuid){a.next=4;break}return a.next=4,this.disconnectChannel();case 4:case"end":return a.stop()}}),_callee,this)})))}))},a._existRomm=function _existRomm(){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.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)})))},a._checkPermission=function _checkPermission(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.core.qchatRole.checkPermission(t);case 2:return a=u.sent,u.abrupt("return",a);case 4:case"end":return u.stop()}}),_callee3,this)})))},a._checkConnectState=function _checkConnectState(){if("connect"!==this.state)throw new Xl("QChatMedia::you should connect first")},a.kickMemberOut=function kickMemberOut(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){return lu.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===(a=this.roomContext)||void 0===a?void 0:a.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 "+Vn(t),u.t0),new Xl("QChatMedia::kickMemberOut error",u.t0);case 11:case"end":return u.stop()}}),_callee4,this,[[2,7]])})))},a.disconnectChannel=function disconnectChannel(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){return lu.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:return this.logger.debug("QChatMedia::disconnect begin disconnect"),a.prev=1,a.next=4,null===(t=this.roomContext)||void 0===t?void 0:t.leaveRoom();case 4:a.next=9;break;case 6:a.prev=6,a.t0=a.catch(1),this.logger.error("QChatMedia::disconnect error",a.t0);case 9:if(!this.authService){a.next=12;break}return a.next=12,this.authService.logout();case 12:this._setStateInit(),this.core.emit("qchatMediaDisconnect"),this.core.qchatMedia.emit("qchatMediaDisconnect");case 15:case"end":return a.stop()}}),_callee5,this,[[1,6]])})))},a._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=""},a.muteAudio=function muteAudio(t){var a,u,m,h,g;return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var M;return lu.wrap((function _callee6$(I){for(;;)switch(I.prev=I.next){case 0:if(this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),(null===(a=this.roomContext)||void 0===a?void 0:a.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,!(M=null===(m=this.roomContext)||void 0===m?void 0:m.roomProperties.audioOff)||"offNotAllowSelfOn"!==(null===(h=M.value)||void 0===h?void 0:h.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===(g=this.rtcController)||void 0===g?void 0:g.muteMemberAudio(t.accid);case 27:throw I.prev=27,I.t1=I.catch(14),this.logger.error("QChatMedia::muteAudio error params is "+Vn(t),I.t1),new Xl("QChatMedia::muteAudio error",I.t1);case 31:case"end":return I.stop()}}),_callee6,this,[[3,8],[14,27]])})))},a.unMuteAudio=function unMuteAudio(t){var a,u,m,h,g;return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var M;return lu.wrap((function _callee7$(I){for(;;)switch(I.prev=I.next){case 0:if(this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),!(M=null===(a=this.roomContext)||void 0===a?void 0:a.roomProperties.audioOff)||"offNotAllowSelfOn"!==(null===(u=M.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===(m=this.roomContext)||void 0===m?void 0:m.localMember.uuid)!==t.accid){I.next=22;break}return I.prev=11,I.next=14,null===(h=this.rtcController)||void 0===h?void 0:h.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===(g=this.rtcController)||void 0===g?void 0:g.unmuteMemberAudio(t.accid);case 27:throw I.prev=27,I.t1=I.catch(22),this.logger.error("QChatMedia::unMuteAudio error params is "+Vn(t),I.t1),new Xl("QChatMedia::unMuteAudio error",I.t1);case 31:case"end":return I.stop()}}),_callee7,this,[[11,16],[22,27]])})))},a.muteVideo=function muteVideo(t){var a,u,m,h,g;return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var M;return lu.wrap((function _callee8$(I){for(;;)switch(I.prev=I.next){case 0:if(this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),(null===(a=this.roomContext)||void 0===a?void 0:a.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,!(M=null===(m=this.roomContext)||void 0===m?void 0:m.roomProperties.videoOff)||"offNotAllowSelfOn"!==(null===(h=M.value)||void 0===h?void 0:h.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===(g=this.rtcController)||void 0===g?void 0:g.muteMemberVideo(t.accid);case 27:throw I.prev=27,I.t1=I.catch(14),this.logger.error("QChatMedia::muteVideo error params is "+Vn(t),I.t1),new Xl("QChatMedia::muteVideo error",I.t1);case 31:case"end":return I.stop()}}),_callee8,this,[[3,8],[14,27]])})))},a.unMuteVideo=function unMuteVideo(t){var a,u,m,h,g;return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var M;return lu.wrap((function _callee9$(I){for(;;)switch(I.prev=I.next){case 0:if(this._checkConnectState(),validate({accid:{type:"string",allowEmpty:!1}},t),!(M=null===(a=this.roomContext)||void 0===a?void 0:a.roomProperties.videoOff)||"offNotAllowSelfOn"!==(null===(u=M.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===(m=this.roomContext)||void 0===m?void 0:m.localMember.uuid)!==t.accid){I.next=22;break}return I.prev=11,I.next=14,null===(h=this.rtcController)||void 0===h?void 0:h.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===(g=this.rtcController)||void 0===g||g.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]])})))},a.startScreenShare=function startScreenShare(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){return lu.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:this._checkConnectState(),a.prev=1,null===(t=this.rtcController)||void 0===t||t.startScreenShare(),a.next=9;break;case 5:throw a.prev=5,a.t0=a.catch(1),this.logger.error("QChatMedia::startScreenShare error",a.t0),new Xl("QChatMedia::startScreenShare error",a.t0);case 9:case"end":return a.stop()}}),_callee10,this,[[1,5]])})))},a.stopScreenShare=function stopScreenShare(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){return lu.wrap((function _callee11$(a){for(;;)switch(a.prev=a.next){case 0:this._checkConnectState(),a.prev=1,null===(t=this.rtcController)||void 0===t||t.stopScreenShare(),a.next=9;break;case 5:throw a.prev=5,a.t0=a.catch(1),this.logger.error("QChatMedia::stopScreenShare error",a.t0),new Xl("QChatMedia::stopScreenShare error",a.t0);case 9:case"end":return a.stop()}}),_callee11,this,[[1,5]])})))},a.stopMemberScreenShare=function stopMemberScreenShare(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){return lu.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===(a=this.rtcController)||void 0===a||a.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]])})))},a.subscribeRemoteVideoStream=function subscribeRemoteVideoStream(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){return lu.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===(a=this.rtcController)||void 0===a||a.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]])})))},a.unSubscribeRemoteVideoStream=function unSubscribeRemoteVideoStream(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){return lu.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===(a=this.rtcController)||void 0===a||a.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]])})))},a.setupVideoCanvas=function setupVideoCanvas(t){var a;if(this._checkConnectState(),(null===(a=this.roomContext)||void 0===a?void 0:a.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)}},a.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)}},a.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)}},a.initQChatMedia=function initQChatMedia(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){return lu.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:if(this.neroom){a.next=3;break}return this.logger.warn("QChatMedia::init::you should import neroom SDK"),a.abrupt("return");case 3:if(void 0===this.state){a.next=6;break}return this.logger.error("QChatMedia::init::you already init QChatMedia"),a.abrupt("return");case 6:a.prev=6,this.neroom.initialize({appKey:this.core.options.appkey,serverConfig:t.serverConfig}),a.next=14;break;case 10:throw a.prev=10,a.t0=a.catch(6),this.logger.error("QChatMedia::initQChatMedia error",a.t0),new Xl("QChatMedia::initQChatMedia error",a.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 a.stop()}}),_callee15,this,[[6,10]])})))},a.loginByIM=function loginByIM(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var a,u;return lu.wrap((function _callee16$(m){for(;;)switch(m.prev=m.next){case 0:if("init"===this.state){m.next=3;break}return this.logger.error("QChatMedia::connect::you should init before login"),m.abrupt("return");case 3:return m.next=5,this._getToken();case 5:return a=m.sent,u=get(this.core,"options.token")||get(this.core,"V2NIMLoginService.token"),m.prev=7,m.next=10,null===(t=this.authService)||void 0===t?void 0:t.loginByIM(this.core.account,a,u);case 10:m.next=16;break;case 12:throw m.prev=12,m.t0=m.catch(7),this.logger.error("QChatMedia::loginByIM error",m.t0),new Xl("QChatMedia::loginByIM error",m.t0);case 16:this.state="login";case 17:case"end":return m.stop()}}),_callee16,this,[[7,12]])})))},a._getToken=function _getToken(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee18(){var a,u,m,h,g=this;return lu.wrap((function _callee18$(M){for(;;)switch(M.prev=M.next){case 0:return this.logger.log("QChatMedia::getToken begin getToken"),M.next=3,this.core.sendCmd("qchatGetNeroomToken",{qchatGetNeroomTokenTag:{neroomDeviceId:null===(t=this.neroom)||void 0===t?void 0:t.deviceId}});case 3:return a=M.sent,u=a.content.neroomToken,m=u.token,h=u.expire,this.logger.log("QChatMedia::getToken success token is "+m+",expire is "+h+" "),this.tokenTimer||(this.logger.debug("QChatMedia::getToken set token timer,expire is "+(1e3*h-this.tokenExpireTime)+" "),this.tokenTimer=this.core.timerManager.addTimer((function(){return __awaiter(g,void 0,void 0,lu.mark((function _callee17(){var t;return lu.wrap((function _callee17$(a){for(;;)switch(a.prev=a.next){case 0:return this.tokenTimer&&this.core.timerManager.deleteTimer(this.tokenTimer),this.tokenTimer=void 0,a.next=4,this._getToken();case 4:t=a.sent,this.authService&&this.authService.renewToken(t);case 6:case"end":return a.stop()}}),_callee17,this)})))}),1e3*h-this.tokenExpireTime)),M.abrupt("return",m);case 8:case"end":return M.stop()}}),_callee18,this)})))},a.connectChannel=function connectChannel(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee19(){var m;return lu.wrap((function _callee19$(h){for(;;)switch(h.prev=h.next){case 0:if(void 0!==this.state){h.next=3;break}return this.logger.error("QChatMedia::connect::you should init before login"),h.abrupt("return");case 3:if("init"!==this.state){h.next=6;break}return h.next=6,this.loginByIM();case 6:return this.serverId=t.serverId,this.channelId=t.channelId,h.prev=8,h.next=11,null===(a=this.roomService)||void 0===a?void 0:a.joinRoom({roomUuid:t.channelId,role:"qchatAudience",userName:this.core.account,initialProperties:{}},{});case 11:h.next=17;break;case 13:throw h.prev=13,h.t0=h.catch(8),this.logger.error("QChatMedia::connectChannel error",h.t0),new Xl("QChatMedia::connectChannel error",h.t0);case 17:if(!(m=null===(u=this.roomService)||void 0===u?void 0:u.getRoomContext(t.channelId))){h.next=28;break}return this.roomContext=m,this.rtcController=this.roomContext.rtcController,this.state="connect",h.next=24,this.rtcController.joinRtcChannel();case 24:this.core.emit("connectChannel"),this.core.qchatMedia.emit("connectChannel"),h.next=29;break;case 28:this.logger.error("QChatMedia::connect room not exited");case 29:case"end":return h.stop()}}),_callee19,this,[[8,13]])})))},a.updateRTCChannelInfo=function updateRTCChannelInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee20(){return lu.wrap((function _callee20$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},limit:{type:"number",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("qchatUpdateRTCChannelConfig",{RTCChannelConfig:Ut(Ut({},t),{audio:Vn(t.audio),video:Vn(t.video)})});case 3:case"end":return a.stop()}}),_callee20,this)})))},a.getRTCChannelInfo=function getRTCChannelInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee21(){var a;return lu.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 a=u.sent,u.abrupt("return",formatRTCChannelConfig(a.content.RTCChannelConfig));case 5:case"end":return u.stop()}}),_callee21,this)})))},a.getRTCChannelOnlineMembers=function getRTCChannelOnlineMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee22(){var a;return lu.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 a=u.sent,u.abrupt("return",formatMembers(a.content.memberList));case 5:case"end":return u.stop()}}),_callee22,this)})))},a.addRTCChannelListener=function addRTCChannelListener(){var t,a,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,lu.mark((function _callee23(){var a;return lu.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(a=u.sent,!this.authService){u.next=9;break}return u.next=9,this.authService.renewToken(a);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===(a=this.roomContext)||void 0===a||a.addRoomListener({onRoomPropertiesChanged:function onRoomPropertiesChanged(t){var a,m,h,g,M,I;if(u.logger.log("QChatMedia::addRTCChannelListener::onRoomPropertiesChanged",t),t.audioOff){var S=null===(a=t.audioOff.value)||void 0===a?void 0:a.split("_")[0];"offNotAllowSelfOn"!==S&&"offAllowSelfOn"!==S||(null===(m=u.roomContext)||void 0===m?void 0:m.localMember.isAudioOn)&&(null===(h=u.rtcController)||void 0===h||h.muteMyAudio())}else if(t.videoOff){var T=null===(g=t.videoOff.value)||void 0===g?void 0:g.split("_")[0];"offNotAllowSelfOn"!==T&&"offAllowSelfOn"!==T||(null===(M=u.roomContext)||void 0===M?void 0:M.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 a=map$6(t).call(t,(function(t){return t.uuid}));u.core.emit("memberJoinRTCChannel",a),u.core.qchatMedia.emit("memberJoinRTCChannel",a)},onMemberLeaveRoom:function onMemberLeaveRoom(t){u.logger.log("QChatMedia::addRTCChannelListener::onMemberLeaveRoom",t);var a=map$6(t).call(t,(function(t){return t.uuid}));u.core.emit("memberLeaveRTCChannel",a),u.core.qchatMedia.emit("memberLeaveRTCChannel",a)},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,a,m){u.logger.log("QChatMedia::addRTCChannelListener::onMemberAudioMuteChanged",t,a),u.core.emit("memberAudioMuteChanged",{memberAccId:t.uuid,mute:a,operateByAccId:m.uuid}),u.core.qchatMedia.emit("memberAudioMuteChanged",{memberAccId:t.uuid,mute:a,operateByAccId:m.uuid})},onMemberScreenShareStateChanged:function onMemberScreenShareStateChanged(t,a,m){u.logger.log("QChatMedia::addRTCChannelListener::onMemberScreenShareStateChanged",t,a),u.core.emit("memberScreenShareStateChanged",{memberAccId:t.uuid,isSharing:a,operateByAccId:m.uuid}),u.core.qchatMedia.emit("memberScreenShareStateChanged",{memberAccId:t.uuid,isSharing:a,operateByAccId:m.uuid})},onMemberVideoMuteChanged:function onMemberVideoMuteChanged(t,a,m){u.logger.log("QChatMedia::addRTCChannelListener::onMemberVideoMuteChanged",t,a),u.core.emit("memberVideoMuteChanged",{memberAccId:t.uuid,mute:a,operateByAccId:m.uuid}),u.core.qchatMedia.emit("memberVideoMuteChanged",{memberAccId:t.uuid,mute:a,operateByAccId:m.uuid})}})},a.enumCameraDevices=function enumCameraDevices(){var t=this;return this._checkConnectState(),this.rtcController.enumCameraDevices().then((function(t){return t.data}),(function(a){throw t.logger.error("QChatMedia::enumCameraDevices error",a),new Xl("QChatMedia::enumCameraDevices error",a)}))},a.enumPlayoutDevices=function enumPlayoutDevices(){var t=this;return this._checkConnectState(),this.rtcController.enumPlayoutDevices().then((function(t){return t.data}),(function(a){throw t.logger.error("QChatMedia::enumPlayoutDevices error",a),new Xl("QChatMedia::enumPlayoutDevices error",a)}))},a.enumRecordDevices=function enumRecordDevices(){var t=this;return this._checkConnectState(),this.rtcController.enumRecordDevices().then((function(t){return t.data}),(function(a){throw t.logger.error("QChatMedia::enumRecordDevices error",a),new Xl("QChatMedia::enumRecordDevices error",a)}))},a.removeRTCChannelListener=function removeRTCChannelListener(){var t,a;this._checkConnectState(),null===(t=this.roomContext)||void 0===t||t.removeRoomListener({}),null===(a=this.authService)||void 0===a||a.removeAuthListener({})},a.setSelectedCameraDevice=function setSelectedCameraDevice(t){var a=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 a.logger.error("QChatMedia::setSelectedCameraDevice error",t),new Xl("QChatMedia::setSelectedCameraDevice error",t)}))},a.setSelectedPlayoutDevice=function setSelectedPlayoutDevice(t){var a=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 a.logger.error("QChatMedia::setSelectedPlayoutDevice error",t),new Xl("QChatMedia::setSelectedPlayoutDevice error",t)}))},a.setSelectedRecordDevice=function setSelectedRecordDevice(t){var a=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 a.logger.error("QChatMedia::setSelectedRecordDevice error",t),new Xl("QChatMedia::setSelectedRecordDevice error",t)}))},a.getRTCMembers=function getRTCMembers(){var t,a;return this._checkConnectState(),map$6(t=filter(a=this.roomContext.remoteMembers).call(a,(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}}))},a.subscribeRemoteVideoSubStream=function subscribeRemoteVideoSubStream(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee24(){return lu.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===(a=this.rtcController)||void 0===a||a.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]])})))},a.unsubscribeRemoteVideoSubStream=function unsubscribeRemoteVideoSubStream(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee25(){return lu.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===(a=this.rtcController)||void 0===a||a.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]])})))},a.muteAllAudio=function muteAllAudio(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee26(){return lu.wrap((function _callee26$(a){for(;;)switch(a.prev=a.next){case 0:return this._checkConnectState(),a.next=3,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneMicrophone"});case 3:if(a.sent){a.next=7;break}return this.logger.error("QChatMedia::connect::auth your have not RTCChannelOpenCloseEveryoneMicrophone auth"),a.abrupt("return");case 7:a.prev=7,null===(t=this.roomContext)||void 0===t||t.updateRoomProperty("audioOff",Vn({value:"offNotAllowSelfOn_"+(new Date).getTime()})),a.next=15;break;case 11:throw a.prev=11,a.t0=a.catch(7),this.logger.error("QChatMedia::muteAllAudio error",a.t0),new Xl("QChatMedia::muteAllAudio error",a.t0);case 15:case"end":return a.stop()}}),_callee26,this,[[7,11]])})))},a.muteAllVideo=function muteAllVideo(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee27(){return lu.wrap((function _callee27$(a){for(;;)switch(a.prev=a.next){case 0:return this._checkConnectState(),a.next=3,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneCamera"});case 3:if(a.sent){a.next=7;break}return this.logger.error("QChatMedia::connect::auth your have not RTCChannelOpenCloseEveryoneCamera auth"),a.abrupt("return");case 7:a.prev=7,null===(t=this.roomContext)||void 0===t||t.updateRoomProperty("videoOff",Vn({value:"offNotAllowSelfOn_"+(new Date).getTime()})),a.next=15;break;case 11:throw a.prev=11,a.t0=a.catch(7),this.logger.error("QChatMedia::muteAllVideo error",a.t0),new Xl("QChatMedia::muteAllVideo error",a.t0);case 15:case"end":return a.stop()}}),_callee27,this,[[7,11]])})))},a.unMuteAllAudio=function unMuteAllAudio(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee28(){return lu.wrap((function _callee28$(a){for(;;)switch(a.prev=a.next){case 0:return this._checkConnectState(),a.next=3,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneMicrophone"});case 3:if(a.sent){a.next=7;break}return this.logger.error("QChatMedia::connect::auth your have not RTCChannelOpenCloseEveryoneMicrophone auth"),a.abrupt("return");case 7:a.prev=7,null===(t=this.roomContext)||void 0===t||t.updateRoomProperty("audioOff",Vn({value:"disable_"+(new Date).getTime()})),a.next=15;break;case 11:throw a.prev=11,a.t0=a.catch(7),this.logger.error("QChatMedia::unMuteAllAudio error",a.t0),new Xl("QChatMedia::unMuteAllAudio error",a.t0);case 15:case"end":return a.stop()}}),_callee28,this,[[7,11]])})))},a.unMuteAllVideo=function unMuteAllVideo(){var t;return __awaiter(this,void 0,void 0,lu.mark((function _callee29(){return lu.wrap((function _callee29$(a){for(;;)switch(a.prev=a.next){case 0:return this._checkConnectState(),a.next=3,this._checkPermission({serverId:this.serverId,channelId:this.channelId,auth:"RTCChannelOpenCloseEveryoneCamera"});case 3:if(a.sent){a.next=7;break}return this.logger.error("QChatMedia::connect::auth your have not RTCChannelOpenCloseEveryoneCamera auth"),a.abrupt("return");case 7:a.prev=7,null===(t=this.roomContext)||void 0===t||t.updateRoomProperty("videoOff",Vn({value:"disable_"+(new Date).getTime()})),a.next=15;break;case 11:throw a.prev=11,a.t0=a.catch(7),this.logger.error("QChatMedia::unMuteAllVideo error",a.t0),new Xl("QChatMedia::unMuteAllVideo error",a.t0);case 15:case"end":return a.stop()}}),_callee29,this,[[7,11]])})))},QChatMediaService}(VI),b_={"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"},E_={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:DI},k_=function getDeserializeTag(){return invertSerializeMap(E_)},R_=function getCmdConfig(){var t=k_();return{qchatSendMsg:{service:"qchatMsg",sid:24,cid:10,params:[{type:"Property",name:"qchatMsg",reflectMapper:E_.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:E_.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:E_.getHistoryMsgTag}],response:[{type:"PropertyArray",name:"qchatMsgs",reflectMapper:t.qchatMsgTag}]},qchatUpdateMessage:{service:"qchatMsg",sid:24,cid:25,params:[{type:"Property",name:"qchatMsgUpdateTag",reflectMapper:E_.qchatMsgUpdateTag},{type:"Property",name:"qchatMsg",reflectMapper:E_.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:E_.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:E_.qchatMsgUpdateTag},{type:"Property",name:"sysMsg",reflectMapper:E_.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:E_.sysMsg}]},qchatMessageSearchByPage:{service:"qchatMsg",sid:24,cid:94,params:[{type:"Property",name:"qchatMessageSearchByPageTag",reflectMapper:E_.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:E_.qchatMsgTag},{type:"Property",name:"getThreadHistoryMsgTag",reflectMapper:E_.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:E_.qchatQuickCommentRequestTag}]},qchatGetQuickComments:{service:"qchatMsg",sid:24,cid:103,params:[{type:"Property",name:"tag",reflectMapper:E_.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:E_.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(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"}(I_||(I_={}));var A_,w_={"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"},N_={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:DI},x_=function getDeserializeTag(){return invertSerializeMap(N_)},O_=function getCmdConfig(){var t=x_();return{qchatCreateServer:{sid:24,cid:31,service:"qchatServer",params:[{type:"Property",name:"serverInfo",reflectMapper:N_.serverInfo},{type:"Property",name:"antispamTag",reflectMapper:N_.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:N_.serverInfo},{type:"Property",name:"antispamTag",reflectMapper:N_.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:N_.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:N_.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:N_.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:N_.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:N_.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:N_.memberInfo},{type:"Property",name:"antispamTag",reflectMapper:N_.antispamTag}],response:[{type:"Property",name:"memberInfo",reflectMapper:t.memberInfo}]},qchatUpdateServerMemberInfo:{sid:24,cid:45,service:"qchatServer",params:[{type:"Property",name:"memberInfo",reflectMapper:N_.otherMemberInfo},{type:"Property",name:"antispamTag",reflectMapper:N_.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:N_.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:N_.updateServerMemberBanTag}]},qchatGetBannedMembersByPage:{sid:24,cid:105,service:"qchatServer",params:[{type:"Property",name:"tag",reflectMapper:N_.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:N_.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:N_.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"}]}}},P_={"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"},L_={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}},V_=function getDeserializeTag(){return invertSerializeMap(L_)},U_=function getCmdConfig(){var t=V_();return{qchatCreateServerRole:{service:"qchatRole",sid:24,cid:61,params:[{type:"Property",name:"serverRole",reflectMapper:L_.serverRole},{type:"Property",name:"antispamTag",reflectMapper:L_.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:L_.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:L_.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:L_.memberRole}],response:[{type:"Property",name:"memberRole",reflectMapper:t.memberRole}]},qchatRemoveMemberRole:{service:"qchatRole",sid:24,cid:70,params:[{type:"Property",name:"memberRole",reflectMapper:L_.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:L_.checkPermissionTag}],response:[{type:"Bool",name:"checked"}]},qchatAddChannelCategoryRole:{service:"qchatRole",sid:24,cid:83,params:[{type:"Property",name:"qchatAddChannelCategoryRoleTag",reflectMapper:L_.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:L_.channelCategoryRole}],response:[{type:"Property",name:"channelCategoryRole",reflectMapper:t.channelCategoryRole}]},qchatGetChannelCategoryRole:{service:"qchatRole",sid:24,cid:86,params:[{type:"Property",name:"qchatGetChannelCategoryRoleTag",reflectMapper:L_.qchatGetChannelCategoryRoleTag}],response:[{type:"PropertyArray",name:"list",reflectMapper:t.channelCategoryRole}]},qchatAddChannelCategoryMemberRole:{service:"qchatRole",sid:24,cid:87,params:[{type:"Property",name:"qchatAddChannelCategoryMemberRoleTag",reflectMapper:L_.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:L_.channelCategoryMemberRole}],response:[{type:"Property",name:"channelCategoryMemberRole",reflectMapper:t.channelCategoryMemberRole}]},qchatGetChannelCategoryMemberRole:{service:"qchatRole",sid:24,cid:90,params:[{type:"Property",name:"qchatGetChannelCategoryMemberRoleTag",reflectMapper:L_.qchatGetChannelCategoryMemberRoleTag}],response:[{type:"PropertyArray",name:"list",reflectMapper:t.channelCategoryMemberRole}]},qchatCheckPermissions:{service:"qchatRole",sid:24,cid:126,params:[{type:"Property",name:"checkPermissionsTag",reflectMapper:L_.checkPermissionsTag}],response:[{type:"PropertyArray",name:"checkPermissionsResult",reflectMapper:{1:"auth",2:"isAllow"}}]}}},D_=["image","audio","video","file"],q_={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:l_},fromClientType:{type:"enum",values:I_},status:{type:"number"},toAccids:{type:"object"},toType:{type:"number"},attach:{type:"object"},pushPayload:{type:"object"}};function generatorSysMsgForCmd(t,a){var u=Ut({},t),m=Ut({type:a||l_.custom},formatReverse(q_,u));return m.serverId&&m.channelId&&m.toAccids?m.toType=4:m.serverId&&m.toAccids?m.toType=3:m.serverId&&m.channelId?m.toType=2:m.serverId?m.toType=1:m.toAccids?m.toType=5:m.toType=0,m}function generatorSysMsgMarkersForCmd(t){var a=pick(t,["msgIdServer","type"]);return formatReverse(q_,a)}var B_=((A_={})[l_.channelUpdateWhiteBlackIdentify]=function(t){var a=BI();return t.notify=formatUpdateWhiteBlackRole(deserialize(t.notify,a.qchatUpdateWhiteBlackRoleTag)),t},A_[l_.channelUpdateWhiteBlackIdentifyUser]=function(t){var a=BI();return t.notify=function formatUpdateWhiteBlackMembers(t){return format(jI,t)}(deserialize(t.notify,a.qchatUpdateWhiteBlackMembersTag)),t},A_[l_.updateQuickComment]=function(t){var a=k_();return t.notify=function formatQuickCommentRequest(t){return format(H_,t)}(deserialize(t.notify,a.qchatQuickCommentRequestTag)),t},A_[l_.channelCategoryCreate]=function(t){var a=BI();return t.categoryInfo=formatChannelCategory(deserialize(t.categoryInfo,a.QChatChannelCategoryInfo)),t},A_[l_.channelCategoryUpdate]=function(t){var a=BI();return t.categoryInfo=formatChannelCategory(deserialize(t.categoryInfo,a.QChatChannelCategoryInfo)),t},A_[l_.channelCategoryUpdateWhiteBlackIdentify]=function(t){var a=BI();return t.notify=formatUpdateWhiteBlackRole(deserialize(t.notify,a.qchatUpdateChannelCategoryWhiteBlackRoleTag)),t},A_[l_.channelCategoryUpdateWhiteBlackIdentifyUser]=function(t){var a=BI();return t.notify=formatUpdateWhiteBlackRole(deserialize(t.notify,a.qchatUpdateChannelCategoryWhiteBlackMembersTag)),t},A_[l_.serverIdentifyAdd]=function(t){var a=V_();return t.serverIdentifyInfo=formatRole(deserialize(t.serverIdentifyInfo,a.serverRole)),t},A_[l_.serverIdentifyRemove]=function(t){var a=V_();return t.serverIdentifyInfo=formatRole(deserialize(t.serverIdentifyInfo,a.serverRole)),t},A_[l_.serverIdentifyUpdate]=function(t){var a=V_();return t.serverIdentifyInfo=formatRole(deserialize(t.serverIdentifyInfo,a.serverRole)),t},A_[l_.channelIdentifyUpdate]=function(t){var a=V_();return t.channelIdentifyInfo=formatRole(deserialize(t.channelIdentifyInfo,a.channelRole)),t},A_[l_.userIdentifyUpdate]=function(t){var a=V_();return t.userIdentifyInfo=formatRole(deserialize(t.userIdentifyInfo,a.memberRole)),t},A_[l_.myMemberInfoUpdated]=function(t){var a,u=get(t,"userInfo.name"),m=get(t,"userInfo.icon");return t.updatedInfos=map$6(a=t.reuseServers).call(a,(function(t){var a={serverId:t.serverId};return 1==(1&t.bits)&&"string"==typeof u&&Ut(a,{nickChanged:!0,nick:u}),2==(2&t.bits)&&"string"==typeof m&&Ut(a,{avatarChanged:!0,avatar:m}),a})),delete t.userInfo,delete t.reuseServers,t},A_);function formatSystemNotification(t,a){var u=format(q_,t);if(!u.attach)return u;var m=x_(),h=BI();if(u.attach.serverInfo&&(u.attach.serverInfo=formatServer(deserialize(u.attach.serverInfo,m.serverInfo))),u.attach.channelInfo&&(u.attach.channelInfo=formatChannel(deserialize(u.attach.channelInfo,h.channelInfo))),u.attach.serverMember&&(u.attach.serverMember=formatMember$1(deserialize(u.attach.serverMember,m.memberInfo))),B_[u.attach.type]&&(u.attach=B_[u.attach.type](u.attach)),u.attach.updateAuths)try{u.attach.updateAuths=formatRoleAuths(JSON.parse(u.attach.updateAuths))}catch(t){a.error("formatSystemNotification:JSON parse updateAuths error: ",t)}return u.attach.type&&(u.attach.rawType=u.attach.type,u.attach.type=l_[u.attach.type]),u}var F_={type:{type:"enum",values:i_},fromClientType:{type:"enum",values:I_},status:{type:"number"},resendFlag:{type:"boolean"},mentionAll:{type:"boolean"},notifyReason:{type:"enum",values:s_},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 a=__rest(t,["onSendBefore","onUploadStart","onUploadDone","onUploadProgress"]),u=formatReverse(F_,a);if(u.msgIdClient=t.resendFlag?t.msgIdClient:Gu(),!u.msgIdClient)throw new Ql("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:I_},pushPayload:{type:"object"}},t)}function formatMsg(t,a,u){var m,h;return void 0===a&&(a={}),__awaiter(this,void 0,void 0,lu.mark((function _callee(){var g,M,I,S;return lu.wrap((function _callee$(T){for(;;)switch(T.prev=T.next){case 0:return(g=format(F_,t)).deliveryStatus=a.deliveryStatus?o_[a.deliveryStatus]:o_[o_.success],a.time&&(g.time=a.time),M=k_(),g.updateContent&&(I=format({status:{type:"number"}},I=deserialize(I=JSON.parse(g.updateContent),M.qchatMsgTag)),g.updateContent=I),g.updateOperatorInfo&&(S=formatMsgOperatorInfo(deserialize(S=JSON.parse(g.updateOperatorInfo),M.qchatMsgUpdateTag)),g.updateOperatorInfo=S),""===(null===(m=null==g?void 0:g.threadRefer)||void 0===m?void 0:m.fromAccount)&&delete g.threadRefer,""===(null===(h=null==g?void 0:g.replyRefer)||void 0===h?void 0:h.fromAccount)&&delete g.replyRefer,g.attach&&a.attachUrl&&(g.attach.url=a.attachUrl),T.next=11,formatMsgAttach(g,u);case 11:return T.abrupt("return",T.sent);case 12:case"end":return T.stop()}}),_callee)})))}function formatMsgAttach(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u;return lu.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:if(includes(D_).call(D_,t.type)&&t.attach&&t.attach.url){m.next=2;break}return m.abrupt("return",t);case 2:if(a&&a.cloudStorage&&"function"==typeof a.cloudStorage.getPrivateUrl&&"function"==typeof a.cloudStorage.getOriginUrl){m.next=4;break}return m.abrupt("return",t);case 4:if(!(indexOf(u=t.attach.url).call(u,"_im_url=1")<0)){m.next=7;break}return t.attach.url=a.cloudStorage.getPrivateUrl(t.attach.url),m.abrupt("return",t);case 7:return m.prev=7,m.next=10,a.cloudStorage.getOriginUrl(t.attach.url);case 10:t.attach.url=m.sent,m.next=16;break;case 13:throw m.prev=13,m.t0=m.catch(7),new Ql('url "'+t.attach.url+'" parse error',"message.attach.url","parse error");case 16:return m.abrupt("return",t);case 17:case"end":return m.stop()}}),_callee2,null,[[7,13]])})))}function formatMsgs(t,a,u){return void 0===a&&(a={}),__awaiter(this,void 0,void 0,lu.mark((function _callee3(){var m;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:if(Un(t)&&t.length>0){h.next=2;break}return h.abrupt("return",[]);case 2:return m=map$6(t).call(t,(function(t){return formatMsg(t,a,u)})),h.next=5,$i.all(m);case 5:return h.abrupt("return",h.sent);case 6:case"end":return h.stop()}}),_callee3)})))}var G_={totalCount:{type:"number"},lastUpdateTime:{type:"number"},details:{type:"object"}};function formatQuickComments(t){var a=map$6(t).call(t,(function(t){var a,u=format(G_,t);return u.details=map$6(a=u.details).call(a,(function(t){var a=t.createTime?Bu(t.createTime):0;return a=isNaN(a)?0:a,{count:t.count,hasSelf:t.self,severalAccids:t.topN,type:t.type,createTime:a}})),u})),u={};return forEach$1(a).call(a,(function(t){return u[t.msgIdServer]=t})),u}var H_={type:{type:"number"},time:{type:"number"},opeType:{type:"number"}};var j_={includeSelf:{type:"number"},order:{type:"enum",values:xI},sort:{type:"enum",values:a_},msgTypes:{type:"object"},subTypes:{type:"object"}};var $_={hasMore:{type:"boolean"},nextTimetag:{type:"number"},cursor:{type:"string"}};var z_={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 a=get(t,"attach.addAccids");return a&&includes(a).call(a,this.core.account)&&this.core.eventBus.emit("qchatChannel/serverIdentifyChange",t),!0},27:function _(t){var a=get(t,"attach.deleteAccids");return a&&includes(a).call(a,this.core.account)&&this.core.eventBus.emit("qchatChannel/serverIdentifyChange",t),!0},31:function _(t){var a,u;return 1===t.attach.event?(null===(u=null===(a=this.core.qchatChannel)||void 0===a?void 0:a.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 a,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===(a=this.core.qchatChannel)||void 0===a?void 0:a.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 a=pick(t,["serverId","channelId","ext","fromAccount","fromNick","time"]);return this.logger.log("qchat on recvTypingEvent: ",a),this.core.emit("recvTypingEvent",a),this.core.qchatMsg.emit("recvTypingEvent",a),!1}},W_=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,lu.mark((function _callee(){var a,u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.core.sendCmd("qchatSendCustomSysMsg",{sysMsg:generatorSysMsgForCmd(t)});case 2:return a=m.sent,u=formatSystemNotification(a.content.sysMsg,this.logger),this.logger.getDebugMode()?this.logger.debug("sendCustomSysMsg success",u):this.logger.log("sendCustomSysMsg success",u.serverId,u.channelId,u.msgIdServer),m.abrupt("return",u);case 6:case"end":return m.stop()}}),_callee,this)})))},t.updateSystemNotification=function updateSystemNotification(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u,m,h,g;return lu.wrap((function _callee2$(M){for(;;)switch(M.prev=M.next){case 0:return a=t.systemNotification,u=__rest(t,["systemNotification"]),m=pick(a,["msgIdServer","type","body","ext","status"]),h=generatorSysMsgForCmd(m),M.next=5,this.core.sendCmd("qchatUpdateSystemNotification",{sysMsg:h,qchatMsgUpdateTag:Ut(Ut({},u),{operatorAccount:this.core.account,operatorClientType:I_.Web,pushPayload:Vn(t.pushPayload),routeEnable:ap.boolean(t,"routeEnable")})});case 5:return g=M.sent,M.abrupt("return",formatSystemNotification(g.content.sysMsg,this.logger));case 7:case"end":return M.stop()}}),_callee2,this)})))},t.markSystemNotificationsRead=function markSystemNotificationsRead(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.core.sendCmd("qchatMarkSysMsgRead",{sysMsgs:map$6(a=t.systemNotifications).call(a,(function(t){return generatorSysMsgMarkersForCmd(t)}))});case 2:case"end":return u.stop()}}),_callee3,this)})))},t.onSysMsg=function onSysMsg(t){var a=t.content.sysMsg;if(a){var u=formatSystemNotification(a,this.core.logger),m=z_[l_[u.type]];if(m)if(!1===m.call(this,u))return;var h={feature:"default",systemNotifications:[u]};this.logger.log("qchat on systemNotification: ",h),this.core.emit("systemNotification",h),this.core.qchatMsg.emit("systemNotification",h)}else this.core.logger.warn("No sysMsg in onSysMsg packet")},t.onMultiSysMsg=function onMultiSysMsg(t){var a=t.content.sysMsg;if(a){var u=formatSystemNotification(a,this.logger);this.core.emit("systemNotificationUpdate",u),this.core.qchatMsg.emit("systemNotificationUpdate",u)}},t.onSyncSysMsg=function onSyncSysMsg(t){var a=this,u=t.content.systemNotifications;if(u&&u.length>0){var m=map$6(u).call(u,(function(t){return formatSystemNotification(t,a.logger)}));this.core.emit("systemNotification",{feature:"sync",systemNotifications:m}),this.core.qchatMsg.emit("systemNotification",{feature:"sync",systemNotifications:m})}else this.logger.warn("sync system notification not exist")},NotificationModuleService}(),K_=["image","audio","video","file"],Y_=function(){function MessageModuleService(t){var a=this;this.markMessageRead=throttle((function(t){return __awaiter(a,void 0,void 0,lu.mark((function _callee(){var a,u;return lu.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.core.sendCmd("qchatMarkMessageRead",{markMsgReadTag:t});case 2:a=m.sent,u=formatUnreadInfo(a.content.unreadInfo),this.core.eventBus.emit("qchatChannel/updateUnreads",[u]);case 5:case"end":return m.stop()}}),_callee,this)})))}),200),this.core=t,this.logger=t.logger}var t=MessageModuleService.prototype;return t.sendMessage=function sendMessage(t){var a,u,m,h;return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var g,M,I,S,T,C;return lu.wrap((function _callee2$(b){for(;;)switch(b.prev=b.next){case 0:if(!(indexOf(K_).call(K_,t.type)>-1)){b.next=4;break}return b.next=3,this.doSendFile(t);case 3:t.attach=b.sent;case 4:return g=generatorMsgForCmd(Ut({fromAccount:this.core.account},t)),b.next=7,formatMsg(g,{time:(new Date).getTime(),deliveryStatus:o_.sending},this.core);case 7:M=b.sent;try{t.onSendBefore&&t.onSendBefore(M)}catch(t){this.logger.error("sendMsg: options.onSendBefore error",t)}return b.prev=9,b.next=12,this.core.sendCmd("qchatSendMsg",{qchatMsg:g});case 12:I=b.sent,b.next=22;break;case 15:return b.prev=15,b.t0=b.catch(9),b.next=19,formatMsg(g,{time:(new Date).getTime(),deliveryStatus:o_.failed,attachUrl:null===(a=M.attach)||void 0===a?void 0:a.url},this.core);case 19:throw S=b.sent,b.t0.msg=S,b.t0;case 22:return T=I.content,b.next=25,formatMsg(Ut({},T.qchatMsg),{deliveryStatus:o_.success,attachUrl:null===(u=M.attach)||void 0===u?void 0:u.url},this.core);case 25:if(!(C=b.sent).isAntispam){b.next=29;break}throw{code:10403,msg:C,message:(null===(m=null==C?void 0:C.antiSpamInfo)||void 0===m?void 0:m.yidunAntiSpamRes)||"message has be antispam",isAntispam:!0,yidunAntiSpamRes:(null===(h=null==C?void 0:C.antiSpamInfo)||void 0===h?void 0:h.yidunAntiSpamRes)||""};case 29:return b.abrupt("return",C);case 30:case"end":return b.stop()}}),_callee2,this,[[9,15]])})))},t.doSendFile=function doSendFile(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.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),a=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:a=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",a);case 16:case"end":return u.stop()}}),_callee3,this,[[5,11]])})))},t.resendMessage=function resendMessage(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var m,h,g,M,I;return lu.wrap((function _callee4$(S){for(;;)switch(S.prev=S.next){case 0:return(m=generatorMsgForCmd(Ut(Ut({},t),{resendFlag:!0}))).deliveryStatus=o_.sending,S.prev=2,S.next=5,this.core.sendCmd("qchatSendMsg",{qchatMsg:m});case 5:h=S.sent,S.next=15;break;case 8:return S.prev=8,S.t0=S.catch(2),S.next=12,formatMsg(m,{time:(new Date).getTime(),deliveryStatus:o_.failed},this.core);case 12:throw g=S.sent,S.t0.msg=g,S.t0;case 15:return M=h.content,S.next=18,formatMsg(Ut({},M.qchatMsg),{deliveryStatus:o_.success},this.core);case 18:if(!(I=S.sent).isAntispam){S.next=22;break}throw{code:10403,msg:I,message:(null===(a=null==I?void 0:I.antiSpamInfo)||void 0===a?void 0:a.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 S.abrupt("return",I);case 23:case"end":return S.stop()}}),_callee4,this,[[2,8]])})))},t.doUpdateMessage=function doUpdateMessage(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var m,h,g,M,I;return lu.wrap((function _callee5$(S){for(;;)switch(S.prev=S.next){case 0:return m=t.message,h=__rest(t,["message"]),(g=generatorMsgForCmd(m)).msgIdClient=void 0,g.time=m.time,S.next=6,this.core.sendCmd("qchatUpdateMessage",{qchatMsg:g,qchatMsgUpdateTag:Ut(Ut({},h),{operatorAccount:this.core.account,operatorClientType:I_.Web,pushPayload:Vn(t.pushPayload),routeEnable:ap.boolean(t,"routeEnable")})});case 6:return M=S.sent,S.next=9,formatMsg(M.content.qchatMsg,{},this.core);case 9:if(I=S.sent,this.core.eventBus.emit("qchatChannel/changeUnread",I,!0),!M.content.qchatMsg.isAntispam){S.next=14;break}throw{code:10403,msg:g,message:(null===(a=M.content.qchatMsg)||void 0===a?void 0:a.yidunAntiSpamRes)||"message has be antispam",isAntispam:!0,yidunAntiSpamRes:(null===(u=M.content.qchatMsg)||void 0===u?void 0:u.yidunAntiSpamRes)||""};case 14:return S.abrupt("return",I);case 15:case"end":return S.stop()}}),_callee5,this)})))},t.getHistoryMessage=function getHistoryMessage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var a,u,m,h=this;return lu.wrap((function _callee6$(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,this.core.sendCmd("qchatGetHistoryMsg",{getHistoryMsgTag:Ut(Ut({},t),{reverse:reverse$1(t)?1:0})});case 2:return u=g.sent,m=u.content,g.next=6,$i.all(map$6(a=m.qchatMsgs).call(a,(function(t){return formatMsg(t,{},h.core)})));case 6:return g.abrupt("return",g.sent);case 7:case"end":return g.stop()}}),_callee6,this)})))},t.getMentionedMeMessages=function getMentionedMeMessages(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var a,u,m,h,g,M=this;return lu.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,m=u.content,S=m.page,h=format($_,S),I.next=7,$i.all(map$6(a=m.datas).call(a,(function(t){return formatMsg(t,{},M.core)})));case 7:return g=I.sent,I.abrupt("return",{pageInfo:h,messages:g});case 9:case"end":return I.stop()}var S}),_callee7,this)})))},t.areMentionedMeMessages=function areMentionedMeMessages(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a,u,m;return lu.wrap((function _callee8$(h){for(;;)switch(h.prev=h.next){case 0:a={},u=0;case 2:if(!(u<t.length)){h.next=13;break}if((m=t[u]).fromAccount!==this.core.account){h.next=7;break}return a[m.msgIdClient]=!1,h.abrupt("continue",10);case 7:return h.next=9,this.core.qchatChannel.subscribeModuleService.getMentionedFlag(m,!0);case 9:a[m.msgIdClient]=h.sent;case 10:u++,h.next=2;break;case 13:return h.abrupt("return",a);case 14:case"end":return h.stop()}}),_callee8,this)})))},t.getLastMessageOfChannels=function getLastMessageOfChannels(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var a,u,m;return lu.wrap((function _callee9$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.core.sendCmd("qchatGetLastMessageOfChannels",{tag:t});case 2:return a=h.sent,u=a.content.msgs,h.next=6,formatMsgs(u,{},this.core);case 6:return m=h.sent,h.abrupt("return",reduce(m).call(m,(function(t,a){return t[a.channelId]=a,t}),{}));case 8:case"end":return h.stop()}}),_callee9,this)})))},t.messageSearchByPage=function messageSearchByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){var a,u,m,h,g;return lu.wrap((function _callee10$(M){for(;;)switch(M.prev=M.next){case 0:return M.next=2,this.core.sendCmd("qchatMessageSearchByPage",{qchatMessageSearchByPageTag:Ut(Ut({},(I=t,formatReverse(j_,I))),{includeSelf:t.includeSelf?1:""})});case 2:return a=M.sent,u=a.content,m=u.datas,h=u.listQueryTag,M.next=6,formatMsgs(m,{},this.core);case 6:return g=M.sent,M.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:h.nextTimetag?Bu(h.nextTimetag):0,cursor:h.cursor},datas:g});case 8:case"end":return M.stop()}var I}),_callee10,this)})))},t.onMsg=function onMsg(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){var a,u;return lu.wrap((function _callee11$(m){for(;;)switch(m.prev=m.next){case 0:if(a=t.content.qchatMsg){m.next=4;break}return this.logger.warn("No qchatMsg in qchatMsg packet"),m.abrupt("return");case 4:return m.next=6,formatMsg(a,{},this.core);case 6:u=m.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 m.stop()}}),_callee11,this)})))},t.onRecvUnreadInfo=function onRecvUnreadInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){var a,u;return lu.wrap((function _callee12$(m){for(;;)switch(m.prev=m.next){case 0:if(a=t.content.qchatMsg){m.next=3;break}return m.abrupt("return");case 3:return m.next=5,formatMsg(a);case 5:u=m.sent,this.core.eventBus.emit("qchatChannel/changeUnread",u,!1);case 7:case"end":return m.stop()}}),_callee12,this)})))},t.onMultiSyncRead=function onMultiSyncRead(t){var a=t.content.unreadInfo;if(a){var u=formatUnreadInfo(a);this.core.eventBus.emit("qchatChannel/updateUnreads",[u])}},t.onMultiSyncServersRead=function onMultiSyncServersRead(t){var a=t.content.qchatMultiSyncServersMessageReadTag;if(a){var u=formatClearServersUnread(a),m=u.successServerIds,h=u.ackTimestamp;this.core.eventBus.emit("qchatChannel/clearUnreadCountByServers",m,h)}},t.onRecvMsgUpdate=function onRecvMsgUpdate(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){var a,u,m,h;return lu.wrap((function _callee13$(g){for(;;)switch(g.prev=g.next){case 0:if(a=t.content.qchatMsg,u=t.content.qchatMsgUpdateInfo,a){g.next=4;break}return g.abrupt("return");case 4:return g.next=6,formatMsg(a,{},this.core);case 6:m=g.sent,h=formatMsgOperatorInfo(u),this.core.eventBus.emit("qchatChannel/changeUnread",m,!0),this.core.emit("messageUpdate",m,h),this.core.qchatMsg.emit("messageUpdate",m,h);case 11:case"end":return g.stop()}}),_callee13,this)})))},MessageModuleService}(),Q_=function(){function ExtendModuleService(t){var a=this;this._sendTypingEvent=throttle((function(t){return __awaiter(a,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.core.sendCmd("qchatSendCustomSysMsg",{sysMsg:generatorSysMsgForCmd(Ut(Ut({},t),{resendFlag:!1,persistEnable:!1,routeEnable:!1,pushEnable:!1,needBadge:!1,needPushNick:!1}),l_.msgTyping)});case 2:case"end":return a.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,lu.mark((function _callee2(){var a,u;return lu.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.core.sendCmd("qchatGetMessageHistoryByIds",{channelInfo:{serverId:t.serverId,channelId:t.channelId},messageReferList:t.messageReferList});case 2:return u=m.sent,m.abrupt("return",$i.all(map$6(a=u.content.qchatMsgs).call(a,(function(t){return formatMsg(t)}))));case 4:case"end":return m.stop()}}),_callee2,this)})))},t.getReferMessages=function getReferMessages(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var m;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:if((null===(a=t.message.replyRefer)||void 0===a?void 0:a.msgIdServer)&&(null===(u=t.message.threadRefer)||void 0===u?void 0:u.msgIdServer)){h.next=2;break}throw new Error("Message has no reply");case 2:return h.next=4,this.getMessageHistoryByIds({serverId:t.message.serverId,channelId:t.message.channelId,messageReferList:[t.message.replyRefer,t.message.threadRefer]});case 4:if(m=h.sent,t.referType!==u_[u_.all]){h.next=9;break}return h.abrupt("return",{replyMessage:m[0],threadMessage:m[1]});case 9:if(t.referType!==u_[u_.reply]){h.next=13;break}return h.abrupt("return",{replyMessage:m[0]});case 13:if(t.referType!==u_[u_.thread]){h.next=15;break}return h.abrupt("return",{threadMessage:m[1]});case 15:return h.abrupt("return",{replyMessage:m[0],threadMessage:m[1]});case 16:case"end":return h.stop()}}),_callee3,this)})))},t.getThreadMessages=function getThreadMessages(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var u,m,h,g,M;return lu.wrap((function _callee4$(I){for(;;)switch(I.prev=I.next){case 0:return m=(null===(a=t.message.threadRefer)||void 0===a?void 0:a.msgIdServer)?Ut({serverId:t.message.serverId,channelId:t.message.channelId},t.message.threadRefer):t.message,I.next=3,this.core.sendCmd("qchatGetThreadMessages",{qchatMsg:m,getThreadHistoryMsgTag:Ut(Ut({},t.messageQueryOption),{reverse:ap.boolean(t.messageQueryOption,"reverse")})});case 3:return h=I.sent,I.next=6,formatMsg(h.content.thread);case 6:return g=I.sent,I.next=9,$i.all(map$6(u=h.content.qchatMsgs).call(u,(function(t){return formatMsg(t)})));case 9:return M=I.sent,I.abrupt("return",{thread:g,threadInfo:{messageCount:+h.content.threadInfo.messageCount,lastMessageTimestamp:+h.content.threadInfo.lastMessageTimestamp},messages:M});case 11:case"end":return I.stop()}}),_callee4,this)})))},t.getThreadRootMessagesMeta=function getThreadRootMessagesMeta(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a,u,m,h;return lu.wrap((function _callee5$(g){for(;;)switch(g.prev=g.next){case 0:return a=t.threadRootMessages,u=__rest(t,["threadRootMessages"]),g.next=3,this.core.sendCmd("qchatGetThreadRootMessagesMeta",{qchatMsgs:a,tag:u});case 3:if(m=g.sent,!((h=m.content.metas)&&h.length>0)){g.next=7;break}return g.abrupt("return",map$6(h).call(h,(function(t){return Ut(Ut({},t),{total:Bu(t.total),timestamp:Bu(t.timestamp),msgTime:Bu(t.msgTime)})})));case 7:return g.abrupt("return",[]);case 8:case"end":return g.stop()}}),_callee5,this)})))},t.getQuickComments=function getQuickComments(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var a,u,m;return lu.wrap((function _callee6$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.core.sendCmd("qchatGetQuickComments",{tag:{serverId:t.serverId,channelId:t.channelId,msgIdServerList:Vn(map$6(a=t.msgList).call(a,(function(t){return t.msgIdServer})))}});case 2:return u=h.sent,m=u.content.quickCommentResponse,h.abrupt("return",formatQuickComments(m));case 5:case"end":return h.stop()}}),_callee6,this)})))},t.updateQuickComment=function updateQuickComment(t,a){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var u,m,h,g,M,I;return lu.wrap((function _callee7$(S){for(;;)switch(S.prev=S.next){case 0:return validate({type:{type:"number"},commentMessage:{type:"object",rules:{msgIdServer:{type:"string",allowEmpty:!1}}}},t),u=t.commentMessage,m=u.serverId,h=u.channelId,g=u.fromAccount,M=u.msgIdServer,I=u.time,S.next=4,this.core.sendCmd("qchatUpdateQuickComment",{tag:{serverId:m,channelId:h,fromAccount:g,msgIdServer:M,time:I,type:t.type,opeType:a,opeAccid:this.core.account}});case 4:case"end":return S.stop()}}),_callee7,this)})))},t.sendTypingEvent=function sendTypingEvent(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){return lu.wrap((function _callee8$(a){for(;;)switch(a.prev=a.next){case 0:if(t.channelId!==this.lastChannelIdInTyping){a.next=4;break}return this.logger.log("qchatMsg sendTypingEvent throttle"),this._sendTypingEvent(t),a.abrupt("return");case 4:this.lastChannelIdInTyping=t.channelId,this._sendTypingEvent.flush(),this._sendTypingEvent(t);case 7:case"end":return a.stop()}}),_callee8,this)})))},ExtendModuleService}(),J_=function(t){function QChatMsgService(a){var u;return(u=t.call(this,"qchatMsg",a)||this).core=a,u.lastChannelIdInMark="",registerParser({cmdMap:b_,cmdConfig:R_()}),u.notificationModuleService=new W_(a),u.messageModuleService=new Y_(a),u.extendModuleService=new Q_(a),u}wt(QChatMsgService,t);var a=QChatMsgService.prototype;return a.sendMessage=function sendMessage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(i_)},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),a.next=3,this.messageModuleService.sendMessage(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee,this)})))},a.updateMessage=function updateMessage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.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)){a.next=3;break}throw new Xl("Status should be greater than or equal to 10000");case 3:return a.next=5,this.messageModuleService.doUpdateMessage(t);case 5:return a.abrupt("return",a.sent);case 6:case"end":return a.stop()}}),_callee2,this)})))},a.resendMessage=function resendMessage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){return lu.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},msgIdClient:{type:"string",allowEmpty:!1}},t),a.next=3,this.messageModuleService.resendMessage(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee3,this)})))},a.deleteMessage=function deleteMessage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a;return lu.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),(a=JSON.parse(Vn(t))).message.status=2,u.next=5,this.messageModuleService.doUpdateMessage(a);case 5:return u.abrupt("return",u.sent);case 6:case"end":return u.stop()}}),_callee4,this)})))},a.revokeMessage=function revokeMessage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a;return lu.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),(a=JSON.parse(Vn(t))).message=pick(a.message,["serverId","channelId","msgIdServer","time"]),a.message.status=1,u.next=6,this.messageModuleService.doUpdateMessage(a);case 6:return u.abrupt("return",u.sent);case 7:case"end":return u.stop()}}),_callee5,this)})))},a.markMessageRead=function markMessageRead(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){return lu.wrap((function _callee6$(a){for(;;)switch(a.prev=a.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 a.stop()}}),_callee6,this)})))},a.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)},a.getMessageHistoryByIds=function getMessageHistoryByIds(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.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),a.next=3,this.extendModuleService.getMessageHistoryByIds(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee7,this)})))},a.getReferMessages=function getReferMessages(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){return lu.wrap((function _callee8$(a){for(;;)switch(a.prev=a.next){case 0:return validate({message:{type:"object",rules:{msgIdServer:{type:"string",allowEmpty:!1},time:{type:"number"}}},referType:{type:"enum",values:getEnumKeys(u_),required:!1}},t),a.next=3,this.extendModuleService.getReferMessages(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee8,this)})))},a.getThreadMessages=function getThreadMessages(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){return lu.wrap((function _callee9$(a){for(;;)switch(a.prev=a.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),a.next=3,this.extendModuleService.getThreadMessages(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee9,this)})))},a.getThreadRootMessagesMeta=function getThreadRootMessagesMeta(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){return lu.wrap((function _callee10$(a){for(;;)switch(a.prev=a.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),a.next=3,this.extendModuleService.getThreadRootMessagesMeta(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee10,this)})))},a.sendSystemNotification=function sendSystemNotification(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){return lu.wrap((function _callee11$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1,required:!1},attach:{type:"object",required:!1}},t),a.next=3,this.notificationModuleService.sendSystemNotification(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee11,this)})))},a.updateSystemNotification=function updateSystemNotification(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){return lu.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:return validate({systemNotification:{type:"object",rules:{msgIdServer:{type:"string",allowEmpty:!1},type:{type:"enum",values:getEnumKeys(l_)},body:{type:"string",required:!1},ext:{type:"string",required:!1},status:{type:"number",required:!1}}}},t),a.next=3,this.notificationModuleService.updateSystemNotification(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee12,this)})))},a.markSystemNotificationsRead=function markSystemNotificationsRead(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){return lu.wrap((function _callee13$(a){for(;;)switch(a.prev=a.next){case 0:return validate({systemNotifications:{type:"array",rules:{msgIdServer:{type:"string",allowEmpty:!1},type:{type:"string",allowEmpty:!1}},min:1}},t),a.next=3,this.notificationModuleService.markSystemNotificationsRead(t);case 3:case"end":return a.stop()}}),_callee13,this)})))},a.getHistoryMessage=function getHistoryMessage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){return lu.wrap((function _callee14$(a){for(;;)switch(a.prev=a.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),a.next=3,this.messageModuleService.getHistoryMessage(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee14,this)})))},a.getMentionedMeMessages=function getMentionedMeMessages(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){return lu.wrap((function _callee15$(a){for(;;)switch(a.prev=a.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),a.next=3,this.messageModuleService.getMentionedMeMessages(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee15,this)})))},a.areMentionedMeMessages=function areMentionedMeMessages(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var a;return lu.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(a=t.messages).call(a,(function(a){return t.messages[0].serverId===a.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)})))},a.addQuickComment=function addQuickComment(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee17(){return lu.wrap((function _callee17$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.extendModuleService.updateQuickComment(t,1);case 2:case"end":return a.stop()}}),_callee17,this)})))},a.removeQuickComment=function removeQuickComment(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee18(){return lu.wrap((function _callee18$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.extendModuleService.updateQuickComment(t,2);case 2:case"end":return a.stop()}}),_callee18,this)})))},a.getQuickComments=function getQuickComments(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee19(){return lu.wrap((function _callee19$(a){for(;;)switch(a.prev=a.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),a.next=3,this.extendModuleService.getQuickComments(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee19,this)})))},a.sendTypingEvent=function sendTypingEvent(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee20(){return lu.wrap((function _callee20$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),a.next=3,this.extendModuleService.sendTypingEvent(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee20,this)})))},a.getLastMessageOfChannels=function getLastMessageOfChannels(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee21(){return lu.wrap((function _callee21$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelIdList:{type:"array",itemType:"string"}},t),a.next=3,this.messageModuleService.getLastMessageOfChannels(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee21,this)})))},a.qchatOnMsgHandler=function qchatOnMsgHandler(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee22(){return lu.wrap((function _callee22$(a){for(;;)switch(a.prev=a.next){case 0:this.messageModuleService.onMsg(t);case 1:case"end":return a.stop()}}),_callee22,this)})))},a.qchatOnRecvUnreadInfoHandler=function qchatOnRecvUnreadInfoHandler(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee23(){return lu.wrap((function _callee23$(a){for(;;)switch(a.prev=a.next){case 0:this.messageModuleService.onRecvUnreadInfo(t);case 1:case"end":return a.stop()}}),_callee23,this)})))},a.qchatOnSysMsgHandler=function qchatOnSysMsgHandler(t){this.notificationModuleService.onSysMsg(t)},a.qchatMultiSyncMessageReadHandler=function qchatMultiSyncMessageReadHandler(t){this.messageModuleService.onMultiSyncRead(t)},a.qchatMultiSyncSystemNotificationUpdateHandler=function qchatMultiSyncSystemNotificationUpdateHandler(t){this.notificationModuleService.onMultiSysMsg(t)},a.qchatSyncSystemNotificationHandler=function qchatSyncSystemNotificationHandler(t){this.notificationModuleService.onSyncSysMsg(t)},a.qchatRecvMessageUpdateHandler=function qchatRecvMessageUpdateHandler(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee24(){return lu.wrap((function _callee24$(a){for(;;)switch(a.prev=a.next){case 0:this.messageModuleService.onRecvMsgUpdate(t);case 1:case"end":return a.stop()}}),_callee24,this)})))},a.searchMsgByPage=function searchMsgByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee25(){return lu.wrap((function _callee25$(a){for(;;)switch(a.prev=a.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(xI),required:!1},limit:{type:"number",min:0,required:!1},sort:{type:"enum",values:getEnumKeys(a_),required:!1},cursor:{type:"string",allowEmpty:!1,required:!1}},t),a.next=3,this.messageModuleService.messageSearchByPage(t);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop()}}),_callee25,this)})))},a.qchatMultiSyncServersMessageReadHandler=function qchatMultiSyncServersMessageReadHandler(t){this.messageModuleService.onMultiSyncServersRead(t)},QChatMsgService}(VI),X_=function(){function CategoryModuleService(t){this.core=t}var t=CategoryModuleService.prototype;return t.addChannelCategoryRole=function addChannelCategoryRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.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 a=u.sent,u.abrupt("return",formatChannelCategoryRole(a.content.channelCategoryRole));case 5:case"end":return u.stop()}}),_callee,this)})))},t.removeChannelCategoryRole=function removeChannelCategoryRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("qchatRemoveChannelCategoryRole",t);case 3:case"end":return a.stop()}}),_callee2,this)})))},t.updateChannelCategoryRole=function updateChannelCategoryRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.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!==(a=u.sent).raw.code){u.next=6;break}throw new Xl("No update required",{},406);case 6:return u.abrupt("return",formatChannelCategoryRole(a.content.channelCategoryRole));case 7:case"end":return u.stop()}}),_callee3,this)})))},t.getChannelCategoryRole=function getChannelCategoryRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a;return lu.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 a=u.sent,u.abrupt("return",(m=a.content.list,Un(m)&&m.length>0?map$6(m).call(m,(function(t){return formatChannelCategoryRole(t)})):[]));case 5:case"end":return u.stop()}var m}),_callee4,this)})))},t.addChannelCategoryMemberRole=function addChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a;return lu.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 a=u.sent,u.abrupt("return",formatChannelCategoryMemberRole(a.content.channelCategoryMemberRole));case 5:case"end":return u.stop()}}),_callee5,this)})))},t.removeChannelCategoryMemberRole=function removeChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){return lu.wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},categoryId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("qchatRemoveChannelCategoryMemberRole",t);case 3:case"end":return a.stop()}}),_callee6,this)})))},t.updateChannelCategoryMemberRole=function updateChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){var a;return lu.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!==(a=u.sent).raw.code){u.next=6;break}throw new Xl("No update required",{},406);case 6:return u.abrupt("return",formatChannelCategoryMemberRole(a.content.channelCategoryMemberRole));case 7:case"end":return u.stop()}}),_callee7,this)})))},t.getChannelCategoryMemberRole=function getChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a;return lu.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 a=u.sent,u.abrupt("return",(m=a.content.list,Un(m)&&m.length>0?map$6(m).call(m,(function(t){return formatChannelCategoryMemberRole(t)})):[]));case 5:case"end":return u.stop()}var m}),_callee8,this)})))},CategoryModuleService}(),Z_=function(t){function QChatRoleService(a){var u;return(u=t.call(this,"qchatRole",a)||this).core=a,registerParser({cmdMap:P_,cmdConfig:U_()}),u.category=new X_(a),u}wt(QChatRoleService,t);var a=QChatRoleService.prototype;return a.createServerRole=function createServerRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.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:Ut(Ut({},generatorRoleForCmd(t)),{type:XI.custom}),antispamTag:generateAntispamTag(t)});case 3:return a=u.sent,u.abrupt("return",formatRole(a.content.serverRole));case 5:case"end":return u.stop()}}),_callee,this)})))},a.updateServerRole=function updateServerRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a;return lu.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 a=u.sent,u.abrupt("return",formatRole(a.content.serverRole));case 5:case"end":return u.stop()}}),_callee2,this)})))},a.deleteServerRole=function deleteServerRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){return lu.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("qchatDeleteServerRole",t);case 3:case"end":return a.stop()}}),_callee3,this)})))},a.getServerRoles=function getServerRoles(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a,u,m;return lu.wrap((function _callee4$(h){for(;;)switch(h.prev=h.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),h.next=3,this.core.sendCmd("qchatGetServerRoles",{getServerRolesTag:generatorRoleForCmd(t)});case 3:return u=h.sent,m=filter(a=u.content.serverRoles).call(a,(function(t){return 1===Bu(t.isMember)})),m=map$6(m).call(m,(function(t){return t.roleId})),h.abrupt("return",{roles:formatRoles(u.content.serverRoles),isMemberRoles:m});case 7:case"end":return h.stop()}}),_callee4,this)})))},a.addChannelRole=function addChannelRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a;return lu.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 a=u.sent,u.abrupt("return",formatRole(a.content.channelRole));case 5:case"end":return u.stop()}}),_callee5,this)})))},a.getChannelRoles=function getChannelRoles(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var a;return lu.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 a=u.sent,u.abrupt("return",formatRoles(a.content.channelRoles));case 5:case"end":return u.stop()}}),_callee6,this)})))},a.removeChannelRole=function removeChannelRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},roleId:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("qchatRemoveChannelRole",t);case 3:case"end":return a.stop()}}),_callee7,this)})))},a.updateChannelRole=function updateChannelRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var a;return lu.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!==(a=u.sent).raw.code){u.next=6;break}throw new Xl("No update required",{},406);case 6:return u.abrupt("return",formatRole(a.content.channelRole));case 7:case"end":return u.stop()}}),_callee8,this)})))},a.addMemberRole=function addMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var a;return lu.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 a=u.sent,u.abrupt("return",formatRole(a.content.memberRole));case 5:case"end":return u.stop()}}),_callee9,this)})))},a.getMemberRoles=function getMemberRoles(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){var a;return lu.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 a=u.sent,u.abrupt("return",formatRoles(a.content.memberRoles));case 5:case"end":return u.stop()}}),_callee10,this)})))},a.removeMemberRole=function removeMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){return lu.wrap((function _callee11$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("qchatRemoveMemberRole",{memberRole:t});case 3:case"end":return a.stop()}}),_callee11,this)})))},a.updateMemberRole=function updateMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){var a;return lu.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!==(a=u.sent).raw.code){u.next=6;break}throw new Xl("No update required",{},406);case 6:return u.abrupt("return",formatRole(a.content.memberRole));case 7:case"end":return u.stop()}}),_callee12,this)})))},a.addMembersToServerRole=function addMembersToServerRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){var a,u,m;return lu.wrap((function _callee13$(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",min:1}},t),h.next=3,this.core.sendCmd("qchatAddMembersToServerRole",Ut(Ut({},t),{accids:Vn(t.accids)}));case 3:return a=h.sent,u=get(a,"content.accids.successAccids"),m=get(a,"content.accids.failedAccids"),h.abrupt("return",{successAccids:u?JSON.parse(u):[],failedAccids:m?JSON.parse(m):[]});case 7:case"end":return h.stop()}}),_callee13,this)})))},a.removeMembersFromServerRole=function removeMembersFromServerRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){var a,u,m;return lu.wrap((function _callee14$(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",min:1}},t),h.next=3,this.core.sendCmd("qchatRemoveMembersFromServerRole",Ut(Ut({},t),{accids:Vn(t.accids)}));case 3:return a=h.sent,u=get(a,"content.accids.successAccids"),m=get(a,"content.accids.failedAccids"),h.abrupt("return",{successAccids:u?JSON.parse(u):[],failedAccids:m?JSON.parse(m):[]});case 7:case"end":return h.stop()}}),_callee14,this)})))},a.getMembersFromServerRole=function getMembersFromServerRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){var a;return lu.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 a=u.sent,u.abrupt("return",formatRoles(a.content.members));case 5:case"end":return u.stop()}}),_callee15,this)})))},a.getServerRolesByAccid=function getServerRolesByAccid(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var a;return lu.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 a=u.sent,u.abrupt("return",formatRoles(a.content.serverRoles));case 5:case"end":return u.stop()}}),_callee16,this)})))},a.getExistingServerRolesByAccids=function getExistingServerRolesByAccids(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee17(){var a,u,m;return lu.wrap((function _callee17$(h){for(;;)switch(h.prev=h.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},accids:{type:"array",itemType:"string"}},t),h.next=3,this.core.sendCmd("qchatGetExistingServerRolesByAccids",{serverId:t.serverId,accids:Vn(t.accids)});case 3:return a=h.sent,h.prev=4,m=JSON.parse(a.content.serverRoles),forEach$1(u=Gt(m)).call(u,(function(t){var a;forEach$1(a=m[t]).call(a,(function(a,u){m[t][u]=deserialize(a,V_().serverRole)})),m[t]=formatRoles(m[t])})),h.abrupt("return",m);case 10:throw h.prev=10,h.t0=h.catch(4),this.logger.error("can not parse serverRolesGroupByAccid from "+t.serverId+" and "+t.accids,a.content.serverRoles),h.t0;case 14:case"end":return h.stop()}}),_callee17,this,[[4,10]])})))},a.getExistingChannelRolesByServerRoleIds=function getExistingChannelRolesByServerRoleIds(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee18(){var a;return lu.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:Vn(t.roleIds)});case 3:return a=u.sent,u.abrupt("return",formatRoles(a.content.channelRoles));case 5:case"end":return u.stop()}}),_callee18,this)})))},a.getExistingAccidsOfMemberRoles=function getExistingAccidsOfMemberRoles(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee19(){var a,u;return lu.wrap((function _callee19$(m){for(;;)switch(m.prev=m.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},channelId:{type:"string",allowEmpty:!1},accids:{type:"array",itemType:"string"}},t),m.next=3,this.core.sendCmd("qchatGetExistingAccidsOfMemberRoles",{serverId:t.serverId,channelId:t.channelId,accids:Vn(t.accids)});case 3:return a=m.sent,u=a.content.memberRoles,m.abrupt("return",u&&u.length>0?map$6(u).call(u,(function(t){return t.accid})):[]);case 6:case"end":return m.stop()}}),_callee19,this)})))},a.getExistingAccidsInServerRole=function getExistingAccidsInServerRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee20(){var a,u;return lu.wrap((function _callee20$(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"}},t),m.next=3,this.core.sendCmd("qchatGetExistingAccidsInServerRole",{serverId:t.serverId,roleId:t.roleId,accids:Vn(t.accids)});case 3:return a=m.sent,u=a.content.members,m.abrupt("return",u&&u.length>0?map$6(u).call(u,(function(t){return t.accid})):[]);case 6:case"end":return m.stop()}}),_callee20,this)})))},a.updateServerRolePriorities=function updateServerRolePriorities(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee21(){var a,u;return lu.wrap((function _callee21$(m){for(;;)switch(m.prev=m.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},serverRoles:{type:"array"}},t),m.next=3,this.core.sendCmd("qchatUpdateServerRolePriorities",{serverId:t.serverId,serverRoles:map$6(a=t.serverRoles).call(a,(function(t){return{serverId:t.serverId,roleId:t.roleId,priority:t.priority}}))});case 3:return u=m.sent,m.abrupt("return",formatRoles(u.content.serverRoles));case 5:case"end":return m.stop()}}),_callee21,this)})))},a.checkPermission=function checkPermission(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee22(){var a;return lu.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:Ut(Ut({},t),{auth:t_[t.auth]||t.auth})});case 3:return a=u.sent,u.abrupt("return",a.content.checked);case 5:case"end":return u.stop()}}),_callee22,this)})))},a.addChannelCategoryRole=function addChannelCategoryRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee23(){return lu.wrap((function _callee23$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.category.addChannelCategoryRole(t);case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop()}}),_callee23,this)})))},a.removeChannelCategoryRole=function removeChannelCategoryRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee24(){return lu.wrap((function _callee24$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.category.removeChannelCategoryRole(t);case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop()}}),_callee24,this)})))},a.updateChannelCategoryRole=function updateChannelCategoryRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee25(){return lu.wrap((function _callee25$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.category.updateChannelCategoryRole(t);case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop()}}),_callee25,this)})))},a.getChannelCategoryRole=function getChannelCategoryRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee26(){return lu.wrap((function _callee26$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.category.getChannelCategoryRole(t);case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop()}}),_callee26,this)})))},a.addChannelCategoryMemberRole=function addChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee27(){return lu.wrap((function _callee27$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.category.addChannelCategoryMemberRole(t);case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop()}}),_callee27,this)})))},a.removeChannelCategoryMemberRole=function removeChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee28(){return lu.wrap((function _callee28$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.category.removeChannelCategoryMemberRole(t);case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop()}}),_callee28,this)})))},a.updateChannelCategoryMemberRole=function updateChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee29(){return lu.wrap((function _callee29$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.category.updateChannelCategoryMemberRole(t);case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop()}}),_callee29,this)})))},a.getChannelCategoryMemberRole=function getChannelCategoryMemberRole(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee30(){return lu.wrap((function _callee30$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.category.getChannelCategoryMemberRole(t);case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop()}}),_callee30,this)})))},a.checkPermissions=function checkPermissions(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee31(){var a,u,m,h;return lu.wrap((function _callee31$(g){for(;;)switch(g.prev=g.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),g.next=4,this.core.sendCmd("qchatCheckPermissions",{checkPermissionsTag:Ut(Ut({},t),{auths:Vn(map$6(a=t.auths).call(a,(function(t){return t_[t]||t})))})});case 4:return m=g.sent,this.core.logger.log("qchatRole::checkPermission result is",m.content),h={},forEach$1(u=m.content.checkPermissionsResult).call(u,(function(t){h[t.auth]=t.isAllow})),this.core.logger.log("qchatRole::checkPermission auths is",h),g.abrupt("return",formatRoleAuths(h));case 10:case"end":return g.stop()}}),_callee31,this)})))},QChatRoleService}(VI);function _createForOfIteratorHelperLoose(t,a){var u,m=void 0!==Zo&&au(t)||t["@@iterator"];if(m)return bind$1(u=(m=m.call(t)).next).call(u,m);if(Un(t)||(m=function _unsupportedIterableToArray(t,a){if(t){var u;if("string"==typeof t)return _arrayLikeToArray(t,a);var m=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===m&&t.constructor&&(m=t.constructor.name),"Map"===m||"Set"===m?nu(t):"Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?_arrayLikeToArray(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){m&&(t=m);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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,a){(null==a||a>t.length)&&(a=t.length);for(var u=0,m=Array(a);u<a;u++)m[u]=t[u];return m}var eS=function(t){function QChatServerService(a){var u;return(u=t.call(this,"qchatServer",a)||this).core=a,registerParser({cmdMap:w_,cmdConfig:O_()}),u}wt(QChatServerService,t);var a=QChatServerService.prototype;return a.createServer=function createServer(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.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:Ut(Ut({},t),{searchEnable:!1===t.searchEnable?0:1}),antispamTag:generateAntispamTag(t)});case 3:return a=u.sent,u.abrupt("return",formatServer(a.content.serverInfo));case 5:case"end":return u.stop()}}),_callee,this)})))},a.deleteServer=function deleteServer(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",min:1}},t),a.next=3,this.core.sendCmd("qchatDeleteServer",t);case 3:case"end":return a.stop()}}),_callee2,this)})))},a.updateServer=function updateServer(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.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:Ut(Ut({},t),{searchEnable:!1===t.searchEnable?0:1}),antispamTag:generateAntispamTag(t)});case 3:return a=u.sent,u.abrupt("return",formatServer(a.content.serverInfo));case 5:case"end":return u.stop()}}),_callee3,this)})))},a.getServers=function getServers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a;return lu.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 a=u.sent,u.abrupt("return",formatServers(a.content.serverList));case 5:case"end":return u.stop()}}),_callee4,this)})))},a.getServersByPage=function getServersByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){var a,u,m,h;return lu.wrap((function _callee5$(g){for(;;)switch(g.prev=g.next){case 0:return validate({timestamp:{type:"number"},limit:{type:"number",min:1,required:!1}},t),g.next=3,this.core.sendCmd("qchatGetServersByPage",{tag:t});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatServers(m)});case 6:case"end":return g.stop()}}),_callee5,this)})))},a.inviteServerMembers=function inviteServerMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var a,u;return lu.wrap((function _callee6$(m){for(;;)switch(m.prev=m.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),m.next=3,this.core.sendCmd("qchatInviteServerMembers",t);case 3:return a=m.sent,u=a.content.record||{},m.abrupt("return",{failByOverAccids:a.content.failByOverAccids,failByBanAccids:a.content.failByBanAccids,recordInfo:formatInviteApplyRecord(u)});case 6:case"end":return m.stop()}}),_callee6,this)})))},a.acceptServerInvite=function acceptServerInvite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(a){for(;;)switch(a.prev=a.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),a.next=3,this.core.sendCmd("qchatAcceptServerInvite",t);case 3:case"end":return a.stop()}}),_callee7,this)})))},a.rejectInviteServer=function rejectInviteServer(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){return lu.wrap((function _callee8$(a){for(;;)switch(a.prev=a.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),a.next=3,this.core.sendCmd("qchatRejectInviteServer",t);case 3:case"end":return a.stop()}}),_callee8,this)})))},a.applyServerJoin=function applyServerJoin(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var a;return lu.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 a=u.sent,u.abrupt("return",formatInviteApplyRecord(a.content.data));case 5:case"end":return u.stop()}}),_callee9,this)})))},a.acceptServerApply=function acceptServerApply(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){return lu.wrap((function _callee10$(a){for(;;)switch(a.prev=a.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),a.next=3,this.core.sendCmd("qchatAcceptServerApply",t);case 3:case"end":return a.stop()}}),_callee10,this)})))},a.rejectServerApply=function rejectServerApply(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){return lu.wrap((function _callee11$(a){for(;;)switch(a.prev=a.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),a.next=3,this.core.sendCmd("qchatRejectServerApply",t);case 3:case"end":return a.stop()}}),_callee11,this)})))},a.kickServerMembers=function kickServerMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){return lu.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",min:1},accids:{type:"array",itemType:"string",min:1}},t),a.next=3,this.core.sendCmd("qchatKickServerMembers",t);case 3:case"end":return a.stop()}}),_callee12,this)})))},a.leaveServer=function leaveServer(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){return lu.wrap((function _callee13$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",min:1}},t),a.next=3,this.core.sendCmd("qchatLeaveServer",t);case 3:case"end":return a.stop()}}),_callee13,this)})))},a.updateMyMemberInfo=function updateMyMemberInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){var a;return lu.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 a=u.sent,u.abrupt("return",formatMember$1(a.content.memberInfo));case 5:case"end":return u.stop()}}),_callee14,this)})))},a.updateServerMemberInfo=function updateServerMemberInfo(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee15(){var a;return lu.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 a=u.sent,u.abrupt("return",formatMember$1(a.content.memberInfo));case 5:case"end":return u.stop()}}),_callee15,this)})))},a.getServerMembers=function getServerMembers(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee16(){var a,u,m,h,g;return lu.wrap((function _callee16$(M){for(;;)switch(M.prev=M.next){case 0:if(validate({accids:{type:"array"}},t),a=[],t.accids.length)for(u=_createForOfIteratorHelperLoose(t.accids);!(m=u()).done;)h=m.value,a.push(h.serverId+"|"+h.accid);return M.next=5,this.core.sendCmd("qchatGetServerMembers",{accids:a});case 5:return g=M.sent,M.abrupt("return",formatMembers$1(g.content.accidList));case 7:case"end":return M.stop()}}),_callee16,this)})))},a.getServerMembersByPage=function getServerMembersByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee17(){var a,u,m,h;return lu.wrap((function _callee17$(g){for(;;)switch(g.prev=g.next){case 0:return validate({serverId:{type:"string",min:1},timetag:{type:"number"},limit:{type:"number",min:1,required:!1}},t),g.next=3,this.core.sendCmd("qchatGetServerMembersByPage",{tag:t});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatMembers$1(m)});case 6:case"end":return g.stop()}}),_callee17,this)})))},a.subscribeServer=function subscribeServer(t){var a,u,m,h;return __awaiter(this,void 0,void 0,lu.mark((function _callee18(){var g,M,I,S;return lu.wrap((function _callee18$(T){for(;;)switch(T.prev=T.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===(a=this.core.qchatChannel)||void 0===a?void 0:a.config)||void 0===u?void 0:u.autoSubscribe)||t.isInternalTrigger){T.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){T.next=12;break}return M=Ut(Ut({},t),{channels:map$6(g=t.servers).call(g,(function(t){return{serverId:t.serverId,channelId:""}}))}),T.next=8,this.core.qchatChannel.subscribeModuleService.subscribe(M);case 8:return I=T.sent,S=I.failedChannels,(null===(h=null===(m=this.core.qchatChannel)||void 0===m?void 0:m.config)||void 0===h?void 0:h.autoSubscribe)?this.core.qchatChannel.subscribeModuleService.cacheAutoSubscribe(M):this.core.qchatChannel.subscribeModuleService.cacheSubscribe(M),T.abrupt("return",{failedServers:S});case 12:case"end":return T.stop()}}),_callee18,this)})))},a.banServerMember=function banServerMember(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee19(){return lu.wrap((function _callee19$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),a.next=3,this.core.sendCmd("qchatUpdateServerMemberBan",{tag:Ut(Ut({},t),{opeType:1})});case 3:case"end":return a.stop()}}),_callee19,this)})))},a.unbanServerMember=function unbanServerMember(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee20(){return lu.wrap((function _callee20$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},accid:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),a.next=3,this.core.sendCmd("qchatUpdateServerMemberBan",{tag:Ut(Ut({},t),{opeType:2})});case 3:case"end":return a.stop()}}),_callee20,this)})))},a.getBannedMembersByPage=function getBannedMembersByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee21(){var a,u,m,h;return lu.wrap((function _callee21$(g){for(;;)switch(g.prev=g.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},timetag:{type:"number",min:0},limit:{type:"number",min:1,required:!1}},t),g.next=3,this.core.sendCmd("qchatGetBannedMembersByPage",{tag:t});case 3:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag)},datas:formatServerMemberBanInfos(m)});case 6:case"end":return g.stop()}}),_callee21,this)})))},a.serverSearchByPage=function serverSearchByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee22(){var a,u,m,h;return lu.wrap((function _callee22$(g){for(;;)switch(g.prev=g.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(xI),required:!1},searchType:{type:"enum",values:getEnumKeys(PI)},sort:{type:"enum",values:getEnumKeys(OI),required:!1},cursor:{type:"string",allowEmpty:!1,required:!1}},t),!(t.startTime&&t.endTime&&t.startTime>=t.endTime)){g.next=3;break}throw new Kl("startTime more than endTime",t,"timeRule");case 3:return g.next=5,this.core.sendCmd("qchatServerSearchByPage",{tag:Ut(Ut({},t),{order:t.order&&xI[t.order],searchType:PI[t.searchType],sort:sort(t)&&OI[sort(t)],serverType:Vn(t.serverType)})});case 5:return a=g.sent,u=a.content,m=u.datas,h=u.listQueryTag,g.abrupt("return",{listQueryTag:{hasMore:1==+h.hasMore,nextTimetag:Bu(h.nextTimetag),cursor:h.cursor},datas:formatServers(m)});case 8:case"end":return g.stop()}}),_callee22,this)})))},a.serverMemberSearchByPage=function serverMemberSearchByPage(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee23(){var a;return lu.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 a=u.sent,u.abrupt("return",formatMembers$1(a.content.members));case 5:case"end":return u.stop()}}),_callee23,this)})))},a.generateInviteCode=function generateInviteCode(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee24(){var a;return lu.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 a=u.sent,u.abrupt("return",format({expireTime:{type:"number"}},a.content.data));case 5:case"end":return u.stop()}}),_callee24,this)})))},a.joinByInviteCode=function joinByInviteCode(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee25(){return lu.wrap((function _callee25$(a){for(;;)switch(a.prev=a.next){case 0:return validate({serverId:{type:"string",allowEmpty:!1},inviteCode:{type:"string",allowEmpty:!1},ps:{type:"string",required:!1}},t),a.next=3,this.core.sendCmd("qchatJoinByInviteCode",{tag:t});case 3:case"end":return a.stop()}}),_callee25,this)})))},a.getInviteApplyRecordOfServer=function getInviteApplyRecordOfServer(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee26(){var a;return lu.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:Ut(Ut({},t),{reverse:reverse$1(t)?1:0})});case 3:return a=u.sent,u.abrupt("return",formatInviteApplyRecords(a.content.data));case 5:case"end":return u.stop()}}),_callee26,this)})))},a.getInviteApplyRecordOfSelf=function getInviteApplyRecordOfSelf(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee27(){var a;return lu.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:Ut(Ut({},t),{reverse:reverse$1(t)?1:0})});case 3:return a=u.sent,u.abrupt("return",formatInviteApplyRecords(a.content.data));case 5:case"end":return u.stop()}}),_callee27,this)})))},a.markRead=function markRead(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee28(){var a,u,m,h;return lu.wrap((function _callee28$(g){for(;;)switch(g.prev=g.next){case 0:return validate({serverIds:{type:"array",itemType:"string",required:!0}},t),g.next=3,this.core.sendCmd("qchatClearServersUnread",t);case 3:return a=g.sent,u=formatClearServersUnread(a.content.clearServersUnreadTag),m=u.successServerIds,h=u.ackTimestamp,this.logger.log("qchatServer::clearServersUnread:: begin auto clear servers unreadInfo"),this.core.eventBus.emit("qchatChannel/clearUnreadCountByServers",m,h),g.abrupt("return",u);case 9:case"end":return g.stop()}}),_callee28,this)})))},a.subscribeAllChannel=function subscribeAllChannel(t){var a,u;return __awaiter(this,void 0,void 0,lu.mark((function _callee29(){var m,h,g;return lu.wrap((function _callee29$(M){for(;;)switch(M.prev=M.next){case 0:if(validate({type:{type:"number",required:!0},serverIds:{type:"array",itemType:"string",required:!0,max:10}},t),!(null===(u=null===(a=this.core.qchatChannel)||void 0===a?void 0:a.config)||void 0===u?void 0:u.autoSubscribe)){M.next=3;break}throw new Xl("subscribe channel failed, manual subscribe is not allowed in auto subscribe mode.",{},403);case 3:return M.next=5,this.core.sendCmd("qchatSubscribeChannelsByServers",t,{timeout:3e4});case 5:return(h=M.sent).content.unreadInfos=formatUnreadInfos(h.content.unreadInfos),h.content.failServerIds=formatFailServerIds(h.content.failServerIds),g={type:t.type,opeType:1,channels:map$6(m=h.content.unreadInfos).call(m,(function(t){return{serverId:t.serverId,channelId:t.channelId}}))},this.core.eventBus.emit("qchatChannel/cacheSubscribe",g),this.core.eventBus.emit("qchatChannel/getRoleIdsByServerId",t.serverIds),this.core.eventBus.emit("qchatChannel/updateUnreads",h.content.unreadInfos),M.abrupt("return",h.content);case 13:case"end":return M.stop()}}),_callee29,this)})))},a.enterAsVisitor=function enterAsVisitor(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee30(){var a,u,m;return lu.wrap((function _callee30$(h){for(;;)switch(h.prev=h.next){case 0:return validate({serverIds:{type:"array",itemType:"string",min:1}},t),h.next=3,this.core.sendCmd("qchatEnterAsVisitor",{tag:{serverIds:Vn(t.serverIds)}});case 3:return a=h.sent,u=formatFailServerIds(a.content.failServerIds),m=difference(t.serverIds,u),this.core.qchatChannel.subscribeForVisitorService.cacheServer(m),h.abrupt("return",{failedServers:u});case 8:case"end":return h.stop()}}),_callee30,this)})))},a.leaveAsVisitor=function leaveAsVisitor(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee31(){var a,u,m,h=this;return lu.wrap((function _callee31$(g){for(;;)switch(g.prev=g.next){case 0:return validate({serverIds:{type:"array",itemType:"string",min:1}},t),g.next=3,this.core.sendCmd("qchatLeaveAsVisitor",{tag:{serverIds:Vn(t.serverIds)}});case 3:return a=g.sent,u=formatFailServerIds(a.content.failServerIds),m=difference(t.serverIds,u),forEach$1(m).call(m,(function(t){h.core.qchatChannel.subscribeForVisitorService.deleteServer(t)})),g.abrupt("return",{failedServers:u});case 8:case"end":return g.stop()}}),_callee31,this)})))},a.subscribeAsVisitor=function subscribeAsVisitor(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee32(){return lu.wrap((function _callee32$(a){for(;;)switch(a.prev=a.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){a.next=5;break}return a.next=4,this.core.qchatChannel.subscribeForVisitorService.subscribeServerAsVisitor(t);case 4:return a.abrupt("return",a.sent);case 5:return a.abrupt("return",{failedServers:[]});case 6:case"end":return a.stop()}}),_callee32,this)})))},QChatServerService}(VI),tS=function(t){function V2NIMNotificationServiceImpl(a,u){var m;return(m=t.call(this,"V2NIMNotificationService",a)||this).config={compatibleWithV1:!0},m.notificationUtil=new Uh(m.core),m.core._registerDep(gm,"V2NIMConversationIdUtil"),"v2"!==m.core.options.apiVersion?Qe(m):(registerParser({cmdMap:Ah,cmdConfig:xh}),m.setOptions(u),m)}wt(V2NIMNotificationServiceImpl,t);var a=V2NIMNotificationServiceImpl.prototype;return a.setOptions=function setOptions(t){var a;(null===(a=this.core.systemMessage)||void 0===a?void 0:a.name)?this.config.compatibleWithV1=!0:this.config.compatibleWithV1=!1,this.config=Ut(this.config,t)},a.emit=function emit(a){for(var u,m,h=this.name+"::emit "+a.toString(),g=arguments.length,M=new Array(g>1?g-1:0),I=1;I<g;I++)M[I-1]=arguments[I];if("onReceiveCustomNotifications"===a){var S=M[0];this.logger.log(""+h,map$6(S).call(S,(function(t){return"sender:"+t.senderId+";receiver:"+t.receiverId+";ctype:"+t.conversationType+";time:"+t.timestamp})))}else if("onReceiveBroadcastNotifications"===a){var T=M[0];this.logger.log(""+h,map$6(T).call(T,(function(t){return"id:"+t.id+";sender:"+t.senderId+";time:"+t.timestamp})))}else{var C,b;(C=this.logger).log.apply(C,concat(b=[""+h]).call(b,M))}return(u=t.prototype.emit).call.apply(u,concat(m=[this,a]).call(m,M))},a.sendCustomNotification=function sendCustomNotification(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var m,h,g;return lu.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:return this.checkV2(),validateConversationId(this.core.account,t),validate(Vh,{content:a,params:u},"",!0),m=this.core.V2NIMConversationIdUtil.parseConversationType(t),h=3===m?"v2SendCustomNotificationWithSuperTeam":"v2SendCustomNotification",g=this.notificationUtil.generateNotificationTag(t,a,u),M.next=8,this.core.sendCmd(h,{tag:g});case 8:case"end":return M.stop()}}),_callee,this)})))},a.processSystemNotification=function processSystemNotification(t){var a=[0,1,2,3,4,15,16,17,18],u=[5,6],m=t.type;if(includes(a).call(a,m))this.core.eventBus.emit("V2NIMTeamService/sysNotification",t);else{if(!includes(u).call(u,m)){var h=Ut(Ut({},t),{conversationType:{100:1,101:2,102:1,103:3}[m]});return delete h.type,h}this.core.eventBus.emit("V2NIMFriendService/sysNotification",t)}},a.markBroadcastMsgAck=function markBroadcastMsgAck(t){this.config.compatibleWithV1||this.core.sendCmd("v2BatchMarkRead",{sid:7,cid:17,ids:map$6(t).call(t,(function(t){return t.id}))})},a.syncBroadcastMsgHandler=function syncBroadcastMsgHandler(t){var a=this,u=t.content.datas;this.markBroadcastMsgAck(u),forEach$1(u).call(u,(function(t){a.core.eventBus.emit("V2NIMSync/updateTimetag",{broadcastMsgs:Bu(t.id)})})),this.emit("onReceiveBroadcastNotifications",u)},a.onBroadcastMsgHandler=function onBroadcastMsgHandler(t){var a=t.content.data;this.markBroadcastMsgAck([a]),this.core.eventBus.emit("V2NIMSync/updateTimetag",{broadcastMsgs:Bu(a.id)}),this.emit("onReceiveBroadcastNotifications",[a])},a.onSysNotificationHandler=function onSysNotificationHandler(t){var a=fillIdServer(t,t.content.data,"idServer");this.markSysNotificationAck([a]);var u=this.processSystemNotification(a);u&&this.emit("onReceiveCustomNotifications",[u])},a.v2SyncOfflineSysNotificationsHandler=function v2SyncOfflineSysNotificationsHandler(t){var a,u,m,h=this;this.markSysNotificationAck(t.content.datas);var g=filter(a=map$6(u=sort(m=t.content.datas).call(m,(function(t,a){return t.timestamp-a.timestamp}))).call(u,(function(t){return h.processSystemNotification(t)}))).call(a,(function(t){return t}));g&&this.emit("onReceiveCustomNotifications",g)},a.v2NotificationRevokeHandler=function v2NotificationRevokeHandler(t){var a=fillIdServer(t,t.content.data,"idServer");this.markSysNotificationAck([a])},a.v2NotificationSyncRevokeHandler=function v2NotificationSyncRevokeHandler(t){var a=t.content.type;1===Bu(a)&&this.markSysNotificationAck(t.content.datas)},a.markSysNotificationAck=function markSysNotificationAck(t){if(!this.config.compatibleWithV1){var a=[],u=[],m=[15,16,17,18,103];forEach$1(t).call(t,(function(t){t.idServer&&(includes(m).call(m,t.type)?u.push(t.idServer):a.push(t.idServer))})),a.length>0&&this.core.sendCmd("v2BatchMarkRead",{sid:"7",cid:"3",ids:a}),u.length>0&&this.core.sendCmd("v2BatchMarkRead",{sid:"21",cid:"19",ids:u})}},V2NIMNotificationServiceImpl}(gp),rS={"27_1":"v2NIMSync","27_10":"v2QChatSync"},nS={v2NIMSync:{sid:27,cid:1,service:"V2NIMSyncService",hasPacketTimer:!1,params:[{type:"Property",name:"tag",reflectMapper:{myInfo:1,offlineMsgs:2,teams:3,roamingMsgs:7,relations:9,friends:11,friendUsers:13,msgReceipts:14,myTeamMembers:15,donnop:16,recallMsg:17,sessionAck:18,broadcastMsgs:20,avSignal:21,superTeams:22,mySuperTeamMembers:23,superTeamRoamingMsgs:24,deleteSuperTeamMsg:25,superTeamSessionAck:26,deleteSelfMsgs:27,stickTopSessions:28,sessionHistoryMsgsDelete:29,p2pTeamModifyMessage:30,superTeamModifyMessage:31,filterMsgs:100}}],response:[{type:"Long",name:"timetag"}]},v2QChatSync:{sid:27,cid:10,service:"V2NIMSyncService",hasPacketTimer:!1,params:[{type:"Property",name:"tag",reflectMapper:{systemNotification:1,pushConfig:2}}],response:[{type:"Long",name:"timetag"}]}},aS=function(t){function V2NIMSyncServiceImpl(a){var u;return(u=t.call(this,"V2NIMSyncService",a)||this).teamKey=["teams","superTeams","myTeamMembers","mySuperTeamMembers"],u.config={},u.timetags={},"v2"!==u.core.options.apiVersion?Qe(u):(u.initEventListeners(),registerParser({cmdMap:rS,cmdConfig:nS}),u.setListener(),u)}wt(V2NIMSyncServiceImpl,t);var a=V2NIMSyncServiceImpl.prototype;return a.reset=function reset(){this.timetags={}},a.setListener=function setListener(){var t=this;this.core.eventBus.on("V2NIMSync/updateTimetag",(function(a){var u;forEach$1(u=Gt(a)).call(u,(function(u){a[u]>(t.timetags[u]||0)&&(t.timetags[u]=a[u])}))}))},a.setOptions=function setOptions(t){var a=this.core,u=!(!a.V2NIMConversationService.name&&!a.V2NIMLocalConversationService.name);return this.config=Ut({myInfo:!!a.V2NIMUserService.name,offlineMsgs:!!a.V2NIMMessageService.name,roamingMsgs:!!a.V2NIMMessageService.name,relations:!!a.V2NIMUserService.name,friends:!!a.V2NIMFriendService.name,friendUsers:!!a.V2NIMUserService.name,msgReceipts:!!a.V2NIMMessageService.name,broadcastMsgs:!!a.V2NIMNotificationService.name,recallMsg:!!a.V2NIMMessageService.name,sessionAck:u,superTeamSessionAck:u,stickTopSessions:u,superTeamRoamingMsgs:!!a.V2NIMTeamService.name,deleteSuperTeamMsg:!!a.V2NIMTeamService.name,deleteSelfMsgs:!!a.V2NIMMessageService.name,sessionHistoryMsgsDelete:!!a.V2NIMMessageService.name,avSignal:!!a.V2NIMSignallingService.name,teams:!!a.V2NIMTeamService.name,superTeams:!!a.V2NIMTeamService.name,myTeamMembers:!!a.V2NIMTeamService.name,mySuperTeamMembers:!!a.V2NIMTeamService.name,donnop:!!a.V2NIMSettingService.name,p2pTeamModifyMessage:!!a.V2NIMMessageService.name,superTeamModifyMessage:!!a.V2NIMMessageService.name},t),this.config},a.doBasicSync=function doBasicSync(){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var t,a,u,m,h,g=this;return lu.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:return t=Gt(this.config),a=filter(t).call(t,(function(t){var a;return!includes(a=g.teamKey).call(a,t)&&g.config[t]})),u=this.genSyncParams(a),this.logger.log("V2Sync:basic",u),M.next=6,this.core.clientSocket.sendCmd("v2NIMSync",{tag:u});case 6:return m=M.sent,h=m.content.timetag,this.setTimetags(h,filter(a).call(a,(function(t){return"broadcastMsgs"!==t}))),M.next=11,this.delaySyncDone();case 11:return M.next=13,this.handleImmediate();case 13:this.core.logger.log("sync::basic sync complete in",h);case 14:case"end":return M.stop()}}),_callee,this)})))},a.doTeamSync=function doTeamSync(){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var t,a,u,m,h,g=this;return lu.wrap((function _callee2$(M){for(;;)switch(M.prev=M.next){case 0:if(0!==(a=filter(t=this.teamKey).call(t,(function(t){return g.config[t]}))).length){M.next=3;break}return M.abrupt("return");case 3:return u=this.genSyncParams(a),this.core.eventBus.emit("V2NIMTeamService/onSyncStarted"),this.logger.log("V2Sync:team",u),m=null,M.prev=7,M.next=10,this.core.clientSocket.sendCmd("v2NIMSync",{tag:u});case 10:m=M.sent,M.next=17;break;case 13:throw M.prev=13,M.t0=M.catch(7),this.core.eventBus.emit("V2NIMTeamService/onSyncFailed",M.t0),M.t0;case 17:this.core.eventBus.emit("V2NIMTeamService/onSyncFinished"),h=m.content.timetag,this.setTimetags(h,this.teamKey),this.core.logger.log("sync::team sync complete in",h);case 21:case"end":return M.stop()}}),_callee2,this,[[7,13]])})))},a.doQchatSync=function doQchatSync(){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var t;return lu.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.core.clientSocket.sendCmd("v2QChatSync",{tag:{systemNotification:0}});case 2:t=a.sent,this.core.logger.log("sync::qchat sync complete in",t.content.timetag);case 4:case"end":return a.stop()}}),_callee3,this)})))},a.doSync=function doSync(){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var t;return lu.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:if(void 0!==(t=get(this.core,"V2NIMLoginService.authenticator.loginClientOfThisConnection.loginType"))){a.next=4;break}return this.logger.warn("sync::doSync: no loginType, stop sync"),a.abrupt("return");case 4:if(this.logger.log("sync::doSync:type "+t),this.core.V2NIMLoginService.dataSync.switchDataSync({type:1,state:2,subType:"mainSync"}),1!==t){a.next=20;break}return a.prev=7,a.next=10,this.doBasicSync();case 10:return a.next=12,this.doTeamSync();case 12:a.next=18;break;case 14:return a.prev=14,a.t0=a.catch(7),this.doSyncComplete(a.t0),a.abrupt("return");case 18:a.next=49;break;case 20:if(2!==t){a.next=32;break}return a.prev=21,a.next=24,this.doQchatSync();case 24:a.next=30;break;case 26:return a.prev=26,a.t1=a.catch(21),this.doSyncComplete(a.t1),a.abrupt("return");case 30:a.next=49;break;case 32:if(3!==t){a.next=48;break}return a.prev=33,a.next=36,this.doBasicSync();case 36:return a.next=38,this.doTeamSync();case 38:return a.next=40,this.doQchatSync();case 40:a.next=46;break;case 42:return a.prev=42,a.t2=a.catch(33),this.doSyncComplete(a.t2),a.abrupt("return");case 46:a.next=49;break;case 48:return a.abrupt("return");case 49:this.doSyncComplete();case 50:case"end":return a.stop()}}),_callee4,this,[[7,14],[21,26],[33,42]])})))},a.doSyncComplete=function doSyncComplete(t){t&&this.core.logger.log("sync::doSync complete but got error",t),this.core.V2NIMLoginService.dataSync.switchDataSync({type:1,state:3,error:t,subType:"mainSync"})},a.initEventListeners=function initEventListeners(){var t=this;this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(){t.doSync()}))},a.genSyncParams=function genSyncParams(t){var a=this;return reduce(t).call(t,(function(t,u){var m=u;return t[m]=a.timetags[m]||0,t}),{})},a.setTimetags=function setTimetags(t,a){var u=this;forEach$1(a).call(a,(function(a){u.timetags[a]=t}))},a.handleImmediate=function handleImmediate(){return this.core.session&&this.core.session.onSyncDone&&this.core.session.onSyncDone(),$i.resolve()},a.delaySyncDone=function delaySyncDone(){return 102===uu.getSystemInfo().hostEnvEnum?(this.core.logger.log("sync: emit ALIAPP sycnHandler, handle later"),new $i((function(t){po((function(){t()}),100)}))):$i.resolve()},V2NIMSyncServiceImpl}(gp),iS=function(){function V2NIMAIModelImpl(){this.aiStreamMap=new _c}var t=V2NIMAIModelImpl.prototype;return t.reset=function reset(){this.aiStreamMap.clear()},t.getAiStream=function getAiStream(t){return this.aiStreamMap.get(t)},t.getAiStreamIsComplete=function getAiStreamIsComplete(t){var a=this.aiStreamMap.get(t);return!a||a.isComplete},t.getAiStreamQueryStatus=function getAiStreamQueryStatus(t){var a=this.aiStreamMap.get(t);return a?a.queryStatus:0},t.upsertAiStreamChunks=function upsertAiStreamChunks(t,a,u){var m=this.aiStreamMap.get(t);return m&&!m.isComplete&&(m.chunks[a]=u),m||{isComplete:!1,queryStatus:0,chunks:[]}},t.setAiStream=function setAiStream(t,a,u){void 0===u&&(u=!1);var m=this.aiStreamMap.get(t);return m?this.aiStreamMap.set(t,Ut(Ut({},m),a)):u&&this.aiStreamMap.set(t,Ut({isComplete:!1,queryStatus:0,chunks:[]},a)),this.aiStreamMap.get(t)||{isComplete:!1,queryStatus:0,chunks:[]}},t.completeAiStream=function completeAiStream(t){var a=this.aiStreamMap.get(t);a&&this.aiStreamMap.set(t,Ut(Ut({},a),{isComplete:!0,queryStatus:0,chunks:[],aiRAGs:void 0}))},V2NIMAIModelImpl}();var oS="V2NIMAIService",sS={"4_26":"v2AIChatNotify","29_35":"v2AIProxyModelCall","29_36":"v2AIGetUserList","4_29":"v2AIOnStreamMessageChunk","4_30":"v2AIChatStreamNotify","29_38":"v2AIStopModelStreamCall","29_39":"v2AIStreamQuery","29_40":"v2AIRegenMessage"},cS={accountId:1,messages:{id:2,converter:objectToJSONString,retConverter:stringToJSONObject},requestId:3,content:{id:4,converter:objectToJSONString,retConverter:stringToJSONObject},promptVariables:5,modelConfigParams:{id:6,converter:objectToJSONString,retConverter:stringToJSONObject},antispamBusinessId:7,antispamEnabled:{id:8,converter:boolToInt},aiStream:{id:9,converter:boolToInt}},lS={accountId:1,name:3,avatar:4,sign:5,gender:{id:6,retType:"number"},email:7,birthday:8,mobile:9,serverExtension:10,modelType:{id:11,retType:"number"},modelConfig:{id:12,retConverter:function retConverter(t){if(t=stringToJSONObject(t)){var a=Gt(t),u=reduce(a).call(a,(function(a,u){var m=function camelCase(t){var a;return map$6(a=(t=t||"").split("_")).call(a,(function(t,a){return 0===a?t:t[0].toUpperCase()+slice(t).call(t,1)})).join("")}(u);return a[m]=t[u],a}),{});if("string"==typeof u.promptKeys)try{u.promptKeys=JSON.parse(u.promptKeys)}catch(t){}return u}}},yunxinConfig:{id:13,retConverter:function retConverter(t){if(t=stringToJSONObject(t))return t}},valid:{id:14,retType:"boolean"},createTime:{id:15,retType:"number"},updateTime:{id:16,retType:"number"}};function aiAgentStreamContentRetConverter(t){try{var a=JSON.parse(t);return"number"==typeof a.index?{msg:a.msg||"",type:a.type,lastChunk:{content:a.msg,chunkTime:Bu(a.timestamp),type:a.type,index:Bu(a.index)}}:a}catch(t){return}}function aiAgentStreamAIRAGsRetConverter(t){try{var a=JSON.parse(t);return a&&a.length>0?map$6(a).call(a,(function(t){return t.description=t.desc,delete t.desc,t})):[]}catch(t){return[]}}var uS={code:{id:1,retType:"number"},accountId:2,requestId:3,content:{id:4,retConverter:aiAgentStreamContentRetConverter},aiRAGs:{id:5,retConverter:aiAgentStreamAIRAGsRetConverter},timestamp:{id:6,retType:"number"},aiStreamStatus:{id:7,retType:"number"},aiStream:{id:8,retType:"boolean"}},dS={serverId:1,clientId:2,type:{id:3,retType:"number"},from:4,to:5,aiAccount:6,startIndex:{id:7,retType:"number"},endIndex:{id:8,retType:"number"},excludeIndex:{id:9,converter:objectToJSONString}},pS={serverId:1,clientId:2,type:{id:3,retType:"number"},content:{id:4,retConverter:aiAgentStreamContentRetConverter},aiRAGs:{id:6,retConverter:aiAgentStreamAIRAGsRetConverter}},mS={v2AIChatNotify:{sid:4,cid:26,service:oS,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(uS)}]},v2AIProxyModelCall:{sid:29,cid:35,service:oS,params:[{type:"Property",name:"tag",reflectMapper:cS}]},v2AIGetUserList:{sid:29,cid:36,service:oS,params:[{type:"Property",name:"tag",reflectMapper:{pageToken:1,limit:2}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(lS)},{type:"Property",name:"queryTag",reflectMapper:invertSerializeItem({hasMore:{id:16,retType:"boolean"},nextToken:2})}]},v2AIOnStreamMessageChunk:{sid:4,cid:29,service:oS,response:[{type:"Property",name:"msg",reflectMapper:invertSerializeItem(_h)}]},v2AIChatStreamNotify:{sid:4,cid:30,service:oS,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(uS)}]},v2AIStopModelStreamCall:{sid:29,cid:38,service:oS,params:[{type:"Property",name:"tag",reflectMapper:{serverId:1,clientId:2,type:{id:3,retType:"number"},from:4,to:5,aiAccount:6,opeType:{id:7,retType:"number"},updateContent:{id:8},messageTime:{id:11,retType:"number"}}}]},v2AIStreamQuery:{sid:29,cid:39,service:oS,params:[{type:"Property",name:"tag",reflectMapper:dS}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(pS)}]},v2AIRegenMessage:{sid:29,cid:40,service:oS,params:[{type:"Property",name:"tag",reflectMapper:{fromAccount:1,to:2,aiAccount:3,serverId:4,clientId:5,time:{id:6,retType:"number"},type:{id:7,retType:"number"},opeType:{id:8,retType:"number"},replyMsgFromAccount:9,replyMsgToAccount:10,replyMsgTime:{id:11,retType:"number"},replyMsgIdServer:12,replyMsgIdClient:13}}]}},hS=function(){function V2NIMAIEventImpl(t,a){this.core=t,this.service=a,this.logger=this.core.logger}var t=V2NIMAIEventImpl.prototype;return t.setListener=function setListener(){},t.beforeEmit=function beforeEmit(t){for(var a,u,m=this.service.name+"::emit "+t.toString(),h=arguments.length,g=new Array(h>1?h-1:0),M=1;M<h;M++)g[M-1]=arguments[M];if("onProxyAIModelCall"===t){var I=g[0];this.logger.log(""+m,"requestId:"+I.requestId+";aiStreamStatus:"+I.aiStreamStatus)}else if("onProxyAIModelStreamCall"===t){var S=g[0];this.logger.log(""+m,"requestId:"+S.requestId+";chunkIndex:"+(null===(a=S.content)||void 0===a?void 0:a.lastChunk.index)+";chunkTime:"+(null===(u=S.content)||void 0===u?void 0:u.lastChunk.chunkTime))}else{var T,C;(T=this.logger).log.apply(T,concat(C=[""+m]).call(C,g))}},V2NIMAIEventImpl}(),gS=function(){function V2NIMAIHandlerImpl(t,a){this.core=t,this.service=a,this.model=a.model,this.logger=this.core.logger}var t=V2NIMAIHandlerImpl.prototype;return t.v2AIChatNotifyHandler=function v2AIChatNotifyHandler(t){var a=t.content.data;a&&a.requestId&&(this.model.completeAiStream(a.requestId),a.aiStreamStatus=a.aiStreamStatus||0,a.aiStream=a.aiStream||!1,a.content&&(a.content.msg=a.content.msg||""),this.service.emit("onProxyAIModelCall",a))},t.v2AIChatStreamNotifyHandler=function v2AIChatStreamNotifyHandler(t){var a=t.content.data;if(a&&a.requestId&&a.content&&a.content.msg){var u=this.model.getAiStream(a.requestId);if(u||(u=this.model.setAiStream(a.requestId,{isComplete:!1,queryStatus:0,chunks:[]},!0)),!u.isComplete){var m=a.content.lastChunk;if(0===m.index&&a.aiRAGs&&(u=this.model.setAiStream(a.requestId,{aiRAGs:a.aiRAGs})),this.logger.log("V2AI::streamNotify requestId:"+a.requestId+";index:"+m.index+";cacheChunkLength:"+u.chunks.length+";chunkTime:"+m.chunkTime+"."),0===u.chunks.length&&m.index>0)this.logger.log("V2AI::streamNotify requestId:"+a.requestId+";chunks missing 0,currentIdx:"+m.index+",needQuery:"+(0===u.queryStatus)+"."),0===u.queryStatus&&(u=this.model.setAiStream(a.requestId,{queryStatus:1}),this.service._queryAiStream({clientId:a.requestId,type:4,from:this.core.account,aiAccount:a.accountId,startIndex:0,endIndex:m.index-1}));else if(m.index>0&&u.chunks.length>0&&void 0===u.chunks[m.index-1]){var h,g=reduce(h=u.chunks).call(h,(function(t,a,u){return void 0!==a&&t.push(u),t}),[]);this.logger.log("V2AI::streamNotify requestId:"+a.requestId+";out of order,currenIdx:"+m.index+",cacheIdx:["+g.join(",")+"],needReport:"+!u.hasReported+"."),u.hasReported||(u=this.model.setAiStream(a.requestId,{hasReported:!0}),this.reportOutOfOrder({requestId:a.requestId,cacheIds:g,targetIndex:m.index,target:"4-30"}))}(u=this.model.upsertAiStreamChunks(a.requestId,m.index,m.content)).chunks[0]||1!==u.queryStatus?(a.content.msg=u.chunks.join(""),u.aiRAGs&&(a.aiRAGs=u.aiRAGs),this.service.emit("onProxyAIModelStreamCall",a)):this.logger.log("V2AI::streamNotify requestId:"+a.requestId+";chunks ignore index:"+m.index+";queryStatus:"+u.queryStatus+".")}}},t.v2AIOnStreamMessageChunkHandler=function v2AIOnStreamMessageChunkHandler(t){var a,u,m,h=completeMessage(this.core,t.content.msg);if(h.streamConfig&&h.streamConfig.lastChunk){var g=this.model.getAiStream(h.messageClientId);if(!g||!g.isComplete){g||(g=this.model.setAiStream(h.messageClientId,{isComplete:!1,queryStatus:0,chunks:[]},!0));var M=h.streamConfig.lastChunk,I=h.messageClientId;if(0===M.index&&(null===(a=h.aiConfig)||void 0===a?void 0:a.aiRAGs)&&(g=this.model.setAiStream(I,{aiRAGs:h.aiConfig.aiRAGs})),this.logger.log("V2AI::aiStream requestId:"+I+";index:"+M.index+";cacheChunkLength:"+g.chunks.length+";chunkTime:"+M.chunkTime+"."),0===g.chunks.length&&M.index>0)this.logger.log("V2AI::msg:aiStream requestId:"+I+";chunks missing 0,currentIdx:"+M.index+",needQuery:"+(0===g.queryStatus)+"."),0===g.queryStatus&&(g=this.model.setAiStream(I,{queryStatus:1}),this.service._queryAiStream({serverId:h.messageServerId,clientId:I,type:(null===(u=h.aiConfig)||void 0===u?void 0:u.accountId)?h.conversationType:5,from:h.senderId,to:h.receiverId,aiAccount:null===(m=h.aiConfig)||void 0===m?void 0:m.accountId,startIndex:0,endIndex:M.index-1}));else if(M.index>0&&g.chunks.length>0&&void 0===g.chunks[M.index-1]){var S,T=reduce(S=g.chunks).call(S,(function(t,a,u){return void 0!==a&&t.push(u),t}),[]);this.logger.log("V2AI::msg:aiStream requestId:"+I+";out of order,currenIdx:"+M.index+";streamCache.chunks:"+Vn(g.chunks)+",cacheIdx:["+T.join(",")+"],needReport:"+!g.hasReported+"."),g.hasReported||(g=this.model.setAiStream(I,{hasReported:!0}),this.reportOutOfOrder({requestId:I,cacheIds:T,targetIndex:M.index,target:"4-29"}))}(g=this.model.upsertAiStreamChunks(I,M.index,M.content)).chunks[0]||1!==g.queryStatus?(h.streamConfig.status=-1,h.aiConfig&&(h.aiConfig.aiStreamStatus=-1),h.text=g.chunks.join(""),g.aiRAGs&&h.aiConfig&&(h.aiConfig.aiRAGs=g.aiRAGs),g.msg&&(h=Ut({},g.msg,Ut({text:h.text,modifyTime:M.chunkTime,modifyAccountId:g.msg.senderId,streamConfig:h.streamConfig},h.aiConfig?{aiConfig:h.aiConfig}:{}))),this.core.eventBus.emit("V2NIMAIService/receiveMessagesModified",[h])):this.logger.log("V2AI::msg:callStream requestId:"+I+";chunks ignore index:"+M.index+";queryStatus:"+g.queryStatus+".")}}},t.reportOutOfOrder=function reportOutOfOrder(t){this.core.reporter.reportTraceStart("exceptions",{user_id:this.core.account,trace_id:get(this.core,"clientSocket.socket.sessionId"),action:2,exception_service:0}),this.core.reporter.reportTraceUpdateV2("exceptions",{code:0,context:t.requestId,description:"["+t.cacheIds.join(",")+"],"+t.targetIndex,operation_type:2,target:t.target,net_connect:!0}),this.core.reporter.reportTraceEnd("exceptions",4)},V2NIMAIHandlerImpl}(),vS=function(t){function V2NIMAIServiceImpl(a){var u;return(u=t.call(this,"V2NIMAIService",a)||this).model=new iS,u.event=new hS(u.core,Qe(u)),u.handler=new gS(u.core,Qe(u)),registerParser({cmdMap:sS,cmdConfig:mS}),u}wt(V2NIMAIServiceImpl,t);var a=V2NIMAIServiceImpl.prototype;return a.setListener=function setListener(){this.event.setListener()},a.reset=function reset(){this.model.reset()},a.emit=function emit(a){for(var u,m,h,g,M=arguments.length,I=new Array(M>1?M-1:0),S=1;S<M;S++)I[S-1]=arguments[S];return(u=this.event).beforeEmit.apply(u,concat(m=[a]).call(m,I)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,I))},a.getAIUserList=function getAIUserList(){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var t;return lu.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return this.checkV2(),a.next=3,this.core.sendCmd("v2AIGetUserList",{tag:{}});case 3:return t=a.sent,a.abrupt("return",t.content.datas);case 5:case"end":return a.stop()}}),_callee,this)})))},a.proxyAIModelCall=function proxyAIModelCall(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){return lu.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:if(validate(_m,t,"",!0),!this.model.getAiStream(t.requestId)){a.next=6;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,desc:"Same requestId",detail:{rawData:t.requestId}});case 6:this.model.setAiStream(t.requestId,{isComplete:!1,queryStatus:0,chunks:[]},!0);case 7:return a.next=9,this.core.sendCmd("v2AIProxyModelCall",{tag:t});case 9:case"end":return a.stop()}}),_callee2,this)})))},a.stopAIModelStreamCall=function stopAIModelStreamCall(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){return lu.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:return validate(Sm,t,"",!0),a.next=3,this.core.sendCmd("v2AIStopModelStreamCall",{tag:{clientId:t.requestId,aiAccount:t.accountId,type:4,from:this.core.account}});case 3:this.logger.log("V2AI::streamCallStop,requestId:"+t.requestId),this.model.completeAiStream(t.requestId);case 5:case"end":return a.stop()}}),_callee3,this)})))},a._queryAiStream=function _queryAiStream(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a,u,m=this;return lu.wrap((function _callee4$(h){for(;;)switch(h.prev=h.next){case 0:return this.model.setAiStream(t.clientId,{queryStatus:1}),h.prev=1,h.next=4,this.core.sendCmd("v2AIStreamQuery",{tag:t});case 4:if(a=h.sent,this.model.setAiStream(t.clientId,{queryStatus:2}),(u=a.content.datas)&&u.length>0){h.next=9;break}return h.abrupt("return");case 9:forEach$1(u).call(u,(function(t){var a=t.clientId,u=m.model.getAiStream(a);if(u&&(!u||!u.isComplete)&&t.content&&t.content.lastChunk){var h=t.content.lastChunk;m.model.upsertAiStreamChunks(a,h.index,h.content),0===h.index&&t.aiRAGs&&m.model.setAiStream(a,{aiRAGs:t.aiRAGs}),m.logger.log("V2AI::queryAiStream requestId:"+a+";index:"+h.index+";cacheChunkLength:"+u.chunks.length+";chunkTime:"+h.chunkTime+".")}})),h.next=16;break;case 12:h.prev=12,h.t0=h.catch(1),this.logger.warn("V2AI::queryAiStream requestId:"+t.clientId+";error:",h.t0),this.model.setAiStream(t.clientId,{queryStatus:2});case 16:case"end":return h.stop()}}),_callee4,this,[[1,12]])})))},V2NIMAIServiceImpl}(gp),fS={"18_1":"v2SignallingCreateRoom","18_2":"v2SignallingDelayRoom","18_3":"v2SignallingCloseRoom","18_4":"v2SignallingJoinRoom","18_5":"v2SignallingLeaveRoom","18_6":"v2SignallingInvite","18_7":"v2SignallingCancelInvite","18_16":"v2SignallingCall","18_17":"v2SignallingCallSetup","18_8":"v2SignallingRejectInvite","18_9":"v2SignallingAcceptInvite","18_10":"v2SignallingSendControl","15_11":"v2SignallingOnlineEvent","15_12":"v2SignallingMultiClientEvent","15_13":"v2SignallingOfflineEvent","15_14":"v2SignallingSyncChannels","18_15":"v2SignallingGetRoomInfo"},yS="V2NIMSignallingService",MS={accountId:1,uid:{id:2,retType:"number"},joinTime:{id:3,retType:"number"},expireTime:{id:4,retType:"number"},deviceId:5},IS={channelType:{id:1,retType:"number",retAccess:"channelInfo.channelType"},channelName:{id:2,retAccess:"channelInfo.channelName"},channelId:{id:3,retAccess:"channelInfo.channelId"},createTime:{id:4,retType:"number",retAccess:"channelInfo.createTime"},expireTime:{id:5,retType:"number",retAccess:"channelInfo.expireTime"},creatorAccountId:{id:6,retAccess:"channelInfo.creatorAccountId"},channelExtension:{id:7,retAccess:"channelInfo.channelExtension"},channelValid:{id:8,retDef:!0,retAccess:"channelInfo.channelValid",retConverter:function retConverter(t){return 1!==Bu(t)}},fromAccid:10,toAccid:11,requestId:12,pushEnabled:{id:13,access:"pushConfig.pushEnabled",converter:boolToInt,retType:"boolean"},pushTitle:{id:14,access:"pushConfig.pushTitle"},pushContent:{id:15,access:"pushConfig.pushContent"},pushPayload:{id:16,access:"pushConfig.pushPayload"},unreadEnabled:{id:17,access:"signallingConfig.unreadEnabled",converter:boolToInt,retType:"boolean",def:1},members:{id:18,retAccess:"members",retConverter:function retConverter(t){try{var a=JSON.parse(t);return map$6(a).call(a,(function(t){return deserialize(t,invertSerializeItem(MS))}))}catch(t){return}}},attach:{id:19,retConverter:stringToJSONObject},serverExtension:{id:20,retDef:""},offlineEnabled:{id:21,converter:boolToInt,retType:"boolean",def:1},msgId:22,selfUid:{id:23,retType:"number",access:"signallingConfig.selfUid"},time:{id:24,retType:"number"},rtcChannelName:{id:25,access:"rtcConfig.rtcChannelName"},rtcTokenTtl:{id:26,retType:"number",access:"rtcConfig.rtcTokenTtl",retAccess:"rtcInfo.rtcTokenTtl"},rtcToken:{id:27,retAccess:"rtcInfo.rtcToken"},rtcParams:{id:28,access:"rtcConfig.rtcParams",retAccess:"rtcInfo.rtcParams"},callStatus:{id:30,retType:"number"}},_S={v2SignallingCall:{sid:18,cid:16,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingCallSetup:{sid:18,cid:17,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingCreateRoom:{sid:18,cid:1,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingDelayRoom:{sid:18,cid:2,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingCloseRoom:{sid:18,cid:3,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingJoinRoom:{sid:18,cid:4,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingLeaveRoom:{sid:18,cid:5,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingInvite:{sid:18,cid:6,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingCancelInvite:{sid:18,cid:7,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingRejectInvite:{sid:18,cid:8,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}]},v2SignallingAcceptInvite:{sid:18,cid:9,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}]},v2SignallingSendControl:{sid:18,cid:10,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}]},v2SignallingOnlineEvent:{sid:15,cid:11,service:yS,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingMultiClientEvent:{sid:15,cid:12,service:yS,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingOfflineEvent:{sid:15,cid:13,service:yS,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(IS)}]},v2SignallingSyncChannels:{sid:15,cid:14,service:yS,response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(IS)}]},v2SignallingGetRoomInfo:{sid:18,cid:15,service:yS,params:[{type:"Property",name:"tag",reflectMapper:IS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(IS)}]},v2SignallingBatchMarkRead:{sid:4,cid:5,hasPacketResponse:!1,service:yS,params:[{type:"Byte",name:"sid"},{type:"Byte",name:"cid"},{type:"LongArray",name:"ids"}]}},SS={calleeAccountId:{type:"string",required:!0,allowEmpty:!1},requestId:{type:"string",required:!0,allowEmpty:!1},channelType:{type:"enum",values:[1,3,2]},channelName:{type:"string",required:!1,allowEmpty:!0},channelExtension:{type:"string",required:!1,allowEmpty:!0},serverExtension:{type:"string",required:!1,allowEmpty:!0},signallingConfig:{type:"object",required:!1,rules:{offlineEnabled:{type:"boolean",required:!1},unreadEnabled:{type:"boolean",required:!1},selfUid:{type:"number",required:!1}}},pushConfig:{type:"object",required:!1,rules:{pushEnabled:{type:"boolean",required:!1},pushTitle:{type:"string",required:!1,allowEmpty:!0},pushContent:{type:"string",required:!1,allowEmpty:!0},pushPayload:{type:"string",required:!1,allowEmpty:!0}}},rtcConfig:{type:"object",required:!1,rules:{rtcChannelName:{type:"string",required:!1,allowEmpty:!0},rtcTokenTtl:{type:"number",required:!1},rtcParams:{type:"string",required:!1,allowEmpty:!0}}}},TS={channelId:{type:"string",required:!0,allowEmpty:!1},callerAccountId:{type:"string",required:!0,allowEmpty:!1},requestId:{type:"string",required:!0,allowEmpty:!1},serverExtension:{type:"string",required:!1,allowEmpty:!0},signallingConfig:{type:"object",required:!1,rules:{offlineEnabled:{type:"boolean",required:!1},unreadEnabled:{type:"boolean",required:!1},selfUid:{type:"number",required:!1}}},rtcConfig:{type:"object",required:!1,rules:{rtcChannelName:{type:"string",required:!1,allowEmpty:!0},rtcTokenTtl:{type:"number",required:!1},rtcParams:{type:"string",required:!1,allowEmpty:!0}}}},CS={channelType:{type:"enum",values:[1,3,2]},channelName:{type:"string",required:!1,allowEmpty:!0},channelExtension:{type:"string",required:!1,allowEmpty:!0}},bS={channelId:{type:"string",required:!0,allowEmpty:!1},offlineEnabled:{type:"boolean",required:!1},serverExtension:{type:"string",required:!1,allowEmpty:!0}},ES={channelId:{type:"string",required:!0,allowEmpty:!1},serverExtension:{type:"string",required:!1,allowEmpty:!0},signallingConfig:{type:"object",required:!1,rules:{offlineEnabled:{type:"boolean",required:!1},unreadEnabled:{type:"boolean",required:!1},selfUid:{type:"number",required:!1}}},rtcConfig:{type:"object",required:!1,rules:{rtcChannelName:{type:"string",required:!1,allowEmpty:!0},rtcTokenTtl:{type:"number",required:!1},rtcParams:{type:"string",required:!1,allowEmpty:!0}}}},kS={channelId:{type:"string",required:!0,allowEmpty:!1},offlineEnabled:{type:"boolean",required:!1},serverExtension:{type:"string",required:!1,allowEmpty:!0}},RS={channelId:{type:"string",required:!0,allowEmpty:!1},inviteeAccountId:{type:"string",required:!0,allowEmpty:!1},requestId:{type:"string",required:!0,allowEmpty:!1},serverExtension:{type:"string",required:!1,allowEmpty:!0},signallingConfig:{type:"object",required:!1,rules:{offlineEnabled:{type:"boolean",required:!1},unreadEnabled:{type:"boolean",required:!1},selfUid:{type:"number",required:!1}}},pushConfig:{type:"object",required:!1,rules:{pushEnabled:{type:"boolean",required:!1},pushTitle:{type:"string",required:!1,allowEmpty:!0},pushContent:{type:"string",required:!1,allowEmpty:!0},pushPayload:{type:"string",required:!1,allowEmpty:!0}}}},AS={channelId:{type:"string",required:!0,allowEmpty:!1},inviteeAccountId:{type:"string",required:!0,allowEmpty:!1},requestId:{type:"string",required:!0,allowEmpty:!1},serverExtension:{type:"string",required:!1,allowEmpty:!0},offlineEnabled:{type:"boolean",required:!1},pushConfig:{type:"object",required:!1,rules:{pushEnabled:{type:"boolean",required:!1},pushTitle:{type:"string",required:!1,allowEmpty:!0},pushContent:{type:"string",required:!1,allowEmpty:!0},pushPayload:{type:"string",required:!1,allowEmpty:!0}}}},wS={channelId:{type:"string",allowEmpty:!1},receiverAccountId:{type:"string",required:!1},serverExtension:{type:"string",required:!1,allowEmpty:!0}},NS={channelId:{type:"string",allowEmpty:!1},inviterAccountId:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},serverExtension:{type:"string",required:!1,allowEmpty:!0},offlineEnabled:{type:"boolean",required:!1}},xS=NS;function formatSignalingEvent(t){var a,u=t.attach,m={eventType:u.type,channelInfo:t.channelInfo,operatorAccountId:t.fromAccid,time:t.time,serverExtension:t.serverExtension,requestId:t.requestId,pushConfig:t.pushConfig,unreadEnabled:null===(a=t.signallingConfig)||void 0===a?void 0:a.unreadEnabled},h=t.fromAccid,g=t.toAccid;switch(m.eventType){case 1:break;case 2:m.member={accountId:u.member[1],uid:Number(u.member[2]),joinTime:Number(u.member[3]),expireTime:Number(u.member[4]),deviceId:u.member[5]};break;case 3:case 4:m.operatorAccountId=h,m.inviteeAccountId=g,m.inviterAccountId=h;break;case 5:case 6:m.operatorAccountId=h,m.inviterAccountId=g,m.inviteeAccountId=h}return JSON.parse(Vn(m))}var OS,PS=function(t){function V2NIMSignallingServiceImpl(a,u){var m;return void 0===u&&(u={}),(m=t.call(this,"V2NIMSignallingService",a)||this).config={compatibleWithV1:!0},m.channels={},m.timer=0,m.pollingInterval=12e4,"v2"!==m.core.options.apiVersion?Qe(m):(registerParser({cmdMap:fS,cmdConfig:_S}),m.setOptions(u),m)}wt(V2NIMSignallingServiceImpl,t);var a=V2NIMSignallingServiceImpl.prototype;return a.reset=function reset(){this.timer=0,this.channels={}},a.setOptions=function setOptions(t){var a;(null===(a=this.core.signaling)||void 0===a?void 0:a.name)?this.config.compatibleWithV1=!0:this.config.compatibleWithV1=!1,this.config=Ut(this.config,t)},a.emit=function emit(a){for(var u,m,h,g,M=this.name+"::emit "+a.toString(),I=arguments.length,S=new Array(I>1?I-1:0),T=1;T<I;T++)S[T-1]=arguments[T];return(u=this.logger).log.apply(u,concat(m=[""+M]).call(m,S)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,S))},a.call=function call(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var u,m,h,g;return lu.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:if(this.checkV2(),validate(SS,t,"",!0),t.calleeAccountId!==this.core.account){M.next=4;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"You cannot call yourself"}});case 4:return u=void 0!==t.pushConfig&&(void 0!==t.pushConfig.pushEnabled&&t.pushConfig.pushEnabled),M.next=7,this.core.sendCmd("v2SignallingCall",{tag:Ut(Ut({},t),{toAccid:t.calleeAccountId,offlineEnabled:void 0===(null===(a=t.signallingConfig)||void 0===a?void 0:a.offlineEnabled)||t.signallingConfig.offlineEnabled,pushConfig:Ut(Ut({},t.pushConfig||{}),{pushEnabled:u})})});case 7:return m=M.sent,h=m.content.data,this.channels[h.channelInfo.channelId]=cloneDeep(h.channelInfo),this.timer||(this.timer=this.core.timerManager.addTimer(bind$1(g=this.aotoDelay).call(g,this),this.pollingInterval,-1)),M.abrupt("return",{callStatus:h.callStatus,rtcInfo:h.rtcInfo,roomInfo:{channelInfo:h.channelInfo,members:h.members}});case 12:case"end":return M.stop()}}),_callee,this)})))},a.callSetup=function callSetup(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var u,m,h;return lu.wrap((function _callee2$(g){for(;;)switch(g.prev=g.next){case 0:if(this.checkV2(),validate(TS,t,"",!0),t.callerAccountId!==this.core.account){g.next=4;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"callSetup: cannot be yourself"}});case 4:return g.next=6,this.core.sendCmd("v2SignallingCallSetup",{tag:Ut(Ut({},t),{toAccid:t.callerAccountId,offlineEnabled:void 0===(null===(a=t.signallingConfig)||void 0===a?void 0:a.offlineEnabled)||t.signallingConfig.offlineEnabled})});case 6:return u=g.sent,m=u.content.data,this.channels[m.channelInfo.channelId]=cloneDeep(m.channelInfo),this.timer||(this.timer=this.core.timerManager.addTimer(bind$1(h=this.aotoDelay).call(h,this),this.pollingInterval,-1)),g.abrupt("return",{callStatus:m.callStatus,rtcInfo:m.rtcInfo,roomInfo:{channelInfo:m.channelInfo,members:m.members}});case 11:case"end":return g.stop()}}),_callee2,this)})))},a.createRoom=function createRoom(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var m;return lu.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validate(CS,{channelType:t,channelName:a,channelExtension:u},"",!0),h.next=4,this.core.sendCmd("v2SignallingCreateRoom",{tag:{channelType:t,channelName:a,channelExtension:u}});case 4:return m=h.sent,h.abrupt("return",m.content.data.channelInfo);case 6:case"end":return h.stop()}}),_callee3,this)})))},a.delayRoom=function delayRoom(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a;return lu.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),u.next=3,this.core.sendCmd("v2SignallingDelayRoom",{tag:{channelId:t}});case 3:return a=u.sent,u.abrupt("return",{channelInfo:a.content.data.channelInfo,members:a.content.data.members});case 5:case"end":return u.stop()}}),_callee4,this)})))},a.closeRoom=function closeRoom(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee5(){return lu.wrap((function _callee5$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate(bS,{channelId:t,offlineEnabled:a,serverExtension:u},"",!0),m.next=4,this.core.sendCmd("v2SignallingCloseRoom",{tag:{channelId:t,offlineEnabled:void 0!==a&&a,serverExtension:u}});case 4:case"end":return m.stop()}}),_callee5,this)})))},a.joinRoom=function joinRoom(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee6(){var u,m,h,g,M,I;return lu.wrap((function _callee6$(S){for(;;)switch(S.prev=S.next){case 0:return this.checkV2(),validate(ES,t,"",!0),S.next=4,this.core.sendCmd("v2SignallingJoinRoom",{tag:Ut(Ut({},t),{offlineEnabled:void 0===(null===(a=t.signallingConfig)||void 0===a?void 0:a.offlineEnabled)||t.signallingConfig.offlineEnabled})});case 4:return u=S.sent,m=u.content.data,this.channels[m.channelInfo.channelId]=cloneDeep(m.channelInfo),this.timer||(this.timer=this.core.timerManager.addTimer(bind$1(h=this.aotoDelay).call(h,this),this.pollingInterval,-1)),g=m.channelInfo,M=m.members,I=m.rtcInfo,S.abrupt("return",{roomInfo:{channelInfo:g,members:M},rtcInfo:I});case 10:case"end":return S.stop()}}),_callee6,this)})))},a.leaveRoom=function leaveRoom(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee7(){return lu.wrap((function _callee7$(m){for(;;)switch(m.prev=m.next){case 0:return this.checkV2(),validate(kS,{channelId:t,offlineEnabled:a,serverExtension:u},"",!0),m.next=4,this.core.sendCmd("v2SignallingLeaveRoom",{tag:{channelId:t,offlineEnabled:void 0!==a&&a,serverExtension:u}});case 4:delete this.channels[t];case 5:case"end":return m.stop()}}),_callee7,this)})))},a.invite=function invite(t){var a;return __awaiter(this,void 0,void 0,lu.mark((function _callee8(){var u,m;return lu.wrap((function _callee8$(h){for(;;)switch(h.prev=h.next){case 0:if(this.checkV2(),validate(RS,t,"",!0),t.inviteeAccountId!==this.core.account){h.next=4;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"invite: cannot be yourself"}});case 4:return u=void 0!==t.pushConfig&&(void 0!==t.pushConfig.pushEnabled&&t.pushConfig.pushEnabled),h.next=7,this.core.sendCmd("v2SignallingInvite",{tag:Ut(Ut({},t),{toAccid:t.inviteeAccountId,offlineEnabled:void 0===(null===(a=t.signallingConfig)||void 0===a?void 0:a.offlineEnabled)||t.signallingConfig.offlineEnabled,pushConfig:Ut(Ut({},t.pushConfig||{}),{pushEnabled:u})})});case 7:return m=h.sent,h.abrupt("return",m.content.data);case 9:case"end":return h.stop()}}),_callee8,this)})))},a.cancelInvite=function cancelInvite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee9(){var a;return lu.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkV2(),validate(AS,t,"",!0),u.next=4,this.core.sendCmd("v2SignallingCancelInvite",{tag:Ut(Ut({},t),{toAccid:t.inviteeAccountId})});case 4:return a=u.sent,u.abrupt("return",a.content.data);case 6:case"end":return u.stop()}}),_callee9,this)})))},a.rejectInvite=function rejectInvite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee10(){return lu.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:if(validate(NS,t,"",!0),t.inviterAccountId!==this.core.account){a.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"rejectInvite: cannot be yourself"}});case 3:return a.next=5,this.core.sendCmd("v2SignallingRejectInvite",{tag:Ut(Ut({},t),{toAccid:t.inviterAccountId})});case 5:case"end":return a.stop()}}),_callee10,this)})))},a.acceptInvite=function acceptInvite(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee11(){return lu.wrap((function _callee11$(a){for(;;)switch(a.prev=a.next){case 0:if(validate(xS,t,"",!0),t.inviterAccountId!==this.core.account){a.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"acceptInvite: cannot be yourself"}});case 3:return a.next=5,this.core.sendCmd("v2SignallingAcceptInvite",{tag:Ut(Ut({},t),{toAccid:t.inviterAccountId})});case 5:case"end":return a.stop()}}),_callee11,this)})))},a.sendControl=function sendControl(t,a,u){return __awaiter(this,void 0,void 0,lu.mark((function _callee12(){return lu.wrap((function _callee12$(m){for(;;)switch(m.prev=m.next){case 0:return validate(wS,{channelId:t,receiverAccountId:a,serverExtension:u},"",!0),m.next=3,this.core.sendCmd("v2SignallingSendControl",{tag:{channelId:t,toAccid:a,serverExtension:u}});case 3:case"end":return m.stop()}}),_callee12,this)})))},a.getRoomInfoByChannelName=function getRoomInfoByChannelName(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee13(){var a,u,m,h;return lu.wrap((function _callee13$(g){for(;;)switch(g.prev=g.next){case 0:return validate({channelName:{type:"string",allowEmpty:!1}},{channelName:t},"",!0),g.next=3,this.core.sendCmd("v2SignallingGetRoomInfo",{tag:{channelName:t}});case 3:return a=g.sent,u=a.content.data,m=u.members,h=u.channelInfo,g.abrupt("return",{channelInfo:h,members:m||[]});case 6:case"end":return g.stop()}}),_callee13,this)})))},a.aotoDelay=function aotoDelay(){return __awaiter(this,void 0,void 0,lu.mark((function _callee14(){var t,a,u,m;return lu.wrap((function _callee14$(h){for(;;)switch(h.prev=h.next){case 0:if(0!==(t=Gt(this.channels)).length){h.next=5;break}return this.timer&&this.core.timerManager.deleteTimer(this.timer),this.timer=0,h.abrupt("return");case 5:this.logger.log("v2Signlling:autoDelay",t),a=0;case 7:if(!(a<t.length)){h.next=23;break}return u=t[a],h.prev=9,h.next=12,this.core.sendCmd("v2SignallingDelayRoom",{tag:{channelId:u}});case 12:m=h.sent,this.channels[u]=m.content.data.channelInfo,h.next=20;break;case 16:h.prev=16,h.t0=h.catch(9),this.logger.warn("signling:autoDelay "+u+" failed",h.t0),delete this.channels[u];case 20:a++,h.next=7;break;case 23:case"end":return h.stop()}}),_callee14,this,[[9,16]])})))},a.v2SignallingOnlineEventHandler=function v2SignallingOnlineEventHandler(t){var a=fillIdServer(t,t.content.data,"msgId","0"),u=a.msgId;!this.config.compatibleWithV1&&u&&Bu(u)&&this.core.sendCmd("v2SignallingBatchMarkRead",{sid:15,cid:11,ids:[u]}),this.handleLeaveRoom(a),this.emit("onOnlineEvent",formatSignalingEvent(a))},a.v2SignallingMultiClientEventHandler=function v2SignallingMultiClientEventHandler(t){this.handleLeaveRoom(t.content.data),this.emit("onMultiClientEvent",formatSignalingEvent(t.content.data))},a.v2SignallingOfflineEventHandler=function v2SignallingOfflineEventHandler(t){var a,u=this;if(t.content.datas&&t.content.datas.length>0){if(!this.config.compatibleWithV1){var m,h=map$6(m=t.content.datas).call(m,(function(t){return t.msgId}));h.length>0&&this.core.sendCmd("v2SignallingBatchMarkRead",{sid:15,cid:11,ids:h})}var g=map$6(a=t.content.datas).call(a,(function(t){return u.handleLeaveRoom(t),formatSignalingEvent(t)}));this.emit("onOfflineEvent",g)}},a.v2SignallingSyncChannelsHandler=function v2SignallingSyncChannelsHandler(t){var a=this;if(this.timer=0,this.channels={},t.content.datas&&t.content.datas.length>0){var u,m=t.content.datas;if(forEach$1(m).call(m,(function(t){var u=t.channelInfo.channelId;a.channels[u]=cloneDeep(t.channelInfo)})),!this.timer)this.timer=this.core.timerManager.addTimer(bind$1(u=this.aotoDelay).call(u,this),this.pollingInterval,-1);this.emit("onSyncRoomInfoList",m)}},a.handleLeaveRoom=function handleLeaveRoom(t){switch(t.attach.type){case 1:case 7:case 9:delete this.channels[t.channelInfo.channelId]}},V2NIMSignallingServiceImpl}(gp),LS={"19_1":"v2PublishEvent","14_2":"v2OnUserStatusChange","19_3":"v2SubscribeUserStatus","19_4":"v2UnsubscribeUserStatus","19_5":"v2UnsubscribeAllUserStatus","19_6":"v2QuerySubscribeEvent","19_7":"v2QueryAllSubscribeEvent","14_9":"v2OnMultiUserStatusChange"},VS="V2NIMSubscriptionService",US={eventType:{id:1,retType:"number"},statusType:{id:2,retType:"number"},uniqueId:3,extension:4,duration:{id:5,retType:"number"},onlineOnly:{id:6,retType:"boolean",converter:function converter(t){return t?1:2}},multiSync:{id:7,retType:"boolean",converter:boolToInt},publishTime:{id:10,retType:"number"},serverId:11,clientType:{id:12,retType:"number"},serverExtension:13,extensionReceived:14,accountId:103},DS={eventType:{id:1,retType:"number"},duration:{id:2,retType:"number"},immediateSync:{id:3,retType:"number",converter:boolToInt},accountId:102,subscribeTime:{id:105,retType:"number"}},qS={v2PublishEvent:{sid:19,cid:1,service:VS,params:[{type:"Property",name:"tag",reflectMapper:US}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(US)}]},v2OnUserStatusChange:{sid:14,cid:2,service:VS,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(US)}]},v2SubscribeUserStatus:{sid:19,cid:3,service:VS,params:[{type:"Property",name:"tag",reflectMapper:DS},{type:"StrArray",name:"accountIds"}],response:[{type:"StrArray",name:"failedList"}]},v2UnsubscribeUserStatus:{sid:19,cid:4,service:VS,params:[{type:"Property",name:"tag",reflectMapper:DS},{type:"StrArray",name:"accountIds"}],response:[{type:"StrArray",name:"failedList"}]},v2UnsubscribeAllUserStatus:{sid:19,cid:5,service:VS,params:[{type:"Property",name:"tag",reflectMapper:DS}]},v2QuerySubscribeEvent:{sid:19,cid:6,service:VS,params:[{type:"Property",name:"tag",reflectMapper:DS},{type:"StrArray",name:"accountIds"}],response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(DS)}]},v2QueryAllSubscribeEvent:{sid:19,cid:7,service:VS,params:[{type:"Property",name:"tag",reflectMapper:DS}],response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(DS)}]},v2OnMultiUserStatusChange:{sid:14,cid:9,service:VS,response:[{type:"PropertyArray",name:"data",reflectMapper:invertSerializeItem(US)}]}},BS={accountIds:{type:"array",required:!0,itemType:"string",min:1,max:100},duration:{type:"number",required:!1,min:60,max:2592e3},immediateSync:{type:"boolean",required:!1}},FS={accountIds:{type:"array",required:!1,itemType:"string",max:100}},GS={statusType:{type:"number",required:!0,min:1e4,max:2147483647},duration:{type:"number",required:!1,min:60,max:604800},extension:{type:"jsonstr",required:!1},onlineOnly:{type:"boolean",required:!1},multiSync:{type:"boolean",required:!1}},HS=function(t){function V2NIMSubscriptionServiceImpl(a){var u;return"v2"!==(u=t.call(this,"V2NIMSubscriptionService",a)||this).core.options.apiVersion?Qe(u):(registerParser({cmdMap:LS,cmdConfig:qS}),u)}wt(V2NIMSubscriptionServiceImpl,t);var a=V2NIMSubscriptionServiceImpl.prototype;return a.emit=function emit(a){for(var u,m,h,g,M=this.name+"::emit "+a.toString(),I=arguments.length,S=new Array(I>1?I-1:0),T=1;T<I;T++)S[T-1]=arguments[T];return(u=this.logger).log.apply(u,concat(m=[""+M]).call(m,S)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,S))},a.subscribeUserStatus=function subscribeUserStatus(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkLogin(),this.checkV2(),validate(BS,t,"",!0),u.next=5,this.core.sendCmd("v2SubscribeUserStatus",{tag:{eventType:1,duration:t.duration||60,immediateSync:void 0!==t.immediateSync&&t.immediateSync},accountIds:t.accountIds});case 5:return a=u.sent,u.abrupt("return",a.content.failedList);case 7:case"end":return u.stop()}}),_callee,this)})))},a.unsubscribeUserStatus=function unsubscribeUserStatus(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee2(){var a,u;return lu.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:if(this.checkLogin(),this.checkV2(),validate(FS,t,"",!0),a=[],!(t.accountIds.length>0)){m.next=11;break}return m.next=7,this.core.sendCmd("v2UnsubscribeUserStatus",{tag:{eventType:1},accountIds:t.accountIds});case 7:u=m.sent,a=u.content.failedList,m.next=15;break;case 11:return m.next=14,this.core.sendCmd("v2UnsubscribeAllUserStatus",{tag:{eventType:1}});case 14:a=[];case 15:return m.abrupt("return",a);case 16:case"end":return m.stop()}}),_callee2,this)})))},a.publishCustomUserStatus=function publishCustomUserStatus(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee3(){var a;return lu.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return this.checkLogin(),this.checkV2(),validate(GS,t,"",!0),u.next=5,this.core.sendCmd("v2PublishEvent",{tag:Ut(Ut({},t),{eventType:1,uniqueId:Gu(),duration:t.duration||60,onlineOnly:void 0===t.onlineOnly||t.onlineOnly,multiSync:void 0!==t.multiSync&&t.multiSync})});case 5:return a=u.sent,u.abrupt("return",a.content.data);case 7:case"end":return u.stop()}}),_callee3,this)})))},a.queryUserStatusSubscriptions=function queryUserStatusSubscriptions(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee4(){var a,u,m,h,g,M;return lu.wrap((function _callee4$(I){for(;;)switch(I.prev=I.next){case 0:if(this.checkLogin(),this.checkV2(),validate({accountIds:{type:"array",required:!0,itemType:"string",max:3e3}},{accountIds:t},"",!0),a=[],!(t.length>0)){I.next=16;break}u=0;case 6:if(!(u<t.length)){I.next=14;break}return I.next=9,this.core.sendCmd("v2QuerySubscribeEvent",{tag:{eventType:1},accountIds:slice(t).call(t,u,u+100)});case 9:h=I.sent,a=concat(a).call(a,map$6(m=h.content.data).call(m,(function(t){return{accountId:t.accountId,subscribeTime:t.subscribeTime,duration:t.duration}})));case 11:u+=100,I.next=6;break;case 14:I.next=20;break;case 16:return I.next=18,this.core.sendCmd("v2QueryAllSubscribeEvent",{tag:{eventType:1}});case 18:M=I.sent,a=concat(a).call(a,map$6(g=M.content.data).call(g,(function(t){return{accountId:t.accountId,subscribeTime:t.subscribeTime,duration:t.duration}})));case 20:return I.abrupt("return",a);case 21:case"end":return I.stop()}}),_callee4,this)})))},a.v2OnUserStatusChangeHandler=function v2OnUserStatusChangeHandler(t){var a=t.content.data,u=a.eventType,m=a.extensionReceived,h=__rest(a,["eventType","extensionReceived"]);1===u?this.emit("onUserStatusChanged",[Ut(Ut({},h),{extension:m})]):this.logger.log("v2OnUserStatusChangeHandler eventType = ",u,"msgEvent = ",a)},a.v2OnMultiUserStatusChangeHandler=function v2OnMultiUserStatusChangeHandler(t){var a,u=t.content.data,m=map$6(a=filter(u).call(u,(function(t){return 1===t.eventType}))).call(a,(function(t){t.eventType;var a=t.extensionReceived,u=__rest(t,["eventType","extensionReceived"]);return Ut(Ut({},u),{extension:a})}));m.length>0&&this.emit("onUserStatusChanged",m)},V2NIMSubscriptionServiceImpl}(gp);!function(t){t[t.V2NIM_PROXY_REQUEST_METHOD_GET=1]="V2NIM_PROXY_REQUEST_METHOD_GET",t[t.V2NIM_PROXY_REQUEST_METHOD_POST=2]="V2NIM_PROXY_REQUEST_METHOD_POST",t[t.V2NIM_PROXY_REQUEST_METHOD_PUT=3]="V2NIM_PROXY_REQUEST_METHOD_PUT",t[t.V2NIM_PROXY_REQUEST_METHOD_DELETE=4]="V2NIM_PROXY_REQUEST_METHOD_DELETE"}(OS||(OS={}));var jS="V2NIMPassthroughService",$S={"22_1":"v2ProxyRequest","22_2":"v2ProxyOnRequest"},zS={zone:1,path:2,method:3,header:4,body:5},WS={v2ProxyRequest:{sid:22,cid:1,service:jS,params:[{type:"Property",name:"tag",reflectMapper:zS}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(zS)}]},v2ProxyOnRequest:{sid:22,cid:2,service:jS,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem({fromAccountId:1,body:2,time:{id:3,retType:"number"}})}]}},KS={path:{type:"string",allowEmpty:!1},zone:{type:"string",required:!1},method:{type:"enum",values:[OS.V2NIM_PROXY_REQUEST_METHOD_DELETE,OS.V2NIM_PROXY_REQUEST_METHOD_GET,OS.V2NIM_PROXY_REQUEST_METHOD_POST,OS.V2NIM_PROXY_REQUEST_METHOD_PUT],required:!1},header:{type:"jsonstr",required:!1},body:{type:"string",required:!1}},YS=function(t){function V2NIMPassthroughServiceImpl(a){var u;return u=t.call(this,"V2NIMPassthroughService",a)||this,registerParser({cmdMap:$S,cmdConfig:WS}),u}wt(V2NIMPassthroughServiceImpl,t);var a=V2NIMPassthroughServiceImpl.prototype;return a.emit=function emit(a){for(var u,m,h,g,M=this.name+"::emit "+a.toString(),I=arguments.length,S=new Array(I>1?I-1:0),T=1;T<I;T++)S[T-1]=arguments[T];return(u=this.logger).log.apply(u,concat(m=[""+M]).call(m,S)),(h=t.prototype.emit).call.apply(h,concat(g=[this,a]).call(g,S))},a.httpProxy=function httpProxy(t){return __awaiter(this,void 0,void 0,lu.mark((function _callee(){var a;return lu.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(validate(KS,t,"",!0),!(t.method===OS.V2NIM_PROXY_REQUEST_METHOD_GET&&t.body||t.method===OS.V2NIM_PROXY_REQUEST_METHOD_POST&&!t.body||t.method===OS.V2NIM_PROXY_REQUEST_METHOD_PUT&&!t.body)){u.next=3;break}throw new Wl({code:jl.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"method "+t.method+", incorrect body"}});case 3:return u.next=5,this.core.sendCmd("v2ProxyRequest",{tag:t});case 5:return a=u.sent,u.abrupt("return",a.content.data);case 7:case"end":return u.stop()}}),_callee,this)})))},a.v2ProxyOnRequestHandler=function v2ProxyOnRequestHandler(t){var a=t.content.data;this.emit("onProxyNotify",a)},V2NIMPassthroughServiceImpl}(gp),QS=createCommonjsModule((function(t,a){t.exports=function(t){var add32=function(t,a){return t+a&4294967295},a=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function cmn(t,a,u,m,h,g){return a=add32(add32(a,t),add32(m,g)),add32(a<<h|a>>>32-h,u)}function ff(t,a,u,m,h,g,M){return cmn(a&u|~a&m,t,a,h,g,M)}function gg(t,a,u,m,h,g,M){return cmn(a&m|u&~m,t,a,h,g,M)}function hh(t,a,u,m,h,g,M){return cmn(a^u^m,t,a,h,g,M)}function ii(t,a,u,m,h,g,M){return cmn(u^(a|~m),t,a,h,g,M)}function md5cycle(t,a){var u=t[0],m=t[1],h=t[2],g=t[3];u=ff(u,m,h,g,a[0],7,-680876936),g=ff(g,u,m,h,a[1],12,-389564586),h=ff(h,g,u,m,a[2],17,606105819),m=ff(m,h,g,u,a[3],22,-1044525330),u=ff(u,m,h,g,a[4],7,-176418897),g=ff(g,u,m,h,a[5],12,1200080426),h=ff(h,g,u,m,a[6],17,-1473231341),m=ff(m,h,g,u,a[7],22,-45705983),u=ff(u,m,h,g,a[8],7,1770035416),g=ff(g,u,m,h,a[9],12,-1958414417),h=ff(h,g,u,m,a[10],17,-42063),m=ff(m,h,g,u,a[11],22,-1990404162),u=ff(u,m,h,g,a[12],7,1804603682),g=ff(g,u,m,h,a[13],12,-40341101),h=ff(h,g,u,m,a[14],17,-1502002290),u=gg(u,m=ff(m,h,g,u,a[15],22,1236535329),h,g,a[1],5,-165796510),g=gg(g,u,m,h,a[6],9,-1069501632),h=gg(h,g,u,m,a[11],14,643717713),m=gg(m,h,g,u,a[0],20,-373897302),u=gg(u,m,h,g,a[5],5,-701558691),g=gg(g,u,m,h,a[10],9,38016083),h=gg(h,g,u,m,a[15],14,-660478335),m=gg(m,h,g,u,a[4],20,-405537848),u=gg(u,m,h,g,a[9],5,568446438),g=gg(g,u,m,h,a[14],9,-1019803690),h=gg(h,g,u,m,a[3],14,-187363961),m=gg(m,h,g,u,a[8],20,1163531501),u=gg(u,m,h,g,a[13],5,-1444681467),g=gg(g,u,m,h,a[2],9,-51403784),h=gg(h,g,u,m,a[7],14,1735328473),u=hh(u,m=gg(m,h,g,u,a[12],20,-1926607734),h,g,a[5],4,-378558),g=hh(g,u,m,h,a[8],11,-2022574463),h=hh(h,g,u,m,a[11],16,1839030562),m=hh(m,h,g,u,a[14],23,-35309556),u=hh(u,m,h,g,a[1],4,-1530992060),g=hh(g,u,m,h,a[4],11,1272893353),h=hh(h,g,u,m,a[7],16,-155497632),m=hh(m,h,g,u,a[10],23,-1094730640),u=hh(u,m,h,g,a[13],4,681279174),g=hh(g,u,m,h,a[0],11,-358537222),h=hh(h,g,u,m,a[3],16,-722521979),m=hh(m,h,g,u,a[6],23,76029189),u=hh(u,m,h,g,a[9],4,-640364487),g=hh(g,u,m,h,a[12],11,-421815835),h=hh(h,g,u,m,a[15],16,530742520),u=ii(u,m=hh(m,h,g,u,a[2],23,-995338651),h,g,a[0],6,-198630844),g=ii(g,u,m,h,a[7],10,1126891415),h=ii(h,g,u,m,a[14],15,-1416354905),m=ii(m,h,g,u,a[5],21,-57434055),u=ii(u,m,h,g,a[12],6,1700485571),g=ii(g,u,m,h,a[3],10,-1894986606),h=ii(h,g,u,m,a[10],15,-1051523),m=ii(m,h,g,u,a[1],21,-2054922799),u=ii(u,m,h,g,a[8],6,1873313359),g=ii(g,u,m,h,a[15],10,-30611744),h=ii(h,g,u,m,a[6],15,-1560198380),m=ii(m,h,g,u,a[13],21,1309151649),u=ii(u,m,h,g,a[4],6,-145523070),g=ii(g,u,m,h,a[11],10,-1120210379),h=ii(h,g,u,m,a[2],15,718787259),m=ii(m,h,g,u,a[9],21,-343485551),t[0]=add32(u,t[0]),t[1]=add32(m,t[1]),t[2]=add32(h,t[2]),t[3]=add32(g,t[3])}function md5blk(t){var a,u=[];for(a=0;a<64;a+=4)u[a>>2]=t.charCodeAt(a)+(t.charCodeAt(a+1)<<8)+(t.charCodeAt(a+2)<<16)+(t.charCodeAt(a+3)<<24);return u}function md5blk_array(t){var a,u=[];for(a=0;a<64;a+=4)u[a>>2]=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+(t[a+3]<<24);return u}function md51(t){var a,u,m,h,g,M,I=t.length,S=[1732584193,-271733879,-1732584194,271733878];for(a=64;a<=I;a+=64)md5cycle(S,md5blk(t.substring(a-64,a)));for(u=(t=t.substring(a-64)).length,m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a=0;a<u;a+=1)m[a>>2]|=t.charCodeAt(a)<<(a%4<<3);if(m[a>>2]|=128<<(a%4<<3),a>55)for(md5cycle(S,m),a=0;a<16;a+=1)m[a]=0;return h=(h=8*I).toString(16).match(/(.*?)(.{0,8})$/),g=parseInt(h[2],16),M=parseInt(h[1],16)||0,m[14]=g,m[15]=M,md5cycle(S,m),S}function md51_array(t){var a,u,m,h,g,M,I=t.length,S=[1732584193,-271733879,-1732584194,271733878];for(a=64;a<=I;a+=64)md5cycle(S,md5blk_array(t.subarray(a-64,a)));for(u=(t=a-64<I?t.subarray(a-64):new Uint8Array(0)).length,m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a=0;a<u;a+=1)m[a>>2]|=t[a]<<(a%4<<3);if(m[a>>2]|=128<<(a%4<<3),a>55)for(md5cycle(S,m),a=0;a<16;a+=1)m[a]=0;return h=(h=8*I).toString(16).match(/(.*?)(.{0,8})$/),g=parseInt(h[2],16),M=parseInt(h[1],16)||0,m[14]=g,m[15]=M,md5cycle(S,m),S}function rhex(t){var u,m="";for(u=0;u<4;u+=1)m+=a[t>>8*u+4&15]+a[t>>8*u&15];return m}function hex(t){var a;for(a=0;a<t.length;a+=1)t[a]=rhex(t[a]);return t.join("")}function toUtf8(t){return/[\u0080-\uFFFF]/.test(t)&&(t=unescape(encodeURIComponent(t))),t}function utf8Str2ArrayBuffer(t,a){var u,m=t.length,h=new ArrayBuffer(m),g=new Uint8Array(h);for(u=0;u<m;u+=1)g[u]=t.charCodeAt(u);return a?g:h}function arrayBuffer2Utf8Str(t){return String.fromCharCode.apply(null,new Uint8Array(t))}function concatenateArrayBuffers(t,a,u){var m=new Uint8Array(t.byteLength+a.byteLength);return m.set(new Uint8Array(t)),m.set(new Uint8Array(a),t.byteLength),u?m:m.buffer}function hexToBinaryString(t){var a,u=[],m=t.length;for(a=0;a<m-1;a+=2)u.push(parseInt(t.substr(a,2),16));return String.fromCharCode.apply(String,u)}function SparkMD5(){this.reset()}return"5d41402abc4b2a76b9719d911017c592"!==hex(md51("hello"))&&(add32=function(t,a){var u=(65535&t)+(65535&a);return(t>>16)+(a>>16)+(u>>16)<<16|65535&u}),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function clamp(t,a){return(t=0|t||0)<0?Math.max(t+a,0):Math.min(t,a)}ArrayBuffer.prototype.slice=function(a,u){var m,h,g,M,I=this.byteLength,S=clamp(a,I),T=I;return u!==t&&(T=clamp(u,I)),S>T?new ArrayBuffer(0):(m=T-S,h=new ArrayBuffer(m),g=new Uint8Array(h),M=new Uint8Array(this,S,m),g.set(M),h)}}(),SparkMD5.prototype.append=function(t){return this.appendBinary(toUtf8(t)),this},SparkMD5.prototype.appendBinary=function(t){this._buff+=t,this._length+=t.length;var a,u=this._buff.length;for(a=64;a<=u;a+=64)md5cycle(this._hash,md5blk(this._buff.substring(a-64,a)));return this._buff=this._buff.substring(a-64),this},SparkMD5.prototype.end=function(t){var a,u,m=this._buff,h=m.length,g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(a=0;a<h;a+=1)g[a>>2]|=m.charCodeAt(a)<<(a%4<<3);return this._finish(g,h),u=hex(this._hash),t&&(u=hexToBinaryString(u)),this.reset(),u},SparkMD5.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},SparkMD5.prototype.setState=function(t){return this._buff=t.buff,this._length=t.length,this._hash=t.hash,this},SparkMD5.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},SparkMD5.prototype._finish=function(t,a){var u,m,h,g=a;if(t[g>>2]|=128<<(g%4<<3),g>55)for(md5cycle(this._hash,t),g=0;g<16;g+=1)t[g]=0;u=(u=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),m=parseInt(u[2],16),h=parseInt(u[1],16)||0,t[14]=m,t[15]=h,md5cycle(this._hash,t)},SparkMD5.hash=function(t,a){return SparkMD5.hashBinary(toUtf8(t),a)},SparkMD5.hashBinary=function(t,a){var u=hex(md51(t));return a?hexToBinaryString(u):u},SparkMD5.ArrayBuffer=function(){this.reset()},SparkMD5.ArrayBuffer.prototype.append=function(t){var a,u=concatenateArrayBuffers(this._buff.buffer,t,!0),m=u.length;for(this._length+=t.byteLength,a=64;a<=m;a+=64)md5cycle(this._hash,md5blk_array(u.subarray(a-64,a)));return this._buff=a-64<m?new Uint8Array(u.buffer.slice(a-64)):new Uint8Array(0),this},SparkMD5.ArrayBuffer.prototype.end=function(t){var a,u,m=this._buff,h=m.length,g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(a=0;a<h;a+=1)g[a>>2]|=m[a]<<(a%4<<3);return this._finish(g,h),u=hex(this._hash),t&&(u=hexToBinaryString(u)),this.reset(),u},SparkMD5.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},SparkMD5.ArrayBuffer.prototype.getState=function(){var t=SparkMD5.prototype.getState.call(this);return t.buff=arrayBuffer2Utf8Str(t.buff),t},SparkMD5.ArrayBuffer.prototype.setState=function(t){return t.buff=utf8Str2ArrayBuffer(t.buff,!0),SparkMD5.prototype.setState.call(this,t)},SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy,SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish,SparkMD5.ArrayBuffer.hash=function(t,a){var u=hex(md51_array(new Uint8Array(t)));return a?hexToBinaryString(u):u},SparkMD5}()}));var JS=function _interopDefault$1(t){return t&&"object"==typeof t&&"default"in t?t.default:t}(QS);var XS=class BMF{md5(t,a,u){this.aborted=!1,this.progress=0;let m=0;const h=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice,g=2097152,M=Math.ceil(t.size/g),I=new JS.ArrayBuffer,S=new FileReader;function loadNext(){const a=m*g,u=a+g>=t.size?t.size:a+g;S.readAsArrayBuffer(h.call(t,a,u))}loadNext(),S.onloadend=t=>{I.append(t.target.result),m++,this.progress=m/M,u&&"function"==typeof u&&u(this.progress),this.aborted?a("aborted"):m<M?loadNext():a(null,I.end())}}abort(){this.aborted=!0}},ZS=function(){function DataStructureConverterImpl(t){this.name="DataStructureConverter",this.core=t}var t=DataStructureConverterImpl.prototype;return t.messageConvertToV1=function messageConvertToV1(t){var a,u=deserialize(serialize(t,_h),invertSerializeItem(zy)),m=getSessionId(u,this.core.account),h=null===(a=this.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:m});return formatMsg$1(u,h?{account:this.core.account,sessionAck:h.ack,msgReceiptTime:h.msgReceiptTime}:{account:this.core.account})},t.messageConvertToV2=function messageConvertToV2(t){var a=deserialize(serialize(generatorMsgForCmd$1(t,t.from,t.fromDeviceId),zy),Sh);return(a=completeMessage(this.core,a)).sendingState="sending"===t.status?3:"sendFailed"===t.status?2:1,a},DataStructureConverterImpl}(),eT=function(){function V2NIMMessageConverterImpl(t){this.name="V2NIMMessageConverter",this.core=t}var t=V2NIMMessageConverterImpl.prototype;return t.messageSerialization=function messageSerialization(t){if(!t)return null;var a=serialize(t,_h);return Vn(a)},t.messageDeserialization=function messageDeserialization(t){var a,u,m,h,g,M,I,S,T,C,b,E,k,R,A,w,N,x,O,P,L,V,U;if(!t)return null;try{var D,q,B,G,H=deserialize(JSON.parse(t),Sh);return H.sendingState=0,1!==H.conversationType||H.senderId!==this.core.account&&H.receiverId!==this.core.account?2===H.conversationType?H.conversationId=this.core.V2NIMConversationIdUtil.teamConversationId(H.receiverId):3===H.conversationType&&(H.conversationId=this.core.V2NIMConversationIdUtil.superTeamConversationId(H.receiverId)):H.conversationId=this.core.V2NIMConversationIdUtil.p2pConversationId(H.senderId===this.core.account?H.receiverId:H.senderId),H.threadReply&&(H.threadReply.conversationType=H.conversationType,H.threadReply=completeMessageRefer(this.core,H.threadReply)),H.threadRoot&&(H.threadRoot.conversationType=H.conversationType,H.threadRoot=completeMessageRefer(this.core,H.threadRoot)),includes(D=[1,3,2,0]).call(D,H.conversationType)||this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid conversationType(enum): "+H.conversationType),H.senderId&&"string"!=typeof H.senderId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid senderId(string): "+H.senderId),H.receiverId&&"string"!=typeof H.receiverId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid receiverId(string): "+H.receiverId),"createTime"in H&&isNaN(H.createTime)&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid createTime(number): "+H.createTime),includes(q=[2,7,12,100,6,1,-1,4,5,11,0,10,3]).call(q,H.messageType)||this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid messageType(enum): "+H.messageType),"subType"in H&&isNaN(H.subType)&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid subType(number): "+H.subType),H.messageClientId&&"string"!=typeof H.messageClientId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid messageClientId(string): "+H.messageClientId),H.messageServerId&&"string"!=typeof H.messageServerId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid messageServerId(string): "+H.messageServerId),H.attachment&&"object"!=typeof H.attachment&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid attachment(object): "+H.attachment),H.text&&"string"!=typeof H.text&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid text(string): "+H.text),H.serverExtension&&"string"!=typeof H.serverExtension&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid serverExtension(string): "+H.serverExtension),H.callbackExtension&&"string"!=typeof H.callbackExtension&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid callbackExtension(string): "+H.callbackExtension),(null===(a=H.pushConfig)||void 0===a?void 0:a.pushContent)&&"string"!=typeof H.pushConfig.pushContent&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid pushContent(string): "+H.pushConfig.pushContent),(null===(u=H.pushConfig)||void 0===u?void 0:u.pushPayload)&&"string"!=typeof H.pushConfig.pushPayload&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid pushPayload(string): "+H.pushConfig.pushPayload),(null===(m=H.pushConfig)||void 0===m?void 0:m.forcePushContent)&&"string"!=typeof H.pushConfig.forcePushContent&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid forcePushContent(string): "+H.pushConfig.forcePushContent),(null===(h=H.pushConfig)||void 0===h?void 0:h.forcePushAccountIds)&&!Un(H.pushConfig.forcePushAccountIds)&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid forcePushAccountIds(array): "+H.pushConfig.forcePushAccountIds),(null===(g=H.routeConfig)||void 0===g?void 0:g.routeEnvironment)&&"string"!=typeof H.routeConfig.routeEnvironment&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid routeEnvironment(string): "+H.routeConfig.routeEnvironment),(null===(M=H.antispamConfig)||void 0===M?void 0:M.antispamBusinessId)&&"string"!=typeof H.antispamConfig.antispamBusinessId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid antispamBusinessId(string): "+H.antispamConfig.antispamBusinessId),(null===(I=H.antispamConfig)||void 0===I?void 0:I.antispamCustomMessage)&&"string"!=typeof H.antispamConfig.antispamCustomMessage&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid antispamCustomMessage(string): "+H.antispamConfig.antispamCustomMessage),(null===(S=H.antispamConfig)||void 0===S?void 0:S.antispamCheating)&&"string"!=typeof H.antispamConfig.antispamCheating&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid antispamCheating(string): "+H.antispamConfig.antispamCheating),(null===(T=H.antispamConfig)||void 0===T?void 0:T.antispamExtension)&&"string"!=typeof H.antispamConfig.antispamExtension&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid antispamExtension(string): "+H.antispamConfig.antispamExtension),(null===(C=H.robotConfig)||void 0===C?void 0:C.accountId)&&"string"!=typeof H.robotConfig.accountId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid accountId(string): "+H.robotConfig.accountId),(null===(b=H.robotConfig)||void 0===b?void 0:b.topic)&&"string"!=typeof H.robotConfig.topic&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid topic(string): "+H.robotConfig.topic),(null===(E=H.robotConfig)||void 0===E?void 0:E.function)&&"string"!=typeof H.robotConfig.function&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid function(string): "+H.robotConfig.function),(null===(k=H.robotConfig)||void 0===k?void 0:k.customContent)&&"string"!=typeof H.robotConfig.customContent&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid customContent(string): "+H.robotConfig.customContent),(null===(R=H.threadRoot)||void 0===R?void 0:R.senderId)&&"string"!=typeof H.threadRoot.senderId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid senderId(string): "+H.threadRoot.senderId),(null===(A=H.threadRoot)||void 0===A?void 0:A.receiverId)&&"string"!=typeof H.threadRoot.receiverId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid receiverId(string): "+H.threadRoot.receiverId),(null===(w=H.threadRoot)||void 0===w?void 0:w.messageClientId)&&"string"!=typeof H.threadRoot.messageClientId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid messageClientId(string): "+H.threadRoot.messageClientId),(null===(N=H.threadRoot)||void 0===N?void 0:N.messageServerId)&&"string"!=typeof H.threadRoot.messageServerId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid messageServerId(string): "+H.threadRoot.messageServerId),H.threadRoot&&"createTime"in H.threadRoot&&isNaN(H.threadRoot.createTime)&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid createTime(number): "+H.threadRoot.createTime),H.threadRoot&&!includes(B=[1,3,2,0]).call(B,H.threadRoot.conversationType)&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid conversationType(enum): "+H.threadRoot.conversationType),(null===(x=H.threadRoot)||void 0===x?void 0:x.conversationId)&&"string"!=typeof H.threadRoot.conversationId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid conversationId(string): "+H.threadRoot.conversationId),(null===(O=H.threadReply)||void 0===O?void 0:O.senderId)&&"string"!=typeof H.threadReply.senderId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid senderId(string): "+H.threadReply.senderId),(null===(P=H.threadReply)||void 0===P?void 0:P.receiverId)&&"string"!=typeof H.threadReply.receiverId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid receiverId(string): "+H.threadReply.receiverId),(null===(L=H.threadReply)||void 0===L?void 0:L.messageClientId)&&"string"!=typeof H.threadReply.messageClientId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid messageClientId(string): "+H.threadReply.messageClientId),(null===(V=H.threadReply)||void 0===V?void 0:V.messageServerId)&&"string"!=typeof H.threadReply.messageServerId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid messageServerId(string): "+H.threadReply.messageServerId),H.threadReply&&"createTime"in H.threadReply&&isNaN(H.threadReply.createTime)&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid createTime(number): "+H.threadReply.createTime),H.threadReply&&!includes(G=[1,3,2,0]).call(G,H.threadReply.conversationType)&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid conversationType(enum): "+H.threadReply.conversationType),(null===(U=H.threadReply)||void 0===U?void 0:U.conversationId)&&"string"!=typeof H.threadReply.conversationId&&this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid conversationId(string): "+H.threadReply.conversationId),delete H.__clientExt,delete H.userUpdateTime,H}catch(a){return this.core.logger.error("V2NIMMessageConverterImpl.messageDeserialization: invalid message string: "+t),null}},V2NIMMessageConverterImpl}();!function setAdapters(t){merge$1(uu,t())}((function getAdapter(){return{setLogger:setLogger,platform:"BROWSER",localStorage:window.localStorage,request:dd,WebSocket:window.WebSocket,uploadFile:uploadFileFn,getFileUploadInformation:getFileUploadInformationFn,getSystemInfo:getSystemInfoFn,net:Ud,powerMonitor:new Bd,logStorage:jd}})),ud.registerService(Cp,"V1NIMLoginService"),ud.registerService(Xy,"msg"),ud.registerService(rM,"user"),ud.registerService(uM,"session"),ud.registerService(pM,"team"),ud.registerService(fM,"systemMessage"),ud.registerService(TM,"friend"),ud.registerService(RM,"event"),ud.registerService(PM,"msgExtend"),ud.registerService(GM,"msgLog"),ud.registerService(WM,"passThrough"),ud.registerService(ig,"cloudStorage"),ud.registerService(pI,"superTeam"),ud.registerService(tM,"sync"),ud.registerService(gI,"plugin"),ud.registerService(_I,"cloudSession"),ud.registerService(LI,"signaling"),ud.registerService(cm,"V2NIMLoginService"),ud.registerService(Gg,"V2NIMLocalConversationService"),ud.registerService(lv,"V2NIMConversationService"),ud.registerService(Mg,"V2NIMMessageService"),ud.registerService(tS,"V2NIMNotificationService"),ud.registerService(sg,"V2NIMStorageService"),ud.registerService(Fh,"V2NIMStorageUtil"),ud.registerService(hv,"V2NIMConversationGroupService"),ud.registerService(df,"V2NIMTeamService"),ud.registerService(_f,"V2NIMUserService"),ud.registerService(Pf,"V2NIMFriendService"),ud.registerService(uy,"V2NIMSettingService"),ud.registerService(aS,"V2NIMSyncService"),ud.registerService(vS,"V2NIMAIService"),ud.registerService(ZS,"DataStructureConverter"),ud.registerService(eT,"V2NIMMessageConverter"),ud.registerService(Iv,"V2NIMMessageLogUtil"),ud.registerService(xv,"V2NIMMessageExtendUtil"),ud.registerService(PS,"V2NIMSignallingService"),ud.registerService(HS,"V2NIMSubscriptionService"),ud.registerService(YS,"V2NIMPassthroughService"),ud.registerService(dg,"YSFService"),ud.registerService(f_,"qchatChannel"),ud.registerService(C_,"qchatMedia"),ud.registerService(J_,"qchatMsg"),ud.registerService(Z_,"qchatRole"),ud.registerService(eS,"qchatServer"),ud.registerPlugin(XS,"browser-md5-file"),ud.registerPrivateService((function EventForwardCenter(t){var a=this;this.bindEvents=function(){a.core.eventBus.on("forwardSend/msg/sendMsg",a.onV1SendMsg),a.core.eventBus.on("forwardSend/msg/recallMsg",a.onV1RecallMsg),a.core.eventBus.on("forwardSend/msg/deleteSelfMsgs",a.onV1DeleteSelfMsgs),a.core.eventBus.on("forwardSend/msgLog/clearHistoryMsgsFromServer",a.onV1ClearHistoryMessage),a.core.eventBus.on("forwardSend/V2NIMMessageService/sendMsg",a.onV2SendMsg),a.core.eventBus.on("forwardSend/V2NIMMessageService/modifyMsg",a.onV2ModifyMsg),a.core.eventBus.on("forwardSend/V2NIMMessageService/revokeMessage",a.onV2RevokeMessage),a.core.eventBus.on("forwardSend/V2NIMMessageService/deleteSelfMsgs",a.onV2DeleteSelfMsgs),a.core.eventBus.on("forwardSend/V2NIMMessageLogService/clearHistoryMessage",a.onV2ClearHistoryMessage),a.core.eventBus.on("forwardSend/team/created",a.onV1TeamCreated),a.core.eventBus.on("forwardSend/team/updateMyMemberInfo",a.onV1TeamMemberUpdate),a.core.eventBus.on("forwardSend/superTeam/updateMyMemberInfo",a.onV1SuperTeamMemberUpdate),a.core.eventBus.on("forwardSend/V2NIMTeamService/updateSelfTeamMemberInfo",a.onV2TeamMemberUpdate),a.core.eventBus.on("forwardSend/team/passTeamApply",(function(t,u){return a.onV1TeamApply(t,1,1,u)})),a.core.eventBus.on("forwardSend/superTeam/passSuperTeamApply",(function(t,u){a.onV1TeamApply(t,2,1,u)})),a.core.eventBus.on("forwardSend/team/rejectTeamApply",(function(t,u){a.onV1TeamApply(t,1,2,u)})),a.core.eventBus.on("forwardSend/superTeam/rejectSuperTeamApply",(function(t,u){a.onV1TeamApply(t,2,2,u)})),a.core.eventBus.on("forwardSend/team/acceptTeamInvite",(function(t,u){a.onV1TeamInvite(t,1,1,u)})),a.core.eventBus.on("forwardSend/superTeam/acceptSuperTeamInvite",(function(t,u){a.onV1TeamInvite(t,2,1,u)})),a.core.eventBus.on("forwardSend/team/rejectTeamInvite",(function(t,u){a.onV1TeamInvite(t,1,2,u)})),a.core.eventBus.on("forwardSend/superTeam/rejectSuperTeamInvite",(function(t,u){a.onV1TeamInvite(t,2,2,u)})),a.core.eventBus.on("forwardSend/user/updateBlackList",a.onV1UpdateBlackList),a.core.eventBus.on("forwardSend/user/updateUserInfo",a.onV1UpdateUserInfo),a.core.eventBus.on("forwardSend/user/setMute",a.onV1SetMute),a.core.eventBus.on("forwardSend/friend/addFriend",a.onV1AddFriend),a.core.eventBus.on("forwardSend/friend/deleteFriend",a.onV1DeleteFriend),a.core.eventBus.on("forwardSend/friend/updateFriend",a.onV1UpdateFriend),a.core.eventBus.on("forwardSend/friend/passFriendApply",a.onV1PassFriendApply),a.core.eventBus.on("forwardSend/friend/rejectFriendApply",a.onV1RejectFriendApply)},this.onV1TeamApply=function(t,u,m,h){if(h){if(!a.core.V2NIMTeamService.notification.checkIfExpired(h))return;m=3}a.core.eventBus.emit("forwardReceive/V2NIMTeamService/updateTeamActionStatus",{teamId:t.teamId,teamType:u,operatorAccountId:t.from,actionType:0},m)},this.onV1TeamInvite=function(t,u,m,h){if(h){if(!a.core.V2NIMTeamService.notification.checkIfExpired(h.code))return;m=3}a.core.eventBus.emit("forwardReceive/V2NIMTeamService/updateTeamActionStatus",{teamId:t.teamId,teamType:u,operatorAccountId:t.from,actionType:2},m)},this.onV1PassFriendApply=function(t,u){a.core.eventBus.emit("forwardReceive/V2NIMFriendService/acceptAddApplication",t,u)},this.onV1RejectFriendApply=function(t,u,m){a.core.eventBus.emit("forwardReceive/V2NIMFriendService/rejectAddApplication",{applicantAccountId:t,recipientAccountId:a.core.account,operatorAccountId:a.core.account,postscript:u||"",timestamp:a.core.timeOrigin.getNTPTime(),read:!0,status:3},m)},this.onV1SetMute=function(t,u){a.core.eventBus.emit("forwardReceive/v2NIMSettingService/setP2PMessageMuteMode",t,u?1:0)},this.onV1UpdateFriend=function(t){a.core.eventBus.emit("forwardReceive/V2NIMFriendService/setFriendInfo",t.account,Ut(Ut({},"alias"in t?{alias:t.alias}:{}),"ext"in t?{serverExtension:t.ext}:{}))},this.onV1AddFriend=function(t){a.core.eventBus.emit("forwardReceive/V2NIMFriendService/addFriend",t)},this.onV1DeleteFriend=function(t){a.core.eventBus.emit("forwardReceive/V2NIMFriendService/deleteFriend",t)},this.onV1UpdateUserInfo=function(t){var u=deserialize(serialize(t,xy.user),invertSerializeItem(hf));a.core.eventBus.emit("forwardReceive/V2NIMUserService/updateUserProfile",u)},this.onV1UpdateBlackList=function(t,u){a.core.eventBus.emit("forwardReceive/V2NIMUserService/updateBlockList",t,u)},this.onV1TeamCreated=function(t){var u=deserialize(serialize(generateTeam(t),Ry.team),invertSerializeItem(ph));a.core.eventBus.emit("forwardReceive/V2NIMTeamService/created",u)},this.onV1TeamMemberUpdate=function(t){(t=Ut({},t)).type&&(t.type={normal:0,owner:1,manager:2}[t.type]);var u=deserialize(serialize(t,Ry.teamMember),invertSerializeItem(mh));u.teamType=1,a.core.eventBus.emit("forwardReceive/V2NIMTeamService/updateSelfTeamMemberInfo",u)},this.onV1SuperTeamMemberUpdate=function(t){(t=Ut({},t)).type&&(t.type={normal:0,owner:1,manager:2}[t.type]);var u=deserialize(serialize(t,lI.superTeamMember),invertSerializeItem(gh));u.teamType=2,a.core.eventBus.emit("forwardReceive/V2NIMTeamService/updateSelfTeamMemberInfo",u)},this.onV2TeamMemberUpdate=function(t){var u=t.teamType,m=serialize(t,mh);if(2===u){var h=deserialize(m,invertSerializeItem(lI.superTeamMember));a.core.eventBus.emit("forwardReceive/superTeam/updateMyMemberInfo",h)}else{var g=deserialize(m,invertSerializeItem(Ry.teamMember));a.core.eventBus.emit("forwardReceive/team/updateMyMemberInfo",g)}},this.onV1SendMsg=function(t){var u=deserialize(serialize(t,zy),Sh);(u=completeMessage(a.core,u)).sendingState="sending"===t.status?3:"sent"===t.status?1:2,a.core.eventBus.emit("forwardReceive/V2NIMMessageService/sendMsg",u)},this.onV2SendMsg=function(t){var u=deserialize(serialize(t,_h),invertSerializeItem(zy));u.status=3===t.sendingState?"sending":1===t.sendingState?"sent":"sendFailed",a.core.eventBus.emit("forwardReceive/msg/sendMsg",u)},this.onV2ModifyMsg=function(t){var u=deserialize(serialize(t,_h),invertSerializeItem(zy));a.core.eventBus.emit("forwardReceive/msg/modifyMsg",u)},this.onV1RecallMsg=function(t){t.deleteMsgCreatetime=t.time;var u=deserialize(serialize(t,Wy.recallMsgTag),invertSerializeItem(bh));a.core.eventBus.emit("forwardReceive/V2NIMMessageService/revokeMessages",[u])},this.onV2RevokeMessage=function(t){var u=deserialize(serialize(t,bh),Ky.recallMsgTag);a.core.eventBus.emit("forwardReceive/msg/recallMsg",u)},this.onV1DeleteSelfMsgs=function(t){var u=map$6(t).call(t,(function(t){return deserialize(serialize(t,Wy.deleteSelfMsgTag),invertSerializeItem(Th))}));forEach$1(u).call(u,(function(t){t.messageRefer=formatMessageRefer(a.core,t.messageRefer)})),a.core.eventBus.emit("forwardReceive/V2NIMMessageService/deleteMessages",u)},this.onV2DeleteSelfMsgs=function(t){var u=map$6(t).call(t,(function(t){return deserialize(serialize(t,Th),Ky.deleteSelfMsgTag)}));a.core.eventBus.emit("forwardReceive/msg/deleteSelfMsgs",u)},this.onV1ClearHistoryMessage=function(t){var u=deserialize(serialize(t,UM.clearHistoryMsgsFromServerReqTag),invertSerializeItem(fv));a.core.eventBus.emit("forwardReceive/V2NIMMessageLogService/clearHistoryMessage",u)},this.onV2ClearHistoryMessage=function(t){var u=deserialize(serialize(t,fv),DM.clearHistoryMsgsFromServerReqTag);a.core.eventBus.emit("forwardReceive/msgLog/clearHistoryMsgsFromServer",u)},this.core=t,this.bindEvents()}),"eventForwardCenter"),t.V2NIMConst=zl,t.default=ud,Object.defineProperty(t,"__esModule",{value:!0})}));