@tencentcloud/lite-chat
Version:
Tencent Cloud Chat SDK for Web/Mini Program/uni-app/React Native/Donut
2 lines (1 loc) • 21.3 kB
JavaScript
var t=new class{constructor(){this._conversationGroupMap=new Map}init(t){this._core=t}getConversationGroupMap(){return this._conversationGroupMap}getConversationGroup(t){return this._conversationGroupMap.get(t)}setConversationGroup(t,o){this._conversationGroupMap.set(t,o)}};function o(t,o,e,n){return new(e||(e=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function i(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var o;t.done?r(t.value):(o=t.value,o instanceof e?o:new e((function(t){t(o)}))).then(a,i)}c((n=n.apply(t,o||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const e=new class{init(t){this.core=t}},n="CONV_GROUP",r=2500,s=2503,a=1,i=2,c="NOT_STARTED",u="FETCHING",p="FINISHED",d="FAILED",v=0,l=1,C=1,h=2,m=3,f=1,I=2;function G(t){const{helper:o,constants:r}=e.core;if(!o.checkBusinessCapabilityBits(n))throw new o.ChatError({functionName:t,code:r.ERROR_CODE.NO_USE,replacement1:t})}function g(){const{notificationCenter:o,OuterEvent:n}=e.core;o.emitOuterEvent(n.CONVERSATION_GROUP_LIST_UPDATED,{name:n.CONVERSATION_GROUP_LIST_UPDATED,data:[...t.getConversationGroupMap().values()]})}function _(t){const{utils:{isUndefined:o},constants:{OuterConstant:n}}=e.core,{Type:r,To_Account:s,GroupId:c,ToGroupId:u=c,Peer_Account:p}=t;let d="";return r===a?o(p)?o(s)||(d=`${n.CONV_C2C}${s}`):d=`${n.CONV_C2C}${p}`:r===i&&(d=`${n.CONV_GROUP}${u}`),d}function D(t){const o=[],{OuterConstant:n,common:{isC2CConv:r,isGroupConv:s}}=e.core,{conversationIDList:c,failureConversationIDList:u,additionalData:p={}}=t;return c.forEach((t=>{L(t,u),r(t)?o.push(Object.assign({ContactItem:{Type:a,To_Account:t.replace(n.CONV_C2C,"")}},p)):s(t)&&o.push(Object.assign({ContactItem:{Type:i,ToGroupId:t.replace(n.CONV_GROUP,"")}},p))})),o}function L(t,o){const{appStore:{conversationStore:n},common:{isC2CConv:a,isGroupConv:i}}=e.core;n.getConversation(t)?a(t)||i(t)||o.push({conversationID:t,code:s}):o.push({conversationID:t,code:r})}function N(t){const{utils:{isString:o}}=e.core,n=[];if(!o(t))return n;const r=t.length;if(0===r)return n;for(let o=r-1;o>=0;o--)"1"===t[o]&&n.push(Math.pow(2,r-o-1));return n}function E(t){null==t||t.forEach(((o,n)=>{const{appStore:r}=e.core,{conversationID:s,data:a}=o,i=n===t.length-1;r.conversationStore.updateConversation(s,a,{emit:i})}))}function S(t){const{conversationInfoList:o,fromAccount:n}=t,r={From_Account:n,MarkItem:o};return e.core.common.buildAndSendPacket({servcmd:"recentcontact.mark_contact",data:r})}function O(t){const{fromAccount:o,groupName:n,conversationInfoList:r}=t,s={From_Account:o,UpdateType:1,UpdateGroup:{UpdateGroupType:I,OldGroupName:n,ContactUpdateItem:r}};return e.core.common.buildAndSendPacket({servcmd:"recentcontact.update_contact_group",data:s})}var R=new class{init(t){const{helper:{registerApi:o}}=t;this._core=t,o({apiName:"createConversationGroup",context:this})}createConversationGroup(n){return o(this,void 0,void 0,(function*(){const{utils:{isPlainObject:o,isArray:r},appStore:s,ssoLog:a}=this._core;G("createConversationGroup");const i=a.createSSOLogData({method:"createConversationGroup"});i.setLogInfo({message:JSON.stringify(n)});const{groupName:c,conversationIDList:u}=n,p=[],d=this._generateConversationInfo(u,p);if(p.length===u.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:p}};try{const n=yield function(t){const{common:{buildAndSendPacket:o,getCurrentUserID:n}}=e.core,{item:r,groupName:s}=t;return o({servcmd:"recentcontact.create_contact_group",data:{From_Account:n(),GroupContactItem:[{GroupName:s,ContactItem:r}]}})}({groupName:c,item:d});if(n){i.end();const{GroupResultItem:e=[]}=n,{GroupItem:a,ResultItem:u}=(null==e?void 0:e[0])||{},d=[];if(o(a)){const{GroupName:o,GroupId:e}=a;t.setConversationGroup(e,o),g()}if(r(u)){const t=[];u.forEach((o=>{const{ContactItem:e,ResultCode:n,ResultInfo:r}=o,a=_(e);if(0===n){const o=s.conversationStore.getConversation(a);if(o&&!o.conversationGroupList.includes(c)){const e=o.conversationGroupList.slice();e.push(c),t.push({conversationID:a,data:{conversationGroupList:e}})}}else p.push({conversationID:a,code:n,message:r})})),t.length>0&&(E(t),g())}return{code:0,data:{successConversationIDList:d,failureConversationIDList:p}}}}catch(t){const{errorCode:o,errorInfo:e}=t,n=new this._core.helper.ChatError({functionName:"createConversationGroup",code:o,message:e});throw i.setError(n).end(),n}}))}_generateConversationInfo(t,o,e={}){const n=[],{OuterConstant:r,common:{isC2CConv:s,isGroupConv:c}}=this._core;return t.forEach((t=>{L(t,o),s(t)?n.push(Object.assign({Type:a,To_Account:t.replace(r.CONV_C2C,"")},e)):c(t)&&n.push(Object.assign({Type:i,ToGroupId:t.replace(r.CONV_GROUP,"")},e))})),n}};var A=new class{constructor(){this._fetchConversationGroupStatus=c}init(t){const{helper:{registerApi:o,registerWorkflowStep:e},constants:{WORKFLOW_NAME:n,WORKFLOW_STEP:r}}=t;this._core=t,o({apiName:"getConversationGroupList",context:this}),e(n.SYNC_SERVER_INFO_AFTER_LOGIN,r.CONVERSATION_GROUP_LIST_SYNC,this._syncConversationGroupList,this),e(n.SYNC_SERVER_INFO_AFTER_LOGIN,r.CONVERSATION_GROUP_UPDATE,this._updateConversation,this)}getConversationGroupList(){return o(this,void 0,void 0,(function*(){return G("getConversationGroupList"),this._fetchConversationGroupStatus===d&&(yield this._fetchConversationGroupList(0)),{code:0,data:[...t.getConversationGroupMap().values()]}}))}_syncConversationGroupList(){return o(this,void 0,void 0,(function*(){return yield this._fetchConversationGroupList(0)}))}_fetchConversationGroupList(n){return o(this,arguments,void 0,(function*(o,n=[]){const{common:{getCurrentUserID:r},utils:{isArray:s}}=this._core;this._fetchConversationGroupStatus=u;try{const a=r(),i=yield function(t){const{fromAccount:o,startIndex:n}=t,r={From_Account:o,StartIndex:n};return e.core.common.buildAndSendPacket({servcmd:"recentcontact.get_contact_group",data:r})}({fromAccount:a,startIndex:o});if(i){const{CompleteFlag:o,ContactItem:e=[],NextStartIndex:r=0,GroupItem:a=[]}=i;if(s(a)&&a.forEach((o=>{const{GroupName:e,GroupId:n}=o;t.setConversationGroup(n,e)})),n.push(...e),o===v)return this._fetchConversationGroupList(r);if(o===l)return this._fetchConversationGroupStatus=p,n}}catch(t){this._fetchConversationGroupStatus=d,console.error(t)}}))}_updateConversation(t){var o;const{constants:{WORKFLOW_STEP:e}}=this._core,n=(null===(o=null==t?void 0:t.result)||void 0===o?void 0:o[e.CONVERSATION_GROUP_LIST_SYNC])||[];E(this._generateConversationUpdateFields(n)),g()}_generateConversationUpdateFields(o){const{utils:{isArray:e},appStore:n}=this._core,r=[];if(e(o)){let s;o.forEach((o=>{const a=[],{StandardMark:i,CustomMark:c="",ContactGroupId:u}=o;e(u)&&u.forEach((o=>{t.getConversationGroupMap().has(o)&&a.push(t.getConversationGroup(o))}));const p=_(o);s=n.conversationStore.getConversation(p),s&&r.push({conversationID:p,data:{markList:N(i),customData:c,conversationGroupList:[...a]}})}))}return r}reset(){this._fetchConversationGroupStatus=c}dispose(){this.reset()}};var T=new class{init(t){const{notificationCenter:o,helper:{registerApi:e},InnerEvent:{MESSAGE_PUSH:n},InnerEventSubType:{CONVERSATION_MARK_UPDATED:r,CONVERSATION_GROUP_ADD:s,CONVERSATION_GROUP_DELETED:a,CONVERSATION_GROUP_UPDATED:i}}=t;this._core=t,e({apiName:"renameConversationGroup",context:this}),e({apiName:"deleteConversationGroup",context:this}),e({apiName:"markConversation",context:this}),e({apiName:"setConversationCustomData",context:this}),e({apiName:"deleteConversationsFromGroup",context:this}),e({apiName:"addConversationsToGroup",context:this}),o.subscribeInnerEvent(n,s,this._handleConversationGroupAdd,this),o.subscribeInnerEvent(n,a,this._handleConversationGroupDeleted,this),o.subscribeInnerEvent(n,i,this._handleConversationGroupUpdated,this),o.subscribeInnerEvent(n,r,this._handleConversationMarkUpdated,this)}renameConversationGroup(n){return o(this,void 0,void 0,(function*(){G("renameConversationGroup");const{common:{getCurrentUserID:o},ssoLog:r}=this._core,{oldName:s,newName:a}=n,i=r.createSSOLogData({method:"renameConversationGroup"});i.setLogInfo({message:`oldName:${s} newName:${a}`});try{const n=yield function(t){const{fromAccount:o,oldName:n,newName:r}=t,s={From_Account:o,UpdateType:1,UpdateGroup:{UpdateGroupType:f,OldGroupName:n,NewGroupName:r}};return e.core.common.buildAndSendPacket({servcmd:"recentcontact.update_contact_group",data:s})}({fromAccount:o(),oldName:s,newName:a});if(n){i.end();const{UpdateGroupResult:o}=n,{GroupId:e}=o;t.setConversationGroup(e,a),g(),this._updateLocalConversationGroupName({oldName:s,newName:a})}}catch(t){const{errorCode:o,errorInfo:e}=t,n=new this._core.helper.ChatError({functionName:"renameConversationGroup",code:o,message:e});throw i.setError(n).end(),n}}))}deleteConversationGroup(n){return o(this,void 0,void 0,(function*(){G("deleteConversationGroup");const{common:{getCurrentUserID:o},ssoLog:r}=this._core,s=r.createSSOLogData({method:"deleteConversationGroup"});s.setLogInfo({message:`groupName:${n}`});try{const r=yield function(t){const{fromAccount:o,groupName:n}=t,r={From_Account:o,GroupName:[n]};return e.core.common.buildAndSendPacket({servcmd:"recentcontact.del_contact_group",data:r})}({fromAccount:o(),groupName:n});if(r){const{GroupItem:o}=r;let e=!1;null==o||o.forEach((o=>{const{GroupId:n}=o,r=t.getConversationGroupMap();r.has(n)&&(r.delete(n),e=!0)})),e&&g(),this._deleteLocalConversationGroupName([n])}}catch(t){const{errorCode:o,errorInfo:e}=t,n=new this._core.helper.ChatError({functionName:"deleteConversationGroup",code:o,message:e});throw s.setError(n).end(),n}}))}markConversation(t){return o(this,void 0,void 0,(function*(){G("markConversation");const{utils:{isNumber:o},common:{getCurrentUserID:e},ssoLog:n,appStore:r}=this._core,{conversationIDList:s,markType:a,enableMark:i}=t,c=this._getFlagBit(a),u=[],p=[];let d,v;const l=n.createSSOLogData({method:"markConversation"});l.setLogInfo({message:JSON.stringify(t)}),!0===i&&o(c)?d=[c]:v=[c];const h=D({conversationIDList:s,failureConversationIDList:u,additionalData:{SetMark:d,ClearMark:v,OptType:C}});if(u.length===s.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:u}};try{const t=yield S({conversationInfoList:h,fromAccount:e()});if(t){l.end();const{ResultItem:o}=t,e=[];o.forEach((t=>{const{ContactItem:o,ResultCode:n,ResultInfo:s}=t,c=_(o);if(0===n){p.push(c);const t=r.conversationStore.getConversation(c);if(t){const o=t.markList.indexOf(a),n=!1===i&&-1!==o;if(!0===i&&-1===o)e.push({conversationID:c,data:{markList:[...t.markList,a]}});else if(n){const n=t.markList.slice();n.splice(o,1),e.push({conversationID:c,data:{markList:n}})}}}else u.push({conversationID:c,code:n,message:s})})),E(e)}return{code:0,data:{successConversationIDList:p,failureConversationIDList:u}}}catch(t){const{errorCode:o,errorInfo:e}=t,n=new this._core.helper.ChatError({functionName:"markConversation",code:o,message:e});throw l.setError(n).end(),n}}))}setConversationCustomData(t){return o(this,void 0,void 0,(function*(){G("setConversationCustomData");const{common:{getCurrentUserID:o},ssoLog:e,appStore:n}=this._core,{conversationIDList:r,customData:s}=t,a=[],i=[],c=e.createSSOLogData({method:"setConversationCustomData"});c.setLogInfo({message:JSON.stringify(t)});const u=D({conversationIDList:r,failureConversationIDList:a,additionalData:{CustomMark:s,OptType:h}});if(a.length===r.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:a}};try{const t=yield S({fromAccount:o(),conversationInfoList:u});if(t){c.end();const{ResultItem:o}=t,e=[];null==o||o.forEach((t=>{const{ContactItem:o,ResultCode:r,ResultInfo:c}=t;if(0===r){const t=_(o);i.push(t);const r=n.conversationStore.getConversation(t);r&&r.customData!==s&&e.push({conversationID:t,data:{customData:s}})}else a.push({conversationID:conversationID,code:r,message:c})})),E(e)}return{code:0,data:{successConversationIDList:i,failureConversationIDList:a}}}catch(t){const{errorCode:o,errorInfo:e}=t,n=new this._core.helper.ChatError({functionName:"setConversationCustomData",code:o,message:e});throw c.setError(n).end(),n}}))}deleteConversationsFromGroup(t){return o(this,void 0,void 0,(function*(){G("deleteConversationsFromGroup");const{common:{getCurrentUserID:o},ssoLog:e,appStore:n}=this._core,r=e.createSSOLogData({method:"deleteConversationsFromGroup"});r.setLogInfo({message:JSON.stringify(t)});const{conversationIDList:s,groupName:a}=t,i=[],c=[],u=D({conversationIDList:s,failureConversationIDList:i,additionalData:{ContactOptType:2}});if(i.length===s.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:i}};try{const t=yield O({fromAccount:o(),groupName:a,conversationInfoList:u});if(t){r.end();const o=[],{UpdateGroupResult:{ContactResultItem:e}}=t;null==e||e.forEach((t=>{const e=_(t.ContactItem);if(0===t.ResultCode){const t=n.conversationStore.getConversation(e);if(t){const n=t.conversationGroupList.indexOf(a);if(-1!==n){const r=t.conversationGroupList.slice();r.splice(n,1),c.push(e),o.push({conversationID:e,data:{conversationGroupList:r}})}}}else i.push({conversationID:e,code:t.ResultCode,message:t.ResultInfo})})),o.length>0&&(g(),E(o))}return{code:0,data:{successConversationIDList:c,failureConversationIDList:i}}}catch(t){const{errorCode:o,errorInfo:e}=t,n=new this._core.helper.ChatError({functionName:"deleteConversationsFromGroup",code:o,message:e});throw r.setError(n).end(),n}}))}addConversationsToGroup(t){return o(this,void 0,void 0,(function*(){G("deleteConversationsFromGroup");const{common:{getCurrentUserID:o},ssoLog:e,appStore:n}=this._core,r=e.createSSOLogData({method:"addConversationsToGroup"});r.setLogInfo({message:JSON.stringify(t)});const{conversationIDList:s,groupName:a}=t,i=[],c=[],u=D({conversationIDList:s,failureConversationIDList:i,additionalData:{ContactOptType:1}});if(i.length===s.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:i}};try{const t=yield O({fromAccount:o(),groupName:a,conversationInfoList:u});if(t){r.end();const o=[],{UpdateGroupResult:{ContactResultItem:e}}=t;null==e||e.forEach((t=>{const e=_(t.ContactItem);if(0===t.ResultCode){const t=n.conversationStore.getConversation(e);if(t){if(-1===t.conversationGroupList.indexOf(a)){const n=t.conversationGroupList.slice();n.push(a),c.push(e),o.push({conversationID:e,data:{conversationGroupList:n}})}}}else i.push({conversationID:e,code:t.ResultCode,message:t.ResultInfo})})),o.length>0&&(g(),E(o))}return{code:0,data:{successConversationIDList:c,failureConversationIDList:i}}}catch(t){const{errorCode:o,errorInfo:e}=t,n=new this._core.helper.ChatError({functionName:"deleteConversationsFromGroup",code:o,message:e});throw r.setError(n).end(),n}}))}_updateLocalConversationGroupName(t){const{appStore:o}=this._core,{oldName:e,newName:n}=t;let r=[];const s=[];let a=-1;Array.from(o.conversationStore.getConversationMap().values()).forEach((t=>{if(r=t.conversationGroupList,a=r.indexOf(e),-1!==a){const o=r.slice();o.splice(a,1,n),s.push({conversationID:t.conversationID,data:{conversationGroupList:o}})}})),E(s)}_deleteLocalConversationGroupName(t){const{utils:{isEmpty:o},appStore:e}=this._core;if(o(t))return;const n=[];Array.from(e.conversationStore.getConversationMap().values()).forEach((o=>{const{conversationID:e,conversationGroupList:r}=o,s=r.filter((o=>!t.includes(o)));s.length<r.length&&n.push({conversationID:e,data:{conversationGroupList:s}})})),E(n)}_getFlagBit(t){const o=t.toString(2),e=o.length;for(let t=e-1;t>=0;t--)if("1"===o[t])return e-t-1}_handleConversationGroupAdd(o){var e;const{utils:{isArray:n},appStore:r}=this._core;null===(e=null==o?void 0:o.RecentContactMod)||void 0===e||e.forEach((o=>{const{RecentContactCreateContactGroup:{MsgContactGroupContactItem:e}}=o;let s=!1;null==e||e.forEach((o=>{const{MsgGroupItem:e,MsgRecentContactItem:a}=o,{GroupId:i,GroupName:c}=e,u=[];t.getConversationGroup(i)!==c&&(t.setConversationGroup(i,c),s=!0),n(a)&&a.forEach((t=>{var o;const e=_(t),n=r.conversationStore.getConversation(e);if(n&&!(null===(o=n.conversationGroupList)||void 0===o?void 0:o.includes(c))){const t=n.conversationGroupList.slice();t.push(c),u.push({conversationID:e,data:{conversationGroupList:t}})}})),s&&g(),E(u)}))}))}_handleConversationGroupDeleted(o){var e;const{utils:{isArray:n}}=this._core;null===(e=null==o?void 0:o.RecentContactMod)||void 0===e||e.forEach((o=>{const{MsgGroupItem:e}=(null==o?void 0:o.RecentContactDelContactGroup)||{};if(n(e)){let o=!1;const n=[];e.forEach((e=>{const{GroupId:r,GroupName:s}=e,a=t.getConversationGroupMap();a.has(r)&&(a.delete(r),o=!0,n.push(s))})),o&&g(),n.length>0&&this._deleteLocalConversationGroupName(n)}}))}_handleConversationGroupUpdated(t){var o;null===(o=t.RecentContactMod)||void 0===o||o.forEach((t=>{const{RecentContactUpdateContactGroup:{MsgUpdateGroup:{GroupId:o,GroupName:e,OldGroupName:n,RecentContactUpdateGroupItem:r,UpdateGroupType:s}}}=t;1===s?this._handleGroupNameUpdated({groupID:o,newName:e,oldName:n}):2===s&&this._handleGroupAddOrDeleteFromConversation({groupInfoList:r,groupName:n})}))}_handleConversationMarkUpdated(t){var o;const{appStore:e}=this._core;null===(o=null==t?void 0:t.RecentContactMod)||void 0===o||o.forEach((t=>{const{RecentContactMarkContact:{RecentContactMarkContactItem:o}}=t,n=[];null==o||o.forEach((t=>{const{RecentContactItem:o,CustomMark:r,StandardMark:s,OptType:a}=t,i=_(o),c=e.conversationStore.getConversation(i);c&&(a===C?this._updateStandMark({conversation:c,standardMark:s,updateConversationList:n}):a===h?this._updateCustomMark({conversation:c,customMark:r,updateConversationList:n}):a===m&&(this._updateStandMark({conversation:c,standardMark:s,updateConversationList:n}),this._updateCustomMark({conversation:c,customMark:r,updateConversationList:n})))})),E(n)}))}_updateStandMark(t){const{conversation:o,standardMark:e,updateConversationList:n}=t,r=N(e);(function(t,o){if(t===o)return!0;if(!t||!o)return!1;if(t.length!==o.length)return!1;t.sort(),o.sort();for(let e=0,n=t.length;e<n;e++)if(t[e]!==o[e])return!1;return!0})(o.markList,r)||n.push({conversationID:o.conversationID,data:{markList:r}})}_updateCustomMark(t){const{conversation:o,customMark:e,updateConversationList:n}=t;o.customData!==e&&void 0!==e&&(o.customData=e,n.push({conversationID:o.conversationID,data:{customData:e}}))}_handleGroupNameUpdated(o){const{groupID:e,oldName:n,newName:r}=o;t.getConversationGroup(e)!==r&&(t.setConversationGroup(e,r),g(),this._updateLocalConversationGroupName({oldName:n,newName:r}))}_handleGroupAddOrDeleteFromConversation({groupInfoList:t,groupName:o}){const{appStore:e}=this._core,n=[];t.forEach((t=>{const{RecentContactItem:r,ContactOptType:s}=t,a=_(r),i=e.conversationStore.getConversation(a),c=i.conversationGroupList.indexOf(o);if(i){const t=i.conversationGroupList.slice();1===s&&-1===c?(t.push(o),n.push({conversationID:a,data:{conversationGroupList:t}})):2===s&&-1!==c&&(t.splice(c,1),n.push({conversationID:a,data:{conversationGroupList:t}}))}})),E(n)}dispose(){const{notificationCenter:t,InnerEvent:{MESSAGE_PUSH:o},InnerEventSubType:{CONVERSATION_MARK_UPDATED:e,CONVERSATION_GROUP_ADD:n,CONVERSATION_GROUP_DELETED:r,CONVERSATION_GROUP_UPDATED:s}}=this._core;t.unSubscribeInnerEvent(o,n,this._handleConversationGroupAdd,this),t.unSubscribeInnerEvent(o,r,this._handleConversationGroupDeleted,this),t.unSubscribeInnerEvent(o,s,this._handleConversationGroupUpdated,this),t.unSubscribeInnerEvent(o,e,this._handleConversationMarkUpdated,this)}};const y={required:!0,rules:["string"],allowEmpty:!1},U={required:!0,rules:["array"],allowEmpty:!1},M={createConversationGroup:{groupName:y,conversationIDList:{required:!0,rules:["array"],allowEmpty:!1}},renameConversationGroup:{oldName:y,newName:Object.assign(Object.assign({},y),{customValidator:t=>!(t.length>32)||"newName length cannot longer than 32"})},deleteConversationGroup:[{required:!0,rules:["string"],allowEmpty:!1}],addConversationsToGroup:{conversationIDList:U,groupName:y},deleteConversationsFromGroup:{conversationIDList:U,groupName:y},markConversation:{conversationIDList:U,markType:{required:!0,rules:["number"],allowEmpty:!1,customValidator:t=>t<=0?"markType must be greater than 0":!(t>=Math.pow(2,64))||"markType must be less than 2^64"},enableMark:{required:!0,rules:["boolean"],allowEmpty:!1}},setConversationCustomData:{conversationIDList:U,customData:{required:!1,rules:["string"],allowEmpty:!0,customValidator:t=>"string"!=typeof t?"customData must be string":!(t.length>256)||"customData length cannot longer than 256"}}},k={createConversationGroup:!0,deleteConversationGroup:!0,renameConversationGroup:!0,getConversationGroupList:!0,addConversationsToGroup:!0,deleteConversationsFromGroup:!0,markConversation:!0,setConversationCustomData:!0};var b=new class{constructor(){this.name="ConversationGroup"}install(o){this._core=o,e.init(o),t.init(o),R.init(o),A.init(o),T.init(o),o.helper.registerValidateConfig({auth:k,params:M}),o.notificationCenter.subscribeInnerEvent(o.InnerEvent.LOGOUT,this.reset,this),o.notificationCenter.subscribeInnerEvent(o.InnerEvent.DESTROY,this.dispose,this)}dispose(){const{notificationCenter:t,InnerEvent:o}=this._core;t.unSubscribeInnerEvent(o.LOGOUT,this.reset,this),t.unSubscribeInnerEvent(o.DESTROY,this.dispose,this),T.dispose(),A.dispose()}reset(){A.reset()}};export{b as default};