@tencentcloud/chat
Version:
Tencent Cloud Chat SDK for Web/Mini Program/uni-app/React Native/Donut
1 lines • 143 kB
JavaScript
let e=2,t=4,s=10,o=11,r=12,i=14,n=17,a=20,u=23,p=26,l=27,c=29,h=30,g=34;class m{constructor(e=0,t=0){this.high=e,this.low=t}equal(e){return null!==e&&this.low===e.low&&this.high===e.high}toString(){var e=Number(this.high).toString(16);let t=Number(this.low).toString(16);if(t.length<8){let e=8-t.length;for(;e;)t="0"+t,e--}return e+t}}let d={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",BACKUP_WEB:"wss://*w4c.my-cpaas.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",BACKUP_WEB:"wss://*w4c.my-cpaas.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT0:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",IPV6:"wss://wsssgpv6.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",BACKUP_WEB:"wss://*w4s.my-cpaas.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT0:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",IPV6:"wss://wsskrv6.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",BACKUP_WEB:"wss://*w4k.my-cpaas.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT0:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",IPV6:"wss://wssgerv6.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",BACKUP_WEB:"wss://*w4g.my-cpaas.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT0:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",IPV6:"wss://wssindv6.im.qcloud.com",BACKUP:"wss://wssind.im.qcloud.com",BACKUP_WEB:"wss://*w4i.my-cpaas.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.19.46"},JPN:{DEFAULT0:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",IPV6:"wss://wssjpnv6.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",BACKUP_WEB:"wss://*w4j.my-cpaas.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT0:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",IPV6:"wss://wssusav6.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",BACKUP_WEB:"wss://*w4u.my-cpaas.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT0:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",IPV6:"wss://wssidnv6.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",BACKUP_WEB:"wss://*w4y.my-cpaas.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},_={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},f="CHINA",M={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(e=f){this.CURRENT=d.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GRP:"group_open_http_svc",GRP_AV:"group_open_avchatroom_http_svc",GRP_COMMUNITY:"million_group_open_http_svc",GRP_ATTR:"group_open_attr_http_svc",FD:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GRP_NO_AUTH:"group_open_http_noauth_svc",BIG_GRP_POLLING:"group_open_long_polling_http_svc",BIG_GRP_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MSG:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate",IM_OPEN_SPEECH:"im_open_speech",MSG_SEARCH:"message_search",GRP_SEARCH:"group_search",GRP_MEMBER_SEARCH:"group_member_search",USER_SEARCH:"user_search",FOLLOW:"follow",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},I={SEARCH_GRP_SNS:new m(0,Math.pow(2,1)).toString(),AV_HISTORY_MSG:new m(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new m(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new m(0,Math.pow(2,4)).toString(),AV_MBR_LIST:new m(0,Math.pow(2,6)).toString(),USER_STATUS:new m(0,Math.pow(2,7)).toString(),CONV_MARK:new m(0,Math.pow(2,9)).toString(),CONV_GROUP:new m(0,Math.pow(2,10)).toString(),AV_BAN_MBR:new m(0,Math.pow(2,11)).toString(),MSG_EXT:new m(0,Math.pow(2,13)).toString(),GRP_COUNTER:new m(0,Math.pow(2,15)).toString(),PLUGIN_TRANSLATE:new m(Math.pow(2,6)).toString(),PLUGIN_VOICE_TO_TEXT:new m(Math.pow(2,7)).toString(),PLUGIN_CS:new m(Math.pow(2,8)).toString(),PLUGIN_PUSH:new m(Math.pow(2,9)).toString(),PLUGIN_BOT:new m(Math.pow(2,10)).toString(),MSG_REACTION:new m(Math.pow(2,16)).toString(),FOLLOW:new m(Math.pow(2,20)).toString()},y="group_profile",D="group_member_profile",L=["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption"],C=["Role","JoinTime","MsgSeq","MsgFlag"],G=(M.HOST.setCurrent(f),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&("mac"===wx.getSystemInfoSync().platform||"windows"===wx.getSystemInfoSync().platform)),b="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)||G,A=(b&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),T="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),v="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),S="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),P="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,R="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,w=b&&"object"==typeof wx.miniapp,$=b||A||T||v||S||R||P,E="undefined"==typeof window&&!$&&"undefined"!=typeof global&&void 0!==global.NativeScriptGlobals,U="undefined"!=typeof global&&(void 0!==global.nativeModuleProxy||void 0!==global.ReactNative),q="undefined"!=typeof uni?!$:"undefined"!=typeof window&&!$&&!U,N=(A?qq:T?tt:v?swan:S?my:b?wx:R?uni:P&&jd,q&&window&&window.navigator&&window.navigator.userAgent||""),k=/(micromessenger|webbrowser)/i.test(N),O=function(){let e="WEB";return k?e="WEB":A?e="QQ_MP":T?e="TT_MP":v?e="BAIDU_MP":S?e="ALI_MP":b?e=w?"DONUT_NATIVE_APP":"WX_MP":R?e="UNI_NATIVE_APP":E?e="NS_NATIVE_APP":U&&(e="RN_NATIVE_APP"),_[e]}(),F=(!function(){var e=N.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),function(){var e,t,s=N.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);s&&(e=s[1]&&parseFloat(s[1]),t=s[2]&&parseFloat(s[2]),e)&&t&&parseFloat(s[1]+"."+s[2])}(),/MSIE/.test(N)||-1<N.indexOf("Trident")&&-1<N.indexOf("rv:11.0")),x,V,H=(!function(){var e=/MSIE\s(\d+)\.\d/.exec(N),e=e&&parseFloat(e[1]);!e&&/Trident\/7.0/i.test(N)&&/rv:11.0/.test(N)}(),x="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{},function(){}),B=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],K=B.length;for(;K--;)V=B[K],console[V]||(x[V]=H);var j=x;let J="TIMTextElem",W="TIMImageElem",z="TIMSoundElem",X="TIMFileElem",Y="TIMFaceElem",Q="TIMVideoFileElem",Z="TIMLocationElem",ee="TIMGroupTipElem",te="TIMGroupSystemNoticeElem",se="TIMCustomElem",oe="TIMRelayElem",re="High",ie="Normal",ne="Low",ae="Lowest",ue="C2C",pe="GROUP",le="TOPIC",ce="@TIM#SYSTEM",he="Private",ge="Public",me="ChatRoom",de="AVChatRoom",_e="Community",fe="Room",Me="Live",Ie="Owner",ye="Admin",De="Member",Le="Custom",Ce=1,Ge=3,be=4,Ae=5,Te="AcceptAndNotify",ve="AlreadyInGroup",Se="__kImSDK_MesssageAtALL__",Pe=function(){return(new Date).getTime()+0},Re={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},we={NICK:"Tag_Profile_IM_Nick",GENDER:"Tag_Profile_IM_Gender",BIRTHDAY:"Tag_Profile_IM_BirthDay",LOCATION:"Tag_Profile_IM_Location",SELFSIGNATURE:"Tag_Profile_IM_SelfSignature",ALLOWTYPE:"Tag_Profile_IM_AllowType",LANGUAGE:"Tag_Profile_IM_Language",AVATAR:"Tag_Profile_IM_Image",MESSAGESETTINGS:"Tag_Profile_IM_MsgSettings",ADMINFORBIDTYPE:"Tag_Profile_IM_AdminForbidType",LEVEL:"Tag_Profile_IM_Level",ROLE:"Tag_Profile_IM_Role"},$e="JoinedSuccess",Ee="WaitAdminApproval",Ue="@TGS#_",qe="@TOPIC#_",Ne=Object.prototype.hasOwnProperty;function ke(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(Be(e)){for(var t in e)if(Ne.call(e,t))return!1;return!0}return!!(Oe(e)||Fe(e)||xe(e))&&0===e.size}let Oe=function(e){return"map"===We(e)},Fe=function(e){return"set"===We(e)},xe=function(e){return"file"===We(e)},Ve=function(e){return null!==e&&("number"==typeof e&&!isNaN(+e)||"object"==typeof e&&e.constructor===Number)},He=function(e){return"string"==typeof e},Be=function(e){if("object"!=typeof e||null===e)return!1;e=Object.getPrototypeOf(e);if(null===e)return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t},Ke=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===We(e)},je=function(e){return void 0===e},Je=function(e){return Ke(e)||null!==e&&"object"==typeof e},We=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},ze=(Date.now||(Date.now=function(){return(new Date).getTime()}),function(s,o,r,i){if(!Je(s)||!Je(o))return 0;let n=0;var a,u=Object.keys(o);for(let e=0,t=u.length;e<t;e++)if(a=u[e],!(je(o[a])||r&&r.includes(a)))if(Je(s[a])&&Je(o[a]))n+=ze(s[a],o[a],r,i);else{if(i&&i.includes(o[a]))continue;s[a]!==o[a]&&(s[a]=o[a],n+=1)}return n}),Xe=function(e){e=e||99999999;return Math.round(Math.random()*e)},Ye={},Qe=function(e){if(0===Object.getOwnPropertyNames(e).length)return Object.create(null);var t,s,o=Array.isArray(e)?[]:Object.create(null);for(s in e)null!==e[s]?void 0!==e[s]?(t=typeof e[s],0<=["string","number","function","boolean"].indexOf(t)?o[s]=e[s]:o[s]=Qe(e[s])):o[s]=void 0:o[s]=null;return o};function Ze(o,e){if(!Ke(o)||!Ke(e))return!1;let r=!1;return e.forEach(({key:t,value:e})=>{var s=o.find(e=>e.key===t);s?s.value!==e&&(s.value=e,r=!0):(o.push({key:t,value:e}),r=!0)}),r}function et(e){return ke(e)?[]:e.filter(e=>!0===e.isModified)}function st(e){var t;if(Be(e)&&Be(e.webhookInfo))return t=[],e.webhookInfo.disableCloudMessagePreHook&&t.push("ForbidBeforeSendMsgCallback"),e.webhookInfo.disableCloudMessagePostHook&&t.push("ForbidAfterSendMsgCallback"),0!==t.length?t:void 0}function ot(e){return ke(e)?[]:e.filter(e=>!1===e.isModified)}let rt=e=>e===de,it=({type:e,groupID:t})=>e===_e||(""+t).startsWith(Ue)&&!(""+t).includes(qe),nt=e=>(""+e).startsWith(Ue)&&(""+e).includes(qe);function at(e){return e.split(qe)[0]}function ut(){return!F&&!$}function pt(e,t=!0,s=!0){var o=Date.now();return t?s?o-e+" ms":Math.round((o-e)/1e3)+" s":s?o-e:Math.round((o-e)/1e3)}let lt=0;function ct(){return ut()?"%c Chat %c":"Chat"}function ht(){(e=new Date).setTime(Pe());var e;return e.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){let t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(e.getMilliseconds())}let gt={arguments2String(s){let o="";if(1===s.length)o=s[0];else for(let e=0,t=s.length;e<t;e++){if(Je(s[e]))try{o+=s[e]instanceof Error?JSON.stringify(s[e],["message","code"]):JSON.stringify(s[e])}catch(e){o+=e?e.message:"";break}else o+=s[e];o+=" "}return o},_exec(e,t){ut()?j[e](ct(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",ht(),t):j[e](`${ct()} ${ht()} `+t)},d:function(){var e;lt<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;lt<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;lt<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;lt<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;lt<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;lt<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+lt+" to "+e),lt=e},getLevel:function(){return lt}},mt=function(e){return{code:0,data:e||{}}};class dt extends Error{constructor(e){super();var{code:e,message:t,data:s}=e;this.code=e,t?this.message=t:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=s||{}}}let _t=2101,ft=2114,Mt=2600,It=2602,yt=2603,Dt=2620,Lt=2621,Ct=2623,Gt=2660,bt=2661,At=2662,Tt=2681,vt=2683,St=2684,Pt=2685,Rt=2686,wt=2687,$t=2805,Et=2903,Ut=2996,qt=3122,Nt=3123,kt="onMessageReceived",Ot="onMessageModified",Ft="onMessageRevoked",xt="onGroupListUpdated",Vt="groupAttributesUpdated",Ht="onGroupCounterUpdated",Bt="onTopicUpdated",Kt="error",jt="onPinnedGroupMessageUpdated",Jt=null,Wt=function(e){return Promise.resolve(mt(e))},zt=function(e,t=!1){if(e instanceof dt)return t&&null!==Jt&&Jt.emit(Kt,e),Promise.reject(e);if(e instanceof Error){let e=new dt({code:Et});return t&&null!==Jt&&Jt.emit(Kt,e),Promise.reject(e)}return je(e)||je(e.code)?Promise.reject(new dt({code:Et})):(e=new dt(e),t&&null!==Jt&&Jt.emit(Kt,e),Promise.reject(e))},Xt={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"},Yt="messageReceivedGroup",Qt="messageReceivedGroupAVPush",Zt="messageReceivedGroupAVPull",es={info:4,warning:5,error:6},ts={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},ss={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16,tui_key_features:16};class os{constructor(e){this._n="SSOLogData",this.eventType=ss[e]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=e,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=Pe()}static bindEventStatModule(e){os.prototype._eventStatModule=e}static bindNetMonitorModule(e){os.prototype._netMonitorModule=e}updateTimeStamp(){this.timestamp=Pe()}start(e){return this._startts=e,this}end(e=!1){if(!this._sentFlag){if(this._netMonitorModule){let e=this._netMonitorModule.getNetworkType();this.setNetworkType(e)}var t=Pe();0===this.costTime&&(this.costTime=t-this._startts),this.setMoreMessage(`startts:${this._startts} endts:`+t),e?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout(()=>{this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)},0)}}setError(t){if(t instanceof Error){if(!this._sentFlag){let e=!0;if(e=this._netMonitorModule?this._netMonitorModule.isOnline():e)t.code&&this.setCode(t.code),t.message&&this.setMoreMessage(t.message);else{let e=$t;this.setCode(e)}this.setLevel("error")}}else gt.w(this._n+".setError value not instanceof Error, please check!");return this}setCode(e){return je(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),Ve(e)?this.code=e:gt.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return je(e)||this._sentFlag||(Ve(e)&&(this.message=e.toString()),He(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return je(e)||this._sentFlag||(this.level=es[e]),this}setMoreMessage(e){return ke(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){return je(e)?gt.w(this._n+".setNetworkType value is undefined, please check!"):(e=ts[e.toLowerCase()],je(e)||(this.networkType=e)),this}getStartTs(){return this._startts}setUIPlatform(e){return this.uiPlatform=e,this}setExtension(e){return this.extension=e,this}setEventType(e){return this.eventType=e,this}}let rs="send_group_msg",is="get_joined_group_list",ns="get_group_self_member_info",as="create_group",us="destroy_group",ps="modify_group_base_info",ls="apply_join_group",cs="apply_join_group_noauth",hs="quit_group",gs="get_group_public_info",ms="change_group_owner",ds="handle_apply_join_group",_s="handle_invite_join_permission_group",fs="handle_invite_join_group",Ms="group_msg_recall",Is="msg_read_report",ys="group_msg_get",Ds="get_group_msg_receipt",Ls="group_msg_receipt",Cs="get_group_msg_receipt_detail",Gs="get_group_msg_receipts_by_users",bs="get_pendency",As="deletemsg",Ts="get_msg",vs="get_msg_noauth",Ss="get_online_member_num",Ps="delete_group_ramble_msg_by_seq",Rs="modify_group_msg",ws="set_group_attr",$s="modify_group_attr",Es="delete_group_attr",Us="clear_group_attr",qs="get_group_attr",Ns="group_set_key_values",ks="group_get_key_values",Os="batch_get_group_notify",Fs="update_group_counter",xs="get_group_counter",Vs="pin_message",Hs="unpin_message",Bs="get_pinned_messages",Ks="get_group_member_info",js="get_members",Js="get_specified_group_member_info",Ws="add_group_member",zs="delete_group_member",Xs="ban_group_member",Ys="modify_group_member_info",Qs="modify_user_info",Zs="unSend",eo="success",to="notStart",so="resolved",oo="rejected";class ro{constructor(e){this.type=J,this.content={text:e.text||""}}setText(e){this.content.text=e}sendable(){return 0!==this.content.text.length}}function io(e,t,s,o=[]){if(!e)return e;let r=e;return t&&(e.startsWith("http://")?r=e.replace(/^http:\/\/[^/]+/,t):e.startsWith("https://")&&(r=e.replace(/^https:\/\/[^/]+/,t))),r=s&&-1===r.indexOf("authKey=")&&uo(r,o)?-1<r.indexOf("?")?r+"&authKey="+s:r+"?authKey="+s:r}function no(e,s,o=[]){let t=s[0].content||s[0].payload;if(e===W)t.imageInfoArray.forEach(e=>{uo(e.imageUrl,o)&&(e.imageUrl=ao(e.imageUrl))});else if(e===Q)uo(t.snapshotUrl,o)&&(t.snapshotUrl=ao(t.snapshotUrl),t.thumbUrl=ao(t.thumbUrl)),uo(t.remoteVideoUrl,o)&&(t.remoteVideoUrl=ao(t.remoteVideoUrl));else if(e===z)uo(t.remoteAudioUrl,o)&&(t.remoteAudioUrl=ao(t.remoteAudioUrl));else if(e===X)uo(t.fileUrl,o)&&(t.fileUrl=ao(t.fileUrl));else if(e===oe){let{downloadKey:e="",messageList:t=[]}=s[0].content||s[0].payload;ke(e)&&t.forEach(e=>{no(e.messageBody[0].type,e.messageBody,o)})}return s}function ao(e){if(!e)return e;if(-1===e.indexOf("authKey="))return e;var e=e.split("?"),t=e[1].split("&");let s=0;for(let e=0;e<t.length;e++)if(-1<t[e].indexOf("authKey=")){s=e;break}return t.splice(s,1),0<t.length?e[0]+"?"+t.join("&"):e[0]}function uo(e,t){let s=!1;if(e){var e=e.match(/:\/\/([0-9]?\.)?(.[^/:]+)/),o=e&&e[2]||"";if(o.includes("rich-dev"))return!0;for(let e=0;e<t.length;e++)if(o.endsWith(t[e])){s=!0;break}}return s}class po{constructor(e,t,s,o){this._imageMemoryURL="",this._fileDownloadProxy=t,this._authKey=s,this._fileDNList=o,$||U?this.createImageDataASURL(e.file):this.createImageDataASURLInWeb(e.file),this._initImageInfoModel(),this.type=W,this._percent=0,this.content={imageFormat:e.imageFormat||Re.UNKNOWN,uuid:e.uuid,imageInfoArray:[]},this.initImageInfoArray(e.imageInfoArray),this._autoFixUrl()}_initImageInfoModel(){let t=this;this._ImageInfoModel=function(e){this.instanceID=Xe(9999999),this.sizeType=e.type||0,this.type=0,this.size=e.size||0,this.width=e.width||0,this.height=e.height||0,this.imageUrl=e.imageUrl||e.url||"",this.url=io(e.url||t._imageMemoryURL,t._fileDownloadProxy,t._authKey,t._fileDNList)},this._ImageInfoModel.prototype={setSizeType(e){this.sizeType=e},setType(e){this.type=e},setImageUrl(e){e&&(this.imageUrl=io(e,t._fileDownloadProxy,t._authKey,t._fileDNList))},getImageUrl(){return this.imageUrl}}}initImageInfoArray(e){let t=0,s=null,o;for(;t<=2;)o=je(e)||je(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(s=new this._ImageInfoModel(o)).setSizeType(t+1),s.setType(t),this.addImageInfo(s),t++;this.updateAccessSideImageInfoArray()}updateImageInfoArray(t){var s,o=this.content.imageInfoArray.length;for(let e=0;e<o;e++)s=this.content.imageInfoArray[e],t[e].size&&(s.size=t[e].size),t[e].url&&s.setImageUrl(t[e].url),t[e].width&&(s.width=t[e].width),t[e].height&&(s.height=t[e].height)}_autoFixUrl(){var t=this.content.imageInfoArray.length;let s="",o="";var r=["http","https"],i=null;for(let e=0;e<t;e++)this.content.imageInfoArray[e].url&&""!==(i=this.content.imageInfoArray[e]).imageUrl&&(o=i.imageUrl.slice(0,i.imageUrl.indexOf("://")+1),s=i.imageUrl.slice(i.imageUrl.indexOf("://")+1),r.indexOf(o)<0&&(o="https:"),this.content.imageInfoArray[e].setImageUrl([o,s].join("")))}updatePercent(e){this._percent=e,1<this._percent&&(this._percent=1)}updateImageFormat(e){this.content.imageFormat=Re[e.toUpperCase()]||Re.UNKNOWN}createImageDataASURLInWeb(e){void 0!==e&&0<e.files.length&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}createImageDataASURL(e){e&&e.url&&(this._imageMemoryURL=e.url)}replaceImageInfo(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}addImageInfo(e){3<=this.content.imageInfoArray.length||this.content.imageInfoArray.push(e)}updateAccessSideImageInfoArray(){var e=this.content.imageInfoArray,{width:t=0,height:s=0}=e[0];if(0!==t&&0!==s){var o=e,r=o[2];o[2]=o[1],o[1]=r;for(let e=0;e<o.length;e++)o[e].setType(e);Object.assign(e[2],function(e){let{originUrl:t,originWidth:s,originHeight:o,min:r=198}=e,i=parseInt(s),n=parseInt(o),a={url:void 0,width:0,height:0};if((i<=n?i:n)<=r)a.url=t,a.width=i,a.height=n;else{n<=i?(a.width=Math.ceil(i*r/n),a.height=r):(a.width=r,a.height=Math.ceil(n*r/i));let e=t&&-1<t.indexOf("?")?t+"&":t+"?";a.url=198===r?e+"imageView2/3/w/198/h/198":e+"imageView2/3/w/720/h/720"}if(je(t)){let{url:e,...t}=a;return t}return a}({originWidth:t,originHeight:s,min:720}))}}sendable(){return 0!==this.content.imageInfoArray.length&&""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size}}class lo{constructor(e){this.type=Y,this.content=e||null}sendable(){return null!==this.content}}class co{constructor(e,t,s,o){this.type=z,this._percent=0,this._fileDownloadProxy=t,this._authKey=s,this._fileDNList=o,this.content={downloadFlag:2,second:e.second,size:e.size,url:io(e.url,this._fileDownloadProxy,this._authKey,this._fileDNList),remoteAudioUrl:io(e.url||"",this._fileDownloadProxy,this._authKey,this._fileDNList),uuid:e.uuid}}updatePercent(e){this._percent=e,1<this._percent&&(this._percent=1)}updateAudioUrl(e){this.content.remoteAudioUrl=io(e,this._fileDownloadProxy,this._authKey,this._fileDNList)}sendable(){return""!==this.content.remoteAudioUrl}}let ho={from:!0,groupID:!0,groupName:!0,to:!0};class go{constructor(e){this.type=ee,this.content={},this._initContent(e)}_initContent(t){Object.keys(t).forEach(e=>{switch(e){case"remarkInfo":break;case"groupProfile":this.content.groupProfile={},this._initGroupProfile(t[e]);break;case"operatorInfo":this.content.operatorInfo={},this._initOperatorInfo(t[e]);break;case"memberInfoList":case"msgMemberInfo":this._updateMemberList(t[e]);break;case"memberExtraInfo":case"onlineMemberInfo":break;case"memberNum":this.content[e]=t[e],this.content.memberCount=t[e];break;case"newGroupProfile":this.content.newGroupProfile={},this._initNewGroupProfile(t[e]);break;default:this.content[e]=t[e]}}),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}_initGroupProfile(t){var s=Object.keys(t);for(let e=0;e<s.length;e++){var o=s[e];ho[o]&&(this.content.groupProfile[o]=t[o])}}_initOperatorInfo(t){var s=Object.keys(t);for(let e=0;e<s.length;e++){var o=s[e];this.content.operatorInfo[o]=t[o]}}_updateMemberList(e){ke(this.content.memberList)?this.content.memberList=e:this.content.memberList.forEach(t=>{e.forEach(e=>{t.userID===e.userID&&Object.assign(t,e)})})}_initNewGroupProfile(t){var s=Object.keys(t);for(let e=0;e<s.length;e++){var o=s[e];this.content.newGroupProfile[o]="muteAllMembers"!==o?t[o]:1===t[o]}}}let mo={from:!0,groupID:!0,groupName:!0,to:!0,groupType:!0};class _o{constructor(e){this.type=te,this.content={},this._initContent(e)}_initContent(t){Object.keys(t).forEach(e=>{switch(e){case"memberInfoList":break;case"remarkInfo":this.content.handleMessage=t[e];break;case"groupProfile":this.content.groupProfile={},this._initGroupProfile(t[e]);break;default:this.content[e]=t[e]}})}_initGroupProfile(t){var s=Object.keys(t);for(let e=0;e<s.length;e++){var o=s[e];mo[o]&&("groupName"===o?this.content.groupProfile.name=t[o]:this.content.groupProfile[o]=t[o])}}}class fo{constructor(e,t,s,o){this.type=X,this._percent=0;var r=this._getFileInfo(e);this.content={downloadFlag:2,fileUrl:io(e.url||e.fileUrl,t,s,o)||"",uuid:e.uuid,fileName:r.name||"",fileSize:r.size||0}}_getFileInfo(e){if(!je(e.fileName)&&!je(e.fileSize))return{size:e.fileSize,name:e.fileName};var t=e.file.files[0];if(R){if(t.path&&-1!==t.path.indexOf(".")){let e=t.path.slice(t.path.lastIndexOf(".")+1).toLowerCase();t.type=e,t.name||(t.name=Xe(999999)+"."+e)}t.name||(t.type="",t.name=t.path.slice(t.path.lastIndexOf("/")+1).toLowerCase()),t.suffix&&(t.type=t.suffix),t.url||(t.url=t.path)}return{size:t.size,name:t.name}}updatePercent(e){this._percent=e,1<this._percent&&(this._percent=1)}updateFileUrl(e){this.content.fileUrl=e}sendable(){return""!==this.content.fileUrl&&""!==this.content.fileName&&0!==this.content.fileSize}}class Mo{constructor(e){this.type=se,this.content={data:e.data||"",description:e.description||"",extension:e.extension||""}}setData(e){return this.content.data=e,this}setDescription(e){return this.content.description=e,this}setExtension(e){return this.content.extension=e,this}sendable(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}class Io{constructor(e,t,s,o){this.type=Q,this._percent=0,this._fileDownloadProxy=t,this._authKey=s,this._fileDNList=o,this.content={remoteVideoUrl:io(e.remoteVideoUrl||e.videoUrl||"",this._fileDownloadProxy,this._authKey,this._fileDNList),videoFormat:e.videoFormat,videoSecond:parseInt(e.videoSecond,10),videoSize:e.videoSize,videoUrl:io(e.videoUrl,this._fileDownloadProxy,this._authKey,this._fileDNList),videoDownloadFlag:2,videoUUID:e.videoUUID,thumbUUID:e.thumbUUID,thumbFormat:e.thumbFormat,thumbWidth:e.thumbWidth,snapshotWidth:e.thumbWidth,thumbHeight:e.thumbHeight,snapshotHeight:e.thumbHeight,thumbSize:e.thumbSize,snapshotSize:e.thumbSize,thumbDownloadFlag:2,thumbUrl:io(e.thumbUrl,this._fileDownloadProxy,this._authKey,this._fileDNList),snapshotUrl:io(e.thumbUrl,this._fileDownloadProxy,this._authKey,this._fileDNList)}}updatePercent(e){this._percent=e,1<this._percent&&(this._percent=1)}updateVideoUrl(e){e&&(this.content.remoteVideoUrl=io(e,this._fileDownloadProxy,this._authKey,this._fileDNList))}updateSnapshotInfo(e){var{snapshotUrl:e,snapshotWidth:t,snapshotHeight:s}=e;ke(e)||(this.content.thumbUrl=this.content.snapshotUrl=e),ke(t)||(this.content.thumbWidth=this.content.snapshotWidth=Number(t)),ke(s)||(this.content.thumbHeight=this.content.snapshotHeight=Number(s))}sendable(){return""!==this.content.remoteVideoUrl}}class yo{constructor(e){this.type=Z;var{description:e,longitude:t,latitude:s}=e;this.content={description:e,longitude:t,latitude:s}}sendable(){return!0}}class Do{constructor(e,t,s,o){var r,i;this.from=e.from,this.messageSender=e.from,this.time=e.time,this.messageSequence=e.sequence,this.clientSequence=e.clientSequence||e.sequence,this.messageRandom=e.random,this.cloudCustomData=e.cloudCustomData||"",this.clientTime=e.clientTime||void 0,e.ID?(this.ID=e.ID||"",this.nick=e.nick||"",this.avatar=e.avatar||"",e.messageBody?this.messageBody=JSON.parse(JSON.stringify(e.messageBody)):this.messageBody=[{type:e.type,payload:e.payload}],e.conversationType?e.conversationType.startsWith(ue)?this.receiverUserID=e.to:e.conversationType.startsWith(pe)&&(this.receiverGroupID=e.to):e.receiverGroupID?this.receiverGroupID=e.receiverGroupID:e.receiverUserID&&(this.receiverUserID=e.receiverUserID),this.messageReceiver=e.to||e.messageReceiver):(this.nick=e.nick||"",this.avatar=e.avatar||"",this.messageBody=[],r=e.elements[0].type,i=e.elements[0].content,this._patchRichMediaPayload(r,i),this._updateRichMediaDownloadUrl(r,i,t,s,o),r===oe?this.messageBody.push({type:r,payload:new Lo(i,t,s,o).content}):this.messageBody.push({type:r,payload:i}),e.groupID&&(this.receiverGroupID=e.groupID,this.messageReceiver=e.groupID),e.to&&(this.receiverUserID=e.to,this.messageReceiver=e.to),this.ID=`${e.tinyID}-${e.clientTime}-`+e.random)}_patchRichMediaPayload(e,t){e===W?t.imageInfoArray.forEach(e=>{!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))}):e===Q?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===z?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===X&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}_updateRichMediaDownloadUrl(e,t,s,o,r){(s||o)&&(e===W?t.imageInfoArray.forEach(e=>{e.imageUrl=io(e.imageUrl,s,o,r),e.url=io(e.url,s,o,r)}):e===Q?(t.remoteVideoUrl=io(t.remoteVideoUrl,s,o,r),t.videoUrl=io(t.videoUrl,s,o,r),t.thumbUrl=io(t.thumbUrl,s,o,r),t.snapshotUrl=io(t.thumbUrl,s,o,r),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===z?(t.remoteAudioUrl=io(t.remoteAudioUrl,s,o,r),t.url=io(t.url,s,o,r)):e===X&&(t.fileUrl=io(t.fileUrl,s,o,r)))}}var Lo=class{constructor(n,a,u,p){if(this.type=oe,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},n.downloadKey){let{downloadKey:e,pbDownloadKey:t,title:s,abstractList:o,compatibleText:r,version:i}=n;this.content.downloadKey=e,this.content.pbDownloadKey=t,this.content.title=s,this.content.abstractList=o,this.content.compatibleText=r,this.content.version=i||0}else if(ke(n.messageList))1===n.layersOverLimit&&(this.content.layersOverLimit=!0);else{let{messageList:e,title:t,abstractList:s,compatibleText:o,version:r}=n,i=[];e.forEach(e=>{ke(e)||(e=new Do(e,a,u,p),i.push(e))}),this.content.messageList=i,this.content.title=t,this.content.abstractList=s,this.content.compatibleText=o,this.content.version=r||0}}sendable(){return!ke(this.content.messageList)||!ke(this.content.downloadKey)}};let Co={1:re,2:ie,3:ne,4:ae};class Go{constructor(e){this.ID="",this.conversationID=e.conversationID||null,this.conversationType=e.conversationType||ue,this.conversationSubType=e.conversationSubType,this.time=e.time||Math.ceil(Date.now()/1e3),this.sequence=e.sequence||0,this.clientSequence=e.clientSequence||e.sequence||0,this.random=e.random||0===e.random?e.random:Xe(),this.priority=this._computePriority(e.priority),this.nick=e.nick||"",this.avatar=e.avatar||"",this.isPeerRead=!1,this.nameCard="",this.hasRiskContent=function(e){let t=e&&1<e?!0:!1;return t}(e.checkResult),this._elements=[],this.isPlaceMessage=e.isPlaceMessage||0,this.isRevoked=2===e.isPlaceMessage||8===e.msgFlagBits,this.from=e.from||null,this.to=e.to||null,this.flow="",this.isSystemMessage=e.isSystemMessage||!1,this.protocol=e.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=e.status||eo,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=e.cloudCustomData||"",this.isDeleted=!1,this.isModified=!!e.messageVersion,this._isExcludedFromUnreadCount=!(!e.messageControlInfo||1!==e.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!e.messageControlInfo||1!==e.messageControlInfo.excludedFromLastMessage),this.clientTime=e.clientTime||Math.floor(Pe()/1e3)||0,this.senderTinyID=e.senderTinyID||e.tinyID||"",this.readReceiptInfo=e.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0,timestamp:0},this.needReadReceipt=!0===e.needReadReceipt||1===e.needReadReceipt,this.version=e.messageVersion||0,this.isBroadcastMessage=e.isBroadcastMessage||!1,this._receiverList=e.receiverList||void 0,this.isSupportExtension=!0===e.isSupportExtension||1===e.isSupportExtension,this._cmConfigID=e.customModerationConfigurationID,this.revoker=e.revokerInfo&&e.revokerInfo.revoker||"",this.revokerInfo=e.revokerInfo||{userID:"",nick:"",avatar:""},this.revokeReason=e.revokeReason||"",this.pinnerInfo=e.pinnerInfo||null,this.reInitialize(e.currentUser),this.extractGroupInfo(e.groupProfile||null),this.handleGroupAtInfo(e),this.initC2CReadReceiptInfo(e)}get elements(){return this._elements}getElements(){return this._elements}extractGroupInfo(e){null!==e&&(He(e.nick)&&(this.nick=e.nick),He(e.avatar)&&(this.avatar=e.avatar),e=e.messageFromAccountExtraInformation,Be(e))&&He(e.nameCard)&&(this.nameCard=e.nameCard)}handleGroupAtInfo(e){e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach(e=>{e!==Se?(this._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),this.atUserList.push(e)):(this._groupAtInfoList.push({groupAtAllFlag:1}),this.atUserList.push(Se))}),Ke(e.groupAtInfo)&&e.groupAtInfo.forEach(e=>{0===e.groupAtAllFlag?this.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&this.atUserList.push(Se)})}getGroupAtInfoList(){return this._groupAtInfoList}_initProxy(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}reInitialize(e){e&&(this.status=this.from?eo:Zs,!this.from)&&(this.from=e),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}isSendable(){return 0!==this._elements.length&&(!0===this._relayFlag||"function"==typeof this._elements[0].sendable&&this._elements[0].sendable())}_initTo(e){this.conversationType===pe&&(this.to=e.groupID)}_initSequence(e){0===this.clientSequence&&e&&(this.clientSequence=function(o){if(!o)return!1;if(void 0===Ye[o]){var r=new Date;let e=("3"+r.getHours()).slice(-2),t=("0"+r.getMinutes()).slice(-2),s=("0"+r.getSeconds()).slice(-2);Ye[o]=parseInt([e,t,s,"0001"].join("")),e=null,t=null,s=null,gt.l("autoIncrementIndex start index:"+Ye[o])}return Ye[o]++}(e)),0===this.sequence&&this.conversationType===ue&&(this.sequence=this.clientSequence)}generateMessageID(){this.from===ce&&(this.senderTinyID="144115198244471703"),this.ID=`${this.senderTinyID}-${this.clientTime}-`+this.random}_initFlow(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}_concatConversationID(e){var t=this["to"],s=this.conversationType;s!==ce?(e=s===ue?e===this.from?t:this.from:this.to,this.conversationID=e?""+s+e:null):this.conversationID=ce}isElement(e){return e instanceof ro||e instanceof po||e instanceof lo||e instanceof co||e instanceof fo||e instanceof Io||e instanceof go||e instanceof _o||e instanceof Mo||e instanceof yo||e instanceof Lo}setElement(t,s,o,r){if(this.isElement(t))this._elements=[t];else{var i=e=>{if(e.type&&e.content)switch(e.type){case J:this.setTextElement(e.content);break;case W:this.setImageElement(e.content,s,o,r);break;case z:this.setAudioElement(e.content,s,o,r);break;case X:this.setFileElement(e.content,s,o,r);break;case Q:this.setVideoElement(e.content,s,o,r);break;case se:this.setCustomElement(e.content);break;case Z:this.setLocationElement(e.content);break;case ee:this.setGroupTipElement(e.content);break;case te:this.setGroupSystemNoticeElement(e.content);break;case Y:this.setFaceElement(e.content);break;case oe:this.setMergerElement(e.content,s,o,r)}};if(Ke(t))for(let e=0;e<t.length;e++)i(t[e]);else i(t)}this._initProxy()}clearElement(){this._elements.length=0}setTextElement(e){e="string"==typeof e?e:e.text,e=new ro({text:e});this._elements.push(e)}setImageElement(e,t,s,o){e=new po(e,t,s,o);this._elements.push(e)}setAudioElement(e,t,s,o){e=new co(e,t,s,o);this._elements.push(e)}setFileElement(e,t,s,o){e=new fo(e,t,s,o);this._elements.push(e)}setVideoElement(e,t,s,o){e=new Io(e,t,s,o);this._elements.push(e)}setLocationElement(e){e=new yo(e);this._elements.push(e)}setCustomElement(e){e=new Mo(e);this._elements.push(e)}setGroupTipElement(e){let t={};var s=e.operationType;if(ke(e.memberInfoList)?e.operatorInfo&&(t=e.operatorInfo):s!==Ce&&s!==Ge&&s!==be&&s!==Ae||(t=e.memberInfoList[0]),!ke(e.memberExtraInfo)){let t=e.memberExtraInfo["reason"];e.msgMemberInfo.forEach(e=>{e.reason=t})}var{nick:s,avatar:o}=t,s=(He(s)&&(this.nick=s),He(o)&&(this.avatar=o),new go(e));this._elements.push(s)}setGroupSystemNoticeElement(e){e=new _o(e);this._elements.push(e)}setFaceElement(e){e=new lo(e);this._elements.push(e)}setMergerElement(e,t,s,o){e=new Lo(e,t,s,o);this._elements.push(e)}setIsRead(e){this.isRead=e}setRelayFlag(e){this._relayFlag=e}_computePriority(e){if(!je(e)){if(He(e)&&-1!==Object.values(Co).indexOf(e))return e;if(Ve(e)){e=""+e;if(-1!==Object.keys(Co).indexOf(e))return Co[e]}}return ie}setNickAndAvatar(e){var{nick:e,avatar:t}=e;He(e)&&(this.nick=e),He(t)&&(this.avatar=t)}setNameCard(e){He(e)&&(this.nameCard=e)}initC2CReadReceiptInfo(e){var{readReceiptSentByPeer:e,timestamp:t=0}=e;this.conversationType===ue&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===e,this.readReceiptInfo.timestamp=t)}}class bo{constructor(e){this._grpM=e,this._n="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4}onCheckTimer(e){e%1==0&&0<this._cachedGroupTipsMap.size&&this._check()}_check(){this._cachedGroupTipsMap.forEach((e,t)=>{var s=this._checkCountMap.get(t),o=this._grpM.hasLocalGroup(t);gt.l(this._n+`._check groupID:${t} hasLocalGroup:${o} checkCount:`+s),o?(this._notifyCachedGroupTips(t),this._checkCountMap.delete(t),this._grpM.deleteUnjoinedAVChatRoom(t)):s>=this.MAX_CHECK_COUNT?(this._deleteCachedGroupTips(t),this._checkCountMap.delete(t)):this._checkCountMap.set(t,++s)})}onNewGroupTips(e){gt.l(this._n+".onNewGroupTips options:"+JSON.stringify(e.dataList));var{eventDataList:e,result:t,AVChatRoomMessageList:s}=this._assembly(e);0<s.length&&this._grpM.onAVChatRoomMessage(s),0<t.length&&(this._grpM.emitOEvt(kt,t),this._handleTips(t)),0<e.length&&(this._grpM.updateNextMessageSeq(e),this._grpM.get(o).onNewMessage({conversationOptionsList:e,isInstantMessage:!0}))}_assembly(e){var{event:s,dataList:r}=e,i=null,n=[],a=[],u={},p=[];for(let t=0,e=r.length;t<e;t++){let e=Qe(r[t]);if(6===s){if(this._grpM.isGroupAttributesUpdatedNotice(e))continue;if(this._grpM.isGroupCountersNotice(e))continue}var{groupProfile:{groupID:l,communityType:g=0,topicID:h,invisible:c,groupType:m},elements:{operationType:d}}=e;if(16===d||17===d)this._grpM.onPinnedMessageNotify(e);else{let t=void 0;var d=this._grpM.isMessageFromTopic(g,h),_=(d&&(t=le,e.to=h),this._grpM.hasLocalGroup(l));if(_||!this._grpM.isUnjoinedAVChatRoom(l))if(_||d)if(this._grpM.isMessageFromOrToAVChatroom(l))e.event=s,p.push(e);else if(e.currentUser=this._grpM.getMyUserID(),e.conversationType=pe,(i=new Go(e)).setElement({type:ee,content:{...e.elements,groupProfile:e.groupProfile}}),i.isSystemMessage=!1,1===c)this._qualityStat(i);else{var _=this._grpM.get(o),{conversationID:d,sequence:c}=i;if(6===s)i._onlineOnlyFlag=!0,a.push(i);else if(!_.pushIntoNoticeResult(a,i))continue;if(!(this._grpM.isMessageFromCommunityOfTopic(g,h)||6===s&&_.getLocalConversation(d))){6!==s&&this._qualityStat(i);g=_.isRemoteRead({conversationID:d,sequence:c});if(je(u[d])){let e=0;"in"!==i.flow||i._isExcludedFromUnreadCount||i._onlineOnlyFlag||g||(e=1),u[d]=n.push({conversationID:d,unreadCount:e,type:je(t)?i.conversationType:t,subType:i.conversationSubType,lastMessage:i._isExcludedFromLastMessage?"":i})-1}else{let e=u[d];n[e].type=i.conversationType,n[e].subType=i.conversationSubType,n[e].lastMessage=i._isExcludedFromLastMessage?"":i,"in"!==i.flow||i._isExcludedFromUnreadCount||i._onlineOnlyFlag||g||n[e].unreadCount++}}}else this._cacheAndCompare({groupID:l,event:s,item:e,groupType:m})}}return{eventDataList:n,result:a,AVChatRoomMessageList:p}}_qualityStat(e){this._grpM.get(p).addMessageSequence({key:Yt,message:e})}_handleTips(e){e.forEach(e=>{switch(e.payload.operationType){case 1:this._onNewMemberComeIn(e);break;case 2:this._onMemberQuit(e);break;case 3:this._onMemberKickedOut(e);break;case 4:this._onMemberSetAdmin(e);break;case 5:this._onMemberCancelledAdmin(e);break;case 6:this._onGroupProfileModified(e);break;case 7:this._onMemberInfoModified(e);break;case 8:this._onTopicProfileUpdated(e);break;default:gt.w(this._n+"._handleTips unknown operationType:"+e.payload.operationType)}})}_onNewMemberComeIn(e){var{memberNum:e,groupProfile:{groupID:t}}=e.payload,t=this._grpM.getLocalGroupProfile(t);t&&Ve(e)&&t.memberCount!==e&&(t.memberCount=e,this._updateConvGroupProfile(t))}_onMemberQuit(e){var{memberNum:t,groupProfile:{groupID:s}}=e.payload,o=this._grpM.getLocalGroupProfile(s);o&&Ve(t)&&o.memberCount!==t&&(o.memberCount=t,this._updateConvGroupProfile(o)),this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(s,e.payload.userIDList)}_onMemberKickedOut(e){var{memberNum:t,groupProfile:{groupID:s}}=e.payload,o=this._grpM.getLocalGroupProfile(s);o&&Ve(t)&&o.memberCount!==t&&(o.memberCount=t,this._updateConvGroupProfile(o)),this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(s,e.payload.userIDList)}_updateConvGroupProfile(e){this._grpM.get(o).updateConvGroupProfile([e])}_onMemberSetAdmin(e){let t=e.payload.groupProfile.groupID,s=e.payload.userIDList,o=this._grpM.getGroupMemberHandler();s.forEach(e=>{e=o.getLocalGroupMemberInfo(t,e);e&&e.updateRole(ye)})}_onMemberCancelledAdmin(e){let t=e.payload.groupProfile.groupID,s=e.payload.userIDList,o=this._grpM.getGroupMemberHandler();s.forEach(e=>{e=o.getLocalGroupMemberInfo(t,e);e&&e.updateRole(De)})}_onGroupProfileModified(e){let{newGroupProfile:t,groupProfile:s,operatorInfo:o}=e.payload,r=s["groupID"],i=this._grpM.getLocalGroupProfile(r);Object.keys(t).forEach(e=>{switch(e){case"ownerID":this._ownerChanged(i,t);break;case"groupName":i.name=t[e];break;default:i[e]=t[e]}}),je(o)||i.selfInfo.userID!==o.userID||Object.keys(o).forEach(t=>{if("nameCard"===t)i.updateSelfInfo({nameCard:o[t]});else if("role"===t){let e="";400===o[t]?e=Ie:300===o[t]?e=ye:200===o[t]&&(e=De),i.updateSelfInfo({role:e})}});e=!i.isSupportTopic;this._grpM.emitGroupListUpdate(!0,e)}_ownerChanged({groupID:r},e){var i=this._grpM.getLocalGroupProfile(r),n=this._grpM.getMyUserID(),a=e["ownerID"];if(n===a){let e=this._grpM.getGroupMemberHandler(),t=e.getLocalGroupMemberInfo(r,n),s=this._grpM.getLocalGroupProfile(r).ownerID,o=e.getLocalGroupMemberInfo(r,s);i.updateGroup({ownerID:a,selfInfo:{role:Ie}}),t&&t.updateRole(Ie),o&&o.updateRole(De)}}_onMemberInfoModified(e){let{to:t,payload:{groupProfile:s,memberList:o}}=e,r=s.groupID,i=(nt(t)&&this._updateTopicMuteTime(e),this._grpM.getGroupMemberHandler());o.forEach(e=>{var t=i.getLocalGroupMemberInfo(r,e.userID);t&&Ve(e.muteTime)&&t.updateMuteUntil(e.muteTime)})}_updateTopicMuteTime(e){var{to:e,payload:{groupProfile:t,memberList:o=[]}}=e,t=t["groupID"],r=this._grpM.get(s).getLocalTopic(t,e);if(r){let s=!1;for(let t=0;t<o.length;t++){let e=o[t];if(e.userID===this._grpM.getMyUserID()&&0<=e.muteTime){r.updateSelfInfo({muteTime:e.muteTime}),s=!0;break}}s&&this._grpM.emitOEvt(Bt,{groupID:t,topic:r})}}_onTopicProfileUpdated(e){var{groupProfile:{groupID:t},newTopicInfo:o}=e.payload;this._grpM.get(s).onTopicProfileUpdated({groupID:t,topicID:e.to,...o})}_cacheGroupTips(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}_deleteCachedGroupTips(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}_notifyCachedGroupTips(e,t){var s=this._cachedGroupTipsMap.get(e)||[];gt.l(this._n+`._notifyCachedGroupTips groupID:${e} groupType:${t} count:`+s.length),s.forEach(e=>{this.onNewGroupTips(e)}),this._deleteCachedGroupTips(e)}_cacheAndCompare(e){var{groupID:e,event:t,item:s,groupType:o}=e,t=(gt.l(this._n+`._cacheAndCompare groupID:${e} groupType:`+o),this._cacheGroupTips(e,{event:t,dataList:[s]}),{groupID:e,type:o});o===de?this._grpM.hasLocalGroup(e)?this._notifyCachedGroupTips(e,o):this._grpM.setUnjoinedAVChatRoom(e):(this._grpM.updateGroupMap([t]),this._notifyCachedGroupTips(e,o)),this._checkCountMap.has(e)||this._checkCountMap.set(e,0)}reset(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear()}}class Ao{constructor(e){this._grpM=e,this._n="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this.PAGING_GRP_COUNT_LIMIT=200,this._pagingStatus=to,this._pagingGetCostList=[],e.getIEmitInst().on(Xt.A2KEY_AND_TINYID_UPDATED,this.syncGroupList,this)}onCheckTimer(e){e%1==0&&0<this._cachedGroupMessageMap.size&&this._check()}_check(){this._cachedGroupMessageMap.forEach((e,t)=>{var s=this._checkCountMap.get(t),o=this._grpM.hasLocalGroup(t);gt.l(this._n+`._check groupID:${t} hasLocalGroup:${o} checkCount:`+s),o?(this._notifyCachedGroupMessage(t),this._checkCountMap.delete(t),this._grpM.deleteUnjoinedAVChatRoom(t)):s>=this.MAX_CHECK_COUNT?(this._deleteCachedGroupMessage(t),this._checkCountMap.delete(t)):this._checkCountMap.set(t,++s)})}updateLastMsg(i){var e=this._n+".updateLastMsg";if(0===this._grpM.getGroupMap().size)this.tempConversationList=i;else{let t,s,o,r=!1;var n,a,u=i.length;for(let e=0;e<u;e++)(t=i[e]).type===pe&&0!==t.lastMessage.lastSequence&&null!==t.lastMessage.payload&&(s=t.conversationID.split(/^GROUP/)[1],o=this._grpM.getLocalGroupProfile(s))&&(n=o.lastMessage,a=t.lastMessage,JSON.stringify(n)!==JSON.stringify(a))&&(o.lastMessage={...t.lastMessage},r=!0);gt.l(e+` convCount:${u} groupCount:${this._grpM.getLocalGroupList().length} isUpdated:`+r),r&&(this._grpM.sortLocalGroupList(),this._grpM.emitGroupListUpdate(!0,!1))}}onNewMessage(e){var{conversationOptionsList:t,messageList:s,AVChatRoomMessageList:r}=this._assembly(e),r=(0<r.length&&this._grpM.onAVChatRoomMessage(r),et(s)),r=(0<r.length&&this._grpM.emitOEvt(Ot,r),0<t.length&&(this._grpM.get(o).onNewMessage({conversationOptionsList:t,isInstantMessage:!1!==e.isInstantMessage,updateUnreadCount:!1!==e.updateUnreadCount}),this._grpM.updateNextMessageSeq(t)),ot(s));0<r.length&&this._grpM.emitOEvt(kt,r),s.length=0}_assembly(e){let{dataList:u,event:p,isInstantMessage:l}=e;var g=null;let h=[],c=[],m=[],d={},_=this._grpM.getFileDownloadProxy(),f=this._grpM.getDownloadFileAuthKey(),M=this._grpM.get(n).getFileDNList(),s=u.length;1<s&&u.sort((e,t)=>e.sequence-t.sequence);var I=this._grpM.get(o),y=this._grpM.get(t);for(let a=0;a<s;a++){let e=Qe(u[a]),{groupProfile:{groupID:t,communityType:r=0,topicID:i,invisible:s,groupType:o}}=e,n=void 0;var D=this._grpM.isMessageFromTopic(r,i),L=(D&&(n=le,e.to=i),this._grpM.hasLocalGroup(t));if(L||!this._grpM.isUnjoinedAVChatRoom(t))if(L||D)if(this._grpM.isMessageFromOrToAVChatroom(t))e.event=p,m.push(e);else if(e.currentUser=this._grpM.getMyUserID(),e.conversationType=pe,e.isSystemMessage=!!e.isSystemMessage,(g=new Go(e)).setElement(e.elements,_,f,M),1===s)this._qualityStat(l,g);else{let s=1===u[a].isModified;if(I.isMessageSentByCurrentInstance(g)?g.isModified=s:s=!1,1===e.onlineOnlyFlag)g._onlineOnlyFlag=!0,I.isMessageSentByCurrentInstance(g)||c.push(g);else{if(this._grpM.isMessageFromCommunityOfTopic(r,i)){c.push(g);continue}if(g.from===this._grpM.getMyUserID()){let s=I.getLatestMessageSentByMe(g.conversationID);if(s){let{nick:e,avatar:t}=s;e===g.nick&&t===g.avatar||(I.modifyMessageSentByMe({conversationID:o,latestNick:g.nick,latestAvatar:g.avatar}),y.mockOnNickAvatarModified(g.nick,g.avatar))}}if(!I.pushIntoMessageList(c,g,s))continue;this._qualityStat(l,g);let{conversationID:o,sequence:e}=g,t=I.isRemoteRead({conversationID:o,sequence:e});if(je(d[o])){let e=0;"in"!==g.flow||g._isExcludedFromUnreadCount||t||(e=1),d[o]=h.push({conversationID:o,unreadCount:e,type:je(n)?g.conversationType:n,subType:g.conversationSubType,lastMessage:g._isExcludedFromLastMessage?"":g})-1}else{let e=d[o];h[e].type=je(n)?g.conversationType:n,h[e].subType=g.conversationSubType,h[e].lastMessage=g._isExcludedFromLastMessage?"":g,"in"!==g.flow||g._isExcludedFromUnreadCount||t||h[e].unreadCount++}}}else this._cacheAndCompare({groupID:t,event:p,item:e,groupType:o})}return{conversationOptionsList:h,messageList:c,AVChatRoomMessageList:m}}_qualityStat(e,t){var s=this._grpM.get(p);s.addMessageSequence({key:Yt,message:t}),e&&0<t.clientTime&&s.addMessageDelay(t.clientTime)}onMsgRevoked(e,t){let p=this._grpM.get(o),l=[],g=[];e.dataList.forEach(e=>{let t=e.elements["revokedInfos"],{revokerInfo:n,groupProfile:a}=e,u=!1;a&&(u=it({groupID:a.groupID})||!ke(a.topicID)),je(t)||t.forEach(t=>{var s=ke(t.topicID)?"GROUP"+t.groupID:"GROUP"+t.topicID,e=p.getLocalConversation(s),o=t.revokerInfo&&t.revokerInfo.revoker||n&&n.revoker,r=n&&n.reason||"";let i;if(e&&rt(e.type))i={conversationID:s,sequence:t.sequence,ID:`${t.tinyID}-${t.clientTime}-`+t.random};else{let e=p.revoke(s,t.sequence,t.random);e?i=e:(i={conversationID:s,sequence:t.sequence},t.tinyID&&t.clientTime&&t.random&&(i.ID=`${t.tinyID}-${t.clientTime}-`+t.random),t.time&&(i.time=t.time))}i&&(i.revoker=o,i.revokeReason=r,i.revokerInfo={userID:o,nick:"",avatar:""},(u?(i.revokerInfo.nick=a.nick,i.revokerInfo.avatar=a.avatar,l):g).push(i))})}),0===g.length&&0===l.length||(p.onMessageRevoked([...l,...g],t),0<l.length&&this._grpM.emitOEvt(Ft,l),0<g.length&&p.updateRevokerInfo(g).then(e=>{this._grpM.emitOEvt(Ft,e)}))}_groupListTreeShaking(s){let o=new Map([...this._grpM.getGroupMap()]);for(let e=0,t=s.length;e<t;e++)o.delete(s[e].groupID);this._grpM.hasJoinedAVChatRoom()&&this._grpM.getJoinedAVChatRoom().forEach(e=>{o.delete(e)}),this._grpM.getGroupMap().forEach((e,t)=>{e.isSupportTopic&&o.delete(