b275fa17eb4dafdc17ff31b6c58273090d7e378b
[motion2.git] / server / api / whatsappMessage / whatsappMessage.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xf219=['jayson/promise','client','test','Sequelize','ValidationError','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','set','save','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','get','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','reject','agent','null','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','defaults','redis','localhost'];(function(_0x5d90b8,_0x528b3a){var _0x5712b3=function(_0x478049){while(--_0x478049){_0x5d90b8['push'](_0x5d90b8['shift']());}};_0x5712b3(++_0x528b3a);}(_0xf219,0x65));var _0x9f21=function(_0xfc36d8,_0x233b0b){_0xfc36d8=_0xfc36d8-0x0;var _0x234f42=_0xf219[_0xfc36d8];return _0x234f42;};'use strict';var pdf=require(_0x9f21('0x0'));var emlformat=require(_0x9f21('0x1'));var rimraf=require(_0x9f21('0x2'));var zipdir=require(_0x9f21('0x3'));var jsonpatch=require(_0x9f21('0x4'));var rp=require(_0x9f21('0x5'));var moment=require(_0x9f21('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9f21('0x7'));var util=require(_0x9f21('0x8'));var path=require(_0x9f21('0x9'));var sox=require('sox');var csv=require(_0x9f21('0xa'));var ejs=require(_0x9f21('0xb'));var fs=require('fs');var _=require(_0x9f21('0xc'));var squel=require('squel');var crypto=require(_0x9f21('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f21('0xe'));var toCsv=require(_0x9f21('0xa'));var querystring=require(_0x9f21('0xf'));var Papa=require('papaparse');var Redis=require(_0x9f21('0x10'));var authService=require(_0x9f21('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9f21('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f21('0x13'))(_0x9f21('0x14'));var utils=require(_0x9f21('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9f21('0x16')](config[_0x9f21('0x17')],{'host':_0x9f21('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f21('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x9f21('0x19'));var client=jayson[_0x9f21('0x1a')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3a5f4c,_0x50562b,_0x516447){if(_0x516447){var _0x696b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x696b[_0x9f21('0x1b')](_0x50562b)){return _0x3a5f4c;}else{throw new db[(_0x9f21('0x1c'))][(_0x9f21('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3a5f4c;}}function respondWithRpcPromise(_0x389450,_0x1543a4,_0x33cd90,_0x26ed27){return new BPromise(function(_0x37fdaf,_0x22c40e){var _0x19311e=_0x26ed27||client;return _0x19311e[_0x9f21('0x1e')](_0x389450,_0x33cd90)[_0x9f21('0x1f')](function(_0x3a3fc4){logger[_0x9f21('0x20')](_0x9f21('0x21'),_0x1543a4,_0x9f21('0x22'));logger[_0x9f21('0x23')](_0x9f21('0x24'),_0x1543a4,_0x9f21('0x22'),JSON[_0x9f21('0x25')](_0x3a3fc4));if(_0x3a3fc4[_0x9f21('0x26')]){if(_0x3a3fc4[_0x9f21('0x26')][_0x9f21('0x27')]===0x1f4){logger['error'](_0x9f21('0x21'),_0x1543a4,_0x3a3fc4[_0x9f21('0x26')][_0x9f21('0x28')]);return _0x22c40e(_0x3a3fc4['error'][_0x9f21('0x28')]);}logger['error'](_0x9f21('0x21'),_0x1543a4,_0x3a3fc4['error']['message']);return _0x37fdaf(_0x3a3fc4[_0x9f21('0x26')][_0x9f21('0x28')]);}else{logger[_0x9f21('0x20')](_0x9f21('0x21'),_0x1543a4,_0x9f21('0x22'));_0x37fdaf(_0x3a3fc4[_0x9f21('0x29')][_0x9f21('0x28')]);}})[_0x9f21('0x2a')](function(_0x1e98d8){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1543a4,_0x1e98d8);_0x22c40e(_0x1e98d8);});});}function respondWithStatusCode(_0x28d4fd,_0x5a21bb){_0x5a21bb=_0x5a21bb||0xcc;return function(_0x4c862c){if(_0x4c862c){return _0x28d4fd['sendStatus'](_0x5a21bb);}return _0x28d4fd[_0x9f21('0x2b')](_0x5a21bb)[_0x9f21('0x2c')]();};}function respondWithResult(_0x1c6cda,_0x2513b2){_0x2513b2=_0x2513b2||0xc8;return function(_0x359676){if(_0x359676){return _0x1c6cda[_0x9f21('0x2b')](_0x2513b2)[_0x9f21('0x2d')](_0x359676);}};}function respondWithFilteredResult(_0x29a7af,_0x5264e7){return function(_0x416383){if(_0x416383){var _0x5a2838=_0x416383[_0x9f21('0x2e')],_0xe82c6d=_0x5264e7[_0x9f21('0x2f')],_0x16a8de=_0x5264e7[_0x9f21('0x2f')]+_0x5264e7['limit'],_0x5c5d75;if(_0x16a8de>=_0x5a2838){_0x16a8de=_0x5a2838;_0x5c5d75=0xc8;}else{_0x5c5d75=0xce;}_0x29a7af[_0x9f21('0x2b')](_0x5c5d75);return _0x29a7af[_0x9f21('0x30')]('Content-Range',_0xe82c6d+'-'+_0x16a8de+'/'+_0x5a2838)[_0x9f21('0x2d')](_0x416383);}return null;};}function patchUpdates(_0x356d68){return function(_0x3bd2b6){try{jsonpatch['apply'](_0x3bd2b6,_0x356d68,!![]);}catch(_0x583808){return BPromise['reject'](_0x583808);}return _0x3bd2b6[_0x9f21('0x31')]();};}function saveUpdates(_0x34add9,_0x22e32f){return function(_0x14e704){if(_0x14e704){return _0x14e704[_0x9f21('0x32')](_0x34add9)[_0x9f21('0x1f')](function(_0x20d3d3){return _0x20d3d3;});}return null;};}function removeEntity(_0x5bd101,_0x3c7db7){return function(_0xb36de9){if(_0xb36de9){return _0xb36de9[_0x9f21('0x33')]()[_0x9f21('0x1f')](function(){_0x5bd101[_0x9f21('0x2b')](0xcc)[_0x9f21('0x2c')]();});}};}function handleEntityNotFound(_0x5ec834,_0x250eb9){return function(_0x28d7c2){if(!_0x28d7c2){_0x5ec834[_0x9f21('0x34')](0x194);}return _0x28d7c2;};}function handleError(_0x24af3c,_0xd0aa09){_0xd0aa09=_0xd0aa09||0x1f4;return function(_0x437f7b){logger[_0x9f21('0x26')](_0x437f7b[_0x9f21('0x35')]);if(_0x437f7b[_0x9f21('0x36')]){delete _0x437f7b['name'];}_0x24af3c['status'](_0xd0aa09)[_0x9f21('0x37')](_0x437f7b);};}exports[_0x9f21('0x38')]=function(_0x389304,_0x1d5ea2){var _0x14aeab={},_0x46feec={},_0x4d2405={'count':0x0,'rows':[]};var _0x537cbb=_[_0x9f21('0x39')](db[_0x9f21('0x3a')]['rawAttributes'],function(_0x116a82){return{'name':_0x116a82[_0x9f21('0x3b')],'type':_0x116a82[_0x9f21('0x3c')]['key']};});_0x46feec['model']=_[_0x9f21('0x39')](_0x537cbb,_0x9f21('0x36'));_0x46feec[_0x9f21('0x3d')]=_[_0x9f21('0x3e')](_0x389304[_0x9f21('0x3d')]);_0x46feec['filters']=_[_0x9f21('0x3f')](_0x46feec[_0x9f21('0x40')],_0x46feec[_0x9f21('0x3d')]);_0x14aeab[_0x9f21('0x41')]=_[_0x9f21('0x3f')](_0x46feec['model'],qs[_0x9f21('0x42')](_0x389304[_0x9f21('0x3d')]['fields']));_0x14aeab['attributes']=_0x14aeab['attributes'][_0x9f21('0x43')]?_0x14aeab[_0x9f21('0x41')]:_0x46feec['model'];if(!_0x389304[_0x9f21('0x3d')][_0x9f21('0x44')](_0x9f21('0x45'))){_0x14aeab[_0x9f21('0x46')]=qs[_0x9f21('0x46')](_0x389304['query'][_0x9f21('0x46')]);_0x14aeab['offset']=qs[_0x9f21('0x2f')](_0x389304[_0x9f21('0x3d')][_0x9f21('0x2f')]);}_0x14aeab[_0x9f21('0x47')]=qs[_0x9f21('0x48')](_0x389304[_0x9f21('0x3d')][_0x9f21('0x48')]);_0x14aeab['where']=qs[_0x9f21('0x49')](_[_0x9f21('0x4a')](_0x389304['query'],_0x46feec[_0x9f21('0x49')]),_0x537cbb);if(_0x389304['query']['filter']){_0x14aeab[_0x9f21('0x4b')]=_[_0x9f21('0x4c')](_0x14aeab[_0x9f21('0x4b')],{'$or':_['map'](_0x537cbb,function(_0x493c41){if(_0x493c41[_0x9f21('0x3c')]!==_0x9f21('0x4d')){var _0x89fa60={};_0x89fa60[_0x493c41[_0x9f21('0x36')]]={'$like':'%'+_0x389304[_0x9f21('0x3d')][_0x9f21('0x4e')]+'%'};return _0x89fa60;}})});}_0x14aeab=_[_0x9f21('0x4c')]({},_0x14aeab,_0x389304[_0x9f21('0x4f')]);var _0x1f31e6={'where':_0x14aeab[_0x9f21('0x4b')]};return db[_0x9f21('0x3a')]['count'](_0x1f31e6)['then'](function(_0x47484b){_0x4d2405[_0x9f21('0x2e')]=_0x47484b;if(_0x389304[_0x9f21('0x3d')][_0x9f21('0x50')]){_0x14aeab[_0x9f21('0x51')]=[{'all':!![]}];}return db[_0x9f21('0x3a')][_0x9f21('0x52')](_0x14aeab);})[_0x9f21('0x1f')](function(_0x4401a6){_0x4d2405['rows']=_0x4401a6;return _0x4d2405;})['then'](respondWithFilteredResult(_0x1d5ea2,_0x14aeab))[_0x9f21('0x2a')](handleError(_0x1d5ea2,null));};exports[_0x9f21('0x53')]=function(_0x4e6ecc,_0x16d4af){var _0x2e85a={'raw':!![],'where':{'id':_0x4e6ecc[_0x9f21('0x54')]['id']}},_0x1f75e1={};_0x1f75e1[_0x9f21('0x40')]=_[_0x9f21('0x3e')](db[_0x9f21('0x3a')][_0x9f21('0x55')]);_0x1f75e1[_0x9f21('0x3d')]=_[_0x9f21('0x3e')](_0x4e6ecc[_0x9f21('0x3d')]);_0x1f75e1[_0x9f21('0x49')]=_['intersection'](_0x1f75e1[_0x9f21('0x40')],_0x1f75e1[_0x9f21('0x3d')]);_0x2e85a['attributes']=_[_0x9f21('0x3f')](_0x1f75e1[_0x9f21('0x40')],qs['fields'](_0x4e6ecc['query'][_0x9f21('0x42')]));_0x2e85a[_0x9f21('0x41')]=_0x2e85a[_0x9f21('0x41')][_0x9f21('0x43')]?_0x2e85a[_0x9f21('0x41')]:_0x1f75e1[_0x9f21('0x40')];if(_0x4e6ecc[_0x9f21('0x3d')][_0x9f21('0x50')]){_0x2e85a['include']=[{'all':!![]}];}_0x2e85a=_[_0x9f21('0x4c')]({},_0x2e85a,_0x4e6ecc[_0x9f21('0x4f')]);return db[_0x9f21('0x3a')][_0x9f21('0x56')](_0x2e85a)[_0x9f21('0x1f')](handleEntityNotFound(_0x16d4af,null))['then'](respondWithResult(_0x16d4af,null))['catch'](handleError(_0x16d4af,null));};exports['create']=function(_0x2331bc,_0x40adc6){return db[_0x9f21('0x3a')][_0x9f21('0x57')](_0x2331bc['body'],{})[_0x9f21('0x1f')](respondWithResult(_0x40adc6,0xc9))[_0x9f21('0x2a')](handleError(_0x40adc6,null));};exports[_0x9f21('0x32')]=function(_0x203253,_0xce8fe9){if(_0x203253[_0x9f21('0x58')]['id']){delete _0x203253[_0x9f21('0x58')]['id'];}return db['WhatsappMessage'][_0x9f21('0x56')]({'where':{'id':_0x203253[_0x9f21('0x54')]['id']}})[_0x9f21('0x1f')](handleEntityNotFound(_0xce8fe9,null))[_0x9f21('0x1f')](saveUpdates(_0x203253[_0x9f21('0x58')],null))['then'](respondWithResult(_0xce8fe9,null))[_0x9f21('0x2a')](handleError(_0xce8fe9,null));};exports[_0x9f21('0x33')]=function(_0x394852,_0x579d2e){return db[_0x9f21('0x3a')][_0x9f21('0x56')]({'where':{'id':_0x394852[_0x9f21('0x54')]['id']}})['then'](handleEntityNotFound(_0x579d2e,null))['then'](removeEntity(_0x579d2e,null))[_0x9f21('0x2a')](handleError(_0x579d2e,null));};exports[_0x9f21('0x59')]=function(_0x2b90da,_0xa4df57){return db[_0x9f21('0x3a')][_0x9f21('0x59')]()['then'](respondWithResult(_0xa4df57,null))['catch'](handleError(_0xa4df57,null));};var interaction_log=require(_0x9f21('0x13'))(_0x9f21('0x5a'));exports['accept']=function(_0x1eed8b,_0x2b6c06,_0x630b86){var _0x52a61f={'channel':_0x9f21('0x5b')};if(_0x1eed8b[_0x9f21('0x58')]['id']){delete _0x1eed8b[_0x9f21('0x58')]['id'];}_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x5c')]=!![];_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x5d')]=moment()[_0x9f21('0x5e')](_0x9f21('0x5f'));_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x60')]=_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x60')]||_0x1eed8b[_0x9f21('0x61')]['id'];return db['WhatsappMessage'][_0x9f21('0x56')]({'where':{'id':_0x1eed8b['params']['id'],'UserId':null},'include':[{'model':db[_0x9f21('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x2b6c06,null))[_0x9f21('0x1f')](saveUpdates(_0x1eed8b[_0x9f21('0x58')],null))[_0x9f21('0x1f')](function(_0x570876){if(_0x570876){_0x52a61f[_0x9f21('0x28')]=_0x570876['get']({'plain':!![]});return db[_0x9f21('0x63')][_0x9f21('0x56')]({'where':{'id':_0x570876[_0x9f21('0x64')]}});}return null;})[_0x9f21('0x1f')](handleEntityNotFound(_0x2b6c06,null))[_0x9f21('0x1f')](function(_0x159f3f){if(_0x159f3f){return _0x159f3f['update']({'UserId':_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x60')],'read1stAt':_[_0x9f21('0x65')](_0x159f3f['read1stAt'])?moment()[_0x9f21('0x5e')](_0x9f21('0x5f')):undefined});}return null;})[_0x9f21('0x1f')](function(_0x4cf0a3){if(_0x4cf0a3){_0x52a61f[_0x9f21('0x66')]=_0x4cf0a3[_0x9f21('0x67')]({'plain':!![]});interaction_log[_0x9f21('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1eed8b['user']['id'],_0x1eed8b['user'][_0x9f21('0x36')],_0x1eed8b['user'][_0x9f21('0x68')],_0x52a61f[_0x9f21('0x66')]['id'],_0x1eed8b['body']?JSON[_0x9f21('0x25')](_0x1eed8b['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x9f21('0x69'),_0x52a61f);}return null;})[_0x9f21('0x1f')](function(_0x5aa32c){if(_0x5aa32c){if(_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x6a')]){_0x52a61f['message'][_0x9f21('0x6b')]=util['format']('SIP/%s',_0x1eed8b[_0x9f21('0x61')]['name']);_0x52a61f[_0x9f21('0x28')][_0x9f21('0x6c')]=_0x52a61f[_0x9f21('0x6c')];_0x52a61f[_0x9f21('0x28')][_0x9f21('0x6d')]='accept';return respondWithRpcPromise(_0x9f21('0x6e'),_0x9f21('0x6e'),{'event':_0x9f21('0x6f'),'message':_0x52a61f['message']},client9002)[_0x9f21('0x1f')](function(){return _0x52a61f;});}return _0x52a61f;}return null;})[_0x9f21('0x1f')](respondWithResult(_0x2b6c06,null))[_0x9f21('0x2a')](handleError(_0x2b6c06,null));};var interaction_log=require(_0x9f21('0x13'))(_0x9f21('0x5a'));exports[_0x9f21('0x70')]=function(_0x5445d6,_0x77a419,_0x44696b){var _0x4e53fa={'agent':{},'channel':_0x9f21('0x5b')};if(_0x5445d6[_0x9f21('0x58')]['id']){delete _0x5445d6[_0x9f21('0x58')]['id'];}_0x5445d6[_0x9f21('0x58')]['UserId']=_0x5445d6[_0x9f21('0x58')][_0x9f21('0x60')]||_0x5445d6['user']['id'];_0x4e53fa[_0x9f21('0x71')]['id']=_0x5445d6['body'][_0x9f21('0x60')];return db[_0x9f21('0x3a')][_0x9f21('0x56')]({'where':{'id':_0x5445d6['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x77a419,null))[_0x9f21('0x1f')](function(_0x30c677){if(_0x30c677){_0x4e53fa[_0x9f21('0x28')]=_0x30c677[_0x9f21('0x67')]({'plain':!![]});return db[_0x9f21('0x63')][_0x9f21('0x56')]({'where':{'id':_0x30c677['WhatsappInteractionId']}});}return null;})[_0x9f21('0x1f')](handleEntityNotFound(_0x77a419,null))['then'](function(_0x50d8a4){if(_0x50d8a4){_0x4e53fa['interaction']=_0x50d8a4[_0x9f21('0x67')]({'plain':!![]});interaction_log[_0x9f21('0x20')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5445d6[_0x9f21('0x61')]['id'],_0x5445d6[_0x9f21('0x61')][_0x9f21('0x36')],_0x5445d6['user']['role'],_0x4e53fa['interaction']['id'],_0x5445d6['body']?JSON[_0x9f21('0x25')](_0x5445d6['body']):_0x9f21('0x72'));return respondWithRpcPromise(_0x9f21('0x73'),_0x9f21('0x74'),_0x4e53fa);}return null;})['then'](function(_0x110f56){if(_0x110f56){_0x110f56[_0x9f21('0x28')][_0x9f21('0x6b')]=util[_0x9f21('0x5e')]('SIP/%s',_0x5445d6[_0x9f21('0x61')][_0x9f21('0x36')]);_0x110f56[_0x9f21('0x28')][_0x9f21('0x6c')]=_0x4e53fa[_0x9f21('0x6c')];_0x110f56['message'][_0x9f21('0x6d')]=_0x9f21('0x70');respondWithRpcPromise(_0x9f21('0x6e'),_0x9f21('0x6e'),{'event':_0x9f21('0x75'),'message':_0x110f56['message']},client9002);return _0x4e53fa;}return null;})[_0x9f21('0x1f')](respondWithResult(_0x77a419,null))[_0x9f21('0x2a')](handleError(_0x77a419,null));};exports[_0x9f21('0x2b')]=function(_0x144371,_0x21d4ad,_0x24d177){if(_0x144371[_0x9f21('0x58')]['id']){delete _0x144371[_0x9f21('0x58')]['id'];}var _0x5cea1e;return db[_0x9f21('0x3a')][_0x9f21('0x56')]({'where':{'id':_0x144371['params']['id']}})[_0x9f21('0x1f')](handleEntityNotFound(_0x21d4ad,null))[_0x9f21('0x1f')](function(_0x27171a){if(_0x27171a){_0x5cea1e=_0x27171a;return db[_0x9f21('0x76')][_0x9f21('0x56')]({'where':{'id':_0x27171a['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x21d4ad,null))[_0x9f21('0x1f')](function(_0x59a0de){if(_0x59a0de){logger['debug'](_0x9f21('0x77'),_0x9f21('0x2b'),_0x9f21('0x78'),_0x59a0de[_0x9f21('0x3c')],util[_0x9f21('0x79')](_0x144371[_0x9f21('0x58')],{'showHidden':![],'depth':null}));switch(_0x59a0de['type']){case _0x9f21('0x7a'):if(_0x144371[_0x9f21('0x58')][_0x9f21('0x7b')]&&_0x144371[_0x9f21('0x58')][_0x9f21('0x7b')]===_0x5cea1e['messageId']&&_0x144371['body'][_0x9f21('0x7c')]&&_0x144371[_0x9f21('0x58')][_0x9f21('0x7c')]===_0x9f21('0x5c')){return _0x5cea1e[_0x9f21('0x32')]({'read':!![]});}else{logger[_0x9f21('0x26')](_0x9f21('0x7d'),_0x9f21('0x2b'),_0x9f21('0x7a'),util['inspect'](_0x144371[_0x9f21('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x5cea1e;}})[_0x9f21('0x1f')](respondWithResult(_0x21d4ad,null))[_0x9f21('0x2a')](handleError(_0x21d4ad,null));};