"use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.websdk=t():e.websdk=t()}(self,(function(){return(self.webpackChunkwebsdk=self.webpackChunkwebsdk||[]).push([[564],{7479:function(e,t,r){r.r(t),r.d(t,{acceptContactInvite:function(){return J},acceptInvitation:function(){return D},addContact:function(){return L},addConversationMark:function(){return ge},addReaction:function(){return te},addToBlackList:function(){return H},addUsersToBlacklist:function(){return K},addUsersToBlocklist:function(){return V},declineContactInvite:function(){return F},declineInvitation:function(){return q},deleteAllMessagesAndConversations:function(){return Se},deleteContact:function(){return X},deleteConversation:function(){return w},deleteReaction:function(){return re},deleteSession:function(){return N},fetchHistoryMessages:function(){return x},fetchUserInfoById:function(){return M},getAllContacts:function(){return he},getBlacklist:function(){return k},getBlocklist:function(){return E},getContacts:function(){return A},getContactsWithCursor:function(){return fe},getConversationlist:function(){return R},getHistoryMessages:function(){return B},getReactionDetail:function(){return oe},getReactionList:function(){return ae},getReactionlist:function(){return ne},getRoster:function(){return I},getSelfIdsOnOtherPlatform:function(){return Te},getServerConversations:function(){return ce},getServerConversationsByFilter:function(){return ye},getServerPinnedConversations:function(){return le},getServerPinnedMessages:function(){return Ae},getSessionList:function(){return j},getTokenExpireTimestamp:function(){return Z},modifyMessage:function(){return ee},pinConversation:function(){return pe},pinMessage:function(){return Ee},recallMessage:function(){return $},removeConversationMark:function(){return ve},removeFromBlackList:function(){return W},removeHistoryMessages:function(){return ie},removeRoster:function(){return G},removeUserFromBlackList:function(){return Q},removeUserFromBlocklist:function(){return Y},reportMessage:function(){return se},setContactRemark:function(){return de},unbindPushToken:function(){return _e},unpinMessage:function(){return Ie},updateCurrentUserNick:function(){return O},updateOwnUserInfo:function(){return P},updateUserInfo:function(){return U},uploadPushToken:function(){return C},uploadToken:function(){return _}}),r(9601),r(1539),r(8674),r(2526),r(1817),r(2165),r(6992),r(8783),r(3948),r(9554),r(4747),r(2222),r(7941),r(6699),r(3710),r(9714),r(9600),r(5069),r(561),r(9753),r(8309),r(1249),r(7327);var a=r(3246),n=r(5531),o=r(7252),s=r(4024),i=r(9937),c=r(8161),u=r(4188),l=r.n(u),p=r(7360),d=r(1595),h=r(4363),f=r(7288),m=r(9743),g=r(6801),v=function(){return v=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&e.pageSize>0),f={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(this.user,"/user_channels").concat(h?"/page":""),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return h&&(f.data={pageNum:e.pageNum,pageSize:e.pageSize}),p.kg.debug("Call getConversationlist"),s.hj.call(this,f,d.fI.GET_SESSION_LIST).then((function(e){return b.call(t,e)}))}function b(e){var t=this,r=e.data.channel_infos;return null==r||r.forEach((function(e){e.meta&&"{}"!==JSON.stringify(e.meta)?(e.meta.payload=JSON.parse(e.meta.payload),e.lastMessage=h.w.call(t,e.meta,{formatCustomExts:!1})):e.lastMessage=e.meta,delete e.meta})),e}function N(e){if(e&&"string"!=typeof e.channel)throw Error("Invalid parameter channel: ".concat(e.channel));if(e&&"singleChat"!==e.chatType&&"groupChat"!==e.chatType)throw Error("Invalid parameter chatType: ".concat(e.chatType));if(e&&"boolean"!=typeof e.deleteRoam)throw Error("Invalid parameter deleteRoam: ".concat(e.deleteRoam));if(!a.XZ.call(this)){var t=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r,i=this.context,c=i.orgName,u=i.appName,l=i.accessToken,h=i.jid;r="singleChat"===e.chatType?"chat":"groupChat";var f={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/user/").concat(this.user,"/user_channel?resource=").concat(h.clientResource),dataType:"json",type:"DELETE",data:JSON.stringify({channel:e.channel,type:r,delete_roam:e.deleteRoam}),headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"},success:e.success,error:e.error};return p.kg.debug("Call deleteSession",e),s.hj.call(this,f,d.fI.DELETE_SESSION)}var w=N;function P(e,t){if(!a.XZ.call(this)){var r=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var i=this.context,c=i.orgName,u=i.appName,l=i.accessToken,h=["nickname","avatarurl","mail","phone","gender","sign","birth","ext"],f={},m=s.P6.getEnvInfo();if("wx"===m.platform||"qq"===m.platform)if("string"==typeof e&&void 0!==t){if(!h.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");f[e]=t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");h.forEach((function(t){h.includes(t)&&void 0!==e[t]&&(f[t]=e[t])}))}else if("string"==typeof e){if(!h.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");f=e+"="+t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");var g=[];h.forEach((function(t){if(h.includes(t)&&void 0!==e[t]){var r=encodeURIComponent(t),a=encodeURIComponent(e[t]);g.push(r+"="+a)}})),f=g.join("&")}var v={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/metadata/user/").concat(this.user),type:"PUT",data:f,dataType:"json",headers:{Authorization:"Bearer "+l,"Content-Type":"application/x-www-form-urlencoded"}};return p.kg.debug("Call updateOwnUserInfo",e),s.hj.call(this,v,d.fI.UPDATE_USER_INFO)}var U=P;function M(e,t){if(!a.XZ.call(this)){var r=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var i,c=this.context,u=c.orgName,l=c.appName,h=c.accessToken,f=[];if("string"==typeof e)f=[e];else{if("[object Array]"!==Object.prototype.toString.call(e))throw new Error("illegal params");f=e}i="string"==typeof t?[t]:t&&"[object Array]"===Object.prototype.toString.call(t)?t:["nickname","avatarurl","mail","phone","gender","sign","birth","ext"];var m={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/metadata/user/get"),type:"POST",data:JSON.stringify({targets:f,properties:i}),dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return p.kg.debug("Call fetchUserInfoById",e),s.hj.call(this,m,d.fI.GET_USER_INFO)}function O(e){if(!a.XZ.call(this)){var t=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,i=r.orgName,c=r.appName,u=r.accessToken,l={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(c,"/users/").concat(this.user),type:"PUT",dataType:"json",data:JSON.stringify({nickname:e}),headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}};return p.kg.debug("Call updateCurrentUserNick",e),s.hj.call(this,l)}function Z(e){if("string"!=typeof e||""===e)throw Error('Invalid parameter: "token"');var t=this.context,r=t.orgName,a=t.appName,n={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(a,"/sdk/users/").concat(this.user,"/token/expires"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json"}};return p.kg.debug("Call getTokenExpireTimestamp",e),s.hj.call(this,n,d.fI.SDK_INTERNAL)}function x(e){var t=this;return new Promise((function(r,s){if(!e.queue)throw Error('Invalid parameter: "specified"');if(!a.XZ.call(t)){var i=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(i)}(function e(t){var a=this,n=t.count||20;z.call(this,{count:n,isGroup:!!t.isGroup,queue:t.queue,start:t.start,format:t.format,success:function(o){if(o.msgs.length>=n||o.is_last){var s=o.msgs.splice(0,n).reverse();t.success&&t.success(s),r(s)}else e.call(a,v(v({},t),{start:null}))},fail:function(e){s(e),t.fail&&t.fail(e)}})}).call(t,e),p.kg.debug("Call fetchHistoryMessages",e)}))}function z(e){var t=this,r=e.queue,a=this.mr_cache[r]||(this.mr_cache[r]={msgs:[]}),i=this.context.userId,u=e.start||-1,p=e.count||20;if(a.msgs.length>=p||a.is_last)"function"==typeof e.success&&e.success(a);else{a&&a.next_key&&(u=a.next_key),e.start&&(u=e.start);var h={queue:r+(e.isGroup?"@conference.easemob.com":"@easemob.com"),start:u,end:-1},f=this.context,m=f.orgName,g=f.appName,v={url:"".concat(this.apiUrl,"/").concat(m,"/").concat(g,"/users/").concat(i,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"},data:JSON.stringify(h),success:function(r){return y(t,void 0,void 0,(function(){var t,n,o,s,i,u,p=this;return T(this,(function(d){switch(d.label){case 0:if(t=null==r?void 0:r.data,!r.data.msgs)return"function"==typeof e.success&&e.success(a),a.is_last=!0,a.next_key="",[2];n=t.msgs,o=n.length,a.is_last=t.is_last,a.next_key=t.next_key,s=function(t){return y(p,void 0,void 0,(function(){var r,a,n,o,s;return T(this,(function(i){switch(i.label){case 0:for(r=[],t=l().atob(t),a=0,n=t.length;a18))throw Error('"Invalid parameter beforeTimeStamp": '+e.beforeTimeStamp);if(e.messageIds&&!(Array.isArray(e.messageIds)&&e.messageIds.length>0&&e.messageIds.length<=20))throw Error('"Invalid parameter messageIds": '+e.messageIds);if(!e.messageIds&&!e.beforeTimeStamp)throw Error("messageIds or beforeTimeStamp field is required.");return a.XZ.call(this)?(i=this.context,c=i.orgName,u=i.appName,l=i.userId,d="singleChat"===e.chatType?"userId":"groupId",h="singleChat"===e.chatType?"chat":"group",f=e.messageIds?"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/message/roaming/").concat(h,"/user/").concat(l,"?").concat(d,"=").concat(e.targetId,"&msgIdList=").concat(e.messageIds,"&resource=").concat(this.clientResource):"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/message/roaming/").concat(h,"/user/").concat(l,"/time?").concat(d,"=").concat(e.targetId,"&delTime=").concat(e.beforeTimeStamp,"&&resource=").concat(this.clientResource),m={url:f,dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"}},p.kg.debug("Call removeHistoryMessages",e),[4,s.hj.call(this,m)]):(r=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(r)]);case 1:return g.sent(),[2]}}))}))}function ce(e){var t=this;if(!a.XZ.call(this)){var r=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));var i=this.context,c=i.orgName,u=i.appName,l=i.accessToken,h={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",need_mark:!0},headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}};return p.kg.debug("Call getServerConversations",e),new Promise((function(e,r){s.hj.call(t,h,d.fI.GET_SESSION_LIST).then((function(r){return y(t,void 0,void 0,(function(){var t,a,n=this;return T(this,(function(o){switch(o.label){case 0:return t=ue.call(this,r),this._localCache?(a=t.data.conversations.map((function(e){return y(n,void 0,void 0,(function(){var t,r,a,n;return T(this,(function(o){switch(o.label){case 0:return[4,null===(r=null===(t=this._localCache)||void 0===t?void 0:t.getInstance())||void 0===r?void 0:r.storeMessage(e.lastMessage,f.r.SUCCESS,!0)];case 1:return o.sent(),[4,null===(n=null===(a=this._localCache)||void 0===a?void 0:a.getInstance())||void 0===n?void 0:n.updateLocalConversation((0,m.MQ)({conversationId:e.conversationId,conversationType:e.conversationType}),{unReadCount:e.unReadCount})];case 2:return o.sent(),[2]}}))}))})),[4,Promise.all(a)]):[3,2];case 1:o.sent(),o.label=2;case 2:return e(t),[2]}}))}))})).catch((function(e){r(e)}))}))}function ue(e){var t=this,r=e.data,a=r.cursor,n=r.channel_infos,o=[];null==n||n.forEach((function(e){var r=null;(null==e?void 0:e.meta)&&"{}"!==JSON.stringify(e.meta)&&(e.meta.payload=JSON.parse(e.meta.payload),"delivery"!==(r=h.w.call(t,e.meta)).type&&"read"!==r.type&&"channel"!==r.type&&(r.chatType=h.U[r.chatType]));var a={conversationId:e.session_to,conversationType:"chat"===e.session_type?"singleChat":"groupChat",isPinned:e.is_top,pinnedTime:e.is_top?e.update_top_status_time:0,unReadCount:e.unread_num,lastMessage:r};e.marks&&(a.marks=e.marks.map((function(e){return i.Z[e]}))),o.push(a)}));var s={conversations:o,cursor:a||""};return{type:e.type,data:s}}function le(e){var t=this;if(!a.XZ.call(this)){var r=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));var i=this.context,c=i.orgName,u=i.appName,l=i.accessToken,h={url:"".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",is_top:!0,need_mark:!0},headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"}};return p.kg.debug("Call getServerPinnedConversations",e),s.hj.call(this,h,d.fI.GET_SESSION_LIST).then((function(e){return ue.call(t,e)}))}function pe(e){return y(this,void 0,void 0,(function(){var t,r,i,c,u,l,h,f,m,g,v,y,S,k;return T(this,(function(T){if(!a.XZ.call(this))return t=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)];if(r=e.conversationId,i=e.conversationType,c=e.isPinned,u="singleChat"===i?"chat":"groupChat","string"!=typeof r||""===r)throw Error("Invalid parameter conversationId: ".concat(r));if(!["singleChat","groupChat"].includes(i))throw Error("Invalid parameter conversationType: ".concat(i));if("boolean"!=typeof c)throw Error("Invalid parameter isPinned: ".concat(c));return l=this.context,h=l.orgName,f=l.appName,m=l.accessToken,g=l.jid,v={type:u,to:r},y=c?"":"type=".concat(u,"&to=").concat(r,"&"),S="".concat(this.apiUrl,"/").concat(h,"/").concat(f,"/sdk/user/").concat(this.user,"/user_channel/top?").concat(y,"resource=").concat(g.clientResource),k={url:S,type:c?"POST":"DELETE",dataType:"json",headers:{Authorization:"Bearer "+m,"Content-Type":"application/json"}},c&&(k.data=JSON.stringify(v)),p.kg.debug("Call pinConversation",e),[2,s.hj.call(this,k,d.fI.PIN_CONVERSATION).then((function(e){var t=e.type,r=e.data;return{type:t,data:{isPinned:r.is_top||!1,pinnedTime:r.is_top?r.update_top_status_time:0}}}))]}))}))}function de(e){return y(this,void 0,void 0,(function(){var t,r,i,c,u,l,h,f,m,g;return T(this,(function(v){switch(v.label){case 0:if(t=e.userId,r=e.remark,!a.XZ.call(this))return i=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(i)];if("string"!=typeof t||""===t)throw Error('Invalid parameter: "userId"');if("string"!=typeof r)throw Error('Invalid parameter: "remark"');return p.kg.debug("Call setContactRemark",e),c=this.context,u=c.orgName,l=c.appName,h=c.accessToken,f=c.jid,m="".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/users/").concat(this.context.userId,"/contacts/users/").concat(t,"?resource=").concat(f.clientResource),g={url:m,type:"PUT",data:JSON.stringify({remark:r}),dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}},[4,s.hj.call(this,g,d.fI.ROSTER_SET_CONTACT_REMARK)];case 1:return v.sent(),[2]}}))}))}function he(){if(!a.XZ.call(this)){var e=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(e)}var t=this.context,r=t.orgName,i=t.appName,c=t.accessToken,u={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(i,"/users/").concat(this.user,"/contacts/users?needReturnRemark=true"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+c}};return p.kg.debug("Call getAllContacts"),s.hj.call(this,u,d.fI.ROSTER_GET_ALL_CONTACTS_REMARKS).then((function(e){var t=((null==e?void 0:e.entities)||[]).map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:t}}))}function fe(e){if(!a.XZ.call(this)){var t=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}p.kg.debug("Call getContactsWithCursor",e);var r=e||{},i=r.pageSize,c=void 0===i?20:i,u=r.cursor,l=void 0===u?"":u;if(c&&"number"!=typeof c)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));var h=this.context,f=h.orgName,m=h.appName,g=h.accessToken,v={url:"".concat(this.apiUrl,"/").concat(f,"/").concat(m,"/users/").concat(this.user,"/contacts?needReturnRemark=true&limit=").concat(c,"&cursor=").concat(l),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+g}};return s.hj.call(this,v,d.fI.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE).then((function(e){var t,r,a=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.contacts)||[],n=(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.cursor)||"",o=a.map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:{cursor:n,contacts:o}}}))}function me(e){return y(this,void 0,void 0,(function(){var t,r,c,u,l,f,m,g,v,y,k,E,I,A,_;return T(this,(function(T){switch(T.label){case 0:if(!a.XZ.call(this))return t=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)];if(p.kg.debug("Call markConversation",e),c=(r=e||{}).conversations,u=void 0===c?[]:c,l=r.mark,f=r.isMarked,!Array.isArray(u))throw Error("Invalid parameter conversations");if(m=u.map((function(e){if(!e.conversationId||!["singleChat","groupChat"].includes(e.conversationType))throw Error("Invalid parameter conversations");return{to:e.conversationId,type:S[e.conversationType]}})),"boolean"!=typeof f)throw Error("Invalid parameter isMarked: ".concat(f));if("number"!=typeof l)throw Error("Invalid parameter mark: ".concat(l));return g=this.context,v=g.orgName,y=g.appName,k=g.accessToken,E=g.userId,I=g.jid,A={mark:i.Z[l],targets:m},_={url:"".concat(this.apiUrl,"/").concat(v,"/").concat(y,"/sdk/user/").concat(E,"/user_channels/mark?resource=").concat(I.clientResource),dataType:"json",data:JSON.stringify(A),type:f?"Post":"Delete",headers:{Authorization:"Bearer "+k}},[4,s.hj.call(this,_,d.fI.MARK_CONVERSATION).then((function(e){var t,r=(null===(t=e.data)||void 0===t?void 0:t.ignore)||[];r&&Array.isArray(r)&&r.length>0&&p.kg.debug("markConversation has ignored conversations",r.map((function(e){return{conversationId:e.to,conversationType:h.U[e.type]}})))}))];case 1:return T.sent(),[2]}}))}))}function ge(e){return y(this,void 0,void 0,(function(){var t,r;return T(this,(function(a){return p.kg.debug("Call addConversationMark",e),t=e.conversations,r=e.mark,[2,me.call(this,{conversations:t,mark:r,isMarked:!0})]}))}))}function ve(e){return y(this,void 0,void 0,(function(){var t,r;return T(this,(function(a){return p.kg.debug("Call removeConversationMark",e),t=e.conversations,r=e.mark,[2,me.call(this,{conversations:t,mark:r,isMarked:!1})]}))}))}function ye(e){var t,r,c=this;if(!a.XZ.call(this)){var u=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(u)}if(p.kg.debug("Call getServerConversationsByFilter",e),(null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));if("number"!=typeof(null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.mark))throw Error("Invalid parameter mark: ".concat(null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.mark));var l=this.context,h=l.orgName,f=l.appName,m=l.accessToken,g="".concat(this.apiUrl,"/").concat(h,"/").concat(f,"/sdk/user/").concat(this.user,"/user_channels/mark/search?"),v=e.pageSize,y=e.cursor,T=((null==e?void 0:e.filter)||{}).mark,S={url:g,type:"GET",dataType:"json",data:{limit:v||10,cursor:y||"",need_mark:!0,mark:i.Z[T]},headers:{Authorization:"Bearer "+m,"Content-Type":"application/json"}};return s.hj.call(this,S,d.fI.GET_SESSION_LIST).then((function(e){return ue.call(c,e)}))}function Te(){if(!a.XZ.call(this)){var e=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(e)}p.kg.debug("Call getSelfIdsOnOtherPlatform");var t=this.context,r=t.orgName,i=t.appName,c=t.accessToken,u=t.userId,l=t.jid,h={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(i,"/users/").concat(u,"/resources"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return s.hj.call(this,h,d.fI.USER_LOGGEDIN_OTHER_PLATFORM).then((function(e){var t,r=null===(t=e.data)||void 0===t?void 0:t.filter((function(e){return e.res!==l.clientResource})),a=null==r?void 0:r.map((function(e){return"".concat(u,"/").concat(e.res)}));return{type:e.type,data:a}}))}function Se(){var e,t,r,i,c,u;return y(this,void 0,void 0,(function(){var l,h,f,m,g,v,y,S,k;return T(this,(function(T){switch(T.label){case 0:return a.XZ.call(this)?(p.kg.debug("Call deleteAllMessagesAndConversations"),h=this.context,f=h.orgName,m=h.appName,g=h.accessToken,v=h.userId,y=h.jid,S="".concat(this.apiUrl,"/").concat(f,"/").concat(m,"/sdk/message/roaming/user/").concat(v,"/delete/all?resource=").concat(y.clientResource),k={url:S,type:"POST",dataType:"json",headers:{Authorization:"Bearer "+g,"Content-Type":"application/json"}},[4,s.hj.call(this,k,d.fI.REST_DELETE_MESSAGES_CONVERSATIONS)]):(l=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(l)]);case 1:return T.sent(),null===(t=null===(e=this._localCache)||void 0===e?void 0:e.getInstance())||void 0===t||t.clearConversationMap(),[4,null===(i=null===(r=this._localCache)||void 0===r?void 0:r.getInstance())||void 0===i?void 0:i.clearStoreData("conversationList")];case 2:return T.sent(),[4,null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u?void 0:u.clearStoreData("message")];case 3:return T.sent(),[2]}}))}))}function ke(e){return y(this,void 0,void 0,(function(){var t,r,i,c,u,l,h,f,m,g,v,y,k,E,I;return T(this,(function(T){switch(T.label){case 0:if(!a.XZ.call(this))return t=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)];if(p.kg.debug("Call setMessagePinStatus",e),i=(r=e||{}).conversationId,c=void 0===i?"":i,u=r.conversationType,l=r.messageId,h=r.isPinned,"string"!=typeof c||""===c)throw Error("Invalid parameter conversationId");if("string"!=typeof l||""===l)throw Error("Invalid parameter messageId");if("boolean"!=typeof h)throw Error("Invalid parameter isPinned");return f=this.context,m=f.orgName,g=f.appName,v=f.accessToken,y=f.userId,k=f.jid,E={to:c,type:S[u],pin_msg_id:l},I={url:"".concat(this.apiUrl,"/").concat(m,"/").concat(g,"/sdk/user/").concat(y,"/user_channel/pin?resource=").concat(k.clientResource),dataType:"json",data:JSON.stringify(E),type:h?"Post":"Delete",headers:{Authorization:"Bearer "+v}},[4,s.hj.call(this,I,d.fI.REST_PIN_MESSAGE)];case 1:return T.sent(),[2]}}))}))}function Ee(e){return y(this,void 0,void 0,(function(){var t,r,a,n;return T(this,(function(o){return p.kg.debug("Call pinMessage",e),r=(t=e||{}).conversationType,a=t.conversationId,n=t.messageId,[2,ke.call(this,{conversationId:a,conversationType:r,messageId:n,isPinned:!0})]}))}))}function Ie(e){return y(this,void 0,void 0,(function(){var t,r,a,n;return T(this,(function(o){return p.kg.debug("Call unpinMessage",e),r=(t=e||{}).conversationType,a=t.conversationId,n=t.messageId,[2,ke.call(this,{conversationId:a,conversationType:r,messageId:n,isPinned:!1})]}))}))}function Ae(e){var t=this;if(!a.XZ.call(this)){var r=o.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}p.kg.debug("Call getServerPinnedMessages",e);var i=e.conversationId,c=e.conversationType,u=e.pageSize,l=e.cursor;if("string"!=typeof i||""===i)throw Error("Invalid parameter conversationId");if(u&&"number"!=typeof u)throw Error("Invalid parameter pageSize: ".concat(u));if(l&&"string"!=typeof l)throw Error("Invalid parameter cursor: ".concat(l));var f=this.context,m=f.orgName,g=f.appName,v=f.accessToken,y={url:"".concat(this.apiUrl,"/").concat(m,"/").concat(g,"/sdk/user/").concat(this.user,"/user_channel/pin"),type:"GET",dataType:"json",data:{to:i,type:S[c],limit:u||10,cursor:l||""},headers:{Authorization:"Bearer "+v,"Content-Type":"application/json"}};return s.hj.call(this,y,d.fI.GET_SESSION_LIST).then((function(e){return{type:0,data:{list:e.data.msg_infos.map((function(e){e.message.payload=JSON.parse(e.message.payload);var r=e.message,a=e.pin_opt_at,n=e.pin_operator;return{message:h.w.call(t,r,{formatChatType:!0}),pinTime:a,operatorId:n}})),cursor:e.data.cursor||""}}}))}function _e(){var e=this;p.kg.debug("Call unbindPushToken");var t={deviceId:this.clientResource,deviceToken:"",notifierName:this.pushCertificateName};return g.r.call(this,t).then((function(t){return e.isRegisterPush=!1,t}))}},5069:function(e,t,r){var a=r(2109),n=r(1702),o=r(3157),s=n([].reverse),i=[1,2];a({target:"Array",proto:!0,forced:String(i)===String(i.reverse())},{reverse:function(){return o(this)&&(this.length=this.length),s(this)}})}},function(e){return 7479,e(e.s=7479)}])}));