Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tencentcloud/chat

Package Overview
Dependencies
Maintainers
14
Versions
29
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.4.0 to 3.4.1

2

modules/follow-module.js

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

"use strict";const t=12,e=20,s=23,o=27;class n{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 i={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"}}},r={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19},l="CHINA",a={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(t=l){this.CURRENT=i.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",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},c={SEARCH_GRP_SNS:new n(0,Math.pow(2,1)).toString(),AV_HISTORY_MSG:new n(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new n(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new n(0,Math.pow(2,4)).toString(),AV_MBR_LIST:new n(0,Math.pow(2,6)).toString(),USER_STATUS:new n(0,Math.pow(2,7)).toString(),CONV_MARK:new n(0,Math.pow(2,9)).toString(),CONV_GROUP:new n(0,Math.pow(2,10)).toString(),AV_BAN_MBR:new n(0,Math.pow(2,11)).toString(),MSG_EXT:new n(0,Math.pow(2,13)).toString(),GRP_COUNTER:new n(0,Math.pow(2,15)).toString(),PLUGIN_TRANSLATE:new n(Math.pow(2,6)).toString(),PLUGIN_VOICE_TO_TEXT:new n(Math.pow(2,7)).toString(),PLUGIN_CS:new n(Math.pow(2,8)).toString(),PLUGIN_PUSH:new n(Math.pow(2,9)).toString(),PLUGIN_BOT:new n(Math.pow(2,10)).toString(),MSG_REACTION:new n(Math.pow(2,16)).toString(),FOLLOW:new n(Math.pow(2,20)).toString()},u=(a.HOST.setCurrent(l),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),h=(u&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),_="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),g="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),m="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,w="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,d=u&&"object"==typeof wx.miniapp,p=u||h||_||g||f||w||m,T=("undefined"!=typeof uni||"undefined"!=typeof window)&&!p,I=(h?qq:_?tt:g?swan:f?my:u?wx:w?uni:m&&jd,T&&window&&window.navigator&&window.navigator.userAgent||""),L=/(micromessenger|webbrowser)/i.test(I),M=/AppleWebKit\/([\d.]+)/i.exec(I),y=(M&&parseFloat(M.pop()),function(){let t="WEB";return L?t="WEB":h?t="QQ_MP":_?t="TT_MP":g?t="BAIDU_MP":f?t="ALI_MP":u?t=d?"DONUT_NATIVE_APP":"WX_MP":w&&(t="UNI_NATIVE_APP"),r[t]}()),A=(!function(){var t=I.match(/OS (\d+)_/i);t&&t[1]&&t[1]}(),function(){var t,e,s=I.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);s&&(t=s[1]&&parseFloat(s[1]),e=s[2]&&parseFloat(s[2]),t&&e&&parseFloat(s[1]+"."+s[2]))}(),function(){var t=I.match(/Chrome\/(\d+)/);t&&t[1]&&parseFloat(t[1])}(),/MSIE/.test(I)||-1<I.indexOf("Trident")&&-1<I.indexOf("rv:11.0"));let S,E;!function(){var t=/MSIE\s(\d+)\.\d/.exec(I),t=t&&parseFloat(t[1]);!t&&/Trident\/7.0/i.test(I)&&/rv:11.0/.test(I)}(),function(){var t=I.match(/TBS\/(\d+)/i);t&&t[1]&&t[1]}(),S="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const U=function(){},O=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let F=O.length;for(;F--;)E=O[F],console[E]||(S[E]=U);var C=S;const P=function(){return(new Date).getTime()+0},D="Tag_Profile_IM_Nick",N="Tag_Profile_IM_Gender",v="Tag_Profile_IM_BirthDay",R="Tag_Profile_IM_Location",b="Tag_Profile_IM_SelfSignature",G="Tag_Profile_IM_AllowType",x="Tag_Profile_IM_Language",k="Tag_Profile_IM_Image",$="Tag_Profile_IM_MsgSettings",q="Tag_Profile_IM_AdminForbidType",B="Tag_Profile_IM_Level",W="Tag_Profile_IM_Role",j=Object.prototype.hasOwnProperty,H=function(t){return"map"===Q(t)},V=function(t){return"set"===Q(t)},K=function(t){return"file"===Q(t)},X=function(t){return null!==t&&("number"==typeof t&&!isNaN(+t)||"object"==typeof t&&t.constructor===Number)},Y=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},z=function(t){return void 0===t},J=function(t){return e=t,("function"==typeof Array.isArray?Array.isArray(e):"array"===Q(e))||null!==t&&"object"==typeof t;var e},Q=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()},Z=(Date.now||(Date.now=function(){return(new Date).getTime()}),"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),et=Z.length;function st(){return!A&&!p}let ot=0;function nt(){return st()?"%c Chat %c":"Chat"}function it(){const t=function(){const t=new Date;return t.setTime(P()),t}();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 rt={arguments2String(s){let o="";if(1===s.length)o=s[0];else for(let t=0,e=s.length;t<e;t++)J(s[t])?s[t]instanceof Error?o+=(n=s[t],JSON.stringify(n,["message","code"])):o+=JSON.stringify(s[t]):o+=s[t],o+=" ";var n;return o},_exec(t,e){st()?C[t](nt(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",it(),e):C[t](`${nt()} ${it()} `+e)},d:function(){var t;ot<=-1&&(t=this.arguments2String(arguments),this._exec("debug",t))},l:function(){var t;ot<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},log:function(){var t;ot<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},i:function(){var t;ot<=1&&(t=this.arguments2String(arguments),this._exec("info",t))},w:function(){var t;ot<=2&&(t=this.arguments2String(arguments),this._exec("warn",t))},e:function(){var t;ot<=3&&(t=this.arguments2String(arguments),this._exec("error",t))},setLevel:function(t){t<4&&this._exec("log","set level from "+ot+" to "+t),ot=t},getLevel:function(){return ot}},lt=function(t){return{code:0,data:t||{}}};class at extends Error{constructor(t){super();var{code:t,message:e,data:s}=t;this.code=t,e?this.message=e:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=s||{}}}const ct=2805,ut=2903,ht=3122,_t="onMyFollowersListUpdated",gt="onMyFollowingListUpdated",ft="onMutualFollowersListUpdated",mt="error";let wt=null;const dt=function(t){return Promise.resolve(lt(t))},pt=function(t,e=!1){if(t instanceof at)return e&&null!==wt&&wt.emit(mt,t),Promise.reject(t);if(t instanceof Error){const t=new at({code:ut});return e&&null!==wt&&wt.emit(mt,t),Promise.reject(t)}if(z(t)||z(t.code))return Promise.reject(new at({code:ut}));t=new at(t);return e&&null!==wt&&wt.emit(mt,t),Promise.reject(t)},Tt="follow_add",It="follow_delete",Lt="follow_get",Mt="follow_get_info",yt="follow_check",At={info:4,warning:5,error:6},St={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},Et={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16};class Ut{constructor(t){this._n="SSOLogData",this.eventType=Et[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=P()}static bindEventStatModule(t){Ut.prototype._eventStatModule=t}static bindNetMonitorModule(t){Ut.prototype._netMonitorModule=t}updateTimeStamp(){this.timestamp=P()}start(t){return this._startts=t,this}end(t=!1){if(!this._sentFlag){if(this._netMonitorModule){const t=this._netMonitorModule.getNetworkType();this.setNetworkType(t)}var e=P();0===this.costTime&&(this.costTime=e-this._startts),this.setMoreMessage(`startts:${this._startts} endts:`+e),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout(()=>{this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)},0)}}setError(t){if(!(t instanceof Error))return rt.w(this._n+".setError value not instanceof Error, please check!"),this;if(this._sentFlag)return this;let e=!0;if(e=this._netMonitorModule?this._netMonitorModule.isOnline():e)t.code&&this.setCode(t.code),t.message&&this.setMoreMessage(t.message);else{const t=ct;this.setCode(t)}return this.setLevel("error"),this}setCode(t){return z(t)||this._sentFlag||("ECONNABORTED"===t&&(this.code=103),X(t)?this.code=t:rt.w(this._n+".setCode value not a number, please check!",t,typeof t)),this}setMessage(t){return z(t)||this._sentFlag||(X(t)&&(this.message=t.toString()),"string"==typeof t&&(this.message=t)),this}setCostTime(t){return this.costTime=t,this}setLevel(t){return z(t)||this._sentFlag||(this.level=At[t]),this}setMoreMessage(t){return function(t){if(null==t)return 1;if("boolean"!=typeof t){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(Y(t)){for(const e in t)if(j.call(t,e))return;return 1}return(H(t)||V(t)||K(t))&&0===t.size}}(this.moreMessage)?this.moreMessage=""+t:this.moreMessage+=" "+t,this}setNetworkType(t){return z(t)?rt.w(this._n+".setNetworkType value is undefined, please check!"):(t=St[t.toLowerCase()],z(t)||(this.networkType=t)),this}getStartTs(){return this._startts}setUIPlatform(t){return this.uiPlatform=t,this}setExtension(t){return this.extension=t,this}setEventType(t){return this.eventType=t,this}}const Ot={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG_UPDATED:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"},Ft={NONE:0,FOLLOWERS:1,FOLLOWING:2,MUTUAL:3};class Ct extends class{constructor(t){this._m=t,this._n=""}isLoggedIn(){return this._m.get(t).isLoggedIn()}isOversea(){return this._m.get(t).isOversea()}isPrivateNetWork(){return this._m.get(t).isPrivateNetWork()}getFileDownloadProxy(){return this._m.get(t).getFileDownloadProxy()}getMyUserID(){return this._m.get(t).getUserID()}getMyTinyID(){return this._m.get(t).getTinyID()}getSDKAppID(){return this._m.get(t).getSDKAppID()}isIntl(){return this._m.get(t).isIntl()}isUsingChatCore(){return this._m.get(t).isUsingChatCore()}isDevMode(){return this._m.get(t).isDevMode()}get(t){return this._m.get(t)}getPlatform(){return y}getCloudConfig(t){return this._m.get(s).getCloudConfig(t)}emitOEvt(t,e){this._m.getOEmitInst().emit(t,e)}emitIEvt(t,e){this._m.getIEmitInst().emit(t,e)}getIEmitInst(){return this._m.getIEmitInst()}generateTjgID(e){return this._m.get(t).getTinyID()+"-"+e.random}req(t){return this._m.get(e).req(t)}canIUse(t){return this._m.get(o).canIUse(t)}getErrMsg(t,e,s){return this._m.getErrMsg(t,e,s)}warn(t,e,s){t=this.getErrMsg(t,e,s);t&&rt.w(t)}noUse(t){var e=ht;return pt({code:e,message:this.getErrMsg(e,t)})}}{constructor(t){super(t),this._n="FollowModule",this._myFollowersList=new Map,this._myFollowingList=new Map,this._myMutualFollowersList=new Map,this._followType=new Map,this.MAX_CATCH_TIME=6e5,this.FIRST_PAGE_INDEX=function(){let e="";for(let t=32;0<t;--t)e+=Z[Math.floor(Math.random()*et)];return e}(),this.DEFAULT_COUNT=500,this.MAX_COUNT=1e3,this.getIEmitInst().on(Ot.CLOUD_CONFIG_UPDATED,this._onCloudConfigUpdated,this)}_onCloudConfigUpdated(){var t=this.getCloudConfig("follow_req_count");z(t)||(t=Number(t),this.DEFAULT_COUNT=t>this.MAX_COUNT?this.MAX_COUNT:t,this._clearFollowList())}clearCacheOnReconnected(){this._clearFollowList(),this._followType.clear()}onFollowInfoNotify(t){var{followAddList:t=[],followDeleteList:e=[],pushType:s}=t.dataList||{},o=this._initFollowInfo();1===s?this._handleFollowAddList({followAddList:t,followInfo:o}):this._handleFollowDeleteList({followDeleteList:e,followInfo:o}),this._emitEvent(o),rt.l(`${this._n}.onFollowInfoNotify pushType:${s} followAddList:${t.length} followDeleteList:`+e.length)}_initFollowInfo(){const e={};return Object.values(Ft).forEach(t=>{t!==Ft.NONE&&(e[t]={userInfoList:[],isAdd:!1})}),e}_handleFollowAddList(t){const{followAddList:e,followInfo:o}=t;e.forEach(t=>{const{followTypeList:e=[],...s}=t;e.forEach(t=>{o[t].userInfoList.push(s),o[t].isAdd=!0}),this._setFollowType(t.userID,t.followType)})}_handleFollowDeleteList(t){const{followDeleteList:e,followInfo:o}=t;e.forEach(t=>{const{followTypeList:e=[],userID:s}=t;e.forEach(t=>{o[t].userInfoList.push(s),o[t].isAdd=!1}),this._setFollowType(t.userID,t.followType)})}_emitEvent(s){Object.keys(s).forEach(t=>{var t=Number(t),e=s[t];0<e.userInfoList.length&&(t===Ft.FOLLOWERS&&(this._clearFollowList(Ft.FOLLOWERS),this.emitOEvt(_t,e)),t===Ft.FOLLOWING&&(this._clearFollowList(Ft.FOLLOWING),this.emitOEvt(gt,e)),t===Ft.MUTUAL&&(this._clearFollowList(Ft.MUTUAL),this.emitOEvt(ft,e)))})}followUser(t){if(!this.canIUse(c.FOLLOW))return this.noUse("followUser");const e=this._n+".followUser",s="userIDList:"+t.length,o=new Ut("followUser");return o.setMessage(s),rt.l(e+" "+s),this.req({P:Tt,data:{fromAccount:this.getMyUserID(),userIDList:t.map(t=>({userID:t}))}}).then(t=>(o.end(),rt.l(e+" ok."),lt(t.data.resultList))).catch(t=>(o.setError(t).end(),rt.e(e+" failed. error:",t),pt(t)))}unfollowUser(t){if(!this.canIUse(c.FOLLOW))return this.noUse("unfollowUser");const e=this._n+".unfollowUser",s="userIDList:"+t.length,o=new Ut("unfollowUser");return o.setMessage(s),rt.l(e+" "+s),this.req({P:It,data:{fromAccount:this.getMyUserID(),userIDList:t}}).then(t=>(o.end(),rt.l(e+" ok."),lt(t.data.resultList))).catch(t=>(o.setError(t).end(),rt.e(e+" failed. error:",t),pt(t)))}getMyFollowersList(e=""){const s="getMyFollowersList";if(!this.canIUse(c.FOLLOW))return this.noUse(s);const o=e||this.FIRST_PAGE_INDEX;if(this._myFollowersList.has(o)){var{resultList:t,nextCursor:n,lastUpdateTime:r}=this._myFollowersList.get(o);if(Date.now()-r<this.MAX_CATCH_TIME&&0<t.length)return rt.l(`${this._n}.${s} nextCursor:${e} from local.`),dt({resultList:t,nextCursor:n})}return this._getFollowList(e,Ft.FOLLOWERS).then(t=>(this._myFollowersList.set(o,{...t,lastUpdateTime:Date.now()}),rt.l(`${this._n}.${s} nextCursor:${e} from remote.`),lt(t)))}getMyFollowingList(e=""){const s="getMyFollowingList";if(!this.canIUse(c.FOLLOW))return this.noUse(s);const o=e||this.FIRST_PAGE_INDEX;if(this._myFollowingList.has(o)){var{resultList:t,nextCursor:n,lastUpdateTime:r}=this._myFollowingList.get(o);if(Date.now()-r<this.MAX_CATCH_TIME&&0<t.length)return rt.l(`${this._n}.${s} nextCursor:${e} from local.`),dt({resultList:t,nextCursor:n})}return this._getFollowList(e,Ft.FOLLOWING).then(t=>(this._myFollowingList.set(o,{...t,lastUpdateTime:Date.now()}),rt.l(`${this._n}.${s} nextCursor:${e} from remote.`),lt(t)))}getMutualFollowersList(e=""){const s="getMutualFollowersList";if(!this.canIUse(c.FOLLOW))return this.noUse(s);const o=e||this.FIRST_PAGE_INDEX;if(this._myMutualFollowersList.has(o)){var{resultList:t,nextCursor:n,lastUpdateTime:r}=this._myMutualFollowersList.get(o);if(Date.now()-r<this.MAX_CATCH_TIME&&0<t.length)return rt.l(`${this._n}.${s} nextCursor:${e} from local.`),dt({resultList:t,nextCursor:n})}return this._getFollowList(e,Ft.MUTUAL).then(t=>(this._myMutualFollowersList.set(o,{...t,lastUpdateTime:Date.now()}),rt.l(`${this._n}.${s} nextCursor:${e} from remote.`),lt(t)))}_getFollowList(t,e){const n=new Ut("_getFollowList");return n.setMessage(`nextCursor:${t} type:`+e),this.req({P:Lt,data:{fromAccount:this.getMyUserID(),count:this.DEFAULT_COUNT,nextCursor:t,type:e}}).then(t=>{n.end();const{resultList:e=[],nextCursor:s=""}=t.data,o=[];return e.forEach(t=>{var{userID:t,followTime:e,profileList:s=[]}=t;o.push({userID:t,followTime:e,...this._handleProfileItem(s)})}),{resultList:o,nextCursor:s}}).catch(t=>(n.setError(t).end(),rt.e(this._n+"._getFollowList failed. error:",t),pt(t)))}_handleProfileItem(t){const e={};return t.forEach(t=>{switch(t.tag){case D:e.nick=t.value;break;case N:e.gender=t.value;break;case v:e.birthday=t.value;break;case R:e.location=t.value;break;case b:e.selfSignature=t.value;break;case G:e.allowType=t.value;break;case x:e.language=t.value;break;case k:e.avatar=t.value;break;case $:e.messageSettings=t.value;break;case q:e.adminForbidType=t.value;break;case B:e.level=t.value;break;case W:e.role=t.value;break;default:e[t.tag]=t.value}}),e}getUserFollowInfo(t){if(!this.canIUse(c.FOLLOW))return this.noUse("getUserFollowInfo");let e=t,s=!1;z(t)&&(e=[this.getMyUserID()],s=!0);const n=this._n+".getUserFollowInfo",o=`userIDList:${e.length} isGetMyFollowInfo:`+s,r=new Ut("getUserFollowInfo");return r.setMessage(o),rt.l(n+" "+o),this.req({P:Mt,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then(t=>{r.end(),rt.l(n+" ok.");const{followInfoList:e=[]}=t.data,o=[];return e.forEach(t=>{var{followersCount:t,followingCount:e,mutualFollowersCount:s}=t;o.push({followersCount:t,followingCount:e,mutualFollowersCount:s})}),lt(o)}).catch(t=>(r.setError(t).end(),rt.e(n+" failed. error:",t),pt(t)))}checkFollowType(t){if(!this.canIUse(c.FOLLOW))return this.noUse("checkFollowType");100<t.length&&(t=t.slice(0,100),rt.w(s+" "+"the length of userIDList cannot exceed 100"));const s=this._n+".checkFollowType",e=`userIDList length:${t.length} `,o=new Ut("checkFollowType"),n=(o.setMessage(e),rt.l(s+" "+e),[]),r=[];return t.forEach(t=>{var e;this._followType.has(t)?(e=this._followType.get(t),n.push({userID:t,followType:e})):r.push(t)}),rt.l(`${s} from local count:${n.length}, from remote count:${r.length}.`),0===r.length?dt(n):this.req({P:yt,data:{fromAccount:this.getMyUserID(),userIDList:r}}).then(t=>{o.end(),rt.l(s+" ok.");const{resultList:e=[]}=t.data;return e.forEach(t=>{var{userID:t,followType:e}=t;this._setFollowType(t,e),n.push({userID:t,followType:e})}),lt(n)}).catch(t=>(o.setError(t).end(),rt.e(s+" failed. error:",t),pt(t)))}_setFollowType(t,e){this._followType.set(t,e)}_clearFollowList(t){if(z(t))return this._myFollowersList.clear(),this._myFollowingList.clear(),void this._myMutualFollowersList.clear();t!==Ft.FOLLOWERS?t!==Ft.FOLLOWING?t!==Ft.MUTUAL||this._myMutualFollowersList.clear():this._myFollowingList.clear():this._myFollowersList.clear()}reset(){rt.l(this._n+".reset"),this._clearFollowList(),this._followType.clear()}}export{Ct as default};
"use strict";const t=12,e=20,s=23,o=27;class n{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 i={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"}}},r={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19},l="CHINA",a={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(t=l){this.CURRENT=i.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",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},c={SEARCH_GRP_SNS:new n(0,Math.pow(2,1)).toString(),AV_HISTORY_MSG:new n(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new n(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new n(0,Math.pow(2,4)).toString(),AV_MBR_LIST:new n(0,Math.pow(2,6)).toString(),USER_STATUS:new n(0,Math.pow(2,7)).toString(),CONV_MARK:new n(0,Math.pow(2,9)).toString(),CONV_GROUP:new n(0,Math.pow(2,10)).toString(),AV_BAN_MBR:new n(0,Math.pow(2,11)).toString(),MSG_EXT:new n(0,Math.pow(2,13)).toString(),GRP_COUNTER:new n(0,Math.pow(2,15)).toString(),PLUGIN_TRANSLATE:new n(Math.pow(2,6)).toString(),PLUGIN_VOICE_TO_TEXT:new n(Math.pow(2,7)).toString(),PLUGIN_CS:new n(Math.pow(2,8)).toString(),PLUGIN_PUSH:new n(Math.pow(2,9)).toString(),PLUGIN_BOT:new n(Math.pow(2,10)).toString(),MSG_REACTION:new n(Math.pow(2,16)).toString(),FOLLOW:new n(Math.pow(2,20)).toString()},u=(a.HOST.setCurrent(l),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),h=(u&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),_="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),g="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),m="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,w="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,d=u&&"object"==typeof wx.miniapp,p=u||h||_||g||f||w||m,T=("undefined"!=typeof uni||"undefined"!=typeof window)&&!p,I=(h?qq:_?tt:g?swan:f?my:u?wx:w?uni:m&&jd,T&&window&&window.navigator&&window.navigator.userAgent||""),L=/(micromessenger|webbrowser)/i.test(I),M=/AppleWebKit\/([\d.]+)/i.exec(I),y=(M&&parseFloat(M.pop()),function(){let t="WEB";return L?t="WEB":h?t="QQ_MP":_?t="TT_MP":g?t="BAIDU_MP":f?t="ALI_MP":u?t=d?"DONUT_NATIVE_APP":"WX_MP":w&&(t="UNI_NATIVE_APP"),r[t]}()),A=(!function(){var t=I.match(/OS (\d+)_/i);t&&t[1]&&t[1]}(),function(){var t,e,s=I.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);s&&(t=s[1]&&parseFloat(s[1]),e=s[2]&&parseFloat(s[2]),t&&e&&parseFloat(s[1]+"."+s[2]))}(),function(){var t=I.match(/Chrome\/(\d+)/);t&&t[1]&&parseFloat(t[1])}(),/MSIE/.test(I)||-1<I.indexOf("Trident")&&-1<I.indexOf("rv:11.0"));let S,E;!function(){var t=/MSIE\s(\d+)\.\d/.exec(I),t=t&&parseFloat(t[1]);!t&&/Trident\/7.0/i.test(I)&&/rv:11.0/.test(I)}(),function(){var t=I.match(/TBS\/(\d+)/i);t&&t[1]&&t[1]}(),S="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const O=function(){},F=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let U=F.length;for(;U--;)E=F[U],console[E]||(S[E]=O);var C=S;const N=function(){return(new Date).getTime()+0},P="Tag_Profile_IM_Nick",D="Tag_Profile_IM_Gender",v="Tag_Profile_IM_BirthDay",R="Tag_Profile_IM_Location",b="Tag_Profile_IM_SelfSignature",G="Tag_Profile_IM_AllowType",x="Tag_Profile_IM_Language",k="Tag_Profile_IM_Image",$="Tag_Profile_IM_MsgSettings",q="Tag_Profile_IM_AdminForbidType",B="Tag_Profile_IM_Level",W="Tag_Profile_IM_Role",j=Object.prototype.hasOwnProperty,H=function(t){return"map"===Q(t)},V=function(t){return"set"===Q(t)},K=function(t){return"file"===Q(t)},X=function(t){return null!==t&&("number"==typeof t&&!isNaN(+t)||"object"==typeof t&&t.constructor===Number)},Y=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},z=function(t){return void 0===t},J=function(t){return e=t,("function"==typeof Array.isArray?Array.isArray(e):"array"===Q(e))||null!==t&&"object"==typeof t;var e},Q=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()},Z=(Date.now||(Date.now=function(){return(new Date).getTime()}),"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),et=Z.length;function st(){return!A&&!p}let ot=0;function nt(){return st()?"%c Chat %c":"Chat"}function it(){const t=function(){const t=new Date;return t.setTime(N()),t}();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 rt={arguments2String(s){let o="";if(1===s.length)o=s[0];else for(let t=0,e=s.length;t<e;t++)J(s[t])?s[t]instanceof Error?o+=(n=s[t],JSON.stringify(n,["message","code"])):o+=JSON.stringify(s[t]):o+=s[t],o+=" ";var n;return o},_exec(t,e){st()?C[t](nt(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",it(),e):C[t](`${nt()} ${it()} `+e)},d:function(){var t;ot<=-1&&(t=this.arguments2String(arguments),this._exec("debug",t))},l:function(){var t;ot<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},log:function(){var t;ot<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},i:function(){var t;ot<=1&&(t=this.arguments2String(arguments),this._exec("info",t))},w:function(){var t;ot<=2&&(t=this.arguments2String(arguments),this._exec("warn",t))},e:function(){var t;ot<=3&&(t=this.arguments2String(arguments),this._exec("error",t))},setLevel:function(t){t<4&&this._exec("log","set level from "+ot+" to "+t),ot=t},getLevel:function(){return ot}},lt=function(t){return{code:0,data:t||{}}};class at extends Error{constructor(t){super();var{code:t,message:e,data:s}=t;this.code=t,e?this.message=e:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=s||{}}}const ct=2805,ut=2903,ht=3122,_t="onMyFollowersListUpdated",gt="onMyFollowingListUpdated",ft="onMutualFollowersListUpdated",mt="error";let wt=null;const dt=function(t){return Promise.resolve(lt(t))},pt=function(t,e=!1){if(t instanceof at)return e&&null!==wt&&wt.emit(mt,t),Promise.reject(t);if(t instanceof Error){const t=new at({code:ut});return e&&null!==wt&&wt.emit(mt,t),Promise.reject(t)}if(z(t)||z(t.code))return Promise.reject(new at({code:ut}));t=new at(t);return e&&null!==wt&&wt.emit(mt,t),Promise.reject(t)},Tt="follow_add",It="follow_delete",Lt="follow_get",Mt="follow_get_info",yt="follow_check",At={info:4,warning:5,error:6},St={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},Et={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16};class Ot{constructor(t){this._n="SSOLogData",this.eventType=Et[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=N()}static bindEventStatModule(t){Ot.prototype._eventStatModule=t}static bindNetMonitorModule(t){Ot.prototype._netMonitorModule=t}updateTimeStamp(){this.timestamp=N()}start(t){return this._startts=t,this}end(t=!1){if(!this._sentFlag){if(this._netMonitorModule){const t=this._netMonitorModule.getNetworkType();this.setNetworkType(t)}var e=N();0===this.costTime&&(this.costTime=e-this._startts),this.setMoreMessage(`startts:${this._startts} endts:`+e),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout(()=>{this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)},0)}}setError(t){if(!(t instanceof Error))return rt.w(this._n+".setError value not instanceof Error, please check!"),this;if(this._sentFlag)return this;let e=!0;if(e=this._netMonitorModule?this._netMonitorModule.isOnline():e)t.code&&this.setCode(t.code),t.message&&this.setMoreMessage(t.message);else{const t=ct;this.setCode(t)}return this.setLevel("error"),this}setCode(t){return z(t)||this._sentFlag||("ECONNABORTED"===t&&(this.code=103),X(t)?this.code=t:rt.w(this._n+".setCode value not a number, please check!",t,typeof t)),this}setMessage(t){return z(t)||this._sentFlag||(X(t)&&(this.message=t.toString()),"string"==typeof t&&(this.message=t)),this}setCostTime(t){return this.costTime=t,this}setLevel(t){return z(t)||this._sentFlag||(this.level=At[t]),this}setMoreMessage(t){return function(t){if(null==t)return 1;if("boolean"!=typeof t){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(Y(t)){for(const e in t)if(j.call(t,e))return;return 1}return(H(t)||V(t)||K(t))&&0===t.size}}(this.moreMessage)?this.moreMessage=""+t:this.moreMessage+=" "+t,this}setNetworkType(t){return z(t)?rt.w(this._n+".setNetworkType value is undefined, please check!"):(t=St[t.toLowerCase()],z(t)||(this.networkType=t)),this}getStartTs(){return this._startts}setUIPlatform(t){return this.uiPlatform=t,this}setExtension(t){return this.extension=t,this}setEventType(t){return this.eventType=t,this}}const Ft={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"},Ut={NONE:0,FOLLOWERS:1,FOLLOWING:2,MUTUAL:3};class Ct extends class{constructor(t){this._m=t,this._n=""}isLoggedIn(){return this._m.get(t).isLoggedIn()}isOversea(){return this._m.get(t).isOversea()}isPrivateNetWork(){return this._m.get(t).isPrivateNetWork()}getFileDownloadProxy(){return this._m.get(t).getFileDownloadProxy()}getMyUserID(){return this._m.get(t).getUserID()}getMyTinyID(){return this._m.get(t).getTinyID()}getSDKAppID(){return this._m.get(t).getSDKAppID()}isIntl(){return this._m.get(t).isIntl()}isUsingChatCore(){return this._m.get(t).isUsingChatCore()}isDevMode(){return this._m.get(t).isDevMode()}get(t){return this._m.get(t)}getPlatform(){return y}getCloudConfig(t){return this._m.get(s).getCloudConfig(t)}emitOEvt(t,e){this._m.getOEmitInst().emit(t,e)}emitIEvt(t,e){this._m.getIEmitInst().emit(t,e)}getIEmitInst(){return this._m.getIEmitInst()}generateTjgID(e){return this._m.get(t).getTinyID()+"-"+e.random}req(t){return this._m.get(e).req(t)}canIUse(t){return this._m.get(o).canIUse(t)}getErrMsg(t,e,s){return this._m.getErrMsg(t,e,s)}warn(t,e,s){t=this.getErrMsg(t,e,s);t&&rt.w(t)}noUse(t){var e=ht;return pt({code:e,message:this.getErrMsg(e,t)})}}{constructor(t){super(t),this._n="FollowModule",this._myFollowersList=new Map,this._myFollowingList=new Map,this._myMutualFollowersList=new Map,this._followType=new Map,this.MAX_CATCH_TIME=6e5,this.FIRST_PAGE_INDEX=function(){let e="";for(let t=32;0<t;--t)e+=Z[Math.floor(Math.random()*et)];return e}(),this.DEFAULT_COUNT=500,this.MAX_COUNT=1e3,this.getIEmitInst().on(Ft.CLOUD_CONFIG,this._onCloudConfig,this)}_onCloudConfig(){var t=this.getCloudConfig("follow_req_count");z(t)||(t=Number(t),this.DEFAULT_COUNT=t>this.MAX_COUNT?this.MAX_COUNT:t,this._clearFollowList())}clearCacheOnReconnected(){this._clearFollowList(),this._followType.clear()}onFollowInfoNotify(t){var{followAddList:t=[],followDeleteList:e=[],pushType:s}=t.dataList||{},o=this._initFollowInfo();1===s?this._handleFollowAddList({followAddList:t,followInfo:o}):this._handleFollowDeleteList({followDeleteList:e,followInfo:o}),this._emitEvent(o),rt.l(`${this._n}.onFollowInfoNotify pushType:${s} followAddList:${t.length} followDeleteList:`+e.length)}_initFollowInfo(){const e={};return Object.values(Ut).forEach(t=>{t!==Ut.NONE&&(e[t]={userInfoList:[],isAdd:!1})}),e}_handleFollowAddList(t){const{followAddList:e,followInfo:o}=t;e.forEach(t=>{const{followTypeList:e=[],...s}=t;e.forEach(t=>{o[t].userInfoList.push(s),o[t].isAdd=!0}),this._setFollowType(t.userID,t.followType)})}_handleFollowDeleteList(t){const{followDeleteList:e,followInfo:o}=t;e.forEach(t=>{const{followTypeList:e=[],userID:s}=t;e.forEach(t=>{o[t].userInfoList.push(s),o[t].isAdd=!1}),this._setFollowType(t.userID,t.followType)})}_emitEvent(s){Object.keys(s).forEach(t=>{var t=Number(t),e=s[t];0<e.userInfoList.length&&(t===Ut.FOLLOWERS&&(this._clearFollowList(Ut.FOLLOWERS),this.emitOEvt(_t,e)),t===Ut.FOLLOWING&&(this._clearFollowList(Ut.FOLLOWING),this.emitOEvt(gt,e)),t===Ut.MUTUAL&&(this._clearFollowList(Ut.MUTUAL),this.emitOEvt(ft,e)))})}followUser(t){if(!this.canIUse(c.FOLLOW))return this.noUse("followUser");const e=this._n+".followUser",s="userIDList:"+t.length,o=new Ot("followUser");return o.setMessage(s),rt.l(e+" "+s),this.req({P:Tt,data:{fromAccount:this.getMyUserID(),userIDList:t.map(t=>({userID:t}))}}).then(t=>(o.end(),rt.l(e+" ok."),lt(t.data.resultList))).catch(t=>(o.setError(t).end(),rt.e(e+" failed. error:",t),pt(t)))}unfollowUser(t){if(!this.canIUse(c.FOLLOW))return this.noUse("unfollowUser");const e=this._n+".unfollowUser",s="userIDList:"+t.length,o=new Ot("unfollowUser");return o.setMessage(s),rt.l(e+" "+s),this.req({P:It,data:{fromAccount:this.getMyUserID(),userIDList:t}}).then(t=>(o.end(),rt.l(e+" ok."),lt(t.data.resultList))).catch(t=>(o.setError(t).end(),rt.e(e+" failed. error:",t),pt(t)))}getMyFollowersList(e=""){const s="getMyFollowersList";if(!this.canIUse(c.FOLLOW))return this.noUse(s);const o=e||this.FIRST_PAGE_INDEX;if(this._myFollowersList.has(o)){var{resultList:t,nextCursor:n,lastUpdateTime:r}=this._myFollowersList.get(o);if(Date.now()-r<this.MAX_CATCH_TIME&&0<t.length)return rt.l(`${this._n}.${s} nextCursor:${e} from local.`),dt({resultList:t,nextCursor:n})}return this._getFollowList(e,Ut.FOLLOWERS).then(t=>(this._myFollowersList.set(o,{...t,lastUpdateTime:Date.now()}),rt.l(`${this._n}.${s} nextCursor:${e} from remote.`),lt(t)))}getMyFollowingList(e=""){const s="getMyFollowingList";if(!this.canIUse(c.FOLLOW))return this.noUse(s);const o=e||this.FIRST_PAGE_INDEX;if(this._myFollowingList.has(o)){var{resultList:t,nextCursor:n,lastUpdateTime:r}=this._myFollowingList.get(o);if(Date.now()-r<this.MAX_CATCH_TIME&&0<t.length)return rt.l(`${this._n}.${s} nextCursor:${e} from local.`),dt({resultList:t,nextCursor:n})}return this._getFollowList(e,Ut.FOLLOWING).then(t=>(this._myFollowingList.set(o,{...t,lastUpdateTime:Date.now()}),rt.l(`${this._n}.${s} nextCursor:${e} from remote.`),lt(t)))}getMutualFollowersList(e=""){const s="getMutualFollowersList";if(!this.canIUse(c.FOLLOW))return this.noUse(s);const o=e||this.FIRST_PAGE_INDEX;if(this._myMutualFollowersList.has(o)){var{resultList:t,nextCursor:n,lastUpdateTime:r}=this._myMutualFollowersList.get(o);if(Date.now()-r<this.MAX_CATCH_TIME&&0<t.length)return rt.l(`${this._n}.${s} nextCursor:${e} from local.`),dt({resultList:t,nextCursor:n})}return this._getFollowList(e,Ut.MUTUAL).then(t=>(this._myMutualFollowersList.set(o,{...t,lastUpdateTime:Date.now()}),rt.l(`${this._n}.${s} nextCursor:${e} from remote.`),lt(t)))}_getFollowList(t,e){const n=new Ot("_getFollowList");return n.setMessage(`nextCursor:${t} type:`+e),this.req({P:Lt,data:{fromAccount:this.getMyUserID(),count:this.DEFAULT_COUNT,nextCursor:t,type:e}}).then(t=>{n.end();const{resultList:e=[],nextCursor:s=""}=t.data,o=[];return e.forEach(t=>{var{userID:t,followTime:e,profileList:s=[]}=t;o.push({userID:t,followTime:e,...this._handleProfileItem(s)})}),{resultList:o,nextCursor:s}}).catch(t=>(n.setError(t).end(),rt.e(this._n+"._getFollowList failed. error:",t),pt(t)))}_handleProfileItem(t){const e={};return t.forEach(t=>{switch(t.tag){case P:e.nick=t.value;break;case D:e.gender=t.value;break;case v:e.birthday=t.value;break;case R:e.location=t.value;break;case b:e.selfSignature=t.value;break;case G:e.allowType=t.value;break;case x:e.language=t.value;break;case k:e.avatar=t.value;break;case $:e.messageSettings=t.value;break;case q:e.adminForbidType=t.value;break;case B:e.level=t.value;break;case W:e.role=t.value;break;default:e[t.tag]=t.value}}),e}getUserFollowInfo(t){if(!this.canIUse(c.FOLLOW))return this.noUse("getUserFollowInfo");let e=t,s=!1;z(t)&&(e=[this.getMyUserID()],s=!0);const n=this._n+".getUserFollowInfo",o=`userIDList:${e.length} isGetMyFollowInfo:`+s,r=new Ot("getUserFollowInfo");return r.setMessage(o),rt.l(n+" "+o),this.req({P:Mt,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then(t=>{r.end(),rt.l(n+" ok.");const{followInfoList:e=[]}=t.data,o=[];return e.forEach(t=>{var{followersCount:t,followingCount:e,mutualFollowersCount:s}=t;o.push({followersCount:t,followingCount:e,mutualFollowersCount:s})}),lt(o)}).catch(t=>(r.setError(t).end(),rt.e(n+" failed. error:",t),pt(t)))}checkFollowType(t){if(!this.canIUse(c.FOLLOW))return this.noUse("checkFollowType");100<t.length&&(t=t.slice(0,100),rt.w(s+" "+"the length of userIDList cannot exceed 100"));const s=this._n+".checkFollowType",e=`userIDList length:${t.length} `,o=new Ot("checkFollowType"),n=(o.setMessage(e),rt.l(s+" "+e),[]),r=[];return t.forEach(t=>{var e;this._followType.has(t)?(e=this._followType.get(t),n.push({userID:t,followType:e})):r.push(t)}),rt.l(`${s} from local count:${n.length}, from remote count:${r.length}.`),0===r.length?dt(n):this.req({P:yt,data:{fromAccount:this.getMyUserID(),userIDList:r}}).then(t=>{o.end(),rt.l(s+" ok.");const{resultList:e=[]}=t.data;return e.forEach(t=>{var{userID:t,followType:e}=t;this._setFollowType(t,e),n.push({userID:t,followType:e})}),lt(n)}).catch(t=>(o.setError(t).end(),rt.e(s+" failed. error:",t),pt(t)))}_setFollowType(t,e){this._followType.set(t,e)}_clearFollowList(t){if(z(t))return this._myFollowersList.clear(),this._myFollowingList.clear(),void this._myMutualFollowersList.clear();t!==Ut.FOLLOWERS?t!==Ut.FOLLOWING?t!==Ut.MUTUAL||this._myMutualFollowersList.clear():this._myFollowingList.clear():this._myFollowersList.clear()}reset(){rt.l(this._n+".reset"),this._clearFollowList(),this._followType.clear()}}export{Ct as default};

@@ -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 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,DONUT_NATIVE_APP:19},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",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},p=(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(),new a(Math.pow(2,20)).toString(),"sns"),h=(l.HOST.setCurrent(c),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),_=(h&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),m="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),g="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),y="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,I="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,A=h&&"object"==typeof wx.miniapp,w=h||_||m||f||g||I||y,D=("undefined"!=typeof uni||"undefined"!=typeof window)&&!w,M=(_?qq:m?tt:f?swan:g?my:h?wx:I?uni:y&&jd,D&&window&&window.navigator&&window.navigator.userAgent||""),T=/(micromessenger|webbrowser)/i.test(M),L=/AppleWebKit\/([\d.]+)/i.exec(M),S=(L&&parseFloat(L.pop()),function(){let e="WEB";return T?e="WEB":_?e="QQ_MP":m?e="TT_MP":f?e="BAIDU_MP":g?e="ALI_MP":h?e=A?"DONUT_NATIVE_APP":"WX_MP":I&&(e="UNI_NATIVE_APP"),u[e]}()),F=(!function(){var e=M.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),function(){var e,t,s=M.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);s&&(e=s[1]&&parseFloat(s[1]),t=s[2]&&parseFloat(s[2]),e&&t&&parseFloat(s[1]+"."+s[2]))}(),function(){var e=M.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),/MSIE/.test(M)||-1<M.indexOf("Trident")&&-1<M.indexOf("rv:11.0")),E=(!function(){var e=/MSIE\s(\d+)\.\d/.exec(M),e=e&&parseFloat(e[1]);!e&&/Trident\/7.0/i.test(M)&&/rv:11.0/.test(M)}(),function(){var e=M.match(/TBS\/(\d+)/i);e&&e[1]&&e[1]}(),"C2C"),k="AllowType_Type_AllowAny",v="AdminForbid_Type_None",b="Add_Type_Single",P="Add_Type_Both",U="Delete_Type_Single",C="Delete_Type_Both",N="Pendency_Type_Both",G="Pendency_Type_ComeIn",O="Pendency_Type_SendOut",$="Response_Action_Agree",R="Response_Action_AgreeAndAdd",q="CheckResult_Type_Both",x="CheckResult_Type_Single",H=function(){return(new Date).getTime()+0},B="Tag_Profile_IM_Nick",j="Tag_Profile_IM_Gender",W="Tag_Profile_IM_BirthDay",K="Tag_Profile_IM_Location",Y="Tag_Profile_IM_SelfSignature",J="Tag_Profile_IM_AllowType",V="Tag_Profile_IM_Language",z="Tag_Profile_IM_Image",Q="Tag_Profile_IM_MsgSettings",X="Tag_Profile_IM_AdminForbidType",Z="Tag_Profile_IM_Level",ee="Tag_Profile_IM_Role",te={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"},se="Gender_Type_",ie={UNKNOWN:se+"Unknown",FEMALE:se+"Female",MALE:se+"Male"},re={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},ne={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},oe=Object.prototype.hasOwnProperty;function ae(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(he(e)){for(const t in e)if(oe.call(e,t))return!1;return!0}return!!(de(e)||ue(e)||ce(e))&&0===e.size}const de=function(e){return"map"===ge(e)},ue=function(e){return"set"===ge(e)},ce=function(e){return"file"===ge(e)},le=function(e){return null!==e&&("number"==typeof e&&!isNaN(+e)||"object"==typeof e&&e.constructor===Number)},pe=function(e){return"string"==typeof e},he=function(e){if("object"!=typeof e||null===e)return!1;e=Object.getPrototypeOf(e);if(null===e)return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t},_e=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===ge(e)},me=function(e){return void 0===e},fe=function(e){return e instanceof Error},ge=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},ye=(Date.now||(Date.now=function(){return(new Date).getTime()}),function(e){if(0===e.length)return 0;let t=0,s=0,i;for(var r="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)i=e[t++].charCodeAt[t]<=255?1:!1===r?3:2,s+=i;return s}),Ie=function(e,t){for(const s in e)if(e[s]===t)return!0;return!1};function Ae(){return!F&&!w}let we=0;function De(){return Ae()?"%c Chat %c":"Chat"}function Me(){const e=function(){const e=new Date;return e.setTime(H()),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 Te={arguments2String(s){let i="";if(1===s.length)i=s[0];else for(let e=0,t=s.length;e<t;e++)r=s[e],_e(r)||null!==r&&"object"==typeof r?fe(s[e])?i+=(r=s[e],JSON.stringify(r,["message","code"])):i+=JSON.stringify(s[e]):i+=s[e],i+=" ";var r;return i},_exec(e,t){Ae()?o[e](De(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",Me(),t):o[e](`${De()} ${Me()} `+t)},d:function(){var e;we<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;we<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;we<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;we<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;we<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;we<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+we+" to "+e),we=e},getLevel:function(){return we}};class Le{constructor(e){ae(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 Se=function(e){return{code:0,data:e||{}}};class Fe extends Error{constructor(e){super();var{code:e,message:t,data:s}=e;this.code=e,t?this.message=t:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=s||{}}}const Ee=2700,ke=2701,ve=2710,be=2711,Pe=2716,Ue=2805,Ce=2903,Ne=3122,Ge=3123,Oe="onFriendListUpdated",$e="onFriendGroupListUpdated",Re="onFriendApplicationListUpdated",qe="error";let xe=null;const He=function(e){return Promise.resolve(Se(e))},Be=function(e,t=!1){if(e instanceof Fe)return t&&null!==xe&&xe.emit(qe,e),Promise.reject(e);if(e instanceof Error){const e=new Fe({code:Ce});return t&&null!==xe&&xe.emit(qe,e),Promise.reject(e)}if(me(e)||me(e.code))return Promise.reject(new Fe({code:Ce}));e=new Fe(e);return t&&null!==xe&&xe.emit(qe,e),Promise.reject(e)},je="friend_get",We="friend_get_specified",Ke="friend_check",Ye="friend_delete",Je="friend_add",Ve="friend_update",ze="friend_response",Qe="pendency_get",Xe="pendency_delete",Ze="pendency_report",et="group_get",st="group_add",it="group_delete",rt="group_update",nt={info:4,warning:5,error:6},ot={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},at={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16};class dt{constructor(e){this._n="SSOLogData",this.eventType=at[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=H()}static bindEventStatModule(e){dt.prototype._eventStatModule=e}static bindNetMonitorModule(e){dt.prototype._netMonitorModule=e}updateTimeStamp(){this.timestamp=H()}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=H();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 Te.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=Ue;this.setCode(e)}return this.setLevel("error"),this}setCode(e){return me(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),le(e)?this.code=e:Te.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return me(e)||this._sentFlag||(le(e)&&(this.message=e.toString()),pe(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return me(e)||this._sentFlag||(this.level=nt[e]),this}setMoreMessage(e){return ae(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){return me(e)?Te.w(this._n+".setNetworkType value is undefined, please check!"):(e=ot[e.toLowerCase()],me(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 ut{constructor(e){this._snsM=e,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSeq=0,this._map=new Map,this._unreadCount=0}getLocalApplicationList(){return{friendApplicationList:[...this._map.values()],unreadCount:this._unreadCount}}_onApplicationListUpdated(){this._snsM.emitOEvt(Re,{friendApplicationList:[...this._map.values()],unreadCount:this._unreadCount})}onApplicationRead(){this._unreadCount=0,this._onApplicationListUpdated()}onApplicationAdded(e,t){if(!ae(e)){let s,i=(s=t===this._snsM.getMyUserID()?O:G,!1);e.forEach(e=>{var t=e.userID+"_"+s;s!==G||this._map.has(t)||(this._unreadCount+=1),this._map.set(t,new Le({...e,type:s})),i=!0}),i&&this._onApplicationListUpdated()}}onApplicationDeleted(e){ae(e)||(this._startTime=0,this._currentSeq=0,this.getApplicationList())}getApplicationList(){const n=this._n+".getApplicationList",o=new dt("getApplicationList");return this._snsM.req({P:Qe,data:{applicationType:N,fromAccount:this._snsM.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSeq}}).then(e=>{const{resultList:t,unreadCount:s,startTime:i,currentSequence:r}=e.data;this._startTime=i,this._currentSeq=r,this._unreadCount=s;e=`applicationCount:${_e(t)?t.length:0} unreadCount:${s} startTime:${i} currentSequence:`+r;o.setMessage(e).end(),Te.i(n+" ok. "+e),this._map.clear(),_e(t)&&t.forEach(e=>{var{userID:t,type:s}=e,e=new Le(e);this._map.set(t+"_"+s,e)}),this._onApplicationListUpdated()}).catch(e=>(o.setError(e).end(),Te.w(n+" failed. error:",e),Be(e)))}deleteApplication(e){const r=this._n+".deleteApplication",{userID:n,type:t}=e;let o=t;if(o&&(o===O||o===G)||(o=G),!this._map.has(n+"_"+o))return Be({code:Pe});const a=new dt("deleteApplication");return a.setMessage(`userID:${n} type:`+o),this._snsM.req({P:Xe,data:{fromAccount:this._snsM.getMyUserID(),userIDList:[n],type:o}}).then(e=>{var e=e.data["resultList"],{to:t,resultCode:s,resultInfo:i}=e[0];return a.setMoreMessage("resultList:"+JSON.stringify(e)).end(),Te.i(r+` ok. userID:${n} type:`+o),0===s?Se():Be({userID:t,code:s,message:i})}).catch(e=>(a.setError(e).end(),Te.w(r+" failed. error:",e),Be(e)))}acceptApplication(e){const s=this._n+".acceptApplication",{userID:i,remark:t,tag:r,type:n}=e;let o=n;o&&(o===$||o===R)||(o=R);const a=new dt("acceptApplication");return a.setMessage(`userID:${i} type:`+o),this._snsM.req({P:ze,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:i,remark:t,tag:r,action:o}]}}).then(e=>{a.end();var e=e.data["resultList"],{resultCode:e,resultInfo:t}=e[0];if(0!==e)return Be({code:e,message:t});Te.i(s+` ok. userID:${i} type:`+o)}).catch(e=>(a.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}refuseApplication(e){const s=this._n+".refuseApplication",i=e["userID"],r=new dt("refuseApplication");return r.setMessage("userID:"+i),this._snsM.req({P:ze,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:i,action:"Response_Action_Reject"}]}}).then(e=>{r.end();var e=e.data["resultList"],{resultCode:e,resultInfo:t}=e[0];if(0!==e)return Be({code:e,message:t});Te.i(s+" ok. userID:"+i)}).catch(e=>(r.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}setApplicationRead(){const t=this._n+".setApplicationRead",s=new dt("setApplicationRead");var e;return this._snsM.req({P:Ze,data:{fromAccount:this._snsM.getMyUserID(),latestTimeStamp:(e=H()/1e3,Math.round(Number(e)*Math.pow(10,0))/Math.pow(10,0))}}).then(e=>{s.end(),Te.i(t+" ok"),this._unreadCount=0}).catch(e=>(s.setError(e).end(),Te.w(t+" failed. error:",e),Be(e)))}reset(){this._maxLimited=100,this._currentSeq=0,this._unreadCount=0,this._map.clear()}}class ct{constructor(e){ae(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||k,this.language=e.language||0,this.avatar=e.avatar||"",this.messageSettings=e.messageSettings||0,this.adminForbidType=e.adminForbidType||v,this.level=e.level||0,this.role=e.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],ae(e.profileCustomField)||e.profileCustomField.forEach(e=>{this.profileCustomField.push({key:e.key,value:e.value})}))}validate(s){let i=!0,e="";if(ae(s))return{valid:!1,tips:"empty options"};if(s.profileCustomField){const i=s.profileCustomField.length;let t=null;for(let e=0;e<i;e++){if(t=s.profileCustomField[e],!pe(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(!pe(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 s)if(Object.prototype.hasOwnProperty.call(s,t)){if("profileCustomField"===t)continue;if(ae(s[t])&&!pe(s[t])&&!le(s[t])){e="key:"+t+", invalid value:"+s[t],i=!1;continue}switch(t){case"nick":pe(s[t])||(e="nick must be a string",i=!1),500<ye(s[t])&&(e=`nick name limited: must less than or equal to 500 bytes, current size: ${ye(s[t])} bytes`,i=!1);break;case"gender":Ie(ie,s.gender)||(e="key:gender, invalid value:"+s.gender,i=!1);break;case"birthday":le(s.birthday)||(e="birthday must be a number",i=!1);break;case"location":pe(s.location)||(e="location must be a string",i=!1);break;case"selfSignature":pe(s.selfSignature)||(e="selfSignature must be a string",i=!1);break;case"allowType":Ie(ne,s.allowType)||(e="key:allowType, invalid value:"+s.allowType,i=!1);break;case"language":le(s.language)||(e="language must be a number",i=!1);break;case"avatar":pe(s.avatar)||(e="avatar must be a string",i=!1);break;case"messageSettings":0!==s.messageSettings&&1!==s.messageSettings&&(e="messageSettings must be 0 or 1",i=!1);break;case"adminForbidType":Ie(re,s.adminForbidType)||(e="key:adminForbidType, invalid value:"+s.adminForbidType,i=!1);break;case"level":le(s.level)||(e="level must be a number",i=!1);break;case"role":le(s.role)||(e="role must be a number",i=!1);break;default:e="unknown key:"+t+" "+s[t],i=!1}}return{valid:i,tips:e}}}class lt{constructor(e,r){this.userID=e,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;const n={},o=[];if(n.userID=e,!ae(r)){let s="",i;for(let e=0,t=r.length;e<t;e++)if(s=r[e].tag,i=r[e].value,-1<s.indexOf("Tag_SNS_Custom"))this.friendCustomField.push({key:s,value:i});else if(-1<s.indexOf("Tag_Profile_Custom"))o.push({key:s,value:i});else switch(s){case B:n.nick=i;break;case j:n.gender=i;break;case W:n.birthday=i;break;case K:n.location=i;break;case Y:n.selfSignature=i;break;case J:n.allowType=i;break;case V:n.language=i;break;case z:n.avatar=i;break;case Q:n.messageSettings=i;break;case X:n.adminForbidType=i;break;case Z:n.level=i;break;case ee:n.role=i;break;case te.REMARK:this.remark=i;break;case te.ADDTIME:this.addTime=i;break;case te.GROUP:this.groupList=JSON.parse(JSON.stringify(i));break;case te.ADDSOURCE:this.source=i;break;case te.ADDWORDING:break;default:Te.l("snsProfileItem unknown tag->",r[e].tag)}}this.profile=new ct({...n,profileCustomField:o})}validate(s){let i=!0,e="";if(ae(s))return{valid:!1,tips:"empty options"};if(s.profileCustomField){const i=s.profileCustomField.length;let t=null;for(let e=0;e<i;e++){if(t=s.profileCustomField[e],!pe(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(!pe(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 s)if(Object.prototype.hasOwnProperty.call(s,t)){if("profileCustomField"===t)continue;if(ae(s[t])&&!pe(s[t])&&!le(s[t])){e="key:"+t+", invalid value:"+s[t],i=!1;continue}switch(t){case"nick":pe(s[t])||(e="nick must be a string",i=!1),500<ye(s[t])&&(e=`nick name limited: must less than or equal to 500 bytes, current size: ${ye(s[t])} bytes`,i=!1);break;case"gender":Ie(ie,s.gender)||(e="key:gender, invalid value:"+s.gender,i=!1);break;case"birthday":le(s.birthday)||(e="birthday must be a number",i=!1);break;case"location":pe(s.location)||(e="location must be a string",i=!1);break;case"selfSignature":pe(s.selfSignature)||(e="selfSignature must be a string",i=!1);break;case"allowType":Ie(ne,s.allowType)||(e="key:allowType, invalid value:"+s.allowType,i=!1);break;case"language":le(s.language)||(e="language must be a number",i=!1);break;case"avatar":pe(s.avatar)||(e="avatar must be a string",i=!1);break;case"messageSettings":0!==s.messageSettings&&1!==s.messageSettings&&(e="messageSettings must be 0 or 1",i=!1);break;case"adminForbidType":Ie(re,s.adminForbidType)||(e="key:adminForbidType, invalid value:"+s.adminForbidType,i=!1);break;case"level":le(s.level)||(e="level must be a number",i=!1);break;case"role":le(s.role)||(e="role must be a number",i=!1);break;default:e="unknown key:"+t+" "+s[t],i=!1}}return{valid:i,tips:e}}update(s){let i="",r;const n=[];this.friendCustomField.forEach(e=>{n.push(e.key)});for(let e=0,t=s.length;e<t;e++)if(i=s[e].tag,r=s[e].value,-1<i.indexOf("Tag_SNS_Custom"))-1<n.indexOf(i)?this.friendCustomField.forEach(e=>{e.key===i&&(e.value=r)}):this.friendCustomField.push({key:i,value:r});else if(-1<i.indexOf("Tag_Profile_Custom")){let t=!1;this.profile.profileCustomField.forEach(e=>{e.key===i&&(e.value=r,t=!0)}),t||this.profile.profileCustomField.push({key:i,value:r})}else switch(i){case B:this.profile.nick=r;break;case j:this.profile.gender=r;break;case W:this.profile.birthday=r;break;case K:this.profile.location=r;break;case Y:this.profile.selfSignature=r;break;case J:this.profile.allowType=r;break;case V:this.profile.language=r;break;case z:this.profile.avatar=r;break;case Q:this.profile.messageSettings=r;break;case X:this.profile.adminForbidType=r;break;case Z:this.profile.level=r;break;case ee:this.profile.role=r;break;case te.REMARK:this.remark=r;break;case te.ADDTIME:this.addTime=r;break;case te.GROUP:this.groupList=JSON.parse(JSON.stringify(r));break;case te.ADDSOURCE:this.source=r;break;case te.ADDWORDING:break;default:Te.d("snsProfileItem unkown tag->",s[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 pt=4,ht=11,_t=12,mt=20,ft=23,gt=27,yt=29;class It{constructor(e){this._snsM=e,this._n="FriendHandler",this._map=new Map,this._startIdx=0,this._standardSeq=0,this._customSeq=0,this._expirationTime=18e4}getLocalFriendList(){return[...this._map.values()]}getFriendRemark(e){return this._map.has(e)?this._map.get(e).remark:""}onFriendProfileModified(e){const t=e["dataList"];if(!ae(t)){const i=this._snsM.get(ht);t.forEach(e=>{var{userID:t,profileList:s}=e;if(this.isMyFriend(t)){Te.l(this._n+`.onFriendProfileModified. friend account:${t}, profileList:`+JSON.stringify(s));const e=this._map.get(t);e.update(s),i.modifyMessageSentByPeer({conversationID:""+E+t,latestNick:e.profile.nick,latestAvatar:e.profile.avatar})}}),this._onFriendListUpdated()}}onFriendAdded(t){0!==t.length&&(Te.l(this._n+".onFriendAdded userIDList:"+t),t.forEach(e=>{this._map.set(e,new lt(e))}),this.getFriendProfile({userIDList:t}).then(e=>{t.forEach(e=>{var t=this._map.get(e);0<t.groupList.length&&this._snsM.updateWhenFriendAdded({nameList:t.groupList,userID:e})}),this._onFriendListUpdated()}))}onFriendDeleted(e){0!==e.length&&(Te.l(this._n+".onFriendDeleted userIDList:"+e),e.forEach(e=>{var t=this._map.get(e);0<t.groupList.length&&this._snsM.updateWhenFriendDeleted({nameList:t.groupList,userID:e}),this._map.delete(e)}),this._onFriendListUpdated())}_onFriendListUpdated(){this._snsM.emitOEvt(Oe),this._snsM.get(ht).checkAndPatchRemark()}getFriendProfile(e){const s=this._n+".getFriendProfile",t=e["userIDList"],r=[],n=[],i=[];if(t.forEach(e=>{var t;this._map.has(e)?(t=this._map.get(e),Date.now()-t.timestamp<this._expirationTime?n.push(t):i.push(e)):r.push({userID:e,code:Ee,message:this._snsM.getErrMsg(Ee)})}),0===i.length)return Te.i(s+" newUserIDList is empty"),He({friendList:n,failureUserIDList:r});const o=new dt("getFriendProfile");return o.setMessage("userIDList:"+i),Te.i(s+" userIDList:"+i),this._snsM.req({P:We,data:{fromAccount:this._snsM.getMyUserID(),userIDList:i}}).then(e=>{o.end(),Te.i(s+" ok");const t=e.data["resultList"];return t.forEach(t=>{var{to:t,resultCode:e,resultInfo:s,tagValueList:i}=t;if(me(e)||0===e){let e;this._map.has(t)?(e=this._map.get(t)).update(i):(e=new lt(t,i),this._map.set(t,e)),n.push(e)}else r.push({userID:t,code:e,message:s})}),Se({friendList:n,failureUserIDList:r})}).catch(e=>(o.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}isMyFriend(e){return this._map.has(e)}pagingGetFriendList(){const a=this._n+".getFriendList",d=new dt("getFriendList"),u=Date.now();this._snsM.req({P:je,data:{fromAccount:this._snsM.getMyUserID(),startIndex:this._startIdx,standardSequence:this._standardSeq,customSequence:this._customSeq}}).then(e=>{const{friendCount:t,resultList:s,nextStartIndex:i,standardSequence:r,customSequence:n,completeFlag:o}=e.data;e=`friendCount:${t} nextStartIndex:${this._startIdx=i} standardSequence:${this._standardSeq=r} customSequence:${this._customSeq=n} completeFlag:${o} cost:`+(e=u,Date.now()-e+" ms");d.setMessage(e).end(),Te.i(a+" ok.",e),ae(s)||s.forEach(e=>{var{to:e,tagValueList:t}=e;this._map.set(e,new lt(e,t))}),0===o?this.pagingGetFriendList():(this._snsM.emitOEvt(Oe),this._pagingGetFriendProfile())}).catch(e=>(d.setError(e).end(),Te.w(a+" failed. error:",e),Be(e)))}_pagingGetFriendProfile(){const t=[...this._map.keys()],s=this._snsM.get(pt),e=t.length,i=e<=100?1:Math.ceil(e/100);Te.l(this._n+`._pagingGetFriendProfile friendCount:${e} pageCount:`+i);for(let e=0;e<i;e++)s.getUserProfile({userIDList:t.slice(100*e,100*(e+1))}).then(e=>{e.data.forEach(e=>{const t=this._map.get(e.userID);t&&t.updateProfile(e)}),this._onFriendListUpdated()})}addFriend(e){const i=this._n+".addFriend";if(this._map.has(e.to))return Be({code:ke});if(e.wording&&!1===this._snsM.filterProfanity("wording",e))return Be({code:Ge});var{to:e,source:t,type:s,wording:r,remark:n,groupName:o}=e;let a=s;a&&(a===b||a===P)||(a=P);const d=new dt("addFriend");return d.setMessage(`to:${e} source:${t} type:`+a),this._snsM.req({P:Je,data:{fromAccount:this._snsM.getMyUserID(),addFriendItem:[{to:e,source:t,wording:r,remark:n,groupName:o}],type:a}}).then(e=>{var e=e.data["resultList"],{to:e,resultCode:t,resultInfo:s}=(d.setMoreMessage("resultList:"+JSON.stringify(e)).end(),e[0]);return Te.i(i+` ok. to:${e} type:${a} code:`+t),me(t)||0===t?Se({userID:e,code:0}):30539===t?Se({userID:e,code:t,message:this._snsM.getErrMsg(t)}):Be({userID:e,code:t,message:this._snsM.getErrMsg(t)||s})}).catch(e=>(d.setError(e).end(),Te.w(i+" failed. error:",e),Be(e)))}deleteFriend(e){const s=this._n+".deleteFriend",{userIDList:t,type:i}=e;1e3<t.length&&(Te.w(s+" "+"the length of userIDList cannot exceed 1000"),t.length=1e3);const r=[],n=[],o=[];if(t.forEach(e=>{this._map.has(e)?o.push(e):r.push({userID:e,code:Ee,message:this._snsM.getErrMsg(Ee)})}),0===o.length)return He({successUserIDList:n,failureUserIDList:r});let a=i;a&&(a===U||a===C)||(a=C);const d=new dt("deleteFriend");return d.setMessage(`userIDList:${o} type:`+a),this._snsM.req({P:Ye,data:{fromAccount:this._snsM.getMyUserID(),userIDList:o,type:a}}).then(e=>{d.end(),Te.i(s+" ok");const t=e.data["resultList"];return ae(t)||t.forEach(e=>{var{to:e,resultCode:t,resultInfo:s}=e;me(t)||0===t?n.push({userID:e}):r.push({userID:e,code:t,message:s})}),Se({successUserIDList:n,failureUserIDList:r})}).catch(e=>(d.setError(e).end(),Te.w(s+" error:",e),Be(e)))}updateFriend(e){const{userID:t,remark:i,friendCustomField:n}=e;if(!this._map.has(t))return Be({code:Ee});const o=this._n+".updateFriend",a=new dt("updateFriend"),s=(a.setMessage(`userID:${t} remark:${i} friendCustomField:`+n),[]);return me(i)||s.push({tag:te.REMARK,value:i}),_e(n)&&0<n.length&&n.forEach(e=>{s.push({tag:e.key,value:e.value})}),this._snsM.req({P:Ve,data:{fromAccount:this._snsM.getMyUserID(),updateItem:[{to:t,snsItem:s}]}}).then(e=>{a.end(),Te.i(o+" ok");var e=e.data["resultList"],{to:t,resultCode:e,resultInfo:s}=e[0];if(me(e)||0===e){const e=this._map.get(t);if(e){me(i)||(e.remark=i);if(_e(n)&&0<n.length){var r=e.friendCustomField;t=n;if(_e(r)&&_e(t)){let i=!1;t.forEach(({key:t,value:e})=>{const s=r.find(e=>e.key===t);s?s.value!==e&&(s.value=e,i=!0):(r.push({key:t,value:e}),i=!0)})}}this._onFriendListUpdated()}return Se(e)}return Be({code:e,message:s})}).catch(e=>(a.setError(e).end(),Te.w(o+" failed. error:",e),Be(e)))}checkFriend(e){const s=this._n+".checkFriend",{userIDList:i,type:t}=e;let o=t;o&&(o===x||o===q)||(o=q);const a=new dt("checkFriend");return a.setMessage(`userIDList:${i} type:`+o),this._snsM.req({P:Ke,data:{fromAccount:this._snsM.getMyUserID(),userIDList:i,type:o}}).then(e=>{a.end(),Te.i(s+` ok. userIDList:${i} type:`+o);const r=[],n=[],t=e.data["resultList"];return _e(t)&&t.forEach(e=>{var{to:e,relation:t,resultCode:s,resultInfo:i}=e;me(s)||0===s?r.push({userID:e,code:0,relation:t}):n.push({userID:e,code:s,message:i})}),Se({successUserIDList:r,failureUserIDList:n})}).catch(e=>(a.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}onAddedToFriendGroup(e){const{name:t,userIDList:s}=e;Te.l(`${this._n}.onAddedToFriendGroup groupName:${t} userIDList:`+s),t&&!ae(s)&&s.forEach(e=>{this._map.has(e)&&this._map.get(e).addToGroupList(t)})}onRemovedFromFriendGroup(e){const{name:t,userIDList:s}=e;Te.l(`${this._n}.onRemovedFromFriendGroup groupName:${t} userIDList:`+s),t&&!ae(s)&&s.forEach(e=>{this._map.has(e)&&this._map.get(e).removeFromGroupList(t)})}reset(){this._map.clear(),this._startIdx=0,this._standardSeq=0,this._customSeq=0}}class At{constructor(e){ae(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 wt{constructor(e){this._snsM=e,this._n="FriendGroupHandler",this._map=new Map}getLocalGroupList(){return[...this._map.values()]}_onGroupListUpdated(){var e=[...this._map.values()];this._snsM.emitOEvt($e,e)}getGroupList(){const s=this._n+".getGroupList",i=new dt("getGroupList");return this._snsM.req({P:et,data:{fromAccount:this._snsM.getMyUserID()}}).then(e=>{i.end();const t=e.data["resultList"];ae(t)?Te.i(s+" ok. count:0"):(Te.i(s+" ok. count:"+t.length),this._map.clear(),t.forEach(e=>{var t=new At(e);this._map.set(e.name,t)}),this._onGroupListUpdated())}).catch(e=>(i.setError(e).end(),Te.w(s+" error:",e),Be(e)))}createGroup(e){const s=this._n+".createGroup",{name:i,userIDList:t}=e;if(this._map.has(i))return Be({code:ve});const o=`name:${i} userIDList:`+t,a=new dt("createGroup");return a.setMessage(o),this._snsM.req({P:st,data:{fromAccount:this._snsM.getMyUserID(),groupName:[i],userIDList:_e(t)?t:void 0}}).then(e=>{a.end(),Te.l(s+" ok. "+o);const t=e.data["resultList"],r=[],n=[];t&&t.forEach(e=>{const{to:t,resultCode:s,resultInfo:i}=e;if(me(s)||0===s)r.push(t);else{const t={userID:e.to,code:s,message:i};n.push(t)}});e=new At({name:i,userIDList:r});return this._map.set(i,e),this._snsM.onAddedToFriendGroup({name:i,userIDList:r}),this._onGroupListUpdated(),Se({friendGroup:e,failureUserIDList:n})}).catch(e=>(a.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}deleteGroup(e){const s=this._n+".deleteGroup",i=e["name"];if(!this._map.has(i))return this._onGroupNotExist();const r="name:"+i,n=new dt("deleteGroup");return n.setMessage(r),this._snsM.req({P:it,data:{fromAccount:this._snsM.getMyUserID(),nameList:[i]}}).then(e=>{n.end(),Te.l(s+" ok. "+r);const t=this._map.get(i);return t&&(this._snsM.onRemovedFromFriendGroup({name:i,userIDList:t.userIDList}),this._map.delete(i),t.userIDList.length=0),this._onGroupListUpdated(),Se(t)}).catch(e=>(n.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}renameGroup(e){const t=this._n+".renameGroup",{oldName:s,newName:i}=e;if(!this._map.has(s))return this._onGroupNotExist();const r=`oldName:${s} newName:`+i,n=new dt("renameGroup");return n.setMessage(r),this._snsM.req({P:rt,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,newName:i}}).then(()=>{if(n.end(),Te.l(t+" ok. "+r),this._map.has(s)){const e=this._map.get(s);return e.name=i,this._map.delete(s),this._map.set(i,e),this._snsM.onRemovedFromFriendGroup({name:s,userIDList:e.userIDList}),this._snsM.onAddedToFriendGroup({name:i,userIDList:e.userIDList}),this._onGroupListUpdated(),Se(e)}return Se()}).catch(e=>(n.setError(e).end(),Te.w(t+" failed. error:",e),Be(e)))}addToGroup(e){const t=this._n+".addToGroup",{name:s,userIDList:i}=e;if(!this._map.has(s))return this._onGroupNotExist();const r=`name:${s} userIDList:`+i,n=new dt("addToGroup");return n.setMessage(r),this._snsM.req({P:rt,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,updateGroupItem:i.filter(e=>this._snsM.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Add"}))}}).then(e=>(n.end(),Te.l(t+" ok. "+r),this._onGroupUpdated(s,e))).catch(e=>(n.setError(e).end(),Te.w(t+" failed. error:",e),Be(e)))}removeFromGroup(e){const t=this._n+".removeFromGroup",{name:s,userIDList:i}=e;if(!this._map.has(s))return this._onGroupNotExist();const r=`name:${s} userIDList:`+i,n=new dt("removeFromGroup");return n.setMessage(r),this._snsM.req({P:rt,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,updateGroupItem:i.filter(e=>this._snsM.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Delete"}))}}).then(e=>(n.end(),Te.l(t+" ok. "+r),this._onGroupUpdated(s,e))).catch(e=>(n.setError(e).end(),Te.w(t+" failed. error:",e),Be(e)))}_onGroupUpdated(e,t){const s=t.data["resultList"],n=this._map.get(e),o=[],a=[],d=[];return _e(s)&&s.forEach(e=>{var{to:t,resultCode:s,resultInfo:i,type:r}=e;0===s?"Update_Type_Add"===r?n&&(n.addToUserIDList(t),a.push(t)):"Update_Type_Delete"===r&&n&&(n.removeFromUserIDList(t),d.push(t)):o.push({to:e.to,code:s,message:i})}),Te.l(this._n+`._onGroupUpdated name:${e} userIDList:`+n.userIDList),0<a.length&&this._snsM.onAddedToFriendGroup({name:e,userIDList:a}),0<d.length&&this._snsM.onRemovedFromFriendGroup({name:e,userIDList:d}),Se({friendGroup:n,failureUserIDList:o})}updateWhenFriendAdded(e){const{nameList:t,userID:s}=e;Te.l(`${this._n}.updateWhenFriendAdded userID:${s} nameList:`+t),ae(t)||t.forEach(e=>{this._map.has(e)&&this._map.get(e).addToUserIDList(s)})}updateWhenFriendDeleted(e){const{nameList:t,userID:s}=e;Te.l(`${this._n}.updateWhenFriendDeleted userID:${s} nameList:`+t),ae(t)||t.forEach(e=>{this._map.has(e)&&this._map.get(e).removeFromUserIDList(s)})}_onGroupNotExist(e){return Be({code:be})}reset(){this._map.clear()}}class Dt extends class{constructor(e){this._m=e,this._n=""}isLoggedIn(){return this._m.get(_t).isLoggedIn()}isOversea(){return this._m.get(_t).isOversea()}isPrivateNetWork(){return this._m.get(_t).isPrivateNetWork()}getFileDownloadProxy(){return this._m.get(_t).getFileDownloadProxy()}getMyUserID(){return this._m.get(_t).getUserID()}getMyTinyID(){return this._m.get(_t).getTinyID()}getSDKAppID(){return this._m.get(_t).getSDKAppID()}isIntl(){return this._m.get(_t).isIntl()}isUsingChatCore(){return this._m.get(_t).isUsingChatCore()}isDevMode(){return this._m.get(_t).isDevMode()}get(e){return this._m.get(e)}getPlatform(){return S}getCloudConfig(e){return this._m.get(ft).getCloudConfig(e)}emitOEvt(e,t){this._m.getOEmitInst().emit(e,t)}emitIEvt(e,t){this._m.getIEmitInst().emit(e,t)}getIEmitInst(){return this._m.getIEmitInst()}generateTjgID(e){return this._m.get(_t).getTinyID()+"-"+e.random}req(e){return this._m.get(mt).req(e)}canIUse(e){return this._m.get(gt).canIUse(e)}getErrMsg(e,t,s){return this._m.getErrMsg(e,t,s)}warn(e,t,s){e=this.getErrMsg(e,t,s);e&&Te.w(e)}noUse(e){var t=Ne;return Be({code:t,message:this.getErrMsg(t,e)})}}{constructor(t){super(t),this._n="SnsModule",this._friendHandler=new It(this),this._friendApplicationHandler=new ut(this),this._friendGroupHandler=new wt(this),this.getIEmitInst().on(e.A2KEY_AND_TINYID_UPDATED,this.onContextUpdated,this)}onContextUpdated(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getGroupList(),this._friendApplicationHandler.getApplicationList()}onRelationChainModified(e){const t=e["dataList"];if(!ae(t)){const r=[],n=[],o=[],a=[];let s=!1,i="";t.forEach(e=>{if(3!==e.pushType&&4!==e.pushType||!e.from||(i=e.from),e.friendAddAccount&&(r.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&&(s=!0),e.friendUpInfo){const t={dataList:[]};e.friendUpInfo.forEach(e=>{t.dataList.push({userID:e.friendAccount,profileList:[...e.sns]})}),this.onFriendProfileModified(t)}}),s&&this._friendApplicationHandler.onApplicationRead(),this._friendApplicationHandler.onApplicationAdded(o,i),this._friendApplicationHandler.onApplicationDeleted(a),this._friendHandler.onFriendAdded(r),this._friendHandler.onFriendDeleted(n)}}isMyFriend(e){return this._friendHandler.isMyFriend(e)}filterProfanity(e,t){const s=this.get(yt);if(!s)return!0;var{isAllowedToSend:i,modifiedText:r}=s.filterText(t[e],p);return!0===i&&(t[e]=r,!0)}onFriendProfileModified(e){this._friendHandler.onFriendProfileModified(e)}getLocalFriendList(e=!0){var t=this._friendHandler.getLocalFriendList();return e?He(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)}onAddedToFriendGroup(e){this._friendHandler.onAddedToFriendGroup(e)}onRemovedFromFriendGroup(e){this._friendHandler.onRemovedFromFriendGroup(e)}getLocalFriendApplicationList(){var e=this._friendApplicationHandler.getLocalApplicationList();return He(e)}deleteFriendApplication(e){return this._friendApplicationHandler.deleteApplication(e)}refuseFriendApplication(e){return this._friendApplicationHandler.refuseApplication(e)}acceptFriendApplication(e){return this._friendApplicationHandler.acceptApplication(e)}setFriendApplicationRead(e){return this._friendApplicationHandler.setApplicationRead(e)}getLocalFriendGroupList(){var e=this._friendGroupHandler.getLocalGroupList();return He(e)}createFriendGroup(e){return this._friendGroupHandler.createGroup(e)}deleteFriendGroup(e){return this._friendGroupHandler.deleteGroup(e)}addToFriendGroup(e){return this._friendGroupHandler.addToGroup(e)}removeFromFriendGroup(e){return this._friendGroupHandler.removeFromGroup(e)}renameFriendGroup(e){return this._friendGroupHandler.renameGroup(e)}updateWhenFriendAdded(e){this._friendGroupHandler.updateWhenFriendAdded(e)}updateWhenFriendDeleted(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}reset(){Te.l(this._n+".reset"),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}export{Dt as default};
"use strict";const e={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG:"_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,DONUT_NATIVE_APP:19},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",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},p=(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(),new a(Math.pow(2,20)).toString(),"sns"),h=(l.HOST.setCurrent(c),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),_=(h&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),m="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),g="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),y="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,I="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,A=h&&"object"==typeof wx.miniapp,w=h||_||m||f||g||I||y,M=("undefined"!=typeof uni||"undefined"!=typeof window)&&!w,D=(_?qq:m?tt:f?swan:g?my:h?wx:I?uni:y&&jd,M&&window&&window.navigator&&window.navigator.userAgent||""),T=/(micromessenger|webbrowser)/i.test(D),L=/AppleWebKit\/([\d.]+)/i.exec(D),S=(L&&parseFloat(L.pop()),function(){let e="WEB";return T?e="WEB":_?e="QQ_MP":m?e="TT_MP":f?e="BAIDU_MP":g?e="ALI_MP":h?e=A?"DONUT_NATIVE_APP":"WX_MP":I&&(e="UNI_NATIVE_APP"),u[e]}()),F=(!function(){var e=D.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),function(){var e,t,s=D.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);s&&(e=s[1]&&parseFloat(s[1]),t=s[2]&&parseFloat(s[2]),e&&t&&parseFloat(s[1]+"."+s[2]))}(),function(){var e=D.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),/MSIE/.test(D)||-1<D.indexOf("Trident")&&-1<D.indexOf("rv:11.0")),E=(!function(){var e=/MSIE\s(\d+)\.\d/.exec(D),e=e&&parseFloat(e[1]);!e&&/Trident\/7.0/i.test(D)&&/rv:11.0/.test(D)}(),function(){var e=D.match(/TBS\/(\d+)/i);e&&e[1]&&e[1]}(),"C2C"),k="AllowType_Type_AllowAny",v="AdminForbid_Type_None",b="Add_Type_Single",P="Add_Type_Both",U="Delete_Type_Single",C="Delete_Type_Both",N="Pendency_Type_Both",G="Pendency_Type_ComeIn",O="Pendency_Type_SendOut",$="Response_Action_Agree",R="Response_Action_AgreeAndAdd",q="CheckResult_Type_Both",x="CheckResult_Type_Single",H=function(){return(new Date).getTime()+0},B="Tag_Profile_IM_Nick",j="Tag_Profile_IM_Gender",W="Tag_Profile_IM_BirthDay",K="Tag_Profile_IM_Location",Y="Tag_Profile_IM_SelfSignature",J="Tag_Profile_IM_AllowType",V="Tag_Profile_IM_Language",z="Tag_Profile_IM_Image",Q="Tag_Profile_IM_MsgSettings",X="Tag_Profile_IM_AdminForbidType",Z="Tag_Profile_IM_Level",ee="Tag_Profile_IM_Role",te={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"},se="Gender_Type_",ie={UNKNOWN:se+"Unknown",FEMALE:se+"Female",MALE:se+"Male"},re={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},ne={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},oe=Object.prototype.hasOwnProperty;function ae(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(he(e)){for(const t in e)if(oe.call(e,t))return!1;return!0}return!!(de(e)||ue(e)||ce(e))&&0===e.size}const de=function(e){return"map"===ge(e)},ue=function(e){return"set"===ge(e)},ce=function(e){return"file"===ge(e)},le=function(e){return null!==e&&("number"==typeof e&&!isNaN(+e)||"object"==typeof e&&e.constructor===Number)},pe=function(e){return"string"==typeof e},he=function(e){if("object"!=typeof e||null===e)return!1;e=Object.getPrototypeOf(e);if(null===e)return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t},_e=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===ge(e)},me=function(e){return void 0===e},fe=function(e){return e instanceof Error},ge=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},ye=(Date.now||(Date.now=function(){return(new Date).getTime()}),function(e){if(0===e.length)return 0;let t=0,s=0,i;for(var r="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)i=e[t++].charCodeAt[t]<=255?1:!1===r?3:2,s+=i;return s}),Ie=function(e,t){for(const s in e)if(e[s]===t)return!0;return!1};function Ae(){return!F&&!w}let we=0;function Me(){return Ae()?"%c Chat %c":"Chat"}function De(){const e=function(){const e=new Date;return e.setTime(H()),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 Te={arguments2String(s){let i="";if(1===s.length)i=s[0];else for(let e=0,t=s.length;e<t;e++)r=s[e],_e(r)||null!==r&&"object"==typeof r?fe(s[e])?i+=(r=s[e],JSON.stringify(r,["message","code"])):i+=JSON.stringify(s[e]):i+=s[e],i+=" ";var r;return i},_exec(e,t){Ae()?o[e](Me(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",De(),t):o[e](`${Me()} ${De()} `+t)},d:function(){var e;we<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;we<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;we<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;we<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;we<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;we<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+we+" to "+e),we=e},getLevel:function(){return we}};class Le{constructor(e){ae(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 Se=function(e){return{code:0,data:e||{}}};class Fe extends Error{constructor(e){super();var{code:e,message:t,data:s}=e;this.code=e,t?this.message=t:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=s||{}}}const Ee=2700,ke=2701,ve=2710,be=2711,Pe=2716,Ue=2805,Ce=2903,Ne=3122,Ge=3123,Oe="onFriendListUpdated",$e="onFriendGroupListUpdated",Re="onFriendApplicationListUpdated",qe="error";let xe=null;const He=function(e){return Promise.resolve(Se(e))},Be=function(e,t=!1){if(e instanceof Fe)return t&&null!==xe&&xe.emit(qe,e),Promise.reject(e);if(e instanceof Error){const e=new Fe({code:Ce});return t&&null!==xe&&xe.emit(qe,e),Promise.reject(e)}if(me(e)||me(e.code))return Promise.reject(new Fe({code:Ce}));e=new Fe(e);return t&&null!==xe&&xe.emit(qe,e),Promise.reject(e)},je="friend_get",We="friend_get_specified",Ke="friend_check",Ye="friend_delete",Je="friend_add",Ve="friend_update",ze="friend_response",Qe="pendency_get",Xe="pendency_delete",Ze="pendency_report",et="group_get",st="group_add",it="group_delete",rt="group_update",nt={info:4,warning:5,error:6},ot={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},at={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16};class dt{constructor(e){this._n="SSOLogData",this.eventType=at[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=H()}static bindEventStatModule(e){dt.prototype._eventStatModule=e}static bindNetMonitorModule(e){dt.prototype._netMonitorModule=e}updateTimeStamp(){this.timestamp=H()}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=H();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 Te.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=Ue;this.setCode(e)}return this.setLevel("error"),this}setCode(e){return me(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),le(e)?this.code=e:Te.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return me(e)||this._sentFlag||(le(e)&&(this.message=e.toString()),pe(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return me(e)||this._sentFlag||(this.level=nt[e]),this}setMoreMessage(e){return ae(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){return me(e)?Te.w(this._n+".setNetworkType value is undefined, please check!"):(e=ot[e.toLowerCase()],me(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 ut{constructor(e){this._snsM=e,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSeq=0,this._map=new Map,this._unreadCount=0}getLocalApplicationList(){return{friendApplicationList:[...this._map.values()],unreadCount:this._unreadCount}}_onApplicationListUpdated(){this._snsM.emitOEvt(Re,{friendApplicationList:[...this._map.values()],unreadCount:this._unreadCount})}onApplicationRead(){this._unreadCount=0,this._onApplicationListUpdated()}onApplicationAdded(e,t){if(!ae(e)){let s,i=(s=t===this._snsM.getMyUserID()?O:G,!1);e.forEach(e=>{var t=e.userID+"_"+s;s!==G||this._map.has(t)||(this._unreadCount+=1),this._map.set(t,new Le({...e,type:s})),i=!0}),i&&this._onApplicationListUpdated()}}onApplicationDeleted(e){ae(e)||(this._startTime=0,this._currentSeq=0,this.getApplicationList())}getApplicationList(){const n=this._n+".getApplicationList",o=new dt("getApplicationList");return this._snsM.req({P:Qe,data:{applicationType:N,fromAccount:this._snsM.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSeq}}).then(e=>{const{resultList:t,unreadCount:s,startTime:i,currentSequence:r}=e.data;this._startTime=i,this._currentSeq=r,this._unreadCount=s;e=`applicationCount:${_e(t)?t.length:0} unreadCount:${s} startTime:${i} currentSequence:`+r;o.setMessage(e).end(),Te.i(n+" ok. "+e),this._map.clear(),_e(t)&&t.forEach(e=>{var{userID:t,type:s}=e,e=new Le(e);this._map.set(t+"_"+s,e)}),this._onApplicationListUpdated()}).catch(e=>(o.setError(e).end(),Te.w(n+" failed. error:",e),Be(e)))}deleteApplication(e){const r=this._n+".deleteApplication",{userID:n,type:t}=e;let o=t;if(o&&(o===O||o===G)||(o=G),!this._map.has(n+"_"+o))return Be({code:Pe});const a=new dt("deleteApplication");return a.setMessage(`userID:${n} type:`+o),this._snsM.req({P:Xe,data:{fromAccount:this._snsM.getMyUserID(),userIDList:[n],type:o}}).then(e=>{var e=e.data["resultList"],{to:t,resultCode:s,resultInfo:i}=e[0];return a.setMoreMessage("resultList:"+JSON.stringify(e)).end(),Te.i(r+` ok. userID:${n} type:`+o),0===s?Se():Be({userID:t,code:s,message:i})}).catch(e=>(a.setError(e).end(),Te.w(r+" failed. error:",e),Be(e)))}acceptApplication(e){const s=this._n+".acceptApplication",{userID:i,remark:t,tag:r,type:n}=e;let o=n;o&&(o===$||o===R)||(o=R);const a=new dt("acceptApplication");return a.setMessage(`userID:${i} type:`+o),this._snsM.req({P:ze,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:i,remark:t,tag:r,action:o}]}}).then(e=>{a.end();var e=e.data["resultList"],{resultCode:e,resultInfo:t}=e[0];if(0!==e)return Be({code:e,message:t});Te.i(s+` ok. userID:${i} type:`+o)}).catch(e=>(a.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}refuseApplication(e){const s=this._n+".refuseApplication",i=e["userID"],r=new dt("refuseApplication");return r.setMessage("userID:"+i),this._snsM.req({P:ze,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:i,action:"Response_Action_Reject"}]}}).then(e=>{r.end();var e=e.data["resultList"],{resultCode:e,resultInfo:t}=e[0];if(0!==e)return Be({code:e,message:t});Te.i(s+" ok. userID:"+i)}).catch(e=>(r.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}setApplicationRead(){const t=this._n+".setApplicationRead",s=new dt("setApplicationRead");var e;return this._snsM.req({P:Ze,data:{fromAccount:this._snsM.getMyUserID(),latestTimeStamp:(e=H()/1e3,Math.round(Number(e)*Math.pow(10,0))/Math.pow(10,0))}}).then(e=>{s.end(),Te.i(t+" ok"),this._unreadCount=0}).catch(e=>(s.setError(e).end(),Te.w(t+" failed. error:",e),Be(e)))}reset(){this._maxLimited=100,this._currentSeq=0,this._unreadCount=0,this._map.clear()}}class ct{constructor(e){ae(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||k,this.language=e.language||0,this.avatar=e.avatar||"",this.messageSettings=e.messageSettings||0,this.adminForbidType=e.adminForbidType||v,this.level=e.level||0,this.role=e.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],ae(e.profileCustomField)||e.profileCustomField.forEach(e=>{this.profileCustomField.push({key:e.key,value:e.value})}))}validate(s){let i=!0,e="";if(ae(s))return{valid:!1,tips:"empty options"};if(s.profileCustomField){const i=s.profileCustomField.length;let t=null;for(let e=0;e<i;e++){if(t=s.profileCustomField[e],!pe(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(!pe(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 s)if(Object.prototype.hasOwnProperty.call(s,t)){if("profileCustomField"===t)continue;if(ae(s[t])&&!pe(s[t])&&!le(s[t])){e="key:"+t+", invalid value:"+s[t],i=!1;continue}switch(t){case"nick":pe(s[t])||(e="nick must be a string",i=!1),500<ye(s[t])&&(e=`nick name limited: must less than or equal to 500 bytes, current size: ${ye(s[t])} bytes`,i=!1);break;case"gender":Ie(ie,s.gender)||(e="key:gender, invalid value:"+s.gender,i=!1);break;case"birthday":le(s.birthday)||(e="birthday must be a number",i=!1);break;case"location":pe(s.location)||(e="location must be a string",i=!1);break;case"selfSignature":pe(s.selfSignature)||(e="selfSignature must be a string",i=!1);break;case"allowType":Ie(ne,s.allowType)||(e="key:allowType, invalid value:"+s.allowType,i=!1);break;case"language":le(s.language)||(e="language must be a number",i=!1);break;case"avatar":pe(s.avatar)||(e="avatar must be a string",i=!1);break;case"messageSettings":0!==s.messageSettings&&1!==s.messageSettings&&(e="messageSettings must be 0 or 1",i=!1);break;case"adminForbidType":Ie(re,s.adminForbidType)||(e="key:adminForbidType, invalid value:"+s.adminForbidType,i=!1);break;case"level":le(s.level)||(e="level must be a number",i=!1);break;case"role":le(s.role)||(e="role must be a number",i=!1);break;default:e="unknown key:"+t+" "+s[t],i=!1}}return{valid:i,tips:e}}}class lt{constructor(e,r){this.userID=e,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;const n={},o=[];if(n.userID=e,!ae(r)){let s="",i;for(let e=0,t=r.length;e<t;e++)if(s=r[e].tag,i=r[e].value,-1<s.indexOf("Tag_SNS_Custom"))this.friendCustomField.push({key:s,value:i});else if(-1<s.indexOf("Tag_Profile_Custom"))o.push({key:s,value:i});else switch(s){case B:n.nick=i;break;case j:n.gender=i;break;case W:n.birthday=i;break;case K:n.location=i;break;case Y:n.selfSignature=i;break;case J:n.allowType=i;break;case V:n.language=i;break;case z:n.avatar=i;break;case Q:n.messageSettings=i;break;case X:n.adminForbidType=i;break;case Z:n.level=i;break;case ee:n.role=i;break;case te.REMARK:this.remark=i;break;case te.ADDTIME:this.addTime=i;break;case te.GROUP:this.groupList=JSON.parse(JSON.stringify(i));break;case te.ADDSOURCE:this.source=i;break;case te.ADDWORDING:break;default:Te.l("snsProfileItem unknown tag->",r[e].tag)}}this.profile=new ct({...n,profileCustomField:o})}validate(s){let i=!0,e="";if(ae(s))return{valid:!1,tips:"empty options"};if(s.profileCustomField){const i=s.profileCustomField.length;let t=null;for(let e=0;e<i;e++){if(t=s.profileCustomField[e],!pe(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(!pe(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 s)if(Object.prototype.hasOwnProperty.call(s,t)){if("profileCustomField"===t)continue;if(ae(s[t])&&!pe(s[t])&&!le(s[t])){e="key:"+t+", invalid value:"+s[t],i=!1;continue}switch(t){case"nick":pe(s[t])||(e="nick must be a string",i=!1),500<ye(s[t])&&(e=`nick name limited: must less than or equal to 500 bytes, current size: ${ye(s[t])} bytes`,i=!1);break;case"gender":Ie(ie,s.gender)||(e="key:gender, invalid value:"+s.gender,i=!1);break;case"birthday":le(s.birthday)||(e="birthday must be a number",i=!1);break;case"location":pe(s.location)||(e="location must be a string",i=!1);break;case"selfSignature":pe(s.selfSignature)||(e="selfSignature must be a string",i=!1);break;case"allowType":Ie(ne,s.allowType)||(e="key:allowType, invalid value:"+s.allowType,i=!1);break;case"language":le(s.language)||(e="language must be a number",i=!1);break;case"avatar":pe(s.avatar)||(e="avatar must be a string",i=!1);break;case"messageSettings":0!==s.messageSettings&&1!==s.messageSettings&&(e="messageSettings must be 0 or 1",i=!1);break;case"adminForbidType":Ie(re,s.adminForbidType)||(e="key:adminForbidType, invalid value:"+s.adminForbidType,i=!1);break;case"level":le(s.level)||(e="level must be a number",i=!1);break;case"role":le(s.role)||(e="role must be a number",i=!1);break;default:e="unknown key:"+t+" "+s[t],i=!1}}return{valid:i,tips:e}}update(s){let i="",r;const n=[];this.friendCustomField.forEach(e=>{n.push(e.key)});for(let e=0,t=s.length;e<t;e++)if(i=s[e].tag,r=s[e].value,-1<i.indexOf("Tag_SNS_Custom"))-1<n.indexOf(i)?this.friendCustomField.forEach(e=>{e.key===i&&(e.value=r)}):this.friendCustomField.push({key:i,value:r});else if(-1<i.indexOf("Tag_Profile_Custom")){let t=!1;this.profile.profileCustomField.forEach(e=>{e.key===i&&(e.value=r,t=!0)}),t||this.profile.profileCustomField.push({key:i,value:r})}else switch(i){case B:this.profile.nick=r;break;case j:this.profile.gender=r;break;case W:this.profile.birthday=r;break;case K:this.profile.location=r;break;case Y:this.profile.selfSignature=r;break;case J:this.profile.allowType=r;break;case V:this.profile.language=r;break;case z:this.profile.avatar=r;break;case Q:this.profile.messageSettings=r;break;case X:this.profile.adminForbidType=r;break;case Z:this.profile.level=r;break;case ee:this.profile.role=r;break;case te.REMARK:this.remark=r;break;case te.ADDTIME:this.addTime=r;break;case te.GROUP:this.groupList=JSON.parse(JSON.stringify(r));break;case te.ADDSOURCE:this.source=r;break;case te.ADDWORDING:break;default:Te.d("snsProfileItem unkown tag->",s[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 pt=4,ht=11,_t=12,mt=20,ft=23,gt=27,yt=29;class It{constructor(e){this._snsM=e,this._n="FriendHandler",this._map=new Map,this._startIdx=0,this._standardSeq=0,this._customSeq=0,this._expirationTime=18e4}getLocalFriendList(){return[...this._map.values()]}getFriendRemark(e){return this._map.has(e)?this._map.get(e).remark:""}onFriendProfileModified(e){const t=e["dataList"];if(!ae(t)){const i=this._snsM.get(ht);t.forEach(e=>{var{userID:t,profileList:s}=e;if(this.isMyFriend(t)){Te.l(this._n+`.onFriendProfileModified. friend account:${t}, profileList:`+JSON.stringify(s));const e=this._map.get(t);e.update(s),i.modifyMessageSentByPeer({conversationID:""+E+t,latestNick:e.profile.nick,latestAvatar:e.profile.avatar})}}),this._onFriendListUpdated()}}onFriendAdded(t){0!==t.length&&(Te.l(this._n+".onFriendAdded userIDList:"+t),t.forEach(e=>{this._map.set(e,new lt(e))}),this.getFriendProfile({userIDList:t}).then(e=>{t.forEach(e=>{var t=this._map.get(e);0<t.groupList.length&&this._snsM.updateWhenFriendAdded({nameList:t.groupList,userID:e})}),this._onFriendListUpdated()}))}onFriendDeleted(e){0!==e.length&&(Te.l(this._n+".onFriendDeleted userIDList:"+e),e.forEach(e=>{var t=this._map.get(e);0<t.groupList.length&&this._snsM.updateWhenFriendDeleted({nameList:t.groupList,userID:e}),this._map.delete(e)}),this._onFriendListUpdated())}_onFriendListUpdated(){this._snsM.emitOEvt(Oe),this._snsM.get(ht).checkAndPatchRemark()}getFriendProfile(e){const s=this._n+".getFriendProfile",t=e["userIDList"],r=[],n=[],i=[];if(t.forEach(e=>{var t;this._map.has(e)?(t=this._map.get(e),Date.now()-t.timestamp<this._expirationTime?n.push(t):i.push(e)):r.push({userID:e,code:Ee,message:this._snsM.getErrMsg(Ee)})}),0===i.length)return Te.i(s+" newUserIDList is empty"),He({friendList:n,failureUserIDList:r});const o=new dt("getFriendProfile");return o.setMessage("userIDList:"+i),Te.i(s+" userIDList:"+i),this._snsM.req({P:We,data:{fromAccount:this._snsM.getMyUserID(),userIDList:i}}).then(e=>{o.end(),Te.i(s+" ok");const t=e.data["resultList"];return t.forEach(t=>{var{to:t,resultCode:e,resultInfo:s,tagValueList:i}=t;if(me(e)||0===e){let e;this._map.has(t)?(e=this._map.get(t)).update(i):(e=new lt(t,i),this._map.set(t,e)),n.push(e)}else r.push({userID:t,code:e,message:s})}),Se({friendList:n,failureUserIDList:r})}).catch(e=>(o.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}isMyFriend(e){return this._map.has(e)}pagingGetFriendList(){const a=this._n+".getFriendList",d=new dt("getFriendList"),u=Date.now();this._snsM.req({P:je,data:{fromAccount:this._snsM.getMyUserID(),startIndex:this._startIdx,standardSequence:this._standardSeq,customSequence:this._customSeq}}).then(e=>{const{friendCount:t,resultList:s,nextStartIndex:i,standardSequence:r,customSequence:n,completeFlag:o}=e.data;e=`friendCount:${t} nextStartIndex:${this._startIdx=i} standardSequence:${this._standardSeq=r} customSequence:${this._customSeq=n} completeFlag:${o} cost:`+(e=u,Date.now()-e+" ms");d.setMessage(e).end(),Te.i(a+" ok.",e),ae(s)||s.forEach(e=>{var{to:e,tagValueList:t}=e;this._map.set(e,new lt(e,t))}),0===o?this.pagingGetFriendList():(this._snsM.emitOEvt(Oe),this._pagingGetFriendProfile())}).catch(e=>(d.setError(e).end(),Te.w(a+" failed. error:",e),Be(e)))}_pagingGetFriendProfile(){const t=[...this._map.keys()],s=this._snsM.get(pt),e=t.length,i=e<=100?1:Math.ceil(e/100);Te.l(this._n+`._pagingGetFriendProfile friendCount:${e} pageCount:`+i);for(let e=0;e<i;e++)s.getUserProfile({userIDList:t.slice(100*e,100*(e+1))}).then(e=>{e.data.forEach(e=>{const t=this._map.get(e.userID);t&&t.updateProfile(e)}),this._onFriendListUpdated()})}addFriend(e){const i=this._n+".addFriend";if(this._map.has(e.to))return Be({code:ke});if(e.wording&&!1===this._snsM.filterProfanity("wording",e))return Be({code:Ge});var{to:e,source:t,type:s,wording:r,remark:n,groupName:o}=e;let a=s;a&&(a===b||a===P)||(a=P);const d=new dt("addFriend");return d.setMessage(`to:${e} source:${t} type:`+a),this._snsM.req({P:Je,data:{fromAccount:this._snsM.getMyUserID(),addFriendItem:[{to:e,source:t,wording:r,remark:n,groupName:o}],type:a}}).then(e=>{var e=e.data["resultList"],{to:e,resultCode:t,resultInfo:s}=(d.setMoreMessage("resultList:"+JSON.stringify(e)).end(),e[0]);return Te.i(i+` ok. to:${e} type:${a} code:`+t),me(t)||0===t?Se({userID:e,code:0}):30539===t?Se({userID:e,code:t,message:this._snsM.getErrMsg(t)}):Be({userID:e,code:t,message:this._snsM.getErrMsg(t)||s})}).catch(e=>(d.setError(e).end(),Te.w(i+" failed. error:",e),Be(e)))}deleteFriend(e){const s=this._n+".deleteFriend",{userIDList:t,type:i}=e;1e3<t.length&&(Te.w(s+" "+"the length of userIDList cannot exceed 1000"),t.length=1e3);const r=[],n=[],o=[];if(t.forEach(e=>{this._map.has(e)?o.push(e):r.push({userID:e,code:Ee,message:this._snsM.getErrMsg(Ee)})}),0===o.length)return He({successUserIDList:n,failureUserIDList:r});let a=i;a&&(a===U||a===C)||(a=C);const d=new dt("deleteFriend");return d.setMessage(`userIDList:${o} type:`+a),this._snsM.req({P:Ye,data:{fromAccount:this._snsM.getMyUserID(),userIDList:o,type:a}}).then(e=>{d.end(),Te.i(s+" ok");const t=e.data["resultList"];return ae(t)||t.forEach(e=>{var{to:e,resultCode:t,resultInfo:s}=e;me(t)||0===t?n.push({userID:e}):r.push({userID:e,code:t,message:s})}),Se({successUserIDList:n,failureUserIDList:r})}).catch(e=>(d.setError(e).end(),Te.w(s+" error:",e),Be(e)))}updateFriend(e){const{userID:t,remark:i,friendCustomField:n}=e;if(!this._map.has(t))return Be({code:Ee});const o=this._n+".updateFriend",a=new dt("updateFriend"),s=(a.setMessage(`userID:${t} remark:${i} friendCustomField:`+n),[]);return me(i)||s.push({tag:te.REMARK,value:i}),_e(n)&&0<n.length&&n.forEach(e=>{s.push({tag:e.key,value:e.value})}),this._snsM.req({P:Ve,data:{fromAccount:this._snsM.getMyUserID(),updateItem:[{to:t,snsItem:s}]}}).then(e=>{a.end(),Te.i(o+" ok");var e=e.data["resultList"],{to:t,resultCode:e,resultInfo:s}=e[0];if(me(e)||0===e){const e=this._map.get(t);if(e){me(i)||(e.remark=i);if(_e(n)&&0<n.length){var r=e.friendCustomField;t=n;if(_e(r)&&_e(t)){let i=!1;t.forEach(({key:t,value:e})=>{const s=r.find(e=>e.key===t);s?s.value!==e&&(s.value=e,i=!0):(r.push({key:t,value:e}),i=!0)})}}this._onFriendListUpdated()}return Se(e)}return Be({code:e,message:s})}).catch(e=>(a.setError(e).end(),Te.w(o+" failed. error:",e),Be(e)))}checkFriend(e){const s=this._n+".checkFriend",{userIDList:i,type:t}=e;let o=t;o&&(o===x||o===q)||(o=q);const a=new dt("checkFriend");return a.setMessage(`userIDList:${i} type:`+o),this._snsM.req({P:Ke,data:{fromAccount:this._snsM.getMyUserID(),userIDList:i,type:o}}).then(e=>{a.end(),Te.i(s+` ok. userIDList:${i} type:`+o);const r=[],n=[],t=e.data["resultList"];return _e(t)&&t.forEach(e=>{var{to:e,relation:t,resultCode:s,resultInfo:i}=e;me(s)||0===s?r.push({userID:e,code:0,relation:t}):n.push({userID:e,code:s,message:i})}),Se({successUserIDList:r,failureUserIDList:n})}).catch(e=>(a.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}onAddedToFriendGroup(e){const{name:t,userIDList:s}=e;Te.l(`${this._n}.onAddedToFriendGroup groupName:${t} userIDList:`+s),t&&!ae(s)&&s.forEach(e=>{this._map.has(e)&&this._map.get(e).addToGroupList(t)})}onRemovedFromFriendGroup(e){const{name:t,userIDList:s}=e;Te.l(`${this._n}.onRemovedFromFriendGroup groupName:${t} userIDList:`+s),t&&!ae(s)&&s.forEach(e=>{this._map.has(e)&&this._map.get(e).removeFromGroupList(t)})}reset(){this._map.clear(),this._startIdx=0,this._standardSeq=0,this._customSeq=0}}class At{constructor(e){ae(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 wt{constructor(e){this._snsM=e,this._n="FriendGroupHandler",this._map=new Map}getLocalGroupList(){return[...this._map.values()]}_onGroupListUpdated(){var e=[...this._map.values()];this._snsM.emitOEvt($e,e)}getGroupList(){const s=this._n+".getGroupList",i=new dt("getGroupList");return this._snsM.req({P:et,data:{fromAccount:this._snsM.getMyUserID()}}).then(e=>{i.end();const t=e.data["resultList"];ae(t)?Te.i(s+" ok. count:0"):(Te.i(s+" ok. count:"+t.length),this._map.clear(),t.forEach(e=>{var t=new At(e);this._map.set(e.name,t)}),this._onGroupListUpdated())}).catch(e=>(i.setError(e).end(),Te.w(s+" error:",e),Be(e)))}createGroup(e){const s=this._n+".createGroup",{name:i,userIDList:t}=e;if(this._map.has(i))return Be({code:ve});const o=`name:${i} userIDList:`+t,a=new dt("createGroup");return a.setMessage(o),this._snsM.req({P:st,data:{fromAccount:this._snsM.getMyUserID(),groupName:[i],userIDList:_e(t)?t:void 0}}).then(e=>{a.end(),Te.l(s+" ok. "+o);const t=e.data["resultList"],r=[],n=[];t&&t.forEach(e=>{const{to:t,resultCode:s,resultInfo:i}=e;if(me(s)||0===s)r.push(t);else{const t={userID:e.to,code:s,message:i};n.push(t)}});e=new At({name:i,userIDList:r});return this._map.set(i,e),this._snsM.onAddedToFriendGroup({name:i,userIDList:r}),this._onGroupListUpdated(),Se({friendGroup:e,failureUserIDList:n})}).catch(e=>(a.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}deleteGroup(e){const s=this._n+".deleteGroup",i=e["name"];if(!this._map.has(i))return this._onGroupNotExist();const r="name:"+i,n=new dt("deleteGroup");return n.setMessage(r),this._snsM.req({P:it,data:{fromAccount:this._snsM.getMyUserID(),nameList:[i]}}).then(e=>{n.end(),Te.l(s+" ok. "+r);const t=this._map.get(i);return t&&(this._snsM.onRemovedFromFriendGroup({name:i,userIDList:t.userIDList}),this._map.delete(i),t.userIDList.length=0),this._onGroupListUpdated(),Se(t)}).catch(e=>(n.setError(e).end(),Te.w(s+" failed. error:",e),Be(e)))}renameGroup(e){const t=this._n+".renameGroup",{oldName:s,newName:i}=e;if(!this._map.has(s))return this._onGroupNotExist();const r=`oldName:${s} newName:`+i,n=new dt("renameGroup");return n.setMessage(r),this._snsM.req({P:rt,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,newName:i}}).then(()=>{if(n.end(),Te.l(t+" ok. "+r),this._map.has(s)){const e=this._map.get(s);return e.name=i,this._map.delete(s),this._map.set(i,e),this._snsM.onRemovedFromFriendGroup({name:s,userIDList:e.userIDList}),this._snsM.onAddedToFriendGroup({name:i,userIDList:e.userIDList}),this._onGroupListUpdated(),Se(e)}return Se()}).catch(e=>(n.setError(e).end(),Te.w(t+" failed. error:",e),Be(e)))}addToGroup(e){const t=this._n+".addToGroup",{name:s,userIDList:i}=e;if(!this._map.has(s))return this._onGroupNotExist();const r=`name:${s} userIDList:`+i,n=new dt("addToGroup");return n.setMessage(r),this._snsM.req({P:rt,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,updateGroupItem:i.filter(e=>this._snsM.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Add"}))}}).then(e=>(n.end(),Te.l(t+" ok. "+r),this._onGroupUpdated(s,e))).catch(e=>(n.setError(e).end(),Te.w(t+" failed. error:",e),Be(e)))}removeFromGroup(e){const t=this._n+".removeFromGroup",{name:s,userIDList:i}=e;if(!this._map.has(s))return this._onGroupNotExist();const r=`name:${s} userIDList:`+i,n=new dt("removeFromGroup");return n.setMessage(r),this._snsM.req({P:rt,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,updateGroupItem:i.filter(e=>this._snsM.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Delete"}))}}).then(e=>(n.end(),Te.l(t+" ok. "+r),this._onGroupUpdated(s,e))).catch(e=>(n.setError(e).end(),Te.w(t+" failed. error:",e),Be(e)))}_onGroupUpdated(e,t){const s=t.data["resultList"],n=this._map.get(e),o=[],a=[],d=[];return _e(s)&&s.forEach(e=>{var{to:t,resultCode:s,resultInfo:i,type:r}=e;0===s?"Update_Type_Add"===r?n&&(n.addToUserIDList(t),a.push(t)):"Update_Type_Delete"===r&&n&&(n.removeFromUserIDList(t),d.push(t)):o.push({to:e.to,code:s,message:i})}),Te.l(this._n+`._onGroupUpdated name:${e} userIDList:`+n.userIDList),0<a.length&&this._snsM.onAddedToFriendGroup({name:e,userIDList:a}),0<d.length&&this._snsM.onRemovedFromFriendGroup({name:e,userIDList:d}),Se({friendGroup:n,failureUserIDList:o})}updateWhenFriendAdded(e){const{nameList:t,userID:s}=e;Te.l(`${this._n}.updateWhenFriendAdded userID:${s} nameList:`+t),ae(t)||t.forEach(e=>{this._map.has(e)&&this._map.get(e).addToUserIDList(s)})}updateWhenFriendDeleted(e){const{nameList:t,userID:s}=e;Te.l(`${this._n}.updateWhenFriendDeleted userID:${s} nameList:`+t),ae(t)||t.forEach(e=>{this._map.has(e)&&this._map.get(e).removeFromUserIDList(s)})}_onGroupNotExist(e){return Be({code:be})}reset(){this._map.clear()}}class Mt extends class{constructor(e){this._m=e,this._n=""}isLoggedIn(){return this._m.get(_t).isLoggedIn()}isOversea(){return this._m.get(_t).isOversea()}isPrivateNetWork(){return this._m.get(_t).isPrivateNetWork()}getFileDownloadProxy(){return this._m.get(_t).getFileDownloadProxy()}getMyUserID(){return this._m.get(_t).getUserID()}getMyTinyID(){return this._m.get(_t).getTinyID()}getSDKAppID(){return this._m.get(_t).getSDKAppID()}isIntl(){return this._m.get(_t).isIntl()}isUsingChatCore(){return this._m.get(_t).isUsingChatCore()}isDevMode(){return this._m.get(_t).isDevMode()}get(e){return this._m.get(e)}getPlatform(){return S}getCloudConfig(e){return this._m.get(ft).getCloudConfig(e)}emitOEvt(e,t){this._m.getOEmitInst().emit(e,t)}emitIEvt(e,t){this._m.getIEmitInst().emit(e,t)}getIEmitInst(){return this._m.getIEmitInst()}generateTjgID(e){return this._m.get(_t).getTinyID()+"-"+e.random}req(e){return this._m.get(mt).req(e)}canIUse(e){return this._m.get(gt).canIUse(e)}getErrMsg(e,t,s){return this._m.getErrMsg(e,t,s)}warn(e,t,s){e=this.getErrMsg(e,t,s);e&&Te.w(e)}noUse(e){var t=Ne;return Be({code:t,message:this.getErrMsg(t,e)})}}{constructor(t){super(t),this._n="SnsModule",this._friendHandler=new It(this),this._friendApplicationHandler=new ut(this),this._friendGroupHandler=new wt(this),this.getIEmitInst().on(e.A2KEY_AND_TINYID_UPDATED,this.onContextUpdated,this)}onContextUpdated(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getGroupList(),this._friendApplicationHandler.getApplicationList()}onRelationChainModified(e){const t=e["dataList"];if(!ae(t)){const r=[],n=[],o=[],a=[];let s=!1,i="";t.forEach(e=>{if(3!==e.pushType&&4!==e.pushType||!e.from||(i=e.from),e.friendAddAccount&&(r.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&&(s=!0),e.friendUpInfo){const t={dataList:[]};e.friendUpInfo.forEach(e=>{t.dataList.push({userID:e.friendAccount,profileList:[...e.sns]})}),this.onFriendProfileModified(t)}}),s&&this._friendApplicationHandler.onApplicationRead(),this._friendApplicationHandler.onApplicationAdded(o,i),this._friendApplicationHandler.onApplicationDeleted(a),this._friendHandler.onFriendAdded(r),this._friendHandler.onFriendDeleted(n)}}isMyFriend(e){return this._friendHandler.isMyFriend(e)}filterProfanity(e,t){const s=this.get(yt);if(!s)return!0;var{isAllowedToSend:i,modifiedText:r}=s.filterText(t[e],p);return!0===i&&(t[e]=r,!0)}onFriendProfileModified(e){this._friendHandler.onFriendProfileModified(e)}getLocalFriendList(e=!0){var t=this._friendHandler.getLocalFriendList();return e?He(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)}onAddedToFriendGroup(e){this._friendHandler.onAddedToFriendGroup(e)}onRemovedFromFriendGroup(e){this._friendHandler.onRemovedFromFriendGroup(e)}getLocalFriendApplicationList(){var e=this._friendApplicationHandler.getLocalApplicationList();return He(e)}deleteFriendApplication(e){return this._friendApplicationHandler.deleteApplication(e)}refuseFriendApplication(e){return this._friendApplicationHandler.refuseApplication(e)}acceptFriendApplication(e){return this._friendApplicationHandler.acceptApplication(e)}setFriendApplicationRead(e){return this._friendApplicationHandler.setApplicationRead(e)}getLocalFriendGroupList(){var e=this._friendGroupHandler.getLocalGroupList();return He(e)}createFriendGroup(e){return this._friendGroupHandler.createGroup(e)}deleteFriendGroup(e){return this._friendGroupHandler.deleteGroup(e)}addToFriendGroup(e){return this._friendGroupHandler.addToGroup(e)}removeFromFriendGroup(e){return this._friendGroupHandler.removeFromGroup(e)}renameFriendGroup(e){return this._friendGroupHandler.renameGroup(e)}updateWhenFriendAdded(e){this._friendGroupHandler.updateWhenFriendAdded(e)}updateWhenFriendDeleted(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}reset(){Te.l(this._n+".reset"),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}export{Mt as default};

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

"use strict";const t=2,e=6,i=11,n=12,s=20,o=23,a=27;class r{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 g={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"}}},c={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19},l="CHINA",h={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(t=l){this.CURRENT=g.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",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},u=(new r(0,Math.pow(2,1)).toString(),new r(0,Math.pow(2,2)).toString(),new r(0,Math.pow(2,3)).toString(),new r(0,Math.pow(2,4)).toString(),new r(0,Math.pow(2,6)).toString(),new r(0,Math.pow(2,7)).toString(),new r(0,Math.pow(2,9)).toString(),new r(0,Math.pow(2,10)).toString(),new r(0,Math.pow(2,11)).toString(),new r(0,Math.pow(2,13)).toString(),new r(0,Math.pow(2,15)).toString(),new r(Math.pow(2,6)).toString(),new r(Math.pow(2,7)).toString(),new r(Math.pow(2,8)).toString(),new r(Math.pow(2,9)).toString(),new r(Math.pow(2,10)).toString(),new r(Math.pow(2,16)).toString(),new r(Math.pow(2,20)).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),I="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),m="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&&"object"==typeof wx.miniapp,D=u||_||d||I||m||v||f,S=("undefined"!=typeof uni||"undefined"!=typeof window)&&!D,M=(_?qq:d?tt:I?swan:m?my:u?wx:v?uni:f&&jd,S&&window&&window.navigator&&window.navigator.userAgent||""),y=/(micromessenger|webbrowser)/i.test(M),C=/AppleWebKit\/([\d.]+)/i.exec(M),w=(C&&parseFloat(C.pop()),function(){let t="WEB";return y?t="WEB":_?t="QQ_MP":d?t="TT_MP":I?t="BAIDU_MP":m?t="ALI_MP":u?t=p?"DONUT_NATIVE_APP":"WX_MP":v&&(t="UNI_NATIVE_APP"),c[t]}()),T=(!function(){var t=M.match(/OS (\d+)_/i);t&&t[1]&&t[1]}(),function(){var t,e,i=M.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=M.match(/Chrome\/(\d+)/);t&&t[1]&&parseFloat(t[1])}(),/MSIE/.test(M)||-1<M.indexOf("Trident")&&-1<M.indexOf("rv:11.0"));let E,L;!function(){var t=/MSIE\s(\d+)\.\d/.exec(M),t=t&&parseFloat(t[1]);!t&&/Trident\/7.0/i.test(M)&&/rv:11.0/.test(M)}(),function(){var t=M.match(/TBS\/(\d+)/i);t&&t[1]&&t[1]}(),E="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const A=function(){},N=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let O=N.length;for(;O--;)L=N[O],console[L]||(E[L]=A);var P=E;const U="TIMCustomElem",$="High",H="C2C",R="GROUP",F=function(){return(new Date).getTime()+0},x=function(){const t=new Date;return t.setTime(F()),t},b=function(){return Math.floor(F()/1e3)},G=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(K(t)){for(const e in t)if(G.call(t,e))return!1;return!0}return!!(B(t)||j(t)||k(t))&&0===t.size}const B=function(t){return"map"===Y(t)},j=function(t){return"set"===Y(t)},k=function(t){return"file"===Y(t)},K=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},J=function(t){return void 0===t},V=function(t){return e=t,("function"==typeof Array.isArray?Array.isArray(e):"array"===Y(e))||null!==t&&"object"==typeof t;var e},Y=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()};function W(){return!T&&!D}Date.now||(Date.now=function(){return(new Date).getTime()});let z=0;function X(){return W()?"%c Chat %c":"Chat"}function Q(){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 Z={arguments2String(i){let n="";if(1===i.length)n=i[0];else for(let t=0,e=i.length;t<e;t++)V(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){W()?P[t](X(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",Q(),e):P[t](`${X()} ${Q()} `+e)},d:function(){var t;z<=-1&&(t=this.arguments2String(arguments),this._exec("debug",t))},l:function(){var t;z<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},log:function(){var t;z<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},i:function(){var t;z<=1&&(t=this.arguments2String(arguments),this._exec("info",t))},w:function(){var t;z<=2&&(t=this.arguments2String(arguments),this._exec("warn",t))},e:function(){var t;z<=3&&(t=this.arguments2String(arguments),this._exec("error",t))},setLevel:function(t){t<4&&this._exec("log","set level from "+z+" to "+t),z=t},getLevel:function(){return z}};class et extends Error{constructor(t){super();var{code:t,message:e,data:i}=t;this.code=t,e?this.message=e:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=i||{}}}const it=2903,nt=3122,st=8010,ot=8011,at=8020,rt="error";let gt=null;const ct=function(t,e=!1){if(t instanceof et)return e&&null!==gt&&gt.emit(rt,t),Promise.reject(t);if(t instanceof Error){const t=new et({code:it});return e&&null!==gt&&gt.emit(rt,t),Promise.reject(t)}if(J(t)||J(t.code))return Promise.reject(new et({code:it}));t=new et(t);return e&&null!==gt&&gt.emit(rt,t),Promise.reject(t)},lt="newInvitationReceived",ht="ts_invitee_accepted",ut="ts_invitee_rejected",_t="ts_invitation_cancelled",dt="ts_invitation_timeout",It="ts_invitation_modified",mt=1,ft=2,vt=3,pt=4,Dt=5;class St{constructor(t){this._n="RemoteSignalingHandler",this._sigM=t}onNewMessageList(t){t.forEach(t=>{var e=this.getPayloadData(t);e&&this._handleActionType(e,t)})}onMessageModified(t){t.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 Z.e(i+" JSON parse error. signalingData:"+e),null}}_handleActionType(t,e){var i=t["actionType"];switch(i){case mt:this._onNewInvitationReceived(t,e);break;case pt:this._onInviteeRejected(t);break;case vt:this._onInviteeAccepted(t);break;case ft:this._onInvitationCancelled(t);break;case Dt:this._onInvitationTimeout(t)}}_genBaseEmitData(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(Z.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(lt,{...this._genBaseEmitData(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);Z.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),o&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(ut,{...this._genBaseEmitData(t),invitee:t.inviteeList[0]}))}_onInviteeAccepted(t){var e=this._n+"._onInviteeAccepted",{inviteID:i,inviter:n,groupID:s}=t,o=this._sigM.hasInviteInfo(i);Z.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),o&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(ht,{...this._genBaseEmitData(t),invitee:t.inviteeList[0]}))}_onInvitationCancelled(t){var e=this._n+"._onInvitationCancelled",{inviteID:i,inviter:n,groupID:s}=t,o=this._sigM.hasInviteInfo(i);Z.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),o&&(this._sigM.deleteInviteInfo(i),this._sigM.emitEvent(_t,this._genBaseEmitData(t)))}_onInvitationTimeout(t){var e=this._n+"._onInvitationTimeout",{inviteID:i,inviter:n,groupID:s,inviteeList:o}=t,a=this._sigM.hasInviteInfo(i);Z.l(e+` inviteID:${i} hasInviteID:${a} inviter:${n} groupID:${s} data:`+t.data),a&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(dt,{...this._genBaseEmitData(t),inviteeList:o,isSelfTimeout:!1}))}_onInvitationModified(t,e){var i=this._n+"._onInvitationModified",{inviteID:n,data:s}=t;Z.l(i+` inviteID:${n} data:`+s),this._sigM.setInviteInfo(n,{...t,message:e}),this._sigM.emitEvent(It,{inviteID:n,data:s})}}const Mt=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},yt=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 Ct{constructor(t){this._n="LocalSignalingHandler",this._sigM=t}generateInviteID(){var t=function(){const t=Mt,e=yt;return e(t(32),8)+"-"+e(t(16),4)+"-"+e(16384|t(12),4)+"-"+e(32768|t(14),4)+"-"+e(t(48),12)}();return Z.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._sigM.createSignaling(t,i),inviteID:e}}_genBaseCustomData(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._genBaseCustomData(t),actionType:mt,inviter:s,inviteeList:n?t.inviteeList:[e],timeout:i};return Z.l(this._n+".createInviteCustomData customData:",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._genBaseCustomData(t),actionType:ft,groupID:o,inviter:s,inviteeList:i}:Z.e(e+` unmatched inviter:${a} and my userID:`+s),Z.l(e+" customData:",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._genBaseCustomData(t),actionType:vt,groupID:a,inviter:o,inviteeList:[s]}:Z.e(e+` userID:${s} not in inviteeList. inviteID:${i} groupID:`+a),Z.l(e+" customData:",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._genBaseCustomData(t),actionType:pt,groupID:a,inviter:o,inviteeList:[s]}:Z.e(e+` userID:${s} not in inviteeList. inviteID:${i} groupID:`+a),Z.l(e+" customData:",n),n}createTimeoutCustomData(t){var e=this._n+".createTimeoutCustomData",{inviteeList:i,inviter:n,isInviter:s=!1}=t,o=this._sigM.getMyUserID(),t={...this._genBaseCustomData(t),actionType:Dt,inviter:n,inviteeList:s?i:[o]};return Z.l(e+" customData:",t),t}}class wt{constructor(t){this._n="HistorySignalingHandler",this._sigM=t,this.COUNT=20,this.EXPIRED_TIME=300,this._map=new Map,this._relatedToMeMap=new Map}setCloudConfig(t=20,e=300){this.COUNT=t,this.EXPIRED_TIME=e,Z.l(this._n+`.setCloudConfig count:${t}, time:`+e)}getHistorySignaling(){var t=this._sigM.get(i).getLocalConvList();q(t)||(this._getC2CSignalingList(),t=this._getValidGroupConvList(t),this._getGroupSignalingList(t).then(t=>{this._handleSignalingList(t)}))}_getC2CSignalingList(){var t=this._sigM.get(e).getMessageListFromUnreadDB(),t=this._sigM.filterMessageList(t);this._getRelatedToMeMap(t)}_getGroupSignalingList(t){t=this._createPromiseList(t);return 0===t.length?Promise.resolve(this._sortSignaling(this._relatedToMeMap)):this._concurrentGetMessageList(t).then(t=>{let e=new Map;return t.forEach(t=>{t=t.list,t=this._getRelatedToMeMap(t);e=new Map([...e,...t])}),this._sortSignaling(e)})}_handleSignalingList(t){q(t)||this._sigM.onNewMessageList(t)}_getValidGroupConvList(i){const n=[];for(let t=0,e=i.length;t<e;t++){var{type:s,unreadCount:o,lastMessage:a}=i[t],s=s===R,a=this._isNotExpired(a);s&&o&&a&&n.push(i[t])}return n}_isNotExpired(t){return!(!t||!t.lastTime)&&t.lastTime>b()-this.EXPIRED_TIME}_createPromiseList(e){const n=[];for(let t=0;t<e.length;t++){var{conversationID:s,unreadCount:o}=e[t],o=o<this.COUNT?o:this.COUNT,o=(this._map.set(s,{msgCount:o,list:[]}),this._sigM.get(i).getMessageList({conversationID:s}));n.push(o)}return n}_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._map})}_relayGetMessageList(t){var{messageList:t,nextReqMessageID:e,isCompleted:n}=t;if(0===t.length)return null;var t=t[0]["conversationID"],s=this._map.get(t)["msgCount"];return 0===s||n?null:this._sigM.get(i).getMessageList({conversationID:t,nextReqMessageID:e,count:s})}_handleMessageList(t){const e=t.length,i=t[0]["conversationID"],{msgCount:n,list:s}=this._map.get(i),o=0<n-e?n-e:0;this._map.set(i,{msgCount:o,list:s.concat(this._sigM.filterMessageList(t))})}_getRelatedToMeMap(e){for(let t=0;t<e.length;t++){var i=e[t];this._saveRelatedToMe(i)}return this._relatedToMeMap}_saveRelatedToMe(t){var{actionType:e="",inviteID:i=""}=this._sigM.getPayloadData(t)||{};switch(e){case mt:this._setHistoryInvite(t);break;case pt:case vt:this._updateHistoryInvite(t);break;case ft:this._delHistoryInvite(i);break;case Dt:this._updateHistoryInvite(t)}}_setHistoryInvite(t){const e=this._sigM.getPayloadData(t)||{},{inviteID:i="",inviteeList:n=[],timeout:s=0}=e,o=this._sigM.getMyUserID();var a;n.includes(o)&&(a=b()-t.time,0<s&&s<a&&0!==s||this._relatedToMeMap.set(i,{...e,messageList:[t]}))}_delHistoryInvite(t){this._relatedToMeMap.has(t)&&this._relatedToMeMap.delete(t)}_updateHistoryInvite(t){const e=this._sigM.getPayloadData(t)||{},{inviteID:i="",inviteeList:n=[]}=e;if(this._relatedToMeMap.has(i)){const{inviteeList:e,messageList:s}=this._relatedToMeMap.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._delHistoryInvite(i):s.push(t)}else this._delHistoryInvite(i)}_sortSignaling(t){let e=[];return t.forEach(t=>{e=[...e,...t.messageList]}),e.sort((t,e)=>t.time-e.time)}reset(){this._map.clear(),this._relatedToMeMap.clear()}}class Tt{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||mt,this.timeout=t.timeout||0}}const Et={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG_UPDATED:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"};class Lt extends class{constructor(t){this._m=t,this._n=""}isLoggedIn(){return this._m.get(n).isLoggedIn()}isOversea(){return this._m.get(n).isOversea()}isPrivateNetWork(){return this._m.get(n).isPrivateNetWork()}getFileDownloadProxy(){return this._m.get(n).getFileDownloadProxy()}getMyUserID(){return this._m.get(n).getUserID()}getMyTinyID(){return this._m.get(n).getTinyID()}getSDKAppID(){return this._m.get(n).getSDKAppID()}isIntl(){return this._m.get(n).isIntl()}isUsingChatCore(){return this._m.get(n).isUsingChatCore()}isDevMode(){return this._m.get(n).isDevMode()}get(t){return this._m.get(t)}getPlatform(){return w}getCloudConfig(t){return this._m.get(o).getCloudConfig(t)}emitOEvt(t,e){this._m.getOEmitInst().emit(t,e)}emitIEvt(t,e){this._m.getIEmitInst().emit(t,e)}getIEmitInst(){return this._m.getIEmitInst()}generateTjgID(t){return this._m.get(n).getTinyID()+"-"+t.random}req(t){return this._m.get(s).req(t)}canIUse(t){return this._m.get(a).canIUse(t)}getErrMsg(t,e,i){return this._m.getErrMsg(t,e,i)}warn(t,e,i){t=this.getErrMsg(t,e,i);t&&Z.w(t)}noUse(t){var e=nt;return ct({code:e,message:this.getErrMsg(e,t)})}}{constructor(t){super(t),this._n="SignalingModule",this._inviteInfoMap=new Map,this._canIUseSignaling=!1,this._isHandling=!1,this._remoteSignalingHandler=new St(this),this._localSignalingHandler=new Ct(this),this._historySignalingHandler=new wt(this),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1,this._isCloudConfigCompleted=!1;const e=this.getIEmitInst();e.on(Et.C2C_UNREAD_HANDLE_COMPLETED,this.onC2CUnreadHandleCompleted,this),e.on(Et.CONV_SYNC_COMPLETED,this.onConvSyncCompleted,this),e.on(Et.CLOUD_CONFIG_UPDATED,this.onCloudConfigUpdated,this)}onC2CUnreadHandleCompleted(){this._isC2CUnreadHandleCompleted=!0,this._isCloudConfigCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}onConvSyncCompleted(){this._isConvSyncCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isCloudConfigCompleted&&!this._isSyncCompleted&&this.onReady()}onCloudConfigUpdated(){this._isCloudConfigCompleted=!0;let t=this.getCloudConfig("history_s_count"),e=this.getCloudConfig("history_s_time");J(t)||(t=Number(t)),J(e)||(e=Number(e)),this._historySignalingHandler.setCloudConfig(t,e),this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}_isListenerExisted(){return-1<this._m.getOEmitInst().eventNames().indexOf(lt)}onReady(){this._isSyncCompleted=!0;var t=this._isListenerExisted();Z.l(this._n+".onReady. isListenerExisted: "+t),t&&this._historySignalingHandler.getHistorySignaling()}onNewMessageList(t){t=this.filterMessageList(t);if(0<t.length)return this._remoteSignalingHandler.onNewMessageList(t)}onMessageModified(t){t=this.filterMessageList(t);if(0<t.length)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;Z.l(this._n+`.setInviteInfo inviteID:${t} data:`,n),this._inviteInfoMap.set(t,{...n,message:i})}deleteInviteInfo(t){this.hasInviteInfo(t)&&(Z.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(Z.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),Z.l(e+` remove ${t}. localInviteeList.length:`+n.length)),0===n.length&&this.deleteInviteInfo(i)}else this.deleteInviteInfo(i)}canIUseSignaling(){return this._canIUseSignaling}emitEvent(t,e){this.emitOEvt(t,e)}addSignalingListener(t,e,i){this._canIUseSignaling||(this._canIUseSignaling=!0),this._m.getOEmitInst().on(t,e,i)}removeSignalingListener(t,e,i){this._m.getOEmitInst().off(t,e,i),this._isListenerExisted()||(this._canIUseSignaling=!1)}invite(t){const e=this._n+".invite",{message:i,customData:n,inviteID:s}=this._localSignalingHandler.createInviteInfo(t);return Z.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=>ct(t))}inviteSync(t,e,i){const n=this._n+".inviteSync",{message:s,customData:o,inviteID:a}=this._localSignalingHandler.createInviteInfo(t);return Z.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),ct(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(Z.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return ct({code:at});this._isHandling=!0;const i=this._localSignalingHandler.createCancelCustomData(e);if(!i)return this._isHandling=!1,ct({code:ot});var{groupID:t,inviteeList:n}=i,t=t||n[0],n=this.createSignaling(i,t);return this.sendSignaling(n,e).then(t=>(this._handleImResponse(i,t,!0),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>ct(t))}accept(e){var t=this._n+".accept";if(Z.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return ct({code:st});this._isHandling=!0;const i=this._localSignalingHandler.createAcceptCustomData(e);if(!i)return this._isHandling=!1,ct({code:ot});t=this.createSignaling(i);return this.sendSignaling(t,e).then(t=>(this._handleImResponse(i,t),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>ct(t))}reject(e){var t=this._n+".reject";if(Z.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return ct({code:st});this._isHandling=!0;const i=this._localSignalingHandler.createRejectCustomData(e);if(!i)return this._isHandling=!1,ct({code:ot});t=this.createSignaling(i);return this.sendSignaling(t,e).then(t=>(this._handleImResponse(i,t,!0),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>ct(t))}getSignalingInfo(t){const e=this._n+".getSignalingInfo",{ID:i,from:n,to:s}=t,o=this._filterSignaling(t);let a=null;if(o){const e=this.getPayloadData(t);a=new Tt(e)}t=o?"actionType:"+a.actionType:"";return Z.l(e+` messageID:${i} from:${n} to:${s} ${t} isSignaling:`+o),a}modifyInvitation(e){const{inviteID:i,data:n}=e;if(!this.hasInviteInfo(e.inviteID)||this._isHandling)return ct({code:st});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(t).modifyRemoteMessage(s).then(t=>(this.setInviteInfo(i,{...o,message:s}),this._isHandling=!1,t)).catch(t=>(this._isHandling=!1,s.payload.data=a,ct(t)))}_genMsgCtrlInfo(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===Dt){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(e,i){return this.get(t).sendMessageInstance(e,this._genMsgCtrlInfo(i)).catch(t=>(this._isHandling=!1,ct(t)))}filterMessageList(t){return t.filter(t=>this._filterSignaling(t))}getPayloadData(t){return this._remoteSignalingHandler.getPayloadData(t)}createSignaling(e,i){var{groupID:n,inviter:s}=e,i={to:i||n||s,conversationType:n?R:H,priority:$,payload:{data:JSON.stringify(e)}},s=this.get(t).createCustomMessage(i);return Z.l(this._n+".createSignaling. message:",s),s}_filterSignaling(t){let e=!1;if(t.type&&t.type===U){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(Z.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),Z.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 Z.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);Z.l(this._n+`._sendTimeoutNotice inviteID:${s} to:${e} isInviter:`+o);const a=this._localSignalingHandler.createTimeoutCustomData({...t,isInviter:o}),r=this.createSignaling(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(dt,{data:t,groupID:e,inviteID:s,inviteeList:i,inviter:n,isSelfTimeout:!0,message:r}),o?this.deleteInviteInfo(s):this.updateInviteInfo(a)}})}reset(){Z.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,this._isCloudConfigCompleted=!1}}export{Lt as default};
"use strict";const t=2,e=6,i=11,n=12,s=20,o=23,a=27;class r{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 g={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"}}},c={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19},l="CHINA",h={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(t=l){this.CURRENT=g.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",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},u=(new r(0,Math.pow(2,1)).toString(),new r(0,Math.pow(2,2)).toString(),new r(0,Math.pow(2,3)).toString(),new r(0,Math.pow(2,4)).toString(),new r(0,Math.pow(2,6)).toString(),new r(0,Math.pow(2,7)).toString(),new r(0,Math.pow(2,9)).toString(),new r(0,Math.pow(2,10)).toString(),new r(0,Math.pow(2,11)).toString(),new r(0,Math.pow(2,13)).toString(),new r(0,Math.pow(2,15)).toString(),new r(Math.pow(2,6)).toString(),new r(Math.pow(2,7)).toString(),new r(Math.pow(2,8)).toString(),new r(Math.pow(2,9)).toString(),new r(Math.pow(2,10)).toString(),new r(Math.pow(2,16)).toString(),new r(Math.pow(2,20)).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),I="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),m="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&&"object"==typeof wx.miniapp,D=u||_||d||I||m||v||f,S=("undefined"!=typeof uni||"undefined"!=typeof window)&&!D,M=(_?qq:d?tt:I?swan:m?my:u?wx:v?uni:f&&jd,S&&window&&window.navigator&&window.navigator.userAgent||""),y=/(micromessenger|webbrowser)/i.test(M),C=/AppleWebKit\/([\d.]+)/i.exec(M),w=(C&&parseFloat(C.pop()),function(){let t="WEB";return y?t="WEB":_?t="QQ_MP":d?t="TT_MP":I?t="BAIDU_MP":m?t="ALI_MP":u?t=p?"DONUT_NATIVE_APP":"WX_MP":v&&(t="UNI_NATIVE_APP"),c[t]}()),T=(!function(){var t=M.match(/OS (\d+)_/i);t&&t[1]&&t[1]}(),function(){var t,e,i=M.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=M.match(/Chrome\/(\d+)/);t&&t[1]&&parseFloat(t[1])}(),/MSIE/.test(M)||-1<M.indexOf("Trident")&&-1<M.indexOf("rv:11.0"));let E,L;!function(){var t=/MSIE\s(\d+)\.\d/.exec(M),t=t&&parseFloat(t[1]);!t&&/Trident\/7.0/i.test(M)&&/rv:11.0/.test(M)}(),function(){var t=M.match(/TBS\/(\d+)/i);t&&t[1]&&t[1]}(),E="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const A=function(){},N=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let O=N.length;for(;O--;)L=N[O],console[L]||(E[L]=A);var P=E;const U="TIMCustomElem",$="High",H="C2C",R="GROUP",F=function(){return(new Date).getTime()+0},x=function(){const t=new Date;return t.setTime(F()),t},b=function(){return Math.floor(F()/1e3)},G=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(K(t)){for(const e in t)if(G.call(t,e))return!1;return!0}return!!(B(t)||j(t)||k(t))&&0===t.size}const B=function(t){return"map"===Y(t)},j=function(t){return"set"===Y(t)},k=function(t){return"file"===Y(t)},K=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},J=function(t){return void 0===t},V=function(t){return e=t,("function"==typeof Array.isArray?Array.isArray(e):"array"===Y(e))||null!==t&&"object"==typeof t;var e},Y=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()};function W(){return!T&&!D}Date.now||(Date.now=function(){return(new Date).getTime()});let z=0;function X(){return W()?"%c Chat %c":"Chat"}function Q(){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 Z={arguments2String(i){let n="";if(1===i.length)n=i[0];else for(let t=0,e=i.length;t<e;t++)V(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){W()?P[t](X(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",Q(),e):P[t](`${X()} ${Q()} `+e)},d:function(){var t;z<=-1&&(t=this.arguments2String(arguments),this._exec("debug",t))},l:function(){var t;z<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},log:function(){var t;z<=0&&(t=this.arguments2String(arguments),this._exec("log",t))},i:function(){var t;z<=1&&(t=this.arguments2String(arguments),this._exec("info",t))},w:function(){var t;z<=2&&(t=this.arguments2String(arguments),this._exec("warn",t))},e:function(){var t;z<=3&&(t=this.arguments2String(arguments),this._exec("error",t))},setLevel:function(t){t<4&&this._exec("log","set level from "+z+" to "+t),z=t},getLevel:function(){return z}};class et extends Error{constructor(t){super();var{code:t,message:e,data:i}=t;this.code=t,e?this.message=e:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=i||{}}}const it=2903,nt=3122,st=8010,ot=8011,at=8020,rt="error";let gt=null;const ct=function(t,e=!1){if(t instanceof et)return e&&null!==gt&&gt.emit(rt,t),Promise.reject(t);if(t instanceof Error){const t=new et({code:it});return e&&null!==gt&&gt.emit(rt,t),Promise.reject(t)}if(J(t)||J(t.code))return Promise.reject(new et({code:it}));t=new et(t);return e&&null!==gt&&gt.emit(rt,t),Promise.reject(t)},lt="newInvitationReceived",ht="ts_invitee_accepted",ut="ts_invitee_rejected",_t="ts_invitation_cancelled",dt="ts_invitation_timeout",It="ts_invitation_modified",mt=1,ft=2,vt=3,pt=4,Dt=5;class St{constructor(t){this._n="RemoteSignalingHandler",this._sigM=t}onNewMessageList(t){t.forEach(t=>{var e=this.getPayloadData(t);e&&this._handleActionType(e,t)})}onMessageModified(t){t.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 Z.e(i+" JSON parse error. signalingData:"+e),null}}_handleActionType(t,e){var i=t["actionType"];switch(i){case mt:this._onNewInvitationReceived(t,e);break;case pt:this._onInviteeRejected(t);break;case vt:this._onInviteeAccepted(t);break;case ft:this._onInvitationCancelled(t);break;case Dt:this._onInvitationTimeout(t)}}_genBaseEmitData(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(Z.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(lt,{...this._genBaseEmitData(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);Z.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),o&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(ut,{...this._genBaseEmitData(t),invitee:t.inviteeList[0]}))}_onInviteeAccepted(t){var e=this._n+"._onInviteeAccepted",{inviteID:i,inviter:n,groupID:s}=t,o=this._sigM.hasInviteInfo(i);Z.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),o&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(ht,{...this._genBaseEmitData(t),invitee:t.inviteeList[0]}))}_onInvitationCancelled(t){var e=this._n+"._onInvitationCancelled",{inviteID:i,inviter:n,groupID:s}=t,o=this._sigM.hasInviteInfo(i);Z.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),o&&(this._sigM.deleteInviteInfo(i),this._sigM.emitEvent(_t,this._genBaseEmitData(t)))}_onInvitationTimeout(t){var e=this._n+"._onInvitationTimeout",{inviteID:i,inviter:n,groupID:s,inviteeList:o}=t,a=this._sigM.hasInviteInfo(i);Z.l(e+` inviteID:${i} hasInviteID:${a} inviter:${n} groupID:${s} data:`+t.data),a&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(dt,{...this._genBaseEmitData(t),inviteeList:o,isSelfTimeout:!1}))}_onInvitationModified(t,e){var i=this._n+"._onInvitationModified",{inviteID:n,data:s}=t;Z.l(i+` inviteID:${n} data:`+s),this._sigM.setInviteInfo(n,{...t,message:e}),this._sigM.emitEvent(It,{inviteID:n,data:s})}}const Mt=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},yt=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 Ct{constructor(t){this._n="LocalSignalingHandler",this._sigM=t}generateInviteID(){var t=function(){const t=Mt,e=yt;return e(t(32),8)+"-"+e(t(16),4)+"-"+e(16384|t(12),4)+"-"+e(32768|t(14),4)+"-"+e(t(48),12)}();return Z.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._sigM.createSignaling(t,i),inviteID:e}}_genBaseCustomData(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._genBaseCustomData(t),actionType:mt,inviter:s,inviteeList:n?t.inviteeList:[e],timeout:i};return Z.l(this._n+".createInviteCustomData customData:",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._genBaseCustomData(t),actionType:ft,groupID:o,inviter:s,inviteeList:i}:Z.e(e+` unmatched inviter:${a} and my userID:`+s),Z.l(e+" customData:",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._genBaseCustomData(t),actionType:vt,groupID:a,inviter:o,inviteeList:[s]}:Z.e(e+` userID:${s} not in inviteeList. inviteID:${i} groupID:`+a),Z.l(e+" customData:",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._genBaseCustomData(t),actionType:pt,groupID:a,inviter:o,inviteeList:[s]}:Z.e(e+` userID:${s} not in inviteeList. inviteID:${i} groupID:`+a),Z.l(e+" customData:",n),n}createTimeoutCustomData(t){var e=this._n+".createTimeoutCustomData",{inviteeList:i,inviter:n,isInviter:s=!1}=t,o=this._sigM.getMyUserID(),t={...this._genBaseCustomData(t),actionType:Dt,inviter:n,inviteeList:s?i:[o]};return Z.l(e+" customData:",t),t}}class wt{constructor(t){this._n="HistorySignalingHandler",this._sigM=t,this.COUNT=20,this.EXPIRED_TIME=300,this._map=new Map,this._relatedToMeMap=new Map}setCloudConfig(t=20,e=300){this.COUNT=t,this.EXPIRED_TIME=e,Z.l(this._n+`.setCloudConfig count:${t}, time:`+e)}getHistorySignaling(){var t=this._sigM.get(i).getLocalConvList();q(t)||(this._getC2CSignalingList(),t=this._getValidGroupConvList(t),this._getGroupSignalingList(t).then(t=>{this._handleSignalingList(t)}))}_getC2CSignalingList(){var t=this._sigM.get(e).getMessageListFromUnreadDB(),t=this._sigM.filterMessageList(t);this._getRelatedToMeMap(t)}_getGroupSignalingList(t){t=this._createPromiseList(t);return 0===t.length?Promise.resolve(this._sortSignaling(this._relatedToMeMap)):this._concurrentGetMessageList(t).then(t=>{let e=new Map;return t.forEach(t=>{t=t.list,t=this._getRelatedToMeMap(t);e=new Map([...e,...t])}),this._sortSignaling(e)})}_handleSignalingList(t){q(t)||this._sigM.onNewMessageList(t)}_getValidGroupConvList(i){const n=[];for(let t=0,e=i.length;t<e;t++){var{type:s,unreadCount:o,lastMessage:a}=i[t],s=s===R,a=this._isNotExpired(a);s&&o&&a&&n.push(i[t])}return n}_isNotExpired(t){return!(!t||!t.lastTime)&&t.lastTime>b()-this.EXPIRED_TIME}_createPromiseList(e){const n=[];for(let t=0;t<e.length;t++){var{conversationID:s,unreadCount:o}=e[t],o=o<this.COUNT?o:this.COUNT,o=(this._map.set(s,{msgCount:o,list:[]}),this._sigM.get(i).getMessageList({conversationID:s}));n.push(o)}return n}_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._map})}_relayGetMessageList(t){var{messageList:t,nextReqMessageID:e,isCompleted:n}=t;if(0===t.length)return null;var t=t[0]["conversationID"],s=this._map.get(t)["msgCount"];return 0===s||n?null:this._sigM.get(i).getMessageList({conversationID:t,nextReqMessageID:e,count:s})}_handleMessageList(t){const e=t.length,i=t[0]["conversationID"],{msgCount:n,list:s}=this._map.get(i),o=0<n-e?n-e:0;this._map.set(i,{msgCount:o,list:s.concat(this._sigM.filterMessageList(t))})}_getRelatedToMeMap(e){for(let t=0;t<e.length;t++){var i=e[t];this._saveRelatedToMe(i)}return this._relatedToMeMap}_saveRelatedToMe(t){var{actionType:e="",inviteID:i=""}=this._sigM.getPayloadData(t)||{};switch(e){case mt:this._setHistoryInvite(t);break;case pt:case vt:this._updateHistoryInvite(t);break;case ft:this._delHistoryInvite(i);break;case Dt:this._updateHistoryInvite(t)}}_setHistoryInvite(t){const e=this._sigM.getPayloadData(t)||{},{inviteID:i="",inviteeList:n=[],timeout:s=0}=e,o=this._sigM.getMyUserID();var a;n.includes(o)&&(a=b()-t.time,0<s&&s<a&&0!==s||this._relatedToMeMap.set(i,{...e,messageList:[t]}))}_delHistoryInvite(t){this._relatedToMeMap.has(t)&&this._relatedToMeMap.delete(t)}_updateHistoryInvite(t){const e=this._sigM.getPayloadData(t)||{},{inviteID:i="",inviteeList:n=[]}=e;if(this._relatedToMeMap.has(i)){const{inviteeList:e,messageList:s}=this._relatedToMeMap.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._delHistoryInvite(i):s.push(t)}else this._delHistoryInvite(i)}_sortSignaling(t){let e=[];return t.forEach(t=>{e=[...e,...t.messageList]}),e.sort((t,e)=>t.time-e.time)}reset(){this._map.clear(),this._relatedToMeMap.clear()}}class Tt{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||mt,this.timeout=t.timeout||0}}const Et={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"};class Lt extends class{constructor(t){this._m=t,this._n=""}isLoggedIn(){return this._m.get(n).isLoggedIn()}isOversea(){return this._m.get(n).isOversea()}isPrivateNetWork(){return this._m.get(n).isPrivateNetWork()}getFileDownloadProxy(){return this._m.get(n).getFileDownloadProxy()}getMyUserID(){return this._m.get(n).getUserID()}getMyTinyID(){return this._m.get(n).getTinyID()}getSDKAppID(){return this._m.get(n).getSDKAppID()}isIntl(){return this._m.get(n).isIntl()}isUsingChatCore(){return this._m.get(n).isUsingChatCore()}isDevMode(){return this._m.get(n).isDevMode()}get(t){return this._m.get(t)}getPlatform(){return w}getCloudConfig(t){return this._m.get(o).getCloudConfig(t)}emitOEvt(t,e){this._m.getOEmitInst().emit(t,e)}emitIEvt(t,e){this._m.getIEmitInst().emit(t,e)}getIEmitInst(){return this._m.getIEmitInst()}generateTjgID(t){return this._m.get(n).getTinyID()+"-"+t.random}req(t){return this._m.get(s).req(t)}canIUse(t){return this._m.get(a).canIUse(t)}getErrMsg(t,e,i){return this._m.getErrMsg(t,e,i)}warn(t,e,i){t=this.getErrMsg(t,e,i);t&&Z.w(t)}noUse(t){var e=nt;return ct({code:e,message:this.getErrMsg(e,t)})}}{constructor(t){super(t),this._n="SignalingModule",this._inviteInfoMap=new Map,this._canIUseSignaling=!1,this._isHandling=!1,this._remoteSignalingHandler=new St(this),this._localSignalingHandler=new Ct(this),this._historySignalingHandler=new wt(this),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1,this._isCloudConfigCompleted=!1;const e=this.getIEmitInst();e.on(Et.C2C_UNREAD_HANDLE_COMPLETED,this.onC2CUnreadHandleCompleted,this),e.on(Et.CONV_SYNC_COMPLETED,this.onConvSyncCompleted,this),e.on(Et.CLOUD_CONFIG,this.onCloudConfig,this)}onC2CUnreadHandleCompleted(){this._isC2CUnreadHandleCompleted=!0,this._isCloudConfigCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}onConvSyncCompleted(){this._isConvSyncCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isCloudConfigCompleted&&!this._isSyncCompleted&&this.onReady()}onCloudConfig(){this._isCloudConfigCompleted=!0;let t=this.getCloudConfig("history_s_count"),e=this.getCloudConfig("history_s_time");J(t)||(t=Number(t)),J(e)||(e=Number(e)),this._historySignalingHandler.setCloudConfig(t,e),this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}_isListenerExisted(){return-1<this._m.getOEmitInst().eventNames().indexOf(lt)}onReady(){this._isSyncCompleted=!0;var t=this._isListenerExisted();Z.l(this._n+".onReady. isListenerExisted: "+t),t&&this._historySignalingHandler.getHistorySignaling()}onNewMessageList(t){t=this.filterMessageList(t);if(0<t.length)return this._remoteSignalingHandler.onNewMessageList(t)}onMessageModified(t){t=this.filterMessageList(t);if(0<t.length)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;Z.l(this._n+`.setInviteInfo inviteID:${t} data:`,n),this._inviteInfoMap.set(t,{...n,message:i})}deleteInviteInfo(t){this.hasInviteInfo(t)&&(Z.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(Z.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),Z.l(e+` remove ${t}. localInviteeList.length:`+n.length)),0===n.length&&this.deleteInviteInfo(i)}else this.deleteInviteInfo(i)}canIUseSignaling(){return this._canIUseSignaling}emitEvent(t,e){this.emitOEvt(t,e)}addSignalingListener(t,e,i){this._canIUseSignaling||(this._canIUseSignaling=!0),this._m.getOEmitInst().on(t,e,i)}removeSignalingListener(t,e,i){this._m.getOEmitInst().off(t,e,i),this._isListenerExisted()||(this._canIUseSignaling=!1)}invite(t){const e=this._n+".invite",{message:i,customData:n,inviteID:s}=this._localSignalingHandler.createInviteInfo(t);return Z.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=>ct(t))}inviteSync(t,e,i){const n=this._n+".inviteSync",{message:s,customData:o,inviteID:a}=this._localSignalingHandler.createInviteInfo(t);return Z.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),ct(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(Z.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return ct({code:at});this._isHandling=!0;const i=this._localSignalingHandler.createCancelCustomData(e);if(!i)return this._isHandling=!1,ct({code:ot});var{groupID:t,inviteeList:n}=i,t=t||n[0],n=this.createSignaling(i,t);return this.sendSignaling(n,e).then(t=>(this._handleImResponse(i,t,!0),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>ct(t))}accept(e){var t=this._n+".accept";if(Z.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return ct({code:st});this._isHandling=!0;const i=this._localSignalingHandler.createAcceptCustomData(e);if(!i)return this._isHandling=!1,ct({code:ot});t=this.createSignaling(i);return this.sendSignaling(t,e).then(t=>(this._handleImResponse(i,t),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>ct(t))}reject(e){var t=this._n+".reject";if(Z.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return ct({code:st});this._isHandling=!0;const i=this._localSignalingHandler.createRejectCustomData(e);if(!i)return this._isHandling=!1,ct({code:ot});t=this.createSignaling(i);return this.sendSignaling(t,e).then(t=>(this._handleImResponse(i,t,!0),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>ct(t))}getSignalingInfo(t){const e=this._n+".getSignalingInfo",{ID:i,from:n,to:s}=t,o=this._filterSignaling(t);let a=null;if(o){const e=this.getPayloadData(t);a=new Tt(e)}t=o?"actionType:"+a.actionType:"";return Z.l(e+` messageID:${i} from:${n} to:${s} ${t} isSignaling:`+o),a}modifyInvitation(e){const{inviteID:i,data:n}=e;if(!this.hasInviteInfo(e.inviteID)||this._isHandling)return ct({code:st});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(t).modifyRemoteMessage(s).then(t=>(this.setInviteInfo(i,{...o,message:s}),this._isHandling=!1,t)).catch(t=>(this._isHandling=!1,s.payload.data=a,ct(t)))}_genMsgCtrlInfo(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===Dt){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(e,i){return this.get(t).sendMessageInstance(e,this._genMsgCtrlInfo(i)).catch(t=>(this._isHandling=!1,ct(t)))}filterMessageList(t){return t.filter(t=>this._filterSignaling(t))}getPayloadData(t){return this._remoteSignalingHandler.getPayloadData(t)}createSignaling(e,i){var{groupID:n,inviter:s}=e,i={to:i||n||s,conversationType:n?R:H,priority:$,payload:{data:JSON.stringify(e)}},s=this.get(t).createCustomMessage(i);return Z.l(this._n+".createSignaling. message:",s),s}_filterSignaling(t){let e=!1;if(t.type&&t.type===U){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(Z.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),Z.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 Z.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);Z.l(this._n+`._sendTimeoutNotice inviteID:${s} to:${e} isInviter:`+o);const a=this._localSignalingHandler.createTimeoutCustomData({...t,isInviter:o}),r=this.createSignaling(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(dt,{data:t,groupID:e,inviteID:s,inviteeList:i,inviter:n,isSelfTimeout:!0,message:r}),o?this.deleteInviteInfo(s):this.updateInviteInfo(a)}})}reset(){Z.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,this._isCloudConfigCompleted=!1}}export{Lt as default};
{
"name": "@tencentcloud/chat",
"version": "3.4.0",
"version": "3.4.1",
"description": "Tencent Cloud Chat SDK for Web",
"main": "index.js",
"keywords": ["chat", "real-time chat", "messaging", "Instant Messaging", "IM", "Tencent Cloud", "Tencent"],
"keywords": ["chat", "real-time chat", "messaging", "Instant Messaging", "IM", "Tencent Cloud", "Tencent RTC"],
"repository": {
"type": "git",
"url": "https://github.com/TencentCloud/chat-uikit-react.git"
"url": "https://trtc.io/products/chat"
},

@@ -11,0 +11,0 @@ "author": "Tencent Cloud Terminal R&D Center",

@@ -6,8 +6,18 @@

[Tencent Cloud Chat](https://www.tencentcloud.com/products/im) provides globally interconnected chat APIs, multi-platform SDKs, and UIKit components to help you quickly bring messaging capabilities such as one-to-one chat, group chat, chat rooms, and system notifications to your applications and websites.
[Tencent Cloud Chat](https://trtc.io/products/chat) provides globally interconnected chat APIs, multi-platform SDKs, and UIKit components to help you quickly bring messaging capabilities such as one-to-one chat, group chat, chat rooms, and system notifications to your applications and websites.
👉🏻 [Free Demo](https://web.sdk.qcloud.com/im/demo/intl/index.html)
## Benefits
### Higher Engagement with Our Feature-rich Chat
<img src="https://trtc.io/_next/static/media/pic1.3de62d45.png?auto=format&fit=max&w=3840" width=580 height=360 />
📄 [Documentation](https://www.tencentcloud.com/document/product/1047/34309)
### Manage Groups and Conversations at Ease
<img src="https://trtc.io/_next/static/media/pic2.55b58e0d.png?auto=format&fit=max&w=3840" width=580 height=360 />
### Build Your Own Chat App in just One Day
<img src="https://trtc.io/_next/static/media/pic3.a1b13e76.png?auto=format&fit=max&w=3840" width=580 height=360 />
👉🏻 [Free Demo](https://trtc.io/demo/homepage/#/detail?scene=messenger)
📄 [Documentation](https://trtc.io/document/50061?platform=web&product=chat)
## Global Compliance Certifications

@@ -38,51 +48,40 @@ <table>

<img src="https://staticintl.cloudcachetci.com/cms/backend-cms/5a5n391_APP%E5%86%85%E8%81%8A%E5%A4%A9%402x.png" width=730 height=410 />
## Use Cases
Empower chat messaging across applications to create one-to-one chats, group chats, and on-screen commenting and support multiple messages types such as text, images, audio and video messages.
### Social
Build real-time community interactions in your app using a simple chat API.
✓Various message types ✓Announcement ✓Group chat
<img src="https://trtc.io/_next/static/media/group1.3289e577.png?auto=format&fit=max&w=3840" width=588 height=602 />
<img src="https://staticintl.cloudcachetci.com/cms/backend-cms/f8XS294_AudioVideoCall.jpg" width=730 height=410 />
### Live
Welcome a large audience to your immersive live show using a simple chat API.
✓Unlimited participants ✓Interactive live streaming ✓Online chat
Integrate audio/video call capabilities into your app with a few lines of code through audio/video UI components. Offline call push is also supported to allow your app users get every calls.
<img src="https://trtc.io/_next/static/media/group6.3937f7d8.png?auto=format&fit=max&w=3840" width=588 height=602 />
### Metaverse
Bridge the limitless virtual and physical worlds using simple chat SDKs.
✓Chat in metaverse ✓User profile and management ✓Immersive interactions
<img src="https://staticintl.cloudcachetci.com/cms/backend-cms/cNAS158_Live%20Streamingjpg.jpg" width=730 height=410 />
<img src="https://trtc.io/_next/static/media/group5.6975e625.png?auto=format&fit=max&w=3840" width=588 height=602 />
Chat supports audio-video groups with unlimited number of members, providing chat, like, gift giving, following, group member management and other functions to help you achieve in-app live streaming.
### Gaming
Intensify gaming with real-time chat engagement using a simple chat API.
✓Chat in game ✓Global message access ✓User profile and management
## Scenarios
<img src="https://trtc.io/_next/static/media/group4.0361228f.png?auto=format&fit=max&w=3840" width=588 height=602 />
- Interactive Live Streaming
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/HY4F687_%E4%BA%92%E5%8A%A8%E7%9B%B4%E6%92%AD%402x.jpg" width=730 height=410 />
### Education
Create interactive virtual classrooms with real-time chat experiences using simple chat SDK and API.
✓Class start notifications ✓Student management ✓Class messages
- Social Messaging
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/m9yR325_%E7%A4%BE%E4%BA%A4%E6%B2%9F%E9%80%9A%402x.jpg" width=730 height=410 />
<img src="https://trtc.io/_next/static/media/group2.08a44cc6.png?auto=format&fit=max&w=3840" width=588 height=602 />
- Influencer Marketing
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/VtQ5764_%E7%94%B5%E5%95%86%E5%B8%A6%E8%B4%A7%402x.jpg" width=730 height=410 />
### On-demand Service
Resolve order issues with in-app conversations quickly, with simple SDK and API.
✓Customer service support ✓Order cancellations minimization ✓Social features
- Interactive Game
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/XubI769_%E4%BA%92%E5%8A%A8%E6%B8%B8%E6%88%8F%402x.jpg" width=730 height=410 />
<img src="https://trtc.io/_next/static/media/group3.45675954.png?auto=format&fit=max&w=3840" width=588 height=602 />
- Customer Service
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/L7Q6912_%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%402x.jpg" width=730 height=410 />
- Education
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/dkIZ813_%E5%9C%A8%E7%BA%BF%E6%95%99%E8%82%B2%402x.jpg" width=730 height=410 />
- Healthcare
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/77Ds965_%E5%9C%A8%E7%BA%BF%E5%8C%BB%E7%96%97%402x.jpg" width=730 height=410 />
- Smart Device
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/yMRc936_%E6%99%BA%E8%83%BD%E8%AE%BE%E5%A4%87%402x%20%281%29.jpg" width=730 height=410 />
- OA
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/nXQN331_%E4%BC%81%E4%B8%9A%E5%8A%9E%E5%85%AC%402x.jpg" width=730 height=410 />
- Meeting
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/24ZF778_%E5%9C%A8%E7%BA%BF%E4%BC%9A%E8%AE%AE%402x.jpg" width=730 height=410 />
- Private Cloud Deployment
<img src="https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/aL7m811_%E7%A7%81%E6%9C%89%E5%8C%96%E9%83%A8%E7%BD%B2%402x.jpg" width=730 height=410 />
## Installation

@@ -123,3 +122,3 @@

UserSig is a password used to log in to Tencent Cloud Chat. It is the ciphertext obtained after data such as UserID is encrypted. This [document](https://www.tencentcloud.com/document/product/1047/34385) describes how to generate a UserSig.
UserSig is a password used to log in to Tencent Cloud Chat. It is the ciphertext obtained after data such as UserID is encrypted. This [document](https://trtc.io/document/34385) describes how to generate a UserSig.

@@ -209,2 +208,2 @@ ### 2. Listen to the SDK_READY event

| iOS Safari | 7 or higher |
| Android Browswer | 4.4 (Kitkat) or higher |
| Android Browswer | 4.4 (Kitkat) or higher |

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