Built motion from commit d158d3d63.|1.0.25
[motion.git] / server / api / contact_manager / contact_manager.controller.js
1 var _0x19b5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x43\x6F\x6E\x74\x61\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x43\x6F\x6E\x74\x61\x63\x74\x50\x68\x6F\x6E\x65","\x43\x6F\x6E\x74\x61\x63\x74\x45\x6D\x61\x69\x6C","\x43\x75\x73\x74\x6F\x6D\x46\x69\x65\x6C\x64","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D\x48\x69\x73\x74\x6F\x72\x79","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x46\x61\x78\x52\x6F\x6F\x6D","\x53\x6D\x73\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x4C\x69\x73\x74","\x43\x6F\x6D\x70\x61\x6E\x79","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C\x48\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x54\x61\x67","\x54\x64\x55\x70\x64\x61\x74\x65","\x73\x74\x72\x65\x61\x6D","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x62\x6C\x75\x65\x62\x69\x72\x64","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x72\x65\x73\x6F\x6C\x76\x65","\x65\x78\x74\x72\x61\x63\x74\x41\x6C\x6C","\x69\x64","\x66\x69\x72\x73\x74\x4E\x61\x6D\x65","\x46\x69\x72\x73\x74\x20\x4E\x61\x6D\x65","\x6C\x61\x73\x74\x4E\x61\x6D\x65","\x4C\x61\x73\x74\x20\x4E\x61\x6D\x65","\x74\x61\x67\x73","\x54\x61\x67\x73","\x73\x74\x72\x65\x65\x74","\x53\x74\x72\x65\x65\x74","\x70\x6F\x73\x74\x61\x6C\x43\x6F\x64\x65","\x50\x6F\x73\x74\x61\x6C\x20\x43\x6F\x64\x65","\x63\x69\x74\x79","\x43\x69\x74\x79","\x63\x6F\x75\x6E\x74\x72\x79","\x43\x6F\x75\x6E\x74\x72\x79","\x64\x61\x74\x65\x4F\x66\x42\x69\x72\x74\x68","\x44\x61\x74\x65\x20\x6F\x66\x20\x62\x69\x72\x74\x68","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x70\x68\x6F\x6E\x65","\x50\x68\x6F\x6E\x65","\x6D\x6F\x62\x69\x6C\x65","\x4D\x6F\x62\x69\x6C\x65","\x66\x61\x78","\x46\x61\x78","\x65\x6D\x61\x69\x6C","\x45\x6D\x61\x69\x6C","\x75\x72\x6C","\x55\x52\x4C","\x43\x6F\x6D\x70\x61\x6E\x79\x49\x64","\x4C\x69\x73\x74\x49\x64","\x72\x6F\x77\x73","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64","\x6E\x61\x6D\x65","","\x66\x6F\x72\x45\x61\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x2C","\x6A\x6F\x69\x6E","\x20\x61\x73\x20\x27","\x61\x6C\x69\x61\x73","\x27","\x6D\x61\x70","\x53\x45\x4C\x45\x43\x54\x20\x69\x64\x2C\x25\x73\x20\x46\x52\x4F\x4D\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x20\x49\x4E\x20\x28\x27","\x27\x2C\x27","\x27\x29\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20\x25\x73","\x6F\x72\x64\x65\x72","\x71\x75\x65\x72\x79","\x69\x64\x20\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x6B\x65\x79\x73","\x63\x66\x5F","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x66\x69\x6C\x74\x65\x72","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x64\x65\x73\x63\x72\x69\x62\x65","\x63\x6F\x6E\x63\x61\x74","\x6D\x65\x72\x67\x65\x63\x6F\x6E\x74\x61\x63\x74","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x6C\x69\x73\x74","\x63\x6F\x6D\x70\x61\x6E\x79","\x63\x6F\x6D\x70\x61\x6E\x79\x5F\x6C\x69\x73\x74\x5F\x66\x69\x6C\x74\x65\x72","\x73\x63\x6F\x70\x65","\x67\x65\x74\x4C\x69\x73\x74\x73","\x75\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x67\x65\x6E\x74","\x63\x6F\x75\x6E\x74","\x72\x6F\x6C\x65","\x67\x65\x74\x4C\x6F\x67","\x64\x65\x74\x61\x69\x6C","\x67\x65\x6E\x65\x72\x61\x6C","\x73\x68\x6F\x77","\x6C\x6F\x67\x54\x79\x70\x65","\x6A\x6F\x75\x72\x6E\x61\x6C","\x74\x79\x70\x65","\x69\x6E\x62\x6F\x75\x6E\x64","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x64\x65\x73\x74\x69\x6E\x61\x74\x69\x6F\x6E","\x73\x6F\x75\x72\x63\x65","\x66\x72\x6F\x6D","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x64\x61\x79","\x73\x74\x61\x72\x74\x4F\x66","\x63\x6F\x6E\x74\x61\x63\x74","\x63\x68\x61\x74","\x73\x6D\x73","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x71\x75\x65\x75\x65","\x70\x61\x72\x61\x6D\x73","\x6E\x75\x6C\x6C","\x53\x45\x4C\x45\x43\x54\x20\x25\x73\x20\x46\x52\x4F\x4D\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3D\x25\x73","\x67\x65\x74\x43\x6F\x6E\x74\x61\x63\x74\x73","\x73\x75\x62\x74\x79\x70\x65\x43\x68\x61\x6E\x6E\x65\x6C","\x62\x6F\x64\x79","\x64\x65\x73\x74\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x76\x6F\x69\x63\x65","\x6D\x61\x69\x6C","\x65\x76\x65\x6E\x74\x43\x68\x61\x6E\x6E\x65\x6C","\x63\x72\x65\x61\x74\x65\x43\x6F\x6E\x74\x61\x63\x74","\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x63\x6F\x6E\x74\x61\x63\x74\x20\x61\x75\x74\x6F\x20\x63\x72\x65\x61\x74\x69\x6F\x6E","\x65\x72\x72\x6F\x72","\x70\x75\x73\x68","\x67\x65\x74","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\x66\x69\x6E\x64\x4F\x6E\x65","\x4E\x61\x6D\x65\x20\x6F\x72\x20\x4C\x69\x73\x74\x49\x64\x20\x6D\x69\x73\x73\x69\x6E\x67\x20\x6F\x72\x20\x69\x6E\x76\x61\x6C\x69\x64\x21","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x55\x73\x65\x72\x49\x64","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x3B","\x3B\x27","\x69\x73\x53\x74\x72\x69\x6E\x67","\x66\x6F\x72\x4F\x77\x6E","\x69\x6E\x73\x65\x72\x74\x49\x64","\x49\x4E\x53\x45\x52\x54\x20\x49\x4E\x54\x4F\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x28\x25\x73\x29\x20\x56\x41\x4C\x55\x45\x53\x20\x28\x25\x73\x29","\x63\x6F\x70\x79","\x25\x73\x3D\x27\x25\x73\x27","\x55\x50\x44\x41\x54\x45\x20\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73\x20\x53\x45\x54\x20\x25\x73\x20\x57\x48\x45\x52\x45\x20\x69\x64\x3D\x25\x73","\x63\x6C\x6F\x6E\x65","\x73\x70\x6C\x69\x74","\x70\x6F\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x6C\x6C","\x63\x6F\x6E\x74\x61\x63\x74\x73","\x75\x6E\x69\x6F\x6E","\x73\x74\x61\x63\x6B","\x64\x65\x62\x75\x67","\x6B\x6F","\x66\x61\x69\x6C\x65\x64","\x6F\x6B","\x66\x6F\x72\x45\x61\x63\x68\x4F\x66","\x75\x70\x64\x61\x74\x65","\x6F\x6C\x64\x43\x6F\x6E\x74\x61\x63\x74","\x64\x65\x73\x74\x72\x6F\x79","\x63\x6F\x6E\x74\x61\x63\x74\x2F\x75\x70\x64\x61\x74\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x63\x6F\x6E\x74\x61\x63\x74\x2F\x64\x65\x6C\x65\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x19b5[0];var _=require(_0x19b5[1]);var moment=require(_0x19b5[2]);var Contact=require(_0x19b5[4])[_0x19b5[3]];var User=require(_0x19b5[4])[_0x19b5[5]];var ContactPhone=require(_0x19b5[4])[_0x19b5[6]];var ContactEmail=require(_0x19b5[4])[_0x19b5[7]];var CustomField=require(_0x19b5[4])[_0x19b5[8]];var ReportCall=require(_0x19b5[4])[_0x19b5[9]];var ReportQueue=require(_0x19b5[4])[_0x19b5[10]];var ReportQueueHistory=require(_0x19b5[4])[_0x19b5[12]][_0x19b5[11]];var ReportChatRoom=require(_0x19b5[4])[_0x19b5[13]];var ReportChatRoomHistory=require(_0x19b5[4])[_0x19b5[12]][_0x19b5[14]];var ChatRoom=require(_0x19b5[4])[_0x19b5[15]];var FaxRoom=require(_0x19b5[4])[_0x19b5[16]];var SmsRoom=require(_0x19b5[4])[_0x19b5[17]];var ReportIntegration=require(_0x19b5[4])[_0x19b5[18]];var List=require(_0x19b5[4])[_0x19b5[19]];var Company=require(_0x19b5[4])[_0x19b5[20]];var ReportCallHistory=require(_0x19b5[4])[_0x19b5[12]][_0x19b5[21]];var ReportMailSession=require(_0x19b5[4])[_0x19b5[22]];var MailRoom=require(_0x19b5[4])[_0x19b5[23]];var ReportMailSessionHistory=require(_0x19b5[4])[_0x19b5[12]][_0x19b5[24]];var Tag=require(_0x19b5[4])[_0x19b5[25]];var TdUpdate=require(_0x19b5[4])[_0x19b5[26]];var stream=require(_0x19b5[27]);var sequelize=require(_0x19b5[4])[_0x19b5[28]];var util=require(_0x19b5[29]);var Util=require(_0x19b5[30]);var Async=require(_0x19b5[31]);var Promise=require(_0x19b5[32]);var logger=require(_0x19b5[34])(_0x19b5[33]);exports[_0x19b5[35]]= function(_0xac2fx20,_0xac2fx21,_0xac2fx22){return Promise[_0x19b5[40]]()[_0x19b5[39]](getContacts(_0xac2fx20))[_0x19b5[39]](function(_0xac2fx24){_0xac2fx21[_0x19b5[38]](200)[_0x19b5[37]](_0xac2fx24)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};exports[_0x19b5[41]]= function(_0xac2fx20,_0xac2fx21,_0xac2fx22){var _0xac2fx25=[_0x19b5[42],[_0x19b5[43],_0x19b5[44]],[_0x19b5[45],_0x19b5[46]],[_0x19b5[47],_0x19b5[48]],[_0x19b5[49],_0x19b5[50]],[_0x19b5[51],_0x19b5[52]],[_0x19b5[53],_0x19b5[54]],[_0x19b5[55],_0x19b5[56]],[_0x19b5[57],_0x19b5[58]],[_0x19b5[59],_0x19b5[60]],[_0x19b5[61],_0x19b5[62]],[_0x19b5[63],_0x19b5[64]],[_0x19b5[65],_0x19b5[66]],[_0x19b5[67],_0x19b5[68]],[_0x19b5[69],_0x19b5[70]],_0x19b5[71],_0x19b5[72]];return Promise[_0x19b5[40]]()[_0x19b5[39]](getContacts(_0xac2fx20,_0xac2fx25))[_0x19b5[39]](function(_0xac2fx24){_0xac2fx21[_0x19b5[38]](200)[_0x19b5[37]](_0xac2fx24)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};function getContacts(_0xac2fx20,_0xac2fx25){return function(){var _0xac2fx27,_0xac2fx28,_0xac2fx29,_0xac2fx2a=[],_0xac2fx2b=[];switch(_0xac2fx20[_0x19b5[113]][_0x19b5[117]]){case _0x19b5[115]:return User[_0x19b5[114]](_0xac2fx20[_0x19b5[113]][_0x19b5[42]])[_0x19b5[39]](function(_0xac2fx3b){return _0xac2fx3b[_0x19b5[112]]()})[_0x19b5[39]](function(_0xac2fx2b){_0xac2fx28= _[_0x19b5[85]](_0xac2fx2b,_0x19b5[42]);return Company[_0x19b5[101]]({attributes:[_0x19b5[42],_0x19b5[76]],raw:true})})[_0x19b5[39]](function(_0xac2fx3a){_0xac2fx2a= _0xac2fx3a;return List[_0x19b5[101]]({attributes:[_0x19b5[42],_0x19b5[76]],raw:true})})[_0x19b5[39]](function(_0xac2fx38){_0xac2fx2b= _0xac2fx38;_0xac2fx29= {CompanyId:_0xac2fx20[_0x19b5[90]][_0x19b5[71]]|| null,ListId:_0xac2fx20[_0x19b5[90]][_0x19b5[72]]|| null};delete _0xac2fx20[_0x19b5[90]][_0x19b5[71]];delete _0xac2fx20[_0x19b5[90]][_0x19b5[72]];var _0xac2fx39=_0xac2fx29[_0x19b5[72]]?{}:{ListId:{$in:_0xac2fx28[_0x19b5[104]](_[_0x19b5[85]](_[_0x19b5[98]](_0xac2fx2b,{defaultEntry:true}),_0x19b5[42]))}};if(_0xac2fx20[_0x19b5[90]][_0x19b5[105]]){_0xac2fx39[_0x19b5[42]]= {$ne:_0xac2fx20[_0x19b5[90]][_0x19b5[105]]};delete _0xac2fx20[_0x19b5[90]][_0x19b5[105]]};return Contact[_0x19b5[111]](_0x19b5[108],_0x19b5[109],{method:[_0x19b5[110],_0xac2fx29]})[_0x19b5[107]](Util[_0x19b5[106]](_0xac2fx20[_0x19b5[90]],_0xac2fx39,{attributes:_0xac2fx25,order:_0xac2fx20[_0x19b5[90]][_0x19b5[89]]|| _0x19b5[91]}))})[_0x19b5[39]](function(_0xac2fx37){_0xac2fx27= {rows:_[_0x19b5[85]](_0xac2fx37[_0x19b5[73]],_0x19b5[102]),count:_0xac2fx37[_0x19b5[73]]};return Contact[_0x19b5[103]]()})[_0x19b5[39]](function(_0xac2fx34){_0xac2fx34= _[_0x19b5[98]](_[_0x19b5[95]](_0xac2fx34),function(_0xac2fx35){return _[_0x19b5[97]](_0xac2fx35,_0x19b5[96])});var _0xac2fx36={where:{name:_0xac2fx34}};_0xac2fx29[_0x19b5[72]]&& (_0xac2fx36[_0x19b5[100]][_0x19b5[99]]= [{ListId:_0xac2fx29[_0x19b5[72]]},{ListId:null}]);return CustomField[_0x19b5[101]](_0xac2fx36)})[_0x19b5[39]](function(_0xac2fx31){if(_0xac2fx31[_0x19b5[79]]){var _0xac2fx32=_[_0x19b5[85]](_0xac2fx31,function(_0xac2fx33){return _0xac2fx33[_0x19b5[76]]+ _0x19b5[82]+ _0xac2fx33[_0x19b5[83]]+ _0x19b5[84]})[_0x19b5[81]](_0x19b5[80]);return sequelize[_0x19b5[90]](util[_0x19b5[92]](_0x19b5[86]+ _[_0x19b5[85]](_0xac2fx27[_0x19b5[73]],_0x19b5[42])[_0x19b5[81]](_0x19b5[87])+ _0x19b5[88],_0xac2fx32,_0xac2fx20[_0x19b5[90]][_0x19b5[89]]|| _0x19b5[91]),{type:sequelize[_0x19b5[94]][_0x19b5[93]]})}})[_0x19b5[39]](function(_0xac2fx2c){var _0xac2fx2d,_0xac2fx2e;_[_0x19b5[78]](_0xac2fx27[_0x19b5[73]],function(_0xac2fx2f,_0xac2fx30){_0xac2fx2c&& _[_0x19b5[74]](_0xac2fx2f,_0xac2fx2c[_0xac2fx30]);_0xac2fx2d= _[_0x19b5[75]](_0xac2fx2a,{id:_0xac2fx2f[_0x19b5[71]]});_0xac2fx2f[_0x19b5[20]]= _0xac2fx2d?_0xac2fx2d[_0x19b5[76]]:_0x19b5[77];_0xac2fx2e= _[_0x19b5[75]](_0xac2fx2b,{id:_0xac2fx2f[_0x19b5[72]]});_0xac2fx2f[_0x19b5[19]]= _0xac2fx2e?_0xac2fx2e[_0x19b5[76]]:_0x19b5[77];if(_0xac2fx25){delete _0xac2fx2f[_0x19b5[42]];delete _0xac2fx2f[_0x19b5[71]];delete _0xac2fx2f[_0x19b5[72]]}});return _0xac2fx27});default:_0xac2fx29= {CompanyId:_0xac2fx20[_0x19b5[90]][_0x19b5[71]]|| null,ListId:_0xac2fx20[_0x19b5[90]][_0x19b5[72]]|| null};delete _0xac2fx20[_0x19b5[90]][_0x19b5[71]];delete _0xac2fx20[_0x19b5[90]][_0x19b5[72]];var _0xac2fx39={};if(_0xac2fx20[_0x19b5[90]][_0x19b5[105]]){_0xac2fx39[_0x19b5[42]]= {$ne:_0xac2fx20[_0x19b5[90]][_0x19b5[105]]};delete _0xac2fx20[_0x19b5[90]][_0x19b5[105]]};return Company[_0x19b5[101]]({attributes:[_0x19b5[42],_0x19b5[76]],raw:true})[_0x19b5[39]](function(_0xac2fx3a){_0xac2fx2a= _0xac2fx3a;return List[_0x19b5[101]]({attributes:[_0x19b5[42],_0x19b5[76]],raw:true})})[_0x19b5[39]](function(_0xac2fx38){_0xac2fx2b= _0xac2fx38;return Contact[_0x19b5[111]]({method:[_0x19b5[110],_0xac2fx29]})[_0x19b5[107]](Util[_0x19b5[106]](_0xac2fx20[_0x19b5[90]],_0xac2fx39,{attributes:_0xac2fx25,order:_0xac2fx20[_0x19b5[90]][_0x19b5[89]]|| _0x19b5[91]}))})[_0x19b5[39]](function(_0xac2fx37){_0xac2fx27= {rows:_[_0x19b5[85]](_0xac2fx37[_0x19b5[73]],_0x19b5[102]),count:_0xac2fx37[_0x19b5[116]]};return Contact[_0x19b5[103]]()})[_0x19b5[39]](function(_0xac2fx34){_0xac2fx34= _[_0x19b5[98]](_[_0x19b5[95]](_0xac2fx34),function(_0xac2fx35){return _[_0x19b5[97]](_0xac2fx35,_0x19b5[96])});var _0xac2fx36={where:{name:_0xac2fx34}};_0xac2fx29[_0x19b5[72]]&& (_0xac2fx36[_0x19b5[100]][_0x19b5[99]]= [{ListId:_0xac2fx29[_0x19b5[72]]},{ListId:null}]);return CustomField[_0x19b5[101]](_0xac2fx36)})[_0x19b5[39]](function(_0xac2fx31){if(_0xac2fx27[_0x19b5[73]][_0x19b5[79]]&& _0xac2fx31[_0x19b5[79]]){var _0xac2fx32=_[_0x19b5[85]](_0xac2fx31,function(_0xac2fx33){return _0xac2fx33[_0x19b5[76]]+ _0x19b5[82]+ _0xac2fx33[_0x19b5[83]]+ _0x19b5[84]})[_0x19b5[81]](_0x19b5[80]);return sequelize[_0x19b5[90]](util[_0x19b5[92]](_0x19b5[86]+ _[_0x19b5[85]](_0xac2fx27[_0x19b5[73]],_0x19b5[42])[_0x19b5[81]](_0x19b5[87])+ _0x19b5[88],_0xac2fx32,_0xac2fx20[_0x19b5[90]][_0x19b5[89]]|| _0x19b5[91]),{type:sequelize[_0x19b5[94]][_0x19b5[93]]})}})[_0x19b5[39]](function(_0xac2fx2c){var _0xac2fx2d,_0xac2fx2e;_[_0x19b5[78]](_0xac2fx27[_0x19b5[73]],function(_0xac2fx2f,_0xac2fx30){_0xac2fx2c&& _[_0x19b5[74]](_0xac2fx2f,_0xac2fx2c[_0xac2fx30]);_0xac2fx2d= _[_0x19b5[75]](_0xac2fx2a,{id:_0xac2fx2f[_0x19b5[71]]});_0xac2fx2f[_0x19b5[20]]= _0xac2fx2d?_0xac2fx2d[_0x19b5[76]]:_0x19b5[77];_0xac2fx2e= _[_0x19b5[75]](_0xac2fx2b,{id:_0xac2fx2f[_0x19b5[72]]});_0xac2fx2f[_0x19b5[19]]= _0xac2fx2e?_0xac2fx2e[_0x19b5[76]]:_0x19b5[77];if(_0xac2fx25){delete _0xac2fx2f[_0x19b5[42]];delete _0xac2fx2f[_0x19b5[71]];delete _0xac2fx2f[_0x19b5[72]]}});return _0xac2fx27})}}}exports[_0x19b5[103]]= function(_0xac2fx20,_0xac2fx21){return Contact[_0x19b5[103]]()[_0x19b5[39]](function(_0xac2fx34){return _0xac2fx21[_0x19b5[38]](200)[_0x19b5[37]](_0xac2fx34)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};exports[_0x19b5[118]]= function(_0xac2fx20,_0xac2fx21,_0xac2fx22){_0xac2fx20[_0x19b5[90]][_0x19b5[119]]= _0xac2fx20[_0x19b5[90]][_0x19b5[119]]|| _0x19b5[120];_0xac2fx20[_0x19b5[90]][_0x19b5[121]]= _0xac2fx20[_0x19b5[90]][_0x19b5[121]]|| _0x19b5[61];_0xac2fx20[_0x19b5[90]][_0x19b5[122]]= _0xac2fx20[_0x19b5[90]][_0x19b5[122]]|| _0x19b5[123];_0xac2fx20[_0x19b5[90]][_0x19b5[124]]= _0xac2fx20[_0x19b5[90]][_0x19b5[124]]|| _0x19b5[125];var _0xac2fx3c,_0xac2fx3d={};return Contact[_0x19b5[114]](_0xac2fx20[_0x19b5[139]][_0x19b5[42]])[_0x19b5[39]](function(_0xac2fx3e){if(!_0xac2fx3e){return _0xac2fx21[_0x19b5[126]](404)};switch(_0xac2fx20[_0x19b5[90]][_0x19b5[119]]){case _0x19b5[120]:switch(_0xac2fx20[_0x19b5[90]][_0x19b5[121]]){case _0x19b5[61]:_0xac2fx3c= (_0xac2fx20[_0x19b5[90]][_0x19b5[122]]=== _0x19b5[12])?ReportCallHistory:ReportCall;if(_0xac2fx20[_0x19b5[90]][_0x19b5[124]]=== _0x19b5[127]){_0xac2fx3d[_0x19b5[128]]= [_0xac2fx3e[_0x19b5[61]],_0xac2fx3e[_0x19b5[63]]]}else {_0xac2fx3d[_0x19b5[129]]= [_0xac2fx3e[_0x19b5[61]],_0xac2fx3e[_0x19b5[63]]]};break;case _0x19b5[67]:_0xac2fx3c= MailRoom;_0xac2fx3d[_0x19b5[130]]= _0xac2fx3e[_0x19b5[67]];if(_0xac2fx20[_0x19b5[90]][_0x19b5[122]]=== _0x19b5[12]){_0xac2fx3d[_0x19b5[131]]= {$lt:moment()[_0x19b5[133]](_0x19b5[132])}}else {_0xac2fx3d[_0x19b5[131]]= {$gte:moment()[_0x19b5[133]](_0x19b5[132])}};break;case _0x19b5[135]:_0xac2fx3c= ChatRoom;_0xac2fx3d[_0x19b5[134]]= _0xac2fx3e[_0x19b5[67]];if(_0xac2fx20[_0x19b5[90]][_0x19b5[122]]=== _0x19b5[12]){_0xac2fx3d[_0x19b5[131]]= {$lt:moment()[_0x19b5[133]](_0x19b5[132])}}else {_0xac2fx3d[_0x19b5[131]]= {$gte:moment()[_0x19b5[133]](_0x19b5[132])}};break;case _0x19b5[65]:_0xac2fx3c= FaxRoom;_0xac2fx3d[_0x19b5[134]]= _0xac2fx3e[_0x19b5[65]];if(_0xac2fx20[_0x19b5[90]][_0x19b5[122]]=== _0x19b5[12]){_0xac2fx3d[_0x19b5[131]]= {$lt:moment()[_0x19b5[133]](_0x19b5[132])}}else {_0xac2fx3d[_0x19b5[131]]= {$gte:moment()[_0x19b5[133]](_0x19b5[132])}};break;case _0x19b5[136]:_0xac2fx3c= SmsRoom;_0xac2fx3d[_0x19b5[134]]= [_0xac2fx3e[_0x19b5[61]],_0xac2fx3e[_0x19b5[63]]];if(_0xac2fx20[_0x19b5[90]][_0x19b5[122]]=== _0x19b5[12]){_0xac2fx3d[_0x19b5[131]]= {$lt:moment()[_0x19b5[133]](_0x19b5[132])}}else {_0xac2fx3d[_0x19b5[131]]= {$gte:moment()[_0x19b5[133]](_0x19b5[132])}};break;default:_0xac2fx3c= (_0xac2fx20[_0x19b5[90]][_0x19b5[122]]=== _0x19b5[12])?ReportCallHistory:ReportCall};break;case _0x19b5[138]:switch(_0xac2fx20[_0x19b5[90]][_0x19b5[121]]){case _0x19b5[61]:_0xac2fx3c= (_0xac2fx20[_0x19b5[90]][_0x19b5[122]]=== _0x19b5[12])?ReportQueueHistory:ReportQueue;_0xac2fx3d[_0x19b5[137]]= [_0xac2fx3e[_0x19b5[61]],_0xac2fx3e[_0x19b5[63]]];break;case _0x19b5[67]:return _0xac2fx21[_0x19b5[126]](404);default:_0xac2fx3c= (_0xac2fx20[_0x19b5[90]][_0x19b5[122]]=== _0x19b5[12])?ReportQueueHistory:ReportQueue};break;default:_0xac2fx3c= ReportCall};delete _0xac2fx20[_0x19b5[90]][_0x19b5[119]];delete _0xac2fx20[_0x19b5[90]][_0x19b5[121]];delete _0xac2fx20[_0x19b5[90]][_0x19b5[122]];delete _0xac2fx20[_0x19b5[90]][_0x19b5[124]];return _0xac2fx3c[_0x19b5[107]](Util[_0x19b5[106]](_0xac2fx20[_0x19b5[90]],_0xac2fx3d))})[_0x19b5[39]](function(_0xac2fx24){_0xac2fx21[_0x19b5[38]](200)[_0x19b5[37]](_0xac2fx24)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};exports[_0x19b5[121]]= function(_0xac2fx20,_0xac2fx21){var _0xac2fx3f;return Contact[_0x19b5[111]](_0x19b5[108],_0x19b5[113],_0x19b5[109])[_0x19b5[114]](_0xac2fx20[_0x19b5[139]][_0x19b5[42]])[_0x19b5[39]](function(_0xac2fx44){if(!_0xac2fx44){return _0xac2fx21[_0x19b5[126]](404)};_0xac2fx3f= _0xac2fx44;return CustomField[_0x19b5[101]]({where:{$or:[{ListId:_0xac2fx3f[_0x19b5[72]]},{ListId:null}]}})})[_0x19b5[39]](function(_0xac2fx31){if(_0xac2fx31[_0x19b5[79]]){var _0xac2fx32=_[_0x19b5[85]](_0xac2fx31,_0x19b5[76])[_0x19b5[81]](_0x19b5[80]);return sequelize[_0x19b5[90]](util[_0x19b5[92]](_0x19b5[141],_0xac2fx32,_0xac2fx20[_0x19b5[139]][_0x19b5[42]]),{type:sequelize[_0x19b5[94]][_0x19b5[93]]})}})[_0x19b5[39]](function(_0xac2fx40){if(_0xac2fx40){_[_0x19b5[78]](_0xac2fx40[0],function(_0xac2fx41,_0xac2fx42,_0xac2fx43){if(_0xac2fx41=== _0x19b5[140]){_0xac2fx43[_0xac2fx42]= null}});_[_0x19b5[74]](_0xac2fx3f[_0x19b5[102]],_0xac2fx40[0])}})[_0x19b5[39]](function(){return _0xac2fx21[_0x19b5[38]](200)[_0x19b5[37]](_0xac2fx3f)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};exports[_0x19b5[142]]= function(_0xac2fx20,_0xac2fx21){var _0xac2fx3d={},_0xac2fx45;switch(_0xac2fx20[_0x19b5[144]][_0x19b5[148]]){case _0x19b5[146]:if(_0xac2fx20[_0x19b5[144]][_0x19b5[143]]=== _0x19b5[138]){_0xac2fx3d= {$or:{phone:_0xac2fx20[_0x19b5[144]][_0x19b5[137]],mobile:_0xac2fx20[_0x19b5[144]][_0x19b5[137]]}}}else {_0xac2fx3d= {$or:{phone:_0xac2fx20[_0x19b5[144]][_0x19b5[145]],mobile:_0xac2fx20[_0x19b5[144]][_0x19b5[145]]}}};break;case _0x19b5[147]:_0xac2fx3d= {email:_0xac2fx20[_0x19b5[144]][_0x19b5[130]]};break;default:_0xac2fx3d= {}};var _0xac2fx46=_[_0x19b5[85]](_[_0x19b5[85]](_0xac2fx20[_0x19b5[113]].Lists,_0x19b5[102]),_0x19b5[42]);var _0xac2fx47;return List[_0x19b5[156]]({where:{defaultEntry:true}})[_0x19b5[39]](function(_0xac2fx2e){if(_0xac2fx2e){_0xac2fx46[_0x19b5[152]](_0xac2fx2e[_0x19b5[42]])};if(_0xac2fx20[_0x19b5[144]][_0x19b5[72]]){_0xac2fx47= _[_0x19b5[97]](_0xac2fx46,_0xac2fx20[_0x19b5[144]].ListId)?{id:_0xac2fx20[_0x19b5[144]][_0x19b5[72]]}:null}else {_0xac2fx47= {id:_0xac2fx46}};if(_0xac2fx47){return Contact[_0x19b5[107]]({where:_0xac2fx3d,include:[{model:List,where:_0xac2fx47}]})};return null})[_0x19b5[39]](function(_0xac2fx37){if(_0xac2fx37&& _0xac2fx37[_0x19b5[73]][_0x19b5[79]]){_0xac2fx45= _0xac2fx37;return null}else {_0xac2fx45= {count:0,rows:[]};if(_0xac2fx20[_0x19b5[144]][_0x19b5[149]]&& _0xac2fx20[_0x19b5[144]][_0x19b5[72]]&& _[_0x19b5[97]](_0xac2fx46,_0xac2fx20[_0x19b5[144]].ListId)){var _0xac2fx3f={};return Contact[_0x19b5[155]]({firstName:_0xac2fx20[_0x19b5[144]][_0x19b5[154]],phone:_0xac2fx20[_0x19b5[144]][_0x19b5[137]],ListId:_0xac2fx20[_0x19b5[144]][_0x19b5[72]]})[_0x19b5[39]](function(_0xac2fx3e){_0xac2fx3f= _0xac2fx3e[_0x19b5[153]]({plain:true});return List[_0x19b5[114]](_0xac2fx20[_0x19b5[144]].ListId,{raw:true})})[_0x19b5[39]](function(_0xac2fx2e){_0xac2fx3f[_0x19b5[19]]= _0xac2fx2e;_0xac2fx45[_0x19b5[73]][_0x19b5[152]](_0xac2fx3f)})[_0x19b5[36]](function(_0xac2fx23){logger[_0x19b5[151]](_0x19b5[150],_0xac2fx23)})}}})[_0x19b5[39]](function(){return _0xac2fx21[_0x19b5[38]](200)[_0x19b5[37]](_0xac2fx45)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};exports[_0x19b5[155]]= function(_0xac2fx20,_0xac2fx21,_0xac2fx22){if(!_0xac2fx20[_0x19b5[144]][_0x19b5[43]]||  !_0xac2fx20[_0x19b5[144]][_0x19b5[72]]){return handleError(_0xac2fx21,{message:_0x19b5[157]})};var _0xac2fx3f,_0xac2fx48=moment()[_0x19b5[92]](_0x19b5[158]),_0xac2fx49=[],_0xac2fx4a=[];_0xac2fx20[_0x19b5[144]][_0x19b5[159]]= _0xac2fx20[_0x19b5[113]][_0x19b5[42]];_0xac2fx20[_0x19b5[144]][_0x19b5[131]]= _0xac2fx48;_0xac2fx20[_0x19b5[144]][_0x19b5[160]]= _0xac2fx48;_[_0x19b5[164]](_0xac2fx20[_0x19b5[144]],function(_0xac2fx41,_0xac2fx42){if(_0xac2fx41){switch(_0xac2fx42){case _0x19b5[47]:if(_0xac2fx41[_0x19b5[79]]){_0xac2fx4a[_0x19b5[152]](_0x19b5[84]+ _0xac2fx41[_0x19b5[81]](_0x19b5[161])+ _0x19b5[162]);_0xac2fx49[_0x19b5[152]](_0xac2fx42)};break;default:_0xac2fx49[_0x19b5[152]](_0xac2fx42);_0xac2fx4a[_0x19b5[152]](_[_0x19b5[163]](_0xac2fx41)?_0x19b5[84]+ _0xac2fx41+ _0x19b5[84]:_0xac2fx41)}}});return sequelize[_0x19b5[90]](util[_0x19b5[92]](_0x19b5[166],_0xac2fx49[_0x19b5[81]](_0x19b5[80]),_0xac2fx4a[_0x19b5[81]](_0x19b5[80])))[_0x19b5[39]](function(_0xac2fx3e){_0xac2fx20[_0x19b5[144]][_0x19b5[42]]= _0xac2fx3e[0][_0x19b5[165]];return _0xac2fx21[_0x19b5[38]](201)[_0x19b5[37]](_0xac2fx20[_0x19b5[144]])})[_0x19b5[36]](function(_0xac2fx23){return _0xac2fx22(_0xac2fx23)})};exports[_0x19b5[167]]= function(_0xac2fx20,_0xac2fx21,_0xac2fx22){var _0xac2fx3f,_0xac2fx4b;return Contact[_0x19b5[114]](_0xac2fx20[_0x19b5[139]][_0x19b5[42]])[_0x19b5[39]](function(_0xac2fx3e){_0xac2fx3f= _0xac2fx3e[_0x19b5[102]];_0xac2fx4b= _[_0x19b5[170]](_0xac2fx3e[_0x19b5[102]]);delete _0xac2fx4b[_0x19b5[42]];_0xac2fx4b[_0x19b5[159]]= _0xac2fx20[_0x19b5[113]][_0x19b5[42]];_0xac2fx4b[_0x19b5[72]]= _0xac2fx20[_0x19b5[144]][_0x19b5[72]];_0xac2fx4b[_0x19b5[47]]= _0xac2fx4b[_0x19b5[47]]?_0xac2fx4b[_0x19b5[47]][_0x19b5[171]](_0x19b5[161]):[];if(_0xac2fx4b[_0x19b5[47]][_0x19b5[79]]> 1){_0xac2fx4b[_0x19b5[47]][_0x19b5[172]]()};return Contact[_0x19b5[155]](_0xac2fx4b)})[_0x19b5[39]](function(_0xac2fx4c){_0xac2fx4b= _0xac2fx4c;if(_0xac2fx3f[_0x19b5[72]]=== _0xac2fx20[_0x19b5[144]][_0x19b5[72]]){return CustomField[_0x19b5[101]]({where:{$or:[{ListId:_0xac2fx3f[_0x19b5[72]]},{ListId:null}]}})}})[_0x19b5[39]](function(_0xac2fx31){if(_0xac2fx31&& _0xac2fx31[_0x19b5[79]]){var _0xac2fx32=_[_0x19b5[85]](_0xac2fx31,_0x19b5[76])[_0x19b5[81]](_0x19b5[80]);return sequelize[_0x19b5[90]](util[_0x19b5[92]](_0x19b5[141],_0xac2fx32,_0xac2fx3f[_0x19b5[42]]),{type:sequelize[_0x19b5[94]][_0x19b5[93]]})}})[_0x19b5[39]](function(_0xac2fx40){if(_0xac2fx40){var _0xac2fx32=[];_[_0x19b5[164]](_0xac2fx40[0],function(_0xac2fx41,_0xac2fx42){_0xac2fx32[_0x19b5[152]](util[_0x19b5[92]](_0x19b5[168],_0xac2fx42,_0xac2fx41))});if(_0xac2fx32[_0x19b5[79]]){_0xac2fx32= _0xac2fx32[_0x19b5[81]](_0x19b5[80]);return sequelize[_0x19b5[90]](util[_0x19b5[92]](_0x19b5[169],_0xac2fx32,_0xac2fx4b[_0x19b5[42]]))}}})[_0x19b5[39]](function(){return _0xac2fx21[_0x19b5[38]](201)[_0x19b5[37]](_0xac2fx4b)})[_0x19b5[36]](function(_0xac2fx23){return _0xac2fx22(_0xac2fx23)})};exports[_0x19b5[173]]= function(_0xac2fx20,_0xac2fx21,_0xac2fx22){var _0xac2fx45=[],_0xac2fx48=moment()[_0x19b5[92]](_0x19b5[158]),_0xac2fx4d=[],_0xac2fx49,_0xac2fx4a,_0xac2fx4e={ok:0,ko:0,failed:[]};return Tag[_0x19b5[101]]()[_0x19b5[39]](function(_0xac2fx4f){var _0xac2fx50=[],_0xac2fx51=[];var _0xac2fx52=_[_0x19b5[85]](_[_0x19b5[85]](_0xac2fx4f,_0x19b5[102]),_0x19b5[76]);Async[_0x19b5[182]](_0xac2fx20[_0x19b5[144]][_0x19b5[175]],function(_0xac2fx3e,_0xac2fx30){if(_0xac2fx3e[_0x19b5[43]]&& _0xac2fx3e[_0x19b5[72]]){_0xac2fx3e[_0x19b5[159]]= _0xac2fx20[_0x19b5[113]][_0x19b5[42]];_0xac2fx3e[_0x19b5[131]]= _0xac2fx48;_0xac2fx3e[_0x19b5[160]]= _0xac2fx48;_0xac2fx3e[_0x19b5[47]]&& (_0xac2fx51= _[_0x19b5[176]](_0xac2fx51,_0xac2fx3e[_0x19b5[47]]));_0xac2fx49= [];_0xac2fx4a= [];_[_0x19b5[164]](_0xac2fx3e,function(_0xac2fx41,_0xac2fx42){if(_0xac2fx41){switch(_0xac2fx42){case _0x19b5[47]:if(_0xac2fx41[_0x19b5[79]]){_0xac2fx4a[_0x19b5[152]](_0x19b5[84]+ _0xac2fx41[_0x19b5[81]](_0x19b5[161])+ _0x19b5[162]);_0xac2fx49[_0x19b5[152]](_0xac2fx42)};break;default:_0xac2fx49[_0x19b5[152]](_0xac2fx42);_0xac2fx4a[_0x19b5[152]](_[_0x19b5[163]](_0xac2fx41)?_0x19b5[84]+ _0xac2fx41+ _0x19b5[84]:_0xac2fx41)}}});_0xac2fx4d[_0x19b5[152]](sequelize[_0x19b5[90]](util[_0x19b5[92]](_0x19b5[166],_0xac2fx49[_0x19b5[81]](_0x19b5[80]),_0xac2fx4a[_0x19b5[81]](_0x19b5[80])))[_0x19b5[39]](function(_0xac2fx4c){_0xac2fx3e[_0x19b5[42]]= _0xac2fx4c[_0x19b5[42]];_0xac2fx45[_0x19b5[152]](_0xac2fx3e);_0xac2fx4e[_0x19b5[181]]++})[_0x19b5[36]](function(_0xac2fx23){logger[_0x19b5[178]](_0xac2fx23[_0x19b5[177]]);_0xac2fx4e[_0x19b5[179]]++;_0xac2fx4e[_0x19b5[180]][_0x19b5[152]](_0xac2fx30)}))}else {_0xac2fx4e[_0x19b5[179]]++;_0xac2fx4e[_0x19b5[180]][_0x19b5[152]](_0xac2fx30)}});_0xac2fx51[_0x19b5[79]]&& _[_0x19b5[78]](_0xac2fx51,function(_0xac2fx35){if(!_0xac2fx52[_0x19b5[79]]||  !_[_0x19b5[97]](_0xac2fx52,_0xac2fx35)){_0xac2fx50[_0x19b5[152]](Tag[_0x19b5[155]]({name:_0xac2fx35}))}});return _0xac2fx50})[_0x19b5[174]]()[_0x19b5[39]](function(){return _0xac2fx4d})[_0x19b5[174]]()[_0x19b5[39]](function(){return _0xac2fx21[_0x19b5[38]](201)[_0x19b5[37]](_0xac2fx4e)})[_0x19b5[36]](function(_0xac2fx23){return _0xac2fx22(_0xac2fx23)})};exports[_0x19b5[183]]= function(_0xac2fx20,_0xac2fx21,_0xac2fx22){return Promise[_0x19b5[174]]([])[_0x19b5[39]](updateContact(_0xac2fx20,_0xac2fx21))[_0x19b5[39]](function(_0xac2fx3e){return _0xac2fx21[_0x19b5[38]](200)[_0x19b5[37]](_0xac2fx3e)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};exports[_0x19b5[74]]= function(_0xac2fx20,_0xac2fx21,_0xac2fx22){var _0xac2fx3f;return Promise[_0x19b5[174]]([])[_0x19b5[39]](updateContact(_0xac2fx20,_0xac2fx21))[_0x19b5[39]](function(_0xac2fx3e){_0xac2fx3f= _0xac2fx3e;if(_0xac2fx20[_0x19b5[144]][_0x19b5[184]]){return Contact[_0x19b5[185]]({where:{id:_0xac2fx20[_0x19b5[144]][_0x19b5[184]]},individualHooks:true})}})[_0x19b5[39]](function(){return _0xac2fx21[_0x19b5[38]](200)[_0x19b5[37]](_0xac2fx3f)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};function updateContact(_0xac2fx20,_0xac2fx21){return function(){var _0xac2fx3f;return Tag[_0x19b5[101]]()[_0x19b5[39]](function(_0xac2fx4f){var _0xac2fx50=[];var _0xac2fx52=_[_0x19b5[85]](_[_0x19b5[85]](_0xac2fx4f,_0x19b5[102]),_0x19b5[76]);if(_0xac2fx20[_0x19b5[144]][_0x19b5[47]]){_0xac2fx20[_0x19b5[144]][_0x19b5[47]][_0x19b5[78]](function(_0xac2fx35){if(!_[_0x19b5[97]](_0xac2fx52,_0xac2fx35)){_0xac2fx50[_0x19b5[152]](Tag[_0x19b5[155]]({name:_0xac2fx35}))}})};return _0xac2fx50})[_0x19b5[39]](function(){return Contact[_0x19b5[114]](_0xac2fx20[_0x19b5[139]][_0x19b5[42]])})[_0x19b5[39]](function(_0xac2fx3e){if(!_0xac2fx3e){return _0xac2fx21[_0x19b5[126]](404)};delete _0xac2fx20[_0x19b5[144]][_0x19b5[42]];return _0xac2fx3e[_0x19b5[188]](_0xac2fx20[_0x19b5[144]])})[_0x19b5[39]](function(_0xac2fx3e){_0xac2fx3f= _0xac2fx3e;return CustomField[_0x19b5[101]]({where:{$or:[{ListId:_0xac2fx3f[_0x19b5[72]]},{ListId:null}]}})})[_0x19b5[39]](function(_0xac2fx31){if(_0xac2fx31[_0x19b5[79]]){var _0xac2fx32=[];_0xac2fx31[_0x19b5[78]](function(_0xac2fx35){if(_0xac2fx20[_0x19b5[144]][_0x19b5[187]](_0xac2fx35[_0x19b5[76]])){_0xac2fx32[_0x19b5[152]](util[_0x19b5[92]](_0x19b5[168],_0xac2fx35[_0x19b5[76]],_0xac2fx20[_0x19b5[144]][_0xac2fx35[_0x19b5[76]]]))}});if(_0xac2fx32[_0x19b5[79]]){_0xac2fx32= _0xac2fx32[_0x19b5[81]](_0x19b5[80]);return sequelize[_0x19b5[90]](util[_0x19b5[92]](_0x19b5[169],_0xac2fx32,_0xac2fx3f[_0x19b5[42]]))}}})[_0x19b5[39]](function(){return TdUpdate[_0x19b5[155]]({action:_0x19b5[186],listId:_0xac2fx3f[_0x19b5[72]],contactId:_0xac2fx3f[_0x19b5[42]]})})[_0x19b5[39]](function(){return _0xac2fx3f})}}exports[_0x19b5[185]]= function(_0xac2fx20,_0xac2fx21){return Contact[_0x19b5[114]](_0xac2fx20[_0x19b5[139]][_0x19b5[42]])[_0x19b5[39]](function(_0xac2fx44){if(!_0xac2fx44){return _0xac2fx21[_0x19b5[126]](404)};return _0xac2fx44[_0x19b5[185]]()})[_0x19b5[39]](function(_0xac2fx3e){return TdUpdate[_0x19b5[155]]({action:_0x19b5[189],listId:_0xac2fx3e[_0x19b5[72]],contactId:_0xac2fx3e[_0x19b5[42]]})})[_0x19b5[39]](function(){return _0xac2fx21[_0x19b5[126]](204)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};exports[_0x19b5[190]]= function(_0xac2fx20,_0xac2fx21){return Contact[_0x19b5[101]]({where:{id:_0xac2fx20[_0x19b5[90]][_0x19b5[191]]}})[_0x19b5[39]](function(_0xac2fx37){var _0xac2fx54=[];if(_0xac2fx37&& _0xac2fx37[_0x19b5[79]]){_[_0x19b5[78]](_0xac2fx37,function(_0xac2fx3e){_0xac2fx54[_0x19b5[152]](_0xac2fx3e[_0x19b5[185]]());_0xac2fx54[_0x19b5[152]](TdUpdate[_0x19b5[155]]({action:_0x19b5[189],listId:_0xac2fx3e[_0x19b5[72]],contactId:_0xac2fx3e[_0x19b5[42]]}))})};return _0xac2fx54})[_0x19b5[174]]()[_0x19b5[39]](function(){return _0xac2fx21[_0x19b5[126]](204)})[_0x19b5[36]](function(_0xac2fx23){return handleError(_0xac2fx21,_0xac2fx23)})};function handleError(_0xac2fx21,_0xac2fx23){logger[_0x19b5[151]](_0xac2fx23[_0x19b5[177]]);return _0xac2fx21[_0x19b5[38]](500)[_0x19b5[37]](_0xac2fx23)}