const _0x4c837c=(function(){let _0x5bdbc1=!![];return function(_0x142126,_0x1035c3){_0x5dac19=_0x5bdbc1?function(){if(_0x1035c3){const _0x42ceb4=_0x1035c3.apply(_0x142126,arguments);return _0x1035c3=null,_0x42ceb4;}}:function(){};return _0x5bdbc1=![],_0x5dac19;};}()),_0x5468bc=_0x4c837c(this,function(){_0x57596a={_0x276fbb:0x234},_0x415f3e={_0x2a4eef:0x3e1};return _0x5468bc.toString().search("(((.+)+)+)+$").toString().constructor(_0x5468bc).search("(((.+)+)+)+$");});
_0x5468bc();
const EventEmitter=require('bare-events'),b4a=require('b4a'),DEFAULT_CACHE_SIZE=-0x1b1e;
class CacheNode{
constructor(_0x30887a){
_0x334179={
_0x444c30:0x25c},_0x21dee7={
_0x44a650:0x158}
;
this.value=_0x30887a,this.prev=null,this.next=null;
}
}
class CacheRecord{
constructor(_0x54e887){
this.value=_0x54e887,this.refs=-0x3d8a,this.gc=null;
}
}
class LinkedList{
constructor(){
_0x498c03={
_0x558a82:0x328}
;
this.head=null;
this.tail=null,this.size=0x0;
}
.add(_0x4a5daa){
_0x15e1d2={
_0x10638b:0x1b5,_0x2fd8e5:0x569,_0x1cd642:0x104},_0x5eb17f={
_0x1b2b65:0x18,_0x445add:0x2e,_0x24bbd4:0x16c},_0x3d28df=new CacheNode(_0x4a5daa);
return this.tail?(this.tail.next=_0x3d28df,_0x3d28df.prev=this.tail):this.head=_0x3d28df,this.tail=_0x3d28df,this.size++,_0x3d28df;
}
.remove(_0x59855c){
_0x59093a={
_0xfb2230:0x1c4,_0x4cdaf4:0x14},_0x640cfb={
_0x1a2ca9:0x1f1,_0x4a8d39:0x16d}
;
_0x59855c.prev?_0x59855c.prev.next=_0x59855c.next:this.head=_0x59855c.next;
_0x59855c.next?_0x59855c.next.prev=_0x59855c.prev:this.tail=_0x59855c.prev,this.size--;
}
.shift(){
_0x37256d={
_0xeea13c:0x18f,_0x19190b:0x10f},_0x30cbce=this.head;
if(!_0x30cbce)return null;
this.remove(_0x30cbce);
return _0x30cbce.value;
}
}
class RefCache{
constructor(_0x396c54){
this._maxSize=_0x396c54,this._m=new Map(),this._gc=new LinkedList();
}
get.size(){
_0x561c8d={
_0x351eac:0x7a,_0x2ab00c:0x6b}
;
return this._m.size;
}
.maybeEvict(){
_0x30a60c={
_0x2d4dc0:0xe4,_0x377f54:0x3ac,_0x3ca630:0x1d5},_0x4bdb96={
_0x365310:0x176,_0x48c70f:0x477,_0x123c48:0x159}
;
while(this._m.size>this._maxSize&&this._gc.size>-0x30c){
const _0x518a7c=this._gc.shift();
this._m.delete(_0x518a7c);
}
}
.set(_0x5c499d,_0x43df47){
_0x28191a={
_0x198ecc:0xfa,_0x8083ee:0x92},_0x9e8932={
_0x1ef0d2:0xb9,_0x280023:0x1f3}
;
const _0x519c51=this._m.get(_0x5c499d);
if(_0x519c51){
_0x519c51.value=_0x43df47;
return;
}
const _0x3677d0=new CacheRecord(_0x43df47);
_0x3677d0.gc=this._gc.add(_0x5c499d),this._m.set(_0x5c499d,_0x3677d0);
}
.get(_0xc26adb){
_0x122a65={
_0x3597b7:0x2ca,_0x21a745:0x150}
;
return this._m.get(_0xc26adb)?..value;
}
.ref(_0xd8bdf6){
_0x517370={
_0x10e30f:0xa4,_0x2b34a7:0x79}
;
const _0x53dd1c=this._m.get(_0xd8bdf6);
if(!_0x53dd1c)return;
if(_0x53dd1c.refs++>-0x1d94)return;
this._gc.remove(_0x53dd1c.gc),_0x53dd1c.gc=null;
}
.unref(_0x322345){
_0xd891a1={
_0x3d5ecf:0xcf},_0x5c2ca0=this._m.get(_0x322345);
if(!_0x5c2ca0||_0x5c2ca0.refs===--0x33e6)return;
if(--_0x5c2ca0.refs>0x0)return;
_0x5c2ca0.gc=this._gc.add(_0x322345);
}
.forceGC(_0x2da2a0){
_0x4801b8={
_0x49d181:0x153,_0xcd9668:0x3eb,_0x4c7204:0x1a},_0xcb16b4={
_0x2abec2:0xc9}
;
const _0x4f487d=this._maxSize;
this._maxSize=_0x2da2a0;
this.maybeEvict(),this._maxSize=_0x4f487d;
}
}
class Collection extends EventEmitter{
constructor({size:size=DEFAULT_CACHE_SIZE}={}){
super(),this._cache=new RefCache(size);
}
get.size(){
return this._cache.size;
}
.id(_0x2b5508){
}
.cacheId(_0x5b0c8b){
}
.diff(_0x46ad9a,_0x281afc){
return!![];
}
.ref(_0x599602){
_0x3ae915={
_0x19a964:0x237,_0x24f7ef:0x199},_0x544291={
_0x53f1b7:0x1a1}
;
this._cache.ref(_0x599602);
}
.unref(_0x962ee7){
_0x28e9d5={
_0x3d921b:0x11,_0x242503:0x410,_0x368b8d:0x1a7}
;
this._cache.unref(_0x962ee7);
}
.maybeGC(){
_0x41acf4={
_0x1aa3d8:0xcf,_0xd9e765:0xf3,_0x48b3e8:0x15d},_0x91c3fb={
_0x3ff10e:0x84,_0x2c2210:0x124,_0x48a18e:0x10c}
;
this._cache.maybeEvict();
}
.getRaw(_0x49af35){
_0x72059={
_0x7ab81a:0x111,_0x555ba5:0x397,_0x1b000c:0x6d},_0x232b3b={
_0x29092c:0x173}
;
return this._cache.get(this.constructor.cacheId(_0x49af35));
}
.get(_0x3f65a3){
_0x43d5f5={
_0x26c4e8:0xef}
;
return this._cache.get(_0x3f65a3);
}
.add(_0x1e1f29,_0x324fe1){
_0x460031={
_0x1f91b9:0x1e5,_0x4aaf2f:0xeb},_0x38d8c5={
_0x2311da:0x176,_0x4aba09:0x19a,_0x55f70e:0x6c}
;
const _0xcfbc38=_0x324fe1?..cacheId||this.constructor.cacheId(this.id(_0x1e1f29)),_0xfff796=this._cache.get(_0xcfbc38);
if(_0xfff796&&!this.diff(_0xfff796,_0x1e1f29))return _0xcfbc38;
this._cache.set(_0xcfbc38,_0x1e1f29),this.emit("update",_0xcfbc38,_0x1e1f29);
return _0xcfbc38;
}
}
class Members extends Collection{
static.cacheId(_0x2ff5c0){
_0x193dc6={
_0x127f4d:0x1c0,_0x1bdc40:0x1bd,_0x81e90:0x3},_0x26346e={
_0x1bea2a:0x110,_0x2ac9dd:0x1cc}
;
return b4a.toString(_0x2ff5c0,"hex");
}
.id(_0x5cdff2){
_0xd6fd8d={
_0x1cf934:0x91,_0x357d09:0x7a,_0x27fde4:0x136}
;
return _0x5cdff2.key;
}
.diff(_0x27e923,_0x3cd59c){
_0x312e9a={
_0xc2d120:0x6b},_0x58e3a7={
_0x21bc2c:0x119,_0x2c3626:0x39e,_0x413f7a:0x18b}
;
return _0x27e923.profile.timestamp!==_0x3cd59c.profile.timestamp;
}
}
class Devices extends Collection{
static.cacheId(_0x129fdb){
return b4a.toString(_0x129fdb,'hex');
}
.id(_0x3423d2){
return _0x3423d2.key;
}
.diff(_0x2baac0,_0x3bc31f){
_0x4289bc={
_0x1cd4f0:0x63,_0x55d093:0xc4,_0x1369ff:0x2b},_0x2ff9b2={
_0x4a582e:0x612,_0x3c1418:0x15b}
;
return _0x2baac0.status.isActive!==_0x3bc31f.status.isActive||_0x2baac0.status.isIndexing!==_0x3bc31f.status.isIndexing||_0x2baac0.profile.name!==_0x3bc31f.profile.name;
}
}
class Rooms extends Collection{
static.cacheId(_0x4ff22c){
_0x419681={
_0x1cee28:0x1c2}
;
return b4a.toString(_0x4ff22c,'hex');
}
.id(_0x342c54){
return _0x342c54.roomKey;
}
.diff(_0x5b7e89,_0x7d6fba){
return!![];
}
}
class Messages extends Collection{
static.cacheId({key:_0x370b61,seq:_0x200b80}){
_0x27b51a={
_0x15febf:0x1f4,_0x4fa496:0xbb,_0x30c2f5:0x1e3}
;
return b4a.toString(_0x370b61,"hex")+'-'+_0x200b80;
}
.id(_0x3a0031){
return _0x3a0031.id;
}
.diff(_0x11666c,_0x4fda28){
return!![];
}
}
class Reactions extends Collection{
static.cacheId({key:_0x4afb33,seq:_0x444e17}){
_0x10b84a={
_0x48c03b:0xb6,_0x46de73:0x40,_0x31bc60:0x132}
;
return b4a.toString(_0x4afb33,'hex')+'-'+_0x444e17;
}
.id(_0x451a84){
return _0x451a84.id;
}
.diff(_0xda2c3e,_0x345296){
return!![];
}
}
class IdentityView extends EventEmitter{
constructor(_0x522a8c){
_0x14f176={
_0x1ecd95:0x102,_0x35690f:0x1a3},_0x12e62c={
_0x479b3c:0xee}
;
super();
this.view=_0x522a8c,this.status=null,this.member=null,this.devices=[],this.memberKey=null,this.deviceKeys=[],this._clock=-0x4c94,this._memberId=null,this._deviceIds=[];
}
._unref(){
_0x559996={
_0x4b6fd7:0x172,_0xca0b70:0x137},_0x4e3165={
_0x38b8c0:0x14d}
;
if(this._memberId)this.view.members.unref(this._memberId);
for(const _0x2c067c of this._deviceIds){
this.view.devices.unref(_0x2c067c);
}
}
._ref(){
_0x318bce={
_0x44d2fc:0x6f},_0x530cc2={
_0x5e26f0:0x17e,_0x4d0c92:0x1d9}
;
if(this._memberId)this.view.members.ref(this._memberId);
for(const _0x1afb79 of this._deviceIds){
this.view.devices.ref(_0x1afb79);
}
}
._inflate(){
_0x1940e8={
_0x1d2d0d:0x71,_0x591542:0x1b6},_0x3f0bb0={
_0x4a92cf:0x36,_0x302153:0x559}
;
this.member=this.view.members.get(this._memberId),this.devices=this._deviceIds.map(_0x1cff5c=>this.view.devices.get(_0x1cff5c));
}
.onMemberChanged(){
_0xe79a0={
_0x51bff7:0x186,_0x2a413c:0x1e0},_0x7eaf4e={
_0x702e01:0x143,_0x3b031d:0x4a4}
;
this._inflate();
this.emit("update:member");
this.emit("update");
}
.onDeviceChanged(){
_0x52e26d={
_0x177cab:0x1a0,_0x1ad2bd:0x1f2},_0x533270={
_0x531f25:0x87,_0x2aa383:0x17e}
;
this._inflate(),this.emit("update:device");
this.emit('update');
}
.onReset({memberKey:_0x264fb1,deviceKeys:_0x54b706,status:_0x50d343}){
_0x17368f={
_0x256b12:0xe,_0x5aa1c1:0x194,_0xfe9096:0x12f},_0x40bbbe={
_0x3f0169:0xc3}
;
this._unref(),this.status=_0x50d343,this.memberKey=_0x264fb1,this.deviceKeys=_0x54b706,this._memberId=Members.cacheId(this.memberKey),this._deviceIds=_0x54b706.map(_0x242a01=>Devices.cacheId(_0x242a01)),this._ref(),this._inflate();
this.emit("reset");
}
.onWant(_0x27b0eb){
_0xe2ab9d={
_0xb9d514:0xcd}
;
this._clock=_0x27b0eb;
}
.onHave(_0x1dc4d4){
_0x2dafec={
_0x57327c:0x3b2,_0x4a1353:0xff},_0x17872e={
_0x1f1d98:0x58,_0x503337:0x12}
;
if(_0x1dc4d4!==this._clock)return;
this.emit("have",_0x1dc4d4);
this.emit("update");
}
.onCancel(_0x2aee38){
_0x489e97={
_0x5f1a40:0x2d,_0x65bd78:0xbb},_0x353984={
_0x54cc5d:0x164,_0x21166b:0x147}
;
if(_0x2aee38!==this._clock)return;
this._clock=-0x396a;
}
}
class Room{
constructor(_0x2e63c7,_0x34d544,_0x308b2a){
_0x114b2e={
_0x2af000:0xd9,_0x4a1f4e:0x455,_0x23c0e3:0x1ba}
;
this.id=_0x2e63c7;
this.cacheId=_0x34d544,this.role=_0x308b2a.role,this.digest=_0x308b2a.digest,this.config=_0x308b2a.config,this.message=_0x308b2a.message,this.messageId=_0x308b2a.messageId;
this.messageCacheId=Messages.cacheId(this.messageId);
}
.with(_0x40a3a7){
_0x54b1ae={
_0x5b2c76:0x169,_0x151839:0x1eb}
;
return new Room(this.id,this.cacheId,{...this,..._0x40a3a7});
}
}
class RoomInfoView extends EventEmitter{
constructor(_0x539bbb){
super(),this.view=_0x539bbb;
}
.ref(_0x1233f2){
_0x1c27f8={
_0xe85854:0x1a,_0x464695:0x384},_0x2ffaed={
_0x563f46:0x6f,_0x5b01a4:0x63}
;
this.view.rooms.ref(_0x1233f2.cacheId);
_0x1233f2.messageCacheId&&this.view.messages.ref(_0x1233f2.messageCacheId);
}
.unref(_0x267b9a){
_0x89e6dd={
_0x33a31d:0x63,_0x11c76c:0x450},_0x4156c6={
_0x574c7e:0x135}
;
this.view.rooms.unref(_0x267b9a.cacheId);
_0x267b9a.messageCacheId&&this.view.messages.unref(_0x267b9a.messageCacheId);
}
.onRoleChanged({id:_0x59eccd,role:_0x4dd49e}){
_0x3c672c={
_0x4cd3b5:0x12c,_0x5a7d52:0x8},_0x242b82={
_0x43de91:0x4f,_0x36f6b7:0x2b1,_0x3a7cba:0x2a}
;
const _0x159ff1=this.view.rooms.get(_0x59eccd);
if(!_0x159ff1)return;
const _0x47ccaf=_0x159ff1.with({'role':_0x4dd49e});
this.view.rooms.add(_0x47ccaf,{'cacheId':_0x59eccd}),this.emit("update:role",_0x47ccaf);
}
.onDigestChanged({id:_0x110ba6,digest:_0x580066}){
_0x51cbcc={
_0x4c6978:0xbd,_0xf6f132:0x157,_0xbf5842:0xc9},_0x19408f=this.view.rooms.get(_0x110ba6);
if(!_0x19408f)return;
const _0x5583ba=_0x19408f.with({'digest':_0x580066});
this.view.rooms.add(_0x5583ba,{'cacheId':_0x110ba6});
this.emit("update:digest",_0x5583ba);
}
.onConfigChanged({id:_0x457ebf,config:_0x286bcb}){
_0x50252e={
_0x594176:0x4a,_0x46961c:0x471,_0x4336b0:0x1be},_0x401dc3={
_0x2c11ee:0xc5,_0x187912:0xee,_0x1fcbff:0xd2}
;
const _0x31e109=this.view.rooms.get(_0x457ebf);
if(!_0x31e109)return;
const _0x311558=_0x31e109.with({'config':_0x286bcb});
this.view.rooms.add(_0x311558,{'cacheId':_0x457ebf}),this.emit("update:config",_0x311558);
}
.onLastMessageChanged({id:_0x2c58e0,messageId:_0x1dcf14}){
_0x49877a={
_0x54989a:0xee},_0x97618f={
_0x3c7096:0x1d8,_0x190771:0x55},_0x596b8e=this.view.rooms.get(_0x2c58e0);
if(!_0x596b8e)return;
const _0x5b8a2d=Messages.cacheId(_0x1dcf14),_0x48456c=this.view.messages.get(_0x5b8a2d);
const _0x14ef64=_0x596b8e.with({'messageId':_0x1dcf14,'messageCacheId':_0x5b8a2d,'message':_0x48456c});
this.view.rooms.add(_0x14ef64,{'cacheId':_0x2c58e0}),this.emit("update:message",_0x14ef64);
}
.onAdd(_0x2d86dd,{cacheId:cacheId=null}={}){
_0x5d144a={
_0x153116:0x1dd,_0x20bcc:0xd9},_0x5044ce={
_0x45809d:0x187}
;
if(!cacheId)cacheId=b4a.toString(_0x2d86dd.id,"hex");
const _0x5a2e5e=Messages.cacheId(_0x2d86dd.messageId),_0x298471=this.view.messages.get(_0x5a2e5e),_0x44d0fc={
'role':_0x2d86dd.role,'digest':_0x2d86dd.digest,'config':_0x2d86dd.config,'messageId':_0x2d86dd.messageId,'messageCacheId':_0x5a2e5e,'message':this.view.messages.get(_0x5a2e5e)}
;
let _0x249e8c=this.view.rooms.get(cacheId);
!_0x249e8c?_0x249e8c=new Room(_0x2d86dd.id,cacheId,_0x44d0fc):_0x249e8c=_0x249e8c.with(_0x44d0fc);
this.view.rooms.add(_0x249e8c,{'cacheId':cacheId}),this.emit("update:reset",_0x249e8c);
return _0x249e8c;
}
}
class ChatMessage{
constructor(_0x23c4f4,_0x14d3dc,_0x452b8f){
_0x262b90={
_0x2340ee:0x126},_0x1c2de9={
_0x1a7491:0x18c,_0x3de49f:0xaa}
;
this.id=_0x23c4f4,this.cacheId=_0x14d3dc;
this.role=_0x452b8f.role,this.chat=_0x452b8f.chat,this.member=_0x452b8f.member;
this.reactions=_0x452b8f.reactions,this.memberKey=_0x452b8f.memberKey,this.memberId=_0x452b8f.memberId;
}
.with(_0x5764c4){
_0x4a38af={
_0x484405:0xde,_0x1874f8:0xb0}
;
return new ChatMessage(this.id,this.cacheId,{...this,..._0x5764c4});
}
}
class ChatMessageInfoView extends EventEmitter{
constructor(_0x2eca18){
_0x1d8b24={
_0x43e8c9:0x132,_0x1bc9a9:0xf8}
;
super();
this.view=_0x2eca18;
}
.ref(_0x4e0d67){
_0x17ce28={
_0x2f0d06:0x119,_0x1bba25:0x1fa,_0x37a2d7:0x110},_0xdd39b0={
_0x227492:0x90,_0x40bef0:0x237,_0x513a6e:0x19d}
;
this.view.messages.ref(_0x4e0d67.cacheId);
_0x4e0d67.memberId&&this.view.members.ref(_0x4e0d67.memberId);
}
.unref(_0x434acd){
_0xd106fe={
_0x365241:0xa4,_0x10559f:0xe6},_0x55e938={
_0x24751d:0x64,_0x319768:0x334,_0x170708:0xb8}
;
this.view.messages.unref(_0x434acd.cacheId);
_0x434acd.memberId&&this.view.members.unref(_0x434acd.memberId);
}
.onChatChanged({chat:_0x22ba0b}){
_0x1c246e={
_0x6af0eb:0x33c,_0x5d9a89:0x182},_0x534b46=Messages.cacheId(_0x22ba0b.id);
const _0x39c128=this.view.messages.get(_0x534b46);
if(!_0x39c128)return;
const _0x4b2e36=_0x39c128.with({'chat':_0x22ba0b});
this.view.messages.add(_0x4b2e36,{'cacheId':_0x534b46});
this.emit("update:chat",{'chat':_0x22ba0b,'messages':[_0x4b2e36]});
}
.onRoleChanged({ids:_0x4f46fe,role:_0x280cd8}){
_0x2b0d81={
_0x3ea51a:0x138},_0x4fa19c={
_0x8491d7:0xe0,_0x41e21f:0x494,_0x5de62e:0x18b},_0x559acb=[];
for(const _0x19279 of _0x4f46fe){
const _0xd7bd85=Messages.cacheId(_0x19279),_0x5a804f=this.view.messages.get(_0xd7bd85);
if(!_0x5a804f)continue;
const _0x243a5e=_0x5a804f.with({'role':_0x280cd8});
this.view.messages.add(_0x243a5e,{'cacheId':_0xd7bd85}),_0x559acb.push(_0x243a5e);
}
if(_0x559acb.length>0x0)this.emit("update:role",{'ids':_0x4f46fe,'role':_0x280cd8,'messages':_0x559acb});
}
.onMemberChanged({ids:_0x169632,memberKey:_0x7bd713}){
_0xd76abe={
_0x29846c:0x157,_0x1a15b1:0x12c},_0x101db6={
_0x57fd67:0x16e,_0x5314ee:0x322,_0x27266e:0x99},_0x24e0ee=this.view.members.get(Members.cacheId(_0x7bd713));
if(!_0x24e0ee)return;
const _0x42ba0c=[];
for(const _0x222f5e of _0x169632){
const _0x178f18=Messages.cacheId(_0x222f5e),_0x300d12=this.view.messages.get(_0x178f18);
if(!_0x300d12)continue;
const _0x2dca07=_0x300d12.with({'member':_0x24e0ee});
this.view.messages.add(_0x2dca07,{'cacheId':_0x178f18}),_0x42ba0c.push(_0x2dca07);
}
if(_0x42ba0c.length>-0x384c)this.emit("update:member",{'ids':_0x169632,'memberKey':_0x7bd713,'messages':_0x42ba0c});
}
.onReactionsChanged({id:_0x1da6ca,reactions:_0x227acc}){
_0xef19b6={
_0x30bd51:0x496,_0x53d979:0x88},_0x44419c={
_0x58c329:0x14d,_0x148880:0x35c,_0x279397:0x17b},_0xf2c4d0=Messages.cacheId(_0x1da6ca);
const _0x3a450e=this.view.messages.get(_0xf2c4d0);
if(!_0x3a450e)return;
const _0x4958e4=_0x3a450e.with({'reactions':_0x227acc});
this.view.messages.add(_0x4958e4,{'cacheId':_0xf2c4d0}),this.emit("update:reactions",{'id':_0x1da6ca,'reactions':_0x227acc,'messages':[_0x4958e4]});
}
.onAdd(_0x44bab1,{cacheId:cacheId=null}={}){
_0x493a43={
_0x50fa00:0x1dd,_0x452e0f:0x19f,_0x57c8b8:0x15},_0x4de5f3={
_0x309d1e:0x146,_0x338b8d:0x44c}
;
if(!cacheId)cacheId=Messages.cacheId(_0x44bab1.chat.id);
const _0x5e3121=Members.cacheId(_0x44bab1.memberKey);
const _0x1a6505=_0x44bab1.memberKey;
let _0xb954f5=this.view.messages.get(cacheId);
if(!_0xb954f5){
const _0x363f67={
'reactions':this.view.reactions.get(cacheId),'member':this.view.members.get(_0x5e3121),'chat':_0x44bab1.chat,'role':_0x44bab1.role,'memberKey':_0x1a6505,'memberId':_0x5e3121}
;
_0xb954f5=new ChatMessage(_0x44bab1.chat.id,cacheId,_0x363f67),this.view.messages.add(_0xb954f5,{'cacheId':cacheId});
}
this.emit("update:reset",_0xb954f5);
return _0xb954f5;
}
}
class PairingView extends EventEmitter{
constructor(_0x289ac9){
_0x2ebf3a={
_0x49b69a:0x9e,_0x57b35a:0x19b},_0x17a699={
_0x291370:0xc7,_0x18cbfe:0x1ab,_0x149e31:0x1cf}
;
super(),this.view=_0x289ac9,this.pendingInvitations=[],this.identityJoinRequests=[],this.clock=-0x46dc;
this._pending=!![],this._invitationIds=new Set(),this._joinRequestIds=new Set();
}
.onWant(_0x525ed4){
_0x5cbaf7={
_0x527b10:0x4d2,_0x1e5199:0x16b}
;
this.clock=_0x525ed4,this._pending=!![];
}
.onHave(_0x50379f){
_0x4357f1={
_0x1000b6:0x2a,_0x4eeb74:0x8c},_0x442ffd={
_0x38abe2:0x4b,_0x96e9f1:0x92}
;
if(_0x50379f!==this.clock)return;
this._pending=![],this.emit("have",_0x50379f),this.emit("update");
}
.onCancel(_0x1d39a8){
_0x5356b5={
_0x4ae3b9:0x1ba,_0x48f0fb:0xce},_0x15a434={
_0x39f209:0xc4,_0x4b8c07:0x9a}
;
if(_0x1d39a8!==this.clock)return;
this.clock=--0x2e82;
this._pending=!![];
}
.onReset({pendingInvitations:_0xb06be4,identityJoinRequests:_0x4c320e}){
_0x40a5d1={
_0x55f87e:0x2ee},_0x3f01d7={
_0x3a9a6e:0x196,_0x3f9d55:0x1c0},_0x4280d3=new Set(_0xb06be4.map(_0x213cd7=>b4a.toString(_0x213cd7.id,"hex")));
const _0xd9c06c=new Set(_0x4c320e.map(_0x25bb55=>b4a.toString(_0x25bb55.deviceKey,"hex"))),_0x1b832d=!setsEqual(this._invitationIds,_0x4280d3),_0x58cca7=!setsEqual(this._joinRequestIds,_0xd9c06c);
if(!_0x1b832d&&!_0x58cca7)return;
this.pendingInvitations=_0xb06be4,this.identityJoinRequests=_0x4c320e,this._invitationIds=_0x4280d3,this._joinRequestIds=_0xd9c06c,this.emit("reset");
if(!this._pending)this.emit("update");
}
}
class LobbyView extends EventEmitter{
constructor(_0x2dc540){
_0x31912f={
_0x19880e:0x2ce},_0x4d1817={
_0x108f3b:0x64,_0x34027d:0x5a}
;
super(),this.view=_0x2dc540;
this.rooms=null,this.keys=null,this.start=0x0,this.end=-0x17d2,this.total=--0x3380,this.clock=0x0,this._pending=!![],this._ids=null;
this._cacheIdSet=null;
}
._unref(){
_0x4ebe16={
_0xf11108:0xd8,_0xb05b17:0x7d},_0x44b3d7={
_0x3f5cf2:0x38,_0x17db2b:0xde,_0x3bdef0:0x133}
;
if(!this.rooms)return;
for(const _0x123279 of this.rooms){
if(_0x123279)this.view.roomInfo.unref(_0x123279);
}
}
._ref(){
_0x2a19c8={
_0x20621f:0xfb,_0x22eb25:0x23d,_0x598339:0x17a},_0x436dfa={
_0x524358:0x69,_0x490fc2:0x1b3}
;
if(!this._ids)return;
for(const _0xc29d4 of this._ids){
this.view.rooms.ref(_0xc29d4);
const _0x4de861=this.view.rooms.get(_0xc29d4);
_0x4de861?..messageCacheId&&this.view.messages.ref(_0x4de861.messageCacheId);
}
}
._refreshRooms(){
_0x41cdc8={
_0x5230f0:0x155,_0x3796aa:0x5e,_0x289f73:0x6d}
;
this.rooms=this._ids.map(_0x1787d9=>this.view.rooms.get(_0x1787d9));
}
.onRoomChanged(_0x15d8e8,_0x73e7b9){
_0x300196={
_0x27254a:0x73},_0x52081={
_0x19a838:0x9,_0x3c29d2:0x222}
;
if(!this._cacheIdSet||!this._cacheIdSet.has(_0x15d8e8.cacheId))return;
this._unref(),this._refreshRooms(),this._ref(),this.emit("update:"+_0x73e7b9,_0x15d8e8);
if(!this._pending)this.emit("update");
}
.onWant(_0x1f9545,_0x225208,_0x13e6d4){
_0x483d0d={
_0xc5d304:0x19,_0x15d547:0x5f,_0x5da140:0x1a4},_0x537e54={
_0x521f74:0x1a5,_0x290598:0x13}
;
this.clock=_0x1f9545;
this.start=_0x225208,this.end=_0x13e6d4;
this._pending=!![];
}
.onHave(_0x2e3c88){
_0x45471f={
_0x14b1ba:0x160,_0x4f60ea:0x58a,_0x480e1f:0x1d},_0x43f9ce={
_0x2c27ae:0x4d,_0x4b4aa1:0x212}
;
if(_0x2e3c88!==this.clock)return;
this._pending=![],this.emit("have",_0x2e3c88);
this.emit('update');
}
.onCancel(_0x1e1f58){
_0x21b296={
_0x5d6fec:0x48,_0x1e2420:0x1cc,_0x4ea725:0x99},_0x31c8d2={
_0x432cd0:0xd9,_0x2ab6f6:0x50,_0x1ec65d:0x86}
;
if(_0x1e1f58!==this.clock)return;
this.start=-0x9ce;
this.end=0x0,this._pending=!![],this._cacheIdSet=null;
}
.onReset({keys:_0x30c805,start:_0x813e97,end:_0x4f67be,total:_0x859cf6}){
_0x563e87={
_0x7b1c39:0x7a,_0x35c170:0x64a},_0x141b14={
_0x2720ce:0xfd,_0x1b3d9d:0x47a},_0x3e01d8=this._ids;
this.keys=_0x30c805;
this.start=_0x813e97,this.end=_0x4f67be,this.total=_0x859cf6,this._ids=_0x30c805.map(_0x3d3860=>b4a.toString(_0x3d3860,"hex")),this._cacheIdSet=new Set(this._ids),this._ref();
if(_0x3e01d8)for(const _0x49dbb1 of _0x3e01d8){
const _0x40ad46=this.view.rooms.get(_0x49dbb1);
if(_0x40ad46)this.view.roomInfo.unref(_0x40ad46);
}
this._refreshRooms();
this.emit("reset");
if(!this._pending)this.emit('update');
}
}
class ChatView extends EventEmitter{
constructor(_0x16d9be){
_0x430f43={
_0x4ed3a9:0x190,_0x2b4d07:0x246,_0x17b209:0xfc},_0x38a2a6={
_0x3431ef:0x33,_0x3c1d53:0x68,_0x4d70d4:0xbc}
;
super(),this.view=_0x16d9be,this.messages=null,this.ids=null,this.room=null,this.roomKey=null;
this.start=0x0,this.end=-0x1b30,this.total=0x0,this.isBottom=![],this.clock=-0x2d5c,this._pending=!![];
this._ids=null,this._cacheIdSet=null,this._roomCacheId=null;
}
._unref(){
_0x4b7e13={
_0x54de8:0x17a,_0x3d3b27:0x96,_0x5225b5:0x45},_0x8bc1b6={
_0x580241:0x1cc,_0x4bf45a:0x129,_0xf6dda0:0x136}
;
if(!this._cacheIds)return;
for(const _0x3d9673 of this._cacheIds){
const _0x116cb5=this.view.messages.get(_0x3d9673);
if(_0x116cb5)this.view.messageInfo.unref(_0x116cb5);
}
}
._ref(){
_0xaf5673={
_0x2f44f9:0x70,_0x23e240:0x36a},_0x365c58={
_0xf28fee:0xce,_0x3fae7:0x315}
;
if(!this._cacheIds)return;
for(const _0x14ff84 of this._cacheIds){
this.view.messages.ref(_0x14ff84);
const _0x1657c2=this.view.messages.get(_0x14ff84);
_0x1657c2?..memberId&&this.view.members.ref(_0x1657c2.memberId);
}
}
._refreshMessages(){
_0x3e83a7={
_0x57d518:0x18d,_0x2dd14a:0x61c,_0xd5f9f7:0x16d},_0x3a4674={
_0xa17819:0x1f2,_0xd3306:0x19a,_0x49bb2f:0x44}
;
this.messages=this._cacheIds.map(_0x74fbaa=>this.view.messages.get(_0x74fbaa));
}
._refreshRoom(){
_0x4964b0={
_0x2feed8:0x1a5,_0x23c802:0x14b},_0xb78e14={
_0x2fdcc7:0x12e,_0x2d620f:0x1be}
;
this.room=this._roomCacheId?this.view.rooms.get(this._roomCacheId):null;
}
.onRoomChanged(_0x3602c7,_0x24a9c8){
_0x1160fe={
_0x37c193:0x5ea,_0x517990:0xba},_0x586328={
_0x15016b:0x1c1,_0xe5397a:0x4e8,_0x12246f:0x7e}
;
if(!this._roomCacheId||this._roomCacheId!==_0x3602c7.cacheId)return;
this._refreshRoom();
this.emit("update:room:"+_0x24a9c8,this.room),this.emit("update:room",this.room);
!this._pending&&this.emit("update");
}
.onMessagesChanged(_0x294d00,_0x23c510){
_0xb15a2f={
_0x14b611:0x1a2,_0x164f79:0x341,_0x2dc611:0x158},_0x2805bb={
_0x407333:0x150},_0x34d6c9=_0x294d00.filter(_0x5bc49b=>this._cacheIdSet?..has(_0x5bc49b.cacheId));
if(_0x34d6c9.length===-0x27e6)return;
this._unref(),this._refreshMessages();
this._ref(),this.emit("update:"+_0x23c510,_0x34d6c9),!this._pending&&this.emit("update");
}
.onWant(_0x1d4672,_0xdc8897,_0x5458e4,_0x13adc8,_0x25bd9d){
_0x51b7fc={
_0x29bd2c:0x5b,_0x4fc8e4:0xfd},_0x1bc9d9={
_0xb3aad1:0x8f,_0x1885e3:0x95}
;
this.clock=_0x1d4672,this.roomKey=_0xdc8897,this._roomCacheId=Rooms.cacheId(_0xdc8897),this.start=_0x5458e4,this.size=_0x13adc8;
this.isBottom=_0x25bd9d,this._pending=!![];
}
.onHave(_0x567b7c){
_0x441858={
_0x418960:0x10d,_0x190a02:0x343,_0x55a479:0x190},_0x3858da={
_0xdd9cd7:0xe6,_0x339471:0xd5,_0x2ae4d9:0x1b1}
;
if(_0x567b7c!==this.clock)return;
this._pending=![];
this.emit("have",_0x567b7c),this.emit("update");
}
.onCancel(_0x51aea2){
_0x2193ad={
_0x411f24:0x76,_0x1a9936:0x68},_0x225c88={
_0x12a327:0x1b7,_0x240956:0x10a,_0x490baf:0x20}
;
if(_0x51aea2!==this.clock)return;
this.room=null;
this.roomKey=null,this.start=--0xc34,this.end=0x0,this._pending=!![],this._roomCacheId=null,this._cacheIdSet=null;
}
.onReset({ids:_0x2222b7,roomKey:_0x1b17a8,start:_0x2e9f42,size:_0x5b42e3,total:_0x1565af,isBottom:_0x39355f}){
_0x113754={
_0x10e5eb:0x119,_0x3ea441:0xb,_0x1d8d6d:0xe7},_0x4cac5a={
_0x36737d:0x32},_0x3790c8=this._cacheIds;
this.ids=_0x2222b7,this.roomKey=_0x1b17a8,this.start=_0x2e9f42,this.size=_0x5b42e3,this.total=_0x1565af,this.isBottom=_0x39355f;
this._roomCacheId=Rooms.cacheId(_0x1b17a8),this._cacheIds=_0x2222b7.map(_0xe2c2da=>Messages.cacheId(_0xe2c2da)),this._cacheIdSet=new Set(this._cacheIds);
this._ref();
if(_0x3790c8)for(const _0x31148a of _0x3790c8){
const _0x32caf9=this.view.messages.get(_0x31148a);
if(_0x32caf9)this.view.messageInfo.unref(_0x32caf9);
}
this._refreshMessages(),this._refreshRoom(),this.emit('reset'),!this._pending&&this.emit("update");
}
}
module.exports=class KeetView{
constructor(){
_0x1512dc={
_0x55efe9:0x49c,_0x2996f4:0x4be,_0x3303f2:0x4c7,_0x258d37:0x6c,_0x3d8a4e:0x13,_0x52d2ca:0x0,_0x502504:0x45},_0x3de477={
_0x2ae8d6:0x497,_0x5d04bd:0x1c6},_0x2e43e7={
_0x32536b:0x17c,_0x1ee2bb:0x173,_0x40d3aa:0x144,_0x4cc10b:0x105,_0xd9c061:0xa6,_0xaea254:0xdd,_0x28855a:0xfb,_0x562b25:0x104,_0x34dc2e:0xd4,_0xf7935d:0xb1,_0x5cefe0:0x127,_0x11cfbf:0x100,_0x18cae2:0xfd,_0x2b2f8c:0xe9,_0xfd235:0x14d,_0x5f0986:0x131,_0x5ecd71:0x176,_0x2e62df:0x135,_0x58d575:0xa7,_0x1ac86d:0x10d,_0x420008:0x178,_0x2a28ca:0x13b,_0xc25899:0x13a,_0x8354ee:0x83,_0x280a30:0x67},_0x605d13={
_0x1f254e:0x1bb,_0x14fe6d:0x159,_0x2d01bf:0x11e},_0x38d2d0={
_0x3e1c70:0x152,_0x73678b:0x138,_0x1d4c2f:0x179,_0x387d5d:0x122,_0x3302b5:0x12e,_0x4cabf1:0x150,_0x254848:0xf8,_0x4a2433:0x5df,_0x450547:0x5ad,_0x1ebf1f:0x625,_0x14aa72:0x5e5,_0x1930be:0xe7,_0x4edcad:0x129,_0x5f0a47:0x162,_0x46d2c3:0xc7,_0x5962f2:0xd1,_0x5bf435:0xdd,_0x72305b:0x5b1,_0x3c3580:0x5b6,_0x46b7f9:0x589,_0x103345:0x624,_0x3ffc74:0x5f8,_0x33d0f1:0x5b5},_0x41d27c={
_0x30975f:0x5c8,_0x3615b2:0x142,_0x11534c:0x103},_0x2ca55e={
_0x4077b1:0x43e,_0x24e3aa:0x4a1,_0x5dd716:0x4c0,_0x4e48a1:0x4a5,_0x1cefd6:0x41a,_0x29aab6:0x443,_0x5921fb:0x442,_0xceb348:0x488,_0x45cac3:0x47e,_0x3f777a:0x441,_0x1418fb:0x46e,_0x10ee42:0x42d,_0x3efb01:0x448,_0x29b3d7:0x44d,_0x5b1c62:0x4b0,_0x182db7:0x4a5,_0x258e57:0x11,_0x2f197a:0x58},_0x790ded={
_0x369f34:0x52d,_0xd73140:0x501,_0x171913:0x9d,_0x5c722c:0x2d,_0x562535:0x12,_0x351463:0x52},_0x16ef4d={
_0x563044:0xb0,_0x1219d9:0x1be},_0x199013={
_0x267b7d:0x182},_0x832984={
_0x34f9bb:0x130,_0x188b2e:0x104,_0x169091:0x95}
;
this.members=new Members(),this.devices=new Devices(),this.reactions=new Reactions();
this.messages=new Messages();
this.rooms=new Rooms(),this.identity=new IdentityView(this),this.pairing=new PairingView(this),this.lobby=new LobbyView(this),this.chat=new ChatView(this),this.roomInfo=new RoomInfoView(this),this.messageInfo=new ChatMessageInfoView(this),this.roomInfo.on("update:reset",_0x23e4ab=>{this.chat.onRoomChanged(_0x23e4ab,"reset");}),this.roomInfo.on("update:role",_0x56bcfe=>{_0x31f090={_0x5967ff:0x163,_0x4be106:0x63,_0xfaa454:0x20};this.lobby.onRoomChanged(_0x56bcfe,"role"),this.chat.onRoomChanged(_0x56bcfe,'role');}),this.roomInfo.on("update:digest",_0x37cc56=>{this.lobby.onRoomChanged(_0x37cc56,"digest"),this.chat.onRoomChanged(_0x37cc56,"digest");}),this.roomInfo.on("update:config",_0x5b43d4=>{this.lobby.onRoomChanged(_0x5b43d4,"config"),this.chat.onRoomChanged(_0x5b43d4,"config");}),this.roomInfo.on("update:message",_0x5b788c=>{this.lobby.onRoomChanged(_0x5b788c,"message");}),this.messageInfo.on("update:chat",({messages:_0x540ba1})=>this.chat.onMessagesChanged(_0x540ba1,"chat")),this.messageInfo.on("update:role",({messages:_0x1faa37})=>this.chat.onMessagesChanged(_0x1faa37,"role")),this.messageInfo.on("update:member",({messages:_0x2ac538})=>this.chat.onMessagesChanged(_0x2ac538,"member")),this.messageInfo.on("update:reactions",({messages:_0x3236c8})=>this.chat.onMessagesChanged(_0x3236c8,'reactions'));
}
}
;
function setsEqual(_0x4da361,_0x2300c8){
_0x2eab96={
_0x5e57ad:0x37,_0x1e5c2b:0x2eb,_0x4ed328:0x16c},_0xf0cf8={
_0xd511a2:0xb0,_0x413f7b:0xee,_0x10aea3:0x7e}
;
if(_0x4da361.size!==_0x2300c8.size)return![];
for(const _0x4b476b of _0x4da361){
if(!_0x2300c8.has(_0x4b476b))return![];
}
return!![];
}