Built motion from commit 52c8a02d.|2.6.29
[motion2.git] / server / components / import / cm / csv.js
index 861eb11..3abad74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x72f8=['catch','sequelize','all','outbound','BlackLists','CampaignId','findAll','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','CmContact','parse','duplicate','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','Duplicate\x20Contact','create','keys','then','push','pick','stringify','cmContact','checkHopper','inspect','insert','scheduledAt','ContactId','updatedAt','select','field','createdAt','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','fromQuery','str','calleridnum','into','id\x20IN\x20?','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId'];(function(_0x36fe55,_0x75f5d){var _0x2701e4=function(_0xce9362){while(--_0xce9362){_0x36fe55['push'](_0x36fe55['shift']());}};_0x2701e4(++_0x75f5d);}(_0x72f8,0xe3));var _0x872f=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x72f8[_0x367e5b];return _0x4b909e;};'use strict';var BPromise=require(_0x872f('0x0'));var util=require(_0x872f('0x1'));var _=require(_0x872f('0x2'));var fs=require('fs');var squel=require(_0x872f('0x3'));var Papa=require(_0x872f('0x4'));var Redis=require(_0x872f('0x5'));var db=require(_0x872f('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x872f('0x7'));config[_0x872f('0x8')]=_[_0x872f('0x9')](config[_0x872f('0x8')],{'host':_0x872f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x872f('0xb'))[_0x872f('0xc')](socket);try{if(!process[_0x872f('0xd')][0x2]||process['argv'][0x2]===_0x872f('0xe')||process['argv'][0x2]===_0x872f('0xf')){throw new Error(_0x872f('0x10'));}var FILEPATH=process[_0x872f('0xd')][0x2];if(!process[_0x872f('0xd')][0x3]||process[_0x872f('0xd')][0x3]===_0x872f('0xe')||process[_0x872f('0xd')][0x3]===_0x872f('0xf')||!process[_0x872f('0xd')][0x4]||process['argv'][0x4]===_0x872f('0xe')||process['argv'][0x4]===_0x872f('0xf')){throw new Error(_0x872f('0x11'));}var FIELDS=_[_0x872f('0x12')](process['argv'][0x3]['split'](','),process[_0x872f('0xd')][0x4][_0x872f('0x13')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x872f('0xe')||process[_0x872f('0xd')][0x5]===_0x872f('0xf')){throw new Error(_0x872f('0x14'));}var LISTID=process[_0x872f('0xd')][0x5];var COMPANYID=process[_0x872f('0xd')][0x6]&&process[_0x872f('0xd')][0x6]!==_0x872f('0xe')&&process['argv'][0x6]!==_0x872f('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x872f('0xd')][0x7]&&process[_0x872f('0xd')][0x7]!==_0x872f('0xe')&&process[_0x872f('0xd')][0x7]!==_0x872f('0xf')?process[_0x872f('0xd')][0x7]:null;if(!process[_0x872f('0xd')][0x8]||process['argv'][0x8]===_0x872f('0xe')||process[_0x872f('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4435a1){logger[_0x872f('0x15')](_0x4435a1);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x11cc31,_0xc564e8,_0x300470,_0x433c22){var _0x3cac31={'message':_0xc564e8};_0x3cac31[_0x11cc31]=!![];if(_0x300470){_0x3cac31[_0x872f('0x16')]=_0x300470;}if(_0x433c22){_0x3cac31[_0x872f('0x17')]=_0x433c22;}return _0x3cac31;}function isEmail(_0x52dc4f){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x872f('0x18')](_0x52dc4f);}function checkRow(_0x5f1fb2,_0x3e557b,_0x22c244){return new BPromise(function(_0xec3405,_0x16ca9e){if(_['isNil'](_0x5f1fb2)){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x22c244));}if(_0x5f1fb2['errors']&&_0x5f1fb2[_0x872f('0x19')][_0x872f('0x1a')]){var _0x40dd64=_[_0x872f('0x1b')](_0x5f1fb2[_0x872f('0x19')],_0x872f('0x1c'))['join'](';');return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),_0x40dd64,null,_0x22c244));}var _0x11fa75={};for(var _0x3e5833 in FIELDS){if(FIELDS[_0x872f('0x1d')](_0x3e5833)&&FIELDS[_0x3e5833]){_0x11fa75[_0x3e5833]=_0x5f1fb2[_0x872f('0x1e')][0x0][FIELDS[_0x3e5833]]||_0x5f1fb2[_0x872f('0x1e')][0x0]['\ufeff'+FIELDS[_0x3e5833]];}}if(!_0x11fa75[_0x872f('0x1f')]){return _0x16ca9e(handleCheckRowError('error',_0x872f('0x20'),null,_0x22c244));}if(!_0x11fa75[_0x872f('0x21')]){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),'phone\x20not\x20specified!',null,_0x22c244));}if(_0x11fa75['birthDate']){var _0x46c01b=moment(_0x11fa75[_0x872f('0x22')],'YYYY-MM-DD');if(!_0x46c01b[_0x872f('0x23')]()){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),_0x872f('0x24'),null,_0x22c244));}}if(_0x11fa75[_0x872f('0x25')]){if(!isEmail(_0x11fa75[_0x872f('0x25')])){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x22c244));}}_0x11fa75[_0x872f('0x26')]=LISTID;_0x11fa75[_0x872f('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x872f('0x1a')]&&_0x3e557b){var _0x11dc65={};for(var _0x12c0d3=0x0,_0x17c0fb=DUPLICATES['length'];_0x12c0d3<_0x17c0fb;_0x12c0d3+=0x1){_0x11dc65[DUPLICATES[_0x12c0d3]]=_0x11fa75[DUPLICATES[_0x12c0d3]];}var _0xefb780=_['find'](_0x3e557b,_0x11dc65);if(_0xefb780){return _0x16ca9e(handleCheckRowError('duplicate',_0x872f('0x28'),_0xefb780,_0x22c244));}}return db['CmContact'][_0x872f('0x29')](_0x11fa75,{'raw':!![],'hooks':![],'fields':_[_0x872f('0x2a')](_0x11fa75)})[_0x872f('0x2b')](function(_0x2d616c){if(DUPLICATES&&DUPLICATES[_0x872f('0x1a')]&&_0x3e557b){_0x3e557b[_0x872f('0x2c')](_[_0x872f('0x2d')](_0x11fa75,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2d616c['id'];return _0xec3405();})['catch'](function(_0x544441){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x544441[_0x872f('0x1c')]||JSON[_0x872f('0x2e')](_0x544441)),null,_0x22c244));});});}function checkHopper(){function _0x2d377d(){return function(_0x18ed95){logger[_0x872f('0x15')](_0x872f('0x2f'),_0x872f('0x30'),util[_0x872f('0x31')](_0x18ed95,{'showHidden':![],'depth':null}));};}var _0x2de6c5=function(_0x16bdad,_0x56d883){var _0x1672ea=squel[_0x872f('0x32')]()['into']('cm_hopper')['fromQuery']([_0x872f('0x21'),_0x872f('0x33'),_0x872f('0x34'),_0x872f('0x26'),_0x56d883,'createdAt',_0x872f('0x35')],squel[_0x872f('0x36')]()['field'](_0x872f('0x21'),_0x872f('0x21'))['field']('NOW()',_0x872f('0x33'))[_0x872f('0x37')]('id',_0x872f('0x34'))['field'](LISTID['toString'](),_0x872f('0x26'))[_0x872f('0x37')](_0x16bdad['id']['toString'](),_0x56d883)[_0x872f('0x37')]('NOW()',_0x872f('0x38'))[_0x872f('0x37')](_0x872f('0x39'),_0x872f('0x35'))[_0x872f('0x3a')](_0x872f('0x3b'))[_0x872f('0x3c')](_0x872f('0x3d'))[_0x872f('0x3c')](_0x872f('0x3e'),LISTID[_0x872f('0x3f')]())[_0x872f('0x3c')](_0x872f('0x40'))['where'](_0x872f('0x41'),squel[_0x872f('0x36')]()['field'](_0x872f('0x21'))['from'](_0x872f('0x42'))[_0x872f('0x3c')](_0x56d883+_0x872f('0x43'),_0x16bdad['id'][_0x872f('0x3f')]())))['toString']();return _0x1672ea;};var _0x1cdcc5=function(_0x54796b,_0x16eb13){var _0x1547b7=squel[_0x872f('0x32')]()['into'](_0x872f('0x42'))[_0x872f('0x44')]([_0x872f('0x21'),_0x872f('0x33'),_0x872f('0x34'),_0x872f('0x26'),_0x16eb13,_0x872f('0x38'),_0x872f('0x35')],squel[_0x872f('0x36')]()[_0x872f('0x37')](_0x872f('0x21'),_0x872f('0x21'))[_0x872f('0x37')](_0x872f('0x39'),'scheduledAt')['field']('id',_0x872f('0x34'))['field'](LISTID[_0x872f('0x3f')](),_0x872f('0x26'))[_0x872f('0x37')](_0x54796b['id'][_0x872f('0x3f')](),_0x16eb13)[_0x872f('0x37')]('NOW()',_0x872f('0x38'))[_0x872f('0x37')]('NOW()',_0x872f('0x35'))[_0x872f('0x3a')]('cm_contacts')[_0x872f('0x3c')](_0x872f('0x3d'))['where'](_0x872f('0x3e'),LISTID['toString']())[_0x872f('0x3c')]('id\x20IN\x20?',squel[_0x872f('0x45')](hopperContacts))[_0x872f('0x3c')](_0x872f('0x40'))[_0x872f('0x3c')](_0x872f('0x41'),squel['select']()[_0x872f('0x37')](_0x872f('0x46'))[_0x872f('0x3a')]('cm_hopper_final')['where'](_0x16eb13+_0x872f('0x43'),_0x54796b['id'][_0x872f('0x3f')]()))[_0x872f('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x872f('0x36')]()['field'](_0x872f('0x21'))[_0x872f('0x3a')](_0x872f('0x42'))['where'](_0x16eb13+_0x872f('0x43'),_0x54796b['id'][_0x872f('0x3f')]())))['toString']();return _0x1547b7;};function _0x19f996(_0x1fdcf4,_0x25a06c){var _0x1a0cc0=squel['insert']()[_0x872f('0x47')](_0x872f('0x42'))[_0x872f('0x44')]([_0x872f('0x21'),_0x872f('0x33'),'ContactId','ListId',_0x25a06c,_0x872f('0x38'),_0x872f('0x35')],squel[_0x872f('0x36')]()[_0x872f('0x37')](_0x872f('0x21'),'phone')[_0x872f('0x37')]('NOW()',_0x872f('0x33'))['field']('id','ContactId')[_0x872f('0x37')](LISTID[_0x872f('0x3f')](),'ListId')['field'](_0x1fdcf4['id'][_0x872f('0x3f')](),_0x25a06c)[_0x872f('0x37')](_0x872f('0x39'),_0x872f('0x38'))[_0x872f('0x37')](_0x872f('0x39'),_0x872f('0x35'))[_0x872f('0x3a')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x872f('0x3c')](_0x872f('0x3e'),LISTID['toString']())[_0x872f('0x3c')](_0x872f('0x48'),squel['str'](hopperContacts))[_0x872f('0x3c')](_0x872f('0x40')))[_0x872f('0x3f')]();return _0x1a0cc0;}function _0x5b297e(_0x528c14,_0x327376){var _0x4f3d98=squel['insert']()[_0x872f('0x47')](_0x872f('0x49'))[_0x872f('0x44')]([_0x872f('0x21'),'ContactId','ListId',_0x327376,_0x872f('0x38'),_0x872f('0x35')],squel[_0x872f('0x36')]()[_0x872f('0x37')](_0x872f('0x21'),_0x872f('0x21'))[_0x872f('0x37')]('id',_0x872f('0x34'))[_0x872f('0x37')](LISTID[_0x872f('0x3f')](),'ListId')[_0x872f('0x37')](_0x528c14['id']['toString'](),_0x327376)[_0x872f('0x37')](_0x872f('0x39'),_0x872f('0x38'))['field'](_0x872f('0x39'),'updatedAt')[_0x872f('0x3a')](_0x872f('0x3b'))[_0x872f('0x3c')](_0x872f('0x3d'))['where'](_0x872f('0x3e'),LISTID['toString']())[_0x872f('0x3c')](_0x872f('0x48'),squel[_0x872f('0x45')](hopperContacts))[_0x872f('0x3c')](_0x872f('0x40')))[_0x872f('0x3f')]();return _0x4f3d98;}return db[_0x872f('0x4a')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x872f('0x4b')],'include':[{'model':db[_0x872f('0x4c')],'as':_0x872f('0x4d'),'where':{'id':LISTID}}]})[_0x872f('0x2b')](function(_0xbca2b0){var _0x389d14=[];if(_0xbca2b0){var _0x437f23;for(var _0x53d5bd=0x0,_0x1be5df;_0x53d5bd<_0xbca2b0[_0x872f('0x1a')];_0x53d5bd+=0x1){_0x1be5df=_0xbca2b0[_0x53d5bd][_0x872f('0x4e')]({'plain':!![]});switch(_0x1be5df['dialCheckDuplicateType']){case _0x872f('0x4f'):_0x389d14[_0x872f('0x2c')](db['sequelize'][_0x872f('0x50')](_0x1cdcc5(_0x1be5df,_0x872f('0x51')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));break;case'onlyIfOpen':_0x389d14[_0x872f('0x2c')](db[_0x872f('0x53')][_0x872f('0x50')](_0x2de6c5(_0x1be5df,'VoiceQueueId'))['then'](function(){})['catch'](_0x2d377d()));break;default:_0x389d14['push'](db[_0x872f('0x53')][_0x872f('0x50')](_0x19f996(_0x1be5df,_0x872f('0x51')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));}}}return _0x389d14;})[_0x872f('0x54')]()[_0x872f('0x2b')](function(){return db[_0x872f('0x4a')]['findAll']({'where':{'type':_0x872f('0x55')},'attributes':['id'],'include':[{'model':db[_0x872f('0x4c')],'as':_0x872f('0x56'),'where':{'id':LISTID}}]})[_0x872f('0x2b')](function(_0xfc9ff3){var _0x1e5129=[];if(_0xfc9ff3){var _0x266f60;for(var _0x106826=0x0,_0x10282c;_0x106826<_0xfc9ff3[_0x872f('0x1a')];_0x106826+=0x1){_0x10282c=_0xfc9ff3[_0x106826]['get']({'plain':!![]});_0x1e5129['push'](db[_0x872f('0x53')][_0x872f('0x50')](_0x5b297e(_0x10282c,_0x872f('0x51')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));}}return _0x1e5129;})[_0x872f('0x54')]();})[_0x872f('0x2b')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x872f('0x4b')],'include':[{'model':db[_0x872f('0x4c')],'as':_0x872f('0x4d'),'where':{'id':LISTID}}]})[_0x872f('0x2b')](function(_0xc3e011){var _0x43f387=[];if(_0xc3e011){for(var _0x54b5a3=0x0,_0x2284d2;_0x54b5a3<_0xc3e011[_0x872f('0x1a')];_0x54b5a3+=0x1){_0x2284d2=_0xc3e011[_0x54b5a3][_0x872f('0x4e')]({'plain':!![]});switch(_0x2284d2[_0x872f('0x4b')]){case _0x872f('0x4f'):_0x43f387['push'](db[_0x872f('0x53')][_0x872f('0x50')](_0x1cdcc5(_0x2284d2,_0x872f('0x57')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));break;case'onlyIfOpen':_0x43f387[_0x872f('0x2c')](db[_0x872f('0x53')][_0x872f('0x50')](_0x2de6c5(_0x2284d2,_0x872f('0x57')))['then'](function(){})['catch'](_0x2d377d()));break;default:_0x43f387[_0x872f('0x2c')](db[_0x872f('0x53')]['query'](_0x19f996(_0x2284d2,_0x872f('0x57')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));}}}return _0x43f387;})['all']();})['then'](function(){return db['Campaign'][_0x872f('0x58')]({'attributes':['id'],'include':[{'model':db[_0x872f('0x4c')],'as':_0x872f('0x56'),'where':{'id':LISTID}}]})[_0x872f('0x2b')](function(_0xdf9d31){var _0x205cc3=[];if(_0xdf9d31){for(var _0x2db836=0x0,_0x370037;_0x2db836<_0xdf9d31[_0x872f('0x1a')];_0x2db836+=0x1){_0x370037=_0xdf9d31[_0x2db836][_0x872f('0x4e')]({'plain':!![]});_0x205cc3[_0x872f('0x2c')](db[_0x872f('0x53')]['query'](_0x5b297e(_0x370037,_0x872f('0x57')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));}}return _0x205cc3;})[_0x872f('0x54')]();})[_0x872f('0x52')](function(_0x294f51){logger[_0x872f('0x15')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x294f51[_0x872f('0x1c')]);});}var processPromises=function(_0x477735){return BPromise[_0x872f('0x54')](promises)[_0x872f('0x2b')](function(_0x34c245){})[_0x872f('0x52')](function(_0x26c2e6){logger['error'](_0x872f('0x59'),JSON[_0x872f('0x2e')](_0x26c2e6));})[_0x872f('0x5a')](function(){socket['emit'](_0x872f('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x477735){return _0x477735[_0x872f('0x5c')]();}});};var endCsv=function(){return BPromise[_0x872f('0x5d')]()[_0x872f('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x872f('0x2b')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x872f('0x5e')](FILEPATH);}catch(_0x35c0fe){logger[_0x872f('0x15')](_0x872f('0x5f'),JSON['stringify'](_0x35c0fe));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x872f('0x60')](_0x872f('0x61'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x872f('0x13')](',');return db[_0x872f('0x62')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x872f('0x2b')](function(_0x506077){var _0x5f122b=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x872f('0x63')](_0x5f122b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4cdf04,_0x28e6c9){total+=0x1;var _0x18e924=total;promises[_0x872f('0x2c')](checkRow(_0x4cdf04,_0x506077,_0x18e924)['then'](function(){success+=0x1;})[_0x872f('0x52')](function(_0x4eafd0){if(_0x4eafd0[_0x872f('0x15')]){errors+=0x1;delete _0x4eafd0['error'];}else if(_0x4eafd0[_0x872f('0x64')]){duplicates+=0x1;delete _0x4eafd0[_0x872f('0x64')];}rows[_0x872f('0x2c')](_0x4eafd0);}));if(total%0xc8===0x0){_0x28e6c9[_0x872f('0x65')]();return processPromises(_0x28e6c9);}},'complete':function(){return processPromises()['then'](function(){logger[_0x872f('0x60')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2c01f8,_0x1cdc0d){logger[_0x872f('0x60')]('CSV\x20parse\x20error',JSON[_0x872f('0x2e')](_0x2c01f8));endCsv();}});})[_0x872f('0x52')](function(_0xd98351){logger['error'](_0x872f('0x66'),JSON['stringify'](_0xd98351));});}main();
\ No newline at end of file
+var _0x4c10=['cmContact','inspect','insert','into','cm_hopper','fromQuery','ContactId','createdAt','select','field','NOW()','scheduledAt','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','query','VoiceQueueId','catch','sequelize','all','BlackLists','Campaign','CampaignId','get','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/environment','redis','../../../api/cmContact/cmContact.socket','register','argv','null','undefined','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4c10,0x17a));var _0x04c1=function(_0x5cdf51,_0x2ce86c){_0x5cdf51=_0x5cdf51-0x0;var _0x470a5f=_0x4c10[_0x5cdf51];return _0x470a5f;};'use strict';var BPromise=require('bluebird');var util=require(_0x04c1('0x0'));var _=require(_0x04c1('0x1'));var fs=require('fs');var squel=require(_0x04c1('0x2'));var Papa=require(_0x04c1('0x3'));var Redis=require(_0x04c1('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x04c1('0x5'));var logger=require('../../../config/logger')('api');config['redis']=_['defaults'](config[_0x04c1('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04c1('0x6')]));require(_0x04c1('0x7'))[_0x04c1('0x8')](socket);try{if(!process[_0x04c1('0x9')][0x2]||process[_0x04c1('0x9')][0x2]==='undefined'||process[_0x04c1('0x9')][0x2]===_0x04c1('0xa')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x04c1('0x9')][0x2];if(!process[_0x04c1('0x9')][0x3]||process['argv'][0x3]==='undefined'||process[_0x04c1('0x9')][0x3]===_0x04c1('0xa')||!process['argv'][0x4]||process[_0x04c1('0x9')][0x4]===_0x04c1('0xb')||process['argv'][0x4]===_0x04c1('0xa')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x04c1('0xc')](process[_0x04c1('0x9')][0x3]['split'](','),process[_0x04c1('0x9')][0x4][_0x04c1('0xd')](','));if(!process['argv'][0x5]||process[_0x04c1('0x9')][0x5]==='undefined'||process['argv'][0x5]===_0x04c1('0xa')){throw new Error(_0x04c1('0xe'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x04c1('0x9')][0x6]&&process[_0x04c1('0x9')][0x6]!==_0x04c1('0xb')&&process[_0x04c1('0x9')][0x6]!==_0x04c1('0xa')?process['argv'][0x6]:null;var DUPLICATES=process[_0x04c1('0x9')][0x7]&&process[_0x04c1('0x9')][0x7]!=='undefined'&&process[_0x04c1('0x9')][0x7]!==_0x04c1('0xa')?process[_0x04c1('0x9')][0x7]:null;if(!process[_0x04c1('0x9')][0x8]||process[_0x04c1('0x9')][0x8]===_0x04c1('0xb')||process[_0x04c1('0x9')][0x8]==='null'){throw new Error(_0x04c1('0xf'));}var SOCKET_TIMESTAMP=process[_0x04c1('0x9')][0x8];}catch(_0x52a1d1){logger['error'](_0x52a1d1);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x555b09,_0xaf0b28,_0x3e5397,_0x590d51){var _0x4086f1={'message':_0xaf0b28};_0x4086f1[_0x555b09]=!![];if(_0x3e5397){_0x4086f1['contact']=_0x3e5397;}if(_0x590d51){_0x4086f1[_0x04c1('0x10')]=_0x590d51;}return _0x4086f1;}function isEmail(_0x202098){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x04c1('0x11')](_0x202098);}function checkRow(_0x1eacde,_0x32d5b5,_0x8b4608){return new BPromise(function(_0x4b2ca8,_0x25dfea){if(_[_0x04c1('0x12')](_0x1eacde)){return _0x25dfea(handleCheckRowError(_0x04c1('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x8b4608));}if(_0x1eacde[_0x04c1('0x14')]&&_0x1eacde[_0x04c1('0x14')][_0x04c1('0x15')]){var _0x3c2438=_['map'](_0x1eacde[_0x04c1('0x14')],_0x04c1('0x16'))[_0x04c1('0x17')](';');return _0x25dfea(handleCheckRowError(_0x04c1('0x13'),_0x3c2438,null,_0x8b4608));}var _0x2dcd4e={};for(var _0x4aa63a in FIELDS){if(FIELDS[_0x04c1('0x18')](_0x4aa63a)&&FIELDS[_0x4aa63a]){_0x2dcd4e[_0x4aa63a]=_0x1eacde[_0x04c1('0x19')][0x0][FIELDS[_0x4aa63a]]||_0x1eacde[_0x04c1('0x19')][0x0]['\ufeff'+FIELDS[_0x4aa63a]];}}if(!_0x2dcd4e[_0x04c1('0x1a')]){return _0x25dfea(handleCheckRowError(_0x04c1('0x13'),_0x04c1('0x1b'),null,_0x8b4608));}if(!_0x2dcd4e[_0x04c1('0x1c')]){return _0x25dfea(handleCheckRowError(_0x04c1('0x13'),_0x04c1('0x1d'),null,_0x8b4608));}if(_0x2dcd4e['birthDate']){var _0x53f3fd=moment(_0x2dcd4e[_0x04c1('0x1e')],_0x04c1('0x1f'));if(!_0x53f3fd[_0x04c1('0x20')]()){return _0x25dfea(handleCheckRowError(_0x04c1('0x13'),_0x04c1('0x21'),null,_0x8b4608));}}if(_0x2dcd4e['email']){if(!isEmail(_0x2dcd4e[_0x04c1('0x22')])){return _0x25dfea(handleCheckRowError(_0x04c1('0x13'),_0x04c1('0x23'),null,_0x8b4608));}}_0x2dcd4e[_0x04c1('0x24')]=LISTID;_0x2dcd4e[_0x04c1('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x04c1('0x15')]&&_0x32d5b5){var _0x46f533={};for(var _0x1bb538=0x0,_0x27c9bd=DUPLICATES[_0x04c1('0x15')];_0x1bb538<_0x27c9bd;_0x1bb538+=0x1){_0x46f533[DUPLICATES[_0x1bb538]]=_0x2dcd4e[DUPLICATES[_0x1bb538]];}var _0xf85aef=_['find'](_0x32d5b5,_0x46f533);if(_0xf85aef){return _0x25dfea(handleCheckRowError(_0x04c1('0x26'),_0x04c1('0x27'),_0xf85aef,_0x8b4608));}}return db[_0x04c1('0x28')]['create'](_0x2dcd4e,{'raw':!![],'hooks':![],'fields':_[_0x04c1('0x29')](_0x2dcd4e)})[_0x04c1('0x2a')](function(_0x135972){if(DUPLICATES&&DUPLICATES['length']&&_0x32d5b5){_0x32d5b5[_0x04c1('0x2b')](_['pick'](_0x2dcd4e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x135972['id'];return _0x4b2ca8();})['catch'](function(_0x43f003){return _0x25dfea(handleCheckRowError('error',_0x04c1('0x2c')+(_0x43f003[_0x04c1('0x16')]||JSON[_0x04c1('0x2d')](_0x43f003)),null,_0x8b4608));});});}function checkHopper(){function _0x2c77f1(){return function(_0x48bc21){logger[_0x04c1('0x13')](_0x04c1('0x2e'),'checkHopper',util[_0x04c1('0x2f')](_0x48bc21,{'showHidden':![],'depth':null}));};}var _0xa5da11=function(_0xea7235,_0x57087d){var _0x1e865a=squel[_0x04c1('0x30')]()[_0x04c1('0x31')](_0x04c1('0x32'))[_0x04c1('0x33')]([_0x04c1('0x1c'),'scheduledAt',_0x04c1('0x34'),_0x04c1('0x24'),_0x57087d,_0x04c1('0x35'),'updatedAt'],squel[_0x04c1('0x36')]()[_0x04c1('0x37')]('phone','phone')[_0x04c1('0x37')](_0x04c1('0x38'),_0x04c1('0x39'))[_0x04c1('0x37')]('id',_0x04c1('0x34'))[_0x04c1('0x37')](LISTID['toString'](),_0x04c1('0x24'))[_0x04c1('0x37')](_0xea7235['id'][_0x04c1('0x3a')](),_0x57087d)[_0x04c1('0x37')](_0x04c1('0x38'),'createdAt')[_0x04c1('0x37')](_0x04c1('0x38'),_0x04c1('0x3b'))[_0x04c1('0x3c')](_0x04c1('0x3d'))[_0x04c1('0x3e')](_0x04c1('0x3f'))[_0x04c1('0x3e')](_0x04c1('0x40'),LISTID['toString']())['where'](_0x04c1('0x41'))[_0x04c1('0x3e')](_0x04c1('0x42'),squel[_0x04c1('0x36')]()[_0x04c1('0x37')](_0x04c1('0x1c'))[_0x04c1('0x3c')](_0x04c1('0x32'))[_0x04c1('0x3e')](_0x57087d+_0x04c1('0x43'),_0xea7235['id']['toString']())))[_0x04c1('0x3a')]();return _0x1e865a;};var _0x43b4eb=function(_0x5959b8,_0x4d260e){var _0x176997=squel[_0x04c1('0x30')]()['into'](_0x04c1('0x32'))[_0x04c1('0x33')]([_0x04c1('0x1c'),'scheduledAt',_0x04c1('0x34'),_0x04c1('0x24'),_0x4d260e,_0x04c1('0x35'),_0x04c1('0x3b')],squel[_0x04c1('0x36')]()[_0x04c1('0x37')]('phone','phone')[_0x04c1('0x37')](_0x04c1('0x38'),_0x04c1('0x39'))['field']('id','ContactId')['field'](LISTID[_0x04c1('0x3a')](),'ListId')[_0x04c1('0x37')](_0x5959b8['id']['toString'](),_0x4d260e)[_0x04c1('0x37')](_0x04c1('0x38'),_0x04c1('0x35'))[_0x04c1('0x37')](_0x04c1('0x38'),_0x04c1('0x3b'))[_0x04c1('0x3c')]('cm_contacts')[_0x04c1('0x3e')](_0x04c1('0x3f'))['where'](_0x04c1('0x40'),LISTID[_0x04c1('0x3a')]())['where']('id\x20IN\x20?',squel[_0x04c1('0x44')](hopperContacts))[_0x04c1('0x3e')](_0x04c1('0x41'))[_0x04c1('0x3e')](_0x04c1('0x42'),squel[_0x04c1('0x36')]()[_0x04c1('0x37')](_0x04c1('0x45'))[_0x04c1('0x3c')](_0x04c1('0x46'))[_0x04c1('0x3e')](_0x4d260e+_0x04c1('0x43'),_0x5959b8['id'][_0x04c1('0x3a')]()))['where'](_0x04c1('0x42'),squel[_0x04c1('0x36')]()['field']('phone')[_0x04c1('0x3c')](_0x04c1('0x32'))['where'](_0x4d260e+_0x04c1('0x43'),_0x5959b8['id']['toString']())))[_0x04c1('0x3a')]();return _0x176997;};function _0x5e7f7e(_0x44c6dd,_0xafa4d6){var _0x4931b3=squel['insert']()['into'](_0x04c1('0x32'))[_0x04c1('0x33')]([_0x04c1('0x1c'),'scheduledAt',_0x04c1('0x34'),_0x04c1('0x24'),_0xafa4d6,_0x04c1('0x35'),_0x04c1('0x3b')],squel[_0x04c1('0x36')]()[_0x04c1('0x37')](_0x04c1('0x1c'),'phone')[_0x04c1('0x37')](_0x04c1('0x38'),_0x04c1('0x39'))[_0x04c1('0x37')]('id',_0x04c1('0x34'))[_0x04c1('0x37')](LISTID[_0x04c1('0x3a')](),_0x04c1('0x24'))['field'](_0x44c6dd['id']['toString'](),_0xafa4d6)['field'](_0x04c1('0x38'),'createdAt')[_0x04c1('0x37')](_0x04c1('0x38'),_0x04c1('0x3b'))[_0x04c1('0x3c')](_0x04c1('0x3d'))[_0x04c1('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0x04c1('0x40'),LISTID[_0x04c1('0x3a')]())[_0x04c1('0x3e')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x04c1('0x3e')](_0x04c1('0x41')))['toString']();return _0x4931b3;}function _0x319c7d(_0x1c2f25,_0x4d5dbb){var _0x47ee59=squel[_0x04c1('0x30')]()['into'](_0x04c1('0x47'))[_0x04c1('0x33')]([_0x04c1('0x1c'),_0x04c1('0x34'),'ListId',_0x4d5dbb,'createdAt','updatedAt'],squel[_0x04c1('0x36')]()[_0x04c1('0x37')](_0x04c1('0x1c'),_0x04c1('0x1c'))[_0x04c1('0x37')]('id',_0x04c1('0x34'))[_0x04c1('0x37')](LISTID['toString'](),_0x04c1('0x24'))[_0x04c1('0x37')](_0x1c2f25['id'][_0x04c1('0x3a')](),_0x4d5dbb)[_0x04c1('0x37')]('NOW()',_0x04c1('0x35'))[_0x04c1('0x37')]('NOW()','updatedAt')[_0x04c1('0x3c')]('cm_contacts')[_0x04c1('0x3e')](_0x04c1('0x3f'))[_0x04c1('0x3e')](_0x04c1('0x40'),LISTID[_0x04c1('0x3a')]())[_0x04c1('0x3e')](_0x04c1('0x48'),squel[_0x04c1('0x44')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x04c1('0x3a')]();return _0x47ee59;}return db[_0x04c1('0x49')][_0x04c1('0x4a')]({'where':{'type':_0x04c1('0x4b')},'attributes':['id',_0x04c1('0x4c')],'include':[{'model':db[_0x04c1('0x4d')],'as':_0x04c1('0x4e'),'where':{'id':LISTID}}]})[_0x04c1('0x2a')](function(_0x2ea14e){var _0xf1dcf6=[];if(_0x2ea14e){var _0x19d7a2;for(var _0x3775d6=0x0,_0x4b90cf;_0x3775d6<_0x2ea14e[_0x04c1('0x15')];_0x3775d6+=0x1){_0x4b90cf=_0x2ea14e[_0x3775d6]['get']({'plain':!![]});switch(_0x4b90cf[_0x04c1('0x4c')]){case _0x04c1('0x4f'):_0xf1dcf6[_0x04c1('0x2b')](db['sequelize'][_0x04c1('0x50')](_0x43b4eb(_0x4b90cf,_0x04c1('0x51')))[_0x04c1('0x2a')](function(){})[_0x04c1('0x52')](_0x2c77f1()));break;case'onlyIfOpen':_0xf1dcf6[_0x04c1('0x2b')](db['sequelize'][_0x04c1('0x50')](_0xa5da11(_0x4b90cf,_0x04c1('0x51')))['then'](function(){})[_0x04c1('0x52')](_0x2c77f1()));break;default:_0xf1dcf6[_0x04c1('0x2b')](db[_0x04c1('0x53')][_0x04c1('0x50')](_0x5e7f7e(_0x4b90cf,_0x04c1('0x51')))[_0x04c1('0x2a')](function(){})[_0x04c1('0x52')](_0x2c77f1()));}}}return _0xf1dcf6;})[_0x04c1('0x54')]()['then'](function(){return db[_0x04c1('0x49')][_0x04c1('0x4a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x04c1('0x4d')],'as':_0x04c1('0x55'),'where':{'id':LISTID}}]})[_0x04c1('0x2a')](function(_0x3327b4){var _0x19114e=[];if(_0x3327b4){var _0x1d0a40;for(var _0x2ee06f=0x0,_0x11082a;_0x2ee06f<_0x3327b4[_0x04c1('0x15')];_0x2ee06f+=0x1){_0x11082a=_0x3327b4[_0x2ee06f]['get']({'plain':!![]});_0x19114e[_0x04c1('0x2b')](db[_0x04c1('0x53')][_0x04c1('0x50')](_0x319c7d(_0x11082a,_0x04c1('0x51')))[_0x04c1('0x2a')](function(){})[_0x04c1('0x52')](_0x2c77f1()));}}return _0x19114e;})[_0x04c1('0x54')]();})[_0x04c1('0x2a')](function(){return db[_0x04c1('0x56')][_0x04c1('0x4a')]({'attributes':['id',_0x04c1('0x4c')],'include':[{'model':db['CmList'],'as':_0x04c1('0x4e'),'where':{'id':LISTID}}]})[_0x04c1('0x2a')](function(_0x1bf816){var _0x4184ad=[];if(_0x1bf816){for(var _0x5c1c28=0x0,_0x3fb641;_0x5c1c28<_0x1bf816['length'];_0x5c1c28+=0x1){_0x3fb641=_0x1bf816[_0x5c1c28]['get']({'plain':!![]});switch(_0x3fb641[_0x04c1('0x4c')]){case _0x04c1('0x4f'):_0x4184ad['push'](db[_0x04c1('0x53')]['query'](_0x43b4eb(_0x3fb641,'CampaignId'))['then'](function(){})[_0x04c1('0x52')](_0x2c77f1()));break;case'onlyIfOpen':_0x4184ad[_0x04c1('0x2b')](db[_0x04c1('0x53')][_0x04c1('0x50')](_0xa5da11(_0x3fb641,_0x04c1('0x57')))['then'](function(){})['catch'](_0x2c77f1()));break;default:_0x4184ad[_0x04c1('0x2b')](db['sequelize'][_0x04c1('0x50')](_0x5e7f7e(_0x3fb641,_0x04c1('0x57')))[_0x04c1('0x2a')](function(){})[_0x04c1('0x52')](_0x2c77f1()));}}}return _0x4184ad;})[_0x04c1('0x54')]();})['then'](function(){return db[_0x04c1('0x56')][_0x04c1('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x04c1('0x4d')],'as':_0x04c1('0x55'),'where':{'id':LISTID}}]})[_0x04c1('0x2a')](function(_0x3614d5){var _0x58793e=[];if(_0x3614d5){for(var _0x8bcead=0x0,_0x3f906f;_0x8bcead<_0x3614d5['length'];_0x8bcead+=0x1){_0x3f906f=_0x3614d5[_0x8bcead][_0x04c1('0x58')]({'plain':!![]});_0x58793e[_0x04c1('0x2b')](db[_0x04c1('0x53')][_0x04c1('0x50')](_0x319c7d(_0x3f906f,'CampaignId'))[_0x04c1('0x2a')](function(){})[_0x04c1('0x52')](_0x2c77f1()));}}return _0x58793e;})[_0x04c1('0x54')]();})[_0x04c1('0x52')](function(_0x3cb7e5){logger[_0x04c1('0x13')](_0x04c1('0x59'),_0x04c1('0x5a'),_0x3cb7e5['message']);});}var processPromises=function(_0x3f78df){return BPromise[_0x04c1('0x54')](promises)[_0x04c1('0x2a')](function(_0x55bdf0){})[_0x04c1('0x52')](function(_0x695afa){logger['error'](_0x04c1('0x5b'),JSON[_0x04c1('0x2d')](_0x695afa));})[_0x04c1('0x5c')](function(){socket[_0x04c1('0x5d')](_0x04c1('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3f78df){return _0x3f78df[_0x04c1('0x5f')]();}});};var endCsv=function(){return BPromise[_0x04c1('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x04c1('0x2a')](function(){socket[_0x04c1('0x5d')](_0x04c1('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xb9ac36){logger[_0x04c1('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x04c1('0x2d')](_0xb9ac36));}finally{process[_0x04c1('0x61')](0x0);}});};process['on'](_0x04c1('0x62'),function(){logger[_0x04c1('0x63')](_0x04c1('0x64'));endCsv();});function main(){return BPromise[_0x04c1('0x60')]()[_0x04c1('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x04c1('0xd')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x04c1('0x2a')](function(_0x5e207d){var _0x46d9ab=fs[_0x04c1('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x04c1('0x66')](_0x46d9ab,{'header':!![],'skipEmptyLines':!![],'step':function(_0x24d850,_0x1892e7){total+=0x1;var _0x2e559f=total;promises['push'](checkRow(_0x24d850,_0x5e207d,_0x2e559f)[_0x04c1('0x2a')](function(){success+=0x1;})[_0x04c1('0x52')](function(_0xe9006){if(_0xe9006[_0x04c1('0x13')]){errors+=0x1;delete _0xe9006[_0x04c1('0x13')];}else if(_0xe9006[_0x04c1('0x26')]){duplicates+=0x1;delete _0xe9006[_0x04c1('0x26')];}rows[_0x04c1('0x2b')](_0xe9006);}));if(total%0xc8===0x0){_0x1892e7['pause']();return processPromises(_0x1892e7);}},'complete':function(){return processPromises()[_0x04c1('0x2a')](function(){logger[_0x04c1('0x63')](_0x04c1('0x67'));endCsv();});},'error':function(_0x4b2d66,_0x1e9661){logger[_0x04c1('0x63')](_0x04c1('0x68'),JSON[_0x04c1('0x2d')](_0x4b2d66));endCsv();}});})[_0x04c1('0x52')](function(_0x14760b){logger[_0x04c1('0x13')](_0x04c1('0x69'),JSON[_0x04c1('0x2d')](_0x14760b));});}main();
\ No newline at end of file