Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / api / team / team.controller.js
index b85e459..9d142b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd64e=['transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','QueryTypes','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','isValidChannel','ValidationError','Unknown\x20channel','capitalize','channel','toLowerCase','order','Queues','add','ids','removeQueues','remove','addAgents','Fax','Openchannel','Whatsapp','Voice','TeamVoiceQueue','penalty','User','Queue','findOrCreate','emit','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','spread','Chat','Mail','Sms','removeAgents','getAgents','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','Team','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize'];(function(_0x121b29,_0x5bd9c3){var _0x3609a7=function(_0x240dbd){while(--_0x240dbd){_0x121b29['push'](_0x121b29['shift']());}};_0x3609a7(++_0x5bd9c3);}(_0xd64e,0xda));var _0xed64=function(_0x34b49a,_0x22e35f){_0x34b49a=_0x34b49a-0x0;var _0x328ecc=_0xd64e[_0x34b49a];return _0x328ecc;};'use strict';var emlformat=require(_0xed64('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xed64('0x1'));var moment=require(_0xed64('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xed64('0x3'));var util=require(_0xed64('0x4'));var path=require('path');var sox=require(_0xed64('0x5'));var csv=require(_0xed64('0x6'));var ejs=require(_0xed64('0x7'));var fs=require('fs');var fs_extra=require(_0xed64('0x8'));var _=require(_0xed64('0x9'));var squel=require(_0xed64('0xa'));var crypto=require(_0xed64('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xed64('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xed64('0xd'));var Redis=require('ioredis');var authService=require(_0xed64('0xe'));var qs=require(_0xed64('0xf'));var as=require(_0xed64('0x10'));var hardwareService=require(_0xed64('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xed64('0x12'));var licenseUtil=require(_0xed64('0x13'));var db=require(_0xed64('0x14'))['db'];config[_0xed64('0x15')]=_[_0xed64('0x16')](config[_0xed64('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xed64('0x17'))(new Redis(config[_0xed64('0x15')]));require(_0xed64('0x18'))['register'](socket);function respondWithStatusCode(_0x3585ab,_0x3e921b){_0x3e921b=_0x3e921b||0xcc;return function(_0x16c685){if(_0x16c685){return _0x3585ab[_0xed64('0x19')](_0x3e921b);}return _0x3585ab[_0xed64('0x1a')](_0x3e921b)[_0xed64('0x1b')]();};}function respondWithResult(_0x437a49,_0x4c825a){_0x4c825a=_0x4c825a||0xc8;return function(_0x53606f){if(_0x53606f){return _0x437a49[_0xed64('0x1a')](_0x4c825a)[_0xed64('0x1c')](_0x53606f);}};}function respondWithFilteredResult(_0x5d3722,_0x48b8f5){return function(_0x3db75f){if(_0x3db75f){var _0x32f7f3=typeof _0x48b8f5[_0xed64('0x1d')]===_0xed64('0x1e')&&typeof _0x48b8f5['limit']===_0xed64('0x1e');var _0x2c25eb=_0x3db75f[_0xed64('0x1f')];var _0x78ca07=_0x32f7f3?0x0:_0x48b8f5[_0xed64('0x1d')];var _0x78f89d=_0x32f7f3?_0x3db75f['count']:_0x48b8f5[_0xed64('0x1d')]+_0x48b8f5[_0xed64('0x20')];var _0x511871;if(_0x78f89d>=_0x2c25eb){_0x78f89d=_0x2c25eb;_0x511871=0xc8;}else{_0x511871=0xce;}_0x5d3722['status'](_0x511871);return _0x5d3722[_0xed64('0x21')](_0xed64('0x22'),_0x78ca07+'-'+_0x78f89d+'/'+_0x2c25eb)[_0xed64('0x1c')](_0x3db75f);}return null;};}function patchUpdates(_0x16e633){return function(_0x52f0fa){try{jsonpatch[_0xed64('0x23')](_0x52f0fa,_0x16e633,!![]);}catch(_0x25edff){return BPromise[_0xed64('0x24')](_0x25edff);}return _0x52f0fa[_0xed64('0x25')]();};}function saveUpdates(_0x54e722,_0x52ab8d){return function(_0x1ae2bb){if(_0x1ae2bb){return _0x1ae2bb[_0xed64('0x26')](_0x54e722)[_0xed64('0x27')](function(_0x57b53a){return _0x57b53a;});}return null;};}function handleEntityNotFound(_0x5c71d4,_0x521933){return function(_0x39cc7d){if(!_0x39cc7d){_0x5c71d4[_0xed64('0x19')](0x194);}return _0x39cc7d;};}function handleError(_0x20cd24,_0x1718de){_0x1718de=_0x1718de||0x1f4;return function(_0x3f47bb){logger[_0xed64('0x28')](_0x3f47bb[_0xed64('0x29')]);if(_0x3f47bb['name']){delete _0x3f47bb[_0xed64('0x2a')];}_0x20cd24[_0xed64('0x1a')](_0x1718de)[_0xed64('0x2b')](_0x3f47bb);};}exports[_0xed64('0x2c')]=function(_0x50abaf,_0x82364){var _0x247c8d={},_0x1a238c={},_0x1bc7e5={'count':0x0,'rows':[]};var _0x378ce3=_['map'](db[_0xed64('0x2d')]['rawAttributes'],function(_0x2c9626){return{'name':_0x2c9626['fieldName'],'type':_0x2c9626[_0xed64('0x2e')][_0xed64('0x2f')]};});_0x1a238c[_0xed64('0x30')]=_[_0xed64('0x31')](_0x378ce3,_0xed64('0x2a'));_0x1a238c['query']=_['keys'](_0x50abaf['query']);_0x1a238c[_0xed64('0x32')]=_[_0xed64('0x33')](_0x1a238c[_0xed64('0x30')],_0x1a238c[_0xed64('0x34')]);_0x247c8d[_0xed64('0x35')]=_[_0xed64('0x33')](_0x1a238c['model'],qs['fields'](_0x50abaf[_0xed64('0x34')][_0xed64('0x36')]));_0x247c8d[_0xed64('0x35')]=_0x247c8d[_0xed64('0x35')][_0xed64('0x37')]?_0x247c8d[_0xed64('0x35')]:_0x1a238c['model'];if(!_0x50abaf[_0xed64('0x34')][_0xed64('0x38')](_0xed64('0x39'))){_0x247c8d[_0xed64('0x20')]=qs['limit'](_0x50abaf[_0xed64('0x34')]['limit']);_0x247c8d[_0xed64('0x1d')]=qs[_0xed64('0x1d')](_0x50abaf[_0xed64('0x34')][_0xed64('0x1d')]);}_0x247c8d['order']=qs[_0xed64('0x3a')](_0x50abaf['query'][_0xed64('0x3a')]);_0x247c8d['where']=qs[_0xed64('0x32')](_[_0xed64('0x3b')](_0x50abaf[_0xed64('0x34')],_0x1a238c[_0xed64('0x32')]),_0x378ce3);if(_0x50abaf[_0xed64('0x34')][_0xed64('0x3c')]){_0x247c8d[_0xed64('0x3d')]=_[_0xed64('0x3e')](_0x247c8d[_0xed64('0x3d')],{'$or':_[_0xed64('0x31')](_0x378ce3,function(_0x56a28e){if(_0x56a28e[_0xed64('0x2e')]!=='VIRTUAL'){var _0x52ca9e={};_0x52ca9e[_0x56a28e[_0xed64('0x2a')]]={'$like':'%'+_0x50abaf['query'][_0xed64('0x3c')]+'%'};return _0x52ca9e;}})});}_0x247c8d=_[_0xed64('0x3e')]({},_0x247c8d,_0x50abaf[_0xed64('0x3f')]);var _0x2bd271={'where':_0x247c8d[_0xed64('0x3d')]};return db[_0xed64('0x2d')][_0xed64('0x1f')](_0x2bd271)[_0xed64('0x27')](function(_0x480a49){_0x1bc7e5[_0xed64('0x1f')]=_0x480a49;if(_0x50abaf[_0xed64('0x34')]['includeAll']){_0x247c8d[_0xed64('0x40')]=[{'all':!![]}];}return db['Team'][_0xed64('0x41')](_0x247c8d);})[_0xed64('0x27')](function(_0x48c9ca){_0x1bc7e5[_0xed64('0x42')]=_0x48c9ca;return _0x1bc7e5;})['then'](respondWithFilteredResult(_0x82364,_0x247c8d))['catch'](handleError(_0x82364,null));};exports[_0xed64('0x43')]=function(_0x2f3dc9,_0x32554a){var _0x46229a={'raw':![],'where':{'id':_0x2f3dc9[_0xed64('0x44')]['id']}},_0x3b1c5d={};_0x3b1c5d[_0xed64('0x30')]=_[_0xed64('0x45')](db[_0xed64('0x2d')][_0xed64('0x46')]);_0x3b1c5d[_0xed64('0x34')]=_[_0xed64('0x45')](_0x2f3dc9[_0xed64('0x34')]);_0x3b1c5d[_0xed64('0x32')]=_['intersection'](_0x3b1c5d[_0xed64('0x30')],_0x3b1c5d[_0xed64('0x34')]);_0x46229a[_0xed64('0x35')]=_[_0xed64('0x33')](_0x3b1c5d['model'],qs[_0xed64('0x36')](_0x2f3dc9['query'][_0xed64('0x36')]));_0x46229a[_0xed64('0x35')]=_0x46229a['attributes'][_0xed64('0x37')]?_0x46229a[_0xed64('0x35')]:_0x3b1c5d[_0xed64('0x30')];if(_0x2f3dc9[_0xed64('0x34')][_0xed64('0x47')]){_0x46229a[_0xed64('0x40')]=[{'all':!![]}];}_0x46229a=_['merge']({},_0x46229a,_0x2f3dc9['options']);return db[_0xed64('0x2d')][_0xed64('0x48')](_0x46229a)[_0xed64('0x27')](handleEntityNotFound(_0x32554a,null))[_0xed64('0x27')](respondWithResult(_0x32554a,null))[_0xed64('0x49')](handleError(_0x32554a,null));};exports[_0xed64('0x4a')]=function(_0x1efefc,_0x76607b){return db[_0xed64('0x2d')][_0xed64('0x4a')](_0x1efefc[_0xed64('0x4b')],{})[_0xed64('0x27')](function(_0x12e366){var _0x46d7e9=_0x1efefc[_0xed64('0x4c')][_0xed64('0x4d')]({'plain':!![]});if(!_0x46d7e9)throw new Error(_0xed64('0x4e'));if(_0x46d7e9[_0xed64('0x4f')]===_0xed64('0x4c')){var _0x3ebdc2=_0x12e366['get']({'plain':!![]});var _0xe6e123='Teams';return db[_0xed64('0x50')][_0xed64('0x48')]({'where':{'name':_0xe6e123,'userProfileId':_0x46d7e9[_0xed64('0x51')]},'raw':!![]})[_0xed64('0x27')](function(_0x3ce1c5){if(_0x3ce1c5&&_0x3ce1c5[_0xed64('0x52')]===0x0){return db[_0xed64('0x53')]['create']({'name':_0x3ebdc2[_0xed64('0x2a')],'resourceId':_0x3ebdc2['id'],'type':_0x3ce1c5[_0xed64('0x2a')],'sectionId':_0x3ce1c5['id']},{})[_0xed64('0x27')](function(){return _0x12e366;});}else{return _0x12e366;}})[_0xed64('0x49')](function(_0x15705f){logger[_0xed64('0x28')](_0xed64('0x54'),_0x15705f);throw _0x15705f;});}return _0x12e366;})['then'](respondWithResult(_0x76607b,0xc9))['catch'](handleError(_0x76607b,null));};exports[_0xed64('0x26')]=function(_0x53625d,_0x20c669){if(_0x53625d[_0xed64('0x4b')]['id']){delete _0x53625d['body']['id'];}return db[_0xed64('0x2d')][_0xed64('0x48')]({'where':{'id':_0x53625d[_0xed64('0x44')]['id']}})[_0xed64('0x27')](handleEntityNotFound(_0x20c669,null))['then'](saveUpdates(_0x53625d[_0xed64('0x4b')],null))[_0xed64('0x27')](respondWithResult(_0x20c669,null))[_0xed64('0x49')](handleError(_0x20c669,null));};exports['destroy']=function(_0x542f80,_0x21f558){var _0x1d1e29=_0x542f80['params']['id'];var _0x1f858a=[];return db[_0xed64('0x55')][_0xed64('0x56')](function(_0x2a3fb0){var _0xb4a88b=_0xed64('0x57')+_0x1d1e29;return db[_0xed64('0x55')][_0xed64('0x34')](_0xb4a88b,{'type':db[_0xed64('0x58')]['QueryTypes'][_0xed64('0x59')],'raw':!![],'transaction':_0x2a3fb0})['then'](function(_0x388f9e){_0x1f858a=_['map'](_0x388f9e,function(_0x31d428){return Number(_0x31d428[_0xed64('0x5a')]);});})[_0xed64('0x27')](function(){var _0x34ddc6='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d1e29;return db[_0xed64('0x55')]['query'](_0x34ddc6,{'type':db[_0xed64('0x58')][_0xed64('0x5b')][_0xed64('0x59')],'raw':!![],'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(_0x7e8c76){var _0x4672a7=_[_0xed64('0x31')](_0x7e8c76,function(_0x4a6b48){return Number(_0x4a6b48[_0xed64('0x5c')]);});return db[_0xed64('0x5d')][_0xed64('0x5e')]({'where':{'UserId':{'$in':_0x1f858a},'VoiceQueueId':{'$in':_0x4672a7}},'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(){var _0xc7b025='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d1e29;return db[_0xed64('0x55')][_0xed64('0x34')](_0xc7b025,{'type':db[_0xed64('0x58')][_0xed64('0x5b')][_0xed64('0x59')],'raw':!![],'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(_0x2c79d7){var _0x1a465e=_[_0xed64('0x31')](_0x2c79d7,function(_0x21dae5){return Number(_0x21dae5[_0xed64('0x5f')]);});return db[_0xed64('0x60')][_0xed64('0x5e')]({'where':{'UserId':{'$in':_0x1f858a},'MailQueueId':{'$in':_0x1a465e}},'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(){var _0x1b198a=_0xed64('0x61')+_0x1d1e29;return db[_0xed64('0x55')][_0xed64('0x34')](_0x1b198a,{'type':db[_0xed64('0x58')][_0xed64('0x5b')][_0xed64('0x59')],'raw':!![],'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(_0x1e47a7){var _0x15fd29=_['map'](_0x1e47a7,function(_0x225972){return Number(_0x225972[_0xed64('0x62')]);});return db[_0xed64('0x63')][_0xed64('0x5e')]({'where':{'UserId':{'$in':_0x1f858a},'SmsQueueId':{'$in':_0x15fd29}},'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(){var _0x22a4bc='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d1e29;return db['sequelize'][_0xed64('0x34')](_0x22a4bc,{'type':db[_0xed64('0x58')][_0xed64('0x5b')]['SELECT'],'raw':!![],'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(_0x339b57){var _0x18275b=_[_0xed64('0x31')](_0x339b57,function(_0x310408){return Number(_0x310408[_0xed64('0x64')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x1f858a},'ChatQueueId':{'$in':_0x18275b}},'transaction':_0x2a3fb0});})['then'](function(){var _0x5466e6=_0xed64('0x65')+_0x1d1e29;return db[_0xed64('0x55')][_0xed64('0x34')](_0x5466e6,{'type':db[_0xed64('0x58')][_0xed64('0x5b')][_0xed64('0x59')],'raw':!![],'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(_0x4e823f){var _0x29a8ad=_[_0xed64('0x31')](_0x4e823f,function(_0x2cc842){return Number(_0x2cc842[_0xed64('0x66')]);});return db[_0xed64('0x67')][_0xed64('0x5e')]({'where':{'UserId':{'$in':_0x1f858a},'FaxQueueId':{'$in':_0x29a8ad}},'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(){var _0x5a8f39=_0xed64('0x68')+_0x1d1e29;return db[_0xed64('0x55')][_0xed64('0x34')](_0x5a8f39,{'type':db[_0xed64('0x58')][_0xed64('0x5b')][_0xed64('0x59')],'raw':!![],'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(_0x2e9bba){var _0x3137f1=_[_0xed64('0x31')](_0x2e9bba,function(_0x3df6cf){return Number(_0x3df6cf[_0xed64('0x69')]);});return db['UserOpenchannelQueue'][_0xed64('0x5e')]({'where':{'UserId':{'$in':_0x1f858a},'OpenchannelQueueId':{'$in':_0x3137f1}},'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(){var _0x3f078c='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d1e29;return db[_0xed64('0x55')][_0xed64('0x34')](_0x3f078c,{'type':db['Sequelize']['QueryTypes'][_0xed64('0x59')],'raw':!![],'transaction':_0x2a3fb0});})['then'](function(_0x55633d){var _0x279635=_['map'](_0x55633d,function(_0x5484b8){return Number(_0x5484b8[_0xed64('0x6a')]);});return db[_0xed64('0x6b')][_0xed64('0x5e')]({'where':{'UserId':{'$in':_0x1f858a},'WhatsappQueueId':{'$in':_0x279635}},'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(){return db[_0xed64('0x6c')]['find']({'where':{'TeamId':_0x1d1e29}});})[_0xed64('0x27')](function(_0xc83ab){if(_0xc83ab===null){return;}return db['UserVoicePrefix'][_0xed64('0x5e')]({'where':{'UserId':{'$in':_0x1f858a},'VoicePrefixId':_0xc83ab[_0xed64('0x6d')]},'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(){return db['Team'][_0xed64('0x5e')]({'where':{'id':_0x1d1e29},'cascade':!![],'transaction':_0x2a3fb0});})[_0xed64('0x27')](function(_0x27d0ef){if(_0x27d0ef===0x0){_0x21f558[_0xed64('0x19')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':_0xed64('0x6e'),'resourceId':_0x1d1e29},'cascade':!![],'transaction':_0x2a3fb0})['then'](function(){_0x21f558[_0xed64('0x1a')](0xcc)['end']();});}})[_0xed64('0x49')](function(_0x51ebf7){_0x21f558['status'](0x1f4)['send'](_0x51ebf7);});});};exports[_0xed64('0x6f')]=function(_0xc1a403,_0x2f393f,_0x25c970){return db[_0xed64('0x2d')][_0xed64('0x70')]({'where':{'id':_0xc1a403[_0xed64('0x44')]['id']}})[_0xed64('0x27')](handleEntityNotFound(_0x2f393f,null))[_0xed64('0x27')](function(_0x59a244){if(!_0xc1a403['query']['channel']||!utils[_0xed64('0x71')](_0xc1a403[_0xed64('0x34')]['channel'])){throw new db[(_0xed64('0x58'))][(_0xed64('0x72'))](_0xed64('0x73'));}var _0x5cf12c={};var _0x3f2a78={};_0x3f2a78['model']=_[_0xed64('0x45')](db[_[_0xed64('0x74')](_0xc1a403['query'][_0xed64('0x75')][_0xed64('0x76')]())+'Queue']['rawAttributes']);_0x3f2a78[_0xed64('0x34')]=_[_0xed64('0x45')](_0xc1a403[_0xed64('0x34')]);_0x3f2a78['filters']=_[_0xed64('0x33')](_0x3f2a78[_0xed64('0x30')],_0x3f2a78[_0xed64('0x34')]);_0x5cf12c['attributes']=_[_0xed64('0x33')](_0x3f2a78[_0xed64('0x30')],qs[_0xed64('0x36')](_0xc1a403[_0xed64('0x34')][_0xed64('0x36')]));_0x5cf12c['attributes']=_0x5cf12c[_0xed64('0x35')][_0xed64('0x37')]?_0x5cf12c['attributes']:_0x3f2a78[_0xed64('0x30')];_0x5cf12c[_0xed64('0x20')]=qs[_0xed64('0x20')](_0xc1a403['query'][_0xed64('0x20')]);_0x5cf12c['offset']=qs[_0xed64('0x1d')](_0xc1a403[_0xed64('0x34')][_0xed64('0x1d')]);_0x5cf12c[_0xed64('0x77')]=qs[_0xed64('0x3a')](_0xc1a403['query']['sort']);_0x5cf12c[_0xed64('0x3d')]=qs[_0xed64('0x32')](_[_0xed64('0x3b')](_0xc1a403[_0xed64('0x34')],_0x3f2a78['filters']));_0x5cf12c=_[_0xed64('0x3e')]({},_0x5cf12c,_0xc1a403['options']);return _0x59a244[_0xed64('0x4d')+_['capitalize'](_0xc1a403[_0xed64('0x34')][_0xed64('0x75')][_0xed64('0x76')]())+_0xed64('0x78')](_0x5cf12c);})[_0xed64('0x27')](respondWithResult(_0x2f393f,null))[_0xed64('0x49')](handleError(_0x2f393f,null));};exports['addQueues']=function(_0x389890,_0xbb98ec,_0x5debf1){return db[_0xed64('0x2d')]['findOne']({'where':{'id':_0x389890[_0xed64('0x44')]['id']}})[_0xed64('0x27')](function(_0x25f85d){if(_0x25f85d){if(!_0x389890[_0xed64('0x4b')][_0xed64('0x75')]||!utils['isValidChannel'](_0x389890[_0xed64('0x4b')][_0xed64('0x75')])){throw new db[(_0xed64('0x58'))][(_0xed64('0x72'))](_0xed64('0x73'));}return _0x25f85d[_0xed64('0x79')+_[_0xed64('0x74')](_0x389890[_0xed64('0x4b')][_0xed64('0x75')][_0xed64('0x76')]())+_0xed64('0x78')](_0x389890[_0xed64('0x4b')][_0xed64('0x7a')]);}return null;})[_0xed64('0x27')](handleEntityNotFound(_0xbb98ec,null))[_0xed64('0x27')](respondWithStatusCode(_0xbb98ec,null))[_0xed64('0x49')](handleError(_0xbb98ec,null));};exports[_0xed64('0x7b')]=function(_0x138521,_0x538f5a,_0x6db4c){return db[_0xed64('0x2d')][_0xed64('0x70')]({'where':{'id':_0x138521[_0xed64('0x44')]['id']}})[_0xed64('0x27')](function(_0x3a3c90){if(_0x3a3c90){if(!_0x138521['query'][_0xed64('0x75')]||!utils[_0xed64('0x71')](_0x138521[_0xed64('0x34')][_0xed64('0x75')])){throw new db[(_0xed64('0x58'))][(_0xed64('0x72'))](_0xed64('0x73'));}return _0x3a3c90[_0xed64('0x7c')+_[_0xed64('0x74')](_0x138521['query'][_0xed64('0x75')]['toLowerCase']())+'Queues'](_0x138521[_0xed64('0x34')][_0xed64('0x7a')]);}return null;})[_0xed64('0x27')](handleEntityNotFound(_0x538f5a,null))[_0xed64('0x27')](respondWithStatusCode(_0x538f5a,null))['catch'](handleError(_0x538f5a,null));};exports[_0xed64('0x7d')]=function(_0x3e04a0,_0x204d03){var _0x4e9992=_['isArray'](_0x3e04a0[_0xed64('0x4b')][_0xed64('0x7a')])?_0x3e04a0[_0xed64('0x4b')][_0xed64('0x7a')]:[_0x3e04a0[_0xed64('0x4b')][_0xed64('0x7a')]];var _0x55e10d=_0x3e04a0[_0xed64('0x44')]['id'];return db['Team']['find']({'where':{'id':_0x55e10d}})['then'](handleEntityNotFound(_0x204d03,null))[_0xed64('0x27')](function(_0x5c184f){if(_0x5c184f){var _0x5bebfe=['Voice','Chat','Mail','Sms',_0xed64('0x7e'),_0xed64('0x7f'),_0xed64('0x80')];return db[_0xed64('0x55')][_0xed64('0x56')](function(_0x59a24c){var _0x24de56=_[_0xed64('0x31')](_0x5bebfe,function(_0x12f10a){var _0x1cbace={'attributes':['id',_0xed64('0x2a')]};if(_0x12f10a===_0xed64('0x81')){_0x1cbace['through']={'attributes':['penalty']};}return _0x5c184f['get'+_0x12f10a+_0xed64('0x78')](_0x1cbace)[_0xed64('0x27')](function(_0x43cd03){var _0x9261a6=_[_0xed64('0x31')](_0x43cd03,function(_0x52d045){var _0x1f867b=_[_0xed64('0x31')](_0x4e9992,function(_0x2b60af){var _0x34235d={'where':{'UserId':_0x2b60af,[_0x12f10a+'QueueId']:_0x52d045['id']},'transaction':_0x59a24c};if(_0x12f10a===_0xed64('0x81')){_0x34235d['defaults']={'penalty':_0x52d045[_0xed64('0x82')][_0xed64('0x83')]};}return db[_0xed64('0x84')+_0x12f10a+_0xed64('0x85')][_0xed64('0x86')](_0x34235d)[_0xed64('0x27')](function(){socket[_0xed64('0x87')](_0xed64('0x4c')+_0x12f10a+_0xed64('0x88'),{'UserId':_0x2b60af,[_0x12f10a+_0xed64('0x89')]:_0x52d045['id']});if(_0x12f10a!==_0xed64('0x81')){return;}return db[_0xed64('0x84')][_0xed64('0x41')]({'where':{'id':_0x4e9992,'online':0x1},'attributes':['id','name',_0xed64('0x8a'),_0xed64('0x8b'),_0xed64('0x8c')],'raw':!![]})[_0xed64('0x27')](function(_0x563bbf){var _0x85da3e=_[_0xed64('0x31')](_0x563bbf,function(_0x50f46e){return db[_0xed64('0x8d')][_0xed64('0x8e')]({'membername':_0x50f46e['name'],'UserId':_0x50f46e['id'],'queue_name':_0x52d045[_0xed64('0x2a')],'VoiceQueueId':_0x52d045['id'],'interface':_[_0xed64('0x8f')](_0x50f46e[_0xed64('0x8c')])?util[_0xed64('0x90')]('SIP/%s',_0x50f46e[_0xed64('0x2a')]):_0x50f46e[_0xed64('0x8c')],'paused':_0x50f46e['voicePause']||![],'penalty':_0x52d045[_0xed64('0x82')][_0xed64('0x83')]},{'transaction':_0x59a24c});});return Promise[_0xed64('0x91')](_0x85da3e);});});});return Promise['all'](_0x1f867b);});return Promise['all'](_0x9261a6);})['then'](function(){return db[_0xed64('0x6c')][_0xed64('0x70')]({'where':{'teamId':_0x55e10d}})['then'](function(_0xef71df){if(_0xef71df){var _0x237515=_[_0xed64('0x31')](_0x4e9992,function(_0x2fa187){db['UserVoicePrefix']['upsert']({'UserId':_0x2fa187,'VoicePrefixId':_0xef71df[_0xed64('0x6d')]});});return Promise[_0xed64('0x91')](_0x237515);}});});});return Promise[_0xed64('0x91')](_0x24de56)['then'](function(){return _0x5c184f[_0xed64('0x7d')](_0x4e9992,{'transaction':_0x59a24c})[_0xed64('0x92')](function(_0x55c659){return _0x55c659;});});});}})[_0xed64('0x27')](respondWithResult(_0x204d03,null))['catch'](handleError(_0x204d03,null));};exports['removeAgents']=function(_0x2ee97,_0x25b89e){var _0x4013a2=_['isArray'](_0x2ee97[_0xed64('0x34')][_0xed64('0x7a')])?_0x2ee97[_0xed64('0x34')][_0xed64('0x7a')]:[_0x2ee97[_0xed64('0x34')][_0xed64('0x7a')]];var _0x4d1a43=_0x2ee97['params']['id'];return db[_0xed64('0x2d')][_0xed64('0x48')]({'where':{'id':_0x4d1a43}})[_0xed64('0x27')](handleEntityNotFound(_0x25b89e,null))[_0xed64('0x27')](function(_0x334215){if(_0x334215){var _0x11a8d0=['Voice',_0xed64('0x93'),_0xed64('0x94'),_0xed64('0x95'),_0xed64('0x7e'),'Openchannel',_0xed64('0x80')];return db['sequelize'][_0xed64('0x56')](function(_0x4f033e){var _0x299a25=_[_0xed64('0x31')](_0x11a8d0,function(_0x52dd66){var _0x20c7e0={'attributes':['id',_0xed64('0x2a')]};return _0x334215['get'+_0x52dd66+'Queues'](_0x20c7e0)[_0xed64('0x27')](function(_0x1fe45f){var _0x1f0e3e=_[_0xed64('0x31')](_0x1fe45f,function(_0x2559bc){return _0x2559bc[_0xed64('0x96')](_0x4013a2,{'transaction':_0x4f033e})['then'](function(){var _0x1cfa26=_[_0xed64('0x31')](_0x4013a2,function(_0x1b3b94){socket[_0xed64('0x87')](_0xed64('0x4c')+_0x52dd66+'Queue:remove',{'UserId':Number(_0x1b3b94),[_0x52dd66+'QueueId']:_0x2559bc['id']});if(_0x52dd66!==_0xed64('0x81')){return;}return db[_0xed64('0x8d')][_0xed64('0x5e')]({'where':{'VoiceQueueId':_0x2559bc['id'],'UserId':_0x1b3b94},'transaction':_0x4f033e});});return Promise[_0xed64('0x91')](_0x1cfa26);});});return Promise[_0xed64('0x91')](_0x1f0e3e);});});return Promise[_0xed64('0x91')](_0x299a25)[_0xed64('0x27')](function(){return _0x334215[_0xed64('0x96')](_0x4013a2,{'transaction':_0x4f033e});})[_0xed64('0x27')](function(){return db[_0xed64('0x6c')]['findOne']({'where':{'teamId':_0x4d1a43}})[_0xed64('0x27')](function(_0xe332a5){if(_0xe332a5){var _0x3015b4=_[_0xed64('0x31')](_0x4013a2,function(_0x2160c0){db['UserVoicePrefix'][_0xed64('0x5e')]({'where':{'UserId':_0x2160c0,'VoicePrefixId':_0xe332a5[_0xed64('0x6d')]}});});return Promise[_0xed64('0x91')](_0x3015b4);}});});});}})[_0xed64('0x27')](respondWithStatusCode(_0x25b89e,null))[_0xed64('0x49')](handleError(_0x25b89e,null));};exports[_0xed64('0x97')]=function(_0x3a5b64,_0x1de7fc,_0x435d17){var _0x2b0a2b={};var _0x366178={};var _0x59ca9e;var _0x4b44f0;return db[_0xed64('0x2d')]['findOne']({'where':{'id':_0x3a5b64['params']['id']}})['then'](handleEntityNotFound(_0x1de7fc,null))[_0xed64('0x27')](function(_0x33a745){if(_0x33a745){_0x59ca9e=_0x33a745;_0x366178[_0xed64('0x30')]=_[_0xed64('0x45')](db[_0xed64('0x84')]['rawAttributes']);_0x366178[_0xed64('0x34')]=_['keys'](_0x3a5b64[_0xed64('0x34')]);_0x366178[_0xed64('0x32')]=_[_0xed64('0x33')](_0x366178[_0xed64('0x30')],_0x366178['query']);_0x2b0a2b['attributes']=_[_0xed64('0x33')](_0x366178[_0xed64('0x30')],qs[_0xed64('0x36')](_0x3a5b64[_0xed64('0x34')][_0xed64('0x36')]));_0x2b0a2b['attributes']=_0x2b0a2b[_0xed64('0x35')][_0xed64('0x37')]?_0x2b0a2b['attributes']:_0x366178[_0xed64('0x30')];_0x2b0a2b['order']=qs[_0xed64('0x3a')](_0x3a5b64[_0xed64('0x34')][_0xed64('0x3a')]);_0x2b0a2b['where']=qs[_0xed64('0x32')](_[_0xed64('0x3b')](_0x3a5b64['query'],_0x366178[_0xed64('0x32')]));if(_0x3a5b64[_0xed64('0x34')][_0xed64('0x3c')]){_0x2b0a2b[_0xed64('0x3d')]=_[_0xed64('0x3e')](_0x2b0a2b[_0xed64('0x3d')],{'$or':_['map'](_0x2b0a2b['attributes'],function(_0x27ea91){var _0x43af0b={};_0x43af0b[_0x27ea91]={'$like':'%'+_0x3a5b64[_0xed64('0x34')][_0xed64('0x3c')]+'%'};return _0x43af0b;})});}_0x2b0a2b=_['merge']({},_0x2b0a2b,_0x3a5b64[_0xed64('0x3f')]);return _0x59ca9e[_0xed64('0x97')](_0x2b0a2b);}})[_0xed64('0x27')](function(_0x36ff0e){if(_0x36ff0e){_0x4b44f0=_0x36ff0e[_0xed64('0x37')];if(!_0x3a5b64[_0xed64('0x34')][_0xed64('0x38')]('nolimit')){_0x2b0a2b['limit']=qs[_0xed64('0x20')](_0x3a5b64[_0xed64('0x34')][_0xed64('0x20')]);_0x2b0a2b['offset']=qs['offset'](_0x3a5b64[_0xed64('0x34')][_0xed64('0x1d')]);}return _0x59ca9e[_0xed64('0x97')](_0x2b0a2b);}})[_0xed64('0x27')](function(_0x3d728e){if(_0x3d728e){return _0x3d728e?{'count':_0x4b44f0,'rows':_0x3d728e}:null;}})['then'](respondWithResult(_0x1de7fc,null))[_0xed64('0x49')](handleError(_0x1de7fc,null));};
\ No newline at end of file
+var _0xfc1e=['model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','keys','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','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','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','length','pick','Queues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','Queue:save','User','findAll','online','interface','UserVoiceQueueRt','format','SIP/%s','voicePause','all','UserVoicePrefix','upsert','spread','removeAgents','Queue:remove','getAgents','hasOwnProperty','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./team.socket','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Team','fieldName','key'];(function(_0x250aea,_0xfdf9c0){var _0xaa4139=function(_0x2d1c58){while(--_0x2d1c58){_0x250aea['push'](_0x250aea['shift']());}};_0xaa4139(++_0xfdf9c0);}(_0xfc1e,0x10a));var _0xefc1=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xfc1e[_0x622035];return _0x326cf2;};'use strict';var emlformat=require(_0xefc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefc1('0x1'));var jsonpatch=require(_0xefc1('0x2'));var rp=require('request-promise');var moment=require(_0xefc1('0x3'));var BPromise=require(_0xefc1('0x4'));var Mustache=require(_0xefc1('0x5'));var util=require(_0xefc1('0x6'));var path=require(_0xefc1('0x7'));var sox=require('sox');var csv=require(_0xefc1('0x8'));var ejs=require(_0xefc1('0x9'));var fs=require('fs');var fs_extra=require(_0xefc1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xefc1('0xb'));var jsforce=require(_0xefc1('0xc'));var deskjs=require(_0xefc1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xefc1('0xe'));var Redis=require(_0xefc1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xefc1('0x10'));var as=require(_0xefc1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xefc1('0x12'))(_0xefc1('0x13'));var utils=require(_0xefc1('0x14'));var config=require(_0xefc1('0x15'));var licenseUtil=require(_0xefc1('0x16'));var db=require(_0xefc1('0x17'))['db'];config['redis']=_[_0xefc1('0x18')](config['redis'],{'host':_0xefc1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xefc1('0x1a')]));require(_0xefc1('0x1b'))['register'](socket);function respondWithStatusCode(_0xdd5c57,_0x5bffe0){_0x5bffe0=_0x5bffe0||0xcc;return function(_0x16cae4){if(_0x16cae4){return _0xdd5c57['sendStatus'](_0x5bffe0);}return _0xdd5c57[_0xefc1('0x1c')](_0x5bffe0)[_0xefc1('0x1d')]();};}function respondWithResult(_0x6cc6d,_0x5e71fb){_0x5e71fb=_0x5e71fb||0xc8;return function(_0x5c7d7a){if(_0x5c7d7a){return _0x6cc6d[_0xefc1('0x1c')](_0x5e71fb)['json'](_0x5c7d7a);}};}function respondWithFilteredResult(_0x57e6a5,_0x2c3877){return function(_0x320d1d){if(_0x320d1d){var _0x5ce969=typeof _0x2c3877[_0xefc1('0x1e')]===_0xefc1('0x1f')&&typeof _0x2c3877[_0xefc1('0x20')]===_0xefc1('0x1f');var _0x1ff166=_0x320d1d['count'];var _0x435840=_0x5ce969?0x0:_0x2c3877[_0xefc1('0x1e')];var _0x325107=_0x5ce969?_0x320d1d[_0xefc1('0x21')]:_0x2c3877[_0xefc1('0x1e')]+_0x2c3877[_0xefc1('0x20')];var _0x34c173;if(_0x325107>=_0x1ff166){_0x325107=_0x1ff166;_0x34c173=0xc8;}else{_0x34c173=0xce;}_0x57e6a5[_0xefc1('0x1c')](_0x34c173);return _0x57e6a5[_0xefc1('0x22')](_0xefc1('0x23'),_0x435840+'-'+_0x325107+'/'+_0x1ff166)['json'](_0x320d1d);}return null;};}function patchUpdates(_0xe42ad9){return function(_0x54b63b){try{jsonpatch[_0xefc1('0x24')](_0x54b63b,_0xe42ad9,!![]);}catch(_0x3c2da3){return BPromise[_0xefc1('0x25')](_0x3c2da3);}return _0x54b63b[_0xefc1('0x26')]();};}function saveUpdates(_0xeeba91,_0x585eca){return function(_0x46f9e7){if(_0x46f9e7){return _0x46f9e7[_0xefc1('0x27')](_0xeeba91)[_0xefc1('0x28')](function(_0x37f4dc){return _0x37f4dc;});}return null;};}function handleEntityNotFound(_0x381aef,_0x50b462){return function(_0x4bb7ad){if(!_0x4bb7ad){_0x381aef[_0xefc1('0x29')](0x194);}return _0x4bb7ad;};}function handleError(_0xbebb0b,_0xf93b46){_0xf93b46=_0xf93b46||0x1f4;return function(_0x5b821a){logger['error'](_0x5b821a[_0xefc1('0x2a')]);if(_0x5b821a['name']){delete _0x5b821a[_0xefc1('0x2b')];}_0xbebb0b[_0xefc1('0x1c')](_0xf93b46)[_0xefc1('0x2c')](_0x5b821a);};}exports[_0xefc1('0x2d')]=function(_0x3341f1,_0xee006f){var _0x2ef2d6={},_0x573992={},_0x12c644={'count':0x0,'rows':[]};var _0x4fc28c=_[_0xefc1('0x2e')](db[_0xefc1('0x2f')]['rawAttributes'],function(_0x319e1d){return{'name':_0x319e1d[_0xefc1('0x30')],'type':_0x319e1d['type'][_0xefc1('0x31')]};});_0x573992[_0xefc1('0x32')]=_[_0xefc1('0x2e')](_0x4fc28c,_0xefc1('0x2b'));_0x573992[_0xefc1('0x33')]=_['keys'](_0x3341f1[_0xefc1('0x33')]);_0x573992[_0xefc1('0x34')]=_['intersection'](_0x573992[_0xefc1('0x32')],_0x573992[_0xefc1('0x33')]);_0x2ef2d6[_0xefc1('0x35')]=_[_0xefc1('0x36')](_0x573992[_0xefc1('0x32')],qs[_0xefc1('0x37')](_0x3341f1[_0xefc1('0x33')][_0xefc1('0x37')]));_0x2ef2d6[_0xefc1('0x35')]=_0x2ef2d6[_0xefc1('0x35')]['length']?_0x2ef2d6[_0xefc1('0x35')]:_0x573992[_0xefc1('0x32')];if(!_0x3341f1[_0xefc1('0x33')]['hasOwnProperty'](_0xefc1('0x38'))){_0x2ef2d6[_0xefc1('0x20')]=qs[_0xefc1('0x20')](_0x3341f1[_0xefc1('0x33')][_0xefc1('0x20')]);_0x2ef2d6[_0xefc1('0x1e')]=qs['offset'](_0x3341f1[_0xefc1('0x33')]['offset']);}_0x2ef2d6[_0xefc1('0x39')]=qs['sort'](_0x3341f1[_0xefc1('0x33')][_0xefc1('0x3a')]);_0x2ef2d6[_0xefc1('0x3b')]=qs[_0xefc1('0x34')](_['pick'](_0x3341f1['query'],_0x573992[_0xefc1('0x34')]),_0x4fc28c);if(_0x3341f1[_0xefc1('0x33')][_0xefc1('0x3c')]){_0x2ef2d6['where']=_[_0xefc1('0x3d')](_0x2ef2d6['where'],{'$or':_[_0xefc1('0x2e')](_0x4fc28c,function(_0x16655b){if(_0x16655b[_0xefc1('0x3e')]!==_0xefc1('0x3f')){var _0xf534ae={};_0xf534ae[_0x16655b[_0xefc1('0x2b')]]={'$like':'%'+_0x3341f1[_0xefc1('0x33')][_0xefc1('0x3c')]+'%'};return _0xf534ae;}})});}_0x2ef2d6=_[_0xefc1('0x3d')]({},_0x2ef2d6,_0x3341f1[_0xefc1('0x40')]);var _0x2a9e2b={'where':_0x2ef2d6[_0xefc1('0x3b')]};return db[_0xefc1('0x2f')][_0xefc1('0x21')](_0x2a9e2b)[_0xefc1('0x28')](function(_0x2fa07d){_0x12c644['count']=_0x2fa07d;if(_0x3341f1['query'][_0xefc1('0x41')]){_0x2ef2d6[_0xefc1('0x42')]=[{'all':!![]}];}return db[_0xefc1('0x2f')]['findAll'](_0x2ef2d6);})[_0xefc1('0x28')](function(_0x564145){_0x12c644[_0xefc1('0x43')]=_0x564145;return _0x12c644;})[_0xefc1('0x28')](respondWithFilteredResult(_0xee006f,_0x2ef2d6))[_0xefc1('0x44')](handleError(_0xee006f,null));};exports['show']=function(_0x2d4b9c,_0x2daaa3){var _0x75a6d7={'raw':![],'where':{'id':_0x2d4b9c[_0xefc1('0x45')]['id']}},_0x1f4346={};_0x1f4346[_0xefc1('0x32')]=_[_0xefc1('0x46')](db['Team'][_0xefc1('0x47')]);_0x1f4346[_0xefc1('0x33')]=_[_0xefc1('0x46')](_0x2d4b9c['query']);_0x1f4346[_0xefc1('0x34')]=_[_0xefc1('0x36')](_0x1f4346[_0xefc1('0x32')],_0x1f4346[_0xefc1('0x33')]);_0x75a6d7[_0xefc1('0x35')]=_['intersection'](_0x1f4346[_0xefc1('0x32')],qs['fields'](_0x2d4b9c['query'][_0xefc1('0x37')]));_0x75a6d7[_0xefc1('0x35')]=_0x75a6d7['attributes']['length']?_0x75a6d7[_0xefc1('0x35')]:_0x1f4346['model'];if(_0x2d4b9c[_0xefc1('0x33')][_0xefc1('0x41')]){_0x75a6d7[_0xefc1('0x42')]=[{'all':!![]}];}_0x75a6d7=_[_0xefc1('0x3d')]({},_0x75a6d7,_0x2d4b9c[_0xefc1('0x40')]);return db[_0xefc1('0x2f')]['find'](_0x75a6d7)[_0xefc1('0x28')](handleEntityNotFound(_0x2daaa3,null))[_0xefc1('0x28')](respondWithResult(_0x2daaa3,null))[_0xefc1('0x44')](handleError(_0x2daaa3,null));};exports['create']=function(_0x5213a3,_0x149737){return db[_0xefc1('0x2f')][_0xefc1('0x48')](_0x5213a3[_0xefc1('0x49')],{})[_0xefc1('0x28')](function(_0x224678){var _0x367b70=_0x5213a3[_0xefc1('0x4a')][_0xefc1('0x4b')]({'plain':!![]});if(!_0x367b70)throw new Error(_0xefc1('0x4c'));if(_0x367b70[_0xefc1('0x4d')]===_0xefc1('0x4a')){var _0xf61038=_0x224678[_0xefc1('0x4b')]({'plain':!![]});var _0x40ffc4=_0xefc1('0x4e');return db[_0xefc1('0x4f')]['find']({'where':{'name':_0x40ffc4,'userProfileId':_0x367b70['userProfileId']},'raw':!![]})['then'](function(_0x2f6699){if(_0x2f6699&&_0x2f6699[_0xefc1('0x50')]===0x0){return db[_0xefc1('0x51')][_0xefc1('0x48')]({'name':_0xf61038['name'],'resourceId':_0xf61038['id'],'type':_0x2f6699[_0xefc1('0x2b')],'sectionId':_0x2f6699['id']},{})[_0xefc1('0x28')](function(){return _0x224678;});}else{return _0x224678;}})['catch'](function(_0x1be3c0){logger[_0xefc1('0x52')](_0xefc1('0x53'),_0x1be3c0);throw _0x1be3c0;});}return _0x224678;})[_0xefc1('0x28')](respondWithResult(_0x149737,0xc9))[_0xefc1('0x44')](handleError(_0x149737,null));};exports[_0xefc1('0x27')]=function(_0xaa6efb,_0x2f9789){if(_0xaa6efb[_0xefc1('0x49')]['id']){delete _0xaa6efb['body']['id'];}return db[_0xefc1('0x2f')][_0xefc1('0x54')]({'where':{'id':_0xaa6efb[_0xefc1('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f9789,null))[_0xefc1('0x28')](saveUpdates(_0xaa6efb[_0xefc1('0x49')],null))[_0xefc1('0x28')](respondWithResult(_0x2f9789,null))['catch'](handleError(_0x2f9789,null));};exports[_0xefc1('0x55')]=function(_0x2e72c9,_0x57216c){var _0x38ab89=_0x2e72c9['params']['id'];var _0x54f7c3=[];return db['sequelize']['transaction'](function(_0x3d6212){var _0x41e989=_0xefc1('0x56')+_0x38ab89;return db[_0xefc1('0x57')]['query'](_0x41e989,{'type':db['Sequelize'][_0xefc1('0x58')][_0xefc1('0x59')],'raw':!![],'transaction':_0x3d6212})[_0xefc1('0x28')](function(_0x1a7a1f){_0x54f7c3=_[_0xefc1('0x2e')](_0x1a7a1f,function(_0x1080d8){return Number(_0x1080d8['UserId']);});})[_0xefc1('0x28')](function(){var _0x2b0e31=_0xefc1('0x5a')+_0x38ab89;return db[_0xefc1('0x57')][_0xefc1('0x33')](_0x2b0e31,{'type':db[_0xefc1('0x5b')][_0xefc1('0x58')][_0xefc1('0x59')],'raw':!![],'transaction':_0x3d6212});})[_0xefc1('0x28')](function(_0x51d7de){var _0x39a41e=_[_0xefc1('0x2e')](_0x51d7de,function(_0x1eb29b){return Number(_0x1eb29b[_0xefc1('0x5c')]);});return db[_0xefc1('0x5d')][_0xefc1('0x55')]({'where':{'UserId':{'$in':_0x54f7c3},'VoiceQueueId':{'$in':_0x39a41e}},'transaction':_0x3d6212});})[_0xefc1('0x28')](function(){var _0x543804=_0xefc1('0x5e')+_0x38ab89;return db['sequelize'][_0xefc1('0x33')](_0x543804,{'type':db[_0xefc1('0x5b')][_0xefc1('0x58')][_0xefc1('0x59')],'raw':!![],'transaction':_0x3d6212});})[_0xefc1('0x28')](function(_0x1746af){var _0x2fb623=_[_0xefc1('0x2e')](_0x1746af,function(_0x2527b6){return Number(_0x2527b6[_0xefc1('0x5f')]);});return db[_0xefc1('0x60')][_0xefc1('0x55')]({'where':{'UserId':{'$in':_0x54f7c3},'MailQueueId':{'$in':_0x2fb623}},'transaction':_0x3d6212});})[_0xefc1('0x28')](function(){var _0x543258=_0xefc1('0x61')+_0x38ab89;return db[_0xefc1('0x57')][_0xefc1('0x33')](_0x543258,{'type':db[_0xefc1('0x5b')][_0xefc1('0x58')][_0xefc1('0x59')],'raw':!![],'transaction':_0x3d6212});})[_0xefc1('0x28')](function(_0x3e6214){var _0x259fdd=_[_0xefc1('0x2e')](_0x3e6214,function(_0x35329d){return Number(_0x35329d['SmsQueueId']);});return db[_0xefc1('0x62')][_0xefc1('0x55')]({'where':{'UserId':{'$in':_0x54f7c3},'SmsQueueId':{'$in':_0x259fdd}},'transaction':_0x3d6212});})[_0xefc1('0x28')](function(){var _0x40f009=_0xefc1('0x63')+_0x38ab89;return db[_0xefc1('0x57')][_0xefc1('0x33')](_0x40f009,{'type':db['Sequelize'][_0xefc1('0x58')][_0xefc1('0x59')],'raw':!![],'transaction':_0x3d6212});})[_0xefc1('0x28')](function(_0x5308d4){var _0x33cc37=_[_0xefc1('0x2e')](_0x5308d4,function(_0x3bf1d9){return Number(_0x3bf1d9[_0xefc1('0x64')]);});return db[_0xefc1('0x65')][_0xefc1('0x55')]({'where':{'UserId':{'$in':_0x54f7c3},'ChatQueueId':{'$in':_0x33cc37}},'transaction':_0x3d6212});})[_0xefc1('0x28')](function(){var _0x374c0d=_0xefc1('0x66')+_0x38ab89;return db[_0xefc1('0x57')]['query'](_0x374c0d,{'type':db[_0xefc1('0x5b')][_0xefc1('0x58')][_0xefc1('0x59')],'raw':!![],'transaction':_0x3d6212});})[_0xefc1('0x28')](function(_0x33c0df){var _0x55e9a5=_['map'](_0x33c0df,function(_0x42f407){return Number(_0x42f407[_0xefc1('0x67')]);});return db[_0xefc1('0x68')]['destroy']({'where':{'UserId':{'$in':_0x54f7c3},'FaxQueueId':{'$in':_0x55e9a5}},'transaction':_0x3d6212});})[_0xefc1('0x28')](function(){var _0x20a42f='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x38ab89;return db[_0xefc1('0x57')][_0xefc1('0x33')](_0x20a42f,{'type':db[_0xefc1('0x5b')][_0xefc1('0x58')][_0xefc1('0x59')],'raw':!![],'transaction':_0x3d6212});})[_0xefc1('0x28')](function(_0x5c390a){var _0x5d3630=_[_0xefc1('0x2e')](_0x5c390a,function(_0x1e1921){return Number(_0x1e1921[_0xefc1('0x69')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x54f7c3},'OpenchannelQueueId':{'$in':_0x5d3630}},'transaction':_0x3d6212});})['then'](function(){var _0x454f6f=_0xefc1('0x6a')+_0x38ab89;return db['sequelize'][_0xefc1('0x33')](_0x454f6f,{'type':db['Sequelize'][_0xefc1('0x58')]['SELECT'],'raw':!![],'transaction':_0x3d6212});})[_0xefc1('0x28')](function(_0x4bc3f4){var _0x52dc04=_[_0xefc1('0x2e')](_0x4bc3f4,function(_0x5ac605){return Number(_0x5ac605[_0xefc1('0x6b')]);});return db[_0xefc1('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x54f7c3},'WhatsappQueueId':{'$in':_0x52dc04}},'transaction':_0x3d6212});})[_0xefc1('0x28')](function(){return db[_0xefc1('0x6d')]['find']({'where':{'TeamId':_0x38ab89}});})[_0xefc1('0x28')](function(_0x11071a){if(_0x11071a===null){return;}return db['UserVoicePrefix'][_0xefc1('0x55')]({'where':{'UserId':{'$in':_0x54f7c3},'VoicePrefixId':_0x11071a[_0xefc1('0x6e')]},'transaction':_0x3d6212});})[_0xefc1('0x28')](function(){return db['Team'][_0xefc1('0x55')]({'where':{'id':_0x38ab89},'cascade':!![],'transaction':_0x3d6212});})[_0xefc1('0x28')](function(_0xce94b4){if(_0xce94b4===0x0){_0x57216c[_0xefc1('0x29')](0x194);}else{return db[_0xefc1('0x51')][_0xefc1('0x55')]({'where':{'type':_0xefc1('0x4e'),'resourceId':_0x38ab89},'cascade':!![],'transaction':_0x3d6212})['then'](function(){_0x57216c[_0xefc1('0x1c')](0xcc)[_0xefc1('0x1d')]();});}})['catch'](function(_0x5cbe37){_0x57216c[_0xefc1('0x1c')](0x1f4)[_0xefc1('0x2c')](_0x5cbe37);});});};exports[_0xefc1('0x6f')]=function(_0x54d918,_0x3dcfd9,_0x57fdbb){return db[_0xefc1('0x2f')][_0xefc1('0x70')]({'where':{'id':_0x54d918['params']['id']}})[_0xefc1('0x28')](handleEntityNotFound(_0x3dcfd9,null))[_0xefc1('0x28')](function(_0x565225){if(!_0x54d918[_0xefc1('0x33')][_0xefc1('0x71')]||!utils[_0xefc1('0x72')](_0x54d918['query'][_0xefc1('0x71')])){throw new db[(_0xefc1('0x5b'))][(_0xefc1('0x73'))](_0xefc1('0x74'));}var _0xdff419={};var _0x22cf54={};_0x22cf54['model']=_[_0xefc1('0x46')](db[_[_0xefc1('0x75')](_0x54d918[_0xefc1('0x33')][_0xefc1('0x71')][_0xefc1('0x76')]())+_0xefc1('0x77')]['rawAttributes']);_0x22cf54[_0xefc1('0x33')]=_['keys'](_0x54d918[_0xefc1('0x33')]);_0x22cf54[_0xefc1('0x34')]=_[_0xefc1('0x36')](_0x22cf54[_0xefc1('0x32')],_0x22cf54[_0xefc1('0x33')]);_0xdff419['attributes']=_[_0xefc1('0x36')](_0x22cf54['model'],qs[_0xefc1('0x37')](_0x54d918['query'][_0xefc1('0x37')]));_0xdff419[_0xefc1('0x35')]=_0xdff419[_0xefc1('0x35')][_0xefc1('0x78')]?_0xdff419[_0xefc1('0x35')]:_0x22cf54[_0xefc1('0x32')];_0xdff419[_0xefc1('0x20')]=qs['limit'](_0x54d918['query'][_0xefc1('0x20')]);_0xdff419['offset']=qs['offset'](_0x54d918[_0xefc1('0x33')][_0xefc1('0x1e')]);_0xdff419[_0xefc1('0x39')]=qs[_0xefc1('0x3a')](_0x54d918[_0xefc1('0x33')][_0xefc1('0x3a')]);_0xdff419[_0xefc1('0x3b')]=qs[_0xefc1('0x34')](_[_0xefc1('0x79')](_0x54d918[_0xefc1('0x33')],_0x22cf54[_0xefc1('0x34')]));_0xdff419=_['merge']({},_0xdff419,_0x54d918['options']);return _0x565225[_0xefc1('0x4b')+_['capitalize'](_0x54d918[_0xefc1('0x33')][_0xefc1('0x71')]['toLowerCase']())+_0xefc1('0x7a')](_0xdff419);})[_0xefc1('0x28')](respondWithResult(_0x3dcfd9,null))[_0xefc1('0x44')](handleError(_0x3dcfd9,null));};exports['addQueues']=function(_0x2cac3e,_0x5834d7,_0xb19b49){return db[_0xefc1('0x2f')][_0xefc1('0x70')]({'where':{'id':_0x2cac3e[_0xefc1('0x45')]['id']}})[_0xefc1('0x28')](function(_0x2e29a9){if(_0x2e29a9){if(!_0x2cac3e[_0xefc1('0x49')][_0xefc1('0x71')]||!utils[_0xefc1('0x72')](_0x2cac3e['body'][_0xefc1('0x71')])){throw new db[(_0xefc1('0x5b'))][(_0xefc1('0x73'))](_0xefc1('0x74'));}return _0x2e29a9[_0xefc1('0x7b')+_['capitalize'](_0x2cac3e[_0xefc1('0x49')][_0xefc1('0x71')][_0xefc1('0x76')]())+_0xefc1('0x7a')](_0x2cac3e[_0xefc1('0x49')][_0xefc1('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x5834d7,null))['then'](respondWithStatusCode(_0x5834d7,null))[_0xefc1('0x44')](handleError(_0x5834d7,null));};exports[_0xefc1('0x7d')]=function(_0x44f785,_0x4ef049,_0x2fe925){return db['Team']['findOne']({'where':{'id':_0x44f785['params']['id']}})[_0xefc1('0x28')](function(_0xb89377){if(_0xb89377){if(!_0x44f785['query'][_0xefc1('0x71')]||!utils[_0xefc1('0x72')](_0x44f785[_0xefc1('0x33')][_0xefc1('0x71')])){throw new db[(_0xefc1('0x5b'))][(_0xefc1('0x73'))](_0xefc1('0x74'));}return _0xb89377[_0xefc1('0x7e')+_['capitalize'](_0x44f785[_0xefc1('0x33')][_0xefc1('0x71')][_0xefc1('0x76')]())+_0xefc1('0x7a')](_0x44f785[_0xefc1('0x33')][_0xefc1('0x7c')]);}return null;})[_0xefc1('0x28')](handleEntityNotFound(_0x4ef049,null))[_0xefc1('0x28')](respondWithStatusCode(_0x4ef049,null))[_0xefc1('0x44')](handleError(_0x4ef049,null));};exports[_0xefc1('0x7f')]=function(_0x4fef4a,_0x350d72){var _0x2d4330=_[_0xefc1('0x80')](_0x4fef4a[_0xefc1('0x49')][_0xefc1('0x7c')])?_0x4fef4a['body'][_0xefc1('0x7c')]:[_0x4fef4a[_0xefc1('0x49')]['ids']];var _0x29756c=_0x4fef4a[_0xefc1('0x45')]['id'];return db['Team'][_0xefc1('0x54')]({'where':{'id':_0x29756c}})[_0xefc1('0x28')](handleEntityNotFound(_0x350d72,null))[_0xefc1('0x28')](function(_0xec5356){if(_0xec5356){var _0x1b61d7=[_0xefc1('0x81'),_0xefc1('0x82'),_0xefc1('0x83'),_0xefc1('0x84'),_0xefc1('0x85'),_0xefc1('0x86'),_0xefc1('0x87')];return db[_0xefc1('0x57')]['transaction'](function(_0x42d426){var _0x4b203c=_[_0xefc1('0x2e')](_0x1b61d7,function(_0x1e6d8d){var _0x2fff33={'attributes':['id',_0xefc1('0x2b')]};if(_0x1e6d8d===_0xefc1('0x81')){_0x2fff33[_0xefc1('0x88')]={'attributes':[_0xefc1('0x89')]};}return _0xec5356['get'+_0x1e6d8d+_0xefc1('0x7a')](_0x2fff33)[_0xefc1('0x28')](function(_0x4971b5){var _0x27aff0=_[_0xefc1('0x2e')](_0x4971b5,function(_0x2868b8){var _0x4493c0=_[_0xefc1('0x2e')](_0x2d4330,function(_0x13435d){var _0x57f78d={'where':{'UserId':_0x13435d,[_0x1e6d8d+_0xefc1('0x8a')]:_0x2868b8['id']},'transaction':_0x42d426};if(_0x1e6d8d==='Voice'){_0x57f78d['defaults']={'penalty':_0x2868b8[_0xefc1('0x8b')][_0xefc1('0x89')]};}return db['User'+_0x1e6d8d+_0xefc1('0x77')][_0xefc1('0x8c')](_0x57f78d)[_0xefc1('0x28')](function(){socket['emit'](_0xefc1('0x4a')+_0x1e6d8d+_0xefc1('0x8d'),{'UserId':_0x13435d,[_0x1e6d8d+_0xefc1('0x8a')]:_0x2868b8['id']});if(_0x1e6d8d!==_0xefc1('0x81')){return;}return db[_0xefc1('0x8e')][_0xefc1('0x8f')]({'where':{'id':_0x2d4330,'online':0x1},'attributes':['id','name',_0xefc1('0x90'),'voicePause',_0xefc1('0x91')],'raw':!![]})[_0xefc1('0x28')](function(_0x43ca99){var _0x20d96d=_[_0xefc1('0x2e')](_0x43ca99,function(_0x16eb86){return db[_0xefc1('0x92')]['upsert']({'membername':_0x16eb86[_0xefc1('0x2b')],'UserId':_0x16eb86['id'],'queue_name':_0x2868b8[_0xefc1('0x2b')],'VoiceQueueId':_0x2868b8['id'],'interface':_['isNil'](_0x16eb86[_0xefc1('0x91')])?util[_0xefc1('0x93')](_0xefc1('0x94'),_0x16eb86[_0xefc1('0x2b')]):_0x16eb86[_0xefc1('0x91')],'paused':_0x16eb86[_0xefc1('0x95')]||![],'penalty':_0x2868b8[_0xefc1('0x8b')][_0xefc1('0x89')]},{'transaction':_0x42d426});});return Promise['all'](_0x20d96d);});});});return Promise[_0xefc1('0x96')](_0x4493c0);});return Promise[_0xefc1('0x96')](_0x27aff0);})[_0xefc1('0x28')](function(){return db[_0xefc1('0x6d')][_0xefc1('0x70')]({'where':{'teamId':_0x29756c}})['then'](function(_0x2f685a){if(_0x2f685a){var _0x4d2fe7=_[_0xefc1('0x2e')](_0x2d4330,function(_0x53b17d){db[_0xefc1('0x97')][_0xefc1('0x98')]({'UserId':_0x53b17d,'VoicePrefixId':_0x2f685a[_0xefc1('0x6e')]});});return Promise['all'](_0x4d2fe7);}});});});return Promise[_0xefc1('0x96')](_0x4b203c)[_0xefc1('0x28')](function(){return _0xec5356['addAgents'](_0x2d4330,{'transaction':_0x42d426})[_0xefc1('0x99')](function(_0xe3b13c){return _0xe3b13c;});});});}})['then'](respondWithResult(_0x350d72,null))[_0xefc1('0x44')](handleError(_0x350d72,null));};exports[_0xefc1('0x9a')]=function(_0x1fc401,_0x268616){var _0x3fbae9=_[_0xefc1('0x80')](_0x1fc401['query'][_0xefc1('0x7c')])?_0x1fc401[_0xefc1('0x33')][_0xefc1('0x7c')]:[_0x1fc401[_0xefc1('0x33')][_0xefc1('0x7c')]];var _0x4b10df=_0x1fc401[_0xefc1('0x45')]['id'];return db[_0xefc1('0x2f')][_0xefc1('0x54')]({'where':{'id':_0x4b10df}})[_0xefc1('0x28')](handleEntityNotFound(_0x268616,null))['then'](function(_0x55eb8c){if(_0x55eb8c){var _0x2ffc06=[_0xefc1('0x81'),_0xefc1('0x82'),_0xefc1('0x83'),_0xefc1('0x84'),_0xefc1('0x85'),_0xefc1('0x86'),'Whatsapp'];return db[_0xefc1('0x57')]['transaction'](function(_0x52fc5a){var _0x173aa0=_[_0xefc1('0x2e')](_0x2ffc06,function(_0x36fe2b){var _0x15b8f6={'attributes':['id',_0xefc1('0x2b')]};return _0x55eb8c[_0xefc1('0x4b')+_0x36fe2b+_0xefc1('0x7a')](_0x15b8f6)['then'](function(_0x364437){var _0x17a1d9=_[_0xefc1('0x2e')](_0x364437,function(_0x24b92c){return _0x24b92c[_0xefc1('0x9a')](_0x3fbae9,{'transaction':_0x52fc5a})['then'](function(){var _0x5f4a79=_[_0xefc1('0x2e')](_0x3fbae9,function(_0x594c40){socket['emit']('user'+_0x36fe2b+_0xefc1('0x9b'),{'UserId':Number(_0x594c40),[_0x36fe2b+_0xefc1('0x8a')]:_0x24b92c['id']});if(_0x36fe2b!==_0xefc1('0x81')){return;}return db[_0xefc1('0x92')]['destroy']({'where':{'VoiceQueueId':_0x24b92c['id'],'UserId':_0x594c40},'transaction':_0x52fc5a});});return Promise[_0xefc1('0x96')](_0x5f4a79);});});return Promise['all'](_0x17a1d9);});});return Promise[_0xefc1('0x96')](_0x173aa0)[_0xefc1('0x28')](function(){return _0x55eb8c['removeAgents'](_0x3fbae9,{'transaction':_0x52fc5a});})[_0xefc1('0x28')](function(){return db['TeamVoicePrefix'][_0xefc1('0x70')]({'where':{'teamId':_0x4b10df}})['then'](function(_0x30b8c4){if(_0x30b8c4){var _0x90a4ea=_[_0xefc1('0x2e')](_0x3fbae9,function(_0x52232f){db[_0xefc1('0x97')][_0xefc1('0x55')]({'where':{'UserId':_0x52232f,'VoicePrefixId':_0x30b8c4[_0xefc1('0x6e')]}});});return Promise[_0xefc1('0x96')](_0x90a4ea);}});});});}})[_0xefc1('0x28')](respondWithStatusCode(_0x268616,null))['catch'](handleError(_0x268616,null));};exports['getAgents']=function(_0x10016f,_0x1babcf,_0x44b2a1){var _0x3a239a={};var _0x4cac18={};var _0x560414;var _0x408696;return db[_0xefc1('0x2f')][_0xefc1('0x70')]({'where':{'id':_0x10016f['params']['id']}})[_0xefc1('0x28')](handleEntityNotFound(_0x1babcf,null))[_0xefc1('0x28')](function(_0x5227b8){if(_0x5227b8){_0x560414=_0x5227b8;_0x4cac18[_0xefc1('0x32')]=_[_0xefc1('0x46')](db[_0xefc1('0x8e')][_0xefc1('0x47')]);_0x4cac18['query']=_['keys'](_0x10016f[_0xefc1('0x33')]);_0x4cac18[_0xefc1('0x34')]=_['intersection'](_0x4cac18[_0xefc1('0x32')],_0x4cac18[_0xefc1('0x33')]);_0x3a239a[_0xefc1('0x35')]=_[_0xefc1('0x36')](_0x4cac18[_0xefc1('0x32')],qs[_0xefc1('0x37')](_0x10016f[_0xefc1('0x33')][_0xefc1('0x37')]));_0x3a239a['attributes']=_0x3a239a[_0xefc1('0x35')][_0xefc1('0x78')]?_0x3a239a['attributes']:_0x4cac18[_0xefc1('0x32')];_0x3a239a[_0xefc1('0x39')]=qs[_0xefc1('0x3a')](_0x10016f[_0xefc1('0x33')][_0xefc1('0x3a')]);_0x3a239a[_0xefc1('0x3b')]=qs[_0xefc1('0x34')](_[_0xefc1('0x79')](_0x10016f[_0xefc1('0x33')],_0x4cac18['filters']));if(_0x10016f[_0xefc1('0x33')][_0xefc1('0x3c')]){_0x3a239a[_0xefc1('0x3b')]=_[_0xefc1('0x3d')](_0x3a239a[_0xefc1('0x3b')],{'$or':_['map'](_0x3a239a[_0xefc1('0x35')],function(_0xaed136){var _0x461a79={};_0x461a79[_0xaed136]={'$like':'%'+_0x10016f[_0xefc1('0x33')][_0xefc1('0x3c')]+'%'};return _0x461a79;})});}_0x3a239a=_['merge']({},_0x3a239a,_0x10016f[_0xefc1('0x40')]);return _0x560414[_0xefc1('0x9c')](_0x3a239a);}})[_0xefc1('0x28')](function(_0x242f6d){if(_0x242f6d){_0x408696=_0x242f6d[_0xefc1('0x78')];if(!_0x10016f[_0xefc1('0x33')][_0xefc1('0x9d')](_0xefc1('0x38'))){_0x3a239a[_0xefc1('0x20')]=qs['limit'](_0x10016f[_0xefc1('0x33')][_0xefc1('0x20')]);_0x3a239a['offset']=qs[_0xefc1('0x1e')](_0x10016f[_0xefc1('0x33')][_0xefc1('0x1e')]);}return _0x560414['getAgents'](_0x3a239a);}})[_0xefc1('0x28')](function(_0x4f6f9d){if(_0x4f6f9d){return _0x4f6f9d?{'count':_0x408696,'rows':_0x4f6f9d}:null;}})[_0xefc1('0x28')](respondWithResult(_0x1babcf,null))[_0xefc1('0x44')](handleError(_0x1babcf,null));};
\ No newline at end of file