Built motion from commit 709aa6fb5ed03aa61bc373fcdbf622215d37d30b. Version 3.0.0...
[motion-next.git] / server / api / user / user.controller.js
index c86080f..a6f3eb1 100644 (file)
@@ -1 +1 @@
-const a648_0x3ea4=['destroy','$in','options','server/files/images/logos/default_profile.png','passwordHistoryLimit','getContacts','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','../../mysqldb','Queue:remove','Use','addWhatsappInteractions','send','CmList','offset','LOGIN','body','pauseType','undefined','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','includeAll','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','getAgents','addContacts','resolve','114','105','findAll','Telephones','You\x20can\x27t\x20delete\x20yourself','some','nonce','$not','set','removeOpenchannelAccounts','x-forwarded-for','model','request','removeFaxAccounts','lastPauseAt','getGroups','removeApiKey','$iLike','Tag','all','Mail','sort','penalty','getWhatsappInteractions','Queue:save','Setting','QueueId','Users','Voice','removeWhatsappInteractions','getSmsInteractions','getSquareProjects','dialActive','code','remove','FaxAccount','getChatInteractions','addTeams','newPassword','role','Invalid\x20body\x20format.\x20Use\x20newPassword','whatsapp','sendStatus','mail','No\x20API\x20access\x20key\x20found!','tag','addSmsInteractions','$overlap','info','MemberReport','name','VoicePrefix','VoiceRecording','100','103','Pause','getAvatar','update','getScheduledCalls','ids','getScreenRecordings','type','mobile','updatePasswordsHistory','getWhatsappAccounts','max','removeChatInteractions','user_has_chat_interactions:save','API\x20key\x20not\x20available','Chat','addSmsAccounts','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','getOpenchannelAccounts','forEach','apiKeyNonce','concat','min_internal','fields','validatePasswordPattern','getMailQueues','getOpenchannelQueues','device','addWhatsappAccounts','../../config/utils','loginInPause','enforcePasswordHistory','lastName','user','intrf','$between','remoteAddress','emit','count','upsert','create','format','getChannels','ScreenRecording','status','autoAssociation','path','password','lodash','removeSmsInteractions','like','existsSync','addMailAccounts','faxPause','getFaxAccounts','admin','user_has_openchannel_interactions:remove','voicePause','client','Tags','include','limit','includes','LOGININPAUSE','value','Openchannel','salt','UserProfileSection','User,\x20%s,\x20%s,\x20%s','stringify','telephone','transaction','addFaxAccounts','ChatWebsite','smsPause','then','$eq','%s%s','pause','user_has_chat_interactions:remove','PAUSE','add','userProfileId','getTeams','sms','login','file','omit','getFaxInteractions','json','lower','removeTeams','rows','intersection','attributes','$any','addFaxInteractions','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','apiKeyIat','findByPk','../../config/license/util','CmContact','LOCAL/%s@from-sip/n','isArray','rawAttributes','getMailAccounts','previousPasswords','addSquareProjects','removeAgent','isNil','Unknown\x20channel','capitalize','root','removeSmsAccounts','107','permissions','UserVoiceQueueRt','user_has_fax_interactions:save','bulkCreate','109','debug','stack','getChatWebsites','manual','VoiceMail','user:%s','voicemail','$contained','getVoiceQueues','voice','util','push','order','user_has_whatsapp_interactions:save','and','where','$contains','Agents','user_has_mail_interactions:save','pick','chat','key','SquareProject','Fax','FaxInteraction','findOne','Unable\x20to\x20retrieve\x20the\x20current\x20user','join','message','toLowerCase','color','111','user_has_sms_interactions:save','getApiKey','request\x20sent','mailbox','QueuePause','getSmsQueues','../../config/environment','api','catch','userpic','from','length','flatten','removeQueues','headers','params','removeSquareProjects','query','connection','getDataValue','user_has_mail_interactions:remove','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','addAgent','addQueues','$notIn','socket','Unknown\x20role','phone','getFaxQueues','../../components/auth/service','unpause','UserId','merge','token','108','getVoiceQueuesRt','keys','channel','MailAccount','openchannelPause','email','SIP/%s','addOpenchannelInteractions','SmsInteraction','$gt','isValidChannel','map','describe','UserVoiceQueue.penalty','$lt','get','Content-Range','addChatInteractions','error','User','113','getWhatsappQueues','getOpenchannelInteractions','CmHopper','getVoicePrefixes','user_has_sms_interactions:remove','Team','removeOpenchannelInteractions','Whatsapp','ChatGroup','show','addOpenchannelAccounts','isEmpty','SELECT','find','addChatWebsites','$notLike','Unauthorized','online','getSmsAccounts','removeWhatsappAccounts','sequelize','interface','removeMailAccounts','jayson/promise','$like','$notILike','differenceBy','settingsEnabled','removeChatWebsites','104','whatsapppause','UserProfileResource','getLists','setDataValue','VIRTUAL','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','110','Queue','ignore','removeMailInteractions','User,\x20%s,\x20%s','retrieveApiKey','WhatsappInteraction','$ne','../../rediscache','../../config/logger','internal','addAvatar','download','values','fullname','addMailInteractions','securePassword','getQueues','$lte','agent','checkUserLimits','getChatQueues','Queues','user:forcelogout','getMailInteractions','OpenchannelAccount','oldPassword','ChatInteraction','removeFaxInteractions','DEFAULT\x20PAUSE','files/images/','nolimit','fax','filter','./user.socket','logout','end','filters','MailInteraction','result'];(function(_0x25c17e,_0x3ea40d){const _0xa135b1=function(_0x42aeda){while(--_0x42aeda){_0x25c17e['push'](_0x25c17e['shift']());}};_0xa135b1(++_0x3ea40d);}(a648_0x3ea4,0x1bc));const a648_0xa135=function(_0x25c17e,_0x3ea40d){_0x25c17e=_0x25c17e-0x0;let _0xa135b1=a648_0x3ea4[_0x25c17e];return _0xa135b1;};const _0x463a9f=a648_0xa135;'use strict';const moment=require('moment'),util=require(_0x463a9f('0x80')),path=require(_0x463a9f('0x2c')),fs=require('fs'),_=require(_0x463a9f('0x2e')),{getSocket}=require(_0x463a9f('0xfa')),socket=getSocket(),authService=require(_0x463a9f('0xb3')),qs=require('../../components/parsers/qs'),logger=require(_0x463a9f('0xfb'))(_0x463a9f('0x9d')),utils=require(_0x463a9f('0x1b')),config=require(_0x463a9f('0x9c')),db=require(_0x463a9f('0x121'))['db'],{Op,QueryTypes,fn,col,where,ValidationError}=require(_0x463a9f('0xe2')),licenseUtil=require(_0x463a9f('0x62'));require(_0x463a9f('0x114'))['register'](socket);const jayson=require(_0x463a9f('0xe5')),client=jayson[_0x463a9f('0x38')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42aeda,_0xf8f994,_0x279a37,_0x129777){return new Promise(function(_0x4ddebd,_0x1575c5){const _0x9ee371=a648_0xa135,_0x1fd4e5=_0x129777||client;return _0x1fd4e5[_0x9ee371('0x13f')](_0x42aeda,_0x279a37)[_0x9ee371('0x49')](function(_0x53b83b){const _0x2c491b=_0x9ee371;logger[_0x2c491b('0x163')](_0x2c491b('0xf6'),_0xf8f994,_0x2c491b('0x98')),logger[_0x2c491b('0x76')](_0x2c491b('0x42'),_0xf8f994,'request\x20sent',JSON[_0x2c491b('0x43')](_0x53b83b));if(_0x53b83b['error']){if(_0x53b83b[_0x2c491b('0xcb')][_0x2c491b('0x154')]===0x1f4)return logger[_0x2c491b('0xcb')](_0x2c491b('0xf6'),_0xf8f994,_0x53b83b[_0x2c491b('0xcb')]['message']),_0x1575c5(_0x53b83b[_0x2c491b('0xcb')][_0x2c491b('0x92')]);return logger[_0x2c491b('0xcb')]('User,\x20%s,\x20%s',_0xf8f994,_0x53b83b[_0x2c491b('0xcb')][_0x2c491b('0x92')]),_0x4ddebd(_0x53b83b[_0x2c491b('0xcb')][_0x2c491b('0x92')]);}else logger[_0x2c491b('0x163')](_0x2c491b('0xf6'),_0xf8f994,'request\x20sent'),_0x4ddebd(_0x53b83b[_0x2c491b('0x119')][_0x2c491b('0x92')]);})[_0x9ee371('0x9e')](function(_0x3909fe){const _0x262f8b=_0x9ee371;logger[_0x262f8b('0xcb')](_0x262f8b('0xf6'),_0xf8f994,_0x3909fe),_0x1575c5(_0x3909fe);});});}function respondWithStatusCode(_0x32fd8e,_0x33f560){return _0x33f560=_0x33f560||0xcc,function(_0x408d46){const _0xea8b5=a648_0xa135;if(_0x408d46)return _0x32fd8e[_0xea8b5('0x15d')](_0x33f560);return _0x32fd8e[_0xea8b5('0x2a')](_0x33f560)[_0xea8b5('0x116')]();};}function respondWithResult(_0x43f976,_0xf3aa73){return _0xf3aa73=_0xf3aa73||0xc8,function(_0x43ba07){const _0x2317f3=a648_0xa135;if(_0x43ba07)return _0x43f976[_0x2317f3('0x2a')](_0xf3aa73)[_0x2317f3('0x57')](_0x43ba07);};}function respondWithFilteredResult(_0x379973,_0x409767){return function(_0x249c51){const _0x24cca5=a648_0xa135;if(_0x249c51){const _0x5160e5=_0x249c51[_0x24cca5('0x24')],_0x26221c=_0x409767['offset'];let _0x4204ce=_0x409767[_0x24cca5('0x127')]+_0x409767[_0x24cca5('0x3b')],_0xe96ace;return _0x4204ce>=_0x5160e5?(_0x4204ce=_0x5160e5,_0xe96ace=0xc8):_0xe96ace=0xce,_0x379973[_0x24cca5('0x2a')](_0xe96ace),_0x379973[_0x24cca5('0x13b')](_0x24cca5('0xc9'),_0x26221c+'-'+_0x4204ce+'/'+_0x5160e5)['json'](_0x249c51);}return null;};}function saveUpdates(_0xef4e1b){return function(_0x485523){const _0x53cf49=a648_0xa135;if(_0x485523)return _0x485523[_0x53cf49('0x1')](_0xef4e1b)[_0x53cf49('0x49')](function(_0x11850a){return _0x11850a;});return null;};}function removeEntity(_0x1eb835){return function(_0x3adb5b){const _0x50bb7f=a648_0xa135;if(_0x3adb5b)return _0x3adb5b[_0x50bb7f('0x11a')]()[_0x50bb7f('0x49')](function(){const _0x5234ba=_0x50bb7f,_0x10db6c=_0x3adb5b[_0x5234ba('0xc8')]({'plain':!![]});if(_0x10db6c['role']===_0x5234ba('0x35'))return;const _0x536fe8=[{'name':_0x5234ba('0x14e'),'value':'user','ignore':!![]},{'name':'Agents','value':_0x5234ba('0x105'),'ignore':![]},{'name':_0x5234ba('0x136'),'value':_0x5234ba('0x44'),'ignore':![]}],_0x26f873=_(_0x536fe8)[_0x5234ba('0x113')](_0x5234ba('0xf4'))[_0x5234ba('0xc4')](_0x5234ba('0x3e'))[_0x5234ba('0x3e')]();if(_[_0x5234ba('0x3c')](_0x26f873,_0x10db6c[_0x5234ba('0x15a')]))return;const _0x1f704f=_[_0x5234ba('0xdb')](_0x536fe8,[_0x5234ba('0x3e'),_0x10db6c[_0x5234ba('0x15a')]])[_0x5234ba('0x165')];return db['UserProfileResource']['destroy']({'where':{'type':_0x1f704f,'resourceId':_0x10db6c['id']}})[_0x5234ba('0x49')](function(){return _0x3adb5b;});})['then'](function(){const _0x4be6dd=_0x50bb7f;_0x1eb835[_0x4be6dd('0x2a')](0xcc)[_0x4be6dd('0x116')]();});};}function handleEntityNotFound(_0x27bb09){return function(_0x3c5e64){const _0x43fc7a=a648_0xa135;return!_0x3c5e64&&_0x27bb09[_0x43fc7a('0x15d')](0x194),_0x3c5e64;};}function handleError(_0x2197bb,_0x121be5){return _0x121be5=_0x121be5||0x1f4,function(_0x5182e5){const _0x8df085=a648_0xa135;logger['error'](_0x5182e5[_0x8df085('0x77')]),_0x5182e5[_0x8df085('0x165')]&&delete _0x5182e5[_0x8df085('0x165')],_0x2197bb[_0x8df085('0x2a')](_0x121be5)[_0x8df085('0x125')](_0x5182e5);};}function validateUser(_0x5de8ac){return new Promise(function(_0x488bee,_0xed8811){const _0x199728=a648_0xa135;if(_0x5de8ac[_0x199728('0xfc')])return _0x488bee(_0x5de8ac);return db[_0x199728('0x14c')][_0x199728('0x61')](0x1)['then'](function(_0x4497d2){const _0x2f510e=_0x199728;if(_0x4497d2[_0x2f510e('0x102')])authService['validatePasswordPattern'](_0x5de8ac[_0x2f510e('0x2d')]);db[_0x2f510e('0xcc')][_0x2f510e('0x9')]('internal')['then'](function(_0x181a38){const _0x390594=_0x2f510e;if(_[_0x390594('0x6b')](_0x181a38)){_0x5de8ac[_0x390594('0xfc')]=_0x4497d2['min_internal']||0x1;return;}if(_[_0x390594('0x6b')](_0x4497d2['min_internal'])||_0x4497d2['min_internal']===_0x181a38){_0x5de8ac['internal']=_0x181a38+0x1;return;}if(_0x4497d2[_0x390594('0x14')]>_0x181a38){_0x5de8ac['internal']=_0x4497d2['min_internal'];return;}return db['sequelize'][_0x390594('0xa7')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':QueryTypes[_0x390594('0xda')]})['then'](function(_0x20198){const _0x35ae38=_0x390594;if(_0x20198&&_0x20198[_0x35ae38('0xa1')])for(let _0x21bc81=0x0,_0x2bbd4d=_0x20198['length'];_0x21bc81<_0x2bbd4d&&_[_0x35ae38('0x6b')](_0x5de8ac['internal']);_0x21bc81++){if(_0x4497d2[_0x35ae38('0x14')]<=_0x20198[_0x21bc81][_0x35ae38('0xa0')])_0x5de8ac[_0x35ae38('0xfc')]=_0x20198[_0x21bc81][_0x35ae38('0xa0')];else _0x4497d2[_0x35ae38('0x14')]>_0x20198[_0x21bc81][_0x35ae38('0xa0')]&&_0x4497d2[_0x35ae38('0x14')]<=_0x20198[_0x21bc81]['to']&&(_0x5de8ac['internal']=_0x4497d2['min_internal']);}return _['isNil'](_0x5de8ac[_0x35ae38('0xfc')])&&(_0x5de8ac[_0x35ae38('0xfc')]=_0x181a38+0x1),_0x488bee(_0x5de8ac);});});})[_0x199728('0x9e')](function(_0xfd6768){_0xed8811(_0xfd6768);});});}function updateUser(_0x1968b1){return new Promise(function(_0x2d15dc,_0x12173d){const _0x3a7958=a648_0xa135;try{_0x1968b1[_0x3a7958('0x7c')]&&(_0x1968b1[_0x3a7958('0x99')]=_0x1968b1[_0x3a7958('0xfc')],_0x1968b1[_0x3a7958('0x7a')]={'mailbox':_0x1968b1['internal'],'password':_0x1968b1[_0x3a7958('0x2d')],'fullname':_0x1968b1[_0x3a7958('0x100')],'email':_0x1968b1[_0x3a7958('0xbe')]});if(_0x1968b1[_0x3a7958('0x15a')]===_0x3a7958('0x105')){if(!_0x1968b1[_0x3a7958('0x71')])_0x1968b1[_0x3a7958('0x71')]=['101','102',_0x3a7958('0x169'),_0x3a7958('0xcd'),_0x3a7958('0xf2'),_0x3a7958('0xeb'),_0x3a7958('0x134'),'106',_0x3a7958('0x70'),_0x3a7958('0xb8'),_0x3a7958('0x75'),_0x3a7958('0x168'),_0x3a7958('0x95'),_0x3a7958('0x133')];}_0x2d15dc(_0x1968b1);}catch(_0x16de33){_0x12173d(_0x16de33);}});}exports['index']=function(_0xedda7b,_0x5490d1){const _0x34f618=_0x463a9f;let _0x3fb2a1={};const _0x3d99b3={},_0x376d80={'count':0x0,'rows':[]},_0x321409=_[_0x34f618('0xc4')](db[_0x34f618('0xcc')]['rawAttributes'],function(_0x13c6b7){const _0x1f6172=_0x34f618;return{'name':_0x13c6b7['fieldName'],'type':_0x13c6b7[_0x1f6172('0x5')][_0x1f6172('0x8b')]};});_0x3d99b3['model']=_['differenceBy'](_['map'](_0x321409,_0x34f618('0x165')),[_0x34f618('0x2d'),_0x34f618('0x40')]),_0x3d99b3[_0x34f618('0xa7')]=_[_0x34f618('0xba')](_0xedda7b[_0x34f618('0xa7')]),_0x3d99b3[_0x34f618('0x117')]=_[_0x34f618('0x5b')](_0x3d99b3['model'],_0x3d99b3[_0x34f618('0xa7')]),_0x3fb2a1[_0x34f618('0x5c')]=_[_0x34f618('0x5b')](_0x3d99b3[_0x34f618('0x13e')],qs['fields'](_0xedda7b['query'][_0x34f618('0x15')])),_0x3fb2a1['attributes']=_0x3fb2a1['attributes'][_0x34f618('0xa1')]?_0x3fb2a1[_0x34f618('0x5c')]:_0x3d99b3[_0x34f618('0x13e')];typeof _0xedda7b['query'][_0x34f618('0x111')]===_0x34f618('0x12b')&&(_0x3fb2a1[_0x34f618('0x3b')]=qs['limit'](_0xedda7b[_0x34f618('0xa7')]['limit']),_0x3fb2a1[_0x34f618('0x127')]=qs[_0x34f618('0x127')](_0xedda7b['query'][_0x34f618('0x127')]));_0x3fb2a1[_0x34f618('0x82')]=qs[_0x34f618('0x148')](_0xedda7b[_0x34f618('0xa7')][_0x34f618('0x148')]),_0x3fb2a1[_0x34f618('0x85')]=qs[_0x34f618('0x117')](_[_0x34f618('0x89')](_0xedda7b[_0x34f618('0xa7')],_0x3d99b3['filters']),_0x321409);_0xedda7b[_0x34f618('0xa7')]['filter']&&(_0x3fb2a1[_0x34f618('0x85')]=_[_0x34f618('0xb6')](_0x3fb2a1[_0x34f618('0x85')],{[Op['or']]:_[_0x34f618('0xc4')](_0x321409,function(_0x3ead5c){const _0x1676db=_0x34f618;if(_0x3ead5c[_0x1676db('0x5')]!==_0x1676db('0xf0'))return where(fn(_0x1676db('0x58'),col(_0x3ead5c[_0x1676db('0x165')])),{'$like':fn(_0x1676db('0x58'),'%'+_0xedda7b[_0x1676db('0xa7')]['filter']+'%')});})}));_0x3fb2a1=_['merge']({},_0x3fb2a1,_0xedda7b[_0x34f618('0x11c')]);const _0x2cf3d9={'where':_0x3fb2a1[_0x34f618('0x85')]};return db[_0x34f618('0xcc')][_0x34f618('0x24')](_0x2cf3d9)[_0x34f618('0x49')](function(_0x4a8cea){const _0x513c28=_0x34f618;return _0x376d80[_0x513c28('0x24')]=_0x4a8cea,typeof _0xedda7b[_0x513c28('0xa7')][_0x513c28('0x12e')]!==_0x513c28('0x12b')&&(_0x3fb2a1[_0x513c28('0x3a')]=[{'all':!![]}]),db[_0x513c28('0xcc')][_0x513c28('0x135')](_0x3fb2a1);})[_0x34f618('0x49')](function(_0x32b86e){const _0x464e2b=_0x34f618;return _0x376d80[_0x464e2b('0x5a')]=_0x32b86e,_0x376d80;})['then'](respondWithFilteredResult(_0x5490d1,_0x3fb2a1))[_0x34f618('0x9e')](handleError(_0x5490d1,null));},exports[_0x463a9f('0xd7')]=function(_0x1da13c,_0x4a4581){const _0x2da854=_0x463a9f;let _0x1bcd7d={'raw':![],'where':{'id':_0x1da13c['params']['id']}};const _0x1c4237={};return _0x1c4237[_0x2da854('0x13e')]=_[_0x2da854('0xe8')](_[_0x2da854('0xba')](db[_0x2da854('0xcc')][_0x2da854('0x66')]),[_0x2da854('0x2d'),_0x2da854('0x40')]),_0x1c4237[_0x2da854('0xa7')]=_[_0x2da854('0xba')](_0x1da13c['query']),_0x1c4237[_0x2da854('0x117')]=_[_0x2da854('0x5b')](_0x1c4237[_0x2da854('0x13e')],_0x1c4237[_0x2da854('0xa7')]),_0x1bcd7d['attributes']=_[_0x2da854('0x5b')](_0x1c4237[_0x2da854('0x13e')],qs['fields'](_0x1da13c['query']['fields'])),_0x1bcd7d[_0x2da854('0x5c')]=_0x1bcd7d[_0x2da854('0x5c')][_0x2da854('0xa1')]?_0x1bcd7d['attributes']:_0x1c4237[_0x2da854('0x13e')],_0x1da13c['query'][_0x2da854('0x12e')]&&(_0x1bcd7d[_0x2da854('0x3a')]=[{'all':!![]}]),_0x1bcd7d=_[_0x2da854('0xb6')]({},_0x1bcd7d,_0x1da13c[_0x2da854('0x11c')]),db[_0x2da854('0xcc')][_0x2da854('0x8f')](_0x1bcd7d)['then'](handleEntityNotFound(_0x4a4581,null))[_0x2da854('0x49')](respondWithResult(_0x4a4581,null))[_0x2da854('0x9e')](handleError(_0x4a4581,null));},exports['bulkCreate']=function(_0x422401,_0x4c3cf7){const _0x28ee6c=_0x463a9f,_0x439a92=_0x422401['body'];let _0x3a2240=[];if(_0x422401[_0x28ee6c('0x1f')][_0x28ee6c('0x15a')]==='agent')throw new Error(_0x28ee6c('0xde'));if(_[_0x28ee6c('0x138')](_0x439a92,[_0x28ee6c('0x15a'),_0x28ee6c('0x1f')])&&_0x422401['user'][_0x28ee6c('0x15a')]!=='admin')throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');if(_[_0x28ee6c('0x138')](_0x439a92,[_0x28ee6c('0x15a'),_0x28ee6c('0x35')])&&_0x422401[_0x28ee6c('0x1f')][_0x28ee6c('0x15a')]!==_0x28ee6c('0x35'))throw new Error(_0x28ee6c('0x5f'));return licenseUtil[_0x28ee6c('0x106')](_0x439a92)['then'](function(){return validateUser(_0x439a92[0x0]);})[_0x28ee6c('0x49')](function(){const _0x38726c=_0x28ee6c;for(let _0x351a14=0x1;_0x351a14<_0x439a92[_0x38726c('0xa1')];_0x351a14++){const _0x1e6904=_0x439a92[_0x351a14-0x1]['internal'];if(!_0x439a92[_0x351a14]['internal'])_0x439a92[_0x351a14][_0x38726c('0xfc')]=_0x1e6904+0x1;_0x3a2240[_0x38726c('0x81')](validateUser(_0x439a92[_0x351a14]));}return Promise[_0x38726c('0x146')](_0x3a2240);})[_0x28ee6c('0x49')](function(){const _0x10d14c=_0x28ee6c;_0x3a2240=[];for(let _0x4d2001=0x0;_0x4d2001<_0x439a92['length'];_0x4d2001++){_0x3a2240[_0x10d14c('0x81')](updateUser(_0x439a92[_0x4d2001]));}return Promise[_0x10d14c('0x146')](_0x3a2240);})[_0x28ee6c('0x49')](function(){const _0x25ea10=_0x28ee6c;return _0x3a2240=_0x439a92[_0x25ea10('0xc4')](_0x203c7c=>{const _0x43fa8e=_0x25ea10;return db['User'][_0x43fa8e('0x26')](_0x203c7c,{'include':[{'model':db['VoiceMail'],'as':_0x43fa8e('0x7a')}]})['then'](function(_0x1c5e52){return _0x203c7c['id']=_0x1c5e52['id'],_0x203c7c;});}),Promise[_0x25ea10('0x146')](_0x3a2240);})[_0x28ee6c('0x49')](function(_0x48d9d3){const _0x576595=_0x28ee6c;if(_0x422401[_0x576595('0x129')][_0x576595('0x15a')]===_0x576595('0x1f'))return _0x48d9d3;if(_0x422401['user'][_0x576595('0x15a')]!==_0x576595('0x1f'))return _0x48d9d3;const _0x196f6d=_['some'](_0x48d9d3,function(_0x40961f){const _0x5a46d0=_0x576595;return _0x40961f[_0x5a46d0('0x15a')]==='agent'||_0x40961f['role']===_0x5a46d0('0x44');});if(!_0x196f6d)return _0x48d9d3;return db[_0x576595('0x41')][_0x576595('0x135')]({'where':{'name':{[Op['or']]:[_0x576595('0x87'),'Telephones']},'userProfileId':_0x422401[_0x576595('0x1f')]['userProfileId']},'raw':!![]})[_0x576595('0x49')](function(_0x4ba013){const _0x131e28=_0x576595;if(_[_0x131e28('0xd9')](_0x4ba013)||!_[_0x131e28('0x138')](_0x4ba013,['autoAssociation',0x0]))return _0x48d9d3;_0x3a2240=[];const _0x122911=_(_0x4ba013)[_0x131e28('0xc4')](function(_0x4f85b){const _0x48b1f2=_0x131e28;if(_0x4f85b[_0x48b1f2('0x2b')]===0x1)return;return _0x4f85b['name']==='Agents'?_0x48b1f2('0x105'):'telephone';})['compact']()[_0x131e28('0x3e')]();for(let _0x3c9f1a=0x0;_0x3c9f1a<_0x48d9d3[_0x131e28('0xa1')];_0x3c9f1a++){if(!_[_0x131e28('0x3c')](_0x122911,_0x48d9d3[_0x3c9f1a][_0x131e28('0x15a')]))return;const _0x4a4b54=_0x48d9d3[_0x3c9f1a][_0x131e28('0x15a')]===_0x131e28('0x105')?_0x131e28('0x87'):_0x131e28('0x136');_0x3a2240[_0x131e28('0x81')](db[_0x131e28('0xed')][_0x131e28('0x26')]({'name':_0x48d9d3[_0x3c9f1a][_0x131e28('0x165')],'resourceId':_0x48d9d3[_0x3c9f1a]['id'],'type':_0x4a4b54,'sectionId':_[_0x131e28('0xdb')](_0x4ba013,[_0x131e28('0x165'),_0x4a4b54])['id']},{}));}return Promise[_0x131e28('0x146')](_0x3a2240);});})['then'](respondWithResult(_0x4c3cf7,0xc9))[_0x28ee6c('0x9e')](handleError(_0x4c3cf7,null));},exports[_0x463a9f('0x1')]=function(_0x4cb63b,_0x44a202){const _0x51ce6e=_0x463a9f;return _0x4cb63b[_0x51ce6e('0x129')]['id']&&delete _0x4cb63b[_0x51ce6e('0x129')]['id'],delete _0x4cb63b[_0x51ce6e('0x129')]['role'],db[_0x51ce6e('0xcc')][_0x51ce6e('0x8f')]({'where':{'id':_0x4cb63b['params']['id']}})['then'](handleEntityNotFound(_0x44a202,null))['then'](saveUpdates(_0x4cb63b[_0x51ce6e('0x129')],null))[_0x51ce6e('0x49')](respondWithResult(_0x44a202,null))[_0x51ce6e('0x9e')](handleError(_0x44a202,null));},exports[_0x463a9f('0xc5')]=function(_0x52c0e0,_0x386ab7){const _0x42c555=_0x463a9f;return db[_0x42c555('0xcc')][_0x42c555('0xc5')]()[_0x42c555('0x49')](respondWithResult(_0x386ab7,null))[_0x42c555('0x9e')](handleError(_0x386ab7,null));},exports[_0x463a9f('0x131')]=function(_0x10ee60,_0x39e160){const _0x419e03=_0x463a9f;return db[_0x419e03('0xcc')]['findOne']({'where':{'id':_0x10ee60[_0x419e03('0xa5')]['id']}})[_0x419e03('0x49')](handleEntityNotFound(_0x39e160,null))[_0x419e03('0x49')](function(_0xbbb38f){const _0x36f411=_0x419e03;if(_0xbbb38f)return _0xbbb38f[_0x36f411('0x131')](_0x10ee60[_0x36f411('0x129')]['ids'],{'through':_['omit'](_0x10ee60[_0x36f411('0x129')],[_0x36f411('0x3'),'id'])});})['then'](respondWithResult(_0x39e160,null))[_0x419e03('0x9e')](handleError(_0x39e160,null));},exports[_0x463a9f('0x26')]=function(_0x27386b,_0x5605ca){const _0xa10a31=_0x463a9f;if(_0x27386b[_0xa10a31('0x1f')][_0xa10a31('0x15a')]===_0xa10a31('0x105'))throw new Error('Unauthorized');if(_0x27386b[_0xa10a31('0x129')][_0xa10a31('0x15a')]==='user'&&_0x27386b[_0xa10a31('0x1f')][_0xa10a31('0x15a')]!=='admin')throw new Error(_0xa10a31('0x12f'));if(_0x27386b[_0xa10a31('0x129')][_0xa10a31('0x15a')]==='admin'&&_0x27386b[_0xa10a31('0x1f')]['role']!==_0xa10a31('0x35'))throw new Error(_0xa10a31('0xab'));return licenseUtil[_0xa10a31('0x106')]([_0x27386b['body']])['then'](function(){const _0x490813=_0xa10a31;return validateUser(_0x27386b[_0x490813('0x129')]);})['then'](function(_0x5408a4){return updateUser(_0x5408a4)['then'](function(_0x522b82){const _0x2c990a=a648_0xa135;return _0x522b82[_0x2c990a('0x15a')]===_0x2c990a('0x35')&&(_0x522b82['settingsEnabled']=_0x27386b[_0x2c990a('0x1f')][_0x2c990a('0xe9')],delete _0x522b82[_0x2c990a('0x50')]),_0x522b82;});})['then'](function(_0x426f5d){const _0x520b53=_0xa10a31;return db[_0x520b53('0xcc')][_0x520b53('0x26')](_0x426f5d,{'include':[{'model':db[_0x520b53('0x7a')],'as':'VoiceMail'}]});})[_0xa10a31('0x49')](function(_0x464d13){const _0x5c1486=_0xa10a31;if(_0x27386b['body'][_0x5c1486('0x15a')]===_0x5c1486('0x1f'))return _0x464d13;if(_0x27386b['user'][_0x5c1486('0x15a')]!==_0x5c1486('0x1f'))return _0x464d13;return db[_0x5c1486('0x41')]['findOne']({'where':{'name':_0x464d13[_0x5c1486('0x15a')]==='agent'?_0x5c1486('0x87'):'Telephones','userProfileId':_0x27386b[_0x5c1486('0x1f')][_0x5c1486('0x50')]},'raw':!![]})[_0x5c1486('0x49')](function(_0x599ed8){const _0xe543e=_0x5c1486;if(!_0x599ed8||_0x599ed8[_0xe543e('0x2b')]!=0x0)return _0x464d13;return db[_0xe543e('0xed')]['create']({'name':_0x464d13['name'],'resourceId':_0x464d13['id'],'type':_0x599ed8[_0xe543e('0x165')],'sectionId':_0x599ed8['id']},{})[_0xe543e('0x49')](function(){return _0x464d13;});})[_0x5c1486('0x9e')](function(_0x5b218c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b218c);throw _0x5b218c;});})[_0xa10a31('0x49')](respondWithResult(_0x5605ca,0xc9))[_0xa10a31('0x9e')](handleError(_0x5605ca,null));},exports['changePassword']=function(_0x2b4c65,_0x4626df){const _0x1148ae=_0x463a9f;if(_0x2b4c65[_0x1148ae('0x129')]['id'])delete _0x2b4c65[_0x1148ae('0x129')]['id'];return db[_0x1148ae('0xcc')][_0x1148ae('0x8f')]({'where':{'id':_0x2b4c65[_0x1148ae('0xa5')]['id']}})[_0x1148ae('0x49')](function(_0x268e56){const _0x2beb34=_0x1148ae;if(!_0x268e56)return null;if(_0x268e56['id']===_0x2b4c65[_0x2beb34('0x1f')]['id']){if(!_0x2b4c65[_0x2beb34('0x129')]['oldPassword']||!_0x2b4c65[_0x2beb34('0x129')][_0x2beb34('0x159')])throw new ValidationError('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');if(!_0x268e56['authenticate'](_0x2b4c65[_0x2beb34('0x129')]['oldPassword']))throw new ValidationError('Wrong\x20credentials');if(_0x2b4c65['body'][_0x2beb34('0x10c')]===_0x2b4c65[_0x2beb34('0x129')][_0x2beb34('0x159')])throw new ValidationError(_0x2beb34('0xf1'));}else{if(_0x2b4c65[_0x2beb34('0x1f')][_0x2beb34('0x15a')]==='admin'){if(!_0x2b4c65['body'][_0x2beb34('0x159')])throw new ValidationError(_0x2beb34('0x15b'));}else{if(_0x2b4c65[_0x2beb34('0x1f')][_0x2beb34('0x15a')]==='user'){if(!_0x2b4c65[_0x2beb34('0x129')][_0x2beb34('0x159')])throw new ValidationError(_0x2beb34('0x15b'));if(_0x268e56[_0x2beb34('0x15a')]!==_0x2beb34('0x105'))throw new ValidationError('Unauthorized');}else throw new ValidationError(_0x2beb34('0xde'));}}return _0x268e56;})[_0x1148ae('0x49')](handleEntityNotFound(_0x4626df,null))[_0x1148ae('0x49')](function(_0x2fd71f){const _0xe3cc7c=_0x1148ae;return db['Setting'][_0xe3cc7c('0x8f')]({'attributes':['id','securePassword',_0xe3cc7c('0x1d'),_0xe3cc7c('0x11e')]})[_0xe3cc7c('0x49')](function(_0x4942d1){const _0x316fee=_0xe3cc7c;if(_0x4942d1[_0x316fee('0x102')])authService[_0x316fee('0x16')](_0x2b4c65['body'][_0x316fee('0x159')]);if(!_0x4942d1[_0x316fee('0x1d')]||!_0x2fd71f[_0x316fee('0x68')])return _0x2fd71f;return authService['validatePasswordHistory'](_0x2b4c65[_0x316fee('0x129')][_0x316fee('0x159')],_0x2fd71f[_0x316fee('0x68')],_0x4942d1[_0x316fee('0x11e')]),_0x2fd71f;})[_0xe3cc7c('0x49')](saveUpdates({'password':_0x2b4c65['body'][_0xe3cc7c('0x159')],'passwordResetAt':_0x2b4c65[_0xe3cc7c('0x1f')]['id']==_0x2b4c65[_0xe3cc7c('0xa5')]['id']?moment():null,'previousPasswords':authService[_0xe3cc7c('0x7')](_0x2b4c65[_0xe3cc7c('0x129')][_0xe3cc7c('0x159')],_0x2fd71f[_0xe3cc7c('0x68')])},null));})[_0x1148ae('0x49')](respondWithResult(_0x4626df,null))[_0x1148ae('0x9e')](handleError(_0x4626df,null));},exports[_0x463a9f('0xad')]=function(_0x1fdc6e,_0x34c1c9){const _0x2f8694=_0x463a9f,_0x50748d=_0x1fdc6e[_0x2f8694('0x129')][_0x2f8694('0xbb')];return db[_0x2f8694('0xcc')][_0x2f8694('0x8f')]({'where':{'id':_0x1fdc6e[_0x2f8694('0xa5')]['id']},'attributes':['id',_0x2f8694('0x165'),_0x2f8694('0x15a'),_0x2f8694('0xdf'),_0x2f8694('0x1c'),_0x2f8694('0x37'),_0x2f8694('0xe3')]})[_0x2f8694('0x49')](handleEntityNotFound(_0x34c1c9,null))['then'](function(_0x2f79c1){const _0x3e8a82=_0x2f8694;if(_0x2f79c1){if(!utils[_0x3e8a82('0xc3')](_0x50748d))throw new ValidationError('Unknown\x20channel');return _0x2f79c1[_0x3e8a82('0x4f')+_[_0x3e8a82('0x6d')](_0x50748d['toLowerCase']())+_0x3e8a82('0x108')](_0x1fdc6e[_0x3e8a82('0x129')][_0x3e8a82('0x3')],{'through':{'penalty':_0x1fdc6e[_0x3e8a82('0x129')]['penalty']||0x0}})[_0x3e8a82('0x49')](function(_0x349e75){const _0x50b87b=_0x3e8a82;for(let _0x3833af=0x0;_0x3833af<_0x1fdc6e[_0x50b87b('0x129')][_0x50b87b('0x3')][_0x50b87b('0xa1')];_0x3833af+=0x1){const _0x5c3dc4={'UserId':_0x1fdc6e[_0x50b87b('0xa5')]['id']};_0x5c3dc4[_[_0x50b87b('0x6d')](_0x50748d[_0x50b87b('0x93')]())+_0x50b87b('0x14d')]=_0x1fdc6e[_0x50b87b('0x129')][_0x50b87b('0x3')][_0x3833af],socket[_0x50b87b('0x23')](_0x50b87b('0x1f')+_[_0x50b87b('0x6d')](_0x50748d[_0x50b87b('0x93')]())+_0x50b87b('0x14b'),_0x5c3dc4);}return _0x349e75;})['then'](function(){const _0xefb2d5=_0x3e8a82;if(_0x50748d===_0xefb2d5('0x7f'))return db[_0xefb2d5('0x12d')][_0xefb2d5('0x135')]({'where':{'id':_0x1fdc6e[_0xefb2d5('0x129')][_0xefb2d5('0x3')]||[]},'raw':!![],'attributes':['id','name']});})['then'](function(_0x358cf1){const _0x25c011=_0x3e8a82,_0x150432=_0x2f79c1[_0x25c011('0xc8')]({'plain':!![]}),_0x427ff2=[];if(_0x50748d==='voice'&&_0x150432[_0x25c011('0x15a')]==='agent'&&_0x150432['online']){for(let _0x4efcdd=0x0;_0x4efcdd<_0x358cf1[_0x25c011('0xa1')];_0x4efcdd+=0x1){_0x427ff2[_0x25c011('0x81')]({'membername':_0x150432[_0x25c011('0x165')],'UserId':_0x150432['id'],'queue_name':_0x358cf1[_0x4efcdd][_0x25c011('0x165')],'VoiceQueueId':_0x358cf1[_0x4efcdd]['id'],'interface':_[_0x25c011('0x6b')](_0x150432['interface'])?util['format'](_0x25c011('0xbf'),_0x150432[_0x25c011('0x165')]):_0x150432[_0x25c011('0xe3')],'paused':_0x150432[_0x25c011('0x37')]||![],'penalty':_0x1fdc6e['body'][_0x25c011('0x149')]||0x0});}return Promise[_0x25c011('0x146')](_0x427ff2[_0x25c011('0xc4')](_0x1ff0d4=>{const _0x3d6a3c=_0x25c011;return db[_0x3d6a3c('0x72')][_0x3d6a3c('0x25')](_0x1ff0d4);}));}return _0x2f79c1;});}})[_0x2f8694('0x49')](respondWithStatusCode(_0x34c1c9,null))[_0x2f8694('0x9e')](handleError(_0x34c1c9,null));},exports[_0x463a9f('0xa3')]=function(_0x429bc1,_0x4e4e33){const _0x490f86=_0x463a9f;let _0x1cb16e;return db[_0x490f86('0xcc')][_0x490f86('0x8f')]({'where':{'id':_0x429bc1['params']['id']},'attributes':['id','name','role']})[_0x490f86('0x49')](handleEntityNotFound(_0x4e4e33,null))[_0x490f86('0x49')](function(_0x34f057){const _0xef4c97=_0x490f86;if(_0x34f057){_0x1cb16e=_0x34f057;if(!_0x429bc1[_0xef4c97('0xa7')]['channel']||!utils[_0xef4c97('0xc3')](_0x429bc1[_0xef4c97('0xa7')][_0xef4c97('0xbb')]))throw new ValidationError(_0xef4c97('0x6c'));return _0x34f057[_0xef4c97('0x155')+_[_0xef4c97('0x6d')](_0x429bc1['query'][_0xef4c97('0xbb')][_0xef4c97('0x93')]())+'Queues'](_0x429bc1[_0xef4c97('0xa7')][_0xef4c97('0x3')]);}})[_0x490f86('0x49')](function(_0x24ae84){const _0x2f2f02=_0x490f86;for(let _0x1bb7be=0x0;_0x1bb7be<_0x429bc1['query'][_0x2f2f02('0x3')]['length'];_0x1bb7be+=0x1){const _0x496688={'UserId':_0x429bc1[_0x2f2f02('0xa5')]['id']};_0x496688[_[_0x2f2f02('0x6d')](_0x429bc1[_0x2f2f02('0xa7')][_0x2f2f02('0xbb')][_0x2f2f02('0x93')]())+'QueueId']=_0x429bc1[_0x2f2f02('0xa7')]['ids'][_0x1bb7be],socket[_0x2f2f02('0x23')]('user'+_[_0x2f2f02('0x6d')](_0x429bc1[_0x2f2f02('0xa7')][_0x2f2f02('0xbb')][_0x2f2f02('0x93')]())+'Queue:remove',_0x496688);}return _0x24ae84;})[_0x490f86('0x49')](function(){const _0x4f34de=_0x490f86;if(_0x429bc1[_0x4f34de('0xa7')][_0x4f34de('0xbb')]===_0x4f34de('0x7f'))return db[_0x4f34de('0x72')][_0x4f34de('0x11a')]({'where':{'UserId':_0x429bc1[_0x4f34de('0xa5')]['id'],'VoiceQueueId':_0x429bc1[_0x4f34de('0xa7')]['ids']},'individualHooks':!![]})[_0x4f34de('0x49')](function(){return _0x1cb16e;});return _0x1cb16e;})[_0x490f86('0x49')](respondWithStatusCode(_0x4e4e33,null))[_0x490f86('0x9e')](handleError(_0x4e4e33,null));},exports[_0x463a9f('0xfd')]=function(_0x390f02,_0x2193cf){const _0x5542e4=_0x463a9f;return _0x390f02[_0x5542e4('0x129')][_0x5542e4('0x9f')]=_0x390f02[_0x5542e4('0x54')]['filename'],db[_0x5542e4('0xcc')]['findOne']({'where':{'id':_0x390f02[_0x5542e4('0xa5')]['id']}})[_0x5542e4('0x49')](handleEntityNotFound(_0x2193cf,null))[_0x5542e4('0x49')](saveUpdates(_0x390f02[_0x5542e4('0x129')],null))['then'](respondWithResult(_0x2193cf,null))[_0x5542e4('0x9e')](handleError(_0x2193cf,null));},exports[_0x463a9f('0x0')]=function(_0x569e93,_0x5853af){const _0x435e62=_0x463a9f,_0x5ee56a=path['join'](config['root'],_0x435e62('0x11d'));return db[_0x435e62('0xcc')][_0x435e62('0x8f')]({'where':{'id':_0x569e93['params']['id']},'attributes':['id',_0x435e62('0x9f')],'raw':!![]})['then'](handleEntityNotFound(_0x5853af,null))[_0x435e62('0x49')](function(_0x112348){const _0x43ede4=_0x435e62;if(_0x112348){if(_[_0x43ede4('0x6b')](_0x112348[_0x43ede4('0x9f')]))return _0x5853af['download'](_0x5ee56a);else{if(!fs[_0x43ede4('0x31')](path[_0x43ede4('0x91')](config[_0x43ede4('0x6e')],_0x43ede4('0x110'),_0x112348[_0x43ede4('0x9f')])))return _0x5853af[_0x43ede4('0xfe')](_0x5ee56a);return _0x5853af['download'](path[_0x43ede4('0x91')](config[_0x43ede4('0x6e')],_0x43ede4('0x110'),_0x112348[_0x43ede4('0x9f')]));}}})['catch'](handleError(_0x5853af,null));},exports[_0x463a9f('0x11f')]=function(_0x5cf573,_0x1e4e8b){const _0x359dd5=_0x463a9f;let _0x3ea398={};const _0x2554e7={};let _0x2766ad,_0x4177f5;return db['User'][_0x359dd5('0x8f')]({'where':{'id':_0x5cf573[_0x359dd5('0xa5')]['id']}})[_0x359dd5('0x49')](handleEntityNotFound(_0x1e4e8b,null))[_0x359dd5('0x49')](function(_0x5000a){const _0xeb5bc=_0x359dd5;if(_0x5000a)return _0x2766ad=_0x5000a,_0x2554e7[_0xeb5bc('0x13e')]=_[_0xeb5bc('0xba')](db['CmContact'][_0xeb5bc('0x66')]),_0x2554e7[_0xeb5bc('0xa7')]=_[_0xeb5bc('0xba')](_0x5cf573[_0xeb5bc('0xa7')]),_0x2554e7[_0xeb5bc('0x117')]=_[_0xeb5bc('0x5b')](_0x2554e7['model'],_0x2554e7[_0xeb5bc('0xa7')]),_0x3ea398[_0xeb5bc('0x5c')]=_[_0xeb5bc('0x5b')](_0x2554e7[_0xeb5bc('0x13e')],qs[_0xeb5bc('0x15')](_0x5cf573[_0xeb5bc('0xa7')]['fields'])),_0x3ea398[_0xeb5bc('0x5c')]=_0x3ea398[_0xeb5bc('0x5c')]['length']?_0x3ea398['attributes']:_0x2554e7[_0xeb5bc('0x13e')],_0x3ea398['order']=qs['sort'](_0x5cf573[_0xeb5bc('0xa7')][_0xeb5bc('0x148')]),_0x3ea398[_0xeb5bc('0x85')]=qs[_0xeb5bc('0x117')](_[_0xeb5bc('0x89')](_0x5cf573[_0xeb5bc('0xa7')],_0x2554e7[_0xeb5bc('0x117')])),_0x5cf573[_0xeb5bc('0xa7')][_0xeb5bc('0x113')]&&(_0x3ea398[_0xeb5bc('0x85')]=_['merge'](_0x3ea398['where'],{[Op['or']]:_['map'](_0x3ea398[_0xeb5bc('0x5c')],function(_0x5d6ce6){const _0x3476db=_0xeb5bc,_0x1e7e30={};return _0x1e7e30[_0x5d6ce6]={[Op[_0x3476db('0x30')]]:'%'+_0x5cf573[_0x3476db('0xa7')][_0x3476db('0x113')]+'%'},_0x1e7e30;})})),_0x3ea398=_[_0xeb5bc('0xb6')]({},_0x3ea398,_0x5cf573['options']),_0x2766ad['getContacts'](_0x3ea398);})[_0x359dd5('0x49')](function(_0x352fab){const _0x42eaec=_0x359dd5;if(_0x352fab)return _0x4177f5=_0x352fab[_0x42eaec('0xa1')],typeof _0x5cf573[_0x42eaec('0xa7')][_0x42eaec('0x12e')]!=='undefined'&&(_0x3ea398[_0x42eaec('0x3a')]=[{'model':db[_0x42eaec('0x126')],'as':'List','required':![]},{'model':db[_0x42eaec('0x145')],'as':_0x42eaec('0x39'),'attributes':['id',_0x42eaec('0x165'),_0x42eaec('0x94')],'where':_0x5cf573[_0x42eaec('0xa7')]['tag']?{'id':_0x5cf573[_0x42eaec('0xa7')][_0x42eaec('0x160')]}:undefined,'required':_0x5cf573[_0x42eaec('0xa7')][_0x42eaec('0x160')]?!![]:![]}]),typeof _0x5cf573[_0x42eaec('0xa7')][_0x42eaec('0x111')]==='undefined'&&(_0x3ea398[_0x42eaec('0x3b')]=qs[_0x42eaec('0x3b')](_0x5cf573[_0x42eaec('0xa7')][_0x42eaec('0x3b')]),_0x3ea398[_0x42eaec('0x127')]=qs[_0x42eaec('0x127')](_0x5cf573[_0x42eaec('0xa7')]['offset'])),_0x2766ad[_0x42eaec('0x11f')](_0x3ea398);})[_0x359dd5('0x49')](function(_0x36ff37){if(_0x36ff37)return _0x36ff37?{'count':_0x4177f5,'rows':_0x36ff37}:null;})['then'](respondWithResult(_0x1e4e8b,null))[_0x359dd5('0x9e')](handleError(_0x1e4e8b,null));},exports[_0x463a9f('0x103')]=function(_0x4b84cf,_0x2c3279){const _0x3ccd2e=_0x463a9f;let _0x561e29,_0x591320={},_0x2d2530;return db[_0x3ccd2e('0xcc')][_0x3ccd2e('0x8f')]({'where':{'id':_0x4b84cf[_0x3ccd2e('0xa5')]['id']},'attributes':['id',_0x3ccd2e('0x165'),_0x3ccd2e('0x15a')]})[_0x3ccd2e('0x49')](handleEntityNotFound(_0x2c3279,null))[_0x3ccd2e('0x49')](function(_0x5c4e8f){const _0x4b37de=_0x3ccd2e;if(!utils[_0x4b37de('0xc3')](_0x4b84cf[_0x4b37de('0xa7')][_0x4b37de('0xbb')]))throw new ValidationError(_0x4b37de('0x6c'));_0x561e29=_0x5c4e8f;const _0x213a7b={};_0x213a7b[_0x4b37de('0x13e')]=_['keys'](db[_[_0x4b37de('0x6d')](_0x4b84cf[_0x4b37de('0xa7')][_0x4b37de('0xbb')])+_0x4b37de('0xf3')][_0x4b37de('0x66')]),_0x213a7b[_0x4b37de('0xa7')]=_[_0x4b37de('0xba')](_0x4b84cf[_0x4b37de('0xa7')]),_0x213a7b['filters']=_[_0x4b37de('0x5b')](_0x213a7b['model'],_0x213a7b[_0x4b37de('0xa7')]),_0x591320[_0x4b37de('0x5c')]=_['intersection'](_0x213a7b[_0x4b37de('0x13e')],qs['fields'](_0x4b84cf['query'][_0x4b37de('0x15')])),_0x591320['attributes']=_0x591320[_0x4b37de('0x5c')][_0x4b37de('0xa1')]?_0x591320[_0x4b37de('0x5c')]:_0x213a7b[_0x4b37de('0x13e')],_0x591320[_0x4b37de('0x82')]=qs[_0x4b37de('0x148')](_0x4b84cf['query'][_0x4b37de('0x148')]),_0x591320[_0x4b37de('0x85')]=qs[_0x4b37de('0x117')](_[_0x4b37de('0x89')](_0x4b84cf[_0x4b37de('0xa7')],_0x213a7b[_0x4b37de('0x117')]));_0x4b84cf[_0x4b37de('0xa7')][_0x4b37de('0x113')]&&(_0x591320['where']=_[_0x4b37de('0xb6')](_0x591320['where'],{[Op['or']]:_[_0x4b37de('0xc4')](_0x591320[_0x4b37de('0x5c')],function(_0x530be7){const _0xa5328e=_0x4b37de,_0x32b439={};return _0x32b439[_0x530be7]={[Op['like']]:'%'+_0x4b84cf[_0xa5328e('0xa7')][_0xa5328e('0x113')]+'%'},_0x32b439;})}));_0x591320=_[_0x4b37de('0xb6')]({},_0x591320,_0x4b84cf['options']);switch(_0x561e29[_0x4b37de('0x15a')]){case _0x4b37de('0x35'):return db[_[_0x4b37de('0x6d')](_0x4b84cf[_0x4b37de('0xa7')][_0x4b37de('0xbb')])+_0x4b37de('0xf3')][_0x4b37de('0x135')](_0x591320);case _0x4b37de('0x1f'):case _0x4b37de('0x105'):return _0x561e29[_0x4b37de('0xc8')+_[_0x4b37de('0x6d')](_0x4b84cf[_0x4b37de('0xa7')][_0x4b37de('0xbb')])+_0x4b37de('0x108')](_0x591320);default:throw new ValidationError(_0x4b37de('0xb0'));}})['then'](function(_0x4b825e){const _0x55c438=_0x3ccd2e;_0x2d2530=_0x4b825e[_0x55c438('0xa1')];typeof _0x4b84cf[_0x55c438('0xa7')][_0x55c438('0x111')]===_0x55c438('0x12b')&&(_0x591320[_0x55c438('0x3b')]=qs[_0x55c438('0x3b')](_0x4b84cf['query'][_0x55c438('0x3b')]),_0x591320['offset']=qs[_0x55c438('0x127')](_0x4b84cf[_0x55c438('0xa7')][_0x55c438('0x127')]));switch(_0x561e29[_0x55c438('0x15a')]){case _0x55c438('0x35'):return db[_['capitalize'](_0x4b84cf['query'][_0x55c438('0xbb')])+_0x55c438('0xf3')]['findAll'](_0x591320);case'user':case _0x55c438('0x105'):return _0x561e29[_0x55c438('0xc8')+_[_0x55c438('0x6d')](_0x4b84cf['query'][_0x55c438('0xbb')])+'Queues'](_0x591320);}})['then'](function(_0x4c9971){return{'count':_0x2d2530,'rows':_0x4c9971};})[_0x3ccd2e('0x49')](respondWithResult(_0x2c3279,null))[_0x3ccd2e('0x9e')](handleError(_0x2c3279,null));},exports[_0x463a9f('0xb9')]=function(_0x527a50,_0x1b37ce){const _0x678a71=_0x463a9f;let _0x5ea3f0={};const _0xbcbaee={};let _0x195f09,_0x5e0d6d;return db[_0x678a71('0xcc')][_0x678a71('0x8f')]({'where':{'id':_0x527a50[_0x678a71('0xa5')]['id']}})[_0x678a71('0x49')](handleEntityNotFound(_0x1b37ce,null))[_0x678a71('0x49')](function(_0x1a856b){const _0x3d843d=_0x678a71;if(_0x1a856b)return _0x195f09=_0x1a856b,_0xbcbaee[_0x3d843d('0x13e')]=_[_0x3d843d('0xba')](db['UserVoiceQueueRt'][_0x3d843d('0x66')]),_0xbcbaee['query']=_[_0x3d843d('0xba')](_0x527a50['query']),_0xbcbaee[_0x3d843d('0x117')]=_[_0x3d843d('0x5b')](_0xbcbaee['model'],_0xbcbaee[_0x3d843d('0xa7')]),_0x5ea3f0['attributes']=_['intersection'](_0xbcbaee['model'],qs['fields'](_0x527a50[_0x3d843d('0xa7')][_0x3d843d('0x15')])),_0x5ea3f0[_0x3d843d('0x5c')]=_0x5ea3f0['attributes'][_0x3d843d('0xa1')]?_0x5ea3f0[_0x3d843d('0x5c')]:_0xbcbaee[_0x3d843d('0x13e')],_0x5ea3f0['order']=qs['sort'](_0x527a50[_0x3d843d('0xa7')]['sort']),_0x5ea3f0[_0x3d843d('0x85')]=qs[_0x3d843d('0x117')](_[_0x3d843d('0x89')](_0x527a50[_0x3d843d('0xa7')],_0xbcbaee[_0x3d843d('0x117')])),_0x527a50[_0x3d843d('0xa7')][_0x3d843d('0x113')]&&(_0x5ea3f0[_0x3d843d('0x85')]=_[_0x3d843d('0xb6')](_0x5ea3f0[_0x3d843d('0x85')],{[Op['or']]:_[_0x3d843d('0xc4')](_0x5ea3f0[_0x3d843d('0x5c')],function(_0xa052ce){const _0x3b4d3c=_0x3d843d,_0x581acc={};return _0x581acc[_0xa052ce]={[Op[_0x3b4d3c('0x30')]]:'%'+_0x527a50[_0x3b4d3c('0xa7')][_0x3b4d3c('0x113')]+'%'},_0x581acc;})})),_0x5ea3f0=_['merge']({},_0x5ea3f0,_0x527a50['options']),_0x195f09['getVoiceQueuesRt'](_0x5ea3f0);})[_0x678a71('0x49')](function(_0x57d380){const _0x423f22=_0x678a71;if(_0x57d380)return _0x5e0d6d=_0x57d380[_0x423f22('0xa1')],typeof _0x527a50[_0x423f22('0xa7')][_0x423f22('0x111')]===_0x423f22('0x12b')&&(_0x5ea3f0[_0x423f22('0x3b')]=qs[_0x423f22('0x3b')](_0x527a50[_0x423f22('0xa7')][_0x423f22('0x3b')]),_0x5ea3f0[_0x423f22('0x127')]=qs[_0x423f22('0x127')](_0x527a50[_0x423f22('0xa7')][_0x423f22('0x127')])),_0x195f09[_0x423f22('0xb9')](_0x5ea3f0);})[_0x678a71('0x49')](function(_0x54c40d){if(_0x54c40d)return _0x54c40d?{'count':_0x5e0d6d,'rows':_0x54c40d}:null;})[_0x678a71('0x49')](respondWithResult(_0x1b37ce,null))[_0x678a71('0x9e')](handleError(_0x1b37ce,null));},exports[_0x463a9f('0x142')]=function(_0x345612,_0x50c4a8){const _0x4c916c=_0x463a9f;let _0x4bf65e={};const _0x4c5289={};let _0x4e0e6e,_0x52b438;return db['User'][_0x4c916c('0x8f')]({'where':{'id':_0x345612[_0x4c916c('0xa5')]['id']}})['then'](handleEntityNotFound(_0x50c4a8,null))[_0x4c916c('0x49')](function(_0x5c480d){const _0x3f539c=_0x4c916c;if(_0x5c480d)return _0x4e0e6e=_0x5c480d,_0x4c5289[_0x3f539c('0x13e')]=_[_0x3f539c('0xba')](db[_0x3f539c('0xd6')][_0x3f539c('0x66')]),_0x4c5289[_0x3f539c('0xa7')]=_[_0x3f539c('0xba')](_0x345612['query']),_0x4c5289['filters']=_[_0x3f539c('0x5b')](_0x4c5289[_0x3f539c('0x13e')],_0x4c5289[_0x3f539c('0xa7')]),_0x4bf65e[_0x3f539c('0x5c')]=_[_0x3f539c('0x5b')](_0x4c5289['model'],qs[_0x3f539c('0x15')](_0x345612[_0x3f539c('0xa7')]['fields'])),_0x4bf65e[_0x3f539c('0x5c')]=_0x4bf65e['attributes'][_0x3f539c('0xa1')]?_0x4bf65e[_0x3f539c('0x5c')]:_0x4c5289[_0x3f539c('0x13e')],_0x4bf65e[_0x3f539c('0x82')]=qs['sort'](_0x345612[_0x3f539c('0xa7')][_0x3f539c('0x148')]),_0x4bf65e[_0x3f539c('0x85')]=qs['filters'](_[_0x3f539c('0x89')](_0x345612[_0x3f539c('0xa7')],_0x4c5289['filters'])),_0x345612[_0x3f539c('0xa7')][_0x3f539c('0x113')]&&(_0x4bf65e[_0x3f539c('0x85')]=_[_0x3f539c('0xb6')](_0x4bf65e[_0x3f539c('0x85')],{[Op['or']]:_[_0x3f539c('0xc4')](_0x4bf65e['attributes'],function(_0xcb316c){const _0x171552=_0x3f539c,_0x2a88ad={};return _0x2a88ad[_0xcb316c]={[Op[_0x171552('0x30')]]:'%'+_0x345612['query'][_0x171552('0x113')]+'%'},_0x2a88ad;})})),_0x4bf65e=_[_0x3f539c('0xb6')]({},_0x4bf65e,_0x345612[_0x3f539c('0x11c')]),_0x4e0e6e['getGroups'](_0x4bf65e);})['then'](function(_0x4235ce){const _0x2b1cf5=_0x4c916c;if(_0x4235ce)return _0x52b438=_0x4235ce['length'],typeof _0x345612['query'][_0x2b1cf5('0x111')]===_0x2b1cf5('0x12b')&&(_0x4bf65e[_0x2b1cf5('0x3b')]=qs['limit'](_0x345612[_0x2b1cf5('0xa7')]['limit']),_0x4bf65e['offset']=qs[_0x2b1cf5('0x127')](_0x345612[_0x2b1cf5('0xa7')]['offset'])),_0x4e0e6e[_0x2b1cf5('0x142')](_0x4bf65e);})[_0x4c916c('0x49')](function(_0x4c979b){if(_0x4c979b)return _0x4c979b?{'count':_0x52b438,'rows':_0x4c979b}:null;})[_0x4c916c('0x49')](respondWithResult(_0x50c4a8,null))[_0x4c916c('0x9e')](handleError(_0x50c4a8,null));},exports['getRecordings']=function(_0x1275a9,_0x5cb72a){const _0x2f5b3d=_0x463a9f;let _0x195db0={'raw':!![],'where':{}};const _0x457083={},_0x33f49f={'count':0x0,'rows':[]};return db[_0x2f5b3d('0xcc')][_0x2f5b3d('0x8f')]({'where':{'id':_0x1275a9[_0x2f5b3d('0xa5')]['id']}})[_0x2f5b3d('0x49')](handleEntityNotFound(_0x5cb72a,null))[_0x2f5b3d('0x49')](function(_0x814d6f){const _0x122c32=_0x2f5b3d;if(_0x814d6f)return _0x457083[_0x122c32('0x13e')]=_[_0x122c32('0xba')](db[_0x122c32('0x167')][_0x122c32('0x66')]),_0x457083['query']=_[_0x122c32('0xba')](_0x1275a9['query']),_0x457083[_0x122c32('0x117')]=_[_0x122c32('0x5b')](_0x457083[_0x122c32('0x13e')],_0x457083['query']),_0x195db0[_0x122c32('0x5c')]=_['intersection'](_0x457083[_0x122c32('0x13e')],qs[_0x122c32('0x15')](_0x1275a9[_0x122c32('0xa7')][_0x122c32('0x15')])),_0x195db0[_0x122c32('0x5c')]=_0x195db0[_0x122c32('0x5c')][_0x122c32('0xa1')]?_0x195db0[_0x122c32('0x5c')]:_0x457083[_0x122c32('0x13e')],typeof _0x1275a9['query']['nolimit']==='undefined'&&(_0x195db0[_0x122c32('0x3b')]=qs[_0x122c32('0x3b')](_0x1275a9[_0x122c32('0xa7')][_0x122c32('0x3b')]),_0x195db0[_0x122c32('0x127')]=qs[_0x122c32('0x127')](_0x1275a9['query']['offset'])),_0x195db0[_0x122c32('0x82')]=qs[_0x122c32('0x148')](_0x1275a9['query'][_0x122c32('0x148')]),_0x195db0[_0x122c32('0x85')]=qs[_0x122c32('0x117')](_[_0x122c32('0x89')](_0x1275a9[_0x122c32('0xa7')],_0x457083['filters'])),_0x195db0[_0x122c32('0x85')][_0x122c32('0xb5')]=_0x814d6f['id'],_0x1275a9['query'][_0x122c32('0x113')]&&(_0x195db0[_0x122c32('0x85')]=_[_0x122c32('0xb6')](_0x195db0[_0x122c32('0x85')],{[Op['or']]:_['map'](_0x195db0['attributes'],function(_0x980fb2){const _0x2c4bba=_0x122c32,_0x4a36db={};return _0x4a36db[_0x980fb2]={[Op[_0x2c4bba('0x30')]]:'%'+_0x1275a9[_0x2c4bba('0xa7')][_0x2c4bba('0x113')]+'%'},_0x4a36db;})})),_0x195db0=_['merge']({},_0x195db0,_0x1275a9[_0x122c32('0x11c')]),db[_0x122c32('0x167')][_0x122c32('0x24')]({'where':_0x195db0[_0x122c32('0x85')]})[_0x122c32('0x49')](function(_0x2deadb){const _0x4ca360=_0x122c32;return _0x33f49f[_0x4ca360('0x24')]=_0x2deadb,_0x1275a9[_0x4ca360('0xa7')][_0x4ca360('0x12e')]&&(_0x195db0[_0x4ca360('0x3a')]=[{'all':!![]}]),db[_0x4ca360('0x167')][_0x4ca360('0x135')](_0x195db0);})[_0x122c32('0x49')](function(_0x11abf1){const _0x1cd84d=_0x122c32;return _0x33f49f[_0x1cd84d('0x5a')]=_0x11abf1,_0x33f49f;});})[_0x2f5b3d('0x49')](respondWithFilteredResult(_0x5cb72a,_0x195db0))['catch'](handleError(_0x5cb72a,null));},exports[_0x463a9f('0x4')]=function(_0x435701,_0x5486c9){const _0x99a23e=_0x463a9f;let _0x42517e={'raw':!![],'where':{}};const _0x546d07={},_0x231854={'count':0x0,'rows':[]};return db['User'][_0x99a23e('0x8f')]({'where':{'id':_0x435701[_0x99a23e('0xa5')]['id']}})['then'](handleEntityNotFound(_0x5486c9,null))[_0x99a23e('0x49')](function(_0xe85c0e){const _0x1697e3=_0x99a23e;if(_0xe85c0e)return _0x546d07[_0x1697e3('0x13e')]=_['keys'](db['ScreenRecording'][_0x1697e3('0x66')]),_0x546d07['query']=_[_0x1697e3('0xba')](_0x435701[_0x1697e3('0xa7')]),_0x546d07[_0x1697e3('0x117')]=_[_0x1697e3('0x5b')](_0x546d07[_0x1697e3('0x13e')],_0x546d07[_0x1697e3('0xa7')]),_0x42517e[_0x1697e3('0x5c')]=_[_0x1697e3('0x5b')](_0x546d07[_0x1697e3('0x13e')],qs[_0x1697e3('0x15')](_0x435701[_0x1697e3('0xa7')][_0x1697e3('0x15')])),_0x42517e[_0x1697e3('0x5c')]=_0x42517e[_0x1697e3('0x5c')][_0x1697e3('0xa1')]?_0x42517e['attributes']:_0x546d07[_0x1697e3('0x13e')],typeof _0x435701[_0x1697e3('0xa7')][_0x1697e3('0x111')]==='undefined'&&(_0x42517e[_0x1697e3('0x3b')]=qs[_0x1697e3('0x3b')](_0x435701['query']['limit']),_0x42517e['offset']=qs['offset'](_0x435701['query'][_0x1697e3('0x127')])),_0x42517e[_0x1697e3('0x82')]=qs[_0x1697e3('0x148')](_0x435701[_0x1697e3('0xa7')]['sort']),_0x42517e[_0x1697e3('0x85')]=qs[_0x1697e3('0x117')](_['pick'](_0x435701[_0x1697e3('0xa7')],_0x546d07[_0x1697e3('0x117')])),_0x42517e['where']['UserId']=_0xe85c0e['id'],_0x435701[_0x1697e3('0xa7')][_0x1697e3('0x113')]&&(_0x42517e[_0x1697e3('0x85')]=_[_0x1697e3('0xb6')](_0x42517e[_0x1697e3('0x85')],{[Op['or']]:_[_0x1697e3('0xc4')](_0x42517e[_0x1697e3('0x5c')],function(_0x4e198c){const _0x2e1067=_0x1697e3,_0x1c2f2b={};return _0x1c2f2b[_0x4e198c]={[Op[_0x2e1067('0x30')]]:'%'+_0x435701['query'][_0x2e1067('0x113')]+'%'},_0x1c2f2b;})})),_0x42517e=_['merge']({},_0x42517e,_0x435701[_0x1697e3('0x11c')]),db['ScreenRecording'][_0x1697e3('0x24')]({'where':_0x42517e[_0x1697e3('0x85')]})['then'](function(_0x4a67a0){const _0x456c57=_0x1697e3;return _0x231854[_0x456c57('0x24')]=_0x4a67a0,_0x435701['query']['includeAll']&&(_0x42517e[_0x456c57('0x3a')]=[{'all':!![]}]),db[_0x456c57('0x29')][_0x456c57('0x135')](_0x42517e);})[_0x1697e3('0x49')](function(_0x39ab8e){const _0x30ed46=_0x1697e3;return _0x231854[_0x30ed46('0x5a')]=_0x39ab8e,_0x231854;});})[_0x99a23e('0x49')](respondWithFilteredResult(_0x5486c9,_0x42517e))[_0x99a23e('0x9e')](handleError(_0x5486c9,null));},exports[_0x463a9f('0x157')]=function(_0x44b578,_0x2288ac){const _0x403cb8=_0x463a9f;let _0x2603f7={};const _0x13e0f9={};let _0x35fdda,_0x507f80;return db[_0x403cb8('0xcc')][_0x403cb8('0x8f')]({'where':{'id':_0x44b578['params']['id']}})[_0x403cb8('0x49')](handleEntityNotFound(_0x2288ac,null))[_0x403cb8('0x49')](function(_0x219454){const _0x45a1fe=_0x403cb8;if(_0x219454)return _0x35fdda=_0x219454,_0x13e0f9[_0x45a1fe('0x13e')]=_[_0x45a1fe('0xba')](db[_0x45a1fe('0x10d')][_0x45a1fe('0x66')]),_0x13e0f9['query']=_[_0x45a1fe('0xba')](_0x44b578[_0x45a1fe('0xa7')]),_0x13e0f9[_0x45a1fe('0x117')]=_[_0x45a1fe('0x5b')](_0x13e0f9[_0x45a1fe('0x13e')],_0x13e0f9['query']),_0x2603f7['attributes']=_['intersection'](_0x13e0f9[_0x45a1fe('0x13e')],qs[_0x45a1fe('0x15')](_0x44b578['query'][_0x45a1fe('0x15')])),_0x2603f7[_0x45a1fe('0x5c')]=_0x2603f7['attributes'][_0x45a1fe('0xa1')]?_0x2603f7['attributes']:_0x13e0f9[_0x45a1fe('0x13e')],_0x2603f7['order']=qs[_0x45a1fe('0x148')](_0x44b578[_0x45a1fe('0xa7')]['sort']),_0x2603f7[_0x45a1fe('0x85')]=qs[_0x45a1fe('0x117')](_['pick'](_0x44b578[_0x45a1fe('0xa7')],_0x13e0f9[_0x45a1fe('0x117')])),_0x44b578[_0x45a1fe('0xa7')][_0x45a1fe('0x113')]&&(_0x2603f7['where']=_['merge'](_0x2603f7[_0x45a1fe('0x85')],{[Op['or']]:_[_0x45a1fe('0xc4')](_0x2603f7['attributes'],function(_0x5e7b18){const _0xa78864=_0x45a1fe,_0x1b6de9={};return _0x1b6de9[_0x5e7b18]={[Op[_0xa78864('0x30')]]:'%'+_0x44b578[_0xa78864('0xa7')][_0xa78864('0x113')]+'%'},_0x1b6de9;})})),_0x2603f7=_[_0x45a1fe('0xb6')]({},_0x2603f7,_0x44b578[_0x45a1fe('0x11c')]),_0x35fdda['getChatInteractions'](_0x2603f7);})[_0x403cb8('0x49')](function(_0x45938d){const _0x4e1c0b=_0x403cb8;if(_0x45938d)return _0x507f80=_0x45938d[_0x4e1c0b('0xa1')],typeof _0x44b578['query'][_0x4e1c0b('0x111')]===_0x4e1c0b('0x12b')&&(_0x2603f7[_0x4e1c0b('0x3b')]=qs[_0x4e1c0b('0x3b')](_0x44b578[_0x4e1c0b('0xa7')][_0x4e1c0b('0x3b')]),_0x2603f7[_0x4e1c0b('0x127')]=qs['offset'](_0x44b578[_0x4e1c0b('0xa7')]['offset'])),_0x35fdda['getChatInteractions'](_0x2603f7);})[_0x403cb8('0x49')](function(_0x69324d){if(_0x69324d)return _0x69324d?{'count':_0x507f80,'rows':_0x69324d}:null;})['then'](respondWithResult(_0x2288ac,null))[_0x403cb8('0x9e')](handleError(_0x2288ac,null));},exports['getOpenchannelInteractions']=function(_0x4d3381,_0x2653d1){const _0x136a15=_0x463a9f;let _0x514fd3={};const _0x1d2a26={};let _0x1264a1,_0x303769;return db[_0x136a15('0xcc')][_0x136a15('0x8f')]({'where':{'id':_0x4d3381[_0x136a15('0xa5')]['id']}})[_0x136a15('0x49')](handleEntityNotFound(_0x2653d1,null))[_0x136a15('0x49')](function(_0x2b9099){const _0x291457=_0x136a15;if(_0x2b9099)return _0x1264a1=_0x2b9099,_0x1d2a26['model']=_[_0x291457('0xba')](db['OpenchannelInteraction'][_0x291457('0x66')]),_0x1d2a26['query']=_[_0x291457('0xba')](_0x4d3381[_0x291457('0xa7')]),_0x1d2a26['filters']=_[_0x291457('0x5b')](_0x1d2a26['model'],_0x1d2a26[_0x291457('0xa7')]),_0x514fd3[_0x291457('0x5c')]=_[_0x291457('0x5b')](_0x1d2a26[_0x291457('0x13e')],qs[_0x291457('0x15')](_0x4d3381[_0x291457('0xa7')][_0x291457('0x15')])),_0x514fd3['attributes']=_0x514fd3[_0x291457('0x5c')][_0x291457('0xa1')]?_0x514fd3[_0x291457('0x5c')]:_0x1d2a26[_0x291457('0x13e')],_0x514fd3[_0x291457('0x82')]=qs[_0x291457('0x148')](_0x4d3381[_0x291457('0xa7')][_0x291457('0x148')]),_0x514fd3[_0x291457('0x85')]=qs[_0x291457('0x117')](_[_0x291457('0x89')](_0x4d3381[_0x291457('0xa7')],_0x1d2a26[_0x291457('0x117')])),_0x4d3381[_0x291457('0xa7')][_0x291457('0x113')]&&(_0x514fd3[_0x291457('0x85')]=_[_0x291457('0xb6')](_0x514fd3[_0x291457('0x85')],{[Op['or']]:_[_0x291457('0xc4')](_0x514fd3['attributes'],function(_0x5f088b){const _0x27dda0=_0x291457,_0x57b712={};return _0x57b712[_0x5f088b]={[Op[_0x27dda0('0x30')]]:'%'+_0x4d3381[_0x27dda0('0xa7')][_0x27dda0('0x113')]+'%'},_0x57b712;})})),_0x514fd3=_[_0x291457('0xb6')]({},_0x514fd3,_0x4d3381[_0x291457('0x11c')]),_0x1264a1[_0x291457('0xcf')](_0x514fd3);})[_0x136a15('0x49')](function(_0x3d3353){const _0x274d3c=_0x136a15;if(_0x3d3353)return _0x303769=_0x3d3353['length'],typeof _0x4d3381[_0x274d3c('0xa7')][_0x274d3c('0x111')]===_0x274d3c('0x12b')&&(_0x514fd3[_0x274d3c('0x3b')]=qs['limit'](_0x4d3381[_0x274d3c('0xa7')]['limit']),_0x514fd3['offset']=qs[_0x274d3c('0x127')](_0x4d3381[_0x274d3c('0xa7')][_0x274d3c('0x127')])),_0x1264a1[_0x274d3c('0xcf')](_0x514fd3);})['then'](function(_0x2afbdb){if(_0x2afbdb)return _0x2afbdb?{'count':_0x303769,'rows':_0x2afbdb}:null;})[_0x136a15('0x49')](respondWithResult(_0x2653d1,null))['catch'](handleError(_0x2653d1,null));},exports[_0x463a9f('0x10a')]=function(_0x4b81d8,_0x33d51b){const _0x3c5044=_0x463a9f;let _0xdf9bdd={'raw':!![],'where':{}};const _0x57a5dd={},_0x592520={'count':0x0,'rows':[]};return db[_0x3c5044('0xcc')][_0x3c5044('0x8f')]({'where':{'id':_0x4b81d8['params']['id']}})[_0x3c5044('0x49')](handleEntityNotFound(_0x33d51b,null))[_0x3c5044('0x49')](function(_0x674a77){const _0x4b84eb=_0x3c5044;if(_0x674a77)return _0x57a5dd[_0x4b84eb('0x13e')]=_[_0x4b84eb('0xba')](db[_0x4b84eb('0x118')][_0x4b84eb('0x66')]),_0x57a5dd[_0x4b84eb('0xa7')]=_[_0x4b84eb('0xba')](_0x4b81d8[_0x4b84eb('0xa7')]),_0x57a5dd[_0x4b84eb('0x117')]=_[_0x4b84eb('0x5b')](_0x57a5dd[_0x4b84eb('0x13e')],_0x57a5dd[_0x4b84eb('0xa7')]),_0xdf9bdd[_0x4b84eb('0x5c')]=_[_0x4b84eb('0x5b')](_0x57a5dd[_0x4b84eb('0x13e')],qs[_0x4b84eb('0x15')](_0x4b81d8[_0x4b84eb('0xa7')][_0x4b84eb('0x15')])),_0xdf9bdd['attributes']=_0xdf9bdd[_0x4b84eb('0x5c')][_0x4b84eb('0xa1')]?_0xdf9bdd['attributes']:_0x57a5dd[_0x4b84eb('0x13e')],typeof _0x4b81d8[_0x4b84eb('0xa7')][_0x4b84eb('0x111')]===_0x4b84eb('0x12b')&&(_0xdf9bdd['limit']=qs['limit'](_0x4b81d8['query']['limit']),_0xdf9bdd['offset']=qs['offset'](_0x4b81d8['query'][_0x4b84eb('0x127')])),_0xdf9bdd[_0x4b84eb('0x82')]=qs[_0x4b84eb('0x148')](_0x4b81d8[_0x4b84eb('0xa7')]['sort']),_0xdf9bdd['where']=qs[_0x4b84eb('0x117')](_[_0x4b84eb('0x89')](_0x4b81d8[_0x4b84eb('0xa7')],_0x57a5dd[_0x4b84eb('0x117')])),_0xdf9bdd[_0x4b84eb('0x85')][_0x4b84eb('0xb5')]=_0x674a77['id'],_0x4b81d8[_0x4b84eb('0xa7')]['filter']&&(_0xdf9bdd[_0x4b84eb('0x85')]=_[_0x4b84eb('0xb6')](_0xdf9bdd[_0x4b84eb('0x85')],{[Op['or']]:_[_0x4b84eb('0xc4')](_0xdf9bdd['attributes'],function(_0x2de6c5){const _0x8c562d=_0x4b84eb,_0x45a966={};return _0x45a966[_0x2de6c5]={[Op[_0x8c562d('0x30')]]:'%'+_0x4b81d8['query']['filter']+'%'},_0x45a966;})})),_0xdf9bdd=_[_0x4b84eb('0xb6')]({},_0xdf9bdd,_0x4b81d8[_0x4b84eb('0x11c')]),db[_0x4b84eb('0x118')][_0x4b84eb('0x24')]({'where':_0xdf9bdd[_0x4b84eb('0x85')]})[_0x4b84eb('0x49')](function(_0x44de){const _0x4813e3=_0x4b84eb;return _0x592520[_0x4813e3('0x24')]=_0x44de,_0x4b81d8[_0x4813e3('0xa7')][_0x4813e3('0x12e')]&&(_0xdf9bdd[_0x4813e3('0x3a')]=[{'all':!![]}]),db[_0x4813e3('0x118')]['findAll'](_0xdf9bdd);})['then'](function(_0x8ac5ca){const _0x46e22e=_0x4b84eb;return _0x592520[_0x46e22e('0x5a')]=_0x8ac5ca,_0x592520;});})[_0x3c5044('0x49')](respondWithFilteredResult(_0x33d51b,_0xdf9bdd))[_0x3c5044('0x9e')](handleError(_0x33d51b,null));},exports[_0x463a9f('0x151')]=function(_0x1f92f4,_0x9d6b3e){const _0x4b8fec=_0x463a9f;let _0x467143={};const _0x1e831a={};let _0x3faebe,_0x13ac0a;return db[_0x4b8fec('0xcc')][_0x4b8fec('0x8f')]({'where':{'id':_0x1f92f4[_0x4b8fec('0xa5')]['id']}})['then'](handleEntityNotFound(_0x9d6b3e,null))[_0x4b8fec('0x49')](function(_0x5864f4){const _0x56fb6b=_0x4b8fec;if(_0x5864f4)return _0x3faebe=_0x5864f4,_0x1e831a[_0x56fb6b('0x13e')]=_[_0x56fb6b('0xba')](db[_0x56fb6b('0xc1')][_0x56fb6b('0x66')]),_0x1e831a['query']=_[_0x56fb6b('0xba')](_0x1f92f4[_0x56fb6b('0xa7')]),_0x1e831a[_0x56fb6b('0x117')]=_[_0x56fb6b('0x5b')](_0x1e831a[_0x56fb6b('0x13e')],_0x1e831a[_0x56fb6b('0xa7')]),_0x467143[_0x56fb6b('0x5c')]=_[_0x56fb6b('0x5b')](_0x1e831a['model'],qs[_0x56fb6b('0x15')](_0x1f92f4[_0x56fb6b('0xa7')]['fields'])),_0x467143['attributes']=_0x467143[_0x56fb6b('0x5c')][_0x56fb6b('0xa1')]?_0x467143[_0x56fb6b('0x5c')]:_0x1e831a[_0x56fb6b('0x13e')],_0x467143[_0x56fb6b('0x82')]=qs[_0x56fb6b('0x148')](_0x1f92f4[_0x56fb6b('0xa7')][_0x56fb6b('0x148')]),_0x467143[_0x56fb6b('0x85')]=qs[_0x56fb6b('0x117')](_[_0x56fb6b('0x89')](_0x1f92f4[_0x56fb6b('0xa7')],_0x1e831a[_0x56fb6b('0x117')])),_0x1f92f4[_0x56fb6b('0xa7')][_0x56fb6b('0x113')]&&(_0x467143[_0x56fb6b('0x85')]=_[_0x56fb6b('0xb6')](_0x467143['where'],{[Op['or']]:_[_0x56fb6b('0xc4')](_0x467143[_0x56fb6b('0x5c')],function(_0x58778b){const _0x31129e=_0x56fb6b,_0x3d232d={};return _0x3d232d[_0x58778b]={[Op[_0x31129e('0x30')]]:'%'+_0x1f92f4['query'][_0x31129e('0x113')]+'%'},_0x3d232d;})})),_0x467143=_[_0x56fb6b('0xb6')]({},_0x467143,_0x1f92f4['options']),_0x3faebe[_0x56fb6b('0x151')](_0x467143);})[_0x4b8fec('0x49')](function(_0xa0556){const _0x1073cf=_0x4b8fec;if(_0xa0556)return _0x13ac0a=_0xa0556[_0x1073cf('0xa1')],typeof _0x1f92f4['query'][_0x1073cf('0x111')]===_0x1073cf('0x12b')&&(_0x467143[_0x1073cf('0x3b')]=qs[_0x1073cf('0x3b')](_0x1f92f4['query']['limit']),_0x467143[_0x1073cf('0x127')]=qs[_0x1073cf('0x127')](_0x1f92f4[_0x1073cf('0xa7')][_0x1073cf('0x127')])),_0x3faebe[_0x1073cf('0x151')](_0x467143);})[_0x4b8fec('0x49')](function(_0x9ebc6d){if(_0x9ebc6d)return _0x9ebc6d?{'count':_0x13ac0a,'rows':_0x9ebc6d}:null;})[_0x4b8fec('0x49')](respondWithResult(_0x9d6b3e,null))[_0x4b8fec('0x9e')](handleError(_0x9d6b3e,null));},exports[_0x463a9f('0x56')]=function(_0x5e7eea,_0x189553){const _0x439a20=_0x463a9f;let _0x2ebcb8={};const _0x1c5ba4={};let _0x44350a,_0x3db6f3;return db[_0x439a20('0xcc')][_0x439a20('0x8f')]({'where':{'id':_0x5e7eea[_0x439a20('0xa5')]['id']}})[_0x439a20('0x49')](handleEntityNotFound(_0x189553,null))[_0x439a20('0x49')](function(_0x429f41){const _0x15f4c3=_0x439a20;if(_0x429f41)return _0x44350a=_0x429f41,_0x1c5ba4[_0x15f4c3('0x13e')]=_['keys'](db[_0x15f4c3('0x8e')][_0x15f4c3('0x66')]),_0x1c5ba4[_0x15f4c3('0xa7')]=_[_0x15f4c3('0xba')](_0x5e7eea[_0x15f4c3('0xa7')]),_0x1c5ba4[_0x15f4c3('0x117')]=_[_0x15f4c3('0x5b')](_0x1c5ba4[_0x15f4c3('0x13e')],_0x1c5ba4['query']),_0x2ebcb8[_0x15f4c3('0x5c')]=_['intersection'](_0x1c5ba4[_0x15f4c3('0x13e')],qs[_0x15f4c3('0x15')](_0x5e7eea[_0x15f4c3('0xa7')]['fields'])),_0x2ebcb8[_0x15f4c3('0x5c')]=_0x2ebcb8[_0x15f4c3('0x5c')][_0x15f4c3('0xa1')]?_0x2ebcb8[_0x15f4c3('0x5c')]:_0x1c5ba4[_0x15f4c3('0x13e')],_0x2ebcb8[_0x15f4c3('0x82')]=qs[_0x15f4c3('0x148')](_0x5e7eea[_0x15f4c3('0xa7')][_0x15f4c3('0x148')]),_0x2ebcb8[_0x15f4c3('0x85')]=qs[_0x15f4c3('0x117')](_[_0x15f4c3('0x89')](_0x5e7eea[_0x15f4c3('0xa7')],_0x1c5ba4['filters'])),_0x5e7eea[_0x15f4c3('0xa7')][_0x15f4c3('0x113')]&&(_0x2ebcb8['where']=_['merge'](_0x2ebcb8['where'],{[Op['or']]:_['map'](_0x2ebcb8['attributes'],function(_0x210172){const _0x18b423=_0x15f4c3,_0x5d6221={};return _0x5d6221[_0x210172]={[Op[_0x18b423('0x30')]]:'%'+_0x5e7eea[_0x18b423('0xa7')][_0x18b423('0x113')]+'%'},_0x5d6221;})})),_0x2ebcb8=_[_0x15f4c3('0xb6')]({},_0x2ebcb8,_0x5e7eea['options']),_0x44350a[_0x15f4c3('0x56')](_0x2ebcb8);})[_0x439a20('0x49')](function(_0x434869){const _0x12315e=_0x439a20;if(_0x434869)return _0x3db6f3=_0x434869['length'],typeof _0x5e7eea[_0x12315e('0xa7')][_0x12315e('0x111')]==='undefined'&&(_0x2ebcb8['limit']=qs[_0x12315e('0x3b')](_0x5e7eea[_0x12315e('0xa7')][_0x12315e('0x3b')]),_0x2ebcb8[_0x12315e('0x127')]=qs['offset'](_0x5e7eea[_0x12315e('0xa7')][_0x12315e('0x127')])),_0x44350a[_0x12315e('0x56')](_0x2ebcb8);})[_0x439a20('0x49')](function(_0x277597){if(_0x277597)return _0x277597?{'count':_0x3db6f3,'rows':_0x277597}:null;})['then'](respondWithResult(_0x189553,null))[_0x439a20('0x9e')](handleError(_0x189553,null));},exports[_0x463a9f('0x14a')]=function(_0x46c448,_0x5d7c41){const _0x593f56=_0x463a9f;let _0x2cb2a5={};const _0x27ab2b={};let _0x2f3331,_0x170a03;return db['User']['findOne']({'where':{'id':_0x46c448['params']['id']}})[_0x593f56('0x49')](handleEntityNotFound(_0x5d7c41,null))[_0x593f56('0x49')](function(_0x2477bf){const _0x5ce8ff=_0x593f56;if(_0x2477bf)return _0x2f3331=_0x2477bf,_0x27ab2b[_0x5ce8ff('0x13e')]=_[_0x5ce8ff('0xba')](db[_0x5ce8ff('0xf8')]['rawAttributes']),_0x27ab2b[_0x5ce8ff('0xa7')]=_['keys'](_0x46c448[_0x5ce8ff('0xa7')]),_0x27ab2b[_0x5ce8ff('0x117')]=_[_0x5ce8ff('0x5b')](_0x27ab2b[_0x5ce8ff('0x13e')],_0x27ab2b[_0x5ce8ff('0xa7')]),_0x2cb2a5[_0x5ce8ff('0x5c')]=_[_0x5ce8ff('0x5b')](_0x27ab2b[_0x5ce8ff('0x13e')],qs[_0x5ce8ff('0x15')](_0x46c448[_0x5ce8ff('0xa7')][_0x5ce8ff('0x15')])),_0x2cb2a5[_0x5ce8ff('0x5c')]=_0x2cb2a5['attributes']['length']?_0x2cb2a5[_0x5ce8ff('0x5c')]:_0x27ab2b[_0x5ce8ff('0x13e')],_0x2cb2a5['order']=qs['sort'](_0x46c448[_0x5ce8ff('0xa7')]['sort']),_0x2cb2a5[_0x5ce8ff('0x85')]=qs[_0x5ce8ff('0x117')](_[_0x5ce8ff('0x89')](_0x46c448['query'],_0x27ab2b[_0x5ce8ff('0x117')])),_0x46c448[_0x5ce8ff('0xa7')][_0x5ce8ff('0x113')]&&(_0x2cb2a5['where']=_[_0x5ce8ff('0xb6')](_0x2cb2a5[_0x5ce8ff('0x85')],{[Op['or']]:_[_0x5ce8ff('0xc4')](_0x2cb2a5[_0x5ce8ff('0x5c')],function(_0x2d5b84){const _0x3fad44=_0x5ce8ff,_0x3e0f89={};return _0x3e0f89[_0x2d5b84]={[Op[_0x3fad44('0x30')]]:'%'+_0x46c448['query'][_0x3fad44('0x113')]+'%'},_0x3e0f89;})})),_0x2cb2a5=_['merge']({},_0x2cb2a5,_0x46c448['options']),_0x2f3331[_0x5ce8ff('0x14a')](_0x2cb2a5);})['then'](function(_0x3b15e6){const _0x4432aa=_0x593f56;if(_0x3b15e6)return _0x170a03=_0x3b15e6[_0x4432aa('0xa1')],typeof _0x46c448[_0x4432aa('0xa7')][_0x4432aa('0x111')]===_0x4432aa('0x12b')&&(_0x2cb2a5[_0x4432aa('0x3b')]=qs[_0x4432aa('0x3b')](_0x46c448[_0x4432aa('0xa7')][_0x4432aa('0x3b')]),_0x2cb2a5['offset']=qs['offset'](_0x46c448[_0x4432aa('0xa7')]['offset'])),_0x2f3331['getWhatsappInteractions'](_0x2cb2a5);})[_0x593f56('0x49')](function(_0x546c0e){if(_0x546c0e)return _0x546c0e?{'count':_0x170a03,'rows':_0x546c0e}:null;})[_0x593f56('0x49')](respondWithResult(_0x5d7c41,null))[_0x593f56('0x9e')](handleError(_0x5d7c41,null));},exports[_0x463a9f('0x53')]=function(_0xa1988a,_0x4870e4,_0x178e7f){const _0x37a5b1=_0x463a9f;let _0x3c415c,_0x330e09,_0x44e04c;const _0x56d05f=!_[_0x37a5b1('0x6b')](_0xa1988a['params']['id'])?_0xa1988a['params']['id']:!_[_0x37a5b1('0x6b')](_0xa1988a[_0x37a5b1('0x1f')]['id'])?_0xa1988a['user']['id']:null;return db[_0x37a5b1('0xcc')][_0x37a5b1('0x8f')]({'where':{'id':_0x56d05f,'role':{[Op['or']]:['admin',_0x37a5b1('0x1f'),_0x37a5b1('0x105')]}},'attributes':['id',_0x37a5b1('0x165'),_0x37a5b1('0xb1'),_0x37a5b1('0x6'),_0x37a5b1('0x15a'),_0x37a5b1('0xfc'),_0x37a5b1('0x1c')]})[_0x37a5b1('0x49')](function(_0xa76de7){const _0x49516d=_0x37a5b1;if(_0xa76de7){if(_0xa76de7[_0x49516d('0x15a')]===_0x49516d('0x105')){_0x3c415c=_0xa76de7;if(_0xa1988a[_0x49516d('0x129')][_0x49516d('0xe3')])_0x44e04c=util['format'](_0x49516d('0x64'),_0x3c415c[_0xa1988a['body'][_0x49516d('0xe3')]]);else _0xa1988a['body']['intrf']?_0x44e04c=util[_0x49516d('0x27')](_0x49516d('0xbf'),_0xa1988a[_0x49516d('0x129')][_0x49516d('0x20')]):_0x44e04c=util[_0x49516d('0x27')](_0x49516d('0xbf'),_0x3c415c[_0x49516d('0x165')]);return socket['to'](util['format'](_0x49516d('0x7b'),_0x3c415c[_0x49516d('0x165')]))[_0x49516d('0x23')](_0x49516d('0x109'),{'ip':_0xa1988a[_0x49516d('0xa4')][_0x49516d('0x13d')]||_0xa1988a[_0x49516d('0xa8')]['remoteAddress']||_0xa1988a[_0x49516d('0xaf')]['remoteAddress']||_0xa1988a[_0x49516d('0xa8')][_0x49516d('0xaf')][_0x49516d('0x22')]}),db[_0x49516d('0x72')][_0x49516d('0x11a')]({'where':{'membername':_0x3c415c[_0x49516d('0x165')]},'individualHooks':!![]});}}else throw new ValidationError(_0x49516d('0x120'));})[_0x37a5b1('0x49')](function(){if(_0x3c415c)return _0x3c415c['getVoiceQueues']({'raw':!![]});})[_0x37a5b1('0x49')](function(_0x42f176){const _0x38194c=_0x37a5b1;if(_0x3c415c){if(_0x42f176){_0x330e09=_0x42f176;if(_0x330e09[_0x38194c('0xa1')]){const _0x4dbaa9=_0x330e09[_0x38194c('0xc4')](_0x4d3f68=>{const _0x501af7=_0x38194c,_0x2558a2={'membername':_0x3c415c[_0x501af7('0x165')],'UserId':_0x3c415c['id'],'queue_name':_0x4d3f68[_0x501af7('0x165')],'VoiceQueueId':_0x4d3f68['id'],'interface':_0x44e04c,'paused':_0x3c415c[_0x501af7('0x1c')]||![],'penalty':_0x4d3f68[_0x501af7('0xc6')]||0x0};return db[_0x501af7('0x72')]['upsert'](_0x2558a2);});return Promise[_0x38194c('0x146')](_0x4dbaa9);}}}})[_0x37a5b1('0x49')](function(){const _0x3bacf3=_0x37a5b1;if(_0x3c415c)return db[_0x3bacf3('0x164')][_0x3bacf3('0x135')]({'where':{'membername':_0x3c415c[_0x3bacf3('0x165')],'exitAt':null}});})[_0x37a5b1('0x49')](function(_0x4c972c){const _0x288666=_0x37a5b1;if(_0x3c415c){const _0x59fe55=[];return _0x4c972c[_0x288666('0x11')](function(_0x377db6){const _0x5d0039=_0x288666;_0x59fe55[_0x5d0039('0x81')](_0x377db6[_0x5d0039('0x1')]({'exitAt':moment()[_0x5d0039('0x27')](_0x5d0039('0x12c'))}));}),Promise['all'](_0x59fe55);}})[_0x37a5b1('0x49')](function(){const _0x28086e=_0x37a5b1;if(_0x3c415c){const _0x58052=[],_0x28bc5d=[],_0x5cd860=utils[_0x28086e('0x28')](),_0x5b4cfb={'membername':_0x3c415c[_0x28086e('0x165')],'interface':_0x44e04c,'enterAt':moment()[_0x28086e('0x27')](_0x28086e('0x12c')),'role':_0x3c415c['role'],'internal':_0x3c415c[_0x28086e('0xfc')]};return _0x5cd860[_0x28086e('0x11')](function(_0x469f7d){const _0x4c6b07=_0x28086e;_0x58052['push'](_['merge']({'channel':_0x469f7d,'type':_0x4c6b07('0x128'),'data1':_0xa1988a[_0x4c6b07('0x129')][_0x4c6b07('0x19')],'data2':_0x44e04c},_0x5b4cfb)),_0x3c415c[_0x4c6b07('0x1c')]&&_0x28bc5d[_0x4c6b07('0x81')](_[_0x4c6b07('0xb6')]({'channel':_0x469f7d,'type':_0x4c6b07('0x4e'),'data1':_0x4c6b07('0x3d')},_0x5b4cfb));}),db[_0x28086e('0x164')][_0x28086e('0x74')](_0x58052[_0x28086e('0x13')](_0x28bc5d),{'individualHooks':!![]});}})[_0x37a5b1('0x49')](function(){const _0x234ece=_0x37a5b1;if(_0x3c415c)return _0x3c415c[_0x234ece('0x1')]({'online':!![],'lastLoginAt':moment()[_0x234ece('0x27')](_0x234ece('0x12c')),'voicePause':_0x3c415c[_0x234ece('0x1c')]||![],'mailPause':_0x3c415c[_0x234ece('0x1c')]||![],'chatPause':_0x3c415c[_0x234ece('0x1c')]||![],'faxPause':_0x3c415c[_0x234ece('0x1c')]||![],'smsPause':_0x3c415c[_0x234ece('0x1c')]||![],'openchannelPause':_0x3c415c[_0x234ece('0x1c')]||![],'whatsappPause':_0x3c415c[_0x234ece('0x1c')]||![],'pauseType':_0x3c415c[_0x234ece('0x1c')]?_0x234ece('0x3d'):null,'interface':_0x44e04c,'lastPauseAt':moment()[_0x234ece('0x27')](_0x234ece('0x12c'))});})['then'](function(_0x418b81){const _0x80cb02=_0x37a5b1;return _0xa1988a['isMiddleware']?_0x178e7f():Promise[_0x80cb02('0x132')](_0x418b81)[_0x80cb02('0x49')](respondWithResult(_0x4870e4,null));})[_0x37a5b1('0x9e')](handleError(_0x4870e4,null));},exports[_0x463a9f('0x115')]=function(_0x397e87,_0x4b9ee5){const _0x13b54c=_0x463a9f;let _0x73b8f0;return db['User'][_0x13b54c('0x8f')]({'where':{'id':_0x397e87[_0x13b54c('0xa5')]['id'],'role':_0x13b54c('0x105')},'attributes':['id',_0x13b54c('0x165'),'role']})[_0x13b54c('0x49')](handleEntityNotFound(_0x4b9ee5,null))[_0x13b54c('0x49')](function(_0x178dd8){const _0x9eedad=_0x13b54c;if(_0x178dd8)return _0x73b8f0=_0x178dd8,db[_0x9eedad('0x72')]['destroy']({'where':{'membername':_0x73b8f0[_0x9eedad('0x165')]},'individualHooks':!![]});})[_0x13b54c('0x49')](function(){const _0x3abf99=_0x13b54c;return db[_0x3abf99('0x164')]['findAll']({'where':{'membername':_0x73b8f0['name'],'exitAt':null}});})[_0x13b54c('0x49')](function(_0x362664){const _0x1cc559=_0x13b54c,_0x9565e3=[];return _0x362664[_0x1cc559('0x11')](function(_0xa54146){const _0x563388=_0x1cc559;_0x9565e3['push'](_0xa54146[_0x563388('0x1')]({'exitAt':moment()[_0x563388('0x27')]('YYYY-MM-DD\x20HH:mm:ss')}));}),Promise[_0x1cc559('0x146')](_0x9565e3);})['then'](function(){const _0x32c25a=_0x13b54c;return _0x73b8f0[_0x32c25a('0x1')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x13b54c('0x49')](respondWithResult(_0x4b9ee5,null))[_0x13b54c('0x9e')](handleError(_0x4b9ee5,null));},exports['pause']=function(_0x324242,_0x768a5c){const _0x44ac0d=_0x463a9f;let _0x56a900;return db[_0x44ac0d('0x72')][_0x44ac0d('0x1')]({'paused':0x1},{'where':{'UserId':_0x324242[_0x44ac0d('0xa5')]['id']},'individualHooks':!![]})[_0x44ac0d('0x49')](function(){const _0x2db530=_0x44ac0d;return db[_0x2db530('0xcc')][_0x2db530('0x8f')]({'where':{'id':_0x324242['params']['id'],'role':_0x2db530('0x105')},'attributes':['id',_0x2db530('0x165'),_0x2db530('0x15a'),_0x2db530('0xfc'),'interface']});})[_0x44ac0d('0x49')](handleEntityNotFound(_0x768a5c,null))[_0x44ac0d('0x49')](function(_0x3e7374){const _0x3a637a=_0x44ac0d;if(_0x3e7374)return _0x56a900=_0x3e7374,respondWithRpcPromise('QueuePause',_0x3a637a('0x4c'),{'id':_0x56a900['id'],'name':_0x56a900[_0x3a637a('0x165')],'pause':!![]});})[_0x44ac0d('0x49')](function(){const _0x5c23ab=_0x44ac0d;if(_0x56a900)return db[_0x5c23ab('0x164')][_0x5c23ab('0x135')]({'where':{'membername':_0x56a900[_0x5c23ab('0x165')],'type':_0x5c23ab('0x4e'),'exitAt':null}});})[_0x44ac0d('0x49')](function(_0x41f9f2){const _0x486bf8=_0x44ac0d;if(_0x41f9f2[_0x486bf8('0xa1')]){const _0x10618e=moment()[_0x486bf8('0x27')](_0x486bf8('0x12c'));for(let _0x47e5bf=0x0,_0x13857d=_0x41f9f2[_0x486bf8('0xa1')];_0x47e5bf<_0x13857d;_0x47e5bf++){_0x41f9f2[_0x47e5bf][_0x486bf8('0x1')]({'exitAt':_0x10618e});}}})[_0x44ac0d('0x49')](function(){const _0x2f50d0=_0x44ac0d,_0x551ded=[],_0x34bfb1=utils[_0x2f50d0('0x28')]();return _0x34bfb1[_0x2f50d0('0x11')](function(_0x6d413c){const _0x37b663=_0x2f50d0;_0x551ded['push']({'channel':_0x6d413c,'membername':_0x56a900[_0x37b663('0x165')],'interface':_[_0x37b663('0x6b')](_0x56a900[_0x37b663('0xe3')])?util[_0x37b663('0x27')](_0x37b663('0xbf'),_0x56a900[_0x37b663('0x165')]):_0x56a900[_0x37b663('0xe3')],'type':'PAUSE','enterAt':moment()[_0x37b663('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x324242['body'][_0x37b663('0x5')]||'DEFAULT\x20PAUSE','role':_0x56a900[_0x37b663('0x15a')],'internal':_0x56a900['internal']});}),db['MemberReport'][_0x2f50d0('0x74')](_0x551ded,{'individualHooks':!![]});})[_0x44ac0d('0x49')](function(){const _0x2103d3=_0x44ac0d;return _0x56a900[_0x2103d3('0x1')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x324242[_0x2103d3('0x129')][_0x2103d3('0x5')]||_0x2103d3('0x10f'),'lastPauseAt':moment()[_0x2103d3('0x27')](_0x2103d3('0x12c'))});})['then'](respondWithResult(_0x768a5c,null))['catch'](handleError(_0x768a5c,null));},exports['unpause']=function(_0x964601,_0x27d317){const _0x287f14=_0x463a9f;let _0x3f55c5;return db['User']['findOne']({'where':{'id':_0x964601[_0x287f14('0xa5')]['id']},'attributes':['id',_0x287f14('0x165'),_0x287f14('0x15a'),_0x287f14('0x37'),'mailPause','chatPause',_0x287f14('0x33'),_0x287f14('0xbd'),_0x287f14('0x48'),_0x287f14('0xec'),_0x287f14('0x12a'),_0x287f14('0x141')]})[_0x287f14('0x49')](handleEntityNotFound(_0x27d317,null))['then'](function(_0x57293b){const _0x37c5f1=_0x287f14;if(_0x57293b){_0x3f55c5=_0x57293b;if(_0x964601[_0x37c5f1('0x129')][_0x37c5f1('0xbb')]&&!utils[_0x37c5f1('0xc3')](_0x964601['body']['channel']))throw new ValidationError('Unknown\x20channel');switch(_0x964601['body'][_0x37c5f1('0xbb')]){case _0x37c5f1('0x7f'):return respondWithRpcPromise(_0x37c5f1('0x9a'),_0x37c5f1('0xb4'),{'id':_0x3f55c5['id'],'name':_0x3f55c5[_0x37c5f1('0x165')],'pause':![]})[_0x37c5f1('0x49')](function(){const _0x2c1d42=_0x37c5f1;return db[_0x2c1d42('0x72')]['update']({'paused':0x0},{'where':{'UserId':_0x3f55c5['id']},'individualHooks':!![]});})[_0x37c5f1('0x49')](function(){const _0x58428e=_0x37c5f1;return db['MemberReport']['findOne']({'where':{'channel':_0x964601[_0x58428e('0x129')][_0x58428e('0xbb')],'membername':_0x3f55c5[_0x58428e('0x165')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x22f744){const _0x19024d=_0x37c5f1;if(_0x22f744)return _0x22f744[_0x19024d('0x1')]({'exitAt':moment()[_0x19024d('0x27')](_0x19024d('0x12c')),'data2':_0x19024d('0x79')},{'individualHooks':!![]});return null;})[_0x37c5f1('0x49')](function(){const _0x14fc49=_0x37c5f1;return _0x3f55c5[_0x14fc49('0x1')]({'voicePause':![]});});case _0x37c5f1('0x15e'):case _0x37c5f1('0x8a'):case _0x37c5f1('0x112'):case _0x37c5f1('0x52'):case _0x37c5f1('0x15c'):case'openchannel':return db[_0x37c5f1('0x164')][_0x37c5f1('0x8f')]({'where':{'channel':_0x964601['body'][_0x37c5f1('0xbb')],'membername':_0x3f55c5[_0x37c5f1('0x165')],'type':_0x37c5f1('0x4e'),'exitAt':null}})['then'](function(_0x36e3e6){const _0x5aa0e1=_0x37c5f1;if(_0x36e3e6)return _0x36e3e6[_0x5aa0e1('0x1')]({'exitAt':moment()[_0x5aa0e1('0x27')](_0x5aa0e1('0x12c')),'data2':'manual'},{'individualHooks':!![]});return null;})[_0x37c5f1('0x49')](function(){const _0x121ea3=_0x37c5f1,_0x180c72={};return _['set'](_0x180c72,util[_0x121ea3('0x27')](_0x121ea3('0x4b'),_0x964601[_0x121ea3('0x129')][_0x121ea3('0xbb')],_0x121ea3('0x16a')),![]),_0x3f55c5[_0x121ea3('0x1')](_0x180c72);});default:return respondWithRpcPromise(_0x37c5f1('0x9a'),_0x37c5f1('0xb4'),{'id':_0x3f55c5['id'],'name':_0x3f55c5[_0x37c5f1('0x165')],'pause':![]})[_0x37c5f1('0x49')](function(){const _0x2fe26c=_0x37c5f1;return db[_0x2fe26c('0x72')][_0x2fe26c('0x1')]({'paused':0x0},{'where':{'UserId':_0x3f55c5['id']}});})[_0x37c5f1('0x49')](function(){const _0x157356=_0x37c5f1;return db[_0x157356('0x164')][_0x157356('0x135')]({'where':{'membername':_0x3f55c5[_0x157356('0x165')],'type':'PAUSE','exitAt':null}});})[_0x37c5f1('0x49')](function(_0x1b990c){const _0x38c2e5=_0x37c5f1,_0x1c0d0f=[];return _0x1b990c[_0x38c2e5('0x11')](function(_0x34a0ff){const _0x414baa=_0x38c2e5;_0x1c0d0f['push'](_0x34a0ff[_0x414baa('0x1')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x414baa('0x79')}));}),Promise[_0x38c2e5('0x146')](_0x1c0d0f);})[_0x37c5f1('0x49')](function(){const _0x52410f=_0x37c5f1;return _0x3f55c5[_0x52410f('0x1')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x287f14('0x49')](respondWithResult(_0x27d317,null))[_0x287f14('0x9e')](handleError(_0x27d317,null));},exports['getTeams']=function(_0x17fde2,_0x44d0c8){const _0x348ffa=_0x463a9f;let _0x360cb9={};const _0x26f9e5={};let _0x510f16,_0x760d06;return db[_0x348ffa('0xcc')]['findOne']({'where':{'id':_0x17fde2['params']['id']}})[_0x348ffa('0x49')](handleEntityNotFound(_0x44d0c8,null))[_0x348ffa('0x49')](function(_0x6b083f){const _0x5ee2c1=_0x348ffa;if(_0x6b083f)return _0x510f16=_0x6b083f,_0x26f9e5[_0x5ee2c1('0x13e')]=_[_0x5ee2c1('0xba')](db[_0x5ee2c1('0xd3')]['rawAttributes']),_0x26f9e5[_0x5ee2c1('0xa7')]=_[_0x5ee2c1('0xba')](_0x17fde2[_0x5ee2c1('0xa7')]),_0x26f9e5['filters']=_[_0x5ee2c1('0x5b')](_0x26f9e5[_0x5ee2c1('0x13e')],_0x26f9e5[_0x5ee2c1('0xa7')]),_0x360cb9['attributes']=_['intersection'](_0x26f9e5[_0x5ee2c1('0x13e')],qs['fields'](_0x17fde2['query'][_0x5ee2c1('0x15')])),_0x360cb9[_0x5ee2c1('0x5c')]=_0x360cb9[_0x5ee2c1('0x5c')]['length']?_0x360cb9[_0x5ee2c1('0x5c')]:_0x26f9e5[_0x5ee2c1('0x13e')],_0x360cb9['order']=qs[_0x5ee2c1('0x148')](_0x17fde2[_0x5ee2c1('0xa7')][_0x5ee2c1('0x148')]),_0x360cb9[_0x5ee2c1('0x85')]=qs[_0x5ee2c1('0x117')](_[_0x5ee2c1('0x89')](_0x17fde2[_0x5ee2c1('0xa7')],_0x26f9e5[_0x5ee2c1('0x117')])),_0x17fde2[_0x5ee2c1('0xa7')][_0x5ee2c1('0x113')]&&(_0x360cb9[_0x5ee2c1('0x85')]=_[_0x5ee2c1('0xb6')](_0x360cb9[_0x5ee2c1('0x85')],{[Op['or']]:_[_0x5ee2c1('0xc4')](_0x360cb9[_0x5ee2c1('0x5c')],function(_0x27aa56){const _0x2b6a2d=_0x5ee2c1,_0x14e847={};return _0x14e847[_0x27aa56]={[Op['like']]:'%'+_0x17fde2[_0x2b6a2d('0xa7')][_0x2b6a2d('0x113')]+'%'},_0x14e847;})})),_0x360cb9=_[_0x5ee2c1('0xb6')]({},_0x360cb9,_0x17fde2['options']),_0x510f16[_0x5ee2c1('0x51')](_0x360cb9);})[_0x348ffa('0x49')](function(_0x32eec4){const _0x29796d=_0x348ffa;if(_0x32eec4)return _0x760d06=_0x32eec4['length'],typeof _0x17fde2[_0x29796d('0xa7')][_0x29796d('0x111')]===_0x29796d('0x12b')&&(_0x360cb9['limit']=qs[_0x29796d('0x3b')](_0x17fde2[_0x29796d('0xa7')]['limit']),_0x360cb9[_0x29796d('0x127')]=qs['offset'](_0x17fde2[_0x29796d('0xa7')][_0x29796d('0x127')])),_0x510f16[_0x29796d('0x51')](_0x360cb9);})[_0x348ffa('0x49')](function(_0x39c15e){if(_0x39c15e)return _0x39c15e?{'count':_0x760d06,'rows':_0x39c15e}:null;})['then'](respondWithResult(_0x44d0c8,null))['catch'](handleError(_0x44d0c8,null));},exports[_0x463a9f('0x158')]=function(_0x439ac6,_0x2a2fde){const _0xd6d685=_0x463a9f;return db[_0xd6d685('0xcc')][_0xd6d685('0x8f')]({'where':{'id':_0x439ac6[_0xd6d685('0xa5')]['id']}})['then'](handleEntityNotFound(_0x2a2fde,null))[_0xd6d685('0x49')](function(_0x4c9b80){const _0x23903d=_0xd6d685;if(_0x4c9b80){const _0x32edab=_0x4c9b80[_0x23903d('0xc8')]({'plain':!![]});return _0x4c9b80['addTeams'](_0x439ac6[_0x23903d('0x129')][_0x23903d('0x3')],_[_0x23903d('0x55')](_0x439ac6[_0x23903d('0x129')],[_0x23903d('0x3'),'id'])||{})[_0x23903d('0x49')](function(){const _0x83b682=_0x23903d;for(let _0x1a6895=0x0;_0x1a6895<_0x439ac6[_0x83b682('0x129')][_0x83b682('0x3')][_0x83b682('0xa1')];_0x1a6895++){let _0x5f0a06=[];db[_0x83b682('0xd3')][_0x83b682('0x8f')]({'where':{'id':_0x439ac6['body'][_0x83b682('0x3')][_0x1a6895]}})['then'](function(_0x2f1cce){const _0x44829a=_0x83b682;return _0x5f0a06[_0x44829a('0x81')](_0x2f1cce[_0x44829a('0x7e')]()['then'](function(_0x65acd3){const _0x1f27c9=_0x44829a;for(let _0x9ed0f1=0x0;_0x9ed0f1<_0x65acd3['length'];_0x9ed0f1++){_0x65acd3[_0x9ed0f1][_0x1f27c9('0xef')](_0x1f27c9('0xbb'),'Voice');}return _0x65acd3;})),_0x5f0a06['push'](_0x2f1cce[_0x44829a('0x107')]()[_0x44829a('0x49')](function(_0x18f01c){const _0x348168=_0x44829a;for(let _0x55834b=0x0;_0x55834b<_0x18f01c[_0x348168('0xa1')];_0x55834b++){_0x18f01c[_0x55834b]['setDataValue']('channel',_0x348168('0xd'));}return _0x18f01c;})),_0x5f0a06[_0x44829a('0x81')](_0x2f1cce[_0x44829a('0x17')]()[_0x44829a('0x49')](function(_0x178e42){const _0x29d191=_0x44829a;for(let _0x530210=0x0;_0x530210<_0x178e42[_0x29d191('0xa1')];_0x530210++){_0x178e42[_0x530210][_0x29d191('0xef')](_0x29d191('0xbb'),_0x29d191('0x147'));}return _0x178e42;})),_0x5f0a06['push'](_0x2f1cce[_0x44829a('0x9b')]()['then'](function(_0x31b8ef){const _0x23ebeb=_0x44829a;for(let _0x962d23=0x0;_0x962d23<_0x31b8ef[_0x23ebeb('0xa1')];_0x962d23++){_0x31b8ef[_0x962d23][_0x23ebeb('0xef')](_0x23ebeb('0xbb'),'Sms');}return _0x31b8ef;})),_0x5f0a06[_0x44829a('0x81')](_0x2f1cce[_0x44829a('0xce')]()['then'](function(_0x456860){const _0x3964b5=_0x44829a;for(let _0x49f70a=0x0;_0x49f70a<_0x456860[_0x3964b5('0xa1')];_0x49f70a++){_0x456860[_0x49f70a][_0x3964b5('0xef')](_0x3964b5('0xbb'),_0x3964b5('0xd5'));}return _0x456860;})),_0x5f0a06[_0x44829a('0x81')](_0x2f1cce[_0x44829a('0xb2')]()['then'](function(_0x1fd433){const _0x5a2822=_0x44829a;for(let _0x2033da=0x0;_0x2033da<_0x1fd433['length'];_0x2033da++){_0x1fd433[_0x2033da][_0x5a2822('0xef')](_0x5a2822('0xbb'),_0x5a2822('0x8d'));}return _0x1fd433;})),_0x5f0a06[_0x44829a('0x81')](_0x2f1cce[_0x44829a('0x18')]()['then'](function(_0x4f4714){const _0x17926c=_0x44829a;for(let _0x40c211=0x0;_0x40c211<_0x4f4714[_0x17926c('0xa1')];_0x40c211++){_0x4f4714[_0x40c211][_0x17926c('0xef')](_0x17926c('0xbb'),'Openchannel');}return _0x4f4714;})),Promise[_0x44829a('0x146')](_0x5f0a06);})[_0x83b682('0x49')](function(_0x270f19){const _0x4192eb=_0x83b682,_0x55bb48=_['flatten'](_0x270f19);return _0x5f0a06=[],db[_0x4192eb('0xe2')][_0x4192eb('0x45')](function(_0x2a8253){const _0x297bdb=_0x4192eb;for(let _0x673a6=0x0;_0x673a6<_0x55bb48[_0x297bdb('0xa1')];_0x673a6++){_0x5f0a06['push'](_0x55bb48[_0x673a6][_0x297bdb('0xac')](_0x32edab['id']),{'transaction':_0x2a8253});}return Promise['all'](_0x5f0a06)['then'](function(){const _0x26237d=_0x297bdb;if(!_0x32edab[_0x26237d('0xdf')])return;const _0x1baad6=_['filter'](_0x55bb48,function(_0x466336){const _0x2c876c=_0x26237d;return _0x466336[_0x2c876c('0xa9')]('channel')===_0x2c876c('0x14f');});return Promise[_0x26237d('0x146')](_0x1baad6[_0x26237d('0xc4')](_0x114ac9=>{const _0x3a649e=_0x26237d;return db[_0x3a649e('0x72')][_0x3a649e('0x25')]({'membername':_0x32edab[_0x3a649e('0x165')],'UserId':_0x32edab['id'],'queue_name':_0x114ac9[_0x3a649e('0x165')],'VoiceQueueId':_0x114ac9['id'],'interface':_[_0x3a649e('0x6b')](_0x32edab[_0x3a649e('0xe3')])?util['format'](_0x3a649e('0xbf'),_0x32edab[_0x3a649e('0x165')]):_0x32edab[_0x3a649e('0xe3')],'paused':_0x32edab['voicePause']||![],'penalty':_0x32edab['penalty']},{'transaction':_0x2a8253});}));})['then'](function(){const _0x55f946=_0x297bdb;for(let _0x2942a1=0x0;_0x2942a1<_0x55bb48[_0x55f946('0xa1')];_0x2942a1++){const _0x27908e=_0x55bb48[_0x2942a1][_0x55f946('0xa9')](_0x55f946('0xbb')),_0x5dee3e=_0x27908e+_0x55f946('0x14d');socket['emit'](_0x55f946('0x1f')+_0x27908e+_0x55f946('0x14b'),{'UserId':_0x32edab['id'],[_0x5dee3e]:_0x55bb48[_0x2942a1]['id']});}});});});}});}})[_0xd6d685('0x49')](respondWithStatusCode(_0x2a2fde,null))[_0xd6d685('0x9e')](handleError(_0x2a2fde,null));},exports['removeTeams']=function(_0x334962,_0x41214f){const _0x119c89=_0x463a9f;return db[_0x119c89('0xcc')]['findOne']({'where':{'id':_0x334962[_0x119c89('0xa5')]['id']}})[_0x119c89('0x49')](handleEntityNotFound(_0x41214f,null))['then'](function(_0x2bdb93){const _0x5a3c28=_0x119c89;if(_0x2bdb93){const _0x4b4f31=_0x2bdb93['get']({'plain':!![]}),_0xea6672=_0x334962[_0x5a3c28('0xa7')][_0x5a3c28('0x3')];return _0x2bdb93[_0x5a3c28('0x59')](_0xea6672)[_0x5a3c28('0x49')](function(){const _0x2181da=_0x5a3c28;for(let _0x3909dc=0x0;_0x3909dc<_0xea6672[_0x2181da('0xa1')];_0x3909dc++){let _0x29db8b=[];db[_0x2181da('0xd3')]['findOne']({'where':{'id':_0xea6672[_0x3909dc]}})[_0x2181da('0x49')](function(_0x4e8c5f){const _0x40584c=_0x2181da;return _0x29db8b['push'](_0x4e8c5f[_0x40584c('0x7e')]()[_0x40584c('0x49')](function(_0xc7c23){const _0x4d5190=_0x40584c;for(let _0x4b684a=0x0;_0x4b684a<_0xc7c23[_0x4d5190('0xa1')];_0x4b684a++){_0xc7c23[_0x4b684a][_0x4d5190('0xef')](_0x4d5190('0xbb'),_0x4d5190('0x14f'));}return _0xc7c23;})),_0x29db8b[_0x40584c('0x81')](_0x4e8c5f[_0x40584c('0x107')]()['then'](function(_0x3975f0){const _0x360093=_0x40584c;for(let _0x10bfb9=0x0;_0x10bfb9<_0x3975f0['length'];_0x10bfb9++){_0x3975f0[_0x10bfb9]['setDataValue'](_0x360093('0xbb'),'Chat');}return _0x3975f0;})),_0x29db8b[_0x40584c('0x81')](_0x4e8c5f[_0x40584c('0x17')]()['then'](function(_0x1f515b){const _0xc78d5b=_0x40584c;for(let _0x19cdc0=0x0;_0x19cdc0<_0x1f515b[_0xc78d5b('0xa1')];_0x19cdc0++){_0x1f515b[_0x19cdc0][_0xc78d5b('0xef')]('channel',_0xc78d5b('0x147'));}return _0x1f515b;})),_0x29db8b[_0x40584c('0x81')](_0x4e8c5f[_0x40584c('0x9b')]()[_0x40584c('0x49')](function(_0x2eabb5){const _0x1edda9=_0x40584c;for(let _0x2128f0=0x0;_0x2128f0<_0x2eabb5[_0x1edda9('0xa1')];_0x2128f0++){_0x2eabb5[_0x2128f0][_0x1edda9('0xef')](_0x1edda9('0xbb'),'Sms');}return _0x2eabb5;})),_0x29db8b['push'](_0x4e8c5f['getWhatsappQueues']()[_0x40584c('0x49')](function(_0x1c92dc){const _0x28df6e=_0x40584c;for(let _0x148650=0x0;_0x148650<_0x1c92dc[_0x28df6e('0xa1')];_0x148650++){_0x1c92dc[_0x148650][_0x28df6e('0xef')](_0x28df6e('0xbb'),_0x28df6e('0xd5'));}return _0x1c92dc;})),_0x29db8b['push'](_0x4e8c5f[_0x40584c('0xb2')]()[_0x40584c('0x49')](function(_0x1a5fe8){const _0x4650b0=_0x40584c;for(let _0x2627f0=0x0;_0x2627f0<_0x1a5fe8['length'];_0x2627f0++){_0x1a5fe8[_0x2627f0][_0x4650b0('0xef')](_0x4650b0('0xbb'),_0x4650b0('0x8d'));}return _0x1a5fe8;})),_0x29db8b[_0x40584c('0x81')](_0x4e8c5f[_0x40584c('0x18')]()[_0x40584c('0x49')](function(_0xa57635){const _0x1e41b4=_0x40584c;for(let _0x22beb6=0x0;_0x22beb6<_0xa57635[_0x1e41b4('0xa1')];_0x22beb6++){_0xa57635[_0x22beb6]['setDataValue'](_0x1e41b4('0xbb'),_0x1e41b4('0x3f'));}return _0xa57635;})),Promise['all'](_0x29db8b);})[_0x2181da('0x49')](function(_0x276968){const _0x58367c=_0x2181da,_0x3c8d90=_[_0x58367c('0xa2')](_0x276968);return _0x29db8b=[],db[_0x58367c('0xe2')][_0x58367c('0x45')](function(_0x2ba02d){const _0x2f2448=_0x58367c;for(let _0x4f0041=0x0;_0x4f0041<_0x3c8d90[_0x2f2448('0xa1')];_0x4f0041++){_0x29db8b[_0x2f2448('0x81')](_0x3c8d90[_0x4f0041][_0x2f2448('0x6a')](_0x4b4f31['id']),{'transaction':_0x2ba02d});}return Promise[_0x2f2448('0x146')](_0x29db8b)['then'](function(){const _0x1efe85=_0x2f2448;if(!_0x4b4f31[_0x1efe85('0xdf')])return;const _0x3ce4f8=_[_0x1efe85('0x113')](_0x3c8d90,function(_0x48f0a7){const _0x455a43=_0x1efe85;return _0x48f0a7['getDataValue'](_0x455a43('0xbb'))==='Voice';});return Promise['all'](_0x3ce4f8[_0x1efe85('0xc4')](_0x5cb8c6=>{const _0x9573b4=_0x1efe85;return db['UserVoiceQueueRt'][_0x9573b4('0x11a')]({'where':{'VoiceQueueId':_0x5cb8c6['id'],'UserId':_0x4b4f31['id']},'transaction':_0x2ba02d});}));})[_0x2f2448('0x49')](function(){const _0x28d3f8=_0x2f2448;for(let _0x2e9a28=0x0;_0x2e9a28<_0x3c8d90[_0x28d3f8('0xa1')];_0x2e9a28++){const _0x45fd7c=_0x3c8d90[_0x2e9a28]['getDataValue'](_0x28d3f8('0xbb')),_0x55a83f=_0x45fd7c+'QueueId';socket[_0x28d3f8('0x23')](_0x28d3f8('0x1f')+_0x45fd7c+_0x28d3f8('0x122'),{'UserId':_0x4b4f31['id'],[_0x55a83f]:_0x3c8d90[_0x2e9a28]['id']});}});});});}});}})[_0x119c89('0x49')](respondWithStatusCode(_0x41214f,null))[_0x119c89('0x9e')](handleError(_0x41214f,null));},exports[_0x463a9f('0xee')]=function(_0x35e3ba,_0x1d5df7){const _0x5e3353=_0x463a9f;let _0x235c93={};const _0x4dbbb9={};let _0x3e665f,_0x247ab1;return db[_0x5e3353('0xcc')]['findOne']({'where':{'id':_0x35e3ba[_0x5e3353('0xa5')]['id']}})[_0x5e3353('0x49')](handleEntityNotFound(_0x1d5df7,null))[_0x5e3353('0x49')](function(_0x5726fe){const _0x5691da=_0x5e3353;if(_0x5726fe)return _0x3e665f=_0x5726fe,_0x4dbbb9[_0x5691da('0x13e')]=_[_0x5691da('0xba')](db[_0x5691da('0x126')][_0x5691da('0x66')]),_0x4dbbb9['query']=_[_0x5691da('0xba')](_0x35e3ba[_0x5691da('0xa7')]),_0x4dbbb9[_0x5691da('0x117')]=_[_0x5691da('0x5b')](_0x4dbbb9[_0x5691da('0x13e')],_0x4dbbb9[_0x5691da('0xa7')]),_0x235c93['attributes']=_[_0x5691da('0x5b')](_0x4dbbb9[_0x5691da('0x13e')],qs['fields'](_0x35e3ba['query'][_0x5691da('0x15')])),_0x235c93[_0x5691da('0x5c')]=_0x235c93[_0x5691da('0x5c')][_0x5691da('0xa1')]?_0x235c93['attributes']:_0x4dbbb9[_0x5691da('0x13e')],_0x235c93[_0x5691da('0x82')]=qs[_0x5691da('0x148')](_0x35e3ba[_0x5691da('0xa7')][_0x5691da('0x148')]),_0x235c93[_0x5691da('0x85')]=qs[_0x5691da('0x117')](_[_0x5691da('0x89')](_0x35e3ba[_0x5691da('0xa7')],_0x4dbbb9[_0x5691da('0x117')])),_0x35e3ba[_0x5691da('0xa7')][_0x5691da('0x113')]&&(_0x235c93[_0x5691da('0x85')]=_[_0x5691da('0xb6')](_0x235c93[_0x5691da('0x85')],{[Op['or']]:_[_0x5691da('0xc4')](_0x235c93[_0x5691da('0x5c')],function(_0x53f5d9){const _0x139bda=_0x5691da,_0x10e8ef={};return _0x10e8ef[_0x53f5d9]={[Op['like']]:'%'+_0x35e3ba[_0x139bda('0xa7')]['filter']+'%'},_0x10e8ef;})})),_0x235c93=_[_0x5691da('0xb6')]({},_0x235c93,_0x35e3ba[_0x5691da('0x11c')]),_0x3e665f['getLists'](_0x235c93);})[_0x5e3353('0x49')](function(_0x1bdd22){const _0x3004d2=_0x5e3353;if(_0x1bdd22)return _0x247ab1=_0x1bdd22['length'],typeof _0x35e3ba[_0x3004d2('0xa7')][_0x3004d2('0x111')]===_0x3004d2('0x12b')&&(_0x235c93[_0x3004d2('0x3b')]=qs[_0x3004d2('0x3b')](_0x35e3ba[_0x3004d2('0xa7')][_0x3004d2('0x3b')]),_0x235c93[_0x3004d2('0x127')]=qs[_0x3004d2('0x127')](_0x35e3ba[_0x3004d2('0xa7')]['offset'])),_0x3e665f['getLists'](_0x235c93);})['then'](function(_0x2a59a9){if(_0x2a59a9)return _0x2a59a9?{'count':_0x247ab1,'rows':_0x2a59a9}:null;})['then'](respondWithResult(_0x1d5df7,null))[_0x5e3353('0x9e')](handleError(_0x1d5df7,null));},exports[_0x463a9f('0x130')]=function(_0x56ba12,_0x2a4f7){const _0x192e33=_0x463a9f;let _0x2a56f5={};const _0x49da35={};let _0x54e612;return db[_0x192e33('0xcc')][_0x192e33('0x8f')]({'where':{'id':_0x56ba12[_0x192e33('0xa5')]['id']}})[_0x192e33('0x49')](handleEntityNotFound(_0x2a4f7,null))[_0x192e33('0x49')](function(_0x402124){const _0x1dc79a=_0x192e33;if(_0x402124)return _0x54e612=_0x402124,_0x49da35[_0x1dc79a('0x13e')]=_[_0x1dc79a('0xba')](db['User'][_0x1dc79a('0x66')]),_0x49da35['query']=_[_0x1dc79a('0xba')](_0x56ba12[_0x1dc79a('0xa7')]),_0x49da35['filters']=_[_0x1dc79a('0x5b')](_0x49da35[_0x1dc79a('0x13e')],_0x49da35[_0x1dc79a('0xa7')]),_0x2a56f5[_0x1dc79a('0x5c')]=_['intersection'](_0x49da35[_0x1dc79a('0x13e')],qs[_0x1dc79a('0x15')](_0x56ba12[_0x1dc79a('0xa7')]['fields'])),_0x2a56f5[_0x1dc79a('0x5c')]=_0x2a56f5[_0x1dc79a('0x5c')][_0x1dc79a('0xa1')]?_0x2a56f5[_0x1dc79a('0x5c')]:_0x49da35[_0x1dc79a('0x13e')],_0x2a56f5[_0x1dc79a('0x82')]=qs[_0x1dc79a('0x148')](_0x56ba12[_0x1dc79a('0xa7')][_0x1dc79a('0x148')]),_0x2a56f5[_0x1dc79a('0x85')]=qs[_0x1dc79a('0x117')](_[_0x1dc79a('0x89')](_0x56ba12['query'],_0x49da35[_0x1dc79a('0x117')])),_0x56ba12[_0x1dc79a('0xa7')][_0x1dc79a('0x113')]&&(_0x2a56f5[_0x1dc79a('0x85')]=_[_0x1dc79a('0xb6')](_0x2a56f5[_0x1dc79a('0x85')],{[Op['or']]:_[_0x1dc79a('0xc4')](_0x2a56f5[_0x1dc79a('0x5c')],function(_0x2a2bf9){const _0x3c0908=_0x1dc79a,_0x1c26c8={};return _0x1c26c8[_0x2a2bf9]={[Op[_0x3c0908('0x30')]]:'%'+_0x56ba12[_0x3c0908('0xa7')][_0x3c0908('0x113')]+'%'},_0x1c26c8;})})),_0x2a56f5['model']=db[_0x1dc79a('0xcc')],_0x2a56f5['as']=_0x1dc79a('0x87'),_0x2a56f5=_[_0x1dc79a('0xb6')]({},_0x2a56f5,_0x56ba12['options']),_0x54e612[_0x1dc79a('0x7e')]({'include':[_0x2a56f5]});})[_0x192e33('0x49')](function(_0xcfdaa6){const _0x2d0313=_0x192e33;if(_0xcfdaa6){let _0x362bd2={};const _0x16bf81=[];for(let _0xa38cd3=0x0;_0xa38cd3<_0xcfdaa6['length'];_0xa38cd3+=0x1){for(let _0x374aa6=0x0,_0x314de8;_0x374aa6<_0xcfdaa6[_0xa38cd3][_0x2d0313('0x87')][_0x2d0313('0xa1')];_0x374aa6+=0x1){_0x314de8=_0xcfdaa6[_0xa38cd3][_0x2d0313('0x87')][_0x374aa6][_0x2d0313('0xc8')]({'plain':!![]}),_0x362bd2[_0x314de8['id']]=_0x314de8;}}_0x362bd2=_[_0x2d0313('0xff')](_0x362bd2);for(let _0xdc7934=qs[_0x2d0313('0x127')](_0x56ba12['query']['offset']);_0xdc7934<_0x362bd2[_0x2d0313('0xa1')]&&_0x16bf81['length']<qs[_0x2d0313('0x3b')](_0x56ba12[_0x2d0313('0xa7')][_0x2d0313('0x3b')]);_0xdc7934+=0x1){_0x362bd2[_0xdc7934]&&_0x16bf81[_0x2d0313('0x81')](_0x362bd2[_0xdc7934]);}return{'count':_0x362bd2[_0x2d0313('0xa1')],'rows':_0x16bf81};}})[_0x192e33('0x49')](respondWithResult(_0x2a4f7,null))[_0x192e33('0x9e')](handleError(_0x2a4f7,null));},exports[_0x463a9f('0x11a')]=function(_0x22583c,_0x10b1fb){const _0x58904f=_0x463a9f;if(_0x22583c['user']['id']==_0x22583c[_0x58904f('0xa5')]['id'])return _0x10b1fb[_0x58904f('0x2a')](0x1f4)['send']({'message':_0x58904f('0x137')});return db[_0x58904f('0xcc')]['findOne']({'where':{'id':_0x22583c[_0x58904f('0xa5')]['id']}})['then'](handleEntityNotFound(_0x10b1fb,null))[_0x58904f('0x49')](removeEntity(_0x10b1fb,null))[_0x58904f('0x9e')](handleError(_0x10b1fb,null));},exports[_0x463a9f('0xca')]=function(_0x362c96,_0x266c6f){const _0x4ea90d=_0x463a9f;return db[_0x4ea90d('0xcc')][_0x4ea90d('0x8f')]({'where':{'id':_0x362c96[_0x4ea90d('0xa5')]['id']}})[_0x4ea90d('0x49')](handleEntityNotFound(_0x266c6f,null))[_0x4ea90d('0x49')](function(_0x4e542a){const _0x1a7640=_0x4ea90d;if(_0x4e542a)return _0x4e542a['addChatInteractions'](_0x362c96[_0x1a7640('0x129')][_0x1a7640('0x3')],{'through':_[_0x1a7640('0x55')](_0x362c96['body'],[_0x1a7640('0x3'),'id'])})[_0x1a7640('0x49')](function(){const _0x24addb=_0x1a7640;for(let _0x1a5372=0x0;_0x1a5372<_0x362c96[_0x24addb('0x129')][_0x24addb('0x3')][_0x24addb('0xa1')];_0x1a5372+=0x1){socket['emit'](_0x24addb('0xb'),{'ChatInteractionId':Number(_0x362c96[_0x24addb('0x129')][_0x24addb('0x3')][_0x1a5372]),'UserId':Number(_0x362c96['params']['id'])});}return _0x362c96[_0x24addb('0x129')]['ids'];});})[_0x4ea90d('0x49')](respondWithResult(_0x266c6f,null))[_0x4ea90d('0x9e')](handleError(_0x266c6f,null));},exports[_0x463a9f('0xa')]=function(_0x4d5207,_0x39aa2d){const _0x360020=_0x463a9f;return db[_0x360020('0xcc')][_0x360020('0x8f')]({'where':{'id':_0x4d5207[_0x360020('0xa5')]['id']}})['then'](handleEntityNotFound(_0x39aa2d,null))['then'](function(_0x1b9d6e){const _0x2e1935=_0x360020;if(_0x1b9d6e)return _0x1b9d6e[_0x2e1935('0xa')](_0x4d5207[_0x2e1935('0xa7')][_0x2e1935('0x3')])[_0x2e1935('0x49')](function(){const _0x51cfdf=_0x2e1935;if(_[_0x51cfdf('0x65')](_0x4d5207[_0x51cfdf('0xa7')]['ids']))for(let _0x3659d8=0x0;_0x3659d8<_0x4d5207[_0x51cfdf('0xa7')][_0x51cfdf('0x3')][_0x51cfdf('0xa1')];_0x3659d8+=0x1){socket[_0x51cfdf('0x23')](_0x51cfdf('0x4d'),{'ChatInteractionId':Number(_0x4d5207['query']['ids'][_0x3659d8]),'UserId':Number(_0x4d5207['params']['id'])});}else socket[_0x51cfdf('0x23')](_0x51cfdf('0x4d'),{'ChatInteractionId':Number(_0x4d5207['query']['ids']),'UserId':Number(_0x4d5207[_0x51cfdf('0xa5')]['id'])});});})[_0x360020('0x49')](respondWithStatusCode(_0x39aa2d,null))[_0x360020('0x9e')](handleError(_0x39aa2d,null));},exports[_0x463a9f('0x101')]=function(_0x2b00ca,_0x389c97){const _0x3e9ed5=_0x463a9f;return db[_0x3e9ed5('0xcc')][_0x3e9ed5('0x8f')]({'where':{'id':_0x2b00ca['params']['id']}})['then'](handleEntityNotFound(_0x389c97,null))['then'](function(_0x313fb8){const _0x4b4c01=_0x3e9ed5;if(_0x313fb8)return _0x313fb8[_0x4b4c01('0x101')](_0x2b00ca[_0x4b4c01('0x129')][_0x4b4c01('0x3')],{'through':_['omit'](_0x2b00ca[_0x4b4c01('0x129')],['ids','id'])})['then'](function(){const _0x4a56e5=_0x4b4c01;for(let _0x2d51dd=0x0;_0x2d51dd<_0x2b00ca[_0x4a56e5('0x129')]['ids'][_0x4a56e5('0xa1')];_0x2d51dd+=0x1){socket[_0x4a56e5('0x23')](_0x4a56e5('0x88'),{'MailInteractionId':Number(_0x2b00ca[_0x4a56e5('0x129')]['ids'][_0x2d51dd]),'UserId':Number(_0x2b00ca[_0x4a56e5('0xa5')]['id'])});}return _0x2b00ca[_0x4a56e5('0x129')]['ids'];});})['then'](respondWithResult(_0x389c97,null))[_0x3e9ed5('0x9e')](handleError(_0x389c97,null));},exports[_0x463a9f('0xf5')]=function(_0x10034d,_0x441ce2){const _0x5a4e14=_0x463a9f;return db[_0x5a4e14('0xcc')][_0x5a4e14('0x8f')]({'where':{'id':_0x10034d['params']['id']}})[_0x5a4e14('0x49')](handleEntityNotFound(_0x441ce2,null))['then'](function(_0x2ceb7c){const _0x42362c=_0x5a4e14;if(_0x2ceb7c)return _0x2ceb7c[_0x42362c('0xf5')](_0x10034d[_0x42362c('0xa7')][_0x42362c('0x3')])[_0x42362c('0x49')](function(){const _0x1278e8=_0x42362c;if(_[_0x1278e8('0x65')](_0x10034d[_0x1278e8('0xa7')][_0x1278e8('0x3')]))for(let _0x47bc9a=0x0;_0x47bc9a<_0x10034d[_0x1278e8('0xa7')][_0x1278e8('0x3')][_0x1278e8('0xa1')];_0x47bc9a+=0x1){socket[_0x1278e8('0x23')](_0x1278e8('0xaa'),{'MailInteractionId':Number(_0x10034d[_0x1278e8('0xa7')][_0x1278e8('0x3')][_0x47bc9a]),'UserId':Number(_0x10034d[_0x1278e8('0xa5')]['id'])});}else socket['emit'](_0x1278e8('0xaa'),{'MailInteractionId':Number(_0x10034d['query'][_0x1278e8('0x3')]),'UserId':Number(_0x10034d[_0x1278e8('0xa5')]['id'])});});})[_0x5a4e14('0x49')](respondWithStatusCode(_0x441ce2,null))[_0x5a4e14('0x9e')](handleError(_0x441ce2,null));},exports[_0x463a9f('0x5e')]=function(_0x11845b,_0x5ac4b6){const _0x20b7db=_0x463a9f;return db[_0x20b7db('0xcc')][_0x20b7db('0x8f')]({'where':{'id':_0x11845b[_0x20b7db('0xa5')]['id']}})[_0x20b7db('0x49')](handleEntityNotFound(_0x5ac4b6,null))[_0x20b7db('0x49')](function(_0x454831){const _0x4f6e47=_0x20b7db;if(_0x454831)return _0x454831[_0x4f6e47('0x5e')](_0x11845b['body'][_0x4f6e47('0x3')],{'through':_[_0x4f6e47('0x55')](_0x11845b[_0x4f6e47('0x129')],[_0x4f6e47('0x3'),'id'])})[_0x4f6e47('0x49')](function(){const _0xf92084=_0x4f6e47;for(let _0x4ffe31=0x0;_0x4ffe31<_0x11845b['body'][_0xf92084('0x3')]['length'];_0x4ffe31+=0x1){socket[_0xf92084('0x23')](_0xf92084('0x73'),{'FaxInteractionId':Number(_0x11845b['body']['ids'][_0x4ffe31]),'UserId':Number(_0x11845b[_0xf92084('0xa5')]['id'])});}return _0x11845b['body'][_0xf92084('0x3')];});})[_0x20b7db('0x49')](respondWithResult(_0x5ac4b6,null))['catch'](handleError(_0x5ac4b6,null));},exports['removeFaxInteractions']=function(_0x7a67e1,_0x30ea7a){const _0x27d3e2=_0x463a9f;return db['User']['findOne']({'where':{'id':_0x7a67e1[_0x27d3e2('0xa5')]['id']}})[_0x27d3e2('0x49')](handleEntityNotFound(_0x30ea7a,null))['then'](function(_0x98d7d){const _0x1df2c7=_0x27d3e2;if(_0x98d7d)return _0x98d7d[_0x1df2c7('0x10e')](_0x7a67e1[_0x1df2c7('0xa7')]['ids'])[_0x1df2c7('0x49')](function(){const _0x5c2103=_0x1df2c7;if(_[_0x5c2103('0x65')](_0x7a67e1['query']['ids']))for(let _0x5a432d=0x0;_0x5a432d<_0x7a67e1[_0x5c2103('0xa7')][_0x5c2103('0x3')][_0x5c2103('0xa1')];_0x5a432d+=0x1){socket['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x7a67e1['query']['ids'][_0x5a432d]),'UserId':Number(_0x7a67e1[_0x5c2103('0xa5')]['id'])});}else socket[_0x5c2103('0x23')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x7a67e1[_0x5c2103('0xa7')][_0x5c2103('0x3')]),'UserId':Number(_0x7a67e1['params']['id'])});});})['then'](respondWithStatusCode(_0x30ea7a,null))[_0x27d3e2('0x9e')](handleError(_0x30ea7a,null));},exports[_0x463a9f('0x161')]=function(_0x3aad5c,_0x4297b1){const _0x309795=_0x463a9f;return db[_0x309795('0xcc')]['findOne']({'where':{'id':_0x3aad5c[_0x309795('0xa5')]['id']}})[_0x309795('0x49')](handleEntityNotFound(_0x4297b1,null))['then'](function(_0x25f111){const _0x3725ed=_0x309795;if(_0x25f111)return _0x25f111[_0x3725ed('0x161')](_0x3aad5c[_0x3725ed('0x129')]['ids'],{'through':_[_0x3725ed('0x55')](_0x3aad5c[_0x3725ed('0x129')],[_0x3725ed('0x3'),'id'])})['then'](function(){const _0x45edb3=_0x3725ed;for(let _0x2770fd=0x0;_0x2770fd<_0x3aad5c[_0x45edb3('0x129')][_0x45edb3('0x3')][_0x45edb3('0xa1')];_0x2770fd+=0x1){socket[_0x45edb3('0x23')](_0x45edb3('0x96'),{'SmsInteractionId':Number(_0x3aad5c[_0x45edb3('0x129')][_0x45edb3('0x3')][_0x2770fd]),'UserId':Number(_0x3aad5c[_0x45edb3('0xa5')]['id'])});}return _0x3aad5c[_0x45edb3('0x129')][_0x45edb3('0x3')];});})[_0x309795('0x49')](respondWithResult(_0x4297b1,null))['catch'](handleError(_0x4297b1,null));},exports[_0x463a9f('0x2f')]=function(_0xb67cd6,_0x276b08){const _0x3be56f=_0x463a9f;return db['User'][_0x3be56f('0x8f')]({'where':{'id':_0xb67cd6[_0x3be56f('0xa5')]['id']}})['then'](handleEntityNotFound(_0x276b08,null))[_0x3be56f('0x49')](function(_0x5e161d){const _0x5e33a7=_0x3be56f;if(_0x5e161d)return _0x5e161d[_0x5e33a7('0x2f')](_0xb67cd6[_0x5e33a7('0xa7')][_0x5e33a7('0x3')])['then'](function(){const _0x4f3e39=_0x5e33a7;if(_[_0x4f3e39('0x65')](_0xb67cd6[_0x4f3e39('0xa7')][_0x4f3e39('0x3')]))for(let _0x4c2bc8=0x0;_0x4c2bc8<_0xb67cd6[_0x4f3e39('0xa7')][_0x4f3e39('0x3')][_0x4f3e39('0xa1')];_0x4c2bc8+=0x1){socket[_0x4f3e39('0x23')](_0x4f3e39('0xd2'),{'SmsInteractionId':Number(_0xb67cd6['query']['ids'][_0x4c2bc8]),'UserId':Number(_0xb67cd6['params']['id'])});}else socket[_0x4f3e39('0x23')](_0x4f3e39('0xd2'),{'SmsInteractionId':Number(_0xb67cd6[_0x4f3e39('0xa7')][_0x4f3e39('0x3')]),'UserId':Number(_0xb67cd6[_0x4f3e39('0xa5')]['id'])});});})[_0x3be56f('0x49')](respondWithStatusCode(_0x276b08,null))['catch'](handleError(_0x276b08,null));},exports[_0x463a9f('0xc0')]=function(_0x3eef00,_0xd61e8e){const _0x2f72af=_0x463a9f;return db[_0x2f72af('0xcc')]['findOne']({'where':{'id':_0x3eef00[_0x2f72af('0xa5')]['id']}})['then'](handleEntityNotFound(_0xd61e8e,null))['then'](function(_0x392228){const _0x13d45b=_0x2f72af;if(_0x392228)return _0x392228[_0x13d45b('0xc0')](_0x3eef00[_0x13d45b('0x129')][_0x13d45b('0x3')],{'through':_[_0x13d45b('0x55')](_0x3eef00[_0x13d45b('0x129')],['ids','id'])})[_0x13d45b('0x49')](function(){const _0x430ae5=_0x13d45b;for(let _0x260e9d=0x0;_0x260e9d<_0x3eef00[_0x430ae5('0x129')][_0x430ae5('0x3')][_0x430ae5('0xa1')];_0x260e9d+=0x1){socket[_0x430ae5('0x23')]('user_has_openchannel_interactions:save',{'OpenchannelInteractionId':Number(_0x3eef00[_0x430ae5('0x129')][_0x430ae5('0x3')][_0x260e9d]),'UserId':Number(_0x3eef00['params']['id'])});}return _0x3eef00['body'][_0x430ae5('0x3')];});})[_0x2f72af('0x49')](respondWithResult(_0xd61e8e,null))[_0x2f72af('0x9e')](handleError(_0xd61e8e,null));},exports[_0x463a9f('0xd4')]=function(_0x21fedf,_0x2b2b07){const _0x69f510=_0x463a9f;return db[_0x69f510('0xcc')]['findOne']({'where':{'id':_0x21fedf[_0x69f510('0xa5')]['id']}})[_0x69f510('0x49')](handleEntityNotFound(_0x2b2b07,null))[_0x69f510('0x49')](function(_0x205948){const _0x2d5712=_0x69f510;if(_0x205948)return _0x205948[_0x2d5712('0xd4')](_0x21fedf[_0x2d5712('0xa7')]['ids'])[_0x2d5712('0x49')](function(){const _0x35b34f=_0x2d5712;if(_[_0x35b34f('0x65')](_0x21fedf[_0x35b34f('0xa7')]['ids']))for(let _0x11254c=0x0;_0x11254c<_0x21fedf[_0x35b34f('0xa7')][_0x35b34f('0x3')][_0x35b34f('0xa1')];_0x11254c+=0x1){socket[_0x35b34f('0x23')](_0x35b34f('0x36'),{'OpenchannelInteractionId':Number(_0x21fedf[_0x35b34f('0xa7')][_0x35b34f('0x3')][_0x11254c]),'UserId':Number(_0x21fedf[_0x35b34f('0xa5')]['id'])});}else socket[_0x35b34f('0x23')](_0x35b34f('0x36'),{'OpenchannelInteractionId':Number(_0x21fedf[_0x35b34f('0xa7')]['ids']),'UserId':Number(_0x21fedf['params']['id'])});});})[_0x69f510('0x49')](respondWithStatusCode(_0x2b2b07,null))[_0x69f510('0x9e')](handleError(_0x2b2b07,null));},exports[_0x463a9f('0x124')]=function(_0x35f8d9,_0x2554e6){const _0x11471a=_0x463a9f;return db[_0x11471a('0xcc')]['findOne']({'where':{'id':_0x35f8d9[_0x11471a('0xa5')]['id']}})['then'](handleEntityNotFound(_0x2554e6,null))[_0x11471a('0x49')](function(_0x33eb32){const _0x45ffbd=_0x11471a;if(_0x33eb32)return _0x33eb32[_0x45ffbd('0x124')](_0x35f8d9[_0x45ffbd('0x129')][_0x45ffbd('0x3')],{'through':_[_0x45ffbd('0x55')](_0x35f8d9[_0x45ffbd('0x129')],[_0x45ffbd('0x3'),'id'])})[_0x45ffbd('0x49')](function(){const _0x4987b7=_0x45ffbd;for(let _0x498634=0x0;_0x498634<_0x35f8d9[_0x4987b7('0x129')][_0x4987b7('0x3')][_0x4987b7('0xa1')];_0x498634+=0x1){socket[_0x4987b7('0x23')](_0x4987b7('0x83'),{'WhatsappInteractionId':Number(_0x35f8d9[_0x4987b7('0x129')][_0x4987b7('0x3')][_0x498634]),'UserId':Number(_0x35f8d9['params']['id'])});}return _0x35f8d9['body'][_0x4987b7('0x3')];});})[_0x11471a('0x49')](respondWithResult(_0x2554e6,null))[_0x11471a('0x9e')](handleError(_0x2554e6,null));},exports['removeWhatsappInteractions']=function(_0x5c01f6,_0x5b0a22){const _0x4c6ae5=_0x463a9f;return db[_0x4c6ae5('0xcc')][_0x4c6ae5('0x8f')]({'where':{'id':_0x5c01f6[_0x4c6ae5('0xa5')]['id']}})['then'](handleEntityNotFound(_0x5b0a22,null))[_0x4c6ae5('0x49')](function(_0x5bff72){const _0x4df19c=_0x4c6ae5;if(_0x5bff72)return _0x5bff72[_0x4df19c('0x150')](_0x5c01f6[_0x4df19c('0xa7')][_0x4df19c('0x3')]);})[_0x4c6ae5('0x49')](respondWithStatusCode(_0x5b0a22,null))[_0x4c6ae5('0x9e')](handleError(_0x5b0a22,null));},exports[_0x463a9f('0xd1')]=function(_0x55e1a4,_0x57d9a5){const _0x479201=_0x463a9f;let _0x3d6854={};const _0x10c30e={};let _0x261f4a,_0x386ae7;return db['User'][_0x479201('0x8f')]({'where':{'id':_0x55e1a4[_0x479201('0xa5')]['id']}})[_0x479201('0x49')](handleEntityNotFound(_0x57d9a5,null))[_0x479201('0x49')](function(_0x3ba975){const _0xab20=_0x479201;if(_0x3ba975)return _0x261f4a=_0x3ba975,_0x10c30e[_0xab20('0x13e')]=_[_0xab20('0xba')](db[_0xab20('0x166')]['rawAttributes']),_0x10c30e['query']=_[_0xab20('0xba')](_0x55e1a4['query']),_0x10c30e[_0xab20('0x117')]=_[_0xab20('0x5b')](_0x10c30e[_0xab20('0x13e')],_0x10c30e['query']),_0x3d6854[_0xab20('0x5c')]=_[_0xab20('0x5b')](_0x10c30e[_0xab20('0x13e')],qs['fields'](_0x55e1a4['query'][_0xab20('0x15')])),_0x3d6854[_0xab20('0x5c')]=_0x3d6854['attributes'][_0xab20('0xa1')]?_0x3d6854[_0xab20('0x5c')]:_0x10c30e[_0xab20('0x13e')],_0x3d6854[_0xab20('0x82')]=qs[_0xab20('0x148')](_0x55e1a4['query'][_0xab20('0x148')]),_0x3d6854['where']=qs['filters'](_[_0xab20('0x89')](_0x55e1a4[_0xab20('0xa7')],_0x10c30e[_0xab20('0x117')])),_0x55e1a4[_0xab20('0xa7')][_0xab20('0x113')]&&(_0x3d6854['where']=_[_0xab20('0xb6')](_0x3d6854[_0xab20('0x85')],{[Op['or']]:_[_0xab20('0xc4')](_0x3d6854[_0xab20('0x5c')],function(_0x3b82cf){const _0x5046dd=_0xab20,_0x5c2857={};return _0x5c2857[_0x3b82cf]={[Op[_0x5046dd('0x30')]]:'%'+_0x55e1a4[_0x5046dd('0xa7')][_0x5046dd('0x113')]+'%'},_0x5c2857;})})),_0x3d6854=_[_0xab20('0xb6')]({},_0x3d6854,_0x55e1a4['options']),_0x261f4a['getVoicePrefixes'](_0x3d6854);})[_0x479201('0x49')](function(_0x55aaca){const _0x5d3da0=_0x479201;if(_0x55aaca)return _0x386ae7=_0x55aaca[_0x5d3da0('0xa1')],typeof _0x55e1a4[_0x5d3da0('0xa7')]['nolimit']===_0x5d3da0('0x12b')&&(_0x3d6854[_0x5d3da0('0x3b')]=qs[_0x5d3da0('0x3b')](_0x55e1a4[_0x5d3da0('0xa7')][_0x5d3da0('0x3b')]),_0x3d6854[_0x5d3da0('0x127')]=qs[_0x5d3da0('0x127')](_0x55e1a4[_0x5d3da0('0xa7')][_0x5d3da0('0x127')])),_0x261f4a['getVoicePrefixes'](_0x3d6854);})[_0x479201('0x49')](function(_0x4ad39e){if(_0x4ad39e)return _0x4ad39e?{'count':_0x386ae7,'rows':_0x4ad39e}:null;})[_0x479201('0x49')](respondWithResult(_0x57d9a5,null))[_0x479201('0x9e')](handleError(_0x57d9a5,null));},exports[_0x463a9f('0x34')]=function(_0x4fa130,_0x5774ea){const _0x1d2a07=_0x463a9f;let _0x413a8e={};const _0x3cbd52={};let _0x12e6fa,_0x1ea75;return db[_0x1d2a07('0xcc')]['findOne']({'where':{'id':_0x4fa130['params']['id']}})[_0x1d2a07('0x49')](handleEntityNotFound(_0x5774ea,null))[_0x1d2a07('0x49')](function(_0x5d46f2){const _0x5db04e=_0x1d2a07;if(_0x5d46f2)return _0x12e6fa=_0x5d46f2,_0x3cbd52['model']=_[_0x5db04e('0xba')](db[_0x5db04e('0x156')][_0x5db04e('0x66')]),_0x3cbd52['query']=_[_0x5db04e('0xba')](_0x4fa130['query']),_0x3cbd52['filters']=_[_0x5db04e('0x5b')](_0x3cbd52[_0x5db04e('0x13e')],_0x3cbd52[_0x5db04e('0xa7')]),_0x413a8e['attributes']=_['intersection'](_0x3cbd52[_0x5db04e('0x13e')],qs[_0x5db04e('0x15')](_0x4fa130[_0x5db04e('0xa7')][_0x5db04e('0x15')])),_0x413a8e[_0x5db04e('0x5c')]=_0x413a8e[_0x5db04e('0x5c')]['length']?_0x413a8e[_0x5db04e('0x5c')]:_0x3cbd52[_0x5db04e('0x13e')],_0x413a8e[_0x5db04e('0x82')]=qs[_0x5db04e('0x148')](_0x4fa130[_0x5db04e('0xa7')][_0x5db04e('0x148')]),_0x413a8e[_0x5db04e('0x85')]=qs['filters'](_[_0x5db04e('0x89')](_0x4fa130[_0x5db04e('0xa7')],_0x3cbd52[_0x5db04e('0x117')])),_0x4fa130[_0x5db04e('0xa7')]['filter']&&(_0x413a8e[_0x5db04e('0x85')]=_['merge'](_0x413a8e[_0x5db04e('0x85')],{[Op['or']]:_[_0x5db04e('0xc4')](_0x413a8e['attributes'],function(_0xecc669){const _0x4a635a=_0x5db04e,_0x4814f0={};return _0x4814f0[_0xecc669]={[Op['like']]:'%'+_0x4fa130[_0x4a635a('0xa7')]['filter']+'%'},_0x4814f0;})})),_0x413a8e=_[_0x5db04e('0xb6')]({},_0x413a8e,_0x4fa130['options']),_0x12e6fa['getFaxAccounts'](_0x413a8e);})[_0x1d2a07('0x49')](function(_0x558db1){const _0x5a55c8=_0x1d2a07;if(_0x558db1)return _0x1ea75=_0x558db1[_0x5a55c8('0xa1')],typeof _0x4fa130[_0x5a55c8('0xa7')][_0x5a55c8('0x111')]===_0x5a55c8('0x12b')&&(_0x413a8e[_0x5a55c8('0x3b')]=qs[_0x5a55c8('0x3b')](_0x4fa130[_0x5a55c8('0xa7')][_0x5a55c8('0x3b')]),_0x413a8e['offset']=qs[_0x5a55c8('0x127')](_0x4fa130[_0x5a55c8('0xa7')][_0x5a55c8('0x127')])),_0x12e6fa[_0x5a55c8('0x34')](_0x413a8e);})[_0x1d2a07('0x49')](function(_0x29e906){if(_0x29e906)return _0x29e906?{'count':_0x1ea75,'rows':_0x29e906}:null;})['then'](respondWithResult(_0x5774ea,null))['catch'](handleError(_0x5774ea,null));},exports[_0x463a9f('0x46')]=function(_0x270ece,_0x4d7ec0){const _0x5aec26=_0x463a9f;return db[_0x5aec26('0xcc')]['findOne']({'where':{'id':_0x270ece[_0x5aec26('0xa5')]['id']}})[_0x5aec26('0x49')](handleEntityNotFound(_0x4d7ec0,null))[_0x5aec26('0x49')](function(_0x15a07c){const _0x5a59af=_0x5aec26;if(_0x15a07c)return _0x15a07c['addFaxAccounts'](_0x270ece[_0x5a59af('0x129')]['ids'],{'through':_['omit'](_0x270ece[_0x5a59af('0x129')],['ids','id'])});})[_0x5aec26('0x49')](respondWithResult(_0x4d7ec0,null))[_0x5aec26('0x9e')](handleError(_0x4d7ec0,null));},exports[_0x463a9f('0x140')]=function(_0x4947ac,_0x3776bf){const _0x2f9c02=_0x463a9f;return db[_0x2f9c02('0xcc')][_0x2f9c02('0x8f')]({'where':{'id':_0x4947ac['params']['id']}})[_0x2f9c02('0x49')](handleEntityNotFound(_0x3776bf,null))[_0x2f9c02('0x49')](function(_0xc55f8b){const _0x13d15f=_0x2f9c02;if(_0xc55f8b)return _0xc55f8b['removeFaxAccounts'](_0x4947ac[_0x13d15f('0xa7')]['ids']);})[_0x2f9c02('0x49')](respondWithStatusCode(_0x3776bf,null))[_0x2f9c02('0x9e')](handleError(_0x3776bf,null));},exports[_0x463a9f('0x67')]=function(_0x47d55d,_0x43e1d2){const _0x3f007d=_0x463a9f;let _0x599347={};const _0x351ff9={};let _0x4e88cf,_0x535792;return db[_0x3f007d('0xcc')]['findOne']({'where':{'id':_0x47d55d[_0x3f007d('0xa5')]['id']}})[_0x3f007d('0x49')](handleEntityNotFound(_0x43e1d2,null))[_0x3f007d('0x49')](function(_0x1ab70a){const _0x5101d7=_0x3f007d;if(_0x1ab70a)return _0x4e88cf=_0x1ab70a,_0x351ff9[_0x5101d7('0x13e')]=_[_0x5101d7('0xba')](db[_0x5101d7('0xbc')][_0x5101d7('0x66')]),_0x351ff9[_0x5101d7('0xa7')]=_[_0x5101d7('0xba')](_0x47d55d[_0x5101d7('0xa7')]),_0x351ff9[_0x5101d7('0x117')]=_[_0x5101d7('0x5b')](_0x351ff9[_0x5101d7('0x13e')],_0x351ff9[_0x5101d7('0xa7')]),_0x599347[_0x5101d7('0x5c')]=_['intersection'](_0x351ff9['model'],qs['fields'](_0x47d55d[_0x5101d7('0xa7')]['fields'])),_0x599347['attributes']=_0x599347[_0x5101d7('0x5c')][_0x5101d7('0xa1')]?_0x599347[_0x5101d7('0x5c')]:_0x351ff9['model'],_0x599347['order']=qs[_0x5101d7('0x148')](_0x47d55d['query'][_0x5101d7('0x148')]),_0x599347[_0x5101d7('0x85')]=qs[_0x5101d7('0x117')](_['pick'](_0x47d55d[_0x5101d7('0xa7')],_0x351ff9[_0x5101d7('0x117')])),_0x47d55d['query'][_0x5101d7('0x113')]&&(_0x599347[_0x5101d7('0x85')]=_['merge'](_0x599347[_0x5101d7('0x85')],{[Op['or']]:_[_0x5101d7('0xc4')](_0x599347['attributes'],function(_0x4835cb){const _0x44ab3f=_0x5101d7,_0x5cddd4={};return _0x5cddd4[_0x4835cb]={[Op['like']]:'%'+_0x47d55d['query'][_0x44ab3f('0x113')]+'%'},_0x5cddd4;})})),_0x599347=_[_0x5101d7('0xb6')]({},_0x599347,_0x47d55d[_0x5101d7('0x11c')]),_0x4e88cf['getMailAccounts'](_0x599347);})['then'](function(_0x1977c3){const _0x4d2ee0=_0x3f007d;if(_0x1977c3)return _0x535792=_0x1977c3['length'],typeof _0x47d55d[_0x4d2ee0('0xa7')][_0x4d2ee0('0x111')]==='undefined'&&(_0x599347[_0x4d2ee0('0x3b')]=qs[_0x4d2ee0('0x3b')](_0x47d55d[_0x4d2ee0('0xa7')][_0x4d2ee0('0x3b')]),_0x599347['offset']=qs[_0x4d2ee0('0x127')](_0x47d55d[_0x4d2ee0('0xa7')][_0x4d2ee0('0x127')])),_0x4e88cf[_0x4d2ee0('0x67')](_0x599347);})[_0x3f007d('0x49')](function(_0x3ae5e0){if(_0x3ae5e0)return _0x3ae5e0?{'count':_0x535792,'rows':_0x3ae5e0}:null;})[_0x3f007d('0x49')](respondWithResult(_0x43e1d2,null))[_0x3f007d('0x9e')](handleError(_0x43e1d2,null));},exports[_0x463a9f('0x32')]=function(_0x512b35,_0x25498b){const _0x1a4c52=_0x463a9f;return db[_0x1a4c52('0xcc')]['findOne']({'where':{'id':_0x512b35[_0x1a4c52('0xa5')]['id']}})[_0x1a4c52('0x49')](handleEntityNotFound(_0x25498b,null))[_0x1a4c52('0x49')](function(_0x46af18){const _0x28145a=_0x1a4c52;if(_0x46af18)return _0x46af18[_0x28145a('0x32')](_0x512b35[_0x28145a('0x129')][_0x28145a('0x3')],{'through':_['omit'](_0x512b35['body'],[_0x28145a('0x3'),'id'])});})[_0x1a4c52('0x49')](respondWithResult(_0x25498b,null))[_0x1a4c52('0x9e')](handleError(_0x25498b,null));},exports[_0x463a9f('0xe4')]=function(_0x1f6142,_0x1f220f){const _0x1ec9f3=_0x463a9f;return db['User'][_0x1ec9f3('0x8f')]({'where':{'id':_0x1f6142['params']['id']}})[_0x1ec9f3('0x49')](handleEntityNotFound(_0x1f220f,null))['then'](function(_0x524e19){const _0x31bda5=_0x1ec9f3;if(_0x524e19)return _0x524e19[_0x31bda5('0xe4')](_0x1f6142[_0x31bda5('0xa7')][_0x31bda5('0x3')]);})[_0x1ec9f3('0x49')](respondWithStatusCode(_0x1f220f,null))[_0x1ec9f3('0x9e')](handleError(_0x1f220f,null));},exports['getOpenchannelAccounts']=function(_0x471c47,_0x4e7179){const _0x1edfc5=_0x463a9f;let _0x14b615={};const _0x4ac194={};let _0x4c81e4,_0x2aaa6f;return db[_0x1edfc5('0xcc')][_0x1edfc5('0x8f')]({'where':{'id':_0x471c47[_0x1edfc5('0xa5')]['id']}})[_0x1edfc5('0x49')](handleEntityNotFound(_0x4e7179,null))['then'](function(_0x84b654){const _0x23af63=_0x1edfc5;if(_0x84b654)return _0x4c81e4=_0x84b654,_0x4ac194[_0x23af63('0x13e')]=_[_0x23af63('0xba')](db[_0x23af63('0x10b')]['rawAttributes']),_0x4ac194['query']=_[_0x23af63('0xba')](_0x471c47[_0x23af63('0xa7')]),_0x4ac194[_0x23af63('0x117')]=_[_0x23af63('0x5b')](_0x4ac194[_0x23af63('0x13e')],_0x4ac194[_0x23af63('0xa7')]),_0x14b615[_0x23af63('0x5c')]=_[_0x23af63('0x5b')](_0x4ac194[_0x23af63('0x13e')],qs[_0x23af63('0x15')](_0x471c47[_0x23af63('0xa7')][_0x23af63('0x15')])),_0x14b615[_0x23af63('0x5c')]=_0x14b615[_0x23af63('0x5c')][_0x23af63('0xa1')]?_0x14b615[_0x23af63('0x5c')]:_0x4ac194['model'],_0x14b615[_0x23af63('0x82')]=qs[_0x23af63('0x148')](_0x471c47[_0x23af63('0xa7')][_0x23af63('0x148')]),_0x14b615[_0x23af63('0x85')]=qs[_0x23af63('0x117')](_['pick'](_0x471c47[_0x23af63('0xa7')],_0x4ac194[_0x23af63('0x117')])),_0x471c47[_0x23af63('0xa7')][_0x23af63('0x113')]&&(_0x14b615[_0x23af63('0x85')]=_['merge'](_0x14b615[_0x23af63('0x85')],{[Op['or']]:_[_0x23af63('0xc4')](_0x14b615[_0x23af63('0x5c')],function(_0x4ffeb6){const _0xb02f6b=_0x23af63,_0x25a2b5={};return _0x25a2b5[_0x4ffeb6]={[Op[_0xb02f6b('0x30')]]:'%'+_0x471c47[_0xb02f6b('0xa7')]['filter']+'%'},_0x25a2b5;})})),_0x14b615=_[_0x23af63('0xb6')]({},_0x14b615,_0x471c47[_0x23af63('0x11c')]),_0x4c81e4[_0x23af63('0x10')](_0x14b615);})['then'](function(_0x252c8f){const _0x24b56f=_0x1edfc5;if(_0x252c8f)return _0x2aaa6f=_0x252c8f[_0x24b56f('0xa1')],typeof _0x471c47[_0x24b56f('0xa7')][_0x24b56f('0x111')]===_0x24b56f('0x12b')&&(_0x14b615[_0x24b56f('0x3b')]=qs[_0x24b56f('0x3b')](_0x471c47['query'][_0x24b56f('0x3b')]),_0x14b615[_0x24b56f('0x127')]=qs['offset'](_0x471c47['query']['offset'])),_0x4c81e4[_0x24b56f('0x10')](_0x14b615);})[_0x1edfc5('0x49')](function(_0x4cb8c5){if(_0x4cb8c5)return _0x4cb8c5?{'count':_0x2aaa6f,'rows':_0x4cb8c5}:null;})[_0x1edfc5('0x49')](respondWithResult(_0x4e7179,null))[_0x1edfc5('0x9e')](handleError(_0x4e7179,null));},exports[_0x463a9f('0xd8')]=function(_0x23fc18,_0xd97b2c){const _0x4b9450=_0x463a9f;return db[_0x4b9450('0xcc')][_0x4b9450('0x8f')]({'where':{'id':_0x23fc18[_0x4b9450('0xa5')]['id']}})[_0x4b9450('0x49')](function(_0x463542){const _0xab192b=_0x4b9450;if(_0x463542)return _0x463542['addOpenchannelAccounts'](_0x23fc18[_0xab192b('0x129')][_0xab192b('0x3')],{'through':_[_0xab192b('0x55')](_0x23fc18[_0xab192b('0x129')],[_0xab192b('0x3'),'id'])});})[_0x4b9450('0x49')](respondWithResult(_0xd97b2c,null))[_0x4b9450('0x9e')](handleError(_0xd97b2c,null));},exports[_0x463a9f('0x13c')]=function(_0x35aad0,_0x2be4b4){const _0x2ee5cd=_0x463a9f;return db[_0x2ee5cd('0xcc')]['findOne']({'where':{'id':_0x35aad0[_0x2ee5cd('0xa5')]['id']}})['then'](handleEntityNotFound(_0x2be4b4,null))[_0x2ee5cd('0x49')](function(_0x379090){const _0x1216a3=_0x2ee5cd;if(_0x379090)return _0x379090[_0x1216a3('0x13c')](_0x35aad0[_0x1216a3('0xa7')][_0x1216a3('0x3')]);})[_0x2ee5cd('0x49')](respondWithStatusCode(_0x2be4b4,null))[_0x2ee5cd('0x9e')](handleError(_0x2be4b4,null));},exports[_0x463a9f('0xe0')]=function(_0x17c5a6,_0x35b2a8){const _0x3edde7=_0x463a9f;let _0x32515b={};const _0x19f6b8={};let _0x55c966,_0x1064cc;return db[_0x3edde7('0xcc')][_0x3edde7('0x8f')]({'where':{'id':_0x17c5a6[_0x3edde7('0xa5')]['id']}})[_0x3edde7('0x49')](handleEntityNotFound(_0x35b2a8,null))[_0x3edde7('0x49')](function(_0x84bfca){const _0xf99b3f=_0x3edde7;if(_0x84bfca)return _0x55c966=_0x84bfca,_0x19f6b8['model']=_['keys'](db['SmsAccount'][_0xf99b3f('0x66')]),_0x19f6b8['query']=_[_0xf99b3f('0xba')](_0x17c5a6[_0xf99b3f('0xa7')]),_0x19f6b8['filters']=_[_0xf99b3f('0x5b')](_0x19f6b8[_0xf99b3f('0x13e')],_0x19f6b8['query']),_0x32515b[_0xf99b3f('0x5c')]=_[_0xf99b3f('0x5b')](_0x19f6b8['model'],qs[_0xf99b3f('0x15')](_0x17c5a6['query']['fields'])),_0x32515b[_0xf99b3f('0x5c')]=_0x32515b[_0xf99b3f('0x5c')][_0xf99b3f('0xa1')]?_0x32515b[_0xf99b3f('0x5c')]:_0x19f6b8[_0xf99b3f('0x13e')],_0x32515b[_0xf99b3f('0x82')]=qs[_0xf99b3f('0x148')](_0x17c5a6[_0xf99b3f('0xa7')]['sort']),_0x32515b[_0xf99b3f('0x85')]=qs[_0xf99b3f('0x117')](_[_0xf99b3f('0x89')](_0x17c5a6['query'],_0x19f6b8[_0xf99b3f('0x117')])),_0x17c5a6[_0xf99b3f('0xa7')][_0xf99b3f('0x113')]&&(_0x32515b[_0xf99b3f('0x85')]=_[_0xf99b3f('0xb6')](_0x32515b['where'],{[Op['or']]:_[_0xf99b3f('0xc4')](_0x32515b[_0xf99b3f('0x5c')],function(_0x39c105){const _0x2a0e3b=_0xf99b3f,_0xe02f9c={};return _0xe02f9c[_0x39c105]={[Op[_0x2a0e3b('0x30')]]:'%'+_0x17c5a6[_0x2a0e3b('0xa7')]['filter']+'%'},_0xe02f9c;})})),_0x32515b=_[_0xf99b3f('0xb6')]({},_0x32515b,_0x17c5a6[_0xf99b3f('0x11c')]),_0x55c966[_0xf99b3f('0xe0')](_0x32515b);})['then'](function(_0x2e0ffa){const _0x378996=_0x3edde7;if(_0x2e0ffa)return _0x1064cc=_0x2e0ffa[_0x378996('0xa1')],typeof _0x17c5a6[_0x378996('0xa7')][_0x378996('0x111')]===_0x378996('0x12b')&&(_0x32515b[_0x378996('0x3b')]=qs[_0x378996('0x3b')](_0x17c5a6[_0x378996('0xa7')][_0x378996('0x3b')]),_0x32515b['offset']=qs[_0x378996('0x127')](_0x17c5a6[_0x378996('0xa7')][_0x378996('0x127')])),_0x55c966[_0x378996('0xe0')](_0x32515b);})[_0x3edde7('0x49')](function(_0x318be9){if(_0x318be9)return _0x318be9?{'count':_0x1064cc,'rows':_0x318be9}:null;})[_0x3edde7('0x49')](respondWithResult(_0x35b2a8,null))[_0x3edde7('0x9e')](handleError(_0x35b2a8,null));},exports[_0x463a9f('0xe')]=function(_0xbb54a7,_0x5d99b0){const _0x69995=_0x463a9f;return db[_0x69995('0xcc')][_0x69995('0x8f')]({'where':{'id':_0xbb54a7['params']['id']}})[_0x69995('0x49')](handleEntityNotFound(_0x5d99b0,null))[_0x69995('0x49')](function(_0x1f7821){const _0xe58bf1=_0x69995;if(_0x1f7821)return _0x1f7821['addSmsAccounts'](_0xbb54a7[_0xe58bf1('0x129')][_0xe58bf1('0x3')],{'through':_[_0xe58bf1('0x55')](_0xbb54a7[_0xe58bf1('0x129')],[_0xe58bf1('0x3'),'id'])});})[_0x69995('0x49')](respondWithResult(_0x5d99b0,null))[_0x69995('0x9e')](handleError(_0x5d99b0,null));},exports[_0x463a9f('0x6f')]=function(_0x1406b9,_0x558dd9){const _0x480de3=_0x463a9f;return db[_0x480de3('0xcc')][_0x480de3('0x8f')]({'where':{'id':_0x1406b9['params']['id']}})[_0x480de3('0x49')](handleEntityNotFound(_0x558dd9,null))[_0x480de3('0x49')](function(_0xfd50db){const _0x111800=_0x480de3;if(_0xfd50db)return _0xfd50db[_0x111800('0x6f')](_0x1406b9[_0x111800('0xa7')][_0x111800('0x3')]);})[_0x480de3('0x49')](respondWithStatusCode(_0x558dd9,null))[_0x480de3('0x9e')](handleError(_0x558dd9,null));},exports[_0x463a9f('0x78')]=function(_0x485124,_0x54d254){const _0x4c1cb2=_0x463a9f;let _0x13a58d={};const _0x2a81ff={};let _0xe4bea2,_0xaefa80;return db[_0x4c1cb2('0xcc')][_0x4c1cb2('0x8f')]({'where':{'id':_0x485124[_0x4c1cb2('0xa5')]['id']}})[_0x4c1cb2('0x49')](handleEntityNotFound(_0x54d254,null))[_0x4c1cb2('0x49')](function(_0xc9acaa){const _0x3e532e=_0x4c1cb2;if(_0xc9acaa)return _0xe4bea2=_0xc9acaa,_0x2a81ff['model']=_[_0x3e532e('0xba')](db[_0x3e532e('0x47')][_0x3e532e('0x66')]),_0x2a81ff['query']=_[_0x3e532e('0xba')](_0x485124[_0x3e532e('0xa7')]),_0x2a81ff['filters']=_[_0x3e532e('0x5b')](_0x2a81ff[_0x3e532e('0x13e')],_0x2a81ff[_0x3e532e('0xa7')]),_0x13a58d[_0x3e532e('0x5c')]=_[_0x3e532e('0x5b')](_0x2a81ff[_0x3e532e('0x13e')],qs[_0x3e532e('0x15')](_0x485124[_0x3e532e('0xa7')][_0x3e532e('0x15')])),_0x13a58d[_0x3e532e('0x5c')]=_0x13a58d[_0x3e532e('0x5c')][_0x3e532e('0xa1')]?_0x13a58d[_0x3e532e('0x5c')]:_0x2a81ff[_0x3e532e('0x13e')],_0x13a58d[_0x3e532e('0x82')]=qs['sort'](_0x485124[_0x3e532e('0xa7')][_0x3e532e('0x148')]),_0x13a58d[_0x3e532e('0x85')]=qs[_0x3e532e('0x117')](_[_0x3e532e('0x89')](_0x485124[_0x3e532e('0xa7')],_0x2a81ff[_0x3e532e('0x117')])),_0x485124[_0x3e532e('0xa7')][_0x3e532e('0x113')]&&(_0x13a58d[_0x3e532e('0x85')]=_[_0x3e532e('0xb6')](_0x13a58d[_0x3e532e('0x85')],{[Op['or']]:_[_0x3e532e('0xc4')](_0x13a58d[_0x3e532e('0x5c')],function(_0x73bcb9){const _0x3ffb69=_0x3e532e,_0xc0ac3f={};return _0xc0ac3f[_0x73bcb9]={[Op[_0x3ffb69('0x30')]]:'%'+_0x485124[_0x3ffb69('0xa7')][_0x3ffb69('0x113')]+'%'},_0xc0ac3f;})})),_0x13a58d=_[_0x3e532e('0xb6')]({},_0x13a58d,_0x485124[_0x3e532e('0x11c')]),_0xe4bea2[_0x3e532e('0x78')](_0x13a58d);})[_0x4c1cb2('0x49')](function(_0x5ef5d1){const _0x3939a9=_0x4c1cb2;if(_0x5ef5d1)return _0xaefa80=_0x5ef5d1['length'],typeof _0x485124['query'][_0x3939a9('0x111')]===_0x3939a9('0x12b')&&(_0x13a58d[_0x3939a9('0x3b')]=qs[_0x3939a9('0x3b')](_0x485124[_0x3939a9('0xa7')][_0x3939a9('0x3b')]),_0x13a58d[_0x3939a9('0x127')]=qs[_0x3939a9('0x127')](_0x485124[_0x3939a9('0xa7')][_0x3939a9('0x127')])),_0xe4bea2[_0x3939a9('0x78')](_0x13a58d);})['then'](function(_0x532a42){if(_0x532a42)return _0x532a42?{'count':_0xaefa80,'rows':_0x532a42}:null;})['then'](respondWithResult(_0x54d254,null))[_0x4c1cb2('0x9e')](handleError(_0x54d254,null));},exports[_0x463a9f('0xdc')]=function(_0x42fec6,_0x3189ed){const _0x284bc5=_0x463a9f;return db['User']['findOne']({'where':{'id':_0x42fec6[_0x284bc5('0xa5')]['id']}})['then'](handleEntityNotFound(_0x3189ed,null))[_0x284bc5('0x49')](function(_0x24e4d7){const _0x8022dd=_0x284bc5;if(_0x24e4d7)return _0x24e4d7['addChatWebsites'](_0x42fec6[_0x8022dd('0x129')]['ids'],{'through':_[_0x8022dd('0x55')](_0x42fec6[_0x8022dd('0x129')],['ids','id'])});})['then'](respondWithResult(_0x3189ed,null))[_0x284bc5('0x9e')](handleError(_0x3189ed,null));},exports[_0x463a9f('0xea')]=function(_0xa79c2e,_0x4999b6){const _0x3ee4dc=_0x463a9f;return db[_0x3ee4dc('0xcc')]['findOne']({'where':{'id':_0xa79c2e[_0x3ee4dc('0xa5')]['id']}})[_0x3ee4dc('0x49')](handleEntityNotFound(_0x4999b6,null))['then'](function(_0x392dba){const _0x318ec0=_0x3ee4dc;if(_0x392dba)return _0x392dba[_0x318ec0('0xea')](_0xa79c2e[_0x318ec0('0xa7')]['ids']);})[_0x3ee4dc('0x49')](respondWithStatusCode(_0x4999b6,null))[_0x3ee4dc('0x9e')](handleError(_0x4999b6,null));},exports[_0x463a9f('0x8')]=function(_0x5da4d4,_0x2629d3){const _0x30a37b=_0x463a9f;let _0x277d06={};const _0x61763a={};let _0x3fc3c9,_0x3eaa27;return db[_0x30a37b('0xcc')][_0x30a37b('0x8f')]({'where':{'id':_0x5da4d4[_0x30a37b('0xa5')]['id']}})[_0x30a37b('0x49')](handleEntityNotFound(_0x2629d3,null))[_0x30a37b('0x49')](function(_0x388781){const _0x23a8c4=_0x30a37b;if(_0x388781)return _0x3fc3c9=_0x388781,_0x61763a[_0x23a8c4('0x13e')]=_[_0x23a8c4('0xba')](db['WhatsappAccount']['rawAttributes']),_0x61763a['query']=_[_0x23a8c4('0xba')](_0x5da4d4['query']),_0x61763a['filters']=_[_0x23a8c4('0x5b')](_0x61763a[_0x23a8c4('0x13e')],_0x61763a[_0x23a8c4('0xa7')]),_0x277d06[_0x23a8c4('0x5c')]=_[_0x23a8c4('0x5b')](_0x61763a[_0x23a8c4('0x13e')],qs[_0x23a8c4('0x15')](_0x5da4d4[_0x23a8c4('0xa7')]['fields'])),_0x277d06['attributes']=_0x277d06[_0x23a8c4('0x5c')][_0x23a8c4('0xa1')]?_0x277d06[_0x23a8c4('0x5c')]:_0x61763a[_0x23a8c4('0x13e')],_0x277d06[_0x23a8c4('0x82')]=qs[_0x23a8c4('0x148')](_0x5da4d4['query'][_0x23a8c4('0x148')]),_0x277d06['where']=qs[_0x23a8c4('0x117')](_['pick'](_0x5da4d4[_0x23a8c4('0xa7')],_0x61763a[_0x23a8c4('0x117')])),_0x5da4d4[_0x23a8c4('0xa7')][_0x23a8c4('0x113')]&&(_0x277d06['where']=_[_0x23a8c4('0xb6')](_0x277d06[_0x23a8c4('0x85')],{[Op['or']]:_[_0x23a8c4('0xc4')](_0x277d06['attributes'],function(_0x5d1364){const _0x26e471=_0x23a8c4,_0x1d60fb={};return _0x1d60fb[_0x5d1364]={[Op[_0x26e471('0x30')]]:'%'+_0x5da4d4[_0x26e471('0xa7')][_0x26e471('0x113')]+'%'},_0x1d60fb;})})),_0x277d06=_[_0x23a8c4('0xb6')]({},_0x277d06,_0x5da4d4[_0x23a8c4('0x11c')]),_0x3fc3c9[_0x23a8c4('0x8')](_0x277d06);})['then'](function(_0x58688c){const _0x433980=_0x30a37b;if(_0x58688c)return _0x3eaa27=_0x58688c[_0x433980('0xa1')],typeof _0x5da4d4[_0x433980('0xa7')][_0x433980('0x111')]===_0x433980('0x12b')&&(_0x277d06[_0x433980('0x3b')]=qs['limit'](_0x5da4d4['query'][_0x433980('0x3b')]),_0x277d06['offset']=qs[_0x433980('0x127')](_0x5da4d4[_0x433980('0xa7')][_0x433980('0x127')])),_0x3fc3c9[_0x433980('0x8')](_0x277d06);})[_0x30a37b('0x49')](function(_0x23469b){if(_0x23469b)return _0x23469b?{'count':_0x3eaa27,'rows':_0x23469b}:null;})[_0x30a37b('0x49')](respondWithResult(_0x2629d3,null))[_0x30a37b('0x9e')](handleError(_0x2629d3,null));},exports[_0x463a9f('0x1a')]=function(_0x5499f4,_0x1ad17a){const _0x37eb9e=_0x463a9f;return db[_0x37eb9e('0xcc')]['findOne']({'where':{'id':_0x5499f4[_0x37eb9e('0xa5')]['id']}})[_0x37eb9e('0x49')](handleEntityNotFound(_0x1ad17a,null))['then'](function(_0x27335f){const _0x217662=_0x37eb9e;if(_0x27335f)return _0x27335f[_0x217662('0x1a')](_0x5499f4[_0x217662('0x129')][_0x217662('0x3')],{'through':_[_0x217662('0x55')](_0x5499f4['body'],[_0x217662('0x3'),'id'])});})[_0x37eb9e('0x49')](respondWithResult(_0x1ad17a,null))['catch'](handleError(_0x1ad17a,null));},exports[_0x463a9f('0xe1')]=function(_0x3055b8,_0x6d6856){const _0x15968a=_0x463a9f;return db[_0x15968a('0xcc')][_0x15968a('0x8f')]({'where':{'id':_0x3055b8[_0x15968a('0xa5')]['id']}})[_0x15968a('0x49')](handleEntityNotFound(_0x6d6856,null))[_0x15968a('0x49')](function(_0xdeb1e4){const _0x497758=_0x15968a;if(_0xdeb1e4)return _0xdeb1e4[_0x497758('0xe1')](_0x3055b8['query'][_0x497758('0x3')]);})[_0x15968a('0x49')](respondWithStatusCode(_0x6d6856,null))[_0x15968a('0x9e')](handleError(_0x6d6856,null));},exports[_0x463a9f('0x152')]=function(_0xf7640e,_0x578f5e){const _0x3a382f=_0x463a9f;let _0x55d26d={};const _0x223be5={};let _0x3e084b,_0xbe06ea;return db['User'][_0x3a382f('0x8f')]({'where':{'id':_0xf7640e[_0x3a382f('0xa5')]['id']}})[_0x3a382f('0x49')](handleEntityNotFound(_0x578f5e,null))[_0x3a382f('0x49')](function(_0x54b6e3){const _0x1177ce=_0x3a382f;if(_0x54b6e3)return _0x3e084b=_0x54b6e3,_0x223be5[_0x1177ce('0x13e')]=_[_0x1177ce('0xba')](db[_0x1177ce('0x8c')]['rawAttributes']),_0x223be5['query']=_[_0x1177ce('0xba')](_0xf7640e[_0x1177ce('0xa7')]),_0x223be5[_0x1177ce('0x117')]=_[_0x1177ce('0x5b')](_0x223be5[_0x1177ce('0x13e')],_0x223be5[_0x1177ce('0xa7')]),_0x55d26d[_0x1177ce('0x5c')]=_['intersection'](_0x223be5[_0x1177ce('0x13e')],qs[_0x1177ce('0x15')](_0xf7640e[_0x1177ce('0xa7')]['fields'])),_0x55d26d[_0x1177ce('0x5c')]=_0x55d26d[_0x1177ce('0x5c')]['length']?_0x55d26d['attributes']:_0x223be5[_0x1177ce('0x13e')],_0x55d26d['order']=qs[_0x1177ce('0x148')](_0xf7640e[_0x1177ce('0xa7')][_0x1177ce('0x148')]),_0x55d26d[_0x1177ce('0x85')]=qs['filters'](_[_0x1177ce('0x89')](_0xf7640e['query'],_0x223be5['filters'])),_0xf7640e[_0x1177ce('0xa7')][_0x1177ce('0x113')]&&(_0x55d26d['where']=_[_0x1177ce('0xb6')](_0x55d26d[_0x1177ce('0x85')],{[Op['or']]:_['map'](_0x55d26d[_0x1177ce('0x5c')],function(_0x34e6c2){const _0x5844f3=_0x1177ce,_0x5f4e4b={};return _0x5f4e4b[_0x34e6c2]={[Op['like']]:'%'+_0xf7640e[_0x5844f3('0xa7')][_0x5844f3('0x113')]+'%'},_0x5f4e4b;})})),_0x55d26d=_['merge']({},_0x55d26d,_0xf7640e['options']),_0x3e084b['getSquareProjects'](_0x55d26d);})['then'](function(_0x3e95ac){const _0x4465b2=_0x3a382f;if(_0x3e95ac)return _0xbe06ea=_0x3e95ac[_0x4465b2('0xa1')],typeof _0xf7640e[_0x4465b2('0xa7')][_0x4465b2('0x111')]==='undefined'&&(_0x55d26d[_0x4465b2('0x3b')]=qs[_0x4465b2('0x3b')](_0xf7640e[_0x4465b2('0xa7')][_0x4465b2('0x3b')]),_0x55d26d[_0x4465b2('0x127')]=qs[_0x4465b2('0x127')](_0xf7640e[_0x4465b2('0xa7')]['offset'])),_0x3e084b[_0x4465b2('0x152')](_0x55d26d);})[_0x3a382f('0x49')](function(_0x304909){if(_0x304909)return _0x304909?{'count':_0xbe06ea,'rows':_0x304909}:null;})[_0x3a382f('0x49')](respondWithResult(_0x578f5e,null))['catch'](handleError(_0x578f5e,null));},exports['addSquareProjects']=function(_0x57e1c0,_0x5efcaf){const _0x4307c7=_0x463a9f;return db['User'][_0x4307c7('0x8f')]({'where':{'id':_0x57e1c0[_0x4307c7('0xa5')]['id']}})[_0x4307c7('0x49')](handleEntityNotFound(_0x5efcaf,null))[_0x4307c7('0x49')](function(_0x22f3af){const _0xaf522d=_0x4307c7;if(_0x22f3af)return _0x22f3af[_0xaf522d('0x69')](_0x57e1c0['body'][_0xaf522d('0x3')],{'through':_[_0xaf522d('0x55')](_0x57e1c0[_0xaf522d('0x129')],[_0xaf522d('0x3'),'id'])});})[_0x4307c7('0x49')](respondWithResult(_0x5efcaf,null))[_0x4307c7('0x9e')](handleError(_0x5efcaf,null));},exports[_0x463a9f('0xa6')]=function(_0x38915e,_0x1c3a9b){const _0x277788=_0x463a9f;return db[_0x277788('0xcc')][_0x277788('0x8f')]({'where':{'id':_0x38915e['params']['id']}})[_0x277788('0x49')](handleEntityNotFound(_0x1c3a9b,null))[_0x277788('0x49')](function(_0x5d962a){const _0x27d4fb=_0x277788;if(_0x5d962a)return _0x5d962a[_0x27d4fb('0xa6')](_0x38915e[_0x27d4fb('0xa7')][_0x27d4fb('0x3')]);})[_0x277788('0x49')](respondWithStatusCode(_0x1c3a9b,null))['catch'](handleError(_0x1c3a9b,null));},exports[_0x463a9f('0x2')]=function(_0x239537,_0x5da326){const _0x38329d=_0x463a9f;let _0x16489d={};const _0x4cecb5={},_0x1421a2={'count':0x0,'rows':[]},_0x5de858=db['CmHopper'][_0x38329d('0x66')];_0x4cecb5[_0x38329d('0x13e')]=_[_0x38329d('0xba')](_0x5de858),_0x4cecb5[_0x38329d('0xa7')]=_[_0x38329d('0xba')](_0x239537['query']),_0x4cecb5['filters']=_['intersection'](_0x4cecb5['model'],_0x4cecb5[_0x38329d('0xa7')]),_0x4cecb5[_0x38329d('0x117')]=_[_0x38329d('0x13')](_0x4cecb5[_0x38329d('0x117')],['$and','$or',_0x38329d('0xc2'),'$gte',_0x38329d('0xc7'),_0x38329d('0x104'),_0x38329d('0xf9'),_0x38329d('0x4a'),_0x38329d('0x13a'),_0x38329d('0x21'),'$notBetween',_0x38329d('0x11b'),_0x38329d('0xae'),_0x38329d('0xe6'),_0x38329d('0xdd'),_0x38329d('0x144'),_0x38329d('0xe7'),'$like',_0x38329d('0x162'),_0x38329d('0x86'),_0x38329d('0x7d'),_0x38329d('0x5d')]),_0x16489d[_0x38329d('0x5c')]=_['intersection'](_0x4cecb5[_0x38329d('0x13e')],qs[_0x38329d('0x15')](_0x239537[_0x38329d('0xa7')][_0x38329d('0x15')])),_0x16489d[_0x38329d('0x5c')]=_0x16489d[_0x38329d('0x5c')][_0x38329d('0xa1')]?_0x16489d[_0x38329d('0x5c')]:_0x4cecb5[_0x38329d('0x13e')];typeof _0x239537[_0x38329d('0xa7')][_0x38329d('0x111')]===_0x38329d('0x12b')&&(_0x16489d['limit']=qs[_0x38329d('0x3b')](_0x239537[_0x38329d('0xa7')][_0x38329d('0x3b')]),_0x16489d[_0x38329d('0x127')]=qs[_0x38329d('0x127')](_0x239537[_0x38329d('0xa7')]['offset']));_0x16489d[_0x38329d('0x82')]=qs[_0x38329d('0x148')](_0x239537[_0x38329d('0xa7')][_0x38329d('0x148')]),_0x16489d[_0x38329d('0x85')]=qs[_0x38329d('0x117')](_[_0x38329d('0x89')](_0x239537['query'],_0x4cecb5[_0x38329d('0x117')]));_0x239537['query']['filter']&&(_0x16489d[_0x38329d('0x85')]=_[_0x38329d('0xb6')](_0x16489d[_0x38329d('0x85')],{[Op['or']]:_['map'](_0x16489d['attributes'],function(_0x5f3fd8){const _0x507df9=_0x38329d,_0x310d3e={};return _0x310d3e[_0x5f3fd8]={[Op[_0x507df9('0x30')]]:'%'+_0x239537[_0x507df9('0xa7')][_0x507df9('0x113')]+'%'},_0x310d3e;})}));_0x16489d[_0x38329d('0x85')]={[Op[_0x38329d('0x84')]]:[_0x16489d[_0x38329d('0x85')],{[Op['or']]:[{'UserId':_0x239537[_0x38329d('0xa5')]['id']},{'OwnerId':_0x239537[_0x38329d('0xa5')]['id']}]}]},_0x16489d=_[_0x38329d('0xb6')]({},_0x16489d,_0x239537[_0x38329d('0x11c')]);const _0x1f024b={'where':_0x16489d['where']};return db[_0x38329d('0xd0')][_0x38329d('0x24')](_0x1f024b)[_0x38329d('0x49')](function(_0xaee5c9){const _0x522200=_0x38329d;return _0x1421a2[_0x522200('0x24')]=_0xaee5c9,_0x239537['query']['includeAll']&&(_0x16489d[_0x522200('0x3a')]=[{'attributes':['id','firstName',_0x522200('0x1e'),_0x522200('0xb1')],'model':db[_0x522200('0x63')],'as':'Contact'},{'attributes':['id','name',_0x522200('0x153')],'model':db['VoiceQueue'],'as':'Queue'}]),db['CmHopper'][_0x522200('0x135')](_0x16489d);})[_0x38329d('0x49')](function(_0x389a8b){return _0x1421a2['rows']=_0x389a8b,_0x1421a2;})[_0x38329d('0x49')](respondWithFilteredResult(_0x5da326,_0x16489d))[_0x38329d('0x9e')](handleError(_0x5da326,null));},exports[_0x463a9f('0x97')]=function(_0x557d76,_0x3b50c0){const _0x395b8f=_0x463a9f;return!_['isNil'](_0x557d76[_0x395b8f('0x1f')]['id'])&&(_0x557d76[_0x395b8f('0x1f')][_0x395b8f('0x15a')]=='admin'||_0x557d76[_0x395b8f('0x1f')][_0x395b8f('0x15a')]=='user')?db[_0x395b8f('0xcc')][_0x395b8f('0x8f')]({'where':{'id':_0x557d76[_0x395b8f('0xa5')]['id']},'raw':!![]})[_0x395b8f('0x49')](function(_0x3261d8){const _0x160a62=_0x395b8f;return authService[_0x160a62('0xf7')](_0x3261d8);})['then'](function(_0x1ed695){const _0x306e14=_0x395b8f;return _0x1ed695?_0x3b50c0[_0x306e14('0x2a')](0xc8)['json']({'api_key':_0x1ed695[_0x306e14('0xb7')]}):_0x3b50c0[_0x306e14('0x2a')](0xcc)[_0x306e14('0x57')]({'message':_0x306e14('0x15f')});})[_0x395b8f('0x9e')](handleError(_0x3b50c0,0x193)):_0x3b50c0[_0x395b8f('0x2a')](0x191)['json']({'message':_0x395b8f('0xf')});},exports['createApiKey']=function(_0x46ed64,_0x278af1){const _0x2d0f45=_0x463a9f;return!_['isNil'](_0x46ed64[_0x2d0f45('0x1f')]['id'])&&(_0x46ed64[_0x2d0f45('0x1f')]['role']==_0x2d0f45('0x35')||_0x46ed64['user'][_0x2d0f45('0x15a')]=='user')?db[_0x2d0f45('0x123')][_0x2d0f45('0x8f')]({'where':{'id':_0x46ed64['params']['id']}})[_0x2d0f45('0x49')](function(_0x53e9fc){return authService['generateApiKey'](_0x53e9fc);})['then'](function(_0x5c7df5){const _0x3bd26b=_0x2d0f45;return db['User'][_0x3bd26b('0x1')]({'apiKeyIat':_0x5c7df5['iat'],'apiKeyNonce':_0x5c7df5[_0x3bd26b('0x139')]},{'where':{'id':_0x46ed64[_0x3bd26b('0xa5')]['id']}})['then'](function(){const _0x116e49=_0x3bd26b;return _0x278af1['status'](0xc8)[_0x116e49('0x57')]({'api_key':_0x5c7df5['token']});});})[_0x2d0f45('0x9e')](handleError(_0x278af1,0x193)):_0x278af1[_0x2d0f45('0x2a')](0x191)[_0x2d0f45('0x57')]({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});},exports[_0x463a9f('0x143')]=function(_0x5f402a,_0x2bc4b8){const _0x456fd6=_0x463a9f;return!_['isNil'](_0x5f402a[_0x456fd6('0x1f')]['id'])&&(_0x5f402a[_0x456fd6('0x1f')]['role']==_0x456fd6('0x35')||_0x5f402a['user'][_0x456fd6('0x15a')]==_0x456fd6('0x1f'))?db['Use'][_0x456fd6('0x8f')]({'where':{'id':_0x5f402a[_0x456fd6('0xa5')]['id']}})[_0x456fd6('0x49')](handleEntityNotFound(_0x2bc4b8,null))[_0x456fd6('0x49')](function(_0x59be99){const _0x4fdf57=_0x456fd6;if(_0x59be99&&_0x59be99[_0x4fdf57('0x12')]&&_0x59be99[_0x4fdf57('0x60')])return _0x59be99;else throw{'message':_0x4fdf57('0xc')};})['then'](function(){const _0x432779=_0x456fd6;return db['User'][_0x432779('0x1')]({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x5f402a[_0x432779('0xa5')]['id']}});})[_0x456fd6('0x49')](respondWithStatusCode(_0x2bc4b8,0xc8))[_0x456fd6('0x9e')](handleError(_0x2bc4b8,0x193)):_0x2bc4b8[_0x456fd6('0x2a')](0x191)['json']({'message':_0x456fd6('0xf')});},exports['whoami']=function(_0x3d67ec,_0x26e6e3){const _0x23fb29=_0x463a9f,_0x5a08a7=_0x3d67ec['user'][_0x23fb29('0xc8')]({'plain':!![]});return!_0x5a08a7?_0x26e6e3[_0x23fb29('0x2a')](0x191)['send'](_0x23fb29('0x90')):_0x26e6e3['status'](0xc8)[_0x23fb29('0x57')](_0x5a08a7);};
\ No newline at end of file
+const a648_0x5109=['user_has_sms_interactions:save','token','max','findByPk','keys','pick','removeMailAccounts','include','result','updatePasswordsHistory','getChatInteractions','getChatWebsites','interface','UserVoiceQueue.penalty','Pause','retrieveApiKey','$any','../../config/logger','MailInteraction','getOpenchannelQueues','$lt','chatPause','pause','getFaxInteractions','model','User','MailAccount','removeSmsAccounts','smsPause','$notBetween','Unauthorized','addQueues','download','intrf','openchannel','getSmsAccounts','min_internal','addSmsInteractions','type','all','where','getMailInteractions','passwordHistoryLimit','SmsAccount','addChatWebsites','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','getOpenchannelInteractions','You\x20can\x27t\x20delete\x20yourself','api','addMailAccounts','online','request\x20sent','rows','omit','../../components/parsers/qs','penalty','unpause','resolve','100','permissions','$not','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Telephones','validatePasswordPattern','transaction','YYYY-MM-DD\x20HH:mm:ss','rawAttributes','generateApiKey','removeAgent','moment','sort','map','removeTeams','mail','getApiKey','addFaxAccounts','MemberReport','admin','removeSquareProjects','$between','createApiKey','sequelize','login','add','differenceBy','changePassword','firstName','Fax','getChatQueues','user_has_whatsapp_interactions:save','isEmpty','params','getLists','Queues','user_has_fax_interactions:save','from','VoiceQueue','role','concat','push','Setting','apiKeyNonce','$like','SquareProject','offset','getSmsInteractions','get','../../components/auth/service','108','isValidChannel','send','../../config/environment','lastPauseAt','remoteAddress','set','user_has_sms_interactions:remove','isMiddleware','CmList','../../mysqldb','../../rediscache','VoicePrefix','util','nolimit','getAvatar','API\x20key\x20not\x20available','isArray','intersection','$notLike','findOne','getDataValue','Invalid\x20body\x20format.\x20Use\x20newPassword','value','removeSmsInteractions','emit','user_has_openchannel_interactions:remove','Use','removeOpenchannelInteractions','securePassword','$overlap','x-forwarded-for','getVoiceQueues','WhatsappAccount','message','getRecordings','setDataValue','format','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','fullname','update','mailPause','getFaxAccounts','path','phone','like','destroy','$in','bulkCreate','102','ChatInteraction','count','getGroups','lower','length','ignore','attributes','Mail','create','userpic','106','stringify','CmContact','Chat','describe','chat','Contact','catch','merge','addSquareProjects','fieldName','removeWhatsappAccounts','SmsInteraction','getQueues','Tag','getScheduledCalls','user','$gte','undefined','removeFaxInteractions','addContacts','Openchannel','getMailAccounts','WhatsappInteraction','isNil','getWhatsappQueues','and','device','Content-Range','info','options','filter','getVoiceQueuesRt','getWhatsappAccounts','ScreenRecording','faxPause','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','SELECT','internal','removeChatInteractions','settingsEnabled','query','pauseType','LOGIN','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)','addSmsAccounts','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','whoami','Voice','getSmsQueues','manual','removeOpenchannelAccounts','compact','upsert','UserId','addChatInteractions','$ne','removeWhatsappInteractions','key','User,\x20%s,\x20%s,\x20%s','loginInPause','dialActive','UserVoiceQueueRt','user_has_fax_interactions:remove','includeAll','lodash','Whatsapp','findAll','voicemail','ChatWebsite','User,\x20%s,\x20%s','FaxAccount','No\x20API\x20access\x20key\x20found!','addAgent','flatten','Queue:save','getScreenRecordings','QueuePause','PAUSE','limit','Queue:remove','113','111','addWhatsappAccounts','end','getMailQueues','addFaxInteractions','$notILike','telephone','LOGININPAUSE','114','openchannelPause','user_has_chat_interactions:remove','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','autoAssociation','VoiceMail','validatePasswordHistory','filename','show','%s%s','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','lastName','includes','Team','getContacts','existsSync','userProfileId','tag','filters','removeChatWebsites','addOpenchannelAccounts','getFaxQueues','$or','user_has_openchannel_interactions:save','DEFAULT\x20PAUSE','mobile','addOpenchannelInteractions','oldPassword','channel','connection','forEach','previousPasswords','then','List','newPassword','Sms','file','removeApiKey','socket','name','$iLike','Unknown\x20channel','109','capitalize','removeQueues','fields','getSquareProjects','voicePause','password','voice','Unable\x20to\x20retrieve\x20the\x20current\x20user','getTeams','files/images/','VoiceRecording','status','join','user:forcelogout','salt','order','./user.socket','SIP/%s','Wrong\x20credentials','Tags','json','ids','LOCAL/%s@from-sip/n','getOpenchannelAccounts','sms','index','getWhatsappInteractions','error','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','agent','$lte','addAvatar','$contains','user_has_mail_interactions:remove','body','ChatGroup','logout','remove','Queue','toLowerCase','QueueId','Agents','root','getVoicePrefixes','color','$gt','sendStatus','110','removeMailInteractions','some','addTeams','getChannels','UserProfileSection','CmHopper','enforcePasswordHistory','addWhatsappInteractions'];(function(_0x2f9e85,_0x51097d){const _0x1eea71=function(_0x1f538f){while(--_0x1f538f){_0x2f9e85['push'](_0x2f9e85['shift']());}};_0x1eea71(++_0x51097d);}(a648_0x5109,0xac));const a648_0x1eea=function(_0x2f9e85,_0x51097d){_0x2f9e85=_0x2f9e85-0x0;let _0x1eea71=a648_0x5109[_0x2f9e85];return _0x1eea71;};const _0x39246c=a648_0x1eea;'use strict';const moment=require(_0x39246c('0x100')),util=require(_0x39246c('0x134')),path=require(_0x39246c('0x152')),fs=require('fs'),_=require(_0x39246c('0x3e')),{getSocket}=require(_0x39246c('0x132')),socket=getSocket(),authService=require(_0x39246c('0x126')),qs=require(_0x39246c('0xf0')),logger=require(_0x39246c('0xcb'))(_0x39246c('0xea')),utils=require('../../config/utils'),config=require(_0x39246c('0x12a')),db=require(_0x39246c('0x131'))['db'],{Op,QueryTypes,fn,col,where,ValidationError}=require(_0x39246c('0x10c')),licenseUtil=require('../../config/license/util');require(_0x39246c('0x92'))['register'](socket);const jayson=require('jayson/promise'),client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f538f,_0x447508,_0x3ee6bb,_0x27d89d){return new Promise(function(_0x469f61,_0x4dbb7b){const _0x444f46=a648_0x1eea,_0x29ed5a=_0x27d89d||client;return _0x29ed5a['request'](_0x1f538f,_0x3ee6bb)[_0x444f46('0x77')](function(_0x21c964){const _0x86e5f7=_0x444f46;logger[_0x86e5f7('0x1a')](_0x86e5f7('0x43'),_0x447508,_0x86e5f7('0xed')),logger['debug'](_0x86e5f7('0x38'),_0x447508,_0x86e5f7('0xed'),JSON[_0x86e5f7('0x164')](_0x21c964));if(_0x21c964[_0x86e5f7('0x9d')]){if(_0x21c964[_0x86e5f7('0x9d')]['code']===0x1f4)return logger['error'](_0x86e5f7('0x43'),_0x447508,_0x21c964[_0x86e5f7('0x9d')][_0x86e5f7('0x149')]),_0x4dbb7b(_0x21c964['error'][_0x86e5f7('0x149')]);return logger[_0x86e5f7('0x9d')]('User,\x20%s,\x20%s',_0x447508,_0x21c964[_0x86e5f7('0x9d')]['message']),_0x469f61(_0x21c964[_0x86e5f7('0x9d')][_0x86e5f7('0x149')]);}else logger['info']('User,\x20%s,\x20%s',_0x447508,_0x86e5f7('0xed')),_0x469f61(_0x21c964[_0x86e5f7('0xc2')][_0x86e5f7('0x149')]);})[_0x444f46('0x4')](function(_0x5053c2){const _0x25533e=_0x444f46;logger[_0x25533e('0x9d')]('User,\x20%s,\x20%s',_0x447508,_0x5053c2),_0x4dbb7b(_0x5053c2);});});}function respondWithStatusCode(_0x2f7b45,_0x41cc1d){return _0x41cc1d=_0x41cc1d||0xcc,function(_0x26b3c6){const _0x453505=a648_0x1eea;if(_0x26b3c6)return _0x2f7b45[_0x453505('0xb0')](_0x41cc1d);return _0x2f7b45[_0x453505('0x8d')](_0x41cc1d)['end']();};}function respondWithResult(_0x7c2791,_0x14e447){return _0x14e447=_0x14e447||0xc8,function(_0x749946){const _0x3ba040=a648_0x1eea;if(_0x749946)return _0x7c2791[_0x3ba040('0x8d')](_0x14e447)[_0x3ba040('0x96')](_0x749946);};}function respondWithFilteredResult(_0x45599b,_0x153d7f){return function(_0x2e35db){const _0x302683=a648_0x1eea;if(_0x2e35db){const _0x122d2c=_0x2e35db[_0x302683('0x15a')],_0x1d1259=_0x153d7f[_0x302683('0x123')];let _0x13f81e=_0x153d7f['offset']+_0x153d7f[_0x302683('0x4c')],_0x34e8a0;return _0x13f81e>=_0x122d2c?(_0x13f81e=_0x122d2c,_0x34e8a0=0xc8):_0x34e8a0=0xce,_0x45599b[_0x302683('0x8d')](_0x34e8a0),_0x45599b['set'](_0x302683('0x19'),_0x1d1259+'-'+_0x13f81e+'/'+_0x122d2c)['json'](_0x2e35db);}return null;};}function saveUpdates(_0x2a8367){return function(_0x32ac7a){const _0x50f3b3=a648_0x1eea;if(_0x32ac7a)return _0x32ac7a[_0x50f3b3('0x14f')](_0x2a8367)[_0x50f3b3('0x77')](function(_0x4026ca){return _0x4026ca;});return null;};}function removeEntity(_0x9c0c75){return function(_0x51caa0){const _0x527944=a648_0x1eea;if(_0x51caa0)return _0x51caa0[_0x527944('0x155')]()[_0x527944('0x77')](function(){const _0x13b3a1=_0x527944,_0x130e4e=_0x51caa0['get']({'plain':!![]});if(_0x130e4e[_0x13b3a1('0x11c')]==='admin')return;const _0x38897b=[{'name':'Users','value':_0x13b3a1('0xd'),'ignore':!![]},{'name':_0x13b3a1('0xab'),'value':_0x13b3a1('0x9f'),'ignore':![]},{'name':_0x13b3a1('0xf9'),'value':_0x13b3a1('0x55'),'ignore':![]}],_0x4b1a47=_(_0x38897b)['filter'](_0x13b3a1('0x15e'))['map'](_0x13b3a1('0x13e'))[_0x13b3a1('0x13e')]();if(_[_0x13b3a1('0x63')](_0x4b1a47,_0x130e4e[_0x13b3a1('0x11c')]))return;const _0xd1f12f=_['find'](_0x38897b,[_0x13b3a1('0x13e'),_0x130e4e[_0x13b3a1('0x11c')]])[_0x13b3a1('0x7e')];return db['UserProfileResource'][_0x13b3a1('0x155')]({'where':{'type':_0xd1f12f,'resourceId':_0x130e4e['id']}})['then'](function(){return _0x51caa0;});})[_0x527944('0x77')](function(){const _0x55b150=_0x527944;_0x9c0c75[_0x55b150('0x8d')](0xcc)[_0x55b150('0x51')]();});};}function handleEntityNotFound(_0x448fba){return function(_0x2c9dd4){return!_0x2c9dd4&&_0x448fba['sendStatus'](0x194),_0x2c9dd4;};}function handleError(_0x43e7a5,_0x114dec){return _0x114dec=_0x114dec||0x1f4,function(_0x4c3dcc){const _0x9b7376=a648_0x1eea;logger[_0x9b7376('0x9d')](_0x4c3dcc['stack']),_0x4c3dcc[_0x9b7376('0x7e')]&&delete _0x4c3dcc['name'],_0x43e7a5['status'](_0x114dec)['send'](_0x4c3dcc);};}function validateUser(_0x49a627){return new Promise(function(_0x51ce04,_0x4dd908){const _0x483199=a648_0x1eea;if(_0x49a627[_0x483199('0x23')])return _0x51ce04(_0x49a627);return db[_0x483199('0x11f')][_0x483199('0xbd')](0x1)['then'](function(_0x99b914){const _0x19dadc=_0x483199;if(_0x99b914[_0x19dadc('0x144')])authService[_0x19dadc('0xfa')](_0x49a627[_0x19dadc('0x87')]);db[_0x19dadc('0xd3')][_0x19dadc('0xbc')](_0x19dadc('0x23'))[_0x19dadc('0x77')](function(_0x485f64){const _0x3aec89=_0x19dadc;if(_[_0x3aec89('0x15')](_0x485f64)){_0x49a627['internal']=_0x99b914[_0x3aec89('0xde')]||0x1;return;}if(_[_0x3aec89('0x15')](_0x99b914['min_internal'])||_0x99b914[_0x3aec89('0xde')]===_0x485f64){_0x49a627[_0x3aec89('0x23')]=_0x485f64+0x1;return;}if(_0x99b914[_0x3aec89('0xde')]>_0x485f64){_0x49a627[_0x3aec89('0x23')]=_0x99b914[_0x3aec89('0xde')];return;}return db['sequelize'][_0x3aec89('0x26')](_0x3aec89('0x29'),{'type':QueryTypes[_0x3aec89('0x22')]})[_0x3aec89('0x77')](function(_0x4d4c0e){const _0x59a969=_0x3aec89;if(_0x4d4c0e&&_0x4d4c0e[_0x59a969('0x15d')])for(let _0x53b652=0x0,_0x85ee9f=_0x4d4c0e[_0x59a969('0x15d')];_0x53b652<_0x85ee9f&&_[_0x59a969('0x15')](_0x49a627[_0x59a969('0x23')]);_0x53b652++){if(_0x99b914[_0x59a969('0xde')]<=_0x4d4c0e[_0x53b652][_0x59a969('0x11a')])_0x49a627[_0x59a969('0x23')]=_0x4d4c0e[_0x53b652][_0x59a969('0x11a')];else _0x99b914[_0x59a969('0xde')]>_0x4d4c0e[_0x53b652][_0x59a969('0x11a')]&&_0x99b914[_0x59a969('0xde')]<=_0x4d4c0e[_0x53b652]['to']&&(_0x49a627[_0x59a969('0x23')]=_0x99b914[_0x59a969('0xde')]);}return _[_0x59a969('0x15')](_0x49a627[_0x59a969('0x23')])&&(_0x49a627[_0x59a969('0x23')]=_0x485f64+0x1),_0x51ce04(_0x49a627);});});})[_0x483199('0x4')](function(_0x55b238){_0x4dd908(_0x55b238);});});}function updateUser(_0x134e2c){return new Promise(function(_0x59401e,_0x3a90e9){const _0x3a7f5e=a648_0x1eea;try{_0x134e2c[_0x3a7f5e('0x41')]&&(_0x134e2c['mailbox']=_0x134e2c[_0x3a7f5e('0x23')],_0x134e2c[_0x3a7f5e('0x5c')]={'mailbox':_0x134e2c['internal'],'password':_0x134e2c[_0x3a7f5e('0x87')],'fullname':_0x134e2c[_0x3a7f5e('0x14e')],'email':_0x134e2c['email']});if(_0x134e2c[_0x3a7f5e('0x11c')]===_0x3a7f5e('0x9f')){if(!_0x134e2c[_0x3a7f5e('0xf5')])_0x134e2c[_0x3a7f5e('0xf5')]=['101',_0x3a7f5e('0x158'),'103',_0x3a7f5e('0x4e'),_0x3a7f5e('0xb1'),'104','105',_0x3a7f5e('0x163'),'107',_0x3a7f5e('0x127'),_0x3a7f5e('0x81'),_0x3a7f5e('0xf4'),_0x3a7f5e('0x4f'),_0x3a7f5e('0x57')];}_0x59401e(_0x134e2c);}catch(_0x3a8675){_0x3a90e9(_0x3a8675);}});}exports[_0x39246c('0x9b')]=function(_0x1c5960,_0xa4f8c7){const _0x4d2f8f=_0x39246c;let _0x49f172={};const _0x279365={},_0x21dd29={'count':0x0,'rows':[]},_0x24b67d=_[_0x4d2f8f('0x102')](db['User'][_0x4d2f8f('0xfd')],function(_0x25dfe2){const _0x5076c8=_0x4d2f8f;return{'name':_0x25dfe2[_0x5076c8('0x7')],'type':_0x25dfe2[_0x5076c8('0xe0')][_0x5076c8('0x37')]};});_0x279365[_0x4d2f8f('0xd2')]=_['differenceBy'](_[_0x4d2f8f('0x102')](_0x24b67d,_0x4d2f8f('0x7e')),[_0x4d2f8f('0x87'),_0x4d2f8f('0x90')]),_0x279365[_0x4d2f8f('0x26')]=_[_0x4d2f8f('0xbe')](_0x1c5960[_0x4d2f8f('0x26')]),_0x279365[_0x4d2f8f('0x69')]=_[_0x4d2f8f('0x139')](_0x279365['model'],_0x279365[_0x4d2f8f('0x26')]),_0x49f172[_0x4d2f8f('0x15f')]=_[_0x4d2f8f('0x139')](_0x279365['model'],qs[_0x4d2f8f('0x84')](_0x1c5960[_0x4d2f8f('0x26')][_0x4d2f8f('0x84')])),_0x49f172['attributes']=_0x49f172[_0x4d2f8f('0x15f')][_0x4d2f8f('0x15d')]?_0x49f172[_0x4d2f8f('0x15f')]:_0x279365[_0x4d2f8f('0xd2')];typeof _0x1c5960[_0x4d2f8f('0x26')]['nolimit']==='undefined'&&(_0x49f172[_0x4d2f8f('0x4c')]=qs[_0x4d2f8f('0x4c')](_0x1c5960[_0x4d2f8f('0x26')][_0x4d2f8f('0x4c')]),_0x49f172[_0x4d2f8f('0x123')]=qs[_0x4d2f8f('0x123')](_0x1c5960[_0x4d2f8f('0x26')][_0x4d2f8f('0x123')]));_0x49f172[_0x4d2f8f('0x91')]=qs[_0x4d2f8f('0x101')](_0x1c5960[_0x4d2f8f('0x26')][_0x4d2f8f('0x101')]),_0x49f172[_0x4d2f8f('0xe2')]=qs[_0x4d2f8f('0x69')](_[_0x4d2f8f('0xbf')](_0x1c5960['query'],_0x279365[_0x4d2f8f('0x69')]),_0x24b67d);_0x1c5960[_0x4d2f8f('0x26')][_0x4d2f8f('0x1c')]&&(_0x49f172[_0x4d2f8f('0xe2')]=_[_0x4d2f8f('0x5')](_0x49f172[_0x4d2f8f('0xe2')],{[Op['or']]:_[_0x4d2f8f('0x102')](_0x24b67d,function(_0x4abc3e){const _0x2317d6=_0x4d2f8f;if(_0x4abc3e[_0x2317d6('0xe0')]!=='VIRTUAL')return where(fn(_0x2317d6('0x15c'),col(_0x4abc3e[_0x2317d6('0x7e')])),{'$like':fn(_0x2317d6('0x15c'),'%'+_0x1c5960['query'][_0x2317d6('0x1c')]+'%')});})}));_0x49f172=_[_0x4d2f8f('0x5')]({},_0x49f172,_0x1c5960[_0x4d2f8f('0x1b')]);const _0x17b47d={'where':_0x49f172[_0x4d2f8f('0xe2')]};return db['User'][_0x4d2f8f('0x15a')](_0x17b47d)['then'](function(_0x42f65e){const _0x3b39d8=_0x4d2f8f;return _0x21dd29[_0x3b39d8('0x15a')]=_0x42f65e,typeof _0x1c5960[_0x3b39d8('0x26')]['includeAll']!=='undefined'&&(_0x49f172[_0x3b39d8('0xc1')]=[{'all':!![]}]),db[_0x3b39d8('0xd3')][_0x3b39d8('0x40')](_0x49f172);})[_0x4d2f8f('0x77')](function(_0x1e3038){return _0x21dd29['rows']=_0x1e3038,_0x21dd29;})[_0x4d2f8f('0x77')](respondWithFilteredResult(_0xa4f8c7,_0x49f172))['catch'](handleError(_0xa4f8c7,null));},exports[_0x39246c('0x5f')]=function(_0x1c6f70,_0x5544c1){const _0x4e928a=_0x39246c;let _0x17ee89={'raw':![],'where':{'id':_0x1c6f70[_0x4e928a('0x116')]['id']}};const _0x5a9269={};return _0x5a9269['model']=_[_0x4e928a('0x10f')](_['keys'](db[_0x4e928a('0xd3')]['rawAttributes']),[_0x4e928a('0x87'),_0x4e928a('0x90')]),_0x5a9269[_0x4e928a('0x26')]=_[_0x4e928a('0xbe')](_0x1c6f70[_0x4e928a('0x26')]),_0x5a9269[_0x4e928a('0x69')]=_[_0x4e928a('0x139')](_0x5a9269[_0x4e928a('0xd2')],_0x5a9269[_0x4e928a('0x26')]),_0x17ee89[_0x4e928a('0x15f')]=_['intersection'](_0x5a9269['model'],qs[_0x4e928a('0x84')](_0x1c6f70[_0x4e928a('0x26')][_0x4e928a('0x84')])),_0x17ee89[_0x4e928a('0x15f')]=_0x17ee89['attributes'][_0x4e928a('0x15d')]?_0x17ee89[_0x4e928a('0x15f')]:_0x5a9269['model'],_0x1c6f70[_0x4e928a('0x26')][_0x4e928a('0x3d')]&&(_0x17ee89[_0x4e928a('0xc1')]=[{'all':!![]}]),_0x17ee89=_[_0x4e928a('0x5')]({},_0x17ee89,_0x1c6f70[_0x4e928a('0x1b')]),db[_0x4e928a('0xd3')][_0x4e928a('0x13b')](_0x17ee89)[_0x4e928a('0x77')](handleEntityNotFound(_0x5544c1,null))[_0x4e928a('0x77')](respondWithResult(_0x5544c1,null))[_0x4e928a('0x4')](handleError(_0x5544c1,null));},exports['bulkCreate']=function(_0x5d2475,_0x2d2d95){const _0xa79a4f=_0x39246c,_0xaf35ba=_0x5d2475['body'];let _0x55fc3e=[];if(_0x5d2475['user']['role']===_0xa79a4f('0x9f'))throw new Error(_0xa79a4f('0xd8'));if(_['some'](_0xaf35ba,[_0xa79a4f('0x11c'),_0xa79a4f('0xd')])&&_0x5d2475[_0xa79a4f('0xd')][_0xa79a4f('0x11c')]!=='admin')throw new Error(_0xa79a4f('0x14d'));if(_[_0xa79a4f('0xb3')](_0xaf35ba,[_0xa79a4f('0x11c'),'admin'])&&_0x5d2475['user'][_0xa79a4f('0x11c')]!=='admin')throw new Error(_0xa79a4f('0x9e'));return licenseUtil['checkUserLimits'](_0xaf35ba)[_0xa79a4f('0x77')](function(){return validateUser(_0xaf35ba[0x0]);})[_0xa79a4f('0x77')](function(){const _0x47c716=_0xa79a4f;for(let _0x118e0c=0x1;_0x118e0c<_0xaf35ba['length'];_0x118e0c++){const _0x4d9de8=_0xaf35ba[_0x118e0c-0x1][_0x47c716('0x23')];if(!_0xaf35ba[_0x118e0c]['internal'])_0xaf35ba[_0x118e0c][_0x47c716('0x23')]=_0x4d9de8+0x1;_0x55fc3e['push'](validateUser(_0xaf35ba[_0x118e0c]));}return Promise[_0x47c716('0xe1')](_0x55fc3e);})[_0xa79a4f('0x77')](function(){const _0x2bd591=_0xa79a4f;_0x55fc3e=[];for(let _0x51934d=0x0;_0x51934d<_0xaf35ba[_0x2bd591('0x15d')];_0x51934d++){_0x55fc3e[_0x2bd591('0x11e')](updateUser(_0xaf35ba[_0x51934d]));}return Promise[_0x2bd591('0xe1')](_0x55fc3e);})[_0xa79a4f('0x77')](function(){const _0x145fa2=_0xa79a4f;return _0x55fc3e=_0xaf35ba[_0x145fa2('0x102')](_0x7fdcac=>{const _0x7a8225=_0x145fa2;return db['User'][_0x7a8225('0x161')](_0x7fdcac,{'include':[{'model':db[_0x7a8225('0x5c')],'as':_0x7a8225('0x5c')}]})[_0x7a8225('0x77')](function(_0x4cc3b1){return _0x7fdcac['id']=_0x4cc3b1['id'],_0x7fdcac;});}),Promise[_0x145fa2('0xe1')](_0x55fc3e);})[_0xa79a4f('0x77')](function(_0x3119c7){const _0x49becc=_0xa79a4f;if(_0x5d2475[_0x49becc('0xa4')][_0x49becc('0x11c')]===_0x49becc('0xd'))return _0x3119c7;if(_0x5d2475['user']['role']!==_0x49becc('0xd'))return _0x3119c7;const _0x76731c=_[_0x49becc('0xb3')](_0x3119c7,function(_0x8573fa){const _0x2db2c0=_0x49becc;return _0x8573fa[_0x2db2c0('0x11c')]===_0x2db2c0('0x9f')||_0x8573fa[_0x2db2c0('0x11c')]==='telephone';});if(!_0x76731c)return _0x3119c7;return db[_0x49becc('0xb6')]['findAll']({'where':{'name':{[Op['or']]:[_0x49becc('0xab'),'Telephones']},'userProfileId':_0x5d2475['user'][_0x49becc('0x67')]},'raw':!![]})[_0x49becc('0x77')](function(_0x178a06){const _0x1a0b94=_0x49becc;if(_[_0x1a0b94('0x115')](_0x178a06)||!_['some'](_0x178a06,[_0x1a0b94('0x5b'),0x0]))return _0x3119c7;_0x55fc3e=[];const _0x4cb97d=_(_0x178a06)[_0x1a0b94('0x102')](function(_0x646372){const _0x3ff0e7=_0x1a0b94;if(_0x646372['autoAssociation']===0x1)return;return _0x646372[_0x3ff0e7('0x7e')]===_0x3ff0e7('0xab')?_0x3ff0e7('0x9f'):_0x3ff0e7('0x55');})[_0x1a0b94('0x31')]()[_0x1a0b94('0x13e')]();for(let _0x39e3ab=0x0;_0x39e3ab<_0x3119c7[_0x1a0b94('0x15d')];_0x39e3ab++){if(!_[_0x1a0b94('0x63')](_0x4cb97d,_0x3119c7[_0x39e3ab][_0x1a0b94('0x11c')]))return;const _0x6b0b39=_0x3119c7[_0x39e3ab][_0x1a0b94('0x11c')]===_0x1a0b94('0x9f')?_0x1a0b94('0xab'):_0x1a0b94('0xf9');_0x55fc3e[_0x1a0b94('0x11e')](db[_0x1a0b94('0xf7')][_0x1a0b94('0x161')]({'name':_0x3119c7[_0x39e3ab]['name'],'resourceId':_0x3119c7[_0x39e3ab]['id'],'type':_0x6b0b39,'sectionId':_['find'](_0x178a06,[_0x1a0b94('0x7e'),_0x6b0b39])['id']},{}));}return Promise['all'](_0x55fc3e);});})[_0xa79a4f('0x77')](respondWithResult(_0x2d2d95,0xc9))['catch'](handleError(_0x2d2d95,null));},exports[_0x39246c('0x14f')]=function(_0x4b1bae,_0x328ec2){const _0x199f3d=_0x39246c;return _0x4b1bae[_0x199f3d('0xa4')]['id']&&delete _0x4b1bae[_0x199f3d('0xa4')]['id'],delete _0x4b1bae[_0x199f3d('0xa4')][_0x199f3d('0x11c')],db[_0x199f3d('0xd3')][_0x199f3d('0x13b')]({'where':{'id':_0x4b1bae[_0x199f3d('0x116')]['id']}})['then'](handleEntityNotFound(_0x328ec2,null))['then'](saveUpdates(_0x4b1bae['body'],null))[_0x199f3d('0x77')](respondWithResult(_0x328ec2,null))[_0x199f3d('0x4')](handleError(_0x328ec2,null));},exports[_0x39246c('0x1')]=function(_0x472649,_0x1fa81e){const _0x33af7d=_0x39246c;return db[_0x33af7d('0xd3')][_0x33af7d('0x1')]()[_0x33af7d('0x77')](respondWithResult(_0x1fa81e,null))[_0x33af7d('0x4')](handleError(_0x1fa81e,null));},exports['addContacts']=function(_0x3e7f92,_0xbafdca){const _0x494ad8=_0x39246c;return db[_0x494ad8('0xd3')][_0x494ad8('0x13b')]({'where':{'id':_0x3e7f92[_0x494ad8('0x116')]['id']}})[_0x494ad8('0x77')](handleEntityNotFound(_0xbafdca,null))[_0x494ad8('0x77')](function(_0x51938d){const _0x330fb3=_0x494ad8;if(_0x51938d)return _0x51938d[_0x330fb3('0x11')](_0x3e7f92[_0x330fb3('0xa4')]['ids'],{'through':_[_0x330fb3('0xef')](_0x3e7f92[_0x330fb3('0xa4')],[_0x330fb3('0x97'),'id'])});})['then'](respondWithResult(_0xbafdca,null))[_0x494ad8('0x4')](handleError(_0xbafdca,null));},exports[_0x39246c('0x161')]=function(_0xf2bcd5,_0x290f1d){const _0x56ff0f=_0x39246c;if(_0xf2bcd5[_0x56ff0f('0xd')][_0x56ff0f('0x11c')]==='agent')throw new Error(_0x56ff0f('0xd8'));if(_0xf2bcd5[_0x56ff0f('0xa4')][_0x56ff0f('0x11c')]===_0x56ff0f('0xd')&&_0xf2bcd5[_0x56ff0f('0xd')][_0x56ff0f('0x11c')]!==_0x56ff0f('0x108'))throw new Error(_0x56ff0f('0x14d'));if(_0xf2bcd5[_0x56ff0f('0xa4')][_0x56ff0f('0x11c')]===_0x56ff0f('0x108')&&_0xf2bcd5[_0x56ff0f('0xd')][_0x56ff0f('0x11c')]!==_0x56ff0f('0x108'))throw new Error(_0x56ff0f('0x21'));return licenseUtil['checkUserLimits']([_0xf2bcd5[_0x56ff0f('0xa4')]])[_0x56ff0f('0x77')](function(){const _0x1693ea=_0x56ff0f;return validateUser(_0xf2bcd5[_0x1693ea('0xa4')]);})['then'](function(_0x33d6c4){const _0x3e7989=_0x56ff0f;return updateUser(_0x33d6c4)[_0x3e7989('0x77')](function(_0x54a1a6){const _0x3493d8=_0x3e7989;return _0x54a1a6[_0x3493d8('0x11c')]===_0x3493d8('0x108')&&(_0x54a1a6[_0x3493d8('0x25')]=_0xf2bcd5[_0x3493d8('0xd')]['settingsEnabled'],delete _0x54a1a6['userProfileId']),_0x54a1a6;});})[_0x56ff0f('0x77')](function(_0x463df1){const _0x15746a=_0x56ff0f;return db[_0x15746a('0xd3')][_0x15746a('0x161')](_0x463df1,{'include':[{'model':db[_0x15746a('0x5c')],'as':_0x15746a('0x5c')}]});})[_0x56ff0f('0x77')](function(_0x3b2af0){const _0x5ae7aa=_0x56ff0f;if(_0xf2bcd5['body'][_0x5ae7aa('0x11c')]===_0x5ae7aa('0xd'))return _0x3b2af0;if(_0xf2bcd5[_0x5ae7aa('0xd')]['role']!==_0x5ae7aa('0xd'))return _0x3b2af0;return db[_0x5ae7aa('0xb6')]['findOne']({'where':{'name':_0x3b2af0['role']===_0x5ae7aa('0x9f')?'Agents':'Telephones','userProfileId':_0xf2bcd5[_0x5ae7aa('0xd')][_0x5ae7aa('0x67')]},'raw':!![]})['then'](function(_0xed5365){const _0x584ff6=_0x5ae7aa;if(!_0xed5365||_0xed5365['autoAssociation']!=0x0)return _0x3b2af0;return db[_0x584ff6('0xf7')][_0x584ff6('0x161')]({'name':_0x3b2af0['name'],'resourceId':_0x3b2af0['id'],'type':_0xed5365['name'],'sectionId':_0xed5365['id']},{})['then'](function(){return _0x3b2af0;});})[_0x5ae7aa('0x4')](function(_0x2c4fcb){const _0x451af5=_0x5ae7aa;logger[_0x451af5('0x9d')](_0x451af5('0xf8'),_0x2c4fcb);throw _0x2c4fcb;});})['then'](respondWithResult(_0x290f1d,0xc9))[_0x56ff0f('0x4')](handleError(_0x290f1d,null));},exports[_0x39246c('0x110')]=function(_0x4b8f73,_0x417b0f){const _0x966f53=_0x39246c;if(_0x4b8f73[_0x966f53('0xa4')]['id'])delete _0x4b8f73[_0x966f53('0xa4')]['id'];return db[_0x966f53('0xd3')][_0x966f53('0x13b')]({'where':{'id':_0x4b8f73[_0x966f53('0x116')]['id']}})['then'](function(_0x305b78){const _0x53c51=_0x966f53;if(!_0x305b78)return null;if(_0x305b78['id']===_0x4b8f73[_0x53c51('0xd')]['id']){if(!_0x4b8f73[_0x53c51('0xa4')]['oldPassword']||!_0x4b8f73[_0x53c51('0xa4')]['newPassword'])throw new ValidationError(_0x53c51('0x2b'));if(!_0x305b78['authenticate'](_0x4b8f73[_0x53c51('0xa4')][_0x53c51('0x72')]))throw new ValidationError(_0x53c51('0x94'));if(_0x4b8f73[_0x53c51('0xa4')][_0x53c51('0x72')]===_0x4b8f73['body'][_0x53c51('0x79')])throw new ValidationError(_0x53c51('0xe7'));}else{if(_0x4b8f73[_0x53c51('0xd')][_0x53c51('0x11c')]===_0x53c51('0x108')){if(!_0x4b8f73[_0x53c51('0xa4')][_0x53c51('0x79')])throw new ValidationError(_0x53c51('0x13d'));}else{if(_0x4b8f73[_0x53c51('0xd')]['role']==='user'){if(!_0x4b8f73[_0x53c51('0xa4')][_0x53c51('0x79')])throw new ValidationError(_0x53c51('0x13d'));if(_0x305b78['role']!==_0x53c51('0x9f'))throw new ValidationError('Unauthorized');}else throw new ValidationError(_0x53c51('0xd8'));}}return _0x305b78;})[_0x966f53('0x77')](handleEntityNotFound(_0x417b0f,null))[_0x966f53('0x77')](function(_0x351f7b){const _0x9fa3f4=_0x966f53;return db['Setting'][_0x9fa3f4('0x13b')]({'attributes':['id',_0x9fa3f4('0x144'),_0x9fa3f4('0xb8'),'passwordHistoryLimit']})[_0x9fa3f4('0x77')](function(_0x204f56){const _0x6657ec=_0x9fa3f4;if(_0x204f56['securePassword'])authService[_0x6657ec('0xfa')](_0x4b8f73['body']['newPassword']);if(!_0x204f56[_0x6657ec('0xb8')]||!_0x351f7b[_0x6657ec('0x76')])return _0x351f7b;return authService[_0x6657ec('0x5d')](_0x4b8f73[_0x6657ec('0xa4')][_0x6657ec('0x79')],_0x351f7b[_0x6657ec('0x76')],_0x204f56[_0x6657ec('0xe4')]),_0x351f7b;})['then'](saveUpdates({'password':_0x4b8f73[_0x9fa3f4('0xa4')]['newPassword'],'passwordResetAt':_0x4b8f73[_0x9fa3f4('0xd')]['id']==_0x4b8f73['params']['id']?moment():null,'previousPasswords':authService[_0x9fa3f4('0xc3')](_0x4b8f73[_0x9fa3f4('0xa4')][_0x9fa3f4('0x79')],_0x351f7b[_0x9fa3f4('0x76')])},null));})[_0x966f53('0x77')](respondWithResult(_0x417b0f,null))[_0x966f53('0x4')](handleError(_0x417b0f,null));},exports[_0x39246c('0xd9')]=function(_0x4a1ace,_0x57c895){const _0x4eefd6=_0x39246c,_0x292bb7=_0x4a1ace[_0x4eefd6('0xa4')]['channel'];return db[_0x4eefd6('0xd3')]['findOne']({'where':{'id':_0x4a1ace['params']['id']},'attributes':['id',_0x4eefd6('0x7e'),'role',_0x4eefd6('0xec'),'loginInPause',_0x4eefd6('0x86'),'interface']})[_0x4eefd6('0x77')](handleEntityNotFound(_0x57c895,null))[_0x4eefd6('0x77')](function(_0x5cb9f4){const _0x5de373=_0x4eefd6;if(_0x5cb9f4){if(!utils[_0x5de373('0x128')](_0x292bb7))throw new ValidationError(_0x5de373('0x80'));return _0x5cb9f4[_0x5de373('0x10e')+_[_0x5de373('0x82')](_0x292bb7['toLowerCase']())+'Queues'](_0x4a1ace[_0x5de373('0xa4')][_0x5de373('0x97')],{'through':{'penalty':_0x4a1ace[_0x5de373('0xa4')][_0x5de373('0xf1')]||0x0}})[_0x5de373('0x77')](function(_0x3adc6e){const _0x1338f2=_0x5de373;for(let _0x4a513c=0x0;_0x4a513c<_0x4a1ace[_0x1338f2('0xa4')][_0x1338f2('0x97')]['length'];_0x4a513c+=0x1){const _0x2121cc={'UserId':_0x4a1ace[_0x1338f2('0x116')]['id']};_0x2121cc[_[_0x1338f2('0x82')](_0x292bb7[_0x1338f2('0xa9')]())+_0x1338f2('0xaa')]=_0x4a1ace[_0x1338f2('0xa4')]['ids'][_0x4a513c],socket['emit'](_0x1338f2('0xd')+_['capitalize'](_0x292bb7[_0x1338f2('0xa9')]())+_0x1338f2('0x48'),_0x2121cc);}return _0x3adc6e;})[_0x5de373('0x77')](function(){const _0x4df9fb=_0x5de373;if(_0x292bb7===_0x4df9fb('0x88'))return db['VoiceQueue'][_0x4df9fb('0x40')]({'where':{'id':_0x4a1ace[_0x4df9fb('0xa4')][_0x4df9fb('0x97')]||[]},'raw':!![],'attributes':['id',_0x4df9fb('0x7e')]});})[_0x5de373('0x77')](function(_0x53e57a){const _0x1b7e73=_0x5de373,_0x49ae3e=_0x5cb9f4[_0x1b7e73('0x125')]({'plain':!![]}),_0x50612e=[];if(_0x292bb7==='voice'&&_0x49ae3e[_0x1b7e73('0x11c')]===_0x1b7e73('0x9f')&&_0x49ae3e[_0x1b7e73('0xec')]){for(let _0x3aef33=0x0;_0x3aef33<_0x53e57a[_0x1b7e73('0x15d')];_0x3aef33+=0x1){_0x50612e['push']({'membername':_0x49ae3e[_0x1b7e73('0x7e')],'UserId':_0x49ae3e['id'],'queue_name':_0x53e57a[_0x3aef33]['name'],'VoiceQueueId':_0x53e57a[_0x3aef33]['id'],'interface':_[_0x1b7e73('0x15')](_0x49ae3e[_0x1b7e73('0xc6')])?util['format'](_0x1b7e73('0x93'),_0x49ae3e[_0x1b7e73('0x7e')]):_0x49ae3e[_0x1b7e73('0xc6')],'paused':_0x49ae3e[_0x1b7e73('0x86')]||![],'penalty':_0x4a1ace['body'][_0x1b7e73('0xf1')]||0x0});}return Promise[_0x1b7e73('0xe1')](_0x50612e['map'](_0x483d7a=>{const _0x5631e0=_0x1b7e73;return db[_0x5631e0('0x3b')][_0x5631e0('0x32')](_0x483d7a);}));}return _0x5cb9f4;});}})[_0x4eefd6('0x77')](respondWithStatusCode(_0x57c895,null))['catch'](handleError(_0x57c895,null));},exports[_0x39246c('0x83')]=function(_0xf66ad8,_0x35ceae){const _0x2df29b=_0x39246c;let _0x3f3f32;return db[_0x2df29b('0xd3')][_0x2df29b('0x13b')]({'where':{'id':_0xf66ad8[_0x2df29b('0x116')]['id']},'attributes':['id','name','role']})[_0x2df29b('0x77')](handleEntityNotFound(_0x35ceae,null))['then'](function(_0x2c3884){const _0x3c0b78=_0x2df29b;if(_0x2c3884){_0x3f3f32=_0x2c3884;if(!_0xf66ad8['query']['channel']||!utils['isValidChannel'](_0xf66ad8[_0x3c0b78('0x26')][_0x3c0b78('0x73')]))throw new ValidationError('Unknown\x20channel');return _0x2c3884[_0x3c0b78('0xa7')+_['capitalize'](_0xf66ad8[_0x3c0b78('0x26')][_0x3c0b78('0x73')][_0x3c0b78('0xa9')]())+_0x3c0b78('0x118')](_0xf66ad8['query'][_0x3c0b78('0x97')]);}})[_0x2df29b('0x77')](function(_0x254d01){const _0x4c4677=_0x2df29b;for(let _0x33f8c7=0x0;_0x33f8c7<_0xf66ad8['query'][_0x4c4677('0x97')][_0x4c4677('0x15d')];_0x33f8c7+=0x1){const _0xd79625={'UserId':_0xf66ad8[_0x4c4677('0x116')]['id']};_0xd79625[_[_0x4c4677('0x82')](_0xf66ad8[_0x4c4677('0x26')][_0x4c4677('0x73')]['toLowerCase']())+_0x4c4677('0xaa')]=_0xf66ad8[_0x4c4677('0x26')][_0x4c4677('0x97')][_0x33f8c7],socket[_0x4c4677('0x140')]('user'+_[_0x4c4677('0x82')](_0xf66ad8['query']['channel'][_0x4c4677('0xa9')]())+_0x4c4677('0x4d'),_0xd79625);}return _0x254d01;})[_0x2df29b('0x77')](function(){const _0x52f435=_0x2df29b;if(_0xf66ad8['query'][_0x52f435('0x73')]===_0x52f435('0x88'))return db[_0x52f435('0x3b')][_0x52f435('0x155')]({'where':{'UserId':_0xf66ad8[_0x52f435('0x116')]['id'],'VoiceQueueId':_0xf66ad8[_0x52f435('0x26')][_0x52f435('0x97')]},'individualHooks':!![]})[_0x52f435('0x77')](function(){return _0x3f3f32;});return _0x3f3f32;})['then'](respondWithStatusCode(_0x35ceae,null))['catch'](handleError(_0x35ceae,null));},exports[_0x39246c('0xa1')]=function(_0x348531,_0x440c60){const _0xbdcda=_0x39246c;return _0x348531[_0xbdcda('0xa4')]['userpic']=_0x348531[_0xbdcda('0x7b')][_0xbdcda('0x5e')],db['User']['findOne']({'where':{'id':_0x348531[_0xbdcda('0x116')]['id']}})[_0xbdcda('0x77')](handleEntityNotFound(_0x440c60,null))[_0xbdcda('0x77')](saveUpdates(_0x348531[_0xbdcda('0xa4')],null))[_0xbdcda('0x77')](respondWithResult(_0x440c60,null))[_0xbdcda('0x4')](handleError(_0x440c60,null));},exports[_0x39246c('0x136')]=function(_0x290d6a,_0x59b62d){const _0x456719=_0x39246c,_0x5605d2=path[_0x456719('0x8e')](config[_0x456719('0xac')],'server/files/images/logos/default_profile.png');return db[_0x456719('0xd3')]['findOne']({'where':{'id':_0x290d6a[_0x456719('0x116')]['id']},'attributes':['id',_0x456719('0x162')],'raw':!![]})[_0x456719('0x77')](handleEntityNotFound(_0x59b62d,null))['then'](function(_0x146d33){const _0x47101e=_0x456719;if(_0x146d33){if(_[_0x47101e('0x15')](_0x146d33[_0x47101e('0x162')]))return _0x59b62d[_0x47101e('0xda')](_0x5605d2);else{if(!fs[_0x47101e('0x66')](path['join'](config[_0x47101e('0xac')],_0x47101e('0x8b'),_0x146d33['userpic'])))return _0x59b62d[_0x47101e('0xda')](_0x5605d2);return _0x59b62d['download'](path[_0x47101e('0x8e')](config['root'],_0x47101e('0x8b'),_0x146d33[_0x47101e('0x162')]));}}})[_0x456719('0x4')](handleError(_0x59b62d,null));},exports['getContacts']=function(_0x257528,_0x174f51){const _0x24e27a=_0x39246c;let _0x24acb3={};const _0xa3bed5={};let _0x4b3d56,_0x2428ed;return db[_0x24e27a('0xd3')]['findOne']({'where':{'id':_0x257528[_0x24e27a('0x116')]['id']}})[_0x24e27a('0x77')](handleEntityNotFound(_0x174f51,null))[_0x24e27a('0x77')](function(_0x1e1b70){const _0x3699b6=_0x24e27a;if(_0x1e1b70)return _0x4b3d56=_0x1e1b70,_0xa3bed5['model']=_['keys'](db[_0x3699b6('0x165')][_0x3699b6('0xfd')]),_0xa3bed5[_0x3699b6('0x26')]=_['keys'](_0x257528['query']),_0xa3bed5[_0x3699b6('0x69')]=_[_0x3699b6('0x139')](_0xa3bed5[_0x3699b6('0xd2')],_0xa3bed5['query']),_0x24acb3[_0x3699b6('0x15f')]=_[_0x3699b6('0x139')](_0xa3bed5['model'],qs[_0x3699b6('0x84')](_0x257528[_0x3699b6('0x26')][_0x3699b6('0x84')])),_0x24acb3[_0x3699b6('0x15f')]=_0x24acb3[_0x3699b6('0x15f')][_0x3699b6('0x15d')]?_0x24acb3[_0x3699b6('0x15f')]:_0xa3bed5[_0x3699b6('0xd2')],_0x24acb3[_0x3699b6('0x91')]=qs[_0x3699b6('0x101')](_0x257528[_0x3699b6('0x26')][_0x3699b6('0x101')]),_0x24acb3[_0x3699b6('0xe2')]=qs[_0x3699b6('0x69')](_[_0x3699b6('0xbf')](_0x257528[_0x3699b6('0x26')],_0xa3bed5[_0x3699b6('0x69')])),_0x257528[_0x3699b6('0x26')]['filter']&&(_0x24acb3['where']=_[_0x3699b6('0x5')](_0x24acb3[_0x3699b6('0xe2')],{[Op['or']]:_['map'](_0x24acb3[_0x3699b6('0x15f')],function(_0x374b48){const _0x411488=_0x3699b6,_0x570e55={};return _0x570e55[_0x374b48]={[Op[_0x411488('0x154')]]:'%'+_0x257528[_0x411488('0x26')][_0x411488('0x1c')]+'%'},_0x570e55;})})),_0x24acb3=_[_0x3699b6('0x5')]({},_0x24acb3,_0x257528[_0x3699b6('0x1b')]),_0x4b3d56['getContacts'](_0x24acb3);})[_0x24e27a('0x77')](function(_0xec40b5){const _0x1e59d1=_0x24e27a;if(_0xec40b5)return _0x2428ed=_0xec40b5['length'],typeof _0x257528[_0x1e59d1('0x26')][_0x1e59d1('0x3d')]!==_0x1e59d1('0xf')&&(_0x24acb3[_0x1e59d1('0xc1')]=[{'model':db[_0x1e59d1('0x130')],'as':_0x1e59d1('0x78'),'required':![]},{'model':db[_0x1e59d1('0xb')],'as':_0x1e59d1('0x95'),'attributes':['id',_0x1e59d1('0x7e'),_0x1e59d1('0xae')],'where':_0x257528[_0x1e59d1('0x26')]['tag']?{'id':_0x257528[_0x1e59d1('0x26')]['tag']}:undefined,'required':_0x257528[_0x1e59d1('0x26')][_0x1e59d1('0x68')]?!![]:![]}]),typeof _0x257528['query'][_0x1e59d1('0x135')]===_0x1e59d1('0xf')&&(_0x24acb3[_0x1e59d1('0x4c')]=qs[_0x1e59d1('0x4c')](_0x257528[_0x1e59d1('0x26')][_0x1e59d1('0x4c')]),_0x24acb3[_0x1e59d1('0x123')]=qs[_0x1e59d1('0x123')](_0x257528['query'][_0x1e59d1('0x123')])),_0x4b3d56[_0x1e59d1('0x65')](_0x24acb3);})['then'](function(_0x4897e){if(_0x4897e)return _0x4897e?{'count':_0x2428ed,'rows':_0x4897e}:null;})[_0x24e27a('0x77')](respondWithResult(_0x174f51,null))[_0x24e27a('0x4')](handleError(_0x174f51,null));},exports[_0x39246c('0xa')]=function(_0x2d6b49,_0x5ba31f){const _0x16ff06=_0x39246c;let _0x41ea88,_0x1c530b={},_0x3d5f54;return db[_0x16ff06('0xd3')]['findOne']({'where':{'id':_0x2d6b49[_0x16ff06('0x116')]['id']},'attributes':['id','name',_0x16ff06('0x11c')]})[_0x16ff06('0x77')](handleEntityNotFound(_0x5ba31f,null))['then'](function(_0x105d50){const _0x1c177b=_0x16ff06;if(!utils['isValidChannel'](_0x2d6b49['query'][_0x1c177b('0x73')]))throw new ValidationError(_0x1c177b('0x80'));_0x41ea88=_0x105d50;const _0x162a02={};_0x162a02['model']=_[_0x1c177b('0xbe')](db[_[_0x1c177b('0x82')](_0x2d6b49[_0x1c177b('0x26')][_0x1c177b('0x73')])+_0x1c177b('0xa8')][_0x1c177b('0xfd')]),_0x162a02['query']=_[_0x1c177b('0xbe')](_0x2d6b49[_0x1c177b('0x26')]),_0x162a02[_0x1c177b('0x69')]=_['intersection'](_0x162a02['model'],_0x162a02[_0x1c177b('0x26')]),_0x1c530b[_0x1c177b('0x15f')]=_[_0x1c177b('0x139')](_0x162a02[_0x1c177b('0xd2')],qs['fields'](_0x2d6b49['query'][_0x1c177b('0x84')])),_0x1c530b['attributes']=_0x1c530b[_0x1c177b('0x15f')][_0x1c177b('0x15d')]?_0x1c530b['attributes']:_0x162a02['model'],_0x1c530b[_0x1c177b('0x91')]=qs[_0x1c177b('0x101')](_0x2d6b49[_0x1c177b('0x26')][_0x1c177b('0x101')]),_0x1c530b[_0x1c177b('0xe2')]=qs['filters'](_[_0x1c177b('0xbf')](_0x2d6b49[_0x1c177b('0x26')],_0x162a02[_0x1c177b('0x69')]));_0x2d6b49[_0x1c177b('0x26')][_0x1c177b('0x1c')]&&(_0x1c530b[_0x1c177b('0xe2')]=_['merge'](_0x1c530b[_0x1c177b('0xe2')],{[Op['or']]:_['map'](_0x1c530b[_0x1c177b('0x15f')],function(_0x5d79f0){const _0x1d8d30=_0x1c177b,_0x3f3c55={};return _0x3f3c55[_0x5d79f0]={[Op['like']]:'%'+_0x2d6b49['query'][_0x1d8d30('0x1c')]+'%'},_0x3f3c55;})}));_0x1c530b=_[_0x1c177b('0x5')]({},_0x1c530b,_0x2d6b49['options']);switch(_0x41ea88[_0x1c177b('0x11c')]){case _0x1c177b('0x108'):return db[_['capitalize'](_0x2d6b49[_0x1c177b('0x26')]['channel'])+'Queue'][_0x1c177b('0x40')](_0x1c530b);case _0x1c177b('0xd'):case'agent':return _0x41ea88['get'+_[_0x1c177b('0x82')](_0x2d6b49[_0x1c177b('0x26')]['channel'])+_0x1c177b('0x118')](_0x1c530b);default:throw new ValidationError('Unknown\x20role');}})[_0x16ff06('0x77')](function(_0x41f57a){const _0x12bbcb=_0x16ff06;_0x3d5f54=_0x41f57a['length'];typeof _0x2d6b49[_0x12bbcb('0x26')]['nolimit']==='undefined'&&(_0x1c530b[_0x12bbcb('0x4c')]=qs['limit'](_0x2d6b49[_0x12bbcb('0x26')]['limit']),_0x1c530b[_0x12bbcb('0x123')]=qs[_0x12bbcb('0x123')](_0x2d6b49[_0x12bbcb('0x26')][_0x12bbcb('0x123')]));switch(_0x41ea88[_0x12bbcb('0x11c')]){case _0x12bbcb('0x108'):return db[_['capitalize'](_0x2d6b49['query'][_0x12bbcb('0x73')])+_0x12bbcb('0xa8')][_0x12bbcb('0x40')](_0x1c530b);case'user':case _0x12bbcb('0x9f'):return _0x41ea88[_0x12bbcb('0x125')+_['capitalize'](_0x2d6b49[_0x12bbcb('0x26')]['channel'])+'Queues'](_0x1c530b);}})[_0x16ff06('0x77')](function(_0x293ff4){return{'count':_0x3d5f54,'rows':_0x293ff4};})['then'](respondWithResult(_0x5ba31f,null))[_0x16ff06('0x4')](handleError(_0x5ba31f,null));},exports['getVoiceQueuesRt']=function(_0xa3eb52,_0x7163cc){const _0x1ec5fc=_0x39246c;let _0x2daf96={};const _0x3bda44={};let _0x1c77aa,_0x9e44fa;return db['User'][_0x1ec5fc('0x13b')]({'where':{'id':_0xa3eb52[_0x1ec5fc('0x116')]['id']}})[_0x1ec5fc('0x77')](handleEntityNotFound(_0x7163cc,null))[_0x1ec5fc('0x77')](function(_0x3d5787){const _0x51d149=_0x1ec5fc;if(_0x3d5787)return _0x1c77aa=_0x3d5787,_0x3bda44[_0x51d149('0xd2')]=_[_0x51d149('0xbe')](db[_0x51d149('0x3b')][_0x51d149('0xfd')]),_0x3bda44[_0x51d149('0x26')]=_['keys'](_0xa3eb52['query']),_0x3bda44[_0x51d149('0x69')]=_['intersection'](_0x3bda44[_0x51d149('0xd2')],_0x3bda44[_0x51d149('0x26')]),_0x2daf96['attributes']=_['intersection'](_0x3bda44['model'],qs[_0x51d149('0x84')](_0xa3eb52['query'][_0x51d149('0x84')])),_0x2daf96[_0x51d149('0x15f')]=_0x2daf96[_0x51d149('0x15f')][_0x51d149('0x15d')]?_0x2daf96[_0x51d149('0x15f')]:_0x3bda44[_0x51d149('0xd2')],_0x2daf96[_0x51d149('0x91')]=qs[_0x51d149('0x101')](_0xa3eb52['query']['sort']),_0x2daf96[_0x51d149('0xe2')]=qs[_0x51d149('0x69')](_[_0x51d149('0xbf')](_0xa3eb52[_0x51d149('0x26')],_0x3bda44['filters'])),_0xa3eb52[_0x51d149('0x26')][_0x51d149('0x1c')]&&(_0x2daf96['where']=_[_0x51d149('0x5')](_0x2daf96[_0x51d149('0xe2')],{[Op['or']]:_[_0x51d149('0x102')](_0x2daf96['attributes'],function(_0x1cfb54){const _0x140163=_0x51d149,_0x37a3ec={};return _0x37a3ec[_0x1cfb54]={[Op[_0x140163('0x154')]]:'%'+_0xa3eb52[_0x140163('0x26')][_0x140163('0x1c')]+'%'},_0x37a3ec;})})),_0x2daf96=_[_0x51d149('0x5')]({},_0x2daf96,_0xa3eb52[_0x51d149('0x1b')]),_0x1c77aa[_0x51d149('0x1d')](_0x2daf96);})['then'](function(_0x5cd002){const _0x1e2e4b=_0x1ec5fc;if(_0x5cd002)return _0x9e44fa=_0x5cd002['length'],typeof _0xa3eb52[_0x1e2e4b('0x26')]['nolimit']===_0x1e2e4b('0xf')&&(_0x2daf96[_0x1e2e4b('0x4c')]=qs['limit'](_0xa3eb52[_0x1e2e4b('0x26')][_0x1e2e4b('0x4c')]),_0x2daf96['offset']=qs[_0x1e2e4b('0x123')](_0xa3eb52[_0x1e2e4b('0x26')]['offset'])),_0x1c77aa[_0x1e2e4b('0x1d')](_0x2daf96);})[_0x1ec5fc('0x77')](function(_0x5295bf){if(_0x5295bf)return _0x5295bf?{'count':_0x9e44fa,'rows':_0x5295bf}:null;})[_0x1ec5fc('0x77')](respondWithResult(_0x7163cc,null))['catch'](handleError(_0x7163cc,null));},exports['getGroups']=function(_0x650ae7,_0xea1d2a){const _0x4475f2=_0x39246c;let _0x222a85={};const _0x5d0bd6={};let _0x26190c,_0x151edc;return db[_0x4475f2('0xd3')][_0x4475f2('0x13b')]({'where':{'id':_0x650ae7['params']['id']}})[_0x4475f2('0x77')](handleEntityNotFound(_0xea1d2a,null))[_0x4475f2('0x77')](function(_0x25a625){const _0x2a8d9f=_0x4475f2;if(_0x25a625)return _0x26190c=_0x25a625,_0x5d0bd6[_0x2a8d9f('0xd2')]=_[_0x2a8d9f('0xbe')](db[_0x2a8d9f('0xa5')][_0x2a8d9f('0xfd')]),_0x5d0bd6[_0x2a8d9f('0x26')]=_[_0x2a8d9f('0xbe')](_0x650ae7['query']),_0x5d0bd6[_0x2a8d9f('0x69')]=_[_0x2a8d9f('0x139')](_0x5d0bd6[_0x2a8d9f('0xd2')],_0x5d0bd6[_0x2a8d9f('0x26')]),_0x222a85['attributes']=_[_0x2a8d9f('0x139')](_0x5d0bd6[_0x2a8d9f('0xd2')],qs[_0x2a8d9f('0x84')](_0x650ae7[_0x2a8d9f('0x26')][_0x2a8d9f('0x84')])),_0x222a85['attributes']=_0x222a85['attributes'][_0x2a8d9f('0x15d')]?_0x222a85[_0x2a8d9f('0x15f')]:_0x5d0bd6[_0x2a8d9f('0xd2')],_0x222a85[_0x2a8d9f('0x91')]=qs[_0x2a8d9f('0x101')](_0x650ae7[_0x2a8d9f('0x26')][_0x2a8d9f('0x101')]),_0x222a85[_0x2a8d9f('0xe2')]=qs[_0x2a8d9f('0x69')](_[_0x2a8d9f('0xbf')](_0x650ae7[_0x2a8d9f('0x26')],_0x5d0bd6[_0x2a8d9f('0x69')])),_0x650ae7[_0x2a8d9f('0x26')][_0x2a8d9f('0x1c')]&&(_0x222a85[_0x2a8d9f('0xe2')]=_[_0x2a8d9f('0x5')](_0x222a85[_0x2a8d9f('0xe2')],{[Op['or']]:_[_0x2a8d9f('0x102')](_0x222a85[_0x2a8d9f('0x15f')],function(_0x32fa05){const _0x18ff56=_0x2a8d9f,_0x4ece8b={};return _0x4ece8b[_0x32fa05]={[Op['like']]:'%'+_0x650ae7[_0x18ff56('0x26')][_0x18ff56('0x1c')]+'%'},_0x4ece8b;})})),_0x222a85=_[_0x2a8d9f('0x5')]({},_0x222a85,_0x650ae7[_0x2a8d9f('0x1b')]),_0x26190c[_0x2a8d9f('0x15b')](_0x222a85);})[_0x4475f2('0x77')](function(_0x5f0ad3){const _0x2edaaa=_0x4475f2;if(_0x5f0ad3)return _0x151edc=_0x5f0ad3['length'],typeof _0x650ae7[_0x2edaaa('0x26')][_0x2edaaa('0x135')]===_0x2edaaa('0xf')&&(_0x222a85[_0x2edaaa('0x4c')]=qs[_0x2edaaa('0x4c')](_0x650ae7[_0x2edaaa('0x26')][_0x2edaaa('0x4c')]),_0x222a85[_0x2edaaa('0x123')]=qs[_0x2edaaa('0x123')](_0x650ae7[_0x2edaaa('0x26')][_0x2edaaa('0x123')])),_0x26190c[_0x2edaaa('0x15b')](_0x222a85);})[_0x4475f2('0x77')](function(_0x3d3882){if(_0x3d3882)return _0x3d3882?{'count':_0x151edc,'rows':_0x3d3882}:null;})[_0x4475f2('0x77')](respondWithResult(_0xea1d2a,null))['catch'](handleError(_0xea1d2a,null));},exports[_0x39246c('0x14a')]=function(_0x4a9b2d,_0x3cce11){const _0x2a32d0=_0x39246c;let _0x3aa20b={'raw':!![],'where':{}};const _0x459998={},_0x1574b6={'count':0x0,'rows':[]};return db[_0x2a32d0('0xd3')][_0x2a32d0('0x13b')]({'where':{'id':_0x4a9b2d['params']['id']}})[_0x2a32d0('0x77')](handleEntityNotFound(_0x3cce11,null))[_0x2a32d0('0x77')](function(_0x17b5a5){const _0x15d1f2=_0x2a32d0;if(_0x17b5a5)return _0x459998['model']=_[_0x15d1f2('0xbe')](db[_0x15d1f2('0x8c')][_0x15d1f2('0xfd')]),_0x459998[_0x15d1f2('0x26')]=_[_0x15d1f2('0xbe')](_0x4a9b2d[_0x15d1f2('0x26')]),_0x459998[_0x15d1f2('0x69')]=_[_0x15d1f2('0x139')](_0x459998[_0x15d1f2('0xd2')],_0x459998[_0x15d1f2('0x26')]),_0x3aa20b['attributes']=_[_0x15d1f2('0x139')](_0x459998['model'],qs[_0x15d1f2('0x84')](_0x4a9b2d[_0x15d1f2('0x26')][_0x15d1f2('0x84')])),_0x3aa20b[_0x15d1f2('0x15f')]=_0x3aa20b[_0x15d1f2('0x15f')]['length']?_0x3aa20b[_0x15d1f2('0x15f')]:_0x459998[_0x15d1f2('0xd2')],typeof _0x4a9b2d[_0x15d1f2('0x26')][_0x15d1f2('0x135')]===_0x15d1f2('0xf')&&(_0x3aa20b[_0x15d1f2('0x4c')]=qs[_0x15d1f2('0x4c')](_0x4a9b2d[_0x15d1f2('0x26')][_0x15d1f2('0x4c')]),_0x3aa20b[_0x15d1f2('0x123')]=qs[_0x15d1f2('0x123')](_0x4a9b2d[_0x15d1f2('0x26')][_0x15d1f2('0x123')])),_0x3aa20b[_0x15d1f2('0x91')]=qs[_0x15d1f2('0x101')](_0x4a9b2d['query'][_0x15d1f2('0x101')]),_0x3aa20b['where']=qs['filters'](_[_0x15d1f2('0xbf')](_0x4a9b2d[_0x15d1f2('0x26')],_0x459998[_0x15d1f2('0x69')])),_0x3aa20b[_0x15d1f2('0xe2')][_0x15d1f2('0x33')]=_0x17b5a5['id'],_0x4a9b2d['query'][_0x15d1f2('0x1c')]&&(_0x3aa20b['where']=_[_0x15d1f2('0x5')](_0x3aa20b['where'],{[Op['or']]:_[_0x15d1f2('0x102')](_0x3aa20b[_0x15d1f2('0x15f')],function(_0x5430c3){const _0x2b7ad3=_0x15d1f2,_0x5b71ae={};return _0x5b71ae[_0x5430c3]={[Op[_0x2b7ad3('0x154')]]:'%'+_0x4a9b2d[_0x2b7ad3('0x26')]['filter']+'%'},_0x5b71ae;})})),_0x3aa20b=_['merge']({},_0x3aa20b,_0x4a9b2d[_0x15d1f2('0x1b')]),db['VoiceRecording'][_0x15d1f2('0x15a')]({'where':_0x3aa20b[_0x15d1f2('0xe2')]})[_0x15d1f2('0x77')](function(_0x199f1f){const _0x4cf30f=_0x15d1f2;return _0x1574b6[_0x4cf30f('0x15a')]=_0x199f1f,_0x4a9b2d[_0x4cf30f('0x26')][_0x4cf30f('0x3d')]&&(_0x3aa20b[_0x4cf30f('0xc1')]=[{'all':!![]}]),db['VoiceRecording'][_0x4cf30f('0x40')](_0x3aa20b);})['then'](function(_0x51eb10){const _0x3daf39=_0x15d1f2;return _0x1574b6[_0x3daf39('0xee')]=_0x51eb10,_0x1574b6;});})[_0x2a32d0('0x77')](respondWithFilteredResult(_0x3cce11,_0x3aa20b))[_0x2a32d0('0x4')](handleError(_0x3cce11,null));},exports[_0x39246c('0x49')]=function(_0x23da6d,_0x4aa376){const _0x574b19=_0x39246c;let _0x4b8b77={'raw':!![],'where':{}};const _0xa967ba={},_0x2b8b6a={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x23da6d[_0x574b19('0x116')]['id']}})['then'](handleEntityNotFound(_0x4aa376,null))[_0x574b19('0x77')](function(_0xabd67){const _0x55e694=_0x574b19;if(_0xabd67)return _0xa967ba[_0x55e694('0xd2')]=_[_0x55e694('0xbe')](db['ScreenRecording'][_0x55e694('0xfd')]),_0xa967ba[_0x55e694('0x26')]=_[_0x55e694('0xbe')](_0x23da6d['query']),_0xa967ba[_0x55e694('0x69')]=_[_0x55e694('0x139')](_0xa967ba['model'],_0xa967ba['query']),_0x4b8b77[_0x55e694('0x15f')]=_[_0x55e694('0x139')](_0xa967ba[_0x55e694('0xd2')],qs[_0x55e694('0x84')](_0x23da6d[_0x55e694('0x26')][_0x55e694('0x84')])),_0x4b8b77[_0x55e694('0x15f')]=_0x4b8b77[_0x55e694('0x15f')][_0x55e694('0x15d')]?_0x4b8b77[_0x55e694('0x15f')]:_0xa967ba[_0x55e694('0xd2')],typeof _0x23da6d[_0x55e694('0x26')][_0x55e694('0x135')]===_0x55e694('0xf')&&(_0x4b8b77['limit']=qs[_0x55e694('0x4c')](_0x23da6d['query'][_0x55e694('0x4c')]),_0x4b8b77['offset']=qs[_0x55e694('0x123')](_0x23da6d[_0x55e694('0x26')]['offset'])),_0x4b8b77[_0x55e694('0x91')]=qs['sort'](_0x23da6d[_0x55e694('0x26')][_0x55e694('0x101')]),_0x4b8b77[_0x55e694('0xe2')]=qs[_0x55e694('0x69')](_[_0x55e694('0xbf')](_0x23da6d['query'],_0xa967ba['filters'])),_0x4b8b77[_0x55e694('0xe2')]['UserId']=_0xabd67['id'],_0x23da6d['query'][_0x55e694('0x1c')]&&(_0x4b8b77['where']=_['merge'](_0x4b8b77[_0x55e694('0xe2')],{[Op['or']]:_[_0x55e694('0x102')](_0x4b8b77[_0x55e694('0x15f')],function(_0x1ed958){const _0x22c919=_0x55e694,_0x4c48d9={};return _0x4c48d9[_0x1ed958]={[Op[_0x22c919('0x154')]]:'%'+_0x23da6d['query'][_0x22c919('0x1c')]+'%'},_0x4c48d9;})})),_0x4b8b77=_['merge']({},_0x4b8b77,_0x23da6d[_0x55e694('0x1b')]),db[_0x55e694('0x1f')][_0x55e694('0x15a')]({'where':_0x4b8b77[_0x55e694('0xe2')]})[_0x55e694('0x77')](function(_0x462d96){const _0x36a7a1=_0x55e694;return _0x2b8b6a['count']=_0x462d96,_0x23da6d[_0x36a7a1('0x26')][_0x36a7a1('0x3d')]&&(_0x4b8b77[_0x36a7a1('0xc1')]=[{'all':!![]}]),db[_0x36a7a1('0x1f')][_0x36a7a1('0x40')](_0x4b8b77);})[_0x55e694('0x77')](function(_0x41dc7d){return _0x2b8b6a['rows']=_0x41dc7d,_0x2b8b6a;});})['then'](respondWithFilteredResult(_0x4aa376,_0x4b8b77))[_0x574b19('0x4')](handleError(_0x4aa376,null));},exports[_0x39246c('0xc4')]=function(_0x58109d,_0x225c79){const _0xf311ca=_0x39246c;let _0x50cf0a={};const _0x1de729={};let _0x1d572a,_0x954c37;return db['User']['findOne']({'where':{'id':_0x58109d[_0xf311ca('0x116')]['id']}})['then'](handleEntityNotFound(_0x225c79,null))[_0xf311ca('0x77')](function(_0x679984){const _0x1e1419=_0xf311ca;if(_0x679984)return _0x1d572a=_0x679984,_0x1de729[_0x1e1419('0xd2')]=_['keys'](db[_0x1e1419('0x159')]['rawAttributes']),_0x1de729['query']=_[_0x1e1419('0xbe')](_0x58109d[_0x1e1419('0x26')]),_0x1de729[_0x1e1419('0x69')]=_[_0x1e1419('0x139')](_0x1de729[_0x1e1419('0xd2')],_0x1de729['query']),_0x50cf0a[_0x1e1419('0x15f')]=_['intersection'](_0x1de729['model'],qs[_0x1e1419('0x84')](_0x58109d[_0x1e1419('0x26')]['fields'])),_0x50cf0a[_0x1e1419('0x15f')]=_0x50cf0a['attributes'][_0x1e1419('0x15d')]?_0x50cf0a[_0x1e1419('0x15f')]:_0x1de729[_0x1e1419('0xd2')],_0x50cf0a[_0x1e1419('0x91')]=qs[_0x1e1419('0x101')](_0x58109d[_0x1e1419('0x26')][_0x1e1419('0x101')]),_0x50cf0a[_0x1e1419('0xe2')]=qs[_0x1e1419('0x69')](_[_0x1e1419('0xbf')](_0x58109d['query'],_0x1de729[_0x1e1419('0x69')])),_0x58109d[_0x1e1419('0x26')][_0x1e1419('0x1c')]&&(_0x50cf0a[_0x1e1419('0xe2')]=_[_0x1e1419('0x5')](_0x50cf0a[_0x1e1419('0xe2')],{[Op['or']]:_[_0x1e1419('0x102')](_0x50cf0a[_0x1e1419('0x15f')],function(_0x55cc03){const _0x5adecd=_0x1e1419,_0x1b3170={};return _0x1b3170[_0x55cc03]={[Op['like']]:'%'+_0x58109d[_0x5adecd('0x26')][_0x5adecd('0x1c')]+'%'},_0x1b3170;})})),_0x50cf0a=_[_0x1e1419('0x5')]({},_0x50cf0a,_0x58109d[_0x1e1419('0x1b')]),_0x1d572a['getChatInteractions'](_0x50cf0a);})[_0xf311ca('0x77')](function(_0x4959d3){const _0xb7ab49=_0xf311ca;if(_0x4959d3)return _0x954c37=_0x4959d3['length'],typeof _0x58109d['query'][_0xb7ab49('0x135')]===_0xb7ab49('0xf')&&(_0x50cf0a['limit']=qs[_0xb7ab49('0x4c')](_0x58109d['query'][_0xb7ab49('0x4c')]),_0x50cf0a[_0xb7ab49('0x123')]=qs[_0xb7ab49('0x123')](_0x58109d[_0xb7ab49('0x26')]['offset'])),_0x1d572a[_0xb7ab49('0xc4')](_0x50cf0a);})['then'](function(_0x204c36){if(_0x204c36)return _0x204c36?{'count':_0x954c37,'rows':_0x204c36}:null;})[_0xf311ca('0x77')](respondWithResult(_0x225c79,null))['catch'](handleError(_0x225c79,null));},exports[_0x39246c('0xe8')]=function(_0x48ae8e,_0x88b101){const _0x2d2b6d=_0x39246c;let _0x49cd69={};const _0xfddcec={};let _0x2a97a8,_0x1d5436;return db['User'][_0x2d2b6d('0x13b')]({'where':{'id':_0x48ae8e[_0x2d2b6d('0x116')]['id']}})[_0x2d2b6d('0x77')](handleEntityNotFound(_0x88b101,null))[_0x2d2b6d('0x77')](function(_0x11eb20){const _0x499713=_0x2d2b6d;if(_0x11eb20)return _0x2a97a8=_0x11eb20,_0xfddcec[_0x499713('0xd2')]=_[_0x499713('0xbe')](db['OpenchannelInteraction'][_0x499713('0xfd')]),_0xfddcec['query']=_[_0x499713('0xbe')](_0x48ae8e[_0x499713('0x26')]),_0xfddcec['filters']=_[_0x499713('0x139')](_0xfddcec[_0x499713('0xd2')],_0xfddcec['query']),_0x49cd69[_0x499713('0x15f')]=_[_0x499713('0x139')](_0xfddcec['model'],qs[_0x499713('0x84')](_0x48ae8e[_0x499713('0x26')][_0x499713('0x84')])),_0x49cd69[_0x499713('0x15f')]=_0x49cd69[_0x499713('0x15f')]['length']?_0x49cd69['attributes']:_0xfddcec[_0x499713('0xd2')],_0x49cd69[_0x499713('0x91')]=qs[_0x499713('0x101')](_0x48ae8e['query'][_0x499713('0x101')]),_0x49cd69[_0x499713('0xe2')]=qs[_0x499713('0x69')](_['pick'](_0x48ae8e[_0x499713('0x26')],_0xfddcec[_0x499713('0x69')])),_0x48ae8e[_0x499713('0x26')]['filter']&&(_0x49cd69[_0x499713('0xe2')]=_[_0x499713('0x5')](_0x49cd69['where'],{[Op['or']]:_[_0x499713('0x102')](_0x49cd69[_0x499713('0x15f')],function(_0x28c8bb){const _0x5ca24e=_0x499713,_0x4d489c={};return _0x4d489c[_0x28c8bb]={[Op[_0x5ca24e('0x154')]]:'%'+_0x48ae8e[_0x5ca24e('0x26')][_0x5ca24e('0x1c')]+'%'},_0x4d489c;})})),_0x49cd69=_[_0x499713('0x5')]({},_0x49cd69,_0x48ae8e['options']),_0x2a97a8[_0x499713('0xe8')](_0x49cd69);})[_0x2d2b6d('0x77')](function(_0x5e5333){const _0x8ab621=_0x2d2b6d;if(_0x5e5333)return _0x1d5436=_0x5e5333[_0x8ab621('0x15d')],typeof _0x48ae8e[_0x8ab621('0x26')][_0x8ab621('0x135')]===_0x8ab621('0xf')&&(_0x49cd69[_0x8ab621('0x4c')]=qs[_0x8ab621('0x4c')](_0x48ae8e[_0x8ab621('0x26')][_0x8ab621('0x4c')]),_0x49cd69[_0x8ab621('0x123')]=qs[_0x8ab621('0x123')](_0x48ae8e[_0x8ab621('0x26')][_0x8ab621('0x123')])),_0x2a97a8['getOpenchannelInteractions'](_0x49cd69);})[_0x2d2b6d('0x77')](function(_0x38b567){if(_0x38b567)return _0x38b567?{'count':_0x1d5436,'rows':_0x38b567}:null;})['then'](respondWithResult(_0x88b101,null))[_0x2d2b6d('0x4')](handleError(_0x88b101,null));},exports[_0x39246c('0xe3')]=function(_0x59da5a,_0x16371a){const _0x162f4f=_0x39246c;let _0x2bb12d={'raw':!![],'where':{}};const _0x7941fd={},_0x3fc928={'count':0x0,'rows':[]};return db[_0x162f4f('0xd3')][_0x162f4f('0x13b')]({'where':{'id':_0x59da5a['params']['id']}})[_0x162f4f('0x77')](handleEntityNotFound(_0x16371a,null))['then'](function(_0x334bde){const _0x4ae70f=_0x162f4f;if(_0x334bde)return _0x7941fd['model']=_['keys'](db[_0x4ae70f('0xcc')]['rawAttributes']),_0x7941fd[_0x4ae70f('0x26')]=_['keys'](_0x59da5a['query']),_0x7941fd[_0x4ae70f('0x69')]=_[_0x4ae70f('0x139')](_0x7941fd['model'],_0x7941fd[_0x4ae70f('0x26')]),_0x2bb12d['attributes']=_[_0x4ae70f('0x139')](_0x7941fd['model'],qs[_0x4ae70f('0x84')](_0x59da5a[_0x4ae70f('0x26')][_0x4ae70f('0x84')])),_0x2bb12d[_0x4ae70f('0x15f')]=_0x2bb12d[_0x4ae70f('0x15f')][_0x4ae70f('0x15d')]?_0x2bb12d[_0x4ae70f('0x15f')]:_0x7941fd['model'],typeof _0x59da5a[_0x4ae70f('0x26')][_0x4ae70f('0x135')]===_0x4ae70f('0xf')&&(_0x2bb12d['limit']=qs[_0x4ae70f('0x4c')](_0x59da5a[_0x4ae70f('0x26')][_0x4ae70f('0x4c')]),_0x2bb12d[_0x4ae70f('0x123')]=qs['offset'](_0x59da5a[_0x4ae70f('0x26')]['offset'])),_0x2bb12d[_0x4ae70f('0x91')]=qs[_0x4ae70f('0x101')](_0x59da5a[_0x4ae70f('0x26')][_0x4ae70f('0x101')]),_0x2bb12d['where']=qs[_0x4ae70f('0x69')](_['pick'](_0x59da5a[_0x4ae70f('0x26')],_0x7941fd[_0x4ae70f('0x69')])),_0x2bb12d[_0x4ae70f('0xe2')]['UserId']=_0x334bde['id'],_0x59da5a[_0x4ae70f('0x26')][_0x4ae70f('0x1c')]&&(_0x2bb12d[_0x4ae70f('0xe2')]=_[_0x4ae70f('0x5')](_0x2bb12d[_0x4ae70f('0xe2')],{[Op['or']]:_[_0x4ae70f('0x102')](_0x2bb12d[_0x4ae70f('0x15f')],function(_0x1ded7f){const _0x1eb4c6=_0x4ae70f,_0x299e1e={};return _0x299e1e[_0x1ded7f]={[Op[_0x1eb4c6('0x154')]]:'%'+_0x59da5a[_0x1eb4c6('0x26')][_0x1eb4c6('0x1c')]+'%'},_0x299e1e;})})),_0x2bb12d=_[_0x4ae70f('0x5')]({},_0x2bb12d,_0x59da5a[_0x4ae70f('0x1b')]),db[_0x4ae70f('0xcc')][_0x4ae70f('0x15a')]({'where':_0x2bb12d[_0x4ae70f('0xe2')]})['then'](function(_0x3b07cc){const _0x21ad70=_0x4ae70f;return _0x3fc928['count']=_0x3b07cc,_0x59da5a[_0x21ad70('0x26')][_0x21ad70('0x3d')]&&(_0x2bb12d['include']=[{'all':!![]}]),db[_0x21ad70('0xcc')][_0x21ad70('0x40')](_0x2bb12d);})[_0x4ae70f('0x77')](function(_0x8d04a7){const _0x4daf3f=_0x4ae70f;return _0x3fc928[_0x4daf3f('0xee')]=_0x8d04a7,_0x3fc928;});})['then'](respondWithFilteredResult(_0x16371a,_0x2bb12d))['catch'](handleError(_0x16371a,null));},exports['getSmsInteractions']=function(_0xc8d546,_0x33b02f){const _0x21b54e=_0x39246c;let _0x2e0b68={};const _0x3a8b0f={};let _0x440254,_0x3a8e11;return db['User'][_0x21b54e('0x13b')]({'where':{'id':_0xc8d546[_0x21b54e('0x116')]['id']}})['then'](handleEntityNotFound(_0x33b02f,null))[_0x21b54e('0x77')](function(_0x47d628){const _0x28f0ce=_0x21b54e;if(_0x47d628)return _0x440254=_0x47d628,_0x3a8b0f[_0x28f0ce('0xd2')]=_[_0x28f0ce('0xbe')](db[_0x28f0ce('0x9')][_0x28f0ce('0xfd')]),_0x3a8b0f[_0x28f0ce('0x26')]=_['keys'](_0xc8d546[_0x28f0ce('0x26')]),_0x3a8b0f[_0x28f0ce('0x69')]=_['intersection'](_0x3a8b0f['model'],_0x3a8b0f[_0x28f0ce('0x26')]),_0x2e0b68[_0x28f0ce('0x15f')]=_[_0x28f0ce('0x139')](_0x3a8b0f[_0x28f0ce('0xd2')],qs[_0x28f0ce('0x84')](_0xc8d546['query'][_0x28f0ce('0x84')])),_0x2e0b68['attributes']=_0x2e0b68[_0x28f0ce('0x15f')]['length']?_0x2e0b68['attributes']:_0x3a8b0f[_0x28f0ce('0xd2')],_0x2e0b68[_0x28f0ce('0x91')]=qs[_0x28f0ce('0x101')](_0xc8d546[_0x28f0ce('0x26')][_0x28f0ce('0x101')]),_0x2e0b68[_0x28f0ce('0xe2')]=qs['filters'](_[_0x28f0ce('0xbf')](_0xc8d546[_0x28f0ce('0x26')],_0x3a8b0f[_0x28f0ce('0x69')])),_0xc8d546[_0x28f0ce('0x26')][_0x28f0ce('0x1c')]&&(_0x2e0b68['where']=_[_0x28f0ce('0x5')](_0x2e0b68['where'],{[Op['or']]:_[_0x28f0ce('0x102')](_0x2e0b68['attributes'],function(_0x451013){const _0x4e18a1=_0x28f0ce,_0x2a9698={};return _0x2a9698[_0x451013]={[Op[_0x4e18a1('0x154')]]:'%'+_0xc8d546[_0x4e18a1('0x26')][_0x4e18a1('0x1c')]+'%'},_0x2a9698;})})),_0x2e0b68=_[_0x28f0ce('0x5')]({},_0x2e0b68,_0xc8d546[_0x28f0ce('0x1b')]),_0x440254[_0x28f0ce('0x124')](_0x2e0b68);})['then'](function(_0x35421c){const _0x6f5492=_0x21b54e;if(_0x35421c)return _0x3a8e11=_0x35421c[_0x6f5492('0x15d')],typeof _0xc8d546[_0x6f5492('0x26')]['nolimit']===_0x6f5492('0xf')&&(_0x2e0b68[_0x6f5492('0x4c')]=qs[_0x6f5492('0x4c')](_0xc8d546[_0x6f5492('0x26')][_0x6f5492('0x4c')]),_0x2e0b68[_0x6f5492('0x123')]=qs[_0x6f5492('0x123')](_0xc8d546[_0x6f5492('0x26')][_0x6f5492('0x123')])),_0x440254['getSmsInteractions'](_0x2e0b68);})[_0x21b54e('0x77')](function(_0x59710a){if(_0x59710a)return _0x59710a?{'count':_0x3a8e11,'rows':_0x59710a}:null;})[_0x21b54e('0x77')](respondWithResult(_0x33b02f,null))[_0x21b54e('0x4')](handleError(_0x33b02f,null));},exports[_0x39246c('0xd1')]=function(_0x26c450,_0x46c23c){const _0x73271d=_0x39246c;let _0x2184a6={};const _0x4762b5={};let _0x58b6b4,_0x123a31;return db[_0x73271d('0xd3')][_0x73271d('0x13b')]({'where':{'id':_0x26c450[_0x73271d('0x116')]['id']}})[_0x73271d('0x77')](handleEntityNotFound(_0x46c23c,null))[_0x73271d('0x77')](function(_0x587d26){const _0x36c5c7=_0x73271d;if(_0x587d26)return _0x58b6b4=_0x587d26,_0x4762b5['model']=_['keys'](db['FaxInteraction'][_0x36c5c7('0xfd')]),_0x4762b5[_0x36c5c7('0x26')]=_[_0x36c5c7('0xbe')](_0x26c450[_0x36c5c7('0x26')]),_0x4762b5[_0x36c5c7('0x69')]=_['intersection'](_0x4762b5[_0x36c5c7('0xd2')],_0x4762b5[_0x36c5c7('0x26')]),_0x2184a6[_0x36c5c7('0x15f')]=_[_0x36c5c7('0x139')](_0x4762b5['model'],qs['fields'](_0x26c450[_0x36c5c7('0x26')][_0x36c5c7('0x84')])),_0x2184a6[_0x36c5c7('0x15f')]=_0x2184a6[_0x36c5c7('0x15f')][_0x36c5c7('0x15d')]?_0x2184a6[_0x36c5c7('0x15f')]:_0x4762b5[_0x36c5c7('0xd2')],_0x2184a6[_0x36c5c7('0x91')]=qs['sort'](_0x26c450['query'][_0x36c5c7('0x101')]),_0x2184a6[_0x36c5c7('0xe2')]=qs[_0x36c5c7('0x69')](_[_0x36c5c7('0xbf')](_0x26c450[_0x36c5c7('0x26')],_0x4762b5[_0x36c5c7('0x69')])),_0x26c450[_0x36c5c7('0x26')][_0x36c5c7('0x1c')]&&(_0x2184a6[_0x36c5c7('0xe2')]=_[_0x36c5c7('0x5')](_0x2184a6[_0x36c5c7('0xe2')],{[Op['or']]:_[_0x36c5c7('0x102')](_0x2184a6[_0x36c5c7('0x15f')],function(_0x1d7654){const _0xdc01e3=_0x36c5c7,_0x44146d={};return _0x44146d[_0x1d7654]={[Op[_0xdc01e3('0x154')]]:'%'+_0x26c450['query']['filter']+'%'},_0x44146d;})})),_0x2184a6=_[_0x36c5c7('0x5')]({},_0x2184a6,_0x26c450['options']),_0x58b6b4[_0x36c5c7('0xd1')](_0x2184a6);})[_0x73271d('0x77')](function(_0x1d0464){const _0x1968ec=_0x73271d;if(_0x1d0464)return _0x123a31=_0x1d0464[_0x1968ec('0x15d')],typeof _0x26c450[_0x1968ec('0x26')][_0x1968ec('0x135')]==='undefined'&&(_0x2184a6['limit']=qs['limit'](_0x26c450[_0x1968ec('0x26')][_0x1968ec('0x4c')]),_0x2184a6[_0x1968ec('0x123')]=qs['offset'](_0x26c450[_0x1968ec('0x26')]['offset'])),_0x58b6b4[_0x1968ec('0xd1')](_0x2184a6);})[_0x73271d('0x77')](function(_0x1a2a9f){if(_0x1a2a9f)return _0x1a2a9f?{'count':_0x123a31,'rows':_0x1a2a9f}:null;})[_0x73271d('0x77')](respondWithResult(_0x46c23c,null))[_0x73271d('0x4')](handleError(_0x46c23c,null));},exports[_0x39246c('0x9c')]=function(_0x4fdcd3,_0xd7f791){const _0x109e51=_0x39246c;let _0x1e1a3a={};const _0x4333bc={};let _0x44b398,_0x1b2d94;return db['User'][_0x109e51('0x13b')]({'where':{'id':_0x4fdcd3[_0x109e51('0x116')]['id']}})[_0x109e51('0x77')](handleEntityNotFound(_0xd7f791,null))[_0x109e51('0x77')](function(_0x4e8645){const _0x48b47a=_0x109e51;if(_0x4e8645)return _0x44b398=_0x4e8645,_0x4333bc['model']=_[_0x48b47a('0xbe')](db[_0x48b47a('0x14')][_0x48b47a('0xfd')]),_0x4333bc['query']=_[_0x48b47a('0xbe')](_0x4fdcd3[_0x48b47a('0x26')]),_0x4333bc[_0x48b47a('0x69')]=_['intersection'](_0x4333bc[_0x48b47a('0xd2')],_0x4333bc[_0x48b47a('0x26')]),_0x1e1a3a[_0x48b47a('0x15f')]=_[_0x48b47a('0x139')](_0x4333bc[_0x48b47a('0xd2')],qs[_0x48b47a('0x84')](_0x4fdcd3[_0x48b47a('0x26')][_0x48b47a('0x84')])),_0x1e1a3a['attributes']=_0x1e1a3a[_0x48b47a('0x15f')][_0x48b47a('0x15d')]?_0x1e1a3a[_0x48b47a('0x15f')]:_0x4333bc[_0x48b47a('0xd2')],_0x1e1a3a['order']=qs[_0x48b47a('0x101')](_0x4fdcd3[_0x48b47a('0x26')][_0x48b47a('0x101')]),_0x1e1a3a[_0x48b47a('0xe2')]=qs[_0x48b47a('0x69')](_[_0x48b47a('0xbf')](_0x4fdcd3[_0x48b47a('0x26')],_0x4333bc[_0x48b47a('0x69')])),_0x4fdcd3[_0x48b47a('0x26')][_0x48b47a('0x1c')]&&(_0x1e1a3a[_0x48b47a('0xe2')]=_['merge'](_0x1e1a3a[_0x48b47a('0xe2')],{[Op['or']]:_[_0x48b47a('0x102')](_0x1e1a3a['attributes'],function(_0x4834f9){const _0x30abc3=_0x48b47a,_0x29f75c={};return _0x29f75c[_0x4834f9]={[Op[_0x30abc3('0x154')]]:'%'+_0x4fdcd3[_0x30abc3('0x26')][_0x30abc3('0x1c')]+'%'},_0x29f75c;})})),_0x1e1a3a=_[_0x48b47a('0x5')]({},_0x1e1a3a,_0x4fdcd3[_0x48b47a('0x1b')]),_0x44b398[_0x48b47a('0x9c')](_0x1e1a3a);})[_0x109e51('0x77')](function(_0x537dc7){const _0x345689=_0x109e51;if(_0x537dc7)return _0x1b2d94=_0x537dc7[_0x345689('0x15d')],typeof _0x4fdcd3[_0x345689('0x26')][_0x345689('0x135')]==='undefined'&&(_0x1e1a3a[_0x345689('0x4c')]=qs['limit'](_0x4fdcd3[_0x345689('0x26')][_0x345689('0x4c')]),_0x1e1a3a[_0x345689('0x123')]=qs[_0x345689('0x123')](_0x4fdcd3[_0x345689('0x26')][_0x345689('0x123')])),_0x44b398[_0x345689('0x9c')](_0x1e1a3a);})[_0x109e51('0x77')](function(_0xb7a25f){if(_0xb7a25f)return _0xb7a25f?{'count':_0x1b2d94,'rows':_0xb7a25f}:null;})['then'](respondWithResult(_0xd7f791,null))[_0x109e51('0x4')](handleError(_0xd7f791,null));},exports[_0x39246c('0x10d')]=function(_0x429cf9,_0x8ba682,_0x4fa3eb){const _0x45be80=_0x39246c;let _0x311774,_0x50215d,_0x58a8fe;const _0x19b889=!_[_0x45be80('0x15')](_0x429cf9[_0x45be80('0x116')]['id'])?_0x429cf9[_0x45be80('0x116')]['id']:!_[_0x45be80('0x15')](_0x429cf9[_0x45be80('0xd')]['id'])?_0x429cf9[_0x45be80('0xd')]['id']:null;return db[_0x45be80('0xd3')]['findOne']({'where':{'id':_0x19b889,'role':{[Op['or']]:['admin',_0x45be80('0xd'),_0x45be80('0x9f')]}},'attributes':['id',_0x45be80('0x7e'),'phone',_0x45be80('0x70'),_0x45be80('0x11c'),_0x45be80('0x23'),_0x45be80('0x39')]})[_0x45be80('0x77')](function(_0x4cba08){const _0x16f6b2=_0x45be80;if(_0x4cba08){if(_0x4cba08[_0x16f6b2('0x11c')]===_0x16f6b2('0x9f')){_0x311774=_0x4cba08;if(_0x429cf9[_0x16f6b2('0xa4')][_0x16f6b2('0xc6')])_0x58a8fe=util[_0x16f6b2('0x14c')](_0x16f6b2('0x98'),_0x311774[_0x429cf9[_0x16f6b2('0xa4')][_0x16f6b2('0xc6')]]);else _0x429cf9['body'][_0x16f6b2('0xdb')]?_0x58a8fe=util[_0x16f6b2('0x14c')]('SIP/%s',_0x429cf9[_0x16f6b2('0xa4')][_0x16f6b2('0xdb')]):_0x58a8fe=util['format']('SIP/%s',_0x311774['name']);return socket['to'](util[_0x16f6b2('0x14c')]('user:%s',_0x311774[_0x16f6b2('0x7e')]))[_0x16f6b2('0x140')](_0x16f6b2('0x8f'),{'ip':_0x429cf9['headers'][_0x16f6b2('0x146')]||_0x429cf9[_0x16f6b2('0x74')][_0x16f6b2('0x12c')]||_0x429cf9[_0x16f6b2('0x7d')][_0x16f6b2('0x12c')]||_0x429cf9[_0x16f6b2('0x74')]['socket'][_0x16f6b2('0x12c')]}),db['UserVoiceQueueRt'][_0x16f6b2('0x155')]({'where':{'membername':_0x311774['name']},'individualHooks':!![]});}}else throw new ValidationError(_0x16f6b2('0x61'));})['then'](function(){const _0x3a5241=_0x45be80;if(_0x311774)return _0x311774[_0x3a5241('0x147')]({'raw':!![]});})['then'](function(_0x3b1798){const _0x22a701=_0x45be80;if(_0x311774){if(_0x3b1798){_0x50215d=_0x3b1798;if(_0x50215d[_0x22a701('0x15d')]){const _0x15f124=_0x50215d[_0x22a701('0x102')](_0x4a5b03=>{const _0x27236=_0x22a701,_0x29c837={'membername':_0x311774[_0x27236('0x7e')],'UserId':_0x311774['id'],'queue_name':_0x4a5b03['name'],'VoiceQueueId':_0x4a5b03['id'],'interface':_0x58a8fe,'paused':_0x311774[_0x27236('0x39')]||![],'penalty':_0x4a5b03[_0x27236('0xc7')]||0x0};return db[_0x27236('0x3b')]['upsert'](_0x29c837);});return Promise['all'](_0x15f124);}}}})['then'](function(){const _0x40d2e0=_0x45be80;if(_0x311774)return db[_0x40d2e0('0x107')][_0x40d2e0('0x40')]({'where':{'membername':_0x311774['name'],'exitAt':null}});})['then'](function(_0x158b84){const _0x11653b=_0x45be80;if(_0x311774){const _0x4b51b9=[];return _0x158b84[_0x11653b('0x75')](function(_0x40a50b){const _0x7e6f12=_0x11653b;_0x4b51b9[_0x7e6f12('0x11e')](_0x40a50b[_0x7e6f12('0x14f')]({'exitAt':moment()[_0x7e6f12('0x14c')](_0x7e6f12('0xfc'))}));}),Promise[_0x11653b('0xe1')](_0x4b51b9);}})[_0x45be80('0x77')](function(){const _0x17cbfc=_0x45be80;if(_0x311774){const _0x43acf9=[],_0x5b258e=[],_0xa2b208=utils[_0x17cbfc('0xb5')](),_0x57526c={'membername':_0x311774[_0x17cbfc('0x7e')],'interface':_0x58a8fe,'enterAt':moment()[_0x17cbfc('0x14c')](_0x17cbfc('0xfc')),'role':_0x311774[_0x17cbfc('0x11c')],'internal':_0x311774[_0x17cbfc('0x23')]};return _0xa2b208[_0x17cbfc('0x75')](function(_0x4272ba){const _0x255129=_0x17cbfc;_0x43acf9[_0x255129('0x11e')](_[_0x255129('0x5')]({'channel':_0x4272ba,'type':_0x255129('0x28'),'data1':_0x429cf9['body'][_0x255129('0x18')],'data2':_0x58a8fe},_0x57526c)),_0x311774['loginInPause']&&_0x5b258e[_0x255129('0x11e')](_[_0x255129('0x5')]({'channel':_0x4272ba,'type':'PAUSE','data1':_0x255129('0x56')},_0x57526c));}),db['MemberReport'][_0x17cbfc('0x157')](_0x43acf9[_0x17cbfc('0x11d')](_0x5b258e),{'individualHooks':!![]});}})[_0x45be80('0x77')](function(){const _0x3c3c79=_0x45be80;if(_0x311774)return _0x311774[_0x3c3c79('0x14f')]({'online':!![],'lastLoginAt':moment()['format'](_0x3c3c79('0xfc')),'voicePause':_0x311774[_0x3c3c79('0x39')]||![],'mailPause':_0x311774['loginInPause']||![],'chatPause':_0x311774[_0x3c3c79('0x39')]||![],'faxPause':_0x311774[_0x3c3c79('0x39')]||![],'smsPause':_0x311774['loginInPause']||![],'openchannelPause':_0x311774[_0x3c3c79('0x39')]||![],'whatsappPause':_0x311774[_0x3c3c79('0x39')]||![],'pauseType':_0x311774[_0x3c3c79('0x39')]?_0x3c3c79('0x56'):null,'interface':_0x58a8fe,'lastPauseAt':moment()[_0x3c3c79('0x14c')](_0x3c3c79('0xfc'))});})[_0x45be80('0x77')](function(_0xe11cdf){const _0x5ed8b7=_0x45be80;return _0x429cf9[_0x5ed8b7('0x12f')]?_0x4fa3eb():Promise[_0x5ed8b7('0xf3')](_0xe11cdf)[_0x5ed8b7('0x77')](respondWithResult(_0x8ba682,null));})[_0x45be80('0x4')](handleError(_0x8ba682,null));},exports[_0x39246c('0xa6')]=function(_0xf76d01,_0x298697){const _0x517d20=_0x39246c;let _0x42e9b2;return db[_0x517d20('0xd3')][_0x517d20('0x13b')]({'where':{'id':_0xf76d01[_0x517d20('0x116')]['id'],'role':'agent'},'attributes':['id','name',_0x517d20('0x11c')]})['then'](handleEntityNotFound(_0x298697,null))[_0x517d20('0x77')](function(_0x236044){const _0x5bb3fa=_0x517d20;if(_0x236044)return _0x42e9b2=_0x236044,db[_0x5bb3fa('0x3b')]['destroy']({'where':{'membername':_0x42e9b2['name']},'individualHooks':!![]});})[_0x517d20('0x77')](function(){const _0x1e89a0=_0x517d20;return db[_0x1e89a0('0x107')][_0x1e89a0('0x40')]({'where':{'membername':_0x42e9b2[_0x1e89a0('0x7e')],'exitAt':null}});})[_0x517d20('0x77')](function(_0x325b7f){const _0x5b17bb=_0x517d20,_0x13e91e=[];return _0x325b7f[_0x5b17bb('0x75')](function(_0x3473b9){const _0x695760=_0x5b17bb;_0x13e91e[_0x695760('0x11e')](_0x3473b9[_0x695760('0x14f')]({'exitAt':moment()[_0x695760('0x14c')](_0x695760('0xfc'))}));}),Promise[_0x5b17bb('0xe1')](_0x13e91e);})[_0x517d20('0x77')](function(){const _0x149594=_0x517d20;return _0x42e9b2[_0x149594('0x14f')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x517d20('0x77')](respondWithResult(_0x298697,null))[_0x517d20('0x4')](handleError(_0x298697,null));},exports[_0x39246c('0xd0')]=function(_0x3c947f,_0x46e737){const _0x3d896f=_0x39246c;let _0x3e371c;return db['UserVoiceQueueRt'][_0x3d896f('0x14f')]({'paused':0x1},{'where':{'UserId':_0x3c947f['params']['id']},'individualHooks':!![]})[_0x3d896f('0x77')](function(){const _0x4a40ce=_0x3d896f;return db[_0x4a40ce('0xd3')][_0x4a40ce('0x13b')]({'where':{'id':_0x3c947f[_0x4a40ce('0x116')]['id'],'role':_0x4a40ce('0x9f')},'attributes':['id',_0x4a40ce('0x7e'),_0x4a40ce('0x11c'),_0x4a40ce('0x23'),_0x4a40ce('0xc6')]});})['then'](handleEntityNotFound(_0x46e737,null))[_0x3d896f('0x77')](function(_0x5ec0b8){const _0xd87f3a=_0x3d896f;if(_0x5ec0b8)return _0x3e371c=_0x5ec0b8,respondWithRpcPromise(_0xd87f3a('0x4a'),_0xd87f3a('0xd0'),{'id':_0x3e371c['id'],'name':_0x3e371c[_0xd87f3a('0x7e')],'pause':!![]});})[_0x3d896f('0x77')](function(){const _0x5bdc16=_0x3d896f;if(_0x3e371c)return db[_0x5bdc16('0x107')][_0x5bdc16('0x40')]({'where':{'membername':_0x3e371c[_0x5bdc16('0x7e')],'type':_0x5bdc16('0x4b'),'exitAt':null}});})['then'](function(_0x18fa79){const _0xe3cd4b=_0x3d896f;if(_0x18fa79['length']){const _0x391274=moment()[_0xe3cd4b('0x14c')](_0xe3cd4b('0xfc'));for(let _0x153ab0=0x0,_0x397895=_0x18fa79[_0xe3cd4b('0x15d')];_0x153ab0<_0x397895;_0x153ab0++){_0x18fa79[_0x153ab0][_0xe3cd4b('0x14f')]({'exitAt':_0x391274});}}})[_0x3d896f('0x77')](function(){const _0x9f2fab=_0x3d896f,_0x1d330c=[],_0x54eabe=utils[_0x9f2fab('0xb5')]();return _0x54eabe[_0x9f2fab('0x75')](function(_0x4c43e7){const _0x1ba390=_0x9f2fab;_0x1d330c[_0x1ba390('0x11e')]({'channel':_0x4c43e7,'membername':_0x3e371c[_0x1ba390('0x7e')],'interface':_[_0x1ba390('0x15')](_0x3e371c[_0x1ba390('0xc6')])?util[_0x1ba390('0x14c')]('SIP/%s',_0x3e371c[_0x1ba390('0x7e')]):_0x3e371c['interface'],'type':_0x1ba390('0x4b'),'enterAt':moment()[_0x1ba390('0x14c')](_0x1ba390('0xfc')),'data1':_0x3c947f[_0x1ba390('0xa4')][_0x1ba390('0xe0')]||_0x1ba390('0x6f'),'role':_0x3e371c[_0x1ba390('0x11c')],'internal':_0x3e371c[_0x1ba390('0x23')]});}),db[_0x9f2fab('0x107')]['bulkCreate'](_0x1d330c,{'individualHooks':!![]});})['then'](function(){const _0x11a951=_0x3d896f;return _0x3e371c[_0x11a951('0x14f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3c947f[_0x11a951('0xa4')][_0x11a951('0xe0')]||_0x11a951('0x6f'),'lastPauseAt':moment()[_0x11a951('0x14c')](_0x11a951('0xfc'))});})[_0x3d896f('0x77')](respondWithResult(_0x46e737,null))[_0x3d896f('0x4')](handleError(_0x46e737,null));},exports['unpause']=function(_0x46bac7,_0x148d07){const _0x380ea4=_0x39246c;let _0x31e97d;return db[_0x380ea4('0xd3')][_0x380ea4('0x13b')]({'where':{'id':_0x46bac7[_0x380ea4('0x116')]['id']},'attributes':['id',_0x380ea4('0x7e'),_0x380ea4('0x11c'),'voicePause',_0x380ea4('0x150'),_0x380ea4('0xcf'),_0x380ea4('0x20'),_0x380ea4('0x58'),_0x380ea4('0xd6'),'whatsapppause',_0x380ea4('0x27'),_0x380ea4('0x12b')]})['then'](handleEntityNotFound(_0x148d07,null))['then'](function(_0x4d835d){const _0x5ecda3=_0x380ea4;if(_0x4d835d){_0x31e97d=_0x4d835d;if(_0x46bac7['body'][_0x5ecda3('0x73')]&&!utils['isValidChannel'](_0x46bac7[_0x5ecda3('0xa4')][_0x5ecda3('0x73')]))throw new ValidationError(_0x5ecda3('0x80'));switch(_0x46bac7[_0x5ecda3('0xa4')][_0x5ecda3('0x73')]){case _0x5ecda3('0x88'):return respondWithRpcPromise(_0x5ecda3('0x4a'),'unpause',{'id':_0x31e97d['id'],'name':_0x31e97d['name'],'pause':![]})[_0x5ecda3('0x77')](function(){const _0x27ca0d=_0x5ecda3;return db['UserVoiceQueueRt'][_0x27ca0d('0x14f')]({'paused':0x0},{'where':{'UserId':_0x31e97d['id']},'individualHooks':!![]});})[_0x5ecda3('0x77')](function(){const _0x4608de=_0x5ecda3;return db[_0x4608de('0x107')]['findOne']({'where':{'channel':_0x46bac7[_0x4608de('0xa4')]['channel'],'membername':_0x31e97d[_0x4608de('0x7e')],'type':_0x4608de('0x4b'),'exitAt':null}});})[_0x5ecda3('0x77')](function(_0x2b92d2){const _0x1d3ea7=_0x5ecda3;if(_0x2b92d2)return _0x2b92d2[_0x1d3ea7('0x14f')]({'exitAt':moment()[_0x1d3ea7('0x14c')](_0x1d3ea7('0xfc')),'data2':_0x1d3ea7('0x2f')},{'individualHooks':!![]});return null;})['then'](function(){const _0x3b8ed1=_0x5ecda3;return _0x31e97d[_0x3b8ed1('0x14f')]({'voicePause':![]});});case _0x5ecda3('0x104'):case _0x5ecda3('0x2'):case'fax':case _0x5ecda3('0x9a'):case'whatsapp':case _0x5ecda3('0xdc'):return db[_0x5ecda3('0x107')][_0x5ecda3('0x13b')]({'where':{'channel':_0x46bac7[_0x5ecda3('0xa4')][_0x5ecda3('0x73')],'membername':_0x31e97d['name'],'type':_0x5ecda3('0x4b'),'exitAt':null}})['then'](function(_0x59d53a){const _0xe5864f=_0x5ecda3;if(_0x59d53a)return _0x59d53a['update']({'exitAt':moment()[_0xe5864f('0x14c')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});return null;})[_0x5ecda3('0x77')](function(){const _0xe71535=_0x5ecda3,_0x5e0c85={};return _[_0xe71535('0x12d')](_0x5e0c85,util[_0xe71535('0x14c')](_0xe71535('0x60'),_0x46bac7['body'][_0xe71535('0x73')],_0xe71535('0xc8')),![]),_0x31e97d[_0xe71535('0x14f')](_0x5e0c85);});default:return respondWithRpcPromise(_0x5ecda3('0x4a'),_0x5ecda3('0xf2'),{'id':_0x31e97d['id'],'name':_0x31e97d[_0x5ecda3('0x7e')],'pause':![]})['then'](function(){const _0x3e585f=_0x5ecda3;return db[_0x3e585f('0x3b')][_0x3e585f('0x14f')]({'paused':0x0},{'where':{'UserId':_0x31e97d['id']}});})['then'](function(){const _0x223734=_0x5ecda3;return db[_0x223734('0x107')][_0x223734('0x40')]({'where':{'membername':_0x31e97d['name'],'type':_0x223734('0x4b'),'exitAt':null}});})[_0x5ecda3('0x77')](function(_0x454f1a){const _0x4481ba=_0x5ecda3,_0x520a50=[];return _0x454f1a['forEach'](function(_0x14d383){const _0x2f5d1c=a648_0x1eea;_0x520a50['push'](_0x14d383[_0x2f5d1c('0x14f')]({'exitAt':moment()[_0x2f5d1c('0x14c')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2f5d1c('0x2f')}));}),Promise[_0x4481ba('0xe1')](_0x520a50);})[_0x5ecda3('0x77')](function(){const _0x9ac9db=_0x5ecda3;return _0x31e97d[_0x9ac9db('0x14f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x380ea4('0x77')](respondWithResult(_0x148d07,null))[_0x380ea4('0x4')](handleError(_0x148d07,null));},exports['getTeams']=function(_0x448c8f,_0x265490){const _0x272d4b=_0x39246c;let _0x1f44a2={};const _0x134c54={};let _0x4db57c,_0x198ed4;return db['User'][_0x272d4b('0x13b')]({'where':{'id':_0x448c8f[_0x272d4b('0x116')]['id']}})[_0x272d4b('0x77')](handleEntityNotFound(_0x265490,null))[_0x272d4b('0x77')](function(_0x487923){const _0x52aa08=_0x272d4b;if(_0x487923)return _0x4db57c=_0x487923,_0x134c54[_0x52aa08('0xd2')]=_[_0x52aa08('0xbe')](db[_0x52aa08('0x64')][_0x52aa08('0xfd')]),_0x134c54[_0x52aa08('0x26')]=_[_0x52aa08('0xbe')](_0x448c8f['query']),_0x134c54[_0x52aa08('0x69')]=_['intersection'](_0x134c54['model'],_0x134c54[_0x52aa08('0x26')]),_0x1f44a2[_0x52aa08('0x15f')]=_[_0x52aa08('0x139')](_0x134c54[_0x52aa08('0xd2')],qs[_0x52aa08('0x84')](_0x448c8f[_0x52aa08('0x26')][_0x52aa08('0x84')])),_0x1f44a2[_0x52aa08('0x15f')]=_0x1f44a2['attributes'][_0x52aa08('0x15d')]?_0x1f44a2[_0x52aa08('0x15f')]:_0x134c54[_0x52aa08('0xd2')],_0x1f44a2[_0x52aa08('0x91')]=qs[_0x52aa08('0x101')](_0x448c8f['query'][_0x52aa08('0x101')]),_0x1f44a2[_0x52aa08('0xe2')]=qs[_0x52aa08('0x69')](_['pick'](_0x448c8f[_0x52aa08('0x26')],_0x134c54['filters'])),_0x448c8f[_0x52aa08('0x26')]['filter']&&(_0x1f44a2[_0x52aa08('0xe2')]=_['merge'](_0x1f44a2[_0x52aa08('0xe2')],{[Op['or']]:_[_0x52aa08('0x102')](_0x1f44a2['attributes'],function(_0x3299e3){const _0x162dd5=_0x52aa08,_0x563aa7={};return _0x563aa7[_0x3299e3]={[Op['like']]:'%'+_0x448c8f[_0x162dd5('0x26')]['filter']+'%'},_0x563aa7;})})),_0x1f44a2=_[_0x52aa08('0x5')]({},_0x1f44a2,_0x448c8f['options']),_0x4db57c[_0x52aa08('0x8a')](_0x1f44a2);})[_0x272d4b('0x77')](function(_0xb55618){const _0x4d3fd5=_0x272d4b;if(_0xb55618)return _0x198ed4=_0xb55618[_0x4d3fd5('0x15d')],typeof _0x448c8f[_0x4d3fd5('0x26')][_0x4d3fd5('0x135')]===_0x4d3fd5('0xf')&&(_0x1f44a2['limit']=qs[_0x4d3fd5('0x4c')](_0x448c8f[_0x4d3fd5('0x26')][_0x4d3fd5('0x4c')]),_0x1f44a2[_0x4d3fd5('0x123')]=qs[_0x4d3fd5('0x123')](_0x448c8f[_0x4d3fd5('0x26')]['offset'])),_0x4db57c[_0x4d3fd5('0x8a')](_0x1f44a2);})['then'](function(_0x3ca4af){if(_0x3ca4af)return _0x3ca4af?{'count':_0x198ed4,'rows':_0x3ca4af}:null;})['then'](respondWithResult(_0x265490,null))[_0x272d4b('0x4')](handleError(_0x265490,null));},exports['addTeams']=function(_0x55d319,_0x22bfa8){const _0x35fcaa=_0x39246c;return db[_0x35fcaa('0xd3')][_0x35fcaa('0x13b')]({'where':{'id':_0x55d319['params']['id']}})[_0x35fcaa('0x77')](handleEntityNotFound(_0x22bfa8,null))[_0x35fcaa('0x77')](function(_0x2f3bea){const _0x45170c=_0x35fcaa;if(_0x2f3bea){const _0x1257ac=_0x2f3bea[_0x45170c('0x125')]({'plain':!![]});return _0x2f3bea[_0x45170c('0xb4')](_0x55d319['body']['ids'],_['omit'](_0x55d319[_0x45170c('0xa4')],[_0x45170c('0x97'),'id'])||{})[_0x45170c('0x77')](function(){const _0x82fff6=_0x45170c;for(let _0x4c6a92=0x0;_0x4c6a92<_0x55d319['body'][_0x82fff6('0x97')][_0x82fff6('0x15d')];_0x4c6a92++){let _0x584fe4=[];db[_0x82fff6('0x64')]['findOne']({'where':{'id':_0x55d319[_0x82fff6('0xa4')]['ids'][_0x4c6a92]}})['then'](function(_0x5dd39d){const _0x77e97e=_0x82fff6;return _0x584fe4[_0x77e97e('0x11e')](_0x5dd39d[_0x77e97e('0x147')]()[_0x77e97e('0x77')](function(_0x16f042){const _0x1267c3=_0x77e97e;for(let _0x3e072c=0x0;_0x3e072c<_0x16f042[_0x1267c3('0x15d')];_0x3e072c++){_0x16f042[_0x3e072c][_0x1267c3('0x14b')]('channel','Voice');}return _0x16f042;})),_0x584fe4[_0x77e97e('0x11e')](_0x5dd39d[_0x77e97e('0x113')]()[_0x77e97e('0x77')](function(_0xf1f02c){const _0x1f5b0b=_0x77e97e;for(let _0x31c6d2=0x0;_0x31c6d2<_0xf1f02c[_0x1f5b0b('0x15d')];_0x31c6d2++){_0xf1f02c[_0x31c6d2][_0x1f5b0b('0x14b')](_0x1f5b0b('0x73'),'Chat');}return _0xf1f02c;})),_0x584fe4[_0x77e97e('0x11e')](_0x5dd39d[_0x77e97e('0x52')]()[_0x77e97e('0x77')](function(_0x229fa5){const _0x1f4f70=_0x77e97e;for(let _0xa7c73a=0x0;_0xa7c73a<_0x229fa5['length'];_0xa7c73a++){_0x229fa5[_0xa7c73a][_0x1f4f70('0x14b')](_0x1f4f70('0x73'),_0x1f4f70('0x160'));}return _0x229fa5;})),_0x584fe4[_0x77e97e('0x11e')](_0x5dd39d[_0x77e97e('0x2e')]()[_0x77e97e('0x77')](function(_0x4ca064){const _0x3324b7=_0x77e97e;for(let _0x19a804=0x0;_0x19a804<_0x4ca064[_0x3324b7('0x15d')];_0x19a804++){_0x4ca064[_0x19a804][_0x3324b7('0x14b')](_0x3324b7('0x73'),_0x3324b7('0x7a'));}return _0x4ca064;})),_0x584fe4[_0x77e97e('0x11e')](_0x5dd39d[_0x77e97e('0x16')]()[_0x77e97e('0x77')](function(_0x4ba7f7){const _0xce0afd=_0x77e97e;for(let _0x3fc195=0x0;_0x3fc195<_0x4ba7f7['length'];_0x3fc195++){_0x4ba7f7[_0x3fc195][_0xce0afd('0x14b')]('channel',_0xce0afd('0x3f'));}return _0x4ba7f7;})),_0x584fe4[_0x77e97e('0x11e')](_0x5dd39d[_0x77e97e('0x6c')]()['then'](function(_0x272666){const _0x3fc53f=_0x77e97e;for(let _0x129bf0=0x0;_0x129bf0<_0x272666[_0x3fc53f('0x15d')];_0x129bf0++){_0x272666[_0x129bf0]['setDataValue'](_0x3fc53f('0x73'),_0x3fc53f('0x112'));}return _0x272666;})),_0x584fe4[_0x77e97e('0x11e')](_0x5dd39d[_0x77e97e('0xcd')]()[_0x77e97e('0x77')](function(_0x286d81){const _0x2afa79=_0x77e97e;for(let _0x5a934f=0x0;_0x5a934f<_0x286d81[_0x2afa79('0x15d')];_0x5a934f++){_0x286d81[_0x5a934f]['setDataValue']('channel','Openchannel');}return _0x286d81;})),Promise[_0x77e97e('0xe1')](_0x584fe4);})[_0x82fff6('0x77')](function(_0x1f8402){const _0x3a56f7=_0x82fff6,_0x17ab30=_[_0x3a56f7('0x47')](_0x1f8402);return _0x584fe4=[],db[_0x3a56f7('0x10c')][_0x3a56f7('0xfb')](function(_0x9475aa){const _0x7677a3=_0x3a56f7;for(let _0x1cbc80=0x0;_0x1cbc80<_0x17ab30[_0x7677a3('0x15d')];_0x1cbc80++){_0x584fe4[_0x7677a3('0x11e')](_0x17ab30[_0x1cbc80][_0x7677a3('0x46')](_0x1257ac['id']),{'transaction':_0x9475aa});}return Promise['all'](_0x584fe4)[_0x7677a3('0x77')](function(){const _0x1c2e9a=_0x7677a3;if(!_0x1257ac['online'])return;const _0x5de2c0=_['filter'](_0x17ab30,function(_0x2de9c3){const _0x3d2f13=a648_0x1eea;return _0x2de9c3[_0x3d2f13('0x13c')]('channel')===_0x3d2f13('0x2d');});return Promise[_0x1c2e9a('0xe1')](_0x5de2c0[_0x1c2e9a('0x102')](_0x2d14c5=>{const _0x249e1c=_0x1c2e9a;return db[_0x249e1c('0x3b')][_0x249e1c('0x32')]({'membername':_0x1257ac[_0x249e1c('0x7e')],'UserId':_0x1257ac['id'],'queue_name':_0x2d14c5[_0x249e1c('0x7e')],'VoiceQueueId':_0x2d14c5['id'],'interface':_[_0x249e1c('0x15')](_0x1257ac[_0x249e1c('0xc6')])?util[_0x249e1c('0x14c')](_0x249e1c('0x93'),_0x1257ac[_0x249e1c('0x7e')]):_0x1257ac['interface'],'paused':_0x1257ac[_0x249e1c('0x86')]||![],'penalty':_0x1257ac[_0x249e1c('0xf1')]},{'transaction':_0x9475aa});}));})[_0x7677a3('0x77')](function(){const _0x2d7966=_0x7677a3;for(let _0x575539=0x0;_0x575539<_0x17ab30[_0x2d7966('0x15d')];_0x575539++){const _0x28e4bc=_0x17ab30[_0x575539][_0x2d7966('0x13c')]('channel'),_0x10854e=_0x28e4bc+_0x2d7966('0xaa');socket[_0x2d7966('0x140')]('user'+_0x28e4bc+_0x2d7966('0x48'),{'UserId':_0x1257ac['id'],[_0x10854e]:_0x17ab30[_0x575539]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x22bfa8,null))['catch'](handleError(_0x22bfa8,null));},exports[_0x39246c('0x103')]=function(_0x228d3f,_0x351020){const _0xb08499=_0x39246c;return db[_0xb08499('0xd3')][_0xb08499('0x13b')]({'where':{'id':_0x228d3f[_0xb08499('0x116')]['id']}})[_0xb08499('0x77')](handleEntityNotFound(_0x351020,null))[_0xb08499('0x77')](function(_0x50402f){const _0x1c9f26=_0xb08499;if(_0x50402f){const _0x2d442f=_0x50402f[_0x1c9f26('0x125')]({'plain':!![]}),_0x254a80=_0x228d3f[_0x1c9f26('0x26')][_0x1c9f26('0x97')];return _0x50402f[_0x1c9f26('0x103')](_0x254a80)[_0x1c9f26('0x77')](function(){const _0x9097cc=_0x1c9f26;for(let _0x46fbb0=0x0;_0x46fbb0<_0x254a80[_0x9097cc('0x15d')];_0x46fbb0++){let _0xd12051=[];db['Team']['findOne']({'where':{'id':_0x254a80[_0x46fbb0]}})['then'](function(_0x4d558a){const _0x1a5cb5=_0x9097cc;return _0xd12051[_0x1a5cb5('0x11e')](_0x4d558a[_0x1a5cb5('0x147')]()[_0x1a5cb5('0x77')](function(_0x3141c3){const _0x2dc99b=_0x1a5cb5;for(let _0x4e7456=0x0;_0x4e7456<_0x3141c3[_0x2dc99b('0x15d')];_0x4e7456++){_0x3141c3[_0x4e7456]['setDataValue'](_0x2dc99b('0x73'),'Voice');}return _0x3141c3;})),_0xd12051[_0x1a5cb5('0x11e')](_0x4d558a[_0x1a5cb5('0x113')]()['then'](function(_0x5e229e){const _0x1de168=_0x1a5cb5;for(let _0x3da15e=0x0;_0x3da15e<_0x5e229e[_0x1de168('0x15d')];_0x3da15e++){_0x5e229e[_0x3da15e][_0x1de168('0x14b')](_0x1de168('0x73'),_0x1de168('0x0'));}return _0x5e229e;})),_0xd12051[_0x1a5cb5('0x11e')](_0x4d558a[_0x1a5cb5('0x52')]()[_0x1a5cb5('0x77')](function(_0x302d15){const _0x1da3e0=_0x1a5cb5;for(let _0x19f349=0x0;_0x19f349<_0x302d15[_0x1da3e0('0x15d')];_0x19f349++){_0x302d15[_0x19f349][_0x1da3e0('0x14b')](_0x1da3e0('0x73'),_0x1da3e0('0x160'));}return _0x302d15;})),_0xd12051[_0x1a5cb5('0x11e')](_0x4d558a[_0x1a5cb5('0x2e')]()['then'](function(_0x46df39){const _0x27e54e=_0x1a5cb5;for(let _0x2e141c=0x0;_0x2e141c<_0x46df39[_0x27e54e('0x15d')];_0x2e141c++){_0x46df39[_0x2e141c]['setDataValue'](_0x27e54e('0x73'),_0x27e54e('0x7a'));}return _0x46df39;})),_0xd12051['push'](_0x4d558a['getWhatsappQueues']()['then'](function(_0x378269){const _0x2c8db0=_0x1a5cb5;for(let _0xd54bbb=0x0;_0xd54bbb<_0x378269['length'];_0xd54bbb++){_0x378269[_0xd54bbb][_0x2c8db0('0x14b')](_0x2c8db0('0x73'),_0x2c8db0('0x3f'));}return _0x378269;})),_0xd12051[_0x1a5cb5('0x11e')](_0x4d558a[_0x1a5cb5('0x6c')]()[_0x1a5cb5('0x77')](function(_0x1ab3ef){const _0x1b3f3a=_0x1a5cb5;for(let _0x4ec4ce=0x0;_0x4ec4ce<_0x1ab3ef['length'];_0x4ec4ce++){_0x1ab3ef[_0x4ec4ce]['setDataValue'](_0x1b3f3a('0x73'),_0x1b3f3a('0x112'));}return _0x1ab3ef;})),_0xd12051['push'](_0x4d558a['getOpenchannelQueues']()['then'](function(_0xe90618){const _0x327d62=_0x1a5cb5;for(let _0x45f88a=0x0;_0x45f88a<_0xe90618[_0x327d62('0x15d')];_0x45f88a++){_0xe90618[_0x45f88a][_0x327d62('0x14b')](_0x327d62('0x73'),_0x327d62('0x12'));}return _0xe90618;})),Promise[_0x1a5cb5('0xe1')](_0xd12051);})[_0x9097cc('0x77')](function(_0x4ba6b3){const _0x37b674=_0x9097cc,_0x2f7f80=_['flatten'](_0x4ba6b3);return _0xd12051=[],db[_0x37b674('0x10c')][_0x37b674('0xfb')](function(_0x6321d9){const _0x117e3b=_0x37b674;for(let _0x24180d=0x0;_0x24180d<_0x2f7f80[_0x117e3b('0x15d')];_0x24180d++){_0xd12051[_0x117e3b('0x11e')](_0x2f7f80[_0x24180d][_0x117e3b('0xff')](_0x2d442f['id']),{'transaction':_0x6321d9});}return Promise['all'](_0xd12051)[_0x117e3b('0x77')](function(){const _0x1cf51a=_0x117e3b;if(!_0x2d442f['online'])return;const _0x840a5f=_[_0x1cf51a('0x1c')](_0x2f7f80,function(_0x1e25d3){const _0x112e23=_0x1cf51a;return _0x1e25d3[_0x112e23('0x13c')](_0x112e23('0x73'))===_0x112e23('0x2d');});return Promise[_0x1cf51a('0xe1')](_0x840a5f[_0x1cf51a('0x102')](_0x293326=>{const _0x472988=_0x1cf51a;return db[_0x472988('0x3b')]['destroy']({'where':{'VoiceQueueId':_0x293326['id'],'UserId':_0x2d442f['id']},'transaction':_0x6321d9});}));})[_0x117e3b('0x77')](function(){const _0x4a6204=_0x117e3b;for(let _0x4c6b5f=0x0;_0x4c6b5f<_0x2f7f80['length'];_0x4c6b5f++){const _0x169ad5=_0x2f7f80[_0x4c6b5f][_0x4a6204('0x13c')](_0x4a6204('0x73')),_0x32b9ca=_0x169ad5+_0x4a6204('0xaa');socket[_0x4a6204('0x140')]('user'+_0x169ad5+_0x4a6204('0x4d'),{'UserId':_0x2d442f['id'],[_0x32b9ca]:_0x2f7f80[_0x4c6b5f]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x351020,null))[_0xb08499('0x4')](handleError(_0x351020,null));},exports[_0x39246c('0x117')]=function(_0x4c27af,_0x5338cb){const _0xa79608=_0x39246c;let _0x4ac0b4={};const _0x52fe21={};let _0x2f89e9,_0x5d2d72;return db['User']['findOne']({'where':{'id':_0x4c27af[_0xa79608('0x116')]['id']}})['then'](handleEntityNotFound(_0x5338cb,null))[_0xa79608('0x77')](function(_0x1607d0){const _0x1324fe=_0xa79608;if(_0x1607d0)return _0x2f89e9=_0x1607d0,_0x52fe21[_0x1324fe('0xd2')]=_[_0x1324fe('0xbe')](db['CmList']['rawAttributes']),_0x52fe21[_0x1324fe('0x26')]=_[_0x1324fe('0xbe')](_0x4c27af[_0x1324fe('0x26')]),_0x52fe21['filters']=_['intersection'](_0x52fe21[_0x1324fe('0xd2')],_0x52fe21['query']),_0x4ac0b4[_0x1324fe('0x15f')]=_['intersection'](_0x52fe21[_0x1324fe('0xd2')],qs[_0x1324fe('0x84')](_0x4c27af['query'][_0x1324fe('0x84')])),_0x4ac0b4[_0x1324fe('0x15f')]=_0x4ac0b4[_0x1324fe('0x15f')][_0x1324fe('0x15d')]?_0x4ac0b4['attributes']:_0x52fe21[_0x1324fe('0xd2')],_0x4ac0b4[_0x1324fe('0x91')]=qs[_0x1324fe('0x101')](_0x4c27af[_0x1324fe('0x26')][_0x1324fe('0x101')]),_0x4ac0b4[_0x1324fe('0xe2')]=qs['filters'](_[_0x1324fe('0xbf')](_0x4c27af['query'],_0x52fe21[_0x1324fe('0x69')])),_0x4c27af['query'][_0x1324fe('0x1c')]&&(_0x4ac0b4['where']=_[_0x1324fe('0x5')](_0x4ac0b4[_0x1324fe('0xe2')],{[Op['or']]:_[_0x1324fe('0x102')](_0x4ac0b4['attributes'],function(_0x168b9d){const _0x5817b5=_0x1324fe,_0x35dbdf={};return _0x35dbdf[_0x168b9d]={[Op[_0x5817b5('0x154')]]:'%'+_0x4c27af[_0x5817b5('0x26')][_0x5817b5('0x1c')]+'%'},_0x35dbdf;})})),_0x4ac0b4=_['merge']({},_0x4ac0b4,_0x4c27af['options']),_0x2f89e9[_0x1324fe('0x117')](_0x4ac0b4);})[_0xa79608('0x77')](function(_0x201330){const _0x33435b=_0xa79608;if(_0x201330)return _0x5d2d72=_0x201330[_0x33435b('0x15d')],typeof _0x4c27af['query'][_0x33435b('0x135')]===_0x33435b('0xf')&&(_0x4ac0b4[_0x33435b('0x4c')]=qs['limit'](_0x4c27af[_0x33435b('0x26')][_0x33435b('0x4c')]),_0x4ac0b4['offset']=qs[_0x33435b('0x123')](_0x4c27af[_0x33435b('0x26')]['offset'])),_0x2f89e9['getLists'](_0x4ac0b4);})[_0xa79608('0x77')](function(_0x49cd4f){if(_0x49cd4f)return _0x49cd4f?{'count':_0x5d2d72,'rows':_0x49cd4f}:null;})[_0xa79608('0x77')](respondWithResult(_0x5338cb,null))[_0xa79608('0x4')](handleError(_0x5338cb,null));},exports['getAgents']=function(_0xc574e3,_0x4a470c){const _0x3ea741=_0x39246c;let _0x2386f4={};const _0x300bbd={};let _0x13a394;return db[_0x3ea741('0xd3')][_0x3ea741('0x13b')]({'where':{'id':_0xc574e3[_0x3ea741('0x116')]['id']}})[_0x3ea741('0x77')](handleEntityNotFound(_0x4a470c,null))[_0x3ea741('0x77')](function(_0x2445b9){const _0x56f4b8=_0x3ea741;if(_0x2445b9)return _0x13a394=_0x2445b9,_0x300bbd[_0x56f4b8('0xd2')]=_['keys'](db[_0x56f4b8('0xd3')][_0x56f4b8('0xfd')]),_0x300bbd[_0x56f4b8('0x26')]=_[_0x56f4b8('0xbe')](_0xc574e3[_0x56f4b8('0x26')]),_0x300bbd[_0x56f4b8('0x69')]=_['intersection'](_0x300bbd[_0x56f4b8('0xd2')],_0x300bbd['query']),_0x2386f4[_0x56f4b8('0x15f')]=_[_0x56f4b8('0x139')](_0x300bbd['model'],qs[_0x56f4b8('0x84')](_0xc574e3[_0x56f4b8('0x26')][_0x56f4b8('0x84')])),_0x2386f4[_0x56f4b8('0x15f')]=_0x2386f4[_0x56f4b8('0x15f')]['length']?_0x2386f4['attributes']:_0x300bbd[_0x56f4b8('0xd2')],_0x2386f4['order']=qs[_0x56f4b8('0x101')](_0xc574e3[_0x56f4b8('0x26')][_0x56f4b8('0x101')]),_0x2386f4[_0x56f4b8('0xe2')]=qs[_0x56f4b8('0x69')](_[_0x56f4b8('0xbf')](_0xc574e3['query'],_0x300bbd[_0x56f4b8('0x69')])),_0xc574e3[_0x56f4b8('0x26')][_0x56f4b8('0x1c')]&&(_0x2386f4[_0x56f4b8('0xe2')]=_['merge'](_0x2386f4[_0x56f4b8('0xe2')],{[Op['or']]:_[_0x56f4b8('0x102')](_0x2386f4[_0x56f4b8('0x15f')],function(_0xf41d90){const _0x432d82=_0x56f4b8,_0x5d6916={};return _0x5d6916[_0xf41d90]={[Op[_0x432d82('0x154')]]:'%'+_0xc574e3[_0x432d82('0x26')][_0x432d82('0x1c')]+'%'},_0x5d6916;})})),_0x2386f4[_0x56f4b8('0xd2')]=db[_0x56f4b8('0xd3')],_0x2386f4['as']=_0x56f4b8('0xab'),_0x2386f4=_[_0x56f4b8('0x5')]({},_0x2386f4,_0xc574e3[_0x56f4b8('0x1b')]),_0x13a394['getVoiceQueues']({'include':[_0x2386f4]});})[_0x3ea741('0x77')](function(_0x923f79){const _0x4653b0=_0x3ea741;if(_0x923f79){let _0x35e3ba={};const _0x4cb84f=[];for(let _0x27417c=0x0;_0x27417c<_0x923f79[_0x4653b0('0x15d')];_0x27417c+=0x1){for(let _0x44ee3b=0x0,_0x5134dd;_0x44ee3b<_0x923f79[_0x27417c][_0x4653b0('0xab')][_0x4653b0('0x15d')];_0x44ee3b+=0x1){_0x5134dd=_0x923f79[_0x27417c][_0x4653b0('0xab')][_0x44ee3b][_0x4653b0('0x125')]({'plain':!![]}),_0x35e3ba[_0x5134dd['id']]=_0x5134dd;}}_0x35e3ba=_['values'](_0x35e3ba);for(let _0x1b80d9=qs[_0x4653b0('0x123')](_0xc574e3[_0x4653b0('0x26')][_0x4653b0('0x123')]);_0x1b80d9<_0x35e3ba[_0x4653b0('0x15d')]&&_0x4cb84f[_0x4653b0('0x15d')]<qs[_0x4653b0('0x4c')](_0xc574e3[_0x4653b0('0x26')][_0x4653b0('0x4c')]);_0x1b80d9+=0x1){_0x35e3ba[_0x1b80d9]&&_0x4cb84f['push'](_0x35e3ba[_0x1b80d9]);}return{'count':_0x35e3ba[_0x4653b0('0x15d')],'rows':_0x4cb84f};}})['then'](respondWithResult(_0x4a470c,null))[_0x3ea741('0x4')](handleError(_0x4a470c,null));},exports[_0x39246c('0x155')]=function(_0x31afd3,_0x107917){const _0x4c6c9a=_0x39246c;if(_0x31afd3[_0x4c6c9a('0xd')]['id']==_0x31afd3[_0x4c6c9a('0x116')]['id'])return _0x107917[_0x4c6c9a('0x8d')](0x1f4)[_0x4c6c9a('0x129')]({'message':_0x4c6c9a('0xe9')});return db[_0x4c6c9a('0xd3')][_0x4c6c9a('0x13b')]({'where':{'id':_0x31afd3[_0x4c6c9a('0x116')]['id']}})[_0x4c6c9a('0x77')](handleEntityNotFound(_0x107917,null))['then'](removeEntity(_0x107917,null))[_0x4c6c9a('0x4')](handleError(_0x107917,null));},exports[_0x39246c('0x34')]=function(_0x4cd31f,_0xd2312a){const _0x2ff617=_0x39246c;return db[_0x2ff617('0xd3')][_0x2ff617('0x13b')]({'where':{'id':_0x4cd31f['params']['id']}})[_0x2ff617('0x77')](handleEntityNotFound(_0xd2312a,null))['then'](function(_0x4df52b){const _0x3c901d=_0x2ff617;if(_0x4df52b)return _0x4df52b[_0x3c901d('0x34')](_0x4cd31f['body']['ids'],{'through':_[_0x3c901d('0xef')](_0x4cd31f[_0x3c901d('0xa4')],[_0x3c901d('0x97'),'id'])})[_0x3c901d('0x77')](function(){const _0x44969c=_0x3c901d;for(let _0x44ad5e=0x0;_0x44ad5e<_0x4cd31f[_0x44969c('0xa4')]['ids'][_0x44969c('0x15d')];_0x44ad5e+=0x1){socket[_0x44969c('0x140')]('user_has_chat_interactions:save',{'ChatInteractionId':Number(_0x4cd31f[_0x44969c('0xa4')][_0x44969c('0x97')][_0x44ad5e]),'UserId':Number(_0x4cd31f['params']['id'])});}return _0x4cd31f['body']['ids'];});})['then'](respondWithResult(_0xd2312a,null))[_0x2ff617('0x4')](handleError(_0xd2312a,null));},exports[_0x39246c('0x24')]=function(_0x297912,_0x5a7399){const _0x55837d=_0x39246c;return db[_0x55837d('0xd3')][_0x55837d('0x13b')]({'where':{'id':_0x297912[_0x55837d('0x116')]['id']}})['then'](handleEntityNotFound(_0x5a7399,null))[_0x55837d('0x77')](function(_0x42a0dd){const _0x2b229d=_0x55837d;if(_0x42a0dd)return _0x42a0dd[_0x2b229d('0x24')](_0x297912[_0x2b229d('0x26')][_0x2b229d('0x97')])[_0x2b229d('0x77')](function(){const _0x31e5a3=_0x2b229d;if(_['isArray'](_0x297912[_0x31e5a3('0x26')]['ids']))for(let _0x200688=0x0;_0x200688<_0x297912[_0x31e5a3('0x26')][_0x31e5a3('0x97')]['length'];_0x200688+=0x1){socket[_0x31e5a3('0x140')](_0x31e5a3('0x59'),{'ChatInteractionId':Number(_0x297912[_0x31e5a3('0x26')][_0x31e5a3('0x97')][_0x200688]),'UserId':Number(_0x297912[_0x31e5a3('0x116')]['id'])});}else socket[_0x31e5a3('0x140')](_0x31e5a3('0x59'),{'ChatInteractionId':Number(_0x297912[_0x31e5a3('0x26')][_0x31e5a3('0x97')]),'UserId':Number(_0x297912[_0x31e5a3('0x116')]['id'])});});})[_0x55837d('0x77')](respondWithStatusCode(_0x5a7399,null))[_0x55837d('0x4')](handleError(_0x5a7399,null));},exports['addMailInteractions']=function(_0x3c76a6,_0x2f8b58){const _0x4e6f8d=_0x39246c;return db[_0x4e6f8d('0xd3')][_0x4e6f8d('0x13b')]({'where':{'id':_0x3c76a6[_0x4e6f8d('0x116')]['id']}})[_0x4e6f8d('0x77')](handleEntityNotFound(_0x2f8b58,null))['then'](function(_0xa13a39){const _0x523aad=_0x4e6f8d;if(_0xa13a39)return _0xa13a39['addMailInteractions'](_0x3c76a6[_0x523aad('0xa4')][_0x523aad('0x97')],{'through':_[_0x523aad('0xef')](_0x3c76a6['body'],[_0x523aad('0x97'),'id'])})[_0x523aad('0x77')](function(){const _0x3eabee=_0x523aad;for(let _0x3035c9=0x0;_0x3035c9<_0x3c76a6[_0x3eabee('0xa4')][_0x3eabee('0x97')]['length'];_0x3035c9+=0x1){socket['emit']('user_has_mail_interactions:save',{'MailInteractionId':Number(_0x3c76a6[_0x3eabee('0xa4')]['ids'][_0x3035c9]),'UserId':Number(_0x3c76a6[_0x3eabee('0x116')]['id'])});}return _0x3c76a6[_0x3eabee('0xa4')]['ids'];});})[_0x4e6f8d('0x77')](respondWithResult(_0x2f8b58,null))[_0x4e6f8d('0x4')](handleError(_0x2f8b58,null));},exports['removeMailInteractions']=function(_0x35e888,_0x21f9d8){const _0x5ab5fa=_0x39246c;return db['User']['findOne']({'where':{'id':_0x35e888[_0x5ab5fa('0x116')]['id']}})[_0x5ab5fa('0x77')](handleEntityNotFound(_0x21f9d8,null))[_0x5ab5fa('0x77')](function(_0xfea2e8){const _0x100039=_0x5ab5fa;if(_0xfea2e8)return _0xfea2e8[_0x100039('0xb2')](_0x35e888[_0x100039('0x26')][_0x100039('0x97')])[_0x100039('0x77')](function(){const _0x55d234=_0x100039;if(_[_0x55d234('0x138')](_0x35e888[_0x55d234('0x26')][_0x55d234('0x97')]))for(let _0x6f51b3=0x0;_0x6f51b3<_0x35e888[_0x55d234('0x26')]['ids']['length'];_0x6f51b3+=0x1){socket[_0x55d234('0x140')](_0x55d234('0xa3'),{'MailInteractionId':Number(_0x35e888[_0x55d234('0x26')]['ids'][_0x6f51b3]),'UserId':Number(_0x35e888['params']['id'])});}else socket[_0x55d234('0x140')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x35e888['query'][_0x55d234('0x97')]),'UserId':Number(_0x35e888[_0x55d234('0x116')]['id'])});});})['then'](respondWithStatusCode(_0x21f9d8,null))[_0x5ab5fa('0x4')](handleError(_0x21f9d8,null));},exports[_0x39246c('0x53')]=function(_0x74f3cc,_0xbf6fc8){const _0x3c377c=_0x39246c;return db[_0x3c377c('0xd3')][_0x3c377c('0x13b')]({'where':{'id':_0x74f3cc[_0x3c377c('0x116')]['id']}})['then'](handleEntityNotFound(_0xbf6fc8,null))[_0x3c377c('0x77')](function(_0x585c18){const _0x498870=_0x3c377c;if(_0x585c18)return _0x585c18[_0x498870('0x53')](_0x74f3cc[_0x498870('0xa4')][_0x498870('0x97')],{'through':_[_0x498870('0xef')](_0x74f3cc['body'],[_0x498870('0x97'),'id'])})[_0x498870('0x77')](function(){const _0x159b43=_0x498870;for(let _0x3c3fb0=0x0;_0x3c3fb0<_0x74f3cc[_0x159b43('0xa4')][_0x159b43('0x97')][_0x159b43('0x15d')];_0x3c3fb0+=0x1){socket[_0x159b43('0x140')](_0x159b43('0x119'),{'FaxInteractionId':Number(_0x74f3cc[_0x159b43('0xa4')][_0x159b43('0x97')][_0x3c3fb0]),'UserId':Number(_0x74f3cc['params']['id'])});}return _0x74f3cc[_0x159b43('0xa4')][_0x159b43('0x97')];});})['then'](respondWithResult(_0xbf6fc8,null))['catch'](handleError(_0xbf6fc8,null));},exports[_0x39246c('0x10')]=function(_0x6e70dd,_0x3bab4e){const _0x3c8d06=_0x39246c;return db[_0x3c8d06('0xd3')][_0x3c8d06('0x13b')]({'where':{'id':_0x6e70dd[_0x3c8d06('0x116')]['id']}})['then'](handleEntityNotFound(_0x3bab4e,null))[_0x3c8d06('0x77')](function(_0x3edc82){const _0x534e18=_0x3c8d06;if(_0x3edc82)return _0x3edc82[_0x534e18('0x10')](_0x6e70dd['query'][_0x534e18('0x97')])['then'](function(){const _0x54f2d2=_0x534e18;if(_[_0x54f2d2('0x138')](_0x6e70dd['query'][_0x54f2d2('0x97')]))for(let _0x5b81fe=0x0;_0x5b81fe<_0x6e70dd[_0x54f2d2('0x26')][_0x54f2d2('0x97')][_0x54f2d2('0x15d')];_0x5b81fe+=0x1){socket['emit'](_0x54f2d2('0x3c'),{'FaxInteractionId':Number(_0x6e70dd['query'][_0x54f2d2('0x97')][_0x5b81fe]),'UserId':Number(_0x6e70dd[_0x54f2d2('0x116')]['id'])});}else socket[_0x54f2d2('0x140')](_0x54f2d2('0x3c'),{'FaxInteractionId':Number(_0x6e70dd[_0x54f2d2('0x26')][_0x54f2d2('0x97')]),'UserId':Number(_0x6e70dd[_0x54f2d2('0x116')]['id'])});});})['then'](respondWithStatusCode(_0x3bab4e,null))[_0x3c8d06('0x4')](handleError(_0x3bab4e,null));},exports['addSmsInteractions']=function(_0x4bcb0d,_0xb25b16){const _0x2d378a=_0x39246c;return db['User'][_0x2d378a('0x13b')]({'where':{'id':_0x4bcb0d[_0x2d378a('0x116')]['id']}})[_0x2d378a('0x77')](handleEntityNotFound(_0xb25b16,null))[_0x2d378a('0x77')](function(_0x21df5b){const _0x2c307a=_0x2d378a;if(_0x21df5b)return _0x21df5b[_0x2c307a('0xdf')](_0x4bcb0d['body'][_0x2c307a('0x97')],{'through':_[_0x2c307a('0xef')](_0x4bcb0d[_0x2c307a('0xa4')],['ids','id'])})[_0x2c307a('0x77')](function(){const _0x206d8f=_0x2c307a;for(let _0x369f5a=0x0;_0x369f5a<_0x4bcb0d['body'][_0x206d8f('0x97')]['length'];_0x369f5a+=0x1){socket[_0x206d8f('0x140')](_0x206d8f('0xba'),{'SmsInteractionId':Number(_0x4bcb0d[_0x206d8f('0xa4')]['ids'][_0x369f5a]),'UserId':Number(_0x4bcb0d[_0x206d8f('0x116')]['id'])});}return _0x4bcb0d[_0x206d8f('0xa4')]['ids'];});})['then'](respondWithResult(_0xb25b16,null))['catch'](handleError(_0xb25b16,null));},exports['removeSmsInteractions']=function(_0x28f54e,_0x3a63a4){const _0x3ac0d3=_0x39246c;return db[_0x3ac0d3('0xd3')]['findOne']({'where':{'id':_0x28f54e['params']['id']}})[_0x3ac0d3('0x77')](handleEntityNotFound(_0x3a63a4,null))[_0x3ac0d3('0x77')](function(_0xefcd36){const _0x48441d=_0x3ac0d3;if(_0xefcd36)return _0xefcd36[_0x48441d('0x13f')](_0x28f54e[_0x48441d('0x26')]['ids'])[_0x48441d('0x77')](function(){const _0x3b82b0=_0x48441d;if(_['isArray'](_0x28f54e[_0x3b82b0('0x26')]['ids']))for(let _0x3358d6=0x0;_0x3358d6<_0x28f54e[_0x3b82b0('0x26')][_0x3b82b0('0x97')]['length'];_0x3358d6+=0x1){socket[_0x3b82b0('0x140')](_0x3b82b0('0x12e'),{'SmsInteractionId':Number(_0x28f54e['query'][_0x3b82b0('0x97')][_0x3358d6]),'UserId':Number(_0x28f54e[_0x3b82b0('0x116')]['id'])});}else socket[_0x3b82b0('0x140')](_0x3b82b0('0x12e'),{'SmsInteractionId':Number(_0x28f54e[_0x3b82b0('0x26')][_0x3b82b0('0x97')]),'UserId':Number(_0x28f54e['params']['id'])});});})[_0x3ac0d3('0x77')](respondWithStatusCode(_0x3a63a4,null))[_0x3ac0d3('0x4')](handleError(_0x3a63a4,null));},exports['addOpenchannelInteractions']=function(_0x247c47,_0x4c6a2b){const _0x195dc3=_0x39246c;return db[_0x195dc3('0xd3')][_0x195dc3('0x13b')]({'where':{'id':_0x247c47[_0x195dc3('0x116')]['id']}})[_0x195dc3('0x77')](handleEntityNotFound(_0x4c6a2b,null))[_0x195dc3('0x77')](function(_0x90a81b){const _0x5a9bbd=_0x195dc3;if(_0x90a81b)return _0x90a81b[_0x5a9bbd('0x71')](_0x247c47[_0x5a9bbd('0xa4')][_0x5a9bbd('0x97')],{'through':_[_0x5a9bbd('0xef')](_0x247c47[_0x5a9bbd('0xa4')],[_0x5a9bbd('0x97'),'id'])})[_0x5a9bbd('0x77')](function(){const _0xcc237c=_0x5a9bbd;for(let _0x542f65=0x0;_0x542f65<_0x247c47[_0xcc237c('0xa4')][_0xcc237c('0x97')][_0xcc237c('0x15d')];_0x542f65+=0x1){socket[_0xcc237c('0x140')](_0xcc237c('0x6e'),{'OpenchannelInteractionId':Number(_0x247c47[_0xcc237c('0xa4')][_0xcc237c('0x97')][_0x542f65]),'UserId':Number(_0x247c47[_0xcc237c('0x116')]['id'])});}return _0x247c47[_0xcc237c('0xa4')][_0xcc237c('0x97')];});})[_0x195dc3('0x77')](respondWithResult(_0x4c6a2b,null))[_0x195dc3('0x4')](handleError(_0x4c6a2b,null));},exports[_0x39246c('0x143')]=function(_0x98259e,_0x4045b4){const _0x1fd299=_0x39246c;return db['User'][_0x1fd299('0x13b')]({'where':{'id':_0x98259e[_0x1fd299('0x116')]['id']}})[_0x1fd299('0x77')](handleEntityNotFound(_0x4045b4,null))['then'](function(_0x35e7f3){const _0x2ba310=_0x1fd299;if(_0x35e7f3)return _0x35e7f3[_0x2ba310('0x143')](_0x98259e[_0x2ba310('0x26')][_0x2ba310('0x97')])[_0x2ba310('0x77')](function(){const _0x287ba5=_0x2ba310;if(_[_0x287ba5('0x138')](_0x98259e[_0x287ba5('0x26')]['ids']))for(let _0x1d88d6=0x0;_0x1d88d6<_0x98259e[_0x287ba5('0x26')][_0x287ba5('0x97')][_0x287ba5('0x15d')];_0x1d88d6+=0x1){socket[_0x287ba5('0x140')](_0x287ba5('0x141'),{'OpenchannelInteractionId':Number(_0x98259e[_0x287ba5('0x26')][_0x287ba5('0x97')][_0x1d88d6]),'UserId':Number(_0x98259e[_0x287ba5('0x116')]['id'])});}else socket[_0x287ba5('0x140')](_0x287ba5('0x141'),{'OpenchannelInteractionId':Number(_0x98259e['query'][_0x287ba5('0x97')]),'UserId':Number(_0x98259e['params']['id'])});});})[_0x1fd299('0x77')](respondWithStatusCode(_0x4045b4,null))[_0x1fd299('0x4')](handleError(_0x4045b4,null));},exports[_0x39246c('0xb9')]=function(_0x3ede84,_0x138f33){const _0x1cde99=_0x39246c;return db['User'][_0x1cde99('0x13b')]({'where':{'id':_0x3ede84[_0x1cde99('0x116')]['id']}})[_0x1cde99('0x77')](handleEntityNotFound(_0x138f33,null))[_0x1cde99('0x77')](function(_0x511e1a){const _0x19532d=_0x1cde99;if(_0x511e1a)return _0x511e1a[_0x19532d('0xb9')](_0x3ede84[_0x19532d('0xa4')][_0x19532d('0x97')],{'through':_[_0x19532d('0xef')](_0x3ede84[_0x19532d('0xa4')],['ids','id'])})[_0x19532d('0x77')](function(){const _0xf1d230=_0x19532d;for(let _0x2acc35=0x0;_0x2acc35<_0x3ede84[_0xf1d230('0xa4')][_0xf1d230('0x97')]['length'];_0x2acc35+=0x1){socket[_0xf1d230('0x140')](_0xf1d230('0x114'),{'WhatsappInteractionId':Number(_0x3ede84[_0xf1d230('0xa4')][_0xf1d230('0x97')][_0x2acc35]),'UserId':Number(_0x3ede84['params']['id'])});}return _0x3ede84[_0xf1d230('0xa4')]['ids'];});})[_0x1cde99('0x77')](respondWithResult(_0x138f33,null))['catch'](handleError(_0x138f33,null));},exports[_0x39246c('0x36')]=function(_0x1a781c,_0x2a7743){const _0xd7a1a5=_0x39246c;return db[_0xd7a1a5('0xd3')][_0xd7a1a5('0x13b')]({'where':{'id':_0x1a781c[_0xd7a1a5('0x116')]['id']}})[_0xd7a1a5('0x77')](handleEntityNotFound(_0x2a7743,null))[_0xd7a1a5('0x77')](function(_0x3edb3e){const _0xf70cf8=_0xd7a1a5;if(_0x3edb3e)return _0x3edb3e[_0xf70cf8('0x36')](_0x1a781c[_0xf70cf8('0x26')][_0xf70cf8('0x97')]);})[_0xd7a1a5('0x77')](respondWithStatusCode(_0x2a7743,null))[_0xd7a1a5('0x4')](handleError(_0x2a7743,null));},exports[_0x39246c('0xad')]=function(_0x41c02c,_0x1ba9ec){const _0x3e739e=_0x39246c;let _0x508abf={};const _0x1a02b5={};let _0x2f67df,_0x350b21;return db[_0x3e739e('0xd3')][_0x3e739e('0x13b')]({'where':{'id':_0x41c02c[_0x3e739e('0x116')]['id']}})['then'](handleEntityNotFound(_0x1ba9ec,null))['then'](function(_0x122430){const _0x3484fa=_0x3e739e;if(_0x122430)return _0x2f67df=_0x122430,_0x1a02b5[_0x3484fa('0xd2')]=_[_0x3484fa('0xbe')](db[_0x3484fa('0x133')][_0x3484fa('0xfd')]),_0x1a02b5[_0x3484fa('0x26')]=_[_0x3484fa('0xbe')](_0x41c02c[_0x3484fa('0x26')]),_0x1a02b5['filters']=_[_0x3484fa('0x139')](_0x1a02b5[_0x3484fa('0xd2')],_0x1a02b5['query']),_0x508abf['attributes']=_[_0x3484fa('0x139')](_0x1a02b5[_0x3484fa('0xd2')],qs[_0x3484fa('0x84')](_0x41c02c[_0x3484fa('0x26')]['fields'])),_0x508abf[_0x3484fa('0x15f')]=_0x508abf[_0x3484fa('0x15f')][_0x3484fa('0x15d')]?_0x508abf[_0x3484fa('0x15f')]:_0x1a02b5[_0x3484fa('0xd2')],_0x508abf['order']=qs[_0x3484fa('0x101')](_0x41c02c[_0x3484fa('0x26')][_0x3484fa('0x101')]),_0x508abf[_0x3484fa('0xe2')]=qs['filters'](_[_0x3484fa('0xbf')](_0x41c02c[_0x3484fa('0x26')],_0x1a02b5[_0x3484fa('0x69')])),_0x41c02c[_0x3484fa('0x26')][_0x3484fa('0x1c')]&&(_0x508abf[_0x3484fa('0xe2')]=_['merge'](_0x508abf['where'],{[Op['or']]:_[_0x3484fa('0x102')](_0x508abf[_0x3484fa('0x15f')],function(_0x5b2f9b){const _0xf3a59b=_0x3484fa,_0x594da1={};return _0x594da1[_0x5b2f9b]={[Op[_0xf3a59b('0x154')]]:'%'+_0x41c02c[_0xf3a59b('0x26')][_0xf3a59b('0x1c')]+'%'},_0x594da1;})})),_0x508abf=_['merge']({},_0x508abf,_0x41c02c[_0x3484fa('0x1b')]),_0x2f67df[_0x3484fa('0xad')](_0x508abf);})['then'](function(_0x1cfbfd){const _0x187772=_0x3e739e;if(_0x1cfbfd)return _0x350b21=_0x1cfbfd[_0x187772('0x15d')],typeof _0x41c02c['query'][_0x187772('0x135')]===_0x187772('0xf')&&(_0x508abf[_0x187772('0x4c')]=qs[_0x187772('0x4c')](_0x41c02c['query'][_0x187772('0x4c')]),_0x508abf['offset']=qs[_0x187772('0x123')](_0x41c02c[_0x187772('0x26')][_0x187772('0x123')])),_0x2f67df['getVoicePrefixes'](_0x508abf);})[_0x3e739e('0x77')](function(_0x30aecb){if(_0x30aecb)return _0x30aecb?{'count':_0x350b21,'rows':_0x30aecb}:null;})[_0x3e739e('0x77')](respondWithResult(_0x1ba9ec,null))[_0x3e739e('0x4')](handleError(_0x1ba9ec,null));},exports[_0x39246c('0x151')]=function(_0x12dc4b,_0x375923){const _0x332e8b=_0x39246c;let _0x175ad9={};const _0x562432={};let _0x37d22b,_0x2205cc;return db[_0x332e8b('0xd3')][_0x332e8b('0x13b')]({'where':{'id':_0x12dc4b[_0x332e8b('0x116')]['id']}})[_0x332e8b('0x77')](handleEntityNotFound(_0x375923,null))[_0x332e8b('0x77')](function(_0xbdb21e){const _0x57d2c7=_0x332e8b;if(_0xbdb21e)return _0x37d22b=_0xbdb21e,_0x562432[_0x57d2c7('0xd2')]=_[_0x57d2c7('0xbe')](db[_0x57d2c7('0x44')][_0x57d2c7('0xfd')]),_0x562432['query']=_[_0x57d2c7('0xbe')](_0x12dc4b['query']),_0x562432[_0x57d2c7('0x69')]=_[_0x57d2c7('0x139')](_0x562432['model'],_0x562432['query']),_0x175ad9[_0x57d2c7('0x15f')]=_[_0x57d2c7('0x139')](_0x562432[_0x57d2c7('0xd2')],qs[_0x57d2c7('0x84')](_0x12dc4b[_0x57d2c7('0x26')]['fields'])),_0x175ad9[_0x57d2c7('0x15f')]=_0x175ad9[_0x57d2c7('0x15f')][_0x57d2c7('0x15d')]?_0x175ad9[_0x57d2c7('0x15f')]:_0x562432[_0x57d2c7('0xd2')],_0x175ad9[_0x57d2c7('0x91')]=qs[_0x57d2c7('0x101')](_0x12dc4b['query'][_0x57d2c7('0x101')]),_0x175ad9[_0x57d2c7('0xe2')]=qs[_0x57d2c7('0x69')](_[_0x57d2c7('0xbf')](_0x12dc4b[_0x57d2c7('0x26')],_0x562432['filters'])),_0x12dc4b['query'][_0x57d2c7('0x1c')]&&(_0x175ad9[_0x57d2c7('0xe2')]=_[_0x57d2c7('0x5')](_0x175ad9[_0x57d2c7('0xe2')],{[Op['or']]:_[_0x57d2c7('0x102')](_0x175ad9[_0x57d2c7('0x15f')],function(_0x40c4a4){const _0x5973bd=_0x57d2c7,_0x1a33d0={};return _0x1a33d0[_0x40c4a4]={[Op[_0x5973bd('0x154')]]:'%'+_0x12dc4b[_0x5973bd('0x26')]['filter']+'%'},_0x1a33d0;})})),_0x175ad9=_[_0x57d2c7('0x5')]({},_0x175ad9,_0x12dc4b[_0x57d2c7('0x1b')]),_0x37d22b[_0x57d2c7('0x151')](_0x175ad9);})['then'](function(_0x582b06){const _0x5d3b1a=_0x332e8b;if(_0x582b06)return _0x2205cc=_0x582b06['length'],typeof _0x12dc4b[_0x5d3b1a('0x26')][_0x5d3b1a('0x135')]===_0x5d3b1a('0xf')&&(_0x175ad9['limit']=qs[_0x5d3b1a('0x4c')](_0x12dc4b[_0x5d3b1a('0x26')][_0x5d3b1a('0x4c')]),_0x175ad9[_0x5d3b1a('0x123')]=qs[_0x5d3b1a('0x123')](_0x12dc4b[_0x5d3b1a('0x26')][_0x5d3b1a('0x123')])),_0x37d22b['getFaxAccounts'](_0x175ad9);})[_0x332e8b('0x77')](function(_0x373529){if(_0x373529)return _0x373529?{'count':_0x2205cc,'rows':_0x373529}:null;})[_0x332e8b('0x77')](respondWithResult(_0x375923,null))['catch'](handleError(_0x375923,null));},exports[_0x39246c('0x106')]=function(_0x1c70a2,_0x567ae4){const _0x26fe92=_0x39246c;return db[_0x26fe92('0xd3')][_0x26fe92('0x13b')]({'where':{'id':_0x1c70a2[_0x26fe92('0x116')]['id']}})[_0x26fe92('0x77')](handleEntityNotFound(_0x567ae4,null))[_0x26fe92('0x77')](function(_0x4c4ce1){const _0x115de3=_0x26fe92;if(_0x4c4ce1)return _0x4c4ce1['addFaxAccounts'](_0x1c70a2[_0x115de3('0xa4')][_0x115de3('0x97')],{'through':_[_0x115de3('0xef')](_0x1c70a2[_0x115de3('0xa4')],[_0x115de3('0x97'),'id'])});})[_0x26fe92('0x77')](respondWithResult(_0x567ae4,null))['catch'](handleError(_0x567ae4,null));},exports['removeFaxAccounts']=function(_0x510796,_0x1ec2fd){const _0x1fadd5=_0x39246c;return db[_0x1fadd5('0xd3')][_0x1fadd5('0x13b')]({'where':{'id':_0x510796[_0x1fadd5('0x116')]['id']}})[_0x1fadd5('0x77')](handleEntityNotFound(_0x1ec2fd,null))[_0x1fadd5('0x77')](function(_0x3ca4fa){const _0x1d1b4d=_0x1fadd5;if(_0x3ca4fa)return _0x3ca4fa['removeFaxAccounts'](_0x510796[_0x1d1b4d('0x26')][_0x1d1b4d('0x97')]);})[_0x1fadd5('0x77')](respondWithStatusCode(_0x1ec2fd,null))[_0x1fadd5('0x4')](handleError(_0x1ec2fd,null));},exports[_0x39246c('0x13')]=function(_0x296822,_0x3dc4b6){const _0x1cffa7=_0x39246c;let _0x2b5bfe={};const _0x39a350={};let _0x49a287,_0x464c7e;return db[_0x1cffa7('0xd3')][_0x1cffa7('0x13b')]({'where':{'id':_0x296822[_0x1cffa7('0x116')]['id']}})[_0x1cffa7('0x77')](handleEntityNotFound(_0x3dc4b6,null))[_0x1cffa7('0x77')](function(_0xa6d907){const _0x1d647b=_0x1cffa7;if(_0xa6d907)return _0x49a287=_0xa6d907,_0x39a350[_0x1d647b('0xd2')]=_['keys'](db[_0x1d647b('0xd4')][_0x1d647b('0xfd')]),_0x39a350['query']=_[_0x1d647b('0xbe')](_0x296822[_0x1d647b('0x26')]),_0x39a350[_0x1d647b('0x69')]=_['intersection'](_0x39a350[_0x1d647b('0xd2')],_0x39a350[_0x1d647b('0x26')]),_0x2b5bfe['attributes']=_['intersection'](_0x39a350['model'],qs[_0x1d647b('0x84')](_0x296822['query']['fields'])),_0x2b5bfe[_0x1d647b('0x15f')]=_0x2b5bfe[_0x1d647b('0x15f')][_0x1d647b('0x15d')]?_0x2b5bfe['attributes']:_0x39a350[_0x1d647b('0xd2')],_0x2b5bfe[_0x1d647b('0x91')]=qs[_0x1d647b('0x101')](_0x296822[_0x1d647b('0x26')]['sort']),_0x2b5bfe[_0x1d647b('0xe2')]=qs[_0x1d647b('0x69')](_['pick'](_0x296822[_0x1d647b('0x26')],_0x39a350[_0x1d647b('0x69')])),_0x296822[_0x1d647b('0x26')][_0x1d647b('0x1c')]&&(_0x2b5bfe[_0x1d647b('0xe2')]=_[_0x1d647b('0x5')](_0x2b5bfe[_0x1d647b('0xe2')],{[Op['or']]:_[_0x1d647b('0x102')](_0x2b5bfe[_0x1d647b('0x15f')],function(_0x2dbc59){const _0x3f81cc=_0x1d647b,_0x173917={};return _0x173917[_0x2dbc59]={[Op[_0x3f81cc('0x154')]]:'%'+_0x296822[_0x3f81cc('0x26')][_0x3f81cc('0x1c')]+'%'},_0x173917;})})),_0x2b5bfe=_[_0x1d647b('0x5')]({},_0x2b5bfe,_0x296822[_0x1d647b('0x1b')]),_0x49a287[_0x1d647b('0x13')](_0x2b5bfe);})[_0x1cffa7('0x77')](function(_0x10b9c1){const _0x518d2c=_0x1cffa7;if(_0x10b9c1)return _0x464c7e=_0x10b9c1[_0x518d2c('0x15d')],typeof _0x296822[_0x518d2c('0x26')][_0x518d2c('0x135')]==='undefined'&&(_0x2b5bfe[_0x518d2c('0x4c')]=qs[_0x518d2c('0x4c')](_0x296822[_0x518d2c('0x26')][_0x518d2c('0x4c')]),_0x2b5bfe[_0x518d2c('0x123')]=qs['offset'](_0x296822[_0x518d2c('0x26')][_0x518d2c('0x123')])),_0x49a287[_0x518d2c('0x13')](_0x2b5bfe);})[_0x1cffa7('0x77')](function(_0x3ab38f){if(_0x3ab38f)return _0x3ab38f?{'count':_0x464c7e,'rows':_0x3ab38f}:null;})[_0x1cffa7('0x77')](respondWithResult(_0x3dc4b6,null))[_0x1cffa7('0x4')](handleError(_0x3dc4b6,null));},exports[_0x39246c('0xeb')]=function(_0x6f028e,_0x154700){const _0x58b700=_0x39246c;return db[_0x58b700('0xd3')][_0x58b700('0x13b')]({'where':{'id':_0x6f028e[_0x58b700('0x116')]['id']}})[_0x58b700('0x77')](handleEntityNotFound(_0x154700,null))[_0x58b700('0x77')](function(_0xc3cee4){const _0x3815b5=_0x58b700;if(_0xc3cee4)return _0xc3cee4[_0x3815b5('0xeb')](_0x6f028e[_0x3815b5('0xa4')][_0x3815b5('0x97')],{'through':_['omit'](_0x6f028e[_0x3815b5('0xa4')],['ids','id'])});})['then'](respondWithResult(_0x154700,null))[_0x58b700('0x4')](handleError(_0x154700,null));},exports[_0x39246c('0xc0')]=function(_0x266b56,_0x5d9d7a){const _0x4c840a=_0x39246c;return db[_0x4c840a('0xd3')][_0x4c840a('0x13b')]({'where':{'id':_0x266b56[_0x4c840a('0x116')]['id']}})[_0x4c840a('0x77')](handleEntityNotFound(_0x5d9d7a,null))[_0x4c840a('0x77')](function(_0x4d55e9){const _0x1c1043=_0x4c840a;if(_0x4d55e9)return _0x4d55e9[_0x1c1043('0xc0')](_0x266b56[_0x1c1043('0x26')][_0x1c1043('0x97')]);})['then'](respondWithStatusCode(_0x5d9d7a,null))[_0x4c840a('0x4')](handleError(_0x5d9d7a,null));},exports[_0x39246c('0x99')]=function(_0x244089,_0x58b6e2){const _0x4abe7a=_0x39246c;let _0x3c4264={};const _0x3a7cc3={};let _0x2c395e,_0x28543c;return db[_0x4abe7a('0xd3')]['findOne']({'where':{'id':_0x244089[_0x4abe7a('0x116')]['id']}})['then'](handleEntityNotFound(_0x58b6e2,null))[_0x4abe7a('0x77')](function(_0x324642){const _0x831641=_0x4abe7a;if(_0x324642)return _0x2c395e=_0x324642,_0x3a7cc3[_0x831641('0xd2')]=_[_0x831641('0xbe')](db['OpenchannelAccount'][_0x831641('0xfd')]),_0x3a7cc3['query']=_[_0x831641('0xbe')](_0x244089[_0x831641('0x26')]),_0x3a7cc3[_0x831641('0x69')]=_[_0x831641('0x139')](_0x3a7cc3['model'],_0x3a7cc3[_0x831641('0x26')]),_0x3c4264['attributes']=_[_0x831641('0x139')](_0x3a7cc3[_0x831641('0xd2')],qs[_0x831641('0x84')](_0x244089[_0x831641('0x26')][_0x831641('0x84')])),_0x3c4264[_0x831641('0x15f')]=_0x3c4264['attributes'][_0x831641('0x15d')]?_0x3c4264[_0x831641('0x15f')]:_0x3a7cc3[_0x831641('0xd2')],_0x3c4264[_0x831641('0x91')]=qs['sort'](_0x244089[_0x831641('0x26')][_0x831641('0x101')]),_0x3c4264[_0x831641('0xe2')]=qs[_0x831641('0x69')](_[_0x831641('0xbf')](_0x244089[_0x831641('0x26')],_0x3a7cc3[_0x831641('0x69')])),_0x244089['query'][_0x831641('0x1c')]&&(_0x3c4264[_0x831641('0xe2')]=_[_0x831641('0x5')](_0x3c4264[_0x831641('0xe2')],{[Op['or']]:_[_0x831641('0x102')](_0x3c4264[_0x831641('0x15f')],function(_0x5e82c6){const _0x398f49=_0x831641,_0x489833={};return _0x489833[_0x5e82c6]={[Op[_0x398f49('0x154')]]:'%'+_0x244089[_0x398f49('0x26')]['filter']+'%'},_0x489833;})})),_0x3c4264=_['merge']({},_0x3c4264,_0x244089[_0x831641('0x1b')]),_0x2c395e[_0x831641('0x99')](_0x3c4264);})[_0x4abe7a('0x77')](function(_0x3b89ec){const _0x545747=_0x4abe7a;if(_0x3b89ec)return _0x28543c=_0x3b89ec['length'],typeof _0x244089['query']['nolimit']===_0x545747('0xf')&&(_0x3c4264[_0x545747('0x4c')]=qs[_0x545747('0x4c')](_0x244089['query'][_0x545747('0x4c')]),_0x3c4264[_0x545747('0x123')]=qs[_0x545747('0x123')](_0x244089[_0x545747('0x26')]['offset'])),_0x2c395e[_0x545747('0x99')](_0x3c4264);})[_0x4abe7a('0x77')](function(_0x3b5333){if(_0x3b5333)return _0x3b5333?{'count':_0x28543c,'rows':_0x3b5333}:null;})[_0x4abe7a('0x77')](respondWithResult(_0x58b6e2,null))[_0x4abe7a('0x4')](handleError(_0x58b6e2,null));},exports['addOpenchannelAccounts']=function(_0x1976bb,_0x2814f4){const _0x2c42d1=_0x39246c;return db[_0x2c42d1('0xd3')][_0x2c42d1('0x13b')]({'where':{'id':_0x1976bb['params']['id']}})[_0x2c42d1('0x77')](function(_0x2df9b2){const _0x33ad73=_0x2c42d1;if(_0x2df9b2)return _0x2df9b2[_0x33ad73('0x6b')](_0x1976bb[_0x33ad73('0xa4')][_0x33ad73('0x97')],{'through':_[_0x33ad73('0xef')](_0x1976bb[_0x33ad73('0xa4')],['ids','id'])});})[_0x2c42d1('0x77')](respondWithResult(_0x2814f4,null))[_0x2c42d1('0x4')](handleError(_0x2814f4,null));},exports[_0x39246c('0x30')]=function(_0x4ff467,_0x32dd71){const _0x4566de=_0x39246c;return db['User'][_0x4566de('0x13b')]({'where':{'id':_0x4ff467[_0x4566de('0x116')]['id']}})[_0x4566de('0x77')](handleEntityNotFound(_0x32dd71,null))[_0x4566de('0x77')](function(_0x579476){const _0x18cc20=_0x4566de;if(_0x579476)return _0x579476[_0x18cc20('0x30')](_0x4ff467['query']['ids']);})['then'](respondWithStatusCode(_0x32dd71,null))['catch'](handleError(_0x32dd71,null));},exports['getSmsAccounts']=function(_0x1e9c4b,_0x5b33bf){const _0x38cf9d=_0x39246c;let _0x484f9a={};const _0x2922ed={};let _0x3df0b2,_0x16f4c2;return db['User'][_0x38cf9d('0x13b')]({'where':{'id':_0x1e9c4b[_0x38cf9d('0x116')]['id']}})[_0x38cf9d('0x77')](handleEntityNotFound(_0x5b33bf,null))[_0x38cf9d('0x77')](function(_0x27e278){const _0x224949=_0x38cf9d;if(_0x27e278)return _0x3df0b2=_0x27e278,_0x2922ed[_0x224949('0xd2')]=_[_0x224949('0xbe')](db[_0x224949('0xe5')]['rawAttributes']),_0x2922ed['query']=_[_0x224949('0xbe')](_0x1e9c4b[_0x224949('0x26')]),_0x2922ed[_0x224949('0x69')]=_[_0x224949('0x139')](_0x2922ed[_0x224949('0xd2')],_0x2922ed[_0x224949('0x26')]),_0x484f9a[_0x224949('0x15f')]=_[_0x224949('0x139')](_0x2922ed['model'],qs[_0x224949('0x84')](_0x1e9c4b['query']['fields'])),_0x484f9a[_0x224949('0x15f')]=_0x484f9a['attributes'][_0x224949('0x15d')]?_0x484f9a[_0x224949('0x15f')]:_0x2922ed[_0x224949('0xd2')],_0x484f9a['order']=qs[_0x224949('0x101')](_0x1e9c4b['query'][_0x224949('0x101')]),_0x484f9a[_0x224949('0xe2')]=qs[_0x224949('0x69')](_[_0x224949('0xbf')](_0x1e9c4b[_0x224949('0x26')],_0x2922ed['filters'])),_0x1e9c4b[_0x224949('0x26')][_0x224949('0x1c')]&&(_0x484f9a[_0x224949('0xe2')]=_[_0x224949('0x5')](_0x484f9a['where'],{[Op['or']]:_[_0x224949('0x102')](_0x484f9a['attributes'],function(_0x1bc9e0){const _0x44398c=_0x224949,_0x53120={};return _0x53120[_0x1bc9e0]={[Op['like']]:'%'+_0x1e9c4b['query'][_0x44398c('0x1c')]+'%'},_0x53120;})})),_0x484f9a=_['merge']({},_0x484f9a,_0x1e9c4b[_0x224949('0x1b')]),_0x3df0b2['getSmsAccounts'](_0x484f9a);})[_0x38cf9d('0x77')](function(_0x2018cd){const _0x616b50=_0x38cf9d;if(_0x2018cd)return _0x16f4c2=_0x2018cd[_0x616b50('0x15d')],typeof _0x1e9c4b[_0x616b50('0x26')][_0x616b50('0x135')]===_0x616b50('0xf')&&(_0x484f9a[_0x616b50('0x4c')]=qs['limit'](_0x1e9c4b[_0x616b50('0x26')][_0x616b50('0x4c')]),_0x484f9a[_0x616b50('0x123')]=qs['offset'](_0x1e9c4b[_0x616b50('0x26')][_0x616b50('0x123')])),_0x3df0b2[_0x616b50('0xdd')](_0x484f9a);})[_0x38cf9d('0x77')](function(_0x2cc4c7){if(_0x2cc4c7)return _0x2cc4c7?{'count':_0x16f4c2,'rows':_0x2cc4c7}:null;})[_0x38cf9d('0x77')](respondWithResult(_0x5b33bf,null))['catch'](handleError(_0x5b33bf,null));},exports[_0x39246c('0x2a')]=function(_0x5cdcfd,_0x281cd5){const _0x16dc72=_0x39246c;return db[_0x16dc72('0xd3')][_0x16dc72('0x13b')]({'where':{'id':_0x5cdcfd[_0x16dc72('0x116')]['id']}})[_0x16dc72('0x77')](handleEntityNotFound(_0x281cd5,null))[_0x16dc72('0x77')](function(_0x3f684e){const _0x5355de=_0x16dc72;if(_0x3f684e)return _0x3f684e[_0x5355de('0x2a')](_0x5cdcfd[_0x5355de('0xa4')][_0x5355de('0x97')],{'through':_[_0x5355de('0xef')](_0x5cdcfd[_0x5355de('0xa4')],[_0x5355de('0x97'),'id'])});})['then'](respondWithResult(_0x281cd5,null))['catch'](handleError(_0x281cd5,null));},exports[_0x39246c('0xd5')]=function(_0xfabd42,_0x169726){const _0x4eba45=_0x39246c;return db[_0x4eba45('0xd3')][_0x4eba45('0x13b')]({'where':{'id':_0xfabd42[_0x4eba45('0x116')]['id']}})['then'](handleEntityNotFound(_0x169726,null))[_0x4eba45('0x77')](function(_0x55f136){const _0x529b76=_0x4eba45;if(_0x55f136)return _0x55f136['removeSmsAccounts'](_0xfabd42[_0x529b76('0x26')]['ids']);})[_0x4eba45('0x77')](respondWithStatusCode(_0x169726,null))[_0x4eba45('0x4')](handleError(_0x169726,null));},exports[_0x39246c('0xc5')]=function(_0x1b0641,_0x46824b){const _0x4bfe5e=_0x39246c;let _0x15349d={};const _0x107078={};let _0x3ad704,_0x52a216;return db[_0x4bfe5e('0xd3')][_0x4bfe5e('0x13b')]({'where':{'id':_0x1b0641['params']['id']}})[_0x4bfe5e('0x77')](handleEntityNotFound(_0x46824b,null))[_0x4bfe5e('0x77')](function(_0x221f2a){const _0x42742e=_0x4bfe5e;if(_0x221f2a)return _0x3ad704=_0x221f2a,_0x107078[_0x42742e('0xd2')]=_[_0x42742e('0xbe')](db[_0x42742e('0x42')][_0x42742e('0xfd')]),_0x107078[_0x42742e('0x26')]=_[_0x42742e('0xbe')](_0x1b0641['query']),_0x107078[_0x42742e('0x69')]=_[_0x42742e('0x139')](_0x107078[_0x42742e('0xd2')],_0x107078[_0x42742e('0x26')]),_0x15349d['attributes']=_[_0x42742e('0x139')](_0x107078['model'],qs[_0x42742e('0x84')](_0x1b0641[_0x42742e('0x26')]['fields'])),_0x15349d['attributes']=_0x15349d[_0x42742e('0x15f')][_0x42742e('0x15d')]?_0x15349d[_0x42742e('0x15f')]:_0x107078[_0x42742e('0xd2')],_0x15349d[_0x42742e('0x91')]=qs[_0x42742e('0x101')](_0x1b0641[_0x42742e('0x26')][_0x42742e('0x101')]),_0x15349d[_0x42742e('0xe2')]=qs['filters'](_[_0x42742e('0xbf')](_0x1b0641[_0x42742e('0x26')],_0x107078['filters'])),_0x1b0641[_0x42742e('0x26')][_0x42742e('0x1c')]&&(_0x15349d[_0x42742e('0xe2')]=_['merge'](_0x15349d[_0x42742e('0xe2')],{[Op['or']]:_['map'](_0x15349d[_0x42742e('0x15f')],function(_0x11c59f){const _0x2a9ecd=_0x42742e,_0x152adf={};return _0x152adf[_0x11c59f]={[Op[_0x2a9ecd('0x154')]]:'%'+_0x1b0641[_0x2a9ecd('0x26')][_0x2a9ecd('0x1c')]+'%'},_0x152adf;})})),_0x15349d=_[_0x42742e('0x5')]({},_0x15349d,_0x1b0641[_0x42742e('0x1b')]),_0x3ad704[_0x42742e('0xc5')](_0x15349d);})['then'](function(_0x26da68){const _0x497d39=_0x4bfe5e;if(_0x26da68)return _0x52a216=_0x26da68[_0x497d39('0x15d')],typeof _0x1b0641[_0x497d39('0x26')][_0x497d39('0x135')]===_0x497d39('0xf')&&(_0x15349d[_0x497d39('0x4c')]=qs[_0x497d39('0x4c')](_0x1b0641[_0x497d39('0x26')][_0x497d39('0x4c')]),_0x15349d[_0x497d39('0x123')]=qs[_0x497d39('0x123')](_0x1b0641[_0x497d39('0x26')][_0x497d39('0x123')])),_0x3ad704['getChatWebsites'](_0x15349d);})['then'](function(_0x121887){if(_0x121887)return _0x121887?{'count':_0x52a216,'rows':_0x121887}:null;})['then'](respondWithResult(_0x46824b,null))[_0x4bfe5e('0x4')](handleError(_0x46824b,null));},exports[_0x39246c('0xe6')]=function(_0x483747,_0x1ee0d3){const _0x4ab6ae=_0x39246c;return db[_0x4ab6ae('0xd3')][_0x4ab6ae('0x13b')]({'where':{'id':_0x483747[_0x4ab6ae('0x116')]['id']}})[_0x4ab6ae('0x77')](handleEntityNotFound(_0x1ee0d3,null))[_0x4ab6ae('0x77')](function(_0x52e167){const _0x24b4e3=_0x4ab6ae;if(_0x52e167)return _0x52e167[_0x24b4e3('0xe6')](_0x483747[_0x24b4e3('0xa4')]['ids'],{'through':_[_0x24b4e3('0xef')](_0x483747[_0x24b4e3('0xa4')],[_0x24b4e3('0x97'),'id'])});})[_0x4ab6ae('0x77')](respondWithResult(_0x1ee0d3,null))['catch'](handleError(_0x1ee0d3,null));},exports[_0x39246c('0x6a')]=function(_0x45f93e,_0x3bf9e9){const _0x1abdc8=_0x39246c;return db[_0x1abdc8('0xd3')]['findOne']({'where':{'id':_0x45f93e[_0x1abdc8('0x116')]['id']}})[_0x1abdc8('0x77')](handleEntityNotFound(_0x3bf9e9,null))[_0x1abdc8('0x77')](function(_0x3bdbf1){const _0x43d80d=_0x1abdc8;if(_0x3bdbf1)return _0x3bdbf1[_0x43d80d('0x6a')](_0x45f93e[_0x43d80d('0x26')]['ids']);})['then'](respondWithStatusCode(_0x3bf9e9,null))[_0x1abdc8('0x4')](handleError(_0x3bf9e9,null));},exports[_0x39246c('0x1e')]=function(_0x5094a9,_0x410085){const _0x2d3e12=_0x39246c;let _0x20e952={};const _0x5cc110={};let _0x503635,_0x146ad1;return db['User'][_0x2d3e12('0x13b')]({'where':{'id':_0x5094a9[_0x2d3e12('0x116')]['id']}})['then'](handleEntityNotFound(_0x410085,null))[_0x2d3e12('0x77')](function(_0x10161f){const _0x16a4a2=_0x2d3e12;if(_0x10161f)return _0x503635=_0x10161f,_0x5cc110[_0x16a4a2('0xd2')]=_[_0x16a4a2('0xbe')](db[_0x16a4a2('0x148')][_0x16a4a2('0xfd')]),_0x5cc110[_0x16a4a2('0x26')]=_[_0x16a4a2('0xbe')](_0x5094a9[_0x16a4a2('0x26')]),_0x5cc110[_0x16a4a2('0x69')]=_[_0x16a4a2('0x139')](_0x5cc110[_0x16a4a2('0xd2')],_0x5cc110[_0x16a4a2('0x26')]),_0x20e952[_0x16a4a2('0x15f')]=_[_0x16a4a2('0x139')](_0x5cc110[_0x16a4a2('0xd2')],qs['fields'](_0x5094a9['query'][_0x16a4a2('0x84')])),_0x20e952[_0x16a4a2('0x15f')]=_0x20e952[_0x16a4a2('0x15f')][_0x16a4a2('0x15d')]?_0x20e952[_0x16a4a2('0x15f')]:_0x5cc110[_0x16a4a2('0xd2')],_0x20e952[_0x16a4a2('0x91')]=qs[_0x16a4a2('0x101')](_0x5094a9[_0x16a4a2('0x26')]['sort']),_0x20e952[_0x16a4a2('0xe2')]=qs[_0x16a4a2('0x69')](_['pick'](_0x5094a9[_0x16a4a2('0x26')],_0x5cc110[_0x16a4a2('0x69')])),_0x5094a9[_0x16a4a2('0x26')][_0x16a4a2('0x1c')]&&(_0x20e952['where']=_[_0x16a4a2('0x5')](_0x20e952['where'],{[Op['or']]:_[_0x16a4a2('0x102')](_0x20e952['attributes'],function(_0x573b8a){const _0x6d563=_0x16a4a2,_0x403dc1={};return _0x403dc1[_0x573b8a]={[Op[_0x6d563('0x154')]]:'%'+_0x5094a9[_0x6d563('0x26')][_0x6d563('0x1c')]+'%'},_0x403dc1;})})),_0x20e952=_[_0x16a4a2('0x5')]({},_0x20e952,_0x5094a9[_0x16a4a2('0x1b')]),_0x503635[_0x16a4a2('0x1e')](_0x20e952);})[_0x2d3e12('0x77')](function(_0x1b24eb){const _0x43225d=_0x2d3e12;if(_0x1b24eb)return _0x146ad1=_0x1b24eb[_0x43225d('0x15d')],typeof _0x5094a9['query'][_0x43225d('0x135')]===_0x43225d('0xf')&&(_0x20e952[_0x43225d('0x4c')]=qs['limit'](_0x5094a9[_0x43225d('0x26')]['limit']),_0x20e952[_0x43225d('0x123')]=qs['offset'](_0x5094a9[_0x43225d('0x26')]['offset'])),_0x503635[_0x43225d('0x1e')](_0x20e952);})['then'](function(_0x2ba262){if(_0x2ba262)return _0x2ba262?{'count':_0x146ad1,'rows':_0x2ba262}:null;})[_0x2d3e12('0x77')](respondWithResult(_0x410085,null))[_0x2d3e12('0x4')](handleError(_0x410085,null));},exports[_0x39246c('0x50')]=function(_0x3361b9,_0x12b35e){const _0x409671=_0x39246c;return db[_0x409671('0xd3')][_0x409671('0x13b')]({'where':{'id':_0x3361b9[_0x409671('0x116')]['id']}})[_0x409671('0x77')](handleEntityNotFound(_0x12b35e,null))[_0x409671('0x77')](function(_0x2b8986){const _0x2e1c7a=_0x409671;if(_0x2b8986)return _0x2b8986[_0x2e1c7a('0x50')](_0x3361b9[_0x2e1c7a('0xa4')][_0x2e1c7a('0x97')],{'through':_['omit'](_0x3361b9[_0x2e1c7a('0xa4')],[_0x2e1c7a('0x97'),'id'])});})[_0x409671('0x77')](respondWithResult(_0x12b35e,null))[_0x409671('0x4')](handleError(_0x12b35e,null));},exports[_0x39246c('0x8')]=function(_0x18f9f3,_0x369ea6){const _0x8fce41=_0x39246c;return db[_0x8fce41('0xd3')]['findOne']({'where':{'id':_0x18f9f3[_0x8fce41('0x116')]['id']}})[_0x8fce41('0x77')](handleEntityNotFound(_0x369ea6,null))['then'](function(_0x3f65ff){const _0x1a98dc=_0x8fce41;if(_0x3f65ff)return _0x3f65ff[_0x1a98dc('0x8')](_0x18f9f3[_0x1a98dc('0x26')][_0x1a98dc('0x97')]);})['then'](respondWithStatusCode(_0x369ea6,null))[_0x8fce41('0x4')](handleError(_0x369ea6,null));},exports[_0x39246c('0x85')]=function(_0x5f3cbd,_0x9bd802){const _0x553faa=_0x39246c;let _0x183be4={};const _0x4f2cfe={};let _0x37f924,_0x3a991a;return db[_0x553faa('0xd3')][_0x553faa('0x13b')]({'where':{'id':_0x5f3cbd[_0x553faa('0x116')]['id']}})[_0x553faa('0x77')](handleEntityNotFound(_0x9bd802,null))[_0x553faa('0x77')](function(_0x3545f4){const _0x3f3c78=_0x553faa;if(_0x3545f4)return _0x37f924=_0x3545f4,_0x4f2cfe[_0x3f3c78('0xd2')]=_['keys'](db[_0x3f3c78('0x122')][_0x3f3c78('0xfd')]),_0x4f2cfe[_0x3f3c78('0x26')]=_[_0x3f3c78('0xbe')](_0x5f3cbd[_0x3f3c78('0x26')]),_0x4f2cfe[_0x3f3c78('0x69')]=_[_0x3f3c78('0x139')](_0x4f2cfe[_0x3f3c78('0xd2')],_0x4f2cfe[_0x3f3c78('0x26')]),_0x183be4[_0x3f3c78('0x15f')]=_['intersection'](_0x4f2cfe[_0x3f3c78('0xd2')],qs[_0x3f3c78('0x84')](_0x5f3cbd[_0x3f3c78('0x26')][_0x3f3c78('0x84')])),_0x183be4[_0x3f3c78('0x15f')]=_0x183be4['attributes'][_0x3f3c78('0x15d')]?_0x183be4['attributes']:_0x4f2cfe[_0x3f3c78('0xd2')],_0x183be4[_0x3f3c78('0x91')]=qs['sort'](_0x5f3cbd[_0x3f3c78('0x26')][_0x3f3c78('0x101')]),_0x183be4[_0x3f3c78('0xe2')]=qs[_0x3f3c78('0x69')](_['pick'](_0x5f3cbd[_0x3f3c78('0x26')],_0x4f2cfe[_0x3f3c78('0x69')])),_0x5f3cbd[_0x3f3c78('0x26')][_0x3f3c78('0x1c')]&&(_0x183be4['where']=_['merge'](_0x183be4[_0x3f3c78('0xe2')],{[Op['or']]:_['map'](_0x183be4[_0x3f3c78('0x15f')],function(_0x580465){const _0x51d1e7=_0x3f3c78,_0xc985e4={};return _0xc985e4[_0x580465]={[Op[_0x51d1e7('0x154')]]:'%'+_0x5f3cbd[_0x51d1e7('0x26')][_0x51d1e7('0x1c')]+'%'},_0xc985e4;})})),_0x183be4=_['merge']({},_0x183be4,_0x5f3cbd[_0x3f3c78('0x1b')]),_0x37f924[_0x3f3c78('0x85')](_0x183be4);})[_0x553faa('0x77')](function(_0x1fc117){const _0x3fd510=_0x553faa;if(_0x1fc117)return _0x3a991a=_0x1fc117[_0x3fd510('0x15d')],typeof _0x5f3cbd['query']['nolimit']===_0x3fd510('0xf')&&(_0x183be4['limit']=qs[_0x3fd510('0x4c')](_0x5f3cbd[_0x3fd510('0x26')][_0x3fd510('0x4c')]),_0x183be4[_0x3fd510('0x123')]=qs[_0x3fd510('0x123')](_0x5f3cbd[_0x3fd510('0x26')]['offset'])),_0x37f924[_0x3fd510('0x85')](_0x183be4);})[_0x553faa('0x77')](function(_0x2c27b8){if(_0x2c27b8)return _0x2c27b8?{'count':_0x3a991a,'rows':_0x2c27b8}:null;})['then'](respondWithResult(_0x9bd802,null))[_0x553faa('0x4')](handleError(_0x9bd802,null));},exports[_0x39246c('0x6')]=function(_0x2b9c10,_0x5edece){const _0x2bbd15=_0x39246c;return db[_0x2bbd15('0xd3')][_0x2bbd15('0x13b')]({'where':{'id':_0x2b9c10[_0x2bbd15('0x116')]['id']}})['then'](handleEntityNotFound(_0x5edece,null))[_0x2bbd15('0x77')](function(_0x4662e6){const _0x10b1a5=_0x2bbd15;if(_0x4662e6)return _0x4662e6[_0x10b1a5('0x6')](_0x2b9c10[_0x10b1a5('0xa4')]['ids'],{'through':_[_0x10b1a5('0xef')](_0x2b9c10[_0x10b1a5('0xa4')],['ids','id'])});})['then'](respondWithResult(_0x5edece,null))[_0x2bbd15('0x4')](handleError(_0x5edece,null));},exports[_0x39246c('0x109')]=function(_0x190f54,_0x70c391){const _0x9463c7=_0x39246c;return db[_0x9463c7('0xd3')][_0x9463c7('0x13b')]({'where':{'id':_0x190f54[_0x9463c7('0x116')]['id']}})[_0x9463c7('0x77')](handleEntityNotFound(_0x70c391,null))[_0x9463c7('0x77')](function(_0x488b63){const _0x5bed00=_0x9463c7;if(_0x488b63)return _0x488b63[_0x5bed00('0x109')](_0x190f54[_0x5bed00('0x26')][_0x5bed00('0x97')]);})['then'](respondWithStatusCode(_0x70c391,null))[_0x9463c7('0x4')](handleError(_0x70c391,null));},exports[_0x39246c('0xc')]=function(_0x258324,_0x4492c7){const _0x547247=_0x39246c;let _0x100654={};const _0x499f3c={},_0x5d5e88={'count':0x0,'rows':[]},_0x6a0ed4=db[_0x547247('0xb7')][_0x547247('0xfd')];_0x499f3c[_0x547247('0xd2')]=_[_0x547247('0xbe')](_0x6a0ed4),_0x499f3c['query']=_[_0x547247('0xbe')](_0x258324[_0x547247('0x26')]),_0x499f3c[_0x547247('0x69')]=_[_0x547247('0x139')](_0x499f3c['model'],_0x499f3c['query']),_0x499f3c[_0x547247('0x69')]=_[_0x547247('0x11d')](_0x499f3c['filters'],['$and',_0x547247('0x6d'),_0x547247('0xaf'),_0x547247('0xe'),_0x547247('0xce'),_0x547247('0xa0'),_0x547247('0x35'),'$eq',_0x547247('0xf6'),_0x547247('0x10a'),_0x547247('0xd7'),_0x547247('0x156'),'$notIn',_0x547247('0x121'),_0x547247('0x13a'),_0x547247('0x7f'),_0x547247('0x54'),_0x547247('0x121'),_0x547247('0x145'),_0x547247('0xa2'),'$contained',_0x547247('0xca')]),_0x100654[_0x547247('0x15f')]=_[_0x547247('0x139')](_0x499f3c['model'],qs['fields'](_0x258324[_0x547247('0x26')]['fields'])),_0x100654[_0x547247('0x15f')]=_0x100654[_0x547247('0x15f')][_0x547247('0x15d')]?_0x100654[_0x547247('0x15f')]:_0x499f3c['model'];typeof _0x258324[_0x547247('0x26')][_0x547247('0x135')]==='undefined'&&(_0x100654[_0x547247('0x4c')]=qs['limit'](_0x258324[_0x547247('0x26')][_0x547247('0x4c')]),_0x100654[_0x547247('0x123')]=qs[_0x547247('0x123')](_0x258324[_0x547247('0x26')][_0x547247('0x123')]));_0x100654[_0x547247('0x91')]=qs[_0x547247('0x101')](_0x258324[_0x547247('0x26')]['sort']),_0x100654[_0x547247('0xe2')]=qs['filters'](_['pick'](_0x258324[_0x547247('0x26')],_0x499f3c[_0x547247('0x69')]));_0x258324['query'][_0x547247('0x1c')]&&(_0x100654['where']=_[_0x547247('0x5')](_0x100654[_0x547247('0xe2')],{[Op['or']]:_['map'](_0x100654[_0x547247('0x15f')],function(_0x143c9b){const _0x5a8a2b=_0x547247,_0x198f1e={};return _0x198f1e[_0x143c9b]={[Op['like']]:'%'+_0x258324[_0x5a8a2b('0x26')]['filter']+'%'},_0x198f1e;})}));_0x100654[_0x547247('0xe2')]={[Op[_0x547247('0x17')]]:[_0x100654[_0x547247('0xe2')],{[Op['or']]:[{'UserId':_0x258324[_0x547247('0x116')]['id']},{'OwnerId':_0x258324['params']['id']}]}]},_0x100654=_[_0x547247('0x5')]({},_0x100654,_0x258324[_0x547247('0x1b')]);const _0x45bf92={'where':_0x100654[_0x547247('0xe2')]};return db[_0x547247('0xb7')]['count'](_0x45bf92)[_0x547247('0x77')](function(_0x193ba1){const _0x268957=_0x547247;return _0x5d5e88[_0x268957('0x15a')]=_0x193ba1,_0x258324['query'][_0x268957('0x3d')]&&(_0x100654['include']=[{'attributes':['id',_0x268957('0x111'),_0x268957('0x62'),_0x268957('0x153')],'model':db[_0x268957('0x165')],'as':_0x268957('0x3')},{'attributes':['id',_0x268957('0x7e'),_0x268957('0x3a')],'model':db[_0x268957('0x11b')],'as':_0x268957('0xa8')}]),db[_0x268957('0xb7')][_0x268957('0x40')](_0x100654);})[_0x547247('0x77')](function(_0x5c0a43){return _0x5d5e88['rows']=_0x5c0a43,_0x5d5e88;})[_0x547247('0x77')](respondWithFilteredResult(_0x4492c7,_0x100654))[_0x547247('0x4')](handleError(_0x4492c7,null));},exports[_0x39246c('0x105')]=function(_0x1bfca5,_0x1115e2){const _0x4231cb=_0x39246c;return!_['isNil'](_0x1bfca5[_0x4231cb('0xd')]['id'])&&(_0x1bfca5[_0x4231cb('0xd')][_0x4231cb('0x11c')]==_0x4231cb('0x108')||_0x1bfca5[_0x4231cb('0xd')][_0x4231cb('0x11c')]==_0x4231cb('0xd'))?db['User'][_0x4231cb('0x13b')]({'where':{'id':_0x1bfca5[_0x4231cb('0x116')]['id']},'raw':!![]})['then'](function(_0x247ada){const _0xb4c5b4=_0x4231cb;return authService[_0xb4c5b4('0xc9')](_0x247ada);})[_0x4231cb('0x77')](function(_0xe2ae44){const _0x1ca97e=_0x4231cb;return _0xe2ae44?_0x1115e2[_0x1ca97e('0x8d')](0xc8)[_0x1ca97e('0x96')]({'api_key':_0xe2ae44[_0x1ca97e('0xbb')]}):_0x1115e2['status'](0xcc)[_0x1ca97e('0x96')]({'message':_0x1ca97e('0x45')});})[_0x4231cb('0x4')](handleError(_0x1115e2,0x193)):_0x1115e2['status'](0x191)[_0x4231cb('0x96')]({'message':_0x4231cb('0x5a')});},exports[_0x39246c('0x10b')]=function(_0x13f97f,_0x5ac1bc){const _0xd0feb2=_0x39246c;return!_['isNil'](_0x13f97f[_0xd0feb2('0xd')]['id'])&&(_0x13f97f['user']['role']==_0xd0feb2('0x108')||_0x13f97f[_0xd0feb2('0xd')][_0xd0feb2('0x11c')]=='user')?db[_0xd0feb2('0x142')][_0xd0feb2('0x13b')]({'where':{'id':_0x13f97f['params']['id']}})[_0xd0feb2('0x77')](function(_0x4c312d){const _0x36c68c=_0xd0feb2;return authService[_0x36c68c('0xfe')](_0x4c312d);})[_0xd0feb2('0x77')](function(_0x2381b8){const _0x35d910=_0xd0feb2;return db[_0x35d910('0xd3')][_0x35d910('0x14f')]({'apiKeyIat':_0x2381b8['iat'],'apiKeyNonce':_0x2381b8['nonce']},{'where':{'id':_0x13f97f[_0x35d910('0x116')]['id']}})['then'](function(){const _0x3d2dfa=_0x35d910;return _0x5ac1bc['status'](0xc8)['json']({'api_key':_0x2381b8[_0x3d2dfa('0xbb')]});});})[_0xd0feb2('0x4')](handleError(_0x5ac1bc,0x193)):_0x5ac1bc[_0xd0feb2('0x8d')](0x191)['json']({'message':_0xd0feb2('0x5a')});},exports[_0x39246c('0x7c')]=function(_0x11a403,_0x2013fd){const _0x4a2c67=_0x39246c;return!_['isNil'](_0x11a403['user']['id'])&&(_0x11a403[_0x4a2c67('0xd')][_0x4a2c67('0x11c')]==_0x4a2c67('0x108')||_0x11a403[_0x4a2c67('0xd')][_0x4a2c67('0x11c')]==_0x4a2c67('0xd'))?db['Use']['findOne']({'where':{'id':_0x11a403[_0x4a2c67('0x116')]['id']}})['then'](handleEntityNotFound(_0x2013fd,null))[_0x4a2c67('0x77')](function(_0x14c2f0){const _0x1a7c18=_0x4a2c67;if(_0x14c2f0&&_0x14c2f0[_0x1a7c18('0x120')]&&_0x14c2f0['apiKeyIat'])return _0x14c2f0;else throw{'message':_0x1a7c18('0x137')};})['then'](function(){const _0x50a87d=_0x4a2c67;return db[_0x50a87d('0xd3')]['update']({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x11a403[_0x50a87d('0x116')]['id']}});})[_0x4a2c67('0x77')](respondWithStatusCode(_0x2013fd,0xc8))[_0x4a2c67('0x4')](handleError(_0x2013fd,0x193)):_0x2013fd[_0x4a2c67('0x8d')](0x191)[_0x4a2c67('0x96')]({'message':_0x4a2c67('0x5a')});},exports[_0x39246c('0x2c')]=function(_0x2d5c40,_0xc3938d){const _0xc783b0=_0x39246c,_0x2adc33=_0x2d5c40[_0xc783b0('0xd')][_0xc783b0('0x125')]({'plain':!![]});return!_0x2adc33?_0xc3938d[_0xc783b0('0x8d')](0x191)[_0xc783b0('0x129')](_0xc783b0('0x89')):_0xc3938d['status'](0xc8)[_0xc783b0('0x96')](_0x2adc33);};
\ No newline at end of file