const ReadyResource=require('ready-resource');
class KeetRequestContext extends ReadyResource{
constructor(_0x42b94a){
_0x3f3ae2={
_0x41a6fa:0x268}
;
super(),this.keet=_0x42b94a,this.room=null,this.dbSnapshot=null;
this.blobSnapshot=null,this.localSnapshot=null;
}
async._close(){
_0x28c782={
_0x2ae3d2:0x2ba},_0x416263={
_0x55e8dd:0x2b8}
;
await Promise.all([this.dbSnapshot?this.dbSnapshot.close():null,this.blobSnapshot?this.blobSnapshot.close():null,this.localSnapshot?this.localSnapshot.close():null]);
if(this.room)this.keet.internalReleaseRoom(this.room);
}
.setRoom(_0x5ee411){
_0x294b9f={
_0x28f2e6:0x11e,_0x1ae557:0xb5},_0x4099ad={
_0x53f748:0x214}
;
return this.room=this.keet.internalOpenExistingRoom(_0x5ee411),this.room;
}
.snapshot(){
_0x29e76d={
_0x118b27:0x159},_0x3e7d4b={
_0x3f4783:0x1ad,_0x56e7ca:0xf8}
;
if(!this.room)throw new Error("Must set a room before taking a\x20db\x20snapshot");
if(this.dbSnapshot)return this.dbSnapshot;
return this.dbSnapshot=this.room.db.snapshot(),this.dbSnapshot;
}
.blobSnapshot(){
_0x46147d={
_0x325a0d:0x0,_0x617396:0x596},_0x355a4f={
_0x11a84:0x161,_0x4af8f7:0x95,_0x72d04e:0xfa}
;
if(!this.room)throw new Error("Must set a room before taking a db snapshot");
if(this.blobSnapshot)return this.dbSnapshot;
return this.blobSnapshot=this.room.blobs.snapshot(),this.blobSnapshot;
}
.localSnapshot(){
_0x1722b0={
_0x180b66:0x1de,_0x17b5e4:0x41c,_0x39c2a7:0x176},_0x16f0a9={
_0x4e610f:0x14f}
;
if(this.localSnapshot)return this.localSnapshot;
this.localSnapshot=this.keet.local.snapshot();
return this.localSnapshot;
}
}
class KeetMethod{
constructor(_0x2d99e7,_0x1e019b){
_0x193782={
_0x542624:0x43,_0x2fc4dc:0x224,_0x2da1fa:0x7d},_0x4a4aed={
_0xc195c9:0x21c}
;
this.backend=_0x2d99e7,this.keet=_0x2d99e7.keet;
this.req=_0x1e019b,this.ctx=new KeetRequestContext(this.keet);
}
async._run(){
}
async.run(){
_0x3160b3={
_0x451a25:0x20f,_0x262fd2:0x152,_0x4019cc:0xc0},_0x72f38b={
_0x9b2f54:0x184,_0x176fbe:0x2af,_0x15eb41:0x1b6}
;
if(!this.backend.opened)await this.backend.ready();
try{
const _0x4cb089=Date.now(),_0x119719=await this._run(),_0x5cb123=Date.now()-_0x4cb089;
return{
'header':{
'duration':_0x5cb123},..._0x119719}
;
}finally{
await this.ctx.close();
}
}
static.run(_0x508c3a,_0x5916b2){
_0x249d8b={
_0x209689:0xd3,_0x25b47b:0x15a,_0x59ffbf:0x8a},_0x3ece22=new this(_0x508c3a,_0x5916b2);
return _0x3ece22.run();
}
}
module.exports={
'KeetMethod':KeetMethod}
;