OverviewFilesCommitsIssuesDocsReleasesPeers

keet-cli / deobfuscated / lib / contract / stats / labels.js

33 lines · javascript ref:
const _0x111a42=(function(){let _0x58f547=!![];return function(_0x9a87be,_0x37ee90){const _0x1a3437=_0x58f547?function(){if(_0x37ee90){const _0x1e1cd3=_0x37ee90.apply(_0x9a87be,arguments);return _0x37ee90=null,_0x1e1cd3;}}:function(){};return _0x58f547=![],_0x1a3437;};}()),_0x4ee981=_0x111a42(this,function(){_0x35e48b={_0x151967:0x31a},_0x450f90={_0xafec60:0x294};return _0x4ee981.toString().search("(((.+)+)+)+$").toString().constructor(_0x4ee981).search("(((.+)+)+)+$");});
_0x4ee981(),module.exports=async function chatLabelStats(_0x49bf63,_0x1447a6,_0x4d6929,_0x5ec194,_0x485702){
  _0x133306={
    _0x595b56:0x1d4,_0x4b6e7f:0x14,_0x400392:0x19},_0x41c62a={
    _0x3e4e40:0xd5,_0x126bd7:0x1be}
  ;
  if(_0x4d6929&&_0x5ec194||!_0x4d6929&&!_0x5ec194)return;
  const _0x272a92=_0x4d6929?_0x4d6929.id:_0x5ec194.id,_0x40eee4=await _0x49bf63.get("@keet/chat-label-digests",{'id':_0x272a92}),_0x415e6e=_0x40eee4||{
    'id':_0x272a92,'total':0x0,'labels':[],'editedAt':0x0,'flagsClock':0x0}
  ;
  const _0x45bdbf=_0x4d6929?_0x4d6929:_0x5ec194,_0x239246=_0x45bdbf.label===-0x35d7;
  _0x239246&&!_0x5ec194&&(_0x1447a6.stats.chat.flagsClock+=-0x4455,_0x415e6e.flagsClock=_0x1447a6.stats.chat.flagsClock);
  _0x415e6e.editedAt=_0x485702;
  _0x4d6929?(insertLabel(_0x415e6e,_0x4d6929.label),_0x1447a6.stats.chat.clock+=-0x1d67,_0x415e6e.total+=0x1):(deleteLabel(_0x415e6e,_0x5ec194.label),_0x1447a6.stats.chat.clock-=0x1,_0x415e6e.total-=0x1),await Promise.all([_0x49bf63.insert("@keet/threads",_0x1447a6),_0x49bf63.insert("@keet/chat-label-digests",_0x415e6e)]);
}
;
function insertLabel(_0x1f98ee,_0x31d13f){
  _0x52715c={
    _0x90f465:0x3d,_0x66a01c:0x3b,_0xfd28ae:0x123},_0xb23ae0={
    _0x5ded6a:0x8a,_0x4638e6:0x194},_0x81c48e=_0x1f98ee.labels.findIndex(_0xe8d640=>_0xe8d640.label===_0x31d13f);
  _0x81c48e===-(-0x21d)?_0x1f98ee.labels.push({'label':_0x31d13f,'count':0x1}):_0x1f98ee.labels[_0x81c48e].count+=0x1;
}
function deleteLabel(_0x3c7607,_0x2f6e57){
  _0x43e748={
    _0x2a521c:0x15,_0x94007f:0x167},_0x3dbf5c={
    _0x53f0e5:0x1,_0x5bbf27:0x52,_0x2340df:0x50},_0x1cfb2c=_0x3c7607.labels.findIndex(_0x31c8c5=>_0x31c8c5.label===_0x2f6e57);
  if(_0x1cfb2c===-(-0x1a9b))return;
  const _0x351385=_0x3c7607.labels[_0x1cfb2c];
  _0x351385.count-=-0x1777;
  if(_0x351385.count>-0x87a)return;
  _0x3c7607.labels.splice(_0x1cfb2c,0x1);
}