Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / dashboard / dashboard.controller.js
index 4223f0c..fe72b66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec91=['map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','sort','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','get','CustomDashboards','end','sendStatus','error','name','send','index'];(function(_0x1f786f,_0x44b552){var _0x202432=function(_0x573a53){while(--_0x573a53){_0x1f786f['push'](_0x1f786f['shift']());}};_0x202432(++_0x44b552);}(_0xec91,0xc7));var _0x1ec9=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0xec91[_0x22663b];return _0x310d0a;};'use strict';var emlformat=require(_0x1ec9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ec9('0x1'));var jsonpatch=require(_0x1ec9('0x2'));var rp=require(_0x1ec9('0x3'));var moment=require(_0x1ec9('0x4'));var BPromise=require(_0x1ec9('0x5'));var Mustache=require('mustache');var util=require(_0x1ec9('0x6'));var path=require(_0x1ec9('0x7'));var sox=require(_0x1ec9('0x8'));var csv=require('to-csv');var ejs=require(_0x1ec9('0x9'));var fs=require('fs');var fs_extra=require(_0x1ec9('0xa'));var _=require(_0x1ec9('0xb'));var squel=require(_0x1ec9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1ec9('0xd'));var querystring=require('querystring');var Papa=require(_0x1ec9('0xe'));var Redis=require(_0x1ec9('0xf'));var authService=require(_0x1ec9('0x10'));var qs=require(_0x1ec9('0x11'));var as=require(_0x1ec9('0x12'));var hardwareService=require(_0x1ec9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1ec9('0x14'));var config=require(_0x1ec9('0x15'));var licenseUtil=require(_0x1ec9('0x16'));var db=require(_0x1ec9('0x17'))['db'];config[_0x1ec9('0x18')]=_['defaults'](config[_0x1ec9('0x18')],{'host':_0x1ec9('0x19'),'port':0x18eb});var socket=require(_0x1ec9('0x1a'))(new Redis(config['redis']));require(_0x1ec9('0x1b'))[_0x1ec9('0x1c')](socket);function respondWithStatusCode(_0x1f5536,_0x4c99e5){_0x4c99e5=_0x4c99e5||0xcc;return function(_0x4aae46){if(_0x4aae46){return _0x1f5536['sendStatus'](_0x4c99e5);}return _0x1f5536[_0x1ec9('0x1d')](_0x4c99e5)['end']();};}function respondWithResult(_0x541273,_0x2570bd){_0x2570bd=_0x2570bd||0xc8;return function(_0x965f96){if(_0x965f96){return _0x541273[_0x1ec9('0x1d')](_0x2570bd)[_0x1ec9('0x1e')](_0x965f96);}};}function respondWithFilteredResult(_0x199419,_0x3b8587){return function(_0x3e3982){if(_0x3e3982){var _0x51d3b6=typeof _0x3b8587[_0x1ec9('0x1f')]===_0x1ec9('0x20')&&typeof _0x3b8587[_0x1ec9('0x21')]===_0x1ec9('0x20');var _0x56e049=_0x3e3982[_0x1ec9('0x22')];var _0x2b62a4=_0x51d3b6?0x0:_0x3b8587[_0x1ec9('0x1f')];var _0x2698e3=_0x51d3b6?_0x3e3982[_0x1ec9('0x22')]:_0x3b8587[_0x1ec9('0x1f')]+_0x3b8587[_0x1ec9('0x21')];var _0x2c739f;if(_0x2698e3>=_0x56e049){_0x2698e3=_0x56e049;_0x2c739f=0xc8;}else{_0x2c739f=0xce;}_0x199419[_0x1ec9('0x1d')](_0x2c739f);return _0x199419['set'](_0x1ec9('0x23'),_0x2b62a4+'-'+_0x2698e3+'/'+_0x56e049)[_0x1ec9('0x1e')](_0x3e3982);}return null;};}function patchUpdates(_0xd7d2a){return function(_0x254c78){try{jsonpatch[_0x1ec9('0x24')](_0x254c78,_0xd7d2a,!![]);}catch(_0x42ffe3){return BPromise[_0x1ec9('0x25')](_0x42ffe3);}return _0x254c78[_0x1ec9('0x26')]();};}function saveUpdates(_0x543337,_0x5bc5d2){return function(_0x2168c9){if(_0x2168c9){return _0x2168c9['update'](_0x543337)['then'](function(_0xfdb251){return _0xfdb251;});}return null;};}function removeEntity(_0x126060,_0x522dca){return function(_0x5d8a27){if(_0x5d8a27){return _0x5d8a27[_0x1ec9('0x27')]()[_0x1ec9('0x28')](function(){var _0x5060dc=_0x5d8a27[_0x1ec9('0x29')]({'plain':!![]});var _0x2cf576=_0x1ec9('0x2a');return db['UserProfileResource'][_0x1ec9('0x27')]({'where':{'type':_0x2cf576,'resourceId':_0x5060dc['id']}})[_0x1ec9('0x28')](function(){return _0x5d8a27;});})[_0x1ec9('0x28')](function(){_0x126060['status'](0xcc)[_0x1ec9('0x2b')]();});}};}function handleEntityNotFound(_0x2fc204,_0x4077ab){return function(_0x491ad0){if(!_0x491ad0){_0x2fc204[_0x1ec9('0x2c')](0x194);}return _0x491ad0;};}function handleError(_0x576f76,_0x3067c4){_0x3067c4=_0x3067c4||0x1f4;return function(_0x53e190){logger[_0x1ec9('0x2d')](_0x53e190['stack']);if(_0x53e190['name']){delete _0x53e190[_0x1ec9('0x2e')];}_0x576f76['status'](_0x3067c4)[_0x1ec9('0x2f')](_0x53e190);};}exports[_0x1ec9('0x30')]=function(_0x40cf8b,_0x1b46e2){var _0x4d6611={},_0x5ac551={},_0xbe79d4={'count':0x0,'rows':[]};var _0x1bf6ec=_[_0x1ec9('0x31')](db[_0x1ec9('0x32')]['rawAttributes'],function(_0x31855f){return{'name':_0x31855f[_0x1ec9('0x33')],'type':_0x31855f[_0x1ec9('0x34')][_0x1ec9('0x35')]};});_0x5ac551[_0x1ec9('0x36')]=_[_0x1ec9('0x31')](_0x1bf6ec,_0x1ec9('0x2e'));_0x5ac551[_0x1ec9('0x37')]=_[_0x1ec9('0x38')](_0x40cf8b[_0x1ec9('0x37')]);_0x5ac551[_0x1ec9('0x39')]=_[_0x1ec9('0x3a')](_0x5ac551[_0x1ec9('0x36')],_0x5ac551[_0x1ec9('0x37')]);_0x4d6611[_0x1ec9('0x3b')]=_[_0x1ec9('0x3a')](_0x5ac551[_0x1ec9('0x36')],qs[_0x1ec9('0x3c')](_0x40cf8b[_0x1ec9('0x37')][_0x1ec9('0x3c')]));_0x4d6611[_0x1ec9('0x3b')]=_0x4d6611['attributes'][_0x1ec9('0x3d')]?_0x4d6611[_0x1ec9('0x3b')]:_0x5ac551[_0x1ec9('0x36')];if(!_0x40cf8b[_0x1ec9('0x37')][_0x1ec9('0x3e')](_0x1ec9('0x3f'))){_0x4d6611['limit']=qs[_0x1ec9('0x21')](_0x40cf8b[_0x1ec9('0x37')][_0x1ec9('0x21')]);_0x4d6611['offset']=qs[_0x1ec9('0x1f')](_0x40cf8b[_0x1ec9('0x37')][_0x1ec9('0x1f')]);}_0x4d6611[_0x1ec9('0x40')]=qs['sort'](_0x40cf8b['query']['sort']);_0x4d6611[_0x1ec9('0x41')]=qs[_0x1ec9('0x39')](_[_0x1ec9('0x42')](_0x40cf8b[_0x1ec9('0x37')],_0x5ac551[_0x1ec9('0x39')]),_0x1bf6ec);if(_0x40cf8b['query'][_0x1ec9('0x43')]){_0x4d6611[_0x1ec9('0x41')]=_[_0x1ec9('0x44')](_0x4d6611[_0x1ec9('0x41')],{'$or':_[_0x1ec9('0x31')](_0x1bf6ec,function(_0x191fd9){if(_0x191fd9[_0x1ec9('0x34')]!=='VIRTUAL'){var _0x35c6e6={};_0x35c6e6[_0x191fd9[_0x1ec9('0x2e')]]={'$like':'%'+_0x40cf8b[_0x1ec9('0x37')][_0x1ec9('0x43')]+'%'};return _0x35c6e6;}})});}_0x4d6611=_[_0x1ec9('0x44')]({},_0x4d6611,_0x40cf8b[_0x1ec9('0x45')]);var _0x4bb98a={'where':_0x4d6611['where']};return db['Dashboard'][_0x1ec9('0x22')](_0x4bb98a)[_0x1ec9('0x28')](function(_0x38aa58){_0xbe79d4['count']=_0x38aa58;if(_0x40cf8b[_0x1ec9('0x37')][_0x1ec9('0x46')]){_0x4d6611[_0x1ec9('0x47')]=[{'all':!![]}];}return db[_0x1ec9('0x32')][_0x1ec9('0x48')](_0x4d6611);})[_0x1ec9('0x28')](function(_0x5179d4){_0xbe79d4[_0x1ec9('0x49')]=_0x5179d4;return _0xbe79d4;})[_0x1ec9('0x28')](respondWithFilteredResult(_0x1b46e2,_0x4d6611))[_0x1ec9('0x4a')](handleError(_0x1b46e2,null));};exports[_0x1ec9('0x4b')]=function(_0x28cd19,_0x15837d){var _0x126474={'raw':![],'where':{'id':_0x28cd19[_0x1ec9('0x4c')]['id']}},_0x380572={};_0x380572[_0x1ec9('0x36')]=_[_0x1ec9('0x38')](db[_0x1ec9('0x32')][_0x1ec9('0x4d')]);_0x380572['query']=_['keys'](_0x28cd19[_0x1ec9('0x37')]);_0x380572[_0x1ec9('0x39')]=_[_0x1ec9('0x3a')](_0x380572['model'],_0x380572[_0x1ec9('0x37')]);_0x126474[_0x1ec9('0x3b')]=_[_0x1ec9('0x3a')](_0x380572[_0x1ec9('0x36')],qs['fields'](_0x28cd19[_0x1ec9('0x37')][_0x1ec9('0x3c')]));_0x126474[_0x1ec9('0x3b')]=_0x126474[_0x1ec9('0x3b')][_0x1ec9('0x3d')]?_0x126474[_0x1ec9('0x3b')]:_0x380572[_0x1ec9('0x36')];if(_0x28cd19[_0x1ec9('0x37')][_0x1ec9('0x46')]){_0x126474[_0x1ec9('0x47')]=[{'all':!![]}];}_0x126474=_['merge']({},_0x126474,_0x28cd19[_0x1ec9('0x45')]);return db[_0x1ec9('0x32')][_0x1ec9('0x4e')](_0x126474)[_0x1ec9('0x28')](handleEntityNotFound(_0x15837d,null))[_0x1ec9('0x28')](respondWithResult(_0x15837d,null))['catch'](handleError(_0x15837d,null));};exports[_0x1ec9('0x4f')]=function(_0x246b4a,_0x54c27d){return db[_0x1ec9('0x32')]['create'](_0x246b4a[_0x1ec9('0x50')],{})[_0x1ec9('0x28')](function(_0x3d3173){var _0xf31986=_0x246b4a['user']['get']({'plain':!![]});if(!_0xf31986)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf31986[_0x1ec9('0x51')]==='user'){var _0x21c87a=_0x3d3173['get']({'plain':!![]});var _0x5b342d='CustomDashboards';return db[_0x1ec9('0x52')][_0x1ec9('0x4e')]({'where':{'name':_0x5b342d,'userProfileId':_0xf31986['userProfileId']},'raw':!![]})[_0x1ec9('0x28')](function(_0x446907){if(_0x446907&&_0x446907['autoAssociation']===0x0){return db[_0x1ec9('0x53')][_0x1ec9('0x4f')]({'name':_0x21c87a['name'],'resourceId':_0x21c87a['id'],'type':_0x446907[_0x1ec9('0x2e')],'sectionId':_0x446907['id']},{})[_0x1ec9('0x28')](function(){return _0x3d3173;});}else{return _0x3d3173;}})[_0x1ec9('0x4a')](function(_0x37ca4c){logger['error'](_0x1ec9('0x54'),_0x37ca4c);throw _0x37ca4c;});}return _0x3d3173;})[_0x1ec9('0x28')](respondWithResult(_0x54c27d,0xc9))[_0x1ec9('0x4a')](handleError(_0x54c27d,null));};exports[_0x1ec9('0x55')]=function(_0x3c3ce5,_0x3c28ce){var _0x18f70e={'where':{'id':_0x3c3ce5[_0x1ec9('0x4c')]['id']}},_0xe42bd={};_0xe42bd[_0x1ec9('0x36')]=_[_0x1ec9('0x38')](db[_0x1ec9('0x32')]['rawAttributes']);_0x18f70e[_0x1ec9('0x3b')]=_[_0x1ec9('0x3a')](_0xe42bd[_0x1ec9('0x36')],qs['fields'](_0x3c3ce5[_0x1ec9('0x37')][_0x1ec9('0x3c')]));_0x18f70e[_0x1ec9('0x3b')]=_0x18f70e[_0x1ec9('0x3b')][_0x1ec9('0x3d')]?_0x18f70e[_0x1ec9('0x3b')]:_0xe42bd[_0x1ec9('0x36')];if(_0x3c3ce5[_0x1ec9('0x37')][_0x1ec9('0x46')]){_0x18f70e[_0x1ec9('0x47')]=[{'all':!![]}];}_0x18f70e=_[_0x1ec9('0x44')]({},_0x18f70e,_0x3c3ce5['options']);return db[_0x1ec9('0x32')][_0x1ec9('0x4e')](_0x18f70e)[_0x1ec9('0x28')](handleEntityNotFound(_0x3c28ce,null))[_0x1ec9('0x28')](function(_0x3d900a){if(_0x3d900a){var _0x1597a5=_0x3d900a[_0x1ec9('0x29')]({'plain':!![]});_0x1597a5=qs[_0x1ec9('0x56')](_0x1597a5,['id',_0x1ec9('0x57'),_0x1ec9('0x58')]);_0x3c3ce5['body']=_['omit'](_0x3c3ce5[_0x1ec9('0x50')],['id',_0x1ec9('0x57'),'updatedAt']);return db['Dashboard'][_0x1ec9('0x4f')](_[_0x1ec9('0x44')](_0x1597a5,_0x3c3ce5[_0x1ec9('0x50')]),{'include':_0x3c3ce5[_0x1ec9('0x37')][_0x1ec9('0x46')]?[{'all':!![]}]:undefined})[_0x1ec9('0x28')](function(_0x120ac8){var _0x1aaac8=_0x3c3ce5[_0x1ec9('0x59')][_0x1ec9('0x29')]({'plain':!![]});if(!_0x1aaac8)throw new Error(_0x1ec9('0x5a'));if(_0x1aaac8['role']==='user'){var _0x5afea4=_0x120ac8['get']({'plain':!![]});var _0x259a58=_0x1ec9('0x2a');return db[_0x1ec9('0x52')][_0x1ec9('0x4e')]({'where':{'name':_0x259a58,'userProfileId':_0x1aaac8[_0x1ec9('0x5b')]},'raw':!![]})[_0x1ec9('0x28')](function(_0x4c52cc){if(_0x4c52cc&&_0x4c52cc[_0x1ec9('0x5c')]===0x0){return db[_0x1ec9('0x53')][_0x1ec9('0x4f')]({'name':_0x5afea4['name'],'resourceId':_0x5afea4['id'],'type':_0x4c52cc[_0x1ec9('0x2e')],'sectionId':_0x4c52cc['id']},{})[_0x1ec9('0x28')](function(){return _0x120ac8;});}else{return _0x120ac8;}})[_0x1ec9('0x4a')](function(_0x3ba607){logger[_0x1ec9('0x2d')](_0x1ec9('0x54'),_0x3ba607);throw _0x3ba607;});}return _0x120ac8;});}})[_0x1ec9('0x28')](respondWithResult(_0x3c28ce,0xc9))[_0x1ec9('0x4a')](handleError(_0x3c28ce,null));};exports['update']=function(_0x192e9e,_0x5aa0fb){if(_0x192e9e['body']['id']){delete _0x192e9e['body']['id'];}return db['Dashboard'][_0x1ec9('0x4e')]({'where':{'id':_0x192e9e[_0x1ec9('0x4c')]['id']}})[_0x1ec9('0x28')](handleEntityNotFound(_0x5aa0fb,null))[_0x1ec9('0x28')](saveUpdates(_0x192e9e['body'],null))[_0x1ec9('0x28')](respondWithResult(_0x5aa0fb,null))[_0x1ec9('0x4a')](handleError(_0x5aa0fb,null));};exports[_0x1ec9('0x27')]=function(_0x4dd02b,_0x26a4cd){return db[_0x1ec9('0x32')][_0x1ec9('0x4e')]({'where':{'id':_0x4dd02b[_0x1ec9('0x4c')]['id']}})[_0x1ec9('0x28')](handleEntityNotFound(_0x26a4cd,null))[_0x1ec9('0x28')](removeEntity(_0x26a4cd,null))['catch'](handleError(_0x26a4cd,null));};function widgetAttributes(_0x15ad50){try{switch(_0x15ad50[_0x1ec9('0x34')]){case _0x1ec9('0x5d'):return[{'name':'attrUrl','value':_0x15ad50[_0x1ec9('0x5e')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x0]?_0x15ad50[_0x1ec9('0x5f')][0x0]['value']:undefined)||'https://'}];case _0x1ec9('0x60'):return[{'name':_0x1ec9('0x61'),'value':_0x15ad50[_0x1ec9('0x61')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x0]?_0x15ad50['attrs'][0x0][_0x1ec9('0x62')]:undefined)||''}];case _0x1ec9('0x63'):return[{'name':_0x1ec9('0x64'),'value':_0x15ad50['attrHourFormat']||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x0]?_0x15ad50[_0x1ec9('0x5f')][0x0][_0x1ec9('0x62')]:undefined)||_0x1ec9('0x65')},{'name':_0x1ec9('0x66'),'value':_0x15ad50[_0x1ec9('0x66')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x1]?_0x15ad50[_0x1ec9('0x5f')][0x1][_0x1ec9('0x62')]:undefined)||_0x1ec9('0x67')},{'name':_0x1ec9('0x68'),'value':_0x15ad50[_0x1ec9('0x68')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x2]?_0x15ad50['attrs'][0x2][_0x1ec9('0x62')]:undefined)||0xc}];case _0x1ec9('0x69'):return[{'name':_0x1ec9('0x6a'),'value':_0x15ad50['attrMetric']||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50['attrs'][0x0]?_0x15ad50[_0x1ec9('0x5f')][0x0]['value']:undefined)||_0x1ec9('0x6b')},{'name':_0x1ec9('0x6c'),'value':_0x15ad50[_0x1ec9('0x6c')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x1]?_0x15ad50['attrs'][0x1][_0x1ec9('0x62')]:undefined)||[]},{'name':_0x1ec9('0x68'),'value':_0x15ad50[_0x1ec9('0x68')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x2]?_0x15ad50[_0x1ec9('0x5f')][0x2][_0x1ec9('0x62')]:undefined)||0x14}];case'multibar-chart':case _0x1ec9('0x6d'):return[{'name':_0x1ec9('0x6e'),'value':_0x15ad50['attrSerie1']||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50['attrs'][0x0]?_0x15ad50['attrs'][0x0][_0x1ec9('0x62')]:undefined)||_0x1ec9('0x6b')},{'name':_0x1ec9('0x6f'),'value':_0x15ad50['attrSerie2']||(_0x15ad50['attrs']&&_0x15ad50[_0x1ec9('0x5f')][0x1]?_0x15ad50[_0x1ec9('0x5f')][0x1][_0x1ec9('0x62')]:undefined)||null},{'name':'attrSerie3','value':_0x15ad50['attrSerie3']||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x2]?_0x15ad50[_0x1ec9('0x5f')][0x2][_0x1ec9('0x62')]:undefined)||null},{'name':_0x1ec9('0x6c'),'value':_0x15ad50[_0x1ec9('0x6c')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x3]?_0x15ad50[_0x1ec9('0x5f')][0x3]['value']:undefined)||[]}];case _0x1ec9('0x70'):return[{'name':_0x1ec9('0x71'),'type':_0x15ad50[_0x1ec9('0x72')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50['attrs'][0x0]?_0x15ad50[_0x1ec9('0x5f')][0x0][_0x1ec9('0x34')]:undefined)||null,'value':_0x15ad50[_0x1ec9('0x71')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x0]?_0x15ad50['attrs'][0x0]['value']:undefined)||null},{'name':_0x1ec9('0x73'),'value':_0x15ad50[_0x1ec9('0x73')]||(_0x15ad50[_0x1ec9('0x5f')]&&_0x15ad50[_0x1ec9('0x5f')][0x1]?_0x15ad50[_0x1ec9('0x5f')][0x1][_0x1ec9('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x40fb6b){logger[_0x1ec9('0x2d')](_0x1ec9('0x74'),JSON[_0x1ec9('0x75')](_0x40fb6b));return[];}}exports[_0x1ec9('0x76')]=function(_0x2f13f8,_0x5508fe,_0xaf672b){if(_0x2f13f8['body']['id']){delete _0x2f13f8[_0x1ec9('0x50')]['id'];}return db['Dashboard'][_0x1ec9('0x4e')]({'where':{'id':_0x2f13f8[_0x1ec9('0x4c')]['id']}})[_0x1ec9('0x28')](handleEntityNotFound(_0x5508fe,null))[_0x1ec9('0x28')](function(_0x56478f){if(_0x56478f){_0x2f13f8[_0x1ec9('0x50')][_0x1ec9('0x77')]=_0x56478f['id'];_0x2f13f8[_0x1ec9('0x50')][_0x1ec9('0x5f')]=widgetAttributes(_0x2f13f8[_0x1ec9('0x50')]);return db[_0x1ec9('0x78')][_0x1ec9('0x4f')](_0x2f13f8[_0x1ec9('0x50')]);}})[_0x1ec9('0x28')](respondWithResult(_0x5508fe,null))[_0x1ec9('0x4a')](handleError(_0x5508fe,null));};exports[_0x1ec9('0x79')]=function(_0x4e9f11,_0x1c53f9,_0x2a3bd7){var _0x11abce={};var _0x244851={};var _0x45b2c4;var _0x42d710;return db[_0x1ec9('0x32')][_0x1ec9('0x7a')]({'where':{'id':_0x4e9f11[_0x1ec9('0x4c')]['id']}})[_0x1ec9('0x28')](handleEntityNotFound(_0x1c53f9,null))[_0x1ec9('0x28')](function(_0xc770cf){if(_0xc770cf){_0x45b2c4=_0xc770cf;_0x244851[_0x1ec9('0x36')]=_[_0x1ec9('0x38')](db[_0x1ec9('0x78')]['rawAttributes']);_0x244851[_0x1ec9('0x37')]=_['keys'](_0x4e9f11[_0x1ec9('0x37')]);_0x244851[_0x1ec9('0x39')]=_[_0x1ec9('0x3a')](_0x244851[_0x1ec9('0x36')],_0x244851[_0x1ec9('0x37')]);_0x11abce[_0x1ec9('0x3b')]=_[_0x1ec9('0x3a')](_0x244851['model'],qs[_0x1ec9('0x3c')](_0x4e9f11[_0x1ec9('0x37')][_0x1ec9('0x3c')]));_0x11abce['attributes']=_0x11abce['attributes'][_0x1ec9('0x3d')]?_0x11abce[_0x1ec9('0x3b')]:_0x244851[_0x1ec9('0x36')];_0x11abce[_0x1ec9('0x40')]=qs[_0x1ec9('0x7b')](_0x4e9f11[_0x1ec9('0x37')]['sort']);_0x11abce[_0x1ec9('0x41')]=qs[_0x1ec9('0x39')](_[_0x1ec9('0x42')](_0x4e9f11[_0x1ec9('0x37')],_0x244851['filters']));if(_0x4e9f11[_0x1ec9('0x37')][_0x1ec9('0x43')]){_0x11abce[_0x1ec9('0x41')]=_['merge'](_0x11abce[_0x1ec9('0x41')],{'$or':_[_0x1ec9('0x31')](_0x11abce[_0x1ec9('0x3b')],function(_0x3c18f2){var _0x7a4661={};_0x7a4661[_0x3c18f2]={'$like':'%'+_0x4e9f11[_0x1ec9('0x37')][_0x1ec9('0x43')]+'%'};return _0x7a4661;})});}_0x11abce=_[_0x1ec9('0x44')]({},_0x11abce,_0x4e9f11[_0x1ec9('0x45')]);return _0x45b2c4['getItems'](_0x11abce);}})[_0x1ec9('0x28')](function(_0x123006){if(_0x123006){_0x42d710=_0x123006['length'];if(!_0x4e9f11[_0x1ec9('0x37')]['hasOwnProperty'](_0x1ec9('0x3f'))){_0x11abce[_0x1ec9('0x21')]=qs[_0x1ec9('0x21')](_0x4e9f11['query'][_0x1ec9('0x21')]);_0x11abce[_0x1ec9('0x1f')]=qs[_0x1ec9('0x1f')](_0x4e9f11[_0x1ec9('0x37')][_0x1ec9('0x1f')]);}return _0x45b2c4[_0x1ec9('0x79')](_0x11abce);}})[_0x1ec9('0x28')](function(_0x3f0e0e){if(_0x3f0e0e){return _0x3f0e0e?{'count':_0x42d710,'rows':_0x3f0e0e}:null;}})[_0x1ec9('0x28')](respondWithResult(_0x1c53f9,null))['catch'](handleError(_0x1c53f9,null));};
\ No newline at end of file
+var _0xe73a=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','reject','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','map','type','VIRTUAL','options','Dashboard','includeAll','include','findAll','show','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','updatedAt','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','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','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','keys','length','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4d50a1,_0x188247){var _0x2d733f=function(_0x4d104c){while(--_0x4d104c){_0x4d50a1['push'](_0x4d50a1['shift']());}};_0x2d733f(++_0x188247);}(_0xe73a,0x80));var _0xae73=function(_0x58256e,_0x48f062){_0x58256e=_0x58256e-0x0;var _0xc9e57b=_0xe73a[_0x58256e];return _0xc9e57b;};'use strict';var emlformat=require(_0xae73('0x0'));var rimraf=require(_0xae73('0x1'));var zipdir=require(_0xae73('0x2'));var jsonpatch=require(_0xae73('0x3'));var rp=require(_0xae73('0x4'));var moment=require(_0xae73('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xae73('0x6'));var util=require(_0xae73('0x7'));var path=require('path');var sox=require(_0xae73('0x8'));var csv=require(_0xae73('0x9'));var ejs=require(_0xae73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae73('0xb'));var squel=require(_0xae73('0xc'));var crypto=require(_0xae73('0xd'));var jsforce=require(_0xae73('0xe'));var deskjs=require(_0xae73('0xf'));var toCsv=require('to-csv');var querystring=require(_0xae73('0x10'));var Papa=require('papaparse');var Redis=require(_0xae73('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xae73('0x12'));var as=require(_0xae73('0x13'));var hardwareService=require(_0xae73('0x14'));var logger=require('../../config/logger')(_0xae73('0x15'));var utils=require('../../config/utils');var config=require(_0xae73('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xae73('0x17')](config['redis'],{'host':_0xae73('0x18'),'port':0x18eb});var socket=require(_0xae73('0x19'))(new Redis(config[_0xae73('0x1a')]));require(_0xae73('0x1b'))[_0xae73('0x1c')](socket);function respondWithStatusCode(_0x12dc8c,_0x275d28){_0x275d28=_0x275d28||0xcc;return function(_0x491c00){if(_0x491c00){return _0x12dc8c[_0xae73('0x1d')](_0x275d28);}return _0x12dc8c[_0xae73('0x1e')](_0x275d28)[_0xae73('0x1f')]();};}function respondWithResult(_0x51ebd6,_0x5740c3){_0x5740c3=_0x5740c3||0xc8;return function(_0x22e588){if(_0x22e588){return _0x51ebd6[_0xae73('0x1e')](_0x5740c3)[_0xae73('0x20')](_0x22e588);}};}function respondWithFilteredResult(_0xa12b27,_0x34822d){return function(_0x290ba5){if(_0x290ba5){var _0x3e51cc=typeof _0x34822d[_0xae73('0x21')]==='undefined'&&typeof _0x34822d['limit']==='undefined';var _0x134763=_0x290ba5[_0xae73('0x22')];var _0x520ff3=_0x3e51cc?0x0:_0x34822d[_0xae73('0x21')];var _0xbc2f7d=_0x3e51cc?_0x290ba5['count']:_0x34822d['offset']+_0x34822d[_0xae73('0x23')];var _0x37e00e;if(_0xbc2f7d>=_0x134763){_0xbc2f7d=_0x134763;_0x37e00e=0xc8;}else{_0x37e00e=0xce;}_0xa12b27[_0xae73('0x1e')](_0x37e00e);return _0xa12b27[_0xae73('0x24')](_0xae73('0x25'),_0x520ff3+'-'+_0xbc2f7d+'/'+_0x134763)[_0xae73('0x20')](_0x290ba5);}return null;};}function patchUpdates(_0x47e4fa){return function(_0x18a19d){try{jsonpatch['apply'](_0x18a19d,_0x47e4fa,!![]);}catch(_0x59bb9f){return BPromise[_0xae73('0x26')](_0x59bb9f);}return _0x18a19d[_0xae73('0x27')]();};}function saveUpdates(_0x26ef52,_0x517fb4){return function(_0x4fdb31){if(_0x4fdb31){return _0x4fdb31[_0xae73('0x28')](_0x26ef52)['then'](function(_0x295099){return _0x295099;});}return null;};}function removeEntity(_0x1988f9,_0x1508ac){return function(_0x5eb5f4){if(_0x5eb5f4){return _0x5eb5f4[_0xae73('0x29')]()[_0xae73('0x2a')](function(){var _0x1e2eff=_0x5eb5f4[_0xae73('0x2b')]({'plain':!![]});var _0x2b14c7=_0xae73('0x2c');return db[_0xae73('0x2d')][_0xae73('0x29')]({'where':{'type':_0x2b14c7,'resourceId':_0x1e2eff['id']}})[_0xae73('0x2a')](function(){return _0x5eb5f4;});})['then'](function(){_0x1988f9[_0xae73('0x1e')](0xcc)[_0xae73('0x1f')]();});}};}function handleEntityNotFound(_0xf534f4,_0x3e0155){return function(_0x524a57){if(!_0x524a57){_0xf534f4[_0xae73('0x1d')](0x194);}return _0x524a57;};}function handleError(_0x516a4f,_0x2b7cba){_0x2b7cba=_0x2b7cba||0x1f4;return function(_0x28729a){logger[_0xae73('0x2e')](_0x28729a[_0xae73('0x2f')]);if(_0x28729a['name']){delete _0x28729a[_0xae73('0x30')];}_0x516a4f[_0xae73('0x1e')](_0x2b7cba)[_0xae73('0x31')](_0x28729a);};}exports[_0xae73('0x32')]=function(_0xd95526,_0xbb18de){var _0xa2c19e={},_0x1e5f3a={},_0x9e9ff6={'count':0x0,'rows':[]};var _0x7ee443=_['map'](db['Dashboard'][_0xae73('0x33')],function(_0x12e865){return{'name':_0x12e865['fieldName'],'type':_0x12e865['type'][_0xae73('0x34')]};});_0x1e5f3a[_0xae73('0x35')]=_['map'](_0x7ee443,_0xae73('0x30'));_0x1e5f3a[_0xae73('0x36')]=_['keys'](_0xd95526[_0xae73('0x36')]);_0x1e5f3a[_0xae73('0x37')]=_[_0xae73('0x38')](_0x1e5f3a[_0xae73('0x35')],_0x1e5f3a[_0xae73('0x36')]);_0xa2c19e[_0xae73('0x39')]=_['intersection'](_0x1e5f3a[_0xae73('0x35')],qs['fields'](_0xd95526[_0xae73('0x36')][_0xae73('0x3a')]));_0xa2c19e[_0xae73('0x39')]=_0xa2c19e[_0xae73('0x39')]['length']?_0xa2c19e[_0xae73('0x39')]:_0x1e5f3a[_0xae73('0x35')];if(!_0xd95526[_0xae73('0x36')][_0xae73('0x3b')](_0xae73('0x3c'))){_0xa2c19e['limit']=qs[_0xae73('0x23')](_0xd95526[_0xae73('0x36')][_0xae73('0x23')]);_0xa2c19e[_0xae73('0x21')]=qs[_0xae73('0x21')](_0xd95526['query'][_0xae73('0x21')]);}_0xa2c19e[_0xae73('0x3d')]=qs[_0xae73('0x3e')](_0xd95526[_0xae73('0x36')][_0xae73('0x3e')]);_0xa2c19e['where']=qs[_0xae73('0x37')](_['pick'](_0xd95526['query'],_0x1e5f3a[_0xae73('0x37')]),_0x7ee443);if(_0xd95526['query'][_0xae73('0x3f')]){_0xa2c19e['where']=_[_0xae73('0x40')](_0xa2c19e[_0xae73('0x41')],{'$or':_[_0xae73('0x42')](_0x7ee443,function(_0x4c64aa){if(_0x4c64aa[_0xae73('0x43')]!==_0xae73('0x44')){var _0x485b6c={};_0x485b6c[_0x4c64aa[_0xae73('0x30')]]={'$like':'%'+_0xd95526[_0xae73('0x36')]['filter']+'%'};return _0x485b6c;}})});}_0xa2c19e=_[_0xae73('0x40')]({},_0xa2c19e,_0xd95526[_0xae73('0x45')]);var _0x2bb8ef={'where':_0xa2c19e[_0xae73('0x41')]};return db[_0xae73('0x46')][_0xae73('0x22')](_0x2bb8ef)[_0xae73('0x2a')](function(_0x55eeb1){_0x9e9ff6[_0xae73('0x22')]=_0x55eeb1;if(_0xd95526[_0xae73('0x36')][_0xae73('0x47')]){_0xa2c19e[_0xae73('0x48')]=[{'all':!![]}];}return db[_0xae73('0x46')][_0xae73('0x49')](_0xa2c19e);})[_0xae73('0x2a')](function(_0x30a56e){_0x9e9ff6['rows']=_0x30a56e;return _0x9e9ff6;})[_0xae73('0x2a')](respondWithFilteredResult(_0xbb18de,_0xa2c19e))['catch'](handleError(_0xbb18de,null));};exports[_0xae73('0x4a')]=function(_0x4dfac9,_0x1636fd){var _0x483af2={'raw':![],'where':{'id':_0x4dfac9['params']['id']}},_0xeb0ef1={};_0xeb0ef1[_0xae73('0x35')]=_['keys'](db[_0xae73('0x46')][_0xae73('0x33')]);_0xeb0ef1[_0xae73('0x36')]=_['keys'](_0x4dfac9[_0xae73('0x36')]);_0xeb0ef1[_0xae73('0x37')]=_['intersection'](_0xeb0ef1[_0xae73('0x35')],_0xeb0ef1['query']);_0x483af2[_0xae73('0x39')]=_['intersection'](_0xeb0ef1['model'],qs[_0xae73('0x3a')](_0x4dfac9[_0xae73('0x36')][_0xae73('0x3a')]));_0x483af2[_0xae73('0x39')]=_0x483af2[_0xae73('0x39')]['length']?_0x483af2['attributes']:_0xeb0ef1[_0xae73('0x35')];if(_0x4dfac9[_0xae73('0x36')][_0xae73('0x47')]){_0x483af2[_0xae73('0x48')]=[{'all':!![]}];}_0x483af2=_[_0xae73('0x40')]({},_0x483af2,_0x4dfac9[_0xae73('0x45')]);return db['Dashboard'][_0xae73('0x4b')](_0x483af2)[_0xae73('0x2a')](handleEntityNotFound(_0x1636fd,null))[_0xae73('0x2a')](respondWithResult(_0x1636fd,null))[_0xae73('0x4c')](handleError(_0x1636fd,null));};exports[_0xae73('0x4d')]=function(_0x1cad4b,_0x54e3f7){return db[_0xae73('0x46')]['create'](_0x1cad4b[_0xae73('0x4e')],{})[_0xae73('0x2a')](function(_0x574cae){var _0x285475=_0x1cad4b[_0xae73('0x4f')][_0xae73('0x2b')]({'plain':!![]});if(!_0x285475)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x285475[_0xae73('0x50')]===_0xae73('0x4f')){var _0x11bd23=_0x574cae[_0xae73('0x2b')]({'plain':!![]});var _0x306189=_0xae73('0x2c');return db[_0xae73('0x51')][_0xae73('0x4b')]({'where':{'name':_0x306189,'userProfileId':_0x285475[_0xae73('0x52')]},'raw':!![]})['then'](function(_0x53385e){if(_0x53385e&&_0x53385e[_0xae73('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x11bd23['name'],'resourceId':_0x11bd23['id'],'type':_0x53385e['name'],'sectionId':_0x53385e['id']},{})[_0xae73('0x2a')](function(){return _0x574cae;});}else{return _0x574cae;}})['catch'](function(_0x25237d){logger[_0xae73('0x2e')](_0xae73('0x54'),_0x25237d);throw _0x25237d;});}return _0x574cae;})[_0xae73('0x2a')](respondWithResult(_0x54e3f7,0xc9))[_0xae73('0x4c')](handleError(_0x54e3f7,null));};exports[_0xae73('0x55')]=function(_0x5c0496,_0xe5370f){var _0x28a4f4={'where':{'id':_0x5c0496[_0xae73('0x56')]['id']}},_0x6e605e={};_0x6e605e[_0xae73('0x35')]=_['keys'](db[_0xae73('0x46')][_0xae73('0x33')]);_0x28a4f4[_0xae73('0x39')]=_[_0xae73('0x38')](_0x6e605e['model'],qs[_0xae73('0x3a')](_0x5c0496[_0xae73('0x36')][_0xae73('0x3a')]));_0x28a4f4[_0xae73('0x39')]=_0x28a4f4['attributes']['length']?_0x28a4f4[_0xae73('0x39')]:_0x6e605e['model'];if(_0x5c0496[_0xae73('0x36')][_0xae73('0x47')]){_0x28a4f4[_0xae73('0x48')]=[{'all':!![]}];}_0x28a4f4=_[_0xae73('0x40')]({},_0x28a4f4,_0x5c0496[_0xae73('0x45')]);return db[_0xae73('0x46')][_0xae73('0x4b')](_0x28a4f4)[_0xae73('0x2a')](handleEntityNotFound(_0xe5370f,null))[_0xae73('0x2a')](function(_0x82e548){if(_0x82e548){var _0x5a0930=_0x82e548['get']({'plain':!![]});_0x5a0930=qs['omit'](_0x5a0930,['id','createdAt',_0xae73('0x57')]);_0x5c0496[_0xae73('0x4e')]=_[_0xae73('0x58')](_0x5c0496[_0xae73('0x4e')],['id',_0xae73('0x59'),_0xae73('0x57')]);return db['Dashboard'][_0xae73('0x4d')](_['merge'](_0x5a0930,_0x5c0496['body']),{'include':_0x5c0496[_0xae73('0x36')][_0xae73('0x47')]?[{'all':!![]}]:undefined})[_0xae73('0x2a')](function(_0x4463f7){var _0x545555=_0x5c0496[_0xae73('0x4f')][_0xae73('0x2b')]({'plain':!![]});if(!_0x545555)throw new Error(_0xae73('0x5a'));if(_0x545555[_0xae73('0x50')]===_0xae73('0x4f')){var _0x44852e=_0x4463f7[_0xae73('0x2b')]({'plain':!![]});var _0x414f95='CustomDashboards';return db['UserProfileSection'][_0xae73('0x4b')]({'where':{'name':_0x414f95,'userProfileId':_0x545555[_0xae73('0x52')]},'raw':!![]})[_0xae73('0x2a')](function(_0x574c38){if(_0x574c38&&_0x574c38['autoAssociation']===0x0){return db[_0xae73('0x2d')]['create']({'name':_0x44852e[_0xae73('0x30')],'resourceId':_0x44852e['id'],'type':_0x574c38['name'],'sectionId':_0x574c38['id']},{})[_0xae73('0x2a')](function(){return _0x4463f7;});}else{return _0x4463f7;}})['catch'](function(_0x10e315){logger[_0xae73('0x2e')](_0xae73('0x54'),_0x10e315);throw _0x10e315;});}return _0x4463f7;});}})['then'](respondWithResult(_0xe5370f,0xc9))[_0xae73('0x4c')](handleError(_0xe5370f,null));};exports[_0xae73('0x28')]=function(_0x160431,_0xeed6b2){if(_0x160431['body']['id']){delete _0x160431[_0xae73('0x4e')]['id'];}return db[_0xae73('0x46')][_0xae73('0x4b')]({'where':{'id':_0x160431['params']['id']}})[_0xae73('0x2a')](handleEntityNotFound(_0xeed6b2,null))[_0xae73('0x2a')](saveUpdates(_0x160431['body'],null))['then'](respondWithResult(_0xeed6b2,null))[_0xae73('0x4c')](handleError(_0xeed6b2,null));};exports[_0xae73('0x29')]=function(_0x573015,_0x2d16db){return db['Dashboard'][_0xae73('0x4b')]({'where':{'id':_0x573015['params']['id']}})[_0xae73('0x2a')](handleEntityNotFound(_0x2d16db,null))['then'](removeEntity(_0x2d16db,null))['catch'](handleError(_0x2d16db,null));};function widgetAttributes(_0x14190f){try{switch(_0x14190f[_0xae73('0x43')]){case _0xae73('0x5b'):return[{'name':'attrUrl','value':_0x14190f[_0xae73('0x5c')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0]['value']:undefined)||_0xae73('0x5e')}];case _0xae73('0x5f'):return[{'name':'attrPath','value':_0x14190f[_0xae73('0x60')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0][_0xae73('0x61')]:undefined)||''}];case _0xae73('0x62'):return[{'name':_0xae73('0x63'),'value':_0x14190f[_0xae73('0x63')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0]['value']:undefined)||_0xae73('0x64')},{'name':_0xae73('0x65'),'value':_0x14190f[_0xae73('0x65')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x1]?_0x14190f[_0xae73('0x5d')][0x1]['value']:undefined)||_0xae73('0x66')},{'name':_0xae73('0x67'),'value':_0x14190f['attrFontSize']||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x2]?_0x14190f['attrs'][0x2][_0xae73('0x61')]:undefined)||0xc}];case _0xae73('0x68'):return[{'name':_0xae73('0x69'),'value':_0x14190f[_0xae73('0x69')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0][_0xae73('0x61')]:undefined)||_0xae73('0x6a')},{'name':_0xae73('0x6b'),'value':_0x14190f['attrVoiceQueues']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x1]?_0x14190f[_0xae73('0x5d')][0x1][_0xae73('0x61')]:undefined)||[]},{'name':_0xae73('0x67'),'value':_0x14190f['attrFontSize']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x2]?_0x14190f[_0xae73('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0xae73('0x6c'),'value':_0x14190f[_0xae73('0x6c')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x3]?_0x14190f[_0xae73('0x5d')][0x3][_0xae73('0x61')]:undefined)||_0xae73('0x6d')},{'name':'attrEmailAccounts','value':_0x14190f[_0xae73('0x6e')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x4]?_0x14190f[_0xae73('0x5d')][0x4][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x6f'),'value':_0x14190f[_0xae73('0x6f')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x5]?_0x14190f[_0xae73('0x5d')][0x5][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x70'),'value':_0x14190f[_0xae73('0x70')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x6]?_0x14190f[_0xae73('0x5d')][0x6][_0xae73('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x14190f[_0xae73('0x71')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x7]?_0x14190f[_0xae73('0x5d')][0x7]['value']:undefined)||''},{'name':_0xae73('0x72'),'value':_0x14190f[_0xae73('0x72')]||(_0x14190f['attrs']&&_0x14190f['attrs'][0x8]?_0x14190f['attrs'][0x8]['value']:undefined)||''},{'name':_0xae73('0x73'),'value':_0x14190f[_0xae73('0x73')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x9]?_0x14190f[_0xae73('0x5d')][0x9][_0xae73('0x61')]:undefined)||''}];case _0xae73('0x74'):case _0xae73('0x75'):return[{'name':_0xae73('0x76'),'value':_0x14190f[_0xae73('0x76')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f['attrs'][0x0][_0xae73('0x61')]:undefined)||_0xae73('0x6a')},{'name':_0xae73('0x77'),'value':_0x14190f[_0xae73('0x77')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x1]?_0x14190f[_0xae73('0x5d')][0x1][_0xae73('0x61')]:undefined)||null},{'name':_0xae73('0x78'),'value':_0x14190f['attrSerie3']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x2]?_0x14190f[_0xae73('0x5d')][0x2][_0xae73('0x61')]:undefined)||null},{'name':_0xae73('0x6b'),'value':_0x14190f[_0xae73('0x6b')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x3]?_0x14190f['attrs'][0x3][_0xae73('0x61')]:undefined)||[]},{'name':'attrChannel','value':_0x14190f[_0xae73('0x6c')]||(_0x14190f['attrs']&&_0x14190f['attrs'][0x4]?_0x14190f['attrs'][0x4][_0xae73('0x61')]:undefined)||_0xae73('0x6d')},{'name':_0xae73('0x6e'),'value':_0x14190f['attrEmailAccounts']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x5]?_0x14190f[_0xae73('0x5d')][0x5][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x6f'),'value':_0x14190f[_0xae73('0x6f')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x6]?_0x14190f[_0xae73('0x5d')][0x6][_0xae73('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x14190f['attrSmsAccounts']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x7]?_0x14190f[_0xae73('0x5d')][0x7][_0xae73('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x14190f[_0xae73('0x71')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x8]?_0x14190f[_0xae73('0x5d')][0x8][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x72'),'value':_0x14190f['attrWhatsappAccounts']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x9]?_0x14190f[_0xae73('0x5d')][0x9][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x73'),'value':_0x14190f[_0xae73('0x73')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0xa]?_0x14190f[_0xae73('0x5d')][0xa]['value']:undefined)||''}];case _0xae73('0x79'):return[{'name':_0xae73('0x7a'),'type':_0x14190f[_0xae73('0x7b')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0]['type']:undefined)||null,'value':_0x14190f[_0xae73('0x7a')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0][_0xae73('0x61')]:undefined)||null},{'name':_0xae73('0x7c'),'value':_0x14190f[_0xae73('0x7c')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x1]?_0x14190f[_0xae73('0x5d')][0x1][_0xae73('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x4ab6ee){logger[_0xae73('0x2e')](_0xae73('0x7d'),JSON[_0xae73('0x7e')](_0x4ab6ee));return[];}}exports[_0xae73('0x7f')]=function(_0x683607,_0x22f05d,_0x26f655){if(_0x683607['body']['id']){delete _0x683607[_0xae73('0x4e')]['id'];}return db[_0xae73('0x46')][_0xae73('0x4b')]({'where':{'id':_0x683607['params']['id']}})['then'](handleEntityNotFound(_0x22f05d,null))[_0xae73('0x2a')](function(_0x5e6b91){if(_0x5e6b91){_0x683607[_0xae73('0x4e')][_0xae73('0x80')]=_0x5e6b91['id'];_0x683607[_0xae73('0x4e')][_0xae73('0x5d')]=widgetAttributes(_0x683607['body']);return db[_0xae73('0x81')]['create'](_0x683607[_0xae73('0x4e')]);}})[_0xae73('0x2a')](respondWithResult(_0x22f05d,null))[_0xae73('0x4c')](handleError(_0x22f05d,null));};exports[_0xae73('0x82')]=function(_0x49fb8a,_0x359ad2,_0x47879d){var _0x10aa5c={};var _0x235c37={};var _0x44f492;var _0x34ac27;return db['Dashboard'][_0xae73('0x83')]({'where':{'id':_0x49fb8a[_0xae73('0x56')]['id']}})['then'](handleEntityNotFound(_0x359ad2,null))['then'](function(_0x987fe3){if(_0x987fe3){_0x44f492=_0x987fe3;_0x235c37[_0xae73('0x35')]=_[_0xae73('0x84')](db['DashboardItem'][_0xae73('0x33')]);_0x235c37[_0xae73('0x36')]=_[_0xae73('0x84')](_0x49fb8a[_0xae73('0x36')]);_0x235c37[_0xae73('0x37')]=_[_0xae73('0x38')](_0x235c37['model'],_0x235c37[_0xae73('0x36')]);_0x10aa5c[_0xae73('0x39')]=_[_0xae73('0x38')](_0x235c37[_0xae73('0x35')],qs['fields'](_0x49fb8a[_0xae73('0x36')][_0xae73('0x3a')]));_0x10aa5c[_0xae73('0x39')]=_0x10aa5c[_0xae73('0x39')][_0xae73('0x85')]?_0x10aa5c[_0xae73('0x39')]:_0x235c37[_0xae73('0x35')];_0x10aa5c[_0xae73('0x3d')]=qs[_0xae73('0x3e')](_0x49fb8a['query'][_0xae73('0x3e')]);_0x10aa5c['where']=qs[_0xae73('0x37')](_[_0xae73('0x86')](_0x49fb8a[_0xae73('0x36')],_0x235c37['filters']));if(_0x49fb8a[_0xae73('0x36')][_0xae73('0x3f')]){_0x10aa5c[_0xae73('0x41')]=_[_0xae73('0x40')](_0x10aa5c[_0xae73('0x41')],{'$or':_[_0xae73('0x42')](_0x10aa5c[_0xae73('0x39')],function(_0x4958c2){var _0x1826bc={};_0x1826bc[_0x4958c2]={'$like':'%'+_0x49fb8a[_0xae73('0x36')][_0xae73('0x3f')]+'%'};return _0x1826bc;})});}_0x10aa5c=_[_0xae73('0x40')]({},_0x10aa5c,_0x49fb8a[_0xae73('0x45')]);return _0x44f492[_0xae73('0x82')](_0x10aa5c);}})[_0xae73('0x2a')](function(_0x10bd8a){if(_0x10bd8a){_0x34ac27=_0x10bd8a['length'];if(!_0x49fb8a[_0xae73('0x36')][_0xae73('0x3b')](_0xae73('0x3c'))){_0x10aa5c[_0xae73('0x23')]=qs['limit'](_0x49fb8a[_0xae73('0x36')][_0xae73('0x23')]);_0x10aa5c[_0xae73('0x21')]=qs['offset'](_0x49fb8a[_0xae73('0x36')][_0xae73('0x21')]);}return _0x44f492[_0xae73('0x82')](_0x10aa5c);}})[_0xae73('0x2a')](function(_0x1bb939){if(_0x1bb939){return _0x1bb939?{'count':_0x34ac27,'rows':_0x1bb939}:null;}})['then'](respondWithResult(_0x359ad2,null))[_0xae73('0x4c')](handleError(_0x359ad2,null));};
\ No newline at end of file