Built motion from commit (unavailable).|2.6.0
[motion2.git] / server / api / userProfile / userProfile.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x144f=['squareprojects','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','whatsappqueues','WhatsappQueue','teams','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','zohoaccounts','dispositions','Disposition','customdashboards','intervals','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Trigger','trunks','variables','Variable','extractedreports','Reports','AnalyticMetric','whatsappaccounts','WhatsappAccount','screenrecordings','ScreenRecording','UserId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','destroy','then','sendStatus','stack','name','send','UserProfile','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','clone','get','omit','createdAt','body','updatedAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','push','ids','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','mergeResources','parentSections','all','ignore','union','childModel','pick','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','reportId','DefaultReports','CustomReports','CmContact','Tag','color','tag','ThroughTags','Agents','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','toString','OpenTabs','value','toLowerCase'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x144f,0x15f));var _0xf144=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x144f[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf144('0x0'));var zipdir=require(_0xf144('0x1'));var jsonpatch=require(_0xf144('0x2'));var rp=require(_0xf144('0x3'));var moment=require(_0xf144('0x4'));var BPromise=require(_0xf144('0x5'));var Mustache=require(_0xf144('0x6'));var util=require(_0xf144('0x7'));var path=require('path');var sox=require(_0xf144('0x8'));var csv=require(_0xf144('0x9'));var ejs=require(_0xf144('0xa'));var fs=require('fs');var fs_extra=require(_0xf144('0xb'));var _=require('lodash');var squel=require(_0xf144('0xc'));var crypto=require('crypto');var jsforce=require(_0xf144('0xd'));var deskjs=require(_0xf144('0xe'));var toCsv=require(_0xf144('0x9'));var querystring=require(_0xf144('0xf'));var Papa=require(_0xf144('0x10'));var Redis=require(_0xf144('0x11'));var authService=require(_0xf144('0x12'));var qs=require(_0xf144('0x13'));var as=require(_0xf144('0x14'));var hardwareService=require(_0xf144('0x15'));var logger=require(_0xf144('0x16'))('api');var utils=require(_0xf144('0x17'));var config=require(_0xf144('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf144('0x19'))['db'];config[_0xf144('0x1a')]=_['defaults'](config[_0xf144('0x1a')],{'host':_0xf144('0x1b'),'port':0x18eb});var socket=require(_0xf144('0x1c'))(new Redis(config['redis']));require(_0xf144('0x1d'))[_0xf144('0x1e')](socket);function respondWithStatusCode(_0x8bc355,_0x55cc44){_0x55cc44=_0x55cc44||0xcc;return function(_0x5f26d0){if(_0x5f26d0){return _0x8bc355['sendStatus'](_0x55cc44);}return _0x8bc355['status'](_0x55cc44)[_0xf144('0x1f')]();};}function respondWithResult(_0x3503b4,_0x2d53fa){_0x2d53fa=_0x2d53fa||0xc8;return function(_0x49c039){if(_0x49c039){return _0x3503b4[_0xf144('0x20')](_0x2d53fa)[_0xf144('0x21')](_0x49c039);}};}function respondWithFilteredResult(_0x1f2693,_0x47bea8){return function(_0x13a142){if(_0x13a142){var _0x48bcc6=typeof _0x47bea8[_0xf144('0x22')]===_0xf144('0x23')&&typeof _0x47bea8['limit']===_0xf144('0x23');var _0x23954b=_0x13a142['count'];var _0x23ac2a=_0x48bcc6?0x0:_0x47bea8[_0xf144('0x22')];var _0x4f258b=_0x48bcc6?_0x13a142['count']:_0x47bea8[_0xf144('0x22')]+_0x47bea8[_0xf144('0x24')];var _0x23b955;if(_0x4f258b>=_0x23954b){_0x4f258b=_0x23954b;_0x23b955=0xc8;}else{_0x23b955=0xce;}_0x1f2693['status'](_0x23b955);return _0x1f2693[_0xf144('0x25')](_0xf144('0x26'),_0x23ac2a+'-'+_0x4f258b+'/'+_0x23954b)[_0xf144('0x21')](_0x13a142);}return null;};}function patchUpdates(_0x406e56){return function(_0x1b2588){try{jsonpatch[_0xf144('0x27')](_0x1b2588,_0x406e56,!![]);}catch(_0xaea821){return BPromise[_0xf144('0x28')](_0xaea821);}return _0x1b2588['save']();};}function saveUpdates(_0x4352a9,_0x1a0c14){return function(_0x4adab2){if(_0x4adab2){return _0x4adab2['update'](_0x4352a9)['then'](function(_0x31e1e9){return _0x31e1e9;});}return null;};}function removeEntity(_0x5fdbef,_0x249fa0){return function(_0x30ef2e){if(_0x30ef2e){return _0x30ef2e[_0xf144('0x29')]()[_0xf144('0x2a')](function(){_0x5fdbef[_0xf144('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b71fb,_0x439a80){return function(_0x3c1830){if(!_0x3c1830){_0x2b71fb[_0xf144('0x2b')](0x194);}return _0x3c1830;};}function handleError(_0x8b632a,_0x40a2da){_0x40a2da=_0x40a2da||0x1f4;return function(_0x4a247c){logger['error'](_0x4a247c[_0xf144('0x2c')]);if(_0x4a247c[_0xf144('0x2d')]){delete _0x4a247c[_0xf144('0x2d')];}_0x8b632a['status'](_0x40a2da)[_0xf144('0x2e')](_0x4a247c);};}exports['index']=function(_0x434a09,_0x284689){var _0x4768ec={},_0xcb85c1={},_0x2611ef={'count':0x0,'rows':[]};var _0x103294=_['map'](db[_0xf144('0x2f')][_0xf144('0x30')],function(_0x1d4926){return{'name':_0x1d4926[_0xf144('0x31')],'type':_0x1d4926['type'][_0xf144('0x32')]};});_0xcb85c1[_0xf144('0x33')]=_[_0xf144('0x34')](_0x103294,_0xf144('0x2d'));_0xcb85c1['query']=_[_0xf144('0x35')](_0x434a09[_0xf144('0x36')]);_0xcb85c1[_0xf144('0x37')]=_[_0xf144('0x38')](_0xcb85c1['model'],_0xcb85c1[_0xf144('0x36')]);_0x4768ec['attributes']=_['intersection'](_0xcb85c1[_0xf144('0x33')],qs[_0xf144('0x39')](_0x434a09[_0xf144('0x36')][_0xf144('0x39')]));_0x4768ec['attributes']=_0x4768ec[_0xf144('0x3a')][_0xf144('0x3b')]?_0x4768ec['attributes']:_0xcb85c1[_0xf144('0x33')];if(!_0x434a09[_0xf144('0x36')][_0xf144('0x3c')](_0xf144('0x3d'))){_0x4768ec['limit']=qs[_0xf144('0x24')](_0x434a09['query'][_0xf144('0x24')]);_0x4768ec[_0xf144('0x22')]=qs[_0xf144('0x22')](_0x434a09[_0xf144('0x36')]['offset']);}_0x4768ec[_0xf144('0x3e')]=qs[_0xf144('0x3f')](_0x434a09[_0xf144('0x36')][_0xf144('0x3f')]);_0x4768ec[_0xf144('0x40')]=qs[_0xf144('0x37')](_['pick'](_0x434a09[_0xf144('0x36')],_0xcb85c1[_0xf144('0x37')]),_0x103294);if(_0x434a09[_0xf144('0x36')][_0xf144('0x41')]){_0x4768ec[_0xf144('0x40')]=_['merge'](_0x4768ec[_0xf144('0x40')],{'$or':_[_0xf144('0x34')](_0x103294,function(_0x581f0d){if(_0x581f0d[_0xf144('0x42')]!=='VIRTUAL'){var _0x320434={};_0x320434[_0x581f0d[_0xf144('0x2d')]]={'$like':'%'+_0x434a09[_0xf144('0x36')][_0xf144('0x41')]+'%'};return _0x320434;}})});}_0x4768ec=_[_0xf144('0x43')]({},_0x4768ec,_0x434a09[_0xf144('0x44')]);var _0x109c09={'where':_0x4768ec['where']};return db[_0xf144('0x2f')]['count'](_0x109c09)[_0xf144('0x2a')](function(_0x2711f7){_0x2611ef[_0xf144('0x45')]=_0x2711f7;if(_0x434a09[_0xf144('0x36')]['includeAll']){_0x4768ec[_0xf144('0x46')]=[{'all':!![]}];}return db['UserProfile'][_0xf144('0x47')](_0x4768ec);})[_0xf144('0x2a')](function(_0xb612aa){_0x2611ef[_0xf144('0x48')]=_0xb612aa;return _0x2611ef;})[_0xf144('0x2a')](respondWithFilteredResult(_0x284689,_0x4768ec))[_0xf144('0x49')](handleError(_0x284689,null));};exports[_0xf144('0x4a')]=function(_0x1e1999,_0x2f0598){var _0xab1246={'raw':![],'where':{'id':_0x1e1999[_0xf144('0x4b')]['id']}},_0x228a9a={};_0x228a9a[_0xf144('0x33')]=_[_0xf144('0x35')](db[_0xf144('0x2f')][_0xf144('0x30')]);_0x228a9a[_0xf144('0x36')]=_['keys'](_0x1e1999[_0xf144('0x36')]);_0x228a9a['filters']=_[_0xf144('0x38')](_0x228a9a[_0xf144('0x33')],_0x228a9a[_0xf144('0x36')]);_0xab1246[_0xf144('0x3a')]=_['intersection'](_0x228a9a[_0xf144('0x33')],qs[_0xf144('0x39')](_0x1e1999['query'][_0xf144('0x39')]));_0xab1246[_0xf144('0x3a')]=_0xab1246[_0xf144('0x3a')]['length']?_0xab1246[_0xf144('0x3a')]:_0x228a9a[_0xf144('0x33')];if(_0x1e1999[_0xf144('0x36')][_0xf144('0x4c')]){_0xab1246[_0xf144('0x46')]=[{'all':!![]}];}_0xab1246=_['merge']({},_0xab1246,_0x1e1999[_0xf144('0x44')]);return db[_0xf144('0x2f')][_0xf144('0x4d')](_0xab1246)[_0xf144('0x2a')](handleEntityNotFound(_0x2f0598,null))[_0xf144('0x2a')](respondWithResult(_0x2f0598,null))[_0xf144('0x49')](handleError(_0x2f0598,null));};exports[_0xf144('0x4e')]=function(_0x2b3bc8,_0x5154ba){return db[_0xf144('0x2f')][_0xf144('0x4e')](_0x2b3bc8['body'],{})['then'](respondWithResult(_0x5154ba,0xc9))['catch'](handleError(_0x5154ba,null));};exports[_0xf144('0x4f')]=function(_0x2f32c7,_0x2aa959){var _0x3e79e0={'where':{'id':_0x2f32c7['params']['id']}},_0x38e2e1={};_0x38e2e1['model']=_['keys'](db[_0xf144('0x2f')][_0xf144('0x30')]);_0x3e79e0[_0xf144('0x3a')]=_['intersection'](_0x38e2e1[_0xf144('0x33')],qs[_0xf144('0x39')](_0x2f32c7[_0xf144('0x36')][_0xf144('0x39')]));_0x3e79e0['attributes']=_0x3e79e0['attributes'][_0xf144('0x3b')]?_0x3e79e0[_0xf144('0x3a')]:_0x38e2e1[_0xf144('0x33')];if(_0x2f32c7[_0xf144('0x36')]['includeAll']){_0x3e79e0[_0xf144('0x46')]=[{'all':!![]}];}_0x3e79e0=_[_0xf144('0x43')]({},_0x3e79e0,_0x2f32c7[_0xf144('0x44')]);return db[_0xf144('0x2f')][_0xf144('0x4d')](_0x3e79e0)[_0xf144('0x2a')](handleEntityNotFound(_0x2aa959,null))[_0xf144('0x2a')](function(_0x383c7a){if(_0x383c7a){var _0x241f74=_0x383c7a[_0xf144('0x50')]({'plain':!![]});_0x241f74=qs[_0xf144('0x51')](_0x241f74,['id',_0xf144('0x52'),'updatedAt','crudPermissions']);_0x2f32c7[_0xf144('0x53')]=_['omit'](_0x2f32c7[_0xf144('0x53')],['id',_0xf144('0x52'),_0xf144('0x54')]);return db[_0xf144('0x55')][_0xf144('0x56')](function(_0x599ce8){return db[_0xf144('0x2f')][_0xf144('0x4e')](_[_0xf144('0x43')](_0x241f74,_0x2f32c7['body']),{'include':_0x2f32c7[_0xf144('0x36')][_0xf144('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x599ce8})[_0xf144('0x2a')](function(_0x2253e4){var _0x1075a5=_0x2253e4['get']({'plain':!![]});return db['UserProfileSection'][_0xf144('0x47')]({'where':{'userProfileId':_0x2f32c7[_0xf144('0x4b')]['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x50b74b){if(_0x50b74b){return BPromise[_0xf144('0x57')](_0x50b74b,function(_0x453862){return new BPromise(function(_0xccc957,_0x1de874){if(_0x453862[_0xf144('0x58')]===null||_0x453862['autoAssociation']===0x1)_0xccc957(null);return db[_0xf144('0x59')][_0xf144('0x47')]({'where':{'sectionId':_0x453862['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x3aed22){var _0x213cce=_[_0xf144('0x34')](_0x3aed22,function(_0x2066df){return qs[_0xf144('0x51')](_0x2066df,['id',_0xf144('0x52'),_0xf144('0x54'),_0xf144('0x5a')]);});_0xccc957(_0x213cce);})[_0xf144('0x49')](function(_0x28ad12){_0x1de874(_0x28ad12);});})[_0xf144('0x2a')](function(_0x5f3027){var _0x39bb4c=qs[_0xf144('0x51')](_0x453862,['id',_0xf144('0x52'),_0xf144('0x54')]);_0x39bb4c[_0xf144('0x5b')]=_0x1075a5['id'];if(_0x5f3027)_0x39bb4c[_0xf144('0x5c')]=_0x5f3027;return _0x39bb4c;})[_0xf144('0x2a')](function(_0x467a77){return db[_0xf144('0x5d')][_0xf144('0x4e')](_0x467a77,{'include':[{'model':db['UserProfileResource'],'as':_0xf144('0x5c')}],'raw':!![],'transaction':_0x599ce8});});})['then'](function(){return _0x1075a5;});}});});});}})['then'](respondWithResult(_0x2aa959,0xc9))[_0xf144('0x49')](handleError(_0x2aa959,null));};exports['update']=function(_0x142ab5,_0x2aab29){if(_0x142ab5[_0xf144('0x53')]['id']){delete _0x142ab5[_0xf144('0x53')]['id'];}return db[_0xf144('0x2f')][_0xf144('0x4d')]({'where':{'id':_0x142ab5[_0xf144('0x4b')]['id']}})[_0xf144('0x2a')](handleEntityNotFound(_0x2aab29,null))[_0xf144('0x2a')](saveUpdates(_0x142ab5[_0xf144('0x53')],null))['then'](respondWithResult(_0x2aab29,null))['catch'](handleError(_0x2aab29,null));};exports[_0xf144('0x29')]=function(_0x2d463c,_0x15a51f){return db[_0xf144('0x2f')][_0xf144('0x4d')]({'where':{'id':_0x2d463c[_0xf144('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15a51f,null))[_0xf144('0x2a')](removeEntity(_0x15a51f,null))[_0xf144('0x49')](handleError(_0x15a51f,null));};exports['describe']=function(_0x2be478,_0x561361){return db[_0xf144('0x2f')][_0xf144('0x5e')]()['then'](respondWithResult(_0x561361,null))[_0xf144('0x49')](handleError(_0x561361,null));};exports[_0xf144('0x5f')]=function(_0x2522b2,_0x13a300){var _0x3971bc=_0x2522b2[_0xf144('0x53')];return db['UserProfile'][_0xf144('0x4d')]({'where':{'id':_0x2522b2[_0xf144('0x4b')]['id']}})[_0xf144('0x2a')](handleEntityNotFound(_0x13a300,null))[_0xf144('0x2a')](function(_0x1ca49c){if(_0x1ca49c){return db[_0xf144('0x55')]['transaction'](function(_0x39eef1){return db[_0xf144('0x5d')][_0xf144('0x29')]({'where':{'userProfileId':_0x2522b2[_0xf144('0x4b')]['id'],'sectionId':_[_0xf144('0x34')](_0x3971bc,function(_0x2bb546){return _0x2bb546[_0xf144('0x5a')];})},'transaction':_0x39eef1})['then'](function(){var _0x34815c=_['map'](_0x3971bc,function(_0xd2655f){_0xd2655f[_0xf144('0x5b')]=_0x2522b2[_0xf144('0x4b')]['id'];return _0xd2655f;});var _0x196336=[];return BPromise[_0xf144('0x57')](_0x34815c,function(_0x2636a6){return db[_0xf144('0x5d')][_0xf144('0x4e')](_0x2636a6,{'include':[{'model':db[_0xf144('0x59')],'as':_0xf144('0x5c')}],'raw':!![],'transaction':_0x39eef1})[_0xf144('0x2a')](function(_0x579a07){_0x196336[_0xf144('0x60')](_0x579a07['get']({'plain':!![]}));});})[_0xf144('0x2a')](function(){return _0x196336;});});});}})[_0xf144('0x2a')](function(_0x5c2471){return _0x5c2471;})[_0xf144('0x2a')](respondWithResult(_0x13a300,null))[_0xf144('0x49')](handleError(_0x13a300,null));};exports['removeSections']=function(_0x3b949a,_0x5f2498){var _0x2d4bf7;return db['UserProfile'][_0xf144('0x4d')]({'where':{'id':_0x3b949a['params']['id']},'attributes':['id','name']})[_0xf144('0x2a')](handleEntityNotFound(_0x5f2498,null))[_0xf144('0x2a')](function(_0x2fc16a){if(_0x2fc16a){_0x2d4bf7=_0x2fc16a;return db[_0xf144('0x5d')][_0xf144('0x29')]({'where':{'userProfileId':_0x3b949a[_0xf144('0x4b')]['id'],'sectionId':_0x3b949a[_0xf144('0x36')][_0xf144('0x61')]}});}})[_0xf144('0x2a')](function(){return _0x2d4bf7;})['then'](respondWithStatusCode(_0x5f2498,null))[_0xf144('0x49')](handleError(_0x5f2498,null));};exports['getSections']=function(_0x3253de,_0x14b2e0){var _0x36d1ed=[];var _0x5a25e7=[];return db[_0xf144('0x5d')][_0xf144('0x47')]({'where':{'userProfileId':_0x3253de[_0xf144('0x4b')]['id']},'raw':!![]})['then'](function(_0x148dfc){_0x36d1ed=_[_0xf144('0x41')](_0x148dfc,function(_0x3accaf){return _0x3accaf[_0xf144('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x3accaf[_0xf144('0x5a')]);});if(!_[_0xf144('0x63')](_0x36d1ed)){return _['map'](_0x36d1ed,function(_0x1c4735){return _0x1c4735['sectionId'];});}else{return;}})[_0xf144('0x2a')](function(_0x4da97f){if(_0x4da97f)_0x5a25e7=_0x4da97f;if(_[_0xf144('0x64')](_0x5a25e7,0x64)){var _0x41896d=_[_0xf144('0x4d')](_0x36d1ed,{'sectionId':0x64});return hasDefaultDashboard(_0x41896d)[_0xf144('0x2a')](function(_0x34a00c){return _[_0xf144('0x34')](_0x36d1ed,function(_0x13b78c){if(_0x13b78c[_0xf144('0x5a')]===0x64){_0x13b78c[_0xf144('0x65')]=_0x34a00c;}return _0x13b78c;});});}else{return;}})[_0xf144('0x2a')](function(_0x1ba5c7){if(_0x1ba5c7)_0x36d1ed=_0x1ba5c7;if(_[_0xf144('0x64')](_0x5a25e7,0x3eb)){var _0xb6ea2d=_[_0xf144('0x4d')](_0x36d1ed,{'sectionId':0x3eb});return getCustomDashboards(_0xb6ea2d)['then'](function(_0x499357){return _['map'](_0x36d1ed,function(_0x226622){if(_0xb6ea2d['enabled']){if(_0x226622[_0xf144('0x5a')]===0x3eb){_0x226622[_0xf144('0x65')]=_0x499357;}}else{if(_0x226622[_0xf144('0x5a')]===0x64){_0x226622[_0xf144('0x65')]=_0x499357;}}return _0x226622;});});}else{return;}})[_0xf144('0x2a')](function(_0x1f5633){if(_0x1f5633)_0x36d1ed=_0x1f5633;if(_[_0xf144('0x64')](_0x5a25e7,0x709)){var _0xeabfc6=_[_0xf144('0x4d')](_0x36d1ed,{'sectionId':0x709});return getPlugins(_0xeabfc6)[_0xf144('0x2a')](function(_0x2ddef6){if(_0xeabfc6[_0xf144('0x62')]){return _['map'](_0x36d1ed,function(_0x149072){if(_0x149072[_0xf144('0x5a')]===0x709){_0x149072[_0xf144('0x65')]=_0x2ddef6;}return _0x149072;});}else{var _0x49d607={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2ddef6};var _0x196d38=_[_0xf144('0x34')](_0x36d1ed);_0x196d38[_0xf144('0x60')](_0x49d607);return _0x196d38;}});}else{return;}})['then'](function(_0x598771){if(_0x598771)_0x36d1ed=_0x598771;return _[_0xf144('0x41')](_0x36d1ed,[_0xf144('0x62'),0x1]);})[_0xf144('0x2a')](respondWithResult(_0x14b2e0,null))[_0xf144('0x49')](handleError(_0x14b2e0,null));};function hasDefaultDashboard(_0x374a75){var _0xca7859=[0x65];return new BPromise(function(_0x1faf98,_0x580024){try{if(_0x374a75[_0xf144('0x58')]){_0x1faf98(_0xca7859);}else{return db[_0xf144('0x59')][_0xf144('0x66')]({'where':{'sectionId':_0x374a75['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x4eaffb){_0x4eaffb?_0x1faf98(_0xca7859):_0x1faf98();});}}catch(_0x56533f){_0x580024(_0x56533f);}});}function getCustomDashboards(_0x7eac63){var _0x278dde=[];return new BPromise(function(_0x514377,_0x48c587){try{if(_0x7eac63[_0xf144('0x58')]){return db[_0xf144('0x67')]['findAll']({'raw':!![]})['then'](function(_0x48f35e){_0x48f35e[_0xf144('0x68')](function(_0x44f8c9){_0x278dde[_0xf144('0x60')](_0x44f8c9['id']+0x1869f);});_0x514377(_0x278dde);});}else{return db[_0xf144('0x59')]['findAll']({'where':{'sectionId':_0x7eac63['id']},'raw':!![]})['then'](function(_0x5721c9){_0x5721c9[_0xf144('0x68')](function(_0xe6a0c0){_0x278dde['push'](_0xe6a0c0[_0xf144('0x69')]+0x1869f);});_0x514377(_0x278dde);});}}catch(_0x120dda){_0x48c587(_0x120dda);}});}function getPlugins(_0x2e1dd7){var _0x2b6f61=[];return new BPromise(function(_0x4b1c5b,_0x2d740d){try{if(_0x2e1dd7[_0xf144('0x58')]){return db[_0xf144('0x6a')][_0xf144('0x47')]({'raw':!![]})[_0xf144('0x2a')](function(_0x4e6cfa){_0x4e6cfa[_0xf144('0x68')](function(_0x5b34d2){_0x2b6f61[_0xf144('0x60')](_0x5b34d2['id']+0x15b38);});_0x4b1c5b(_0x2b6f61);});}else{return db[_0xf144('0x59')][_0xf144('0x47')]({'where':{'sectionId':_0x2e1dd7['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x21c7e6){_0x21c7e6[_0xf144('0x68')](function(_0xfebd80){_0x2b6f61[_0xf144('0x60')](_0xfebd80[_0xf144('0x69')]+0x15b38);});_0x4b1c5b(_0x2b6f61);});}}catch(_0x21035e){_0x2d740d(_0x21035e);}});}exports[_0xf144('0x6b')]=function(_0x11ef31,_0x370e5f){return db['UserProfile']['find']({'where':{'id':_0x11ef31[_0xf144('0x4b')]['id']}})['then'](handleEntityNotFound(_0x370e5f,null))[_0xf144('0x2a')](function(_0x5e7321){if(_0x5e7321){return db[_0xf144('0x55')][_0xf144('0x56')](function(_0x25295f){return db[_0xf144('0x5d')][_0xf144('0x47')]({'where':{'userProfileId':_0x11ef31[_0xf144('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0xf144('0x2a')](function(_0x10e3a2){if(_0x10e3a2){return db[_0xf144('0x5d')][_0xf144('0x29')]({'where':{'userProfileId':_0x11ef31[_0xf144('0x4b')]['id'],'id':_['map'](_0x10e3a2,function(_0x53836c){return _0x53836c['id'];})},'transaction':_0x25295f});}})['then'](function(_0x49c836){var _0x18e2d3=_[_0xf144('0x34')](_0x11ef31[_0xf144('0x53')],function(_0x29a56e){_0x29a56e[_0xf144('0x5b')]=_0x11ef31[_0xf144('0x4b')]['id'];return _0x29a56e;});return db['UserProfileSection'][_0xf144('0x6c')](_0x18e2d3,{'raw':!![],'transaction':_0x25295f});})[_0xf144('0x2a')](function(_0x43150b){var _0x4d7629=_[_0xf144('0x41')](_['map'](_0x43150b,function(_0x49d58c){return _0x49d58c[_0xf144('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x4d7629){return db[_0xf144('0x5d')][_0xf144('0x47')]({'where':{'userProfileId':_0x11ef31[_0xf144('0x4b')]['id'],'sectionId':_['map'](_0x4d7629,function(_0x440b25){return _0x440b25[_0xf144('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x5b4740){var _0x15c95b=_[_0xf144('0x34')](_0x11ef31[_0xf144('0x53')],function(_0x507a6c){_0x507a6c['userProfileId']=_0x11ef31[_0xf144('0x4b')]['id'];return _0x507a6c;});return db[_0xf144('0x59')][_0xf144('0x6c')](_0x15c95b,{'raw':!![],'transaction':_0x25295f});});}})[_0xf144('0x49')](handleError(_0x370e5f,null));});}})[_0xf144('0x2a')](function(_0x346619){var _0x100069=_[_0xf144('0x34')](_0x346619,function(_0x3eafbf){return _0x3eafbf[_0xf144('0x50')]({'plain':!![]});});})[_0xf144('0x2a')](respondWithResult(_0x370e5f,null))[_0xf144('0x49')](handleError(_0x370e5f,null));};exports[_0xf144('0x6d')]=function(_0x481c46,_0x245932,_0x9f3464){return db['UserProfile'][_0xf144('0x4d')]({'where':{'id':_0x481c46[_0xf144('0x4b')]['id']}})[_0xf144('0x2a')](handleEntityNotFound(_0x245932,null))[_0xf144('0x2a')](function(_0x1b7a4e){if(_0x1b7a4e){return _0x1b7a4e[_0xf144('0x6d')](_0x481c46['query']['ids']);}})[_0xf144('0x2a')](respondWithStatusCode(_0x245932,null))[_0xf144('0x49')](handleError(_0x245932,null));};exports[_0xf144('0x6e')]=function(_0xe97675,_0x16719e){var _0x13cd8a={'raw':![],'where':{}};var _0x3e0994={};var _0x3bb1e4={'count':0x0,'rows':[]};var _0x49c40f=_0xe97675[_0xf144('0x36')][_0xf144('0x6f')];if(typeof _0x49c40f===_0xf144('0x23')){throw new db[(_0xf144('0x70'))][(_0xf144('0x71'))]('Unknown\x20section');}var _0x44f45b=_0xe97675['query'][_0xf144('0x72')]||![];var _0x3bf614=getQueryModels(_0x49c40f,_0x44f45b);if(typeof _0x3bf614['childModel']===_0xf144('0x23')){throw new db['Sequelize']['ValidationError']('Invalid\x20section\x20\x27'+_0x49c40f+'\x27');}var _0x22e835=[];if(!_[_0xf144('0x63')](_0x3bf614[_0xf144('0x73')])){_0x22e835=_0x3bf614[_0xf144('0x73')];}else{_0x22e835=[{'name':_0x49c40f}];}return db['UserProfile'][_0xf144('0x66')]({'where':{'id':_0xe97675[_0xf144('0x4b')]['id']}})['then'](handleEntityNotFound(_0x16719e,null))['then'](function(_0x307179){if(_0x307179){var _0x301102=[];for(var _0x373f56=0x0;_0x373f56<_0x22e835[_0xf144('0x3b')];_0x373f56++){_0x301102[_0xf144('0x60')](db[_0xf144('0x5d')][_0xf144('0x66')]({'where':{'userProfileId':_0x307179['id'],'name':_0x22e835[_0x373f56][_0xf144('0x2d')]},'raw':!![]}));}return BPromise[_0xf144('0x74')](_0x301102);}})[_0xf144('0x2a')](function(_0x31c096){var _0x4ce121=_[_0xf144('0x41')](_0x31c096,function(_0x4ecc45){return _0x4ecc45?_0x4ecc45:undefined;});var _0x3a33af=_['filter'](_0x22e835,[_0xf144('0x75'),!![]]);var _0x5c11ca=_[_0xf144('0x63')](_0x4ce121)&&_[_0xf144('0x63')](_0x3a33af)?null:_[_0xf144('0x76')](_0x3a33af,_0x4ce121);if(_0x5c11ca){var _0x559fe6=[];for(var _0x4d6261=0x0;_0x4d6261<_0x5c11ca[_0xf144('0x3b')];_0x4d6261++){var _0x587e9e=_[_0xf144('0x4d')](_0x22e835,function(_0x3520d4){return _0x5c11ca[_0x4d6261]?_0x3520d4[_0xf144('0x2d')]===_0x5c11ca[_0x4d6261][_0xf144('0x2d')]:null;});if(_0x587e9e){if(_0x5c11ca[_0x4d6261][_0xf144('0x75')]){_0x559fe6[_0xf144('0x60')](getAllResources(_0x3bf614[_0xf144('0x77')],_0x5c11ca[_0x4d6261]));}else{if(!_0x5c11ca[_0x4d6261][_0xf144('0x58')]){_0x559fe6[_0xf144('0x60')](getAllowedResources(_0x587e9e,_0x5c11ca[_0x4d6261],_0x3bf614['childModel']));}else{if(_0x587e9e[_0xf144('0x33')]){_0x559fe6[_0xf144('0x60')](getAllFilteredResources(_0x587e9e,_0x5c11ca[_0x4d6261]));}}}}}return BPromise['all'](_0x559fe6);}else{return null;}})[_0xf144('0x2a')](function(_0x2d8f77){var _0x3eb5ec=_0x2d8f77;var _0x2c3ab0=null;if(_0x3eb5ec){_0x2c3ab0=_0x3eb5ec[_0xf144('0x3b')]===0x1?_0x3eb5ec[0x0]:null;}if(_0x2c3ab0||_0x3eb5ec){var _0x34a11a=db[_0x3bf614[_0xf144('0x77')]][_0xf144('0x30')];_0x3e0994[_0xf144('0x33')]=_[_0xf144('0x35')](_0x34a11a);_0x3e0994[_0xf144('0x36')]=_[_0xf144('0x35')](_0xe97675[_0xf144('0x36')]);_0x3e0994[_0xf144('0x37')]=_[_0xf144('0x38')](_0x3e0994[_0xf144('0x33')],_0x3e0994[_0xf144('0x36')]);_0x13cd8a[_0xf144('0x3a')]=_[_0xf144('0x38')](_0x3e0994[_0xf144('0x33')],qs[_0xf144('0x39')](_0xe97675[_0xf144('0x36')][_0xf144('0x39')]));_0x13cd8a[_0xf144('0x3a')]=_0x13cd8a[_0xf144('0x3a')][_0xf144('0x3b')]?_0x13cd8a[_0xf144('0x3a')]:_0x3e0994['model'];if(!_0xe97675[_0xf144('0x36')][_0xf144('0x3c')]('nolimit')){_0x13cd8a[_0xf144('0x24')]=qs[_0xf144('0x24')](_0xe97675['query']['limit']);_0x13cd8a[_0xf144('0x22')]=qs[_0xf144('0x22')](_0xe97675[_0xf144('0x36')][_0xf144('0x22')]);}_0x13cd8a[_0xf144('0x3e')]=qs['sort'](_0xe97675[_0xf144('0x36')][_0xf144('0x3f')]);_0x13cd8a[_0xf144('0x40')]=qs['filters'](_[_0xf144('0x78')](_0xe97675[_0xf144('0x36')],_0x3e0994['filters']));if(_0xe97675[_0xf144('0x36')][_0xf144('0x41')]){_0x13cd8a[_0xf144('0x40')]=_['merge'](_0x13cd8a[_0xf144('0x40')],{'$or':_[_0xf144('0x34')](_0x34a11a,function(_0x56856d){if(_0x56856d[_0xf144('0x42')][_0xf144('0x32')]!==_0xf144('0x79')){var _0x5ac44e={};_0x5ac44e[_0x56856d[_0xf144('0x7a')]]={'$like':'%'+_0xe97675['query'][_0xf144('0x41')]+'%'};return _0x5ac44e;}})});}var _0x4aac6f=[];if(_0x2c3ab0){var _0x39e72e=_[_0xf144('0x4d')](_0x22e835,[_0xf144('0x2d'),_0x2c3ab0[_0xf144('0x2d')]]);if(_0x39e72e[_0xf144('0x7a')]){var _0x4a3a80={};if(_0x3bf614[_0xf144('0x77')]===_0xf144('0x7b')){_0x4a3a80[_0x39e72e[_0xf144('0x7c')]]=_[_0xf144('0x34')](_0x2c3ab0['associatedResources'],'id');}else{_0x4a3a80[_0x39e72e[_0xf144('0x7c')]]=_0x2c3ab0[_0xf144('0x7d')];}_0x4aac6f[_0xf144('0x60')](_0x4a3a80);}else{_0x13cd8a['where']['id']=_0x2c3ab0['associatedResources'];}}else{for(var _0x565ffc=0x0;_0x565ffc<_0x3eb5ec['length'];_0x565ffc++){var _0x39e72e=_['find'](_0x22e835,[_0xf144('0x2d'),_0x3eb5ec[_0x565ffc]['name']]);if(_0x39e72e[_0xf144('0x7a')]){var _0x4a3a80={};_0x4a3a80[_0x39e72e['foreignKey']]=_0x3eb5ec[_0x565ffc][_0xf144('0x7d')];_0x4aac6f[_0xf144('0x60')](_0x4a3a80);}else{if(!_0x13cd8a[_0xf144('0x40')]['id'])_0x13cd8a[_0xf144('0x40')]['id']=[];_0x3eb5ec[_0x565ffc][_0xf144('0x7d')]['forEach'](function(_0x5f3571){_0x13cd8a[_0xf144('0x40')]['id'][_0xf144('0x60')](_0x5f3571);});}}}if(!_[_0xf144('0x63')](_0x4aac6f)){_0x13cd8a[_0xf144('0x40')]=_[_0xf144('0x43')](_0x13cd8a[_0xf144('0x40')],{'$and':{'$or':_0x4aac6f}});}_0x13cd8a=_[_0xf144('0x43')]({},_0x13cd8a,_0xe97675[_0xf144('0x44')]);if(_0x2c3ab0&&!_0x2c3ab0[_0xf144('0x58')]&&_0x3bf614['childModel']==='AnalyticExtractedReport'){if(_0xe97675[_0xf144('0x36')]['includeAll']){_0x13cd8a[_0xf144('0x46')]=[{'all':!![]}];}return db[_0x3bf614['childModel']][_0xf144('0x47')](_0x13cd8a)[_0xf144('0x2a')](function(_0x39a168){var _0x21d7b1=[];_0x39a168[_0xf144('0x68')](function(_0x5363b5){var _0x198af9;switch(_0x5363b5[_0xf144('0x7e')]){case'default':_0x198af9=_[_0xf144('0x4d')](_0x2c3ab0[_0xf144('0x7d')],function(_0x1cdf4b){return _0x1cdf4b['id']===_0x5363b5[_0xf144('0x7f')]&&_0x1cdf4b[_0xf144('0x42')]===_0xf144('0x80');});break;case'custom':_0x198af9=_[_0xf144('0x4d')](_0x2c3ab0[_0xf144('0x7d')],function(_0x4a1223){return _0x4a1223['id']===_0x5363b5['reportId']&&_0x4a1223['type']===_0xf144('0x81');});break;}if(_0x198af9)_0x21d7b1[_0xf144('0x60')](_0x5363b5);});_0x3bb1e4['count']=_0x21d7b1[_0xf144('0x3b')];_0x3bb1e4[_0xf144('0x48')]=_0x21d7b1;return _0x3bb1e4;});}else{return db[_0x3bf614[_0xf144('0x77')]][_0xf144('0x45')]({'where':_0x13cd8a[_0xf144('0x40')]})[_0xf144('0x2a')](function(_0xe8bd0f){_0x3bb1e4[_0xf144('0x45')]=_0xe8bd0f;if(_0xe97675[_0xf144('0x36')][_0xf144('0x4c')]){if(_0x3bf614[_0xf144('0x77')]===_0xf144('0x82')){_0x13cd8a[_0xf144('0x46')]=[{'model':db[_0xf144('0x83')],'as':'Tags','attributes':['id',_0xf144('0x2d'),_0xf144('0x84')],'required':_0xe97675['query'][_0xf144('0x85')]?!![]:![]},{'model':db[_0xf144('0x83')],'as':_0xf144('0x86'),'attributes':['id',_0xf144('0x2d'),'color'],'through':_0xe97675[_0xf144('0x36')][_0xf144('0x85')]?{'attributes':[],'where':{'TagId':_0xe97675[_0xf144('0x36')]['tag']||undefined}}:{},'required':_0xe97675[_0xf144('0x36')][_0xf144('0x85')]?!![]:![]}];}else{_0x13cd8a[_0xf144('0x46')]=[{'all':!![]}];}}return db[_0x3bf614[_0xf144('0x77')]]['findAll'](_0x13cd8a);})[_0xf144('0x2a')](function(_0x3e83db){_0x3bb1e4['rows']=_0x3e83db;if(_0x49c40f===_0xf144('0x87')&&_0xe97675[_0xf144('0x36')][_0xf144('0x88')]===_0xf144('0x89')){var _0x4c306f=[];for(var _0x24935e=0x0;_0x24935e<_0x3bb1e4[_0xf144('0x48')][_0xf144('0x3b')];_0x24935e++){_0x4c306f[_0xf144('0x60')](getOpenTabs(_0xf144('0x8a'),_0x3bb1e4[_0xf144('0x48')][_0x24935e][_0xf144('0x8b')]));_0x4c306f[_0xf144('0x60')](getOpenTabs('sms',_0x3bb1e4[_0xf144('0x48')][_0x24935e][_0xf144('0x8b')]));_0x4c306f['push'](getOpenTabs(_0xf144('0x8c'),_0x3bb1e4[_0xf144('0x48')][_0x24935e][_0xf144('0x8b')]));_0x4c306f[_0xf144('0x60')](getOpenTabs(_0xf144('0x8d'),_0x3bb1e4[_0xf144('0x48')][_0x24935e][_0xf144('0x8b')]));_0x4c306f[_0xf144('0x60')](getOpenTabs(_0xf144('0x8e'),_0x3bb1e4['rows'][_0x24935e][_0xf144('0x8b')]));_0x4c306f['push'](getOpenTabs(_0xf144('0x8f'),_0x3bb1e4[_0xf144('0x48')][_0x24935e]['dataValues']));}return Promise['all'](_0x4c306f)[_0xf144('0x2a')](function(){return _0x3bb1e4;});}return _0x3bb1e4;});}}else{return _0x3bb1e4;}})[_0xf144('0x2a')](respondWithFilteredResult(_0x16719e,_0x13cd8a))[_0xf144('0x49')](handleError(_0x16719e,null));};function getOpenTabs(_0x495ad7,_0x1c7f36){var _0x21e78e=_0x495ad7[_0xf144('0x90')](0x0)[_0xf144('0x91')]()+_0x495ad7[_0xf144('0x92')](0x1);var _0x36a641={'type':db['Sequelize'][_0xf144('0x93')][_0xf144('0x94')],'raw':!![]};return new BPromise(function(_0x57122b,_0x45ad97){var _0x1b3d16=squel[_0xf144('0x95')]()[_0xf144('0x7a')](_0xf144('0x96')+_0x21e78e+_0xf144('0x97'),'id')[_0xf144('0x7a')]('ui.createdAt')[_0xf144('0x98')](_0xf144('0x99')+_0x495ad7+_0xf144('0x9a'),'ui')[_0xf144('0x40')]('ui.UserId\x20=\x20?',_0x1c7f36['id']);return db[_0xf144('0x55')][_0xf144('0x36')](_0x1b3d16[_0xf144('0x9b')](),_0x36a641)[_0xf144('0x2a')](function(_0x4edd88){_0x1c7f36[_0x21e78e+_0xf144('0x9c')]=_0x4edd88;_0x57122b(_0x4edd88);})[_0xf144('0x49')](function(_0x1a19b8){_0x45ad97(_0x1a19b8);});});}function getAllResources(_0x2ccca9,_0x19f63e){return new BPromise(function(_0x37d81f,_0x4ccb30){if(_0x19f63e){var _0x111c25=_0x19f63e['filter']?{[_0x19f63e[_0xf144('0x41')][_0xf144('0x7a')]]:_0x19f63e['filter'][_0xf144('0x9d')]}:undefined;return db[_0x2ccca9][_0xf144('0x47')]({'where':_0x111c25,'raw':!![]})['then'](function(_0x35b1c5){_0x19f63e[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x35b1c5,'id');_0x37d81f(_0x19f63e);})[_0xf144('0x49')](function(_0x25cdfd){_0x4ccb30(_0x25cdfd);});}else{_0x37d81f(null);}});}function getAllFilteredResources(_0x44b2ef,_0x4bafce){return new BPromise(function(_0x547c30,_0x3c1ad7){var _0x5c6058=_0x44b2ef[_0xf144('0x41')]?{[_0x44b2ef[_0xf144('0x41')][_0xf144('0x7a')]]:_0x44b2ef['filter'][_0xf144('0x9d')]}:undefined;return db[_0x44b2ef[_0xf144('0x33')]][_0xf144('0x47')]({'where':_0x5c6058,'raw':!![]})[_0xf144('0x2a')](function(_0x59ab53){_0x4bafce[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x59ab53,function(_0x117212){return _0x44b2ef['field']?_0x117212[_0x44b2ef[_0xf144('0x7a')]]:_0x117212['name'];});_0x547c30(_0x4bafce);})[_0xf144('0x49')](function(_0x4036c5){_0x3c1ad7(_0x4036c5);});});}function getAllowedResources(_0x2fb6f4,_0x95502b,_0x2c693b){return new BPromise(function(_0x4af798,_0x7d2533){if(_0x95502b){return db['UserProfileResource'][_0xf144('0x47')]({'where':{'sectionId':_0x95502b['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x235c94){if(_0x2fb6f4[_0xf144('0x7a')]&&_0x2fb6f4['field']!=='id'){_0x95502b[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x235c94,function(_0x3867bc){return _0x3867bc[_0x2fb6f4[_0xf144('0x7a')]];});}else{if(_0x2c693b===_0xf144('0x7b')){_0x95502b[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x235c94,function(_0x4b7591){return{'id':_0x4b7591[_0xf144('0x69')],'type':_0x4b7591[_0xf144('0x42')]};});}else{_0x95502b[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x235c94,function(_0x197c32){return _0x197c32[_0xf144('0x69')];});}}_0x4af798(_0x95502b);})['catch'](function(_0x29d6d5){_0x7d2533(_0x29d6d5);});}else{_0x4af798(null);}});}function getQueryModels(_0x549f51,_0x27b18c){var _0x592305=_0x549f51[_0xf144('0x9e')]();var _0x546bf1={'childModel':undefined,'parentSections':[]};switch(_0x592305){case _0xf144('0x9f'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xa0');break;case _0xf144('0xa1'):_0x546bf1[_0xf144('0x77')]='SquareOdbc';break;case _0xf144('0xa2'):_0x546bf1['childModel']=_0xf144('0xa3');_0x546bf1['parentSections']=[{'name':_0xf144('0xa4'),'field':_0xf144('0x2d'),'foreignKey':_0xf144('0xa5')}];break;case _0xf144('0xa6'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xa7');break;case _0xf144('0xa8'):_0x546bf1[_0xf144('0x77')]='CmContact';_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0xa9'),'field':'id','foreignKey':_0xf144('0xaa')}];break;case _0xf144('0xab'):_0x546bf1['childModel']=_0xf144('0xac');break;case _0xf144('0xad'):_0x546bf1[_0xf144('0x77')]='CmCompany';break;case _0xf144('0xae'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xaf');break;case'chatqueues':_0x546bf1[_0xf144('0x77')]='ChatQueue';break;case'chatwebsites':_0x546bf1[_0xf144('0x77')]=_0xf144('0xb0');break;case _0xf144('0xb1'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xb2');break;case _0xf144('0xb3'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xb4');break;case'inboundroutes':case _0xf144('0xb5'):case _0xf144('0xb6'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xb7');break;case _0xf144('0xb8'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xb9');break;case _0xf144('0xba'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xbb');break;case _0xf144('0xbc'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xbd');_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0x87'),'field':_0xf144('0x2d'),'foreignKey':_0xf144('0xbe'),'model':_0xf144('0xbf'),'filter':{'field':_0xf144('0xc0'),'value':[_0xf144('0xc1')]}},{'name':_0xf144('0xc2'),'field':'name','foreignKey':_0xf144('0xbe'),'model':_0xf144('0xbf'),'filter':{'field':_0xf144('0xc0'),'value':[_0xf144('0xc3')]}},{'name':'VoiceQueues','field':_0xf144('0x2d'),'foreignKey':'queue','model':_0xf144('0xc4'),'filter':{'field':_0xf144('0x42'),'value':[_0xf144('0xc5')]}},{'name':'QueueCampaigns','field':_0xf144('0x2d'),'foreignKey':'queue','model':_0xf144('0xc4'),'filter':{'field':'type','value':[_0xf144('0xc6')]}}];break;case _0xf144('0xc7'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xc8');break;case'chanspies':_0x546bf1['childModel']=_0xf144('0xc9');break;case _0xf144('0xca'):_0x546bf1['childModel']=_0xf144('0xcb');break;case _0xf144('0xcc'):_0x546bf1[_0xf144('0x77')]='Campaign';break;case'mailqueues':_0x546bf1[_0xf144('0x77')]=_0xf144('0xcd');break;case'mailaccounts':_0x546bf1[_0xf144('0x77')]=_0xf144('0xce');break;case _0xf144('0xcf'):_0x546bf1[_0xf144('0x77')]='MailSubstatus';break;case _0xf144('0xd0'):_0x546bf1[_0xf144('0x77')]='OpenchannelQueue';break;case _0xf144('0xd1'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xd2');break;case'smsqueues':_0x546bf1['childModel']=_0xf144('0xd3');break;case'smsaccounts':_0x546bf1[_0xf144('0x77')]='SmsAccount';break;case _0xf144('0xd4'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xd5');break;case _0xf144('0xd6'):_0x546bf1[_0xf144('0x77')]='Team';break;case _0xf144('0xd7'):case _0xf144('0xd8'):_0x546bf1['childModel']=_0xf144('0xc4');if(_0x27b18c){_0x546bf1[_0xf144('0x73')]=[{'name':'VoiceQueues'},{'name':_0xf144('0xd9')}];}break;case _0xf144('0xda'):case _0xf144('0xdb'):case _0xf144('0xdc'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xbf');if(_0x27b18c){_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0xdd'),'filter':{'field':_0xf144('0xc0'),'value':[_0xf144('0xde'),_0xf144('0xdf')]},'ignore':!![]},{'name':_0xf144('0x87')},{'name':_0xf144('0xc2')}];}break;case _0xf144('0xe0'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xe1');break;case _0xf144('0xe2'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xe3');break;case _0xf144('0xe4'):_0x546bf1['childModel']='FreshdeskAccount';break;case _0xf144('0xe5'):_0x546bf1[_0xf144('0x77')]='SugarcrmAccount';break;case _0xf144('0xe6'):_0x546bf1[_0xf144('0x77')]='DeskAccount';break;case _0xf144('0xe7'):_0x546bf1[_0xf144('0x77')]='ZohoAccount';break;case'vtigeraccounts':_0x546bf1[_0xf144('0x77')]=_0xf144('0xbf');break;case'cannedanswers':_0x546bf1[_0xf144('0x77')]='CannedAnswer';break;case _0xf144('0xe8'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xe9');break;case _0xf144('0xea'):_0x546bf1[_0xf144('0x77')]=_0xf144('0x67');break;case _0xf144('0xeb'):_0x546bf1[_0xf144('0x77')]='Interval';break;case _0xf144('0xec'):_0x546bf1['childModel']=_0xf144('0xed');break;case _0xf144('0xee'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xef');break;case _0xf144('0xf0'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xf1');break;case _0xf144('0xf2'):_0x546bf1[_0xf144('0x77')]=_0xf144('0x83');break;case'templates':_0x546bf1[_0xf144('0x77')]='Template';break;case'triggers':_0x546bf1[_0xf144('0x77')]=_0xf144('0xf3');break;case _0xf144('0xf4'):_0x546bf1['childModel']='Trunk';break;case _0xf144('0xf5'):_0x546bf1['childModel']=_0xf144('0xf6');break;case'plugins':_0x546bf1[_0xf144('0x77')]=_0xf144('0x6a');break;case _0xf144('0xf7'):_0x546bf1[_0xf144('0x77')]=_0xf144('0x7b');_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0xf8'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x546bf1[_0xf144('0x77')]=_0xf144('0xf9');break;case _0xf144('0xfa'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xfb');break;case _0xf144('0xfc'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xfd');_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0x87'),'field':'id','foreignKey':_0xf144('0xfe'),'model':'User','filter':{'field':_0xf144('0xc0'),'value':[_0xf144('0xc1')]}},{'name':_0xf144('0xc2'),'field':'id','foreignKey':_0xf144('0xfe'),'model':_0xf144('0xbf'),'filter':{'field':'role','value':['telephone']}}];break;default:return _0x546bf1;}return _0x546bf1;}