OverviewFilesCommitsIssuesDocsReleasesPeers

holepunchto-deps / @holepunchto / keet-core-hyperdb / lib / contract / labels.js

1 lines · javascript ref:
(function(_0x594991,_0x822c8e){const _0x518bf0={_0x335ef2:0x284,_0x13e6cd:0x282,_0x78f519:0x281,_0x4ffa7b:0x276,_0x1f7ff0:0x26f,_0x56f146:0x294,_0x35c7f2:0x286,_0x4385b1:0x29e,_0x3131d0:0x293,_0x520582:0x296,_0x75e9d0:0x28a,_0x16d1d6:0x186,_0x238195:0x17c,_0xb508a5:0x185,_0x272264:0x196,_0x200d62:0x186,_0x4bcd65:0x2a8,_0x26d7c0:0x172,_0x26b30e:0x169,_0x409e96:0x167,_0x149145:0x27b,_0x58fe17:0x289,_0x5e7ecc:0x290,_0x1fb6af:0x292},_0x2bd4c2={_0x5b688b:0xfd};function _0x784529(_0x48f9db,_0x4d995e,_0xb21e19,_0x302569){return _0x3262(_0x302569- -0xb,_0x48f9db);}const _0x2fa822=_0x594991();function _0x170642(_0x501251,_0x1d18b9,_0x399ba4,_0x510c6b){return _0x3262(_0x501251-_0x2bd4c2._0x5b688b,_0x1d18b9);}while(!![]){try{const _0x3e8974=parseInt(_0x170642(_0x518bf0._0x335ef2,0x293,0x295,_0x518bf0._0x13e6cd))/(0x1*-0x82a+-0x1*-0xbe9+0x1df*-0x2)*(parseInt(_0x170642(_0x518bf0._0x78f519,_0x518bf0._0x4ffa7b,0x26f,_0x518bf0._0x1f7ff0))/(0x3b2*-0x1+-0xfc5+0x1379))+parseInt(_0x170642(_0x518bf0._0x56f146,_0x518bf0._0x35c7f2,_0x518bf0._0x4385b1,_0x518bf0._0x3131d0))/(0x3a6*0x8+0x1f42+-0x3c6f)+-parseInt(_0x170642(0x288,_0x518bf0._0x520582,0x28b,_0x518bf0._0x75e9d0))/(-0x1519+-0xa13+0x1f30)+-parseInt(_0x784529(_0x518bf0._0x16d1d6,0x184,0x195,_0x518bf0._0x16d1d6))/(-0x513+0x4e3+0x35)*(-parseInt(_0x784529(_0x518bf0._0x238195,_0x518bf0._0x238195,0x165,0x16b))/(-0x21f1+0x49d+0x1d5a))+parseInt(_0x784529(_0x518bf0._0xb508a5,_0x518bf0._0x272264,_0x518bf0._0x200d62,0x185))/(0x1eaf+0x3*0x301+-0x27ab)+-parseInt(_0x170642(0x296,0x292,_0x518bf0._0x4385b1,_0x518bf0._0x4bcd65))/(0x20f2+0x3*-0xacd+0x1*-0x83)*(parseInt(_0x784529(_0x518bf0._0x26d7c0,_0x518bf0._0x26b30e,_0x518bf0._0x409e96,_0x518bf0._0x26d7c0))/(0x1c4b+0xb7b*0x3+-0x8f5*0x7))+parseInt(_0x170642(_0x518bf0._0x149145,_0x518bf0._0x58fe17,_0x518bf0._0x35c7f2,0x27a))/(-0x1ccb+-0x1c8a+0x395f*0x1)*(parseInt(_0x170642(_0x518bf0._0x5e7ecc,_0x518bf0._0x4385b1,_0x518bf0._0x1fb6af,_0x518bf0._0x520582))/(-0x2bf+0xb11+-0xd*0xa3));if(_0x3e8974===_0x822c8e)break;else _0x2fa822['push'](_0x2fa822['shift']());}catch(_0x514636){_0x2fa822['push'](_0x2fa822['shift']());}}}(_0x549f,-0x1b*-0x46c6+0xb02*-0xb7+0x7082d));const _0x48a0f4=(function(){let _0x140ede=!![];return function(_0x1025cf,_0x362d33){const _0x4eae09={_0x1a40c2:0x507,_0x4c54a5:0x503,_0x953339:0x50a},_0x6be36b=_0x140ede?function(){function _0x560789(_0x3d0cf6,_0x391bda,_0x2a25d0,_0x2cb63b){return _0x3262(_0x2cb63b-0x395,_0x2a25d0);}if(_0x362d33){const _0x4d94c2=_0x362d33[_0x560789(_0x4eae09._0x1a40c2,0x517,_0x4eae09._0x4c54a5,_0x4eae09._0x953339)](_0x1025cf,arguments);return _0x362d33=null,_0x4d94c2;}}:function(){};return _0x140ede=![],_0x6be36b;};}()),_0x444d8d=_0x48a0f4(this,function(){const _0x3ee2ba={_0x155380:0x2b5,_0x9a0677:0x2ad,_0x3df3a7:0x2ad,_0x20e819:0x168,_0x435eb3:0x155,_0x28f299:0x164,_0x2883c3:0x2b5,_0xa797fa:0x2bf,_0x2cb47d:0x178,_0x316af9:0x170,_0x4c8b64:0x16b,_0xa4bd95:0x163,_0x3cc711:0x14d,_0x462d87:0x15f},_0x1234c0={_0x521c96:0x12b},_0x4055b1={_0x20a691:0x2f};function _0x2ef0e4(_0x440920,_0xbae4db,_0x339896,_0x495ddf){return _0x3262(_0x495ddf- -_0x4055b1._0x20a691,_0x440920);}function _0x496e98(_0x4d0847,_0x434209,_0x130376,_0x212415){return _0x3262(_0x4d0847-_0x1234c0._0x521c96,_0x434209);}return _0x444d8d[_0x496e98(_0x3ee2ba._0x155380,_0x3ee2ba._0x9a0677,_0x3ee2ba._0x3df3a7,0x2c5)]()['search'](_0x2ef0e4(_0x3ee2ba._0x20e819,_0x3ee2ba._0x435eb3,_0x3ee2ba._0x28f299,0x15f)+'+$')[_0x496e98(_0x3ee2ba._0x2883c3,_0x3ee2ba._0xa797fa,0x2c0,0x2b1)]()[_0x2ef0e4(_0x3ee2ba._0x2cb47d,0x16f,_0x3ee2ba._0x316af9,_0x3ee2ba._0x4c8b64)+'r'](_0x444d8d)['search'](_0x2ef0e4(_0x3ee2ba._0xa4bd95,_0x3ee2ba._0x3cc711,0x14e,_0x3ee2ba._0x462d87)+'+$');});_0x444d8d();const REGISTER_ROUTES=require('./registration'),{isMemberActive,getMemberForDeviceKey}=require('./query');function _0x3262(_0x2bc2b8,_0x9c3153){const _0x9d4904=_0x549f();return _0x3262=function(_0x38803c,_0x279862){_0x38803c=_0x38803c-(-0x1e47+0x61f*0x5+0x1*0x121);let _0x595ed9=_0x9d4904[_0x38803c];return _0x595ed9;},_0x3262(_0x2bc2b8,_0x9c3153);}function _0xfd90dc(_0xb30a2c,_0x359ef1,_0x22a73a,_0x213032){const _0x3e90ba={_0x9e8019:0x2c1};return _0x3262(_0x213032- -_0x3e90ba._0x9e8019,_0x359ef1);}const b4a=require('b4a'),{KeetContractError}=require('./errors'),{chatLabelStats}=require('./stats');async function handleAddChatLabel({header:_0x142ddf,oplog:_0x33fa49,label:_0x168263},{db:_0x50526d,writer:_0x31a808}){const _0x5b4393={_0xfb52ea:0x103,_0xfdc460:0x11d,_0x20fb1c:0x12a,_0x5385ea:0x10b,_0x49ffea:0x119,_0x39089d:0x124,_0xc0d63f:0x109,_0x514bdd:0x12c,_0x3be427:0x126,_0x47079a:0x12f,_0x17685b:0x122,_0x101436:0x127,_0x30a665:0x2b9,_0x5ecb2f:0x2af,_0x59a1f5:0x2a1,_0x467f57:0x28e,_0x32a5ba:0x2b2,_0x4b523f:0x29f,_0x5828ca:0x296,_0x1dedc2:0x29e,_0x49926a:0x292,_0x12d39d:0x2a2,_0x13adb3:0x2c9,_0x27ac66:0x2b8,_0x4df27e:0x2c4,_0x19a9a3:0x2b7,_0x2e0bdd:0x2c6,_0x36e935:0x2c0,_0x53642d:0x2bd,_0x305823:0x2ac,_0x54d90d:0x2bb,_0x33c520:0x2b0,_0x436fa0:0x11a,_0x44e61c:0x10b,_0x44c80e:0x114,_0x1b1aa9:0x290,_0x1ae094:0x29d,_0x5f20fc:0x29c,_0x552e1c:0x2a3,_0x4cff3d:0x10a,_0x14c354:0x10a,_0x3717ca:0x10f,_0x32f0f3:0xfc,_0x823c1b:0x2b1,_0x7d5b95:0x2b3,_0x5348e0:0x108,_0x14bbb4:0x113,_0x5758a0:0x128,_0x67ca49:0x121,_0x1e2ad3:0x2a9,_0x1d8f86:0x133,_0xad3dfe:0x29a,_0x536d95:0x293,_0x4e063e:0x2a9,_0x248e1d:0x11f,_0x295b4b:0x10f},_0x429c12={_0x70a1aa:0x128},[_0x2fb231,_0x37622e,_0x4ef743,_0x346523]=await Promise[_0x576311(-0x111,-_0x5b4393._0xfb52ea,-0x115,-_0x5b4393._0xfdc460)]([getMemberForDeviceKey(_0x50526d,_0x31a808[_0x576311(-_0x5b4393._0x20fb1c,-_0x5b4393._0x5385ea,-_0x5b4393._0x49ffea,-0x10b)]),getMemberForDeviceKey(_0x50526d,_0x33fa49[_0x576311(-_0x5b4393._0x39089d,-_0x5b4393._0xc0d63f,-0x119,-_0x5b4393._0x514bdd)]),_0x50526d['get'](_0x576311(-_0x5b4393._0x3be427,-_0x5b4393._0x47079a,-_0x5b4393._0x17685b,-_0x5b4393._0x101436)+'-by-messag'+'e-id',{'oplog':_0x33fa49}),_0x50526d['get'](_0x3aeae7(_0x5b4393._0x30a665,_0x5b4393._0x5ecb2f,_0x5b4393._0x59a1f5,0x2ae)+'ads',{'id':0x0})]);if(!isMemberActive(_0x2fb231)||!_0x4ef743||_0x4ef743[_0x3aeae7(_0x5b4393._0x467f57,_0x5b4393._0x32a5ba,_0x5b4393._0x467f57,_0x5b4393._0x4b523f)][_0x3aeae7(_0x5b4393._0x5828ca,_0x5b4393._0x1dedc2,_0x5b4393._0x49926a,_0x5b4393._0x12d39d)]||_0x2fb231['status'][_0x3aeae7(_0x5b4393._0x13adb3,_0x5b4393._0x27ac66,_0x5b4393._0x4df27e,_0x5b4393._0x19a9a3)]||b4a[_0x3aeae7(0x2bc,_0x5b4393._0x2e0bdd,_0x5b4393._0x36e935,_0x5b4393._0x53642d)](_0x2fb231['key'],_0x37622e[_0x3aeae7(_0x5b4393._0x305823,_0x5b4393._0x27ac66,_0x5b4393._0x54d90d,_0x5b4393._0x33c520)]))return;const _0x83a8b2=await _0x50526d[_0x576311(-_0x5b4393._0x436fa0,-_0x5b4393._0x44e61c,-_0x5b4393._0x44c80e,-0x105)](_0x576311(-0x117,-0x118,-_0x5b4393._0x17685b,-_0x5b4393._0x101436)+_0x3aeae7(_0x5b4393._0x1b1aa9,_0x5b4393._0x1ae094,_0x5b4393._0x5f20fc,_0x5b4393._0x552e1c),{'id':_0x4ef743['id'],'sender':_0x2fb231['key'],'label':_0x168263});function _0x3aeae7(_0x44878f,_0x1a0d1f,_0x583d3c,_0x285be1){return _0x3262(_0x285be1-_0x429c12._0x70a1aa,_0x583d3c);}if(_0x83a8b2)throw KeetContractError[_0x576311(-_0x5b4393._0x4cff3d,-_0x5b4393._0x14c354,-_0x5b4393._0x3717ca,-_0x5b4393._0x32f0f3)]();function _0x576311(_0x11781b,_0x55a33e,_0x49c0b1,_0x4b576d){return _0x3262(_0x49c0b1- -0x2a1,_0x4b576d);}const _0x5da3c4={'id':_0x4ef743['id'],'sender':_0x2fb231[_0x3aeae7(_0x5b4393._0x823c1b,_0x5b4393._0x7d5b95,0x2b3,_0x5b4393._0x33c520)],'clock':_0x346523[_0x576311(-_0x5b4393._0x5348e0,-_0x5b4393._0x14bbb4,-0x118,-_0x5b4393._0x49ffea)][_0x576311(-_0x5b4393._0x47079a,-_0x5b4393._0x5758a0,-_0x5b4393._0x67ca49,-_0x5b4393._0x3717ca)][_0x3aeae7(0x2a9,_0x5b4393._0x552e1c,0x2a5,_0x5b4393._0x1e2ad3)],'label':_0x168263};await _0x50526d['insert'](_0x576311(-_0x5b4393._0x1d8f86,-0x11e,-_0x5b4393._0x17685b,-0x110)+_0x3aeae7(_0x5b4393._0xad3dfe,_0x5b4393._0x536d95,_0x5b4393._0x4e063e,0x2a3),_0x5da3c4),await chatLabelStats(_0x50526d,_0x346523,_0x5da3c4,null,_0x142ddf[_0x576311(-0x11c,-0x122,-_0x5b4393._0x248e1d,-_0x5b4393._0x295b4b)]);}async function handleRemoveChatLabel({header:_0x15393d,oplog:_0x54d8d7,label:_0x428321},{db:_0x130626,writer:_0x5c3625}){const _0x2dba1a={_0x14a457:0x4a8,_0x2e9829:0x49b,_0x19e951:0x48d,_0x515e5b:0x492,_0x277895:0x496,_0x210d6e:0x497,_0xfe16f7:0x4a4,_0x2f27ba:0x488,_0x429280:0x493,_0x4d97a9:0x49c,_0x7b4c5f:0x490,_0x47822c:0x49e,_0x29b6ca:0x48e,_0x57c348:0x487,_0x1a7217:0x47d,_0x28f92f:0x471,_0x1e0283:0x479,_0x174352:0x47e,_0x415789:0x480,_0x28bdbb:0x47b,_0x594df7:0x473,_0xd741e0:0x49b,_0x2f8a12:0x4ab,_0x4e1399:0x49d,_0x3fef15:0x48e,_0x157fb7:0x486,_0x5964aa:0x48c,_0x2531b5:0x489,_0x3116ae:0x4a0,_0x19a177:0x485,_0x3a9065:0x490,_0xb77b3e:0x481,_0x2fd871:0x491,_0x298a1a:0x484,_0x2f7c73:0x470,_0x2e5a78:0x498,_0x4b6f40:0x499,_0x232abf:0x486,_0xc80721:0x475,_0x157439:0x470,_0x518271:0x482},_0x312f38={_0x2d91ef:0x30e},[_0x4216b1,_0x34a9e9,_0x4d4ed3,_0x1e8250]=await Promise[_0x144294(0x4a6,_0x2dba1a._0x14a457,0x49a,_0x2dba1a._0x2e9829)]([getMemberForDeviceKey(_0x130626,_0x5c3625[_0x144294(_0x2dba1a._0x19e951,_0x2dba1a._0x515e5b,_0x2dba1a._0x277895,_0x2dba1a._0x210d6e)]),getMemberForDeviceKey(_0x130626,_0x54d8d7[_0x144294(0x4a7,_0x2dba1a._0xfe16f7,0x496,_0x2dba1a._0x2f27ba)]),_0x130626[_0x1b5dc6(_0x2dba1a._0x429280,_0x2dba1a._0x2f27ba,0x48b,0x489)](_0x144294(_0x2dba1a._0x4d97a9,_0x2dba1a._0x2f27ba,_0x2dba1a._0x19e951,_0x2dba1a._0x7b4c5f)+_0x1b5dc6(_0x2dba1a._0x47822c,_0x2dba1a._0x29b6ca,0x498,0x48f)+_0x144294(_0x2dba1a._0x57c348,0x499,0x487,0x476),{'oplog':_0x54d8d7}),_0x130626['get']('@keet/thre'+'ads',{'id':0x0})]);if(!isMemberActive(_0x4216b1)||!_0x4d4ed3||_0x4d4ed3[_0x1b5dc6(_0x2dba1a._0x1a7217,0x473,_0x2dba1a._0x28f92f,_0x2dba1a._0x1e0283)][_0x144294(_0x2dba1a._0x174352,_0x2dba1a._0x19e951,0x488,_0x2dba1a._0x415789)]||_0x4216b1[_0x144294(_0x2dba1a._0x7b4c5f,_0x2dba1a._0x28bdbb,0x485,_0x2dba1a._0x594df7)]['isMuted']||b4a[_0x1b5dc6(_0x2dba1a._0xd741e0,_0x2dba1a._0x2f8a12,_0x2dba1a._0x4e1399,0x4a3)](_0x4216b1[_0x1b5dc6(_0x2dba1a._0x3fef15,_0x2dba1a._0x157fb7,_0x2dba1a._0x5964aa,_0x2dba1a._0x2531b5)],_0x34a9e9[_0x1b5dc6(_0x2dba1a._0x3fef15,_0x2dba1a._0x3116ae,_0x2dba1a._0x2e9829,0x48e)]))return;const _0x5b1d63=await _0x130626['get'](_0x1b5dc6(_0x2dba1a._0x19a177,_0x2dba1a._0x2f27ba,_0x2dba1a._0x3a9065,_0x2dba1a._0x429280)+_0x1b5dc6(_0x2dba1a._0xb77b3e,_0x2dba1a._0x2fd871,_0x2dba1a._0x298a1a,_0x2dba1a._0x2f7c73),{'id':_0x4d4ed3['id'],'sender':_0x4216b1[_0x1b5dc6(_0x2dba1a._0x3fef15,_0x2dba1a._0x19e951,0x49a,_0x2dba1a._0x2f27ba)],'label':_0x428321});function _0x1b5dc6(_0x418741,_0x1e5b7d,_0x8c4146,_0x40588c){return _0x3262(_0x418741-0x306,_0x1e5b7d);}function _0x144294(_0x54f322,_0xe14771,_0x4cd569,_0x249d48){return _0x3262(_0x4cd569-_0x312f38._0x2d91ef,_0xe14771);}if(!_0x5b1d63)throw KeetContractError[_0x1b5dc6(_0x2dba1a._0x2e5a78,_0x2dba1a._0x3a9065,_0x2dba1a._0x4b6f40,_0x2dba1a._0x232abf)]();await _0x130626['delete'](_0x144294(0x49d,_0x2dba1a._0x1a7217,_0x2dba1a._0x19e951,_0x2dba1a._0x232abf)+_0x1b5dc6(_0x2dba1a._0xb77b3e,_0x2dba1a._0xc80721,0x490,_0x2dba1a._0x157439),_0x5b1d63),await chatLabelStats(_0x130626,_0x1e8250,null,_0x5b1d63,_0x15393d[_0x144294(0x49c,0x4a0,0x490,_0x2dba1a._0x518271)]);}function _0x549f(){const _0x52a531=['add','@keet/thre','1FxAeRj','key','stats','toString','1528876mCVDew','all','get','(((.+)+)+)','isMuted','2663850JyzWfI','132985uCxXal','ABORT','171039dItgTc','@keet/remo','equals','exports','618651OKZDGG','-by-messag','556456fBVJeY','constructo','apply','6IebkjJ','status','bel','e-id','isDeleted','-labels','chat-label','9gpGUtm','40CaxKKS','@keet/chat','chat','clock','timestamp','ve-chat-la','421106lNtcGY'];_0x549f=function(){return _0x52a531;};return _0x549f();}function registerRoutes(_0x3d4d65){const _0x3f89ef={_0x2e6925:0x15e,_0x4b8fc8:0x164,_0x2274f4:0x159,_0x1bbc88:0x148,_0x12b635:0x13f,_0x136160:0x150,_0x8315f4:0x9e,_0x12516e:0xb7,_0x577d33:0x150,_0x219b0e:0x146,_0x215f8d:0x152,_0x37398a:0x8d,_0x2a20da:0x92,_0x28814a:0x97},_0x1abc08={_0xa5bca4:0x2d5},_0x46879c={_0x314189:0xee};function _0x435662(_0x1d1f8a,_0xa85d76,_0xc1dbe4,_0x30a928){return _0x3262(_0x1d1f8a- -_0x46879c._0x314189,_0x30a928);}_0x3d4d65['add']('@keet/add-'+_0x2a51dc(-_0x3f89ef._0x2e6925,-_0x3f89ef._0x4b8fc8,-0x153,-_0x3f89ef._0x2274f4),handleAddChatLabel);function _0x2a51dc(_0x5bb6b9,_0x298286,_0x1a3cff,_0xec1621){return _0x3262(_0xec1621- -_0x1abc08._0xa5bca4,_0x5bb6b9);}_0x3d4d65[_0x2a51dc(-0x162,-_0x3f89ef._0x1bbc88,-_0x3f89ef._0x12b635,-_0x3f89ef._0x136160)](_0x435662(0xa6,0x9b,_0x3f89ef._0x8315f4,_0x3f89ef._0x12516e)+_0x2a51dc(-_0x3f89ef._0x1bbc88,-_0x3f89ef._0x577d33,-_0x3f89ef._0x219b0e,-_0x3f89ef._0x215f8d)+_0x435662(0x8a,_0x3f89ef._0x37398a,_0x3f89ef._0x2a20da,_0x3f89ef._0x28814a),handleRemoveChatLabel);}module[_0xfd90dc(-0x13b,-0x12b,-0x120,-0x12b)]={[REGISTER_ROUTES]:registerRoutes};