OverviewFilesCommitsIssuesDocsReleasesPeers

keet-cli / deobfuscated / api / v1 / index.js

2738 lines · javascript ref:
const _0xa09659=(function(){let _0x79a936=!![];return function(_0x1b3589,_0x44aa28){const _0x1f0e08=_0x79a936?function(){if(_0x44aa28){const _0xa99681=_0x44aa28.apply(_0x1b3589,arguments);return _0x44aa28=null,_0xa99681;}}:function(){};return _0x79a936=![],_0x1f0e08;};}()),_0x43f94c=_0xa09659(this,function(){_0x157cf0={_0x144e44:0x1e8};return _0x43f94c.toString().search("(((.+)+)+)+$").toString().constructor(_0x43f94c).search("(((.+)+)+)+$");});
_0x43f94c();
const p=require('path'),ReadyResource=require('ready-resource'),HypercoreId=require('hypercore-id-encoding'),crypto=require('hypercore-crypto'),debounce=require('debounceify'),safetyCatch=require('safety-catch'),b4a=require('b4a'),uncaughts=require('uncaughts'),{
  Readable,Transform,pipeline}
=require('streamx'),{
  Session,HeapSnapshot}
=require('bare-inspector'),fs=require('bare-fs'),top=require('process-top')(),TinyPreferences=require('tiny-preferences');
const KeetCallServer=require('@holepunchto/keet-call/server'),{
  contract:{
    hyperschema:{
      getEnum:getContractEnum}
  },local:{
  hyperschema:{
    getEnum:getLocalEnum}
}
}
=require('../../spec'),{
  encodeRoomRecord,encodeConfig,encodeDevice,encodeMemberRecord,encodeInvitationRecord,encodeFile,encodeIdentityPairingRequest,encodeDmRequest,encodeReaction,encodeUser,encodeContactInfo,encodeImageFile,encodeReservation,encodeFileEntry,encodeUserSettings,encodeErrorRecord,encodeNotification,encodeHyperDHTSettings}
=require('./encode.js');
const {
  decodeChatRangeOptions,decodeChatMessage,decodeMessageId,decodeKeyRangeOptions,decodeFile,decodeConfig,decodeImageFile,decodeFileRangeOptions,decodeUserSettings}
=require('./decode.js'),RoomType=getContractEnum("@keet/room-type"),DisplayType=getContractEnum("@keet/display-type"),Label=getContractEnum("@keet/label-type"),MemberLabel=getContractEnum("@keet/member-label-type"),{
  ContactRequestStatus,RoomStatus}
=require('../../lib/contract/identity/private.js'),{
  Config,CONFIG_INDEX_TO_KEY}
=require('../../lib/contract/config'),{
  Settings}
=require('../../lib/contract/internal'),{
  getChatMessages,getChatMessage,getReactions,isDMRead}
=require('./helpers.js'),{
  MemberStatus}
=require('../../lib/contract/members/index.js'),{
  MemberRoles,DM_STATUSES,isValidPreferenceKey,getPreferenceKeyName,CHAT_MESSAGE_REPORT_COUNT,PREFERENCES,GENERIC_EVENTS}
=require('@holepunchto/keet-core-api'),{
  restoreAvatar}
=require('../../lib/contract/avatars.js'),{
  getMemberForDeviceKey}
=require('../../lib/contract/query.js'),c=require('compact-encoding'),{
  DEBUG_FLAG_INDEX_BY_KEY,DHT_SETTINGS}
=require('../../debugging.js'),KeetInspector=require('./inspector.js'),KeetState=getLocalEnum("@local/keet-state"),V1_PREFERENCES_FILE_NAME="preferences_v1.json",DEFAULT_SUB_ID="keet",RECENTS_ROOMS_SUB_ID="recent-rooms",DM_ROOMS_SUB_ID='dm-rooms',CHAT_CHANGED_SUB_ID="chat-changed",IDENTITY_SUB_ID="identity",PROFILE_SUB_ID="private-profile",IDENTITY_PAIRING_REQUEST_SUB_ID="identity-pairing-requests",MIGRATION_STATUS_SUB_ID="migration-status",ROOM_PREFERENCES_SUB_ID="room-preferences",UNREADS_SUB_ID="unreads",ERRORS_SUB_ID="errors",FORCE_UPDATES_SUB_ID="force-updates",CORE_MODULE_VERSIONS={
  'keet-core':require('../../package.json').version,'autobase':require('autobase/package.json').version,'hypercore':require('hypercore/package.json').version,'hyperbee':require('hyperbee/package.json').version,'keet-identity-key':require('keet-identity-key/package.json').version,'keet-push':require('@holepunchto/keet-push/package.json').version,'corestore':require('corestore/package.json').version}
;
class Subscriptions{
  constructor(_0x4439fb,_0x15bc10){
    _0x42cbf1={
      _0x1efc95:0x36,_0x3a106d:0x11,_0x147e0a:0x16e},_0x45f4d1={
      _0x186f4c:0x149,_0x5a444:0x115,_0x4b8419:0x164}
    ;
    this.api=_0x4439fb;
    this.id=_0x15bc10,this.subscriptions=[];
  }
.destroy(){
  _0x46ec7b={
    _0x1a1581:0x1e8,_0xd5a307:0x34c,_0x1dcd0d:0x6b}
  ;
  for(const {stream:_0x30e5b0}of this.subscriptions){
    _0x30e5b0.destroy();
  }
}
.refresh(_0x53af5c){
  _0x2157a4={
    _0x213dfa:0x5c},_0x322d5c={
    _0x83b7d8:0x12b,_0x3c22ef:0x52b}
  ;
  for(const _0x35c269 of this.subscriptions){
    if(_0x53af5c&&_0x53af5c.name&&_0x53af5c.name!==_0x35c269.name)continue;
    if(_0x35c269.query)_0x35c269.query();
  }
}
.push(_0x11eb3a,_0xf0d197){
  _0x333a51={
    _0x3b113d:0xc5,_0x35ec68:0x6e,_0x1a94f6:0x1c1},_0x44e5f1={
    _0x189f53:0x1be,_0x235514:0x286}
  ;
  for(const _0x39158c of this.subscriptions){
    if(_0xf0d197&&_0xf0d197.name&&_0xf0d197.name!==_0x39158c.name)continue;
    if(_0x39158c.map)_0x39158c.stream.push(_0x39158c.map(_0x11eb3a));
  }
}
._onDestroy(_0x3b6f71,_0x2ea795){
  _0x2efb52={
    _0x3962f4:0x1d7,_0x1545bb:0x23,_0x3d778e:0x220},_0x3805d5={
    _0x39cac:0x1e6,_0x26d24e:0x232},_0x2d2797=this.subscriptions.pop();
  _0x2d2797!==_0x3b6f71&&(this.subscriptions[_0x3b6f71.idx]=_0x2d2797,_0x2d2797.idx=_0x3b6f71.idx);
  if(this.subscriptions.length===--0x2a2c){
    const _0x26801c=this.api._subscriptions.get(this.id);
    if(_0x26801c===this)this.api._subscriptions.delete(this.id);
  }
_0x2ea795(null);
}
._create(_0x2e90d9){
  _0x37094d={
    _0x3afe56:0x1ed,_0xcb6d4b:0x57,_0x27b8d8:0x56b},_0x23239c={
    _0xce6ae2:0x5e,_0x223a48:0x1ac,_0x283f36:0x111},_0x137c3a={
    'name':_0x2e90d9||null,'stream':null,'query':null,'map':null,'idx':0x0}
  ;
  _0x137c3a.stream=new Readable({'destroy':_0x1155d3=>this._onDestroy(_0x137c3a,_0x1155d3)}),_0x137c3a.idx=this.subscriptions.push(_0x137c3a)-(-0x23fd);
  return _0x137c3a;
}
.add({query:_0x4c8988,map:_0x487f28,name:_0x5f378f}){
  _0x37d5ae={
    _0x2e4a3b:0x150,_0x4b55c3:0x165,_0x3e6ed1:0x4f9},_0x271a17={
    _0x4c969b:0x44d,_0x2b1e8d:0x624,_0x1b2491:0x4f3,_0x5a65f7:0x5bb,_0x4a58c5:0x689,_0x3f596d:0x684,_0x2fff96:0x5b8,_0x1cd6d7:0x44d,_0x3af2a3:0x59a,_0x40cc56:0x33f},_0x4f526e={
    _0x2bcf54:0x8},_0x2ac6c7={
    _0x522a15:0xcf,_0x3decad:0x1a2}
  ;
  if(!_0x4c8988&&!_0x487f28)throw new Error("Must\x20have\x20either a query or a map");
  const _0x5108e4=this._create(_0x5f378f);
  _0x4c8988&&(_0x5108e4.query=debounce(async()=>{try{const _0x28565f=await _0x4c8988();if(_0x28565f!==null)_0x5108e4.stream.push(_0x28565f);}catch(_0x50f980){_0x5108e4.stream.destroy(_0x50f980);}}),_0x5108e4.query());
  _0x5108e4.map=_0x487f28;
  return _0x5108e4.stream;
}
}
class ContextManager{
  constructor(_0x16fa33){
    _0x453e7d={
      _0x37a5b2:0x155,_0x1fd2f9:0x511}
    ;
    this.keet=_0x16fa33;
  }
.create(_0x402eec,_0x21d052){
  _0x29b22c={
    _0x42cdbc:0x63}
  ;
  return async(_0x185129,..._0x170785)=>{
    if(this.keet.closing)return null;
    const _0x50cbf5=["files","base","drive",'db','snapshot',"blobs","blobsSnapshot"],_0x491997=!!_0x21d052.find(_0x4e624c=>_0x50cbf5.includes(_0x4e624c));
    if(_0x491997&&!_0x185129)throw new Error("Room ID is required for methods that require room resources");
    (typeof _0x185129==="object"&&_0x185129!==null||!_0x491997)&&(_0x170785=[_0x185129,..._0x170785],_0x185129=null);
    const _0x2cbf88=_0x185129?this.keet.internalOpenExistingRoom(_0x185129):null;
    _0x2cbf88&&(await _0x2cbf88.ready(),await _0x2cbf88.base.flush());
    if(this.keet.closing)return null;
    const _0x3c526b={
      'roomId':_0x185129,'roomKey':_0x2cbf88?..key||null,'discoveryKey':_0x2cbf88?..discoveryKey||null}
    ;
    let _0x3194be=null;
    try{
      for(const _0x3a92d5 of _0x21d052){
        if(_0x2cbf88&&_0x3a92d5==='db')_0x3c526b.db=_0x2cbf88.db;
        if(_0x2cbf88&&_0x3a92d5==='snapshot')_0x3c526b.snapshot=_0x2cbf88.db.snapshot();
        if(_0x2cbf88&&_0x3a92d5==="base")_0x3c526b.base=_0x2cbf88.base;
        if(_0x2cbf88&&_0x3a92d5==="drive")_0x3c526b.drive=_0x2cbf88.drive;
        if(_0x2cbf88&&_0x3a92d5==='blobs')_0x3c526b.blobs=_0x2cbf88.blobs;
        if(_0x2cbf88&&_0x3a92d5==="blobsSnapshot")_0x3c526b.blobsSnapshot=_0x2cbf88.blobs.snapshot();
        if(_0x3a92d5==="local")_0x3c526b.local=this.keet.local;
        if(_0x3a92d5==="localSnapshot")_0x3c526b.localSnapshot=this.keet.local.snapshot();
        if(_0x3a92d5==="files")_0x3c526b.files=this.keet.files;
        if(_0x3a92d5==="myKey"){
          if(!_0x3c526b.localSnapshot)_0x3c526b.localSnapshot=this.keet.local.snapshot();
          _0x3c526b.id=await _0x3c526b.localSnapshot.get("@local/identity"),_0x3c526b.profileInfo=await _0x3c526b.localSnapshot.get("@local/rooms",{'roomKey':_0x3c526b.id.privateProfileKey}),_0x3c526b.myKey=_0x3c526b.profileInfo?..selfMember?..key||null;
        }
      if(_0x3a92d5==="profile"){
        if(!_0x3c526b.localSnapshot)_0x3c526b.localSnapshot=this.keet.local.snapshot();
        if(!_0x3c526b.id)_0x3c526b.id=await _0x3c526b.localSnapshot.get("@local/identity");
        !_0x3c526b.profileInfo&&(_0x3c526b.profileInfo=await _0x3c526b.localSnapshot.get("@local/rooms",{'roomKey':_0x3c526b.id.privateProfileKey})),_0x3c526b.profile=this.keet.internalOpenExistingRoom(_0x3c526b.id.privateProfileKey),await _0x3c526b.profile.ready();
      }
    if(_0x3c526b.profile&&_0x3a92d5==="profileDb")_0x3c526b.profileDb=_0x3c526b.profile.db;
    _0x3c526b.profile&&_0x3a92d5==="profileSnapshot"&&(_0x3c526b.profileSnapshot=_0x3c526b.profile.db.snapshot()),_0x3c526b.profile&&_0x3a92d5==="profileBlobs"&&(_0x3c526b.profileBlobs=_0x3c526b.profile.profileBlobs),_0x3c526b.profile&&_0x3a92d5==="profileBlobsSnapshot"&&(_0x3c526b.profileBlobsSnapshot=_0x3c526b.profile.blobs.snapshot());
  }
const _0x1dd93c=Date.now();
return _0x3194be=await _0x402eec(_0x3c526b,..._0x170785),this.keet.internalProductionLog("[Keet API]",_0x402eec.name,"duration:",Date.now()-_0x1dd93c,"args:",_0x170785),_0x3194be;
}catch(_0x4bcf93){
if(this.keet.closing)return null;
if(_0x2cbf88?..base.getLastError()){
  this.keet.onerror(_0x2cbf88?..base.getLastError());
  throw _0x2cbf88.base.getLastError();
}
this.keet.onerror(_0x4bcf93);
throw _0x4bcf93;
}finally{
if(_0x3c526b.snapshot)await _0x3c526b.snapshot.close();
if(_0x3c526b.blobsSnapshot)await _0x3c526b.blobsSnapshot.close();
if(_0x3c526b.localSnapshot)await _0x3c526b.localSnapshot.close();
if(_0x3c526b.profileSnapshot)await _0x3c526b.profileSnapshot.close();
if(_0x3c526b.profileBlobsSnapshot)await _0x3c526b.profileBlobsSnapshot.close();
if(_0x3c526b.profile)await this.keet.internalReleaseRoom(_0x3c526b.profile);
if(_0x2cbf88)await this.keet.internalReleaseRoom(_0x2cbf88);
}
}
;
}
}
class V1KeetCoreAPI{
  constructor(_0x2fcd12,{onerror:onerror=safetyCatch}={}){
    _0x3ba8c3={
      _0x30ce1f:0x180,_0x3d8479:0x6b,_0x92fdab:0x246},_0x4ba97e={
      _0x1fceef:0x120,_0x5ad19e:0x8b}
    ;
    this.keet=_0x2fcd12,this.context=new ContextManager(this.keet),this._onerror=onerror,this._subscriptions=new Map(),this._profileSubscriptions=new Subscriptions(this,null,{'isProfileSub':!![]}),this.keet.on("room-interrupted",this._handleRoomInterrupted.bind(this)),this.keet.on("room-changed",this._handleRoomChanged.bind(this)),this.keet.on("identity-changed",this._handleIdentityChanged.bind(this)),this.keet.on("recent-rooms-changed",this._handleRecentRoomsChanged.bind(this)),this.keet.on("dm-rooms-changed",this._handleDmRoomsChanged.bind(this)),this.keet.on("chat-changed",this._handleChatChanged.bind(this)),this.keet.on("identity-pairing-request",this._handleIdentityPairingRequest.bind(this)),this.keet.on("migration-status",this._handleMigrationStatus.bind(this)),this.keet.on("room-preferences-changed",this._handleRoomPreferencesChanged.bind(this)),this.keet.on("unread-anchors-changed",this._handleUnreadAnchorsChanged.bind(this)),this.keet.on("room-sent-message",this._handleRoomSentMessageLengthChanged.bind(this)),this.keet.on("caught-error",this._handleKeetError.bind(this)),this.keet.on("force-update",this._handleForceUpdate.bind(this)),this.keet.on("local-files-changed",this._handleLocalFilesChanged.bind(this)),this.boot=this._timed(this._boot.bind(this)),this.createInvitation=this._timed(this._createInvitation.bind(this)),this.confirmPairingRequest=this._timed(this._confirmPairingRequest.bind(this)),this.startPairingRoom=this._timed(this._startPairingRoom.bind(this)),this.stopPairingRoom=this.context.create(this._stopPairingRoom.bind(this),.profile),this.searchRooms=this.context.create(this._searchRooms.bind(this),.local),this.getRoomInfo=this.context.create(this._getRoomInfo.bind(this),.localSnapshot),this.getRecentRooms=this.context.create(this._getRecentRooms.bind(this),.local),this.getPendingRooms=this.context.create(this._getPendingRooms.bind(this),.profile),this.getLocalRoomMetadata=this.context.create(this._getLocalRoomMetadata.bind(this),.local),this.getConfig=this.context.create(this._getConfig.bind(this),["snapshot","local"]),this.updateRoomSettings=this._updateRoomSettings.bind(this),this.getChatMessage=this.context.create(this._getChatMessage.bind(this),['snapshot',"blobsSnapshot","files",'local']),this.getChatMessageById=this.context.create(this._getChatMessageById.bind(this),["snapshot","blobsSnapshot","files","local"]),this.getChatMessages=this.context.create(this._getChatMessages.bind(this),["snapshot","blobsSnapshot","files","local"]),this.getChatLength=this.context.create(this._getChatLength.bind(this),.db),this.removeChatMessage=this.context.create(this._removeChatMessage.bind(this),['snapshot',"blobsSnapshot","files","local"]),this.searchChatMessages=this.context.create(this._searchChatMessages.bind(this),['local',"snapshot","blobsSnapshot",'files']),this.addChatMessage=this._timed(this._addChatMessage.bind(this)),this.updateChatMessage=this._timed(this._updateChatMessage.bind(this)),this.forwardChatMessage=this.context.create(this._forwardChatMessage.bind(this),['snapshot',"blobsSnapshot","files","local"]),this.pinChatMessage=this._timed(this._pinChatMessage.bind(this)),this.unpinChatMessage=this._timed(this._unpinChatMessage.bind(this)),this.addCallStartedEvent=this._timed(this._addCallStartedEvent.bind(this)),this.addCallHangupEvent=this._timed(this._addCallHangupEvent.bind(this)),this.addCallMissedEvent=this._timed(this._addCallMissedEvent.bind(this)),this.addLocationSharedEvent=this._timed(this._addLocationSharedEvent.bind(this)),this.getReactions=this.context.create(this._getReactions.bind(this),['snapshot',"local"]);
    this.getLatestReactions=this.context.create(this._getLatestReactions.bind(this),.snapshot),this.addReaction=this._timed(this._addReaction.bind(this)),this.removeReaction=this._timed(this._removeReaction.bind(this)),this.getReportedMembers=this.context.create(this._getReportedMembers.bind(this),["snapshot","blobsSnapshot"]),this.addChatReport=this._timed(this._addChatReport.bind(this)),this.removeChatReport=this._timed(this._removeChatReport.bind(this)),this.getReportedMessages=this.context.create(this._getReportedMessages.bind(this),["roomKey","local","snapshot","blobsSnapshot",'files']),this.getPinnedChatMessages=this.context.create(this._getPinnedChatMessages.bind(this),['local',"snapshot","blobsSnapshot","files"]),this.getActiveMember=this.context.create(this._getActiveMember.bind(this),["snapshot","blobsSnapshot",'myKey']),this.getActiveMembers=this.context.create(this._getActiveMembers.bind(this),["snapshot","blobsSnapshot","myKey"]),this.getMembers=this.context.create(this._getMembers.bind(this),["snapshot","blobsSnapshot","myKey"]),this.getMember=this.context.create(this._getMember.bind(this),['snapshot',"blobsSnapshot",'myKey']),this.getMemberCount=this.context.create(this._getMemberCount.bind(this),.db),this.getMemberBySwarmId=this.context.create(this._getMemberBySwarmId.bind(this),["snapshot","blobsSnapshot","myKey"]),this.getMemberByDeviceId=this.context.create(this._getMemberByDeviceId.bind(this),["snapshot","blobsSnapshot","myKey"]),this.waitUntilJoined=this.context.create(this._waitUntilJoined.bind(this),.local),this.isMemberMuted=this.context.create(this._isMemberMuted.bind(this),.db),this.getSearchMembers=this.context.create(this._getSearchMembers.bind(this),['db',"blobsSnapshot","myKey"]),this.updateMember=this._timed(this._updateMember.bind(this)),this.removeMember=this._timed(this._removeMember.bind(this)),this.changeMemberRole=this._timed(this._changeMemberRole.bind(this)),this.muteMember=this._timed(this._muteMember.bind(this)),this.unmuteMember=this._timed(this._unmuteMember.bind(this)),this.blockMember=this._timed(this._blockMember.bind(this)),this.unblockMember=this._timed(this._unblockMember.bind(this)),this.getDevices=this.context.create(this._getDevices.bind(this),.db),this.getDevice=this.context.create(this._getDevice.bind(this),.db),this.getDevicesByMemberId=this.context.create(this._getDevicesByMemberId.bind(this),.db),this.getModerators=this.context.create(this._getModerators.bind(this),['snapshot',"blobsSnapshot","myKey"]),this.saveFile=this.context.create(this._saveFile.bind(this),.files),this.saveFileBlob=this.context.create(this._saveFileBlob.bind(this),.files),this.getFileEntry=this.context.create(this._getFileEntry.bind(this),.files),this.getFileCleared=this.context.create(this._getFileCleared.bind(this),.files),this.clearFile=this.context.create(this._clearFile.bind(this),.files),this.unclearFile=this.context.create(this._unclearFile.bind(this),.files),this.clearAllFiles=this.context.create(this._clearAllFiles.bind(this),.files),this.getLocalFiles=this.context.create(this._getLocalFiles.bind(this),["files",'snapshot',"blobsSnapshot"]),this.getFiles=this.context.create(this._getFiles.bind(this),["files",'snapshot',"blobsSnapshot"]),this.startDownload=this.context.create(this._startDownload.bind(this),.files),this.cancelDownload=this.context.create(this._cancelDownload.bind(this),.files),this.sendFile=this._timed(this._sendFile.bind(this)),this.sendFiles=this._timed(this._sendFiles.bind(this)),this.refreshFileLinks=this._timed(this._refreshFileLinks.bind(this)),this.createRoom=this._timed(this._createRoom.bind(this)),this.leaveRoom=this._timed(this._leaveRoom.bind(this)),this.getSystemDigest=this.context.create(this._getSystemDigest.bind(this),.db),this.getTipSize=this.context.create(this._getTipSize.bind(this),.base),this.getRoomKeys=this._timed(this._getRoomKeys.bind(this)),this.resyncPrivateProfile=this._timed(this._resyncPrivateProfile.bind(this)),this.restoreIdentity=this._timed(this._restoreIdentity.bind(this)),this.getRecoveryPhrase=this._timed(this._getRecoveryPhrase.bind(this)),this.confirmRecoveryPhrase=this._timed(this._confirmRecoveryPhrase.bind(this)),this.storeRecoveryPhrase=this._timed(this._storeRecoveryPhrase.bind(this)),this.getIdentity=this.context.create(this._getIdentity.bind(this),["local","profile","profileSnapshot"]),this.getSelfContactInfo=this.context.create(this._getSelfContactInfo.bind(this),["local","profile"]),this.removeIdentityDevice=this.context.create(this._removeIdentityDevice.bind(this),.profile),this.createIdentityInvitation=this._timed(this._createIdentityInvitation.bind(this)),this.startPairingIdentity=this._timed(this._startPairingIdentity.bind(this)),this.updateIdentityProfile=this._timed(this._updateIdentityProfile.bind(this)),this.updateIdentityDevice=this._timed(this._updateIdentityDevice.bind(this)),this.getIdentityPairingRequest=this._timed(this._getIdentityPairingRequest.bind(this)),this.updateUserSettings=this._timed(this._updateUserSettings.bind(this)),this.updateDHTSettings=this._timed(this._updateDHTSettings.bind(this)),this.getDHTSettings=this._timed(this._getDHTSettings.bind(this)),this.getContactInfo=this.context.create(this._getContactInfo.bind(this),['local',"profile"]);
    this.getBlockedMembers=this.context.create(this._getBlockedMembers.bind(this),.local),this.getDmRequestsByStatus=this.context.create(this._getDmRequestsByStatus.bind(this),["profile",'profileDb',"profileBlobsSnapshot"]),this.sendDMFromContact=this._timed(this._sendDMFromContact.bind(this)),this.sendDMRequest=this._timed(this._sendDMRequest.bind(this)),this.sendInvitations=this._timed(this._sendInvitations.bind(this)),this.updatePrivateMailboxRecord=this._timed(this._updatePrivateMailboxRecord.bind(this)),this.acceptDmRequest=this._timed(this._acceptDmRequest.bind(this)),this.rejectDmRequest=this._timed(this._rejectDmRequest.bind(this)),this.getRoomPreferences=this.context.create(this._getRoomPreferences.bind(this),.local),this.updateRoomPreferences=this.context.create(this._updateRoomPreferences.bind(this),.profile),this.getBlockedMembers=this.context.create(this._getBlockedMembers.bind(this),.local),this.updateConfig=this._timed(this._updateConfig.bind(this)),this.disableMembershipEvents=this._timed(this._disableMembershipEvents.bind(this)),this.enableMembershipEvents=this._timed(this._enableMembershipEvents.bind(this)),this.getLinkInfo=this._timed(this._getLinkInfo.bind(this)),this.lookupUsername=this._timed(this._lookupUsername.bind(this)),this.lookupUserByMemberId=this._timed(this._lookupUserByMemberId.bind(this)),this.registerUsername=this._timed(this._registerUsername.bind(this)),this.updateUsername=this._timed(this._updateUsername.bind(this)),this.searchUsername=this._timed(this._searchUsername.bind(this)),this.getReservationsByKey=this._timed(this._getReservationsByKey.bind(this)),this.checkUsername=this._timed(this._checkUsername.bind(this)),this.repair=this._timed(this._repair.bind(this)),this.rotateWriter=this._timed(this._rotateWriter.bind(this)),this.audit=this._timed(this._audit.bind(this)),this.setUnread=this._setUnread.bind(this),this.getUnread=this._getUnread.bind(this),this.setUnreadAnchor=this._setUnreadAnchor.bind(this),this.getUnreadAnchor=this._getUnreadAnchor.bind(this),this.subscribeUnreadAnchor=this._subscribeUnreadAnchor.bind(this),this.setRoomFavorite=this._setRoomFavorite.bind(this);
  }
._timed(_0x36b2d4){
  _0x1446fa={
    _0x1e01cd:0x200},_0x4b5bd8={
    _0x3e6486:0x34f}
  ;
  return async function(..._0x120f35){
    const _0x4e0a83=Date.now();
    try{
      const _0x3694d2=await _0x36b2d4(..._0x120f35);
      return this.keet.internalProductionLog("[Keet API]",_0x36b2d4.name,"duration:",Date.now()-_0x4e0a83,'args:',_0x120f35),_0x3694d2;
    }catch(_0x45d420){
    this.keet.onerror(_0x45d420);
    throw _0x45d420;
  }
}
;
}
._boot(){
  return this.keet.backendReady();
}
._disableMembershipEvents(_0x3b3e1d){
  _0x5084c8={
    _0x52f032:0x1df,_0x4dce2a:0x5c3},_0x277e2b={
    _0x27aba5:0x1e3,_0x392343:0x505}
  ;
  return this.keet.dispatch(_0x3b3e1d,"@keet/update-system-settings",{'key':Settings.IsMembershipEventsDisabled,'settings':{'isMembershipEventsDisabled':!![]}});
}
._enableMembershipEvents(_0x5001a0){
  _0x2ee37d={
    _0x13945f:0x1e5,_0x35f243:0x2c6,_0x52d3aa:0xc4},_0x51d9dc={
    _0x442080:0x11c}
  ;
  return this.keet.dispatch(_0x5001a0,"@keet/update-system-settings",{'key':Settings.IsMembershipEventsDisabled,'settings':{'isMembershipEventsDisabled':![]}});
}
._addKeetSubscription(_0xe0603c=DEFAULT_SUB_ID,_0x225972){
  return this._addRoomSubscription(_0xe0603c,_0x225972);
}
._addRoomSubscription(_0x2dd678,_0x3fa2ab,{isProfileSub:isProfileSub=![],_isRoomSub:_isRoomSub=!![]}={}){
  _0x67e1b5={
    _0x331c2b:0xb0,_0x19ba2c:0x69,_0x560039:0x2da},_0x3879a3={
    _0x4495d9:0x18d}
  ;
  if(_0x2dd678===null&&isProfileSub)return this._profileSubscriptions.add(_0x3fa2ab);
  let _0x183514=this._subscriptions.get(_0x2dd678);
  return!_0x183514&&(_0x183514=new Subscriptions(this,_0x2dd678),this._subscriptions.set(_0x2dd678,_0x183514)),_0x183514.add(_0x3fa2ab);
}
._refreshSubscriptionsById(_0x46a665){
  _0x4cba2e={
    _0x275337:0xe8,_0x5e919d:0x14d,_0x3e3499:0x142},_0x493e37={
    _0xd9688:0x474},_0x527b7a=_0x46a665===this.keet.privateProfile?..id?this._subscriptions.get(PROFILE_SUB_ID):this._subscriptions.get(_0x46a665);
  if(!_0x527b7a)return;
  _0x527b7a.refresh();
}
._handleIdentityPairingRequest(_0x35b6ab){
  _0x5060cb={
    _0x22685a:0xe5,_0x394829:0x4cd},_0x2bd2ac={
    _0x416f43:0x1bf,_0x38aa9e:0x1cc,_0x59e428:0x163}
  ;
  this._identityPairingRequestsByDeviceId.set(HypercoreId.encode(_0x35b6ab.deviceKey),_0x35b6ab),this._refreshSubscriptionsById(IDENTITY_PAIRING_REQUEST_SUB_ID);
}
._handleRoomInterrupted(_0xfece9c,{unsupportedABI:_0x1eae26,digest:_0x146c57}){
  _0x48ef28={
    _0x48fd16:0xff,_0x8f90e3:0x508,_0x24ce79:0xf6},_0x595cdc={
    _0x50deae:0xdc,_0x659dcb:0x73,_0x3571ee:0x199}
  ;
  const _0x16dcd6=this._subscriptions.get(_0xfece9c);
  if(!_0x16dcd6)return;
  for(const _0x587884 of _0x16dcd6.subscriptions){
    if(_0x587884.name!=="room-version")continue;
    _0x587884.stream.push({'version':_0x1eae26,'experimental':_0x146c57&&_0x146c57.settings.isExperimental});
  }
}
._handleRoomChanged(_0x599c6d){
  _0x4a1440={
    _0x20652f:0x17e,_0x47568d:0x1ef},_0x396957={
    _0x5cce93:0x13e,_0x5710ff:0x1a7,_0x1746e5:0x1c3}
  ;
  this._refreshSubscriptionsById(_0x599c6d);
}
._handleRecentRoomsChanged(..._0x5b6f26){
  _0x4e88b5={
    _0x4f0ff6:0x1d,_0x37da38:0x77,_0x1b13bd:0xe8},_0x584a63={
    _0x2a3140:0x12d,_0x3e581c:0x74},_0x546518=this._subscriptions.get(RECENTS_ROOMS_SUB_ID);
  if(!_0x546518)return;
  _0x546518.push(_0x5b6f26);
}
._handleDmRoomsChanged(){
  _0x3d9f8d={
    _0x42bef5:0x2d,_0x32f673:0x105},_0x4f2e33={
    _0x388af4:0x111,_0x5f0f2f:0xef,_0xbd2d03:0x12c}
  ;
  const _0x1ea76d=this._subscriptions.get(DM_ROOMS_SUB_ID);
  if(!_0x1ea76d)return;
  _0x1ea76d.refresh();
}
._handleRoomPreferencesChanged(..._0x39e54f){
  _0x5712a6={
    _0x57e6ae:0x144,_0x239be9:0x16d},_0x288890={
    _0x281f16:0x1c0,_0x54ea21:0x79}
  ;
  const _0x22abc9=this._subscriptions.get(ROOM_PREFERENCES_SUB_ID);
  if(!_0x22abc9)return;
  _0x22abc9.push(_0x39e54f);
}
._handleUnreadAnchorsChanged(){
  _0x475e17={
    _0x2c829a:0x55,_0x6e4f6:0x1dc,_0xedf93e:0x62f},_0x491a64=this._subscriptions.get(UNREADS_SUB_ID);
  if(!_0x491a64)return;
  _0x491a64.refresh();
}
._handleRoomSentMessageLengthChanged(_0x186bd3){
  _0x574ca1={
    _0x590da0:0xff,_0x262795:0x1d6,_0x32b0c2:0x13a},_0x21fe20={
    _0x234cb3:0x141,_0x17ccca:0x3fc,_0x350bed:0x191},_0x1c6cca=this._subscriptions.get(_0x186bd3);
  if(!_0x1c6cca)return;
  _0x1c6cca.refresh({'name':"room-info"});
}
._handleIdentityChanged(){
  _0x23dab2={
    _0x5dbc6e:0xe6},_0x185ede={
    _0x38de13:0x4a0}
  ;
  this._refreshSubscriptionsById(IDENTITY_SUB_ID);
}
._handleChatChanged(..._0x23b400){
  _0x28e60d={
    _0x3ac906:0x1e8,_0x21e002:0x585},_0x401ac5={
    _0x189ac2:0x125,_0x4e975e:0xc9,_0x275bf6:0x3f},_0x33d875=this._subscriptions.get(CHAT_CHANGED_SUB_ID);
  if(!_0x33d875)return;
  const [_0x47c931,_0x3b3f2f]=_0x23b400;
  if(_0x47c931===this.keet.privateProfile.id)return;
  _0x33d875.push({'roomId':_0x47c931,'index':_0x3b3f2f});
}
._handleMigrationStatus(_0x48c027){
  _0x35d195={
    _0x9814ec:0x1bc,_0x19494b:0x125,_0x107ed3:0x2b1},_0x98d0a8={
    _0x247592:0x4,_0x26a8d3:0x9d}
  ;
  const _0x585534=this._subscriptions.get(MIGRATION_STATUS_SUB_ID);
  if(!_0x585534)return;
  _0x585534.push(_0x48c027);
}
._handleKeetError(_0x44da87){
  _0x927d60={
    _0xa15df2:0x1ea,_0x4426b8:0x444},_0x2fb485={
    _0xecc232:0x105,_0x332cee:0x23d,_0x1dfc0a:0x73}
  ;
  const _0x1d1aed=this._subscriptions.get(ERRORS_SUB_ID);
  if(!_0x1d1aed)return;
  _0x1d1aed.push(_0x44da87);
}
._handleForceUpdate(){
  _0x6563c8={
    _0x3942e3:0x1a1,_0x388cad:0x1b0,_0x31b21b:0x5b1},_0x362e94={
    _0x50d871:0x104,_0x5a5632:0xa3}
  ;
  const _0x3a289a=this._subscriptions.get(FORCE_UPDATES_SUB_ID);
  if(!_0x3a289a)return;
  _0x3a289a.refresh();
}
._handleLocalFilesChanged(_0x1d6860){
  _0x55b19f={
    _0x3948e3:0x1ac,_0x37b77e:0xe1},_0x273fbc={
    _0x5e01d3:0x18a},_0x82417d=this._subscriptions.get(_0x1d6860);
  if(!_0x82417d)return;
  _0x82417d.refresh({'name':"room-info"});
}
.createFirewall(_0x564e60){
  _0x498f39={
    _0x44a218:0x130,_0x5e75bd:0x3ed,_0x335d9c:0xc1},_0x5b107f={
    _0x471251:0x22,_0x5ba09c:0x14a}
  ;
  return this.keet.createFirewall(_0x564e60);
}
.getVersion(){
  _0x3f4d18={
    _0x53eca1:0x7a,_0x1ecd5d:0x73},_0x147059={
    _0x4a78b9:0x16}
  ;
  return{
    'experimental':this.keet.isExperimental,'version':this.keet.isExperimental?this.keet.abi.max:this.keet.abi.production,'modules':CORE_MODULE_VERSIONS}
  ;
}
async._getSystemDigest({db:_0x53a445}){
  _0x562954={
    _0x39823d:0x2fb,_0x464c05:0x17e},_0x3a4039={
    _0xd4a997:0x14,_0x59544c:0x1f7,_0x30b4a6:0x55}
  ;
  return await _0x53a445.get("@keet/system-digest");
}
.subscribeSentLength(_0x5c9134){
  _0x52182f={
    _0x33ca28:0xb7,_0x4f5c72:0x91,_0x22e830:0x1ee},_0x1fe885={
    _0x57d326:0x2ee,_0xb2803c:0x368,_0x3cc226:0x44a,_0x3f3e3c:0xa8,_0x27ddfd:0x1cd,_0x36d48b:0x94,_0x8a6204:0x3e8,_0x44d8ce:0x4f1,_0x36159d:0x396,_0x581aa:0x32a,_0x23d549:0x662,_0x14e793:0x4f7,_0x37aabd:0x47a,_0x1abc77:0x3f0,_0x54584f:0x3e6,_0x105b6b:0x45b,_0x51d8bc:0x36f,_0x29de5b:0x37f,_0x7fb94f:0x35e,_0x29b0b3:0x2bf,_0x5ce025:0x3ad,_0x3a84c3:0x661,_0x3ab1ee:0x552,_0x21e598:0x73b,_0x174b59:0x437,_0x101e3a:0x2d3,_0x416bda:0x26a,_0x8e9c0e:0x214,_0x29a33a:0x1db,_0x3ee979:0x241,_0xd499dc:0x5f8,_0x147161:0x51f,_0x521b4c:0x4ce,_0x24cddc:0x2de,_0x29231d:0x177,_0x2a5b41:0x2a1},_0x518cbb=async()=>{
    _0x30a271=this.keet.internalOpenExistingRoom(_0x5c9134);
    await _0x30a271.ready();
    const _0x529e82={
      'deviceId':_0x30a271.base.local.id,'length':_0x30a271.base.local.remoteContiguousLength}
    ;
    return this.keet.internalReleaseRoom(_0x30a271),_0x529e82;
  }
;
return this._addRoomSubscription(_0x5c9134,{'query':_0x518cbb,'name':"room-sent-message"});
}
.subscribeRoomVersion(_0x5eb3ab){
  _0x2b4447={
    _0x122537:0x37,_0x4f3180:0x1b0},_0x52a523={
    _0x31061f:0xba,_0x4f46b7:0x129,_0x12a611:0xf5},_0x2961a6={
    _0x20357d:0x55d,_0x147916:0x46a,_0x4a454a:0x608,_0x544ab6:0x27,_0x13f186:0x182,_0x36bc97:0x1ba,_0x13ceec:0x84,_0x5ce49a:0x8e,_0x482e62:0x355,_0x3fa70b:0x236,_0x20a1d3:0x25b,_0x464388:0x343,_0x2c418f:0xc2,_0x4598e5:0x163,_0x35d4b3:0xac},_0x46c5c8=async()=>{
    const _0x52a54a=await this.getSystemDigest(_0x5eb3ab);
    return{
      'version':_0x52a54a.abi.version,'experimental':_0x52a54a.settings.isExperimental}
    ;
  }
;
return this._addRoomSubscription(_0x5eb3ab,{'query':_0x46c5c8,'name':"room-version"});
}
.subscribeForceUpdates(){
  _0x23890a={
    _0x3432bb:0x5df,_0x1cf501:0x69a,_0x5b5f15:0x5c0,_0x4bf635:0x5e0,_0x3b9a19:0x684,_0x2e148d:0x6dd,_0x5a7c61:0x6e0,_0x3372c9:0x5aa},_0x1b0690={
    _0x20ba6c:0x31f},_0x377a7c={
    _0x1c553a:0x1bf,_0xfaee83:0x2b8,_0x202a5b:0x103}
  ;
  const _0x1119f3=()=>{
    return{
      'showBanner':this.keet.shouldForceUpdate()}
    ;
  }
;
return this._addKeetSubscription(FORCE_UPDATES_SUB_ID,{'query':_0x1119f3});
}
async.upgradeRoom(_0x4c9de7){
  _0x19cbf2={
    _0x22e9f6:0xd7,_0x1f2cb5:0x181,_0x5844e0:0x81},_0x238833={
    _0x2a785e:0x1d,_0x20ec53:0x132}
  ;
  if(!this.keet.opened)await this.keet.ready();
  await this.keet.internalDispatchUpgrade(_0x4c9de7,this.keet.abi.production);
}
async._getLinkInfo(_0x3d1ddc){
  _0x270e39={
    _0x15cd85:0x20,_0x48e073:0xb3,_0x27a442:0x33c},_0x1b4e38={
    _0x140e0d:0x103,_0x508fb2:0x1e,_0x208917:0x1cb},_0x4dd2b5=this.keet.internalGetLinkInfo(_0x3d1ddc);
  if(!_0x4dd2b5)return null;
  if(_0x4dd2b5.identity)return{
    'isIdentityInvitation':!![],'memberId':HypercoreId.encode(_0x4dd2b5.identity.identityPublicKey),'invitationSeed':HypercoreId.encode(_0x4dd2b5.identity.invitationSeed),'additionalNodes':_0x4dd2b5.additionalNodes}
  ;
  if(_0x4dd2b5.room){
    const _0x1a7f74={
      'capabilities':{
        'mailboxKeyPair':{
          'publicKey':_0x4dd2b5.room.mailbox}
      }
  },_0xe4d350=await this.keet.local.get("@local/rooms-by-mailbox",_0x1a7f74);
return{
  'isRoomInvitation':!![],'roomId':_0xe4d350?HypercoreId.encode(_0xe4d350.roomKey):null,'title':_0xe4d350?_0xe4d350.config.title:null,'description':_0xe4d350?_0xe4d350.config.description:null,'avatar':_0xe4d350?encodeImageFile(_0xe4d350.config.avatar):null,'invitationSeed':HypercoreId.encode(_0x4dd2b5.room.invitationSeed),'additionalNodes':_0x4dd2b5.additionalNodes}
;
}
if(_0x4dd2b5.profile)return{
  'isContactInfo':!![],'memberId':HypercoreId.encode(_0x4dd2b5.attestation.memberKey),'displayName':_0x4dd2b5.profile.displayName,'username':_0x4dd2b5.profile.username,'additionalNodes':_0x4dd2b5.additionalNodes}
;
if(_0x4dd2b5.readonly)return{
  'isReadOnly':!![],'additionalNodes':_0x4dd2b5.additionalNodes}
;
}
async._getSelfContactInfo({id:_0x4979a5,profileInfo:_0xa1b70}){
  _0x55a989={
    _0x5b71ca:0x14f,_0x56e727:0xa2,_0x471d3c:0x374},_0x4c1b14={
    _0x42a910:0x119,_0xb52645:0x185},_0x13cbd2=this.keet.internalCreateContactInfoStruct(_0x4979a5,_0xa1b70,{'avatar':null,'timestamp':0x0});
  return b4a.toString(_0x13cbd2,"base64");
}
async._getIdentity({id:_0x30c759,profile:_0x4e403c,profileSnapshot:_0x45a69a,profileInfo:_0xf1975b}){
  _0x21b6de={
    _0x59e337:0x1cf,_0x77c9e7:0x48},_0x5c5c6a={
    _0x46c233:0x17,_0xb7f6ec:0x15a,_0x40e412:0x275},[_0x311d4c,_0xd6846b]=await Promise.all([_0x45a69a.find("@keet/devices").toArray(),_0x45a69a.get("@keet-private-id/settings")]),_0x59112d=[];
  for(const _0xd7ef67 of _0x311d4c){
    if(!_0xd7ef67.status.isActive)continue;
    _0x59112d.push({...encodeDevice(_0xd7ef67),'confirmed':!![]});
  }
const _0x19e0c4=encodeMemberRecord(_0xf1975b.selfMember,_0xf1975b.selfMember.key);
_0x19e0c4.hasDiscoveryKey=!!_0xf1975b.identity.discoveryCoreKey;
return _0x19e0c4.anonymous=![],_0x19e0c4.confirmed=_0x30c759.status.isConfirmed,_0x19e0c4.devices=_0x59112d,_0x19e0c4.profileId=_0x4e403c.id,_0x19e0c4.profileDiscoveryId=_0x4e403c.discoveryId,_0x19e0c4.local={
  'deviceId':HypercoreId.encode(_0x4e403c.deviceKey)},_0x19e0c4.settings=encodeUserSettings(_0xd6846b),_0x19e0c4.isLoggedOut=_0xf1975b.selfDevice&&!_0xf1975b.selfDevice.status.isActive,_0x19e0c4;
}
._removeIdentityDevice({profile:_0x1345ad},_0x50c1f4){
  _0x24d1c2={
    _0x91e9a:0x64},_0x53a615={
    _0x963aaf:0x19f,_0x170f9c:0x26,_0xa677bf:0x2b6}
  ;
  return _0x1345ad.dispatch("@keet/remove-device",{'key':HypercoreId.decode(_0x50c1f4)});
}
.subscribeIdentity(){
  _0x4c157f={
    _0x43a68c:0x1b5,_0x382ada:0xe9,_0x533d29:0x30},_0x24e89f={
    _0x38e9d6:0x148,_0x246e43:0x5eb}
  ;
  return this._addKeetSubscription(IDENTITY_SUB_ID,{'query':()=>this.getIdentity()});
}
async._restoreIdentity(_0x19057e,_0x25aa43={}){
  _0x55c838={
    _0x437081:0x5d,_0x50bbbb:0x108,_0x56f856:0x427},_0x31aa8d={
    _0x275d1c:0x2d,_0x206f6d:0x194,_0x375f94:0xa6}
  ;
  await this.keet.restoreIdentity(_0x19057e,_0x25aa43);
}
._getRecoveryPhrase(){
  _0x819b96={
    _0x403ba7:0x14c,_0x315fb9:0x19a},_0x146767={
    _0x2f9c7d:0xbc,_0x59c756:0x10e,_0x10eb2d:0x3d6}
  ;
  return this.keet.getRecoveryPhrase();
}
._confirmRecoveryPhrase(_0xf4e8f){
  _0x507c14={
    _0x1534f2:0x19b,_0x4c72c6:0x13,_0x48ced4:0x56},_0x438034={
    _0x15799b:0x14a,_0x4bdd19:0x18e}
  ;
  return this.keet.confirmRecoveryPhrase(_0xf4e8f);
}
._storeRecoveryPhrase(_0x286177){
  _0x20ce13={
    _0x3f7c6f:0xbc,_0x14f67f:0x1c3,_0x51ff9c:0x1c1},_0x36ee88={
    _0x2b0093:0xce,_0x81911c:0xdd,_0xbc320f:0x14}
  ;
  return this.keet.storeRecoveryPhrase(_0x286177);
}
.confirmIdentity(..._0x464ed0){
  _0x13651d={
    _0xf6647d:0x1c,_0x17a5a9:0x1db,_0x29178e:0x471},_0x53dbbd={
    _0x12aceb:0x2a,_0x156a59:0x28,_0x2fb078:0x5ba}
  ;
  console.log("confirmIdentity",..._0x464ed0);
  throw new Error("Missing required method:\x20"+("confirmIdentity"));
}
._confirmPairingRequest({deviceId:_0x3efa9c},_0x373dad=!![]){
  _0xd5880a={
    _0x3d455f:0x1bd,_0x30769a:0x499,_0x2473e2:0x15c},_0xf9865f={
    _0x51c56f:0xed,_0x1e85d5:0x3ea},_0x5030a7=this.keet.privateProfile.key;
  const _0xafc168=HypercoreId.decode(_0x3efa9c);
  if(!_0x373dad)return this.keet.rejectJoinRequest(_0x5030a7,_0xafc168);
  return this.keet.acceptJoinRequest(_0x5030a7,_0xafc168);
}
async._getIdentityPairingRequest(){
  _0x4e8f0e={
    _0x133884:0x9,_0x1e2b59:0x65},_0x4d2977={
    _0x3156bd:0x0,_0x1e22e2:0x182,_0x991653:0x106},_0x4f958d=await this.keet.internalOpenPrivateProfile(),_0x51216b=await _0x4f958d.db.find("@keet/join-requests").toArray();
  this.keet.internalReleaseRoom(_0x4f958d);
  if(_0x51216b.length===-0x299c)return null;
  return encodeIdentityPairingRequest(_0x51216b[0x0]);
}
.subscribeIdentityPairingRequests(..._0x1fcd8d){
  _0x40e234={
    _0x2937db:0x2f,_0x569597:0x22a},_0x832984={
    _0x4077a4:0x88,_0x4d6c56:0x4cc,_0xd81083:0x101}
  ;
  return this._addKeetSubscription(IDENTITY_SUB_ID,{'query':()=>this.getIdentityPairingRequest()});
}
async._updateIdentityProfile({displayName:_0x4a2164,avatar:_0x1d84bd}){
  _0x851263={
    _0x3a3b34:0x55}
  ;
  await this.updateMember(_0x4a2164,_0x1d84bd);
}
._updateIdentityDevice(_0x13f2cf){
  _0xd3b38c={
    _0xe05423:0xba,_0x20c26a:0x565},_0x4ef351={
    _0xfdac13:0x83,_0x3a7f2b:0xb,_0x16cde3:0x450}
  ;
  return this.keet.updateDevice(_0x13f2cf);
}
._startPairingIdentity(_0x1c34bc){
  _0x1f72cc={
    _0x3e1cf5:0x1d0,_0x374b12:0xf4,_0x57fd36:0x644},_0x1e2965={
    _0x4be95e:0x8c,_0x5adb60:0x168,_0x3ca861:0x563}
  ;
  return this.keet.startPairingIdentity(_0x1c34bc);
}
.pairIdentity(..._0x12e26a){
  _0x5ab1ea={
    _0x875644:0x180,_0x47bb3d:0x1bd},_0x360dc4={
    _0x355d16:0x98,_0x188669:0x7a,_0x221a7b:0x165}
  ;
  console.log("pairIdentity",..._0x12e26a);
  throw new Error("Missing required method: "+("pairIdentity"));
}
async._updateUserSettings(_0x4c8009,_0x9bf8a9){
  _0x1d1cf8={
    _0x19023c:0x6,_0x30881f:0xa,_0x2c772d:0x7b},_0x5dc148={
    _0x5db45c:0x1c3,_0x2f2d5d:0x94,_0x233a5a:0x178}
  ;
  const _0x17fd21={
    [_0x4c8009]:_0x9bf8a9}
  ;
  return this.keet.privateProfile.dispatch("@keet-private-id/update-settings",{'key':_0x4c8009,'settings':decodeUserSettings(_0x17fd21)});
}
async._getDHTSettings(){
  _0x275635={
    _0x1ebf1b:0x1b9,_0x1d6749:0x1a1,_0xe7c3cd:0x116},_0x3d47a3={
    _0x2cedcb:0x9d}
  ;
  const _0x50bfb8=await this.keet.getDHTSettings();
  return encodeHyperDHTSettings(_0x50bfb8);
}
async._updateDHTSettings(_0x100f63,_0x34eef0){
  _0x55573d={
    _0x4cbbb4:0x99,_0x56a9f5:0x20f,_0x4027ef:0xf9},_0x504255={
    _0x1f698b:0xef,_0x1b9e63:0x50f,_0x6928ea:0xcd}
  ;
  if(!(_0x100f63 in DHT_SETTINGS))return;
  const _0x1c7ee1=await this.keet.internalEnterLocalTransaction();
  try{
    const _0x1ede83=await this.keet.getDHTSettings();
    _0x1ede83[_0x100f63]=_0x34eef0,await _0x1c7ee1.insert("@local/hyperdht",_0x1ede83),await _0x1c7ee1.flush();
  }finally{
  await this.keet.internalExitLocalTransaction();
}
}
async._createRoom(_0x50dde8={}){
  _0x56b8af={
    _0xf2e3c4:0x7c,_0x23f2de:0xa2},_0x170f52={
    _0x3854b7:0x1ce,_0x464ed4:0x590},_0x13232e=await this.keet.createRoom(formatRoomCreationOptions(_0x50dde8));
  return HypercoreId.encode(_0x13232e);
}
._pairRoom(..._0x4a8968){
  _0x541408={
    _0x184d0d:0x1c8,_0x1e204b:0x1f},_0x134d01={
    _0x5dd50e:0x18e,_0x5786c7:0x1ac}
  ;
  console.log("pairRoom",..._0x4a8968);
  throw new Error("Missing required\x20method: pairRoom");
}
._leaveRoom(_0x409b28,_0x1e0129={}){
  _0x4fbdef={
    _0x4aa7ff:0x151,_0x51ef95:0x484}
  ;
  return this.keet.leaveRoom(HypercoreId.decode(_0x409b28));
}
async._startPairingRoom(_0x26d9cf,_0xbe3692={}){
  _0x10d143={
    _0x4804fe:0x145,_0xb45742:0x353},_0x374b25={
    _0x5d1832:0x75,_0x4fb93d:0x185}
  ;
  return await this.keet.startPairingRoom(_0x26d9cf,_0xbe3692);
}
async._stopPairingRoom({profile:_0xc3545d},_0x4ac336){
  _0x45fcdf={
    _0x346e50:0x1f4,_0x1f8ba5:0x9e},_0x1c2f2c={
    _0x178a4a:0xb7,_0x3fa045:0x2ce,_0xf36dba:0x48},_0x56776c=HypercoreId.decode(_0x4ac336);
  const _0xf753c9=await _0xc3545d.db.find("@keet-private-id/pending-invitations").toArray();
  for(const _0x3e38fa of _0xf753c9){
    if(!b4a.equals(_0x3e38fa.invitationSeed,_0x56776c))continue;
    await this.keet.stopPairing(_0x3e38fa.id);
    break;
  }
}
.subscribePendingRooms(){
  return this._addKeetSubscription(IDENTITY_SUB_ID,{'query':()=>this.getPendingRooms()});
}
.subscribePushNotificationChanges(){
  _0x46da49=function(_0x1fc11e){
    const [_0x339d86,_0x2edfe5,_0x1b38ac]=_0x1fc11e,_0x430d73=_0x1b38ac||crypto.discoveryKey(_0x2edfe5);
    return{
      'type':_0x339d86,'roomId':HypercoreId.encode(_0x2edfe5),'discoveryId':HypercoreId.encode(_0x430d73)}
    ;
  }
;
return this._addKeetSubscription(ROOM_PREFERENCES_SUB_ID,{'map':_0x46da49});
}
.subscribeActivateRoom(_0x99fe34){
  _0x144276={
    _0x5f06ef:0x103,_0x451cfd:0x116,_0x3f1aab:0x2d,_0x2ad530:0x51,_0x1e8efd:0x309,_0x429ebf:0x13a,_0x290e5f:0x40,_0x472a0e:0x33b,_0x1d1bd5:0x396,_0x3acb86:0x18c,_0x58092a:0x598},_0x309b1e={
    _0x4df3f1:0x1f4,_0x3af16b:0x237,_0x4da9b1:0x1a0},_0x295ac5={
    _0x4b9e22:0x1cb,_0xa049ef:0x1d9},_0x486bd1={
    _0x386ff5:0x3f0,_0x44182f:0x281,_0x37370b:0x589},_0x51ab71={
    _0x564822:0xbc,_0x38c319:0x5c,_0x3d4c24:0x4c},_0x5a953c={
    _0x3666f0:0x5e,_0x3150b4:0x8b,_0x14ce29:0x123},_0x55ca1e=HypercoreId.decode(_0x99fe34);
  return new Readable({'eagerOpen':!![],'open':async _0x50f006=>{let _0x13ec49=null;try{await this.keet.activateRoom(_0x55ca1e);}catch(_0x33dd09){_0x13ec49=_0x33dd09;}_0x50f006(_0x13ec49);},'destroy':async _0x5d3769=>{let _0x59badd=null;try{await this.keet.deactivateRoom(_0x55ca1e);}catch(_0x4b613a){_0x59badd=_0x4b613a;}_0x5d3769(_0x59badd);}});
}
._getRoomKeys(_0x590b0d){
  _0x26305e={
    _0x514e9b:0x261},_0x6f2075={
    _0x5311c7:0x13}
  ;
  try{
    const _0x352f3c=HypercoreId.decode(_0x590b0d),_0x42bf0f=b4a.toString(crypto.discoveryKey(_0x352f3c),"hex");
    return{
      'discoveryKey':_0x42bf0f}
    ;
  }catch{
  return{
    'discoveryKey':''}
  ;
}
}
._getTipSize({base:_0xd5a943}){
  _0x2c02fa={
    _0x2533f0:0x131},_0x17e656={
    _0x55633e:0x9f}
  ;
  return _0xd5a943.linearizer.size;
}
async._resyncPrivateProfile(){
  _0x5fe451={
    _0x1b9e5f:0x101,_0x5d85d7:0x1bf},_0x4b553e={
    _0x142a3f:0xbc,_0x1a4af5:0x1a3,_0x2eb1a0:0xa9}
  ;
  const _0x1f6aeb=[];
  for await(const _0x2b17a2 of this.keet.privateProfile.db.find("@keet-private-id/rooms")){
    const _0x92b229=await this.keet.local.get("@local/rooms",{'roomKey':_0x2b17a2.roomKey});
    if(_0x92b229)continue;
    _0x1f6aeb.push(_0x2b17a2);
  }
for(const _0x1a6982 of _0x1f6aeb){
  const _0x59cad3=this.keet.tasks.joinRoomKeys(_0x1a6982.roomKey,{'keys':_0x1a6982});
  _0x59cad3.runBackground();
}
}
.bookmark(..._0x3a1ab5){
  _0x5e4b46={
    _0x1f92e7:0x1c5},_0x490807={
    _0x31476d:0x39,_0xa6a33b:0xbe}
  ;
  console.log("bookmark",..._0x3a1ab5);
  throw new Error("Missing required method:\x20bookmark");
}
.unbookmark(..._0x1aabbe){
  _0x4c054e={
    _0x423e1d:0xf7,_0x2a6de8:0xcd},_0x22ab58={
    _0x1f28eb:0x1b,_0x3f50bb:0x1c5,_0xa7f26b:0x45}
  ;
  console.log("unbookmark",..._0x1aabbe);
  throw new Error("Missing required method: unbookmark");
}
.subscribeBookmarks(..._0x7e4684){
  _0x3fe7e2={
    _0x16eb8b:0xbf,_0x1ed35c:0x1b4},_0x167fc2={
    _0x1e6500:0x92,_0x3c201b:0x75}
  ;
  return console.log("subscribeBookmarks",..._0x7e4684),new Readable();
}
async._loadRecents(_0x29631f,_0x38b818={}){
  _0x1d3acb={
    _0x23eff6:0x7f3,_0x456389:0x560,_0x3ed1d5:0x606,_0x3ce8df:0x56f,_0x5c4ef9:0x59f,_0x125d98:0x509,_0x5aa6c4:0x2ec,_0x59bd3e:0x1b7,_0x52c79e:0x4cb,_0x20b961:0x3ff,_0x5b2d37:0x21f},_0x20899b={
    _0x3f3083:0x174},_0x5e7082={
    _0x594e30:0x597,_0x39a477:0x45c,_0x3d33e3:0x665,_0x54b16c:0x394,_0x395621:0x492,_0x53dbc9:0x310,_0xfeef7e:0x2f1,_0x45da24:0x687,_0x4461e3:0x991,_0x35207e:0x81d,_0x3f3154:0x8f7,_0x3b1e52:0x556,_0x5816f9:0x70f,_0x5256d9:0x939,_0x388c9f:0x67d,_0x339b91:0x320,_0x446b3d:0x4ee,_0x3cb4e4:0x226,_0x5d649c:0x85f,_0x2f467c:0x7e0,_0x514430:0x502,_0x285e92:0x4da,_0x1ab46d:0x470,_0x488f4d:0x487,_0x1b7c88:0xab0,_0x4bdaf1:0x97c,_0x16de71:0x8ae,_0x5aae18:0x2d2,_0x31d794:0x361,_0x2b5340:0x22b,_0x70ed0:0x283,_0x47cb30:0x656,_0x491ef8:0x325,_0x342802:0x51d,_0x5da8c0:0xa03,_0x1a52f5:0x841,_0x1f27be:0x997,_0x240de3:0x864,_0xee7ba8:0x688,_0x3c13ea:0xa35},_0x16d506={
    _0x299b11:0x1bf,_0x3dde2b:0x614},_0x70aec5={
    _0x5be2e6:0x1cf,_0x19dda1:0x2dc,_0x17becd:0x62d,_0x4c70a2:0x828,_0x2b3b45:0x5d9,_0x348dfa:0x43c,_0x552879:0x49b,_0x2f6312:0x4f2,_0x25fa30:0x627},_0x566f28={
    _0x23059c:0x19b,_0x273ff4:0x1b7},_0x75c173={
    _0x5e1845:0x1e2,_0x5e5aad:0x160,_0x2a1e9f:0x3e0},_0x20a05b={
    _0x1feeb4:0x1f4,_0x3315f0:0x4d9},{
    index:_0x2345cd,range:_0x4907ea}
  =_0x2df6f3(_0x38b818),_0x29bd81=await _0x29631f.find(_0x2345cd,{..._0x38b818,..._0x4907ea,'reverse':!![]}).toArray();
  const _0x57d3bb=await Promise.all(_0x29bd81.map(_0x5767d5=>{return _0x29631f.get("@local/room-preferences",{'roomKey':_0x5767d5.roomKey});}));
  for(let _0x4f4db9=-0x13fc;_0x4f4db9<_0x57d3bb.length;_0x4f4db9++){
    const _0x10c415=_0x57d3bb[_0x4f4db9];
    if(!_0x10c415||_0x10c415.status.isActive)continue;
    _0x29bd81[_0x4f4db9]=null;
  }
return _0x29bd81;
function _0x2df6f3(_0x2cded0){
  if(_0x2cded0.favorites)return{
    'index':"@local/rooms-by-favorite-and-timestamp",'range':{
    }
}
;
if(_0x2cded0.default||_0x2cded0.dms||_0x2cded0.broadcast)return{
  'index':"@local/rooms-by-type-and-timestamp",'range':{
    'lte':{
      'type':_0x357165(_0x2cded0)},'gte':{
      'type':_0x357165(_0x2cded0)}
  }
}
;
return{
  'index':"@local/rooms-by-timestamp",'range':{
  }
}
;
}
function _0x357165(_0x6c70f7){
  if(_0x6c70f7.default)return RoomType.Default;
  if(_0x6c70f7.dms)return RoomType.DirectMessage;
  if(_0x6c70f7.broadcast)return RoomType.Broadcast;
}
}
async._getRoomInfo({localSnapshot:_0x166401},_0x27f720){
  _0x1a4fa5={
    _0x293b6a:0xdf,_0x550f61:0x16c},_0xc4d959={
    _0x790991:0x66,_0x4db8a7:0x3cd,_0x36c9b6:0x1b},_0x15d82c=HypercoreId.decode(_0x27f720),_0xbf4d4f=await _0x166401.get("@local/rooms",{'roomKey':_0x15d82c});
  if(!_0xbf4d4f)return null;
  let _0x491531=encodeMemberRecord(_0xbf4d4f.lastMember);
  const [_0x3bca31,_0x1701ea,_0x4c2461]=await Promise.all([_0x166401.get("@local/room-preferences",{'roomKey':_0xbf4d4f.roomKey}),_0xbf4d4f.lastMessage&&!_0x491531?_0x166401.get("@local/devices",{'device':{'key':_0xbf4d4f.lastMessage.oplog.key}}):null,_0x166401.get("@local/file-stats",{'roomKey':_0xbf4d4f.roomKey})]);
  if(_0x1701ea){
    const _0x5243df=await _0x166401.get("@local/members",{'key':_0x1701ea.device.memberKey});
    _0x5243df&&(_0x491531={'id':HypercoreId.encode(_0x5243df.key),'memberId':HypercoreId.encode(_0x5243df.key),'displayName':_0x5243df.profile.displayName});
  }
if(_0xbf4d4f.lastMessage){
  const _0x4115e4=isDMRead(_0xbf4d4f,_0xbf4d4f.lastMessage.id);
  _0xbf4d4f.lastMessage.read=_0x4115e4;
}
const _0x33edfe=_0xbf4d4f.selfDevice?crypto.discoveryKey(_0xbf4d4f.selfDevice.key):null,_0x5d41cb={
  'hints':!![],'auth':![],'head':![]},_0x442770=_0x33edfe?await this.keet.storage.getInfo(_0x33edfe,_0x5d41cb):null;
return encodeRoomRecord({'roomInfo':_0xbf4d4f,'preferences':_0x3bca31,'lastMessageMember':_0x491531,'storageInfo':_0x442770,'fileStats':_0x4c2461});
}
async._searchRooms({local:_0x182bad}){
  _0x1e8856={
    _0x38b0f2:0xfa,_0x12455b:0x194},_0x442909={
    _0xfae06f:0x76,_0x1f9427:0x91,_0x5983ee:0x2d2}
  ;
  const _0x126894=await this._loadRecents(_0x182bad),_0x413a95=[];
  for(const _0x2ad077 of _0x126894){
    if(!_0x2ad077)continue;
    _0x413a95.push({'title':_0x2ad077.config.title,'roomId':HypercoreId.encode(_0x2ad077.roomKey)});
  }
return _0x413a95;
}
async._getRecentRooms({local:_0xbffb05},_0x57fca8){
  _0x2a9be8={
    _0x2500ec:0xd6,_0x22c9c6:0xbb,_0x542354:0x13e},_0x571079={
    _0x4dee7c:0x178,_0x35427f:0x8c,_0x4773f2:0x60},[_0x52eeca,_0xe57778]=await Promise.all([this._loadRecents(_0xbffb05,_0x57fca8),_0xbffb05.get("@local/stats")]),_0x460e1d=[];
  for(const _0xf034e3 of _0x52eeca){
    if(!_0xf034e3)continue;
    _0x460e1d.push({'timestamp':_0xf034e3.timestamps.latestChatMessage||_0xf034e3.timestamps.latestSync,'roomId':HypercoreId.encode(_0xf034e3.roomKey)});
  }
const _0x1949c5=_0xe57778?_0xe57778.activeRooms:0x0;
return{
  'type':"all",'total':_0x1949c5,'rooms':_0x460e1d}
;
}
async._getPendingRooms({profile:_0x3854a3}){
  _0x56e0ca={
    _0x54d73b:0xf3,_0x2e374d:0x90,_0x2cfaca:0x161},_0x16ac19={
    _0x45aaf6:0xe2,_0x270b23:0x432}
  ;
  const _0x353673=await _0x3854a3.db.find("@keet-private-id/pending-invitations").toArray();
  return _0x353673.map(encodeInvitationRecord);
}
._getLocalRoomMetadata({local:_0x39cebd},_0x126b3f){
  _0x2de1f={
    _0x51b5a1:0x37,_0x225042:0x83,_0x1867ab:0x26}
  ;
  return _0x39cebd.get("@local/rooms",{'discoveryKey':HypercoreId.decode(_0x126b3f)});
}
.subscribeRecentRooms(_0x46bd72){
  _0xbde226={
    _0x349db3:0x8c,_0x43ca73:0x4ae,_0x30f46e:0xf0},_0x44666b={
    _0x34ca70:0x85},_0x293874=function(_0x377494){
    const [_0x469a7c,_0x4fdde8,_0x1bc094]=_0x377494;
    return{
      'type':_0x469a7c,'timestamp':_0x4fdde8,'roomId':_0x1bc094}
    ;
  }
;
return this._addKeetSubscription(RECENTS_ROOMS_SUB_ID,{'map':_0x293874,'query':()=>this.getRecentRooms(_0x46bd72)});
}
.subscribeRoomInfo(_0x123129,_0x5a73b4){
  _0x219c11={
    _0x42d77c:0x2d,_0x53bc15:0xd6,_0x4b8bcd:0x190},_0x3875f6={
    _0x1bf19d:0x192,_0xaee03e:0x110,_0x50c863:0x112}
  ;
  return this._addRoomSubscription(_0x123129,{'query':()=>this.getRoomInfo(_0x123129,_0x5a73b4),'name':'room-info'});
}
.subscribeUnreadActivity(_0x180695={}){
  _0x14bf26={
    _0xe688d8:0x297},_0x594a14=({roomId:_0x1c4c0c,index:_0x19336e})=>{
    if(!_0x1c4c0c)return null;
    if(!_0x180695.includeLength&&!_0x180695.includeIndex)return{
      'roomId':_0x1c4c0c}
    ;
    return{
      'roomId':_0x1c4c0c,'index':_0x19336e}
    ;
  }
;
return this._addKeetSubscription(CHAT_CHANGED_SUB_ID,{'map':_0x594a14});
}
.subscribeErrors(){
  _0x4fd323={
    _0xf60526:0x192,_0x482898:0x6c,_0x3e6fde:0x115},_0x317620={
    _0xcc405a:0x1db,_0x5f3fc2:0x22c,_0x36713:0x11}
  ;
  const _0x1f1f64=_0x2ff7c6=>{
    return encodeErrorRecord(_0x2ff7c6);
  }
;
return this._addKeetSubscription(ERRORS_SUB_ID,{'map':_0x1f1f64});
}
.subscribeNotifications(){
  _0x323526={
    _0x418c73:0xe1,_0x10c19e:0x281,_0x52a422:0x1d5},_0xf05c8e={
    _0x3b0292:0x1ea,_0x3e32ff:0x1af,_0x4cf03f:0x1c8}
  ;
  const _0x3a5931=this.subscribeUnreadActivity({'includeIndex':!![]}),_0x2eec61=Readable.from(this._subscribeNotifications(_0x3a5931));
  _0x2eec61.once("close",()=>{_0x3a5931.destroy();});
  return _0x2eec61;
}
.setCallRingingId(_0x759f42){
  _0x3261c5={
    _0x32258f:0x1f0},_0x3c30c7={
    _0x575b90:0x101,_0x2a4a7e:0xad}
  ;
  this._callRingingRoomId=_0x759f42;
}
.setProcessingNotifications(_0x53e9cc){
  _0x14349b={
    _0x1b1045:0x1b1,_0x1e4504:0x1db},_0x4b6483={
    _0x1107df:0x8b,_0x1122c8:0x7a,_0x4b8b8d:0x134}
  ;
  this._processingNotifications=_0x53e9cc;
}
async*._subscribeNotifications(_0x271137){
  _0x1cecbd={
    _0x1fb283:0x275,_0x2e8777:0x475,_0x296f1d:0x3ea,_0x16d930:0x2dd,_0x1769e5:0x4f3,_0x17ace0:0x1f0,_0x3a2e51:0x60e,_0x4e40da:0x816,_0x3807b8:0x516,_0x3d31fb:0x5a0,_0x42f079:0x454,_0x8ccc6d:0x49c,_0x455151:0x42b,_0x178356:0x36b,_0x27e22b:0x4d1,_0x457e1f:0x37e,_0x938c3f:0x50b,_0x1256b2:0x681,_0x11a36c:0x5c2,_0x5ad6a6:0x64f,_0xcb7e0f:0x84f,_0x37dcd5:0x65a},_0x121218={
    _0x3dd6b0:0x1b3,_0x2870ad:0x19d,_0x4eeaea:0x27d},_0x334e8e={
    _0x304a35:0x1e6,_0x1a1632:0x2a3}
  ;
  for await(const {roomId:_0x27a617,index:_0x4f6cef}of _0x271137){
    if(this._callRingingRoomId){
      if(_0x27a617!==this._callRingingRoomId)continue;
      const _0x1161a1=await this.getChatMessage(_0x27a617,_0x4f6cef);
      _0x1161a1?..event?..type===GENERIC_EVENTS.CALL_HANGUP&&(yield{'type':GENERIC_EVENTS.CALL_HANGUP});
    }
  if(this._processingNotifications)continue;
  if(this.keet.backendAPI.api.call.callIsActive)continue;
  const _0xacf32d=await this.getRoomPreferences(_0x27a617,PREFERENCES.IS_FULLY_MUTED);
  if(_0xacf32d||this._processingNotifications)continue;
  const [_0x45da78,_0x578af5,_0x5a43b6]=await Promise.all([this.getConfig(_0x27a617),this.getChatMessage(_0x27a617,_0x4f6cef),this.keet.local.get("@local/identity")]);
  if(!_0x578af5||Math.abs(Date.now()-_0x578af5.timestamp)>0x7530)continue;
  const _0x7378f8=await this.getBlockedMembers(),_0x3249f0=_0x7378f8.some(_0x4df754=>_0x4df754.memberId===_0x578af5.memberId);
  if(_0x3249f0||this._processingNotifications)continue;
  if(_0x5a43b6&&HypercoreId.encode(_0x5a43b6.publicKey)===_0x578af5.memberId)continue;
  const _0x1e462e=_0x578af5.id.deviceId+'/b'+_0x578af5.id.seq,_0x5cff08=_0x34997e(_0x578af5),_0x5920ca=_0x578af5.files.length>--0x49c6&&_0x578af5.files[-0x1a2e].metadata?..mimetype||'',_0x1db4c2=await this.getMember(_0x27a617,_0x578af5.memberId),_0xbd57d0=_0x578af5.chat?..text||'',_0x32b2bd=fromCompatRoomType(_0x45da78.roomType)===RoomType.DirectMessage;
  if(this._processingNotifications)continue;
  if(_0xbd57d0||_0x5cff08){
    _0x32b2bd&&_0x5cff08==="call"&&!this.keet.backendAPI.call.callIsActive&&(yield{'type':GENERIC_EVENTS.CALL_STARTED});
    const _0x24f331=await this.getRoomInfo(_0x27a617),_0x5c12cd=_0x24f331?..config?..avatar?..small?..pointer?..inlined??'',_0x5a4f23=_0x578af5.message.generic.locationShared;
    yield encodeNotification({'messageId':_0x1e462e,'roomId':_0x27a617,'avatar':_0x5c12cd,'location':_0x5a4f23,'messageText':_0xbd57d0,'messageType':_0x5cff08,'fileType':_0x5920ca},_0x45da78,_0x1db4c2);
  }
}
function _0x34997e(_0x1362a2){
  _0x1ac885={
    _0x4ea419:0xc8,_0x33b645:0xb9,_0x390799:0x24}
  ;
  if(_0x1362a2.event?..type===GENERIC_EVENTS.CALL_STARTED)return "call";
  if(_0x1362a2.files.length>-0x1aea)return'file';
  if(_0x1362a2.message?..generic?..locationShared)return "location";
  return'';
}
}
.setRoomUnread(..._0x81c480){
  _0x3ad922={
    _0x8820fb:0x19a,_0x3a8493:0x5d9},_0x425cc3={
    _0x38eb99:0x258,_0x512326:0xee}
  ;
  console.log("setRoomUnread",..._0x81c480);
  throw new Error("Missing required method:\x20"+("setRoomUnread"));
}
.bumpRoomPriority(..._0x5da017){
  _0x5227b5={
    _0x38ed39:0x1e0,_0x25af75:0x1eb,_0x1b32e4:0x1b2},_0x3bed88={
    _0x239a62:0xfb,_0x4e4fa2:0x397,_0x5dd0fd:0x166}
  ;
  console.log("bumpRoomPriority",..._0x5da017);
  throw new Error("Missing\x20required method:\x20"+("bumpRoomPriority"));
}
.addDevice(..._0x59a83f){
  _0x1b0c00={
    _0x407157:0x13f,_0x2b1750:0x4b,_0x1541d0:0x7a},_0x2e2c9a={
    _0x309f3c:0x17c}
  ;
  console.log("addDevice",..._0x59a83f);
  throw new Error("Missing required method: addDevice");
}
.removeDevice(..._0x132a3b){
  _0x257a7f={
    _0x1b4ee4:0xbc,_0x2f1f6e:0x393,_0x467ed1:0x79},_0xe9fe66={
    _0xb5e45:0x14b}
  ;
  console.log("removeDevice",..._0x132a3b);
  throw new Error("Missing required method:\x20"+("removeDevice"));
}
async._getDevice({db:_0x76018d},_0x8e8c16){
  _0x547381={
    _0x2a4445:0xc5,_0xc74bb6:0x15a,_0x2bdc92:0x174},_0x203855={
    _0x504737:0x2,_0x90fbb8:0xf6,_0x4ef1df:0xc4}
  ;
  const _0x1524bb=await _0x76018d.findOne("@keet/devices",decodeKeyRangeOptions({'gte':_0x8e8c16,'lte':_0x8e8c16}));
  return _0x1524bb?encodeDevice(_0x1524bb):null;
}
async._getDevices({db:_0x4e456c},_0x3b5987){
  _0x32a9cb={
    _0x1c2de3:0x155,_0x48970e:0xa4},_0x233e8f={
    _0x5eac53:0x195,_0x36f3f4:0x38c,_0x44f775:0x16f}
  ;
  return(await _0x4e456c.find("@keet/devices",decodeKeyRangeOptions(_0x3b5987)).toArray()).map(_0x3d8a97=>encodeDevice(_0x3d8a97));
}
async.moveIndexer(_0x4e49c0,_0x39afb1,_0x1abe62){
  _0x64342d={
    _0x54c107:0x54},_0x1597cd={
    _0x517cc7:0xb2,_0x2d71d4:0x9},_0xbdd00e=HypercoreId.decode(_0x39afb1);
  const _0x366c1d=HypercoreId.decode(_0x1abe62);
  return this.keet.dispatch(_0x4e49c0,"@keet/move-indexer",{'deviceKey':_0xbdd00e,'fromDeviceKey':_0x366c1d});
}
.subscribeDevice(_0x5e8798,..._0x2af442){
  _0x3b14e1={
    _0x14ae37:0x58,_0x32d92b:0x81,_0x1d75a1:0x30e},_0x5e5020={
    _0x375e81:0x14,_0x50ff95:0x73}
  ;
  return this._addRoomSubscription(_0x5e8798,{'query':()=>this.getDevice(_0x5e8798,..._0x2af442)});
}
.subscribeDevices(_0xb16bbc,..._0x328c32){
  _0xf38adb={
    _0x385741:0x8d,_0x444e1c:0x131},_0x1287ac={
    _0x37fed0:0x1c2}
  ;
  return this._addRoomSubscription(_0xb16bbc,{'query':()=>this.getDevices(_0xb16bbc,..._0x328c32)});
}
async._createIdentityInvitation(){
  _0x439823={
    _0x5e885f:0x5d,_0x793a40:0x182,_0x8eb399:0x15c},_0x4035a6={
    _0x2ac279:0x47d}
  ;
  return this.keet.createIdentityInvitation();
}
._createInvitation(_0x32f488,_0x462350={}){
  _0x2a4f67={
    _0x5ddadc:0x1e4,_0x87bfe:0x25d},_0x59cfda={
    _0xee821:0x10a,_0x242d43:0x36,_0x5739df:0xd}
  ;
  if(_0x462350.canIndex===!![])_0x462350.canAdmin=!![];
  return this.keet.createRoomInvitation(HypercoreId.decode(_0x32f488),_0x462350);
}
async._updateMember(_0x447e86,_0x164b6b){
  _0x3e5fe4={
    _0x17f66:0x18c,_0x29e799:0x15f,_0x105ff2:0xd8},_0x15f232={
    _0x311124:0x1a,_0x82de8:0xb7}
  ;
  const _0x5efa9d=await this.keet.local.get("@local/identity"),_0x414b71=_0x5efa9d?HypercoreId.encode(_0x5efa9d.privateProfileKey):null;
  if(!_0x414b71)return;
  return _0x164b6b=decodeImageFile(_0x164b6b),this.keet.updateProfile({'displayName':_0x447e86,'avatar':_0x164b6b});
}
async._muteMember(_0x31f558,_0x2433f4){
  _0x5734c6={
    _0x151618:0x66,_0x5157bd:0x3c8,_0xcfb98b:0x1ce},_0x3b78d8={
    _0x3ef197:0x1c2,_0x3402e3:0x68}
  ;
  const _0x444947=HypercoreId.decode(_0x2433f4);
  return this.keet.dispatch(_0x31f558,"@keet/change-member-status",{'memberKey':_0x444947,'key':MemberStatus.IsMuted,'status':{'isMuted':!![]}});
}
async._unmuteMember(_0x20a752,_0x7ca0d3){
  _0x6fa424={
    _0x1b3188:0x1d3,_0x530cda:0x197},_0x3169fd={
    _0x2d0b73:0x9c}
  ;
  const _0x328b6d=HypercoreId.decode(_0x7ca0d3);
  return this.keet.dispatch(_0x20a752,"@keet/change-member-status",{'memberKey':_0x328b6d,'key':MemberStatus.IsMuted,'status':{'isMuted':![]}});
}
async._isMemberMuted({db:_0x59e8b4},_0x2e79e4){
  _0x47eab8={
    _0x49b02e:0xda,_0xfd8a04:0x1c6,_0x32afdd:0x70},_0x3a32da={
    _0x5a85ba:0x1a2,_0x5668de:0xf3,_0x318b33:0xb}
  ;
  const _0x398f3a=HypercoreId.decode(_0x2e79e4);
  return!!await _0x59e8b4.get("@keet/muted-members",{'key':_0x398f3a});
}
async._getMemberByDeviceId({myKey:_0x5e5bfb,snapshot:_0x33d45d,blobsSnapshot:_0x5d797d},_0x318fb7){
  _0x39e477={
    _0x235df2:0x109,_0x40c71a:0x17c,_0x2f40b3:0x100},_0x3ab303={
    _0x10bb9e:0x160,_0x10652b:0x66}
  ;
  const _0x1a5567=await getMemberForDeviceKey(_0x33d45d,HypercoreId.decode(_0x318fb7));
  if(!_0x1a5567)return null;
  return await restoreAvatar(_0x5d797d,_0x1a5567.profile.avatar),encodeMemberRecord(_0x1a5567,_0x5e5bfb);
}
async._getMemberBySwarmId({myKey:_0x21a669,snapshot:_0x33c78c,blobsSnapshot:_0x2c00f9},_0x3e6b5a){
  _0x1b47a8={
    _0x170eb1:0x72},_0x10cdae={
    _0x15baba:0x130},_0x4c0eff=HypercoreId.decode(_0x3e6b5a),_0x59e27f=await _0x33c78c.get("@keet/devices-by-swarm-key",{'profile':{'swarmKey':_0x4c0eff}});
  if(!_0x59e27f)return null;
  const _0x27a32e=await getMemberForDeviceKey(_0x33c78c,_0x59e27f.key);
  if(!_0x27a32e)return null;
  return await restoreAvatar(_0x2c00f9,_0x27a32e.profile.avatar),encodeMemberRecord(_0x27a32e,_0x21a669);
}
async._getMemberCount({db:_0x3e6e91}){
  _0x2dcac8={
    _0x10be0f:0x1e0,_0x300595:0x16a},_0x645387={
    _0x55e9b3:0x1a9,_0x43f915:0x168,_0x4b5d4f:0x493},_0x4d3cb7=await _0x3e6e91.get("@keet/threads",{'id':0x0});
  return _0x4d3cb7?_0x4d3cb7.stats.members.active:-0x1dfc;
}
async._getDevicesByMemberId({db:_0x3a4d79},_0x3f6a57){
  _0x423b9f={
    _0x3134d6:0xd0,_0x13bf52:0x193,_0x22751e:0x209}
  ;
  const _0x4a4ea2=[],_0x4334ae=HypercoreId.decode(_0x3f6a57);
  const _0x509858={
    'gte':{
      'memberKey':_0x4334ae},'lte':{
      'memberKey':_0x4334ae}
  }
;
for await(const _0x224458 of _0x3a4d79.find("@keet/devices-by-member-key",_0x509858)){
  _0x4a4ea2.push(encodeDevice(_0x224458));
}
return _0x4a4ea2;
}
.getCurrentDeviceId(_0xbfca13){
  _0x3a8065={
    _0x39c49a:0xad,_0x22d342:0x183},_0x141325={
    _0x45adf5:0x96,_0x40f586:0x1d3,_0x574946:0x431},_0xb396c=this.keet.internalOpenExistingRoom(_0xbfca13);
  try{
    return _0xb396c.deviceId;
  }finally{
  this.keet.internalReleaseRoom(_0xb396c);
}
}
async._getMember({roomId:_0x31c37c,myKey:_0x422d09,base:_0x1687f3,snapshot:_0x40f487,blobsSnapshot:_0x5320c0},_0x53553c,_0x5a4b31={}){
  _0xce4ca6={
    _0x175bfd:0x78,_0x3edd63:0x197,_0x2e8a22:0x210},_0x326bd5={
    _0x1a0091:0xd1,_0x1efc3f:0x6f}
  ;
  const _0x1cb3c8=HypercoreId.decode(_0x53553c);
  if(_0x5a4b31.swarmId===!![])return this.getMemberBySwarmId(_0x31c37c,_0x53553c);
  const _0x5e42d5=await _0x40f487.get("@keet/members",{'key':_0x1cb3c8});
  if(!_0x5e42d5)return null;
  return await restoreAvatar(_0x5320c0,_0x5e42d5.profile.avatar),encodeMemberRecord(_0x5e42d5,_0x422d09);
}
async._getActiveMember({myKey:_0x3e3d6a,snapshot:_0x30c1a7,blobsSnapshot:_0x4dcc27},_0x310639){
  _0x197e56={
    _0x41e77a:0x1f,_0x487bca:0x72,_0x55972f:0x13},_0x385640={
    _0x35e136:0x3e6}
  ;
  const _0x2dd33f=await _0x30c1a7.get("@keet/active-members",{'key':HypercoreId.decode(_0x310639)});
  if(!_0x2dd33f)return null;
  return await restoreAvatar(_0x4dcc27,_0x2dd33f.profile.avatar),encodeMemberRecord(_0x2dd33f,_0x3e3d6a);
}
async._removeMember(_0x250193,_0x52463a){
  _0x2778b9={
    _0x53bea0:0xa4,_0x2e3448:0xc6,_0xd71b1c:0x27b},_0x153691={
    _0x3f9618:0x46,_0x1eec7b:0x369,_0x241e7a:0x9e},_0x2b630c=HypercoreId.decode(_0x250193);
  const _0x4fd8e5=await this.keet.local.get("@local/rooms",{'roomKey':_0x2b630c});
  if(!_0x4fd8e5)return;
  const {
    isFeatureSupported:_0x28995b,FEATURES:_0x47154d}
  =this.keet.versions;
  if(!_0x28995b(_0x4fd8e5.digest.abi.version,_0x47154d.REMOVE_MEMBER_V2))return;
  return this.keet.dispatch(_0x250193,"@keet/remove-member",{'key':HypercoreId.decode(_0x52463a)});
}
async._getMembers({myKey:_0x193c47,snapshot:_0x4e7db1,blobsSnapshot:_0x52069e},_0x507556={}){
  _0x196cbe={
    _0x40133d:0xf5,_0x457a98:0x1e3,_0x173572:0x3a2,_0x5c6827:0x21f,_0x43bda0:0x809,_0x252d7c:0x849,_0x395d0c:0x8af},_0x28ba1f={
    _0x108a7d:0x1e9,_0x5441e8:0x305,_0x1fd280:0x1a7},_0x1d184a={
    _0x1b572d:0x1e7,_0x566501:0x9a,_0x540839:0xd7},_0x36d8e2={
    _0xdb134b:0x123,_0x3d4796:0x1ab},_0x46e3c7=await _0x4e7db1.find("@keet/members",decodeKeyRangeOptions(_0x507556)).toArray();
  return Promise.all(_0x46e3c7.map(async _0x553e81=>{await restoreAvatar(_0x52069e,_0x553e81.profile.avatar);return encodeMemberRecord(_0x553e81,_0x193c47);}));
}
async._getActiveMembers({myKey:_0x4cd6ad,snapshot:_0x3a8661,blobsSnapshot:_0x3e58f4},_0x52ee23={}){
  _0x289115={
    _0x239a2c:0x563,_0x328626:0x3de,_0x35840c:0x287,_0xab8bff:0x6cf,_0x202747:0x856,_0xf3f518:0x738},_0x4e7765={
    _0x8af226:0x1a0,_0x2cca62:0x89,_0xdec926:0x6},_0x1195f6={
    _0x5d329c:0xbc},_0x5be3a2={
    _0x22b47c:0x14d,_0x11ce3e:0x83,_0x585f13:0x2e1}
  ;
  const _0x473aa7=await _0x3a8661.find("@keet/active-members",decodeKeyRangeOptions(_0x52ee23)).toArray();
  return Promise.all(_0x473aa7.map(async _0xdc64ca=>{await restoreAvatar(_0x3e58f4,_0xdc64ca.profile.avatar);return encodeMemberRecord(_0xdc64ca,_0x4cd6ad);}));
}
async._getModerators({myKey:_0x41cbcd,snapshot:_0x164e7e,blobsSnapshot:_0x16c346},_0x2e5b43={}){
  _0x4719dd={
    _0x3337a4:0x1b5,_0x2aeac1:0x181},_0x5b1d2b={
    _0x556a2f:0x224,_0x2934e3:0x189}
  ;
  const _0x5613f0=await _0x164e7e.find("@keet/moderators",decodeKeyRangeOptions(_0x2e5b43)).toArray();
  return Promise.all(_0x5613f0.map(async _0x24db2a=>{return await restoreAvatar(_0x16c346,_0x24db2a.profile.avatar),encodeMemberRecord(_0x24db2a,_0x41cbcd);}));
}
async._waitUntilJoined({roomKey:_0x2ebc33,local:_0x24420e}){
  _0x2aa634={
    _0x1f9b78:0x25f,_0x581dba:0x82},_0x58ddde=await _0x24420e.get("@local/rooms",{'roomKey':_0x2ebc33});
  if(!_0x58ddde)return null;
  return encodeMemberRecord(_0x58ddde.selfMember);
}
.getMemberForDevice(..._0x36ec61){
  _0x33f02a={
    _0x258632:0x101,_0x3a07ca:0xbd},_0x3252bd={
    _0x31800a:0x4b,_0x4a87af:0x96,_0x4eba41:0x51a}
  ;
  console.log("getMemberForDevice",..._0x36ec61);
  throw new Error("Missing required method: "+("getMemberForDevice"));
}
.subscribeMemberCount(_0x44f7bc,..._0x1f74ad){
  _0x31cc8f={
    _0x58b23d:0x24,_0x17caca:0x191},_0x60f2a9={
    _0x5e3110:0x45,_0x16aa44:0x6d,_0x3ea873:0xc3}
  ;
  return this._addRoomSubscription(_0x44f7bc,{'query':()=>this.getMemberCount(_0x44f7bc,..._0x1f74ad)});
}
.subscribeMember(_0x4cfc0b,..._0x2d599f){
  _0x1c24e5={
    _0x51c77f:0x6e,_0x2c751b:0x16,_0x453839:0x50c}
  ;
  return this._addRoomSubscription(_0x4cfc0b,{'query':()=>this.getMember(_0x4cfc0b,..._0x2d599f)});
}
.subscribeActiveMember(_0x435946,..._0x1c740c){
  _0x9fc72d={
    _0x56111e:0xea,_0x1996c6:0x90,_0xb111e4:0x243},_0x1466b8={
    _0x2e84ed:0x17c,_0x3ac21f:0x45,_0x4dff85:0x284}
  ;
  return this._addRoomSubscription(_0x435946,{'query':()=>this.getActiveMember(_0x435946,..._0x1c740c)});
}
.subscribeActiveMembers(_0x1325c9,..._0x15f226){
  _0x4a6dbb={
    _0x12863b:0x180},_0x15f86e={
    _0x4df973:0x42,_0x4f7110:0x67}
  ;
  return this._addRoomSubscription(_0x1325c9,{'query':()=>this.getActiveMembers(_0x1325c9,..._0x15f226)});
}
.subscribeMembers(_0x4d943c,..._0xeb092d){
  _0x5194e0={
    _0xa49306:0x128,_0x48b18a:0x50}
  ;
  return this._addRoomSubscription(_0x4d943c,{'query':()=>this.getMembers(_0x4d943c,..._0xeb092d)});
}
.subscribeModerators(_0x2d3752,..._0x1e5ffc){
  _0x4a42a9={
    _0x1de9c8:0xfd,_0x3c78e6:0x18f,_0x5c75fa:0x14f},_0x33e1be={
    _0x4bf7f4:0x149}
  ;
  return this._addRoomSubscription(_0x2d3752,{'query':()=>this.getModerators(_0x2d3752,..._0x1e5ffc)});
}
.subscribeMemberForDevice(_0x218821,..._0x43ae6a){
  _0x4d2db5={
    _0x14233c:0x391,_0x3e389c:0x1a1},_0x5af3b4={
    _0x2e9ca7:0xd6,_0x180ca9:0x171}
  ;
  return this._addRoomSubscription(_0x218821,{'query':()=>this.getMemberByDeviceId(_0x218821,..._0x43ae6a)});
}
._changeMemberRole(_0x3e3857,{memberId:_0xfddcb7,role:_0x5b370b}){
  _0x10093d={
    _0x5908fc:0x95,_0x33eebf:0xc4},_0x1b54de={
    _0x3dbfb1:0xbc}
  ;
  return this.keet.dispatch(_0x3e3857,"@keet/change-member-role",{'key':HypercoreId.decode(_0xfddcb7),'isAdmin':_0x5b370b===MemberRoles.ADMIN,'isModerator':_0x5b370b===MemberRoles.ADMIN||_0x5b370b===MemberRoles.MODERATOR});
}
async._getSearchMembers({myKey:_0x2b083d,db:_0x458970,blobsSnapshot:_0x581dd8},_0x10f1ac,{limit:limit=0x32}={}){
  _0x118b89={
    _0x5903b6:0x4da,_0x1a9dae:0x30a,_0x94bcb5:0x5b4,_0x5d9d49:0x652,_0x5022a9:0x34d,_0x2260b7:0x35e,_0x2f92f7:0x248,_0x51d7cf:0x459},_0x1cef6e={
    _0xd6b5c1:0xd3,_0x11b09c:0x194,_0x6cd0c9:0x5},_0x20654d={
    _0x3c3770:0x111,_0x1bbee9:0x66,_0x33d3ee:0x1c3},_0x52ac9={
    _0x37131a:0x2a0,_0x1ea3ec:0x238,_0xb5f26d:0xb7,_0x2dcd14:0x238},_0x1a07c4={
    _0x226b4f:0x17a,_0x18a1f4:0xfe},_0x23f27e={
    _0x2c27fb:0x12b}
  ;
  _0x10f1ac=_0x10f1ac.toLowerCase();
  const _0x197890=await _0x458970.find("@keet/members-by-member-name",{'gte':{'name':_0x10f1ac},'limit':limit}).toArray(),_0x1defe2=await Promise.all(_0x197890.map(async _0x375cfc=>{await restoreAvatar(_0x581dd8,_0x375cfc.profile.avatar);return encodeMemberRecord(_0x375cfc,_0x2b083d);}));
  return _0x1defe2.filter(_0x3de0dc=>{return _0x3de0dc.name.startsWith(_0x10f1ac);});
}
.getPushNotificationMembers(..._0x27a8dd){
  _0x45ecc9={
    _0x1cfdb8:0xc0,_0x5e71fd:0x11f},_0x49842e={
    _0x58c272:0x1dc,_0x50deb8:0x11e,_0x1e5b8d:0xc2}
  ;
  console.log("getPushNotificationMembers",..._0x27a8dd);
  throw new Error("Missing required method: "+("getPushNotificationMembers"));
}
.subscribeSearchMembers(..._0x10197b){
  _0x5ec23c={
    _0xccf62c:0x1ad,_0x2b3319:0x153},_0x591dce={
    _0x2f3a20:0x1c8,_0x1ba0d0:0xc3}
  ;
  console.log("subscribeSearchMembers",..._0x10197b);
  return new Readable();
}
.subscribePushNotificationMembers(..._0x3faec9){
  _0x2ebdaf={
    _0x2e3fee:0x87,_0x45ee99:0xaf,_0xf6d6a1:0x5a},_0x4297f={
    _0x526779:0x127}
  ;
  console.log("subscribePushNotificationMembers",..._0x3faec9);
  return new Readable();
}
async._getContactInfo({local:_0x2307f1,profile:_0x24b02d},_0x4120b7){
  _0x4458a5={
    _0x55bb96:0x44},_0x596610={
    _0x19f5fa:0x149,_0x5010e1:0x27d},_0x8c145b=HypercoreId.decode(_0x4120b7);
  const [_0x447bb8,_0xb688c5,_0x151d10]=await Promise.all([_0x2307f1.get("@local/contacts",{'memberKey':_0x8c145b}),_0x2307f1.findOne("@local/rooms-by-contact",{'gte':{'contact':_0x8c145b},'lte':{'contact':_0x8c145b}}),_0x24b02d.db.findOne("@keet-private-id/pending-contact-requests-by-member",{'gte':{'memberKey':_0x8c145b},'lte':{'memberKey':_0x8c145b}})]);
  return encodeContactInfo(_0x4120b7,_0x447bb8,_0xb688c5,_0x151d10);
}
.subscribeContactInfo(_0x4d8182){
  _0x2b27d0={
    _0x3d63b0:0xa0,_0x1cfa8f:0x23,_0x3f0eab:0x98},_0x3acf0c={
    _0x2fb2e7:0xa9},_0x12da91={
    _0x56c394:0x297,_0x27065a:0x4b4,_0x27b49c:0x446,_0x138c36:0x345,_0x11c9b7:0x1a2,_0x2668d1:0x514,_0x177d6a:0x87c,_0x1aca36:0x8b0,_0x24702b:0x83f,_0xf3342f:0x6c9,_0x44db95:0x47a,_0x12c3a8:0x423,_0x4d0d76:0x5bb,_0x593dcf:0x76d,_0x5385c8:0x3bf,_0x10844f:0x77b,_0x1304f7:0x74b,_0xe88552:0x91b,_0x492f3c:0x547,_0x5ac9a8:0x7e4,_0x14ccef:0x6d3,_0x5af596:0x7f4,_0x2d100a:0x515,_0x532042:0x897,_0xb1e1c2:0x743,_0x5d7fbf:0x7b9,_0x5e3512:0x8c8,_0x2b2795:0x801},_0x1cbad6={
    _0x30b9b6:0x3e8},_0x39d0d6=async()=>{
    const _0x136c66=this.keet.local.snapshot();
    try{
      const _0x3d7726=HypercoreId.decode(_0x4d8182),[_0x5356a4,_0x606f84]=await Promise.all([_0x136c66.get("@local/contacts",{'memberKey':_0x3d7726}),_0x136c66.findOne("@local/rooms-by-contact",{'gte':{'contact':_0x3d7726},'lte':{'contact':_0x3d7726}})]);
      return encodeContactInfo(_0x4d8182,_0x5356a4,_0x606f84,null);
    }finally{
    await _0x136c66.close();
  }
}
;
return this._addRoomSubscription(DM_ROOMS_SUB_ID,{'query':_0x39d0d6});
}
async._blockMember(_0xe65f5e,_0xc87180){
  _0x3e6c99={
    _0x302397:0x33},_0x4a8922={
    _0x6c046b:0x25},_0x35d9d3=HypercoreId.decode(_0xc87180);
  return this.keet.blockContact(_0x35d9d3);
}
async._unblockMember(_0x33b5c8,_0x55ad9f){
  _0x2b6bef={
    _0x565e10:0x3f7},_0x479a36={
    _0x3f9593:0xdf,_0x50c0c6:0x68,_0xd6949d:0x5a1}
  ;
  const _0x149b7a=HypercoreId.decode(_0x55ad9f);
  return this.keet.unblockContact(_0x149b7a);
}
async._getBlockedMembers({local:_0x11e6bd}){
  _0x423092={
    _0x30d9dc:0x7d,_0x3f020f:0x4b6},_0xf92b02={
    _0x11245d:0x1b,_0x1a2eb2:0xb6,_0x452027:0x131}
  ;
  return(await _0x11e6bd.find("@local/blocked-contacts").toArray()).map(({memberKey:_0x5d6d9a})=>({'memberId':HypercoreId.encode(_0x5d6d9a)}));
}
.subscribeBlockedMembers(){
  _0x3ef866={
    _0x24485d:0xe4,_0x4a3bdc:0x392,_0x1296a3:0x118},_0xb16848={
    _0x284656:0x6e,_0x196410:0xe3}
  ;
  return this._addRoomSubscription(PROFILE_SUB_ID,{'query':()=>this.getBlockedMembers()});
}
.getConnectedMembers(..._0xb3c626){
  _0x2bae91={
    _0x2f2a1b:0x40,_0x3a0bb8:0x4af}
  ;
  console.log("getConnectedMembers",..._0xb3c626);
  throw new Error("Missing required method: "+("getConnectedMembers"));
}
.subscribeConnectedMembers(..._0x43b1bf){
  _0x2b65d3={
    _0x2ad716:0x1bf,_0xda16bd:0x10a},_0x23fddc={
    _0x56c1bc:0x37b,_0x50f496:0x15d}
  ;
  console.log("subscribeConnectedMembers",..._0x43b1bf);
  return new Readable();
}
async._updateConfig(_0x1c6e00,_0x3c720a,_0x3d7e8e){
  _0x176bdc={
    _0x3d36e3:0x1ef,_0xa8b8e9:0xa2,_0x1e48fd:0x5fb},_0x1358d2={
    _0x47a199:0x19b,_0xe18775:0x120}
  ;
  const _0x31e876=fromCompatConfigKey(_0x3c720a);
  if(_0x31e876!==0x0){
    const _0x57b75f={
      [CONFIG_INDEX_TO_KEY[_0x31e876-(-0x3bed)]]:_0x3d7e8e}
    ;
    await this.keet.dispatch(_0x1c6e00,"@keet/update-room-config",{'key':_0x31e876,'config':decodeConfig(_0x57b75f)});
  }else{
  if(_0x3c720a==="roomType"){
    const _0x297f3e=fromCompatRoomType(_0x3d7e8e);
    if(_0x297f3e===0x0)throw new Error("Invalid room type");
    await this.keet.dispatch(_0x1c6e00,"@keet/update-system-settings",{'key':Settings.RoomType,'settings':{'roomType':_0x297f3e}});
  }else{
  if(_0x3c720a==="canCall")await this.keet.dispatch(_0x1c6e00,"@keet/update-system-settings",{'key':Settings.IsCallingDisabled,'settings':{'isCallingDisabled':_0x3d7e8e==="false"}});
  else throw new Error("Invalid config\x20key");
}
}
}
async._updateRoomPreferences({profile:_0x503c3f},_0x3c4df7,_0x38b5f6,_0x361d09){
  _0x3b53e7={
    _0x53c4a0:0x116},_0x2b56ea={
    _0x376b77:0x18e,_0x4a4b82:0x16f}
  ;
  if(!isValidPreferenceKey(_0x38b5f6))throw new Error("invalid\x20preference key: "+_0x38b5f6);
  const _0x94563a=HypercoreId.decode(_0x3c4df7);
  await this.keet.dispatch(_0x503c3f.id,"@keet-private-id/update-room-status",{'roomKey':_0x94563a,'key':fromCompatPreferencesKey(_0x38b5f6),'status':{[getPreferenceKeyName(_0x38b5f6)]:_0x361d09}});
}
._updateRoomSettings(_0x168771,_0x2744ba,_0x3ce373){
  _0x35d066={
    _0x1a56af:0x47b,_0x1b460b:0xcc},_0x3b1e10={
    _0x238309:0xf,_0x15c4e2:0x106,_0x584bcb:0x55}
  ;
  const _0x544f3f=HypercoreId.decode(_0x168771);
  return this.keet.dispatch(_0x544f3f,"@keet/update-system-settings",{'key':_0x2744ba,'settings':_0x3ce373});
}
async._getRoomSettings(_0x41b0e9){
  _0x61ff5b={
    _0x557647:0x1f3,_0x576bb0:0xe4,_0x76828:0x2f0},_0x761ebf={
    _0x1f9909:0x18f,_0x88b1f3:0x1ac},_0x5a6833=HypercoreId.decode(_0x41b0e9),_0x3f06f6=this.keet.internalOpenExistingRoom(_0x5a6833);
  try{
    const _0x4211ce=await _0x3f06f6.db.get("@keet/system-digest");
    return _0x4211ce.settings;
  }finally{
  this.keet.internalReleaseRoom(_0x3f06f6);
}
}
async._getRoomPreferences({local:_0x5a759f},_0x31e6ac,_0x163d84){
  _0x1acba4={
    _0x4304ef:0x1ed,_0x5de8c4:0x4d8,_0x118e98:0x1e3},_0x57cf43={
    _0xeb62d3:0xad,_0x29195b:0x36e},_0x1a770a=HypercoreId.decode(_0x31e6ac),_0x56846f=await _0x5a759f.get("@local/room-preferences",{'roomKey':_0x1a770a});
  if(!_0x56846f)return null;
  const {
    status:_0x9d5bd6}
  =_0x56846f;
  if(!isValidPreferenceKey(_0x163d84))return null;
  return _0x163d84?_0x9d5bd6[getPreferenceKeyName(_0x163d84)]:_0x9d5bd6;
}
async._getConfig({roomKey:_0x4bd5b3,local:_0x1ff728},_0x36b316){
  _0x1d2750={
    _0x278698:0x52,_0x4a5cb7:0x316,_0x28891c:0xc1}
  ;
  const _0x4561e5=await _0x1ff728.get("@local/rooms",{'roomKey':_0x4bd5b3});
  if(!_0x4561e5)return null;
  const {
    config:_0x4e7c00,digest:_0x168887}
  =_0x4561e5,_0x3cd184=encodeConfig(_0x4e7c00,_0x168887)||{
  }
;
return _0x36b316?_0x3cd184[_0x36b316]:_0x3cd184;
}
.subscribeConfig(_0x8acc0e){
  _0x3cb338={
    _0x468745:0x155,_0x32d9cc:0x3e6,_0x344642:0x1c0},_0x498522={
    _0x1b48a2:0x44,_0x1816ac:0x9f}
  ;
  return this._addRoomSubscription(_0x8acc0e,{'query':()=>this.getConfig(_0x8acc0e)});
}
async._addChatMessage(_0x7f82e2,_0x436dbc,_0x15c4a4={}){
  _0x265160={
    _0x42653c:0x2b4,_0x2ffb5b:0x5a},_0x4e08d4={
    _0x28f59f:0x66,_0xdd1211:0x116},_0x10c0df=HypercoreId.decode(_0x7f82e2);
  const _0x2c4c2f=await this.keet.local.get("@local/rooms",{'roomKey':_0x10c0df});
  if(!_0x2c4c2f)return;
  const _0xedb96a=decodeChatMessage(_0x436dbc,_0x15c4a4),_0xe9a921=removePreviewsFromChatMessage(_0xedb96a);
  const {
    isFeatureSupported:_0x4568d1,FEATURES:_0x433550}
  =this.keet.versions,_0x167a3f=_0x4568d1(_0x2c4c2f.digest.abi.version,_0x433550.MULTI_FILES);
  if(_0xedb96a.files.length&&!_0x167a3f)throw new Error("multi files\x20not\x20supported");
  const _0x3944d5=this.keet.batch(_0x7f82e2),_0x13b428=await _0x3944d5.dispatch("@keet/add-chat-message",{'timestamp':Date.now(),'message':_0xedb96a});
  if(_0x13b428===-0x1058)return;
  return(_0xe9a921.files.length||_0xe9a921.pearLink.length||_0xe9a921.httpLink.length)&&await addFilePreviewOperations(_0x3944d5,_0xe9a921),await _0x3944d5.flush();
}
async._updateChatMessage(_0x297e9d,_0x519a60,_0x437931,_0x199b23={}){
  _0x2f5009={
    _0x3c42fd:0x11a,_0x4b9cd4:0x121,_0x128875:0x47e},_0x5b151f={
    _0x268daf:0x1c4,_0x1d9c9b:0x1e7,_0x3a38b7:0x25c},_0x30bf0d=HypercoreId.decode(_0x297e9d);
  const _0x9a8ae5=await this.keet.local.get("@local/rooms",{'roomKey':_0x30bf0d});
  if(!_0x9a8ae5)return;
  const _0x15a32f=decodeMessageId(_0x519a60),_0x5a0b97=decodeChatMessage(_0x437931,_0x199b23),_0x5cb0e2=removePreviewsFromChatMessage(_0x5a0b97),{
    isFeatureSupported:_0x294967,FEATURES:_0x8eb9e6}
  =this.keet.versions,_0x411634=_0x294967(_0x9a8ae5.digest.abi.version,_0x8eb9e6.MULTI_FILES);
  if(_0x5a0b97.files.length&&!_0x411634)throw new Error("multi files not supported");
  const _0x2aa423=this.keet.batch(_0x297e9d),_0x3dd80c=await _0x2aa423.dispatch("@keet/update-chat-message",{'oplog':_0x15a32f,'message':_0x5a0b97});
  if(_0x3dd80c===0x0)return;
  (_0x5cb0e2.files.length||_0x5cb0e2.pearLink.length||_0x5cb0e2.httpLink.length)&&await addFilePreviewOperations(_0x2aa423,_0x5cb0e2,_0x15a32f);
  await _0x2aa423.flush();
}
async._removeChatMessage({roomKey:_0x513f15,local:_0x2c2aa5,roomId:_0xe61114,snapshot:_0x5bed55,blobsSnapshot:_0x250e21,files:_0x16d3a2},_0x6ba176){
  _0x3cbd2d={
    _0x1d1eb0:0x88,_0x58c3b7:0x175,_0x557960:0x34b},_0x460b2f={
    _0xaf79cb:0x196,_0x1e8ef7:0xd,_0x220f71:0x2c9},_0x2098aa=await this._getChatMessageById({'roomKey':_0x513f15,'local':_0x2c2aa5,'snapshot':_0x5bed55,'blobsSnapshot':_0x250e21,'files':_0x16d3a2},_0x6ba176);
  if(!_0x2098aa)return null;
  if(_0x2098aa.files.length){
    const _0x2359f2=[];
    for(const _0xda31e1 of _0x2098aa.files)_0x2359f2.push(this._clearFile({'roomKey':_0x513f15,'files':_0x16d3a2},_0xda31e1));
    await Promise.all(_0x2359f2);
  }
return this.keet.dispatch(_0xe61114,"@keet/remove-chat-message",{'oplog':decodeMessageId(_0x6ba176)});
}
async._forwardChatMessage({roomKey:_0x362f31,local:_0x48c650,roomId:_0x1e5c36,snapshot:_0x383586,blobsSnapshot:_0x33d24f,files:_0x168faa},_0x4bd36b,_0x31d5b,_0x153b1b={}){
  _0x29e169={
    _0x5d7175:0x160,_0x513eac:0xe9,_0x1ef64f:0x12d},_0xbdde8a={
    _0x133687:0x51,_0x8a3b3b:0x124,_0x6c5b4e:0x640},_0x5dd245=await this.keet.local.get("@local/rooms",{'roomKey':_0x362f31});
  if(!_0x5dd245)return;
  const {
    isFeatureSupported:_0x41b4ed,FEATURES:_0x2cdb28}
  =this.keet.versions;
  if(!_0x41b4ed(_0x5dd245.digest.abi.version,_0x2cdb28.FORWARDED_MESSAGE))throw new Error("Message\x20forwarding not\x20supported");
  const _0x5550cb=await this._getChatMessageById({'roomKey':_0x362f31,'local':_0x48c650,'snapshot':_0x383586,'blobsSnapshot':_0x33d24f,'files':_0x168faa},_0x4bd36b);
  if(!_0x5550cb)return null;
  const _0x1ca6a0=_0x5550cb.message.text;
  return await this._addChatMessage(_0x31d5b,_0x1ca6a0,{..._0x153b1b,'forwarded':!![]});
}
._pinChatMessage(_0x5d7c3e,_0x38885f){
  _0x1cdb96={
    _0x9572f5:0x10c,_0x156784:0x132,_0x488093:0x634},_0x3c53b1={
    _0x3c1d71:0x125,_0x11a3ce:0x95,_0x116816:0x127}
  ;
  return this.keet.dispatch(_0x5d7c3e,"@keet/pin-chat-message",{'oplog':decodeMessageId(_0x38885f),'isPinned':!![]});
}
._unpinChatMessage(_0x5d24bb,_0x1e9396){
  _0x15b9fb={
    _0x14b84c:0x155,_0x122476:0x125},_0xedac45={
    _0x3e0c48:0x17d,_0xe598cb:0x12,_0x4e7157:0x15}
  ;
  return this.keet.dispatch(_0x5d24bb,"@keet/pin-chat-message",{'oplog':decodeMessageId(_0x1e9396),'isPinned':![]});
}
._addCallStartedEvent(_0x21e5da){
  _0x3780c5={
    _0x3d3fcb:0x10b,_0xfd2900:0xa8},_0x1192c5={
    _0x265823:0xe5,_0x454908:0x21f}
  ;
  return this.addChatMessage(_0x21e5da,null,{'callStarted':!![]});
}
._addCallHangupEvent(_0x5ef45c){
  _0x2925ec={
    _0xfbbdd9:0x1a4,_0x86d089:0x24b,_0x44c96b:0x149}
  ;
  return this.addChatMessage(_0x5ef45c,null,{'callHangup':!![]});
}
._addCallMissedEvent(_0xb8ee5e){
  _0x48ee59={
    _0x4ab50e:0x9c,_0x56a106:0x1aa,_0xe81c75:0x133},_0x4616fc={
    _0x3fff7c:0x123,_0x14aac7:0x73}
  ;
  return this.addChatMessage(_0xb8ee5e,null,{'callMissed':!![]});
}
async._addLocationSharedEvent(_0x223fb0,_0x57f168,{locationShared:{latitude:_0x591e62,longitude:_0x452387}}){
  _0x46126d={
    _0x125b53:0x1b6,_0x3952c2:0x2e},_0x3b4580={
    _0x2c5fb7:0x70,_0x4a50c4:0x147,_0xf5d64e:0x5ee},_0x45fe32=HypercoreId.decode(_0x223fb0);
  const _0x5b120a=await this.keet.local.get("@local/rooms",{'roomKey':_0x45fe32});
  if(!_0x5b120a)return;
  const {
    isFeatureSupported:_0x3bcc8b,FEATURES:_0x2a0a30}
  =this.keet.versions;
  if(!_0x3bcc8b(_0x5b120a.digest.abi.version,_0x2a0a30.LOCATION_SHARED_EVENT))throw new Error("Location sharing not supported");
  return this.addChatMessage(_0x223fb0,_0x57f168,{'locationShared':{'latitude':_0x591e62,'longitude':_0x452387}});
}
.addRoomAvatarChangedEvent(..._0x293eaf){
  _0x52c7b9={
    _0x3d2a1b:0x1bd,_0xce498d:0x2cd,_0x5cf58a:0x18b},_0x4fa94b={
    _0x3efbfb:0x16e,_0xa39d14:0x113,_0x51c8d7:0xcf}
  ;
  console.log("addRoomAvatarChangedEvent",..._0x293eaf);
  console.warn("Missing required method:\x20"+("addRoomAvatarChangedEvent"));
}
.addEvent(..._0x915b2e){
  _0x4a5c13={
    _0x5d30ab:0x12,_0x45a58f:0xe7},_0x1c56e4={
    _0x354c82:0x16a,_0x397ecf:0xd2}
  ;
  console.log("addEvent",..._0x915b2e);
  console.warn("Missing required\x20method: addEvent");
}
.removeEvent(..._0x3d3202){
  _0x3532b5={
    _0x3904f3:0xc8,_0x3d6b20:0x1ef,_0x1aa00e:0x514},_0x2e2bf5={
    _0x3b3858:0xc1,_0x58fb1a:0x159}
  ;
  console.log("removeEvent",..._0x3d3202);
  console.warn("Missing required method: "+("removeEvent"));
}
async._getChatMessage({roomKey:_0x5f5668,local:_0x11cf6c,snapshot:_0x3a4853,blobsSnapshot:_0x3b2222,files:_0x29d765},_0x158236){
  async function _0x115d16(){
    const _0x43ab3d=decodeChatRangeOptions(_0x5f5668,{'gte':_0x158236,'lte':_0x158236});
    return await _0x3a4853.findOne("@keet/chat",_0x43ab3d);
  }
return(await getChatMessages(_0x115d16,_0x5f5668,_0x11cf6c,_0x3a4853,_0x3b2222,_0x29d765))[0x0];
}
async._getChatMessageById({roomKey:_0x193c44,local:_0x1dbcf9,snapshot:_0x20697f,blobsSnapshot:_0x5b94cd,files:_0x4cf1c9},_0xb2ece3){
  _0x3aa8d2={
    _0x4ca4a7:0x1d7}
  ;
  async function _0x3f4aff(){
    return await _0x20697f.get("@keet/chat-by-message-id",{'oplog':decodeMessageId(_0xb2ece3)});
  }
return(await getChatMessages(_0x3f4aff,_0x193c44,_0x1dbcf9,_0x20697f,_0x5b94cd,_0x4cf1c9))[-0x1b7c];
}
async._getChatMessages({roomKey:_0x517723,local:_0x1920b4,snapshot:_0x500fdc,blobsSnapshot:_0x3a0f8e,files:_0x13dfba},_0x4029c4){
  _0x4b0d0c={
    _0x1d4e15:0x241}
  ;
  async function _0x44c6d2(){
    _0x2603ec=decodeChatRangeOptions(_0x517723,_0x4029c4);
    return await _0x500fdc.find("@keet/chat",_0x2603ec).toArray();
  }
const _0x5e209b=await getChatMessages(_0x44c6d2,_0x517723,_0x1920b4,_0x500fdc,_0x3a0f8e,_0x13dfba);
return _0x5e209b;
}
async._getPinnedChatMessages({roomKey:_0x4680a3,local:_0x5004c9,snapshot:_0x18a45e,blobsSnapshot:_0x263ec1,files:_0x4af355},_0x36127f){
  _0x2d3248={
    _0x1679c4:0x37a}
  ;
  async function _0x2c891b(){
    return await _0x18a45e.find("@keet/pinned-chat-messages",_0x36127f).toArray();
  }
return await getChatMessages(_0x2c891b,_0x4680a3,_0x5004c9,_0x18a45e,_0x263ec1,_0x4af355);
}
async._getChatLength({db:_0x5c206e}){
  _0x4dcddc={
    _0x1c7474:0x1b5},_0x5b1272={
    _0x54cad5:0x1ee,_0x3744fe:0x45b}
  ;
  const _0x1546f7=await _0x5c206e.get("@keet/threads",{'id':0x0});
  return{
    'length':_0x1546f7?_0x1546f7.count:0x0}
  ;
}
.subscribeChatMessages(_0x183c81,..._0x3d3a8d){
  _0x9c8a3d={
    _0x220e95:0x23a},_0x237b3f={
    _0x40ce6d:0x1a6,_0x39f298:0x185}
  ;
  return this._addRoomSubscription(_0x183c81,{'query':()=>this.getChatMessages(_0x183c81,..._0x3d3a8d)});
}
.subscribeChatLength(_0x1cf39f,_0x151c4c){
  _0x5f0c24={
    _0x599e01:0x103,_0xfa426e:0x144,_0x557fed:0x15b},_0x199981={
    _0x1471a1:0x16f,_0x1954ca:0x1b6,_0x50c201:0x3e},_0x5dd298={
    _0x377188:0x2a3,_0x368e34:0x1f8,_0x103b1e:0x12d,_0x161a32:0x98,_0x88fc3a:0x2bc,_0x1ec287:0x4cf,_0x5e4406:0x2e5,_0x5f372a:0x1c5,_0x4ee1fd:0x1c3,_0x421783:0xe8,_0x269fc3:0x73,_0x53d48a:0xef,_0x4355c3:0xd5,_0x3ceabd:0x1a5,_0x4f733b:0x235,_0xf10bee:0x10d,_0x41b5e7:0x438,_0x8625cb:0x396,_0x98a34f:0x319,_0x3e52c8:0x124,_0xc6cf88:0x4f0,_0x123395:0x253,_0x2a3d27:0x56d,_0x468e17:0x2ba,_0xedd72f:0x13b,_0x6b8f6a:0x52,_0x5313cf:0x79,_0x2e5686:0x2d2,_0x3c6a90:0x30e,_0x484671:0x2aa,_0x14ac66:0x35c,_0x98c7a:0xd7,_0x1327eb:0x1dc,_0x3efd6c:0x23e,_0x347bae:0x3d2,_0x59a217:0x21f,_0x6c0524:0x2f7,_0x304c73:0x29b,_0x32ed1b:0xb0,_0x6a4a94:0x30}
  ;
  let _0x3ecafc=0x0;
  const _0x406380=async()=>{
    if(!_0x151c4c||!_0x151c4c.reorders)return this.getChatLength(_0x1cf39f);
    if(this.keet.closing)return null;
    const _0x46ff81=this.keet.internalOpenExistingRoom(_0x1cf39f);
    try{
      const {
        length:_0x316820}
      =await this.getChatLength(_0x1cf39f),_0x5a708b=_0x46ff81.base.view.core.fork!==_0x3ecafc;
      return _0x3ecafc=_0x46ff81.base.view.core.fork,{
        'length':_0x316820,'reordered':_0x5a708b}
      ;
    }finally{
    this.keet.internalReleaseRoom(_0x46ff81);
  }
}
;
return this._addRoomSubscription(_0x1cf39f,{'query':_0x406380});
}
async._searchChatMessages({snapshot:_0x258199,roomKey:_0xe583c3,local:_0x548b62,blobsSnapshot:_0x5430ce,files:_0x16aa5b},_0x4683a4,{limit:limit=0x3e8,reverse:reverse=!![]}={}){
  _0x4a5a1f={
    _0x35ddd1:0xde,_0x4dd159:0x251},_0x3e00c9={
    _0x3098d6:0x28f}
  ;
  if(!_0x4683a4||!_0x4683a4.length)return[];
  const _0x41e4f9=await _0x548b62.get("@local/rooms",{'roomKey':_0xe583c3});
  if(!_0x41e4f9)return[];
  _0x4683a4=_0x4683a4.map(_0x4cfe1f=>_0x4cfe1f.replace(/\s/g,'').toLowerCase()).filter(_0x4c30f4=>_0x4c30f4);
  if(!_0x4683a4.length)return[];
  const _0xc894cd=[];
  for await(const _0x262aef of _0x258199.find("@keet/chat",{'limit':limit,'reverse':reverse})){
    if(!_0x262aef.message?..text)continue;
    const _0x20903f=_0x262aef.message.text.replace(/\s/g,'').toLowerCase();
    if(_0x4683a4.every(_0x51834f=>_0x20903f.indexOf(_0x51834f)>-(-0x47b3))){
      const _0x537b2b=getChatMessage(_0xe583c3,_0x258199,_0x5430ce,_0x41e4f9,_0x16aa5b,_0x262aef);
      _0x537b2b.catch(safetyCatch),_0xc894cd.push(_0x537b2b);
    }
}
return Promise.all(_0xc894cd);
}
.createChatSearchStream(_0x2d9a3a,_0x23d52c,_0x105a0a){
  _0x2902cb={
    _0x3c44e6:0x8,_0x2a7c83:0x1b2},_0x396d75={
    _0xd4b775:0xd1}
  ;
  return Readable.from(this._createChatSearchGenerator(_0x2d9a3a,_0x23d52c,_0x105a0a));
}
async*._createChatSearchGenerator(_0x2403ef,_0x52dc35,{limit:limit=0x3e8,reverse:reverse=!![]}={}){
  _0x542cee={
    _0x4231c5:0x425,_0x444ad6:0x4cb,_0x338477:0x59a,_0x591777:0x336,_0x267c86:0x322,_0x2529f0:0x40c,_0x3c12e0:0x1d8,_0x59a12c:0x359,_0x494b1a:0x503,_0x894fc0:0x284,_0x17f256:0x461,_0x48260f:0xdc,_0x4445aa:0x247,_0x3ba86b:0x2da,_0x3b19a3:0x3c2,_0x1f4a06:0x3b2,_0x2198d8:0x567,_0x5f834b:0x3d4,_0x16c2a2:0x3d2,_0x42a6e1:0x805,_0x42e75c:0x5a4,_0x14a043:0x283,_0x24bed4:0x200,_0x2a5872:0x675,_0xb7ac5d:0x4a5,_0x139653:0x3bd,_0x588c30:0x698,_0x52b676:0x6b9,_0x1b53fd:0x687,_0x555156:0x7eb,_0x3fb248:0x494,_0x4f74d6:0x350,_0x5df81f:0x2b0,_0x2dbb83:0x3a4,_0x18975e:0x51c,_0x4f03e5:0x931,_0xe3270:0x681,_0x13d329:0x4d4,_0x4224bd:0x368,_0x68c225:0x705,_0xc26e51:0x769,_0x318f8c:0x390,_0x49b8f9:0x4a8,_0x18f742:0x56e,_0x4c3d2c:0x387,_0x45db22:0x3e7,_0x53d88b:0x367,_0xffa25b:0x471,_0x318af4:0x423,_0x2e5514:0x5bb,_0x158aca:0x67e,_0x281a46:0x367,_0x2d8655:0x5ad,_0x2a5547:0x48f,_0x2271c1:0x60a},_0xd8ed9b={
    _0x27e4f5:0x136,_0x3489a3:0x483,_0x1b43ad:0x1d1},_0x3e3197={
    _0x168f95:0x163,_0x4b805a:0x1b8,_0x395639:0x4f9}
  ;
  if(!_0x52dc35||!_0x52dc35.length)return;
  _0x52dc35=_0x52dc35.map(_0x4c96a3=>_0x4c96a3.replace(/\s/g,'').toLowerCase()).filter(_0x5cc4dc=>_0x5cc4dc);
  if(!_0x52dc35.length)return;
  const _0x16ee6d=HypercoreId.decode(_0x2403ef),_0x1d2082=await this.keet.local.get("@local/rooms",{'roomKey':_0x16ee6d});
  if(!_0x1d2082)return;
  const _0x4b8d5e=this.keet.internalOpenExistingRoom(_0x16ee6d);
  await _0x4b8d5e.ready();
  const _0x3f3e43=_0x4b8d5e.db.snapshot(),_0x2c3e1d=_0x4b8d5e.blobs.snapshot(),_0x4260c6=this.keet.local.snapshot(),_0x2a74b0=this.keet.files,_0x33253f=_0x3f3e43.find("@keet/chat",{'limit':limit,'reverse':reverse});
  try{
    for await(const _0x160a37 of _0x33253f){
      const _0x5a9ed5=await _0x5c46be(_0x160a37);
      if(!_0x5a9ed5)continue;
      yield _0x5a9ed5;
    }
}catch(_0x3c4521){
this.keet.onerror(_0x3c4521);
}finally{
await _0x4260c6.close(),await _0x3f3e43.close(),await _0x2c3e1d.close(),this.keet.internalReleaseRoom(_0x4b8d5e);
}
async function _0x5c46be(_0x412627){
  _0x13f02b={
    _0x25f25d:0x4da,_0x588ed9:0x77}
  ;
  if(!_0x412627.message?..text)return;
  const _0x29a6b9=_0x412627.message.text.replace(/\s/g,'').toLowerCase();
  if(!_0x52dc35.every(_0x14b73d=>_0x29a6b9.indexOf(_0x14b73d)>-(0x1)))return;
  const _0x214c17=await getChatMessage(_0x16ee6d,_0x3f3e43,_0x2c3e1d,_0x1d2082,_0x2a74b0,_0x412627);
  if(_0x214c17.labels.flagged||_0x214c17.labels.flags>=CHAT_MESSAGE_REPORT_COUNT)return;
  const _0x2a15af=HypercoreId.decode(_0x214c17.memberId),_0x51205b=await _0x4260c6.get("@local/blocked-contacts",{'memberKey':_0x2a15af});
  if(_0x51205b)return;
  const _0x3f5907=await _0x3f3e43.get("@keet/muted-members",{'key':_0x2a15af});
  if(_0x3f5907)return;
  const _0x14330c=_0x214c17.reactions.digest.reactions.find(_0x35627a=>_0x35627a.text==='⚠️');
  if(_0x14330c)return;
  return _0x214c17;
}
}
._sendDMFromContact(_0x335b48,{message:message=null}={}){
  _0x88c353={
    _0x20df77:0x126,_0x43eefb:0x1b7},_0x5df438={
    _0x4d1dc2:0x18a,_0x15de82:0x42b}
  ;
  return this.keet.sendContactRequestFromContact(_0x335b48,{'message':message});
}
._sendDMRequest(_0x1db5ca,_0x3829e9,{message:message=null}={}){
  _0xf68c1b={
    _0x186d39:0xbb,_0x5bfb0f:0x2ba},_0x3950b0={
    _0x2f2d73:0x1d1}
  ;
  return this.sendInvitations(_0x1db5ca,{'receivers':[_0x3829e9],'message':message});
}
async._sendInvitations(_0x197c51,{receivers:_0xcd786e,message:_0x5f447f}){
  _0x585ed9={
    _0x1a2327:0xcc,_0x57cf4e:0x9d},_0x1d8153={
    _0x24d883:0x6f,_0x3d72cf:0xf8},_0x547c2c=HypercoreId.decode(_0x197c51);
  const _0x18a5a0=Array.isArray(_0xcd786e)?_0xcd786e[0x0]:_0xcd786e;
  const _0x5de8bd=HypercoreId.decode(_0x18a5a0);
  await this.keet.sendContactRequest(_0x547c2c,_0x5de8bd,{'message':_0x5f447f});
}
async._updatePrivateMailboxRecord({memberId:_0x3a90b2,roomId:_0x36c128},_0x1df64e={}){
  _0x4247da={
    _0x2356fd:0x70},_0x3235d8={
    _0x235ce2:0x27,_0x2647fe:0x10c,_0x369264:0x113}
  ;
  const _0x50d307=_0x1df64e.isSeen||_0x1df64e.seen===-0x2a47;
  return this.keet.privateProfile.dispatch("@keet-private-id/update-contact-request-status",{'memberKey':HypercoreId.decode(_0x3a90b2),'roomKey':HypercoreId.decode(_0x36c128),'key':ContactRequestStatus.IsSeen,'status':{'isSeen':_0x50d307}});
}
async._getDmRequestsByStatus({profileDb:_0x14f2f2},_0x5067ea,{reverse:reverse=!![]}={}){
  _0x55ec7e={
    _0x55b0ec:0x132,_0x367c0b:0x4f2},_0x52a433={
    _0x52aa1b:0x1be,_0x31ba5e:0xd}
  ;
  if(!_0x14f2f2)return[];
  const _0x241226={
    [DM_STATUSES.ACCEPTED]:"@keet-private-id/accepted-contact-requests-v2",[DM_STATUSES.REJECTED]:"@keet-private-id/rejected-contact-requests-v2",[DM_STATUSES.PENDING]:"@keet-private-id/pending-contact-requests-v2",[DM_STATUSES.DISCARDED]:"@keet-private-id/discarded-contact-requests-v2"},_0x26e69f=_0x241226[_0x5067ea]||"@keet-private-id/pending-contact-requests-v2",_0x5460bd=await _0x14f2f2.find(_0x26e69f,{'reverse':reverse}).toArray();
  return _0x5460bd.map(encodeDmRequest);
}
.subscribeDmRequestsByStatus(_0x1ec074,_0x5b75ca={}){
  _0x524e30={
    _0x31741e:0xa6,_0xbf927c:0xfb},_0xfcb346={
    _0x26fb00:0x15f,_0x274c0d:0x361,_0x50d546:0x140}
  ;
  return this._addRoomSubscription(PROFILE_SUB_ID,{'query':()=>this.getDmRequestsByStatus(_0x1ec074,_0x5b75ca)});
}
async._getPrivateMailboxRecords({profile:_0x1ffe0e},_0x35ca96={}){
  _0x5d737b={
    _0x3e2c40:0x5c,_0x5a1405:0x15a,_0x51ef0e:0x507},_0x5e2ff2={
    _0x150615:0x19,_0x3465da:0xc9,_0x323109:0x101}
  ;
  console.warn("Deprecated: getPrivateMailboxRecords");
}
.subscribePrivateMailbox(){
  _0xa22a77={
    _0x1f1379:0xcd},_0x1b5d24={
    _0x18e147:0x1ce,_0x40fbe2:0x21e}
  ;
  console.warn("Deprecated: subscribePrivateMailbox");
  return new Readable();
}
.getSentPrivateMailboxRecords(..._0x138623){
  _0x33b29d={
    _0x1e8f6b:0x100,_0x61249d:0x24,_0x18211b:0xbb},_0x5b3ea8={
    _0x19db1c:0x173,_0x2b9cf6:0x24f}
  ;
  console.warn("Deprecated: getSentPrivateMailboxRecords");
}
.subscribeSentPrivateMailbox(..._0x4f585b){
  _0xd4f029={
    _0x46712c:0x613},_0x9feae3={
    _0x326e4e:0x1ad,_0x29b0fb:0x10,_0x9e8302:0x17c}
  ;
  return console.warn("Deprecated: subscribeSentPrivateMailbox"),new Readable();
}
async._getDmByMemberId({profileSnapshot:_0xa38ac5},_0x30b217){
  _0xbaa320={
    _0x282acb:0x28,_0xd7801c:0x1da},_0x6ae8c7={
    _0x593f7d:0x8c,_0x2175ed:0x242},_0x3f2704=HypercoreId.decode(_0x30b217),[_0x2ec606,_0x59fce8]=await Promise.all([_0xa38ac5.get("@keet-private-id/contacts",{'memberKey':_0x3f2704}),_0xa38ac5.get("@keet-private-id/contact-requests",{'memberKey':_0x3f2704})]);
  let _0x1f4454=null;
  if(_0x2ec606&&_0x2ec606.roomKey)_0x1f4454=_0x2ec606.roomKey;
  else _0x59fce8&&(_0x1f4454=_0x59fce8.keys.key);
  return{
    'roomId':_0x1f4454?HypercoreId.encode(_0x1f4454):null,'discoveryId':_0x1f4454?HypercoreId.encode(crypto.discoveryKey(_0x1f4454)):null,'dmMemberId':_0x30b217,'recipient':_0x30b217}
  ;
}
async.updateRoomInvitationSeenStatus({discoveryId:_0x57995c,invitationId:_0x24f821},_0x396956){
  _0x81eef1={
    _0x3f02ac:0x171,_0x35508f:0x280},_0x111831={
    _0x3dd27f:0x43,_0x2a3818:0x97}
  ;
  return this.keet.updateRoomInvitationSeenStatus(HypercoreId.decode(_0x57995c),HypercoreId.decode(_0x24f821),_0x396956);
}
async._acceptDmRequest({memberId:_0x7dbf7,roomId:_0x105289}){
  _0x269159={
    _0x955c29:0x110},_0x19d4bf={
    _0x481a06:0x123,_0x4bbce5:0x11d,_0x5c72b7:0x19c}
  ;
  return this.keet.privateProfile.dispatch("@keet-private-id/update-contact-request-status",{'memberKey':HypercoreId.decode(_0x7dbf7),'roomKey':HypercoreId.decode(_0x105289),'key':ContactRequestStatus.IsAccepted,'status':{'isAccepted':!![]}});
}
async._rejectDmRequest({memberId:_0x1427f7,roomId:_0x240c36}){
  _0x2f4ca2={
    _0x123dcf:0x12,_0x1a8998:0x2c2,_0x18503b:0x1ec},_0x31378d={
    _0x311d2e:0x2e,_0x3e8374:0x46,_0x3db669:0x1ec}
  ;
  return this.keet.privateProfile.dispatch("@keet-private-id/update-contact-request-status",{'memberKey':HypercoreId.decode(_0x1427f7),'roomKey':HypercoreId.decode(_0x240c36),'key':ContactRequestStatus.IsRejected,'status':{'isRejected':!![]}});
}
async.discardDmRequest({memberId:_0x5e2f78,roomId:_0x280ab5}){
  _0x51e1a4={
    _0x1a0b9a:0x92,_0x38e483:0x1ce,_0x405950:0x17e},_0x1ac6f7={
    _0x2eb7c6:0x122,_0x333ee5:0x74}
  ;
  return this.keet.privateProfile.dispatch("@keet-private-id/update-contact-request-status",{'memberKey':HypercoreId.decode(_0x5e2f78),'roomKey':HypercoreId.decode(_0x280ab5),'key':ContactRequestStatus.IsDiscarded,'status':{'isDiscarded':!![]}});
}
._addReaction(_0x3441f3,_0x125f81,_0x43f8aa){
  _0x17b320={
    _0x4dea72:0x150,_0x35402f:0x1ad,_0x3caa60:0x339},_0x2593d4={
    _0x14e16c:0xd8,_0x53d90a:0x1a6}
  ;
  return this.keet.dispatch(_0x3441f3,"@keet/add-reaction",{'oplog':{'key':HypercoreId.decode(_0x125f81.deviceId),'seq':_0x125f81.seq},'reaction':_0x43f8aa});
}
._removeReaction(_0x2df027,_0x4cea44,_0x2c603f){
  _0x35b245={
    _0x4434d4:0x3f},_0x279631={
    _0x569221:0x1a2,_0x13860d:0xe0}
  ;
  return this.keet.dispatch(_0x2df027,"@keet/remove-reaction",{'oplog':{'key':HypercoreId.decode(_0x4cea44.deviceId),'seq':_0x4cea44.seq},'reaction':_0x2c603f});
}
async._getLatestReactions({snapshot:_0x293839},_0x2cce15,_0x11ffd7,{limit:_0x52a1f6}={}){
  _0x4473a8={
    _0x13e7cf:0x266},_0x1ef04a={
    _0x32dfa4:0x12f,_0x15b20b:0x5a1},{
    id:_0x1fb9b9}
  =await _0x293839.get("@keet/chat-by-message-id",{'oplog':decodeMessageId(_0x2cce15)}),_0xe6c192=await _0x293839.find("@keet/reactions-by-clock",{'gte':{'id':_0x1fb9b9,'reaction':_0x11ffd7},'lte':{'id':_0x1fb9b9,'reaction':_0x11ffd7},'limit':_0x52a1f6,'reverse':!![]}).toArray();
  return _0xe6c192.map(_0x30a16f=>encodeReaction(_0x30a16f));
}
async._getReactions({roomKey:_0x2ddc4d,snapshot:_0x4eda10,local:_0x1513fb},_0x36ac9e){
  const _0x8cacef=decodeMessageId(_0x36ac9e);
  return getReactions({'roomKey':_0x2ddc4d,'snapshot':_0x4eda10,'local':_0x1513fb,'oplog':_0x8cacef});
}
.subscribeReactions(_0x1caaf8,_0x103fc4){
  _0x5279b8={
    _0x476d6f:0x1b3,_0x56d6b0:0x308,_0x4a17ef:0x1f3},_0xf665fb={
    _0x1817c3:0xfc,_0x5b0fbf:0x1e4}
  ;
  return this._addRoomSubscription(_0x1caaf8,{'query':()=>this.getReactions(_0x1caaf8,_0x103fc4)});
}
.subscribeReportedMessages(_0x33b481,..._0x3ce34c){
  _0x4ffa10={
    _0x546a68:0x33,_0x190041:0x1dc},_0x4f1b36={
    _0x4f21b7:0x1c1,_0x146f2b:0x180}
  ;
  return this._addRoomSubscription(_0x33b481,{'query':()=>this.getReportedMessages(_0x33b481,..._0x3ce34c)});
}
.subscribeReportedMembers(_0x398883,..._0x320e02){
  _0x1aaa94={
    _0x423db4:0x109,_0x120b95:0x11c},_0x1c9639={
    _0x23a216:0x1c0}
  ;
  return this._addRoomSubscription(_0x398883,{'query':()=>this.getReportedMembers(_0x398883,..._0x320e02)});
}
async._getReportedMembers({snapshot:_0x5cf778,blobsSnapshot:_0x40c78e},{clock:_0x1f1cdd,limit:limit=0x32}={}){
  _0x5caf6f={
    _0x114ec4:0x3ad,_0x41c5c3:0x275,_0x2e524b:0x1d5,_0x24ff6b:0xa7,_0x51fd89:0x64,_0x37e0d3:0x5c6,_0x42868f:0x798,_0x15989e:0x4a3,_0x49edc4:0x6f9},_0x25d8aa={
    _0x2a40fd:0x10e,_0x227e4c:0x47b,_0x1a5027:0x154},_0x3229ed={
    _0x3ab191:0x12d,_0x682380:0x153,_0x53896a:0x46c},_0x3d496d=await _0x5cf778.find("@keet/member-label-digests-by-clock",{'gte':{'label':MemberLabel.Flag},'lte':{'label':MemberLabel.Flag,'clock':_0x1f1cdd},'limit':limit<=0x32?limit:-0x4954,'reverse':!![]});
  const _0x503e15=[];
  for await(const _0x312530 of _0x3d496d){
    const _0x9fe47b=_0x2f0050.bind(this);
    _0x503e15.push(_0x9fe47b(_0x312530));
  }
return await Promise.all(_0x503e15);
async function _0x2f0050(_0x1ea207){
  const {
    key:_0x28e103,total:_0x150ed8,flagsClock:_0x46fa20}
  =_0x1ea207,_0x4b3989=await this._getMember({'snapshot':_0x5cf778,'blobsSnapshot':_0x40c78e},HypercoreId.encode(_0x28e103));
  return _0x4b3989.labels={
    'total':_0x150ed8,'flagsClock':_0x46fa20},_0x4b3989;
}
}
.reportMember(_0x505932,_0x13debd){
  _0x53f1b7={
    _0x1263bc:0xbb,_0x405d65:0x237,_0x497c71:0x110},_0x5ca519={
    _0x3b92c9:0x169,_0x24278d:0x16d}
  ;
  return this.keet.dispatch(_0x505932,"@keet/add-member-label",{'key':HypercoreId.decode(_0x13debd),'label':MemberLabel.Flag});
}
async._getReportedMessages({roomKey:_0x5ca46e,local:_0x103980,snapshot:_0x3984dd,blobsSnapshot:_0x481e6b,files:_0x54f9fb},{clock:_0x51e556,limit:limit=0x32}={}){
  _0xe1f504={
    _0x2e66a0:0x1a1,_0x176f4f:0x126,_0x1a463d:0x1f2},_0x400e88={
    _0x2fa3b0:0x138,_0x52fc6b:0x39c}
  ;
  const _0x1cf448=await _0x103980.get("@local/rooms",{'roomKey':_0x5ca46e});
  if(!_0x1cf448)return;
  const _0x3458d1=await _0x3984dd.find("@keet/chat-label-digests-by-clock",{'gte':{'label':Label.Flag},'lte':{'label':Label.Flag,'clock':_0x51e556},'limit':limit<=-0x4966?limit:--0x1996,'reverse':!![]});
  const _0x1babc4=[];
  for await(const {id:_0xa5b57}of _0x3458d1)_0x1babc4.push(_0x342e08(_0xa5b57));
  return await Promise.all(_0x1babc4);
  async function _0x342e08(_0x483057){
    const _0x562e98=await _0x3984dd.findOne('@keet/chat',{'gte':{'id':_0x483057},'lte':{'id':_0x483057}});
    return getChatMessage(_0x5ca46e,_0x3984dd,_0x481e6b,_0x1cf448,_0x54f9fb,_0x562e98);
  }
}
._addChatReport(_0x4e29ef,_0x2174eb){
  _0x37c25d={
    _0x20345c:0x11,_0x142916:0x6b,_0x59cb9b:0x455}
  ;
  const _0x42baaa=decodeMessageId(_0x2174eb);
  return this.keet.dispatch(_0x4e29ef,"@keet/add-chat-label",{'oplog':_0x42baaa,'label':Label.Flag});
}
._removeChatReport(_0x11a14d,_0x3acb84){
  _0x648051={
    _0x5aa975:0x24,_0x26a928:0x3eb},_0x552b3d={
    _0x1200f6:0x7,_0x306399:0x525,_0x45d0d0:0x96}
  ;
  const _0x1d9715=decodeMessageId(_0x3acb84);
  return this.keet.dispatch(_0x11a14d,"@keet/remove-chat-label",{'oplog':_0x1d9715,'label':Label.Flag});
}
.addFileBlob(..._0x424490){
  _0x3e2941={
    _0x41ca3e:0x3c3,_0xfa9439:0x132},_0x446a37={
    _0x16e0d2:0x151}
  ;
  console.log("addFileBlob",..._0x424490);
  throw new Error("Missing required method: "+("addFileBlob"));
}
.addFile(..._0x317294){
  _0x56935b={
    _0x1a4924:0x2c,_0x2a68b3:0x196},_0x28be2d={
    _0x245f51:0x148,_0x3c7688:0x26b,_0x7ede07:0x175}
  ;
  console.log("addFile",..._0x317294);
  throw new Error("Missing\x20required method:\x20addFile");
}
async._saveFileBlob({roomKey:_0x1de41c,files:_0x241504},_0x27f089,_0x2eb692){
  _0x125cec={
    _0x1b5183:0xe5,_0x26bf23:0x174},_0x1d64cc=await _0x241504.saveFileBlob(_0x1de41c,_0x27f089,_0x2eb692);
  return encodeFile(_0x1d64cc);
}
async._saveFile({roomKey:_0x5cf808,files:_0x2cb7a0},_0x3a0d3d,_0x23ce80){
  _0x359d18={
    _0x513a7c:0x1d9}
  ;
  const _0x39654c=await _0x2cb7a0.saveFile(_0x5cf808,_0x3a0d3d,_0x23ce80);
  return encodeFile(_0x39654c);
}
.subscribeAddFile(_0x4f4106,_0x49be68,_0x50e953){
  _0x328930={
    _0x1671a1:0x1e2,_0x5190bf:0x38a},_0x6d8143={
    _0x262e83:0x66,_0x5f1d05:0x3b},_0x51fda1={
    _0x502731:0x1a4,_0x22ce01:0x3b}
  ;
  const _0x393c32=HypercoreId.decode(_0x4f4106);
  return pipeline(this.keet.files.subscribeAddFile(_0x393c32,_0x49be68,_0x50e953),new Transform({'transform'(_0x7e4d64,_0x317c7c){_0x317c7c(null,{..._0x7e4d64,'result':encodeFile(_0x7e4d64.result)});}}));
}
async._sendFile(_0x423e25,_0x1ef28f){
  _0x45357b={
    _0x338ab5:0x16f,_0x5af9cb:0x480,_0x491e61:0x1df},_0x861589={
    _0x8a6bfa:0x53,_0x1587fe:0x8a,_0xf29867:0x56e}
  ;
  const _0x2908c3=_0x1ef28f.preview;
  _0x1ef28f.preview=null;
  const _0x564edf=this.keet.batch(_0x423e25),_0x54fc5e=await _0x564edf.dispatch("@keet/add-chat-message",{'timestamp':Date.now(),'message':decodeChatMessage(null,{'files':[_0x1ef28f]})});
  if(_0x54fc5e===--0x4d02)return;
  _0x2908c3&&await _0x564edf.dispatch("@keet/add-file-preview",{'oplog':{'key':_0x564edf.key,'seq':_0x54fc5e-(0x1)},'index':0x0,'preview':decodeImageFile(_0x2908c3)},{'dryRun':![]}),await _0x564edf.flush();
}
async._sendFiles(_0x4352f5,_0x2077fe=[]){
  _0x43d61f={
    _0x262a5c:0x50,_0x1a7b84:0x3b},_0x25d5a9={
    _0x41477b:0x50,_0x35b1d8:0x103,_0x21034a:0x248},_0x4180c8=[];
  for(const _0x47bcd2 of _0x2077fe){
    _0x4180c8.push(_0x47bcd2.preview),_0x47bcd2.preview=null;
  }
const _0x2de558=this.keet.batch(_0x4352f5),_0x136844=await _0x2de558.dispatch("@keet/add-chat-message",{'timestamp':Date.now(),'message':decodeChatMessage(null,{'files':_0x2077fe})});
if(_0x136844===0x0)return;
const _0x5a4032={
  'key':_0x2de558.key,'seq':_0x136844-(--0x72d)}
;
for(let _0x1846c0=-0x318a;_0x1846c0<_0x4180c8.length;_0x1846c0++){
  const _0xefd4cd=_0x4180c8[_0x1846c0];
  if(!_0xefd4cd)continue;
  await _0x2de558.dispatch("@keet/add-file-preview",{'oplog':_0x5a4032,'index':_0x1846c0,'preview':decodeImageFile(_0xefd4cd)},{'dryRun':![]});
}
await _0x2de558.flush();
}
.removeFile(..._0x53c056){
  _0x5a3c26={
    _0x25be19:0x3c,_0x2bd93b:0x185},_0x580071={
    _0x3b3e63:0x190,_0x12e6f5:0x4dd}
  ;
  console.log("removeFile",..._0x53c056);
  throw new Error("Missing required method: removeFile");
}
.subscribeFileInfo(_0xf27948,_0x4ba3ad){
  _0x24cf19={
    _0xf396b7:0x6d6,_0x1edc0f:0x588},_0x167a6b={
    _0x236ae7:0x133,_0x3b0a5d:0x319},_0x3375bc={
    _0x24a9d6:0x4d4,_0x492d36:0x39b,_0x44163f:0x389,_0xa049de:0x503,_0x5a4f3f:0x4f0,_0x1cf794:0x5d2,_0x13fe66:0x26e,_0x4d61a6:0x522,_0x17636e:0x34a,_0x143272:0x338,_0x3b8719:0x5ce,_0x13006f:0x3d5},_0x54a538={
    _0x1a226c:0xde,_0x80bfd8:0x3d,_0x3b6c92:0x296}
  ;
  const _0x35ab21=HypercoreId.decode(_0xf27948),_0x4535aa=this;
  let _0x4b7cbe=null;
  return new Readable({async 'open'(_0x260e57){_0x777fc5={_0xca9291:0x7c,_0x1e5894:0xb0,_0x21d899:0xb3},_0x149175={_0x1a4d2a:0x1a8,_0x226fdb:0xf3};let _0xb589d2=null;try{_0x4b7cbe=await _0x4535aa.keet.files.monitor(_0x35ab21,decodeFile(_0x4ba3ad)),_0x4b7cbe.on("update",_0x22a650=>{this.push(_0x4b7cbe.stats);});}catch(_0x17a891){_0xb589d2=_0x17a891;}_0x260e57(_0xb589d2);},async 'destroy'(_0x5a6907){if(_0x4b7cbe)_0x4b7cbe.close();_0x5a6907(null);}});
}
async._clearAllFiles({roomId:_0x48d641,roomKey:_0x5060f9,files:_0x4d4b18},_0x1b42c1){
  _0x376eea={
    _0x353ec3:0xe9,_0x2e3b4d:0x182,_0x2b8812:0x10f},_0x14935e={
    _0x247f86:0xd9,_0x593b49:0x3,_0x2831a2:0x1c8},_0x336255=await _0x4d4b18.clearAllFiles(_0x5060f9,_0x1b42c1);
  this.keet.emit("local-files-changed",_0x48d641);
  return _0x336255;
}
async._getFileEntry({roomKey:_0xf83f33,files:_0x3e013c},_0x467818){
  _0x3172a8={
    _0x5d7c72:0x1ca,_0x4c2afc:0x4d,_0x5ef233:0x7b}
  ;
  const _0x13b488=await _0x3e013c.getFileEntry(_0xf83f33,decodeFile(_0x467818));
  return encodeFileEntry(_0x13b488);
}
async._getLocalFiles({roomKey:_0xf5f1ec,files:_0x33eb0b,blobsSnapshot:_0x2bbf25}){
  _0x592860={
    _0x40e331:0x479,_0x47e2a3:0x512,_0x38e630:0x38c,_0x462ef3:0x48a,_0x25bead:0x4da,_0x35f2b6:0x429,_0x3871b9:0x93f,_0x1ee4f4:0x905,_0x1e47f5:0x5ef,_0x11edea:0x7ab,_0x45f07a:0x434,_0x5033aa:0x3e9,_0x530ff2:0xea,_0x483a75:0x5d,_0x428b74:0x1a2,_0x203e5a:0x66},_0x357b86={
    _0x12ff2c:0x98,_0x2ef9e9:0x170,_0x595674:0x15c},_0x5f3bd2={
    _0x47d417:0x8b,_0x4c052d:0x15e,_0x19c1e2:0x80}
  ;
  const _0x1c5b8b=await _0x33eb0b.getLocalFiles(_0xf5f1ec);
  return Promise.all(_0x1c5b8b.map(async _0x549ccb=>{_0x4be070={_0x4ed042:0x4c,_0x354232:0x66,_0x5c5b00:0x7c},_0x4a51ac=await _0x33eb0b.getFileEntryWithPreview(_0xf5f1ec,_0x549ccb.file,{'loadBlob':_0x4287cb=>_0x2bbf25.get(_0x4287cb)});return{...encodeFile(_0x4a51ac.file),'entry':encodeFileEntry(_0x4a51ac)};}));
}
async._getFiles({roomKey:_0x4da9a7,files:_0x165440,snapshot:_0x3a95c9,blobsSnapshot:_0x576337},_0x50bc1b={}){
  _0x2ca4c6={
    _0x2da076:0x201,_0x3465bb:0x16b,_0x11f8f6:0x36d,_0x45854b:0x5e2,_0x8b0274:0x5c8,_0x1c23f1:0x711,_0x30e834:0x5e1,_0x182e35:0x4c6,_0x43263d:0x2d6,_0x1b5ed1:0x3d0,_0x290073:0x369,_0x168829:0x45c,_0x48a6ea:0x4c5,_0x52d2f5:0x60c,_0x30fad2:0x314,_0x529cec:0x311,_0x135d89:0x4e5,_0xce62de:0x87d,_0x3c52df:0x58c,_0x48f516:0x85e},_0x164bbb={
    _0x12b638:0x131,_0x40999c:0x197},_0x1c5d80={
    _0x26ccb0:0xcb,_0xd79ad4:0x1a3,_0xff1a86:0x3a4},_0x3be5b9={
    _0x4e7be4:0x113,_0x321988:0x15b,_0x32d1b5:0x97},_0x3455f1=decodeFileRangeOptions(_0x50bc1b);
  const _0xcc84da=await _0x3a95c9.find(_0x50bc1b.type?"@keet/files-by-major-type":"@keet/active-files",_0x3455f1).toArray();
  return Promise.all(_0xcc84da.map(async _0x998d35=>{const _0x533fc9=await _0x165440.getFileEntryWithPreview(_0x4da9a7,_0x998d35.file,{'loadBlob':_0x53bba2=>_0x576337.get(_0x53bba2)});return{...encodeFile(_0x533fc9.file),'id':_0x998d35.id,'messageId':{'deviceId':HypercoreId.encode(_0x998d35.oplog.key),'seq':_0x998d35.oplog.seq},'entry':encodeFileEntry(_0x533fc9)};}));
}
._startDownload({roomKey:_0x28cad5,files:_0xed3148},_0x3f4653){
  return _0xed3148.startDownload(_0x28cad5,decodeFile(_0x3f4653));
}
._cancelDownload({roomKey:_0x4845c5,files:_0x47d67f},_0x1c09d4){
  _0x1d9b9d={
    _0x29b38d:0x1a7,_0x5dc987:0x112,_0x165ebd:0xd1},_0xf4f9f1={
    _0x42b13a:0x43,_0x40f9c1:0x243,_0x517c31:0xe9}
  ;
  return _0x47d67f.cancelDownload(_0x4845c5,_0x1c09d4);
}
async._clearFile({roomId:_0x540b94,roomKey:_0x5c0f57,files:_0x1a4706},_0x10b836){
  _0x5cfa4d={
    _0x57a7cc:0x2c},_0x45a5eb={
    _0x5b46a5:0x11a,_0x536d4e:0xa7,_0x587f01:0x526}
  ;
  _0x10b836.preview?..large?..pointer?..externalBlob&&await _0x1a4706.clearFile(_0x5c0f57,decodeFile(_0x10b836.preview.large));
  await _0x1a4706.clearFile(_0x5c0f57,decodeFile(_0x10b836));
  this.keet.emit("local-files-changed",_0x540b94);
}
async._unclearFile({roomId:_0x1e527d,roomKey:_0x315d3f,files:_0xb713c2},_0x1db155){
  _0x157576={
    _0x5c6d29:0x3f,_0x313773:0xb1},_0x56ae9a={
    _0x4b00e7:0x15c,_0x5e6db0:0x1d1}
  ;
  _0x1db155.preview?..large?..pointer?..externalBlob&&await _0xb713c2.unclearFile(_0x315d3f,decodeFile(_0x1db155.preview.large));
  await _0xb713c2.unclearFile(_0x315d3f,decodeFile(_0x1db155));
  this.keet.emit("local-files-changed",_0x1e527d);
}
._getFileCleared({roomKey:_0x523a02,files:_0x3fdeb5},_0x19f8c7){
  return _0x3fdeb5.getFileCleared(_0x523a02,decodeFile(_0x19f8c7));
}
._refreshFileLinks(_0x113fd3){
  _0x5f0458={
    _0x2c49fc:0x4e,_0x57f6a6:0x106},_0x35fe1e={
    _0x54c6d9:0x6c,_0x29732f:0xb7,_0x561c42:0x14d}
  ;
  return this.keet.files.refreshLinks(_0x113fd3);
}
.subscribeFileCleared(_0x537f4a,_0x3b5750){
  _0x5631da={
    _0x23578e:0x321,_0x271389:0x12d},_0x3da5cd={
    _0x42b44b:0x13f,_0x398207:0x19d}
  ;
  return this._addRoomSubscription(_0x537f4a,{'query':()=>this.getFileCleared(_0x537f4a,_0x3b5750)});
}
.subscribeFiles(_0x580146,..._0x162efb){
  _0xc162a1={
    _0x2d7fd0:0x188,_0x260249:0x40,_0x34924f:0xed},_0x68423={
    _0x1a439e:0x1ea,_0x4d392b:0x1cb,_0x46a799:0xda}
  ;
  return this._addRoomSubscription(_0x580146,{'query':async()=>this.getFiles(_0x580146,..._0x162efb)});
}
.getStats(){
  _0x3eb782={
    _0x553ec2:0x1c9,_0x48b35e:0x327,_0xc91602:0xb2},_0x186d19={
    _0x35c0fc:0x79,_0x21393a:0x137}
  ;
  return{
    'suspended':this.keet.state===KeetState.SUSPEND,'connections':this.keet.swarm.connections.size,'openRooms':this.keet.rooms.size,'openCores':this.keet.store.cores.size,'activeRooms':this.keet.activeRooms.size,'roomSubscriptions':[...this._subscriptions.values()].filter(_0x1c2928=>_0x1c2928.isRoomSub).size,'backgroundSwarmingRooms':[...this.keet.swarmWorker.sessions.keys()],'dht':this.keet.swarm.dht.stats,'swarm':this.keet.swarm.stats,'ops':this.keet.stats.ops,'uploaded':this.keet.stats.uploaded,'bytesUploaded':this.keet.stats.bytesUploaded,'downloaded':this.keet.stats.downloaded,'bytesDownloaded':this.keet.stats.bytesDownloaded,'appends':this.keet.stats.appends,'bytesAppended':this.keet.stats.bytesAppended,'ipc':{
      'sent':0x0,'recv':0x0},'threads':[]}
  ;
}
async.getRoomStats(_0x280a11){
  _0x5237d1={
    _0x15c50a:0x17e,_0x420711:0x11a},_0x4c025f={
    _0x214749:0x136,_0x50e580:0x177,_0x5c76ea:0x8},_0x1a996f=this.keet.internalOpenExistingRoom(HypercoreId.decode(_0x280a11));
  try{
    const _0x154944=await _0x1a996f.getStats();
    return _0x154944;
  }finally{
  this.keet.internalReleaseRoom(_0x1a996f);
}
}
async._lookupUsername(_0x5e30cd){
  _0xe2182f={
    _0x1e4b4d:0x241},_0x291385={
    _0x50cee3:0x172,_0x3b2c8c:0x29e}
  ;
  if(!_0x5e30cd)return;
  const _0x2b2520=await this.keet.userRegistry.lookup(_0x5e30cd);
  return encodeUser(_0x2b2520);
}
async._lookupUserByMemberId(_0x268f0e){
  _0x53cd9b={
    _0x21c1de:0x175,_0x3fd25e:0x5f,_0x5a32db:0xb4},_0x422a2c={
    _0x33b079:0x1ec,_0x184c7e:0x1c9,_0x226237:0x157}
  ;
  if(!_0x268f0e)return;
  const _0x22dfc6=HypercoreId.decode(_0x268f0e);
  const _0x59c6ec=await this.keet.userRegistry.lookupByKey(_0x22dfc6);
  return encodeUser(_0x59c6ec);
}
async._searchUsername(_0x474fbb){
  _0x1368b4={
    _0x1e705d:0x175,_0xd47e3f:0xd6},_0x55de89={
    _0x33a54e:0x12c,_0x543149:0x1f0,_0xfcd7e6:0x34}
  ;
  const _0x433393=await this.keet.userRegistry.search(_0x474fbb);
  return _0x433393.map(encodeUser);
}
._registerUsername(_0x4bd8cb){
  _0x5aa53b={
    _0x17acb9:0x42},_0x2e038b={
    _0x25d01f:0x1e8,_0x1092a8:0x316,_0x57ea6b:0x145}
  ;
  return this.keet.userRegistry.update(_0x4bd8cb);
}
._updateUsername(_0x5d99ba){
  _0xed13e7={
    _0x197724:0x15a,_0x5a0de7:0x53,_0x13956b:0x4c0},_0x52a156={
    _0x3d28b5:0x1cc,_0x56a507:0x25}
  ;
  return this.keet.userRegistry.update(_0x5d99ba);
}
async._getReservationsByKey(_0x5d5d94){
  _0x2b8700={
    _0x35ac65:0x186,_0x3edddf:0x175,_0x5a5d34:0xfb}
  ;
  if(!_0x5d5d94)return;
  const _0x3cc151=HypercoreId.decode(_0x5d5d94),_0x3e6e78=await this.keet.userRegistry.getReservationsByKey(_0x3cc151);
  if(!_0x3e6e78||!_0x3e6e78.length)return null;
  const _0x154f7c=_0x3e6e78[-0x29b4];
  return encodeReservation(_0x154f7c);
}
.subscribeUsername(){
  _0x25e724={
    _0x490e2e:0x795,_0x528f1f:0x4d3,_0x332942:0x67f,_0x2aca8d:0x63e,_0xb8685f:0x70f},_0x2550ec={
    _0x179bf2:0xf8},_0x2bcdf6={
    _0x6e5180:0x12,_0x1868a8:0xe8,_0x267fe6:0x118},_0x36ed68={
    _0x191ae3:0x15b,_0x563123:0x28b},_0x4f458b=this.keet.userRegistry.subscribeUsername();
  return pipeline(_0x4f458b,new Transform({'transform'(_0x27df7f,_0x236d32){if(!_0x27df7f)return _0x236d32(null);_0x236d32(null,{'status':_0x27df7f.status,'reservation':encodeReservation(_0x27df7f.reservation),'record':encodeUser(_0x27df7f.record),'error':_0x27df7f.error});}}));
}
._checkUsername(_0x267a0f){
  _0x1aa716={
    _0x241ca2:0x3c,_0x5b894d:0x1bf,_0x672aa5:0x9c},_0x508cae={
    _0x32fe8a:0xda,_0xefa8b4:0x121,_0x3dbbe3:0x24d}
  ;
  return this.keet.userRegistry.isAvailable(_0x267a0f);
}
.subscribeSystemUpdateRequest(){
  _0x54d441={
    _0x3ba54b:0x190,_0x4131e2:0x137},_0x224081={
    _0x199d68:0x114,_0x14fb9a:0x1ab,_0x3061d1:0x193}
  ;
  return this._addKeetSubscription(MIGRATION_STATUS_SUB_ID,{'query':()=>this.keet.migrationStatus||{'remaining':0x0}});
}
.close(){
  _0x175aec={
    _0xf08e36:0xc1}
  ;
  return this.keet.close();
}
.suspend(){
  _0x587074={
    _0x3a00a5:0x196,_0x23fd96:0x1d8,_0x3e058b:0xba},_0x236bde={
    _0x4c05b7:0x54,_0x14fdc9:0x1,_0x50c338:0x3c}
  ;
  return this.keet.suspend();
}
.resume(){
  _0x31bbea={
    _0x2fe5a2:0x11c,_0x29fd96:0x1ab,_0x4a2a5d:0xa3},_0x2cf4e5={
    _0x5d25dc:0xcd,_0x5ecd6d:0x218}
  ;
  return this.keet.resume();
}
async.getDebugFlags(){
  _0x2cc2e4={
    _0x70c54:0x1a4,_0x1fd793:0xe0},_0x46a752={
    _0x243625:0x80,_0x4f538b:0x166,_0x30226d:0x5ee}
  ;
  const _0x483734=await this.keet.local.get("@local/debug");
  return _0x483734?..flags||[];
}
async.updateDebugFlag(_0x358e21,_0x5005dd){
  _0x2ac6f4={
    _0x50f7a9:0x167,_0x21f8e3:0x16},_0x544011={
    _0x36ce5c:0x22,_0xd88d20:0x154,_0xff734a:0x45}
  ;
  const _0x544d00=DEBUG_FLAG_INDEX_BY_KEY.get(_0x358e21);
  if(!(_0x544d00>=-0x43e8))return;
  const _0x5a0a35=await this.keet.internalEnterLocalTransaction();
  try{
    const _0x5b6759=await _0x5a0a35.get("@local/debug");
    _0x5b6759.flags[_0x544d00].value=_0x5005dd===!![],await _0x5a0a35.insert("@local/debug",_0x5b6759),await _0x5a0a35.flush();
  }finally{
  await this.keet.internalExitLocalTransaction();
}
}
.createErrorStream(){
  _0x2f8510={
    _0x5820e9:0x151,_0x314178:0x1c1,_0x2da2f4:0x579},_0x42f678={
    _0x1a8518:0x22}
  ;
  return pipeline(this.keet.local.find("@local/errors"),new Transform({'transform'(_0x100334,_0x559005){_0x559005(null,encodeErrorRecord(_0x100334));}}));
}
async._repair(_0x363cab){
  _0x4f2a1e={
    _0x4a3390:0x98,_0x4f22b1:0x163},_0x3865af={
    _0x48d62d:0x1ca,_0x1aceb8:0x9b,_0x1741db:0xcd}
  ;
  const _0x3e392c=this.keet.internalOpenExistingRoom(HypercoreId.decode(_0x363cab));
  try{
    await _0x3e392c.ready(),await _0x3e392c.base.repair();
  }finally{
  this.keet.internalReleaseRoom(_0x3e392c);
}
}
async._audit(_0x2451a1){
  _0x4d42fd={
    _0x5d87a3:0xa6,_0x4b6023:0x9e,_0x45b77d:0x1ed},_0x294758={
    _0x50e6f7:0x18b,_0x2c2bad:0x197,_0xd51474:0x2f7},_0xd3ca63=this.keet.rootCorestore.audit(_0x2451a1);
  const _0x42333a=[];
  for await(const _0x27c8c4 of _0xd3ca63){
    _0x42333a.push(_0x27c8c4);
  }
return _0x42333a;
}
async._rotateWriter(_0x39d89d){
  _0x3d66ec={
    _0x113d48:0xc,_0x5c3c93:0x6c},_0x4ffac3={
    _0x19c12e:0x45,_0x5f3a6c:0x1e2,_0x49a7f8:0x1c2}
  ;
  return this.keet.rotateWriter(HypercoreId.decode(_0x39d89d));
}
.compact(){
  _0x2a48cd={
    _0x3c8a6e:0x1c3,_0x4763ae:0x21,_0x215675:0xa3},_0x3d08a1={
    _0xa38c21:0x1eb,_0xb45ddd:0xb1}
  ;
  return this.keet.storage.compact();
}
async._setUnread(_0x276b9f,_0x467b9e){
  _0x1a7d89={
    _0xeb47e4:0x1b3,_0xf935e9:0x182,_0x1a2ad3:0x1fb},_0x516ad1={
    _0x6d7b07:0x1c5,_0x39d5a2:0x59f}
  ;
  const _0x3760c4=HypercoreId.decode(_0x276b9f),_0x394eac=await this.keet.internalEnterLocalTransaction();
  try{
    await _0x394eac.insert("@local/unreads",{'roomKey':_0x3760c4,'count':_0x467b9e}),await _0x394eac.flush();
  }finally{
  await this.keet.internalExitLocalTransaction();
}
}
async._getUnread(_0x12ff85){
  _0x1d629f={
    _0x793fb8:0x1bc,_0x22d083:0x250},_0x2d5c2c={
    _0x389b67:0xad,_0x45f01f:0xe0},_0xea3207=HypercoreId.decode(_0x12ff85),_0x325ace=await this.keet.local.get("@local/unreads",{'roomKey':_0xea3207});
  return _0x325ace?_0x325ace.count:0x0;
}
async._setUnreadAnchor(_0x2ab36e,_0x329b3e){
  _0x4958bb={
    _0x4ccddc:0x10},_0x440827={
    _0x1c36c5:0x47,_0x3ed29a:0xbd,_0x4bc732:0x18b},_0x1ecedf=HypercoreId.decode(_0x2ab36e);
  await this.keet.internalEnsureUnreads();
  if(this.keet.unreads)await this.keet.unreads.put(_0x1ecedf,{'timestamp':Date.now(),'length':_0x329b3e});
  const _0x16d4f3=await this.keet.local.get("@local/rooms",{'roomKey':_0x1ecedf});
  if(!_0x16d4f3?..dm?..length)return;
  const {
    isFeatureSupported:_0x3f98e5,FEATURES:_0x39fb9b}
  =this.keet.versions;
  if(!_0x3f98e5(_0x16d4f3.digest.abi.version,_0x39fb9b.READ_LENGTH))return;
  const _0x4d82f7=await this.keet.internalOpenPrivateProfile();
  try{
    const _0x4a8d48=await _0x4d82f7.db.get("@keet-private-id/settings");
    if(_0x4a8d48?..disableReadReceipts)return;
    await this.keet.dispatch(_0x2ab36e,"@keet/update-read-length",{'length':_0x329b3e});
  }finally{
  this.keet.internalReleaseRoom(_0x4d82f7);
}
}
async._getUnreadAnchor(_0x1be5ba){
  _0x350f8d={
    _0x541333:0xd7,_0x5e5a63:0x1c3,_0x1eb315:0x71},_0xb65d82={
    _0x58d064:0x1c5,_0x27ce8c:0x121}
  ;
  await this.keet.internalEnsureUnreads();
  if(!this.keet.unreads)return null;
  const _0x1964b5=HypercoreId.decode(_0x1be5ba);
  return this.keet.unreads.get(_0x1964b5);
}
._subscribeUnreadAnchor(_0x243b21){
  _0x5e7bfa={
    _0x50213e:0x1ab,_0x5d8068:0x3a7,_0xe77eae:0x197},_0x42547f={
    _0x96cfc8:0xd1,_0x2dc295:0x1a}
  ;
  return this._addKeetSubscription(UNREADS_SUB_ID,{'query':()=>this.getUnreadAnchor(_0x243b21)});
}
async._setRoomFavorite(_0x5b04de,_0x455d9b=!![]){
  _0x2d7284={
    _0x2ba857:0xaf,_0x26abf8:0x18b},_0x39af08={
    _0x416ef7:0x1b2,_0x25c956:0x91,_0x265f7f:0x19f},_0x4c3f08=HypercoreId.decode(_0x5b04de),_0x1138d3=await this.keet.local.get("@local/rooms",{'roomKey':_0x4c3f08});
  if(!_0x1138d3)return;
  const {
    isFeatureSupported:_0x35ff98,FEATURES:_0x54b61d}
  =this.keet.versions;
  if(!_0x35ff98(_0x1138d3.digest.abi.version,_0x54b61d.FAVORITE_ROOMS))throw new Error("Favorite rooms is not supported");
  await this.keet.privateProfile.dispatch("@keet-private-id/update-room-status",{'roomKey':_0x4c3f08,'key':RoomStatus.IsFavorite,'status':{'isFavorite':_0x455d9b}});
}
}
class V1SwarmAPI{
  constructor(_0x3d59a5){
    _0x29c80b={
      _0x28c83b:0x11,_0x3e244a:0x11d}
    ;
    this.keet=_0x3d59a5;
  }
async.ready(){
  _0x1868c0={
    _0x3fb174:0xa4,_0x4ae45c:0xd6,_0x267255:0x187},_0x1b8cb4={
    _0x14fb48:0x1b1,_0xdad470:0x137,_0x4ae5d8:0x24b}
  ;
  await this.keet.ready();
  return HypercoreId.encode(this.keet.swarm.keyPair.publicKey);
}
}
class V1PreferencesAPI{
  constructor(_0x19bf04){
    _0x2b24cb={
      _0x45092e:0xb3,_0x29786a:0xa6,_0x22dc7e:0x1d2},_0x1a3544={
      _0x5b5a29:0x87}
    ;
    this.keet=_0x19bf04;
    this.preferences=new TinyPreferences(p.join(_0x19bf04.dir,V1_PREFERENCES_FILE_NAME)),this._subs=[];
  }
async._bump(){
  _0x390cd6={
    _0x4ba1af:0x79,_0x33da3c:0x186},_0x223335={
    _0x5747d4:0xfe,_0x3c5dcc:0x80}
  ;
  const _0x5dc06b=await this.preferences.list();
  for(const _0x3e41e6 of this._subs){
    _0x3e41e6.push(_0x5dc06b);
  }
}
async.update(_0x33d71c,_0x48c2d6){
  _0x25f3f5={
    _0x205bd3:0xce,_0x4ad8d0:0x7c},_0x4be4bf={
    _0x519ddb:0xe5,_0x2ab574:0x107}
  ;
  await this.preferences.set(_0x33d71c,_0x48c2d6);
  await this._bump();
}
.query(){
  _0x239ae6={
    _0x49d80d:0x191,_0x3ec2e6:0x21d,_0x3e9cb5:0x18e}
  ;
  return this.preferences.list();
}
.subscribe(){
  _0x48510a={
    _0x35a3de:0x328},_0x2c8c93={
    _0x2b6d87:0x388,_0x19a565:0x35f,_0x115e3b:0x2f6,_0x3801ca:0x4a4},_0x27f7d3=this,_0x4434e2=new Readable({async 'open'(_0x36fd37){let _0x1db508=null;try{await this._bump();}catch(_0x265742){_0x1db508=_0x265742;}_0x36fd37(_0x1db508);},'destroy'(_0x599f87){const _0x6b99af=_0x27f7d3._subs.indexOf(this);if(_0x6b99af!==-(0x1))_0x27f7d3._subs.splice(_0x6b99af,--0x2853);_0x599f87(null);}});
  return this._subs.push(_0x4434e2),_0x4434e2;
}
}
class V1NetworkAPI{
  constructor(_0x2533b9,{onerror:onerror=safetyCatch}={}){
    _0x3670a6={
      _0x32cb5b:0x1a9,_0x40b646:0x113},_0x4fcb0b={
      _0x4279fe:0x198,_0xe2ab07:0x87,_0x370153:0xe6}
    ;
    this.keet=_0x2533b9,this._status=null;
    this._subs=[],this.keet.swarm.on("update",this._handleUpdate.bind(this)),this.keet.swarm.dht.on("network-update",this._handleUpdate.bind(this));
  }
._handleUpdate(){
  _0x1b694c={
    _0x1c3a54:0x74,_0x40c90e:0x21f,_0x2e7fb8:0x13},_0x22bace={
    _0x36bcba:0x41d}
  ;
  this._status=this.query();
  for(const _0x5ef663 of this._subs){
    _0x5ef663.push(this._status);
  }
}
.query(){
  _0x1e6ce5={
    _0x906e2:0x178,_0x464005:0x96},_0x4aef70={
    _0x3099b3:0x6b,_0x378156:0x631}
  ;
  return{
    'host':this.keet.swarm.dht.host,'port':this.keet.swarm.dht.port,'online':this.keet.swarm.dht.online,'degraded':this.keet.swarm.dht.degraded,'connections':this.keet.swarm.connections.size}
  ;
}
.subscribe(){
  _0x1b0d1d={
    _0x438764:0x130,_0xe0e3c3:0x118,_0x45aea2:0x1c4},_0x2fe4ed={
    _0x1831b3:0x2a8,_0x228b24:0x24f,_0x45e977:0x2dc,_0x5393db:0x35f,_0xdd3678:0x1e2,_0x25ecd9:0x184,_0x489b68:0x2f,_0x255e4f:0x298,_0x5d40c0:0x289,_0xa69c52:0x2fd,_0x26431f:0x1fd},_0x47724c={
    _0x551af9:0x250,_0x2e8974:0xbf,_0x463288:0x235,_0x3fef42:0x239},_0x7924b4={
    _0x1fd242:0x4e,_0x476c83:0x404,_0x42bf18:0xf7},_0x3ceafa=this;
  const _0x18105b=new Readable({'open'(_0x1e579d){_0xc41659={_0x458cb1:0x3d3};if(_0x3ceafa._status)this.push(_0x3ceafa._status);_0x1e579d(null);},'destroy'(_0x5419a6){_0x30af45={_0x10ffd8:0x390};const _0x4b0ba4=_0x3ceafa._subs.indexOf(this);if(_0x4b0ba4!==-(0x1))_0x3ceafa._subs.splice(_0x4b0ba4,-0x3ebb);_0x5419a6(null);}});
  return this._subs.push(_0x18105b),_0x18105b;
}
}
class V1ErrorAPI{
  constructor(){
    _0x260e11={
      _0x3315e8:0x22,_0x2873a9:0x1e,_0x4c099d:0x62},_0x42a0f6={
      _0xe96092:0x1dd,_0x2fb423:0xae}
    ;
    this.subscriptions=[],this._handleError=this._handleError.bind(this),this._listenersAttached=![];
  }
._handleError(_0x3b6a4c){
  _0xf3e31b={
    _0x18bbdd:0xb,_0xf466e2:0xa8,_0x491611:0x2b3},_0x3c76bb={
    _0x4a16d8:0x117}
  ;
  console.error("uncaught\x20on worker",_0x3b6a4c);
  for(const _0x53ca90 of this.subscriptions){
    _0x53ca90.push({'message':_0x3b6a4c.message,'stack':_0x3b6a4c.stack+''});
  }
}
.subscribe(_0x49a2a2){
  _0x41bcc6={
    _0x1d9982:0x550,_0x16858c:0x5e5,_0x12c5c9:0x7cb,_0x4457d9:0x681,_0x3aaebd:0x782,_0x86fde0:0x928,_0x59f4ea:0x9e7,_0xf254fa:0x477,_0x32ce57:0x68d,_0x25b629:0x498,_0x322871:0x680},_0x3c7a47={
    _0x523daf:0x13f,_0x3985cc:0x16e,_0x195dce:0x1e0},_0xcce83a={
    _0x45d234:0x116},_0x274219={
    _0xafce36:0x54}
  ;
  const _0x1cfd6c=this;
  !this._listenersAttached&&(uncaughts.on(this._handleError),this._listenersAttached=!![]);
  const _0x4c1666=new Readable({..._0x49a2a2,'destroy'(_0x1caf9e){_0x5c3e18=_0x1cfd6c.subscriptions.indexOf(this);if(_0x5c3e18!==-(0x1))_0x1cfd6c.subscriptions.splice(_0x5c3e18,0x1);_0x1caf9e(null);}});
  return this.subscriptions.push(_0x4c1666),_0x4c1666;
}
}
class V1DebugAPI{
  constructor(_0x40b531){
    _0x17fbec={
      _0x53f684:0x1b5}
    ;
    this.keet=_0x40b531,this.inspector=new KeetInspector();
  }
._getCurrentRoom(){
  _0x4b9b83={
    _0x59e438:0x178,_0x2d03a0:0x353},_0x48ca94={
    _0x225f8f:0x165,_0x43d162:0x1c1,_0x3f2ac1:0x5b6}
  ;
  let _0x29da4f=null;
  for(const _0x5c9a41 of this.keet.rooms.values()){
    (!_0x29da4f||_0x5c9a41.refs>_0x29da4f.refs)&&(_0x29da4f=_0x5c9a41);
  }
return _0x29da4f;
}
async.getCurrentRoomStats(){
  _0x3ef718={
    _0x6d68e9:0x1e,_0x5c3fcc:0x446}
  ;
  const _0x3c82fb=this._getCurrentRoom();
  const _0x168c4a=await _0x3c82fb?..base.core.treeHash();
  return{
    'hash':_0x168c4a.toString("hex"),'length':_0x3c82fb?..base.length}
  ;
}
.enableInspector(){
  _0x3eb450={
    _0xc07df7:0x4e,_0x4d5b09:0x46b}
  ;
  return this.inspector?..enable();
}
.disableInspector(){
  _0x415b3d={
    _0x1ce83:0x12a,_0x4caba1:0x33,_0x4a0ff7:0x1ac},_0x3001a8={
    _0x4d42ce:0x138,_0x2ad73c:0x23c}
  ;
  return this.inspector?..disable();
}
.getInspectorKey(){
  return this.inspector?..key;
}
.processTop(){
  _0x2a8e23={
    _0x2407d0:0x150,_0x313df1:0xca}
  ;
  return top.toJSON();
}
.hash(_0x169f20){
  _0x74d00={
    _0x4ec6eb:0xcd,_0x2fa445:0x2e2,_0x5e845b:0x198}
  ;
  return crypto.hash(_0x169f20);
}
.generateSyntheticError(_0x1bce7f){
  _0x422c99={
    _0x45e028:0x13,_0x7f6e7b:0x62},_0x2ca83b={
    _0xd094da:0xaa,_0x53e8af:0x8f,_0x5137ae:0x523}
  ;
  if(_0x1bce7f)this.keet.onerror(new Error("KEET_CORE_ERROR_HANDLED"));
  else throw new Error("KEET_CORE_ERROR_UNHANDLED");
}
async.heapSnapshot(_0x27b83e="/tmp/keet-heapsnapshot-"+Bare.pid+'.'+Date.now()+(".heapsnapshot")){
  _0x6e74ad={
    _0x75741a:0x86},_0x243e1d={
    _0x4d284e:0x2f,_0x4b35b4:0x117,_0x3012a:0x603},_0x1e62f9=new Session();
  _0x1e62f9.connect();
  const _0x59b57c=new HeapSnapshot(_0x1e62f9),_0x49c67e=fs.createWriteStream(_0x27b83e);
  _0x59b57c.pipe(_0x49c67e),await new Promise(_0x1d22a3=>_0x49c67e.once("close",_0x1d22a3)),_0x1e62f9.destroy();
  return _0x27b83e;
}
}
class V1FeedbackAPI{
  constructor(_0x414d13){
    _0x15b621={
      _0x323d60:0x11b,_0x468892:0x618},_0x1e3590={
      _0x5c008c:0x5d,_0x593275:0x1e5,_0x404ebb:0xef}
    ;
    this._rpcClient=_0x414d13.rpcClient,this.keet=_0x414d13;
  }
.send(_0x135538){
  _0xa43021={
    _0xb2f233:0x4d5,_0x3e2ff7:0x1cd},_0x4a3ccb={
    _0x6f9982:0x1ee}
  ;
  return this._rpcClient.makeRequest(this.keet.config.services.feedback,"send",_0x135538,{'requestEncoding':c.json});
}
}
module.exports=class V1KeetAPI extends ReadyResource{
  constructor(_0xf58116,_0x57bdb1){
    _0x492993={
      _0x2d797d:0xd,_0x130e8c:0x176,_0xfa7ea5:0x53b},_0x404f71={
      _0x29a64c:0x8a,_0x1b84b0:0x23a,_0x2105f3:0x228,_0x552811:0x19c,_0x237e70:0x3b8,_0x5029c4:0x279,_0x46b822:0x26d,_0x2f3f6a:0x2bf,_0x404669:0xf9,_0x233122:0xdf,_0x2e1e5e:0x1e6,_0x3cfe10:0x25e,_0x17609f:0x11d,_0x3300c1:0x367,_0x5bdab3:0x26,_0xdc0504:0x19f},_0x155628={
      _0x2980a5:0x6a}
    ;
    super(),this.keet=_0xf58116,this.opts=_0x57bdb1,this.api={
      'core':new V1KeetCoreAPI(_0xf58116,_0x57bdb1),'swarm':null,'preferences':null,'network':null,'error':null,'debug':null,'console':null,'call':null,'pear':{
        'teardown':()=>{
          _0x2305e4={
            _0x29608c:0x14,_0x5515c2:0x1a,_0x15e466:0xee}
          ;
          console.log("teardown initiated");
          const _0x438828=this.keet.close();
          return _0x438828.catch(_0xf58116.onerror),_0x438828;
        },'selfDestruct':_0x5b6be2=>this.keet.selfDestruct(_0x5b6be2)}
  },this._callBootstraps=null;
this.ready().catch(_0x57bdb1?..onerror||safetyCatch);
}
async._open(){
  _0x3c9fc1={
    _0x4324d2:0x12b,_0x2b8f00:0x3b}
  ;
  await this.keet.ready(),this.api.swarm=new V1SwarmAPI(this.keet,this.opts),this.api.preferences=new V1PreferencesAPI(this.keet,this.opts),this.api.network=new V1NetworkAPI(this.keet,this.opts),this.api.error=new V1ErrorAPI(this.keet,this.opts),this.api.debug=new V1DebugAPI(this.keet,this.opts),this.api.feedback=new V1FeedbackAPI(this.keet);
  this.call=this.api.call=new KeetCallServer(this.keet.swarm,{'firewall':this.api.core.createFirewall.bind(this.api.core)}),this.api.call.on("call-active",this._onCallActive.bind(this));
  this.api.call.on("call-inactive",this._onCallInactive.bind(this));
}
async._close(){
  _0x1238af={
    _0x174d39:0x1aa,_0x5324d5:0x2f,_0x1e43db:0x3a},_0x3fb67e={
    _0x4595ed:0x40,_0x1133da:0x2ba,_0x3e7779:0x134}
  ;
  if(this.call)this.call.close();
  await this.api.debug.disableInspector();
}
async._onCallActive(_0x29e7db){
  _0x1af450={
    _0x626dd6:0xc1},_0x32f18c={
    _0x20b1d0:0x2c}
  ;
  if(this._callBootstraps)return;
  const _0x1e3b4c=await this.keet.rootCorestore.getAuth(HypercoreId.decode(_0x29e7db));
  if(!_0x1e3b4c)return;
  const _0x363805=_0x1e3b4c.key,_0xc6b1ae=this.keet.internalOpenExistingRoom(_0x363805),_0x485579=new Set();
  try{
    await _0xc6b1ae.base.update();
    const _0x230eda=await _0xc6b1ae.db.find("@keet/chat",{'reverse':!![],'limit':0xa}).toArray();
    for(const _0x5c5013 of _0x230eda){
      if(!_0x5c5013||!_0x5c5013.event||!_0x5c5013.event.callStarted)continue;
      if(Math.abs(Date.now()-_0x5c5013.timestamp)>=(0x14)*(0xea60))continue;
      const _0x351638=await _0xc6b1ae.db.get("@keet/devices",{'key':_0x5c5013.oplog.key});
      if(b4a.equals(_0x351638.profile.swarmKey,this.call.swarm.keyPair.publicKey))continue;
      _0x485579.add(b4a.toString(_0x351638.profile.swarmKey,"hex"));
    }
}finally{
this.keet.internalReleaseRoom(_0xc6b1ae);
}
if(!this.api.call.callIsActive||this._callBootstraps)return;
this._callBootstraps=new Set();
for(const _0x2fd2d5 of _0x485579){
  const _0x998c09=b4a.from(_0x2fd2d5,"hex");
  this._callBootstraps.add(_0x998c09),this.call.swarm.joinPeer(_0x998c09);
}
}
._onCallInactive(_0x5dae3c){
  _0x1ddef0={
    _0x43e3a8:0x16e,_0x1c8b8d:0x1aa},_0x4ed587={
    _0x4a6fa1:0x2b}
  ;
  if(!this._callBootstraps)return;
  for(const _0x393338 of this._callBootstraps){
    this.call.swarm.leavePeer(_0x393338);
  }
this._callBootstraps=null;
}
async.suspend(){
  _0x57ce59={
    _0x18ced3:0x1df,_0x165c71:0x16e},_0x217ac9={
    _0x3d656c:0xed,_0x4ee4de:0x365,_0x2a35eb:0x159}
  ;
  await this.keet.suspend();
}
async.resume(){
  _0x3f1848={
    _0x4c964e:0x130,_0x1a2226:0x14c,_0x2d21e5:0x89}
  ;
  await this.keet.resume();
}
}
;
function fromCompatPreferencesKey(_0x3f09d9){
  _0x251548={
    _0x5898b3:0xe,_0x36fdb5:0x141},_0xc0a6e5={
    _0x1df862:0x4a,_0x542c19:0xd,_0x1a7e71:0x102}
  ;
  switch(_0x3f09d9){
    case0x1:return RoomStatus.IsFullyMuted;
    case 0x2:return RoomStatus.IsMentionsOnlyMuted;
    default:return0x0;
  }
}
function fromCompatConfigKey(_0x1f2119){
  _0x74aa28={
    _0x41b63c:0x103,_0x2562df:0x13f},_0x3c3b5a={
    _0x5b9e3a:0x49,_0x661005:0x3fc,_0x4417f6:0x1a0}
  ;
  switch(_0x1f2119){
    case "title":return Config.Title;
    case'avatar':return Config.Avatar;
    case "description":return Config.Description;
    case"supportedLanguages":return Config.SupportedLanguages;
    case'blindPeers':return Config.BlindPeers;
    default:return0x0;
  }
}
function fromCompatRoomType(_0x33a0e9){
  _0x117af2={
    _0x1595b0:0x3c,_0x21fa87:0xed,_0x48baa3:0x76},_0x3a1408={
    _0x31b1ca:0x123}
  ;
  switch(_0x33a0e9){
    case'0':return RoomType.Default;
    case'1':return RoomType.Broadcast;
    case'2':return RoomType.DirectMessage;
    default:return RoomType.Default;
  }
}
function formatRoomCreationOptions(_0x529887={}){
  _0x3816ef={
    _0xb2af9a:0xdd,_0x578917:0x379},_0x8b572={
    _0x19cfa5:0x1b9,_0x388bf1:0x74},_0x1399d9={
    'title':_0x529887.config?..title,'description':_0x529887.config?..description}
  ;
  const _0x1f6830={
    'roomType':fromCompatRoomType(_0x529887.config?..roomType),'isCallingDisabled':_0x529887.config?..canCall==="false"}
  ;
  return{
    'config':_0x1399d9,'settings':_0x1f6830}
  ;
}
function removePreviewsFromChatMessage(_0x578959){
  _0x197c1a={
    _0x3ef8fe:0x25f,_0x28ee1a:0x172,_0x5e83fe:0x118,_0x155ddf:0x3ae,_0x150d58:0x44f,_0x4ccb64:0x4e9,_0x2f2c9f:0x3f8,_0x1ba6b5:0x3f3,_0x185269:0x3b0,_0x516f2a:0x36c,_0x33c7ee:0x2d7,_0x2f777b:0x23f,_0x1d4d45:0x58,_0x500dc9:0x136,_0x274c32:0x494,_0x8b7f16:0x4d0,_0x34b14d:0x1e0,_0x16ab01:0x3b0},_0x351efc={
    _0x21d844:0x132,_0x3cab48:0x3d5,_0x18e4ba:0x1ac},_0x53c33d={
    _0x864ae1:0x1e6},_0xf50e42={
    'files':[],'httpLink':[],'pearLink':[]},_0x1317d8=_0x578959.files||[];
  for(let _0xd47bc6=-0x444;_0xd47bc6<_0x1317d8.length;_0xd47bc6++){
    const _0x172906=_0x1317d8[_0xd47bc6].preview;
    if(!_0x172906)continue;
    _0x1317d8[_0xd47bc6].preview=null,_0xf50e42.files.push({'index':_0xd47bc6,'preview':_0x172906});
  }
const _0x30d0d1=_0x578959.display?..httpLink||[];
for(let _0x4575b4=0x0;_0x4575b4<_0x30d0d1.length;_0x4575b4++){
  const _0x2d4641=_0x3837a5(_0x30d0d1[_0x4575b4]);
  if(!_0x2d4641)continue;
  _0xf50e42.httpLink.push({'index':_0x4575b4,'preview':_0x2d4641});
}
const _0x50c7da=_0x578959.display?..pearLink||[];
for(let _0x4bb7f9=-0x44e2;_0x4bb7f9<_0x50c7da.length;_0x4bb7f9++){
  const _0x1e34af=_0x3837a5(_0x50c7da[_0x4bb7f9]);
  if(!_0x1e34af)continue;
  _0xf50e42.pearLink.push({'index':_0x4bb7f9,'preview':_0x1e34af});
}
return _0xf50e42;
function _0x3837a5(_0x4c6128){
  _0xe0cf60={
    _0x5d19f1:0x349,_0x22e996:0x14b,_0x48abfd:0x181}
  ;
  if(!_0x4c6128.preview?..file?..preview)return null;
  const _0xc35fd2=_0x4c6128.preview.file.preview;
  return _0x4c6128.preview.file.preview=null,_0xc35fd2;
}
}
async function addFilePreviewOperations(_0x50e3c6,{files:_0x449cf1,httpLink:_0x10e3c4,pearLink:_0x4b0175},_0x2c8e0c=null){
  _0xfbb33b={
    _0x3a95e2:0x70},_0x5e0e42={
    _0x69bc94:0x5a,_0x5b8277:0x28}
  ;
  const _0x88aeef=_0x2c8e0c||{
    'key':_0x50e3c6.key,'seq':_0x50e3c6.length-(0x1)}
  ;
  if(_0x449cf1.length)for(const {index:_0x1eac3c,preview:_0x162e7f}of _0x449cf1){
    await _0x50e3c6.dispatch("@keet/add-file-preview",{'oplog':_0x88aeef,'index':_0x1eac3c,'preview':decodeImageFile(_0x162e7f)},{'dryRun':![]});
  }
if(_0x10e3c4.length)for(const {index:_0x2129d2,preview:_0x255d4d}of _0x10e3c4){
  await _0x50e3c6.dispatch("@keet/add-file-preview",{'oplog':_0x88aeef,'index':_0x2129d2,'preview':decodeImageFile(_0x255d4d),'displayType':DisplayType.HttpLink},{'dryRun':![]});
}
if(_0x4b0175.length)for(const {index:_0x341f88,preview:_0x144a9d}of _0x4b0175){
  await _0x50e3c6.dispatch("@keet/add-file-preview",{'oplog':_0x88aeef,'index':_0x341f88,'preview':decodeImageFile(_0x144a9d),'displayType':DisplayType.PearLink},{'dryRun':![]});
}
}