"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 c={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT0:"wss://*w4c.my-imcloud.com",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:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT0:"wss://*w4s.my-imcloud.com",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:{DEFAULT0:"wss://*w4k.my-imcloud.com",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:{DEFAULT0:"wss://*w4g.my-imcloud.com",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:{DEFAULT0:"wss://*w4i.my-imcloud.com",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:{DEFAULT0:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT0:"wss://*w4u.my-imcloud.com",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:{DEFAULT0:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},g={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},l="CHINA",h={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(t=l){this.CURRENT=c.PRODUCTION[t]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GRP:"group_open_http_svc",GRP_AV:"group_open_avchatroom_http_svc",GRP_COMMUNITY:"million_group_open_http_svc",GRP_ATTR:"group_open_attr_http_svc",FD:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GRP_NO_AUTH:"group_open_http_noauth_svc",BIG_GRP_POLLING:"group_open_long_polling_http_svc",BIG_GRP_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MSG:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate",IM_OPEN_SPEECH:"im_open_speech",MSG_SEARCH:"message_search",FOLLOW:"follow",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)),d=(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),m="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),I="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,v="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,p=u&&"object"==typeof wx.miniapp,D=u||d||_||m||I||v||f,S="undefined"==typeof window&&!D&&"undefined"!=typeof global&&void 0!==global.NativeScriptGlobals,y="undefined"!=typeof global&&(void 0!==global.nativeModuleProxy||void 0!==global.ReactNative),M="undefined"!=typeof uni?!D:"undefined"!=typeof window&&!D&&!y,C=(d?qq:_?tt:m?swan:I?my:u?wx:v?uni:f&&jd,M&&window&&window.navigator&&window.navigator.userAgent||""),w=/(micromessenger|webbrowser)/i.test(C),T=function(){let t="WEB";return w?t="WEB":d?t="QQ_MP":_?t="TT_MP":m?t="BAIDU_MP":I?t="ALI_MP":u?t=p?"DONUT_NATIVE_APP":"WX_MP":v?t="UNI_NATIVE_APP":S?t="NS_NATIVE_APP":y&&(t="RN_NATIVE_APP"),g[t]}(),E=(!function(){var t=C.match(/OS (\d+)_/i);t&&t[1]&&t[1]}(),function(){var t,e,i=C.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])}(),/MSIE/.test(C)||-1{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 et.e(i+" JSON parse error. signalingData:"+e),null}}_handleActionType(t,e){var i=t["actionType"];switch(i){case ft:this._onNewInvitationReceived(t,e);break;case Dt:this._onInviteeRejected(t);break;case pt:this._onInviteeAccepted(t);break;case vt:this._onInvitationCancelled(t);break;case St: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:a}=t,r=this._sigM.getMyUserID(),g=s.includes(r);let l=t.timeout;var c=(x().getTime()-1e3*e.time)/1e3,h=(0c&&(l-=c),i+` myselfIncluded:${g} groupID:${o} signalObj:`+JSON.stringify(t));if(et.l(h+` timeout:${l}s delta:${c}s`),o&&g||!o){const i=this._sigM.getInviteInfo(n);i&&i===t||(i||this._sigM.setInviteInfo(n,{...t,message:e}),this._sigM.emitEvent(ht,{...this._genBaseEmitData(t),inviteeList:s}),a!==r&&this._sigM.startTimer({...t,timeout:l}))}}_onInviteeRejected(t){var e=this._n+"._onInviteeRejected",{inviteID:i,inviter:n,groupID:s}=t,o=this._sigM.hasInviteInfo(i);et.l(e+` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:`+s),o&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(dt,{...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);et.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]}))}_onInvitationCancelled(t){var e=this._n+"._onInvitationCancelled",{inviteID:i,inviter:n,groupID:s}=t,o=this._sigM.hasInviteInfo(i);et.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);et.l(e+` inviteID:${i} hasInviteID:${a} inviter:${n} groupID:${s} data:`+t.data),a&&(this._sigM.updateInviteInfo(t),this._sigM.emitEvent(mt,{...this._genBaseEmitData(t),inviteeList:o,isSelfTimeout:!1}))}_onInvitationModified(t,e){var i=this._n+"._onInvitationModified",{inviteID:n,data:s}=t;et.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){var e;return t<0||53>>30-t)},Ct=function(t,e){let i=t.toString(16),n=e-i.length,s="0";for(;0>>=1,s+=s)1&n&&(i=s+i);return i};class wt{constructor(t){this._n="LocalSignalingHandler",this._sigM=t}generateInviteID(){t=Mt;var t,e=(e=Ct)(t(32),8)+"-"+e(t(16),4)+"-"+e(16384|t(12),4)+"-"+e(32768|t(14),4)+"-"+e(t(48),12);return et.l(this._n+".generateInviteID inviteID:"+e),e}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:ft,inviter:s,inviteeList:n?t.inviteeList:[e],timeout:i};return et.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:vt,groupID:o,inviter:s,inviteeList:i}:et.e(e+` unmatched inviter:${a} and my userID:`+s),et.l(e+" customData:",n),n}createAcceptCustomData(t){var e=this._n+".createAcceptCustomData",i=t["inviteID"];let n;var 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]}:et.e(e+` userID:${s} not in inviteeList. inviteID:${i} groupID:`+a),et.l(e+" customData:",n),n}createRejectCustomData(t){var e=this._n+".createRejectCustomData",i=t["inviteID"];let n;var s=this._sigM.getMyUserID(),{inviter:o,groupID:a,inviteeList:r}=this._sigM.getInviteInfo(i);return r.includes(s)?n={...this._genBaseCustomData(t),actionType:Dt,groupID:a,inviter:o,inviteeList:[s]}:et.e(e+` userID:${s} not in inviteeList. inviteID:${i} groupID:`+a),et.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:St,inviter:n,inviteeList:s?i:[o]};return et.l(e+" customData:",t),t}}class Tt{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,et.l(this._n+`.setCloudConfig count:${t}, time:`+e)}getHistorySignaling(){var t=this._sigM.get(i).getLocalConvList();B(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){B(t)||this._sigM.onNewMessageList(t)}_getValidGroupConvList(i){var n=[];for(let t=0,e=i.length;tG()-this.EXPIRED_TIME}_createPromiseList(e){var n=[];for(let t=0;t{for(let t=0;t{e=[...e,...t.messageList]}),e.sort((t,e)=>t.time-e.time)}reset(){this._map.clear(),this._relatedToMeMap.clear()}}class Et{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||ft,this.timeout=t.timeout||0}}const At={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(){var t=this._m.get(n);return t.isPrivateNetWork()&&!t.getFileDownloadProxy()}getFileDownloadProxy(){return this._m.get(n).getFileDownloadProxy()}getDowloadFileAuthKey(){return this._m.get(n).getDowloadFileAuthKey()}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 T}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()}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&&et.w(t)}noUse(t){var e=st;return lt({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 yt(this),this._localSignalingHandler=new wt(this),this._historySignalingHandler=new Tt(this),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1,this._isCloudConfigCompleted=!1;t=this.getIEmitInst();t.on(At.C2C_UNREAD_HANDLE_COMPLETED,this.onC2CUnreadHandleCompleted,this),t.on(At.CONV_SYNC_COMPLETED,this.onConvSyncCompleted,this),t.on(At.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-1t&&0===t.code?(this.setInviteInfo(s,{...n,message:i}),this.startTimer({...n,inviteID:s}),{...t,inviteID:s}):t).catch(t=>lt(t))}inviteSync(t,e,i){const n=this._n+".inviteSync",{message:s,customData:o,inviteID:a}=this._localSignalingHandler.createInviteInfo(t);return et.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),lt(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,i=this._n+".cancel";if(et.l(i+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return lt({code:rt});this._isHandling=!0;const n=this._localSignalingHandler.createCancelCustomData(e);return n?({groupID:i,inviteeList:t}=n,i=i||t[0],t=this.createSignaling(n,i),this.sendSignaling(t,e).then(t=>(this._handleImResponse(n,t,!0),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>lt(t))):(this._isHandling=!1,lt({code:at}))}accept(e){var t=this._n+".accept";if(et.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return lt({code:ot});this._isHandling=!0;const i=this._localSignalingHandler.createAcceptCustomData(e);return i?(t=this.createSignaling(i),this.sendSignaling(t,e).then(t=>(this._handleImResponse(i,t),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>lt(t))):(this._isHandling=!1,lt({code:at}))}reject(e){var t=this._n+".reject";if(et.l(t+" options:"+JSON.stringify(e)),!this.hasInviteInfo(e.inviteID)||this._isHandling)return lt({code:ot});this._isHandling=!0;const i=this._localSignalingHandler.createRejectCustomData(e);return i?(t=this.createSignaling(i),this.sendSignaling(t,e).then(t=>(this._handleImResponse(i,t,!0),0===t.code?{...t,inviteID:e.inviteID}:t)).catch(t=>lt(t))):(this._isHandling=!1,lt({code:at}))}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 Et(e)}t=o?"actionType:"+a.actionType:"";return et.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 lt({code:ot});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,lt(t)))}_genMsgCtrlInfo(t={}){var{data:e="",onlineUserOnly:t,inviteID:i="",offlinePushInfo:n,actionType:s}=t;let o={_onlineOnlyFlag:!1};i={onlineUserOnly:(o=i&&this.getInviteInfo(i)?this.getInviteInfo(i).message:o)._onlineOnlyFlag||t||!1,offlinePushInfo:n,messageControlInfo:{excludedFromContentModeration:!0,excludedFromUnreadCount:!1,excludedFromLastMessage:!1}};if(s===St){const t=!!e.match(/excludeTimeoutSignalingFromHistoryMessage/);i.messageControlInfo.excludedFromUnreadCount=t,i.messageControlInfo.excludedFromLastMessage=t}else{t=!!e.match(/excludeFromHistoryMessage/),n=!!e.match(/excludeOriginalSignalingFromHistoryMessage/);i.messageControlInfo.excludedFromUnreadCount=t||n,i.messageControlInfo.excludedFromLastMessage=t||n}return i}sendSignaling(e,i){return this.get(t).sendMessageInstance(e,this._genMsgCtrlInfo(i)).catch(t=>(this._isHandling=!1,lt(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?F:H,priority:R,payload:{data:JSON.stringify(e)}},s=this.get(t).createCustomMessage(i);return et.l(this._n+".createSignaling. message:",s),s}_filterSignaling(t){let e=!1;var i,n;return t.type&&t.type===$&&({cloudCustomData:t="",payload:{data:n=""}}=t,t=t.match(/"type":"tsignaling"/),i=n.match(/inviteID/),n=n.match(/actionType/),e=t||i&&n),!!e}startTimer(i){const n=this._n+".startTimer",{timeout:t,inviteID:s,inviter:e,groupID:o}=i,a=e===this.getMyUserID();if(et.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{if(t&&0===t.code){const{data:t,groupID:e,inviteeList:i,inviter:n}=a;this.emitEvent(mt,{data:t,groupID:e,inviteID:s,inviteeList:i,inviter:n,isSelfTimeout:!0,message:r}),o?this.deleteInviteInfo(s):this.updateInviteInfo(a)}})}reset(){et.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};