Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / cmContact / cmContact.controller.js
index ece2a1f..bf09368 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd08c=['getTags','rawAttributes','intersection','options','setTags','ids','getHoppers','ContactId','rows','getHopperHistories','includeAll','include','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','upload','createReadStream','path','parse','meta','binding','firstName','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','error\x20child\x20process','getJourney','chat','sms','openchannel','whatsapp','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','destination','callerid','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','referer','mail','substatus','threadId','startCase','Interaction','sortBy','slice','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','describe','keys','length','cf_','findOne','trimStart','all','fieldType','type','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','conditions','Tag','value','split','map','forEach','union','and','datetime','DATE','buildExpression','text','start','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','role','some','User','user','getLists','c.ListId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','CmContact','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','push','catch','find','tags','startsWith','displayName','alias','values','columnName','body','findAll','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','CmCustomField','format','cf_%d','params','$and','omit','pickBy','table','setFields','toParam','phone'];(function(_0x57df28,_0x1aae4b){var _0x5a0cf9=function(_0x58a0fa){while(--_0x58a0fa){_0x57df28['push'](_0x57df28['shift']());}};_0x5a0cf9(++_0x1aae4b);}(_0xd08c,0x18f));var _0xcd08=function(_0xe4270f,_0x26de62){_0xe4270f=_0xe4270f-0x0;var _0x105519=_0xd08c[_0xe4270f];return _0x105519;};'use strict';var emlformat=require(_0xcd08('0x0'));var rimraf=require(_0xcd08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd08('0x2'));var rp=require(_0xcd08('0x3'));var moment=require(_0xcd08('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcd08('0x5'));var path=require('path');var sox=require(_0xcd08('0x6'));var csv=require(_0xcd08('0x7'));var ejs=require(_0xcd08('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd08('0x9'));var squel=require(_0xcd08('0xa'));var crypto=require(_0xcd08('0xb'));var jsforce=require(_0xcd08('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcd08('0x7'));var querystring=require('querystring');var Papa=require(_0xcd08('0xd'));var Redis=require(_0xcd08('0xe'));var authService=require(_0xcd08('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcd08('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcd08('0x11'));var utils=require(_0xcd08('0x12'));var config=require(_0xcd08('0x13'));var licenseUtil=require(_0xcd08('0x14'));var db=require(_0xcd08('0x15'))['db'];config[_0xcd08('0x16')]=_[_0xcd08('0x17')](config[_0xcd08('0x16')],{'host':_0xcd08('0x18'),'port':0x18eb});var socket=require(_0xcd08('0x19'))(new Redis(config[_0xcd08('0x16')]));require(_0xcd08('0x1a'))['register'](socket);function respondWithStatusCode(_0x1aa6e7,_0x18c3d3){_0x18c3d3=_0x18c3d3||0xcc;return function(_0x308a78){if(_0x308a78){return _0x1aa6e7[_0xcd08('0x1b')](_0x18c3d3);}return _0x1aa6e7['status'](_0x18c3d3)[_0xcd08('0x1c')]();};}function respondWithResult(_0x57dbfc,_0x404f65){_0x404f65=_0x404f65||0xc8;return function(_0x19cdd7){if(_0x19cdd7){return _0x57dbfc[_0xcd08('0x1d')](_0x404f65)[_0xcd08('0x1e')](_0x19cdd7);}};}function respondWithFilteredResult(_0x5e2e6a,_0x3f2dd4){return function(_0xc8d7a7){if(_0xc8d7a7){var _0x23bbfd=typeof _0x3f2dd4[_0xcd08('0x1f')]===_0xcd08('0x20')&&typeof _0x3f2dd4['limit']===_0xcd08('0x20');var _0x1652cc=_0xc8d7a7['count'];var _0x31c91d=_0x23bbfd?0x0:_0x3f2dd4[_0xcd08('0x1f')];var _0x4a343d=_0x23bbfd?_0xc8d7a7[_0xcd08('0x21')]:_0x3f2dd4['offset']+_0x3f2dd4[_0xcd08('0x22')];var _0x490ba9;if(_0x4a343d>=_0x1652cc){_0x4a343d=_0x1652cc;_0x490ba9=0xc8;}else{_0x490ba9=0xce;}_0x5e2e6a[_0xcd08('0x1d')](_0x490ba9);return _0x5e2e6a[_0xcd08('0x23')](_0xcd08('0x24'),_0x31c91d+'-'+_0x4a343d+'/'+_0x1652cc)[_0xcd08('0x1e')](_0xc8d7a7);}return null;};}function patchUpdates(_0x4635cc){return function(_0x4ecc4a){try{jsonpatch[_0xcd08('0x25')](_0x4ecc4a,_0x4635cc,!![]);}catch(_0x1b44b6){return BPromise[_0xcd08('0x26')](_0x1b44b6);}return _0x4ecc4a[_0xcd08('0x27')]();};}function saveUpdates(_0x430246,_0x3282b9){return function(_0x2d6932){if(_0x2d6932){return _0x2d6932['update'](_0x430246)[_0xcd08('0x28')](function(_0x49da90){return _0x49da90;});}return null;};}function removeEntity(_0x52a0c4,_0x17dcdc){return function(_0x4f0f16){if(_0x4f0f16){return _0x4f0f16[_0xcd08('0x29')]()[_0xcd08('0x28')](function(){_0x52a0c4[_0xcd08('0x1d')](0xcc)[_0xcd08('0x1c')]();});}};}function handleEntityNotFound(_0x1f1aff,_0x17fb23){return function(_0x493986){if(!_0x493986){_0x1f1aff[_0xcd08('0x1b')](0x194);}return _0x493986;};}function handleError(_0x1eba3e,_0x1f6cd7){_0x1f6cd7=_0x1f6cd7||0x1f4;return function(_0x153ed6){logger[_0xcd08('0x2a')](_0x153ed6[_0xcd08('0x2b')]);if(_0x153ed6[_0xcd08('0x2c')]){delete _0x153ed6[_0xcd08('0x2c')];}_0x1eba3e[_0xcd08('0x1d')](_0x1f6cd7)[_0xcd08('0x2d')](_0x153ed6);};}exports[_0xcd08('0x2e')]=function(_0x28011c,_0x332dc8){var _0x53f9b8={},_0x38a5ae={},_0x308b34={'count':0x0,'rows':[]};return db['CmContact'][_0xcd08('0x2f')]()['then'](function(_0x131ad9){var _0x52edd3=[];for(var _0x4b178f=0x0;_0x4b178f<Object[_0xcd08('0x30')](_0x131ad9)[_0xcd08('0x31')];_0x4b178f++){var _0x233b21=Object[_0xcd08('0x30')](_0x131ad9)[_0x4b178f];if(_['startsWith'](_0x233b21,_0xcd08('0x32'))){_0x52edd3['push'](db['CmCustomField'][_0xcd08('0x33')]({'where':{'id':_[_0xcd08('0x34')](_0x233b21,_0xcd08('0x32'))},'raw':!![]}));}}return BPromise[_0xcd08('0x35')](_0x52edd3)[_0xcd08('0x28')](function(_0x677cf9){for(var _0x38466a=0x0;_0x38466a<_0x677cf9['length'];_0x38466a++){if(_0x677cf9[_0x38466a]){var _0x5b0858=_0xcd08('0x32')+_0x677cf9[_0x38466a]['id'];var _0x126156=_0x131ad9[_0x5b0858];_0x126156[_0xcd08('0x36')]=_0x677cf9[_0x38466a][_0xcd08('0x37')];}}return _0x131ad9;});})[_0xcd08('0x28')](function(_0x33e2dd){_0x38a5ae[_0xcd08('0x38')]=_[_0xcd08('0x30')](_0x33e2dd);_0x38a5ae['query']=_['keys'](_0x28011c[_0xcd08('0x39')]);_0x38a5ae['filters']=_['intersection'](_0x38a5ae[_0xcd08('0x38')],_0x38a5ae[_0xcd08('0x39')]);_0x53f9b8[_0xcd08('0x3a')]=_['intersection'](_0x38a5ae[_0xcd08('0x38')],qs[_0xcd08('0x3b')](_0x28011c[_0xcd08('0x39')][_0xcd08('0x3b')]));_0x53f9b8[_0xcd08('0x3a')]=_0x53f9b8[_0xcd08('0x3a')][_0xcd08('0x31')]?_0x53f9b8[_0xcd08('0x3a')]:_0x38a5ae[_0xcd08('0x38')];if(!_0x28011c[_0xcd08('0x39')][_0xcd08('0x3c')](_0xcd08('0x3d'))){_0x53f9b8[_0xcd08('0x22')]=qs['limit'](_0x28011c['query']['limit']);_0x53f9b8[_0xcd08('0x1f')]=qs[_0xcd08('0x1f')](_0x28011c[_0xcd08('0x39')]['offset']);}_0x53f9b8[_0xcd08('0x3e')]=qs[_0xcd08('0x3f')](_0x28011c['query'][_0xcd08('0x3f')]);_0x53f9b8[_0xcd08('0x40')]=qs[_0xcd08('0x41')](_[_0xcd08('0x42')](_0x28011c['query'],_0x38a5ae[_0xcd08('0x41')]),_0x33e2dd);var _0x1d8c6e=[];var _0x4c5c6e=squel[_0xcd08('0x43')]()[_0xcd08('0x44')]('id')['field'](_0xcd08('0x2c'))['field'](_0xcd08('0x45'))[_0xcd08('0x46')]('tools_tags');var _0x474289=squel[_0xcd08('0x43')]()[_0xcd08('0x46')](_0xcd08('0x47'),'c')[_0xcd08('0x48')](_0xcd08('0x49'),'uc',_0xcd08('0x4a'))[_0xcd08('0x48')](_0xcd08('0x4b'),'ct',_0xcd08('0x4c'))[_0xcd08('0x48')]('tools_tags','t',_0xcd08('0x4d'))[_0xcd08('0x40')](_0xcd08('0x4e'));var _0x5dc8ef=squel['expr']();var _0x1326af=[];var _0x22e544=squel[_0xcd08('0x4f')]();var _0x310b80;if(_0x28011c[_0xcd08('0x39')]['search']){_0x310b80=as['parseSearch'](_0x28011c[_0xcd08('0x39')][_0xcd08('0x50')]);var _0x3b5663=_0x310b80['sqlOperator'];for(var _0x4cb3fc=0x0;_0x4cb3fc<_0x310b80[_0xcd08('0x51')][_0xcd08('0x31')];_0x4cb3fc++){var _0x5a6051=_0x310b80[_0xcd08('0x51')][_0x4cb3fc];var _0x3154a6='c';var _0x4c6eed=_(_0x33e2dd)[_0xcd08('0x30')]()['find'](function(_0x2ecb8b){return _0x2ecb8b===_0x5a6051[_0xcd08('0x44')];});if(_0x4c6eed)_0x4c6eed=_0x33e2dd[_0x5a6051[_0xcd08('0x44')]];if(!_0x4c6eed){if(_0x5a6051['field']===_0xcd08('0x52')){var _0x223ec5=_0x5a6051[_0xcd08('0x53')][_0xcd08('0x54')](',')[_0xcd08('0x55')](function(_0xfae3c){return Number(_0xfae3c);});_0x223ec5[_0xcd08('0x56')](function(_0x43f81c){_0x22e544['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x43f81c+',%');});_0x1326af=_[_0xcd08('0x57')](_0x1326af,_0x223ec5);}else if(_0x5a6051[_0xcd08('0x44')]==='User'){_0x5dc8ef[_0xcd08('0x58')]('uc.UserId\x20=\x20?',_0x5a6051['value']);}}else{if(_0x5a6051[_0xcd08('0x44')]==='dateOfBirth'||_0x4c6eed[_0xcd08('0x36')]===_0xcd08('0x59'))_0x5a6051['castTo']=_0xcd08('0x5a');var _0x348b76=as[_0xcd08('0x5b')](_0x3154a6,_0x4c6eed[_0xcd08('0x37')],_0x5a6051);_0x5dc8ef[_0x3b5663](_0x348b76[_0xcd08('0x5c')],_0x348b76[_0xcd08('0x53')][_0xcd08('0x5d')],_0x348b76[_0xcd08('0x53')][_0xcd08('0x1c')]);}}}else{var _0x4d27a7=_(Object[_0xcd08('0x30')](_0x28011c[_0xcd08('0x39')]))[_0xcd08('0x55')](function(_0x96677c){return _0x33e2dd[_0xcd08('0x3c')](_0x96677c)?_0x96677c:undefined;})[_0xcd08('0x5e')](function(_0x283380){return!_[_0xcd08('0x5f')](_0x283380);})[_0xcd08('0x53')]();if(_0x28011c[_0xcd08('0x39')][_0xcd08('0x60')])_0x4d27a7['push'](_0xcd08('0x60'));if(!_[_0xcd08('0x61')](_0x4d27a7)){_0x4d27a7[_0xcd08('0x56')](function(_0x26a30c){if(_0x26a30c===_0xcd08('0x62')){_0x474289[_0xcd08('0x40')](_0xcd08('0x63'),[][_0xcd08('0x64')](_0x28011c[_0xcd08('0x39')][_0x26a30c]));}else if(_0x26a30c===_0xcd08('0x60')){var _0x259dc2='%'+_0x28011c[_0xcd08('0x39')][_0x26a30c]+'%';_0x474289[_0xcd08('0x40')](_0xcd08('0x65'),_0x259dc2);}else{_0x474289[_0xcd08('0x40')]('c.'+_0x26a30c+_0xcd08('0x66'),_0x28011c[_0xcd08('0x39')][_0x26a30c]);}});}if(_0x28011c['query'][_0xcd08('0x67')]){_0x1326af=_[_0xcd08('0x68')](_0x28011c[_0xcd08('0x39')][_0xcd08('0x67')])?_0x28011c[_0xcd08('0x39')][_0xcd08('0x67')]:new Array(_0x28011c[_0xcd08('0x39')]['tag']);_0x1326af[_0xcd08('0x56')](function(_0x3fd68e){_0x22e544['or'](_0xcd08('0x69'),'%,'+_0x3fd68e+',%');});}if(_0x28011c[_0xcd08('0x39')]['filter']){var _0x2e773b=_0x28011c[_0xcd08('0x39')][_0xcd08('0x5e')][_0xcd08('0x6a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x2e773b[_0xcd08('0x54')]('\x20')[_0xcd08('0x31')]>0x1){_0x5dc8ef['or'](_0xcd08('0x6b'),qs['getFullTextValue'](_0x2e773b),null);}else{if(qs[_0xcd08('0x6c')](_0x2e773b)){_0x5dc8ef['or'](_0xcd08('0x6d'),_0x2e773b+'%');_0x5dc8ef['or'](_0xcd08('0x6e'),_0x2e773b+'%');_0x5dc8ef['or'](_0xcd08('0x6f'),_0x2e773b+'%');_0x5dc8ef['or'](_0xcd08('0x70'),_0x2e773b+'%');}else if(qs[_0xcd08('0x71')](_0x2e773b)){_0x5dc8ef['or'](_0xcd08('0x72'),_0x2e773b+'%');}else{_0x5dc8ef['or'](_0xcd08('0x73'),'%'+_0x2e773b+'%');_0x5dc8ef['or'](_0xcd08('0x74'),'%'+_0x2e773b+'%');_0x5dc8ef['or'](_0xcd08('0x72'),'%'+_0x2e773b+'%');}}}}_0x474289[_0xcd08('0x40')](_0x5dc8ef);_0x474289['group'](_0xcd08('0x75'));var _0x18deac={'type':db[_0xcd08('0x76')][_0xcd08('0x77')][_0xcd08('0x78')],'raw':!![]};var _0x4b9193=_0x474289[_0xcd08('0x79')]()['field'](_0xcd08('0x75'));if(_0x53f9b8[_0xcd08('0x3e')]){_0x53f9b8[_0xcd08('0x3e')][_0xcd08('0x56')](function(_0x2860c1){_0x474289[_0xcd08('0x3e')]('c.'+_0x2860c1[0x0],_0x2860c1[0x1]===_0xcd08('0x7a')?![]:!![]);});}if(!_[_0xcd08('0x61')](_0x1326af)){_0x474289['having'](_0x22e544);_0x4b9193[_0xcd08('0x40')](_0xcd08('0x7b'),_0x1326af);}BPromise[_0xcd08('0x7c')]()['then'](function(){if(!_0x310b80)return;if(_0x28011c['user'][_0xcd08('0x7d')]!=='agent')return;if(!_[_0xcd08('0x7e')](_0x310b80['conditions'],[_0xcd08('0x44'),_0xcd08('0x7f')])){return _0x28011c[_0xcd08('0x80')][_0xcd08('0x81')]({'attributes':['id'],'raw':!![]})[_0xcd08('0x28')](function(_0x2e250f){if(_[_0xcd08('0x61')](_0x2e250f)){_0x4b9193[_0xcd08('0x40')](_0xcd08('0x82'));_0x474289['where'](_0xcd08('0x82'));}else{_0x4b9193['where'](_0xcd08('0x63'),_[_0xcd08('0x55')](_0x2e250f,'id'));_0x474289[_0xcd08('0x40')]('c.ListId\x20IN\x20?',_[_0xcd08('0x55')](_0x2e250f,'id'));}});}})[_0xcd08('0x28')](function(){if(_0x28011c[_0xcd08('0x80')][_0xcd08('0x7d')]===_0xcd08('0x83')&&!_0x310b80&&!_0x28011c[_0xcd08('0x39')]['ListId'])return[];return db[_0xcd08('0x84')][_0xcd08('0x39')](_0x4b9193[_0xcd08('0x85')](),_0x18deac);})[_0xcd08('0x28')](function(_0x251cfb){_0x308b34[_0xcd08('0x21')]=_0x251cfb[_0xcd08('0x31')];if(_0x308b34[_0xcd08('0x21')]===0x0)return[];return db[_0xcd08('0x84')][_0xcd08('0x39')](_0x4c5c6e[_0xcd08('0x85')](),_0x18deac)[_0xcd08('0x28')](function(_0x5ab489){_0x1d8c6e=_[_0xcd08('0x86')](_0x5ab489,'id');_0x18deac=_[_0xcd08('0x87')](_0x18deac,{'model':db[_0xcd08('0x88')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x28011c['query'][_0xcd08('0x3b')]){_0x53f9b8[_0xcd08('0x3a')][_0xcd08('0x56')](function(_0x33ad83){_0x474289[_0xcd08('0x44')]('c.'+_0x33ad83);});}else{_0x474289[_0xcd08('0x44')]('c.id');_0x474289[_0xcd08('0x44')](_0xcd08('0x89'));_0x474289[_0xcd08('0x44')](_0xcd08('0x8a'));_0x474289[_0xcd08('0x44')](_0xcd08('0x8b'));_0x474289[_0xcd08('0x44')](_0xcd08('0x8c'));_0x474289['field']('c.fax');_0x474289[_0xcd08('0x44')](_0xcd08('0x8d'));_0x474289[_0xcd08('0x44')](_0xcd08('0x8e'));_0x474289['field']('c.createdAt');_0x474289[_0xcd08('0x44')](_0xcd08('0x8f'));_0x474289[_0xcd08('0x44')](_0xcd08('0x90'));_0x474289[_0xcd08('0x44')](_0xcd08('0x91'),_0xcd08('0x92'));}if(_0x53f9b8['limit'])_0x474289[_0xcd08('0x22')](_0x53f9b8[_0xcd08('0x22')]);if(_0x53f9b8[_0xcd08('0x1f')])_0x474289['offset'](_0x53f9b8[_0xcd08('0x1f')]);return db[_0xcd08('0x84')][_0xcd08('0x39')](_0x474289[_0xcd08('0x85')](),_0x18deac);});})[_0xcd08('0x28')](function(_0x21e360){_0x21e360['forEach'](function(_0x31d95f){if(_0x31d95f[_0xcd08('0x92')]){_0x31d95f[_0xcd08('0x93')]=[];_0x31d95f[_0xcd08('0x92')][_0xcd08('0x54')](',')[_0xcd08('0x56')](function(_0x44356b){_0x31d95f[_0xcd08('0x93')][_0xcd08('0x94')](_0x1d8c6e[_0x44356b]);});}delete _0x31d95f[_0xcd08('0x92')];});_0x308b34['rows']=_0x21e360;return _0x308b34;})[_0xcd08('0x28')](respondWithFilteredResult(_0x332dc8,_0x53f9b8));})[_0xcd08('0x95')](handleError(_0x332dc8,null));};exports['destroy']=function(_0x252aa5,_0x1bbc11){return db[_0xcd08('0x88')][_0xcd08('0x96')]({'where':{'id':_0x252aa5['params']['id']}})[_0xcd08('0x28')](handleEntityNotFound(_0x1bbc11,null))[_0xcd08('0x28')](removeEntity(_0x1bbc11,null))[_0xcd08('0x95')](handleError(_0x1bbc11,null));};exports['describe']=function(_0x53933b,_0x34cfc7){return db[_0xcd08('0x88')]['describe']()['then'](function(_0xaf8138){delete _0xaf8138[_0xcd08('0x97')];for(var _0x683556=0x0;_0x683556<Object[_0xcd08('0x30')](_0xaf8138)[_0xcd08('0x31')];_0x683556++){var _0x4ad507=Object['keys'](_0xaf8138)[_0x683556];if(!_[_0xcd08('0x98')](_0x4ad507,_0xcd08('0x32'))){_0xaf8138[_0x4ad507]['columnName']=_0x4ad507;_0xaf8138[_0x4ad507][_0xcd08('0x99')]=_0x4ad507;}}return _0xaf8138;})[_0xcd08('0x28')](function(_0x577017){var _0x259091={'where':{'$or':[{'ListId':_0x53933b[_0xcd08('0x39')]['id']},{'ListId':null}]},'raw':!![]};return db['CmCustomField']['findAll'](_0x259091)[_0xcd08('0x28')](function(_0x529068){for(var _0x5dd57e=0x0;_0x5dd57e<_0x529068[_0xcd08('0x31')];_0x5dd57e++){var _0x358a5b='cf_'+_0x529068[_0x5dd57e]['id'];_0x577017[_0x358a5b]['columnName']=_0x358a5b;_0x577017[_0x358a5b]['displayName']=_0x529068[_0x5dd57e][_0xcd08('0x9a')];_0x577017[_0x358a5b]['custom']={'type':_0x529068[_0x5dd57e][_0xcd08('0x37')],'values':_0x529068[_0x5dd57e][_0xcd08('0x9b')]};}Object[_0xcd08('0x30')](_0x577017)[_0xcd08('0x56')](function(_0x17ab87){if(!_0x577017[_0x17ab87][_0xcd08('0x3c')](_0xcd08('0x9c'))){delete _0x577017[_0x17ab87];}});return _0x577017;});})[_0xcd08('0x28')](respondWithResult(_0x34cfc7,null))[_0xcd08('0x95')](handleError(_0x34cfc7,null));};exports[_0xcd08('0x87')]=function(_0x4b64a4,_0x54684b){var _0x5b76b5;var _0x20da50;var _0x226927;if(_0x4b64a4[_0xcd08('0x9d')]['id']){delete _0x4b64a4[_0xcd08('0x9d')]['id'];}return db[_0xcd08('0x88')][_0xcd08('0x9e')]({'where':{'id':[_0x4b64a4[_0xcd08('0x9d')]['to'],_0x4b64a4[_0xcd08('0x9d')]['from']]}})[_0xcd08('0x28')](function(_0x275b42){if(_0x275b42){if(_0x275b42[_0xcd08('0x31')]!==0x2){return null;}_0x275b42[0x0]=_0x275b42[0x0][_0xcd08('0x9f')]({'plain':!![]});_0x275b42[0x1]=_0x275b42[0x1]['get']({'plain':!![]});delete _0x275b42[0x0]['id'];delete _0x275b42[0x1]['id'];return _[_0xcd08('0xa0')](_0x275b42[0x0],_0x275b42[0x1],function(_0x26ec61,_0x249972){if(Array[_0xcd08('0x68')](_0x249972)&&!_0x249972['length']){return _0x26ec61;}else if(!_0x249972){return _0x26ec61;}});}})['then'](handleEntityNotFound(_0x54684b,null))[_0xcd08('0x28')](function(_0x25446a){if(_0x25446a){if(_0x25446a[_0xcd08('0x97')]&&_['isArray'](_0x25446a['tags'])){_0x25446a[_0xcd08('0x97')]=_0x25446a[_0xcd08('0x97')][_0xcd08('0xa1')]();}logger[_0xcd08('0xa2')](_0xcd08('0xa3'),_0x4b64a4[_0xcd08('0x9d')]['to'],_0x4b64a4[_0xcd08('0x9d')]['from']);return db[_0xcd08('0xa4')][_0xcd08('0x29')]({'where':{'ContactId':[_0x4b64a4[_0xcd08('0x9d')]['to'],_0x4b64a4[_0xcd08('0x9d')][_0xcd08('0x46')]]}})[_0xcd08('0x28')](function(_0xbc7781){logger[_0xcd08('0xa2')](_0xcd08('0xa5'),_0xbc7781);return db[_0xcd08('0xa6')]['destroy']({'where':{'ContactId':[_0x4b64a4[_0xcd08('0x9d')]['to'],_0x4b64a4['body'][_0xcd08('0x46')]]}})[_0xcd08('0x28')](function(_0xf8ab71){logger['info'](_0xcd08('0xa7'),_0xf8ab71);return db[_0xcd08('0x88')][_0xcd08('0xa8')](_0x25446a);});});}})[_0xcd08('0x28')](function(_0x36eaa6){if(_0x36eaa6){_0x5b76b5=_0x36eaa6;_0x20da50={'ContactId':_0x5b76b5['id']};_0x226927={'where':{'ContactId':[_0x4b64a4[_0xcd08('0x9d')]['to'],_0x4b64a4[_0xcd08('0x9d')][_0xcd08('0x46')]]}};return db[_0xcd08('0xa9')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db['ChatMessage'][_0xcd08('0xaa')](_0x20da50,_0x226927);}})['then'](function(){if(_0x5b76b5){return db['ChatOfflineMessage']['update'](_0x20da50,_0x226927);}})['then'](function(){if(_0x5b76b5){return db[_0xcd08('0xab')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})['then'](function(){if(_0x5b76b5){return db[_0xcd08('0xac')]['update'](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xab')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db['MailMessage']['update'](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xad')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})['then'](function(){if(_0x5b76b5){return db[_0xcd08('0xae')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xaf')]['update'](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xb0')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})['then'](function(){if(_0x5b76b5){return db[_0xcd08('0xb1')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db['OpenchannelMessage'][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xb2')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xb3')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})['then'](function(){if(_0x5b76b5){return db['ReportAgentPreview'][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xb4')]['update'](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xb5')]['update'](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xb6')]['update'](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xb7')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xb8')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xb9')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db['JscriptySessionReport'][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xba')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})['then'](function(){if(_0x5b76b5){return db[_0xcd08('0xbb')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0xbc')][_0xcd08('0xaa')](_0x20da50,_0x226927);}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return db[_0xcd08('0x88')][_0xcd08('0x29')]({'where':{'id':[_0x4b64a4[_0xcd08('0x9d')]['to'],_0x4b64a4[_0xcd08('0x9d')]['from']]}});}})[_0xcd08('0x28')](function(){if(_0x5b76b5){return _0x5b76b5;}})[_0xcd08('0x28')](respondWithResult(_0x54684b,null))[_0xcd08('0x95')](handleError(_0x54684b,null));};exports['create']=function(_0xb85e54,_0x44002c){return db[_0xcd08('0x88')][_0xcd08('0x2f')]()['then'](function(_0x3e6e63){if(_0xb85e54['body'][_0xcd08('0x97')]&&_[_0xcd08('0x68')](_0xb85e54[_0xcd08('0x9d')][_0xcd08('0x97')])){if(_0xb85e54[_0xcd08('0x9d')][_0xcd08('0x97')]['length']){_0xb85e54[_0xcd08('0x9d')][_0xcd08('0x97')]=_0xb85e54[_0xcd08('0x9d')]['tags'][_0xcd08('0xa1')](';')+';';}else{_0xb85e54[_0xcd08('0x9d')][_0xcd08('0x97')]=null;}}else{_0xb85e54[_0xcd08('0x9d')][_0xcd08('0x97')]=null;}return db[_0xcd08('0x88')][_0xcd08('0xa8')](_0xb85e54[_0xcd08('0x9d')],{'fields':_[_0xcd08('0x30')](_0x3e6e63),'raw':!![]});})[_0xcd08('0x28')](respondWithResult(_0x44002c,0xc9))[_0xcd08('0x95')](handleError(_0x44002c,null));};exports[_0xcd08('0xbd')]=function(_0x186cc6,_0x392ce7){var _0x2f4c7f=[];var _0x3e53b0=0x0;var _0x3fb462=0x0;var _0x2e527=0x0;return db['CmContact'][_0xcd08('0x2f')]()[_0xcd08('0x28')](function(_0x2f12ca){return BPromise[_0xcd08('0xbe')](_0x186cc6[_0xcd08('0x9d')],function(_0x23c829){var _0x4bc484={'where':{'$or':[]},'defaults':_0x23c829,'fields':_[_0xcd08('0x30')](_0x2f12ca),'raw':!![]};if(_0x23c829[_0xcd08('0xbf')]){for(var _0x1e983c=0x0;_0x1e983c<_0x23c829[_0xcd08('0xbf')][_0xcd08('0x31')];_0x1e983c++){var _0x355e65={};_0x355e65[_0x23c829[_0xcd08('0xbf')][_0x1e983c]]=_0x23c829[_0x23c829[_0xcd08('0xbf')][_0x1e983c]];_0x4bc484[_0xcd08('0x40')][_0xcd08('0xc0')][_0xcd08('0x94')](_0x355e65);}_0x4bc484['where']['ListId']=_0x23c829[_0xcd08('0x62')];}return db[_0xcd08('0x88')][_0xcd08('0xc1')](_0x4bc484)[_0xcd08('0xc2')](function(_0x518d1c,_0x2349f9){if(_0x2349f9){_0x3e53b0++;}else{_0x2e527++;}})[_0xcd08('0x95')](function(_0x28b981){console['error'](_0x28b981);_0x3fb462++;});});})[_0xcd08('0x28')](function(_0x51c297){if(_0x51c297){return{'success':_0x3e53b0,'failure':_0x3fb462,'duplicates':_0x2e527};}})[_0xcd08('0x28')](respondWithResult(_0x392ce7,0xc9))[_0xcd08('0x95')](handleError(_0x392ce7,null));};exports[_0xcd08('0xc3')]=function(_0x1765e9,_0x240807,_0x166b8a){var _0x14282d;return db[_0xcd08('0x88')][_0xcd08('0x2f')]()[_0xcd08('0x28')](function(_0x551bf7){return db[_0xcd08('0x88')]['find']({'where':{'id':_0x1765e9['params']['id']},'include':[{'model':db[_0xcd08('0x52')],'as':_0xcd08('0x93'),'attributes':['id',_0xcd08('0x2c'),_0xcd08('0x45')],'required':_0x1765e9['query']['tag']?!![]:![]}],'attributes':_[_0xcd08('0x30')](_0x551bf7)});})['then'](function(_0x2b9fcb){_0x14282d=_0x2b9fcb[_0xcd08('0x9f')]({'plain':!![]});var _0x1aef30={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2b9fcb&&_0x2b9fcb[_0xcd08('0x62')]){if(_0x2b9fcb[_0xcd08('0x62')]){_0x1aef30[_0xcd08('0x40')]['$and'][_0xcd08('0x94')]({'ListId':{'$ne':_0x2b9fcb['ListId']}});}}return db[_0xcd08('0xc4')][_0xcd08('0x9e')](_0x1aef30);})[_0xcd08('0x28')](function(_0xbaa70c){return _['omit'](_0x14282d,_[_0xcd08('0x55')](_0xbaa70c,function(_0x13345b){return util[_0xcd08('0xc5')](_0xcd08('0xc6'),_0x13345b['id']);}));})[_0xcd08('0x28')](handleEntityNotFound(_0x240807,null))[_0xcd08('0x28')](respondWithResult(_0x240807,null))['catch'](handleError(_0x240807,null));};exports[_0xcd08('0xaa')]=function(_0x58f10b,_0x463bc6){var _0x264742;if(_0x58f10b['body']['id']){delete _0x58f10b[_0xcd08('0x9d')]['id'];}return db[_0xcd08('0x88')][_0xcd08('0x96')]({'where':{'id':_0x58f10b[_0xcd08('0xc7')]['id']}})[_0xcd08('0x28')](handleEntityNotFound(_0x463bc6,null))['then'](saveUpdates(_0x58f10b['body'],null))[_0xcd08('0x28')](function(_0x29fb6a){_0x264742=_0x29fb6a;var _0x25ce82={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x29fb6a&&_0x29fb6a[_0xcd08('0x62')]){if(_0x29fb6a['ListId']){_0x25ce82['where'][_0xcd08('0xc8')][_0xcd08('0x94')]({'ListId':{'$ne':_0x29fb6a[_0xcd08('0x62')]}});}}return db[_0xcd08('0xc4')][_0xcd08('0x9e')](_0x25ce82);})[_0xcd08('0x28')](function(_0x24f258){if(_0x24f258){return _[_0xcd08('0xc9')](_[_0xcd08('0xca')](_0x58f10b[_0xcd08('0x9d')],function(_0x20de43,_0x730265){return _['startsWith'](_0x730265,_0xcd08('0x32'));}),_[_0xcd08('0x55')](_0x24f258,function(_0x2c8791){return util[_0xcd08('0xc5')](_0xcd08('0xc6'),_0x2c8791['id']);}));}})[_0xcd08('0x28')](function(_0x53ca99){if(_0x53ca99&&!_['isEmpty'](_0x53ca99)){var _0x4acebe=squel[_0xcd08('0xaa')]()[_0xcd08('0xcb')](_0xcd08('0x47'))[_0xcd08('0xcc')](_0x53ca99)[_0xcd08('0x40')]('id\x20=\x20?',_0x58f10b[_0xcd08('0xc7')]['id'])[_0xcd08('0xcd')]();return db[_0xcd08('0x84')]['query'](_0x4acebe['text'],{'replacements':_0x4acebe[_0xcd08('0x9b')]});}})[_0xcd08('0x28')](function(){if(_0x58f10b[_0xcd08('0x9d')][_0xcd08('0xce')]&&_0x264742){return db['CmHopper'][_0xcd08('0xaa')]({'phone':_0x58f10b[_0xcd08('0x9d')][_0xcd08('0xce')]},{'where':{'ContactId':_0x264742['id']}});}})[_0xcd08('0x28')](function(){return _0x264742;})[_0xcd08('0x28')](respondWithResult(_0x463bc6,null))[_0xcd08('0x95')](handleError(_0x463bc6,null));};exports[_0xcd08('0xcf')]=function(_0x113922,_0x46ac95,_0x19e25d){var _0x363efc={};var _0xa39c35={};var _0x109cd0;var _0x461aa8;return db[_0xcd08('0x88')][_0xcd08('0x33')]({'where':{'id':_0x113922[_0xcd08('0xc7')]['id']}})['then'](handleEntityNotFound(_0x46ac95,null))['then'](function(_0x2bf2ed){if(_0x2bf2ed){_0x109cd0=_0x2bf2ed;_0xa39c35['model']=_['keys'](db[_0xcd08('0x52')][_0xcd08('0xd0')]);_0xa39c35[_0xcd08('0x39')]=_[_0xcd08('0x30')](_0x113922[_0xcd08('0x39')]);_0xa39c35[_0xcd08('0x41')]=_[_0xcd08('0xd1')](_0xa39c35[_0xcd08('0x38')],_0xa39c35[_0xcd08('0x39')]);_0x363efc['attributes']=_['intersection'](_0xa39c35[_0xcd08('0x38')],qs[_0xcd08('0x3b')](_0x113922[_0xcd08('0x39')][_0xcd08('0x3b')]));_0x363efc[_0xcd08('0x3a')]=_0x363efc[_0xcd08('0x3a')]['length']?_0x363efc[_0xcd08('0x3a')]:_0xa39c35[_0xcd08('0x38')];_0x363efc['order']=qs[_0xcd08('0x3f')](_0x113922[_0xcd08('0x39')][_0xcd08('0x3f')]);_0x363efc[_0xcd08('0x40')]=qs[_0xcd08('0x41')](_['pick'](_0x113922[_0xcd08('0x39')],_0xa39c35[_0xcd08('0x41')]));if(_0x113922[_0xcd08('0x39')][_0xcd08('0x5e')]){_0x363efc['where']=_['merge'](_0x363efc['where'],{'$or':_['map'](_0x363efc[_0xcd08('0x3a')],function(_0x4ce0d9){var _0x18ede2={};_0x18ede2[_0x4ce0d9]={'$like':'%'+_0x113922[_0xcd08('0x39')][_0xcd08('0x5e')]+'%'};return _0x18ede2;})});}_0x363efc=_[_0xcd08('0x87')]({},_0x363efc,_0x113922[_0xcd08('0xd2')]);return _0x109cd0[_0xcd08('0xcf')](_0x363efc);}})[_0xcd08('0x28')](function(_0x4d1c00){if(_0x4d1c00){_0x461aa8=_0x4d1c00[_0xcd08('0x31')];if(!_0x113922[_0xcd08('0x39')][_0xcd08('0x3c')]('nolimit')){_0x363efc[_0xcd08('0x22')]=qs[_0xcd08('0x22')](_0x113922['query'][_0xcd08('0x22')]);_0x363efc[_0xcd08('0x1f')]=qs[_0xcd08('0x1f')](_0x113922[_0xcd08('0x39')][_0xcd08('0x1f')]);}return _0x109cd0[_0xcd08('0xcf')](_0x363efc);}})[_0xcd08('0x28')](function(_0x2c2176){if(_0x2c2176){return _0x2c2176?{'count':_0x461aa8,'rows':_0x2c2176}:null;}})['then'](respondWithResult(_0x46ac95,null))[_0xcd08('0x95')](handleError(_0x46ac95,null));};exports[_0xcd08('0xd3')]=function(_0x44ce00,_0x25d242,_0x5e404a){if(_0x44ce00[_0xcd08('0x9d')]['id']){delete _0x44ce00[_0xcd08('0x9d')]['id'];}return db['CmContact'][_0xcd08('0x33')]({'where':{'id':_0x44ce00['params']['id']}})[_0xcd08('0x28')](handleEntityNotFound(_0x25d242,null))[_0xcd08('0x28')](function(_0x301034){if(_0x301034){return _0x301034['setTags'](_0x44ce00[_0xcd08('0x9d')][_0xcd08('0xd4')]||[]);}return null;})[_0xcd08('0x28')](respondWithResult(_0x25d242,null))[_0xcd08('0x95')](handleError(_0x25d242,null));};exports[_0xcd08('0xd5')]=function(_0x46aef5,_0x1389db,_0xc785c7){var _0x596b4b={'raw':![],'where':{}};var _0x3a5654={};var _0x3932e2={'count':0x0,'rows':[]};return db[_0xcd08('0x88')][_0xcd08('0x33')]({'where':{'id':_0x46aef5[_0xcd08('0xc7')]['id']}})[_0xcd08('0x28')](handleEntityNotFound(_0x1389db,null))[_0xcd08('0x28')](function(_0x4af385){if(_0x4af385){_0x3a5654[_0xcd08('0x38')]=_['keys'](db['CmHopper'][_0xcd08('0xd0')]);_0x3a5654[_0xcd08('0x39')]=_[_0xcd08('0x30')](_0x46aef5['query']);_0x3a5654[_0xcd08('0x41')]=_['intersection'](_0x3a5654[_0xcd08('0x38')],_0x3a5654['query']);_0x596b4b[_0xcd08('0x3a')]=_[_0xcd08('0xd1')](_0x3a5654['model'],qs[_0xcd08('0x3b')](_0x46aef5[_0xcd08('0x39')][_0xcd08('0x3b')]));_0x596b4b['attributes']=_0x596b4b['attributes'][_0xcd08('0x31')]?_0x596b4b[_0xcd08('0x3a')]:_0x3a5654['model'];if(!_0x46aef5[_0xcd08('0x39')]['hasOwnProperty']('nolimit')){_0x596b4b[_0xcd08('0x22')]=qs[_0xcd08('0x22')](_0x46aef5[_0xcd08('0x39')][_0xcd08('0x22')]);_0x596b4b['offset']=qs[_0xcd08('0x1f')](_0x46aef5[_0xcd08('0x39')][_0xcd08('0x1f')]);}_0x596b4b[_0xcd08('0x3e')]=qs[_0xcd08('0x3f')](_0x46aef5[_0xcd08('0x39')][_0xcd08('0x3f')]);_0x596b4b[_0xcd08('0x40')]=qs[_0xcd08('0x41')](_['pick'](_0x46aef5[_0xcd08('0x39')],_0x3a5654[_0xcd08('0x41')]));_0x596b4b[_0xcd08('0x40')][_0xcd08('0xd6')]=_0x4af385['id'];if(_0x46aef5[_0xcd08('0x39')]['filter']){_0x596b4b[_0xcd08('0x40')]=_[_0xcd08('0x87')](_0x596b4b[_0xcd08('0x40')],{'$or':_[_0xcd08('0x55')](_0x596b4b[_0xcd08('0x3a')],function(_0xdb530){var _0x14b27c={};_0x14b27c[_0xdb530]={'$like':'%'+_0x46aef5[_0xcd08('0x39')][_0xcd08('0x5e')]+'%'};return _0x14b27c;})});}_0x596b4b=_[_0xcd08('0x87')]({},_0x596b4b,_0x46aef5['options']);return db[_0xcd08('0xa4')]['count']({'where':_0x596b4b[_0xcd08('0x40')]})[_0xcd08('0x28')](function(_0x581643){_0x3932e2['count']=_0x581643;if(_0x46aef5[_0xcd08('0x39')]['includeAll']){_0x596b4b['include']=[{'all':!![]}];}return db[_0xcd08('0xa4')][_0xcd08('0x9e')](_0x596b4b);})['then'](function(_0x5742e3){_0x3932e2[_0xcd08('0xd7')]=_0x5742e3;return _0x3932e2;});}})[_0xcd08('0x28')](respondWithFilteredResult(_0x1389db,_0x596b4b))[_0xcd08('0x95')](handleError(_0x1389db,null));};exports[_0xcd08('0xd8')]=function(_0x16331,_0x28db7,_0x8634bf){var _0x12f870={'raw':!![],'where':{}};var _0x4b2800={};var _0x100fdc={'count':0x0,'rows':[]};return db['CmContact'][_0xcd08('0x33')]({'where':{'id':_0x16331['params']['id']}})[_0xcd08('0x28')](handleEntityNotFound(_0x28db7,null))[_0xcd08('0x28')](function(_0x549fd8){if(_0x549fd8){_0x4b2800[_0xcd08('0x38')]=_[_0xcd08('0x30')](db[_0xcd08('0xb3')][_0xcd08('0xd0')]);_0x4b2800[_0xcd08('0x39')]=_[_0xcd08('0x30')](_0x16331['query']);_0x4b2800[_0xcd08('0x41')]=_[_0xcd08('0xd1')](_0x4b2800[_0xcd08('0x38')],_0x4b2800[_0xcd08('0x39')]);_0x12f870[_0xcd08('0x3a')]=_[_0xcd08('0xd1')](_0x4b2800[_0xcd08('0x38')],qs[_0xcd08('0x3b')](_0x16331[_0xcd08('0x39')][_0xcd08('0x3b')]));_0x12f870[_0xcd08('0x3a')]=_0x12f870[_0xcd08('0x3a')]['length']?_0x12f870['attributes']:_0x4b2800[_0xcd08('0x38')];if(!_0x16331[_0xcd08('0x39')][_0xcd08('0x3c')](_0xcd08('0x3d'))){_0x12f870[_0xcd08('0x22')]=qs[_0xcd08('0x22')](_0x16331[_0xcd08('0x39')]['limit']);_0x12f870[_0xcd08('0x1f')]=qs[_0xcd08('0x1f')](_0x16331[_0xcd08('0x39')][_0xcd08('0x1f')]);}_0x12f870[_0xcd08('0x3e')]=qs[_0xcd08('0x3f')](_0x16331['query'][_0xcd08('0x3f')]);_0x12f870[_0xcd08('0x40')]=qs[_0xcd08('0x41')](_[_0xcd08('0x42')](_0x16331[_0xcd08('0x39')],_0x4b2800[_0xcd08('0x41')]));_0x12f870[_0xcd08('0x40')][_0xcd08('0xd6')]=_0x549fd8['id'];if(_0x16331[_0xcd08('0x39')]['filter']){_0x12f870[_0xcd08('0x40')]=_[_0xcd08('0x87')](_0x12f870[_0xcd08('0x40')],{'$or':_[_0xcd08('0x55')](_0x12f870[_0xcd08('0x3a')],function(_0x1e45dd){var _0x52d7e1={};_0x52d7e1[_0x1e45dd]={'$like':'%'+_0x16331[_0xcd08('0x39')][_0xcd08('0x5e')]+'%'};return _0x52d7e1;})});}_0x12f870=_['merge']({},_0x12f870,_0x16331[_0xcd08('0xd2')]);return db['CmHopperHistory']['count']({'where':_0x12f870[_0xcd08('0x40')]})[_0xcd08('0x28')](function(_0x5baa71){_0x100fdc[_0xcd08('0x21')]=_0x5baa71;if(_0x16331[_0xcd08('0x39')][_0xcd08('0xd9')]){_0x12f870[_0xcd08('0xda')]=[{'all':!![]}];}return db[_0xcd08('0xb3')][_0xcd08('0x9e')](_0x12f870);})['then'](function(_0x1b8195){_0x100fdc[_0xcd08('0xd7')]=_0x1b8195;return _0x100fdc;});}})[_0xcd08('0x28')](respondWithFilteredResult(_0x28db7,_0x12f870))[_0xcd08('0x95')](handleError(_0x28db7,null));};exports[_0xcd08('0xdb')]=function(_0x1dae3f,_0x280a54,_0x155dc1){var _0x54c3b5={'raw':!![],'where':{}};var _0x5726cc={};var _0x4681c5={'count':0x0,'rows':[]};return db[_0xcd08('0x88')][_0xcd08('0x33')]({'where':{'id':_0x1dae3f['params']['id']}})[_0xcd08('0x28')](handleEntityNotFound(_0x280a54,null))[_0xcd08('0x28')](function(_0x4897ed){if(_0x4897ed){_0x5726cc[_0xcd08('0x38')]=_[_0xcd08('0x30')](db['CmHopperFinal'][_0xcd08('0xd0')]);_0x5726cc[_0xcd08('0x39')]=_['keys'](_0x1dae3f['query']);_0x5726cc[_0xcd08('0x41')]=_[_0xcd08('0xd1')](_0x5726cc['model'],_0x5726cc[_0xcd08('0x39')]);_0x54c3b5[_0xcd08('0x3a')]=_[_0xcd08('0xd1')](_0x5726cc[_0xcd08('0x38')],qs[_0xcd08('0x3b')](_0x1dae3f[_0xcd08('0x39')]['fields']));_0x54c3b5[_0xcd08('0x3a')]=_0x54c3b5[_0xcd08('0x3a')][_0xcd08('0x31')]?_0x54c3b5[_0xcd08('0x3a')]:_0x5726cc[_0xcd08('0x38')];if(!_0x1dae3f['query'][_0xcd08('0x3c')](_0xcd08('0x3d'))){_0x54c3b5['limit']=qs[_0xcd08('0x22')](_0x1dae3f[_0xcd08('0x39')]['limit']);_0x54c3b5[_0xcd08('0x1f')]=qs[_0xcd08('0x1f')](_0x1dae3f['query'][_0xcd08('0x1f')]);}_0x54c3b5['order']=qs['sort'](_0x1dae3f[_0xcd08('0x39')][_0xcd08('0x3f')]);_0x54c3b5[_0xcd08('0x40')]=qs[_0xcd08('0x41')](_[_0xcd08('0x42')](_0x1dae3f[_0xcd08('0x39')],_0x5726cc[_0xcd08('0x41')]));_0x54c3b5[_0xcd08('0x40')]['ContactId']=_0x4897ed['id'];if(_0x1dae3f[_0xcd08('0x39')][_0xcd08('0x5e')]){_0x54c3b5[_0xcd08('0x40')]=_['merge'](_0x54c3b5[_0xcd08('0x40')],{'$or':_[_0xcd08('0x55')](_0x54c3b5['attributes'],function(_0x5e3cf1){var _0x10aa74={};_0x10aa74[_0x5e3cf1]={'$like':'%'+_0x1dae3f['query'][_0xcd08('0x5e')]+'%'};return _0x10aa74;})});}_0x54c3b5=_['merge']({},_0x54c3b5,_0x1dae3f[_0xcd08('0xd2')]);return db['CmHopperFinal'][_0xcd08('0x21')]({'where':_0x54c3b5[_0xcd08('0x40')]})[_0xcd08('0x28')](function(_0x32b171){_0x4681c5[_0xcd08('0x21')]=_0x32b171;if(_0x1dae3f[_0xcd08('0x39')][_0xcd08('0xd9')]){_0x54c3b5['include']=[{'all':!![]}];}return db[_0xcd08('0xb2')][_0xcd08('0x9e')](_0x54c3b5);})[_0xcd08('0x28')](function(_0x3720d1){_0x4681c5['rows']=_0x3720d1;return _0x4681c5;});}})['then'](respondWithFilteredResult(_0x280a54,_0x54c3b5))[_0xcd08('0x95')](handleError(_0x280a54,null));};exports[_0xcd08('0xdc')]=function(_0x393fd8,_0x12424c,_0x18c82b){var _0x2d02e5={'raw':!![],'where':{}};var _0x4792b3={};var _0x171f66={'count':0x0,'rows':[]};return db['CmContact'][_0xcd08('0x33')]({'where':{'id':_0x393fd8[_0xcd08('0xc7')]['id']}})[_0xcd08('0x28')](handleEntityNotFound(_0x12424c,null))['then'](function(_0x5e4b0a){if(_0x5e4b0a){_0x4792b3[_0xcd08('0x38')]=_[_0xcd08('0x30')](db[_0xcd08('0xdd')]['rawAttributes']);_0x4792b3[_0xcd08('0x39')]=_['keys'](_0x393fd8[_0xcd08('0x39')]);_0x4792b3[_0xcd08('0x41')]=_[_0xcd08('0xd1')](_0x4792b3[_0xcd08('0x38')],_0x4792b3[_0xcd08('0x39')]);_0x2d02e5[_0xcd08('0x3a')]=_['intersection'](_0x4792b3[_0xcd08('0x38')],qs['fields'](_0x393fd8['query'][_0xcd08('0x3b')]));_0x2d02e5[_0xcd08('0x3a')]=_0x2d02e5['attributes'][_0xcd08('0x31')]?_0x2d02e5[_0xcd08('0x3a')]:_0x4792b3['model'];if(!_0x393fd8['query']['hasOwnProperty'](_0xcd08('0x3d'))){_0x2d02e5[_0xcd08('0x22')]=qs[_0xcd08('0x22')](_0x393fd8[_0xcd08('0x39')][_0xcd08('0x22')]);_0x2d02e5[_0xcd08('0x1f')]=qs['offset'](_0x393fd8[_0xcd08('0x39')][_0xcd08('0x1f')]);}_0x2d02e5[_0xcd08('0x3e')]=qs[_0xcd08('0x3f')](_0x393fd8[_0xcd08('0x39')][_0xcd08('0x3f')]);_0x2d02e5[_0xcd08('0x40')]=qs[_0xcd08('0x41')](_[_0xcd08('0x42')](_0x393fd8['query'],_0x4792b3[_0xcd08('0x41')]));_0x2d02e5[_0xcd08('0x40')][_0xcd08('0xd6')]=_0x5e4b0a['id'];if(_0x393fd8['query'][_0xcd08('0x5e')]){_0x2d02e5[_0xcd08('0x40')]=_[_0xcd08('0x87')](_0x2d02e5[_0xcd08('0x40')],{'$or':_[_0xcd08('0x55')](_0x2d02e5[_0xcd08('0x3a')],function(_0x3b6b06){var _0x7cdaa5={};_0x7cdaa5[_0x3b6b06]={'$like':'%'+_0x393fd8[_0xcd08('0x39')][_0xcd08('0x5e')]+'%'};return _0x7cdaa5;})});}_0x2d02e5=_['merge']({},_0x2d02e5,_0x393fd8[_0xcd08('0xd2')]);return db[_0xcd08('0xdd')]['count']({'where':_0x2d02e5[_0xcd08('0x40')]})[_0xcd08('0x28')](function(_0x516f86){_0x171f66['count']=_0x516f86;if(_0x393fd8[_0xcd08('0x39')][_0xcd08('0xd9')]){_0x2d02e5['include']=[{'all':!![]}];}return db[_0xcd08('0xdd')][_0xcd08('0x9e')](_0x2d02e5);})['then'](function(_0x27815c){_0x171f66[_0xcd08('0xd7')]=_0x27815c;return _0x171f66;});}})['then'](respondWithFilteredResult(_0x12424c,_0x2d02e5))[_0xcd08('0x95')](handleError(_0x12424c,null));};exports[_0xcd08('0xde')]=function(_0xf21626,_0x3995b7,_0x37cdd4){try{if(!_0xf21626[_0xcd08('0x9d')][_0xcd08('0x62')]){throw new Error(_0xcd08('0xdf'));}if(!_0xf21626[_0xcd08('0x9d')][_0xcd08('0xe0')]){throw new Error(_0xcd08('0xe1'));}if(!_0xf21626[_0xcd08('0x9d')][_0xcd08('0xe2')]){throw new Error(_0xcd08('0xe3'));}if(!_0xf21626['body'][_0xcd08('0xe4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x28ccf9=_0xf21626[_0xcd08('0x9d')]['binding_keys'][_0xcd08('0x54')](',');var _0xb35c41=_0xf21626[_0xcd08('0x9d')][_0xcd08('0xe2')][_0xcd08('0x54')](',');if(!_0x28ccf9[_0xcd08('0x31')]||!_0xb35c41[_0xcd08('0x31')]||_0x28ccf9[_0xcd08('0x31')]!==_0xb35c41[_0xcd08('0x31')]){throw new Error(_0xcd08('0xe5'));}_0xf21626['body'][_0xcd08('0x3b')]=_[_0xcd08('0xe6')](_0x28ccf9,_0xb35c41);if(!_0xf21626[_0xcd08('0x9d')][_0xcd08('0x3b')][_0xcd08('0xce')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xf21626[_0xcd08('0x9d')][_0xcd08('0x3b')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x139851=path[_0xcd08('0xa1')](config[_0xcd08('0xe7')],_0xcd08('0xe8'),_0xf21626[_0xcd08('0xe9')][_0xcd08('0xea')]);fs[_0xcd08('0xeb')](_0x139851,parseInt(_0xcd08('0xec'),0x8));var _0x48d065=require(_0xcd08('0xed'))[_0xcd08('0xee')](path[_0xcd08('0xa1')](__dirname,_0xcd08('0xef')),[_0x139851,_0xf21626['body'][_0xcd08('0xe0')],_0xf21626['body'][_0xcd08('0xe2')],_0xf21626['body'][_0xcd08('0x62')],_0xf21626[_0xcd08('0x9d')][_0xcd08('0xf0')],_0xf21626['body'][_0xcd08('0xbf')],_0xf21626['body'][_0xcd08('0xe4')]]);return _0x3995b7[_0xcd08('0x1d')](0xc8)[_0xcd08('0x1e')]({'message':'File\x20uploaded\x20correctly!','pid':_0x48d065['pid']});}catch(_0x245961){return _0x3995b7[_0xcd08('0x1d')](0x1f4)[_0xcd08('0x2d')](_0x245961);}};exports[_0xcd08('0xf1')]=function(_0x5b0e9b,_0x23bb55,_0x134ba2){var _0x451a86=fs[_0xcd08('0xf2')](_0x5b0e9b[_0xcd08('0xe9')][_0xcd08('0xf3')]);Papa[_0xcd08('0xf4')](_0x451a86,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xcab461){return _0x23bb55['status'](0xc8)['json']({'file':_0x5b0e9b[_0xcd08('0xe9')],'fields':_0xcab461[_0xcd08('0xf5')][_0xcd08('0x3b')]});}});};exports['import']=function(_0x38be75,_0x3551bf,_0x2bf93d){return db[_0xcd08('0x7f')][_0xcd08('0x9e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xcd08('0x83')}})[_0xcd08('0x28')](function(_0x54e749){var _0x175cc3=![];if(!_0x38be75['body'][_0xcd08('0x62')]){throw new Error(_0xcd08('0xdf'));}if(!_0x38be75[_0xcd08('0x9d')][_0xcd08('0xf6')][_0xcd08('0xce')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x38be75[_0xcd08('0x9d')][_0xcd08('0xf6')][_0xcd08('0xf7')]){throw new Error(_0xcd08('0xf8'));}if(!_0x38be75[_0xcd08('0x9d')][_0xcd08('0xe4')]){throw new Error(_0xcd08('0xf9'));}var _0x29fa39=require(_0xcd08('0xed'))['fork'](path[_0xcd08('0xa1')](__dirname,_0xcd08('0xfa')),[_0x38be75[_0xcd08('0xc7')]['id'],JSON[_0xcd08('0xfb')](_0x38be75[_0xcd08('0x9d')]),JSON[_0xcd08('0xfb')](_0x54e749)]);_0x29fa39['on']('message',function(_0x5713f4){_0x175cc3=!![];return _0x3551bf[_0xcd08('0x1d')](0xc8)[_0xcd08('0x1e')]({'message':_0xcd08('0xfc'),'pid':_0x29fa39[_0xcd08('0xfd')]});});_0x29fa39['on']('exit',function(_0x353b06){if(_0x353b06&&!_0x175cc3){return _0x3551bf['status'](0x1f4)[_0xcd08('0x1e')]({'message':_0xcd08('0xfe'),'pid':_0x29fa39[_0xcd08('0xfd')]});}});})['catch'](handleError(_0x3551bf,null));};exports[_0xcd08('0xff')]=function(_0x18eb3e,_0x3c2162){var _0x4d1abd=['mail',_0xcd08('0x100'),_0xcd08('0x101'),_0xcd08('0x102'),'fax',_0xcd08('0x103'),'voice'];var _0x3d4ce7={'offset':0x0,'order':qs[_0xcd08('0x3f')]('-createdAt')},_0x1d7585={'count':0x0,'rows':[]};Promise[_0xcd08('0x7c')]()[_0xcd08('0x28')](function(){if(_0x18eb3e[_0xcd08('0x39')][_0xcd08('0x104')]){if(!_[_0xcd08('0x105')](_0x4d1abd,_0x18eb3e['query'][_0xcd08('0x104')][_0xcd08('0x106')]())){throw new Error('Invalid\x20channel');}_0x4d1abd=[_0x18eb3e[_0xcd08('0x39')][_0xcd08('0x104')][_0xcd08('0x106')]()];}if(_0x18eb3e['query'][_0xcd08('0x107')]){try{var _0x36d5b9=JSON[_0xcd08('0xf4')](_0x18eb3e[_0xcd08('0x39')][_0xcd08('0x107')]);if(!moment(_0x36d5b9[_0xcd08('0x46')])[_0xcd08('0x108')]()){throw new Error(_0xcd08('0x109'));}if(!moment(_0x36d5b9['to'])[_0xcd08('0x108')]()){throw new Error(_0xcd08('0x10a'));}}catch(_0x183ff8){throw new Error(_0xcd08('0x10b'));}}if(!_0x18eb3e[_0xcd08('0x39')]['hasOwnProperty'](_0xcd08('0x3d'))){_0x3d4ce7[_0xcd08('0x22')]=qs[_0xcd08('0x22')](_0x18eb3e[_0xcd08('0x39')]['limit']||0xa);_0x3d4ce7['offset']=qs[_0xcd08('0x1f')](_0x18eb3e[_0xcd08('0x39')][_0xcd08('0x1f')]);}var _0x40bd38=_0x4d1abd[_0xcd08('0x55')](function(_0x3e0adb){if(_0x3e0adb===_0xcd08('0x10c')){var _0x1620f8={'attributes':['id','uniqueid',_0xcd08('0x37'),'source',_0xcd08('0x10d'),_0xcd08('0x10e'),'starttime','endtime',_0xcd08('0x10f'),_0xcd08('0x110'),_0xcd08('0x111'),_0xcd08('0x112'),_0xcd08('0x113'),_0xcd08('0x114'),_0xcd08('0x115')],'where':{'ContactId':_0x18eb3e[_0xcd08('0xc7')]['id']},'include':[{'model':db['User'],'as':_0xcd08('0x7f'),'attributes':['id','name',_0xcd08('0x116'),'alias']}],'order':[['createdAt',_0xcd08('0x7a')]]};if(_0x18eb3e[_0xcd08('0x39')][_0xcd08('0x107')]){_0x1620f8[_0xcd08('0x40')][_0xcd08('0x111')]={'$gte':_0x36d5b9[_0xcd08('0x46')],'$lte':_0x36d5b9['to']};}return db[_0xcd08('0xb4')][_0xcd08('0x117')](_0x1620f8)['then'](function(_0x3087d6){_0x1d7585[_0xcd08('0x21')]+=_0x3087d6[_0xcd08('0x21')];return _['map'](_0x3087d6[_0xcd08('0xd7')],function(_0x4de215){var _0x3f8772=_0x4de215[_0xcd08('0x9f')]({'plain':!![]});_0x3f8772[_0xcd08('0x104')]=_0x3e0adb;if(_0x3f8772[_0xcd08('0x7f')]){_0x3f8772[_0xcd08('0x7f')]={'id':_0x3f8772[_0xcd08('0x7f')]['id'],'name':_0x3f8772[_0xcd08('0x7f')][_0xcd08('0x2c')],'fullname':_0x3f8772[_0xcd08('0x7f')][_0xcd08('0x116')],'alias':_0x3f8772[_0xcd08('0x7f')]['alias']};}return _0x3f8772;});});}else{var _0x5729a3=_['startCase'](_0x3e0adb)+(_0x3e0adb===_0xcd08('0x100')?_0xcd08('0x118'):'Account');var _0x1cf43e={'attributes':['id',_0xcd08('0x119'),_0xcd08('0x11a'),'createdAt',_0xcd08('0x110'),_0xcd08('0x11b'),_0xcd08('0x11c'),_0xcd08('0x11d'),_0xcd08('0x115'),_0x5729a3+'Id'],'where':{'ContactId':_0x18eb3e[_0xcd08('0xc7')]['id']},'include':[{'model':db[_0x5729a3],'as':'Account','attributes':['id',_0xcd08('0x2c'),_0xcd08('0x11e')]},{'model':db[_0xcd08('0x7f')],'as':_0xcd08('0x11f'),'attributes':['id',_0xcd08('0x2c'),_0xcd08('0x116')]},{'model':db[_0xcd08('0x52')],'as':'Tags','attributes':['id',_0xcd08('0x2c'),'color'],'through':{'attributes':[]}}],'order':[[_0xcd08('0x111'),'DESC']]};if(_0x18eb3e[_0xcd08('0x39')][_0xcd08('0x107')]){_0x1cf43e[_0xcd08('0x40')][_0xcd08('0x111')]={'$gte':_0x36d5b9[_0xcd08('0x46')],'$lte':_0x36d5b9['to']};}switch(_0x3e0adb){case _0xcd08('0x100'):_0x1cf43e['attributes']['push'](_0xcd08('0x120'),_0xcd08('0x121'),_0xcd08('0x122'),_0xcd08('0x123'),_0xcd08('0x124'),'ratingMessage',_0xcd08('0x125'),_0xcd08('0x126'),_0xcd08('0x127'));break;case _0xcd08('0x128'):_0x1cf43e[_0xcd08('0x3a')][_0xcd08('0x94')]('subject',_0xcd08('0x129'));break;case'openchannel':_0x1cf43e[_0xcd08('0x3a')][_0xcd08('0x94')]('externalUrl',_0xcd08('0x12a'));break;}return db[_[_0xcd08('0x12b')](_0x3e0adb)+_0xcd08('0x12c')][_0xcd08('0x117')](_0x1cf43e)['then'](function(_0x44241d){_0x1d7585['count']+=_0x44241d[_0xcd08('0x21')];return _[_0xcd08('0x55')](_0x44241d[_0xcd08('0xd7')],function(_0x5c3405){var _0x689b2b=_0x5c3405[_0xcd08('0x9f')]({'plain':!![]});_0x689b2b['channel']=_0x3e0adb;if(_0x689b2b[_0xcd08('0x11f')]){_0x689b2b['Owner']={'id':_0x689b2b['Owner']['id'],'name':_0x689b2b['Owner'][_0xcd08('0x2c')],'fullname':_0x689b2b[_0xcd08('0x11f')][_0xcd08('0x116')]};}return _0x689b2b;});});}});return Promise['all'](_0x40bd38);})[_0xcd08('0x28')](function(_0x1ec316){return _(_0x1ec316)['flatten']()[_0xcd08('0x12d')](_0xcd08('0x111'))['reverse']()[_0xcd08('0x53')]();})[_0xcd08('0x28')](function(_0xfe4e7){_0x1d7585['rows']=_0x3d4ce7[_0xcd08('0x22')]?_0xfe4e7[_0xcd08('0x12e')](_0x3d4ce7[_0xcd08('0x1f')],_0x3d4ce7['offset']+_0x3d4ce7[_0xcd08('0x22')]):_0xfe4e7;return _0x1d7585;})[_0xcd08('0x28')](respondWithFilteredResult(_0x3c2162,_0x3d4ce7))[_0xcd08('0x95')](handleError(_0x3c2162,null));};
\ No newline at end of file
+var _0xe5f2=['getHopperFinals','CmHopperFinal','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','root','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','socket_timestamp','json','pid','upload','createReadStream','path','parse','meta','User','agent','No\x20phone\x20column\x20specified','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','exit','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','voice','source','destination','callerid','starttime','duration','note','userDisposition','userSecondDisposition','UserId','createdAt','findAndCountAll','startCase','Website','Account','closed','disposition','thirdDisposition','key','Owner','fullname','color','DESC','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','substatus','Interaction','flatten','sortBy','reverse','value','bluebird','util','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','undefined','limit','count','set','then','end','error','stack','name','send','index','getOptions','findAll','query','user','destroy','CmContact','find','params','catch','describe','cf_','columnName','analytics','CmCustomField','length','displayName','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','keys','hasOwnProperty','body','from','get','mergeWith','isArray','tags','join','CmHopperBlack','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','create','isNil','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','where','$or','ListId','spread','push','contact','all','show','Tag','Tags','Phones','ContactItemType','sequelize','literal','Phones.OrderBy','omit','map','cf_%d','$and','pickBy','startsWith','format','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','findOne','model','rawAttributes','intersection','attributes','fields','order','sort','filters','filter','merge','options','nolimit','offset','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopper','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','pick','ContactId','includeAll','rows','getHopperHistories'];(function(_0x4254af,_0x3c9214){var _0x2fa64d=function(_0x1ee605){while(--_0x1ee605){_0x4254af['push'](_0x4254af['shift']());}};_0x2fa64d(++_0x3c9214);}(_0xe5f2,0x15e));var _0x2e5f=function(_0x593b96,_0x260616){_0x593b96=_0x593b96-0x0;var _0x55b051=_0xe5f2[_0x593b96];return _0x55b051;};'use strict';var moment=require('moment');var BPromise=require(_0x2e5f('0x0'));var util=require(_0x2e5f('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x2e5f('0x2'));var Papa=require(_0x2e5f('0x3'));var Redis=require(_0x2e5f('0x4'));var contacts=require(_0x2e5f('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x2e5f('0x6'))(_0x2e5f('0x7'));var config=require(_0x2e5f('0x8'));var shared=require('../../config/environment/shared');var db=require(_0x2e5f('0x9'))['db'];config[_0x2e5f('0xa')]=_[_0x2e5f('0xb')](config[_0x2e5f('0xa')],{'host':_0x2e5f('0xc'),'port':0x18eb});var socket=require(_0x2e5f('0xd'))(new Redis(config[_0x2e5f('0xa')]));require(_0x2e5f('0xe'))['register'](socket);function respondWithResult(_0x317d1c,_0x3e5e60){_0x3e5e60=_0x3e5e60||0xc8;return function(_0x2e926c){if(_0x2e926c){return _0x317d1c[_0x2e5f('0xf')](_0x3e5e60)['json'](_0x2e926c);}};}function respondWithFilteredResult(_0xd034e5,_0x2bc05f){return function(_0xad288d){if(_0xad288d){var _0x46835a=typeof _0x2bc05f['offset']===_0x2e5f('0x10')&&typeof _0x2bc05f[_0x2e5f('0x11')]==='undefined';var _0x2c28b9=_0xad288d['count'];var _0x3a5dce=_0x46835a?0x0:_0x2bc05f['offset'];var _0xe6b917=_0x46835a?_0xad288d[_0x2e5f('0x12')]:_0x2bc05f['offset']+_0x2bc05f['limit'];var _0x58baa0;if(_0xe6b917>=_0x2c28b9){_0xe6b917=_0x2c28b9;_0x58baa0=0xc8;}else{_0x58baa0=0xce;}_0xd034e5['status'](_0x58baa0);return _0xd034e5[_0x2e5f('0x13')]('Content-Range',_0x3a5dce+'-'+_0xe6b917+'/'+_0x2c28b9)['json'](_0xad288d);}return null;};}function saveUpdates(_0x5457ea){return function(_0x3f0880){if(_0x3f0880){return _0x3f0880['update'](_0x5457ea)[_0x2e5f('0x14')](function(_0x34d9e1){return _0x34d9e1;});}return null;};}function removeEntity(_0x3efc84){return function(_0x27b564){if(_0x27b564){return _0x27b564['destroy']()['then'](function(){_0x3efc84[_0x2e5f('0xf')](0xcc)[_0x2e5f('0x15')]();});}};}function handleEntityNotFound(_0x3647aa){return function(_0x1537c9){if(!_0x1537c9){_0x3647aa['sendStatus'](0x194);}return _0x1537c9;};}function handleError(_0x3f511b,_0x2402f2){_0x2402f2=_0x2402f2||0x1f4;return function(_0x119a29){logger[_0x2e5f('0x16')](_0x119a29[_0x2e5f('0x17')]);if(_0x119a29[_0x2e5f('0x18')]){delete _0x119a29[_0x2e5f('0x18')];}_0x3f511b[_0x2e5f('0xf')](_0x2402f2)[_0x2e5f('0x19')](_0x119a29);};}exports[_0x2e5f('0x1a')]=function(_0x469f34,_0x226015){var _0xc0bad5={};return contacts['describe']()[_0x2e5f('0x14')](function(_0x1c99ac){_0xc0bad5=qs[_0x2e5f('0x1b')](_0x1c99ac,_0x469f34);return contacts[_0x2e5f('0x1c')](_0x469f34[_0x2e5f('0x1d')],_0x469f34[_0x2e5f('0x1e')],_0xc0bad5,_0x1c99ac);})[_0x2e5f('0x14')](respondWithFilteredResult(_0x226015,_0xc0bad5))['catch'](handleError(_0x226015,null));};exports[_0x2e5f('0x1f')]=function(_0x240aa8,_0x22f4ed){return db[_0x2e5f('0x20')][_0x2e5f('0x21')]({'where':{'id':_0x240aa8[_0x2e5f('0x22')]['id']}})['then'](handleEntityNotFound(_0x22f4ed,null))[_0x2e5f('0x14')](removeEntity(_0x22f4ed,null))[_0x2e5f('0x23')](handleError(_0x22f4ed,null));};exports[_0x2e5f('0x24')]=function(_0x2308e7,_0x5651ef){return db['CmContact'][_0x2e5f('0x24')]()['then'](function(_0x4ac62b){delete _0x4ac62b['tags'];for(var _0x4136fa=0x0;_0x4136fa<Object['keys'](_0x4ac62b)['length'];_0x4136fa++){var _0x208e84=Object['keys'](_0x4ac62b)[_0x4136fa];if(!_['startsWith'](_0x208e84,_0x2e5f('0x25'))){_0x4ac62b[_0x208e84][_0x2e5f('0x26')]=_0x208e84;_0x4ac62b[_0x208e84]['displayName']=_0x208e84;}}return _0x4ac62b;})[_0x2e5f('0x14')](function(_0x4555b5){var _0x3475d1={'where':Boolean(_0x2308e7[_0x2e5f('0x1d')][_0x2e5f('0x27')])===!![]?undefined:{'$or':[{'ListId':_0x2308e7[_0x2e5f('0x1d')]['id']},{'ListId':null}]},'raw':!![]};return db[_0x2e5f('0x28')][_0x2e5f('0x1c')](_0x3475d1)[_0x2e5f('0x14')](function(_0x5b0190){for(var _0x250d09=0x0;_0x250d09<_0x5b0190[_0x2e5f('0x29')];_0x250d09++){var _0x3f560b=_0x2e5f('0x25')+_0x5b0190[_0x250d09]['id'];if(_0x4555b5[_0x3f560b]){_0x4555b5[_0x3f560b]['columnName']=_0x3f560b;_0x4555b5[_0x3f560b][_0x2e5f('0x2a')]=_0x5b0190[_0x250d09][_0x2e5f('0x2b')];_0x4555b5[_0x3f560b][_0x2e5f('0x2c')]={'type':_0x5b0190[_0x250d09][_0x2e5f('0x2d')],'values':_0x5b0190[_0x250d09][_0x2e5f('0x2e')]};}else{logger[_0x2e5f('0x2f')](_0x2e5f('0x30'),_0x3f560b);}}Object[_0x2e5f('0x31')](_0x4555b5)['forEach'](function(_0x50a406){if(!_0x4555b5[_0x50a406][_0x2e5f('0x32')](_0x2e5f('0x26'))){delete _0x4555b5[_0x50a406];}});return _0x4555b5;});})[_0x2e5f('0x14')](respondWithResult(_0x5651ef,null))['catch'](handleError(_0x5651ef,null));};exports['merge']=function(_0x47943c,_0x1d8642){var _0x43b49e;var _0x5063da;var _0x267181;if(_0x47943c[_0x2e5f('0x33')]['id']){delete _0x47943c[_0x2e5f('0x33')]['id'];}return db[_0x2e5f('0x20')]['findAll']({'where':{'id':[_0x47943c['body']['to'],_0x47943c[_0x2e5f('0x33')][_0x2e5f('0x34')]]}})[_0x2e5f('0x14')](function(_0x2d000e){if(_0x2d000e){if(_0x2d000e[_0x2e5f('0x29')]!==0x2){return null;}_0x2d000e[0x0]=_0x2d000e[0x0][_0x2e5f('0x35')]({'plain':!![]});_0x2d000e[0x1]=_0x2d000e[0x1][_0x2e5f('0x35')]({'plain':!![]});delete _0x2d000e[0x0]['id'];delete _0x2d000e[0x1]['id'];return _[_0x2e5f('0x36')](_0x2d000e[0x0],_0x2d000e[0x1],function(_0x371684,_0x4af350){if(Array[_0x2e5f('0x37')](_0x4af350)&&!_0x4af350[_0x2e5f('0x29')]){return _0x371684;}else if(!_0x4af350){return _0x371684;}});}})[_0x2e5f('0x14')](handleEntityNotFound(_0x1d8642,null))[_0x2e5f('0x14')](function(_0x55af60){if(_0x55af60){if(_0x55af60[_0x2e5f('0x38')]&&_[_0x2e5f('0x37')](_0x55af60[_0x2e5f('0x38')])){_0x55af60[_0x2e5f('0x38')]=_0x55af60['tags'][_0x2e5f('0x39')]();}logger[_0x2e5f('0x2f')]('[CmContact][merge]\x20to\x20%s\x20from\x20%s',_0x47943c['body']['to'],_0x47943c[_0x2e5f('0x33')][_0x2e5f('0x34')]);return db['CmHopper'][_0x2e5f('0x1f')]({'where':{'ContactId':[_0x47943c[_0x2e5f('0x33')]['to'],_0x47943c[_0x2e5f('0x33')][_0x2e5f('0x34')]]}})[_0x2e5f('0x14')](function(_0x42d80e){logger[_0x2e5f('0x2f')]('[CmContact][merge][destroy][CmHopper],\x20%s',_0x42d80e);return db[_0x2e5f('0x3a')][_0x2e5f('0x1f')]({'where':{'ContactId':[_0x47943c[_0x2e5f('0x33')]['to'],_0x47943c[_0x2e5f('0x33')][_0x2e5f('0x34')]]}})[_0x2e5f('0x14')](function(_0x470c13){logger['info']('[CmContact][merge][destroy][CmHopperBlack],\x20%s',_0x470c13);return db['CmContact']['create'](_0x55af60);});});}})['then'](function(_0x12f8d2){if(_0x12f8d2){_0x43b49e=_0x12f8d2;_0x5063da={'ContactId':_0x43b49e['id']};_0x267181={'where':{'ContactId':[_0x47943c[_0x2e5f('0x33')]['to'],_0x47943c[_0x2e5f('0x33')]['from']]}};return db[_0x2e5f('0x3b')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})['then'](function(){if(_0x43b49e){return db[_0x2e5f('0x3d')]['update'](_0x5063da,_0x267181);}})['then'](function(){if(_0x43b49e){return db[_0x2e5f('0x3e')]['update'](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x3f')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x40')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x3f')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db['MailMessage'][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x41')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x42')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x43')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x44')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})['then'](function(){if(_0x43b49e){return db[_0x2e5f('0x45')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x46')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x47')][_0x2e5f('0x3c')]({'CmContactId':_0x43b49e['id']},{'where':{'CmContactId':[_0x47943c[_0x2e5f('0x33')]['to'],_0x47943c[_0x2e5f('0x33')][_0x2e5f('0x34')]]}});}})['then'](function(){if(_0x43b49e){return db['CmHopperFinal'][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x48')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x49')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})['then'](function(){if(_0x43b49e){return db[_0x2e5f('0x4a')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x4b')]['update'](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x4c')]['update'](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x4d')]['update'](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x4e')]['update'](_0x5063da,_0x267181);}})['then'](function(){if(_0x43b49e){return db[_0x2e5f('0x4f')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})['then'](function(){if(_0x43b49e){return db[_0x2e5f('0x50')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db['WhatsappInteraction']['update'](_0x5063da,_0x267181);}})['then'](function(){if(_0x43b49e){return db[_0x2e5f('0x51')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x52')][_0x2e5f('0x3c')](_0x5063da,_0x267181);}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return db[_0x2e5f('0x20')][_0x2e5f('0x1f')]({'where':{'id':[_0x47943c[_0x2e5f('0x33')]['to'],_0x47943c[_0x2e5f('0x33')]['from']]}});}})[_0x2e5f('0x14')](function(){if(_0x43b49e){return _0x43b49e;}})['then'](respondWithResult(_0x1d8642,null))['catch'](handleError(_0x1d8642,null));};exports[_0x2e5f('0x53')]=function(_0xc181b2,_0x38f3a4){return db[_0x2e5f('0x20')][_0x2e5f('0x24')]()[_0x2e5f('0x14')](function(_0x336d10){if(_0xc181b2['body']['tags']&&_['isArray'](_0xc181b2[_0x2e5f('0x33')]['tags'])){if(_0xc181b2[_0x2e5f('0x33')][_0x2e5f('0x38')][_0x2e5f('0x29')]){_0xc181b2['body'][_0x2e5f('0x38')]=_0xc181b2[_0x2e5f('0x33')][_0x2e5f('0x38')]['join'](';')+';';}else{_0xc181b2[_0x2e5f('0x33')][_0x2e5f('0x38')]=null;}}else{_0xc181b2[_0x2e5f('0x33')][_0x2e5f('0x38')]=null;}if(!_[_0x2e5f('0x54')](_0xc181b2['body']['dialTimezone'])){var _0xa744cc=_0xc181b2[_0x2e5f('0x33')][_0x2e5f('0x55')];if(!_[_0x2e5f('0x54')](shared[_0x2e5f('0x56')][_0xa744cc]))_0xc181b2['body'][_0x2e5f('0x57')]=shared[_0x2e5f('0x56')][_0xa744cc][_0x2e5f('0x57')];}return db[_0x2e5f('0x20')][_0x2e5f('0x53')](_0xc181b2[_0x2e5f('0x33')],{'fields':_[_0x2e5f('0x31')](_0x336d10),'raw':!![]});})['then'](function(_0x38c6af){if(_0xc181b2[_0x2e5f('0x33')]['additionalPhones']){return insertAdditionalPhones(_0x38c6af,_0xc181b2[_0x2e5f('0x33')][_0x2e5f('0x58')]);}else{return _0x38c6af;}})[_0x2e5f('0x14')](respondWithResult(_0x38f3a4,0xc9))[_0x2e5f('0x23')](handleError(_0x38f3a4,null));};exports['bulkCreate']=function(_0x4ae44d,_0x5de56e){var _0x6289fb=0x0;var _0x2aa641=0x0;var _0x30d2b2=0x0;var _0x15d6ca=[];return db['CmContact'][_0x2e5f('0x24')]()['then'](function(_0x6b3616){return BPromise[_0x2e5f('0x59')](_0x4ae44d['body'],function(_0x131aac){var _0x2960dc={'where':{'$or':[]},'defaults':_0x131aac,'fields':_[_0x2e5f('0x31')](_0x6b3616),'raw':!![]};if(_0x131aac['duplicates']){for(var _0x29bd52=0x0;_0x29bd52<_0x131aac[_0x2e5f('0x5a')][_0x2e5f('0x29')];_0x29bd52++){var _0xccf928={};_0xccf928[_0x131aac['duplicates'][_0x29bd52]]=_0x131aac[_0x131aac[_0x2e5f('0x5a')][_0x29bd52]];_0x2960dc[_0x2e5f('0x5b')][_0x2e5f('0x5c')]['push'](_0xccf928);}_0x2960dc[_0x2e5f('0x5b')][_0x2e5f('0x5d')]=_0x131aac[_0x2e5f('0x5d')];}return db[_0x2e5f('0x20')]['findOrCreate'](_0x2960dc)[_0x2e5f('0x5e')](function(_0x5d3f8a,_0x463321){if(_0x463321){if(_0x131aac[_0x2e5f('0x32')]('additionalPhones')){_0x15d6ca[_0x2e5f('0x5f')]({'contact':_0x5d3f8a,'additionalPhones':_0x131aac[_0x2e5f('0x58')]});}_0x6289fb++;}else{_0x30d2b2++;}})[_0x2e5f('0x23')](function(){_0x2aa641++;});});})[_0x2e5f('0x14')](function(_0x5b4f70){if(_0x5b4f70){if(_0x15d6ca[_0x2e5f('0x29')]>0x0){return new Promise(function(_0xd009a2){var _0x5de8f4=[];for(var _0x3b30ee=0x0;_0x3b30ee<_0x15d6ca[_0x2e5f('0x29')];_0x3b30ee++){_0x5de8f4[_0x2e5f('0x5f')](insertAdditionalPhones(_0x15d6ca[_0x3b30ee][_0x2e5f('0x60')],_0x15d6ca[_0x3b30ee][_0x2e5f('0x58')]));}Promise[_0x2e5f('0x61')](_0x5de8f4)[_0x2e5f('0x14')](function(){_0xd009a2(0x1);});})['then'](function(){return{'success':_0x6289fb,'failure':_0x2aa641,'duplicates':_0x30d2b2};});}else{return{'success':_0x6289fb,'failure':_0x2aa641,'duplicates':_0x30d2b2};}}})[_0x2e5f('0x14')](respondWithResult(_0x5de56e,0xc9))[_0x2e5f('0x23')](handleError(_0x5de56e,null));};exports[_0x2e5f('0x62')]=function(_0x10d5e0,_0x51c740){var _0x2f27d6;return db['CmContact'][_0x2e5f('0x24')]()['then'](function(_0x8374f){return db[_0x2e5f('0x20')][_0x2e5f('0x21')]({'where':{'id':_0x10d5e0[_0x2e5f('0x22')]['id']},'include':[{'model':db[_0x2e5f('0x63')],'as':_0x2e5f('0x64'),'attributes':['id',_0x2e5f('0x18'),'color'],'required':_0x10d5e0[_0x2e5f('0x1d')]['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x2e5f('0x65'),'where':{'CmContactId':_0x10d5e0[_0x2e5f('0x22')]['id']},'required':![],'include':[{'model':db[_0x2e5f('0x66')],'as':'ItemType'}]}],'order':[db[_0x2e5f('0x67')][_0x2e5f('0x68')](_0x2e5f('0x69'))],'attributes':_['keys'](_0x8374f)});})[_0x2e5f('0x14')](function(_0x19ad95){if(!_['isNil'](_0x19ad95)){_0x2f27d6=_0x19ad95[_0x2e5f('0x35')]({'plain':!![]});var _0xeec750={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x19ad95&&_0x19ad95[_0x2e5f('0x5d')]){if(_0x19ad95['ListId']){_0xeec750[_0x2e5f('0x5b')]['$and'][_0x2e5f('0x5f')]({'ListId':{'$ne':_0x19ad95[_0x2e5f('0x5d')]}});}}return db[_0x2e5f('0x28')][_0x2e5f('0x1c')](_0xeec750);}})['then'](function(_0x43996e){if(!_[_0x2e5f('0x54')](_0x43996e)){return _[_0x2e5f('0x6a')](_0x2f27d6,_[_0x2e5f('0x6b')](_0x43996e,function(_0x3649fe){return util['format'](_0x2e5f('0x6c'),_0x3649fe['id']);}));}})['then'](handleEntityNotFound(_0x51c740,null))[_0x2e5f('0x14')](respondWithResult(_0x51c740,null))[_0x2e5f('0x23')](handleError(_0x51c740,null));};exports[_0x2e5f('0x3c')]=function(_0x23ab1b,_0x89470f){var _0x2b195d;if(_0x23ab1b[_0x2e5f('0x33')]['id']){delete _0x23ab1b[_0x2e5f('0x33')]['id'];}if(!_[_0x2e5f('0x54')](_0x23ab1b['body'][_0x2e5f('0x55')])){var _0x4f0d3d=_0x23ab1b[_0x2e5f('0x33')][_0x2e5f('0x55')];if(!_['isNil'](shared[_0x2e5f('0x56')][_0x4f0d3d]))_0x23ab1b[_0x2e5f('0x33')][_0x2e5f('0x57')]=shared[_0x2e5f('0x56')][_0x4f0d3d][_0x2e5f('0x57')];}return db[_0x2e5f('0x20')][_0x2e5f('0x21')]({'where':{'id':_0x23ab1b[_0x2e5f('0x22')]['id']}})['then'](handleEntityNotFound(_0x89470f,null))[_0x2e5f('0x14')](saveUpdates(_0x23ab1b[_0x2e5f('0x33')],null))['then'](function(_0x58c61b){_0x2b195d=_0x58c61b;var _0x24b226={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x58c61b&&_0x58c61b[_0x2e5f('0x5d')]){if(_0x58c61b['ListId']){_0x24b226[_0x2e5f('0x5b')][_0x2e5f('0x6d')][_0x2e5f('0x5f')]({'ListId':{'$ne':_0x58c61b[_0x2e5f('0x5d')]}});}}return db[_0x2e5f('0x28')]['findAll'](_0x24b226);})[_0x2e5f('0x14')](function(_0x55d55f){if(_0x55d55f){return _[_0x2e5f('0x6a')](_[_0x2e5f('0x6e')](_0x23ab1b[_0x2e5f('0x33')],function(_0x2825a2,_0x30ae1a){return _[_0x2e5f('0x6f')](_0x30ae1a,'cf_');}),_['map'](_0x55d55f,function(_0x2ef23a){return util[_0x2e5f('0x70')](_0x2e5f('0x6c'),_0x2ef23a['id']);}));}})['then'](function(_0x56b8e2){if(_0x56b8e2&&!_[_0x2e5f('0x71')](_0x56b8e2)){var _0x59873b=squel[_0x2e5f('0x3c')]()[_0x2e5f('0x72')](_0x2e5f('0x73'))[_0x2e5f('0x74')](_0x56b8e2)[_0x2e5f('0x5b')](_0x2e5f('0x75'),_0x23ab1b[_0x2e5f('0x22')]['id'])[_0x2e5f('0x76')]();return db[_0x2e5f('0x67')][_0x2e5f('0x1d')](_0x59873b[_0x2e5f('0x77')],{'replacements':_0x59873b[_0x2e5f('0x2e')]});}})[_0x2e5f('0x14')](function(){if(_0x23ab1b['body'][_0x2e5f('0x78')]&&_0x2b195d){return db['CmHopper']['update']({'phone':_0x23ab1b[_0x2e5f('0x33')][_0x2e5f('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x2b195d['id']}});}})[_0x2e5f('0x14')](function(){return _0x2b195d;})[_0x2e5f('0x14')](respondWithResult(_0x89470f,null))[_0x2e5f('0x23')](handleError(_0x89470f,null));};exports['getTags']=function(_0x518f57,_0x593263){var _0x289748={};var _0xf0eed1={};var _0x30c183;var _0xb5ed00;return db[_0x2e5f('0x20')][_0x2e5f('0x79')]({'where':{'id':_0x518f57['params']['id']}})['then'](handleEntityNotFound(_0x593263,null))['then'](function(_0xe14530){if(_0xe14530){_0x30c183=_0xe14530;_0xf0eed1[_0x2e5f('0x7a')]=_[_0x2e5f('0x31')](db[_0x2e5f('0x63')][_0x2e5f('0x7b')]);_0xf0eed1[_0x2e5f('0x1d')]=_[_0x2e5f('0x31')](_0x518f57[_0x2e5f('0x1d')]);_0xf0eed1['filters']=_[_0x2e5f('0x7c')](_0xf0eed1[_0x2e5f('0x7a')],_0xf0eed1[_0x2e5f('0x1d')]);_0x289748[_0x2e5f('0x7d')]=_[_0x2e5f('0x7c')](_0xf0eed1[_0x2e5f('0x7a')],qs[_0x2e5f('0x7e')](_0x518f57['query'][_0x2e5f('0x7e')]));_0x289748[_0x2e5f('0x7d')]=_0x289748[_0x2e5f('0x7d')]['length']?_0x289748[_0x2e5f('0x7d')]:_0xf0eed1[_0x2e5f('0x7a')];_0x289748[_0x2e5f('0x7f')]=qs[_0x2e5f('0x80')](_0x518f57[_0x2e5f('0x1d')][_0x2e5f('0x80')]);_0x289748['where']=qs[_0x2e5f('0x81')](_['pick'](_0x518f57[_0x2e5f('0x1d')],_0xf0eed1[_0x2e5f('0x81')]));if(_0x518f57[_0x2e5f('0x1d')][_0x2e5f('0x82')]){_0x289748[_0x2e5f('0x5b')]=_[_0x2e5f('0x83')](_0x289748['where'],{'$or':_[_0x2e5f('0x6b')](_0x289748['attributes'],function(_0x32ce0e){var _0x11a2fe={};_0x11a2fe[_0x32ce0e]={'$like':'%'+_0x518f57[_0x2e5f('0x1d')][_0x2e5f('0x82')]+'%'};return _0x11a2fe;})});}_0x289748=_[_0x2e5f('0x83')]({},_0x289748,_0x518f57[_0x2e5f('0x84')]);return _0x30c183['getTags'](_0x289748);}})[_0x2e5f('0x14')](function(_0x282dbb){if(_0x282dbb){_0xb5ed00=_0x282dbb[_0x2e5f('0x29')];if(!_0x518f57[_0x2e5f('0x1d')][_0x2e5f('0x32')](_0x2e5f('0x85'))){_0x289748[_0x2e5f('0x11')]=qs['limit'](_0x518f57[_0x2e5f('0x1d')]['limit']);_0x289748[_0x2e5f('0x86')]=qs[_0x2e5f('0x86')](_0x518f57[_0x2e5f('0x1d')]['offset']);}return _0x30c183['getTags'](_0x289748);}})[_0x2e5f('0x14')](function(_0x2b0e77){if(_0x2b0e77){return _0x2b0e77?{'count':_0xb5ed00,'rows':_0x2b0e77}:null;}})['then'](respondWithResult(_0x593263,null))[_0x2e5f('0x23')](handleError(_0x593263,null));};exports[_0x2e5f('0x87')]=function(_0x275109,_0x2f1ecb){if(_0x275109[_0x2e5f('0x33')]['id']){delete _0x275109[_0x2e5f('0x33')]['id'];}return db[_0x2e5f('0x20')][_0x2e5f('0x79')]({'where':{'id':_0x275109[_0x2e5f('0x22')]['id']}})[_0x2e5f('0x14')](handleEntityNotFound(_0x2f1ecb,null))[_0x2e5f('0x14')](function(_0x583adb){if(_0x583adb){return _0x583adb[_0x2e5f('0x87')](_0x275109[_0x2e5f('0x33')]['ids']||[]);}return null;})['then'](respondWithResult(_0x2f1ecb,null))['catch'](handleError(_0x2f1ecb,null));};exports[_0x2e5f('0x88')]=function(_0x1dcbc9,_0x1ea4dc){var _0x579274=[];_0x579274[_0x2e5f('0x5f')](addAdditionalPhones(_0x1dcbc9[_0x2e5f('0x33')]));Promise[_0x2e5f('0x61')](_0x579274)[_0x2e5f('0x14')](function(){_0x579274=[];_0x579274['push'](deleteCmHopperPhones(_0x1dcbc9[_0x2e5f('0x33')]['id']));_0x579274[_0x2e5f('0x5f')](addCmHopperPhones(_0x1dcbc9[_0x2e5f('0x33')]['id']));Promise[_0x2e5f('0x61')](_0x579274)[_0x2e5f('0x14')](function(){return[0x1];})[_0x2e5f('0x14')](respondWithResult(_0x1ea4dc,null));});};function addAdditionalPhones(_0x5bad98){var _0x496ff6;return new Promise(function(_0x2c97c3){return db[_0x2e5f('0x47')]['destroy']({'where':{'CmContactId':_0x5bad98['id']}})[_0x2e5f('0x14')](function(){db[_0x2e5f('0x66')][_0x2e5f('0x1c')]({'raw':!![],'attributes':['id',_0x2e5f('0x89')]})[_0x2e5f('0x14')](function(_0x400846){var _0x127de0=[];for(var _0x206569=0x0;_0x206569<_0x5bad98[_0x2e5f('0x8a')]['length'];_0x206569++){var _0xce3f4f=_0x5bad98['item_types']?_[_0x2e5f('0x54')](_0x5bad98[_0x2e5f('0x8b')][_0x206569])?'':_0x5bad98[_0x2e5f('0x8b')][_0x206569]:_0x5bad98[_0x2e5f('0x8a')][_0x206569][_0x2e5f('0x8c')]?_0x5bad98[_0x2e5f('0x8a')][_0x206569]['ItemTypeId']:'';var _0x10321e=_[_0x2e5f('0x54')](_0x5bad98[_0x2e5f('0x8a')][_0x206569][_0x2e5f('0x8d')])?'':_0x5bad98['items'][_0x206569][_0x2e5f('0x8d')];var _0x4743f1=_0xce3f4f+':'+_0x5bad98['items'][_0x206569][_0x2e5f('0x78')]+'ยง'+_0x10321e;if(_[_0x2e5f('0x54')](_0x496ff6))_0x496ff6=_0x4743f1;else _0x496ff6+=';'+_0x4743f1;var _0x116ba2=null;var _0x421df4=null;if(_0x5bad98[_0x2e5f('0x8b')]){if(!_['isNil'](_0x5bad98[_0x2e5f('0x8b')][_0x206569])){_0x421df4=_[_0x2e5f('0x21')](_0x400846,function(_0x572c5d){return _0x572c5d['id']===_0x5bad98[_0x2e5f('0x8b')][_0x206569];});if(!_[_0x2e5f('0x54')](_0x421df4)){_0x116ba2=_0x421df4[_0x2e5f('0x89')];}}}else{if(!_['isNil'](_0x5bad98['items'][_0x206569])){_0x421df4=_[_0x2e5f('0x21')](_0x400846,function(_0x47dd20){return _0x47dd20['id']===_0x5bad98[_0x2e5f('0x8a')][_0x206569][_0x2e5f('0x8c')];});if(!_['isNil'](_0x421df4)){_0x116ba2=_0x206569;}}}if(_[_0x2e5f('0x54')](_0x116ba2)){_0x116ba2=0x64;}_0x127de0[_0x2e5f('0x5f')](addAdditionalPhone(_0x5bad98['id'],_0x5bad98[_0x2e5f('0x8a')][_0x206569][_0x2e5f('0x78')],_0x5bad98[_0x2e5f('0x8b')]?_[_0x2e5f('0x54')](_0x5bad98['item_types'][_0x206569])?null:_0x5bad98['item_types'][_0x206569]:_0x5bad98[_0x2e5f('0x8a')][_0x206569][_0x2e5f('0x8c')]?_0x5bad98['items'][_0x206569][_0x2e5f('0x8c')]:null,_0x116ba2,_0x10321e));}Promise['all'](_0x127de0)['then'](function(){db[_0x2e5f('0x20')][_0x2e5f('0x3c')]({'AdditionalPhones':_0x496ff6},{'where':{'id':_0x5bad98['id']}})[_0x2e5f('0x14')](function(){_0x2c97c3(0x1);});});});});});}function addAdditionalPhone(_0xbbebcd,_0xa62ec8,_0x28dfc2,_0x4e87ec,_0xd10072){return db[_0x2e5f('0x47')]['find']({'where':{'CmContactId':_0xbbebcd,'item':_0xa62ec8}})[_0x2e5f('0x14')](function(_0x3c04e5){if(_0x3c04e5)logger[_0x2e5f('0x2f')](_0x2e5f('0x8e'),_0x3c04e5);else{db[_0x2e5f('0x47')][_0x2e5f('0x53')]({'CmContactId':_0xbbebcd,'item':_0xa62ec8,'ItemTypeId':_0x28dfc2,'OrderBy':_0x4e87ec,'ItemClass':_0x2e5f('0x8f'),'description':_0xd10072});}});}function deleteCmHopperPhones(_0x25b0b8){return new Promise(function(_0x53f966){return db[_0x2e5f('0x90')][_0x2e5f('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x25b0b8}})['then'](function(_0x24b759){db[_0x2e5f('0x91')][_0x2e5f('0x1f')]({'where':{'CmHopperId':{'$in':_[_0x2e5f('0x6b')](_0x24b759,'id')}}});})['then'](function(){_0x53f966(0x1);});});}function addCmHopperPhones(_0x2e5fe4){return new Promise(function(_0x6fda9e){return db['CmHopper'][_0x2e5f('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2e5fe4}})[_0x2e5f('0x14')](function(_0x5bc249){var _0x4aaae2=[];_['map'](_0x5bc249,function(_0x57ced0){_0x4aaae2['push'](createCmHopperPhone(_0x2e5fe4,_0x57ced0['id']));});Promise[_0x2e5f('0x61')](_0x4aaae2)[_0x2e5f('0x14')](function(){_0x6fda9e(0x1);});});});}function createCmHopperPhone(_0x201c33,_0x355f99){return new Promise(function(_0x5846b6){db[_0x2e5f('0x47')][_0x2e5f('0x1c')]({'raw':!![],'attributes':[_0x2e5f('0x92'),'OrderBy'],'where':{'CmContactId':_0x201c33,'ItemClass':_0x2e5f('0x8f')},'include':[{'model':db[_0x2e5f('0x66')],'attributes':[_0x2e5f('0x89')],'as':'ItemType'}],'order':[_0x2e5f('0x89'),db[_0x2e5f('0x67')][_0x2e5f('0x68')](_0x2e5f('0x93'))]})[_0x2e5f('0x14')](function(_0x59a88f){var _0x268ac7=0x1;var _0x22430e=_[_0x2e5f('0x6b')](_0x59a88f,function(_0x1c4c14){_0x1c4c14[_0x2e5f('0x94')]=_0x355f99;_0x1c4c14[_0x2e5f('0x78')]=_0x1c4c14[_0x2e5f('0x92')];_0x1c4c14[_0x2e5f('0x89')]=_0x268ac7;delete _0x1c4c14['ItemType.OrderBy'];_0x268ac7=_0x268ac7+0x1;return _0x1c4c14;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x22430e,{});})[_0x2e5f('0x14')](function(){_0x5846b6(0x1);});});}function insertAdditionalPhones(_0x23d684,_0x18485b){return new Promise(function(_0x49da8d){var _0x178e0c=[];for(var _0x5de013=0x0;_0x5de013<_0x18485b[_0x2e5f('0x29')];_0x5de013++){var _0x3789e1=_0x18485b[_0x5de013];_0x178e0c[_0x2e5f('0x5f')](parseContactItemType(_0x3789e1));}Promise['all'](_0x178e0c)[_0x2e5f('0x14')](function(){var _0x5cc01c={'id':_0x23d684['id'],'items':_0x18485b};return addAdditionalPhones(_0x5cc01c)[_0x2e5f('0x14')](function(){return addCmHopperPhones(_0x23d684['id']);});})[_0x2e5f('0x14')](function(){_0x49da8d(_0x23d684);});});}function parseContactItemType(_0x595a56){return new Promise(function(_0x1a224b){if(_0x595a56[_0x2e5f('0x32')](_0x2e5f('0x8c'))){_0x1a224b(_0x595a56);}else{return db['ContactItemType'][_0x2e5f('0x21')]({'where':{'name':_0x595a56[_0x2e5f('0x95')]}})[_0x2e5f('0x14')](function(_0x2f6c43){if(_[_0x2e5f('0x54')](_0x2f6c43))_0x595a56[_0x2e5f('0x8c')]=null;else _0x595a56[_0x2e5f('0x8c')]=_0x2f6c43['id'];_0x1a224b(_0x595a56);});}});}exports[_0x2e5f('0x96')]=function(_0x263655,_0x5d9d5a){return db['CmContactHasItem'][_0x2e5f('0x1c')]({'raw':!![],'where':{'CmContactId':_0x263655[_0x2e5f('0x22')]['id'],'ItemClass':_0x2e5f('0x8f')},'include':[{'model':db[_0x2e5f('0x66')],'as':_0x2e5f('0x95')}],'order':[[_0x2e5f('0x89')],[db[_0x2e5f('0x67')][_0x2e5f('0x68')](_0x2e5f('0x93'))]]})[_0x2e5f('0x14')](function(_0x5a0d6c){return _0x5a0d6c;})[_0x2e5f('0x14')](respondWithResult(_0x5d9d5a,null))[_0x2e5f('0x23')](handleError(_0x5d9d5a,null));};exports[_0x2e5f('0x97')]=function(_0x2632ef,_0x3b02c){return db[_0x2e5f('0x47')][_0x2e5f('0x1c')]({'raw':!![],'where':{'CmContactId':_0x2632ef[_0x2e5f('0x33')][_0x2e5f('0x98')]}})['then'](function(_0xc57a3a){var _0x3f9963=_[_0x2e5f('0x6b')](_0xc57a3a,function(_0x45d1b9){_0x45d1b9['CmContactId']=_0x2632ef[_0x2e5f('0x33')]['toContactId'];return _0x45d1b9;});return db[_0x2e5f('0x47')]['bulkCreate'](_0x3f9963,{});})[_0x2e5f('0x14')](function(){return addCmHopperPhones(_0x2632ef[_0x2e5f('0x33')][_0x2e5f('0x99')]);})['then'](function(){return['ok'];})[_0x2e5f('0x14')](respondWithResult(_0x3b02c,null))[_0x2e5f('0x23')](handleError(_0x3b02c,null));};exports[_0x2e5f('0x9a')]=function(_0x2c9e61,_0x348e73){var _0x1db485=[];_0x1db485[_0x2e5f('0x5f')](createCmHopperPhone(_0x2c9e61['body']['id'],_0x2c9e61[_0x2e5f('0x33')][_0x2e5f('0x9b')]));Promise['all'](_0x1db485)[_0x2e5f('0x14')](function(){return[0x1];})[_0x2e5f('0x14')](respondWithResult(_0x348e73,null));};exports[_0x2e5f('0x9c')]=function(_0x43ae75,_0x23c1e4){var _0x342196={'raw':![],'where':{}};var _0x49fa22={};var _0x37f8e2={'count':0x0,'rows':[]};return db[_0x2e5f('0x20')][_0x2e5f('0x79')]({'where':{'id':_0x43ae75[_0x2e5f('0x22')]['id']}})['then'](handleEntityNotFound(_0x23c1e4,null))[_0x2e5f('0x14')](function(_0x58f8c3){if(_0x58f8c3){_0x49fa22[_0x2e5f('0x7a')]=_[_0x2e5f('0x31')](db[_0x2e5f('0x90')][_0x2e5f('0x7b')]);_0x49fa22['query']=_['keys'](_0x43ae75[_0x2e5f('0x1d')]);_0x49fa22[_0x2e5f('0x81')]=_[_0x2e5f('0x7c')](_0x49fa22[_0x2e5f('0x7a')],_0x49fa22[_0x2e5f('0x1d')]);_0x342196['attributes']=_[_0x2e5f('0x7c')](_0x49fa22[_0x2e5f('0x7a')],qs[_0x2e5f('0x7e')](_0x43ae75[_0x2e5f('0x1d')][_0x2e5f('0x7e')]));_0x342196[_0x2e5f('0x7d')]=_0x342196[_0x2e5f('0x7d')]['length']?_0x342196[_0x2e5f('0x7d')]:_0x49fa22['model'];if(!_0x43ae75[_0x2e5f('0x1d')]['hasOwnProperty'](_0x2e5f('0x85'))){_0x342196['limit']=qs[_0x2e5f('0x11')](_0x43ae75[_0x2e5f('0x1d')][_0x2e5f('0x11')]);_0x342196[_0x2e5f('0x86')]=qs[_0x2e5f('0x86')](_0x43ae75[_0x2e5f('0x1d')][_0x2e5f('0x86')]);}_0x342196[_0x2e5f('0x7f')]=qs[_0x2e5f('0x80')](_0x43ae75[_0x2e5f('0x1d')][_0x2e5f('0x80')]);_0x342196[_0x2e5f('0x5b')]=qs[_0x2e5f('0x81')](_[_0x2e5f('0x9d')](_0x43ae75[_0x2e5f('0x1d')],_0x49fa22[_0x2e5f('0x81')]));_0x342196['where'][_0x2e5f('0x9e')]=_0x58f8c3['id'];if(_0x43ae75[_0x2e5f('0x1d')]['filter']){_0x342196[_0x2e5f('0x5b')]=_[_0x2e5f('0x83')](_0x342196[_0x2e5f('0x5b')],{'$or':_[_0x2e5f('0x6b')](_0x342196[_0x2e5f('0x7d')],function(_0x34f950){var _0x4b502f={};_0x4b502f[_0x34f950]={'$like':'%'+_0x43ae75[_0x2e5f('0x1d')][_0x2e5f('0x82')]+'%'};return _0x4b502f;})});}_0x342196=_[_0x2e5f('0x83')]({},_0x342196,_0x43ae75[_0x2e5f('0x84')]);return db[_0x2e5f('0x90')][_0x2e5f('0x12')]({'where':_0x342196['where']})['then'](function(_0x5683d4){_0x37f8e2[_0x2e5f('0x12')]=_0x5683d4;if(_0x43ae75[_0x2e5f('0x1d')][_0x2e5f('0x9f')]){_0x342196['include']=[{'all':!![]}];}return db[_0x2e5f('0x90')][_0x2e5f('0x1c')](_0x342196);})[_0x2e5f('0x14')](function(_0x5242e0){_0x37f8e2[_0x2e5f('0xa0')]=_0x5242e0;return _0x37f8e2;});}})['then'](respondWithFilteredResult(_0x23c1e4,_0x342196))[_0x2e5f('0x23')](handleError(_0x23c1e4,null));};exports[_0x2e5f('0xa1')]=function(_0x1b0c7c,_0x1263ee){var _0x42aa94={'raw':!![],'where':{}};var _0x310c87={};var _0x32d0a7={'count':0x0,'rows':[]};return db['CmContact'][_0x2e5f('0x79')]({'where':{'id':_0x1b0c7c[_0x2e5f('0x22')]['id']}})['then'](handleEntityNotFound(_0x1263ee,null))['then'](function(_0x7e8bfc){if(_0x7e8bfc){_0x310c87[_0x2e5f('0x7a')]=_[_0x2e5f('0x31')](db['CmHopperHistory'][_0x2e5f('0x7b')]);_0x310c87[_0x2e5f('0x1d')]=_[_0x2e5f('0x31')](_0x1b0c7c[_0x2e5f('0x1d')]);_0x310c87[_0x2e5f('0x81')]=_[_0x2e5f('0x7c')](_0x310c87[_0x2e5f('0x7a')],_0x310c87[_0x2e5f('0x1d')]);_0x42aa94[_0x2e5f('0x7d')]=_[_0x2e5f('0x7c')](_0x310c87['model'],qs['fields'](_0x1b0c7c['query']['fields']));_0x42aa94['attributes']=_0x42aa94[_0x2e5f('0x7d')][_0x2e5f('0x29')]?_0x42aa94[_0x2e5f('0x7d')]:_0x310c87[_0x2e5f('0x7a')];if(!_0x1b0c7c['query'][_0x2e5f('0x32')](_0x2e5f('0x85'))){_0x42aa94['limit']=qs['limit'](_0x1b0c7c['query']['limit']);_0x42aa94[_0x2e5f('0x86')]=qs[_0x2e5f('0x86')](_0x1b0c7c['query'][_0x2e5f('0x86')]);}_0x42aa94['order']=qs[_0x2e5f('0x80')](_0x1b0c7c[_0x2e5f('0x1d')][_0x2e5f('0x80')]);_0x42aa94[_0x2e5f('0x5b')]=qs[_0x2e5f('0x81')](_[_0x2e5f('0x9d')](_0x1b0c7c[_0x2e5f('0x1d')],_0x310c87[_0x2e5f('0x81')]));_0x42aa94[_0x2e5f('0x5b')][_0x2e5f('0x9e')]=_0x7e8bfc['id'];if(_0x1b0c7c['query'][_0x2e5f('0x82')]){_0x42aa94['where']=_['merge'](_0x42aa94['where'],{'$or':_[_0x2e5f('0x6b')](_0x42aa94[_0x2e5f('0x7d')],function(_0x28d848){var _0x4cfee3={};_0x4cfee3[_0x28d848]={'$like':'%'+_0x1b0c7c['query'][_0x2e5f('0x82')]+'%'};return _0x4cfee3;})});}_0x42aa94=_[_0x2e5f('0x83')]({},_0x42aa94,_0x1b0c7c[_0x2e5f('0x84')]);return db[_0x2e5f('0x48')][_0x2e5f('0x12')]({'where':_0x42aa94[_0x2e5f('0x5b')]})[_0x2e5f('0x14')](function(_0x50ea88){_0x32d0a7[_0x2e5f('0x12')]=_0x50ea88;if(_0x1b0c7c['query'][_0x2e5f('0x9f')]){_0x42aa94['include']=[{'all':!![]}];}return db[_0x2e5f('0x48')][_0x2e5f('0x1c')](_0x42aa94);})['then'](function(_0xf217a5){_0x32d0a7[_0x2e5f('0xa0')]=_0xf217a5;return _0x32d0a7;});}})['then'](respondWithFilteredResult(_0x1263ee,_0x42aa94))['catch'](handleError(_0x1263ee,null));};exports[_0x2e5f('0xa2')]=function(_0x13393c,_0x2bf8fa){var _0x35ae18={'raw':!![],'where':{}};var _0x3b6e2f={};var _0x272b85={'count':0x0,'rows':[]};return db[_0x2e5f('0x20')][_0x2e5f('0x79')]({'where':{'id':_0x13393c[_0x2e5f('0x22')]['id']}})[_0x2e5f('0x14')](handleEntityNotFound(_0x2bf8fa,null))[_0x2e5f('0x14')](function(_0x45deef){if(_0x45deef){_0x3b6e2f[_0x2e5f('0x7a')]=_[_0x2e5f('0x31')](db[_0x2e5f('0xa3')][_0x2e5f('0x7b')]);_0x3b6e2f[_0x2e5f('0x1d')]=_[_0x2e5f('0x31')](_0x13393c['query']);_0x3b6e2f[_0x2e5f('0x81')]=_[_0x2e5f('0x7c')](_0x3b6e2f[_0x2e5f('0x7a')],_0x3b6e2f[_0x2e5f('0x1d')]);_0x35ae18[_0x2e5f('0x7d')]=_[_0x2e5f('0x7c')](_0x3b6e2f['model'],qs['fields'](_0x13393c[_0x2e5f('0x1d')][_0x2e5f('0x7e')]));_0x35ae18['attributes']=_0x35ae18['attributes'][_0x2e5f('0x29')]?_0x35ae18[_0x2e5f('0x7d')]:_0x3b6e2f[_0x2e5f('0x7a')];if(!_0x13393c[_0x2e5f('0x1d')]['hasOwnProperty'](_0x2e5f('0x85'))){_0x35ae18[_0x2e5f('0x11')]=qs[_0x2e5f('0x11')](_0x13393c[_0x2e5f('0x1d')][_0x2e5f('0x11')]);_0x35ae18['offset']=qs['offset'](_0x13393c[_0x2e5f('0x1d')][_0x2e5f('0x86')]);}_0x35ae18[_0x2e5f('0x7f')]=qs[_0x2e5f('0x80')](_0x13393c[_0x2e5f('0x1d')][_0x2e5f('0x80')]);_0x35ae18[_0x2e5f('0x5b')]=qs[_0x2e5f('0x81')](_[_0x2e5f('0x9d')](_0x13393c[_0x2e5f('0x1d')],_0x3b6e2f[_0x2e5f('0x81')]));_0x35ae18[_0x2e5f('0x5b')]['ContactId']=_0x45deef['id'];if(_0x13393c[_0x2e5f('0x1d')][_0x2e5f('0x82')]){_0x35ae18[_0x2e5f('0x5b')]=_['merge'](_0x35ae18[_0x2e5f('0x5b')],{'$or':_[_0x2e5f('0x6b')](_0x35ae18[_0x2e5f('0x7d')],function(_0x212c2f){var _0x14c06b={};_0x14c06b[_0x212c2f]={'$like':'%'+_0x13393c[_0x2e5f('0x1d')]['filter']+'%'};return _0x14c06b;})});}_0x35ae18=_['merge']({},_0x35ae18,_0x13393c[_0x2e5f('0x84')]);return db['CmHopperFinal'][_0x2e5f('0x12')]({'where':_0x35ae18[_0x2e5f('0x5b')]})[_0x2e5f('0x14')](function(_0x47bdb1){_0x272b85[_0x2e5f('0x12')]=_0x47bdb1;if(_0x13393c[_0x2e5f('0x1d')][_0x2e5f('0x9f')]){_0x35ae18[_0x2e5f('0xa4')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x2e5f('0x1c')](_0x35ae18);})[_0x2e5f('0x14')](function(_0x276bd4){_0x272b85[_0x2e5f('0xa0')]=_0x276bd4;return _0x272b85;});}})[_0x2e5f('0x14')](respondWithFilteredResult(_0x2bf8fa,_0x35ae18))[_0x2e5f('0x23')](handleError(_0x2bf8fa,null));};exports[_0x2e5f('0xa5')]=function(_0x34e4c6,_0x2aad86){var _0xc5f13c={'raw':!![],'where':{}};var _0x27760d={};var _0x4e2d84={'count':0x0,'rows':[]};return db[_0x2e5f('0x20')][_0x2e5f('0x79')]({'where':{'id':_0x34e4c6[_0x2e5f('0x22')]['id']}})[_0x2e5f('0x14')](handleEntityNotFound(_0x2aad86,null))[_0x2e5f('0x14')](function(_0x1f4558){if(_0x1f4558){_0x27760d[_0x2e5f('0x7a')]=_[_0x2e5f('0x31')](db[_0x2e5f('0x50')][_0x2e5f('0x7b')]);_0x27760d[_0x2e5f('0x1d')]=_[_0x2e5f('0x31')](_0x34e4c6[_0x2e5f('0x1d')]);_0x27760d[_0x2e5f('0x81')]=_[_0x2e5f('0x7c')](_0x27760d[_0x2e5f('0x7a')],_0x27760d['query']);_0xc5f13c[_0x2e5f('0x7d')]=_[_0x2e5f('0x7c')](_0x27760d[_0x2e5f('0x7a')],qs['fields'](_0x34e4c6['query'][_0x2e5f('0x7e')]));_0xc5f13c[_0x2e5f('0x7d')]=_0xc5f13c[_0x2e5f('0x7d')][_0x2e5f('0x29')]?_0xc5f13c[_0x2e5f('0x7d')]:_0x27760d[_0x2e5f('0x7a')];if(!_0x34e4c6[_0x2e5f('0x1d')]['hasOwnProperty'](_0x2e5f('0x85'))){_0xc5f13c[_0x2e5f('0x11')]=qs[_0x2e5f('0x11')](_0x34e4c6[_0x2e5f('0x1d')][_0x2e5f('0x11')]);_0xc5f13c[_0x2e5f('0x86')]=qs[_0x2e5f('0x86')](_0x34e4c6[_0x2e5f('0x1d')][_0x2e5f('0x86')]);}_0xc5f13c[_0x2e5f('0x7f')]=qs[_0x2e5f('0x80')](_0x34e4c6['query']['sort']);_0xc5f13c['where']=qs[_0x2e5f('0x81')](_[_0x2e5f('0x9d')](_0x34e4c6[_0x2e5f('0x1d')],_0x27760d[_0x2e5f('0x81')]));_0xc5f13c[_0x2e5f('0x5b')][_0x2e5f('0x9e')]=_0x1f4558['id'];if(_0x34e4c6[_0x2e5f('0x1d')][_0x2e5f('0x82')]){_0xc5f13c[_0x2e5f('0x5b')]=_[_0x2e5f('0x83')](_0xc5f13c['where'],{'$or':_[_0x2e5f('0x6b')](_0xc5f13c[_0x2e5f('0x7d')],function(_0x565a62){var _0x515105={};_0x515105[_0x565a62]={'$like':'%'+_0x34e4c6[_0x2e5f('0x1d')][_0x2e5f('0x82')]+'%'};return _0x515105;})});}_0xc5f13c=_[_0x2e5f('0x83')]({},_0xc5f13c,_0x34e4c6[_0x2e5f('0x84')]);return db['JscriptySessionReport']['count']({'where':_0xc5f13c['where']})[_0x2e5f('0x14')](function(_0x1ed3bf){_0x4e2d84['count']=_0x1ed3bf;if(_0x34e4c6[_0x2e5f('0x1d')][_0x2e5f('0x9f')]){_0xc5f13c[_0x2e5f('0xa4')]=[{'all':!![]}];}return db[_0x2e5f('0x50')][_0x2e5f('0x1c')](_0xc5f13c);})[_0x2e5f('0x14')](function(_0x40abd3){_0x4e2d84[_0x2e5f('0xa0')]=_0x40abd3;return _0x4e2d84;});}})[_0x2e5f('0x14')](respondWithFilteredResult(_0x2aad86,_0xc5f13c))[_0x2e5f('0x23')](handleError(_0x2aad86,null));};exports[_0x2e5f('0xa6')]=function(_0x87d8fa,_0x32266d){try{if(!_0x87d8fa[_0x2e5f('0x33')][_0x2e5f('0x5d')]){throw new Error(_0x2e5f('0xa7'));}if(!_0x87d8fa['body'][_0x2e5f('0xa8')]){throw new Error(_0x2e5f('0xa9'));}if(!_0x87d8fa['body'][_0x2e5f('0xaa')]){throw new Error(_0x2e5f('0xab'));}if(!_0x87d8fa[_0x2e5f('0x33')]['socket_timestamp']){throw new Error(_0x2e5f('0xac'));}var _0x7fab2c=_0x87d8fa[_0x2e5f('0x33')][_0x2e5f('0xa8')][_0x2e5f('0xad')](',');var _0x174aff=_0x87d8fa[_0x2e5f('0x33')][_0x2e5f('0xaa')]['split'](',');if(!_0x7fab2c[_0x2e5f('0x29')]||!_0x174aff['length']||_0x7fab2c[_0x2e5f('0x29')]!==_0x174aff[_0x2e5f('0x29')]){throw new Error(_0x2e5f('0xae'));}_0x87d8fa[_0x2e5f('0x33')][_0x2e5f('0x7e')]=_[_0x2e5f('0xaf')](_0x7fab2c,_0x174aff);if(!_0x87d8fa[_0x2e5f('0x33')]['fields'][_0x2e5f('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x87d8fa['body'][_0x2e5f('0x7e')][_0x2e5f('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x505857=path[_0x2e5f('0x39')](config[_0x2e5f('0xb1')],_0x2e5f('0xb2'),_0x87d8fa[_0x2e5f('0xb3')][_0x2e5f('0xb4')]);fs['chmodSync'](_0x505857,parseInt(_0x2e5f('0xb5'),0x8));var _0x5d3cb7=require(_0x2e5f('0xb6'))[_0x2e5f('0xb7')](path[_0x2e5f('0x39')](__dirname,_0x2e5f('0xb8')),[_0x505857,_0x87d8fa[_0x2e5f('0x33')][_0x2e5f('0xa8')],_0x87d8fa[_0x2e5f('0x33')][_0x2e5f('0xaa')],_0x87d8fa[_0x2e5f('0x33')][_0x2e5f('0x5d')],_0x87d8fa['body']['CompanyId'],_0x87d8fa[_0x2e5f('0x33')]['duplicates'],_0x87d8fa[_0x2e5f('0x33')][_0x2e5f('0xb9')]]);return _0x32266d['status'](0xc8)[_0x2e5f('0xba')]({'message':'File\x20uploaded\x20correctly!','pid':_0x5d3cb7[_0x2e5f('0xbb')]});}catch(_0x550ba4){return _0x32266d[_0x2e5f('0xf')](0x1f4)['send'](_0x550ba4);}};exports[_0x2e5f('0xbc')]=function(_0x278654,_0x151029){var _0x4d8d86=fs[_0x2e5f('0xbd')](_0x278654['file'][_0x2e5f('0xbe')]);Papa[_0x2e5f('0xbf')](_0x4d8d86,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x83bbd6){return _0x151029['status'](0xc8)[_0x2e5f('0xba')]({'file':_0x278654[_0x2e5f('0xb3')],'fields':_0x83bbd6[_0x2e5f('0xc0')]['fields']});}});};exports['import']=function(_0x48153f,_0x215640){return db[_0x2e5f('0xc1')][_0x2e5f('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':_0x2e5f('0xc2')}})[_0x2e5f('0x14')](function(_0x24c0ff){var _0x41a8d5=![];if(!_0x48153f['body'][_0x2e5f('0x5d')]){throw new Error(_0x2e5f('0xa7'));}if(!_0x48153f[_0x2e5f('0x33')]['binding']['phone']){throw new Error(_0x2e5f('0xc3'));}if(!_0x48153f[_0x2e5f('0x33')][_0x2e5f('0xc4')]['firstName']){throw new Error(_0x2e5f('0xc5'));}if(!_0x48153f[_0x2e5f('0x33')][_0x2e5f('0xb9')]){throw new Error(_0x2e5f('0xac'));}var _0x1ec52c=require(_0x2e5f('0xb6'))['fork'](path['join'](__dirname,_0x2e5f('0xc6')),[_0x48153f['params']['id'],JSON[_0x2e5f('0xc7')](_0x48153f[_0x2e5f('0x33')]),JSON[_0x2e5f('0xc7')](_0x24c0ff)]);_0x1ec52c['on'](_0x2e5f('0xc8'),function(){_0x41a8d5=!![];return _0x215640[_0x2e5f('0xf')](0xc8)[_0x2e5f('0xba')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1ec52c['pid']});});_0x1ec52c['on'](_0x2e5f('0xc9'),function(_0xf07070){if(_0xf07070&&!_0x41a8d5){return _0x215640[_0x2e5f('0xf')](0x1f4)[_0x2e5f('0xba')]({'message':'error\x20child\x20process','pid':_0x1ec52c[_0x2e5f('0xbb')]});}});})['catch'](handleError(_0x215640,null));};exports[_0x2e5f('0xca')]=function(_0x39c825,_0x44ab0c){return db[_0x2e5f('0xc1')][_0x2e5f('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':_0x2e5f('0xc2')}})['then'](function(_0x5466b7){var _0x6bcb7d=![];if(!_0x39c825[_0x2e5f('0x33')][_0x2e5f('0x5d')]){throw new Error(_0x2e5f('0xa7'));}if(!_0x39c825[_0x2e5f('0x33')]['binding']['phone']){throw new Error(_0x2e5f('0xc3'));}if(!_0x39c825[_0x2e5f('0x33')]['binding'][_0x2e5f('0xb0')]){throw new Error(_0x2e5f('0xc5'));}if(!_0x39c825[_0x2e5f('0x33')][_0x2e5f('0xb9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2bf851=require(_0x2e5f('0xb6'))['fork'](path[_0x2e5f('0x39')](__dirname,_0x2e5f('0xcb')),[_0x39c825[_0x2e5f('0x22')]['id'],JSON[_0x2e5f('0xc7')](_0x39c825[_0x2e5f('0x33')]),JSON[_0x2e5f('0xc7')](_0x5466b7)]);_0x2bf851['on']('message',function(){_0x6bcb7d=!![];return _0x44ab0c[_0x2e5f('0xf')](0xc8)[_0x2e5f('0xba')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x2bf851[_0x2e5f('0xbb')]});});_0x2bf851['on'](_0x2e5f('0xc9'),function(_0x4de9d2){if(_0x4de9d2&&!_0x6bcb7d){return _0x44ab0c[_0x2e5f('0xf')](0x1f4)[_0x2e5f('0xba')]({'message':'error\x20child\x20process','pid':_0x2bf851['pid']});}});})[_0x2e5f('0x23')](handleError(_0x44ab0c,null));};exports[_0x2e5f('0xcc')]=function(_0x18ba5f,_0x2dafbc){var _0xc917c=[_0x2e5f('0xcd'),_0x2e5f('0xce'),_0x2e5f('0xcf'),_0x2e5f('0xd0'),_0x2e5f('0xd1'),_0x2e5f('0xd2'),'voice'];var _0xc79ce3={'offset':0x0,'order':qs[_0x2e5f('0x80')](_0x2e5f('0xd3'))},_0x44be17={'count':0x0,'rows':[]};Promise[_0x2e5f('0xd4')]()[_0x2e5f('0x14')](function(){if(_0x18ba5f['query']['channel']){if(!_['includes'](_0xc917c,_0x18ba5f[_0x2e5f('0x1d')][_0x2e5f('0xd5')][_0x2e5f('0xd6')]())){throw new Error(_0x2e5f('0xd7'));}_0xc917c=[_0x18ba5f[_0x2e5f('0x1d')][_0x2e5f('0xd5')][_0x2e5f('0xd6')]()];}if(_0x18ba5f[_0x2e5f('0x1d')][_0x2e5f('0xd8')]){try{var _0x1c4873=JSON[_0x2e5f('0xbf')](_0x18ba5f[_0x2e5f('0x1d')][_0x2e5f('0xd8')]);if(!moment(_0x1c4873[_0x2e5f('0x34')])[_0x2e5f('0xd9')]()){throw new Error(_0x2e5f('0xda'));}if(!moment(_0x1c4873['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x2fc1b5){throw new Error(_0x2e5f('0xdb'));}}if(!_0x18ba5f[_0x2e5f('0x1d')][_0x2e5f('0x32')](_0x2e5f('0x85'))){_0xc79ce3['limit']=qs[_0x2e5f('0x11')](_0x18ba5f['query'][_0x2e5f('0x11')]||0xa);_0xc79ce3[_0x2e5f('0x86')]=qs['offset'](_0x18ba5f[_0x2e5f('0x1d')][_0x2e5f('0x86')]);}var _0x3e8856=_0xc917c[_0x2e5f('0x6b')](function(_0x354ce8){if(_0x354ce8===_0x2e5f('0xdc')){var _0x311124={'attributes':['id','uniqueid',_0x2e5f('0x2d'),_0x2e5f('0xdd'),_0x2e5f('0xde'),_0x2e5f('0xdf'),_0x2e5f('0xe0'),'endtime',_0x2e5f('0xe1'),_0x2e5f('0xe2'),'createdAt',_0x2e5f('0xe3'),_0x2e5f('0xe4'),'userThirdDisposition',_0x2e5f('0xe5')],'where':{'ContactId':_0x18ba5f[_0x2e5f('0x22')]['id']},'include':[{'model':db[_0x2e5f('0xc1')],'as':_0x2e5f('0xc1'),'attributes':['id',_0x2e5f('0x18'),'fullname',_0x2e5f('0x2b')]}],'order':[[_0x2e5f('0xe6'),'DESC']]};if(_0x18ba5f[_0x2e5f('0x1d')][_0x2e5f('0xd8')]){_0x311124[_0x2e5f('0x5b')]['createdAt']={'$gte':_0x1c4873['from'],'$lte':_0x1c4873['to']};}return db['VoiceCallReport'][_0x2e5f('0xe7')](_0x311124)[_0x2e5f('0x14')](function(_0x732259){_0x44be17[_0x2e5f('0x12')]+=_0x732259[_0x2e5f('0x12')];return _[_0x2e5f('0x6b')](_0x732259[_0x2e5f('0xa0')],function(_0x545dea){var _0x4cb946=_0x545dea[_0x2e5f('0x35')]({'plain':!![]});_0x4cb946[_0x2e5f('0xd5')]=_0x354ce8;if(_0x4cb946['User']){_0x4cb946[_0x2e5f('0xc1')]={'id':_0x4cb946[_0x2e5f('0xc1')]['id'],'name':_0x4cb946[_0x2e5f('0xc1')][_0x2e5f('0x18')],'fullname':_0x4cb946[_0x2e5f('0xc1')]['fullname'],'alias':_0x4cb946['User'][_0x2e5f('0x2b')]};}return _0x4cb946;});});}else{var _0x5ed8d7=_[_0x2e5f('0xe8')](_0x354ce8)+(_0x354ce8===_0x2e5f('0xce')?_0x2e5f('0xe9'):_0x2e5f('0xea'));var _0x27eaf8={'attributes':['id',_0x2e5f('0xeb'),'closedAt',_0x2e5f('0xe6'),_0x2e5f('0xe2'),_0x2e5f('0xec'),'secondDisposition',_0x2e5f('0xed'),'UserId',_0x5ed8d7+'Id'],'where':{'ContactId':_0x18ba5f[_0x2e5f('0x22')]['id']},'include':[{'model':db[_0x5ed8d7],'as':_0x2e5f('0xea'),'attributes':['id','name',_0x2e5f('0xee')]},{'model':db[_0x2e5f('0xc1')],'as':_0x2e5f('0xef'),'attributes':['id',_0x2e5f('0x18'),_0x2e5f('0xf0')]},{'model':db[_0x2e5f('0x63')],'as':_0x2e5f('0x64'),'attributes':['id',_0x2e5f('0x18'),_0x2e5f('0xf1')],'through':{'attributes':[]}}],'order':[[_0x2e5f('0xe6'),_0x2e5f('0xf2')]]};if(_0x18ba5f['query'][_0x2e5f('0xd8')]){_0x27eaf8[_0x2e5f('0x5b')][_0x2e5f('0xe6')]={'$gte':_0x1c4873[_0x2e5f('0x34')],'$lte':_0x1c4873['to']};}switch(_0x354ce8){case'chat':_0x27eaf8[_0x2e5f('0x7d')]['push'](_0x2e5f('0xf3'),'customerIp',_0x2e5f('0xf4'),_0x2e5f('0xf5'),_0x2e5f('0xf6'),_0x2e5f('0xf7'),_0x2e5f('0xf8'),'ratingValue',_0x2e5f('0xf9'));break;case'mail':_0x27eaf8[_0x2e5f('0x7d')][_0x2e5f('0x5f')]('subject',_0x2e5f('0xfa'));break;case _0x2e5f('0xd0'):_0x27eaf8[_0x2e5f('0x7d')][_0x2e5f('0x5f')]('externalUrl','threadId');break;}return db[_[_0x2e5f('0xe8')](_0x354ce8)+_0x2e5f('0xfb')][_0x2e5f('0xe7')](_0x27eaf8)[_0x2e5f('0x14')](function(_0x3e806a){_0x44be17[_0x2e5f('0x12')]+=_0x3e806a['count'];return _[_0x2e5f('0x6b')](_0x3e806a[_0x2e5f('0xa0')],function(_0x106685){var _0x3a7887=_0x106685[_0x2e5f('0x35')]({'plain':!![]});_0x3a7887[_0x2e5f('0xd5')]=_0x354ce8;if(_0x3a7887[_0x2e5f('0xef')]){_0x3a7887['Owner']={'id':_0x3a7887[_0x2e5f('0xef')]['id'],'name':_0x3a7887[_0x2e5f('0xef')][_0x2e5f('0x18')],'fullname':_0x3a7887[_0x2e5f('0xef')]['fullname']};}return _0x3a7887;});});}});return Promise[_0x2e5f('0x61')](_0x3e8856);})[_0x2e5f('0x14')](function(_0x36dc04){return _(_0x36dc04)[_0x2e5f('0xfc')]()[_0x2e5f('0xfd')]('createdAt')[_0x2e5f('0xfe')]()[_0x2e5f('0xff')]();})[_0x2e5f('0x14')](function(_0x381cfa){_0x44be17[_0x2e5f('0xa0')]=_0xc79ce3[_0x2e5f('0x11')]?_0x381cfa['slice'](_0xc79ce3[_0x2e5f('0x86')],_0xc79ce3['offset']+_0xc79ce3[_0x2e5f('0x11')]):_0x381cfa;return _0x44be17;})['then'](respondWithFilteredResult(_0x2dafbc,_0xc79ce3))[_0x2e5f('0x23')](handleError(_0x2dafbc,null));};
\ No newline at end of file