Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / user / user.controller.js
index a51cf52..9f1376e 100644 (file)
@@ -1 +1 @@
-const a648_0x2aab=['whatsapp','addMailInteractions','UserId','sequelize','color','Use','Queue:save','generateApiKey','telephone','../../config/license/util','oldPassword','removeChatWebsites','getVoiceQueues','Team','whoami','catch','100','Agents','bulkCreate','voicePause','filter','securePassword','phone','isEmpty','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','offset','getDataValue','channel','file','MailAccount','transaction','user_has_openchannel_interactions:save','options','getAvatar','$not','undefined','get','$and','removeOpenchannelInteractions','addWhatsappAccounts','removeOpenchannelAccounts','getFaxAccounts','QueueId','105','join','passwordHistoryLimit','email','settingsEnabled','differenceBy','addSquareProjects','107','omit','add','CmContact','Queues','files/images/','jayson/promise','getScheduledCalls','user_has_sms_interactions:save','$eq','fullname','Users','user_has_fax_interactions:remove','apiKeyIat','FaxInteraction','removeSquareProjects','debug','Whatsapp','removeApiKey','each','findByPk','user','List','Voice','max','Contact','getChatInteractions','include','toLowerCase','agent','lodash','removeQueues','UserProfileSection','removeWhatsappInteractions','getWhatsappAccounts','findOne','lower','token','SmsInteraction','ids','merge','getSmsInteractions','params','count','capitalize','isArray','sendStatus','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','%s%s','getVoiceQueuesRt','user:forcelogout','forEach','upsert','min_internal','MailInteraction','enforcePasswordHistory','rawAttributes','../../components/auth/service','ChatGroup','ignore','VoicePrefix','message','body','lastName','addFaxAccounts','101','Tags','headers','like','removeWhatsappAccounts','remove','download','SIP/%s','addChatWebsites','addWhatsappInteractions','http','removeSmsAccounts','UserVoiceQueue.penalty','user_has_chat_interactions:remove','addFaxInteractions','Unknown\x20channel','getContacts','user_has_openchannel_interactions:remove','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','flatten','autoAssociation','removeTeams','rows','getChatWebsites','remoteAddress','where','server/files/images/logos/default_profile.png','114','OpenchannelInteraction','intersection','Invalid\x20body\x20format.\x20Use\x20newPassword','destroy','Tag','retrieveApiKey','key','concat','request','addAvatar','type','user_has_sms_interactions:remove','format','103','set','user:%s','removeMailAccounts','values','PAUSE','Fax','getAgents','removeChatInteractions','Mail','VoiceQueue','../../config/environment','VoiceRecording','fax','voicemail','nolimit','addContacts','user_has_whatsapp_interactions:save','removeFaxInteractions','getMailInteractions','DEFAULT\x20PAUSE','removeFaxAccounts','getOpenchannelAccounts','changePassword','emit','Telephones','getWhatsappQueues','addTeams','removeMailInteractions','tag','filters','stringify','order','WhatsappInteraction','pick','root','isNil','111','addOpenchannelInteractions','LOGININPAUSE','attributes','push','addSmsAccounts','json','internal','getMailQueues','user_has_mail_interactions:remove','findAll','user_has_fax_interactions:save','getSmsQueues','../../config/logger','SELECT','chatPause','QueuePause','newPassword','includeAll','socket','CmList','fieldName','permissions','User','model','from','getSquareProjects','ChatInteraction','getChannels','getScreenRecordings','find','addOpenchannelAccounts','sort','$notILike','role','userpic','all','YYYY-MM-DD\x20HH:mm:ss','and','Pause','getSmsAccounts','code','setDataValue','voice','getRecordings','No\x20API\x20access\x20key\x20found!','108','compact','resolve','getOpenchannelInteractions','UserVoiceQueueRt','MemberReport','firstName','UserProfileResource','existsSync','Unknown\x20role','faxPause','password','interface','result','send','getOpenchannelQueues','LOGIN','online','some','checkUserLimits','getLists','create','updatePasswordsHistory','query','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','iat','stack','removeSmsInteractions','ChatWebsite','map','113','Unauthorized','keys','$like','includes','client','getChatQueues','user_has_chat_interactions:save','104','WhatsappAccount','User,\x20%s,\x20%s','pause','addChatInteractions','limit','penalty','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','fields','authenticate','mobile','getMailAccounts','getTeams','userProfileId','addMailAccounts','getWhatsappInteractions','isMiddleware','$gt','nonce','describe','../../components/parsers/qs','length','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getGroups','dialActive','then','moment','logout','../../config/utils','Queue','LOCAL/%s@from-sip/n','whatsapppause','addQueues','getVoicePrefixes','$notBetween','info','$lte','$overlap','SmsAccount','$lt','getFaxQueues','salt','FaxAccount','request\x20sent','chat','util','status','loginInPause','Openchannel','isValidChannel','value','update','CmHopper','validatePasswordPattern','pauseType','getFaxInteractions','mail','106','admin','index','Sms','unpause','manual','API\x20key\x20not\x20available','x-forwarded-for','error','name','VoiceMail','ScreenRecording','createApiKey','Wrong\x20credentials','end'];(function(_0x2de9ba,_0x2aab49){const _0x254fc7=function(_0x2a0236){while(--_0x2a0236){_0x2de9ba['push'](_0x2de9ba['shift']());}};_0x254fc7(++_0x2aab49);}(a648_0x2aab,0xdc));const a648_0x254f=function(_0x2de9ba,_0x2aab49){_0x2de9ba=_0x2de9ba-0x0;let _0x254fc7=a648_0x2aab[_0x2de9ba];return _0x254fc7;};const _0x1a4ed3=a648_0x254f;'use strict';const moment=require(_0x1a4ed3('0x53')),util=require(_0x1a4ed3('0x66')),path=require('path'),fs=require('fs'),_=require(_0x1a4ed3('0xd1')),{getSocket}=require('../../rediscache'),socket=getSocket(),authService=require(_0x1a4ed3('0xec')),qs=require(_0x1a4ed3('0x4d')),logger=require(_0x1a4ed3('0x14f'))('api'),utils=require(_0x1a4ed3('0x55')),config=require(_0x1a4ed3('0x128')),db=require('../../mysqldb')['db'],{Op,QueryTypes,fn,col,where,ValidationError}=require('sequelize'),licenseUtil=require(_0x1a4ed3('0x8a'));require('./user.socket')['register'](socket);const jayson=require(_0x1a4ed3('0xb9')),client=jayson[_0x1a4ed3('0x36')][_0x1a4ed3('0xfe')]({'port':0x232a});function respondWithRpcPromise(_0x2a0236,_0x44804f,_0x462b93,_0x50057f){return new Promise(function(_0x54ec30,_0x1613ba){const _0x55fddd=a648_0x254f,_0x368735=_0x50057f||client;return _0x368735[_0x55fddd('0x118')](_0x2a0236,_0x462b93)[_0x55fddd('0x52')](function(_0x45e2d4){const _0xbde108=_0x55fddd;logger['info'](_0xbde108('0x3b'),_0x44804f,_0xbde108('0x64')),logger[_0xbde108('0xc3')]('User,\x20%s,\x20%s,\x20%s',_0x44804f,_0xbde108('0x64'),JSON[_0xbde108('0x13c')](_0x45e2d4));if(_0x45e2d4[_0xbde108('0x7a')]){if(_0x45e2d4['error'][_0xbde108('0xe')]===0x1f4)return logger[_0xbde108('0x7a')]('User,\x20%s,\x20%s',_0x44804f,_0x45e2d4[_0xbde108('0x7a')][_0xbde108('0xf0')]),_0x1613ba(_0x45e2d4[_0xbde108('0x7a')]['message']);return logger['error']('User,\x20%s,\x20%s',_0x44804f,_0x45e2d4['error'][_0xbde108('0xf0')]),_0x54ec30(_0x45e2d4[_0xbde108('0x7a')]['message']);}else logger[_0xbde108('0x5c')](_0xbde108('0x3b'),_0x44804f,_0xbde108('0x64')),_0x54ec30(_0x45e2d4[_0xbde108('0x20')][_0xbde108('0xf0')]);})['catch'](function(_0x53dc4f){const _0x141f40=_0x55fddd;logger[_0x141f40('0x7a')](_0x141f40('0x3b'),_0x44804f,_0x53dc4f),_0x1613ba(_0x53dc4f);});});}function respondWithStatusCode(_0x3cd087,_0xec6729){return _0xec6729=_0xec6729||0xcc,function(_0x39a22b){const _0x38350f=a648_0x254f;if(_0x39a22b)return _0x3cd087[_0x38350f('0xe1')](_0xec6729);return _0x3cd087[_0x38350f('0x67')](_0xec6729)[_0x38350f('0x80')]();};}function respondWithResult(_0x153bee,_0x196a2a){return _0x196a2a=_0x196a2a||0xc8,function(_0x271605){if(_0x271605)return _0x153bee['status'](_0x196a2a)['json'](_0x271605);};}function respondWithFilteredResult(_0x4e88b1,_0x5a2303){return function(_0x4bc8b2){const _0x32da20=a648_0x254f;if(_0x4bc8b2){const _0x239018=_0x4bc8b2[_0x32da20('0xde')],_0x3882bd=_0x5a2303['offset'];let _0x1a61d7=_0x5a2303[_0x32da20('0x9a')]+_0x5a2303[_0x32da20('0x3e')],_0x1c4d61;return _0x1a61d7>=_0x239018?(_0x1a61d7=_0x239018,_0x1c4d61=0xc8):_0x1c4d61=0xce,_0x4e88b1['status'](_0x1c4d61),_0x4e88b1[_0x32da20('0x11e')]('Content-Range',_0x3882bd+'-'+_0x1a61d7+'/'+_0x239018)['json'](_0x4bc8b2);}return null;};}function saveUpdates(_0x132d24){return function(_0x2be50c){const _0x20259c=a648_0x254f;if(_0x2be50c)return _0x2be50c[_0x20259c('0x6c')](_0x132d24)[_0x20259c('0x52')](function(_0x181a91){return _0x181a91;});return null;};}function removeEntity(_0x567c8d){return function(_0x4ed31b){const _0x59543b=a648_0x254f;if(_0x4ed31b)return _0x4ed31b[_0x59543b('0x113')]()[_0x59543b('0x52')](function(){const _0x47119a=_0x59543b,_0x30fa45=_0x4ed31b[_0x47119a('0xa5')]({'plain':!![]});if(_0x30fa45[_0x47119a('0x7')]===_0x47119a('0x73'))return;const _0x570012=[{'name':_0x47119a('0xbe'),'value':'user','ignore':!![]},{'name':_0x47119a('0x92'),'value':_0x47119a('0xd0'),'ignore':![]},{'name':_0x47119a('0x136'),'value':_0x47119a('0x89'),'ignore':![]}],_0x3d113e=_(_0x570012)['filter'](_0x47119a('0xee'))[_0x47119a('0x30')](_0x47119a('0x6b'))['value']();if(_[_0x47119a('0x35')](_0x3d113e,_0x30fa45['role']))return;const _0x540561=_[_0x47119a('0x3')](_0x570012,[_0x47119a('0x6b'),_0x30fa45['role']])[_0x47119a('0x7b')];return db[_0x47119a('0x1a')][_0x47119a('0x113')]({'where':{'type':_0x540561,'resourceId':_0x30fa45['id']}})[_0x47119a('0x52')](function(){return _0x4ed31b;});})[_0x59543b('0x52')](function(){const _0x404a68=_0x59543b;_0x567c8d['status'](0xcc)[_0x404a68('0x80')]();});};}function handleEntityNotFound(_0x1af12a){return function(_0x5278d5){return!_0x5278d5&&_0x1af12a['sendStatus'](0x194),_0x5278d5;};}function handleError(_0x487688,_0x2ecec1){return _0x2ecec1=_0x2ecec1||0x1f4,function(_0x399240){const _0x1c3686=a648_0x254f;logger[_0x1c3686('0x7a')](_0x399240[_0x1c3686('0x2d')]),_0x399240[_0x1c3686('0x7b')]&&delete _0x399240[_0x1c3686('0x7b')],_0x487688[_0x1c3686('0x67')](_0x2ecec1)[_0x1c3686('0x21')](_0x399240);};}function validateUser(_0x52009f){return new Promise(function(_0x76425e,_0x32d28a){const _0x3e6b91=a648_0x254f;if(_0x52009f[_0x3e6b91('0x149')])return _0x76425e(_0x52009f);return db['Setting'][_0x3e6b91('0xc7')](0x1)[_0x3e6b91('0x52')](function(_0x3a64aa){const _0x3e03cf=_0x3e6b91;if(_0x3a64aa[_0x3e03cf('0x96')])authService['validatePasswordPattern'](_0x52009f['password']);db[_0x3e03cf('0x159')][_0x3e03cf('0xcb')](_0x3e03cf('0x149'))[_0x3e03cf('0x52')](function(_0x2f9b93){const _0x58fcdc=_0x3e03cf;if(_[_0x58fcdc('0x141')](_0x2f9b93)){_0x52009f[_0x58fcdc('0x149')]=_0x3a64aa[_0x58fcdc('0xe8')]||0x1;return;}if(_['isNil'](_0x3a64aa['min_internal'])||_0x3a64aa['min_internal']===_0x2f9b93){_0x52009f['internal']=_0x2f9b93+0x1;return;}if(_0x3a64aa[_0x58fcdc('0xe8')]>_0x2f9b93){_0x52009f['internal']=_0x3a64aa[_0x58fcdc('0xe8')];return;}return db[_0x58fcdc('0x84')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':QueryTypes[_0x58fcdc('0x150')]})[_0x58fcdc('0x52')](function(_0x1d82c5){const _0x1a5018=_0x58fcdc;if(_0x1d82c5&&_0x1d82c5[_0x1a5018('0x4e')])for(let _0x56160f=0x0,_0x201f37=_0x1d82c5['length'];_0x56160f<_0x201f37&&_[_0x1a5018('0x141')](_0x52009f[_0x1a5018('0x149')]);_0x56160f++){if(_0x3a64aa[_0x1a5018('0xe8')]<=_0x1d82c5[_0x56160f][_0x1a5018('0x15b')])_0x52009f[_0x1a5018('0x149')]=_0x1d82c5[_0x56160f][_0x1a5018('0x15b')];else _0x3a64aa['min_internal']>_0x1d82c5[_0x56160f][_0x1a5018('0x15b')]&&_0x3a64aa[_0x1a5018('0xe8')]<=_0x1d82c5[_0x56160f]['to']&&(_0x52009f[_0x1a5018('0x149')]=_0x3a64aa[_0x1a5018('0xe8')]);}return _[_0x1a5018('0x141')](_0x52009f[_0x1a5018('0x149')])&&(_0x52009f['internal']=_0x2f9b93+0x1),_0x76425e(_0x52009f);});});})[_0x3e6b91('0x90')](function(_0x4ee233){_0x32d28a(_0x4ee233);});});}function updateUser(_0x9a3773){return new Promise(function(_0x32e7f1,_0x1d1970){const _0x5c589e=a648_0x254f;try{_0x9a3773[_0x5c589e('0x12b')]&&(_0x9a3773['mailbox']=_0x9a3773[_0x5c589e('0x149')],_0x9a3773['VoiceMail']={'mailbox':_0x9a3773[_0x5c589e('0x149')],'password':_0x9a3773[_0x5c589e('0x1e')],'fullname':_0x9a3773[_0x5c589e('0xbd')],'email':_0x9a3773[_0x5c589e('0xaf')]});if(_0x9a3773[_0x5c589e('0x7')]===_0x5c589e('0xd0')){if(!_0x9a3773[_0x5c589e('0x158')])_0x9a3773[_0x5c589e('0x158')]=[_0x5c589e('0xf4'),'102',_0x5c589e('0x11d'),_0x5c589e('0x31'),'110',_0x5c589e('0x39'),_0x5c589e('0xac'),_0x5c589e('0x72'),_0x5c589e('0xb3'),_0x5c589e('0x13'),'109',_0x5c589e('0x91'),_0x5c589e('0x142'),_0x5c589e('0x10f')];}_0x32e7f1(_0x9a3773);}catch(_0x5c3236){_0x1d1970(_0x5c3236);}});}exports[_0x1a4ed3('0x74')]=function(_0x5b3a09,_0xfc642d){const _0x2f96bc=_0x1a4ed3;let _0x1a2110={};const _0x17125c={},_0xfd42e1={'count':0x0,'rows':[]},_0x129b1b=_[_0x2f96bc('0x30')](db[_0x2f96bc('0x159')][_0x2f96bc('0xeb')],function(_0x275f60){const _0x3c5d9f=_0x2f96bc;return{'name':_0x275f60[_0x3c5d9f('0x157')],'type':_0x275f60[_0x3c5d9f('0x11a')][_0x3c5d9f('0x116')]};});_0x17125c[_0x2f96bc('0x15a')]=_[_0x2f96bc('0xb1')](_[_0x2f96bc('0x30')](_0x129b1b,_0x2f96bc('0x7b')),[_0x2f96bc('0x1e'),_0x2f96bc('0x62')]),_0x17125c[_0x2f96bc('0x2a')]=_['keys'](_0x5b3a09[_0x2f96bc('0x2a')]),_0x17125c[_0x2f96bc('0x13b')]=_[_0x2f96bc('0x111')](_0x17125c[_0x2f96bc('0x15a')],_0x17125c[_0x2f96bc('0x2a')]),_0x1a2110[_0x2f96bc('0x145')]=_['intersection'](_0x17125c[_0x2f96bc('0x15a')],qs['fields'](_0x5b3a09[_0x2f96bc('0x2a')][_0x2f96bc('0x41')])),_0x1a2110['attributes']=_0x1a2110[_0x2f96bc('0x145')][_0x2f96bc('0x4e')]?_0x1a2110[_0x2f96bc('0x145')]:_0x17125c[_0x2f96bc('0x15a')];typeof _0x5b3a09[_0x2f96bc('0x2a')][_0x2f96bc('0x12c')]==='undefined'&&(_0x1a2110[_0x2f96bc('0x3e')]=qs[_0x2f96bc('0x3e')](_0x5b3a09[_0x2f96bc('0x2a')][_0x2f96bc('0x3e')]),_0x1a2110['offset']=qs[_0x2f96bc('0x9a')](_0x5b3a09['query'][_0x2f96bc('0x9a')]));_0x1a2110[_0x2f96bc('0x13d')]=qs[_0x2f96bc('0x5')](_0x5b3a09[_0x2f96bc('0x2a')][_0x2f96bc('0x5')]),_0x1a2110[_0x2f96bc('0x10d')]=qs[_0x2f96bc('0x13b')](_[_0x2f96bc('0x13f')](_0x5b3a09[_0x2f96bc('0x2a')],_0x17125c[_0x2f96bc('0x13b')]),_0x129b1b);_0x5b3a09['query']['filter']&&(_0x1a2110[_0x2f96bc('0x10d')]=_[_0x2f96bc('0xdb')](_0x1a2110[_0x2f96bc('0x10d')],{[Op['or']]:_['map'](_0x129b1b,function(_0x47c600){const _0x6b05c9=_0x2f96bc;if(_0x47c600[_0x6b05c9('0x11a')]!=='VIRTUAL')return where(fn(_0x6b05c9('0xd7'),col(_0x47c600[_0x6b05c9('0x7b')])),{'$like':fn(_0x6b05c9('0xd7'),'%'+_0x5b3a09['query'][_0x6b05c9('0x95')]+'%')});})}));_0x1a2110=_[_0x2f96bc('0xdb')]({},_0x1a2110,_0x5b3a09[_0x2f96bc('0xa1')]);const _0x4f9b10={'where':_0x1a2110['where']};return db[_0x2f96bc('0x159')]['count'](_0x4f9b10)[_0x2f96bc('0x52')](function(_0xe0613d){const _0x2fdcf2=_0x2f96bc;return _0xfd42e1[_0x2fdcf2('0xde')]=_0xe0613d,typeof _0x5b3a09[_0x2fdcf2('0x2a')]['includeAll']!==_0x2fdcf2('0xa4')&&(_0x1a2110[_0x2fdcf2('0xce')]=[{'all':!![]}]),db[_0x2fdcf2('0x159')][_0x2fdcf2('0x14c')](_0x1a2110);})[_0x2f96bc('0x52')](function(_0x5531bb){const _0x4621f5=_0x2f96bc;return _0xfd42e1[_0x4621f5('0x10a')]=_0x5531bb,_0xfd42e1;})[_0x2f96bc('0x52')](respondWithFilteredResult(_0xfc642d,_0x1a2110))[_0x2f96bc('0x90')](handleError(_0xfc642d,null));},exports['show']=function(_0x4d5ab5,_0x3f1d5c){const _0x4db703=_0x1a4ed3;let _0x59a962={'raw':![],'where':{'id':_0x4d5ab5[_0x4db703('0xdd')]['id']}};const _0x3ca670={};return _0x3ca670['model']=_['differenceBy'](_['keys'](db['User']['rawAttributes']),['password',_0x4db703('0x62')]),_0x3ca670['query']=_[_0x4db703('0x33')](_0x4d5ab5['query']),_0x3ca670[_0x4db703('0x13b')]=_[_0x4db703('0x111')](_0x3ca670[_0x4db703('0x15a')],_0x3ca670[_0x4db703('0x2a')]),_0x59a962['attributes']=_[_0x4db703('0x111')](_0x3ca670[_0x4db703('0x15a')],qs['fields'](_0x4d5ab5[_0x4db703('0x2a')][_0x4db703('0x41')])),_0x59a962[_0x4db703('0x145')]=_0x59a962[_0x4db703('0x145')][_0x4db703('0x4e')]?_0x59a962['attributes']:_0x3ca670[_0x4db703('0x15a')],_0x4d5ab5[_0x4db703('0x2a')][_0x4db703('0x154')]&&(_0x59a962['include']=[{'all':!![]}]),_0x59a962=_[_0x4db703('0xdb')]({},_0x59a962,_0x4d5ab5[_0x4db703('0xa1')]),db[_0x4db703('0x159')]['findOne'](_0x59a962)[_0x4db703('0x52')](handleEntityNotFound(_0x3f1d5c,null))['then'](respondWithResult(_0x3f1d5c,null))[_0x4db703('0x90')](handleError(_0x3f1d5c,null));},exports['bulkCreate']=function(_0x135c5e,_0x401ae7){const _0x1a2ee3=_0x1a4ed3,_0x9d6db8=_0x135c5e[_0x1a2ee3('0xf1')];let _0x2ae065=[];if(_0x135c5e['user'][_0x1a2ee3('0x7')]===_0x1a2ee3('0xd0'))throw new Error(_0x1a2ee3('0x32'));if(_['some'](_0x9d6db8,[_0x1a2ee3('0x7'),_0x1a2ee3('0xc8')])&&_0x135c5e['user'][_0x1a2ee3('0x7')]!=='admin')throw new Error(_0x1a2ee3('0x40'));if(_['some'](_0x9d6db8,['role',_0x1a2ee3('0x73')])&&_0x135c5e[_0x1a2ee3('0xc8')][_0x1a2ee3('0x7')]!==_0x1a2ee3('0x73'))throw new Error(_0x1a2ee3('0x99'));return licenseUtil[_0x1a2ee3('0x26')](_0x9d6db8)[_0x1a2ee3('0x52')](function(){return validateUser(_0x9d6db8[0x0]);})['then'](function(){const _0x107437=_0x1a2ee3;for(let _0x202400=0x1;_0x202400<_0x9d6db8[_0x107437('0x4e')];_0x202400++){const _0x57060a=_0x9d6db8[_0x202400-0x1]['internal'];if(!_0x9d6db8[_0x202400][_0x107437('0x149')])_0x9d6db8[_0x202400][_0x107437('0x149')]=_0x57060a+0x1;_0x2ae065[_0x107437('0x146')](validateUser(_0x9d6db8[_0x202400]));}return Promise[_0x107437('0x9')](_0x2ae065);})[_0x1a2ee3('0x52')](function(){const _0x348acb=_0x1a2ee3;_0x2ae065=[];for(let _0x218bcb=0x0;_0x218bcb<_0x9d6db8[_0x348acb('0x4e')];_0x218bcb++){_0x2ae065[_0x348acb('0x146')](updateUser(_0x9d6db8[_0x218bcb]));}return Promise[_0x348acb('0x9')](_0x2ae065);})['then'](function(){const _0x18de0f=_0x1a2ee3;return _0x2ae065=_0x9d6db8[_0x18de0f('0x30')](_0x6ab710=>{const _0x5e5c0f=_0x18de0f;return db[_0x5e5c0f('0x159')][_0x5e5c0f('0x28')](_0x6ab710,{'include':[{'model':db[_0x5e5c0f('0x7c')],'as':'VoiceMail'}]})[_0x5e5c0f('0x52')](function(_0x3c0bc9){return _0x6ab710['id']=_0x3c0bc9['id'],_0x6ab710;});}),Promise['all'](_0x2ae065);})[_0x1a2ee3('0x52')](function(_0x38086e){const _0x30372b=_0x1a2ee3;if(_0x135c5e[_0x30372b('0xf1')][_0x30372b('0x7')]===_0x30372b('0xc8'))return _0x38086e;if(_0x135c5e[_0x30372b('0xc8')]['role']!==_0x30372b('0xc8'))return _0x38086e;const _0xa60ecc=_['some'](_0x38086e,function(_0x37e87e){const _0xf7388c=_0x30372b;return _0x37e87e[_0xf7388c('0x7')]===_0xf7388c('0xd0')||_0x37e87e[_0xf7388c('0x7')]===_0xf7388c('0x89');});if(!_0xa60ecc)return _0x38086e;return db['UserProfileSection']['findAll']({'where':{'name':{[Op['or']]:[_0x30372b('0x92'),_0x30372b('0x136')]},'userProfileId':_0x135c5e[_0x30372b('0xc8')]['userProfileId']},'raw':!![]})[_0x30372b('0x52')](function(_0x17c7f5){const _0x3ab3e6=_0x30372b;if(_[_0x3ab3e6('0x98')](_0x17c7f5)||!_[_0x3ab3e6('0x25')](_0x17c7f5,[_0x3ab3e6('0x108'),0x0]))return _0x38086e;_0x2ae065=[];const _0x530658=_(_0x17c7f5)[_0x3ab3e6('0x30')](function(_0x5f5e0e){const _0x209911=_0x3ab3e6;if(_0x5f5e0e[_0x209911('0x108')]===0x1)return;return _0x5f5e0e[_0x209911('0x7b')]===_0x209911('0x92')?_0x209911('0xd0'):_0x209911('0x89');})[_0x3ab3e6('0x14')]()[_0x3ab3e6('0x6b')]();for(let _0x2f429c=0x0;_0x2f429c<_0x38086e[_0x3ab3e6('0x4e')];_0x2f429c++){if(!_[_0x3ab3e6('0x35')](_0x530658,_0x38086e[_0x2f429c]['role']))return;const _0x3d6723=_0x38086e[_0x2f429c][_0x3ab3e6('0x7')]===_0x3ab3e6('0xd0')?_0x3ab3e6('0x92'):'Telephones';_0x2ae065[_0x3ab3e6('0x146')](db[_0x3ab3e6('0x1a')][_0x3ab3e6('0x28')]({'name':_0x38086e[_0x2f429c][_0x3ab3e6('0x7b')],'resourceId':_0x38086e[_0x2f429c]['id'],'type':_0x3d6723,'sectionId':_[_0x3ab3e6('0x3')](_0x17c7f5,[_0x3ab3e6('0x7b'),_0x3d6723])['id']},{}));}return Promise[_0x3ab3e6('0x9')](_0x2ae065);});})[_0x1a2ee3('0x52')](respondWithResult(_0x401ae7,0xc9))[_0x1a2ee3('0x90')](handleError(_0x401ae7,null));},exports[_0x1a4ed3('0x6c')]=function(_0x54a82d,_0x388626){const _0x3c24f7=_0x1a4ed3;return _0x54a82d[_0x3c24f7('0xf1')]['id']&&delete _0x54a82d['body']['id'],delete _0x54a82d[_0x3c24f7('0xf1')][_0x3c24f7('0x7')],db[_0x3c24f7('0x159')][_0x3c24f7('0xd6')]({'where':{'id':_0x54a82d['params']['id']}})[_0x3c24f7('0x52')](handleEntityNotFound(_0x388626,null))['then'](saveUpdates(_0x54a82d['body'],null))['then'](respondWithResult(_0x388626,null))[_0x3c24f7('0x90')](handleError(_0x388626,null));},exports[_0x1a4ed3('0x4c')]=function(_0x550843,_0x35e4d0){const _0x57a1a2=_0x1a4ed3;return db[_0x57a1a2('0x159')][_0x57a1a2('0x4c')]()[_0x57a1a2('0x52')](respondWithResult(_0x35e4d0,null))[_0x57a1a2('0x90')](handleError(_0x35e4d0,null));},exports['addContacts']=function(_0x136f97,_0x26f2ce){const _0x1965ae=_0x1a4ed3;return db[_0x1965ae('0x159')][_0x1965ae('0xd6')]({'where':{'id':_0x136f97[_0x1965ae('0xdd')]['id']}})[_0x1965ae('0x52')](handleEntityNotFound(_0x26f2ce,null))[_0x1965ae('0x52')](function(_0x3f5ae3){const _0x464a04=_0x1965ae;if(_0x3f5ae3)return _0x3f5ae3[_0x464a04('0x12d')](_0x136f97['body'][_0x464a04('0xda')],{'through':_['omit'](_0x136f97['body'],[_0x464a04('0xda'),'id'])});})[_0x1965ae('0x52')](respondWithResult(_0x26f2ce,null))[_0x1965ae('0x90')](handleError(_0x26f2ce,null));},exports['create']=function(_0x116d9a,_0x349daf){const _0x5b5e2a=_0x1a4ed3;if(_0x116d9a['user'][_0x5b5e2a('0x7')]===_0x5b5e2a('0xd0'))throw new Error(_0x5b5e2a('0x32'));if(_0x116d9a[_0x5b5e2a('0xf1')][_0x5b5e2a('0x7')]===_0x5b5e2a('0xc8')&&_0x116d9a[_0x5b5e2a('0xc8')][_0x5b5e2a('0x7')]!==_0x5b5e2a('0x73'))throw new Error(_0x5b5e2a('0x40'));if(_0x116d9a['body']['role']===_0x5b5e2a('0x73')&&_0x116d9a[_0x5b5e2a('0xc8')][_0x5b5e2a('0x7')]!==_0x5b5e2a('0x73'))throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');return licenseUtil[_0x5b5e2a('0x26')]([_0x116d9a[_0x5b5e2a('0xf1')]])[_0x5b5e2a('0x52')](function(){const _0x52129d=_0x5b5e2a;return validateUser(_0x116d9a[_0x52129d('0xf1')]);})[_0x5b5e2a('0x52')](function(_0x1a18fe){const _0x4c3653=_0x5b5e2a;return updateUser(_0x1a18fe)[_0x4c3653('0x52')](function(_0xd666ff){const _0xc39b1b=_0x4c3653;return _0xd666ff[_0xc39b1b('0x7')]===_0xc39b1b('0x73')&&(_0xd666ff[_0xc39b1b('0xb0')]=_0x116d9a['user'][_0xc39b1b('0xb0')],delete _0xd666ff[_0xc39b1b('0x46')]),_0xd666ff;});})[_0x5b5e2a('0x52')](function(_0x2ac0af){const _0xb08317=_0x5b5e2a;return db[_0xb08317('0x159')][_0xb08317('0x28')](_0x2ac0af,{'include':[{'model':db['VoiceMail'],'as':_0xb08317('0x7c')}]});})[_0x5b5e2a('0x52')](function(_0xb686c4){const _0x37951b=_0x5b5e2a;if(_0x116d9a[_0x37951b('0xf1')][_0x37951b('0x7')]===_0x37951b('0xc8'))return _0xb686c4;if(_0x116d9a[_0x37951b('0xc8')]['role']!==_0x37951b('0xc8'))return _0xb686c4;return db[_0x37951b('0xd3')][_0x37951b('0xd6')]({'where':{'name':_0xb686c4[_0x37951b('0x7')]===_0x37951b('0xd0')?_0x37951b('0x92'):_0x37951b('0x136'),'userProfileId':_0x116d9a['user'][_0x37951b('0x46')]},'raw':!![]})[_0x37951b('0x52')](function(_0x6e5efc){const _0x2d3f02=_0x37951b;if(!_0x6e5efc||_0x6e5efc[_0x2d3f02('0x108')]!=0x0)return _0xb686c4;return db[_0x2d3f02('0x1a')][_0x2d3f02('0x28')]({'name':_0xb686c4[_0x2d3f02('0x7b')],'resourceId':_0xb686c4['id'],'type':_0x6e5efc['name'],'sectionId':_0x6e5efc['id']},{})['then'](function(){return _0xb686c4;});})['catch'](function(_0x304a5e){const _0x45aa01=_0x37951b;logger[_0x45aa01('0x7a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x304a5e);throw _0x304a5e;});})[_0x5b5e2a('0x52')](respondWithResult(_0x349daf,0xc9))[_0x5b5e2a('0x90')](handleError(_0x349daf,null));},exports[_0x1a4ed3('0x134')]=function(_0x34ea56,_0x46c226){const _0x4efcb1=_0x1a4ed3;if(_0x34ea56[_0x4efcb1('0xf1')]['id'])delete _0x34ea56[_0x4efcb1('0xf1')]['id'];return db[_0x4efcb1('0x159')][_0x4efcb1('0xd6')]({'where':{'id':_0x34ea56[_0x4efcb1('0xdd')]['id']}})['then'](function(_0x4ef4e4){const _0x4234b5=_0x4efcb1;if(!_0x4ef4e4)return null;if(_0x4ef4e4['id']===_0x34ea56[_0x4234b5('0xc8')]['id']){if(!_0x34ea56[_0x4234b5('0xf1')][_0x4234b5('0x8b')]||!_0x34ea56[_0x4234b5('0xf1')][_0x4234b5('0x153')])throw new ValidationError(_0x4234b5('0xe2'));if(!_0x4ef4e4[_0x4234b5('0x42')](_0x34ea56[_0x4234b5('0xf1')]['oldPassword']))throw new ValidationError(_0x4234b5('0x7f'));if(_0x34ea56[_0x4234b5('0xf1')][_0x4234b5('0x8b')]===_0x34ea56[_0x4234b5('0xf1')][_0x4234b5('0x153')])throw new ValidationError(_0x4234b5('0x106'));}else{if(_0x34ea56[_0x4234b5('0xc8')][_0x4234b5('0x7')]==='admin'){if(!_0x34ea56[_0x4234b5('0xf1')][_0x4234b5('0x153')])throw new ValidationError(_0x4234b5('0x112'));}else{if(_0x34ea56['user'][_0x4234b5('0x7')]==='user'){if(!_0x34ea56[_0x4234b5('0xf1')][_0x4234b5('0x153')])throw new ValidationError(_0x4234b5('0x112'));if(_0x4ef4e4[_0x4234b5('0x7')]!==_0x4234b5('0xd0'))throw new ValidationError(_0x4234b5('0x32'));}else throw new ValidationError(_0x4234b5('0x32'));}}return _0x4ef4e4;})['then'](handleEntityNotFound(_0x46c226,null))[_0x4efcb1('0x52')](function(_0x5579fb){const _0x1e426b=_0x4efcb1;return db['Setting'][_0x1e426b('0xd6')]({'attributes':['id',_0x1e426b('0x96'),_0x1e426b('0xea'),_0x1e426b('0xae')]})['then'](function(_0x419cbf){const _0x489b9b=_0x1e426b;if(_0x419cbf['securePassword'])authService[_0x489b9b('0x6e')](_0x34ea56['body'][_0x489b9b('0x153')]);if(!_0x419cbf[_0x489b9b('0xea')]||!_0x5579fb['previousPasswords'])return _0x5579fb;return authService['validatePasswordHistory'](_0x34ea56['body'][_0x489b9b('0x153')],_0x5579fb['previousPasswords'],_0x419cbf[_0x489b9b('0xae')]),_0x5579fb;})[_0x1e426b('0x52')](saveUpdates({'password':_0x34ea56['body']['newPassword'],'passwordResetAt':_0x34ea56['user']['id']==_0x34ea56[_0x1e426b('0xdd')]['id']?moment():null,'previousPasswords':authService[_0x1e426b('0x29')](_0x34ea56[_0x1e426b('0xf1')][_0x1e426b('0x153')],_0x5579fb['previousPasswords'])},null));})[_0x4efcb1('0x52')](respondWithResult(_0x46c226,null))[_0x4efcb1('0x90')](handleError(_0x46c226,null));},exports[_0x1a4ed3('0x59')]=function(_0x44daa1,_0x321e50){const _0x43f231=_0x1a4ed3,_0x32b13c=_0x44daa1[_0x43f231('0xf1')][_0x43f231('0x9c')];return db[_0x43f231('0x159')][_0x43f231('0xd6')]({'where':{'id':_0x44daa1[_0x43f231('0xdd')]['id']},'attributes':['id',_0x43f231('0x7b'),_0x43f231('0x7'),_0x43f231('0x24'),'loginInPause',_0x43f231('0x94'),_0x43f231('0x1f')]})['then'](handleEntityNotFound(_0x321e50,null))['then'](function(_0xecb39e){const _0x28bd8f=_0x43f231;if(_0xecb39e){if(!utils[_0x28bd8f('0x6a')](_0x32b13c))throw new ValidationError(_0x28bd8f('0x103'));return _0xecb39e[_0x28bd8f('0xb5')+_['capitalize'](_0x32b13c[_0x28bd8f('0xcf')]())+_0x28bd8f('0xb7')](_0x44daa1['body'][_0x28bd8f('0xda')],{'through':{'penalty':_0x44daa1[_0x28bd8f('0xf1')]['penalty']||0x0}})['then'](function(_0x4fe9b7){const _0x13c979=_0x28bd8f;for(let _0x236ba3=0x0;_0x236ba3<_0x44daa1[_0x13c979('0xf1')][_0x13c979('0xda')]['length'];_0x236ba3+=0x1){const _0x4dc297={'UserId':_0x44daa1[_0x13c979('0xdd')]['id']};_0x4dc297[_[_0x13c979('0xdf')](_0x32b13c[_0x13c979('0xcf')]())+'QueueId']=_0x44daa1[_0x13c979('0xf1')][_0x13c979('0xda')][_0x236ba3],socket[_0x13c979('0x135')](_0x13c979('0xc8')+_[_0x13c979('0xdf')](_0x32b13c[_0x13c979('0xcf')]())+_0x13c979('0x87'),_0x4dc297);}return _0x4fe9b7;})['then'](function(){const _0x2a8873=_0x28bd8f;if(_0x32b13c===_0x2a8873('0x10'))return db[_0x2a8873('0x127')][_0x2a8873('0x14c')]({'where':{'id':_0x44daa1[_0x2a8873('0xf1')]['ids']||[]},'raw':!![],'attributes':['id',_0x2a8873('0x7b')]});})[_0x28bd8f('0x52')](function(_0x42052d){const _0xdfc993=_0x28bd8f,_0x4f9bbb=_0xecb39e[_0xdfc993('0xa5')]({'plain':!![]}),_0x4c3e32=[];if(_0x32b13c===_0xdfc993('0x10')&&_0x4f9bbb['role']==='agent'&&_0x4f9bbb[_0xdfc993('0x24')]){for(let _0x2991e0=0x0;_0x2991e0<_0x42052d['length'];_0x2991e0+=0x1){_0x4c3e32[_0xdfc993('0x146')]({'membername':_0x4f9bbb[_0xdfc993('0x7b')],'UserId':_0x4f9bbb['id'],'queue_name':_0x42052d[_0x2991e0]['name'],'VoiceQueueId':_0x42052d[_0x2991e0]['id'],'interface':_[_0xdfc993('0x141')](_0x4f9bbb[_0xdfc993('0x1f')])?util[_0xdfc993('0x11c')](_0xdfc993('0xfb'),_0x4f9bbb[_0xdfc993('0x7b')]):_0x4f9bbb[_0xdfc993('0x1f')],'paused':_0x4f9bbb['voicePause']||![],'penalty':_0x44daa1[_0xdfc993('0xf1')][_0xdfc993('0x3f')]||0x0});}return Promise['each'](_0x4c3e32,function(_0x28d3cb){const _0x1a1500=_0xdfc993;return db[_0x1a1500('0x17')][_0x1a1500('0xe7')](_0x28d3cb);});}return _0xecb39e;});}})[_0x43f231('0x52')](respondWithStatusCode(_0x321e50,null))[_0x43f231('0x90')](handleError(_0x321e50,null));},exports[_0x1a4ed3('0xd2')]=function(_0x4d8d26,_0x5bb926){const _0x5b11cf=_0x1a4ed3;let _0x18f315;return db[_0x5b11cf('0x159')]['findOne']({'where':{'id':_0x4d8d26[_0x5b11cf('0xdd')]['id']},'attributes':['id','name','role']})[_0x5b11cf('0x52')](handleEntityNotFound(_0x5bb926,null))['then'](function(_0x1b09f0){const _0x3e099f=_0x5b11cf;if(_0x1b09f0){_0x18f315=_0x1b09f0;if(!_0x4d8d26['query'][_0x3e099f('0x9c')]||!utils[_0x3e099f('0x6a')](_0x4d8d26['query'][_0x3e099f('0x9c')]))throw new ValidationError(_0x3e099f('0x103'));return _0x1b09f0[_0x3e099f('0xf9')+_[_0x3e099f('0xdf')](_0x4d8d26[_0x3e099f('0x2a')][_0x3e099f('0x9c')][_0x3e099f('0xcf')]())+_0x3e099f('0xb7')](_0x4d8d26['query'][_0x3e099f('0xda')]);}})[_0x5b11cf('0x52')](function(_0x53c8d4){const _0x5e3945=_0x5b11cf;for(let _0x4bad5a=0x0;_0x4bad5a<_0x4d8d26[_0x5e3945('0x2a')][_0x5e3945('0xda')][_0x5e3945('0x4e')];_0x4bad5a+=0x1){const _0x33f1d5={'UserId':_0x4d8d26['params']['id']};_0x33f1d5[_['capitalize'](_0x4d8d26[_0x5e3945('0x2a')]['channel'][_0x5e3945('0xcf')]())+_0x5e3945('0xab')]=_0x4d8d26[_0x5e3945('0x2a')][_0x5e3945('0xda')][_0x4bad5a],socket[_0x5e3945('0x135')](_0x5e3945('0xc8')+_[_0x5e3945('0xdf')](_0x4d8d26['query'][_0x5e3945('0x9c')]['toLowerCase']())+'Queue:remove',_0x33f1d5);}return _0x53c8d4;})[_0x5b11cf('0x52')](function(){const _0x5007b1=_0x5b11cf;if(_0x4d8d26[_0x5007b1('0x2a')][_0x5007b1('0x9c')]===_0x5007b1('0x10'))return db[_0x5007b1('0x17')][_0x5007b1('0x113')]({'where':{'UserId':_0x4d8d26['params']['id'],'VoiceQueueId':_0x4d8d26[_0x5007b1('0x2a')][_0x5007b1('0xda')]},'individualHooks':!![]})[_0x5007b1('0x52')](function(){return _0x18f315;});return _0x18f315;})[_0x5b11cf('0x52')](respondWithStatusCode(_0x5bb926,null))[_0x5b11cf('0x90')](handleError(_0x5bb926,null));},exports[_0x1a4ed3('0x119')]=function(_0x4cfcb7,_0x3a70e3){const _0x52cc78=_0x1a4ed3;return _0x4cfcb7['body'][_0x52cc78('0x8')]=_0x4cfcb7[_0x52cc78('0x9d')]['filename'],db[_0x52cc78('0x159')][_0x52cc78('0xd6')]({'where':{'id':_0x4cfcb7['params']['id']}})['then'](handleEntityNotFound(_0x3a70e3,null))['then'](saveUpdates(_0x4cfcb7[_0x52cc78('0xf1')],null))[_0x52cc78('0x52')](respondWithResult(_0x3a70e3,null))[_0x52cc78('0x90')](handleError(_0x3a70e3,null));},exports[_0x1a4ed3('0xa2')]=function(_0x34c542,_0x45d740){const _0x1d823e=_0x1a4ed3,_0x18ec81=path[_0x1d823e('0xad')](config[_0x1d823e('0x140')],_0x1d823e('0x10e'));return db[_0x1d823e('0x159')][_0x1d823e('0xd6')]({'where':{'id':_0x34c542[_0x1d823e('0xdd')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x1d823e('0x52')](handleEntityNotFound(_0x45d740,null))['then'](function(_0x301852){const _0x593d56=_0x1d823e;if(_0x301852){if(_[_0x593d56('0x141')](_0x301852[_0x593d56('0x8')]))return _0x45d740[_0x593d56('0xfa')](_0x18ec81);else{if(!fs[_0x593d56('0x1b')](path['join'](config['root'],_0x593d56('0xb8'),_0x301852[_0x593d56('0x8')])))return _0x45d740['download'](_0x18ec81);return _0x45d740[_0x593d56('0xfa')](path[_0x593d56('0xad')](config['root'],_0x593d56('0xb8'),_0x301852[_0x593d56('0x8')]));}}})[_0x1d823e('0x90')](handleError(_0x45d740,null));},exports[_0x1a4ed3('0x104')]=function(_0x2ea797,_0x167ec6){const _0x40376d=_0x1a4ed3;let _0x571ae6={};const _0x1bc53a={};let _0x2229c8,_0x493caf;return db[_0x40376d('0x159')][_0x40376d('0xd6')]({'where':{'id':_0x2ea797[_0x40376d('0xdd')]['id']}})[_0x40376d('0x52')](handleEntityNotFound(_0x167ec6,null))[_0x40376d('0x52')](function(_0x2a50fb){const _0x9b3dac=_0x40376d;if(_0x2a50fb)return _0x2229c8=_0x2a50fb,_0x1bc53a[_0x9b3dac('0x15a')]=_[_0x9b3dac('0x33')](db['CmContact'][_0x9b3dac('0xeb')]),_0x1bc53a[_0x9b3dac('0x2a')]=_[_0x9b3dac('0x33')](_0x2ea797['query']),_0x1bc53a[_0x9b3dac('0x13b')]=_[_0x9b3dac('0x111')](_0x1bc53a[_0x9b3dac('0x15a')],_0x1bc53a[_0x9b3dac('0x2a')]),_0x571ae6[_0x9b3dac('0x145')]=_[_0x9b3dac('0x111')](_0x1bc53a['model'],qs[_0x9b3dac('0x41')](_0x2ea797['query'][_0x9b3dac('0x41')])),_0x571ae6[_0x9b3dac('0x145')]=_0x571ae6[_0x9b3dac('0x145')][_0x9b3dac('0x4e')]?_0x571ae6[_0x9b3dac('0x145')]:_0x1bc53a[_0x9b3dac('0x15a')],_0x571ae6[_0x9b3dac('0x13d')]=qs['sort'](_0x2ea797[_0x9b3dac('0x2a')][_0x9b3dac('0x5')]),_0x571ae6[_0x9b3dac('0x10d')]=qs['filters'](_[_0x9b3dac('0x13f')](_0x2ea797[_0x9b3dac('0x2a')],_0x1bc53a[_0x9b3dac('0x13b')])),_0x2ea797[_0x9b3dac('0x2a')][_0x9b3dac('0x95')]&&(_0x571ae6[_0x9b3dac('0x10d')]=_[_0x9b3dac('0xdb')](_0x571ae6['where'],{[Op['or']]:_[_0x9b3dac('0x30')](_0x571ae6[_0x9b3dac('0x145')],function(_0x516d5a){const _0x268e92=_0x9b3dac,_0x69c8a7={};return _0x69c8a7[_0x516d5a]={[Op['like']]:'%'+_0x2ea797['query'][_0x268e92('0x95')]+'%'},_0x69c8a7;})})),_0x571ae6=_[_0x9b3dac('0xdb')]({},_0x571ae6,_0x2ea797[_0x9b3dac('0xa1')]),_0x2229c8[_0x9b3dac('0x104')](_0x571ae6);})[_0x40376d('0x52')](function(_0x3efe58){const _0x5e62a0=_0x40376d;if(_0x3efe58)return _0x493caf=_0x3efe58['length'],typeof _0x2ea797['query'][_0x5e62a0('0x154')]!==_0x5e62a0('0xa4')&&(_0x571ae6[_0x5e62a0('0xce')]=[{'model':db[_0x5e62a0('0x156')],'as':_0x5e62a0('0xc9'),'required':![]},{'model':db[_0x5e62a0('0x114')],'as':_0x5e62a0('0xf5'),'attributes':['id',_0x5e62a0('0x7b'),_0x5e62a0('0x85')],'where':_0x2ea797[_0x5e62a0('0x2a')]['tag']?{'id':_0x2ea797[_0x5e62a0('0x2a')][_0x5e62a0('0x13a')]}:undefined,'required':_0x2ea797['query'][_0x5e62a0('0x13a')]?!![]:![]}]),typeof _0x2ea797['query'][_0x5e62a0('0x12c')]===_0x5e62a0('0xa4')&&(_0x571ae6[_0x5e62a0('0x3e')]=qs[_0x5e62a0('0x3e')](_0x2ea797[_0x5e62a0('0x2a')][_0x5e62a0('0x3e')]),_0x571ae6[_0x5e62a0('0x9a')]=qs[_0x5e62a0('0x9a')](_0x2ea797[_0x5e62a0('0x2a')]['offset'])),_0x2229c8[_0x5e62a0('0x104')](_0x571ae6);})[_0x40376d('0x52')](function(_0x1a4725){if(_0x1a4725)return _0x1a4725?{'count':_0x493caf,'rows':_0x1a4725}:null;})[_0x40376d('0x52')](respondWithResult(_0x167ec6,null))['catch'](handleError(_0x167ec6,null));},exports['getQueues']=function(_0x348e78,_0x11de68){const _0x57a614=_0x1a4ed3;let _0x5bfe88,_0x478128={},_0x31eac8;return db[_0x57a614('0x159')][_0x57a614('0xd6')]({'where':{'id':_0x348e78[_0x57a614('0xdd')]['id']},'attributes':['id','name','role']})[_0x57a614('0x52')](handleEntityNotFound(_0x11de68,null))[_0x57a614('0x52')](function(_0x358501){const _0x5e3906=_0x57a614;if(!utils[_0x5e3906('0x6a')](_0x348e78[_0x5e3906('0x2a')][_0x5e3906('0x9c')]))throw new ValidationError(_0x5e3906('0x103'));_0x5bfe88=_0x358501;const _0x446dd5={};_0x446dd5[_0x5e3906('0x15a')]=_[_0x5e3906('0x33')](db[_['capitalize'](_0x348e78[_0x5e3906('0x2a')]['channel'])+_0x5e3906('0x56')][_0x5e3906('0xeb')]),_0x446dd5[_0x5e3906('0x2a')]=_[_0x5e3906('0x33')](_0x348e78['query']),_0x446dd5['filters']=_['intersection'](_0x446dd5['model'],_0x446dd5[_0x5e3906('0x2a')]),_0x478128[_0x5e3906('0x145')]=_['intersection'](_0x446dd5['model'],qs[_0x5e3906('0x41')](_0x348e78[_0x5e3906('0x2a')]['fields'])),_0x478128[_0x5e3906('0x145')]=_0x478128['attributes'][_0x5e3906('0x4e')]?_0x478128[_0x5e3906('0x145')]:_0x446dd5[_0x5e3906('0x15a')],_0x478128[_0x5e3906('0x13d')]=qs['sort'](_0x348e78[_0x5e3906('0x2a')][_0x5e3906('0x5')]),_0x478128['where']=qs[_0x5e3906('0x13b')](_[_0x5e3906('0x13f')](_0x348e78[_0x5e3906('0x2a')],_0x446dd5[_0x5e3906('0x13b')]));_0x348e78['query'][_0x5e3906('0x95')]&&(_0x478128[_0x5e3906('0x10d')]=_[_0x5e3906('0xdb')](_0x478128['where'],{[Op['or']]:_[_0x5e3906('0x30')](_0x478128['attributes'],function(_0x386f0c){const _0x44bb71=_0x5e3906,_0x4b2083={};return _0x4b2083[_0x386f0c]={[Op[_0x44bb71('0xf7')]]:'%'+_0x348e78['query'][_0x44bb71('0x95')]+'%'},_0x4b2083;})}));_0x478128=_[_0x5e3906('0xdb')]({},_0x478128,_0x348e78[_0x5e3906('0xa1')]);switch(_0x5bfe88['role']){case _0x5e3906('0x73'):return db[_[_0x5e3906('0xdf')](_0x348e78['query'][_0x5e3906('0x9c')])+_0x5e3906('0x56')]['findAll'](_0x478128);case _0x5e3906('0xc8'):case'agent':return _0x5bfe88[_0x5e3906('0xa5')+_[_0x5e3906('0xdf')](_0x348e78['query'][_0x5e3906('0x9c')])+_0x5e3906('0xb7')](_0x478128);default:throw new ValidationError(_0x5e3906('0x1c'));}})[_0x57a614('0x52')](function(_0x3f6df9){const _0x132675=_0x57a614;_0x31eac8=_0x3f6df9[_0x132675('0x4e')];typeof _0x348e78[_0x132675('0x2a')][_0x132675('0x12c')]===_0x132675('0xa4')&&(_0x478128[_0x132675('0x3e')]=qs['limit'](_0x348e78[_0x132675('0x2a')][_0x132675('0x3e')]),_0x478128[_0x132675('0x9a')]=qs['offset'](_0x348e78['query'][_0x132675('0x9a')]));switch(_0x5bfe88[_0x132675('0x7')]){case _0x132675('0x73'):return db[_[_0x132675('0xdf')](_0x348e78[_0x132675('0x2a')][_0x132675('0x9c')])+_0x132675('0x56')]['findAll'](_0x478128);case _0x132675('0xc8'):case'agent':return _0x5bfe88[_0x132675('0xa5')+_[_0x132675('0xdf')](_0x348e78[_0x132675('0x2a')]['channel'])+'Queues'](_0x478128);}})[_0x57a614('0x52')](function(_0x2279bf){return{'count':_0x31eac8,'rows':_0x2279bf};})[_0x57a614('0x52')](respondWithResult(_0x11de68,null))[_0x57a614('0x90')](handleError(_0x11de68,null));},exports[_0x1a4ed3('0xe4')]=function(_0x46fe86,_0x1d96aa){const _0x4ad026=_0x1a4ed3;let _0x7ff441={};const _0x268a33={};let _0x3d14ec,_0x1a5d7f;return db[_0x4ad026('0x159')][_0x4ad026('0xd6')]({'where':{'id':_0x46fe86[_0x4ad026('0xdd')]['id']}})[_0x4ad026('0x52')](handleEntityNotFound(_0x1d96aa,null))[_0x4ad026('0x52')](function(_0x30eba9){const _0x3a8711=_0x4ad026;if(_0x30eba9)return _0x3d14ec=_0x30eba9,_0x268a33[_0x3a8711('0x15a')]=_[_0x3a8711('0x33')](db['UserVoiceQueueRt']['rawAttributes']),_0x268a33[_0x3a8711('0x2a')]=_[_0x3a8711('0x33')](_0x46fe86[_0x3a8711('0x2a')]),_0x268a33[_0x3a8711('0x13b')]=_[_0x3a8711('0x111')](_0x268a33[_0x3a8711('0x15a')],_0x268a33[_0x3a8711('0x2a')]),_0x7ff441['attributes']=_[_0x3a8711('0x111')](_0x268a33[_0x3a8711('0x15a')],qs[_0x3a8711('0x41')](_0x46fe86['query'][_0x3a8711('0x41')])),_0x7ff441['attributes']=_0x7ff441['attributes'][_0x3a8711('0x4e')]?_0x7ff441[_0x3a8711('0x145')]:_0x268a33['model'],_0x7ff441[_0x3a8711('0x13d')]=qs[_0x3a8711('0x5')](_0x46fe86[_0x3a8711('0x2a')]['sort']),_0x7ff441[_0x3a8711('0x10d')]=qs[_0x3a8711('0x13b')](_['pick'](_0x46fe86[_0x3a8711('0x2a')],_0x268a33['filters'])),_0x46fe86[_0x3a8711('0x2a')]['filter']&&(_0x7ff441[_0x3a8711('0x10d')]=_[_0x3a8711('0xdb')](_0x7ff441[_0x3a8711('0x10d')],{[Op['or']]:_[_0x3a8711('0x30')](_0x7ff441[_0x3a8711('0x145')],function(_0x5c1d2b){const _0xe37664=_0x3a8711,_0x5abed5={};return _0x5abed5[_0x5c1d2b]={[Op[_0xe37664('0xf7')]]:'%'+_0x46fe86[_0xe37664('0x2a')][_0xe37664('0x95')]+'%'},_0x5abed5;})})),_0x7ff441=_['merge']({},_0x7ff441,_0x46fe86[_0x3a8711('0xa1')]),_0x3d14ec[_0x3a8711('0xe4')](_0x7ff441);})['then'](function(_0x195418){const _0x5a7369=_0x4ad026;if(_0x195418)return _0x1a5d7f=_0x195418[_0x5a7369('0x4e')],typeof _0x46fe86[_0x5a7369('0x2a')][_0x5a7369('0x12c')]===_0x5a7369('0xa4')&&(_0x7ff441[_0x5a7369('0x3e')]=qs[_0x5a7369('0x3e')](_0x46fe86[_0x5a7369('0x2a')][_0x5a7369('0x3e')]),_0x7ff441[_0x5a7369('0x9a')]=qs[_0x5a7369('0x9a')](_0x46fe86[_0x5a7369('0x2a')][_0x5a7369('0x9a')])),_0x3d14ec['getVoiceQueuesRt'](_0x7ff441);})['then'](function(_0x3cc3a5){if(_0x3cc3a5)return _0x3cc3a5?{'count':_0x1a5d7f,'rows':_0x3cc3a5}:null;})[_0x4ad026('0x52')](respondWithResult(_0x1d96aa,null))[_0x4ad026('0x90')](handleError(_0x1d96aa,null));},exports[_0x1a4ed3('0x50')]=function(_0x52de24,_0x2f43d0){const _0x5180b0=_0x1a4ed3;let _0x4e58b7={};const _0x2ea920={};let _0xee083c,_0x2ce46a;return db[_0x5180b0('0x159')][_0x5180b0('0xd6')]({'where':{'id':_0x52de24[_0x5180b0('0xdd')]['id']}})[_0x5180b0('0x52')](handleEntityNotFound(_0x2f43d0,null))[_0x5180b0('0x52')](function(_0x22ed0e){const _0x11fc0a=_0x5180b0;if(_0x22ed0e)return _0xee083c=_0x22ed0e,_0x2ea920[_0x11fc0a('0x15a')]=_[_0x11fc0a('0x33')](db[_0x11fc0a('0xed')][_0x11fc0a('0xeb')]),_0x2ea920['query']=_[_0x11fc0a('0x33')](_0x52de24['query']),_0x2ea920[_0x11fc0a('0x13b')]=_[_0x11fc0a('0x111')](_0x2ea920[_0x11fc0a('0x15a')],_0x2ea920['query']),_0x4e58b7[_0x11fc0a('0x145')]=_[_0x11fc0a('0x111')](_0x2ea920['model'],qs[_0x11fc0a('0x41')](_0x52de24['query'][_0x11fc0a('0x41')])),_0x4e58b7[_0x11fc0a('0x145')]=_0x4e58b7['attributes'][_0x11fc0a('0x4e')]?_0x4e58b7[_0x11fc0a('0x145')]:_0x2ea920[_0x11fc0a('0x15a')],_0x4e58b7[_0x11fc0a('0x13d')]=qs['sort'](_0x52de24['query']['sort']),_0x4e58b7[_0x11fc0a('0x10d')]=qs[_0x11fc0a('0x13b')](_['pick'](_0x52de24[_0x11fc0a('0x2a')],_0x2ea920['filters'])),_0x52de24['query'][_0x11fc0a('0x95')]&&(_0x4e58b7[_0x11fc0a('0x10d')]=_[_0x11fc0a('0xdb')](_0x4e58b7['where'],{[Op['or']]:_[_0x11fc0a('0x30')](_0x4e58b7[_0x11fc0a('0x145')],function(_0x234272){const _0x5d270e=_0x11fc0a,_0x4c9f46={};return _0x4c9f46[_0x234272]={[Op[_0x5d270e('0xf7')]]:'%'+_0x52de24[_0x5d270e('0x2a')][_0x5d270e('0x95')]+'%'},_0x4c9f46;})})),_0x4e58b7=_[_0x11fc0a('0xdb')]({},_0x4e58b7,_0x52de24['options']),_0xee083c['getGroups'](_0x4e58b7);})['then'](function(_0x11fb26){const _0x111606=_0x5180b0;if(_0x11fb26)return _0x2ce46a=_0x11fb26[_0x111606('0x4e')],typeof _0x52de24[_0x111606('0x2a')][_0x111606('0x12c')]===_0x111606('0xa4')&&(_0x4e58b7['limit']=qs[_0x111606('0x3e')](_0x52de24['query']['limit']),_0x4e58b7[_0x111606('0x9a')]=qs[_0x111606('0x9a')](_0x52de24[_0x111606('0x2a')][_0x111606('0x9a')])),_0xee083c['getGroups'](_0x4e58b7);})[_0x5180b0('0x52')](function(_0x2bb78a){if(_0x2bb78a)return _0x2bb78a?{'count':_0x2ce46a,'rows':_0x2bb78a}:null;})[_0x5180b0('0x52')](respondWithResult(_0x2f43d0,null))[_0x5180b0('0x90')](handleError(_0x2f43d0,null));},exports[_0x1a4ed3('0x11')]=function(_0x45c961,_0x4858f2){const _0x5d629a=_0x1a4ed3;let _0x322250={'raw':!![],'where':{}};const _0x1a985b={},_0x1f10b6={'count':0x0,'rows':[]};return db[_0x5d629a('0x159')]['findOne']({'where':{'id':_0x45c961[_0x5d629a('0xdd')]['id']}})[_0x5d629a('0x52')](handleEntityNotFound(_0x4858f2,null))['then'](function(_0x2105ca){const _0x484056=_0x5d629a;if(_0x2105ca)return _0x1a985b[_0x484056('0x15a')]=_[_0x484056('0x33')](db[_0x484056('0x129')][_0x484056('0xeb')]),_0x1a985b[_0x484056('0x2a')]=_[_0x484056('0x33')](_0x45c961[_0x484056('0x2a')]),_0x1a985b['filters']=_[_0x484056('0x111')](_0x1a985b[_0x484056('0x15a')],_0x1a985b[_0x484056('0x2a')]),_0x322250[_0x484056('0x145')]=_[_0x484056('0x111')](_0x1a985b[_0x484056('0x15a')],qs[_0x484056('0x41')](_0x45c961['query'][_0x484056('0x41')])),_0x322250[_0x484056('0x145')]=_0x322250[_0x484056('0x145')][_0x484056('0x4e')]?_0x322250[_0x484056('0x145')]:_0x1a985b[_0x484056('0x15a')],typeof _0x45c961[_0x484056('0x2a')]['nolimit']===_0x484056('0xa4')&&(_0x322250[_0x484056('0x3e')]=qs[_0x484056('0x3e')](_0x45c961['query']['limit']),_0x322250[_0x484056('0x9a')]=qs[_0x484056('0x9a')](_0x45c961['query'][_0x484056('0x9a')])),_0x322250[_0x484056('0x13d')]=qs[_0x484056('0x5')](_0x45c961[_0x484056('0x2a')][_0x484056('0x5')]),_0x322250['where']=qs[_0x484056('0x13b')](_[_0x484056('0x13f')](_0x45c961[_0x484056('0x2a')],_0x1a985b[_0x484056('0x13b')])),_0x322250[_0x484056('0x10d')][_0x484056('0x83')]=_0x2105ca['id'],_0x45c961[_0x484056('0x2a')][_0x484056('0x95')]&&(_0x322250[_0x484056('0x10d')]=_[_0x484056('0xdb')](_0x322250[_0x484056('0x10d')],{[Op['or']]:_[_0x484056('0x30')](_0x322250[_0x484056('0x145')],function(_0x5f0c57){const _0x377098=_0x484056,_0x45bcc1={};return _0x45bcc1[_0x5f0c57]={[Op[_0x377098('0xf7')]]:'%'+_0x45c961[_0x377098('0x2a')]['filter']+'%'},_0x45bcc1;})})),_0x322250=_['merge']({},_0x322250,_0x45c961[_0x484056('0xa1')]),db[_0x484056('0x129')][_0x484056('0xde')]({'where':_0x322250[_0x484056('0x10d')]})[_0x484056('0x52')](function(_0x59560c){const _0x40857f=_0x484056;return _0x1f10b6[_0x40857f('0xde')]=_0x59560c,_0x45c961['query']['includeAll']&&(_0x322250[_0x40857f('0xce')]=[{'all':!![]}]),db[_0x40857f('0x129')][_0x40857f('0x14c')](_0x322250);})[_0x484056('0x52')](function(_0x551f61){const _0xa5dddf=_0x484056;return _0x1f10b6[_0xa5dddf('0x10a')]=_0x551f61,_0x1f10b6;});})[_0x5d629a('0x52')](respondWithFilteredResult(_0x4858f2,_0x322250))[_0x5d629a('0x90')](handleError(_0x4858f2,null));},exports[_0x1a4ed3('0x2')]=function(_0x18d131,_0x11c65e){const _0x16f643=_0x1a4ed3;let _0x19f91b={'raw':!![],'where':{}};const _0x3e34b5={},_0x2a44e2={'count':0x0,'rows':[]};return db[_0x16f643('0x159')][_0x16f643('0xd6')]({'where':{'id':_0x18d131[_0x16f643('0xdd')]['id']}})['then'](handleEntityNotFound(_0x11c65e,null))[_0x16f643('0x52')](function(_0x3c2c9b){const _0x40dcac=_0x16f643;if(_0x3c2c9b)return _0x3e34b5[_0x40dcac('0x15a')]=_[_0x40dcac('0x33')](db[_0x40dcac('0x7d')][_0x40dcac('0xeb')]),_0x3e34b5[_0x40dcac('0x2a')]=_[_0x40dcac('0x33')](_0x18d131['query']),_0x3e34b5[_0x40dcac('0x13b')]=_[_0x40dcac('0x111')](_0x3e34b5[_0x40dcac('0x15a')],_0x3e34b5['query']),_0x19f91b[_0x40dcac('0x145')]=_[_0x40dcac('0x111')](_0x3e34b5['model'],qs[_0x40dcac('0x41')](_0x18d131['query'][_0x40dcac('0x41')])),_0x19f91b[_0x40dcac('0x145')]=_0x19f91b[_0x40dcac('0x145')][_0x40dcac('0x4e')]?_0x19f91b[_0x40dcac('0x145')]:_0x3e34b5[_0x40dcac('0x15a')],typeof _0x18d131[_0x40dcac('0x2a')][_0x40dcac('0x12c')]==='undefined'&&(_0x19f91b[_0x40dcac('0x3e')]=qs[_0x40dcac('0x3e')](_0x18d131[_0x40dcac('0x2a')][_0x40dcac('0x3e')]),_0x19f91b[_0x40dcac('0x9a')]=qs[_0x40dcac('0x9a')](_0x18d131[_0x40dcac('0x2a')]['offset'])),_0x19f91b[_0x40dcac('0x13d')]=qs[_0x40dcac('0x5')](_0x18d131[_0x40dcac('0x2a')][_0x40dcac('0x5')]),_0x19f91b[_0x40dcac('0x10d')]=qs[_0x40dcac('0x13b')](_[_0x40dcac('0x13f')](_0x18d131[_0x40dcac('0x2a')],_0x3e34b5[_0x40dcac('0x13b')])),_0x19f91b[_0x40dcac('0x10d')][_0x40dcac('0x83')]=_0x3c2c9b['id'],_0x18d131['query'][_0x40dcac('0x95')]&&(_0x19f91b[_0x40dcac('0x10d')]=_[_0x40dcac('0xdb')](_0x19f91b[_0x40dcac('0x10d')],{[Op['or']]:_[_0x40dcac('0x30')](_0x19f91b['attributes'],function(_0x367539){const _0x2a58c9=_0x40dcac,_0x5a80d6={};return _0x5a80d6[_0x367539]={[Op['like']]:'%'+_0x18d131[_0x2a58c9('0x2a')][_0x2a58c9('0x95')]+'%'},_0x5a80d6;})})),_0x19f91b=_[_0x40dcac('0xdb')]({},_0x19f91b,_0x18d131[_0x40dcac('0xa1')]),db[_0x40dcac('0x7d')][_0x40dcac('0xde')]({'where':_0x19f91b['where']})['then'](function(_0x3ed59e){const _0x5896e2=_0x40dcac;return _0x2a44e2['count']=_0x3ed59e,_0x18d131['query'][_0x5896e2('0x154')]&&(_0x19f91b['include']=[{'all':!![]}]),db[_0x5896e2('0x7d')][_0x5896e2('0x14c')](_0x19f91b);})[_0x40dcac('0x52')](function(_0x5eff1a){const _0x223909=_0x40dcac;return _0x2a44e2[_0x223909('0x10a')]=_0x5eff1a,_0x2a44e2;});})[_0x16f643('0x52')](respondWithFilteredResult(_0x11c65e,_0x19f91b))[_0x16f643('0x90')](handleError(_0x11c65e,null));},exports[_0x1a4ed3('0xcd')]=function(_0x5d8802,_0x17fcfc){const _0x3d2011=_0x1a4ed3;let _0xe33abc={};const _0x3120bd={};let _0x2b1bc4,_0x32dc55;return db[_0x3d2011('0x159')][_0x3d2011('0xd6')]({'where':{'id':_0x5d8802['params']['id']}})[_0x3d2011('0x52')](handleEntityNotFound(_0x17fcfc,null))[_0x3d2011('0x52')](function(_0x5c5a6f){const _0x51ae84=_0x3d2011;if(_0x5c5a6f)return _0x2b1bc4=_0x5c5a6f,_0x3120bd['model']=_[_0x51ae84('0x33')](db[_0x51ae84('0x0')][_0x51ae84('0xeb')]),_0x3120bd['query']=_[_0x51ae84('0x33')](_0x5d8802[_0x51ae84('0x2a')]),_0x3120bd['filters']=_[_0x51ae84('0x111')](_0x3120bd['model'],_0x3120bd[_0x51ae84('0x2a')]),_0xe33abc[_0x51ae84('0x145')]=_[_0x51ae84('0x111')](_0x3120bd[_0x51ae84('0x15a')],qs[_0x51ae84('0x41')](_0x5d8802[_0x51ae84('0x2a')][_0x51ae84('0x41')])),_0xe33abc[_0x51ae84('0x145')]=_0xe33abc['attributes']['length']?_0xe33abc['attributes']:_0x3120bd[_0x51ae84('0x15a')],_0xe33abc[_0x51ae84('0x13d')]=qs['sort'](_0x5d8802[_0x51ae84('0x2a')][_0x51ae84('0x5')]),_0xe33abc[_0x51ae84('0x10d')]=qs['filters'](_[_0x51ae84('0x13f')](_0x5d8802['query'],_0x3120bd['filters'])),_0x5d8802[_0x51ae84('0x2a')][_0x51ae84('0x95')]&&(_0xe33abc['where']=_[_0x51ae84('0xdb')](_0xe33abc[_0x51ae84('0x10d')],{[Op['or']]:_['map'](_0xe33abc[_0x51ae84('0x145')],function(_0x354acc){const _0x22a9db=_0x51ae84,_0x3cf835={};return _0x3cf835[_0x354acc]={[Op['like']]:'%'+_0x5d8802['query'][_0x22a9db('0x95')]+'%'},_0x3cf835;})})),_0xe33abc=_[_0x51ae84('0xdb')]({},_0xe33abc,_0x5d8802[_0x51ae84('0xa1')]),_0x2b1bc4[_0x51ae84('0xcd')](_0xe33abc);})[_0x3d2011('0x52')](function(_0x379e5c){const _0x50a924=_0x3d2011;if(_0x379e5c)return _0x32dc55=_0x379e5c['length'],typeof _0x5d8802[_0x50a924('0x2a')]['nolimit']===_0x50a924('0xa4')&&(_0xe33abc['limit']=qs['limit'](_0x5d8802[_0x50a924('0x2a')][_0x50a924('0x3e')]),_0xe33abc[_0x50a924('0x9a')]=qs[_0x50a924('0x9a')](_0x5d8802[_0x50a924('0x2a')][_0x50a924('0x9a')])),_0x2b1bc4[_0x50a924('0xcd')](_0xe33abc);})[_0x3d2011('0x52')](function(_0x34006d){if(_0x34006d)return _0x34006d?{'count':_0x32dc55,'rows':_0x34006d}:null;})[_0x3d2011('0x52')](respondWithResult(_0x17fcfc,null))['catch'](handleError(_0x17fcfc,null));},exports[_0x1a4ed3('0x16')]=function(_0x163e4c,_0x4ae972){const _0x3d267a=_0x1a4ed3;let _0x25db4b={};const _0x4a1acb={};let _0x299b4a,_0x353f94;return db['User'][_0x3d267a('0xd6')]({'where':{'id':_0x163e4c[_0x3d267a('0xdd')]['id']}})['then'](handleEntityNotFound(_0x4ae972,null))['then'](function(_0x1e32cd){const _0x102d95=_0x3d267a;if(_0x1e32cd)return _0x299b4a=_0x1e32cd,_0x4a1acb[_0x102d95('0x15a')]=_[_0x102d95('0x33')](db[_0x102d95('0x110')]['rawAttributes']),_0x4a1acb[_0x102d95('0x2a')]=_[_0x102d95('0x33')](_0x163e4c['query']),_0x4a1acb[_0x102d95('0x13b')]=_[_0x102d95('0x111')](_0x4a1acb[_0x102d95('0x15a')],_0x4a1acb[_0x102d95('0x2a')]),_0x25db4b[_0x102d95('0x145')]=_['intersection'](_0x4a1acb[_0x102d95('0x15a')],qs[_0x102d95('0x41')](_0x163e4c[_0x102d95('0x2a')][_0x102d95('0x41')])),_0x25db4b[_0x102d95('0x145')]=_0x25db4b['attributes'][_0x102d95('0x4e')]?_0x25db4b[_0x102d95('0x145')]:_0x4a1acb['model'],_0x25db4b['order']=qs[_0x102d95('0x5')](_0x163e4c['query'][_0x102d95('0x5')]),_0x25db4b['where']=qs[_0x102d95('0x13b')](_[_0x102d95('0x13f')](_0x163e4c[_0x102d95('0x2a')],_0x4a1acb[_0x102d95('0x13b')])),_0x163e4c[_0x102d95('0x2a')][_0x102d95('0x95')]&&(_0x25db4b['where']=_[_0x102d95('0xdb')](_0x25db4b['where'],{[Op['or']]:_[_0x102d95('0x30')](_0x25db4b[_0x102d95('0x145')],function(_0x17e07e){const _0x2a8042=_0x102d95,_0x387999={};return _0x387999[_0x17e07e]={[Op['like']]:'%'+_0x163e4c[_0x2a8042('0x2a')][_0x2a8042('0x95')]+'%'},_0x387999;})})),_0x25db4b=_[_0x102d95('0xdb')]({},_0x25db4b,_0x163e4c[_0x102d95('0xa1')]),_0x299b4a[_0x102d95('0x16')](_0x25db4b);})['then'](function(_0x10a576){const _0x248870=_0x3d267a;if(_0x10a576)return _0x353f94=_0x10a576[_0x248870('0x4e')],typeof _0x163e4c['query'][_0x248870('0x12c')]===_0x248870('0xa4')&&(_0x25db4b['limit']=qs[_0x248870('0x3e')](_0x163e4c['query'][_0x248870('0x3e')]),_0x25db4b[_0x248870('0x9a')]=qs[_0x248870('0x9a')](_0x163e4c[_0x248870('0x2a')][_0x248870('0x9a')])),_0x299b4a[_0x248870('0x16')](_0x25db4b);})[_0x3d267a('0x52')](function(_0x39c0b0){if(_0x39c0b0)return _0x39c0b0?{'count':_0x353f94,'rows':_0x39c0b0}:null;})[_0x3d267a('0x52')](respondWithResult(_0x4ae972,null))['catch'](handleError(_0x4ae972,null));},exports[_0x1a4ed3('0x130')]=function(_0x29cc18,_0x494492){const _0x3eea12=_0x1a4ed3;let _0x40477c={'raw':!![],'where':{}};const _0x45f077={},_0xb78be7={'count':0x0,'rows':[]};return db['User'][_0x3eea12('0xd6')]({'where':{'id':_0x29cc18[_0x3eea12('0xdd')]['id']}})[_0x3eea12('0x52')](handleEntityNotFound(_0x494492,null))['then'](function(_0x4924c0){const _0x2ad4c2=_0x3eea12;if(_0x4924c0)return _0x45f077[_0x2ad4c2('0x15a')]=_[_0x2ad4c2('0x33')](db[_0x2ad4c2('0xe9')][_0x2ad4c2('0xeb')]),_0x45f077[_0x2ad4c2('0x2a')]=_[_0x2ad4c2('0x33')](_0x29cc18[_0x2ad4c2('0x2a')]),_0x45f077[_0x2ad4c2('0x13b')]=_[_0x2ad4c2('0x111')](_0x45f077[_0x2ad4c2('0x15a')],_0x45f077[_0x2ad4c2('0x2a')]),_0x40477c['attributes']=_[_0x2ad4c2('0x111')](_0x45f077['model'],qs[_0x2ad4c2('0x41')](_0x29cc18[_0x2ad4c2('0x2a')][_0x2ad4c2('0x41')])),_0x40477c[_0x2ad4c2('0x145')]=_0x40477c[_0x2ad4c2('0x145')]['length']?_0x40477c[_0x2ad4c2('0x145')]:_0x45f077[_0x2ad4c2('0x15a')],typeof _0x29cc18[_0x2ad4c2('0x2a')][_0x2ad4c2('0x12c')]===_0x2ad4c2('0xa4')&&(_0x40477c[_0x2ad4c2('0x3e')]=qs[_0x2ad4c2('0x3e')](_0x29cc18[_0x2ad4c2('0x2a')][_0x2ad4c2('0x3e')]),_0x40477c[_0x2ad4c2('0x9a')]=qs['offset'](_0x29cc18[_0x2ad4c2('0x2a')][_0x2ad4c2('0x9a')])),_0x40477c[_0x2ad4c2('0x13d')]=qs['sort'](_0x29cc18[_0x2ad4c2('0x2a')]['sort']),_0x40477c[_0x2ad4c2('0x10d')]=qs[_0x2ad4c2('0x13b')](_['pick'](_0x29cc18[_0x2ad4c2('0x2a')],_0x45f077[_0x2ad4c2('0x13b')])),_0x40477c[_0x2ad4c2('0x10d')]['UserId']=_0x4924c0['id'],_0x29cc18['query']['filter']&&(_0x40477c[_0x2ad4c2('0x10d')]=_['merge'](_0x40477c[_0x2ad4c2('0x10d')],{[Op['or']]:_[_0x2ad4c2('0x30')](_0x40477c['attributes'],function(_0x1e031){const _0x3df985=_0x2ad4c2,_0x56870b={};return _0x56870b[_0x1e031]={[Op[_0x3df985('0xf7')]]:'%'+_0x29cc18[_0x3df985('0x2a')][_0x3df985('0x95')]+'%'},_0x56870b;})})),_0x40477c=_[_0x2ad4c2('0xdb')]({},_0x40477c,_0x29cc18[_0x2ad4c2('0xa1')]),db[_0x2ad4c2('0xe9')][_0x2ad4c2('0xde')]({'where':_0x40477c['where']})[_0x2ad4c2('0x52')](function(_0x1554ef){const _0x1f8d49=_0x2ad4c2;return _0xb78be7[_0x1f8d49('0xde')]=_0x1554ef,_0x29cc18[_0x1f8d49('0x2a')]['includeAll']&&(_0x40477c[_0x1f8d49('0xce')]=[{'all':!![]}]),db[_0x1f8d49('0xe9')][_0x1f8d49('0x14c')](_0x40477c);})[_0x2ad4c2('0x52')](function(_0x1c0a32){return _0xb78be7['rows']=_0x1c0a32,_0xb78be7;});})[_0x3eea12('0x52')](respondWithFilteredResult(_0x494492,_0x40477c))['catch'](handleError(_0x494492,null));},exports['getSmsInteractions']=function(_0x5781da,_0x2bcc64){const _0x264031=_0x1a4ed3;let _0x14f3e5={};const _0x2f3637={};let _0x5f502d,_0x25dfe8;return db['User'][_0x264031('0xd6')]({'where':{'id':_0x5781da[_0x264031('0xdd')]['id']}})['then'](handleEntityNotFound(_0x2bcc64,null))[_0x264031('0x52')](function(_0x300dd6){const _0x1e9da1=_0x264031;if(_0x300dd6)return _0x5f502d=_0x300dd6,_0x2f3637[_0x1e9da1('0x15a')]=_[_0x1e9da1('0x33')](db[_0x1e9da1('0xd9')]['rawAttributes']),_0x2f3637[_0x1e9da1('0x2a')]=_[_0x1e9da1('0x33')](_0x5781da[_0x1e9da1('0x2a')]),_0x2f3637[_0x1e9da1('0x13b')]=_[_0x1e9da1('0x111')](_0x2f3637[_0x1e9da1('0x15a')],_0x2f3637[_0x1e9da1('0x2a')]),_0x14f3e5[_0x1e9da1('0x145')]=_['intersection'](_0x2f3637[_0x1e9da1('0x15a')],qs[_0x1e9da1('0x41')](_0x5781da[_0x1e9da1('0x2a')][_0x1e9da1('0x41')])),_0x14f3e5['attributes']=_0x14f3e5[_0x1e9da1('0x145')]['length']?_0x14f3e5['attributes']:_0x2f3637[_0x1e9da1('0x15a')],_0x14f3e5[_0x1e9da1('0x13d')]=qs['sort'](_0x5781da['query']['sort']),_0x14f3e5[_0x1e9da1('0x10d')]=qs['filters'](_[_0x1e9da1('0x13f')](_0x5781da[_0x1e9da1('0x2a')],_0x2f3637[_0x1e9da1('0x13b')])),_0x5781da[_0x1e9da1('0x2a')]['filter']&&(_0x14f3e5[_0x1e9da1('0x10d')]=_[_0x1e9da1('0xdb')](_0x14f3e5['where'],{[Op['or']]:_[_0x1e9da1('0x30')](_0x14f3e5[_0x1e9da1('0x145')],function(_0x2d0894){const _0x11084a=_0x1e9da1,_0x26ee20={};return _0x26ee20[_0x2d0894]={[Op['like']]:'%'+_0x5781da[_0x11084a('0x2a')][_0x11084a('0x95')]+'%'},_0x26ee20;})})),_0x14f3e5=_[_0x1e9da1('0xdb')]({},_0x14f3e5,_0x5781da['options']),_0x5f502d[_0x1e9da1('0xdc')](_0x14f3e5);})[_0x264031('0x52')](function(_0x37f1b6){const _0x43056a=_0x264031;if(_0x37f1b6)return _0x25dfe8=_0x37f1b6[_0x43056a('0x4e')],typeof _0x5781da[_0x43056a('0x2a')][_0x43056a('0x12c')]==='undefined'&&(_0x14f3e5[_0x43056a('0x3e')]=qs['limit'](_0x5781da['query'][_0x43056a('0x3e')]),_0x14f3e5['offset']=qs[_0x43056a('0x9a')](_0x5781da[_0x43056a('0x2a')]['offset'])),_0x5f502d['getSmsInteractions'](_0x14f3e5);})['then'](function(_0x16f163){if(_0x16f163)return _0x16f163?{'count':_0x25dfe8,'rows':_0x16f163}:null;})[_0x264031('0x52')](respondWithResult(_0x2bcc64,null))[_0x264031('0x90')](handleError(_0x2bcc64,null));},exports['getFaxInteractions']=function(_0x1b3f34,_0x3eb4b3){const _0x5dc7dc=_0x1a4ed3;let _0x3c056d={};const _0xbe34d2={};let _0x7de9a6,_0x3090e7;return db[_0x5dc7dc('0x159')][_0x5dc7dc('0xd6')]({'where':{'id':_0x1b3f34['params']['id']}})['then'](handleEntityNotFound(_0x3eb4b3,null))[_0x5dc7dc('0x52')](function(_0x56a8eb){const _0x2f3e35=_0x5dc7dc;if(_0x56a8eb)return _0x7de9a6=_0x56a8eb,_0xbe34d2['model']=_['keys'](db[_0x2f3e35('0xc1')][_0x2f3e35('0xeb')]),_0xbe34d2['query']=_['keys'](_0x1b3f34[_0x2f3e35('0x2a')]),_0xbe34d2[_0x2f3e35('0x13b')]=_['intersection'](_0xbe34d2[_0x2f3e35('0x15a')],_0xbe34d2[_0x2f3e35('0x2a')]),_0x3c056d[_0x2f3e35('0x145')]=_[_0x2f3e35('0x111')](_0xbe34d2[_0x2f3e35('0x15a')],qs[_0x2f3e35('0x41')](_0x1b3f34[_0x2f3e35('0x2a')][_0x2f3e35('0x41')])),_0x3c056d[_0x2f3e35('0x145')]=_0x3c056d['attributes']['length']?_0x3c056d[_0x2f3e35('0x145')]:_0xbe34d2['model'],_0x3c056d[_0x2f3e35('0x13d')]=qs[_0x2f3e35('0x5')](_0x1b3f34['query'][_0x2f3e35('0x5')]),_0x3c056d[_0x2f3e35('0x10d')]=qs['filters'](_[_0x2f3e35('0x13f')](_0x1b3f34['query'],_0xbe34d2['filters'])),_0x1b3f34[_0x2f3e35('0x2a')][_0x2f3e35('0x95')]&&(_0x3c056d['where']=_[_0x2f3e35('0xdb')](_0x3c056d['where'],{[Op['or']]:_[_0x2f3e35('0x30')](_0x3c056d['attributes'],function(_0x4bea7f){const _0x17ead5=_0x2f3e35,_0x2c061f={};return _0x2c061f[_0x4bea7f]={[Op[_0x17ead5('0xf7')]]:'%'+_0x1b3f34['query'][_0x17ead5('0x95')]+'%'},_0x2c061f;})})),_0x3c056d=_[_0x2f3e35('0xdb')]({},_0x3c056d,_0x1b3f34['options']),_0x7de9a6[_0x2f3e35('0x70')](_0x3c056d);})['then'](function(_0x305ae2){const _0x4d7a1c=_0x5dc7dc;if(_0x305ae2)return _0x3090e7=_0x305ae2['length'],typeof _0x1b3f34[_0x4d7a1c('0x2a')][_0x4d7a1c('0x12c')]===_0x4d7a1c('0xa4')&&(_0x3c056d['limit']=qs[_0x4d7a1c('0x3e')](_0x1b3f34[_0x4d7a1c('0x2a')][_0x4d7a1c('0x3e')]),_0x3c056d[_0x4d7a1c('0x9a')]=qs[_0x4d7a1c('0x9a')](_0x1b3f34[_0x4d7a1c('0x2a')][_0x4d7a1c('0x9a')])),_0x7de9a6[_0x4d7a1c('0x70')](_0x3c056d);})['then'](function(_0xfc0b76){if(_0xfc0b76)return _0xfc0b76?{'count':_0x3090e7,'rows':_0xfc0b76}:null;})[_0x5dc7dc('0x52')](respondWithResult(_0x3eb4b3,null))[_0x5dc7dc('0x90')](handleError(_0x3eb4b3,null));},exports[_0x1a4ed3('0x48')]=function(_0xa897c3,_0x2799a3){const _0x14945d=_0x1a4ed3;let _0x503eca={};const _0x279f9b={};let _0x17a878,_0x46508b;return db['User'][_0x14945d('0xd6')]({'where':{'id':_0xa897c3[_0x14945d('0xdd')]['id']}})[_0x14945d('0x52')](handleEntityNotFound(_0x2799a3,null))[_0x14945d('0x52')](function(_0x379aec){const _0x39acfd=_0x14945d;if(_0x379aec)return _0x17a878=_0x379aec,_0x279f9b[_0x39acfd('0x15a')]=_[_0x39acfd('0x33')](db[_0x39acfd('0x13e')][_0x39acfd('0xeb')]),_0x279f9b[_0x39acfd('0x2a')]=_[_0x39acfd('0x33')](_0xa897c3[_0x39acfd('0x2a')]),_0x279f9b[_0x39acfd('0x13b')]=_[_0x39acfd('0x111')](_0x279f9b[_0x39acfd('0x15a')],_0x279f9b[_0x39acfd('0x2a')]),_0x503eca[_0x39acfd('0x145')]=_[_0x39acfd('0x111')](_0x279f9b[_0x39acfd('0x15a')],qs['fields'](_0xa897c3[_0x39acfd('0x2a')][_0x39acfd('0x41')])),_0x503eca['attributes']=_0x503eca[_0x39acfd('0x145')][_0x39acfd('0x4e')]?_0x503eca[_0x39acfd('0x145')]:_0x279f9b[_0x39acfd('0x15a')],_0x503eca['order']=qs[_0x39acfd('0x5')](_0xa897c3[_0x39acfd('0x2a')][_0x39acfd('0x5')]),_0x503eca['where']=qs['filters'](_['pick'](_0xa897c3['query'],_0x279f9b[_0x39acfd('0x13b')])),_0xa897c3[_0x39acfd('0x2a')][_0x39acfd('0x95')]&&(_0x503eca['where']=_[_0x39acfd('0xdb')](_0x503eca[_0x39acfd('0x10d')],{[Op['or']]:_['map'](_0x503eca['attributes'],function(_0x1cd085){const _0x202e6b=_0x39acfd,_0xf3cf58={};return _0xf3cf58[_0x1cd085]={[Op[_0x202e6b('0xf7')]]:'%'+_0xa897c3[_0x202e6b('0x2a')]['filter']+'%'},_0xf3cf58;})})),_0x503eca=_['merge']({},_0x503eca,_0xa897c3[_0x39acfd('0xa1')]),_0x17a878[_0x39acfd('0x48')](_0x503eca);})[_0x14945d('0x52')](function(_0x398072){const _0x192da2=_0x14945d;if(_0x398072)return _0x46508b=_0x398072[_0x192da2('0x4e')],typeof _0xa897c3['query'][_0x192da2('0x12c')]===_0x192da2('0xa4')&&(_0x503eca[_0x192da2('0x3e')]=qs['limit'](_0xa897c3[_0x192da2('0x2a')]['limit']),_0x503eca[_0x192da2('0x9a')]=qs[_0x192da2('0x9a')](_0xa897c3[_0x192da2('0x2a')]['offset'])),_0x17a878[_0x192da2('0x48')](_0x503eca);})[_0x14945d('0x52')](function(_0x25ad7c){if(_0x25ad7c)return _0x25ad7c?{'count':_0x46508b,'rows':_0x25ad7c}:null;})[_0x14945d('0x52')](respondWithResult(_0x2799a3,null))[_0x14945d('0x90')](handleError(_0x2799a3,null));},exports['login']=function(_0x2166dd,_0x46d556,_0x3b9212){const _0x3707de=_0x1a4ed3;let _0x2b0e8d,_0x58620e,_0x376b3a;const _0x433850=!_['isNil'](_0x2166dd[_0x3707de('0xdd')]['id'])?_0x2166dd[_0x3707de('0xdd')]['id']:!_[_0x3707de('0x141')](_0x2166dd['user']['id'])?_0x2166dd[_0x3707de('0xc8')]['id']:null;return db[_0x3707de('0x159')][_0x3707de('0xd6')]({'where':{'id':_0x433850,'role':{[Op['or']]:[_0x3707de('0x73'),_0x3707de('0xc8'),'agent']}},'attributes':['id',_0x3707de('0x7b'),_0x3707de('0x97'),_0x3707de('0x43'),'role',_0x3707de('0x149'),'loginInPause']})[_0x3707de('0x52')](function(_0x187c5a){const _0x3207e8=_0x3707de;if(_0x187c5a){if(_0x187c5a[_0x3207e8('0x7')]==='agent'){_0x2b0e8d=_0x187c5a;if(_0x2166dd[_0x3207e8('0xf1')][_0x3207e8('0x1f')])_0x376b3a=util['format'](_0x3207e8('0x57'),_0x2b0e8d[_0x2166dd[_0x3207e8('0xf1')][_0x3207e8('0x1f')]]);else _0x2166dd[_0x3207e8('0xf1')]['intrf']?_0x376b3a=util[_0x3207e8('0x11c')](_0x3207e8('0xfb'),_0x2166dd[_0x3207e8('0xf1')]['intrf']):_0x376b3a=util['format'](_0x3207e8('0xfb'),_0x2b0e8d[_0x3207e8('0x7b')]);return socket['to'](util[_0x3207e8('0x11c')](_0x3207e8('0x11f'),_0x2b0e8d[_0x3207e8('0x7b')]))[_0x3207e8('0x135')](_0x3207e8('0xe5'),{'ip':_0x2166dd[_0x3207e8('0xf6')][_0x3207e8('0x79')]||_0x2166dd['connection'][_0x3207e8('0x10c')]||_0x2166dd[_0x3207e8('0x155')]['remoteAddress']||_0x2166dd['connection']['socket'][_0x3207e8('0x10c')]}),db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2b0e8d['name']},'individualHooks':!![]});}}else throw new ValidationError(_0x3207e8('0x4f'));})['then'](function(){const _0x5527d5=_0x3707de;if(_0x2b0e8d)return _0x2b0e8d[_0x5527d5('0x8d')]({'raw':!![]});})[_0x3707de('0x52')](function(_0x27ab86){const _0x18104e=_0x3707de;if(_0x2b0e8d){if(_0x27ab86){_0x58620e=_0x27ab86;if(_0x58620e[_0x18104e('0x4e')]){const _0x2b5d37=_0x58620e[_0x18104e('0x30')](_0x755a31=>{const _0x3edc0a=_0x18104e,_0x2ecb43={'membername':_0x2b0e8d[_0x3edc0a('0x7b')],'UserId':_0x2b0e8d['id'],'queue_name':_0x755a31[_0x3edc0a('0x7b')],'VoiceQueueId':_0x755a31['id'],'interface':_0x376b3a,'paused':_0x2b0e8d[_0x3edc0a('0x68')]||![],'penalty':_0x755a31[_0x3edc0a('0x100')]||0x0};return db[_0x3edc0a('0x17')]['upsert'](_0x2ecb43);});return Promise[_0x18104e('0x9')](_0x2b5d37);}}}})[_0x3707de('0x52')](function(){const _0x589c2c=_0x3707de;if(_0x2b0e8d)return db[_0x589c2c('0x18')]['findAll']({'where':{'membername':_0x2b0e8d[_0x589c2c('0x7b')],'exitAt':null}});})[_0x3707de('0x52')](function(_0x319070){const _0x1beef1=_0x3707de;if(_0x2b0e8d){const _0x26d19c=[];return _0x319070[_0x1beef1('0xe6')](function(_0x36b3cf){const _0x424e1d=_0x1beef1;_0x26d19c[_0x424e1d('0x146')](_0x36b3cf['update']({'exitAt':moment()[_0x424e1d('0x11c')](_0x424e1d('0xa'))}));}),Promise[_0x1beef1('0x9')](_0x26d19c);}})[_0x3707de('0x52')](function(){const _0x252b9f=_0x3707de;if(_0x2b0e8d){const _0x43ade9=[],_0x4bc203=[],_0xeb7eb9=utils[_0x252b9f('0x1')](),_0x3b0447={'membername':_0x2b0e8d[_0x252b9f('0x7b')],'interface':_0x376b3a,'enterAt':moment()[_0x252b9f('0x11c')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2b0e8d[_0x252b9f('0x7')],'internal':_0x2b0e8d[_0x252b9f('0x149')]};return _0xeb7eb9['forEach'](function(_0x284e19){const _0x56a7e4=_0x252b9f;_0x43ade9['push'](_[_0x56a7e4('0xdb')]({'channel':_0x284e19,'type':_0x56a7e4('0x23'),'data1':_0x2166dd[_0x56a7e4('0xf1')]['device'],'data2':_0x376b3a},_0x3b0447)),_0x2b0e8d[_0x56a7e4('0x68')]&&_0x4bc203[_0x56a7e4('0x146')](_[_0x56a7e4('0xdb')]({'channel':_0x284e19,'type':'PAUSE','data1':_0x56a7e4('0x144')},_0x3b0447));}),db[_0x252b9f('0x18')][_0x252b9f('0x93')](_0x43ade9['concat'](_0x4bc203),{'individualHooks':!![]});}})[_0x3707de('0x52')](function(){const _0x4f4869=_0x3707de;if(_0x2b0e8d)return _0x2b0e8d[_0x4f4869('0x6c')]({'online':!![],'lastLoginAt':moment()['format'](_0x4f4869('0xa')),'voicePause':_0x2b0e8d[_0x4f4869('0x68')]||![],'mailPause':_0x2b0e8d[_0x4f4869('0x68')]||![],'chatPause':_0x2b0e8d[_0x4f4869('0x68')]||![],'faxPause':_0x2b0e8d['loginInPause']||![],'smsPause':_0x2b0e8d[_0x4f4869('0x68')]||![],'openchannelPause':_0x2b0e8d[_0x4f4869('0x68')]||![],'whatsappPause':_0x2b0e8d[_0x4f4869('0x68')]||![],'pauseType':_0x2b0e8d['loginInPause']?_0x4f4869('0x144'):null,'interface':_0x376b3a,'lastPauseAt':moment()[_0x4f4869('0x11c')](_0x4f4869('0xa'))});})[_0x3707de('0x52')](function(_0x1ad309){const _0x12c81b=_0x3707de;return _0x2166dd[_0x12c81b('0x49')]?_0x3b9212():Promise[_0x12c81b('0x15')](_0x1ad309)[_0x12c81b('0x52')](respondWithResult(_0x46d556,null));})[_0x3707de('0x90')](handleError(_0x46d556,null));},exports[_0x1a4ed3('0x54')]=function(_0x8f753e,_0x3746f4){const _0x148461=_0x1a4ed3;let _0x20d07a;return db['User']['findOne']({'where':{'id':_0x8f753e[_0x148461('0xdd')]['id'],'role':'agent'},'attributes':['id',_0x148461('0x7b'),_0x148461('0x7')]})[_0x148461('0x52')](handleEntityNotFound(_0x3746f4,null))[_0x148461('0x52')](function(_0x4be2ad){const _0xe4bff4=_0x148461;if(_0x4be2ad)return _0x20d07a=_0x4be2ad,db['UserVoiceQueueRt'][_0xe4bff4('0x113')]({'where':{'membername':_0x20d07a[_0xe4bff4('0x7b')]},'individualHooks':!![]});})[_0x148461('0x52')](function(){const _0x9a5cb9=_0x148461;return db['MemberReport']['findAll']({'where':{'membername':_0x20d07a[_0x9a5cb9('0x7b')],'exitAt':null}});})['then'](function(_0x5eb984){const _0x4111fb=_0x148461,_0x169940=[];return _0x5eb984[_0x4111fb('0xe6')](function(_0x8b8a5f){const _0x667960=_0x4111fb;_0x169940[_0x667960('0x146')](_0x8b8a5f['update']({'exitAt':moment()['format'](_0x667960('0xa'))}));}),Promise[_0x4111fb('0x9')](_0x169940);})[_0x148461('0x52')](function(){const _0x305602=_0x148461;return _0x20d07a[_0x305602('0x6c')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x148461('0x52')](respondWithResult(_0x3746f4,null))[_0x148461('0x90')](handleError(_0x3746f4,null));},exports[_0x1a4ed3('0x3c')]=function(_0x45c40e,_0x36eed2){const _0x49964e=_0x1a4ed3;let _0x265bf0;return db['UserVoiceQueueRt'][_0x49964e('0x6c')]({'paused':0x1},{'where':{'UserId':_0x45c40e['params']['id']},'individualHooks':!![]})[_0x49964e('0x52')](function(){const _0x9e1a00=_0x49964e;return db[_0x9e1a00('0x159')][_0x9e1a00('0xd6')]({'where':{'id':_0x45c40e['params']['id'],'role':'agent'},'attributes':['id',_0x9e1a00('0x7b'),_0x9e1a00('0x7'),'internal','interface']});})['then'](handleEntityNotFound(_0x36eed2,null))['then'](function(_0x125fc0){const _0x285f45=_0x49964e;if(_0x125fc0)return _0x265bf0=_0x125fc0,respondWithRpcPromise(_0x285f45('0x152'),'pause',{'id':_0x265bf0['id'],'name':_0x265bf0['name'],'pause':!![]});})[_0x49964e('0x52')](function(){const _0x45af6d=_0x49964e;if(_0x265bf0)return db[_0x45af6d('0x18')][_0x45af6d('0x14c')]({'where':{'membername':_0x265bf0[_0x45af6d('0x7b')],'type':_0x45af6d('0x122'),'exitAt':null}});})['then'](function(_0x12ee6e){const _0x59b439=_0x49964e;if(_0x12ee6e['length']){const _0x159454=moment()[_0x59b439('0x11c')](_0x59b439('0xa'));for(let _0x1dcb2f=0x0,_0x13124c=_0x12ee6e[_0x59b439('0x4e')];_0x1dcb2f<_0x13124c;_0x1dcb2f++){_0x12ee6e[_0x1dcb2f][_0x59b439('0x6c')]({'exitAt':_0x159454});}}})[_0x49964e('0x52')](function(){const _0x59a87d=_0x49964e,_0x2b5bfc=[],_0x156cfc=utils[_0x59a87d('0x1')]();return _0x156cfc[_0x59a87d('0xe6')](function(_0x3c2dd8){const _0x397127=_0x59a87d;_0x2b5bfc[_0x397127('0x146')]({'channel':_0x3c2dd8,'membername':_0x265bf0[_0x397127('0x7b')],'interface':_[_0x397127('0x141')](_0x265bf0[_0x397127('0x1f')])?util[_0x397127('0x11c')](_0x397127('0xfb'),_0x265bf0['name']):_0x265bf0['interface'],'type':_0x397127('0x122'),'enterAt':moment()['format'](_0x397127('0xa')),'data1':_0x45c40e[_0x397127('0xf1')]['type']||_0x397127('0x131'),'role':_0x265bf0[_0x397127('0x7')],'internal':_0x265bf0[_0x397127('0x149')]});}),db[_0x59a87d('0x18')][_0x59a87d('0x93')](_0x2b5bfc,{'individualHooks':!![]});})['then'](function(){const _0x5a4e4a=_0x49964e;return _0x265bf0[_0x5a4e4a('0x6c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x45c40e['body'][_0x5a4e4a('0x11a')]||_0x5a4e4a('0x131'),'lastPauseAt':moment()[_0x5a4e4a('0x11c')](_0x5a4e4a('0xa'))});})[_0x49964e('0x52')](respondWithResult(_0x36eed2,null))[_0x49964e('0x90')](handleError(_0x36eed2,null));},exports[_0x1a4ed3('0x76')]=function(_0x250ae3,_0x5cb1c3){const _0x4d805e=_0x1a4ed3;let _0x411c15;return db[_0x4d805e('0x159')]['findOne']({'where':{'id':_0x250ae3[_0x4d805e('0xdd')]['id']},'attributes':['id','name',_0x4d805e('0x7'),_0x4d805e('0x94'),'mailPause',_0x4d805e('0x151'),_0x4d805e('0x1d'),'openchannelPause','smsPause',_0x4d805e('0x58'),_0x4d805e('0x6f'),'lastPauseAt']})['then'](handleEntityNotFound(_0x5cb1c3,null))['then'](function(_0x183aa4){const _0x583c88=_0x4d805e;if(_0x183aa4){_0x411c15=_0x183aa4;if(_0x250ae3[_0x583c88('0xf1')]['channel']&&!utils['isValidChannel'](_0x250ae3[_0x583c88('0xf1')][_0x583c88('0x9c')]))throw new ValidationError(_0x583c88('0x103'));switch(_0x250ae3[_0x583c88('0xf1')][_0x583c88('0x9c')]){case _0x583c88('0x10'):return respondWithRpcPromise(_0x583c88('0x152'),_0x583c88('0x76'),{'id':_0x411c15['id'],'name':_0x411c15[_0x583c88('0x7b')],'pause':![]})[_0x583c88('0x52')](function(){const _0x1a5f33=_0x583c88;return db[_0x1a5f33('0x17')]['update']({'paused':0x0},{'where':{'UserId':_0x411c15['id']},'individualHooks':!![]});})[_0x583c88('0x52')](function(){const _0x5db9d4=_0x583c88;return db['MemberReport'][_0x5db9d4('0xd6')]({'where':{'channel':_0x250ae3['body'][_0x5db9d4('0x9c')],'membername':_0x411c15[_0x5db9d4('0x7b')],'type':'PAUSE','exitAt':null}});})[_0x583c88('0x52')](function(_0x1ea616){const _0x41bac0=_0x583c88;if(_0x1ea616)return _0x1ea616[_0x41bac0('0x6c')]({'exitAt':moment()['format'](_0x41bac0('0xa')),'data2':_0x41bac0('0x77')},{'individualHooks':!![]});return null;})['then'](function(){const _0x357732=_0x583c88;return _0x411c15[_0x357732('0x6c')]({'voicePause':![]});});case _0x583c88('0x71'):case _0x583c88('0x65'):case _0x583c88('0x12a'):case'sms':case _0x583c88('0x81'):case'openchannel':return db[_0x583c88('0x18')][_0x583c88('0xd6')]({'where':{'channel':_0x250ae3[_0x583c88('0xf1')][_0x583c88('0x9c')],'membername':_0x411c15[_0x583c88('0x7b')],'type':'PAUSE','exitAt':null}})[_0x583c88('0x52')](function(_0x51e223){const _0x5a0a28=_0x583c88;if(_0x51e223)return _0x51e223[_0x5a0a28('0x6c')]({'exitAt':moment()['format'](_0x5a0a28('0xa')),'data2':'manual'},{'individualHooks':!![]});return null;})['then'](function(){const _0x3b0c36=_0x583c88,_0x17bc4a={};return _['set'](_0x17bc4a,util[_0x3b0c36('0x11c')](_0x3b0c36('0xe3'),_0x250ae3[_0x3b0c36('0xf1')][_0x3b0c36('0x9c')],_0x3b0c36('0xc')),![]),_0x411c15['update'](_0x17bc4a);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x411c15['id'],'name':_0x411c15[_0x583c88('0x7b')],'pause':![]})[_0x583c88('0x52')](function(){const _0xd74bab=_0x583c88;return db[_0xd74bab('0x17')][_0xd74bab('0x6c')]({'paused':0x0},{'where':{'UserId':_0x411c15['id']}});})[_0x583c88('0x52')](function(){const _0x13731a=_0x583c88;return db[_0x13731a('0x18')]['findAll']({'where':{'membername':_0x411c15[_0x13731a('0x7b')],'type':_0x13731a('0x122'),'exitAt':null}});})['then'](function(_0x2752fa){const _0x48a1d0=[];return _0x2752fa['forEach'](function(_0x147408){const _0x50e851=a648_0x254f;_0x48a1d0[_0x50e851('0x146')](_0x147408[_0x50e851('0x6c')]({'exitAt':moment()[_0x50e851('0x11c')](_0x50e851('0xa')),'data2':'manual'}));}),Promise['all'](_0x48a1d0);})[_0x583c88('0x52')](function(){const _0x22ce81=_0x583c88;return _0x411c15[_0x22ce81('0x6c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x4d805e('0x52')](respondWithResult(_0x5cb1c3,null))[_0x4d805e('0x90')](handleError(_0x5cb1c3,null));},exports[_0x1a4ed3('0x45')]=function(_0x127e13,_0x438fbc){const _0x1da706=_0x1a4ed3;let _0x1583a0={};const _0x13e5c9={};let _0x3d212f,_0x369871;return db[_0x1da706('0x159')]['findOne']({'where':{'id':_0x127e13[_0x1da706('0xdd')]['id']}})[_0x1da706('0x52')](handleEntityNotFound(_0x438fbc,null))[_0x1da706('0x52')](function(_0x1490ca){const _0x2c2422=_0x1da706;if(_0x1490ca)return _0x3d212f=_0x1490ca,_0x13e5c9['model']=_[_0x2c2422('0x33')](db[_0x2c2422('0x8e')][_0x2c2422('0xeb')]),_0x13e5c9[_0x2c2422('0x2a')]=_[_0x2c2422('0x33')](_0x127e13[_0x2c2422('0x2a')]),_0x13e5c9[_0x2c2422('0x13b')]=_[_0x2c2422('0x111')](_0x13e5c9[_0x2c2422('0x15a')],_0x13e5c9[_0x2c2422('0x2a')]),_0x1583a0[_0x2c2422('0x145')]=_[_0x2c2422('0x111')](_0x13e5c9['model'],qs[_0x2c2422('0x41')](_0x127e13['query']['fields'])),_0x1583a0[_0x2c2422('0x145')]=_0x1583a0['attributes'][_0x2c2422('0x4e')]?_0x1583a0['attributes']:_0x13e5c9[_0x2c2422('0x15a')],_0x1583a0[_0x2c2422('0x13d')]=qs[_0x2c2422('0x5')](_0x127e13['query']['sort']),_0x1583a0['where']=qs[_0x2c2422('0x13b')](_[_0x2c2422('0x13f')](_0x127e13[_0x2c2422('0x2a')],_0x13e5c9['filters'])),_0x127e13['query'][_0x2c2422('0x95')]&&(_0x1583a0[_0x2c2422('0x10d')]=_[_0x2c2422('0xdb')](_0x1583a0[_0x2c2422('0x10d')],{[Op['or']]:_['map'](_0x1583a0[_0x2c2422('0x145')],function(_0x2110d0){const _0x423aee=_0x2c2422,_0x48bd78={};return _0x48bd78[_0x2110d0]={[Op['like']]:'%'+_0x127e13[_0x423aee('0x2a')]['filter']+'%'},_0x48bd78;})})),_0x1583a0=_[_0x2c2422('0xdb')]({},_0x1583a0,_0x127e13[_0x2c2422('0xa1')]),_0x3d212f[_0x2c2422('0x45')](_0x1583a0);})['then'](function(_0x282eec){const _0xe10fe7=_0x1da706;if(_0x282eec)return _0x369871=_0x282eec[_0xe10fe7('0x4e')],typeof _0x127e13['query'][_0xe10fe7('0x12c')]==='undefined'&&(_0x1583a0[_0xe10fe7('0x3e')]=qs[_0xe10fe7('0x3e')](_0x127e13['query'][_0xe10fe7('0x3e')]),_0x1583a0[_0xe10fe7('0x9a')]=qs['offset'](_0x127e13[_0xe10fe7('0x2a')][_0xe10fe7('0x9a')])),_0x3d212f[_0xe10fe7('0x45')](_0x1583a0);})[_0x1da706('0x52')](function(_0x3b7837){if(_0x3b7837)return _0x3b7837?{'count':_0x369871,'rows':_0x3b7837}:null;})[_0x1da706('0x52')](respondWithResult(_0x438fbc,null))[_0x1da706('0x90')](handleError(_0x438fbc,null));},exports[_0x1a4ed3('0x138')]=function(_0x3f622d,_0x1ad6e9){const _0x50a438=_0x1a4ed3;return db[_0x50a438('0x159')][_0x50a438('0xd6')]({'where':{'id':_0x3f622d[_0x50a438('0xdd')]['id']}})[_0x50a438('0x52')](handleEntityNotFound(_0x1ad6e9,null))[_0x50a438('0x52')](function(_0xeb6c9c){const _0xae2fd4=_0x50a438;if(_0xeb6c9c){const _0x55ad3d=_0xeb6c9c[_0xae2fd4('0xa5')]({'plain':!![]});return _0xeb6c9c[_0xae2fd4('0x138')](_0x3f622d[_0xae2fd4('0xf1')][_0xae2fd4('0xda')],_['omit'](_0x3f622d[_0xae2fd4('0xf1')],[_0xae2fd4('0xda'),'id'])||{})[_0xae2fd4('0x52')](function(){const _0x299303=_0xae2fd4;for(let _0x2b6777=0x0;_0x2b6777<_0x3f622d[_0x299303('0xf1')][_0x299303('0xda')][_0x299303('0x4e')];_0x2b6777++){let _0x5d6fc4=[];db['Team'][_0x299303('0xd6')]({'where':{'id':_0x3f622d['body'][_0x299303('0xda')][_0x2b6777]}})[_0x299303('0x52')](function(_0x559de7){const _0x4a6c92=_0x299303;return _0x5d6fc4[_0x4a6c92('0x146')](_0x559de7[_0x4a6c92('0x8d')]()[_0x4a6c92('0x52')](function(_0x3c4c98){const _0x137e91=_0x4a6c92;for(let _0x1f97a5=0x0;_0x1f97a5<_0x3c4c98[_0x137e91('0x4e')];_0x1f97a5++){_0x3c4c98[_0x1f97a5][_0x137e91('0xf')](_0x137e91('0x9c'),_0x137e91('0xca'));}return _0x3c4c98;})),_0x5d6fc4[_0x4a6c92('0x146')](_0x559de7[_0x4a6c92('0x37')]()[_0x4a6c92('0x52')](function(_0x446dda){const _0x1b5b81=_0x4a6c92;for(let _0xe2dfaf=0x0;_0xe2dfaf<_0x446dda[_0x1b5b81('0x4e')];_0xe2dfaf++){_0x446dda[_0xe2dfaf][_0x1b5b81('0xf')](_0x1b5b81('0x9c'),'Chat');}return _0x446dda;})),_0x5d6fc4[_0x4a6c92('0x146')](_0x559de7[_0x4a6c92('0x14a')]()['then'](function(_0x2d1a5e){const _0x4a7b78=_0x4a6c92;for(let _0x193bb4=0x0;_0x193bb4<_0x2d1a5e[_0x4a7b78('0x4e')];_0x193bb4++){_0x2d1a5e[_0x193bb4]['setDataValue'](_0x4a7b78('0x9c'),_0x4a7b78('0x126'));}return _0x2d1a5e;})),_0x5d6fc4['push'](_0x559de7[_0x4a6c92('0x14e')]()[_0x4a6c92('0x52')](function(_0x36434d){const _0x13891c=_0x4a6c92;for(let _0x356504=0x0;_0x356504<_0x36434d['length'];_0x356504++){_0x36434d[_0x356504][_0x13891c('0xf')](_0x13891c('0x9c'),_0x13891c('0x75'));}return _0x36434d;})),_0x5d6fc4['push'](_0x559de7[_0x4a6c92('0x137')]()[_0x4a6c92('0x52')](function(_0x1997ac){const _0x254a41=_0x4a6c92;for(let _0x498c5b=0x0;_0x498c5b<_0x1997ac[_0x254a41('0x4e')];_0x498c5b++){_0x1997ac[_0x498c5b]['setDataValue'](_0x254a41('0x9c'),_0x254a41('0xc4'));}return _0x1997ac;})),_0x5d6fc4['push'](_0x559de7[_0x4a6c92('0x61')]()[_0x4a6c92('0x52')](function(_0x4ef260){const _0x9d176f=_0x4a6c92;for(let _0x484219=0x0;_0x484219<_0x4ef260[_0x9d176f('0x4e')];_0x484219++){_0x4ef260[_0x484219]['setDataValue'](_0x9d176f('0x9c'),_0x9d176f('0x123'));}return _0x4ef260;})),_0x5d6fc4[_0x4a6c92('0x146')](_0x559de7[_0x4a6c92('0x22')]()['then'](function(_0x5873e3){const _0x3b1e8a=_0x4a6c92;for(let _0x4e04ac=0x0;_0x4e04ac<_0x5873e3[_0x3b1e8a('0x4e')];_0x4e04ac++){_0x5873e3[_0x4e04ac][_0x3b1e8a('0xf')](_0x3b1e8a('0x9c'),_0x3b1e8a('0x69'));}return _0x5873e3;})),Promise[_0x4a6c92('0x9')](_0x5d6fc4);})['then'](function(_0xb62559){const _0x3d077e=_0x299303,_0x4b38b8=_[_0x3d077e('0x107')](_0xb62559);return _0x5d6fc4=[],db[_0x3d077e('0x84')]['transaction'](function(_0x1b772d){const _0xad7e90=_0x3d077e;for(let _0xc98fd0=0x0;_0xc98fd0<_0x4b38b8[_0xad7e90('0x4e')];_0xc98fd0++){_0x5d6fc4['push'](_0x4b38b8[_0xc98fd0]['addAgent'](_0x55ad3d['id']),{'transaction':_0x1b772d});}return Promise[_0xad7e90('0x9')](_0x5d6fc4)[_0xad7e90('0x52')](function(){const _0x58d2e2=_0xad7e90;if(_0x55ad3d[_0x58d2e2('0x24')])return Promise[_0x58d2e2('0xc6')](_['filter'](_0x4b38b8,function(_0x268026){const _0x47b41a=_0x58d2e2;return _0x268026['getDataValue'](_0x47b41a('0x9c'))===_0x47b41a('0xca');}),function(_0x3705b3){const _0x3951ec=_0x58d2e2;return db[_0x3951ec('0x17')][_0x3951ec('0xe7')]({'membername':_0x55ad3d[_0x3951ec('0x7b')],'UserId':_0x55ad3d['id'],'queue_name':_0x3705b3[_0x3951ec('0x7b')],'VoiceQueueId':_0x3705b3['id'],'interface':_[_0x3951ec('0x141')](_0x55ad3d[_0x3951ec('0x1f')])?util['format']('SIP/%s',_0x55ad3d[_0x3951ec('0x7b')]):_0x55ad3d[_0x3951ec('0x1f')],'paused':_0x55ad3d[_0x3951ec('0x94')]||![],'penalty':_0x55ad3d[_0x3951ec('0x3f')]},{'transaction':_0x1b772d});});else return;})[_0xad7e90('0x52')](function(){const _0x4bef64=_0xad7e90;for(let _0x2499a4=0x0;_0x2499a4<_0x4b38b8[_0x4bef64('0x4e')];_0x2499a4++){const _0x107e3f=_0x4b38b8[_0x2499a4][_0x4bef64('0x9b')](_0x4bef64('0x9c')),_0x367982=_0x107e3f+_0x4bef64('0xab');socket[_0x4bef64('0x135')](_0x4bef64('0xc8')+_0x107e3f+_0x4bef64('0x87'),{'UserId':_0x55ad3d['id'],[_0x367982]:_0x4b38b8[_0x2499a4]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x1ad6e9,null))[_0x50a438('0x90')](handleError(_0x1ad6e9,null));},exports[_0x1a4ed3('0x109')]=function(_0x23d60f,_0x3b036b){const _0x455e9e=_0x1a4ed3;return db[_0x455e9e('0x159')][_0x455e9e('0xd6')]({'where':{'id':_0x23d60f[_0x455e9e('0xdd')]['id']}})['then'](handleEntityNotFound(_0x3b036b,null))[_0x455e9e('0x52')](function(_0x56348f){const _0x18c119=_0x455e9e;if(_0x56348f){const _0x265e13=_0x56348f[_0x18c119('0xa5')]({'plain':!![]}),_0x168634=_0x23d60f[_0x18c119('0x2a')]['ids'];return _0x56348f[_0x18c119('0x109')](_0x168634)[_0x18c119('0x52')](function(){const _0x2e45ce=_0x18c119;for(let _0x131f28=0x0;_0x131f28<_0x168634[_0x2e45ce('0x4e')];_0x131f28++){let _0x4bd43d=[];db[_0x2e45ce('0x8e')][_0x2e45ce('0xd6')]({'where':{'id':_0x168634[_0x131f28]}})[_0x2e45ce('0x52')](function(_0x6d63ef){const _0x3b5e22=_0x2e45ce;return _0x4bd43d[_0x3b5e22('0x146')](_0x6d63ef['getVoiceQueues']()[_0x3b5e22('0x52')](function(_0x234bcf){const _0x531064=_0x3b5e22;for(let _0x207d70=0x0;_0x207d70<_0x234bcf[_0x531064('0x4e')];_0x207d70++){_0x234bcf[_0x207d70][_0x531064('0xf')](_0x531064('0x9c'),'Voice');}return _0x234bcf;})),_0x4bd43d[_0x3b5e22('0x146')](_0x6d63ef['getChatQueues']()['then'](function(_0x357740){const _0x4ab2b4=_0x3b5e22;for(let _0x6071cc=0x0;_0x6071cc<_0x357740[_0x4ab2b4('0x4e')];_0x6071cc++){_0x357740[_0x6071cc][_0x4ab2b4('0xf')](_0x4ab2b4('0x9c'),'Chat');}return _0x357740;})),_0x4bd43d[_0x3b5e22('0x146')](_0x6d63ef[_0x3b5e22('0x14a')]()['then'](function(_0x3dfc8b){const _0x380173=_0x3b5e22;for(let _0x3b44af=0x0;_0x3b44af<_0x3dfc8b[_0x380173('0x4e')];_0x3b44af++){_0x3dfc8b[_0x3b44af]['setDataValue'](_0x380173('0x9c'),_0x380173('0x126'));}return _0x3dfc8b;})),_0x4bd43d[_0x3b5e22('0x146')](_0x6d63ef[_0x3b5e22('0x14e')]()[_0x3b5e22('0x52')](function(_0x2c179e){const _0x14f10b=_0x3b5e22;for(let _0x53be1d=0x0;_0x53be1d<_0x2c179e[_0x14f10b('0x4e')];_0x53be1d++){_0x2c179e[_0x53be1d][_0x14f10b('0xf')](_0x14f10b('0x9c'),_0x14f10b('0x75'));}return _0x2c179e;})),_0x4bd43d[_0x3b5e22('0x146')](_0x6d63ef[_0x3b5e22('0x137')]()['then'](function(_0x7ea008){const _0x3d139a=_0x3b5e22;for(let _0x11f498=0x0;_0x11f498<_0x7ea008[_0x3d139a('0x4e')];_0x11f498++){_0x7ea008[_0x11f498][_0x3d139a('0xf')]('channel',_0x3d139a('0xc4'));}return _0x7ea008;})),_0x4bd43d[_0x3b5e22('0x146')](_0x6d63ef[_0x3b5e22('0x61')]()[_0x3b5e22('0x52')](function(_0x5e8d4b){const _0x5368b6=_0x3b5e22;for(let _0x5d3532=0x0;_0x5d3532<_0x5e8d4b[_0x5368b6('0x4e')];_0x5d3532++){_0x5e8d4b[_0x5d3532]['setDataValue'](_0x5368b6('0x9c'),_0x5368b6('0x123'));}return _0x5e8d4b;})),_0x4bd43d[_0x3b5e22('0x146')](_0x6d63ef[_0x3b5e22('0x22')]()[_0x3b5e22('0x52')](function(_0x4f2b19){const _0x413a3b=_0x3b5e22;for(let _0x154d4d=0x0;_0x154d4d<_0x4f2b19[_0x413a3b('0x4e')];_0x154d4d++){_0x4f2b19[_0x154d4d][_0x413a3b('0xf')](_0x413a3b('0x9c'),_0x413a3b('0x69'));}return _0x4f2b19;})),Promise['all'](_0x4bd43d);})[_0x2e45ce('0x52')](function(_0x29ad8f){const _0x2e7a7e=_0x2e45ce,_0xa17c05=_[_0x2e7a7e('0x107')](_0x29ad8f);return _0x4bd43d=[],db[_0x2e7a7e('0x84')][_0x2e7a7e('0x9f')](function(_0x2039b9){const _0x25bf04=_0x2e7a7e;for(let _0x414a5e=0x0;_0x414a5e<_0xa17c05[_0x25bf04('0x4e')];_0x414a5e++){_0x4bd43d[_0x25bf04('0x146')](_0xa17c05[_0x414a5e]['removeAgent'](_0x265e13['id']),{'transaction':_0x2039b9});}return Promise[_0x25bf04('0x9')](_0x4bd43d)[_0x25bf04('0x52')](function(){const _0x1aab7a=_0x25bf04;if(_0x265e13[_0x1aab7a('0x24')])return Promise['each'](_[_0x1aab7a('0x95')](_0xa17c05,function(_0x364e15){const _0x11a991=_0x1aab7a;return _0x364e15[_0x11a991('0x9b')](_0x11a991('0x9c'))===_0x11a991('0xca');}),function(_0x18677e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x18677e['id'],'UserId':_0x265e13['id']},'transaction':_0x2039b9});});else return;})[_0x25bf04('0x52')](function(){const _0x27d74e=_0x25bf04;for(let _0x56ca31=0x0;_0x56ca31<_0xa17c05[_0x27d74e('0x4e')];_0x56ca31++){const _0x631587=_0xa17c05[_0x56ca31][_0x27d74e('0x9b')](_0x27d74e('0x9c')),_0x3e082e=_0x631587+'QueueId';socket[_0x27d74e('0x135')](_0x27d74e('0xc8')+_0x631587+'Queue:remove',{'UserId':_0x265e13['id'],[_0x3e082e]:_0xa17c05[_0x56ca31]['id']});}});});});}});}})[_0x455e9e('0x52')](respondWithStatusCode(_0x3b036b,null))[_0x455e9e('0x90')](handleError(_0x3b036b,null));},exports[_0x1a4ed3('0x27')]=function(_0x2011f7,_0x28f3ea){const _0x4df990=_0x1a4ed3;let _0x54d29f={};const _0xdf33ec={};let _0x279f42,_0x22e13e;return db[_0x4df990('0x159')][_0x4df990('0xd6')]({'where':{'id':_0x2011f7[_0x4df990('0xdd')]['id']}})[_0x4df990('0x52')](handleEntityNotFound(_0x28f3ea,null))[_0x4df990('0x52')](function(_0x239d95){const _0x152112=_0x4df990;if(_0x239d95)return _0x279f42=_0x239d95,_0xdf33ec[_0x152112('0x15a')]=_[_0x152112('0x33')](db[_0x152112('0x156')][_0x152112('0xeb')]),_0xdf33ec[_0x152112('0x2a')]=_[_0x152112('0x33')](_0x2011f7[_0x152112('0x2a')]),_0xdf33ec[_0x152112('0x13b')]=_[_0x152112('0x111')](_0xdf33ec['model'],_0xdf33ec[_0x152112('0x2a')]),_0x54d29f['attributes']=_['intersection'](_0xdf33ec[_0x152112('0x15a')],qs[_0x152112('0x41')](_0x2011f7[_0x152112('0x2a')][_0x152112('0x41')])),_0x54d29f['attributes']=_0x54d29f['attributes'][_0x152112('0x4e')]?_0x54d29f[_0x152112('0x145')]:_0xdf33ec[_0x152112('0x15a')],_0x54d29f[_0x152112('0x13d')]=qs['sort'](_0x2011f7[_0x152112('0x2a')][_0x152112('0x5')]),_0x54d29f[_0x152112('0x10d')]=qs['filters'](_[_0x152112('0x13f')](_0x2011f7[_0x152112('0x2a')],_0xdf33ec['filters'])),_0x2011f7[_0x152112('0x2a')][_0x152112('0x95')]&&(_0x54d29f[_0x152112('0x10d')]=_[_0x152112('0xdb')](_0x54d29f[_0x152112('0x10d')],{[Op['or']]:_[_0x152112('0x30')](_0x54d29f[_0x152112('0x145')],function(_0x40d879){const _0x1f8257=_0x152112,_0xb373c4={};return _0xb373c4[_0x40d879]={[Op[_0x1f8257('0xf7')]]:'%'+_0x2011f7[_0x1f8257('0x2a')]['filter']+'%'},_0xb373c4;})})),_0x54d29f=_[_0x152112('0xdb')]({},_0x54d29f,_0x2011f7[_0x152112('0xa1')]),_0x279f42[_0x152112('0x27')](_0x54d29f);})[_0x4df990('0x52')](function(_0x317aa9){const _0x360a30=_0x4df990;if(_0x317aa9)return _0x22e13e=_0x317aa9[_0x360a30('0x4e')],typeof _0x2011f7['query'][_0x360a30('0x12c')]===_0x360a30('0xa4')&&(_0x54d29f[_0x360a30('0x3e')]=qs[_0x360a30('0x3e')](_0x2011f7[_0x360a30('0x2a')][_0x360a30('0x3e')]),_0x54d29f[_0x360a30('0x9a')]=qs[_0x360a30('0x9a')](_0x2011f7[_0x360a30('0x2a')][_0x360a30('0x9a')])),_0x279f42['getLists'](_0x54d29f);})[_0x4df990('0x52')](function(_0x2c7dab){if(_0x2c7dab)return _0x2c7dab?{'count':_0x22e13e,'rows':_0x2c7dab}:null;})[_0x4df990('0x52')](respondWithResult(_0x28f3ea,null))['catch'](handleError(_0x28f3ea,null));},exports[_0x1a4ed3('0x124')]=function(_0x3f894f,_0x505b62){const _0x43e0fc=_0x1a4ed3;let _0x1ffc8c={};const _0x1c4b7d={};let _0x4a5fa3;return db[_0x43e0fc('0x159')][_0x43e0fc('0xd6')]({'where':{'id':_0x3f894f['params']['id']}})['then'](handleEntityNotFound(_0x505b62,null))['then'](function(_0x44e6ed){const _0x4baece=_0x43e0fc;if(_0x44e6ed)return _0x4a5fa3=_0x44e6ed,_0x1c4b7d[_0x4baece('0x15a')]=_[_0x4baece('0x33')](db['User'][_0x4baece('0xeb')]),_0x1c4b7d[_0x4baece('0x2a')]=_[_0x4baece('0x33')](_0x3f894f['query']),_0x1c4b7d['filters']=_[_0x4baece('0x111')](_0x1c4b7d[_0x4baece('0x15a')],_0x1c4b7d[_0x4baece('0x2a')]),_0x1ffc8c[_0x4baece('0x145')]=_['intersection'](_0x1c4b7d[_0x4baece('0x15a')],qs['fields'](_0x3f894f['query'][_0x4baece('0x41')])),_0x1ffc8c[_0x4baece('0x145')]=_0x1ffc8c[_0x4baece('0x145')][_0x4baece('0x4e')]?_0x1ffc8c[_0x4baece('0x145')]:_0x1c4b7d['model'],_0x1ffc8c[_0x4baece('0x13d')]=qs['sort'](_0x3f894f[_0x4baece('0x2a')][_0x4baece('0x5')]),_0x1ffc8c[_0x4baece('0x10d')]=qs[_0x4baece('0x13b')](_[_0x4baece('0x13f')](_0x3f894f[_0x4baece('0x2a')],_0x1c4b7d['filters'])),_0x3f894f[_0x4baece('0x2a')][_0x4baece('0x95')]&&(_0x1ffc8c[_0x4baece('0x10d')]=_[_0x4baece('0xdb')](_0x1ffc8c[_0x4baece('0x10d')],{[Op['or']]:_[_0x4baece('0x30')](_0x1ffc8c[_0x4baece('0x145')],function(_0x35c910){const _0x14f010=_0x4baece,_0x304251={};return _0x304251[_0x35c910]={[Op[_0x14f010('0xf7')]]:'%'+_0x3f894f[_0x14f010('0x2a')][_0x14f010('0x95')]+'%'},_0x304251;})})),_0x1ffc8c['model']=db[_0x4baece('0x159')],_0x1ffc8c['as']=_0x4baece('0x92'),_0x1ffc8c=_[_0x4baece('0xdb')]({},_0x1ffc8c,_0x3f894f['options']),_0x4a5fa3[_0x4baece('0x8d')]({'include':[_0x1ffc8c]});})[_0x43e0fc('0x52')](function(_0x42a0b4){const _0x27eca7=_0x43e0fc;if(_0x42a0b4){let _0x348a0c={};const _0x4e8ed5=[];for(let _0x4033c4=0x0;_0x4033c4<_0x42a0b4[_0x27eca7('0x4e')];_0x4033c4+=0x1){for(let _0x42b2d4=0x0,_0xf17f17;_0x42b2d4<_0x42a0b4[_0x4033c4][_0x27eca7('0x92')][_0x27eca7('0x4e')];_0x42b2d4+=0x1){_0xf17f17=_0x42a0b4[_0x4033c4]['Agents'][_0x42b2d4][_0x27eca7('0xa5')]({'plain':!![]}),_0x348a0c[_0xf17f17['id']]=_0xf17f17;}}_0x348a0c=_[_0x27eca7('0x121')](_0x348a0c);for(let _0x5cec2a=qs['offset'](_0x3f894f[_0x27eca7('0x2a')][_0x27eca7('0x9a')]);_0x5cec2a<_0x348a0c[_0x27eca7('0x4e')]&&_0x4e8ed5[_0x27eca7('0x4e')]<qs[_0x27eca7('0x3e')](_0x3f894f[_0x27eca7('0x2a')][_0x27eca7('0x3e')]);_0x5cec2a+=0x1){_0x348a0c[_0x5cec2a]&&_0x4e8ed5['push'](_0x348a0c[_0x5cec2a]);}return{'count':_0x348a0c['length'],'rows':_0x4e8ed5};}})['then'](respondWithResult(_0x505b62,null))[_0x43e0fc('0x90')](handleError(_0x505b62,null));},exports[_0x1a4ed3('0x113')]=function(_0x9da3da,_0x21c521){const _0x536532=_0x1a4ed3;if(_0x9da3da['user']['id']==_0x9da3da['params']['id'])return _0x21c521['status'](0x1f4)[_0x536532('0x21')]({'message':'You\x20can\x27t\x20delete\x20yourself'});return db[_0x536532('0x159')]['findOne']({'where':{'id':_0x9da3da['params']['id']}})[_0x536532('0x52')](handleEntityNotFound(_0x21c521,null))[_0x536532('0x52')](removeEntity(_0x21c521,null))[_0x536532('0x90')](handleError(_0x21c521,null));},exports['addChatInteractions']=function(_0x309ca5,_0x5ef0d4){const _0x3341aa=_0x1a4ed3;return db[_0x3341aa('0x159')]['findOne']({'where':{'id':_0x309ca5[_0x3341aa('0xdd')]['id']}})[_0x3341aa('0x52')](handleEntityNotFound(_0x5ef0d4,null))['then'](function(_0x255a4a){const _0x59e189=_0x3341aa;if(_0x255a4a)return _0x255a4a[_0x59e189('0x3d')](_0x309ca5[_0x59e189('0xf1')][_0x59e189('0xda')],{'through':_[_0x59e189('0xb4')](_0x309ca5[_0x59e189('0xf1')],[_0x59e189('0xda'),'id'])})[_0x59e189('0x52')](function(){const _0x497334=_0x59e189;for(let _0x3118fd=0x0;_0x3118fd<_0x309ca5['body'][_0x497334('0xda')][_0x497334('0x4e')];_0x3118fd+=0x1){socket[_0x497334('0x135')](_0x497334('0x38'),{'ChatInteractionId':Number(_0x309ca5[_0x497334('0xf1')][_0x497334('0xda')][_0x3118fd]),'UserId':Number(_0x309ca5['params']['id'])});}return _0x309ca5['body']['ids'];});})['then'](respondWithResult(_0x5ef0d4,null))['catch'](handleError(_0x5ef0d4,null));},exports[_0x1a4ed3('0x125')]=function(_0x138118,_0x21e316){const _0x5357f9=_0x1a4ed3;return db[_0x5357f9('0x159')][_0x5357f9('0xd6')]({'where':{'id':_0x138118[_0x5357f9('0xdd')]['id']}})[_0x5357f9('0x52')](handleEntityNotFound(_0x21e316,null))[_0x5357f9('0x52')](function(_0x524b50){const _0x27fec5=_0x5357f9;if(_0x524b50)return _0x524b50[_0x27fec5('0x125')](_0x138118[_0x27fec5('0x2a')]['ids'])[_0x27fec5('0x52')](function(){const _0x34b2ab=_0x27fec5;if(_[_0x34b2ab('0xe0')](_0x138118[_0x34b2ab('0x2a')][_0x34b2ab('0xda')]))for(let _0x57f119=0x0;_0x57f119<_0x138118[_0x34b2ab('0x2a')]['ids'][_0x34b2ab('0x4e')];_0x57f119+=0x1){socket[_0x34b2ab('0x135')](_0x34b2ab('0x101'),{'ChatInteractionId':Number(_0x138118[_0x34b2ab('0x2a')][_0x34b2ab('0xda')][_0x57f119]),'UserId':Number(_0x138118['params']['id'])});}else socket[_0x34b2ab('0x135')](_0x34b2ab('0x101'),{'ChatInteractionId':Number(_0x138118[_0x34b2ab('0x2a')][_0x34b2ab('0xda')]),'UserId':Number(_0x138118[_0x34b2ab('0xdd')]['id'])});});})[_0x5357f9('0x52')](respondWithStatusCode(_0x21e316,null))[_0x5357f9('0x90')](handleError(_0x21e316,null));},exports[_0x1a4ed3('0x82')]=function(_0x237dde,_0x42c80a){const _0x10608c=_0x1a4ed3;return db[_0x10608c('0x159')]['findOne']({'where':{'id':_0x237dde['params']['id']}})['then'](handleEntityNotFound(_0x42c80a,null))['then'](function(_0x23cd03){const _0x4b8954=_0x10608c;if(_0x23cd03)return _0x23cd03['addMailInteractions'](_0x237dde[_0x4b8954('0xf1')][_0x4b8954('0xda')],{'through':_['omit'](_0x237dde[_0x4b8954('0xf1')],[_0x4b8954('0xda'),'id'])})[_0x4b8954('0x52')](function(){const _0x81dc19=_0x4b8954;for(let _0x5aba23=0x0;_0x5aba23<_0x237dde['body'][_0x81dc19('0xda')][_0x81dc19('0x4e')];_0x5aba23+=0x1){socket[_0x81dc19('0x135')]('user_has_mail_interactions:save',{'MailInteractionId':Number(_0x237dde[_0x81dc19('0xf1')][_0x81dc19('0xda')][_0x5aba23]),'UserId':Number(_0x237dde[_0x81dc19('0xdd')]['id'])});}return _0x237dde[_0x81dc19('0xf1')][_0x81dc19('0xda')];});})[_0x10608c('0x52')](respondWithResult(_0x42c80a,null))[_0x10608c('0x90')](handleError(_0x42c80a,null));},exports[_0x1a4ed3('0x139')]=function(_0x54a796,_0x4df8a6){const _0x2364e6=_0x1a4ed3;return db[_0x2364e6('0x159')]['findOne']({'where':{'id':_0x54a796['params']['id']}})[_0x2364e6('0x52')](handleEntityNotFound(_0x4df8a6,null))['then'](function(_0x466eba){const _0xd39e48=_0x2364e6;if(_0x466eba)return _0x466eba[_0xd39e48('0x139')](_0x54a796[_0xd39e48('0x2a')][_0xd39e48('0xda')])['then'](function(){const _0x259cfb=_0xd39e48;if(_[_0x259cfb('0xe0')](_0x54a796[_0x259cfb('0x2a')][_0x259cfb('0xda')]))for(let _0x200501=0x0;_0x200501<_0x54a796['query'][_0x259cfb('0xda')]['length'];_0x200501+=0x1){socket[_0x259cfb('0x135')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x54a796[_0x259cfb('0x2a')][_0x259cfb('0xda')][_0x200501]),'UserId':Number(_0x54a796[_0x259cfb('0xdd')]['id'])});}else socket[_0x259cfb('0x135')](_0x259cfb('0x14b'),{'MailInteractionId':Number(_0x54a796[_0x259cfb('0x2a')][_0x259cfb('0xda')]),'UserId':Number(_0x54a796[_0x259cfb('0xdd')]['id'])});});})[_0x2364e6('0x52')](respondWithStatusCode(_0x4df8a6,null))[_0x2364e6('0x90')](handleError(_0x4df8a6,null));},exports[_0x1a4ed3('0x102')]=function(_0x28e35d,_0xffb21b){const _0x305bc5=_0x1a4ed3;return db[_0x305bc5('0x159')][_0x305bc5('0xd6')]({'where':{'id':_0x28e35d[_0x305bc5('0xdd')]['id']}})[_0x305bc5('0x52')](handleEntityNotFound(_0xffb21b,null))[_0x305bc5('0x52')](function(_0x349c5b){const _0x502adc=_0x305bc5;if(_0x349c5b)return _0x349c5b[_0x502adc('0x102')](_0x28e35d['body'][_0x502adc('0xda')],{'through':_[_0x502adc('0xb4')](_0x28e35d[_0x502adc('0xf1')],[_0x502adc('0xda'),'id'])})[_0x502adc('0x52')](function(){const _0x39db7c=_0x502adc;for(let _0x55c583=0x0;_0x55c583<_0x28e35d[_0x39db7c('0xf1')][_0x39db7c('0xda')]['length'];_0x55c583+=0x1){socket[_0x39db7c('0x135')](_0x39db7c('0x14d'),{'FaxInteractionId':Number(_0x28e35d[_0x39db7c('0xf1')][_0x39db7c('0xda')][_0x55c583]),'UserId':Number(_0x28e35d[_0x39db7c('0xdd')]['id'])});}return _0x28e35d[_0x39db7c('0xf1')]['ids'];});})['then'](respondWithResult(_0xffb21b,null))[_0x305bc5('0x90')](handleError(_0xffb21b,null));},exports[_0x1a4ed3('0x12f')]=function(_0x4a57a2,_0x1d968d){const _0x4e678e=_0x1a4ed3;return db[_0x4e678e('0x159')][_0x4e678e('0xd6')]({'where':{'id':_0x4a57a2[_0x4e678e('0xdd')]['id']}})[_0x4e678e('0x52')](handleEntityNotFound(_0x1d968d,null))[_0x4e678e('0x52')](function(_0x2a54cc){const _0x59e62b=_0x4e678e;if(_0x2a54cc)return _0x2a54cc[_0x59e62b('0x12f')](_0x4a57a2['query'][_0x59e62b('0xda')])[_0x59e62b('0x52')](function(){const _0x6ef735=_0x59e62b;if(_['isArray'](_0x4a57a2[_0x6ef735('0x2a')][_0x6ef735('0xda')]))for(let _0x595f1a=0x0;_0x595f1a<_0x4a57a2[_0x6ef735('0x2a')]['ids'][_0x6ef735('0x4e')];_0x595f1a+=0x1){socket[_0x6ef735('0x135')](_0x6ef735('0xbf'),{'FaxInteractionId':Number(_0x4a57a2[_0x6ef735('0x2a')][_0x6ef735('0xda')][_0x595f1a]),'UserId':Number(_0x4a57a2[_0x6ef735('0xdd')]['id'])});}else socket[_0x6ef735('0x135')](_0x6ef735('0xbf'),{'FaxInteractionId':Number(_0x4a57a2[_0x6ef735('0x2a')][_0x6ef735('0xda')]),'UserId':Number(_0x4a57a2[_0x6ef735('0xdd')]['id'])});});})[_0x4e678e('0x52')](respondWithStatusCode(_0x1d968d,null))[_0x4e678e('0x90')](handleError(_0x1d968d,null));},exports['addSmsInteractions']=function(_0x45eee6,_0x2ad566){const _0x9ef690=_0x1a4ed3;return db[_0x9ef690('0x159')]['findOne']({'where':{'id':_0x45eee6[_0x9ef690('0xdd')]['id']}})[_0x9ef690('0x52')](handleEntityNotFound(_0x2ad566,null))[_0x9ef690('0x52')](function(_0x1ae0ec){const _0x469ebd=_0x9ef690;if(_0x1ae0ec)return _0x1ae0ec['addSmsInteractions'](_0x45eee6[_0x469ebd('0xf1')][_0x469ebd('0xda')],{'through':_[_0x469ebd('0xb4')](_0x45eee6['body'],['ids','id'])})[_0x469ebd('0x52')](function(){const _0x41a11a=_0x469ebd;for(let _0xbb3c10=0x0;_0xbb3c10<_0x45eee6[_0x41a11a('0xf1')][_0x41a11a('0xda')][_0x41a11a('0x4e')];_0xbb3c10+=0x1){socket[_0x41a11a('0x135')](_0x41a11a('0xbb'),{'SmsInteractionId':Number(_0x45eee6[_0x41a11a('0xf1')]['ids'][_0xbb3c10]),'UserId':Number(_0x45eee6[_0x41a11a('0xdd')]['id'])});}return _0x45eee6[_0x41a11a('0xf1')][_0x41a11a('0xda')];});})[_0x9ef690('0x52')](respondWithResult(_0x2ad566,null))[_0x9ef690('0x90')](handleError(_0x2ad566,null));},exports[_0x1a4ed3('0x2e')]=function(_0x5e2b8e,_0x58fbfa){const _0x1519e7=_0x1a4ed3;return db[_0x1519e7('0x159')]['findOne']({'where':{'id':_0x5e2b8e[_0x1519e7('0xdd')]['id']}})[_0x1519e7('0x52')](handleEntityNotFound(_0x58fbfa,null))[_0x1519e7('0x52')](function(_0x3e6f1b){const _0x4777c1=_0x1519e7;if(_0x3e6f1b)return _0x3e6f1b['removeSmsInteractions'](_0x5e2b8e['query'][_0x4777c1('0xda')])[_0x4777c1('0x52')](function(){const _0xc86ed7=_0x4777c1;if(_['isArray'](_0x5e2b8e['query'][_0xc86ed7('0xda')]))for(let _0x9ed15a=0x0;_0x9ed15a<_0x5e2b8e[_0xc86ed7('0x2a')][_0xc86ed7('0xda')][_0xc86ed7('0x4e')];_0x9ed15a+=0x1){socket[_0xc86ed7('0x135')](_0xc86ed7('0x11b'),{'SmsInteractionId':Number(_0x5e2b8e[_0xc86ed7('0x2a')][_0xc86ed7('0xda')][_0x9ed15a]),'UserId':Number(_0x5e2b8e[_0xc86ed7('0xdd')]['id'])});}else socket[_0xc86ed7('0x135')](_0xc86ed7('0x11b'),{'SmsInteractionId':Number(_0x5e2b8e[_0xc86ed7('0x2a')]['ids']),'UserId':Number(_0x5e2b8e[_0xc86ed7('0xdd')]['id'])});});})[_0x1519e7('0x52')](respondWithStatusCode(_0x58fbfa,null))['catch'](handleError(_0x58fbfa,null));},exports[_0x1a4ed3('0x143')]=function(_0xa638ab,_0x12462f){const _0x10ad1f=_0x1a4ed3;return db[_0x10ad1f('0x159')]['findOne']({'where':{'id':_0xa638ab[_0x10ad1f('0xdd')]['id']}})[_0x10ad1f('0x52')](handleEntityNotFound(_0x12462f,null))[_0x10ad1f('0x52')](function(_0x301dd0){const _0x5cacec=_0x10ad1f;if(_0x301dd0)return _0x301dd0['addOpenchannelInteractions'](_0xa638ab[_0x5cacec('0xf1')]['ids'],{'through':_[_0x5cacec('0xb4')](_0xa638ab[_0x5cacec('0xf1')],[_0x5cacec('0xda'),'id'])})[_0x5cacec('0x52')](function(){const _0x280506=_0x5cacec;for(let _0x51e4d1=0x0;_0x51e4d1<_0xa638ab[_0x280506('0xf1')][_0x280506('0xda')][_0x280506('0x4e')];_0x51e4d1+=0x1){socket[_0x280506('0x135')](_0x280506('0xa0'),{'OpenchannelInteractionId':Number(_0xa638ab[_0x280506('0xf1')][_0x280506('0xda')][_0x51e4d1]),'UserId':Number(_0xa638ab[_0x280506('0xdd')]['id'])});}return _0xa638ab[_0x280506('0xf1')][_0x280506('0xda')];});})['then'](respondWithResult(_0x12462f,null))[_0x10ad1f('0x90')](handleError(_0x12462f,null));},exports[_0x1a4ed3('0xa7')]=function(_0x35a9cd,_0x7cf65a){const _0xad75c3=_0x1a4ed3;return db['User'][_0xad75c3('0xd6')]({'where':{'id':_0x35a9cd[_0xad75c3('0xdd')]['id']}})[_0xad75c3('0x52')](handleEntityNotFound(_0x7cf65a,null))[_0xad75c3('0x52')](function(_0x2a89bb){const _0x458276=_0xad75c3;if(_0x2a89bb)return _0x2a89bb['removeOpenchannelInteractions'](_0x35a9cd[_0x458276('0x2a')][_0x458276('0xda')])['then'](function(){const _0x250ff9=_0x458276;if(_[_0x250ff9('0xe0')](_0x35a9cd[_0x250ff9('0x2a')][_0x250ff9('0xda')]))for(let _0x2c161a=0x0;_0x2c161a<_0x35a9cd[_0x250ff9('0x2a')][_0x250ff9('0xda')][_0x250ff9('0x4e')];_0x2c161a+=0x1){socket['emit'](_0x250ff9('0x105'),{'OpenchannelInteractionId':Number(_0x35a9cd[_0x250ff9('0x2a')][_0x250ff9('0xda')][_0x2c161a]),'UserId':Number(_0x35a9cd[_0x250ff9('0xdd')]['id'])});}else socket['emit'](_0x250ff9('0x105'),{'OpenchannelInteractionId':Number(_0x35a9cd[_0x250ff9('0x2a')][_0x250ff9('0xda')]),'UserId':Number(_0x35a9cd[_0x250ff9('0xdd')]['id'])});});})[_0xad75c3('0x52')](respondWithStatusCode(_0x7cf65a,null))[_0xad75c3('0x90')](handleError(_0x7cf65a,null));},exports[_0x1a4ed3('0xfd')]=function(_0x42a428,_0x75bf0){const _0x2bc55d=_0x1a4ed3;return db[_0x2bc55d('0x159')][_0x2bc55d('0xd6')]({'where':{'id':_0x42a428[_0x2bc55d('0xdd')]['id']}})[_0x2bc55d('0x52')](handleEntityNotFound(_0x75bf0,null))[_0x2bc55d('0x52')](function(_0x174d7e){const _0x230378=_0x2bc55d;if(_0x174d7e)return _0x174d7e[_0x230378('0xfd')](_0x42a428['body'][_0x230378('0xda')],{'through':_[_0x230378('0xb4')](_0x42a428[_0x230378('0xf1')],['ids','id'])})[_0x230378('0x52')](function(){const _0x55103d=_0x230378;for(let _0x501f57=0x0;_0x501f57<_0x42a428['body']['ids'][_0x55103d('0x4e')];_0x501f57+=0x1){socket[_0x55103d('0x135')](_0x55103d('0x12e'),{'WhatsappInteractionId':Number(_0x42a428['body'][_0x55103d('0xda')][_0x501f57]),'UserId':Number(_0x42a428[_0x55103d('0xdd')]['id'])});}return _0x42a428[_0x55103d('0xf1')][_0x55103d('0xda')];});})[_0x2bc55d('0x52')](respondWithResult(_0x75bf0,null))[_0x2bc55d('0x90')](handleError(_0x75bf0,null));},exports[_0x1a4ed3('0xd4')]=function(_0x5d96e0,_0x3f86f9){const _0x574c46=_0x1a4ed3;return db['User']['findOne']({'where':{'id':_0x5d96e0[_0x574c46('0xdd')]['id']}})[_0x574c46('0x52')](handleEntityNotFound(_0x3f86f9,null))[_0x574c46('0x52')](function(_0x50f30d){const _0xf2739a=_0x574c46;if(_0x50f30d)return _0x50f30d[_0xf2739a('0xd4')](_0x5d96e0[_0xf2739a('0x2a')][_0xf2739a('0xda')]);})[_0x574c46('0x52')](respondWithStatusCode(_0x3f86f9,null))['catch'](handleError(_0x3f86f9,null));},exports[_0x1a4ed3('0x5a')]=function(_0x517b70,_0x41848f){const _0x292be5=_0x1a4ed3;let _0x43ac5d={};const _0x1d1dcc={};let _0x55ade8,_0x298bd2;return db['User'][_0x292be5('0xd6')]({'where':{'id':_0x517b70[_0x292be5('0xdd')]['id']}})['then'](handleEntityNotFound(_0x41848f,null))['then'](function(_0x5645d2){const _0x434cf9=_0x292be5;if(_0x5645d2)return _0x55ade8=_0x5645d2,_0x1d1dcc[_0x434cf9('0x15a')]=_[_0x434cf9('0x33')](db[_0x434cf9('0xef')][_0x434cf9('0xeb')]),_0x1d1dcc[_0x434cf9('0x2a')]=_[_0x434cf9('0x33')](_0x517b70['query']),_0x1d1dcc[_0x434cf9('0x13b')]=_[_0x434cf9('0x111')](_0x1d1dcc[_0x434cf9('0x15a')],_0x1d1dcc[_0x434cf9('0x2a')]),_0x43ac5d[_0x434cf9('0x145')]=_[_0x434cf9('0x111')](_0x1d1dcc[_0x434cf9('0x15a')],qs[_0x434cf9('0x41')](_0x517b70['query'][_0x434cf9('0x41')])),_0x43ac5d[_0x434cf9('0x145')]=_0x43ac5d[_0x434cf9('0x145')][_0x434cf9('0x4e')]?_0x43ac5d[_0x434cf9('0x145')]:_0x1d1dcc['model'],_0x43ac5d[_0x434cf9('0x13d')]=qs['sort'](_0x517b70[_0x434cf9('0x2a')][_0x434cf9('0x5')]),_0x43ac5d[_0x434cf9('0x10d')]=qs[_0x434cf9('0x13b')](_[_0x434cf9('0x13f')](_0x517b70[_0x434cf9('0x2a')],_0x1d1dcc[_0x434cf9('0x13b')])),_0x517b70[_0x434cf9('0x2a')][_0x434cf9('0x95')]&&(_0x43ac5d[_0x434cf9('0x10d')]=_[_0x434cf9('0xdb')](_0x43ac5d[_0x434cf9('0x10d')],{[Op['or']]:_['map'](_0x43ac5d[_0x434cf9('0x145')],function(_0x1c374e){const _0x235b21=_0x434cf9,_0x44c885={};return _0x44c885[_0x1c374e]={[Op['like']]:'%'+_0x517b70[_0x235b21('0x2a')]['filter']+'%'},_0x44c885;})})),_0x43ac5d=_[_0x434cf9('0xdb')]({},_0x43ac5d,_0x517b70[_0x434cf9('0xa1')]),_0x55ade8[_0x434cf9('0x5a')](_0x43ac5d);})[_0x292be5('0x52')](function(_0x9c8bb8){const _0xf17be2=_0x292be5;if(_0x9c8bb8)return _0x298bd2=_0x9c8bb8['length'],typeof _0x517b70[_0xf17be2('0x2a')]['nolimit']==='undefined'&&(_0x43ac5d[_0xf17be2('0x3e')]=qs[_0xf17be2('0x3e')](_0x517b70['query']['limit']),_0x43ac5d['offset']=qs[_0xf17be2('0x9a')](_0x517b70[_0xf17be2('0x2a')][_0xf17be2('0x9a')])),_0x55ade8[_0xf17be2('0x5a')](_0x43ac5d);})['then'](function(_0x1d28e1){if(_0x1d28e1)return _0x1d28e1?{'count':_0x298bd2,'rows':_0x1d28e1}:null;})[_0x292be5('0x52')](respondWithResult(_0x41848f,null))[_0x292be5('0x90')](handleError(_0x41848f,null));},exports['getFaxAccounts']=function(_0x5bae02,_0x3bdd42){const _0x454e3a=_0x1a4ed3;let _0x4f3db0={};const _0x45a790={};let _0x1d501f,_0x3b6f93;return db['User']['findOne']({'where':{'id':_0x5bae02['params']['id']}})[_0x454e3a('0x52')](handleEntityNotFound(_0x3bdd42,null))[_0x454e3a('0x52')](function(_0x2e0c38){const _0x1db0f9=_0x454e3a;if(_0x2e0c38)return _0x1d501f=_0x2e0c38,_0x45a790['model']=_[_0x1db0f9('0x33')](db[_0x1db0f9('0x63')][_0x1db0f9('0xeb')]),_0x45a790['query']=_[_0x1db0f9('0x33')](_0x5bae02['query']),_0x45a790[_0x1db0f9('0x13b')]=_[_0x1db0f9('0x111')](_0x45a790[_0x1db0f9('0x15a')],_0x45a790[_0x1db0f9('0x2a')]),_0x4f3db0[_0x1db0f9('0x145')]=_['intersection'](_0x45a790['model'],qs[_0x1db0f9('0x41')](_0x5bae02['query'][_0x1db0f9('0x41')])),_0x4f3db0[_0x1db0f9('0x145')]=_0x4f3db0[_0x1db0f9('0x145')][_0x1db0f9('0x4e')]?_0x4f3db0[_0x1db0f9('0x145')]:_0x45a790['model'],_0x4f3db0[_0x1db0f9('0x13d')]=qs[_0x1db0f9('0x5')](_0x5bae02[_0x1db0f9('0x2a')][_0x1db0f9('0x5')]),_0x4f3db0[_0x1db0f9('0x10d')]=qs[_0x1db0f9('0x13b')](_[_0x1db0f9('0x13f')](_0x5bae02[_0x1db0f9('0x2a')],_0x45a790[_0x1db0f9('0x13b')])),_0x5bae02[_0x1db0f9('0x2a')][_0x1db0f9('0x95')]&&(_0x4f3db0[_0x1db0f9('0x10d')]=_['merge'](_0x4f3db0[_0x1db0f9('0x10d')],{[Op['or']]:_[_0x1db0f9('0x30')](_0x4f3db0[_0x1db0f9('0x145')],function(_0x10cdc0){const _0x194fad=_0x1db0f9,_0x142f88={};return _0x142f88[_0x10cdc0]={[Op[_0x194fad('0xf7')]]:'%'+_0x5bae02[_0x194fad('0x2a')]['filter']+'%'},_0x142f88;})})),_0x4f3db0=_['merge']({},_0x4f3db0,_0x5bae02['options']),_0x1d501f[_0x1db0f9('0xaa')](_0x4f3db0);})[_0x454e3a('0x52')](function(_0x1de29d){const _0x4ea1d2=_0x454e3a;if(_0x1de29d)return _0x3b6f93=_0x1de29d['length'],typeof _0x5bae02[_0x4ea1d2('0x2a')][_0x4ea1d2('0x12c')]===_0x4ea1d2('0xa4')&&(_0x4f3db0['limit']=qs[_0x4ea1d2('0x3e')](_0x5bae02[_0x4ea1d2('0x2a')][_0x4ea1d2('0x3e')]),_0x4f3db0[_0x4ea1d2('0x9a')]=qs[_0x4ea1d2('0x9a')](_0x5bae02[_0x4ea1d2('0x2a')][_0x4ea1d2('0x9a')])),_0x1d501f[_0x4ea1d2('0xaa')](_0x4f3db0);})['then'](function(_0x1f0d03){if(_0x1f0d03)return _0x1f0d03?{'count':_0x3b6f93,'rows':_0x1f0d03}:null;})[_0x454e3a('0x52')](respondWithResult(_0x3bdd42,null))[_0x454e3a('0x90')](handleError(_0x3bdd42,null));},exports[_0x1a4ed3('0xf3')]=function(_0x2eb265,_0x35084a){const _0x45aa16=_0x1a4ed3;return db[_0x45aa16('0x159')][_0x45aa16('0xd6')]({'where':{'id':_0x2eb265['params']['id']}})[_0x45aa16('0x52')](handleEntityNotFound(_0x35084a,null))[_0x45aa16('0x52')](function(_0xc61240){const _0x50e3b8=_0x45aa16;if(_0xc61240)return _0xc61240[_0x50e3b8('0xf3')](_0x2eb265['body']['ids'],{'through':_[_0x50e3b8('0xb4')](_0x2eb265[_0x50e3b8('0xf1')],[_0x50e3b8('0xda'),'id'])});})['then'](respondWithResult(_0x35084a,null))[_0x45aa16('0x90')](handleError(_0x35084a,null));},exports['removeFaxAccounts']=function(_0x568b58,_0xac8538){const _0x1b623d=_0x1a4ed3;return db[_0x1b623d('0x159')]['findOne']({'where':{'id':_0x568b58['params']['id']}})[_0x1b623d('0x52')](handleEntityNotFound(_0xac8538,null))['then'](function(_0x26141a){const _0x52c756=_0x1b623d;if(_0x26141a)return _0x26141a[_0x52c756('0x132')](_0x568b58[_0x52c756('0x2a')][_0x52c756('0xda')]);})[_0x1b623d('0x52')](respondWithStatusCode(_0xac8538,null))[_0x1b623d('0x90')](handleError(_0xac8538,null));},exports[_0x1a4ed3('0x44')]=function(_0x48ce5b,_0x10fafe){const _0xf48202=_0x1a4ed3;let _0x1acb84={};const _0x2687e5={};let _0x1375b3,_0x1955df;return db[_0xf48202('0x159')][_0xf48202('0xd6')]({'where':{'id':_0x48ce5b[_0xf48202('0xdd')]['id']}})[_0xf48202('0x52')](handleEntityNotFound(_0x10fafe,null))['then'](function(_0x51e87d){const _0x2ee162=_0xf48202;if(_0x51e87d)return _0x1375b3=_0x51e87d,_0x2687e5[_0x2ee162('0x15a')]=_[_0x2ee162('0x33')](db[_0x2ee162('0x9e')][_0x2ee162('0xeb')]),_0x2687e5[_0x2ee162('0x2a')]=_['keys'](_0x48ce5b[_0x2ee162('0x2a')]),_0x2687e5[_0x2ee162('0x13b')]=_['intersection'](_0x2687e5[_0x2ee162('0x15a')],_0x2687e5[_0x2ee162('0x2a')]),_0x1acb84[_0x2ee162('0x145')]=_[_0x2ee162('0x111')](_0x2687e5[_0x2ee162('0x15a')],qs[_0x2ee162('0x41')](_0x48ce5b[_0x2ee162('0x2a')][_0x2ee162('0x41')])),_0x1acb84[_0x2ee162('0x145')]=_0x1acb84['attributes'][_0x2ee162('0x4e')]?_0x1acb84[_0x2ee162('0x145')]:_0x2687e5[_0x2ee162('0x15a')],_0x1acb84[_0x2ee162('0x13d')]=qs[_0x2ee162('0x5')](_0x48ce5b[_0x2ee162('0x2a')]['sort']),_0x1acb84[_0x2ee162('0x10d')]=qs[_0x2ee162('0x13b')](_[_0x2ee162('0x13f')](_0x48ce5b[_0x2ee162('0x2a')],_0x2687e5[_0x2ee162('0x13b')])),_0x48ce5b[_0x2ee162('0x2a')][_0x2ee162('0x95')]&&(_0x1acb84[_0x2ee162('0x10d')]=_['merge'](_0x1acb84[_0x2ee162('0x10d')],{[Op['or']]:_[_0x2ee162('0x30')](_0x1acb84[_0x2ee162('0x145')],function(_0x254b31){const _0x382947=_0x2ee162,_0x462f69={};return _0x462f69[_0x254b31]={[Op[_0x382947('0xf7')]]:'%'+_0x48ce5b[_0x382947('0x2a')][_0x382947('0x95')]+'%'},_0x462f69;})})),_0x1acb84=_[_0x2ee162('0xdb')]({},_0x1acb84,_0x48ce5b[_0x2ee162('0xa1')]),_0x1375b3[_0x2ee162('0x44')](_0x1acb84);})['then'](function(_0x4898c9){const _0xf0fc3f=_0xf48202;if(_0x4898c9)return _0x1955df=_0x4898c9[_0xf0fc3f('0x4e')],typeof _0x48ce5b[_0xf0fc3f('0x2a')][_0xf0fc3f('0x12c')]==='undefined'&&(_0x1acb84[_0xf0fc3f('0x3e')]=qs['limit'](_0x48ce5b[_0xf0fc3f('0x2a')][_0xf0fc3f('0x3e')]),_0x1acb84[_0xf0fc3f('0x9a')]=qs[_0xf0fc3f('0x9a')](_0x48ce5b[_0xf0fc3f('0x2a')][_0xf0fc3f('0x9a')])),_0x1375b3[_0xf0fc3f('0x44')](_0x1acb84);})[_0xf48202('0x52')](function(_0x3fea07){if(_0x3fea07)return _0x3fea07?{'count':_0x1955df,'rows':_0x3fea07}:null;})[_0xf48202('0x52')](respondWithResult(_0x10fafe,null))['catch'](handleError(_0x10fafe,null));},exports['addMailAccounts']=function(_0x492368,_0x42aed1){const _0x3e70cf=_0x1a4ed3;return db['User']['findOne']({'where':{'id':_0x492368[_0x3e70cf('0xdd')]['id']}})[_0x3e70cf('0x52')](handleEntityNotFound(_0x42aed1,null))['then'](function(_0x4e5d99){const _0x4d5dc8=_0x3e70cf;if(_0x4e5d99)return _0x4e5d99[_0x4d5dc8('0x47')](_0x492368[_0x4d5dc8('0xf1')][_0x4d5dc8('0xda')],{'through':_[_0x4d5dc8('0xb4')](_0x492368['body'],[_0x4d5dc8('0xda'),'id'])});})[_0x3e70cf('0x52')](respondWithResult(_0x42aed1,null))['catch'](handleError(_0x42aed1,null));},exports[_0x1a4ed3('0x120')]=function(_0x550370,_0x2a25d7){const _0x293457=_0x1a4ed3;return db[_0x293457('0x159')][_0x293457('0xd6')]({'where':{'id':_0x550370['params']['id']}})[_0x293457('0x52')](handleEntityNotFound(_0x2a25d7,null))['then'](function(_0x4c9b39){const _0x4a39a2=_0x293457;if(_0x4c9b39)return _0x4c9b39['removeMailAccounts'](_0x550370[_0x4a39a2('0x2a')]['ids']);})[_0x293457('0x52')](respondWithStatusCode(_0x2a25d7,null))[_0x293457('0x90')](handleError(_0x2a25d7,null));},exports[_0x1a4ed3('0x133')]=function(_0x248204,_0x540dac){const _0x1c7cac=_0x1a4ed3;let _0x26f697={};const _0x17f2e4={};let _0x4cfb8f,_0x2a603d;return db[_0x1c7cac('0x159')]['findOne']({'where':{'id':_0x248204[_0x1c7cac('0xdd')]['id']}})[_0x1c7cac('0x52')](handleEntityNotFound(_0x540dac,null))[_0x1c7cac('0x52')](function(_0x2c1b4c){const _0x3a9b07=_0x1c7cac;if(_0x2c1b4c)return _0x4cfb8f=_0x2c1b4c,_0x17f2e4[_0x3a9b07('0x15a')]=_[_0x3a9b07('0x33')](db['OpenchannelAccount']['rawAttributes']),_0x17f2e4[_0x3a9b07('0x2a')]=_[_0x3a9b07('0x33')](_0x248204[_0x3a9b07('0x2a')]),_0x17f2e4['filters']=_[_0x3a9b07('0x111')](_0x17f2e4[_0x3a9b07('0x15a')],_0x17f2e4[_0x3a9b07('0x2a')]),_0x26f697[_0x3a9b07('0x145')]=_['intersection'](_0x17f2e4[_0x3a9b07('0x15a')],qs[_0x3a9b07('0x41')](_0x248204[_0x3a9b07('0x2a')][_0x3a9b07('0x41')])),_0x26f697[_0x3a9b07('0x145')]=_0x26f697[_0x3a9b07('0x145')][_0x3a9b07('0x4e')]?_0x26f697[_0x3a9b07('0x145')]:_0x17f2e4[_0x3a9b07('0x15a')],_0x26f697[_0x3a9b07('0x13d')]=qs[_0x3a9b07('0x5')](_0x248204[_0x3a9b07('0x2a')][_0x3a9b07('0x5')]),_0x26f697['where']=qs[_0x3a9b07('0x13b')](_['pick'](_0x248204[_0x3a9b07('0x2a')],_0x17f2e4['filters'])),_0x248204[_0x3a9b07('0x2a')][_0x3a9b07('0x95')]&&(_0x26f697[_0x3a9b07('0x10d')]=_[_0x3a9b07('0xdb')](_0x26f697[_0x3a9b07('0x10d')],{[Op['or']]:_['map'](_0x26f697['attributes'],function(_0x5aef95){const _0x1e8e99=_0x3a9b07,_0x19fdaf={};return _0x19fdaf[_0x5aef95]={[Op[_0x1e8e99('0xf7')]]:'%'+_0x248204[_0x1e8e99('0x2a')]['filter']+'%'},_0x19fdaf;})})),_0x26f697=_[_0x3a9b07('0xdb')]({},_0x26f697,_0x248204['options']),_0x4cfb8f['getOpenchannelAccounts'](_0x26f697);})[_0x1c7cac('0x52')](function(_0x4d31fa){const _0x1c0087=_0x1c7cac;if(_0x4d31fa)return _0x2a603d=_0x4d31fa['length'],typeof _0x248204[_0x1c0087('0x2a')][_0x1c0087('0x12c')]==='undefined'&&(_0x26f697[_0x1c0087('0x3e')]=qs[_0x1c0087('0x3e')](_0x248204['query'][_0x1c0087('0x3e')]),_0x26f697[_0x1c0087('0x9a')]=qs[_0x1c0087('0x9a')](_0x248204[_0x1c0087('0x2a')][_0x1c0087('0x9a')])),_0x4cfb8f[_0x1c0087('0x133')](_0x26f697);})[_0x1c7cac('0x52')](function(_0x4836ad){if(_0x4836ad)return _0x4836ad?{'count':_0x2a603d,'rows':_0x4836ad}:null;})[_0x1c7cac('0x52')](respondWithResult(_0x540dac,null))['catch'](handleError(_0x540dac,null));},exports['addOpenchannelAccounts']=function(_0x310ec8,_0x1f782a){const _0x4f5e7c=_0x1a4ed3;return db[_0x4f5e7c('0x159')][_0x4f5e7c('0xd6')]({'where':{'id':_0x310ec8['params']['id']}})[_0x4f5e7c('0x52')](function(_0x11970e){const _0x308de3=_0x4f5e7c;if(_0x11970e)return _0x11970e[_0x308de3('0x4')](_0x310ec8[_0x308de3('0xf1')]['ids'],{'through':_[_0x308de3('0xb4')](_0x310ec8['body'],[_0x308de3('0xda'),'id'])});})[_0x4f5e7c('0x52')](respondWithResult(_0x1f782a,null))['catch'](handleError(_0x1f782a,null));},exports[_0x1a4ed3('0xa9')]=function(_0x5701bd,_0x245477){const _0x1b7303=_0x1a4ed3;return db[_0x1b7303('0x159')]['findOne']({'where':{'id':_0x5701bd[_0x1b7303('0xdd')]['id']}})[_0x1b7303('0x52')](handleEntityNotFound(_0x245477,null))[_0x1b7303('0x52')](function(_0x1eff95){const _0x26b02d=_0x1b7303;if(_0x1eff95)return _0x1eff95[_0x26b02d('0xa9')](_0x5701bd[_0x26b02d('0x2a')][_0x26b02d('0xda')]);})[_0x1b7303('0x52')](respondWithStatusCode(_0x245477,null))['catch'](handleError(_0x245477,null));},exports[_0x1a4ed3('0xd')]=function(_0x31a5bd,_0x1128ff){const _0x5eeb03=_0x1a4ed3;let _0x4a225c={};const _0x327566={};let _0x5a75f5,_0x19e15a;return db[_0x5eeb03('0x159')]['findOne']({'where':{'id':_0x31a5bd[_0x5eeb03('0xdd')]['id']}})[_0x5eeb03('0x52')](handleEntityNotFound(_0x1128ff,null))[_0x5eeb03('0x52')](function(_0x5146d0){const _0x5339a7=_0x5eeb03;if(_0x5146d0)return _0x5a75f5=_0x5146d0,_0x327566['model']=_['keys'](db[_0x5339a7('0x5f')][_0x5339a7('0xeb')]),_0x327566[_0x5339a7('0x2a')]=_[_0x5339a7('0x33')](_0x31a5bd[_0x5339a7('0x2a')]),_0x327566['filters']=_['intersection'](_0x327566['model'],_0x327566[_0x5339a7('0x2a')]),_0x4a225c[_0x5339a7('0x145')]=_[_0x5339a7('0x111')](_0x327566[_0x5339a7('0x15a')],qs[_0x5339a7('0x41')](_0x31a5bd[_0x5339a7('0x2a')]['fields'])),_0x4a225c['attributes']=_0x4a225c[_0x5339a7('0x145')][_0x5339a7('0x4e')]?_0x4a225c['attributes']:_0x327566[_0x5339a7('0x15a')],_0x4a225c[_0x5339a7('0x13d')]=qs[_0x5339a7('0x5')](_0x31a5bd[_0x5339a7('0x2a')][_0x5339a7('0x5')]),_0x4a225c[_0x5339a7('0x10d')]=qs['filters'](_[_0x5339a7('0x13f')](_0x31a5bd[_0x5339a7('0x2a')],_0x327566[_0x5339a7('0x13b')])),_0x31a5bd[_0x5339a7('0x2a')][_0x5339a7('0x95')]&&(_0x4a225c[_0x5339a7('0x10d')]=_[_0x5339a7('0xdb')](_0x4a225c[_0x5339a7('0x10d')],{[Op['or']]:_[_0x5339a7('0x30')](_0x4a225c[_0x5339a7('0x145')],function(_0x4b5975){const _0x339343=_0x5339a7,_0x2c4768={};return _0x2c4768[_0x4b5975]={[Op['like']]:'%'+_0x31a5bd['query'][_0x339343('0x95')]+'%'},_0x2c4768;})})),_0x4a225c=_[_0x5339a7('0xdb')]({},_0x4a225c,_0x31a5bd['options']),_0x5a75f5[_0x5339a7('0xd')](_0x4a225c);})['then'](function(_0x5f22c4){const _0x316b2b=_0x5eeb03;if(_0x5f22c4)return _0x19e15a=_0x5f22c4['length'],typeof _0x31a5bd[_0x316b2b('0x2a')][_0x316b2b('0x12c')]==='undefined'&&(_0x4a225c[_0x316b2b('0x3e')]=qs[_0x316b2b('0x3e')](_0x31a5bd[_0x316b2b('0x2a')][_0x316b2b('0x3e')]),_0x4a225c[_0x316b2b('0x9a')]=qs['offset'](_0x31a5bd[_0x316b2b('0x2a')][_0x316b2b('0x9a')])),_0x5a75f5[_0x316b2b('0xd')](_0x4a225c);})[_0x5eeb03('0x52')](function(_0x45a904){if(_0x45a904)return _0x45a904?{'count':_0x19e15a,'rows':_0x45a904}:null;})[_0x5eeb03('0x52')](respondWithResult(_0x1128ff,null))['catch'](handleError(_0x1128ff,null));},exports[_0x1a4ed3('0x147')]=function(_0xb09a2a,_0x14abb1){const _0x138373=_0x1a4ed3;return db[_0x138373('0x159')][_0x138373('0xd6')]({'where':{'id':_0xb09a2a[_0x138373('0xdd')]['id']}})[_0x138373('0x52')](handleEntityNotFound(_0x14abb1,null))[_0x138373('0x52')](function(_0x57694d){const _0x733348=_0x138373;if(_0x57694d)return _0x57694d[_0x733348('0x147')](_0xb09a2a[_0x733348('0xf1')][_0x733348('0xda')],{'through':_[_0x733348('0xb4')](_0xb09a2a[_0x733348('0xf1')],[_0x733348('0xda'),'id'])});})[_0x138373('0x52')](respondWithResult(_0x14abb1,null))[_0x138373('0x90')](handleError(_0x14abb1,null));},exports['removeSmsAccounts']=function(_0x1981a2,_0x159b68){const _0x2609aa=_0x1a4ed3;return db[_0x2609aa('0x159')][_0x2609aa('0xd6')]({'where':{'id':_0x1981a2[_0x2609aa('0xdd')]['id']}})['then'](handleEntityNotFound(_0x159b68,null))[_0x2609aa('0x52')](function(_0x4f537c){const _0x20351f=_0x2609aa;if(_0x4f537c)return _0x4f537c[_0x20351f('0xff')](_0x1981a2[_0x20351f('0x2a')][_0x20351f('0xda')]);})[_0x2609aa('0x52')](respondWithStatusCode(_0x159b68,null))['catch'](handleError(_0x159b68,null));},exports[_0x1a4ed3('0x10b')]=function(_0x2dfe18,_0x21d779){const _0xf9c4a3=_0x1a4ed3;let _0x5656af={};const _0x4e40c2={};let _0x1a8b47,_0x4face8;return db[_0xf9c4a3('0x159')]['findOne']({'where':{'id':_0x2dfe18[_0xf9c4a3('0xdd')]['id']}})[_0xf9c4a3('0x52')](handleEntityNotFound(_0x21d779,null))[_0xf9c4a3('0x52')](function(_0x335d67){const _0x177bda=_0xf9c4a3;if(_0x335d67)return _0x1a8b47=_0x335d67,_0x4e40c2[_0x177bda('0x15a')]=_[_0x177bda('0x33')](db[_0x177bda('0x2f')][_0x177bda('0xeb')]),_0x4e40c2[_0x177bda('0x2a')]=_[_0x177bda('0x33')](_0x2dfe18['query']),_0x4e40c2[_0x177bda('0x13b')]=_[_0x177bda('0x111')](_0x4e40c2[_0x177bda('0x15a')],_0x4e40c2['query']),_0x5656af[_0x177bda('0x145')]=_['intersection'](_0x4e40c2[_0x177bda('0x15a')],qs['fields'](_0x2dfe18['query'][_0x177bda('0x41')])),_0x5656af[_0x177bda('0x145')]=_0x5656af['attributes'][_0x177bda('0x4e')]?_0x5656af[_0x177bda('0x145')]:_0x4e40c2[_0x177bda('0x15a')],_0x5656af[_0x177bda('0x13d')]=qs[_0x177bda('0x5')](_0x2dfe18[_0x177bda('0x2a')][_0x177bda('0x5')]),_0x5656af[_0x177bda('0x10d')]=qs[_0x177bda('0x13b')](_[_0x177bda('0x13f')](_0x2dfe18['query'],_0x4e40c2['filters'])),_0x2dfe18[_0x177bda('0x2a')][_0x177bda('0x95')]&&(_0x5656af[_0x177bda('0x10d')]=_[_0x177bda('0xdb')](_0x5656af[_0x177bda('0x10d')],{[Op['or']]:_[_0x177bda('0x30')](_0x5656af[_0x177bda('0x145')],function(_0x3e7643){const _0x427648=_0x177bda,_0x54dca1={};return _0x54dca1[_0x3e7643]={[Op[_0x427648('0xf7')]]:'%'+_0x2dfe18[_0x427648('0x2a')][_0x427648('0x95')]+'%'},_0x54dca1;})})),_0x5656af=_['merge']({},_0x5656af,_0x2dfe18[_0x177bda('0xa1')]),_0x1a8b47['getChatWebsites'](_0x5656af);})[_0xf9c4a3('0x52')](function(_0x45841b){const _0x48a289=_0xf9c4a3;if(_0x45841b)return _0x4face8=_0x45841b['length'],typeof _0x2dfe18[_0x48a289('0x2a')][_0x48a289('0x12c')]===_0x48a289('0xa4')&&(_0x5656af[_0x48a289('0x3e')]=qs[_0x48a289('0x3e')](_0x2dfe18[_0x48a289('0x2a')][_0x48a289('0x3e')]),_0x5656af[_0x48a289('0x9a')]=qs[_0x48a289('0x9a')](_0x2dfe18['query']['offset'])),_0x1a8b47['getChatWebsites'](_0x5656af);})['then'](function(_0x244aaf){if(_0x244aaf)return _0x244aaf?{'count':_0x4face8,'rows':_0x244aaf}:null;})[_0xf9c4a3('0x52')](respondWithResult(_0x21d779,null))[_0xf9c4a3('0x90')](handleError(_0x21d779,null));},exports[_0x1a4ed3('0xfc')]=function(_0x2cb626,_0x196667){const _0x5dd33f=_0x1a4ed3;return db['User'][_0x5dd33f('0xd6')]({'where':{'id':_0x2cb626[_0x5dd33f('0xdd')]['id']}})[_0x5dd33f('0x52')](handleEntityNotFound(_0x196667,null))[_0x5dd33f('0x52')](function(_0x5d37d6){const _0x36ffd5=_0x5dd33f;if(_0x5d37d6)return _0x5d37d6[_0x36ffd5('0xfc')](_0x2cb626[_0x36ffd5('0xf1')][_0x36ffd5('0xda')],{'through':_[_0x36ffd5('0xb4')](_0x2cb626[_0x36ffd5('0xf1')],[_0x36ffd5('0xda'),'id'])});})[_0x5dd33f('0x52')](respondWithResult(_0x196667,null))[_0x5dd33f('0x90')](handleError(_0x196667,null));},exports['removeChatWebsites']=function(_0x29a49b,_0x4891e4){const _0x5062eb=_0x1a4ed3;return db[_0x5062eb('0x159')][_0x5062eb('0xd6')]({'where':{'id':_0x29a49b['params']['id']}})[_0x5062eb('0x52')](handleEntityNotFound(_0x4891e4,null))[_0x5062eb('0x52')](function(_0x396ee6){const _0x267737=_0x5062eb;if(_0x396ee6)return _0x396ee6[_0x267737('0x8c')](_0x29a49b['query'][_0x267737('0xda')]);})[_0x5062eb('0x52')](respondWithStatusCode(_0x4891e4,null))['catch'](handleError(_0x4891e4,null));},exports[_0x1a4ed3('0xd5')]=function(_0x1c6427,_0x51da56){const _0x3d607e=_0x1a4ed3;let _0x1e324b={};const _0x265d4a={};let _0x112326,_0x5c2294;return db['User'][_0x3d607e('0xd6')]({'where':{'id':_0x1c6427[_0x3d607e('0xdd')]['id']}})[_0x3d607e('0x52')](handleEntityNotFound(_0x51da56,null))[_0x3d607e('0x52')](function(_0x375149){const _0x1b596c=_0x3d607e;if(_0x375149)return _0x112326=_0x375149,_0x265d4a[_0x1b596c('0x15a')]=_[_0x1b596c('0x33')](db[_0x1b596c('0x3a')][_0x1b596c('0xeb')]),_0x265d4a[_0x1b596c('0x2a')]=_[_0x1b596c('0x33')](_0x1c6427[_0x1b596c('0x2a')]),_0x265d4a['filters']=_[_0x1b596c('0x111')](_0x265d4a[_0x1b596c('0x15a')],_0x265d4a[_0x1b596c('0x2a')]),_0x1e324b[_0x1b596c('0x145')]=_['intersection'](_0x265d4a[_0x1b596c('0x15a')],qs['fields'](_0x1c6427[_0x1b596c('0x2a')][_0x1b596c('0x41')])),_0x1e324b[_0x1b596c('0x145')]=_0x1e324b[_0x1b596c('0x145')][_0x1b596c('0x4e')]?_0x1e324b[_0x1b596c('0x145')]:_0x265d4a[_0x1b596c('0x15a')],_0x1e324b[_0x1b596c('0x13d')]=qs[_0x1b596c('0x5')](_0x1c6427['query'][_0x1b596c('0x5')]),_0x1e324b['where']=qs[_0x1b596c('0x13b')](_[_0x1b596c('0x13f')](_0x1c6427['query'],_0x265d4a[_0x1b596c('0x13b')])),_0x1c6427[_0x1b596c('0x2a')][_0x1b596c('0x95')]&&(_0x1e324b['where']=_['merge'](_0x1e324b[_0x1b596c('0x10d')],{[Op['or']]:_[_0x1b596c('0x30')](_0x1e324b[_0x1b596c('0x145')],function(_0x315b20){const _0x25c17c=_0x1b596c,_0x34474a={};return _0x34474a[_0x315b20]={[Op[_0x25c17c('0xf7')]]:'%'+_0x1c6427[_0x25c17c('0x2a')][_0x25c17c('0x95')]+'%'},_0x34474a;})})),_0x1e324b=_[_0x1b596c('0xdb')]({},_0x1e324b,_0x1c6427['options']),_0x112326[_0x1b596c('0xd5')](_0x1e324b);})['then'](function(_0x583501){const _0x3c2e1c=_0x3d607e;if(_0x583501)return _0x5c2294=_0x583501[_0x3c2e1c('0x4e')],typeof _0x1c6427[_0x3c2e1c('0x2a')]['nolimit']===_0x3c2e1c('0xa4')&&(_0x1e324b['limit']=qs[_0x3c2e1c('0x3e')](_0x1c6427[_0x3c2e1c('0x2a')][_0x3c2e1c('0x3e')]),_0x1e324b[_0x3c2e1c('0x9a')]=qs['offset'](_0x1c6427[_0x3c2e1c('0x2a')]['offset'])),_0x112326[_0x3c2e1c('0xd5')](_0x1e324b);})[_0x3d607e('0x52')](function(_0x1f39db){if(_0x1f39db)return _0x1f39db?{'count':_0x5c2294,'rows':_0x1f39db}:null;})[_0x3d607e('0x52')](respondWithResult(_0x51da56,null))[_0x3d607e('0x90')](handleError(_0x51da56,null));},exports['addWhatsappAccounts']=function(_0x54b184,_0x33b114){const _0x159a18=_0x1a4ed3;return db['User'][_0x159a18('0xd6')]({'where':{'id':_0x54b184['params']['id']}})[_0x159a18('0x52')](handleEntityNotFound(_0x33b114,null))[_0x159a18('0x52')](function(_0x13f2d4){const _0x1274ad=_0x159a18;if(_0x13f2d4)return _0x13f2d4[_0x1274ad('0xa8')](_0x54b184[_0x1274ad('0xf1')][_0x1274ad('0xda')],{'through':_['omit'](_0x54b184[_0x1274ad('0xf1')],[_0x1274ad('0xda'),'id'])});})[_0x159a18('0x52')](respondWithResult(_0x33b114,null))[_0x159a18('0x90')](handleError(_0x33b114,null));},exports[_0x1a4ed3('0xf8')]=function(_0x35d6ef,_0x12b75b){const _0x56de23=_0x1a4ed3;return db[_0x56de23('0x159')][_0x56de23('0xd6')]({'where':{'id':_0x35d6ef[_0x56de23('0xdd')]['id']}})[_0x56de23('0x52')](handleEntityNotFound(_0x12b75b,null))['then'](function(_0x3f3843){const _0x8a61eb=_0x56de23;if(_0x3f3843)return _0x3f3843[_0x8a61eb('0xf8')](_0x35d6ef[_0x8a61eb('0x2a')][_0x8a61eb('0xda')]);})[_0x56de23('0x52')](respondWithStatusCode(_0x12b75b,null))[_0x56de23('0x90')](handleError(_0x12b75b,null));},exports['getSquareProjects']=function(_0x4c0255,_0xadccea){const _0x3d5a7d=_0x1a4ed3;let _0x50ab41={};const _0x21dcd8={};let _0x106808,_0x479067;return db['User']['findOne']({'where':{'id':_0x4c0255[_0x3d5a7d('0xdd')]['id']}})['then'](handleEntityNotFound(_0xadccea,null))[_0x3d5a7d('0x52')](function(_0x31b840){const _0x4be74e=_0x3d5a7d;if(_0x31b840)return _0x106808=_0x31b840,_0x21dcd8['model']=_[_0x4be74e('0x33')](db['SquareProject'][_0x4be74e('0xeb')]),_0x21dcd8[_0x4be74e('0x2a')]=_[_0x4be74e('0x33')](_0x4c0255[_0x4be74e('0x2a')]),_0x21dcd8[_0x4be74e('0x13b')]=_[_0x4be74e('0x111')](_0x21dcd8[_0x4be74e('0x15a')],_0x21dcd8['query']),_0x50ab41[_0x4be74e('0x145')]=_[_0x4be74e('0x111')](_0x21dcd8[_0x4be74e('0x15a')],qs[_0x4be74e('0x41')](_0x4c0255[_0x4be74e('0x2a')][_0x4be74e('0x41')])),_0x50ab41[_0x4be74e('0x145')]=_0x50ab41[_0x4be74e('0x145')][_0x4be74e('0x4e')]?_0x50ab41['attributes']:_0x21dcd8[_0x4be74e('0x15a')],_0x50ab41[_0x4be74e('0x13d')]=qs[_0x4be74e('0x5')](_0x4c0255['query'][_0x4be74e('0x5')]),_0x50ab41['where']=qs[_0x4be74e('0x13b')](_[_0x4be74e('0x13f')](_0x4c0255[_0x4be74e('0x2a')],_0x21dcd8[_0x4be74e('0x13b')])),_0x4c0255[_0x4be74e('0x2a')][_0x4be74e('0x95')]&&(_0x50ab41[_0x4be74e('0x10d')]=_[_0x4be74e('0xdb')](_0x50ab41[_0x4be74e('0x10d')],{[Op['or']]:_['map'](_0x50ab41[_0x4be74e('0x145')],function(_0x253029){const _0x4bb040=_0x4be74e,_0x3bdefb={};return _0x3bdefb[_0x253029]={[Op[_0x4bb040('0xf7')]]:'%'+_0x4c0255[_0x4bb040('0x2a')][_0x4bb040('0x95')]+'%'},_0x3bdefb;})})),_0x50ab41=_['merge']({},_0x50ab41,_0x4c0255['options']),_0x106808[_0x4be74e('0x15c')](_0x50ab41);})['then'](function(_0x1b9c4c){const _0x120b8d=_0x3d5a7d;if(_0x1b9c4c)return _0x479067=_0x1b9c4c[_0x120b8d('0x4e')],typeof _0x4c0255[_0x120b8d('0x2a')][_0x120b8d('0x12c')]===_0x120b8d('0xa4')&&(_0x50ab41[_0x120b8d('0x3e')]=qs[_0x120b8d('0x3e')](_0x4c0255[_0x120b8d('0x2a')][_0x120b8d('0x3e')]),_0x50ab41[_0x120b8d('0x9a')]=qs['offset'](_0x4c0255[_0x120b8d('0x2a')][_0x120b8d('0x9a')])),_0x106808[_0x120b8d('0x15c')](_0x50ab41);})[_0x3d5a7d('0x52')](function(_0x34e684){if(_0x34e684)return _0x34e684?{'count':_0x479067,'rows':_0x34e684}:null;})['then'](respondWithResult(_0xadccea,null))[_0x3d5a7d('0x90')](handleError(_0xadccea,null));},exports[_0x1a4ed3('0xb2')]=function(_0x5743be,_0x4cec95){const _0x358540=_0x1a4ed3;return db[_0x358540('0x159')][_0x358540('0xd6')]({'where':{'id':_0x5743be[_0x358540('0xdd')]['id']}})['then'](handleEntityNotFound(_0x4cec95,null))[_0x358540('0x52')](function(_0x58ebad){const _0x284751=_0x358540;if(_0x58ebad)return _0x58ebad[_0x284751('0xb2')](_0x5743be['body'][_0x284751('0xda')],{'through':_[_0x284751('0xb4')](_0x5743be[_0x284751('0xf1')],['ids','id'])});})[_0x358540('0x52')](respondWithResult(_0x4cec95,null))[_0x358540('0x90')](handleError(_0x4cec95,null));},exports[_0x1a4ed3('0xc2')]=function(_0x47fe23,_0x4820bd){const _0x2dd0dd=_0x1a4ed3;return db['User']['findOne']({'where':{'id':_0x47fe23[_0x2dd0dd('0xdd')]['id']}})[_0x2dd0dd('0x52')](handleEntityNotFound(_0x4820bd,null))['then'](function(_0x621607){const _0x5c19fe=_0x2dd0dd;if(_0x621607)return _0x621607[_0x5c19fe('0xc2')](_0x47fe23[_0x5c19fe('0x2a')][_0x5c19fe('0xda')]);})[_0x2dd0dd('0x52')](respondWithStatusCode(_0x4820bd,null))[_0x2dd0dd('0x90')](handleError(_0x4820bd,null));},exports[_0x1a4ed3('0xba')]=function(_0x4cf4c2,_0x10f909){const _0x90eedc=_0x1a4ed3;let _0x108a0b={};const _0x233dcc={},_0x412b88={'count':0x0,'rows':[]},_0x32f73a=db[_0x90eedc('0x6d')]['rawAttributes'];_0x233dcc[_0x90eedc('0x15a')]=_[_0x90eedc('0x33')](_0x32f73a),_0x233dcc[_0x90eedc('0x2a')]=_['keys'](_0x4cf4c2[_0x90eedc('0x2a')]),_0x233dcc[_0x90eedc('0x13b')]=_['intersection'](_0x233dcc[_0x90eedc('0x15a')],_0x233dcc[_0x90eedc('0x2a')]),_0x233dcc['filters']=_[_0x90eedc('0x117')](_0x233dcc[_0x90eedc('0x13b')],[_0x90eedc('0xa6'),'$or',_0x90eedc('0x4a'),'$gte',_0x90eedc('0x60'),_0x90eedc('0x5d'),'$ne',_0x90eedc('0xbc'),_0x90eedc('0xa3'),'$between',_0x90eedc('0x5b'),'$in','$notIn',_0x90eedc('0x34'),'$notLike','$iLike',_0x90eedc('0x6'),_0x90eedc('0x34'),_0x90eedc('0x5e'),'$contains','$contained','$any']),_0x108a0b[_0x90eedc('0x145')]=_[_0x90eedc('0x111')](_0x233dcc['model'],qs[_0x90eedc('0x41')](_0x4cf4c2[_0x90eedc('0x2a')]['fields'])),_0x108a0b[_0x90eedc('0x145')]=_0x108a0b[_0x90eedc('0x145')][_0x90eedc('0x4e')]?_0x108a0b[_0x90eedc('0x145')]:_0x233dcc[_0x90eedc('0x15a')];typeof _0x4cf4c2[_0x90eedc('0x2a')][_0x90eedc('0x12c')]==='undefined'&&(_0x108a0b[_0x90eedc('0x3e')]=qs[_0x90eedc('0x3e')](_0x4cf4c2[_0x90eedc('0x2a')][_0x90eedc('0x3e')]),_0x108a0b[_0x90eedc('0x9a')]=qs['offset'](_0x4cf4c2[_0x90eedc('0x2a')][_0x90eedc('0x9a')]));_0x108a0b['order']=qs[_0x90eedc('0x5')](_0x4cf4c2[_0x90eedc('0x2a')]['sort']),_0x108a0b[_0x90eedc('0x10d')]=qs['filters'](_[_0x90eedc('0x13f')](_0x4cf4c2[_0x90eedc('0x2a')],_0x233dcc[_0x90eedc('0x13b')]));_0x4cf4c2[_0x90eedc('0x2a')][_0x90eedc('0x95')]&&(_0x108a0b['where']=_['merge'](_0x108a0b[_0x90eedc('0x10d')],{[Op['or']]:_['map'](_0x108a0b[_0x90eedc('0x145')],function(_0x4e9cad){const _0x1bf8e8=_0x90eedc,_0x4a8102={};return _0x4a8102[_0x4e9cad]={[Op[_0x1bf8e8('0xf7')]]:'%'+_0x4cf4c2[_0x1bf8e8('0x2a')][_0x1bf8e8('0x95')]+'%'},_0x4a8102;})}));_0x108a0b[_0x90eedc('0x10d')]={[Op[_0x90eedc('0xb')]]:[_0x108a0b[_0x90eedc('0x10d')],{[Op['or']]:[{'UserId':_0x4cf4c2[_0x90eedc('0xdd')]['id']},{'OwnerId':_0x4cf4c2[_0x90eedc('0xdd')]['id']}]}]},_0x108a0b=_[_0x90eedc('0xdb')]({},_0x108a0b,_0x4cf4c2['options']);const _0x381978={'where':_0x108a0b['where']};return db[_0x90eedc('0x6d')][_0x90eedc('0xde')](_0x381978)[_0x90eedc('0x52')](function(_0xd308f8){const _0x3e3263=_0x90eedc;return _0x412b88[_0x3e3263('0xde')]=_0xd308f8,_0x4cf4c2[_0x3e3263('0x2a')][_0x3e3263('0x154')]&&(_0x108a0b[_0x3e3263('0xce')]=[{'attributes':['id',_0x3e3263('0x19'),_0x3e3263('0xf2'),'phone'],'model':db[_0x3e3263('0xb6')],'as':_0x3e3263('0xcc')},{'attributes':['id',_0x3e3263('0x7b'),_0x3e3263('0x51')],'model':db[_0x3e3263('0x127')],'as':'Queue'}]),db['CmHopper']['findAll'](_0x108a0b);})['then'](function(_0x1b9600){const _0x466eb9=_0x90eedc;return _0x412b88[_0x466eb9('0x10a')]=_0x1b9600,_0x412b88;})[_0x90eedc('0x52')](respondWithFilteredResult(_0x10f909,_0x108a0b))[_0x90eedc('0x90')](handleError(_0x10f909,null));},exports['getApiKey']=function(_0xadb422,_0x39bb09){const _0x5a8104=_0x1a4ed3;return!_[_0x5a8104('0x141')](_0xadb422[_0x5a8104('0xc8')]['id'])&&(_0xadb422['user'][_0x5a8104('0x7')]==_0x5a8104('0x73')||_0xadb422['user'][_0x5a8104('0x7')]==_0x5a8104('0xc8'))?db[_0x5a8104('0x159')][_0x5a8104('0xd6')]({'where':{'id':_0xadb422['params']['id']},'raw':!![]})[_0x5a8104('0x52')](function(_0x45551e){const _0x3e11b4=_0x5a8104;return authService[_0x3e11b4('0x115')](_0x45551e);})[_0x5a8104('0x52')](function(_0x5f0d88){const _0xf398c0=_0x5a8104;return _0x5f0d88?_0x39bb09[_0xf398c0('0x67')](0xc8)[_0xf398c0('0x148')]({'api_key':_0x5f0d88[_0xf398c0('0xd8')]}):_0x39bb09['status'](0xcc)[_0xf398c0('0x148')]({'message':_0xf398c0('0x12')});})[_0x5a8104('0x90')](handleError(_0x39bb09,0x193)):_0x39bb09[_0x5a8104('0x67')](0x191)[_0x5a8104('0x148')]({'message':_0x5a8104('0x2b')});},exports[_0x1a4ed3('0x7e')]=function(_0x486110,_0x565071){const _0x9abd19=_0x1a4ed3;return!_[_0x9abd19('0x141')](_0x486110[_0x9abd19('0xc8')]['id'])&&(_0x486110['user']['role']==_0x9abd19('0x73')||_0x486110[_0x9abd19('0xc8')][_0x9abd19('0x7')]==_0x9abd19('0xc8'))?db[_0x9abd19('0x86')][_0x9abd19('0xd6')]({'where':{'id':_0x486110[_0x9abd19('0xdd')]['id']}})[_0x9abd19('0x52')](function(_0x4dae83){const _0x5650cb=_0x9abd19;return authService[_0x5650cb('0x88')](_0x4dae83);})[_0x9abd19('0x52')](function(_0x5bd326){const _0x5edabd=_0x9abd19;return db[_0x5edabd('0x159')]['update']({'apiKeyIat':_0x5bd326[_0x5edabd('0x2c')],'apiKeyNonce':_0x5bd326[_0x5edabd('0x4b')]},{'where':{'id':_0x486110['params']['id']}})[_0x5edabd('0x52')](function(){const _0x17be83=_0x5edabd;return _0x565071[_0x17be83('0x67')](0xc8)[_0x17be83('0x148')]({'api_key':_0x5bd326[_0x17be83('0xd8')]});});})[_0x9abd19('0x90')](handleError(_0x565071,0x193)):_0x565071['status'](0x191)['json']({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});},exports[_0x1a4ed3('0xc5')]=function(_0x23566d,_0x2b6bde){const _0x1de6e7=_0x1a4ed3;return!_[_0x1de6e7('0x141')](_0x23566d[_0x1de6e7('0xc8')]['id'])&&(_0x23566d['user'][_0x1de6e7('0x7')]==_0x1de6e7('0x73')||_0x23566d[_0x1de6e7('0xc8')][_0x1de6e7('0x7')]==_0x1de6e7('0xc8'))?db[_0x1de6e7('0x86')][_0x1de6e7('0xd6')]({'where':{'id':_0x23566d['params']['id']}})['then'](handleEntityNotFound(_0x2b6bde,null))['then'](function(_0x44027f){const _0x7d1fa5=_0x1de6e7;if(_0x44027f&&_0x44027f['apiKeyNonce']&&_0x44027f[_0x7d1fa5('0xc0')])return _0x44027f;else throw{'message':_0x7d1fa5('0x78')};})[_0x1de6e7('0x52')](function(){const _0x3bd087=_0x1de6e7;return db[_0x3bd087('0x159')]['update']({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x23566d[_0x3bd087('0xdd')]['id']}});})['then'](respondWithStatusCode(_0x2b6bde,0xc8))[_0x1de6e7('0x90')](handleError(_0x2b6bde,0x193)):_0x2b6bde['status'](0x191)[_0x1de6e7('0x148')]({'message':_0x1de6e7('0x2b')});},exports[_0x1a4ed3('0x8f')]=function(_0x1984b4,_0x39b487){const _0x2f8084=_0x1a4ed3,_0x3415c7=_0x1984b4[_0x2f8084('0xc8')]['get']({'plain':!![]});return!_0x3415c7?_0x39b487[_0x2f8084('0x67')](0x191)[_0x2f8084('0x21')]('Unable\x20to\x20retrieve\x20the\x20current\x20user'):_0x39b487[_0x2f8084('0x67')](0xc8)[_0x2f8084('0x148')](_0x3415c7);};
\ No newline at end of file
+const a648_0x5643=['openchannel','set','getWhatsappInteractions','removeMailInteractions','pick','You\x20can\x27t\x20delete\x20yourself','user_has_openchannel_interactions:remove','OpenchannelInteraction','Contact','getDataValue','min_internal','getOpenchannelQueues','like','register','previousPasswords','getChatInteractions','catch','getWhatsappAccounts','changePassword','fullname','jayson/promise','getOpenchannelInteractions','Use','destroy','$notBetween','authenticate','getFaxInteractions','enforcePasswordHistory','max','isArray','addWhatsappInteractions','VoiceRecording','undefined','%s%s','ChatWebsite','$ne','channel','Sms','fieldName','getContacts','user:forcelogout','describe','login','capitalize','Users','add','chatPause','server/files/images/logos/default_profile.png','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','each','SmsAccount','apiKeyIat','getQueues','addSquareProjects','password','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','nolimit','updatePasswordsHistory','getMailAccounts','removeOpenchannelAccounts','attributes','user','code','keys','Fax','addContacts','unpause','getWhatsappQueues','some','create','$eq','111','getAgents','name','removeSquareProjects','remoteAddress','$notLike','VIRTUAL','$and','salt','getVoiceQueues','getChannels','CmList','getTeams','color','removeFaxInteractions','whatsapppause','tag','device','$overlap','generateApiKey','options','SELECT','UserProfileResource','lower','user_has_mail_interactions:save','includeAll','MailInteraction','$gt','Pause','getGroups','addAvatar','getSquareProjects','addMailAccounts','UserId','addChatWebsites','stack','$gte','format','http','where','Queue','OpenchannelAccount','user:%s','addQueues','Setting','map','dialActive','internal','lastName','$notILike','interface','sequelize','oldPassword','offset','validatePasswordPattern','findAll','settingsEnabled','client','rawAttributes','manual','lastPauseAt','existsSync','Unknown\x20channel','ids','checkUserLimits','transaction','getSmsQueues','query','getLists','iat','Tag','getChatQueues','addTeams','phone','QueuePause','CmHopper','toLowerCase','../../components/auth/service','100','forEach','newPassword','include','getVoiceQueuesRt','user_has_sms_interactions:remove','removeSmsAccounts','count','moment','addSmsInteractions','user_has_chat_interactions:save','getAvatar','addOpenchannelAccounts','API\x20key\x20not\x20available','info','model','UserVoiceQueueRt','getScheduledCalls','removeWhatsappAccounts','removeFaxAccounts','108','limit','103','user_has_mail_interactions:remove','firstName','Queue:remove','userProfileId','user_has_chat_interactions:remove','permissions','Mail','LOCAL/%s@from-sip/n','CmContact','emit','smsPause','No\x20API\x20access\x20key\x20found!','then','pauseType','Wrong\x20credentials','addSmsAccounts','../../mysqldb','email','getSmsInteractions','pause','agent','whatsapp','intrf','update','whoami','setDataValue','../../rediscache','removeMailAccounts','json','$lte','removeChatWebsites','mailbox','VoiceQueue','$iLike','Tags','params','getFaxAccounts','Unable\x20to\x20retrieve\x20the\x20current\x20user','request\x20sent','role','getOpenchannelAccounts','end','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','error','get','filter','voicePause','fields','flatten','Invalid\x20body\x20format.\x20Use\x20newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','addWhatsappAccounts','MailAccount','removeWhatsappInteractions','QueueId','concat','SquareProject','values','push','getMailQueues','merge','101','User,\x20%s,\x20%s','getFaxQueues','filename','getVoicePrefixes','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','retrieveApiKey','includes','loginInPause','Unknown\x20role','$notIn','isValidChannel','telephone','files/images/','ChatGroup','validatePasswordHistory','../../config/utils','upsert','openchannelPause','isNil','sort','and','passwordHistoryLimit','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','104','util','DEFAULT\x20PAUSE','type','securePassword','root','Team','lodash','all','106','createApiKey','isEmpty','penalty','send','token','ScreenRecording','sendStatus','Queue:save','getChatWebsites','Agents','join','order','userpic','Openchannel','rows','mobile','faxPause','file','admin','removeQueues','UserProfileSection','ChatInteraction','addMailInteractions','status','body','index','SIP/%s','113','autoAssociation','../../components/parsers/qs','mailPause','addFaxInteractions','addChatInteractions','debug','find','Voice','$contains','Queues','getSmsAccounts','114','voice','user_has_fax_interactions:save','omit','WhatsappAccount','getRecordings','getMailInteractions','filters','value','107','$like','from','online','addOpenchannelInteractions','LOGIN','message','bulkCreate','intersection','$in','user_has_fax_interactions:remove','User','user_has_sms_interactions:save','removeTeams','LOGININPAUSE','VoiceMail','getApiKey','mail','Chat','Whatsapp','headers','download','length','findOne','Telephones','key','PAUSE','removeAgent','removeOpenchannelInteractions','MemberReport','differenceBy','removeSmsInteractions','socket','Unauthorized','WhatsappInteraction','UserVoiceQueue.penalty','removeChatInteractions','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2776af,_0x564397){const _0x200509=function(_0x13cf09){while(--_0x13cf09){_0x2776af['push'](_0x2776af['shift']());}};_0x200509(++_0x564397);}(a648_0x5643,0xea));const a648_0x2005=function(_0x2776af,_0x564397){_0x2776af=_0x2776af-0x0;let _0x200509=a648_0x5643[_0x2776af];return _0x200509;};const _0x4d238e=a648_0x2005;'use strict';const moment=require(_0x4d238e('0x114')),util=require(_0x4d238e('0x18')),path=require('path'),fs=require('fs'),_=require(_0x4d238e('0x1e')),{getSocket}=require(_0x4d238e('0x13d')),socket=getSocket(),authService=require(_0x4d238e('0x10b')),qs=require(_0x4d238e('0x3e')),logger=require('../../config/logger')('api'),utils=require(_0x4d238e('0xf')),config=require('../../config/environment'),db=require(_0x4d238e('0x133'))['db'],{Op,QueryTypes,fn,col,where,ValidationError}=require('sequelize'),licenseUtil=require('../../config/license/util');require('./user.socket')[_0x4d238e('0x84')](socket);const jayson=require(_0x4d238e('0x8b')),client=jayson[_0x4d238e('0xf7')][_0x4d238e('0xe4')]({'port':0x232a});function respondWithRpcPromise(_0x13cf09,_0x63e230,_0x1855ba,_0x5cfbda){return new Promise(function(_0x51a63e,_0x59f1ed){const _0x57fdef=a648_0x2005,_0x595ada=_0x5cfbda||client;return _0x595ada['request'](_0x13cf09,_0x1855ba)['then'](function(_0x306f6f){const _0x25770b=a648_0x2005;logger[_0x25770b('0x11a')]('User,\x20%s,\x20%s',_0x63e230,'request\x20sent'),logger[_0x25770b('0x42')]('User,\x20%s,\x20%s,\x20%s',_0x63e230,_0x25770b('0x149'),JSON['stringify'](_0x306f6f));if(_0x306f6f[_0x25770b('0x14e')]){if(_0x306f6f[_0x25770b('0x14e')][_0x25770b('0xb5')]===0x1f4)return logger['error'](_0x25770b('0x0'),_0x63e230,_0x306f6f[_0x25770b('0x14e')][_0x25770b('0x57')]),_0x59f1ed(_0x306f6f[_0x25770b('0x14e')][_0x25770b('0x57')]);return logger[_0x25770b('0x14e')]('User,\x20%s,\x20%s',_0x63e230,_0x306f6f[_0x25770b('0x14e')]['message']),_0x51a63e(_0x306f6f['error'][_0x25770b('0x57')]);}else logger[_0x25770b('0x11a')]('User,\x20%s,\x20%s',_0x63e230,_0x25770b('0x149')),_0x51a63e(_0x306f6f['result'][_0x25770b('0x57')]);})[_0x57fdef('0x87')](function(_0x53568b){const _0x2443b0=_0x57fdef;logger[_0x2443b0('0x14e')](_0x2443b0('0x0'),_0x63e230,_0x53568b),_0x59f1ed(_0x53568b);});});}function respondWithStatusCode(_0x117ab3,_0x30d3fe){return _0x30d3fe=_0x30d3fe||0xcc,function(_0x3004ed){const _0x3383ae=a648_0x2005;if(_0x3004ed)return _0x117ab3['sendStatus'](_0x30d3fe);return _0x117ab3[_0x3383ae('0x38')](_0x30d3fe)[_0x3383ae('0x14c')]();};}function respondWithResult(_0x4af867,_0x354a5e){return _0x354a5e=_0x354a5e||0xc8,function(_0x16d190){const _0x1bce42=a648_0x2005;if(_0x16d190)return _0x4af867[_0x1bce42('0x38')](_0x354a5e)['json'](_0x16d190);};}function respondWithFilteredResult(_0x11e5e5,_0x37ff4d){return function(_0x2cf791){const _0x4b3764=a648_0x2005;if(_0x2cf791){const _0x3def80=_0x2cf791[_0x4b3764('0x113')],_0x21b891=_0x37ff4d['offset'];let _0x11baa3=_0x37ff4d['offset']+_0x37ff4d[_0x4b3764('0x121')],_0x13624e;return _0x11baa3>=_0x3def80?(_0x11baa3=_0x3def80,_0x13624e=0xc8):_0x13624e=0xce,_0x11e5e5[_0x4b3764('0x38')](_0x13624e),_0x11e5e5[_0x4b3764('0x78')]('Content-Range',_0x21b891+'-'+_0x11baa3+'/'+_0x3def80)[_0x4b3764('0x13f')](_0x2cf791);}return null;};}function saveUpdates(_0x198727){return function(_0x5a3a7c){const _0x41dfaa=a648_0x2005;if(_0x5a3a7c)return _0x5a3a7c['update'](_0x198727)[_0x41dfaa('0x12f')](function(_0x4eb5d8){return _0x4eb5d8;});return null;};}function removeEntity(_0x52fb99){return function(_0x326fc5){const _0x5cb214=a648_0x2005;if(_0x326fc5)return _0x326fc5[_0x5cb214('0x8e')]()[_0x5cb214('0x12f')](function(){const _0x347b59=_0x5cb214,_0x4c1b9f=_0x326fc5['get']({'plain':!![]});if(_0x4c1b9f[_0x347b59('0x14a')]==='admin')return;const _0x2a4316=[{'name':_0x347b59('0xa3'),'value':_0x347b59('0xb4'),'ignore':!![]},{'name':_0x347b59('0x2a'),'value':_0x347b59('0x137'),'ignore':![]},{'name':'Telephones','value':_0x347b59('0xb'),'ignore':![]}],_0x1eec46=_(_0x2a4316)['filter']('ignore')[_0x347b59('0xeb')](_0x347b59('0x50'))[_0x347b59('0x50')]();if(_[_0x347b59('0x6')](_0x1eec46,_0x4c1b9f[_0x347b59('0x14a')]))return;const _0x37be87=_[_0x347b59('0x43')](_0x2a4316,[_0x347b59('0x50'),_0x4c1b9f[_0x347b59('0x14a')]])['name'];return db[_0x347b59('0xd4')][_0x347b59('0x8e')]({'where':{'type':_0x37be87,'resourceId':_0x4c1b9f['id']}})[_0x347b59('0x12f')](function(){return _0x326fc5;});})[_0x5cb214('0x12f')](function(){const _0x66a580=_0x5cb214;_0x52fb99[_0x66a580('0x38')](0xcc)[_0x66a580('0x14c')]();});};}function handleEntityNotFound(_0x29a3db){return function(_0x1b330b){const _0xef313c=a648_0x2005;return!_0x1b330b&&_0x29a3db[_0xef313c('0x27')](0x194),_0x1b330b;};}function handleError(_0xd349da,_0x1f01c9){return _0x1f01c9=_0x1f01c9||0x1f4,function(_0x26f2b2){const _0x2f63c5=a648_0x2005;logger['error'](_0x26f2b2[_0x2f63c5('0xe1')]),_0x26f2b2[_0x2f63c5('0xc0')]&&delete _0x26f2b2[_0x2f63c5('0xc0')],_0xd349da[_0x2f63c5('0x38')](_0x1f01c9)[_0x2f63c5('0x24')](_0x26f2b2);};}function validateUser(_0x2d9192){return new Promise(function(_0x4811c6,_0x293d72){const _0x25b915=a648_0x2005;if(_0x2d9192[_0x25b915('0xed')])return _0x4811c6(_0x2d9192);return db[_0x25b915('0xea')]['findByPk'](0x1)['then'](function(_0x30f724){const _0x561892=_0x25b915;if(_0x30f724['securePassword'])authService[_0x561892('0xf4')](_0x2d9192[_0x561892('0xad')]);db[_0x561892('0x5c')][_0x561892('0x93')](_0x561892('0xed'))[_0x561892('0x12f')](function(_0x19ffc9){const _0x2e5bad=_0x561892;if(_['isNil'](_0x19ffc9)){_0x2d9192[_0x2e5bad('0xed')]=_0x30f724[_0x2e5bad('0x81')]||0x1;return;}if(_[_0x2e5bad('0x12')](_0x30f724[_0x2e5bad('0x81')])||_0x30f724[_0x2e5bad('0x81')]===_0x19ffc9){_0x2d9192[_0x2e5bad('0xed')]=_0x19ffc9+0x1;return;}if(_0x30f724['min_internal']>_0x19ffc9){_0x2d9192['internal']=_0x30f724[_0x2e5bad('0x81')];return;}return db[_0x2e5bad('0xf1')][_0x2e5bad('0x101')](_0x2e5bad('0xa7'),{'type':QueryTypes[_0x2e5bad('0xd3')]})['then'](function(_0x642c1c){const _0x3d9787=_0x2e5bad;if(_0x642c1c&&_0x642c1c['length'])for(let _0x3353c1=0x0,_0x147f11=_0x642c1c[_0x3d9787('0x67')];_0x3353c1<_0x147f11&&_[_0x3d9787('0x12')](_0x2d9192['internal']);_0x3353c1++){if(_0x30f724[_0x3d9787('0x81')]<=_0x642c1c[_0x3353c1][_0x3d9787('0x53')])_0x2d9192[_0x3d9787('0xed')]=_0x642c1c[_0x3353c1][_0x3d9787('0x53')];else _0x30f724[_0x3d9787('0x81')]>_0x642c1c[_0x3353c1][_0x3d9787('0x53')]&&_0x30f724['min_internal']<=_0x642c1c[_0x3353c1]['to']&&(_0x2d9192[_0x3d9787('0xed')]=_0x30f724[_0x3d9787('0x81')]);}return _['isNil'](_0x2d9192[_0x3d9787('0xed')])&&(_0x2d9192[_0x3d9787('0xed')]=_0x19ffc9+0x1),_0x4811c6(_0x2d9192);});});})[_0x25b915('0x87')](function(_0x41f693){_0x293d72(_0x41f693);});});}function updateUser(_0x466e08){return new Promise(function(_0x12668e,_0x1281b4){const _0x1e57ea=a648_0x2005;try{_0x466e08['voicemail']&&(_0x466e08[_0x1e57ea('0x142')]=_0x466e08[_0x1e57ea('0xed')],_0x466e08[_0x1e57ea('0x60')]={'mailbox':_0x466e08[_0x1e57ea('0xed')],'password':_0x466e08[_0x1e57ea('0xad')],'fullname':_0x466e08[_0x1e57ea('0x8a')],'email':_0x466e08[_0x1e57ea('0x134')]});if(_0x466e08[_0x1e57ea('0x14a')]==='agent'){if(!_0x466e08['permissions'])_0x466e08[_0x1e57ea('0x128')]=[_0x1e57ea('0x160'),'102',_0x1e57ea('0x122'),_0x1e57ea('0x3c'),'110',_0x1e57ea('0x17'),'105',_0x1e57ea('0x20'),_0x1e57ea('0x51'),_0x1e57ea('0x120'),'109',_0x1e57ea('0x10c'),_0x1e57ea('0xbe'),_0x1e57ea('0x48')];}_0x12668e(_0x466e08);}catch(_0x2e704b){_0x1281b4(_0x2e704b);}});}exports[_0x4d238e('0x3a')]=function(_0x3d9a55,_0x3e1a12){const _0x3fc41e=_0x4d238e;let _0x1c76b7={};const _0x2f6f56={},_0x3ce245={'count':0x0,'rows':[]},_0x55494d=_[_0x3fc41e('0xeb')](db['User']['rawAttributes'],function(_0x596cf4){const _0x17198f=_0x3fc41e;return{'name':_0x596cf4[_0x17198f('0x9d')],'type':_0x596cf4[_0x17198f('0x1a')][_0x17198f('0x6a')]};});_0x2f6f56['model']=_[_0x3fc41e('0x6f')](_[_0x3fc41e('0xeb')](_0x55494d,_0x3fc41e('0xc0')),[_0x3fc41e('0xad'),_0x3fc41e('0xc6')]),_0x2f6f56[_0x3fc41e('0x101')]=_['keys'](_0x3d9a55[_0x3fc41e('0x101')]),_0x2f6f56[_0x3fc41e('0x4f')]=_[_0x3fc41e('0x59')](_0x2f6f56[_0x3fc41e('0x11b')],_0x2f6f56[_0x3fc41e('0x101')]),_0x1c76b7[_0x3fc41e('0xb3')]=_[_0x3fc41e('0x59')](_0x2f6f56[_0x3fc41e('0x11b')],qs['fields'](_0x3d9a55[_0x3fc41e('0x101')]['fields'])),_0x1c76b7[_0x3fc41e('0xb3')]=_0x1c76b7[_0x3fc41e('0xb3')][_0x3fc41e('0x67')]?_0x1c76b7['attributes']:_0x2f6f56[_0x3fc41e('0x11b')];typeof _0x3d9a55[_0x3fc41e('0x101')]['nolimit']===_0x3fc41e('0x97')&&(_0x1c76b7[_0x3fc41e('0x121')]=qs[_0x3fc41e('0x121')](_0x3d9a55[_0x3fc41e('0x101')][_0x3fc41e('0x121')]),_0x1c76b7[_0x3fc41e('0xf3')]=qs[_0x3fc41e('0xf3')](_0x3d9a55[_0x3fc41e('0x101')][_0x3fc41e('0xf3')]));_0x1c76b7[_0x3fc41e('0x2c')]=qs[_0x3fc41e('0x13')](_0x3d9a55[_0x3fc41e('0x101')][_0x3fc41e('0x13')]),_0x1c76b7[_0x3fc41e('0xe5')]=qs['filters'](_[_0x3fc41e('0x7b')](_0x3d9a55[_0x3fc41e('0x101')],_0x2f6f56[_0x3fc41e('0x4f')]),_0x55494d);_0x3d9a55[_0x3fc41e('0x101')]['filter']&&(_0x1c76b7['where']=_['merge'](_0x1c76b7['where'],{[Op['or']]:_[_0x3fc41e('0xeb')](_0x55494d,function(_0xb27dda){const _0x1cce94=_0x3fc41e;if(_0xb27dda[_0x1cce94('0x1a')]!==_0x1cce94('0xc4'))return where(fn(_0x1cce94('0xd5'),col(_0xb27dda[_0x1cce94('0xc0')])),{'$like':fn(_0x1cce94('0xd5'),'%'+_0x3d9a55[_0x1cce94('0x101')]['filter']+'%')});})}));_0x1c76b7=_[_0x3fc41e('0x15f')]({},_0x1c76b7,_0x3d9a55[_0x3fc41e('0xd2')]);const _0x181bf4={'where':_0x1c76b7[_0x3fc41e('0xe5')]};return db['User']['count'](_0x181bf4)[_0x3fc41e('0x12f')](function(_0x3b43fd){const _0x307779=_0x3fc41e;return _0x3ce245[_0x307779('0x113')]=_0x3b43fd,typeof _0x3d9a55['query'][_0x307779('0xd7')]!==_0x307779('0x97')&&(_0x1c76b7[_0x307779('0x10f')]=[{'all':!![]}]),db[_0x307779('0x5c')][_0x307779('0xf5')](_0x1c76b7);})[_0x3fc41e('0x12f')](function(_0x6bce11){const _0x3d06a1=_0x3fc41e;return _0x3ce245[_0x3d06a1('0x2f')]=_0x6bce11,_0x3ce245;})[_0x3fc41e('0x12f')](respondWithFilteredResult(_0x3e1a12,_0x1c76b7))[_0x3fc41e('0x87')](handleError(_0x3e1a12,null));},exports['show']=function(_0x3dc5a8,_0x599eaa){const _0x2a1524=_0x4d238e;let _0x1c517c={'raw':![],'where':{'id':_0x3dc5a8[_0x2a1524('0x146')]['id']}};const _0xd74ca3={};return _0xd74ca3[_0x2a1524('0x11b')]=_['differenceBy'](_[_0x2a1524('0xb6')](db[_0x2a1524('0x5c')][_0x2a1524('0xf8')]),[_0x2a1524('0xad'),_0x2a1524('0xc6')]),_0xd74ca3['query']=_['keys'](_0x3dc5a8[_0x2a1524('0x101')]),_0xd74ca3[_0x2a1524('0x4f')]=_['intersection'](_0xd74ca3[_0x2a1524('0x11b')],_0xd74ca3[_0x2a1524('0x101')]),_0x1c517c[_0x2a1524('0xb3')]=_[_0x2a1524('0x59')](_0xd74ca3[_0x2a1524('0x11b')],qs[_0x2a1524('0x152')](_0x3dc5a8[_0x2a1524('0x101')][_0x2a1524('0x152')])),_0x1c517c[_0x2a1524('0xb3')]=_0x1c517c[_0x2a1524('0xb3')]['length']?_0x1c517c['attributes']:_0xd74ca3[_0x2a1524('0x11b')],_0x3dc5a8['query'][_0x2a1524('0xd7')]&&(_0x1c517c[_0x2a1524('0x10f')]=[{'all':!![]}]),_0x1c517c=_[_0x2a1524('0x15f')]({},_0x1c517c,_0x3dc5a8[_0x2a1524('0xd2')]),db[_0x2a1524('0x5c')]['findOne'](_0x1c517c)[_0x2a1524('0x12f')](handleEntityNotFound(_0x599eaa,null))[_0x2a1524('0x12f')](respondWithResult(_0x599eaa,null))[_0x2a1524('0x87')](handleError(_0x599eaa,null));},exports['bulkCreate']=function(_0x54f206,_0x642c9){const _0x392c9e=_0x4d238e,_0x236c85=_0x54f206[_0x392c9e('0x39')];let _0x57b24e=[];if(_0x54f206[_0x392c9e('0xb4')][_0x392c9e('0x14a')]===_0x392c9e('0x137'))throw new Error(_0x392c9e('0x72'));if(_[_0x392c9e('0xbb')](_0x236c85,['role',_0x392c9e('0xb4')])&&_0x54f206[_0x392c9e('0xb4')][_0x392c9e('0x14a')]!=='admin')throw new Error(_0x392c9e('0x14d'));if(_[_0x392c9e('0xbb')](_0x236c85,['role','admin'])&&_0x54f206[_0x392c9e('0xb4')]['role']!=='admin')throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');return licenseUtil[_0x392c9e('0xfe')](_0x236c85)[_0x392c9e('0x12f')](function(){return validateUser(_0x236c85[0x0]);})[_0x392c9e('0x12f')](function(){const _0x51e8fb=_0x392c9e;for(let _0x36f941=0x1;_0x36f941<_0x236c85[_0x51e8fb('0x67')];_0x36f941++){const _0x152486=_0x236c85[_0x36f941-0x1][_0x51e8fb('0xed')];if(!_0x236c85[_0x36f941]['internal'])_0x236c85[_0x36f941][_0x51e8fb('0xed')]=_0x152486+0x1;_0x57b24e[_0x51e8fb('0x15d')](validateUser(_0x236c85[_0x36f941]));}return Promise[_0x51e8fb('0x1f')](_0x57b24e);})[_0x392c9e('0x12f')](function(){const _0x1704fa=_0x392c9e;_0x57b24e=[];for(let _0xfd0d5=0x0;_0xfd0d5<_0x236c85[_0x1704fa('0x67')];_0xfd0d5++){_0x57b24e[_0x1704fa('0x15d')](updateUser(_0x236c85[_0xfd0d5]));}return Promise[_0x1704fa('0x1f')](_0x57b24e);})[_0x392c9e('0x12f')](function(){const _0x16731c=_0x392c9e;return _0x57b24e=_0x236c85[_0x16731c('0xeb')](_0x26e11c=>{const _0x10cd30=_0x16731c;return db[_0x10cd30('0x5c')][_0x10cd30('0xbc')](_0x26e11c,{'include':[{'model':db[_0x10cd30('0x60')],'as':'VoiceMail'}]})[_0x10cd30('0x12f')](function(_0x1952cb){return _0x26e11c['id']=_0x1952cb['id'],_0x26e11c;});}),Promise[_0x16731c('0x1f')](_0x57b24e);})[_0x392c9e('0x12f')](function(_0x2a3970){const _0x5d2811=_0x392c9e;if(_0x54f206[_0x5d2811('0x39')][_0x5d2811('0x14a')]===_0x5d2811('0xb4'))return _0x2a3970;if(_0x54f206[_0x5d2811('0xb4')]['role']!==_0x5d2811('0xb4'))return _0x2a3970;const _0x3812a5=_['some'](_0x2a3970,function(_0x401fc5){const _0x516686=_0x5d2811;return _0x401fc5[_0x516686('0x14a')]===_0x516686('0x137')||_0x401fc5[_0x516686('0x14a')]===_0x516686('0xb');});if(!_0x3812a5)return _0x2a3970;return db['UserProfileSection'][_0x5d2811('0xf5')]({'where':{'name':{[Op['or']]:[_0x5d2811('0x2a'),_0x5d2811('0x69')]},'userProfileId':_0x54f206['user'][_0x5d2811('0x126')]},'raw':!![]})[_0x5d2811('0x12f')](function(_0x166bb3){const _0x5799b7=_0x5d2811;if(_[_0x5799b7('0x22')](_0x166bb3)||!_[_0x5799b7('0xbb')](_0x166bb3,[_0x5799b7('0x3d'),0x0]))return _0x2a3970;_0x57b24e=[];const _0x6ec48d=_(_0x166bb3)[_0x5799b7('0xeb')](function(_0x1fa304){const _0x12509a=_0x5799b7;if(_0x1fa304[_0x12509a('0x3d')]===0x1)return;return _0x1fa304[_0x12509a('0xc0')]==='Agents'?_0x12509a('0x137'):_0x12509a('0xb');})['compact']()[_0x5799b7('0x50')]();for(let _0x5ecf9c=0x0;_0x5ecf9c<_0x2a3970[_0x5799b7('0x67')];_0x5ecf9c++){if(!_[_0x5799b7('0x6')](_0x6ec48d,_0x2a3970[_0x5ecf9c][_0x5799b7('0x14a')]))return;const _0x5305a5=_0x2a3970[_0x5ecf9c][_0x5799b7('0x14a')]===_0x5799b7('0x137')?'Agents':_0x5799b7('0x69');_0x57b24e['push'](db[_0x5799b7('0xd4')][_0x5799b7('0xbc')]({'name':_0x2a3970[_0x5ecf9c][_0x5799b7('0xc0')],'resourceId':_0x2a3970[_0x5ecf9c]['id'],'type':_0x5305a5,'sectionId':_['find'](_0x166bb3,[_0x5799b7('0xc0'),_0x5305a5])['id']},{}));}return Promise[_0x5799b7('0x1f')](_0x57b24e);});})[_0x392c9e('0x12f')](respondWithResult(_0x642c9,0xc9))['catch'](handleError(_0x642c9,null));},exports[_0x4d238e('0x13a')]=function(_0x5c6ad0,_0x27f07e){const _0x74070f=_0x4d238e;return _0x5c6ad0['body']['id']&&delete _0x5c6ad0[_0x74070f('0x39')]['id'],delete _0x5c6ad0[_0x74070f('0x39')][_0x74070f('0x14a')],db['User']['findOne']({'where':{'id':_0x5c6ad0[_0x74070f('0x146')]['id']}})[_0x74070f('0x12f')](handleEntityNotFound(_0x27f07e,null))[_0x74070f('0x12f')](saveUpdates(_0x5c6ad0[_0x74070f('0x39')],null))[_0x74070f('0x12f')](respondWithResult(_0x27f07e,null))[_0x74070f('0x87')](handleError(_0x27f07e,null));},exports['describe']=function(_0x21c58e,_0x1a6fcd){const _0x48b1b8=_0x4d238e;return db[_0x48b1b8('0x5c')][_0x48b1b8('0xa0')]()[_0x48b1b8('0x12f')](respondWithResult(_0x1a6fcd,null))[_0x48b1b8('0x87')](handleError(_0x1a6fcd,null));},exports[_0x4d238e('0xb8')]=function(_0x1b4db5,_0x2a44d6){const _0x5eee88=_0x4d238e;return db[_0x5eee88('0x5c')][_0x5eee88('0x68')]({'where':{'id':_0x1b4db5['params']['id']}})['then'](handleEntityNotFound(_0x2a44d6,null))[_0x5eee88('0x12f')](function(_0x56e311){const _0x4fa53a=_0x5eee88;if(_0x56e311)return _0x56e311[_0x4fa53a('0xb8')](_0x1b4db5['body'][_0x4fa53a('0xfd')],{'through':_[_0x4fa53a('0x4b')](_0x1b4db5['body'],['ids','id'])});})[_0x5eee88('0x12f')](respondWithResult(_0x2a44d6,null))[_0x5eee88('0x87')](handleError(_0x2a44d6,null));},exports['create']=function(_0x5e8061,_0x8945f5){const _0x3499d7=_0x4d238e;if(_0x5e8061[_0x3499d7('0xb4')][_0x3499d7('0x14a')]===_0x3499d7('0x137'))throw new Error(_0x3499d7('0x72'));if(_0x5e8061['body'][_0x3499d7('0x14a')]===_0x3499d7('0xb4')&&_0x5e8061[_0x3499d7('0xb4')][_0x3499d7('0x14a')]!==_0x3499d7('0x33'))throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');if(_0x5e8061['body'][_0x3499d7('0x14a')]==='admin'&&_0x5e8061['user'][_0x3499d7('0x14a')]!==_0x3499d7('0x33'))throw new Error(_0x3499d7('0xae'));return licenseUtil['checkUserLimits']([_0x5e8061[_0x3499d7('0x39')]])[_0x3499d7('0x12f')](function(){return validateUser(_0x5e8061['body']);})['then'](function(_0x133929){return updateUser(_0x133929)['then'](function(_0x19d62a){const _0x4bfe97=a648_0x2005;return _0x19d62a[_0x4bfe97('0x14a')]===_0x4bfe97('0x33')&&(_0x19d62a[_0x4bfe97('0xf6')]=_0x5e8061[_0x4bfe97('0xb4')][_0x4bfe97('0xf6')],delete _0x19d62a['userProfileId']),_0x19d62a;});})[_0x3499d7('0x12f')](function(_0x5e730f){const _0x45ffe7=_0x3499d7;return db['User']['create'](_0x5e730f,{'include':[{'model':db['VoiceMail'],'as':_0x45ffe7('0x60')}]});})[_0x3499d7('0x12f')](function(_0x22ac83){const _0xcb4d3e=_0x3499d7;if(_0x5e8061['body']['role']===_0xcb4d3e('0xb4'))return _0x22ac83;if(_0x5e8061[_0xcb4d3e('0xb4')][_0xcb4d3e('0x14a')]!==_0xcb4d3e('0xb4'))return _0x22ac83;return db[_0xcb4d3e('0x35')][_0xcb4d3e('0x68')]({'where':{'name':_0x22ac83[_0xcb4d3e('0x14a')]===_0xcb4d3e('0x137')?_0xcb4d3e('0x2a'):_0xcb4d3e('0x69'),'userProfileId':_0x5e8061[_0xcb4d3e('0xb4')]['userProfileId']},'raw':!![]})[_0xcb4d3e('0x12f')](function(_0x51c668){const _0x1285d7=_0xcb4d3e;if(!_0x51c668||_0x51c668[_0x1285d7('0x3d')]!=0x0)return _0x22ac83;return db[_0x1285d7('0xd4')][_0x1285d7('0xbc')]({'name':_0x22ac83[_0x1285d7('0xc0')],'resourceId':_0x22ac83['id'],'type':_0x51c668[_0x1285d7('0xc0')],'sectionId':_0x51c668['id']},{})[_0x1285d7('0x12f')](function(){return _0x22ac83;});})[_0xcb4d3e('0x87')](function(_0x57fb11){const _0x28f73f=_0xcb4d3e;logger[_0x28f73f('0x14e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57fb11);throw _0x57fb11;});})[_0x3499d7('0x12f')](respondWithResult(_0x8945f5,0xc9))[_0x3499d7('0x87')](handleError(_0x8945f5,null));},exports[_0x4d238e('0x89')]=function(_0x658122,_0x3d771c){const _0x2f49de=_0x4d238e;if(_0x658122['body']['id'])delete _0x658122[_0x2f49de('0x39')]['id'];return db['User'][_0x2f49de('0x68')]({'where':{'id':_0x658122[_0x2f49de('0x146')]['id']}})[_0x2f49de('0x12f')](function(_0x2a9229){const _0x5725bd=_0x2f49de;if(!_0x2a9229)return null;if(_0x2a9229['id']===_0x658122['user']['id']){if(!_0x658122[_0x5725bd('0x39')][_0x5725bd('0xf2')]||!_0x658122[_0x5725bd('0x39')][_0x5725bd('0x10e')])throw new ValidationError(_0x5725bd('0x16'));if(!_0x2a9229[_0x5725bd('0x90')](_0x658122[_0x5725bd('0x39')][_0x5725bd('0xf2')]))throw new ValidationError(_0x5725bd('0x131'));if(_0x658122['body']['oldPassword']===_0x658122[_0x5725bd('0x39')][_0x5725bd('0x10e')])throw new ValidationError(_0x5725bd('0x155'));}else{if(_0x658122[_0x5725bd('0xb4')]['role']===_0x5725bd('0x33')){if(!_0x658122['body']['newPassword'])throw new ValidationError(_0x5725bd('0x154'));}else{if(_0x658122[_0x5725bd('0xb4')][_0x5725bd('0x14a')]==='user'){if(!_0x658122[_0x5725bd('0x39')][_0x5725bd('0x10e')])throw new ValidationError('Invalid\x20body\x20format.\x20Use\x20newPassword');if(_0x2a9229[_0x5725bd('0x14a')]!=='agent')throw new ValidationError(_0x5725bd('0x72'));}else throw new ValidationError(_0x5725bd('0x72'));}}return _0x2a9229;})[_0x2f49de('0x12f')](handleEntityNotFound(_0x3d771c,null))[_0x2f49de('0x12f')](function(_0x442483){const _0x8a338f=_0x2f49de;return db[_0x8a338f('0xea')]['findOne']({'attributes':['id','securePassword',_0x8a338f('0x92'),'passwordHistoryLimit']})[_0x8a338f('0x12f')](function(_0x206723){const _0x46eee3=_0x8a338f;if(_0x206723[_0x46eee3('0x1b')])authService[_0x46eee3('0xf4')](_0x658122['body'][_0x46eee3('0x10e')]);if(!_0x206723[_0x46eee3('0x92')]||!_0x442483['previousPasswords'])return _0x442483;return authService[_0x46eee3('0xe')](_0x658122[_0x46eee3('0x39')][_0x46eee3('0x10e')],_0x442483[_0x46eee3('0x85')],_0x206723[_0x46eee3('0x15')]),_0x442483;})[_0x8a338f('0x12f')](saveUpdates({'password':_0x658122[_0x8a338f('0x39')][_0x8a338f('0x10e')],'passwordResetAt':_0x658122[_0x8a338f('0xb4')]['id']==_0x658122[_0x8a338f('0x146')]['id']?moment():null,'previousPasswords':authService[_0x8a338f('0xb0')](_0x658122[_0x8a338f('0x39')][_0x8a338f('0x10e')],_0x442483['previousPasswords'])},null));})[_0x2f49de('0x12f')](respondWithResult(_0x3d771c,null))[_0x2f49de('0x87')](handleError(_0x3d771c,null));},exports[_0x4d238e('0xe9')]=function(_0x2a3c9c,_0x264395){const _0x101cc2=_0x4d238e,_0x11a0b3=_0x2a3c9c[_0x101cc2('0x39')]['channel'];return db[_0x101cc2('0x5c')][_0x101cc2('0x68')]({'where':{'id':_0x2a3c9c[_0x101cc2('0x146')]['id']},'attributes':['id',_0x101cc2('0xc0'),_0x101cc2('0x14a'),_0x101cc2('0x54'),_0x101cc2('0x7'),'voicePause',_0x101cc2('0xf0')]})['then'](handleEntityNotFound(_0x264395,null))[_0x101cc2('0x12f')](function(_0xea9fe6){const _0x1e8563=_0x101cc2;if(_0xea9fe6){if(!utils[_0x1e8563('0xa')](_0x11a0b3))throw new ValidationError(_0x1e8563('0xfc'));return _0xea9fe6[_0x1e8563('0xa4')+_['capitalize'](_0x11a0b3[_0x1e8563('0x10a')]())+_0x1e8563('0x46')](_0x2a3c9c[_0x1e8563('0x39')][_0x1e8563('0xfd')],{'through':{'penalty':_0x2a3c9c[_0x1e8563('0x39')][_0x1e8563('0x23')]||0x0}})[_0x1e8563('0x12f')](function(_0x362070){const _0x1baa1=_0x1e8563;for(let _0x29d478=0x0;_0x29d478<_0x2a3c9c[_0x1baa1('0x39')]['ids']['length'];_0x29d478+=0x1){const _0x1bf6b9={'UserId':_0x2a3c9c[_0x1baa1('0x146')]['id']};_0x1bf6b9[_[_0x1baa1('0xa2')](_0x11a0b3['toLowerCase']())+'QueueId']=_0x2a3c9c[_0x1baa1('0x39')][_0x1baa1('0xfd')][_0x29d478],socket[_0x1baa1('0x12c')](_0x1baa1('0xb4')+_['capitalize'](_0x11a0b3[_0x1baa1('0x10a')]())+_0x1baa1('0x28'),_0x1bf6b9);}return _0x362070;})[_0x1e8563('0x12f')](function(){const _0x48e890=_0x1e8563;if(_0x11a0b3===_0x48e890('0x49'))return db[_0x48e890('0x143')][_0x48e890('0xf5')]({'where':{'id':_0x2a3c9c['body'][_0x48e890('0xfd')]||[]},'raw':!![],'attributes':['id',_0x48e890('0xc0')]});})['then'](function(_0x7be36e){const _0x10dd24=_0x1e8563,_0x454326=_0xea9fe6[_0x10dd24('0x14f')]({'plain':!![]}),_0x2d084e=[];if(_0x11a0b3==='voice'&&_0x454326['role']===_0x10dd24('0x137')&&_0x454326['online']){for(let _0x30f339=0x0;_0x30f339<_0x7be36e['length'];_0x30f339+=0x1){_0x2d084e['push']({'membername':_0x454326['name'],'UserId':_0x454326['id'],'queue_name':_0x7be36e[_0x30f339][_0x10dd24('0xc0')],'VoiceQueueId':_0x7be36e[_0x30f339]['id'],'interface':_[_0x10dd24('0x12')](_0x454326[_0x10dd24('0xf0')])?util[_0x10dd24('0xe3')](_0x10dd24('0x3b'),_0x454326[_0x10dd24('0xc0')]):_0x454326[_0x10dd24('0xf0')],'paused':_0x454326[_0x10dd24('0x151')]||![],'penalty':_0x2a3c9c[_0x10dd24('0x39')]['penalty']||0x0});}return Promise[_0x10dd24('0xa8')](_0x2d084e,function(_0x4df694){const _0x97398f=_0x10dd24;return db[_0x97398f('0x11c')][_0x97398f('0x10')](_0x4df694);});}return _0xea9fe6;});}})[_0x101cc2('0x12f')](respondWithStatusCode(_0x264395,null))[_0x101cc2('0x87')](handleError(_0x264395,null));},exports[_0x4d238e('0x34')]=function(_0x58bcd1,_0x2006cd){const _0xd6c910=_0x4d238e;let _0x262b6e;return db['User'][_0xd6c910('0x68')]({'where':{'id':_0x58bcd1[_0xd6c910('0x146')]['id']},'attributes':['id','name','role']})[_0xd6c910('0x12f')](handleEntityNotFound(_0x2006cd,null))[_0xd6c910('0x12f')](function(_0x4f20b4){const _0x4ff51d=_0xd6c910;if(_0x4f20b4){_0x262b6e=_0x4f20b4;if(!_0x58bcd1['query']['channel']||!utils[_0x4ff51d('0xa')](_0x58bcd1[_0x4ff51d('0x101')]['channel']))throw new ValidationError(_0x4ff51d('0xfc'));return _0x4f20b4['remove'+_[_0x4ff51d('0xa2')](_0x58bcd1[_0x4ff51d('0x101')][_0x4ff51d('0x9b')][_0x4ff51d('0x10a')]())+_0x4ff51d('0x46')](_0x58bcd1[_0x4ff51d('0x101')][_0x4ff51d('0xfd')]);}})[_0xd6c910('0x12f')](function(_0x337138){const _0x5d8e89=_0xd6c910;for(let _0x10152d=0x0;_0x10152d<_0x58bcd1[_0x5d8e89('0x101')][_0x5d8e89('0xfd')][_0x5d8e89('0x67')];_0x10152d+=0x1){const _0x427612={'UserId':_0x58bcd1['params']['id']};_0x427612[_['capitalize'](_0x58bcd1[_0x5d8e89('0x101')][_0x5d8e89('0x9b')]['toLowerCase']())+'QueueId']=_0x58bcd1[_0x5d8e89('0x101')][_0x5d8e89('0xfd')][_0x10152d],socket[_0x5d8e89('0x12c')]('user'+_[_0x5d8e89('0xa2')](_0x58bcd1[_0x5d8e89('0x101')]['channel'][_0x5d8e89('0x10a')]())+_0x5d8e89('0x125'),_0x427612);}return _0x337138;})[_0xd6c910('0x12f')](function(){const _0xa03683=_0xd6c910;if(_0x58bcd1[_0xa03683('0x101')]['channel']===_0xa03683('0x49'))return db[_0xa03683('0x11c')][_0xa03683('0x8e')]({'where':{'UserId':_0x58bcd1[_0xa03683('0x146')]['id'],'VoiceQueueId':_0x58bcd1['query'][_0xa03683('0xfd')]},'individualHooks':!![]})['then'](function(){return _0x262b6e;});return _0x262b6e;})['then'](respondWithStatusCode(_0x2006cd,null))['catch'](handleError(_0x2006cd,null));},exports[_0x4d238e('0xdc')]=function(_0x195d74,_0xe965f2){const _0x9a286=_0x4d238e;return _0x195d74[_0x9a286('0x39')]['userpic']=_0x195d74[_0x9a286('0x32')][_0x9a286('0x2')],db[_0x9a286('0x5c')][_0x9a286('0x68')]({'where':{'id':_0x195d74[_0x9a286('0x146')]['id']}})[_0x9a286('0x12f')](handleEntityNotFound(_0xe965f2,null))[_0x9a286('0x12f')](saveUpdates(_0x195d74[_0x9a286('0x39')],null))[_0x9a286('0x12f')](respondWithResult(_0xe965f2,null))['catch'](handleError(_0xe965f2,null));},exports[_0x4d238e('0x117')]=function(_0x400f3b,_0xba23c6){const _0x4a81d1=_0x4d238e,_0x2c9eee=path[_0x4a81d1('0x2b')](config[_0x4a81d1('0x1c')],_0x4a81d1('0xa6'));return db['User'][_0x4a81d1('0x68')]({'where':{'id':_0x400f3b['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x4a81d1('0x12f')](handleEntityNotFound(_0xba23c6,null))[_0x4a81d1('0x12f')](function(_0x363c59){const _0x36b730=_0x4a81d1;if(_0x363c59){if(_['isNil'](_0x363c59[_0x36b730('0x2d')]))return _0xba23c6['download'](_0x2c9eee);else{if(!fs[_0x36b730('0xfb')](path[_0x36b730('0x2b')](config[_0x36b730('0x1c')],'files/images/',_0x363c59['userpic'])))return _0xba23c6[_0x36b730('0x66')](_0x2c9eee);return _0xba23c6[_0x36b730('0x66')](path[_0x36b730('0x2b')](config['root'],_0x36b730('0xc'),_0x363c59[_0x36b730('0x2d')]));}}})[_0x4a81d1('0x87')](handleError(_0xba23c6,null));},exports[_0x4d238e('0x9e')]=function(_0x85e8d7,_0x438636){const _0x4561b1=_0x4d238e;let _0x38d143={};const _0x45d70d={};let _0x397e34,_0x3e394b;return db[_0x4561b1('0x5c')][_0x4561b1('0x68')]({'where':{'id':_0x85e8d7[_0x4561b1('0x146')]['id']}})['then'](handleEntityNotFound(_0x438636,null))[_0x4561b1('0x12f')](function(_0x4d8b30){const _0x9c7922=_0x4561b1;if(_0x4d8b30)return _0x397e34=_0x4d8b30,_0x45d70d[_0x9c7922('0x11b')]=_[_0x9c7922('0xb6')](db[_0x9c7922('0x12b')][_0x9c7922('0xf8')]),_0x45d70d[_0x9c7922('0x101')]=_['keys'](_0x85e8d7['query']),_0x45d70d[_0x9c7922('0x4f')]=_['intersection'](_0x45d70d[_0x9c7922('0x11b')],_0x45d70d[_0x9c7922('0x101')]),_0x38d143['attributes']=_[_0x9c7922('0x59')](_0x45d70d['model'],qs[_0x9c7922('0x152')](_0x85e8d7[_0x9c7922('0x101')][_0x9c7922('0x152')])),_0x38d143['attributes']=_0x38d143[_0x9c7922('0xb3')][_0x9c7922('0x67')]?_0x38d143['attributes']:_0x45d70d['model'],_0x38d143[_0x9c7922('0x2c')]=qs[_0x9c7922('0x13')](_0x85e8d7[_0x9c7922('0x101')]['sort']),_0x38d143[_0x9c7922('0xe5')]=qs[_0x9c7922('0x4f')](_[_0x9c7922('0x7b')](_0x85e8d7[_0x9c7922('0x101')],_0x45d70d[_0x9c7922('0x4f')])),_0x85e8d7[_0x9c7922('0x101')]['filter']&&(_0x38d143[_0x9c7922('0xe5')]=_['merge'](_0x38d143[_0x9c7922('0xe5')],{[Op['or']]:_[_0x9c7922('0xeb')](_0x38d143['attributes'],function(_0x18ba39){const _0x13e366=_0x9c7922,_0x3b5ec8={};return _0x3b5ec8[_0x18ba39]={[Op[_0x13e366('0x83')]]:'%'+_0x85e8d7[_0x13e366('0x101')][_0x13e366('0x150')]+'%'},_0x3b5ec8;})})),_0x38d143=_[_0x9c7922('0x15f')]({},_0x38d143,_0x85e8d7[_0x9c7922('0xd2')]),_0x397e34['getContacts'](_0x38d143);})[_0x4561b1('0x12f')](function(_0x3d9eb8){const _0x1ef37f=_0x4561b1;if(_0x3d9eb8)return _0x3e394b=_0x3d9eb8[_0x1ef37f('0x67')],typeof _0x85e8d7[_0x1ef37f('0x101')]['includeAll']!=='undefined'&&(_0x38d143[_0x1ef37f('0x10f')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x1ef37f('0x104')],'as':_0x1ef37f('0x145'),'attributes':['id',_0x1ef37f('0xc0'),_0x1ef37f('0xcb')],'where':_0x85e8d7['query'][_0x1ef37f('0xce')]?{'id':_0x85e8d7['query'][_0x1ef37f('0xce')]}:undefined,'required':_0x85e8d7[_0x1ef37f('0x101')][_0x1ef37f('0xce')]?!![]:![]}]),typeof _0x85e8d7['query'][_0x1ef37f('0xaf')]===_0x1ef37f('0x97')&&(_0x38d143[_0x1ef37f('0x121')]=qs[_0x1ef37f('0x121')](_0x85e8d7[_0x1ef37f('0x101')]['limit']),_0x38d143['offset']=qs[_0x1ef37f('0xf3')](_0x85e8d7[_0x1ef37f('0x101')][_0x1ef37f('0xf3')])),_0x397e34[_0x1ef37f('0x9e')](_0x38d143);})['then'](function(_0x137d32){if(_0x137d32)return _0x137d32?{'count':_0x3e394b,'rows':_0x137d32}:null;})['then'](respondWithResult(_0x438636,null))[_0x4561b1('0x87')](handleError(_0x438636,null));},exports[_0x4d238e('0xab')]=function(_0x13ac07,_0x5e2900){const _0x4a5faa=_0x4d238e;let _0x8a4cde,_0x4fc840={},_0x2f4d7a;return db[_0x4a5faa('0x5c')][_0x4a5faa('0x68')]({'where':{'id':_0x13ac07[_0x4a5faa('0x146')]['id']},'attributes':['id',_0x4a5faa('0xc0'),_0x4a5faa('0x14a')]})[_0x4a5faa('0x12f')](handleEntityNotFound(_0x5e2900,null))[_0x4a5faa('0x12f')](function(_0x1c17c1){const _0x487a41=_0x4a5faa;if(!utils[_0x487a41('0xa')](_0x13ac07['query'][_0x487a41('0x9b')]))throw new ValidationError(_0x487a41('0xfc'));_0x8a4cde=_0x1c17c1;const _0x37a275={};_0x37a275[_0x487a41('0x11b')]=_['keys'](db[_[_0x487a41('0xa2')](_0x13ac07['query']['channel'])+_0x487a41('0xe6')][_0x487a41('0xf8')]),_0x37a275[_0x487a41('0x101')]=_['keys'](_0x13ac07[_0x487a41('0x101')]),_0x37a275[_0x487a41('0x4f')]=_[_0x487a41('0x59')](_0x37a275[_0x487a41('0x11b')],_0x37a275['query']),_0x4fc840[_0x487a41('0xb3')]=_['intersection'](_0x37a275[_0x487a41('0x11b')],qs[_0x487a41('0x152')](_0x13ac07[_0x487a41('0x101')][_0x487a41('0x152')])),_0x4fc840[_0x487a41('0xb3')]=_0x4fc840[_0x487a41('0xb3')]['length']?_0x4fc840['attributes']:_0x37a275['model'],_0x4fc840[_0x487a41('0x2c')]=qs[_0x487a41('0x13')](_0x13ac07[_0x487a41('0x101')][_0x487a41('0x13')]),_0x4fc840[_0x487a41('0xe5')]=qs[_0x487a41('0x4f')](_[_0x487a41('0x7b')](_0x13ac07['query'],_0x37a275[_0x487a41('0x4f')]));_0x13ac07[_0x487a41('0x101')][_0x487a41('0x150')]&&(_0x4fc840[_0x487a41('0xe5')]=_[_0x487a41('0x15f')](_0x4fc840[_0x487a41('0xe5')],{[Op['or']]:_[_0x487a41('0xeb')](_0x4fc840[_0x487a41('0xb3')],function(_0x3643b9){const _0x4e572e=_0x487a41,_0x3b97e8={};return _0x3b97e8[_0x3643b9]={[Op[_0x4e572e('0x83')]]:'%'+_0x13ac07[_0x4e572e('0x101')][_0x4e572e('0x150')]+'%'},_0x3b97e8;})}));_0x4fc840=_[_0x487a41('0x15f')]({},_0x4fc840,_0x13ac07['options']);switch(_0x8a4cde[_0x487a41('0x14a')]){case'admin':return db[_['capitalize'](_0x13ac07['query'][_0x487a41('0x9b')])+_0x487a41('0xe6')]['findAll'](_0x4fc840);case'user':case'agent':return _0x8a4cde[_0x487a41('0x14f')+_[_0x487a41('0xa2')](_0x13ac07[_0x487a41('0x101')][_0x487a41('0x9b')])+_0x487a41('0x46')](_0x4fc840);default:throw new ValidationError(_0x487a41('0x8'));}})['then'](function(_0x4daca7){const _0x36005b=_0x4a5faa;_0x2f4d7a=_0x4daca7[_0x36005b('0x67')];typeof _0x13ac07[_0x36005b('0x101')][_0x36005b('0xaf')]==='undefined'&&(_0x4fc840[_0x36005b('0x121')]=qs[_0x36005b('0x121')](_0x13ac07['query'][_0x36005b('0x121')]),_0x4fc840['offset']=qs[_0x36005b('0xf3')](_0x13ac07[_0x36005b('0x101')][_0x36005b('0xf3')]));switch(_0x8a4cde[_0x36005b('0x14a')]){case'admin':return db[_[_0x36005b('0xa2')](_0x13ac07[_0x36005b('0x101')]['channel'])+'Queue'][_0x36005b('0xf5')](_0x4fc840);case _0x36005b('0xb4'):case _0x36005b('0x137'):return _0x8a4cde[_0x36005b('0x14f')+_[_0x36005b('0xa2')](_0x13ac07[_0x36005b('0x101')]['channel'])+_0x36005b('0x46')](_0x4fc840);}})[_0x4a5faa('0x12f')](function(_0x5640a6){return{'count':_0x2f4d7a,'rows':_0x5640a6};})[_0x4a5faa('0x12f')](respondWithResult(_0x5e2900,null))[_0x4a5faa('0x87')](handleError(_0x5e2900,null));},exports[_0x4d238e('0x110')]=function(_0x5c2d4c,_0x183c1e){const _0x224e61=_0x4d238e;let _0x1912d2={};const _0x20e5fb={};let _0x4946b2,_0x12b904;return db[_0x224e61('0x5c')][_0x224e61('0x68')]({'where':{'id':_0x5c2d4c['params']['id']}})[_0x224e61('0x12f')](handleEntityNotFound(_0x183c1e,null))[_0x224e61('0x12f')](function(_0x426adc){const _0xccc4bf=_0x224e61;if(_0x426adc)return _0x4946b2=_0x426adc,_0x20e5fb[_0xccc4bf('0x11b')]=_[_0xccc4bf('0xb6')](db[_0xccc4bf('0x11c')][_0xccc4bf('0xf8')]),_0x20e5fb[_0xccc4bf('0x101')]=_[_0xccc4bf('0xb6')](_0x5c2d4c['query']),_0x20e5fb[_0xccc4bf('0x4f')]=_[_0xccc4bf('0x59')](_0x20e5fb[_0xccc4bf('0x11b')],_0x20e5fb[_0xccc4bf('0x101')]),_0x1912d2[_0xccc4bf('0xb3')]=_['intersection'](_0x20e5fb[_0xccc4bf('0x11b')],qs[_0xccc4bf('0x152')](_0x5c2d4c[_0xccc4bf('0x101')][_0xccc4bf('0x152')])),_0x1912d2[_0xccc4bf('0xb3')]=_0x1912d2[_0xccc4bf('0xb3')]['length']?_0x1912d2[_0xccc4bf('0xb3')]:_0x20e5fb[_0xccc4bf('0x11b')],_0x1912d2['order']=qs[_0xccc4bf('0x13')](_0x5c2d4c[_0xccc4bf('0x101')]['sort']),_0x1912d2[_0xccc4bf('0xe5')]=qs[_0xccc4bf('0x4f')](_[_0xccc4bf('0x7b')](_0x5c2d4c['query'],_0x20e5fb[_0xccc4bf('0x4f')])),_0x5c2d4c[_0xccc4bf('0x101')][_0xccc4bf('0x150')]&&(_0x1912d2[_0xccc4bf('0xe5')]=_[_0xccc4bf('0x15f')](_0x1912d2[_0xccc4bf('0xe5')],{[Op['or']]:_[_0xccc4bf('0xeb')](_0x1912d2['attributes'],function(_0x165f76){const _0x376d09={};return _0x376d09[_0x165f76]={[Op['like']]:'%'+_0x5c2d4c['query']['filter']+'%'},_0x376d09;})})),_0x1912d2=_['merge']({},_0x1912d2,_0x5c2d4c['options']),_0x4946b2['getVoiceQueuesRt'](_0x1912d2);})[_0x224e61('0x12f')](function(_0x4e8a77){const _0x6a86b7=_0x224e61;if(_0x4e8a77)return _0x12b904=_0x4e8a77['length'],typeof _0x5c2d4c[_0x6a86b7('0x101')][_0x6a86b7('0xaf')]===_0x6a86b7('0x97')&&(_0x1912d2[_0x6a86b7('0x121')]=qs[_0x6a86b7('0x121')](_0x5c2d4c['query']['limit']),_0x1912d2[_0x6a86b7('0xf3')]=qs['offset'](_0x5c2d4c[_0x6a86b7('0x101')][_0x6a86b7('0xf3')])),_0x4946b2[_0x6a86b7('0x110')](_0x1912d2);})[_0x224e61('0x12f')](function(_0x14fd35){if(_0x14fd35)return _0x14fd35?{'count':_0x12b904,'rows':_0x14fd35}:null;})[_0x224e61('0x12f')](respondWithResult(_0x183c1e,null))[_0x224e61('0x87')](handleError(_0x183c1e,null));},exports[_0x4d238e('0xdb')]=function(_0x210318,_0x4167ed){const _0x37cac3=_0x4d238e;let _0x41a018={};const _0x2279c8={};let _0x7c0f05,_0x8e9e05;return db[_0x37cac3('0x5c')][_0x37cac3('0x68')]({'where':{'id':_0x210318[_0x37cac3('0x146')]['id']}})[_0x37cac3('0x12f')](handleEntityNotFound(_0x4167ed,null))[_0x37cac3('0x12f')](function(_0x5d79c4){const _0x384295=_0x37cac3;if(_0x5d79c4)return _0x7c0f05=_0x5d79c4,_0x2279c8[_0x384295('0x11b')]=_[_0x384295('0xb6')](db[_0x384295('0xd')][_0x384295('0xf8')]),_0x2279c8[_0x384295('0x101')]=_[_0x384295('0xb6')](_0x210318[_0x384295('0x101')]),_0x2279c8[_0x384295('0x4f')]=_[_0x384295('0x59')](_0x2279c8[_0x384295('0x11b')],_0x2279c8['query']),_0x41a018['attributes']=_[_0x384295('0x59')](_0x2279c8[_0x384295('0x11b')],qs[_0x384295('0x152')](_0x210318[_0x384295('0x101')][_0x384295('0x152')])),_0x41a018[_0x384295('0xb3')]=_0x41a018[_0x384295('0xb3')]['length']?_0x41a018[_0x384295('0xb3')]:_0x2279c8[_0x384295('0x11b')],_0x41a018[_0x384295('0x2c')]=qs[_0x384295('0x13')](_0x210318[_0x384295('0x101')][_0x384295('0x13')]),_0x41a018[_0x384295('0xe5')]=qs[_0x384295('0x4f')](_[_0x384295('0x7b')](_0x210318[_0x384295('0x101')],_0x2279c8[_0x384295('0x4f')])),_0x210318[_0x384295('0x101')][_0x384295('0x150')]&&(_0x41a018[_0x384295('0xe5')]=_['merge'](_0x41a018[_0x384295('0xe5')],{[Op['or']]:_['map'](_0x41a018['attributes'],function(_0x2f214e){const _0x2c5f6e=_0x384295,_0x467b8e={};return _0x467b8e[_0x2f214e]={[Op['like']]:'%'+_0x210318[_0x2c5f6e('0x101')][_0x2c5f6e('0x150')]+'%'},_0x467b8e;})})),_0x41a018=_[_0x384295('0x15f')]({},_0x41a018,_0x210318[_0x384295('0xd2')]),_0x7c0f05['getGroups'](_0x41a018);})['then'](function(_0x1436a9){const _0x325b0d=_0x37cac3;if(_0x1436a9)return _0x8e9e05=_0x1436a9[_0x325b0d('0x67')],typeof _0x210318[_0x325b0d('0x101')][_0x325b0d('0xaf')]===_0x325b0d('0x97')&&(_0x41a018['limit']=qs['limit'](_0x210318['query']['limit']),_0x41a018['offset']=qs[_0x325b0d('0xf3')](_0x210318[_0x325b0d('0x101')][_0x325b0d('0xf3')])),_0x7c0f05[_0x325b0d('0xdb')](_0x41a018);})[_0x37cac3('0x12f')](function(_0x3a6ffc){if(_0x3a6ffc)return _0x3a6ffc?{'count':_0x8e9e05,'rows':_0x3a6ffc}:null;})['then'](respondWithResult(_0x4167ed,null))['catch'](handleError(_0x4167ed,null));},exports[_0x4d238e('0x4d')]=function(_0x478e43,_0x677baa){const _0x236561=_0x4d238e;let _0x2ee62d={'raw':!![],'where':{}};const _0x8cd99a={},_0x2383d3={'count':0x0,'rows':[]};return db[_0x236561('0x5c')]['findOne']({'where':{'id':_0x478e43[_0x236561('0x146')]['id']}})[_0x236561('0x12f')](handleEntityNotFound(_0x677baa,null))['then'](function(_0x40752d){const _0x5004b3=_0x236561;if(_0x40752d)return _0x8cd99a[_0x5004b3('0x11b')]=_[_0x5004b3('0xb6')](db[_0x5004b3('0x96')][_0x5004b3('0xf8')]),_0x8cd99a[_0x5004b3('0x101')]=_[_0x5004b3('0xb6')](_0x478e43[_0x5004b3('0x101')]),_0x8cd99a[_0x5004b3('0x4f')]=_[_0x5004b3('0x59')](_0x8cd99a[_0x5004b3('0x11b')],_0x8cd99a[_0x5004b3('0x101')]),_0x2ee62d['attributes']=_[_0x5004b3('0x59')](_0x8cd99a['model'],qs[_0x5004b3('0x152')](_0x478e43[_0x5004b3('0x101')][_0x5004b3('0x152')])),_0x2ee62d[_0x5004b3('0xb3')]=_0x2ee62d['attributes'][_0x5004b3('0x67')]?_0x2ee62d['attributes']:_0x8cd99a['model'],typeof _0x478e43[_0x5004b3('0x101')]['nolimit']===_0x5004b3('0x97')&&(_0x2ee62d[_0x5004b3('0x121')]=qs[_0x5004b3('0x121')](_0x478e43[_0x5004b3('0x101')][_0x5004b3('0x121')]),_0x2ee62d[_0x5004b3('0xf3')]=qs[_0x5004b3('0xf3')](_0x478e43[_0x5004b3('0x101')][_0x5004b3('0xf3')])),_0x2ee62d[_0x5004b3('0x2c')]=qs[_0x5004b3('0x13')](_0x478e43[_0x5004b3('0x101')][_0x5004b3('0x13')]),_0x2ee62d[_0x5004b3('0xe5')]=qs[_0x5004b3('0x4f')](_[_0x5004b3('0x7b')](_0x478e43[_0x5004b3('0x101')],_0x8cd99a[_0x5004b3('0x4f')])),_0x2ee62d['where'][_0x5004b3('0xdf')]=_0x40752d['id'],_0x478e43[_0x5004b3('0x101')][_0x5004b3('0x150')]&&(_0x2ee62d[_0x5004b3('0xe5')]=_[_0x5004b3('0x15f')](_0x2ee62d['where'],{[Op['or']]:_['map'](_0x2ee62d[_0x5004b3('0xb3')],function(_0x1d42f3){const _0x4a9f21=_0x5004b3,_0x182585={};return _0x182585[_0x1d42f3]={[Op[_0x4a9f21('0x83')]]:'%'+_0x478e43[_0x4a9f21('0x101')]['filter']+'%'},_0x182585;})})),_0x2ee62d=_[_0x5004b3('0x15f')]({},_0x2ee62d,_0x478e43['options']),db[_0x5004b3('0x96')][_0x5004b3('0x113')]({'where':_0x2ee62d[_0x5004b3('0xe5')]})[_0x5004b3('0x12f')](function(_0x48f320){const _0x185907=_0x5004b3;return _0x2383d3['count']=_0x48f320,_0x478e43[_0x185907('0x101')][_0x185907('0xd7')]&&(_0x2ee62d[_0x185907('0x10f')]=[{'all':!![]}]),db['VoiceRecording'][_0x185907('0xf5')](_0x2ee62d);})['then'](function(_0x244d86){const _0xf05afb=_0x5004b3;return _0x2383d3[_0xf05afb('0x2f')]=_0x244d86,_0x2383d3;});})[_0x236561('0x12f')](respondWithFilteredResult(_0x677baa,_0x2ee62d))[_0x236561('0x87')](handleError(_0x677baa,null));},exports['getScreenRecordings']=function(_0x81d3dd,_0x21be00){const _0x1579ae=_0x4d238e;let _0x132d00={'raw':!![],'where':{}};const _0x4fe773={},_0xbe4cf5={'count':0x0,'rows':[]};return db[_0x1579ae('0x5c')][_0x1579ae('0x68')]({'where':{'id':_0x81d3dd[_0x1579ae('0x146')]['id']}})['then'](handleEntityNotFound(_0x21be00,null))[_0x1579ae('0x12f')](function(_0x32e67c){const _0x81a46c=_0x1579ae;if(_0x32e67c)return _0x4fe773[_0x81a46c('0x11b')]=_[_0x81a46c('0xb6')](db[_0x81a46c('0x26')]['rawAttributes']),_0x4fe773['query']=_[_0x81a46c('0xb6')](_0x81d3dd[_0x81a46c('0x101')]),_0x4fe773[_0x81a46c('0x4f')]=_['intersection'](_0x4fe773[_0x81a46c('0x11b')],_0x4fe773[_0x81a46c('0x101')]),_0x132d00[_0x81a46c('0xb3')]=_['intersection'](_0x4fe773['model'],qs[_0x81a46c('0x152')](_0x81d3dd[_0x81a46c('0x101')][_0x81a46c('0x152')])),_0x132d00[_0x81a46c('0xb3')]=_0x132d00[_0x81a46c('0xb3')][_0x81a46c('0x67')]?_0x132d00[_0x81a46c('0xb3')]:_0x4fe773[_0x81a46c('0x11b')],typeof _0x81d3dd[_0x81a46c('0x101')]['nolimit']===_0x81a46c('0x97')&&(_0x132d00[_0x81a46c('0x121')]=qs[_0x81a46c('0x121')](_0x81d3dd['query'][_0x81a46c('0x121')]),_0x132d00[_0x81a46c('0xf3')]=qs[_0x81a46c('0xf3')](_0x81d3dd[_0x81a46c('0x101')][_0x81a46c('0xf3')])),_0x132d00['order']=qs[_0x81a46c('0x13')](_0x81d3dd['query'][_0x81a46c('0x13')]),_0x132d00['where']=qs[_0x81a46c('0x4f')](_['pick'](_0x81d3dd[_0x81a46c('0x101')],_0x4fe773[_0x81a46c('0x4f')])),_0x132d00['where']['UserId']=_0x32e67c['id'],_0x81d3dd[_0x81a46c('0x101')][_0x81a46c('0x150')]&&(_0x132d00['where']=_[_0x81a46c('0x15f')](_0x132d00[_0x81a46c('0xe5')],{[Op['or']]:_[_0x81a46c('0xeb')](_0x132d00['attributes'],function(_0x1813c7){const _0x414dac=_0x81a46c,_0x260262={};return _0x260262[_0x1813c7]={[Op[_0x414dac('0x83')]]:'%'+_0x81d3dd[_0x414dac('0x101')][_0x414dac('0x150')]+'%'},_0x260262;})})),_0x132d00=_[_0x81a46c('0x15f')]({},_0x132d00,_0x81d3dd[_0x81a46c('0xd2')]),db['ScreenRecording']['count']({'where':_0x132d00[_0x81a46c('0xe5')]})[_0x81a46c('0x12f')](function(_0x218a30){const _0x4abc56=_0x81a46c;return _0xbe4cf5[_0x4abc56('0x113')]=_0x218a30,_0x81d3dd[_0x4abc56('0x101')]['includeAll']&&(_0x132d00[_0x4abc56('0x10f')]=[{'all':!![]}]),db[_0x4abc56('0x26')][_0x4abc56('0xf5')](_0x132d00);})[_0x81a46c('0x12f')](function(_0x399829){const _0x3af1eb=_0x81a46c;return _0xbe4cf5[_0x3af1eb('0x2f')]=_0x399829,_0xbe4cf5;});})[_0x1579ae('0x12f')](respondWithFilteredResult(_0x21be00,_0x132d00))['catch'](handleError(_0x21be00,null));},exports[_0x4d238e('0x86')]=function(_0x189e65,_0x1d20c6){const _0x2e7811=_0x4d238e;let _0x5cc86d={};const _0x43dbe9={};let _0x442ac9,_0x4ae03f;return db['User'][_0x2e7811('0x68')]({'where':{'id':_0x189e65['params']['id']}})[_0x2e7811('0x12f')](handleEntityNotFound(_0x1d20c6,null))[_0x2e7811('0x12f')](function(_0x9a66f6){const _0x2b5297=_0x2e7811;if(_0x9a66f6)return _0x442ac9=_0x9a66f6,_0x43dbe9[_0x2b5297('0x11b')]=_[_0x2b5297('0xb6')](db[_0x2b5297('0x36')][_0x2b5297('0xf8')]),_0x43dbe9['query']=_[_0x2b5297('0xb6')](_0x189e65['query']),_0x43dbe9[_0x2b5297('0x4f')]=_['intersection'](_0x43dbe9['model'],_0x43dbe9[_0x2b5297('0x101')]),_0x5cc86d[_0x2b5297('0xb3')]=_[_0x2b5297('0x59')](_0x43dbe9[_0x2b5297('0x11b')],qs[_0x2b5297('0x152')](_0x189e65[_0x2b5297('0x101')]['fields'])),_0x5cc86d[_0x2b5297('0xb3')]=_0x5cc86d['attributes']['length']?_0x5cc86d[_0x2b5297('0xb3')]:_0x43dbe9[_0x2b5297('0x11b')],_0x5cc86d[_0x2b5297('0x2c')]=qs[_0x2b5297('0x13')](_0x189e65['query'][_0x2b5297('0x13')]),_0x5cc86d['where']=qs[_0x2b5297('0x4f')](_[_0x2b5297('0x7b')](_0x189e65['query'],_0x43dbe9[_0x2b5297('0x4f')])),_0x189e65[_0x2b5297('0x101')][_0x2b5297('0x150')]&&(_0x5cc86d[_0x2b5297('0xe5')]=_[_0x2b5297('0x15f')](_0x5cc86d[_0x2b5297('0xe5')],{[Op['or']]:_[_0x2b5297('0xeb')](_0x5cc86d['attributes'],function(_0x566aa2){const _0x17a630=_0x2b5297,_0x42db43={};return _0x42db43[_0x566aa2]={[Op[_0x17a630('0x83')]]:'%'+_0x189e65[_0x17a630('0x101')][_0x17a630('0x150')]+'%'},_0x42db43;})})),_0x5cc86d=_[_0x2b5297('0x15f')]({},_0x5cc86d,_0x189e65[_0x2b5297('0xd2')]),_0x442ac9[_0x2b5297('0x86')](_0x5cc86d);})[_0x2e7811('0x12f')](function(_0x341c49){const _0x199eef=_0x2e7811;if(_0x341c49)return _0x4ae03f=_0x341c49[_0x199eef('0x67')],typeof _0x189e65[_0x199eef('0x101')]['nolimit']===_0x199eef('0x97')&&(_0x5cc86d[_0x199eef('0x121')]=qs[_0x199eef('0x121')](_0x189e65['query'][_0x199eef('0x121')]),_0x5cc86d[_0x199eef('0xf3')]=qs['offset'](_0x189e65[_0x199eef('0x101')][_0x199eef('0xf3')])),_0x442ac9['getChatInteractions'](_0x5cc86d);})[_0x2e7811('0x12f')](function(_0x59bb64){if(_0x59bb64)return _0x59bb64?{'count':_0x4ae03f,'rows':_0x59bb64}:null;})[_0x2e7811('0x12f')](respondWithResult(_0x1d20c6,null))[_0x2e7811('0x87')](handleError(_0x1d20c6,null));},exports[_0x4d238e('0x8c')]=function(_0x1cbfe0,_0x31ed9e){const _0x2328e5=_0x4d238e;let _0x315732={};const _0x164512={};let _0x275840,_0x422e3e;return db[_0x2328e5('0x5c')][_0x2328e5('0x68')]({'where':{'id':_0x1cbfe0[_0x2328e5('0x146')]['id']}})[_0x2328e5('0x12f')](handleEntityNotFound(_0x31ed9e,null))[_0x2328e5('0x12f')](function(_0x59e594){const _0xa99ceb=_0x2328e5;if(_0x59e594)return _0x275840=_0x59e594,_0x164512[_0xa99ceb('0x11b')]=_[_0xa99ceb('0xb6')](db[_0xa99ceb('0x7e')]['rawAttributes']),_0x164512[_0xa99ceb('0x101')]=_[_0xa99ceb('0xb6')](_0x1cbfe0[_0xa99ceb('0x101')]),_0x164512['filters']=_['intersection'](_0x164512[_0xa99ceb('0x11b')],_0x164512[_0xa99ceb('0x101')]),_0x315732[_0xa99ceb('0xb3')]=_[_0xa99ceb('0x59')](_0x164512[_0xa99ceb('0x11b')],qs[_0xa99ceb('0x152')](_0x1cbfe0[_0xa99ceb('0x101')][_0xa99ceb('0x152')])),_0x315732[_0xa99ceb('0xb3')]=_0x315732[_0xa99ceb('0xb3')]['length']?_0x315732['attributes']:_0x164512[_0xa99ceb('0x11b')],_0x315732['order']=qs[_0xa99ceb('0x13')](_0x1cbfe0[_0xa99ceb('0x101')]['sort']),_0x315732[_0xa99ceb('0xe5')]=qs[_0xa99ceb('0x4f')](_[_0xa99ceb('0x7b')](_0x1cbfe0[_0xa99ceb('0x101')],_0x164512['filters'])),_0x1cbfe0[_0xa99ceb('0x101')][_0xa99ceb('0x150')]&&(_0x315732['where']=_[_0xa99ceb('0x15f')](_0x315732[_0xa99ceb('0xe5')],{[Op['or']]:_[_0xa99ceb('0xeb')](_0x315732[_0xa99ceb('0xb3')],function(_0x27dc0e){const _0x18780b=_0xa99ceb,_0x3360f3={};return _0x3360f3[_0x27dc0e]={[Op['like']]:'%'+_0x1cbfe0[_0x18780b('0x101')][_0x18780b('0x150')]+'%'},_0x3360f3;})})),_0x315732=_['merge']({},_0x315732,_0x1cbfe0[_0xa99ceb('0xd2')]),_0x275840[_0xa99ceb('0x8c')](_0x315732);})[_0x2328e5('0x12f')](function(_0x25b1f2){const _0x586834=_0x2328e5;if(_0x25b1f2)return _0x422e3e=_0x25b1f2['length'],typeof _0x1cbfe0[_0x586834('0x101')]['nolimit']===_0x586834('0x97')&&(_0x315732[_0x586834('0x121')]=qs[_0x586834('0x121')](_0x1cbfe0[_0x586834('0x101')][_0x586834('0x121')]),_0x315732[_0x586834('0xf3')]=qs[_0x586834('0xf3')](_0x1cbfe0[_0x586834('0x101')][_0x586834('0xf3')])),_0x275840[_0x586834('0x8c')](_0x315732);})[_0x2328e5('0x12f')](function(_0x293516){if(_0x293516)return _0x293516?{'count':_0x422e3e,'rows':_0x293516}:null;})[_0x2328e5('0x12f')](respondWithResult(_0x31ed9e,null))[_0x2328e5('0x87')](handleError(_0x31ed9e,null));},exports[_0x4d238e('0x4e')]=function(_0x4731a0,_0x11ceae){const _0x809f51=_0x4d238e;let _0x43043d={'raw':!![],'where':{}};const _0x23cf7e={},_0x3877e7={'count':0x0,'rows':[]};return db[_0x809f51('0x5c')]['findOne']({'where':{'id':_0x4731a0['params']['id']}})[_0x809f51('0x12f')](handleEntityNotFound(_0x11ceae,null))[_0x809f51('0x12f')](function(_0x48d7a8){const _0x3b8a2d=_0x809f51;if(_0x48d7a8)return _0x23cf7e['model']=_['keys'](db['MailInteraction'][_0x3b8a2d('0xf8')]),_0x23cf7e[_0x3b8a2d('0x101')]=_[_0x3b8a2d('0xb6')](_0x4731a0[_0x3b8a2d('0x101')]),_0x23cf7e[_0x3b8a2d('0x4f')]=_[_0x3b8a2d('0x59')](_0x23cf7e[_0x3b8a2d('0x11b')],_0x23cf7e['query']),_0x43043d['attributes']=_[_0x3b8a2d('0x59')](_0x23cf7e[_0x3b8a2d('0x11b')],qs[_0x3b8a2d('0x152')](_0x4731a0[_0x3b8a2d('0x101')][_0x3b8a2d('0x152')])),_0x43043d[_0x3b8a2d('0xb3')]=_0x43043d[_0x3b8a2d('0xb3')][_0x3b8a2d('0x67')]?_0x43043d[_0x3b8a2d('0xb3')]:_0x23cf7e[_0x3b8a2d('0x11b')],typeof _0x4731a0[_0x3b8a2d('0x101')][_0x3b8a2d('0xaf')]===_0x3b8a2d('0x97')&&(_0x43043d[_0x3b8a2d('0x121')]=qs[_0x3b8a2d('0x121')](_0x4731a0[_0x3b8a2d('0x101')]['limit']),_0x43043d[_0x3b8a2d('0xf3')]=qs['offset'](_0x4731a0[_0x3b8a2d('0x101')][_0x3b8a2d('0xf3')])),_0x43043d[_0x3b8a2d('0x2c')]=qs[_0x3b8a2d('0x13')](_0x4731a0[_0x3b8a2d('0x101')][_0x3b8a2d('0x13')]),_0x43043d[_0x3b8a2d('0xe5')]=qs[_0x3b8a2d('0x4f')](_[_0x3b8a2d('0x7b')](_0x4731a0['query'],_0x23cf7e[_0x3b8a2d('0x4f')])),_0x43043d[_0x3b8a2d('0xe5')][_0x3b8a2d('0xdf')]=_0x48d7a8['id'],_0x4731a0[_0x3b8a2d('0x101')][_0x3b8a2d('0x150')]&&(_0x43043d[_0x3b8a2d('0xe5')]=_[_0x3b8a2d('0x15f')](_0x43043d['where'],{[Op['or']]:_[_0x3b8a2d('0xeb')](_0x43043d[_0x3b8a2d('0xb3')],function(_0x2e4bb0){const _0x49cc92=_0x3b8a2d,_0xce706={};return _0xce706[_0x2e4bb0]={[Op[_0x49cc92('0x83')]]:'%'+_0x4731a0['query']['filter']+'%'},_0xce706;})})),_0x43043d=_[_0x3b8a2d('0x15f')]({},_0x43043d,_0x4731a0[_0x3b8a2d('0xd2')]),db[_0x3b8a2d('0xd8')][_0x3b8a2d('0x113')]({'where':_0x43043d[_0x3b8a2d('0xe5')]})[_0x3b8a2d('0x12f')](function(_0x25f4b6){const _0x546b66=_0x3b8a2d;return _0x3877e7[_0x546b66('0x113')]=_0x25f4b6,_0x4731a0['query']['includeAll']&&(_0x43043d[_0x546b66('0x10f')]=[{'all':!![]}]),db['MailInteraction'][_0x546b66('0xf5')](_0x43043d);})[_0x3b8a2d('0x12f')](function(_0x1b62dd){const _0x14dfcf=_0x3b8a2d;return _0x3877e7[_0x14dfcf('0x2f')]=_0x1b62dd,_0x3877e7;});})[_0x809f51('0x12f')](respondWithFilteredResult(_0x11ceae,_0x43043d))['catch'](handleError(_0x11ceae,null));},exports[_0x4d238e('0x135')]=function(_0x43126,_0x412874){const _0x104ea1=_0x4d238e;let _0x300d5a={};const _0x4daff3={};let _0x1e812e,_0x288ce4;return db[_0x104ea1('0x5c')][_0x104ea1('0x68')]({'where':{'id':_0x43126[_0x104ea1('0x146')]['id']}})[_0x104ea1('0x12f')](handleEntityNotFound(_0x412874,null))['then'](function(_0x2811de){const _0x5f467b=_0x104ea1;if(_0x2811de)return _0x1e812e=_0x2811de,_0x4daff3['model']=_[_0x5f467b('0xb6')](db['SmsInteraction'][_0x5f467b('0xf8')]),_0x4daff3[_0x5f467b('0x101')]=_[_0x5f467b('0xb6')](_0x43126['query']),_0x4daff3['filters']=_[_0x5f467b('0x59')](_0x4daff3[_0x5f467b('0x11b')],_0x4daff3['query']),_0x300d5a[_0x5f467b('0xb3')]=_[_0x5f467b('0x59')](_0x4daff3[_0x5f467b('0x11b')],qs['fields'](_0x43126[_0x5f467b('0x101')][_0x5f467b('0x152')])),_0x300d5a[_0x5f467b('0xb3')]=_0x300d5a[_0x5f467b('0xb3')]['length']?_0x300d5a[_0x5f467b('0xb3')]:_0x4daff3[_0x5f467b('0x11b')],_0x300d5a[_0x5f467b('0x2c')]=qs[_0x5f467b('0x13')](_0x43126[_0x5f467b('0x101')][_0x5f467b('0x13')]),_0x300d5a[_0x5f467b('0xe5')]=qs['filters'](_[_0x5f467b('0x7b')](_0x43126[_0x5f467b('0x101')],_0x4daff3[_0x5f467b('0x4f')])),_0x43126[_0x5f467b('0x101')][_0x5f467b('0x150')]&&(_0x300d5a['where']=_[_0x5f467b('0x15f')](_0x300d5a[_0x5f467b('0xe5')],{[Op['or']]:_[_0x5f467b('0xeb')](_0x300d5a[_0x5f467b('0xb3')],function(_0x392e9a){const _0x380904=_0x5f467b,_0x5ccdd0={};return _0x5ccdd0[_0x392e9a]={[Op['like']]:'%'+_0x43126['query'][_0x380904('0x150')]+'%'},_0x5ccdd0;})})),_0x300d5a=_[_0x5f467b('0x15f')]({},_0x300d5a,_0x43126[_0x5f467b('0xd2')]),_0x1e812e[_0x5f467b('0x135')](_0x300d5a);})[_0x104ea1('0x12f')](function(_0x184c03){const _0x441fe2=_0x104ea1;if(_0x184c03)return _0x288ce4=_0x184c03[_0x441fe2('0x67')],typeof _0x43126[_0x441fe2('0x101')]['nolimit']==='undefined'&&(_0x300d5a[_0x441fe2('0x121')]=qs['limit'](_0x43126[_0x441fe2('0x101')][_0x441fe2('0x121')]),_0x300d5a[_0x441fe2('0xf3')]=qs[_0x441fe2('0xf3')](_0x43126['query']['offset'])),_0x1e812e['getSmsInteractions'](_0x300d5a);})['then'](function(_0xd70d91){if(_0xd70d91)return _0xd70d91?{'count':_0x288ce4,'rows':_0xd70d91}:null;})[_0x104ea1('0x12f')](respondWithResult(_0x412874,null))[_0x104ea1('0x87')](handleError(_0x412874,null));},exports[_0x4d238e('0x91')]=function(_0x1c84ab,_0x2ded77){const _0x15b5d3=_0x4d238e;let _0x18e814={};const _0x5f08a0={};let _0x5f4c5d,_0x327276;return db[_0x15b5d3('0x5c')][_0x15b5d3('0x68')]({'where':{'id':_0x1c84ab[_0x15b5d3('0x146')]['id']}})['then'](handleEntityNotFound(_0x2ded77,null))[_0x15b5d3('0x12f')](function(_0x1f2a06){const _0x29bb12=_0x15b5d3;if(_0x1f2a06)return _0x5f4c5d=_0x1f2a06,_0x5f08a0[_0x29bb12('0x11b')]=_[_0x29bb12('0xb6')](db['FaxInteraction']['rawAttributes']),_0x5f08a0[_0x29bb12('0x101')]=_[_0x29bb12('0xb6')](_0x1c84ab['query']),_0x5f08a0[_0x29bb12('0x4f')]=_['intersection'](_0x5f08a0['model'],_0x5f08a0[_0x29bb12('0x101')]),_0x18e814[_0x29bb12('0xb3')]=_[_0x29bb12('0x59')](_0x5f08a0['model'],qs[_0x29bb12('0x152')](_0x1c84ab[_0x29bb12('0x101')][_0x29bb12('0x152')])),_0x18e814['attributes']=_0x18e814[_0x29bb12('0xb3')]['length']?_0x18e814[_0x29bb12('0xb3')]:_0x5f08a0[_0x29bb12('0x11b')],_0x18e814['order']=qs[_0x29bb12('0x13')](_0x1c84ab[_0x29bb12('0x101')][_0x29bb12('0x13')]),_0x18e814[_0x29bb12('0xe5')]=qs[_0x29bb12('0x4f')](_['pick'](_0x1c84ab[_0x29bb12('0x101')],_0x5f08a0['filters'])),_0x1c84ab[_0x29bb12('0x101')][_0x29bb12('0x150')]&&(_0x18e814[_0x29bb12('0xe5')]=_['merge'](_0x18e814['where'],{[Op['or']]:_['map'](_0x18e814['attributes'],function(_0x1e3daa){const _0x57c508=_0x29bb12,_0x2f05ec={};return _0x2f05ec[_0x1e3daa]={[Op[_0x57c508('0x83')]]:'%'+_0x1c84ab[_0x57c508('0x101')][_0x57c508('0x150')]+'%'},_0x2f05ec;})})),_0x18e814=_[_0x29bb12('0x15f')]({},_0x18e814,_0x1c84ab[_0x29bb12('0xd2')]),_0x5f4c5d['getFaxInteractions'](_0x18e814);})[_0x15b5d3('0x12f')](function(_0x1b8610){const _0x548a2f=_0x15b5d3;if(_0x1b8610)return _0x327276=_0x1b8610[_0x548a2f('0x67')],typeof _0x1c84ab['query'][_0x548a2f('0xaf')]===_0x548a2f('0x97')&&(_0x18e814[_0x548a2f('0x121')]=qs[_0x548a2f('0x121')](_0x1c84ab['query'][_0x548a2f('0x121')]),_0x18e814[_0x548a2f('0xf3')]=qs[_0x548a2f('0xf3')](_0x1c84ab[_0x548a2f('0x101')][_0x548a2f('0xf3')])),_0x5f4c5d[_0x548a2f('0x91')](_0x18e814);})['then'](function(_0x33dfcf){if(_0x33dfcf)return _0x33dfcf?{'count':_0x327276,'rows':_0x33dfcf}:null;})[_0x15b5d3('0x12f')](respondWithResult(_0x2ded77,null))[_0x15b5d3('0x87')](handleError(_0x2ded77,null));},exports[_0x4d238e('0x79')]=function(_0x7d607,_0x4d5f89){const _0xcc5af7=_0x4d238e;let _0x16d555={};const _0x4693ce={};let _0x384c5b,_0x55311f;return db[_0xcc5af7('0x5c')][_0xcc5af7('0x68')]({'where':{'id':_0x7d607[_0xcc5af7('0x146')]['id']}})[_0xcc5af7('0x12f')](handleEntityNotFound(_0x4d5f89,null))['then'](function(_0x1dda67){const _0x2247de=_0xcc5af7;if(_0x1dda67)return _0x384c5b=_0x1dda67,_0x4693ce[_0x2247de('0x11b')]=_[_0x2247de('0xb6')](db[_0x2247de('0x73')]['rawAttributes']),_0x4693ce[_0x2247de('0x101')]=_[_0x2247de('0xb6')](_0x7d607['query']),_0x4693ce[_0x2247de('0x4f')]=_[_0x2247de('0x59')](_0x4693ce[_0x2247de('0x11b')],_0x4693ce[_0x2247de('0x101')]),_0x16d555['attributes']=_[_0x2247de('0x59')](_0x4693ce[_0x2247de('0x11b')],qs[_0x2247de('0x152')](_0x7d607['query'][_0x2247de('0x152')])),_0x16d555[_0x2247de('0xb3')]=_0x16d555[_0x2247de('0xb3')][_0x2247de('0x67')]?_0x16d555[_0x2247de('0xb3')]:_0x4693ce['model'],_0x16d555[_0x2247de('0x2c')]=qs[_0x2247de('0x13')](_0x7d607[_0x2247de('0x101')][_0x2247de('0x13')]),_0x16d555['where']=qs[_0x2247de('0x4f')](_['pick'](_0x7d607[_0x2247de('0x101')],_0x4693ce[_0x2247de('0x4f')])),_0x7d607[_0x2247de('0x101')][_0x2247de('0x150')]&&(_0x16d555[_0x2247de('0xe5')]=_[_0x2247de('0x15f')](_0x16d555[_0x2247de('0xe5')],{[Op['or']]:_[_0x2247de('0xeb')](_0x16d555[_0x2247de('0xb3')],function(_0x4c654d){const _0x57a1f0=_0x2247de,_0x2f4aff={};return _0x2f4aff[_0x4c654d]={[Op[_0x57a1f0('0x83')]]:'%'+_0x7d607[_0x57a1f0('0x101')][_0x57a1f0('0x150')]+'%'},_0x2f4aff;})})),_0x16d555=_[_0x2247de('0x15f')]({},_0x16d555,_0x7d607[_0x2247de('0xd2')]),_0x384c5b['getWhatsappInteractions'](_0x16d555);})[_0xcc5af7('0x12f')](function(_0x33e2c6){const _0x52511f=_0xcc5af7;if(_0x33e2c6)return _0x55311f=_0x33e2c6['length'],typeof _0x7d607[_0x52511f('0x101')][_0x52511f('0xaf')]===_0x52511f('0x97')&&(_0x16d555[_0x52511f('0x121')]=qs[_0x52511f('0x121')](_0x7d607[_0x52511f('0x101')][_0x52511f('0x121')]),_0x16d555[_0x52511f('0xf3')]=qs[_0x52511f('0xf3')](_0x7d607['query'][_0x52511f('0xf3')])),_0x384c5b[_0x52511f('0x79')](_0x16d555);})[_0xcc5af7('0x12f')](function(_0x917314){if(_0x917314)return _0x917314?{'count':_0x55311f,'rows':_0x917314}:null;})[_0xcc5af7('0x12f')](respondWithResult(_0x4d5f89,null))[_0xcc5af7('0x87')](handleError(_0x4d5f89,null));},exports[_0x4d238e('0xa1')]=function(_0x5d978a,_0x108c5e,_0x36b188){const _0x3d9351=_0x4d238e;let _0x33efe2,_0x16ba1e,_0x22c953;const _0x368ab2=!_['isNil'](_0x5d978a['params']['id'])?_0x5d978a[_0x3d9351('0x146')]['id']:!_[_0x3d9351('0x12')](_0x5d978a[_0x3d9351('0xb4')]['id'])?_0x5d978a[_0x3d9351('0xb4')]['id']:null;return db[_0x3d9351('0x5c')][_0x3d9351('0x68')]({'where':{'id':_0x368ab2,'role':{[Op['or']]:[_0x3d9351('0x33'),_0x3d9351('0xb4'),'agent']}},'attributes':['id','name',_0x3d9351('0x107'),_0x3d9351('0x30'),_0x3d9351('0x14a'),'internal',_0x3d9351('0x7')]})[_0x3d9351('0x12f')](function(_0x4b16c6){const _0x1b0cef=_0x3d9351;if(_0x4b16c6){if(_0x4b16c6[_0x1b0cef('0x14a')]===_0x1b0cef('0x137')){_0x33efe2=_0x4b16c6;if(_0x5d978a['body'][_0x1b0cef('0xf0')])_0x22c953=util[_0x1b0cef('0xe3')](_0x1b0cef('0x12a'),_0x33efe2[_0x5d978a[_0x1b0cef('0x39')][_0x1b0cef('0xf0')]]);else _0x5d978a[_0x1b0cef('0x39')][_0x1b0cef('0x139')]?_0x22c953=util[_0x1b0cef('0xe3')](_0x1b0cef('0x3b'),_0x5d978a['body'][_0x1b0cef('0x139')]):_0x22c953=util[_0x1b0cef('0xe3')](_0x1b0cef('0x3b'),_0x33efe2[_0x1b0cef('0xc0')]);return socket['to'](util[_0x1b0cef('0xe3')](_0x1b0cef('0xe8'),_0x33efe2[_0x1b0cef('0xc0')]))[_0x1b0cef('0x12c')](_0x1b0cef('0x9f'),{'ip':_0x5d978a[_0x1b0cef('0x65')]['x-forwarded-for']||_0x5d978a['connection']['remoteAddress']||_0x5d978a[_0x1b0cef('0x71')][_0x1b0cef('0xc2')]||_0x5d978a['connection']['socket'][_0x1b0cef('0xc2')]}),db['UserVoiceQueueRt'][_0x1b0cef('0x8e')]({'where':{'membername':_0x33efe2[_0x1b0cef('0xc0')]},'individualHooks':!![]});}}else throw new ValidationError('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');})['then'](function(){const _0x5dd1fb=_0x3d9351;if(_0x33efe2)return _0x33efe2[_0x5dd1fb('0xc7')]({'raw':!![]});})[_0x3d9351('0x12f')](function(_0x599a42){const _0x2e4b49=_0x3d9351;if(_0x33efe2){if(_0x599a42){_0x16ba1e=_0x599a42;if(_0x16ba1e[_0x2e4b49('0x67')]){const _0x177bd2=_0x16ba1e['map'](_0x26d11b=>{const _0x1400d1=_0x2e4b49,_0x23b2c1={'membername':_0x33efe2[_0x1400d1('0xc0')],'UserId':_0x33efe2['id'],'queue_name':_0x26d11b[_0x1400d1('0xc0')],'VoiceQueueId':_0x26d11b['id'],'interface':_0x22c953,'paused':_0x33efe2[_0x1400d1('0x7')]||![],'penalty':_0x26d11b[_0x1400d1('0x74')]||0x0};return db[_0x1400d1('0x11c')][_0x1400d1('0x10')](_0x23b2c1);});return Promise[_0x2e4b49('0x1f')](_0x177bd2);}}}})[_0x3d9351('0x12f')](function(){const _0x1f9739=_0x3d9351;if(_0x33efe2)return db[_0x1f9739('0x6e')]['findAll']({'where':{'membername':_0x33efe2['name'],'exitAt':null}});})['then'](function(_0x5476f9){const _0x4064b0=_0x3d9351;if(_0x33efe2){const _0x59dfb7=[];return _0x5476f9[_0x4064b0('0x10d')](function(_0x54226d){const _0xf917d8=_0x4064b0;_0x59dfb7[_0xf917d8('0x15d')](_0x54226d['update']({'exitAt':moment()[_0xf917d8('0xe3')](_0xf917d8('0x76'))}));}),Promise['all'](_0x59dfb7);}})[_0x3d9351('0x12f')](function(){const _0xb30143=_0x3d9351;if(_0x33efe2){const _0x76e42f=[],_0x39884f=[],_0x24b57f=utils['getChannels'](),_0x781619={'membername':_0x33efe2[_0xb30143('0xc0')],'interface':_0x22c953,'enterAt':moment()['format'](_0xb30143('0x76')),'role':_0x33efe2['role'],'internal':_0x33efe2[_0xb30143('0xed')]};return _0x24b57f['forEach'](function(_0x1e28dd){const _0x59efde=_0xb30143;_0x76e42f[_0x59efde('0x15d')](_[_0x59efde('0x15f')]({'channel':_0x1e28dd,'type':_0x59efde('0x56'),'data1':_0x5d978a[_0x59efde('0x39')][_0x59efde('0xcf')],'data2':_0x22c953},_0x781619)),_0x33efe2['loginInPause']&&_0x39884f[_0x59efde('0x15d')](_[_0x59efde('0x15f')]({'channel':_0x1e28dd,'type':'PAUSE','data1':_0x59efde('0x5f')},_0x781619));}),db['MemberReport'][_0xb30143('0x58')](_0x76e42f[_0xb30143('0x15a')](_0x39884f),{'individualHooks':!![]});}})[_0x3d9351('0x12f')](function(){const _0x3cd85c=_0x3d9351;if(_0x33efe2)return _0x33efe2['update']({'online':!![],'lastLoginAt':moment()[_0x3cd85c('0xe3')](_0x3cd85c('0x76')),'voicePause':_0x33efe2[_0x3cd85c('0x7')]||![],'mailPause':_0x33efe2[_0x3cd85c('0x7')]||![],'chatPause':_0x33efe2['loginInPause']||![],'faxPause':_0x33efe2[_0x3cd85c('0x7')]||![],'smsPause':_0x33efe2[_0x3cd85c('0x7')]||![],'openchannelPause':_0x33efe2[_0x3cd85c('0x7')]||![],'whatsappPause':_0x33efe2[_0x3cd85c('0x7')]||![],'pauseType':_0x33efe2[_0x3cd85c('0x7')]?_0x3cd85c('0x5f'):null,'interface':_0x22c953,'lastPauseAt':moment()[_0x3cd85c('0xe3')](_0x3cd85c('0x76'))});})[_0x3d9351('0x12f')](function(_0x24ccb2){const _0x3df2e6=_0x3d9351;return _0x5d978a['isMiddleware']?_0x36b188():Promise['resolve'](_0x24ccb2)[_0x3df2e6('0x12f')](respondWithResult(_0x108c5e,null));})[_0x3d9351('0x87')](handleError(_0x108c5e,null));},exports['logout']=function(_0x147155,_0x5618fd){const _0x570c53=_0x4d238e;let _0x65f0d8;return db['User'][_0x570c53('0x68')]({'where':{'id':_0x147155[_0x570c53('0x146')]['id'],'role':_0x570c53('0x137')},'attributes':['id','name',_0x570c53('0x14a')]})[_0x570c53('0x12f')](handleEntityNotFound(_0x5618fd,null))['then'](function(_0x53477f){const _0x15fd71=_0x570c53;if(_0x53477f)return _0x65f0d8=_0x53477f,db[_0x15fd71('0x11c')][_0x15fd71('0x8e')]({'where':{'membername':_0x65f0d8[_0x15fd71('0xc0')]},'individualHooks':!![]});})['then'](function(){const _0x5aee09=_0x570c53;return db[_0x5aee09('0x6e')][_0x5aee09('0xf5')]({'where':{'membername':_0x65f0d8[_0x5aee09('0xc0')],'exitAt':null}});})[_0x570c53('0x12f')](function(_0x25b922){const _0x2b0260=_0x570c53,_0x4e46f1=[];return _0x25b922[_0x2b0260('0x10d')](function(_0x2c5146){const _0x33065f=_0x2b0260;_0x4e46f1[_0x33065f('0x15d')](_0x2c5146[_0x33065f('0x13a')]({'exitAt':moment()[_0x33065f('0xe3')](_0x33065f('0x76'))}));}),Promise[_0x2b0260('0x1f')](_0x4e46f1);})[_0x570c53('0x12f')](function(){const _0x4e387f=_0x570c53;return _0x65f0d8[_0x4e387f('0x13a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x570c53('0x12f')](respondWithResult(_0x5618fd,null))[_0x570c53('0x87')](handleError(_0x5618fd,null));},exports[_0x4d238e('0x136')]=function(_0x100603,_0x4f9dd2){const _0x141211=_0x4d238e;let _0x5e9cd5;return db[_0x141211('0x11c')][_0x141211('0x13a')]({'paused':0x1},{'where':{'UserId':_0x100603[_0x141211('0x146')]['id']},'individualHooks':!![]})[_0x141211('0x12f')](function(){const _0x1adf9e=_0x141211;return db[_0x1adf9e('0x5c')][_0x1adf9e('0x68')]({'where':{'id':_0x100603[_0x1adf9e('0x146')]['id'],'role':'agent'},'attributes':['id','name','role',_0x1adf9e('0xed'),_0x1adf9e('0xf0')]});})[_0x141211('0x12f')](handleEntityNotFound(_0x4f9dd2,null))[_0x141211('0x12f')](function(_0x4350ba){const _0x19bcc3=_0x141211;if(_0x4350ba)return _0x5e9cd5=_0x4350ba,respondWithRpcPromise(_0x19bcc3('0x108'),'pause',{'id':_0x5e9cd5['id'],'name':_0x5e9cd5['name'],'pause':!![]});})['then'](function(){const _0x1a4f93=_0x141211;if(_0x5e9cd5)return db[_0x1a4f93('0x6e')][_0x1a4f93('0xf5')]({'where':{'membername':_0x5e9cd5[_0x1a4f93('0xc0')],'type':_0x1a4f93('0x6b'),'exitAt':null}});})['then'](function(_0x197320){const _0x146fe1=_0x141211;if(_0x197320[_0x146fe1('0x67')]){const _0x32b3a7=moment()[_0x146fe1('0xe3')](_0x146fe1('0x76'));for(let _0x483183=0x0,_0x5d4150=_0x197320[_0x146fe1('0x67')];_0x483183<_0x5d4150;_0x483183++){_0x197320[_0x483183][_0x146fe1('0x13a')]({'exitAt':_0x32b3a7});}}})[_0x141211('0x12f')](function(){const _0x2aebe6=_0x141211,_0x31d094=[],_0x11046a=utils[_0x2aebe6('0xc8')]();return _0x11046a[_0x2aebe6('0x10d')](function(_0x23b3b7){const _0x5833fe=_0x2aebe6;_0x31d094['push']({'channel':_0x23b3b7,'membername':_0x5e9cd5[_0x5833fe('0xc0')],'interface':_['isNil'](_0x5e9cd5[_0x5833fe('0xf0')])?util['format']('SIP/%s',_0x5e9cd5[_0x5833fe('0xc0')]):_0x5e9cd5[_0x5833fe('0xf0')],'type':'PAUSE','enterAt':moment()[_0x5833fe('0xe3')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x100603[_0x5833fe('0x39')][_0x5833fe('0x1a')]||'DEFAULT\x20PAUSE','role':_0x5e9cd5[_0x5833fe('0x14a')],'internal':_0x5e9cd5['internal']});}),db['MemberReport'][_0x2aebe6('0x58')](_0x31d094,{'individualHooks':!![]});})[_0x141211('0x12f')](function(){const _0x2bdcea=_0x141211;return _0x5e9cd5[_0x2bdcea('0x13a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x100603[_0x2bdcea('0x39')]['type']||_0x2bdcea('0x19'),'lastPauseAt':moment()['format'](_0x2bdcea('0x76'))});})[_0x141211('0x12f')](respondWithResult(_0x4f9dd2,null))[_0x141211('0x87')](handleError(_0x4f9dd2,null));},exports['unpause']=function(_0x27f516,_0x55b3f0){const _0x4bc958=_0x4d238e;let _0x39791f;return db[_0x4bc958('0x5c')][_0x4bc958('0x68')]({'where':{'id':_0x27f516[_0x4bc958('0x146')]['id']},'attributes':['id','name','role',_0x4bc958('0x151'),_0x4bc958('0x3f'),_0x4bc958('0xa5'),_0x4bc958('0x31'),_0x4bc958('0x11'),_0x4bc958('0x12d'),_0x4bc958('0xcd'),_0x4bc958('0x130'),_0x4bc958('0xfa')]})[_0x4bc958('0x12f')](handleEntityNotFound(_0x55b3f0,null))['then'](function(_0x26de4d){const _0x424267=_0x4bc958;if(_0x26de4d){_0x39791f=_0x26de4d;if(_0x27f516[_0x424267('0x39')][_0x424267('0x9b')]&&!utils[_0x424267('0xa')](_0x27f516[_0x424267('0x39')][_0x424267('0x9b')]))throw new ValidationError(_0x424267('0xfc'));switch(_0x27f516[_0x424267('0x39')][_0x424267('0x9b')]){case _0x424267('0x49'):return respondWithRpcPromise(_0x424267('0x108'),_0x424267('0xb9'),{'id':_0x39791f['id'],'name':_0x39791f[_0x424267('0xc0')],'pause':![]})['then'](function(){const _0x395ab4=_0x424267;return db[_0x395ab4('0x11c')]['update']({'paused':0x0},{'where':{'UserId':_0x39791f['id']},'individualHooks':!![]});})['then'](function(){const _0x23afcb=_0x424267;return db[_0x23afcb('0x6e')][_0x23afcb('0x68')]({'where':{'channel':_0x27f516['body']['channel'],'membername':_0x39791f[_0x23afcb('0xc0')],'type':'PAUSE','exitAt':null}});})[_0x424267('0x12f')](function(_0x4b3dbb){const _0x408a92=_0x424267;if(_0x4b3dbb)return _0x4b3dbb['update']({'exitAt':moment()[_0x408a92('0xe3')](_0x408a92('0x76')),'data2':_0x408a92('0xf9')},{'individualHooks':!![]});return null;})[_0x424267('0x12f')](function(){const _0x4f6725=_0x424267;return _0x39791f[_0x4f6725('0x13a')]({'voicePause':![]});});case _0x424267('0x62'):case'chat':case'fax':case'sms':case _0x424267('0x138'):case _0x424267('0x77'):return db[_0x424267('0x6e')][_0x424267('0x68')]({'where':{'channel':_0x27f516['body']['channel'],'membername':_0x39791f['name'],'type':_0x424267('0x6b'),'exitAt':null}})[_0x424267('0x12f')](function(_0x517ced){const _0x332ad4=_0x424267;if(_0x517ced)return _0x517ced[_0x332ad4('0x13a')]({'exitAt':moment()[_0x332ad4('0xe3')](_0x332ad4('0x76')),'data2':_0x332ad4('0xf9')},{'individualHooks':!![]});return null;})[_0x424267('0x12f')](function(){const _0x479e74=_0x424267,_0x524769={};return _[_0x479e74('0x78')](_0x524769,util[_0x479e74('0xe3')](_0x479e74('0x98'),_0x27f516['body'][_0x479e74('0x9b')],_0x479e74('0xda')),![]),_0x39791f[_0x479e74('0x13a')](_0x524769);});default:return respondWithRpcPromise('QueuePause',_0x424267('0xb9'),{'id':_0x39791f['id'],'name':_0x39791f['name'],'pause':![]})[_0x424267('0x12f')](function(){const _0x969c51=_0x424267;return db[_0x969c51('0x11c')][_0x969c51('0x13a')]({'paused':0x0},{'where':{'UserId':_0x39791f['id']}});})['then'](function(){const _0x96b31b=_0x424267;return db[_0x96b31b('0x6e')][_0x96b31b('0xf5')]({'where':{'membername':_0x39791f['name'],'type':_0x96b31b('0x6b'),'exitAt':null}});})[_0x424267('0x12f')](function(_0x154a12){const _0x500993=_0x424267,_0x45340c=[];return _0x154a12[_0x500993('0x10d')](function(_0x27ea3d){const _0x232bc0=_0x500993;_0x45340c['push'](_0x27ea3d[_0x232bc0('0x13a')]({'exitAt':moment()[_0x232bc0('0xe3')](_0x232bc0('0x76')),'data2':_0x232bc0('0xf9')}));}),Promise[_0x500993('0x1f')](_0x45340c);})[_0x424267('0x12f')](function(){const _0x5c638c=_0x424267;return _0x39791f[_0x5c638c('0x13a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x4bc958('0x12f')](respondWithResult(_0x55b3f0,null))[_0x4bc958('0x87')](handleError(_0x55b3f0,null));},exports[_0x4d238e('0xca')]=function(_0x10a20d,_0x3edcb9){const _0x585c79=_0x4d238e;let _0x796da8={};const _0x1c1984={};let _0x309c21,_0x2232e1;return db[_0x585c79('0x5c')]['findOne']({'where':{'id':_0x10a20d[_0x585c79('0x146')]['id']}})[_0x585c79('0x12f')](handleEntityNotFound(_0x3edcb9,null))['then'](function(_0x3ac635){const _0x40a809=_0x585c79;if(_0x3ac635)return _0x309c21=_0x3ac635,_0x1c1984[_0x40a809('0x11b')]=_[_0x40a809('0xb6')](db['Team'][_0x40a809('0xf8')]),_0x1c1984[_0x40a809('0x101')]=_[_0x40a809('0xb6')](_0x10a20d[_0x40a809('0x101')]),_0x1c1984['filters']=_['intersection'](_0x1c1984['model'],_0x1c1984[_0x40a809('0x101')]),_0x796da8[_0x40a809('0xb3')]=_[_0x40a809('0x59')](_0x1c1984[_0x40a809('0x11b')],qs['fields'](_0x10a20d[_0x40a809('0x101')][_0x40a809('0x152')])),_0x796da8[_0x40a809('0xb3')]=_0x796da8[_0x40a809('0xb3')]['length']?_0x796da8['attributes']:_0x1c1984[_0x40a809('0x11b')],_0x796da8[_0x40a809('0x2c')]=qs[_0x40a809('0x13')](_0x10a20d[_0x40a809('0x101')]['sort']),_0x796da8[_0x40a809('0xe5')]=qs[_0x40a809('0x4f')](_['pick'](_0x10a20d[_0x40a809('0x101')],_0x1c1984[_0x40a809('0x4f')])),_0x10a20d[_0x40a809('0x101')]['filter']&&(_0x796da8[_0x40a809('0xe5')]=_[_0x40a809('0x15f')](_0x796da8[_0x40a809('0xe5')],{[Op['or']]:_[_0x40a809('0xeb')](_0x796da8[_0x40a809('0xb3')],function(_0x139bba){const _0x480300=_0x40a809,_0xe5606b={};return _0xe5606b[_0x139bba]={[Op[_0x480300('0x83')]]:'%'+_0x10a20d[_0x480300('0x101')]['filter']+'%'},_0xe5606b;})})),_0x796da8=_[_0x40a809('0x15f')]({},_0x796da8,_0x10a20d['options']),_0x309c21[_0x40a809('0xca')](_0x796da8);})[_0x585c79('0x12f')](function(_0x1ec6c7){const _0x30615b=_0x585c79;if(_0x1ec6c7)return _0x2232e1=_0x1ec6c7[_0x30615b('0x67')],typeof _0x10a20d[_0x30615b('0x101')][_0x30615b('0xaf')]===_0x30615b('0x97')&&(_0x796da8[_0x30615b('0x121')]=qs[_0x30615b('0x121')](_0x10a20d[_0x30615b('0x101')]['limit']),_0x796da8[_0x30615b('0xf3')]=qs[_0x30615b('0xf3')](_0x10a20d[_0x30615b('0x101')][_0x30615b('0xf3')])),_0x309c21['getTeams'](_0x796da8);})['then'](function(_0x52f212){if(_0x52f212)return _0x52f212?{'count':_0x2232e1,'rows':_0x52f212}:null;})[_0x585c79('0x12f')](respondWithResult(_0x3edcb9,null))[_0x585c79('0x87')](handleError(_0x3edcb9,null));},exports[_0x4d238e('0x106')]=function(_0x3e0f9d,_0x1f5744){const _0x424abe=_0x4d238e;return db[_0x424abe('0x5c')]['findOne']({'where':{'id':_0x3e0f9d['params']['id']}})['then'](handleEntityNotFound(_0x1f5744,null))[_0x424abe('0x12f')](function(_0x1fdaa5){const _0x31e455=_0x424abe;if(_0x1fdaa5){const _0xb08fc8=_0x1fdaa5[_0x31e455('0x14f')]({'plain':!![]});return _0x1fdaa5['addTeams'](_0x3e0f9d[_0x31e455('0x39')][_0x31e455('0xfd')],_[_0x31e455('0x4b')](_0x3e0f9d[_0x31e455('0x39')],[_0x31e455('0xfd'),'id'])||{})['then'](function(){const _0x1da553=_0x31e455;for(let _0x152f98=0x0;_0x152f98<_0x3e0f9d['body'][_0x1da553('0xfd')][_0x1da553('0x67')];_0x152f98++){let _0x5c6548=[];db[_0x1da553('0x1d')]['findOne']({'where':{'id':_0x3e0f9d['body'][_0x1da553('0xfd')][_0x152f98]}})[_0x1da553('0x12f')](function(_0x4954f8){const _0x44c989=_0x1da553;return _0x5c6548[_0x44c989('0x15d')](_0x4954f8[_0x44c989('0xc7')]()[_0x44c989('0x12f')](function(_0x226cf3){const _0x43eaa3=_0x44c989;for(let _0x187c79=0x0;_0x187c79<_0x226cf3[_0x43eaa3('0x67')];_0x187c79++){_0x226cf3[_0x187c79][_0x43eaa3('0x13c')]('channel','Voice');}return _0x226cf3;})),_0x5c6548['push'](_0x4954f8['getChatQueues']()[_0x44c989('0x12f')](function(_0x29e8fc){const _0x498620=_0x44c989;for(let _0x41b589=0x0;_0x41b589<_0x29e8fc['length'];_0x41b589++){_0x29e8fc[_0x41b589][_0x498620('0x13c')](_0x498620('0x9b'),_0x498620('0x63'));}return _0x29e8fc;})),_0x5c6548[_0x44c989('0x15d')](_0x4954f8[_0x44c989('0x15e')]()[_0x44c989('0x12f')](function(_0x40d30e){const _0x924838=_0x44c989;for(let _0x237d9a=0x0;_0x237d9a<_0x40d30e[_0x924838('0x67')];_0x237d9a++){_0x40d30e[_0x237d9a][_0x924838('0x13c')]('channel',_0x924838('0x129'));}return _0x40d30e;})),_0x5c6548['push'](_0x4954f8[_0x44c989('0x100')]()[_0x44c989('0x12f')](function(_0x576d2c){const _0x3139b4=_0x44c989;for(let _0x41930c=0x0;_0x41930c<_0x576d2c[_0x3139b4('0x67')];_0x41930c++){_0x576d2c[_0x41930c][_0x3139b4('0x13c')](_0x3139b4('0x9b'),_0x3139b4('0x9c'));}return _0x576d2c;})),_0x5c6548[_0x44c989('0x15d')](_0x4954f8['getWhatsappQueues']()[_0x44c989('0x12f')](function(_0x25261a){const _0x463302=_0x44c989;for(let _0x30e0c5=0x0;_0x30e0c5<_0x25261a[_0x463302('0x67')];_0x30e0c5++){_0x25261a[_0x30e0c5][_0x463302('0x13c')](_0x463302('0x9b'),'Whatsapp');}return _0x25261a;})),_0x5c6548[_0x44c989('0x15d')](_0x4954f8['getFaxQueues']()['then'](function(_0x206d70){const _0xd8c8c9=_0x44c989;for(let _0xa4c966=0x0;_0xa4c966<_0x206d70[_0xd8c8c9('0x67')];_0xa4c966++){_0x206d70[_0xa4c966][_0xd8c8c9('0x13c')](_0xd8c8c9('0x9b'),_0xd8c8c9('0xb7'));}return _0x206d70;})),_0x5c6548[_0x44c989('0x15d')](_0x4954f8[_0x44c989('0x82')]()[_0x44c989('0x12f')](function(_0x402c94){const _0x1beeb4=_0x44c989;for(let _0x2bfc4b=0x0;_0x2bfc4b<_0x402c94[_0x1beeb4('0x67')];_0x2bfc4b++){_0x402c94[_0x2bfc4b][_0x1beeb4('0x13c')](_0x1beeb4('0x9b'),_0x1beeb4('0x2e'));}return _0x402c94;})),Promise[_0x44c989('0x1f')](_0x5c6548);})[_0x1da553('0x12f')](function(_0x33664d){const _0x3fcf78=_0x1da553,_0x1aab65=_['flatten'](_0x33664d);return _0x5c6548=[],db[_0x3fcf78('0xf1')][_0x3fcf78('0xff')](function(_0x285bfd){const _0xecc509=_0x3fcf78;for(let _0x5d4633=0x0;_0x5d4633<_0x1aab65[_0xecc509('0x67')];_0x5d4633++){_0x5c6548[_0xecc509('0x15d')](_0x1aab65[_0x5d4633]['addAgent'](_0xb08fc8['id']),{'transaction':_0x285bfd});}return Promise[_0xecc509('0x1f')](_0x5c6548)[_0xecc509('0x12f')](function(){const _0x3af015=_0xecc509;if(_0xb08fc8[_0x3af015('0x54')])return Promise[_0x3af015('0xa8')](_['filter'](_0x1aab65,function(_0x21d7c0){const _0x11128f=_0x3af015;return _0x21d7c0['getDataValue'](_0x11128f('0x9b'))===_0x11128f('0x44');}),function(_0x141a49){const _0xbc2dd5=_0x3af015;return db[_0xbc2dd5('0x11c')]['upsert']({'membername':_0xb08fc8[_0xbc2dd5('0xc0')],'UserId':_0xb08fc8['id'],'queue_name':_0x141a49['name'],'VoiceQueueId':_0x141a49['id'],'interface':_[_0xbc2dd5('0x12')](_0xb08fc8['interface'])?util[_0xbc2dd5('0xe3')](_0xbc2dd5('0x3b'),_0xb08fc8['name']):_0xb08fc8['interface'],'paused':_0xb08fc8['voicePause']||![],'penalty':_0xb08fc8[_0xbc2dd5('0x23')]},{'transaction':_0x285bfd});});else return;})[_0xecc509('0x12f')](function(){const _0x4e34e7=_0xecc509;for(let _0x444589=0x0;_0x444589<_0x1aab65[_0x4e34e7('0x67')];_0x444589++){const _0x170c77=_0x1aab65[_0x444589][_0x4e34e7('0x80')](_0x4e34e7('0x9b')),_0x5c53d0=_0x170c77+_0x4e34e7('0x159');socket[_0x4e34e7('0x12c')](_0x4e34e7('0xb4')+_0x170c77+_0x4e34e7('0x28'),{'UserId':_0xb08fc8['id'],[_0x5c53d0]:_0x1aab65[_0x444589]['id']});}});});});}});}})[_0x424abe('0x12f')](respondWithStatusCode(_0x1f5744,null))[_0x424abe('0x87')](handleError(_0x1f5744,null));},exports[_0x4d238e('0x5e')]=function(_0x53dcc8,_0x4f4c88){const _0x452cd6=_0x4d238e;return db[_0x452cd6('0x5c')][_0x452cd6('0x68')]({'where':{'id':_0x53dcc8['params']['id']}})[_0x452cd6('0x12f')](handleEntityNotFound(_0x4f4c88,null))['then'](function(_0x445c26){const _0x5099e3=_0x452cd6;if(_0x445c26){const _0x4c2cdb=_0x445c26[_0x5099e3('0x14f')]({'plain':!![]}),_0x2960bb=_0x53dcc8[_0x5099e3('0x101')]['ids'];return _0x445c26[_0x5099e3('0x5e')](_0x2960bb)['then'](function(){const _0x5b5da6=_0x5099e3;for(let _0xabba9e=0x0;_0xabba9e<_0x2960bb[_0x5b5da6('0x67')];_0xabba9e++){let _0x444dd0=[];db[_0x5b5da6('0x1d')]['findOne']({'where':{'id':_0x2960bb[_0xabba9e]}})[_0x5b5da6('0x12f')](function(_0x4a13a7){const _0x19c841=_0x5b5da6;return _0x444dd0['push'](_0x4a13a7[_0x19c841('0xc7')]()[_0x19c841('0x12f')](function(_0x1542d1){const _0x5663b8=_0x19c841;for(let _0x42d33c=0x0;_0x42d33c<_0x1542d1[_0x5663b8('0x67')];_0x42d33c++){_0x1542d1[_0x42d33c][_0x5663b8('0x13c')](_0x5663b8('0x9b'),'Voice');}return _0x1542d1;})),_0x444dd0[_0x19c841('0x15d')](_0x4a13a7[_0x19c841('0x105')]()[_0x19c841('0x12f')](function(_0x2e2125){const _0x5b11a1=_0x19c841;for(let _0x4a40d0=0x0;_0x4a40d0<_0x2e2125[_0x5b11a1('0x67')];_0x4a40d0++){_0x2e2125[_0x4a40d0][_0x5b11a1('0x13c')]('channel','Chat');}return _0x2e2125;})),_0x444dd0[_0x19c841('0x15d')](_0x4a13a7[_0x19c841('0x15e')]()[_0x19c841('0x12f')](function(_0x450530){const _0x479da0=_0x19c841;for(let _0x1f29c4=0x0;_0x1f29c4<_0x450530['length'];_0x1f29c4++){_0x450530[_0x1f29c4]['setDataValue'](_0x479da0('0x9b'),'Mail');}return _0x450530;})),_0x444dd0[_0x19c841('0x15d')](_0x4a13a7[_0x19c841('0x100')]()['then'](function(_0x2db238){const _0x3fe0af=_0x19c841;for(let _0x2f920e=0x0;_0x2f920e<_0x2db238[_0x3fe0af('0x67')];_0x2f920e++){_0x2db238[_0x2f920e][_0x3fe0af('0x13c')](_0x3fe0af('0x9b'),_0x3fe0af('0x9c'));}return _0x2db238;})),_0x444dd0[_0x19c841('0x15d')](_0x4a13a7[_0x19c841('0xba')]()['then'](function(_0x1def47){const _0x4ab357=_0x19c841;for(let _0x53f405=0x0;_0x53f405<_0x1def47[_0x4ab357('0x67')];_0x53f405++){_0x1def47[_0x53f405][_0x4ab357('0x13c')](_0x4ab357('0x9b'),_0x4ab357('0x64'));}return _0x1def47;})),_0x444dd0[_0x19c841('0x15d')](_0x4a13a7[_0x19c841('0x1')]()[_0x19c841('0x12f')](function(_0x149d04){const _0x57ae4b=_0x19c841;for(let _0x2562b9=0x0;_0x2562b9<_0x149d04[_0x57ae4b('0x67')];_0x2562b9++){_0x149d04[_0x2562b9][_0x57ae4b('0x13c')](_0x57ae4b('0x9b'),_0x57ae4b('0xb7'));}return _0x149d04;})),_0x444dd0[_0x19c841('0x15d')](_0x4a13a7[_0x19c841('0x82')]()[_0x19c841('0x12f')](function(_0x44b8f2){const _0x383499=_0x19c841;for(let _0x1da994=0x0;_0x1da994<_0x44b8f2[_0x383499('0x67')];_0x1da994++){_0x44b8f2[_0x1da994][_0x383499('0x13c')](_0x383499('0x9b'),_0x383499('0x2e'));}return _0x44b8f2;})),Promise[_0x19c841('0x1f')](_0x444dd0);})[_0x5b5da6('0x12f')](function(_0x12b517){const _0x4e298b=_0x5b5da6,_0x28c898=_[_0x4e298b('0x153')](_0x12b517);return _0x444dd0=[],db['sequelize'][_0x4e298b('0xff')](function(_0x5bc28d){const _0x5e7d7f=_0x4e298b;for(let _0x36323f=0x0;_0x36323f<_0x28c898[_0x5e7d7f('0x67')];_0x36323f++){_0x444dd0[_0x5e7d7f('0x15d')](_0x28c898[_0x36323f][_0x5e7d7f('0x6c')](_0x4c2cdb['id']),{'transaction':_0x5bc28d});}return Promise[_0x5e7d7f('0x1f')](_0x444dd0)[_0x5e7d7f('0x12f')](function(){const _0x5d3e1c=_0x5e7d7f;if(_0x4c2cdb[_0x5d3e1c('0x54')])return Promise[_0x5d3e1c('0xa8')](_[_0x5d3e1c('0x150')](_0x28c898,function(_0x2b4a34){const _0x2d67ba=_0x5d3e1c;return _0x2b4a34[_0x2d67ba('0x80')]('channel')===_0x2d67ba('0x44');}),function(_0x55aeb0){const _0x5324a7=_0x5d3e1c;return db[_0x5324a7('0x11c')][_0x5324a7('0x8e')]({'where':{'VoiceQueueId':_0x55aeb0['id'],'UserId':_0x4c2cdb['id']},'transaction':_0x5bc28d});});else return;})[_0x5e7d7f('0x12f')](function(){const _0x5c3827=_0x5e7d7f;for(let _0x4a3caa=0x0;_0x4a3caa<_0x28c898['length'];_0x4a3caa++){const _0x23ded8=_0x28c898[_0x4a3caa][_0x5c3827('0x80')]('channel'),_0x167958=_0x23ded8+_0x5c3827('0x159');socket[_0x5c3827('0x12c')](_0x5c3827('0xb4')+_0x23ded8+_0x5c3827('0x125'),{'UserId':_0x4c2cdb['id'],[_0x167958]:_0x28c898[_0x4a3caa]['id']});}});});});}});}})[_0x452cd6('0x12f')](respondWithStatusCode(_0x4f4c88,null))['catch'](handleError(_0x4f4c88,null));},exports[_0x4d238e('0x102')]=function(_0x4195c2,_0x1c7169){const _0x2e750e=_0x4d238e;let _0x128557={};const _0x2d6a82={};let _0x38690a,_0x56dd6b;return db[_0x2e750e('0x5c')][_0x2e750e('0x68')]({'where':{'id':_0x4195c2['params']['id']}})[_0x2e750e('0x12f')](handleEntityNotFound(_0x1c7169,null))[_0x2e750e('0x12f')](function(_0x5b6a3a){const _0x2fceca=_0x2e750e;if(_0x5b6a3a)return _0x38690a=_0x5b6a3a,_0x2d6a82['model']=_['keys'](db[_0x2fceca('0xc9')][_0x2fceca('0xf8')]),_0x2d6a82['query']=_[_0x2fceca('0xb6')](_0x4195c2[_0x2fceca('0x101')]),_0x2d6a82[_0x2fceca('0x4f')]=_[_0x2fceca('0x59')](_0x2d6a82['model'],_0x2d6a82[_0x2fceca('0x101')]),_0x128557[_0x2fceca('0xb3')]=_[_0x2fceca('0x59')](_0x2d6a82[_0x2fceca('0x11b')],qs['fields'](_0x4195c2[_0x2fceca('0x101')][_0x2fceca('0x152')])),_0x128557[_0x2fceca('0xb3')]=_0x128557['attributes']['length']?_0x128557[_0x2fceca('0xb3')]:_0x2d6a82[_0x2fceca('0x11b')],_0x128557[_0x2fceca('0x2c')]=qs[_0x2fceca('0x13')](_0x4195c2[_0x2fceca('0x101')][_0x2fceca('0x13')]),_0x128557[_0x2fceca('0xe5')]=qs[_0x2fceca('0x4f')](_[_0x2fceca('0x7b')](_0x4195c2['query'],_0x2d6a82['filters'])),_0x4195c2[_0x2fceca('0x101')][_0x2fceca('0x150')]&&(_0x128557[_0x2fceca('0xe5')]=_['merge'](_0x128557['where'],{[Op['or']]:_[_0x2fceca('0xeb')](_0x128557['attributes'],function(_0x185bf9){const _0x100cd8=_0x2fceca,_0x10a26d={};return _0x10a26d[_0x185bf9]={[Op[_0x100cd8('0x83')]]:'%'+_0x4195c2[_0x100cd8('0x101')][_0x100cd8('0x150')]+'%'},_0x10a26d;})})),_0x128557=_[_0x2fceca('0x15f')]({},_0x128557,_0x4195c2[_0x2fceca('0xd2')]),_0x38690a[_0x2fceca('0x102')](_0x128557);})[_0x2e750e('0x12f')](function(_0x32c496){const _0x41f7f9=_0x2e750e;if(_0x32c496)return _0x56dd6b=_0x32c496['length'],typeof _0x4195c2[_0x41f7f9('0x101')][_0x41f7f9('0xaf')]===_0x41f7f9('0x97')&&(_0x128557[_0x41f7f9('0x121')]=qs[_0x41f7f9('0x121')](_0x4195c2[_0x41f7f9('0x101')][_0x41f7f9('0x121')]),_0x128557[_0x41f7f9('0xf3')]=qs[_0x41f7f9('0xf3')](_0x4195c2['query'][_0x41f7f9('0xf3')])),_0x38690a[_0x41f7f9('0x102')](_0x128557);})[_0x2e750e('0x12f')](function(_0x4c5397){if(_0x4c5397)return _0x4c5397?{'count':_0x56dd6b,'rows':_0x4c5397}:null;})[_0x2e750e('0x12f')](respondWithResult(_0x1c7169,null))['catch'](handleError(_0x1c7169,null));},exports[_0x4d238e('0xbf')]=function(_0x220653,_0x2bd436){const _0x37da5c=_0x4d238e;let _0x1f202c={};const _0x4be9d5={};let _0x104fe4;return db[_0x37da5c('0x5c')]['findOne']({'where':{'id':_0x220653[_0x37da5c('0x146')]['id']}})[_0x37da5c('0x12f')](handleEntityNotFound(_0x2bd436,null))['then'](function(_0x142315){const _0x27359d=_0x37da5c;if(_0x142315)return _0x104fe4=_0x142315,_0x4be9d5[_0x27359d('0x11b')]=_[_0x27359d('0xb6')](db['User'][_0x27359d('0xf8')]),_0x4be9d5[_0x27359d('0x101')]=_[_0x27359d('0xb6')](_0x220653[_0x27359d('0x101')]),_0x4be9d5[_0x27359d('0x4f')]=_[_0x27359d('0x59')](_0x4be9d5['model'],_0x4be9d5[_0x27359d('0x101')]),_0x1f202c[_0x27359d('0xb3')]=_[_0x27359d('0x59')](_0x4be9d5[_0x27359d('0x11b')],qs[_0x27359d('0x152')](_0x220653['query'][_0x27359d('0x152')])),_0x1f202c[_0x27359d('0xb3')]=_0x1f202c[_0x27359d('0xb3')]['length']?_0x1f202c[_0x27359d('0xb3')]:_0x4be9d5['model'],_0x1f202c['order']=qs[_0x27359d('0x13')](_0x220653[_0x27359d('0x101')][_0x27359d('0x13')]),_0x1f202c[_0x27359d('0xe5')]=qs[_0x27359d('0x4f')](_['pick'](_0x220653[_0x27359d('0x101')],_0x4be9d5[_0x27359d('0x4f')])),_0x220653[_0x27359d('0x101')][_0x27359d('0x150')]&&(_0x1f202c[_0x27359d('0xe5')]=_['merge'](_0x1f202c[_0x27359d('0xe5')],{[Op['or']]:_[_0x27359d('0xeb')](_0x1f202c['attributes'],function(_0x212a73){const _0x340fc8=_0x27359d,_0x54c152={};return _0x54c152[_0x212a73]={[Op[_0x340fc8('0x83')]]:'%'+_0x220653[_0x340fc8('0x101')]['filter']+'%'},_0x54c152;})})),_0x1f202c['model']=db[_0x27359d('0x5c')],_0x1f202c['as']='Agents',_0x1f202c=_[_0x27359d('0x15f')]({},_0x1f202c,_0x220653[_0x27359d('0xd2')]),_0x104fe4[_0x27359d('0xc7')]({'include':[_0x1f202c]});})[_0x37da5c('0x12f')](function(_0x42b80c){const _0x4b4f1a=_0x37da5c;if(_0x42b80c){let _0x534e25={};const _0x1341d7=[];for(let _0x5adf96=0x0;_0x5adf96<_0x42b80c[_0x4b4f1a('0x67')];_0x5adf96+=0x1){for(let _0x260f31=0x0,_0x489a0c;_0x260f31<_0x42b80c[_0x5adf96][_0x4b4f1a('0x2a')][_0x4b4f1a('0x67')];_0x260f31+=0x1){_0x489a0c=_0x42b80c[_0x5adf96]['Agents'][_0x260f31]['get']({'plain':!![]}),_0x534e25[_0x489a0c['id']]=_0x489a0c;}}_0x534e25=_[_0x4b4f1a('0x15c')](_0x534e25);for(let _0x1cd98c=qs[_0x4b4f1a('0xf3')](_0x220653[_0x4b4f1a('0x101')][_0x4b4f1a('0xf3')]);_0x1cd98c<_0x534e25[_0x4b4f1a('0x67')]&&_0x1341d7[_0x4b4f1a('0x67')]<qs['limit'](_0x220653[_0x4b4f1a('0x101')][_0x4b4f1a('0x121')]);_0x1cd98c+=0x1){_0x534e25[_0x1cd98c]&&_0x1341d7[_0x4b4f1a('0x15d')](_0x534e25[_0x1cd98c]);}return{'count':_0x534e25['length'],'rows':_0x1341d7};}})['then'](respondWithResult(_0x2bd436,null))['catch'](handleError(_0x2bd436,null));},exports['destroy']=function(_0x2ff976,_0x51468){const _0x6f748f=_0x4d238e;if(_0x2ff976[_0x6f748f('0xb4')]['id']==_0x2ff976[_0x6f748f('0x146')]['id'])return _0x51468[_0x6f748f('0x38')](0x1f4)['send']({'message':_0x6f748f('0x7c')});return db[_0x6f748f('0x5c')]['findOne']({'where':{'id':_0x2ff976[_0x6f748f('0x146')]['id']}})['then'](handleEntityNotFound(_0x51468,null))[_0x6f748f('0x12f')](removeEntity(_0x51468,null))[_0x6f748f('0x87')](handleError(_0x51468,null));},exports[_0x4d238e('0x41')]=function(_0x65882d,_0x2cabf7){const _0x366e03=_0x4d238e;return db[_0x366e03('0x5c')]['findOne']({'where':{'id':_0x65882d[_0x366e03('0x146')]['id']}})['then'](handleEntityNotFound(_0x2cabf7,null))[_0x366e03('0x12f')](function(_0x1db0ee){const _0x1f3eed=_0x366e03;if(_0x1db0ee)return _0x1db0ee[_0x1f3eed('0x41')](_0x65882d['body']['ids'],{'through':_[_0x1f3eed('0x4b')](_0x65882d[_0x1f3eed('0x39')],[_0x1f3eed('0xfd'),'id'])})['then'](function(){const _0x218466=_0x1f3eed;for(let _0x4bb414=0x0;_0x4bb414<_0x65882d[_0x218466('0x39')]['ids'][_0x218466('0x67')];_0x4bb414+=0x1){socket[_0x218466('0x12c')](_0x218466('0x116'),{'ChatInteractionId':Number(_0x65882d[_0x218466('0x39')][_0x218466('0xfd')][_0x4bb414]),'UserId':Number(_0x65882d[_0x218466('0x146')]['id'])});}return _0x65882d[_0x218466('0x39')][_0x218466('0xfd')];});})['then'](respondWithResult(_0x2cabf7,null))['catch'](handleError(_0x2cabf7,null));},exports[_0x4d238e('0x75')]=function(_0x31b16a,_0x591fe5){const _0x460604=_0x4d238e;return db[_0x460604('0x5c')][_0x460604('0x68')]({'where':{'id':_0x31b16a[_0x460604('0x146')]['id']}})[_0x460604('0x12f')](handleEntityNotFound(_0x591fe5,null))[_0x460604('0x12f')](function(_0x10ab1a){const _0x3b04ea=_0x460604;if(_0x10ab1a)return _0x10ab1a[_0x3b04ea('0x75')](_0x31b16a[_0x3b04ea('0x101')][_0x3b04ea('0xfd')])[_0x3b04ea('0x12f')](function(){const _0x403717=_0x3b04ea;if(_[_0x403717('0x94')](_0x31b16a[_0x403717('0x101')][_0x403717('0xfd')]))for(let _0x1fb9f0=0x0;_0x1fb9f0<_0x31b16a[_0x403717('0x101')]['ids'][_0x403717('0x67')];_0x1fb9f0+=0x1){socket['emit'](_0x403717('0x127'),{'ChatInteractionId':Number(_0x31b16a[_0x403717('0x101')][_0x403717('0xfd')][_0x1fb9f0]),'UserId':Number(_0x31b16a[_0x403717('0x146')]['id'])});}else socket['emit'](_0x403717('0x127'),{'ChatInteractionId':Number(_0x31b16a[_0x403717('0x101')][_0x403717('0xfd')]),'UserId':Number(_0x31b16a[_0x403717('0x146')]['id'])});});})[_0x460604('0x12f')](respondWithStatusCode(_0x591fe5,null))[_0x460604('0x87')](handleError(_0x591fe5,null));},exports[_0x4d238e('0x37')]=function(_0x26c262,_0x488b2c){const _0x27b255=_0x4d238e;return db['User'][_0x27b255('0x68')]({'where':{'id':_0x26c262['params']['id']}})['then'](handleEntityNotFound(_0x488b2c,null))[_0x27b255('0x12f')](function(_0x4fca6e){const _0x496bc8=_0x27b255;if(_0x4fca6e)return _0x4fca6e[_0x496bc8('0x37')](_0x26c262['body'][_0x496bc8('0xfd')],{'through':_[_0x496bc8('0x4b')](_0x26c262[_0x496bc8('0x39')],[_0x496bc8('0xfd'),'id'])})[_0x496bc8('0x12f')](function(){const _0x350004=_0x496bc8;for(let _0x43f558=0x0;_0x43f558<_0x26c262[_0x350004('0x39')][_0x350004('0xfd')][_0x350004('0x67')];_0x43f558+=0x1){socket[_0x350004('0x12c')](_0x350004('0xd6'),{'MailInteractionId':Number(_0x26c262[_0x350004('0x39')]['ids'][_0x43f558]),'UserId':Number(_0x26c262[_0x350004('0x146')]['id'])});}return _0x26c262[_0x350004('0x39')]['ids'];});})['then'](respondWithResult(_0x488b2c,null))[_0x27b255('0x87')](handleError(_0x488b2c,null));},exports[_0x4d238e('0x7a')]=function(_0x2f94bd,_0x26622c){const _0x15baf7=_0x4d238e;return db[_0x15baf7('0x5c')][_0x15baf7('0x68')]({'where':{'id':_0x2f94bd[_0x15baf7('0x146')]['id']}})['then'](handleEntityNotFound(_0x26622c,null))[_0x15baf7('0x12f')](function(_0x59acd5){const _0x2dd3fc=_0x15baf7;if(_0x59acd5)return _0x59acd5[_0x2dd3fc('0x7a')](_0x2f94bd[_0x2dd3fc('0x101')]['ids'])[_0x2dd3fc('0x12f')](function(){const _0x26b9d0=_0x2dd3fc;if(_[_0x26b9d0('0x94')](_0x2f94bd[_0x26b9d0('0x101')]['ids']))for(let _0x9100a2=0x0;_0x9100a2<_0x2f94bd[_0x26b9d0('0x101')][_0x26b9d0('0xfd')][_0x26b9d0('0x67')];_0x9100a2+=0x1){socket[_0x26b9d0('0x12c')](_0x26b9d0('0x123'),{'MailInteractionId':Number(_0x2f94bd[_0x26b9d0('0x101')][_0x26b9d0('0xfd')][_0x9100a2]),'UserId':Number(_0x2f94bd['params']['id'])});}else socket['emit'](_0x26b9d0('0x123'),{'MailInteractionId':Number(_0x2f94bd[_0x26b9d0('0x101')][_0x26b9d0('0xfd')]),'UserId':Number(_0x2f94bd[_0x26b9d0('0x146')]['id'])});});})[_0x15baf7('0x12f')](respondWithStatusCode(_0x26622c,null))['catch'](handleError(_0x26622c,null));},exports[_0x4d238e('0x40')]=function(_0x140029,_0x5c564c){const _0x16add1=_0x4d238e;return db[_0x16add1('0x5c')]['findOne']({'where':{'id':_0x140029[_0x16add1('0x146')]['id']}})[_0x16add1('0x12f')](handleEntityNotFound(_0x5c564c,null))['then'](function(_0x1212e2){const _0xd5a770=_0x16add1;if(_0x1212e2)return _0x1212e2['addFaxInteractions'](_0x140029[_0xd5a770('0x39')][_0xd5a770('0xfd')],{'through':_[_0xd5a770('0x4b')](_0x140029[_0xd5a770('0x39')],['ids','id'])})[_0xd5a770('0x12f')](function(){const _0x19911d=_0xd5a770;for(let _0x32ffa0=0x0;_0x32ffa0<_0x140029[_0x19911d('0x39')][_0x19911d('0xfd')][_0x19911d('0x67')];_0x32ffa0+=0x1){socket[_0x19911d('0x12c')](_0x19911d('0x4a'),{'FaxInteractionId':Number(_0x140029[_0x19911d('0x39')][_0x19911d('0xfd')][_0x32ffa0]),'UserId':Number(_0x140029['params']['id'])});}return _0x140029[_0x19911d('0x39')][_0x19911d('0xfd')];});})['then'](respondWithResult(_0x5c564c,null))['catch'](handleError(_0x5c564c,null));},exports[_0x4d238e('0xcc')]=function(_0xd4f583,_0x2908de){const _0x4f910e=_0x4d238e;return db['User'][_0x4f910e('0x68')]({'where':{'id':_0xd4f583[_0x4f910e('0x146')]['id']}})[_0x4f910e('0x12f')](handleEntityNotFound(_0x2908de,null))[_0x4f910e('0x12f')](function(_0x1d894a){const _0x145992=_0x4f910e;if(_0x1d894a)return _0x1d894a[_0x145992('0xcc')](_0xd4f583['query'][_0x145992('0xfd')])[_0x145992('0x12f')](function(){const _0x5effc1=_0x145992;if(_[_0x5effc1('0x94')](_0xd4f583['query'][_0x5effc1('0xfd')]))for(let _0x14d488=0x0;_0x14d488<_0xd4f583['query'][_0x5effc1('0xfd')][_0x5effc1('0x67')];_0x14d488+=0x1){socket[_0x5effc1('0x12c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xd4f583[_0x5effc1('0x101')][_0x5effc1('0xfd')][_0x14d488]),'UserId':Number(_0xd4f583['params']['id'])});}else socket[_0x5effc1('0x12c')](_0x5effc1('0x5b'),{'FaxInteractionId':Number(_0xd4f583['query'][_0x5effc1('0xfd')]),'UserId':Number(_0xd4f583['params']['id'])});});})[_0x4f910e('0x12f')](respondWithStatusCode(_0x2908de,null))[_0x4f910e('0x87')](handleError(_0x2908de,null));},exports[_0x4d238e('0x115')]=function(_0x1397ac,_0x274b29){const _0x3a1bcb=_0x4d238e;return db[_0x3a1bcb('0x5c')][_0x3a1bcb('0x68')]({'where':{'id':_0x1397ac[_0x3a1bcb('0x146')]['id']}})['then'](handleEntityNotFound(_0x274b29,null))[_0x3a1bcb('0x12f')](function(_0x4db422){const _0x5abfe0=_0x3a1bcb;if(_0x4db422)return _0x4db422['addSmsInteractions'](_0x1397ac[_0x5abfe0('0x39')]['ids'],{'through':_[_0x5abfe0('0x4b')](_0x1397ac[_0x5abfe0('0x39')],[_0x5abfe0('0xfd'),'id'])})[_0x5abfe0('0x12f')](function(){const _0x5f0f73=_0x5abfe0;for(let _0x4215ba=0x0;_0x4215ba<_0x1397ac[_0x5f0f73('0x39')][_0x5f0f73('0xfd')][_0x5f0f73('0x67')];_0x4215ba+=0x1){socket['emit'](_0x5f0f73('0x5d'),{'SmsInteractionId':Number(_0x1397ac['body'][_0x5f0f73('0xfd')][_0x4215ba]),'UserId':Number(_0x1397ac['params']['id'])});}return _0x1397ac[_0x5f0f73('0x39')][_0x5f0f73('0xfd')];});})['then'](respondWithResult(_0x274b29,null))[_0x3a1bcb('0x87')](handleError(_0x274b29,null));},exports[_0x4d238e('0x70')]=function(_0x3b7f74,_0x53ad9b){const _0xf9689c=_0x4d238e;return db[_0xf9689c('0x5c')][_0xf9689c('0x68')]({'where':{'id':_0x3b7f74[_0xf9689c('0x146')]['id']}})[_0xf9689c('0x12f')](handleEntityNotFound(_0x53ad9b,null))[_0xf9689c('0x12f')](function(_0x59c645){const _0x3d4f7d=_0xf9689c;if(_0x59c645)return _0x59c645[_0x3d4f7d('0x70')](_0x3b7f74[_0x3d4f7d('0x101')]['ids'])[_0x3d4f7d('0x12f')](function(){const _0x4c3a24=_0x3d4f7d;if(_[_0x4c3a24('0x94')](_0x3b7f74[_0x4c3a24('0x101')][_0x4c3a24('0xfd')]))for(let _0x3092a9=0x0;_0x3092a9<_0x3b7f74['query']['ids'][_0x4c3a24('0x67')];_0x3092a9+=0x1){socket[_0x4c3a24('0x12c')](_0x4c3a24('0x111'),{'SmsInteractionId':Number(_0x3b7f74[_0x4c3a24('0x101')][_0x4c3a24('0xfd')][_0x3092a9]),'UserId':Number(_0x3b7f74[_0x4c3a24('0x146')]['id'])});}else socket['emit'](_0x4c3a24('0x111'),{'SmsInteractionId':Number(_0x3b7f74['query'][_0x4c3a24('0xfd')]),'UserId':Number(_0x3b7f74[_0x4c3a24('0x146')]['id'])});});})['then'](respondWithStatusCode(_0x53ad9b,null))['catch'](handleError(_0x53ad9b,null));},exports[_0x4d238e('0x55')]=function(_0x204b15,_0x1e11de){const _0xd7e867=_0x4d238e;return db[_0xd7e867('0x5c')]['findOne']({'where':{'id':_0x204b15[_0xd7e867('0x146')]['id']}})['then'](handleEntityNotFound(_0x1e11de,null))['then'](function(_0x597592){const _0x816e85=_0xd7e867;if(_0x597592)return _0x597592[_0x816e85('0x55')](_0x204b15['body'][_0x816e85('0xfd')],{'through':_['omit'](_0x204b15[_0x816e85('0x39')],['ids','id'])})['then'](function(){const _0x35fc9a=_0x816e85;for(let _0x3ba83b=0x0;_0x3ba83b<_0x204b15[_0x35fc9a('0x39')][_0x35fc9a('0xfd')][_0x35fc9a('0x67')];_0x3ba83b+=0x1){socket[_0x35fc9a('0x12c')]('user_has_openchannel_interactions:save',{'OpenchannelInteractionId':Number(_0x204b15[_0x35fc9a('0x39')]['ids'][_0x3ba83b]),'UserId':Number(_0x204b15[_0x35fc9a('0x146')]['id'])});}return _0x204b15['body']['ids'];});})[_0xd7e867('0x12f')](respondWithResult(_0x1e11de,null))[_0xd7e867('0x87')](handleError(_0x1e11de,null));},exports['removeOpenchannelInteractions']=function(_0x278ac3,_0x1231d8){const _0x17a570=_0x4d238e;return db['User'][_0x17a570('0x68')]({'where':{'id':_0x278ac3[_0x17a570('0x146')]['id']}})[_0x17a570('0x12f')](handleEntityNotFound(_0x1231d8,null))[_0x17a570('0x12f')](function(_0x29015e){const _0x430f95=_0x17a570;if(_0x29015e)return _0x29015e[_0x430f95('0x6d')](_0x278ac3[_0x430f95('0x101')][_0x430f95('0xfd')])[_0x430f95('0x12f')](function(){const _0x435294=_0x430f95;if(_[_0x435294('0x94')](_0x278ac3[_0x435294('0x101')][_0x435294('0xfd')]))for(let _0x480387=0x0;_0x480387<_0x278ac3[_0x435294('0x101')][_0x435294('0xfd')]['length'];_0x480387+=0x1){socket['emit'](_0x435294('0x7d'),{'OpenchannelInteractionId':Number(_0x278ac3[_0x435294('0x101')][_0x435294('0xfd')][_0x480387]),'UserId':Number(_0x278ac3[_0x435294('0x146')]['id'])});}else socket['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x278ac3[_0x435294('0x101')][_0x435294('0xfd')]),'UserId':Number(_0x278ac3[_0x435294('0x146')]['id'])});});})[_0x17a570('0x12f')](respondWithStatusCode(_0x1231d8,null))['catch'](handleError(_0x1231d8,null));},exports[_0x4d238e('0x95')]=function(_0x5b0dc8,_0x593013){const _0x337e69=_0x4d238e;return db['User']['findOne']({'where':{'id':_0x5b0dc8[_0x337e69('0x146')]['id']}})[_0x337e69('0x12f')](handleEntityNotFound(_0x593013,null))[_0x337e69('0x12f')](function(_0x1d4488){const _0x473e18=_0x337e69;if(_0x1d4488)return _0x1d4488[_0x473e18('0x95')](_0x5b0dc8[_0x473e18('0x39')]['ids'],{'through':_[_0x473e18('0x4b')](_0x5b0dc8['body'],[_0x473e18('0xfd'),'id'])})[_0x473e18('0x12f')](function(){const _0x160f4f=_0x473e18;for(let _0x209410=0x0;_0x209410<_0x5b0dc8['body'][_0x160f4f('0xfd')][_0x160f4f('0x67')];_0x209410+=0x1){socket[_0x160f4f('0x12c')]('user_has_whatsapp_interactions:save',{'WhatsappInteractionId':Number(_0x5b0dc8[_0x160f4f('0x39')][_0x160f4f('0xfd')][_0x209410]),'UserId':Number(_0x5b0dc8['params']['id'])});}return _0x5b0dc8[_0x160f4f('0x39')][_0x160f4f('0xfd')];});})[_0x337e69('0x12f')](respondWithResult(_0x593013,null))[_0x337e69('0x87')](handleError(_0x593013,null));},exports[_0x4d238e('0x158')]=function(_0x110ef9,_0x476f3f){const _0x55e96d=_0x4d238e;return db['User'][_0x55e96d('0x68')]({'where':{'id':_0x110ef9[_0x55e96d('0x146')]['id']}})[_0x55e96d('0x12f')](handleEntityNotFound(_0x476f3f,null))[_0x55e96d('0x12f')](function(_0x3699b6){const _0x73600c=_0x55e96d;if(_0x3699b6)return _0x3699b6[_0x73600c('0x158')](_0x110ef9[_0x73600c('0x101')][_0x73600c('0xfd')]);})['then'](respondWithStatusCode(_0x476f3f,null))[_0x55e96d('0x87')](handleError(_0x476f3f,null));},exports[_0x4d238e('0x3')]=function(_0x59cfd1,_0x54c9a2){const _0x32d390=_0x4d238e;let _0x2c6c20={};const _0x23f08c={};let _0x33fcf5,_0x26bc5e;return db[_0x32d390('0x5c')][_0x32d390('0x68')]({'where':{'id':_0x59cfd1[_0x32d390('0x146')]['id']}})[_0x32d390('0x12f')](handleEntityNotFound(_0x54c9a2,null))[_0x32d390('0x12f')](function(_0x136814){const _0x2f54c7=_0x32d390;if(_0x136814)return _0x33fcf5=_0x136814,_0x23f08c['model']=_['keys'](db['VoicePrefix'][_0x2f54c7('0xf8')]),_0x23f08c[_0x2f54c7('0x101')]=_[_0x2f54c7('0xb6')](_0x59cfd1[_0x2f54c7('0x101')]),_0x23f08c[_0x2f54c7('0x4f')]=_[_0x2f54c7('0x59')](_0x23f08c[_0x2f54c7('0x11b')],_0x23f08c[_0x2f54c7('0x101')]),_0x2c6c20[_0x2f54c7('0xb3')]=_[_0x2f54c7('0x59')](_0x23f08c[_0x2f54c7('0x11b')],qs['fields'](_0x59cfd1[_0x2f54c7('0x101')]['fields'])),_0x2c6c20['attributes']=_0x2c6c20[_0x2f54c7('0xb3')][_0x2f54c7('0x67')]?_0x2c6c20[_0x2f54c7('0xb3')]:_0x23f08c[_0x2f54c7('0x11b')],_0x2c6c20[_0x2f54c7('0x2c')]=qs[_0x2f54c7('0x13')](_0x59cfd1['query'][_0x2f54c7('0x13')]),_0x2c6c20[_0x2f54c7('0xe5')]=qs[_0x2f54c7('0x4f')](_[_0x2f54c7('0x7b')](_0x59cfd1[_0x2f54c7('0x101')],_0x23f08c[_0x2f54c7('0x4f')])),_0x59cfd1['query'][_0x2f54c7('0x150')]&&(_0x2c6c20[_0x2f54c7('0xe5')]=_[_0x2f54c7('0x15f')](_0x2c6c20[_0x2f54c7('0xe5')],{[Op['or']]:_['map'](_0x2c6c20[_0x2f54c7('0xb3')],function(_0x2ee816){const _0x2420a2=_0x2f54c7,_0x59027a={};return _0x59027a[_0x2ee816]={[Op[_0x2420a2('0x83')]]:'%'+_0x59cfd1['query']['filter']+'%'},_0x59027a;})})),_0x2c6c20=_[_0x2f54c7('0x15f')]({},_0x2c6c20,_0x59cfd1[_0x2f54c7('0xd2')]),_0x33fcf5[_0x2f54c7('0x3')](_0x2c6c20);})[_0x32d390('0x12f')](function(_0x40c1ed){const _0x299591=_0x32d390;if(_0x40c1ed)return _0x26bc5e=_0x40c1ed[_0x299591('0x67')],typeof _0x59cfd1['query'][_0x299591('0xaf')]===_0x299591('0x97')&&(_0x2c6c20[_0x299591('0x121')]=qs[_0x299591('0x121')](_0x59cfd1['query'][_0x299591('0x121')]),_0x2c6c20[_0x299591('0xf3')]=qs[_0x299591('0xf3')](_0x59cfd1[_0x299591('0x101')][_0x299591('0xf3')])),_0x33fcf5[_0x299591('0x3')](_0x2c6c20);})[_0x32d390('0x12f')](function(_0x205f23){if(_0x205f23)return _0x205f23?{'count':_0x26bc5e,'rows':_0x205f23}:null;})[_0x32d390('0x12f')](respondWithResult(_0x54c9a2,null))[_0x32d390('0x87')](handleError(_0x54c9a2,null));},exports[_0x4d238e('0x147')]=function(_0x41e6e3,_0x46763c){const _0x5ad2e0=_0x4d238e;let _0x3b01e9={};const _0x5763ef={};let _0x445c72,_0x31826f;return db[_0x5ad2e0('0x5c')][_0x5ad2e0('0x68')]({'where':{'id':_0x41e6e3[_0x5ad2e0('0x146')]['id']}})[_0x5ad2e0('0x12f')](handleEntityNotFound(_0x46763c,null))[_0x5ad2e0('0x12f')](function(_0x1a34c1){const _0x4e9b31=_0x5ad2e0;if(_0x1a34c1)return _0x445c72=_0x1a34c1,_0x5763ef[_0x4e9b31('0x11b')]=_[_0x4e9b31('0xb6')](db['FaxAccount'][_0x4e9b31('0xf8')]),_0x5763ef[_0x4e9b31('0x101')]=_['keys'](_0x41e6e3[_0x4e9b31('0x101')]),_0x5763ef['filters']=_[_0x4e9b31('0x59')](_0x5763ef[_0x4e9b31('0x11b')],_0x5763ef['query']),_0x3b01e9['attributes']=_[_0x4e9b31('0x59')](_0x5763ef['model'],qs[_0x4e9b31('0x152')](_0x41e6e3['query']['fields'])),_0x3b01e9[_0x4e9b31('0xb3')]=_0x3b01e9[_0x4e9b31('0xb3')][_0x4e9b31('0x67')]?_0x3b01e9[_0x4e9b31('0xb3')]:_0x5763ef[_0x4e9b31('0x11b')],_0x3b01e9[_0x4e9b31('0x2c')]=qs['sort'](_0x41e6e3[_0x4e9b31('0x101')][_0x4e9b31('0x13')]),_0x3b01e9['where']=qs[_0x4e9b31('0x4f')](_[_0x4e9b31('0x7b')](_0x41e6e3[_0x4e9b31('0x101')],_0x5763ef[_0x4e9b31('0x4f')])),_0x41e6e3[_0x4e9b31('0x101')]['filter']&&(_0x3b01e9[_0x4e9b31('0xe5')]=_[_0x4e9b31('0x15f')](_0x3b01e9['where'],{[Op['or']]:_[_0x4e9b31('0xeb')](_0x3b01e9[_0x4e9b31('0xb3')],function(_0x303d0c){const _0x5d7a5c=_0x4e9b31,_0x52fe33={};return _0x52fe33[_0x303d0c]={[Op[_0x5d7a5c('0x83')]]:'%'+_0x41e6e3[_0x5d7a5c('0x101')]['filter']+'%'},_0x52fe33;})})),_0x3b01e9=_[_0x4e9b31('0x15f')]({},_0x3b01e9,_0x41e6e3[_0x4e9b31('0xd2')]),_0x445c72[_0x4e9b31('0x147')](_0x3b01e9);})[_0x5ad2e0('0x12f')](function(_0x43fc53){const _0x282ead=_0x5ad2e0;if(_0x43fc53)return _0x31826f=_0x43fc53['length'],typeof _0x41e6e3[_0x282ead('0x101')]['nolimit']===_0x282ead('0x97')&&(_0x3b01e9[_0x282ead('0x121')]=qs[_0x282ead('0x121')](_0x41e6e3[_0x282ead('0x101')][_0x282ead('0x121')]),_0x3b01e9[_0x282ead('0xf3')]=qs[_0x282ead('0xf3')](_0x41e6e3[_0x282ead('0x101')][_0x282ead('0xf3')])),_0x445c72[_0x282ead('0x147')](_0x3b01e9);})[_0x5ad2e0('0x12f')](function(_0x50b7b9){if(_0x50b7b9)return _0x50b7b9?{'count':_0x31826f,'rows':_0x50b7b9}:null;})[_0x5ad2e0('0x12f')](respondWithResult(_0x46763c,null))['catch'](handleError(_0x46763c,null));},exports['addFaxAccounts']=function(_0x4c165e,_0xcef434){const _0x5d56f4=_0x4d238e;return db['User'][_0x5d56f4('0x68')]({'where':{'id':_0x4c165e[_0x5d56f4('0x146')]['id']}})[_0x5d56f4('0x12f')](handleEntityNotFound(_0xcef434,null))[_0x5d56f4('0x12f')](function(_0x595bf3){const _0x445f18=_0x5d56f4;if(_0x595bf3)return _0x595bf3['addFaxAccounts'](_0x4c165e[_0x445f18('0x39')]['ids'],{'through':_[_0x445f18('0x4b')](_0x4c165e[_0x445f18('0x39')],[_0x445f18('0xfd'),'id'])});})[_0x5d56f4('0x12f')](respondWithResult(_0xcef434,null))[_0x5d56f4('0x87')](handleError(_0xcef434,null));},exports[_0x4d238e('0x11f')]=function(_0x40cc4a,_0x20ccaa){const _0x398e53=_0x4d238e;return db[_0x398e53('0x5c')]['findOne']({'where':{'id':_0x40cc4a[_0x398e53('0x146')]['id']}})[_0x398e53('0x12f')](handleEntityNotFound(_0x20ccaa,null))[_0x398e53('0x12f')](function(_0xa8e252){const _0x11ca47=_0x398e53;if(_0xa8e252)return _0xa8e252[_0x11ca47('0x11f')](_0x40cc4a[_0x11ca47('0x101')][_0x11ca47('0xfd')]);})['then'](respondWithStatusCode(_0x20ccaa,null))[_0x398e53('0x87')](handleError(_0x20ccaa,null));},exports[_0x4d238e('0xb1')]=function(_0x4fa439,_0x570099){const _0x3522b0=_0x4d238e;let _0x4f8674={};const _0xea2a6={};let _0x10b537,_0xc425ba;return db[_0x3522b0('0x5c')][_0x3522b0('0x68')]({'where':{'id':_0x4fa439[_0x3522b0('0x146')]['id']}})[_0x3522b0('0x12f')](handleEntityNotFound(_0x570099,null))[_0x3522b0('0x12f')](function(_0x29a448){const _0x1b581b=_0x3522b0;if(_0x29a448)return _0x10b537=_0x29a448,_0xea2a6[_0x1b581b('0x11b')]=_['keys'](db[_0x1b581b('0x157')][_0x1b581b('0xf8')]),_0xea2a6['query']=_[_0x1b581b('0xb6')](_0x4fa439[_0x1b581b('0x101')]),_0xea2a6[_0x1b581b('0x4f')]=_[_0x1b581b('0x59')](_0xea2a6[_0x1b581b('0x11b')],_0xea2a6[_0x1b581b('0x101')]),_0x4f8674[_0x1b581b('0xb3')]=_[_0x1b581b('0x59')](_0xea2a6['model'],qs['fields'](_0x4fa439['query'][_0x1b581b('0x152')])),_0x4f8674['attributes']=_0x4f8674[_0x1b581b('0xb3')][_0x1b581b('0x67')]?_0x4f8674[_0x1b581b('0xb3')]:_0xea2a6[_0x1b581b('0x11b')],_0x4f8674['order']=qs['sort'](_0x4fa439[_0x1b581b('0x101')][_0x1b581b('0x13')]),_0x4f8674[_0x1b581b('0xe5')]=qs[_0x1b581b('0x4f')](_[_0x1b581b('0x7b')](_0x4fa439['query'],_0xea2a6[_0x1b581b('0x4f')])),_0x4fa439[_0x1b581b('0x101')][_0x1b581b('0x150')]&&(_0x4f8674[_0x1b581b('0xe5')]=_['merge'](_0x4f8674[_0x1b581b('0xe5')],{[Op['or']]:_['map'](_0x4f8674['attributes'],function(_0x2fa726){const _0x5f44fc=_0x1b581b,_0x235e8f={};return _0x235e8f[_0x2fa726]={[Op[_0x5f44fc('0x83')]]:'%'+_0x4fa439['query'][_0x5f44fc('0x150')]+'%'},_0x235e8f;})})),_0x4f8674=_[_0x1b581b('0x15f')]({},_0x4f8674,_0x4fa439[_0x1b581b('0xd2')]),_0x10b537['getMailAccounts'](_0x4f8674);})[_0x3522b0('0x12f')](function(_0x5bdf5f){const _0x400ee9=_0x3522b0;if(_0x5bdf5f)return _0xc425ba=_0x5bdf5f[_0x400ee9('0x67')],typeof _0x4fa439[_0x400ee9('0x101')][_0x400ee9('0xaf')]===_0x400ee9('0x97')&&(_0x4f8674[_0x400ee9('0x121')]=qs['limit'](_0x4fa439[_0x400ee9('0x101')][_0x400ee9('0x121')]),_0x4f8674['offset']=qs['offset'](_0x4fa439[_0x400ee9('0x101')][_0x400ee9('0xf3')])),_0x10b537[_0x400ee9('0xb1')](_0x4f8674);})[_0x3522b0('0x12f')](function(_0x4b7e21){if(_0x4b7e21)return _0x4b7e21?{'count':_0xc425ba,'rows':_0x4b7e21}:null;})[_0x3522b0('0x12f')](respondWithResult(_0x570099,null))[_0x3522b0('0x87')](handleError(_0x570099,null));},exports[_0x4d238e('0xde')]=function(_0x6797ef,_0x4d98ea){const _0xc005f9=_0x4d238e;return db['User']['findOne']({'where':{'id':_0x6797ef[_0xc005f9('0x146')]['id']}})[_0xc005f9('0x12f')](handleEntityNotFound(_0x4d98ea,null))[_0xc005f9('0x12f')](function(_0xdd4f53){const _0x33e9c7=_0xc005f9;if(_0xdd4f53)return _0xdd4f53[_0x33e9c7('0xde')](_0x6797ef['body'][_0x33e9c7('0xfd')],{'through':_[_0x33e9c7('0x4b')](_0x6797ef[_0x33e9c7('0x39')],[_0x33e9c7('0xfd'),'id'])});})['then'](respondWithResult(_0x4d98ea,null))[_0xc005f9('0x87')](handleError(_0x4d98ea,null));},exports[_0x4d238e('0x13e')]=function(_0x57eee5,_0x2dff38){const _0x583351=_0x4d238e;return db[_0x583351('0x5c')][_0x583351('0x68')]({'where':{'id':_0x57eee5[_0x583351('0x146')]['id']}})[_0x583351('0x12f')](handleEntityNotFound(_0x2dff38,null))[_0x583351('0x12f')](function(_0x51127e){const _0x4d1b6f=_0x583351;if(_0x51127e)return _0x51127e[_0x4d1b6f('0x13e')](_0x57eee5[_0x4d1b6f('0x101')]['ids']);})[_0x583351('0x12f')](respondWithStatusCode(_0x2dff38,null))[_0x583351('0x87')](handleError(_0x2dff38,null));},exports['getOpenchannelAccounts']=function(_0x18314f,_0x42d8e4){const _0x3f6ee9=_0x4d238e;let _0x2d8fcf={};const _0x3fa41b={};let _0x2309b1,_0x365468;return db['User'][_0x3f6ee9('0x68')]({'where':{'id':_0x18314f[_0x3f6ee9('0x146')]['id']}})['then'](handleEntityNotFound(_0x42d8e4,null))[_0x3f6ee9('0x12f')](function(_0xe2a089){const _0x563773=_0x3f6ee9;if(_0xe2a089)return _0x2309b1=_0xe2a089,_0x3fa41b[_0x563773('0x11b')]=_[_0x563773('0xb6')](db[_0x563773('0xe7')][_0x563773('0xf8')]),_0x3fa41b[_0x563773('0x101')]=_[_0x563773('0xb6')](_0x18314f[_0x563773('0x101')]),_0x3fa41b[_0x563773('0x4f')]=_['intersection'](_0x3fa41b[_0x563773('0x11b')],_0x3fa41b[_0x563773('0x101')]),_0x2d8fcf[_0x563773('0xb3')]=_[_0x563773('0x59')](_0x3fa41b['model'],qs[_0x563773('0x152')](_0x18314f[_0x563773('0x101')][_0x563773('0x152')])),_0x2d8fcf[_0x563773('0xb3')]=_0x2d8fcf[_0x563773('0xb3')][_0x563773('0x67')]?_0x2d8fcf['attributes']:_0x3fa41b['model'],_0x2d8fcf[_0x563773('0x2c')]=qs[_0x563773('0x13')](_0x18314f[_0x563773('0x101')][_0x563773('0x13')]),_0x2d8fcf[_0x563773('0xe5')]=qs[_0x563773('0x4f')](_[_0x563773('0x7b')](_0x18314f[_0x563773('0x101')],_0x3fa41b['filters'])),_0x18314f[_0x563773('0x101')][_0x563773('0x150')]&&(_0x2d8fcf[_0x563773('0xe5')]=_[_0x563773('0x15f')](_0x2d8fcf['where'],{[Op['or']]:_[_0x563773('0xeb')](_0x2d8fcf['attributes'],function(_0x527408){const _0x54f962=_0x563773,_0x1fd111={};return _0x1fd111[_0x527408]={[Op[_0x54f962('0x83')]]:'%'+_0x18314f[_0x54f962('0x101')]['filter']+'%'},_0x1fd111;})})),_0x2d8fcf=_[_0x563773('0x15f')]({},_0x2d8fcf,_0x18314f[_0x563773('0xd2')]),_0x2309b1[_0x563773('0x14b')](_0x2d8fcf);})[_0x3f6ee9('0x12f')](function(_0x1f099a){const _0xdb4350=_0x3f6ee9;if(_0x1f099a)return _0x365468=_0x1f099a[_0xdb4350('0x67')],typeof _0x18314f[_0xdb4350('0x101')][_0xdb4350('0xaf')]===_0xdb4350('0x97')&&(_0x2d8fcf[_0xdb4350('0x121')]=qs[_0xdb4350('0x121')](_0x18314f[_0xdb4350('0x101')]['limit']),_0x2d8fcf[_0xdb4350('0xf3')]=qs[_0xdb4350('0xf3')](_0x18314f[_0xdb4350('0x101')][_0xdb4350('0xf3')])),_0x2309b1[_0xdb4350('0x14b')](_0x2d8fcf);})[_0x3f6ee9('0x12f')](function(_0x2ccd3c){if(_0x2ccd3c)return _0x2ccd3c?{'count':_0x365468,'rows':_0x2ccd3c}:null;})['then'](respondWithResult(_0x42d8e4,null))[_0x3f6ee9('0x87')](handleError(_0x42d8e4,null));},exports[_0x4d238e('0x118')]=function(_0xc4c33,_0x293c1f){const _0x46e406=_0x4d238e;return db[_0x46e406('0x5c')][_0x46e406('0x68')]({'where':{'id':_0xc4c33['params']['id']}})[_0x46e406('0x12f')](function(_0x5c7468){const _0x9cf046=_0x46e406;if(_0x5c7468)return _0x5c7468[_0x9cf046('0x118')](_0xc4c33[_0x9cf046('0x39')]['ids'],{'through':_[_0x9cf046('0x4b')](_0xc4c33[_0x9cf046('0x39')],[_0x9cf046('0xfd'),'id'])});})[_0x46e406('0x12f')](respondWithResult(_0x293c1f,null))['catch'](handleError(_0x293c1f,null));},exports[_0x4d238e('0xb2')]=function(_0x5ef0a6,_0x485fb0){const _0x5959dd=_0x4d238e;return db[_0x5959dd('0x5c')][_0x5959dd('0x68')]({'where':{'id':_0x5ef0a6[_0x5959dd('0x146')]['id']}})[_0x5959dd('0x12f')](handleEntityNotFound(_0x485fb0,null))[_0x5959dd('0x12f')](function(_0x42c265){const _0x27c042=_0x5959dd;if(_0x42c265)return _0x42c265['removeOpenchannelAccounts'](_0x5ef0a6[_0x27c042('0x101')][_0x27c042('0xfd')]);})[_0x5959dd('0x12f')](respondWithStatusCode(_0x485fb0,null))[_0x5959dd('0x87')](handleError(_0x485fb0,null));},exports['getSmsAccounts']=function(_0x30846d,_0x119927){const _0x43bc8a=_0x4d238e;let _0x629930={};const _0x222fbd={};let _0x44e519,_0x59f063;return db[_0x43bc8a('0x5c')][_0x43bc8a('0x68')]({'where':{'id':_0x30846d[_0x43bc8a('0x146')]['id']}})['then'](handleEntityNotFound(_0x119927,null))[_0x43bc8a('0x12f')](function(_0x178602){const _0x341600=_0x43bc8a;if(_0x178602)return _0x44e519=_0x178602,_0x222fbd['model']=_['keys'](db[_0x341600('0xa9')][_0x341600('0xf8')]),_0x222fbd[_0x341600('0x101')]=_[_0x341600('0xb6')](_0x30846d['query']),_0x222fbd[_0x341600('0x4f')]=_[_0x341600('0x59')](_0x222fbd[_0x341600('0x11b')],_0x222fbd[_0x341600('0x101')]),_0x629930[_0x341600('0xb3')]=_[_0x341600('0x59')](_0x222fbd['model'],qs[_0x341600('0x152')](_0x30846d['query'][_0x341600('0x152')])),_0x629930['attributes']=_0x629930['attributes'][_0x341600('0x67')]?_0x629930[_0x341600('0xb3')]:_0x222fbd[_0x341600('0x11b')],_0x629930[_0x341600('0x2c')]=qs[_0x341600('0x13')](_0x30846d[_0x341600('0x101')][_0x341600('0x13')]),_0x629930['where']=qs[_0x341600('0x4f')](_['pick'](_0x30846d['query'],_0x222fbd[_0x341600('0x4f')])),_0x30846d[_0x341600('0x101')]['filter']&&(_0x629930[_0x341600('0xe5')]=_['merge'](_0x629930['where'],{[Op['or']]:_[_0x341600('0xeb')](_0x629930[_0x341600('0xb3')],function(_0x519b96){const _0xf26b85=_0x341600,_0x5db843={};return _0x5db843[_0x519b96]={[Op[_0xf26b85('0x83')]]:'%'+_0x30846d[_0xf26b85('0x101')][_0xf26b85('0x150')]+'%'},_0x5db843;})})),_0x629930=_[_0x341600('0x15f')]({},_0x629930,_0x30846d[_0x341600('0xd2')]),_0x44e519[_0x341600('0x47')](_0x629930);})[_0x43bc8a('0x12f')](function(_0x54d28c){const _0x405dea=_0x43bc8a;if(_0x54d28c)return _0x59f063=_0x54d28c['length'],typeof _0x30846d[_0x405dea('0x101')][_0x405dea('0xaf')]===_0x405dea('0x97')&&(_0x629930[_0x405dea('0x121')]=qs[_0x405dea('0x121')](_0x30846d[_0x405dea('0x101')][_0x405dea('0x121')]),_0x629930['offset']=qs['offset'](_0x30846d['query'][_0x405dea('0xf3')])),_0x44e519[_0x405dea('0x47')](_0x629930);})['then'](function(_0x1b7e95){if(_0x1b7e95)return _0x1b7e95?{'count':_0x59f063,'rows':_0x1b7e95}:null;})[_0x43bc8a('0x12f')](respondWithResult(_0x119927,null))[_0x43bc8a('0x87')](handleError(_0x119927,null));},exports['addSmsAccounts']=function(_0x5dfd31,_0x206b61){const _0x2438dd=_0x4d238e;return db[_0x2438dd('0x5c')]['findOne']({'where':{'id':_0x5dfd31[_0x2438dd('0x146')]['id']}})['then'](handleEntityNotFound(_0x206b61,null))['then'](function(_0x1bc846){const _0x36a304=_0x2438dd;if(_0x1bc846)return _0x1bc846[_0x36a304('0x132')](_0x5dfd31[_0x36a304('0x39')][_0x36a304('0xfd')],{'through':_['omit'](_0x5dfd31[_0x36a304('0x39')],[_0x36a304('0xfd'),'id'])});})[_0x2438dd('0x12f')](respondWithResult(_0x206b61,null))[_0x2438dd('0x87')](handleError(_0x206b61,null));},exports[_0x4d238e('0x112')]=function(_0x593e44,_0x3699af){const _0x5c3a28=_0x4d238e;return db[_0x5c3a28('0x5c')]['findOne']({'where':{'id':_0x593e44[_0x5c3a28('0x146')]['id']}})[_0x5c3a28('0x12f')](handleEntityNotFound(_0x3699af,null))[_0x5c3a28('0x12f')](function(_0x2cfb0e){const _0x414028=_0x5c3a28;if(_0x2cfb0e)return _0x2cfb0e['removeSmsAccounts'](_0x593e44[_0x414028('0x101')][_0x414028('0xfd')]);})[_0x5c3a28('0x12f')](respondWithStatusCode(_0x3699af,null))[_0x5c3a28('0x87')](handleError(_0x3699af,null));},exports[_0x4d238e('0x29')]=function(_0x4a4521,_0x151335){const _0x4e3785=_0x4d238e;let _0x1b2733={};const _0x512d62={};let _0x29715c,_0x17c6e5;return db[_0x4e3785('0x5c')][_0x4e3785('0x68')]({'where':{'id':_0x4a4521['params']['id']}})[_0x4e3785('0x12f')](handleEntityNotFound(_0x151335,null))[_0x4e3785('0x12f')](function(_0x16415b){const _0x19612f=_0x4e3785;if(_0x16415b)return _0x29715c=_0x16415b,_0x512d62[_0x19612f('0x11b')]=_[_0x19612f('0xb6')](db[_0x19612f('0x99')]['rawAttributes']),_0x512d62['query']=_['keys'](_0x4a4521[_0x19612f('0x101')]),_0x512d62[_0x19612f('0x4f')]=_['intersection'](_0x512d62[_0x19612f('0x11b')],_0x512d62[_0x19612f('0x101')]),_0x1b2733[_0x19612f('0xb3')]=_[_0x19612f('0x59')](_0x512d62[_0x19612f('0x11b')],qs[_0x19612f('0x152')](_0x4a4521[_0x19612f('0x101')][_0x19612f('0x152')])),_0x1b2733[_0x19612f('0xb3')]=_0x1b2733[_0x19612f('0xb3')][_0x19612f('0x67')]?_0x1b2733[_0x19612f('0xb3')]:_0x512d62[_0x19612f('0x11b')],_0x1b2733['order']=qs[_0x19612f('0x13')](_0x4a4521[_0x19612f('0x101')][_0x19612f('0x13')]),_0x1b2733[_0x19612f('0xe5')]=qs[_0x19612f('0x4f')](_[_0x19612f('0x7b')](_0x4a4521[_0x19612f('0x101')],_0x512d62[_0x19612f('0x4f')])),_0x4a4521['query']['filter']&&(_0x1b2733[_0x19612f('0xe5')]=_[_0x19612f('0x15f')](_0x1b2733[_0x19612f('0xe5')],{[Op['or']]:_[_0x19612f('0xeb')](_0x1b2733[_0x19612f('0xb3')],function(_0x16f6ef){const _0x19ba1a=_0x19612f,_0x253ace={};return _0x253ace[_0x16f6ef]={[Op['like']]:'%'+_0x4a4521['query'][_0x19ba1a('0x150')]+'%'},_0x253ace;})})),_0x1b2733=_[_0x19612f('0x15f')]({},_0x1b2733,_0x4a4521['options']),_0x29715c[_0x19612f('0x29')](_0x1b2733);})['then'](function(_0x19b652){const _0x4278b4=_0x4e3785;if(_0x19b652)return _0x17c6e5=_0x19b652[_0x4278b4('0x67')],typeof _0x4a4521[_0x4278b4('0x101')][_0x4278b4('0xaf')]==='undefined'&&(_0x1b2733[_0x4278b4('0x121')]=qs['limit'](_0x4a4521[_0x4278b4('0x101')][_0x4278b4('0x121')]),_0x1b2733[_0x4278b4('0xf3')]=qs[_0x4278b4('0xf3')](_0x4a4521[_0x4278b4('0x101')]['offset'])),_0x29715c[_0x4278b4('0x29')](_0x1b2733);})[_0x4e3785('0x12f')](function(_0x8d3dcc){if(_0x8d3dcc)return _0x8d3dcc?{'count':_0x17c6e5,'rows':_0x8d3dcc}:null;})[_0x4e3785('0x12f')](respondWithResult(_0x151335,null))['catch'](handleError(_0x151335,null));},exports[_0x4d238e('0xe0')]=function(_0x8fa268,_0x641a6e){const _0x285afb=_0x4d238e;return db[_0x285afb('0x5c')][_0x285afb('0x68')]({'where':{'id':_0x8fa268[_0x285afb('0x146')]['id']}})[_0x285afb('0x12f')](handleEntityNotFound(_0x641a6e,null))[_0x285afb('0x12f')](function(_0x150013){const _0x390b68=_0x285afb;if(_0x150013)return _0x150013['addChatWebsites'](_0x8fa268['body'][_0x390b68('0xfd')],{'through':_['omit'](_0x8fa268[_0x390b68('0x39')],[_0x390b68('0xfd'),'id'])});})[_0x285afb('0x12f')](respondWithResult(_0x641a6e,null))[_0x285afb('0x87')](handleError(_0x641a6e,null));},exports['removeChatWebsites']=function(_0x3d54cc,_0x2219e2){const _0x2f7447=_0x4d238e;return db[_0x2f7447('0x5c')][_0x2f7447('0x68')]({'where':{'id':_0x3d54cc['params']['id']}})[_0x2f7447('0x12f')](handleEntityNotFound(_0x2219e2,null))[_0x2f7447('0x12f')](function(_0x31e963){const _0x25697c=_0x2f7447;if(_0x31e963)return _0x31e963[_0x25697c('0x141')](_0x3d54cc[_0x25697c('0x101')]['ids']);})[_0x2f7447('0x12f')](respondWithStatusCode(_0x2219e2,null))['catch'](handleError(_0x2219e2,null));},exports[_0x4d238e('0x88')]=function(_0x3f68a8,_0x4c7f72){const _0x20e4d5=_0x4d238e;let _0x203b95={};const _0x27f1aa={};let _0x24b328,_0x1845d8;return db[_0x20e4d5('0x5c')]['findOne']({'where':{'id':_0x3f68a8['params']['id']}})['then'](handleEntityNotFound(_0x4c7f72,null))[_0x20e4d5('0x12f')](function(_0x57586e){const _0xa36648=_0x20e4d5;if(_0x57586e)return _0x24b328=_0x57586e,_0x27f1aa[_0xa36648('0x11b')]=_[_0xa36648('0xb6')](db[_0xa36648('0x4c')][_0xa36648('0xf8')]),_0x27f1aa[_0xa36648('0x101')]=_[_0xa36648('0xb6')](_0x3f68a8[_0xa36648('0x101')]),_0x27f1aa['filters']=_[_0xa36648('0x59')](_0x27f1aa['model'],_0x27f1aa[_0xa36648('0x101')]),_0x203b95[_0xa36648('0xb3')]=_[_0xa36648('0x59')](_0x27f1aa[_0xa36648('0x11b')],qs[_0xa36648('0x152')](_0x3f68a8[_0xa36648('0x101')][_0xa36648('0x152')])),_0x203b95[_0xa36648('0xb3')]=_0x203b95['attributes'][_0xa36648('0x67')]?_0x203b95['attributes']:_0x27f1aa[_0xa36648('0x11b')],_0x203b95[_0xa36648('0x2c')]=qs[_0xa36648('0x13')](_0x3f68a8['query'][_0xa36648('0x13')]),_0x203b95['where']=qs[_0xa36648('0x4f')](_['pick'](_0x3f68a8['query'],_0x27f1aa['filters'])),_0x3f68a8[_0xa36648('0x101')][_0xa36648('0x150')]&&(_0x203b95[_0xa36648('0xe5')]=_['merge'](_0x203b95[_0xa36648('0xe5')],{[Op['or']]:_['map'](_0x203b95[_0xa36648('0xb3')],function(_0x4acd9a){const _0x20ebfd=_0xa36648,_0x10facf={};return _0x10facf[_0x4acd9a]={[Op[_0x20ebfd('0x83')]]:'%'+_0x3f68a8[_0x20ebfd('0x101')][_0x20ebfd('0x150')]+'%'},_0x10facf;})})),_0x203b95=_['merge']({},_0x203b95,_0x3f68a8[_0xa36648('0xd2')]),_0x24b328[_0xa36648('0x88')](_0x203b95);})[_0x20e4d5('0x12f')](function(_0x136554){const _0x347906=_0x20e4d5;if(_0x136554)return _0x1845d8=_0x136554['length'],typeof _0x3f68a8[_0x347906('0x101')][_0x347906('0xaf')]===_0x347906('0x97')&&(_0x203b95[_0x347906('0x121')]=qs['limit'](_0x3f68a8[_0x347906('0x101')][_0x347906('0x121')]),_0x203b95[_0x347906('0xf3')]=qs[_0x347906('0xf3')](_0x3f68a8[_0x347906('0x101')][_0x347906('0xf3')])),_0x24b328[_0x347906('0x88')](_0x203b95);})[_0x20e4d5('0x12f')](function(_0x3375b2){if(_0x3375b2)return _0x3375b2?{'count':_0x1845d8,'rows':_0x3375b2}:null;})[_0x20e4d5('0x12f')](respondWithResult(_0x4c7f72,null))[_0x20e4d5('0x87')](handleError(_0x4c7f72,null));},exports[_0x4d238e('0x156')]=function(_0x52c07a,_0x4d8c70){const _0x380e86=_0x4d238e;return db[_0x380e86('0x5c')][_0x380e86('0x68')]({'where':{'id':_0x52c07a['params']['id']}})[_0x380e86('0x12f')](handleEntityNotFound(_0x4d8c70,null))[_0x380e86('0x12f')](function(_0x302f5e){const _0x2dc9b3=_0x380e86;if(_0x302f5e)return _0x302f5e['addWhatsappAccounts'](_0x52c07a['body'][_0x2dc9b3('0xfd')],{'through':_[_0x2dc9b3('0x4b')](_0x52c07a['body'],[_0x2dc9b3('0xfd'),'id'])});})[_0x380e86('0x12f')](respondWithResult(_0x4d8c70,null))['catch'](handleError(_0x4d8c70,null));},exports[_0x4d238e('0x11e')]=function(_0x39bec6,_0x2a2a84){const _0x3fff6e=_0x4d238e;return db['User']['findOne']({'where':{'id':_0x39bec6[_0x3fff6e('0x146')]['id']}})[_0x3fff6e('0x12f')](handleEntityNotFound(_0x2a2a84,null))[_0x3fff6e('0x12f')](function(_0x3ad518){const _0x57c152=_0x3fff6e;if(_0x3ad518)return _0x3ad518['removeWhatsappAccounts'](_0x39bec6[_0x57c152('0x101')][_0x57c152('0xfd')]);})[_0x3fff6e('0x12f')](respondWithStatusCode(_0x2a2a84,null))['catch'](handleError(_0x2a2a84,null));},exports[_0x4d238e('0xdd')]=function(_0xa79b34,_0x124ff1){const _0x45ce33=_0x4d238e;let _0x57118e={};const _0x5cf1a4={};let _0x4c8883,_0x26ef17;return db['User'][_0x45ce33('0x68')]({'where':{'id':_0xa79b34['params']['id']}})[_0x45ce33('0x12f')](handleEntityNotFound(_0x124ff1,null))[_0x45ce33('0x12f')](function(_0x2a843e){const _0xd58a97=_0x45ce33;if(_0x2a843e)return _0x4c8883=_0x2a843e,_0x5cf1a4['model']=_['keys'](db[_0xd58a97('0x15b')][_0xd58a97('0xf8')]),_0x5cf1a4[_0xd58a97('0x101')]=_[_0xd58a97('0xb6')](_0xa79b34['query']),_0x5cf1a4['filters']=_[_0xd58a97('0x59')](_0x5cf1a4[_0xd58a97('0x11b')],_0x5cf1a4[_0xd58a97('0x101')]),_0x57118e[_0xd58a97('0xb3')]=_[_0xd58a97('0x59')](_0x5cf1a4[_0xd58a97('0x11b')],qs[_0xd58a97('0x152')](_0xa79b34[_0xd58a97('0x101')][_0xd58a97('0x152')])),_0x57118e[_0xd58a97('0xb3')]=_0x57118e['attributes'][_0xd58a97('0x67')]?_0x57118e[_0xd58a97('0xb3')]:_0x5cf1a4[_0xd58a97('0x11b')],_0x57118e[_0xd58a97('0x2c')]=qs['sort'](_0xa79b34['query']['sort']),_0x57118e[_0xd58a97('0xe5')]=qs[_0xd58a97('0x4f')](_[_0xd58a97('0x7b')](_0xa79b34['query'],_0x5cf1a4[_0xd58a97('0x4f')])),_0xa79b34[_0xd58a97('0x101')][_0xd58a97('0x150')]&&(_0x57118e[_0xd58a97('0xe5')]=_[_0xd58a97('0x15f')](_0x57118e[_0xd58a97('0xe5')],{[Op['or']]:_[_0xd58a97('0xeb')](_0x57118e[_0xd58a97('0xb3')],function(_0x3d4283){const _0x592f5d=_0xd58a97,_0x217d3f={};return _0x217d3f[_0x3d4283]={[Op['like']]:'%'+_0xa79b34[_0x592f5d('0x101')]['filter']+'%'},_0x217d3f;})})),_0x57118e=_['merge']({},_0x57118e,_0xa79b34[_0xd58a97('0xd2')]),_0x4c8883[_0xd58a97('0xdd')](_0x57118e);})[_0x45ce33('0x12f')](function(_0x39b110){const _0x40ecc0=_0x45ce33;if(_0x39b110)return _0x26ef17=_0x39b110[_0x40ecc0('0x67')],typeof _0xa79b34['query'][_0x40ecc0('0xaf')]==='undefined'&&(_0x57118e[_0x40ecc0('0x121')]=qs[_0x40ecc0('0x121')](_0xa79b34[_0x40ecc0('0x101')]['limit']),_0x57118e['offset']=qs[_0x40ecc0('0xf3')](_0xa79b34[_0x40ecc0('0x101')][_0x40ecc0('0xf3')])),_0x4c8883[_0x40ecc0('0xdd')](_0x57118e);})[_0x45ce33('0x12f')](function(_0x2ea6eb){if(_0x2ea6eb)return _0x2ea6eb?{'count':_0x26ef17,'rows':_0x2ea6eb}:null;})[_0x45ce33('0x12f')](respondWithResult(_0x124ff1,null))[_0x45ce33('0x87')](handleError(_0x124ff1,null));},exports[_0x4d238e('0xac')]=function(_0xe3d9e3,_0x5c1b81){const _0x1b0e90=_0x4d238e;return db[_0x1b0e90('0x5c')][_0x1b0e90('0x68')]({'where':{'id':_0xe3d9e3[_0x1b0e90('0x146')]['id']}})[_0x1b0e90('0x12f')](handleEntityNotFound(_0x5c1b81,null))['then'](function(_0x22382f){const _0x5425f9=_0x1b0e90;if(_0x22382f)return _0x22382f[_0x5425f9('0xac')](_0xe3d9e3['body'][_0x5425f9('0xfd')],{'through':_[_0x5425f9('0x4b')](_0xe3d9e3[_0x5425f9('0x39')],[_0x5425f9('0xfd'),'id'])});})['then'](respondWithResult(_0x5c1b81,null))['catch'](handleError(_0x5c1b81,null));},exports[_0x4d238e('0xc1')]=function(_0xac0828,_0xcd8d1e){const _0x568088=_0x4d238e;return db[_0x568088('0x5c')][_0x568088('0x68')]({'where':{'id':_0xac0828[_0x568088('0x146')]['id']}})[_0x568088('0x12f')](handleEntityNotFound(_0xcd8d1e,null))['then'](function(_0x1d9248){const _0x1c6e24=_0x568088;if(_0x1d9248)return _0x1d9248[_0x1c6e24('0xc1')](_0xac0828[_0x1c6e24('0x101')]['ids']);})[_0x568088('0x12f')](respondWithStatusCode(_0xcd8d1e,null))['catch'](handleError(_0xcd8d1e,null));},exports[_0x4d238e('0x11d')]=function(_0x54f674,_0x64070){const _0x4d7d10=_0x4d238e;let _0x3c110b={};const _0x4758fa={},_0x5a76bb={'count':0x0,'rows':[]},_0x48a0dc=db[_0x4d7d10('0x109')]['rawAttributes'];_0x4758fa['model']=_[_0x4d7d10('0xb6')](_0x48a0dc),_0x4758fa['query']=_[_0x4d7d10('0xb6')](_0x54f674[_0x4d7d10('0x101')]),_0x4758fa['filters']=_['intersection'](_0x4758fa[_0x4d7d10('0x11b')],_0x4758fa[_0x4d7d10('0x101')]),_0x4758fa[_0x4d7d10('0x4f')]=_[_0x4d7d10('0x15a')](_0x4758fa[_0x4d7d10('0x4f')],[_0x4d7d10('0xc5'),'$or',_0x4d7d10('0xd9'),_0x4d7d10('0xe2'),'$lt',_0x4d7d10('0x140'),_0x4d7d10('0x9a'),_0x4d7d10('0xbd'),'$not','$between',_0x4d7d10('0x8f'),_0x4d7d10('0x5a'),_0x4d7d10('0x9'),_0x4d7d10('0x52'),_0x4d7d10('0xc3'),_0x4d7d10('0x144'),_0x4d7d10('0xef'),_0x4d7d10('0x52'),_0x4d7d10('0xd0'),_0x4d7d10('0x45'),'$contained','$any']),_0x3c110b['attributes']=_[_0x4d7d10('0x59')](_0x4758fa[_0x4d7d10('0x11b')],qs['fields'](_0x54f674[_0x4d7d10('0x101')][_0x4d7d10('0x152')])),_0x3c110b['attributes']=_0x3c110b[_0x4d7d10('0xb3')]['length']?_0x3c110b[_0x4d7d10('0xb3')]:_0x4758fa[_0x4d7d10('0x11b')];typeof _0x54f674[_0x4d7d10('0x101')][_0x4d7d10('0xaf')]===_0x4d7d10('0x97')&&(_0x3c110b[_0x4d7d10('0x121')]=qs[_0x4d7d10('0x121')](_0x54f674[_0x4d7d10('0x101')][_0x4d7d10('0x121')]),_0x3c110b[_0x4d7d10('0xf3')]=qs[_0x4d7d10('0xf3')](_0x54f674[_0x4d7d10('0x101')][_0x4d7d10('0xf3')]));_0x3c110b[_0x4d7d10('0x2c')]=qs['sort'](_0x54f674[_0x4d7d10('0x101')][_0x4d7d10('0x13')]),_0x3c110b['where']=qs['filters'](_[_0x4d7d10('0x7b')](_0x54f674['query'],_0x4758fa[_0x4d7d10('0x4f')]));_0x54f674['query'][_0x4d7d10('0x150')]&&(_0x3c110b[_0x4d7d10('0xe5')]=_[_0x4d7d10('0x15f')](_0x3c110b['where'],{[Op['or']]:_[_0x4d7d10('0xeb')](_0x3c110b[_0x4d7d10('0xb3')],function(_0x1bdffd){const _0x40b2d6=_0x4d7d10,_0x4b976d={};return _0x4b976d[_0x1bdffd]={[Op[_0x40b2d6('0x83')]]:'%'+_0x54f674['query']['filter']+'%'},_0x4b976d;})}));_0x3c110b[_0x4d7d10('0xe5')]={[Op[_0x4d7d10('0x14')]]:[_0x3c110b['where'],{[Op['or']]:[{'UserId':_0x54f674['params']['id']},{'OwnerId':_0x54f674[_0x4d7d10('0x146')]['id']}]}]},_0x3c110b=_[_0x4d7d10('0x15f')]({},_0x3c110b,_0x54f674['options']);const _0x9c4002={'where':_0x3c110b[_0x4d7d10('0xe5')]};return db[_0x4d7d10('0x109')][_0x4d7d10('0x113')](_0x9c4002)[_0x4d7d10('0x12f')](function(_0x571d97){const _0x296e0a=_0x4d7d10;return _0x5a76bb['count']=_0x571d97,_0x54f674[_0x296e0a('0x101')][_0x296e0a('0xd7')]&&(_0x3c110b[_0x296e0a('0x10f')]=[{'attributes':['id',_0x296e0a('0x124'),_0x296e0a('0xee'),_0x296e0a('0x107')],'model':db[_0x296e0a('0x12b')],'as':_0x296e0a('0x7f')},{'attributes':['id',_0x296e0a('0xc0'),_0x296e0a('0xec')],'model':db[_0x296e0a('0x143')],'as':_0x296e0a('0xe6')}]),db[_0x296e0a('0x109')][_0x296e0a('0xf5')](_0x3c110b);})[_0x4d7d10('0x12f')](function(_0x4a20a9){const _0x32c29f=_0x4d7d10;return _0x5a76bb[_0x32c29f('0x2f')]=_0x4a20a9,_0x5a76bb;})['then'](respondWithFilteredResult(_0x64070,_0x3c110b))['catch'](handleError(_0x64070,null));},exports[_0x4d238e('0x61')]=function(_0x55b27a,_0x2e40ef){const _0x12c649=_0x4d238e;return!_[_0x12c649('0x12')](_0x55b27a[_0x12c649('0xb4')]['id'])&&(_0x55b27a[_0x12c649('0xb4')][_0x12c649('0x14a')]=='admin'||_0x55b27a['user']['role']==_0x12c649('0xb4'))?db[_0x12c649('0x5c')][_0x12c649('0x68')]({'where':{'id':_0x55b27a[_0x12c649('0x146')]['id']},'raw':!![]})['then'](function(_0x217199){const _0x5bab0c=_0x12c649;return authService[_0x5bab0c('0x5')](_0x217199);})[_0x12c649('0x12f')](function(_0x4bd8c8){const _0x55ff4a=_0x12c649;return _0x4bd8c8?_0x2e40ef[_0x55ff4a('0x38')](0xc8)[_0x55ff4a('0x13f')]({'api_key':_0x4bd8c8[_0x55ff4a('0x25')]}):_0x2e40ef[_0x55ff4a('0x38')](0xcc)[_0x55ff4a('0x13f')]({'message':_0x55ff4a('0x12e')});})['catch'](handleError(_0x2e40ef,0x193)):_0x2e40ef[_0x12c649('0x38')](0x191)[_0x12c649('0x13f')]({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});},exports[_0x4d238e('0x21')]=function(_0x33c01d,_0x49b445){const _0x587b5b=_0x4d238e;return!_['isNil'](_0x33c01d[_0x587b5b('0xb4')]['id'])&&(_0x33c01d[_0x587b5b('0xb4')][_0x587b5b('0x14a')]=='admin'||_0x33c01d[_0x587b5b('0xb4')][_0x587b5b('0x14a')]==_0x587b5b('0xb4'))?db[_0x587b5b('0x8d')][_0x587b5b('0x68')]({'where':{'id':_0x33c01d[_0x587b5b('0x146')]['id']}})[_0x587b5b('0x12f')](function(_0x29aa06){const _0x1ee3e3=_0x587b5b;return authService[_0x1ee3e3('0xd1')](_0x29aa06);})['then'](function(_0x4a8c8a){const _0x472930=_0x587b5b;return db[_0x472930('0x5c')][_0x472930('0x13a')]({'apiKeyIat':_0x4a8c8a[_0x472930('0x103')],'apiKeyNonce':_0x4a8c8a['nonce']},{'where':{'id':_0x33c01d[_0x472930('0x146')]['id']}})[_0x472930('0x12f')](function(){const _0x11913a=_0x472930;return _0x49b445[_0x11913a('0x38')](0xc8)[_0x11913a('0x13f')]({'api_key':_0x4a8c8a[_0x11913a('0x25')]});});})[_0x587b5b('0x87')](handleError(_0x49b445,0x193)):_0x49b445[_0x587b5b('0x38')](0x191)[_0x587b5b('0x13f')]({'message':_0x587b5b('0x4')});},exports['removeApiKey']=function(_0x2bfd57,_0x4117df){const _0x87bd9=_0x4d238e;return!_[_0x87bd9('0x12')](_0x2bfd57[_0x87bd9('0xb4')]['id'])&&(_0x2bfd57['user'][_0x87bd9('0x14a')]=='admin'||_0x2bfd57[_0x87bd9('0xb4')][_0x87bd9('0x14a')]==_0x87bd9('0xb4'))?db[_0x87bd9('0x8d')][_0x87bd9('0x68')]({'where':{'id':_0x2bfd57[_0x87bd9('0x146')]['id']}})[_0x87bd9('0x12f')](handleEntityNotFound(_0x4117df,null))[_0x87bd9('0x12f')](function(_0x1c5d01){const _0x5c341b=_0x87bd9;if(_0x1c5d01&&_0x1c5d01['apiKeyNonce']&&_0x1c5d01[_0x5c341b('0xaa')])return _0x1c5d01;else throw{'message':_0x5c341b('0x119')};})[_0x87bd9('0x12f')](function(){const _0x41d165=_0x87bd9;return db[_0x41d165('0x5c')][_0x41d165('0x13a')]({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x2bfd57['params']['id']}});})['then'](respondWithStatusCode(_0x4117df,0xc8))['catch'](handleError(_0x4117df,0x193)):_0x4117df[_0x87bd9('0x38')](0x191)['json']({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});},exports[_0x4d238e('0x13b')]=function(_0x47a0b8,_0x337a07){const _0x541e0f=_0x4d238e,_0x11c4e6=_0x47a0b8[_0x541e0f('0xb4')][_0x541e0f('0x14f')]({'plain':!![]});return!_0x11c4e6?_0x337a07[_0x541e0f('0x38')](0x191)['send'](_0x541e0f('0x148')):_0x337a07[_0x541e0f('0x38')](0xc8)[_0x541e0f('0x13f')](_0x11c4e6);};
\ No newline at end of file