Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / team / team.controller.js
index 3403243..89f9c14 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc95a=['capitalize','toLowerCase','Queue','Queues','addQueues','findOne','add','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Fax','Openchannel','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','user','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','Sms','removeAgents','Queue:remove','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','Team','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel'];(function(_0x3e0f66,_0x37e558){var _0x95225b=function(_0x33ad6d){while(--_0x33ad6d){_0x3e0f66['push'](_0x3e0f66['shift']());}};_0x95225b(++_0x37e558);}(_0xc95a,0xc4));var _0xac95=function(_0x100194,_0x3f0a2c){_0x100194=_0x100194-0x0;var _0x3e4536=_0xc95a[_0x100194];return _0x3e4536;};'use strict';var emlformat=require(_0xac95('0x0'));var rimraf=require(_0xac95('0x1'));var zipdir=require(_0xac95('0x2'));var jsonpatch=require(_0xac95('0x3'));var rp=require(_0xac95('0x4'));var moment=require(_0xac95('0x5'));var BPromise=require(_0xac95('0x6'));var Mustache=require(_0xac95('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xac95('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac95('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac95('0xa'));var toCsv=require(_0xac95('0x8'));var querystring=require(_0xac95('0xb'));var Papa=require(_0xac95('0xc'));var Redis=require(_0xac95('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xac95('0xe'));var as=require(_0xac95('0xf'));var hardwareService=require(_0xac95('0x10'));var logger=require(_0xac95('0x11'))(_0xac95('0x12'));var utils=require(_0xac95('0x13'));var config=require(_0xac95('0x14'));var licenseUtil=require(_0xac95('0x15'));var db=require(_0xac95('0x16'))['db'];config[_0xac95('0x17')]=_[_0xac95('0x18')](config[_0xac95('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xac95('0x19'))(new Redis(config[_0xac95('0x17')]));require(_0xac95('0x1a'))[_0xac95('0x1b')](socket);function respondWithStatusCode(_0x506502,_0x1c2dfa){_0x1c2dfa=_0x1c2dfa||0xcc;return function(_0x40a1bc){if(_0x40a1bc){return _0x506502[_0xac95('0x1c')](_0x1c2dfa);}return _0x506502[_0xac95('0x1d')](_0x1c2dfa)['end']();};}function respondWithResult(_0x1fc1e2,_0x1deea4){_0x1deea4=_0x1deea4||0xc8;return function(_0x48a543){if(_0x48a543){return _0x1fc1e2[_0xac95('0x1d')](_0x1deea4)[_0xac95('0x1e')](_0x48a543);}};}function respondWithFilteredResult(_0x26090b,_0x5272b7){return function(_0x2302fa){if(_0x2302fa){var _0x1ceb34=typeof _0x5272b7[_0xac95('0x1f')]==='undefined'&&typeof _0x5272b7[_0xac95('0x20')]===_0xac95('0x21');var _0x385f27=_0x2302fa[_0xac95('0x22')];var _0x32c131=_0x1ceb34?0x0:_0x5272b7['offset'];var _0xc9586d=_0x1ceb34?_0x2302fa[_0xac95('0x22')]:_0x5272b7[_0xac95('0x1f')]+_0x5272b7[_0xac95('0x20')];var _0xc19a63;if(_0xc9586d>=_0x385f27){_0xc9586d=_0x385f27;_0xc19a63=0xc8;}else{_0xc19a63=0xce;}_0x26090b[_0xac95('0x1d')](_0xc19a63);return _0x26090b[_0xac95('0x23')](_0xac95('0x24'),_0x32c131+'-'+_0xc9586d+'/'+_0x385f27)['json'](_0x2302fa);}return null;};}function patchUpdates(_0x3204f6){return function(_0x28d74a){try{jsonpatch[_0xac95('0x25')](_0x28d74a,_0x3204f6,!![]);}catch(_0x2b9c02){return BPromise[_0xac95('0x26')](_0x2b9c02);}return _0x28d74a[_0xac95('0x27')]();};}function saveUpdates(_0x353d1a,_0x1139ed){return function(_0x517899){if(_0x517899){return _0x517899[_0xac95('0x28')](_0x353d1a)[_0xac95('0x29')](function(_0x5a895a){return _0x5a895a;});}return null;};}function handleEntityNotFound(_0x3f9f09,_0xcc0016){return function(_0x3097e6){if(!_0x3097e6){_0x3f9f09[_0xac95('0x1c')](0x194);}return _0x3097e6;};}function handleError(_0x474e92,_0x4a3752){_0x4a3752=_0x4a3752||0x1f4;return function(_0x52cc36){logger['error'](_0x52cc36[_0xac95('0x2a')]);if(_0x52cc36['name']){delete _0x52cc36[_0xac95('0x2b')];}_0x474e92['status'](_0x4a3752)[_0xac95('0x2c')](_0x52cc36);};}exports['index']=function(_0x4558cb,_0x5f3e83){var _0x30ff1c={},_0xdc4399={},_0x5c8453={'count':0x0,'rows':[]};var _0x30e276=_['map'](db[_0xac95('0x2d')][_0xac95('0x2e')],function(_0x53c39a){return{'name':_0x53c39a[_0xac95('0x2f')],'type':_0x53c39a[_0xac95('0x30')][_0xac95('0x31')]};});_0xdc4399[_0xac95('0x32')]=_[_0xac95('0x33')](_0x30e276,_0xac95('0x2b'));_0xdc4399[_0xac95('0x34')]=_[_0xac95('0x35')](_0x4558cb[_0xac95('0x34')]);_0xdc4399['filters']=_[_0xac95('0x36')](_0xdc4399[_0xac95('0x32')],_0xdc4399[_0xac95('0x34')]);_0x30ff1c[_0xac95('0x37')]=_[_0xac95('0x36')](_0xdc4399['model'],qs[_0xac95('0x38')](_0x4558cb[_0xac95('0x34')]['fields']));_0x30ff1c[_0xac95('0x37')]=_0x30ff1c['attributes'][_0xac95('0x39')]?_0x30ff1c[_0xac95('0x37')]:_0xdc4399[_0xac95('0x32')];if(!_0x4558cb['query']['hasOwnProperty']('nolimit')){_0x30ff1c['limit']=qs[_0xac95('0x20')](_0x4558cb['query'][_0xac95('0x20')]);_0x30ff1c['offset']=qs[_0xac95('0x1f')](_0x4558cb[_0xac95('0x34')]['offset']);}_0x30ff1c[_0xac95('0x3a')]=qs[_0xac95('0x3b')](_0x4558cb[_0xac95('0x34')][_0xac95('0x3b')]);_0x30ff1c[_0xac95('0x3c')]=qs[_0xac95('0x3d')](_[_0xac95('0x3e')](_0x4558cb[_0xac95('0x34')],_0xdc4399[_0xac95('0x3d')]),_0x30e276);if(_0x4558cb[_0xac95('0x34')][_0xac95('0x3f')]){_0x30ff1c['where']=_[_0xac95('0x40')](_0x30ff1c[_0xac95('0x3c')],{'$or':_[_0xac95('0x33')](_0x30e276,function(_0x46acf4){if(_0x46acf4['type']!=='VIRTUAL'){var _0x4401a6={};_0x4401a6[_0x46acf4[_0xac95('0x2b')]]={'$like':'%'+_0x4558cb[_0xac95('0x34')]['filter']+'%'};return _0x4401a6;}})});}_0x30ff1c=_['merge']({},_0x30ff1c,_0x4558cb['options']);var _0x446e6d={'where':_0x30ff1c[_0xac95('0x3c')]};return db[_0xac95('0x2d')][_0xac95('0x22')](_0x446e6d)[_0xac95('0x29')](function(_0x53f47b){_0x5c8453[_0xac95('0x22')]=_0x53f47b;if(_0x4558cb['query'][_0xac95('0x41')]){_0x30ff1c[_0xac95('0x42')]=[{'all':!![]}];}return db[_0xac95('0x2d')][_0xac95('0x43')](_0x30ff1c);})[_0xac95('0x29')](function(_0x447363){_0x5c8453[_0xac95('0x44')]=_0x447363;return _0x5c8453;})[_0xac95('0x29')](respondWithFilteredResult(_0x5f3e83,_0x30ff1c))[_0xac95('0x45')](handleError(_0x5f3e83,null));};exports[_0xac95('0x46')]=function(_0x52927b,_0xc1f86b){var _0x33b313={'raw':![],'where':{'id':_0x52927b[_0xac95('0x47')]['id']}},_0x494bca={};_0x494bca[_0xac95('0x32')]=_[_0xac95('0x35')](db[_0xac95('0x2d')]['rawAttributes']);_0x494bca[_0xac95('0x34')]=_[_0xac95('0x35')](_0x52927b['query']);_0x494bca[_0xac95('0x3d')]=_[_0xac95('0x36')](_0x494bca['model'],_0x494bca[_0xac95('0x34')]);_0x33b313[_0xac95('0x37')]=_['intersection'](_0x494bca[_0xac95('0x32')],qs[_0xac95('0x38')](_0x52927b['query'][_0xac95('0x38')]));_0x33b313[_0xac95('0x37')]=_0x33b313[_0xac95('0x37')]['length']?_0x33b313['attributes']:_0x494bca[_0xac95('0x32')];if(_0x52927b[_0xac95('0x34')]['includeAll']){_0x33b313[_0xac95('0x42')]=[{'all':!![]}];}_0x33b313=_['merge']({},_0x33b313,_0x52927b[_0xac95('0x48')]);return db[_0xac95('0x2d')]['find'](_0x33b313)[_0xac95('0x29')](handleEntityNotFound(_0xc1f86b,null))[_0xac95('0x29')](respondWithResult(_0xc1f86b,null))[_0xac95('0x45')](handleError(_0xc1f86b,null));};exports[_0xac95('0x49')]=function(_0x3bcf73,_0x3de8b2){return db[_0xac95('0x2d')][_0xac95('0x49')](_0x3bcf73[_0xac95('0x4a')],{})['then'](function(_0x694f32){var _0x3166d3=_0x3bcf73['user'][_0xac95('0x4b')]({'plain':!![]});if(!_0x3166d3)throw new Error(_0xac95('0x4c'));if(_0x3166d3[_0xac95('0x4d')]==='user'){var _0x1dd340=_0x694f32[_0xac95('0x4b')]({'plain':!![]});var _0x2f197f='Teams';return db['UserProfileSection'][_0xac95('0x4e')]({'where':{'name':_0x2f197f,'userProfileId':_0x3166d3[_0xac95('0x4f')]},'raw':!![]})[_0xac95('0x29')](function(_0x3ae38a){if(_0x3ae38a&&_0x3ae38a[_0xac95('0x50')]===0x0){return db[_0xac95('0x51')]['create']({'name':_0x1dd340[_0xac95('0x2b')],'resourceId':_0x1dd340['id'],'type':_0x3ae38a[_0xac95('0x2b')],'sectionId':_0x3ae38a['id']},{})[_0xac95('0x29')](function(){return _0x694f32;});}else{return _0x694f32;}})[_0xac95('0x45')](function(_0xf0e46e){logger[_0xac95('0x52')](_0xac95('0x53'),_0xf0e46e);throw _0xf0e46e;});}return _0x694f32;})[_0xac95('0x29')](respondWithResult(_0x3de8b2,0xc9))['catch'](handleError(_0x3de8b2,null));};exports[_0xac95('0x28')]=function(_0x179eb6,_0x542298){if(_0x179eb6[_0xac95('0x4a')]['id']){delete _0x179eb6[_0xac95('0x4a')]['id'];}return db[_0xac95('0x2d')][_0xac95('0x4e')]({'where':{'id':_0x179eb6[_0xac95('0x47')]['id']}})[_0xac95('0x29')](handleEntityNotFound(_0x542298,null))[_0xac95('0x29')](saveUpdates(_0x179eb6[_0xac95('0x4a')],null))['then'](respondWithResult(_0x542298,null))[_0xac95('0x45')](handleError(_0x542298,null));};exports[_0xac95('0x54')]=function(_0x4ccc76,_0x420d2b){var _0x7fe041=_0x4ccc76[_0xac95('0x47')]['id'];var _0x8c42e9=[];return db[_0xac95('0x55')]['transaction'](function(_0x4fde63){var _0x1ff3e5=_0xac95('0x56')+_0x7fe041;return db[_0xac95('0x55')]['query'](_0x1ff3e5,{'type':db[_0xac95('0x57')]['QueryTypes'][_0xac95('0x58')],'raw':!![],'transaction':_0x4fde63})[_0xac95('0x29')](function(_0x29b00d){_0x8c42e9=_['map'](_0x29b00d,function(_0x11cf2b){return Number(_0x11cf2b[_0xac95('0x59')]);});})[_0xac95('0x29')](function(){var _0x5b0803=_0xac95('0x5a')+_0x7fe041;return db[_0xac95('0x55')]['query'](_0x5b0803,{'type':db[_0xac95('0x57')][_0xac95('0x5b')]['SELECT'],'raw':!![],'transaction':_0x4fde63});})['then'](function(_0x3c183b){var _0x224212=_[_0xac95('0x33')](_0x3c183b,function(_0x42dcab){return Number(_0x42dcab[_0xac95('0x5c')]);});return db[_0xac95('0x5d')][_0xac95('0x54')]({'where':{'UserId':{'$in':_0x8c42e9},'VoiceQueueId':{'$in':_0x224212}},'transaction':_0x4fde63});})['then'](function(){var _0x306c26='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x7fe041;return db['sequelize'][_0xac95('0x34')](_0x306c26,{'type':db[_0xac95('0x57')][_0xac95('0x5b')][_0xac95('0x58')],'raw':!![],'transaction':_0x4fde63});})[_0xac95('0x29')](function(_0x43f24a){var _0x2b8092=_['map'](_0x43f24a,function(_0x4076ea){return Number(_0x4076ea['MailQueueId']);});return db[_0xac95('0x5e')][_0xac95('0x54')]({'where':{'UserId':{'$in':_0x8c42e9},'MailQueueId':{'$in':_0x2b8092}},'transaction':_0x4fde63});})[_0xac95('0x29')](function(){var _0x59057c=_0xac95('0x5f')+_0x7fe041;return db[_0xac95('0x55')]['query'](_0x59057c,{'type':db[_0xac95('0x57')][_0xac95('0x5b')][_0xac95('0x58')],'raw':!![],'transaction':_0x4fde63});})[_0xac95('0x29')](function(_0x5910f3){var _0x2be3a2=_[_0xac95('0x33')](_0x5910f3,function(_0x21a72e){return Number(_0x21a72e[_0xac95('0x60')]);});return db[_0xac95('0x61')]['destroy']({'where':{'UserId':{'$in':_0x8c42e9},'SmsQueueId':{'$in':_0x2be3a2}},'transaction':_0x4fde63});})[_0xac95('0x29')](function(){var _0x5aaa3=_0xac95('0x62')+_0x7fe041;return db[_0xac95('0x55')][_0xac95('0x34')](_0x5aaa3,{'type':db['Sequelize'][_0xac95('0x5b')][_0xac95('0x58')],'raw':!![],'transaction':_0x4fde63});})[_0xac95('0x29')](function(_0xbf88c5){var _0x5196e5=_[_0xac95('0x33')](_0xbf88c5,function(_0x49aa39){return Number(_0x49aa39[_0xac95('0x63')]);});return db[_0xac95('0x64')][_0xac95('0x54')]({'where':{'UserId':{'$in':_0x8c42e9},'ChatQueueId':{'$in':_0x5196e5}},'transaction':_0x4fde63});})[_0xac95('0x29')](function(){var _0x9713e0='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x7fe041;return db['sequelize'][_0xac95('0x34')](_0x9713e0,{'type':db[_0xac95('0x57')][_0xac95('0x5b')][_0xac95('0x58')],'raw':!![],'transaction':_0x4fde63});})[_0xac95('0x29')](function(_0x3693e7){var _0x41f161=_[_0xac95('0x33')](_0x3693e7,function(_0x8d8b43){return Number(_0x8d8b43[_0xac95('0x65')]);});return db[_0xac95('0x66')]['destroy']({'where':{'UserId':{'$in':_0x8c42e9},'FaxQueueId':{'$in':_0x41f161}},'transaction':_0x4fde63});})[_0xac95('0x29')](function(){var _0x1c01f7=_0xac95('0x67')+_0x7fe041;return db[_0xac95('0x55')]['query'](_0x1c01f7,{'type':db[_0xac95('0x57')][_0xac95('0x5b')]['SELECT'],'raw':!![],'transaction':_0x4fde63});})[_0xac95('0x29')](function(_0x40d425){var _0x5ca89a=_[_0xac95('0x33')](_0x40d425,function(_0x4c002a){return Number(_0x4c002a[_0xac95('0x68')]);});return db[_0xac95('0x69')][_0xac95('0x54')]({'where':{'UserId':{'$in':_0x8c42e9},'OpenchannelQueueId':{'$in':_0x5ca89a}},'transaction':_0x4fde63});})['then'](function(){var _0x204890=_0xac95('0x6a')+_0x7fe041;return db[_0xac95('0x55')][_0xac95('0x34')](_0x204890,{'type':db[_0xac95('0x57')][_0xac95('0x5b')]['SELECT'],'raw':!![],'transaction':_0x4fde63});})[_0xac95('0x29')](function(_0x4493f9){var _0x1538b2=_[_0xac95('0x33')](_0x4493f9,function(_0x350fbf){return Number(_0x350fbf[_0xac95('0x6b')]);});return db[_0xac95('0x6c')][_0xac95('0x54')]({'where':{'UserId':{'$in':_0x8c42e9},'WhatsappQueueId':{'$in':_0x1538b2}},'transaction':_0x4fde63});})[_0xac95('0x29')](function(){return db[_0xac95('0x6d')][_0xac95('0x4e')]({'where':{'TeamId':_0x7fe041}});})[_0xac95('0x29')](function(_0x1e8607){if(_0x1e8607===null){return;}return db[_0xac95('0x6e')][_0xac95('0x54')]({'where':{'UserId':{'$in':_0x8c42e9},'VoicePrefixId':_0x1e8607[_0xac95('0x6f')]},'transaction':_0x4fde63});})[_0xac95('0x29')](function(){return db['Team'][_0xac95('0x54')]({'where':{'id':_0x7fe041},'cascade':!![],'transaction':_0x4fde63});})[_0xac95('0x29')](function(_0x31e5d0){if(_0x31e5d0===0x0){_0x420d2b['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xac95('0x54')]({'where':{'type':'Teams','resourceId':_0x7fe041},'cascade':!![],'transaction':_0x4fde63})[_0xac95('0x29')](function(){_0x420d2b[_0xac95('0x1d')](0xcc)[_0xac95('0x70')]();});}})['catch'](function(_0x1ae420){_0x420d2b[_0xac95('0x1d')](0x1f4)[_0xac95('0x2c')](_0x1ae420);});});};exports[_0xac95('0x71')]=function(_0x2eae22,_0x8504c5,_0x22059a){return db['Team']['findOne']({'where':{'id':_0x2eae22[_0xac95('0x47')]['id']}})['then'](handleEntityNotFound(_0x8504c5,null))[_0xac95('0x29')](function(_0x465702){if(!_0x2eae22['query'][_0xac95('0x72')]||!utils[_0xac95('0x73')](_0x2eae22[_0xac95('0x34')][_0xac95('0x72')])){throw new db[(_0xac95('0x57'))][(_0xac95('0x74'))](_0xac95('0x75'));}var _0x28201c={};var _0x2d485e={};_0x2d485e[_0xac95('0x32')]=_[_0xac95('0x35')](db[_[_0xac95('0x76')](_0x2eae22[_0xac95('0x34')][_0xac95('0x72')][_0xac95('0x77')]())+_0xac95('0x78')][_0xac95('0x2e')]);_0x2d485e[_0xac95('0x34')]=_[_0xac95('0x35')](_0x2eae22['query']);_0x2d485e[_0xac95('0x3d')]=_[_0xac95('0x36')](_0x2d485e['model'],_0x2d485e[_0xac95('0x34')]);_0x28201c['attributes']=_[_0xac95('0x36')](_0x2d485e['model'],qs['fields'](_0x2eae22[_0xac95('0x34')]['fields']));_0x28201c[_0xac95('0x37')]=_0x28201c[_0xac95('0x37')][_0xac95('0x39')]?_0x28201c[_0xac95('0x37')]:_0x2d485e[_0xac95('0x32')];_0x28201c['limit']=qs[_0xac95('0x20')](_0x2eae22['query'][_0xac95('0x20')]);_0x28201c[_0xac95('0x1f')]=qs[_0xac95('0x1f')](_0x2eae22[_0xac95('0x34')]['offset']);_0x28201c[_0xac95('0x3a')]=qs['sort'](_0x2eae22[_0xac95('0x34')]['sort']);_0x28201c[_0xac95('0x3c')]=qs[_0xac95('0x3d')](_[_0xac95('0x3e')](_0x2eae22[_0xac95('0x34')],_0x2d485e[_0xac95('0x3d')]));_0x28201c=_['merge']({},_0x28201c,_0x2eae22[_0xac95('0x48')]);return _0x465702[_0xac95('0x4b')+_[_0xac95('0x76')](_0x2eae22[_0xac95('0x34')][_0xac95('0x72')][_0xac95('0x77')]())+_0xac95('0x79')](_0x28201c);})[_0xac95('0x29')](respondWithResult(_0x8504c5,null))[_0xac95('0x45')](handleError(_0x8504c5,null));};exports[_0xac95('0x7a')]=function(_0x1fe2b0,_0x1d8e76,_0x4a1f47){return db[_0xac95('0x2d')][_0xac95('0x7b')]({'where':{'id':_0x1fe2b0['params']['id']}})[_0xac95('0x29')](function(_0x3dc86b){if(_0x3dc86b){if(!_0x1fe2b0[_0xac95('0x4a')][_0xac95('0x72')]||!utils[_0xac95('0x73')](_0x1fe2b0[_0xac95('0x4a')][_0xac95('0x72')])){throw new db[(_0xac95('0x57'))][(_0xac95('0x74'))](_0xac95('0x75'));}return _0x3dc86b[_0xac95('0x7c')+_[_0xac95('0x76')](_0x1fe2b0[_0xac95('0x4a')][_0xac95('0x72')]['toLowerCase']())+_0xac95('0x79')](_0x1fe2b0[_0xac95('0x4a')]['ids']);}return null;})[_0xac95('0x29')](handleEntityNotFound(_0x1d8e76,null))['then'](respondWithStatusCode(_0x1d8e76,null))['catch'](handleError(_0x1d8e76,null));};exports[_0xac95('0x7d')]=function(_0xe69a43,_0x7f92ca,_0xf100d9){return db[_0xac95('0x2d')]['findOne']({'where':{'id':_0xe69a43[_0xac95('0x47')]['id']}})[_0xac95('0x29')](function(_0xd57352){if(_0xd57352){if(!_0xe69a43['query'][_0xac95('0x72')]||!utils[_0xac95('0x73')](_0xe69a43[_0xac95('0x34')][_0xac95('0x72')])){throw new db[(_0xac95('0x57'))][(_0xac95('0x74'))](_0xac95('0x75'));}return _0xd57352[_0xac95('0x7e')+_[_0xac95('0x76')](_0xe69a43[_0xac95('0x34')][_0xac95('0x72')][_0xac95('0x77')]())+'Queues'](_0xe69a43[_0xac95('0x34')][_0xac95('0x7f')]);}return null;})[_0xac95('0x29')](handleEntityNotFound(_0x7f92ca,null))['then'](respondWithStatusCode(_0x7f92ca,null))[_0xac95('0x45')](handleError(_0x7f92ca,null));};exports[_0xac95('0x80')]=function(_0x227c01,_0x66804d){var _0x5a6f79=_[_0xac95('0x81')](_0x227c01['body']['ids'])?_0x227c01[_0xac95('0x4a')]['ids']:[_0x227c01[_0xac95('0x4a')][_0xac95('0x7f')]];var _0x407d11=_0x227c01[_0xac95('0x47')]['id'];return db['Team'][_0xac95('0x4e')]({'where':{'id':_0x407d11}})['then'](handleEntityNotFound(_0x66804d,null))[_0xac95('0x29')](function(_0x266564){if(_0x266564){var _0x3c402a=[_0xac95('0x82'),_0xac95('0x83'),'Mail','Sms',_0xac95('0x84'),_0xac95('0x85'),'Whatsapp'];return db[_0xac95('0x55')]['transaction'](function(_0x18331a){var _0x418b9f=_[_0xac95('0x33')](_0x3c402a,function(_0x2e6860){var _0x51117a={'attributes':['id','name']};if(_0x2e6860===_0xac95('0x82')){_0x51117a[_0xac95('0x86')]={'attributes':[_0xac95('0x87')]};}return _0x266564[_0xac95('0x4b')+_0x2e6860+'Queues'](_0x51117a)['then'](function(_0x5c25bd){var _0x3c158f=_[_0xac95('0x33')](_0x5c25bd,function(_0x43329d){var _0x1dd81d=_[_0xac95('0x33')](_0x5a6f79,function(_0xa4711c){var _0x2c6082={'where':{'UserId':_0xa4711c,[_0x2e6860+_0xac95('0x88')]:_0x43329d['id']},'transaction':_0x18331a};if(_0x2e6860==='Voice'){_0x2c6082['defaults']={'penalty':_0x43329d[_0xac95('0x89')][_0xac95('0x87')]};}return db[_0xac95('0x8a')+_0x2e6860+_0xac95('0x78')][_0xac95('0x8b')](_0x2c6082)['then'](function(){socket[_0xac95('0x8c')](_0xac95('0x8d')+_0x2e6860+'Queue:save',{'UserId':_0xa4711c,[_0x2e6860+_0xac95('0x88')]:_0x43329d['id']});if(_0x2e6860!==_0xac95('0x82')){return;}return db[_0xac95('0x8a')][_0xac95('0x43')]({'where':{'id':_0x5a6f79,'online':0x1},'attributes':['id','name','online',_0xac95('0x8e'),_0xac95('0x8f')],'raw':!![]})['then'](function(_0x5df0ad){var _0x52e6ab=_[_0xac95('0x33')](_0x5df0ad,function(_0xbcc659){return db[_0xac95('0x90')][_0xac95('0x91')]({'membername':_0xbcc659[_0xac95('0x2b')],'UserId':_0xbcc659['id'],'queue_name':_0x43329d[_0xac95('0x2b')],'VoiceQueueId':_0x43329d['id'],'interface':_[_0xac95('0x92')](_0xbcc659[_0xac95('0x8f')])?util[_0xac95('0x93')](_0xac95('0x94'),_0xbcc659['name']):_0xbcc659[_0xac95('0x8f')],'paused':_0xbcc659[_0xac95('0x8e')]||![],'penalty':_0x43329d[_0xac95('0x89')][_0xac95('0x87')]},{'transaction':_0x18331a});});return Promise[_0xac95('0x95')](_0x52e6ab);});});});return Promise[_0xac95('0x95')](_0x1dd81d);});return Promise[_0xac95('0x95')](_0x3c158f);})[_0xac95('0x29')](function(){return db['TeamVoicePrefix'][_0xac95('0x7b')]({'where':{'teamId':_0x407d11}})[_0xac95('0x29')](function(_0x9c356b){if(_0x9c356b){var _0x2a18a3=_['map'](_0x5a6f79,function(_0x2abdba){db[_0xac95('0x6e')][_0xac95('0x91')]({'UserId':_0x2abdba,'VoicePrefixId':_0x9c356b[_0xac95('0x6f')]});});return Promise['all'](_0x2a18a3);}});});});return Promise[_0xac95('0x95')](_0x418b9f)[_0xac95('0x29')](function(){return _0x266564[_0xac95('0x80')](_0x5a6f79,{'transaction':_0x18331a})[_0xac95('0x96')](function(_0x56a5b3){return _0x56a5b3;});});});}})[_0xac95('0x29')](respondWithResult(_0x66804d,null))[_0xac95('0x45')](handleError(_0x66804d,null));};exports['removeAgents']=function(_0x4ae72a,_0x12786b){var _0x39a78f=_[_0xac95('0x81')](_0x4ae72a[_0xac95('0x34')][_0xac95('0x7f')])?_0x4ae72a[_0xac95('0x34')][_0xac95('0x7f')]:[_0x4ae72a[_0xac95('0x34')][_0xac95('0x7f')]];var _0x1c2763=_0x4ae72a[_0xac95('0x47')]['id'];return db[_0xac95('0x2d')][_0xac95('0x4e')]({'where':{'id':_0x1c2763}})[_0xac95('0x29')](handleEntityNotFound(_0x12786b,null))[_0xac95('0x29')](function(_0x251e23){if(_0x251e23){var _0x42963e=[_0xac95('0x82'),_0xac95('0x83'),'Mail',_0xac95('0x97'),_0xac95('0x84'),_0xac95('0x85'),'Whatsapp'];return db['sequelize']['transaction'](function(_0xcba91f){var _0x23e4c5=_['map'](_0x42963e,function(_0x52b71c){var _0x404986={'attributes':['id',_0xac95('0x2b')]};return _0x251e23[_0xac95('0x4b')+_0x52b71c+'Queues'](_0x404986)[_0xac95('0x29')](function(_0x416ab8){var _0x3e19cf=_[_0xac95('0x33')](_0x416ab8,function(_0x1dcbc7){return _0x1dcbc7[_0xac95('0x98')](_0x39a78f,{'transaction':_0xcba91f})[_0xac95('0x29')](function(){var _0x505a96=_[_0xac95('0x33')](_0x39a78f,function(_0x398419){socket[_0xac95('0x8c')]('user'+_0x52b71c+_0xac95('0x99'),{'UserId':Number(_0x398419),[_0x52b71c+_0xac95('0x88')]:_0x1dcbc7['id']});if(_0x52b71c!=='Voice'){return;}return db['UserVoiceQueueRt'][_0xac95('0x54')]({'where':{'VoiceQueueId':_0x1dcbc7['id'],'UserId':_0x398419},'transaction':_0xcba91f});});return Promise[_0xac95('0x95')](_0x505a96);});});return Promise[_0xac95('0x95')](_0x3e19cf);});});return Promise[_0xac95('0x95')](_0x23e4c5)['then'](function(){return _0x251e23[_0xac95('0x98')](_0x39a78f,{'transaction':_0xcba91f});})[_0xac95('0x29')](function(){return db[_0xac95('0x6d')][_0xac95('0x7b')]({'where':{'teamId':_0x1c2763}})['then'](function(_0x11e0d4){if(_0x11e0d4){var _0x56de0a=_['map'](_0x39a78f,function(_0x244bfb){db[_0xac95('0x6e')][_0xac95('0x54')]({'where':{'UserId':_0x244bfb,'VoicePrefixId':_0x11e0d4['VoicePrefixId']}});});return Promise[_0xac95('0x95')](_0x56de0a);}});});});}})[_0xac95('0x29')](respondWithStatusCode(_0x12786b,null))[_0xac95('0x45')](handleError(_0x12786b,null));};exports[_0xac95('0x9a')]=function(_0x297285,_0x2eccc2,_0x25410f){var _0x426477={};var _0x42de94={};var _0x3c1fed;var _0x541dbb;return db[_0xac95('0x2d')]['findOne']({'where':{'id':_0x297285['params']['id']}})['then'](handleEntityNotFound(_0x2eccc2,null))[_0xac95('0x29')](function(_0x2f612b){if(_0x2f612b){_0x3c1fed=_0x2f612b;_0x42de94['model']=_[_0xac95('0x35')](db['User']['rawAttributes']);_0x42de94[_0xac95('0x34')]=_['keys'](_0x297285['query']);_0x42de94['filters']=_[_0xac95('0x36')](_0x42de94[_0xac95('0x32')],_0x42de94[_0xac95('0x34')]);_0x426477['attributes']=_['intersection'](_0x42de94[_0xac95('0x32')],qs[_0xac95('0x38')](_0x297285[_0xac95('0x34')][_0xac95('0x38')]));_0x426477[_0xac95('0x37')]=_0x426477['attributes'][_0xac95('0x39')]?_0x426477[_0xac95('0x37')]:_0x42de94[_0xac95('0x32')];_0x426477[_0xac95('0x3a')]=qs[_0xac95('0x3b')](_0x297285[_0xac95('0x34')]['sort']);_0x426477[_0xac95('0x3c')]=qs[_0xac95('0x3d')](_['pick'](_0x297285['query'],_0x42de94['filters']));if(_0x297285[_0xac95('0x34')]['filter']){_0x426477['where']=_[_0xac95('0x40')](_0x426477[_0xac95('0x3c')],{'$or':_[_0xac95('0x33')](_0x426477[_0xac95('0x37')],function(_0x57280a){var _0xd926e5={};_0xd926e5[_0x57280a]={'$like':'%'+_0x297285[_0xac95('0x34')][_0xac95('0x3f')]+'%'};return _0xd926e5;})});}_0x426477=_[_0xac95('0x40')]({},_0x426477,_0x297285[_0xac95('0x48')]);return _0x3c1fed[_0xac95('0x9a')](_0x426477);}})[_0xac95('0x29')](function(_0x108da7){if(_0x108da7){_0x541dbb=_0x108da7['length'];if(!_0x297285[_0xac95('0x34')][_0xac95('0x9b')](_0xac95('0x9c'))){_0x426477[_0xac95('0x20')]=qs[_0xac95('0x20')](_0x297285['query'][_0xac95('0x20')]);_0x426477[_0xac95('0x1f')]=qs[_0xac95('0x1f')](_0x297285[_0xac95('0x34')][_0xac95('0x1f')]);}return _0x3c1fed['getAgents'](_0x426477);}})[_0xac95('0x29')](function(_0x3899a3){if(_0x3899a3){return _0x3899a3?{'count':_0x541dbb,'rows':_0x3899a3}:null;}})[_0xac95('0x29')](respondWithResult(_0x2eccc2,null))[_0xac95('0x45')](handleError(_0x2eccc2,null));};
\ No newline at end of file
+var _0xe6f2=['OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','getQueues','params','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','findOne','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','findOrCreate','Queue:save','QueueId','User','findAll','online','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','VoicePrefixId','spread','removeAgents','emit','Queue:remove','getAgents','nolimit','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','error','send','index','map','Team','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','then','includeAll','rows','catch','show','keys','include','find','create','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x5d4c75,_0x13deae){var _0x8410b1=function(_0x3a76f3){while(--_0x3a76f3){_0x5d4c75['push'](_0x5d4c75['shift']());}};_0x8410b1(++_0x13deae);}(_0xe6f2,0xd1));var _0x2e6f=function(_0x425008,_0x21c494){_0x425008=_0x425008-0x0;var _0x5f1001=_0xe6f2[_0x425008];return _0x5f1001;};'use strict';var emlformat=require(_0x2e6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2e6f('0x2'));var moment=require('moment');var BPromise=require(_0x2e6f('0x3'));var Mustache=require(_0x2e6f('0x4'));var util=require(_0x2e6f('0x5'));var path=require(_0x2e6f('0x6'));var sox=require('sox');var csv=require(_0x2e6f('0x7'));var ejs=require(_0x2e6f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e6f('0x9'));var squel=require(_0x2e6f('0xa'));var crypto=require(_0x2e6f('0xb'));var jsforce=require(_0x2e6f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2e6f('0xd'));var Papa=require(_0x2e6f('0xe'));var Redis=require(_0x2e6f('0xf'));var authService=require(_0x2e6f('0x10'));var qs=require(_0x2e6f('0x11'));var as=require(_0x2e6f('0x12'));var hardwareService=require(_0x2e6f('0x13'));var logger=require(_0x2e6f('0x14'))(_0x2e6f('0x15'));var utils=require(_0x2e6f('0x16'));var config=require(_0x2e6f('0x17'));var licenseUtil=require(_0x2e6f('0x18'));var db=require(_0x2e6f('0x19'))['db'];config[_0x2e6f('0x1a')]=_[_0x2e6f('0x1b')](config[_0x2e6f('0x1a')],{'host':_0x2e6f('0x1c'),'port':0x18eb});var socket=require(_0x2e6f('0x1d'))(new Redis(config[_0x2e6f('0x1a')]));require('./team.socket')[_0x2e6f('0x1e')](socket);function respondWithStatusCode(_0x3400b9,_0x2bb0c3){_0x2bb0c3=_0x2bb0c3||0xcc;return function(_0x2fd653){if(_0x2fd653){return _0x3400b9[_0x2e6f('0x1f')](_0x2bb0c3);}return _0x3400b9['status'](_0x2bb0c3)['end']();};}function respondWithResult(_0x25eafa,_0x51e74e){_0x51e74e=_0x51e74e||0xc8;return function(_0x24b925){if(_0x24b925){return _0x25eafa[_0x2e6f('0x20')](_0x51e74e)[_0x2e6f('0x21')](_0x24b925);}};}function respondWithFilteredResult(_0x3d04d5,_0x3973d0){return function(_0x514283){if(_0x514283){var _0x10d424=typeof _0x3973d0[_0x2e6f('0x22')]===_0x2e6f('0x23')&&typeof _0x3973d0[_0x2e6f('0x24')]===_0x2e6f('0x23');var _0x4ba1ed=_0x514283['count'];var _0xe0d2c7=_0x10d424?0x0:_0x3973d0[_0x2e6f('0x22')];var _0x1b0115=_0x10d424?_0x514283[_0x2e6f('0x25')]:_0x3973d0[_0x2e6f('0x22')]+_0x3973d0[_0x2e6f('0x24')];var _0x5f25dc;if(_0x1b0115>=_0x4ba1ed){_0x1b0115=_0x4ba1ed;_0x5f25dc=0xc8;}else{_0x5f25dc=0xce;}_0x3d04d5[_0x2e6f('0x20')](_0x5f25dc);return _0x3d04d5['set']('Content-Range',_0xe0d2c7+'-'+_0x1b0115+'/'+_0x4ba1ed)['json'](_0x514283);}return null;};}function patchUpdates(_0x2c09b2){return function(_0x3ad924){try{jsonpatch['apply'](_0x3ad924,_0x2c09b2,!![]);}catch(_0xbba393){return BPromise[_0x2e6f('0x26')](_0xbba393);}return _0x3ad924[_0x2e6f('0x27')]();};}function saveUpdates(_0xf91ba2,_0x122801){return function(_0x22ac15){if(_0x22ac15){return _0x22ac15[_0x2e6f('0x28')](_0xf91ba2)['then'](function(_0x44c26c){return _0x44c26c;});}return null;};}function handleEntityNotFound(_0x2bc517,_0x48385e){return function(_0x2ddd71){if(!_0x2ddd71){_0x2bc517['sendStatus'](0x194);}return _0x2ddd71;};}function handleError(_0xf66b89,_0x5e637f){_0x5e637f=_0x5e637f||0x1f4;return function(_0x596c04){logger[_0x2e6f('0x29')](_0x596c04['stack']);if(_0x596c04['name']){delete _0x596c04['name'];}_0xf66b89[_0x2e6f('0x20')](_0x5e637f)[_0x2e6f('0x2a')](_0x596c04);};}exports[_0x2e6f('0x2b')]=function(_0x47c2de,_0x21bd3e){var _0x45f12a={},_0x4a9cce={},_0x175e97={'count':0x0,'rows':[]};var _0x320b30=_[_0x2e6f('0x2c')](db[_0x2e6f('0x2d')][_0x2e6f('0x2e')],function(_0x26e42b){return{'name':_0x26e42b['fieldName'],'type':_0x26e42b[_0x2e6f('0x2f')][_0x2e6f('0x30')]};});_0x4a9cce[_0x2e6f('0x31')]=_[_0x2e6f('0x2c')](_0x320b30,'name');_0x4a9cce[_0x2e6f('0x32')]=_['keys'](_0x47c2de[_0x2e6f('0x32')]);_0x4a9cce[_0x2e6f('0x33')]=_[_0x2e6f('0x34')](_0x4a9cce[_0x2e6f('0x31')],_0x4a9cce['query']);_0x45f12a['attributes']=_[_0x2e6f('0x34')](_0x4a9cce[_0x2e6f('0x31')],qs[_0x2e6f('0x35')](_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x35')]));_0x45f12a['attributes']=_0x45f12a[_0x2e6f('0x36')][_0x2e6f('0x37')]?_0x45f12a['attributes']:_0x4a9cce['model'];if(!_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x38')]('nolimit')){_0x45f12a[_0x2e6f('0x24')]=qs['limit'](_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x24')]);_0x45f12a[_0x2e6f('0x22')]=qs[_0x2e6f('0x22')](_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x22')]);}_0x45f12a[_0x2e6f('0x39')]=qs[_0x2e6f('0x3a')](_0x47c2de[_0x2e6f('0x32')]['sort']);_0x45f12a[_0x2e6f('0x3b')]=qs[_0x2e6f('0x33')](_[_0x2e6f('0x3c')](_0x47c2de[_0x2e6f('0x32')],_0x4a9cce[_0x2e6f('0x33')]),_0x320b30);if(_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x3d')]){_0x45f12a[_0x2e6f('0x3b')]=_[_0x2e6f('0x3e')](_0x45f12a[_0x2e6f('0x3b')],{'$or':_['map'](_0x320b30,function(_0x550604){if(_0x550604[_0x2e6f('0x2f')]!==_0x2e6f('0x3f')){var _0x5dc99c={};_0x5dc99c[_0x550604[_0x2e6f('0x40')]]={'$like':'%'+_0x47c2de['query'][_0x2e6f('0x3d')]+'%'};return _0x5dc99c;}})});}_0x45f12a=_[_0x2e6f('0x3e')]({},_0x45f12a,_0x47c2de[_0x2e6f('0x41')]);var _0x6a911b={'where':_0x45f12a[_0x2e6f('0x3b')]};return db[_0x2e6f('0x2d')]['count'](_0x6a911b)[_0x2e6f('0x42')](function(_0x505268){_0x175e97[_0x2e6f('0x25')]=_0x505268;if(_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x43')]){_0x45f12a['include']=[{'all':!![]}];}return db[_0x2e6f('0x2d')]['findAll'](_0x45f12a);})['then'](function(_0x1334e6){_0x175e97[_0x2e6f('0x44')]=_0x1334e6;return _0x175e97;})[_0x2e6f('0x42')](respondWithFilteredResult(_0x21bd3e,_0x45f12a))[_0x2e6f('0x45')](handleError(_0x21bd3e,null));};exports[_0x2e6f('0x46')]=function(_0x437716,_0x22c396){var _0x5837b3={'raw':![],'where':{'id':_0x437716['params']['id']}},_0x1bc063={};_0x1bc063[_0x2e6f('0x31')]=_[_0x2e6f('0x47')](db[_0x2e6f('0x2d')][_0x2e6f('0x2e')]);_0x1bc063['query']=_[_0x2e6f('0x47')](_0x437716['query']);_0x1bc063['filters']=_[_0x2e6f('0x34')](_0x1bc063['model'],_0x1bc063[_0x2e6f('0x32')]);_0x5837b3[_0x2e6f('0x36')]=_[_0x2e6f('0x34')](_0x1bc063[_0x2e6f('0x31')],qs[_0x2e6f('0x35')](_0x437716[_0x2e6f('0x32')][_0x2e6f('0x35')]));_0x5837b3[_0x2e6f('0x36')]=_0x5837b3[_0x2e6f('0x36')]['length']?_0x5837b3[_0x2e6f('0x36')]:_0x1bc063[_0x2e6f('0x31')];if(_0x437716[_0x2e6f('0x32')][_0x2e6f('0x43')]){_0x5837b3[_0x2e6f('0x48')]=[{'all':!![]}];}_0x5837b3=_[_0x2e6f('0x3e')]({},_0x5837b3,_0x437716[_0x2e6f('0x41')]);return db[_0x2e6f('0x2d')][_0x2e6f('0x49')](_0x5837b3)['then'](handleEntityNotFound(_0x22c396,null))[_0x2e6f('0x42')](respondWithResult(_0x22c396,null))[_0x2e6f('0x45')](handleError(_0x22c396,null));};exports[_0x2e6f('0x4a')]=function(_0x478a6c,_0xad246){return db['Team'][_0x2e6f('0x4a')](_0x478a6c['body'],{})[_0x2e6f('0x42')](function(_0x391e58){var _0x3d9741=_0x478a6c['user'][_0x2e6f('0x4b')]({'plain':!![]});if(!_0x3d9741)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d9741[_0x2e6f('0x4c')]===_0x2e6f('0x4d')){var _0x15c585=_0x391e58[_0x2e6f('0x4b')]({'plain':!![]});var _0x528271=_0x2e6f('0x4e');return db[_0x2e6f('0x4f')][_0x2e6f('0x49')]({'where':{'name':_0x528271,'userProfileId':_0x3d9741[_0x2e6f('0x50')]},'raw':!![]})[_0x2e6f('0x42')](function(_0x212e40){if(_0x212e40&&_0x212e40[_0x2e6f('0x51')]===0x0){return db[_0x2e6f('0x52')]['create']({'name':_0x15c585[_0x2e6f('0x40')],'resourceId':_0x15c585['id'],'type':_0x212e40[_0x2e6f('0x40')],'sectionId':_0x212e40['id']},{})[_0x2e6f('0x42')](function(){return _0x391e58;});}else{return _0x391e58;}})[_0x2e6f('0x45')](function(_0x23f9de){logger[_0x2e6f('0x29')](_0x2e6f('0x53'),_0x23f9de);throw _0x23f9de;});}return _0x391e58;})[_0x2e6f('0x42')](respondWithResult(_0xad246,0xc9))[_0x2e6f('0x45')](handleError(_0xad246,null));};exports[_0x2e6f('0x28')]=function(_0x16722c,_0x5c4172){if(_0x16722c['body']['id']){delete _0x16722c['body']['id'];}return db[_0x2e6f('0x2d')][_0x2e6f('0x49')]({'where':{'id':_0x16722c['params']['id']}})[_0x2e6f('0x42')](handleEntityNotFound(_0x5c4172,null))[_0x2e6f('0x42')](saveUpdates(_0x16722c[_0x2e6f('0x54')],null))[_0x2e6f('0x42')](respondWithResult(_0x5c4172,null))[_0x2e6f('0x45')](handleError(_0x5c4172,null));};exports['destroy']=function(_0x111239,_0x48d883){var _0x20af16=_0x111239['params']['id'];var _0x50f657=[];return db[_0x2e6f('0x55')][_0x2e6f('0x56')](function(_0x4ef695){var _0x4e1703='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x4e1703,{'type':db[_0x2e6f('0x57')][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695})[_0x2e6f('0x42')](function(_0x55479a){_0x50f657=_['map'](_0x55479a,function(_0x9f2d20){return Number(_0x9f2d20[_0x2e6f('0x5a')]);});})[_0x2e6f('0x42')](function(){var _0x21c807=_0x2e6f('0x5b')+_0x20af16;return db[_0x2e6f('0x55')]['query'](_0x21c807,{'type':db['Sequelize'][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x2f70ef){var _0x9bfcb=_[_0x2e6f('0x2c')](_0x2f70ef,function(_0x2ee20a){return Number(_0x2ee20a[_0x2e6f('0x5c')]);});return db[_0x2e6f('0x5d')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'VoiceQueueId':{'$in':_0x9bfcb}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x4f13a8='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x4f13a8,{'type':db[_0x2e6f('0x57')]['QueryTypes'][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x51da1d){var _0x55938e=_[_0x2e6f('0x2c')](_0x51da1d,function(_0x420981){return Number(_0x420981[_0x2e6f('0x5f')]);});return db[_0x2e6f('0x60')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'MailQueueId':{'$in':_0x55938e}},'transaction':_0x4ef695});})['then'](function(){var _0x362a26=_0x2e6f('0x61')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x362a26,{'type':db[_0x2e6f('0x57')][_0x2e6f('0x58')]['SELECT'],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x16a420){var _0x127ebe=_[_0x2e6f('0x2c')](_0x16a420,function(_0x2d0845){return Number(_0x2d0845[_0x2e6f('0x62')]);});return db[_0x2e6f('0x63')]['destroy']({'where':{'UserId':{'$in':_0x50f657},'SmsQueueId':{'$in':_0x127ebe}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x35ada3=_0x2e6f('0x64')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x35ada3,{'type':db[_0x2e6f('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x1d41e7){var _0x4c7798=_['map'](_0x1d41e7,function(_0x5ce265){return Number(_0x5ce265[_0x2e6f('0x65')]);});return db[_0x2e6f('0x66')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'ChatQueueId':{'$in':_0x4c7798}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x2b88b2=_0x2e6f('0x67')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x2b88b2,{'type':db[_0x2e6f('0x57')][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x510221){var _0x13b788=_['map'](_0x510221,function(_0x2660b8){return Number(_0x2660b8['FaxQueueId']);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x50f657},'FaxQueueId':{'$in':_0x13b788}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x523846=_0x2e6f('0x68')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x523846,{'type':db['Sequelize'][_0x2e6f('0x58')]['SELECT'],'raw':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x27ac86){var _0x4ebce4=_['map'](_0x27ac86,function(_0x3f719b){return Number(_0x3f719b[_0x2e6f('0x69')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x50f657},'OpenchannelQueueId':{'$in':_0x4ebce4}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x1ce2c1=_0x2e6f('0x6a')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x1ce2c1,{'type':db['Sequelize'][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x33f6f4){var _0x2de16c=_[_0x2e6f('0x2c')](_0x33f6f4,function(_0xf75eee){return Number(_0xf75eee[_0x2e6f('0x6b')]);});return db[_0x2e6f('0x6c')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'WhatsappQueueId':{'$in':_0x2de16c}},'transaction':_0x4ef695});})['then'](function(){return db['TeamVoicePrefix'][_0x2e6f('0x49')]({'where':{'TeamId':_0x20af16}});})[_0x2e6f('0x42')](function(_0x37906a){if(_0x37906a===null){return;}return db[_0x2e6f('0x6d')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'VoicePrefixId':_0x37906a['VoicePrefixId']},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){return db['Team'][_0x2e6f('0x5e')]({'where':{'id':_0x20af16},'cascade':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x313e1a){if(_0x313e1a===0x0){_0x48d883[_0x2e6f('0x1f')](0x194);}else{return db[_0x2e6f('0x52')][_0x2e6f('0x5e')]({'where':{'type':_0x2e6f('0x4e'),'resourceId':_0x20af16},'cascade':!![],'transaction':_0x4ef695})[_0x2e6f('0x42')](function(){_0x48d883[_0x2e6f('0x20')](0xcc)['end']();});}})[_0x2e6f('0x45')](function(_0x5dd798){_0x48d883[_0x2e6f('0x20')](0x1f4)[_0x2e6f('0x2a')](_0x5dd798);});});};exports[_0x2e6f('0x6e')]=function(_0xaec12b,_0x1be033,_0x1e0a02){return db[_0x2e6f('0x2d')]['findOne']({'where':{'id':_0xaec12b[_0x2e6f('0x6f')]['id']}})[_0x2e6f('0x42')](handleEntityNotFound(_0x1be033,null))[_0x2e6f('0x42')](function(_0xa44446){if(!_0xaec12b[_0x2e6f('0x32')][_0x2e6f('0x70')]||!utils[_0x2e6f('0x71')](_0xaec12b['query']['channel'])){throw new db[(_0x2e6f('0x57'))][(_0x2e6f('0x72'))](_0x2e6f('0x73'));}var _0x2364b1={};var _0x34c8b1={};_0x34c8b1[_0x2e6f('0x31')]=_['keys'](db[_[_0x2e6f('0x74')](_0xaec12b[_0x2e6f('0x32')][_0x2e6f('0x70')][_0x2e6f('0x75')]())+_0x2e6f('0x76')][_0x2e6f('0x2e')]);_0x34c8b1['query']=_['keys'](_0xaec12b[_0x2e6f('0x32')]);_0x34c8b1[_0x2e6f('0x33')]=_[_0x2e6f('0x34')](_0x34c8b1[_0x2e6f('0x31')],_0x34c8b1[_0x2e6f('0x32')]);_0x2364b1['attributes']=_[_0x2e6f('0x34')](_0x34c8b1[_0x2e6f('0x31')],qs['fields'](_0xaec12b['query'][_0x2e6f('0x35')]));_0x2364b1[_0x2e6f('0x36')]=_0x2364b1['attributes'][_0x2e6f('0x37')]?_0x2364b1[_0x2e6f('0x36')]:_0x34c8b1['model'];_0x2364b1[_0x2e6f('0x24')]=qs[_0x2e6f('0x24')](_0xaec12b[_0x2e6f('0x32')][_0x2e6f('0x24')]);_0x2364b1[_0x2e6f('0x22')]=qs[_0x2e6f('0x22')](_0xaec12b[_0x2e6f('0x32')]['offset']);_0x2364b1['order']=qs[_0x2e6f('0x3a')](_0xaec12b['query'][_0x2e6f('0x3a')]);_0x2364b1[_0x2e6f('0x3b')]=qs[_0x2e6f('0x33')](_[_0x2e6f('0x3c')](_0xaec12b[_0x2e6f('0x32')],_0x34c8b1[_0x2e6f('0x33')]));_0x2364b1=_[_0x2e6f('0x3e')]({},_0x2364b1,_0xaec12b['options']);return _0xa44446[_0x2e6f('0x4b')+_[_0x2e6f('0x74')](_0xaec12b['query'][_0x2e6f('0x70')][_0x2e6f('0x75')]())+_0x2e6f('0x77')](_0x2364b1);})[_0x2e6f('0x42')](respondWithResult(_0x1be033,null))[_0x2e6f('0x45')](handleError(_0x1be033,null));};exports[_0x2e6f('0x78')]=function(_0x4d44ff,_0x28bcab,_0x1d87a6){return db[_0x2e6f('0x2d')][_0x2e6f('0x79')]({'where':{'id':_0x4d44ff[_0x2e6f('0x6f')]['id']}})[_0x2e6f('0x42')](function(_0x2b92ea){if(_0x2b92ea){if(!_0x4d44ff['body']['channel']||!utils[_0x2e6f('0x71')](_0x4d44ff[_0x2e6f('0x54')][_0x2e6f('0x70')])){throw new db[(_0x2e6f('0x57'))]['ValidationError'](_0x2e6f('0x73'));}return _0x2b92ea[_0x2e6f('0x7a')+_[_0x2e6f('0x74')](_0x4d44ff[_0x2e6f('0x54')][_0x2e6f('0x70')]['toLowerCase']())+'Queues'](_0x4d44ff[_0x2e6f('0x54')][_0x2e6f('0x7b')]);}return null;})[_0x2e6f('0x42')](handleEntityNotFound(_0x28bcab,null))[_0x2e6f('0x42')](respondWithStatusCode(_0x28bcab,null))['catch'](handleError(_0x28bcab,null));};exports[_0x2e6f('0x7c')]=function(_0x38b3bb,_0xff83,_0x55eff2){return db['Team'][_0x2e6f('0x79')]({'where':{'id':_0x38b3bb['params']['id']}})['then'](function(_0xbdd00c){if(_0xbdd00c){if(!_0x38b3bb[_0x2e6f('0x32')]['channel']||!utils[_0x2e6f('0x71')](_0x38b3bb[_0x2e6f('0x32')][_0x2e6f('0x70')])){throw new db[(_0x2e6f('0x57'))][(_0x2e6f('0x72'))](_0x2e6f('0x73'));}return _0xbdd00c['remove'+_['capitalize'](_0x38b3bb[_0x2e6f('0x32')]['channel'][_0x2e6f('0x75')]())+_0x2e6f('0x77')](_0x38b3bb['query']['ids']);}return null;})[_0x2e6f('0x42')](handleEntityNotFound(_0xff83,null))[_0x2e6f('0x42')](respondWithStatusCode(_0xff83,null))[_0x2e6f('0x45')](handleError(_0xff83,null));};exports[_0x2e6f('0x7d')]=function(_0xd9b351,_0x2b92f2){var _0x586bd0=_[_0x2e6f('0x7e')](_0xd9b351[_0x2e6f('0x54')][_0x2e6f('0x7b')])?_0xd9b351[_0x2e6f('0x54')][_0x2e6f('0x7b')]:[_0xd9b351[_0x2e6f('0x54')][_0x2e6f('0x7b')]];var _0x8d2f7d=_0xd9b351['params']['id'];return db[_0x2e6f('0x2d')][_0x2e6f('0x49')]({'where':{'id':_0x8d2f7d}})[_0x2e6f('0x42')](handleEntityNotFound(_0x2b92f2,null))[_0x2e6f('0x42')](function(_0x527033){if(_0x527033){var _0x5a35cf=[_0x2e6f('0x7f'),_0x2e6f('0x80'),_0x2e6f('0x81'),_0x2e6f('0x82'),_0x2e6f('0x83'),_0x2e6f('0x84'),'Whatsapp'];return db[_0x2e6f('0x55')][_0x2e6f('0x56')](function(_0x17e639){var _0x451945=_[_0x2e6f('0x2c')](_0x5a35cf,function(_0x1f7bbc){var _0x28b867={'attributes':['id',_0x2e6f('0x40')]};if(_0x1f7bbc==='Voice'){_0x28b867[_0x2e6f('0x85')]={'attributes':[_0x2e6f('0x86')]};}return _0x527033[_0x2e6f('0x4b')+_0x1f7bbc+_0x2e6f('0x77')](_0x28b867)['then'](function(_0x521ee1){var _0x1cc5c8=_['map'](_0x521ee1,function(_0x5384d8){var _0x3613c6=_[_0x2e6f('0x2c')](_0x586bd0,function(_0x59777f){var _0x40be94={'where':{'UserId':_0x59777f,[_0x1f7bbc+'QueueId']:_0x5384d8['id']},'transaction':_0x17e639};if(_0x1f7bbc===_0x2e6f('0x7f')){_0x40be94[_0x2e6f('0x1b')]={'penalty':_0x5384d8['TeamVoiceQueue']['penalty']};}return db['User'+_0x1f7bbc+_0x2e6f('0x76')][_0x2e6f('0x87')](_0x40be94)['then'](function(){socket['emit'](_0x2e6f('0x4d')+_0x1f7bbc+_0x2e6f('0x88'),{'UserId':_0x59777f,[_0x1f7bbc+_0x2e6f('0x89')]:_0x5384d8['id']});if(_0x1f7bbc!==_0x2e6f('0x7f')){return;}return db[_0x2e6f('0x8a')][_0x2e6f('0x8b')]({'where':{'id':_0x586bd0,'online':0x1},'attributes':['id',_0x2e6f('0x40'),_0x2e6f('0x8c'),_0x2e6f('0x8d'),_0x2e6f('0x8e')],'raw':!![]})[_0x2e6f('0x42')](function(_0x934108){var _0x359891=_[_0x2e6f('0x2c')](_0x934108,function(_0xddc7fe){return db['UserVoiceQueueRt'][_0x2e6f('0x8f')]({'membername':_0xddc7fe[_0x2e6f('0x40')],'UserId':_0xddc7fe['id'],'queue_name':_0x5384d8['name'],'VoiceQueueId':_0x5384d8['id'],'interface':_[_0x2e6f('0x90')](_0xddc7fe[_0x2e6f('0x8e')])?util[_0x2e6f('0x91')](_0x2e6f('0x92'),_0xddc7fe['name']):_0xddc7fe[_0x2e6f('0x8e')],'paused':_0xddc7fe[_0x2e6f('0x8d')]||![],'penalty':_0x5384d8[_0x2e6f('0x93')]['penalty']},{'transaction':_0x17e639});});return Promise[_0x2e6f('0x94')](_0x359891);});});});return Promise[_0x2e6f('0x94')](_0x3613c6);});return Promise[_0x2e6f('0x94')](_0x1cc5c8);})[_0x2e6f('0x42')](function(){return db[_0x2e6f('0x95')][_0x2e6f('0x79')]({'where':{'teamId':_0x8d2f7d}})[_0x2e6f('0x42')](function(_0x5e1def){if(_0x5e1def){var _0x3906d6=_[_0x2e6f('0x2c')](_0x586bd0,function(_0x588039){db['UserVoicePrefix'][_0x2e6f('0x8f')]({'UserId':_0x588039,'VoicePrefixId':_0x5e1def[_0x2e6f('0x96')]});});return Promise[_0x2e6f('0x94')](_0x3906d6);}});});});return Promise[_0x2e6f('0x94')](_0x451945)[_0x2e6f('0x42')](function(){return _0x527033[_0x2e6f('0x7d')](_0x586bd0,{'transaction':_0x17e639})[_0x2e6f('0x97')](function(_0x475538){return _0x475538;});});});}})[_0x2e6f('0x42')](respondWithResult(_0x2b92f2,null))[_0x2e6f('0x45')](handleError(_0x2b92f2,null));};exports[_0x2e6f('0x98')]=function(_0x436911,_0x1c5978){var _0x3ca774=_[_0x2e6f('0x7e')](_0x436911[_0x2e6f('0x32')]['ids'])?_0x436911[_0x2e6f('0x32')][_0x2e6f('0x7b')]:[_0x436911[_0x2e6f('0x32')][_0x2e6f('0x7b')]];var _0xbb7d32=_0x436911[_0x2e6f('0x6f')]['id'];return db[_0x2e6f('0x2d')][_0x2e6f('0x49')]({'where':{'id':_0xbb7d32}})[_0x2e6f('0x42')](handleEntityNotFound(_0x1c5978,null))[_0x2e6f('0x42')](function(_0x30bb2b){if(_0x30bb2b){var _0x26c06d=[_0x2e6f('0x7f'),_0x2e6f('0x80'),_0x2e6f('0x81'),_0x2e6f('0x82'),_0x2e6f('0x83'),_0x2e6f('0x84'),'Whatsapp'];return db[_0x2e6f('0x55')][_0x2e6f('0x56')](function(_0x5dde5c){var _0x2191f3=_['map'](_0x26c06d,function(_0x42496d){var _0x24d158={'attributes':['id',_0x2e6f('0x40')]};return _0x30bb2b[_0x2e6f('0x4b')+_0x42496d+'Queues'](_0x24d158)['then'](function(_0x334575){var _0x54645d=_[_0x2e6f('0x2c')](_0x334575,function(_0x445d16){return _0x445d16[_0x2e6f('0x98')](_0x3ca774,{'transaction':_0x5dde5c})['then'](function(){var _0x902beb=_[_0x2e6f('0x2c')](_0x3ca774,function(_0x1670ab){socket[_0x2e6f('0x99')](_0x2e6f('0x4d')+_0x42496d+_0x2e6f('0x9a'),{'UserId':Number(_0x1670ab),[_0x42496d+_0x2e6f('0x89')]:_0x445d16['id']});if(_0x42496d!==_0x2e6f('0x7f')){return;}return db['UserVoiceQueueRt'][_0x2e6f('0x5e')]({'where':{'VoiceQueueId':_0x445d16['id'],'UserId':_0x1670ab},'transaction':_0x5dde5c});});return Promise[_0x2e6f('0x94')](_0x902beb);});});return Promise[_0x2e6f('0x94')](_0x54645d);});});return Promise[_0x2e6f('0x94')](_0x2191f3)['then'](function(){return _0x30bb2b[_0x2e6f('0x98')](_0x3ca774,{'transaction':_0x5dde5c});})[_0x2e6f('0x42')](function(){return db[_0x2e6f('0x95')][_0x2e6f('0x79')]({'where':{'teamId':_0xbb7d32}})['then'](function(_0x24b7a3){if(_0x24b7a3){var _0x104c1b=_[_0x2e6f('0x2c')](_0x3ca774,function(_0x432a35){db[_0x2e6f('0x6d')][_0x2e6f('0x5e')]({'where':{'UserId':_0x432a35,'VoicePrefixId':_0x24b7a3['VoicePrefixId']}});});return Promise[_0x2e6f('0x94')](_0x104c1b);}});});});}})['then'](respondWithStatusCode(_0x1c5978,null))[_0x2e6f('0x45')](handleError(_0x1c5978,null));};exports[_0x2e6f('0x9b')]=function(_0x3ad053,_0x5ece8f,_0x1b8ca7){var _0x50b9af={};var _0x3dccca={};var _0x319014;var _0xef33de;return db[_0x2e6f('0x2d')]['findOne']({'where':{'id':_0x3ad053[_0x2e6f('0x6f')]['id']}})[_0x2e6f('0x42')](handleEntityNotFound(_0x5ece8f,null))[_0x2e6f('0x42')](function(_0x317523){if(_0x317523){_0x319014=_0x317523;_0x3dccca[_0x2e6f('0x31')]=_['keys'](db[_0x2e6f('0x8a')][_0x2e6f('0x2e')]);_0x3dccca[_0x2e6f('0x32')]=_[_0x2e6f('0x47')](_0x3ad053[_0x2e6f('0x32')]);_0x3dccca['filters']=_[_0x2e6f('0x34')](_0x3dccca['model'],_0x3dccca[_0x2e6f('0x32')]);_0x50b9af[_0x2e6f('0x36')]=_[_0x2e6f('0x34')](_0x3dccca['model'],qs[_0x2e6f('0x35')](_0x3ad053['query'][_0x2e6f('0x35')]));_0x50b9af['attributes']=_0x50b9af[_0x2e6f('0x36')][_0x2e6f('0x37')]?_0x50b9af[_0x2e6f('0x36')]:_0x3dccca[_0x2e6f('0x31')];_0x50b9af['order']=qs[_0x2e6f('0x3a')](_0x3ad053['query'][_0x2e6f('0x3a')]);_0x50b9af[_0x2e6f('0x3b')]=qs[_0x2e6f('0x33')](_[_0x2e6f('0x3c')](_0x3ad053['query'],_0x3dccca[_0x2e6f('0x33')]));if(_0x3ad053[_0x2e6f('0x32')][_0x2e6f('0x3d')]){_0x50b9af[_0x2e6f('0x3b')]=_[_0x2e6f('0x3e')](_0x50b9af[_0x2e6f('0x3b')],{'$or':_['map'](_0x50b9af['attributes'],function(_0x325a4c){var _0x93fdf6={};_0x93fdf6[_0x325a4c]={'$like':'%'+_0x3ad053[_0x2e6f('0x32')]['filter']+'%'};return _0x93fdf6;})});}_0x50b9af=_['merge']({},_0x50b9af,_0x3ad053['options']);return _0x319014[_0x2e6f('0x9b')](_0x50b9af);}})[_0x2e6f('0x42')](function(_0x2c1284){if(_0x2c1284){_0xef33de=_0x2c1284[_0x2e6f('0x37')];if(!_0x3ad053['query'][_0x2e6f('0x38')](_0x2e6f('0x9c'))){_0x50b9af[_0x2e6f('0x24')]=qs[_0x2e6f('0x24')](_0x3ad053['query'][_0x2e6f('0x24')]);_0x50b9af[_0x2e6f('0x22')]=qs[_0x2e6f('0x22')](_0x3ad053[_0x2e6f('0x32')]['offset']);}return _0x319014['getAgents'](_0x50b9af);}})[_0x2e6f('0x42')](function(_0x1f8273){if(_0x1f8273){return _0x1f8273?{'count':_0xef33de,'rows':_0x1f8273}:null;}})[_0x2e6f('0x42')](respondWithResult(_0x5ece8f,null))[_0x2e6f('0x45')](handleError(_0x5ece8f,null));};
\ No newline at end of file