Built motion from commit 459747fdfe53bbf13fbede61eeaffea1f1438f86. Version 3.0.0...
[motion-next.git] / server / api / openchannelInteraction / openchannelInteraction.controller.js
index 3bbedca..d2ecd01 100644 (file)
@@ -1 +1 @@
-const a480_0x1c6c=['filter','findOne','o.id\x20=\x20i.UserId','DESC','undefined','isEmpty','null','User','forEach','40px','compact','union','Contact.fax','fields','type','Contact.mobile','json','30px','then','ContactId','value','start','../../config/environment','split','i.id\x20LIKE\x20?','me.OpenchannelInteractionId\x20=\x20i.id','status','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','err','10px','ejs','like','Sequelize','setTags','getOpenchannelAccounts','Attachment','describe','resolve','keys','send','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','pipe','`\x20>\x200','YYYY-MM-DD','include','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','tag','Content-Range','addMessage','isNumeric','\x27\x27\x27\x27','$substring','files','Contact.lastName','ids','i.OpenchannelAccountId\x20IN\x20?','parseSearch','t.id\x20=\x20it.TagId','OpenchannelInteractionId','u.id','params','rows','show','<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>','System','disposition','conditions','Contact.email','$lte','transcript-%d-%s.zip','%s\x20#%d','length','downloadInteraction.html','join','lastName','u.fullname','all','where','QueryTypes','Tag','openchannel_interactions','find','text','Tags','api','c.fax','sort','removeTags','body','Owner.internal','register','ui.OpenchannelInteractionId','c.phone','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','attachments','destroy','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','a.id\x20=\x20i.OpenchannelAccountId','some','root','includeAll','TagIds','getFullTextValue','Account','\x20IS\x20NULL','count','sqlOperator','keyBy','operator','order','emit','parse','o.fullname','fieldName','basename','server','OpenchannelAccountId','o.internal','buildExpression','from','Account.mandatoryDisposition','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','set','filters','read','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','openchannel_messages','YYYY-MM-DD\x20HH:mm:ss','it.OpenchannelInteractionId\x20=\x20i.id','Messages','search','closed','attributes','Openchannel','UserId','Public','`unreadMessages`\x20=\x200','c.mobile','nolimit','offset','i.from\x20LIKE\x20?','limit','error','`unreadMessages`\x20>\x200','`\x20=\x200','select','../../components/parsers/advancedSearch','cm_contacts','addTags','having','intersection','unlinkSync','left_join','a.mandatoryDisposition','renderFile','pick','t.id\x20IN\x20?','concat','i.*','query','Owner.fullname','\x20=\x20?','group','moment','i.OpenchannelAccountId\x20IS\x20NULL','openchannel_interaction_has_tags','createWriteStream','options','isArray','toString','download','ui.OpenchannelInteractionId\x20IN\x20?','tools_tags','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','model','fullname','create','merge','SELECT','OpenchannelMessage','log','<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>','N.A.','update','mkdirSync','i.id','map','Owner','out','catch','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','sequelize','unix','Contact','tmp','push','unreadMessages','$gte','field','end','firstName','Private','openchannel_accounts','OpenchannelInteraction','sendStatus','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','existsSync','replace','stack','createdAt','users','openchannelInteractionTags:save','OpenchannelAccount','color','transcript-','CmContact','rawAttributes','name','format','GROUP_CONCAT(DISTINCT\x20t.id)','direction','toFile','u.id\x20=\x20ui.UserId','secret','c.firstName'];(function(_0x70a5bf,_0x1c6cf5){const _0x1830b7=function(_0x405bc8){while(--_0x405bc8){_0x70a5bf['push'](_0x70a5bf['shift']());}};_0x1830b7(++_0x1c6cf5);}(a480_0x1c6c,0x103));const a480_0x1830=function(_0x70a5bf,_0x1c6cf5){_0x70a5bf=_0x70a5bf-0x0;let _0x1830b7=a480_0x1c6c[_0x70a5bf];return _0x1830b7;};const _0x2f38a6=a480_0x1830;'use strict';const pdf=require('html-pdf'),rimraf=require('rimraf'),zipdir=require('zip-dir'),moment=require(_0x2f38a6('0x81')),util=require('util'),path=require('path'),ejs=require(_0x2f38a6('0xdd')),fs=require('fs'),_=require('lodash'),squel=require('squel'),{getSocket}=require('../../rediscache'),socket=getSocket(),qs=require('../../components/parsers/qs'),as=require(_0x2f38a6('0x70')),logger=require('../../config/logger')(_0x2f38a6('0x32')),config=require(_0x2f38a6('0xd5')),db=require('../../mysqldb')['db'],{Op}=require('sequelize');require('./openchannelInteraction.socket')[_0x2f38a6('0x38')](socket);function respondWithStatusCode(_0x405bc8,_0x463599){return _0x463599=_0x463599||0xcc,function(_0x4504bd){const _0x579079=a480_0x1830;if(_0x4504bd)return _0x405bc8[_0x579079('0xaa')](_0x463599);return _0x405bc8[_0x579079('0xd9')](_0x463599)['end']();};}function respondWithResult(_0x7b29a1,_0x27e33c){return _0x27e33c=_0x27e33c||0xc8,function(_0x2a0d45){const _0x3c9eff=a480_0x1830;if(_0x2a0d45)return _0x7b29a1[_0x3c9eff('0xd9')](_0x27e33c)[_0x3c9eff('0xcf')](_0x2a0d45);};}function respondWithFilteredResult(_0x193d5c,_0x30b2e4){return function(_0x5529db){const _0x5710a4=a480_0x1830;if(_0x5529db){const _0x281b2f=_0x5529db[_0x5710a4('0x47')],_0x502059=_0x30b2e4[_0x5710a4('0x69')];let _0x128e31=_0x30b2e4[_0x5710a4('0x69')]+_0x30b2e4[_0x5710a4('0x6b')],_0x27ad5d;return _0x128e31>=_0x281b2f?(_0x128e31=_0x281b2f,_0x27ad5d=0xc8):_0x27ad5d=0xce,_0x193d5c[_0x5710a4('0xd9')](_0x27ad5d),_0x193d5c[_0x5710a4('0x58')](_0x5710a4('0xd'),_0x502059+'-'+_0x128e31+'/'+_0x281b2f)[_0x5710a4('0xcf')](_0x5529db);}return null;};}function saveUpdates(_0x4f5ef7){return function(_0x7f8d1c){const _0x417c07=a480_0x1830;if(_0x7f8d1c)return _0x7f8d1c['update'](_0x4f5ef7)[_0x417c07('0xd1')](function(_0x1e42a4){return _0x1e42a4;});return null;};}function removeEntity(_0x72670c){return function(_0x21f433){const _0x8a16ef=a480_0x1830;if(_0x21f433)return _0x21f433[_0x8a16ef('0x3d')]()[_0x8a16ef('0xd1')](function(){const _0x1a9b81=_0x8a16ef;_0x72670c[_0x1a9b81('0xd9')](0xcc)[_0x1a9b81('0xa5')]();});};}function handleEntityNotFound(_0x593836){return function(_0x2ff5f0){return!_0x2ff5f0&&_0x593836['sendStatus'](0x194),_0x2ff5f0;};}function handleError(_0x59619c,_0x127f99){return _0x127f99=_0x127f99||0x1f4,function(_0x269aaf){const _0x1aa36f=a480_0x1830;logger[_0x1aa36f('0x6c')](_0x269aaf[_0x1aa36f('0xae')]),_0x269aaf[_0x1aa36f('0xb7')]&&delete _0x269aaf['name'],_0x59619c[_0x1aa36f('0xd9')](_0x127f99)[_0x1aa36f('0x5')](_0x269aaf);};}function getInteractionUsers(_0x1ae041,_0x4f469a){return new Promise(function(_0x18e999,_0x58010b){const _0x422340=a480_0x1830;try{_0x4f469a[_0x1ae041['id']]&&(_0x1ae041['Users']=_[_0x422340('0x98')](_0x4f469a[_0x1ae041['id']],function(_0x2cbf55){return{'id':_0x2cbf55['id'],'fullname':_0x2cbf55['fullname']};}));}catch(_0x26c9df){_0x58010b(_0x26c9df);}_0x18e999(_0x1ae041);});}function getInteractionTags(_0x4ce255,_0x4d9958){return new Promise(function(_0x41badf,_0x39aab9){const _0x22f21b=a480_0x1830;try{_0x4ce255[_0x22f21b('0x43')]&&(_0x4ce255[_0x22f21b('0x31')]=[],_0x4ce255[_0x22f21b('0x43')]['split'](',')['forEach'](function(_0x270e33){const _0x49ef7e=_0x22f21b;_0x4ce255[_0x49ef7e('0x31')][_0x49ef7e('0xa1')](_0x4d9958[_0x270e33]);})),delete _0x4ce255[_0x22f21b('0x43')];}catch(_0x11b8a2){_0x39aab9(_0x11b8a2);}_0x41badf(_0x4ce255);});}function updateOpenchannelInteraction(_0x1c245d,_0x34fe57,_0x3317bb){return new Promise(function(_0x11d4c3,_0x5e1404){const _0x52c0dd=a480_0x1830;return getInteractionUsers(_0x1c245d,_0x3317bb)['then'](function(_0x5cfa0a){return getInteractionTags(_0x5cfa0a,_0x34fe57);})['then'](function(_0x553d12){_0x11d4c3(_0x553d12);})[_0x52c0dd('0x9b')](function(_0x1ab7a6){_0x5e1404(_0x1ab7a6);});});}exports['index']=function(_0x335996,_0x4407db){const _0x17b863=_0x2f38a6,_0x717c53={},_0x60433a={},_0x5213c7={'count':0x0,'rows':[]},_0x2f9ec8=_[_0x17b863('0x98')](db[_0x17b863('0xa9')][_0x17b863('0xb6')],function(_0x74f8ba){const _0x23774c=_0x17b863;return{'name':_0x74f8ba[_0x23774c('0x4f')],'type':_0x74f8ba[_0x23774c('0xcd')]['key']};});_0x60433a[_0x17b863('0x8c')]=_[_0x17b863('0x98')](_0x2f9ec8,_0x17b863('0xb7')),_0x60433a[_0x17b863('0x7d')]=_[_0x17b863('0x4')](_0x335996[_0x17b863('0x7d')]),_0x60433a[_0x17b863('0x59')]=_[_0x17b863('0x74')](_0x60433a[_0x17b863('0x8c')],_0x60433a[_0x17b863('0x7d')]),_0x717c53[_0x17b863('0x62')]=_[_0x17b863('0x74')](_0x60433a[_0x17b863('0x8c')],qs['fields'](_0x335996[_0x17b863('0x7d')][_0x17b863('0xcc')])),_0x717c53['attributes']=_0x717c53[_0x17b863('0x62')][_0x17b863('0x25')]?_0x717c53['attributes']:_0x60433a['model'];typeof _0x335996[_0x17b863('0x7d')][_0x17b863('0x68')]===_0x17b863('0xc3')&&(_0x717c53[_0x17b863('0x6b')]=qs[_0x17b863('0x6b')](_0x335996[_0x17b863('0x7d')]['limit']),_0x717c53['offset']=qs['offset'](_0x335996[_0x17b863('0x7d')][_0x17b863('0x69')]));_0x717c53[_0x17b863('0x4b')]=qs['sort'](_0x335996[_0x17b863('0x7d')][_0x17b863('0x34')]),_0x717c53[_0x17b863('0x2b')]=qs[_0x17b863('0x59')](_['pick'](_0x335996[_0x17b863('0x7d')],_0x60433a[_0x17b863('0x59')]),_0x2f9ec8);let _0x217d7c=[];const _0x2fa6c9=squel[_0x17b863('0x6f')]()[_0x17b863('0xa4')]('id')[_0x17b863('0xa4')](_0x17b863('0xb7'))[_0x17b863('0xa4')]('color')[_0x17b863('0x55')]('tools_tags'),_0x3791b1=squel[_0x17b863('0x6f')]()[_0x17b863('0xa4')](_0x17b863('0x19'))['field'](_0x17b863('0x29'))['field'](_0x17b863('0x39'))['from']('user_has_openchannel_interactions','ui')[_0x17b863('0x76')](_0x17b863('0xb0'),'u',_0x17b863('0xbc')),_0x1b1940=squel[_0x17b863('0x6f')]()[_0x17b863('0x55')](_0x17b863('0x2e'),'i')[_0x17b863('0x76')](_0x17b863('0x71'),'c',_0x17b863('0xab'))['left_join'](_0x17b863('0xb0'),'o',_0x17b863('0xc1'))[_0x17b863('0x76')](_0x17b863('0xa8'),'a',_0x17b863('0x3f'))[_0x17b863('0x76')](_0x17b863('0x5c'),'me',_0x17b863('0xd8'))[_0x17b863('0x76')](_0x17b863('0x83'),'it',_0x17b863('0x5e'))[_0x17b863('0x76')](_0x17b863('0x8a'),'t',_0x17b863('0x17')),_0x270602=squel['expr']();let _0x552c18=[];const _0x51f1ad=squel['expr']();let _0x291466;if(_0x335996[_0x17b863('0x7d')][_0x17b863('0x60')]){_0x291466=as[_0x17b863('0x16')](_0x335996[_0x17b863('0x7d')]['search']);const _0x449925=_0x291466[_0x17b863('0x48')];for(let _0x3f7fce=0x0;_0x3f7fce<_0x291466[_0x17b863('0x20')]['length'];_0x3f7fce++){const _0x40a6dd=_0x291466[_0x17b863('0x20')][_0x3f7fce],_0x1edff6='i';let _0x2110cc,_0xbcf1e4=_[_0x17b863('0x2f')](_0x2f9ec8,['name',_0x40a6dd[_0x17b863('0xa4')]]);if(!_0xbcf1e4)switch(_0x40a6dd[_0x17b863('0xa4')]){case'unreadMessages':_0x40a6dd[_0x17b863('0xd3')]==0x1?_0x1b1940[_0x17b863('0x73')]('`'+_0x40a6dd[_0x17b863('0xa4')]+_0x17b863('0x6e')):_0x1b1940[_0x17b863('0x73')]('`'+_0x40a6dd['field']+_0x17b863('0x8'));break;case _0x17b863('0x9f'):if(_0x40a6dd[_0x17b863('0x4a')]===_0x17b863('0x11')){if(_0x40a6dd[_0x17b863('0xd3')]['split']('\x20')[_0x17b863('0x25')]>0x1)_0x270602[_0x449925](_0x17b863('0x3b'),qs[_0x17b863('0x44')](_0x40a6dd[_0x17b863('0xd3')]),null);else{const _0x29730e='%'+_0x40a6dd[_0x17b863('0xd3')]+'%';_0x270602[_0x449925](_0x17b863('0x5b'),_0x29730e,_0x29730e,_0x29730e);}}else _0xbcf1e4=_[_0x17b863('0x2f')](_0x2f9ec8,[_0x17b863('0xb7'),_0x17b863('0xd2')]),_0x40a6dd['field']=_0x17b863('0xd2'),_0x2110cc=as[_0x17b863('0x54')](_0x1edff6,_0xbcf1e4[_0x17b863('0xcd')],_0x40a6dd),_0x270602[_0x449925](_0x2110cc[_0x17b863('0x30')],_0x2110cc[_0x17b863('0xd3')][_0x17b863('0xd4')],_0x2110cc['value'][_0x17b863('0xa5')]);break;case _0x17b863('0x2d'):{const _0x55c066=_0x40a6dd[_0x17b863('0xd3')][_0x17b863('0xd6')](',')[_0x17b863('0x98')](function(_0x55344d){return Number(_0x55344d);});_0x55c066[_0x17b863('0xc7')](function(_0x561825){const _0x412e66=_0x17b863;_0x51f1ad['or'](_0x412e66('0x57'),'%,'+_0x561825+',%');}),_0x552c18=_[_0x17b863('0xca')](_0x552c18,_0x55c066);}break;case _0x17b863('0xc6'):_0x40a6dd[_0x17b863('0x4a')]==='$substring'?_0x270602[_0x449925](_0x17b863('0x9c'),'%'+_0x40a6dd[_0x17b863('0xd3')]+'%',null):(_0xbcf1e4=_[_0x17b863('0x2f')](_0x2f9ec8,[_0x17b863('0xb7'),'UserId']),_0x40a6dd['field']=_0x17b863('0x64'),_0x2110cc=as['buildExpression'](_0x1edff6,_0xbcf1e4[_0x17b863('0xcd')],_0x40a6dd),_0x270602[_0x449925](_0x2110cc[_0x17b863('0x30')],_0x2110cc['value'][_0x17b863('0xd4')],_0x2110cc[_0x17b863('0xd3')][_0x17b863('0xa5')]));break;case _0x17b863('0x36'):_0x2110cc=as[_0x17b863('0x54')]('me',null,_0x40a6dd),_0x270602[_0x449925](_0x2110cc['text'],_0x2110cc[_0x17b863('0xd3')]['start'],_0x2110cc['value']['end']);break;}else _0x2110cc=as[_0x17b863('0x54')](_0x1edff6,_0xbcf1e4[_0x17b863('0xcd')],_0x40a6dd),_0x270602[_0x449925](_0x2110cc[_0x17b863('0x30')],_0x2110cc[_0x17b863('0xd3')][_0x17b863('0xd4')],_0x2110cc[_0x17b863('0xd3')]['end']);}}else{const _0x2338dd=_(_0x335996[_0x17b863('0x7d')])[_0x17b863('0x4')]()['map'](function(_0x460d9d){const _0x46b118=_0x17b863;return _[_0x46b118('0x40')](_0x2f9ec8,[_0x46b118('0xb7'),_0x460d9d])?_0x460d9d:undefined;})[_0x17b863('0xc9')]()[_0x17b863('0xd3')]();!_[_0x17b863('0xc4')](_0x2338dd)&&_0x2338dd[_0x17b863('0xc7')](function(_0x1022fa){const _0x2ffd78=_0x17b863;if(_0x1022fa===_0x2ffd78('0x52'))_0x1b1940[_0x2ffd78('0x2b')](_0x2ffd78('0x15'),[][_0x2ffd78('0x7b')](_0x335996[_0x2ffd78('0x7d')][_0x1022fa]));else{if(_0x1022fa===_0x2ffd78('0xaf')){const _0x4ad968=JSON[_0x2ffd78('0x4d')](_0x335996[_0x2ffd78('0x7d')][_0x1022fa])['$gte'],_0x54392d=JSON[_0x2ffd78('0x4d')](_0x335996[_0x2ffd78('0x7d')][_0x1022fa])[_0x2ffd78('0x22')];_0x1b1940[_0x2ffd78('0x2b')](_0x2ffd78('0xb'),_0x4ad968,_0x54392d);}else _0x335996[_0x2ffd78('0x7d')][_0x1022fa]===_0x2ffd78('0xc5')?_0x1b1940[_0x2ffd78('0x2b')]('i.'+_0x1022fa+_0x2ffd78('0x46')):_0x1b1940[_0x2ffd78('0x2b')]('i.'+_0x1022fa+_0x2ffd78('0x7f'),_0x335996['query'][_0x1022fa]);}});_0x335996[_0x17b863('0x7d')][_0x17b863('0x5a')]&&(_0x335996[_0x17b863('0x7d')][_0x17b863('0x5a')]==0x1?_0x1b1940[_0x17b863('0x73')](_0x17b863('0x66')):_0x1b1940['having'](_0x17b863('0x6d')));_0x335996[_0x17b863('0x7d')][_0x17b863('0xc')]&&(_0x552c18=_[_0x17b863('0x86')](_0x335996[_0x17b863('0x7d')][_0x17b863('0xc')])?_0x335996[_0x17b863('0x7d')][_0x17b863('0xc')]:new Array(_0x335996['query'][_0x17b863('0xc')]),_0x552c18[_0x17b863('0xc7')](function(_0x448774){_0x51f1ad['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x448774+',%');}));if(_0x335996[_0x17b863('0x7d')][_0x17b863('0xbf')]){const _0x3f9250=_0x335996[_0x17b863('0x7d')][_0x17b863('0xbf')][_0x17b863('0xad')]('\x5c','\x5c\x5c')[_0x17b863('0xad')]('\x27\x27',_0x17b863('0x10'));qs[_0x17b863('0xf')](_0x3f9250)?_0x270602['or'](_0x17b863('0xd7'),_0x3f9250+'%'):_0x270602['or'](_0x17b863('0x6'),qs[_0x17b863('0x44')](_0x3f9250))['or'](_0x17b863('0x6a'),_0x3f9250+'%')['or'](_0x17b863('0x3e'),_0x3f9250+'%');}}_0x1b1940['where'](_0x270602),_0x1b1940[_0x17b863('0x80')](_0x17b863('0x97'));let _0x19157e={'type':db[_0x17b863('0xdf')][_0x17b863('0x2c')][_0x17b863('0x90')],'raw':!![]};const _0x14c03c=_0x1b1940['clone']();_0x14c03c[_0x17b863('0xa4')](_0x17b863('0x97')),_0x14c03c['field'](_0x17b863('0x8b'),_0x17b863('0xa2')),_0x717c53[_0x17b863('0x4b')]&&_0x717c53[_0x17b863('0x4b')]['forEach'](function(_0x231182){const _0x2741f5=_0x17b863;_0x1b1940[_0x2741f5('0x4b')]('i.'+_0x231182[0x0],_0x231182[0x1]===_0x2741f5('0xc2')?![]:!![]);}),!_[_0x17b863('0xc4')](_0x552c18)&&(_0x1b1940[_0x17b863('0x73')](_0x51f1ad),_0x14c03c[_0x17b863('0x2b')](_0x17b863('0x7a'),_0x552c18)),Promise[_0x17b863('0x3')]()[_0x17b863('0xd1')](function(){const _0x25cccf=_0x17b863;if(!_0x291466){if(_0x335996[_0x25cccf('0x7d')]['OpenchannelAccountId']||_0x335996[_0x25cccf('0x7d')]['journey'])return;_0x14c03c[_0x25cccf('0x2b')](_0x25cccf('0xda')),_0x1b1940[_0x25cccf('0x2b')](_0x25cccf('0xda'));return;}return _0x335996['user'][_0x25cccf('0x0')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2960ba){const _0x2ee9ee=_0x25cccf;_['isEmpty'](_0x2960ba)?(_0x14c03c[_0x2ee9ee('0x2b')](_0x2ee9ee('0x82')),_0x1b1940[_0x2ee9ee('0x2b')](_0x2ee9ee('0x82'))):(_0x14c03c[_0x2ee9ee('0x2b')](_0x2ee9ee('0x15'),_[_0x2ee9ee('0x98')](_0x2960ba,'id')),_0x1b1940[_0x2ee9ee('0x2b')](_0x2ee9ee('0x15'),_[_0x2ee9ee('0x98')](_0x2960ba,'id')));});})[_0x17b863('0xd1')](function(){const _0x37e3a5=_0x17b863;db[_0x37e3a5('0x9d')]['query'](_0x14c03c[_0x37e3a5('0x87')](),_0x19157e)[_0x37e3a5('0xd1')](function(_0x18160d){const _0x1d6f63=_0x37e3a5;_0x5213c7[_0x1d6f63('0x47')]=_0x18160d[_0x1d6f63('0x25')];if(_0x5213c7[_0x1d6f63('0x47')]===0x0)return[];return db[_0x1d6f63('0x9d')][_0x1d6f63('0x7d')](_0x2fa6c9[_0x1d6f63('0x87')](),_0x19157e)['then'](function(_0x1a924d){const _0x36ff30=_0x1d6f63;_0x217d7c=_[_0x36ff30('0x49')](_0x1a924d,'id'),_0x19157e=_['merge'](_0x19157e,{'model':db[_0x36ff30('0xa9')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x335996['query']['fields']?_0x717c53['attributes'][_0x36ff30('0xc7')](function(_0x4666b0){const _0x4f13c9=_0x36ff30;_0x1b1940[_0x4f13c9('0xa4')]('i.'+_0x4666b0);}):(_0x1b1940['field'](_0x36ff30('0x8b'),_0x36ff30('0xa2')),_0x1b1940['field']('a.key','Account.key'),_0x1b1940['field'](_0x36ff30('0x77'),_0x36ff30('0x56')),_0x1b1940['field'](_0x36ff30('0x7c')),_0x1b1940[_0x36ff30('0xa4')](_0x36ff30('0xbe'),'Contact.firstName'),_0x1b1940['field']('c.lastName',_0x36ff30('0x13')),_0x1b1940['field']('c.email',_0x36ff30('0x21')),_0x1b1940[_0x36ff30('0xa4')](_0x36ff30('0x3a'),'Contact.phone'),_0x1b1940[_0x36ff30('0xa4')](_0x36ff30('0x67'),_0x36ff30('0xce')),_0x1b1940[_0x36ff30('0xa4')](_0x36ff30('0x33'),_0x36ff30('0xcb')),_0x1b1940[_0x36ff30('0xa4')](_0x36ff30('0x4e'),_0x36ff30('0x7e')),_0x1b1940[_0x36ff30('0xa4')](_0x36ff30('0x53'),_0x36ff30('0x37')),_0x1b1940['field'](_0x36ff30('0xb9'),_0x36ff30('0x43')));if(_0x717c53[_0x36ff30('0x6b')])_0x1b1940[_0x36ff30('0x6b')](_0x717c53[_0x36ff30('0x6b')]);if(_0x717c53['offset'])_0x1b1940[_0x36ff30('0x69')](_0x717c53[_0x36ff30('0x69')]);return db[_0x36ff30('0x9d')][_0x36ff30('0x7d')](_0x1b1940[_0x36ff30('0x87')](),_0x19157e);})['then'](function(_0x2c7ba7){const _0x4d60ea=_0x1d6f63;return _0x3791b1['where'](_0x4d60ea('0x89'),_['map'](_0x2c7ba7,'id')),db[_0x4d60ea('0x9d')][_0x4d60ea('0x7d')](_0x3791b1[_0x4d60ea('0x87')](),_0x19157e)[_0x4d60ea('0xd1')](function(_0x447c5f){const _0x3d3527=_0x4d60ea,_0x51d081=_['groupBy'](_0x447c5f,'OpenchannelInteractionId'),_0x15ca22=[];return _0x2c7ba7[_0x3d3527('0xc7')](function(_0x14d692){const _0x56bdb9=_0x3d3527;_0x15ca22[_0x56bdb9('0xa1')](updateOpenchannelInteraction(_0x14d692,_0x217d7c,_0x51d081));}),Promise[_0x3d3527('0x2a')](_0x15ca22);});});})[_0x37e3a5('0xd1')](function(_0x19b0b2){const _0x44cfa0=_0x37e3a5;return _0x5213c7[_0x44cfa0('0x1b')]=_0x19b0b2,_0x5213c7;})[_0x37e3a5('0xd1')](respondWithFilteredResult(_0x4407db,_0x717c53));})[_0x17b863('0x9b')](handleError(_0x4407db,null));},exports[_0x2f38a6('0x1c')]=function(_0x380f5a,_0x407922){const _0x47bde7=_0x2f38a6,_0x2582c7={};_0x380f5a[_0x47bde7('0x7d')][_0x47bde7('0xcd')]&&_0x380f5a[_0x47bde7('0x7d')]['type']===_0x47bde7('0x55')?_0x2582c7[_0x47bde7('0x55')]=_0x380f5a[_0x47bde7('0x1a')]['id']:_0x2582c7['id']=_0x380f5a[_0x47bde7('0x1a')]['id'];let _0x51d3ce={'raw':![],'where':_0x2582c7};const _0x16efcc={};return _0x16efcc[_0x47bde7('0x8c')]=_[_0x47bde7('0x4')](db[_0x47bde7('0xa9')]['rawAttributes']),_0x16efcc['query']=_[_0x47bde7('0x4')](_0x380f5a[_0x47bde7('0x7d')]),_0x16efcc[_0x47bde7('0x59')]=_['intersection'](_0x16efcc[_0x47bde7('0x8c')],_0x16efcc[_0x47bde7('0x7d')]),_0x51d3ce[_0x47bde7('0x62')]=_[_0x47bde7('0x74')](_0x16efcc[_0x47bde7('0x8c')],qs['fields'](_0x380f5a[_0x47bde7('0x7d')][_0x47bde7('0xcc')])),_0x51d3ce[_0x47bde7('0x62')]=_0x51d3ce['attributes'][_0x47bde7('0x25')]?_0x51d3ce[_0x47bde7('0x62')]:_0x16efcc[_0x47bde7('0x8c')],_0x380f5a[_0x47bde7('0x7d')][_0x47bde7('0x42')]&&(_0x51d3ce[_0x47bde7('0xa')]=[{'all':!![]}]),_0x51d3ce=_[_0x47bde7('0x8f')]({},_0x51d3ce,_0x380f5a[_0x47bde7('0x85')]),db[_0x47bde7('0xa9')]['findOne'](_0x51d3ce)[_0x47bde7('0xd1')](handleEntityNotFound(_0x407922,null))[_0x47bde7('0xd1')](respondWithResult(_0x407922,null))[_0x47bde7('0x9b')](handleError(_0x407922,null));},exports[_0x2f38a6('0x8e')]=function(_0x1f6168,_0xf0b2e1){const _0x43f9b5=_0x2f38a6;return db[_0x43f9b5('0xa9')][_0x43f9b5('0x8e')](_0x1f6168[_0x43f9b5('0x36')],{})[_0x43f9b5('0xd1')](respondWithResult(_0xf0b2e1,0xc9))[_0x43f9b5('0x9b')](handleError(_0xf0b2e1,null));},exports[_0x2f38a6('0x95')]=function(_0x2f026b,_0x530b82){const _0x437514=_0x2f38a6;return _0x2f026b['body']['id']&&delete _0x2f026b[_0x437514('0x36')]['id'],db[_0x437514('0xa9')][_0x437514('0xc0')]({'where':{'id':_0x2f026b['params']['id']}})[_0x437514('0xd1')](handleEntityNotFound(_0x530b82,null))[_0x437514('0xd1')](saveUpdates(_0x2f026b['body'],null))[_0x437514('0xd1')](respondWithResult(_0x530b82,null))[_0x437514('0x9b')](handleError(_0x530b82,null));},exports[_0x2f38a6('0x3d')]=function(_0xfa7e2a,_0x2133da){const _0x2638f9=_0x2f38a6;return db[_0x2638f9('0xa9')]['findOne']({'where':{'id':_0xfa7e2a[_0x2638f9('0x1a')]['id']}})[_0x2638f9('0xd1')](handleEntityNotFound(_0x2133da,null))[_0x2638f9('0xd1')](removeEntity(_0x2133da,null))['catch'](handleError(_0x2133da,null));},exports[_0x2f38a6('0x2')]=function(_0x4670e1,_0x44e212){const _0x40424d=_0x2f38a6;return db[_0x40424d('0xa9')]['describe']()[_0x40424d('0xd1')](respondWithResult(_0x44e212,null))[_0x40424d('0x9b')](handleError(_0x44e212,null));},exports[_0x2f38a6('0xe')]=function(_0x2be0d7,_0xa525d9){const _0x5a6017=_0x2f38a6;return db[_0x5a6017('0x91')]['findOne']({'where':{'id':_0x2be0d7[_0x5a6017('0x1a')]['id']}})[_0x5a6017('0xd1')](function(_0x40fe91){const _0x222911=_0x5a6017;if(_0x40fe91)return _0x40fe91[_0x222911('0xe')](_0x2be0d7['body'][_0x222911('0x14')],{'through':_['omit'](_0x2be0d7['body'],[_0x222911('0x14'),'id'])});})[_0x5a6017('0xd1')](respondWithResult(_0xa525d9,null))[_0x5a6017('0x9b')](handleError(_0xa525d9,null));},exports['getMessages']=function(_0x207b05,_0x9e4837){const _0x7f582d=_0x2f38a6;let _0x2711a1={'raw':![],'where':{}};const _0x5b7151={},_0x443a7d={'count':0x0,'rows':[]};return db[_0x7f582d('0xa9')][_0x7f582d('0xc0')]({'where':{'id':_0x207b05[_0x7f582d('0x1a')]['id']}})[_0x7f582d('0xd1')](handleEntityNotFound(_0x9e4837,null))['then'](function(_0x9c2aca){const _0x398720=_0x7f582d;if(_0x9c2aca){_0x5b7151['model']=_[_0x398720('0x4')](db[_0x398720('0x91')][_0x398720('0xb6')]),_0x5b7151[_0x398720('0x7d')]=_[_0x398720('0x4')](_0x207b05[_0x398720('0x7d')]),_0x5b7151[_0x398720('0x59')]=_[_0x398720('0x74')](_0x5b7151['model'],_0x5b7151[_0x398720('0x7d')]),_0x2711a1['attributes']=_[_0x398720('0x74')](_0x5b7151[_0x398720('0x8c')],qs[_0x398720('0xcc')](_0x207b05[_0x398720('0x7d')][_0x398720('0xcc')])),_0x2711a1['attributes']=_0x2711a1[_0x398720('0x62')]['length']?_0x2711a1[_0x398720('0x62')]:_0x5b7151[_0x398720('0x8c')];typeof _0x207b05[_0x398720('0x7d')][_0x398720('0x68')]==='undefined'&&(_0x2711a1[_0x398720('0x6b')]=qs[_0x398720('0x6b')](_0x207b05['query'][_0x398720('0x6b')]),_0x2711a1['offset']=qs['offset'](_0x207b05[_0x398720('0x7d')][_0x398720('0x69')]));_0x2711a1[_0x398720('0x4b')]=qs[_0x398720('0x34')](_0x207b05[_0x398720('0x7d')][_0x398720('0x34')]),_0x2711a1[_0x398720('0x2b')]=qs[_0x398720('0x59')](_[_0x398720('0x79')](_0x207b05[_0x398720('0x7d')],_0x5b7151[_0x398720('0x59')])),_0x2711a1[_0x398720('0x2b')][_0x398720('0x18')]=_0x9c2aca['id'];_0x207b05[_0x398720('0x7d')][_0x398720('0xbf')]&&(_0x2711a1[_0x398720('0x2b')]=_['merge'](_0x2711a1[_0x398720('0x2b')],{[Op['or']]:_[_0x398720('0x98')](_0x2711a1[_0x398720('0x62')],function(_0xae35a2){const _0x5c55b3=_0x398720,_0x27b3bc={};return _0x27b3bc[_0xae35a2]={[Op[_0x5c55b3('0xde')]]:'%'+_0x207b05[_0x5c55b3('0x7d')][_0x5c55b3('0xbf')]+'%'},_0x27b3bc;})}));if(_0x207b05[_0x398720('0x7d')][_0x398720('0xa3')]){const _0x3c8dde=_0x207b05[_0x398720('0x7d')]['$gte'][_0x398720('0xd6')](','),_0x30cedb={};_0x30cedb[_0x3c8dde[0x0]]={[Op['gte']]:moment(_0x3c8dde[0x1])[_0x398720('0xb8')](_0x398720('0x5d'))},_0x2711a1[_0x398720('0x2b')]=_[_0x398720('0x8f')](_0x2711a1[_0x398720('0x2b')],_0x30cedb);}return _0x2711a1=_[_0x398720('0x8f')]({},_0x2711a1,_0x207b05['options']),db[_0x398720('0x91')]['count']({'where':_0x2711a1['where']})['then'](function(_0x567390){const _0x5f070b=_0x398720;return _0x443a7d[_0x5f070b('0x47')]=_0x567390,_0x207b05['query'][_0x5f070b('0x42')]&&(_0x2711a1['include']=[{'all':!![]}]),db['OpenchannelMessage']['findAll'](_0x2711a1);})['then'](function(_0x1d44f5){const _0x501b6a=_0x398720;return _0x443a7d[_0x501b6a('0x1b')]=_0x1d44f5,_0x443a7d;});}})[_0x7f582d('0xd1')](respondWithFilteredResult(_0x9e4837,_0x2711a1))[_0x7f582d('0x9b')](handleError(_0x9e4837,null));},exports[_0x2f38a6('0x72')]=function(_0x5e9c28,_0x11bd23){const _0x5a95f4=_0x2f38a6;return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x5e9c28[_0x5a95f4('0x1a')]['id']}})[_0x5a95f4('0xd1')](function(_0x5c1dab){const _0x2c6b99=_0x5a95f4;if(_0x5c1dab)return _0x5c1dab[_0x2c6b99('0xe0')](_0x5e9c28[_0x2c6b99('0x36')][_0x2c6b99('0x14')],{'through':_['omit'](_0x5e9c28[_0x2c6b99('0x36')],[_0x2c6b99('0x14'),'id'])})[_0x2c6b99('0xd1')](function(){const _0x50b595=_0x2c6b99;return db[_0x50b595('0x2d')]['findAll']({'attributes':['id','name',_0x50b595('0xb3')],'where':{'id':_0x5e9c28[_0x50b595('0x36')]['ids']}});})['then'](function(_0x2535ce){const _0x2cac25=_0x2c6b99;return socket[_0x2cac25('0x4c')](_0x2cac25('0xb1'),{'id':Number(_0x5e9c28['params']['id']),'tags':_0x2535ce||[]}),{'id':Number(_0x5e9c28[_0x2cac25('0x1a')]['id']),'tags':_0x2535ce||[]};});})[_0x5a95f4('0xd1')](respondWithResult(_0x11bd23,null))[_0x5a95f4('0x9b')](handleError(_0x11bd23,null));},exports[_0x2f38a6('0x35')]=function(_0xecd4ba,_0x4beb98){const _0x445d99=_0x2f38a6;return db[_0x445d99('0xa9')][_0x445d99('0xc0')]({'where':{'id':_0xecd4ba[_0x445d99('0x1a')]['id']}})[_0x445d99('0xd1')](handleEntityNotFound(_0x4beb98,null))[_0x445d99('0xd1')](function(_0x2ab5c5){const _0x46c75d=_0x445d99;if(_0x2ab5c5)return _0x2ab5c5[_0x46c75d('0x35')](_0xecd4ba[_0x46c75d('0x7d')][_0x46c75d('0x14')]);})['then'](respondWithStatusCode(_0x4beb98,null))[_0x445d99('0x9b')](handleError(_0x4beb98,null));},exports['download']=function(_0x51303e,_0x21a30d){const _0x268b79=_0x2f38a6,_0xf6fd4=moment()[_0x268b79('0x9e')]()[_0x268b79('0x87')](),_0x5db011=path[_0x268b79('0x27')](config[_0x268b79('0x41')],'files',_0x268b79('0xa0')),_0xdaaf27=path[_0x268b79('0x27')](config[_0x268b79('0x41')],_0x268b79('0x51'),_0x268b79('0x12'),_0x268b79('0x3c')),_0x1b7547=path[_0x268b79('0x27')](_0x5db011,_0xf6fd4),_0x88b49a=util['format'](_0x268b79('0x23'),_0x51303e[_0x268b79('0x1a')]['id'],_0xf6fd4),_0x549eb3=path['join'](_0x5db011,_0x88b49a),_0x5dd805=[];_0x5dd805[_0x268b79('0xa1')]({'model':db[_0x268b79('0xc6')],'as':'User','attributes':['id','fullname'],'raw':!![]}),_0x5dd805[_0x268b79('0xa1')]({'model':db[_0x268b79('0xb5')],'as':'Contact','attributes':['id',_0x268b79('0xa6'),_0x268b79('0x28')],'raw':!![]});_0x51303e[_0x268b79('0x7d')][_0x268b79('0x3c')]&&_0x5dd805['push']({'model':db[_0x268b79('0x1')],'as':'Attachment','raw':!![]});const _0x466a8c=[{'model':db[_0x268b79('0x91')],'as':_0x268b79('0x5f'),'attributes':['id','body',_0x268b79('0xaf'),_0x268b79('0xba'),_0x268b79('0xbd'),'read'],'include':_0x5dd805}];return _0x466a8c[_0x268b79('0xa1')]({'model':db[_0x268b79('0xb2')],'as':_0x268b79('0x45'),'attributes':['id',_0x268b79('0xb7')]}),_0x466a8c['push']({'model':db['User'],'as':_0x268b79('0x99'),'attributes':['id',_0x268b79('0x8d')]}),db[_0x268b79('0xa9')][_0x268b79('0xc0')]({'where':{'id':_0x51303e[_0x268b79('0x1a')]['id']},'include':_0x466a8c})['then'](handleEntityNotFound(_0x21a30d,null))['then'](function(_0x262572){const _0x2313cc=_0x268b79;if(_0x262572){const _0x20a31e=_0x262572['get']({'plain':!![]});fs[_0x2313cc('0x96')](_0x1b7547);const _0x3d73a3={'format':'A4','border':_0x2313cc('0xdc'),'header':{'height':_0x2313cc('0xc8'),'contents':{'first':_0x2313cc('0x93')}},'footer':{'height':_0x2313cc('0xd0'),'contents':{'default':util[_0x2313cc('0xb8')](_0x2313cc('0x1d'),util[_0x2313cc('0xb8')](_0x2313cc('0x24'),_0x2313cc('0x63'),_0x20a31e['id']),moment()[_0x2313cc('0xb8')](_0x2313cc('0x9'))[_0x2313cc('0x87')]())}}},_0x58f1df={'channel':_0x2313cc('0x63'),'account':_0x20a31e[_0x2313cc('0x45')][_0x2313cc('0xb7')],'agent':_0x20a31e[_0x2313cc('0x99')]?_0x20a31e['Owner']['fullname']:_0x2313cc('0x94'),'createdAt':moment(_0x20a31e[_0x2313cc('0xaf')])['format'](_0x2313cc('0x5d'))[_0x2313cc('0x87')](),'closedAt':_0x20a31e[_0x2313cc('0x61')]?moment(_0x20a31e['closedAt'])['format'](_0x2313cc('0x5d'))[_0x2313cc('0x87')]():'','disposition':_0x20a31e[_0x2313cc('0x1f')],'visibility':_0x20a31e['threadId']?_0x2313cc('0x65'):_0x2313cc('0xa7'),'messages':_(_0x20a31e[_0x2313cc('0x5f')])[_0x2313cc('0xbf')]({'secret':![]})['map'](function(_0x54a347){const _0x41561a=_0x2313cc;if(_0x54a347['Attachment']){const _0x2f9819=path[_0x41561a('0x27')](_0xdaaf27,_0x54a347[_0x41561a('0x1')][_0x41561a('0x50')]);fs[_0x41561a('0xac')](_0x2f9819)&&fs['createReadStream'](_0x2f9819)[_0x41561a('0x7')](fs[_0x41561a('0x84')](path[_0x41561a('0x27')](_0x1b7547,_0x54a347['Attachment'][_0x41561a('0x50')])));}return{'date':moment(_0x54a347['createdAt'])[_0x41561a('0xb8')](_0x41561a('0x5d'))['toString'](),'sender':_0x54a347[_0x41561a('0xba')]===_0x41561a('0x9a')?_0x54a347['User']?_0x54a347[_0x41561a('0xc6')][_0x41561a('0x8d')]:_0x41561a('0x1e'):_0x54a347[_0x41561a('0x9f')][_0x41561a('0xa6')]+(_0x54a347['Contact'][_0x41561a('0x28')]?'\x20'+_0x54a347[_0x41561a('0x9f')]['lastName']:''),'body':_0x54a347[_0x41561a('0x1')]?_0x54a347[_0x41561a('0x1')][_0x41561a('0x50')]:_0x54a347['body'],'direction':_0x54a347[_0x41561a('0xba')]===_0x41561a('0x9a')?'A':'C','secret':_0x54a347[_0x41561a('0xbd')],'read':_0x54a347[_0x41561a('0x5a')],'attachment':_0x54a347[_0x41561a('0x1')]};})['value']()};return ejs[_0x2313cc('0x78')](path[_0x2313cc('0x27')](config[_0x2313cc('0x41')],_0x2313cc('0x51'),'views',_0x2313cc('0x26')),{'interaction':_0x58f1df})[_0x2313cc('0xd1')](function(_0x1062fe){return new Promise(function(_0x115166,_0x34d4ba){const _0x13dc90=a480_0x1830;pdf[_0x13dc90('0x8e')](_0x1062fe,_0x3d73a3)[_0x13dc90('0xbb')](path[_0x13dc90('0x27')](_0x1b7547,_0x13dc90('0xb4')+_0x20a31e['id']+'-'+_0xf6fd4+'.pdf'),function(_0x465e6e,_0x528791){if(_0x465e6e)return _0x34d4ba(_0x465e6e);_0x115166(_0x528791);});});})[_0x2313cc('0xd1')](function(){const _0x233dbb=_0x2313cc;return new Promise(function(_0x54c7a8,_0x12aa79){zipdir(_0x1b7547,{'saveTo':_0x549eb3},function(_0x1786f5,_0x4368c1){if(_0x1786f5)return _0x12aa79(_0x1786f5);return _0x54c7a8(_0x4368c1);});})[_0x233dbb('0xd1')](function(){return new Promise(function(_0x15e49b,_0x34d878){rimraf(_0x1b7547,function(_0x5e379e){if(_0x5e379e)_0x34d878(_0x5e379e);return _0x15e49b();});});})[_0x233dbb('0xd1')](function(){const _0x422c2f=_0x233dbb;return _0x21a30d[_0x422c2f('0x88')](_0x549eb3,_0x88b49a,function(_0x52988d){const _0x8259f0=_0x422c2f;_0x52988d?console[_0x8259f0('0x92')](_0x8259f0('0xdb'),_0x52988d):fs[_0x8259f0('0x75')](_0x549eb3);});});});}else return _0x21a30d[_0x2313cc('0xaa')](0xc8);})[_0x268b79('0x9b')](handleError(_0x21a30d,null));};
\ No newline at end of file
+const a480_0x21d0=['ui.OpenchannelInteractionId','disposition','i.from\x20LIKE\x20?','operator','user','order','err','select','omit','count','type','emit','user_has_openchannel_interactions','\x20=\x20?','User','Owner','then','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','basename','register','join','include','10px','like','Account.key','i.OpenchannelAccountId\x20IS\x20NULL','transcript-%d-%s.zip','UserId','intersection','read','OpenchannelMessage','TagIds','key','sqlOperator','color','gte','server','zip-dir','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','openchannelInteractionTags:save','isEmpty','filters','a.mandatoryDisposition','c.firstName','toString','field','../../rediscache','attributes','keys','expr','i.id\x20LIKE\x20?','$substring','it.OpenchannelInteractionId\x20=\x20i.id','fields','moment','having','groupBy','create','buildExpression','Messages','search','unlinkSync','html-pdf','Contact','includeAll','createdAt','keyBy','sequelize','YYYY-MM-DD\x20HH:mm:ss','\x20IS\x20NULL','u.id','u.id\x20=\x20ui.UserId','30px','OpenchannelAccountId','o.internal','Public','ContactId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unix','openchannel_interaction_has_tags','getMessages','filter','rimraf','rawAttributes','openchannel_accounts','c.phone','CmContact','null','out','OpenchannelInteractionId','downloadInteraction.html','nolimit','attachments','findAll','sendStatus','./openchannelInteraction.socket','status','c.lastName','tag','N.A.','value','params','Owner.fullname','squel','addMessage','Account','u.fullname','left_join','some','i.OpenchannelAccountId\x20IN\x20?','pipe','map','Attachment','tmp','download','ids','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','a.key','o.fullname','cm_contacts','pick','concat','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','log','createWriteStream','fullname','replace','journey','QueryTypes','secret','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','transcript-','text','query','start','\x27\x27\x27\x27','addTags','closed','resolve','all','sort','me.OpenchannelInteractionId\x20=\x20i.id','find','../../mysqldb','lodash','unreadMessages','Content-Range','$lte','`unreadMessages`\x20=\x200','model','closedAt','DESC','split','forEach','Contact.lastName','offset','Owner.internal','group','get','a.id\x20=\x20i.OpenchannelAccountId','renderFile','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','c.mobile','body','options','stack','users','openchannel_interactions','findOne','Contact.firstName','removeTags','describe','Tag','Tags','where','end','%s\x20#%d','error','from','merge','mkdirSync','`\x20>\x200','Openchannel','YYYY-MM-DD','destroy','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','t.id\x20IN\x20?','views','OpenchannelAccount','catch','`unreadMessages`\x20>\x200','../../config/logger','lastName','toFile','$gte','undefined','files','name','setTags','format','<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>','../../config/environment','rows','tools_tags','direction','limit','push','update','send','json','OpenchannelInteraction','Private','length','root','Contact.mobile','isArray','i.*','compact','parse','conditions','c.fax','threadId','Account.mandatoryDisposition','firstName'];(function(_0x3c9dea,_0x21d01e){const _0x777041=function(_0x4b326a){while(--_0x4b326a){_0x3c9dea['push'](_0x3c9dea['shift']());}};_0x777041(++_0x21d01e);}(a480_0x21d0,0x1d2));const a480_0x7770=function(_0x3c9dea,_0x21d01e){_0x3c9dea=_0x3c9dea-0x0;let _0x777041=a480_0x21d0[_0x3c9dea];return _0x777041;};const _0x2c79f9=a480_0x7770;'use strict';const pdf=require(_0x2c79f9('0x2c')),rimraf=require(_0x2c79f9('0x40')),zipdir=require(_0x2c79f9('0x13')),moment=require(_0x2c79f9('0x24')),util=require('util'),path=require('path'),ejs=require('ejs'),fs=require('fs'),_=require(_0x2c79f9('0x7e')),squel=require(_0x2c79f9('0x55')),{getSocket}=require(_0x2c79f9('0x1c')),socket=getSocket(),qs=require('../../components/parsers/qs'),as=require('../../components/parsers/advancedSearch'),logger=require(_0x2c79f9('0xad'))('api'),config=require(_0x2c79f9('0xb7')),db=require(_0x2c79f9('0x7d'))['db'],{Op}=require(_0x2c79f9('0x31'));require(_0x2c79f9('0x4d'))[_0x2c79f9('0x1')](socket);function respondWithStatusCode(_0x4b326a,_0x49fdff){return _0x49fdff=_0x49fdff||0xcc,function(_0x5eeac0){const _0x4ebccb=a480_0x7770;if(_0x5eeac0)return _0x4b326a[_0x4ebccb('0x4c')](_0x49fdff);return _0x4b326a[_0x4ebccb('0x4e')](_0x49fdff)[_0x4ebccb('0x9d')]();};}function respondWithResult(_0x10dddc,_0x1921ec){return _0x1921ec=_0x1921ec||0xc8,function(_0x2a437c){const _0x94676c=a480_0x7770;if(_0x2a437c)return _0x10dddc[_0x94676c('0x4e')](_0x1921ec)[_0x94676c('0xbf')](_0x2a437c);};}function respondWithFilteredResult(_0x4bffc1,_0x3b768b){return function(_0x4a9b77){const _0x53a965=a480_0x7770;if(_0x4a9b77){const _0x324088=_0x4a9b77[_0x53a965('0xd7')],_0x62dc80=_0x3b768b[_0x53a965('0x89')];let _0xf1486=_0x3b768b['offset']+_0x3b768b['limit'],_0x32c614;return _0xf1486>=_0x324088?(_0xf1486=_0x324088,_0x32c614=0xc8):_0x32c614=0xce,_0x4bffc1[_0x53a965('0x4e')](_0x32c614),_0x4bffc1['set'](_0x53a965('0x80'),_0x62dc80+'-'+_0xf1486+'/'+_0x324088)[_0x53a965('0xbf')](_0x4a9b77);}return null;};}function saveUpdates(_0x28acc4){return function(_0x42a37e){const _0x546bb8=a480_0x7770;if(_0x42a37e)return _0x42a37e[_0x546bb8('0xbd')](_0x28acc4)[_0x546bb8('0xde')](function(_0x530b14){return _0x530b14;});return null;};}function removeEntity(_0x39a5ef){return function(_0xb4c906){const _0x483512=a480_0x7770;if(_0xb4c906)return _0xb4c906[_0x483512('0xa6')]()[_0x483512('0xde')](function(){const _0x4d82bb=_0x483512;_0x39a5ef[_0x4d82bb('0x4e')](0xcc)[_0x4d82bb('0x9d')]();});};}function handleEntityNotFound(_0x46e8af){return function(_0x34f55f){return!_0x34f55f&&_0x46e8af['sendStatus'](0x194),_0x34f55f;};}function handleError(_0x57022d,_0x43e559){return _0x43e559=_0x43e559||0x1f4,function(_0x31465e){const _0x2e20bf=a480_0x7770;logger[_0x2e20bf('0x9f')](_0x31465e[_0x2e20bf('0x93')]),_0x31465e[_0x2e20bf('0xb3')]&&delete _0x31465e['name'],_0x57022d[_0x2e20bf('0x4e')](_0x43e559)[_0x2e20bf('0xbe')](_0x31465e);};}function getInteractionUsers(_0x5cd800,_0x12c9ab){return new Promise(function(_0xb8d99c,_0x1561f5){const _0x72ca5a=a480_0x7770;try{_0x12c9ab[_0x5cd800['id']]&&(_0x5cd800['Users']=_[_0x72ca5a('0x5d')](_0x12c9ab[_0x5cd800['id']],function(_0x2dc4fa){const _0x598375=_0x72ca5a;return{'id':_0x2dc4fa['id'],'fullname':_0x2dc4fa[_0x598375('0x6b')]};}));}catch(_0x562d3e){_0x1561f5(_0x562d3e);}_0xb8d99c(_0x5cd800);});}function getInteractionTags(_0x5a6dea,_0x168778){return new Promise(function(_0x18cc56,_0x529f0b){const _0x4d76ab=a480_0x7770;try{_0x5a6dea['TagIds']&&(_0x5a6dea[_0x4d76ab('0x9b')]=[],_0x5a6dea['TagIds'][_0x4d76ab('0x86')](',')[_0x4d76ab('0x87')](function(_0x3167aa){const _0x44cc97=_0x4d76ab;_0x5a6dea['Tags'][_0x44cc97('0xbc')](_0x168778[_0x3167aa]);})),delete _0x5a6dea[_0x4d76ab('0xd')];}catch(_0x458418){_0x529f0b(_0x458418);}_0x18cc56(_0x5a6dea);});}function updateOpenchannelInteraction(_0x46844d,_0x2797da,_0x297ccc){return new Promise(function(_0x4a6208,_0x12175a){const _0x1bdb6f=a480_0x7770;return getInteractionUsers(_0x46844d,_0x297ccc)['then'](function(_0x205c82){return getInteractionTags(_0x205c82,_0x2797da);})[_0x1bdb6f('0xde')](function(_0x47b048){_0x4a6208(_0x47b048);})[_0x1bdb6f('0xab')](function(_0x4410f2){_0x12175a(_0x4410f2);});});}exports['index']=function(_0x77cf85,_0x2dfb08){const _0x17fc0b=_0x2c79f9,_0x2752a4={},_0x208f72={},_0x163121={'count':0x0,'rows':[]},_0x8a812e=_[_0x17fc0b('0x5d')](db[_0x17fc0b('0xc0')]['rawAttributes'],function(_0x42db89){const _0x435ce8=_0x17fc0b;return{'name':_0x42db89['fieldName'],'type':_0x42db89[_0x435ce8('0xd8')][_0x435ce8('0xe')]};});_0x208f72[_0x17fc0b('0x83')]=_[_0x17fc0b('0x5d')](_0x8a812e,'name'),_0x208f72[_0x17fc0b('0x73')]=_[_0x17fc0b('0x1e')](_0x77cf85[_0x17fc0b('0x73')]),_0x208f72[_0x17fc0b('0x17')]=_['intersection'](_0x208f72[_0x17fc0b('0x83')],_0x208f72[_0x17fc0b('0x73')]),_0x2752a4[_0x17fc0b('0x1d')]=_[_0x17fc0b('0xa')](_0x208f72['model'],qs[_0x17fc0b('0x23')](_0x77cf85['query'][_0x17fc0b('0x23')])),_0x2752a4['attributes']=_0x2752a4[_0x17fc0b('0x1d')][_0x17fc0b('0xc2')]?_0x2752a4['attributes']:_0x208f72[_0x17fc0b('0x83')];typeof _0x77cf85[_0x17fc0b('0x73')][_0x17fc0b('0x49')]===_0x17fc0b('0xb1')&&(_0x2752a4[_0x17fc0b('0xbb')]=qs[_0x17fc0b('0xbb')](_0x77cf85[_0x17fc0b('0x73')]['limit']),_0x2752a4['offset']=qs[_0x17fc0b('0x89')](_0x77cf85[_0x17fc0b('0x73')][_0x17fc0b('0x89')]));_0x2752a4['order']=qs['sort'](_0x77cf85[_0x17fc0b('0x73')]['sort']),_0x2752a4['where']=qs['filters'](_[_0x17fc0b('0x66')](_0x77cf85[_0x17fc0b('0x73')],_0x208f72['filters']),_0x8a812e);let _0x1ecdde=[];const _0x41fa77=squel[_0x17fc0b('0xd5')]()[_0x17fc0b('0x1b')]('id')[_0x17fc0b('0x1b')](_0x17fc0b('0xb3'))['field'](_0x17fc0b('0x10'))[_0x17fc0b('0xa0')]('tools_tags'),_0x36baac=squel[_0x17fc0b('0xd5')]()[_0x17fc0b('0x1b')](_0x17fc0b('0x34'))[_0x17fc0b('0x1b')](_0x17fc0b('0x58'))[_0x17fc0b('0x1b')](_0x17fc0b('0xce'))[_0x17fc0b('0xa0')](_0x17fc0b('0xda'),'ui')[_0x17fc0b('0x59')](_0x17fc0b('0x94'),'u',_0x17fc0b('0x35')),_0x2977a9=squel[_0x17fc0b('0xd5')]()[_0x17fc0b('0xa0')](_0x17fc0b('0x95'),'i')[_0x17fc0b('0x59')](_0x17fc0b('0x65'),'c',_0x17fc0b('0x8f'))[_0x17fc0b('0x59')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x17fc0b('0x42'),'a',_0x17fc0b('0x8d'))[_0x17fc0b('0x59')]('openchannel_messages','me',_0x17fc0b('0x7b'))['left_join'](_0x17fc0b('0x3d'),'it',_0x17fc0b('0x22'))[_0x17fc0b('0x59')](_0x17fc0b('0xb9'),'t','t.id\x20=\x20it.TagId'),_0xac17e9=squel[_0x17fc0b('0x1f')]();let _0x39bbf3=[];const _0x5eb742=squel[_0x17fc0b('0x1f')]();let _0xdd21bd;if(_0x77cf85[_0x17fc0b('0x73')][_0x17fc0b('0x2a')]){_0xdd21bd=as['parseSearch'](_0x77cf85[_0x17fc0b('0x73')]['search']);const _0x4ce6c0=_0xdd21bd[_0x17fc0b('0xf')];for(let _0x1ab51e=0x0;_0x1ab51e<_0xdd21bd[_0x17fc0b('0xc9')][_0x17fc0b('0xc2')];_0x1ab51e++){const _0x2aba9a=_0xdd21bd[_0x17fc0b('0xc9')][_0x1ab51e],_0x2d8310='i';let _0x3405ff,_0x2dc978=_[_0x17fc0b('0x7c')](_0x8a812e,[_0x17fc0b('0xb3'),_0x2aba9a['field']]);if(!_0x2dc978)switch(_0x2aba9a[_0x17fc0b('0x1b')]){case _0x17fc0b('0x7f'):_0x2aba9a[_0x17fc0b('0x52')]==0x1?_0x2977a9[_0x17fc0b('0x25')]('`'+_0x2aba9a['field']+'`\x20=\x200'):_0x2977a9[_0x17fc0b('0x25')]('`'+_0x2aba9a['field']+_0x17fc0b('0xa3'));break;case _0x17fc0b('0x2d'):if(_0x2aba9a['operator']==='$substring'){if(_0x2aba9a[_0x17fc0b('0x52')][_0x17fc0b('0x86')]('\x20')[_0x17fc0b('0xc2')]>0x1)_0xac17e9[_0x4ce6c0](_0x17fc0b('0x68'),qs['getFullTextValue'](_0x2aba9a['value']),null);else{const _0x51c34b='%'+_0x2aba9a[_0x17fc0b('0x52')]+'%';_0xac17e9[_0x4ce6c0](_0x17fc0b('0x62'),_0x51c34b,_0x51c34b,_0x51c34b);}}else _0x2dc978=_[_0x17fc0b('0x7c')](_0x8a812e,[_0x17fc0b('0xb3'),_0x17fc0b('0x3a')]),_0x2aba9a[_0x17fc0b('0x1b')]=_0x17fc0b('0x3a'),_0x3405ff=as['buildExpression'](_0x2d8310,_0x2dc978[_0x17fc0b('0xd8')],_0x2aba9a),_0xac17e9[_0x4ce6c0](_0x3405ff['text'],_0x3405ff[_0x17fc0b('0x52')]['start'],_0x3405ff['value'][_0x17fc0b('0x9d')]);break;case _0x17fc0b('0x9a'):{const _0x442a0b=_0x2aba9a[_0x17fc0b('0x52')]['split'](',')['map'](function(_0x2b45e7){return Number(_0x2b45e7);});_0x442a0b[_0x17fc0b('0x87')](function(_0x505c9b){const _0x13c6ea=_0x17fc0b;_0x5eb742['or'](_0x13c6ea('0x3b'),'%,'+_0x505c9b+',%');}),_0x39bbf3=_['union'](_0x39bbf3,_0x442a0b);}break;case _0x17fc0b('0xdc'):_0x2aba9a[_0x17fc0b('0xd1')]===_0x17fc0b('0x21')?_0xac17e9[_0x4ce6c0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2aba9a[_0x17fc0b('0x52')]+'%',null):(_0x2dc978=_['find'](_0x8a812e,[_0x17fc0b('0xb3'),_0x17fc0b('0x9')]),_0x2aba9a['field']=_0x17fc0b('0x9'),_0x3405ff=as[_0x17fc0b('0x28')](_0x2d8310,_0x2dc978[_0x17fc0b('0xd8')],_0x2aba9a),_0xac17e9[_0x4ce6c0](_0x3405ff[_0x17fc0b('0x72')],_0x3405ff[_0x17fc0b('0x52')]['start'],_0x3405ff[_0x17fc0b('0x52')]['end']));break;case _0x17fc0b('0x91'):_0x3405ff=as['buildExpression']('me',null,_0x2aba9a),_0xac17e9[_0x4ce6c0](_0x3405ff[_0x17fc0b('0x72')],_0x3405ff[_0x17fc0b('0x52')][_0x17fc0b('0x74')],_0x3405ff[_0x17fc0b('0x52')][_0x17fc0b('0x9d')]);break;}else _0x3405ff=as[_0x17fc0b('0x28')](_0x2d8310,_0x2dc978[_0x17fc0b('0xd8')],_0x2aba9a),_0xac17e9[_0x4ce6c0](_0x3405ff[_0x17fc0b('0x72')],_0x3405ff[_0x17fc0b('0x52')][_0x17fc0b('0x74')],_0x3405ff['value'][_0x17fc0b('0x9d')]);}}else{const _0x59c754=_(_0x77cf85['query'])[_0x17fc0b('0x1e')]()[_0x17fc0b('0x5d')](function(_0x51c08e){const _0xa2b5d=_0x17fc0b;return _[_0xa2b5d('0x5a')](_0x8a812e,[_0xa2b5d('0xb3'),_0x51c08e])?_0x51c08e:undefined;})[_0x17fc0b('0xc7')]()[_0x17fc0b('0x52')]();!_[_0x17fc0b('0x16')](_0x59c754)&&_0x59c754[_0x17fc0b('0x87')](function(_0x73ce6e){const _0x5803b9=_0x17fc0b;if(_0x73ce6e===_0x5803b9('0x37'))_0x2977a9['where'](_0x5803b9('0x5b'),[][_0x5803b9('0x67')](_0x77cf85[_0x5803b9('0x73')][_0x73ce6e]));else{if(_0x73ce6e===_0x5803b9('0x2f')){const _0x38811a=JSON[_0x5803b9('0xc8')](_0x77cf85[_0x5803b9('0x73')][_0x73ce6e])[_0x5803b9('0xb0')],_0x482a4=JSON['parse'](_0x77cf85[_0x5803b9('0x73')][_0x73ce6e])[_0x5803b9('0x81')];_0x2977a9[_0x5803b9('0x9c')](_0x5803b9('0xa7'),_0x38811a,_0x482a4);}else _0x77cf85[_0x5803b9('0x73')][_0x73ce6e]===_0x5803b9('0x45')?_0x2977a9[_0x5803b9('0x9c')]('i.'+_0x73ce6e+_0x5803b9('0x33')):_0x2977a9[_0x5803b9('0x9c')]('i.'+_0x73ce6e+_0x5803b9('0xdb'),_0x77cf85['query'][_0x73ce6e]);}});_0x77cf85[_0x17fc0b('0x73')][_0x17fc0b('0xb')]&&(_0x77cf85[_0x17fc0b('0x73')][_0x17fc0b('0xb')]==0x1?_0x2977a9[_0x17fc0b('0x25')](_0x17fc0b('0x82')):_0x2977a9[_0x17fc0b('0x25')](_0x17fc0b('0xac')));_0x77cf85['query'][_0x17fc0b('0x50')]&&(_0x39bbf3=_[_0x17fc0b('0xc5')](_0x77cf85[_0x17fc0b('0x73')]['tag'])?_0x77cf85[_0x17fc0b('0x73')][_0x17fc0b('0x50')]:new Array(_0x77cf85[_0x17fc0b('0x73')][_0x17fc0b('0x50')]),_0x39bbf3[_0x17fc0b('0x87')](function(_0x33d2be){const _0x2f90db=_0x17fc0b;_0x5eb742['or'](_0x2f90db('0x3b'),'%,'+_0x33d2be+',%');}));if(_0x77cf85[_0x17fc0b('0x73')][_0x17fc0b('0x3f')]){const _0x209cb8=_0x77cf85['query'][_0x17fc0b('0x3f')]['replace']('\x5c','\x5c\x5c')[_0x17fc0b('0x6c')]('\x27\x27',_0x17fc0b('0x75'));qs['isNumeric'](_0x209cb8)?_0xac17e9['or'](_0x17fc0b('0x20'),_0x209cb8+'%'):_0xac17e9['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x209cb8))['or'](_0x17fc0b('0xd0'),_0x209cb8+'%')['or'](_0x17fc0b('0xdf'),_0x209cb8+'%');}}_0x2977a9[_0x17fc0b('0x9c')](_0xac17e9),_0x2977a9[_0x17fc0b('0x8b')]('i.id');let _0xd67a30={'type':db['Sequelize'][_0x17fc0b('0x6e')]['SELECT'],'raw':!![]};const _0x57860b=_0x2977a9['clone']();_0x57860b[_0x17fc0b('0x1b')]('i.id'),_0x57860b['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x17fc0b('0x7f')),_0x2752a4[_0x17fc0b('0xd3')]&&_0x2752a4[_0x17fc0b('0xd3')]['forEach'](function(_0x3e7cc2){const _0x5055f6=_0x17fc0b;_0x2977a9[_0x5055f6('0xd3')]('i.'+_0x3e7cc2[0x0],_0x3e7cc2[0x1]===_0x5055f6('0x85')?![]:!![]);}),!_['isEmpty'](_0x39bbf3)&&(_0x2977a9['having'](_0x5eb742),_0x57860b[_0x17fc0b('0x9c')](_0x17fc0b('0xa8'),_0x39bbf3)),Promise[_0x17fc0b('0x78')]()[_0x17fc0b('0xde')](function(){const _0x4bf889=_0x17fc0b;if(!_0xdd21bd){if(_0x77cf85[_0x4bf889('0x73')]['OpenchannelAccountId']||_0x77cf85[_0x4bf889('0x73')][_0x4bf889('0x6d')])return;_0x57860b[_0x4bf889('0x9c')](_0x4bf889('0x70')),_0x2977a9['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x77cf85[_0x4bf889('0xd2')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x4bf889('0xde')](function(_0x18b0ec){const _0x3e0ae8=_0x4bf889;_[_0x3e0ae8('0x16')](_0x18b0ec)?(_0x57860b[_0x3e0ae8('0x9c')](_0x3e0ae8('0x7')),_0x2977a9[_0x3e0ae8('0x9c')](_0x3e0ae8('0x7'))):(_0x57860b[_0x3e0ae8('0x9c')](_0x3e0ae8('0x5b'),_['map'](_0x18b0ec,'id')),_0x2977a9[_0x3e0ae8('0x9c')](_0x3e0ae8('0x5b'),_[_0x3e0ae8('0x5d')](_0x18b0ec,'id')));});})['then'](function(){const _0x380df9=_0x17fc0b;db[_0x380df9('0x31')]['query'](_0x57860b[_0x380df9('0x1a')](),_0xd67a30)['then'](function(_0x48d6b3){const _0x33f2ce=_0x380df9;_0x163121[_0x33f2ce('0xd7')]=_0x48d6b3['length'];if(_0x163121[_0x33f2ce('0xd7')]===0x0)return[];return db[_0x33f2ce('0x31')]['query'](_0x41fa77[_0x33f2ce('0x1a')](),_0xd67a30)[_0x33f2ce('0xde')](function(_0x538385){const _0x153379=_0x33f2ce;_0x1ecdde=_[_0x153379('0x30')](_0x538385,'id'),_0xd67a30=_[_0x153379('0xa1')](_0xd67a30,{'model':db[_0x153379('0xc0')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x77cf85['query'][_0x153379('0x23')]?_0x2752a4[_0x153379('0x1d')][_0x153379('0x87')](function(_0x5b493e){const _0x156e5e=_0x153379;_0x2977a9[_0x156e5e('0x1b')]('i.'+_0x5b493e);}):(_0x2977a9[_0x153379('0x1b')](_0x153379('0x14'),_0x153379('0x7f')),_0x2977a9['field'](_0x153379('0x63'),_0x153379('0x6')),_0x2977a9[_0x153379('0x1b')](_0x153379('0x18'),_0x153379('0xcc')),_0x2977a9[_0x153379('0x1b')](_0x153379('0xc6')),_0x2977a9[_0x153379('0x1b')](_0x153379('0x19'),_0x153379('0x97')),_0x2977a9[_0x153379('0x1b')](_0x153379('0x4f'),_0x153379('0x88')),_0x2977a9[_0x153379('0x1b')]('c.email','Contact.email'),_0x2977a9[_0x153379('0x1b')](_0x153379('0x43'),'Contact.phone'),_0x2977a9[_0x153379('0x1b')](_0x153379('0x90'),_0x153379('0xc4')),_0x2977a9[_0x153379('0x1b')](_0x153379('0xca'),'Contact.fax'),_0x2977a9[_0x153379('0x1b')](_0x153379('0x64'),_0x153379('0x54')),_0x2977a9[_0x153379('0x1b')](_0x153379('0x38'),_0x153379('0x8a')),_0x2977a9[_0x153379('0x1b')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds'));if(_0x2752a4[_0x153379('0xbb')])_0x2977a9[_0x153379('0xbb')](_0x2752a4['limit']);if(_0x2752a4[_0x153379('0x89')])_0x2977a9[_0x153379('0x89')](_0x2752a4[_0x153379('0x89')]);return db[_0x153379('0x31')][_0x153379('0x73')](_0x2977a9[_0x153379('0x1a')](),_0xd67a30);})[_0x33f2ce('0xde')](function(_0x2b8a14){const _0x3ddc3d=_0x33f2ce;return _0x36baac[_0x3ddc3d('0x9c')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x3ddc3d('0x5d')](_0x2b8a14,'id')),db[_0x3ddc3d('0x31')][_0x3ddc3d('0x73')](_0x36baac[_0x3ddc3d('0x1a')](),_0xd67a30)[_0x3ddc3d('0xde')](function(_0x3977ea){const _0xf2d239=_0x3ddc3d,_0x48e4e7=_[_0xf2d239('0x26')](_0x3977ea,_0xf2d239('0x47')),_0x441d1d=[];return _0x2b8a14[_0xf2d239('0x87')](function(_0x52b11a){const _0x4bc3e2=_0xf2d239;_0x441d1d[_0x4bc3e2('0xbc')](updateOpenchannelInteraction(_0x52b11a,_0x1ecdde,_0x48e4e7));}),Promise[_0xf2d239('0x79')](_0x441d1d);});});})[_0x380df9('0xde')](function(_0x2be436){const _0x455795=_0x380df9;return _0x163121[_0x455795('0xb8')]=_0x2be436,_0x163121;})['then'](respondWithFilteredResult(_0x2dfb08,_0x2752a4));})['catch'](handleError(_0x2dfb08,null));},exports['show']=function(_0x1f8679,_0x252854){const _0x36feb4=_0x2c79f9,_0x198e87={};_0x1f8679[_0x36feb4('0x73')][_0x36feb4('0xd8')]&&_0x1f8679['query'][_0x36feb4('0xd8')]===_0x36feb4('0xa0')?_0x198e87['from']=_0x1f8679[_0x36feb4('0x53')]['id']:_0x198e87['id']=_0x1f8679['params']['id'];let _0x41b4e0={'raw':![],'where':_0x198e87};const _0x4905d1={};return _0x4905d1[_0x36feb4('0x83')]=_[_0x36feb4('0x1e')](db[_0x36feb4('0xc0')][_0x36feb4('0x41')]),_0x4905d1[_0x36feb4('0x73')]=_[_0x36feb4('0x1e')](_0x1f8679[_0x36feb4('0x73')]),_0x4905d1[_0x36feb4('0x17')]=_[_0x36feb4('0xa')](_0x4905d1[_0x36feb4('0x83')],_0x4905d1['query']),_0x41b4e0[_0x36feb4('0x1d')]=_['intersection'](_0x4905d1['model'],qs[_0x36feb4('0x23')](_0x1f8679[_0x36feb4('0x73')][_0x36feb4('0x23')])),_0x41b4e0[_0x36feb4('0x1d')]=_0x41b4e0[_0x36feb4('0x1d')][_0x36feb4('0xc2')]?_0x41b4e0['attributes']:_0x4905d1['model'],_0x1f8679[_0x36feb4('0x73')][_0x36feb4('0x2e')]&&(_0x41b4e0[_0x36feb4('0x3')]=[{'all':!![]}]),_0x41b4e0=_['merge']({},_0x41b4e0,_0x1f8679[_0x36feb4('0x92')]),db[_0x36feb4('0xc0')][_0x36feb4('0x96')](_0x41b4e0)[_0x36feb4('0xde')](handleEntityNotFound(_0x252854,null))[_0x36feb4('0xde')](respondWithResult(_0x252854,null))[_0x36feb4('0xab')](handleError(_0x252854,null));},exports[_0x2c79f9('0x27')]=function(_0x48aa53,_0x4964f7){const _0x553879=_0x2c79f9;return db[_0x553879('0xc0')]['create'](_0x48aa53[_0x553879('0x91')],{})[_0x553879('0xde')](respondWithResult(_0x4964f7,0xc9))[_0x553879('0xab')](handleError(_0x4964f7,null));},exports['update']=function(_0x537b1c,_0x74e3e5){const _0x40ed44=_0x2c79f9;return _0x537b1c[_0x40ed44('0x91')]['id']&&delete _0x537b1c[_0x40ed44('0x91')]['id'],db[_0x40ed44('0xc0')][_0x40ed44('0x96')]({'where':{'id':_0x537b1c[_0x40ed44('0x53')]['id']}})[_0x40ed44('0xde')](handleEntityNotFound(_0x74e3e5,null))['then'](saveUpdates(_0x537b1c[_0x40ed44('0x91')],null))[_0x40ed44('0xde')](respondWithResult(_0x74e3e5,null))[_0x40ed44('0xab')](handleError(_0x74e3e5,null));},exports[_0x2c79f9('0xa6')]=function(_0x4bf9aa,_0x46a45b){const _0x4f6db9=_0x2c79f9;return db[_0x4f6db9('0xc0')][_0x4f6db9('0x96')]({'where':{'id':_0x4bf9aa[_0x4f6db9('0x53')]['id']}})[_0x4f6db9('0xde')](handleEntityNotFound(_0x46a45b,null))[_0x4f6db9('0xde')](removeEntity(_0x46a45b,null))['catch'](handleError(_0x46a45b,null));},exports['describe']=function(_0x170397,_0x4cdd6c){const _0x55f62c=_0x2c79f9;return db['OpenchannelInteraction'][_0x55f62c('0x99')]()[_0x55f62c('0xde')](respondWithResult(_0x4cdd6c,null))[_0x55f62c('0xab')](handleError(_0x4cdd6c,null));},exports[_0x2c79f9('0x56')]=function(_0x4605b8,_0x57a531){const _0x4d4beb=_0x2c79f9;return db['OpenchannelMessage']['findOne']({'where':{'id':_0x4605b8[_0x4d4beb('0x53')]['id']}})[_0x4d4beb('0xde')](function(_0x33686b){const _0x3d4f53=_0x4d4beb;if(_0x33686b)return _0x33686b[_0x3d4f53('0x56')](_0x4605b8['body'][_0x3d4f53('0x61')],{'through':_[_0x3d4f53('0xd6')](_0x4605b8[_0x3d4f53('0x91')],['ids','id'])});})['then'](respondWithResult(_0x57a531,null))['catch'](handleError(_0x57a531,null));},exports[_0x2c79f9('0x3e')]=function(_0x20c34b,_0x560961){const _0x5b3948=_0x2c79f9;let _0xf7a7f1={'raw':![],'where':{}};const _0x21a3f4={},_0x325e39={'count':0x0,'rows':[]};return db[_0x5b3948('0xc0')][_0x5b3948('0x96')]({'where':{'id':_0x20c34b[_0x5b3948('0x53')]['id']}})[_0x5b3948('0xde')](handleEntityNotFound(_0x560961,null))[_0x5b3948('0xde')](function(_0x430c33){const _0x426ae4=_0x5b3948;if(_0x430c33){_0x21a3f4[_0x426ae4('0x83')]=_[_0x426ae4('0x1e')](db[_0x426ae4('0xc')][_0x426ae4('0x41')]),_0x21a3f4[_0x426ae4('0x73')]=_[_0x426ae4('0x1e')](_0x20c34b[_0x426ae4('0x73')]),_0x21a3f4[_0x426ae4('0x17')]=_[_0x426ae4('0xa')](_0x21a3f4[_0x426ae4('0x83')],_0x21a3f4[_0x426ae4('0x73')]),_0xf7a7f1[_0x426ae4('0x1d')]=_['intersection'](_0x21a3f4['model'],qs[_0x426ae4('0x23')](_0x20c34b[_0x426ae4('0x73')]['fields'])),_0xf7a7f1['attributes']=_0xf7a7f1['attributes'][_0x426ae4('0xc2')]?_0xf7a7f1['attributes']:_0x21a3f4['model'];typeof _0x20c34b[_0x426ae4('0x73')][_0x426ae4('0x49')]===_0x426ae4('0xb1')&&(_0xf7a7f1[_0x426ae4('0xbb')]=qs['limit'](_0x20c34b['query'][_0x426ae4('0xbb')]),_0xf7a7f1[_0x426ae4('0x89')]=qs[_0x426ae4('0x89')](_0x20c34b[_0x426ae4('0x73')][_0x426ae4('0x89')]));_0xf7a7f1['order']=qs[_0x426ae4('0x7a')](_0x20c34b[_0x426ae4('0x73')][_0x426ae4('0x7a')]),_0xf7a7f1[_0x426ae4('0x9c')]=qs[_0x426ae4('0x17')](_[_0x426ae4('0x66')](_0x20c34b[_0x426ae4('0x73')],_0x21a3f4[_0x426ae4('0x17')])),_0xf7a7f1[_0x426ae4('0x9c')]['OpenchannelInteractionId']=_0x430c33['id'];_0x20c34b[_0x426ae4('0x73')][_0x426ae4('0x3f')]&&(_0xf7a7f1[_0x426ae4('0x9c')]=_[_0x426ae4('0xa1')](_0xf7a7f1[_0x426ae4('0x9c')],{[Op['or']]:_[_0x426ae4('0x5d')](_0xf7a7f1[_0x426ae4('0x1d')],function(_0x5302c0){const _0x3ab56d=_0x426ae4,_0x30b3c6={};return _0x30b3c6[_0x5302c0]={[Op[_0x3ab56d('0x5')]]:'%'+_0x20c34b['query'][_0x3ab56d('0x3f')]+'%'},_0x30b3c6;})}));if(_0x20c34b[_0x426ae4('0x73')]['$gte']){const _0x117423=_0x20c34b[_0x426ae4('0x73')][_0x426ae4('0xb0')]['split'](','),_0x590a49={};_0x590a49[_0x117423[0x0]]={[Op[_0x426ae4('0x11')]]:moment(_0x117423[0x1])[_0x426ae4('0xb5')](_0x426ae4('0x32'))},_0xf7a7f1[_0x426ae4('0x9c')]=_[_0x426ae4('0xa1')](_0xf7a7f1[_0x426ae4('0x9c')],_0x590a49);}return _0xf7a7f1=_[_0x426ae4('0xa1')]({},_0xf7a7f1,_0x20c34b[_0x426ae4('0x92')]),db[_0x426ae4('0xc')][_0x426ae4('0xd7')]({'where':_0xf7a7f1['where']})[_0x426ae4('0xde')](function(_0x13ec19){const _0x31dce6=_0x426ae4;return _0x325e39['count']=_0x13ec19,_0x20c34b[_0x31dce6('0x73')][_0x31dce6('0x2e')]&&(_0xf7a7f1[_0x31dce6('0x3')]=[{'all':!![]}]),db['OpenchannelMessage']['findAll'](_0xf7a7f1);})[_0x426ae4('0xde')](function(_0x35e40e){const _0x90205d=_0x426ae4;return _0x325e39[_0x90205d('0xb8')]=_0x35e40e,_0x325e39;});}})[_0x5b3948('0xde')](respondWithFilteredResult(_0x560961,_0xf7a7f1))['catch'](handleError(_0x560961,null));},exports[_0x2c79f9('0x76')]=function(_0x133619,_0x1e4bcd){const _0x30540e=_0x2c79f9;return db['OpenchannelInteraction'][_0x30540e('0x96')]({'where':{'id':_0x133619[_0x30540e('0x53')]['id']}})[_0x30540e('0xde')](function(_0x2165e3){const _0x21dd23=_0x30540e;if(_0x2165e3)return _0x2165e3[_0x21dd23('0xb4')](_0x133619[_0x21dd23('0x91')][_0x21dd23('0x61')],{'through':_[_0x21dd23('0xd6')](_0x133619[_0x21dd23('0x91')],[_0x21dd23('0x61'),'id'])})[_0x21dd23('0xde')](function(){const _0x717c06=_0x21dd23;return db[_0x717c06('0x9a')][_0x717c06('0x4b')]({'attributes':['id',_0x717c06('0xb3'),_0x717c06('0x10')],'where':{'id':_0x133619[_0x717c06('0x91')][_0x717c06('0x61')]}});})[_0x21dd23('0xde')](function(_0x3b36bd){const _0x2e3d58=_0x21dd23;return socket[_0x2e3d58('0xd9')](_0x2e3d58('0x15'),{'id':Number(_0x133619[_0x2e3d58('0x53')]['id']),'tags':_0x3b36bd||[]}),{'id':Number(_0x133619[_0x2e3d58('0x53')]['id']),'tags':_0x3b36bd||[]};});})['then'](respondWithResult(_0x1e4bcd,null))[_0x30540e('0xab')](handleError(_0x1e4bcd,null));},exports[_0x2c79f9('0x98')]=function(_0xd1b37e,_0x37a12c){const _0x29d5e6=_0x2c79f9;return db[_0x29d5e6('0xc0')][_0x29d5e6('0x96')]({'where':{'id':_0xd1b37e[_0x29d5e6('0x53')]['id']}})['then'](handleEntityNotFound(_0x37a12c,null))['then'](function(_0x182a4f){const _0x3c5c2d=_0x29d5e6;if(_0x182a4f)return _0x182a4f[_0x3c5c2d('0x98')](_0xd1b37e[_0x3c5c2d('0x73')][_0x3c5c2d('0x61')]);})[_0x29d5e6('0xde')](respondWithStatusCode(_0x37a12c,null))[_0x29d5e6('0xab')](handleError(_0x37a12c,null));},exports[_0x2c79f9('0x60')]=function(_0x55dd77,_0xf1cdb1){const _0xa34c82=_0x2c79f9,_0x528346=moment()[_0xa34c82('0x3c')]()[_0xa34c82('0x1a')](),_0x1d9377=path['join'](config[_0xa34c82('0xc3')],_0xa34c82('0xb2'),_0xa34c82('0x5f')),_0xb6a528=path[_0xa34c82('0x2')](config[_0xa34c82('0xc3')],_0xa34c82('0x12'),'files',_0xa34c82('0x4a')),_0xe72d9d=path[_0xa34c82('0x2')](_0x1d9377,_0x528346),_0x1a0dc8=util[_0xa34c82('0xb5')](_0xa34c82('0x8'),_0x55dd77['params']['id'],_0x528346),_0x1dc644=path[_0xa34c82('0x2')](_0x1d9377,_0x1a0dc8),_0x235dc4=[];_0x235dc4[_0xa34c82('0xbc')]({'model':db[_0xa34c82('0xdc')],'as':_0xa34c82('0xdc'),'attributes':['id',_0xa34c82('0x6b')],'raw':!![]}),_0x235dc4['push']({'model':db[_0xa34c82('0x44')],'as':_0xa34c82('0x2d'),'attributes':['id',_0xa34c82('0xcd'),_0xa34c82('0xae')],'raw':!![]});_0x55dd77[_0xa34c82('0x73')][_0xa34c82('0x4a')]&&_0x235dc4[_0xa34c82('0xbc')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});const _0x40725d=[{'model':db[_0xa34c82('0xc')],'as':_0xa34c82('0x29'),'attributes':['id',_0xa34c82('0x91'),_0xa34c82('0x2f'),_0xa34c82('0xba'),_0xa34c82('0x6f'),_0xa34c82('0xb')],'include':_0x235dc4}];return _0x40725d[_0xa34c82('0xbc')]({'model':db[_0xa34c82('0xaa')],'as':_0xa34c82('0x57'),'attributes':['id',_0xa34c82('0xb3')]}),_0x40725d[_0xa34c82('0xbc')]({'model':db[_0xa34c82('0xdc')],'as':_0xa34c82('0xdd'),'attributes':['id',_0xa34c82('0x6b')]}),db['OpenchannelInteraction'][_0xa34c82('0x96')]({'where':{'id':_0x55dd77['params']['id']},'include':_0x40725d})[_0xa34c82('0xde')](handleEntityNotFound(_0xf1cdb1,null))[_0xa34c82('0xde')](function(_0x32c342){const _0x2a0be4=_0xa34c82;if(_0x32c342){const _0xb79d5d=_0x32c342[_0x2a0be4('0x8c')]({'plain':!![]});fs[_0x2a0be4('0xa2')](_0xe72d9d);const _0x2c5adc={'format':'A4','border':_0x2a0be4('0x4'),'header':{'height':'40px','contents':{'first':'<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>'}},'footer':{'height':_0x2a0be4('0x36'),'contents':{'default':util[_0x2a0be4('0xb5')](_0x2a0be4('0xb6'),util['format'](_0x2a0be4('0x9e'),_0x2a0be4('0xa4'),_0xb79d5d['id']),moment()[_0x2a0be4('0xb5')](_0x2a0be4('0xa5'))[_0x2a0be4('0x1a')]())}}},_0x4f585d={'channel':_0x2a0be4('0xa4'),'account':_0xb79d5d[_0x2a0be4('0x57')][_0x2a0be4('0xb3')],'agent':_0xb79d5d[_0x2a0be4('0xdd')]?_0xb79d5d[_0x2a0be4('0xdd')][_0x2a0be4('0x6b')]:_0x2a0be4('0x51'),'createdAt':moment(_0xb79d5d[_0x2a0be4('0x2f')])[_0x2a0be4('0xb5')](_0x2a0be4('0x32'))['toString'](),'closedAt':_0xb79d5d[_0x2a0be4('0x77')]?moment(_0xb79d5d[_0x2a0be4('0x84')])['format'](_0x2a0be4('0x32'))[_0x2a0be4('0x1a')]():'','disposition':_0xb79d5d[_0x2a0be4('0xcf')],'visibility':_0xb79d5d[_0x2a0be4('0xcb')]?_0x2a0be4('0x39'):_0x2a0be4('0xc1'),'messages':_(_0xb79d5d[_0x2a0be4('0x29')])[_0x2a0be4('0x3f')]({'secret':![]})[_0x2a0be4('0x5d')](function(_0x5b03f2){const _0x50e2c5=_0x2a0be4;if(_0x5b03f2[_0x50e2c5('0x5e')]){const _0x44454c=path['join'](_0xb6a528,_0x5b03f2[_0x50e2c5('0x5e')]['basename']);fs['existsSync'](_0x44454c)&&fs['createReadStream'](_0x44454c)[_0x50e2c5('0x5c')](fs[_0x50e2c5('0x6a')](path[_0x50e2c5('0x2')](_0xe72d9d,_0x5b03f2[_0x50e2c5('0x5e')][_0x50e2c5('0x0')])));}return{'date':moment(_0x5b03f2['createdAt'])[_0x50e2c5('0xb5')](_0x50e2c5('0x32'))['toString'](),'sender':_0x5b03f2['direction']===_0x50e2c5('0x46')?_0x5b03f2[_0x50e2c5('0xdc')]?_0x5b03f2[_0x50e2c5('0xdc')][_0x50e2c5('0x6b')]:'System':_0x5b03f2['Contact']['firstName']+(_0x5b03f2['Contact'][_0x50e2c5('0xae')]?'\x20'+_0x5b03f2[_0x50e2c5('0x2d')][_0x50e2c5('0xae')]:''),'body':_0x5b03f2[_0x50e2c5('0x5e')]?_0x5b03f2[_0x50e2c5('0x5e')]['basename']:_0x5b03f2[_0x50e2c5('0x91')],'direction':_0x5b03f2[_0x50e2c5('0xba')]===_0x50e2c5('0x46')?'A':'C','secret':_0x5b03f2[_0x50e2c5('0x6f')],'read':_0x5b03f2['read'],'attachment':_0x5b03f2[_0x50e2c5('0x5e')]};})['value']()};return ejs[_0x2a0be4('0x8e')](path[_0x2a0be4('0x2')](config['root'],_0x2a0be4('0x12'),_0x2a0be4('0xa9'),_0x2a0be4('0x48')),{'interaction':_0x4f585d})[_0x2a0be4('0xde')](function(_0x207058){return new Promise(function(_0x2de7db,_0x5517dd){const _0x30af33=a480_0x7770;pdf[_0x30af33('0x27')](_0x207058,_0x2c5adc)[_0x30af33('0xaf')](path[_0x30af33('0x2')](_0xe72d9d,_0x30af33('0x71')+_0xb79d5d['id']+'-'+_0x528346+'.pdf'),function(_0x57e5a9,_0x14bc27){if(_0x57e5a9)return _0x5517dd(_0x57e5a9);_0x2de7db(_0x14bc27);});});})['then'](function(){const _0x43c75c=_0x2a0be4;return new Promise(function(_0x3134da,_0x58e2f0){zipdir(_0xe72d9d,{'saveTo':_0x1dc644},function(_0x43751e,_0x4727b8){if(_0x43751e)return _0x58e2f0(_0x43751e);return _0x3134da(_0x4727b8);});})[_0x43c75c('0xde')](function(){return new Promise(function(_0x1cfd7f,_0x270af1){rimraf(_0xe72d9d,function(_0x455689){if(_0x455689)_0x270af1(_0x455689);return _0x1cfd7f();});});})[_0x43c75c('0xde')](function(){const _0xc1e719=_0x43c75c;return _0xf1cdb1[_0xc1e719('0x60')](_0x1dc644,_0x1a0dc8,function(_0x27bfe7){const _0x23f772=_0xc1e719;_0x27bfe7?console[_0x23f772('0x69')](_0x23f772('0xd4'),_0x27bfe7):fs[_0x23f772('0x2b')](_0x1dc644);});});});}else return _0xf1cdb1[_0x2a0be4('0x4c')](0xc8);})[_0xa34c82('0xab')](handleError(_0xf1cdb1,null));};
\ No newline at end of file