Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.controller.js
index 6d9904b..7a84eaa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb47=['clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','isEmpty','t.id\x20IN\x20?','resolve','WhatsappAccountId','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','options','create','describe','addMessage','ids','omit','getMessages','WhatsappMessage','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','transcript-%d-%s.zip','User','CmContact','lastName','attachments','Attachment','Messages','direction','secret','read','Account','Owner','get','mkdirSync','40px','<div\x20class=\x22header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h5>Interaction\x20Transcript</h5>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>','30px','<hr\x20class=\x22separator\x22/>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22footer\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22left\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>%s</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22center\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>{{page}}/{{pages}}</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22right\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span>%s</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>','%s\x20#%d','Whatsapp','N.A.','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','System','firstName','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','count','offset','set','json','apply','reject','update','then','destroy','sendStatus','error','name','map','fullname','Tags','TagIds','split','forEach','push','catch','WhatsappInteraction','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','field','color','from','tools_tags','select','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','find','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','compact','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes'];(function(_0x4a42f0,_0x2da65d){var _0x3dc532=function(_0xb60cdf){while(--_0xb60cdf){_0x4a42f0['push'](_0x4a42f0['shift']());}};_0x3dc532(++_0x2da65d);}(_0xbb47,0x6e));var _0x7bb4=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0xbb47[_0x178668];return _0x26107d;};'use strict';var pdf=require(_0x7bb4('0x0'));var emlformat=require(_0x7bb4('0x1'));var rimraf=require(_0x7bb4('0x2'));var zipdir=require(_0x7bb4('0x3'));var jsonpatch=require(_0x7bb4('0x4'));var rp=require(_0x7bb4('0x5'));var moment=require(_0x7bb4('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7bb4('0x7'));var util=require(_0x7bb4('0x8'));var path=require('path');var sox=require(_0x7bb4('0x9'));var csv=require(_0x7bb4('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bb4('0xb'));var deskjs=require(_0x7bb4('0xc'));var toCsv=require(_0x7bb4('0xa'));var querystring=require('querystring');var Papa=require(_0x7bb4('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7bb4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bb4('0xf'));var logger=require('../../config/logger')(_0x7bb4('0x10'));var utils=require(_0x7bb4('0x11'));var config=require(_0x7bb4('0x12'));var licenseUtil=require(_0x7bb4('0x13'));var db=require(_0x7bb4('0x14'))['db'];config['redis']=_[_0x7bb4('0x15')](config[_0x7bb4('0x16')],{'host':_0x7bb4('0x17'),'port':0x18eb});var socket=require(_0x7bb4('0x18'))(new Redis(config[_0x7bb4('0x16')]));require('./whatsappInteraction.socket')[_0x7bb4('0x19')](socket);function respondWithStatusCode(_0x1d12b5,_0x48f164){_0x48f164=_0x48f164||0xcc;return function(_0x5b461a){if(_0x5b461a){return _0x1d12b5['sendStatus'](_0x48f164);}return _0x1d12b5[_0x7bb4('0x1a')](_0x48f164)[_0x7bb4('0x1b')]();};}function respondWithResult(_0x5aab28,_0xa07236){_0xa07236=_0xa07236||0xc8;return function(_0x55797e){if(_0x55797e){return _0x5aab28[_0x7bb4('0x1a')](_0xa07236)['json'](_0x55797e);}};}function respondWithFilteredResult(_0x5e7f5d,_0x4250e0){return function(_0x56da52){if(_0x56da52){var _0x1204b7=_0x56da52[_0x7bb4('0x1c')],_0x2315c2=_0x4250e0[_0x7bb4('0x1d')],_0x5ae00b=_0x4250e0[_0x7bb4('0x1d')]+_0x4250e0['limit'],_0x263ea8;if(_0x5ae00b>=_0x1204b7){_0x5ae00b=_0x1204b7;_0x263ea8=0xc8;}else{_0x263ea8=0xce;}_0x5e7f5d[_0x7bb4('0x1a')](_0x263ea8);return _0x5e7f5d[_0x7bb4('0x1e')]('Content-Range',_0x2315c2+'-'+_0x5ae00b+'/'+_0x1204b7)[_0x7bb4('0x1f')](_0x56da52);}return null;};}function patchUpdates(_0x315d3f){return function(_0x2a5992){try{jsonpatch[_0x7bb4('0x20')](_0x2a5992,_0x315d3f,!![]);}catch(_0x4e0c5c){return BPromise[_0x7bb4('0x21')](_0x4e0c5c);}return _0x2a5992['save']();};}function saveUpdates(_0x6c8c90,_0x194bab){return function(_0x2b9806){if(_0x2b9806){return _0x2b9806[_0x7bb4('0x22')](_0x6c8c90)[_0x7bb4('0x23')](function(_0x341204){return _0x341204;});}return null;};}function removeEntity(_0x442e93,_0x23678b){return function(_0x4a2948){if(_0x4a2948){return _0x4a2948[_0x7bb4('0x24')]()[_0x7bb4('0x23')](function(){_0x442e93[_0x7bb4('0x1a')](0xcc)[_0x7bb4('0x1b')]();});}};}function handleEntityNotFound(_0x209597,_0x43d716){return function(_0x41a476){if(!_0x41a476){_0x209597[_0x7bb4('0x25')](0x194);}return _0x41a476;};}function handleError(_0x5b6f7f,_0x1d3e7c){_0x1d3e7c=_0x1d3e7c||0x1f4;return function(_0x154bc5){logger[_0x7bb4('0x26')](_0x154bc5['stack']);if(_0x154bc5[_0x7bb4('0x27')]){delete _0x154bc5[_0x7bb4('0x27')];}_0x5b6f7f[_0x7bb4('0x1a')](_0x1d3e7c)['send'](_0x154bc5);};}function getInteractionUsers(_0x15fce7,_0x2b93a3){return new BPromise(function(_0x1bbc4c,_0x4e9fc0){try{if(_0x2b93a3[_0x15fce7['id']]){_0x15fce7['Users']=_[_0x7bb4('0x28')](_0x2b93a3[_0x15fce7['id']],function(_0x49a81d){return{'id':_0x49a81d['id'],'fullname':_0x49a81d[_0x7bb4('0x29')]};});}}catch(_0x40e9bc){_0x4e9fc0(_0x40e9bc);}_0x1bbc4c(_0x15fce7);});}function getInteractionTags(_0x39d999,_0x56107e){return new BPromise(function(_0x1fa8f6,_0x159a13){try{if(_0x39d999['TagIds']){_0x39d999[_0x7bb4('0x2a')]=[];_0x39d999[_0x7bb4('0x2b')][_0x7bb4('0x2c')](',')[_0x7bb4('0x2d')](function(_0x5232ae){_0x39d999[_0x7bb4('0x2a')][_0x7bb4('0x2e')](_0x56107e[_0x5232ae]);});}delete _0x39d999[_0x7bb4('0x2b')];}catch(_0x17442c){_0x159a13(_0x17442c);}_0x1fa8f6(_0x39d999);});}function updateWhatsappInteraction(_0x57ce38,_0x3a29e8,_0xa3a068){return new BPromise(function(_0xfdeffd,_0x34ed41){return getInteractionUsers(_0x57ce38,_0xa3a068)[_0x7bb4('0x23')](function(_0x57b45c){return getInteractionTags(_0x57b45c,_0x3a29e8);})[_0x7bb4('0x23')](function(_0x17b8bd){_0xfdeffd(_0x17b8bd);})[_0x7bb4('0x2f')](function(_0xde634b){_0x34ed41(_0xde634b);});});}exports['index']=function(_0x2af623,_0x342360){var _0x733e22={},_0x4f600b={},_0x47d1b4={'count':0x0,'rows':[]};var _0x8384c5=_[_0x7bb4('0x28')](db[_0x7bb4('0x30')][_0x7bb4('0x31')],function(_0x338ffd){return{'name':_0x338ffd['fieldName'],'type':_0x338ffd[_0x7bb4('0x32')][_0x7bb4('0x33')]};});_0x4f600b[_0x7bb4('0x34')]=_['map'](_0x8384c5,_0x7bb4('0x27'));_0x4f600b[_0x7bb4('0x35')]=_['keys'](_0x2af623['query']);_0x4f600b[_0x7bb4('0x36')]=_[_0x7bb4('0x37')](_0x4f600b[_0x7bb4('0x34')],_0x4f600b[_0x7bb4('0x35')]);_0x733e22[_0x7bb4('0x38')]=_[_0x7bb4('0x37')](_0x4f600b[_0x7bb4('0x34')],qs[_0x7bb4('0x39')](_0x2af623[_0x7bb4('0x35')][_0x7bb4('0x39')]));_0x733e22[_0x7bb4('0x38')]=_0x733e22[_0x7bb4('0x38')][_0x7bb4('0x3a')]?_0x733e22['attributes']:_0x4f600b['model'];if(!_0x2af623[_0x7bb4('0x35')][_0x7bb4('0x3b')](_0x7bb4('0x3c'))){_0x733e22[_0x7bb4('0x3d')]=qs[_0x7bb4('0x3d')](_0x2af623['query'][_0x7bb4('0x3d')]);_0x733e22['offset']=qs[_0x7bb4('0x1d')](_0x2af623['query']['offset']);}_0x733e22[_0x7bb4('0x3e')]=qs[_0x7bb4('0x3f')](_0x2af623['query'][_0x7bb4('0x3f')]);_0x733e22['where']=qs['filters'](_['pick'](_0x2af623[_0x7bb4('0x35')],_0x4f600b[_0x7bb4('0x36')]),_0x8384c5);var _0x6bcaed=[];var _0x28ed7d=squel['select']()[_0x7bb4('0x40')]('id')[_0x7bb4('0x40')](_0x7bb4('0x27'))[_0x7bb4('0x40')](_0x7bb4('0x41'))[_0x7bb4('0x42')](_0x7bb4('0x43'));var _0x3f89fd=squel[_0x7bb4('0x44')]()[_0x7bb4('0x40')](_0x7bb4('0x45'))[_0x7bb4('0x40')](_0x7bb4('0x46'))[_0x7bb4('0x40')]('ui.WhatsappInteractionId')['from'](_0x7bb4('0x47'),'ui')[_0x7bb4('0x48')](_0x7bb4('0x49'),'u',_0x7bb4('0x4a'));var _0xa24691=squel[_0x7bb4('0x44')]()[_0x7bb4('0x42')](_0x7bb4('0x4b'),'i')['left_join']('cm_contacts','c',_0x7bb4('0x4c'))[_0x7bb4('0x48')](_0x7bb4('0x49'),'o','o.id\x20=\x20i.UserId')[_0x7bb4('0x48')](_0x7bb4('0x4d'),'a',_0x7bb4('0x4e'))['left_join'](_0x7bb4('0x4f'),'me',_0x7bb4('0x50'))[_0x7bb4('0x48')](_0x7bb4('0x51'),'it',_0x7bb4('0x52'))[_0x7bb4('0x48')](_0x7bb4('0x43'),'t',_0x7bb4('0x53'));var _0x2380d0=squel['expr']();var _0x524ad9=[];var _0x17e20c=squel[_0x7bb4('0x54')]();var _0x279883;if(_0x2af623[_0x7bb4('0x35')]['search']){_0x279883=as['parseSearch'](_0x2af623[_0x7bb4('0x35')]['search']);var _0x47fed9=_0x279883[_0x7bb4('0x55')];for(var _0x4619ce=0x0;_0x4619ce<_0x279883[_0x7bb4('0x56')]['length'];_0x4619ce++){var _0x4f95ae=_0x279883[_0x7bb4('0x56')][_0x4619ce];var _0x544e8a='i';var _0x29f150=_[_0x7bb4('0x57')](_0x8384c5,[_0x7bb4('0x27'),_0x4f95ae[_0x7bb4('0x40')]]);if(!_0x29f150){switch(_0x4f95ae['field']){case'unreadMessages':if(_0x4f95ae[_0x7bb4('0x58')]==0x1){_0xa24691[_0x7bb4('0x59')]('`'+_0x4f95ae[_0x7bb4('0x40')]+_0x7bb4('0x5a'));}else{_0xa24691[_0x7bb4('0x59')]('`'+_0x4f95ae[_0x7bb4('0x40')]+'`\x20>\x200');}break;case _0x7bb4('0x5b'):if(_0x4f95ae[_0x7bb4('0x5c')]===_0x7bb4('0x5d')){if(_0x4f95ae[_0x7bb4('0x58')]['split']('\x20')['length']>0x1){_0x2380d0[_0x47fed9](_0x7bb4('0x5e'),qs[_0x7bb4('0x5f')](_0x4f95ae[_0x7bb4('0x58')]),null);}else{var _0x598523='%'+_0x4f95ae[_0x7bb4('0x58')]+'%';_0x2380d0[_0x47fed9](_0x7bb4('0x60'),_0x598523,_0x598523,_0x598523);}}else{_0x29f150=_['find'](_0x8384c5,['name','ContactId']);_0x4f95ae[_0x7bb4('0x40')]=_0x7bb4('0x61');_0x12f341=as['buildExpression'](_0x544e8a,_0x29f150['type'],_0x4f95ae);_0x2380d0[_0x47fed9](_0x12f341[_0x7bb4('0x62')],_0x12f341['value'][_0x7bb4('0x63')],_0x12f341[_0x7bb4('0x58')][_0x7bb4('0x1b')]);}break;case'Tag':var _0x35ae49=_0x4f95ae[_0x7bb4('0x58')][_0x7bb4('0x2c')](',')[_0x7bb4('0x28')](function(_0x130563){return Number(_0x130563);});_0x35ae49['forEach'](function(_0x2849c9){_0x17e20c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2849c9+',%');});_0x524ad9=_[_0x7bb4('0x64')](_0x524ad9,_0x35ae49);break;case'User':if(_0x4f95ae[_0x7bb4('0x5c')]===_0x7bb4('0x5d')){_0x2380d0[_0x47fed9](_0x7bb4('0x65'),'%'+_0x4f95ae[_0x7bb4('0x58')]+'%',null);}else{_0x29f150=_[_0x7bb4('0x57')](_0x8384c5,[_0x7bb4('0x27'),_0x7bb4('0x66')]);_0x4f95ae[_0x7bb4('0x40')]=_0x7bb4('0x66');_0x12f341=as[_0x7bb4('0x67')](_0x544e8a,_0x29f150[_0x7bb4('0x32')],_0x4f95ae);_0x2380d0[_0x47fed9](_0x12f341[_0x7bb4('0x62')],_0x12f341['value']['start'],_0x12f341[_0x7bb4('0x58')][_0x7bb4('0x1b')]);}break;case _0x7bb4('0x68'):_0x12f341=as[_0x7bb4('0x67')]('me',null,_0x4f95ae);_0x2380d0[_0x47fed9](_0x12f341[_0x7bb4('0x62')],_0x12f341[_0x7bb4('0x58')][_0x7bb4('0x63')],_0x12f341['value'][_0x7bb4('0x1b')]);break;}}else{var _0x12f341=as[_0x7bb4('0x67')](_0x544e8a,_0x29f150[_0x7bb4('0x32')],_0x4f95ae);_0x2380d0[_0x47fed9](_0x12f341[_0x7bb4('0x62')],_0x12f341['value'][_0x7bb4('0x63')],_0x12f341['value'][_0x7bb4('0x1b')]);}}}else{var _0x273304=_(_0x2af623['query'])[_0x7bb4('0x69')]()[_0x7bb4('0x28')](function(_0x2a0b8d){return _['some'](_0x8384c5,[_0x7bb4('0x27'),_0x2a0b8d])?_0x2a0b8d:undefined;})[_0x7bb4('0x6a')]()[_0x7bb4('0x58')]();if(!_['isEmpty'](_0x273304)){_0x273304[_0x7bb4('0x2d')](function(_0x29fbb6){if(_0x29fbb6==='WhatsappAccountId'){_0xa24691[_0x7bb4('0x6b')](_0x7bb4('0x6c'),[][_0x7bb4('0x6d')](_0x2af623[_0x7bb4('0x35')][_0x29fbb6]));}else if(_0x29fbb6===_0x7bb4('0x6e')){var _0x1ff955=JSON['parse'](_0x2af623[_0x7bb4('0x35')][_0x29fbb6])[_0x7bb4('0x6f')];var _0x4f2cab=JSON[_0x7bb4('0x70')](_0x2af623[_0x7bb4('0x35')][_0x29fbb6])[_0x7bb4('0x71')];_0xa24691['where'](_0x7bb4('0x72'),_0x1ff955,_0x4f2cab);}else{if(_0x2af623['query'][_0x29fbb6]===_0x7bb4('0x73')){_0xa24691[_0x7bb4('0x6b')]('i.'+_0x29fbb6+'\x20IS\x20NULL');}else{_0xa24691[_0x7bb4('0x6b')]('i.'+_0x29fbb6+'\x20=\x20?',_0x2af623[_0x7bb4('0x35')][_0x29fbb6]);}}});}if(_0x2af623[_0x7bb4('0x35')]['read']){if(_0x2af623[_0x7bb4('0x35')]['read']==0x1){_0xa24691[_0x7bb4('0x59')](_0x7bb4('0x74'));}else{_0xa24691[_0x7bb4('0x59')](_0x7bb4('0x75'));}}if(_0x2af623['query'][_0x7bb4('0x76')]){_0x524ad9=_[_0x7bb4('0x77')](_0x2af623['query'][_0x7bb4('0x76')])?_0x2af623[_0x7bb4('0x35')][_0x7bb4('0x76')]:new Array(_0x2af623[_0x7bb4('0x35')]['tag']);_0x524ad9[_0x7bb4('0x2d')](function(_0x54b3c8){_0x17e20c['or'](_0x7bb4('0x78'),'%,'+_0x54b3c8+',%');});}if(_0x2af623[_0x7bb4('0x35')][_0x7bb4('0x79')]){var _0x4d2f0b=_0x2af623['query'][_0x7bb4('0x79')][_0x7bb4('0x7a')]('\x5c','\x5c\x5c')[_0x7bb4('0x7a')](/'/g,'\x27\x27');if(qs[_0x7bb4('0x7b')](_0x4d2f0b)){_0x2380d0['or'](_0x7bb4('0x7c'),_0x4d2f0b+'%')['or']('i.phone\x20LIKE\x20?',_0x4d2f0b+'%');}else{_0x2380d0['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4d2f0b))['or'](_0x7bb4('0x7d'),_0x4d2f0b+'%');}}}_0xa24691[_0x7bb4('0x6b')](_0x2380d0);_0xa24691[_0x7bb4('0x7e')]('i.id');var _0x10cd77={'type':db[_0x7bb4('0x7f')][_0x7bb4('0x80')]['SELECT'],'raw':!![]};var _0x114e4a=_0xa24691[_0x7bb4('0x81')]();_0x114e4a[_0x7bb4('0x40')](_0x7bb4('0x82'));_0x114e4a[_0x7bb4('0x40')](_0x7bb4('0x83'),_0x7bb4('0x84'));if(_0x733e22[_0x7bb4('0x3e')]){_0x733e22[_0x7bb4('0x3e')][_0x7bb4('0x2d')](function(_0x2d74fc){_0xa24691[_0x7bb4('0x3e')]('i.'+_0x2d74fc[0x0],_0x2d74fc[0x1]===_0x7bb4('0x85')?![]:!![]);});}if(!_[_0x7bb4('0x86')](_0x524ad9)){_0xa24691[_0x7bb4('0x59')](_0x17e20c);_0x114e4a[_0x7bb4('0x6b')](_0x7bb4('0x87'),_0x524ad9);}BPromise[_0x7bb4('0x88')]()['then'](function(){if(!_0x279883){if(_0x2af623[_0x7bb4('0x35')][_0x7bb4('0x89')]||_0x2af623[_0x7bb4('0x35')][_0x7bb4('0x8a')])return;_0x114e4a['where'](_0x7bb4('0x8b'));_0xa24691[_0x7bb4('0x6b')](_0x7bb4('0x8b'));return;}return _0x2af623[_0x7bb4('0x8c')][_0x7bb4('0x8d')]({'attributes':['id'],'raw':!![]})[_0x7bb4('0x23')](function(_0xf266bc){if(_[_0x7bb4('0x86')](_0xf266bc)){_0x114e4a[_0x7bb4('0x6b')](_0x7bb4('0x8e'));_0xa24691[_0x7bb4('0x6b')](_0x7bb4('0x8e'));}else{_0x114e4a['where'](_0x7bb4('0x6c'),_[_0x7bb4('0x28')](_0xf266bc,'id'));_0xa24691[_0x7bb4('0x6b')]('i.WhatsappAccountId\x20IN\x20?',_[_0x7bb4('0x28')](_0xf266bc,'id'));}});})[_0x7bb4('0x23')](function(){db[_0x7bb4('0x8f')][_0x7bb4('0x35')](_0x114e4a['toString'](),_0x10cd77)[_0x7bb4('0x23')](function(_0x13d107){_0x47d1b4[_0x7bb4('0x1c')]=_0x13d107[_0x7bb4('0x3a')];if(_0x47d1b4['count']===0x0)return[];return db[_0x7bb4('0x8f')][_0x7bb4('0x35')](_0x28ed7d[_0x7bb4('0x90')](),_0x10cd77)[_0x7bb4('0x23')](function(_0x15a4a4){_0x6bcaed=_[_0x7bb4('0x91')](_0x15a4a4,'id');_0x10cd77=_[_0x7bb4('0x92')](_0x10cd77,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2af623[_0x7bb4('0x35')][_0x7bb4('0x39')]){_0x733e22[_0x7bb4('0x38')][_0x7bb4('0x2d')](function(_0x1440a3){_0xa24691[_0x7bb4('0x40')]('i.'+_0x1440a3);});}else{_0xa24691[_0x7bb4('0x40')](_0x7bb4('0x83'),'unreadMessages');_0xa24691[_0x7bb4('0x40')]('a.key',_0x7bb4('0x93'));_0xa24691[_0x7bb4('0x40')](_0x7bb4('0x94'),_0x7bb4('0x95'));_0xa24691[_0x7bb4('0x40')](_0x7bb4('0x96'));_0xa24691['field']('c.firstName',_0x7bb4('0x97'));_0xa24691['field'](_0x7bb4('0x98'),_0x7bb4('0x99'));_0xa24691['field'](_0x7bb4('0x9a'),_0x7bb4('0x9b'));_0xa24691[_0x7bb4('0x40')](_0x7bb4('0x9c'),_0x7bb4('0x9d'));_0xa24691[_0x7bb4('0x40')](_0x7bb4('0x9e'),_0x7bb4('0x9f'));_0xa24691[_0x7bb4('0x40')](_0x7bb4('0xa0'),_0x7bb4('0xa1'));_0xa24691[_0x7bb4('0x40')](_0x7bb4('0xa2'),_0x7bb4('0xa3'));_0xa24691['field'](_0x7bb4('0xa4'),_0x7bb4('0xa5'));_0xa24691[_0x7bb4('0x40')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7bb4('0x2b'));}if(_0x733e22['limit'])_0xa24691[_0x7bb4('0x3d')](_0x733e22['limit']);if(_0x733e22[_0x7bb4('0x1d')])_0xa24691['offset'](_0x733e22[_0x7bb4('0x1d')]);return db[_0x7bb4('0x8f')][_0x7bb4('0x35')](_0xa24691[_0x7bb4('0x90')](),_0x10cd77);})[_0x7bb4('0x23')](function(_0x4ab6c3){_0x3f89fd[_0x7bb4('0x6b')](_0x7bb4('0xa6'),_[_0x7bb4('0x28')](_0x4ab6c3,'id'));return db['sequelize'][_0x7bb4('0x35')](_0x3f89fd['toString'](),_0x10cd77)[_0x7bb4('0x23')](function(_0x91ca76){var _0x121c3c=_[_0x7bb4('0xa7')](_0x91ca76,_0x7bb4('0xa8'));var _0x3cd176=[];_0x4ab6c3[_0x7bb4('0x2d')](function(_0x4164e0){_0x3cd176[_0x7bb4('0x2e')](updateWhatsappInteraction(_0x4164e0,_0x6bcaed,_0x121c3c));});return BPromise[_0x7bb4('0xa9')](_0x3cd176);});});})['then'](function(_0x40f036){_0x47d1b4[_0x7bb4('0xaa')]=_0x40f036;return _0x47d1b4;})[_0x7bb4('0x23')](respondWithFilteredResult(_0x342360,_0x733e22));})[_0x7bb4('0x2f')](handleError(_0x342360,null));};exports[_0x7bb4('0xab')]=function(_0x268fb4,_0x3c9eb4){var _0x1f382a={'raw':![],'where':{'id':_0x268fb4[_0x7bb4('0xac')]['id']}},_0x44b5ce={};_0x44b5ce['model']=_[_0x7bb4('0x69')](db['WhatsappInteraction'][_0x7bb4('0x31')]);_0x44b5ce[_0x7bb4('0x35')]=_[_0x7bb4('0x69')](_0x268fb4[_0x7bb4('0x35')]);_0x44b5ce[_0x7bb4('0x36')]=_[_0x7bb4('0x37')](_0x44b5ce[_0x7bb4('0x34')],_0x44b5ce[_0x7bb4('0x35')]);_0x1f382a[_0x7bb4('0x38')]=_[_0x7bb4('0x37')](_0x44b5ce[_0x7bb4('0x34')],qs[_0x7bb4('0x39')](_0x268fb4[_0x7bb4('0x35')][_0x7bb4('0x39')]));_0x1f382a[_0x7bb4('0x38')]=_0x1f382a[_0x7bb4('0x38')][_0x7bb4('0x3a')]?_0x1f382a[_0x7bb4('0x38')]:_0x44b5ce[_0x7bb4('0x34')];if(_0x268fb4['query'][_0x7bb4('0xad')]){_0x1f382a['include']=[{'all':!![]}];}_0x1f382a=_[_0x7bb4('0x92')]({},_0x1f382a,_0x268fb4[_0x7bb4('0xae')]);return db[_0x7bb4('0x30')][_0x7bb4('0x57')](_0x1f382a)[_0x7bb4('0x23')](handleEntityNotFound(_0x3c9eb4,null))[_0x7bb4('0x23')](respondWithResult(_0x3c9eb4,null))[_0x7bb4('0x2f')](handleError(_0x3c9eb4,null));};exports[_0x7bb4('0xaf')]=function(_0x110f36,_0x56ea8c){return db[_0x7bb4('0x30')][_0x7bb4('0xaf')](_0x110f36['body'],{})[_0x7bb4('0x23')](respondWithResult(_0x56ea8c,0xc9))[_0x7bb4('0x2f')](handleError(_0x56ea8c,null));};exports[_0x7bb4('0x22')]=function(_0x22d7da,_0x1b50ee){if(_0x22d7da[_0x7bb4('0x68')]['id']){delete _0x22d7da[_0x7bb4('0x68')]['id'];}return db[_0x7bb4('0x30')][_0x7bb4('0x57')]({'where':{'id':_0x22d7da[_0x7bb4('0xac')]['id']}})[_0x7bb4('0x23')](handleEntityNotFound(_0x1b50ee,null))[_0x7bb4('0x23')](saveUpdates(_0x22d7da[_0x7bb4('0x68')],null))[_0x7bb4('0x23')](respondWithResult(_0x1b50ee,null))[_0x7bb4('0x2f')](handleError(_0x1b50ee,null));};exports[_0x7bb4('0x24')]=function(_0x259cf5,_0x479fb6){return db[_0x7bb4('0x30')]['find']({'where':{'id':_0x259cf5[_0x7bb4('0xac')]['id']}})[_0x7bb4('0x23')](handleEntityNotFound(_0x479fb6,null))[_0x7bb4('0x23')](removeEntity(_0x479fb6,null))[_0x7bb4('0x2f')](handleError(_0x479fb6,null));};exports[_0x7bb4('0xb0')]=function(_0x20402a,_0x3e0248){return db['WhatsappInteraction'][_0x7bb4('0xb0')]()[_0x7bb4('0x23')](respondWithResult(_0x3e0248,null))[_0x7bb4('0x2f')](handleError(_0x3e0248,null));};exports[_0x7bb4('0xb1')]=function(_0x37627c,_0x1ea8ff,_0x1190e1){return db['WhatsappMessage']['find']({'where':{'id':_0x37627c[_0x7bb4('0xac')]['id']}})[_0x7bb4('0x23')](handleEntityNotFound(_0x1ea8ff,null))[_0x7bb4('0x23')](function(_0x18eac9){if(_0x18eac9){return _0x18eac9['addMessage'](_0x37627c[_0x7bb4('0x68')][_0x7bb4('0xb2')],_[_0x7bb4('0xb3')](_0x37627c[_0x7bb4('0x68')],[_0x7bb4('0xb2'),'id'])||{});}})[_0x7bb4('0x23')](respondWithResult(_0x1ea8ff,null))[_0x7bb4('0x2f')](handleError(_0x1ea8ff,null));};exports[_0x7bb4('0xb4')]=function(_0x6ffd0e,_0x30be5d,_0x1c5a5d){var _0x577b0f={'raw':![],'where':{}};var _0x57f505={};var _0x296973={'count':0x0,'rows':[]};return db[_0x7bb4('0x30')]['findOne']({'where':{'id':_0x6ffd0e[_0x7bb4('0xac')]['id']}})[_0x7bb4('0x23')](handleEntityNotFound(_0x30be5d,null))[_0x7bb4('0x23')](function(_0x482d01){if(_0x482d01){_0x57f505['model']=_[_0x7bb4('0x69')](db[_0x7bb4('0xb5')][_0x7bb4('0x31')]);_0x57f505[_0x7bb4('0x35')]=_[_0x7bb4('0x69')](_0x6ffd0e[_0x7bb4('0x35')]);_0x57f505[_0x7bb4('0x36')]=_[_0x7bb4('0x37')](_0x57f505[_0x7bb4('0x34')],_0x57f505[_0x7bb4('0x35')]);_0x577b0f[_0x7bb4('0x38')]=_['intersection'](_0x57f505['model'],qs[_0x7bb4('0x39')](_0x6ffd0e[_0x7bb4('0x35')][_0x7bb4('0x39')]));_0x577b0f[_0x7bb4('0x38')]=_0x577b0f['attributes']['length']?_0x577b0f[_0x7bb4('0x38')]:_0x57f505[_0x7bb4('0x34')];if(!_0x6ffd0e['query']['hasOwnProperty'](_0x7bb4('0x3c'))){_0x577b0f[_0x7bb4('0x3d')]=qs[_0x7bb4('0x3d')](_0x6ffd0e['query'][_0x7bb4('0x3d')]);_0x577b0f[_0x7bb4('0x1d')]=qs[_0x7bb4('0x1d')](_0x6ffd0e['query']['offset']);}_0x577b0f['order']=qs[_0x7bb4('0x3f')](_0x6ffd0e[_0x7bb4('0x35')][_0x7bb4('0x3f')]);_0x577b0f[_0x7bb4('0x6b')]=qs[_0x7bb4('0x36')](_[_0x7bb4('0xb6')](_0x6ffd0e['query'],_0x57f505[_0x7bb4('0x36')]));_0x577b0f[_0x7bb4('0x6b')][_0x7bb4('0xa8')]=_0x482d01['id'];if(_0x6ffd0e[_0x7bb4('0x35')][_0x7bb4('0x79')]){_0x577b0f[_0x7bb4('0x6b')]=_[_0x7bb4('0x92')](_0x577b0f[_0x7bb4('0x6b')],{'$or':_[_0x7bb4('0x28')](_0x577b0f[_0x7bb4('0x38')],function(_0x5922c5){var _0x4577b4={};_0x4577b4[_0x5922c5]={'$like':'%'+_0x6ffd0e[_0x7bb4('0x35')]['filter']+'%'};return _0x4577b4;})});}if(_0x6ffd0e[_0x7bb4('0x35')]['$gte']){var _0x2c79ad=_0x6ffd0e[_0x7bb4('0x35')][_0x7bb4('0x6f')][_0x7bb4('0x2c')](',');var _0x5c0369={};_0x5c0369[_0x2c79ad[0x0]]={'$gte':moment(_0x2c79ad[0x1])[_0x7bb4('0xb7')](_0x7bb4('0xb8'))};_0x577b0f[_0x7bb4('0x6b')]=_['merge'](_0x577b0f[_0x7bb4('0x6b')],_0x5c0369);}_0x577b0f=_[_0x7bb4('0x92')]({},_0x577b0f,_0x6ffd0e[_0x7bb4('0xae')]);return db[_0x7bb4('0xb5')][_0x7bb4('0x1c')]({'where':_0x577b0f[_0x7bb4('0x6b')]})['then'](function(_0x41c1b7){_0x296973[_0x7bb4('0x1c')]=_0x41c1b7;if(_0x6ffd0e[_0x7bb4('0x35')]['includeAll']){_0x577b0f[_0x7bb4('0xb9')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x7bb4('0xba')](_0x577b0f);})[_0x7bb4('0x23')](function(_0x2936a3){_0x296973[_0x7bb4('0xaa')]=_0x2936a3;return _0x296973;});}})[_0x7bb4('0x23')](respondWithFilteredResult(_0x30be5d,_0x577b0f))[_0x7bb4('0x2f')](handleError(_0x30be5d,null));};exports[_0x7bb4('0xbb')]=function(_0x14ed8f,_0x1799e9,_0x123c1f){return db['WhatsappInteraction'][_0x7bb4('0x57')]({'where':{'id':_0x14ed8f[_0x7bb4('0xac')]['id']}})[_0x7bb4('0x23')](handleEntityNotFound(_0x1799e9,null))[_0x7bb4('0x23')](function(_0x2a9bdb){if(_0x2a9bdb){return _0x2a9bdb[_0x7bb4('0xbc')](_0x14ed8f[_0x7bb4('0x68')][_0x7bb4('0xb2')],_['omit'](_0x14ed8f[_0x7bb4('0x68')],[_0x7bb4('0xb2'),'id'])||{})[_0x7bb4('0xbd')](function(){return db['Tag'][_0x7bb4('0xba')]({'attributes':['id',_0x7bb4('0x27'),'color'],'where':{'id':_0x14ed8f[_0x7bb4('0x68')]['ids']}});})[_0x7bb4('0x23')](function(_0x563da4){socket[_0x7bb4('0xbe')](_0x7bb4('0xbf'),{'id':Number(_0x14ed8f['params']['id']),'tags':_0x563da4||[]});return{'id':Number(_0x14ed8f[_0x7bb4('0xac')]['id']),'tags':_0x563da4||[]};});}})['then'](respondWithResult(_0x1799e9,null))[_0x7bb4('0x2f')](handleError(_0x1799e9,null));};exports[_0x7bb4('0xc0')]=function(_0x2221d4,_0x485459,_0x1be447){return db[_0x7bb4('0x30')]['find']({'where':{'id':_0x2221d4['params']['id']}})[_0x7bb4('0x23')](handleEntityNotFound(_0x485459,null))[_0x7bb4('0x23')](function(_0x7fdb5c){if(_0x7fdb5c){return _0x7fdb5c[_0x7bb4('0xc0')](_0x2221d4[_0x7bb4('0x35')][_0x7bb4('0xb2')]);}})['then'](respondWithStatusCode(_0x485459,null))[_0x7bb4('0x2f')](handleError(_0x485459,null));};exports[_0x7bb4('0xc1')]=function(_0x2dea2a,_0x5f1708){var _0x1168bb=moment()[_0x7bb4('0xc2')]()['toString']();var _0x376932=path['join'](config['root'],_0x7bb4('0xc3'),_0x7bb4('0xc4'),_0x7bb4('0xc5'));var _0x36ad80=path[_0x7bb4('0xc6')](config[_0x7bb4('0xc7')],_0x7bb4('0xc3'),_0x7bb4('0xc4'),'attachments');var _0x121d3c=path['join'](_0x376932,_0x1168bb);var _0x49e5f8=util[_0x7bb4('0xb7')](_0x7bb4('0xc8'),_0x2dea2a[_0x7bb4('0xac')]['id'],_0x1168bb);var _0x5c37c9=path[_0x7bb4('0xc6')](_0x376932,_0x49e5f8);var _0x1cb5b8=[];_0x1cb5b8[_0x7bb4('0x2e')]({'model':db[_0x7bb4('0xc9')],'as':_0x7bb4('0xc9'),'attributes':['id',_0x7bb4('0x29')],'raw':!![]});_0x1cb5b8['push']({'model':db[_0x7bb4('0xca')],'as':_0x7bb4('0x5b'),'attributes':['id','firstName',_0x7bb4('0xcb')],'raw':!![]});if(_0x2dea2a[_0x7bb4('0x35')][_0x7bb4('0xcc')]){_0x1cb5b8[_0x7bb4('0x2e')]({'model':db[_0x7bb4('0xcd')],'as':_0x7bb4('0xcd'),'raw':!![]});}var _0x14df38=[{'model':db[_0x7bb4('0xb5')],'as':_0x7bb4('0xce'),'attributes':['id','body','createdAt',_0x7bb4('0xcf'),_0x7bb4('0xd0'),_0x7bb4('0xd1')],'include':_0x1cb5b8}];_0x14df38[_0x7bb4('0x2e')]({'model':db['WhatsappAccount'],'as':_0x7bb4('0xd2'),'attributes':['id',_0x7bb4('0x27')]});_0x14df38['push']({'model':db[_0x7bb4('0xc9')],'as':_0x7bb4('0xd3'),'attributes':['id','fullname']});return db[_0x7bb4('0x30')][_0x7bb4('0x57')]({'where':{'id':_0x2dea2a[_0x7bb4('0xac')]['id']},'include':_0x14df38})[_0x7bb4('0x23')](handleEntityNotFound(_0x5f1708,null))[_0x7bb4('0x23')](function(_0x10abf3){if(_0x10abf3){var _0x21b9b2=_0x10abf3[_0x7bb4('0xd4')]({'plain':!![]});fs[_0x7bb4('0xd5')](_0x121d3c);var _0x4ee274={'format':'A4','border':'10px','header':{'height':_0x7bb4('0xd6'),'contents':{'first':_0x7bb4('0xd7')}},'footer':{'height':_0x7bb4('0xd8'),'contents':{'default':util[_0x7bb4('0xb7')](_0x7bb4('0xd9'),util[_0x7bb4('0xb7')](_0x7bb4('0xda'),_0x7bb4('0xdb'),_0x21b9b2['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x13842a={'channel':'Whatsapp','account':_0x21b9b2[_0x7bb4('0xd2')][_0x7bb4('0x27')],'agent':_0x21b9b2['Owner']?_0x21b9b2['Owner'][_0x7bb4('0x29')]:_0x7bb4('0xdc'),'createdAt':moment(_0x21b9b2[_0x7bb4('0x6e')])[_0x7bb4('0xb7')](_0x7bb4('0xb8'))['toString'](),'closedAt':_0x21b9b2[_0x7bb4('0xdd')]?moment(_0x21b9b2[_0x7bb4('0xde')])[_0x7bb4('0xb7')](_0x7bb4('0xb8'))[_0x7bb4('0x90')]():'','disposition':_0x21b9b2['disposition'],'messages':_(_0x21b9b2[_0x7bb4('0xce')])[_0x7bb4('0x79')]({'secret':![]})[_0x7bb4('0x28')](function(_0x4bfd16){if(_0x4bfd16[_0x7bb4('0xcd')]){var _0x6e28b7=path[_0x7bb4('0xc6')](_0x36ad80,_0x4bfd16[_0x7bb4('0xcd')][_0x7bb4('0xdf')]);if(fs[_0x7bb4('0xe0')](_0x6e28b7)){fs[_0x7bb4('0xe1')](_0x6e28b7)[_0x7bb4('0xe2')](fs[_0x7bb4('0xe3')](path[_0x7bb4('0xc6')](_0x121d3c,_0x4bfd16[_0x7bb4('0xcd')][_0x7bb4('0xdf')])));}}return{'date':moment(_0x4bfd16[_0x7bb4('0x6e')])[_0x7bb4('0xb7')](_0x7bb4('0xb8'))[_0x7bb4('0x90')](),'sender':_0x4bfd16[_0x7bb4('0xcf')]==='out'?_0x4bfd16[_0x7bb4('0xc9')]?_0x4bfd16[_0x7bb4('0xc9')]['fullname']:_0x7bb4('0xe4'):_0x4bfd16[_0x7bb4('0x5b')][_0x7bb4('0xe5')]+(_0x4bfd16[_0x7bb4('0x5b')][_0x7bb4('0xcb')]?'\x20'+_0x4bfd16[_0x7bb4('0x5b')][_0x7bb4('0xcb')]:''),'body':_0x4bfd16[_0x7bb4('0xcd')]?_0x4bfd16[_0x7bb4('0xcd')]['basename']:_0x4bfd16[_0x7bb4('0x68')],'direction':_0x4bfd16[_0x7bb4('0xcf')]===_0x7bb4('0xe6')?'A':'C','secret':_0x4bfd16[_0x7bb4('0xd0')],'read':_0x4bfd16[_0x7bb4('0xd1')],'attachment':_0x4bfd16[_0x7bb4('0xcd')]};})[_0x7bb4('0x58')]()};return ejs[_0x7bb4('0xe7')](path[_0x7bb4('0xc6')](config[_0x7bb4('0xc7')],_0x7bb4('0xc3'),_0x7bb4('0xe8'),_0x7bb4('0xe9')),{'interaction':_0x13842a})[_0x7bb4('0x23')](function(_0x5e9e8f){return new BPromise(function(_0xb6f40,_0x417bbb){pdf['create'](_0x5e9e8f,_0x4ee274)[_0x7bb4('0xea')](path[_0x7bb4('0xc6')](_0x121d3c,_0x7bb4('0xeb')+_0x21b9b2['id']+'-'+_0x1168bb+_0x7bb4('0xec')),function(_0x1419e5,_0x1449d8){if(_0x1419e5)return _0x417bbb(_0x1419e5);_0xb6f40(_0x1449d8);});});})[_0x7bb4('0x23')](function(){return new BPromise(function(_0x3bee7b,_0x32d4d6){zipdir(_0x121d3c,{'saveTo':_0x5c37c9},function(_0x45adf2,_0x226bec){if(_0x45adf2)return _0x32d4d6(_0x45adf2);return _0x3bee7b(_0x226bec);});})['then'](function(){return new BPromise(function(_0x1ff8b0,_0x4d1517){rimraf(_0x121d3c,function(_0x39c2b3){if(_0x39c2b3)_0x4d1517(_0x39c2b3);return _0x1ff8b0();});});})[_0x7bb4('0x23')](function(){return _0x5f1708[_0x7bb4('0xc1')](_0x5c37c9,_0x49e5f8,function(_0x567af5){if(_0x567af5){console[_0x7bb4('0xed')](_0x7bb4('0xee'),_0x567af5);}else{fs['unlinkSync'](_0x5c37c9);}});});});}else{return _0x5f1708['sendStatus'](0xc8);}})[_0x7bb4('0x2f')](handleError(_0x5f1708,null));};
\ No newline at end of file
+var _0xb7b4=['offset','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','read','Account','Owner','N.A.','toString','closed','closedAt','disposition','basename','existsSync','pipe','out','System','secret','renderFile','views','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','findAll','whatsapp','catch','show','params','keys','WhatsappInteraction','query','filters','intersection','model','attributes','fields','include','merge','options','find','create','body','addMessage','WhatsappMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit'];(function(_0x2808e2,_0x2570fe){var _0x57088f=function(_0x488583){while(--_0x488583){_0x2808e2['push'](_0x2808e2['shift']());}};_0x57088f(++_0x2570fe);}(_0xb7b4,0x1ad));var _0x4b7b=function(_0x385f0e,_0xa10008){_0x385f0e=_0x385f0e-0x0;var _0x41d183=_0xb7b4[_0x385f0e];return _0x41d183;};'use strict';var rimraf=require(_0x4b7b('0x0'));var zipdir=require(_0x4b7b('0x1'));var moment=require(_0x4b7b('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x4b7b('0x3'));var ejs=require(_0x4b7b('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4b7b('0x5'));var interaction=require(_0x4b7b('0x6'));var qs=require(_0x4b7b('0x7'));var pdf=require(_0x4b7b('0x8'));var logger=require(_0x4b7b('0x9'))(_0x4b7b('0xa'));var config=require(_0x4b7b('0xb'));var db=require(_0x4b7b('0xc'))['db'];config[_0x4b7b('0xd')]=_[_0x4b7b('0xe')](config[_0x4b7b('0xd')],{'host':_0x4b7b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b7b('0xd')]));require('./whatsappInteraction.socket')[_0x4b7b('0x10')](socket);function respondWithStatusCode(_0x873075,_0x27414b){_0x27414b=_0x27414b||0xcc;return function(_0x5b457f){if(_0x5b457f){return _0x873075[_0x4b7b('0x11')](_0x27414b);}return _0x873075[_0x4b7b('0x12')](_0x27414b)[_0x4b7b('0x13')]();};}function respondWithResult(_0x31f453,_0x469122){_0x469122=_0x469122||0xc8;return function(_0x272280){if(_0x272280){return _0x31f453[_0x4b7b('0x12')](_0x469122)[_0x4b7b('0x14')](_0x272280);}};}function respondWithFilteredResult(_0x24a13b,_0x5e3510){return function(_0x477bb6){if(_0x477bb6){var _0x136e86=typeof _0x5e3510['offset']===_0x4b7b('0x15')&&typeof _0x5e3510[_0x4b7b('0x16')]===_0x4b7b('0x15');var _0x33a7f8=_0x477bb6[_0x4b7b('0x17')];var _0x35a13b=_0x136e86?0x0:_0x5e3510['offset'];var _0x411284=_0x136e86?_0x477bb6['count']:_0x5e3510['offset']+_0x5e3510[_0x4b7b('0x16')];var _0x216b12;if(_0x411284>=_0x33a7f8){_0x411284=_0x33a7f8;_0x216b12=0xc8;}else{_0x216b12=0xce;}_0x24a13b[_0x4b7b('0x12')](_0x216b12);return _0x24a13b[_0x4b7b('0x18')](_0x4b7b('0x19'),_0x35a13b+'-'+_0x411284+'/'+_0x33a7f8)[_0x4b7b('0x14')](_0x477bb6);}return null;};}function saveUpdates(_0x590f83){return function(_0x209215){if(_0x209215){return _0x209215[_0x4b7b('0x1a')](_0x590f83)[_0x4b7b('0x1b')](function(_0x54ef79){return _0x54ef79;});}return null;};}function removeEntity(_0x1a4365){return function(_0x5dcf02){if(_0x5dcf02){return _0x5dcf02[_0x4b7b('0x1c')]()[_0x4b7b('0x1b')](function(){_0x1a4365[_0x4b7b('0x12')](0xcc)[_0x4b7b('0x13')]();});}};}function handleEntityNotFound(_0x918d1b){return function(_0x4bf891){if(!_0x4bf891){_0x918d1b[_0x4b7b('0x11')](0x194);}return _0x4bf891;};}function handleError(_0x59c6bd,_0x4660ea){_0x4660ea=_0x4660ea||0x1f4;return function(_0x70f4fa){logger['error'](_0x70f4fa[_0x4b7b('0x1d')]);if(_0x70f4fa[_0x4b7b('0x1e')]){delete _0x70f4fa[_0x4b7b('0x1e')];}_0x59c6bd[_0x4b7b('0x12')](_0x4660ea)['send'](_0x70f4fa);};}exports[_0x4b7b('0x1f')]=function(_0xfa7452,_0x44925d){var _0x2cf184={};var _0x10ec6b=_[_0x4b7b('0x20')](db['WhatsappInteraction'][_0x4b7b('0x21')],function(_0xa683b4){return{'name':_0xa683b4[_0x4b7b('0x22')],'type':_0xa683b4[_0x4b7b('0x23')]['key']};});_0x2cf184=qs['getOptions'](_0x10ec6b,_0xfa7452);return interaction[_0x4b7b('0x24')](_0x4b7b('0x25'),_0xfa7452['query'],_0xfa7452['user'],_0x2cf184,_0x10ec6b)[_0x4b7b('0x1b')](respondWithFilteredResult(_0x44925d,_0x2cf184))[_0x4b7b('0x26')](handleError(_0x44925d,null));};exports[_0x4b7b('0x27')]=function(_0x4d0df2,_0x59c9e2){var _0x228e96={'raw':![],'where':{'id':_0x4d0df2[_0x4b7b('0x28')]['id']}},_0x1c61d0={};_0x1c61d0['model']=_[_0x4b7b('0x29')](db[_0x4b7b('0x2a')]['rawAttributes']);_0x1c61d0['query']=_[_0x4b7b('0x29')](_0x4d0df2[_0x4b7b('0x2b')]);_0x1c61d0[_0x4b7b('0x2c')]=_[_0x4b7b('0x2d')](_0x1c61d0[_0x4b7b('0x2e')],_0x1c61d0[_0x4b7b('0x2b')]);_0x228e96[_0x4b7b('0x2f')]=_[_0x4b7b('0x2d')](_0x1c61d0[_0x4b7b('0x2e')],qs[_0x4b7b('0x30')](_0x4d0df2[_0x4b7b('0x2b')][_0x4b7b('0x30')]));_0x228e96[_0x4b7b('0x2f')]=_0x228e96[_0x4b7b('0x2f')]['length']?_0x228e96['attributes']:_0x1c61d0[_0x4b7b('0x2e')];if(_0x4d0df2[_0x4b7b('0x2b')]['includeAll']){_0x228e96[_0x4b7b('0x31')]=[{'all':!![]}];}_0x228e96=_[_0x4b7b('0x32')]({},_0x228e96,_0x4d0df2[_0x4b7b('0x33')]);return db[_0x4b7b('0x2a')][_0x4b7b('0x34')](_0x228e96)[_0x4b7b('0x1b')](handleEntityNotFound(_0x59c9e2,null))[_0x4b7b('0x1b')](respondWithResult(_0x59c9e2,null))['catch'](handleError(_0x59c9e2,null));};exports['create']=function(_0x4d611e,_0x5253d0){return db['WhatsappInteraction'][_0x4b7b('0x35')](_0x4d611e[_0x4b7b('0x36')],{})[_0x4b7b('0x1b')](respondWithResult(_0x5253d0,0xc9))[_0x4b7b('0x26')](handleError(_0x5253d0,null));};exports[_0x4b7b('0x1a')]=function(_0x1c1c63,_0xa2c747){if(_0x1c1c63[_0x4b7b('0x36')]['id']){delete _0x1c1c63[_0x4b7b('0x36')]['id'];}return db[_0x4b7b('0x2a')][_0x4b7b('0x34')]({'where':{'id':_0x1c1c63[_0x4b7b('0x28')]['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0xa2c747,null))[_0x4b7b('0x1b')](saveUpdates(_0x1c1c63[_0x4b7b('0x36')],null))[_0x4b7b('0x1b')](respondWithResult(_0xa2c747,null))[_0x4b7b('0x26')](handleError(_0xa2c747,null));};exports[_0x4b7b('0x1c')]=function(_0x5edc33,_0x59f0df){return db['WhatsappInteraction'][_0x4b7b('0x34')]({'where':{'id':_0x5edc33[_0x4b7b('0x28')]['id']}})['then'](handleEntityNotFound(_0x59f0df,null))[_0x4b7b('0x1b')](removeEntity(_0x59f0df,null))[_0x4b7b('0x26')](handleError(_0x59f0df,null));};exports['describe']=function(_0x6a496e,_0x14d02d){return db['WhatsappInteraction']['describe']()[_0x4b7b('0x1b')](respondWithResult(_0x14d02d,null))[_0x4b7b('0x26')](handleError(_0x14d02d,null));};exports[_0x4b7b('0x37')]=function(_0x5d9516,_0x509ff8){return db[_0x4b7b('0x38')][_0x4b7b('0x34')]({'where':{'id':_0x5d9516[_0x4b7b('0x28')]['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0x509ff8,null))['then'](function(_0x18bb41){if(_0x18bb41){return _0x18bb41[_0x4b7b('0x37')](_0x5d9516[_0x4b7b('0x36')][_0x4b7b('0x39')],_[_0x4b7b('0x3a')](_0x5d9516[_0x4b7b('0x36')],[_0x4b7b('0x39'),'id'])||{});}})[_0x4b7b('0x1b')](respondWithResult(_0x509ff8,null))['catch'](handleError(_0x509ff8,null));};exports[_0x4b7b('0x3b')]=function(_0x2a60b0,_0x112cd1){var _0x3d4716={'raw':![],'where':{}};var _0x50dd4f={};var _0x4bd6a3={'count':0x0,'rows':[]};return db[_0x4b7b('0x2a')]['findOne']({'where':{'id':_0x2a60b0[_0x4b7b('0x28')]['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0x112cd1,null))[_0x4b7b('0x1b')](function(_0x387ce2){if(_0x387ce2){_0x50dd4f['model']=_[_0x4b7b('0x29')](db[_0x4b7b('0x38')]['rawAttributes']);_0x50dd4f[_0x4b7b('0x2b')]=_[_0x4b7b('0x29')](_0x2a60b0['query']);_0x50dd4f[_0x4b7b('0x2c')]=_[_0x4b7b('0x2d')](_0x50dd4f[_0x4b7b('0x2e')],_0x50dd4f['query']);_0x3d4716[_0x4b7b('0x2f')]=_[_0x4b7b('0x2d')](_0x50dd4f['model'],qs['fields'](_0x2a60b0['query'][_0x4b7b('0x30')]));_0x3d4716[_0x4b7b('0x2f')]=_0x3d4716[_0x4b7b('0x2f')][_0x4b7b('0x3c')]?_0x3d4716[_0x4b7b('0x2f')]:_0x50dd4f['model'];if(!_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x3d')](_0x4b7b('0x3e'))){_0x3d4716[_0x4b7b('0x16')]=qs['limit'](_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x16')]);_0x3d4716[_0x4b7b('0x3f')]=qs[_0x4b7b('0x3f')](_0x2a60b0['query'][_0x4b7b('0x3f')]);}_0x3d4716['order']=qs['sort'](_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x40')]);_0x3d4716['where']=qs[_0x4b7b('0x2c')](_[_0x4b7b('0x41')](_0x2a60b0[_0x4b7b('0x2b')],_0x50dd4f[_0x4b7b('0x2c')]));_0x3d4716[_0x4b7b('0x42')][_0x4b7b('0x43')]=_0x387ce2['id'];if(_0x2a60b0[_0x4b7b('0x2b')]['filter']){_0x3d4716[_0x4b7b('0x42')]=_[_0x4b7b('0x32')](_0x3d4716[_0x4b7b('0x42')],{'$or':_[_0x4b7b('0x20')](_0x3d4716[_0x4b7b('0x2f')],function(_0x4dd54a){var _0x83e4e4={};_0x83e4e4[_0x4dd54a]={'$like':'%'+_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x44')]+'%'};return _0x83e4e4;})});}if(_0x2a60b0['query'][_0x4b7b('0x45')]){var _0xf62d79=_0x2a60b0[_0x4b7b('0x2b')]['$gte'][_0x4b7b('0x46')](',');var _0xdd0c0f={};_0xdd0c0f[_0xf62d79[0x0]]={'$gte':moment(_0xf62d79[0x1])[_0x4b7b('0x47')](_0x4b7b('0x48'))};_0x3d4716[_0x4b7b('0x42')]=_[_0x4b7b('0x32')](_0x3d4716['where'],_0xdd0c0f);}_0x3d4716=_['merge']({},_0x3d4716,_0x2a60b0[_0x4b7b('0x33')]);return db['WhatsappMessage'][_0x4b7b('0x17')]({'where':_0x3d4716[_0x4b7b('0x42')]})[_0x4b7b('0x1b')](function(_0x25caf1){_0x4bd6a3[_0x4b7b('0x17')]=_0x25caf1;if(_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x49')]){_0x3d4716[_0x4b7b('0x31')]=[{'all':!![]}];}return db[_0x4b7b('0x38')][_0x4b7b('0x24')](_0x3d4716);})[_0x4b7b('0x1b')](function(_0x10002e){_0x4bd6a3[_0x4b7b('0x4a')]=_0x10002e;return _0x4bd6a3;});}})[_0x4b7b('0x1b')](respondWithFilteredResult(_0x112cd1,_0x3d4716))[_0x4b7b('0x26')](handleError(_0x112cd1,null));};exports[_0x4b7b('0x4b')]=function(_0x53888d,_0x42c481){return db['WhatsappInteraction'][_0x4b7b('0x34')]({'where':{'id':_0x53888d[_0x4b7b('0x28')]['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0x42c481,null))[_0x4b7b('0x1b')](function(_0x51e7da){if(_0x51e7da){return _0x51e7da[_0x4b7b('0x4c')](_0x53888d['body']['ids'],_['omit'](_0x53888d[_0x4b7b('0x36')],[_0x4b7b('0x39'),'id'])||{})[_0x4b7b('0x4d')](function(){return db[_0x4b7b('0x4e')]['findAll']({'attributes':['id','name',_0x4b7b('0x4f')],'where':{'id':_0x53888d[_0x4b7b('0x36')][_0x4b7b('0x39')]}});})[_0x4b7b('0x1b')](function(_0x43fd8b){socket[_0x4b7b('0x50')]('whatsappInteractionTags:save',{'id':Number(_0x53888d[_0x4b7b('0x28')]['id']),'tags':_0x43fd8b||[]});return{'id':Number(_0x53888d[_0x4b7b('0x28')]['id']),'tags':_0x43fd8b||[]};});}})[_0x4b7b('0x1b')](respondWithResult(_0x42c481,null))[_0x4b7b('0x26')](handleError(_0x42c481,null));};exports[_0x4b7b('0x51')]=function(_0x5bd219,_0x339543){return db['WhatsappInteraction'][_0x4b7b('0x34')]({'where':{'id':_0x5bd219['params']['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0x339543,null))[_0x4b7b('0x1b')](function(_0x2a53bf){if(_0x2a53bf){return _0x2a53bf[_0x4b7b('0x51')](_0x5bd219[_0x4b7b('0x2b')][_0x4b7b('0x39')]);}})['then'](respondWithStatusCode(_0x339543,null))[_0x4b7b('0x26')](handleError(_0x339543,null));};exports[_0x4b7b('0x52')]=function(_0x4b2e11,_0x1db915){var _0x24dbe2=moment()['unix']()['toString']();var _0x44a893=path[_0x4b7b('0x53')](config[_0x4b7b('0x54')],_0x4b7b('0x55'),_0x4b7b('0x56'),_0x4b7b('0x57'));var _0x43a93e=path[_0x4b7b('0x53')](config[_0x4b7b('0x54')],_0x4b7b('0x55'),_0x4b7b('0x56'),'attachments');var _0x58a96c=path[_0x4b7b('0x53')](_0x44a893,_0x24dbe2);var _0x515f6e=util[_0x4b7b('0x47')](_0x4b7b('0x58'),_0x4b2e11['params']['id'],_0x24dbe2);var _0x35148a=path[_0x4b7b('0x53')](_0x44a893,_0x515f6e);var _0x2a1270=[];_0x2a1270[_0x4b7b('0x59')]({'model':db[_0x4b7b('0x5a')],'as':_0x4b7b('0x5a'),'attributes':['id',_0x4b7b('0x5b')],'raw':!![]});_0x2a1270['push']({'model':db[_0x4b7b('0x5c')],'as':_0x4b7b('0x5d'),'attributes':['id',_0x4b7b('0x5e'),_0x4b7b('0x5f')],'raw':!![]});if(_0x4b2e11[_0x4b7b('0x2b')][_0x4b7b('0x60')]){_0x2a1270['push']({'model':db['Attachment'],'as':_0x4b7b('0x61'),'raw':!![]});}var _0x40bb8d=[{'model':db[_0x4b7b('0x38')],'as':_0x4b7b('0x62'),'attributes':['id',_0x4b7b('0x36'),_0x4b7b('0x63'),_0x4b7b('0x64'),'secret',_0x4b7b('0x65')],'include':_0x2a1270}];_0x40bb8d[_0x4b7b('0x59')]({'model':db['WhatsappAccount'],'as':_0x4b7b('0x66'),'attributes':['id',_0x4b7b('0x1e')]});_0x40bb8d['push']({'model':db['User'],'as':_0x4b7b('0x67'),'attributes':['id','fullname']});return db[_0x4b7b('0x2a')][_0x4b7b('0x34')]({'where':{'id':_0x4b2e11[_0x4b7b('0x28')]['id']},'include':_0x40bb8d})[_0x4b7b('0x1b')](handleEntityNotFound(_0x1db915,null))['then'](function(_0x258ed5){if(_0x258ed5){var _0x157097=_0x258ed5['get']({'plain':!![]});fs['mkdirSync'](_0x58a96c);var _0x532807={'channel':'Whatsapp','account':_0x157097['Account'][_0x4b7b('0x1e')],'agent':_0x157097['Owner']?_0x157097[_0x4b7b('0x67')][_0x4b7b('0x5b')]:_0x4b7b('0x68'),'createdAt':moment(_0x157097['createdAt'])[_0x4b7b('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4b7b('0x69')](),'closedAt':_0x157097[_0x4b7b('0x6a')]?moment(_0x157097[_0x4b7b('0x6b')])[_0x4b7b('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x157097[_0x4b7b('0x6c')],'messages':_(_0x157097[_0x4b7b('0x62')])[_0x4b7b('0x44')]({'secret':![]})['map'](function(_0x169058){if(_0x169058['Attachment']){var _0x36ace4=path['join'](_0x43a93e,_0x169058[_0x4b7b('0x61')][_0x4b7b('0x6d')]);if(fs[_0x4b7b('0x6e')](_0x36ace4)){fs['createReadStream'](_0x36ace4)[_0x4b7b('0x6f')](fs['createWriteStream'](path['join'](_0x58a96c,_0x169058[_0x4b7b('0x61')][_0x4b7b('0x6d')])));}}return{'date':moment(_0x169058[_0x4b7b('0x63')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x169058[_0x4b7b('0x64')]===_0x4b7b('0x70')?_0x169058[_0x4b7b('0x5a')]?_0x169058['User']['fullname']:_0x4b7b('0x71'):_0x169058[_0x4b7b('0x5d')][_0x4b7b('0x5e')]+(_0x169058[_0x4b7b('0x5d')][_0x4b7b('0x5f')]?'\x20'+_0x169058['Contact'][_0x4b7b('0x5f')]:''),'body':_0x169058[_0x4b7b('0x61')]?_0x169058[_0x4b7b('0x61')]['basename']:_0x169058[_0x4b7b('0x36')],'direction':_0x169058[_0x4b7b('0x64')]===_0x4b7b('0x70')?'A':'C','secret':_0x169058[_0x4b7b('0x72')],'read':_0x169058[_0x4b7b('0x65')],'attachment':_0x169058[_0x4b7b('0x61')]};})['value']()};return ejs[_0x4b7b('0x73')](path[_0x4b7b('0x53')](config[_0x4b7b('0x54')],_0x4b7b('0x55'),_0x4b7b('0x74'),'downloadInteraction.ejs'),{'interaction':_0x532807})[_0x4b7b('0x1b')](function(_0x607106){var _0x508946=path[_0x4b7b('0x53')](_0x58a96c,'transcript-'+_0x157097['id']+'-'+_0x24dbe2+_0x4b7b('0x75'));var _0x382fdb={'path':_0x508946,'channel':_0x4b7b('0x76'),'interactionId':_0x157097['id']};return pdf[_0x4b7b('0x77')](_0x607106,_0x382fdb);})[_0x4b7b('0x1b')](function(){return new BPromise(function(_0xa2cc74,_0x43ffc6){zipdir(_0x58a96c,{'saveTo':_0x35148a},function(_0x10e810,_0x335583){if(_0x10e810)return _0x43ffc6(_0x10e810);return _0xa2cc74(_0x335583);});})[_0x4b7b('0x1b')](function(){return new BPromise(function(_0x26988e,_0x50e139){rimraf(_0x58a96c,function(_0x21cf63){if(_0x21cf63)_0x50e139(_0x21cf63);return _0x26988e();});});})[_0x4b7b('0x1b')](function(){return _0x1db915[_0x4b7b('0x52')](_0x35148a,_0x515f6e,function(_0x282ec9){if(_0x282ec9){console[_0x4b7b('0x78')](_0x4b7b('0x79'),_0x282ec9);}else{fs[_0x4b7b('0x7a')](_0x35148a);}});});});}else{return _0x1db915['sendStatus'](0xc8);}})[_0x4b7b('0x26')](handleError(_0x1db915,null));};
\ No newline at end of file