Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / api / dashboard / dashboard.controller.js
index 84cb8a9..4967f97 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x35db=['squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','status','json','offset','limit','set','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','autoAssociation','update','iframe','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','nolimit','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x56579d,_0x3b32ce){var _0x1eabf2=function(_0x576c15){while(--_0x576c15){_0x56579d['push'](_0x56579d['shift']());}};_0x1eabf2(++_0x3b32ce);}(_0x35db,0x1d7));var _0xb35d=function(_0x44b26c,_0x3d2f43){_0x44b26c=_0x44b26c-0x0;var _0x20c13c=_0x35db[_0x44b26c];return _0x20c13c;};'use strict';var pdf=require(_0xb35d('0x0'));var emlformat=require(_0xb35d('0x1'));var rimraf=require(_0xb35d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb35d('0x3'));var rp=require(_0xb35d('0x4'));var moment=require(_0xb35d('0x5'));var BPromise=require(_0xb35d('0x6'));var Mustache=require(_0xb35d('0x7'));var util=require(_0xb35d('0x8'));var path=require(_0xb35d('0x9'));var sox=require(_0xb35d('0xa'));var csv=require('to-csv');var ejs=require(_0xb35d('0xb'));var fs=require('fs');var _=require(_0xb35d('0xc'));var squel=require(_0xb35d('0xd'));var crypto=require(_0xb35d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb35d('0xf'));var toCsv=require(_0xb35d('0x10'));var querystring=require('querystring');var Papa=require(_0xb35d('0x11'));var Redis=require(_0xb35d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb35d('0x13'));var hardwareService=require(_0xb35d('0x14'));var logger=require(_0xb35d('0x15'))(_0xb35d('0x16'));var utils=require(_0xb35d('0x17'));var config=require(_0xb35d('0x18'));var licenseUtil=require(_0xb35d('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb35d('0x1a')](config[_0xb35d('0x1b')],{'host':_0xb35d('0x1c'),'port':0x18eb});var socket=require(_0xb35d('0x1d'))(new Redis(config[_0xb35d('0x1b')]));require('./dashboard.socket')[_0xb35d('0x1e')](socket);function respondWithStatusCode(_0x3e95a9,_0x2e123a){_0x2e123a=_0x2e123a||0xcc;return function(_0x1c0c03){if(_0x1c0c03){return _0x3e95a9['sendStatus'](_0x2e123a);}return _0x3e95a9['status'](_0x2e123a)['end']();};}function respondWithResult(_0x305fbc,_0x1c33cd){_0x1c33cd=_0x1c33cd||0xc8;return function(_0xeaad59){if(_0xeaad59){return _0x305fbc[_0xb35d('0x1f')](_0x1c33cd)[_0xb35d('0x20')](_0xeaad59);}};}function respondWithFilteredResult(_0x2f73de,_0x371f34){return function(_0xea0378){if(_0xea0378){var _0x359fa9=_0xea0378['count'],_0x583265=_0x371f34['offset'],_0x2a4873=_0x371f34[_0xb35d('0x21')]+_0x371f34[_0xb35d('0x22')],_0x201308;if(_0x2a4873>=_0x359fa9){_0x2a4873=_0x359fa9;_0x201308=0xc8;}else{_0x201308=0xce;}_0x2f73de[_0xb35d('0x1f')](_0x201308);return _0x2f73de[_0xb35d('0x23')]('Content-Range',_0x583265+'-'+_0x2a4873+'/'+_0x359fa9)[_0xb35d('0x20')](_0xea0378);}return null;};}function patchUpdates(_0x15007b){return function(_0x3b1a13){try{jsonpatch[_0xb35d('0x24')](_0x3b1a13,_0x15007b,!![]);}catch(_0x563150){return BPromise[_0xb35d('0x25')](_0x563150);}return _0x3b1a13[_0xb35d('0x26')]();};}function saveUpdates(_0x43ff3c,_0x5c1765){return function(_0x5687c9){if(_0x5687c9){return _0x5687c9['update'](_0x43ff3c)[_0xb35d('0x27')](function(_0x24b27b){return _0x24b27b;});}return null;};}function removeEntity(_0x3130e2,_0x1b3be4){return function(_0x7bf1cc){if(_0x7bf1cc){return _0x7bf1cc[_0xb35d('0x28')]()['then'](function(){var _0x31060c=_0x7bf1cc[_0xb35d('0x29')]({'plain':!![]});var _0x3d142f=_0xb35d('0x2a');return db[_0xb35d('0x2b')][_0xb35d('0x28')]({'where':{'type':_0x3d142f,'resourceId':_0x31060c['id']}})[_0xb35d('0x27')](function(){return _0x7bf1cc;});})[_0xb35d('0x27')](function(){_0x3130e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a655e,_0x287264){return function(_0x21738a){if(!_0x21738a){_0x4a655e[_0xb35d('0x2c')](0x194);}return _0x21738a;};}function handleError(_0x2dcef5,_0x41575e){_0x41575e=_0x41575e||0x1f4;return function(_0x39513d){logger[_0xb35d('0x2d')](_0x39513d[_0xb35d('0x2e')]);if(_0x39513d[_0xb35d('0x2f')]){delete _0x39513d[_0xb35d('0x2f')];}_0x2dcef5[_0xb35d('0x1f')](_0x41575e)[_0xb35d('0x30')](_0x39513d);};}exports[_0xb35d('0x31')]=function(_0x171367,_0x545ed0){var _0x151c0f={},_0x3fdd0b={},_0x7bdba3={'count':0x0,'rows':[]};var _0x5803b2=_[_0xb35d('0x32')](db[_0xb35d('0x33')][_0xb35d('0x34')],function(_0x4f393c){return{'name':_0x4f393c[_0xb35d('0x35')],'type':_0x4f393c[_0xb35d('0x36')]['key']};});_0x3fdd0b[_0xb35d('0x37')]=_[_0xb35d('0x32')](_0x5803b2,'name');_0x3fdd0b[_0xb35d('0x38')]=_[_0xb35d('0x39')](_0x171367[_0xb35d('0x38')]);_0x3fdd0b[_0xb35d('0x3a')]=_['intersection'](_0x3fdd0b['model'],_0x3fdd0b[_0xb35d('0x38')]);_0x151c0f[_0xb35d('0x3b')]=_[_0xb35d('0x3c')](_0x3fdd0b[_0xb35d('0x37')],qs['fields'](_0x171367[_0xb35d('0x38')][_0xb35d('0x3d')]));_0x151c0f[_0xb35d('0x3b')]=_0x151c0f[_0xb35d('0x3b')][_0xb35d('0x3e')]?_0x151c0f[_0xb35d('0x3b')]:_0x3fdd0b[_0xb35d('0x37')];if(!_0x171367[_0xb35d('0x38')][_0xb35d('0x3f')]('nolimit')){_0x151c0f[_0xb35d('0x22')]=qs[_0xb35d('0x22')](_0x171367[_0xb35d('0x38')][_0xb35d('0x22')]);_0x151c0f[_0xb35d('0x21')]=qs['offset'](_0x171367[_0xb35d('0x38')][_0xb35d('0x21')]);}_0x151c0f[_0xb35d('0x40')]=qs[_0xb35d('0x41')](_0x171367[_0xb35d('0x38')][_0xb35d('0x41')]);_0x151c0f[_0xb35d('0x42')]=qs['filters'](_[_0xb35d('0x43')](_0x171367[_0xb35d('0x38')],_0x3fdd0b['filters']),_0x5803b2);if(_0x171367[_0xb35d('0x38')][_0xb35d('0x44')]){_0x151c0f[_0xb35d('0x42')]=_[_0xb35d('0x45')](_0x151c0f[_0xb35d('0x42')],{'$or':_[_0xb35d('0x32')](_0x5803b2,function(_0x487e6c){if(_0x487e6c[_0xb35d('0x36')]!==_0xb35d('0x46')){var _0x5c8266={};_0x5c8266[_0x487e6c[_0xb35d('0x2f')]]={'$like':'%'+_0x171367[_0xb35d('0x38')]['filter']+'%'};return _0x5c8266;}})});}_0x151c0f=_[_0xb35d('0x45')]({},_0x151c0f,_0x171367[_0xb35d('0x47')]);var _0x2d9cba={'where':_0x151c0f[_0xb35d('0x42')]};return db['Dashboard']['count'](_0x2d9cba)[_0xb35d('0x27')](function(_0x5a248b){_0x7bdba3[_0xb35d('0x48')]=_0x5a248b;if(_0x171367[_0xb35d('0x38')][_0xb35d('0x49')]){_0x151c0f[_0xb35d('0x4a')]=[{'all':!![]}];}return db[_0xb35d('0x33')][_0xb35d('0x4b')](_0x151c0f);})[_0xb35d('0x27')](function(_0x236ae5){_0x7bdba3['rows']=_0x236ae5;return _0x7bdba3;})[_0xb35d('0x27')](respondWithFilteredResult(_0x545ed0,_0x151c0f))[_0xb35d('0x4c')](handleError(_0x545ed0,null));};exports[_0xb35d('0x4d')]=function(_0x3d626a,_0x479c45){var _0x1785f0={'raw':![],'where':{'id':_0x3d626a[_0xb35d('0x4e')]['id']}},_0x3f1200={};_0x3f1200[_0xb35d('0x37')]=_['keys'](db[_0xb35d('0x33')]['rawAttributes']);_0x3f1200[_0xb35d('0x38')]=_[_0xb35d('0x39')](_0x3d626a[_0xb35d('0x38')]);_0x3f1200[_0xb35d('0x3a')]=_[_0xb35d('0x3c')](_0x3f1200[_0xb35d('0x37')],_0x3f1200[_0xb35d('0x38')]);_0x1785f0['attributes']=_[_0xb35d('0x3c')](_0x3f1200['model'],qs[_0xb35d('0x3d')](_0x3d626a[_0xb35d('0x38')][_0xb35d('0x3d')]));_0x1785f0[_0xb35d('0x3b')]=_0x1785f0['attributes'][_0xb35d('0x3e')]?_0x1785f0['attributes']:_0x3f1200['model'];if(_0x3d626a['query'][_0xb35d('0x49')]){_0x1785f0[_0xb35d('0x4a')]=[{'all':!![]}];}_0x1785f0=_['merge']({},_0x1785f0,_0x3d626a[_0xb35d('0x47')]);return db[_0xb35d('0x33')][_0xb35d('0x4f')](_0x1785f0)[_0xb35d('0x27')](handleEntityNotFound(_0x479c45,null))[_0xb35d('0x27')](respondWithResult(_0x479c45,null))[_0xb35d('0x4c')](handleError(_0x479c45,null));};exports['create']=function(_0x362442,_0xa580eb){return db[_0xb35d('0x33')]['create'](_0x362442[_0xb35d('0x50')],{})['then'](function(_0x25732e){var _0x158ee8=_0x362442['user']['get']({'plain':!![]});if(!_0x158ee8)throw new Error(_0xb35d('0x51'));if(_0x158ee8[_0xb35d('0x52')]===_0xb35d('0x53')){var _0x305cb9=_0x25732e[_0xb35d('0x29')]({'plain':!![]});var _0x381f36=_0xb35d('0x2a');return db[_0xb35d('0x54')][_0xb35d('0x4f')]({'where':{'name':_0x381f36,'userProfileId':_0x158ee8[_0xb35d('0x55')]},'raw':!![]})[_0xb35d('0x27')](function(_0x1511b1){if(_0x1511b1&&_0x1511b1['autoAssociation']===0x0){return db[_0xb35d('0x2b')][_0xb35d('0x56')]({'name':_0x305cb9[_0xb35d('0x2f')],'resourceId':_0x305cb9['id'],'type':_0x1511b1['name'],'sectionId':_0x1511b1['id']},{})[_0xb35d('0x27')](function(){return _0x25732e;});}else{return _0x25732e;}})['catch'](function(_0x2718d7){logger[_0xb35d('0x2d')](_0xb35d('0x57'),_0x2718d7);throw _0x2718d7;});}return _0x25732e;})[_0xb35d('0x27')](respondWithResult(_0xa580eb,0xc9))[_0xb35d('0x4c')](handleError(_0xa580eb,null));};exports[_0xb35d('0x58')]=function(_0x30a90d,_0x575d58){var _0xf62c0f={'where':{'id':_0x30a90d[_0xb35d('0x4e')]['id']}},_0x592875={};_0x592875[_0xb35d('0x37')]=_['keys'](db[_0xb35d('0x33')][_0xb35d('0x34')]);_0xf62c0f[_0xb35d('0x3b')]=_[_0xb35d('0x3c')](_0x592875['model'],qs[_0xb35d('0x3d')](_0x30a90d[_0xb35d('0x38')][_0xb35d('0x3d')]));_0xf62c0f[_0xb35d('0x3b')]=_0xf62c0f[_0xb35d('0x3b')][_0xb35d('0x3e')]?_0xf62c0f[_0xb35d('0x3b')]:_0x592875[_0xb35d('0x37')];if(_0x30a90d[_0xb35d('0x38')][_0xb35d('0x49')]){_0xf62c0f[_0xb35d('0x4a')]=[{'all':!![]}];}_0xf62c0f=_[_0xb35d('0x45')]({},_0xf62c0f,_0x30a90d['options']);return db[_0xb35d('0x33')]['find'](_0xf62c0f)[_0xb35d('0x27')](handleEntityNotFound(_0x575d58,null))['then'](function(_0x1faf81){if(_0x1faf81){var _0x1f2b55=_0x1faf81[_0xb35d('0x29')]({'plain':!![]});_0x1f2b55=qs[_0xb35d('0x59')](_0x1f2b55,['id','createdAt',_0xb35d('0x5a')]);_0x30a90d['body']=_[_0xb35d('0x59')](_0x30a90d[_0xb35d('0x50')],['id',_0xb35d('0x5b'),_0xb35d('0x5a')]);return db['Dashboard'][_0xb35d('0x56')](_[_0xb35d('0x45')](_0x1f2b55,_0x30a90d['body']),{'include':_0x30a90d[_0xb35d('0x38')][_0xb35d('0x49')]?[{'all':!![]}]:undefined})[_0xb35d('0x27')](function(_0x17cf53){var _0x23c494=_0x30a90d[_0xb35d('0x53')][_0xb35d('0x29')]({'plain':!![]});if(!_0x23c494)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23c494['role']===_0xb35d('0x53')){var _0x1d9c22=_0x17cf53[_0xb35d('0x29')]({'plain':!![]});var _0xd2c96e=_0xb35d('0x2a');return db[_0xb35d('0x54')][_0xb35d('0x4f')]({'where':{'name':_0xd2c96e,'userProfileId':_0x23c494[_0xb35d('0x55')]},'raw':!![]})['then'](function(_0x331b78){if(_0x331b78&&_0x331b78[_0xb35d('0x5c')]===0x0){return db[_0xb35d('0x2b')][_0xb35d('0x56')]({'name':_0x1d9c22['name'],'resourceId':_0x1d9c22['id'],'type':_0x331b78[_0xb35d('0x2f')],'sectionId':_0x331b78['id']},{})['then'](function(){return _0x17cf53;});}else{return _0x17cf53;}})[_0xb35d('0x4c')](function(_0x348074){logger[_0xb35d('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x348074);throw _0x348074;});}return _0x17cf53;});}})[_0xb35d('0x27')](respondWithResult(_0x575d58,0xc9))[_0xb35d('0x4c')](handleError(_0x575d58,null));};exports[_0xb35d('0x5d')]=function(_0x1461f3,_0x3731f1){if(_0x1461f3[_0xb35d('0x50')]['id']){delete _0x1461f3[_0xb35d('0x50')]['id'];}return db[_0xb35d('0x33')]['find']({'where':{'id':_0x1461f3[_0xb35d('0x4e')]['id']}})[_0xb35d('0x27')](handleEntityNotFound(_0x3731f1,null))['then'](saveUpdates(_0x1461f3[_0xb35d('0x50')],null))[_0xb35d('0x27')](respondWithResult(_0x3731f1,null))[_0xb35d('0x4c')](handleError(_0x3731f1,null));};exports[_0xb35d('0x28')]=function(_0xef273f,_0x887b7f){return db[_0xb35d('0x33')][_0xb35d('0x4f')]({'where':{'id':_0xef273f[_0xb35d('0x4e')]['id']}})[_0xb35d('0x27')](handleEntityNotFound(_0x887b7f,null))['then'](removeEntity(_0x887b7f,null))['catch'](handleError(_0x887b7f,null));};function widgetAttributes(_0x1e571c){try{switch(_0x1e571c[_0xb35d('0x36')]){case _0xb35d('0x5e'):return[{'name':'attrUrl','value':_0x1e571c['attrUrl']||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x0]?_0x1e571c[_0xb35d('0x5f')][0x0]['value']:undefined)||_0xb35d('0x60')}];case _0xb35d('0x61'):return[{'name':_0xb35d('0x62'),'value':_0x1e571c[_0xb35d('0x62')]||(_0x1e571c['attrs']&&_0x1e571c['attrs'][0x0]?_0x1e571c[_0xb35d('0x5f')][0x0][_0xb35d('0x63')]:undefined)||''}];case _0xb35d('0x64'):return[{'name':_0xb35d('0x65'),'value':_0x1e571c[_0xb35d('0x65')]||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x0]?_0x1e571c[_0xb35d('0x5f')][0x0][_0xb35d('0x63')]:undefined)||_0xb35d('0x66')},{'name':_0xb35d('0x67'),'value':_0x1e571c['attrTimezone']||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x1]?_0x1e571c['attrs'][0x1][_0xb35d('0x63')]:undefined)||_0xb35d('0x68')},{'name':_0xb35d('0x69'),'value':_0x1e571c['attrFontSize']||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x2]?_0x1e571c[_0xb35d('0x5f')][0x2][_0xb35d('0x63')]:undefined)||0xc}];case _0xb35d('0x6a'):return[{'name':_0xb35d('0x6b'),'value':_0x1e571c[_0xb35d('0x6b')]||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x0]?_0x1e571c[_0xb35d('0x5f')][0x0][_0xb35d('0x63')]:undefined)||_0xb35d('0x6c')},{'name':_0xb35d('0x6d'),'value':_0x1e571c[_0xb35d('0x6d')]||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x1]?_0x1e571c[_0xb35d('0x5f')][0x1][_0xb35d('0x63')]:undefined)||[]},{'name':_0xb35d('0x69'),'value':_0x1e571c[_0xb35d('0x69')]||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c['attrs'][0x2]?_0x1e571c[_0xb35d('0x5f')][0x2][_0xb35d('0x63')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0xb35d('0x6e'),'value':_0x1e571c['attrSerie1']||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x0]?_0x1e571c[_0xb35d('0x5f')][0x0]['value']:undefined)||'total'},{'name':_0xb35d('0x6f'),'value':_0x1e571c['attrSerie2']||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x1]?_0x1e571c[_0xb35d('0x5f')][0x1]['value']:undefined)||null},{'name':_0xb35d('0x70'),'value':_0x1e571c[_0xb35d('0x70')]||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x2]?_0x1e571c[_0xb35d('0x5f')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x1e571c[_0xb35d('0x6d')]||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c['attrs'][0x3]?_0x1e571c['attrs'][0x3][_0xb35d('0x63')]:undefined)||[]}];case _0xb35d('0x71'):return[{'name':_0xb35d('0x72'),'type':_0x1e571c[_0xb35d('0x73')]||(_0x1e571c['attrs']&&_0x1e571c[_0xb35d('0x5f')][0x0]?_0x1e571c['attrs'][0x0]['type']:undefined)||null,'value':_0x1e571c['attrReport']||(_0x1e571c[_0xb35d('0x5f')]&&_0x1e571c[_0xb35d('0x5f')][0x0]?_0x1e571c[_0xb35d('0x5f')][0x0][_0xb35d('0x63')]:undefined)||null},{'name':'attrRefresh','value':_0x1e571c['attrRefresh']||(_0x1e571c['attrs']&&_0x1e571c[_0xb35d('0x5f')][0x1]?_0x1e571c[_0xb35d('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x270b14){logger['error'](_0xb35d('0x74'),JSON['stringify'](_0x270b14));return[];}}exports['addItem']=function(_0x4be05d,_0x1c2552,_0x55ca96){if(_0x4be05d[_0xb35d('0x50')]['id']){delete _0x4be05d[_0xb35d('0x50')]['id'];}return db['Dashboard'][_0xb35d('0x4f')]({'where':{'id':_0x4be05d[_0xb35d('0x4e')]['id']}})[_0xb35d('0x27')](handleEntityNotFound(_0x1c2552,null))[_0xb35d('0x27')](function(_0x6f2c51){if(_0x6f2c51){_0x4be05d[_0xb35d('0x50')][_0xb35d('0x75')]=_0x6f2c51['id'];_0x4be05d[_0xb35d('0x50')][_0xb35d('0x5f')]=widgetAttributes(_0x4be05d['body']);return db['DashboardItem'][_0xb35d('0x56')](_0x4be05d[_0xb35d('0x50')]);}})[_0xb35d('0x27')](respondWithResult(_0x1c2552,null))[_0xb35d('0x4c')](handleError(_0x1c2552,null));};exports['getItems']=function(_0x4fce46,_0x17d59a,_0x6a6620){var _0x1b7c0d={};var _0x3860d5={};var _0x527db2;var _0x47adb9;return db[_0xb35d('0x33')]['findOne']({'where':{'id':_0x4fce46[_0xb35d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17d59a,null))[_0xb35d('0x27')](function(_0x2ac936){if(_0x2ac936){_0x527db2=_0x2ac936;_0x3860d5[_0xb35d('0x37')]=_[_0xb35d('0x39')](db[_0xb35d('0x76')][_0xb35d('0x34')]);_0x3860d5[_0xb35d('0x38')]=_['keys'](_0x4fce46[_0xb35d('0x38')]);_0x3860d5[_0xb35d('0x3a')]=_[_0xb35d('0x3c')](_0x3860d5[_0xb35d('0x37')],_0x3860d5[_0xb35d('0x38')]);_0x1b7c0d['attributes']=_['intersection'](_0x3860d5['model'],qs['fields'](_0x4fce46[_0xb35d('0x38')][_0xb35d('0x3d')]));_0x1b7c0d[_0xb35d('0x3b')]=_0x1b7c0d[_0xb35d('0x3b')][_0xb35d('0x3e')]?_0x1b7c0d[_0xb35d('0x3b')]:_0x3860d5[_0xb35d('0x37')];_0x1b7c0d[_0xb35d('0x40')]=qs[_0xb35d('0x41')](_0x4fce46['query'][_0xb35d('0x41')]);_0x1b7c0d['where']=qs[_0xb35d('0x3a')](_['pick'](_0x4fce46[_0xb35d('0x38')],_0x3860d5[_0xb35d('0x3a')]));if(_0x4fce46['query'][_0xb35d('0x44')]){_0x1b7c0d['where']=_[_0xb35d('0x45')](_0x1b7c0d[_0xb35d('0x42')],{'$or':_[_0xb35d('0x32')](_0x1b7c0d['attributes'],function(_0x13f78c){var _0x200099={};_0x200099[_0x13f78c]={'$like':'%'+_0x4fce46['query'][_0xb35d('0x44')]+'%'};return _0x200099;})});}_0x1b7c0d=_[_0xb35d('0x45')]({},_0x1b7c0d,_0x4fce46[_0xb35d('0x47')]);return _0x527db2[_0xb35d('0x77')](_0x1b7c0d);}})[_0xb35d('0x27')](function(_0x32a187){if(_0x32a187){_0x47adb9=_0x32a187['length'];if(!_0x4fce46[_0xb35d('0x38')][_0xb35d('0x3f')](_0xb35d('0x78'))){_0x1b7c0d[_0xb35d('0x22')]=qs[_0xb35d('0x22')](_0x4fce46[_0xb35d('0x38')][_0xb35d('0x22')]);_0x1b7c0d[_0xb35d('0x21')]=qs[_0xb35d('0x21')](_0x4fce46[_0xb35d('0x38')]['offset']);}return _0x527db2['getItems'](_0x1b7c0d);}})['then'](function(_0x49094){if(_0x49094){return _0x49094?{'count':_0x47adb9,'rows':_0x49094}:null;}})[_0xb35d('0x27')](respondWithResult(_0x17d59a,null))[_0xb35d('0x4c')](handleError(_0x17d59a,null));};
\ No newline at end of file
+var _0xdc8a=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','autoAssociation','update','type','iframe','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','nolimit','getItems','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x47bba9,_0x592e4e){var _0x31cc0a=function(_0x3cbc8c){while(--_0x3cbc8c){_0x47bba9['push'](_0x47bba9['shift']());}};_0x31cc0a(++_0x592e4e);}(_0xdc8a,0xf6));var _0xadc8=function(_0x56769e,_0x1528ac){_0x56769e=_0x56769e-0x0;var _0x5cb354=_0xdc8a[_0x56769e];return _0x5cb354;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xadc8('0x0'));var rimraf=require(_0xadc8('0x1'));var zipdir=require(_0xadc8('0x2'));var jsonpatch=require(_0xadc8('0x3'));var rp=require(_0xadc8('0x4'));var moment=require(_0xadc8('0x5'));var BPromise=require(_0xadc8('0x6'));var Mustache=require(_0xadc8('0x7'));var util=require(_0xadc8('0x8'));var path=require(_0xadc8('0x9'));var sox=require(_0xadc8('0xa'));var csv=require(_0xadc8('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xadc8('0xc'));var squel=require(_0xadc8('0xd'));var crypto=require(_0xadc8('0xe'));var jsforce=require(_0xadc8('0xf'));var deskjs=require(_0xadc8('0x10'));var toCsv=require(_0xadc8('0xb'));var querystring=require(_0xadc8('0x11'));var Papa=require('papaparse');var Redis=require(_0xadc8('0x12'));var authService=require(_0xadc8('0x13'));var qs=require(_0xadc8('0x14'));var as=require(_0xadc8('0x15'));var hardwareService=require(_0xadc8('0x16'));var logger=require(_0xadc8('0x17'))(_0xadc8('0x18'));var utils=require('../../config/utils');var config=require(_0xadc8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xadc8('0x1a'))['db'];config[_0xadc8('0x1b')]=_[_0xadc8('0x1c')](config[_0xadc8('0x1b')],{'host':_0xadc8('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xadc8('0x1e'))[_0xadc8('0x1f')](socket);function respondWithStatusCode(_0x238226,_0x148dec){_0x148dec=_0x148dec||0xcc;return function(_0x58b0c4){if(_0x58b0c4){return _0x238226['sendStatus'](_0x148dec);}return _0x238226[_0xadc8('0x20')](_0x148dec)[_0xadc8('0x21')]();};}function respondWithResult(_0x4ace5a,_0x225b73){_0x225b73=_0x225b73||0xc8;return function(_0x1bc391){if(_0x1bc391){return _0x4ace5a[_0xadc8('0x20')](_0x225b73)[_0xadc8('0x22')](_0x1bc391);}};}function respondWithFilteredResult(_0x2a41b5,_0x819b9a){return function(_0x5e5d25){if(_0x5e5d25){var _0x3b703d=_0x5e5d25[_0xadc8('0x23')],_0x12a84d=_0x819b9a[_0xadc8('0x24')],_0x11c1fb=_0x819b9a[_0xadc8('0x24')]+_0x819b9a[_0xadc8('0x25')],_0x35d10a;if(_0x11c1fb>=_0x3b703d){_0x11c1fb=_0x3b703d;_0x35d10a=0xc8;}else{_0x35d10a=0xce;}_0x2a41b5[_0xadc8('0x20')](_0x35d10a);return _0x2a41b5[_0xadc8('0x26')](_0xadc8('0x27'),_0x12a84d+'-'+_0x11c1fb+'/'+_0x3b703d)[_0xadc8('0x22')](_0x5e5d25);}return null;};}function patchUpdates(_0x40fa61){return function(_0x509b74){try{jsonpatch['apply'](_0x509b74,_0x40fa61,!![]);}catch(_0x53e08a){return BPromise[_0xadc8('0x28')](_0x53e08a);}return _0x509b74[_0xadc8('0x29')]();};}function saveUpdates(_0x37ccd9,_0x40fa18){return function(_0x38e834){if(_0x38e834){return _0x38e834['update'](_0x37ccd9)['then'](function(_0x336307){return _0x336307;});}return null;};}function removeEntity(_0x5a33d3,_0x3743e2){return function(_0x30eb14){if(_0x30eb14){return _0x30eb14[_0xadc8('0x2a')]()[_0xadc8('0x2b')](function(){var _0x172acc=_0x30eb14[_0xadc8('0x2c')]({'plain':!![]});var _0x219945='CustomDashboards';return db[_0xadc8('0x2d')][_0xadc8('0x2a')]({'where':{'type':_0x219945,'resourceId':_0x172acc['id']}})[_0xadc8('0x2b')](function(){return _0x30eb14;});})[_0xadc8('0x2b')](function(){_0x5a33d3[_0xadc8('0x20')](0xcc)[_0xadc8('0x21')]();});}};}function handleEntityNotFound(_0x18b025,_0x5e1edc){return function(_0x539ebb){if(!_0x539ebb){_0x18b025[_0xadc8('0x2e')](0x194);}return _0x539ebb;};}function handleError(_0x4a91e0,_0x575704){_0x575704=_0x575704||0x1f4;return function(_0x47d687){logger[_0xadc8('0x2f')](_0x47d687[_0xadc8('0x30')]);if(_0x47d687[_0xadc8('0x31')]){delete _0x47d687[_0xadc8('0x31')];}_0x4a91e0[_0xadc8('0x20')](_0x575704)[_0xadc8('0x32')](_0x47d687);};}exports[_0xadc8('0x33')]=function(_0x2d49da,_0x4b48ce){var _0x59b062={},_0x2962bd={},_0x3b6c16={'count':0x0,'rows':[]};var _0x4eada9=_[_0xadc8('0x34')](db[_0xadc8('0x35')][_0xadc8('0x36')],function(_0x11d85d){return{'name':_0x11d85d[_0xadc8('0x37')],'type':_0x11d85d['type'][_0xadc8('0x38')]};});_0x2962bd[_0xadc8('0x39')]=_['map'](_0x4eada9,_0xadc8('0x31'));_0x2962bd['query']=_[_0xadc8('0x3a')](_0x2d49da[_0xadc8('0x3b')]);_0x2962bd[_0xadc8('0x3c')]=_[_0xadc8('0x3d')](_0x2962bd[_0xadc8('0x39')],_0x2962bd[_0xadc8('0x3b')]);_0x59b062[_0xadc8('0x3e')]=_[_0xadc8('0x3d')](_0x2962bd[_0xadc8('0x39')],qs[_0xadc8('0x3f')](_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x3f')]));_0x59b062[_0xadc8('0x3e')]=_0x59b062[_0xadc8('0x3e')][_0xadc8('0x40')]?_0x59b062['attributes']:_0x2962bd[_0xadc8('0x39')];if(!_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x41')]('nolimit')){_0x59b062[_0xadc8('0x25')]=qs[_0xadc8('0x25')](_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x25')]);_0x59b062[_0xadc8('0x24')]=qs[_0xadc8('0x24')](_0x2d49da[_0xadc8('0x3b')]['offset']);}_0x59b062[_0xadc8('0x42')]=qs[_0xadc8('0x43')](_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x43')]);_0x59b062[_0xadc8('0x44')]=qs['filters'](_[_0xadc8('0x45')](_0x2d49da[_0xadc8('0x3b')],_0x2962bd[_0xadc8('0x3c')]),_0x4eada9);if(_0x2d49da['query'][_0xadc8('0x46')]){_0x59b062[_0xadc8('0x44')]=_['merge'](_0x59b062[_0xadc8('0x44')],{'$or':_[_0xadc8('0x34')](_0x4eada9,function(_0x5afa9c){if(_0x5afa9c['type']!==_0xadc8('0x47')){var _0x2a1d0e={};_0x2a1d0e[_0x5afa9c[_0xadc8('0x31')]]={'$like':'%'+_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x46')]+'%'};return _0x2a1d0e;}})});}_0x59b062=_['merge']({},_0x59b062,_0x2d49da[_0xadc8('0x48')]);var _0xfbdb57={'where':_0x59b062['where']};return db[_0xadc8('0x35')]['count'](_0xfbdb57)[_0xadc8('0x2b')](function(_0x3cd9c5){_0x3b6c16['count']=_0x3cd9c5;if(_0x2d49da[_0xadc8('0x3b')]['includeAll']){_0x59b062[_0xadc8('0x49')]=[{'all':!![]}];}return db[_0xadc8('0x35')][_0xadc8('0x4a')](_0x59b062);})[_0xadc8('0x2b')](function(_0x49ce77){_0x3b6c16[_0xadc8('0x4b')]=_0x49ce77;return _0x3b6c16;})['then'](respondWithFilteredResult(_0x4b48ce,_0x59b062))[_0xadc8('0x4c')](handleError(_0x4b48ce,null));};exports['show']=function(_0x175401,_0x3a5c23){var _0x2528c7={'raw':![],'where':{'id':_0x175401[_0xadc8('0x4d')]['id']}},_0x3c22e5={};_0x3c22e5[_0xadc8('0x39')]=_[_0xadc8('0x3a')](db[_0xadc8('0x35')][_0xadc8('0x36')]);_0x3c22e5['query']=_[_0xadc8('0x3a')](_0x175401[_0xadc8('0x3b')]);_0x3c22e5[_0xadc8('0x3c')]=_[_0xadc8('0x3d')](_0x3c22e5['model'],_0x3c22e5[_0xadc8('0x3b')]);_0x2528c7[_0xadc8('0x3e')]=_['intersection'](_0x3c22e5['model'],qs[_0xadc8('0x3f')](_0x175401[_0xadc8('0x3b')][_0xadc8('0x3f')]));_0x2528c7['attributes']=_0x2528c7[_0xadc8('0x3e')]['length']?_0x2528c7[_0xadc8('0x3e')]:_0x3c22e5[_0xadc8('0x39')];if(_0x175401[_0xadc8('0x3b')][_0xadc8('0x4e')]){_0x2528c7[_0xadc8('0x49')]=[{'all':!![]}];}_0x2528c7=_[_0xadc8('0x4f')]({},_0x2528c7,_0x175401['options']);return db[_0xadc8('0x35')]['find'](_0x2528c7)[_0xadc8('0x2b')](handleEntityNotFound(_0x3a5c23,null))[_0xadc8('0x2b')](respondWithResult(_0x3a5c23,null))['catch'](handleError(_0x3a5c23,null));};exports['create']=function(_0x5e9add,_0x57722b){return db[_0xadc8('0x35')][_0xadc8('0x50')](_0x5e9add[_0xadc8('0x51')],{})[_0xadc8('0x2b')](function(_0x3549fb){var _0x27b724=_0x5e9add[_0xadc8('0x52')][_0xadc8('0x2c')]({'plain':!![]});if(!_0x27b724)throw new Error(_0xadc8('0x53'));if(_0x27b724[_0xadc8('0x54')]===_0xadc8('0x52')){var _0x4d87cc=_0x3549fb['get']({'plain':!![]});var _0x101103=_0xadc8('0x55');return db[_0xadc8('0x56')]['find']({'where':{'name':_0x101103,'userProfileId':_0x27b724[_0xadc8('0x57')]},'raw':!![]})['then'](function(_0x2d1617){if(_0x2d1617&&_0x2d1617['autoAssociation']===0x0){return db[_0xadc8('0x2d')]['create']({'name':_0x4d87cc[_0xadc8('0x31')],'resourceId':_0x4d87cc['id'],'type':_0x2d1617['name'],'sectionId':_0x2d1617['id']},{})['then'](function(){return _0x3549fb;});}else{return _0x3549fb;}})[_0xadc8('0x4c')](function(_0x2ade76){logger[_0xadc8('0x2f')](_0xadc8('0x58'),_0x2ade76);throw _0x2ade76;});}return _0x3549fb;})[_0xadc8('0x2b')](respondWithResult(_0x57722b,0xc9))[_0xadc8('0x4c')](handleError(_0x57722b,null));};exports[_0xadc8('0x59')]=function(_0x34ff14,_0x5ee910){var _0x40ec53={'where':{'id':_0x34ff14[_0xadc8('0x4d')]['id']}},_0x3b8739={};_0x3b8739['model']=_[_0xadc8('0x3a')](db[_0xadc8('0x35')][_0xadc8('0x36')]);_0x40ec53['attributes']=_[_0xadc8('0x3d')](_0x3b8739[_0xadc8('0x39')],qs[_0xadc8('0x3f')](_0x34ff14[_0xadc8('0x3b')]['fields']));_0x40ec53[_0xadc8('0x3e')]=_0x40ec53['attributes'][_0xadc8('0x40')]?_0x40ec53[_0xadc8('0x3e')]:_0x3b8739[_0xadc8('0x39')];if(_0x34ff14[_0xadc8('0x3b')][_0xadc8('0x4e')]){_0x40ec53['include']=[{'all':!![]}];}_0x40ec53=_[_0xadc8('0x4f')]({},_0x40ec53,_0x34ff14[_0xadc8('0x48')]);return db[_0xadc8('0x35')][_0xadc8('0x5a')](_0x40ec53)['then'](handleEntityNotFound(_0x5ee910,null))[_0xadc8('0x2b')](function(_0x4df7e6){if(_0x4df7e6){var _0x73cb3f=_0x4df7e6['get']({'plain':!![]});_0x73cb3f=qs[_0xadc8('0x5b')](_0x73cb3f,['id',_0xadc8('0x5c'),_0xadc8('0x5d')]);_0x34ff14['body']=_[_0xadc8('0x5b')](_0x34ff14[_0xadc8('0x51')],['id',_0xadc8('0x5c'),_0xadc8('0x5d')]);return db[_0xadc8('0x35')]['create'](_[_0xadc8('0x4f')](_0x73cb3f,_0x34ff14[_0xadc8('0x51')]),{'include':_0x34ff14['query'][_0xadc8('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x2e3c09){var _0x180a87=_0x34ff14['user'][_0xadc8('0x2c')]({'plain':!![]});if(!_0x180a87)throw new Error(_0xadc8('0x53'));if(_0x180a87[_0xadc8('0x54')]===_0xadc8('0x52')){var _0x56e93e=_0x2e3c09[_0xadc8('0x2c')]({'plain':!![]});var _0x1180fc='CustomDashboards';return db[_0xadc8('0x56')]['find']({'where':{'name':_0x1180fc,'userProfileId':_0x180a87[_0xadc8('0x57')]},'raw':!![]})[_0xadc8('0x2b')](function(_0x3985cf){if(_0x3985cf&&_0x3985cf[_0xadc8('0x5e')]===0x0){return db[_0xadc8('0x2d')][_0xadc8('0x50')]({'name':_0x56e93e[_0xadc8('0x31')],'resourceId':_0x56e93e['id'],'type':_0x3985cf[_0xadc8('0x31')],'sectionId':_0x3985cf['id']},{})[_0xadc8('0x2b')](function(){return _0x2e3c09;});}else{return _0x2e3c09;}})['catch'](function(_0x256ac6){logger[_0xadc8('0x2f')](_0xadc8('0x58'),_0x256ac6);throw _0x256ac6;});}return _0x2e3c09;});}})[_0xadc8('0x2b')](respondWithResult(_0x5ee910,0xc9))[_0xadc8('0x4c')](handleError(_0x5ee910,null));};exports[_0xadc8('0x5f')]=function(_0x389e20,_0x53eb3a){if(_0x389e20[_0xadc8('0x51')]['id']){delete _0x389e20[_0xadc8('0x51')]['id'];}return db['Dashboard'][_0xadc8('0x5a')]({'where':{'id':_0x389e20[_0xadc8('0x4d')]['id']}})[_0xadc8('0x2b')](handleEntityNotFound(_0x53eb3a,null))['then'](saveUpdates(_0x389e20['body'],null))[_0xadc8('0x2b')](respondWithResult(_0x53eb3a,null))[_0xadc8('0x4c')](handleError(_0x53eb3a,null));};exports[_0xadc8('0x2a')]=function(_0x100162,_0x1f74a8){return db['Dashboard'][_0xadc8('0x5a')]({'where':{'id':_0x100162['params']['id']}})['then'](handleEntityNotFound(_0x1f74a8,null))['then'](removeEntity(_0x1f74a8,null))[_0xadc8('0x4c')](handleError(_0x1f74a8,null));};function widgetAttributes(_0x39800d){try{switch(_0x39800d[_0xadc8('0x60')]){case _0xadc8('0x61'):return[{'name':'attrUrl','value':_0x39800d['attrUrl']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x63')]:undefined)||'https://'}];case _0xadc8('0x64'):return[{'name':'attrPath','value':_0x39800d[_0xadc8('0x65')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x63')]:undefined)||''}];case _0xadc8('0x66'):return[{'name':_0xadc8('0x67'),'value':_0x39800d['attrHourFormat']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x39800d[_0xadc8('0x68')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x1]?_0x39800d[_0xadc8('0x62')][0x1][_0xadc8('0x63')]:undefined)||'0.00'},{'name':_0xadc8('0x69'),'value':_0x39800d['attrFontSize']||(_0x39800d['attrs']&&_0x39800d[_0xadc8('0x62')][0x2]?_0x39800d['attrs'][0x2][_0xadc8('0x63')]:undefined)||0xc}];case _0xadc8('0x6a'):return[{'name':_0xadc8('0x6b'),'value':_0x39800d['attrMetric']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x63')]:undefined)||_0xadc8('0x6c')},{'name':'attrVoiceQueues','value':_0x39800d['attrVoiceQueues']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d['attrs'][0x1]?_0x39800d[_0xadc8('0x62')][0x1][_0xadc8('0x63')]:undefined)||[]},{'name':_0xadc8('0x69'),'value':_0x39800d[_0xadc8('0x69')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d['attrs'][0x2]?_0x39800d[_0xadc8('0x62')][0x2][_0xadc8('0x63')]:undefined)||0x14}];case _0xadc8('0x6d'):case _0xadc8('0x6e'):return[{'name':_0xadc8('0x6f'),'value':_0x39800d[_0xadc8('0x6f')]||(_0x39800d['attrs']&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d['attrs'][0x0][_0xadc8('0x63')]:undefined)||'total'},{'name':_0xadc8('0x70'),'value':_0x39800d[_0xadc8('0x70')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x1]?_0x39800d['attrs'][0x1][_0xadc8('0x63')]:undefined)||null},{'name':_0xadc8('0x71'),'value':_0x39800d[_0xadc8('0x71')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x2]?_0x39800d[_0xadc8('0x62')][0x2][_0xadc8('0x63')]:undefined)||null},{'name':_0xadc8('0x72'),'value':_0x39800d[_0xadc8('0x72')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x3]?_0x39800d[_0xadc8('0x62')][0x3][_0xadc8('0x63')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x39800d['reportType']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d['attrs'][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x60')]:undefined)||null,'value':_0x39800d[_0xadc8('0x73')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x63')]:undefined)||null},{'name':_0xadc8('0x74'),'value':_0x39800d[_0xadc8('0x74')]||(_0x39800d['attrs']&&_0x39800d[_0xadc8('0x62')][0x1]?_0x39800d[_0xadc8('0x62')][0x1][_0xadc8('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x4ad009){logger[_0xadc8('0x2f')](_0xadc8('0x75'),JSON[_0xadc8('0x76')](_0x4ad009));return[];}}exports[_0xadc8('0x77')]=function(_0xfa73ed,_0xa0859e,_0x367f0c){if(_0xfa73ed[_0xadc8('0x51')]['id']){delete _0xfa73ed[_0xadc8('0x51')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xfa73ed[_0xadc8('0x4d')]['id']}})[_0xadc8('0x2b')](handleEntityNotFound(_0xa0859e,null))[_0xadc8('0x2b')](function(_0x58f440){if(_0x58f440){_0xfa73ed[_0xadc8('0x51')][_0xadc8('0x78')]=_0x58f440['id'];_0xfa73ed['body'][_0xadc8('0x62')]=widgetAttributes(_0xfa73ed[_0xadc8('0x51')]);return db[_0xadc8('0x79')][_0xadc8('0x50')](_0xfa73ed['body']);}})[_0xadc8('0x2b')](respondWithResult(_0xa0859e,null))[_0xadc8('0x4c')](handleError(_0xa0859e,null));};exports['getItems']=function(_0x462d6a,_0x480ac2,_0x25b89c){var _0x324a38={};var _0xcc1121={};var _0x19e0f8;var _0x4a1cf5;return db['Dashboard'][_0xadc8('0x7a')]({'where':{'id':_0x462d6a[_0xadc8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x480ac2,null))[_0xadc8('0x2b')](function(_0x206f5f){if(_0x206f5f){_0x19e0f8=_0x206f5f;_0xcc1121[_0xadc8('0x39')]=_['keys'](db[_0xadc8('0x79')][_0xadc8('0x36')]);_0xcc1121[_0xadc8('0x3b')]=_['keys'](_0x462d6a[_0xadc8('0x3b')]);_0xcc1121[_0xadc8('0x3c')]=_[_0xadc8('0x3d')](_0xcc1121[_0xadc8('0x39')],_0xcc1121['query']);_0x324a38[_0xadc8('0x3e')]=_['intersection'](_0xcc1121[_0xadc8('0x39')],qs[_0xadc8('0x3f')](_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x3f')]));_0x324a38[_0xadc8('0x3e')]=_0x324a38[_0xadc8('0x3e')][_0xadc8('0x40')]?_0x324a38[_0xadc8('0x3e')]:_0xcc1121[_0xadc8('0x39')];_0x324a38[_0xadc8('0x42')]=qs[_0xadc8('0x43')](_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x43')]);_0x324a38[_0xadc8('0x44')]=qs['filters'](_[_0xadc8('0x45')](_0x462d6a[_0xadc8('0x3b')],_0xcc1121[_0xadc8('0x3c')]));if(_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x46')]){_0x324a38[_0xadc8('0x44')]=_[_0xadc8('0x4f')](_0x324a38['where'],{'$or':_[_0xadc8('0x34')](_0x324a38[_0xadc8('0x3e')],function(_0x19b878){var _0x418e2b={};_0x418e2b[_0x19b878]={'$like':'%'+_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x46')]+'%'};return _0x418e2b;})});}_0x324a38=_[_0xadc8('0x4f')]({},_0x324a38,_0x462d6a[_0xadc8('0x48')]);return _0x19e0f8['getItems'](_0x324a38);}})[_0xadc8('0x2b')](function(_0x108d0b){if(_0x108d0b){_0x4a1cf5=_0x108d0b[_0xadc8('0x40')];if(!_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x41')](_0xadc8('0x7b'))){_0x324a38[_0xadc8('0x25')]=qs[_0xadc8('0x25')](_0x462d6a['query'][_0xadc8('0x25')]);_0x324a38[_0xadc8('0x24')]=qs['offset'](_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x24')]);}return _0x19e0f8[_0xadc8('0x7c')](_0x324a38);}})[_0xadc8('0x2b')](function(_0x28a0f9){if(_0x28a0f9){return _0x28a0f9?{'count':_0x4a1cf5,'rows':_0x28a0f9}:null;}})[_0xadc8('0x2b')](respondWithResult(_0x480ac2,null))[_0xadc8('0x4c')](handleError(_0x480ac2,null));};
\ No newline at end of file