Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / dashboard / dashboard.controller.js
index 4c9fa57..5578a23 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf678=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','update','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','get','CustomDashboards','then','error','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf678,0x14a));var _0x8f67=function(_0x5e8ab7,_0x48757b){_0x5e8ab7=_0x5e8ab7-0x0;var _0x26d7ca=_0xf678[_0x5e8ab7];return _0x26d7ca;};'use strict';var emlformat=require(_0x8f67('0x0'));var rimraf=require(_0x8f67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f67('0x2'));var rp=require(_0x8f67('0x3'));var moment=require(_0x8f67('0x4'));var BPromise=require(_0x8f67('0x5'));var Mustache=require('mustache');var util=require(_0x8f67('0x6'));var path=require(_0x8f67('0x7'));var sox=require(_0x8f67('0x8'));var csv=require('to-csv');var ejs=require(_0x8f67('0x9'));var fs=require('fs');var fs_extra=require(_0x8f67('0xa'));var _=require(_0x8f67('0xb'));var squel=require(_0x8f67('0xc'));var crypto=require(_0x8f67('0xd'));var jsforce=require(_0x8f67('0xe'));var deskjs=require(_0x8f67('0xf'));var toCsv=require(_0x8f67('0x10'));var querystring=require(_0x8f67('0x11'));var Papa=require(_0x8f67('0x12'));var Redis=require(_0x8f67('0x13'));var authService=require(_0x8f67('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8f67('0x15'));var hardwareService=require(_0x8f67('0x16'));var logger=require(_0x8f67('0x17'))('api');var utils=require(_0x8f67('0x18'));var config=require(_0x8f67('0x19'));var licenseUtil=require(_0x8f67('0x1a'));var db=require(_0x8f67('0x1b'))['db'];config[_0x8f67('0x1c')]=_['defaults'](config[_0x8f67('0x1c')],{'host':_0x8f67('0x1d'),'port':0x18eb});var socket=require(_0x8f67('0x1e'))(new Redis(config[_0x8f67('0x1c')]));require('./dashboard.socket')[_0x8f67('0x1f')](socket);function respondWithStatusCode(_0x13bd25,_0xe83d32){_0xe83d32=_0xe83d32||0xcc;return function(_0x288c6){if(_0x288c6){return _0x13bd25[_0x8f67('0x20')](_0xe83d32);}return _0x13bd25[_0x8f67('0x21')](_0xe83d32)[_0x8f67('0x22')]();};}function respondWithResult(_0xb608fb,_0x204a5c){_0x204a5c=_0x204a5c||0xc8;return function(_0x2be26b){if(_0x2be26b){return _0xb608fb[_0x8f67('0x21')](_0x204a5c)[_0x8f67('0x23')](_0x2be26b);}};}function respondWithFilteredResult(_0x12ec70,_0x44458f){return function(_0x11c69c){if(_0x11c69c){var _0x4d6ab5=typeof _0x44458f[_0x8f67('0x24')]==='undefined'&&typeof _0x44458f[_0x8f67('0x25')]===_0x8f67('0x26');var _0x2a538f=_0x11c69c[_0x8f67('0x27')];var _0x2444dd=_0x4d6ab5?0x0:_0x44458f[_0x8f67('0x24')];var _0x3527f4=_0x4d6ab5?_0x11c69c[_0x8f67('0x27')]:_0x44458f['offset']+_0x44458f[_0x8f67('0x25')];var _0x15bde7;if(_0x3527f4>=_0x2a538f){_0x3527f4=_0x2a538f;_0x15bde7=0xc8;}else{_0x15bde7=0xce;}_0x12ec70[_0x8f67('0x21')](_0x15bde7);return _0x12ec70[_0x8f67('0x28')](_0x8f67('0x29'),_0x2444dd+'-'+_0x3527f4+'/'+_0x2a538f)[_0x8f67('0x23')](_0x11c69c);}return null;};}function patchUpdates(_0x348335){return function(_0x5d4da5){try{jsonpatch['apply'](_0x5d4da5,_0x348335,!![]);}catch(_0x596a28){return BPromise[_0x8f67('0x2a')](_0x596a28);}return _0x5d4da5[_0x8f67('0x2b')]();};}function saveUpdates(_0x4932fa,_0x1872fa){return function(_0x58edfe){if(_0x58edfe){return _0x58edfe['update'](_0x4932fa)['then'](function(_0x38e296){return _0x38e296;});}return null;};}function removeEntity(_0x4ae9d9,_0x46f8c4){return function(_0x1556dc){if(_0x1556dc){return _0x1556dc[_0x8f67('0x2c')]()['then'](function(){var _0x209330=_0x1556dc[_0x8f67('0x2d')]({'plain':!![]});var _0x208fd3=_0x8f67('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x208fd3,'resourceId':_0x209330['id']}})[_0x8f67('0x2f')](function(){return _0x1556dc;});})[_0x8f67('0x2f')](function(){_0x4ae9d9[_0x8f67('0x21')](0xcc)[_0x8f67('0x22')]();});}};}function handleEntityNotFound(_0x5ab8f4,_0x20c06c){return function(_0x85f2d3){if(!_0x85f2d3){_0x5ab8f4['sendStatus'](0x194);}return _0x85f2d3;};}function handleError(_0x3caf84,_0x1a2390){_0x1a2390=_0x1a2390||0x1f4;return function(_0x215c18){logger[_0x8f67('0x30')](_0x215c18['stack']);if(_0x215c18[_0x8f67('0x31')]){delete _0x215c18['name'];}_0x3caf84[_0x8f67('0x21')](_0x1a2390)[_0x8f67('0x32')](_0x215c18);};}exports[_0x8f67('0x33')]=function(_0x1f9c28,_0x36b498){var _0x49c679={},_0x53aa3b={},_0x2c2307={'count':0x0,'rows':[]};var _0x236550=_['map'](db[_0x8f67('0x34')][_0x8f67('0x35')],function(_0x1d80d8){return{'name':_0x1d80d8[_0x8f67('0x36')],'type':_0x1d80d8[_0x8f67('0x37')][_0x8f67('0x38')]};});_0x53aa3b[_0x8f67('0x39')]=_['map'](_0x236550,_0x8f67('0x31'));_0x53aa3b[_0x8f67('0x3a')]=_['keys'](_0x1f9c28['query']);_0x53aa3b['filters']=_[_0x8f67('0x3b')](_0x53aa3b[_0x8f67('0x39')],_0x53aa3b['query']);_0x49c679[_0x8f67('0x3c')]=_['intersection'](_0x53aa3b[_0x8f67('0x39')],qs[_0x8f67('0x3d')](_0x1f9c28['query'][_0x8f67('0x3d')]));_0x49c679[_0x8f67('0x3c')]=_0x49c679[_0x8f67('0x3c')][_0x8f67('0x3e')]?_0x49c679[_0x8f67('0x3c')]:_0x53aa3b['model'];if(!_0x1f9c28[_0x8f67('0x3a')][_0x8f67('0x3f')](_0x8f67('0x40'))){_0x49c679[_0x8f67('0x25')]=qs[_0x8f67('0x25')](_0x1f9c28['query'][_0x8f67('0x25')]);_0x49c679['offset']=qs['offset'](_0x1f9c28[_0x8f67('0x3a')]['offset']);}_0x49c679[_0x8f67('0x41')]=qs[_0x8f67('0x42')](_0x1f9c28[_0x8f67('0x3a')][_0x8f67('0x42')]);_0x49c679[_0x8f67('0x43')]=qs[_0x8f67('0x44')](_[_0x8f67('0x45')](_0x1f9c28[_0x8f67('0x3a')],_0x53aa3b['filters']),_0x236550);if(_0x1f9c28['query'][_0x8f67('0x46')]){_0x49c679[_0x8f67('0x43')]=_[_0x8f67('0x47')](_0x49c679[_0x8f67('0x43')],{'$or':_['map'](_0x236550,function(_0x140306){if(_0x140306['type']!==_0x8f67('0x48')){var _0x51e068={};_0x51e068[_0x140306[_0x8f67('0x31')]]={'$like':'%'+_0x1f9c28[_0x8f67('0x3a')]['filter']+'%'};return _0x51e068;}})});}_0x49c679=_[_0x8f67('0x47')]({},_0x49c679,_0x1f9c28[_0x8f67('0x49')]);var _0x1ca5d5={'where':_0x49c679[_0x8f67('0x43')]};return db['Dashboard'][_0x8f67('0x27')](_0x1ca5d5)[_0x8f67('0x2f')](function(_0x7f4d2e){_0x2c2307[_0x8f67('0x27')]=_0x7f4d2e;if(_0x1f9c28['query'][_0x8f67('0x4a')]){_0x49c679[_0x8f67('0x4b')]=[{'all':!![]}];}return db['Dashboard'][_0x8f67('0x4c')](_0x49c679);})[_0x8f67('0x2f')](function(_0x9b45f5){_0x2c2307[_0x8f67('0x4d')]=_0x9b45f5;return _0x2c2307;})[_0x8f67('0x2f')](respondWithFilteredResult(_0x36b498,_0x49c679))[_0x8f67('0x4e')](handleError(_0x36b498,null));};exports[_0x8f67('0x4f')]=function(_0xc6ea8a,_0x4e9f55){var _0x39a845={'raw':![],'where':{'id':_0xc6ea8a[_0x8f67('0x50')]['id']}},_0x3947eb={};_0x3947eb[_0x8f67('0x39')]=_[_0x8f67('0x51')](db['Dashboard'][_0x8f67('0x35')]);_0x3947eb[_0x8f67('0x3a')]=_[_0x8f67('0x51')](_0xc6ea8a[_0x8f67('0x3a')]);_0x3947eb[_0x8f67('0x44')]=_['intersection'](_0x3947eb[_0x8f67('0x39')],_0x3947eb['query']);_0x39a845[_0x8f67('0x3c')]=_[_0x8f67('0x3b')](_0x3947eb[_0x8f67('0x39')],qs[_0x8f67('0x3d')](_0xc6ea8a[_0x8f67('0x3a')][_0x8f67('0x3d')]));_0x39a845['attributes']=_0x39a845[_0x8f67('0x3c')][_0x8f67('0x3e')]?_0x39a845[_0x8f67('0x3c')]:_0x3947eb[_0x8f67('0x39')];if(_0xc6ea8a[_0x8f67('0x3a')][_0x8f67('0x4a')]){_0x39a845['include']=[{'all':!![]}];}_0x39a845=_[_0x8f67('0x47')]({},_0x39a845,_0xc6ea8a[_0x8f67('0x49')]);return db[_0x8f67('0x34')][_0x8f67('0x52')](_0x39a845)['then'](handleEntityNotFound(_0x4e9f55,null))[_0x8f67('0x2f')](respondWithResult(_0x4e9f55,null))['catch'](handleError(_0x4e9f55,null));};exports[_0x8f67('0x53')]=function(_0xdb1582,_0x297cf9){return db[_0x8f67('0x34')][_0x8f67('0x53')](_0xdb1582[_0x8f67('0x54')],{})[_0x8f67('0x2f')](function(_0x366476){var _0x287854=_0xdb1582[_0x8f67('0x55')]['get']({'plain':!![]});if(!_0x287854)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x287854['role']==='user'){var _0x4338d8=_0x366476[_0x8f67('0x2d')]({'plain':!![]});var _0x244ed2=_0x8f67('0x2e');return db[_0x8f67('0x56')]['find']({'where':{'name':_0x244ed2,'userProfileId':_0x287854[_0x8f67('0x57')]},'raw':!![]})[_0x8f67('0x2f')](function(_0x4e8364){if(_0x4e8364&&_0x4e8364[_0x8f67('0x58')]===0x0){return db['UserProfileResource'][_0x8f67('0x53')]({'name':_0x4338d8['name'],'resourceId':_0x4338d8['id'],'type':_0x4e8364[_0x8f67('0x31')],'sectionId':_0x4e8364['id']},{})['then'](function(){return _0x366476;});}else{return _0x366476;}})[_0x8f67('0x4e')](function(_0x1c1b06){logger[_0x8f67('0x30')](_0x8f67('0x59'),_0x1c1b06);throw _0x1c1b06;});}return _0x366476;})[_0x8f67('0x2f')](respondWithResult(_0x297cf9,0xc9))['catch'](handleError(_0x297cf9,null));};exports[_0x8f67('0x5a')]=function(_0x21a43e,_0x4319bb){var _0x2a45ff={'where':{'id':_0x21a43e[_0x8f67('0x50')]['id']}},_0x17bcba={};_0x17bcba[_0x8f67('0x39')]=_['keys'](db[_0x8f67('0x34')][_0x8f67('0x35')]);_0x2a45ff[_0x8f67('0x3c')]=_[_0x8f67('0x3b')](_0x17bcba[_0x8f67('0x39')],qs['fields'](_0x21a43e[_0x8f67('0x3a')][_0x8f67('0x3d')]));_0x2a45ff[_0x8f67('0x3c')]=_0x2a45ff['attributes'][_0x8f67('0x3e')]?_0x2a45ff[_0x8f67('0x3c')]:_0x17bcba['model'];if(_0x21a43e[_0x8f67('0x3a')][_0x8f67('0x4a')]){_0x2a45ff['include']=[{'all':!![]}];}_0x2a45ff=_[_0x8f67('0x47')]({},_0x2a45ff,_0x21a43e[_0x8f67('0x49')]);return db[_0x8f67('0x34')][_0x8f67('0x52')](_0x2a45ff)['then'](handleEntityNotFound(_0x4319bb,null))[_0x8f67('0x2f')](function(_0x16c9a9){if(_0x16c9a9){var _0x15e38a=_0x16c9a9[_0x8f67('0x2d')]({'plain':!![]});_0x15e38a=qs[_0x8f67('0x5b')](_0x15e38a,['id',_0x8f67('0x5c'),'updatedAt']);_0x21a43e['body']=_[_0x8f67('0x5b')](_0x21a43e[_0x8f67('0x54')],['id',_0x8f67('0x5c'),_0x8f67('0x5d')]);return db[_0x8f67('0x34')][_0x8f67('0x53')](_[_0x8f67('0x47')](_0x15e38a,_0x21a43e[_0x8f67('0x54')]),{'include':_0x21a43e[_0x8f67('0x3a')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38d1ed){var _0x478b2c=_0x21a43e[_0x8f67('0x55')][_0x8f67('0x2d')]({'plain':!![]});if(!_0x478b2c)throw new Error(_0x8f67('0x5e'));if(_0x478b2c[_0x8f67('0x5f')]===_0x8f67('0x55')){var _0x47fa24=_0x38d1ed['get']({'plain':!![]});var _0x28043c=_0x8f67('0x2e');return db[_0x8f67('0x56')][_0x8f67('0x52')]({'where':{'name':_0x28043c,'userProfileId':_0x478b2c['userProfileId']},'raw':!![]})[_0x8f67('0x2f')](function(_0x11b604){if(_0x11b604&&_0x11b604['autoAssociation']===0x0){return db[_0x8f67('0x60')][_0x8f67('0x53')]({'name':_0x47fa24[_0x8f67('0x31')],'resourceId':_0x47fa24['id'],'type':_0x11b604[_0x8f67('0x31')],'sectionId':_0x11b604['id']},{})['then'](function(){return _0x38d1ed;});}else{return _0x38d1ed;}})[_0x8f67('0x4e')](function(_0x42314d){logger[_0x8f67('0x30')](_0x8f67('0x59'),_0x42314d);throw _0x42314d;});}return _0x38d1ed;});}})[_0x8f67('0x2f')](respondWithResult(_0x4319bb,0xc9))[_0x8f67('0x4e')](handleError(_0x4319bb,null));};exports[_0x8f67('0x61')]=function(_0x4e52ec,_0x16b834){if(_0x4e52ec[_0x8f67('0x54')]['id']){delete _0x4e52ec[_0x8f67('0x54')]['id'];}return db[_0x8f67('0x34')][_0x8f67('0x52')]({'where':{'id':_0x4e52ec[_0x8f67('0x50')]['id']}})[_0x8f67('0x2f')](handleEntityNotFound(_0x16b834,null))['then'](saveUpdates(_0x4e52ec[_0x8f67('0x54')],null))['then'](respondWithResult(_0x16b834,null))['catch'](handleError(_0x16b834,null));};exports['destroy']=function(_0x2acdf3,_0x13c32d){return db[_0x8f67('0x34')]['find']({'where':{'id':_0x2acdf3[_0x8f67('0x50')]['id']}})[_0x8f67('0x2f')](handleEntityNotFound(_0x13c32d,null))[_0x8f67('0x2f')](removeEntity(_0x13c32d,null))[_0x8f67('0x4e')](handleError(_0x13c32d,null));};function widgetAttributes(_0x541d6f){try{switch(_0x541d6f[_0x8f67('0x37')]){case'iframe':return[{'name':'attrUrl','value':_0x541d6f[_0x8f67('0x62')]||(_0x541d6f['attrs']&&_0x541d6f[_0x8f67('0x63')][0x0]?_0x541d6f[_0x8f67('0x63')][0x0][_0x8f67('0x64')]:undefined)||_0x8f67('0x65')}];case _0x8f67('0x66'):return[{'name':_0x8f67('0x67'),'value':_0x541d6f['attrPath']||(_0x541d6f['attrs']&&_0x541d6f[_0x8f67('0x63')][0x0]?_0x541d6f[_0x8f67('0x63')][0x0][_0x8f67('0x64')]:undefined)||''}];case _0x8f67('0x68'):return[{'name':'attrHourFormat','value':_0x541d6f[_0x8f67('0x69')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x0]?_0x541d6f['attrs'][0x0][_0x8f67('0x64')]:undefined)||'HH:mm:ss'},{'name':_0x8f67('0x6a'),'value':_0x541d6f[_0x8f67('0x6a')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x1]?_0x541d6f['attrs'][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x541d6f['attrFontSize']||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x2]?_0x541d6f[_0x8f67('0x63')][0x2][_0x8f67('0x64')]:undefined)||0xc}];case _0x8f67('0x6b'):return[{'name':_0x8f67('0x6c'),'value':_0x541d6f[_0x8f67('0x6c')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x0]?_0x541d6f['attrs'][0x0][_0x8f67('0x64')]:undefined)||_0x8f67('0x6d')},{'name':_0x8f67('0x6e'),'value':_0x541d6f[_0x8f67('0x6e')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x1]?_0x541d6f[_0x8f67('0x63')][0x1]['value']:undefined)||[]},{'name':_0x8f67('0x6f'),'value':_0x541d6f[_0x8f67('0x6f')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f['attrs'][0x2]?_0x541d6f[_0x8f67('0x63')][0x2][_0x8f67('0x64')]:undefined)||0x14},{'name':_0x8f67('0x70'),'value':_0x541d6f[_0x8f67('0x70')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x3]?_0x541d6f[_0x8f67('0x63')][0x3][_0x8f67('0x64')]:undefined)||_0x8f67('0x71')},{'name':_0x8f67('0x72'),'value':_0x541d6f[_0x8f67('0x72')]||(_0x541d6f['attrs']&&_0x541d6f[_0x8f67('0x63')][0x4]?_0x541d6f[_0x8f67('0x63')][0x4][_0x8f67('0x64')]:undefined)||''},{'name':_0x8f67('0x73'),'value':_0x541d6f[_0x8f67('0x73')]||(_0x541d6f['attrs']&&_0x541d6f[_0x8f67('0x63')][0x5]?_0x541d6f['attrs'][0x5][_0x8f67('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x541d6f['attrSmsAccounts']||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x6]?_0x541d6f[_0x8f67('0x63')][0x6][_0x8f67('0x64')]:undefined)||''},{'name':_0x8f67('0x74'),'value':_0x541d6f[_0x8f67('0x74')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x7]?_0x541d6f[_0x8f67('0x63')][0x7]['value']:undefined)||''},{'name':_0x8f67('0x75'),'value':_0x541d6f[_0x8f67('0x75')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x8]?_0x541d6f[_0x8f67('0x63')][0x8]['value']:undefined)||''},{'name':_0x8f67('0x76'),'value':_0x541d6f[_0x8f67('0x76')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x9]?_0x541d6f[_0x8f67('0x63')][0x9][_0x8f67('0x64')]:undefined)||''}];case _0x8f67('0x77'):case _0x8f67('0x78'):return[{'name':_0x8f67('0x79'),'value':_0x541d6f[_0x8f67('0x79')]||(_0x541d6f['attrs']&&_0x541d6f[_0x8f67('0x63')][0x0]?_0x541d6f[_0x8f67('0x63')][0x0]['value']:undefined)||_0x8f67('0x6d')},{'name':'attrSerie2','value':_0x541d6f[_0x8f67('0x7a')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x1]?_0x541d6f[_0x8f67('0x63')][0x1][_0x8f67('0x64')]:undefined)||null},{'name':_0x8f67('0x7b'),'value':_0x541d6f[_0x8f67('0x7b')]||(_0x541d6f['attrs']&&_0x541d6f[_0x8f67('0x63')][0x2]?_0x541d6f[_0x8f67('0x63')][0x2][_0x8f67('0x64')]:undefined)||null},{'name':_0x8f67('0x6e'),'value':_0x541d6f[_0x8f67('0x6e')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f['attrs'][0x3]?_0x541d6f[_0x8f67('0x63')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x541d6f[_0x8f67('0x70')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x4]?_0x541d6f[_0x8f67('0x63')][0x4][_0x8f67('0x64')]:undefined)||'voice'},{'name':_0x8f67('0x72'),'value':_0x541d6f[_0x8f67('0x72')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x5]?_0x541d6f['attrs'][0x5][_0x8f67('0x64')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x541d6f[_0x8f67('0x73')]||(_0x541d6f['attrs']&&_0x541d6f['attrs'][0x6]?_0x541d6f[_0x8f67('0x63')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x541d6f[_0x8f67('0x7c')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x7]?_0x541d6f[_0x8f67('0x63')][0x7]['value']:undefined)||''},{'name':_0x8f67('0x74'),'value':_0x541d6f[_0x8f67('0x74')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x8]?_0x541d6f[_0x8f67('0x63')][0x8][_0x8f67('0x64')]:undefined)||''},{'name':_0x8f67('0x75'),'value':_0x541d6f['attrWhatsappAccounts']||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x9]?_0x541d6f[_0x8f67('0x63')][0x9][_0x8f67('0x64')]:undefined)||''},{'name':'attrChatWebsites','value':_0x541d6f[_0x8f67('0x76')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0xa]?_0x541d6f[_0x8f67('0x63')][0xa][_0x8f67('0x64')]:undefined)||''}];case'web-report':return[{'name':_0x8f67('0x7d'),'type':_0x541d6f['reportType']||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f[_0x8f67('0x63')][0x0]?_0x541d6f[_0x8f67('0x63')][0x0]['type']:undefined)||null,'value':_0x541d6f[_0x8f67('0x7d')]||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f['attrs'][0x0]?_0x541d6f['attrs'][0x0][_0x8f67('0x64')]:undefined)||null},{'name':_0x8f67('0x7e'),'value':_0x541d6f['attrRefresh']||(_0x541d6f[_0x8f67('0x63')]&&_0x541d6f['attrs'][0x1]?_0x541d6f[_0x8f67('0x63')][0x1][_0x8f67('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x239268){logger[_0x8f67('0x30')](_0x8f67('0x7f'),JSON['stringify'](_0x239268));return[];}}exports[_0x8f67('0x80')]=function(_0x52c6d3,_0x2339f6,_0x25e5a1){if(_0x52c6d3[_0x8f67('0x54')]['id']){delete _0x52c6d3[_0x8f67('0x54')]['id'];}return db[_0x8f67('0x34')][_0x8f67('0x52')]({'where':{'id':_0x52c6d3[_0x8f67('0x50')]['id']}})[_0x8f67('0x2f')](handleEntityNotFound(_0x2339f6,null))[_0x8f67('0x2f')](function(_0x39a56e){if(_0x39a56e){_0x52c6d3['body'][_0x8f67('0x81')]=_0x39a56e['id'];_0x52c6d3[_0x8f67('0x54')][_0x8f67('0x63')]=widgetAttributes(_0x52c6d3[_0x8f67('0x54')]);return db[_0x8f67('0x82')]['create'](_0x52c6d3[_0x8f67('0x54')]);}})[_0x8f67('0x2f')](respondWithResult(_0x2339f6,null))[_0x8f67('0x4e')](handleError(_0x2339f6,null));};exports[_0x8f67('0x83')]=function(_0x46cc72,_0x38cc25,_0x2248d0){var _0x381856={};var _0x59cd86={};var _0x31fc5d;var _0x36b2e4;return db['Dashboard'][_0x8f67('0x84')]({'where':{'id':_0x46cc72[_0x8f67('0x50')]['id']}})[_0x8f67('0x2f')](handleEntityNotFound(_0x38cc25,null))[_0x8f67('0x2f')](function(_0xa3e928){if(_0xa3e928){_0x31fc5d=_0xa3e928;_0x59cd86['model']=_[_0x8f67('0x51')](db['DashboardItem'][_0x8f67('0x35')]);_0x59cd86[_0x8f67('0x3a')]=_[_0x8f67('0x51')](_0x46cc72['query']);_0x59cd86[_0x8f67('0x44')]=_[_0x8f67('0x3b')](_0x59cd86['model'],_0x59cd86[_0x8f67('0x3a')]);_0x381856[_0x8f67('0x3c')]=_['intersection'](_0x59cd86[_0x8f67('0x39')],qs[_0x8f67('0x3d')](_0x46cc72[_0x8f67('0x3a')][_0x8f67('0x3d')]));_0x381856[_0x8f67('0x3c')]=_0x381856['attributes'][_0x8f67('0x3e')]?_0x381856[_0x8f67('0x3c')]:_0x59cd86[_0x8f67('0x39')];_0x381856[_0x8f67('0x41')]=qs['sort'](_0x46cc72[_0x8f67('0x3a')][_0x8f67('0x42')]);_0x381856['where']=qs[_0x8f67('0x44')](_[_0x8f67('0x45')](_0x46cc72[_0x8f67('0x3a')],_0x59cd86[_0x8f67('0x44')]));if(_0x46cc72[_0x8f67('0x3a')][_0x8f67('0x46')]){_0x381856[_0x8f67('0x43')]=_[_0x8f67('0x47')](_0x381856[_0x8f67('0x43')],{'$or':_['map'](_0x381856[_0x8f67('0x3c')],function(_0x4abebd){var _0x576aee={};_0x576aee[_0x4abebd]={'$like':'%'+_0x46cc72['query'][_0x8f67('0x46')]+'%'};return _0x576aee;})});}_0x381856=_[_0x8f67('0x47')]({},_0x381856,_0x46cc72['options']);return _0x31fc5d['getItems'](_0x381856);}})[_0x8f67('0x2f')](function(_0x81e87c){if(_0x81e87c){_0x36b2e4=_0x81e87c[_0x8f67('0x3e')];if(!_0x46cc72['query'][_0x8f67('0x3f')](_0x8f67('0x40'))){_0x381856['limit']=qs['limit'](_0x46cc72[_0x8f67('0x3a')][_0x8f67('0x25')]);_0x381856[_0x8f67('0x24')]=qs[_0x8f67('0x24')](_0x46cc72['query'][_0x8f67('0x24')]);}return _0x31fc5d[_0x8f67('0x83')](_0x381856);}})[_0x8f67('0x2f')](function(_0x4e6d11){if(_0x4e6d11){return _0x4e6d11?{'count':_0x36b2e4,'rows':_0x4e6d11}:null;}})[_0x8f67('0x2f')](respondWithResult(_0x38cc25,null))[_0x8f67('0x4e')](handleError(_0x38cc25,null));};
\ No newline at end of file
+var _0x331b=['includeAll','include','findAll','rows','catch','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','body','omit','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','findOne','pick','getItems','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','merge','options'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x331b,0x1c7));var _0xb331=function(_0x4c6733,_0x878e1b){_0x4c6733=_0x4c6733-0x0;var _0x57ad98=_0x331b[_0x4c6733];return _0x57ad98;};'use strict';var emlformat=require(_0xb331('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb331('0x1'));var rp=require(_0xb331('0x2'));var moment=require(_0xb331('0x3'));var BPromise=require(_0xb331('0x4'));var Mustache=require(_0xb331('0x5'));var util=require(_0xb331('0x6'));var path=require(_0xb331('0x7'));var sox=require(_0xb331('0x8'));var csv=require(_0xb331('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb331('0xa'));var _=require(_0xb331('0xb'));var squel=require(_0xb331('0xc'));var crypto=require(_0xb331('0xd'));var jsforce=require(_0xb331('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb331('0x9'));var querystring=require(_0xb331('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb331('0x10'));var qs=require(_0xb331('0x11'));var as=require(_0xb331('0x12'));var hardwareService=require(_0xb331('0x13'));var logger=require(_0xb331('0x14'))('api');var utils=require(_0xb331('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb331('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb331('0x17')](config[_0xb331('0x18')],{'host':_0xb331('0x19'),'port':0x18eb});var socket=require(_0xb331('0x1a'))(new Redis(config[_0xb331('0x18')]));require(_0xb331('0x1b'))['register'](socket);function respondWithStatusCode(_0x35b9db,_0x2358c1){_0x2358c1=_0x2358c1||0xcc;return function(_0x48bdcd){if(_0x48bdcd){return _0x35b9db['sendStatus'](_0x2358c1);}return _0x35b9db[_0xb331('0x1c')](_0x2358c1)[_0xb331('0x1d')]();};}function respondWithResult(_0x5ef819,_0x20afca){_0x20afca=_0x20afca||0xc8;return function(_0x313bcb){if(_0x313bcb){return _0x5ef819[_0xb331('0x1c')](_0x20afca)[_0xb331('0x1e')](_0x313bcb);}};}function respondWithFilteredResult(_0x54489b,_0x30f7d9){return function(_0x155681){if(_0x155681){var _0x3bd1a5=typeof _0x30f7d9[_0xb331('0x1f')]===_0xb331('0x20')&&typeof _0x30f7d9['limit']===_0xb331('0x20');var _0x2a1f5e=_0x155681['count'];var _0x283e65=_0x3bd1a5?0x0:_0x30f7d9[_0xb331('0x1f')];var _0x184fa2=_0x3bd1a5?_0x155681[_0xb331('0x21')]:_0x30f7d9['offset']+_0x30f7d9[_0xb331('0x22')];var _0x288e25;if(_0x184fa2>=_0x2a1f5e){_0x184fa2=_0x2a1f5e;_0x288e25=0xc8;}else{_0x288e25=0xce;}_0x54489b[_0xb331('0x1c')](_0x288e25);return _0x54489b[_0xb331('0x23')](_0xb331('0x24'),_0x283e65+'-'+_0x184fa2+'/'+_0x2a1f5e)[_0xb331('0x1e')](_0x155681);}return null;};}function patchUpdates(_0x4a5cce){return function(_0x4995fb){try{jsonpatch[_0xb331('0x25')](_0x4995fb,_0x4a5cce,!![]);}catch(_0x31336e){return BPromise[_0xb331('0x26')](_0x31336e);}return _0x4995fb[_0xb331('0x27')]();};}function saveUpdates(_0x54df9f,_0x11bb79){return function(_0x1f4e38){if(_0x1f4e38){return _0x1f4e38[_0xb331('0x28')](_0x54df9f)[_0xb331('0x29')](function(_0x85281c){return _0x85281c;});}return null;};}function removeEntity(_0x50ac76,_0x24e6e6){return function(_0x20d9e9){if(_0x20d9e9){return _0x20d9e9[_0xb331('0x2a')]()[_0xb331('0x29')](function(){var _0x4f9155=_0x20d9e9[_0xb331('0x2b')]({'plain':!![]});var _0x1f53c6='CustomDashboards';return db[_0xb331('0x2c')][_0xb331('0x2a')]({'where':{'type':_0x1f53c6,'resourceId':_0x4f9155['id']}})['then'](function(){return _0x20d9e9;});})[_0xb331('0x29')](function(){_0x50ac76[_0xb331('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59b9f1,_0x2dc85c){return function(_0x2d676e){if(!_0x2d676e){_0x59b9f1['sendStatus'](0x194);}return _0x2d676e;};}function handleError(_0x4d3049,_0x50da61){_0x50da61=_0x50da61||0x1f4;return function(_0x2ebf7c){logger[_0xb331('0x2d')](_0x2ebf7c[_0xb331('0x2e')]);if(_0x2ebf7c['name']){delete _0x2ebf7c[_0xb331('0x2f')];}_0x4d3049[_0xb331('0x1c')](_0x50da61)['send'](_0x2ebf7c);};}exports[_0xb331('0x30')]=function(_0x163d54,_0x18a964){var _0x2ad787={},_0x691d79={},_0x44185c={'count':0x0,'rows':[]};var _0x80a23d=_[_0xb331('0x31')](db[_0xb331('0x32')][_0xb331('0x33')],function(_0x5a4000){return{'name':_0x5a4000[_0xb331('0x34')],'type':_0x5a4000['type']['key']};});_0x691d79[_0xb331('0x35')]=_[_0xb331('0x31')](_0x80a23d,_0xb331('0x2f'));_0x691d79[_0xb331('0x36')]=_[_0xb331('0x37')](_0x163d54['query']);_0x691d79['filters']=_['intersection'](_0x691d79[_0xb331('0x35')],_0x691d79[_0xb331('0x36')]);_0x2ad787[_0xb331('0x38')]=_[_0xb331('0x39')](_0x691d79[_0xb331('0x35')],qs[_0xb331('0x3a')](_0x163d54[_0xb331('0x36')][_0xb331('0x3a')]));_0x2ad787[_0xb331('0x38')]=_0x2ad787['attributes']['length']?_0x2ad787[_0xb331('0x38')]:_0x691d79['model'];if(!_0x163d54['query'][_0xb331('0x3b')](_0xb331('0x3c'))){_0x2ad787[_0xb331('0x22')]=qs[_0xb331('0x22')](_0x163d54[_0xb331('0x36')]['limit']);_0x2ad787[_0xb331('0x1f')]=qs[_0xb331('0x1f')](_0x163d54['query'][_0xb331('0x1f')]);}_0x2ad787[_0xb331('0x3d')]=qs['sort'](_0x163d54['query'][_0xb331('0x3e')]);_0x2ad787[_0xb331('0x3f')]=qs[_0xb331('0x40')](_['pick'](_0x163d54[_0xb331('0x36')],_0x691d79[_0xb331('0x40')]),_0x80a23d);if(_0x163d54[_0xb331('0x36')][_0xb331('0x41')]){_0x2ad787[_0xb331('0x3f')]=_['merge'](_0x2ad787['where'],{'$or':_[_0xb331('0x31')](_0x80a23d,function(_0x89e051){if(_0x89e051[_0xb331('0x42')]!=='VIRTUAL'){var _0x30bb71={};_0x30bb71[_0x89e051['name']]={'$like':'%'+_0x163d54[_0xb331('0x36')][_0xb331('0x41')]+'%'};return _0x30bb71;}})});}_0x2ad787=_[_0xb331('0x43')]({},_0x2ad787,_0x163d54[_0xb331('0x44')]);var _0x3018dc={'where':_0x2ad787[_0xb331('0x3f')]};return db[_0xb331('0x32')][_0xb331('0x21')](_0x3018dc)[_0xb331('0x29')](function(_0x1ac072){_0x44185c[_0xb331('0x21')]=_0x1ac072;if(_0x163d54[_0xb331('0x36')][_0xb331('0x45')]){_0x2ad787[_0xb331('0x46')]=[{'all':!![]}];}return db['Dashboard'][_0xb331('0x47')](_0x2ad787);})[_0xb331('0x29')](function(_0x4abe5e){_0x44185c[_0xb331('0x48')]=_0x4abe5e;return _0x44185c;})['then'](respondWithFilteredResult(_0x18a964,_0x2ad787))[_0xb331('0x49')](handleError(_0x18a964,null));};exports[_0xb331('0x4a')]=function(_0x5b4e5f,_0x317c85){var _0x3b090e={'raw':![],'where':{'id':_0x5b4e5f['params']['id']}},_0x5ab4f0={};_0x5ab4f0[_0xb331('0x35')]=_['keys'](db['Dashboard']['rawAttributes']);_0x5ab4f0[_0xb331('0x36')]=_[_0xb331('0x37')](_0x5b4e5f[_0xb331('0x36')]);_0x5ab4f0[_0xb331('0x40')]=_[_0xb331('0x39')](_0x5ab4f0['model'],_0x5ab4f0[_0xb331('0x36')]);_0x3b090e[_0xb331('0x38')]=_[_0xb331('0x39')](_0x5ab4f0[_0xb331('0x35')],qs[_0xb331('0x3a')](_0x5b4e5f['query'][_0xb331('0x3a')]));_0x3b090e[_0xb331('0x38')]=_0x3b090e['attributes'][_0xb331('0x4b')]?_0x3b090e[_0xb331('0x38')]:_0x5ab4f0['model'];if(_0x5b4e5f['query']['includeAll']){_0x3b090e[_0xb331('0x46')]=[{'all':!![]}];}_0x3b090e=_[_0xb331('0x43')]({},_0x3b090e,_0x5b4e5f['options']);return db[_0xb331('0x32')][_0xb331('0x4c')](_0x3b090e)['then'](handleEntityNotFound(_0x317c85,null))[_0xb331('0x29')](respondWithResult(_0x317c85,null))[_0xb331('0x49')](handleError(_0x317c85,null));};exports[_0xb331('0x4d')]=function(_0x4a303b,_0x53bb71){return db[_0xb331('0x32')][_0xb331('0x4d')](_0x4a303b['body'],{})[_0xb331('0x29')](function(_0x5963d9){var _0x4bd5e7=_0x4a303b[_0xb331('0x4e')][_0xb331('0x2b')]({'plain':!![]});if(!_0x4bd5e7)throw new Error(_0xb331('0x4f'));if(_0x4bd5e7[_0xb331('0x50')]==='user'){var _0x175b49=_0x5963d9[_0xb331('0x2b')]({'plain':!![]});var _0x4ebd51=_0xb331('0x51');return db[_0xb331('0x52')]['find']({'where':{'name':_0x4ebd51,'userProfileId':_0x4bd5e7[_0xb331('0x53')]},'raw':!![]})[_0xb331('0x29')](function(_0x22e148){if(_0x22e148&&_0x22e148[_0xb331('0x54')]===0x0){return db[_0xb331('0x2c')][_0xb331('0x4d')]({'name':_0x175b49[_0xb331('0x2f')],'resourceId':_0x175b49['id'],'type':_0x22e148[_0xb331('0x2f')],'sectionId':_0x22e148['id']},{})[_0xb331('0x29')](function(){return _0x5963d9;});}else{return _0x5963d9;}})['catch'](function(_0x487cce){logger['error'](_0xb331('0x55'),_0x487cce);throw _0x487cce;});}return _0x5963d9;})[_0xb331('0x29')](respondWithResult(_0x53bb71,0xc9))[_0xb331('0x49')](handleError(_0x53bb71,null));};exports[_0xb331('0x56')]=function(_0x508d29,_0x3d6864){var _0x409bf4={'where':{'id':_0x508d29[_0xb331('0x57')]['id']}},_0x27fe2f={};_0x27fe2f[_0xb331('0x35')]=_[_0xb331('0x37')](db['Dashboard'][_0xb331('0x33')]);_0x409bf4[_0xb331('0x38')]=_[_0xb331('0x39')](_0x27fe2f[_0xb331('0x35')],qs[_0xb331('0x3a')](_0x508d29['query'][_0xb331('0x3a')]));_0x409bf4['attributes']=_0x409bf4[_0xb331('0x38')][_0xb331('0x4b')]?_0x409bf4['attributes']:_0x27fe2f[_0xb331('0x35')];if(_0x508d29[_0xb331('0x36')][_0xb331('0x45')]){_0x409bf4[_0xb331('0x46')]=[{'all':!![]}];}_0x409bf4=_[_0xb331('0x43')]({},_0x409bf4,_0x508d29[_0xb331('0x44')]);return db['Dashboard'][_0xb331('0x4c')](_0x409bf4)[_0xb331('0x29')](handleEntityNotFound(_0x3d6864,null))[_0xb331('0x29')](function(_0x1ed4c0){if(_0x1ed4c0){var _0x448c1b=_0x1ed4c0[_0xb331('0x2b')]({'plain':!![]});_0x448c1b=qs['omit'](_0x448c1b,['id',_0xb331('0x58'),_0xb331('0x59')]);_0x508d29[_0xb331('0x5a')]=_[_0xb331('0x5b')](_0x508d29[_0xb331('0x5a')],['id',_0xb331('0x58'),_0xb331('0x59')]);return db['Dashboard'][_0xb331('0x4d')](_['merge'](_0x448c1b,_0x508d29[_0xb331('0x5a')]),{'include':_0x508d29['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x17017a){var _0x4dfb23=_0x508d29[_0xb331('0x4e')][_0xb331('0x2b')]({'plain':!![]});if(!_0x4dfb23)throw new Error(_0xb331('0x4f'));if(_0x4dfb23[_0xb331('0x50')]===_0xb331('0x4e')){var _0x25510e=_0x17017a[_0xb331('0x2b')]({'plain':!![]});var _0x274aca=_0xb331('0x51');return db[_0xb331('0x52')][_0xb331('0x4c')]({'where':{'name':_0x274aca,'userProfileId':_0x4dfb23['userProfileId']},'raw':!![]})['then'](function(_0x29da15){if(_0x29da15&&_0x29da15[_0xb331('0x54')]===0x0){return db[_0xb331('0x2c')][_0xb331('0x4d')]({'name':_0x25510e[_0xb331('0x2f')],'resourceId':_0x25510e['id'],'type':_0x29da15[_0xb331('0x2f')],'sectionId':_0x29da15['id']},{})['then'](function(){return _0x17017a;});}else{return _0x17017a;}})[_0xb331('0x49')](function(_0x2e5dd2){logger[_0xb331('0x2d')](_0xb331('0x55'),_0x2e5dd2);throw _0x2e5dd2;});}return _0x17017a;});}})[_0xb331('0x29')](respondWithResult(_0x3d6864,0xc9))['catch'](handleError(_0x3d6864,null));};exports['update']=function(_0x570257,_0x31dec9){if(_0x570257['body']['id']){delete _0x570257[_0xb331('0x5a')]['id'];}return db[_0xb331('0x32')][_0xb331('0x4c')]({'where':{'id':_0x570257[_0xb331('0x57')]['id']}})[_0xb331('0x29')](handleEntityNotFound(_0x31dec9,null))[_0xb331('0x29')](saveUpdates(_0x570257['body'],null))[_0xb331('0x29')](respondWithResult(_0x31dec9,null))[_0xb331('0x49')](handleError(_0x31dec9,null));};exports[_0xb331('0x2a')]=function(_0x3784a9,_0x26a2c3){return db[_0xb331('0x32')]['find']({'where':{'id':_0x3784a9[_0xb331('0x57')]['id']}})[_0xb331('0x29')](handleEntityNotFound(_0x26a2c3,null))[_0xb331('0x29')](removeEntity(_0x26a2c3,null))[_0xb331('0x49')](handleError(_0x26a2c3,null));};function widgetAttributes(_0x5f27b1){try{switch(_0x5f27b1[_0xb331('0x42')]){case _0xb331('0x5c'):return[{'name':_0xb331('0x5d'),'value':_0x5f27b1[_0xb331('0x5d')]||(_0x5f27b1['attrs']&&_0x5f27b1[_0xb331('0x5e')][0x0]?_0x5f27b1[_0xb331('0x5e')][0x0][_0xb331('0x5f')]:undefined)||_0xb331('0x60')}];case _0xb331('0x61'):return[{'name':'attrPath','value':_0x5f27b1[_0xb331('0x62')]||(_0x5f27b1['attrs']&&_0x5f27b1[_0xb331('0x5e')][0x0]?_0x5f27b1[_0xb331('0x5e')][0x0][_0xb331('0x5f')]:undefined)||''}];case'clock':return[{'name':_0xb331('0x63'),'value':_0x5f27b1[_0xb331('0x63')]||(_0x5f27b1['attrs']&&_0x5f27b1[_0xb331('0x5e')][0x0]?_0x5f27b1[_0xb331('0x5e')][0x0][_0xb331('0x5f')]:undefined)||_0xb331('0x64')},{'name':'attrTimezone','value':_0x5f27b1[_0xb331('0x65')]||(_0x5f27b1['attrs']&&_0x5f27b1[_0xb331('0x5e')][0x1]?_0x5f27b1[_0xb331('0x5e')][0x1]['value']:undefined)||_0xb331('0x66')},{'name':_0xb331('0x67'),'value':_0x5f27b1['attrFontSize']||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x2]?_0x5f27b1['attrs'][0x2][_0xb331('0x5f')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x5f27b1[_0xb331('0x68')]||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x0]?_0x5f27b1[_0xb331('0x5e')][0x0]['value']:undefined)||_0xb331('0x69')},{'name':_0xb331('0x6a'),'value':_0x5f27b1[_0xb331('0x6a')]||(_0x5f27b1['attrs']&&_0x5f27b1[_0xb331('0x5e')][0x1]?_0x5f27b1[_0xb331('0x5e')][0x1][_0xb331('0x5f')]:undefined)||[]},{'name':_0xb331('0x67'),'value':_0x5f27b1['attrFontSize']||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x2]?_0x5f27b1['attrs'][0x2][_0xb331('0x5f')]:undefined)||0x14},{'name':'attrChannel','value':_0x5f27b1[_0xb331('0x6b')]||(_0x5f27b1['attrs']&&_0x5f27b1['attrs'][0x3]?_0x5f27b1['attrs'][0x3][_0xb331('0x5f')]:undefined)||_0xb331('0x6c')},{'name':_0xb331('0x6d'),'value':_0x5f27b1['attrEmailAccounts']||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x4]?_0x5f27b1[_0xb331('0x5e')][0x4][_0xb331('0x5f')]:undefined)||''},{'name':_0xb331('0x6e'),'value':_0x5f27b1[_0xb331('0x6e')]||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x5]?_0x5f27b1[_0xb331('0x5e')][0x5][_0xb331('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5f27b1['attrSmsAccounts']||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x6]?_0x5f27b1[_0xb331('0x5e')][0x6][_0xb331('0x5f')]:undefined)||''},{'name':_0xb331('0x6f'),'value':_0x5f27b1[_0xb331('0x6f')]||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1['attrs'][0x7]?_0x5f27b1[_0xb331('0x5e')][0x7]['value']:undefined)||''},{'name':_0xb331('0x70'),'value':_0x5f27b1[_0xb331('0x70')]||(_0x5f27b1['attrs']&&_0x5f27b1[_0xb331('0x5e')][0x8]?_0x5f27b1[_0xb331('0x5e')][0x8][_0xb331('0x5f')]:undefined)||''},{'name':_0xb331('0x71'),'value':_0x5f27b1[_0xb331('0x71')]||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x9]?_0x5f27b1['attrs'][0x9]['value']:undefined)||''}];case _0xb331('0x72'):case _0xb331('0x73'):return[{'name':'attrSerie1','value':_0x5f27b1[_0xb331('0x74')]||(_0x5f27b1['attrs']&&_0x5f27b1[_0xb331('0x5e')][0x0]?_0x5f27b1[_0xb331('0x5e')][0x0][_0xb331('0x5f')]:undefined)||_0xb331('0x69')},{'name':_0xb331('0x75'),'value':_0x5f27b1[_0xb331('0x75')]||(_0x5f27b1['attrs']&&_0x5f27b1['attrs'][0x1]?_0x5f27b1[_0xb331('0x5e')][0x1]['value']:undefined)||null},{'name':_0xb331('0x76'),'value':_0x5f27b1[_0xb331('0x76')]||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x2]?_0x5f27b1[_0xb331('0x5e')][0x2][_0xb331('0x5f')]:undefined)||null},{'name':_0xb331('0x6a'),'value':_0x5f27b1['attrVoiceQueues']||(_0x5f27b1['attrs']&&_0x5f27b1[_0xb331('0x5e')][0x3]?_0x5f27b1[_0xb331('0x5e')][0x3][_0xb331('0x5f')]:undefined)||[]},{'name':_0xb331('0x6b'),'value':_0x5f27b1[_0xb331('0x6b')]||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1['attrs'][0x4]?_0x5f27b1['attrs'][0x4][_0xb331('0x5f')]:undefined)||_0xb331('0x6c')},{'name':'attrEmailAccounts','value':_0x5f27b1['attrEmailAccounts']||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x5]?_0x5f27b1[_0xb331('0x5e')][0x5][_0xb331('0x5f')]:undefined)||''},{'name':_0xb331('0x6e'),'value':_0x5f27b1['attrFaxAccounts']||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x6]?_0x5f27b1[_0xb331('0x5e')][0x6][_0xb331('0x5f')]:undefined)||''},{'name':_0xb331('0x77'),'value':_0x5f27b1[_0xb331('0x77')]||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x7]?_0x5f27b1[_0xb331('0x5e')][0x7][_0xb331('0x5f')]:undefined)||''},{'name':_0xb331('0x6f'),'value':_0x5f27b1['attrOpenchannelAccounts']||(_0x5f27b1['attrs']&&_0x5f27b1['attrs'][0x8]?_0x5f27b1[_0xb331('0x5e')][0x8][_0xb331('0x5f')]:undefined)||''},{'name':_0xb331('0x70'),'value':_0x5f27b1[_0xb331('0x70')]||(_0x5f27b1['attrs']&&_0x5f27b1['attrs'][0x9]?_0x5f27b1[_0xb331('0x5e')][0x9][_0xb331('0x5f')]:undefined)||''},{'name':_0xb331('0x71'),'value':_0x5f27b1[_0xb331('0x71')]||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0xa]?_0x5f27b1['attrs'][0xa][_0xb331('0x5f')]:undefined)||''}];case _0xb331('0x78'):return[{'name':_0xb331('0x79'),'type':_0x5f27b1[_0xb331('0x7a')]||(_0x5f27b1['attrs']&&_0x5f27b1[_0xb331('0x5e')][0x0]?_0x5f27b1[_0xb331('0x5e')][0x0]['type']:undefined)||null,'value':_0x5f27b1['attrReport']||(_0x5f27b1['attrs']&&_0x5f27b1['attrs'][0x0]?_0x5f27b1[_0xb331('0x5e')][0x0][_0xb331('0x5f')]:undefined)||null},{'name':_0xb331('0x7b'),'value':_0x5f27b1[_0xb331('0x7b')]||(_0x5f27b1[_0xb331('0x5e')]&&_0x5f27b1[_0xb331('0x5e')][0x1]?_0x5f27b1['attrs'][0x1][_0xb331('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x3d4247){logger[_0xb331('0x2d')](_0xb331('0x7c'),JSON['stringify'](_0x3d4247));return[];}}exports[_0xb331('0x7d')]=function(_0x57a0dc,_0x430af5,_0x5962ea){if(_0x57a0dc['body']['id']){delete _0x57a0dc[_0xb331('0x5a')]['id'];}return db[_0xb331('0x32')]['find']({'where':{'id':_0x57a0dc[_0xb331('0x57')]['id']}})['then'](handleEntityNotFound(_0x430af5,null))['then'](function(_0x3a9dd5){if(_0x3a9dd5){_0x57a0dc[_0xb331('0x5a')][_0xb331('0x7e')]=_0x3a9dd5['id'];_0x57a0dc[_0xb331('0x5a')]['attrs']=widgetAttributes(_0x57a0dc[_0xb331('0x5a')]);return db[_0xb331('0x7f')][_0xb331('0x4d')](_0x57a0dc['body']);}})[_0xb331('0x29')](respondWithResult(_0x430af5,null))['catch'](handleError(_0x430af5,null));};exports['getItems']=function(_0x568352,_0x534336,_0xbbfc3f){var _0x234ee0={};var _0xfd2ac3={};var _0x82b26;var _0x53d35b;return db[_0xb331('0x32')][_0xb331('0x80')]({'where':{'id':_0x568352[_0xb331('0x57')]['id']}})['then'](handleEntityNotFound(_0x534336,null))[_0xb331('0x29')](function(_0x5321ad){if(_0x5321ad){_0x82b26=_0x5321ad;_0xfd2ac3[_0xb331('0x35')]=_[_0xb331('0x37')](db[_0xb331('0x7f')][_0xb331('0x33')]);_0xfd2ac3['query']=_[_0xb331('0x37')](_0x568352[_0xb331('0x36')]);_0xfd2ac3[_0xb331('0x40')]=_[_0xb331('0x39')](_0xfd2ac3[_0xb331('0x35')],_0xfd2ac3[_0xb331('0x36')]);_0x234ee0[_0xb331('0x38')]=_[_0xb331('0x39')](_0xfd2ac3[_0xb331('0x35')],qs['fields'](_0x568352[_0xb331('0x36')][_0xb331('0x3a')]));_0x234ee0[_0xb331('0x38')]=_0x234ee0[_0xb331('0x38')]['length']?_0x234ee0['attributes']:_0xfd2ac3[_0xb331('0x35')];_0x234ee0['order']=qs[_0xb331('0x3e')](_0x568352[_0xb331('0x36')][_0xb331('0x3e')]);_0x234ee0['where']=qs[_0xb331('0x40')](_[_0xb331('0x81')](_0x568352[_0xb331('0x36')],_0xfd2ac3[_0xb331('0x40')]));if(_0x568352[_0xb331('0x36')]['filter']){_0x234ee0['where']=_['merge'](_0x234ee0['where'],{'$or':_[_0xb331('0x31')](_0x234ee0[_0xb331('0x38')],function(_0x888459){var _0x488dd5={};_0x488dd5[_0x888459]={'$like':'%'+_0x568352[_0xb331('0x36')][_0xb331('0x41')]+'%'};return _0x488dd5;})});}_0x234ee0=_[_0xb331('0x43')]({},_0x234ee0,_0x568352[_0xb331('0x44')]);return _0x82b26[_0xb331('0x82')](_0x234ee0);}})['then'](function(_0x4e93fd){if(_0x4e93fd){_0x53d35b=_0x4e93fd['length'];if(!_0x568352[_0xb331('0x36')][_0xb331('0x3b')](_0xb331('0x3c'))){_0x234ee0[_0xb331('0x22')]=qs[_0xb331('0x22')](_0x568352['query'][_0xb331('0x22')]);_0x234ee0[_0xb331('0x1f')]=qs['offset'](_0x568352[_0xb331('0x36')][_0xb331('0x1f')]);}return _0x82b26['getItems'](_0x234ee0);}})[_0xb331('0x29')](function(_0x42f633){if(_0x42f633){return _0x42f633?{'count':_0x53d35b,'rows':_0x42f633}:null;}})[_0xb331('0x29')](respondWithResult(_0x534336,null))[_0xb331('0x49')](handleError(_0x534336,null));};
\ No newline at end of file