Built motion from commit dbf3a7e2.|2.6.30
[motion2.git] / server / api / dashboardItem / dashboardItem.controller.js
index ca52bc2..4556ba4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd0a=['stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrSmsAccounts','web-report','attrRefresh','stringify','create','body','DashboardItem','find','params','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x5ebb4d,_0x3180ec){var _0x7e1980=function(_0x1ec1dd){while(--_0x1ec1dd){_0x5ebb4d['push'](_0x5ebb4d['shift']());}};_0x7e1980(++_0x3180ec);}(_0xbd0a,0x1b9));var _0xabd0=function(_0xd818c8,_0x2fb8c8){_0xd818c8=_0xd818c8-0x0;var _0x5ed974=_0xbd0a[_0xd818c8];return _0x5ed974;};'use strict';var emlformat=require(_0xabd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xabd0('0x2'));var Mustache=require(_0xabd0('0x3'));var util=require(_0xabd0('0x4'));var path=require(_0xabd0('0x5'));var sox=require(_0xabd0('0x6'));var csv=require(_0xabd0('0x7'));var ejs=require(_0xabd0('0x8'));var fs=require('fs');var fs_extra=require(_0xabd0('0x9'));var _=require(_0xabd0('0xa'));var squel=require('squel');var crypto=require(_0xabd0('0xb'));var jsforce=require(_0xabd0('0xc'));var deskjs=require(_0xabd0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabd0('0xe'));var Papa=require('papaparse');var Redis=require(_0xabd0('0xf'));var authService=require(_0xabd0('0x10'));var qs=require(_0xabd0('0x11'));var as=require(_0xabd0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabd0('0x13'))('api');var utils=require(_0xabd0('0x14'));var config=require(_0xabd0('0x15'));var licenseUtil=require(_0xabd0('0x16'));var db=require(_0xabd0('0x17'))['db'];config[_0xabd0('0x18')]=_[_0xabd0('0x19')](config['redis'],{'host':_0xabd0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabd0('0x18')]));require(_0xabd0('0x1b'))['register'](socket);function respondWithStatusCode(_0x56ba31,_0x4ca156){_0x4ca156=_0x4ca156||0xcc;return function(_0x53acfc){if(_0x53acfc){return _0x56ba31[_0xabd0('0x1c')](_0x4ca156);}return _0x56ba31[_0xabd0('0x1d')](_0x4ca156)[_0xabd0('0x1e')]();};}function respondWithResult(_0xdb7a40,_0x169611){_0x169611=_0x169611||0xc8;return function(_0x28ddcf){if(_0x28ddcf){return _0xdb7a40[_0xabd0('0x1d')](_0x169611)[_0xabd0('0x1f')](_0x28ddcf);}};}function respondWithFilteredResult(_0x2d17b1,_0x543461){return function(_0x3a0ace){if(_0x3a0ace){var _0x5de1df=typeof _0x543461['offset']===_0xabd0('0x20')&&typeof _0x543461[_0xabd0('0x21')]===_0xabd0('0x20');var _0x23f955=_0x3a0ace['count'];var _0x862492=_0x5de1df?0x0:_0x543461[_0xabd0('0x22')];var _0x4eed20=_0x5de1df?_0x3a0ace['count']:_0x543461[_0xabd0('0x22')]+_0x543461[_0xabd0('0x21')];var _0x4d9416;if(_0x4eed20>=_0x23f955){_0x4eed20=_0x23f955;_0x4d9416=0xc8;}else{_0x4d9416=0xce;}_0x2d17b1[_0xabd0('0x1d')](_0x4d9416);return _0x2d17b1[_0xabd0('0x23')](_0xabd0('0x24'),_0x862492+'-'+_0x4eed20+'/'+_0x23f955)[_0xabd0('0x1f')](_0x3a0ace);}return null;};}function patchUpdates(_0x4c9f3a){return function(_0x1b1079){try{jsonpatch[_0xabd0('0x25')](_0x1b1079,_0x4c9f3a,!![]);}catch(_0x3376bc){return BPromise[_0xabd0('0x26')](_0x3376bc);}return _0x1b1079[_0xabd0('0x27')]();};}function saveUpdates(_0xf6dbad,_0x48c4a1){return function(_0x16f7be){if(_0x16f7be){return _0x16f7be[_0xabd0('0x28')](_0xf6dbad)[_0xabd0('0x29')](function(_0x52c8be){return _0x52c8be;});}return null;};}function removeEntity(_0x369dd0,_0x2699c4){return function(_0x30739e){if(_0x30739e){return _0x30739e[_0xabd0('0x2a')]()[_0xabd0('0x29')](function(){_0x369dd0[_0xabd0('0x1d')](0xcc)[_0xabd0('0x1e')]();});}};}function handleEntityNotFound(_0x3a10d6,_0x392b05){return function(_0x38c553){if(!_0x38c553){_0x3a10d6[_0xabd0('0x1c')](0x194);}return _0x38c553;};}function handleError(_0x2fcbe8,_0x465749){_0x465749=_0x465749||0x1f4;return function(_0x3246de){logger[_0xabd0('0x2b')](_0x3246de[_0xabd0('0x2c')]);if(_0x3246de['name']){delete _0x3246de[_0xabd0('0x2d')];}_0x2fcbe8[_0xabd0('0x1d')](_0x465749)[_0xabd0('0x2e')](_0x3246de);};}exports[_0xabd0('0x2f')]=function(_0x58f687,_0x1ef94b){var _0x30c608={'raw':![],'where':{'id':_0x58f687['params']['id']}},_0x20ff0a={};_0x20ff0a[_0xabd0('0x30')]=_[_0xabd0('0x31')](db['DashboardItem'][_0xabd0('0x32')]);_0x20ff0a['query']=_[_0xabd0('0x31')](_0x58f687[_0xabd0('0x33')]);_0x20ff0a[_0xabd0('0x34')]=_[_0xabd0('0x35')](_0x20ff0a[_0xabd0('0x30')],_0x20ff0a[_0xabd0('0x33')]);_0x30c608['attributes']=_[_0xabd0('0x35')](_0x20ff0a[_0xabd0('0x30')],qs[_0xabd0('0x36')](_0x58f687[_0xabd0('0x33')][_0xabd0('0x36')]));_0x30c608[_0xabd0('0x37')]=_0x30c608[_0xabd0('0x37')][_0xabd0('0x38')]?_0x30c608[_0xabd0('0x37')]:_0x20ff0a[_0xabd0('0x30')];if(_0x58f687[_0xabd0('0x33')][_0xabd0('0x39')]){_0x30c608[_0xabd0('0x3a')]=[{'all':!![]}];}_0x30c608=_[_0xabd0('0x3b')]({},_0x30c608,_0x58f687[_0xabd0('0x3c')]);return db['DashboardItem']['find'](_0x30c608)['then'](handleEntityNotFound(_0x1ef94b,null))[_0xabd0('0x29')](respondWithResult(_0x1ef94b,null))[_0xabd0('0x3d')](handleError(_0x1ef94b,null));};exports[_0xabd0('0x2a')]=function(_0x3a99ee,_0x2a7a18){return db['DashboardItem']['find']({'where':{'id':_0x3a99ee['params']['id']}})[_0xabd0('0x29')](handleEntityNotFound(_0x2a7a18,null))['then'](removeEntity(_0x2a7a18,null))[_0xabd0('0x3d')](handleError(_0x2a7a18,null));};function widgetAttributes(_0x2acff1){try{switch(_0x2acff1[_0xabd0('0x3e')]){case _0xabd0('0x3f'):return[{'name':_0xabd0('0x40'),'value':_0x2acff1[_0xabd0('0x40')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1['attrs'][0x0][_0xabd0('0x42')]:undefined)||'https://'}];case'custom':return[{'name':_0xabd0('0x43'),'value':_0x2acff1[_0xabd0('0x43')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1[_0xabd0('0x41')][0x0]['value']:undefined)||''}];case _0xabd0('0x44'):return[{'name':_0xabd0('0x45'),'value':_0x2acff1[_0xabd0('0x45')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1['attrs'][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x42')]:undefined)||_0xabd0('0x46')},{'name':_0xabd0('0x47'),'value':_0x2acff1[_0xabd0('0x47')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x1]?_0x2acff1[_0xabd0('0x41')][0x1][_0xabd0('0x42')]:undefined)||_0xabd0('0x48')},{'name':_0xabd0('0x49'),'value':_0x2acff1[_0xabd0('0x49')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1['attrs'][0x2]?_0x2acff1[_0xabd0('0x41')][0x2][_0xabd0('0x42')]:undefined)||0xc}];case _0xabd0('0x4a'):return[{'name':'attrMetric','value':_0x2acff1['attrMetric']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x42')]:undefined)||_0xabd0('0x4b')},{'name':'attrVoiceQueues','value':_0x2acff1['attrVoiceQueues']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x1]?_0x2acff1[_0xabd0('0x41')][0x1][_0xabd0('0x42')]:undefined)||[]},{'name':_0xabd0('0x49'),'value':_0x2acff1['attrFontSize']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x2]?_0x2acff1[_0xabd0('0x41')][0x2]['value']:undefined)||0x14},{'name':_0xabd0('0x4c'),'value':_0x2acff1[_0xabd0('0x4c')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x3]?_0x2acff1['attrs'][0x3][_0xabd0('0x42')]:undefined)||_0xabd0('0x4d')},{'name':_0xabd0('0x4e'),'value':_0x2acff1[_0xabd0('0x4e')]||(_0x2acff1['attrs']&&_0x2acff1[_0xabd0('0x41')][0x4]?_0x2acff1[_0xabd0('0x41')][0x4][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x4f'),'value':_0x2acff1[_0xabd0('0x4f')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1['attrs'][0x5]?_0x2acff1['attrs'][0x5][_0xabd0('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2acff1['attrSmsAccounts']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x6]?_0x2acff1[_0xabd0('0x41')][0x6][_0xabd0('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2acff1[_0xabd0('0x50')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x7]?_0x2acff1[_0xabd0('0x41')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2acff1[_0xabd0('0x51')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x8]?_0x2acff1[_0xabd0('0x41')][0x8][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x52'),'value':_0x2acff1[_0xabd0('0x52')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x9]?_0x2acff1['attrs'][0x9][_0xabd0('0x42')]:undefined)||''}];case _0xabd0('0x53'):case'pie-chart':return[{'name':_0xabd0('0x54'),'value':_0x2acff1[_0xabd0('0x54')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x42')]:undefined)||'total'},{'name':_0xabd0('0x55'),'value':_0x2acff1[_0xabd0('0x55')]||(_0x2acff1['attrs']&&_0x2acff1[_0xabd0('0x41')][0x1]?_0x2acff1[_0xabd0('0x41')][0x1]['value']:undefined)||null},{'name':_0xabd0('0x56'),'value':_0x2acff1[_0xabd0('0x56')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x2]?_0x2acff1[_0xabd0('0x41')][0x2][_0xabd0('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2acff1[_0xabd0('0x57')]||(_0x2acff1['attrs']&&_0x2acff1[_0xabd0('0x41')][0x3]?_0x2acff1[_0xabd0('0x41')][0x3][_0xabd0('0x42')]:undefined)||[]},{'name':_0xabd0('0x4c'),'value':_0x2acff1[_0xabd0('0x4c')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x4]?_0x2acff1[_0xabd0('0x41')][0x4][_0xabd0('0x42')]:undefined)||_0xabd0('0x4d')},{'name':_0xabd0('0x4e'),'value':_0x2acff1['attrEmailAccounts']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x5]?_0x2acff1['attrs'][0x5][_0xabd0('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2acff1[_0xabd0('0x4f')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x6]?_0x2acff1[_0xabd0('0x41')][0x6][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x58'),'value':_0x2acff1['attrSmsAccounts']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x7]?_0x2acff1['attrs'][0x7][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x50'),'value':_0x2acff1[_0xabd0('0x50')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x8]?_0x2acff1[_0xabd0('0x41')][0x8]['value']:undefined)||''},{'name':_0xabd0('0x51'),'value':_0x2acff1['attrWhatsappAccounts']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x9]?_0x2acff1[_0xabd0('0x41')][0x9][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x52'),'value':_0x2acff1['attrChatWebsites']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0xa]?_0x2acff1['attrs'][0xa]['value']:undefined)||''}];case _0xabd0('0x59'):return[{'name':'attrReport','type':_0x2acff1['reportType']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x3e')]:undefined)||null,'value':_0x2acff1['attrReport']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1['attrs'][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x42')]:undefined)||null},{'name':_0xabd0('0x5a'),'value':_0x2acff1[_0xabd0('0x5a')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x1]?_0x2acff1['attrs'][0x1][_0xabd0('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x2a29e0){logger[_0xabd0('0x2b')]('widgetAttributes:\x20%s',JSON[_0xabd0('0x5b')](_0x2a29e0));return[];}}exports[_0xabd0('0x5c')]=function(_0x3f688d,_0x4c5c75){if(_0x3f688d[_0xabd0('0x5d')]){_0x3f688d[_0xabd0('0x5d')]['attrs']=widgetAttributes(_0x3f688d['body']);}return db[_0xabd0('0x5e')][_0xabd0('0x5c')](_0x3f688d[_0xabd0('0x5d')],{})['then'](respondWithResult(_0x4c5c75,0xc9))['catch'](handleError(_0x4c5c75,null));};exports[_0xabd0('0x28')]=function(_0x4c6ca1,_0x33992d){if(_0x4c6ca1[_0xabd0('0x5d')]['id']){delete _0x4c6ca1[_0xabd0('0x5d')]['id'];}_0x4c6ca1[_0xabd0('0x5d')][_0xabd0('0x41')]=widgetAttributes(_0x4c6ca1[_0xabd0('0x5d')]);return db[_0xabd0('0x5e')][_0xabd0('0x5f')]({'where':{'id':_0x4c6ca1[_0xabd0('0x60')]['id']}})[_0xabd0('0x29')](handleEntityNotFound(_0x33992d,null))['then'](saveUpdates(_0x4c6ca1[_0xabd0('0x5d')],null))[_0xabd0('0x29')](respondWithResult(_0x33992d,null))[_0xabd0('0x3d')](handleError(_0x33992d,null));};
\ No newline at end of file
+var _0x77f7=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','attrFontSize','counter','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x77f7,0xbd));var _0x777f=function(_0x391d6e,_0x2a6d9c){_0x391d6e=_0x391d6e-0x0;var _0x198355=_0x77f7[_0x391d6e];return _0x198355;};'use strict';var emlformat=require(_0x777f('0x0'));var rimraf=require(_0x777f('0x1'));var zipdir=require(_0x777f('0x2'));var jsonpatch=require(_0x777f('0x3'));var rp=require(_0x777f('0x4'));var moment=require(_0x777f('0x5'));var BPromise=require(_0x777f('0x6'));var Mustache=require(_0x777f('0x7'));var util=require(_0x777f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x777f('0x9'));var ejs=require(_0x777f('0xa'));var fs=require('fs');var fs_extra=require(_0x777f('0xb'));var _=require(_0x777f('0xc'));var squel=require(_0x777f('0xd'));var crypto=require(_0x777f('0xe'));var jsforce=require(_0x777f('0xf'));var deskjs=require(_0x777f('0x10'));var toCsv=require(_0x777f('0x9'));var querystring=require(_0x777f('0x11'));var Papa=require('papaparse');var Redis=require(_0x777f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x777f('0x13'));var as=require(_0x777f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x777f('0x15'))(_0x777f('0x16'));var utils=require(_0x777f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x777f('0x18'));var db=require(_0x777f('0x19'))['db'];config[_0x777f('0x1a')]=_[_0x777f('0x1b')](config[_0x777f('0x1a')],{'host':_0x777f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x777f('0x1a')]));require(_0x777f('0x1d'))['register'](socket);function respondWithStatusCode(_0x36652d,_0x187bcb){_0x187bcb=_0x187bcb||0xcc;return function(_0x198805){if(_0x198805){return _0x36652d[_0x777f('0x1e')](_0x187bcb);}return _0x36652d[_0x777f('0x1f')](_0x187bcb)[_0x777f('0x20')]();};}function respondWithResult(_0x41855a,_0x4cdaa9){_0x4cdaa9=_0x4cdaa9||0xc8;return function(_0x856923){if(_0x856923){return _0x41855a[_0x777f('0x1f')](_0x4cdaa9)[_0x777f('0x21')](_0x856923);}};}function respondWithFilteredResult(_0x1ef1c5,_0x361759){return function(_0x3aeb58){if(_0x3aeb58){var _0x4038e2=typeof _0x361759['offset']==='undefined'&&typeof _0x361759[_0x777f('0x22')]===_0x777f('0x23');var _0x31f786=_0x3aeb58[_0x777f('0x24')];var _0xa0c7f1=_0x4038e2?0x0:_0x361759[_0x777f('0x25')];var _0x1897f0=_0x4038e2?_0x3aeb58[_0x777f('0x24')]:_0x361759['offset']+_0x361759[_0x777f('0x22')];var _0x5637d0;if(_0x1897f0>=_0x31f786){_0x1897f0=_0x31f786;_0x5637d0=0xc8;}else{_0x5637d0=0xce;}_0x1ef1c5[_0x777f('0x1f')](_0x5637d0);return _0x1ef1c5[_0x777f('0x26')](_0x777f('0x27'),_0xa0c7f1+'-'+_0x1897f0+'/'+_0x31f786)[_0x777f('0x21')](_0x3aeb58);}return null;};}function patchUpdates(_0x3a0c1d){return function(_0x1654c4){try{jsonpatch[_0x777f('0x28')](_0x1654c4,_0x3a0c1d,!![]);}catch(_0x5732c6){return BPromise[_0x777f('0x29')](_0x5732c6);}return _0x1654c4[_0x777f('0x2a')]();};}function saveUpdates(_0x5089ba,_0x24ede2){return function(_0x52d4fc){if(_0x52d4fc){return _0x52d4fc[_0x777f('0x2b')](_0x5089ba)[_0x777f('0x2c')](function(_0x109a8e){return _0x109a8e;});}return null;};}function removeEntity(_0x3fe93d,_0x43a7c1){return function(_0x38d48a){if(_0x38d48a){return _0x38d48a[_0x777f('0x2d')]()[_0x777f('0x2c')](function(){_0x3fe93d[_0x777f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b865c,_0x16ca18){return function(_0x37655d){if(!_0x37655d){_0x5b865c[_0x777f('0x1e')](0x194);}return _0x37655d;};}function handleError(_0x1e7a4b,_0x16222c){_0x16222c=_0x16222c||0x1f4;return function(_0x32007e){logger[_0x777f('0x2e')](_0x32007e['stack']);if(_0x32007e[_0x777f('0x2f')]){delete _0x32007e[_0x777f('0x2f')];}_0x1e7a4b['status'](_0x16222c)[_0x777f('0x30')](_0x32007e);};}exports[_0x777f('0x31')]=function(_0x573752,_0x502924){var _0x263fa2={'raw':![],'where':{'id':_0x573752[_0x777f('0x32')]['id']}},_0x10e02e={};_0x10e02e[_0x777f('0x33')]=_[_0x777f('0x34')](db[_0x777f('0x35')][_0x777f('0x36')]);_0x10e02e[_0x777f('0x37')]=_[_0x777f('0x34')](_0x573752[_0x777f('0x37')]);_0x10e02e['filters']=_[_0x777f('0x38')](_0x10e02e[_0x777f('0x33')],_0x10e02e[_0x777f('0x37')]);_0x263fa2[_0x777f('0x39')]=_[_0x777f('0x38')](_0x10e02e[_0x777f('0x33')],qs['fields'](_0x573752[_0x777f('0x37')][_0x777f('0x3a')]));_0x263fa2['attributes']=_0x263fa2[_0x777f('0x39')]['length']?_0x263fa2['attributes']:_0x10e02e[_0x777f('0x33')];if(_0x573752[_0x777f('0x37')][_0x777f('0x3b')]){_0x263fa2[_0x777f('0x3c')]=[{'all':!![]}];}_0x263fa2=_[_0x777f('0x3d')]({},_0x263fa2,_0x573752[_0x777f('0x3e')]);return db[_0x777f('0x35')][_0x777f('0x3f')](_0x263fa2)['then'](handleEntityNotFound(_0x502924,null))['then'](respondWithResult(_0x502924,null))[_0x777f('0x40')](handleError(_0x502924,null));};exports[_0x777f('0x2d')]=function(_0x1978bd,_0x23d1e5){return db[_0x777f('0x35')][_0x777f('0x3f')]({'where':{'id':_0x1978bd[_0x777f('0x32')]['id']}})[_0x777f('0x2c')](handleEntityNotFound(_0x23d1e5,null))['then'](removeEntity(_0x23d1e5,null))[_0x777f('0x40')](handleError(_0x23d1e5,null));};function widgetAttributes(_0x2f7007){try{switch(_0x2f7007[_0x777f('0x41')]){case _0x777f('0x42'):return[{'name':_0x777f('0x43'),'value':_0x2f7007[_0x777f('0x43')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x0]?_0x2f7007['attrs'][0x0]['value']:undefined)||_0x777f('0x45')}];case'custom':return[{'name':_0x777f('0x46'),'value':_0x2f7007[_0x777f('0x46')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x0]?_0x2f7007[_0x777f('0x44')][0x0]['value']:undefined)||''}];case _0x777f('0x47'):return[{'name':_0x777f('0x48'),'value':_0x2f7007[_0x777f('0x48')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x0]?_0x2f7007['attrs'][0x0][_0x777f('0x49')]:undefined)||_0x777f('0x4a')},{'name':_0x777f('0x4b'),'value':_0x2f7007[_0x777f('0x4b')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x1]?_0x2f7007[_0x777f('0x44')][0x1][_0x777f('0x49')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x2f7007[_0x777f('0x4c')]||(_0x2f7007['attrs']&&_0x2f7007['attrs'][0x2]?_0x2f7007[_0x777f('0x44')][0x2][_0x777f('0x49')]:undefined)||0xc}];case _0x777f('0x4d'):return[{'name':'attrMetric','value':_0x2f7007['attrMetric']||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x0]?_0x2f7007[_0x777f('0x44')][0x0][_0x777f('0x49')]:undefined)||'total'},{'name':_0x777f('0x4e'),'value':_0x2f7007[_0x777f('0x4e')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x1]?_0x2f7007[_0x777f('0x44')][0x1][_0x777f('0x49')]:undefined)||[]},{'name':_0x777f('0x4c'),'value':_0x2f7007[_0x777f('0x4c')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x2]?_0x2f7007[_0x777f('0x44')][0x2][_0x777f('0x49')]:undefined)||0x14},{'name':_0x777f('0x4f'),'value':_0x2f7007[_0x777f('0x4f')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007['attrs'][0x3]?_0x2f7007[_0x777f('0x44')][0x3][_0x777f('0x49')]:undefined)||_0x777f('0x50')},{'name':_0x777f('0x51'),'value':_0x2f7007['attrEmailAccounts']||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x4]?_0x2f7007[_0x777f('0x44')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x2f7007[_0x777f('0x52')]||(_0x2f7007['attrs']&&_0x2f7007['attrs'][0x5]?_0x2f7007[_0x777f('0x44')][0x5][_0x777f('0x49')]:undefined)||''},{'name':_0x777f('0x53'),'value':_0x2f7007[_0x777f('0x53')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x6]?_0x2f7007[_0x777f('0x44')][0x6][_0x777f('0x49')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2f7007[_0x777f('0x54')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x7]?_0x2f7007[_0x777f('0x44')][0x7][_0x777f('0x49')]:undefined)||''},{'name':_0x777f('0x55'),'value':_0x2f7007[_0x777f('0x55')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x8]?_0x2f7007[_0x777f('0x44')][0x8][_0x777f('0x49')]:undefined)||''},{'name':_0x777f('0x56'),'value':_0x2f7007[_0x777f('0x56')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x9]?_0x2f7007[_0x777f('0x44')][0x9][_0x777f('0x49')]:undefined)||''}];case'multibar-chart':case _0x777f('0x57'):return[{'name':'attrSerie1','value':_0x2f7007[_0x777f('0x58')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x0]?_0x2f7007[_0x777f('0x44')][0x0][_0x777f('0x49')]:undefined)||_0x777f('0x59')},{'name':_0x777f('0x5a'),'value':_0x2f7007[_0x777f('0x5a')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x1]?_0x2f7007[_0x777f('0x44')][0x1]['value']:undefined)||null},{'name':_0x777f('0x5b'),'value':_0x2f7007['attrSerie3']||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x2]?_0x2f7007[_0x777f('0x44')][0x2][_0x777f('0x49')]:undefined)||null},{'name':_0x777f('0x4e'),'value':_0x2f7007[_0x777f('0x4e')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x3]?_0x2f7007[_0x777f('0x44')][0x3][_0x777f('0x49')]:undefined)||[]},{'name':_0x777f('0x4f'),'value':_0x2f7007[_0x777f('0x4f')]||(_0x2f7007['attrs']&&_0x2f7007[_0x777f('0x44')][0x4]?_0x2f7007['attrs'][0x4][_0x777f('0x49')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x2f7007['attrEmailAccounts']||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x5]?_0x2f7007[_0x777f('0x44')][0x5][_0x777f('0x49')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2f7007[_0x777f('0x52')]||(_0x2f7007['attrs']&&_0x2f7007[_0x777f('0x44')][0x6]?_0x2f7007[_0x777f('0x44')][0x6][_0x777f('0x49')]:undefined)||''},{'name':_0x777f('0x53'),'value':_0x2f7007[_0x777f('0x53')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x7]?_0x2f7007[_0x777f('0x44')][0x7][_0x777f('0x49')]:undefined)||''},{'name':_0x777f('0x54'),'value':_0x2f7007[_0x777f('0x54')]||(_0x2f7007['attrs']&&_0x2f7007['attrs'][0x8]?_0x2f7007[_0x777f('0x44')][0x8][_0x777f('0x49')]:undefined)||''},{'name':_0x777f('0x55'),'value':_0x2f7007[_0x777f('0x55')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x9]?_0x2f7007['attrs'][0x9][_0x777f('0x49')]:undefined)||''},{'name':_0x777f('0x56'),'value':_0x2f7007[_0x777f('0x56')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0xa]?_0x2f7007['attrs'][0xa][_0x777f('0x49')]:undefined)||''}];case _0x777f('0x5c'):return[{'name':_0x777f('0x5d'),'type':_0x2f7007[_0x777f('0x5e')]||(_0x2f7007['attrs']&&_0x2f7007['attrs'][0x0]?_0x2f7007[_0x777f('0x44')][0x0]['type']:undefined)||null,'value':_0x2f7007[_0x777f('0x5d')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007[_0x777f('0x44')][0x0]?_0x2f7007[_0x777f('0x44')][0x0][_0x777f('0x49')]:undefined)||null},{'name':'attrRefresh','value':_0x2f7007[_0x777f('0x5f')]||(_0x2f7007[_0x777f('0x44')]&&_0x2f7007['attrs'][0x1]?_0x2f7007[_0x777f('0x44')][0x1][_0x777f('0x49')]:undefined)||0x0}];default:return[];}}catch(_0x14be8e){logger[_0x777f('0x2e')](_0x777f('0x60'),JSON['stringify'](_0x14be8e));return[];}}exports[_0x777f('0x61')]=function(_0x2d7b8a,_0x477db6){if(_0x2d7b8a['body']){_0x2d7b8a['body'][_0x777f('0x44')]=widgetAttributes(_0x2d7b8a[_0x777f('0x62')]);}return db[_0x777f('0x35')][_0x777f('0x61')](_0x2d7b8a['body'],{})[_0x777f('0x2c')](respondWithResult(_0x477db6,0xc9))['catch'](handleError(_0x477db6,null));};exports[_0x777f('0x2b')]=function(_0x49b44a,_0x107dc1){if(_0x49b44a['body']['id']){delete _0x49b44a[_0x777f('0x62')]['id'];}_0x49b44a[_0x777f('0x62')][_0x777f('0x44')]=widgetAttributes(_0x49b44a[_0x777f('0x62')]);return db[_0x777f('0x35')][_0x777f('0x3f')]({'where':{'id':_0x49b44a[_0x777f('0x32')]['id']}})[_0x777f('0x2c')](handleEntityNotFound(_0x107dc1,null))[_0x777f('0x2c')](saveUpdates(_0x49b44a[_0x777f('0x62')],null))['then'](respondWithResult(_0x107dc1,null))[_0x777f('0x40')](handleError(_0x107dc1,null));};
\ No newline at end of file