Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / voiceQueue / voiceQueue.controller.js
index 6b0ccae..31a54f4 100644 (file)
@@ -1 +1 @@
-const a903_0x4105=['CmHopper','sequelize','offset','UserVoiceQueueRt','CmList','COALESCE(phone,\x27\x27)','update','util','updatedAt','compact','online','SIP/%s','send','phone\x20NOT\x20IN\x20(?)','format','VoiceQueues','intersection','select','addLists','UserProfileSection','include','scheduledAt','filters','omit','role','type','json','order','removeBlackLists','CmHopperFinal','fields','VoiceQueue','cm_hopper','phone','getHopperFinals','like','clone','value','attributes','keys','removeTeams','../../rediscache','emit','union','merge','from','penalty','NOW()','count','always','./voiceQueue.socket','every','end','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','name','userVoiceQueue:remove','isEmpty','status','nolimit','sort','voicePause','deletedAt\x20IS\x20NULL','teams','CmHopperBlack','createdAt','userVoiceQueue:save','UserVoiceQueue','index','CmListId','error','COALESCE(calleridnum,\x27\x27)','tq.TeamId','filter','cm_hopper_final','fieldName','params','includes','toString','create','removeAgents','VIRTUAL','findOrCreate','../../mysqldb','map','catch','flatMap','getLists','User','destroy','outbound','upsert','getMembers','findOne','length','Team','body','Agents','ut.TeamId\x20=\x20tq.TeamId','where','ListId\x20=\x20?','UserProfileResource','squel','dialCheckDuplicateType','insert','isArray','cm_contacts','interface','into','options','VoiceQueueId\x20=\x20?','userProfileId','key','fromQuery','ContactId','QueueCampaigns','model','ListId','findAll','getAgents','autoAssociation','getHoppers','limit','find','inbound','query','addAgents','SELECT','rawAttributes','../../config/logger','team_has_voice_queues','register','removeLists','user_has_teams','getBlackLists','addBlackLists','forEach','show','rows','VoiceQueueId','CmHopperHistory','sendStatus','field','isNil','Content-Range','pick','addTeams','get','all','cm_hopper_black','includeAll','getHopperBlacks','user','getTeams','then','ut.UserId\x20=\x20?','push','api','ids','phone\x20IS\x20NOT\x20NULL','undefined'];(function(_0x14a9dd,_0xce3067){const _0x4105dd=function(_0x559613){while(--_0x559613){_0x14a9dd['push'](_0x14a9dd['shift']());}};_0x4105dd(++_0xce3067);}(a903_0x4105,0x159));const a903_0x5596=function(_0x14a9dd,_0xce3067){_0x14a9dd=_0x14a9dd-0xc9;let _0x4105dd=a903_0x4105[_0x14a9dd];return _0x4105dd;};const a903_0x15cc44=a903_0x5596;'use strict';const util=require(a903_0x15cc44(0x157)),_=require('lodash'),squel=require(a903_0x15cc44(0x115)),qs=require('../../components/parsers/qs'),logger=require(a903_0x15cc44(0x130))(a903_0x15cc44(0x14c)),{getSocket}=require(a903_0x15cc44(0xd9)),socket=getSocket(),{db}=require(a903_0x15cc44(0x102)),{Op,QueryTypes}=require(a903_0x15cc44(0x151));require(a903_0x15cc44(0xe2))[a903_0x15cc44(0x132)](socket);function respondWithStatusCode(_0x1ba7d4,_0x57227a){return _0x57227a=_0x57227a||0xcc,function(_0xbb0f93){const _0x165d22=a903_0x5596;if(_0xbb0f93)return _0x1ba7d4[_0x165d22(0x13c)](_0x57227a);return _0x1ba7d4[_0x165d22(0xe9)](_0x57227a)['end']();};}function respondWithResult(_0x576e50,_0xbf1989){return _0xbf1989=_0xbf1989||0xc8,function(_0x243ec9){const _0x213ed7=a903_0x5596;if(_0x243ec9)return _0x576e50[_0x213ed7(0xe9)](_0xbf1989)[_0x213ed7(0xca)](_0x243ec9);};}function respondWithFilteredResult(_0x527151,_0x473140){return function(_0x914049){const _0x20bca4=a903_0x5596;if(_0x914049){const _0x5d2d29=_0x914049[_0x20bca4(0xe0)],_0x180f6c=_0x473140['offset'];let _0x322b2d=_0x473140[_0x20bca4(0x152)]+_0x473140['limit'],_0x289b55;return _0x322b2d>=_0x5d2d29?(_0x322b2d=_0x5d2d29,_0x289b55=0xc8):_0x289b55=0xce,_0x527151['status'](_0x289b55),_0x527151['set'](_0x20bca4(0x13f),_0x180f6c+'-'+_0x322b2d+'/'+_0x5d2d29)[_0x20bca4(0xca)](_0x914049);}return null;};}function saveUpdates(_0x2ab4a9){return function(_0x585af1){const _0x167f62=a903_0x5596;if(_0x585af1)return _0x585af1[_0x167f62(0x156)](_0x2ab4a9)[_0x167f62(0x149)](function(_0x32395e){return _0x32395e;});return null;};}function removeEntity(_0x2d38cb){return function(_0x5f0011){const _0x4e5c34=a903_0x5596;if(_0x5f0011)return _0x5f0011[_0x4e5c34(0x108)]()[_0x4e5c34(0x149)](function(){const _0x1e070e=_0x4e5c34,_0x34b076=_0x5f0011[_0x1e070e(0x142)]({'plain':!![]}),_0x4b681e=[{'name':_0x1e070e(0x15f),'value':_0x1e070e(0x12b),'ignore':![]},{'name':'QueueCampaigns','value':_0x1e070e(0x109),'ignore':![]}],_0x2aaef7=_(_0x4b681e)[_0x1e070e(0xf8)]('ignore')[_0x1e070e(0x103)](_0x1e070e(0xd5))[_0x1e070e(0xd5)]();if(_['includes'](_0x2aaef7,_0x34b076[_0x1e070e(0xc9)]))return;const _0x202e3b=_['find'](_0x4b681e,['value',_0x34b076[_0x1e070e(0xc9)]])[_0x1e070e(0xe6)];return db[_0x1e070e(0x114)][_0x1e070e(0x108)]({'where':{'type':_0x202e3b,'resourceId':_0x34b076['id']}})[_0x1e070e(0x149)](function(){return _0x5f0011;});})['then'](function(){const _0x5937e9=_0x4e5c34;_0x2d38cb[_0x5937e9(0xe9)](0xcc)[_0x5937e9(0xe4)]();});};}function handleEntityNotFound(_0x123694){return function(_0x1bc4f8){const _0x16a8d0=a903_0x5596;return!_0x1bc4f8&&_0x123694[_0x16a8d0(0x13c)](0x194),_0x1bc4f8;};}function handleError(_0x3a120b,_0x25a21e){return _0x25a21e=_0x25a21e||0x1f4,function(_0x5c4802){const _0x537aff=a903_0x5596;logger['error'](_0x5c4802['stack']),_0x5c4802[_0x537aff(0xe6)]&&delete _0x5c4802[_0x537aff(0xe6)],_0x3a120b[_0x537aff(0xe9)](_0x25a21e)[_0x537aff(0x15c)](_0x5c4802);};}exports[a903_0x15cc44(0xf3)]=function(_0x452c71,_0xf62a81){const _0x1dc733=a903_0x15cc44;let _0x327a6a={};const _0x588f68={},_0x3f95a2={'count':0x0,'rows':[]},_0x20f30c=_[_0x1dc733(0x103)](db[_0x1dc733(0xcf)][_0x1dc733(0x12f)],function(_0x186a23){const _0x217931=_0x1dc733;return{'name':_0x186a23[_0x217931(0xfa)],'type':_0x186a23[_0x217931(0xc9)][_0x217931(0x11f)]};});_0x588f68[_0x1dc733(0x123)]=_[_0x1dc733(0x103)](_0x20f30c,_0x1dc733(0xe6)),_0x588f68['query']=_[_0x1dc733(0xd7)](_0x452c71[_0x1dc733(0x12c)]),_0x588f68['filters']=_[_0x1dc733(0x160)](_0x588f68[_0x1dc733(0x123)],_0x588f68[_0x1dc733(0x12c)]),_0x327a6a[_0x1dc733(0xd6)]=_[_0x1dc733(0x160)](_0x588f68[_0x1dc733(0x123)],qs[_0x1dc733(0xce)](_0x452c71['query'][_0x1dc733(0xce)])),_0x327a6a[_0x1dc733(0xd6)]=_0x327a6a['attributes']['length']?_0x327a6a[_0x1dc733(0xd6)]:_0x588f68['model'];typeof _0x452c71['query'][_0x1dc733(0xea)]===_0x1dc733(0x14f)&&(_0x327a6a[_0x1dc733(0x129)]=qs[_0x1dc733(0x129)](_0x452c71[_0x1dc733(0x12c)][_0x1dc733(0x129)]),_0x327a6a[_0x1dc733(0x152)]=qs[_0x1dc733(0x152)](_0x452c71['query'][_0x1dc733(0x152)]));_0x327a6a[_0x1dc733(0xcb)]=qs['sort'](_0x452c71[_0x1dc733(0x12c)][_0x1dc733(0xeb)]),_0x327a6a[_0x1dc733(0x112)]=qs[_0x1dc733(0x166)](_[_0x1dc733(0x140)](_0x452c71['query'],_0x588f68[_0x1dc733(0x166)]),_0x20f30c);_0x452c71['query'][_0x1dc733(0xf8)]&&(_0x327a6a[_0x1dc733(0x112)]=_[_0x1dc733(0xdc)](_0x327a6a[_0x1dc733(0x112)],{[Op['or']]:_['map'](_0x20f30c,function(_0x393d64){const _0xa422ff=_0x1dc733;if(_0x393d64[_0xa422ff(0xc9)]!==_0xa422ff(0x100)){const _0x262e0e={};return _0x262e0e[_0x393d64[_0xa422ff(0xe6)]]={[Op['like']]:'%'+_0x452c71[_0xa422ff(0x12c)]['filter']+'%'},_0x262e0e;}})}));_0x327a6a=_[_0x1dc733(0xdc)]({},_0x327a6a,_0x452c71[_0x1dc733(0x11c)]);const _0x2e5a93={'where':_0x327a6a[_0x1dc733(0x112)]};return db[_0x1dc733(0xcf)][_0x1dc733(0xe0)](_0x2e5a93)['then'](function(_0x579c90){const _0x43d42b=_0x1dc733;return _0x3f95a2[_0x43d42b(0xe0)]=_0x579c90,_0x452c71[_0x43d42b(0x12c)]['includeAll']&&(_0x327a6a[_0x43d42b(0x164)]=[{'all':!![]}]),db[_0x43d42b(0xcf)]['findAll'](_0x327a6a);})['then'](function(_0x335fc3){return _0x3f95a2['rows']=_0x335fc3,_0x3f95a2;})[_0x1dc733(0x149)](respondWithFilteredResult(_0xf62a81,_0x327a6a))['catch'](handleError(_0xf62a81,null));},exports[a903_0x15cc44(0x138)]=function(_0x33294d,_0x3ff546){const _0x505c1d=a903_0x15cc44;let _0x6fa719={'raw':![],'where':{'id':_0x33294d[_0x505c1d(0xfb)]['id']}};const _0x38611c={};return _0x38611c[_0x505c1d(0x123)]=_[_0x505c1d(0xd7)](db['VoiceQueue'][_0x505c1d(0x12f)]),_0x38611c['query']=_[_0x505c1d(0xd7)](_0x33294d[_0x505c1d(0x12c)]),_0x38611c[_0x505c1d(0x166)]=_['intersection'](_0x38611c[_0x505c1d(0x123)],_0x38611c['query']),_0x6fa719[_0x505c1d(0xd6)]=_[_0x505c1d(0x160)](_0x38611c[_0x505c1d(0x123)],qs['fields'](_0x33294d[_0x505c1d(0x12c)][_0x505c1d(0xce)])),_0x6fa719['attributes']=_0x6fa719[_0x505c1d(0xd6)][_0x505c1d(0x10d)]?_0x6fa719['attributes']:_0x38611c['model'],_0x33294d[_0x505c1d(0x12c)][_0x505c1d(0x145)]&&(_0x6fa719['include']=[{'all':!![]}]),_0x6fa719=_[_0x505c1d(0xdc)]({},_0x6fa719,_0x33294d['options']),db[_0x505c1d(0xcf)][_0x505c1d(0x10c)](_0x6fa719)['then'](handleEntityNotFound(_0x3ff546,null))[_0x505c1d(0x149)](respondWithResult(_0x3ff546,null))[_0x505c1d(0x104)](handleError(_0x3ff546,null));},exports[a903_0x15cc44(0xfe)]=function(_0x576ba7,_0x2c0681){const _0x37b81c=a903_0x15cc44;return db[_0x37b81c(0xcf)][_0x37b81c(0xfe)](_0x576ba7[_0x37b81c(0x10f)],{})[_0x37b81c(0x149)](function(_0x5a4a06){const _0x482136=_0x37b81c,_0x5711be=_0x576ba7[_0x482136(0x147)]['get']({'plain':!![]});if(!_0x5711be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5711be[_0x482136(0x168)]==='user'){const _0x24d27e=_0x5a4a06[_0x482136(0x142)]({'plain':!![]}),_0x3bf811=[{'name':_0x482136(0x15f),'value':_0x482136(0x12b)},{'name':'QueueCampaigns','value':'outbound'}],_0x2ba509=_[_0x482136(0x12a)](_0x3bf811,[_0x482136(0xd5),_0x24d27e[_0x482136(0xc9)]])[_0x482136(0xe6)];return db[_0x482136(0x163)][_0x482136(0x10c)]({'where':{'name':_0x2ba509,'userProfileId':_0x5711be[_0x482136(0x11e)]},'raw':!![]})[_0x482136(0x149)](function(_0x2b27f1){const _0x2332fd=_0x482136;return _0x2b27f1&&_0x2b27f1[_0x2332fd(0x127)]===0x0?db[_0x2332fd(0x114)][_0x2332fd(0xfe)]({'name':_0x24d27e[_0x2332fd(0xe6)],'resourceId':_0x24d27e['id'],'type':_0x2b27f1[_0x2332fd(0xe6)],'sectionId':_0x2b27f1['id']},{})[_0x2332fd(0x149)](function(){return _0x5a4a06;}):_0x5a4a06;})[_0x482136(0x104)](function(_0x3dbd09){const _0x49f1db=_0x482136;logger[_0x49f1db(0xf5)](_0x49f1db(0xe5),_0x3dbd09);throw _0x3dbd09;});}return _0x5a4a06;})['then'](respondWithResult(_0x2c0681,0xc9))[_0x37b81c(0x104)](handleError(_0x2c0681,null));},exports[a903_0x15cc44(0xd4)]=function(_0x2418ce,_0x4a82d4){const _0xf9c47=a903_0x15cc44;let _0x17a185={'where':{'id':_0x2418ce[_0xf9c47(0xfb)]['id']}};const _0x54eb6d={};return _0x54eb6d[_0xf9c47(0x123)]=_['keys'](db['VoiceQueue'][_0xf9c47(0x12f)]),_0x17a185['attributes']=_[_0xf9c47(0x160)](_0x54eb6d['model'],qs[_0xf9c47(0xce)](_0x2418ce['query'][_0xf9c47(0xce)])),_0x17a185[_0xf9c47(0xd6)]=_0x17a185[_0xf9c47(0xd6)][_0xf9c47(0x10d)]?_0x17a185[_0xf9c47(0xd6)]:_0x54eb6d['model'],_0x2418ce['query'][_0xf9c47(0x145)]&&(_0x17a185[_0xf9c47(0x164)]=[{'all':!![]}]),_0x17a185=_[_0xf9c47(0xdc)]({},_0x17a185,_0x2418ce[_0xf9c47(0x11c)]),db[_0xf9c47(0xcf)][_0xf9c47(0x10c)](_0x17a185)[_0xf9c47(0x149)](handleEntityNotFound(_0x4a82d4,null))[_0xf9c47(0x149)](function(_0x5c0017){const _0x7c4003=_0xf9c47;if(_0x5c0017){let _0x1e626f=_0x5c0017[_0x7c4003(0x142)]({'plain':!![]});return _0x1e626f=qs['omit'](_0x1e626f,['id',_0x7c4003(0xf0),_0x7c4003(0x158)]),_0x2418ce['body']=_['omit'](_0x2418ce['body'],['id','createdAt','updatedAt']),db[_0x7c4003(0xcf)][_0x7c4003(0xfe)](_['merge'](_0x1e626f,_0x2418ce['body']),{'include':_0x2418ce[_0x7c4003(0x12c)][_0x7c4003(0x145)]?[{'all':!![]}]:undefined})[_0x7c4003(0x149)](function(_0x4956ca){const _0x26f3ca=_0x7c4003,_0x2ee53b=_0x2418ce['user'][_0x26f3ca(0x142)]({'plain':!![]});if(!_0x2ee53b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ee53b[_0x26f3ca(0x168)]===_0x26f3ca(0x147)){const _0x17a4c0=_0x4956ca['get']({'plain':!![]}),_0x106f53=[{'name':_0x26f3ca(0x15f),'value':'inbound'},{'name':_0x26f3ca(0x122),'value':_0x26f3ca(0x109)}],_0x27a5dd=_[_0x26f3ca(0x12a)](_0x106f53,[_0x26f3ca(0xd5),_0x17a4c0[_0x26f3ca(0xc9)]])['name'];return db[_0x26f3ca(0x163)][_0x26f3ca(0x10c)]({'where':{'name':_0x27a5dd,'userProfileId':_0x2ee53b[_0x26f3ca(0x11e)]},'raw':!![]})[_0x26f3ca(0x149)](function(_0x296909){const _0x1368be=_0x26f3ca;return _0x296909&&_0x296909[_0x1368be(0x127)]===0x0?db[_0x1368be(0x114)]['create']({'name':_0x17a4c0[_0x1368be(0xe6)],'resourceId':_0x17a4c0['id'],'type':_0x296909[_0x1368be(0xe6)],'sectionId':_0x296909['id']},{})[_0x1368be(0x149)](function(){return _0x4956ca;}):_0x4956ca;})['catch'](function(_0x269843){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x269843);throw _0x269843;});}return _0x4956ca;});}})['then'](respondWithResult(_0x4a82d4,0xc9))['catch'](handleError(_0x4a82d4,null));},exports[a903_0x15cc44(0x156)]=function(_0x3eabc3,_0x750815){const _0x177de4=a903_0x15cc44;return _0x3eabc3[_0x177de4(0x10f)]['id']&&delete _0x3eabc3[_0x177de4(0x10f)]['id'],db[_0x177de4(0xcf)][_0x177de4(0x10c)]({'where':{'id':_0x3eabc3[_0x177de4(0xfb)]['id']}})[_0x177de4(0x149)](handleEntityNotFound(_0x750815,null))[_0x177de4(0x149)](saveUpdates(_0x3eabc3[_0x177de4(0x10f)],null))[_0x177de4(0x149)](respondWithResult(_0x750815,null))['catch'](handleError(_0x750815,null));},exports['destroy']=function(_0x262e75,_0x3dd7ec){const _0x2a5479=a903_0x15cc44;return db[_0x2a5479(0xcf)]['findOne']({'where':{'id':_0x262e75[_0x2a5479(0xfb)]['id']}})['then'](handleEntityNotFound(_0x3dd7ec,null))[_0x2a5479(0x149)](removeEntity(_0x3dd7ec,null))[_0x2a5479(0x104)](handleError(_0x3dd7ec,null));},exports[a903_0x15cc44(0x128)]=function(_0x1bf26b,_0x3095d4){const _0x4518f2=a903_0x15cc44;let _0x19b79b={'raw':![],'where':{}};const _0x28b50f={},_0x238cde={'count':0x0,'rows':[]};return db[_0x4518f2(0xcf)]['findOne']({'where':{'id':_0x1bf26b[_0x4518f2(0xfb)]['id']}})[_0x4518f2(0x149)](handleEntityNotFound(_0x3095d4,null))['then'](function(_0x3e0140){const _0x29a58d=_0x4518f2;if(_0x3e0140)return _0x28b50f['model']=_[_0x29a58d(0xd7)](db[_0x29a58d(0x150)]['rawAttributes']),_0x28b50f[_0x29a58d(0x12c)]=_[_0x29a58d(0xd7)](_0x1bf26b[_0x29a58d(0x12c)]),_0x28b50f[_0x29a58d(0x166)]=_[_0x29a58d(0x160)](_0x28b50f[_0x29a58d(0x123)],_0x28b50f['query']),_0x19b79b[_0x29a58d(0xd6)]=_[_0x29a58d(0x160)](_0x28b50f[_0x29a58d(0x123)],qs[_0x29a58d(0xce)](_0x1bf26b['query'][_0x29a58d(0xce)])),_0x19b79b[_0x29a58d(0xd6)]=_0x19b79b[_0x29a58d(0xd6)][_0x29a58d(0x10d)]?_0x19b79b['attributes']:_0x28b50f[_0x29a58d(0x123)],typeof _0x1bf26b[_0x29a58d(0x12c)]['nolimit']===_0x29a58d(0x14f)&&(_0x19b79b['limit']=qs['limit'](_0x1bf26b[_0x29a58d(0x12c)][_0x29a58d(0x129)]),_0x19b79b[_0x29a58d(0x152)]=qs[_0x29a58d(0x152)](_0x1bf26b[_0x29a58d(0x12c)][_0x29a58d(0x152)])),_0x19b79b[_0x29a58d(0xcb)]=qs[_0x29a58d(0xeb)](_0x1bf26b[_0x29a58d(0x12c)][_0x29a58d(0xeb)]),_0x19b79b[_0x29a58d(0x112)]=qs[_0x29a58d(0x166)](_[_0x29a58d(0x140)](_0x1bf26b[_0x29a58d(0x12c)],_0x28b50f[_0x29a58d(0x166)])),_0x19b79b[_0x29a58d(0x112)]['VoiceQueueId']=_0x3e0140['id'],_0x1bf26b[_0x29a58d(0x12c)]['filter']&&(_0x19b79b[_0x29a58d(0x112)]=_['merge'](_0x19b79b['where'],{[Op['or']]:_[_0x29a58d(0x103)](_0x19b79b[_0x29a58d(0xd6)],function(_0x1fdbe1){const _0x32a9f7=_0x29a58d,_0x355b9d={};return _0x355b9d[_0x1fdbe1]={[Op['like']]:'%'+_0x1bf26b[_0x32a9f7(0x12c)]['filter']+'%'},_0x355b9d;})})),_0x19b79b=_[_0x29a58d(0xdc)]({},_0x19b79b,_0x1bf26b[_0x29a58d(0x11c)]),db[_0x29a58d(0x150)]['count']({'where':_0x19b79b[_0x29a58d(0x112)]})[_0x29a58d(0x149)](function(_0x4dad43){const _0x2cd0d5=_0x29a58d;return _0x238cde['count']=_0x4dad43,_0x1bf26b[_0x2cd0d5(0x12c)][_0x2cd0d5(0x145)]&&(_0x19b79b['include']=[{'all':!![]}]),db['CmHopper'][_0x2cd0d5(0x125)](_0x19b79b);})[_0x29a58d(0x149)](function(_0x50eec2){const _0x3c221a=_0x29a58d;return _0x238cde[_0x3c221a(0x139)]=_0x50eec2,_0x238cde;});})[_0x4518f2(0x149)](respondWithFilteredResult(_0x3095d4,_0x19b79b))[_0x4518f2(0x104)](handleError(_0x3095d4,null));},exports['getHopperHistories']=function(_0x1c55e6,_0x893f93){const _0x475508=a903_0x15cc44;let _0x404780={'raw':!![],'where':{}};const _0x8454a9={},_0xa2ad7={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x475508(0x10c)]({'where':{'id':_0x1c55e6[_0x475508(0xfb)]['id']}})[_0x475508(0x149)](handleEntityNotFound(_0x893f93,null))[_0x475508(0x149)](function(_0x352c94){const _0xae829b=_0x475508;if(_0x352c94)return _0x8454a9[_0xae829b(0x123)]=_[_0xae829b(0xd7)](db['CmHopperHistory'][_0xae829b(0x12f)]),_0x8454a9[_0xae829b(0x12c)]=_['keys'](_0x1c55e6[_0xae829b(0x12c)]),_0x8454a9[_0xae829b(0x166)]=_[_0xae829b(0x160)](_0x8454a9[_0xae829b(0x123)],_0x8454a9[_0xae829b(0x12c)]),_0x404780['attributes']=_[_0xae829b(0x160)](_0x8454a9['model'],qs[_0xae829b(0xce)](_0x1c55e6[_0xae829b(0x12c)][_0xae829b(0xce)])),_0x404780[_0xae829b(0xd6)]=_0x404780[_0xae829b(0xd6)][_0xae829b(0x10d)]?_0x404780[_0xae829b(0xd6)]:_0x8454a9[_0xae829b(0x123)],typeof _0x1c55e6['query'][_0xae829b(0xea)]===_0xae829b(0x14f)&&(_0x404780[_0xae829b(0x129)]=qs['limit'](_0x1c55e6[_0xae829b(0x12c)][_0xae829b(0x129)]),_0x404780[_0xae829b(0x152)]=qs[_0xae829b(0x152)](_0x1c55e6['query'][_0xae829b(0x152)])),_0x404780[_0xae829b(0xcb)]=qs['sort'](_0x1c55e6[_0xae829b(0x12c)][_0xae829b(0xeb)]),_0x404780[_0xae829b(0x112)]=qs[_0xae829b(0x166)](_[_0xae829b(0x140)](_0x1c55e6[_0xae829b(0x12c)],_0x8454a9[_0xae829b(0x166)])),_0x404780[_0xae829b(0x112)][_0xae829b(0x13a)]=_0x352c94['id'],_0x1c55e6[_0xae829b(0x12c)][_0xae829b(0xf8)]&&(_0x404780[_0xae829b(0x112)]=_[_0xae829b(0xdc)](_0x404780[_0xae829b(0x112)],{[Op['or']]:_[_0xae829b(0x103)](_0x404780['attributes'],function(_0x28dba6){const _0x3fd9d7=_0xae829b,_0x1ce9f1={};return _0x1ce9f1[_0x28dba6]={[Op['like']]:'%'+_0x1c55e6['query'][_0x3fd9d7(0xf8)]+'%'},_0x1ce9f1;})})),_0x404780=_['merge']({},_0x404780,_0x1c55e6[_0xae829b(0x11c)]),db[_0xae829b(0x13b)][_0xae829b(0xe0)]({'where':_0x404780[_0xae829b(0x112)]})[_0xae829b(0x149)](function(_0x282eab){const _0x3fbfa0=_0xae829b;return _0xa2ad7['count']=_0x282eab,_0x1c55e6[_0x3fbfa0(0x12c)]['includeAll']&&(_0x404780[_0x3fbfa0(0x164)]=[{'all':!![]}]),db[_0x3fbfa0(0x13b)][_0x3fbfa0(0x125)](_0x404780);})['then'](function(_0x45ec10){const _0x46f808=_0xae829b;return _0xa2ad7[_0x46f808(0x139)]=_0x45ec10,_0xa2ad7;});})[_0x475508(0x149)](respondWithFilteredResult(_0x893f93,_0x404780))[_0x475508(0x104)](handleError(_0x893f93,null));},exports[a903_0x15cc44(0xd2)]=function(_0x310f78,_0x3da9eb){const _0x373770=a903_0x15cc44;let _0x3d0356={'raw':!![],'where':{}};const _0x1f592f={},_0x2c73e2={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x373770(0x10c)]({'where':{'id':_0x310f78[_0x373770(0xfb)]['id']}})[_0x373770(0x149)](handleEntityNotFound(_0x3da9eb,null))[_0x373770(0x149)](function(_0x2983af){const _0x371355=_0x373770;if(_0x2983af)return _0x1f592f[_0x371355(0x123)]=_['keys'](db[_0x371355(0xcd)]['rawAttributes']),_0x1f592f['query']=_['keys'](_0x310f78[_0x371355(0x12c)]),_0x1f592f['filters']=_[_0x371355(0x160)](_0x1f592f['model'],_0x1f592f[_0x371355(0x12c)]),_0x3d0356[_0x371355(0xd6)]=_[_0x371355(0x160)](_0x1f592f[_0x371355(0x123)],qs[_0x371355(0xce)](_0x310f78[_0x371355(0x12c)][_0x371355(0xce)])),_0x3d0356['attributes']=_0x3d0356[_0x371355(0xd6)]['length']?_0x3d0356[_0x371355(0xd6)]:_0x1f592f[_0x371355(0x123)],typeof _0x310f78['query'][_0x371355(0xea)]===_0x371355(0x14f)&&(_0x3d0356['limit']=qs['limit'](_0x310f78['query']['limit']),_0x3d0356[_0x371355(0x152)]=qs[_0x371355(0x152)](_0x310f78[_0x371355(0x12c)][_0x371355(0x152)])),_0x3d0356[_0x371355(0xcb)]=qs[_0x371355(0xeb)](_0x310f78[_0x371355(0x12c)][_0x371355(0xeb)]),_0x3d0356['where']=qs[_0x371355(0x166)](_[_0x371355(0x140)](_0x310f78['query'],_0x1f592f[_0x371355(0x166)])),_0x3d0356[_0x371355(0x112)][_0x371355(0x13a)]=_0x2983af['id'],_0x310f78['query'][_0x371355(0xf8)]&&(_0x3d0356['where']=_['merge'](_0x3d0356[_0x371355(0x112)],{[Op['or']]:_[_0x371355(0x103)](_0x3d0356[_0x371355(0xd6)],function(_0x270de){const _0x1a1819=_0x371355,_0x52690c={};return _0x52690c[_0x270de]={[Op[_0x1a1819(0xd3)]]:'%'+_0x310f78['query']['filter']+'%'},_0x52690c;})})),_0x3d0356=_['merge']({},_0x3d0356,_0x310f78['options']),db[_0x371355(0xcd)]['count']({'where':_0x3d0356[_0x371355(0x112)]})[_0x371355(0x149)](function(_0x147cab){const _0xac28ce=_0x371355;return _0x2c73e2['count']=_0x147cab,_0x310f78[_0xac28ce(0x12c)]['includeAll']&&(_0x3d0356['include']=[{'all':!![]}]),db[_0xac28ce(0xcd)]['findAll'](_0x3d0356);})[_0x371355(0x149)](function(_0x3800c4){const _0x1a1ced=_0x371355;return _0x2c73e2[_0x1a1ced(0x139)]=_0x3800c4,_0x2c73e2;});})['then'](respondWithFilteredResult(_0x3da9eb,_0x3d0356))['catch'](handleError(_0x3da9eb,null));},exports[a903_0x15cc44(0x146)]=function(_0x38bc17,_0x343457){const _0x44d1cc=a903_0x15cc44;let _0x378406={'raw':!![],'where':{}};const _0xb97dcc={},_0x29cc91={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x38bc17[_0x44d1cc(0xfb)]['id']}})[_0x44d1cc(0x149)](handleEntityNotFound(_0x343457,null))[_0x44d1cc(0x149)](function(_0x3f4abe){const _0x58444a=_0x44d1cc;if(_0x3f4abe)return _0xb97dcc[_0x58444a(0x123)]=_['keys'](db[_0x58444a(0xef)][_0x58444a(0x12f)]),_0xb97dcc['query']=_[_0x58444a(0xd7)](_0x38bc17[_0x58444a(0x12c)]),_0xb97dcc[_0x58444a(0x166)]=_[_0x58444a(0x160)](_0xb97dcc['model'],_0xb97dcc['query']),_0x378406[_0x58444a(0xd6)]=_['intersection'](_0xb97dcc['model'],qs[_0x58444a(0xce)](_0x38bc17[_0x58444a(0x12c)]['fields'])),_0x378406['attributes']=_0x378406[_0x58444a(0xd6)]['length']?_0x378406[_0x58444a(0xd6)]:_0xb97dcc['model'],typeof _0x38bc17['query'][_0x58444a(0xea)]==='undefined'&&(_0x378406[_0x58444a(0x129)]=qs[_0x58444a(0x129)](_0x38bc17[_0x58444a(0x12c)][_0x58444a(0x129)]),_0x378406[_0x58444a(0x152)]=qs[_0x58444a(0x152)](_0x38bc17[_0x58444a(0x12c)][_0x58444a(0x152)])),_0x378406['order']=qs[_0x58444a(0xeb)](_0x38bc17[_0x58444a(0x12c)][_0x58444a(0xeb)]),_0x378406[_0x58444a(0x112)]=qs[_0x58444a(0x166)](_['pick'](_0x38bc17[_0x58444a(0x12c)],_0xb97dcc[_0x58444a(0x166)])),_0x378406['where'][_0x58444a(0x13a)]=_0x3f4abe['id'],_0x38bc17[_0x58444a(0x12c)][_0x58444a(0xf8)]&&(_0x378406[_0x58444a(0x112)]=_['merge'](_0x378406[_0x58444a(0x112)],{[Op['or']]:_[_0x58444a(0x103)](_0x378406[_0x58444a(0xd6)],function(_0x16783f){const _0xfb595a=_0x58444a,_0x1e9e02={};return _0x1e9e02[_0x16783f]={[Op[_0xfb595a(0xd3)]]:'%'+_0x38bc17[_0xfb595a(0x12c)]['filter']+'%'},_0x1e9e02;})})),_0x378406=_['merge']({},_0x378406,_0x38bc17[_0x58444a(0x11c)]),db[_0x58444a(0xef)][_0x58444a(0xe0)]({'where':_0x378406[_0x58444a(0x112)]})[_0x58444a(0x149)](function(_0xdc8568){const _0x283d95=_0x58444a;return _0x29cc91[_0x283d95(0xe0)]=_0xdc8568,_0x38bc17[_0x283d95(0x12c)][_0x283d95(0x145)]&&(_0x378406['include']=[{'all':!![]}]),db[_0x283d95(0xef)][_0x283d95(0x125)](_0x378406);})['then'](function(_0x4e62c6){return _0x29cc91['rows']=_0x4e62c6,_0x29cc91;});})[_0x44d1cc(0x149)](respondWithFilteredResult(_0x343457,_0x378406))[_0x44d1cc(0x104)](handleError(_0x343457,null));},exports[a903_0x15cc44(0x148)]=function(_0x1c8af0,_0x41b4cb){const _0x239b79=a903_0x15cc44;let _0x5bf419={};const _0x55162f={};let _0x26e5e8,_0x57d06f;return db[_0x239b79(0xcf)][_0x239b79(0x10c)]({'where':{'id':_0x1c8af0['params']['id']}})[_0x239b79(0x149)](handleEntityNotFound(_0x41b4cb,null))[_0x239b79(0x149)](function(_0x1d97f5){const _0x3466bf=_0x239b79;if(_0x1d97f5)return _0x26e5e8=_0x1d97f5,_0x55162f['model']=_[_0x3466bf(0xd7)](db[_0x3466bf(0x10e)][_0x3466bf(0x12f)]),_0x55162f['query']=_['keys'](_0x1c8af0[_0x3466bf(0x12c)]),_0x55162f[_0x3466bf(0x166)]=_[_0x3466bf(0x160)](_0x55162f['model'],_0x55162f[_0x3466bf(0x12c)]),_0x5bf419[_0x3466bf(0xd6)]=_[_0x3466bf(0x160)](_0x55162f[_0x3466bf(0x123)],qs['fields'](_0x1c8af0['query'][_0x3466bf(0xce)])),_0x5bf419['attributes']=_0x5bf419[_0x3466bf(0xd6)][_0x3466bf(0x10d)]?_0x5bf419['attributes']:_0x55162f['model'],_0x5bf419[_0x3466bf(0xcb)]=qs[_0x3466bf(0xeb)](_0x1c8af0[_0x3466bf(0x12c)][_0x3466bf(0xeb)]),_0x5bf419[_0x3466bf(0x112)]=qs[_0x3466bf(0x166)](_[_0x3466bf(0x140)](_0x1c8af0[_0x3466bf(0x12c)],_0x55162f[_0x3466bf(0x166)])),_0x1c8af0[_0x3466bf(0x12c)][_0x3466bf(0xf8)]&&(_0x5bf419[_0x3466bf(0x112)]=_['merge'](_0x5bf419['where'],{[Op['or']]:_[_0x3466bf(0x103)](_0x5bf419[_0x3466bf(0xd6)],function(_0x2339e1){const _0x5149b2=_0x3466bf,_0x5225b2={};return _0x5225b2[_0x2339e1]={[Op[_0x5149b2(0xd3)]]:'%'+_0x1c8af0[_0x5149b2(0x12c)][_0x5149b2(0xf8)]+'%'},_0x5225b2;})})),_0x5bf419=_['merge']({},_0x5bf419,_0x1c8af0['options']),_0x26e5e8['getTeams'](_0x5bf419);})[_0x239b79(0x149)](function(_0x186700){const _0x42fe3c=_0x239b79;if(_0x186700)return _0x57d06f=_0x186700[_0x42fe3c(0x10d)],typeof _0x1c8af0[_0x42fe3c(0x12c)]['nolimit']===_0x42fe3c(0x14f)&&(_0x5bf419['limit']=qs['limit'](_0x1c8af0['query'][_0x42fe3c(0x129)]),_0x5bf419[_0x42fe3c(0x152)]=qs[_0x42fe3c(0x152)](_0x1c8af0[_0x42fe3c(0x12c)][_0x42fe3c(0x152)])),_0x26e5e8[_0x42fe3c(0x148)](_0x5bf419);})[_0x239b79(0x149)](function(_0x27714a){if(_0x27714a)return _0x27714a?{'count':_0x57d06f,'rows':_0x27714a}:null;})[_0x239b79(0x149)](respondWithResult(_0x41b4cb,null))['catch'](handleError(_0x41b4cb,null));},exports['addTeams']=function(_0x657e66,_0x5e1b2f){const _0x305910=a903_0x15cc44,_0x117d2c=_0x657e66[_0x305910(0x10f)][_0x305910(0xee)],_0x356fda=_[_0x305910(0x103)](_0x117d2c,'id');return db[_0x305910(0x10e)][_0x305910(0x125)]({'where':{'id':_0x356fda},'attributes':['id'],'include':[{'model':db[_0x305910(0x107)],'as':_0x305910(0x110),'attributes':['id',_0x305910(0xe6),'online',_0x305910(0xec),_0x305910(0x11a)],'raw':!![]}]})['then'](function(_0x29148d){const _0x36f905=_0x305910;if(_0x29148d){const _0x260360=_[_0x36f905(0x105)](_0x29148d,function(_0x17bb0f){const _0x3152d0=_0x36f905,_0x2aef62=_0x17bb0f[_0x3152d0(0x142)]({'plain':!![]});return _0x2aef62[_0x3152d0(0x110)]['forEach'](function(_0x323a60){const _0x1fe692=_0x3152d0;_0x323a60['penalty']=_[_0x1fe692(0x12a)](_0x117d2c,{'id':_0x2aef62['id']})['penalty'];}),_0x2aef62[_0x3152d0(0x110)];});return db[_0x36f905(0xcf)]['findOne']({'where':{'id':_0x657e66[_0x36f905(0xfb)]['id']}})[_0x36f905(0x149)](function(_0x1046da){const _0xf2fd05=_0x36f905;return db[_0xf2fd05(0x151)]['transaction'](function(_0x3efef4){const _0x175c5f=_0xf2fd05;return _0x1046da[_0x175c5f(0x141)](_0x356fda,{'transaction':_0x3efef4})[_0x175c5f(0x149)](function(){const _0x184736=_0x175c5f,_0x225ae6=_0x260360[_0x184736(0x103)](_0x55438b=>{const _0x191a9b=_0x184736;return db[_0x191a9b(0xf2)][_0x191a9b(0x101)]({'where':{'UserId':_0x55438b['id'],'VoiceQueueId':_0x657e66[_0x191a9b(0xfb)]['id']},'defaults':{'penalty':_0x55438b[_0x191a9b(0xde)]},'transaction':_0x3efef4});});return Promise['all'](_0x225ae6);})[_0x175c5f(0x149)](function(){const _0x250fbf=_0x175c5f,_0x78f394=_[_0x250fbf(0xf8)](_0x260360,{'online':!![]}),_0x1a29f4=_0x78f394[_0x250fbf(0x103)](_0x39395b=>{const _0x2b385c=_0x250fbf;return db[_0x2b385c(0x153)]['upsert']({'membername':_0x39395b['name'],'UserId':_0x39395b['id'],'queue_name':_0x1046da['name'],'VoiceQueueId':_0x1046da['id'],'interface':_[_0x2b385c(0x13e)](_0x39395b['interface'])?util[_0x2b385c(0x15e)](_0x2b385c(0x15b),_0x39395b[_0x2b385c(0xe6)]):_0x39395b[_0x2b385c(0x11a)],'paused':_0x39395b[_0x2b385c(0xec)]||![],'penalty':_0x39395b['penalty']},{'transaction':_0x3efef4});});return Promise[_0x250fbf(0x143)](_0x1a29f4);})[_0x175c5f(0x149)](function(){const _0x558c6d=_0x175c5f;_0x260360[_0x558c6d(0x137)](function(_0x11aad9){const _0x56e3c5=_0x558c6d;socket[_0x56e3c5(0xda)](_0x56e3c5(0xf1),{'UserId':_0x11aad9['id'],'VoiceQueueId':_0x1046da['id']});});});});});}})['then'](respondWithStatusCode(_0x5e1b2f,null))[_0x305910(0x104)](handleError(_0x5e1b2f,null));},exports[a903_0x15cc44(0xd8)]=function(_0x3488c3,_0x209a40){const _0x2455f5=a903_0x15cc44;return db['Team'][_0x2455f5(0x125)]({'where':{'id':_0x3488c3[_0x2455f5(0x12c)][_0x2455f5(0x14d)]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2455f5(0x110),'attributes':['id'],'raw':!![]}]})[_0x2455f5(0x149)](handleEntityNotFound(_0x209a40,null))[_0x2455f5(0x149)](function(_0x2152bd){const _0x3f7958=_0x2455f5,_0x517cae=_[_0x3f7958(0x103)](_0x2152bd,'id');let _0x5d4573=[];const _0x1c56db=[],_0x187ec8=squel[_0x3f7958(0x161)]();_0x187ec8[_0x3f7958(0x13d)](_0x3f7958(0xf7))[_0x3f7958(0xdd)](_0x3f7958(0x131),'tq')['join'](_0x3f7958(0x134),'ut',_0x3f7958(0x111))[_0x3f7958(0x112)](_0x3f7958(0x11d),_0x3488c3[_0x3f7958(0xfb)]['id']);for(let _0x3e599f=0x0;_0x3e599f<_0x2152bd['length'];_0x3e599f+=0x1){const _0x429e34=_0x2152bd[_0x3e599f];for(let _0x5c572c=0x0;_0x5c572c<_0x429e34['Agents']['length'];_0x5c572c+=0x1){const _0x31cf60=_0x429e34['Agents'][_0x5c572c],_0x3b3244=_0x187ec8[_0x3f7958(0xd4)]();_0x3b3244['where'](_0x3f7958(0x14a),_0x31cf60['id']),_0x1c56db[_0x3f7958(0x14b)](db[_0x3f7958(0x151)][_0x3f7958(0x12c)](_0x3b3244[_0x3f7958(0xfd)](),{'type':QueryTypes[_0x3f7958(0x12e)]})['then'](function(_0x2c81d6){const _0x54b955=_0x3f7958;if(_0x2c81d6['length']===0x1)return _0x31cf60['id'];else{const _0x27697b=_[_0x54b955(0xe3)](_[_0x54b955(0x103)](_0x2c81d6,'TeamId'),function(_0x356e7d){const _0x4940ce=_0x54b955;return _[_0x4940ce(0xfc)](_0x517cae,_0x356e7d);});if(_0x27697b)return _0x31cf60['id'];}}));}}return Promise['all'](_0x1c56db)['then'](function(_0x378375){const _0x2822be=_0x3f7958;return _0x5d4573=_(_0x5d4573)[_0x2822be(0xdb)](_0x378375)[_0x2822be(0x159)]()['value'](),db[_0x2822be(0xcf)]['findOne']({'where':{'id':_0x3488c3[_0x2822be(0xfb)]['id']}})[_0x2822be(0x149)](function(_0x8901bf){const _0x3d33ef=_0x2822be;return db[_0x3d33ef(0x151)]['transaction'](function(_0x1cf4d3){const _0x770026=_0x3d33ef;return _0x8901bf['removeTeams'](_0x3488c3[_0x770026(0x12c)]['ids'],{'transaction':_0x1cf4d3})[_0x770026(0x149)](function(){const _0x4ef84a=_0x770026;if(!_[_0x4ef84a(0xe8)](_0x5d4573))return _0x8901bf[_0x4ef84a(0xff)](_0x5d4573,{'transaction':_0x1cf4d3})[_0x4ef84a(0x149)](function(){const _0x3d7a1f=_0x4ef84a;return db[_0x3d7a1f(0x153)][_0x3d7a1f(0x108)]({'where':{'VoiceQueueId':_0x3488c3[_0x3d7a1f(0xfb)]['id'],'UserId':_0x5d4573},'transaction':_0x1cf4d3});});})[_0x770026(0x149)](function(){_0x5d4573['forEach'](function(_0x53dfcb){const _0x4d2072=a903_0x5596;socket[_0x4d2072(0xda)](_0x4d2072(0xe7),{'UserId':_0x53dfcb,'VoiceQueueId':_0x8901bf['id']});});});});});});})[_0x2455f5(0x149)](respondWithStatusCode(_0x209a40,null))['catch'](handleError(_0x209a40,null));},exports[a903_0x15cc44(0x12d)]=function(_0x51cd20,_0xb7de5c){const _0x2f8315=a903_0x15cc44;let _0x333d6c,_0x410ebd;return db[_0x2f8315(0xcf)][_0x2f8315(0x10c)]({'where':{'id':_0x51cd20[_0x2f8315(0xfb)]['id']}})[_0x2f8315(0x149)](function(_0x1baf0d){const _0x2d3a9c=_0x2f8315;if(_0x1baf0d)return _0x410ebd=_0x1baf0d,_0x1baf0d['addAgents'](_0x51cd20['body'][_0x2d3a9c(0x14d)],{'through':_[_0x2d3a9c(0x167)](_0x51cd20[_0x2d3a9c(0x10f)],['ids','id'])})['then'](function(_0x2e4574){const _0x40c641=_0x2d3a9c;for(let _0x5c7a68=0x0;_0x5c7a68<_0x51cd20[_0x40c641(0x10f)][_0x40c641(0x14d)]['length'];_0x5c7a68+=0x1){socket[_0x40c641(0xda)](_0x40c641(0xf1),{'UserId':_0x51cd20[_0x40c641(0x10f)][_0x40c641(0x14d)][_0x5c7a68],'VoiceQueueId':_0x51cd20['params']['id']});}return _0x2e4574;});})[_0x2f8315(0x149)](function(_0x23ec93){const _0x1c6181=_0x2f8315;_0x333d6c=_0x23ec93||[];if(_0x410ebd)return db[_0x1c6181(0x107)]['findAll']({'where':{'id':_0x51cd20[_0x1c6181(0x10f)][_0x1c6181(0x14d)]},'attributes':['id',_0x1c6181(0xe6),_0x1c6181(0x15a),_0x1c6181(0xec),_0x1c6181(0x11a)],'raw':!![]});})[_0x2f8315(0x149)](function(_0x35779f){const _0x349460=_0x2f8315;if(!_['isEmpty'](_0x35779f)){const _0xbeaa9d=[];for(let _0x4244bf=0x0;_0x4244bf<_0x35779f[_0x349460(0x10d)];_0x4244bf++){_0x35779f[_0x4244bf][_0x349460(0x15a)]&&_0xbeaa9d[_0x349460(0x14b)](db[_0x349460(0x153)][_0x349460(0x10a)]({'membername':_0x35779f[_0x4244bf][_0x349460(0xe6)],'UserId':_0x35779f[_0x4244bf]['id'],'queue_name':_0x410ebd[_0x349460(0xe6)],'VoiceQueueId':_0x410ebd['id'],'interface':_[_0x349460(0x13e)](_0x35779f[_0x4244bf]['interface'])?util['format'](_0x349460(0x15b),_0x35779f[_0x4244bf][_0x349460(0xe6)]):_0x35779f[_0x4244bf]['interface'],'paused':_0x35779f[_0x4244bf]['voicePause']||![],'penalty':_0x51cd20['body']['penalty']||0x0}));}return Promise[_0x349460(0x143)](_0xbeaa9d);}})['then'](function(){return _0x333d6c;})[_0x2f8315(0x149)](respondWithResult(_0xb7de5c,null))[_0x2f8315(0x104)](handleError(_0xb7de5c,null));},exports[a903_0x15cc44(0xff)]=function(_0x1edaf6,_0x445ec8){const _0x366c7e=a903_0x15cc44;return db['VoiceQueue']['findOne']({'where':{'id':_0x1edaf6[_0x366c7e(0xfb)]['id']}})['then'](handleEntityNotFound(_0x445ec8,null))[_0x366c7e(0x149)](function(_0x51892f){const _0x3591b6=_0x366c7e;if(_0x51892f)return _0x51892f[_0x3591b6(0xff)](_0x1edaf6[_0x3591b6(0x12c)]['ids'])[_0x3591b6(0x149)](function(){const _0x35d3b3=_0x3591b6;if(_[_0x35d3b3(0x118)](_0x1edaf6['query'][_0x35d3b3(0x14d)]))for(let _0x38513c=0x0;_0x38513c<_0x1edaf6[_0x35d3b3(0x12c)][_0x35d3b3(0x14d)][_0x35d3b3(0x10d)];_0x38513c+=0x1){socket[_0x35d3b3(0xda)]('userVoiceQueue:remove',{'UserId':Number(_0x1edaf6['query']['ids'][_0x38513c]),'VoiceQueueId':Number(_0x1edaf6['params']['id'])});}else socket[_0x35d3b3(0xda)](_0x35d3b3(0xe7),{'UserId':Number(_0x1edaf6[_0x35d3b3(0x12c)][_0x35d3b3(0x14d)]),'VoiceQueueId':Number(_0x1edaf6[_0x35d3b3(0xfb)]['id'])});});})['then'](function(_0x2d37b7){const _0x107b49=_0x366c7e;return db[_0x107b49(0x153)][_0x107b49(0x108)]({'where':{'VoiceQueueId':_0x1edaf6[_0x107b49(0xfb)]['id'],'UserId':_0x1edaf6[_0x107b49(0x12c)][_0x107b49(0x14d)]}})[_0x107b49(0x149)](function(){return _0x2d37b7;});})[_0x366c7e(0x149)](respondWithStatusCode(_0x445ec8,null))['catch'](handleError(_0x445ec8,null));},exports[a903_0x15cc44(0x126)]=function(_0x4a9cbf,_0x3c2436){const _0x5e1f2a=a903_0x15cc44;let _0x3246ea={};const _0x3007bd={};let _0x508499,_0xa04609;return db[_0x5e1f2a(0xcf)]['findOne']({'where':{'id':_0x4a9cbf[_0x5e1f2a(0xfb)]['id']}})[_0x5e1f2a(0x149)](handleEntityNotFound(_0x3c2436,null))['then'](function(_0x18c5e0){const _0x440b2d=_0x5e1f2a;if(_0x18c5e0)return _0x508499=_0x18c5e0,_0x3007bd[_0x440b2d(0x123)]=_[_0x440b2d(0xd7)](db[_0x440b2d(0x107)]['rawAttributes']),_0x3007bd[_0x440b2d(0x12c)]=_['keys'](_0x4a9cbf[_0x440b2d(0x12c)]),_0x3007bd['filters']=_['intersection'](_0x3007bd[_0x440b2d(0x123)],_0x3007bd[_0x440b2d(0x12c)]),_0x3246ea[_0x440b2d(0xd6)]=_['intersection'](_0x3007bd[_0x440b2d(0x123)],qs[_0x440b2d(0xce)](_0x4a9cbf['query'][_0x440b2d(0xce)])),_0x3246ea[_0x440b2d(0xd6)]=_0x3246ea['attributes'][_0x440b2d(0x10d)]?_0x3246ea[_0x440b2d(0xd6)]:_0x3007bd['model'],_0x3246ea[_0x440b2d(0xcb)]=qs['sort'](_0x4a9cbf['query'][_0x440b2d(0xeb)]),_0x3246ea[_0x440b2d(0x112)]=qs[_0x440b2d(0x166)](_[_0x440b2d(0x140)](_0x4a9cbf['query'],_0x3007bd[_0x440b2d(0x166)])),_0x4a9cbf[_0x440b2d(0x12c)][_0x440b2d(0xf8)]&&(_0x3246ea[_0x440b2d(0x112)]=_[_0x440b2d(0xdc)](_0x3246ea[_0x440b2d(0x112)],{[Op['or']]:_['map'](_0x3246ea[_0x440b2d(0xd6)],function(_0x1178da){const _0x22ca48=_0x440b2d,_0x5b34d6={};return _0x5b34d6[_0x1178da]={[Op['like']]:'%'+_0x4a9cbf[_0x22ca48(0x12c)][_0x22ca48(0xf8)]+'%'},_0x5b34d6;})})),_0x3246ea=_[_0x440b2d(0xdc)]({},_0x3246ea,_0x4a9cbf[_0x440b2d(0x11c)]),_0x508499[_0x440b2d(0x126)](_0x3246ea);})[_0x5e1f2a(0x149)](function(_0x3dcb19){const _0x29ca2c=_0x5e1f2a;if(_0x3dcb19)return _0xa04609=_0x3dcb19[_0x29ca2c(0x10d)],typeof _0x4a9cbf[_0x29ca2c(0x12c)][_0x29ca2c(0xea)]===_0x29ca2c(0x14f)&&(_0x3246ea[_0x29ca2c(0x129)]=qs['limit'](_0x4a9cbf[_0x29ca2c(0x12c)][_0x29ca2c(0x129)]),_0x3246ea[_0x29ca2c(0x152)]=qs['offset'](_0x4a9cbf[_0x29ca2c(0x12c)][_0x29ca2c(0x152)])),_0x508499[_0x29ca2c(0x126)](_0x3246ea);})['then'](function(_0x108851){if(_0x108851)return _0x108851?{'count':_0xa04609,'rows':_0x108851}:null;})[_0x5e1f2a(0x149)](respondWithResult(_0x3c2436,null))['catch'](handleError(_0x3c2436,null));},exports[a903_0x15cc44(0x10b)]=function(_0x2fc42,_0x408c21){const _0x15be6f=a903_0x15cc44;let _0x35e42d={};const _0x42de4e={};let _0x336267,_0x22273c;return db[_0x15be6f(0xcf)]['findOne']({'where':{'id':_0x2fc42[_0x15be6f(0xfb)]['id']}})[_0x15be6f(0x149)](handleEntityNotFound(_0x408c21,null))[_0x15be6f(0x149)](function(_0xda37f8){const _0x512e86=_0x15be6f;if(_0xda37f8)return _0x336267=_0xda37f8,_0x42de4e[_0x512e86(0x123)]=_[_0x512e86(0xd7)](db[_0x512e86(0x153)][_0x512e86(0x12f)]),_0x42de4e[_0x512e86(0x12c)]=_[_0x512e86(0xd7)](_0x2fc42[_0x512e86(0x12c)]),_0x42de4e[_0x512e86(0x166)]=_[_0x512e86(0x160)](_0x42de4e['model'],_0x42de4e['query']),_0x35e42d[_0x512e86(0xd6)]=_[_0x512e86(0x160)](_0x42de4e[_0x512e86(0x123)],qs[_0x512e86(0xce)](_0x2fc42[_0x512e86(0x12c)][_0x512e86(0xce)])),_0x35e42d[_0x512e86(0xd6)]=_0x35e42d[_0x512e86(0xd6)]['length']?_0x35e42d[_0x512e86(0xd6)]:_0x42de4e[_0x512e86(0x123)],_0x35e42d[_0x512e86(0xcb)]=qs[_0x512e86(0xeb)](_0x2fc42[_0x512e86(0x12c)][_0x512e86(0xeb)]),_0x35e42d[_0x512e86(0x112)]=qs['filters'](_[_0x512e86(0x140)](_0x2fc42[_0x512e86(0x12c)],_0x42de4e[_0x512e86(0x166)])),_0x2fc42['query'][_0x512e86(0xf8)]&&(_0x35e42d[_0x512e86(0x112)]=_[_0x512e86(0xdc)](_0x35e42d[_0x512e86(0x112)],{[Op['or']]:_[_0x512e86(0x103)](_0x35e42d[_0x512e86(0xd6)],function(_0x44647c){const _0x7725fb=_0x512e86,_0x3ff6d6={};return _0x3ff6d6[_0x44647c]={[Op[_0x7725fb(0xd3)]]:'%'+_0x2fc42[_0x7725fb(0x12c)][_0x7725fb(0xf8)]+'%'},_0x3ff6d6;})})),_0x35e42d=_[_0x512e86(0xdc)]({},_0x35e42d,_0x2fc42[_0x512e86(0x11c)]),_0x336267[_0x512e86(0x10b)](_0x35e42d);})[_0x15be6f(0x149)](function(_0x249188){const _0xeb49e7=_0x15be6f;if(_0x249188)return _0x22273c=_0x249188['length'],typeof _0x2fc42[_0xeb49e7(0x12c)][_0xeb49e7(0xea)]===_0xeb49e7(0x14f)&&(_0x35e42d[_0xeb49e7(0x129)]=qs['limit'](_0x2fc42[_0xeb49e7(0x12c)][_0xeb49e7(0x129)]),_0x35e42d[_0xeb49e7(0x152)]=qs['offset'](_0x2fc42[_0xeb49e7(0x12c)][_0xeb49e7(0x152)])),_0x336267[_0xeb49e7(0x10b)](_0x35e42d);})['then'](function(_0x3bbc44){return _0x3bbc44?{'count':_0x22273c,'rows':_0x3bbc44}:null;})[_0x15be6f(0x149)](respondWithResult(_0x408c21,null))['catch'](handleError(_0x408c21,null));},exports[a903_0x15cc44(0x106)]=function(_0x33fe93,_0x28e3f3){const _0x3b3650=a903_0x15cc44;let _0xbf79b9={};const _0x296274={};let _0x30fb49,_0x23be3e;return db[_0x3b3650(0xcf)]['findOne']({'where':{'id':_0x33fe93[_0x3b3650(0xfb)]['id']}})['then'](handleEntityNotFound(_0x28e3f3,null))[_0x3b3650(0x149)](function(_0x276eb7){const _0x4e8c5a=_0x3b3650;if(_0x276eb7)return _0x30fb49=_0x276eb7,_0x296274[_0x4e8c5a(0x123)]=_['keys'](db['CmList'][_0x4e8c5a(0x12f)]),_0x296274[_0x4e8c5a(0x12c)]=_[_0x4e8c5a(0xd7)](_0x33fe93[_0x4e8c5a(0x12c)]),_0x296274[_0x4e8c5a(0x166)]=_[_0x4e8c5a(0x160)](_0x296274['model'],_0x296274[_0x4e8c5a(0x12c)]),_0xbf79b9[_0x4e8c5a(0xd6)]=_['intersection'](_0x296274[_0x4e8c5a(0x123)],qs[_0x4e8c5a(0xce)](_0x33fe93[_0x4e8c5a(0x12c)]['fields'])),_0xbf79b9[_0x4e8c5a(0xd6)]=_0xbf79b9[_0x4e8c5a(0xd6)][_0x4e8c5a(0x10d)]?_0xbf79b9[_0x4e8c5a(0xd6)]:_0x296274['model'],_0xbf79b9[_0x4e8c5a(0xcb)]=qs[_0x4e8c5a(0xeb)](_0x33fe93[_0x4e8c5a(0x12c)]['sort']),_0xbf79b9[_0x4e8c5a(0x112)]=qs[_0x4e8c5a(0x166)](_[_0x4e8c5a(0x140)](_0x33fe93['query'],_0x296274[_0x4e8c5a(0x166)])),_0x33fe93['query'][_0x4e8c5a(0xf8)]&&(_0xbf79b9[_0x4e8c5a(0x112)]=_[_0x4e8c5a(0xdc)](_0xbf79b9[_0x4e8c5a(0x112)],{[Op['or']]:_[_0x4e8c5a(0x103)](_0xbf79b9[_0x4e8c5a(0xd6)],function(_0x1789bd){const _0x4471c6=_0x4e8c5a,_0x1f0e55={};return _0x1f0e55[_0x1789bd]={[Op[_0x4471c6(0xd3)]]:'%'+_0x33fe93[_0x4471c6(0x12c)]['filter']+'%'},_0x1f0e55;})})),_0xbf79b9=_[_0x4e8c5a(0xdc)]({},_0xbf79b9,_0x33fe93['options']),_0x30fb49[_0x4e8c5a(0x106)](_0xbf79b9);})[_0x3b3650(0x149)](function(_0x46e5eb){const _0x417938=_0x3b3650;if(_0x46e5eb)return _0x23be3e=_0x46e5eb['length'],typeof _0x33fe93[_0x417938(0x12c)]['nolimit']===_0x417938(0x14f)&&(_0xbf79b9[_0x417938(0x129)]=qs[_0x417938(0x129)](_0x33fe93[_0x417938(0x12c)]['limit']),_0xbf79b9[_0x417938(0x152)]=qs[_0x417938(0x152)](_0x33fe93[_0x417938(0x12c)][_0x417938(0x152)])),_0x30fb49[_0x417938(0x106)](_0xbf79b9);})['then'](function(_0x3504c8){if(_0x3504c8)return _0x3504c8?{'count':_0x23be3e,'rows':_0x3504c8}:null;})[_0x3b3650(0x149)](respondWithResult(_0x28e3f3,null))[_0x3b3650(0x104)](handleError(_0x28e3f3,null));},exports[a903_0x15cc44(0x162)]=function(_0x3112a9,_0x1cad75){const _0x4161d9=a903_0x15cc44;let _0x65fe5d,_0x560f87;return db['VoiceQueue'][_0x4161d9(0x10c)]({'where':{'id':_0x3112a9[_0x4161d9(0xfb)]['id']}})[_0x4161d9(0x149)](handleEntityNotFound(_0x1cad75,null))[_0x4161d9(0x149)](function(_0x5ca7dd){const _0x2652c4=_0x4161d9;if(_0x5ca7dd)return _0x560f87=_0x5ca7dd,_0x5ca7dd[_0x2652c4(0x162)](_0x3112a9['body']['ids'],{'through':_[_0x2652c4(0x167)](_0x3112a9[_0x2652c4(0x10f)],[_0x2652c4(0x14d),'id'])});return null;})[_0x4161d9(0x149)](function(_0x486edb){const _0x470ebf=_0x4161d9;let _0x505eac;_0x65fe5d=_0x486edb||[];const _0x51a4fe=[];if(_0x486edb){for(let _0x587dec=0x0;_0x587dec<_0x486edb['length'];_0x587dec+=0x1){const _0xf4fd0f=_0x486edb[_0x587dec]['get']({'plain':!![]});_0x560f87['dialCheckDuplicateType']=_0x3112a9[_0x470ebf(0x10f)]['dialCheckDuplicateType']?_0x3112a9['body']['dialCheckDuplicateType']:_0x560f87[_0x470ebf(0x116)];switch(_0x560f87[_0x470ebf(0x116)]){case _0x470ebf(0xe1):_0x505eac=squel['insert']()[_0x470ebf(0x11b)]('cm_hopper')[_0x470ebf(0x120)]([_0x470ebf(0xd1),_0x470ebf(0x165),_0x470ebf(0x121),_0x470ebf(0x124),'VoiceQueueId','createdAt',_0x470ebf(0x158)],squel['select']()['field'](_0x470ebf(0xd1),'phone')['field'](_0x470ebf(0xdf),_0x470ebf(0x165))['field']('id',_0x470ebf(0x121))['field'](_0xf4fd0f['CmListId'][_0x470ebf(0xfd)](),_0x470ebf(0x124))[_0x470ebf(0x13d)](_0x3112a9[_0x470ebf(0xfb)]['id'][_0x470ebf(0xfd)](),'VoiceQueueId')[_0x470ebf(0x13d)](_0x470ebf(0xdf),'createdAt')[_0x470ebf(0x13d)](_0x470ebf(0xdf),_0x470ebf(0x158))[_0x470ebf(0xdd)](_0x470ebf(0x119))['where'](_0x470ebf(0xed))[_0x470ebf(0x112)](_0x470ebf(0x113),_0xf4fd0f[_0x470ebf(0xf4)][_0x470ebf(0xfd)]())[_0x470ebf(0x112)](_0x470ebf(0x14e))['where'](_0x470ebf(0x15d),squel[_0x470ebf(0x161)]()['field'](_0x470ebf(0xf6))[_0x470ebf(0xdd)](_0x470ebf(0xf9))[_0x470ebf(0x112)](_0x470ebf(0x11d),_0x3112a9[_0x470ebf(0xfb)]['id'][_0x470ebf(0xfd)]()))['where'](_0x470ebf(0x15d),squel[_0x470ebf(0x161)]()[_0x470ebf(0x13d)](_0x470ebf(0x155))[_0x470ebf(0xdd)](_0x470ebf(0xd0))[_0x470ebf(0x112)]('VoiceQueueId\x20=\x20?',_0x3112a9[_0x470ebf(0xfb)]['id'][_0x470ebf(0xfd)]())))['toString']();break;case'onlyIfOpen':_0x505eac=squel['insert']()[_0x470ebf(0x11b)]('cm_hopper')[_0x470ebf(0x120)]([_0x470ebf(0xd1),_0x470ebf(0x165),_0x470ebf(0x121),_0x470ebf(0x124),_0x470ebf(0x13a),_0x470ebf(0xf0),'updatedAt'],squel[_0x470ebf(0x161)]()[_0x470ebf(0x13d)]('phone',_0x470ebf(0xd1))[_0x470ebf(0x13d)](_0x470ebf(0xdf),_0x470ebf(0x165))[_0x470ebf(0x13d)]('id',_0x470ebf(0x121))[_0x470ebf(0x13d)](_0xf4fd0f[_0x470ebf(0xf4)][_0x470ebf(0xfd)](),_0x470ebf(0x124))['field'](_0x3112a9[_0x470ebf(0xfb)]['id'][_0x470ebf(0xfd)](),'VoiceQueueId')['field'](_0x470ebf(0xdf),_0x470ebf(0xf0))['field'](_0x470ebf(0xdf),_0x470ebf(0x158))['from'](_0x470ebf(0x119))[_0x470ebf(0x112)](_0x470ebf(0xed))[_0x470ebf(0x112)](_0x470ebf(0x113),_0xf4fd0f[_0x470ebf(0xf4)]['toString']())['where'](_0x470ebf(0x14e))['where'](_0x470ebf(0x15d),squel[_0x470ebf(0x161)]()[_0x470ebf(0x13d)](_0x470ebf(0x155))[_0x470ebf(0xdd)]('cm_hopper')['where'](_0x470ebf(0x11d),_0x3112a9['params']['id'][_0x470ebf(0xfd)]())))[_0x470ebf(0xfd)]();break;default:_0x505eac=squel[_0x470ebf(0x117)]()['into'](_0x470ebf(0xd0))['fromQuery']([_0x470ebf(0xd1),_0x470ebf(0x165),_0x470ebf(0x121),_0x470ebf(0x124),_0x470ebf(0x13a),_0x470ebf(0xf0),_0x470ebf(0x158)],squel['select']()[_0x470ebf(0x13d)](_0x470ebf(0xd1),_0x470ebf(0xd1))[_0x470ebf(0x13d)](_0x470ebf(0xdf),_0x470ebf(0x165))[_0x470ebf(0x13d)]('id','ContactId')['field'](_0xf4fd0f[_0x470ebf(0xf4)][_0x470ebf(0xfd)](),_0x470ebf(0x124))[_0x470ebf(0x13d)](_0x3112a9[_0x470ebf(0xfb)]['id'][_0x470ebf(0xfd)](),_0x470ebf(0x13a))[_0x470ebf(0x13d)]('NOW()',_0x470ebf(0xf0))['field'](_0x470ebf(0xdf),'updatedAt')[_0x470ebf(0xdd)](_0x470ebf(0x119))['where'](_0x470ebf(0xed))['where'](_0x470ebf(0x113),_0xf4fd0f[_0x470ebf(0xf4)][_0x470ebf(0xfd)]())[_0x470ebf(0x112)](_0x470ebf(0x14e)))[_0x470ebf(0xfd)]();}_0x51a4fe[_0x470ebf(0x14b)](db[_0x470ebf(0x151)]['query'](_0x505eac));}return Promise['all'](_0x51a4fe);}})[_0x4161d9(0x149)](function(){return _0x65fe5d;})[_0x4161d9(0x149)](respondWithResult(_0x1cad75,null))['catch'](handleError(_0x1cad75,null));},exports[a903_0x15cc44(0x133)]=function(_0x39c2c3,_0x397555){const _0x77adc3=a903_0x15cc44;return db[_0x77adc3(0xcf)][_0x77adc3(0x10c)]({'where':{'id':_0x39c2c3[_0x77adc3(0xfb)]['id']}})[_0x77adc3(0x149)](handleEntityNotFound(_0x397555,null))[_0x77adc3(0x149)](function(_0x3732b0){const _0x40c09a=_0x77adc3;if(_0x3732b0)return _0x3732b0['removeLists'](_0x39c2c3[_0x40c09a(0x12c)][_0x40c09a(0x14d)]);})[_0x77adc3(0x149)](function(_0x592b1e){const _0x213085=_0x77adc3;if(_0x592b1e)return db[_0x213085(0x150)][_0x213085(0x108)]({'where':{'ListId':_0x39c2c3[_0x213085(0x12c)][_0x213085(0x14d)],'VoiceQueueId':_0x39c2c3['params']['id']}})[_0x213085(0x149)](function(){return _0x592b1e;});})[_0x77adc3(0x149)](respondWithStatusCode(_0x397555,null))[_0x77adc3(0x104)](handleError(_0x397555,null));},exports[a903_0x15cc44(0x135)]=function(_0x1de7b1,_0x168771){const _0x49800b=a903_0x15cc44;let _0x3af64c={};const _0x2213a5={};let _0x32b402,_0x458093;return db[_0x49800b(0xcf)][_0x49800b(0x10c)]({'where':{'id':_0x1de7b1[_0x49800b(0xfb)]['id']}})[_0x49800b(0x149)](handleEntityNotFound(_0x168771,null))[_0x49800b(0x149)](function(_0x151517){const _0x470d95=_0x49800b;if(_0x151517)return _0x32b402=_0x151517,_0x2213a5[_0x470d95(0x123)]=_[_0x470d95(0xd7)](db[_0x470d95(0x154)]['rawAttributes']),_0x2213a5[_0x470d95(0x12c)]=_[_0x470d95(0xd7)](_0x1de7b1['query']),_0x2213a5[_0x470d95(0x166)]=_['intersection'](_0x2213a5['model'],_0x2213a5[_0x470d95(0x12c)]),_0x3af64c[_0x470d95(0xd6)]=_[_0x470d95(0x160)](_0x2213a5[_0x470d95(0x123)],qs[_0x470d95(0xce)](_0x1de7b1[_0x470d95(0x12c)][_0x470d95(0xce)])),_0x3af64c[_0x470d95(0xd6)]=_0x3af64c['attributes']['length']?_0x3af64c[_0x470d95(0xd6)]:_0x2213a5['model'],_0x3af64c['order']=qs['sort'](_0x1de7b1[_0x470d95(0x12c)][_0x470d95(0xeb)]),_0x3af64c[_0x470d95(0x112)]=qs['filters'](_[_0x470d95(0x140)](_0x1de7b1[_0x470d95(0x12c)],_0x2213a5['filters'])),_0x1de7b1[_0x470d95(0x12c)][_0x470d95(0xf8)]&&(_0x3af64c['where']=_[_0x470d95(0xdc)](_0x3af64c[_0x470d95(0x112)],{[Op['or']]:_[_0x470d95(0x103)](_0x3af64c[_0x470d95(0xd6)],function(_0xd74390){const _0x41ff07=_0x470d95,_0x32455c={};return _0x32455c[_0xd74390]={[Op[_0x41ff07(0xd3)]]:'%'+_0x1de7b1['query'][_0x41ff07(0xf8)]+'%'},_0x32455c;})})),_0x3af64c=_[_0x470d95(0xdc)]({},_0x3af64c,_0x1de7b1[_0x470d95(0x11c)]),_0x32b402[_0x470d95(0x135)](_0x3af64c);})[_0x49800b(0x149)](function(_0x38344d){const _0x540447=_0x49800b;if(_0x38344d)return _0x458093=_0x38344d[_0x540447(0x10d)],typeof _0x1de7b1[_0x540447(0x12c)]['nolimit']===_0x540447(0x14f)&&(_0x3af64c[_0x540447(0x129)]=qs['limit'](_0x1de7b1[_0x540447(0x12c)][_0x540447(0x129)]),_0x3af64c[_0x540447(0x152)]=qs[_0x540447(0x152)](_0x1de7b1[_0x540447(0x12c)]['offset'])),_0x32b402['getBlackLists'](_0x3af64c);})[_0x49800b(0x149)](function(_0x12075f){if(_0x12075f)return _0x12075f?{'count':_0x458093,'rows':_0x12075f}:null;})[_0x49800b(0x149)](respondWithResult(_0x168771,null))['catch'](handleError(_0x168771,null));},exports[a903_0x15cc44(0x136)]=function(_0x1431d6,_0xe33bf4){const _0x1a5bea=a903_0x15cc44;let _0x7401f8;return db[_0x1a5bea(0xcf)][_0x1a5bea(0x10c)]({'where':{'id':_0x1431d6[_0x1a5bea(0xfb)]['id']}})['then'](handleEntityNotFound(_0xe33bf4,null))[_0x1a5bea(0x149)](function(_0x295b31){const _0x3fe71=_0x1a5bea;if(_0x295b31)return _0x295b31[_0x3fe71(0x136)](_0x1431d6[_0x3fe71(0x10f)][_0x3fe71(0x14d)],{'through':_[_0x3fe71(0x167)](_0x1431d6[_0x3fe71(0x10f)],['ids','id'])});return null;})[_0x1a5bea(0x149)](function(_0x476ac0){const _0x1809e8=_0x1a5bea;let _0x3d7aea;_0x7401f8=_0x476ac0||[];const _0x24484f=[];if(_0x476ac0){for(let _0x5ca7a2=0x0;_0x5ca7a2<_0x476ac0[_0x1809e8(0x10d)];_0x5ca7a2+=0x1){const _0x2eb3b6=_0x476ac0[_0x5ca7a2][_0x1809e8(0x142)]({'plain':!![]});_0x3d7aea=squel[_0x1809e8(0x117)]()[_0x1809e8(0x11b)](_0x1809e8(0x144))['fromQuery']([_0x1809e8(0xd1),'ContactId',_0x1809e8(0x124),_0x1809e8(0x13a),'createdAt',_0x1809e8(0x158)],squel[_0x1809e8(0x161)]()[_0x1809e8(0x13d)](_0x1809e8(0xd1),_0x1809e8(0xd1))[_0x1809e8(0x13d)]('id',_0x1809e8(0x121))[_0x1809e8(0x13d)](_0x2eb3b6[_0x1809e8(0xf4)][_0x1809e8(0xfd)](),_0x1809e8(0x124))['field'](_0x1431d6[_0x1809e8(0xfb)]['id']['toString'](),_0x1809e8(0x13a))[_0x1809e8(0x13d)](_0x1809e8(0xdf),_0x1809e8(0xf0))['field'](_0x1809e8(0xdf),_0x1809e8(0x158))[_0x1809e8(0xdd)]('cm_contacts')[_0x1809e8(0x112)]('deletedAt\x20IS\x20NULL')['where'](_0x1809e8(0x113),_0x2eb3b6[_0x1809e8(0xf4)][_0x1809e8(0xfd)]())[_0x1809e8(0x112)](_0x1809e8(0x14e)))['toString'](),_0x24484f['push'](db['sequelize'][_0x1809e8(0x12c)](_0x3d7aea));}return Promise['all'](_0x24484f);}})['then'](function(){return _0x7401f8;})[_0x1a5bea(0x149)](respondWithResult(_0xe33bf4,null))['catch'](handleError(_0xe33bf4,null));},exports[a903_0x15cc44(0xcc)]=function(_0x54f4ba,_0xe7432b){const _0x1437c2=a903_0x15cc44;return db[_0x1437c2(0xcf)][_0x1437c2(0x10c)]({'where':{'id':_0x54f4ba[_0x1437c2(0xfb)]['id']}})[_0x1437c2(0x149)](handleEntityNotFound(_0xe7432b,null))[_0x1437c2(0x149)](function(_0x1c74ae){const _0x16a035=_0x1437c2;if(_0x1c74ae)return _0x1c74ae[_0x16a035(0xcc)](_0x54f4ba[_0x16a035(0x12c)]['ids']);})[_0x1437c2(0x149)](function(_0x599cf0){const _0x131f8c=_0x1437c2;if(_0x599cf0)return db[_0x131f8c(0xef)][_0x131f8c(0x108)]({'where':{'ListId':_0x54f4ba[_0x131f8c(0x12c)][_0x131f8c(0x14d)],'VoiceQueueId':_0x54f4ba[_0x131f8c(0xfb)]['id']}})[_0x131f8c(0x149)](function(){return _0x599cf0;});})[_0x1437c2(0x149)](respondWithStatusCode(_0xe7432b,null))[_0x1437c2(0x104)](handleError(_0xe7432b,null));};
\ No newline at end of file
+const a903_0x4523=['then','COALESCE(phone,\x27\x27)','destroy','QueueCampaigns','length','ListId\x20=\x20?','order','CmHopper','where','sendStatus','interface','options','getHopperFinals','createdAt','body','filters','CmHopperBlack','VoiceQueueId','register','emit','COALESCE(calleridnum,\x27\x27)','insert','flatMap','ContactId','update','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','select','fromQuery','VoiceQueueId\x20=\x20?','map','create','forEach','CmList','getAgents','findOne','query','VoiceQueues','every','merge','push','updatedAt','getLists','catch','format','Team','Unable\x20to\x20retrieve\x20the\x20current\x20user','rows','../../config/logger','phone\x20IS\x20NOT\x20NULL','from','fieldName','sequelize','removeAgents','teams','userProfileId','voicePause','getHoppers','getBlackLists','like','UserVoiceQueueRt','intersection','params','find','./voiceQueue.socket','error','includes','../../rediscache','userVoiceQueue:remove','json','CmListId','send','Agents','user','stack','autoAssociation','isEmpty','end','removeBlackLists','CmHopperFinal','isArray','model','ignore','../../components/parsers/qs','addBlackLists','sort','role','attributes','field','keys','VoiceQueue','SELECT','getHopperBlacks','toString','all','limit','getHopperHistories','removeLists','cm_hopper','into','show','set','includeAll','cm_contacts','VIRTUAL','removeTeams','outbound','rawAttributes','status','include','nolimit','phone','get','SIP/%s','UserProfileResource','getMembers','addLists','online','findAll','compact','ListId','count','omit','isNil','findOrCreate','api','transaction','penalty','dialCheckDuplicateType','user_has_teams','offset','name','util','pick','scheduledAt','phone\x20NOT\x20IN\x20(?)','getTeams','UserProfileSection','team_has_voice_queues','inbound','../../mysqldb','addAgents','value','index','NOW()','Content-Range','upsert','deletedAt\x20IS\x20NULL','CmHopperHistory','clone','type','ids','join','ut.UserId\x20=\x20?','undefined','TeamId','filter','lodash','fields','User','addTeams'];(function(_0x26263f,_0x487fef){const _0x452320=function(_0x2d8265){while(--_0x2d8265){_0x26263f['push'](_0x26263f['shift']());}};_0x452320(++_0x487fef);}(a903_0x4523,0x8c));const a903_0x2d82=function(_0x26263f,_0x487fef){_0x26263f=_0x26263f-0xa5;let _0x452320=a903_0x4523[_0x26263f];return _0x452320;};const a903_0x1a0075=a903_0x2d82;'use strict';const util=require(a903_0x1a0075(0x13c)),_=require(a903_0x1a0075(0xb5)),squel=require('squel'),qs=require(a903_0x1a0075(0x10b)),logger=require(a903_0x1a0075(0xe8))(a903_0x1a0075(0x135)),{getSocket}=require(a903_0x1a0075(0xfb)),socket=getSocket(),{db}=require(a903_0x1a0075(0x144)),{Op,QueryTypes}=require(a903_0x1a0075(0xec));require(a903_0x1a0075(0xf8))[a903_0x1a0075(0xcb)](socket);function respondWithStatusCode(_0x5066be,_0x3c0a4a){return _0x3c0a4a=_0x3c0a4a||0xcc,function(_0x3a55a9){const _0x400ad3=a903_0x2d82;if(_0x3a55a9)return _0x5066be[_0x400ad3(0xc2)](_0x3c0a4a);return _0x5066be['status'](_0x3c0a4a)['end']();};}function respondWithResult(_0x38c0a7,_0x531e52){return _0x531e52=_0x531e52||0xc8,function(_0x335484){const _0x5e039f=a903_0x2d82;if(_0x335484)return _0x38c0a7[_0x5e039f(0x124)](_0x531e52)['json'](_0x335484);};}function respondWithFilteredResult(_0x485bb5,_0x397990){return function(_0x5f0b49){const _0x14da95=a903_0x2d82;if(_0x5f0b49){const _0x57cbe3=_0x5f0b49[_0x14da95(0x131)],_0x254278=_0x397990[_0x14da95(0x13a)];let _0x1af81d=_0x397990['offset']+_0x397990[_0x14da95(0x117)],_0x52b2f0;return _0x1af81d>=_0x57cbe3?(_0x1af81d=_0x57cbe3,_0x52b2f0=0xc8):_0x52b2f0=0xce,_0x485bb5[_0x14da95(0x124)](_0x52b2f0),_0x485bb5[_0x14da95(0x11d)](_0x14da95(0xa9),_0x254278+'-'+_0x1af81d+'/'+_0x57cbe3)[_0x14da95(0xfd)](_0x5f0b49);}return null;};}function saveUpdates(_0x2f6f08){return function(_0x21d830){const _0x15a514=a903_0x2d82;if(_0x21d830)return _0x21d830[_0x15a514(0xd1)](_0x2f6f08)['then'](function(_0x2b05d7){return _0x2b05d7;});return null;};}function removeEntity(_0x1dd96c){return function(_0x312a9f){const _0x1dfc06=a903_0x2d82;if(_0x312a9f)return _0x312a9f[_0x1dfc06(0xbb)]()['then'](function(){const _0x3bca10=_0x1dfc06,_0x548234=_0x312a9f['get']({'plain':!![]}),_0x3aabb3=[{'name':_0x3bca10(0xdd),'value':_0x3bca10(0x143),'ignore':![]},{'name':_0x3bca10(0xbc),'value':'outbound','ignore':![]}],_0xf889f8=_(_0x3aabb3)['filter'](_0x3bca10(0x10a))[_0x3bca10(0xd6)](_0x3bca10(0xa6))[_0x3bca10(0xa6)]();if(_['includes'](_0xf889f8,_0x548234['type']))return;const _0x16d7aa=_[_0x3bca10(0xf7)](_0x3aabb3,['value',_0x548234[_0x3bca10(0xae)]])[_0x3bca10(0x13b)];return db[_0x3bca10(0x12a)][_0x3bca10(0xbb)]({'where':{'type':_0x16d7aa,'resourceId':_0x548234['id']}})[_0x3bca10(0xb9)](function(){return _0x312a9f;});})[_0x1dfc06(0xb9)](function(){const _0x5e8afd=_0x1dfc06;_0x1dd96c[_0x5e8afd(0x124)](0xcc)[_0x5e8afd(0x105)]();});};}function handleEntityNotFound(_0x2af712){return function(_0x4e5546){const _0x9ca1c0=a903_0x2d82;return!_0x4e5546&&_0x2af712[_0x9ca1c0(0xc2)](0x194),_0x4e5546;};}function handleError(_0x590712,_0x2614e7){return _0x2614e7=_0x2614e7||0x1f4,function(_0x31e860){const _0x3d817f=a903_0x2d82;logger['error'](_0x31e860[_0x3d817f(0x102)]),_0x31e860[_0x3d817f(0x13b)]&&delete _0x31e860[_0x3d817f(0x13b)],_0x590712[_0x3d817f(0x124)](_0x2614e7)[_0x3d817f(0xff)](_0x31e860);};}exports[a903_0x1a0075(0xa7)]=function(_0x49a61e,_0x1718ec){const _0x60148f=a903_0x1a0075;let _0xb2c29b={};const _0x2baf8f={},_0x4d3544={'count':0x0,'rows':[]},_0x53bf97=_[_0x60148f(0xd6)](db[_0x60148f(0x112)][_0x60148f(0x123)],function(_0x169a34){const _0x4c2cef=_0x60148f;return{'name':_0x169a34[_0x4c2cef(0xeb)],'type':_0x169a34[_0x4c2cef(0xae)]['key']};});_0x2baf8f[_0x60148f(0x109)]=_[_0x60148f(0xd6)](_0x53bf97,_0x60148f(0x13b)),_0x2baf8f['query']=_[_0x60148f(0x111)](_0x49a61e[_0x60148f(0xdc)]),_0x2baf8f[_0x60148f(0xc8)]=_[_0x60148f(0xf5)](_0x2baf8f['model'],_0x2baf8f['query']),_0xb2c29b['attributes']=_[_0x60148f(0xf5)](_0x2baf8f[_0x60148f(0x109)],qs[_0x60148f(0xb6)](_0x49a61e['query'][_0x60148f(0xb6)])),_0xb2c29b[_0x60148f(0x10f)]=_0xb2c29b[_0x60148f(0x10f)][_0x60148f(0xbd)]?_0xb2c29b[_0x60148f(0x10f)]:_0x2baf8f['model'];typeof _0x49a61e['query'][_0x60148f(0x126)]===_0x60148f(0xb2)&&(_0xb2c29b[_0x60148f(0x117)]=qs[_0x60148f(0x117)](_0x49a61e[_0x60148f(0xdc)][_0x60148f(0x117)]),_0xb2c29b[_0x60148f(0x13a)]=qs[_0x60148f(0x13a)](_0x49a61e[_0x60148f(0xdc)][_0x60148f(0x13a)]));_0xb2c29b[_0x60148f(0xbf)]=qs['sort'](_0x49a61e[_0x60148f(0xdc)]['sort']),_0xb2c29b[_0x60148f(0xc1)]=qs['filters'](_[_0x60148f(0x13d)](_0x49a61e[_0x60148f(0xdc)],_0x2baf8f[_0x60148f(0xc8)]),_0x53bf97);_0x49a61e[_0x60148f(0xdc)][_0x60148f(0xb4)]&&(_0xb2c29b[_0x60148f(0xc1)]=_[_0x60148f(0xdf)](_0xb2c29b[_0x60148f(0xc1)],{[Op['or']]:_[_0x60148f(0xd6)](_0x53bf97,function(_0x2d34ff){const _0x20dc0c=_0x60148f;if(_0x2d34ff[_0x20dc0c(0xae)]!==_0x20dc0c(0x120)){const _0x436454={};return _0x436454[_0x2d34ff[_0x20dc0c(0x13b)]]={[Op[_0x20dc0c(0xf3)]]:'%'+_0x49a61e[_0x20dc0c(0xdc)][_0x20dc0c(0xb4)]+'%'},_0x436454;}})}));_0xb2c29b=_[_0x60148f(0xdf)]({},_0xb2c29b,_0x49a61e[_0x60148f(0xc4)]);const _0xaf6da9={'where':_0xb2c29b['where']};return db[_0x60148f(0x112)]['count'](_0xaf6da9)[_0x60148f(0xb9)](function(_0x3196d2){const _0x26a91e=_0x60148f;return _0x4d3544[_0x26a91e(0x131)]=_0x3196d2,_0x49a61e['query'][_0x26a91e(0x11e)]&&(_0xb2c29b[_0x26a91e(0x125)]=[{'all':!![]}]),db[_0x26a91e(0x112)][_0x26a91e(0x12e)](_0xb2c29b);})['then'](function(_0x6b671b){return _0x4d3544['rows']=_0x6b671b,_0x4d3544;})['then'](respondWithFilteredResult(_0x1718ec,_0xb2c29b))['catch'](handleError(_0x1718ec,null));},exports[a903_0x1a0075(0x11c)]=function(_0x1cada7,_0x144837){const _0x556669=a903_0x1a0075;let _0x2965b7={'raw':![],'where':{'id':_0x1cada7[_0x556669(0xf6)]['id']}};const _0x56223b={};return _0x56223b[_0x556669(0x109)]=_[_0x556669(0x111)](db[_0x556669(0x112)][_0x556669(0x123)]),_0x56223b[_0x556669(0xdc)]=_['keys'](_0x1cada7['query']),_0x56223b[_0x556669(0xc8)]=_[_0x556669(0xf5)](_0x56223b[_0x556669(0x109)],_0x56223b['query']),_0x2965b7[_0x556669(0x10f)]=_[_0x556669(0xf5)](_0x56223b[_0x556669(0x109)],qs[_0x556669(0xb6)](_0x1cada7['query'][_0x556669(0xb6)])),_0x2965b7[_0x556669(0x10f)]=_0x2965b7[_0x556669(0x10f)][_0x556669(0xbd)]?_0x2965b7[_0x556669(0x10f)]:_0x56223b[_0x556669(0x109)],_0x1cada7['query'][_0x556669(0x11e)]&&(_0x2965b7['include']=[{'all':!![]}]),_0x2965b7=_[_0x556669(0xdf)]({},_0x2965b7,_0x1cada7['options']),db[_0x556669(0x112)]['findOne'](_0x2965b7)['then'](handleEntityNotFound(_0x144837,null))[_0x556669(0xb9)](respondWithResult(_0x144837,null))['catch'](handleError(_0x144837,null));},exports[a903_0x1a0075(0xd7)]=function(_0x3fb311,_0x20f54a){const _0x3cd1e5=a903_0x1a0075;return db[_0x3cd1e5(0x112)][_0x3cd1e5(0xd7)](_0x3fb311[_0x3cd1e5(0xc7)],{})[_0x3cd1e5(0xb9)](function(_0x4389c1){const _0x58b742=_0x3cd1e5,_0x5d0894=_0x3fb311[_0x58b742(0x101)][_0x58b742(0x128)]({'plain':!![]});if(!_0x5d0894)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d0894[_0x58b742(0x10e)]==='user'){const _0x8a1952=_0x4389c1['get']({'plain':!![]}),_0x2e3205=[{'name':_0x58b742(0xdd),'value':_0x58b742(0x143)},{'name':_0x58b742(0xbc),'value':_0x58b742(0x122)}],_0x233586=_[_0x58b742(0xf7)](_0x2e3205,[_0x58b742(0xa6),_0x8a1952[_0x58b742(0xae)]])[_0x58b742(0x13b)];return db['UserProfileSection']['findOne']({'where':{'name':_0x233586,'userProfileId':_0x5d0894[_0x58b742(0xef)]},'raw':!![]})[_0x58b742(0xb9)](function(_0x3ec05a){const _0x7572c0=_0x58b742;return _0x3ec05a&&_0x3ec05a[_0x7572c0(0x103)]===0x0?db[_0x7572c0(0x12a)][_0x7572c0(0xd7)]({'name':_0x8a1952[_0x7572c0(0x13b)],'resourceId':_0x8a1952['id'],'type':_0x3ec05a[_0x7572c0(0x13b)],'sectionId':_0x3ec05a['id']},{})[_0x7572c0(0xb9)](function(){return _0x4389c1;}):_0x4389c1;})[_0x58b742(0xe3)](function(_0x2b4948){const _0x5974f4=_0x58b742;logger[_0x5974f4(0xf9)]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4948);throw _0x2b4948;});}return _0x4389c1;})[_0x3cd1e5(0xb9)](respondWithResult(_0x20f54a,0xc9))[_0x3cd1e5(0xe3)](handleError(_0x20f54a,null));},exports[a903_0x1a0075(0xad)]=function(_0x31874f,_0x370593){const _0x3394c0=a903_0x1a0075;let _0xe46e60={'where':{'id':_0x31874f['params']['id']}};const _0x228adb={};return _0x228adb[_0x3394c0(0x109)]=_[_0x3394c0(0x111)](db[_0x3394c0(0x112)][_0x3394c0(0x123)]),_0xe46e60[_0x3394c0(0x10f)]=_[_0x3394c0(0xf5)](_0x228adb[_0x3394c0(0x109)],qs['fields'](_0x31874f['query'][_0x3394c0(0xb6)])),_0xe46e60[_0x3394c0(0x10f)]=_0xe46e60[_0x3394c0(0x10f)][_0x3394c0(0xbd)]?_0xe46e60[_0x3394c0(0x10f)]:_0x228adb['model'],_0x31874f[_0x3394c0(0xdc)][_0x3394c0(0x11e)]&&(_0xe46e60['include']=[{'all':!![]}]),_0xe46e60=_[_0x3394c0(0xdf)]({},_0xe46e60,_0x31874f[_0x3394c0(0xc4)]),db[_0x3394c0(0x112)][_0x3394c0(0xdb)](_0xe46e60)[_0x3394c0(0xb9)](handleEntityNotFound(_0x370593,null))['then'](function(_0x4d308c){const _0xeb2f09=_0x3394c0;if(_0x4d308c){let _0xc6aa60=_0x4d308c[_0xeb2f09(0x128)]({'plain':!![]});return _0xc6aa60=qs[_0xeb2f09(0x132)](_0xc6aa60,['id',_0xeb2f09(0xc6),_0xeb2f09(0xe1)]),_0x31874f[_0xeb2f09(0xc7)]=_[_0xeb2f09(0x132)](_0x31874f['body'],['id',_0xeb2f09(0xc6),_0xeb2f09(0xe1)]),db[_0xeb2f09(0x112)][_0xeb2f09(0xd7)](_[_0xeb2f09(0xdf)](_0xc6aa60,_0x31874f[_0xeb2f09(0xc7)]),{'include':_0x31874f[_0xeb2f09(0xdc)][_0xeb2f09(0x11e)]?[{'all':!![]}]:undefined})[_0xeb2f09(0xb9)](function(_0x4bc741){const _0xab9dd6=_0xeb2f09,_0x2a3040=_0x31874f[_0xab9dd6(0x101)][_0xab9dd6(0x128)]({'plain':!![]});if(!_0x2a3040)throw new Error(_0xab9dd6(0xe6));if(_0x2a3040[_0xab9dd6(0x10e)]===_0xab9dd6(0x101)){const _0x40667e=_0x4bc741[_0xab9dd6(0x128)]({'plain':!![]}),_0x5e6420=[{'name':'VoiceQueues','value':_0xab9dd6(0x143)},{'name':_0xab9dd6(0xbc),'value':_0xab9dd6(0x122)}],_0x43918b=_[_0xab9dd6(0xf7)](_0x5e6420,[_0xab9dd6(0xa6),_0x40667e[_0xab9dd6(0xae)]])[_0xab9dd6(0x13b)];return db[_0xab9dd6(0x141)]['findOne']({'where':{'name':_0x43918b,'userProfileId':_0x2a3040[_0xab9dd6(0xef)]},'raw':!![]})[_0xab9dd6(0xb9)](function(_0x1c1df7){const _0x126c73=_0xab9dd6;return _0x1c1df7&&_0x1c1df7[_0x126c73(0x103)]===0x0?db[_0x126c73(0x12a)][_0x126c73(0xd7)]({'name':_0x40667e[_0x126c73(0x13b)],'resourceId':_0x40667e['id'],'type':_0x1c1df7['name'],'sectionId':_0x1c1df7['id']},{})[_0x126c73(0xb9)](function(){return _0x4bc741;}):_0x4bc741;})[_0xab9dd6(0xe3)](function(_0x5c3094){const _0x40160b=_0xab9dd6;logger[_0x40160b(0xf9)](_0x40160b(0xd2),_0x5c3094);throw _0x5c3094;});}return _0x4bc741;});}})['then'](respondWithResult(_0x370593,0xc9))['catch'](handleError(_0x370593,null));},exports[a903_0x1a0075(0xd1)]=function(_0x3451c9,_0x50220c){const _0x307743=a903_0x1a0075;return _0x3451c9[_0x307743(0xc7)]['id']&&delete _0x3451c9[_0x307743(0xc7)]['id'],db[_0x307743(0x112)]['findOne']({'where':{'id':_0x3451c9[_0x307743(0xf6)]['id']}})['then'](handleEntityNotFound(_0x50220c,null))[_0x307743(0xb9)](saveUpdates(_0x3451c9[_0x307743(0xc7)],null))[_0x307743(0xb9)](respondWithResult(_0x50220c,null))[_0x307743(0xe3)](handleError(_0x50220c,null));},exports[a903_0x1a0075(0xbb)]=function(_0xbf2ee4,_0x54999e){const _0x5531a5=a903_0x1a0075;return db[_0x5531a5(0x112)]['findOne']({'where':{'id':_0xbf2ee4['params']['id']}})[_0x5531a5(0xb9)](handleEntityNotFound(_0x54999e,null))[_0x5531a5(0xb9)](removeEntity(_0x54999e,null))[_0x5531a5(0xe3)](handleError(_0x54999e,null));},exports[a903_0x1a0075(0xf1)]=function(_0xb82648,_0x4f1187){const _0x5629ea=a903_0x1a0075;let _0x4f25b={'raw':![],'where':{}};const _0x41451d={},_0x26304e={'count':0x0,'rows':[]};return db[_0x5629ea(0x112)][_0x5629ea(0xdb)]({'where':{'id':_0xb82648['params']['id']}})[_0x5629ea(0xb9)](handleEntityNotFound(_0x4f1187,null))[_0x5629ea(0xb9)](function(_0x104512){const _0x284d4f=_0x5629ea;if(_0x104512)return _0x41451d[_0x284d4f(0x109)]=_['keys'](db[_0x284d4f(0xc0)][_0x284d4f(0x123)]),_0x41451d[_0x284d4f(0xdc)]=_[_0x284d4f(0x111)](_0xb82648['query']),_0x41451d[_0x284d4f(0xc8)]=_[_0x284d4f(0xf5)](_0x41451d[_0x284d4f(0x109)],_0x41451d['query']),_0x4f25b[_0x284d4f(0x10f)]=_[_0x284d4f(0xf5)](_0x41451d['model'],qs['fields'](_0xb82648[_0x284d4f(0xdc)]['fields'])),_0x4f25b['attributes']=_0x4f25b[_0x284d4f(0x10f)][_0x284d4f(0xbd)]?_0x4f25b[_0x284d4f(0x10f)]:_0x41451d[_0x284d4f(0x109)],typeof _0xb82648[_0x284d4f(0xdc)][_0x284d4f(0x126)]==='undefined'&&(_0x4f25b[_0x284d4f(0x117)]=qs['limit'](_0xb82648[_0x284d4f(0xdc)][_0x284d4f(0x117)]),_0x4f25b[_0x284d4f(0x13a)]=qs[_0x284d4f(0x13a)](_0xb82648[_0x284d4f(0xdc)][_0x284d4f(0x13a)])),_0x4f25b[_0x284d4f(0xbf)]=qs[_0x284d4f(0x10d)](_0xb82648[_0x284d4f(0xdc)][_0x284d4f(0x10d)]),_0x4f25b[_0x284d4f(0xc1)]=qs[_0x284d4f(0xc8)](_[_0x284d4f(0x13d)](_0xb82648[_0x284d4f(0xdc)],_0x41451d[_0x284d4f(0xc8)])),_0x4f25b['where'][_0x284d4f(0xca)]=_0x104512['id'],_0xb82648[_0x284d4f(0xdc)]['filter']&&(_0x4f25b['where']=_[_0x284d4f(0xdf)](_0x4f25b[_0x284d4f(0xc1)],{[Op['or']]:_[_0x284d4f(0xd6)](_0x4f25b[_0x284d4f(0x10f)],function(_0x29fce9){const _0x898bc0=_0x284d4f,_0x54a0cf={};return _0x54a0cf[_0x29fce9]={[Op['like']]:'%'+_0xb82648[_0x898bc0(0xdc)]['filter']+'%'},_0x54a0cf;})})),_0x4f25b=_[_0x284d4f(0xdf)]({},_0x4f25b,_0xb82648['options']),db[_0x284d4f(0xc0)]['count']({'where':_0x4f25b[_0x284d4f(0xc1)]})['then'](function(_0x1342ae){const _0x497df7=_0x284d4f;return _0x26304e['count']=_0x1342ae,_0xb82648[_0x497df7(0xdc)][_0x497df7(0x11e)]&&(_0x4f25b[_0x497df7(0x125)]=[{'all':!![]}]),db[_0x497df7(0xc0)][_0x497df7(0x12e)](_0x4f25b);})[_0x284d4f(0xb9)](function(_0x18b3df){const _0x4714fc=_0x284d4f;return _0x26304e[_0x4714fc(0xe7)]=_0x18b3df,_0x26304e;});})[_0x5629ea(0xb9)](respondWithFilteredResult(_0x4f1187,_0x4f25b))['catch'](handleError(_0x4f1187,null));},exports[a903_0x1a0075(0x118)]=function(_0x185cdb,_0x90bac9){const _0x167475=a903_0x1a0075;let _0x8728f1={'raw':!![],'where':{}};const _0x404e14={},_0x153818={'count':0x0,'rows':[]};return db[_0x167475(0x112)][_0x167475(0xdb)]({'where':{'id':_0x185cdb[_0x167475(0xf6)]['id']}})[_0x167475(0xb9)](handleEntityNotFound(_0x90bac9,null))[_0x167475(0xb9)](function(_0x124fea){const _0x5536e7=_0x167475;if(_0x124fea)return _0x404e14[_0x5536e7(0x109)]=_['keys'](db[_0x5536e7(0xac)][_0x5536e7(0x123)]),_0x404e14[_0x5536e7(0xdc)]=_[_0x5536e7(0x111)](_0x185cdb[_0x5536e7(0xdc)]),_0x404e14[_0x5536e7(0xc8)]=_[_0x5536e7(0xf5)](_0x404e14['model'],_0x404e14[_0x5536e7(0xdc)]),_0x8728f1[_0x5536e7(0x10f)]=_[_0x5536e7(0xf5)](_0x404e14[_0x5536e7(0x109)],qs['fields'](_0x185cdb[_0x5536e7(0xdc)][_0x5536e7(0xb6)])),_0x8728f1[_0x5536e7(0x10f)]=_0x8728f1[_0x5536e7(0x10f)][_0x5536e7(0xbd)]?_0x8728f1['attributes']:_0x404e14[_0x5536e7(0x109)],typeof _0x185cdb[_0x5536e7(0xdc)][_0x5536e7(0x126)]==='undefined'&&(_0x8728f1[_0x5536e7(0x117)]=qs['limit'](_0x185cdb[_0x5536e7(0xdc)][_0x5536e7(0x117)]),_0x8728f1['offset']=qs['offset'](_0x185cdb[_0x5536e7(0xdc)][_0x5536e7(0x13a)])),_0x8728f1[_0x5536e7(0xbf)]=qs[_0x5536e7(0x10d)](_0x185cdb['query'][_0x5536e7(0x10d)]),_0x8728f1[_0x5536e7(0xc1)]=qs[_0x5536e7(0xc8)](_[_0x5536e7(0x13d)](_0x185cdb['query'],_0x404e14[_0x5536e7(0xc8)])),_0x8728f1[_0x5536e7(0xc1)][_0x5536e7(0xca)]=_0x124fea['id'],_0x185cdb[_0x5536e7(0xdc)][_0x5536e7(0xb4)]&&(_0x8728f1[_0x5536e7(0xc1)]=_['merge'](_0x8728f1[_0x5536e7(0xc1)],{[Op['or']]:_[_0x5536e7(0xd6)](_0x8728f1['attributes'],function(_0x3f83ee){const _0x1777cf=_0x5536e7,_0x1a9b2a={};return _0x1a9b2a[_0x3f83ee]={[Op[_0x1777cf(0xf3)]]:'%'+_0x185cdb[_0x1777cf(0xdc)]['filter']+'%'},_0x1a9b2a;})})),_0x8728f1=_[_0x5536e7(0xdf)]({},_0x8728f1,_0x185cdb[_0x5536e7(0xc4)]),db[_0x5536e7(0xac)][_0x5536e7(0x131)]({'where':_0x8728f1[_0x5536e7(0xc1)]})[_0x5536e7(0xb9)](function(_0x250968){const _0x490206=_0x5536e7;return _0x153818[_0x490206(0x131)]=_0x250968,_0x185cdb[_0x490206(0xdc)]['includeAll']&&(_0x8728f1['include']=[{'all':!![]}]),db[_0x490206(0xac)][_0x490206(0x12e)](_0x8728f1);})['then'](function(_0x5dab87){const _0x1d423c=_0x5536e7;return _0x153818[_0x1d423c(0xe7)]=_0x5dab87,_0x153818;});})[_0x167475(0xb9)](respondWithFilteredResult(_0x90bac9,_0x8728f1))[_0x167475(0xe3)](handleError(_0x90bac9,null));},exports[a903_0x1a0075(0xc5)]=function(_0x2710f1,_0x307459){const _0x2dc03a=a903_0x1a0075;let _0x4b2b8c={'raw':!![],'where':{}};const _0x3a3f48={},_0x5a6f46={'count':0x0,'rows':[]};return db[_0x2dc03a(0x112)][_0x2dc03a(0xdb)]({'where':{'id':_0x2710f1[_0x2dc03a(0xf6)]['id']}})[_0x2dc03a(0xb9)](handleEntityNotFound(_0x307459,null))[_0x2dc03a(0xb9)](function(_0x2ef6df){const _0x5678db=_0x2dc03a;if(_0x2ef6df)return _0x3a3f48[_0x5678db(0x109)]=_[_0x5678db(0x111)](db['CmHopperFinal'][_0x5678db(0x123)]),_0x3a3f48['query']=_[_0x5678db(0x111)](_0x2710f1['query']),_0x3a3f48[_0x5678db(0xc8)]=_['intersection'](_0x3a3f48[_0x5678db(0x109)],_0x3a3f48[_0x5678db(0xdc)]),_0x4b2b8c[_0x5678db(0x10f)]=_[_0x5678db(0xf5)](_0x3a3f48['model'],qs[_0x5678db(0xb6)](_0x2710f1['query'][_0x5678db(0xb6)])),_0x4b2b8c[_0x5678db(0x10f)]=_0x4b2b8c[_0x5678db(0x10f)][_0x5678db(0xbd)]?_0x4b2b8c['attributes']:_0x3a3f48['model'],typeof _0x2710f1[_0x5678db(0xdc)][_0x5678db(0x126)]===_0x5678db(0xb2)&&(_0x4b2b8c['limit']=qs[_0x5678db(0x117)](_0x2710f1[_0x5678db(0xdc)][_0x5678db(0x117)]),_0x4b2b8c[_0x5678db(0x13a)]=qs[_0x5678db(0x13a)](_0x2710f1[_0x5678db(0xdc)][_0x5678db(0x13a)])),_0x4b2b8c[_0x5678db(0xbf)]=qs['sort'](_0x2710f1['query'][_0x5678db(0x10d)]),_0x4b2b8c[_0x5678db(0xc1)]=qs[_0x5678db(0xc8)](_[_0x5678db(0x13d)](_0x2710f1[_0x5678db(0xdc)],_0x3a3f48[_0x5678db(0xc8)])),_0x4b2b8c[_0x5678db(0xc1)]['VoiceQueueId']=_0x2ef6df['id'],_0x2710f1[_0x5678db(0xdc)][_0x5678db(0xb4)]&&(_0x4b2b8c['where']=_[_0x5678db(0xdf)](_0x4b2b8c[_0x5678db(0xc1)],{[Op['or']]:_[_0x5678db(0xd6)](_0x4b2b8c['attributes'],function(_0xe916d5){const _0x32248d=_0x5678db,_0x5015de={};return _0x5015de[_0xe916d5]={[Op[_0x32248d(0xf3)]]:'%'+_0x2710f1[_0x32248d(0xdc)]['filter']+'%'},_0x5015de;})})),_0x4b2b8c=_[_0x5678db(0xdf)]({},_0x4b2b8c,_0x2710f1[_0x5678db(0xc4)]),db[_0x5678db(0x107)][_0x5678db(0x131)]({'where':_0x4b2b8c['where']})[_0x5678db(0xb9)](function(_0xf9d2e6){const _0x47fcd9=_0x5678db;return _0x5a6f46[_0x47fcd9(0x131)]=_0xf9d2e6,_0x2710f1[_0x47fcd9(0xdc)][_0x47fcd9(0x11e)]&&(_0x4b2b8c[_0x47fcd9(0x125)]=[{'all':!![]}]),db[_0x47fcd9(0x107)][_0x47fcd9(0x12e)](_0x4b2b8c);})[_0x5678db(0xb9)](function(_0x3e4f4d){return _0x5a6f46['rows']=_0x3e4f4d,_0x5a6f46;});})[_0x2dc03a(0xb9)](respondWithFilteredResult(_0x307459,_0x4b2b8c))['catch'](handleError(_0x307459,null));},exports[a903_0x1a0075(0x114)]=function(_0x4db7de,_0x59bc49){const _0x19fc04=a903_0x1a0075;let _0x44f368={'raw':!![],'where':{}};const _0xc41e4c={},_0x28d6bd={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x19fc04(0xdb)]({'where':{'id':_0x4db7de[_0x19fc04(0xf6)]['id']}})[_0x19fc04(0xb9)](handleEntityNotFound(_0x59bc49,null))[_0x19fc04(0xb9)](function(_0x550d9f){const _0x27ede0=_0x19fc04;if(_0x550d9f)return _0xc41e4c[_0x27ede0(0x109)]=_[_0x27ede0(0x111)](db[_0x27ede0(0xc9)]['rawAttributes']),_0xc41e4c[_0x27ede0(0xdc)]=_[_0x27ede0(0x111)](_0x4db7de['query']),_0xc41e4c['filters']=_[_0x27ede0(0xf5)](_0xc41e4c[_0x27ede0(0x109)],_0xc41e4c[_0x27ede0(0xdc)]),_0x44f368['attributes']=_[_0x27ede0(0xf5)](_0xc41e4c[_0x27ede0(0x109)],qs['fields'](_0x4db7de[_0x27ede0(0xdc)][_0x27ede0(0xb6)])),_0x44f368[_0x27ede0(0x10f)]=_0x44f368[_0x27ede0(0x10f)][_0x27ede0(0xbd)]?_0x44f368['attributes']:_0xc41e4c['model'],typeof _0x4db7de[_0x27ede0(0xdc)][_0x27ede0(0x126)]===_0x27ede0(0xb2)&&(_0x44f368[_0x27ede0(0x117)]=qs[_0x27ede0(0x117)](_0x4db7de[_0x27ede0(0xdc)][_0x27ede0(0x117)]),_0x44f368[_0x27ede0(0x13a)]=qs[_0x27ede0(0x13a)](_0x4db7de[_0x27ede0(0xdc)]['offset'])),_0x44f368[_0x27ede0(0xbf)]=qs[_0x27ede0(0x10d)](_0x4db7de[_0x27ede0(0xdc)]['sort']),_0x44f368[_0x27ede0(0xc1)]=qs[_0x27ede0(0xc8)](_['pick'](_0x4db7de['query'],_0xc41e4c['filters'])),_0x44f368[_0x27ede0(0xc1)][_0x27ede0(0xca)]=_0x550d9f['id'],_0x4db7de[_0x27ede0(0xdc)][_0x27ede0(0xb4)]&&(_0x44f368[_0x27ede0(0xc1)]=_['merge'](_0x44f368[_0x27ede0(0xc1)],{[Op['or']]:_[_0x27ede0(0xd6)](_0x44f368[_0x27ede0(0x10f)],function(_0x2ce0a0){const _0x8cd593=_0x27ede0,_0x522798={};return _0x522798[_0x2ce0a0]={[Op[_0x8cd593(0xf3)]]:'%'+_0x4db7de[_0x8cd593(0xdc)][_0x8cd593(0xb4)]+'%'},_0x522798;})})),_0x44f368=_[_0x27ede0(0xdf)]({},_0x44f368,_0x4db7de['options']),db['CmHopperBlack']['count']({'where':_0x44f368['where']})[_0x27ede0(0xb9)](function(_0x34fa1e){const _0x1e61c8=_0x27ede0;return _0x28d6bd[_0x1e61c8(0x131)]=_0x34fa1e,_0x4db7de[_0x1e61c8(0xdc)][_0x1e61c8(0x11e)]&&(_0x44f368[_0x1e61c8(0x125)]=[{'all':!![]}]),db[_0x1e61c8(0xc9)][_0x1e61c8(0x12e)](_0x44f368);})['then'](function(_0xe04f36){const _0x489349=_0x27ede0;return _0x28d6bd[_0x489349(0xe7)]=_0xe04f36,_0x28d6bd;});})[_0x19fc04(0xb9)](respondWithFilteredResult(_0x59bc49,_0x44f368))[_0x19fc04(0xe3)](handleError(_0x59bc49,null));},exports['getTeams']=function(_0x43f444,_0x1b875e){const _0x42d4b6=a903_0x1a0075;let _0x18b1f9={};const _0x3e5d98={};let _0x1f7296,_0x4ccd0b;return db[_0x42d4b6(0x112)]['findOne']({'where':{'id':_0x43f444['params']['id']}})[_0x42d4b6(0xb9)](handleEntityNotFound(_0x1b875e,null))[_0x42d4b6(0xb9)](function(_0x70c1d4){const _0x233e9d=_0x42d4b6;if(_0x70c1d4)return _0x1f7296=_0x70c1d4,_0x3e5d98[_0x233e9d(0x109)]=_[_0x233e9d(0x111)](db[_0x233e9d(0xe5)][_0x233e9d(0x123)]),_0x3e5d98['query']=_[_0x233e9d(0x111)](_0x43f444[_0x233e9d(0xdc)]),_0x3e5d98['filters']=_[_0x233e9d(0xf5)](_0x3e5d98[_0x233e9d(0x109)],_0x3e5d98['query']),_0x18b1f9[_0x233e9d(0x10f)]=_[_0x233e9d(0xf5)](_0x3e5d98['model'],qs[_0x233e9d(0xb6)](_0x43f444['query']['fields'])),_0x18b1f9[_0x233e9d(0x10f)]=_0x18b1f9[_0x233e9d(0x10f)][_0x233e9d(0xbd)]?_0x18b1f9[_0x233e9d(0x10f)]:_0x3e5d98[_0x233e9d(0x109)],_0x18b1f9['order']=qs['sort'](_0x43f444['query'][_0x233e9d(0x10d)]),_0x18b1f9[_0x233e9d(0xc1)]=qs[_0x233e9d(0xc8)](_[_0x233e9d(0x13d)](_0x43f444[_0x233e9d(0xdc)],_0x3e5d98[_0x233e9d(0xc8)])),_0x43f444[_0x233e9d(0xdc)][_0x233e9d(0xb4)]&&(_0x18b1f9[_0x233e9d(0xc1)]=_['merge'](_0x18b1f9[_0x233e9d(0xc1)],{[Op['or']]:_[_0x233e9d(0xd6)](_0x18b1f9['attributes'],function(_0x3fb76e){const _0xa5b45=_0x233e9d,_0x573fa6={};return _0x573fa6[_0x3fb76e]={[Op[_0xa5b45(0xf3)]]:'%'+_0x43f444[_0xa5b45(0xdc)][_0xa5b45(0xb4)]+'%'},_0x573fa6;})})),_0x18b1f9=_[_0x233e9d(0xdf)]({},_0x18b1f9,_0x43f444[_0x233e9d(0xc4)]),_0x1f7296[_0x233e9d(0x140)](_0x18b1f9);})['then'](function(_0x1e2c30){const _0x1e8e96=_0x42d4b6;if(_0x1e2c30)return _0x4ccd0b=_0x1e2c30['length'],typeof _0x43f444[_0x1e8e96(0xdc)]['nolimit']===_0x1e8e96(0xb2)&&(_0x18b1f9[_0x1e8e96(0x117)]=qs[_0x1e8e96(0x117)](_0x43f444[_0x1e8e96(0xdc)][_0x1e8e96(0x117)]),_0x18b1f9['offset']=qs[_0x1e8e96(0x13a)](_0x43f444[_0x1e8e96(0xdc)][_0x1e8e96(0x13a)])),_0x1f7296[_0x1e8e96(0x140)](_0x18b1f9);})[_0x42d4b6(0xb9)](function(_0x5a4c36){if(_0x5a4c36)return _0x5a4c36?{'count':_0x4ccd0b,'rows':_0x5a4c36}:null;})[_0x42d4b6(0xb9)](respondWithResult(_0x1b875e,null))[_0x42d4b6(0xe3)](handleError(_0x1b875e,null));},exports[a903_0x1a0075(0xb8)]=function(_0x6ff43d,_0x4a608d){const _0x44edc9=a903_0x1a0075,_0x1b0002=_0x6ff43d[_0x44edc9(0xc7)][_0x44edc9(0xee)],_0x3e691b=_[_0x44edc9(0xd6)](_0x1b0002,'id');return db[_0x44edc9(0xe5)][_0x44edc9(0x12e)]({'where':{'id':_0x3e691b},'attributes':['id'],'include':[{'model':db[_0x44edc9(0xb7)],'as':'Agents','attributes':['id','name',_0x44edc9(0x12d),'voicePause',_0x44edc9(0xc3)],'raw':!![]}]})['then'](function(_0x15f0a0){const _0x33636f=_0x44edc9;if(_0x15f0a0){const _0x3207c9=_[_0x33636f(0xcf)](_0x15f0a0,function(_0x355602){const _0x5b6ca2=_0x33636f,_0x5c100b=_0x355602[_0x5b6ca2(0x128)]({'plain':!![]});return _0x5c100b[_0x5b6ca2(0x100)]['forEach'](function(_0x1a3c7f){const _0x1ca113=_0x5b6ca2;_0x1a3c7f[_0x1ca113(0x137)]=_[_0x1ca113(0xf7)](_0x1b0002,{'id':_0x5c100b['id']})[_0x1ca113(0x137)];}),_0x5c100b['Agents'];});return db[_0x33636f(0x112)]['findOne']({'where':{'id':_0x6ff43d[_0x33636f(0xf6)]['id']}})[_0x33636f(0xb9)](function(_0x42a5b7){const _0x1d782d=_0x33636f;return db[_0x1d782d(0xec)][_0x1d782d(0x136)](function(_0x2bc235){const _0x354bf1=_0x1d782d;return _0x42a5b7['addTeams'](_0x3e691b,{'transaction':_0x2bc235})[_0x354bf1(0xb9)](function(){const _0x32b4d4=_0x354bf1,_0x526095=_0x3207c9[_0x32b4d4(0xd6)](_0x3d3185=>{const _0x22b011=_0x32b4d4;return db['UserVoiceQueue'][_0x22b011(0x134)]({'where':{'UserId':_0x3d3185['id'],'VoiceQueueId':_0x6ff43d[_0x22b011(0xf6)]['id']},'defaults':{'penalty':_0x3d3185[_0x22b011(0x137)]},'transaction':_0x2bc235});});return Promise['all'](_0x526095);})[_0x354bf1(0xb9)](function(){const _0xdb999b=_0x354bf1,_0x4366a7=_[_0xdb999b(0xb4)](_0x3207c9,{'online':!![]}),_0x5f6a85=_0x4366a7[_0xdb999b(0xd6)](_0x5bec68=>{const _0x143dbf=_0xdb999b;return db[_0x143dbf(0xf4)][_0x143dbf(0xaa)]({'membername':_0x5bec68['name'],'UserId':_0x5bec68['id'],'queue_name':_0x42a5b7[_0x143dbf(0x13b)],'VoiceQueueId':_0x42a5b7['id'],'interface':_[_0x143dbf(0x133)](_0x5bec68[_0x143dbf(0xc3)])?util[_0x143dbf(0xe4)](_0x143dbf(0x129),_0x5bec68[_0x143dbf(0x13b)]):_0x5bec68[_0x143dbf(0xc3)],'paused':_0x5bec68['voicePause']||![],'penalty':_0x5bec68[_0x143dbf(0x137)]},{'transaction':_0x2bc235});});return Promise[_0xdb999b(0x116)](_0x5f6a85);})[_0x354bf1(0xb9)](function(){const _0xbfcce3=_0x354bf1;_0x3207c9[_0xbfcce3(0xd8)](function(_0x272257){socket['emit']('userVoiceQueue:save',{'UserId':_0x272257['id'],'VoiceQueueId':_0x42a5b7['id']});});});});});}})[_0x44edc9(0xb9)](respondWithStatusCode(_0x4a608d,null))[_0x44edc9(0xe3)](handleError(_0x4a608d,null));},exports['removeTeams']=function(_0x5199f1,_0x4d225a){const _0x25cf66=a903_0x1a0075;return db['Team'][_0x25cf66(0x12e)]({'where':{'id':_0x5199f1[_0x25cf66(0xdc)][_0x25cf66(0xaf)]},'attributes':['id'],'include':[{'model':db[_0x25cf66(0xb7)],'as':_0x25cf66(0x100),'attributes':['id'],'raw':!![]}]})[_0x25cf66(0xb9)](handleEntityNotFound(_0x4d225a,null))[_0x25cf66(0xb9)](function(_0x1f8957){const _0x5b1ce7=_0x25cf66,_0x574550=_['map'](_0x1f8957,'id');let _0x223bfb=[];const _0x15d7bb=[],_0x529df8=squel[_0x5b1ce7(0xd3)]();_0x529df8[_0x5b1ce7(0x110)]('tq.TeamId')[_0x5b1ce7(0xea)](_0x5b1ce7(0x142),'tq')[_0x5b1ce7(0xb0)](_0x5b1ce7(0x139),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5b1ce7(0xc1)](_0x5b1ce7(0xd5),_0x5199f1['params']['id']);for(let _0x3290b3=0x0;_0x3290b3<_0x1f8957[_0x5b1ce7(0xbd)];_0x3290b3+=0x1){const _0xb6694c=_0x1f8957[_0x3290b3];for(let _0x44af8c=0x0;_0x44af8c<_0xb6694c[_0x5b1ce7(0x100)][_0x5b1ce7(0xbd)];_0x44af8c+=0x1){const _0x42bf8e=_0xb6694c[_0x5b1ce7(0x100)][_0x44af8c],_0x1ddb66=_0x529df8[_0x5b1ce7(0xad)]();_0x1ddb66[_0x5b1ce7(0xc1)](_0x5b1ce7(0xb1),_0x42bf8e['id']),_0x15d7bb[_0x5b1ce7(0xe0)](db[_0x5b1ce7(0xec)][_0x5b1ce7(0xdc)](_0x1ddb66['toString'](),{'type':QueryTypes[_0x5b1ce7(0x113)]})['then'](function(_0x197bac){const _0x45e1f7=_0x5b1ce7;if(_0x197bac['length']===0x1)return _0x42bf8e['id'];else{const _0x313994=_[_0x45e1f7(0xde)](_[_0x45e1f7(0xd6)](_0x197bac,_0x45e1f7(0xb3)),function(_0x3aa447){const _0x49f31e=_0x45e1f7;return _[_0x49f31e(0xfa)](_0x574550,_0x3aa447);});if(_0x313994)return _0x42bf8e['id'];}}));}}return Promise[_0x5b1ce7(0x116)](_0x15d7bb)['then'](function(_0x52e230){const _0x8e5a75=_0x5b1ce7;return _0x223bfb=_(_0x223bfb)['union'](_0x52e230)[_0x8e5a75(0x12f)]()[_0x8e5a75(0xa6)](),db['VoiceQueue']['findOne']({'where':{'id':_0x5199f1[_0x8e5a75(0xf6)]['id']}})[_0x8e5a75(0xb9)](function(_0x27ea52){const _0x5dfd3b=_0x8e5a75;return db[_0x5dfd3b(0xec)][_0x5dfd3b(0x136)](function(_0x2c7780){const _0x118ef0=_0x5dfd3b;return _0x27ea52[_0x118ef0(0x121)](_0x5199f1[_0x118ef0(0xdc)]['ids'],{'transaction':_0x2c7780})['then'](function(){const _0x2bf8c4=_0x118ef0;if(!_[_0x2bf8c4(0x104)](_0x223bfb))return _0x27ea52[_0x2bf8c4(0xed)](_0x223bfb,{'transaction':_0x2c7780})['then'](function(){const _0x6ec6a1=_0x2bf8c4;return db[_0x6ec6a1(0xf4)][_0x6ec6a1(0xbb)]({'where':{'VoiceQueueId':_0x5199f1['params']['id'],'UserId':_0x223bfb},'transaction':_0x2c7780});});})['then'](function(){_0x223bfb['forEach'](function(_0x4e41cb){const _0x2486ec=a903_0x2d82;socket[_0x2486ec(0xcc)](_0x2486ec(0xfc),{'UserId':_0x4e41cb,'VoiceQueueId':_0x27ea52['id']});});});});});});})[_0x25cf66(0xb9)](respondWithStatusCode(_0x4d225a,null))['catch'](handleError(_0x4d225a,null));},exports[a903_0x1a0075(0xa5)]=function(_0x772b94,_0x160077){const _0x3e74b1=a903_0x1a0075;let _0x7f6a91,_0x336923;return db[_0x3e74b1(0x112)][_0x3e74b1(0xdb)]({'where':{'id':_0x772b94[_0x3e74b1(0xf6)]['id']}})[_0x3e74b1(0xb9)](function(_0x18aec2){const _0x539c66=_0x3e74b1;if(_0x18aec2)return _0x336923=_0x18aec2,_0x18aec2[_0x539c66(0xa5)](_0x772b94[_0x539c66(0xc7)][_0x539c66(0xaf)],{'through':_['omit'](_0x772b94[_0x539c66(0xc7)],[_0x539c66(0xaf),'id'])})[_0x539c66(0xb9)](function(_0x135e36){const _0x37be37=_0x539c66;for(let _0x3f2c1e=0x0;_0x3f2c1e<_0x772b94[_0x37be37(0xc7)][_0x37be37(0xaf)]['length'];_0x3f2c1e+=0x1){socket[_0x37be37(0xcc)]('userVoiceQueue:save',{'UserId':_0x772b94[_0x37be37(0xc7)]['ids'][_0x3f2c1e],'VoiceQueueId':_0x772b94[_0x37be37(0xf6)]['id']});}return _0x135e36;});})['then'](function(_0x7a8341){const _0xef387b=_0x3e74b1;_0x7f6a91=_0x7a8341||[];if(_0x336923)return db[_0xef387b(0xb7)][_0xef387b(0x12e)]({'where':{'id':_0x772b94[_0xef387b(0xc7)][_0xef387b(0xaf)]},'attributes':['id',_0xef387b(0x13b),'online','voicePause',_0xef387b(0xc3)],'raw':!![]});})[_0x3e74b1(0xb9)](function(_0x14271d){const _0x14789b=_0x3e74b1;if(!_['isEmpty'](_0x14271d)){const _0xd7a73e=[];for(let _0x4e9d12=0x0;_0x4e9d12<_0x14271d[_0x14789b(0xbd)];_0x4e9d12++){_0x14271d[_0x4e9d12]['online']&&_0xd7a73e[_0x14789b(0xe0)](db[_0x14789b(0xf4)][_0x14789b(0xaa)]({'membername':_0x14271d[_0x4e9d12][_0x14789b(0x13b)],'UserId':_0x14271d[_0x4e9d12]['id'],'queue_name':_0x336923[_0x14789b(0x13b)],'VoiceQueueId':_0x336923['id'],'interface':_[_0x14789b(0x133)](_0x14271d[_0x4e9d12][_0x14789b(0xc3)])?util[_0x14789b(0xe4)]('SIP/%s',_0x14271d[_0x4e9d12]['name']):_0x14271d[_0x4e9d12][_0x14789b(0xc3)],'paused':_0x14271d[_0x4e9d12][_0x14789b(0xf0)]||![],'penalty':_0x772b94[_0x14789b(0xc7)][_0x14789b(0x137)]||0x0}));}return Promise[_0x14789b(0x116)](_0xd7a73e);}})['then'](function(){return _0x7f6a91;})['then'](respondWithResult(_0x160077,null))[_0x3e74b1(0xe3)](handleError(_0x160077,null));},exports[a903_0x1a0075(0xed)]=function(_0x2480bb,_0x3f59f6){const _0x6c7daf=a903_0x1a0075;return db['VoiceQueue'][_0x6c7daf(0xdb)]({'where':{'id':_0x2480bb[_0x6c7daf(0xf6)]['id']}})['then'](handleEntityNotFound(_0x3f59f6,null))['then'](function(_0x5d8423){const _0x318b76=_0x6c7daf;if(_0x5d8423)return _0x5d8423[_0x318b76(0xed)](_0x2480bb[_0x318b76(0xdc)][_0x318b76(0xaf)])[_0x318b76(0xb9)](function(){const _0xacfc89=_0x318b76;if(_[_0xacfc89(0x108)](_0x2480bb[_0xacfc89(0xdc)][_0xacfc89(0xaf)]))for(let _0x4d4abd=0x0;_0x4d4abd<_0x2480bb[_0xacfc89(0xdc)]['ids'][_0xacfc89(0xbd)];_0x4d4abd+=0x1){socket['emit'](_0xacfc89(0xfc),{'UserId':Number(_0x2480bb[_0xacfc89(0xdc)][_0xacfc89(0xaf)][_0x4d4abd]),'VoiceQueueId':Number(_0x2480bb[_0xacfc89(0xf6)]['id'])});}else socket[_0xacfc89(0xcc)](_0xacfc89(0xfc),{'UserId':Number(_0x2480bb[_0xacfc89(0xdc)]['ids']),'VoiceQueueId':Number(_0x2480bb['params']['id'])});});})[_0x6c7daf(0xb9)](function(_0x2005c0){const _0x4dd734=_0x6c7daf;return db['UserVoiceQueueRt'][_0x4dd734(0xbb)]({'where':{'VoiceQueueId':_0x2480bb[_0x4dd734(0xf6)]['id'],'UserId':_0x2480bb[_0x4dd734(0xdc)][_0x4dd734(0xaf)]}})[_0x4dd734(0xb9)](function(){return _0x2005c0;});})[_0x6c7daf(0xb9)](respondWithStatusCode(_0x3f59f6,null))[_0x6c7daf(0xe3)](handleError(_0x3f59f6,null));},exports[a903_0x1a0075(0xda)]=function(_0x50c94c,_0x1c9d4f){const _0x165d8d=a903_0x1a0075;let _0x46f24e={};const _0x1c54bb={};let _0x252d4f,_0x347201;return db[_0x165d8d(0x112)][_0x165d8d(0xdb)]({'where':{'id':_0x50c94c['params']['id']}})['then'](handleEntityNotFound(_0x1c9d4f,null))[_0x165d8d(0xb9)](function(_0x45540a){const _0xa9bff3=_0x165d8d;if(_0x45540a)return _0x252d4f=_0x45540a,_0x1c54bb[_0xa9bff3(0x109)]=_[_0xa9bff3(0x111)](db['User'][_0xa9bff3(0x123)]),_0x1c54bb[_0xa9bff3(0xdc)]=_['keys'](_0x50c94c[_0xa9bff3(0xdc)]),_0x1c54bb[_0xa9bff3(0xc8)]=_[_0xa9bff3(0xf5)](_0x1c54bb[_0xa9bff3(0x109)],_0x1c54bb[_0xa9bff3(0xdc)]),_0x46f24e[_0xa9bff3(0x10f)]=_['intersection'](_0x1c54bb[_0xa9bff3(0x109)],qs[_0xa9bff3(0xb6)](_0x50c94c[_0xa9bff3(0xdc)][_0xa9bff3(0xb6)])),_0x46f24e[_0xa9bff3(0x10f)]=_0x46f24e[_0xa9bff3(0x10f)][_0xa9bff3(0xbd)]?_0x46f24e[_0xa9bff3(0x10f)]:_0x1c54bb[_0xa9bff3(0x109)],_0x46f24e['order']=qs[_0xa9bff3(0x10d)](_0x50c94c[_0xa9bff3(0xdc)][_0xa9bff3(0x10d)]),_0x46f24e[_0xa9bff3(0xc1)]=qs['filters'](_['pick'](_0x50c94c['query'],_0x1c54bb['filters'])),_0x50c94c[_0xa9bff3(0xdc)][_0xa9bff3(0xb4)]&&(_0x46f24e[_0xa9bff3(0xc1)]=_[_0xa9bff3(0xdf)](_0x46f24e['where'],{[Op['or']]:_[_0xa9bff3(0xd6)](_0x46f24e[_0xa9bff3(0x10f)],function(_0x1c474c){const _0x532779=_0xa9bff3,_0x44c680={};return _0x44c680[_0x1c474c]={[Op['like']]:'%'+_0x50c94c[_0x532779(0xdc)][_0x532779(0xb4)]+'%'},_0x44c680;})})),_0x46f24e=_[_0xa9bff3(0xdf)]({},_0x46f24e,_0x50c94c[_0xa9bff3(0xc4)]),_0x252d4f[_0xa9bff3(0xda)](_0x46f24e);})[_0x165d8d(0xb9)](function(_0x420cac){const _0xb9df24=_0x165d8d;if(_0x420cac)return _0x347201=_0x420cac[_0xb9df24(0xbd)],typeof _0x50c94c['query']['nolimit']===_0xb9df24(0xb2)&&(_0x46f24e[_0xb9df24(0x117)]=qs[_0xb9df24(0x117)](_0x50c94c[_0xb9df24(0xdc)][_0xb9df24(0x117)]),_0x46f24e[_0xb9df24(0x13a)]=qs[_0xb9df24(0x13a)](_0x50c94c[_0xb9df24(0xdc)]['offset'])),_0x252d4f[_0xb9df24(0xda)](_0x46f24e);})[_0x165d8d(0xb9)](function(_0x17c79e){if(_0x17c79e)return _0x17c79e?{'count':_0x347201,'rows':_0x17c79e}:null;})[_0x165d8d(0xb9)](respondWithResult(_0x1c9d4f,null))[_0x165d8d(0xe3)](handleError(_0x1c9d4f,null));},exports['getMembers']=function(_0x2d8428,_0xda7e85){const _0x298c94=a903_0x1a0075;let _0x18b983={};const _0x2a3af9={};let _0x2771bf,_0x5b0b2c;return db[_0x298c94(0x112)]['findOne']({'where':{'id':_0x2d8428['params']['id']}})['then'](handleEntityNotFound(_0xda7e85,null))['then'](function(_0x257e89){const _0x2965d1=_0x298c94;if(_0x257e89)return _0x2771bf=_0x257e89,_0x2a3af9[_0x2965d1(0x109)]=_[_0x2965d1(0x111)](db[_0x2965d1(0xf4)]['rawAttributes']),_0x2a3af9[_0x2965d1(0xdc)]=_[_0x2965d1(0x111)](_0x2d8428[_0x2965d1(0xdc)]),_0x2a3af9[_0x2965d1(0xc8)]=_[_0x2965d1(0xf5)](_0x2a3af9[_0x2965d1(0x109)],_0x2a3af9[_0x2965d1(0xdc)]),_0x18b983[_0x2965d1(0x10f)]=_['intersection'](_0x2a3af9['model'],qs[_0x2965d1(0xb6)](_0x2d8428[_0x2965d1(0xdc)]['fields'])),_0x18b983[_0x2965d1(0x10f)]=_0x18b983[_0x2965d1(0x10f)]['length']?_0x18b983[_0x2965d1(0x10f)]:_0x2a3af9['model'],_0x18b983['order']=qs[_0x2965d1(0x10d)](_0x2d8428[_0x2965d1(0xdc)]['sort']),_0x18b983[_0x2965d1(0xc1)]=qs[_0x2965d1(0xc8)](_[_0x2965d1(0x13d)](_0x2d8428[_0x2965d1(0xdc)],_0x2a3af9[_0x2965d1(0xc8)])),_0x2d8428['query'][_0x2965d1(0xb4)]&&(_0x18b983[_0x2965d1(0xc1)]=_['merge'](_0x18b983[_0x2965d1(0xc1)],{[Op['or']]:_[_0x2965d1(0xd6)](_0x18b983[_0x2965d1(0x10f)],function(_0x49aff1){const _0x1efe7e=_0x2965d1,_0x5ad1f2={};return _0x5ad1f2[_0x49aff1]={[Op[_0x1efe7e(0xf3)]]:'%'+_0x2d8428[_0x1efe7e(0xdc)][_0x1efe7e(0xb4)]+'%'},_0x5ad1f2;})})),_0x18b983=_[_0x2965d1(0xdf)]({},_0x18b983,_0x2d8428[_0x2965d1(0xc4)]),_0x2771bf[_0x2965d1(0x12b)](_0x18b983);})[_0x298c94(0xb9)](function(_0x49d415){const _0x3b9bf3=_0x298c94;if(_0x49d415)return _0x5b0b2c=_0x49d415[_0x3b9bf3(0xbd)],typeof _0x2d8428[_0x3b9bf3(0xdc)][_0x3b9bf3(0x126)]===_0x3b9bf3(0xb2)&&(_0x18b983['limit']=qs['limit'](_0x2d8428[_0x3b9bf3(0xdc)][_0x3b9bf3(0x117)]),_0x18b983[_0x3b9bf3(0x13a)]=qs[_0x3b9bf3(0x13a)](_0x2d8428[_0x3b9bf3(0xdc)][_0x3b9bf3(0x13a)])),_0x2771bf[_0x3b9bf3(0x12b)](_0x18b983);})['then'](function(_0xf48218){return _0xf48218?{'count':_0x5b0b2c,'rows':_0xf48218}:null;})[_0x298c94(0xb9)](respondWithResult(_0xda7e85,null))[_0x298c94(0xe3)](handleError(_0xda7e85,null));},exports[a903_0x1a0075(0xe2)]=function(_0xd1145a,_0x3751ea){const _0x489dc3=a903_0x1a0075;let _0x523aa7={};const _0x5983ee={};let _0x207902,_0xfc151f;return db[_0x489dc3(0x112)]['findOne']({'where':{'id':_0xd1145a['params']['id']}})[_0x489dc3(0xb9)](handleEntityNotFound(_0x3751ea,null))[_0x489dc3(0xb9)](function(_0xccc678){const _0x587396=_0x489dc3;if(_0xccc678)return _0x207902=_0xccc678,_0x5983ee[_0x587396(0x109)]=_[_0x587396(0x111)](db[_0x587396(0xd9)][_0x587396(0x123)]),_0x5983ee[_0x587396(0xdc)]=_['keys'](_0xd1145a[_0x587396(0xdc)]),_0x5983ee[_0x587396(0xc8)]=_['intersection'](_0x5983ee[_0x587396(0x109)],_0x5983ee[_0x587396(0xdc)]),_0x523aa7[_0x587396(0x10f)]=_['intersection'](_0x5983ee[_0x587396(0x109)],qs[_0x587396(0xb6)](_0xd1145a[_0x587396(0xdc)]['fields'])),_0x523aa7[_0x587396(0x10f)]=_0x523aa7['attributes'][_0x587396(0xbd)]?_0x523aa7[_0x587396(0x10f)]:_0x5983ee[_0x587396(0x109)],_0x523aa7[_0x587396(0xbf)]=qs[_0x587396(0x10d)](_0xd1145a['query'][_0x587396(0x10d)]),_0x523aa7[_0x587396(0xc1)]=qs['filters'](_[_0x587396(0x13d)](_0xd1145a[_0x587396(0xdc)],_0x5983ee[_0x587396(0xc8)])),_0xd1145a['query'][_0x587396(0xb4)]&&(_0x523aa7[_0x587396(0xc1)]=_[_0x587396(0xdf)](_0x523aa7[_0x587396(0xc1)],{[Op['or']]:_[_0x587396(0xd6)](_0x523aa7['attributes'],function(_0x260453){const _0xbebe65=_0x587396,_0x463a4b={};return _0x463a4b[_0x260453]={[Op[_0xbebe65(0xf3)]]:'%'+_0xd1145a[_0xbebe65(0xdc)]['filter']+'%'},_0x463a4b;})})),_0x523aa7=_[_0x587396(0xdf)]({},_0x523aa7,_0xd1145a[_0x587396(0xc4)]),_0x207902['getLists'](_0x523aa7);})['then'](function(_0x39c43c){const _0x278ca4=_0x489dc3;if(_0x39c43c)return _0xfc151f=_0x39c43c[_0x278ca4(0xbd)],typeof _0xd1145a[_0x278ca4(0xdc)][_0x278ca4(0x126)]==='undefined'&&(_0x523aa7['limit']=qs[_0x278ca4(0x117)](_0xd1145a[_0x278ca4(0xdc)][_0x278ca4(0x117)]),_0x523aa7[_0x278ca4(0x13a)]=qs[_0x278ca4(0x13a)](_0xd1145a['query'][_0x278ca4(0x13a)])),_0x207902[_0x278ca4(0xe2)](_0x523aa7);})[_0x489dc3(0xb9)](function(_0x4127bb){if(_0x4127bb)return _0x4127bb?{'count':_0xfc151f,'rows':_0x4127bb}:null;})[_0x489dc3(0xb9)](respondWithResult(_0x3751ea,null))[_0x489dc3(0xe3)](handleError(_0x3751ea,null));},exports['addLists']=function(_0x5e7e63,_0x384890){const _0x2d1e06=a903_0x1a0075;let _0x547133,_0x2b1473;return db[_0x2d1e06(0x112)]['findOne']({'where':{'id':_0x5e7e63['params']['id']}})[_0x2d1e06(0xb9)](handleEntityNotFound(_0x384890,null))['then'](function(_0x26e350){const _0x16c4ae=_0x2d1e06;if(_0x26e350)return _0x2b1473=_0x26e350,_0x26e350[_0x16c4ae(0x12c)](_0x5e7e63[_0x16c4ae(0xc7)][_0x16c4ae(0xaf)],{'through':_[_0x16c4ae(0x132)](_0x5e7e63[_0x16c4ae(0xc7)],[_0x16c4ae(0xaf),'id'])});return null;})[_0x2d1e06(0xb9)](function(_0x59d18e){const _0x24fd68=_0x2d1e06;let _0x52ed98;_0x547133=_0x59d18e||[];const _0x3a2431=[];if(_0x59d18e){for(let _0x5476ea=0x0;_0x5476ea<_0x59d18e[_0x24fd68(0xbd)];_0x5476ea+=0x1){const _0x440a7b=_0x59d18e[_0x5476ea][_0x24fd68(0x128)]({'plain':!![]});_0x2b1473['dialCheckDuplicateType']=_0x5e7e63['body']['dialCheckDuplicateType']?_0x5e7e63[_0x24fd68(0xc7)]['dialCheckDuplicateType']:_0x2b1473[_0x24fd68(0x138)];switch(_0x2b1473[_0x24fd68(0x138)]){case'always':_0x52ed98=squel[_0x24fd68(0xce)]()[_0x24fd68(0x11b)](_0x24fd68(0x11a))[_0x24fd68(0xd4)]([_0x24fd68(0x127),_0x24fd68(0x13e),'ContactId',_0x24fd68(0x130),_0x24fd68(0xca),_0x24fd68(0xc6),'updatedAt'],squel[_0x24fd68(0xd3)]()[_0x24fd68(0x110)](_0x24fd68(0x127),_0x24fd68(0x127))['field'](_0x24fd68(0xa8),_0x24fd68(0x13e))[_0x24fd68(0x110)]('id',_0x24fd68(0xd0))[_0x24fd68(0x110)](_0x440a7b[_0x24fd68(0xfe)][_0x24fd68(0x115)](),_0x24fd68(0x130))['field'](_0x5e7e63[_0x24fd68(0xf6)]['id'][_0x24fd68(0x115)](),_0x24fd68(0xca))[_0x24fd68(0x110)](_0x24fd68(0xa8),_0x24fd68(0xc6))[_0x24fd68(0x110)](_0x24fd68(0xa8),_0x24fd68(0xe1))[_0x24fd68(0xea)]('cm_contacts')['where'](_0x24fd68(0xab))[_0x24fd68(0xc1)](_0x24fd68(0xbe),_0x440a7b[_0x24fd68(0xfe)]['toString']())[_0x24fd68(0xc1)](_0x24fd68(0xe9))[_0x24fd68(0xc1)](_0x24fd68(0x13f),squel[_0x24fd68(0xd3)]()[_0x24fd68(0x110)](_0x24fd68(0xcd))[_0x24fd68(0xea)]('cm_hopper_final')['where'](_0x24fd68(0xd5),_0x5e7e63[_0x24fd68(0xf6)]['id'][_0x24fd68(0x115)]()))[_0x24fd68(0xc1)]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x24fd68(0xea)]('cm_hopper')[_0x24fd68(0xc1)]('VoiceQueueId\x20=\x20?',_0x5e7e63['params']['id'][_0x24fd68(0x115)]())))[_0x24fd68(0x115)]();break;case'onlyIfOpen':_0x52ed98=squel[_0x24fd68(0xce)]()['into'](_0x24fd68(0x11a))[_0x24fd68(0xd4)]([_0x24fd68(0x127),'scheduledAt',_0x24fd68(0xd0),_0x24fd68(0x130),_0x24fd68(0xca),'createdAt','updatedAt'],squel['select']()[_0x24fd68(0x110)]('phone',_0x24fd68(0x127))[_0x24fd68(0x110)](_0x24fd68(0xa8),'scheduledAt')['field']('id',_0x24fd68(0xd0))[_0x24fd68(0x110)](_0x440a7b['CmListId'][_0x24fd68(0x115)](),_0x24fd68(0x130))[_0x24fd68(0x110)](_0x5e7e63[_0x24fd68(0xf6)]['id'][_0x24fd68(0x115)](),'VoiceQueueId')['field'](_0x24fd68(0xa8),_0x24fd68(0xc6))[_0x24fd68(0x110)](_0x24fd68(0xa8),_0x24fd68(0xe1))[_0x24fd68(0xea)](_0x24fd68(0x11f))[_0x24fd68(0xc1)](_0x24fd68(0xab))[_0x24fd68(0xc1)](_0x24fd68(0xbe),_0x440a7b[_0x24fd68(0xfe)]['toString']())[_0x24fd68(0xc1)](_0x24fd68(0xe9))[_0x24fd68(0xc1)]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x24fd68(0x110)](_0x24fd68(0xba))[_0x24fd68(0xea)](_0x24fd68(0x11a))['where'](_0x24fd68(0xd5),_0x5e7e63[_0x24fd68(0xf6)]['id'][_0x24fd68(0x115)]())))[_0x24fd68(0x115)]();break;default:_0x52ed98=squel['insert']()['into'](_0x24fd68(0x11a))[_0x24fd68(0xd4)]([_0x24fd68(0x127),_0x24fd68(0x13e),_0x24fd68(0xd0),_0x24fd68(0x130),_0x24fd68(0xca),_0x24fd68(0xc6),_0x24fd68(0xe1)],squel[_0x24fd68(0xd3)]()[_0x24fd68(0x110)](_0x24fd68(0x127),_0x24fd68(0x127))['field'](_0x24fd68(0xa8),_0x24fd68(0x13e))['field']('id',_0x24fd68(0xd0))[_0x24fd68(0x110)](_0x440a7b[_0x24fd68(0xfe)][_0x24fd68(0x115)](),_0x24fd68(0x130))[_0x24fd68(0x110)](_0x5e7e63[_0x24fd68(0xf6)]['id'][_0x24fd68(0x115)](),_0x24fd68(0xca))[_0x24fd68(0x110)]('NOW()',_0x24fd68(0xc6))[_0x24fd68(0x110)](_0x24fd68(0xa8),_0x24fd68(0xe1))[_0x24fd68(0xea)]('cm_contacts')[_0x24fd68(0xc1)](_0x24fd68(0xab))['where']('ListId\x20=\x20?',_0x440a7b[_0x24fd68(0xfe)][_0x24fd68(0x115)]())[_0x24fd68(0xc1)](_0x24fd68(0xe9)))[_0x24fd68(0x115)]();}_0x3a2431[_0x24fd68(0xe0)](db['sequelize'][_0x24fd68(0xdc)](_0x52ed98));}return Promise['all'](_0x3a2431);}})[_0x2d1e06(0xb9)](function(){return _0x547133;})[_0x2d1e06(0xb9)](respondWithResult(_0x384890,null))[_0x2d1e06(0xe3)](handleError(_0x384890,null));},exports[a903_0x1a0075(0x119)]=function(_0x4c1f04,_0x138b55){const _0x454699=a903_0x1a0075;return db[_0x454699(0x112)]['findOne']({'where':{'id':_0x4c1f04[_0x454699(0xf6)]['id']}})[_0x454699(0xb9)](handleEntityNotFound(_0x138b55,null))[_0x454699(0xb9)](function(_0x44bfb9){const _0x34c824=_0x454699;if(_0x44bfb9)return _0x44bfb9[_0x34c824(0x119)](_0x4c1f04['query'][_0x34c824(0xaf)]);})[_0x454699(0xb9)](function(_0x2a4d7b){const _0x537329=_0x454699;if(_0x2a4d7b)return db[_0x537329(0xc0)]['destroy']({'where':{'ListId':_0x4c1f04['query'][_0x537329(0xaf)],'VoiceQueueId':_0x4c1f04[_0x537329(0xf6)]['id']}})[_0x537329(0xb9)](function(){return _0x2a4d7b;});})[_0x454699(0xb9)](respondWithStatusCode(_0x138b55,null))['catch'](handleError(_0x138b55,null));},exports[a903_0x1a0075(0xf2)]=function(_0x560645,_0x48ab25){const _0x12008a=a903_0x1a0075;let _0x44afe6={};const _0x809913={};let _0x190a4a,_0x36d958;return db[_0x12008a(0x112)][_0x12008a(0xdb)]({'where':{'id':_0x560645[_0x12008a(0xf6)]['id']}})[_0x12008a(0xb9)](handleEntityNotFound(_0x48ab25,null))[_0x12008a(0xb9)](function(_0x5769e5){const _0x22bcb9=_0x12008a;if(_0x5769e5)return _0x190a4a=_0x5769e5,_0x809913[_0x22bcb9(0x109)]=_['keys'](db[_0x22bcb9(0xd9)]['rawAttributes']),_0x809913['query']=_['keys'](_0x560645[_0x22bcb9(0xdc)]),_0x809913['filters']=_[_0x22bcb9(0xf5)](_0x809913[_0x22bcb9(0x109)],_0x809913[_0x22bcb9(0xdc)]),_0x44afe6[_0x22bcb9(0x10f)]=_[_0x22bcb9(0xf5)](_0x809913['model'],qs['fields'](_0x560645[_0x22bcb9(0xdc)]['fields'])),_0x44afe6['attributes']=_0x44afe6[_0x22bcb9(0x10f)][_0x22bcb9(0xbd)]?_0x44afe6['attributes']:_0x809913[_0x22bcb9(0x109)],_0x44afe6['order']=qs[_0x22bcb9(0x10d)](_0x560645[_0x22bcb9(0xdc)][_0x22bcb9(0x10d)]),_0x44afe6[_0x22bcb9(0xc1)]=qs[_0x22bcb9(0xc8)](_[_0x22bcb9(0x13d)](_0x560645[_0x22bcb9(0xdc)],_0x809913['filters'])),_0x560645[_0x22bcb9(0xdc)][_0x22bcb9(0xb4)]&&(_0x44afe6[_0x22bcb9(0xc1)]=_['merge'](_0x44afe6['where'],{[Op['or']]:_[_0x22bcb9(0xd6)](_0x44afe6[_0x22bcb9(0x10f)],function(_0x4a5fb4){const _0x2aea42=_0x22bcb9,_0x2820a4={};return _0x2820a4[_0x4a5fb4]={[Op[_0x2aea42(0xf3)]]:'%'+_0x560645[_0x2aea42(0xdc)][_0x2aea42(0xb4)]+'%'},_0x2820a4;})})),_0x44afe6=_[_0x22bcb9(0xdf)]({},_0x44afe6,_0x560645['options']),_0x190a4a[_0x22bcb9(0xf2)](_0x44afe6);})[_0x12008a(0xb9)](function(_0x1b4fdb){const _0x183285=_0x12008a;if(_0x1b4fdb)return _0x36d958=_0x1b4fdb[_0x183285(0xbd)],typeof _0x560645[_0x183285(0xdc)]['nolimit']===_0x183285(0xb2)&&(_0x44afe6[_0x183285(0x117)]=qs[_0x183285(0x117)](_0x560645[_0x183285(0xdc)]['limit']),_0x44afe6['offset']=qs['offset'](_0x560645[_0x183285(0xdc)]['offset'])),_0x190a4a[_0x183285(0xf2)](_0x44afe6);})['then'](function(_0x3a021f){if(_0x3a021f)return _0x3a021f?{'count':_0x36d958,'rows':_0x3a021f}:null;})[_0x12008a(0xb9)](respondWithResult(_0x48ab25,null))[_0x12008a(0xe3)](handleError(_0x48ab25,null));},exports[a903_0x1a0075(0x10c)]=function(_0x3dde22,_0x39a2b4){const _0x504069=a903_0x1a0075;let _0x237efb;return db['VoiceQueue'][_0x504069(0xdb)]({'where':{'id':_0x3dde22['params']['id']}})[_0x504069(0xb9)](handleEntityNotFound(_0x39a2b4,null))[_0x504069(0xb9)](function(_0x168030){const _0x2df958=_0x504069;if(_0x168030)return _0x168030[_0x2df958(0x10c)](_0x3dde22[_0x2df958(0xc7)]['ids'],{'through':_[_0x2df958(0x132)](_0x3dde22['body'],[_0x2df958(0xaf),'id'])});return null;})[_0x504069(0xb9)](function(_0x51d15c){const _0x3b61f6=_0x504069;let _0x17be56;_0x237efb=_0x51d15c||[];const _0x4cb5b2=[];if(_0x51d15c){for(let _0xae4a8b=0x0;_0xae4a8b<_0x51d15c[_0x3b61f6(0xbd)];_0xae4a8b+=0x1){const _0x13afb0=_0x51d15c[_0xae4a8b][_0x3b61f6(0x128)]({'plain':!![]});_0x17be56=squel[_0x3b61f6(0xce)]()[_0x3b61f6(0x11b)]('cm_hopper_black')[_0x3b61f6(0xd4)](['phone',_0x3b61f6(0xd0),_0x3b61f6(0x130),_0x3b61f6(0xca),_0x3b61f6(0xc6),'updatedAt'],squel['select']()[_0x3b61f6(0x110)](_0x3b61f6(0x127),_0x3b61f6(0x127))[_0x3b61f6(0x110)]('id',_0x3b61f6(0xd0))[_0x3b61f6(0x110)](_0x13afb0[_0x3b61f6(0xfe)][_0x3b61f6(0x115)](),_0x3b61f6(0x130))[_0x3b61f6(0x110)](_0x3dde22['params']['id'][_0x3b61f6(0x115)](),_0x3b61f6(0xca))[_0x3b61f6(0x110)](_0x3b61f6(0xa8),_0x3b61f6(0xc6))[_0x3b61f6(0x110)](_0x3b61f6(0xa8),_0x3b61f6(0xe1))[_0x3b61f6(0xea)](_0x3b61f6(0x11f))[_0x3b61f6(0xc1)](_0x3b61f6(0xab))['where'](_0x3b61f6(0xbe),_0x13afb0[_0x3b61f6(0xfe)][_0x3b61f6(0x115)]())[_0x3b61f6(0xc1)](_0x3b61f6(0xe9)))[_0x3b61f6(0x115)](),_0x4cb5b2[_0x3b61f6(0xe0)](db[_0x3b61f6(0xec)][_0x3b61f6(0xdc)](_0x17be56));}return Promise[_0x3b61f6(0x116)](_0x4cb5b2);}})[_0x504069(0xb9)](function(){return _0x237efb;})[_0x504069(0xb9)](respondWithResult(_0x39a2b4,null))[_0x504069(0xe3)](handleError(_0x39a2b4,null));},exports[a903_0x1a0075(0x106)]=function(_0x419a7e,_0x496f39){const _0x278e73=a903_0x1a0075;return db[_0x278e73(0x112)][_0x278e73(0xdb)]({'where':{'id':_0x419a7e[_0x278e73(0xf6)]['id']}})[_0x278e73(0xb9)](handleEntityNotFound(_0x496f39,null))[_0x278e73(0xb9)](function(_0x12a273){const _0x9e0a86=_0x278e73;if(_0x12a273)return _0x12a273[_0x9e0a86(0x106)](_0x419a7e[_0x9e0a86(0xdc)]['ids']);})[_0x278e73(0xb9)](function(_0x22a54c){const _0x36ead2=_0x278e73;if(_0x22a54c)return db[_0x36ead2(0xc9)][_0x36ead2(0xbb)]({'where':{'ListId':_0x419a7e[_0x36ead2(0xdc)][_0x36ead2(0xaf)],'VoiceQueueId':_0x419a7e[_0x36ead2(0xf6)]['id']}})[_0x36ead2(0xb9)](function(){return _0x22a54c;});})[_0x278e73(0xb9)](respondWithStatusCode(_0x496f39,null))[_0x278e73(0xe3)](handleError(_0x496f39,null));};
\ No newline at end of file