Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / dashboard / dashboard.controller.js
index b09d253..fe72b66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ff4=['stringify','addItem','DashboardId','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','stack','name','send','index','map','rawAttributes','fieldName','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','type','filter','merge','options','Dashboard','includeAll','include','findAll','rows','catch','show','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','autoAssociation','error','clone','params','omit','updatedAt','body','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrOpenchannelAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s'];(function(_0x43c0d8,_0x59449e){var _0x255aaf=function(_0x204b32){while(--_0x204b32){_0x43c0d8['push'](_0x43c0d8['shift']());}};_0x255aaf(++_0x59449e);}(_0x1ff4,0x8d));var _0x41ff=function(_0x1bcff0,_0x1a06cc){_0x1bcff0=_0x1bcff0-0x0;var _0x1c949d=_0x1ff4[_0x1bcff0];return _0x1c949d;};'use strict';var emlformat=require(_0x41ff('0x0'));var rimraf=require(_0x41ff('0x1'));var zipdir=require(_0x41ff('0x2'));var jsonpatch=require(_0x41ff('0x3'));var rp=require(_0x41ff('0x4'));var moment=require(_0x41ff('0x5'));var BPromise=require(_0x41ff('0x6'));var Mustache=require(_0x41ff('0x7'));var util=require(_0x41ff('0x8'));var path=require(_0x41ff('0x9'));var sox=require(_0x41ff('0xa'));var csv=require(_0x41ff('0xb'));var ejs=require(_0x41ff('0xc'));var fs=require('fs');var fs_extra=require(_0x41ff('0xd'));var _=require(_0x41ff('0xe'));var squel=require(_0x41ff('0xf'));var crypto=require(_0x41ff('0x10'));var jsforce=require(_0x41ff('0x11'));var deskjs=require(_0x41ff('0x12'));var toCsv=require(_0x41ff('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x41ff('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x41ff('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41ff('0x15'));var logger=require('../../config/logger')(_0x41ff('0x16'));var utils=require(_0x41ff('0x17'));var config=require(_0x41ff('0x18'));var licenseUtil=require(_0x41ff('0x19'));var db=require('../../mysqldb')['db'];config[_0x41ff('0x1a')]=_[_0x41ff('0x1b')](config[_0x41ff('0x1a')],{'host':_0x41ff('0x1c'),'port':0x18eb});var socket=require(_0x41ff('0x1d'))(new Redis(config[_0x41ff('0x1a')]));require(_0x41ff('0x1e'))[_0x41ff('0x1f')](socket);function respondWithStatusCode(_0x57e2fc,_0x309f8e){_0x309f8e=_0x309f8e||0xcc;return function(_0x18a025){if(_0x18a025){return _0x57e2fc[_0x41ff('0x20')](_0x309f8e);}return _0x57e2fc[_0x41ff('0x21')](_0x309f8e)[_0x41ff('0x22')]();};}function respondWithResult(_0x3aa551,_0x342c5b){_0x342c5b=_0x342c5b||0xc8;return function(_0x297f98){if(_0x297f98){return _0x3aa551['status'](_0x342c5b)[_0x41ff('0x23')](_0x297f98);}};}function respondWithFilteredResult(_0x29bdbc,_0x2854a3){return function(_0x6cb750){if(_0x6cb750){var _0x1cc17b=typeof _0x2854a3['offset']===_0x41ff('0x24')&&typeof _0x2854a3['limit']===_0x41ff('0x24');var _0x10ccb8=_0x6cb750[_0x41ff('0x25')];var _0x4bc720=_0x1cc17b?0x0:_0x2854a3[_0x41ff('0x26')];var _0x4f329b=_0x1cc17b?_0x6cb750[_0x41ff('0x25')]:_0x2854a3[_0x41ff('0x26')]+_0x2854a3['limit'];var _0x27740a;if(_0x4f329b>=_0x10ccb8){_0x4f329b=_0x10ccb8;_0x27740a=0xc8;}else{_0x27740a=0xce;}_0x29bdbc[_0x41ff('0x21')](_0x27740a);return _0x29bdbc[_0x41ff('0x27')](_0x41ff('0x28'),_0x4bc720+'-'+_0x4f329b+'/'+_0x10ccb8)[_0x41ff('0x23')](_0x6cb750);}return null;};}function patchUpdates(_0x2d1455){return function(_0xa11725){try{jsonpatch[_0x41ff('0x29')](_0xa11725,_0x2d1455,!![]);}catch(_0xf62ed9){return BPromise[_0x41ff('0x2a')](_0xf62ed9);}return _0xa11725[_0x41ff('0x2b')]();};}function saveUpdates(_0x326bd8,_0x4a1f07){return function(_0x40eba9){if(_0x40eba9){return _0x40eba9[_0x41ff('0x2c')](_0x326bd8)['then'](function(_0x48b7b3){return _0x48b7b3;});}return null;};}function removeEntity(_0x40954c,_0x36a5ca){return function(_0x3307d6){if(_0x3307d6){return _0x3307d6[_0x41ff('0x2d')]()['then'](function(){var _0x3ae6e4=_0x3307d6[_0x41ff('0x2e')]({'plain':!![]});var _0x16296c='CustomDashboards';return db[_0x41ff('0x2f')]['destroy']({'where':{'type':_0x16296c,'resourceId':_0x3ae6e4['id']}})[_0x41ff('0x30')](function(){return _0x3307d6;});})[_0x41ff('0x30')](function(){_0x40954c[_0x41ff('0x21')](0xcc)[_0x41ff('0x22')]();});}};}function handleEntityNotFound(_0x1befc3,_0x2c1e70){return function(_0x1f0267){if(!_0x1f0267){_0x1befc3[_0x41ff('0x20')](0x194);}return _0x1f0267;};}function handleError(_0x3a678c,_0xed2492){_0xed2492=_0xed2492||0x1f4;return function(_0xd8e883){logger['error'](_0xd8e883[_0x41ff('0x31')]);if(_0xd8e883[_0x41ff('0x32')]){delete _0xd8e883[_0x41ff('0x32')];}_0x3a678c[_0x41ff('0x21')](_0xed2492)[_0x41ff('0x33')](_0xd8e883);};}exports[_0x41ff('0x34')]=function(_0x2ad63f,_0x1421ba){var _0x3cb51e={},_0x3c6bce={},_0xd47d75={'count':0x0,'rows':[]};var _0x521f0f=_[_0x41ff('0x35')](db['Dashboard'][_0x41ff('0x36')],function(_0x10252b){return{'name':_0x10252b[_0x41ff('0x37')],'type':_0x10252b['type']['key']};});_0x3c6bce['model']=_[_0x41ff('0x35')](_0x521f0f,_0x41ff('0x32'));_0x3c6bce[_0x41ff('0x38')]=_[_0x41ff('0x39')](_0x2ad63f['query']);_0x3c6bce['filters']=_[_0x41ff('0x3a')](_0x3c6bce['model'],_0x3c6bce[_0x41ff('0x38')]);_0x3cb51e[_0x41ff('0x3b')]=_[_0x41ff('0x3a')](_0x3c6bce[_0x41ff('0x3c')],qs[_0x41ff('0x3d')](_0x2ad63f[_0x41ff('0x38')][_0x41ff('0x3d')]));_0x3cb51e['attributes']=_0x3cb51e[_0x41ff('0x3b')]['length']?_0x3cb51e[_0x41ff('0x3b')]:_0x3c6bce[_0x41ff('0x3c')];if(!_0x2ad63f[_0x41ff('0x38')][_0x41ff('0x3e')](_0x41ff('0x3f'))){_0x3cb51e[_0x41ff('0x40')]=qs['limit'](_0x2ad63f['query'][_0x41ff('0x40')]);_0x3cb51e[_0x41ff('0x26')]=qs['offset'](_0x2ad63f[_0x41ff('0x38')][_0x41ff('0x26')]);}_0x3cb51e[_0x41ff('0x41')]=qs[_0x41ff('0x42')](_0x2ad63f['query'][_0x41ff('0x42')]);_0x3cb51e['where']=qs[_0x41ff('0x43')](_[_0x41ff('0x44')](_0x2ad63f[_0x41ff('0x38')],_0x3c6bce[_0x41ff('0x43')]),_0x521f0f);if(_0x2ad63f[_0x41ff('0x38')]['filter']){_0x3cb51e[_0x41ff('0x45')]=_['merge'](_0x3cb51e[_0x41ff('0x45')],{'$or':_[_0x41ff('0x35')](_0x521f0f,function(_0x4e8335){if(_0x4e8335[_0x41ff('0x46')]!=='VIRTUAL'){var _0x4052b4={};_0x4052b4[_0x4e8335[_0x41ff('0x32')]]={'$like':'%'+_0x2ad63f[_0x41ff('0x38')][_0x41ff('0x47')]+'%'};return _0x4052b4;}})});}_0x3cb51e=_[_0x41ff('0x48')]({},_0x3cb51e,_0x2ad63f[_0x41ff('0x49')]);var _0x18e971={'where':_0x3cb51e[_0x41ff('0x45')]};return db[_0x41ff('0x4a')][_0x41ff('0x25')](_0x18e971)[_0x41ff('0x30')](function(_0x173baf){_0xd47d75[_0x41ff('0x25')]=_0x173baf;if(_0x2ad63f['query'][_0x41ff('0x4b')]){_0x3cb51e[_0x41ff('0x4c')]=[{'all':!![]}];}return db[_0x41ff('0x4a')][_0x41ff('0x4d')](_0x3cb51e);})[_0x41ff('0x30')](function(_0x3ce0b6){_0xd47d75[_0x41ff('0x4e')]=_0x3ce0b6;return _0xd47d75;})[_0x41ff('0x30')](respondWithFilteredResult(_0x1421ba,_0x3cb51e))[_0x41ff('0x4f')](handleError(_0x1421ba,null));};exports[_0x41ff('0x50')]=function(_0x4b1c35,_0x100e66){var _0x493d36={'raw':![],'where':{'id':_0x4b1c35['params']['id']}},_0x5ea425={};_0x5ea425[_0x41ff('0x3c')]=_['keys'](db[_0x41ff('0x4a')]['rawAttributes']);_0x5ea425[_0x41ff('0x38')]=_[_0x41ff('0x39')](_0x4b1c35[_0x41ff('0x38')]);_0x5ea425[_0x41ff('0x43')]=_[_0x41ff('0x3a')](_0x5ea425['model'],_0x5ea425[_0x41ff('0x38')]);_0x493d36[_0x41ff('0x3b')]=_[_0x41ff('0x3a')](_0x5ea425[_0x41ff('0x3c')],qs['fields'](_0x4b1c35[_0x41ff('0x38')][_0x41ff('0x3d')]));_0x493d36[_0x41ff('0x3b')]=_0x493d36[_0x41ff('0x3b')][_0x41ff('0x51')]?_0x493d36['attributes']:_0x5ea425[_0x41ff('0x3c')];if(_0x4b1c35[_0x41ff('0x38')][_0x41ff('0x4b')]){_0x493d36['include']=[{'all':!![]}];}_0x493d36=_[_0x41ff('0x48')]({},_0x493d36,_0x4b1c35[_0x41ff('0x49')]);return db['Dashboard']['find'](_0x493d36)[_0x41ff('0x30')](handleEntityNotFound(_0x100e66,null))[_0x41ff('0x30')](respondWithResult(_0x100e66,null))[_0x41ff('0x4f')](handleError(_0x100e66,null));};exports[_0x41ff('0x52')]=function(_0x44e8e9,_0x7bdb26){return db[_0x41ff('0x4a')][_0x41ff('0x52')](_0x44e8e9['body'],{})[_0x41ff('0x30')](function(_0xd87b75){var _0x2b14ba=_0x44e8e9[_0x41ff('0x53')]['get']({'plain':!![]});if(!_0x2b14ba)throw new Error(_0x41ff('0x54'));if(_0x2b14ba[_0x41ff('0x55')]==='user'){var _0x5209ee=_0xd87b75[_0x41ff('0x2e')]({'plain':!![]});var _0x4394b0=_0x41ff('0x56');return db[_0x41ff('0x57')][_0x41ff('0x58')]({'where':{'name':_0x4394b0,'userProfileId':_0x2b14ba['userProfileId']},'raw':!![]})[_0x41ff('0x30')](function(_0x21d579){if(_0x21d579&&_0x21d579[_0x41ff('0x59')]===0x0){return db[_0x41ff('0x2f')][_0x41ff('0x52')]({'name':_0x5209ee[_0x41ff('0x32')],'resourceId':_0x5209ee['id'],'type':_0x21d579[_0x41ff('0x32')],'sectionId':_0x21d579['id']},{})[_0x41ff('0x30')](function(){return _0xd87b75;});}else{return _0xd87b75;}})[_0x41ff('0x4f')](function(_0x32d007){logger[_0x41ff('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32d007);throw _0x32d007;});}return _0xd87b75;})[_0x41ff('0x30')](respondWithResult(_0x7bdb26,0xc9))[_0x41ff('0x4f')](handleError(_0x7bdb26,null));};exports[_0x41ff('0x5b')]=function(_0x486996,_0x309ef9){var _0x165194={'where':{'id':_0x486996[_0x41ff('0x5c')]['id']}},_0x314349={};_0x314349['model']=_['keys'](db[_0x41ff('0x4a')][_0x41ff('0x36')]);_0x165194['attributes']=_[_0x41ff('0x3a')](_0x314349[_0x41ff('0x3c')],qs['fields'](_0x486996[_0x41ff('0x38')][_0x41ff('0x3d')]));_0x165194[_0x41ff('0x3b')]=_0x165194[_0x41ff('0x3b')]['length']?_0x165194[_0x41ff('0x3b')]:_0x314349[_0x41ff('0x3c')];if(_0x486996[_0x41ff('0x38')][_0x41ff('0x4b')]){_0x165194[_0x41ff('0x4c')]=[{'all':!![]}];}_0x165194=_[_0x41ff('0x48')]({},_0x165194,_0x486996[_0x41ff('0x49')]);return db['Dashboard'][_0x41ff('0x58')](_0x165194)[_0x41ff('0x30')](handleEntityNotFound(_0x309ef9,null))[_0x41ff('0x30')](function(_0xcbd45e){if(_0xcbd45e){var _0x641e7f=_0xcbd45e[_0x41ff('0x2e')]({'plain':!![]});_0x641e7f=qs[_0x41ff('0x5d')](_0x641e7f,['id','createdAt',_0x41ff('0x5e')]);_0x486996[_0x41ff('0x5f')]=_[_0x41ff('0x5d')](_0x486996[_0x41ff('0x5f')],['id',_0x41ff('0x60'),_0x41ff('0x5e')]);return db[_0x41ff('0x4a')][_0x41ff('0x52')](_['merge'](_0x641e7f,_0x486996[_0x41ff('0x5f')]),{'include':_0x486996[_0x41ff('0x38')][_0x41ff('0x4b')]?[{'all':!![]}]:undefined})[_0x41ff('0x30')](function(_0x88ae1f){var _0x47e09f=_0x486996[_0x41ff('0x53')][_0x41ff('0x2e')]({'plain':!![]});if(!_0x47e09f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47e09f[_0x41ff('0x55')]===_0x41ff('0x53')){var _0x58bd91=_0x88ae1f[_0x41ff('0x2e')]({'plain':!![]});var _0x433658=_0x41ff('0x56');return db[_0x41ff('0x57')][_0x41ff('0x58')]({'where':{'name':_0x433658,'userProfileId':_0x47e09f[_0x41ff('0x61')]},'raw':!![]})['then'](function(_0x23a626){if(_0x23a626&&_0x23a626[_0x41ff('0x59')]===0x0){return db[_0x41ff('0x2f')]['create']({'name':_0x58bd91[_0x41ff('0x32')],'resourceId':_0x58bd91['id'],'type':_0x23a626[_0x41ff('0x32')],'sectionId':_0x23a626['id']},{})['then'](function(){return _0x88ae1f;});}else{return _0x88ae1f;}})[_0x41ff('0x4f')](function(_0x52634a){logger['error'](_0x41ff('0x62'),_0x52634a);throw _0x52634a;});}return _0x88ae1f;});}})[_0x41ff('0x30')](respondWithResult(_0x309ef9,0xc9))[_0x41ff('0x4f')](handleError(_0x309ef9,null));};exports[_0x41ff('0x2c')]=function(_0x3a544a,_0x4a29cb){if(_0x3a544a[_0x41ff('0x5f')]['id']){delete _0x3a544a[_0x41ff('0x5f')]['id'];}return db[_0x41ff('0x4a')]['find']({'where':{'id':_0x3a544a[_0x41ff('0x5c')]['id']}})[_0x41ff('0x30')](handleEntityNotFound(_0x4a29cb,null))[_0x41ff('0x30')](saveUpdates(_0x3a544a[_0x41ff('0x5f')],null))[_0x41ff('0x30')](respondWithResult(_0x4a29cb,null))[_0x41ff('0x4f')](handleError(_0x4a29cb,null));};exports[_0x41ff('0x2d')]=function(_0x3076a7,_0xeb998d){return db['Dashboard']['find']({'where':{'id':_0x3076a7[_0x41ff('0x5c')]['id']}})[_0x41ff('0x30')](handleEntityNotFound(_0xeb998d,null))[_0x41ff('0x30')](removeEntity(_0xeb998d,null))['catch'](handleError(_0xeb998d,null));};function widgetAttributes(_0x865f51){try{switch(_0x865f51[_0x41ff('0x46')]){case _0x41ff('0x63'):return[{'name':_0x41ff('0x64'),'value':_0x865f51['attrUrl']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||_0x41ff('0x67')}];case _0x41ff('0x68'):return[{'name':_0x41ff('0x69'),'value':_0x865f51[_0x41ff('0x69')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x865f51[_0x41ff('0x6a')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||'HH:mm:ss'},{'name':_0x41ff('0x6b'),'value':_0x865f51[_0x41ff('0x6b')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x1]?_0x865f51[_0x41ff('0x65')][0x1]['value']:undefined)||_0x41ff('0x6c')},{'name':'attrFontSize','value':_0x865f51[_0x41ff('0x6d')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x2]?_0x865f51['attrs'][0x2][_0x41ff('0x66')]:undefined)||0xc}];case _0x41ff('0x6e'):return[{'name':_0x41ff('0x6f'),'value':_0x865f51[_0x41ff('0x6f')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||_0x41ff('0x70')},{'name':'attrVoiceQueues','value':_0x865f51[_0x41ff('0x71')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x1]?_0x865f51[_0x41ff('0x65')][0x1][_0x41ff('0x66')]:undefined)||[]},{'name':_0x41ff('0x6d'),'value':_0x865f51[_0x41ff('0x6d')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x2]?_0x865f51[_0x41ff('0x65')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x865f51[_0x41ff('0x72')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x3]?_0x865f51[_0x41ff('0x65')][0x3][_0x41ff('0x66')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x865f51[_0x41ff('0x73')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x4]?_0x865f51[_0x41ff('0x65')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x865f51[_0x41ff('0x74')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x5]?_0x865f51[_0x41ff('0x65')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x865f51[_0x41ff('0x75')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x6]?_0x865f51[_0x41ff('0x65')][0x6][_0x41ff('0x66')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x865f51['attrOpenchannelAccounts']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x7]?_0x865f51[_0x41ff('0x65')][0x7][_0x41ff('0x66')]:undefined)||''},{'name':_0x41ff('0x76'),'value':_0x865f51['attrWhatsappAccounts']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x8]?_0x865f51[_0x41ff('0x65')][0x8][_0x41ff('0x66')]:undefined)||''},{'name':'attrChatWebsites','value':_0x865f51[_0x41ff('0x77')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x9]?_0x865f51[_0x41ff('0x65')][0x9][_0x41ff('0x66')]:undefined)||''}];case _0x41ff('0x78'):case _0x41ff('0x79'):return[{'name':_0x41ff('0x7a'),'value':_0x865f51['attrSerie1']||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||'total'},{'name':_0x41ff('0x7b'),'value':_0x865f51[_0x41ff('0x7b')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x1]?_0x865f51['attrs'][0x1][_0x41ff('0x66')]:undefined)||null},{'name':_0x41ff('0x7c'),'value':_0x865f51['attrSerie3']||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x2]?_0x865f51['attrs'][0x2][_0x41ff('0x66')]:undefined)||null},{'name':_0x41ff('0x71'),'value':_0x865f51['attrVoiceQueues']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x3]?_0x865f51['attrs'][0x3][_0x41ff('0x66')]:undefined)||[]},{'name':_0x41ff('0x72'),'value':_0x865f51[_0x41ff('0x72')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x4]?_0x865f51[_0x41ff('0x65')][0x4][_0x41ff('0x66')]:undefined)||_0x41ff('0x7d')},{'name':_0x41ff('0x73'),'value':_0x865f51[_0x41ff('0x73')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x5]?_0x865f51[_0x41ff('0x65')][0x5][_0x41ff('0x66')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x865f51['attrFaxAccounts']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x6]?_0x865f51[_0x41ff('0x65')][0x6][_0x41ff('0x66')]:undefined)||''},{'name':_0x41ff('0x75'),'value':_0x865f51[_0x41ff('0x75')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x7]?_0x865f51[_0x41ff('0x65')][0x7]['value']:undefined)||''},{'name':_0x41ff('0x7e'),'value':_0x865f51[_0x41ff('0x7e')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x8]?_0x865f51['attrs'][0x8][_0x41ff('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x865f51[_0x41ff('0x76')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x9]?_0x865f51[_0x41ff('0x65')][0x9][_0x41ff('0x66')]:undefined)||''},{'name':'attrChatWebsites','value':_0x865f51[_0x41ff('0x77')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0xa]?_0x865f51[_0x41ff('0x65')][0xa][_0x41ff('0x66')]:undefined)||''}];case _0x41ff('0x7f'):return[{'name':_0x41ff('0x80'),'type':_0x865f51['reportType']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51['attrs'][0x0]['type']:undefined)||null,'value':_0x865f51['attrReport']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x0]?_0x865f51[_0x41ff('0x65')][0x0]['value']:undefined)||null},{'name':_0x41ff('0x81'),'value':_0x865f51[_0x41ff('0x81')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x1]?_0x865f51[_0x41ff('0x65')][0x1][_0x41ff('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x504106){logger[_0x41ff('0x5a')](_0x41ff('0x82'),JSON[_0x41ff('0x83')](_0x504106));return[];}}exports[_0x41ff('0x84')]=function(_0xd226e9,_0x1e2090,_0x25d5a6){if(_0xd226e9[_0x41ff('0x5f')]['id']){delete _0xd226e9[_0x41ff('0x5f')]['id'];}return db['Dashboard'][_0x41ff('0x58')]({'where':{'id':_0xd226e9['params']['id']}})[_0x41ff('0x30')](handleEntityNotFound(_0x1e2090,null))[_0x41ff('0x30')](function(_0x22fa61){if(_0x22fa61){_0xd226e9[_0x41ff('0x5f')][_0x41ff('0x85')]=_0x22fa61['id'];_0xd226e9[_0x41ff('0x5f')][_0x41ff('0x65')]=widgetAttributes(_0xd226e9[_0x41ff('0x5f')]);return db['DashboardItem'][_0x41ff('0x52')](_0xd226e9[_0x41ff('0x5f')]);}})[_0x41ff('0x30')](respondWithResult(_0x1e2090,null))[_0x41ff('0x4f')](handleError(_0x1e2090,null));};exports[_0x41ff('0x86')]=function(_0x379c97,_0xc2e4a8,_0x2fba78){var _0x1a09df={};var _0x16275b={};var _0x16e4e0;var _0x2a9f83;return db[_0x41ff('0x4a')][_0x41ff('0x87')]({'where':{'id':_0x379c97[_0x41ff('0x5c')]['id']}})['then'](handleEntityNotFound(_0xc2e4a8,null))['then'](function(_0x9d657d){if(_0x9d657d){_0x16e4e0=_0x9d657d;_0x16275b[_0x41ff('0x3c')]=_[_0x41ff('0x39')](db['DashboardItem']['rawAttributes']);_0x16275b[_0x41ff('0x38')]=_['keys'](_0x379c97['query']);_0x16275b[_0x41ff('0x43')]=_[_0x41ff('0x3a')](_0x16275b[_0x41ff('0x3c')],_0x16275b[_0x41ff('0x38')]);_0x1a09df[_0x41ff('0x3b')]=_[_0x41ff('0x3a')](_0x16275b['model'],qs[_0x41ff('0x3d')](_0x379c97[_0x41ff('0x38')][_0x41ff('0x3d')]));_0x1a09df[_0x41ff('0x3b')]=_0x1a09df[_0x41ff('0x3b')][_0x41ff('0x51')]?_0x1a09df['attributes']:_0x16275b[_0x41ff('0x3c')];_0x1a09df['order']=qs[_0x41ff('0x42')](_0x379c97[_0x41ff('0x38')]['sort']);_0x1a09df[_0x41ff('0x45')]=qs[_0x41ff('0x43')](_[_0x41ff('0x44')](_0x379c97[_0x41ff('0x38')],_0x16275b['filters']));if(_0x379c97['query'][_0x41ff('0x47')]){_0x1a09df[_0x41ff('0x45')]=_[_0x41ff('0x48')](_0x1a09df[_0x41ff('0x45')],{'$or':_[_0x41ff('0x35')](_0x1a09df['attributes'],function(_0x5576d9){var _0x89966f={};_0x89966f[_0x5576d9]={'$like':'%'+_0x379c97[_0x41ff('0x38')]['filter']+'%'};return _0x89966f;})});}_0x1a09df=_['merge']({},_0x1a09df,_0x379c97[_0x41ff('0x49')]);return _0x16e4e0[_0x41ff('0x86')](_0x1a09df);}})[_0x41ff('0x30')](function(_0x4e62c2){if(_0x4e62c2){_0x2a9f83=_0x4e62c2[_0x41ff('0x51')];if(!_0x379c97[_0x41ff('0x38')][_0x41ff('0x3e')]('nolimit')){_0x1a09df[_0x41ff('0x40')]=qs[_0x41ff('0x40')](_0x379c97[_0x41ff('0x38')][_0x41ff('0x40')]);_0x1a09df[_0x41ff('0x26')]=qs[_0x41ff('0x26')](_0x379c97[_0x41ff('0x38')][_0x41ff('0x26')]);}return _0x16e4e0[_0x41ff('0x86')](_0x1a09df);}})['then'](function(_0x3fcf78){if(_0x3fcf78){return _0x3fcf78?{'count':_0x2a9f83,'rows':_0x3fcf78}:null;}})['then'](respondWithResult(_0xc2e4a8,null))[_0x41ff('0x4f')](handleError(_0xc2e4a8,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