Built motion from commit (unavailable).|2.5.11
[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 _0xc86f=['length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','clone','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','describe','sequelize','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','get','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','all','ignore','union','childModel','pick','type','VIRTUAL','field','associatedResources','foreignKey','reportType','default','reportId','rows','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','internalroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','teams','Team','voicequeues','users','agents','admin','user','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','triggers','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','metrics','AnalyticMetric','whatsappaccounts','WhatsappAccount','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','apply','save','then','destroy','error','stack','UserProfile','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields'];(function(_0x3ecd68,_0x4930c4){var _0x1a39cc=function(_0x549817){while(--_0x549817){_0x3ecd68['push'](_0x3ecd68['shift']());}};_0x1a39cc(++_0x4930c4);}(_0xc86f,0xb3));var _0xfc86=function(_0x2713f5,_0x382adb){_0x2713f5=_0x2713f5-0x0;var _0x4e6249=_0xc86f[_0x2713f5];return _0x4e6249;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc86('0x0'));var rimraf=require(_0xfc86('0x1'));var zipdir=require(_0xfc86('0x2'));var jsonpatch=require(_0xfc86('0x3'));var rp=require(_0xfc86('0x4'));var moment=require('moment');var BPromise=require(_0xfc86('0x5'));var Mustache=require('mustache');var util=require(_0xfc86('0x6'));var path=require('path');var sox=require(_0xfc86('0x7'));var csv=require(_0xfc86('0x8'));var ejs=require(_0xfc86('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfc86('0xa'));var crypto=require(_0xfc86('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfc86('0xc'));var toCsv=require(_0xfc86('0x8'));var querystring=require('querystring');var Papa=require(_0xfc86('0xd'));var Redis=require(_0xfc86('0xe'));var authService=require(_0xfc86('0xf'));var qs=require(_0xfc86('0x10'));var as=require(_0xfc86('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc86('0x12'))(_0xfc86('0x13'));var utils=require('../../config/utils');var config=require(_0xfc86('0x14'));var licenseUtil=require(_0xfc86('0x15'));var db=require(_0xfc86('0x16'))['db'];config[_0xfc86('0x17')]=_['defaults'](config[_0xfc86('0x17')],{'host':_0xfc86('0x18'),'port':0x18eb});var socket=require(_0xfc86('0x19'))(new Redis(config[_0xfc86('0x17')]));require('./userProfile.socket')[_0xfc86('0x1a')](socket);function respondWithStatusCode(_0x1098c3,_0x3085f7){_0x3085f7=_0x3085f7||0xcc;return function(_0x49d0ca){if(_0x49d0ca){return _0x1098c3[_0xfc86('0x1b')](_0x3085f7);}return _0x1098c3[_0xfc86('0x1c')](_0x3085f7)[_0xfc86('0x1d')]();};}function respondWithResult(_0x1a31e8,_0x18ee80){_0x18ee80=_0x18ee80||0xc8;return function(_0x1f1a5c){if(_0x1f1a5c){return _0x1a31e8['status'](_0x18ee80)[_0xfc86('0x1e')](_0x1f1a5c);}};}function respondWithFilteredResult(_0x653a36,_0x347d00){return function(_0x9d3f03){if(_0x9d3f03){var _0x917206=_0x9d3f03[_0xfc86('0x1f')],_0x2e3167=_0x347d00[_0xfc86('0x20')],_0xaa96f1=_0x347d00[_0xfc86('0x20')]+_0x347d00['limit'],_0x117004;if(_0xaa96f1>=_0x917206){_0xaa96f1=_0x917206;_0x117004=0xc8;}else{_0x117004=0xce;}_0x653a36[_0xfc86('0x1c')](_0x117004);return _0x653a36['set']('Content-Range',_0x2e3167+'-'+_0xaa96f1+'/'+_0x917206)[_0xfc86('0x1e')](_0x9d3f03);}return null;};}function patchUpdates(_0x44c867){return function(_0x5439de){try{jsonpatch[_0xfc86('0x21')](_0x5439de,_0x44c867,!![]);}catch(_0xea65d9){return BPromise['reject'](_0xea65d9);}return _0x5439de[_0xfc86('0x22')]();};}function saveUpdates(_0x1a7cc6,_0x11238a){return function(_0x55e81a){if(_0x55e81a){return _0x55e81a['update'](_0x1a7cc6)[_0xfc86('0x23')](function(_0x386b16){return _0x386b16;});}return null;};}function removeEntity(_0x1cec62,_0x579d8e){return function(_0x912a3d){if(_0x912a3d){return _0x912a3d[_0xfc86('0x24')]()[_0xfc86('0x23')](function(){_0x1cec62['status'](0xcc)[_0xfc86('0x1d')]();});}};}function handleEntityNotFound(_0xa3322f,_0x20d90f){return function(_0x33b875){if(!_0x33b875){_0xa3322f[_0xfc86('0x1b')](0x194);}return _0x33b875;};}function handleError(_0xa590fa,_0x579497){_0x579497=_0x579497||0x1f4;return function(_0x3131a8){logger[_0xfc86('0x25')](_0x3131a8[_0xfc86('0x26')]);if(_0x3131a8['name']){delete _0x3131a8['name'];}_0xa590fa[_0xfc86('0x1c')](_0x579497)['send'](_0x3131a8);};}exports['index']=function(_0xf914cf,_0x3ccfcc){var _0x200be0={},_0x3a8ed4={},_0x29e60a={'count':0x0,'rows':[]};var _0x926029=_['map'](db[_0xfc86('0x27')][_0xfc86('0x28')],function(_0x12b693){return{'name':_0x12b693['fieldName'],'type':_0x12b693['type'][_0xfc86('0x29')]};});_0x3a8ed4[_0xfc86('0x2a')]=_[_0xfc86('0x2b')](_0x926029,_0xfc86('0x2c'));_0x3a8ed4[_0xfc86('0x2d')]=_[_0xfc86('0x2e')](_0xf914cf['query']);_0x3a8ed4[_0xfc86('0x2f')]=_[_0xfc86('0x30')](_0x3a8ed4[_0xfc86('0x2a')],_0x3a8ed4[_0xfc86('0x2d')]);_0x200be0[_0xfc86('0x31')]=_['intersection'](_0x3a8ed4[_0xfc86('0x2a')],qs['fields'](_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x32')]));_0x200be0['attributes']=_0x200be0['attributes'][_0xfc86('0x33')]?_0x200be0[_0xfc86('0x31')]:_0x3a8ed4[_0xfc86('0x2a')];if(!_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x34')](_0xfc86('0x35'))){_0x200be0[_0xfc86('0x36')]=qs['limit'](_0xf914cf['query']['limit']);_0x200be0[_0xfc86('0x20')]=qs['offset'](_0xf914cf['query'][_0xfc86('0x20')]);}_0x200be0[_0xfc86('0x37')]=qs[_0xfc86('0x38')](_0xf914cf['query'][_0xfc86('0x38')]);_0x200be0['where']=qs[_0xfc86('0x2f')](_['pick'](_0xf914cf[_0xfc86('0x2d')],_0x3a8ed4['filters']),_0x926029);if(_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x39')]){_0x200be0[_0xfc86('0x3a')]=_[_0xfc86('0x3b')](_0x200be0[_0xfc86('0x3a')],{'$or':_['map'](_0x926029,function(_0x27d8e9){if(_0x27d8e9['type']!=='VIRTUAL'){var _0x1cbdca={};_0x1cbdca[_0x27d8e9[_0xfc86('0x2c')]]={'$like':'%'+_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x39')]+'%'};return _0x1cbdca;}})});}_0x200be0=_['merge']({},_0x200be0,_0xf914cf[_0xfc86('0x3c')]);var _0x20da03={'where':_0x200be0[_0xfc86('0x3a')]};return db[_0xfc86('0x27')][_0xfc86('0x1f')](_0x20da03)['then'](function(_0x4a2cbf){_0x29e60a[_0xfc86('0x1f')]=_0x4a2cbf;if(_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x3d')]){_0x200be0[_0xfc86('0x3e')]=[{'all':!![]}];}return db[_0xfc86('0x27')][_0xfc86('0x3f')](_0x200be0);})['then'](function(_0x4971eb){_0x29e60a['rows']=_0x4971eb;return _0x29e60a;})['then'](respondWithFilteredResult(_0x3ccfcc,_0x200be0))['catch'](handleError(_0x3ccfcc,null));};exports[_0xfc86('0x40')]=function(_0x4074d9,_0x4c5463){var _0x45f069={'raw':![],'where':{'id':_0x4074d9[_0xfc86('0x41')]['id']}},_0x4c6616={};_0x4c6616['model']=_[_0xfc86('0x2e')](db[_0xfc86('0x27')][_0xfc86('0x28')]);_0x4c6616['query']=_[_0xfc86('0x2e')](_0x4074d9[_0xfc86('0x2d')]);_0x4c6616[_0xfc86('0x2f')]=_[_0xfc86('0x30')](_0x4c6616[_0xfc86('0x2a')],_0x4c6616['query']);_0x45f069[_0xfc86('0x31')]=_[_0xfc86('0x30')](_0x4c6616[_0xfc86('0x2a')],qs[_0xfc86('0x32')](_0x4074d9[_0xfc86('0x2d')][_0xfc86('0x32')]));_0x45f069[_0xfc86('0x31')]=_0x45f069[_0xfc86('0x31')][_0xfc86('0x33')]?_0x45f069[_0xfc86('0x31')]:_0x4c6616['model'];if(_0x4074d9[_0xfc86('0x2d')][_0xfc86('0x3d')]){_0x45f069[_0xfc86('0x3e')]=[{'all':!![]}];}_0x45f069=_[_0xfc86('0x3b')]({},_0x45f069,_0x4074d9[_0xfc86('0x3c')]);return db[_0xfc86('0x27')][_0xfc86('0x42')](_0x45f069)[_0xfc86('0x23')](handleEntityNotFound(_0x4c5463,null))[_0xfc86('0x23')](respondWithResult(_0x4c5463,null))[_0xfc86('0x43')](handleError(_0x4c5463,null));};exports[_0xfc86('0x44')]=function(_0x3c4f3d,_0xd880e0){return db[_0xfc86('0x27')]['create'](_0x3c4f3d[_0xfc86('0x45')],{})[_0xfc86('0x23')](respondWithResult(_0xd880e0,0xc9))[_0xfc86('0x43')](handleError(_0xd880e0,null));};exports[_0xfc86('0x46')]=function(_0x39a2e,_0x26b236){var _0x26e602={'where':{'id':_0x39a2e['params']['id']}},_0x1f6911={};_0x1f6911[_0xfc86('0x2a')]=_[_0xfc86('0x2e')](db['UserProfile']['rawAttributes']);_0x26e602[_0xfc86('0x31')]=_[_0xfc86('0x30')](_0x1f6911[_0xfc86('0x2a')],qs[_0xfc86('0x32')](_0x39a2e['query'][_0xfc86('0x32')]));_0x26e602[_0xfc86('0x31')]=_0x26e602[_0xfc86('0x31')][_0xfc86('0x33')]?_0x26e602['attributes']:_0x1f6911[_0xfc86('0x2a')];if(_0x39a2e['query'][_0xfc86('0x3d')]){_0x26e602[_0xfc86('0x3e')]=[{'all':!![]}];}_0x26e602=_[_0xfc86('0x3b')]({},_0x26e602,_0x39a2e['options']);return db[_0xfc86('0x27')][_0xfc86('0x42')](_0x26e602)['then'](handleEntityNotFound(_0x26b236,null))['then'](function(_0x30a07e){if(_0x30a07e){var _0x5ee6fe=_0x30a07e['get']({'plain':!![]});_0x5ee6fe=qs[_0xfc86('0x47')](_0x5ee6fe,['id','createdAt',_0xfc86('0x48'),_0xfc86('0x49')]);_0x39a2e[_0xfc86('0x45')]=_[_0xfc86('0x47')](_0x39a2e[_0xfc86('0x45')],['id',_0xfc86('0x4a'),_0xfc86('0x48')]);return db['sequelize'][_0xfc86('0x4b')](function(_0xbfa740){return db[_0xfc86('0x27')][_0xfc86('0x44')](_[_0xfc86('0x3b')](_0x5ee6fe,_0x39a2e[_0xfc86('0x45')]),{'include':_0x39a2e['query'][_0xfc86('0x3d')]?[{'all':!![]}]:undefined,'transaction':_0xbfa740})[_0xfc86('0x23')](function(_0x2570fc){var _0x5382e5=_0x2570fc['get']({'plain':!![]});return db[_0xfc86('0x4c')][_0xfc86('0x3f')]({'where':{'userProfileId':_0x39a2e[_0xfc86('0x41')]['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x54b1f0){if(_0x54b1f0){return BPromise[_0xfc86('0x4d')](_0x54b1f0,function(_0x2acb34){return new BPromise(function(_0x43b6f6,_0x506ad7){if(_0x2acb34[_0xfc86('0x4e')]===null||_0x2acb34[_0xfc86('0x4e')]===0x1)_0x43b6f6(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2acb34['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x20f8d6){var _0x161a59=_[_0xfc86('0x2b')](_0x20f8d6,function(_0x49035c){return qs[_0xfc86('0x47')](_0x49035c,['id',_0xfc86('0x4a'),_0xfc86('0x48'),_0xfc86('0x4f')]);});_0x43b6f6(_0x161a59);})[_0xfc86('0x43')](function(_0x4ccf3c){_0x506ad7(_0x4ccf3c);});})['then'](function(_0x45e5ad){var _0x46f5c5=qs[_0xfc86('0x47')](_0x2acb34,['id',_0xfc86('0x4a'),'updatedAt']);_0x46f5c5[_0xfc86('0x50')]=_0x5382e5['id'];if(_0x45e5ad)_0x46f5c5[_0xfc86('0x51')]=_0x45e5ad;return _0x46f5c5;})[_0xfc86('0x23')](function(_0x2ce8e3){return db[_0xfc86('0x4c')]['create'](_0x2ce8e3,{'include':[{'model':db[_0xfc86('0x52')],'as':_0xfc86('0x51')}],'raw':!![],'transaction':_0xbfa740});});})[_0xfc86('0x23')](function(){return _0x5382e5;});}});});});}})[_0xfc86('0x23')](respondWithResult(_0x26b236,0xc9))[_0xfc86('0x43')](handleError(_0x26b236,null));};exports[_0xfc86('0x53')]=function(_0x252ecd,_0x3368ce){if(_0x252ecd[_0xfc86('0x45')]['id']){delete _0x252ecd[_0xfc86('0x45')]['id'];}return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0x252ecd['params']['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x3368ce,null))['then'](saveUpdates(_0x252ecd[_0xfc86('0x45')],null))[_0xfc86('0x23')](respondWithResult(_0x3368ce,null))['catch'](handleError(_0x3368ce,null));};exports['destroy']=function(_0x12ccf8,_0x3b76f4){return db['UserProfile'][_0xfc86('0x42')]({'where':{'id':_0x12ccf8[_0xfc86('0x41')]['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x3b76f4,null))[_0xfc86('0x23')](removeEntity(_0x3b76f4,null))[_0xfc86('0x43')](handleError(_0x3b76f4,null));};exports[_0xfc86('0x54')]=function(_0x511685,_0x2825aa){return db[_0xfc86('0x27')][_0xfc86('0x54')]()[_0xfc86('0x23')](respondWithResult(_0x2825aa,null))[_0xfc86('0x43')](handleError(_0x2825aa,null));};exports['addSections']=function(_0x200c88,_0x3bcb42){var _0x16188d=_0x200c88[_0xfc86('0x45')];return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0x200c88['params']['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x3bcb42,null))[_0xfc86('0x23')](function(_0x42a726){if(_0x42a726){return db[_0xfc86('0x55')]['transaction'](function(_0x3ff6ef){return db[_0xfc86('0x4c')][_0xfc86('0x24')]({'where':{'userProfileId':_0x200c88[_0xfc86('0x41')]['id'],'sectionId':_[_0xfc86('0x2b')](_0x16188d,function(_0x51d989){return _0x51d989[_0xfc86('0x4f')];})},'transaction':_0x3ff6ef})[_0xfc86('0x23')](function(){var _0x20292f=_['map'](_0x16188d,function(_0x396dfd){_0x396dfd[_0xfc86('0x50')]=_0x200c88[_0xfc86('0x41')]['id'];return _0x396dfd;});var _0x32c0b5=[];return BPromise[_0xfc86('0x4d')](_0x20292f,function(_0x505e34){return db[_0xfc86('0x4c')]['create'](_0x505e34,{'include':[{'model':db[_0xfc86('0x52')],'as':_0xfc86('0x51')}],'raw':!![],'transaction':_0x3ff6ef})[_0xfc86('0x23')](function(_0x4a9fd5){_0x32c0b5['push'](_0x4a9fd5['get']({'plain':!![]}));});})[_0xfc86('0x23')](function(){return _0x32c0b5;});});});}})[_0xfc86('0x23')](function(_0xbccff3){return _0xbccff3;})['then'](respondWithResult(_0x3bcb42,null))[_0xfc86('0x43')](handleError(_0x3bcb42,null));};exports[_0xfc86('0x56')]=function(_0x586a88,_0x27c2d2){var _0x20b96c;return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0x586a88[_0xfc86('0x41')]['id']},'attributes':['id',_0xfc86('0x2c')]})[_0xfc86('0x23')](handleEntityNotFound(_0x27c2d2,null))[_0xfc86('0x23')](function(_0x821fbc){if(_0x821fbc){_0x20b96c=_0x821fbc;return db[_0xfc86('0x4c')][_0xfc86('0x24')]({'where':{'userProfileId':_0x586a88[_0xfc86('0x41')]['id'],'sectionId':_0x586a88[_0xfc86('0x2d')][_0xfc86('0x57')]}});}})[_0xfc86('0x23')](function(){return _0x20b96c;})['then'](respondWithStatusCode(_0x27c2d2,null))[_0xfc86('0x43')](handleError(_0x27c2d2,null));};exports[_0xfc86('0x58')]=function(_0xedcfc3,_0x19d2a1){var _0x473694=[];var _0x12735e=[];return db['UserProfileSection'][_0xfc86('0x3f')]({'where':{'userProfileId':_0xedcfc3[_0xfc86('0x41')]['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x1d2aff){_0x473694=_[_0xfc86('0x39')](_0x1d2aff,function(_0x3b0cf4){return _0x3b0cf4[_0xfc86('0x59')]===0x1||_['includes']([0x3eb,0x709],_0x3b0cf4[_0xfc86('0x4f')]);});if(!_[_0xfc86('0x5a')](_0x473694)){return _[_0xfc86('0x2b')](_0x473694,function(_0xc840ad){return _0xc840ad[_0xfc86('0x4f')];});}else{return;}})['then'](function(_0x2aeafc){if(_0x2aeafc)_0x12735e=_0x2aeafc;if(_[_0xfc86('0x5b')](_0x12735e,0x64)){var _0x103c31=_[_0xfc86('0x42')](_0x473694,{'sectionId':0x64});return hasDefaultDashboard(_0x103c31)[_0xfc86('0x23')](function(_0x2cb602){return _[_0xfc86('0x2b')](_0x473694,function(_0x364107){if(_0x364107[_0xfc86('0x4f')]===0x64){_0x364107[_0xfc86('0x5c')]=_0x2cb602;}return _0x364107;});});}else{return;}})[_0xfc86('0x23')](function(_0x118a91){if(_0x118a91)_0x473694=_0x118a91;if(_['includes'](_0x12735e,0x3eb)){var _0x4a41fa=_['find'](_0x473694,{'sectionId':0x3eb});return getCustomDashboards(_0x4a41fa)[_0xfc86('0x23')](function(_0x25dca6){return _[_0xfc86('0x2b')](_0x473694,function(_0x4348cb){if(_0x4a41fa[_0xfc86('0x59')]){if(_0x4348cb[_0xfc86('0x4f')]===0x3eb){_0x4348cb[_0xfc86('0x5c')]=_0x25dca6;}}else{if(_0x4348cb[_0xfc86('0x4f')]===0x64){_0x4348cb[_0xfc86('0x5c')]=_0x25dca6;}}return _0x4348cb;});});}else{return;}})[_0xfc86('0x23')](function(_0x3a0b03){if(_0x3a0b03)_0x473694=_0x3a0b03;if(_[_0xfc86('0x5b')](_0x12735e,0x709)){var _0x470420=_[_0xfc86('0x42')](_0x473694,{'sectionId':0x709});return getPlugins(_0x470420)[_0xfc86('0x23')](function(_0x31a4be){if(_0x470420[_0xfc86('0x59')]){return _[_0xfc86('0x2b')](_0x473694,function(_0x3d875a){if(_0x3d875a[_0xfc86('0x4f')]===0x709){_0x3d875a[_0xfc86('0x5c')]=_0x31a4be;}return _0x3d875a;});}else{var _0x2c629b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x31a4be};var _0x16392f=_['map'](_0x473694);_0x16392f[_0xfc86('0x5d')](_0x2c629b);return _0x16392f;}});}else{return;}})[_0xfc86('0x23')](function(_0x1a31bb){if(_0x1a31bb)_0x473694=_0x1a31bb;return _[_0xfc86('0x39')](_0x473694,['enabled',0x1]);})['then'](respondWithResult(_0x19d2a1,null))[_0xfc86('0x43')](handleError(_0x19d2a1,null));};function hasDefaultDashboard(_0x38a363){var _0x21fe8c=[0x65];return new BPromise(function(_0x3158ed,_0x5f1078){try{if(_0x38a363[_0xfc86('0x4e')]){_0x3158ed(_0x21fe8c);}else{return db['UserProfileResource'][_0xfc86('0x5e')]({'where':{'sectionId':_0x38a363['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x2ef5c5){_0x2ef5c5?_0x3158ed(_0x21fe8c):_0x3158ed();});}}catch(_0x27833d){_0x5f1078(_0x27833d);}});}function getCustomDashboards(_0x436052){var _0x377e37=[];return new BPromise(function(_0x5c8cff,_0x289f20){try{if(_0x436052[_0xfc86('0x4e')]){return db['Dashboard'][_0xfc86('0x3f')]({'raw':!![]})[_0xfc86('0x23')](function(_0x5ec156){_0x5ec156[_0xfc86('0x5f')](function(_0x57ec9b){_0x377e37[_0xfc86('0x5d')](_0x57ec9b['id']+0x1869f);});_0x5c8cff(_0x377e37);});}else{return db[_0xfc86('0x52')][_0xfc86('0x3f')]({'where':{'sectionId':_0x436052['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x2035a5){_0x2035a5['forEach'](function(_0x1b8b71){_0x377e37[_0xfc86('0x5d')](_0x1b8b71[_0xfc86('0x60')]+0x1869f);});_0x5c8cff(_0x377e37);});}}catch(_0x31b90a){_0x289f20(_0x31b90a);}});}function getPlugins(_0x278046){var _0x35f4a5=[];return new BPromise(function(_0x7dfbc,_0x2a644a){try{if(_0x278046['autoAssociation']){return db[_0xfc86('0x61')][_0xfc86('0x3f')]({'raw':!![]})[_0xfc86('0x23')](function(_0x20a2ed){_0x20a2ed['forEach'](function(_0x3d6dfe){_0x35f4a5[_0xfc86('0x5d')](_0x3d6dfe['id']+0x15b38);});_0x7dfbc(_0x35f4a5);});}else{return db[_0xfc86('0x52')][_0xfc86('0x3f')]({'where':{'sectionId':_0x278046['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x3f910f){_0x3f910f['forEach'](function(_0x1ee07e){_0x35f4a5[_0xfc86('0x5d')](_0x1ee07e[_0xfc86('0x60')]+0x15b38);});_0x7dfbc(_0x35f4a5);});}}catch(_0xf4b6f9){_0x2a644a(_0xf4b6f9);}});}exports[_0xfc86('0x62')]=function(_0x1149ee,_0x6b19e1){return db[_0xfc86('0x27')]['find']({'where':{'id':_0x1149ee[_0xfc86('0x41')]['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x6b19e1,null))[_0xfc86('0x23')](function(_0x7501d3){if(_0x7501d3){return db['sequelize'][_0xfc86('0x4b')](function(_0x4a082b){return db['UserProfileSection'][_0xfc86('0x3f')]({'where':{'userProfileId':_0x1149ee[_0xfc86('0x41')]['id']},'attributes':['id'],'raw':!![]})[_0xfc86('0x23')](function(_0xe02640){if(_0xe02640){return db[_0xfc86('0x4c')][_0xfc86('0x24')]({'where':{'userProfileId':_0x1149ee[_0xfc86('0x41')]['id'],'id':_[_0xfc86('0x2b')](_0xe02640,function(_0x209e0a){return _0x209e0a['id'];})},'transaction':_0x4a082b});}})['then'](function(_0x137c17){var _0x2c7dbb=_['map'](_0x1149ee[_0xfc86('0x45')],function(_0x1a7e5d){_0x1a7e5d[_0xfc86('0x50')]=_0x1149ee[_0xfc86('0x41')]['id'];return _0x1a7e5d;});return db[_0xfc86('0x4c')][_0xfc86('0x63')](_0x2c7dbb,{'raw':!![],'transaction':_0x4a082b});})[_0xfc86('0x23')](function(_0x1d24cc){var _0x59f1a6=_[_0xfc86('0x39')](_[_0xfc86('0x2b')](_0x1d24cc,function(_0x386988){return _0x386988['get']({'plain':!![]});}),{'includeAll':![]});if(_0x59f1a6){return db[_0xfc86('0x4c')][_0xfc86('0x3f')]({'where':{'userProfileId':_0x1149ee[_0xfc86('0x41')]['id'],'sectionId':_[_0xfc86('0x2b')](_0x59f1a6,function(_0x5a18eb){return _0x5a18eb[_0xfc86('0x4f')];})},'attributes':['id',_0xfc86('0x4f')],'raw':!![]})[_0xfc86('0x23')](function(_0x40482e){var _0x1b04c=_['map'](_0x1149ee[_0xfc86('0x45')],function(_0x5d429a){_0x5d429a['userProfileId']=_0x1149ee[_0xfc86('0x41')]['id'];return _0x5d429a;});return db[_0xfc86('0x52')][_0xfc86('0x63')](_0x1b04c,{'raw':!![],'transaction':_0x4a082b});});}})[_0xfc86('0x43')](handleError(_0x6b19e1,null));});}})[_0xfc86('0x23')](function(_0x4aac1e){var _0x35ec80=_[_0xfc86('0x2b')](_0x4aac1e,function(_0x31a244){return _0x31a244[_0xfc86('0x64')]({'plain':!![]});});})[_0xfc86('0x23')](respondWithResult(_0x6b19e1,null))[_0xfc86('0x43')](handleError(_0x6b19e1,null));};exports[_0xfc86('0x65')]=function(_0xb5d911,_0x355887,_0x58f41f){return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0xb5d911[_0xfc86('0x41')]['id']}})['then'](handleEntityNotFound(_0x355887,null))[_0xfc86('0x23')](function(_0x26639b){if(_0x26639b){return _0x26639b['removeResources'](_0xb5d911[_0xfc86('0x2d')][_0xfc86('0x57')]);}})[_0xfc86('0x23')](respondWithStatusCode(_0x355887,null))['catch'](handleError(_0x355887,null));};exports[_0xfc86('0x66')]=function(_0x5999de,_0xfa1a08){var _0x5a723d={'raw':![],'where':{}};var _0x1e3fab={};var _0x332444={'count':0x0,'rows':[]};var _0x4738d6=_0x5999de[_0xfc86('0x2d')][_0xfc86('0x67')];if(typeof _0x4738d6===_0xfc86('0x68')){throw new db[(_0xfc86('0x69'))][(_0xfc86('0x6a'))](_0xfc86('0x6b'));}var _0x3a7868=_0x5999de['query'][_0xfc86('0x6c')]||![];var _0x3cdbb2=getQueryModels(_0x4738d6,_0x3a7868);if(typeof _0x3cdbb2['childModel']==='undefined'){throw new db['Sequelize']['ValidationError'](_0xfc86('0x6d')+_0x4738d6+'\x27');}var _0x259e50=[];if(!_['isEmpty'](_0x3cdbb2[_0xfc86('0x6e')])){_0x259e50=_0x3cdbb2[_0xfc86('0x6e')];}else{_0x259e50=[{'name':_0x4738d6}];}return db['UserProfile'][_0xfc86('0x5e')]({'where':{'id':_0x5999de[_0xfc86('0x41')]['id']}})['then'](handleEntityNotFound(_0xfa1a08,null))[_0xfc86('0x23')](function(_0x1ad19d){if(_0x1ad19d){var _0x5e411e=[];for(var _0x22c8c3=0x0;_0x22c8c3<_0x259e50[_0xfc86('0x33')];_0x22c8c3++){_0x5e411e[_0xfc86('0x5d')](db['UserProfileSection'][_0xfc86('0x5e')]({'where':{'userProfileId':_0x1ad19d['id'],'name':_0x259e50[_0x22c8c3][_0xfc86('0x2c')]},'raw':!![]}));}return BPromise[_0xfc86('0x6f')](_0x5e411e);}})['then'](function(_0x9e1b68){var _0x5add7b=_[_0xfc86('0x39')](_0x9e1b68,function(_0x2e4af0){return _0x2e4af0?_0x2e4af0:undefined;});var _0x5c9b05=_['filter'](_0x259e50,[_0xfc86('0x70'),!![]]);var _0x494267=_[_0xfc86('0x5a')](_0x5add7b)&&_['isEmpty'](_0x5c9b05)?null:_[_0xfc86('0x71')](_0x5c9b05,_0x5add7b);if(_0x494267){var _0x6a4373=[];for(var _0x986ce7=0x0;_0x986ce7<_0x494267[_0xfc86('0x33')];_0x986ce7++){var _0x40f995=_[_0xfc86('0x42')](_0x259e50,function(_0x2a884d){return _0x494267[_0x986ce7]?_0x2a884d[_0xfc86('0x2c')]===_0x494267[_0x986ce7][_0xfc86('0x2c')]:null;});if(_0x40f995){if(_0x494267[_0x986ce7][_0xfc86('0x70')]){_0x6a4373['push'](getAllResources(_0x3cdbb2[_0xfc86('0x72')],_0x494267[_0x986ce7]));}else{if(!_0x494267[_0x986ce7]['autoAssociation']){_0x6a4373[_0xfc86('0x5d')](getAllowedResources(_0x40f995,_0x494267[_0x986ce7],_0x3cdbb2[_0xfc86('0x72')]));}else{if(_0x40f995[_0xfc86('0x2a')]){_0x6a4373['push'](getAllFilteredResources(_0x40f995,_0x494267[_0x986ce7]));}}}}}return BPromise['all'](_0x6a4373);}else{return null;}})[_0xfc86('0x23')](function(_0x57233b){var _0x450bac=_0x57233b;var _0x1b4b11=null;if(_0x450bac){_0x1b4b11=_0x450bac[_0xfc86('0x33')]===0x1?_0x450bac[0x0]:null;}if(_0x1b4b11||_0x450bac){var _0x13d6c5=db[_0x3cdbb2[_0xfc86('0x72')]][_0xfc86('0x28')];_0x1e3fab[_0xfc86('0x2a')]=_[_0xfc86('0x2e')](_0x13d6c5);_0x1e3fab['query']=_[_0xfc86('0x2e')](_0x5999de[_0xfc86('0x2d')]);_0x1e3fab['filters']=_[_0xfc86('0x30')](_0x1e3fab[_0xfc86('0x2a')],_0x1e3fab[_0xfc86('0x2d')]);_0x5a723d[_0xfc86('0x31')]=_['intersection'](_0x1e3fab[_0xfc86('0x2a')],qs[_0xfc86('0x32')](_0x5999de['query'][_0xfc86('0x32')]));_0x5a723d['attributes']=_0x5a723d['attributes'][_0xfc86('0x33')]?_0x5a723d['attributes']:_0x1e3fab['model'];if(!_0x5999de[_0xfc86('0x2d')][_0xfc86('0x34')]('nolimit')){_0x5a723d['limit']=qs[_0xfc86('0x36')](_0x5999de[_0xfc86('0x2d')]['limit']);_0x5a723d[_0xfc86('0x20')]=qs[_0xfc86('0x20')](_0x5999de[_0xfc86('0x2d')][_0xfc86('0x20')]);}_0x5a723d[_0xfc86('0x37')]=qs['sort'](_0x5999de[_0xfc86('0x2d')][_0xfc86('0x38')]);_0x5a723d[_0xfc86('0x3a')]=qs[_0xfc86('0x2f')](_[_0xfc86('0x73')](_0x5999de[_0xfc86('0x2d')],_0x1e3fab['filters']));if(_0x5999de['query']['filter']){_0x5a723d[_0xfc86('0x3a')]=_[_0xfc86('0x3b')](_0x5a723d[_0xfc86('0x3a')],{'$or':_['map'](_0x13d6c5,function(_0x4a5ef0){if(_0x4a5ef0[_0xfc86('0x74')][_0xfc86('0x29')]!==_0xfc86('0x75')){var _0x44abfc={};_0x44abfc[_0x4a5ef0[_0xfc86('0x76')]]={'$like':'%'+_0x5999de[_0xfc86('0x2d')][_0xfc86('0x39')]+'%'};return _0x44abfc;}})});}var _0x46d9b6=[];if(_0x1b4b11){var _0x48452c=_[_0xfc86('0x42')](_0x259e50,[_0xfc86('0x2c'),_0x1b4b11['name']]);if(_0x48452c['field']){var _0x28bad9={};if(_0x3cdbb2[_0xfc86('0x72')]==='AnalyticExtractedReport'){_0x28bad9[_0x48452c['foreignKey']]=_[_0xfc86('0x2b')](_0x1b4b11[_0xfc86('0x77')],'id');}else{_0x28bad9[_0x48452c['foreignKey']]=_0x1b4b11[_0xfc86('0x77')];}_0x46d9b6[_0xfc86('0x5d')](_0x28bad9);}else{_0x5a723d[_0xfc86('0x3a')]['id']=_0x1b4b11[_0xfc86('0x77')];}}else{for(var _0x310728=0x0;_0x310728<_0x450bac[_0xfc86('0x33')];_0x310728++){var _0x48452c=_[_0xfc86('0x42')](_0x259e50,['name',_0x450bac[_0x310728][_0xfc86('0x2c')]]);if(_0x48452c[_0xfc86('0x76')]){var _0x28bad9={};_0x28bad9[_0x48452c[_0xfc86('0x78')]]=_0x450bac[_0x310728]['associatedResources'];_0x46d9b6[_0xfc86('0x5d')](_0x28bad9);}else{if(!_0x5a723d[_0xfc86('0x3a')]['id'])_0x5a723d[_0xfc86('0x3a')]['id']=[];_0x450bac[_0x310728]['associatedResources']['forEach'](function(_0x3b837f){_0x5a723d[_0xfc86('0x3a')]['id'][_0xfc86('0x5d')](_0x3b837f);});}}}if(!_['isEmpty'](_0x46d9b6)){_0x5a723d[_0xfc86('0x3a')]=_[_0xfc86('0x3b')](_0x5a723d[_0xfc86('0x3a')],{'$and':{'$or':_0x46d9b6}});}_0x5a723d=_[_0xfc86('0x3b')]({},_0x5a723d,_0x5999de[_0xfc86('0x3c')]);if(_0x1b4b11&&!_0x1b4b11[_0xfc86('0x4e')]&&_0x3cdbb2[_0xfc86('0x72')]==='AnalyticExtractedReport'){if(_0x5999de['query'][_0xfc86('0x3d')]){_0x5a723d[_0xfc86('0x3e')]=[{'all':!![]}];}return db[_0x3cdbb2['childModel']][_0xfc86('0x3f')](_0x5a723d)[_0xfc86('0x23')](function(_0x1751ac){var _0x50d07a=[];_0x1751ac[_0xfc86('0x5f')](function(_0x338a47){var _0x38baf7;switch(_0x338a47[_0xfc86('0x79')]){case _0xfc86('0x7a'):_0x38baf7=_['find'](_0x1b4b11['associatedResources'],function(_0x414aaa){return _0x414aaa['id']===_0x338a47[_0xfc86('0x7b')]&&_0x414aaa[_0xfc86('0x74')]==='DefaultReports';});break;case'custom':_0x38baf7=_[_0xfc86('0x42')](_0x1b4b11[_0xfc86('0x77')],function(_0x451630){return _0x451630['id']===_0x338a47[_0xfc86('0x7b')]&&_0x451630[_0xfc86('0x74')]==='CustomReports';});break;}if(_0x38baf7)_0x50d07a[_0xfc86('0x5d')](_0x338a47);});_0x332444[_0xfc86('0x1f')]=_0x50d07a['length'];_0x332444[_0xfc86('0x7c')]=_0x50d07a;return _0x332444;});}else{return db[_0x3cdbb2[_0xfc86('0x72')]][_0xfc86('0x1f')]({'where':_0x5a723d[_0xfc86('0x3a')]})[_0xfc86('0x23')](function(_0x415601){_0x332444[_0xfc86('0x1f')]=_0x415601;if(_0x5999de[_0xfc86('0x2d')]['includeAll']){if(_0x3cdbb2[_0xfc86('0x72')]==='CmContact'){_0x5a723d[_0xfc86('0x3e')]=[{'model':db[_0xfc86('0x7d')],'as':_0xfc86('0x7e'),'attributes':['id',_0xfc86('0x2c'),_0xfc86('0x7f')],'required':_0x5999de[_0xfc86('0x2d')][_0xfc86('0x80')]?!![]:![]},{'model':db[_0xfc86('0x7d')],'as':_0xfc86('0x81'),'attributes':['id','name',_0xfc86('0x7f')],'through':_0x5999de[_0xfc86('0x2d')][_0xfc86('0x80')]?{'attributes':[],'where':{'TagId':_0x5999de[_0xfc86('0x2d')]['tag']||undefined}}:{},'required':_0x5999de[_0xfc86('0x2d')][_0xfc86('0x80')]?!![]:![]}];}else{_0x5a723d[_0xfc86('0x3e')]=[{'all':!![]}];}}return db[_0x3cdbb2[_0xfc86('0x72')]]['findAll'](_0x5a723d);})[_0xfc86('0x23')](function(_0x26352a){_0x332444[_0xfc86('0x7c')]=_0x26352a;return _0x332444;});}}else{return _0x332444;}})['then'](respondWithFilteredResult(_0xfa1a08,_0x5a723d))[_0xfc86('0x43')](handleError(_0xfa1a08,null));};function getAllResources(_0x325d0c,_0x55a15c){return new BPromise(function(_0xd647cb,_0x29dc1c){if(_0x55a15c){var _0x2c3708=_0x55a15c[_0xfc86('0x39')]?{[_0x55a15c['filter'][_0xfc86('0x76')]]:_0x55a15c[_0xfc86('0x39')][_0xfc86('0x82')]}:undefined;return db[_0x325d0c]['findAll']({'where':_0x2c3708,'raw':!![]})['then'](function(_0xd409bc){_0x55a15c['associatedResources']=_[_0xfc86('0x2b')](_0xd409bc,'id');_0xd647cb(_0x55a15c);})[_0xfc86('0x43')](function(_0x3a8d02){_0x29dc1c(_0x3a8d02);});}else{_0xd647cb(null);}});}function getAllFilteredResources(_0x1df586,_0x4d5f53){return new BPromise(function(_0x3f3fe0,_0xb2983b){var _0x26cea8=_0x1df586[_0xfc86('0x39')]?{[_0x1df586['filter'][_0xfc86('0x76')]]:_0x1df586[_0xfc86('0x39')][_0xfc86('0x82')]}:undefined;return db[_0x1df586[_0xfc86('0x2a')]][_0xfc86('0x3f')]({'where':_0x26cea8,'raw':!![]})[_0xfc86('0x23')](function(_0x3e8a10){_0x4d5f53[_0xfc86('0x77')]=_[_0xfc86('0x2b')](_0x3e8a10,function(_0x34b84f){return _0x34b84f[_0xfc86('0x2c')];});_0x3f3fe0(_0x4d5f53);})['catch'](function(_0x57b607){_0xb2983b(_0x57b607);});});}function getAllowedResources(_0x153b7d,_0x3d0399,_0x18a618){return new BPromise(function(_0x1eea63,_0x159405){if(_0x3d0399){return db[_0xfc86('0x52')]['findAll']({'where':{'sectionId':_0x3d0399['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x44d6ff){if(_0x153b7d[_0xfc86('0x76')]&&_0x153b7d[_0xfc86('0x76')]!=='id'){_0x3d0399[_0xfc86('0x77')]=_['map'](_0x44d6ff,function(_0x796a48){return _0x796a48[_0x153b7d[_0xfc86('0x76')]];});}else{if(_0x18a618==='AnalyticExtractedReport'){_0x3d0399['associatedResources']=_[_0xfc86('0x2b')](_0x44d6ff,function(_0x996da8){return{'id':_0x996da8[_0xfc86('0x60')],'type':_0x996da8[_0xfc86('0x74')]};});}else{_0x3d0399['associatedResources']=_[_0xfc86('0x2b')](_0x44d6ff,function(_0x56c7bc){return _0x56c7bc[_0xfc86('0x60')];});}}_0x1eea63(_0x3d0399);})[_0xfc86('0x43')](function(_0x2cc39b){_0x159405(_0x2cc39b);});}else{_0x1eea63(null);}});}function getQueryModels(_0x1312fd,_0x4f79e1){var _0x4a5b51=_0x1312fd[_0xfc86('0x83')]();var _0x1fd847={'childModel':undefined,'parentSections':[]};switch(_0x4a5b51){case _0xfc86('0x84'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x85');break;case _0xfc86('0x86'):_0x1fd847[_0xfc86('0x72')]='SquareOdbc';break;case _0xfc86('0x87'):_0x1fd847[_0xfc86('0x72')]='SquareRecording';_0x1fd847['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0xfc86('0x88')}];break;case'projects':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x89');break;case _0xfc86('0x8a'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x8b');_0x1fd847[_0xfc86('0x6e')]=[{'name':_0xfc86('0x8c'),'field':'id','foreignKey':_0xfc86('0x8d')}];break;case _0xfc86('0x8e'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x8f');break;case _0xfc86('0x90'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x91');break;case'globalcustomfields':_0x1fd847['childModel']=_0xfc86('0x92');break;case'chatqueues':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x93');break;case _0xfc86('0x94'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x95');break;case _0xfc86('0x96'):_0x1fd847[_0xfc86('0x72')]='FaxQueue';break;case _0xfc86('0x97'):_0x1fd847['childModel']='FaxAccount';break;case'inboundroutes':case _0xfc86('0x98'):case'outboundroutes':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x99');break;case _0xfc86('0x9a'):_0x1fd847['childModel']=_0xfc86('0x9b');break;case'voicemails':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x9c');break;case'voicerecordings':_0x1fd847['childModel']=_0xfc86('0x9d');_0x1fd847[_0xfc86('0x6e')]=[{'name':_0xfc86('0x9e'),'field':'name','foreignKey':'membername','model':_0xfc86('0x9f'),'filter':{'field':_0xfc86('0xa0'),'value':['agent']}},{'name':_0xfc86('0xa1'),'field':_0xfc86('0x2c'),'foreignKey':_0xfc86('0xa2'),'model':'User','filter':{'field':_0xfc86('0xa0'),'value':[_0xfc86('0xa3')]}},{'name':_0xfc86('0xa4'),'field':'name','foreignKey':_0xfc86('0xa5'),'model':_0xfc86('0xa6'),'filter':{'field':_0xfc86('0x74'),'value':[_0xfc86('0xa7')]}},{'name':_0xfc86('0xa8'),'field':_0xfc86('0x2c'),'foreignKey':_0xfc86('0xa5'),'model':'VoiceQueue','filter':{'field':_0xfc86('0x74'),'value':[_0xfc86('0xa9')]}}];break;case'musiconholds':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xaa');break;case _0xfc86('0xab'):_0x1fd847['childModel']=_0xfc86('0xac');break;case _0xfc86('0xad'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xae');break;case _0xfc86('0xaf'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb0');break;case _0xfc86('0xb1'):_0x1fd847['childModel']=_0xfc86('0xb2');break;case'mailaccounts':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb3');break;case _0xfc86('0xb4'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb5');break;case _0xfc86('0xb6'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb7');break;case _0xfc86('0xb8'):_0x1fd847[_0xfc86('0x72')]='OpenchannelAccount';break;case'smsqueues':_0x1fd847['childModel']=_0xfc86('0xb9');break;case _0xfc86('0xba'):_0x1fd847['childModel']=_0xfc86('0xbb');break;case _0xfc86('0xbc'):_0x1fd847[_0xfc86('0x72')]='WhatsappQueue';break;case'whatsappaccounts':_0x1fd847[_0xfc86('0x72')]='WhatsappAccount';break;case _0xfc86('0xbd'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xbe');break;case _0xfc86('0xbf'):case'queuecampaigns':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xa6');if(_0x4f79e1){_0x1fd847[_0xfc86('0x6e')]=[{'name':_0xfc86('0xa4')},{'name':_0xfc86('0xa8')}];}break;case _0xfc86('0xc0'):case _0xfc86('0xc1'):case'telephones':_0x1fd847['childModel']=_0xfc86('0x9f');if(_0x4f79e1){_0x1fd847[_0xfc86('0x6e')]=[{'name':'Users','filter':{'field':_0xfc86('0xa0'),'value':[_0xfc86('0xc2'),_0xfc86('0xc3')]},'ignore':!![]},{'name':_0xfc86('0x9e')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xc4');break;case _0xfc86('0xc5'):_0x1fd847[_0xfc86('0x72')]='SalesforceAccount';break;case _0xfc86('0xc6'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xc7');break;case'sugarcrmaccounts':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xc8');break;case _0xfc86('0xc9'):_0x1fd847[_0xfc86('0x72')]='DeskAccount';break;case _0xfc86('0xca'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xcb');break;case _0xfc86('0xcc'):_0x1fd847['childModel']=_0xfc86('0x9f');break;case'cannedanswers':_0x1fd847['childModel']=_0xfc86('0xcd');break;case _0xfc86('0xce'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xcf');break;case _0xfc86('0xd0'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd1');break;case _0xfc86('0xd2'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd3');break;case _0xfc86('0xd4'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd5');break;case _0xfc86('0xd6'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd7');break;case _0xfc86('0xd8'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd9');break;case _0xfc86('0xda'):_0x1fd847[_0xfc86('0x72')]='Tag';break;case _0xfc86('0xdb'):_0x1fd847[_0xfc86('0x72')]='Template';break;case _0xfc86('0xdc'):_0x1fd847[_0xfc86('0x72')]='Trigger';break;case'trunks':_0x1fd847[_0xfc86('0x72')]='Trunk';break;case _0xfc86('0xdd'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xde');break;case _0xfc86('0xdf'):_0x1fd847['childModel']=_0xfc86('0x61');break;case _0xfc86('0xe0'):_0x1fd847['childModel']=_0xfc86('0xe1');_0x1fd847['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xfc86('0x7b')}];break;case _0xfc86('0xe2'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xe3');break;case _0xfc86('0xe4'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xe5');break;default:return _0x1fd847;}return _0x1fd847;}