Built motion from commit 42801a18.|2.6.28
[motion2.git] / server / api / dashboardItem / dashboardItem.controller.js
index 52f892a..8be004f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b74=['value','https://','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrFaxAccounts','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','DashboardItem','catch','find','type','iframe','attrs'];(function(_0x3bbd2d,_0xf8ba3c){var _0x241bd4=function(_0x4f02fb){while(--_0x4f02fb){_0x3bbd2d['push'](_0x3bbd2d['shift']());}};_0x241bd4(++_0xf8ba3c);}(_0x3b74,0x80));var _0x43b7=function(_0x17617c,_0x4c6683){_0x17617c=_0x17617c-0x0;var _0x4b6d31=_0x3b74[_0x17617c];return _0x4b6d31;};'use strict';var emlformat=require(_0x43b7('0x0'));var rimraf=require(_0x43b7('0x1'));var zipdir=require(_0x43b7('0x2'));var jsonpatch=require(_0x43b7('0x3'));var rp=require('request-promise');var moment=require(_0x43b7('0x4'));var BPromise=require(_0x43b7('0x5'));var Mustache=require(_0x43b7('0x6'));var util=require(_0x43b7('0x7'));var path=require('path');var sox=require(_0x43b7('0x8'));var csv=require(_0x43b7('0x9'));var ejs=require(_0x43b7('0xa'));var fs=require('fs');var fs_extra=require(_0x43b7('0xb'));var _=require(_0x43b7('0xc'));var squel=require(_0x43b7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x43b7('0xe'));var toCsv=require(_0x43b7('0x9'));var querystring=require('querystring');var Papa=require(_0x43b7('0xf'));var Redis=require(_0x43b7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x43b7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43b7('0x12'));var logger=require(_0x43b7('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x43b7('0x14'));var licenseUtil=require(_0x43b7('0x15'));var db=require('../../mysqldb')['db'];config[_0x43b7('0x16')]=_['defaults'](config[_0x43b7('0x16')],{'host':_0x43b7('0x17'),'port':0x18eb});var socket=require(_0x43b7('0x18'))(new Redis(config['redis']));require(_0x43b7('0x19'))[_0x43b7('0x1a')](socket);function respondWithStatusCode(_0x307e4d,_0x28c0dd){_0x28c0dd=_0x28c0dd||0xcc;return function(_0x445dad){if(_0x445dad){return _0x307e4d[_0x43b7('0x1b')](_0x28c0dd);}return _0x307e4d[_0x43b7('0x1c')](_0x28c0dd)[_0x43b7('0x1d')]();};}function respondWithResult(_0x4f2b2c,_0x199493){_0x199493=_0x199493||0xc8;return function(_0x481e71){if(_0x481e71){return _0x4f2b2c[_0x43b7('0x1c')](_0x199493)[_0x43b7('0x1e')](_0x481e71);}};}function respondWithFilteredResult(_0x4a2e48,_0x3dd0a6){return function(_0xaaeba5){if(_0xaaeba5){var _0x111798=typeof _0x3dd0a6[_0x43b7('0x1f')]==='undefined'&&typeof _0x3dd0a6[_0x43b7('0x20')]===_0x43b7('0x21');var _0x2091f4=_0xaaeba5[_0x43b7('0x22')];var _0x42a57e=_0x111798?0x0:_0x3dd0a6[_0x43b7('0x1f')];var _0x400022=_0x111798?_0xaaeba5[_0x43b7('0x22')]:_0x3dd0a6[_0x43b7('0x1f')]+_0x3dd0a6['limit'];var _0x30a632;if(_0x400022>=_0x2091f4){_0x400022=_0x2091f4;_0x30a632=0xc8;}else{_0x30a632=0xce;}_0x4a2e48['status'](_0x30a632);return _0x4a2e48[_0x43b7('0x23')](_0x43b7('0x24'),_0x42a57e+'-'+_0x400022+'/'+_0x2091f4)[_0x43b7('0x1e')](_0xaaeba5);}return null;};}function patchUpdates(_0x978ade){return function(_0x406151){try{jsonpatch[_0x43b7('0x25')](_0x406151,_0x978ade,!![]);}catch(_0x4c0527){return BPromise[_0x43b7('0x26')](_0x4c0527);}return _0x406151[_0x43b7('0x27')]();};}function saveUpdates(_0x48e91b,_0x447b70){return function(_0x4fcce3){if(_0x4fcce3){return _0x4fcce3[_0x43b7('0x28')](_0x48e91b)[_0x43b7('0x29')](function(_0x1f6bd7){return _0x1f6bd7;});}return null;};}function removeEntity(_0x42f73a,_0x2d25b0){return function(_0xda601b){if(_0xda601b){return _0xda601b['destroy']()[_0x43b7('0x29')](function(){_0x42f73a[_0x43b7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ff13,_0x78e299){return function(_0x461bed){if(!_0x461bed){_0x16ff13[_0x43b7('0x1b')](0x194);}return _0x461bed;};}function handleError(_0x49de1f,_0xd41a04){_0xd41a04=_0xd41a04||0x1f4;return function(_0x3122d7){logger['error'](_0x3122d7[_0x43b7('0x2a')]);if(_0x3122d7[_0x43b7('0x2b')]){delete _0x3122d7['name'];}_0x49de1f[_0x43b7('0x1c')](_0xd41a04)['send'](_0x3122d7);};}exports[_0x43b7('0x2c')]=function(_0x1379bb,_0x3047ca){var _0xc8625c={'raw':![],'where':{'id':_0x1379bb[_0x43b7('0x2d')]['id']}},_0x1eede6={};_0x1eede6[_0x43b7('0x2e')]=_[_0x43b7('0x2f')](db['DashboardItem'][_0x43b7('0x30')]);_0x1eede6[_0x43b7('0x31')]=_['keys'](_0x1379bb[_0x43b7('0x31')]);_0x1eede6[_0x43b7('0x32')]=_[_0x43b7('0x33')](_0x1eede6[_0x43b7('0x2e')],_0x1eede6[_0x43b7('0x31')]);_0xc8625c[_0x43b7('0x34')]=_[_0x43b7('0x33')](_0x1eede6[_0x43b7('0x2e')],qs['fields'](_0x1379bb[_0x43b7('0x31')][_0x43b7('0x35')]));_0xc8625c[_0x43b7('0x34')]=_0xc8625c['attributes']['length']?_0xc8625c[_0x43b7('0x34')]:_0x1eede6[_0x43b7('0x2e')];if(_0x1379bb['query'][_0x43b7('0x36')]){_0xc8625c[_0x43b7('0x37')]=[{'all':!![]}];}_0xc8625c=_[_0x43b7('0x38')]({},_0xc8625c,_0x1379bb[_0x43b7('0x39')]);return db[_0x43b7('0x3a')]['find'](_0xc8625c)[_0x43b7('0x29')](handleEntityNotFound(_0x3047ca,null))[_0x43b7('0x29')](respondWithResult(_0x3047ca,null))[_0x43b7('0x3b')](handleError(_0x3047ca,null));};exports['destroy']=function(_0x2b0921,_0xacb382){return db[_0x43b7('0x3a')][_0x43b7('0x3c')]({'where':{'id':_0x2b0921[_0x43b7('0x2d')]['id']}})[_0x43b7('0x29')](handleEntityNotFound(_0xacb382,null))[_0x43b7('0x29')](removeEntity(_0xacb382,null))[_0x43b7('0x3b')](handleError(_0xacb382,null));};function widgetAttributes(_0x3f7eb2){try{switch(_0x3f7eb2[_0x43b7('0x3d')]){case _0x43b7('0x3e'):return[{'name':'attrUrl','value':_0x3f7eb2['attrUrl']||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2[_0x43b7('0x3f')][0x0][_0x43b7('0x40')]:undefined)||_0x43b7('0x41')}];case'custom':return[{'name':_0x43b7('0x42'),'value':_0x3f7eb2[_0x43b7('0x42')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2[_0x43b7('0x3f')][0x0][_0x43b7('0x40')]:undefined)||''}];case _0x43b7('0x43'):return[{'name':'attrHourFormat','value':_0x3f7eb2['attrHourFormat']||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2['attrs'][0x0]['value']:undefined)||_0x43b7('0x44')},{'name':_0x43b7('0x45'),'value':_0x3f7eb2[_0x43b7('0x45')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2['attrs'][0x1]?_0x3f7eb2['attrs'][0x1][_0x43b7('0x40')]:undefined)||'0.00'},{'name':_0x43b7('0x46'),'value':_0x3f7eb2['attrFontSize']||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x2]?_0x3f7eb2[_0x43b7('0x3f')][0x2]['value']:undefined)||0xc}];case _0x43b7('0x47'):return[{'name':_0x43b7('0x48'),'value':_0x3f7eb2['attrMetric']||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2['attrs'][0x0]?_0x3f7eb2[_0x43b7('0x3f')][0x0][_0x43b7('0x40')]:undefined)||'total'},{'name':_0x43b7('0x49'),'value':_0x3f7eb2[_0x43b7('0x49')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2['attrs'][0x1]?_0x3f7eb2['attrs'][0x1][_0x43b7('0x40')]:undefined)||[]},{'name':_0x43b7('0x46'),'value':_0x3f7eb2[_0x43b7('0x46')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x2]?_0x3f7eb2[_0x43b7('0x3f')][0x2]['value']:undefined)||0x14},{'name':_0x43b7('0x4a'),'value':_0x3f7eb2[_0x43b7('0x4a')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x3]?_0x3f7eb2['attrs'][0x3][_0x43b7('0x40')]:undefined)||_0x43b7('0x4b')},{'name':_0x43b7('0x4c'),'value':_0x3f7eb2[_0x43b7('0x4c')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x4]?_0x3f7eb2[_0x43b7('0x3f')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3f7eb2['attrFaxAccounts']||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x5]?_0x3f7eb2[_0x43b7('0x3f')][0x5][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4d'),'value':_0x3f7eb2[_0x43b7('0x4d')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x6]?_0x3f7eb2['attrs'][0x6][_0x43b7('0x40')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3f7eb2['attrOpenchannelAccounts']||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x7]?_0x3f7eb2['attrs'][0x7][_0x43b7('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3f7eb2[_0x43b7('0x4e')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x8]?_0x3f7eb2['attrs'][0x8][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4f'),'value':_0x3f7eb2[_0x43b7('0x4f')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x9]?_0x3f7eb2[_0x43b7('0x3f')][0x9][_0x43b7('0x40')]:undefined)||''}];case'multibar-chart':case _0x43b7('0x50'):return[{'name':_0x43b7('0x51'),'value':_0x3f7eb2[_0x43b7('0x51')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2['attrs'][0x0]['value']:undefined)||_0x43b7('0x52')},{'name':_0x43b7('0x53'),'value':_0x3f7eb2[_0x43b7('0x53')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x1]?_0x3f7eb2[_0x43b7('0x3f')][0x1][_0x43b7('0x40')]:undefined)||null},{'name':_0x43b7('0x54'),'value':_0x3f7eb2[_0x43b7('0x54')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x2]?_0x3f7eb2[_0x43b7('0x3f')][0x2][_0x43b7('0x40')]:undefined)||null},{'name':_0x43b7('0x49'),'value':_0x3f7eb2[_0x43b7('0x49')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x3]?_0x3f7eb2[_0x43b7('0x3f')][0x3]['value']:undefined)||[]},{'name':_0x43b7('0x4a'),'value':_0x3f7eb2[_0x43b7('0x4a')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x4]?_0x3f7eb2[_0x43b7('0x3f')][0x4][_0x43b7('0x40')]:undefined)||_0x43b7('0x4b')},{'name':_0x43b7('0x4c'),'value':_0x3f7eb2[_0x43b7('0x4c')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x5]?_0x3f7eb2[_0x43b7('0x3f')][0x5][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x55'),'value':_0x3f7eb2[_0x43b7('0x55')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x6]?_0x3f7eb2[_0x43b7('0x3f')][0x6][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4d'),'value':_0x3f7eb2[_0x43b7('0x4d')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x7]?_0x3f7eb2['attrs'][0x7][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x56'),'value':_0x3f7eb2[_0x43b7('0x56')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x8]?_0x3f7eb2[_0x43b7('0x3f')][0x8][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4e'),'value':_0x3f7eb2[_0x43b7('0x4e')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x9]?_0x3f7eb2[_0x43b7('0x3f')][0x9][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4f'),'value':_0x3f7eb2[_0x43b7('0x4f')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2['attrs'][0xa]?_0x3f7eb2[_0x43b7('0x3f')][0xa][_0x43b7('0x40')]:undefined)||''}];case _0x43b7('0x57'):return[{'name':_0x43b7('0x58'),'type':_0x3f7eb2[_0x43b7('0x59')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2[_0x43b7('0x3f')][0x0][_0x43b7('0x3d')]:undefined)||null,'value':_0x3f7eb2[_0x43b7('0x58')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2['attrs'][0x0]['value']:undefined)||null},{'name':_0x43b7('0x5a'),'value':_0x3f7eb2[_0x43b7('0x5a')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x1]?_0x3f7eb2[_0x43b7('0x3f')][0x1][_0x43b7('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x11f2bb){logger[_0x43b7('0x5b')](_0x43b7('0x5c'),JSON[_0x43b7('0x5d')](_0x11f2bb));return[];}}exports['create']=function(_0x3db8ed,_0x13369c){if(_0x3db8ed[_0x43b7('0x5e')]){_0x3db8ed[_0x43b7('0x5e')][_0x43b7('0x3f')]=widgetAttributes(_0x3db8ed[_0x43b7('0x5e')]);}return db[_0x43b7('0x3a')][_0x43b7('0x5f')](_0x3db8ed[_0x43b7('0x5e')],{})[_0x43b7('0x29')](respondWithResult(_0x13369c,0xc9))['catch'](handleError(_0x13369c,null));};exports[_0x43b7('0x28')]=function(_0xd40838,_0x143164){if(_0xd40838[_0x43b7('0x5e')]['id']){delete _0xd40838[_0x43b7('0x5e')]['id'];}_0xd40838[_0x43b7('0x5e')][_0x43b7('0x3f')]=widgetAttributes(_0xd40838[_0x43b7('0x5e')]);return db[_0x43b7('0x3a')][_0x43b7('0x3c')]({'where':{'id':_0xd40838[_0x43b7('0x2d')]['id']}})['then'](handleEntityNotFound(_0x143164,null))[_0x43b7('0x29')](saveUpdates(_0xd40838[_0x43b7('0x5e')],null))[_0x43b7('0x29')](respondWithResult(_0x143164,null))['catch'](handleError(_0x143164,null));};
\ No newline at end of file
+var _0xf13b=['status','end','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','name','send','params','model','keys','query','intersection','attributes','fields','options','find','catch','DashboardItem','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','body','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus'];(function(_0x42c7e7,_0x357294){var _0x4f17aa=function(_0x1d158d){while(--_0x1d158d){_0x42c7e7['push'](_0x42c7e7['shift']());}};_0x4f17aa(++_0x357294);}(_0xf13b,0x1f0));var _0xbf13=function(_0x37a042,_0x2c307a){_0x37a042=_0x37a042-0x0;var _0x19a727=_0xf13b[_0x37a042];return _0x19a727;};'use strict';var emlformat=require(_0xbf13('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf13('0x1'));var moment=require(_0xbf13('0x2'));var BPromise=require(_0xbf13('0x3'));var Mustache=require(_0xbf13('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbf13('0x5'));var csv=require(_0xbf13('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf13('0x7'));var _=require(_0xbf13('0x8'));var squel=require('squel');var crypto=require(_0xbf13('0x9'));var jsforce=require(_0xbf13('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbf13('0x6'));var querystring=require(_0xbf13('0xb'));var Papa=require(_0xbf13('0xc'));var Redis=require(_0xbf13('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbf13('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf13('0xf'));var logger=require('../../config/logger')(_0xbf13('0x10'));var utils=require(_0xbf13('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xbf13('0x12'));var db=require(_0xbf13('0x13'))['db'];config[_0xbf13('0x14')]=_[_0xbf13('0x15')](config['redis'],{'host':_0xbf13('0x16'),'port':0x18eb});var socket=require(_0xbf13('0x17'))(new Redis(config[_0xbf13('0x14')]));require(_0xbf13('0x18'))['register'](socket);function respondWithStatusCode(_0x5df674,_0x56331f){_0x56331f=_0x56331f||0xcc;return function(_0x12c77d){if(_0x12c77d){return _0x5df674[_0xbf13('0x19')](_0x56331f);}return _0x5df674[_0xbf13('0x1a')](_0x56331f)[_0xbf13('0x1b')]();};}function respondWithResult(_0x3ce614,_0x2f1a98){_0x2f1a98=_0x2f1a98||0xc8;return function(_0xef3d83){if(_0xef3d83){return _0x3ce614[_0xbf13('0x1a')](_0x2f1a98)['json'](_0xef3d83);}};}function respondWithFilteredResult(_0xa296f0,_0x528d3c){return function(_0xdd4206){if(_0xdd4206){var _0x1adb54=typeof _0x528d3c[_0xbf13('0x1c')]===_0xbf13('0x1d')&&typeof _0x528d3c['limit']==='undefined';var _0x3a2ff8=_0xdd4206[_0xbf13('0x1e')];var _0x3cbc13=_0x1adb54?0x0:_0x528d3c[_0xbf13('0x1c')];var _0x5d1be7=_0x1adb54?_0xdd4206['count']:_0x528d3c[_0xbf13('0x1c')]+_0x528d3c[_0xbf13('0x1f')];var _0x12f3f9;if(_0x5d1be7>=_0x3a2ff8){_0x5d1be7=_0x3a2ff8;_0x12f3f9=0xc8;}else{_0x12f3f9=0xce;}_0xa296f0['status'](_0x12f3f9);return _0xa296f0[_0xbf13('0x20')]('Content-Range',_0x3cbc13+'-'+_0x5d1be7+'/'+_0x3a2ff8)['json'](_0xdd4206);}return null;};}function patchUpdates(_0x31b0b9){return function(_0x29dce1){try{jsonpatch[_0xbf13('0x21')](_0x29dce1,_0x31b0b9,!![]);}catch(_0x44dfb3){return BPromise[_0xbf13('0x22')](_0x44dfb3);}return _0x29dce1[_0xbf13('0x23')]();};}function saveUpdates(_0x3eb399,_0x326397){return function(_0x11e635){if(_0x11e635){return _0x11e635['update'](_0x3eb399)[_0xbf13('0x24')](function(_0x74217e){return _0x74217e;});}return null;};}function removeEntity(_0x3ad31f,_0x115e5a){return function(_0x4152c3){if(_0x4152c3){return _0x4152c3[_0xbf13('0x25')]()[_0xbf13('0x24')](function(){_0x3ad31f['status'](0xcc)[_0xbf13('0x1b')]();});}};}function handleEntityNotFound(_0x2a87c1,_0x2ec35c){return function(_0x38a039){if(!_0x38a039){_0x2a87c1[_0xbf13('0x19')](0x194);}return _0x38a039;};}function handleError(_0x242f21,_0x5b4779){_0x5b4779=_0x5b4779||0x1f4;return function(_0x1d81db){logger[_0xbf13('0x26')](_0x1d81db['stack']);if(_0x1d81db['name']){delete _0x1d81db[_0xbf13('0x27')];}_0x242f21[_0xbf13('0x1a')](_0x5b4779)[_0xbf13('0x28')](_0x1d81db);};}exports['show']=function(_0x229093,_0x46fa93){var _0x43c8b0={'raw':![],'where':{'id':_0x229093[_0xbf13('0x29')]['id']}},_0x22dbed={};_0x22dbed[_0xbf13('0x2a')]=_[_0xbf13('0x2b')](db['DashboardItem']['rawAttributes']);_0x22dbed[_0xbf13('0x2c')]=_[_0xbf13('0x2b')](_0x229093['query']);_0x22dbed['filters']=_[_0xbf13('0x2d')](_0x22dbed[_0xbf13('0x2a')],_0x22dbed[_0xbf13('0x2c')]);_0x43c8b0[_0xbf13('0x2e')]=_[_0xbf13('0x2d')](_0x22dbed[_0xbf13('0x2a')],qs[_0xbf13('0x2f')](_0x229093[_0xbf13('0x2c')]['fields']));_0x43c8b0[_0xbf13('0x2e')]=_0x43c8b0[_0xbf13('0x2e')]['length']?_0x43c8b0[_0xbf13('0x2e')]:_0x22dbed[_0xbf13('0x2a')];if(_0x229093[_0xbf13('0x2c')]['includeAll']){_0x43c8b0['include']=[{'all':!![]}];}_0x43c8b0=_['merge']({},_0x43c8b0,_0x229093[_0xbf13('0x30')]);return db['DashboardItem'][_0xbf13('0x31')](_0x43c8b0)[_0xbf13('0x24')](handleEntityNotFound(_0x46fa93,null))['then'](respondWithResult(_0x46fa93,null))[_0xbf13('0x32')](handleError(_0x46fa93,null));};exports[_0xbf13('0x25')]=function(_0x31d005,_0xd1dd0c){return db[_0xbf13('0x33')][_0xbf13('0x31')]({'where':{'id':_0x31d005[_0xbf13('0x29')]['id']}})[_0xbf13('0x24')](handleEntityNotFound(_0xd1dd0c,null))[_0xbf13('0x24')](removeEntity(_0xd1dd0c,null))[_0xbf13('0x32')](handleError(_0xd1dd0c,null));};function widgetAttributes(_0x58c0c4){try{switch(_0x58c0c4[_0xbf13('0x34')]){case _0xbf13('0x35'):return[{'name':_0xbf13('0x36'),'value':_0x58c0c4[_0xbf13('0x36')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0][_0xbf13('0x38')]:undefined)||_0xbf13('0x39')}];case _0xbf13('0x3a'):return[{'name':_0xbf13('0x3b'),'value':_0x58c0c4['attrPath']||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0]['value']:undefined)||''}];case _0xbf13('0x3c'):return[{'name':_0xbf13('0x3d'),'value':_0x58c0c4[_0xbf13('0x3d')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xbf13('0x3e'),'value':_0x58c0c4[_0xbf13('0x3e')]||(_0x58c0c4['attrs']&&_0x58c0c4[_0xbf13('0x37')][0x1]?_0x58c0c4[_0xbf13('0x37')][0x1][_0xbf13('0x38')]:undefined)||_0xbf13('0x3f')},{'name':'attrFontSize','value':_0x58c0c4[_0xbf13('0x40')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x2]?_0x58c0c4[_0xbf13('0x37')][0x2][_0xbf13('0x38')]:undefined)||0xc}];case _0xbf13('0x41'):return[{'name':'attrMetric','value':_0x58c0c4['attrMetric']||(_0x58c0c4['attrs']&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0][_0xbf13('0x38')]:undefined)||_0xbf13('0x42')},{'name':'attrVoiceQueues','value':_0x58c0c4[_0xbf13('0x43')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x1]?_0x58c0c4[_0xbf13('0x37')][0x1][_0xbf13('0x38')]:undefined)||[]},{'name':_0xbf13('0x40'),'value':_0x58c0c4[_0xbf13('0x40')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x2]?_0x58c0c4[_0xbf13('0x37')][0x2]['value']:undefined)||0x14},{'name':_0xbf13('0x44'),'value':_0x58c0c4[_0xbf13('0x44')]||(_0x58c0c4['attrs']&&_0x58c0c4['attrs'][0x3]?_0x58c0c4['attrs'][0x3][_0xbf13('0x38')]:undefined)||_0xbf13('0x45')},{'name':_0xbf13('0x46'),'value':_0x58c0c4[_0xbf13('0x46')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x4]?_0x58c0c4[_0xbf13('0x37')][0x4]['value']:undefined)||''},{'name':_0xbf13('0x47'),'value':_0x58c0c4[_0xbf13('0x47')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x5]?_0x58c0c4[_0xbf13('0x37')][0x5][_0xbf13('0x38')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x58c0c4[_0xbf13('0x48')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x6]?_0x58c0c4[_0xbf13('0x37')][0x6][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x49'),'value':_0x58c0c4[_0xbf13('0x49')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x7]?_0x58c0c4[_0xbf13('0x37')][0x7][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x4a'),'value':_0x58c0c4[_0xbf13('0x4a')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x8]?_0x58c0c4[_0xbf13('0x37')][0x8]['value']:undefined)||''},{'name':_0xbf13('0x4b'),'value':_0x58c0c4[_0xbf13('0x4b')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x9]?_0x58c0c4[_0xbf13('0x37')][0x9][_0xbf13('0x38')]:undefined)||''}];case _0xbf13('0x4c'):case _0xbf13('0x4d'):return[{'name':_0xbf13('0x4e'),'value':_0x58c0c4[_0xbf13('0x4e')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0]['value']:undefined)||_0xbf13('0x42')},{'name':_0xbf13('0x4f'),'value':_0x58c0c4[_0xbf13('0x4f')]||(_0x58c0c4['attrs']&&_0x58c0c4[_0xbf13('0x37')][0x1]?_0x58c0c4['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x58c0c4[_0xbf13('0x50')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x2]?_0x58c0c4[_0xbf13('0x37')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x58c0c4[_0xbf13('0x43')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x3]?_0x58c0c4[_0xbf13('0x37')][0x3]['value']:undefined)||[]},{'name':_0xbf13('0x44'),'value':_0x58c0c4[_0xbf13('0x44')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x4]?_0x58c0c4['attrs'][0x4][_0xbf13('0x38')]:undefined)||_0xbf13('0x45')},{'name':'attrEmailAccounts','value':_0x58c0c4['attrEmailAccounts']||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x5]?_0x58c0c4[_0xbf13('0x37')][0x5][_0xbf13('0x38')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x58c0c4[_0xbf13('0x47')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x6]?_0x58c0c4[_0xbf13('0x37')][0x6][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x48'),'value':_0x58c0c4[_0xbf13('0x48')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x7]?_0x58c0c4[_0xbf13('0x37')][0x7][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x49'),'value':_0x58c0c4[_0xbf13('0x49')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x8]?_0x58c0c4['attrs'][0x8][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x4a'),'value':_0x58c0c4['attrWhatsappAccounts']||(_0x58c0c4['attrs']&&_0x58c0c4['attrs'][0x9]?_0x58c0c4[_0xbf13('0x37')][0x9][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x4b'),'value':_0x58c0c4[_0xbf13('0x4b')]||(_0x58c0c4['attrs']&&_0x58c0c4['attrs'][0xa]?_0x58c0c4['attrs'][0xa]['value']:undefined)||''}];case _0xbf13('0x51'):return[{'name':_0xbf13('0x52'),'type':_0x58c0c4[_0xbf13('0x53')]||(_0x58c0c4['attrs']&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0]['type']:undefined)||null,'value':_0x58c0c4[_0xbf13('0x52')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0][_0xbf13('0x38')]:undefined)||null},{'name':'attrRefresh','value':_0x58c0c4[_0xbf13('0x54')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x1]?_0x58c0c4['attrs'][0x1][_0xbf13('0x38')]:undefined)||0x0}];default:return[];}}catch(_0x19c8ac){logger[_0xbf13('0x26')](_0xbf13('0x55'),JSON['stringify'](_0x19c8ac));return[];}}exports['create']=function(_0x50390a,_0x199d4e){if(_0x50390a[_0xbf13('0x56')]){_0x50390a['body'][_0xbf13('0x37')]=widgetAttributes(_0x50390a[_0xbf13('0x56')]);}return db[_0xbf13('0x33')]['create'](_0x50390a['body'],{})[_0xbf13('0x24')](respondWithResult(_0x199d4e,0xc9))[_0xbf13('0x32')](handleError(_0x199d4e,null));};exports['update']=function(_0x11a2a4,_0x1458c5){if(_0x11a2a4[_0xbf13('0x56')]['id']){delete _0x11a2a4[_0xbf13('0x56')]['id'];}_0x11a2a4[_0xbf13('0x56')][_0xbf13('0x37')]=widgetAttributes(_0x11a2a4[_0xbf13('0x56')]);return db[_0xbf13('0x33')][_0xbf13('0x31')]({'where':{'id':_0x11a2a4[_0xbf13('0x29')]['id']}})[_0xbf13('0x24')](handleEntityNotFound(_0x1458c5,null))[_0xbf13('0x24')](saveUpdates(_0x11a2a4['body'],null))[_0xbf13('0x24')](respondWithResult(_0x1458c5,null))['catch'](handleError(_0x1458c5,null));};
\ No newline at end of file