Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / api / voicePrefix / voicePrefix.controller.js
index 3b12aa7..0b0d728 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb38d=['merge','options','VoicePrefix','includeAll','findAll','rows','catch','show','rawAttributes','find','params','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voicePrefix.socket','register','status','end','json','count','offset','set','apply','update','destroy','get','VoicePrefixes','UserProfileResource','then','sendStatus','error','stack','name','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xb38d,0xaf));var _0xdb38=function(_0xfa34aa,_0x1aa9b2){_0xfa34aa=_0xfa34aa-0x0;var _0x469987=_0xb38d[_0xfa34aa];return _0x469987;};'use strict';var pdf=require(_0xdb38('0x0'));var emlformat=require(_0xdb38('0x1'));var rimraf=require(_0xdb38('0x2'));var zipdir=require(_0xdb38('0x3'));var jsonpatch=require(_0xdb38('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb38('0x5'));var Mustache=require(_0xdb38('0x6'));var util=require(_0xdb38('0x7'));var path=require(_0xdb38('0x8'));var sox=require(_0xdb38('0x9'));var csv=require(_0xdb38('0xa'));var ejs=require(_0xdb38('0xb'));var fs=require('fs');var _=require(_0xdb38('0xc'));var squel=require('squel');var crypto=require(_0xdb38('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdb38('0xe'));var toCsv=require(_0xdb38('0xa'));var querystring=require(_0xdb38('0xf'));var Papa=require('papaparse');var Redis=require(_0xdb38('0x10'));var authService=require(_0xdb38('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdb38('0x12'));var hardwareService=require(_0xdb38('0x13'));var logger=require(_0xdb38('0x14'))(_0xdb38('0x15'));var utils=require('../../config/utils');var config=require(_0xdb38('0x16'));var db=require('../../mysqldb')['db'];config[_0xdb38('0x17')]=_['defaults'](config[_0xdb38('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb38('0x18'))(new Redis(config['redis']));require(_0xdb38('0x19'))[_0xdb38('0x1a')](socket);function respondWithStatusCode(_0x1967b9,_0x49fd30){_0x49fd30=_0x49fd30||0xcc;return function(_0x570267){if(_0x570267){return _0x1967b9['sendStatus'](_0x49fd30);}return _0x1967b9[_0xdb38('0x1b')](_0x49fd30)[_0xdb38('0x1c')]();};}function respondWithResult(_0x528642,_0x2cf862){_0x2cf862=_0x2cf862||0xc8;return function(_0x3f2367){if(_0x3f2367){return _0x528642[_0xdb38('0x1b')](_0x2cf862)[_0xdb38('0x1d')](_0x3f2367);}};}function respondWithFilteredResult(_0xd32ab9,_0x32233f){return function(_0x47f09e){if(_0x47f09e){var _0x36da51=_0x47f09e[_0xdb38('0x1e')],_0x6b5c8d=_0x32233f[_0xdb38('0x1f')],_0xbd2076=_0x32233f[_0xdb38('0x1f')]+_0x32233f['limit'],_0x2eb66a;if(_0xbd2076>=_0x36da51){_0xbd2076=_0x36da51;_0x2eb66a=0xc8;}else{_0x2eb66a=0xce;}_0xd32ab9['status'](_0x2eb66a);return _0xd32ab9[_0xdb38('0x20')]('Content-Range',_0x6b5c8d+'-'+_0xbd2076+'/'+_0x36da51)['json'](_0x47f09e);}return null;};}function patchUpdates(_0x379c3c){return function(_0x3f998c){try{jsonpatch[_0xdb38('0x21')](_0x3f998c,_0x379c3c,!![]);}catch(_0x2fd08b){return BPromise['reject'](_0x2fd08b);}return _0x3f998c['save']();};}function saveUpdates(_0x3e8ac7,_0x252c39){return function(_0x4beafe){if(_0x4beafe){return _0x4beafe[_0xdb38('0x22')](_0x3e8ac7)['then'](function(_0x113438){return _0x113438;});}return null;};}function removeEntity(_0x4f7251,_0x5ecbb0){return function(_0x8a9d44){if(_0x8a9d44){return _0x8a9d44[_0xdb38('0x23')]()['then'](function(){var _0x12d265=_0x8a9d44[_0xdb38('0x24')]({'plain':!![]});var _0x3a285f=_0xdb38('0x25');return db[_0xdb38('0x26')][_0xdb38('0x23')]({'where':{'type':_0x3a285f,'resourceId':_0x12d265['id']}})[_0xdb38('0x27')](function(){return _0x8a9d44;});})[_0xdb38('0x27')](function(){_0x4f7251['status'](0xcc)[_0xdb38('0x1c')]();});}};}function handleEntityNotFound(_0x22635c,_0x3c09aa){return function(_0x322e9b){if(!_0x322e9b){_0x22635c[_0xdb38('0x28')](0x194);}return _0x322e9b;};}function handleError(_0x2dc019,_0x16bd5d){_0x16bd5d=_0x16bd5d||0x1f4;return function(_0x4779ad){logger[_0xdb38('0x29')](_0x4779ad[_0xdb38('0x2a')]);if(_0x4779ad[_0xdb38('0x2b')]){delete _0x4779ad[_0xdb38('0x2b')];}_0x2dc019[_0xdb38('0x1b')](_0x16bd5d)['send'](_0x4779ad);};}exports[_0xdb38('0x2c')]=function(_0x14580e,_0x3a3a59){var _0x3b3ae2={},_0x4b66d5={},_0x2731b4={'count':0x0,'rows':[]};var _0x11b63b=_[_0xdb38('0x2d')](db['VoicePrefix']['rawAttributes'],function(_0x59771f){return{'name':_0x59771f[_0xdb38('0x2e')],'type':_0x59771f['type'][_0xdb38('0x2f')]};});_0x4b66d5[_0xdb38('0x30')]=_['map'](_0x11b63b,_0xdb38('0x2b'));_0x4b66d5[_0xdb38('0x31')]=_[_0xdb38('0x32')](_0x14580e['query']);_0x4b66d5['filters']=_[_0xdb38('0x33')](_0x4b66d5['model'],_0x4b66d5[_0xdb38('0x31')]);_0x3b3ae2[_0xdb38('0x34')]=_['intersection'](_0x4b66d5['model'],qs[_0xdb38('0x35')](_0x14580e[_0xdb38('0x31')][_0xdb38('0x35')]));_0x3b3ae2['attributes']=_0x3b3ae2[_0xdb38('0x34')][_0xdb38('0x36')]?_0x3b3ae2[_0xdb38('0x34')]:_0x4b66d5['model'];if(!_0x14580e['query']['hasOwnProperty']('nolimit')){_0x3b3ae2['limit']=qs[_0xdb38('0x37')](_0x14580e[_0xdb38('0x31')][_0xdb38('0x37')]);_0x3b3ae2[_0xdb38('0x1f')]=qs[_0xdb38('0x1f')](_0x14580e['query'][_0xdb38('0x1f')]);}_0x3b3ae2[_0xdb38('0x38')]=qs[_0xdb38('0x39')](_0x14580e[_0xdb38('0x31')]['sort']);_0x3b3ae2[_0xdb38('0x3a')]=qs[_0xdb38('0x3b')](_[_0xdb38('0x3c')](_0x14580e[_0xdb38('0x31')],_0x4b66d5[_0xdb38('0x3b')]),_0x11b63b);if(_0x14580e[_0xdb38('0x31')][_0xdb38('0x3d')]){_0x3b3ae2['where']=_['merge'](_0x3b3ae2[_0xdb38('0x3a')],{'$or':_[_0xdb38('0x2d')](_0x11b63b,function(_0x65a384){if(_0x65a384['type']!==_0xdb38('0x3e')){var _0x1608dc={};_0x1608dc[_0x65a384['name']]={'$like':'%'+_0x14580e[_0xdb38('0x31')][_0xdb38('0x3d')]+'%'};return _0x1608dc;}})});}_0x3b3ae2=_[_0xdb38('0x3f')]({},_0x3b3ae2,_0x14580e[_0xdb38('0x40')]);var _0x580703={'where':_0x3b3ae2[_0xdb38('0x3a')]};return db[_0xdb38('0x41')][_0xdb38('0x1e')](_0x580703)[_0xdb38('0x27')](function(_0x313eab){_0x2731b4[_0xdb38('0x1e')]=_0x313eab;if(_0x14580e[_0xdb38('0x31')][_0xdb38('0x42')]){_0x3b3ae2['include']=[{'all':!![]}];}return db[_0xdb38('0x41')][_0xdb38('0x43')](_0x3b3ae2);})[_0xdb38('0x27')](function(_0x1207ce){_0x2731b4[_0xdb38('0x44')]=_0x1207ce;return _0x2731b4;})[_0xdb38('0x27')](respondWithFilteredResult(_0x3a3a59,_0x3b3ae2))[_0xdb38('0x45')](handleError(_0x3a3a59,null));};exports[_0xdb38('0x46')]=function(_0x4eb5e1,_0x26db22){var _0x23751b={'raw':![],'where':{'id':_0x4eb5e1['params']['id']}},_0x32020f={};_0x32020f[_0xdb38('0x30')]=_[_0xdb38('0x32')](db[_0xdb38('0x41')][_0xdb38('0x47')]);_0x32020f[_0xdb38('0x31')]=_['keys'](_0x4eb5e1['query']);_0x32020f[_0xdb38('0x3b')]=_[_0xdb38('0x33')](_0x32020f[_0xdb38('0x30')],_0x32020f[_0xdb38('0x31')]);_0x23751b[_0xdb38('0x34')]=_[_0xdb38('0x33')](_0x32020f[_0xdb38('0x30')],qs[_0xdb38('0x35')](_0x4eb5e1[_0xdb38('0x31')][_0xdb38('0x35')]));_0x23751b[_0xdb38('0x34')]=_0x23751b[_0xdb38('0x34')][_0xdb38('0x36')]?_0x23751b[_0xdb38('0x34')]:_0x32020f['model'];if(_0x4eb5e1[_0xdb38('0x31')]['includeAll']){_0x23751b['include']=[{'all':!![]}];}_0x23751b=_[_0xdb38('0x3f')]({},_0x23751b,_0x4eb5e1[_0xdb38('0x40')]);return db['VoicePrefix']['find'](_0x23751b)[_0xdb38('0x27')](handleEntityNotFound(_0x26db22,null))[_0xdb38('0x27')](respondWithResult(_0x26db22,null))[_0xdb38('0x45')](handleError(_0x26db22,null));};exports[_0xdb38('0x23')]=function(_0x3721fe,_0x3b96cd){return db[_0xdb38('0x41')][_0xdb38('0x48')]({'where':{'id':_0x3721fe[_0xdb38('0x49')]['id']}})[_0xdb38('0x27')](handleEntityNotFound(_0x3b96cd,null))['then'](removeEntity(_0x3b96cd,null))[_0xdb38('0x45')](handleError(_0x3b96cd,null));};exports[_0xdb38('0x4a')]=function(_0x4f7cd7,_0x532fc4){return db[_0xdb38('0x41')]['describe']()[_0xdb38('0x27')](respondWithResult(_0x532fc4,null))[_0xdb38('0x45')](handleError(_0x532fc4,null));};exports['create']=function(_0x1aa76b,_0x34bcee){var _0x581c26;return db[_0xdb38('0x4b')]['transaction'](function(_0xc4f123){return db[_0xdb38('0x41')][_0xdb38('0x4c')](_0x1aa76b[_0xdb38('0x4d')],{'transaction':_0xc4f123})[_0xdb38('0x27')](function(_0x4fb0f2){_0x581c26=_0x4fb0f2[_0xdb38('0x24')]({'plain':!![]});return db[_0xdb38('0x4e')][_0xdb38('0x48')]({'where':{'id':_0x581c26[_0xdb38('0x4f')]},'raw':!![]})[_0xdb38('0x27')](function(_0x3477b8){return createVoicePrefixExtensions(_0x581c26,_0x3477b8,_0xc4f123);});});})['then'](function(){var _0x50e868=_0x1aa76b['user']['get']({'plain':!![]});if(!_0x50e868)throw new Error(_0xdb38('0x50'));if(_0x50e868['role']===_0xdb38('0x51')){var _0x4f75ed=_0x581c26;return db[_0xdb38('0x52')]['find']({'where':{'name':_0xdb38('0x25'),'userProfileId':_0x50e868[_0xdb38('0x53')]},'raw':!![]})[_0xdb38('0x27')](function(_0x9d3980){if(_0x9d3980&&_0x9d3980['autoAssociation']===0x0){return db[_0xdb38('0x26')][_0xdb38('0x4c')]({'name':_0x4f75ed[_0xdb38('0x2b')],'resourceId':_0x4f75ed['id'],'type':_0x9d3980[_0xdb38('0x2b')],'sectionId':_0x9d3980['id']},{})['then'](function(){return _0x581c26;});}else{return _0x581c26;}})[_0xdb38('0x45')](function(_0x1b9a4c){logger[_0xdb38('0x29')](_0xdb38('0x54'),_0x1b9a4c);throw _0x1b9a4c;});}return _0x581c26;})['then'](respondWithResult(_0x34bcee,null))['catch'](handleError(_0x34bcee,null));};function Extension(_0x33a72f,_0x3a4770,_0x3fb1ea,_0x405051){this[_0xdb38('0x55')]=_0xdb38('0x56');this['exten']=_0x33a72f;this[_0xdb38('0x57')]=_0x3fb1ea;this['type']=_0xdb38('0x58');this[_0xdb38('0x59')]='Voice\x20Prefix\x20Extension';this[_0xdb38('0x5a')]=_0x3a4770;this[_0xdb38('0x5b')]=_0x405051;}function createVoicePrefixExtensions(_0x4b1469,_0x160097,_0xb0bd9b){return new BPromise(function(_0x48d399,_0x234321){var _0x590ec5=new Extension(formatPrefixName(_0x4b1469[_0xdb38('0x5c')]),0x1,_0xdb38('0x5d'),_0xdb38('0x5e'));_0x590ec5['VoicePrefixId']=_0x4b1469['id'];return db['VoiceExtension'][_0xdb38('0x4c')](_0x590ec5,{'transaction':_0xb0bd9b})[_0xdb38('0x27')](function(_0x32be5b){var _0x1af9ba=_0x32be5b[_0xdb38('0x24')]({'plain':!![]});var _0x4b1e88=_['map'](addVoicePrefixExtensions(_0x4b1469,_0x160097),function(_0xa7c38b){_0xa7c38b[_0xdb38('0x4f')]=_0x1af9ba['id'];_0xa7c38b['VoicePrefixId']=_0x4b1469['id'];return _0xa7c38b;});return db[_0xdb38('0x4e')][_0xdb38('0x5f')](_0x4b1e88,{'transaction':_0xb0bd9b})[_0xdb38('0x27')](function(_0x264b15){if(!_0x264b15){return _0x234321(_0xdb38('0x60'));}else{return _0x48d399(_0x264b15);}})[_0xdb38('0x45')](function(_0x173d4f){return _0x234321(_0x173d4f);});});;});};function addVoicePrefixExtensions(_0x263232,_0x29d0a2){var _0x335da0=[];var _0x1ed017=formatPrefixName(_0x263232[_0xdb38('0x5c')]);_0x335da0[_0xdb38('0x61')](new Extension(_0x1ed017,0x2,_0xdb38('0x62'),_0xdb38('0x63')+_0x263232[_0xdb38('0x2b')]));if(_0x263232['callerIdAll']){_0x335da0['push'](new Extension(_0x1ed017,0x3,_0xdb38('0x62'),_0xdb38('0x64')+_0x263232[_0xdb38('0x65')]));}else{_0x335da0[_0xdb38('0x61')](new Extension(_0x1ed017,0x3,_0xdb38('0x5d'),_0xdb38('0x66')));}_0x335da0[_0xdb38('0x61')](new Extension(_0x1ed017,0x4,'goto',_0x29d0a2[_0xdb38('0x55')]+','+_0xdb38('0x67')+(0x8+_0x263232[_0xdb38('0x2b')][_0xdb38('0x36')])+'}'+','+0x1));return _0x335da0;}function formatPrefixName(_0x37c28e){var _0x5c82cd='_';for(var _0x5487c8=0x0;_0x5487c8<_0x37c28e[_0xdb38('0x36')];_0x5487c8++){if(_0x37c28e[_0xdb38('0x68')](_0x5487c8)=='-'){_0x5c82cd+=_0x37c28e['charAt'](_0x5487c8);}else{_0x5c82cd+='['+_0x37c28e['charAt'](_0x5487c8)+']';}}_0x5c82cd+='.';return _0x5c82cd;}exports['update']=function(_0x17ecf4,_0xa6f688,_0x5d147d){var _0xb52dcc=_0x17ecf4[_0xdb38('0x4d')];_0xb52dcc[_0xdb38('0x5c')]='system-'+_0xb52dcc[_0xdb38('0x2b')]+'-';return db[_0xdb38('0x4b')][_0xdb38('0x69')](function(_0x9f9dc3){return db[_0xdb38('0x41')][_0xdb38('0x22')](_0xb52dcc,{'where':{'id':_0xb52dcc['id']},'transaction':_0x9f9dc3})['then'](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0xb52dcc['id']},'transaction':_0x9f9dc3})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0xb52dcc[_0xdb38('0x4f')]},'raw':!![]})['then'](function(_0xfad668){return createVoicePrefixExtensions(_0xb52dcc,_0xfad668,_0x9f9dc3);});});});})[_0xdb38('0x27')](function(){return db['VoicePrefix'][_0xdb38('0x6a')](_0xb52dcc['id']);})[_0xdb38('0x27')](respondWithResult(_0xa6f688,null))[_0xdb38('0x45')](handleError(_0xa6f688,null));};exports['addAgents']=function(_0xd8a1e0,_0x437515,_0x22370b){return db[_0xdb38('0x41')][_0xdb38('0x48')]({'where':{'id':_0xd8a1e0[_0xdb38('0x49')]['id']}})[_0xdb38('0x27')](handleEntityNotFound(_0x437515,null))[_0xdb38('0x27')](function(_0x47ce5a){if(_0x47ce5a){return _0x47ce5a[_0xdb38('0x6b')](_0xd8a1e0[_0xdb38('0x4d')][_0xdb38('0x6c')],_[_0xdb38('0x6d')](_0xd8a1e0[_0xdb38('0x4d')],[_0xdb38('0x6c'),'id'])||{})['spread'](function(_0x127fc7){for(var _0xe3bdb7=0x0;_0xe3bdb7<_0xd8a1e0['body']['ids']['length'];_0xe3bdb7+=0x1){socket[_0xdb38('0x6e')](_0xdb38('0x6f'),{'UserId':_0xd8a1e0['body'][_0xdb38('0x6c')][_0xe3bdb7],'VoicePrefixId':_0xd8a1e0[_0xdb38('0x49')]['id']});}return _0x127fc7;});}})[_0xdb38('0x27')](respondWithResult(_0x437515,null))[_0xdb38('0x45')](handleError(_0x437515,null));};exports[_0xdb38('0x70')]=function(_0x2c9386,_0x570c33,_0x1147cd){return db[_0xdb38('0x41')][_0xdb38('0x48')]({'where':{'id':_0x2c9386[_0xdb38('0x49')]['id']}})[_0xdb38('0x27')](handleEntityNotFound(_0x570c33,null))['then'](function(_0xd7c4dc){if(_0xd7c4dc){return _0xd7c4dc[_0xdb38('0x70')](_0x2c9386[_0xdb38('0x31')][_0xdb38('0x6c')])[_0xdb38('0x27')](function(){if(_[_0xdb38('0x71')](_0x2c9386[_0xdb38('0x31')][_0xdb38('0x6c')])){for(var _0x1a18c7=0x0;_0x1a18c7<_0x2c9386[_0xdb38('0x31')][_0xdb38('0x6c')][_0xdb38('0x36')];_0x1a18c7+=0x1){socket[_0xdb38('0x6e')]('userVoicePrefix:remove',{'UserId':Number(_0x2c9386['query']['ids'][_0x1a18c7]),'VoicePrefixId':Number(_0x2c9386[_0xdb38('0x49')]['id'])});}}else{socket[_0xdb38('0x6e')](_0xdb38('0x72'),{'UserId':Number(_0x2c9386['query'][_0xdb38('0x6c')]),'VoicePrefixId':Number(_0x2c9386['params']['id'])});}});}})[_0xdb38('0x27')](respondWithStatusCode(_0x570c33,null))[_0xdb38('0x45')](handleError(_0x570c33,null));};exports[_0xdb38('0x73')]=function(_0x2bf457,_0x4e8d30,_0x257f9e){var _0x1d33b6={};var _0x41d24f={};var _0x3c251d;var _0x11ef89;return db[_0xdb38('0x41')][_0xdb38('0x74')]({'where':{'id':_0x2bf457['params']['id']}})['then'](handleEntityNotFound(_0x4e8d30,null))[_0xdb38('0x27')](function(_0x451f5a){if(_0x451f5a){_0x3c251d=_0x451f5a;_0x41d24f[_0xdb38('0x30')]=_[_0xdb38('0x32')](db['User'][_0xdb38('0x47')]);_0x41d24f[_0xdb38('0x31')]=_[_0xdb38('0x32')](_0x2bf457[_0xdb38('0x31')]);_0x41d24f[_0xdb38('0x3b')]=_[_0xdb38('0x33')](_0x41d24f[_0xdb38('0x30')],_0x41d24f[_0xdb38('0x31')]);_0x1d33b6[_0xdb38('0x34')]=_[_0xdb38('0x33')](_0x41d24f[_0xdb38('0x30')],qs['fields'](_0x2bf457[_0xdb38('0x31')][_0xdb38('0x35')]));_0x1d33b6['attributes']=_0x1d33b6[_0xdb38('0x34')]['length']?_0x1d33b6['attributes']:_0x41d24f[_0xdb38('0x30')];_0x1d33b6[_0xdb38('0x38')]=qs[_0xdb38('0x39')](_0x2bf457[_0xdb38('0x31')][_0xdb38('0x39')]);_0x1d33b6[_0xdb38('0x3a')]=qs['filters'](_[_0xdb38('0x3c')](_0x2bf457[_0xdb38('0x31')],_0x41d24f[_0xdb38('0x3b')]));if(_0x2bf457[_0xdb38('0x31')][_0xdb38('0x3d')]){_0x1d33b6[_0xdb38('0x3a')]=_[_0xdb38('0x3f')](_0x1d33b6[_0xdb38('0x3a')],{'$or':_['map'](_0x1d33b6[_0xdb38('0x34')],function(_0x30218f){var _0x5a040f={};_0x5a040f[_0x30218f]={'$like':'%'+_0x2bf457[_0xdb38('0x31')]['filter']+'%'};return _0x5a040f;})});}_0x1d33b6=_[_0xdb38('0x3f')]({},_0x1d33b6,_0x2bf457[_0xdb38('0x40')]);return _0x3c251d[_0xdb38('0x73')](_0x1d33b6);}})['then'](function(_0x357939){if(_0x357939){_0x11ef89=_0x357939['length'];if(!_0x2bf457[_0xdb38('0x31')][_0xdb38('0x75')](_0xdb38('0x76'))){_0x1d33b6[_0xdb38('0x37')]=qs[_0xdb38('0x37')](_0x2bf457[_0xdb38('0x31')][_0xdb38('0x37')]);_0x1d33b6['offset']=qs['offset'](_0x2bf457[_0xdb38('0x31')][_0xdb38('0x1f')]);}return _0x3c251d['getAgents'](_0x1d33b6);}})[_0xdb38('0x27')](function(_0x383cf8){if(_0x383cf8){return _0x383cf8?{'count':_0x11ef89,'rows':_0x383cf8}:null;}})[_0xdb38('0x27')](respondWithResult(_0x4e8d30,null))[_0xdb38('0x45')](handleError(_0x4e8d30,null));};
\ No newline at end of file
+var _0x2dc3=['params','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','context','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','VoicePrefixes','end','error','stack','name','VoicePrefix','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','length','find','catch'];(function(_0x47a5c4,_0x2f3f64){var _0x276083=function(_0x3bcf79){while(--_0x3bcf79){_0x47a5c4['push'](_0x47a5c4['shift']());}};_0x276083(++_0x2f3f64);}(_0x2dc3,0x127));var _0x32dc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2dc3[_0x6c993a];return _0x27f547;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32dc('0x0'));var rimraf=require(_0x32dc('0x1'));var zipdir=require(_0x32dc('0x2'));var jsonpatch=require(_0x32dc('0x3'));var rp=require(_0x32dc('0x4'));var moment=require(_0x32dc('0x5'));var BPromise=require(_0x32dc('0x6'));var Mustache=require(_0x32dc('0x7'));var util=require('util');var path=require('path');var sox=require(_0x32dc('0x8'));var csv=require('to-csv');var ejs=require(_0x32dc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x32dc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32dc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x32dc('0xc'));var Papa=require(_0x32dc('0xd'));var Redis=require(_0x32dc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x32dc('0xf'));var hardwareService=require(_0x32dc('0x10'));var logger=require(_0x32dc('0x11'))(_0x32dc('0x12'));var utils=require(_0x32dc('0x13'));var config=require(_0x32dc('0x14'));var licenseUtil=require(_0x32dc('0x15'));var db=require('../../mysqldb')['db'];config[_0x32dc('0x16')]=_['defaults'](config[_0x32dc('0x16')],{'host':_0x32dc('0x17'),'port':0x18eb});var socket=require(_0x32dc('0x18'))(new Redis(config['redis']));require(_0x32dc('0x19'))[_0x32dc('0x1a')](socket);function respondWithStatusCode(_0x5e373a,_0x1fb775){_0x1fb775=_0x1fb775||0xcc;return function(_0x4bf4ca){if(_0x4bf4ca){return _0x5e373a[_0x32dc('0x1b')](_0x1fb775);}return _0x5e373a['status'](_0x1fb775)['end']();};}function respondWithResult(_0x497b11,_0x2e1a9d){_0x2e1a9d=_0x2e1a9d||0xc8;return function(_0x328940){if(_0x328940){return _0x497b11[_0x32dc('0x1c')](_0x2e1a9d)['json'](_0x328940);}};}function respondWithFilteredResult(_0x284dfe,_0x32d0d1){return function(_0x38064a){if(_0x38064a){var _0x47ccb4=_0x38064a[_0x32dc('0x1d')],_0x36e287=_0x32d0d1['offset'],_0x36389b=_0x32d0d1[_0x32dc('0x1e')]+_0x32d0d1[_0x32dc('0x1f')],_0x2671b1;if(_0x36389b>=_0x47ccb4){_0x36389b=_0x47ccb4;_0x2671b1=0xc8;}else{_0x2671b1=0xce;}_0x284dfe[_0x32dc('0x1c')](_0x2671b1);return _0x284dfe[_0x32dc('0x20')](_0x32dc('0x21'),_0x36e287+'-'+_0x36389b+'/'+_0x47ccb4)[_0x32dc('0x22')](_0x38064a);}return null;};}function patchUpdates(_0x43b18c){return function(_0x33eae0){try{jsonpatch['apply'](_0x33eae0,_0x43b18c,!![]);}catch(_0x227563){return BPromise[_0x32dc('0x23')](_0x227563);}return _0x33eae0[_0x32dc('0x24')]();};}function saveUpdates(_0x2a4bf9,_0x5ed495){return function(_0xa5c303){if(_0xa5c303){return _0xa5c303[_0x32dc('0x25')](_0x2a4bf9)[_0x32dc('0x26')](function(_0x39182b){return _0x39182b;});}return null;};}function removeEntity(_0x57e1e3,_0x36a190){return function(_0x18fc9c){if(_0x18fc9c){return _0x18fc9c[_0x32dc('0x27')]()['then'](function(){var _0x51af54=_0x18fc9c[_0x32dc('0x28')]({'plain':!![]});var _0x4a0e6e=_0x32dc('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x4a0e6e,'resourceId':_0x51af54['id']}})['then'](function(){return _0x18fc9c;});})[_0x32dc('0x26')](function(){_0x57e1e3['status'](0xcc)[_0x32dc('0x2a')]();});}};}function handleEntityNotFound(_0x26e348,_0x58a46c){return function(_0x2cbe2a){if(!_0x2cbe2a){_0x26e348[_0x32dc('0x1b')](0x194);}return _0x2cbe2a;};}function handleError(_0x28beb9,_0xa37191){_0xa37191=_0xa37191||0x1f4;return function(_0x287bb2){logger[_0x32dc('0x2b')](_0x287bb2[_0x32dc('0x2c')]);if(_0x287bb2['name']){delete _0x287bb2[_0x32dc('0x2d')];}_0x28beb9[_0x32dc('0x1c')](_0xa37191)['send'](_0x287bb2);};}exports['index']=function(_0x2e240f,_0x51e50c){var _0x46a526={},_0x5b9c3a={},_0x1c90dc={'count':0x0,'rows':[]};var _0x1e5e51=_['map'](db[_0x32dc('0x2e')][_0x32dc('0x2f')],function(_0x1ec064){return{'name':_0x1ec064['fieldName'],'type':_0x1ec064[_0x32dc('0x30')][_0x32dc('0x31')]};});_0x5b9c3a[_0x32dc('0x32')]=_[_0x32dc('0x33')](_0x1e5e51,_0x32dc('0x2d'));_0x5b9c3a[_0x32dc('0x34')]=_[_0x32dc('0x35')](_0x2e240f[_0x32dc('0x34')]);_0x5b9c3a[_0x32dc('0x36')]=_[_0x32dc('0x37')](_0x5b9c3a['model'],_0x5b9c3a[_0x32dc('0x34')]);_0x46a526[_0x32dc('0x38')]=_[_0x32dc('0x37')](_0x5b9c3a[_0x32dc('0x32')],qs[_0x32dc('0x39')](_0x2e240f['query'][_0x32dc('0x39')]));_0x46a526['attributes']=_0x46a526[_0x32dc('0x38')]['length']?_0x46a526[_0x32dc('0x38')]:_0x5b9c3a['model'];if(!_0x2e240f['query'][_0x32dc('0x3a')](_0x32dc('0x3b'))){_0x46a526[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x2e240f['query'][_0x32dc('0x1f')]);_0x46a526[_0x32dc('0x1e')]=qs[_0x32dc('0x1e')](_0x2e240f[_0x32dc('0x34')]['offset']);}_0x46a526[_0x32dc('0x3c')]=qs[_0x32dc('0x3d')](_0x2e240f[_0x32dc('0x34')][_0x32dc('0x3d')]);_0x46a526[_0x32dc('0x3e')]=qs['filters'](_['pick'](_0x2e240f['query'],_0x5b9c3a['filters']),_0x1e5e51);if(_0x2e240f['query'][_0x32dc('0x3f')]){_0x46a526[_0x32dc('0x3e')]=_['merge'](_0x46a526[_0x32dc('0x3e')],{'$or':_[_0x32dc('0x33')](_0x1e5e51,function(_0x515709){if(_0x515709[_0x32dc('0x30')]!==_0x32dc('0x40')){var _0x15c217={};_0x15c217[_0x515709['name']]={'$like':'%'+_0x2e240f['query'][_0x32dc('0x3f')]+'%'};return _0x15c217;}})});}_0x46a526=_[_0x32dc('0x41')]({},_0x46a526,_0x2e240f[_0x32dc('0x42')]);var _0x405dbc={'where':_0x46a526[_0x32dc('0x3e')]};return db[_0x32dc('0x2e')][_0x32dc('0x1d')](_0x405dbc)[_0x32dc('0x26')](function(_0x12c093){_0x1c90dc[_0x32dc('0x1d')]=_0x12c093;if(_0x2e240f[_0x32dc('0x34')][_0x32dc('0x43')]){_0x46a526[_0x32dc('0x44')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x46a526);})[_0x32dc('0x26')](function(_0x2bf523){_0x1c90dc[_0x32dc('0x45')]=_0x2bf523;return _0x1c90dc;})[_0x32dc('0x26')](respondWithFilteredResult(_0x51e50c,_0x46a526))['catch'](handleError(_0x51e50c,null));};exports[_0x32dc('0x46')]=function(_0x9fac10,_0x3e3896){var _0x530e46={'raw':![],'where':{'id':_0x9fac10['params']['id']}},_0xa49568={};_0xa49568[_0x32dc('0x32')]=_[_0x32dc('0x35')](db[_0x32dc('0x2e')][_0x32dc('0x2f')]);_0xa49568['query']=_[_0x32dc('0x35')](_0x9fac10['query']);_0xa49568[_0x32dc('0x36')]=_['intersection'](_0xa49568[_0x32dc('0x32')],_0xa49568[_0x32dc('0x34')]);_0x530e46[_0x32dc('0x38')]=_[_0x32dc('0x37')](_0xa49568[_0x32dc('0x32')],qs[_0x32dc('0x39')](_0x9fac10[_0x32dc('0x34')][_0x32dc('0x39')]));_0x530e46[_0x32dc('0x38')]=_0x530e46[_0x32dc('0x38')][_0x32dc('0x47')]?_0x530e46['attributes']:_0xa49568[_0x32dc('0x32')];if(_0x9fac10[_0x32dc('0x34')][_0x32dc('0x43')]){_0x530e46[_0x32dc('0x44')]=[{'all':!![]}];}_0x530e46=_['merge']({},_0x530e46,_0x9fac10[_0x32dc('0x42')]);return db['VoicePrefix'][_0x32dc('0x48')](_0x530e46)['then'](handleEntityNotFound(_0x3e3896,null))['then'](respondWithResult(_0x3e3896,null))[_0x32dc('0x49')](handleError(_0x3e3896,null));};exports[_0x32dc('0x27')]=function(_0x112cca,_0x2ff025){return db['VoicePrefix'][_0x32dc('0x48')]({'where':{'id':_0x112cca[_0x32dc('0x4a')]['id']}})[_0x32dc('0x26')](handleEntityNotFound(_0x2ff025,null))['then'](removeEntity(_0x2ff025,null))['catch'](handleError(_0x2ff025,null));};exports[_0x32dc('0x4b')]=function(_0x5e7b48,_0x387643){return db['VoicePrefix']['describe']()[_0x32dc('0x26')](respondWithResult(_0x387643,null))[_0x32dc('0x49')](handleError(_0x387643,null));};exports[_0x32dc('0x4c')]=function(_0x307b0f,_0x524f9d){var _0x18b4e7;return db['sequelize'][_0x32dc('0x4d')](function(_0x2056c2){return db[_0x32dc('0x2e')][_0x32dc('0x4c')](_0x307b0f[_0x32dc('0x4e')],{'transaction':_0x2056c2})['then'](function(_0x5f51f0){_0x18b4e7=_0x5f51f0[_0x32dc('0x28')]({'plain':!![]});return db['VoiceExtension'][_0x32dc('0x48')]({'where':{'id':_0x18b4e7[_0x32dc('0x4f')]},'raw':!![]})[_0x32dc('0x26')](function(_0x1a528b){return createVoicePrefixExtensions(_0x18b4e7,_0x1a528b,_0x2056c2);});});})[_0x32dc('0x26')](function(){var _0x3c18e8=_0x307b0f[_0x32dc('0x50')][_0x32dc('0x28')]({'plain':!![]});if(!_0x3c18e8)throw new Error(_0x32dc('0x51'));if(_0x3c18e8[_0x32dc('0x52')]===_0x32dc('0x50')){var _0x29944c=_0x18b4e7;return db[_0x32dc('0x53')][_0x32dc('0x48')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3c18e8[_0x32dc('0x54')]},'raw':!![]})['then'](function(_0x2f7243){if(_0x2f7243&&_0x2f7243[_0x32dc('0x55')]===0x0){return db[_0x32dc('0x56')]['create']({'name':_0x29944c[_0x32dc('0x2d')],'resourceId':_0x29944c['id'],'type':_0x2f7243[_0x32dc('0x2d')],'sectionId':_0x2f7243['id']},{})[_0x32dc('0x26')](function(){return _0x18b4e7;});}else{return _0x18b4e7;}})[_0x32dc('0x49')](function(_0x1a6566){logger[_0x32dc('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a6566);throw _0x1a6566;});}return _0x18b4e7;})['then'](respondWithResult(_0x524f9d,null))[_0x32dc('0x49')](handleError(_0x524f9d,null));};function Extension(_0x32c973,_0x507ba2,_0x26e0d4,_0x54f701){this[_0x32dc('0x57')]='from-sip';this[_0x32dc('0x58')]=_0x32c973;this[_0x32dc('0x59')]=_0x26e0d4;this[_0x32dc('0x30')]=_0x32dc('0x5a');this[_0x32dc('0x5b')]=_0x32dc('0x5c');this['priority']=_0x507ba2;this[_0x32dc('0x5d')]=_0x54f701;}function createVoicePrefixExtensions(_0x50597b,_0x2df0f8,_0x546a34){return new BPromise(function(_0x1d277f,_0x281313){var _0x1c8d2a=new Extension(formatPrefixName(_0x50597b[_0x32dc('0x5e')]),0x1,_0x32dc('0x5f'),_0x32dc('0x60'));_0x1c8d2a[_0x32dc('0x61')]=_0x50597b['id'];return db[_0x32dc('0x62')][_0x32dc('0x4c')](_0x1c8d2a,{'transaction':_0x546a34})['then'](function(_0x866993){var _0x4e6471=_0x866993['get']({'plain':!![]});var _0x8de2fd=_[_0x32dc('0x33')](addVoicePrefixExtensions(_0x50597b,_0x2df0f8),function(_0x33f093){_0x33f093['VoiceExtensionId']=_0x4e6471['id'];_0x33f093[_0x32dc('0x61')]=_0x50597b['id'];return _0x33f093;});return db[_0x32dc('0x62')][_0x32dc('0x63')](_0x8de2fd,{'transaction':_0x546a34})[_0x32dc('0x26')](function(_0x3227b4){if(!_0x3227b4){return _0x281313(_0x32dc('0x64'));}else{return _0x1d277f(_0x3227b4);}})['catch'](function(_0x43c764){return _0x281313(_0x43c764);});});;});};function addVoicePrefixExtensions(_0x388312,_0x43fb82){var _0x4a1840=[];var _0x314563=formatPrefixName(_0x388312[_0x32dc('0x5e')]);_0x4a1840['push'](new Extension(_0x314563,0x2,_0x32dc('0x65'),_0x32dc('0x66')+_0x388312[_0x32dc('0x2d')]));if(_0x388312[_0x32dc('0x67')]){_0x4a1840['push'](new Extension(_0x314563,0x3,_0x32dc('0x65'),_0x32dc('0x68')+_0x388312[_0x32dc('0x67')]));}else{_0x4a1840[_0x32dc('0x69')](new Extension(_0x314563,0x3,_0x32dc('0x5f'),_0x32dc('0x6a')));}_0x4a1840[_0x32dc('0x69')](new Extension(_0x314563,0x4,_0x32dc('0x6b'),_0x43fb82[_0x32dc('0x57')]+','+'${EXTEN:'+(0x8+_0x388312[_0x32dc('0x2d')][_0x32dc('0x47')])+'}'+','+0x1));return _0x4a1840;}function formatPrefixName(_0x14cbf9){var _0x123b4a='_';for(var _0x538680=0x0;_0x538680<_0x14cbf9[_0x32dc('0x47')];_0x538680++){if(_0x14cbf9[_0x32dc('0x6c')](_0x538680)=='-'){_0x123b4a+=_0x14cbf9[_0x32dc('0x6c')](_0x538680);}else{_0x123b4a+='['+_0x14cbf9[_0x32dc('0x6c')](_0x538680)+']';}}_0x123b4a+='.';return _0x123b4a;}exports[_0x32dc('0x25')]=function(_0xa1a13,_0xf62624,_0x1781fa){var _0x215b58=_0xa1a13[_0x32dc('0x4e')];_0x215b58[_0x32dc('0x5e')]=_0x32dc('0x6d')+_0x215b58[_0x32dc('0x2d')]+'-';return db[_0x32dc('0x6e')][_0x32dc('0x4d')](function(_0x29ad68){return db[_0x32dc('0x2e')][_0x32dc('0x25')](_0x215b58,{'where':{'id':_0x215b58['id']},'transaction':_0x29ad68})[_0x32dc('0x26')](function(){return db['VoiceExtension'][_0x32dc('0x27')]({'where':{'VoicePrefixId':_0x215b58['id']},'transaction':_0x29ad68})[_0x32dc('0x26')](function(){return db[_0x32dc('0x62')][_0x32dc('0x48')]({'where':{'id':_0x215b58['VoiceExtensionId']},'raw':!![]})[_0x32dc('0x26')](function(_0x406292){return createVoicePrefixExtensions(_0x215b58,_0x406292,_0x29ad68);});});});})[_0x32dc('0x26')](function(){return db[_0x32dc('0x2e')][_0x32dc('0x6f')](_0x215b58['id']);})[_0x32dc('0x26')](respondWithResult(_0xf62624,null))[_0x32dc('0x49')](handleError(_0xf62624,null));};exports[_0x32dc('0x70')]=function(_0x289bda,_0x3c2bdc,_0x3d6afa){return db[_0x32dc('0x2e')]['find']({'where':{'id':_0x289bda[_0x32dc('0x4a')]['id']}})[_0x32dc('0x26')](handleEntityNotFound(_0x3c2bdc,null))['then'](function(_0x23cdf1){if(_0x23cdf1){return _0x23cdf1[_0x32dc('0x70')](_0x289bda[_0x32dc('0x4e')][_0x32dc('0x71')],_[_0x32dc('0x72')](_0x289bda[_0x32dc('0x4e')],[_0x32dc('0x71'),'id'])||{})['spread'](function(_0x4114b6){for(var _0x22e9bd=0x0;_0x22e9bd<_0x289bda[_0x32dc('0x4e')][_0x32dc('0x71')][_0x32dc('0x47')];_0x22e9bd+=0x1){socket[_0x32dc('0x73')]('userVoicePrefix:save',{'UserId':_0x289bda[_0x32dc('0x4e')]['ids'][_0x22e9bd],'VoicePrefixId':_0x289bda[_0x32dc('0x4a')]['id']});}return _0x4114b6;});}})[_0x32dc('0x26')](respondWithResult(_0x3c2bdc,null))['catch'](handleError(_0x3c2bdc,null));};exports[_0x32dc('0x74')]=function(_0xbf195d,_0xc71aa7,_0x59d766){return db[_0x32dc('0x2e')][_0x32dc('0x48')]({'where':{'id':_0xbf195d[_0x32dc('0x4a')]['id']}})[_0x32dc('0x26')](handleEntityNotFound(_0xc71aa7,null))[_0x32dc('0x26')](function(_0x1a10ff){if(_0x1a10ff){return _0x1a10ff[_0x32dc('0x74')](_0xbf195d['query'][_0x32dc('0x71')])['then'](function(){if(_[_0x32dc('0x75')](_0xbf195d[_0x32dc('0x34')]['ids'])){for(var _0x273f7c=0x0;_0x273f7c<_0xbf195d[_0x32dc('0x34')][_0x32dc('0x71')][_0x32dc('0x47')];_0x273f7c+=0x1){socket[_0x32dc('0x73')](_0x32dc('0x76'),{'UserId':Number(_0xbf195d[_0x32dc('0x34')]['ids'][_0x273f7c]),'VoicePrefixId':Number(_0xbf195d[_0x32dc('0x4a')]['id'])});}}else{socket['emit'](_0x32dc('0x76'),{'UserId':Number(_0xbf195d[_0x32dc('0x34')][_0x32dc('0x71')]),'VoicePrefixId':Number(_0xbf195d[_0x32dc('0x4a')]['id'])});}});}})[_0x32dc('0x26')](respondWithStatusCode(_0xc71aa7,null))[_0x32dc('0x49')](handleError(_0xc71aa7,null));};exports['getAgents']=function(_0x2f22f8,_0x289c0b,_0x46185c){var _0x328cf3={};var _0x18f3a9={};var _0x46e61c;var _0xcc7e13;return db[_0x32dc('0x2e')][_0x32dc('0x77')]({'where':{'id':_0x2f22f8[_0x32dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x289c0b,null))['then'](function(_0x5e72d9){if(_0x5e72d9){_0x46e61c=_0x5e72d9;_0x18f3a9[_0x32dc('0x32')]=_[_0x32dc('0x35')](db[_0x32dc('0x78')][_0x32dc('0x2f')]);_0x18f3a9[_0x32dc('0x34')]=_[_0x32dc('0x35')](_0x2f22f8[_0x32dc('0x34')]);_0x18f3a9[_0x32dc('0x36')]=_[_0x32dc('0x37')](_0x18f3a9['model'],_0x18f3a9[_0x32dc('0x34')]);_0x328cf3[_0x32dc('0x38')]=_[_0x32dc('0x37')](_0x18f3a9[_0x32dc('0x32')],qs['fields'](_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x39')]));_0x328cf3[_0x32dc('0x38')]=_0x328cf3[_0x32dc('0x38')]['length']?_0x328cf3[_0x32dc('0x38')]:_0x18f3a9[_0x32dc('0x32')];_0x328cf3['order']=qs['sort'](_0x2f22f8[_0x32dc('0x34')]['sort']);_0x328cf3['where']=qs[_0x32dc('0x36')](_[_0x32dc('0x79')](_0x2f22f8[_0x32dc('0x34')],_0x18f3a9[_0x32dc('0x36')]));if(_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x3f')]){_0x328cf3[_0x32dc('0x3e')]=_['merge'](_0x328cf3[_0x32dc('0x3e')],{'$or':_[_0x32dc('0x33')](_0x328cf3[_0x32dc('0x38')],function(_0x28bd70){var _0x96ddb={};_0x96ddb[_0x28bd70]={'$like':'%'+_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x3f')]+'%'};return _0x96ddb;})});}_0x328cf3=_['merge']({},_0x328cf3,_0x2f22f8['options']);return _0x46e61c['getAgents'](_0x328cf3);}})[_0x32dc('0x26')](function(_0x360ece){if(_0x360ece){_0xcc7e13=_0x360ece[_0x32dc('0x47')];if(!_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x3a')](_0x32dc('0x3b'))){_0x328cf3[_0x32dc('0x1f')]=qs[_0x32dc('0x1f')](_0x2f22f8[_0x32dc('0x34')][_0x32dc('0x1f')]);_0x328cf3[_0x32dc('0x1e')]=qs['offset'](_0x2f22f8[_0x32dc('0x34')]['offset']);}return _0x46e61c[_0x32dc('0x7a')](_0x328cf3);}})[_0x32dc('0x26')](function(_0x47bf1b){if(_0x47bf1b){return _0x47bf1b?{'count':_0xcc7e13,'rows':_0x47bf1b}:null;}})[_0x32dc('0x26')](respondWithResult(_0x289c0b,null))[_0x32dc('0x49')](handleError(_0x289c0b,null));};
\ No newline at end of file