Built motion from commit e6806ed6.|2.6.0
[motion2.git] / server / api / userProfile / userProfile.controller.js
index 1e5e10a..21fe9db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x903b=['model','map','query','filters','intersection','fields','attributes','length','limit','order','sort','where','filter','merge','VIRTUAL','options','UserProfile','includeAll','rows','catch','show','params','keys','include','find','create','body','clone','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','findAll','sectionId','userProfileId','update','describe','addSections','sequelize','UserProfileResource','Resources','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','hasOwnProperty','type','field','AnalyticExtractedReport','foreignKey','associatedResources','default','reportId','custom','CustomReports','CmContact','Tag','Tags','tag','ThroughTags','value','toLowerCase','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueue','QueueCampaigns','queue','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','WhatsappAccount','Team','voicequeues','VoiceQueues','users','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','Interval','Pause','scheduler','sounds','Sound','triggers','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','end','status','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','rawAttributes','fieldName','key'];(function(_0x3bb9da,_0x502962){var _0x17eef7=function(_0x94c254){while(--_0x94c254){_0x3bb9da['push'](_0x3bb9da['shift']());}};_0x17eef7(++_0x502962);}(_0x903b,0x19d));var _0xb903=function(_0x4f966a,_0x22d73b){_0x4f966a=_0x4f966a-0x0;var _0x31993d=_0x903b[_0x4f966a];return _0x31993d;};'use strict';var pdf=require(_0xb903('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb903('0x1'));var jsonpatch=require(_0xb903('0x2'));var rp=require(_0xb903('0x3'));var moment=require('moment');var BPromise=require(_0xb903('0x4'));var Mustache=require(_0xb903('0x5'));var util=require('util');var path=require(_0xb903('0x6'));var sox=require(_0xb903('0x7'));var csv=require(_0xb903('0x8'));var ejs=require(_0xb903('0x9'));var fs=require('fs');var _=require(_0xb903('0xa'));var squel=require(_0xb903('0xb'));var crypto=require(_0xb903('0xc'));var jsforce=require(_0xb903('0xd'));var deskjs=require(_0xb903('0xe'));var toCsv=require(_0xb903('0x8'));var querystring=require(_0xb903('0xf'));var Papa=require('papaparse');var Redis=require(_0xb903('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb903('0x11'));var as=require(_0xb903('0x12'));var hardwareService=require(_0xb903('0x13'));var logger=require(_0xb903('0x14'))(_0xb903('0x15'));var utils=require(_0xb903('0x16'));var config=require(_0xb903('0x17'));var licenseUtil=require(_0xb903('0x18'));var db=require(_0xb903('0x19'))['db'];config[_0xb903('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb903('0x1b'))(new Redis(config[_0xb903('0x1a')]));require(_0xb903('0x1c'))['register'](socket);function respondWithStatusCode(_0x51c260,_0x44129b){_0x44129b=_0x44129b||0xcc;return function(_0x1ae72d){if(_0x1ae72d){return _0x51c260['sendStatus'](_0x44129b);}return _0x51c260['status'](_0x44129b)[_0xb903('0x1d')]();};}function respondWithResult(_0x3c4666,_0x46d0e1){_0x46d0e1=_0x46d0e1||0xc8;return function(_0x16c505){if(_0x16c505){return _0x3c4666[_0xb903('0x1e')](_0x46d0e1)['json'](_0x16c505);}};}function respondWithFilteredResult(_0x47db7,_0x1a3ead){return function(_0x35620d){if(_0x35620d){var _0x1f6f13=_0x35620d[_0xb903('0x1f')],_0xf065f8=_0x1a3ead[_0xb903('0x20')],_0x331471=_0x1a3ead[_0xb903('0x20')]+_0x1a3ead['limit'],_0x407660;if(_0x331471>=_0x1f6f13){_0x331471=_0x1f6f13;_0x407660=0xc8;}else{_0x407660=0xce;}_0x47db7[_0xb903('0x1e')](_0x407660);return _0x47db7[_0xb903('0x21')](_0xb903('0x22'),_0xf065f8+'-'+_0x331471+'/'+_0x1f6f13)[_0xb903('0x23')](_0x35620d);}return null;};}function patchUpdates(_0x43b0c8){return function(_0x5878dd){try{jsonpatch[_0xb903('0x24')](_0x5878dd,_0x43b0c8,!![]);}catch(_0x447b71){return BPromise[_0xb903('0x25')](_0x447b71);}return _0x5878dd[_0xb903('0x26')]();};}function saveUpdates(_0x457cbf,_0x24f812){return function(_0x2495d9){if(_0x2495d9){return _0x2495d9['update'](_0x457cbf)[_0xb903('0x27')](function(_0x412110){return _0x412110;});}return null;};}function removeEntity(_0x1da009,_0x102f9d){return function(_0x1ced64){if(_0x1ced64){return _0x1ced64[_0xb903('0x28')]()[_0xb903('0x27')](function(){_0x1da009[_0xb903('0x1e')](0xcc)[_0xb903('0x1d')]();});}};}function handleEntityNotFound(_0x390ec3,_0x51a723){return function(_0xe180b7){if(!_0xe180b7){_0x390ec3[_0xb903('0x29')](0x194);}return _0xe180b7;};}function handleError(_0x44832f,_0xc138c3){_0xc138c3=_0xc138c3||0x1f4;return function(_0x383ca2){logger[_0xb903('0x2a')](_0x383ca2[_0xb903('0x2b')]);if(_0x383ca2[_0xb903('0x2c')]){delete _0x383ca2[_0xb903('0x2c')];}_0x44832f[_0xb903('0x1e')](_0xc138c3)['send'](_0x383ca2);};}exports[_0xb903('0x2d')]=function(_0x1ea7c5,_0x49a83b){var _0x50e384={},_0x4ef46c={},_0x420e03={'count':0x0,'rows':[]};var _0x71fd1e=_['map'](db['UserProfile'][_0xb903('0x2e')],function(_0xac22cd){return{'name':_0xac22cd[_0xb903('0x2f')],'type':_0xac22cd['type'][_0xb903('0x30')]};});_0x4ef46c[_0xb903('0x31')]=_[_0xb903('0x32')](_0x71fd1e,_0xb903('0x2c'));_0x4ef46c[_0xb903('0x33')]=_['keys'](_0x1ea7c5['query']);_0x4ef46c[_0xb903('0x34')]=_[_0xb903('0x35')](_0x4ef46c[_0xb903('0x31')],_0x4ef46c['query']);_0x50e384['attributes']=_[_0xb903('0x35')](_0x4ef46c[_0xb903('0x31')],qs[_0xb903('0x36')](_0x1ea7c5[_0xb903('0x33')][_0xb903('0x36')]));_0x50e384[_0xb903('0x37')]=_0x50e384[_0xb903('0x37')][_0xb903('0x38')]?_0x50e384[_0xb903('0x37')]:_0x4ef46c['model'];if(!_0x1ea7c5[_0xb903('0x33')]['hasOwnProperty']('nolimit')){_0x50e384[_0xb903('0x39')]=qs[_0xb903('0x39')](_0x1ea7c5[_0xb903('0x33')][_0xb903('0x39')]);_0x50e384['offset']=qs['offset'](_0x1ea7c5[_0xb903('0x33')]['offset']);}_0x50e384[_0xb903('0x3a')]=qs['sort'](_0x1ea7c5['query'][_0xb903('0x3b')]);_0x50e384[_0xb903('0x3c')]=qs[_0xb903('0x34')](_['pick'](_0x1ea7c5[_0xb903('0x33')],_0x4ef46c[_0xb903('0x34')]),_0x71fd1e);if(_0x1ea7c5[_0xb903('0x33')][_0xb903('0x3d')]){_0x50e384[_0xb903('0x3c')]=_[_0xb903('0x3e')](_0x50e384[_0xb903('0x3c')],{'$or':_[_0xb903('0x32')](_0x71fd1e,function(_0x4c3232){if(_0x4c3232['type']!==_0xb903('0x3f')){var _0x369cb7={};_0x369cb7[_0x4c3232['name']]={'$like':'%'+_0x1ea7c5[_0xb903('0x33')][_0xb903('0x3d')]+'%'};return _0x369cb7;}})});}_0x50e384=_[_0xb903('0x3e')]({},_0x50e384,_0x1ea7c5[_0xb903('0x40')]);var _0x29f3cf={'where':_0x50e384[_0xb903('0x3c')]};return db[_0xb903('0x41')][_0xb903('0x1f')](_0x29f3cf)['then'](function(_0x27bebf){_0x420e03[_0xb903('0x1f')]=_0x27bebf;if(_0x1ea7c5[_0xb903('0x33')][_0xb903('0x42')]){_0x50e384['include']=[{'all':!![]}];}return db[_0xb903('0x41')]['findAll'](_0x50e384);})[_0xb903('0x27')](function(_0xed3a95){_0x420e03[_0xb903('0x43')]=_0xed3a95;return _0x420e03;})[_0xb903('0x27')](respondWithFilteredResult(_0x49a83b,_0x50e384))[_0xb903('0x44')](handleError(_0x49a83b,null));};exports[_0xb903('0x45')]=function(_0x413a71,_0x82c81d){var _0x146b52={'raw':![],'where':{'id':_0x413a71[_0xb903('0x46')]['id']}},_0x2789e6={};_0x2789e6[_0xb903('0x31')]=_[_0xb903('0x47')](db['UserProfile'][_0xb903('0x2e')]);_0x2789e6[_0xb903('0x33')]=_[_0xb903('0x47')](_0x413a71[_0xb903('0x33')]);_0x2789e6[_0xb903('0x34')]=_[_0xb903('0x35')](_0x2789e6[_0xb903('0x31')],_0x2789e6[_0xb903('0x33')]);_0x146b52[_0xb903('0x37')]=_[_0xb903('0x35')](_0x2789e6[_0xb903('0x31')],qs[_0xb903('0x36')](_0x413a71['query'][_0xb903('0x36')]));_0x146b52[_0xb903('0x37')]=_0x146b52[_0xb903('0x37')][_0xb903('0x38')]?_0x146b52['attributes']:_0x2789e6[_0xb903('0x31')];if(_0x413a71['query'][_0xb903('0x42')]){_0x146b52[_0xb903('0x48')]=[{'all':!![]}];}_0x146b52=_['merge']({},_0x146b52,_0x413a71['options']);return db['UserProfile'][_0xb903('0x49')](_0x146b52)[_0xb903('0x27')](handleEntityNotFound(_0x82c81d,null))['then'](respondWithResult(_0x82c81d,null))[_0xb903('0x44')](handleError(_0x82c81d,null));};exports['create']=function(_0x5f0d29,_0x3ce02c){return db[_0xb903('0x41')][_0xb903('0x4a')](_0x5f0d29[_0xb903('0x4b')],{})['then'](respondWithResult(_0x3ce02c,0xc9))[_0xb903('0x44')](handleError(_0x3ce02c,null));};exports[_0xb903('0x4c')]=function(_0x5a2e00,_0x2b52ba){var _0x191245={'where':{'id':_0x5a2e00[_0xb903('0x46')]['id']}},_0x52ab03={};_0x52ab03[_0xb903('0x31')]=_[_0xb903('0x47')](db['UserProfile'][_0xb903('0x2e')]);_0x191245[_0xb903('0x37')]=_[_0xb903('0x35')](_0x52ab03['model'],qs[_0xb903('0x36')](_0x5a2e00['query']['fields']));_0x191245[_0xb903('0x37')]=_0x191245[_0xb903('0x37')][_0xb903('0x38')]?_0x191245[_0xb903('0x37')]:_0x52ab03[_0xb903('0x31')];if(_0x5a2e00[_0xb903('0x33')][_0xb903('0x42')]){_0x191245[_0xb903('0x48')]=[{'all':!![]}];}_0x191245=_[_0xb903('0x3e')]({},_0x191245,_0x5a2e00[_0xb903('0x40')]);return db['UserProfile'][_0xb903('0x49')](_0x191245)[_0xb903('0x27')](handleEntityNotFound(_0x2b52ba,null))['then'](function(_0xb6b973){if(_0xb6b973){var _0x525de2=_0xb6b973[_0xb903('0x4d')]({'plain':!![]});_0x525de2=qs[_0xb903('0x4e')](_0x525de2,['id','createdAt',_0xb903('0x4f'),_0xb903('0x50')]);_0x5a2e00[_0xb903('0x4b')]=_['omit'](_0x5a2e00[_0xb903('0x4b')],['id',_0xb903('0x51'),_0xb903('0x4f')]);return db['sequelize'][_0xb903('0x52')](function(_0x370d9f){return db[_0xb903('0x41')][_0xb903('0x4a')](_[_0xb903('0x3e')](_0x525de2,_0x5a2e00[_0xb903('0x4b')]),{'include':_0x5a2e00[_0xb903('0x33')][_0xb903('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x370d9f})[_0xb903('0x27')](function(_0x22b4b0){var _0x5d077a=_0x22b4b0[_0xb903('0x4d')]({'plain':!![]});return db[_0xb903('0x53')]['findAll']({'where':{'userProfileId':_0x5a2e00['params']['id']},'raw':!![]})[_0xb903('0x27')](function(_0x13e58e){if(_0x13e58e){return BPromise[_0xb903('0x54')](_0x13e58e,function(_0x2976df){return new BPromise(function(_0xbf3fd1,_0x17f8b5){if(_0x2976df[_0xb903('0x55')]===null||_0x2976df['autoAssociation']===0x1)_0xbf3fd1(null);return db['UserProfileResource'][_0xb903('0x56')]({'where':{'sectionId':_0x2976df['id']},'raw':!![]})[_0xb903('0x27')](function(_0x3ff8b0){var _0x5a2de6=_['map'](_0x3ff8b0,function(_0x41d109){return qs[_0xb903('0x4e')](_0x41d109,['id',_0xb903('0x51'),'updatedAt',_0xb903('0x57')]);});_0xbf3fd1(_0x5a2de6);})['catch'](function(_0x5deccd){_0x17f8b5(_0x5deccd);});})['then'](function(_0x463b62){var _0x51ba76=qs[_0xb903('0x4e')](_0x2976df,['id','createdAt','updatedAt']);_0x51ba76[_0xb903('0x58')]=_0x5d077a['id'];if(_0x463b62)_0x51ba76['Resources']=_0x463b62;return _0x51ba76;})[_0xb903('0x27')](function(_0x1eba62){return db[_0xb903('0x53')][_0xb903('0x4a')](_0x1eba62,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x370d9f});});})['then'](function(){return _0x5d077a;});}});});});}})[_0xb903('0x27')](respondWithResult(_0x2b52ba,0xc9))[_0xb903('0x44')](handleError(_0x2b52ba,null));};exports[_0xb903('0x59')]=function(_0x5d863e,_0x1ebb7a){if(_0x5d863e[_0xb903('0x4b')]['id']){delete _0x5d863e['body']['id'];}return db[_0xb903('0x41')][_0xb903('0x49')]({'where':{'id':_0x5d863e[_0xb903('0x46')]['id']}})[_0xb903('0x27')](handleEntityNotFound(_0x1ebb7a,null))[_0xb903('0x27')](saveUpdates(_0x5d863e['body'],null))['then'](respondWithResult(_0x1ebb7a,null))[_0xb903('0x44')](handleError(_0x1ebb7a,null));};exports[_0xb903('0x28')]=function(_0x5da914,_0x518e77){return db[_0xb903('0x41')][_0xb903('0x49')]({'where':{'id':_0x5da914[_0xb903('0x46')]['id']}})['then'](handleEntityNotFound(_0x518e77,null))[_0xb903('0x27')](removeEntity(_0x518e77,null))[_0xb903('0x44')](handleError(_0x518e77,null));};exports[_0xb903('0x5a')]=function(_0x39eea5,_0x27ac0f){return db[_0xb903('0x41')][_0xb903('0x5a')]()['then'](respondWithResult(_0x27ac0f,null))['catch'](handleError(_0x27ac0f,null));};exports[_0xb903('0x5b')]=function(_0x24b30d,_0xa8ff01){var _0x1adbd6=_0x24b30d[_0xb903('0x4b')];return db[_0xb903('0x41')][_0xb903('0x49')]({'where':{'id':_0x24b30d['params']['id']}})['then'](handleEntityNotFound(_0xa8ff01,null))['then'](function(_0x12b2b3){if(_0x12b2b3){return db[_0xb903('0x5c')][_0xb903('0x52')](function(_0x1061a7){return db[_0xb903('0x53')]['destroy']({'where':{'userProfileId':_0x24b30d['params']['id'],'sectionId':_[_0xb903('0x32')](_0x1adbd6,function(_0x554dca){return _0x554dca[_0xb903('0x57')];})},'transaction':_0x1061a7})['then'](function(){var _0x42f002=_[_0xb903('0x32')](_0x1adbd6,function(_0x56e1ca){_0x56e1ca[_0xb903('0x58')]=_0x24b30d['params']['id'];return _0x56e1ca;});var _0x58f68b=[];return BPromise['each'](_0x42f002,function(_0x31ff86){return db[_0xb903('0x53')][_0xb903('0x4a')](_0x31ff86,{'include':[{'model':db[_0xb903('0x5d')],'as':_0xb903('0x5e')}],'raw':!![],'transaction':_0x1061a7})[_0xb903('0x27')](function(_0x58285d){_0x58f68b['push'](_0x58285d[_0xb903('0x4d')]({'plain':!![]}));});})[_0xb903('0x27')](function(){return _0x58f68b;});});});}})[_0xb903('0x27')](function(_0x14dfd9){return _0x14dfd9;})[_0xb903('0x27')](respondWithResult(_0xa8ff01,null))['catch'](handleError(_0xa8ff01,null));};exports[_0xb903('0x5f')]=function(_0x1cf03f,_0x81413a){var _0x2d00cd;return db[_0xb903('0x41')]['find']({'where':{'id':_0x1cf03f[_0xb903('0x46')]['id']},'attributes':['id',_0xb903('0x2c')]})[_0xb903('0x27')](handleEntityNotFound(_0x81413a,null))[_0xb903('0x27')](function(_0x578d0c){if(_0x578d0c){_0x2d00cd=_0x578d0c;return db[_0xb903('0x53')]['destroy']({'where':{'userProfileId':_0x1cf03f[_0xb903('0x46')]['id'],'sectionId':_0x1cf03f[_0xb903('0x33')][_0xb903('0x60')]}});}})[_0xb903('0x27')](function(){return _0x2d00cd;})[_0xb903('0x27')](respondWithStatusCode(_0x81413a,null))[_0xb903('0x44')](handleError(_0x81413a,null));};exports[_0xb903('0x61')]=function(_0x7a21e3,_0x324945){var _0x2911b9=[];var _0x44974e=[];return db[_0xb903('0x53')][_0xb903('0x56')]({'where':{'userProfileId':_0x7a21e3[_0xb903('0x46')]['id']},'raw':!![]})['then'](function(_0x18e2d6){_0x2911b9=_['filter'](_0x18e2d6,function(_0x605016){return _0x605016[_0xb903('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x605016[_0xb903('0x57')]);});if(!_[_0xb903('0x63')](_0x2911b9)){return _['map'](_0x2911b9,function(_0x3cae79){return _0x3cae79[_0xb903('0x57')];});}else{return;}})[_0xb903('0x27')](function(_0x110d0a){if(_0x110d0a)_0x44974e=_0x110d0a;if(_[_0xb903('0x64')](_0x44974e,0x64)){var _0x2c4276=_[_0xb903('0x49')](_0x2911b9,{'sectionId':0x64});return hasDefaultDashboard(_0x2c4276)['then'](function(_0x1b3e52){return _[_0xb903('0x32')](_0x2911b9,function(_0x49aa0b){if(_0x49aa0b[_0xb903('0x57')]===0x64){_0x49aa0b['subsections']=_0x1b3e52;}return _0x49aa0b;});});}else{return;}})[_0xb903('0x27')](function(_0x5bab41){if(_0x5bab41)_0x2911b9=_0x5bab41;if(_[_0xb903('0x64')](_0x44974e,0x3eb)){var _0x595694=_[_0xb903('0x49')](_0x2911b9,{'sectionId':0x3eb});return getCustomDashboards(_0x595694)[_0xb903('0x27')](function(_0x516da1){return _[_0xb903('0x32')](_0x2911b9,function(_0x143356){if(_0x595694[_0xb903('0x62')]){if(_0x143356[_0xb903('0x57')]===0x3eb){_0x143356[_0xb903('0x65')]=_0x516da1;}}else{if(_0x143356[_0xb903('0x57')]===0x64){_0x143356[_0xb903('0x65')]=_0x516da1;}}return _0x143356;});});}else{return;}})['then'](function(_0xe7653){if(_0xe7653)_0x2911b9=_0xe7653;if(_[_0xb903('0x64')](_0x44974e,0x709)){var _0x3fa319=_[_0xb903('0x49')](_0x2911b9,{'sectionId':0x709});return getPlugins(_0x3fa319)[_0xb903('0x27')](function(_0x4bfd52){if(_0x3fa319[_0xb903('0x62')]){return _['map'](_0x2911b9,function(_0x246042){if(_0x246042['sectionId']===0x709){_0x246042[_0xb903('0x65')]=_0x4bfd52;}return _0x246042;});}else{var _0x2bea5e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4bfd52};var _0x4f01c3=_['map'](_0x2911b9);_0x4f01c3[_0xb903('0x66')](_0x2bea5e);return _0x4f01c3;}});}else{return;}})['then'](function(_0x5c0866){if(_0x5c0866)_0x2911b9=_0x5c0866;return _[_0xb903('0x3d')](_0x2911b9,[_0xb903('0x62'),0x1]);})[_0xb903('0x27')](respondWithResult(_0x324945,null))[_0xb903('0x44')](handleError(_0x324945,null));};function hasDefaultDashboard(_0x3ea500){var _0x575931=[0x65];return new BPromise(function(_0x3ac47a,_0x43a062){try{if(_0x3ea500[_0xb903('0x55')]){_0x3ac47a(_0x575931);}else{return db[_0xb903('0x5d')][_0xb903('0x67')]({'where':{'sectionId':_0x3ea500['id']},'raw':!![]})[_0xb903('0x27')](function(_0x3dcda3){_0x3dcda3?_0x3ac47a(_0x575931):_0x3ac47a();});}}catch(_0x2ad614){_0x43a062(_0x2ad614);}});}function getCustomDashboards(_0x5ac87a){var _0x4f86a8=[];return new BPromise(function(_0x2ca068,_0x1e5553){try{if(_0x5ac87a[_0xb903('0x55')]){return db[_0xb903('0x68')][_0xb903('0x56')]({'raw':!![]})['then'](function(_0x54499a){_0x54499a[_0xb903('0x69')](function(_0x4415c6){_0x4f86a8[_0xb903('0x66')](_0x4415c6['id']+0x1869f);});_0x2ca068(_0x4f86a8);});}else{return db[_0xb903('0x5d')][_0xb903('0x56')]({'where':{'sectionId':_0x5ac87a['id']},'raw':!![]})[_0xb903('0x27')](function(_0x41c2c1){_0x41c2c1[_0xb903('0x69')](function(_0x4c1f0e){_0x4f86a8[_0xb903('0x66')](_0x4c1f0e[_0xb903('0x6a')]+0x1869f);});_0x2ca068(_0x4f86a8);});}}catch(_0x157bd5){_0x1e5553(_0x157bd5);}});}function getPlugins(_0x3a9368){var _0x22c9ef=[];return new BPromise(function(_0x14984f,_0xcdca58){try{if(_0x3a9368[_0xb903('0x55')]){return db[_0xb903('0x6b')][_0xb903('0x56')]({'raw':!![]})[_0xb903('0x27')](function(_0x4b8468){_0x4b8468['forEach'](function(_0x3a33c2){_0x22c9ef[_0xb903('0x66')](_0x3a33c2['id']+0x15b38);});_0x14984f(_0x22c9ef);});}else{return db[_0xb903('0x5d')]['findAll']({'where':{'sectionId':_0x3a9368['id']},'raw':!![]})['then'](function(_0x46dc54){_0x46dc54[_0xb903('0x69')](function(_0x4c72c1){_0x22c9ef[_0xb903('0x66')](_0x4c72c1[_0xb903('0x6a')]+0x15b38);});_0x14984f(_0x22c9ef);});}}catch(_0xf00b65){_0xcdca58(_0xf00b65);}});}exports[_0xb903('0x6c')]=function(_0x4d56bf,_0x560d5a){return db[_0xb903('0x41')]['find']({'where':{'id':_0x4d56bf['params']['id']}})[_0xb903('0x27')](handleEntityNotFound(_0x560d5a,null))[_0xb903('0x27')](function(_0x485a1a){if(_0x485a1a){return db[_0xb903('0x5c')][_0xb903('0x52')](function(_0x278d8d){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4d56bf[_0xb903('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xb903('0x27')](function(_0x3afe3d){if(_0x3afe3d){return db['UserProfileSection'][_0xb903('0x28')]({'where':{'userProfileId':_0x4d56bf['params']['id'],'id':_['map'](_0x3afe3d,function(_0x2f67d7){return _0x2f67d7['id'];})},'transaction':_0x278d8d});}})[_0xb903('0x27')](function(_0x34683f){var _0x34b1d4=_['map'](_0x4d56bf['body'],function(_0x4155e3){_0x4155e3[_0xb903('0x58')]=_0x4d56bf['params']['id'];return _0x4155e3;});return db[_0xb903('0x53')][_0xb903('0x6d')](_0x34b1d4,{'raw':!![],'transaction':_0x278d8d});})[_0xb903('0x27')](function(_0x4038c5){var _0x18c225=_[_0xb903('0x3d')](_[_0xb903('0x32')](_0x4038c5,function(_0xed83c8){return _0xed83c8[_0xb903('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x18c225){return db[_0xb903('0x53')][_0xb903('0x56')]({'where':{'userProfileId':_0x4d56bf[_0xb903('0x46')]['id'],'sectionId':_[_0xb903('0x32')](_0x18c225,function(_0xe23da2){return _0xe23da2['sectionId'];})},'attributes':['id',_0xb903('0x57')],'raw':!![]})[_0xb903('0x27')](function(_0x421cfc){var _0x25208e=_[_0xb903('0x32')](_0x4d56bf[_0xb903('0x4b')],function(_0x1e8528){_0x1e8528[_0xb903('0x58')]=_0x4d56bf['params']['id'];return _0x1e8528;});return db[_0xb903('0x5d')][_0xb903('0x6d')](_0x25208e,{'raw':!![],'transaction':_0x278d8d});});}})[_0xb903('0x44')](handleError(_0x560d5a,null));});}})[_0xb903('0x27')](function(_0xc2d2bf){var _0x28176f=_[_0xb903('0x32')](_0xc2d2bf,function(_0x203da2){return _0x203da2['get']({'plain':!![]});});})['then'](respondWithResult(_0x560d5a,null))[_0xb903('0x44')](handleError(_0x560d5a,null));};exports[_0xb903('0x6e')]=function(_0x35801c,_0x24fea5,_0x3470e3){return db['UserProfile'][_0xb903('0x49')]({'where':{'id':_0x35801c[_0xb903('0x46')]['id']}})[_0xb903('0x27')](handleEntityNotFound(_0x24fea5,null))[_0xb903('0x27')](function(_0x30011d){if(_0x30011d){return _0x30011d[_0xb903('0x6e')](_0x35801c['query'][_0xb903('0x60')]);}})[_0xb903('0x27')](respondWithStatusCode(_0x24fea5,null))['catch'](handleError(_0x24fea5,null));};exports['getResources']=function(_0x4664f7,_0x4845f5){var _0x326bc3={'raw':![],'where':{}};var _0x451a01={};var _0x4644cd={'count':0x0,'rows':[]};var _0x44cc4d=_0x4664f7[_0xb903('0x33')][_0xb903('0x6f')];if(typeof _0x44cc4d===_0xb903('0x70')){throw new db[(_0xb903('0x71'))][(_0xb903('0x72'))](_0xb903('0x73'));}var _0x490e16=_0x4664f7[_0xb903('0x33')][_0xb903('0x74')]||![];var _0x50c45b=getQueryModels(_0x44cc4d,_0x490e16);if(typeof _0x50c45b[_0xb903('0x75')]===_0xb903('0x70')){throw new db[(_0xb903('0x71'))][(_0xb903('0x72'))](_0xb903('0x76')+_0x44cc4d+'\x27');}var _0x2a7b75=[];if(!_['isEmpty'](_0x50c45b[_0xb903('0x77')])){_0x2a7b75=_0x50c45b[_0xb903('0x77')];}else{_0x2a7b75=[{'name':_0x44cc4d}];}return db['UserProfile'][_0xb903('0x67')]({'where':{'id':_0x4664f7[_0xb903('0x46')]['id']}})['then'](handleEntityNotFound(_0x4845f5,null))[_0xb903('0x27')](function(_0x3e5b11){if(_0x3e5b11){var _0x4da2a5=[];for(var _0x3a8651=0x0;_0x3a8651<_0x2a7b75['length'];_0x3a8651++){_0x4da2a5[_0xb903('0x66')](db[_0xb903('0x53')][_0xb903('0x67')]({'where':{'userProfileId':_0x3e5b11['id'],'name':_0x2a7b75[_0x3a8651][_0xb903('0x2c')]},'raw':!![]}));}return BPromise[_0xb903('0x78')](_0x4da2a5);}})[_0xb903('0x27')](function(_0x37fb73){var _0x4b964c=_[_0xb903('0x3d')](_0x37fb73,function(_0x4b3adc){return _0x4b3adc?_0x4b3adc:undefined;});var _0x413ec8=_['filter'](_0x2a7b75,[_0xb903('0x79'),!![]]);var _0x6554c0=_['isEmpty'](_0x4b964c)&&_['isEmpty'](_0x413ec8)?null:_[_0xb903('0x7a')](_0x413ec8,_0x4b964c);if(_0x6554c0){var _0x2f0de3=[];for(var _0x2143dc=0x0;_0x2143dc<_0x6554c0['length'];_0x2143dc++){var _0x5eeb00=_[_0xb903('0x49')](_0x2a7b75,function(_0x5c1b54){return _0x6554c0[_0x2143dc]?_0x5c1b54[_0xb903('0x2c')]===_0x6554c0[_0x2143dc][_0xb903('0x2c')]:null;});if(_0x5eeb00){if(_0x6554c0[_0x2143dc][_0xb903('0x79')]){_0x2f0de3[_0xb903('0x66')](getAllResources(_0x50c45b[_0xb903('0x75')],_0x6554c0[_0x2143dc]));}else{if(!_0x6554c0[_0x2143dc][_0xb903('0x55')]){_0x2f0de3[_0xb903('0x66')](getAllowedResources(_0x5eeb00,_0x6554c0[_0x2143dc],_0x50c45b[_0xb903('0x75')]));}else{if(_0x5eeb00[_0xb903('0x31')]){_0x2f0de3[_0xb903('0x66')](getAllFilteredResources(_0x5eeb00,_0x6554c0[_0x2143dc]));}}}}}return BPromise[_0xb903('0x78')](_0x2f0de3);}else{return null;}})[_0xb903('0x27')](function(_0x3637d6){var _0x1aac64=_0x3637d6;var _0x4b2c70=null;if(_0x1aac64){_0x4b2c70=_0x1aac64[_0xb903('0x38')]===0x1?_0x1aac64[0x0]:null;}if(_0x4b2c70||_0x1aac64){var _0x1afba5=db[_0x50c45b[_0xb903('0x75')]][_0xb903('0x2e')];_0x451a01['model']=_[_0xb903('0x47')](_0x1afba5);_0x451a01[_0xb903('0x33')]=_[_0xb903('0x47')](_0x4664f7[_0xb903('0x33')]);_0x451a01['filters']=_[_0xb903('0x35')](_0x451a01[_0xb903('0x31')],_0x451a01[_0xb903('0x33')]);_0x326bc3[_0xb903('0x37')]=_['intersection'](_0x451a01[_0xb903('0x31')],qs[_0xb903('0x36')](_0x4664f7[_0xb903('0x33')]['fields']));_0x326bc3['attributes']=_0x326bc3[_0xb903('0x37')]['length']?_0x326bc3[_0xb903('0x37')]:_0x451a01['model'];if(!_0x4664f7['query'][_0xb903('0x7b')]('nolimit')){_0x326bc3[_0xb903('0x39')]=qs['limit'](_0x4664f7[_0xb903('0x33')][_0xb903('0x39')]);_0x326bc3['offset']=qs[_0xb903('0x20')](_0x4664f7[_0xb903('0x33')][_0xb903('0x20')]);}_0x326bc3[_0xb903('0x3a')]=qs['sort'](_0x4664f7[_0xb903('0x33')][_0xb903('0x3b')]);_0x326bc3[_0xb903('0x3c')]=qs[_0xb903('0x34')](_['pick'](_0x4664f7[_0xb903('0x33')],_0x451a01[_0xb903('0x34')]));if(_0x4664f7[_0xb903('0x33')][_0xb903('0x3d')]){_0x326bc3[_0xb903('0x3c')]=_[_0xb903('0x3e')](_0x326bc3[_0xb903('0x3c')],{'$or':_[_0xb903('0x32')](_0x1afba5,function(_0x223407){if(_0x223407[_0xb903('0x7c')][_0xb903('0x30')]!==_0xb903('0x3f')){var _0x46918c={};_0x46918c[_0x223407[_0xb903('0x7d')]]={'$like':'%'+_0x4664f7[_0xb903('0x33')]['filter']+'%'};return _0x46918c;}})});}var _0x115df9=[];if(_0x4b2c70){var _0x46ecb5=_['find'](_0x2a7b75,[_0xb903('0x2c'),_0x4b2c70[_0xb903('0x2c')]]);if(_0x46ecb5['field']){var _0x5e3955={};if(_0x50c45b['childModel']===_0xb903('0x7e')){_0x5e3955[_0x46ecb5[_0xb903('0x7f')]]=_[_0xb903('0x32')](_0x4b2c70[_0xb903('0x80')],'id');}else{_0x5e3955[_0x46ecb5[_0xb903('0x7f')]]=_0x4b2c70[_0xb903('0x80')];}_0x115df9['push'](_0x5e3955);}else{_0x326bc3['where']['id']=_0x4b2c70[_0xb903('0x80')];}}else{for(var _0x347dcd=0x0;_0x347dcd<_0x1aac64[_0xb903('0x38')];_0x347dcd++){var _0x46ecb5=_[_0xb903('0x49')](_0x2a7b75,[_0xb903('0x2c'),_0x1aac64[_0x347dcd][_0xb903('0x2c')]]);if(_0x46ecb5[_0xb903('0x7d')]){var _0x5e3955={};_0x5e3955[_0x46ecb5[_0xb903('0x7f')]]=_0x1aac64[_0x347dcd][_0xb903('0x80')];_0x115df9['push'](_0x5e3955);}else{if(!_0x326bc3[_0xb903('0x3c')]['id'])_0x326bc3['where']['id']=[];_0x1aac64[_0x347dcd][_0xb903('0x80')][_0xb903('0x69')](function(_0x136389){_0x326bc3[_0xb903('0x3c')]['id'][_0xb903('0x66')](_0x136389);});}}}if(!_['isEmpty'](_0x115df9)){_0x326bc3[_0xb903('0x3c')]=_['merge'](_0x326bc3[_0xb903('0x3c')],{'$and':{'$or':_0x115df9}});}_0x326bc3=_[_0xb903('0x3e')]({},_0x326bc3,_0x4664f7[_0xb903('0x40')]);if(_0x4b2c70&&!_0x4b2c70['autoAssociation']&&_0x50c45b[_0xb903('0x75')]==='AnalyticExtractedReport'){if(_0x4664f7[_0xb903('0x33')][_0xb903('0x42')]){_0x326bc3[_0xb903('0x48')]=[{'all':!![]}];}return db[_0x50c45b[_0xb903('0x75')]][_0xb903('0x56')](_0x326bc3)[_0xb903('0x27')](function(_0x45948f){var _0x10976e=[];_0x45948f[_0xb903('0x69')](function(_0x3ee156){var _0x170bbc;switch(_0x3ee156['reportType']){case _0xb903('0x81'):_0x170bbc=_[_0xb903('0x49')](_0x4b2c70[_0xb903('0x80')],function(_0x5756c5){return _0x5756c5['id']===_0x3ee156[_0xb903('0x82')]&&_0x5756c5[_0xb903('0x7c')]==='DefaultReports';});break;case _0xb903('0x83'):_0x170bbc=_['find'](_0x4b2c70[_0xb903('0x80')],function(_0x28ab60){return _0x28ab60['id']===_0x3ee156['reportId']&&_0x28ab60['type']===_0xb903('0x84');});break;}if(_0x170bbc)_0x10976e[_0xb903('0x66')](_0x3ee156);});_0x4644cd[_0xb903('0x1f')]=_0x10976e['length'];_0x4644cd[_0xb903('0x43')]=_0x10976e;return _0x4644cd;});}else{return db[_0x50c45b[_0xb903('0x75')]][_0xb903('0x1f')]({'where':_0x326bc3[_0xb903('0x3c')]})[_0xb903('0x27')](function(_0x4fad0e){_0x4644cd[_0xb903('0x1f')]=_0x4fad0e;if(_0x4664f7[_0xb903('0x33')][_0xb903('0x42')]){if(_0x50c45b[_0xb903('0x75')]===_0xb903('0x85')){_0x326bc3['include']=[{'model':db[_0xb903('0x86')],'as':_0xb903('0x87'),'attributes':['id',_0xb903('0x2c'),'color'],'required':_0x4664f7['query'][_0xb903('0x88')]?!![]:![]},{'model':db['Tag'],'as':_0xb903('0x89'),'attributes':['id','name','color'],'through':_0x4664f7['query']['tag']?{'attributes':[],'where':{'TagId':_0x4664f7[_0xb903('0x33')][_0xb903('0x88')]||undefined}}:{},'required':_0x4664f7['query']['tag']?!![]:![]}];}else{_0x326bc3[_0xb903('0x48')]=[{'all':!![]}];}}return db[_0x50c45b[_0xb903('0x75')]][_0xb903('0x56')](_0x326bc3);})['then'](function(_0x1f8f9d){_0x4644cd['rows']=_0x1f8f9d;return _0x4644cd;});}}else{return _0x4644cd;}})[_0xb903('0x27')](respondWithFilteredResult(_0x4845f5,_0x326bc3))[_0xb903('0x44')](handleError(_0x4845f5,null));};function getAllResources(_0x56351a,_0x4177e5){return new BPromise(function(_0x5e5fc0,_0x6875ee){if(_0x4177e5){var _0x9bed52=_0x4177e5[_0xb903('0x3d')]?{[_0x4177e5['filter'][_0xb903('0x7d')]]:_0x4177e5[_0xb903('0x3d')][_0xb903('0x8a')]}:undefined;return db[_0x56351a]['findAll']({'where':_0x9bed52,'raw':!![]})[_0xb903('0x27')](function(_0x42bcf4){_0x4177e5[_0xb903('0x80')]=_[_0xb903('0x32')](_0x42bcf4,'id');_0x5e5fc0(_0x4177e5);})[_0xb903('0x44')](function(_0x2a629e){_0x6875ee(_0x2a629e);});}else{_0x5e5fc0(null);}});}function getAllFilteredResources(_0x19bf2d,_0x57e421){return new BPromise(function(_0x2025e4,_0x50288b){var _0x3da7e4=_0x19bf2d['filter']?{[_0x19bf2d[_0xb903('0x3d')][_0xb903('0x7d')]]:_0x19bf2d[_0xb903('0x3d')][_0xb903('0x8a')]}:undefined;return db[_0x19bf2d[_0xb903('0x31')]]['findAll']({'where':_0x3da7e4,'raw':!![]})['then'](function(_0x552190){_0x57e421[_0xb903('0x80')]=_[_0xb903('0x32')](_0x552190,function(_0x323975){return _0x323975[_0xb903('0x2c')];});_0x2025e4(_0x57e421);})['catch'](function(_0x54b9b6){_0x50288b(_0x54b9b6);});});}function getAllowedResources(_0x47dbe9,_0x5a9906,_0x5e849a){return new BPromise(function(_0x307c6b,_0x3adf66){if(_0x5a9906){return db[_0xb903('0x5d')][_0xb903('0x56')]({'where':{'sectionId':_0x5a9906['id']},'raw':!![]})[_0xb903('0x27')](function(_0x1b09ab){if(_0x47dbe9[_0xb903('0x7d')]&&_0x47dbe9[_0xb903('0x7d')]!=='id'){_0x5a9906[_0xb903('0x80')]=_[_0xb903('0x32')](_0x1b09ab,function(_0x559321){return _0x559321[_0x47dbe9[_0xb903('0x7d')]];});}else{if(_0x5e849a===_0xb903('0x7e')){_0x5a9906['associatedResources']=_[_0xb903('0x32')](_0x1b09ab,function(_0x1c3e45){return{'id':_0x1c3e45['resourceId'],'type':_0x1c3e45[_0xb903('0x7c')]};});}else{_0x5a9906['associatedResources']=_['map'](_0x1b09ab,function(_0x3b8fdc){return _0x3b8fdc[_0xb903('0x6a')];});}}_0x307c6b(_0x5a9906);})['catch'](function(_0x423e89){_0x3adf66(_0x423e89);});}else{_0x307c6b(null);}});}function getQueryModels(_0x2f0750,_0x4c3f11){var _0x2bae68=_0x2f0750[_0xb903('0x8b')]();var _0x29734a={'childModel':undefined,'parentSections':[]};switch(_0x2bae68){case'squareprojects':_0x29734a[_0xb903('0x75')]='SquareProject';break;case _0xb903('0x8c'):_0x29734a[_0xb903('0x75')]=_0xb903('0x8d');break;case _0xb903('0x8e'):_0x29734a[_0xb903('0x75')]='SquareRecording';_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0x8f'),'field':_0xb903('0x2c'),'foreignKey':_0xb903('0x90')}];break;case'projects':_0x29734a[_0xb903('0x75')]=_0xb903('0x91');break;case'contacts':_0x29734a[_0xb903('0x75')]=_0xb903('0x85');_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0x92'),'field':'id','foreignKey':_0xb903('0x93')}];break;case _0xb903('0x94'):_0x29734a[_0xb903('0x75')]=_0xb903('0x95');break;case _0xb903('0x96'):_0x29734a[_0xb903('0x75')]=_0xb903('0x97');break;case'globalcustomfields':_0x29734a[_0xb903('0x75')]='CmCustomField';break;case _0xb903('0x98'):_0x29734a[_0xb903('0x75')]=_0xb903('0x99');break;case _0xb903('0x9a'):_0x29734a['childModel']='ChatWebsite';break;case _0xb903('0x9b'):_0x29734a[_0xb903('0x75')]=_0xb903('0x9c');break;case _0xb903('0x9d'):_0x29734a[_0xb903('0x75')]=_0xb903('0x9e');break;case _0xb903('0x9f'):case _0xb903('0xa0'):case'outboundroutes':_0x29734a[_0xb903('0x75')]=_0xb903('0xa1');break;case _0xb903('0xa2'):_0x29734a[_0xb903('0x75')]=_0xb903('0xa3');break;case _0xb903('0xa4'):_0x29734a[_0xb903('0x75')]=_0xb903('0xa5');break;case _0xb903('0xa6'):_0x29734a[_0xb903('0x75')]=_0xb903('0xa7');_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0xa8'),'field':_0xb903('0x2c'),'foreignKey':_0xb903('0xa9'),'model':_0xb903('0xaa'),'filter':{'field':_0xb903('0xab'),'value':[_0xb903('0xac')]}},{'name':_0xb903('0xad'),'field':_0xb903('0x2c'),'foreignKey':_0xb903('0xa9'),'model':_0xb903('0xaa'),'filter':{'field':_0xb903('0xab'),'value':[_0xb903('0xae')]}},{'name':'VoiceQueues','field':_0xb903('0x2c'),'foreignKey':'queue','model':_0xb903('0xaf'),'filter':{'field':'type','value':['inbound']}},{'name':_0xb903('0xb0'),'field':'name','foreignKey':_0xb903('0xb1'),'model':'VoiceQueue','filter':{'field':_0xb903('0x7c'),'value':['outbound']}}];break;case'musiconholds':_0x29734a[_0xb903('0x75')]=_0xb903('0xb2');break;case _0xb903('0xb3'):_0x29734a['childModel']='VoiceChanSpy';break;case'voiceprefixes':_0x29734a[_0xb903('0x75')]=_0xb903('0xb4');break;case _0xb903('0xb5'):_0x29734a[_0xb903('0x75')]=_0xb903('0xb6');break;case _0xb903('0xb7'):_0x29734a[_0xb903('0x75')]=_0xb903('0xb8');break;case _0xb903('0xb9'):_0x29734a[_0xb903('0x75')]=_0xb903('0xba');break;case'mailsubstatuses':_0x29734a[_0xb903('0x75')]=_0xb903('0xbb');break;case _0xb903('0xbc'):_0x29734a[_0xb903('0x75')]='OpenchannelQueue';break;case _0xb903('0xbd'):_0x29734a[_0xb903('0x75')]=_0xb903('0xbe');break;case _0xb903('0xbf'):_0x29734a['childModel']=_0xb903('0xc0');break;case _0xb903('0xc1'):_0x29734a[_0xb903('0x75')]='SmsAccount';break;case'whatsappqueues':_0x29734a[_0xb903('0x75')]=_0xb903('0xc2');break;case'whatsappaccounts':_0x29734a[_0xb903('0x75')]=_0xb903('0xc3');break;case'teams':_0x29734a[_0xb903('0x75')]=_0xb903('0xc4');break;case _0xb903('0xc5'):case'queuecampaigns':_0x29734a['childModel']=_0xb903('0xaf');if(_0x4c3f11){_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0xc6')},{'name':'QueueCampaigns'}];}break;case _0xb903('0xc7'):case'agents':case'telephones':_0x29734a[_0xb903('0x75')]='User';if(_0x4c3f11){_0x29734a['parentSections']=[{'name':_0xb903('0xc8'),'filter':{'field':_0xb903('0xab'),'value':[_0xb903('0xc9'),'user']},'ignore':!![]},{'name':_0xb903('0xa8')},{'name':_0xb903('0xad')}];}break;case _0xb903('0xca'):_0x29734a[_0xb903('0x75')]=_0xb903('0xcb');break;case _0xb903('0xcc'):_0x29734a[_0xb903('0x75')]=_0xb903('0xcd');break;case _0xb903('0xce'):_0x29734a[_0xb903('0x75')]=_0xb903('0xcf');break;case'sugarcrmaccounts':_0x29734a['childModel']='SugarcrmAccount';break;case _0xb903('0xd0'):_0x29734a[_0xb903('0x75')]='DeskAccount';break;case _0xb903('0xd1'):_0x29734a[_0xb903('0x75')]='ZohoAccount';break;case _0xb903('0xd2'):_0x29734a[_0xb903('0x75')]=_0xb903('0xaa');break;case _0xb903('0xd3'):_0x29734a[_0xb903('0x75')]=_0xb903('0xd4');break;case _0xb903('0xd5'):_0x29734a['childModel']=_0xb903('0xd6');break;case'customdashboards':_0x29734a[_0xb903('0x75')]=_0xb903('0x68');break;case _0xb903('0xd7'):_0x29734a[_0xb903('0x75')]=_0xb903('0xd8');break;case'pauses':_0x29734a[_0xb903('0x75')]=_0xb903('0xd9');break;case _0xb903('0xda'):_0x29734a[_0xb903('0x75')]='Schedule';break;case _0xb903('0xdb'):_0x29734a[_0xb903('0x75')]=_0xb903('0xdc');break;case'tags':_0x29734a['childModel']=_0xb903('0x86');break;case'templates':_0x29734a[_0xb903('0x75')]='Template';break;case _0xb903('0xdd'):_0x29734a[_0xb903('0x75')]='Trigger';break;case _0xb903('0xde'):_0x29734a[_0xb903('0x75')]=_0xb903('0xdf');break;case _0xb903('0xe0'):_0x29734a[_0xb903('0x75')]=_0xb903('0xe1');break;case _0xb903('0xe2'):_0x29734a[_0xb903('0x75')]='Plugin';break;case _0xb903('0xe3'):_0x29734a[_0xb903('0x75')]=_0xb903('0x7e');_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0xe4'),'field':'id','foreignKey':_0xb903('0x82')}];break;case _0xb903('0xe5'):_0x29734a['childModel']=_0xb903('0xe6');break;case'whatsappaccounts':_0x29734a['childModel']=_0xb903('0xc3');break;default:return _0x29734a;}return _0x29734a;}
\ No newline at end of file
+var _0x14a0=['UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','describe','addSections','sequelize','transaction','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','push','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions'];(function(_0x54e3b7,_0x1725db){var _0x1d9796=function(_0x4614d7){while(--_0x4614d7){_0x54e3b7['push'](_0x54e3b7['shift']());}};_0x1d9796(++_0x1725db);}(_0x14a0,0x8e));var _0x014a=function(_0x2f33db,_0x5ab33f){_0x2f33db=_0x2f33db-0x0;var _0x25cb50=_0x14a0[_0x2f33db];return _0x25cb50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);function respondWithStatusCode(_0x3c54c8,_0x4fe87c){_0x4fe87c=_0x4fe87c||0xcc;return function(_0x130d13){if(_0x130d13){return _0x3c54c8[_0x014a('0x1a')](_0x4fe87c);}return _0x3c54c8['status'](_0x4fe87c)[_0x014a('0x1b')]();};}function respondWithResult(_0x128c46,_0x59a4ea){_0x59a4ea=_0x59a4ea||0xc8;return function(_0x16e6fc){if(_0x16e6fc){return _0x128c46[_0x014a('0x1c')](_0x59a4ea)[_0x014a('0x1d')](_0x16e6fc);}};}function respondWithFilteredResult(_0x12da95,_0x2c26ac){return function(_0x12d339){if(_0x12d339){var _0x61ec9f=typeof _0x2c26ac[_0x014a('0x1e')]===_0x014a('0x1f')&&typeof _0x2c26ac[_0x014a('0x20')]===_0x014a('0x1f');var _0x89e132=_0x12d339[_0x014a('0x21')];var _0x34e5c3=_0x61ec9f?0x0:_0x2c26ac['offset'];var _0x359903=_0x61ec9f?_0x12d339[_0x014a('0x21')]:_0x2c26ac[_0x014a('0x1e')]+_0x2c26ac[_0x014a('0x20')];var _0xc9a563;if(_0x359903>=_0x89e132){_0x359903=_0x89e132;_0xc9a563=0xc8;}else{_0xc9a563=0xce;}_0x12da95[_0x014a('0x1c')](_0xc9a563);return _0x12da95[_0x014a('0x22')](_0x014a('0x23'),_0x34e5c3+'-'+_0x359903+'/'+_0x89e132)[_0x014a('0x1d')](_0x12d339);}return null;};}function patchUpdates(_0x486e66){return function(_0x3679ed){try{jsonpatch['apply'](_0x3679ed,_0x486e66,!![]);}catch(_0x1a1318){return BPromise[_0x014a('0x24')](_0x1a1318);}return _0x3679ed[_0x014a('0x25')]();};}function saveUpdates(_0x36d52b,_0x2b3c10){return function(_0x113b12){if(_0x113b12){return _0x113b12[_0x014a('0x26')](_0x36d52b)[_0x014a('0x27')](function(_0x165a42){return _0x165a42;});}return null;};}function removeEntity(_0x4c2627,_0x3b4b92){return function(_0x5358e9){if(_0x5358e9){return _0x5358e9[_0x014a('0x28')]()[_0x014a('0x27')](function(){_0x4c2627['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a901f,_0x3f9719){return function(_0x143346){if(!_0x143346){_0x9a901f['sendStatus'](0x194);}return _0x143346;};}function handleError(_0x183f19,_0x3c1fa4){_0x3c1fa4=_0x3c1fa4||0x1f4;return function(_0x598179){logger[_0x014a('0x29')](_0x598179[_0x014a('0x2a')]);if(_0x598179['name']){delete _0x598179['name'];}_0x183f19[_0x014a('0x1c')](_0x3c1fa4)[_0x014a('0x2b')](_0x598179);};}exports[_0x014a('0x2c')]=function(_0x29fce5,_0x4ea00c){var _0x434038={},_0x147e7e={},_0x15af07={'count':0x0,'rows':[]};var _0x402d3b=_[_0x014a('0x2d')](db[_0x014a('0x2e')][_0x014a('0x2f')],function(_0x1dae8e){return{'name':_0x1dae8e[_0x014a('0x30')],'type':_0x1dae8e[_0x014a('0x31')][_0x014a('0x32')]};});_0x147e7e['model']=_[_0x014a('0x2d')](_0x402d3b,_0x014a('0x33'));_0x147e7e[_0x014a('0x34')]=_[_0x014a('0x35')](_0x29fce5[_0x014a('0x34')]);_0x147e7e[_0x014a('0x36')]=_[_0x014a('0x37')](_0x147e7e['model'],_0x147e7e[_0x014a('0x34')]);_0x434038[_0x014a('0x38')]=_['intersection'](_0x147e7e[_0x014a('0x39')],qs[_0x014a('0x3a')](_0x29fce5[_0x014a('0x34')][_0x014a('0x3a')]));_0x434038[_0x014a('0x38')]=_0x434038[_0x014a('0x38')][_0x014a('0x3b')]?_0x434038[_0x014a('0x38')]:_0x147e7e['model'];if(!_0x29fce5[_0x014a('0x34')][_0x014a('0x3c')](_0x014a('0x3d'))){_0x434038[_0x014a('0x20')]=qs['limit'](_0x29fce5[_0x014a('0x34')][_0x014a('0x20')]);_0x434038[_0x014a('0x1e')]=qs[_0x014a('0x1e')](_0x29fce5[_0x014a('0x34')][_0x014a('0x1e')]);}_0x434038[_0x014a('0x3e')]=qs[_0x014a('0x3f')](_0x29fce5[_0x014a('0x34')]['sort']);_0x434038[_0x014a('0x40')]=qs['filters'](_[_0x014a('0x41')](_0x29fce5[_0x014a('0x34')],_0x147e7e[_0x014a('0x36')]),_0x402d3b);if(_0x29fce5[_0x014a('0x34')][_0x014a('0x42')]){_0x434038['where']=_[_0x014a('0x43')](_0x434038[_0x014a('0x40')],{'$or':_['map'](_0x402d3b,function(_0x9227b8){if(_0x9227b8[_0x014a('0x31')]!==_0x014a('0x44')){var _0x2e7a14={};_0x2e7a14[_0x9227b8[_0x014a('0x33')]]={'$like':'%'+_0x29fce5[_0x014a('0x34')][_0x014a('0x42')]+'%'};return _0x2e7a14;}})});}_0x434038=_[_0x014a('0x43')]({},_0x434038,_0x29fce5[_0x014a('0x45')]);var _0x537bde={'where':_0x434038[_0x014a('0x40')]};return db[_0x014a('0x2e')][_0x014a('0x21')](_0x537bde)[_0x014a('0x27')](function(_0x5f1a91){_0x15af07[_0x014a('0x21')]=_0x5f1a91;if(_0x29fce5[_0x014a('0x34')][_0x014a('0x46')]){_0x434038[_0x014a('0x47')]=[{'all':!![]}];}return db[_0x014a('0x2e')][_0x014a('0x48')](_0x434038);})['then'](function(_0x361866){_0x15af07[_0x014a('0x49')]=_0x361866;return _0x15af07;})['then'](respondWithFilteredResult(_0x4ea00c,_0x434038))[_0x014a('0x4a')](handleError(_0x4ea00c,null));};exports[_0x014a('0x4b')]=function(_0x2c45f1,_0x5dc092){var _0x5bcf8={'raw':![],'where':{'id':_0x2c45f1['params']['id']}},_0x50a8f0={};_0x50a8f0[_0x014a('0x39')]=_[_0x014a('0x35')](db['UserProfile'][_0x014a('0x2f')]);_0x50a8f0[_0x014a('0x34')]=_[_0x014a('0x35')](_0x2c45f1[_0x014a('0x34')]);_0x50a8f0[_0x014a('0x36')]=_[_0x014a('0x37')](_0x50a8f0['model'],_0x50a8f0[_0x014a('0x34')]);_0x5bcf8[_0x014a('0x38')]=_[_0x014a('0x37')](_0x50a8f0['model'],qs['fields'](_0x2c45f1[_0x014a('0x34')]['fields']));_0x5bcf8['attributes']=_0x5bcf8[_0x014a('0x38')]['length']?_0x5bcf8[_0x014a('0x38')]:_0x50a8f0[_0x014a('0x39')];if(_0x2c45f1[_0x014a('0x34')]['includeAll']){_0x5bcf8[_0x014a('0x47')]=[{'all':!![]}];}_0x5bcf8=_[_0x014a('0x43')]({},_0x5bcf8,_0x2c45f1[_0x014a('0x45')]);return db[_0x014a('0x2e')][_0x014a('0x4c')](_0x5bcf8)[_0x014a('0x27')](handleEntityNotFound(_0x5dc092,null))['then'](respondWithResult(_0x5dc092,null))[_0x014a('0x4a')](handleError(_0x5dc092,null));};exports[_0x014a('0x4d')]=function(_0x5a861c,_0x1a4df9){return db[_0x014a('0x2e')][_0x014a('0x4d')](_0x5a861c[_0x014a('0x4e')],{})[_0x014a('0x27')](respondWithResult(_0x1a4df9,0xc9))[_0x014a('0x4a')](handleError(_0x1a4df9,null));};exports[_0x014a('0x4f')]=function(_0x21680f,_0x4aa72b){var _0x423fb2={'where':{'id':_0x21680f[_0x014a('0x50')]['id']}},_0x16a4b5={};_0x16a4b5[_0x014a('0x39')]=_[_0x014a('0x35')](db['UserProfile'][_0x014a('0x2f')]);_0x423fb2['attributes']=_[_0x014a('0x37')](_0x16a4b5[_0x014a('0x39')],qs[_0x014a('0x3a')](_0x21680f[_0x014a('0x34')][_0x014a('0x3a')]));_0x423fb2['attributes']=_0x423fb2['attributes']['length']?_0x423fb2['attributes']:_0x16a4b5[_0x014a('0x39')];if(_0x21680f['query'][_0x014a('0x46')]){_0x423fb2['include']=[{'all':!![]}];}_0x423fb2=_['merge']({},_0x423fb2,_0x21680f[_0x014a('0x45')]);return db['UserProfile'][_0x014a('0x4c')](_0x423fb2)[_0x014a('0x27')](handleEntityNotFound(_0x4aa72b,null))[_0x014a('0x27')](function(_0x3c7e06){if(_0x3c7e06){var _0x21b16c=_0x3c7e06[_0x014a('0x51')]({'plain':!![]});_0x21b16c=qs[_0x014a('0x52')](_0x21b16c,['id',_0x014a('0x53'),_0x014a('0x54'),_0x014a('0x55')]);_0x21680f['body']=_['omit'](_0x21680f[_0x014a('0x4e')],['id',_0x014a('0x53'),_0x014a('0x54')]);return db['sequelize']['transaction'](function(_0x4591ad){return db['UserProfile'][_0x014a('0x4d')](_[_0x014a('0x43')](_0x21b16c,_0x21680f[_0x014a('0x4e')]),{'include':_0x21680f[_0x014a('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4591ad})[_0x014a('0x27')](function(_0x2ccc2f){var _0x3d1c9d=_0x2ccc2f['get']({'plain':!![]});return db[_0x014a('0x56')]['findAll']({'where':{'userProfileId':_0x21680f[_0x014a('0x50')]['id']},'raw':!![]})[_0x014a('0x27')](function(_0x34736b){if(_0x34736b){return BPromise[_0x014a('0x57')](_0x34736b,function(_0xd0334a){return new BPromise(function(_0x1a308b,_0x4e9260){if(_0xd0334a[_0x014a('0x58')]===null||_0xd0334a[_0x014a('0x58')]===0x1)_0x1a308b(null);return db[_0x014a('0x59')]['findAll']({'where':{'sectionId':_0xd0334a['id']},'raw':!![]})[_0x014a('0x27')](function(_0x17f9d7){var _0x2a9137=_[_0x014a('0x2d')](_0x17f9d7,function(_0x11bf5c){return qs['omit'](_0x11bf5c,['id',_0x014a('0x53'),_0x014a('0x54'),_0x014a('0x5a')]);});_0x1a308b(_0x2a9137);})[_0x014a('0x4a')](function(_0x3ca7e6){_0x4e9260(_0x3ca7e6);});})[_0x014a('0x27')](function(_0x477946){var _0x4039d1=qs[_0x014a('0x52')](_0xd0334a,['id',_0x014a('0x53'),_0x014a('0x54')]);_0x4039d1[_0x014a('0x5b')]=_0x3d1c9d['id'];if(_0x477946)_0x4039d1['Resources']=_0x477946;return _0x4039d1;})[_0x014a('0x27')](function(_0x5ac216){return db['UserProfileSection']['create'](_0x5ac216,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x4591ad});});})[_0x014a('0x27')](function(){return _0x3d1c9d;});}});});});}})[_0x014a('0x27')](respondWithResult(_0x4aa72b,0xc9))[_0x014a('0x4a')](handleError(_0x4aa72b,null));};exports['update']=function(_0x3c6fc0,_0x2a5007){if(_0x3c6fc0[_0x014a('0x4e')]['id']){delete _0x3c6fc0[_0x014a('0x4e')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x3c6fc0[_0x014a('0x50')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x2a5007,null))[_0x014a('0x27')](saveUpdates(_0x3c6fc0[_0x014a('0x4e')],null))[_0x014a('0x27')](respondWithResult(_0x2a5007,null))[_0x014a('0x4a')](handleError(_0x2a5007,null));};exports[_0x014a('0x28')]=function(_0x1eee3e,_0x387d12){return db[_0x014a('0x2e')][_0x014a('0x4c')]({'where':{'id':_0x1eee3e['params']['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x387d12,null))[_0x014a('0x27')](removeEntity(_0x387d12,null))['catch'](handleError(_0x387d12,null));};exports[_0x014a('0x5c')]=function(_0x3e39c9,_0x56f4b2){return db[_0x014a('0x2e')]['describe']()[_0x014a('0x27')](respondWithResult(_0x56f4b2,null))[_0x014a('0x4a')](handleError(_0x56f4b2,null));};exports[_0x014a('0x5d')]=function(_0x456d69,_0x37b8f){var _0x5e0f22=_0x456d69[_0x014a('0x4e')];return db[_0x014a('0x2e')][_0x014a('0x4c')]({'where':{'id':_0x456d69[_0x014a('0x50')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x37b8f,null))['then'](function(_0x20cddc){if(_0x20cddc){return db[_0x014a('0x5e')][_0x014a('0x5f')](function(_0x5f3224){return db[_0x014a('0x56')]['destroy']({'where':{'userProfileId':_0x456d69[_0x014a('0x50')]['id'],'sectionId':_[_0x014a('0x2d')](_0x5e0f22,function(_0x267026){return _0x267026[_0x014a('0x5a')];})},'transaction':_0x5f3224})[_0x014a('0x27')](function(){var _0x465a8e=_[_0x014a('0x2d')](_0x5e0f22,function(_0x58e087){_0x58e087['userProfileId']=_0x456d69[_0x014a('0x50')]['id'];return _0x58e087;});var _0x5d077c=[];return BPromise[_0x014a('0x57')](_0x465a8e,function(_0x5966f0){return db[_0x014a('0x56')][_0x014a('0x4d')](_0x5966f0,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x5f3224})[_0x014a('0x27')](function(_0x8234ee){_0x5d077c['push'](_0x8234ee[_0x014a('0x51')]({'plain':!![]}));});})[_0x014a('0x27')](function(){return _0x5d077c;});});});}})['then'](function(_0x4a1b65){return _0x4a1b65;})[_0x014a('0x27')](respondWithResult(_0x37b8f,null))[_0x014a('0x4a')](handleError(_0x37b8f,null));};exports[_0x014a('0x60')]=function(_0x33e383,_0x37ea2d){var _0x321329;return db['UserProfile'][_0x014a('0x4c')]({'where':{'id':_0x33e383['params']['id']},'attributes':['id','name']})[_0x014a('0x27')](handleEntityNotFound(_0x37ea2d,null))[_0x014a('0x27')](function(_0x523859){if(_0x523859){_0x321329=_0x523859;return db[_0x014a('0x56')][_0x014a('0x28')]({'where':{'userProfileId':_0x33e383[_0x014a('0x50')]['id'],'sectionId':_0x33e383[_0x014a('0x34')][_0x014a('0x61')]}});}})['then'](function(){return _0x321329;})[_0x014a('0x27')](respondWithStatusCode(_0x37ea2d,null))[_0x014a('0x4a')](handleError(_0x37ea2d,null));};exports[_0x014a('0x62')]=function(_0x163fa2,_0x4aefeb){var _0x8716b=[];var _0x4c568c=[];return db[_0x014a('0x56')][_0x014a('0x48')]({'where':{'userProfileId':_0x163fa2[_0x014a('0x50')]['id']},'raw':!![]})[_0x014a('0x27')](function(_0xf7c997){_0x8716b=_[_0x014a('0x42')](_0xf7c997,function(_0x5dd4b8){return _0x5dd4b8[_0x014a('0x63')]===0x1||_[_0x014a('0x64')]([0x3eb,0x709],_0x5dd4b8[_0x014a('0x5a')]);});if(!_[_0x014a('0x65')](_0x8716b)){return _[_0x014a('0x2d')](_0x8716b,function(_0x3802df){return _0x3802df[_0x014a('0x5a')];});}else{return;}})[_0x014a('0x27')](function(_0x55cfe7){if(_0x55cfe7)_0x4c568c=_0x55cfe7;if(_[_0x014a('0x64')](_0x4c568c,0x64)){var _0x37c69e=_[_0x014a('0x4c')](_0x8716b,{'sectionId':0x64});return hasDefaultDashboard(_0x37c69e)['then'](function(_0x2fbaf3){return _[_0x014a('0x2d')](_0x8716b,function(_0x1cdfa5){if(_0x1cdfa5[_0x014a('0x5a')]===0x64){_0x1cdfa5[_0x014a('0x66')]=_0x2fbaf3;}return _0x1cdfa5;});});}else{return;}})[_0x014a('0x27')](function(_0x29b061){if(_0x29b061)_0x8716b=_0x29b061;if(_['includes'](_0x4c568c,0x3eb)){var _0x5891cf=_['find'](_0x8716b,{'sectionId':0x3eb});return getCustomDashboards(_0x5891cf)['then'](function(_0x194c8d){return _[_0x014a('0x2d')](_0x8716b,function(_0x1810a8){if(_0x5891cf[_0x014a('0x63')]){if(_0x1810a8[_0x014a('0x5a')]===0x3eb){_0x1810a8[_0x014a('0x66')]=_0x194c8d;}}else{if(_0x1810a8[_0x014a('0x5a')]===0x64){_0x1810a8['subsections']=_0x194c8d;}}return _0x1810a8;});});}else{return;}})[_0x014a('0x27')](function(_0x2e3ccd){if(_0x2e3ccd)_0x8716b=_0x2e3ccd;if(_[_0x014a('0x64')](_0x4c568c,0x709)){var _0x28a8ec=_['find'](_0x8716b,{'sectionId':0x709});return getPlugins(_0x28a8ec)['then'](function(_0x13e2fc){if(_0x28a8ec[_0x014a('0x63')]){return _['map'](_0x8716b,function(_0x4aea1d){if(_0x4aea1d[_0x014a('0x5a')]===0x709){_0x4aea1d['subsections']=_0x13e2fc;}return _0x4aea1d;});}else{var _0x5d4099={'sectionId':0x76c,'enabled':0x1,'subsections':_0x13e2fc};var _0x403836=_[_0x014a('0x2d')](_0x8716b);_0x403836['push'](_0x5d4099);return _0x403836;}});}else{return;}})[_0x014a('0x27')](function(_0x3ac51b){if(_0x3ac51b)_0x8716b=_0x3ac51b;return _[_0x014a('0x42')](_0x8716b,[_0x014a('0x63'),0x1]);})[_0x014a('0x27')](respondWithResult(_0x4aefeb,null))[_0x014a('0x4a')](handleError(_0x4aefeb,null));};function hasDefaultDashboard(_0x13a545){var _0xc86f44=[0x65];return new BPromise(function(_0x5c3935,_0x5bae68){try{if(_0x13a545[_0x014a('0x58')]){_0x5c3935(_0xc86f44);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x13a545['id']},'raw':!![]})['then'](function(_0x1ba1e0){_0x1ba1e0?_0x5c3935(_0xc86f44):_0x5c3935();});}}catch(_0x10144f){_0x5bae68(_0x10144f);}});}function getCustomDashboards(_0x2c527f){var _0x55408f=[];return new BPromise(function(_0x19e317,_0x387fd0){try{if(_0x2c527f[_0x014a('0x58')]){return db[_0x014a('0x67')]['findAll']({'raw':!![]})[_0x014a('0x27')](function(_0x3fa661){_0x3fa661[_0x014a('0x68')](function(_0x48617c){_0x55408f[_0x014a('0x69')](_0x48617c['id']+0x1869f);});_0x19e317(_0x55408f);});}else{return db[_0x014a('0x59')]['findAll']({'where':{'sectionId':_0x2c527f['id']},'raw':!![]})[_0x014a('0x27')](function(_0x3367cb){_0x3367cb[_0x014a('0x68')](function(_0x4b0d03){_0x55408f[_0x014a('0x69')](_0x4b0d03[_0x014a('0x6a')]+0x1869f);});_0x19e317(_0x55408f);});}}catch(_0x53c335){_0x387fd0(_0x53c335);}});}function getPlugins(_0x1e096b){var _0x293221=[];return new BPromise(function(_0x317df3,_0x368083){try{if(_0x1e096b[_0x014a('0x58')]){return db[_0x014a('0x6b')][_0x014a('0x48')]({'raw':!![]})[_0x014a('0x27')](function(_0x5d99a9){_0x5d99a9[_0x014a('0x68')](function(_0x1806d0){_0x293221['push'](_0x1806d0['id']+0x15b38);});_0x317df3(_0x293221);});}else{return db['UserProfileResource'][_0x014a('0x48')]({'where':{'sectionId':_0x1e096b['id']},'raw':!![]})[_0x014a('0x27')](function(_0x47f3c7){_0x47f3c7[_0x014a('0x68')](function(_0x440b9b){_0x293221[_0x014a('0x69')](_0x440b9b['resourceId']+0x15b38);});_0x317df3(_0x293221);});}}catch(_0x3a0012){_0x368083(_0x3a0012);}});}exports[_0x014a('0x6c')]=function(_0x5dedaf,_0x5baf80){return db[_0x014a('0x2e')]['find']({'where':{'id':_0x5dedaf[_0x014a('0x50')]['id']}})['then'](handleEntityNotFound(_0x5baf80,null))[_0x014a('0x27')](function(_0x25f4ef){if(_0x25f4ef){return db[_0x014a('0x5e')][_0x014a('0x5f')](function(_0x20b182){return db['UserProfileSection'][_0x014a('0x48')]({'where':{'userProfileId':_0x5dedaf[_0x014a('0x50')]['id']},'attributes':['id'],'raw':!![]})[_0x014a('0x27')](function(_0x41f999){if(_0x41f999){return db[_0x014a('0x56')][_0x014a('0x28')]({'where':{'userProfileId':_0x5dedaf[_0x014a('0x50')]['id'],'id':_[_0x014a('0x2d')](_0x41f999,function(_0x51c35f){return _0x51c35f['id'];})},'transaction':_0x20b182});}})[_0x014a('0x27')](function(_0x54645e){var _0xc1dcb9=_['map'](_0x5dedaf['body'],function(_0x47bad1){_0x47bad1['userProfileId']=_0x5dedaf[_0x014a('0x50')]['id'];return _0x47bad1;});return db[_0x014a('0x56')][_0x014a('0x6d')](_0xc1dcb9,{'raw':!![],'transaction':_0x20b182});})[_0x014a('0x27')](function(_0x28a692){var _0x27a899=_[_0x014a('0x42')](_[_0x014a('0x2d')](_0x28a692,function(_0x5327a6){return _0x5327a6['get']({'plain':!![]});}),{'includeAll':![]});if(_0x27a899){return db[_0x014a('0x56')][_0x014a('0x48')]({'where':{'userProfileId':_0x5dedaf[_0x014a('0x50')]['id'],'sectionId':_[_0x014a('0x2d')](_0x27a899,function(_0x45aef0){return _0x45aef0[_0x014a('0x5a')];})},'attributes':['id',_0x014a('0x5a')],'raw':!![]})[_0x014a('0x27')](function(_0x5342cc){var _0x27431c=_[_0x014a('0x2d')](_0x5dedaf[_0x014a('0x4e')],function(_0x2baee6){_0x2baee6[_0x014a('0x5b')]=_0x5dedaf['params']['id'];return _0x2baee6;});return db[_0x014a('0x59')][_0x014a('0x6d')](_0x27431c,{'raw':!![],'transaction':_0x20b182});});}})[_0x014a('0x4a')](handleError(_0x5baf80,null));});}})[_0x014a('0x27')](function(_0x3171d3){var _0x567357=_[_0x014a('0x2d')](_0x3171d3,function(_0x5ad83b){return _0x5ad83b[_0x014a('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x5baf80,null))['catch'](handleError(_0x5baf80,null));};exports[_0x014a('0x6e')]=function(_0xaf1b9f,_0x4af6d4,_0x129c22){return db[_0x014a('0x2e')][_0x014a('0x4c')]({'where':{'id':_0xaf1b9f['params']['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x4af6d4,null))[_0x014a('0x27')](function(_0x2feb8a){if(_0x2feb8a){return _0x2feb8a[_0x014a('0x6e')](_0xaf1b9f[_0x014a('0x34')][_0x014a('0x61')]);}})[_0x014a('0x27')](respondWithStatusCode(_0x4af6d4,null))[_0x014a('0x4a')](handleError(_0x4af6d4,null));};exports[_0x014a('0x6f')]=function(_0x58341b,_0x597702){var _0x14b351={};if(!_0x58341b[_0x014a('0x34')][_0x014a('0x70')])throw new Error('Missing\x20section\x20parameter');if(!_0x58341b[_0x014a('0x34')][_0x014a('0x3c')](_0x014a('0x3d'))){_0x14b351[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x58341b[_0x014a('0x34')]['limit']);_0x14b351[_0x014a('0x1e')]=qs[_0x014a('0x1e')](_0x58341b[_0x014a('0x34')][_0x014a('0x1e')]);}return db['UserProfile'][_0x014a('0x4c')]({'where':{'id':_0x58341b[_0x014a('0x50')]['id']}})[_0x014a('0x27')](function(_0x30999a){if(!_0x30999a)throw new Error(_0x014a('0x71')+_0x58341b['params']['id']);return db[_0x014a('0x2e')]['getResources'](_0x58341b);})['then'](respondWithFilteredResult(_0x597702,_0x14b351))[_0x014a('0x4a')](handleError(_0x597702,null));};
\ No newline at end of file