Built motion from commit f74363e9.|2.6.34
[motion2.git] / server / api / dashboard / dashboard.controller.js
index 3ddd0b8..0fa4501 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b5e=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','UserProfileResource','stack','name','send','index','map','Dashboard','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','error','clone','length','omit','createdAt','body','updatedAt','update','destroy','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','findOne','getItems','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x10eb4f,_0x356f91){var _0x4743ff=function(_0x2d0287){while(--_0x2d0287){_0x10eb4f['push'](_0x10eb4f['shift']());}};_0x4743ff(++_0x356f91);}(_0x9b5e,0x7a));var _0xe9b5=function(_0x400e4a,_0x29ef2d){_0x400e4a=_0x400e4a-0x0;var _0x4c1cae=_0x9b5e[_0x400e4a];return _0x4c1cae;};'use strict';var emlformat=require(_0xe9b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9b5('0x2'));var moment=require(_0xe9b5('0x3'));var BPromise=require(_0xe9b5('0x4'));var Mustache=require(_0xe9b5('0x5'));var util=require(_0xe9b5('0x6'));var path=require(_0xe9b5('0x7'));var sox=require(_0xe9b5('0x8'));var csv=require('to-csv');var ejs=require(_0xe9b5('0x9'));var fs=require('fs');var fs_extra=require(_0xe9b5('0xa'));var _=require(_0xe9b5('0xb'));var squel=require(_0xe9b5('0xc'));var crypto=require(_0xe9b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe9b5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe9b5('0xf'));var Papa=require('papaparse');var Redis=require(_0xe9b5('0x10'));var authService=require(_0xe9b5('0x11'));var qs=require(_0xe9b5('0x12'));var as=require(_0xe9b5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9b5('0x14'))(_0xe9b5('0x15'));var utils=require(_0xe9b5('0x16'));var config=require(_0xe9b5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9b5('0x18'))['db'];config[_0xe9b5('0x19')]=_[_0xe9b5('0x1a')](config[_0xe9b5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9b5('0x1b'))(new Redis(config[_0xe9b5('0x19')]));require(_0xe9b5('0x1c'))[_0xe9b5('0x1d')](socket);function respondWithStatusCode(_0x4bc6a5,_0x4525e1){_0x4525e1=_0x4525e1||0xcc;return function(_0x7450cb){if(_0x7450cb){return _0x4bc6a5[_0xe9b5('0x1e')](_0x4525e1);}return _0x4bc6a5[_0xe9b5('0x1f')](_0x4525e1)[_0xe9b5('0x20')]();};}function respondWithResult(_0x348ebf,_0x53be67){_0x53be67=_0x53be67||0xc8;return function(_0x26db2e){if(_0x26db2e){return _0x348ebf[_0xe9b5('0x1f')](_0x53be67)['json'](_0x26db2e);}};}function respondWithFilteredResult(_0x561aa7,_0x40c8f0){return function(_0x18602c){if(_0x18602c){var _0x214a38=typeof _0x40c8f0[_0xe9b5('0x21')]===_0xe9b5('0x22')&&typeof _0x40c8f0[_0xe9b5('0x23')]==='undefined';var _0x146a02=_0x18602c[_0xe9b5('0x24')];var _0x24ff97=_0x214a38?0x0:_0x40c8f0[_0xe9b5('0x21')];var _0x392912=_0x214a38?_0x18602c[_0xe9b5('0x24')]:_0x40c8f0[_0xe9b5('0x21')]+_0x40c8f0['limit'];var _0x36ff16;if(_0x392912>=_0x146a02){_0x392912=_0x146a02;_0x36ff16=0xc8;}else{_0x36ff16=0xce;}_0x561aa7[_0xe9b5('0x1f')](_0x36ff16);return _0x561aa7[_0xe9b5('0x25')](_0xe9b5('0x26'),_0x24ff97+'-'+_0x392912+'/'+_0x146a02)[_0xe9b5('0x27')](_0x18602c);}return null;};}function patchUpdates(_0x55c249){return function(_0x26b384){try{jsonpatch[_0xe9b5('0x28')](_0x26b384,_0x55c249,!![]);}catch(_0x363ec2){return BPromise[_0xe9b5('0x29')](_0x363ec2);}return _0x26b384[_0xe9b5('0x2a')]();};}function saveUpdates(_0x49231b,_0x534424){return function(_0x2fe360){if(_0x2fe360){return _0x2fe360['update'](_0x49231b)[_0xe9b5('0x2b')](function(_0x2ccf9f){return _0x2ccf9f;});}return null;};}function removeEntity(_0x605dab,_0x20922d){return function(_0x5a2a18){if(_0x5a2a18){return _0x5a2a18['destroy']()['then'](function(){var _0x5a90a8=_0x5a2a18['get']({'plain':!![]});var _0xa06359='CustomDashboards';return db[_0xe9b5('0x2c')]['destroy']({'where':{'type':_0xa06359,'resourceId':_0x5a90a8['id']}})[_0xe9b5('0x2b')](function(){return _0x5a2a18;});})['then'](function(){_0x605dab[_0xe9b5('0x1f')](0xcc)[_0xe9b5('0x20')]();});}};}function handleEntityNotFound(_0x5f11d0,_0xa6013f){return function(_0x45df73){if(!_0x45df73){_0x5f11d0[_0xe9b5('0x1e')](0x194);}return _0x45df73;};}function handleError(_0x44c03a,_0x5f05e8){_0x5f05e8=_0x5f05e8||0x1f4;return function(_0x460b4f){logger['error'](_0x460b4f[_0xe9b5('0x2d')]);if(_0x460b4f[_0xe9b5('0x2e')]){delete _0x460b4f[_0xe9b5('0x2e')];}_0x44c03a[_0xe9b5('0x1f')](_0x5f05e8)[_0xe9b5('0x2f')](_0x460b4f);};}exports[_0xe9b5('0x30')]=function(_0x50d19e,_0x539a33){var _0x1e3922={},_0x279884={},_0x335898={'count':0x0,'rows':[]};var _0x2fcc0e=_[_0xe9b5('0x31')](db[_0xe9b5('0x32')]['rawAttributes'],function(_0x33afa4){return{'name':_0x33afa4['fieldName'],'type':_0x33afa4['type'][_0xe9b5('0x33')]};});_0x279884['model']=_[_0xe9b5('0x31')](_0x2fcc0e,_0xe9b5('0x2e'));_0x279884[_0xe9b5('0x34')]=_[_0xe9b5('0x35')](_0x50d19e[_0xe9b5('0x34')]);_0x279884[_0xe9b5('0x36')]=_[_0xe9b5('0x37')](_0x279884[_0xe9b5('0x38')],_0x279884[_0xe9b5('0x34')]);_0x1e3922['attributes']=_['intersection'](_0x279884[_0xe9b5('0x38')],qs[_0xe9b5('0x39')](_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x39')]));_0x1e3922[_0xe9b5('0x3a')]=_0x1e3922[_0xe9b5('0x3a')]['length']?_0x1e3922[_0xe9b5('0x3a')]:_0x279884['model'];if(!_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x3b')](_0xe9b5('0x3c'))){_0x1e3922['limit']=qs[_0xe9b5('0x23')](_0x50d19e['query'][_0xe9b5('0x23')]);_0x1e3922[_0xe9b5('0x21')]=qs[_0xe9b5('0x21')](_0x50d19e[_0xe9b5('0x34')]['offset']);}_0x1e3922['order']=qs[_0xe9b5('0x3d')](_0x50d19e[_0xe9b5('0x34')]['sort']);_0x1e3922[_0xe9b5('0x3e')]=qs['filters'](_['pick'](_0x50d19e[_0xe9b5('0x34')],_0x279884[_0xe9b5('0x36')]),_0x2fcc0e);if(_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x3f')]){_0x1e3922['where']=_[_0xe9b5('0x40')](_0x1e3922['where'],{'$or':_['map'](_0x2fcc0e,function(_0x4e1efb){if(_0x4e1efb[_0xe9b5('0x41')]!==_0xe9b5('0x42')){var _0x5b54d7={};_0x5b54d7[_0x4e1efb[_0xe9b5('0x2e')]]={'$like':'%'+_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x3f')]+'%'};return _0x5b54d7;}})});}_0x1e3922=_[_0xe9b5('0x40')]({},_0x1e3922,_0x50d19e[_0xe9b5('0x43')]);var _0x4e050c={'where':_0x1e3922[_0xe9b5('0x3e')]};return db[_0xe9b5('0x32')]['count'](_0x4e050c)[_0xe9b5('0x2b')](function(_0x353d77){_0x335898['count']=_0x353d77;if(_0x50d19e[_0xe9b5('0x34')][_0xe9b5('0x44')]){_0x1e3922['include']=[{'all':!![]}];}return db[_0xe9b5('0x32')][_0xe9b5('0x45')](_0x1e3922);})[_0xe9b5('0x2b')](function(_0xe36f02){_0x335898[_0xe9b5('0x46')]=_0xe36f02;return _0x335898;})[_0xe9b5('0x2b')](respondWithFilteredResult(_0x539a33,_0x1e3922))[_0xe9b5('0x47')](handleError(_0x539a33,null));};exports[_0xe9b5('0x48')]=function(_0x13cd73,_0x3f9944){var _0x405451={'raw':![],'where':{'id':_0x13cd73[_0xe9b5('0x49')]['id']}},_0x56de45={};_0x56de45[_0xe9b5('0x38')]=_[_0xe9b5('0x35')](db[_0xe9b5('0x32')][_0xe9b5('0x4a')]);_0x56de45[_0xe9b5('0x34')]=_[_0xe9b5('0x35')](_0x13cd73[_0xe9b5('0x34')]);_0x56de45[_0xe9b5('0x36')]=_['intersection'](_0x56de45[_0xe9b5('0x38')],_0x56de45[_0xe9b5('0x34')]);_0x405451[_0xe9b5('0x3a')]=_['intersection'](_0x56de45[_0xe9b5('0x38')],qs[_0xe9b5('0x39')](_0x13cd73[_0xe9b5('0x34')]['fields']));_0x405451[_0xe9b5('0x3a')]=_0x405451[_0xe9b5('0x3a')]['length']?_0x405451[_0xe9b5('0x3a')]:_0x56de45[_0xe9b5('0x38')];if(_0x13cd73[_0xe9b5('0x34')]['includeAll']){_0x405451[_0xe9b5('0x4b')]=[{'all':!![]}];}_0x405451=_[_0xe9b5('0x40')]({},_0x405451,_0x13cd73[_0xe9b5('0x43')]);return db[_0xe9b5('0x32')]['find'](_0x405451)[_0xe9b5('0x2b')](handleEntityNotFound(_0x3f9944,null))['then'](respondWithResult(_0x3f9944,null))[_0xe9b5('0x47')](handleError(_0x3f9944,null));};exports[_0xe9b5('0x4c')]=function(_0x204358,_0x3511b2){return db[_0xe9b5('0x32')]['create'](_0x204358['body'],{})[_0xe9b5('0x2b')](function(_0x592a1d){var _0x2abc95=_0x204358[_0xe9b5('0x4d')][_0xe9b5('0x4e')]({'plain':!![]});if(!_0x2abc95)throw new Error(_0xe9b5('0x4f'));if(_0x2abc95[_0xe9b5('0x50')]===_0xe9b5('0x4d')){var _0x193fed=_0x592a1d[_0xe9b5('0x4e')]({'plain':!![]});var _0x2123a4=_0xe9b5('0x51');return db[_0xe9b5('0x52')][_0xe9b5('0x53')]({'where':{'name':_0x2123a4,'userProfileId':_0x2abc95[_0xe9b5('0x54')]},'raw':!![]})['then'](function(_0x23eeac){if(_0x23eeac&&_0x23eeac[_0xe9b5('0x55')]===0x0){return db[_0xe9b5('0x2c')][_0xe9b5('0x4c')]({'name':_0x193fed[_0xe9b5('0x2e')],'resourceId':_0x193fed['id'],'type':_0x23eeac[_0xe9b5('0x2e')],'sectionId':_0x23eeac['id']},{})['then'](function(){return _0x592a1d;});}else{return _0x592a1d;}})[_0xe9b5('0x47')](function(_0x3d9dcc){logger[_0xe9b5('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d9dcc);throw _0x3d9dcc;});}return _0x592a1d;})[_0xe9b5('0x2b')](respondWithResult(_0x3511b2,0xc9))[_0xe9b5('0x47')](handleError(_0x3511b2,null));};exports[_0xe9b5('0x57')]=function(_0x4bd1be,_0x3e38a0){var _0x26c673={'where':{'id':_0x4bd1be[_0xe9b5('0x49')]['id']}},_0x2b224f={};_0x2b224f[_0xe9b5('0x38')]=_[_0xe9b5('0x35')](db[_0xe9b5('0x32')]['rawAttributes']);_0x26c673[_0xe9b5('0x3a')]=_[_0xe9b5('0x37')](_0x2b224f[_0xe9b5('0x38')],qs[_0xe9b5('0x39')](_0x4bd1be['query'][_0xe9b5('0x39')]));_0x26c673['attributes']=_0x26c673['attributes'][_0xe9b5('0x58')]?_0x26c673[_0xe9b5('0x3a')]:_0x2b224f[_0xe9b5('0x38')];if(_0x4bd1be[_0xe9b5('0x34')][_0xe9b5('0x44')]){_0x26c673[_0xe9b5('0x4b')]=[{'all':!![]}];}_0x26c673=_[_0xe9b5('0x40')]({},_0x26c673,_0x4bd1be['options']);return db[_0xe9b5('0x32')][_0xe9b5('0x53')](_0x26c673)[_0xe9b5('0x2b')](handleEntityNotFound(_0x3e38a0,null))[_0xe9b5('0x2b')](function(_0x16a824){if(_0x16a824){var _0x146cd7=_0x16a824['get']({'plain':!![]});_0x146cd7=qs[_0xe9b5('0x59')](_0x146cd7,['id',_0xe9b5('0x5a'),'updatedAt']);_0x4bd1be[_0xe9b5('0x5b')]=_[_0xe9b5('0x59')](_0x4bd1be[_0xe9b5('0x5b')],['id',_0xe9b5('0x5a'),_0xe9b5('0x5c')]);return db['Dashboard'][_0xe9b5('0x4c')](_[_0xe9b5('0x40')](_0x146cd7,_0x4bd1be[_0xe9b5('0x5b')]),{'include':_0x4bd1be[_0xe9b5('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0xe9b5('0x2b')](function(_0x32d57f){var _0x177d3b=_0x4bd1be['user'][_0xe9b5('0x4e')]({'plain':!![]});if(!_0x177d3b)throw new Error(_0xe9b5('0x4f'));if(_0x177d3b[_0xe9b5('0x50')]==='user'){var _0x2bcd49=_0x32d57f[_0xe9b5('0x4e')]({'plain':!![]});var _0x36ea3b=_0xe9b5('0x51');return db[_0xe9b5('0x52')]['find']({'where':{'name':_0x36ea3b,'userProfileId':_0x177d3b[_0xe9b5('0x54')]},'raw':!![]})[_0xe9b5('0x2b')](function(_0x2aa68e){if(_0x2aa68e&&_0x2aa68e[_0xe9b5('0x55')]===0x0){return db[_0xe9b5('0x2c')][_0xe9b5('0x4c')]({'name':_0x2bcd49['name'],'resourceId':_0x2bcd49['id'],'type':_0x2aa68e[_0xe9b5('0x2e')],'sectionId':_0x2aa68e['id']},{})['then'](function(){return _0x32d57f;});}else{return _0x32d57f;}})[_0xe9b5('0x47')](function(_0x2ef7f1){logger[_0xe9b5('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ef7f1);throw _0x2ef7f1;});}return _0x32d57f;});}})[_0xe9b5('0x2b')](respondWithResult(_0x3e38a0,0xc9))[_0xe9b5('0x47')](handleError(_0x3e38a0,null));};exports[_0xe9b5('0x5d')]=function(_0x518703,_0x5d6419){if(_0x518703[_0xe9b5('0x5b')]['id']){delete _0x518703[_0xe9b5('0x5b')]['id'];}return db['Dashboard'][_0xe9b5('0x53')]({'where':{'id':_0x518703[_0xe9b5('0x49')]['id']}})[_0xe9b5('0x2b')](handleEntityNotFound(_0x5d6419,null))[_0xe9b5('0x2b')](saveUpdates(_0x518703[_0xe9b5('0x5b')],null))['then'](respondWithResult(_0x5d6419,null))[_0xe9b5('0x47')](handleError(_0x5d6419,null));};exports[_0xe9b5('0x5e')]=function(_0x487b57,_0x110a5d){return db[_0xe9b5('0x32')][_0xe9b5('0x53')]({'where':{'id':_0x487b57[_0xe9b5('0x49')]['id']}})[_0xe9b5('0x2b')](handleEntityNotFound(_0x110a5d,null))[_0xe9b5('0x2b')](removeEntity(_0x110a5d,null))[_0xe9b5('0x47')](handleError(_0x110a5d,null));};function widgetAttributes(_0x1698b8){try{switch(_0x1698b8[_0xe9b5('0x41')]){case _0xe9b5('0x5f'):return[{'name':_0xe9b5('0x60'),'value':_0x1698b8[_0xe9b5('0x60')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0][_0xe9b5('0x62')]:undefined)||_0xe9b5('0x63')}];case _0xe9b5('0x64'):return[{'name':_0xe9b5('0x65'),'value':_0x1698b8[_0xe9b5('0x65')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0][_0xe9b5('0x62')]:undefined)||''}];case _0xe9b5('0x66'):return[{'name':'attrHourFormat','value':_0x1698b8[_0xe9b5('0x67')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x0]?_0x1698b8['attrs'][0x0][_0xe9b5('0x62')]:undefined)||_0xe9b5('0x68')},{'name':_0xe9b5('0x69'),'value':_0x1698b8[_0xe9b5('0x69')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x1]?_0x1698b8['attrs'][0x1][_0xe9b5('0x62')]:undefined)||_0xe9b5('0x6a')},{'name':_0xe9b5('0x6b'),'value':_0x1698b8[_0xe9b5('0x6b')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x2]?_0x1698b8[_0xe9b5('0x61')][0x2]['value']:undefined)||0xc}];case _0xe9b5('0x6c'):return[{'name':'attrMetric','value':_0x1698b8[_0xe9b5('0x6d')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0][_0xe9b5('0x62')]:undefined)||_0xe9b5('0x6e')},{'name':'attrVoiceQueues','value':_0x1698b8[_0xe9b5('0x6f')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x1]?_0x1698b8[_0xe9b5('0x61')][0x1][_0xe9b5('0x62')]:undefined)||[]},{'name':_0xe9b5('0x6b'),'value':_0x1698b8['attrFontSize']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x2]?_0x1698b8[_0xe9b5('0x61')][0x2][_0xe9b5('0x62')]:undefined)||0x14},{'name':'attrChannel','value':_0x1698b8[_0xe9b5('0x70')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x3]?_0x1698b8[_0xe9b5('0x61')][0x3][_0xe9b5('0x62')]:undefined)||'voice'},{'name':_0xe9b5('0x71'),'value':_0x1698b8[_0xe9b5('0x71')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x4]?_0x1698b8[_0xe9b5('0x61')][0x4][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x72'),'value':_0x1698b8[_0xe9b5('0x72')]||(_0x1698b8['attrs']&&_0x1698b8[_0xe9b5('0x61')][0x5]?_0x1698b8[_0xe9b5('0x61')][0x5][_0xe9b5('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1698b8[_0xe9b5('0x73')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x6]?_0x1698b8[_0xe9b5('0x61')][0x6][_0xe9b5('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1698b8[_0xe9b5('0x74')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x7]?_0x1698b8[_0xe9b5('0x61')][0x7]['value']:undefined)||''},{'name':_0xe9b5('0x75'),'value':_0x1698b8[_0xe9b5('0x75')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x8]?_0x1698b8[_0xe9b5('0x61')][0x8][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x76'),'value':_0x1698b8[_0xe9b5('0x76')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x9]?_0x1698b8[_0xe9b5('0x61')][0x9][_0xe9b5('0x62')]:undefined)||''}];case'multibar-chart':case _0xe9b5('0x77'):return[{'name':_0xe9b5('0x78'),'value':_0x1698b8[_0xe9b5('0x78')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0]['value']:undefined)||_0xe9b5('0x6e')},{'name':_0xe9b5('0x79'),'value':_0x1698b8[_0xe9b5('0x79')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x1]?_0x1698b8[_0xe9b5('0x61')][0x1][_0xe9b5('0x62')]:undefined)||null},{'name':_0xe9b5('0x7a'),'value':_0x1698b8['attrSerie3']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x2]?_0x1698b8[_0xe9b5('0x61')][0x2][_0xe9b5('0x62')]:undefined)||null},{'name':_0xe9b5('0x6f'),'value':_0x1698b8[_0xe9b5('0x6f')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x3]?_0x1698b8[_0xe9b5('0x61')][0x3]['value']:undefined)||[]},{'name':_0xe9b5('0x70'),'value':_0x1698b8[_0xe9b5('0x70')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x4]?_0x1698b8['attrs'][0x4][_0xe9b5('0x62')]:undefined)||'voice'},{'name':_0xe9b5('0x71'),'value':_0x1698b8['attrEmailAccounts']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x5]?_0x1698b8[_0xe9b5('0x61')][0x5][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x72'),'value':_0x1698b8[_0xe9b5('0x72')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x6]?_0x1698b8['attrs'][0x6]['value']:undefined)||''},{'name':_0xe9b5('0x73'),'value':_0x1698b8[_0xe9b5('0x73')]||(_0x1698b8['attrs']&&_0x1698b8[_0xe9b5('0x61')][0x7]?_0x1698b8['attrs'][0x7]['value']:undefined)||''},{'name':_0xe9b5('0x74'),'value':_0x1698b8[_0xe9b5('0x74')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x8]?_0x1698b8['attrs'][0x8][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x75'),'value':_0x1698b8['attrWhatsappAccounts']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x9]?_0x1698b8[_0xe9b5('0x61')][0x9][_0xe9b5('0x62')]:undefined)||''},{'name':_0xe9b5('0x76'),'value':_0x1698b8[_0xe9b5('0x76')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0xa]?_0x1698b8['attrs'][0xa][_0xe9b5('0x62')]:undefined)||''}];case _0xe9b5('0x7b'):return[{'name':'attrReport','type':_0x1698b8[_0xe9b5('0x7c')]||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8[_0xe9b5('0x61')][0x0]?_0x1698b8[_0xe9b5('0x61')][0x0]['type']:undefined)||null,'value':_0x1698b8['attrReport']||(_0x1698b8[_0xe9b5('0x61')]&&_0x1698b8['attrs'][0x0]?_0x1698b8['attrs'][0x0][_0xe9b5('0x62')]:undefined)||null},{'name':_0xe9b5('0x7d'),'value':_0x1698b8[_0xe9b5('0x7d')]||(_0x1698b8['attrs']&&_0x1698b8[_0xe9b5('0x61')][0x1]?_0x1698b8[_0xe9b5('0x61')][0x1][_0xe9b5('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x547f27){logger[_0xe9b5('0x56')](_0xe9b5('0x7e'),JSON['stringify'](_0x547f27));return[];}}exports['addItem']=function(_0x1c3269,_0x3b0cfe,_0x7a32a0){if(_0x1c3269[_0xe9b5('0x5b')]['id']){delete _0x1c3269[_0xe9b5('0x5b')]['id'];}return db['Dashboard'][_0xe9b5('0x53')]({'where':{'id':_0x1c3269['params']['id']}})[_0xe9b5('0x2b')](handleEntityNotFound(_0x3b0cfe,null))[_0xe9b5('0x2b')](function(_0x4f01f1){if(_0x4f01f1){_0x1c3269[_0xe9b5('0x5b')][_0xe9b5('0x7f')]=_0x4f01f1['id'];_0x1c3269['body']['attrs']=widgetAttributes(_0x1c3269[_0xe9b5('0x5b')]);return db[_0xe9b5('0x80')]['create'](_0x1c3269['body']);}})['then'](respondWithResult(_0x3b0cfe,null))[_0xe9b5('0x47')](handleError(_0x3b0cfe,null));};exports['getItems']=function(_0x4ef933,_0x387495,_0x4ba596){var _0x333552={};var _0x1bab2e={};var _0x5c75c8;var _0x24b70f;return db['Dashboard'][_0xe9b5('0x81')]({'where':{'id':_0x4ef933[_0xe9b5('0x49')]['id']}})[_0xe9b5('0x2b')](handleEntityNotFound(_0x387495,null))[_0xe9b5('0x2b')](function(_0x3816f6){if(_0x3816f6){_0x5c75c8=_0x3816f6;_0x1bab2e[_0xe9b5('0x38')]=_[_0xe9b5('0x35')](db['DashboardItem'][_0xe9b5('0x4a')]);_0x1bab2e['query']=_['keys'](_0x4ef933['query']);_0x1bab2e[_0xe9b5('0x36')]=_[_0xe9b5('0x37')](_0x1bab2e[_0xe9b5('0x38')],_0x1bab2e['query']);_0x333552[_0xe9b5('0x3a')]=_[_0xe9b5('0x37')](_0x1bab2e[_0xe9b5('0x38')],qs['fields'](_0x4ef933[_0xe9b5('0x34')][_0xe9b5('0x39')]));_0x333552[_0xe9b5('0x3a')]=_0x333552[_0xe9b5('0x3a')][_0xe9b5('0x58')]?_0x333552[_0xe9b5('0x3a')]:_0x1bab2e[_0xe9b5('0x38')];_0x333552['order']=qs[_0xe9b5('0x3d')](_0x4ef933[_0xe9b5('0x34')]['sort']);_0x333552[_0xe9b5('0x3e')]=qs[_0xe9b5('0x36')](_['pick'](_0x4ef933[_0xe9b5('0x34')],_0x1bab2e[_0xe9b5('0x36')]));if(_0x4ef933['query']['filter']){_0x333552['where']=_[_0xe9b5('0x40')](_0x333552[_0xe9b5('0x3e')],{'$or':_[_0xe9b5('0x31')](_0x333552['attributes'],function(_0x304810){var _0x1834d7={};_0x1834d7[_0x304810]={'$like':'%'+_0x4ef933[_0xe9b5('0x34')][_0xe9b5('0x3f')]+'%'};return _0x1834d7;})});}_0x333552=_['merge']({},_0x333552,_0x4ef933[_0xe9b5('0x43')]);return _0x5c75c8[_0xe9b5('0x82')](_0x333552);}})['then'](function(_0x4a928f){if(_0x4a928f){_0x24b70f=_0x4a928f[_0xe9b5('0x58')];if(!_0x4ef933['query'][_0xe9b5('0x3b')]('nolimit')){_0x333552[_0xe9b5('0x23')]=qs[_0xe9b5('0x23')](_0x4ef933[_0xe9b5('0x34')][_0xe9b5('0x23')]);_0x333552[_0xe9b5('0x21')]=qs['offset'](_0x4ef933['query'][_0xe9b5('0x21')]);}return _0x5c75c8[_0xe9b5('0x82')](_0x333552);}})[_0xe9b5('0x2b')](function(_0x39323a){if(_0x39323a){return _0x39323a?{'count':_0x24b70f,'rows':_0x39323a}:null;}})[_0xe9b5('0x2b')](respondWithResult(_0x387495,null))[_0xe9b5('0x47')](handleError(_0x387495,null));};
\ No newline at end of file
+var _0x3db7=['where','merge','includeAll','rows','catch','show','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','options','updatedAt','body','omit','createdAt','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','total','attrVoiceQueues','attrFontSize','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','DashboardItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x17cbfe,_0x52f810){var _0x5305e9=function(_0x4bc6eb){while(--_0x4bc6eb){_0x17cbfe['push'](_0x17cbfe['shift']());}};_0x5305e9(++_0x52f810);}(_0x3db7,0x14a));var _0x73db=function(_0x230ada,_0x4bbf6d){_0x230ada=_0x230ada-0x0;var _0x156db1=_0x3db7[_0x230ada];return _0x156db1;};'use strict';var emlformat=require(_0x73db('0x0'));var rimraf=require(_0x73db('0x1'));var zipdir=require(_0x73db('0x2'));var jsonpatch=require(_0x73db('0x3'));var rp=require(_0x73db('0x4'));var moment=require(_0x73db('0x5'));var BPromise=require(_0x73db('0x6'));var Mustache=require('mustache');var util=require(_0x73db('0x7'));var path=require(_0x73db('0x8'));var sox=require(_0x73db('0x9'));var csv=require(_0x73db('0xa'));var ejs=require(_0x73db('0xb'));var fs=require('fs');var fs_extra=require(_0x73db('0xc'));var _=require(_0x73db('0xd'));var squel=require('squel');var crypto=require(_0x73db('0xe'));var jsforce=require(_0x73db('0xf'));var deskjs=require(_0x73db('0x10'));var toCsv=require('to-csv');var querystring=require(_0x73db('0x11'));var Papa=require(_0x73db('0x12'));var Redis=require(_0x73db('0x13'));var authService=require(_0x73db('0x14'));var qs=require(_0x73db('0x15'));var as=require(_0x73db('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x73db('0x17'));var utils=require(_0x73db('0x18'));var config=require(_0x73db('0x19'));var licenseUtil=require(_0x73db('0x1a'));var db=require(_0x73db('0x1b'))['db'];config[_0x73db('0x1c')]=_[_0x73db('0x1d')](config[_0x73db('0x1c')],{'host':_0x73db('0x1e'),'port':0x18eb});var socket=require(_0x73db('0x1f'))(new Redis(config[_0x73db('0x1c')]));require(_0x73db('0x20'))['register'](socket);function respondWithStatusCode(_0x457e40,_0x5be971){_0x5be971=_0x5be971||0xcc;return function(_0x51dd91){if(_0x51dd91){return _0x457e40[_0x73db('0x21')](_0x5be971);}return _0x457e40['status'](_0x5be971)[_0x73db('0x22')]();};}function respondWithResult(_0x2d276f,_0x53018c){_0x53018c=_0x53018c||0xc8;return function(_0x3a037f){if(_0x3a037f){return _0x2d276f[_0x73db('0x23')](_0x53018c)[_0x73db('0x24')](_0x3a037f);}};}function respondWithFilteredResult(_0x345412,_0x4ce23e){return function(_0x23dc1b){if(_0x23dc1b){var _0x799e44=typeof _0x4ce23e['offset']===_0x73db('0x25')&&typeof _0x4ce23e[_0x73db('0x26')]===_0x73db('0x25');var _0x27ae8a=_0x23dc1b[_0x73db('0x27')];var _0x22b8b6=_0x799e44?0x0:_0x4ce23e[_0x73db('0x28')];var _0x5b62d7=_0x799e44?_0x23dc1b[_0x73db('0x27')]:_0x4ce23e['offset']+_0x4ce23e[_0x73db('0x26')];var _0xe79d51;if(_0x5b62d7>=_0x27ae8a){_0x5b62d7=_0x27ae8a;_0xe79d51=0xc8;}else{_0xe79d51=0xce;}_0x345412[_0x73db('0x23')](_0xe79d51);return _0x345412[_0x73db('0x29')](_0x73db('0x2a'),_0x22b8b6+'-'+_0x5b62d7+'/'+_0x27ae8a)[_0x73db('0x24')](_0x23dc1b);}return null;};}function patchUpdates(_0x52082f){return function(_0x12f8b3){try{jsonpatch[_0x73db('0x2b')](_0x12f8b3,_0x52082f,!![]);}catch(_0x10e480){return BPromise[_0x73db('0x2c')](_0x10e480);}return _0x12f8b3[_0x73db('0x2d')]();};}function saveUpdates(_0x1374f8,_0x511a51){return function(_0x40c901){if(_0x40c901){return _0x40c901[_0x73db('0x2e')](_0x1374f8)[_0x73db('0x2f')](function(_0x526f0e){return _0x526f0e;});}return null;};}function removeEntity(_0x40c6e0,_0x28b631){return function(_0x3836b7){if(_0x3836b7){return _0x3836b7[_0x73db('0x30')]()['then'](function(){var _0x392dcd=_0x3836b7[_0x73db('0x31')]({'plain':!![]});var _0x125e46=_0x73db('0x32');return db['UserProfileResource']['destroy']({'where':{'type':_0x125e46,'resourceId':_0x392dcd['id']}})[_0x73db('0x2f')](function(){return _0x3836b7;});})[_0x73db('0x2f')](function(){_0x40c6e0[_0x73db('0x23')](0xcc)[_0x73db('0x22')]();});}};}function handleEntityNotFound(_0x5448bd,_0x33e0fb){return function(_0x573b5c){if(!_0x573b5c){_0x5448bd[_0x73db('0x21')](0x194);}return _0x573b5c;};}function handleError(_0x1c08f3,_0x5460c7){_0x5460c7=_0x5460c7||0x1f4;return function(_0x4f4292){logger[_0x73db('0x33')](_0x4f4292[_0x73db('0x34')]);if(_0x4f4292[_0x73db('0x35')]){delete _0x4f4292['name'];}_0x1c08f3[_0x73db('0x23')](_0x5460c7)['send'](_0x4f4292);};}exports[_0x73db('0x36')]=function(_0x4cc293,_0x36a70a){var _0x17bc47={},_0x508295={},_0x4e7b19={'count':0x0,'rows':[]};var _0x3490af=_[_0x73db('0x37')](db[_0x73db('0x38')][_0x73db('0x39')],function(_0x3b385a){return{'name':_0x3b385a[_0x73db('0x3a')],'type':_0x3b385a[_0x73db('0x3b')][_0x73db('0x3c')]};});_0x508295[_0x73db('0x3d')]=_['map'](_0x3490af,_0x73db('0x35'));_0x508295[_0x73db('0x3e')]=_[_0x73db('0x3f')](_0x4cc293[_0x73db('0x3e')]);_0x508295[_0x73db('0x40')]=_['intersection'](_0x508295[_0x73db('0x3d')],_0x508295[_0x73db('0x3e')]);_0x17bc47[_0x73db('0x41')]=_[_0x73db('0x42')](_0x508295['model'],qs[_0x73db('0x43')](_0x4cc293[_0x73db('0x3e')][_0x73db('0x43')]));_0x17bc47['attributes']=_0x17bc47[_0x73db('0x41')][_0x73db('0x44')]?_0x17bc47[_0x73db('0x41')]:_0x508295[_0x73db('0x3d')];if(!_0x4cc293[_0x73db('0x3e')][_0x73db('0x45')](_0x73db('0x46'))){_0x17bc47['limit']=qs[_0x73db('0x26')](_0x4cc293[_0x73db('0x3e')][_0x73db('0x26')]);_0x17bc47['offset']=qs[_0x73db('0x28')](_0x4cc293[_0x73db('0x3e')][_0x73db('0x28')]);}_0x17bc47[_0x73db('0x47')]=qs['sort'](_0x4cc293[_0x73db('0x3e')][_0x73db('0x48')]);_0x17bc47['where']=qs[_0x73db('0x40')](_[_0x73db('0x49')](_0x4cc293['query'],_0x508295[_0x73db('0x40')]),_0x3490af);if(_0x4cc293[_0x73db('0x3e')][_0x73db('0x4a')]){_0x17bc47[_0x73db('0x4b')]=_[_0x73db('0x4c')](_0x17bc47[_0x73db('0x4b')],{'$or':_[_0x73db('0x37')](_0x3490af,function(_0x1b7ef0){if(_0x1b7ef0['type']!=='VIRTUAL'){var _0x3fa887={};_0x3fa887[_0x1b7ef0[_0x73db('0x35')]]={'$like':'%'+_0x4cc293[_0x73db('0x3e')][_0x73db('0x4a')]+'%'};return _0x3fa887;}})});}_0x17bc47=_[_0x73db('0x4c')]({},_0x17bc47,_0x4cc293['options']);var _0x5bf1cc={'where':_0x17bc47[_0x73db('0x4b')]};return db[_0x73db('0x38')][_0x73db('0x27')](_0x5bf1cc)['then'](function(_0x1c7e8a){_0x4e7b19[_0x73db('0x27')]=_0x1c7e8a;if(_0x4cc293[_0x73db('0x3e')][_0x73db('0x4d')]){_0x17bc47['include']=[{'all':!![]}];}return db[_0x73db('0x38')]['findAll'](_0x17bc47);})['then'](function(_0x1b58c6){_0x4e7b19[_0x73db('0x4e')]=_0x1b58c6;return _0x4e7b19;})['then'](respondWithFilteredResult(_0x36a70a,_0x17bc47))[_0x73db('0x4f')](handleError(_0x36a70a,null));};exports[_0x73db('0x50')]=function(_0x4a21d7,_0x134b45){var _0x4b79dd={'raw':![],'where':{'id':_0x4a21d7['params']['id']}},_0x268366={};_0x268366[_0x73db('0x3d')]=_[_0x73db('0x3f')](db[_0x73db('0x38')][_0x73db('0x39')]);_0x268366[_0x73db('0x3e')]=_[_0x73db('0x3f')](_0x4a21d7[_0x73db('0x3e')]);_0x268366['filters']=_[_0x73db('0x42')](_0x268366['model'],_0x268366[_0x73db('0x3e')]);_0x4b79dd[_0x73db('0x41')]=_['intersection'](_0x268366['model'],qs[_0x73db('0x43')](_0x4a21d7[_0x73db('0x3e')][_0x73db('0x43')]));_0x4b79dd[_0x73db('0x41')]=_0x4b79dd[_0x73db('0x41')]['length']?_0x4b79dd[_0x73db('0x41')]:_0x268366[_0x73db('0x3d')];if(_0x4a21d7[_0x73db('0x3e')][_0x73db('0x4d')]){_0x4b79dd[_0x73db('0x51')]=[{'all':!![]}];}_0x4b79dd=_[_0x73db('0x4c')]({},_0x4b79dd,_0x4a21d7['options']);return db['Dashboard']['find'](_0x4b79dd)[_0x73db('0x2f')](handleEntityNotFound(_0x134b45,null))[_0x73db('0x2f')](respondWithResult(_0x134b45,null))[_0x73db('0x4f')](handleError(_0x134b45,null));};exports['create']=function(_0x3fcd2b,_0x25e3fc){return db[_0x73db('0x38')][_0x73db('0x52')](_0x3fcd2b['body'],{})['then'](function(_0x1878b3){var _0x10680f=_0x3fcd2b['user'][_0x73db('0x31')]({'plain':!![]});if(!_0x10680f)throw new Error(_0x73db('0x53'));if(_0x10680f[_0x73db('0x54')]===_0x73db('0x55')){var _0xc11e6a=_0x1878b3[_0x73db('0x31')]({'plain':!![]});var _0x19558c=_0x73db('0x32');return db[_0x73db('0x56')][_0x73db('0x57')]({'where':{'name':_0x19558c,'userProfileId':_0x10680f[_0x73db('0x58')]},'raw':!![]})['then'](function(_0x22870b){if(_0x22870b&&_0x22870b[_0x73db('0x59')]===0x0){return db[_0x73db('0x5a')][_0x73db('0x52')]({'name':_0xc11e6a[_0x73db('0x35')],'resourceId':_0xc11e6a['id'],'type':_0x22870b[_0x73db('0x35')],'sectionId':_0x22870b['id']},{})[_0x73db('0x2f')](function(){return _0x1878b3;});}else{return _0x1878b3;}})[_0x73db('0x4f')](function(_0x3066aa){logger[_0x73db('0x33')](_0x73db('0x5b'),_0x3066aa);throw _0x3066aa;});}return _0x1878b3;})['then'](respondWithResult(_0x25e3fc,0xc9))[_0x73db('0x4f')](handleError(_0x25e3fc,null));};exports[_0x73db('0x5c')]=function(_0x3485cc,_0x6c57fa){var _0x30072d={'where':{'id':_0x3485cc[_0x73db('0x5d')]['id']}},_0x3fb700={};_0x3fb700['model']=_['keys'](db[_0x73db('0x38')]['rawAttributes']);_0x30072d['attributes']=_['intersection'](_0x3fb700[_0x73db('0x3d')],qs['fields'](_0x3485cc[_0x73db('0x3e')][_0x73db('0x43')]));_0x30072d[_0x73db('0x41')]=_0x30072d[_0x73db('0x41')][_0x73db('0x44')]?_0x30072d[_0x73db('0x41')]:_0x3fb700[_0x73db('0x3d')];if(_0x3485cc[_0x73db('0x3e')]['includeAll']){_0x30072d[_0x73db('0x51')]=[{'all':!![]}];}_0x30072d=_['merge']({},_0x30072d,_0x3485cc[_0x73db('0x5e')]);return db['Dashboard']['find'](_0x30072d)[_0x73db('0x2f')](handleEntityNotFound(_0x6c57fa,null))['then'](function(_0xd6a9b2){if(_0xd6a9b2){var _0x1dc46d=_0xd6a9b2['get']({'plain':!![]});_0x1dc46d=qs['omit'](_0x1dc46d,['id','createdAt',_0x73db('0x5f')]);_0x3485cc[_0x73db('0x60')]=_[_0x73db('0x61')](_0x3485cc[_0x73db('0x60')],['id',_0x73db('0x62'),'updatedAt']);return db[_0x73db('0x38')][_0x73db('0x52')](_[_0x73db('0x4c')](_0x1dc46d,_0x3485cc['body']),{'include':_0x3485cc['query'][_0x73db('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x382476){var _0x1b2129=_0x3485cc[_0x73db('0x55')][_0x73db('0x31')]({'plain':!![]});if(!_0x1b2129)throw new Error(_0x73db('0x53'));if(_0x1b2129['role']===_0x73db('0x55')){var _0x17bd14=_0x382476[_0x73db('0x31')]({'plain':!![]});var _0x598b07=_0x73db('0x32');return db[_0x73db('0x56')]['find']({'where':{'name':_0x598b07,'userProfileId':_0x1b2129['userProfileId']},'raw':!![]})[_0x73db('0x2f')](function(_0x545cc4){if(_0x545cc4&&_0x545cc4['autoAssociation']===0x0){return db[_0x73db('0x5a')][_0x73db('0x52')]({'name':_0x17bd14[_0x73db('0x35')],'resourceId':_0x17bd14['id'],'type':_0x545cc4['name'],'sectionId':_0x545cc4['id']},{})['then'](function(){return _0x382476;});}else{return _0x382476;}})['catch'](function(_0x404276){logger[_0x73db('0x33')](_0x73db('0x5b'),_0x404276);throw _0x404276;});}return _0x382476;});}})[_0x73db('0x2f')](respondWithResult(_0x6c57fa,0xc9))[_0x73db('0x4f')](handleError(_0x6c57fa,null));};exports[_0x73db('0x2e')]=function(_0x5a7b65,_0x3eea9b){if(_0x5a7b65['body']['id']){delete _0x5a7b65[_0x73db('0x60')]['id'];}return db[_0x73db('0x38')][_0x73db('0x57')]({'where':{'id':_0x5a7b65[_0x73db('0x5d')]['id']}})[_0x73db('0x2f')](handleEntityNotFound(_0x3eea9b,null))[_0x73db('0x2f')](saveUpdates(_0x5a7b65['body'],null))[_0x73db('0x2f')](respondWithResult(_0x3eea9b,null))[_0x73db('0x4f')](handleError(_0x3eea9b,null));};exports[_0x73db('0x30')]=function(_0xcad67d,_0x34b5cc){return db['Dashboard'][_0x73db('0x57')]({'where':{'id':_0xcad67d[_0x73db('0x5d')]['id']}})['then'](handleEntityNotFound(_0x34b5cc,null))[_0x73db('0x2f')](removeEntity(_0x34b5cc,null))['catch'](handleError(_0x34b5cc,null));};function widgetAttributes(_0x5d4322){try{switch(_0x5d4322[_0x73db('0x3b')]){case _0x73db('0x63'):return[{'name':'attrUrl','value':_0x5d4322[_0x73db('0x64')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x0]?_0x5d4322['attrs'][0x0]['value']:undefined)||'https://'}];case _0x73db('0x66'):return[{'name':_0x73db('0x67'),'value':_0x5d4322[_0x73db('0x67')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x0]?_0x5d4322[_0x73db('0x65')][0x0][_0x73db('0x68')]:undefined)||''}];case _0x73db('0x69'):return[{'name':'attrHourFormat','value':_0x5d4322[_0x73db('0x6a')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x0]?_0x5d4322['attrs'][0x0][_0x73db('0x68')]:undefined)||_0x73db('0x6b')},{'name':'attrTimezone','value':_0x5d4322[_0x73db('0x6c')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x1]?_0x5d4322[_0x73db('0x65')][0x1]['value']:undefined)||_0x73db('0x6d')},{'name':'attrFontSize','value':_0x5d4322['attrFontSize']||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x2]?_0x5d4322[_0x73db('0x65')][0x2][_0x73db('0x68')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x5d4322['attrMetric']||(_0x5d4322['attrs']&&_0x5d4322[_0x73db('0x65')][0x0]?_0x5d4322[_0x73db('0x65')][0x0][_0x73db('0x68')]:undefined)||_0x73db('0x6e')},{'name':_0x73db('0x6f'),'value':_0x5d4322[_0x73db('0x6f')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x1]?_0x5d4322[_0x73db('0x65')][0x1][_0x73db('0x68')]:undefined)||[]},{'name':'attrFontSize','value':_0x5d4322[_0x73db('0x70')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x2]?_0x5d4322[_0x73db('0x65')][0x2][_0x73db('0x68')]:undefined)||0x14},{'name':_0x73db('0x71'),'value':_0x5d4322[_0x73db('0x71')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322['attrs'][0x3]?_0x5d4322[_0x73db('0x65')][0x3][_0x73db('0x68')]:undefined)||'voice'},{'name':_0x73db('0x72'),'value':_0x5d4322[_0x73db('0x72')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322['attrs'][0x4]?_0x5d4322[_0x73db('0x65')][0x4][_0x73db('0x68')]:undefined)||''},{'name':_0x73db('0x73'),'value':_0x5d4322[_0x73db('0x73')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x5]?_0x5d4322[_0x73db('0x65')][0x5][_0x73db('0x68')]:undefined)||''},{'name':_0x73db('0x74'),'value':_0x5d4322[_0x73db('0x74')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322['attrs'][0x6]?_0x5d4322['attrs'][0x6][_0x73db('0x68')]:undefined)||''},{'name':_0x73db('0x75'),'value':_0x5d4322[_0x73db('0x75')]||(_0x5d4322['attrs']&&_0x5d4322[_0x73db('0x65')][0x7]?_0x5d4322[_0x73db('0x65')][0x7][_0x73db('0x68')]:undefined)||''},{'name':_0x73db('0x76'),'value':_0x5d4322['attrWhatsappAccounts']||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x8]?_0x5d4322[_0x73db('0x65')][0x8][_0x73db('0x68')]:undefined)||''},{'name':_0x73db('0x77'),'value':_0x5d4322[_0x73db('0x77')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x9]?_0x5d4322[_0x73db('0x65')][0x9]['value']:undefined)||''}];case _0x73db('0x78'):case _0x73db('0x79'):return[{'name':_0x73db('0x7a'),'value':_0x5d4322[_0x73db('0x7a')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x0]?_0x5d4322[_0x73db('0x65')][0x0][_0x73db('0x68')]:undefined)||'total'},{'name':_0x73db('0x7b'),'value':_0x5d4322[_0x73db('0x7b')]||(_0x5d4322['attrs']&&_0x5d4322[_0x73db('0x65')][0x1]?_0x5d4322[_0x73db('0x65')][0x1][_0x73db('0x68')]:undefined)||null},{'name':_0x73db('0x7c'),'value':_0x5d4322[_0x73db('0x7c')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x2]?_0x5d4322[_0x73db('0x65')][0x2][_0x73db('0x68')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5d4322['attrVoiceQueues']||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322['attrs'][0x3]?_0x5d4322[_0x73db('0x65')][0x3][_0x73db('0x68')]:undefined)||[]},{'name':_0x73db('0x71'),'value':_0x5d4322[_0x73db('0x71')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x4]?_0x5d4322['attrs'][0x4][_0x73db('0x68')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x5d4322[_0x73db('0x72')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x5]?_0x5d4322[_0x73db('0x65')][0x5]['value']:undefined)||''},{'name':_0x73db('0x73'),'value':_0x5d4322[_0x73db('0x73')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x6]?_0x5d4322['attrs'][0x6]['value']:undefined)||''},{'name':_0x73db('0x74'),'value':_0x5d4322[_0x73db('0x74')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x7]?_0x5d4322[_0x73db('0x65')][0x7][_0x73db('0x68')]:undefined)||''},{'name':_0x73db('0x75'),'value':_0x5d4322['attrOpenchannelAccounts']||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x8]?_0x5d4322[_0x73db('0x65')][0x8][_0x73db('0x68')]:undefined)||''},{'name':_0x73db('0x76'),'value':_0x5d4322['attrWhatsappAccounts']||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x9]?_0x5d4322[_0x73db('0x65')][0x9][_0x73db('0x68')]:undefined)||''},{'name':_0x73db('0x77'),'value':_0x5d4322['attrChatWebsites']||(_0x5d4322['attrs']&&_0x5d4322[_0x73db('0x65')][0xa]?_0x5d4322['attrs'][0xa][_0x73db('0x68')]:undefined)||''}];case _0x73db('0x7d'):return[{'name':'attrReport','type':_0x5d4322[_0x73db('0x7e')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x0]?_0x5d4322[_0x73db('0x65')][0x0][_0x73db('0x3b')]:undefined)||null,'value':_0x5d4322[_0x73db('0x7f')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x0]?_0x5d4322[_0x73db('0x65')][0x0][_0x73db('0x68')]:undefined)||null},{'name':_0x73db('0x80'),'value':_0x5d4322[_0x73db('0x80')]||(_0x5d4322[_0x73db('0x65')]&&_0x5d4322[_0x73db('0x65')][0x1]?_0x5d4322['attrs'][0x1][_0x73db('0x68')]:undefined)||0x0}];default:return[];}}catch(_0x6a5c02){logger[_0x73db('0x33')](_0x73db('0x81'),JSON[_0x73db('0x82')](_0x6a5c02));return[];}}exports[_0x73db('0x83')]=function(_0x3416fc,_0x2ddabe,_0x317544){if(_0x3416fc[_0x73db('0x60')]['id']){delete _0x3416fc[_0x73db('0x60')]['id'];}return db['Dashboard'][_0x73db('0x57')]({'where':{'id':_0x3416fc[_0x73db('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2ddabe,null))[_0x73db('0x2f')](function(_0x2d5ddb){if(_0x2d5ddb){_0x3416fc['body'][_0x73db('0x84')]=_0x2d5ddb['id'];_0x3416fc['body'][_0x73db('0x65')]=widgetAttributes(_0x3416fc[_0x73db('0x60')]);return db['DashboardItem'][_0x73db('0x52')](_0x3416fc[_0x73db('0x60')]);}})['then'](respondWithResult(_0x2ddabe,null))[_0x73db('0x4f')](handleError(_0x2ddabe,null));};exports[_0x73db('0x85')]=function(_0x32614e,_0x445b14,_0x322220){var _0x509c01={};var _0x458870={};var _0x4cff19;var _0x250da7;return db[_0x73db('0x38')]['findOne']({'where':{'id':_0x32614e['params']['id']}})[_0x73db('0x2f')](handleEntityNotFound(_0x445b14,null))[_0x73db('0x2f')](function(_0x254f82){if(_0x254f82){_0x4cff19=_0x254f82;_0x458870[_0x73db('0x3d')]=_[_0x73db('0x3f')](db[_0x73db('0x86')]['rawAttributes']);_0x458870[_0x73db('0x3e')]=_[_0x73db('0x3f')](_0x32614e[_0x73db('0x3e')]);_0x458870[_0x73db('0x40')]=_[_0x73db('0x42')](_0x458870[_0x73db('0x3d')],_0x458870[_0x73db('0x3e')]);_0x509c01[_0x73db('0x41')]=_[_0x73db('0x42')](_0x458870[_0x73db('0x3d')],qs[_0x73db('0x43')](_0x32614e[_0x73db('0x3e')][_0x73db('0x43')]));_0x509c01['attributes']=_0x509c01[_0x73db('0x41')][_0x73db('0x44')]?_0x509c01[_0x73db('0x41')]:_0x458870[_0x73db('0x3d')];_0x509c01[_0x73db('0x47')]=qs[_0x73db('0x48')](_0x32614e[_0x73db('0x3e')]['sort']);_0x509c01[_0x73db('0x4b')]=qs['filters'](_[_0x73db('0x49')](_0x32614e[_0x73db('0x3e')],_0x458870[_0x73db('0x40')]));if(_0x32614e['query'][_0x73db('0x4a')]){_0x509c01[_0x73db('0x4b')]=_['merge'](_0x509c01[_0x73db('0x4b')],{'$or':_['map'](_0x509c01[_0x73db('0x41')],function(_0xea318c){var _0x4e397c={};_0x4e397c[_0xea318c]={'$like':'%'+_0x32614e['query']['filter']+'%'};return _0x4e397c;})});}_0x509c01=_[_0x73db('0x4c')]({},_0x509c01,_0x32614e[_0x73db('0x5e')]);return _0x4cff19[_0x73db('0x85')](_0x509c01);}})[_0x73db('0x2f')](function(_0x3bf95d){if(_0x3bf95d){_0x250da7=_0x3bf95d['length'];if(!_0x32614e[_0x73db('0x3e')][_0x73db('0x45')]('nolimit')){_0x509c01[_0x73db('0x26')]=qs[_0x73db('0x26')](_0x32614e[_0x73db('0x3e')][_0x73db('0x26')]);_0x509c01[_0x73db('0x28')]=qs[_0x73db('0x28')](_0x32614e['query'][_0x73db('0x28')]);}return _0x4cff19[_0x73db('0x85')](_0x509c01);}})['then'](function(_0x162ea7){if(_0x162ea7){return _0x162ea7?{'count':_0x250da7,'rows':_0x162ea7}:null;}})[_0x73db('0x2f')](respondWithResult(_0x445b14,null))['catch'](handleError(_0x445b14,null));};
\ No newline at end of file