zego-zim-miniprogram
Version:
ZEGO ZIM SDK for mini program
1 lines • 965 kB
JavaScript
((e,t)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r,s=t();for(r in s)("object"==typeof exports?exports:e)[r]=s[r]}})("undefined"!=typeof self?self:this,()=>(()=>{var __webpack_modules__={20:(e,t,r)=>{r.d(t,{_:()=>s});var s={DEBUG:0,INFO:1,WARN:2,ERROR:3,REPORT:99,DISABLE:100,debug:0,info:1,warn:2,error:3,report:99,disable:100}},293:(e,t,r)=>{r.d(t,{EJ:()=>O,KV:()=>v,QO:()=>j,RB:()=>P,Us:()=>T,XG:()=>x,Zg:()=>R,_Z:()=>D,aj:()=>I,cT:()=>L,cc:()=>U,eR:()=>F,gU:()=>A,lk:()=>S,lp:()=>b,mG:()=>w,re:()=>M,sc:()=>C,sx:()=>k,tZ:()=>G,us:()=>q,wo:()=>y,y_:()=>z});var s,i,n,o,a,u,c,l,d,p=r(3293),h=(t=r(8570),r.n(t)),f=r(6713),m=function(){return(m=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},g=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var s,i,n=r.call(e),o=[];try{for(;(void 0===t||0<t--)&&!(s=n.next()).done;)o.push(s.value)}catch(e){i={error:e}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return o},_=function(e,t,r){if(r||2===arguments.length)for(var s,i=0,n=t.length;i<n;i++)!s&&i in t||((s=s||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(s||Array.prototype.slice.call(t))},v=(t=null,d=r="","undefined"!=typeof tt?(r="douyin,",d=tt.env.VERSION,t=tt):"undefined"!=typeof swan?(r="baidu,",swan.getEnvInfoSync&&(d=swan.getEnvInfoSync().env),t=swan):"undefined"!=typeof my?(my._zim_isAlipay=!0,r="alipay,",d=my.getAccountInfoSync().miniProgram.envVersion,t=my):"undefined"!=typeof wx&&(r="weixin,",d=wx.getAccountInfoSync().miniProgram.envVersion,t=wx),t&&(d={env:d,brand:"",model:"",version:"",SDKVersion:"",system:"",platform:"",memorySize:"",benchmarkLevel:""},t.getAppBaseInfo&&(l=t.getAppBaseInfo(),d.version=l.version,d.SDKVersion=l.SDKVersion),s=(l=(t.getDeviceInfo||t.getDeviceBaseInfo||t.getDeviceInfoSync||t.getSystemInfoSync).call(t)).version,i=l.SDKVersion,n=l.brand,o=l.model,a=l.system,u=l.platform,c=l.memorySize,l=l.benchmarkLevel,d.version||(d.version=s),d.SDKVersion||(d.SDKVersion=i),d.brand=n,d.model=o,d.system=a,d.platform=r+u,d.memorySize=c,d.benchmarkLevel=l,t._zim_env=JSON.stringify(d)),t),b=v?v._zim_env:location.origin+navigator.userAgent,y=(()=>{var e,t="z_deviceID",r=(e=(new Date).getTime(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|8).toString(36)})),s="";try{var i=v.getStorageSync(v._zim_isAlipay?{key:t}:t)||"";i&&i.data?s="object"==typeof i?i.data:i:(s=r,v._zim_isAlipay?v.setStorageSync({key:t,data:s}):v.setStorageSync(t,s))}catch(t){s=r}return s})(),M=function(e){return m({type:0,extendedData:"",localExtendedData:"",isMentionAll:!1,mentionedUserIDs:[],localMessageID:"",messageID:"",messageSeq:0,senderUserID:"",timestamp:0,conversationID:"",conversationType:0,direction:0,sentStatus:1,orderKey:0,isUserInserted:!1,isBroadcastMessage:!1,isServerMessage:!1,isGroupTargetedMessage:!1,receiptStatus:0,reactions:[],rootRepliedCount:0,editorUserID:"",editedTime:0,pinnedUserID:"",pinnedTime:0},e)},k=function(e,t,r){return t={conversationID:t,conversationName:"",conversationAlias:"",conversationAvatarUrl:"",type:r=r||0,unreadMessageCount:0,notificationStatus:1,orderKey:0,draft:"",isPinned:!1,pinnedTime:0,isDisabled:2==r,mutedExpiredTime:0,marks:[],mentionedInfoList:[],id:e+r+t,ownerID:e,seq:0,state:f.NI.Normal,maxSeq:0,maxOrderKey:0,msgSeq:0,sendMsgCount:0,subMsgCount:0,deletedMsgCount:0,readMsgSeq:0,dbReadMsgSeq:0,deletedMsgMaxSeq:0,extraMsgs:{},maxSendReceiptMsgSeq:0,maxRecvReceiptMsgSeq:0,minStatemsgSeq:0,maxStatemsgSeq:0,muteSeq:0,markSeq:0},2==r&&(t.groupMap={totalMemberCount:0,groupNotice:"",attributes:{},createTime:0,maxMemberCount:0,mutedInfo:{mode:0,expiredTime:0,roles:[]},verifyInfo:{joinMode:0,inviteMode:0,beInviteMode:0},dataSeq:0,memberSeq:0,pinSeq:0,attributeSeq:0,groupSeq:0,groupAppSeq:0,historyMsgSeq:0,memberAllSeq:0,memberSeqs:{}}),t},S=function(){return(new Date).getTime()+Math.random().toString().substring(2,7)},I=function(e){if("string"!=typeof e)return e;if(!e)return new Uint8Array;try{var t;return"undefined"!=typeof TextEncoder?(new TextEncoder).encode(e):(t=unescape(encodeURIComponent(e)),new Uint8Array(Array.from(t).map(function(e){return e.charCodeAt(0)})))}catch(t){for(var r=e,s=[],i=0;i<r.length;i++){var n=r.charCodeAt(i);n<=127?s.push(n):n<=2047?s.push(192|n>>6,128|63&n):n<=65535?s.push(224|n>>12,128|n>>6&63,128|63&n):s.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n)}return new Uint8Array(s)}},C=function(e){if("string"==typeof e)return e;if(!e||!e.length)return"";try{return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):(t=String.fromCharCode.apply(String,_([],g(Array.from(e)),!1)),decodeURIComponent(escape(t)))}catch(a){try{var t=String.fromCharCode.apply(String,_([],g(Array.from(e)),!1));return decodeURIComponent(t)}catch(t){for(var r=e,s="",i=0;i<r.length;i++){var n,o=r[i];128&o?192==(224&o)?(n=(31&o)<<6|63&r[++i],s+=String.fromCharCode(n)):224==(240&o)?(n=(15&o)<<12|(63&r[++i])<<6|63&r[++i],s+=String.fromCharCode(n)):240==(248&o)&&(65535<(n=(7&o)<<18|(63&r[++i])<<12|(63&r[++i])<<6|63&r[++i])?(n-=65536,s+=String.fromCharCode(55296|n>>10,56320|1023&n)):s+=String.fromCharCode(n)):s+=String.fromCharCode(o)}return s}}},q=function(e){return p.o4.fromUint8Array(e)},D=function(e){return p.o4.toUint8Array(e)},w=function(e,t){return!!e&&"string"==typeof e&&e.length<=f.hT.MAX_ID_SIZE&&(!t||"#"!=e[0])},A=function(e,t){if(!e||"string"!=typeof e||e.length<31)return[6000103];if("04"!==e.substring(0,2))return[6000107];try{var r=Date.now()/1e3,s=Array.from(p.o4.toUint8Array(e.substring(2,14))),i=h().fromBytes(s.slice(0,8)).toInt();return[i<t||i<r?6000106:i<30+r?6000108:2073600+r<i?6000109:0,i]}catch(e){return[6000103]}},R=function(e,t,r){var s=t.dbUserMap.get(e.userID);return s?((!r||!s.updateTime||r>s.updateTime)&&(e.userName&&(s.userName=e.userName),e.userAvatarUrl&&(s.userAvatarUrl=e.userAvatarUrl),r)&&(s.updateTime=r),e.hasOwnProperty("userExtendedData")&&(s.userExtendedData=e.userExtendedData),s):(r&&(e.updateTime=r),t.dbUserMap.set(e.userID,e),e)},x=function(e,t){var r=t.dbUserMap.get(e)||{userID:e};return e&&!r.userName&&t.syncUserTask.add(e),{userID:r.userID,userName:r.userName||"",userAvatarUrl:r.userAvatarUrl||"",userExtendedData:r.userExtendedData||""}},U=function(e,t){var r,s,i;return e?(s=(null==(r=t.dbUserMap.get(e.userID))?void 0:r.userAvatarUrl)||"",(i=e.operatedUser)&&Object.assign(i,x(i.userID,t)),{userID:e.userID,userName:(null==r?void 0:r.userName)||"",userAvatarUrl:s,userExtendedData:(null==r?void 0:r.userExtendedData)||"",memberAvatarUrl:s,memberNickname:e.memberNickname||"",memberRole:e.memberRole||f.Go.Member,muteExpiredTime:e.muteExpiredTime||0,groupEnterInfo:{enterTime:e.enterTime||0,enterType:e.enterType||0,operatedUser:i}}):{userID:"",userName:"",userAvatarUrl:"",userExtendedData:"",memberAvatarUrl:"",memberNickname:"",memberRole:f.Go.Member,muteExpiredTime:0,groupEnterInfo:{enterTime:0,enterType:0}}},T=function(e){return{type:e.type||0,conversationID:e.conversationID,conversationName:e.conversationName||"",conversationAlias:e.conversationAlias||"",conversationAvatarUrl:e.conversationAvatarUrl||"",unreadMessageCount:e.unreadMessageCount||0,orderKey:e.orderKey||0,notificationStatus:e.notificationStatus||1,isPinned:e.isPinned||!1,pinnedTime:e.pinnedTime||0,isDisabled:e.isDisabled||!1,mutedExpiredTime:e.mutedExpiredTime||0,draft:e.draft||"",marks:e.marks||[],mentionedInfoList:e.mentionedInfoList||[],lastMessage:e.lastMessage?M(e.lastMessage):void 0}},L=function(e,t,r,s,i,n,o){var a=new Map,u=[],c=((c=Object.keys(r)).forEach(function(e){r[e]&&(e=s[e])&&u.push(e.userID)}),c.forEach(function(e){var t;n&&r[e]?(t=s[e])&&a.set(t.userID,t):n||r[e]||(t=s[e])&&(-1==u.indexOf(t.userID)?a.set(t.userID,t):delete r[e])}),Array.from(a.values())),l=(c.sort(function(e,t){return e.seq-t.seq}),c.length),d=(null==(d=c[c.length-1])?void 0:d.seq)||0,p=i.nextFlag||0,h=0,m=(0<p&&p<d?h=c.findIndex(function(e){return e.seq==p})+1:d<=p&&d&&(h=c.length),h+Math.min(f.hT.MAX_QUERY_PAGE_COUNT,i.count)),g=(c=c.slice(h,m)).length,_=(null==(_=c[g-1])?void 0:_.seq)||0,v=(c=c.map(function(t){return U(t,e)}),g==l||d==_?0:_);return Object.assign(o,{start:h,end:m,next:_,max:d,total:l,count:g,nextFlag:v,config:i}),{groupID:t,nextFlag:v,userList:c}},E=((s={})[f.Lj.RevokeSelf]=0,s[f.Lj.RevokeSystem]=1,s[f.Lj.RevokeService]=2,s[f.Lj.RevokeGroupAdmin]=3,s[f.Lj.RevokeGroupOwner]=4,s[f.Lj.RevokeAudit]=5,s[f.Lj.ReceiptDone]=2,s[f.Lj.ReceiptExpired]=3,s[f.Lj.ReceiptFailed]=4,s[f.Lj.ReceiptDoing]=1,s),P=function(e){for(var t,r=0,s={revoke:0,receipt:0};e;)1&e&&((t=1<<r)>=f.Lj.RevokeSelf&&t<=f.Lj.RevokeAudit?s.revoke+=t:t>=f.Lj.ReceiptDone&&t<=f.Lj.ReceiptDoing&&(s.receipt+=t)),r++,e>>=1;return s.revoke=s.revoke>=f.Lj.RevokeSelf&&s.revoke<=f.Lj.RevokeAudit?E[s.revoke]:-1,s.receipt=s.receipt>=f.Lj.ReceiptDone&&s.receipt<=f.Lj.ReceiptDoing?E[s.receipt]:0,s},F=(Math.log2||(Math.log2=function(e){return Math.log(e)/Math.LN2}),function(e,t){void 0===t&&(t=!0);var r=[];if(e&&"0"!=e.toString())for(var s=0,i=Math.pow(2,s);e.greaterThanOrEqual(i);)"0"!==e.and(i).toString()&&r.push(t?Math.log2(i)+1:i),s++,i=Math.pow(2,s);return r}),G=function(e,t){var r;if(e&&e.title&&e.content)return r=e.privateMessageTemplate?{private_msg_template_id:e.privateMessageTemplate.templateID||"",private_title_parameters:e.privateMessageTemplate.titleParameters||"",private_content_parameters:e.privateMessageTemplate.contentParameters||""}:null,{enable_push:1,title:String(e.title),content:String(e.content),payload:String(e.payload||""),pushStrategyId:String(e.resourcesID||""),enable_force_push:t,custom_map:e.enableBadge||e.voIPConfig||e.privateMessageTemplate?m({badge_increment:e.enableBadge?String(e.badgeIncrement||0):void 0,sdk_params:e.voIPConfig?JSON.stringify({voip_handle_type:e.voIPConfig.iOSVoIPHandleType,voip_handle_value:String(e.voIPConfig.iOSVoIPHandleValue||""),voip_has_video:!!e.voIPConfig.iOSVoIPHasVideo}):void 0},r):void 0}},z=function(e,t){var r=e.is_all_forbid,s=e.forbid_list;return-1!=(e=e.forbid_expire_time)&&e<t?{mode:0,expiredTime:0,roles:[]}:((t=0)!=e&&r?t=2:1==s.length&&s[0]==f.Go.Member?t=1:0!=e&&s.length&&(t=3),{mode:t,expiredTime:e,roles:s})},B=function(e,t){if(!e||!t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;var r,s=!0;for(r in e)void 0===t[r]&&(s=!1),"object"==("object"==typeof e[r]&&typeof t[r])?s=B(e[r],t[r]):e[r]!==t[r]&&(s=!1);return s},O=function(e,t){return!(!e||!t||e.length!==t.length)&&e.every(function(e,r){return B(e,t[r])})},j=function(e,t){return!!e&&-1!=e.toLocaleLowerCase().indexOf(t)}},477:()=>{},754:function(e,t,r){var s;e.exports=(e=r(9021),s=e.lib.WordArray,e.enc.Base64={stringify:function(e){for(var t=e.words,r=e.sigBytes,s=this._map,i=(e.clamp(),[]),n=0;n<r;n+=3)for(var o=(t[n>>>2]>>>24-n%4*8&255)<<16|(t[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|t[n+2>>>2]>>>24-(n+2)%4*8&255,a=0;a<4&&n+.75*a<r;a++)i.push(s.charAt(o>>>6*(3-a)&63));var u=s.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,r=this._map;if(!(i=this._reverseMap))for(var i=this._reverseMap=[],n=0;n<r.length;n++)i[r.charCodeAt(n)]=n;var o=r.charAt(64);return o&&-1!==(o=e.indexOf(o))&&(t=o),function(e,t,r){for(var i,n,o=[],a=0,u=0;u<t;u++)u%4&&(i=r[e.charCodeAt(u-1)]<<u%4*2,n=r[e.charCodeAt(u)]>>>6-u%4*2,o[a>>>2]|=(i|n)<<24-a%4*8,a++);return s.create(o,a)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.enc.Base64)},818:(e,t,r)=>{e.exports=n;var s=r(3449),i=((n.prototype=Object.create(s.prototype)).constructor=n,r(3610));function n(){s.call(this)}function o(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}n._configure=function(){n.alloc=i._Buffer_allocUnsafe,n.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var s=0;s<e.length;)t[r++]=e[s++]}},n.prototype.bytes=function(e){var t=(e=i.isString(e)?i._Buffer_from(e,"base64"):e).length>>>0;return this.uint32(t),t&&this._push(n.writeBytesBuffer,t,e),this},n.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},n._configure()},844:(e,t,r)=>{r.d(t,{C:()=>c});var s=r(8272),i=r(4661),n=r(6713),o=function(){return(o=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=(t=function(e,t,r,s){var i,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,s);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(o=(n<3?i(o):3<n?i(t,r,o):i(t,r))||o);return 3<n&&o&&Object.defineProperty(t,r,o),o},n.lm.Room),u="mergeUser",c=(l.prototype.destroy=function(e){0!==this.state&&this.emitState(0,0),this.localSeq=0,this.sessionID=0,this.attrItemSeq=0,this.isMergeUser=!1,this.totalMemberCount=0,this.userMap.clear(),this.hbTimer&&clearTimeout(this.hbTimer),this.hbTimer=0,e&&(this.dbMgr=null,this.cnMgr=null,this.bus=null,this.econf=null)},l.prototype.createFrequencyLimitError=function(e){var t=(0,i.$$)(6000004),r={roomID:this.groupID,error:t};return this.lg.w(a,e,r),t},l.prototype.create=function(e,t,r,s,o){var u=this;if(2===this.state&&e==n.g1.Join&&!r)return p={roomID:this.groupID,roomName:this.groupName,state:this.state},this.lg.i(a,n.vv.JoinRoom,p),Promise.resolve({roomInfo:{baseInfo:{roomID:this.groupID,roomName:this.groupName}}});var c={time:new Date,roomID:this.groupID,roomName:t,state:this.state,config:o},l=(0==this.state&&(p=6,e==n.g1.Create?p=4:e==n.g1.Switch&&(p=11),this.emitState(1,p)),n.Fs.rm_enter),d=e==n.g1.Join?n.vv.JoinRoom:n.vv.EnterRoom;switch(e){case n.g1.Create:l=n.Fs.rm_create,d=n.vv.CreateRoom;break;case n.g1.Switch:l=n.Fs.rm_switch,d=n.vv.SwitchRoom}var p={room_id:this.groupID,room_name:(0,i.aj)(t||this.groupName),room_user_session_id:this.userSessionID||0,create_if_not_exist:e==n.g1.Enter||e==n.g1.Switch&&r,sub_room_id:this.subRoomID,last_room:e==n.g1.Switch?s:void 0,sdk_action:e};return this.addAttr(p,o),r=this.econf.cloudSetting.req_to.room_life,this.cnMgr.send(l,p,n.Sk.A,r).then(function(r){c.state_=u.state;var s,l=e==n.g1.Create?6000303:6000304,p=r.code;return p?(s=103032==p||103035==p||103015==p,6000105===p||s?u.cnMgr.send(n.Fs.rm_check,{room_id:u.groupID}).then(function(t){var h=t.code;return h?(c.error=(0,i.$$)(l,t.message,h),e==n.g1.Create&&s&&(c.error.code=6000323),u.handleEnterError(e,h),u.lg.w(a,d,c),Promise.reject(c.error)):(e==n.g1.Create&&(u.localSeq=1),u.handleEnterRsp(e,t,o),e==n.g1.Create&&s?(c.error=(0,i.$$)(0,r.message,p),c.error.code=6000323,u.lg.w(a,d,c),Promise.reject(c.error)):(c.roomName=u.groupName,u.lg.i(a,d,c),{roomInfo:{baseInfo:{roomID:u.groupID,roomName:u.groupName}}}))}):(c.error=(0,i.$$)(l,r.message,p),u.handleEnterError(e,p),u.lg.w(a,d,c),Promise.reject(c.error))):(e==n.g1.Create&&(u.localSeq=1),u.handleEnterRsp(e,r,o),t&&(u.groupName=t),c.roomName=u.groupName,u.lg.i(a,d,c),{roomInfo:{baseInfo:{roomID:u.groupID,roomName:u.groupName}}})})},l.prototype.queryMemberList=function(e){var t=this,r=o({time:new Date,roomID:this.groupID},e);return this.fetchPageUser(Math.min(100,0|e.count),e.nextFlag,n.Sk.A).then(function(e){t.lg.i(a,n.vv.QueryRoomMemberList,r);var s=e.users.map(function(e){return t.createUser(e)});return{roomID:t.groupID,memberList:s,nextFlag:e.pos_flag}})},l.prototype.queryMembers=function(e){var t=this,r={time:new Date,roomID:this.groupID,userIDs:e},s=[];return e=e.filter(function(e){return!!(0,i.mG)(e)||(s.push({userID:e,reason:6000001}),!1)}),e=Array.from(new Set(e)),e={room_id:this.groupID,room_session_id:this.sessionID,room_user_session_id:this.userSessionID,sub_room_id:this.subRoomID,user_ids:e},this.cnMgr.send(n.Fs.rm_userinfos,e).then(function(e){return e.code?(r.error=(0,i.$$)(6000310,e.message,e.code),t.lg.w(a,n.vv.QueryRoomMembers,r),Promise.reject(r.error)):(e.err_list.forEach(function(e){return s.push({userID:e.user_id,reason:e.sub_code})}),e=e.result.map(function(e){return t.createUser(e)}),t.lg.i(a,n.vv.QueryRoomMembers,r),{roomID:t.groupID,memberList:e,errorUserList:s})})},l.prototype.queryMemberCount=function(){var e={roomID:this.groupID,count:this.totalMemberCount};return this.lg.i(a,n.vv.QueryRoomMemberCount,e),Promise.resolve(e)},l.prototype.queryAttr=function(e){var t=this,r=(void 0===e&&(e=n.Sk.A),{time:new Date,roomID:this.groupID}),s=(new Date).getTime(),o=0,u=(this.queryAttrTask.length&&(u=this.queryAttrTask[this.queryAttrTask.length-1],s-u<this.mergeConfig.attrPullInterval)&&(o=this.mergeConfig.attrPullInterval-(s-u)+10),this.queryAttrTask.push(s),{room_id:this.groupID,room_session_id:this.sessionID,sub_room_id:this.subRoomID,attributes:{attribute_seq:this.stRoomAttributes.attribute_seq,attributes:[]}}),c=this.cnMgr.send(n.Fs.rm_attr,u,e).then(function(o){return o.code?(r.error=(0,i.$$)(6000333,o.message,o.code),t.lg.w(a,n.vv.QueryRoomAllAttr,r),Promise.reject(r.error)):(t.queryAttrTask=t.queryAttrTask.filter(function(e){return e!==s}),t.queryAllAttrRsp(o,r,e))});return o?new Promise(function(e){setTimeout(function(){t.cnMgr&&c.then(e)},o)}):c},l.prototype.setAttr=function(e,t){var r=this;if(this.batchFlag)return new Promise(function(t,s){return r.batchAttr(t,s,e)});var s,i,n=[];for(s in e)s&&(i={action:0,attribute:{key:s,value:e[s].toString(),seq:++this.attrItemSeq,auto_delete:t.isDeleteAfterOwnerLeft?1:0}},this.localAttrKeySeqMap[s]=i.attribute.seq,n.push(i));var o={room_id:this.groupID,room_session_id:this.sessionID,sub_room_id:this.subRoomID,force_modify:t.isForce?1:0,set_member:t.isUpdateOwner?1:0,attributes_seq:this.stRoomAttributes.attribute_seq,op_fail_fast:0,attributes:n};return this.mdfAttr(e,o)},l.prototype.delAttr=function(e,t){var r,s=this;return this.batchFlag?new Promise(function(t,r){return s.batchAttr(t,r,e)}):(r=[],e.forEach(function(e){var t={action:1,attribute:{key:e,value:"",seq:++s.attrItemSeq,auto_delete:1}};s.localAttrKeySeqMap[e]=t.attribute.seq,r.push(t)}),t={room_id:this.groupID,room_session_id:this.sessionID,sub_room_id:this.subRoomID,force_modify:t.isForce?1:0,set_member:1,attributes_seq:this.stRoomAttributes.attribute_seq,op_fail_fast:0,attributes:r},this.mdfAttr({},t))},l.prototype.beginAttr=function(e){this.batchFlag=!0,this.batchOperationConfig=e,this.batchRoomAttributes.length=0},l.prototype.endAttr=function(){var e,t,r,s=this,o=(this.batchFlag=!1,{time:new Date,roomID:this.groupID});return this.batchRoomAttributes.length?(e=[],t={},this.batchRoomAttributes.forEach(function(r){var i={action:r.action,attribute:{key:r.key,value:r.value.toString(),seq:++s.attrItemSeq,auto_delete:s.batchOperationConfig.isDeleteAfterOwnerLeft?1:0}};r.action||(t[r.key]=r.value),s.localAttrKeySeqMap[i.attribute.key]=i.attribute.seq,e.push(i)}),r={room_id:this.groupID,room_session_id:this.sessionID,sub_room_id:this.subRoomID,force_modify:this.batchOperationConfig.isForce?1:0,set_member:this.batchOperationConfig.isUpdateOwner?1:0,attributes_seq:this.stRoomAttributes.attribute_seq,op_fail_fast:1,attributes:e},this.mdfAttr(t,r,!0).then(function(){return s.batchOperationConfig=null,s.batchRoomAttributes.length=0,s.batchAttributesMap.clear(),s.batchIndex=0,s.lg.i(a,n.vv.EndRoomAttr,o),{roomID:s.groupID}})):(o.error=(0,i.$$)(6000331),this.lg.w(a,n.vv.EndRoomAttr,o),Promise.reject(o.error))},l.prototype.setMembersAttr=function(e,t,r){var s,o=this,u={roomID:this.groupID,attributes:e,userIDs:t,config:r},c=[],l=(t=t.filter(function(e){return!!(0,i.mG)(e)||(c.push(e),!1)}),t=Array.from(new Set(t)),{room_id:this.groupID,room_session_id:this.sessionID,room_user_session_id:this.userSessionID,sub_room_id:this.subRoomID,force_modify:1,auto_save:null==r.isDeleteAfterOwnerLeft||r.isDeleteAfterOwnerLeft?0:1,op_fail_fast:0,attributes:{user_ids:t,modify_attribute:[]}});for(s in e){this.userAttrSeq++;var d={action:0,attribute:{key:s,value:e[s],seq:this.userAttrSeq}};l.attributes.modify_attribute.push(d)}return this.cnMgr.send(n.Fs.rm_user_attr_mdf,l).then(function(t){var r,s;return t.code?(u.error=(0,i.$$)(6000350,t.message,t.code),o.lg.w(a,n.vv.SetRoomMembersAttr,u),Promise.reject(u.error)):(r=(s=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var s,i,n=r.call(e),o=[];try{for(;(void 0===t||0<t--)&&!(s=n.next()).done;)o.push(s.value)}catch(e){i={error:e}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return o}(o.mergeSvrUserAttr(t,e),2))[0],s=s[1],t.user_err_list.forEach(function(e){return c.push(e.user_id)}),t.user_err_list.length&&!s.length?(t=(0,i.$$)(6000350,t.message,t.code),Promise.reject(t)):(o.bus.emit(n.R0.RoomMemberAttr,{roomID:o.groupID,infos:r,operatedInfo:{userID:o.econf.user.userID}}),u.setInfos=s,o.lg.i(a,n.vv.SetRoomMembersAttr,u),{roomID:o.groupID,infos:s,errorUserList:c}))})},l.prototype.queryMembersAttr=function(e){var t=this,r={roomID:this.groupID,userIDs:e},s={room_id:this.groupID,room_session_id:this.sessionID,room_user_session_id:this.userSessionID,sub_room_id:this.subRoomID,req_attributes:[]};return e.forEach(function(e){var r=t.userAttributeMap.get(e);e={user_id:e,user_attributes_seq:r?r.seq:0},s.req_attributes.push(e)}),this.cnMgr.send(n.Fs.rm_user_attr,s).then(function(e){return e.code?(r.error=(0,i.$$)(6000301,e.message,e.code),t.lg.w(a,n.vv.QueryRoomMembersAttr,r),Promise.reject(r.error)):(e=t.mergeSvrUserAttr(e)[0].map(function(e){return e.attributesInfo}),r.infos=e,t.lg.i(a,n.vv.QueryRoomMembersAttr,r),{roomID:t.groupID,infos:e})})},l.prototype.queryMemberAttrs=function(e){var t=this,r={roomID:this.groupID,config:e};return e={room_id:this.groupID,room_session_id:this.sessionID,room_user_session_id:this.userSessionID,sub_room_id:this.subRoomID,pos_flag:e.nextFlag||"",count:e.count},this.cnMgr.send(n.Fs.rm_user_attr_list,e).then(function(e){var s;return e.code?(r.error=(0,i.$$)(6000301,e.message,e.code),t.lg.w(a,n.vv.QueryRoomMemberAttrs,r),Promise.reject(r.error)):(s=t.mergeSvrUserAttr(e)[0].map(function(e){return e.attributesInfo}),r.infos=s,t.lg.i(a,n.vv.QueryRoomMemberAttrs,r),{roomID:t.groupID,infos:s,nextFlag:e.pos_flag})})},l.prototype.onDisConnected=function(e){e?(this.emitState(0,2),this.destroy(!1)):this.emitState(1,1)},l.prototype.onConnected=function(){this.startHB(!0)},l.prototype.onPushKickout=function(e){this.emitState(0,[0,8,3,10,13][e.reason]||0,JSON.stringify(e)),this.destroy(!0)},l.prototype.onPushUser=function(e,t){this.totalMemberCount=e.user_count;var r=e.multilogin_count||0,s=this.createUser(e);this.isMergeUser?this.waitingMergeUser(e.userlist_seq,s,t?"enter":"quit"):(t&&1==r||!t&&!r)&&(r=t?n.R0.RoomMemberJoined:n.R0.RoomMemberLeft,this.bus.emit(r,{roomID:e.room_id,memberList:[s]}))},l.prototype.onPushAttrMdf=function(e){var t,r,s,i=this,o=e.attributes_seq;o&&(o-this.stRoomAttributes.attribute_seq>e.attributes.length?this.queryAttr(n.Sk.S):(t={},r=this.printLocalRoomAttr(),s={delete:{},set:{}},this.stRoomAttributes.attribute_seq=o,e.attributes.forEach(function(e){t[e.key]=e}),Object.values(t).forEach(function(e){var t=i.stRoomAttributes.attributes.findIndex(function(t){return t.key==e.key}),r=i.stRoomAttributes.attributes[t];r?e.seq?(Object.assign(r,e),s.set[e.key]=e.value):(i.stRoomAttributes.attributes.splice(t,1),s.delete[e.key]=""):e.seq&&(i.stRoomAttributes.attributes.push(e),s.set[e.key]=e.value)}),o=[],Object.keys(s.set).length&&o.push({action:0,roomAttributes:s.set}),Object.keys(s.delete).length&&o.push({action:1,roomAttributes:s.delete}),0<o.length&&(e=1<o.length?n.R0.RoomAttrBatch:n.R0.RoomAttr,this.bus.emit(e,{roomID:this.groupID,infos:o})),this.lg.i(a,"onPushAttr",{map:s,local:r,attrs:t})))},l.prototype.onPushUserAttrMdf=function(e){e.user_attributes=e.push_attributes,this.bus.emit(n.R0.RoomMemberAttr,{roomID:this.groupID,infos:this.mergeSvrUserAttr(e)[0],operatedInfo:{userID:e.user_id}})},l.prototype.mdfAttr=function(e,t,r){var s=this,o=(void 0===r&&(r=!1),2<JSON.stringify(e).length?n.vv.SetRoomAttr:n.vv.DelRoomAttr);return this.cnMgr.send(n.Fs.rm_attr_mdf,t).then(function(u){function c(e){return r&&(s.batchAttributesMap.forEach(function(t){t.reject&&t.reject(e)}),s.batchOperationConfig=null,s.batchRoomAttributes.length=0,s.batchAttributesMap.clear(),s.batchIndex=0),s.lg.w(a,o,{error:e,local:s.printLocalRoomAttr()}),Promise.reject(e)}var l,d,p,h,f,m,g,_;return u.code?c((0,i.$$)(6000331,u.message,u.code)):u.err_list.length&&u.err_list.length==t.attributes.length?c((0,i.$$)(6000331)):(l=u.attributes.attributes,r&&(d=[],l.forEach(function(e){var t=d.findIndex(function(t){return t.key==e.key});e.seq?(-1!=t&&d.splice(t,1),d.push(e)):-1!=t?d.splice(t,1):d.push(e)}),l=d),p={},h=s.printLocalRoomAttr(),f={delete:{},set:{}},s.stRoomAttributes.attribute_seq=u.attributes.attribute_seq,l.forEach(function(e){p[e.key]=e}),Object.values(p).forEach(function(t){var r=s.stRoomAttributes.attributes.findIndex(function(e){return e.key==t.key}),i=s.stRoomAttributes.attributes[r];i?t.seq?(i.value=e[t.key].toString(),i.seq=t.seq,i.auto_delete=t.auto_delete,f.set[t.key]=i.value):(s.stRoomAttributes.attributes.splice(r,1),f.delete[t.key]=""):t.seq&&(t.value=e[t.key].toString(),s.stRoomAttributes.attributes.push(t),f.set[t.key]=t.value)}),m=[],Object.keys(f.set).length&&m.push({action:0,roomAttributes:f.set}),Object.keys(f.delete).length&&m.push({action:1,roomAttributes:f.delete}),0<m.length&&(g=1<m.length?n.R0.RoomAttrBatch:n.R0.RoomAttr,s.bus.emit(g,{roomID:s.groupID,infos:m})),s.lg.i(a,o,{map:f,local:h,attrs:p}),_=u.err_list.map(function(e){return e.key}),r&&s.batchAttributesMap.forEach(function(e){var t,r,i,n,o,u;_.length?(t=_[0],i=!1,r={},!Array.isArray(e.data)&&t in e.data&&!l.some(function(r){return r.value==e.data[t]})||Array.isArray(e.data)&&-1!=e.data.indexOf(t)?(i=!0,n=[],1==e.action&&-1!==(o=e.data.findIndex(function(e){return e==t}))&&(n=e.data.slice(o)),0==e.action&&(n=Object.keys(e.data)),e.resolve&&e.resolve({roomID:s.groupID,errorKeys:n}),r={attributeList:l,data:e.data}):i?(1==e.action&&(u=e.data.slice()),0==e.action&&(u=Object.keys(e.data)),e.resolve&&e.resolve({roomID:s.groupID,errorKeys:u})):(r.error=!1,e.resolve&&e.resolve({roomID:s.groupID,errorKeys:_})),s.lg.i(a,"operaAttr",r)):e.resolve&&e.resolve({roomID:s.groupID,errorKeys:[]})}),{roomID:s.groupID,errorKeys:_})})},l.prototype.mergeSvrUserAttr=function(e,t){var r=this,s=[],i=[];return e.user_attributes.forEach(function(e){var n=e.user_id,a=e.attributes,u=e.err_list,c={},l=r.userAttributeMap.get(n)||{seq:0,attribute:[]};if(e.user_attributes_seq>l.seq)l.seq=e.user_attributes_seq,a.forEach(function(e){var t=l.attribute.find(function(t){return t.key==e.key});t?(t.value=e.value,c[e.key]=e.value):(l.attribute.push(o(o({},e),{value:e.value||""})),c[e.key]=e.value||"")});else if(t)for(d in t)(e=>{var r=t[e],s=l.attribute.find(function(t){return t.key==e});s?s.value=r:l.attribute.push({key:e,value:r}),c[e]=r})(d);else l.attribute.forEach(function(e){c[e.key]=e.value});if(r.userAttributeMap.set(n,l),(a.length||e.user_attributes_seq)&&s.push({attributesInfo:{userID:n,attributes:c}}),t){var d,p=u.map(function(e){return e.key}),h={};for(d in t)-1==p.indexOf(d)&&(h[d]=c[d]);i.push({errorKeys:p,attributesInfo:{userID:n,attributes:h}})}}),[s,i]},l.prototype.queryAllAttrRsp=function(e,t,r){var s,i={delete:{},set:{}},o={};return t.map=i,t.local=this.printLocalRoomAttr(),t.attrs=o,this.stRoomAttributes.attribute_seq=e.attributes.attribute_seq,e.attributes.attributes.length?((s=this.stRoomAttributes.attributes).forEach(function(e){return e.seq=0}),e.attributes.attributes.forEach(function(e){var t;e&&e.key&&(o[e.key]=e,(t=s.find(function(t){return t.key==e.key}))?(t.value===e.value&&t.auto_delete===e.auto_delete||(i.set[e.key]=e.value),Object.assign(t,e)):(i.set[e.key]=e.value,s.push(e)))}),this.stRoomAttributes.attributes=s.filter(function(e){return e.seq||(i.delete[e.key]=""),!!e.seq})):(this.stRoomAttributes.attributes.forEach(function(e){i.delete[e.key]=""}),this.stRoomAttributes.attributes=[]),e=[],Object.keys(i.set).length&&e.push({action:0,roomAttributes:i.set}),Object.keys(i.delete).length&&e.push({action:1,roomAttributes:i.delete}),this.lg.i(a,r?n.vv.QueryRoomAllAttr:"queryRoomAllAttr",t),!r&&0<e.length&&(t=1<e.length?n.R0.RoomAttrBatch:n.R0.RoomAttr,this.bus.emit(t,{roomID:this.groupID,infos:e})),{roomID:this.groupID,roomAttributes:this.getRecordFromStRoomAttributes()}},l.prototype.addAttr=function(e,t){if(t&&"[object Object]"==Object.prototype.toString.call(t.roomAttributes)){var r,s,i=[];for(r in t.roomAttributes)r&&(s={key:r,value:t.roomAttributes[r].toString(),seq:++this.attrItemSeq,auto_delete:1},i.push(s),this.localAttrKeySeqMap[r]=s.seq);i.length&&(e.attributes=i)}t&&t.roomDestroyDelayTime&&(e.destroy_delay=+t.roomDestroyDelayTime)},l.prototype.batchAttr=function(e,t,r){var s=this;if(this.batchRoomAttributes||(this.batchRoomAttributes=[]),Array.isArray(r))this.batchAttributesMap.set(++this.batchIndex,{action:1,data:r,resolve:e,reject:t}),r.forEach(function(e){return s.batchRoomAttributes.push({action:1,key:e,value:""})});else for(var i in this.batchAttributesMap.set(++this.batchIndex,{action:0,data:r,resolve:e,reject:t}),r)this.batchRoomAttributes.push({action:0,key:i,value:r[i]});this.lg.i(a,"bmdfAttr",{param:r,batch:JSON.stringify(this.batchRoomAttributes)})},l.prototype.getRecordFromStRoomAttributes=function(){var e;return this.stRoomAttributes.attributes.length?(e={},this.stRoomAttributes.attributes.forEach(function(t){e[t.key]=t.value}),e):{}},l.prototype.checkRoomAttributesUpdateByHb=function(e){var t=this;this.stRoomAttributes&&e.attribute_seq>this.stRoomAttributes.attribute_seq+1&&(this.attrTimer=setTimeout(function(){t.cnMgr&&t.queryAttr(n.Sk.S)},this.mergeConfig.attrMergeTimeout))},l.prototype.fetchPageUser=function(e,t,r){var s=this;return e={room_id:this.groupID,room_session_id:this.sessionID,sub_room_id:this.subRoomID,count:e,pos_flag:t,expect_seq:this.localSeq},this.cnMgr.send(n.Fs.rm_userlist,e,r).then(function(e){return e.code?e.users=[]:(s.totalMemberCount=e.user_count,s.localSeq=e.userlist_seq),e})},l.prototype.emitState=function(e,t,r){this.state=e,this.bus.emit(n.R0.RoomState,{roomID:this.groupID,state:e,event:t,extendedData:r||""}),0==e&&3==t&&(r=this.econf.dbConvMap.get(this.econf.user.userID+1+this.groupID))&&(r.maxSeq=0,r.msgSeq=0,r.maxOrderKey=0,r.roomSessionID="",this.dbMgr.addConversationList([r]),this.dbMgr.clearRoomMessage(this.groupID,this.enabledOfflineMsg))},l.prototype.handleEnterError=function(e,t){var r=2==this.state&&103032==t?2:0,s=7;e==n.g1.Create?s=5:e==n.g1.Switch?s=12:6000105==t?s=2:103021==t&&(s=3),this.emitState(r,2==r?4:s),0==r&&this.destroy(!1)},l.prototype.handleEnterRsp=function(e,t,r){this.subRoomID=t.sub_room_id,this.sessionID=t.room_session_id,this.userSessionID=t.room_user_session_id,this.groupName=(0,i.sc)(t.room_name),this.enabledOfflineMsg=!!t.enabled_offline_msg,this.totalMemberCount=t.user_count||1;var s,a=t.room_info_interval;this.hbItvl=a=!a||a<1e3?15e3:a,this.hbTimer&&clearTimeout(this.hbTimer),this.hbTimer=setTimeout(this.startHB,this.hbItvl),this.mergeConfig.listPullInterval=t.userlist_interval,this.mergeConfig.listMergeTimeout=t.userlist_merge_timeout,this.mergeConfig.attrPullInterval=t.attributes_pull_interval,this.mergeConfig.attrMergeTimeout=t.attributes_merge_timeout,this.isMergeUser=1==t.userlist_enable,this.destroyDelay=t.destroy_delay||0,this.startHB(!0),this.isMergeUser&&(e==n.g1.Create?(a={userID:this.econf.user.userID,userName:this.econf.user.userName,userAvatarUrl:this.econf.user.userAvatarUrl,userExtendedData:this.econf.user.userExtendedData},this.userMap.set(a.userID,a),this.bus.emit(n.R0.RoomMemberJoined,{roomID:this.groupID,memberList:[o({},a)]})):t.userlist_seq!=this.localSeq&&this.fetchAllUser()),t.attributes&&t.attributes.attributes.length&&((s=null==r?void 0:r.roomAttributes)&&t.attributes.attributes.forEach(function(e){e.seq&&s[e.key]&&(e.value=s[e.key])}),this.stRoomAttributes=t.attributes,e={action:0,roomAttributes:this.getRecordFromStRoomAttributes()},this.bus.emit(n.R0.RoomAttr,{roomID:this.groupID,infos:[e]}))},l.prototype.createUser=function(e){return{userID:e.user_id,userName:(0,i.sc)(e.user_name),userAvatarUrl:(0,i.sc)(e.avatar),userExtendedData:(0,i.sc)(e.extra)}},l.prototype.fetchAllUser=function(){var e=this,t={time:new Date,event:"fetchAllUser",roomID:this.groupID,localSeq:this.localSeq,totalMemberCount:this.totalMemberCount},r=[],s=function(i){i.users.forEach(function(t){return r.push(e.createUser(t))}),i.pos_flag&&e.cnMgr?e.fetchPageUser(100,i.pos_flag,n.Sk.S).then(s):(e.updateUserList(r),t.localSeq_=e.localSeq,t.tatalMemberCount_=e.totalMemberCount,e.lg.i(a,u,t))},i=Date.now(),o=this.lastFetchAllUserTime+this.mergeConfig.listPullInterval;setTimeout(function(){e.lastFetchAllUserTime=i,e.cnMgr&&e.fetchPageUser(100,"",n.Sk.S).then(s)},i<o?o-i:0)},l.prototype.waitingMergeUser=function(e,t,r){var s,i,c,l=this;e<=this.localSeq?this.lg.i(a,u,{roomID:this.groupID,event:"dropMerge",action:r,seq:e,localSeq:this.localSeq,totalMemberCount:this.totalMemberCount}):e!=this.localSeq+1||this.mergeTimer?(-1==this.mergeSeqList.indexOf(e)&&this.mergeSeqList.push(e),s=t.userID,c=this.mergeUserList.findIndex(function(e){return e.userID==s}),"enter"==r&&-1==c?this.mergeUserList.push(t):"quit"==r&&-1!=c&&this.mergeUserList.splice(c,1),this.mergeTimer||(i={roomID:this.groupID,event:"waitingPush",action:r,seq:e,localSeq:this.localSeq,totalMemberCount:this.totalMemberCount},-1==this.mergeSeqList.indexOf(this.localSeq)&&this.mergeSeqList.push(this.localSeq),this.mergeTimer=setTimeout(function(){var e;l.cnMgr&&(l.mergeSeqList.sort(),e=l.mergeSeqList.length-1,(e=l.mergeSeqList[e]-l.mergeSeqList[0]==e)?l.updateUserList(l.mergeUserList):l.fetchAllUser(),Object.assign(i,{time:l.mergeConfig.listMergeTimeout,localSeq_:l.localSeq,tatalMemberCount_:l.totalMemberCount,continuous:e,mergeSeqList:l.mergeSeqList}),l.lg.i(a,u,i),l.mergeTimer=0,l.mergeSeqList.length=0,l.mergeUserList.length=0)},this.mergeConfig.listMergeTimeout))):(this.localSeq=e,c=this.userMap.has(t.userID),"enter"!=r||c?"quit"==r&&c&&(this.userMap.delete(t.userID),this.subRoomID||this.bus.emit(n.R0.RoomMemberLeft,{roomID:this.groupID,memberList:[o({},t)]})):(this.userMap.set(t.userID,t),this.subRoomID||this.bus.emit(n.R0.RoomMemberJoined,{roomID:this.groupID,memberList:[o({},t)]})),t={roomID:this.groupID,event:"continuousMerge",action:r,has:c,seq:e,localSeq:this.localSeq,totalMemberCount:this.totalMemberCount},this.lg.i(a,u,t))},l.prototype.updateUserList=function(e){var t=this,r=e.map(function(e){return e.userID}),s=Array.from(this.userMap.values()),i=(e=e.filter(function(e){var r=!t.userMap.has(e.userID);return r&&t.userMap.set(e.userID,o({},e)),r}),s.filter(function(e){var s=-1==r.indexOf(e.userID);return s&&t.userMap.delete(e.userID),s}));e.length&&!this.subRoomID&&this.bus.emit(n.R0.RoomMemberJoined,{roomID:this.groupID,memberList:e}),i.length&&!this.subRoomID&&this.bus.emit(n.R0.RoomMemberLeft,{roomID:this.groupID,memberList:i}),s={roomID:this.groupID,event:"updateMember",localSeq:this.localSeq,totalMemberCount:this.totalMemberCount,mergeIds:r,beginLocalIds:s.map(function(e){return e.userID}),endLocalIDs:Array.from(this.userMap.keys()),joinedUserIDs:e.map(function(e){return e.userID}),leftUserIDs:i.map(function(e){return e.userID})},this.lg.i(a,u,s)},l.prototype.printLocalRoomAttr=function(){return this.stRoomAttributes.attributes.reduce(function(e,t){return e[t.key]=t,e},{seq:this.stRoomAttributes.attribute_seq})},t([(0,i.hu)(n.hT.get_user_attribute_qps,n.hT.get_user_attribute_interval,n.vv.QueryRoomMembersAttr)],l.prototype,"queryMembersAttr",null),t([(0,i.hu)(n.hT.get_user_attribute_qps,n.hT.get_user_attribute_interval,n.vv.QueryRoomMemberAttrs)],l.prototype,"queryMemberAttrs",null),l);function l(e,t,r,i,o){var a=this;this.type=1,this.state=0,this.subRoomID="",this.enabledOfflineMsg=!1,this.destroyDelay=0,this.userMap=new Map,this.userAttributeMap=new Map,this.totalMemberCount=0,this.isMergeUser=!1,this.mergeTimer=0,this.mergeSeqList=[],this.mergeUserList=[],this.mergeConfig={listMergeTimeout:0,listPullInterval:0,attrMergeTimeout:0,attrPullInterval:0},this.lastFetchAllUserTime=0,this.hbItvl=0,this.hbTimer=0,this.localSeq=0,this.userAttrSeq=0,this.attrItemSeq=0,this.stRoomAttributes={attributes:[],attribute_seq:0},this.localAttrKeySeqMap={},this.batchOperationConfig=null,this.batchRoomAttributes=[],this.batchAttributesMap=new Map,this.batchIndex=0,this.batchFlag=!1,this.attrTimer=null,this.queryAttrTask=[],this.startHB=function(e){var t,r;e||(a.hbTimer=setTimeout(a.startHB,a.hbItvl)),a.cnMgr&&a.econf&&a.econf.token&&a.sessionID&&(t=new Date,r={room_id:a.groupID,room_session_id:a.sessionID,sub_room_id:a.subRoomID},a.cnMgr.sendHB(n.Fs.rm_info,r).then(function(r){if(o=r.code){if(s.A.getInstance().dr.addHbLog(t,a.groupID,r.timeout||o),-1!=n.hT.needReloginCodeList.indexOf(o)){var i=2;switch(o){case 103015:i=9;break;case 103021:i=3}a.emitState(0,i),a.destroy(!1)}r.state=a.state}else{e&&a.emitState(2,0),a.totalMemberCount=r.user_count,a.subRoomID=r.sub_room_id;var o=r.max_conv_msg_seq||0,u=r.statemsg_seq||0;a.bus.exec(n.R0.IConnectedRoom,a.groupID,{msgSeq:o,fetchMsg:a.enabledOfflineMsg&&!!o,stateSeq:u,fetchState:e}),r.ulist_to&&(a.mergeConfig.listMergeTimeout=r.ulist_to),r.ulist_itvl&&(a.mergeConfig.listPullInterval=r.ulist_itvl),a.checkRoomAttributesUpdateByHb(r),o={msg:o,state:u,user:a.totalMemberCount,login:r.multilogin_count},s.A.getInstance().dr.addHbLog(t,a.groupID,o)}}))},this.lg=s.A.getInstance().lg,this.groupID=e,this.econf=t,this.bus=r,this.dbMgr=i,this.cnMgr=o}},955:function(e,t,r){e.exports=(e=>{for(var t=e,r=t.lib.BlockCipher,s=t.algo,i=[],n=[],o=[],a=[],u=[],c=[],l=[],d=[],p=[],h=[],f=[],m=0;m<256;m++)f[m]=m<128?m<<1:m<<1^283;var g=0,_=0;for(m=0;m<256;m++){var v=_^_<<1^_<<2^_<<3^_<<4,b=f[n[i[g]=v=v>>>8^255&v^99]=g],y=f[b],M=f[y],k=257*f[v]^16843008*v;o[g]=k<<24|k>>>8,a[g]=k<<16|k>>>16,u[g]=k<<8|k>>>24,c[g]=k,l[v]=(k=16843009*M^65537*y^257*b^16843008*g)<<24|k>>>8,d[v]=k<<16|k>>>16,p[v]=k<<8|k>>>24,h[v]=k,g?(g=b^f[f[f[M^b]]],_^=f[f[_]]):g=_=1}var S=[0,1,2,4,8,16,32,64,128,27,54];return s=s.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,s=4*(1+(this._nRounds=6+r)),n=this._keySchedule=[],o=0;o<s;o++)o<r?n[o]=t[o]:(c=n[o-1],o%r?6<r&&o%r==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=S[o/r|0]<<24),n[o]=n[o-r]^c);for(var a=this._invKeySchedule=[],u=0;u<s;u++){var c;o=s-u,c=u%4?n[o]:n[o-4],a[u]=u<4||o<=4?c:l[i[c>>>24]]^d[i[c>>>16&255]]^p[i[c>>>8&255]]^h[i[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,u,c,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,d,p,h,n),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,s,i,n,o,a){for(var u=this._nRounds,c=e[t]^r[0],l=e[t+1]^r[1],d=e[t+2]^r[2],p=e[t+3]^r[3],h=4,f=1;f<u;f++){var m=s[c>>>24]^i[l>>>16&255]^n[d>>>8&255]^o[255&p]^r[h++],g=s[l>>>24]^i[d>>>16&255]^n[p>>>8&255]^o[255&c]^r[h++],_=s[d>>>24]^i[p>>>16&255]^n[c>>>8&255]^o[255&l]^r[h++],v=s[p>>>24]^i[c>>>16&255]^n[l>>>8&255]^o[255&d]^r[h++];c=m,l=g,d=_,p=v}m=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[d>>>8&255]<<8|a[255&p])^r[h++],g=(a[l>>>24]<<24|a[d>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^r[h++],_=(a[d>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^r[h++],v=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&d])^r[h++],e[t]=m,e[t+1]=g,e[t+2]=_,e[t+3]=v},keySize:8}),t.AES=r._createHelper(s),e.AES})(r(9021),(r(754),r(4636),r(9506),r(7165)))},1025:function(e,t,r){var s;e.exports=(e=r(9021),r=e.lib.Base,s=e.enc.Utf8,void(e.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));for(var r=e.blockSize,i=4*r,n=((t=t.sigBytes>i?e.finalize(t):t).clamp(),e=this._oKey=t.clone(),t=this._iKey=t.clone(),e.words),o=t.words,a=0;a<r;a++)n[a]^=1549556828,o[a]^=909522486;e.sigBytes=t.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})))},1084:(e,t,r)=>{r.d(t,{_:()=>i});var s,i={decode:function(e){if(void 0===s){var t="0123456789ABCDEF";for(s={},o=0;o<16;++o)s[t.charAt(o)]=o;for(t=t.toLowerCase(),o=10;o<16;++o)s[t.charAt(o)]=o;for(o=0;o<8;++o)s[" \f\n\r\t \u2028\u2029".charAt(o)]=-1}for(var r=[],i=0,n=0,o=0;o<e.length;++o){var a=e.charAt(o);if("="==a)break;if(-1!=(a=s[a])){if(void 0===a)throw new Error("Illegal character at offset "+o);i|=a,2<=++n?(r[r.length]=i,n=i=0):i<<=4}}if(n)throw new Error("Hex encoding incomplete: 4 bits missing");return r}}},1126:(e,t,r)=>{r.d(t,{o:()=>i});var s,i={decode:function(e){if(void 0===s){for(s=Object.create(null),n=0;n<64;++n)s["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(n)]=n;for(s["-"]=62,s._=63,n=0;n<9;++n)s["= \f\n\r\t \u2028\u2029".charAt(n)]=-1}for(var t=[],r=0,i=0,n=0;n<e.length;++n){var o=e.charAt(n);if("="==o)break;if(-1!=(o=s[o])){if(void 0===o)throw new Error("Illegal character at offset "+n);r|=o,4<=++i?(t[t.length]=r>>16,t[t.length]=r>>8&255,t[t.length]=255&r,i=r=0):r<<=6}}switch(i){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:t[t.length]=r>>10;break;case 3:t[t.length]=r>>16,t[t.length]=r>>8&255}return t},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=i.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return i.decode(e)}}},1447:(e,t)=>{t.length=function(e){for(var t,r=0,s=0;s<e.length;++s)(t=e.charCodeAt(s))<128?r+=1:t<2048?r+=2:55296==(64512&t)&&56320==(64512&e.charCodeAt(s+1))?(++s,r+=4):r+=3;return r},t.read=function(e,t,r){if(r-t<1)return"";for(var s,i=null,n=[],o=0;t<r;)(s=e[t++])<128?n[o++]=s:191<s&&s<224?n[o++]=(31&s)<<6|63&e[t++]:239<s&&s<365?(s=((7&s)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,n[o++]=55296+(s>>10),n[o++]=56320+(1023&s)):n[o++]=(15&s)<<12|(63&e[t++])<<6|63&e[t++],8191<o&&((i=i||[]).push(String.fromCharCode.apply(String,n)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,n.slice(0,o))),i.join("")):String.fromCharCode.apply(String,n.slice(0,o))},t.write=function(e,t,r){for(var s,i,n=r,o=0;o<e.length;++o)(s=e.charCodeAt(o))<128?t[r++]=s:(s<2048?t[r++]=s>>6|192:(55296==(64512&s)&&56320==(64512&(i=e.charCodeAt(o+1)))?(++o,t[r++]=(s=65536+((1023&s)<<10)+(1023&i))>>18|240,t[r++]=s>>12&63|128):t[r++]=s>>12|224,t[r++]=s>>6&63|128),t[r++]=63&s|128);return r-n}},1509:(e,t,r)=>{r.d(t,{Bv:()=>function(e,t){return new i(e,t)},jZ:()=>i});var s=r(3842),i=(n.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,i=(1<<t)-1,n=!1,o="",a=this.t,u=this.DB-a*this.DB%t;if(0<a--)for(u<this.DB&&0<(r=this[a]>>u)&&(n=!0,o=(0,s.W)(r));0<=a;)u<t?(r=(this[a]&(1<<u)-1)<<t-u,r|=this[--a]>>(u+=this.DB-t)):(r=this[a]>>(u-=t)&i,u<=0&&(u+=this.DB,--a)),(n=0<r||n)&&(o+=(0,s.W)(r));return n?o:"0"},n.prototype.negate=function(){var e=l();return n.ZERO.subTo(this,e),e},n.prototype.abs=function(){return this.s<0?this.negate():this},n.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;0<=--r;)if(0!=(t=this[r]-e[r]))return t;return 0},n.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+g(this[this.t-1]^this.s&this.DM)},n.prototype.mod=function(e){var t=l();return this.abs().divRemTo(e,null,t),this.s<0&&0<t.compareTo(n.ZERO)&&e.subTo(t,t),t},n.prototype.modPowInt=function(e,t){return t=new(e<256||t.isEven()?o:u)(t),this.exp(e,t)},n.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},n.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},n.prototype.copyTo=function(e){for(var t=this.t-1;0<=t;--t)e[t]=this[t];e.t=this.t,e.s=this.s},n.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,0<e?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},n.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var s=e.length,i=!1,o=0;0<=--s;){var a=8==r?255&+e[s]:f(e,s);a<0?"-"==e.charAt(s)&&(i=!0):(i=!1,0==o?this[this.t++]=a:o+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&!!(128&+e[0])&&(this.s=-1,0<o)&&(this[this.t-1]|=(1<<this.DB-o)-1<<o),this.clamp(),i&&n.ZERO.subTo(this,this)},n.prototype.clamp=function(){for(var e=this.s&this.DM;0<this.t&&this[this.t-1]==e;)--this.t},n.prototype.dlShiftTo=function(e,t){for(var r=this.t-1;0<=r;--r)t[r+e]=this[r];for(r=e-1;0<=r;--r)t[r]=0;t.t=this.t+e,t.s=this.s},n.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s},n.prototype.lShiftTo=function(e,t){for(var r=e%this.DB,s=this.DB-r,i=(1<<s)-1,n=Math.floor(e/this.DB),o=this.s<<r&this.DM,a=this.t-1;0<=a;--a)t[a+n+1]=this[a]>>s|o,o=(this[a]&i)<<r;for(a=n-1;0<=a;--a)t[a]=0;t[n]=o,t.t=this.t+n+1,t.s=this.s,t.clamp()},n.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var s=e%this.DB,i=this.DB-s,n=(1<<s)-1;t[0]=this[r]>>s;for(var o=r+1;o<this.t;++o)t[o-r-1]|=(this[o]&n)<<i,t[o-r]=this[o]>>s;0<s&&(t[this.t-r-1]|=(this.s&n)<<i),t.t=this.t-r,t.clamp()}},n.prototype.subTo=function(e,t){for(var r=0,s=0,i=Math.min(e.t,this.t);r<i;)s+=this[r]-e[r],t[r++]=s&this.DM,s>>=this.DB;if(e.t<this.t){for(s-=e.s;r<this.t;)s+=this[r],t[r++]=s&this.DM,s>>=this.DB;s+=this.s}else{for(s+=this.s;r<e.t;)s-=e[r],t[r++]=s&this.DM,s>>=this.DB;s-=e.s}t.s=s<0?-1:0,s<-1?t[r++]=this.DV+s:0<s&&(t[r++]=s),t.t=r,t.clamp()},n.prototype.multiplyTo=function(e,t){var r=this.abs(),s=e.abs(),i=r.t;for(t.t=i+s.t;0<=--i;)t[i]=0;for(i=0;i<s.t;++i)t[i+r.t]=r.am(0,s[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&n.ZERO.subTo(t,t)},n.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;0<=--r;)e[r]=0;for(r=0;r<t.t-1;++r){var s=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,s,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}0<e.t&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},n.prototype.divRemTo=function(e,t,r){if(!((d=e.abs()).t<=0)){var s=this.abs();if(s.t<d.t)null!=t&&t.fromInt(0),null!=r&&this.copyTo(r);else{null==r&&(r=l());var i=l(),o=this.s,a=(e=e.s,this.DB-g(d[d.t-1])),u=(0<a?(d.lShiftTo(a,i),s.lShiftTo(a,r)):(d.copyTo(i),s.copyTo(r)),i.t),c=i[u-1];if(0!=c){var d=c*(1<<this.F1)+(1<u?i[u-2]>>this.F2:0),p=this.FV/d,h=(1<<this.F1)/d,f=1<<this.F2,m=r.t,_=m-u,v=null==t?l():t;for(i.dlShiftTo(_,v),0<=r.compareTo(v)&&(r[r.t++]=1,r.subTo(v,r)),n.ONE.dlShiftTo(u,v),v.subTo(i,i);i.t<u;)i[i.t++]=0;for(;0<=--_;){var b=r[--m]==c?this.DM:Math.floor(r[m]*p+(r[m-1]+f)*h);if((r[m]+=i.am(0,b,r,_,0,u))<b)for(i.dlShiftTo(_,v),r.subTo(v,r);r[m]<--b;)r.subTo(v,r)}null!=t&&(r.drShiftTo(u,t),o!=e)&&n.ZERO.subTo(t,t),r.t=u,r.clamp(),0<a&&r.rShiftTo(a,r),o<0&&n.ZERO.subTo(r,r)}}}},n.prototype.invDigit=function(){var e,t;return this.t<1||!(1&(e=this[0]))?0:0<(t=(t=(t=(t=(t=3&e)*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)?this.DV-t:-t},n.prototype.isEven=function(){return 0==(0<this.t?1&this[0]:this.s)},n.prototype.exp=function(e,t){if(4294967295<e||e<1)return n.ONE;var r,s=l(),i=l(),o=t.convert(this),a=g(e)-1;for(o.copyTo(s);0<=--a;)t.sqrTo(s,i),0<(e&1<<a)?t.mulTo(i,o,s):(r=s,s=i,i=r);return t.revert(s)},n.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},n.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||36<e)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),s=m(r),i=l(),n=l(),o="";for(this.divRemTo(s,i,n);0<i.signum();)o=(r+n.intValue()).toString(e).substr(1)+o,i.divRemTo(s,i,n);return n.intValue().toString(e)+o},n.prototype.fromRadix=function(e,t){this.fromInt(0);for(var r=this.chunkSize(t=null==t?10:t),s=Math.pow(t,r),i=!1,o=0,a=0,u=0;u<e.length;++u){var c=f(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(i=!0):(a=t*a+c,++o>=r&&(this.dMultiply(s),this.dAddOffset(a,0),a=o=0))}0<o&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),i&&n.ZERO.subTo(this,this)},n.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},n.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},n);function n(e,t){null!=e&&(null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}a.prototype.convert=function(e){return e.s<0||0<=e.compareTo(this.m)?e.mod(this.m):e},a.prototype.revert=function(e){return e},a.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},a.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},a.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var o=a;function a(e){this.m=e}c.prototype.convert=function(e){var t=l();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&0<t.compareTo(i.ZERO)&&this.m.subTo(t,t),t},c.prototype.revert=function(e){var t=l();return e.