@tencentcloud/chat
Version:
Tencent Cloud Chat SDK for Web/Mini Program/uni-app/React Native/Donut
1 lines • 139 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",I={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"}},M={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=(I.HOST.setCurrent(f),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),b=(G&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),A="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),T="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),v="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),S="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,P="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,R=G&&"object"==typeof wx.miniapp,w=G||b||A||T||v||P||S,$="undefined"==typeof window&&!w&&"undefined"!=typeof global&&void 0!==global.NativeScriptGlobals,E="undefined"!=typeof global&&(void 0!==global.nativeModuleProxy||void 0!==global.ReactNative),U="undefined"!=typeof uni?!w:"undefined"!=typeof window&&!w&&!E,N=(b?qq:A?tt:T?swan:v?my:G?wx:P?uni:S&&jd,U&&window&&window.navigator&&window.navigator.userAgent||""),q=/(micromessenger|webbrowser)/i.test(N),k=function(){let e="WEB";return q?e="WEB":b?e="QQ_MP":A?e="TT_MP":T?e="BAIDU_MP":v?e="ALI_MP":G?e=R?"DONUT_NATIVE_APP":"WX_MP":P?e="UNI_NATIVE_APP":$?e="NS_NATIVE_APP":E&&(e="RN_NATIVE_APP"),_[e]}(),O=(!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")),F,x,V=(!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)}(),F="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{},function(){}),H=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],K=H.length;for(;K--;)x=H[K],console[x]||(F[x]=V);var B=F;let j="TIMTextElem",J="TIMImageElem",W="TIMSoundElem",z="TIMFileElem",X="TIMFaceElem",Y="TIMVideoFileElem",Q="TIMLocationElem",Z="TIMGroupTipElem",ee="TIMGroupSystemNoticeElem",te="TIMCustomElem",se="TIMRelayElem",oe="High",re="Normal",ie="Low",ne="Lowest",ae="C2C",ue="GROUP",pe="TOPIC",le="@TIM#SYSTEM",ce="Private",he="Public",ge="ChatRoom",me="AVChatRoom",de="Community",_e="Room",fe="Live",Ie="Owner",Me="Admin",ye="Member",De="Custom",Le=1,Ce=3,Ge=4,be=5,Ae="AcceptAndNotify",Te="AlreadyInGroup",ve="__kImSDK_MesssageAtALL__",Se=function(){return(new Date).getTime()+0},Pe={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},Re={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"},we="JoinedSuccess",$e="WaitAdminApproval",Ee="@TGS#_",Ue="@TOPIC#_",Ne=Object.prototype.hasOwnProperty;function qe(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(He(e)){for(var t in e)if(Ne.call(e,t))return!1;return!0}return!!(ke(e)||Oe(e)||Fe(e))&&0===e.size}let ke=function(e){return"map"===Je(e)},Oe=function(e){return"set"===Je(e)},Fe=function(e){return"file"===Je(e)},xe=function(e){return null!==e&&("number"==typeof e&&!isNaN(+e)||"object"==typeof e&&e.constructor===Number)},Ve=function(e){return"string"==typeof e},He=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"===Je(e)},Be=function(e){return void 0===e},je=function(e){return Ke(e)||null!==e&&"object"==typeof e},Je=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},We=(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],!(Be(o[a])||r&&r.includes(a)))if(je(s[a])&&je(o[a]))n+=We(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}),ze=function(e){e=e||99999999;return Math.round(Math.random()*e)},Xe={},Ye=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]=Ye(e[s])):o[s]=void 0:o[s]=null;return o};function Qe(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 Ze(e){return qe(e)?[]:e.filter(e=>!0===e.isModified)}function et(e){var t;if(He(e)&&He(e.webhookInfo))return t=[],e.webhookInfo.disableCloudMessagePreHook&&t.push("ForbidBeforeSendMsgCallback"),e.webhookInfo.disableCloudMessagePostHook&&t.push("ForbidAfterSendMsgCallback"),0!==t.length?t:void 0}function st(e){return qe(e)?[]:e.filter(e=>!1===e.isModified)}let ot=e=>e===me,rt=({type:e,groupID:t})=>e===de||(""+t).startsWith(Ee)&&!(""+t).includes(Ue),it=e=>(""+e).startsWith(Ee)&&(""+e).includes(Ue);function nt(e){return e.split(Ue)[0]}function at(){return!O&&!w}function ut(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 pt=0;function lt(){return at()?"%c Chat %c":"Chat"}function ct(){(e=new Date).setTime(Se());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 ht={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){at()?B[e](lt(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",ct(),t):B[e](`${lt()} ${ct()} `+t)},d:function(){var e;pt<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;pt<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;pt<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;pt<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;pt<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;pt<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+pt+" to "+e),pt=e},getLevel:function(){return pt}},gt=function(e){return{code:0,data:e||{}}};class mt 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 dt=2101,_t=2114,ft=2600,It=2602,Mt=2603,yt=2620,Dt=2621,Lt=2623,Ct=2660,Gt=2661,bt=2662,At=2681,Tt=2683,vt=2684,St=2685,Pt=2686,Rt=2687,wt=2805,$t=2903,Et=3122,Ut=3123,Nt="onMessageReceived",qt="onMessageModified",kt="onMessageRevoked",Ot="onGroupListUpdated",Ft="groupAttributesUpdated",xt="onGroupCounterUpdated",Vt="onTopicUpdated",Ht="error",Kt=null,Bt=function(e){return Promise.resolve(gt(e))},jt=function(e,t=!1){if(e instanceof mt)return t&&null!==Kt&&Kt.emit(Ht,e),Promise.reject(e);if(e instanceof Error){let e=new mt({code:$t});return t&&null!==Kt&&Kt.emit(Ht,e),Promise.reject(e)}return Be(e)||Be(e.code)?Promise.reject(new mt({code:$t})):(e=new mt(e),t&&null!==Kt&&Kt.emit(Ht,e),Promise.reject(e))},Jt={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"},Wt="messageReceivedGroup",zt="messageReceivedGroupAVPush",Xt="messageReceivedGroupAVPull",Yt={info:4,warning:5,error:6},Qt={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},Zt={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 es{constructor(e){this._n="SSOLogData",this.eventType=Zt[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=Se()}static bindEventStatModule(e){es.prototype._eventStatModule=e}static bindNetMonitorModule(e){es.prototype._netMonitorModule=e}updateTimeStamp(){this.timestamp=Se()}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=Se();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=wt;this.setCode(e)}this.setLevel("error")}}else ht.w(this._n+".setError value not instanceof Error, please check!");return this}setCode(e){return Be(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),xe(e)?this.code=e:ht.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return Be(e)||this._sentFlag||(xe(e)&&(this.message=e.toString()),Ve(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return Be(e)||this._sentFlag||(this.level=Yt[e]),this}setMoreMessage(e){return qe(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){return Be(e)?ht.w(this._n+".setNetworkType value is undefined, please check!"):(e=Qt[e.toLowerCase()],Be(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 ts="send_group_msg",ss="get_joined_group_list",os="get_group_self_member_info",rs="create_group",is="destroy_group",ns="modify_group_base_info",as="apply_join_group",us="apply_join_group_noauth",ps="quit_group",ls="get_group_public_info",cs="change_group_owner",hs="handle_apply_join_group",gs="handle_invite_join_permission_group",ms="handle_invite_join_group",ds="group_msg_recall",_s="msg_read_report",fs="group_msg_get",Is="get_group_msg_receipt",Ms="group_msg_receipt",ys="get_group_msg_receipt_detail",Ds="get_group_msg_receipts_by_users",Ls="get_pendency",Cs="deletemsg",Gs="get_msg",bs="get_msg_noauth",As="get_online_member_num",Ts="delete_group_ramble_msg_by_seq",vs="modify_group_msg",Ss="set_group_attr",Ps="modify_group_attr",Rs="delete_group_attr",ws="clear_group_attr",$s="get_group_attr",Es="group_set_key_values",Us="group_get_key_values",Ns="batch_get_group_notify",qs="update_group_counter",ks="get_group_counter",Os="get_group_member_info",Fs="get_members",xs="get_specified_group_member_info",Vs="add_group_member",Hs="delete_group_member",Ks="ban_group_member",Bs="modify_group_member_info",js="modify_user_info",Js="unSend",Ws="success",zs="notStart",Xs="resolved",Ys="rejected";class Qs{constructor(e){this.type=j,this.content={text:e.text||""}}setText(e){this.content.text=e}sendable(){return 0!==this.content.text.length}}function Zs(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=")&&so(r,o)?-1<r.indexOf("?")?r+"&authKey="+s:r+"?authKey="+s:r}function eo(e,s,o=[]){let t=s[0].content||s[0].payload;if(e===J)t.imageInfoArray.forEach(e=>{so(e.imageUrl,o)&&(e.imageUrl=to(e.imageUrl))});else if(e===Y)so(t.snapshotUrl,o)&&(t.snapshotUrl=to(t.snapshotUrl),t.thumbUrl=to(t.thumbUrl)),so(t.remoteVideoUrl,o)&&(t.remoteVideoUrl=to(t.remoteVideoUrl));else if(e===W)so(t.remoteAudioUrl,o)&&(t.remoteAudioUrl=to(t.remoteAudioUrl));else if(e===z)so(t.fileUrl,o)&&(t.fileUrl=to(t.fileUrl));else if(e===se){let{downloadKey:e="",messageList:t=[]}=s[0].content||s[0].payload;qe(e)&&t.forEach(e=>{eo(e.messageBody[0].type,e.messageBody,o)})}return s}function to(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 so(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 oo{constructor(e,t,s,o){this._imageMemoryURL="",this._fileDownloadProxy=t,this._authKey=s,this._fileDNList=o,w||E?this.createImageDataASURL(e.file):this.createImageDataASURLInWeb(e.file),this._initImageInfoModel(),this.type=J,this._percent=0,this.content={imageFormat:e.imageFormat||Pe.UNKNOWN,uuid:e.uuid,imageInfoArray:[]},this.initImageInfoArray(e.imageInfoArray),this._autoFixUrl()}_initImageInfoModel(){let t=this;this._ImageInfoModel=function(e){this.instanceID=ze(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=Zs(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=Zs(e,t._fileDownloadProxy,t._authKey,t._fileDNList))},getImageUrl(){return this.imageUrl}}}initImageInfoArray(e){let t=0,s=null,o;for(;t<=2;)o=Be(e)||Be(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=Pe[e.toUpperCase()]||Pe.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(Be(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 ro{constructor(e){this.type=X,this.content=e||null}sendable(){return null!==this.content}}class io{constructor(e,t,s,o){this.type=W,this._percent=0,this._fileDownloadProxy=t,this._authKey=s,this._fileDNList=o,this.content={downloadFlag:2,second:e.second,size:e.size,url:Zs(e.url,this._fileDownloadProxy,this._authKey,this._fileDNList),remoteAudioUrl:Zs(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=Zs(e,this._fileDownloadProxy,this._authKey,this._fileDNList)}sendable(){return""!==this.content.remoteAudioUrl}}let no={from:!0,groupID:!0,groupName:!0,to:!0};class ao{constructor(e){this.type=Z,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];no[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){qe(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 uo={from:!0,groupID:!0,groupName:!0,to:!0,groupType:!0};class po{constructor(e){this.type=ee,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];uo[o]&&("groupName"===o?this.content.groupProfile.name=t[o]:this.content.groupProfile[o]=t[o])}}}class lo{constructor(e,t,s,o){this.type=z,this._percent=0;var r=this._getFileInfo(e);this.content={downloadFlag:2,fileUrl:Zs(e.url||e.fileUrl,t,s,o)||"",uuid:e.uuid,fileName:r.name||"",fileSize:r.size||0}}_getFileInfo(e){if(!Be(e.fileName)&&!Be(e.fileSize))return{size:e.fileSize,name:e.fileName};var t=e.file.files[0];if(P){if(t.path&&-1!==t.path.indexOf(".")){let e=t.path.slice(t.path.lastIndexOf(".")+1).toLowerCase();t.type=e,t.name||(t.name=ze(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 co{constructor(e){this.type=te,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 ho{constructor(e,t,s,o){this.type=Y,this._percent=0,this._fileDownloadProxy=t,this._authKey=s,this._fileDNList=o,this.content={remoteVideoUrl:Zs(e.remoteVideoUrl||e.videoUrl||"",this._fileDownloadProxy,this._authKey,this._fileDNList),videoFormat:e.videoFormat,videoSecond:parseInt(e.videoSecond,10),videoSize:e.videoSize,videoUrl:Zs(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:Zs(e.thumbUrl,this._fileDownloadProxy,this._authKey,this._fileDNList),snapshotUrl:Zs(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=Zs(e,this._fileDownloadProxy,this._authKey,this._fileDNList))}updateSnapshotInfo(e){var{snapshotUrl:e,snapshotWidth:t,snapshotHeight:s}=e;qe(e)||(this.content.thumbUrl=this.content.snapshotUrl=e),qe(t)||(this.content.thumbWidth=this.content.snapshotWidth=Number(t)),qe(s)||(this.content.thumbHeight=this.content.snapshotHeight=Number(s))}sendable(){return""!==this.content.remoteVideoUrl}}class go{constructor(e){this.type=Q;var{description:e,longitude:t,latitude:s}=e;this.content={description:e,longitude:t,latitude:s}}sendable(){return!0}}class mo{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(ae)?this.receiverUserID=e.to:e.conversationType.startsWith(ue)&&(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===se?this.messageBody.push({type:r,payload:new _o(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===J?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===Y?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===W?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===z&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}_updateRichMediaDownloadUrl(e,t,s,o,r){(s||o)&&(e===J?t.imageInfoArray.forEach(e=>{e.imageUrl=Zs(e.imageUrl,s,o,r),e.url=Zs(e.url,s,o,r)}):e===Y?(t.remoteVideoUrl=Zs(t.remoteVideoUrl,s,o,r),t.videoUrl=Zs(t.videoUrl,s,o,r),t.thumbUrl=Zs(t.thumbUrl,s,o,r),t.snapshotUrl=Zs(t.thumbUrl,s,o,r),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===W?(t.remoteAudioUrl=Zs(t.remoteAudioUrl,s,o,r),t.url=Zs(t.url,s,o,r)):e===z&&(t.fileUrl=Zs(t.fileUrl,s,o,r)))}}var _o=class{constructor(n,a,u,p){if(this.type=se,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(qe(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=>{qe(e)||(e=new mo(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!qe(this.content.messageList)||!qe(this.content.downloadKey)}};let fo={1:oe,2:re,3:ie,4:ne};class Io{constructor(e){this.ID="",this.conversationID=e.conversationID||null,this.conversationType=e.conversationType||ae,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:ze(),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||Ws,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(Se()/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.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&&(Ve(e.nick)&&(this.nick=e.nick),Ve(e.avatar)&&(this.avatar=e.avatar),e=e.messageFromAccountExtraInformation,He(e))&&Ve(e.nameCard)&&(this.nameCard=e.nameCard)}handleGroupAtInfo(e){e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach(e=>{e!==ve?(this._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),this.atUserList.push(e)):(this._groupAtInfoList.push({groupAtAllFlag:1}),this.atUserList.push(ve))}),Ke(e.groupAtInfo)&&e.groupAtInfo.forEach(e=>{0===e.groupAtAllFlag?this.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&this.atUserList.push(ve)})}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?Ws:Js,!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===ue&&(this.to=e.groupID)}_initSequence(e){0===this.clientSequence&&e&&(this.clientSequence=function(o){if(!o)return!1;if(void 0===Xe[o]){var r=new Date;let e=("3"+r.getHours()).slice(-2),t=("0"+r.getMinutes()).slice(-2),s=("0"+r.getSeconds()).slice(-2);Xe[o]=parseInt([e,t,s,"0001"].join("")),e=null,t=null,s=null,ht.l("autoIncrementIndex start index:"+Xe[o])}return Xe[o]++}(e)),0===this.sequence&&this.conversationType===ae&&(this.sequence=this.clientSequence)}generateMessageID(){this.from===le&&(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!==le?(e=s===ae?e===this.from?t:this.from:this.to,this.conversationID=e?""+s+e:null):this.conversationID=le}isElement(e){return e instanceof Qs||e instanceof oo||e instanceof ro||e instanceof io||e instanceof lo||e instanceof ho||e instanceof ao||e instanceof po||e instanceof co||e instanceof go||e instanceof _o}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 J:this.setImageElement(e.content,s,o,r);break;case W:this.setAudioElement(e.content,s,o,r);break;case z:this.setFileElement(e.content,s,o,r);break;case Y:this.setVideoElement(e.content,s,o,r);break;case te:this.setCustomElement(e.content);break;case Q:this.setLocationElement(e.content);break;case Z:this.setGroupTipElement(e.content);break;case ee:this.setGroupSystemNoticeElement(e.content);break;case X:this.setFaceElement(e.content);break;case se: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 Qs({text:e});this._elements.push(e)}setImageElement(e,t,s,o){e=new oo(e,t,s,o);this._elements.push(e)}setAudioElement(e,t,s,o){e=new io(e,t,s,o);this._elements.push(e)}setFileElement(e,t,s,o){e=new lo(e,t,s,o);this._elements.push(e)}setVideoElement(e,t,s,o){e=new ho(e,t,s,o);this._elements.push(e)}setLocationElement(e){e=new go(e);this._elements.push(e)}setCustomElement(e){e=new co(e);this._elements.push(e)}setGroupTipElement(e){let t={};var s=e.operationType;if(qe(e.memberInfoList)?e.operatorInfo&&(t=e.operatorInfo):s!==Le&&s!==Ce&&s!==Ge&&s!==be||(t=e.memberInfoList[0]),!qe(e.memberExtraInfo)){let t=e.memberExtraInfo["reason"];e.msgMemberInfo.forEach(e=>{e.reason=t})}var{nick:s,avatar:o}=t,s=(Ve(s)&&(this.nick=s),Ve(o)&&(this.avatar=o),new ao(e));this._elements.push(s)}setGroupSystemNoticeElement(e){e=new po(e);this._elements.push(e)}setFaceElement(e){e=new ro(e);this._elements.push(e)}setMergerElement(e,t,s,o){e=new _o(e,t,s,o);this._elements.push(e)}setIsRead(e){this.isRead=e}setRelayFlag(e){this._relayFlag=e}_computePriority(e){if(!Be(e)){if(Ve(e)&&-1!==Object.values(fo).indexOf(e))return e;if(xe(e)){e=""+e;if(-1!==Object.keys(fo).indexOf(e))return fo[e]}}return re}setNickAndAvatar(e){var{nick:e,avatar:t}=e;Ve(e)&&(this.nick=e),Ve(t)&&(this.avatar=t)}setNameCard(e){Ve(e)&&(this.nameCard=e)}initC2CReadReceiptInfo(e){var{readReceiptSentByPeer:e,timestamp:t=0}=e;this.conversationType===ae&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===e,this.readReceiptInfo.timestamp=t)}}class Mo{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);ht.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){ht.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(Nt,t),this._handleTips(t)),0<e.length&&(this._grpM.updateNextMessageSeq(e),this._grpM.get(o).onNewMessage({conversationOptionsList:e,isInstantMessage:!0}))}_assembly(e){var{event:r,dataList:i}=e,n=null,a=[],u=[],p={},l=[];for(let s=0,e=i.length;s<e;s++){let e=Ye(i[s]);if(6===r){if(this._grpM.isGroupAttributesUpdatedNotice(e))continue;if(this._grpM.isGroupCountersNotice(e))continue}var{groupProfile:{groupID:h,communityType:g=0,topicID:c,invisible:m,groupType:d}}=e;let t=void 0;var _=this._grpM.isMessageFromTopic(g,c),f=(_&&(t=pe,e.to=c),this._grpM.hasLocalGroup(h));if(f||!this._grpM.isUnjoinedAVChatRoom(h))if(f||_)if(this._grpM.isMessageFromOrToAVChatroom(h))e.event=r,l.push(e);else if(e.currentUser=this._grpM.getMyUserID(),e.conversationType=ue,(n=new Io(e)).setElement({type:Z,content:{...e.elements,groupProfile:e.groupProfile}}),n.isSystemMessage=!1,1===m)this._qualityStat(n);else{var f=this._grpM.get(o),{conversationID:_,sequence:m}=n;if(6===r)n._onlineOnlyFlag=!0,u.push(n);else if(!f.pushIntoNoticeResult(u,n))continue;if(!(this._grpM.isMessageFromCommunityOfTopic(g,c)||6===r&&f.getLocalConversation(_))){6!==r&&this._qualityStat(n);g=f.isRemoteRead({conversationID:_,sequence:m});if(Be(p[_])){let e=0;"in"!==n.flow||n._isExcludedFromUnreadCount||n._onlineOnlyFlag||g||(e=1),p[_]=a.push({conversationID:_,unreadCount:e,type:Be(t)?n.conversationType:t,subType:n.conversationSubType,lastMessage:n._isExcludedFromLastMessage?"":n})-1}else{let e=p[_];a[e].type=n.conversationType,a[e].subType=n.conversationSubType,a[e].lastMessage=n._isExcludedFromLastMessage?"":n,"in"!==n.flow||n._isExcludedFromUnreadCount||n._onlineOnlyFlag||g||a[e].unreadCount++}}}else this._cacheAndCompare({groupID:h,event:r,item:e,groupType:d})}return{eventDataList:a,result:u,AVChatRoomMessageList:l}}_qualityStat(e){this._grpM.get(p).addMessageSequence({key:Wt,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:ht.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&&xe(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&&xe(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&&xe(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(Me)})}_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(ye)})}_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]}}),Be(o)||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=Me:200===o[t]&&(e=ye),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();if(n===e.ownerID){i.updateGroup({selfInfo:{role:Ie}});let e=this._grpM.getGroupMemberHandler(),t=e.getLocalGroupMemberInfo(r,n),s=this._grpM.getLocalGroupProfile(r).ownerID,o=e.getLocalGroupMemberInfo(r,s);t&&t.updateRole(Ie),o&&o.updateRole(ye)}}_onMemberInfoModified(e){let{to:t,payload:{groupProfile:s,memberList:o}}=e,r=s.groupID,i=(it(t)&&this._updateTopicMuteTime(e),this._grpM.getGroupMemberHandler());o.forEach(e=>{var t=i.getLocalGroupMemberInfo(r,e.userID);t&&xe(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(Vt,{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)||[];ht.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=(ht.l(this._n+`._cacheAndCompare groupID:${e} groupType:`+o),this._cacheGroupTips(e,{event:t,dataList:[s]}),{groupID:e,type:o});o===me?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 yo{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=zs,this._pagingGetCostList=[],e.getIEmitInst().on(Jt.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);ht.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===ue&&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);ht.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),Ze(s)),r=(0<r.length&&this._grpM.emitOEvt(qt,r),0<t.length&&(this._grpM.get(o).onNewMessage({conversationOptionsList:t,isInstantMessage:!1!==e.isInstantMessage,updateUnreadCount:!1!==e.updateUnreadCount}),this._grpM.updateNextMessageSeq(t)),st(s));0<r.length&&this._grpM.emitOEvt(Nt,r),s.length=0}_assembly(e){let{dataList:u,event:p,isInstantMessage:l}=e;var h=null;let g=[],c=[],m=[],d={},_=this._grpM.getFileDownloadProxy(),f=this._grpM.getDownloadFileAuthKey(),I=this._grpM.get(n).getFileDNList(),s=u.length;1<s&&u.sort((e,t)=>e.sequence-t.sequence);var M=this._grpM.get(o),y=this._grpM.get(t);for(let a=0;a<s;a++){let e=Ye(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=pe,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=ue,e.isSystemMessage=!!e.isSystemMessage,(h=new Io(e)).setElement(e.elements,_,f,I),1===s)this._qualityStat(l,h);else{let s=1===u[a].isModified;if(M.isMessageSentByCurrentInstance(h)?h.isModified=s:s=!1,1===e.onlineOnlyFlag)h._onlineOnlyFlag=!0,M.isMessageSentByCurrentInstance(h)||c.push(h);else{if(this._grpM.isMessageFromCommunityOfTopic(r,i)){c.push(h);continue}if(h.from===this._grpM.getMyUserID()){let s=M.getLatestMessageSentByMe(h.conversationID);if(s){let{nick:e,avatar:t}=s;e===h.nick&&t===h.avatar||(M.modifyMessageSentByMe({conversationID:o,latestNick:h.nick,latestAvatar:h.avatar}),y.mockOnNickAvatarModified(h.nick,h.avatar))}}if(!M.pushIntoMessageList(c,h,s))continue;this._qualityStat(l,h);let{conversationID:o,sequence:e}=h,t=M.isRemoteRead({conversationID:o,sequence:e});if(Be(d[o])){let e=0;"in"!==h.flow||h._isExcludedFromUnreadCount||t||(e=1),d[o]=g.push({conversationID:o,unreadCount:e,type:Be(n)?h.conversationType:n,subType:h.conversationSubType,lastMessage:h._isExcludedFromLastMessage?"":h})-1}else{let e=d[o];g[e].type=Be(n)?h.conversationType:n,g[e].subType=h.conversationSubType,g[e].lastMessage=h._isExcludedFromLastMessage?"":h,"in"!==h.flow||h._isExcludedFromUnreadCount||t||g[e].unreadCount++}}}else this._cacheAndCompare({groupID:t,event:p,item:e,groupType:o})}return{conversationOptionsList:g,messageList:c,AVChatRoomMessageList:m}}_qualityStat(e,t){var s=this._grpM.get(p);s.addMessageSequence({key:Wt,message:t}),e&&0<t.clientTime&&s.addMessageDelay(t.clientTime)}onMsgRevoked(e,t){let p=this._grpM.get(o),l=[],h=[];e.dataList.forEach(e=>{let t=e.elements["revokedInfos"],{revokerInfo:n,groupProfile:a}=e,u=!1;a&&(u=rt({groupID:a.groupID})||!qe(a.topicID)),Be(t)||t.forEach(t=>{var s=qe(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&&ot(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):h).push(i))})}),0===h.length&&0===l.length||(p.onMessageRevoked([...l,...h],t),0<l.length&&this._grpM.emitOEvt(kt,l),0<h.length&&p.updateRevokerInfo(h).then(e=>{this._grpM.emitOEvt(kt,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(t)});var r=[...o.keys()];for(let e=0,t=r.length;e<t;e++)this._grpM.deleteGroup(r[e])}syncGroupList(e=!1){this._pagingStatus===zs&&this._grpM.clearGroupMap();let t=[...L],s=this.PAGING_GRP_COUNT_LIMIT,o=[];if(!0===e)return this._pagingGetGroupListWithTopic({limit:s,offset:0,groupBaseInfoFilter:t,groupList:o});let r=this._n+".syncGroupList",i=new es("syncGroupList");return this._pagingGetGroupList({limit:s,offset:0,groupBaseInfoFi