Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / user / user.controller.js
1 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);};