Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / components / realtime / agents.js
index 7b2e734..708d125 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc931=['phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','value','filterAgentAttributes','openchannelStatusTime','whatsappCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','client','http','chatPause','faxPause','openchannelPause','smsPause','voicePause','every','filter','length','idle','voiceStatus','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','unknown','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','getAgents','all','flatten','uniq','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','mailPause','whatsappPause','pauseType','find','merge','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xc931,0x19c));var _0x1c93=function(_0x8d9e0,_0x402d93){_0x8d9e0=_0x8d9e0-0x0;var _0x3221f7=_0xc931[_0x8d9e0];return _0x3221f7;};'use strict';var _=require(_0x1c93('0x0'));var jayson=require(_0x1c93('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x1c93('0x2')][_0x1c93('0x3')]({'port':0x232a});var routingClient=jayson[_0x1c93('0x2')][_0x1c93('0x3')]({'port':0x232c});function isAgentPaused(_0x1c539d,_0xc5f313){var _0x3468f7=[_0x1c539d[_0x1c93('0x4')],_0x1c539d[_0x1c93('0x5')],_0x1c539d['mailPause'],_0x1c539d[_0x1c93('0x6')],_0x1c539d[_0x1c93('0x7')],_0x1c539d[_0x1c93('0x8')],_0x1c539d['whatsappPause']];if(!_0xc5f313)return _[_0x1c93('0x9')](_0x3468f7);var _0x2f6582=_[_0x1c93('0xa')](_0x3468f7);return _0x2f6582[_0x1c93('0xb')]>0x0&&_0x2f6582[_0x1c93('0xb')]<_0x3468f7[_0x1c93('0xb')]?!![]:![];}function isIdle(_0x57290b){return _0x57290b===_0x1c93('0xc')||_0x57290b==='unknown'||_0x57290b==='unavailable'||_0x57290b==='ringing'||_['isNil'](_0x57290b);}function isAgentIdle(_0x113fb7){if(_0x113fb7[_0x1c93('0xd')]!==_0x1c93('0xc')&&_0x113fb7[_0x1c93('0x8')]){_0x113fb7['voiceStatus']=_0x1c93('0xe');return![];}return _[_0x1c93('0x9')]([_0x113fb7[_0x1c93('0xf')],_0x113fb7['faxStatus'],_0x113fb7[_0x1c93('0x10')],_0x113fb7[_0x1c93('0x11')],_0x113fb7[_0x1c93('0x12')],_0x113fb7[_0x1c93('0xd')],_0x113fb7[_0x1c93('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x1c93('0x14')](_0x1c93('0x15'),{})['then'](function(_0x5b6da3){if(_0x5b6da3[_0x1c93('0x16')]){throw new Error(_0x1c93('0x17'));}var _0x2752e3=_0x5b6da3[_0x1c93('0x18')];return routingClient['request']('Agents',{})[_0x1c93('0x19')](function(_0x185286){if(_0x185286[_0x1c93('0x16')]){throw new Error(_0x1c93('0x1a'));}var _0x195839=_0x185286[_0x1c93('0x18')];return _['merge']({},_0x2752e3,_0x195839);});})['catch'](function(_0x5719a5){throw _0x5719a5;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x10d963){var _0x4bc17c=_0x1c93('0x1b');if(isAgentPaused(_0x10d963))_0x4bc17c=_0x1c93('0xe');else if(isAgentPaused(_0x10d963,!![]))_0x4bc17c=_0x1c93('0x1c');else if(isAgentIdle(_0x10d963))_0x4bc17c=_0x1c93('0xc');else _0x4bc17c=_0x1c93('0x1d');return _0x4bc17c;}exports[_0x1c93('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x14b99b,_0x26c4b2){var _0x41db55=_[_0x1c93('0x1f')](_0x14b99b)?_0x14b99b:[_0x14b99b];var _0x28189e=_[_0x1c93('0x20')](_0x26c4b2)+_0x1c93('0x21');var _0x4bfa0b=_[_0x1c93('0x22')](_0x41db55,function(_0x27d52b){return db[_0x28189e]['findOne']({'where':{'id':_0x27d52b}})[_0x1c93('0x19')](function(_0x1c275c){if(!_0x1c275c)return[];return _0x1c275c[_0x1c93('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x1c93('0x24')](_0x4bfa0b)[_0x1c93('0x19')](function(_0x449e65){var _0x1166f4=_(_0x449e65)[_0x1c93('0x25')]()[_0x1c93('0x22')]('id')[_0x1c93('0x26')]()['value']();return _0x1166f4;});}exports[_0x1c93('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5ca28a,_0xcad2bd,_0x125496){try{if(_0xcad2bd[_0x1c93('0xb')]>0x0){_0x5ca28a=_0x5ca28a[_0x1c93('0xa')](function(_0x457a9a){return _0xcad2bd[_0x1c93('0x28')](_0x457a9a['id']);});}var _0x2832e8=_0x5ca28a['filter'](function(_0x55225d){var _0x3c41f2=_0x1c93('0x1d');if(isAgentIdle(_0x55225d)){_0x3c41f2=_0x1c93('0xc');}return _0x3c41f2===_0x125496;});return _[_0x1c93('0x22')](_0x2832e8,'id');}catch(_0x14577e){throw _0x14577e;}}exports[_0x1c93('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x24f573,_0x44f1ad,_0x4e02ab){return Promise[_0x1c93('0x2a')]()[_0x1c93('0x19')](function(){if(_0x44f1ad['length']>0x0){_0x24f573=_0x24f573[_0x1c93('0xa')](function(_0x43d789){return _0x44f1ad[_0x1c93('0x28')](_0x43d789['id']);});}return _0x24f573;})['then'](function(){return db[_0x1c93('0x2b')][_0x1c93('0x2c')]({'attributes':['id',_0x1c93('0x2d'),_0x1c93('0x2e'),_0x1c93('0x4'),_0x1c93('0x5'),_0x1c93('0x2f'),_0x1c93('0x6'),_0x1c93('0x7'),'voicePause',_0x1c93('0x30'),_0x1c93('0x31')],'where':{'id':{'$in':_[_0x1c93('0x22')](_0x24f573,'id')}},'raw':!![]});})[_0x1c93('0x19')](function(_0xc9deae){return _0xc9deae['map'](function(_0x4854a7){var _0x3ae63b=_[_0x1c93('0x32')](_0x24f573,['id',_0x4854a7['id']]);var _0x55d84f=filterAgentAttributes(_0x3ae63b);_[_0x1c93('0x33')](_0x4854a7,_0x55d84f);_0x4854a7[_0x1c93('0x34')]=getAgentStatus(_0x4854a7);return _0x4854a7;});})[_0x1c93('0x19')](function(_0x24d776){var _0x1d34da=sortAgentsByStatus(_0x24d776,_0x4e02ab);return _[_0x1c93('0x22')](_0x1d34da,'id');})[_0x1c93('0x35')](function(_0x21c399){throw _0x21c399;});}exports[_0x1c93('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x49b9ce){var _0xc9f990={'fields':[],'order':null};var _0x4b7fbd=_0x49b9ce[_0x1c93('0x37')](',');_0xc9f990[_0x1c93('0x38')]=_['filter'](_0x4b7fbd,function(_0x2d08f8){if(!_0x2d08f8[_0x1c93('0x28')](_0x1c93('0x34'))){return!![];}_0xc9f990[_0x1c93('0x39')]=_[_0x1c93('0x3a')](_0x2d08f8,'-')?_0x1c93('0x3b'):_0x1c93('0x3c');return![];});return _0xc9f990;}exports[_0x1c93('0x3d')]=getUpdatedSortOptions;function validateSortParameter(_0x478343){if(!_0x478343){_0x478343=_0x1c93('0x3e');}if(_0x478343[_0x1c93('0x28')](_0x1c93('0x2e'))&&!_0x478343[_0x1c93('0x28')]('internal')){var _0x2bc381=_0x478343['substring'](0x0,_0x478343[_0x1c93('0x3f')](_0x1c93('0x2e')));_0x478343+=','+_0x2bc381+_0x1c93('0x40');}return _0x478343;}exports[_0x1c93('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x1c2f1e,_0x3bdb8d){var _0x3a58ef=_0x1c2f1e[_0x1c93('0x42')](function(_0x287b13,_0x1b3344){if(_0x287b13[_0x1c93('0x34')]===_0x1b3344[_0x1c93('0x34')]){if(_0x287b13[_0x1c93('0x34')]===_0x1c93('0xe')){if(_0x3bdb8d===_0x1c93('0x3b')){return(_0x287b13[_0x1c93('0x31')]||'')<(_0x1b3344[_0x1c93('0x31')]||'')||_0x287b13[_0x1c93('0x2e')][_0x1c93('0x43')]()>_0x1b3344[_0x1c93('0x2e')][_0x1c93('0x43')]()?0x1:-0x1;}else{return(_0x287b13[_0x1c93('0x31')]||'')<(_0x1b3344['pauseType']||'')||_0x287b13[_0x1c93('0x2e')][_0x1c93('0x43')]()>_0x1b3344[_0x1c93('0x2e')][_0x1c93('0x43')]()?-0x1:0x1;}}else{if(_0x3bdb8d===_0x1c93('0x3b')){return _0x287b13[_0x1c93('0x2e')][_0x1c93('0x43')]()<_0x1b3344[_0x1c93('0x2e')][_0x1c93('0x43')]()?0x1:-0x1;}else{return _0x287b13[_0x1c93('0x2e')]['toLowerCase']()<_0x1b3344[_0x1c93('0x2e')][_0x1c93('0x43')]()?-0x1:0x1;}}}else{if(_0x3bdb8d===_0x1c93('0x3b')){return _0x287b13['globalStatus']<_0x1b3344[_0x1c93('0x34')]?0x1:-0x1;}else{return _0x287b13[_0x1c93('0x34')]<_0x1b3344[_0x1c93('0x34')]?-0x1:0x1;}}});return _0x3a58ef;}exports[_0x1c93('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x485f9c){var _0x57b8c3=[_0x1c93('0x45'),_0x1c93('0x46'),'lastLoginAt',_0x1c93('0x47'),_0x1c93('0x31'),_0x1c93('0x47'),_0x1c93('0x40'),_0x1c93('0x48'),_0x1c93('0x4'),_0x1c93('0x6'),_0x1c93('0x2f'),_0x1c93('0x7'),_0x1c93('0x30'),_0x1c93('0x5'),'voicePause',_0x1c93('0x49'),_0x1c93('0x4a'),_0x1c93('0x4b'),_0x1c93('0x4c'),_0x1c93('0x4d'),'faxCapacity',_0x1c93('0x4e'),_0x1c93('0x4f'),_0x1c93('0x50'),_0x1c93('0x51'),'whatsappCurrentCapacity',_0x1c93('0x52'),_0x1c93('0xf'),_0x1c93('0x11'),_0x1c93('0x10'),'smsStatus',_0x1c93('0x13'),_0x1c93('0x53'),_0x1c93('0xd'),_0x1c93('0x54'),'openchannelStatusTime',_0x1c93('0x55'),_0x1c93('0x56'),_0x1c93('0x57'),_0x1c93('0x58'),_0x1c93('0x59'),_0x1c93('0x5a'),_0x1c93('0x5b'),_0x1c93('0x5c'),_0x1c93('0x5d'),_0x1c93('0x5e')];var _0x36f21e=[_0x1c93('0x4'),'openchannelPause','mailPause',_0x1c93('0x7'),_0x1c93('0x30'),_0x1c93('0x5'),_0x1c93('0x8'),'online'];var _0x36ca5f=_(_0x485f9c)['omit'](_0x36f21e)['pick'](_0x57b8c3)[_0x1c93('0x5f')]();return _0x36ca5f;}exports[_0x1c93('0x60')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x1c93('0x2d'),_0x1c93('0x2e'),'role',_0x1c93('0x40'),_0x1c93('0x46'),'globalStatus',_0x1c93('0x45'),'lastLoginAt',_0x1c93('0x31'),'lastPauseAt',_0x1c93('0x5'),_0x1c93('0x4'),_0x1c93('0x2f'),_0x1c93('0x6'),_0x1c93('0x7'),_0x1c93('0x8'),_0x1c93('0x30'),_0x1c93('0xf'),_0x1c93('0x53'),_0x1c93('0x10'),'openchannelStatus',_0x1c93('0x12'),_0x1c93('0xd'),_0x1c93('0x13'),_0x1c93('0x54'),_0x1c93('0x58'),_0x1c93('0x55'),_0x1c93('0x61'),_0x1c93('0x56'),_0x1c93('0x59'),_0x1c93('0x57'),_0x1c93('0x49'),'faxCapacity',_0x1c93('0x4b'),_0x1c93('0x4a'),'smsCapacity',_0x1c93('0x4d'),_0x1c93('0x4e'),_0x1c93('0x52'),_0x1c93('0x50'),_0x1c93('0x4f'),_0x1c93('0x51'),_0x1c93('0x62'),'phoneBarEnableScreenRecordingByAgent',_0x1c93('0x5e'),'destconnectedlinenum',_0x1c93('0x63'),'queue',_0x1c93('0x5c')];}exports[_0x1c93('0x64')]=getRealtimeAgentsQueryFields;
\ No newline at end of file
+var _0x2ff5=['getAgentIdsByStatus','resolve','User','findAll','fullname','chatPause','smsPause','pauseType','find','getSortedAgentsIdsByStatus','fields','globalStatus','order','startsWith','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','role','mailStatusTime','faxCapacity','whatsappCapacity','onhold','queue','getRealtimeAgentsQueryFields','jayson/promise','../../mysqldb','http','client','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','voiceStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','Queue','map','getAgents','flatten','uniq','value','getAgentIdsByQueues','includes'];(function(_0x1fa3e2,_0x58020c){var _0x1261fc=function(_0x439e3b){while(--_0x439e3b){_0x1fa3e2['push'](_0x1fa3e2['shift']());}};_0x1261fc(++_0x58020c);}(_0x2ff5,0x1d5));var _0x52ff=function(_0xec24f8,_0x3ec72a){_0xec24f8=_0xec24f8-0x0;var _0x60f49f=_0x2ff5[_0xec24f8];return _0x60f49f;};'use strict';var _=require('lodash');var jayson=require(_0x52ff('0x0'));var db=require(_0x52ff('0x1'))['db'];var amiClient=jayson['client'][_0x52ff('0x2')]({'port':0x232a});var routingClient=jayson[_0x52ff('0x3')][_0x52ff('0x2')]({'port':0x232c});function isAgentPaused(_0x36b0e9,_0x190df8){var _0xbfba62=[_0x36b0e9['chatPause'],_0x36b0e9[_0x52ff('0x4')],_0x36b0e9[_0x52ff('0x5')],_0x36b0e9[_0x52ff('0x6')],_0x36b0e9['smsPause'],_0x36b0e9[_0x52ff('0x7')],_0x36b0e9[_0x52ff('0x8')]];if(!_0x190df8)return _[_0x52ff('0x9')](_0xbfba62);var _0x17ca0b=_[_0x52ff('0xa')](_0xbfba62);return _0x17ca0b[_0x52ff('0xb')]>0x0&&_0x17ca0b[_0x52ff('0xb')]<_0xbfba62[_0x52ff('0xb')]?!![]:![];}function isIdle(_0x5e127e){return _0x5e127e===_0x52ff('0xc')||_0x5e127e===_0x52ff('0xd')||_0x5e127e===_0x52ff('0xe')||_0x5e127e===_0x52ff('0xf')||_[_0x52ff('0x10')](_0x5e127e);}function isAgentIdle(_0x300409){if(_0x300409['voiceStatus']!=='idle'&&_0x300409['voicePause']){_0x300409['voiceStatus']=_0x52ff('0x11');return![];}return _['every']([_0x300409[_0x52ff('0x12')],_0x300409[_0x52ff('0x13')],_0x300409['mailStatus'],_0x300409[_0x52ff('0x14')],_0x300409[_0x52ff('0x15')],_0x300409[_0x52ff('0x16')],_0x300409[_0x52ff('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x52ff('0x18')](_0x52ff('0x19'),{})['then'](function(_0x3a1a83){if(_0x3a1a83[_0x52ff('0x1a')]){throw new Error(_0x52ff('0x1b'));}var _0x4c83f=_0x3a1a83[_0x52ff('0x1c')];return routingClient[_0x52ff('0x18')]('Agents',{})[_0x52ff('0x1d')](function(_0x154419){if(_0x154419[_0x52ff('0x1a')]){throw new Error(_0x52ff('0x1e'));}var _0x5a87ac=_0x154419[_0x52ff('0x1c')];return _[_0x52ff('0x1f')]({},_0x4c83f,_0x5a87ac);});})[_0x52ff('0x20')](function(_0x58efb4){throw _0x58efb4;});}exports[_0x52ff('0x21')]=getRealtimeAgents;function getAgentStatus(_0x10ad04){var _0x2ba460=_0x52ff('0xd');if(isAgentPaused(_0x10ad04))_0x2ba460=_0x52ff('0x11');else if(isAgentPaused(_0x10ad04,!![]))_0x2ba460=_0x52ff('0x22');else if(isAgentIdle(_0x10ad04))_0x2ba460=_0x52ff('0xc');else _0x2ba460=_0x52ff('0x23');return _0x2ba460;}exports[_0x52ff('0x24')]=getAgentStatus;function getAgentIdsByQueues(_0x439011,_0x174a01){var _0xe68eb5=_[_0x52ff('0x25')](_0x439011)?_0x439011:[_0x439011];var _0x3e441b=_['startCase'](_0x174a01)+_0x52ff('0x26');var _0x27b209=_[_0x52ff('0x27')](_0xe68eb5,function(_0x3accd4){return db[_0x3e441b]['findOne']({'where':{'id':_0x3accd4}})[_0x52ff('0x1d')](function(_0xc68d3b){if(!_0xc68d3b)return[];return _0xc68d3b[_0x52ff('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x27b209)['then'](function(_0x1ac770){var _0x3f5e22=_(_0x1ac770)[_0x52ff('0x29')]()[_0x52ff('0x27')]('id')[_0x52ff('0x2a')]()[_0x52ff('0x2b')]();return _0x3f5e22;});}exports[_0x52ff('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x322260,_0x1a706c,_0x3a049f){try{if(_0x1a706c[_0x52ff('0xb')]>0x0){_0x322260=_0x322260[_0x52ff('0xa')](function(_0x406343){return _0x1a706c[_0x52ff('0x2d')](_0x406343['id']);});}var _0x4e4571=_0x322260[_0x52ff('0xa')](function(_0x5cc35d){var _0x233a3e=_0x52ff('0x23');if(isAgentIdle(_0x5cc35d)){_0x233a3e='idle';}return _0x233a3e===_0x3a049f;});return _[_0x52ff('0x27')](_0x4e4571,'id');}catch(_0x326d23){throw _0x326d23;}}exports[_0x52ff('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2e6c9a,_0x50fd8b,_0x320c07){return Promise[_0x52ff('0x2f')]()['then'](function(){if(_0x50fd8b[_0x52ff('0xb')]>0x0){_0x2e6c9a=_0x2e6c9a[_0x52ff('0xa')](function(_0xef339d){return _0x50fd8b[_0x52ff('0x2d')](_0xef339d['id']);});}return _0x2e6c9a;})['then'](function(){return db[_0x52ff('0x30')][_0x52ff('0x31')]({'attributes':['id','name',_0x52ff('0x32'),_0x52ff('0x33'),_0x52ff('0x4'),_0x52ff('0x5'),'openchannelPause',_0x52ff('0x34'),'voicePause',_0x52ff('0x8'),_0x52ff('0x35')],'where':{'id':{'$in':_['map'](_0x2e6c9a,'id')}},'raw':!![]});})[_0x52ff('0x1d')](function(_0x10cfdd){return _0x10cfdd[_0x52ff('0x27')](function(_0x5e5ac1){var _0x4f3d97=_[_0x52ff('0x36')](_0x2e6c9a,['id',_0x5e5ac1['id']]);var _0x4b72cd=filterAgentAttributes(_0x4f3d97);_[_0x52ff('0x1f')](_0x5e5ac1,_0x4b72cd);_0x5e5ac1['globalStatus']=getAgentStatus(_0x5e5ac1);return _0x5e5ac1;});})[_0x52ff('0x1d')](function(_0x2a5653){var _0x59643f=sortAgentsByStatus(_0x2a5653,_0x320c07);return _[_0x52ff('0x27')](_0x59643f,'id');})[_0x52ff('0x20')](function(_0x2b38b7){throw _0x2b38b7;});}exports[_0x52ff('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xcb5b6c){var _0x3dc9bb={'fields':[],'order':null};var _0x45d059=_0xcb5b6c['split'](',');_0x3dc9bb[_0x52ff('0x38')]=_[_0x52ff('0xa')](_0x45d059,function(_0x422c95){if(!_0x422c95[_0x52ff('0x2d')](_0x52ff('0x39'))){return!![];}_0x3dc9bb[_0x52ff('0x3a')]=_[_0x52ff('0x3b')](_0x422c95,'-')?'DESC':_0x52ff('0x3c');return![];});return _0x3dc9bb;}exports[_0x52ff('0x3d')]=getUpdatedSortOptions;function validateSortParameter(_0xf2f766){if(!_0xf2f766){_0xf2f766='fullname,internal';}if(_0xf2f766['includes'](_0x52ff('0x32'))&&!_0xf2f766['includes'](_0x52ff('0x3e'))){var _0xbbfef8=_0xf2f766[_0x52ff('0x3f')](0x0,_0xf2f766[_0x52ff('0x40')](_0x52ff('0x32')));_0xf2f766+=','+_0xbbfef8+_0x52ff('0x3e');}return _0xf2f766;}exports[_0x52ff('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x18a780,_0x379684){var _0x501a2f=_0x18a780[_0x52ff('0x42')](function(_0x1cf8ee,_0x5a5c37){if(_0x1cf8ee[_0x52ff('0x39')]===_0x5a5c37[_0x52ff('0x39')]){if(_0x1cf8ee[_0x52ff('0x39')]===_0x52ff('0x11')){if(_0x379684===_0x52ff('0x43')){return(_0x1cf8ee[_0x52ff('0x35')]||'')<(_0x5a5c37[_0x52ff('0x35')]||'')||_0x1cf8ee['fullname'][_0x52ff('0x44')]()>_0x5a5c37[_0x52ff('0x32')][_0x52ff('0x44')]()?0x1:-0x1;}else{return(_0x1cf8ee[_0x52ff('0x35')]||'')<(_0x5a5c37['pauseType']||'')||_0x1cf8ee['fullname'][_0x52ff('0x44')]()>_0x5a5c37[_0x52ff('0x32')][_0x52ff('0x44')]()?-0x1:0x1;}}else{if(_0x379684===_0x52ff('0x43')){return _0x1cf8ee[_0x52ff('0x32')]['toLowerCase']()<_0x5a5c37[_0x52ff('0x32')][_0x52ff('0x44')]()?0x1:-0x1;}else{return _0x1cf8ee[_0x52ff('0x32')][_0x52ff('0x44')]()<_0x5a5c37[_0x52ff('0x32')][_0x52ff('0x44')]()?-0x1:0x1;}}}else{if(_0x379684===_0x52ff('0x43')){return _0x1cf8ee[_0x52ff('0x39')]<_0x5a5c37[_0x52ff('0x39')]?0x1:-0x1;}else{return _0x1cf8ee[_0x52ff('0x39')]<_0x5a5c37['globalStatus']?-0x1:0x1;}}});return _0x501a2f;}exports[_0x52ff('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0xdcb5d){var _0x41930f=[_0x52ff('0x46'),_0x52ff('0x47'),'lastLoginAt',_0x52ff('0x48'),_0x52ff('0x35'),'lastPauseAt',_0x52ff('0x3e'),_0x52ff('0x49'),_0x52ff('0x33'),_0x52ff('0x6'),'mailPause','smsPause',_0x52ff('0x8'),_0x52ff('0x4'),_0x52ff('0x7'),_0x52ff('0x4a'),_0x52ff('0x4b'),_0x52ff('0x4c'),_0x52ff('0x4d'),'whatsappCapacity','faxCapacity',_0x52ff('0x4e'),_0x52ff('0x4f'),_0x52ff('0x50'),_0x52ff('0x51'),_0x52ff('0x52'),_0x52ff('0x53'),_0x52ff('0x12'),_0x52ff('0x14'),_0x52ff('0x54'),'smsStatus',_0x52ff('0x17'),_0x52ff('0x13'),_0x52ff('0x16'),_0x52ff('0x55'),_0x52ff('0x56'),'mailStatusTime',_0x52ff('0x57'),_0x52ff('0x58'),_0x52ff('0x59'),_0x52ff('0x5a'),'queue',_0x52ff('0x5b'),_0x52ff('0x5c'),_0x52ff('0x5d'),_0x52ff('0x5e')];var _0x4479c1=[_0x52ff('0x33'),'openchannelPause',_0x52ff('0x5'),'smsPause',_0x52ff('0x8'),_0x52ff('0x4'),_0x52ff('0x7'),_0x52ff('0x47')];var _0x4a1e3c=_(_0xdcb5d)[_0x52ff('0x5f')](_0x4479c1)['pick'](_0x41930f)[_0x52ff('0x2b')]();return _0x4a1e3c;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x52ff('0x32'),_0x52ff('0x60'),'internal',_0x52ff('0x47'),'globalStatus',_0x52ff('0x46'),'lastLoginAt',_0x52ff('0x35'),_0x52ff('0x48'),_0x52ff('0x4'),_0x52ff('0x33'),'mailPause',_0x52ff('0x6'),_0x52ff('0x34'),_0x52ff('0x7'),_0x52ff('0x8'),_0x52ff('0x12'),_0x52ff('0x13'),_0x52ff('0x54'),'openchannelStatus','smsStatus','voiceStatus','whatsappStatus',_0x52ff('0x55'),_0x52ff('0x59'),_0x52ff('0x61'),_0x52ff('0x56'),_0x52ff('0x57'),_0x52ff('0x5a'),'whatsappStatusTime',_0x52ff('0x4a'),_0x52ff('0x62'),_0x52ff('0x4c'),_0x52ff('0x4b'),_0x52ff('0x4d'),_0x52ff('0x63'),'chatCurrentCapacity',_0x52ff('0x53'),_0x52ff('0x50'),_0x52ff('0x4f'),_0x52ff('0x51'),_0x52ff('0x52'),_0x52ff('0x5d'),_0x52ff('0x5e'),_0x52ff('0x5b'),_0x52ff('0x64'),_0x52ff('0x65'),_0x52ff('0x5c')];}exports[_0x52ff('0x66')]=getRealtimeAgentsQueryFields;
\ No newline at end of file