Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / userNotification / userNotification.controller.js
index 74ed7e6..8f0a3b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x351f=['hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','create','recipient','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','replace','Queue','forEach','push','all','flatten','getAgents','map','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./userNotification.socket','sendStatus','status','end','undefined','limit','count','offset','Content-Range','reject','save','then','stack','name','sendUserNotification','body'];(function(_0x4f2568,_0x39f223){var _0x300894=function(_0x139451){while(--_0x139451){_0x4f2568['push'](_0x4f2568['shift']());}};_0x300894(++_0x39f223);}(_0x351f,0x91));var _0xf351=function(_0x50ebce,_0x313c6f){_0x50ebce=_0x50ebce-0x0;var _0x4a2518=_0x351f[_0x50ebce];return _0x4a2518;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf351('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf351('0x1'));var rp=require(_0xf351('0x2'));var moment=require(_0xf351('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf351('0x4'));var util=require(_0xf351('0x5'));var path=require(_0xf351('0x6'));var sox=require('sox');var csv=require(_0xf351('0x7'));var ejs=require(_0xf351('0x8'));var fs=require('fs');var fs_extra=require(_0xf351('0x9'));var _=require('lodash');var squel=require(_0xf351('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf351('0xb'));var toCsv=require(_0xf351('0x7'));var querystring=require(_0xf351('0xc'));var Papa=require(_0xf351('0xd'));var Redis=require('ioredis');var authService=require(_0xf351('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf351('0xf'));var hardwareService=require(_0xf351('0x10'));var logger=require(_0xf351('0x11'))('api');var utils=require(_0xf351('0x12'));var config=require(_0xf351('0x13'));var licenseUtil=require(_0xf351('0x14'));var db=require(_0xf351('0x15'))['db'];config[_0xf351('0x16')]=_['defaults'](config[_0xf351('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf351('0x16')]));require(_0xf351('0x17'))['register'](socket);function respondWithStatusCode(_0x158cdc,_0x58e8e9){_0x58e8e9=_0x58e8e9||0xcc;return function(_0x37eafe){if(_0x37eafe){return _0x158cdc[_0xf351('0x18')](_0x58e8e9);}return _0x158cdc[_0xf351('0x19')](_0x58e8e9)[_0xf351('0x1a')]();};}function respondWithResult(_0x27b589,_0x2e8949){_0x2e8949=_0x2e8949||0xc8;return function(_0x58ca74){if(_0x58ca74){return _0x27b589[_0xf351('0x19')](_0x2e8949)['json'](_0x58ca74);}};}function respondWithFilteredResult(_0x3cc504,_0x248744){return function(_0x5783f8){if(_0x5783f8){var _0xa507a8=typeof _0x248744['offset']===_0xf351('0x1b')&&typeof _0x248744[_0xf351('0x1c')]===_0xf351('0x1b');var _0x44ad82=_0x5783f8[_0xf351('0x1d')];var _0x10dcf3=_0xa507a8?0x0:_0x248744['offset'];var _0x140408=_0xa507a8?_0x5783f8['count']:_0x248744[_0xf351('0x1e')]+_0x248744[_0xf351('0x1c')];var _0x3b1add;if(_0x140408>=_0x44ad82){_0x140408=_0x44ad82;_0x3b1add=0xc8;}else{_0x3b1add=0xce;}_0x3cc504[_0xf351('0x19')](_0x3b1add);return _0x3cc504['set'](_0xf351('0x1f'),_0x10dcf3+'-'+_0x140408+'/'+_0x44ad82)['json'](_0x5783f8);}return null;};}function patchUpdates(_0x315090){return function(_0x7cedab){try{jsonpatch['apply'](_0x7cedab,_0x315090,!![]);}catch(_0x29b88a){return BPromise[_0xf351('0x20')](_0x29b88a);}return _0x7cedab[_0xf351('0x21')]();};}function saveUpdates(_0x41ce07,_0x331d18){return function(_0x392235){if(_0x392235){return _0x392235['update'](_0x41ce07)[_0xf351('0x22')](function(_0x1fb9a7){return _0x1fb9a7;});}return null;};}function removeEntity(_0x56f87d,_0x199c09){return function(_0x12901d){if(_0x12901d){return _0x12901d['destroy']()['then'](function(){_0x56f87d['status'](0xcc)[_0xf351('0x1a')]();});}};}function handleEntityNotFound(_0x49b7f8,_0x549f79){return function(_0x4670d7){if(!_0x4670d7){_0x49b7f8[_0xf351('0x18')](0x194);}return _0x4670d7;};}function handleError(_0x4fc88a,_0x82e08e){_0x82e08e=_0x82e08e||0x1f4;return function(_0x1b8c28){logger['error'](_0x1b8c28[_0xf351('0x23')]);if(_0x1b8c28['name']){delete _0x1b8c28[_0xf351('0x24')];}_0x4fc88a['status'](_0x82e08e)['send'](_0x1b8c28);};}exports[_0xf351('0x25')]=function(_0x1b7ff6,_0x2996f0,_0x110469){if(!_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')](_0xf351('0x28'))&&!_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')](_0xf351('0x29'))){throw new db['Sequelize']['ValidationError'](_0xf351('0x2a'));}else{if(_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')](_0xf351('0x29'))&&!_0x1b7ff6['body'][_0xf351('0x27')](_0xf351('0x2b'))){throw new db[(_0xf351('0x2c'))][(_0xf351('0x2d'))](_0xf351('0x2e'));}if(!_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')]('recipients')){throw new db[(_0xf351('0x2c'))][(_0xf351('0x2d'))](_0xf351('0x2f'));}else{try{var _0xddd30e=JSON['parse'](_0x1b7ff6[_0xf351('0x26')][_0xf351('0x30')]);}catch(_0x4e5849){logger[_0xf351('0x31')](_0x4e5849);throw new db[(_0xf351('0x2c'))][(_0xf351('0x2d'))](_0xf351('0x32'));}var _0x189192=[_0xf351('0x33'),_0xf351('0x34'),_0xf351('0x35'),'openchannelqueue',_0xf351('0x36'),_0xf351('0x37'),'whatsappqueue',_0xf351('0x38'),_0xf351('0x39')];if(_[_0xf351('0x3a')](_0xddd30e,function(_0x1544c0){return!_[_0xf351('0x3b')](_0x189192,_0x1544c0[_0xf351('0x3c')][_0xf351('0x3d')]());})){throw new db[(_0xf351('0x2c'))][(_0xf351('0x2d'))](_0xf351('0x3e'));}}}var _0x203efb={};_0x203efb[_0xf351('0x3f')]=_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')](_0xf351('0x3f'))?_0x1b7ff6[_0xf351('0x26')]['senderName']:_0x1b7ff6[_0xf351('0x39')]['fullname'];_0x203efb[_0xf351('0x40')]=_[_0xf351('0x41')](_0x1b7ff6[_0xf351('0x26')][_0xf351('0x40')])?null:_0x1b7ff6[_0xf351('0x26')][_0xf351('0x40')];_0x203efb[_0xf351('0x42')]=_0x1b7ff6[_0xf351('0x26')][_0xf351('0x42')]||![];_0x203efb[_0xf351('0x43')]=_0x1b7ff6[_0xf351('0x39')]['id'];return getContent(_0x1b7ff6[_0xf351('0x26')])[_0xf351('0x22')](function(_0x5439f4){_0x203efb[_0xf351('0x26')]=_0x5439f4;return getRecipients(_0xddd30e);})['then'](function(_0xb5631c){_0x203efb['recipientsId']=_[_0xf351('0x44')](_0xb5631c)[_0xf351('0x45')](',');return db[_0xf351('0x46')][_0xf351('0x47')](function(_0x394026){return db['UserNotification'][_0xf351('0x48')](_0x203efb,{'raw':!![],'transaction':_0x394026})[_0xf351('0x22')](function(_0xe02fb0){var _0x204597={'sender':_0x203efb[_0xf351('0x3f')],'description':_0x203efb[_0xf351('0x40')],'content':_0x203efb['body'],'beep':_0x203efb[_0xf351('0x42')]};_0xb5631c['forEach'](function(_0x5694df){_0x204597[_0xf351('0x49')]=_0x5694df;socket[_0xf351('0x4a')]('userNotification:send',_0x204597);});return _0xe02fb0;});});})[_0xf351('0x22')](respondWithResult(_0x2996f0,0xc9))[_0xf351('0x4b')](handleError(_0x2996f0,null));};function getContent(_0x25a4f8){return new BPromise(function(_0x4d617f,_0x5b07f9){if(_0x25a4f8['text']){_0x4d617f(_0x25a4f8[_0xf351('0x28')]);return;}return db[_0xf351('0x4c')][_0xf351('0x4d')]({'attributes':[_0xf351('0x4e')],'where':{'id':_0x25a4f8[_0xf351('0x29')]},'raw':!![]})[_0xf351('0x22')](function(_0x3823f8){if(!_0x3823f8)throw new db['Sequelize'][(_0xf351('0x2d'))](_0xf351('0x4f'));var _0x4d500d=Mustache[_0xf351('0x50')](_0x3823f8[_0xf351('0x4e')],_0x25a4f8[_0xf351('0x2b')]);_0x4d617f(_0x4d500d);})['catch'](function(_0xf473cc){_0x5b07f9(_0xf473cc);});});}function getRecipients(_0x1e8d68){return new BPromise(function(_0x3fcb04,_0x4dc06a){var _0x45d8a8=[];var _0x119687=[];_0x1e8d68['forEach'](function(_0x47ced7){var _0x51bbf8=_[_0xf351('0x51')](_0x47ced7['model'][_0xf351('0x3d')]());if(_0x51bbf8===_0xf351('0x52')){_0x45d8a8=_[_0xf351('0x53')](_0x45d8a8,_0x47ced7['ids']);}else{if(_['includes'](_0x51bbf8,'queue'))_0x51bbf8=_0x51bbf8[_0xf351('0x54')]('queue',_0xf351('0x55'));_0x47ced7['ids'][_0xf351('0x56')](function(_0x2e6d6d){_0x119687[_0xf351('0x57')](getAgents(_0x51bbf8,_0x2e6d6d));});}});return BPromise[_0xf351('0x58')](_0x119687)[_0xf351('0x22')](function(_0x4ab790){_0x45d8a8=_[_0xf351('0x53')](_0x45d8a8,_[_0xf351('0x59')](_0x4ab790));_0x3fcb04(_0x45d8a8);})[_0xf351('0x4b')](function(_0x4cc34d){_0x4dc06a(_0x4cc34d);});});}function getAgents(_0xfc8d3c,_0x14e753){return new BPromise(function(_0x2295b0,_0x158cac){return db[_0xfc8d3c][_0xf351('0x4d')]({'where':{'id':_0x14e753}})[_0xf351('0x22')](function(_0x2fa249){return _0x2fa249[_0xf351('0x5a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x18e1be){var _0x1525de=_[_0xf351('0x5b')](_0x18e1be,'id');_0x2295b0(_0x1525de);});})[_0xf351('0x4b')](function(_0x6d2764){_0x158cac(_0x6d2764);});});}
\ No newline at end of file
+var _0xc5df=['emit','Template','findOne','render','html','catch','forEach','startCase','User','union','ids','queue','replace','Queue','push','flatten','map','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','voicequeue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','user','fullname','recipientsDescription','beep','join','create','senderName','recipient'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xc5df,0xbf));var _0xfc5d=function(_0x4659eb,_0xa122ad){_0x4659eb=_0x4659eb-0x0;var _0x1e468a=_0xc5df[_0x4659eb];return _0x1e468a;};'use strict';var emlformat=require(_0xfc5d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfc5d('0x1'));var rp=require('request-promise');var moment=require(_0xfc5d('0x2'));var BPromise=require(_0xfc5d('0x3'));var Mustache=require(_0xfc5d('0x4'));var util=require(_0xfc5d('0x5'));var path=require(_0xfc5d('0x6'));var sox=require('sox');var csv=require(_0xfc5d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc5d('0x8'));var squel=require(_0xfc5d('0x9'));var crypto=require(_0xfc5d('0xa'));var jsforce=require(_0xfc5d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfc5d('0x7'));var querystring=require(_0xfc5d('0xc'));var Papa=require(_0xfc5d('0xd'));var Redis=require('ioredis');var authService=require(_0xfc5d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfc5d('0xf'));var hardwareService=require(_0xfc5d('0x10'));var logger=require('../../config/logger')(_0xfc5d('0x11'));var utils=require(_0xfc5d('0x12'));var config=require(_0xfc5d('0x13'));var licenseUtil=require(_0xfc5d('0x14'));var db=require('../../mysqldb')['db'];config[_0xfc5d('0x15')]=_[_0xfc5d('0x16')](config[_0xfc5d('0x15')],{'host':_0xfc5d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc5d('0x18'))[_0xfc5d('0x19')](socket);function respondWithStatusCode(_0x2ff716,_0xa1d560){_0xa1d560=_0xa1d560||0xcc;return function(_0x41e173){if(_0x41e173){return _0x2ff716[_0xfc5d('0x1a')](_0xa1d560);}return _0x2ff716[_0xfc5d('0x1b')](_0xa1d560)[_0xfc5d('0x1c')]();};}function respondWithResult(_0x852322,_0x11a7da){_0x11a7da=_0x11a7da||0xc8;return function(_0x24953d){if(_0x24953d){return _0x852322[_0xfc5d('0x1b')](_0x11a7da)[_0xfc5d('0x1d')](_0x24953d);}};}function respondWithFilteredResult(_0x177afb,_0x4f633d){return function(_0x22c0bb){if(_0x22c0bb){var _0x3c3325=typeof _0x4f633d[_0xfc5d('0x1e')]===_0xfc5d('0x1f')&&typeof _0x4f633d[_0xfc5d('0x20')]===_0xfc5d('0x1f');var _0xcde73c=_0x22c0bb[_0xfc5d('0x21')];var _0x5c307f=_0x3c3325?0x0:_0x4f633d[_0xfc5d('0x1e')];var _0x55971b=_0x3c3325?_0x22c0bb['count']:_0x4f633d[_0xfc5d('0x1e')]+_0x4f633d['limit'];var _0x4d2398;if(_0x55971b>=_0xcde73c){_0x55971b=_0xcde73c;_0x4d2398=0xc8;}else{_0x4d2398=0xce;}_0x177afb[_0xfc5d('0x1b')](_0x4d2398);return _0x177afb['set']('Content-Range',_0x5c307f+'-'+_0x55971b+'/'+_0xcde73c)[_0xfc5d('0x1d')](_0x22c0bb);}return null;};}function patchUpdates(_0x2ea39c){return function(_0x26150c){try{jsonpatch[_0xfc5d('0x22')](_0x26150c,_0x2ea39c,!![]);}catch(_0x582037){return BPromise[_0xfc5d('0x23')](_0x582037);}return _0x26150c[_0xfc5d('0x24')]();};}function saveUpdates(_0xbcaa85,_0xf25de5){return function(_0x42fd23){if(_0x42fd23){return _0x42fd23['update'](_0xbcaa85)[_0xfc5d('0x25')](function(_0xec0353){return _0xec0353;});}return null;};}function removeEntity(_0x4e890a,_0x250ff3){return function(_0x59e299){if(_0x59e299){return _0x59e299[_0xfc5d('0x26')]()[_0xfc5d('0x25')](function(){_0x4e890a[_0xfc5d('0x1b')](0xcc)[_0xfc5d('0x1c')]();});}};}function handleEntityNotFound(_0x444ff8,_0x2ce1e9){return function(_0x1dc4a6){if(!_0x1dc4a6){_0x444ff8[_0xfc5d('0x1a')](0x194);}return _0x1dc4a6;};}function handleError(_0x218899,_0x5dc485){_0x5dc485=_0x5dc485||0x1f4;return function(_0x42640d){logger[_0xfc5d('0x27')](_0x42640d[_0xfc5d('0x28')]);if(_0x42640d[_0xfc5d('0x29')]){delete _0x42640d[_0xfc5d('0x29')];}_0x218899[_0xfc5d('0x1b')](_0x5dc485)[_0xfc5d('0x2a')](_0x42640d);};}exports[_0xfc5d('0x2b')]=function(_0x59a709,_0xd40efb,_0x22b267){if(!_0x59a709[_0xfc5d('0x2c')][_0xfc5d('0x2d')](_0xfc5d('0x2e'))&&!_0x59a709[_0xfc5d('0x2c')][_0xfc5d('0x2d')](_0xfc5d('0x2f'))){throw new db['Sequelize'][(_0xfc5d('0x30'))](_0xfc5d('0x31'));}else{if(_0x59a709[_0xfc5d('0x2c')][_0xfc5d('0x2d')](_0xfc5d('0x2f'))&&!_0x59a709[_0xfc5d('0x2c')][_0xfc5d('0x2d')](_0xfc5d('0x32'))){throw new db[(_0xfc5d('0x33'))][(_0xfc5d('0x30'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x59a709['body'][_0xfc5d('0x2d')]('recipients')){throw new db[(_0xfc5d('0x33'))][(_0xfc5d('0x30'))](_0xfc5d('0x34'));}else{try{var _0x41a73b=JSON[_0xfc5d('0x35')](_0x59a709['body']['recipients']);}catch(_0x5337f4){logger[_0xfc5d('0x27')](_0x5337f4);throw new db[(_0xfc5d('0x33'))][(_0xfc5d('0x30'))](_0xfc5d('0x36'));}var _0x32a1d7=['chatqueue',_0xfc5d('0x37'),'mailqueue','openchannelqueue','smsqueue',_0xfc5d('0x38'),'whatsappqueue','team','user'];if(_[_0xfc5d('0x39')](_0x41a73b,function(_0x5c72f2){return!_[_0xfc5d('0x3a')](_0x32a1d7,_0x5c72f2[_0xfc5d('0x3b')][_0xfc5d('0x3c')]());})){throw new db['Sequelize'][(_0xfc5d('0x30'))](_0xfc5d('0x3d'));}}}var _0x5f0a64={};_0x5f0a64['senderName']=_0x59a709[_0xfc5d('0x2c')][_0xfc5d('0x2d')]('senderName')?_0x59a709[_0xfc5d('0x2c')]['senderName']:_0x59a709[_0xfc5d('0x3e')][_0xfc5d('0x3f')];_0x5f0a64[_0xfc5d('0x40')]=_['isEmpty'](_0x59a709[_0xfc5d('0x2c')]['recipientsDescription'])?null:_0x59a709[_0xfc5d('0x2c')][_0xfc5d('0x40')];_0x5f0a64[_0xfc5d('0x41')]=_0x59a709['body'][_0xfc5d('0x41')]||![];_0x5f0a64['SenderId']=_0x59a709[_0xfc5d('0x3e')]['id'];return getContent(_0x59a709[_0xfc5d('0x2c')])[_0xfc5d('0x25')](function(_0x4435ed){_0x5f0a64[_0xfc5d('0x2c')]=_0x4435ed;return getRecipients(_0x41a73b);})[_0xfc5d('0x25')](function(_0x45e540){_0x5f0a64['recipientsId']=_['sortBy'](_0x45e540)[_0xfc5d('0x42')](',');return db['sequelize']['transaction'](function(_0x5f371f){return db['UserNotification'][_0xfc5d('0x43')](_0x5f0a64,{'raw':!![],'transaction':_0x5f371f})[_0xfc5d('0x25')](function(_0x52a583){var _0x5a9d4f={'sender':_0x5f0a64[_0xfc5d('0x44')],'description':_0x5f0a64[_0xfc5d('0x40')],'content':_0x5f0a64[_0xfc5d('0x2c')],'beep':_0x5f0a64['beep']};_0x45e540['forEach'](function(_0x170a6d){_0x5a9d4f[_0xfc5d('0x45')]=_0x170a6d;socket[_0xfc5d('0x46')]('userNotification:send',_0x5a9d4f);});return _0x52a583;});});})['then'](respondWithResult(_0xd40efb,0xc9))['catch'](handleError(_0xd40efb,null));};function getContent(_0x356808){return new BPromise(function(_0x4c798d,_0x8478ea){if(_0x356808[_0xfc5d('0x2e')]){_0x4c798d(_0x356808[_0xfc5d('0x2e')]);return;}return db[_0xfc5d('0x47')][_0xfc5d('0x48')]({'attributes':['html'],'where':{'id':_0x356808[_0xfc5d('0x2f')]},'raw':!![]})['then'](function(_0x59495f){if(!_0x59495f)throw new db[(_0xfc5d('0x33'))][(_0xfc5d('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2e7154=Mustache[_0xfc5d('0x49')](_0x59495f[_0xfc5d('0x4a')],_0x356808[_0xfc5d('0x32')]);_0x4c798d(_0x2e7154);})[_0xfc5d('0x4b')](function(_0x343fa8){_0x8478ea(_0x343fa8);});});}function getRecipients(_0x2c97f4){return new BPromise(function(_0x1ab56b,_0x19fe35){var _0x2b0b9d=[];var _0x790f12=[];_0x2c97f4[_0xfc5d('0x4c')](function(_0x51bfa3){var _0x3ae733=_[_0xfc5d('0x4d')](_0x51bfa3[_0xfc5d('0x3b')][_0xfc5d('0x3c')]());if(_0x3ae733===_0xfc5d('0x4e')){_0x2b0b9d=_[_0xfc5d('0x4f')](_0x2b0b9d,_0x51bfa3[_0xfc5d('0x50')]);}else{if(_[_0xfc5d('0x3a')](_0x3ae733,_0xfc5d('0x51')))_0x3ae733=_0x3ae733[_0xfc5d('0x52')](_0xfc5d('0x51'),_0xfc5d('0x53'));_0x51bfa3[_0xfc5d('0x50')][_0xfc5d('0x4c')](function(_0x172cf2){_0x790f12[_0xfc5d('0x54')](getAgents(_0x3ae733,_0x172cf2));});}});return BPromise['all'](_0x790f12)['then'](function(_0x47db14){_0x2b0b9d=_[_0xfc5d('0x4f')](_0x2b0b9d,_[_0xfc5d('0x55')](_0x47db14));_0x1ab56b(_0x2b0b9d);})[_0xfc5d('0x4b')](function(_0x20f805){_0x19fe35(_0x20f805);});});}function getAgents(_0x2b4e7e,_0x4a12ca){return new BPromise(function(_0x269ffb,_0x597101){return db[_0x2b4e7e]['findOne']({'where':{'id':_0x4a12ca}})[_0xfc5d('0x25')](function(_0x457e23){return _0x457e23['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x1f3e3c){var _0x1f809b=_[_0xfc5d('0x56')](_0x1f3e3c,'id');_0x269ffb(_0x1f809b);});})[_0xfc5d('0x4b')](function(_0x217b2b){_0x597101(_0x217b2b);});});}
\ No newline at end of file