c8768cf7820dcbdd1fbba6d025ffe0deb25ea19c
[motion-next.git] / server / api / user / user.controller.js
1 const a648_0x11d4=['user_has_whatsapp_interactions:save','server/files/images/logos/default_profile.png','addMailAccounts','emit','$overlap','Pause','getSmsInteractions','getMailInteractions','getWhatsappInteractions','FaxInteraction','voicePause','message','where','params','addOpenchannelInteractions','agent','setDataValue','keys','tag','join','Unknown\x20channel','getOpenchannelAccounts','LOGIN','status','ignore','http','114','MailAccount','unpause','user_has_chat_interactions:remove','type','getTeams','createApiKey','telephone','removeMailInteractions','show','109','upsert','Chat','userpic','set','isEmpty','capitalize','LOCAL/%s@from-sip/n','removeOpenchannelAccounts','getFaxQueues','$iLike','Telephones','changePassword','enforcePasswordHistory','phone','getMailQueues','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','ChatGroup','../../mysqldb','Queue:remove','omit','api','filename','../../components/auth/service','map','ChatInteraction','UserVoiceQueue.penalty','rows','previousPasswords','interface','login','getApiKey','getFaxInteractions','permissions','some','lastPauseAt','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','max','get','bulkCreate','$notLike','role','openchannelPause','then','getGroups','getWhatsappAccounts','$like','user_has_sms_interactions:save','files/images/','code','LOGININPAUSE','VoiceMail','path','OpenchannelAccount','forEach','108','toLowerCase','removeSmsAccounts','newPassword','getChannels','firstName','isValidChannel','$or','compact','getVoiceQueues','format','addChatWebsites','$not','user:forcelogout','dialActive','$in','query','getFaxAccounts','removeApiKey','UserId','QueueId','length','getContacts','openchannel','UserVoiceQueueRt','min_internal','getChatInteractions','removeSquareProjects','Invalid\x20body\x20format.\x20Use\x20newPassword','register','$notBetween','x-forwarded-for','removeAgent','ids','flatten','token','key','smsPause','Fax','getChatWebsites','update','undefined','$lt','password','user_has_openchannel_interactions:remove','manual','merge','user_has_fax_interactions:remove','differenceBy','removeChatWebsites','getQueues','userProfileId','salt','UserProfileResource','CmList','validatePasswordPattern','info','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)','passwordHistoryLimit','Agents','addChatInteractions','name','pauseType','getRecordings','../../rediscache','send','value','includeAll','addSmsAccounts','Voice','$between','validatePasswordHistory','100','MailInteraction','addSmsInteractions','getDataValue','FaxAccount','getLists','connection','retrieveApiKey','body','push','user:%s','lower','$notILike','transaction','Queue','105','addAgent','download','Contact','addWhatsappInteractions','user_has_fax_interactions:save','removeMailAccounts','../../components/parsers/qs','addOpenchannelAccounts','sequelize','model','internal','file','Queue:save','addFaxInteractions','error','fax','user','fields','lodash','whoami','../../config/utils','UserProfileSection','penalty','ScreenRecording','$contained','attributes','from','like','intersection','root','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','OpenchannelInteraction','catch','loginInPause','resolve','Queues','VIRTUAL','./user.socket','$any','intrf','settingsEnabled','filters','SIP/%s','isMiddleware','WhatsappAccount','whatsapp','checkUserLimits','removeFaxAccounts','getWhatsappQueues','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','socket','voice','102','request\x20sent','106','filter','addWhatsappAccounts','DEFAULT\x20PAUSE','Team','getSmsQueues','findAll','removeSmsInteractions','getOpenchannelInteractions','getChatQueues','moment','oldPassword','admin','pick','User,\x20%s,\x20%s,\x20%s','nonce','CmContact','securePassword','end','Mail','getSquareProjects','getScheduledCalls','describe','MemberReport','channel','user_has_sms_interactions:remove','YYYY-MM-DD\x20HH:mm:ss','Use','User,\x20%s,\x20%s','isArray','add','103','nolimit','json','$ne','mailbox','getVoicePrefixes','PAUSE','addTeams','headers','VoiceRecording','sendStatus','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','You\x20can\x27t\x20delete\x20yourself','client','CmHopper','pause','findOne','WhatsappInteraction','removeTeams','stringify','order','isNil','removeFaxInteractions','VoiceQueue','111','updatePasswordsHistory','getSmsAccounts','autoAssociation','Unauthorized','getMailAccounts','apiKeyIat','destroy','No\x20API\x20access\x20key\x20found!','offset','SmsInteraction','../../config/environment','$eq','addSquareProjects','getScreenRecordings','online','Content-Range','removeWhatsappAccounts','QueuePause','Openchannel','faxPause','authenticate','getOpenchannelQueues','include','logout','request','$and','sort','rawAttributes','Whatsapp','fieldName','user_has_mail_interactions:remove','and','removeOpenchannelInteractions','$notIn','User','$lte','addFaxAccounts','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','voicemail','whatsapppause','stack','apiKeyNonce','107','options','getVoiceQueuesRt','Tags','$gte','count','remove','addQueues','user_has_openchannel_interactions:save','Tag','../../config/logger','limit','addMailInteractions','concat','all','remoteAddress'];(function(_0x420938,_0x11d4d9){const _0x327340=function(_0x55c189){while(--_0x55c189){_0x420938['push'](_0x420938['shift']());}};_0x327340(++_0x11d4d9);}(a648_0x11d4,0x69));const a648_0x3273=function(_0x420938,_0x11d4d9){_0x420938=_0x420938-0x0;let _0x327340=a648_0x11d4[_0x420938];return _0x327340;};const _0x1d55f6=a648_0x3273;'use strict';const moment=require(_0x1d55f6('0x8a')),util=require('util'),path=require(_0x1d55f6('0x14b')),fs=require('fs'),_=require(_0x1d55f6('0x5c')),{getSocket}=require(_0x1d55f6('0x32')),socket=getSocket(),authService=require(_0x1d55f6('0x12e')),qs=require(_0x1d55f6('0x50')),logger=require(_0x1d55f6('0xed'))(_0x1d55f6('0x12c')),utils=require(_0x1d55f6('0x5e')),config=require(_0x1d55f6('0xc3')),db=require(_0x1d55f6('0x129'))['db'],{Op,QueryTypes,fn,col,where,ValidationError}=require(_0x1d55f6('0x52')),licenseUtil=require('../../config/license/util');require(_0x1d55f6('0x6f'))[_0x1d55f6('0xf')](socket);const jayson=require('jayson/promise'),client=jayson[_0x1d55f6('0xad')][_0x1d55f6('0x10c')]({'port':0x232a});function respondWithRpcPromise(_0x55c189,_0x33e798,_0x25177f,_0x22d1be){return new Promise(function(_0x322777,_0x33d76e){const _0x5aac58=a648_0x3273,_0xa7f77d=_0x22d1be||client;return _0xa7f77d[_0x5aac58('0xd1')](_0x55c189,_0x25177f)[_0x5aac58('0x142')](function(_0x4eb54c){const _0x18ab5f=_0x5aac58;logger[_0x18ab5f('0x2a')](_0x18ab5f('0x9c'),_0x33e798,_0x18ab5f('0x7f')),logger['debug'](_0x18ab5f('0x8e'),_0x33e798,_0x18ab5f('0x7f'),JSON[_0x18ab5f('0xb3')](_0x4eb54c));if(_0x4eb54c[_0x18ab5f('0x58')]){if(_0x4eb54c[_0x18ab5f('0x58')][_0x18ab5f('0x148')]===0x1f4)return logger['error']('User,\x20%s,\x20%s',_0x33e798,_0x4eb54c[_0x18ab5f('0x58')]['message']),_0x33d76e(_0x4eb54c[_0x18ab5f('0x58')][_0x18ab5f('0xfe')]);return logger[_0x18ab5f('0x58')](_0x18ab5f('0x9c'),_0x33e798,_0x4eb54c[_0x18ab5f('0x58')][_0x18ab5f('0xfe')]),_0x322777(_0x4eb54c['error'][_0x18ab5f('0xfe')]);}else logger[_0x18ab5f('0x2a')](_0x18ab5f('0x9c'),_0x33e798,_0x18ab5f('0x7f')),_0x322777(_0x4eb54c['result'][_0x18ab5f('0xfe')]);})['catch'](function(_0x74d593){const _0x504f71=_0x5aac58;logger[_0x504f71('0x58')](_0x504f71('0x9c'),_0x33e798,_0x74d593),_0x33d76e(_0x74d593);});});}function respondWithStatusCode(_0x4a70a8,_0x297096){return _0x297096=_0x297096||0xcc,function(_0x7047b2){const _0x3261e8=a648_0x3273;if(_0x7047b2)return _0x4a70a8[_0x3261e8('0xa9')](_0x297096);return _0x4a70a8[_0x3261e8('0x10a')](_0x297096)[_0x3261e8('0x92')]();};}function respondWithResult(_0x11e21b,_0x834649){return _0x834649=_0x834649||0xc8,function(_0xec4e7e){const _0x565177=a648_0x3273;if(_0xec4e7e)return _0x11e21b[_0x565177('0x10a')](_0x834649)[_0x565177('0xa1')](_0xec4e7e);};}function respondWithFilteredResult(_0x304f3c,_0x4678b5){return function(_0x33f222){const _0x152871=a648_0x3273;if(_0x33f222){const _0xa6978=_0x33f222[_0x152871('0xe8')],_0x300875=_0x4678b5[_0x152871('0xc1')];let _0x5e81a5=_0x4678b5['offset']+_0x4678b5[_0x152871('0xee')],_0x425080;return _0x5e81a5>=_0xa6978?(_0x5e81a5=_0xa6978,_0x425080=0xc8):_0x425080=0xce,_0x304f3c[_0x152871('0x10a')](_0x425080),_0x304f3c[_0x152871('0x11b')](_0x152871('0xc8'),_0x300875+'-'+_0x5e81a5+'/'+_0xa6978)['json'](_0x33f222);}return null;};}function saveUpdates(_0x5d563a){return function(_0x6fde){const _0x575eae=a648_0x3273;if(_0x6fde)return _0x6fde[_0x575eae('0x1a')](_0x5d563a)[_0x575eae('0x142')](function(_0x2b4bff){return _0x2b4bff;});return null;};}function removeEntity(_0x2d29be){return function(_0x5d5e0f){const _0x4f2567=a648_0x3273;if(_0x5d5e0f)return _0x5d5e0f['destroy']()['then'](function(){const _0x26c6e4=a648_0x3273,_0x4c16b3=_0x5d5e0f[_0x26c6e4('0x13d')]({'plain':!![]});if(_0x4c16b3[_0x26c6e4('0x140')]===_0x26c6e4('0x8c'))return;const _0x8c4940=[{'name':'Users','value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x26c6e4('0x122'),'value':_0x26c6e4('0x114'),'ignore':![]}],_0x2c0793=_(_0x8c4940)[_0x26c6e4('0x81')](_0x26c6e4('0x10b'))[_0x26c6e4('0x12f')](_0x26c6e4('0x34'))['value']();if(_['includes'](_0x2c0793,_0x4c16b3['role']))return;const _0x368893=_['find'](_0x8c4940,['value',_0x4c16b3['role']])['name'];return db[_0x26c6e4('0x27')][_0x26c6e4('0xbf')]({'where':{'type':_0x368893,'resourceId':_0x4c16b3['id']}})[_0x26c6e4('0x142')](function(){return _0x5d5e0f;});})[_0x4f2567('0x142')](function(){const _0x13b09e=_0x4f2567;_0x2d29be[_0x13b09e('0x10a')](0xcc)[_0x13b09e('0x92')]();});};}function handleEntityNotFound(_0x2ad3d2){return function(_0x41a922){const _0xa25813=a648_0x3273;return!_0x41a922&&_0x2ad3d2[_0xa25813('0xa9')](0x194),_0x41a922;};}function handleError(_0x4eb409,_0x49ef7a){return _0x49ef7a=_0x49ef7a||0x1f4,function(_0x53638f){const _0x493686=a648_0x3273;logger[_0x493686('0x58')](_0x53638f[_0x493686('0xe1')]),_0x53638f[_0x493686('0x2f')]&&delete _0x53638f[_0x493686('0x2f')],_0x4eb409['status'](_0x49ef7a)[_0x493686('0x33')](_0x53638f);};}function validateUser(_0x44ff70){return new Promise(function(_0x7c35d0,_0xc1a66e){const _0x31e3e8=a648_0x3273;if(_0x44ff70[_0x31e3e8('0x54')])return _0x7c35d0(_0x44ff70);return db['Setting']['findByPk'](0x1)[_0x31e3e8('0x142')](function(_0x37fa87){const _0x9292b1=_0x31e3e8;if(_0x37fa87[_0x9292b1('0x91')])authService[_0x9292b1('0x29')](_0x44ff70[_0x9292b1('0x1d')]);db[_0x9292b1('0xdb')][_0x9292b1('0x13c')](_0x9292b1('0x54'))[_0x9292b1('0x142')](function(_0x7dbf9){const _0x427e45=_0x9292b1;if(_[_0x427e45('0xb5')](_0x7dbf9)){_0x44ff70[_0x427e45('0x54')]=_0x37fa87[_0x427e45('0xb')]||0x1;return;}if(_['isNil'](_0x37fa87[_0x427e45('0xb')])||_0x37fa87[_0x427e45('0xb')]===_0x7dbf9){_0x44ff70['internal']=_0x7dbf9+0x1;return;}if(_0x37fa87[_0x427e45('0xb')]>_0x7dbf9){_0x44ff70[_0x427e45('0x54')]=_0x37fa87[_0x427e45('0xb')];return;}return db[_0x427e45('0x52')][_0x427e45('0x2')](_0x427e45('0x2b'),{'type':QueryTypes['SELECT']})['then'](function(_0xf008cf){const _0x350722=_0x427e45;if(_0xf008cf&&_0xf008cf[_0x350722('0x7')])for(let _0x52a787=0x0,_0x3aeaf9=_0xf008cf[_0x350722('0x7')];_0x52a787<_0x3aeaf9&&_['isNil'](_0x44ff70['internal']);_0x52a787++){if(_0x37fa87[_0x350722('0xb')]<=_0xf008cf[_0x52a787][_0x350722('0x64')])_0x44ff70[_0x350722('0x54')]=_0xf008cf[_0x52a787]['from'];else _0x37fa87[_0x350722('0xb')]>_0xf008cf[_0x52a787]['from']&&_0x37fa87[_0x350722('0xb')]<=_0xf008cf[_0x52a787]['to']&&(_0x44ff70[_0x350722('0x54')]=_0x37fa87[_0x350722('0xb')]);}return _['isNil'](_0x44ff70[_0x350722('0x54')])&&(_0x44ff70[_0x350722('0x54')]=_0x7dbf9+0x1),_0x7c35d0(_0x44ff70);});});})['catch'](function(_0x258d2e){_0xc1a66e(_0x258d2e);});});}function updateUser(_0x458038){return new Promise(function(_0x2aaacf,_0x28d280){const _0x2d6523=a648_0x3273;try{_0x458038[_0x2d6523('0xdf')]&&(_0x458038[_0x2d6523('0xa3')]=_0x458038['internal'],_0x458038['VoiceMail']={'mailbox':_0x458038[_0x2d6523('0x54')],'password':_0x458038[_0x2d6523('0x1d')],'fullname':_0x458038['fullname'],'email':_0x458038['email']});if(_0x458038[_0x2d6523('0x140')]===_0x2d6523('0x102')){if(!_0x458038[_0x2d6523('0x138')])_0x458038[_0x2d6523('0x138')]=['101',_0x2d6523('0x7e'),_0x2d6523('0x9f'),'113','110','104',_0x2d6523('0x49'),_0x2d6523('0x80'),_0x2d6523('0xe3'),_0x2d6523('0x14e'),_0x2d6523('0x117'),_0x2d6523('0x3a'),_0x2d6523('0xb8'),_0x2d6523('0x10d')];}_0x2aaacf(_0x458038);}catch(_0x43515d){_0x28d280(_0x43515d);}});}exports['index']=function(_0xc3c7fd,_0x1f6f28){const _0x5a6eec=_0x1d55f6;let _0x1a76da={};const _0x1d881d={},_0x3d2652={'count':0x0,'rows':[]},_0x3ad871=_['map'](db[_0x5a6eec('0xdb')][_0x5a6eec('0xd4')],function(_0x1bcc0e){const _0x52964c=_0x5a6eec;return{'name':_0x1bcc0e[_0x52964c('0xd6')],'type':_0x1bcc0e[_0x52964c('0x111')][_0x52964c('0x16')]};});_0x1d881d['model']=_[_0x5a6eec('0x22')](_['map'](_0x3ad871,_0x5a6eec('0x2f')),[_0x5a6eec('0x1d'),'salt']),_0x1d881d['query']=_[_0x5a6eec('0x104')](_0xc3c7fd['query']),_0x1d881d[_0x5a6eec('0x73')]=_[_0x5a6eec('0x66')](_0x1d881d[_0x5a6eec('0x53')],_0x1d881d[_0x5a6eec('0x2')]),_0x1a76da[_0x5a6eec('0x63')]=_[_0x5a6eec('0x66')](_0x1d881d[_0x5a6eec('0x53')],qs[_0x5a6eec('0x5b')](_0xc3c7fd['query'][_0x5a6eec('0x5b')])),_0x1a76da['attributes']=_0x1a76da[_0x5a6eec('0x63')][_0x5a6eec('0x7')]?_0x1a76da['attributes']:_0x1d881d[_0x5a6eec('0x53')];typeof _0xc3c7fd[_0x5a6eec('0x2')][_0x5a6eec('0xa0')]==='undefined'&&(_0x1a76da[_0x5a6eec('0xee')]=qs[_0x5a6eec('0xee')](_0xc3c7fd['query'][_0x5a6eec('0xee')]),_0x1a76da[_0x5a6eec('0xc1')]=qs[_0x5a6eec('0xc1')](_0xc3c7fd[_0x5a6eec('0x2')][_0x5a6eec('0xc1')]));_0x1a76da[_0x5a6eec('0xb4')]=qs[_0x5a6eec('0xd3')](_0xc3c7fd[_0x5a6eec('0x2')]['sort']),_0x1a76da[_0x5a6eec('0xff')]=qs['filters'](_[_0x5a6eec('0x8d')](_0xc3c7fd[_0x5a6eec('0x2')],_0x1d881d['filters']),_0x3ad871);_0xc3c7fd[_0x5a6eec('0x2')][_0x5a6eec('0x81')]&&(_0x1a76da[_0x5a6eec('0xff')]=_['merge'](_0x1a76da['where'],{[Op['or']]:_[_0x5a6eec('0x12f')](_0x3ad871,function(_0x19c25d){const _0x180c68=_0x5a6eec;if(_0x19c25d[_0x180c68('0x111')]!==_0x180c68('0x6e'))return where(fn('lower',col(_0x19c25d[_0x180c68('0x2f')])),{'$like':fn(_0x180c68('0x45'),'%'+_0xc3c7fd['query'][_0x180c68('0x81')]+'%')});})}));_0x1a76da=_[_0x5a6eec('0x20')]({},_0x1a76da,_0xc3c7fd[_0x5a6eec('0xe4')]);const _0x5ec6b6={'where':_0x1a76da[_0x5a6eec('0xff')]};return db[_0x5a6eec('0xdb')][_0x5a6eec('0xe8')](_0x5ec6b6)['then'](function(_0x941c4b){const _0x134acb=_0x5a6eec;return _0x3d2652[_0x134acb('0xe8')]=_0x941c4b,typeof _0xc3c7fd[_0x134acb('0x2')][_0x134acb('0x35')]!==_0x134acb('0x1b')&&(_0x1a76da[_0x134acb('0xcf')]=[{'all':!![]}]),db[_0x134acb('0xdb')][_0x134acb('0x86')](_0x1a76da);})[_0x5a6eec('0x142')](function(_0x4141b3){const _0xdb9f90=_0x5a6eec;return _0x3d2652[_0xdb9f90('0x132')]=_0x4141b3,_0x3d2652;})['then'](respondWithFilteredResult(_0x1f6f28,_0x1a76da))[_0x5a6eec('0x6a')](handleError(_0x1f6f28,null));},exports[_0x1d55f6('0x116')]=function(_0x5cd29a,_0x373bad){const _0x712776=_0x1d55f6;let _0x8521fb={'raw':![],'where':{'id':_0x5cd29a[_0x712776('0x100')]['id']}};const _0x128a3d={};return _0x128a3d[_0x712776('0x53')]=_['differenceBy'](_['keys'](db['User']['rawAttributes']),['password',_0x712776('0x26')]),_0x128a3d[_0x712776('0x2')]=_['keys'](_0x5cd29a['query']),_0x128a3d[_0x712776('0x73')]=_[_0x712776('0x66')](_0x128a3d[_0x712776('0x53')],_0x128a3d['query']),_0x8521fb[_0x712776('0x63')]=_[_0x712776('0x66')](_0x128a3d[_0x712776('0x53')],qs[_0x712776('0x5b')](_0x5cd29a['query'][_0x712776('0x5b')])),_0x8521fb['attributes']=_0x8521fb[_0x712776('0x63')][_0x712776('0x7')]?_0x8521fb[_0x712776('0x63')]:_0x128a3d[_0x712776('0x53')],_0x5cd29a[_0x712776('0x2')][_0x712776('0x35')]&&(_0x8521fb[_0x712776('0xcf')]=[{'all':!![]}]),_0x8521fb=_['merge']({},_0x8521fb,_0x5cd29a[_0x712776('0xe4')]),db[_0x712776('0xdb')][_0x712776('0xb0')](_0x8521fb)['then'](handleEntityNotFound(_0x373bad,null))[_0x712776('0x142')](respondWithResult(_0x373bad,null))[_0x712776('0x6a')](handleError(_0x373bad,null));},exports[_0x1d55f6('0x13e')]=function(_0x470bd9,_0x238a65){const _0x41643d=_0x1d55f6,_0x3c06a7=_0x470bd9[_0x41643d('0x42')];let _0xa5e278=[];if(_0x470bd9['user'][_0x41643d('0x140')]==='agent')throw new Error(_0x41643d('0xbc'));if(_[_0x41643d('0x139')](_0x3c06a7,['role',_0x41643d('0x5a')])&&_0x470bd9[_0x41643d('0x5a')]['role']!==_0x41643d('0x8c'))throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');if(_['some'](_0x3c06a7,[_0x41643d('0x140'),'admin'])&&_0x470bd9[_0x41643d('0x5a')][_0x41643d('0x140')]!==_0x41643d('0x8c'))throw new Error(_0x41643d('0x13b'));return licenseUtil[_0x41643d('0x78')](_0x3c06a7)['then'](function(){return validateUser(_0x3c06a7[0x0]);})['then'](function(){const _0x1bce8e=_0x41643d;for(let _0x3ea138=0x1;_0x3ea138<_0x3c06a7[_0x1bce8e('0x7')];_0x3ea138++){const _0x3bb4fb=_0x3c06a7[_0x3ea138-0x1][_0x1bce8e('0x54')];if(!_0x3c06a7[_0x3ea138]['internal'])_0x3c06a7[_0x3ea138][_0x1bce8e('0x54')]=_0x3bb4fb+0x1;_0xa5e278[_0x1bce8e('0x43')](validateUser(_0x3c06a7[_0x3ea138]));}return Promise[_0x1bce8e('0xf1')](_0xa5e278);})[_0x41643d('0x142')](function(){const _0x5d7aea=_0x41643d;_0xa5e278=[];for(let _0x46eaa1=0x0;_0x46eaa1<_0x3c06a7['length'];_0x46eaa1++){_0xa5e278[_0x5d7aea('0x43')](updateUser(_0x3c06a7[_0x46eaa1]));}return Promise[_0x5d7aea('0xf1')](_0xa5e278);})[_0x41643d('0x142')](function(){const _0x346890=_0x41643d;return _0xa5e278=_0x3c06a7[_0x346890('0x12f')](_0x30764c=>{const _0x2f17c2=_0x346890;return db[_0x2f17c2('0xdb')][_0x2f17c2('0xaa')](_0x30764c,{'include':[{'model':db[_0x2f17c2('0x14a')],'as':_0x2f17c2('0x14a')}]})[_0x2f17c2('0x142')](function(_0x175aa8){return _0x30764c['id']=_0x175aa8['id'],_0x30764c;});}),Promise[_0x346890('0xf1')](_0xa5e278);})[_0x41643d('0x142')](function(_0x528df2){const _0x4e14d4=_0x41643d;if(_0x470bd9[_0x4e14d4('0x42')][_0x4e14d4('0x140')]===_0x4e14d4('0x5a'))return _0x528df2;if(_0x470bd9[_0x4e14d4('0x5a')][_0x4e14d4('0x140')]!==_0x4e14d4('0x5a'))return _0x528df2;const _0x4779b4=_[_0x4e14d4('0x139')](_0x528df2,function(_0x54119f){const _0x2b795b=_0x4e14d4;return _0x54119f[_0x2b795b('0x140')]===_0x2b795b('0x102')||_0x54119f[_0x2b795b('0x140')]===_0x2b795b('0x114');});if(!_0x4779b4)return _0x528df2;return db[_0x4e14d4('0x5f')][_0x4e14d4('0x86')]({'where':{'name':{[Op['or']]:[_0x4e14d4('0x2d'),'Telephones']},'userProfileId':_0x470bd9[_0x4e14d4('0x5a')][_0x4e14d4('0x25')]},'raw':!![]})['then'](function(_0x528307){const _0x3b2116=_0x4e14d4;if(_[_0x3b2116('0x11c')](_0x528307)||!_[_0x3b2116('0x139')](_0x528307,[_0x3b2116('0xbb'),0x0]))return _0x528df2;_0xa5e278=[];const _0x250359=_(_0x528307)[_0x3b2116('0x12f')](function(_0x5efb64){const _0x357ec9=_0x3b2116;if(_0x5efb64['autoAssociation']===0x1)return;return _0x5efb64['name']===_0x357ec9('0x2d')?'agent':_0x357ec9('0x114');})[_0x3b2116('0x156')]()[_0x3b2116('0x34')]();for(let _0x272a6b=0x0;_0x272a6b<_0x528df2[_0x3b2116('0x7')];_0x272a6b++){if(!_['includes'](_0x250359,_0x528df2[_0x272a6b][_0x3b2116('0x140')]))return;const _0x243063=_0x528df2[_0x272a6b][_0x3b2116('0x140')]===_0x3b2116('0x102')?'Agents':_0x3b2116('0x122');_0xa5e278['push'](db[_0x3b2116('0x27')][_0x3b2116('0xaa')]({'name':_0x528df2[_0x272a6b][_0x3b2116('0x2f')],'resourceId':_0x528df2[_0x272a6b]['id'],'type':_0x243063,'sectionId':_['find'](_0x528307,['name',_0x243063])['id']},{}));}return Promise[_0x3b2116('0xf1')](_0xa5e278);});})[_0x41643d('0x142')](respondWithResult(_0x238a65,0xc9))[_0x41643d('0x6a')](handleError(_0x238a65,null));},exports['update']=function(_0x1e7aa9,_0x12d4dd){const _0x5e42bd=_0x1d55f6;return _0x1e7aa9[_0x5e42bd('0x42')]['id']&&delete _0x1e7aa9[_0x5e42bd('0x42')]['id'],delete _0x1e7aa9[_0x5e42bd('0x42')][_0x5e42bd('0x140')],db[_0x5e42bd('0xdb')][_0x5e42bd('0xb0')]({'where':{'id':_0x1e7aa9['params']['id']}})[_0x5e42bd('0x142')](handleEntityNotFound(_0x12d4dd,null))[_0x5e42bd('0x142')](saveUpdates(_0x1e7aa9['body'],null))[_0x5e42bd('0x142')](respondWithResult(_0x12d4dd,null))['catch'](handleError(_0x12d4dd,null));},exports[_0x1d55f6('0x96')]=function(_0x1a0c32,_0x3cd865){const _0x16126a=_0x1d55f6;return db[_0x16126a('0xdb')][_0x16126a('0x96')]()['then'](respondWithResult(_0x3cd865,null))[_0x16126a('0x6a')](handleError(_0x3cd865,null));},exports['addContacts']=function(_0x53fe62,_0x3f331b){const _0x241542=_0x1d55f6;return db['User'][_0x241542('0xb0')]({'where':{'id':_0x53fe62[_0x241542('0x100')]['id']}})['then'](handleEntityNotFound(_0x3f331b,null))['then'](function(_0x58604b){const _0x59e063=_0x241542;if(_0x58604b)return _0x58604b['addContacts'](_0x53fe62['body']['ids'],{'through':_[_0x59e063('0x12b')](_0x53fe62['body'],['ids','id'])});})[_0x241542('0x142')](respondWithResult(_0x3f331b,null))[_0x241542('0x6a')](handleError(_0x3f331b,null));},exports[_0x1d55f6('0xaa')]=function(_0x2117df,_0x3a5d2b){const _0x473971=_0x1d55f6;if(_0x2117df[_0x473971('0x5a')]['role']===_0x473971('0x102'))throw new Error(_0x473971('0xbc'));if(_0x2117df[_0x473971('0x42')][_0x473971('0x140')]===_0x473971('0x5a')&&_0x2117df['user'][_0x473971('0x140')]!==_0x473971('0x8c'))throw new Error(_0x473971('0x127'));if(_0x2117df[_0x473971('0x42')][_0x473971('0x140')]===_0x473971('0x8c')&&_0x2117df[_0x473971('0x5a')]['role']!=='admin')throw new Error(_0x473971('0x7b'));return licenseUtil[_0x473971('0x78')]([_0x2117df[_0x473971('0x42')]])['then'](function(){return validateUser(_0x2117df['body']);})['then'](function(_0x9cea03){const _0x522809=_0x473971;return updateUser(_0x9cea03)[_0x522809('0x142')](function(_0x51d062){const _0x432b17=_0x522809;return _0x51d062[_0x432b17('0x140')]==='admin'&&(_0x51d062['settingsEnabled']=_0x2117df[_0x432b17('0x5a')][_0x432b17('0x72')],delete _0x51d062[_0x432b17('0x25')]),_0x51d062;});})[_0x473971('0x142')](function(_0x1c8fd7){const _0xe297c6=_0x473971;return db[_0xe297c6('0xdb')][_0xe297c6('0xaa')](_0x1c8fd7,{'include':[{'model':db[_0xe297c6('0x14a')],'as':'VoiceMail'}]});})[_0x473971('0x142')](function(_0x36a72c){const _0x4a5aac=_0x473971;if(_0x2117df[_0x4a5aac('0x42')][_0x4a5aac('0x140')]===_0x4a5aac('0x5a'))return _0x36a72c;if(_0x2117df['user'][_0x4a5aac('0x140')]!=='user')return _0x36a72c;return db['UserProfileSection'][_0x4a5aac('0xb0')]({'where':{'name':_0x36a72c[_0x4a5aac('0x140')]===_0x4a5aac('0x102')?'Agents':_0x4a5aac('0x122'),'userProfileId':_0x2117df[_0x4a5aac('0x5a')]['userProfileId']},'raw':!![]})['then'](function(_0x34d376){const _0x5534e7=_0x4a5aac;if(!_0x34d376||_0x34d376['autoAssociation']!=0x0)return _0x36a72c;return db[_0x5534e7('0x27')]['create']({'name':_0x36a72c['name'],'resourceId':_0x36a72c['id'],'type':_0x34d376[_0x5534e7('0x2f')],'sectionId':_0x34d376['id']},{})[_0x5534e7('0x142')](function(){return _0x36a72c;});})[_0x4a5aac('0x6a')](function(_0x3258c4){const _0x4a4740=_0x4a5aac;logger[_0x4a4740('0x58')](_0x4a4740('0xab'),_0x3258c4);throw _0x3258c4;});})['then'](respondWithResult(_0x3a5d2b,0xc9))[_0x473971('0x6a')](handleError(_0x3a5d2b,null));},exports[_0x1d55f6('0x123')]=function(_0xeb29db,_0x550aa4){const _0x563d0d=_0x1d55f6;if(_0xeb29db[_0x563d0d('0x42')]['id'])delete _0xeb29db[_0x563d0d('0x42')]['id'];return db[_0x563d0d('0xdb')][_0x563d0d('0xb0')]({'where':{'id':_0xeb29db['params']['id']}})[_0x563d0d('0x142')](function(_0x5a0522){const _0x2c64d5=_0x563d0d;if(!_0x5a0522)return null;if(_0x5a0522['id']===_0xeb29db[_0x2c64d5('0x5a')]['id']){if(!_0xeb29db[_0x2c64d5('0x42')][_0x2c64d5('0x8b')]||!_0xeb29db[_0x2c64d5('0x42')][_0x2c64d5('0x151')])throw new ValidationError(_0x2c64d5('0x68'));if(!_0x5a0522[_0x2c64d5('0xcd')](_0xeb29db['body'][_0x2c64d5('0x8b')]))throw new ValidationError('Wrong\x20credentials');if(_0xeb29db[_0x2c64d5('0x42')][_0x2c64d5('0x8b')]===_0xeb29db['body'][_0x2c64d5('0x151')])throw new ValidationError('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}else{if(_0xeb29db['user'][_0x2c64d5('0x140')]===_0x2c64d5('0x8c')){if(!_0xeb29db[_0x2c64d5('0x42')][_0x2c64d5('0x151')])throw new ValidationError(_0x2c64d5('0xe'));}else{if(_0xeb29db['user'][_0x2c64d5('0x140')]===_0x2c64d5('0x5a')){if(!_0xeb29db[_0x2c64d5('0x42')][_0x2c64d5('0x151')])throw new ValidationError(_0x2c64d5('0xe'));if(_0x5a0522[_0x2c64d5('0x140')]!=='agent')throw new ValidationError(_0x2c64d5('0xbc'));}else throw new ValidationError(_0x2c64d5('0xbc'));}}return _0x5a0522;})[_0x563d0d('0x142')](handleEntityNotFound(_0x550aa4,null))['then'](function(_0x48901e){const _0x763ed=_0x563d0d;return db['Setting'][_0x763ed('0xb0')]({'attributes':['id',_0x763ed('0x91'),_0x763ed('0x124'),_0x763ed('0x2c')]})['then'](function(_0x29e593){const _0x1bd7fa=_0x763ed;if(_0x29e593[_0x1bd7fa('0x91')])authService[_0x1bd7fa('0x29')](_0xeb29db[_0x1bd7fa('0x42')][_0x1bd7fa('0x151')]);if(!_0x29e593['enforcePasswordHistory']||!_0x48901e[_0x1bd7fa('0x133')])return _0x48901e;return authService[_0x1bd7fa('0x39')](_0xeb29db[_0x1bd7fa('0x42')]['newPassword'],_0x48901e[_0x1bd7fa('0x133')],_0x29e593[_0x1bd7fa('0x2c')]),_0x48901e;})['then'](saveUpdates({'password':_0xeb29db[_0x763ed('0x42')][_0x763ed('0x151')],'passwordResetAt':_0xeb29db[_0x763ed('0x5a')]['id']==_0xeb29db[_0x763ed('0x100')]['id']?moment():null,'previousPasswords':authService[_0x763ed('0xb9')](_0xeb29db[_0x763ed('0x42')]['newPassword'],_0x48901e[_0x763ed('0x133')])},null));})[_0x563d0d('0x142')](respondWithResult(_0x550aa4,null))[_0x563d0d('0x6a')](handleError(_0x550aa4,null));},exports[_0x1d55f6('0xea')]=function(_0x576fb8,_0x233a7c){const _0x379408=_0x1d55f6,_0x55fe4a=_0x576fb8[_0x379408('0x42')][_0x379408('0x98')];return db[_0x379408('0xdb')][_0x379408('0xb0')]({'where':{'id':_0x576fb8['params']['id']},'attributes':['id',_0x379408('0x2f'),'role','online',_0x379408('0x6b'),'voicePause','interface']})['then'](handleEntityNotFound(_0x233a7c,null))[_0x379408('0x142')](function(_0x495a47){const _0x3574b6=_0x379408;if(_0x495a47){if(!utils[_0x3574b6('0x154')](_0x55fe4a))throw new ValidationError(_0x3574b6('0x107'));return _0x495a47[_0x3574b6('0x9e')+_[_0x3574b6('0x11d')](_0x55fe4a[_0x3574b6('0x14f')]())+_0x3574b6('0x6d')](_0x576fb8[_0x3574b6('0x42')][_0x3574b6('0x13')],{'through':{'penalty':_0x576fb8[_0x3574b6('0x42')][_0x3574b6('0x60')]||0x0}})[_0x3574b6('0x142')](function(_0x26e482){const _0x5ae735=_0x3574b6;for(let _0x33a480=0x0;_0x33a480<_0x576fb8['body']['ids']['length'];_0x33a480+=0x1){const _0x4e5c44={'UserId':_0x576fb8[_0x5ae735('0x100')]['id']};_0x4e5c44[_['capitalize'](_0x55fe4a['toLowerCase']())+_0x5ae735('0x6')]=_0x576fb8[_0x5ae735('0x42')][_0x5ae735('0x13')][_0x33a480],socket[_0x5ae735('0xf6')]('user'+_[_0x5ae735('0x11d')](_0x55fe4a[_0x5ae735('0x14f')]())+_0x5ae735('0x56'),_0x4e5c44);}return _0x26e482;})[_0x3574b6('0x142')](function(){const _0x45edc6=_0x3574b6;if(_0x55fe4a===_0x45edc6('0x7d'))return db[_0x45edc6('0xb7')]['findAll']({'where':{'id':_0x576fb8[_0x45edc6('0x42')][_0x45edc6('0x13')]||[]},'raw':!![],'attributes':['id',_0x45edc6('0x2f')]});})['then'](function(_0x5979d7){const _0x3a306e=_0x3574b6,_0x4af589=_0x495a47[_0x3a306e('0x13d')]({'plain':!![]}),_0x1bd43a=[];if(_0x55fe4a===_0x3a306e('0x7d')&&_0x4af589[_0x3a306e('0x140')]===_0x3a306e('0x102')&&_0x4af589[_0x3a306e('0xc7')]){for(let _0xa8c9f9=0x0;_0xa8c9f9<_0x5979d7['length'];_0xa8c9f9+=0x1){_0x1bd43a[_0x3a306e('0x43')]({'membername':_0x4af589[_0x3a306e('0x2f')],'UserId':_0x4af589['id'],'queue_name':_0x5979d7[_0xa8c9f9][_0x3a306e('0x2f')],'VoiceQueueId':_0x5979d7[_0xa8c9f9]['id'],'interface':_[_0x3a306e('0xb5')](_0x4af589[_0x3a306e('0x134')])?util[_0x3a306e('0x158')](_0x3a306e('0x74'),_0x4af589[_0x3a306e('0x2f')]):_0x4af589[_0x3a306e('0x134')],'paused':_0x4af589[_0x3a306e('0xfd')]||![],'penalty':_0x576fb8[_0x3a306e('0x42')][_0x3a306e('0x60')]||0x0});}return Promise[_0x3a306e('0xf1')](_0x1bd43a['map'](_0x46e573=>{const _0x4a0ff2=_0x3a306e;return db[_0x4a0ff2('0xa')][_0x4a0ff2('0x118')](_0x46e573);}));}return _0x495a47;});}})[_0x379408('0x142')](respondWithStatusCode(_0x233a7c,null))['catch'](handleError(_0x233a7c,null));},exports['removeQueues']=function(_0x1a141d,_0x1d5598){const _0x1bc041=_0x1d55f6;let _0x4c5e94;return db[_0x1bc041('0xdb')][_0x1bc041('0xb0')]({'where':{'id':_0x1a141d[_0x1bc041('0x100')]['id']},'attributes':['id',_0x1bc041('0x2f'),'role']})[_0x1bc041('0x142')](handleEntityNotFound(_0x1d5598,null))[_0x1bc041('0x142')](function(_0x24aa50){const _0xd3c409=_0x1bc041;if(_0x24aa50){_0x4c5e94=_0x24aa50;if(!_0x1a141d[_0xd3c409('0x2')][_0xd3c409('0x98')]||!utils[_0xd3c409('0x154')](_0x1a141d[_0xd3c409('0x2')][_0xd3c409('0x98')]))throw new ValidationError(_0xd3c409('0x107'));return _0x24aa50[_0xd3c409('0xe9')+_[_0xd3c409('0x11d')](_0x1a141d[_0xd3c409('0x2')][_0xd3c409('0x98')][_0xd3c409('0x14f')]())+'Queues'](_0x1a141d[_0xd3c409('0x2')][_0xd3c409('0x13')]);}})['then'](function(_0x25b729){const _0x55beef=_0x1bc041;for(let _0x29cc0e=0x0;_0x29cc0e<_0x1a141d['query'][_0x55beef('0x13')][_0x55beef('0x7')];_0x29cc0e+=0x1){const _0x42cac3={'UserId':_0x1a141d[_0x55beef('0x100')]['id']};_0x42cac3[_[_0x55beef('0x11d')](_0x1a141d[_0x55beef('0x2')]['channel'][_0x55beef('0x14f')]())+_0x55beef('0x6')]=_0x1a141d[_0x55beef('0x2')][_0x55beef('0x13')][_0x29cc0e],socket['emit'](_0x55beef('0x5a')+_[_0x55beef('0x11d')](_0x1a141d[_0x55beef('0x2')][_0x55beef('0x98')][_0x55beef('0x14f')]())+_0x55beef('0x12a'),_0x42cac3);}return _0x25b729;})[_0x1bc041('0x142')](function(){const _0x48e10d=_0x1bc041;if(_0x1a141d[_0x48e10d('0x2')]['channel']===_0x48e10d('0x7d'))return db[_0x48e10d('0xa')]['destroy']({'where':{'UserId':_0x1a141d[_0x48e10d('0x100')]['id'],'VoiceQueueId':_0x1a141d[_0x48e10d('0x2')]['ids']},'individualHooks':!![]})[_0x48e10d('0x142')](function(){return _0x4c5e94;});return _0x4c5e94;})[_0x1bc041('0x142')](respondWithStatusCode(_0x1d5598,null))['catch'](handleError(_0x1d5598,null));},exports['addAvatar']=function(_0x1a41a3,_0x58b84e){const _0x5798cf=_0x1d55f6;return _0x1a41a3[_0x5798cf('0x42')]['userpic']=_0x1a41a3[_0x5798cf('0x55')][_0x5798cf('0x12d')],db[_0x5798cf('0xdb')]['findOne']({'where':{'id':_0x1a41a3['params']['id']}})['then'](handleEntityNotFound(_0x58b84e,null))[_0x5798cf('0x142')](saveUpdates(_0x1a41a3[_0x5798cf('0x42')],null))[_0x5798cf('0x142')](respondWithResult(_0x58b84e,null))[_0x5798cf('0x6a')](handleError(_0x58b84e,null));},exports['getAvatar']=function(_0x55f0f7,_0x1fc612){const _0x13c9ba=_0x1d55f6,_0x562965=path[_0x13c9ba('0x106')](config[_0x13c9ba('0x67')],_0x13c9ba('0xf4'));return db[_0x13c9ba('0xdb')][_0x13c9ba('0xb0')]({'where':{'id':_0x55f0f7[_0x13c9ba('0x100')]['id']},'attributes':['id',_0x13c9ba('0x11a')],'raw':!![]})[_0x13c9ba('0x142')](handleEntityNotFound(_0x1fc612,null))[_0x13c9ba('0x142')](function(_0x2e14b9){const _0x337ca5=_0x13c9ba;if(_0x2e14b9){if(_[_0x337ca5('0xb5')](_0x2e14b9[_0x337ca5('0x11a')]))return _0x1fc612[_0x337ca5('0x4b')](_0x562965);else{if(!fs['existsSync'](path[_0x337ca5('0x106')](config[_0x337ca5('0x67')],_0x337ca5('0x147'),_0x2e14b9[_0x337ca5('0x11a')])))return _0x1fc612[_0x337ca5('0x4b')](_0x562965);return _0x1fc612[_0x337ca5('0x4b')](path[_0x337ca5('0x106')](config[_0x337ca5('0x67')],_0x337ca5('0x147'),_0x2e14b9['userpic']));}}})['catch'](handleError(_0x1fc612,null));},exports[_0x1d55f6('0x8')]=function(_0x8b7d38,_0x439eb1){const _0x35b493=_0x1d55f6;let _0x4151e0={};const _0xf14712={};let _0x46eaa7,_0x11ca7c;return db[_0x35b493('0xdb')][_0x35b493('0xb0')]({'where':{'id':_0x8b7d38[_0x35b493('0x100')]['id']}})[_0x35b493('0x142')](handleEntityNotFound(_0x439eb1,null))[_0x35b493('0x142')](function(_0x450f86){const _0x4d24d7=_0x35b493;if(_0x450f86)return _0x46eaa7=_0x450f86,_0xf14712['model']=_[_0x4d24d7('0x104')](db[_0x4d24d7('0x90')]['rawAttributes']),_0xf14712[_0x4d24d7('0x2')]=_[_0x4d24d7('0x104')](_0x8b7d38[_0x4d24d7('0x2')]),_0xf14712[_0x4d24d7('0x73')]=_['intersection'](_0xf14712['model'],_0xf14712[_0x4d24d7('0x2')]),_0x4151e0['attributes']=_[_0x4d24d7('0x66')](_0xf14712[_0x4d24d7('0x53')],qs[_0x4d24d7('0x5b')](_0x8b7d38[_0x4d24d7('0x2')][_0x4d24d7('0x5b')])),_0x4151e0['attributes']=_0x4151e0[_0x4d24d7('0x63')][_0x4d24d7('0x7')]?_0x4151e0[_0x4d24d7('0x63')]:_0xf14712['model'],_0x4151e0['order']=qs[_0x4d24d7('0xd3')](_0x8b7d38[_0x4d24d7('0x2')][_0x4d24d7('0xd3')]),_0x4151e0[_0x4d24d7('0xff')]=qs[_0x4d24d7('0x73')](_['pick'](_0x8b7d38[_0x4d24d7('0x2')],_0xf14712[_0x4d24d7('0x73')])),_0x8b7d38['query'][_0x4d24d7('0x81')]&&(_0x4151e0[_0x4d24d7('0xff')]=_[_0x4d24d7('0x20')](_0x4151e0[_0x4d24d7('0xff')],{[Op['or']]:_[_0x4d24d7('0x12f')](_0x4151e0['attributes'],function(_0x3f9cb9){const _0xff20c6=_0x4d24d7,_0x5aec01={};return _0x5aec01[_0x3f9cb9]={[Op[_0xff20c6('0x65')]]:'%'+_0x8b7d38[_0xff20c6('0x2')]['filter']+'%'},_0x5aec01;})})),_0x4151e0=_[_0x4d24d7('0x20')]({},_0x4151e0,_0x8b7d38[_0x4d24d7('0xe4')]),_0x46eaa7[_0x4d24d7('0x8')](_0x4151e0);})['then'](function(_0x55c13d){const _0x195acb=_0x35b493;if(_0x55c13d)return _0x11ca7c=_0x55c13d['length'],typeof _0x8b7d38[_0x195acb('0x2')][_0x195acb('0x35')]!==_0x195acb('0x1b')&&(_0x4151e0['include']=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x195acb('0xec')],'as':_0x195acb('0xe6'),'attributes':['id',_0x195acb('0x2f'),'color'],'where':_0x8b7d38[_0x195acb('0x2')]['tag']?{'id':_0x8b7d38[_0x195acb('0x2')][_0x195acb('0x105')]}:undefined,'required':_0x8b7d38[_0x195acb('0x2')][_0x195acb('0x105')]?!![]:![]}]),typeof _0x8b7d38[_0x195acb('0x2')][_0x195acb('0xa0')]===_0x195acb('0x1b')&&(_0x4151e0[_0x195acb('0xee')]=qs[_0x195acb('0xee')](_0x8b7d38[_0x195acb('0x2')][_0x195acb('0xee')]),_0x4151e0['offset']=qs[_0x195acb('0xc1')](_0x8b7d38[_0x195acb('0x2')][_0x195acb('0xc1')])),_0x46eaa7[_0x195acb('0x8')](_0x4151e0);})[_0x35b493('0x142')](function(_0x298161){if(_0x298161)return _0x298161?{'count':_0x11ca7c,'rows':_0x298161}:null;})[_0x35b493('0x142')](respondWithResult(_0x439eb1,null))[_0x35b493('0x6a')](handleError(_0x439eb1,null));},exports[_0x1d55f6('0x24')]=function(_0x1ae64c,_0x4d8efb){const _0x5bfee6=_0x1d55f6;let _0x442fd1,_0x1978c3={},_0x276d58;return db[_0x5bfee6('0xdb')][_0x5bfee6('0xb0')]({'where':{'id':_0x1ae64c[_0x5bfee6('0x100')]['id']},'attributes':['id','name','role']})[_0x5bfee6('0x142')](handleEntityNotFound(_0x4d8efb,null))[_0x5bfee6('0x142')](function(_0xb5f26c){const _0x59908b=_0x5bfee6;if(!utils[_0x59908b('0x154')](_0x1ae64c[_0x59908b('0x2')][_0x59908b('0x98')]))throw new ValidationError(_0x59908b('0x107'));_0x442fd1=_0xb5f26c;const _0x27f138={};_0x27f138[_0x59908b('0x53')]=_[_0x59908b('0x104')](db[_[_0x59908b('0x11d')](_0x1ae64c[_0x59908b('0x2')][_0x59908b('0x98')])+_0x59908b('0x48')][_0x59908b('0xd4')]),_0x27f138[_0x59908b('0x2')]=_[_0x59908b('0x104')](_0x1ae64c[_0x59908b('0x2')]),_0x27f138[_0x59908b('0x73')]=_[_0x59908b('0x66')](_0x27f138['model'],_0x27f138[_0x59908b('0x2')]),_0x1978c3[_0x59908b('0x63')]=_[_0x59908b('0x66')](_0x27f138['model'],qs[_0x59908b('0x5b')](_0x1ae64c[_0x59908b('0x2')][_0x59908b('0x5b')])),_0x1978c3[_0x59908b('0x63')]=_0x1978c3[_0x59908b('0x63')]['length']?_0x1978c3[_0x59908b('0x63')]:_0x27f138[_0x59908b('0x53')],_0x1978c3['order']=qs[_0x59908b('0xd3')](_0x1ae64c['query'][_0x59908b('0xd3')]),_0x1978c3[_0x59908b('0xff')]=qs[_0x59908b('0x73')](_[_0x59908b('0x8d')](_0x1ae64c[_0x59908b('0x2')],_0x27f138[_0x59908b('0x73')]));_0x1ae64c[_0x59908b('0x2')][_0x59908b('0x81')]&&(_0x1978c3[_0x59908b('0xff')]=_['merge'](_0x1978c3[_0x59908b('0xff')],{[Op['or']]:_[_0x59908b('0x12f')](_0x1978c3[_0x59908b('0x63')],function(_0x11a9fc){const _0x53da89=_0x59908b,_0x561f2b={};return _0x561f2b[_0x11a9fc]={[Op[_0x53da89('0x65')]]:'%'+_0x1ae64c[_0x53da89('0x2')][_0x53da89('0x81')]+'%'},_0x561f2b;})}));_0x1978c3=_[_0x59908b('0x20')]({},_0x1978c3,_0x1ae64c['options']);switch(_0x442fd1[_0x59908b('0x140')]){case'admin':return db[_[_0x59908b('0x11d')](_0x1ae64c['query'][_0x59908b('0x98')])+_0x59908b('0x48')]['findAll'](_0x1978c3);case'user':case _0x59908b('0x102'):return _0x442fd1[_0x59908b('0x13d')+_['capitalize'](_0x1ae64c[_0x59908b('0x2')][_0x59908b('0x98')])+_0x59908b('0x6d')](_0x1978c3);default:throw new ValidationError('Unknown\x20role');}})[_0x5bfee6('0x142')](function(_0x34035a){const _0x5e07ff=_0x5bfee6;_0x276d58=_0x34035a['length'];typeof _0x1ae64c[_0x5e07ff('0x2')]['nolimit']==='undefined'&&(_0x1978c3[_0x5e07ff('0xee')]=qs[_0x5e07ff('0xee')](_0x1ae64c['query'][_0x5e07ff('0xee')]),_0x1978c3[_0x5e07ff('0xc1')]=qs[_0x5e07ff('0xc1')](_0x1ae64c[_0x5e07ff('0x2')][_0x5e07ff('0xc1')]));switch(_0x442fd1['role']){case _0x5e07ff('0x8c'):return db[_[_0x5e07ff('0x11d')](_0x1ae64c['query']['channel'])+_0x5e07ff('0x48')][_0x5e07ff('0x86')](_0x1978c3);case'user':case _0x5e07ff('0x102'):return _0x442fd1['get'+_[_0x5e07ff('0x11d')](_0x1ae64c[_0x5e07ff('0x2')][_0x5e07ff('0x98')])+_0x5e07ff('0x6d')](_0x1978c3);}})['then'](function(_0x176087){return{'count':_0x276d58,'rows':_0x176087};})['then'](respondWithResult(_0x4d8efb,null))[_0x5bfee6('0x6a')](handleError(_0x4d8efb,null));},exports[_0x1d55f6('0xe5')]=function(_0x2c2ad3,_0x377b53){const _0x11ba8=_0x1d55f6;let _0x433463={};const _0x2402e0={};let _0x463205,_0x547a89;return db[_0x11ba8('0xdb')][_0x11ba8('0xb0')]({'where':{'id':_0x2c2ad3[_0x11ba8('0x100')]['id']}})[_0x11ba8('0x142')](handleEntityNotFound(_0x377b53,null))[_0x11ba8('0x142')](function(_0x4aa15b){const _0xa675e4=_0x11ba8;if(_0x4aa15b)return _0x463205=_0x4aa15b,_0x2402e0['model']=_[_0xa675e4('0x104')](db[_0xa675e4('0xa')]['rawAttributes']),_0x2402e0[_0xa675e4('0x2')]=_[_0xa675e4('0x104')](_0x2c2ad3[_0xa675e4('0x2')]),_0x2402e0[_0xa675e4('0x73')]=_[_0xa675e4('0x66')](_0x2402e0[_0xa675e4('0x53')],_0x2402e0[_0xa675e4('0x2')]),_0x433463['attributes']=_[_0xa675e4('0x66')](_0x2402e0[_0xa675e4('0x53')],qs[_0xa675e4('0x5b')](_0x2c2ad3[_0xa675e4('0x2')][_0xa675e4('0x5b')])),_0x433463[_0xa675e4('0x63')]=_0x433463[_0xa675e4('0x63')]['length']?_0x433463['attributes']:_0x2402e0[_0xa675e4('0x53')],_0x433463[_0xa675e4('0xb4')]=qs[_0xa675e4('0xd3')](_0x2c2ad3['query']['sort']),_0x433463['where']=qs[_0xa675e4('0x73')](_[_0xa675e4('0x8d')](_0x2c2ad3[_0xa675e4('0x2')],_0x2402e0['filters'])),_0x2c2ad3[_0xa675e4('0x2')]['filter']&&(_0x433463['where']=_[_0xa675e4('0x20')](_0x433463[_0xa675e4('0xff')],{[Op['or']]:_[_0xa675e4('0x12f')](_0x433463['attributes'],function(_0x3a5fad){const _0x19d76f=_0xa675e4,_0x3d9d6e={};return _0x3d9d6e[_0x3a5fad]={[Op[_0x19d76f('0x65')]]:'%'+_0x2c2ad3['query'][_0x19d76f('0x81')]+'%'},_0x3d9d6e;})})),_0x433463=_[_0xa675e4('0x20')]({},_0x433463,_0x2c2ad3[_0xa675e4('0xe4')]),_0x463205[_0xa675e4('0xe5')](_0x433463);})['then'](function(_0x8a9f13){const _0x29c671=_0x11ba8;if(_0x8a9f13)return _0x547a89=_0x8a9f13[_0x29c671('0x7')],typeof _0x2c2ad3[_0x29c671('0x2')][_0x29c671('0xa0')]===_0x29c671('0x1b')&&(_0x433463[_0x29c671('0xee')]=qs[_0x29c671('0xee')](_0x2c2ad3[_0x29c671('0x2')][_0x29c671('0xee')]),_0x433463[_0x29c671('0xc1')]=qs['offset'](_0x2c2ad3[_0x29c671('0x2')][_0x29c671('0xc1')])),_0x463205[_0x29c671('0xe5')](_0x433463);})[_0x11ba8('0x142')](function(_0x5e9a52){if(_0x5e9a52)return _0x5e9a52?{'count':_0x547a89,'rows':_0x5e9a52}:null;})[_0x11ba8('0x142')](respondWithResult(_0x377b53,null))[_0x11ba8('0x6a')](handleError(_0x377b53,null));},exports[_0x1d55f6('0x143')]=function(_0x2baf7b,_0x5089a4){const _0x5d6d65=_0x1d55f6;let _0x160c7f={};const _0x3bb82a={};let _0x4db8ca,_0x5ac2be;return db['User'][_0x5d6d65('0xb0')]({'where':{'id':_0x2baf7b['params']['id']}})['then'](handleEntityNotFound(_0x5089a4,null))[_0x5d6d65('0x142')](function(_0x481909){const _0x4fcd0b=_0x5d6d65;if(_0x481909)return _0x4db8ca=_0x481909,_0x3bb82a['model']=_[_0x4fcd0b('0x104')](db[_0x4fcd0b('0x128')][_0x4fcd0b('0xd4')]),_0x3bb82a['query']=_[_0x4fcd0b('0x104')](_0x2baf7b['query']),_0x3bb82a[_0x4fcd0b('0x73')]=_[_0x4fcd0b('0x66')](_0x3bb82a[_0x4fcd0b('0x53')],_0x3bb82a[_0x4fcd0b('0x2')]),_0x160c7f[_0x4fcd0b('0x63')]=_['intersection'](_0x3bb82a['model'],qs['fields'](_0x2baf7b['query']['fields'])),_0x160c7f['attributes']=_0x160c7f['attributes'][_0x4fcd0b('0x7')]?_0x160c7f['attributes']:_0x3bb82a[_0x4fcd0b('0x53')],_0x160c7f[_0x4fcd0b('0xb4')]=qs[_0x4fcd0b('0xd3')](_0x2baf7b[_0x4fcd0b('0x2')]['sort']),_0x160c7f[_0x4fcd0b('0xff')]=qs[_0x4fcd0b('0x73')](_[_0x4fcd0b('0x8d')](_0x2baf7b['query'],_0x3bb82a[_0x4fcd0b('0x73')])),_0x2baf7b[_0x4fcd0b('0x2')][_0x4fcd0b('0x81')]&&(_0x160c7f[_0x4fcd0b('0xff')]=_[_0x4fcd0b('0x20')](_0x160c7f['where'],{[Op['or']]:_[_0x4fcd0b('0x12f')](_0x160c7f[_0x4fcd0b('0x63')],function(_0x71e28f){const _0x544db9=_0x4fcd0b,_0x3933dc={};return _0x3933dc[_0x71e28f]={[Op['like']]:'%'+_0x2baf7b['query'][_0x544db9('0x81')]+'%'},_0x3933dc;})})),_0x160c7f=_[_0x4fcd0b('0x20')]({},_0x160c7f,_0x2baf7b['options']),_0x4db8ca['getGroups'](_0x160c7f);})['then'](function(_0x51dbd8){const _0x19c462=_0x5d6d65;if(_0x51dbd8)return _0x5ac2be=_0x51dbd8[_0x19c462('0x7')],typeof _0x2baf7b[_0x19c462('0x2')]['nolimit']===_0x19c462('0x1b')&&(_0x160c7f[_0x19c462('0xee')]=qs['limit'](_0x2baf7b[_0x19c462('0x2')][_0x19c462('0xee')]),_0x160c7f['offset']=qs[_0x19c462('0xc1')](_0x2baf7b[_0x19c462('0x2')][_0x19c462('0xc1')])),_0x4db8ca[_0x19c462('0x143')](_0x160c7f);})[_0x5d6d65('0x142')](function(_0x235645){if(_0x235645)return _0x235645?{'count':_0x5ac2be,'rows':_0x235645}:null;})['then'](respondWithResult(_0x5089a4,null))[_0x5d6d65('0x6a')](handleError(_0x5089a4,null));},exports[_0x1d55f6('0x31')]=function(_0xdf2dd0,_0x2ab3d9){const _0x157384=_0x1d55f6;let _0x39d132={'raw':!![],'where':{}};const _0x16d728={},_0x5a5a24={'count':0x0,'rows':[]};return db[_0x157384('0xdb')][_0x157384('0xb0')]({'where':{'id':_0xdf2dd0[_0x157384('0x100')]['id']}})['then'](handleEntityNotFound(_0x2ab3d9,null))[_0x157384('0x142')](function(_0x114157){const _0x3a3278=_0x157384;if(_0x114157)return _0x16d728[_0x3a3278('0x53')]=_[_0x3a3278('0x104')](db[_0x3a3278('0xa8')][_0x3a3278('0xd4')]),_0x16d728['query']=_[_0x3a3278('0x104')](_0xdf2dd0['query']),_0x16d728[_0x3a3278('0x73')]=_['intersection'](_0x16d728[_0x3a3278('0x53')],_0x16d728['query']),_0x39d132['attributes']=_[_0x3a3278('0x66')](_0x16d728[_0x3a3278('0x53')],qs[_0x3a3278('0x5b')](_0xdf2dd0[_0x3a3278('0x2')][_0x3a3278('0x5b')])),_0x39d132['attributes']=_0x39d132[_0x3a3278('0x63')][_0x3a3278('0x7')]?_0x39d132[_0x3a3278('0x63')]:_0x16d728[_0x3a3278('0x53')],typeof _0xdf2dd0[_0x3a3278('0x2')][_0x3a3278('0xa0')]==='undefined'&&(_0x39d132[_0x3a3278('0xee')]=qs['limit'](_0xdf2dd0[_0x3a3278('0x2')][_0x3a3278('0xee')]),_0x39d132[_0x3a3278('0xc1')]=qs['offset'](_0xdf2dd0[_0x3a3278('0x2')][_0x3a3278('0xc1')])),_0x39d132[_0x3a3278('0xb4')]=qs[_0x3a3278('0xd3')](_0xdf2dd0[_0x3a3278('0x2')]['sort']),_0x39d132['where']=qs['filters'](_[_0x3a3278('0x8d')](_0xdf2dd0[_0x3a3278('0x2')],_0x16d728[_0x3a3278('0x73')])),_0x39d132[_0x3a3278('0xff')][_0x3a3278('0x5')]=_0x114157['id'],_0xdf2dd0[_0x3a3278('0x2')][_0x3a3278('0x81')]&&(_0x39d132[_0x3a3278('0xff')]=_[_0x3a3278('0x20')](_0x39d132[_0x3a3278('0xff')],{[Op['or']]:_[_0x3a3278('0x12f')](_0x39d132['attributes'],function(_0x4c3d25){const _0x4267c2=_0x3a3278,_0x26fcd2={};return _0x26fcd2[_0x4c3d25]={[Op[_0x4267c2('0x65')]]:'%'+_0xdf2dd0[_0x4267c2('0x2')][_0x4267c2('0x81')]+'%'},_0x26fcd2;})})),_0x39d132=_['merge']({},_0x39d132,_0xdf2dd0[_0x3a3278('0xe4')]),db[_0x3a3278('0xa8')][_0x3a3278('0xe8')]({'where':_0x39d132[_0x3a3278('0xff')]})[_0x3a3278('0x142')](function(_0x411a6a){const _0x120a96=_0x3a3278;return _0x5a5a24['count']=_0x411a6a,_0xdf2dd0[_0x120a96('0x2')][_0x120a96('0x35')]&&(_0x39d132[_0x120a96('0xcf')]=[{'all':!![]}]),db[_0x120a96('0xa8')][_0x120a96('0x86')](_0x39d132);})['then'](function(_0x377844){return _0x5a5a24['rows']=_0x377844,_0x5a5a24;});})[_0x157384('0x142')](respondWithFilteredResult(_0x2ab3d9,_0x39d132))[_0x157384('0x6a')](handleError(_0x2ab3d9,null));},exports[_0x1d55f6('0xc6')]=function(_0x49939f,_0x3c31ea){const _0x5b7ec9=_0x1d55f6;let _0x1fa38a={'raw':!![],'where':{}};const _0x42332f={},_0x15cf8c={'count':0x0,'rows':[]};return db[_0x5b7ec9('0xdb')][_0x5b7ec9('0xb0')]({'where':{'id':_0x49939f[_0x5b7ec9('0x100')]['id']}})[_0x5b7ec9('0x142')](handleEntityNotFound(_0x3c31ea,null))['then'](function(_0x1fbbbb){const _0x1fafc0=_0x5b7ec9;if(_0x1fbbbb)return _0x42332f[_0x1fafc0('0x53')]=_[_0x1fafc0('0x104')](db['ScreenRecording'][_0x1fafc0('0xd4')]),_0x42332f[_0x1fafc0('0x2')]=_[_0x1fafc0('0x104')](_0x49939f[_0x1fafc0('0x2')]),_0x42332f[_0x1fafc0('0x73')]=_[_0x1fafc0('0x66')](_0x42332f[_0x1fafc0('0x53')],_0x42332f[_0x1fafc0('0x2')]),_0x1fa38a[_0x1fafc0('0x63')]=_['intersection'](_0x42332f[_0x1fafc0('0x53')],qs[_0x1fafc0('0x5b')](_0x49939f['query'][_0x1fafc0('0x5b')])),_0x1fa38a['attributes']=_0x1fa38a[_0x1fafc0('0x63')][_0x1fafc0('0x7')]?_0x1fa38a['attributes']:_0x42332f['model'],typeof _0x49939f[_0x1fafc0('0x2')][_0x1fafc0('0xa0')]===_0x1fafc0('0x1b')&&(_0x1fa38a[_0x1fafc0('0xee')]=qs[_0x1fafc0('0xee')](_0x49939f[_0x1fafc0('0x2')][_0x1fafc0('0xee')]),_0x1fa38a[_0x1fafc0('0xc1')]=qs['offset'](_0x49939f[_0x1fafc0('0x2')][_0x1fafc0('0xc1')])),_0x1fa38a[_0x1fafc0('0xb4')]=qs[_0x1fafc0('0xd3')](_0x49939f[_0x1fafc0('0x2')][_0x1fafc0('0xd3')]),_0x1fa38a['where']=qs[_0x1fafc0('0x73')](_[_0x1fafc0('0x8d')](_0x49939f[_0x1fafc0('0x2')],_0x42332f[_0x1fafc0('0x73')])),_0x1fa38a[_0x1fafc0('0xff')]['UserId']=_0x1fbbbb['id'],_0x49939f[_0x1fafc0('0x2')][_0x1fafc0('0x81')]&&(_0x1fa38a[_0x1fafc0('0xff')]=_['merge'](_0x1fa38a[_0x1fafc0('0xff')],{[Op['or']]:_['map'](_0x1fa38a[_0x1fafc0('0x63')],function(_0x1596a2){const _0x2a684f=_0x1fafc0,_0x12c57a={};return _0x12c57a[_0x1596a2]={[Op[_0x2a684f('0x65')]]:'%'+_0x49939f[_0x2a684f('0x2')]['filter']+'%'},_0x12c57a;})})),_0x1fa38a=_[_0x1fafc0('0x20')]({},_0x1fa38a,_0x49939f[_0x1fafc0('0xe4')]),db[_0x1fafc0('0x61')][_0x1fafc0('0xe8')]({'where':_0x1fa38a[_0x1fafc0('0xff')]})['then'](function(_0x45fe94){const _0xd075e4=_0x1fafc0;return _0x15cf8c['count']=_0x45fe94,_0x49939f[_0xd075e4('0x2')][_0xd075e4('0x35')]&&(_0x1fa38a[_0xd075e4('0xcf')]=[{'all':!![]}]),db[_0xd075e4('0x61')]['findAll'](_0x1fa38a);})[_0x1fafc0('0x142')](function(_0x42d78a){const _0x4e4a26=_0x1fafc0;return _0x15cf8c[_0x4e4a26('0x132')]=_0x42d78a,_0x15cf8c;});})['then'](respondWithFilteredResult(_0x3c31ea,_0x1fa38a))[_0x5b7ec9('0x6a')](handleError(_0x3c31ea,null));},exports[_0x1d55f6('0xc')]=function(_0x8033f6,_0x1926f0){const _0x5d4a31=_0x1d55f6;let _0x15d3bd={};const _0x2ae869={};let _0x498b79,_0xb54ef3;return db[_0x5d4a31('0xdb')][_0x5d4a31('0xb0')]({'where':{'id':_0x8033f6[_0x5d4a31('0x100')]['id']}})['then'](handleEntityNotFound(_0x1926f0,null))[_0x5d4a31('0x142')](function(_0x111a64){const _0x7c5202=_0x5d4a31;if(_0x111a64)return _0x498b79=_0x111a64,_0x2ae869[_0x7c5202('0x53')]=_[_0x7c5202('0x104')](db[_0x7c5202('0x130')][_0x7c5202('0xd4')]),_0x2ae869[_0x7c5202('0x2')]=_[_0x7c5202('0x104')](_0x8033f6['query']),_0x2ae869['filters']=_['intersection'](_0x2ae869[_0x7c5202('0x53')],_0x2ae869[_0x7c5202('0x2')]),_0x15d3bd[_0x7c5202('0x63')]=_[_0x7c5202('0x66')](_0x2ae869[_0x7c5202('0x53')],qs['fields'](_0x8033f6['query'][_0x7c5202('0x5b')])),_0x15d3bd['attributes']=_0x15d3bd[_0x7c5202('0x63')]['length']?_0x15d3bd[_0x7c5202('0x63')]:_0x2ae869[_0x7c5202('0x53')],_0x15d3bd[_0x7c5202('0xb4')]=qs['sort'](_0x8033f6[_0x7c5202('0x2')][_0x7c5202('0xd3')]),_0x15d3bd[_0x7c5202('0xff')]=qs[_0x7c5202('0x73')](_['pick'](_0x8033f6[_0x7c5202('0x2')],_0x2ae869[_0x7c5202('0x73')])),_0x8033f6[_0x7c5202('0x2')][_0x7c5202('0x81')]&&(_0x15d3bd[_0x7c5202('0xff')]=_[_0x7c5202('0x20')](_0x15d3bd[_0x7c5202('0xff')],{[Op['or']]:_[_0x7c5202('0x12f')](_0x15d3bd['attributes'],function(_0x3b07db){const _0x10a0c6=_0x7c5202,_0x47b570={};return _0x47b570[_0x3b07db]={[Op[_0x10a0c6('0x65')]]:'%'+_0x8033f6[_0x10a0c6('0x2')][_0x10a0c6('0x81')]+'%'},_0x47b570;})})),_0x15d3bd=_[_0x7c5202('0x20')]({},_0x15d3bd,_0x8033f6[_0x7c5202('0xe4')]),_0x498b79[_0x7c5202('0xc')](_0x15d3bd);})[_0x5d4a31('0x142')](function(_0x38f94e){const _0x509196=_0x5d4a31;if(_0x38f94e)return _0xb54ef3=_0x38f94e['length'],typeof _0x8033f6[_0x509196('0x2')][_0x509196('0xa0')]===_0x509196('0x1b')&&(_0x15d3bd[_0x509196('0xee')]=qs[_0x509196('0xee')](_0x8033f6[_0x509196('0x2')]['limit']),_0x15d3bd[_0x509196('0xc1')]=qs[_0x509196('0xc1')](_0x8033f6[_0x509196('0x2')][_0x509196('0xc1')])),_0x498b79[_0x509196('0xc')](_0x15d3bd);})[_0x5d4a31('0x142')](function(_0x1eaa1d){if(_0x1eaa1d)return _0x1eaa1d?{'count':_0xb54ef3,'rows':_0x1eaa1d}:null;})[_0x5d4a31('0x142')](respondWithResult(_0x1926f0,null))[_0x5d4a31('0x6a')](handleError(_0x1926f0,null));},exports['getOpenchannelInteractions']=function(_0x4144ff,_0x49dd7e){const _0x131d4c=_0x1d55f6;let _0x391374={};const _0x53d08d={};let _0x2433ba,_0x6269aa;return db[_0x131d4c('0xdb')][_0x131d4c('0xb0')]({'where':{'id':_0x4144ff[_0x131d4c('0x100')]['id']}})[_0x131d4c('0x142')](handleEntityNotFound(_0x49dd7e,null))['then'](function(_0x4eac31){const _0x4d8de2=_0x131d4c;if(_0x4eac31)return _0x2433ba=_0x4eac31,_0x53d08d[_0x4d8de2('0x53')]=_[_0x4d8de2('0x104')](db[_0x4d8de2('0x69')][_0x4d8de2('0xd4')]),_0x53d08d[_0x4d8de2('0x2')]=_[_0x4d8de2('0x104')](_0x4144ff[_0x4d8de2('0x2')]),_0x53d08d['filters']=_[_0x4d8de2('0x66')](_0x53d08d[_0x4d8de2('0x53')],_0x53d08d[_0x4d8de2('0x2')]),_0x391374[_0x4d8de2('0x63')]=_[_0x4d8de2('0x66')](_0x53d08d[_0x4d8de2('0x53')],qs[_0x4d8de2('0x5b')](_0x4144ff['query'][_0x4d8de2('0x5b')])),_0x391374['attributes']=_0x391374['attributes'][_0x4d8de2('0x7')]?_0x391374[_0x4d8de2('0x63')]:_0x53d08d['model'],_0x391374['order']=qs[_0x4d8de2('0xd3')](_0x4144ff[_0x4d8de2('0x2')][_0x4d8de2('0xd3')]),_0x391374[_0x4d8de2('0xff')]=qs[_0x4d8de2('0x73')](_[_0x4d8de2('0x8d')](_0x4144ff[_0x4d8de2('0x2')],_0x53d08d[_0x4d8de2('0x73')])),_0x4144ff['query'][_0x4d8de2('0x81')]&&(_0x391374['where']=_[_0x4d8de2('0x20')](_0x391374[_0x4d8de2('0xff')],{[Op['or']]:_[_0x4d8de2('0x12f')](_0x391374[_0x4d8de2('0x63')],function(_0x2c204c){const _0x67a7a5=_0x4d8de2,_0x3a998a={};return _0x3a998a[_0x2c204c]={[Op[_0x67a7a5('0x65')]]:'%'+_0x4144ff[_0x67a7a5('0x2')][_0x67a7a5('0x81')]+'%'},_0x3a998a;})})),_0x391374=_['merge']({},_0x391374,_0x4144ff['options']),_0x2433ba['getOpenchannelInteractions'](_0x391374);})[_0x131d4c('0x142')](function(_0x30347d){const _0x21954d=_0x131d4c;if(_0x30347d)return _0x6269aa=_0x30347d[_0x21954d('0x7')],typeof _0x4144ff['query'][_0x21954d('0xa0')]===_0x21954d('0x1b')&&(_0x391374[_0x21954d('0xee')]=qs[_0x21954d('0xee')](_0x4144ff[_0x21954d('0x2')][_0x21954d('0xee')]),_0x391374[_0x21954d('0xc1')]=qs[_0x21954d('0xc1')](_0x4144ff[_0x21954d('0x2')][_0x21954d('0xc1')])),_0x2433ba[_0x21954d('0x88')](_0x391374);})[_0x131d4c('0x142')](function(_0x1eba85){if(_0x1eba85)return _0x1eba85?{'count':_0x6269aa,'rows':_0x1eba85}:null;})[_0x131d4c('0x142')](respondWithResult(_0x49dd7e,null))[_0x131d4c('0x6a')](handleError(_0x49dd7e,null));},exports[_0x1d55f6('0xfa')]=function(_0x1d1d7a,_0x2f33f2){const _0x103989=_0x1d55f6;let _0x5df1ea={'raw':!![],'where':{}};const _0x18b64f={},_0x39293e={'count':0x0,'rows':[]};return db[_0x103989('0xdb')][_0x103989('0xb0')]({'where':{'id':_0x1d1d7a[_0x103989('0x100')]['id']}})[_0x103989('0x142')](handleEntityNotFound(_0x2f33f2,null))[_0x103989('0x142')](function(_0x5dbd97){const _0x16060f=_0x103989;if(_0x5dbd97)return _0x18b64f[_0x16060f('0x53')]=_['keys'](db[_0x16060f('0x3b')]['rawAttributes']),_0x18b64f[_0x16060f('0x2')]=_[_0x16060f('0x104')](_0x1d1d7a[_0x16060f('0x2')]),_0x18b64f[_0x16060f('0x73')]=_[_0x16060f('0x66')](_0x18b64f[_0x16060f('0x53')],_0x18b64f[_0x16060f('0x2')]),_0x5df1ea[_0x16060f('0x63')]=_[_0x16060f('0x66')](_0x18b64f[_0x16060f('0x53')],qs['fields'](_0x1d1d7a[_0x16060f('0x2')][_0x16060f('0x5b')])),_0x5df1ea[_0x16060f('0x63')]=_0x5df1ea[_0x16060f('0x63')][_0x16060f('0x7')]?_0x5df1ea[_0x16060f('0x63')]:_0x18b64f['model'],typeof _0x1d1d7a[_0x16060f('0x2')][_0x16060f('0xa0')]===_0x16060f('0x1b')&&(_0x5df1ea['limit']=qs['limit'](_0x1d1d7a[_0x16060f('0x2')][_0x16060f('0xee')]),_0x5df1ea[_0x16060f('0xc1')]=qs[_0x16060f('0xc1')](_0x1d1d7a[_0x16060f('0x2')][_0x16060f('0xc1')])),_0x5df1ea[_0x16060f('0xb4')]=qs[_0x16060f('0xd3')](_0x1d1d7a['query'][_0x16060f('0xd3')]),_0x5df1ea['where']=qs[_0x16060f('0x73')](_[_0x16060f('0x8d')](_0x1d1d7a[_0x16060f('0x2')],_0x18b64f[_0x16060f('0x73')])),_0x5df1ea[_0x16060f('0xff')][_0x16060f('0x5')]=_0x5dbd97['id'],_0x1d1d7a[_0x16060f('0x2')][_0x16060f('0x81')]&&(_0x5df1ea[_0x16060f('0xff')]=_['merge'](_0x5df1ea['where'],{[Op['or']]:_[_0x16060f('0x12f')](_0x5df1ea[_0x16060f('0x63')],function(_0x374149){const _0x3215ab=_0x16060f,_0x286dc4={};return _0x286dc4[_0x374149]={[Op['like']]:'%'+_0x1d1d7a[_0x3215ab('0x2')][_0x3215ab('0x81')]+'%'},_0x286dc4;})})),_0x5df1ea=_['merge']({},_0x5df1ea,_0x1d1d7a['options']),db[_0x16060f('0x3b')][_0x16060f('0xe8')]({'where':_0x5df1ea[_0x16060f('0xff')]})[_0x16060f('0x142')](function(_0x119bcb){const _0x557d78=_0x16060f;return _0x39293e['count']=_0x119bcb,_0x1d1d7a[_0x557d78('0x2')][_0x557d78('0x35')]&&(_0x5df1ea[_0x557d78('0xcf')]=[{'all':!![]}]),db[_0x557d78('0x3b')][_0x557d78('0x86')](_0x5df1ea);})['then'](function(_0x56c115){const _0x3cde52=_0x16060f;return _0x39293e[_0x3cde52('0x132')]=_0x56c115,_0x39293e;});})[_0x103989('0x142')](respondWithFilteredResult(_0x2f33f2,_0x5df1ea))[_0x103989('0x6a')](handleError(_0x2f33f2,null));},exports[_0x1d55f6('0xf9')]=function(_0x2006e4,_0x2ec88e){const _0x257fba=_0x1d55f6;let _0x4d1dc5={};const _0x42b637={};let _0x40791c,_0x345543;return db['User'][_0x257fba('0xb0')]({'where':{'id':_0x2006e4[_0x257fba('0x100')]['id']}})['then'](handleEntityNotFound(_0x2ec88e,null))['then'](function(_0x73a14){const _0x1694f8=_0x257fba;if(_0x73a14)return _0x40791c=_0x73a14,_0x42b637[_0x1694f8('0x53')]=_[_0x1694f8('0x104')](db[_0x1694f8('0xc2')][_0x1694f8('0xd4')]),_0x42b637['query']=_['keys'](_0x2006e4[_0x1694f8('0x2')]),_0x42b637['filters']=_[_0x1694f8('0x66')](_0x42b637[_0x1694f8('0x53')],_0x42b637[_0x1694f8('0x2')]),_0x4d1dc5['attributes']=_['intersection'](_0x42b637[_0x1694f8('0x53')],qs['fields'](_0x2006e4[_0x1694f8('0x2')][_0x1694f8('0x5b')])),_0x4d1dc5[_0x1694f8('0x63')]=_0x4d1dc5[_0x1694f8('0x63')][_0x1694f8('0x7')]?_0x4d1dc5[_0x1694f8('0x63')]:_0x42b637[_0x1694f8('0x53')],_0x4d1dc5['order']=qs[_0x1694f8('0xd3')](_0x2006e4[_0x1694f8('0x2')][_0x1694f8('0xd3')]),_0x4d1dc5[_0x1694f8('0xff')]=qs[_0x1694f8('0x73')](_[_0x1694f8('0x8d')](_0x2006e4[_0x1694f8('0x2')],_0x42b637[_0x1694f8('0x73')])),_0x2006e4['query'][_0x1694f8('0x81')]&&(_0x4d1dc5['where']=_[_0x1694f8('0x20')](_0x4d1dc5['where'],{[Op['or']]:_[_0x1694f8('0x12f')](_0x4d1dc5['attributes'],function(_0x1fed50){const _0x164169=_0x1694f8,_0x1c8afd={};return _0x1c8afd[_0x1fed50]={[Op[_0x164169('0x65')]]:'%'+_0x2006e4['query'][_0x164169('0x81')]+'%'},_0x1c8afd;})})),_0x4d1dc5=_[_0x1694f8('0x20')]({},_0x4d1dc5,_0x2006e4['options']),_0x40791c['getSmsInteractions'](_0x4d1dc5);})[_0x257fba('0x142')](function(_0x40b7be){const _0x59df72=_0x257fba;if(_0x40b7be)return _0x345543=_0x40b7be[_0x59df72('0x7')],typeof _0x2006e4[_0x59df72('0x2')]['nolimit']===_0x59df72('0x1b')&&(_0x4d1dc5['limit']=qs[_0x59df72('0xee')](_0x2006e4[_0x59df72('0x2')][_0x59df72('0xee')]),_0x4d1dc5[_0x59df72('0xc1')]=qs[_0x59df72('0xc1')](_0x2006e4[_0x59df72('0x2')][_0x59df72('0xc1')])),_0x40791c[_0x59df72('0xf9')](_0x4d1dc5);})[_0x257fba('0x142')](function(_0x1bfd2f){if(_0x1bfd2f)return _0x1bfd2f?{'count':_0x345543,'rows':_0x1bfd2f}:null;})[_0x257fba('0x142')](respondWithResult(_0x2ec88e,null))[_0x257fba('0x6a')](handleError(_0x2ec88e,null));},exports['getFaxInteractions']=function(_0x51db65,_0x4f0791){const _0x3be26b=_0x1d55f6;let _0x462889={};const _0x453c85={};let _0x3c57a1,_0x44ed4a;return db[_0x3be26b('0xdb')][_0x3be26b('0xb0')]({'where':{'id':_0x51db65[_0x3be26b('0x100')]['id']}})[_0x3be26b('0x142')](handleEntityNotFound(_0x4f0791,null))['then'](function(_0x1ca40a){const _0x55039=_0x3be26b;if(_0x1ca40a)return _0x3c57a1=_0x1ca40a,_0x453c85[_0x55039('0x53')]=_[_0x55039('0x104')](db[_0x55039('0xfc')]['rawAttributes']),_0x453c85[_0x55039('0x2')]=_[_0x55039('0x104')](_0x51db65['query']),_0x453c85['filters']=_[_0x55039('0x66')](_0x453c85[_0x55039('0x53')],_0x453c85[_0x55039('0x2')]),_0x462889[_0x55039('0x63')]=_[_0x55039('0x66')](_0x453c85[_0x55039('0x53')],qs[_0x55039('0x5b')](_0x51db65[_0x55039('0x2')][_0x55039('0x5b')])),_0x462889[_0x55039('0x63')]=_0x462889['attributes']['length']?_0x462889[_0x55039('0x63')]:_0x453c85[_0x55039('0x53')],_0x462889[_0x55039('0xb4')]=qs[_0x55039('0xd3')](_0x51db65[_0x55039('0x2')]['sort']),_0x462889['where']=qs['filters'](_['pick'](_0x51db65[_0x55039('0x2')],_0x453c85[_0x55039('0x73')])),_0x51db65[_0x55039('0x2')][_0x55039('0x81')]&&(_0x462889[_0x55039('0xff')]=_[_0x55039('0x20')](_0x462889['where'],{[Op['or']]:_['map'](_0x462889[_0x55039('0x63')],function(_0xc4b798){const _0x51c9af=_0x55039,_0x5d8133={};return _0x5d8133[_0xc4b798]={[Op[_0x51c9af('0x65')]]:'%'+_0x51db65[_0x51c9af('0x2')]['filter']+'%'},_0x5d8133;})})),_0x462889=_[_0x55039('0x20')]({},_0x462889,_0x51db65[_0x55039('0xe4')]),_0x3c57a1[_0x55039('0x137')](_0x462889);})[_0x3be26b('0x142')](function(_0xa7c2dd){const _0x56c3dd=_0x3be26b;if(_0xa7c2dd)return _0x44ed4a=_0xa7c2dd[_0x56c3dd('0x7')],typeof _0x51db65[_0x56c3dd('0x2')][_0x56c3dd('0xa0')]===_0x56c3dd('0x1b')&&(_0x462889[_0x56c3dd('0xee')]=qs[_0x56c3dd('0xee')](_0x51db65[_0x56c3dd('0x2')][_0x56c3dd('0xee')]),_0x462889[_0x56c3dd('0xc1')]=qs['offset'](_0x51db65['query'][_0x56c3dd('0xc1')])),_0x3c57a1['getFaxInteractions'](_0x462889);})['then'](function(_0x1ccc28){if(_0x1ccc28)return _0x1ccc28?{'count':_0x44ed4a,'rows':_0x1ccc28}:null;})[_0x3be26b('0x142')](respondWithResult(_0x4f0791,null))[_0x3be26b('0x6a')](handleError(_0x4f0791,null));},exports[_0x1d55f6('0xfb')]=function(_0x37e40a,_0x1b468d){const _0xb5aeef=_0x1d55f6;let _0x581e91={};const _0x42c4bc={};let _0x1dfac8,_0x4f5a00;return db[_0xb5aeef('0xdb')][_0xb5aeef('0xb0')]({'where':{'id':_0x37e40a[_0xb5aeef('0x100')]['id']}})['then'](handleEntityNotFound(_0x1b468d,null))['then'](function(_0x5e7c12){const _0x4f8a6e=_0xb5aeef;if(_0x5e7c12)return _0x1dfac8=_0x5e7c12,_0x42c4bc[_0x4f8a6e('0x53')]=_[_0x4f8a6e('0x104')](db[_0x4f8a6e('0xb1')]['rawAttributes']),_0x42c4bc[_0x4f8a6e('0x2')]=_[_0x4f8a6e('0x104')](_0x37e40a[_0x4f8a6e('0x2')]),_0x42c4bc[_0x4f8a6e('0x73')]=_[_0x4f8a6e('0x66')](_0x42c4bc[_0x4f8a6e('0x53')],_0x42c4bc[_0x4f8a6e('0x2')]),_0x581e91[_0x4f8a6e('0x63')]=_[_0x4f8a6e('0x66')](_0x42c4bc[_0x4f8a6e('0x53')],qs[_0x4f8a6e('0x5b')](_0x37e40a[_0x4f8a6e('0x2')][_0x4f8a6e('0x5b')])),_0x581e91[_0x4f8a6e('0x63')]=_0x581e91[_0x4f8a6e('0x63')][_0x4f8a6e('0x7')]?_0x581e91[_0x4f8a6e('0x63')]:_0x42c4bc[_0x4f8a6e('0x53')],_0x581e91[_0x4f8a6e('0xb4')]=qs['sort'](_0x37e40a[_0x4f8a6e('0x2')][_0x4f8a6e('0xd3')]),_0x581e91[_0x4f8a6e('0xff')]=qs['filters'](_[_0x4f8a6e('0x8d')](_0x37e40a[_0x4f8a6e('0x2')],_0x42c4bc['filters'])),_0x37e40a[_0x4f8a6e('0x2')][_0x4f8a6e('0x81')]&&(_0x581e91['where']=_[_0x4f8a6e('0x20')](_0x581e91['where'],{[Op['or']]:_[_0x4f8a6e('0x12f')](_0x581e91['attributes'],function(_0x52f4e9){const _0x206ef4=_0x4f8a6e,_0x4c62ce={};return _0x4c62ce[_0x52f4e9]={[Op['like']]:'%'+_0x37e40a[_0x206ef4('0x2')][_0x206ef4('0x81')]+'%'},_0x4c62ce;})})),_0x581e91=_[_0x4f8a6e('0x20')]({},_0x581e91,_0x37e40a[_0x4f8a6e('0xe4')]),_0x1dfac8['getWhatsappInteractions'](_0x581e91);})[_0xb5aeef('0x142')](function(_0x86a110){const _0x36ad49=_0xb5aeef;if(_0x86a110)return _0x4f5a00=_0x86a110[_0x36ad49('0x7')],typeof _0x37e40a[_0x36ad49('0x2')][_0x36ad49('0xa0')]===_0x36ad49('0x1b')&&(_0x581e91['limit']=qs[_0x36ad49('0xee')](_0x37e40a[_0x36ad49('0x2')]['limit']),_0x581e91[_0x36ad49('0xc1')]=qs[_0x36ad49('0xc1')](_0x37e40a['query'][_0x36ad49('0xc1')])),_0x1dfac8['getWhatsappInteractions'](_0x581e91);})[_0xb5aeef('0x142')](function(_0x1a5bfb){if(_0x1a5bfb)return _0x1a5bfb?{'count':_0x4f5a00,'rows':_0x1a5bfb}:null;})['then'](respondWithResult(_0x1b468d,null))[_0xb5aeef('0x6a')](handleError(_0x1b468d,null));},exports[_0x1d55f6('0x135')]=function(_0x89b323,_0x224856,_0x37ddd9){const _0x8e689b=_0x1d55f6;let _0x248139,_0x2f48de,_0x76d988;const _0x3b8aa7=!_['isNil'](_0x89b323[_0x8e689b('0x100')]['id'])?_0x89b323[_0x8e689b('0x100')]['id']:!_[_0x8e689b('0xb5')](_0x89b323['user']['id'])?_0x89b323[_0x8e689b('0x5a')]['id']:null;return db[_0x8e689b('0xdb')][_0x8e689b('0xb0')]({'where':{'id':_0x3b8aa7,'role':{[Op['or']]:[_0x8e689b('0x8c'),_0x8e689b('0x5a'),_0x8e689b('0x102')]}},'attributes':['id',_0x8e689b('0x2f'),_0x8e689b('0x125'),'mobile',_0x8e689b('0x140'),_0x8e689b('0x54'),_0x8e689b('0x6b')]})[_0x8e689b('0x142')](function(_0x1491e6){const _0x4efd7d=_0x8e689b;if(_0x1491e6){if(_0x1491e6['role']===_0x4efd7d('0x102')){_0x248139=_0x1491e6;if(_0x89b323[_0x4efd7d('0x42')]['interface'])_0x76d988=util['format'](_0x4efd7d('0x11e'),_0x248139[_0x89b323['body'][_0x4efd7d('0x134')]]);else _0x89b323[_0x4efd7d('0x42')]['intrf']?_0x76d988=util[_0x4efd7d('0x158')](_0x4efd7d('0x74'),_0x89b323[_0x4efd7d('0x42')][_0x4efd7d('0x71')]):_0x76d988=util[_0x4efd7d('0x158')](_0x4efd7d('0x74'),_0x248139[_0x4efd7d('0x2f')]);return socket['to'](util[_0x4efd7d('0x158')](_0x4efd7d('0x44'),_0x248139['name']))[_0x4efd7d('0xf6')](_0x4efd7d('0x15b'),{'ip':_0x89b323[_0x4efd7d('0xa7')][_0x4efd7d('0x11')]||_0x89b323[_0x4efd7d('0x40')][_0x4efd7d('0xf2')]||_0x89b323[_0x4efd7d('0x7c')][_0x4efd7d('0xf2')]||_0x89b323[_0x4efd7d('0x40')][_0x4efd7d('0x7c')][_0x4efd7d('0xf2')]}),db['UserVoiceQueueRt'][_0x4efd7d('0xbf')]({'where':{'membername':_0x248139[_0x4efd7d('0x2f')]},'individualHooks':!![]});}}else throw new ValidationError('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');})['then'](function(){const _0xe35889=_0x8e689b;if(_0x248139)return _0x248139[_0xe35889('0x157')]({'raw':!![]});})['then'](function(_0x367fe3){const _0x48c0e4=_0x8e689b;if(_0x248139){if(_0x367fe3){_0x2f48de=_0x367fe3;if(_0x2f48de['length']){const _0x2b1d6e=_0x2f48de['map'](_0x4898a9=>{const _0x5c1ab6=a648_0x3273,_0xa9a07b={'membername':_0x248139[_0x5c1ab6('0x2f')],'UserId':_0x248139['id'],'queue_name':_0x4898a9[_0x5c1ab6('0x2f')],'VoiceQueueId':_0x4898a9['id'],'interface':_0x76d988,'paused':_0x248139[_0x5c1ab6('0x6b')]||![],'penalty':_0x4898a9[_0x5c1ab6('0x131')]||0x0};return db[_0x5c1ab6('0xa')]['upsert'](_0xa9a07b);});return Promise[_0x48c0e4('0xf1')](_0x2b1d6e);}}}})[_0x8e689b('0x142')](function(){const _0x2c3c92=_0x8e689b;if(_0x248139)return db[_0x2c3c92('0x97')][_0x2c3c92('0x86')]({'where':{'membername':_0x248139['name'],'exitAt':null}});})[_0x8e689b('0x142')](function(_0xfe03d7){const _0x359cac=_0x8e689b;if(_0x248139){const _0x5e4ec7=[];return _0xfe03d7['forEach'](function(_0xde252b){const _0x3cc683=a648_0x3273;_0x5e4ec7[_0x3cc683('0x43')](_0xde252b[_0x3cc683('0x1a')]({'exitAt':moment()[_0x3cc683('0x158')](_0x3cc683('0x9a'))}));}),Promise[_0x359cac('0xf1')](_0x5e4ec7);}})[_0x8e689b('0x142')](function(){const _0x33f9c6=_0x8e689b;if(_0x248139){const _0x1e89bb=[],_0x419449=[],_0x5a7c09=utils['getChannels'](),_0x5b0e3e={'membername':_0x248139[_0x33f9c6('0x2f')],'interface':_0x76d988,'enterAt':moment()[_0x33f9c6('0x158')](_0x33f9c6('0x9a')),'role':_0x248139[_0x33f9c6('0x140')],'internal':_0x248139[_0x33f9c6('0x54')]};return _0x5a7c09[_0x33f9c6('0x14d')](function(_0x39e1e8){const _0x3ab7e1=_0x33f9c6;_0x1e89bb[_0x3ab7e1('0x43')](_[_0x3ab7e1('0x20')]({'channel':_0x39e1e8,'type':_0x3ab7e1('0x109'),'data1':_0x89b323[_0x3ab7e1('0x42')]['device'],'data2':_0x76d988},_0x5b0e3e)),_0x248139[_0x3ab7e1('0x6b')]&&_0x419449[_0x3ab7e1('0x43')](_[_0x3ab7e1('0x20')]({'channel':_0x39e1e8,'type':_0x3ab7e1('0xa5'),'data1':_0x3ab7e1('0x149')},_0x5b0e3e));}),db[_0x33f9c6('0x97')]['bulkCreate'](_0x1e89bb[_0x33f9c6('0xf0')](_0x419449),{'individualHooks':!![]});}})[_0x8e689b('0x142')](function(){const _0x31fd9b=_0x8e689b;if(_0x248139)return _0x248139[_0x31fd9b('0x1a')]({'online':!![],'lastLoginAt':moment()[_0x31fd9b('0x158')](_0x31fd9b('0x9a')),'voicePause':_0x248139[_0x31fd9b('0x6b')]||![],'mailPause':_0x248139[_0x31fd9b('0x6b')]||![],'chatPause':_0x248139[_0x31fd9b('0x6b')]||![],'faxPause':_0x248139['loginInPause']||![],'smsPause':_0x248139[_0x31fd9b('0x6b')]||![],'openchannelPause':_0x248139[_0x31fd9b('0x6b')]||![],'whatsappPause':_0x248139['loginInPause']||![],'pauseType':_0x248139[_0x31fd9b('0x6b')]?_0x31fd9b('0x149'):null,'interface':_0x76d988,'lastPauseAt':moment()['format'](_0x31fd9b('0x9a'))});})['then'](function(_0x516d91){const _0x2d262b=_0x8e689b;return _0x89b323[_0x2d262b('0x75')]?_0x37ddd9():Promise[_0x2d262b('0x6c')](_0x516d91)['then'](respondWithResult(_0x224856,null));})[_0x8e689b('0x6a')](handleError(_0x224856,null));},exports[_0x1d55f6('0xd0')]=function(_0x373988,_0x21265b){const _0x52446e=_0x1d55f6;let _0x4c5993;return db[_0x52446e('0xdb')][_0x52446e('0xb0')]({'where':{'id':_0x373988[_0x52446e('0x100')]['id'],'role':_0x52446e('0x102')},'attributes':['id',_0x52446e('0x2f'),_0x52446e('0x140')]})[_0x52446e('0x142')](handleEntityNotFound(_0x21265b,null))[_0x52446e('0x142')](function(_0x11f065){const _0x159c09=_0x52446e;if(_0x11f065)return _0x4c5993=_0x11f065,db[_0x159c09('0xa')][_0x159c09('0xbf')]({'where':{'membername':_0x4c5993[_0x159c09('0x2f')]},'individualHooks':!![]});})[_0x52446e('0x142')](function(){const _0x5bfe57=_0x52446e;return db[_0x5bfe57('0x97')][_0x5bfe57('0x86')]({'where':{'membername':_0x4c5993['name'],'exitAt':null}});})[_0x52446e('0x142')](function(_0xa671a1){const _0x45073c=_0x52446e,_0xb2da83=[];return _0xa671a1['forEach'](function(_0x224acb){const _0x22a620=a648_0x3273;_0xb2da83[_0x22a620('0x43')](_0x224acb[_0x22a620('0x1a')]({'exitAt':moment()['format'](_0x22a620('0x9a'))}));}),Promise[_0x45073c('0xf1')](_0xb2da83);})[_0x52446e('0x142')](function(){const _0x41a21c=_0x52446e;return _0x4c5993[_0x41a21c('0x1a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x21265b,null))[_0x52446e('0x6a')](handleError(_0x21265b,null));},exports[_0x1d55f6('0xaf')]=function(_0x211d77,_0x5e861a){const _0x529dab=_0x1d55f6;let _0x579ad7;return db[_0x529dab('0xa')][_0x529dab('0x1a')]({'paused':0x1},{'where':{'UserId':_0x211d77[_0x529dab('0x100')]['id']},'individualHooks':!![]})[_0x529dab('0x142')](function(){const _0x4dbf74=_0x529dab;return db[_0x4dbf74('0xdb')][_0x4dbf74('0xb0')]({'where':{'id':_0x211d77['params']['id'],'role':_0x4dbf74('0x102')},'attributes':['id','name',_0x4dbf74('0x140'),_0x4dbf74('0x54'),_0x4dbf74('0x134')]});})[_0x529dab('0x142')](handleEntityNotFound(_0x5e861a,null))['then'](function(_0x49ac5d){const _0x8aa15b=_0x529dab;if(_0x49ac5d)return _0x579ad7=_0x49ac5d,respondWithRpcPromise('QueuePause',_0x8aa15b('0xaf'),{'id':_0x579ad7['id'],'name':_0x579ad7[_0x8aa15b('0x2f')],'pause':!![]});})[_0x529dab('0x142')](function(){const _0x64909f=_0x529dab;if(_0x579ad7)return db[_0x64909f('0x97')][_0x64909f('0x86')]({'where':{'membername':_0x579ad7[_0x64909f('0x2f')],'type':_0x64909f('0xa5'),'exitAt':null}});})['then'](function(_0x3dc14d){const _0x447b40=_0x529dab;if(_0x3dc14d[_0x447b40('0x7')]){const _0x1a5336=moment()[_0x447b40('0x158')](_0x447b40('0x9a'));for(let _0x4b2dac=0x0,_0x131b78=_0x3dc14d[_0x447b40('0x7')];_0x4b2dac<_0x131b78;_0x4b2dac++){_0x3dc14d[_0x4b2dac][_0x447b40('0x1a')]({'exitAt':_0x1a5336});}}})[_0x529dab('0x142')](function(){const _0x36072b=_0x529dab,_0x1ec2ef=[],_0x21dfe3=utils[_0x36072b('0x152')]();return _0x21dfe3['forEach'](function(_0x56b1e8){const _0x5012a0=_0x36072b;_0x1ec2ef[_0x5012a0('0x43')]({'channel':_0x56b1e8,'membername':_0x579ad7['name'],'interface':_[_0x5012a0('0xb5')](_0x579ad7[_0x5012a0('0x134')])?util[_0x5012a0('0x158')](_0x5012a0('0x74'),_0x579ad7[_0x5012a0('0x2f')]):_0x579ad7[_0x5012a0('0x134')],'type':_0x5012a0('0xa5'),'enterAt':moment()['format'](_0x5012a0('0x9a')),'data1':_0x211d77[_0x5012a0('0x42')][_0x5012a0('0x111')]||_0x5012a0('0x83'),'role':_0x579ad7[_0x5012a0('0x140')],'internal':_0x579ad7[_0x5012a0('0x54')]});}),db[_0x36072b('0x97')][_0x36072b('0x13e')](_0x1ec2ef,{'individualHooks':!![]});})[_0x529dab('0x142')](function(){const _0x113c50=_0x529dab;return _0x579ad7[_0x113c50('0x1a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x211d77[_0x113c50('0x42')][_0x113c50('0x111')]||_0x113c50('0x83'),'lastPauseAt':moment()[_0x113c50('0x158')](_0x113c50('0x9a'))});})[_0x529dab('0x142')](respondWithResult(_0x5e861a,null))['catch'](handleError(_0x5e861a,null));},exports[_0x1d55f6('0x10f')]=function(_0x1a54ee,_0x497501){const _0x3634fb=_0x1d55f6;let _0x167a9f;return db['User'][_0x3634fb('0xb0')]({'where':{'id':_0x1a54ee[_0x3634fb('0x100')]['id']},'attributes':['id',_0x3634fb('0x2f'),_0x3634fb('0x140'),'voicePause','mailPause','chatPause',_0x3634fb('0xcc'),_0x3634fb('0x141'),_0x3634fb('0x17'),_0x3634fb('0xe0'),_0x3634fb('0x30'),_0x3634fb('0x13a')]})['then'](handleEntityNotFound(_0x497501,null))[_0x3634fb('0x142')](function(_0x2e91da){const _0x425faf=_0x3634fb;if(_0x2e91da){_0x167a9f=_0x2e91da;if(_0x1a54ee['body'][_0x425faf('0x98')]&&!utils[_0x425faf('0x154')](_0x1a54ee[_0x425faf('0x42')][_0x425faf('0x98')]))throw new ValidationError(_0x425faf('0x107'));switch(_0x1a54ee[_0x425faf('0x42')][_0x425faf('0x98')]){case _0x425faf('0x7d'):return respondWithRpcPromise('QueuePause',_0x425faf('0x10f'),{'id':_0x167a9f['id'],'name':_0x167a9f[_0x425faf('0x2f')],'pause':![]})[_0x425faf('0x142')](function(){const _0x11fb9d=_0x425faf;return db[_0x11fb9d('0xa')][_0x11fb9d('0x1a')]({'paused':0x0},{'where':{'UserId':_0x167a9f['id']},'individualHooks':!![]});})[_0x425faf('0x142')](function(){const _0x4e2a8f=_0x425faf;return db[_0x4e2a8f('0x97')][_0x4e2a8f('0xb0')]({'where':{'channel':_0x1a54ee[_0x4e2a8f('0x42')][_0x4e2a8f('0x98')],'membername':_0x167a9f[_0x4e2a8f('0x2f')],'type':_0x4e2a8f('0xa5'),'exitAt':null}});})[_0x425faf('0x142')](function(_0x462877){const _0x47c751=_0x425faf;if(_0x462877)return _0x462877[_0x47c751('0x1a')]({'exitAt':moment()[_0x47c751('0x158')](_0x47c751('0x9a')),'data2':_0x47c751('0x1f')},{'individualHooks':!![]});return null;})[_0x425faf('0x142')](function(){const _0x53ac0c=_0x425faf;return _0x167a9f[_0x53ac0c('0x1a')]({'voicePause':![]});});case'mail':case'chat':case _0x425faf('0x59'):case'sms':case _0x425faf('0x77'):case _0x425faf('0x9'):return db[_0x425faf('0x97')][_0x425faf('0xb0')]({'where':{'channel':_0x1a54ee[_0x425faf('0x42')]['channel'],'membername':_0x167a9f[_0x425faf('0x2f')],'type':_0x425faf('0xa5'),'exitAt':null}})[_0x425faf('0x142')](function(_0x3d876b){const _0x3fed76=_0x425faf;if(_0x3d876b)return _0x3d876b[_0x3fed76('0x1a')]({'exitAt':moment()['format'](_0x3fed76('0x9a')),'data2':'manual'},{'individualHooks':!![]});return null;})[_0x425faf('0x142')](function(){const _0x51f09d=_0x425faf,_0x3cc053={};return _[_0x51f09d('0x11b')](_0x3cc053,util[_0x51f09d('0x158')]('%s%s',_0x1a54ee[_0x51f09d('0x42')]['channel'],_0x51f09d('0xf8')),![]),_0x167a9f['update'](_0x3cc053);});default:return respondWithRpcPromise(_0x425faf('0xca'),_0x425faf('0x10f'),{'id':_0x167a9f['id'],'name':_0x167a9f[_0x425faf('0x2f')],'pause':![]})[_0x425faf('0x142')](function(){const _0x45aadb=_0x425faf;return db[_0x45aadb('0xa')][_0x45aadb('0x1a')]({'paused':0x0},{'where':{'UserId':_0x167a9f['id']}});})['then'](function(){const _0x1e4ac9=_0x425faf;return db[_0x1e4ac9('0x97')][_0x1e4ac9('0x86')]({'where':{'membername':_0x167a9f[_0x1e4ac9('0x2f')],'type':_0x1e4ac9('0xa5'),'exitAt':null}});})['then'](function(_0x2259dd){const _0x1f775a=_0x425faf,_0x1925cd=[];return _0x2259dd[_0x1f775a('0x14d')](function(_0x33714c){const _0x131857=_0x1f775a;_0x1925cd['push'](_0x33714c[_0x131857('0x1a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x131857('0x1f')}));}),Promise[_0x1f775a('0xf1')](_0x1925cd);})[_0x425faf('0x142')](function(){return _0x167a9f['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x3634fb('0x142')](respondWithResult(_0x497501,null))[_0x3634fb('0x6a')](handleError(_0x497501,null));},exports[_0x1d55f6('0x112')]=function(_0x18f6ef,_0x2e62e0){const _0x1f5038=_0x1d55f6;let _0x48229f={};const _0x12c771={};let _0x39d401,_0x349890;return db[_0x1f5038('0xdb')][_0x1f5038('0xb0')]({'where':{'id':_0x18f6ef[_0x1f5038('0x100')]['id']}})[_0x1f5038('0x142')](handleEntityNotFound(_0x2e62e0,null))[_0x1f5038('0x142')](function(_0xb68c77){const _0xccd120=_0x1f5038;if(_0xb68c77)return _0x39d401=_0xb68c77,_0x12c771[_0xccd120('0x53')]=_[_0xccd120('0x104')](db[_0xccd120('0x84')]['rawAttributes']),_0x12c771[_0xccd120('0x2')]=_['keys'](_0x18f6ef[_0xccd120('0x2')]),_0x12c771[_0xccd120('0x73')]=_[_0xccd120('0x66')](_0x12c771[_0xccd120('0x53')],_0x12c771[_0xccd120('0x2')]),_0x48229f[_0xccd120('0x63')]=_[_0xccd120('0x66')](_0x12c771['model'],qs[_0xccd120('0x5b')](_0x18f6ef[_0xccd120('0x2')][_0xccd120('0x5b')])),_0x48229f['attributes']=_0x48229f[_0xccd120('0x63')][_0xccd120('0x7')]?_0x48229f[_0xccd120('0x63')]:_0x12c771[_0xccd120('0x53')],_0x48229f[_0xccd120('0xb4')]=qs[_0xccd120('0xd3')](_0x18f6ef[_0xccd120('0x2')][_0xccd120('0xd3')]),_0x48229f[_0xccd120('0xff')]=qs['filters'](_[_0xccd120('0x8d')](_0x18f6ef[_0xccd120('0x2')],_0x12c771[_0xccd120('0x73')])),_0x18f6ef[_0xccd120('0x2')][_0xccd120('0x81')]&&(_0x48229f[_0xccd120('0xff')]=_[_0xccd120('0x20')](_0x48229f[_0xccd120('0xff')],{[Op['or']]:_[_0xccd120('0x12f')](_0x48229f[_0xccd120('0x63')],function(_0x2b8d5e){const _0x269b7c=_0xccd120,_0x1190ef={};return _0x1190ef[_0x2b8d5e]={[Op[_0x269b7c('0x65')]]:'%'+_0x18f6ef[_0x269b7c('0x2')][_0x269b7c('0x81')]+'%'},_0x1190ef;})})),_0x48229f=_['merge']({},_0x48229f,_0x18f6ef[_0xccd120('0xe4')]),_0x39d401[_0xccd120('0x112')](_0x48229f);})[_0x1f5038('0x142')](function(_0x20c413){const _0x2e1476=_0x1f5038;if(_0x20c413)return _0x349890=_0x20c413[_0x2e1476('0x7')],typeof _0x18f6ef[_0x2e1476('0x2')][_0x2e1476('0xa0')]==='undefined'&&(_0x48229f[_0x2e1476('0xee')]=qs['limit'](_0x18f6ef['query']['limit']),_0x48229f[_0x2e1476('0xc1')]=qs[_0x2e1476('0xc1')](_0x18f6ef[_0x2e1476('0x2')][_0x2e1476('0xc1')])),_0x39d401['getTeams'](_0x48229f);})[_0x1f5038('0x142')](function(_0x4fe2a0){if(_0x4fe2a0)return _0x4fe2a0?{'count':_0x349890,'rows':_0x4fe2a0}:null;})[_0x1f5038('0x142')](respondWithResult(_0x2e62e0,null))[_0x1f5038('0x6a')](handleError(_0x2e62e0,null));},exports[_0x1d55f6('0xa6')]=function(_0x1b412,_0xb072db){const _0x4565d7=_0x1d55f6;return db[_0x4565d7('0xdb')][_0x4565d7('0xb0')]({'where':{'id':_0x1b412['params']['id']}})[_0x4565d7('0x142')](handleEntityNotFound(_0xb072db,null))[_0x4565d7('0x142')](function(_0x362feb){const _0x4c20ec=_0x4565d7;if(_0x362feb){const _0x10e5fe=_0x362feb[_0x4c20ec('0x13d')]({'plain':!![]});return _0x362feb[_0x4c20ec('0xa6')](_0x1b412['body'][_0x4c20ec('0x13')],_[_0x4c20ec('0x12b')](_0x1b412[_0x4c20ec('0x42')],[_0x4c20ec('0x13'),'id'])||{})[_0x4c20ec('0x142')](function(){const _0x168059=_0x4c20ec;for(let _0x39591d=0x0;_0x39591d<_0x1b412['body'][_0x168059('0x13')][_0x168059('0x7')];_0x39591d++){let _0x16e781=[];db[_0x168059('0x84')][_0x168059('0xb0')]({'where':{'id':_0x1b412['body'][_0x168059('0x13')][_0x39591d]}})[_0x168059('0x142')](function(_0x462b6e){const _0x254818=_0x168059;return _0x16e781[_0x254818('0x43')](_0x462b6e[_0x254818('0x157')]()[_0x254818('0x142')](function(_0x1803ce){const _0x45b339=_0x254818;for(let _0x1e5e19=0x0;_0x1e5e19<_0x1803ce[_0x45b339('0x7')];_0x1e5e19++){_0x1803ce[_0x1e5e19]['setDataValue'](_0x45b339('0x98'),_0x45b339('0x37'));}return _0x1803ce;})),_0x16e781[_0x254818('0x43')](_0x462b6e[_0x254818('0x89')]()['then'](function(_0x2fc132){const _0x36ae57=_0x254818;for(let _0x2a9b69=0x0;_0x2a9b69<_0x2fc132[_0x36ae57('0x7')];_0x2a9b69++){_0x2fc132[_0x2a9b69][_0x36ae57('0x103')](_0x36ae57('0x98'),_0x36ae57('0x119'));}return _0x2fc132;})),_0x16e781[_0x254818('0x43')](_0x462b6e[_0x254818('0x126')]()[_0x254818('0x142')](function(_0x4bb8ef){const _0x1f668b=_0x254818;for(let _0x3bbdba=0x0;_0x3bbdba<_0x4bb8ef[_0x1f668b('0x7')];_0x3bbdba++){_0x4bb8ef[_0x3bbdba]['setDataValue']('channel',_0x1f668b('0x93'));}return _0x4bb8ef;})),_0x16e781[_0x254818('0x43')](_0x462b6e[_0x254818('0x85')]()[_0x254818('0x142')](function(_0x22176a){const _0x5af102=_0x254818;for(let _0x4f9b35=0x0;_0x4f9b35<_0x22176a[_0x5af102('0x7')];_0x4f9b35++){_0x22176a[_0x4f9b35]['setDataValue'](_0x5af102('0x98'),'Sms');}return _0x22176a;})),_0x16e781[_0x254818('0x43')](_0x462b6e[_0x254818('0x7a')]()[_0x254818('0x142')](function(_0x4e6ea9){const _0x404bb6=_0x254818;for(let _0x58cdea=0x0;_0x58cdea<_0x4e6ea9[_0x404bb6('0x7')];_0x58cdea++){_0x4e6ea9[_0x58cdea]['setDataValue'](_0x404bb6('0x98'),_0x404bb6('0xd5'));}return _0x4e6ea9;})),_0x16e781[_0x254818('0x43')](_0x462b6e[_0x254818('0x120')]()['then'](function(_0x51876c){const _0x2bb2c5=_0x254818;for(let _0xaf6cc2=0x0;_0xaf6cc2<_0x51876c[_0x2bb2c5('0x7')];_0xaf6cc2++){_0x51876c[_0xaf6cc2][_0x2bb2c5('0x103')](_0x2bb2c5('0x98'),_0x2bb2c5('0x18'));}return _0x51876c;})),_0x16e781['push'](_0x462b6e[_0x254818('0xce')]()[_0x254818('0x142')](function(_0x5c7142){const _0x48d693=_0x254818;for(let _0x17cd3a=0x0;_0x17cd3a<_0x5c7142[_0x48d693('0x7')];_0x17cd3a++){_0x5c7142[_0x17cd3a]['setDataValue'](_0x48d693('0x98'),_0x48d693('0xcb'));}return _0x5c7142;})),Promise['all'](_0x16e781);})[_0x168059('0x142')](function(_0x458e5c){const _0x1577b3=_0x168059,_0x2cb46a=_[_0x1577b3('0x14')](_0x458e5c);return _0x16e781=[],db[_0x1577b3('0x52')][_0x1577b3('0x47')](function(_0x560b4b){const _0x1aa9a0=_0x1577b3;for(let _0x3cdcf3=0x0;_0x3cdcf3<_0x2cb46a[_0x1aa9a0('0x7')];_0x3cdcf3++){_0x16e781[_0x1aa9a0('0x43')](_0x2cb46a[_0x3cdcf3][_0x1aa9a0('0x4a')](_0x10e5fe['id']),{'transaction':_0x560b4b});}return Promise[_0x1aa9a0('0xf1')](_0x16e781)['then'](function(){const _0x1fcb64=_0x1aa9a0;if(!_0x10e5fe[_0x1fcb64('0xc7')])return;const _0x39b5f4=_[_0x1fcb64('0x81')](_0x2cb46a,function(_0x52dce2){const _0x448d0a=_0x1fcb64;return _0x52dce2[_0x448d0a('0x3d')](_0x448d0a('0x98'))===_0x448d0a('0x37');});return Promise[_0x1fcb64('0xf1')](_0x39b5f4[_0x1fcb64('0x12f')](_0x48bf8f=>{const _0x3c1cad=_0x1fcb64;return db['UserVoiceQueueRt']['upsert']({'membername':_0x10e5fe[_0x3c1cad('0x2f')],'UserId':_0x10e5fe['id'],'queue_name':_0x48bf8f['name'],'VoiceQueueId':_0x48bf8f['id'],'interface':_[_0x3c1cad('0xb5')](_0x10e5fe[_0x3c1cad('0x134')])?util['format']('SIP/%s',_0x10e5fe['name']):_0x10e5fe[_0x3c1cad('0x134')],'paused':_0x10e5fe[_0x3c1cad('0xfd')]||![],'penalty':_0x10e5fe[_0x3c1cad('0x60')]},{'transaction':_0x560b4b});}));})[_0x1aa9a0('0x142')](function(){const _0x1fb730=_0x1aa9a0;for(let _0x5a8d35=0x0;_0x5a8d35<_0x2cb46a['length'];_0x5a8d35++){const _0x48820a=_0x2cb46a[_0x5a8d35][_0x1fb730('0x3d')](_0x1fb730('0x98')),_0x2f132a=_0x48820a+_0x1fb730('0x6');socket[_0x1fb730('0xf6')]('user'+_0x48820a+_0x1fb730('0x56'),{'UserId':_0x10e5fe['id'],[_0x2f132a]:_0x2cb46a[_0x5a8d35]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xb072db,null))[_0x4565d7('0x6a')](handleError(_0xb072db,null));},exports['removeTeams']=function(_0x188a32,_0x23a6c6){const _0x31d7f0=_0x1d55f6;return db[_0x31d7f0('0xdb')][_0x31d7f0('0xb0')]({'where':{'id':_0x188a32[_0x31d7f0('0x100')]['id']}})[_0x31d7f0('0x142')](handleEntityNotFound(_0x23a6c6,null))['then'](function(_0x1ff5c8){const _0x5975ae=_0x31d7f0;if(_0x1ff5c8){const _0x56af01=_0x1ff5c8['get']({'plain':!![]}),_0x223ef8=_0x188a32[_0x5975ae('0x2')][_0x5975ae('0x13')];return _0x1ff5c8[_0x5975ae('0xb2')](_0x223ef8)[_0x5975ae('0x142')](function(){const _0x3ada0e=_0x5975ae;for(let _0x2cd3d2=0x0;_0x2cd3d2<_0x223ef8[_0x3ada0e('0x7')];_0x2cd3d2++){let _0x4ff03a=[];db['Team']['findOne']({'where':{'id':_0x223ef8[_0x2cd3d2]}})[_0x3ada0e('0x142')](function(_0x355153){const _0x4bfc61=_0x3ada0e;return _0x4ff03a['push'](_0x355153[_0x4bfc61('0x157')]()[_0x4bfc61('0x142')](function(_0x1008b3){const _0x247289=_0x4bfc61;for(let _0x160bf7=0x0;_0x160bf7<_0x1008b3['length'];_0x160bf7++){_0x1008b3[_0x160bf7][_0x247289('0x103')](_0x247289('0x98'),_0x247289('0x37'));}return _0x1008b3;})),_0x4ff03a[_0x4bfc61('0x43')](_0x355153['getChatQueues']()[_0x4bfc61('0x142')](function(_0x580e97){const _0x3bb755=_0x4bfc61;for(let _0x1d5be0=0x0;_0x1d5be0<_0x580e97['length'];_0x1d5be0++){_0x580e97[_0x1d5be0][_0x3bb755('0x103')](_0x3bb755('0x98'),_0x3bb755('0x119'));}return _0x580e97;})),_0x4ff03a['push'](_0x355153[_0x4bfc61('0x126')]()[_0x4bfc61('0x142')](function(_0x1cc510){const _0x542bb3=_0x4bfc61;for(let _0xed5b2=0x0;_0xed5b2<_0x1cc510['length'];_0xed5b2++){_0x1cc510[_0xed5b2][_0x542bb3('0x103')](_0x542bb3('0x98'),_0x542bb3('0x93'));}return _0x1cc510;})),_0x4ff03a[_0x4bfc61('0x43')](_0x355153[_0x4bfc61('0x85')]()[_0x4bfc61('0x142')](function(_0x51d193){const _0x5cc69e=_0x4bfc61;for(let _0x33eb8a=0x0;_0x33eb8a<_0x51d193[_0x5cc69e('0x7')];_0x33eb8a++){_0x51d193[_0x33eb8a][_0x5cc69e('0x103')](_0x5cc69e('0x98'),'Sms');}return _0x51d193;})),_0x4ff03a[_0x4bfc61('0x43')](_0x355153[_0x4bfc61('0x7a')]()['then'](function(_0x2bc811){const _0x40cee9=_0x4bfc61;for(let _0x3cba78=0x0;_0x3cba78<_0x2bc811[_0x40cee9('0x7')];_0x3cba78++){_0x2bc811[_0x3cba78][_0x40cee9('0x103')](_0x40cee9('0x98'),_0x40cee9('0xd5'));}return _0x2bc811;})),_0x4ff03a[_0x4bfc61('0x43')](_0x355153['getFaxQueues']()[_0x4bfc61('0x142')](function(_0x1e2c19){const _0x575aeb=_0x4bfc61;for(let _0x44a7ec=0x0;_0x44a7ec<_0x1e2c19[_0x575aeb('0x7')];_0x44a7ec++){_0x1e2c19[_0x44a7ec][_0x575aeb('0x103')](_0x575aeb('0x98'),_0x575aeb('0x18'));}return _0x1e2c19;})),_0x4ff03a[_0x4bfc61('0x43')](_0x355153[_0x4bfc61('0xce')]()['then'](function(_0x5c92f7){const _0x20463d=_0x4bfc61;for(let _0x41341f=0x0;_0x41341f<_0x5c92f7[_0x20463d('0x7')];_0x41341f++){_0x5c92f7[_0x41341f][_0x20463d('0x103')](_0x20463d('0x98'),_0x20463d('0xcb'));}return _0x5c92f7;})),Promise[_0x4bfc61('0xf1')](_0x4ff03a);})[_0x3ada0e('0x142')](function(_0x251c99){const _0x11a7dc=_0x3ada0e,_0x35ea89=_['flatten'](_0x251c99);return _0x4ff03a=[],db[_0x11a7dc('0x52')]['transaction'](function(_0xbd864b){const _0x2bbf7f=_0x11a7dc;for(let _0x40b2a5=0x0;_0x40b2a5<_0x35ea89[_0x2bbf7f('0x7')];_0x40b2a5++){_0x4ff03a[_0x2bbf7f('0x43')](_0x35ea89[_0x40b2a5][_0x2bbf7f('0x12')](_0x56af01['id']),{'transaction':_0xbd864b});}return Promise[_0x2bbf7f('0xf1')](_0x4ff03a)['then'](function(){const _0x48ec1e=_0x2bbf7f;if(!_0x56af01[_0x48ec1e('0xc7')])return;const _0x49330e=_['filter'](_0x35ea89,function(_0x3403c7){const _0x540f0f=_0x48ec1e;return _0x3403c7['getDataValue'](_0x540f0f('0x98'))===_0x540f0f('0x37');});return Promise['all'](_0x49330e[_0x48ec1e('0x12f')](_0x11432b=>{const _0xebd8f4=_0x48ec1e;return db[_0xebd8f4('0xa')]['destroy']({'where':{'VoiceQueueId':_0x11432b['id'],'UserId':_0x56af01['id']},'transaction':_0xbd864b});}));})['then'](function(){const _0x3641ef=_0x2bbf7f;for(let _0x4748d1=0x0;_0x4748d1<_0x35ea89[_0x3641ef('0x7')];_0x4748d1++){const _0x3b50a4=_0x35ea89[_0x4748d1][_0x3641ef('0x3d')](_0x3641ef('0x98')),_0x3969b5=_0x3b50a4+'QueueId';socket['emit']('user'+_0x3b50a4+_0x3641ef('0x12a'),{'UserId':_0x56af01['id'],[_0x3969b5]:_0x35ea89[_0x4748d1]['id']});}});});});}});}})[_0x31d7f0('0x142')](respondWithStatusCode(_0x23a6c6,null))['catch'](handleError(_0x23a6c6,null));},exports['getLists']=function(_0x4b0a8f,_0x335bd3){const _0x924600=_0x1d55f6;let _0x5608e7={};const _0x30508d={};let _0x1858f0,_0xd4aaad;return db[_0x924600('0xdb')][_0x924600('0xb0')]({'where':{'id':_0x4b0a8f[_0x924600('0x100')]['id']}})['then'](handleEntityNotFound(_0x335bd3,null))[_0x924600('0x142')](function(_0x57b1e2){const _0xe67e91=_0x924600;if(_0x57b1e2)return _0x1858f0=_0x57b1e2,_0x30508d[_0xe67e91('0x53')]=_[_0xe67e91('0x104')](db[_0xe67e91('0x28')]['rawAttributes']),_0x30508d[_0xe67e91('0x2')]=_['keys'](_0x4b0a8f[_0xe67e91('0x2')]),_0x30508d[_0xe67e91('0x73')]=_['intersection'](_0x30508d[_0xe67e91('0x53')],_0x30508d[_0xe67e91('0x2')]),_0x5608e7[_0xe67e91('0x63')]=_['intersection'](_0x30508d[_0xe67e91('0x53')],qs[_0xe67e91('0x5b')](_0x4b0a8f[_0xe67e91('0x2')]['fields'])),_0x5608e7[_0xe67e91('0x63')]=_0x5608e7[_0xe67e91('0x63')][_0xe67e91('0x7')]?_0x5608e7[_0xe67e91('0x63')]:_0x30508d[_0xe67e91('0x53')],_0x5608e7[_0xe67e91('0xb4')]=qs[_0xe67e91('0xd3')](_0x4b0a8f[_0xe67e91('0x2')][_0xe67e91('0xd3')]),_0x5608e7[_0xe67e91('0xff')]=qs[_0xe67e91('0x73')](_[_0xe67e91('0x8d')](_0x4b0a8f[_0xe67e91('0x2')],_0x30508d[_0xe67e91('0x73')])),_0x4b0a8f[_0xe67e91('0x2')][_0xe67e91('0x81')]&&(_0x5608e7['where']=_[_0xe67e91('0x20')](_0x5608e7[_0xe67e91('0xff')],{[Op['or']]:_[_0xe67e91('0x12f')](_0x5608e7[_0xe67e91('0x63')],function(_0x2bc64d){const _0x3d61b3=_0xe67e91,_0x5ce35f={};return _0x5ce35f[_0x2bc64d]={[Op[_0x3d61b3('0x65')]]:'%'+_0x4b0a8f['query']['filter']+'%'},_0x5ce35f;})})),_0x5608e7=_[_0xe67e91('0x20')]({},_0x5608e7,_0x4b0a8f[_0xe67e91('0xe4')]),_0x1858f0[_0xe67e91('0x3f')](_0x5608e7);})[_0x924600('0x142')](function(_0x250233){const _0x583497=_0x924600;if(_0x250233)return _0xd4aaad=_0x250233['length'],typeof _0x4b0a8f[_0x583497('0x2')][_0x583497('0xa0')]==='undefined'&&(_0x5608e7[_0x583497('0xee')]=qs[_0x583497('0xee')](_0x4b0a8f[_0x583497('0x2')][_0x583497('0xee')]),_0x5608e7['offset']=qs[_0x583497('0xc1')](_0x4b0a8f[_0x583497('0x2')][_0x583497('0xc1')])),_0x1858f0[_0x583497('0x3f')](_0x5608e7);})[_0x924600('0x142')](function(_0x49d106){if(_0x49d106)return _0x49d106?{'count':_0xd4aaad,'rows':_0x49d106}:null;})[_0x924600('0x142')](respondWithResult(_0x335bd3,null))[_0x924600('0x6a')](handleError(_0x335bd3,null));},exports['getAgents']=function(_0x2cf368,_0x546b12){const _0x20095e=_0x1d55f6;let _0x579af1={};const _0x407e9a={};let _0x1d875e;return db[_0x20095e('0xdb')][_0x20095e('0xb0')]({'where':{'id':_0x2cf368['params']['id']}})['then'](handleEntityNotFound(_0x546b12,null))['then'](function(_0x17c522){const _0x5d9227=_0x20095e;if(_0x17c522)return _0x1d875e=_0x17c522,_0x407e9a[_0x5d9227('0x53')]=_[_0x5d9227('0x104')](db[_0x5d9227('0xdb')]['rawAttributes']),_0x407e9a[_0x5d9227('0x2')]=_[_0x5d9227('0x104')](_0x2cf368[_0x5d9227('0x2')]),_0x407e9a[_0x5d9227('0x73')]=_[_0x5d9227('0x66')](_0x407e9a['model'],_0x407e9a[_0x5d9227('0x2')]),_0x579af1[_0x5d9227('0x63')]=_[_0x5d9227('0x66')](_0x407e9a[_0x5d9227('0x53')],qs[_0x5d9227('0x5b')](_0x2cf368[_0x5d9227('0x2')][_0x5d9227('0x5b')])),_0x579af1[_0x5d9227('0x63')]=_0x579af1[_0x5d9227('0x63')][_0x5d9227('0x7')]?_0x579af1['attributes']:_0x407e9a[_0x5d9227('0x53')],_0x579af1['order']=qs[_0x5d9227('0xd3')](_0x2cf368[_0x5d9227('0x2')]['sort']),_0x579af1[_0x5d9227('0xff')]=qs[_0x5d9227('0x73')](_[_0x5d9227('0x8d')](_0x2cf368['query'],_0x407e9a[_0x5d9227('0x73')])),_0x2cf368[_0x5d9227('0x2')][_0x5d9227('0x81')]&&(_0x579af1[_0x5d9227('0xff')]=_[_0x5d9227('0x20')](_0x579af1[_0x5d9227('0xff')],{[Op['or']]:_['map'](_0x579af1[_0x5d9227('0x63')],function(_0x44a4c6){const _0x274fbd=_0x5d9227,_0x524c1f={};return _0x524c1f[_0x44a4c6]={[Op[_0x274fbd('0x65')]]:'%'+_0x2cf368[_0x274fbd('0x2')][_0x274fbd('0x81')]+'%'},_0x524c1f;})})),_0x579af1['model']=db[_0x5d9227('0xdb')],_0x579af1['as']='Agents',_0x579af1=_[_0x5d9227('0x20')]({},_0x579af1,_0x2cf368[_0x5d9227('0xe4')]),_0x1d875e[_0x5d9227('0x157')]({'include':[_0x579af1]});})['then'](function(_0x390098){const _0x4b0d86=_0x20095e;if(_0x390098){let _0x25cacb={};const _0x1157b5=[];for(let _0x525fbd=0x0;_0x525fbd<_0x390098[_0x4b0d86('0x7')];_0x525fbd+=0x1){for(let _0x289621=0x0,_0x29780f;_0x289621<_0x390098[_0x525fbd][_0x4b0d86('0x2d')][_0x4b0d86('0x7')];_0x289621+=0x1){_0x29780f=_0x390098[_0x525fbd][_0x4b0d86('0x2d')][_0x289621][_0x4b0d86('0x13d')]({'plain':!![]}),_0x25cacb[_0x29780f['id']]=_0x29780f;}}_0x25cacb=_['values'](_0x25cacb);for(let _0x2a47da=qs['offset'](_0x2cf368[_0x4b0d86('0x2')][_0x4b0d86('0xc1')]);_0x2a47da<_0x25cacb[_0x4b0d86('0x7')]&&_0x1157b5[_0x4b0d86('0x7')]<qs[_0x4b0d86('0xee')](_0x2cf368[_0x4b0d86('0x2')][_0x4b0d86('0xee')]);_0x2a47da+=0x1){_0x25cacb[_0x2a47da]&&_0x1157b5[_0x4b0d86('0x43')](_0x25cacb[_0x2a47da]);}return{'count':_0x25cacb[_0x4b0d86('0x7')],'rows':_0x1157b5};}})[_0x20095e('0x142')](respondWithResult(_0x546b12,null))[_0x20095e('0x6a')](handleError(_0x546b12,null));},exports[_0x1d55f6('0xbf')]=function(_0x3b478c,_0x5d7164){const _0x2535a3=_0x1d55f6;if(_0x3b478c[_0x2535a3('0x5a')]['id']==_0x3b478c['params']['id'])return _0x5d7164[_0x2535a3('0x10a')](0x1f4)[_0x2535a3('0x33')]({'message':_0x2535a3('0xac')});return db[_0x2535a3('0xdb')][_0x2535a3('0xb0')]({'where':{'id':_0x3b478c[_0x2535a3('0x100')]['id']}})['then'](handleEntityNotFound(_0x5d7164,null))[_0x2535a3('0x142')](removeEntity(_0x5d7164,null))[_0x2535a3('0x6a')](handleError(_0x5d7164,null));},exports[_0x1d55f6('0x2e')]=function(_0x5407a8,_0x54ecac){const _0x10c9fb=_0x1d55f6;return db['User'][_0x10c9fb('0xb0')]({'where':{'id':_0x5407a8[_0x10c9fb('0x100')]['id']}})['then'](handleEntityNotFound(_0x54ecac,null))['then'](function(_0x11d4e1){const _0x3c8e62=_0x10c9fb;if(_0x11d4e1)return _0x11d4e1[_0x3c8e62('0x2e')](_0x5407a8[_0x3c8e62('0x42')][_0x3c8e62('0x13')],{'through':_[_0x3c8e62('0x12b')](_0x5407a8[_0x3c8e62('0x42')],[_0x3c8e62('0x13'),'id'])})[_0x3c8e62('0x142')](function(){const _0x3f65a1=_0x3c8e62;for(let _0x5747c2=0x0;_0x5747c2<_0x5407a8[_0x3f65a1('0x42')][_0x3f65a1('0x13')][_0x3f65a1('0x7')];_0x5747c2+=0x1){socket[_0x3f65a1('0xf6')]('user_has_chat_interactions:save',{'ChatInteractionId':Number(_0x5407a8['body'][_0x3f65a1('0x13')][_0x5747c2]),'UserId':Number(_0x5407a8['params']['id'])});}return _0x5407a8['body'][_0x3f65a1('0x13')];});})[_0x10c9fb('0x142')](respondWithResult(_0x54ecac,null))[_0x10c9fb('0x6a')](handleError(_0x54ecac,null));},exports['removeChatInteractions']=function(_0x409305,_0x14cfc7){const _0x592983=_0x1d55f6;return db[_0x592983('0xdb')][_0x592983('0xb0')]({'where':{'id':_0x409305['params']['id']}})[_0x592983('0x142')](handleEntityNotFound(_0x14cfc7,null))['then'](function(_0x5c15af){const _0x279b34=_0x592983;if(_0x5c15af)return _0x5c15af['removeChatInteractions'](_0x409305['query'][_0x279b34('0x13')])[_0x279b34('0x142')](function(){const _0x36c056=_0x279b34;if(_[_0x36c056('0x9d')](_0x409305[_0x36c056('0x2')][_0x36c056('0x13')]))for(let _0x141386=0x0;_0x141386<_0x409305['query'][_0x36c056('0x13')][_0x36c056('0x7')];_0x141386+=0x1){socket[_0x36c056('0xf6')](_0x36c056('0x110'),{'ChatInteractionId':Number(_0x409305[_0x36c056('0x2')][_0x36c056('0x13')][_0x141386]),'UserId':Number(_0x409305[_0x36c056('0x100')]['id'])});}else socket['emit'](_0x36c056('0x110'),{'ChatInteractionId':Number(_0x409305[_0x36c056('0x2')][_0x36c056('0x13')]),'UserId':Number(_0x409305[_0x36c056('0x100')]['id'])});});})['then'](respondWithStatusCode(_0x14cfc7,null))[_0x592983('0x6a')](handleError(_0x14cfc7,null));},exports[_0x1d55f6('0xef')]=function(_0x55f71e,_0x1562ce){const _0x5ddb2d=_0x1d55f6;return db[_0x5ddb2d('0xdb')][_0x5ddb2d('0xb0')]({'where':{'id':_0x55f71e[_0x5ddb2d('0x100')]['id']}})['then'](handleEntityNotFound(_0x1562ce,null))['then'](function(_0x9c42ab){const _0x2a5336=_0x5ddb2d;if(_0x9c42ab)return _0x9c42ab[_0x2a5336('0xef')](_0x55f71e[_0x2a5336('0x42')][_0x2a5336('0x13')],{'through':_[_0x2a5336('0x12b')](_0x55f71e['body'],['ids','id'])})[_0x2a5336('0x142')](function(){const _0x2bd077=_0x2a5336;for(let _0x353f5f=0x0;_0x353f5f<_0x55f71e[_0x2bd077('0x42')][_0x2bd077('0x13')]['length'];_0x353f5f+=0x1){socket['emit']('user_has_mail_interactions:save',{'MailInteractionId':Number(_0x55f71e[_0x2bd077('0x42')][_0x2bd077('0x13')][_0x353f5f]),'UserId':Number(_0x55f71e[_0x2bd077('0x100')]['id'])});}return _0x55f71e[_0x2bd077('0x42')][_0x2bd077('0x13')];});})[_0x5ddb2d('0x142')](respondWithResult(_0x1562ce,null))[_0x5ddb2d('0x6a')](handleError(_0x1562ce,null));},exports[_0x1d55f6('0x115')]=function(_0x2e0f24,_0x3fd3b3){const _0x50add1=_0x1d55f6;return db['User'][_0x50add1('0xb0')]({'where':{'id':_0x2e0f24[_0x50add1('0x100')]['id']}})[_0x50add1('0x142')](handleEntityNotFound(_0x3fd3b3,null))[_0x50add1('0x142')](function(_0x515328){const _0x4c5cd1=_0x50add1;if(_0x515328)return _0x515328['removeMailInteractions'](_0x2e0f24[_0x4c5cd1('0x2')]['ids'])[_0x4c5cd1('0x142')](function(){const _0x2029c5=_0x4c5cd1;if(_[_0x2029c5('0x9d')](_0x2e0f24['query'][_0x2029c5('0x13')]))for(let _0xbe9ad7=0x0;_0xbe9ad7<_0x2e0f24[_0x2029c5('0x2')][_0x2029c5('0x13')][_0x2029c5('0x7')];_0xbe9ad7+=0x1){socket[_0x2029c5('0xf6')](_0x2029c5('0xd7'),{'MailInteractionId':Number(_0x2e0f24[_0x2029c5('0x2')][_0x2029c5('0x13')][_0xbe9ad7]),'UserId':Number(_0x2e0f24[_0x2029c5('0x100')]['id'])});}else socket[_0x2029c5('0xf6')](_0x2029c5('0xd7'),{'MailInteractionId':Number(_0x2e0f24[_0x2029c5('0x2')][_0x2029c5('0x13')]),'UserId':Number(_0x2e0f24['params']['id'])});});})[_0x50add1('0x142')](respondWithStatusCode(_0x3fd3b3,null))[_0x50add1('0x6a')](handleError(_0x3fd3b3,null));},exports[_0x1d55f6('0x57')]=function(_0x3002a2,_0x371e01){const _0x54388d=_0x1d55f6;return db[_0x54388d('0xdb')]['findOne']({'where':{'id':_0x3002a2[_0x54388d('0x100')]['id']}})[_0x54388d('0x142')](handleEntityNotFound(_0x371e01,null))[_0x54388d('0x142')](function(_0x1a6971){const _0x385d03=_0x54388d;if(_0x1a6971)return _0x1a6971[_0x385d03('0x57')](_0x3002a2[_0x385d03('0x42')][_0x385d03('0x13')],{'through':_['omit'](_0x3002a2[_0x385d03('0x42')],[_0x385d03('0x13'),'id'])})['then'](function(){const _0x540298=_0x385d03;for(let _0x223565=0x0;_0x223565<_0x3002a2['body'][_0x540298('0x13')][_0x540298('0x7')];_0x223565+=0x1){socket[_0x540298('0xf6')](_0x540298('0x4e'),{'FaxInteractionId':Number(_0x3002a2['body']['ids'][_0x223565]),'UserId':Number(_0x3002a2[_0x540298('0x100')]['id'])});}return _0x3002a2[_0x540298('0x42')]['ids'];});})[_0x54388d('0x142')](respondWithResult(_0x371e01,null))[_0x54388d('0x6a')](handleError(_0x371e01,null));},exports[_0x1d55f6('0xb6')]=function(_0x333d9f,_0x37288b){const _0x13bb43=_0x1d55f6;return db[_0x13bb43('0xdb')][_0x13bb43('0xb0')]({'where':{'id':_0x333d9f[_0x13bb43('0x100')]['id']}})[_0x13bb43('0x142')](handleEntityNotFound(_0x37288b,null))[_0x13bb43('0x142')](function(_0x4d9321){const _0x3da538=_0x13bb43;if(_0x4d9321)return _0x4d9321[_0x3da538('0xb6')](_0x333d9f[_0x3da538('0x2')][_0x3da538('0x13')])[_0x3da538('0x142')](function(){const _0x6ea69b=_0x3da538;if(_[_0x6ea69b('0x9d')](_0x333d9f[_0x6ea69b('0x2')][_0x6ea69b('0x13')]))for(let _0x48b5c0=0x0;_0x48b5c0<_0x333d9f[_0x6ea69b('0x2')][_0x6ea69b('0x13')]['length'];_0x48b5c0+=0x1){socket[_0x6ea69b('0xf6')](_0x6ea69b('0x21'),{'FaxInteractionId':Number(_0x333d9f['query'][_0x6ea69b('0x13')][_0x48b5c0]),'UserId':Number(_0x333d9f[_0x6ea69b('0x100')]['id'])});}else socket[_0x6ea69b('0xf6')](_0x6ea69b('0x21'),{'FaxInteractionId':Number(_0x333d9f[_0x6ea69b('0x2')]['ids']),'UserId':Number(_0x333d9f[_0x6ea69b('0x100')]['id'])});});})[_0x13bb43('0x142')](respondWithStatusCode(_0x37288b,null))[_0x13bb43('0x6a')](handleError(_0x37288b,null));},exports[_0x1d55f6('0x3c')]=function(_0x1376ac,_0x1d1004){const _0x4db600=_0x1d55f6;return db[_0x4db600('0xdb')]['findOne']({'where':{'id':_0x1376ac['params']['id']}})['then'](handleEntityNotFound(_0x1d1004,null))[_0x4db600('0x142')](function(_0x1d0972){const _0x57d098=_0x4db600;if(_0x1d0972)return _0x1d0972[_0x57d098('0x3c')](_0x1376ac['body'][_0x57d098('0x13')],{'through':_[_0x57d098('0x12b')](_0x1376ac['body'],['ids','id'])})['then'](function(){const _0x45b325=_0x57d098;for(let _0x10fc96=0x0;_0x10fc96<_0x1376ac[_0x45b325('0x42')][_0x45b325('0x13')][_0x45b325('0x7')];_0x10fc96+=0x1){socket['emit'](_0x45b325('0x146'),{'SmsInteractionId':Number(_0x1376ac[_0x45b325('0x42')]['ids'][_0x10fc96]),'UserId':Number(_0x1376ac[_0x45b325('0x100')]['id'])});}return _0x1376ac[_0x45b325('0x42')][_0x45b325('0x13')];});})[_0x4db600('0x142')](respondWithResult(_0x1d1004,null))[_0x4db600('0x6a')](handleError(_0x1d1004,null));},exports[_0x1d55f6('0x87')]=function(_0x5152ec,_0x2cf53d){const _0xee26ba=_0x1d55f6;return db[_0xee26ba('0xdb')][_0xee26ba('0xb0')]({'where':{'id':_0x5152ec['params']['id']}})[_0xee26ba('0x142')](handleEntityNotFound(_0x2cf53d,null))['then'](function(_0x29dae2){const _0x322627=_0xee26ba;if(_0x29dae2)return _0x29dae2[_0x322627('0x87')](_0x5152ec['query'][_0x322627('0x13')])[_0x322627('0x142')](function(){const _0x236bb2=_0x322627;if(_[_0x236bb2('0x9d')](_0x5152ec[_0x236bb2('0x2')][_0x236bb2('0x13')]))for(let _0x4e97bc=0x0;_0x4e97bc<_0x5152ec['query'][_0x236bb2('0x13')]['length'];_0x4e97bc+=0x1){socket['emit'](_0x236bb2('0x99'),{'SmsInteractionId':Number(_0x5152ec[_0x236bb2('0x2')][_0x236bb2('0x13')][_0x4e97bc]),'UserId':Number(_0x5152ec['params']['id'])});}else socket[_0x236bb2('0xf6')](_0x236bb2('0x99'),{'SmsInteractionId':Number(_0x5152ec[_0x236bb2('0x2')][_0x236bb2('0x13')]),'UserId':Number(_0x5152ec[_0x236bb2('0x100')]['id'])});});})[_0xee26ba('0x142')](respondWithStatusCode(_0x2cf53d,null))['catch'](handleError(_0x2cf53d,null));},exports[_0x1d55f6('0x101')]=function(_0x363507,_0xb167a7){const _0x360d1f=_0x1d55f6;return db['User'][_0x360d1f('0xb0')]({'where':{'id':_0x363507[_0x360d1f('0x100')]['id']}})['then'](handleEntityNotFound(_0xb167a7,null))[_0x360d1f('0x142')](function(_0x1b2cb6){const _0x3e1fe7=_0x360d1f;if(_0x1b2cb6)return _0x1b2cb6[_0x3e1fe7('0x101')](_0x363507['body'][_0x3e1fe7('0x13')],{'through':_[_0x3e1fe7('0x12b')](_0x363507[_0x3e1fe7('0x42')],[_0x3e1fe7('0x13'),'id'])})[_0x3e1fe7('0x142')](function(){const _0x22dfb6=_0x3e1fe7;for(let _0x533b71=0x0;_0x533b71<_0x363507[_0x22dfb6('0x42')][_0x22dfb6('0x13')][_0x22dfb6('0x7')];_0x533b71+=0x1){socket[_0x22dfb6('0xf6')](_0x22dfb6('0xeb'),{'OpenchannelInteractionId':Number(_0x363507[_0x22dfb6('0x42')][_0x22dfb6('0x13')][_0x533b71]),'UserId':Number(_0x363507[_0x22dfb6('0x100')]['id'])});}return _0x363507['body'][_0x22dfb6('0x13')];});})[_0x360d1f('0x142')](respondWithResult(_0xb167a7,null))['catch'](handleError(_0xb167a7,null));},exports[_0x1d55f6('0xd9')]=function(_0x6adc16,_0x483784){const _0x32a775=_0x1d55f6;return db[_0x32a775('0xdb')][_0x32a775('0xb0')]({'where':{'id':_0x6adc16['params']['id']}})['then'](handleEntityNotFound(_0x483784,null))['then'](function(_0x621d6d){const _0x311c0d=_0x32a775;if(_0x621d6d)return _0x621d6d[_0x311c0d('0xd9')](_0x6adc16[_0x311c0d('0x2')][_0x311c0d('0x13')])[_0x311c0d('0x142')](function(){const _0x35589d=_0x311c0d;if(_[_0x35589d('0x9d')](_0x6adc16[_0x35589d('0x2')][_0x35589d('0x13')]))for(let _0x26a385=0x0;_0x26a385<_0x6adc16[_0x35589d('0x2')][_0x35589d('0x13')][_0x35589d('0x7')];_0x26a385+=0x1){socket[_0x35589d('0xf6')](_0x35589d('0x1e'),{'OpenchannelInteractionId':Number(_0x6adc16[_0x35589d('0x2')][_0x35589d('0x13')][_0x26a385]),'UserId':Number(_0x6adc16[_0x35589d('0x100')]['id'])});}else socket[_0x35589d('0xf6')](_0x35589d('0x1e'),{'OpenchannelInteractionId':Number(_0x6adc16[_0x35589d('0x2')]['ids']),'UserId':Number(_0x6adc16[_0x35589d('0x100')]['id'])});});})[_0x32a775('0x142')](respondWithStatusCode(_0x483784,null))['catch'](handleError(_0x483784,null));},exports[_0x1d55f6('0x4d')]=function(_0x3f332f,_0x558aa4){const _0x401c07=_0x1d55f6;return db['User']['findOne']({'where':{'id':_0x3f332f[_0x401c07('0x100')]['id']}})['then'](handleEntityNotFound(_0x558aa4,null))['then'](function(_0x57dba4){const _0x25dd25=_0x401c07;if(_0x57dba4)return _0x57dba4[_0x25dd25('0x4d')](_0x3f332f[_0x25dd25('0x42')][_0x25dd25('0x13')],{'through':_[_0x25dd25('0x12b')](_0x3f332f[_0x25dd25('0x42')],['ids','id'])})[_0x25dd25('0x142')](function(){const _0x5d57bc=_0x25dd25;for(let _0xf019af=0x0;_0xf019af<_0x3f332f[_0x5d57bc('0x42')][_0x5d57bc('0x13')][_0x5d57bc('0x7')];_0xf019af+=0x1){socket[_0x5d57bc('0xf6')](_0x5d57bc('0xf3'),{'WhatsappInteractionId':Number(_0x3f332f[_0x5d57bc('0x42')][_0x5d57bc('0x13')][_0xf019af]),'UserId':Number(_0x3f332f[_0x5d57bc('0x100')]['id'])});}return _0x3f332f[_0x5d57bc('0x42')][_0x5d57bc('0x13')];});})[_0x401c07('0x142')](respondWithResult(_0x558aa4,null))[_0x401c07('0x6a')](handleError(_0x558aa4,null));},exports['removeWhatsappInteractions']=function(_0x1897a5,_0x272b7c){const _0x1ece6a=_0x1d55f6;return db[_0x1ece6a('0xdb')]['findOne']({'where':{'id':_0x1897a5[_0x1ece6a('0x100')]['id']}})['then'](handleEntityNotFound(_0x272b7c,null))[_0x1ece6a('0x142')](function(_0x30a927){const _0x18f739=_0x1ece6a;if(_0x30a927)return _0x30a927['removeWhatsappInteractions'](_0x1897a5[_0x18f739('0x2')][_0x18f739('0x13')]);})[_0x1ece6a('0x142')](respondWithStatusCode(_0x272b7c,null))['catch'](handleError(_0x272b7c,null));},exports[_0x1d55f6('0xa4')]=function(_0x2bbdf8,_0x4751ef){const _0x170543=_0x1d55f6;let _0x73a75b={};const _0x1de35f={};let _0x2f36c3,_0x5d90dd;return db['User']['findOne']({'where':{'id':_0x2bbdf8['params']['id']}})[_0x170543('0x142')](handleEntityNotFound(_0x4751ef,null))[_0x170543('0x142')](function(_0x373765){const _0x4a58cc=_0x170543;if(_0x373765)return _0x2f36c3=_0x373765,_0x1de35f[_0x4a58cc('0x53')]=_['keys'](db['VoicePrefix'][_0x4a58cc('0xd4')]),_0x1de35f['query']=_[_0x4a58cc('0x104')](_0x2bbdf8[_0x4a58cc('0x2')]),_0x1de35f[_0x4a58cc('0x73')]=_[_0x4a58cc('0x66')](_0x1de35f['model'],_0x1de35f['query']),_0x73a75b[_0x4a58cc('0x63')]=_[_0x4a58cc('0x66')](_0x1de35f[_0x4a58cc('0x53')],qs[_0x4a58cc('0x5b')](_0x2bbdf8[_0x4a58cc('0x2')]['fields'])),_0x73a75b[_0x4a58cc('0x63')]=_0x73a75b[_0x4a58cc('0x63')][_0x4a58cc('0x7')]?_0x73a75b['attributes']:_0x1de35f[_0x4a58cc('0x53')],_0x73a75b[_0x4a58cc('0xb4')]=qs[_0x4a58cc('0xd3')](_0x2bbdf8['query'][_0x4a58cc('0xd3')]),_0x73a75b[_0x4a58cc('0xff')]=qs['filters'](_[_0x4a58cc('0x8d')](_0x2bbdf8[_0x4a58cc('0x2')],_0x1de35f[_0x4a58cc('0x73')])),_0x2bbdf8[_0x4a58cc('0x2')][_0x4a58cc('0x81')]&&(_0x73a75b[_0x4a58cc('0xff')]=_[_0x4a58cc('0x20')](_0x73a75b[_0x4a58cc('0xff')],{[Op['or']]:_[_0x4a58cc('0x12f')](_0x73a75b[_0x4a58cc('0x63')],function(_0x6b27c1){const _0x54983b=_0x4a58cc,_0x191ea0={};return _0x191ea0[_0x6b27c1]={[Op[_0x54983b('0x65')]]:'%'+_0x2bbdf8[_0x54983b('0x2')][_0x54983b('0x81')]+'%'},_0x191ea0;})})),_0x73a75b=_[_0x4a58cc('0x20')]({},_0x73a75b,_0x2bbdf8[_0x4a58cc('0xe4')]),_0x2f36c3['getVoicePrefixes'](_0x73a75b);})[_0x170543('0x142')](function(_0x389581){const _0x47c742=_0x170543;if(_0x389581)return _0x5d90dd=_0x389581[_0x47c742('0x7')],typeof _0x2bbdf8[_0x47c742('0x2')][_0x47c742('0xa0')]===_0x47c742('0x1b')&&(_0x73a75b[_0x47c742('0xee')]=qs[_0x47c742('0xee')](_0x2bbdf8[_0x47c742('0x2')][_0x47c742('0xee')]),_0x73a75b[_0x47c742('0xc1')]=qs[_0x47c742('0xc1')](_0x2bbdf8[_0x47c742('0x2')]['offset'])),_0x2f36c3[_0x47c742('0xa4')](_0x73a75b);})[_0x170543('0x142')](function(_0x440d08){if(_0x440d08)return _0x440d08?{'count':_0x5d90dd,'rows':_0x440d08}:null;})[_0x170543('0x142')](respondWithResult(_0x4751ef,null))['catch'](handleError(_0x4751ef,null));},exports[_0x1d55f6('0x3')]=function(_0x4e88e9,_0x243d8f){const _0x1d5f94=_0x1d55f6;let _0xa3058d={};const _0x522980={};let _0x46bc02,_0x1816c6;return db[_0x1d5f94('0xdb')]['findOne']({'where':{'id':_0x4e88e9['params']['id']}})['then'](handleEntityNotFound(_0x243d8f,null))[_0x1d5f94('0x142')](function(_0x2347ba){const _0x302fd8=_0x1d5f94;if(_0x2347ba)return _0x46bc02=_0x2347ba,_0x522980['model']=_['keys'](db[_0x302fd8('0x3e')][_0x302fd8('0xd4')]),_0x522980[_0x302fd8('0x2')]=_[_0x302fd8('0x104')](_0x4e88e9[_0x302fd8('0x2')]),_0x522980[_0x302fd8('0x73')]=_[_0x302fd8('0x66')](_0x522980['model'],_0x522980[_0x302fd8('0x2')]),_0xa3058d[_0x302fd8('0x63')]=_[_0x302fd8('0x66')](_0x522980[_0x302fd8('0x53')],qs[_0x302fd8('0x5b')](_0x4e88e9[_0x302fd8('0x2')][_0x302fd8('0x5b')])),_0xa3058d[_0x302fd8('0x63')]=_0xa3058d['attributes'][_0x302fd8('0x7')]?_0xa3058d[_0x302fd8('0x63')]:_0x522980[_0x302fd8('0x53')],_0xa3058d['order']=qs[_0x302fd8('0xd3')](_0x4e88e9[_0x302fd8('0x2')][_0x302fd8('0xd3')]),_0xa3058d[_0x302fd8('0xff')]=qs[_0x302fd8('0x73')](_[_0x302fd8('0x8d')](_0x4e88e9[_0x302fd8('0x2')],_0x522980[_0x302fd8('0x73')])),_0x4e88e9[_0x302fd8('0x2')]['filter']&&(_0xa3058d[_0x302fd8('0xff')]=_[_0x302fd8('0x20')](_0xa3058d[_0x302fd8('0xff')],{[Op['or']]:_['map'](_0xa3058d[_0x302fd8('0x63')],function(_0x58f529){const _0x50ecaa=_0x302fd8,_0x1d7722={};return _0x1d7722[_0x58f529]={[Op[_0x50ecaa('0x65')]]:'%'+_0x4e88e9[_0x50ecaa('0x2')][_0x50ecaa('0x81')]+'%'},_0x1d7722;})})),_0xa3058d=_[_0x302fd8('0x20')]({},_0xa3058d,_0x4e88e9['options']),_0x46bc02[_0x302fd8('0x3')](_0xa3058d);})[_0x1d5f94('0x142')](function(_0x490685){const _0x13c109=_0x1d5f94;if(_0x490685)return _0x1816c6=_0x490685[_0x13c109('0x7')],typeof _0x4e88e9[_0x13c109('0x2')][_0x13c109('0xa0')]===_0x13c109('0x1b')&&(_0xa3058d[_0x13c109('0xee')]=qs[_0x13c109('0xee')](_0x4e88e9[_0x13c109('0x2')][_0x13c109('0xee')]),_0xa3058d[_0x13c109('0xc1')]=qs[_0x13c109('0xc1')](_0x4e88e9[_0x13c109('0x2')][_0x13c109('0xc1')])),_0x46bc02[_0x13c109('0x3')](_0xa3058d);})[_0x1d5f94('0x142')](function(_0x2d291b){if(_0x2d291b)return _0x2d291b?{'count':_0x1816c6,'rows':_0x2d291b}:null;})[_0x1d5f94('0x142')](respondWithResult(_0x243d8f,null))['catch'](handleError(_0x243d8f,null));},exports[_0x1d55f6('0xdd')]=function(_0x4fc984,_0x18f5f9){const _0x4e85d8=_0x1d55f6;return db[_0x4e85d8('0xdb')][_0x4e85d8('0xb0')]({'where':{'id':_0x4fc984['params']['id']}})[_0x4e85d8('0x142')](handleEntityNotFound(_0x18f5f9,null))[_0x4e85d8('0x142')](function(_0x54c53c){const _0x4ebb03=_0x4e85d8;if(_0x54c53c)return _0x54c53c[_0x4ebb03('0xdd')](_0x4fc984[_0x4ebb03('0x42')][_0x4ebb03('0x13')],{'through':_['omit'](_0x4fc984[_0x4ebb03('0x42')],[_0x4ebb03('0x13'),'id'])});})[_0x4e85d8('0x142')](respondWithResult(_0x18f5f9,null))[_0x4e85d8('0x6a')](handleError(_0x18f5f9,null));},exports[_0x1d55f6('0x79')]=function(_0x3f15f3,_0x354281){const _0x464d46=_0x1d55f6;return db[_0x464d46('0xdb')][_0x464d46('0xb0')]({'where':{'id':_0x3f15f3[_0x464d46('0x100')]['id']}})[_0x464d46('0x142')](handleEntityNotFound(_0x354281,null))[_0x464d46('0x142')](function(_0x3736af){const _0x3880d1=_0x464d46;if(_0x3736af)return _0x3736af['removeFaxAccounts'](_0x3f15f3[_0x3880d1('0x2')][_0x3880d1('0x13')]);})[_0x464d46('0x142')](respondWithStatusCode(_0x354281,null))[_0x464d46('0x6a')](handleError(_0x354281,null));},exports[_0x1d55f6('0xbd')]=function(_0x5be3d0,_0x2596d9){const _0x1eeaed=_0x1d55f6;let _0x2d7daa={};const _0x2d7300={};let _0x5a6b49,_0x52e7cc;return db[_0x1eeaed('0xdb')]['findOne']({'where':{'id':_0x5be3d0['params']['id']}})[_0x1eeaed('0x142')](handleEntityNotFound(_0x2596d9,null))[_0x1eeaed('0x142')](function(_0x31aca6){const _0x5ce569=_0x1eeaed;if(_0x31aca6)return _0x5a6b49=_0x31aca6,_0x2d7300['model']=_[_0x5ce569('0x104')](db[_0x5ce569('0x10e')][_0x5ce569('0xd4')]),_0x2d7300[_0x5ce569('0x2')]=_[_0x5ce569('0x104')](_0x5be3d0[_0x5ce569('0x2')]),_0x2d7300['filters']=_[_0x5ce569('0x66')](_0x2d7300[_0x5ce569('0x53')],_0x2d7300['query']),_0x2d7daa[_0x5ce569('0x63')]=_[_0x5ce569('0x66')](_0x2d7300[_0x5ce569('0x53')],qs['fields'](_0x5be3d0[_0x5ce569('0x2')][_0x5ce569('0x5b')])),_0x2d7daa['attributes']=_0x2d7daa[_0x5ce569('0x63')]['length']?_0x2d7daa[_0x5ce569('0x63')]:_0x2d7300['model'],_0x2d7daa[_0x5ce569('0xb4')]=qs[_0x5ce569('0xd3')](_0x5be3d0[_0x5ce569('0x2')][_0x5ce569('0xd3')]),_0x2d7daa[_0x5ce569('0xff')]=qs[_0x5ce569('0x73')](_[_0x5ce569('0x8d')](_0x5be3d0[_0x5ce569('0x2')],_0x2d7300[_0x5ce569('0x73')])),_0x5be3d0[_0x5ce569('0x2')][_0x5ce569('0x81')]&&(_0x2d7daa[_0x5ce569('0xff')]=_[_0x5ce569('0x20')](_0x2d7daa[_0x5ce569('0xff')],{[Op['or']]:_[_0x5ce569('0x12f')](_0x2d7daa[_0x5ce569('0x63')],function(_0x45c526){const _0x2629fb=_0x5ce569,_0x35fe8b={};return _0x35fe8b[_0x45c526]={[Op[_0x2629fb('0x65')]]:'%'+_0x5be3d0[_0x2629fb('0x2')][_0x2629fb('0x81')]+'%'},_0x35fe8b;})})),_0x2d7daa=_[_0x5ce569('0x20')]({},_0x2d7daa,_0x5be3d0[_0x5ce569('0xe4')]),_0x5a6b49[_0x5ce569('0xbd')](_0x2d7daa);})[_0x1eeaed('0x142')](function(_0x4e27a9){const _0x4061cd=_0x1eeaed;if(_0x4e27a9)return _0x52e7cc=_0x4e27a9[_0x4061cd('0x7')],typeof _0x5be3d0[_0x4061cd('0x2')][_0x4061cd('0xa0')]==='undefined'&&(_0x2d7daa[_0x4061cd('0xee')]=qs[_0x4061cd('0xee')](_0x5be3d0['query'][_0x4061cd('0xee')]),_0x2d7daa['offset']=qs[_0x4061cd('0xc1')](_0x5be3d0[_0x4061cd('0x2')][_0x4061cd('0xc1')])),_0x5a6b49[_0x4061cd('0xbd')](_0x2d7daa);})[_0x1eeaed('0x142')](function(_0x4a854a){if(_0x4a854a)return _0x4a854a?{'count':_0x52e7cc,'rows':_0x4a854a}:null;})[_0x1eeaed('0x142')](respondWithResult(_0x2596d9,null))[_0x1eeaed('0x6a')](handleError(_0x2596d9,null));},exports[_0x1d55f6('0xf5')]=function(_0x12db36,_0xb8f19f){const _0x4412e8=_0x1d55f6;return db['User'][_0x4412e8('0xb0')]({'where':{'id':_0x12db36['params']['id']}})[_0x4412e8('0x142')](handleEntityNotFound(_0xb8f19f,null))[_0x4412e8('0x142')](function(_0x5b534e){const _0x3cf1cc=_0x4412e8;if(_0x5b534e)return _0x5b534e[_0x3cf1cc('0xf5')](_0x12db36[_0x3cf1cc('0x42')]['ids'],{'through':_['omit'](_0x12db36[_0x3cf1cc('0x42')],['ids','id'])});})['then'](respondWithResult(_0xb8f19f,null))[_0x4412e8('0x6a')](handleError(_0xb8f19f,null));},exports[_0x1d55f6('0x4f')]=function(_0x16dad8,_0x24985a){const _0x26498d=_0x1d55f6;return db['User'][_0x26498d('0xb0')]({'where':{'id':_0x16dad8[_0x26498d('0x100')]['id']}})[_0x26498d('0x142')](handleEntityNotFound(_0x24985a,null))[_0x26498d('0x142')](function(_0xc806a7){const _0x212b96=_0x26498d;if(_0xc806a7)return _0xc806a7[_0x212b96('0x4f')](_0x16dad8[_0x212b96('0x2')][_0x212b96('0x13')]);})[_0x26498d('0x142')](respondWithStatusCode(_0x24985a,null))[_0x26498d('0x6a')](handleError(_0x24985a,null));},exports[_0x1d55f6('0x108')]=function(_0x3d348a,_0x550f41){const _0xd49461=_0x1d55f6;let _0xd334ec={};const _0x5cd6bc={};let _0x1dc401,_0x5a1b5c;return db[_0xd49461('0xdb')][_0xd49461('0xb0')]({'where':{'id':_0x3d348a['params']['id']}})[_0xd49461('0x142')](handleEntityNotFound(_0x550f41,null))[_0xd49461('0x142')](function(_0x5cf1c9){const _0x2b177f=_0xd49461;if(_0x5cf1c9)return _0x1dc401=_0x5cf1c9,_0x5cd6bc[_0x2b177f('0x53')]=_['keys'](db[_0x2b177f('0x14c')]['rawAttributes']),_0x5cd6bc['query']=_[_0x2b177f('0x104')](_0x3d348a['query']),_0x5cd6bc['filters']=_[_0x2b177f('0x66')](_0x5cd6bc[_0x2b177f('0x53')],_0x5cd6bc[_0x2b177f('0x2')]),_0xd334ec[_0x2b177f('0x63')]=_['intersection'](_0x5cd6bc[_0x2b177f('0x53')],qs['fields'](_0x3d348a['query']['fields'])),_0xd334ec[_0x2b177f('0x63')]=_0xd334ec[_0x2b177f('0x63')]['length']?_0xd334ec[_0x2b177f('0x63')]:_0x5cd6bc[_0x2b177f('0x53')],_0xd334ec[_0x2b177f('0xb4')]=qs['sort'](_0x3d348a[_0x2b177f('0x2')][_0x2b177f('0xd3')]),_0xd334ec[_0x2b177f('0xff')]=qs[_0x2b177f('0x73')](_[_0x2b177f('0x8d')](_0x3d348a[_0x2b177f('0x2')],_0x5cd6bc[_0x2b177f('0x73')])),_0x3d348a[_0x2b177f('0x2')][_0x2b177f('0x81')]&&(_0xd334ec['where']=_['merge'](_0xd334ec[_0x2b177f('0xff')],{[Op['or']]:_[_0x2b177f('0x12f')](_0xd334ec['attributes'],function(_0x57c660){const _0x25ef3a=_0x2b177f,_0x110458={};return _0x110458[_0x57c660]={[Op[_0x25ef3a('0x65')]]:'%'+_0x3d348a['query'][_0x25ef3a('0x81')]+'%'},_0x110458;})})),_0xd334ec=_[_0x2b177f('0x20')]({},_0xd334ec,_0x3d348a['options']),_0x1dc401[_0x2b177f('0x108')](_0xd334ec);})[_0xd49461('0x142')](function(_0x4f81a2){const _0x10db61=_0xd49461;if(_0x4f81a2)return _0x5a1b5c=_0x4f81a2['length'],typeof _0x3d348a[_0x10db61('0x2')][_0x10db61('0xa0')]==='undefined'&&(_0xd334ec[_0x10db61('0xee')]=qs[_0x10db61('0xee')](_0x3d348a['query'][_0x10db61('0xee')]),_0xd334ec['offset']=qs[_0x10db61('0xc1')](_0x3d348a['query'][_0x10db61('0xc1')])),_0x1dc401[_0x10db61('0x108')](_0xd334ec);})[_0xd49461('0x142')](function(_0x2b7063){if(_0x2b7063)return _0x2b7063?{'count':_0x5a1b5c,'rows':_0x2b7063}:null;})[_0xd49461('0x142')](respondWithResult(_0x550f41,null))['catch'](handleError(_0x550f41,null));},exports[_0x1d55f6('0x51')]=function(_0x2a210f,_0x8bf02a){const _0x37db43=_0x1d55f6;return db[_0x37db43('0xdb')][_0x37db43('0xb0')]({'where':{'id':_0x2a210f['params']['id']}})[_0x37db43('0x142')](function(_0x219ea8){const _0x5cab8e=_0x37db43;if(_0x219ea8)return _0x219ea8[_0x5cab8e('0x51')](_0x2a210f['body']['ids'],{'through':_[_0x5cab8e('0x12b')](_0x2a210f[_0x5cab8e('0x42')],[_0x5cab8e('0x13'),'id'])});})['then'](respondWithResult(_0x8bf02a,null))[_0x37db43('0x6a')](handleError(_0x8bf02a,null));},exports[_0x1d55f6('0x11f')]=function(_0x3867de,_0x3c7f26){const _0x48705e=_0x1d55f6;return db[_0x48705e('0xdb')][_0x48705e('0xb0')]({'where':{'id':_0x3867de[_0x48705e('0x100')]['id']}})[_0x48705e('0x142')](handleEntityNotFound(_0x3c7f26,null))[_0x48705e('0x142')](function(_0x3bbc4c){const _0x544501=_0x48705e;if(_0x3bbc4c)return _0x3bbc4c[_0x544501('0x11f')](_0x3867de[_0x544501('0x2')][_0x544501('0x13')]);})[_0x48705e('0x142')](respondWithStatusCode(_0x3c7f26,null))[_0x48705e('0x6a')](handleError(_0x3c7f26,null));},exports[_0x1d55f6('0xba')]=function(_0x55dd0c,_0x17383f){const _0x324b2a=_0x1d55f6;let _0xef91e6={};const _0x141a6d={};let _0x33cdf0,_0x3204ee;return db[_0x324b2a('0xdb')][_0x324b2a('0xb0')]({'where':{'id':_0x55dd0c[_0x324b2a('0x100')]['id']}})['then'](handleEntityNotFound(_0x17383f,null))[_0x324b2a('0x142')](function(_0x3d368e){const _0x594146=_0x324b2a;if(_0x3d368e)return _0x33cdf0=_0x3d368e,_0x141a6d['model']=_[_0x594146('0x104')](db['SmsAccount'][_0x594146('0xd4')]),_0x141a6d[_0x594146('0x2')]=_[_0x594146('0x104')](_0x55dd0c[_0x594146('0x2')]),_0x141a6d[_0x594146('0x73')]=_['intersection'](_0x141a6d[_0x594146('0x53')],_0x141a6d[_0x594146('0x2')]),_0xef91e6[_0x594146('0x63')]=_['intersection'](_0x141a6d[_0x594146('0x53')],qs[_0x594146('0x5b')](_0x55dd0c['query'][_0x594146('0x5b')])),_0xef91e6['attributes']=_0xef91e6[_0x594146('0x63')]['length']?_0xef91e6[_0x594146('0x63')]:_0x141a6d['model'],_0xef91e6[_0x594146('0xb4')]=qs[_0x594146('0xd3')](_0x55dd0c['query'][_0x594146('0xd3')]),_0xef91e6[_0x594146('0xff')]=qs[_0x594146('0x73')](_['pick'](_0x55dd0c[_0x594146('0x2')],_0x141a6d[_0x594146('0x73')])),_0x55dd0c[_0x594146('0x2')]['filter']&&(_0xef91e6[_0x594146('0xff')]=_[_0x594146('0x20')](_0xef91e6[_0x594146('0xff')],{[Op['or']]:_[_0x594146('0x12f')](_0xef91e6[_0x594146('0x63')],function(_0x28583c){const _0x25778f=_0x594146,_0x330e1b={};return _0x330e1b[_0x28583c]={[Op[_0x25778f('0x65')]]:'%'+_0x55dd0c[_0x25778f('0x2')][_0x25778f('0x81')]+'%'},_0x330e1b;})})),_0xef91e6=_[_0x594146('0x20')]({},_0xef91e6,_0x55dd0c[_0x594146('0xe4')]),_0x33cdf0[_0x594146('0xba')](_0xef91e6);})[_0x324b2a('0x142')](function(_0x208e50){const _0x451350=_0x324b2a;if(_0x208e50)return _0x3204ee=_0x208e50['length'],typeof _0x55dd0c[_0x451350('0x2')][_0x451350('0xa0')]==='undefined'&&(_0xef91e6[_0x451350('0xee')]=qs[_0x451350('0xee')](_0x55dd0c[_0x451350('0x2')][_0x451350('0xee')]),_0xef91e6[_0x451350('0xc1')]=qs[_0x451350('0xc1')](_0x55dd0c[_0x451350('0x2')][_0x451350('0xc1')])),_0x33cdf0['getSmsAccounts'](_0xef91e6);})[_0x324b2a('0x142')](function(_0x5bb5d2){if(_0x5bb5d2)return _0x5bb5d2?{'count':_0x3204ee,'rows':_0x5bb5d2}:null;})[_0x324b2a('0x142')](respondWithResult(_0x17383f,null))[_0x324b2a('0x6a')](handleError(_0x17383f,null));},exports[_0x1d55f6('0x36')]=function(_0x2eeb8b,_0x37c9e2){const _0x816d0e=_0x1d55f6;return db[_0x816d0e('0xdb')][_0x816d0e('0xb0')]({'where':{'id':_0x2eeb8b[_0x816d0e('0x100')]['id']}})['then'](handleEntityNotFound(_0x37c9e2,null))[_0x816d0e('0x142')](function(_0x497af1){const _0xadd167=_0x816d0e;if(_0x497af1)return _0x497af1[_0xadd167('0x36')](_0x2eeb8b[_0xadd167('0x42')][_0xadd167('0x13')],{'through':_[_0xadd167('0x12b')](_0x2eeb8b[_0xadd167('0x42')],['ids','id'])});})[_0x816d0e('0x142')](respondWithResult(_0x37c9e2,null))[_0x816d0e('0x6a')](handleError(_0x37c9e2,null));},exports[_0x1d55f6('0x150')]=function(_0x325788,_0x106da0){const _0x557dc9=_0x1d55f6;return db[_0x557dc9('0xdb')][_0x557dc9('0xb0')]({'where':{'id':_0x325788['params']['id']}})[_0x557dc9('0x142')](handleEntityNotFound(_0x106da0,null))['then'](function(_0x1355e1){const _0x4e7fc8=_0x557dc9;if(_0x1355e1)return _0x1355e1[_0x4e7fc8('0x150')](_0x325788[_0x4e7fc8('0x2')][_0x4e7fc8('0x13')]);})[_0x557dc9('0x142')](respondWithStatusCode(_0x106da0,null))[_0x557dc9('0x6a')](handleError(_0x106da0,null));},exports[_0x1d55f6('0x19')]=function(_0x3a9ac8,_0x586bd2){const _0x1292aa=_0x1d55f6;let _0x4041ad={};const _0x18b692={};let _0x2e4a90,_0x560284;return db[_0x1292aa('0xdb')][_0x1292aa('0xb0')]({'where':{'id':_0x3a9ac8[_0x1292aa('0x100')]['id']}})['then'](handleEntityNotFound(_0x586bd2,null))[_0x1292aa('0x142')](function(_0x3b32c1){const _0x3ae4e2=_0x1292aa;if(_0x3b32c1)return _0x2e4a90=_0x3b32c1,_0x18b692['model']=_[_0x3ae4e2('0x104')](db['ChatWebsite'][_0x3ae4e2('0xd4')]),_0x18b692[_0x3ae4e2('0x2')]=_[_0x3ae4e2('0x104')](_0x3a9ac8[_0x3ae4e2('0x2')]),_0x18b692[_0x3ae4e2('0x73')]=_[_0x3ae4e2('0x66')](_0x18b692['model'],_0x18b692['query']),_0x4041ad[_0x3ae4e2('0x63')]=_['intersection'](_0x18b692[_0x3ae4e2('0x53')],qs[_0x3ae4e2('0x5b')](_0x3a9ac8['query'][_0x3ae4e2('0x5b')])),_0x4041ad['attributes']=_0x4041ad[_0x3ae4e2('0x63')][_0x3ae4e2('0x7')]?_0x4041ad[_0x3ae4e2('0x63')]:_0x18b692[_0x3ae4e2('0x53')],_0x4041ad['order']=qs[_0x3ae4e2('0xd3')](_0x3a9ac8[_0x3ae4e2('0x2')]['sort']),_0x4041ad[_0x3ae4e2('0xff')]=qs[_0x3ae4e2('0x73')](_[_0x3ae4e2('0x8d')](_0x3a9ac8[_0x3ae4e2('0x2')],_0x18b692[_0x3ae4e2('0x73')])),_0x3a9ac8['query'][_0x3ae4e2('0x81')]&&(_0x4041ad[_0x3ae4e2('0xff')]=_[_0x3ae4e2('0x20')](_0x4041ad[_0x3ae4e2('0xff')],{[Op['or']]:_[_0x3ae4e2('0x12f')](_0x4041ad['attributes'],function(_0x583d1a){const _0x4d63b6=_0x3ae4e2,_0x215f60={};return _0x215f60[_0x583d1a]={[Op[_0x4d63b6('0x65')]]:'%'+_0x3a9ac8['query'][_0x4d63b6('0x81')]+'%'},_0x215f60;})})),_0x4041ad=_[_0x3ae4e2('0x20')]({},_0x4041ad,_0x3a9ac8[_0x3ae4e2('0xe4')]),_0x2e4a90[_0x3ae4e2('0x19')](_0x4041ad);})[_0x1292aa('0x142')](function(_0x167ba3){const _0x1994dd=_0x1292aa;if(_0x167ba3)return _0x560284=_0x167ba3['length'],typeof _0x3a9ac8[_0x1994dd('0x2')]['nolimit']===_0x1994dd('0x1b')&&(_0x4041ad[_0x1994dd('0xee')]=qs[_0x1994dd('0xee')](_0x3a9ac8[_0x1994dd('0x2')][_0x1994dd('0xee')]),_0x4041ad[_0x1994dd('0xc1')]=qs[_0x1994dd('0xc1')](_0x3a9ac8[_0x1994dd('0x2')][_0x1994dd('0xc1')])),_0x2e4a90[_0x1994dd('0x19')](_0x4041ad);})[_0x1292aa('0x142')](function(_0x42b404){if(_0x42b404)return _0x42b404?{'count':_0x560284,'rows':_0x42b404}:null;})[_0x1292aa('0x142')](respondWithResult(_0x586bd2,null))['catch'](handleError(_0x586bd2,null));},exports['addChatWebsites']=function(_0x1b593f,_0x3b684f){const _0x3ceced=_0x1d55f6;return db[_0x3ceced('0xdb')]['findOne']({'where':{'id':_0x1b593f[_0x3ceced('0x100')]['id']}})['then'](handleEntityNotFound(_0x3b684f,null))['then'](function(_0x3da271){const _0xc54394=_0x3ceced;if(_0x3da271)return _0x3da271[_0xc54394('0x159')](_0x1b593f['body']['ids'],{'through':_[_0xc54394('0x12b')](_0x1b593f[_0xc54394('0x42')],[_0xc54394('0x13'),'id'])});})[_0x3ceced('0x142')](respondWithResult(_0x3b684f,null))['catch'](handleError(_0x3b684f,null));},exports[_0x1d55f6('0x23')]=function(_0x21ca53,_0x2ddc66){const _0x357d6e=_0x1d55f6;return db[_0x357d6e('0xdb')][_0x357d6e('0xb0')]({'where':{'id':_0x21ca53[_0x357d6e('0x100')]['id']}})[_0x357d6e('0x142')](handleEntityNotFound(_0x2ddc66,null))['then'](function(_0x1e4690){const _0xb1ee54=_0x357d6e;if(_0x1e4690)return _0x1e4690['removeChatWebsites'](_0x21ca53[_0xb1ee54('0x2')][_0xb1ee54('0x13')]);})[_0x357d6e('0x142')](respondWithStatusCode(_0x2ddc66,null))[_0x357d6e('0x6a')](handleError(_0x2ddc66,null));},exports[_0x1d55f6('0x144')]=function(_0x16ef2f,_0xa3df3e){const _0x37fa64=_0x1d55f6;let _0x143649={};const _0x47ebcd={};let _0x59c65c,_0x4e6560;return db[_0x37fa64('0xdb')][_0x37fa64('0xb0')]({'where':{'id':_0x16ef2f[_0x37fa64('0x100')]['id']}})[_0x37fa64('0x142')](handleEntityNotFound(_0xa3df3e,null))[_0x37fa64('0x142')](function(_0x840f8e){const _0x32e441=_0x37fa64;if(_0x840f8e)return _0x59c65c=_0x840f8e,_0x47ebcd['model']=_['keys'](db[_0x32e441('0x76')]['rawAttributes']),_0x47ebcd[_0x32e441('0x2')]=_['keys'](_0x16ef2f[_0x32e441('0x2')]),_0x47ebcd['filters']=_['intersection'](_0x47ebcd[_0x32e441('0x53')],_0x47ebcd[_0x32e441('0x2')]),_0x143649[_0x32e441('0x63')]=_[_0x32e441('0x66')](_0x47ebcd[_0x32e441('0x53')],qs['fields'](_0x16ef2f[_0x32e441('0x2')][_0x32e441('0x5b')])),_0x143649[_0x32e441('0x63')]=_0x143649[_0x32e441('0x63')]['length']?_0x143649['attributes']:_0x47ebcd[_0x32e441('0x53')],_0x143649[_0x32e441('0xb4')]=qs[_0x32e441('0xd3')](_0x16ef2f['query']['sort']),_0x143649[_0x32e441('0xff')]=qs[_0x32e441('0x73')](_[_0x32e441('0x8d')](_0x16ef2f[_0x32e441('0x2')],_0x47ebcd[_0x32e441('0x73')])),_0x16ef2f['query'][_0x32e441('0x81')]&&(_0x143649['where']=_[_0x32e441('0x20')](_0x143649[_0x32e441('0xff')],{[Op['or']]:_[_0x32e441('0x12f')](_0x143649[_0x32e441('0x63')],function(_0x8e652f){const _0x357e9e=_0x32e441,_0x3f5dfa={};return _0x3f5dfa[_0x8e652f]={[Op[_0x357e9e('0x65')]]:'%'+_0x16ef2f[_0x357e9e('0x2')][_0x357e9e('0x81')]+'%'},_0x3f5dfa;})})),_0x143649=_['merge']({},_0x143649,_0x16ef2f[_0x32e441('0xe4')]),_0x59c65c[_0x32e441('0x144')](_0x143649);})['then'](function(_0x1f9a45){const _0x57d4d2=_0x37fa64;if(_0x1f9a45)return _0x4e6560=_0x1f9a45[_0x57d4d2('0x7')],typeof _0x16ef2f[_0x57d4d2('0x2')][_0x57d4d2('0xa0')]===_0x57d4d2('0x1b')&&(_0x143649['limit']=qs[_0x57d4d2('0xee')](_0x16ef2f[_0x57d4d2('0x2')]['limit']),_0x143649[_0x57d4d2('0xc1')]=qs[_0x57d4d2('0xc1')](_0x16ef2f[_0x57d4d2('0x2')][_0x57d4d2('0xc1')])),_0x59c65c[_0x57d4d2('0x144')](_0x143649);})['then'](function(_0xf017d5){if(_0xf017d5)return _0xf017d5?{'count':_0x4e6560,'rows':_0xf017d5}:null;})[_0x37fa64('0x142')](respondWithResult(_0xa3df3e,null))['catch'](handleError(_0xa3df3e,null));},exports[_0x1d55f6('0x82')]=function(_0x951849,_0x78610){const _0x1d6e17=_0x1d55f6;return db[_0x1d6e17('0xdb')][_0x1d6e17('0xb0')]({'where':{'id':_0x951849['params']['id']}})[_0x1d6e17('0x142')](handleEntityNotFound(_0x78610,null))['then'](function(_0x6fb252){const _0x8d3c81=_0x1d6e17;if(_0x6fb252)return _0x6fb252[_0x8d3c81('0x82')](_0x951849[_0x8d3c81('0x42')][_0x8d3c81('0x13')],{'through':_[_0x8d3c81('0x12b')](_0x951849['body'],['ids','id'])});})[_0x1d6e17('0x142')](respondWithResult(_0x78610,null))[_0x1d6e17('0x6a')](handleError(_0x78610,null));},exports[_0x1d55f6('0xc9')]=function(_0xa756c7,_0x32ef60){const _0x500fdd=_0x1d55f6;return db['User'][_0x500fdd('0xb0')]({'where':{'id':_0xa756c7[_0x500fdd('0x100')]['id']}})['then'](handleEntityNotFound(_0x32ef60,null))[_0x500fdd('0x142')](function(_0x42e3bb){const _0x3c3374=_0x500fdd;if(_0x42e3bb)return _0x42e3bb[_0x3c3374('0xc9')](_0xa756c7[_0x3c3374('0x2')]['ids']);})['then'](respondWithStatusCode(_0x32ef60,null))[_0x500fdd('0x6a')](handleError(_0x32ef60,null));},exports['getSquareProjects']=function(_0x20de4e,_0x1dea0d){const _0x26f4a0=_0x1d55f6;let _0x43ed95={};const _0x32af58={};let _0x27c241,_0x50453c;return db[_0x26f4a0('0xdb')][_0x26f4a0('0xb0')]({'where':{'id':_0x20de4e['params']['id']}})[_0x26f4a0('0x142')](handleEntityNotFound(_0x1dea0d,null))[_0x26f4a0('0x142')](function(_0x21d89d){const _0xbb57e=_0x26f4a0;if(_0x21d89d)return _0x27c241=_0x21d89d,_0x32af58[_0xbb57e('0x53')]=_['keys'](db['SquareProject'][_0xbb57e('0xd4')]),_0x32af58[_0xbb57e('0x2')]=_[_0xbb57e('0x104')](_0x20de4e['query']),_0x32af58['filters']=_[_0xbb57e('0x66')](_0x32af58['model'],_0x32af58[_0xbb57e('0x2')]),_0x43ed95['attributes']=_[_0xbb57e('0x66')](_0x32af58['model'],qs[_0xbb57e('0x5b')](_0x20de4e['query'][_0xbb57e('0x5b')])),_0x43ed95[_0xbb57e('0x63')]=_0x43ed95[_0xbb57e('0x63')][_0xbb57e('0x7')]?_0x43ed95[_0xbb57e('0x63')]:_0x32af58[_0xbb57e('0x53')],_0x43ed95[_0xbb57e('0xb4')]=qs['sort'](_0x20de4e['query']['sort']),_0x43ed95[_0xbb57e('0xff')]=qs[_0xbb57e('0x73')](_[_0xbb57e('0x8d')](_0x20de4e['query'],_0x32af58[_0xbb57e('0x73')])),_0x20de4e[_0xbb57e('0x2')][_0xbb57e('0x81')]&&(_0x43ed95[_0xbb57e('0xff')]=_[_0xbb57e('0x20')](_0x43ed95[_0xbb57e('0xff')],{[Op['or']]:_[_0xbb57e('0x12f')](_0x43ed95[_0xbb57e('0x63')],function(_0x16163c){const _0x327880=_0xbb57e,_0x123216={};return _0x123216[_0x16163c]={[Op['like']]:'%'+_0x20de4e[_0x327880('0x2')][_0x327880('0x81')]+'%'},_0x123216;})})),_0x43ed95=_['merge']({},_0x43ed95,_0x20de4e[_0xbb57e('0xe4')]),_0x27c241[_0xbb57e('0x94')](_0x43ed95);})[_0x26f4a0('0x142')](function(_0x5a5d22){const _0x3f429e=_0x26f4a0;if(_0x5a5d22)return _0x50453c=_0x5a5d22[_0x3f429e('0x7')],typeof _0x20de4e[_0x3f429e('0x2')]['nolimit']===_0x3f429e('0x1b')&&(_0x43ed95['limit']=qs[_0x3f429e('0xee')](_0x20de4e[_0x3f429e('0x2')][_0x3f429e('0xee')]),_0x43ed95[_0x3f429e('0xc1')]=qs[_0x3f429e('0xc1')](_0x20de4e['query'][_0x3f429e('0xc1')])),_0x27c241['getSquareProjects'](_0x43ed95);})[_0x26f4a0('0x142')](function(_0x2ee624){if(_0x2ee624)return _0x2ee624?{'count':_0x50453c,'rows':_0x2ee624}:null;})[_0x26f4a0('0x142')](respondWithResult(_0x1dea0d,null))['catch'](handleError(_0x1dea0d,null));},exports[_0x1d55f6('0xc5')]=function(_0x28adc8,_0x102cf1){const _0x3ee27c=_0x1d55f6;return db[_0x3ee27c('0xdb')][_0x3ee27c('0xb0')]({'where':{'id':_0x28adc8[_0x3ee27c('0x100')]['id']}})[_0x3ee27c('0x142')](handleEntityNotFound(_0x102cf1,null))[_0x3ee27c('0x142')](function(_0x3b36e8){const _0x49823f=_0x3ee27c;if(_0x3b36e8)return _0x3b36e8[_0x49823f('0xc5')](_0x28adc8[_0x49823f('0x42')][_0x49823f('0x13')],{'through':_[_0x49823f('0x12b')](_0x28adc8[_0x49823f('0x42')],[_0x49823f('0x13'),'id'])});})[_0x3ee27c('0x142')](respondWithResult(_0x102cf1,null))[_0x3ee27c('0x6a')](handleError(_0x102cf1,null));},exports['removeSquareProjects']=function(_0x108c31,_0x24c84d){const _0x29288b=_0x1d55f6;return db[_0x29288b('0xdb')]['findOne']({'where':{'id':_0x108c31[_0x29288b('0x100')]['id']}})[_0x29288b('0x142')](handleEntityNotFound(_0x24c84d,null))[_0x29288b('0x142')](function(_0x396cff){const _0x58f80a=_0x29288b;if(_0x396cff)return _0x396cff[_0x58f80a('0xd')](_0x108c31['query'][_0x58f80a('0x13')]);})[_0x29288b('0x142')](respondWithStatusCode(_0x24c84d,null))[_0x29288b('0x6a')](handleError(_0x24c84d,null));},exports[_0x1d55f6('0x95')]=function(_0x4163ba,_0x236754){const _0x3d08e9=_0x1d55f6;let _0x5aecc8={};const _0x568c7a={},_0x5dee75={'count':0x0,'rows':[]},_0x5457d0=db[_0x3d08e9('0xae')][_0x3d08e9('0xd4')];_0x568c7a[_0x3d08e9('0x53')]=_[_0x3d08e9('0x104')](_0x5457d0),_0x568c7a['query']=_['keys'](_0x4163ba[_0x3d08e9('0x2')]),_0x568c7a[_0x3d08e9('0x73')]=_['intersection'](_0x568c7a['model'],_0x568c7a['query']),_0x568c7a[_0x3d08e9('0x73')]=_[_0x3d08e9('0xf0')](_0x568c7a[_0x3d08e9('0x73')],[_0x3d08e9('0xd2'),_0x3d08e9('0x155'),'$gt',_0x3d08e9('0xe7'),_0x3d08e9('0x1c'),_0x3d08e9('0xdc'),_0x3d08e9('0xa2'),_0x3d08e9('0xc4'),_0x3d08e9('0x15a'),_0x3d08e9('0x38'),_0x3d08e9('0x10'),_0x3d08e9('0x1'),_0x3d08e9('0xda'),_0x3d08e9('0x145'),_0x3d08e9('0x13f'),_0x3d08e9('0x121'),_0x3d08e9('0x46'),_0x3d08e9('0x145'),_0x3d08e9('0xf7'),'$contains',_0x3d08e9('0x62'),_0x3d08e9('0x70')]),_0x5aecc8[_0x3d08e9('0x63')]=_[_0x3d08e9('0x66')](_0x568c7a[_0x3d08e9('0x53')],qs[_0x3d08e9('0x5b')](_0x4163ba['query'][_0x3d08e9('0x5b')])),_0x5aecc8['attributes']=_0x5aecc8[_0x3d08e9('0x63')]['length']?_0x5aecc8['attributes']:_0x568c7a[_0x3d08e9('0x53')];typeof _0x4163ba['query'][_0x3d08e9('0xa0')]==='undefined'&&(_0x5aecc8['limit']=qs[_0x3d08e9('0xee')](_0x4163ba[_0x3d08e9('0x2')][_0x3d08e9('0xee')]),_0x5aecc8[_0x3d08e9('0xc1')]=qs[_0x3d08e9('0xc1')](_0x4163ba[_0x3d08e9('0x2')][_0x3d08e9('0xc1')]));_0x5aecc8['order']=qs['sort'](_0x4163ba[_0x3d08e9('0x2')][_0x3d08e9('0xd3')]),_0x5aecc8[_0x3d08e9('0xff')]=qs['filters'](_[_0x3d08e9('0x8d')](_0x4163ba[_0x3d08e9('0x2')],_0x568c7a['filters']));_0x4163ba[_0x3d08e9('0x2')][_0x3d08e9('0x81')]&&(_0x5aecc8[_0x3d08e9('0xff')]=_['merge'](_0x5aecc8[_0x3d08e9('0xff')],{[Op['or']]:_['map'](_0x5aecc8[_0x3d08e9('0x63')],function(_0x164b29){const _0x3727ef={};return _0x3727ef[_0x164b29]={[Op['like']]:'%'+_0x4163ba['query']['filter']+'%'},_0x3727ef;})}));_0x5aecc8[_0x3d08e9('0xff')]={[Op[_0x3d08e9('0xd8')]]:[_0x5aecc8[_0x3d08e9('0xff')],{[Op['or']]:[{'UserId':_0x4163ba[_0x3d08e9('0x100')]['id']},{'OwnerId':_0x4163ba['params']['id']}]}]},_0x5aecc8=_[_0x3d08e9('0x20')]({},_0x5aecc8,_0x4163ba[_0x3d08e9('0xe4')]);const _0x42cd66={'where':_0x5aecc8[_0x3d08e9('0xff')]};return db[_0x3d08e9('0xae')][_0x3d08e9('0xe8')](_0x42cd66)['then'](function(_0x1e5e79){const _0x5b811f=_0x3d08e9;return _0x5dee75[_0x5b811f('0xe8')]=_0x1e5e79,_0x4163ba['query'][_0x5b811f('0x35')]&&(_0x5aecc8[_0x5b811f('0xcf')]=[{'attributes':['id',_0x5b811f('0x153'),'lastName',_0x5b811f('0x125')],'model':db[_0x5b811f('0x90')],'as':_0x5b811f('0x4c')},{'attributes':['id',_0x5b811f('0x2f'),_0x5b811f('0x0')],'model':db[_0x5b811f('0xb7')],'as':_0x5b811f('0x48')}]),db[_0x5b811f('0xae')][_0x5b811f('0x86')](_0x5aecc8);})[_0x3d08e9('0x142')](function(_0x22f5ec){return _0x5dee75['rows']=_0x22f5ec,_0x5dee75;})[_0x3d08e9('0x142')](respondWithFilteredResult(_0x236754,_0x5aecc8))[_0x3d08e9('0x6a')](handleError(_0x236754,null));},exports[_0x1d55f6('0x136')]=function(_0x6fca2a,_0x315eb7){const _0x15cef9=_0x1d55f6;return!_[_0x15cef9('0xb5')](_0x6fca2a['user']['id'])&&(_0x6fca2a[_0x15cef9('0x5a')][_0x15cef9('0x140')]==_0x15cef9('0x8c')||_0x6fca2a[_0x15cef9('0x5a')][_0x15cef9('0x140')]==_0x15cef9('0x5a'))?db[_0x15cef9('0xdb')][_0x15cef9('0xb0')]({'where':{'id':_0x6fca2a['params']['id']},'raw':!![]})[_0x15cef9('0x142')](function(_0xe4c2f0){const _0x586187=_0x15cef9;return authService[_0x586187('0x41')](_0xe4c2f0);})[_0x15cef9('0x142')](function(_0x194a42){const _0x5b9d6f=_0x15cef9;return _0x194a42?_0x315eb7[_0x5b9d6f('0x10a')](0xc8)[_0x5b9d6f('0xa1')]({'api_key':_0x194a42[_0x5b9d6f('0x15')]}):_0x315eb7['status'](0xcc)[_0x5b9d6f('0xa1')]({'message':_0x5b9d6f('0xc0')});})['catch'](handleError(_0x315eb7,0x193)):_0x315eb7[_0x15cef9('0x10a')](0x191)[_0x15cef9('0xa1')]({'message':_0x15cef9('0xde')});},exports[_0x1d55f6('0x113')]=function(_0x10842b,_0x241005){const _0x4481b5=_0x1d55f6;return!_[_0x4481b5('0xb5')](_0x10842b['user']['id'])&&(_0x10842b[_0x4481b5('0x5a')][_0x4481b5('0x140')]==_0x4481b5('0x8c')||_0x10842b[_0x4481b5('0x5a')]['role']=='user')?db['Use'][_0x4481b5('0xb0')]({'where':{'id':_0x10842b[_0x4481b5('0x100')]['id']}})[_0x4481b5('0x142')](function(_0x364641){return authService['generateApiKey'](_0x364641);})['then'](function(_0x1ccac5){const _0x51635b=_0x4481b5;return db[_0x51635b('0xdb')][_0x51635b('0x1a')]({'apiKeyIat':_0x1ccac5['iat'],'apiKeyNonce':_0x1ccac5[_0x51635b('0x8f')]},{'where':{'id':_0x10842b['params']['id']}})[_0x51635b('0x142')](function(){const _0x134993=_0x51635b;return _0x241005['status'](0xc8)[_0x134993('0xa1')]({'api_key':_0x1ccac5[_0x134993('0x15')]});});})[_0x4481b5('0x6a')](handleError(_0x241005,0x193)):_0x241005[_0x4481b5('0x10a')](0x191)['json']({'message':_0x4481b5('0xde')});},exports[_0x1d55f6('0x4')]=function(_0x5eb651,_0x1fc435){const _0x2da144=_0x1d55f6;return!_[_0x2da144('0xb5')](_0x5eb651[_0x2da144('0x5a')]['id'])&&(_0x5eb651[_0x2da144('0x5a')][_0x2da144('0x140')]==_0x2da144('0x8c')||_0x5eb651['user'][_0x2da144('0x140')]==_0x2da144('0x5a'))?db[_0x2da144('0x9b')]['findOne']({'where':{'id':_0x5eb651[_0x2da144('0x100')]['id']}})[_0x2da144('0x142')](handleEntityNotFound(_0x1fc435,null))[_0x2da144('0x142')](function(_0x184f5a){const _0x3ca82b=_0x2da144;if(_0x184f5a&&_0x184f5a[_0x3ca82b('0xe2')]&&_0x184f5a[_0x3ca82b('0xbe')])return _0x184f5a;else throw{'message':'API\x20key\x20not\x20available'};})[_0x2da144('0x142')](function(){const _0x1e662c=_0x2da144;return db[_0x1e662c('0xdb')][_0x1e662c('0x1a')]({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x5eb651[_0x1e662c('0x100')]['id']}});})[_0x2da144('0x142')](respondWithStatusCode(_0x1fc435,0xc8))[_0x2da144('0x6a')](handleError(_0x1fc435,0x193)):_0x1fc435[_0x2da144('0x10a')](0x191)['json']({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});},exports[_0x1d55f6('0x5d')]=function(_0x22f9f4,_0x3ecf3a){const _0x27f2be=_0x1d55f6,_0x5292c3=_0x22f9f4[_0x27f2be('0x5a')][_0x27f2be('0x13d')]({'plain':!![]});return!_0x5292c3?_0x3ecf3a[_0x27f2be('0x10a')](0x191)[_0x27f2be('0x33')]('Unable\x20to\x20retrieve\x20the\x20current\x20user'):_0x3ecf3a[_0x27f2be('0x10a')](0xc8)[_0x27f2be('0xa1')](_0x5292c3);};