Built motion from commit ff78e754.|2.6.29
[motion2.git] / server / api / dashboardItem / dashboardItem.controller.js
index 3a5fde6..acdf36e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5e0=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','show','params','model','keys','query','intersection','fields','attributes','length','includeAll','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','total','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs'];(function(_0x760e41,_0x3c0b38){var _0xac848c=function(_0x37ac84){while(--_0x37ac84){_0x760e41['push'](_0x760e41['shift']());}};_0xac848c(++_0x3c0b38);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x3c9257,_0x4d6655){_0x3c9257=_0x3c9257-0x0;var _0x91712a=_0xe5e0[_0x3c9257];return _0x91712a;};'use strict';var emlformat=require(_0x0e5e('0x0'));var rimraf=require(_0x0e5e('0x1'));var zipdir=require(_0x0e5e('0x2'));var jsonpatch=require(_0x0e5e('0x3'));var rp=require(_0x0e5e('0x4'));var moment=require(_0x0e5e('0x5'));var BPromise=require(_0x0e5e('0x6'));var Mustache=require(_0x0e5e('0x7'));var util=require(_0x0e5e('0x8'));var path=require('path');var sox=require(_0x0e5e('0x9'));var csv=require(_0x0e5e('0xa'));var ejs=require(_0x0e5e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e5e('0xc'));var squel=require(_0x0e5e('0xd'));var crypto=require(_0x0e5e('0xe'));var jsforce=require(_0x0e5e('0xf'));var deskjs=require(_0x0e5e('0x10'));var toCsv=require(_0x0e5e('0xa'));var querystring=require(_0x0e5e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e5e('0x12'));var as=require(_0x0e5e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e5e('0x14'));var utils=require(_0x0e5e('0x15'));var config=require(_0x0e5e('0x16'));var licenseUtil=require(_0x0e5e('0x17'));var db=require('../../mysqldb')['db'];config[_0x0e5e('0x18')]=_[_0x0e5e('0x19')](config['redis'],{'host':_0x0e5e('0x1a'),'port':0x18eb});var socket=require(_0x0e5e('0x1b'))(new Redis(config[_0x0e5e('0x18')]));require('./dashboardItem.socket')[_0x0e5e('0x1c')](socket);function respondWithStatusCode(_0x2353b3,_0x187d39){_0x187d39=_0x187d39||0xcc;return function(_0x3d13a0){if(_0x3d13a0){return _0x2353b3[_0x0e5e('0x1d')](_0x187d39);}return _0x2353b3[_0x0e5e('0x1e')](_0x187d39)['end']();};}function respondWithResult(_0x20a35f,_0x3e5104){_0x3e5104=_0x3e5104||0xc8;return function(_0x1ce55f){if(_0x1ce55f){return _0x20a35f[_0x0e5e('0x1e')](_0x3e5104)[_0x0e5e('0x1f')](_0x1ce55f);}};}function respondWithFilteredResult(_0x550dda,_0x11aef2){return function(_0x2efa7f){if(_0x2efa7f){var _0x4bfc60=typeof _0x11aef2[_0x0e5e('0x20')]===_0x0e5e('0x21')&&typeof _0x11aef2['limit']===_0x0e5e('0x21');var _0x3b80f8=_0x2efa7f['count'];var _0x422c08=_0x4bfc60?0x0:_0x11aef2[_0x0e5e('0x20')];var _0x3659d9=_0x4bfc60?_0x2efa7f['count']:_0x11aef2['offset']+_0x11aef2[_0x0e5e('0x22')];var _0x1b0588;if(_0x3659d9>=_0x3b80f8){_0x3659d9=_0x3b80f8;_0x1b0588=0xc8;}else{_0x1b0588=0xce;}_0x550dda[_0x0e5e('0x1e')](_0x1b0588);return _0x550dda[_0x0e5e('0x23')](_0x0e5e('0x24'),_0x422c08+'-'+_0x3659d9+'/'+_0x3b80f8)[_0x0e5e('0x1f')](_0x2efa7f);}return null;};}function patchUpdates(_0x2588fa){return function(_0x3f5512){try{jsonpatch[_0x0e5e('0x25')](_0x3f5512,_0x2588fa,!![]);}catch(_0x33b27e){return BPromise['reject'](_0x33b27e);}return _0x3f5512[_0x0e5e('0x26')]();};}function saveUpdates(_0x2321f9,_0xfff15b){return function(_0xcab633){if(_0xcab633){return _0xcab633[_0x0e5e('0x27')](_0x2321f9)[_0x0e5e('0x28')](function(_0x46cbd7){return _0x46cbd7;});}return null;};}function removeEntity(_0x4b53ca,_0x1b19f0){return function(_0x5ed110){if(_0x5ed110){return _0x5ed110[_0x0e5e('0x29')]()[_0x0e5e('0x28')](function(){_0x4b53ca['status'](0xcc)[_0x0e5e('0x2a')]();});}};}function handleEntityNotFound(_0x471834,_0x952141){return function(_0x563870){if(!_0x563870){_0x471834[_0x0e5e('0x1d')](0x194);}return _0x563870;};}function handleError(_0x57b970,_0x343eb2){_0x343eb2=_0x343eb2||0x1f4;return function(_0x2d5cc0){logger[_0x0e5e('0x2b')](_0x2d5cc0['stack']);if(_0x2d5cc0[_0x0e5e('0x2c')]){delete _0x2d5cc0[_0x0e5e('0x2c')];}_0x57b970[_0x0e5e('0x1e')](_0x343eb2)[_0x0e5e('0x2d')](_0x2d5cc0);};}exports[_0x0e5e('0x2e')]=function(_0x3a0984,_0x3ea522){var _0x4ca32e={'raw':![],'where':{'id':_0x3a0984[_0x0e5e('0x2f')]['id']}},_0x34455b={};_0x34455b[_0x0e5e('0x30')]=_[_0x0e5e('0x31')](db['DashboardItem']['rawAttributes']);_0x34455b['query']=_['keys'](_0x3a0984[_0x0e5e('0x32')]);_0x34455b['filters']=_[_0x0e5e('0x33')](_0x34455b[_0x0e5e('0x30')],_0x34455b[_0x0e5e('0x32')]);_0x4ca32e['attributes']=_[_0x0e5e('0x33')](_0x34455b['model'],qs['fields'](_0x3a0984[_0x0e5e('0x32')][_0x0e5e('0x34')]));_0x4ca32e[_0x0e5e('0x35')]=_0x4ca32e[_0x0e5e('0x35')][_0x0e5e('0x36')]?_0x4ca32e['attributes']:_0x34455b[_0x0e5e('0x30')];if(_0x3a0984[_0x0e5e('0x32')][_0x0e5e('0x37')]){_0x4ca32e[_0x0e5e('0x38')]=[{'all':!![]}];}_0x4ca32e=_[_0x0e5e('0x39')]({},_0x4ca32e,_0x3a0984[_0x0e5e('0x3a')]);return db[_0x0e5e('0x3b')][_0x0e5e('0x3c')](_0x4ca32e)[_0x0e5e('0x28')](handleEntityNotFound(_0x3ea522,null))['then'](respondWithResult(_0x3ea522,null))[_0x0e5e('0x3d')](handleError(_0x3ea522,null));};exports[_0x0e5e('0x29')]=function(_0x3f7067,_0x32958a){return db['DashboardItem'][_0x0e5e('0x3c')]({'where':{'id':_0x3f7067['params']['id']}})[_0x0e5e('0x28')](handleEntityNotFound(_0x32958a,null))[_0x0e5e('0x28')](removeEntity(_0x32958a,null))[_0x0e5e('0x3d')](handleError(_0x32958a,null));};function widgetAttributes(_0x4bf916){try{switch(_0x4bf916[_0x0e5e('0x3e')]){case _0x0e5e('0x3f'):return[{'name':_0x0e5e('0x40'),'value':_0x4bf916['attrUrl']||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x42')]:undefined)||'https://'}];case _0x0e5e('0x43'):return[{'name':_0x0e5e('0x44'),'value':_0x4bf916[_0x0e5e('0x44')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916['attrs'][0x0][_0x0e5e('0x42')]:undefined)||''}];case _0x0e5e('0x45'):return[{'name':_0x0e5e('0x46'),'value':_0x4bf916[_0x0e5e('0x46')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916['attrs'][0x0][_0x0e5e('0x42')]:undefined)||_0x0e5e('0x47')},{'name':'attrTimezone','value':_0x4bf916[_0x0e5e('0x48')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x1]?_0x4bf916[_0x0e5e('0x41')][0x1][_0x0e5e('0x42')]:undefined)||'0.00'},{'name':_0x0e5e('0x49'),'value':_0x4bf916['attrFontSize']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x2]?_0x4bf916[_0x0e5e('0x41')][0x2][_0x0e5e('0x42')]:undefined)||0xc}];case _0x0e5e('0x4a'):return[{'name':_0x0e5e('0x4b'),'value':_0x4bf916[_0x0e5e('0x4b')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x42')]:undefined)||'total'},{'name':_0x0e5e('0x4c'),'value':_0x4bf916['attrVoiceQueues']||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x1]?_0x4bf916[_0x0e5e('0x41')][0x1][_0x0e5e('0x42')]:undefined)||[]},{'name':_0x0e5e('0x49'),'value':_0x4bf916[_0x0e5e('0x49')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x2]?_0x4bf916['attrs'][0x2][_0x0e5e('0x42')]:undefined)||0x14},{'name':_0x0e5e('0x4d'),'value':_0x4bf916[_0x0e5e('0x4d')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x3]?_0x4bf916[_0x0e5e('0x41')][0x3][_0x0e5e('0x42')]:undefined)||_0x0e5e('0x4e')},{'name':_0x0e5e('0x4f'),'value':_0x4bf916['attrEmailAccounts']||(_0x4bf916['attrs']&&_0x4bf916['attrs'][0x4]?_0x4bf916[_0x0e5e('0x41')][0x4]['value']:undefined)||''},{'name':_0x0e5e('0x50'),'value':_0x4bf916[_0x0e5e('0x50')]||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x5]?_0x4bf916[_0x0e5e('0x41')][0x5][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x51'),'value':_0x4bf916[_0x0e5e('0x51')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x6]?_0x4bf916[_0x0e5e('0x41')][0x6][_0x0e5e('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4bf916['attrOpenchannelAccounts']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x7]?_0x4bf916[_0x0e5e('0x41')][0x7][_0x0e5e('0x42')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4bf916[_0x0e5e('0x52')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x8]?_0x4bf916[_0x0e5e('0x41')][0x8][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x53'),'value':_0x4bf916[_0x0e5e('0x53')]||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x9]?_0x4bf916['attrs'][0x9][_0x0e5e('0x42')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x0e5e('0x54'),'value':_0x4bf916[_0x0e5e('0x54')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x42')]:undefined)||_0x0e5e('0x55')},{'name':'attrSerie2','value':_0x4bf916[_0x0e5e('0x56')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x1]?_0x4bf916['attrs'][0x1][_0x0e5e('0x42')]:undefined)||null},{'name':_0x0e5e('0x57'),'value':_0x4bf916[_0x0e5e('0x57')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x2]?_0x4bf916[_0x0e5e('0x41')][0x2][_0x0e5e('0x42')]:undefined)||null},{'name':_0x0e5e('0x4c'),'value':_0x4bf916[_0x0e5e('0x4c')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x3]?_0x4bf916[_0x0e5e('0x41')][0x3][_0x0e5e('0x42')]:undefined)||[]},{'name':_0x0e5e('0x4d'),'value':_0x4bf916[_0x0e5e('0x4d')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x4]?_0x4bf916[_0x0e5e('0x41')][0x4]['value']:undefined)||_0x0e5e('0x4e')},{'name':'attrEmailAccounts','value':_0x4bf916[_0x0e5e('0x4f')]||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x5]?_0x4bf916['attrs'][0x5][_0x0e5e('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4bf916[_0x0e5e('0x50')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x6]?_0x4bf916['attrs'][0x6][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x51'),'value':_0x4bf916['attrSmsAccounts']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x7]?_0x4bf916[_0x0e5e('0x41')][0x7]['value']:undefined)||''},{'name':_0x0e5e('0x58'),'value':_0x4bf916[_0x0e5e('0x58')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x8]?_0x4bf916[_0x0e5e('0x41')][0x8][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x52'),'value':_0x4bf916[_0x0e5e('0x52')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x9]?_0x4bf916['attrs'][0x9][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x53'),'value':_0x4bf916[_0x0e5e('0x53')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0xa]?_0x4bf916[_0x0e5e('0x41')][0xa][_0x0e5e('0x42')]:undefined)||''}];case _0x0e5e('0x59'):return[{'name':_0x0e5e('0x5a'),'type':_0x4bf916['reportType']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x3e')]:undefined)||null,'value':_0x4bf916['attrReport']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x4bf916['attrRefresh']||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x1]?_0x4bf916[_0x0e5e('0x41')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x499d14){logger[_0x0e5e('0x2b')]('widgetAttributes:\x20%s',JSON['stringify'](_0x499d14));return[];}}exports['create']=function(_0x5af553,_0x2d5b5a){if(_0x5af553[_0x0e5e('0x5b')]){_0x5af553[_0x0e5e('0x5b')][_0x0e5e('0x41')]=widgetAttributes(_0x5af553[_0x0e5e('0x5b')]);}return db[_0x0e5e('0x3b')][_0x0e5e('0x5c')](_0x5af553[_0x0e5e('0x5b')],{})[_0x0e5e('0x28')](respondWithResult(_0x2d5b5a,0xc9))['catch'](handleError(_0x2d5b5a,null));};exports[_0x0e5e('0x27')]=function(_0x45191c,_0x1b8188){if(_0x45191c[_0x0e5e('0x5b')]['id']){delete _0x45191c['body']['id'];}_0x45191c[_0x0e5e('0x5b')][_0x0e5e('0x41')]=widgetAttributes(_0x45191c[_0x0e5e('0x5b')]);return db[_0x0e5e('0x3b')][_0x0e5e('0x3c')]({'where':{'id':_0x45191c[_0x0e5e('0x2f')]['id']}})[_0x0e5e('0x28')](handleEntityNotFound(_0x1b8188,null))[_0x0e5e('0x28')](saveUpdates(_0x45191c[_0x0e5e('0x5b')],null))[_0x0e5e('0x28')](respondWithResult(_0x1b8188,null))[_0x0e5e('0x3d')](handleError(_0x1b8188,null));};
\ No newline at end of file
+var _0x326f=['attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','stringify','create','body','update','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','set','reject','save','destroy','then','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','find','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x326f,0xd1));var _0xf326=function(_0x4a9ff3,_0x5c5c6c){_0x4a9ff3=_0x4a9ff3-0x0;var _0x49e911=_0x326f[_0x4a9ff3];return _0x49e911;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];config[_0xf326('0x17')]=_[_0xf326('0x18')](config['redis'],{'host':_0xf326('0x19'),'port':0x18eb});var socket=require(_0xf326('0x1a'))(new Redis(config[_0xf326('0x17')]));require(_0xf326('0x1b'))['register'](socket);function respondWithStatusCode(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xcc;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1c')](_0x5204ee);}return _0x45c1b6[_0xf326('0x1d')](_0x5204ee)[_0xf326('0x1e')]();};}function respondWithResult(_0xa63d1a,_0x292f4b){_0x292f4b=_0x292f4b||0xc8;return function(_0x287a2a){if(_0x287a2a){return _0xa63d1a[_0xf326('0x1d')](_0x292f4b)[_0xf326('0x1f')](_0x287a2a);}};}function respondWithFilteredResult(_0x5a682a,_0x3ad7da){return function(_0x453100){if(_0x453100){var _0x18bee3=typeof _0x3ad7da[_0xf326('0x20')]===_0xf326('0x21')&&typeof _0x3ad7da[_0xf326('0x22')]==='undefined';var _0x4a5b6c=_0x453100['count'];var _0x16e605=_0x18bee3?0x0:_0x3ad7da[_0xf326('0x20')];var _0x484cbe=_0x18bee3?_0x453100['count']:_0x3ad7da[_0xf326('0x20')]+_0x3ad7da['limit'];var _0x5b6d3c;if(_0x484cbe>=_0x4a5b6c){_0x484cbe=_0x4a5b6c;_0x5b6d3c=0xc8;}else{_0x5b6d3c=0xce;}_0x5a682a[_0xf326('0x1d')](_0x5b6d3c);return _0x5a682a[_0xf326('0x23')]('Content-Range',_0x16e605+'-'+_0x484cbe+'/'+_0x4a5b6c)['json'](_0x453100);}return null;};}function patchUpdates(_0x19b8ba){return function(_0xb1efcf){try{jsonpatch['apply'](_0xb1efcf,_0x19b8ba,!![]);}catch(_0x337ed5){return BPromise[_0xf326('0x24')](_0x337ed5);}return _0xb1efcf[_0xf326('0x25')]();};}function saveUpdates(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['update'](_0x295752)['then'](function(_0x4f31f6){return _0x4f31f6;});}return null;};}function removeEntity(_0x520d85,_0x1a2c4e){return function(_0x2cd45a){if(_0x2cd45a){return _0x2cd45a[_0xf326('0x26')]()[_0xf326('0x27')](function(){_0x520d85[_0xf326('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x201d28,_0xa3c0b){return function(_0x212d5d){if(!_0x212d5d){_0x201d28['sendStatus'](0x194);}return _0x212d5d;};}function handleError(_0x1617d2,_0x55ad0f){_0x55ad0f=_0x55ad0f||0x1f4;return function(_0x4a9abf){logger[_0xf326('0x28')](_0x4a9abf[_0xf326('0x29')]);if(_0x4a9abf[_0xf326('0x2a')]){delete _0x4a9abf['name'];}_0x1617d2[_0xf326('0x1d')](_0x55ad0f)[_0xf326('0x2b')](_0x4a9abf);};}exports['show']=function(_0x225776,_0x119ab8){var _0xd77aba={'raw':![],'where':{'id':_0x225776[_0xf326('0x2c')]['id']}},_0x18d110={};_0x18d110[_0xf326('0x2d')]=_[_0xf326('0x2e')](db[_0xf326('0x2f')][_0xf326('0x30')]);_0x18d110[_0xf326('0x31')]=_['keys'](_0x225776[_0xf326('0x31')]);_0x18d110[_0xf326('0x32')]=_[_0xf326('0x33')](_0x18d110['model'],_0x18d110[_0xf326('0x31')]);_0xd77aba[_0xf326('0x34')]=_[_0xf326('0x33')](_0x18d110['model'],qs['fields'](_0x225776[_0xf326('0x31')][_0xf326('0x35')]));_0xd77aba[_0xf326('0x34')]=_0xd77aba[_0xf326('0x34')][_0xf326('0x36')]?_0xd77aba[_0xf326('0x34')]:_0x18d110[_0xf326('0x2d')];if(_0x225776[_0xf326('0x31')]['includeAll']){_0xd77aba[_0xf326('0x37')]=[{'all':!![]}];}_0xd77aba=_[_0xf326('0x38')]({},_0xd77aba,_0x225776['options']);return db[_0xf326('0x2f')]['find'](_0xd77aba)[_0xf326('0x27')](handleEntityNotFound(_0x119ab8,null))['then'](respondWithResult(_0x119ab8,null))['catch'](handleError(_0x119ab8,null));};exports[_0xf326('0x26')]=function(_0x4d8eac,_0x40dcb4){return db['DashboardItem'][_0xf326('0x39')]({'where':{'id':_0x4d8eac[_0xf326('0x2c')]['id']}})[_0xf326('0x27')](handleEntityNotFound(_0x40dcb4,null))['then'](removeEntity(_0x40dcb4,null))[_0xf326('0x3a')](handleError(_0x40dcb4,null));};function widgetAttributes(_0x4095e6){try{switch(_0x4095e6['type']){case _0xf326('0x3b'):return[{'name':_0xf326('0x3c'),'value':_0x4095e6[_0xf326('0x3c')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6['attrs'][0x0]?_0x4095e6[_0xf326('0x3d')][0x0][_0xf326('0x3e')]:undefined)||_0xf326('0x3f')}];case _0xf326('0x40'):return[{'name':_0xf326('0x41'),'value':_0x4095e6['attrPath']||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x0]?_0x4095e6['attrs'][0x0]['value']:undefined)||''}];case _0xf326('0x42'):return[{'name':'attrHourFormat','value':_0x4095e6['attrHourFormat']||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6['attrs'][0x0]?_0x4095e6[_0xf326('0x3d')][0x0][_0xf326('0x3e')]:undefined)||_0xf326('0x43')},{'name':_0xf326('0x44'),'value':_0x4095e6['attrTimezone']||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x1]?_0x4095e6[_0xf326('0x3d')][0x1][_0xf326('0x3e')]:undefined)||_0xf326('0x45')},{'name':_0xf326('0x46'),'value':_0x4095e6[_0xf326('0x46')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x2]?_0x4095e6[_0xf326('0x3d')][0x2][_0xf326('0x3e')]:undefined)||0xc}];case _0xf326('0x47'):return[{'name':'attrMetric','value':_0x4095e6[_0xf326('0x48')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x0]?_0x4095e6[_0xf326('0x3d')][0x0][_0xf326('0x3e')]:undefined)||_0xf326('0x49')},{'name':'attrVoiceQueues','value':_0x4095e6[_0xf326('0x4a')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6['attrs'][0x1]?_0x4095e6[_0xf326('0x3d')][0x1][_0xf326('0x3e')]:undefined)||[]},{'name':_0xf326('0x46'),'value':_0x4095e6[_0xf326('0x46')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6['attrs'][0x2]?_0x4095e6['attrs'][0x2][_0xf326('0x3e')]:undefined)||0x14},{'name':_0xf326('0x4b'),'value':_0x4095e6['attrChannel']||(_0x4095e6['attrs']&&_0x4095e6[_0xf326('0x3d')][0x3]?_0x4095e6[_0xf326('0x3d')][0x3][_0xf326('0x3e')]:undefined)||'voice'},{'name':_0xf326('0x4c'),'value':_0x4095e6[_0xf326('0x4c')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x4]?_0x4095e6[_0xf326('0x3d')][0x4][_0xf326('0x3e')]:undefined)||''},{'name':_0xf326('0x4d'),'value':_0x4095e6[_0xf326('0x4d')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x5]?_0x4095e6[_0xf326('0x3d')][0x5][_0xf326('0x3e')]:undefined)||''},{'name':_0xf326('0x4e'),'value':_0x4095e6[_0xf326('0x4e')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6['attrs'][0x6]?_0x4095e6[_0xf326('0x3d')][0x6][_0xf326('0x3e')]:undefined)||''},{'name':_0xf326('0x4f'),'value':_0x4095e6[_0xf326('0x4f')]||(_0x4095e6['attrs']&&_0x4095e6[_0xf326('0x3d')][0x7]?_0x4095e6[_0xf326('0x3d')][0x7][_0xf326('0x3e')]:undefined)||''},{'name':_0xf326('0x50'),'value':_0x4095e6['attrWhatsappAccounts']||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x8]?_0x4095e6[_0xf326('0x3d')][0x8][_0xf326('0x3e')]:undefined)||''},{'name':_0xf326('0x51'),'value':_0x4095e6['attrChatWebsites']||(_0x4095e6['attrs']&&_0x4095e6[_0xf326('0x3d')][0x9]?_0x4095e6[_0xf326('0x3d')][0x9][_0xf326('0x3e')]:undefined)||''}];case'multibar-chart':case _0xf326('0x52'):return[{'name':_0xf326('0x53'),'value':_0x4095e6[_0xf326('0x53')]||(_0x4095e6['attrs']&&_0x4095e6['attrs'][0x0]?_0x4095e6[_0xf326('0x3d')][0x0]['value']:undefined)||_0xf326('0x49')},{'name':'attrSerie2','value':_0x4095e6[_0xf326('0x54')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x1]?_0x4095e6[_0xf326('0x3d')][0x1][_0xf326('0x3e')]:undefined)||null},{'name':_0xf326('0x55'),'value':_0x4095e6[_0xf326('0x55')]||(_0x4095e6['attrs']&&_0x4095e6[_0xf326('0x3d')][0x2]?_0x4095e6[_0xf326('0x3d')][0x2][_0xf326('0x3e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4095e6[_0xf326('0x4a')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x3]?_0x4095e6[_0xf326('0x3d')][0x3][_0xf326('0x3e')]:undefined)||[]},{'name':'attrChannel','value':_0x4095e6[_0xf326('0x4b')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x4]?_0x4095e6[_0xf326('0x3d')][0x4]['value']:undefined)||_0xf326('0x56')},{'name':_0xf326('0x4c'),'value':_0x4095e6[_0xf326('0x4c')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6['attrs'][0x5]?_0x4095e6['attrs'][0x5][_0xf326('0x3e')]:undefined)||''},{'name':_0xf326('0x4d'),'value':_0x4095e6['attrFaxAccounts']||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x6]?_0x4095e6[_0xf326('0x3d')][0x6][_0xf326('0x3e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4095e6[_0xf326('0x4e')]||(_0x4095e6['attrs']&&_0x4095e6['attrs'][0x7]?_0x4095e6[_0xf326('0x3d')][0x7]['value']:undefined)||''},{'name':_0xf326('0x4f'),'value':_0x4095e6[_0xf326('0x4f')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6['attrs'][0x8]?_0x4095e6['attrs'][0x8][_0xf326('0x3e')]:undefined)||''},{'name':_0xf326('0x50'),'value':_0x4095e6[_0xf326('0x50')]||(_0x4095e6['attrs']&&_0x4095e6[_0xf326('0x3d')][0x9]?_0x4095e6['attrs'][0x9][_0xf326('0x3e')]:undefined)||''},{'name':_0xf326('0x51'),'value':_0x4095e6[_0xf326('0x51')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0xa]?_0x4095e6[_0xf326('0x3d')][0xa][_0xf326('0x3e')]:undefined)||''}];case _0xf326('0x57'):return[{'name':_0xf326('0x58'),'type':_0x4095e6[_0xf326('0x59')]||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x0]?_0x4095e6[_0xf326('0x3d')][0x0]['type']:undefined)||null,'value':_0x4095e6[_0xf326('0x58')]||(_0x4095e6['attrs']&&_0x4095e6[_0xf326('0x3d')][0x0]?_0x4095e6[_0xf326('0x3d')][0x0]['value']:undefined)||null},{'name':_0xf326('0x5a'),'value':_0x4095e6['attrRefresh']||(_0x4095e6[_0xf326('0x3d')]&&_0x4095e6[_0xf326('0x3d')][0x1]?_0x4095e6[_0xf326('0x3d')][0x1][_0xf326('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x31b6dd){logger['error']('widgetAttributes:\x20%s',JSON[_0xf326('0x5b')](_0x31b6dd));return[];}}exports[_0xf326('0x5c')]=function(_0x15a538,_0x21b3cc){if(_0x15a538[_0xf326('0x5d')]){_0x15a538['body'][_0xf326('0x3d')]=widgetAttributes(_0x15a538[_0xf326('0x5d')]);}return db['DashboardItem']['create'](_0x15a538['body'],{})[_0xf326('0x27')](respondWithResult(_0x21b3cc,0xc9))[_0xf326('0x3a')](handleError(_0x21b3cc,null));};exports[_0xf326('0x5e')]=function(_0x235525,_0x240ce5){if(_0x235525[_0xf326('0x5d')]['id']){delete _0x235525[_0xf326('0x5d')]['id'];}_0x235525['body'][_0xf326('0x3d')]=widgetAttributes(_0x235525[_0xf326('0x5d')]);return db[_0xf326('0x2f')][_0xf326('0x39')]({'where':{'id':_0x235525['params']['id']}})[_0xf326('0x27')](handleEntityNotFound(_0x240ce5,null))['then'](saveUpdates(_0x235525['body'],null))[_0xf326('0x27')](respondWithResult(_0x240ce5,null))['catch'](handleError(_0x240ce5,null));};
\ No newline at end of file