Socket
Socket
Sign inDemoInstall

@tencentcloud/chat

Package Overview
Dependencies
Maintainers
13
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tencentcloud/chat - npm Package Compare versions

Comparing version 3.2.3 to 3.2.4

modules/follow-module.js

2

modules/relationship-module.js

@@ -1,1 +0,1 @@

'use strict';const e={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG_UPDATED:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"};let t,s;t="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const r=function(){},i=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let n=i.length;for(;n--;)s=i[n],console[s]||(t[s]=r);var o=t;class a{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(){const 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}}const 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:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.18.188"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT:"wss://wssidn.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},u={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},l="CHINA",p={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(e=l){this.CURRENT=d.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GROUP:"group_open_http_svc",GROUP_AVCHATROOM:"group_open_avchatroom_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_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_MESSAGE:"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",MESSAGE_SEARCH:"message_search"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v4",group_open_long_polling_http_svc:"v4",group_open_long_polling_http_noauth_svc:"v4",imopenstat:"v4",im_cos_sign_svr:"v4",im_cos_msg:"v4",webim:"v4",im_open_push:"v4",im_open_status:"v4"}};new a(0,Math.pow(2,0)).toString(),new a(0,Math.pow(2,1)).toString(),new a(0,Math.pow(2,2)).toString(),new a(0,Math.pow(2,3)).toString(),new a(0,Math.pow(2,4)).toString(),new a(0,Math.pow(2,6)).toString(),new a(0,Math.pow(2,7)).toString(),new a(0,Math.pow(2,9)).toString(),new a(0,Math.pow(2,10)).toString(),new a(0,Math.pow(2,11)).toString(),new a(0,Math.pow(2,13)).toString(),new a(0,Math.pow(2,15)).toString(),new a(Math.pow(2,16)).toString();const c="sns";p.HOST.setCurrent(l);const h="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting);h&&wx.createGamePortal;const _="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),m="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),g="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),M="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,y="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,w=h||_||f||m||g||y||M,F=("undefined"!=typeof uni||"undefined"!=typeof window)&&!w;_?qq:f?tt:m?swan:g?my:h?wx:y?uni:!M||jd;const T=F&&window&&window.navigator&&window.navigator.userAgent||"",A=/(micromessenger|webbrowser)/i.test(T),I=/AppleWebKit\/([\d.]+)/i.exec(T);I&&parseFloat(I.pop());const D=function(){let e="WEB";return A?e="WEB":_?e="QQ_MP":f?e="TT_MP":m?e="BAIDU_MP":g?e="ALI_MP":h?e="WX_MP":y&&(e="UNI_NATIVE_APP"),u[e]}();!function(){const e=T.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),function(){const e=T.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),s=e[2]&&parseFloat(e[2]);t&&s&&parseFloat(e[1]+"."+e[2])}(),function(){const e=T.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();const L=/MSIE/.test(T)||T.indexOf("Trident")>-1&&T.indexOf("rv:11.0")>-1;!function(){const e=/MSIE\s(\d+)\.\d/.exec(T);let t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(T)&&/rv:11.0/.test(T)&&(t=11)}(),function(){const e=T.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();const k="C2C",S="AllowType_Type_AllowAny",N="AdminForbid_Type_None",v="Add_Type_Single",E="Add_Type_Both",b="Delete_Type_Single",U="Delete_Type_Both",C="Pendency_Type_Both",G="Pendency_Type_ComeIn",P="Pendency_Type_SendOut",O="Response_Action_Agree",$="Response_Action_AgreeAndAdd",q="CheckResult_Type_Both",R="CheckResult_Type_Single";const x=function(){return(new Date).getTime()+0},H="Tag_Profile_IM_Nick",W="Tag_Profile_IM_Gender",B="Tag_Profile_IM_BirthDay",j="Tag_Profile_IM_Location",K="Tag_Profile_IM_SelfSignature",Y="Tag_Profile_IM_AllowType",J="Tag_Profile_IM_Language",V="Tag_Profile_IM_Image",z="Tag_Profile_IM_MsgSettings",Q="Tag_Profile_IM_AdminForbidType",X="Tag_Profile_IM_Level",Z="Tag_Profile_IM_Role",ee="Tag_SNS_IM_Group",te="Tag_SNS_IM_Remark",se="Tag_SNS_IM_AddSource",re="Tag_SNS_IM_AddWording",ie="Tag_SNS_IM_AddTime",ne={UNKNOWN:"Gender_Type_Unknown",FEMALE:"Gender_Type_Female",MALE:"Gender_Type_Male"},oe={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},ae={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},de=function(e){return null!==e&&("number"==typeof e&&!isNaN(e-0)||"object"==typeof e&&e.constructor===Number)},ue=function(e){return"string"==typeof e},le=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===he(e)},pe=function(e){return void 0===e},ce=function(e){return e instanceof Error},he=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()};Date.now||(Date.now=function(){return(new Date).getTime()});const _e=function(e){if(0===e.length)return 0;let t=0,s="",r=0,i=1;const n="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";for(;void 0!==e[t];)s=e[t++],i=s.charCodeAt[t]<=255?1:!1===n?3:2,r+=i;return r},fe=function(e,t){for(const s in e)if(e[s]===t)return!0;return!1};function me(){return!L&&!w}let ge=0;function Me(){return me()?"%c Chat %c":"Chat"}function ye(){const e=function(){const e=new Date;return e.setTime(x()),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())}const we={arguments2String(e){let t="";if(1===e.length)t=e[0];else for(let i=0,n=e.length;i<n;i++)r=e[i],le(r)||function(e){return null!==e&&"object"==typeof e}(r)?ce(e[i])?t+=(s=e[i],JSON.stringify(s,["message","code"])):t+=JSON.stringify(e[i]):t+=e[i],t+=" ";var s,r;return t},_exec(e,t){me()?o[e](Me(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",ye(),t):o[e](`${Me()} ${ye()} ${t}`)},d:function(){if(ge<=-1){const e=this.arguments2String(arguments);this._exec("debug",e)}},l:function(){if(ge<=0){const e=this.arguments2String(arguments);this._exec("log",e)}},log:function(){if(ge<=0){const e=this.arguments2String(arguments);this._exec("log",e)}},i:function(){if(ge<=1){const e=this.arguments2String(arguments);this._exec("info",e)}},w:function(){if(ge<=2){const e=this.arguments2String(arguments);this._exec("warn",e)}},e:function(){if(ge<=3){const e=this.arguments2String(arguments);this._exec("error",e)}},setLevel:function(e){e<4&&this._exec("log","set level from "+ge+" to "+e),ge=e},getLevel:function(){return ge}},Fe=Object.prototype.hasOwnProperty;function Te(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(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);if(null===t)return!0;let s=t;for(;null!==Object.getPrototypeOf(s);)s=Object.getPrototypeOf(s);return t===s}(e)){for(const t in e)if(Fe.call(e,t))return!1;return!0}return!("map"!==he(e)&&!function(e){return"set"===he(e)}(e)&&!function(e){return"file"===he(e)}(e))&&0===e.size}class Ae{constructor(e){Te(e)||(this.userID=e.userID||"",this.nick=e.nick||"",this.avatar=e.avatar||"",this.time=e.time||0,this.source=e.source||"",this.wording=e.wording||"",this.type=e.type||"")}}const Ie=function(e){return{code:0,data:e||{}}};class De extends Error{constructor(e){super();const{code:t,message:s,data:r}=e;this.code=t,this.message=s||this._getErrorMessage(this.code),this.data=r||{}}}const Le=2700,ke=2701,Se=2710,Ne=2711,ve=2716,Ee=2805,be=2903,Ue=3122,Ce=3123,Ge="onMessageModified",Pe="onFriendListUpdated",Oe="onFriendGroupListUpdated",$e="onFriendApplicationListUpdated",qe="error";let Re=null;const xe=function(e){return Promise.resolve(Ie(e))},He=function(e,t=!1){if(e instanceof De)return t&&null!==Re&&Re.emit(qe,e),Promise.reject(e);if(e instanceof Error){const e=new De({code:be});return t&&null!==Re&&Re.emit(qe,e),Promise.reject(e)}if(pe(e)||pe(e.code))return Promise.reject(new De({code:be}));const s=new De(e);return t&&null!==Re&&Re.emit(qe,s),Promise.reject(s)},We="friend_get",Be="friend_get_specified",je="friend_check",Ke="friend_delete",Ye="friend_add",Je="friend_update",Ve="friend_response",ze="pendency_get",Qe="pendency_delete",Xe="pendency_report",Ze="group_get",et="group_add",st="group_delete",rt="group_update",it={info:4,warning:5,error:6},nt={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},ot={login:4};class at{constructor(e){this._n="SSOLogData",this.eventType=ot[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=x()}static bindEventStatModule(e){at.prototype._eventStatModule=e}updateTimeStamp(){this.timestamp=x()}start(e){return this._startts=e,this}end(e=!1){if(this._sentFlag)return;const t=x();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(e,t,s){if(!(e instanceof Error))return we.w(this._n+".setError value not instanceof Error, please check!"),this;if(this._sentFlag)return this;if(this.setNetworkType(s),t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{const e=Ee;this.setCode(e)}return this.setLevel("error"),this}setCode(e){return pe(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),de(e)?this.code=e:we.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return pe(e)||this._sentFlag||(de(e)&&(this.message=e.toString()),ue(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return pe(e)||this._sentFlag||(this.level=it[e]),this}setMoreMessage(e){return Te(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){if(pe(e))we.w(this._n+".setNetworkType value is undefined, please check!");else{const t=nt[e.toLowerCase()];pe(t)||(this.networkType=t)}return this}getStartTs(){return this._startts}setUIPlatform(e){this.uiPlatform=e}setExtension(e){return this.extension=e,this}setEventType(e){return this.eventType=e,this}}class dt{constructor(e){this._snsModule=e,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSequence=0,this._friendApplicationMap=new Map,this._unreadCount=0}getLocalFriendApplicationList(){return{friendApplicationList:[...this._friendApplicationMap.values()],unreadCount:this._unreadCount}}_onFriendApplicationListUpdated(){this._snsModule.emitOuterEvent($e,{friendApplicationList:[...this._friendApplicationMap.values()],unreadCount:this._unreadCount})}onFriendApplicationRead(){this._unreadCount=0,this._onFriendApplicationListUpdated()}onFriendApplicationAdded(e,t){if(Te(e))return;let s="";s=t===this._snsModule.getMyUserID()?P:G;let r=!1;e.forEach(e=>{const t=`${e.userID}_${s}`;s!==G||this._friendApplicationMap.has(t)||(this._unreadCount+=1),this._friendApplicationMap.set(t,new Ae({...e,type:s})),r=!0}),r&&this._onFriendApplicationListUpdated()}onFriendApplicationDeleted(e){Te(e)||(this._startTime=0,this._currentSequence=0,this.getFriendApplicationList())}getFriendApplicationList(){const e=this._n+".getFriendApplicationList",t=new at("getFriendApplicationList");return this._snsModule.request({protocolName:ze,requestData:{applicationType:C,fromAccount:this._snsModule.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSequence}}).then(s=>{const{resultList:r,unreadCount:i,startTime:n,currentSequence:o}=s.data;this._startTime=n,this._currentSequence=o,this._unreadCount=i;const a=`applicationCount:${le(r)?r.length:0} unreadCount:${i} startTime:${n} currentSequence:${o}`;t.setNetworkType(this._snsModule.getNetworkType()).setMessage(a).end(),we.i(`${e} ok. ${a}`),this._friendApplicationMap.clear(),le(r)&&r.forEach(e=>{const{userID:t,type:s}=e,r=new Ae(e);this._friendApplicationMap.set(`${t}_${s}`,r)}),this._onFriendApplicationListUpdated()}).catch(s=>(this._snsModule.probeNetwork().then(([e,r])=>{t.setError(s,e,r).end()}),we.w(e+" failed. error:",s),He(s)))}deleteFriendApplication(e){const t=this._n+".deleteFriendApplication",{userID:s,type:r}=e;let i=r;if((!i||i!==P&&i!==G)&&(i=G),!this._friendApplicationMap.has(`${s}_${i}`))return He({code:ve});const n=new at("deleteFriendApplication");n.setMessage(`userID:${s} type:${i}`);return this._snsModule.request({protocolName:Qe,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:[s],type:i}}).then(e=>{const{resultList:r}=e.data,{to:o,resultCode:a,resultInfo:d}=r[0];return n.setNetworkType(this._snsModule.getNetworkType()).setMoreMessage("resultList:"+JSON.stringify(r)).end(),we.i(`${t} ok. userID:${s} type:${i}`),0===a?Ie():He({userID:o,code:a,message:d})}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{n.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}acceptFriendApplication(e){const t=this._n+".acceptFriendApplication",{userID:s,remark:r,tag:i,type:n}=e;let o=n;(!o||o!==O&&o!==$)&&(o=$);const a=new at("acceptFriendApplication");a.setMessage(`userID:${s} type:${o}`);return this._snsModule.request({protocolName:Ve,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:s,remark:r,tag:i,action:o}]}}).then(e=>{a.setNetworkType(this._snsModule.getNetworkType()).end();const{resultList:r}=e.data,{resultCode:i,resultInfo:n}=r[0];if(0!==i)return He({code:i,message:n});we.i(`${t} ok. userID:${s} type:${o}`)}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{a.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}refuseFriendApplication(e){const t=this._n+".refuseFriendApplication",{userID:s}=e,r=new at("refuseFriendApplication");r.setMessage("userID:"+s);return this._snsModule.request({protocolName:Ve,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:s,action:"Response_Action_Reject"}]}}).then(e=>{r.setNetworkType(this._snsModule.getNetworkType()).end();const{resultList:i}=e.data,{resultCode:n,resultInfo:o}=i[0];if(0!==n)return He({code:n,message:o});we.i(`${t} ok. userID:${s}`)}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{r.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}_onFriendApplicationProcessed(e){if(0===e.length)return;let t=!1;e.forEach(e=>{const s=`${e.to}_${G}`;this._friendApplicationMap.has(s)&&(this._friendApplicationMap.delete(s),this._unreadCount-=1,t=!0)}),this._unreadCount<0&&(this._unreadCount=0),t&&this._onFriendApplicationListUpdated()}setFriendApplicationRead(){const e=this._n+".setFriendApplicationRead",t=new at("setFriendApplicationRead");var s,r;return this._snsModule.request({protocolName:Xe,requestData:{fromAccount:this._snsModule.getMyUserID(),latestTimeStamp:(s=x()/1e3,r=0,Math.round(Number(s)*Math.pow(10,r))/Math.pow(10,r))}}).then(s=>{t.setNetworkType(this._snsModule.getNetworkType()).end(),we.i(e+" ok"),this._unreadCount=0}).catch(s=>(this._snsModule.probeNetwork().then(([e,r])=>{t.setError(s,e,r).end()}),we.w(e+" failed. error:",s),He(s)))}reset(){this._startIndex=0,this._maxLimited=100,this._currentSequence=0,this._unreadCount=0,this._friendApplicationMap.clear()}}class ut{constructor(e){Te(e)||(this.userID=e.userID||"",this.nick=e.nick||"",this.gender=e.gender||"",this.birthday=e.birthday||0,this.location=e.location||"",this.selfSignature=e.selfSignature||"",this.allowType=e.allowType||S,this.language=e.language||0,this.avatar=e.avatar||"",this.messageSettings=e.messageSettings||0,this.adminForbidType=e.adminForbidType||N,this.level=e.level||0,this.role=e.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],Te(e.profileCustomField)||e.profileCustomField.forEach(e=>{this.profileCustomField.push({key:e.key,value:e.value})}))}validate(e){let t=!0,s="";if(Te(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField){const t=e.profileCustomField.length;let s=null;for(let r=0;r<t;r++){if(s=e.profileCustomField[r],!ue(s.key)||-1===s.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!ue(s.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}}for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if("profileCustomField"===r)continue;if(Te(e[r])&&!ue(e[r])&&!de(e[r])){s="key:"+r+", invalid value:"+e[r],t=!1;continue}switch(r){case"nick":ue(e[r])||(s="nick must be a string",t=!1),_e(e[r])>500&&(s=`nick name limited: must less than or equal to 500 bytes, current size: ${_e(e[r])} bytes`,t=!1);break;case"gender":fe(ne,e.gender)||(s="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":de(e.birthday)||(s="birthday must be a number",t=!1);break;case"location":ue(e.location)||(s="location must be a string",t=!1);break;case"selfSignature":ue(e.selfSignature)||(s="selfSignature must be a string",t=!1);break;case"allowType":fe(ae,e.allowType)||(s="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":de(e.language)||(s="language must be a number",t=!1);break;case"avatar":ue(e.avatar)||(s="avatar must be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(s="messageSettings must be 0 or 1",t=!1);break;case"adminForbidType":fe(oe,e.adminForbidType)||(s="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":de(e.level)||(s="level must be a number",t=!1);break;case"role":de(e.role)||(s="role must be a number",t=!1);break;default:s="unknown key:"+r+" "+e[r],t=!1}}return{valid:t,tips:s}}}class lt{constructor(e,t){this.userID=e,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;const s={},r=[];if(s.userID=e,!Te(t)){let e="",i="";for(let n=0,o=t.length;n<o;n++)if(e=t[n].tag,i=t[n].value,e.indexOf("Tag_SNS_Custom")>-1)this.friendCustomField.push({key:e,value:i});else if(e.indexOf("Tag_Profile_Custom")>-1)r.push({key:e,value:i});else switch(e){case H:s.nick=i;break;case W:s.gender=i;break;case B:s.birthday=i;break;case j:s.location=i;break;case K:s.selfSignature=i;break;case Y:s.allowType=i;break;case J:s.language=i;break;case V:s.avatar=i;break;case z:s.messageSettings=i;break;case Q:s.adminForbidType=i;break;case X:s.level=i;break;case Z:s.role=i;break;case te:this.remark=i;break;case ie:this.addTime=i;break;case ee:this.groupList=JSON.parse(JSON.stringify(i));break;case se:this.source=i;break;case re:break;default:we.l("snsProfileItem unknown tag->",t[n].tag)}}this.profile=new ut({...s,profileCustomField:r})}validate(e){let t=!0,s="";if(Te(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField){const t=e.profileCustomField.length;let s=null;for(let r=0;r<t;r++){if(s=e.profileCustomField[r],!ue(s.key)||-1===s.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!ue(s.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}}for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if("profileCustomField"===r)continue;if(Te(e[r])&&!ue(e[r])&&!de(e[r])){s="key:"+r+", invalid value:"+e[r],t=!1;continue}switch(r){case"nick":ue(e[r])||(s="nick must be a string",t=!1),_e(e[r])>500&&(s=`nick name limited: must less than or equal to 500 bytes, current size: ${_e(e[r])} bytes`,t=!1);break;case"gender":fe(ne,e.gender)||(s="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":de(e.birthday)||(s="birthday must be a number",t=!1);break;case"location":ue(e.location)||(s="location must be a string",t=!1);break;case"selfSignature":ue(e.selfSignature)||(s="selfSignature must be a string",t=!1);break;case"allowType":fe(ae,e.allowType)||(s="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":de(e.language)||(s="language must be a number",t=!1);break;case"avatar":ue(e.avatar)||(s="avatar must be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(s="messageSettings must be 0 or 1",t=!1);break;case"adminForbidType":fe(oe,e.adminForbidType)||(s="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":de(e.level)||(s="level must be a number",t=!1);break;case"role":de(e.role)||(s="role must be a number",t=!1);break;default:s="unknown key:"+r+" "+e[r],t=!1}}return{valid:t,tips:s}}update(e){let t="",s="";const r=[];this.friendCustomField.forEach(e=>{r.push(e.key)});for(let i=0,n=e.length;i<n;i++)if(t=e[i].tag,s=e[i].value,t.indexOf("Tag_SNS_Custom")>-1)r.indexOf(t)>-1?this.friendCustomField.forEach(e=>{e.key===t&&(e.value=s)}):this.friendCustomField.push({key:t,value:s});else if(t.indexOf("Tag_Profile_Custom")>-1){let e=!1;this.profile.profileCustomField.forEach(r=>{r.key===t&&(r.value=s,e=!0)}),e||this.profile.profileCustomField.push({key:t,value:s})}else switch(t){case H:this.profile.nick=s;break;case W:this.profile.gender=s;break;case B:this.profile.birthday=s;break;case j:this.profile.location=s;break;case K:this.profile.selfSignature=s;break;case Y:this.profile.allowType=s;break;case J:this.profile.language=s;break;case V:this.profile.avatar=s;break;case z:this.profile.messageSettings=s;break;case Q:this.profile.adminForbidType=s;break;case X:this.profile.level=s;break;case Z:this.profile.role=s;break;case te:this.remark=s;break;case ie:this.addTime=s;break;case ee:this.groupList=JSON.parse(JSON.stringify(s));break;case se:this.source=s;break;case re:break;default:we.d("snsProfileItem unkown tag->",e[i].tag)}this.timestamp=Date.now(),r.length=0}updateProfile(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}addToGroupList(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}removeFromGroupList(e){const t=this.groupList.indexOf(e);t>-1&&(this.groupList.splice(t,1),this.count=this.groupList.length)}}const pt=4,ct=11,ht=12,_t=15,ft=20,mt=23,gt=27,Mt=29;class yt{constructor(e){this._snsModule=e,this._n="FriendHandler",this._friendMap=new Map,this._startIndex=0,this._standardSequence=0,this._customSequence=0,this._expirationTime=18e4}getLocalFriendList(){return[...this._friendMap.values()]}getFriendRemark(e){return this._friendMap.has(e)?this._friendMap.get(e).remark:""}onFriendProfileModified(e){const{dataList:t}=e;if(Te(t))return;const s=this._snsModule.getModule(ct);t.forEach(e=>{const{userID:t,profileList:r}=e;if(this.isMyFriend(t)){we.l(`${this._n}.onFriendProfileModified. friend account:${t}, profileList:${JSON.stringify(r)}`);const e=this._friendMap.get(t);e.update(r),s.modifyMessageSentByPeer({conversationID:`${k}${t}`,latestNick:e.profile.nick,latestAvatar:e.profile.avatar})}}),this._onFriendListUpdated()}onFriendAdded(e){0!==e.length&&(we.l(`${this._n}.onFriendAdded userIDList:${e}`),e.forEach(e=>{this._friendMap.set(e,new lt(e))}),this.getFriendProfile({userIDList:e}).then(t=>{e.forEach(e=>{const t=this._friendMap.get(e);t.groupList.length>0&&this._snsModule.updateWhenFriendAdded({nameList:t.groupList,userID:e})}),this._onFriendListUpdated()}))}onFriendDeleted(e){0!==e.length&&(we.l(`${this._n}.onFriendDeleted userIDList:${e}`),e.forEach(e=>{const t=this._friendMap.get(e);t.groupList.length>0&&this._snsModule.updateWhenFriendDeleted({nameList:t.groupList,userID:e}),this._friendMap.delete(e)}),this._onFriendListUpdated())}_onFriendListUpdated(){this._snsModule.emitOuterEvent(Pe);this._snsModule.getModule(ct).checkAndPatchRemark()}getFriendProfile(e){const t=this._n+".getFriendProfile",{userIDList:s}=e,r=[],i=[],n=[];if(s.forEach(e=>{if(this._friendMap.has(e)){const t=this._friendMap.get(e);Date.now()-t.timestamp<this._expirationTime?i.push(t):n.push(e)}else r.push({userID:e,code:Le,message:this._snsModule.getErrorMessage(Le)})}),0===n.length)return we.i(t+" newUserIDList is empty"),xe({friendList:i,failureUserIDList:r});const o=new at("getFriendProfile");o.setMessage("userIDList:"+n),we.i(`${t} userIDList:${n}`);return this._snsModule.request({protocolName:Be,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:n}}).then(e=>{o.setNetworkType(this._snsModule.getNetworkType()).end(),we.i(t+" ok");const{resultList:s}=e.data;return s.forEach(e=>{const{to:t,resultCode:s,resultInfo:n,tagValueList:o}=e;if(pe(s)||0===s){let e;this._friendMap.has(t)?(e=this._friendMap.get(t),e.update(o)):(e=new lt(t,o),this._friendMap.set(t,e)),i.push(e)}else r.push({userID:t,code:s,message:n})}),Ie({friendList:i,failureUserIDList:r})}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{o.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}isMyFriend(e){return this._friendMap.has(e)}pagingGetFriendList(){const e=this._n+".getFriendList",t=new at("getFriendList"),s=Date.now();this._snsModule.request({protocolName:We,requestData:{fromAccount:this._snsModule.getMyUserID(),startIndex:this._startIndex,standardSequence:this._standardSequence,customSequence:this._customSequence}}).then(r=>{const{friendCount:i,resultList:n,nextStartIndex:o,standardSequence:a,customSequence:d,completeFlag:u}=r.data;this._startIndex=o,this._standardSequence=a,this._customSequence=d;const l=`friendCount:${i} nextStartIndex:${o} standardSequence:${a} customSequence:${d} completeFlag:${u} cost:${function(e,t=!0,s=!0){const r=Date.now();return t?s?r-e+" ms":Math.round((r-e)/1e3)+" s":s?r-e:Math.round((r-e)/1e3)}(s)}`;t.setNetworkType(this._snsModule.getNetworkType()).setMessage(l).end(),we.i(e+" ok.",l),Te(n)||n.forEach(e=>{const{to:t,tagValueList:s}=e;this._friendMap.set(t,new lt(t,s))}),0===u?this.pagingGetFriendList():(this._snsModule.emitOuterEvent(Pe),this._pagingGetFriendProfile())}).catch(s=>(this._snsModule.probeNetwork().then(([e,r])=>{t.setError(s,e,r).end()}),we.w(e+" failed. error:",s),He(s)))}_pagingGetFriendProfile(){const e=[...this._friendMap.keys()],t=this._snsModule.getModule(pt),s=e.length,r=s<=100?1:Math.ceil(s/100);we.l(`${this._n}._pagingGetFriendProfile friendCount:${s} pageCount:${r}`);for(let i=0;i<r;i++)t.getUserProfile({userIDList:e.slice(100*i,100*(i+1))}).then(e=>{e.data.forEach(e=>{const t=this._friendMap.get(e.userID);t&&t.updateProfile(e)}),this._onFriendListUpdated()})}addFriend(e){const t=this._n+".addFriend";if(this._friendMap.has(e.to))return He({code:ke});if(e.wording&&!1===this._snsModule.filterProfanity("wording",e))return He({code:Ce});const{to:s,source:r,type:i,wording:n,remark:o,groupName:a}=e;let d=i;(!d||d!==v&&d!==E)&&(d=E);const u=new at("addFriend");u.setMessage(`to:${s} source:${r} type:${d}`);return this._snsModule.request({protocolName:Ye,requestData:{fromAccount:this._snsModule.getMyUserID(),addFriendItem:[{to:s,source:r,wording:n,remark:o,groupName:a}],type:d}}).then(e=>{const{resultList:s}=e.data;u.setNetworkType(this._snsModule.getNetworkType()).setMoreMessage("resultList:"+JSON.stringify(s)).end();const{to:r,resultCode:i,resultInfo:n}=s[0];return we.i(`${t} ok. to:${r} type:${d} code:${i}`),pe(i)||0===i?Ie({userID:r,code:0}):30539===i?Ie({userID:r,code:i,message:this._snsModule.getErrorMessage(i)}):He({userID:r,code:i,message:this._snsModule.getErrorMessage(i)||n})}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{u.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}deleteFriend(e){const t=this._n+".deleteFriend",{userIDList:s,type:r}=e;var i;s.length>1e3&&(we.w(`${t} ${i=1e3,"the length of userIDList cannot exceed "+i}`),s.length=1e3);const n=[],o=[],a=[];if(s.forEach(e=>{this._friendMap.has(e)?a.push(e):n.push({userID:e,code:Le,message:this._snsModule.getErrorMessage(Le)})}),0===a.length)return xe({successUserIDList:o,failureUserIDList:n});let d=r;(!d||d!==b&&d!==U)&&(d=U);const u=new at("deleteFriend");u.setMessage(`userIDList:${a} type:${d}`);return this._snsModule.request({protocolName:Ke,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:a,type:d}}).then(e=>{u.setNetworkType(this._snsModule.getNetworkType()).end(),we.i(t+" ok");const{resultList:s}=e.data;return Te(s)||s.forEach(e=>{const{to:t,resultCode:s,resultInfo:r}=e;pe(s)||0===s?o.push({userID:t}):n.push({userID:t,code:s,message:r})}),Ie({successUserIDList:o,failureUserIDList:n})}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{u.setError(e,t,s).end()}),we.w(t+" error:",e),He(e)))}updateFriend(e){const{userID:t,remark:s,friendCustomField:r}=e;if(!this._friendMap.has(t))return He({code:Le});const i=this._n+".updateFriend",n=new at("updateFriend");n.setMessage(`userID:${t} remark:${s} friendCustomField:${r}`);const o=[];pe(s)||o.push({tag:te,value:s}),le(r)&&r.length>0&&r.forEach(e=>{o.push({tag:e.key,value:e.value})});return this._snsModule.request({protocolName:Je,requestData:{fromAccount:this._snsModule.getMyUserID(),updateItem:[{to:t,snsItem:o}]}}).then(e=>{n.setNetworkType(this._snsModule.getNetworkType()).end(),we.i(i+" ok");const{resultList:t}=e.data,{to:o,resultCode:a,resultInfo:d}=t[0];if(pe(a)||0===a){const e=this._friendMap.get(o);return e&&(pe(s)||(e.remark=s),le(r)&&r.length>0&&function(e,t){if(!le(e)||!le(t))return!1;let s=!1;t.forEach(({key:t,value:r})=>{const i=e.find(e=>e.key===t);i?i.value!==r&&(i.value=r,s=!0):(e.push({key:t,value:r}),s=!0)})}(e.friendCustomField,r),this._onFriendListUpdated()),Ie(e)}return He({code:a,message:d})}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{n.setError(e,t,s).end()}),we.w(i+" failed. error:",e),He(e)))}checkFriend(e){const t=this._n+".checkFriend",{userIDList:s,type:r}=e;let i=r;(!i||i!==R&&i!==q)&&(i=q);const n=new at("checkFriend");n.setMessage(`userIDList:${s} type:${i}`);return this._snsModule.request({protocolName:je,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:s,type:i}}).then(e=>{n.setNetworkType(this._snsModule.getNetworkType()).end(),we.i(`${t} ok. userIDList:${s} type:${i}`);const r=[],o=[],{resultList:a}=e.data;return le(a)&&a.forEach(e=>{const{to:t,relation:s,resultCode:i,resultInfo:n}=e;pe(i)||0===i?r.push({userID:t,code:0,relation:s}):o.push({userID:t,code:i,message:n})}),Ie({successUserIDList:r,failureUserIDList:o})}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{n.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}updateWhenAddedToFriendGroup(e){const{name:t,userIDList:s}=e;we.l(`${this._n}.updateWhenAddedToFriendGroup groupName:${t} userIDList:${s}`),t&&!Te(s)&&s.forEach(e=>{if(this._friendMap.has(e)){this._friendMap.get(e).addToGroupList(t)}})}updateWhenRemovedFromFriendGroup(e){const{name:t,userIDList:s}=e;we.l(`${this._n}.updateWhenRemovedFromFriendGroup groupName:${t} userIDList:${s}`),t&&!Te(s)&&s.forEach(e=>{if(this._friendMap.has(e)){this._friendMap.get(e).removeFromGroupList(t)}})}reset(){this._friendMap.clear(),this._startIndex=0,this._standardSequence=0,this._customSequence=0}}class wt{constructor(e){Te(e)||(this.name=e.name||"",this.userIDList=e.userIDList||[],this.count=this.userIDList.length||0)}addToUserIDList(e){-1===this.userIDList.indexOf(e)&&(this.userIDList.push(e),this.count=this.userIDList.length)}removeFromUserIDList(e){const t=this.userIDList.indexOf(e);t>-1&&(this.userIDList.splice(t,1),this.count=this.userIDList.length)}}class Ft{constructor(e){this._snsModule=e,this._n="FriendGroupHandler",this._friendGroupMap=new Map}getLocalFriendGroupList(){return[...this._friendGroupMap.values()]}_emitFriendGroupListUpdated(){const e=[...this._friendGroupMap.values()];this._snsModule.emitOuterEvent(Oe,e)}getFriendGroupList(){const e=this._n+".getFriendGroupList",t=new at("getFriendGroupList");return this._snsModule.request({protocolName:Ze,requestData:{fromAccount:this._snsModule.getMyUserID()}}).then(s=>{t.setNetworkType(this._snsModule.getNetworkType()).end();const{resultList:r}=s.data;Te(r)?we.i(e+" ok. friend group count:0"):(we.i(`${e} ok. friend group count:${r.length}`),this._friendGroupMap.clear(),r.forEach(e=>{const t=new wt(e);this._friendGroupMap.set(e.name,t)}),this._emitFriendGroupListUpdated())}).catch(s=>(this._snsModule.probeNetwork().then(([e,r])=>{t.setError(s,e,r).end()}),we.w(e+" error:",s),He(s)))}createFriendGroup(e){const t=this._n+".createFriendGroup",{name:s,userIDList:r}=e;if(this._friendGroupMap.has(s))return He({code:Se});const i=new at("createFriendGroup");return i.setMessage(`name:${s} userIDList:${r}`),this._snsModule.request({protocolName:et,requestData:{fromAccount:this._snsModule.getMyUserID(),groupName:[s],userIDList:le(r)?r:void 0}}).then(e=>{i.setNetworkType(this._snsModule.getNetworkType()).end(),we.l(`${t} ok. name:${s} userIDList:${r}`);const{resultList:n}=e.data,o=[],a=[];n&&n.forEach(e=>{const{to:t,resultCode:s,resultInfo:r}=e;if(pe(s)||0===s)o.push(t);else{const t={userID:e.to,code:s,message:r};a.push(t)}});const d=new wt({name:s,userIDList:o});return this._friendGroupMap.set(s,d),this._snsModule.updateWhenAddedToFriendGroup({name:s,userIDList:o}),this._emitFriendGroupListUpdated(),Ie({friendGroup:d,failureUserIDList:a})}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{i.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}deleteFriendGroup(e){const t=this._n+".deleteFriendGroup",{name:s}=e;if(!this._friendGroupMap.has(s))return He({code:Ne});const r=new at("deleteFriendGroup");r.setMessage("name:"+s);return this._snsModule.request({protocolName:st,requestData:{fromAccount:this._snsModule.getMyUserID(),nameList:[s]}}).then(e=>{r.setNetworkType(this._snsModule.getNetworkType()).end(),we.l(`${t} ok. name:${s}`);const i=this._friendGroupMap.get(s);return i&&(this._snsModule.updateWhenRemovedFromFriendGroup({name:s,userIDList:i.userIDList}),this._friendGroupMap.delete(s),i.userIDList.length=0),this._emitFriendGroupListUpdated(),Ie(i)}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{r.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}renameFriendGroup(e){const t=this._n+".renameFriendGroup",{oldName:s,newName:r}=e;if(!this._friendGroupMap.has(s))return He({code:Ne});const i=new at("renameFriendGroup");i.setMessage(`oldName:${s} newName:${r}`);return this._snsModule.request({protocolName:rt,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:s,newName:r}}).then(()=>{if(i.setNetworkType(this._snsModule.getNetworkType()).end(),we.l(`${t} ok. oldName:${s} newName:${r}`),this._friendGroupMap.has(s)){const e=this._friendGroupMap.get(s);return e.name=r,this._friendGroupMap.delete(s),this._friendGroupMap.set(r,e),this._snsModule.updateWhenRemovedFromFriendGroup({name:s,userIDList:e.userIDList}),this._snsModule.updateWhenAddedToFriendGroup({name:r,userIDList:e.userIDList}),this._emitFriendGroupListUpdated(),Ie(e)}return Ie()}).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{i.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}addToFriendGroup(e){const t=this._n+".addToFriendGroup",{name:s,userIDList:r}=e;if(!this._friendGroupMap.has(s))return this._onFriendGroupNotExist(s);const i=new at("addToFriendGroup");i.setMessage(`name:${s} userIDList:${r}`),we.l(`${t} name:${s} userIDList:${r}`);return this._snsModule.request({protocolName:rt,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:s,updateGroupItem:r.filter(e=>this._snsModule.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Add"}))}}).then(e=>(i.setNetworkType(this._snsModule.getNetworkType()).end(),this._onFriendGroupUpdated(s,e))).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{i.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}removeFromFriendGroup(e){const t=this._n+".removeFromFriendGroup",{name:s,userIDList:r}=e;if(!this._friendGroupMap.has(s))return this._onFriendGroupNotExist(s);const i=new at("removeFromFriendGroup");i.setMessage(`name:${s} userIDList:${r}`),we.l(`${t} name:${s} userIDList:${r}`);return this._snsModule.request({protocolName:rt,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:s,updateGroupItem:r.filter(e=>this._snsModule.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Delete"}))}}).then(e=>(i.setNetworkType(this._snsModule.getNetworkType()).end(),this._onFriendGroupUpdated(s,e))).catch(e=>(this._snsModule.probeNetwork().then(([t,s])=>{i.setError(e,t,s).end()}),we.w(t+" failed. error:",e),He(e)))}_onFriendGroupUpdated(e,t){const{resultList:s}=t.data,r=this._friendGroupMap.get(e),i=[],n=[],o=[];return le(s)&&s.forEach(e=>{const{to:t,resultCode:s,resultInfo:a,type:d}=e;0===s?"Update_Type_Add"===d?r&&(r.addToUserIDList(t),n.push(t)):"Update_Type_Delete"===d&&r&&(r.removeFromUserIDList(t),o.push(t)):i.push({to:e.to,code:s,message:a})}),we.l(`${this._n}._onFriendGroupUpdated name:${e} userIDList:${r.userIDList}`),n.length>0&&this._snsModule.updateWhenAddedToFriendGroup({name:e,userIDList:n}),o.length>0&&this._snsModule.updateWhenRemovedFromFriendGroup({name:e,userIDList:o}),Ie({friendGroup:r,failureUserIDList:i})}updateWhenFriendAdded(e){const{nameList:t,userID:s}=e;we.l(`${this._n}.updateWhenFriendAdded userID:${s} nameList:${t}`),Te(t)||t.forEach(e=>{if(this._friendGroupMap.has(e)){this._friendGroupMap.get(e).addToUserIDList(s)}})}updateWhenFriendDeleted(e){const{nameList:t,userID:s}=e;we.l(`${this._n}.updateWhenFriendDeleted userID:${s} nameList:${t}`),Te(t)||t.forEach(e=>{if(this._friendGroupMap.has(e)){this._friendGroupMap.get(e).removeFromUserIDList(s)}})}reset(){this._friendGroupMap.clear()}}class Tt extends class{constructor(e){this._m=e,this._n=""}isLoggedIn(){return this._m.getModule(ht).isLoggedIn()}isOversea(){return this._m.getModule(ht).isOversea()}isPrivateNetWork(){return this._m.getModule(ht).isPrivateNetWork()}getFileDownloadProxy(){return this._m.getModule(ht).getFileDownloadProxy()}getMyUserID(){return this._m.getModule(ht).getUserID()}getMyTinyID(){return this._m.getModule(ht).getTinyID()}getSDKAppID(){return this._m.getModule(ht).getSDKAppID()}isIntl(){return this._m.getModule(ht).isIntl()}isUsingChatCore(){return this._m.getModule(ht).isUsingChatCore()}isDevMode(){return this._m.getModule(ht).isDevMode()}getModule(e){return this._m.getModule(e)}getPlatform(){return D}getNetworkType(){return this._m.getModule(_t).getNetworkType()}probeNetwork(e){return this._m.getModule(_t).probe(e)}getCloudConfig(e){return this._m.getModule(mt).getCloudConfig(e)}emitOuterEvent(e,t){this._m.getOuterEmitterInstance().emit(e,t)}emitInnerEvent(e,t){this._m.getInnerEmitterInstance().emit(e,t)}getInnerEmitterInstance(){return this._m.getInnerEmitterInstance()}generateTjgID(e){return this._m.getModule(ht).getTinyID()+"-"+e.random}filterModifiedMessage(e){if(Te(e))return;const t=e.filter(e=>!0===e.isModified);t.length>0&&this.emitOuterEvent(Ge,t)}filterUnmodifiedMessage(e){if(Te(e))return[];return e.filter(e=>!1===e.isModified)}request(e){return this._m.getModule(ft).request(e)}canIUse(e){return this._m.getModule(gt).canIUse(e)}getErrorMessage(e,t,s){return this._m.getErrorMessage(e,t,s)}outputWarning(e,t,s){const r=this.getErrorMessage(e,t,s);r&&we.w(r)}cannotUseCommercialAbility(e){const t=Ue;return He({code:t,message:this.getErrorMessage(t,e)})}}{constructor(t){super(t),this._n="SnsModule",this._friendHandler=new yt(this),this._friendApplicationHandler=new dt(this),this._friendGroupHandler=new Ft(this);this.getInnerEmitterInstance().on(e.A2KEY_AND_TINYID_UPDATED,this.onContextUpdated,this)}onContextUpdated(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getFriendGroupList(),this._friendApplicationHandler.getFriendApplicationList()}onRelationChainModified(e){const{dataList:t}=e;if(Te(t))return;const s=[],r=[],i=[],n=[];let o=!1,a="";t.forEach(e=>{if(3!==e.pushType&&4!==e.pushType||!e.from||(a=e.from),e.friendAddAccount&&(s.push(...e.friendAddAccount),n.push(...e.friendAddAccount)),e.friendDelAccount&&r.push(...e.friendDelAccount),e.friendApplicationAdded&&i.push(...e.friendApplicationAdded),e.friendApplicationDeletedUserIDList&&n.push(...e.friendApplicationDeletedUserIDList),e.reportTime&&7===e.pushType&&(o=!0),e.friendUpInfo){const t={dataList:[]};e.friendUpInfo.forEach(e=>{t.dataList.push({userID:e.friendAccount,profileList:[...e.sns]})}),this.onFriendProfileModified(t)}}),o&&this._friendApplicationHandler.onFriendApplicationRead(),this._friendApplicationHandler.onFriendApplicationAdded(i,a),this._friendApplicationHandler.onFriendApplicationDeleted(n),this._friendHandler.onFriendAdded(s),this._friendHandler.onFriendDeleted(r)}isMyFriend(e){return this._friendHandler.isMyFriend(e)}filterProfanity(e,t){const s=this.getModule(Mt);if(!s)return!0;const{isAllowedToSend:r,modifiedText:i}=s.filterText(t[e],c);return!0===r&&(t[e]=i,!0)}onFriendProfileModified(e){this._friendHandler.onFriendProfileModified(e)}getLocalFriendList(e=!0){const t=this._friendHandler.getLocalFriendList();return e?xe(t):t}getFriendRemark(e){return this._friendHandler.getFriendRemark(e)}getFriendList(){return this._friendHandler.pagingGetFriendList()}addFriend(e){return this._friendHandler.addFriend(e)}deleteFriend(e){return this._friendHandler.deleteFriend(e)}checkFriend(e){return this._friendHandler.checkFriend(e)}getFriendProfile(e){return this._friendHandler.getFriendProfile(e)}updateFriend(e){return this._friendHandler.updateFriend(e)}updateWhenAddedToFriendGroup(e){this._friendHandler.updateWhenAddedToFriendGroup(e)}updateWhenRemovedFromFriendGroup(e){this._friendHandler.updateWhenRemovedFromFriendGroup(e)}getLocalFriendApplicationList(){const e=this._friendApplicationHandler.getLocalFriendApplicationList();return xe(e)}deleteFriendApplication(e){return this._friendApplicationHandler.deleteFriendApplication(e)}refuseFriendApplication(e){return this._friendApplicationHandler.refuseFriendApplication(e)}acceptFriendApplication(e){return this._friendApplicationHandler.acceptFriendApplication(e)}setFriendApplicationRead(e){return this._friendApplicationHandler.setFriendApplicationRead(e)}getLocalFriendGroupList(){const e=this._friendGroupHandler.getLocalFriendGroupList();return xe(e)}createFriendGroup(e){return this._friendGroupHandler.createFriendGroup(e)}deleteFriendGroup(e){return this._friendGroupHandler.deleteFriendGroup(e)}addToFriendGroup(e){return this._friendGroupHandler.addToFriendGroup(e)}removeFromFriendGroup(e){return this._friendGroupHandler.removeFromFriendGroup(e)}renameFriendGroup(e){return this._friendGroupHandler.renameFriendGroup(e)}onAddToFriendGroup(e){return this._friendGroupHandler.onAddToFriendGroup(e)}updateWhenFriendAdded(e){this._friendGroupHandler.updateWhenFriendAdded(e)}updateWhenFriendDeleted(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}reset(){we.l(this._n+".reset"),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}export{Tt as default};
"use strict";const e={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG_UPDATED:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"};let t,s;t="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const i=function(){},r=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let n=r.length;for(;n--;)s=r[n],console[s]||(t[s]=i);var o=t;class a{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}}const 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:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.18.188"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT:"wss://wssidn.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},u={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},c="CHINA",l={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(e=c){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",FOLLOW:"follow"}},p=(new a(0,Math.pow(2,0)).toString(),new a(0,Math.pow(2,1)).toString(),new a(0,Math.pow(2,2)).toString(),new a(0,Math.pow(2,3)).toString(),new a(0,Math.pow(2,4)).toString(),new a(0,Math.pow(2,6)).toString(),new a(0,Math.pow(2,7)).toString(),new a(0,Math.pow(2,9)).toString(),new a(0,Math.pow(2,10)).toString(),new a(0,Math.pow(2,11)).toString(),new a(0,Math.pow(2,13)).toString(),new a(0,Math.pow(2,15)).toString(),new a(Math.pow(2,6)).toString(),new a(Math.pow(2,7)).toString(),new a(Math.pow(2,8)).toString(),new a(Math.pow(2,9)).toString(),new a(Math.pow(2,10)).toString(),new a(Math.pow(2,16)).toString(),"sns"),h=(l.HOST.setCurrent(c),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),f=(h&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),_="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),m="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),g="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),M="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,y="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,F=h||f||_||m||g||y||M,A=("undefined"!=typeof uni||"undefined"!=typeof window)&&!F,I=(f?qq:_?tt:m?swan:g?my:h?wx:y?uni:M&&jd,A&&window&&window.navigator&&window.navigator.userAgent||""),w=/(micromessenger|webbrowser)/i.test(I),D=/AppleWebKit\/([\d.]+)/i.exec(I),T=(D&&parseFloat(D.pop()),function(){let e="WEB";return w?e="WEB":f?e="QQ_MP":_?e="TT_MP":m?e="BAIDU_MP":g?e="ALI_MP":h?e="WX_MP":y&&(e="UNI_NATIVE_APP"),u[e]}()),L=(!function(){var e=I.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),function(){var e,t,r=I.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);r&&(e=r[1]&&parseFloat(r[1]),t=r[2]&&parseFloat(r[2]),e&&t&&parseFloat(r[1]+"."+r[2]))}(),function(){var e=I.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),/MSIE/.test(I)||-1<I.indexOf("Trident")&&-1<I.indexOf("rv:11.0")),S=(!function(){var e=/MSIE\s(\d+)\.\d/.exec(I),e=e&&parseFloat(e[1]);!e&&/Trident\/7.0/i.test(I)&&/rv:11.0/.test(I)}(),function(){var e=I.match(/TBS\/(\d+)/i);e&&e[1]&&e[1]}(),"C2C"),E="AllowType_Type_AllowAny",k="AdminForbid_Type_None",v="Add_Type_Single",b="Add_Type_Both",G="Delete_Type_Single",C="Delete_Type_Both",U="Pendency_Type_Both",N="Pendency_Type_ComeIn",P="Pendency_Type_SendOut",O="Response_Action_Agree",$="Response_Action_AgreeAndAdd",R="CheckResult_Type_Both",q="CheckResult_Type_Single",x=function(){return(new Date).getTime()+0},H="Tag_Profile_IM_Nick",W="Tag_Profile_IM_Gender",B="Tag_Profile_IM_BirthDay",j="Tag_Profile_IM_Location",K="Tag_Profile_IM_SelfSignature",Y="Tag_Profile_IM_AllowType",J="Tag_Profile_IM_Language",V="Tag_Profile_IM_Image",z="Tag_Profile_IM_MsgSettings",Q="Tag_Profile_IM_AdminForbidType",X="Tag_Profile_IM_Level",Z="Tag_Profile_IM_Role",ee={GROUP:"Tag_SNS_IM_Group",REMARK:"Tag_SNS_IM_Remark",ADDSOURCE:"Tag_SNS_IM_AddSource",ADDWORDING:"Tag_SNS_IM_Wording",ADDTIME:"Tag_SNS_IM_AddTime"},te="Gender_Type_",se={UNKNOWN:te+"Unknown",FEMALE:te+"Female",MALE:te+"Male"},ie={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},re={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},ne=Object.prototype.hasOwnProperty;function oe(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(pe(e)){for(const t in e)if(ne.call(e,t))return!1;return!0}return!!(ae(e)||de(e)||ue(e))&&0===e.size}const ae=function(e){return"map"===me(e)},de=function(e){return"set"===me(e)},ue=function(e){return"file"===me(e)},ce=function(e){return null!==e&&("number"==typeof e&&!isNaN(+e)||"object"==typeof e&&e.constructor===Number)},le=function(e){return"string"==typeof e},pe=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},he=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===me(e)},fe=function(e){return void 0===e},_e=function(e){return e instanceof Error},me=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},ge=(Date.now||(Date.now=function(){return(new Date).getTime()}),function(e){if(0===e.length)return 0;let t=0,r=0,i;for(var s="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)i=e[t++].charCodeAt[t]<=255?1:!1===s?3:2,r+=i;return r}),Me=function(e,t){for(const r in e)if(e[r]===t)return!0;return!1};function ye(){return!L&&!F}let Fe=0;function Ae(){return ye()?"%c Chat %c":"Chat"}function Ie(){const e=function(){const e=new Date;return e.setTime(x()),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())}const we={arguments2String(r){let i="";if(1===r.length)i=r[0];else for(let e=0,t=r.length;e<t;e++)s=r[e],he(s)||null!==s&&"object"==typeof s?_e(r[e])?i+=(s=r[e],JSON.stringify(s,["message","code"])):i+=JSON.stringify(r[e]):i+=r[e],i+=" ";var s;return i},_exec(e,t){ye()?o[e](Ae(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",Ie(),t):o[e](`${Ae()} ${Ie()} `+t)},d:function(){var e;Fe<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;Fe<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;Fe<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;Fe<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;Fe<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;Fe<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+Fe+" to "+e),Fe=e},getLevel:function(){return Fe}};class De{constructor(e){oe(e)||(this.userID=e.userID||"",this.nick=e.nick||"",this.avatar=e.avatar||"",this.time=e.time||0,this.source=e.source||"",this.wording=e.wording||"",this.type=e.type||"")}}const Te=function(e){return{code:0,data:e||{}}};class Le extends Error{constructor(e){super();var{code:e,message:t,data:r}=e;this.code=e,this.message=t||this._getErrorMessage(this.code),this.data=r||{}}}const Se=2700,Ee=2701,ke=2710,ve=2711,be=2716,Ge=2805,Ce=2903,Ue=3122,Ne=3123,Pe="onFriendListUpdated",Oe="onFriendGroupListUpdated",$e="onFriendApplicationListUpdated",Re="error";let qe=null;const xe=function(e){return Promise.resolve(Te(e))},He=function(e,t=!1){if(e instanceof Le)return t&&null!==qe&&qe.emit(Re,e),Promise.reject(e);if(e instanceof Error){const e=new Le({code:Ce});return t&&null!==qe&&qe.emit(Re,e),Promise.reject(e)}if(fe(e)||fe(e.code))return Promise.reject(new Le({code:Ce}));e=new Le(e);return t&&null!==qe&&qe.emit(Re,e),Promise.reject(e)},We="friend_get",Be="friend_get_specified",je="friend_check",Ke="friend_delete",Ye="friend_add",Je="friend_update",Ve="friend_response",ze="pendency_get",Qe="pendency_delete",Xe="pendency_report",Ze="group_get",et="group_add",st="group_delete",it="group_update",rt={info:4,warning:5,error:6},nt={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},ot={login:4,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16};class at{constructor(e){this._n="SSOLogData",this.eventType=ot[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=x()}static bindEventStatModule(e){at.prototype._eventStatModule=e}static bindNetMonitorModule(e){at.prototype._netMonitorModule=e}updateTimeStamp(){this.timestamp=x()}start(e){return this._startts=e,this}end(e=!1){if(!this._sentFlag){if(this._netMonitorModule){const e=this._netMonitorModule.getNetworkType();this.setNetworkType(e)}var t=x();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(e){if(!(e instanceof Error))return we.w(this._n+".setError value not instanceof Error, please check!"),this;if(this._sentFlag)return this;let t=!0;if(t=this._netMonitorModule?this._netMonitorModule.isOnline():t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{const e=Ge;this.setCode(e)}return this.setLevel("error"),this}setCode(e){return fe(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),ce(e)?this.code=e:we.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return fe(e)||this._sentFlag||(ce(e)&&(this.message=e.toString()),le(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return fe(e)||this._sentFlag||(this.level=rt[e]),this}setMoreMessage(e){return oe(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){return fe(e)?we.w(this._n+".setNetworkType value is undefined, please check!"):(e=nt[e.toLowerCase()],fe(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}}class dt{constructor(e){this._snsM=e,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSequence=0,this._friendApplicationMap=new Map,this._unreadCount=0}getLocalFriendApplicationList(){return{friendApplicationList:[...this._friendApplicationMap.values()],unreadCount:this._unreadCount}}_onFriendApplicationListUpdated(){this._snsM.emitOuterEvent($e,{friendApplicationList:[...this._friendApplicationMap.values()],unreadCount:this._unreadCount})}onFriendApplicationRead(){this._unreadCount=0,this._onFriendApplicationListUpdated()}onFriendApplicationAdded(e,t){if(!oe(e)){let r,i=(r=t===this._snsM.getMyUserID()?P:N,!1);e.forEach(e=>{var t=e.userID+"_"+r;r!==N||this._friendApplicationMap.has(t)||(this._unreadCount+=1),this._friendApplicationMap.set(t,new De({...e,type:r})),i=!0}),i&&this._onFriendApplicationListUpdated()}}onFriendApplicationDeleted(e){oe(e)||(this._startTime=0,this._currentSequence=0,this.getFriendApplicationList())}getFriendApplicationList(){const n=this._n+".getFriendApplicationList",o=new at("getFriendApplicationList");return this._snsM.req({proto:ze,data:{applicationType:U,fromAccount:this._snsM.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSequence}}).then(e=>{const{resultList:t,unreadCount:r,startTime:i,currentSequence:s}=e.data;this._startTime=i,this._currentSequence=s,this._unreadCount=r;e=`applicationCount:${he(t)?t.length:0} unreadCount:${r} startTime:${i} currentSequence:`+s;o.setMessage(e).end(),we.i(n+" ok. "+e),this._friendApplicationMap.clear(),he(t)&&t.forEach(e=>{var{userID:t,type:r}=e,e=new De(e);this._friendApplicationMap.set(t+"_"+r,e)}),this._onFriendApplicationListUpdated()}).catch(e=>(o.setError(e).end(),we.w(n+" failed. error:",e),He(e)))}deleteFriendApplication(e){const s=this._n+".deleteFriendApplication",{userID:n,type:t}=e;let o=t;if(o&&(o===P||o===N)||(o=N),!this._friendApplicationMap.has(n+"_"+o))return He({code:be});const a=new at("deleteFriendApplication");return a.setMessage(`userID:${n} type:`+o),this._snsM.req({proto:Qe,data:{fromAccount:this._snsM.getMyUserID(),userIDList:[n],type:o}}).then(e=>{var e=e.data["resultList"],{to:t,resultCode:r,resultInfo:i}=e[0];return a.setMoreMessage("resultList:"+JSON.stringify(e)).end(),we.i(s+` ok. userID:${n} type:`+o),0===r?Te():He({userID:t,code:r,message:i})}).catch(e=>(a.setError(e).end(),we.w(s+" failed. error:",e),He(e)))}acceptFriendApplication(e){const r=this._n+".acceptFriendApplication",{userID:i,remark:t,tag:s,type:n}=e;let o=n;o&&(o===O||o===$)||(o=$);const a=new at("acceptFriendApplication");return a.setMessage(`userID:${i} type:`+o),this._snsM.req({proto:Ve,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:i,remark:t,tag:s,action:o}]}}).then(e=>{a.end();var e=e.data["resultList"],{resultCode:e,resultInfo:t}=e[0];if(0!==e)return He({code:e,message:t});we.i(r+` ok. userID:${i} type:`+o)}).catch(e=>(a.setError(e).end(),we.w(r+" failed. error:",e),He(e)))}refuseFriendApplication(e){const r=this._n+".refuseFriendApplication",i=e["userID"],s=new at("refuseFriendApplication");return s.setMessage("userID:"+i),this._snsM.req({proto:Ve,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:i,action:"Response_Action_Reject"}]}}).then(e=>{s.end();var e=e.data["resultList"],{resultCode:e,resultInfo:t}=e[0];if(0!==e)return He({code:e,message:t});we.i(r+" ok. userID:"+i)}).catch(e=>(s.setError(e).end(),we.w(r+" failed. error:",e),He(e)))}_onFriendApplicationProcessed(e){if(0!==e.length){let t=!1;e.forEach(e=>{e=e.to+"_"+N;this._friendApplicationMap.has(e)&&(this._friendApplicationMap.delete(e),--this._unreadCount,t=!0)}),this._unreadCount<0&&(this._unreadCount=0),t&&this._onFriendApplicationListUpdated()}}setFriendApplicationRead(){const t=this._n+".setFriendApplicationRead",r=new at("setFriendApplicationRead");var e;return this._snsM.req({proto:Xe,data:{fromAccount:this._snsM.getMyUserID(),latestTimeStamp:(e=x()/1e3,Math.round(Number(e)*Math.pow(10,0))/Math.pow(10,0))}}).then(e=>{r.end(),we.i(t+" ok"),this._unreadCount=0}).catch(e=>(r.setError(e).end(),we.w(t+" failed. error:",e),He(e)))}reset(){this._startIndex=0,this._maxLimited=100,this._currentSequence=0,this._unreadCount=0,this._friendApplicationMap.clear()}}class ut{constructor(e){oe(e)||(this.userID=e.userID||"",this.nick=e.nick||"",this.gender=e.gender||"",this.birthday=e.birthday||0,this.location=e.location||"",this.selfSignature=e.selfSignature||"",this.allowType=e.allowType||E,this.language=e.language||0,this.avatar=e.avatar||"",this.messageSettings=e.messageSettings||0,this.adminForbidType=e.adminForbidType||k,this.level=e.level||0,this.role=e.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],oe(e.profileCustomField)||e.profileCustomField.forEach(e=>{this.profileCustomField.push({key:e.key,value:e.value})}))}validate(r){let i=!0,e="";if(oe(r))return{valid:!1,tips:"empty options"};if(r.profileCustomField){const i=r.profileCustomField.length;let t=null;for(let e=0;e<i;e++){if(t=r.profileCustomField[e],!le(t.key)||-1===t.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!le(t.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}}for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if("profileCustomField"===t)continue;if(oe(r[t])&&!le(r[t])&&!ce(r[t])){e="key:"+t+", invalid value:"+r[t],i=!1;continue}switch(t){case"nick":le(r[t])||(e="nick must be a string",i=!1),500<ge(r[t])&&(e=`nick name limited: must less than or equal to 500 bytes, current size: ${ge(r[t])} bytes`,i=!1);break;case"gender":Me(se,r.gender)||(e="key:gender, invalid value:"+r.gender,i=!1);break;case"birthday":ce(r.birthday)||(e="birthday must be a number",i=!1);break;case"location":le(r.location)||(e="location must be a string",i=!1);break;case"selfSignature":le(r.selfSignature)||(e="selfSignature must be a string",i=!1);break;case"allowType":Me(re,r.allowType)||(e="key:allowType, invalid value:"+r.allowType,i=!1);break;case"language":ce(r.language)||(e="language must be a number",i=!1);break;case"avatar":le(r.avatar)||(e="avatar must be a string",i=!1);break;case"messageSettings":0!==r.messageSettings&&1!==r.messageSettings&&(e="messageSettings must be 0 or 1",i=!1);break;case"adminForbidType":Me(ie,r.adminForbidType)||(e="key:adminForbidType, invalid value:"+r.adminForbidType,i=!1);break;case"level":ce(r.level)||(e="level must be a number",i=!1);break;case"role":ce(r.role)||(e="role must be a number",i=!1);break;default:e="unknown key:"+t+" "+r[t],i=!1}}return{valid:i,tips:e}}}class ct{constructor(e,s){this.userID=e,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;const n={},o=[];if(n.userID=e,!oe(s)){let r="",i;for(let e=0,t=s.length;e<t;e++)if(r=s[e].tag,i=s[e].value,-1<r.indexOf("Tag_SNS_Custom"))this.friendCustomField.push({key:r,value:i});else if(-1<r.indexOf("Tag_Profile_Custom"))o.push({key:r,value:i});else switch(r){case H:n.nick=i;break;case W:n.gender=i;break;case B:n.birthday=i;break;case j:n.location=i;break;case K:n.selfSignature=i;break;case Y:n.allowType=i;break;case J:n.language=i;break;case V:n.avatar=i;break;case z:n.messageSettings=i;break;case Q:n.adminForbidType=i;break;case X:n.level=i;break;case Z:n.role=i;break;case ee.REMARK:this.remark=i;break;case ee.ADDTIME:this.addTime=i;break;case ee.GROUP:this.groupList=JSON.parse(JSON.stringify(i));break;case ee.ADDSOURCE:this.source=i;break;case ee.ADDWORDING:break;default:we.l("snsProfileItem unknown tag->",s[e].tag)}}this.profile=new ut({...n,profileCustomField:o})}validate(r){let i=!0,e="";if(oe(r))return{valid:!1,tips:"empty options"};if(r.profileCustomField){const i=r.profileCustomField.length;let t=null;for(let e=0;e<i;e++){if(t=r.profileCustomField[e],!le(t.key)||-1===t.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!le(t.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}}for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if("profileCustomField"===t)continue;if(oe(r[t])&&!le(r[t])&&!ce(r[t])){e="key:"+t+", invalid value:"+r[t],i=!1;continue}switch(t){case"nick":le(r[t])||(e="nick must be a string",i=!1),500<ge(r[t])&&(e=`nick name limited: must less than or equal to 500 bytes, current size: ${ge(r[t])} bytes`,i=!1);break;case"gender":Me(se,r.gender)||(e="key:gender, invalid value:"+r.gender,i=!1);break;case"birthday":ce(r.birthday)||(e="birthday must be a number",i=!1);break;case"location":le(r.location)||(e="location must be a string",i=!1);break;case"selfSignature":le(r.selfSignature)||(e="selfSignature must be a string",i=!1);break;case"allowType":Me(re,r.allowType)||(e="key:allowType, invalid value:"+r.allowType,i=!1);break;case"language":ce(r.language)||(e="language must be a number",i=!1);break;case"avatar":le(r.avatar)||(e="avatar must be a string",i=!1);break;case"messageSettings":0!==r.messageSettings&&1!==r.messageSettings&&(e="messageSettings must be 0 or 1",i=!1);break;case"adminForbidType":Me(ie,r.adminForbidType)||(e="key:adminForbidType, invalid value:"+r.adminForbidType,i=!1);break;case"level":ce(r.level)||(e="level must be a number",i=!1);break;case"role":ce(r.role)||(e="role must be a number",i=!1);break;default:e="unknown key:"+t+" "+r[t],i=!1}}return{valid:i,tips:e}}update(r){let i="",s;const n=[];this.friendCustomField.forEach(e=>{n.push(e.key)});for(let e=0,t=r.length;e<t;e++)if(i=r[e].tag,s=r[e].value,-1<i.indexOf("Tag_SNS_Custom"))-1<n.indexOf(i)?this.friendCustomField.forEach(e=>{e.key===i&&(e.value=s)}):this.friendCustomField.push({key:i,value:s});else if(-1<i.indexOf("Tag_Profile_Custom")){let t=!1;this.profile.profileCustomField.forEach(e=>{e.key===i&&(e.value=s,t=!0)}),t||this.profile.profileCustomField.push({key:i,value:s})}else switch(i){case H:this.profile.nick=s;break;case W:this.profile.gender=s;break;case B:this.profile.birthday=s;break;case j:this.profile.location=s;break;case K:this.profile.selfSignature=s;break;case Y:this.profile.allowType=s;break;case J:this.profile.language=s;break;case V:this.profile.avatar=s;break;case z:this.profile.messageSettings=s;break;case Q:this.profile.adminForbidType=s;break;case X:this.profile.level=s;break;case Z:this.profile.role=s;break;case ee.REMARK:this.remark=s;break;case ee.ADDTIME:this.addTime=s;break;case ee.GROUP:this.groupList=JSON.parse(JSON.stringify(s));break;case ee.ADDSOURCE:this.source=s;break;case ee.ADDWORDING:break;default:we.d("snsProfileItem unkown tag->",r[e].tag)}this.timestamp=Date.now(),n.length=0}updateProfile(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}addToGroupList(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}removeFromGroupList(e){e=this.groupList.indexOf(e);-1<e&&(this.groupList.splice(e,1),this.count=this.groupList.length)}}const lt=4,pt=11,ht=12,ft=20,_t=23,mt=27,gt=29;class Mt{constructor(e){this._snsM=e,this._n="FriendHandler",this._friendMap=new Map,this._startIndex=0,this._standardSequence=0,this._customSequence=0,this._expirationTime=18e4}getLocalFriendList(){return[...this._friendMap.values()]}getFriendRemark(e){return this._friendMap.has(e)?this._friendMap.get(e).remark:""}onFriendProfileModified(e){const t=e["dataList"];if(!oe(t)){const i=this._snsM.get(pt);t.forEach(e=>{var{userID:t,profileList:r}=e;if(this.isMyFriend(t)){we.l(this._n+`.onFriendProfileModified. friend account:${t}, profileList:`+JSON.stringify(r));const e=this._friendMap.get(t);e.update(r),i.modifyMessageSentByPeer({conversationID:""+S+t,latestNick:e.profile.nick,latestAvatar:e.profile.avatar})}}),this._onFriendListUpdated()}}onFriendAdded(t){0!==t.length&&(we.l(this._n+".onFriendAdded userIDList:"+t),t.forEach(e=>{this._friendMap.set(e,new ct(e))}),this.getFriendProfile({userIDList:t}).then(e=>{t.forEach(e=>{var t=this._friendMap.get(e);0<t.groupList.length&&this._snsM.updateWhenFriendAdded({nameList:t.groupList,userID:e})}),this._onFriendListUpdated()}))}onFriendDeleted(e){0!==e.length&&(we.l(this._n+".onFriendDeleted userIDList:"+e),e.forEach(e=>{var t=this._friendMap.get(e);0<t.groupList.length&&this._snsM.updateWhenFriendDeleted({nameList:t.groupList,userID:e}),this._friendMap.delete(e)}),this._onFriendListUpdated())}_onFriendListUpdated(){this._snsM.emitOuterEvent(Pe),this._snsM.get(pt).checkAndPatchRemark()}getFriendProfile(e){const r=this._n+".getFriendProfile",t=e["userIDList"],s=[],n=[],i=[];if(t.forEach(e=>{var t;this._friendMap.has(e)?(t=this._friendMap.get(e),Date.now()-t.timestamp<this._expirationTime?n.push(t):i.push(e)):s.push({userID:e,code:Se,message:this._snsM.getErrorMessage(Se)})}),0===i.length)return we.i(r+" newUserIDList is empty"),xe({friendList:n,failureUserIDList:s});const o=new at("getFriendProfile");return o.setMessage("userIDList:"+i),we.i(r+" userIDList:"+i),this._snsM.req({proto:Be,data:{fromAccount:this._snsM.getMyUserID(),userIDList:i}}).then(e=>{o.end(),we.i(r+" ok");const t=e.data["resultList"];return t.forEach(t=>{var{to:t,resultCode:e,resultInfo:r,tagValueList:i}=t;if(fe(e)||0===e){let e;this._friendMap.has(t)?(e=this._friendMap.get(t)).update(i):(e=new ct(t,i),this._friendMap.set(t,e)),n.push(e)}else s.push({userID:t,code:e,message:r})}),Te({friendList:n,failureUserIDList:s})}).catch(e=>(o.setError(e).end(),we.w(r+" failed. error:",e),He(e)))}isMyFriend(e){return this._friendMap.has(e)}pagingGetFriendList(){const a=this._n+".getFriendList",d=new at("getFriendList"),u=Date.now();this._snsM.req({proto:We,data:{fromAccount:this._snsM.getMyUserID(),startIndex:this._startIndex,standardSequence:this._standardSequence,customSequence:this._customSequence}}).then(e=>{const{friendCount:t,resultList:r,nextStartIndex:i,standardSequence:s,customSequence:n,completeFlag:o}=e.data;e=`friendCount:${t} nextStartIndex:${this._startIndex=i} standardSequence:${this._standardSequence=s} customSequence:${this._customSequence=n} completeFlag:${o} cost:`+(e=u,Date.now()-e+" ms");d.setMessage(e).end(),we.i(a+" ok.",e),oe(r)||r.forEach(e=>{var{to:e,tagValueList:t}=e;this._friendMap.set(e,new ct(e,t))}),0===o?this.pagingGetFriendList():(this._snsM.emitOuterEvent(Pe),this._pagingGetFriendProfile())}).catch(e=>(d.setError(e).end(),we.w(a+" failed. error:",e),He(e)))}_pagingGetFriendProfile(){const t=[...this._friendMap.keys()],r=this._snsM.get(lt),e=t.length,i=e<=100?1:Math.ceil(e/100);we.l(this._n+`._pagingGetFriendProfile friendCount:${e} pageCount:`+i);for(let e=0;e<i;e++)r.getUserProfile({userIDList:t.slice(100*e,100*(e+1))}).then(e=>{e.data.forEach(e=>{const t=this._friendMap.get(e.userID);t&&t.updateProfile(e)}),this._onFriendListUpdated()})}addFriend(e){const i=this._n+".addFriend";if(this._friendMap.has(e.to))return He({code:Ee});if(e.wording&&!1===this._snsM.filterProfanity("wording",e))return He({code:Ne});var{to:e,source:t,type:r,wording:s,remark:n,groupName:o}=e;let a=r;a&&(a===v||a===b)||(a=b);const d=new at("addFriend");return d.setMessage(`to:${e} source:${t} type:`+a),this._snsM.req({proto:Ye,data:{fromAccount:this._snsM.getMyUserID(),addFriendItem:[{to:e,source:t,wording:s,remark:n,groupName:o}],type:a}}).then(e=>{var e=e.data["resultList"],{to:e,resultCode:t,resultInfo:r}=(d.setMoreMessage("resultList:"+JSON.stringify(e)).end(),e[0]);return we.i(i+` ok. to:${e} type:${a} code:`+t),fe(t)||0===t?Te({userID:e,code:0}):30539===t?Te({userID:e,code:t,message:this._snsM.getErrorMessage(t)}):He({userID:e,code:t,message:this._snsM.getErrorMessage(t)||r})}).catch(e=>(d.setError(e).end(),we.w(i+" failed. error:",e),He(e)))}deleteFriend(e){const r=this._n+".deleteFriend",{userIDList:t,type:i}=e;1e3<t.length&&(we.w(r+" "+"the length of userIDList cannot exceed 1000"),t.length=1e3);const s=[],n=[],o=[];if(t.forEach(e=>{this._friendMap.has(e)?o.push(e):s.push({userID:e,code:Se,message:this._snsM.getErrorMessage(Se)})}),0===o.length)return xe({successUserIDList:n,failureUserIDList:s});let a=i;a&&(a===G||a===C)||(a=C);const d=new at("deleteFriend");return d.setMessage(`userIDList:${o} type:`+a),this._snsM.req({proto:Ke,data:{fromAccount:this._snsM.getMyUserID(),userIDList:o,type:a}}).then(e=>{d.end(),we.i(r+" ok");const t=e.data["resultList"];return oe(t)||t.forEach(e=>{var{to:e,resultCode:t,resultInfo:r}=e;fe(t)||0===t?n.push({userID:e}):s.push({userID:e,code:t,message:r})}),Te({successUserIDList:n,failureUserIDList:s})}).catch(e=>(d.setError(e).end(),we.w(r+" error:",e),He(e)))}updateFriend(e){const{userID:t,remark:i,friendCustomField:n}=e;if(!this._friendMap.has(t))return He({code:Se});const o=this._n+".updateFriend",a=new at("updateFriend"),r=(a.setMessage(`userID:${t} remark:${i} friendCustomField:`+n),[]);return fe(i)||r.push({tag:ee.REMARK,value:i}),he(n)&&0<n.length&&n.forEach(e=>{r.push({tag:e.key,value:e.value})}),this._snsM.req({proto:Je,data:{fromAccount:this._snsM.getMyUserID(),updateItem:[{to:t,snsItem:r}]}}).then(e=>{a.end(),we.i(o+" ok");var e=e.data["resultList"],{to:t,resultCode:e,resultInfo:r}=e[0];if(fe(e)||0===e){const e=this._friendMap.get(t);if(e){fe(i)||(e.remark=i);if(he(n)&&0<n.length){var s=e.friendCustomField;t=n;if(he(s)&&he(t)){let i=!1;t.forEach(({key:t,value:e})=>{const r=s.find(e=>e.key===t);r?r.value!==e&&(r.value=e,i=!0):(s.push({key:t,value:e}),i=!0)})}}this._onFriendListUpdated()}return Te(e)}return He({code:e,message:r})}).catch(e=>(a.setError(e).end(),we.w(o+" failed. error:",e),He(e)))}checkFriend(e){const r=this._n+".checkFriend",{userIDList:i,type:t}=e;let o=t;o&&(o===q||o===R)||(o=R);const a=new at("checkFriend");return a.setMessage(`userIDList:${i} type:`+o),this._snsM.req({proto:je,data:{fromAccount:this._snsM.getMyUserID(),userIDList:i,type:o}}).then(e=>{a.end(),we.i(r+` ok. userIDList:${i} type:`+o);const s=[],n=[],t=e.data["resultList"];return he(t)&&t.forEach(e=>{var{to:e,relation:t,resultCode:r,resultInfo:i}=e;fe(r)||0===r?s.push({userID:e,code:0,relation:t}):n.push({userID:e,code:r,message:i})}),Te({successUserIDList:s,failureUserIDList:n})}).catch(e=>(a.setError(e).end(),we.w(r+" failed. error:",e),He(e)))}updateWhenAddedToFriendGroup(e){const{name:t,userIDList:r}=e;we.l(`${this._n}.updateWhenAddedToFriendGroup groupName:${t} userIDList:`+r),t&&!oe(r)&&r.forEach(e=>{this._friendMap.has(e)&&this._friendMap.get(e).addToGroupList(t)})}updateWhenRemovedFromFriendGroup(e){const{name:t,userIDList:r}=e;we.l(`${this._n}.updateWhenRemovedFromFriendGroup groupName:${t} userIDList:`+r),t&&!oe(r)&&r.forEach(e=>{this._friendMap.has(e)&&this._friendMap.get(e).removeFromGroupList(t)})}reset(){this._friendMap.clear(),this._startIndex=0,this._standardSequence=0,this._customSequence=0}}class yt{constructor(e){oe(e)||(this.name=e.name||"",this.userIDList=e.userIDList||[],this.count=this.userIDList.length||0)}addToUserIDList(e){-1===this.userIDList.indexOf(e)&&(this.userIDList.push(e),this.count=this.userIDList.length)}removeFromUserIDList(e){e=this.userIDList.indexOf(e);-1<e&&(this.userIDList.splice(e,1),this.count=this.userIDList.length)}}class Ft{constructor(e){this._snsM=e,this._n="FriendGroupHandler",this._friendGroupMap=new Map}getLocalFriendGroupList(){return[...this._friendGroupMap.values()]}_emitFriendGroupListUpdated(){var e=[...this._friendGroupMap.values()];this._snsM.emitOuterEvent(Oe,e)}getFriendGroupList(){const r=this._n+".getFriendGroupList",i=new at("getFriendGroupList");return this._snsM.req({proto:Ze,data:{fromAccount:this._snsM.getMyUserID()}}).then(e=>{i.end();const t=e.data["resultList"];oe(t)?we.i(r+" ok. friend group count:0"):(we.i(r+" ok. friend group count:"+t.length),this._friendGroupMap.clear(),t.forEach(e=>{var t=new yt(e);this._friendGroupMap.set(e.name,t)}),this._emitFriendGroupListUpdated())}).catch(e=>(i.setError(e).end(),we.w(r+" error:",e),He(e)))}createFriendGroup(e){const r=this._n+".createFriendGroup",{name:i,userIDList:o}=e;if(this._friendGroupMap.has(i))return He({code:ke});const a=new at("createFriendGroup");return a.setMessage(`name:${i} userIDList:`+o),this._snsM.req({proto:et,data:{fromAccount:this._snsM.getMyUserID(),groupName:[i],userIDList:he(o)?o:void 0}}).then(e=>{a.end(),we.l(r+` ok. name:${i} userIDList:`+o);const t=e.data["resultList"],s=[],n=[];t&&t.forEach(e=>{const{to:t,resultCode:r,resultInfo:i}=e;if(fe(r)||0===r)s.push(t);else{const t={userID:e.to,code:r,message:i};n.push(t)}});e=new yt({name:i,userIDList:s});return this._friendGroupMap.set(i,e),this._snsM.updateWhenAddedToFriendGroup({name:i,userIDList:s}),this._emitFriendGroupListUpdated(),Te({friendGroup:e,failureUserIDList:n})}).catch(e=>(a.setError(e).end(),we.w(r+" failed. error:",e),He(e)))}deleteFriendGroup(e){const r=this._n+".deleteFriendGroup",i=e["name"];if(!this._friendGroupMap.has(i))return He({code:ve});const s=new at("deleteFriendGroup");return s.setMessage("name:"+i),this._snsM.req({proto:st,data:{fromAccount:this._snsM.getMyUserID(),nameList:[i]}}).then(e=>{s.end(),we.l(r+" ok. name:"+i);const t=this._friendGroupMap.get(i);return t&&(this._snsM.updateWhenRemovedFromFriendGroup({name:i,userIDList:t.userIDList}),this._friendGroupMap.delete(i),t.userIDList.length=0),this._emitFriendGroupListUpdated(),Te(t)}).catch(e=>(s.setError(e).end(),we.w(r+" failed. error:",e),He(e)))}renameFriendGroup(e){const t=this._n+".renameFriendGroup",{oldName:r,newName:i}=e;if(!this._friendGroupMap.has(r))return He({code:ve});const s=new at("renameFriendGroup");return s.setMessage(`oldName:${r} newName:`+i),this._snsM.req({proto:it,data:{fromAccount:this._snsM.getMyUserID(),oldName:r,newName:i}}).then(()=>{if(s.end(),we.l(t+` ok. oldName:${r} newName:`+i),this._friendGroupMap.has(r)){const e=this._friendGroupMap.get(r);return e.name=i,this._friendGroupMap.delete(r),this._friendGroupMap.set(i,e),this._snsM.updateWhenRemovedFromFriendGroup({name:r,userIDList:e.userIDList}),this._snsM.updateWhenAddedToFriendGroup({name:i,userIDList:e.userIDList}),this._emitFriendGroupListUpdated(),Te(e)}return Te()}).catch(e=>(s.setError(e).end(),we.w(t+" failed. error:",e),He(e)))}addToFriendGroup(e){const t=this._n+".addToFriendGroup",{name:r,userIDList:i}=e;if(!this._friendGroupMap.has(r))return this._onFriendGroupNotExist(r);const s=new at("addToFriendGroup");return s.setMessage(`name:${r} userIDList:`+i),we.l(t+` name:${r} userIDList:`+i),this._snsM.req({proto:it,data:{fromAccount:this._snsM.getMyUserID(),oldName:r,updateGroupItem:i.filter(e=>this._snsM.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Add"}))}}).then(e=>(s.end(),this._onFriendGroupUpdated(r,e))).catch(e=>(s.setError(e).end(),we.w(t+" failed. error:",e),He(e)))}removeFromFriendGroup(e){const t=this._n+".removeFromFriendGroup",{name:r,userIDList:i}=e;if(!this._friendGroupMap.has(r))return this._onFriendGroupNotExist(r);const s=new at("removeFromFriendGroup");return s.setMessage(`name:${r} userIDList:`+i),we.l(t+` name:${r} userIDList:`+i),this._snsM.req({proto:it,data:{fromAccount:this._snsM.getMyUserID(),oldName:r,updateGroupItem:i.filter(e=>this._snsM.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Delete"}))}}).then(e=>(s.end(),this._onFriendGroupUpdated(r,e))).catch(e=>(s.setError(e).end(),we.w(t+" failed. error:",e),He(e)))}_onFriendGroupUpdated(e,t){const r=t.data["resultList"],n=this._friendGroupMap.get(e),o=[],a=[],d=[];return he(r)&&r.forEach(e=>{var{to:t,resultCode:r,resultInfo:i,type:s}=e;0===r?"Update_Type_Add"===s?n&&(n.addToUserIDList(t),a.push(t)):"Update_Type_Delete"===s&&n&&(n.removeFromUserIDList(t),d.push(t)):o.push({to:e.to,code:r,message:i})}),we.l(this._n+`._onFriendGroupUpdated name:${e} userIDList:`+n.userIDList),0<a.length&&this._snsM.updateWhenAddedToFriendGroup({name:e,userIDList:a}),0<d.length&&this._snsM.updateWhenRemovedFromFriendGroup({name:e,userIDList:d}),Te({friendGroup:n,failureUserIDList:o})}updateWhenFriendAdded(e){const{nameList:t,userID:r}=e;we.l(`${this._n}.updateWhenFriendAdded userID:${r} nameList:`+t),oe(t)||t.forEach(e=>{this._friendGroupMap.has(e)&&this._friendGroupMap.get(e).addToUserIDList(r)})}updateWhenFriendDeleted(e){const{nameList:t,userID:r}=e;we.l(`${this._n}.updateWhenFriendDeleted userID:${r} nameList:`+t),oe(t)||t.forEach(e=>{this._friendGroupMap.has(e)&&this._friendGroupMap.get(e).removeFromUserIDList(r)})}reset(){this._friendGroupMap.clear()}}class At extends class{constructor(e){this._m=e,this._n=""}isLoggedIn(){return this._m.get(ht).isLoggedIn()}isOversea(){return this._m.get(ht).isOversea()}isPrivateNetWork(){return this._m.get(ht).isPrivateNetWork()}getFileDownloadProxy(){return this._m.get(ht).getFileDownloadProxy()}getMyUserID(){return this._m.get(ht).getUserID()}getMyTinyID(){return this._m.get(ht).getTinyID()}getSDKAppID(){return this._m.get(ht).getSDKAppID()}isIntl(){return this._m.get(ht).isIntl()}isUsingChatCore(){return this._m.get(ht).isUsingChatCore()}isDevMode(){return this._m.get(ht).isDevMode()}get(e){return this._m.get(e)}getPlatform(){return T}getCloudConfig(e){return this._m.get(_t).getCloudConfig(e)}emitOuterEvent(e,t){this._m.getOuterEmitterInstance().emit(e,t)}emitInnerEvent(e,t){this._m.getInnerEmitterInstance().emit(e,t)}getInnerEmitterInstance(){return this._m.getInnerEmitterInstance()}generateTjgID(e){return this._m.get(ht).getTinyID()+"-"+e.random}req(e){return this._m.get(ft).req(e)}canIUse(e){return this._m.get(mt).canIUse(e)}getErrorMessage(e,t,r){return this._m.getErrorMessage(e,t,r)}outputWarning(e,t,r){e=this.getErrorMessage(e,t,r);e&&we.w(e)}cannotUseCommercialAbility(e){var t=Ue;return He({code:t,message:this.getErrorMessage(t,e)})}}{constructor(t){super(t),this._n="SnsModule",this._friendHandler=new Mt(this),this._friendApplicationHandler=new dt(this),this._friendGroupHandler=new Ft(this),this.getInnerEmitterInstance().on(e.A2KEY_AND_TINYID_UPDATED,this.onContextUpdated,this)}onContextUpdated(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getFriendGroupList(),this._friendApplicationHandler.getFriendApplicationList()}onRelationChainModified(e){const t=e["dataList"];if(!oe(t)){const s=[],n=[],o=[],a=[];let r=!1,i="";t.forEach(e=>{if(3!==e.pushType&&4!==e.pushType||!e.from||(i=e.from),e.friendAddAccount&&(s.push(...e.friendAddAccount),a.push(...e.friendAddAccount)),e.friendDelAccount&&n.push(...e.friendDelAccount),e.friendApplicationAdded&&o.push(...e.friendApplicationAdded),e.friendApplicationDeletedUserIDList&&a.push(...e.friendApplicationDeletedUserIDList),e.reportTime&&7===e.pushType&&(r=!0),e.friendUpInfo){const t={dataList:[]};e.friendUpInfo.forEach(e=>{t.dataList.push({userID:e.friendAccount,profileList:[...e.sns]})}),this.onFriendProfileModified(t)}}),r&&this._friendApplicationHandler.onFriendApplicationRead(),this._friendApplicationHandler.onFriendApplicationAdded(o,i),this._friendApplicationHandler.onFriendApplicationDeleted(a),this._friendHandler.onFriendAdded(s),this._friendHandler.onFriendDeleted(n)}}isMyFriend(e){return this._friendHandler.isMyFriend(e)}filterProfanity(e,t){const r=this.get(gt);if(!r)return!0;var{isAllowedToSend:i,modifiedText:s}=r.filterText(t[e],p);return!0===i&&(t[e]=s,!0)}onFriendProfileModified(e){this._friendHandler.onFriendProfileModified(e)}getLocalFriendList(e=!0){var t=this._friendHandler.getLocalFriendList();return e?xe(t):t}getFriendRemark(e){return this._friendHandler.getFriendRemark(e)}getFriendList(){return this._friendHandler.pagingGetFriendList()}addFriend(e){return this._friendHandler.addFriend(e)}deleteFriend(e){return this._friendHandler.deleteFriend(e)}checkFriend(e){return this._friendHandler.checkFriend(e)}getFriendProfile(e){return this._friendHandler.getFriendProfile(e)}updateFriend(e){return this._friendHandler.updateFriend(e)}updateWhenAddedToFriendGroup(e){this._friendHandler.updateWhenAddedToFriendGroup(e)}updateWhenRemovedFromFriendGroup(e){this._friendHandler.updateWhenRemovedFromFriendGroup(e)}getLocalFriendApplicationList(){var e=this._friendApplicationHandler.getLocalFriendApplicationList();return xe(e)}deleteFriendApplication(e){return this._friendApplicationHandler.deleteFriendApplication(e)}refuseFriendApplication(e){return this._friendApplicationHandler.refuseFriendApplication(e)}acceptFriendApplication(e){return this._friendApplicationHandler.acceptFriendApplication(e)}setFriendApplicationRead(e){return this._friendApplicationHandler.setFriendApplicationRead(e)}getLocalFriendGroupList(){var e=this._friendGroupHandler.getLocalFriendGroupList();return xe(e)}createFriendGroup(e){return this._friendGroupHandler.createFriendGroup(e)}deleteFriendGroup(e){return this._friendGroupHandler.deleteFriendGroup(e)}addToFriendGroup(e){return this._friendGroupHandler.addToFriendGroup(e)}removeFromFriendGroup(e){return this._friendGroupHandler.removeFromFriendGroup(e)}renameFriendGroup(e){return this._friendGroupHandler.renameFriendGroup(e)}onAddToFriendGroup(e){return this._friendGroupHandler.onAddToFriendGroup(e)}updateWhenFriendAdded(e){this._friendGroupHandler.updateWhenFriendAdded(e)}updateWhenFriendDeleted(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}reset(){we.l(this._n+".reset"),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}export{At as default};

@@ -1,1 +0,1 @@

'use strict';var t=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}function s(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,i,o,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var r=new s(i,o||t,a),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],r]:t._events[l].push(r):(t._events[l]=r,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function r(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),r.prototype.eventNames=function(){var t,i,s=[];if(0===this._eventsCount)return s;for(i in t=this._events)e.call(t,i)&&s.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},r.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,a=new Array(o);s<o;s++)a[s]=i[s].fn;return a},r.prototype.listenerCount=function(t){var e=n?n+t:t,i=this._events[e];return i?i.fn?1:i.length:0},r.prototype.emit=function(t,e,i,s,o,a){var r=n?n+t:t;if(!this._events[r])return!1;var l,g,c=this._events[r],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,i),!0;case 4:return c.fn.call(c.context,e,i,s),!0;case 5:return c.fn.call(c.context,e,i,s,o),!0;case 6:return c.fn.call(c.context,e,i,s,o,a),!0}for(g=1,l=new Array(u-1);g<u;g++)l[g-1]=arguments[g];c.fn.apply(c.context,l)}else{var h,d=c.length;for(g=0;g<d;g++)switch(c[g].once&&this.removeListener(t,c[g].fn,void 0,!0),u){case 1:c[g].fn.call(c[g].context);break;case 2:c[g].fn.call(c[g].context,e);break;case 3:c[g].fn.call(c[g].context,e,i);break;case 4:c[g].fn.call(c[g].context,e,i,s);break;default:if(!l)for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c[g].fn.apply(c[g].context,l)}}return!0},r.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},r.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},r.prototype.removeListener=function(t,e,i,s){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var r=this._events[o];if(r.fn)r.fn!==e||s&&!r.once||i&&r.context!==i||a(this,o);else{for(var l=0,g=[],c=r.length;l<c;l++)(r[l].fn!==e||s&&!r[l].once||i&&r[l].context!==i)&&g.push(r[l]);g.length?this._events[o]=1===g.length?g[0]:g:a(this,o)}return this},r.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prefixed=n,r.EventEmitter=r,t.exports=r}));const e=2,n=11,i=12,s=15,o=20,a=23,r=27,l="onMessageModified",g="error";class c{constructor(t=0,e=0){this.high=t,this.low=e}equal(t){return null!==t&&(this.low===t.low&&this.high===t.high)}toString(){const t=Number(this.high).toString(16);let e=Number(this.low).toString(16);if(e.length<8){let t=8-e.length;for(;t;)e="0"+e,t--}return t+e}}const u={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:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.18.188"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT:"wss://wssidn.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},h={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},d="CHINA",_={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(t=d){this.CURRENT=u.PRODUCTION[t]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GROUP:"group_open_http_svc",GROUP_AVCHATROOM:"group_open_avchatroom_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_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_MESSAGE:"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",MESSAGE_SEARCH:"message_search"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v4",group_open_long_polling_http_svc:"v4",group_open_long_polling_http_noauth_svc:"v4",imopenstat:"v4",im_cos_sign_svr:"v4",im_cos_msg:"v4",webim:"v4",im_open_push:"v4",im_open_status:"v4"}};new c(0,Math.pow(2,0)).toString(),new c(0,Math.pow(2,1)).toString(),new c(0,Math.pow(2,2)).toString(),new c(0,Math.pow(2,3)).toString(),new c(0,Math.pow(2,4)).toString(),new c(0,Math.pow(2,6)).toString(),new c(0,Math.pow(2,7)).toString(),new c(0,Math.pow(2,9)).toString(),new c(0,Math.pow(2,10)).toString(),new c(0,Math.pow(2,11)).toString(),new c(0,Math.pow(2,13)).toString(),new c(0,Math.pow(2,15)).toString(),new c(Math.pow(2,16)).toString(),_.HOST.setCurrent(d);const m="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting);m&&wx.createGamePortal;const I="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),v="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),p="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),D="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,M="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,S=m||I||f||v||p||M||D,y=("undefined"!=typeof uni||"undefined"!=typeof window)&&!S;I?qq:f?tt:v?swan:p?my:m?wx:M?uni:!D||jd;const w=y&&window&&window.navigator&&window.navigator.userAgent||"",C=/(micromessenger|webbrowser)/i.test(w),T=/AppleWebKit\/([\d.]+)/i.exec(w);T&&parseFloat(T.pop());const E=function(){let t="WEB";return C?t="WEB":I?t="QQ_MP":f?t="TT_MP":v?t="BAIDU_MP":p?t="ALI_MP":m?t="WX_MP":M&&(t="UNI_NATIVE_APP"),h[t]}();!function(){const t=w.match(/OS (\d+)_/i);t&&t[1]&&t[1]}(),function(){const t=w.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;const e=t[1]&&parseFloat(t[1]),n=t[2]&&parseFloat(t[2]);e&&n&&parseFloat(t[1]+"."+t[2])}(),function(){const t=w.match(/Chrome\/(\d+)/);t&&t[1]&&parseFloat(t[1])}();const A=/MSIE/.test(w)||w.indexOf("Trident")>-1&&w.indexOf("rv:11.0")>-1;!function(){const t=/MSIE\s(\d+)\.\d/.exec(w);let e=t&&parseFloat(t[1]);!e&&/Trident\/7.0/i.test(w)&&/rv:11.0/.test(w)&&(e=11)}(),function(){const t=w.match(/TBS\/(\d+)/i);if(t&&t[1])t[1]}();const L="TIMCustomElem",O="High",N="C2C",$="GROUP",U="@TIM#SYSTEM";let P,R;P="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const H=function(){},x=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let b=x.length;for(;b--;)R=x[b],console[R]||(P[R]=H);var F=P;const q=function(){const t=new Date;return t.setTime((new Date).getTime()+0),t};let j=0;function G(){return z()?"%c Chat %c":"Chat"}function k(){const t=q();return t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(t){let e;switch(t.toString().length){case 1:e="00"+t;break;case 2:e="0"+t;break;default:e=t}return e}(t.getMilliseconds())}const B={arguments2String(t){let e="";if(1===t.length)e=t[0];else for(let n=0,i=t.length;n<i;n++)K(t[n])?Y(t[n])?e+=W(t[n]):e+=JSON.stringify(t[n]):e+=t[n],e+=" ";return e},_exec(t,e){z()?F[t](G(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",k(),e):F[t](`${G()} ${k()} ${e}`)},d:function(){if(j<=-1){const t=this.arguments2String(arguments);this._exec("debug",t)}},l:function(){if(j<=0){const t=this.arguments2String(arguments);this._exec("log",t)}},log:function(){if(j<=0){const t=this.arguments2String(arguments);this._exec("log",t)}},i:function(){if(j<=1){const t=this.arguments2String(arguments);this._exec("info",t)}},w:function(){if(j<=2){const t=this.arguments2String(arguments);this._exec("warn",t)}},e:function(){if(j<=3){const t=this.arguments2String(arguments);this._exec("error",t)}},setLevel:function(t){t<4&&this._exec("log","set level from "+j+" to "+t),j=t},getLevel:function(){return j}},J=function(t){return void 0===t},K=function(t){return function(t){return"function"==typeof Array.isArray?Array.isArray(t):"array"===V(t)}(t)||function(t){return null!==t&&"object"==typeof t}(t)},Y=function(t){return t instanceof Error},V=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()};Date.now||(Date.now=function(){return(new Date).getTime()});const W=function(t){return JSON.stringify(t,["message","code"])};function z(){return!A&&!S}const X=Object.prototype.hasOwnProperty;function Q(t){if(null==t)return!0;if("boolean"==typeof t)return!1;if("number"==typeof t)return 0===t;if("string"==typeof t)return 0===t.length;if("function"==typeof t)return 0===t.length;if(Array.isArray(t))return 0===t.length;if(t instanceof Error)return""===t.message;if(function(t){if("object"!=typeof t||null===t)return!1;const e=Object.getPrototypeOf(t);if(null===e)return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n}(t)){for(const e in t)if(X.call(t,e))return!1;return!0}return!("map"!==V(t)&&!function(t){return"set"===V(t)}(t)&&!function(t){return"file"===V(t)}(t))&&0===t.size}class Z extends Error{constructor(t){super();const{code:e,message:n,data:i}=t;this.code=e,this.message=n||this._getErrorMessage(this.code),this.data=i||{}}}const et=2903,nt=3122,it=8010,st=8011,ot=8020;let at=null;const rt=function(t,e=!1){if(t instanceof Z)return e&&null!==at&&at.emit(g,t),Promise.reject(t);if(t instanceof Error){const t=new Z({code:et});return e&&null!==at&&at.emit(g,t),Promise.reject(t)}if(J(t)||J(t.code))return Promise.reject(new Z({code:et}));const n=new Z(t);return e&&null!==at&&at.emit(g,n),Promise.reject(n)};const lt="newInvitationReceived",gt="ts_invitee_accepted",ct="ts_invitee_rejected",ut="ts_invitation_cancelled",ht="ts_invitation_timeout",dt="ts_invitation_modified",_t=1,mt=2,It=3,ft=4,vt=5;class pt{constructor(t){this._n="RemoteSignalingHandler",this._signalingModule=t}onNewMessageList(t){const e=this._signalingModule.filterMessageList(t);e.length>0&&e.forEach(t=>{const e=this.getPayloadData(t);e&&this._handleActionType(e,t)})}onMessageModified(t){const e=this._signalingModule.filterMessageList(t);e.length>0&&e.forEach(t=>{const e=this.getPayloadData(t);e&&this._onInvitationModified(e,t)})}getPayloadData(t){const e=this._n+".getPayloadData",{data:n}=t.payload;try{return JSON.parse(n)}catch(i){return B.e(`${e} JSON parse error. signalingData:${n}`),null}}_handleActionType(t,e){const{actionType:n}=t;switch(n){case _t:this._onNewInvitationReceived(t,e);break;case ft:this._onInviteeRejected(t);break;case It:this._onInviteeAccepted(t);break;case mt:this._onInvitationCancelled(t);break;case vt:this._onInvitationTimeout(t)}}_createDefaultEmitData(t){const{inviteID:e,inviter:n,groupID:i,data:s}=t;return{inviteID:e,inviter:n,groupID:i,data:s||""}}_onNewInvitationReceived(t,e){const n=this._n+"._onNewInvitationReceived",{inviteID:i,inviteeList:s,groupID:o,inviter:a}=t,r=this._signalingModule.getMyUserID(),l=s.includes(r),g=Math.round(t.timeout-((new Date).getTime()-1e3*e.time)/1e3);if(B.l(`${n} myselfIncluded:${l} groupID:${o} timeout:${g}s signalObj:${JSON.stringify(t)}`),o&&l||!o){const n=this._signalingModule.getInviteInfo(i);if(n&&n===t)return;n||this._signalingModule.setInviteInfo(i,{...t,message:e}),this._signalingModule.emitEvent(lt,{...this._createDefaultEmitData(t),inviteeList:s}),a!==r&&this._signalingModule.startTimer({...t,timeout:g})}}_onInviteeRejected(t){const e=this._n+"._onInviteeRejected",{inviteID:n,inviter:i,groupID:s}=t,o=this._signalingModule.hasInviteInfo(n);B.l(`${e} inviteID:${n} hasInviteID:${o} inviter:${i} groupID:${s}`),(s&&o||!s)&&(this._signalingModule.updateInviteInfo(t),this._signalingModule.emitEvent(ct,{...this._createDefaultEmitData(t),invitee:t.inviteeList[0]}))}_onInviteeAccepted(t){const e=this._n+"._onInviteeAccepted",{inviteID:n,inviter:i,groupID:s}=t,o=this._signalingModule.hasInviteInfo(n);B.l(`${e} inviteID:${n} hasInviteID:${o} inviter:${i} groupID:${s}`),(s&&o||!s)&&(this._signalingModule.updateInviteInfo(t),this._signalingModule.emitEvent(gt,{...this._createDefaultEmitData(t),invitee:t.inviteeList[0]}))}_onInvitationCancelled(t){const e=this._n+"._onInvitationCancelled",{inviteID:n,inviter:i,groupID:s}=t,o=this._signalingModule.hasInviteInfo(n);B.l(`${e} inviteID:${n} hasInviteID:${o} inviter:${i} groupID:${s}`),(s&&o||!s)&&(this._signalingModule.deleteInviteInfo(n),this._signalingModule.emitEvent(ut,this._createDefaultEmitData(t)))}_onInvitationTimeout(t){const e=this._n+"._onInvitationTimeout",{inviteID:n,inviter:i,groupID:s,inviteeList:o}=t,a=this._signalingModule.hasInviteInfo(n);B.l(`${e} inviteID:${n} hasInviteID:${a} inviter:${i} groupID:${s} data:${t.data}`),(s&&a||!s)&&(this._signalingModule.updateInviteInfo(t),this._signalingModule.emitEvent(ht,{...this._createDefaultEmitData(t),inviteeList:o,isSelfTimeout:!1}))}_onInvitationModified(t,e){const n=this._n+"._onInvitationModified",{inviteID:i,data:s}=t;B.l(`${n} inviteID:${i} data:${s}`),this._signalingModule.setInviteInfo(i,{...t,message:e}),this._signalingModule.emitEvent(dt,{inviteID:i,data:s})}}const Dt=function(t){if(t<0||t>53)return NaN;const e=0|1073741824*Math.random();return t>30?e+1073741824*(0|Math.random()*(1<<t-30)):e>>>30-t},Mt=function(t,e){let n=t.toString(16),i=e-n.length,s="0";for(;i>0;i>>>=1,s+=s)1&i&&(n=s+n);return n};class St{constructor(t){this._n="LocalSignalingHandler",this._signalingModule=t}generateInviteID(){const t=function(){const t=Dt,e=Mt;return e(t(32),8)+"-"+e(t(16),4)+"-"+e(16384|t(12),4)+"-"+e(32768|t(14),4)+"-"+e(t(48),12)}();return B.l(`${this._n}.generateInviteID inviteID:${t}`),t}createInviteInfo(t){const e=this.generateInviteID(),n=this.createInviteCustomData({...t,inviteID:e}),{groupID:i,inviteeList:s}=n,o=i||s[0];return{customData:n,message:this.createSignalingMessage(n,o),inviteID:e}}_createDefaultCustomData(t){const{data:e="",inviteID:n="",groupID:i=""}=t;return{businessID:1,timeout:0,data:e,inviteID:n,groupID:i}}createInviteCustomData(t){const{userID:e,timeout:n=0,groupID:i=""}=t,s=this._signalingModule.getMyUserID(),o={...this._createDefaultCustomData(t),actionType:_t,inviter:s,inviteeList:i?t.inviteeList:[e],timeout:n};return B.l(`${this._n}.createInviteCustomData customData:${JSON.stringify(o)}`),o}createCancelCustomData(t){const e=this._n+".createCancelCustomData",{inviteID:n}=t;let i;const s=this._signalingModule.getMyUserID(),{inviteeList:o,groupID:a,inviter:r}=this._signalingModule.getInviteInfo(n);return r===s?i={...this._createDefaultCustomData(t),actionType:mt,groupID:a,inviter:s,inviteeList:o}:B.e(`${e} unmatched inviter:${r} and my userID:${s}`),B.l(`${e} customData:${JSON.stringify(i)}`),i}createAcceptCustomData(t){const e=this._n+".createAcceptCustomData",{inviteID:n}=t;let i;const s=this._signalingModule.getMyUserID(),{inviter:o,groupID:a,inviteeList:r}=this._signalingModule.getInviteInfo(n);return r.includes(s)?i={...this._createDefaultCustomData(t),actionType:It,groupID:a,inviter:o,inviteeList:[s]}:B.e(`${e} userID:${s} not in inviteeList. inviteID:${n} groupID:${a}`),B.l(`${e} customData:${JSON.stringify(i)}`),i}createRejectCustomData(t){const e=this._n+".createRejectCustomData",{inviteID:n}=t;let i;const s=this._signalingModule.getMyUserID(),{inviter:o,groupID:a,inviteeList:r}=this._signalingModule.getInviteInfo(n);return r.includes(s)?i={...this._createDefaultCustomData(t),actionType:ft,groupID:a,inviter:o,inviteeList:[s]}:B.e(`${e} userID:${s} not in inviteeList. inviteID:${n} groupID:${a}`),B.l(`${e} customData:${JSON.stringify(i)}`),i}createTimeoutCustomData(t){const e=this._n+".createTimeoutCustomData",{inviteeList:n,inviter:i,isInviter:s=!1}=t,o=this._signalingModule.getMyUserID(),a={...this._createDefaultCustomData(t),actionType:vt,inviter:i,inviteeList:s?n:[o]};return B.l(`${e} customData:${JSON.stringify(a)}`),a}createSignalingMessage(t,n){const{groupID:i,inviter:s}=t,o=this._signalingModule.getModule(e),a={to:n||i||s,conversationType:i?$:N,priority:O,payload:{data:JSON.stringify(t)}},r=o.createCustomMessage(a);return B.d(`${this._n}.createSignalingMessage. message:${JSON.stringify(r)}`),r}}class yt{constructor(t){this._n="HistorySignalingHandler",this._signalingModule=t,this.EXPIRED_TIME=3e4,this.COUNT=20,this._signalingMap=new Map,this._signalingRelatedToMeMap=new Map}getHistorySignaling(){const t=this._signalingModule.getModule(n).getLocalConversationList();Q(t)||this._getSignalingList(t).then(t=>{this._handleSignalingList(t)})}_getSignalingList(t){const e=this._getValidConversationList(t),n=this._createPromiseList(e);return Q(n)?Promise.resolve([]):this._concurrentGetMessageList(n).then(t=>{let e=new Map;return t.forEach(t=>{const{signalingList:n}=t,i=this._getSignalingRelatedToMeMap(n);e=new Map([...e,...i])}),this._sortSignaling(e)})}_handleSignalingList(t){Q(t)||(B.d(`${this._n}._handleSignalingList signalingList:${JSON.stringify(t)}`),this._signalingModule.onNewMessageList(t))}_isSignalingNotExpired(t,e){return t[e]&&1e3*t[e]>(new Date).getTime()-this.EXPIRED_TIME}_getValidConversationList(t){const e=[];for(let n=0;n<t.length;n++){const{type:i,unreadCount:s,lastMessage:o}=t[n],a=this._isSignalingNotExpired(o,"lastTime");i!==U&&s>0&&a&&e.push(t[n])}return e}_createPromiseList(t){const e=[];for(let i=0;i<t.length;i++){const s=t[i],{conversationID:o,unreadCount:a,type:r}=s,l=r===N?a:this.COUNT;this._signalingMap.set(o,{needMessageCount:l,signalingList:[]});const g=this._signalingModule.getModule(n).getMessageList({conversationID:o});e.push(g)}return e}_concurrentGetMessageList(t){const e=[];return Promise.all(t).then(t=>{for(let n=0;n<t.length;n++){const{code:i,data:s}=t[n];if(0!==i||0===s.messageList.length)continue;this._handleMessageList(s.messageList);const o=this._relayGetMessageList(s);o&&e.push(o)}return e.length>0?this._concurrentGetMessageList(e):this._signalingMap})}_relayGetMessageList(t){const{messageList:e,nextReqMessageID:i,isCompleted:s}=t,o=e.length;if(0===o)return null;const{conversationID:a,conversationType:r}=e[0],{needMessageCount:l}=this._signalingMap.get(a),g=r===$,c=0===l||s,u=this._isSignalingNotExpired(e[o-1],"time");if(g||c||!u)return null;return this._signalingModule.getModule(n).getMessageList({conversationID:a,nextReqMessageID:i,count:l})}_handleMessageList(t){const e=t.length,{conversationID:n}=t[0],{needMessageCount:i,signalingList:s}=this._signalingMap.get(n),o=i-e>0?i-e:0,a=[];for(let l=0;l<t.length;l++){const e=t[l];this._isSignalingNotExpired(e,"time")&&a.push(e)}const r=this._signalingModule.filterMessageList(a);this._signalingMap.set(n,{needMessageCount:o,signalingList:s.concat(r)})}_getSignalingRelatedToMeMap(t){for(let e=0;e<t.length;e++){const n=t[e];this._saveSignalingRelatedToMe(n)}return this._signalingRelatedToMeMap}_saveSignalingRelatedToMe(t){const e=this._signalingModule.getRemoteSignalingHandler().getPayloadData(t)||{},{actionType:n="",inviteID:i="",inviteeList:s=[]}=e,o=this._signalingModule.getMyUserID();switch(n){case _t:s.includes(o)&&this._signalingRelatedToMeMap.set(i,{...e,messageList:[t]});break;case ft:case It:this.updateHistoryInviteInfo(t);break;case mt:this.deleteHistoryInviteInfo(i);break;case vt:this.updateHistoryInviteInfo(t)}}deleteHistoryInviteInfo(t){this._signalingRelatedToMeMap.has(t)&&this._signalingRelatedToMeMap.delete(t)}updateHistoryInviteInfo(t){const e=this._signalingModule.getRemoteSignalingHandler().getPayloadData(t)||{},{inviteID:n="",inviteeList:i=[]}=e;if(this._signalingRelatedToMeMap.has(n)){const{inviteeList:e,messageList:s}=this._signalingRelatedToMeMap.get(n);for(let t=0;t<i.length;t++){const n=i[t];e.includes(n)&&e.splice(e.indexOf(n),1)}0===e.length?this.deleteHistoryInviteInfo(n):s.push(t)}else this.deleteHistoryInviteInfo(n)}_sortSignaling(t){let e=[];t.forEach(t=>{e=[...e,...t.messageList]});return e.sort((function(t,e){return(t.time?t.time:0)-(e.time?e.time:0)}))}reset(){this._signalingMap.clear(),this._signalingRelatedToMeMap.clear()}}class wt{constructor(t,e){this.businessID=t.businessID||1,this.inviteID=t.inviteID,this.groupID=t.groupID||"",this.inviter=t.inviter||"",this.inviteeList=t.inviteeList||[],this.data=t.data||"",this.actionType=t.actionType||_t,this.timeout=t.timeout||0}}const Ct={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG_UPDATED:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"};class Tt extends class{constructor(t){this._m=t,this._n=""}isLoggedIn(){return this._m.getModule(i).isLoggedIn()}isOversea(){return this._m.getModule(i).isOversea()}isPrivateNetWork(){return this._m.getModule(i).isPrivateNetWork()}getFileDownloadProxy(){return this._m.getModule(i).getFileDownloadProxy()}getMyUserID(){return this._m.getModule(i).getUserID()}getMyTinyID(){return this._m.getModule(i).getTinyID()}getSDKAppID(){return this._m.getModule(i).getSDKAppID()}isIntl(){return this._m.getModule(i).isIntl()}isUsingChatCore(){return this._m.getModule(i).isUsingChatCore()}isDevMode(){return this._m.getModule(i).isDevMode()}getModule(t){return this._m.getModule(t)}getPlatform(){return E}getNetworkType(){return this._m.getModule(s).getNetworkType()}probeNetwork(t){return this._m.getModule(s).probe(t)}getCloudConfig(t){return this._m.getModule(a).getCloudConfig(t)}emitOuterEvent(t,e){this._m.getOuterEmitterInstance().emit(t,e)}emitInnerEvent(t,e){this._m.getInnerEmitterInstance().emit(t,e)}getInnerEmitterInstance(){return this._m.getInnerEmitterInstance()}generateTjgID(t){return this._m.getModule(i).getTinyID()+"-"+t.random}filterModifiedMessage(t){if(Q(t))return;const e=t.filter(t=>!0===t.isModified);e.length>0&&this.emitOuterEvent(l,e)}filterUnmodifiedMessage(t){if(Q(t))return[];return t.filter(t=>!1===t.isModified)}request(t){return this._m.getModule(o).request(t)}canIUse(t){return this._m.getModule(r).canIUse(t)}getErrorMessage(t,e,n){return this._m.getErrorMessage(t,e,n)}outputWarning(t,e,n){const i=this.getErrorMessage(t,e,n);i&&B.w(i)}cannotUseCommercialAbility(t){const e=nt;return rt({code:e,message:this.getErrorMessage(e,t)})}}{constructor(e){super(e),this._n="SignalingModule",this._inviteInfoMap=new Map,this._outerEmitter=new t,this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(...t){const e=[t[0],{name:t[0],data:t[1]}];this._outerEmitter._emit.apply(this._outerEmitter,[...e])}.bind(this),this._canIUseSignaling=!1,this._isHandling=!1,this._remoteSignalingHandler=new pt(this),this._localSignalingHandler=new St(this),this._historySignalingHandler=new yt(this),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1,this.getInnerEmitterInstance().on(Ct.C2C_UNREAD_HANDLE_COMPLETED,this.onC2CUnreadHandleCompleted,this),this.getInnerEmitterInstance().on(Ct.CONV_SYNC_COMPLETED,this.onConvSyncCompleted,this)}onC2CUnreadHandleCompleted(){this._isC2CUnreadHandleCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}onConvSyncCompleted(){this._isConvSyncCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}onReady(){B.l(this._n+".onReady"),this._isSyncCompleted=!0,this._historySignalingHandler.getHistorySignaling()}onNewMessageList(t){return this._remoteSignalingHandler.onNewMessageList(t)}onMessageModified(t){return this._remoteSignalingHandler.onMessageModified(t)}hasInviteInfo(t){return this._inviteInfoMap.has(t)}getInviteInfo(t){return this._inviteInfoMap.get(t)}setInviteInfo(t,e){const{message:n,...i}=e;B.l(`${this._n}.setInviteInfo inviteID:${t} data:${JSON.stringify(i)}`),this._inviteInfoMap.set(t,{...i,message:n})}deleteInviteInfo(t){this.hasInviteInfo(t)&&(B.l(`${this._n}.deleteInviteInfo inviteID:${t}.`),this._inviteInfoMap.delete(t))}updateInviteInfo(t){const e=this._n+".updateInviteInfo",{inviteID:n,inviter:i,inviteeList:s,groupID:o}=t;if(B.l(`${e} inviteID:${n} inviter:${i} groupID:${o}`),o&&this.hasInviteInfo(n)){const t=s[0],{inviteeList:i}=this.getInviteInfo(n);i.includes(t)&&(i.splice(i.indexOf(t),1),B.l(`${e} remove ${t}. localInviteeList.length:${i.length}`)),0===i.length&&this.deleteInviteInfo(n)}else this.deleteInviteInfo(n)}getLocalSignalingHandler(){return this._localSignalingHandler}getRemoteSignalingHandler(){return this._remoteSignalingHandler}canIUseSignaling(){return this._canIUseSignaling}emitEvent(t,e){this._outerEmitter.emit(t,e)}addSignalingListener(t,e,n){this._canIUseSignaling||(this._canIUseSignaling=!0),this._outerEmitter.on(t,e,n)}removeSignalingListener(t,e,n){this._outerEmitter.off(t,e,n),0===this._outerEmitter.eventNames().length&&(this._canIUseSignaling=!1)}invite(t){const e=this._n+".invite",{message:n,customData:i,inviteID:s}=this._localSignalingHandler.createInviteInfo(t);return B.l(`${e} options:${JSON.stringify(t)} inviteID:${s}`),this.sendSignaling(n,t).then(t=>t&&0===t.code?(this.setInviteInfo(s,{...i,message:n}),this.startTimer({...i,inviteID:s}),{...t,inviteID:s}):t).catch(t=>rt(t))}inviteSync(t,e,n){const i=this._n+".inviteSync",{message:s,customData:o,inviteID:a}=this._localSignalingHandler.createInviteInfo(t);return B.l(`${i} options:${JSON.stringify(t)} inviteID:${a}`),this.sendSignaling(s,t).then(t=>{if(t&&0===t.code)return this.setInviteInfo(a,{...o,message:s}),this.startTimer({...o,inviteID:a}),e&&e({inviteID:a}),{inviteID:a};n&&n(0===t.code,t.message||"")}).catch(t=>(n&&n(t.code,t.message),rt(t))),a}_handleImResponse(t,e,n){e&&0===e.code&&(this._isHandling=!1,n?this.deleteInviteInfo(t.inviteID):this.updateInviteInfo(t))}cancel(t){const e=this._n+".cancel";if(B.l(`${e} options:${JSON.stringify(t)}`),!this.hasInviteInfo(t.inviteID)||this._isHandling)return rt({code:ot});this._isHandling=!0;const n=this._localSignalingHandler.createCancelCustomData(t);if(!n)return this._isHandling=!1,rt({code:st});const{groupID:i,inviteeList:s}=n,o=i||s[0],a=this._localSignalingHandler.createSignalingMessage(n,o);return this.sendSignaling(a,t).then(e=>(this._handleImResponse(n,e,!0),0===e.code?{...e,inviteID:t.inviteID}:e)).catch(t=>rt(t))}accept(t){const e=this._n+".accept";if(B.l(`${e} options:${JSON.stringify(t)}`),!this.hasInviteInfo(t.inviteID)||this._isHandling)return rt({code:it});this._isHandling=!0;const n=this._localSignalingHandler.createAcceptCustomData(t);if(!n)return this._isHandling=!1,rt({code:st});const i=this._localSignalingHandler.createSignalingMessage(n);return this.sendSignaling(i,t).then(e=>(this._handleImResponse(n,e),0===e.code?{...e,inviteID:t.inviteID}:e)).catch(t=>rt(t))}reject(t){const e=this._n+".reject";if(B.l(`${e} options:${JSON.stringify(t)}`),!this.hasInviteInfo(t.inviteID)||this._isHandling)return rt({code:it});this._isHandling=!0;const n=this._localSignalingHandler.createRejectCustomData(t);if(!n)return this._isHandling=!1,rt({code:st});const i=this._localSignalingHandler.createSignalingMessage(n);return this.sendSignaling(i,t).then(e=>(this._handleImResponse(n,e,!0),0===e.code?{...e,inviteID:t.inviteID}:e)).catch(t=>rt(t))}getSignalingInfo(t){const e=this._n+".getSignalingInfo",{ID:n,from:i,to:s}=t,o=this._filterSignalingMessage(t);let a=null;if(o){const e=this._remoteSignalingHandler.getPayloadData(t);a=new wt(e)}const r=o?"actionType:"+a.actionType:"";return B.l(`${e} messageID:${n} from:${i} to:${s} ${r} isSignaling:${o}`),a}modifyInvitation(t){const{inviteID:n,data:i}=t;if(!this.hasInviteInfo(t.inviteID)||this._isHandling)return rt({code:it});this._isHandling=!0;const{message:s,...o}=this.getInviteInfo(n),a=s.payload.data;o.data=i,s.payload.data=JSON.stringify(o);return this.getModule(e).modifyRemoteMessage(s).then(t=>(this.setInviteInfo(n,{...o,message:s}),this._isHandling=!1,t)).catch(t=>(this._isHandling=!1,s.payload.data=a,rt(t)))}_genMessageControlInfo(t={}){const{data:e="",onlineUserOnly:n,inviteID:i="",offlinePushInfo:s,actionType:o}=t;let a={_onlineOnlyFlag:!1};i&&this.getInviteInfo(i)&&(a=this.getInviteInfo(i).message);const r={onlineUserOnly:a._onlineOnlyFlag||n||!1,offlinePushInfo:s,messageControlInfo:{excludedFromContentModeration:!0,excludedFromUnreadCount:!1,excludedFromLastMessage:!1}};if(o===vt){const t=!!e.match(/excludeTimeoutSignalingFromHistoryMessage/);return r.messageControlInfo.excludedFromUnreadCount=t,r.messageControlInfo.excludedFromLastMessage=t,r}const l=!!e.match(/excludeFromHistoryMessage/),g=!!e.match(/excludeOriginalSignalingFromHistoryMessage/);return r.messageControlInfo.excludedFromUnreadCount=l||g,r.messageControlInfo.excludedFromLastMessage=l||g,r}sendSignaling(t,n){return this.getModule(e).sendMessageInstance(t,this._genMessageControlInfo(n)).catch(t=>(this._isHandling=!1,rt(t)))}filterMessageList(t){return t.filter(t=>this._filterSignalingMessage(t))}_filterSignalingMessage(t){let e=!1;if(t.type&&t.type===L){const{cloudCustomData:n="",payload:{data:i=""}}=t,s=n.match(/"type":"tsignaling"/),o=i.match(/inviteID/),a=i.match(/actionType/);e=s||o&&a}return!!e}startTimer(t){const e=this._n+".startTimer",{timeout:n,inviteID:i,inviter:s,groupID:o}=t,a=s===this.getMyUserID();if(B.l(`${e} timeout:${n} isInviter:${a} groupID:${o}`),n<=0)return;const r=a?n+5:n;let l=1;const g=setInterval(()=>{const n=this._hasLocalInviteInfo(t,a);l<r&&n?++l:(n&&this._sendTimeoutNotice(i,a),B.l(e+" end."),clearInterval(g))},1e3)}_hasLocalInviteInfo(t,e){const{inviteID:n,groupID:i}=t;if(!this.hasInviteInfo(n))return!1;const s=this._n+"._hasLocalInviteInfo",{inviteeList:o}=this.getInviteInfo(n);return B.l(`${s} inviteID:${n} inviteeList:${o} groupID:${i}`),!i||(e?o.length>0:o.length>0&&o.includes(this.getMyUserID()))}_getReceiver(t,e){const{groupID:n,inviteeList:i,inviter:s}=e;return t?n||i[0]:n||s}_sendTimeoutNotice(t,e){const n=this.getInviteInfo(t),i=this._getReceiver(e,n);B.l(`${this._n}._sendTimeoutNotice inviteID:${t} to:${i} isInviter:${e}`);const s=this._localSignalingHandler.createTimeoutCustomData({...n,isInviter:e}),o=this._localSignalingHandler.createSignalingMessage(s,i);return this.sendSignaling(o,s).then(n=>{if(n&&0===n.code){const{data:n,groupID:i,inviteeList:a,inviter:r}=s;this.emitEvent(ht,{data:n,groupID:i,inviteID:t,inviteeList:a,inviter:r,isSelfTimeout:!0,message:o}),e?this.deleteInviteInfo(t):this.updateInviteInfo(s)}})}reset(){B.l(this._n+".reset"),this._inviteInfoMap.clear(),this._canIUseSignaling=!1,this._isHandling=!1,this._historySignalingHandler.reset(),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1}}export{Tt as default};
"use strict";var t=function(t){return s=t={exports:{}},a=Object.prototype.hasOwnProperty,_="~",Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(_=!1)),e.prototype.eventNames=function(){var t,e,i=[];if(0===this._eventsCount)return i;for(e in t=this._events)a.call(t,e)&&i.push(_?e.slice(1):e);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},e.prototype.listeners=function(t){var t=_?_+t:t,e=this._events[t];if(!e)return[];if(e.fn)return[e.fn];for(var i=0,n=e.length,s=new Array(n);i<n;i++)s[i]=e[i].fn;return s},e.prototype.listenerCount=function(t){t=_?_+t:t,t=this._events[t];return t?t.fn?1:t.length:0},e.prototype.emit=function(t,e,i,n,l,c){var h=_?_+t:t;if(!this._events[h])return!1;var s,o=this._events[h],a=arguments.length;if(o.fn){switch(o.once&&this.removeListener(t,o.fn,void 0,!0),a){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,e),!0;case 3:return o.fn.call(o.context,e,i),!0;case 4:return o.fn.call(o.context,e,i,n),!0;case 5:return o.fn.call(o.context,e,i,n,l),!0;case 6:return o.fn.call(o.context,e,i,n,l,c),!0}for(g=1,s=new Array(a-1);g<a;g++)s[g-1]=arguments[g];o.fn.apply(o.context,s)}else for(var r,u=o.length,g=0;g<u;g++)switch(o[g].once&&this.removeListener(t,o[g].fn,void 0,!0),a){case 1:o[g].fn.call(o[g].context);break;case 2:o[g].fn.call(o[g].context,e);break;case 3:o[g].fn.call(o[g].context,e,i);break;case 4:o[g].fn.call(o[g].context,e,i,n);break;default:if(!s)for(r=1,s=new Array(a-1);r<a;r++)s[r-1]=arguments[r];o[g].fn.apply(o[g].context,s)}return!0},e.prototype.on=function(t,e,i){return n(this,t,e,i,!1)},e.prototype.once=function(t,e,i){return n(this,t,e,i,!0)},e.prototype.removeListener=function(t,e,i,n){t=_?_+t:t;if(!this._events[t])return this;if(!e)return g(this,t),this;var s=this._events[t];if(s.fn)s.fn!==e||n&&!s.once||i&&s.context!==i||g(this,t);else{for(var o=0,a=[],r=s.length;o<r;o++)(s[o].fn!==e||n&&!s[o].once||i&&s[o].context!==i)&&a.push(s[o]);a.length?this._events[t]=1===a.length?a[0]:a:g(this,t)}return this},e.prototype.removeAllListeners=function(t){return t?(t=_?_+t:t,this._events[t]&&g(this,t)):(this._events=new i,this._eventsCount=0),this},e.prototype.off=e.prototype.removeListener,e.prototype.addListener=e.prototype.on,e.prefixed=_,s.exports=e.EventEmitter=e,t.exports;function i(){}function o(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,i,n,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");i=new o(i,n||t,s),n=_?_+e:e;return t._events[n]?t._events[n].fn?t._events[n]=[t._events[n],i]:t._events[n].push(i):(t._events[n]=i,t._eventsCount++),t}function g(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function e(){this._events=new i,this._eventsCount=0}var s,a,_}();const e=2,n=11,i=12,s=20,o=23,r=27;class a{constructor(t=0,e=0){this.high=t,this.low=e}equal(t){return null!==t&&this.low===t.low&&this.high===t.high}toString(){var t=Number(this.high).toString(16);let e=Number(this.low).toString(16);if(e.length<8){let t=8-e.length;for(;t;)e="0"+e,t--}return t+e}}const c={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:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.18.188"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT:"wss://wssidn.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},g={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},l="CHINA",h={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(t=l){this.CURRENT=c.PRODUCTION[t]}},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",FOLLOW:"follow"}},u=(new a(0,Math.pow(2,0)).toString(),new a(0,Math.pow(2,1)).toString(),new a(0,Math.pow(2,2)).toString(),new a(0,Math.pow(2,3)).toString(),new a(0,Math.pow(2,4)).toString(),new a(0,Math.pow(2,6)).toString(),new a(0,Math.pow(2,7)).toString(),new a(0,Math.pow(2,9)).toString(),new a(0,Math.pow(2,10)).toString(),new a(0,Math.pow(2,11)).toString(),new a(0,Math.pow(2,13)).toString(),new a(0,Math.pow(2,15)).toString(),new a(Math.pow(2,6)).toString(),new a(Math.pow(2,7)).toString(),new a(Math.pow(2,8)).toString(),new a(Math.pow(2,9)).toString(),new a(Math.pow(2,10)).toString(),new a(Math.pow(2,16)).toString(),h.HOST.setCurrent(l),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),_=(u&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),d="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),m="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),I="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,v="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,p=u||_||d||m||I||v||f,D=("undefined"!=typeof uni||"undefined"!=typeof window)&&!p,S=(_?qq:d?tt:m?swan:I?my:u?wx:v?uni:f&&jd,D&&window&&window.navigator&&window.navigator.userAgent||""),y=/(micromessenger|webbrowser)/i.test(S),M=/AppleWebKit\/([\d.]+)/i.exec(S),w=(M&&parseFloat(M.pop()),function(){let t="WEB";return y?t="WEB":_?t="QQ_MP":d?t="TT_MP":m?t="BAIDU_MP":I?t="ALI_MP":u?t="WX_MP":v&&(t="UNI_NATIVE_APP"),g[t]}()),C=(!function(){var t=S.match(/OS (\d+)_/i);t&&t[1]&&t[1]}(),function(){var t,e,i=S.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);i&&(t=i[1]&&parseFloat(i[1]),e=i[2]&&parseFloat(i[2]),t&&e&&parseFloat(i[1]+"."+i[2]))}(),function(){var t=S.match(/Chrome\/(\d+)/);t&&t[1]&&parseFloat(t[1])}(),/MSIE/.test(S)||-1<S.indexOf("Trident")&&-1<S.indexOf("rv:11.0"));let T,E;!function(){var t=/MSIE\s(\d+)\.\d/.exec(S),t=t&&parseFloat(t[1]);!t&&/Trident\/7.0/i.test(S)&&/rv:11.0/.test(S)}(),function(){var t=S.match(/TBS\/(\d+)/i);t&&t[1]&&t[1]}(),T="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const L=function(){},A=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let N=A.length;for(;N--;)E=A[N],console[E]||(T[E]=L);var O=T;const $="TIMCustomElem",P="High",U="C2C",H="GROUP",R="@TIM#SYSTEM",x=function(){const t=new Date;return t.setTime((new Date).getTime()+0),t},b=Object.prototype.hasOwnProperty;function F(t){if(null==t)return!0;if("boolean"==typeof t)return!1;if("number"==typeof t)return 0===t;if("string"==typeof t)return 0===t.length;if("function"==typeof t)return 0===t.length;if(Array.isArray(t))return 0===t.length;if(t instanceof Error)return""===t.message;if(B(t)){for(const e in t)if(b.call(t,e))return!1;return!0}return!!(q(t)||j(t)||G(t))&&0===t.size}const q=function(t){return"map"===K(t)},j=function(t){return"set"===K(t)},G=function(t){return"file"===K(t)},B=function(t){if("object"!=typeof t||null===t)return!1;t=Object.getPrototypeOf(t);if(null===t)return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return t===e},k=function(t){return void 0===t},J=function(t){return e=t,("function"==typeof Array.isArray?Array.isArray(e):"array"===K(e))||null!==t&&"object"==typeof t;var e},K=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()};function Y(){return!C&&!p}Date.now||(Date.now=function(){return(new Date).getTime()});let V=0;function W(){return Y()?"%c Chat %c":"Chat"}function z(){const t=x();return t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(t){let e;switch(t.toString().length){case 1:e="00"+t;break;case 2:e="0"+t;break;default:e=t}return e}(t.getMilliseconds())}const X={arguments2String(i){let n="";if(1===i.length)n=i[0];else for(let t=0,e=i.length;t<e;t++)J(i[t])?i[t]instanceof Error?n+=(s=i[t],JSON.stringify(s,["message","code"])):n+=JSON.stringify(i[t]):n+=i[t],n+=" ";var s;return n},_exec(t,e){Y()?O[t](W(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",z(),e):O[t](`${W()} ${z()} `+e)},d:function(){var t;V<=-1&&(t=this.arguments2String(arguments),this._exec("debug",t))},l:function(){var t;V<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},log:function(){var t;V<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},i:function(){var t;V<=1&&(t=this.arguments2String(arguments),this._exec("info",t))},w:function(){var t;V<=2&&(t=this.arguments2String(arguments),this._exec("warn",t))},e:function(){var t;V<=3&&(t=this.arguments2String(arguments),this._exec("error",t))},setLevel:function(t){t<4&&this._exec("log","set level from "+V+" to "+t),V=t},getLevel:function(){return V}};class Q extends Error{constructor(t){super();var{code:t,message:e,data:i}=t;this.code=t,this.message=e||this._getErrorMessage(this.code),this.data=i||{}}}const Z=2903,et=3122,nt=8010,it=8011,st=8020,ot="error";let rt=null;const at=function(t,e=!1){if(t instanceof Q)return e&&null!==rt&&rt.emit(ot,t),Promise.reject(t);if(t instanceof Error){const t=new Q({code:Z});return e&&null!==rt&&rt.emit(ot,t),Promise.reject(t)}if(k(t)||k(t.code))return Promise.reject(new Q({code:Z}));t=new Q(t);return e&&null!==rt&&rt.emit(ot,t),Promise.reject(t)},ct="newInvitationReceived",gt="ts_invitee_accepted",lt="ts_invitee_rejected",ht="ts_invitation_cancelled",ut="ts_invitation_timeout",_t="ts_invitation_modified",dt=1,mt=2,It=3,ft=4,vt=5;class pt{constructor(t){this._n="RemoteSignalingHandler",this._sigM=t}onNewMessageList(t){const e=this._sigM.filterMessageList(t);0<e.length&&e.forEach(t=>{var e=this.getPayloadData(t);e&&this._handleActionType(e,t)})}onMessageModified(t){const e=this._sigM.filterMessageList(t);0<e.length&&e.forEach(t=>{var e=this.getPayloadData(t);e&&this._onInvitationModified(e,t)})}getPayloadData(e){var i=this._n+".getPayloadData",e=e.payload["data"];try{return JSON.parse(e)}catch(t){return X.e(i+" JSON parse error. signalingData:"+e),null}}_handleActionType(t,e){var i=t["actionType"];switch(i){case dt:this._onNewInvitationReceived(t,e);break;case ft:this._onInviteeRejected(t);break;case It:this._onInviteeAccepted(t);break;case mt:this._onInvitationCancelled(t);break;case vt:this._onInvitationTimeout(t)}}_createDefaultEmitData(t){var{inviteID:t,inviter:e,groupID:i,data:n}=t;return{inviteID:t,inviter:e,groupID:i,data:n||""}}_onNewInvitationReceived(t,e){const i=this._n+"._onNewInvitationReceived",{inviteID:n,inviteeList:s,groupID:o,inviter:c}=t,a=this._sigM.getMyUserID(),r=s.includes(a);let g=t.timeout;var l=(x().getTime()-1e3*e.time)/1e3,h=(0<g&&0<l&&g>l&&(g-=l),i+` myselfIncluded:${r} groupID:${o} signalObj:`+JSON.stringify(t));if(X.l(h+` timeout:${g}s delta:${l}s`),o&&r||!o){const i=this._sigM.getInviteInfo(n);i&&i===t||(i||this._sigM.setInviteInfo(n,{...t,message:e}),this._sigM.emitEvent(ct,{...this._createDefaultEmitData(t),inviteeList:s}),c!==a&&this._sigM.startTimer({...t,timeout:g}))}}_onInviteeRejected(t){var e=this._n+"._onInviteeRejected",{inviteID:i,inviter:n,groupID:s}=t,o=this._sigM.hasInviteInfo(i);X.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),(s&&o||!s)&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(lt,{...this._createDefaultEmitData(t),invitee:t.inviteeList[0]}))}_onInviteeAccepted(t){var e=this._n+"._onInviteeAccepted",{inviteID:i,inviter:n,groupID:s}=t,o=this._sigM.hasInviteInfo(i);X.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),(s&&o||!s)&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(gt,{...this._createDefaultEmitData(t),invitee:t.inviteeList[0]}))}_onInvitationCancelled(t){var e=this._n+"._onInvitationCancelled",{inviteID:i,inviter:n,groupID:s}=t,o=this._sigM.hasInviteInfo(i);X.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),(s&&o||!s)&&(this._sigM.deleteInviteInfo(i),this._sigM.emitEvent(ht,this._createDefaultEmitData(t)))}_onInvitationTimeout(t){var e=this._n+"._onInvitationTimeout",{inviteID:i,inviter:n,groupID:s,inviteeList:o}=t,a=this._sigM.hasInviteInfo(i);X.l(e+` inviteID:${i} hasInviteID:${a} inviter:${n} groupID:${s} data:`+t.data),(s&&a||!s)&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(ut,{...this._createDefaultEmitData(t),inviteeList:o,isSelfTimeout:!1}))}_onInvitationModified(t,e){var i=this._n+"._onInvitationModified",{inviteID:n,data:s}=t;X.l(i+` inviteID:${n} data:`+s),this._sigM.setInviteInfo(n,{...t,message:e}),this._sigM.emitEvent(_t,{inviteID:n,data:s})}}const Dt=function(t){if(t<0||53<t)return NaN;var e=0|1073741824*Math.random();return 30<t?e+1073741824*(0|Math.random()*(1<<t-30)):e>>>30-t},St=function(t,e){let i=t.toString(16),n=e-i.length,s="0";for(;0<n;n>>>=1,s+=s)1&n&&(i=s+i);return i};class yt{constructor(t){this._n="LocalSignalingHandler",this._sigM=t}generateInviteID(){var t=function(){const t=Dt,e=St;return e(t(32),8)+"-"+e(t(16),4)+"-"+e(16384|t(12),4)+"-"+e(32768|t(14),4)+"-"+e(t(48),12)}();return X.l(this._n+".generateInviteID inviteID:"+t),t}createInviteInfo(t){var e=this.generateInviteID(),t=this.createInviteCustomData({...t,inviteID:e}),{groupID:i,inviteeList:n}=t,i=i||n[0];return{customData:t,message:this.createSignalingMessage(t,i),inviteID:e}}_createDefaultCustomData(t){var{data:t="",inviteID:e="",groupID:i=""}=t;return{businessID:1,timeout:0,data:t,inviteID:e,groupID:i}}createInviteCustomData(t){var{userID:e,timeout:i=0,groupID:n=""}=t,s=this._sigM.getMyUserID(),s={...this._createDefaultCustomData(t),actionType:dt,inviter:s,inviteeList:n?t.inviteeList:[e],timeout:i};return X.l(this._n+".createInviteCustomData customData:"+JSON.stringify(s)),s}createCancelCustomData(t){var e=this._n+".createCancelCustomData",i=t["inviteID"];let n;var s=this._sigM.getMyUserID(),{inviteeList:i,groupID:o,inviter:a}=this._sigM.getInviteInfo(i);return a===s?n={...this._createDefaultCustomData(t),actionType:mt,groupID:o,inviter:s,inviteeList:i}:X.e(e+` unmatched inviter:${a} and my userID:`+s),X.l(e+" customData:"+JSON.stringify(n)),n}createAcceptCustomData(t){var e=this._n+".createAcceptCustomData",i=t["inviteID"];let n;const s=this._sigM.getMyUserID(),{inviter:o,groupID:a,inviteeList:r}=this._sigM.getInviteInfo(i);return r.includes(s)?n={...this._createDefaultCustomData(t),actionType:It,groupID:a,inviter:o,inviteeList:[s]}:X.e(e+` userID:${s} not in inviteeList. inviteID:${i} groupID:`+a),X.l(e+" customData:"+JSON.stringify(n)),n}createRejectCustomData(t){var e=this._n+".createRejectCustomData",i=t["inviteID"];let n;const s=this._sigM.getMyUserID(),{inviter:o,groupID:a,inviteeList:r}=this._sigM.getInviteInfo(i);return r.includes(s)?n={...this._createDefaultCustomData(t),actionType:ft,groupID:a,inviter:o,inviteeList:[s]}:X.e(e+` userID:${s} not in inviteeList. inviteID:${i} groupID:`+a),X.l(e+" customData:"+JSON.stringify(n)),n}createTimeoutCustomData(t){var e=this._n+".createTimeoutCustomData",{inviteeList:i,inviter:n,isInviter:s=!1}=t,o=this._sigM.getMyUserID(),t={...this._createDefaultCustomData(t),actionType:vt,inviter:n,inviteeList:s?i:[o]};return X.l(e+" customData:"+JSON.stringify(t)),t}createSignalingMessage(t,i){const{groupID:n,inviter:s}=t,o=this._sigM.get(e),a={to:i||n||s,conversationType:n?H:U,priority:P,payload:{data:JSON.stringify(t)}},r=o.createCustomMessage(a);return X.d(this._n+".createSignalingMessage. message:"+JSON.stringify(r)),r}}class Mt{constructor(t){this._n="HistorySignalingHandler",this._sigM=t,this.EXPIRED_TIME=3e4,this.COUNT=20,this._signalingMap=new Map,this._signalingRelatedToMeMap=new Map}getHistorySignaling(){var t=this._sigM.get(n).getLocalConversationList();F(t)||this._getSignalingList(t).then(t=>{this._handleSignalingList(t)})}_getSignalingList(t){t=this._getValidConversationList(t),t=this._createPromiseList(t);return F(t)?Promise.resolve([]):this._concurrentGetMessageList(t).then(t=>{let e=new Map;return t.forEach(t=>{t=t.signalingList,t=this._getSignalingRelatedToMeMap(t);e=new Map([...e,...t])}),this._sortSignaling(e)})}_handleSignalingList(t){F(t)||(X.d(this._n+"._handleSignalingList signalingList:"+JSON.stringify(t)),this._sigM.onNewMessageList(t))}_isSignalingNotExpired(t,e){return t[e]&&1e3*t[e]>(new Date).getTime()-this.EXPIRED_TIME}_getValidConversationList(e){const i=[];for(let t=0;t<e.length;t++){var{type:n,unreadCount:s,lastMessage:o}=e[t],o=this._isSignalingNotExpired(o,"lastTime");n!==R&&0<s&&o&&i.push(e[t])}return i}_createPromiseList(e){const i=[];for(let t=0;t<e.length;t++){var{conversationID:s,unreadCount:o,type:a}=e[t],a=a===U?o:this.COUNT,o=(this._signalingMap.set(s,{needMessageCount:a,signalingList:[]}),this._sigM.get(n).getMessageList({conversationID:s}));i.push(o)}return i}_concurrentGetMessageList(t){const s=[];return Promise.all(t).then(e=>{for(let t=0;t<e.length;t++){var{code:i,data:n}=e[t];0===i&&0!==n.messageList.length&&(this._handleMessageList(n.messageList),(i=this._relayGetMessageList(n))&&s.push(i))}return 0<s.length?this._concurrentGetMessageList(s):this._signalingMap})}_relayGetMessageList(t){var{messageList:t,nextReqMessageID:e,isCompleted:i}=t,s=t.length;if(0===s)return null;var{conversationID:o,conversationType:a}=t[0],r=this._signalingMap.get(o)["needMessageCount"],a=a===H,i=0===r||i,t=this._isSignalingNotExpired(t[s-1],"time");return a||i||!t?null:this._sigM.get(n).getMessageList({conversationID:o,nextReqMessageID:e,count:r})}_handleMessageList(e){const i=e.length,t=e[0]["conversationID"],{needMessageCount:n,signalingList:s}=this._signalingMap.get(t),o=0<n-i?n-i:0,a=[];for(let t=0;t<e.length;t++){const i=e[t];this._isSignalingNotExpired(i,"time")&&a.push(i)}var r=this._sigM.filterMessageList(a);this._signalingMap.set(t,{needMessageCount:o,signalingList:s.concat(r)})}_getSignalingRelatedToMeMap(e){for(let t=0;t<e.length;t++){var i=e[t];this._saveSignalingRelatedToMe(i)}return this._signalingRelatedToMeMap}_saveSignalingRelatedToMe(t){const e=this._sigM.getRemoteSignalingHandler().getPayloadData(t)||{},{actionType:i="",inviteID:n="",inviteeList:s=[]}=e,o=this._sigM.getMyUserID();switch(i){case dt:s.includes(o)&&this._signalingRelatedToMeMap.set(n,{...e,messageList:[t]});break;case ft:case It:this.updateHistoryInviteInfo(t);break;case mt:this.deleteHistoryInviteInfo(n);break;case vt:this.updateHistoryInviteInfo(t)}}deleteHistoryInviteInfo(t){this._signalingRelatedToMeMap.has(t)&&this._signalingRelatedToMeMap.delete(t)}updateHistoryInviteInfo(t){const e=this._sigM.getRemoteSignalingHandler().getPayloadData(t)||{},{inviteID:i="",inviteeList:n=[]}=e;if(this._signalingRelatedToMeMap.has(i)){const{inviteeList:e,messageList:s}=this._signalingRelatedToMeMap.get(i);for(let t=0;t<n.length;t++){const i=n[t];e.includes(i)&&e.splice(e.indexOf(i),1)}0===e.length?this.deleteHistoryInviteInfo(i):s.push(t)}else this.deleteHistoryInviteInfo(i)}_sortSignaling(t){let e=[];return t.forEach(t=>{e=[...e,...t.messageList]}),e.sort(function(t,e){return(t.time||0)-(e.time||0)})}reset(){this._signalingMap.clear(),this._signalingRelatedToMeMap.clear()}}class wt{constructor(t,e){this.businessID=t.businessID||1,this.inviteID=t.inviteID,this.groupID=t.groupID||"",this.inviter=t.inviter||"",this.inviteeList=t.inviteeList||[],this.data=t.data||"",this.actionType=t.actionType||dt,this.timeout=t.timeout||0}}const Ct={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG_UPDATED:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"};class Tt extends class{constructor(t){this._m=t,this._n=""}isLoggedIn(){return this._m.get(i).isLoggedIn()}isOversea(){return this._m.get(i).isOversea()}isPrivateNetWork(){return this._m.get(i).isPrivateNetWork()}getFileDownloadProxy(){return this._m.get(i).getFileDownloadProxy()}getMyUserID(){return this._m.get(i).getUserID()}getMyTinyID(){return this._m.get(i).getTinyID()}getSDKAppID(){return this._m.get(i).getSDKAppID()}isIntl(){return this._m.get(i).isIntl()}isUsingChatCore(){return this._m.get(i).isUsingChatCore()}isDevMode(){return this._m.get(i).isDevMode()}get(t){return this._m.get(t)}getPlatform(){return w}getCloudConfig(t){return this._m.get(o).getCloudConfig(t)}emitOuterEvent(t,e){this._m.getOuterEmitterInstance().emit(t,e)}emitInnerEvent(t,e){this._m.getInnerEmitterInstance().emit(t,e)}getInnerEmitterInstance(){return this._m.getInnerEmitterInstance()}generateTjgID(t){return this._m.get(i).getTinyID()+"-"+t.random}req(t){return this._m.get(s).req(t)}canIUse(t){return this._m.get(r).canIUse(t)}getErrorMessage(t,e,i){return this._m.getErrorMessage(t,e,i)}outputWarning(t,e,i){t=this.getErrorMessage(t,e,i);t&&X.w(t)}cannotUseCommercialAbility(t){var e=et;return at({code:e,message:this.getErrorMessage(e,t)})}}{constructor(e){super(e),this._n="SignalingModule",this._inviteInfoMap=new Map,this._outerEmitter=new t,this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(...t){t=[t[0],{name:t[0],data:t[1]}];this._outerEmitter._emit.apply(this._outerEmitter,[...t])}.bind(this),this._canIUseSignaling=!1,this._isHandling=!1,this._remoteSignalingHandler=new pt(this),this._localSignalingHandler=new yt(this),this._historySignalingHandler=new Mt(this),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1,this.getInnerEmitterInstance().on(Ct.C2C_UNREAD_HANDLE_COMPLETED,this.onC2CUnreadHandleCompleted,this),this.getInnerEmitterInstance().on(Ct.CONV_SYNC_COMPLETED,this.onConvSyncCompleted,this)}onC2CUnreadHandleCompleted(){this._isC2CUnreadHandleCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}onConvSyncCompleted(){this._isConvSyncCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}onReady(){X.l(this._n+".onReady"),this._isSyncCompleted=!0,this._historySignalingHandler.getHistorySignaling()}onNewMessageList(t){return this._remoteSignalingHandler.onNewMessageList(t)}onMessageModified(t){return this._remoteSignalingHandler.onMessageModified(t)}hasInviteInfo(t){return this._inviteInfoMap.has(t)}getInviteInfo(t){return this._inviteInfoMap.get(t)}setInviteInfo(t,e){const{message:i,...n}=e;X.l(this._n+`.setInviteInfo inviteID:${t} data:`+JSON.stringify(n)),this._inviteInfoMap.set(t,{...n,message:i})}deleteInviteInfo(t){this.hasInviteInfo(t)&&(X.l(this._n+`.deleteInviteInfo inviteID:${t}.`),this._inviteInfoMap.delete(t))}updateInviteInfo(t){const e=this._n+".updateInviteInfo",{inviteID:i,inviter:n,inviteeList:s,groupID:o}=t;if(X.l(e+` inviteID:${i} inviter:${n} groupID:`+o),o&&this.hasInviteInfo(i)){const t=s[0],n=this.getInviteInfo(i)["inviteeList"];n.includes(t)&&(n.splice(n.indexOf(t),1),X.l(e+` remove ${t}. localInviteeList.length:`+n.length)),0===n.length&&this.deleteInviteInfo(i)}else this.deleteInviteInfo(i)}getLocalSignalingHandler(){return this._localSignalingHandler}getRemoteSignalingHandler(){return this._remoteSignalingHandler}canIUseSignaling(){return this._canIUseSignaling}emitEvent(t,e){this._outerEmitter.emit(t,e)}addSignalingListener(t,e,i){this._canIUseSignaling||(this._canIUseSignaling=!0),this._outerEmitter.on(t,e,i)}removeSignalingListener(t,e,i){this._outerEmitter.off(t,e,i),0===this._outerEmitter.eventNames().length&&(this._canIUseSignaling=!1)}invite(t){const e=this._n+".invite",{message:i,customData:n,inviteID:s}=this._localSignalingHandler.createInviteInfo(t);return X.l(e+` options:${JSON.stringify(t)} inviteID:`+s),this.sendSignaling(i,t).then(t=>t&&0===t.code?(this.setInviteInfo(s,{...n,message:i}),this.startTimer({...n,inviteID:s}),{...t,inviteID:s}):t).catch(t=>at(t))}inviteSync(t,e,i){const n=this._n+".inviteSync",{message:s,customData:o,inviteID:a}=this._localSignalingHandler.createInviteInfo(t);return X.l(n+` options:${JSON.stringify(t)} inviteID:`+a),this.sendSignaling(s,t).then(t=>{if(t&&0===t.code)return this.setInviteInfo(a,{...o,message:s}),this.startTimer({...o,inviteID:a}),e&&e({inviteID:a}),{inviteID:a};i&&i(0===t.code,t.message||"")}).catch(t=>(i&&i(t.code,t.message),at(t))),a}_handleImResponse(t,e,i){e&&0===e.code&&(this._isHandling=!1,i?this.deleteInviteInfo(t.inviteID):this.updateInviteInfo(t))}cancel(e){var t=this._n+".cancel";if(X.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return at({code:st});this._isHandling=!0;const i=this._localSignalingHandler.createCancelCustomData(e);if(!i)return this._isHandling=!1,at({code:it});var{groupID:t,inviteeList:n}=i,t=t||n[0],n=this._localSignalingHandler.createSignalingMessage(i,t);return this.sendSignaling(n,e).then(t=>(this._handleImResponse(i,t,!0),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>at(t))}accept(e){var t=this._n+".accept";if(X.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return at({code:nt});this._isHandling=!0;const i=this._localSignalingHandler.createAcceptCustomData(e);if(!i)return this._isHandling=!1,at({code:it});t=this._localSignalingHandler.createSignalingMessage(i);return this.sendSignaling(t,e).then(t=>(this._handleImResponse(i,t),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>at(t))}reject(e){var t=this._n+".reject";if(X.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return at({code:nt});this._isHandling=!0;const i=this._localSignalingHandler.createRejectCustomData(e);if(!i)return this._isHandling=!1,at({code:it});t=this._localSignalingHandler.createSignalingMessage(i);return this.sendSignaling(t,e).then(t=>(this._handleImResponse(i,t,!0),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>at(t))}getSignalingInfo(t){const e=this._n+".getSignalingInfo",{ID:i,from:n,to:s}=t,o=this._filterSignalingMessage(t);let a=null;if(o){const e=this._remoteSignalingHandler.getPayloadData(t);a=new wt(e)}t=o?"actionType:"+a.actionType:"";return X.l(e+` messageID:${i} from:${n} to:${s} ${t} isSignaling:`+o),a}modifyInvitation(t){const{inviteID:i,data:n}=t;if(!this.hasInviteInfo(t.inviteID)||this._isHandling)return at({code:nt});this._isHandling=!0;const{message:s,...o}=this.getInviteInfo(i),a=s.payload.data;return o.data=n,s.payload.data=JSON.stringify(o),this.get(e).modifyRemoteMessage(s).then(t=>(this.setInviteInfo(i,{...o,message:s}),this._isHandling=!1,t)).catch(t=>(this._isHandling=!1,s.payload.data=a,at(t)))}_genMessageControlInfo(t={}){const{data:e="",onlineUserOnly:i,inviteID:n="",offlinePushInfo:s,actionType:o}=t;let a={_onlineOnlyFlag:!1};const r={onlineUserOnly:(a=n&&this.getInviteInfo(n)?this.getInviteInfo(n).message:a)._onlineOnlyFlag||i||!1,offlinePushInfo:s,messageControlInfo:{excludedFromContentModeration:!0,excludedFromUnreadCount:!1,excludedFromLastMessage:!1}};if(o===vt){const t=!!e.match(/excludeTimeoutSignalingFromHistoryMessage/);return r.messageControlInfo.excludedFromUnreadCount=t,r.messageControlInfo.excludedFromLastMessage=t,r}var t=!!e.match(/excludeFromHistoryMessage/),g=!!e.match(/excludeOriginalSignalingFromHistoryMessage/);return r.messageControlInfo.excludedFromUnreadCount=t||g,r.messageControlInfo.excludedFromLastMessage=t||g,r}sendSignaling(t,i){return this.get(e).sendMessageInstance(t,this._genMessageControlInfo(i)).catch(t=>(this._isHandling=!1,at(t)))}filterMessageList(t){return t.filter(t=>this._filterSignalingMessage(t))}_filterSignalingMessage(t){let e=!1;if(t.type&&t.type===$){const{cloudCustomData:i="",payload:{data:n=""}}=t,s=i.match(/"type":"tsignaling"/),o=n.match(/inviteID/),a=n.match(/actionType/);e=s||o&&a}return!!e}startTimer(i){const n=this._n+".startTimer",{timeout:t,inviteID:s,inviter:e,groupID:o}=i,a=e===this.getMyUserID();if(X.l(n+` timeout:${t} isInviter:${a} groupID:`+o),!(t<=0)){const r=a?t+5:t;let e=1;const g=setInterval(()=>{var t=this._hasLocalInviteInfo(i,a);e<r&&t?++e:(t&&this._sendTimeoutNotice(s,a),X.l(n+" end."),clearInterval(g))},1e3)}}_hasLocalInviteInfo(t,e){var{inviteID:t,groupID:i}=t;if(!this.hasInviteInfo(t))return!1;const n=this._n+"._hasLocalInviteInfo",s=this.getInviteInfo(t)["inviteeList"];return X.l(n+` inviteID:${t} inviteeList:${s} groupID:`+i),!i||(e?0<s.length:0<s.length&&s.includes(this.getMyUserID()))}_getReceiver(t,e){var{groupID:e,inviteeList:i,inviter:n}=e;return t?e||i[0]:e||n}_sendTimeoutNotice(s,o){var t=this.getInviteInfo(s),e=this._getReceiver(o,t);X.l(this._n+`._sendTimeoutNotice inviteID:${s} to:${e} isInviter:`+o);const a=this._localSignalingHandler.createTimeoutCustomData({...t,isInviter:o}),r=this._localSignalingHandler.createSignalingMessage(a,e);return this.sendSignaling(r,a).then(t=>{if(t&&0===t.code){const{data:t,groupID:e,inviteeList:i,inviter:n}=a;this.emitEvent(ut,{data:t,groupID:e,inviteID:s,inviteeList:i,inviter:n,isSelfTimeout:!0,message:r}),o?this.deleteInviteInfo(s):this.updateInviteInfo(a)}})}reset(){X.l(this._n+".reset"),this._inviteInfoMap.clear(),this._canIUseSignaling=!1,this._isHandling=!1,this._historySignalingHandler.reset(),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1}}export{Tt as default};
{
"name": "@tencentcloud/chat",
"version": "3.2.3",
"version": "3.2.4",
"description": "Tencent Cloud Chat SDK for Web",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,0 +0,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc