Built motion from commit fd055180.|2.6.30
[motion2.git] / server / api / userProfile / userProfile.model.js
index 5547869..6163d25 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf618=['sounds','Sound','tags','Template','triggers','Trigger','Trunk','variables','plugins','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','push','autoAssociation','model','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','Tag','Tags','color','tag','ThroughTags','openTabs','true','sms','fax','dataValues','openchannel','whatsapp','lodash','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','MailAccount','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','Users','role','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule'];(function(_0x5e2407,_0x375bc6){var _0x285838=function(_0x209907){while(--_0x209907){_0x5e2407['push'](_0x5e2407['shift']());}};_0x285838(++_0x375bc6);}(_0xf618,0x1d2));var _0x8f61=function(_0x8b29b3,_0x29ac61){_0x8b29b3=_0x8b29b3-0x0;var _0x294497=_0xf618[_0x8b29b3];return _0x294497;};'use strict';var _=require(_0x8f61('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x8f61('0x1'));module[_0x8f61('0x2')]=function(_0x3bdb81){var _0x193c95=_0x3bdb81[_0x8f61('0x3')];function _0x451612(_0x1bddd4,_0x6c6427){return new Promise(function(_0xa86dc9,_0x1a5f61){if(!_0x6c6427)return _0xa86dc9(null);var _0x2cf43e=_0x6c6427[_0x8f61('0x4')]?{[_0x6c6427[_0x8f61('0x4')][_0x8f61('0x5')]]:_0x6c6427[_0x8f61('0x4')][_0x8f61('0x6')]}:undefined;return _0x193c95[_0x1bddd4][_0x8f61('0x7')]({'where':_0x2cf43e,'raw':!![]})[_0x8f61('0x8')](function(_0x4f1dd8){_0x6c6427[_0x8f61('0x9')]=_[_0x8f61('0xa')](_0x4f1dd8,'id');_0xa86dc9(_0x6c6427);})[_0x8f61('0xb')](function(_0x5891ea){_0x1a5f61(_0x5891ea);});});}function _0x57e1bb(_0x1367b6,_0x4427ec){return new Promise(function(_0x187f80,_0x28a1cc){var _0x578984=_0x1367b6[_0x8f61('0x4')]?{[_0x1367b6[_0x8f61('0x4')]['field']]:_0x1367b6[_0x8f61('0x4')]['value']}:undefined;return _0x193c95[_0x1367b6['model']][_0x8f61('0x7')]({'where':_0x578984,'raw':!![]})[_0x8f61('0x8')](function(_0x5d49b8){_0x4427ec['associatedResources']=_[_0x8f61('0xa')](_0x5d49b8,function(_0x2dd4e3){return _0x2dd4e3[_0x8f61('0xc')];});_0x187f80(_0x4427ec);})[_0x8f61('0xb')](function(_0x3d2da1){_0x28a1cc(_0x3d2da1);});});}function _0x271c5e(_0x4de747,_0x563fbc,_0x4a13d7){if(!_0x563fbc)return Promise[_0x8f61('0xd')](null);return new Promise(function(_0x11b0e3,_0x5d9bb0){return _0x193c95[_0x8f61('0xe')][_0x8f61('0x7')]({'where':{'sectionId':_0x563fbc['id']},'raw':!![]})['then'](function(_0x508afe){if(_0x4de747[_0x8f61('0x5')]&&_0x4de747[_0x8f61('0x5')]!=='id'){_0x563fbc[_0x8f61('0x9')]=_[_0x8f61('0xa')](_0x508afe,function(_0x142803){return _0x142803[_0x4de747[_0x8f61('0x5')]];});}else{if(_0x4a13d7===_0x8f61('0xf')){_0x563fbc['associatedResources']=_[_0x8f61('0xa')](_0x508afe,function(_0x2409c6){return{'id':_0x2409c6[_0x8f61('0x10')],'type':_0x2409c6[_0x8f61('0x11')]};});}else{_0x563fbc[_0x8f61('0x9')]=_[_0x8f61('0xa')](_0x508afe,function(_0x3b193f){return _0x3b193f[_0x8f61('0x10')];});}}_0x11b0e3(_0x563fbc);})['catch'](function(_0xe19d){_0x5d9bb0(_0xe19d);});});}function _0x7c99a2(_0x48dd5c,_0x1bca69){var _0x3a9776={'parentSections':[]};switch(_0x48dd5c['toLowerCase']()){case _0x8f61('0x12'):_0x3a9776['childModel']=_0x8f61('0x13');break;case _0x8f61('0x14'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x16');break;case'squarerecordings':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x17');_0x3a9776[_0x8f61('0x18')]=[{'name':_0x8f61('0x19'),'field':_0x8f61('0xc'),'foreignKey':'projectName'}];break;case _0x8f61('0x1a'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x1b');break;case _0x8f61('0x1c'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x1d');_0x3a9776['parentSections']=[{'name':_0x8f61('0x1e'),'field':'id','foreignKey':_0x8f61('0x1f')}];break;case _0x8f61('0x20'):_0x3a9776[_0x8f61('0x15')]='CmList';break;case'companies':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x21');break;case _0x8f61('0x22'):_0x3a9776['childModel']=_0x8f61('0x23');break;case _0x8f61('0x24'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x25');break;case _0x8f61('0x26'):_0x3a9776[_0x8f61('0x15')]='ChatWebsite';break;case _0x8f61('0x27'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x28');break;case'faxaccounts':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x29');break;case _0x8f61('0x2a'):case _0x8f61('0x2b'):case'outboundroutes':_0x3a9776[_0x8f61('0x15')]='VoiceExtension';break;case _0x8f61('0x2c'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x2d');break;case _0x8f61('0x2e'):_0x3a9776[_0x8f61('0x15')]='VoiceMail';break;case _0x8f61('0x2f'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x30');_0x3a9776[_0x8f61('0x18')]=[{'name':_0x8f61('0x31'),'field':_0x8f61('0xc'),'foreignKey':'membername','model':_0x8f61('0x32'),'filter':{'field':'role','value':[_0x8f61('0x33')]}},{'name':_0x8f61('0x34'),'field':'name','foreignKey':_0x8f61('0x35'),'model':_0x8f61('0x32'),'filter':{'field':'role','value':[_0x8f61('0x36')]}},{'name':_0x8f61('0x37'),'field':_0x8f61('0xc'),'foreignKey':_0x8f61('0x38'),'model':_0x8f61('0x39'),'filter':{'field':'type','value':[_0x8f61('0x3a')]}},{'name':_0x8f61('0x3b'),'field':'name','foreignKey':_0x8f61('0x38'),'model':_0x8f61('0x39'),'filter':{'field':'type','value':['outbound']}}];break;case'musiconholds':_0x3a9776['childModel']=_0x8f61('0x3c');break;case'chanspies':_0x3a9776[_0x8f61('0x15')]='VoiceChanSpy';break;case _0x8f61('0x3d'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x3e');break;case _0x8f61('0x3f'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x40');break;case'mailqueues':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x41');break;case'mailaccounts':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x42');break;case'mailsubstatuses':_0x3a9776[_0x8f61('0x15')]='MailSubstatus';break;case _0x8f61('0x43'):_0x3a9776[_0x8f61('0x15')]='OpenchannelQueue';break;case _0x8f61('0x44'):_0x3a9776['childModel']=_0x8f61('0x45');break;case _0x8f61('0x46'):_0x3a9776['childModel']='SmsQueue';break;case _0x8f61('0x47'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x48');break;case _0x8f61('0x49'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x4a');break;case _0x8f61('0x4b'):_0x3a9776['childModel']=_0x8f61('0x4c');break;case _0x8f61('0x4d'):_0x3a9776['childModel']=_0x8f61('0x4e');break;case _0x8f61('0x4f'):case _0x8f61('0x50'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x39');if(_0x1bca69){_0x3a9776[_0x8f61('0x18')]=[{'name':'VoiceQueues'},{'name':_0x8f61('0x3b')}];}break;case'users':case _0x8f61('0x51'):case'telephones':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x32');if(_0x1bca69){_0x3a9776['parentSections']=[{'name':_0x8f61('0x52'),'filter':{'field':_0x8f61('0x53'),'value':[_0x8f61('0x54'),_0x8f61('0x55')]},'ignore':!![]},{'name':_0x8f61('0x31')},{'name':_0x8f61('0x34')}];}break;case'zendeskaccounts':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x56');break;case _0x8f61('0x57'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x58');break;case _0x8f61('0x59'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x5a');break;case'sugarcrmaccounts':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x5b');break;case _0x8f61('0x5c'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x5d');break;case'zohoaccounts':_0x3a9776[_0x8f61('0x15')]='ZohoAccount';break;case _0x8f61('0x5e'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x32');break;case'cannedanswers':_0x3a9776[_0x8f61('0x15')]='CannedAnswer';break;case _0x8f61('0x5f'):_0x3a9776['childModel']='Disposition';break;case _0x8f61('0x60'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x61');break;case _0x8f61('0x62'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x63');break;case _0x8f61('0x64'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x65');break;case _0x8f61('0x66'):_0x3a9776['childModel']=_0x8f61('0x67');break;case _0x8f61('0x68'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x69');break;case _0x8f61('0x6a'):_0x3a9776[_0x8f61('0x15')]='Tag';break;case'templates':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x6b');break;case _0x8f61('0x6c'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x6d');break;case'trunks':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x6e');break;case _0x8f61('0x6f'):_0x3a9776[_0x8f61('0x15')]='Variable';break;case _0x8f61('0x70'):_0x3a9776[_0x8f61('0x15')]='Plugin';break;case _0x8f61('0x71'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0xf');_0x3a9776[_0x8f61('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0x8f61('0x72')}];break;case _0x8f61('0x73'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x74');break;}return _0x3a9776;}function _0x5e8c09(_0x567af3,_0x5a79ac){var _0x5492e4=_0x567af3[_0x8f61('0x75')](0x0)[_0x8f61('0x76')]()+_0x567af3[_0x8f61('0x77')](0x1);var _0x470dc4={'type':_0x193c95[_0x8f61('0x78')]['QueryTypes'][_0x8f61('0x79')],'raw':!![]};return new Promise(function(_0x51e0d6,_0x3ec0d0){var _0x1ff700=squel[_0x8f61('0x7a')]()[_0x8f61('0x5')](_0x8f61('0x7b')+_0x5492e4+_0x8f61('0x7c'),'id')[_0x8f61('0x5')]('ui.createdAt')[_0x8f61('0x7d')]('user_has_'+_0x567af3+_0x8f61('0x7e'),'ui')[_0x8f61('0x7f')](_0x8f61('0x80'),_0x5a79ac['id']);return _0x193c95['sequelize'][_0x8f61('0x81')](_0x1ff700[_0x8f61('0x82')](),_0x470dc4)[_0x8f61('0x8')](function(_0x315990){_0x5a79ac[_0x5492e4+_0x8f61('0x83')]=_0x315990;_0x51e0d6(_0x315990);})[_0x8f61('0xb')](function(_0x5a2c9f){_0x3ec0d0(_0x5a2c9f);});});}return _0x3bdb81[_0x8f61('0x84')](_0x8f61('0x85'),attributes,{'tableName':_0x8f61('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x203e28){var _0x35952c=require(_0x8f61('0x87'));var _0x4832bc={'raw':_0x203e28[_0x8f61('0x81')][_0x8f61('0x88')],'where':{}};var _0x954566={};var _0xeb1696={'count':0x0,'rows':[]};var _0x577bf6=_0x203e28[_0x8f61('0x81')][_0x8f61('0x89')];var _0x208fcd=_0x203e28[_0x8f61('0x81')][_0x8f61('0x8a')]||![];var _0x9e8ecd=_0x7c99a2(_0x577bf6,_0x208fcd);if(!_0x9e8ecd[_0x8f61('0x15')])throw new Error(_0x8f61('0x8b')+_0x577bf6+'\x27');var _0x4cc6f4=[{'name':_0x577bf6}];if(!_[_0x8f61('0x8c')](_0x9e8ecd['parentSections']))_0x4cc6f4=_0x9e8ecd[_0x8f61('0x18')];var _0x3cd117=[];for(var _0x4f1468=0x0;_0x4f1468<_0x4cc6f4[_0x8f61('0x8d')];_0x4f1468++){_0x3cd117['push'](_0x193c95['UserProfileSection'][_0x8f61('0x8e')]({'where':{'userProfileId':_0x203e28[_0x8f61('0x8f')]['id'],'name':_0x4cc6f4[_0x4f1468][_0x8f61('0xc')]},'raw':!![]}));}return Promise[_0x8f61('0x90')](_0x3cd117)['then'](function(_0x2bb81e){var _0x1c20f2=_[_0x8f61('0x4')](_0x2bb81e,function(_0x4b7c32){return _0x4b7c32?_0x4b7c32:undefined;});var _0x1d1281=_[_0x8f61('0x4')](_0x4cc6f4,[_0x8f61('0x91'),!![]]);var _0x42b2f3=_[_0x8f61('0x8c')](_0x1c20f2)&&_[_0x8f61('0x8c')](_0x1d1281)?null:_['union'](_0x1d1281,_0x1c20f2);if(!_0x42b2f3)return null;var _0x513dd5=[];for(var _0x4e7696=0x0;_0x4e7696<_0x42b2f3[_0x8f61('0x8d')];_0x4e7696++){var _0x1d1b92=_[_0x8f61('0x8e')](_0x4cc6f4,function(_0x13681f){return _0x42b2f3[_0x4e7696]?_0x13681f[_0x8f61('0xc')]===_0x42b2f3[_0x4e7696][_0x8f61('0xc')]:null;});if(_0x1d1b92){if(_0x42b2f3[_0x4e7696]['ignore']){_0x513dd5[_0x8f61('0x92')](_0x451612(_0x9e8ecd[_0x8f61('0x15')],_0x42b2f3[_0x4e7696]));}else{if(!_0x42b2f3[_0x4e7696][_0x8f61('0x93')]){_0x513dd5[_0x8f61('0x92')](_0x271c5e(_0x1d1b92,_0x42b2f3[_0x4e7696],_0x9e8ecd[_0x8f61('0x15')]));}else{if(_0x1d1b92[_0x8f61('0x94')]){_0x513dd5[_0x8f61('0x92')](_0x57e1bb(_0x1d1b92,_0x42b2f3[_0x4e7696]));}}}}}return Promise[_0x8f61('0x90')](_0x513dd5);})['then'](function(_0x9e3e15){var _0xe2e715=_0x9e3e15;var _0x4bbc94=null;if(_0xe2e715){_0x4bbc94=_0xe2e715['length']===0x1?_0xe2e715[0x0]:null;}if(!_0x4bbc94&&!_0xe2e715)return _0xeb1696;var _0x48b4ca=_0x193c95[_0x9e8ecd[_0x8f61('0x15')]][_0x8f61('0x95')];_0x954566[_0x8f61('0x94')]=_[_0x8f61('0x96')](_0x48b4ca);_0x954566[_0x8f61('0x81')]=_[_0x8f61('0x96')](_0x203e28[_0x8f61('0x81')]);_0x954566['filters']=_[_0x8f61('0x97')](_0x954566[_0x8f61('0x94')],_0x954566[_0x8f61('0x81')]);_0x4832bc[_0x8f61('0x98')]=_[_0x8f61('0x97')](_0x954566[_0x8f61('0x94')],_0x35952c['fields'](_0x203e28['query'][_0x8f61('0x99')]));_0x4832bc[_0x8f61('0x98')]=_0x4832bc[_0x8f61('0x98')][_0x8f61('0x8d')]?_0x4832bc[_0x8f61('0x98')]:_0x954566[_0x8f61('0x94')];if(!_0x203e28[_0x8f61('0x81')][_0x8f61('0x9a')](_0x8f61('0x9b'))){_0x4832bc[_0x8f61('0x9c')]=_0x35952c[_0x8f61('0x9c')](_0x203e28[_0x8f61('0x81')][_0x8f61('0x9c')]);_0x4832bc['offset']=_0x35952c[_0x8f61('0x9d')](_0x203e28[_0x8f61('0x81')]['offset']);}_0x4832bc[_0x8f61('0x9e')]=_0x35952c[_0x8f61('0x9f')](_0x203e28['query'][_0x8f61('0x9f')]);_0x4832bc[_0x8f61('0x7f')]=_0x35952c[_0x8f61('0xa0')](_[_0x8f61('0xa1')](_0x203e28[_0x8f61('0x81')],_0x954566['filters']));if(_0x203e28['query'][_0x8f61('0x4')]){_0x4832bc[_0x8f61('0x7f')]=_['merge'](_0x4832bc[_0x8f61('0x7f')],{'$or':_[_0x8f61('0xa')](_0x48b4ca,function(_0x306089){if(_0x306089[_0x8f61('0x11')]['key']!==_0x8f61('0xa2')){var _0x36de75={};_0x36de75[_0x306089[_0x8f61('0x5')]]={'$like':'%'+_0x203e28['query'][_0x8f61('0x4')]+'%'};return _0x36de75;}})});}var _0x4b4be9=[];var _0x5ed69f=null;var _0x5c9521={};if(_0x4bbc94){_0x5ed69f=_['find'](_0x4cc6f4,['name',_0x4bbc94[_0x8f61('0xc')]]);if(_0x5ed69f[_0x8f61('0x5')]){_0x5c9521={};if(_0x9e8ecd[_0x8f61('0x15')]===_0x8f61('0xf')){_0x5c9521[_0x5ed69f['foreignKey']]=_['map'](_0x4bbc94[_0x8f61('0x9')],'id');}else{_0x5c9521[_0x5ed69f[_0x8f61('0xa3')]]=_0x4bbc94[_0x8f61('0x9')];}_0x4b4be9[_0x8f61('0x92')](_0x5c9521);}else{_0x4832bc[_0x8f61('0x7f')]['id']=_0x4bbc94['associatedResources'];}}else{for(var _0x414cc2=0x0;_0x414cc2<_0xe2e715[_0x8f61('0x8d')];_0x414cc2++){_0x5ed69f=_[_0x8f61('0x8e')](_0x4cc6f4,[_0x8f61('0xc'),_0xe2e715[_0x414cc2]['name']]);if(_0x5ed69f[_0x8f61('0x5')]){_0x5c9521={};_0x5c9521[_0x5ed69f[_0x8f61('0xa3')]]=_0xe2e715[_0x414cc2][_0x8f61('0x9')];_0x4b4be9[_0x8f61('0x92')](_0x5c9521);}else{if(!_0x4832bc['where']['id'])_0x4832bc[_0x8f61('0x7f')]['id']=[];_0xe2e715[_0x414cc2]['associatedResources'][_0x8f61('0xa4')](function(_0x28f18e){_0x4832bc[_0x8f61('0x7f')]['id'][_0x8f61('0x92')](_0x28f18e);});}}}if(!_[_0x8f61('0x8c')](_0x4b4be9)){_0x4832bc[_0x8f61('0x7f')]=_[_0x8f61('0xa5')](_0x4832bc[_0x8f61('0x7f')],{'$and':{'$or':_0x4b4be9}});}_0x4832bc=_[_0x8f61('0xa5')]({},_0x4832bc,_0x203e28[_0x8f61('0xa6')]);if(_0x4bbc94&&!_0x4bbc94[_0x8f61('0x93')]&&_0x9e8ecd[_0x8f61('0x15')]==='AnalyticExtractedReport'){if(_0x203e28[_0x8f61('0x81')][_0x8f61('0xa7')]){_0x4832bc[_0x8f61('0xa8')]=[{'all':!![]}];}return _0x193c95[_0x9e8ecd[_0x8f61('0x15')]]['findAll'](_0x4832bc)[_0x8f61('0x8')](function(_0x24812b){var _0x4f16c6=[];_0x24812b[_0x8f61('0xa4')](function(_0x5e2056){var _0x1db45a;switch(_0x5e2056[_0x8f61('0xa9')]){case _0x8f61('0xaa'):_0x1db45a=_['find'](_0x4bbc94[_0x8f61('0x9')],function(_0x25d04b){return _0x25d04b['id']===_0x5e2056[_0x8f61('0x72')]&&_0x25d04b['type']===_0x8f61('0xab');});break;case _0x8f61('0xac'):_0x1db45a=_['find'](_0x4bbc94[_0x8f61('0x9')],function(_0x2fe1ec){return _0x2fe1ec['id']===_0x5e2056[_0x8f61('0x72')]&&_0x2fe1ec[_0x8f61('0x11')]==='CustomReports';});break;}if(_0x1db45a)_0x4f16c6[_0x8f61('0x92')](_0x5e2056);});_0xeb1696[_0x8f61('0xad')]=_0x4f16c6[_0x8f61('0x8d')];_0xeb1696[_0x8f61('0xae')]=_0x4f16c6;return _0xeb1696;});}else{if(!_[_0x8f61('0x8c')](_0x203e28[_0x8f61('0x81')]['ids'])){_0x4832bc[_0x8f61('0x7f')]['id']=_0x4832bc[_0x8f61('0x7f')]['id']?_['intersection'](_0x4832bc[_0x8f61('0x7f')]['id'],_0x203e28[_0x8f61('0x81')][_0x8f61('0xaf')]):_0x203e28[_0x8f61('0x81')][_0x8f61('0xaf')];if(_0x203e28[_0x8f61('0x81')][_0x8f61('0xb0')]){_0x4832bc['order']=_0x203e28[_0x8f61('0x81')][_0x8f61('0xb0')];}}if(_0x203e28[_0x8f61('0x81')][_0x8f61('0xb1')]){_0x4832bc[_0x8f61('0x7f')]=_[_0x8f61('0xa5')](_0x4832bc[_0x8f61('0x7f')],{'$and':_0x203e28['query'][_0x8f61('0xb1')]});}return _0x193c95[_0x9e8ecd[_0x8f61('0x15')]][_0x8f61('0xad')]({'where':_0x4832bc[_0x8f61('0x7f')]})[_0x8f61('0x8')](function(_0x3735cd){_0xeb1696['count']=_0x3735cd;if(_0x203e28[_0x8f61('0x81')][_0x8f61('0xa7')]){if(_0x9e8ecd['childModel']===_0x8f61('0x1d')){_0x4832bc[_0x8f61('0xa8')]=[{'model':_0x193c95[_0x8f61('0xb2')],'as':_0x8f61('0xb3'),'attributes':['id',_0x8f61('0xc'),_0x8f61('0xb4')],'required':_0x203e28[_0x8f61('0x81')][_0x8f61('0xb5')]?!![]:![]},{'model':_0x193c95[_0x8f61('0xb2')],'as':_0x8f61('0xb6'),'attributes':['id',_0x8f61('0xc'),_0x8f61('0xb4')],'through':_0x203e28[_0x8f61('0x81')][_0x8f61('0xb5')]?{'attributes':[],'where':{'TagId':_0x203e28[_0x8f61('0x81')][_0x8f61('0xb5')]||undefined}}:{},'required':_0x203e28['query'][_0x8f61('0xb5')]?!![]:![]}];}else{_0x4832bc[_0x8f61('0xa8')]=[{'all':!![]}];}}return _0x193c95[_0x9e8ecd['childModel']][_0x8f61('0x7')](_0x4832bc);})[_0x8f61('0x8')](function(_0x49c391){_0xeb1696[_0x8f61('0xae')]=_0x49c391;if(_0x577bf6===_0x8f61('0x31')&&_0x203e28[_0x8f61('0x81')][_0x8f61('0xb7')]===_0x8f61('0xb8')){var _0x2be95d=[];for(var _0x3cda78=0x0;_0x3cda78<_0xeb1696[_0x8f61('0xae')][_0x8f61('0x8d')];_0x3cda78++){_0x2be95d[_0x8f61('0x92')](_0x5e8c09('chat',_0xeb1696[_0x8f61('0xae')][_0x3cda78]['dataValues']));_0x2be95d[_0x8f61('0x92')](_0x5e8c09(_0x8f61('0xb9'),_0xeb1696[_0x8f61('0xae')][_0x3cda78]['dataValues']));_0x2be95d['push'](_0x5e8c09(_0x8f61('0xba'),_0xeb1696['rows'][_0x3cda78][_0x8f61('0xbb')]));_0x2be95d['push'](_0x5e8c09('mail',_0xeb1696[_0x8f61('0xae')][_0x3cda78]['dataValues']));_0x2be95d[_0x8f61('0x92')](_0x5e8c09(_0x8f61('0xbc'),_0xeb1696[_0x8f61('0xae')][_0x3cda78][_0x8f61('0xbb')]));_0x2be95d[_0x8f61('0x92')](_0x5e8c09(_0x8f61('0xbd'),_0xeb1696[_0x8f61('0xae')][_0x3cda78][_0x8f61('0xbb')]));}return Promise[_0x8f61('0x90')](_0x2be95d)['then'](function(){return _0xeb1696;});}return _0xeb1696;});}});}}});};
\ No newline at end of file
+var _0xc7ba=['params','all','ignore','union','length','autoAssociation','push','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','VIRTUAL','foreignKey','forEach','merge','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','tag','ThroughTags','color','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','then','associatedResources','map','model','findAll','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareRecording','parentSections','projectName','projects','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','Plugin','extractedreports','AnalyticExtractedReport','reportId','toUpperCase','slice','QueryTypes','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','query','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','find'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc7ba,0x1b1));var _0xac7b=function(_0x1da907,_0x44795f){_0x1da907=_0x1da907-0x0;var _0x4c9cca=_0xc7ba[_0x1da907];return _0x4c9cca;};'use strict';var _=require(_0xac7b('0x0'));var attributes=require(_0xac7b('0x1'));var squel=require(_0xac7b('0x2'));module[_0xac7b('0x3')]=function(_0x3a4ea3){var _0x1671d7=_0x3a4ea3[_0xac7b('0x4')];function _0x7f656d(_0x21367a,_0xe72920){return new Promise(function(_0xf0073e,_0x2fb273){if(!_0xe72920)return _0xf0073e(null);var _0x2e02c2=_0xe72920[_0xac7b('0x5')]?{[_0xe72920['filter'][_0xac7b('0x6')]]:_0xe72920[_0xac7b('0x5')][_0xac7b('0x7')]}:undefined;return _0x1671d7[_0x21367a]['findAll']({'where':_0x2e02c2,'raw':!![]})[_0xac7b('0x8')](function(_0x52452f){_0xe72920[_0xac7b('0x9')]=_[_0xac7b('0xa')](_0x52452f,'id');_0xf0073e(_0xe72920);})['catch'](function(_0xce0e3d){_0x2fb273(_0xce0e3d);});});}function _0x24e696(_0x1591a1,_0x13617e){return new Promise(function(_0x5662b2,_0x1dc9a5){var _0x3e68d7=_0x1591a1[_0xac7b('0x5')]?{[_0x1591a1['filter']['field']]:_0x1591a1['filter'][_0xac7b('0x7')]}:undefined;return _0x1671d7[_0x1591a1[_0xac7b('0xb')]][_0xac7b('0xc')]({'where':_0x3e68d7,'raw':!![]})[_0xac7b('0x8')](function(_0x3304aa){_0x13617e[_0xac7b('0x9')]=_[_0xac7b('0xa')](_0x3304aa,function(_0x160dcc){return _0x160dcc[_0xac7b('0xd')];});_0x5662b2(_0x13617e);})[_0xac7b('0xe')](function(_0x39087f){_0x1dc9a5(_0x39087f);});});}function _0x4373c1(_0xa742cd,_0x250006,_0x3fc6a9){if(!_0x250006)return Promise[_0xac7b('0xf')](null);return new Promise(function(_0x58e185,_0xd47e99){return _0x1671d7[_0xac7b('0x10')][_0xac7b('0xc')]({'where':{'sectionId':_0x250006['id']},'raw':!![]})[_0xac7b('0x8')](function(_0x15508d){if(_0xa742cd[_0xac7b('0x6')]&&_0xa742cd['field']!=='id'){_0x250006[_0xac7b('0x9')]=_[_0xac7b('0xa')](_0x15508d,function(_0x38e206){return _0x38e206[_0xa742cd[_0xac7b('0x6')]];});}else{if(_0x3fc6a9==='AnalyticExtractedReport'){_0x250006['associatedResources']=_[_0xac7b('0xa')](_0x15508d,function(_0x257101){return{'id':_0x257101[_0xac7b('0x11')],'type':_0x257101[_0xac7b('0x12')]};});}else{_0x250006['associatedResources']=_[_0xac7b('0xa')](_0x15508d,function(_0x236866){return _0x236866[_0xac7b('0x11')];});}}_0x58e185(_0x250006);})[_0xac7b('0xe')](function(_0x383a43){_0xd47e99(_0x383a43);});});}function _0x50d370(_0xf0a6c5,_0x578ba9){var _0x54769b={'parentSections':[]};switch(_0xf0a6c5[_0xac7b('0x13')]()){case _0xac7b('0x14'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x16');break;case'odbc':_0x54769b[_0xac7b('0x15')]='SquareOdbc';break;case'squarerecordings':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x17');_0x54769b[_0xac7b('0x18')]=[{'name':'SquareProjects','field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x19')}];break;case _0xac7b('0x1a'):_0x54769b[_0xac7b('0x15')]='JscriptyProject';break;case'contacts':_0x54769b[_0xac7b('0x15')]='CmContact';_0x54769b[_0xac7b('0x18')]=[{'name':_0xac7b('0x1b'),'field':'id','foreignKey':_0xac7b('0x1c')}];break;case _0xac7b('0x1d'):_0x54769b[_0xac7b('0x15')]='CmList';break;case _0xac7b('0x1e'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x1f');break;case'globalcustomfields':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x20');break;case _0xac7b('0x21'):_0x54769b[_0xac7b('0x15')]='ChatQueue';break;case'chatwebsites':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x22');break;case _0xac7b('0x23'):_0x54769b['childModel']=_0xac7b('0x24');break;case _0xac7b('0x25'):_0x54769b['childModel']=_0xac7b('0x26');break;case'inboundroutes':case _0xac7b('0x27'):case _0xac7b('0x28'):_0x54769b[_0xac7b('0x15')]='VoiceExtension';break;case'contexts':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x29');break;case'voicemails':_0x54769b['childModel']=_0xac7b('0x2a');break;case _0xac7b('0x2b'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x2c');_0x54769b[_0xac7b('0x18')]=[{'name':'Agents','field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x2d'),'model':_0xac7b('0x2e'),'filter':{'field':_0xac7b('0x2f'),'value':[_0xac7b('0x30')]}},{'name':_0xac7b('0x31'),'field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x2d'),'model':_0xac7b('0x2e'),'filter':{'field':_0xac7b('0x2f'),'value':[_0xac7b('0x32')]}},{'name':_0xac7b('0x33'),'field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x34'),'model':'VoiceQueue','filter':{'field':_0xac7b('0x12'),'value':[_0xac7b('0x35')]}},{'name':_0xac7b('0x36'),'field':'name','foreignKey':_0xac7b('0x34'),'model':_0xac7b('0x37'),'filter':{'field':'type','value':[_0xac7b('0x38')]}}];break;case _0xac7b('0x39'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x3a');break;case _0xac7b('0x3b'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x3c');break;case _0xac7b('0x3d'):_0x54769b['childModel']=_0xac7b('0x3e');break;case'ivrcampaigns':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x3f');break;case _0xac7b('0x40'):_0x54769b['childModel']=_0xac7b('0x41');break;case _0xac7b('0x42'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x43');break;case _0xac7b('0x44'):_0x54769b['childModel']=_0xac7b('0x45');break;case _0xac7b('0x46'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x47');break;case _0xac7b('0x48'):_0x54769b['childModel']=_0xac7b('0x49');break;case _0xac7b('0x4a'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4b');break;case'smsaccounts':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4c');break;case'whatsappqueues':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4d');break;case _0xac7b('0x4e'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4f');break;case _0xac7b('0x50'):_0x54769b['childModel']=_0xac7b('0x51');break;case _0xac7b('0x52'):case _0xac7b('0x53'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x37');if(_0x578ba9){_0x54769b[_0xac7b('0x18')]=[{'name':'VoiceQueues'},{'name':_0xac7b('0x36')}];}break;case _0xac7b('0x54'):case _0xac7b('0x55'):case _0xac7b('0x56'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x2e');if(_0x578ba9){_0x54769b[_0xac7b('0x18')]=[{'name':_0xac7b('0x57'),'filter':{'field':_0xac7b('0x2f'),'value':[_0xac7b('0x58'),_0xac7b('0x59')]},'ignore':!![]},{'name':_0xac7b('0x5a')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x54769b['childModel']=_0xac7b('0x5b');break;case _0xac7b('0x5c'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x5d');break;case _0xac7b('0x5e'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x5f');break;case'sugarcrmaccounts':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x60');break;case _0xac7b('0x61'):_0x54769b['childModel']='DeskAccount';break;case _0xac7b('0x62'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x63');break;case _0xac7b('0x64'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x2e');break;case _0xac7b('0x65'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x66');break;case _0xac7b('0x67'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x68');break;case _0xac7b('0x69'):_0x54769b['childModel']=_0xac7b('0x6a');break;case'intervals':_0x54769b['childModel']=_0xac7b('0x6b');break;case'pauses':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x6c');break;case _0xac7b('0x6d'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x6e');break;case _0xac7b('0x6f'):_0x54769b['childModel']='Sound';break;case _0xac7b('0x70'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x71');break;case _0xac7b('0x72'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x73');break;case _0xac7b('0x74'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x75');break;case _0xac7b('0x76'):_0x54769b['childModel']=_0xac7b('0x77');break;case'variables':_0x54769b['childModel']=_0xac7b('0x78');break;case'plugins':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x79');break;case _0xac7b('0x7a'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x7b');_0x54769b[_0xac7b('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0xac7b('0x7c')}];break;case'metrics':_0x54769b['childModel']='AnalyticMetric';break;}return _0x54769b;}function _0x616678(_0x35a45e,_0x3a40a9){var _0x40ff6c=_0x35a45e['charAt'](0x0)[_0xac7b('0x7d')]()+_0x35a45e[_0xac7b('0x7e')](0x1);var _0x2f1448={'type':_0x1671d7['Sequelize'][_0xac7b('0x7f')]['SELECT'],'raw':!![]};return new Promise(function(_0x3ede66,_0x366a1a){var _0x4392fa=squel['select']()[_0xac7b('0x6')](_0xac7b('0x80')+_0x40ff6c+_0xac7b('0x81'),'id')[_0xac7b('0x6')](_0xac7b('0x82'))[_0xac7b('0x83')](_0xac7b('0x84')+_0x35a45e+'_interactions','ui')[_0xac7b('0x85')](_0xac7b('0x86'),_0x3a40a9['id']);return _0x1671d7['sequelize']['query'](_0x4392fa[_0xac7b('0x87')](),_0x2f1448)[_0xac7b('0x8')](function(_0x483312){_0x3a40a9[_0x40ff6c+_0xac7b('0x88')]=_0x483312;_0x3ede66(_0x483312);})['catch'](function(_0x5ee276){_0x366a1a(_0x5ee276);});});}return _0x3a4ea3[_0xac7b('0x89')]('UserProfile',attributes,{'tableName':_0xac7b('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2145e8){var _0x77afa3=require(_0xac7b('0x8b'));var _0x29d341={'raw':_0x2145e8[_0xac7b('0x8c')][_0xac7b('0x8d')],'where':{}};var _0x231b7f={};var _0x37969f={'count':0x0,'rows':[]};var _0x21842d=_0x2145e8[_0xac7b('0x8c')]['section'];var _0x303945=_0x2145e8[_0xac7b('0x8c')][_0xac7b('0x8e')]||![];var _0x5c7873=_0x50d370(_0x21842d,_0x303945);if(!_0x5c7873[_0xac7b('0x15')])throw new Error(_0xac7b('0x8f')+_0x21842d+'\x27');var _0x21d17d=[{'name':_0x21842d}];if(!_[_0xac7b('0x90')](_0x5c7873[_0xac7b('0x18')]))_0x21d17d=_0x5c7873[_0xac7b('0x18')];var _0x1337fe=[];for(var _0x3aee0d=0x0;_0x3aee0d<_0x21d17d['length'];_0x3aee0d++){_0x1337fe['push'](_0x1671d7['UserProfileSection'][_0xac7b('0x91')]({'where':{'userProfileId':_0x2145e8[_0xac7b('0x92')]['id'],'name':_0x21d17d[_0x3aee0d][_0xac7b('0xd')]},'raw':!![]}));}return Promise[_0xac7b('0x93')](_0x1337fe)[_0xac7b('0x8')](function(_0x3ee4f0){var _0x427c63=_['filter'](_0x3ee4f0,function(_0x504a59){return _0x504a59?_0x504a59:undefined;});var _0x29d74d=_[_0xac7b('0x5')](_0x21d17d,[_0xac7b('0x94'),!![]]);var _0x1c0a03=_['isEmpty'](_0x427c63)&&_[_0xac7b('0x90')](_0x29d74d)?null:_[_0xac7b('0x95')](_0x29d74d,_0x427c63);if(!_0x1c0a03)return null;var _0xca6e30=[];for(var _0x1dda09=0x0;_0x1dda09<_0x1c0a03[_0xac7b('0x96')];_0x1dda09++){var _0x14f5e3=_[_0xac7b('0x91')](_0x21d17d,function(_0x3849e6){return _0x1c0a03[_0x1dda09]?_0x3849e6[_0xac7b('0xd')]===_0x1c0a03[_0x1dda09][_0xac7b('0xd')]:null;});if(_0x14f5e3){if(_0x1c0a03[_0x1dda09][_0xac7b('0x94')]){_0xca6e30['push'](_0x7f656d(_0x5c7873[_0xac7b('0x15')],_0x1c0a03[_0x1dda09]));}else{if(!_0x1c0a03[_0x1dda09][_0xac7b('0x97')]){_0xca6e30[_0xac7b('0x98')](_0x4373c1(_0x14f5e3,_0x1c0a03[_0x1dda09],_0x5c7873[_0xac7b('0x15')]));}else{if(_0x14f5e3[_0xac7b('0xb')]){_0xca6e30[_0xac7b('0x98')](_0x24e696(_0x14f5e3,_0x1c0a03[_0x1dda09]));}}}}}return Promise[_0xac7b('0x93')](_0xca6e30);})[_0xac7b('0x8')](function(_0x3219bf){var _0x734297=_0x3219bf;var _0x3e176c=null;if(_0x734297){_0x3e176c=_0x734297[_0xac7b('0x96')]===0x1?_0x734297[0x0]:null;}if(!_0x3e176c&&!_0x734297)return _0x37969f;var _0x1d1662=_0x1671d7[_0x5c7873[_0xac7b('0x15')]][_0xac7b('0x99')];_0x231b7f['model']=_[_0xac7b('0x9a')](_0x1d1662);_0x231b7f[_0xac7b('0x8c')]=_['keys'](_0x2145e8[_0xac7b('0x8c')]);_0x231b7f[_0xac7b('0x9b')]=_[_0xac7b('0x9c')](_0x231b7f['model'],_0x231b7f[_0xac7b('0x8c')]);_0x29d341[_0xac7b('0x9d')]=_[_0xac7b('0x9c')](_0x231b7f[_0xac7b('0xb')],_0x77afa3[_0xac7b('0x9e')](_0x2145e8['query'][_0xac7b('0x9e')]));_0x29d341['attributes']=_0x29d341[_0xac7b('0x9d')][_0xac7b('0x96')]?_0x29d341[_0xac7b('0x9d')]:_0x231b7f['model'];if(!_0x2145e8[_0xac7b('0x8c')][_0xac7b('0x9f')](_0xac7b('0xa0'))){_0x29d341['limit']=_0x77afa3[_0xac7b('0xa1')](_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xa1')]);_0x29d341['offset']=_0x77afa3[_0xac7b('0xa2')](_0x2145e8['query'][_0xac7b('0xa2')]);}_0x29d341[_0xac7b('0xa3')]=_0x77afa3[_0xac7b('0xa4')](_0x2145e8[_0xac7b('0x8c')]['sort']);_0x29d341[_0xac7b('0x85')]=_0x77afa3['filters'](_['pick'](_0x2145e8[_0xac7b('0x8c')],_0x231b7f[_0xac7b('0x9b')]));if(_0x2145e8[_0xac7b('0x8c')]['filter']){_0x29d341[_0xac7b('0x85')]=_['merge'](_0x29d341['where'],{'$or':_[_0xac7b('0xa')](_0x1d1662,function(_0x92652e){if(_0x92652e['type']['key']!==_0xac7b('0xa5')){var _0x25d1a9={};_0x25d1a9[_0x92652e[_0xac7b('0x6')]]={'$like':'%'+_0x2145e8[_0xac7b('0x8c')]['filter']+'%'};return _0x25d1a9;}})});}var _0x2db8d2=[];var _0x520650=null;var _0x2d55e1={};if(_0x3e176c){_0x520650=_['find'](_0x21d17d,[_0xac7b('0xd'),_0x3e176c[_0xac7b('0xd')]]);if(_0x520650[_0xac7b('0x6')]){_0x2d55e1={};if(_0x5c7873[_0xac7b('0x15')]===_0xac7b('0x7b')){_0x2d55e1[_0x520650[_0xac7b('0xa6')]]=_[_0xac7b('0xa')](_0x3e176c['associatedResources'],'id');}else{_0x2d55e1[_0x520650[_0xac7b('0xa6')]]=_0x3e176c['associatedResources'];}_0x2db8d2[_0xac7b('0x98')](_0x2d55e1);}else{_0x29d341[_0xac7b('0x85')]['id']=_0x3e176c[_0xac7b('0x9')];}}else{for(var _0x344b6f=0x0;_0x344b6f<_0x734297[_0xac7b('0x96')];_0x344b6f++){_0x520650=_[_0xac7b('0x91')](_0x21d17d,['name',_0x734297[_0x344b6f][_0xac7b('0xd')]]);if(_0x520650[_0xac7b('0x6')]){_0x2d55e1={};_0x2d55e1[_0x520650[_0xac7b('0xa6')]]=_0x734297[_0x344b6f][_0xac7b('0x9')];_0x2db8d2['push'](_0x2d55e1);}else{if(!_0x29d341[_0xac7b('0x85')]['id'])_0x29d341[_0xac7b('0x85')]['id']=[];_0x734297[_0x344b6f][_0xac7b('0x9')][_0xac7b('0xa7')](function(_0x1ebd77){_0x29d341['where']['id']['push'](_0x1ebd77);});}}}if(!_['isEmpty'](_0x2db8d2)){_0x29d341[_0xac7b('0x85')]=_['merge'](_0x29d341['where'],{'$and':{'$or':_0x2db8d2}});}_0x29d341=_[_0xac7b('0xa8')]({},_0x29d341,_0x2145e8['options']);if(_0x3e176c&&!_0x3e176c[_0xac7b('0x97')]&&_0x5c7873['childModel']===_0xac7b('0x7b')){if(_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xa9')]){_0x29d341[_0xac7b('0xaa')]=[{'all':!![]}];}return _0x1671d7[_0x5c7873[_0xac7b('0x15')]][_0xac7b('0xc')](_0x29d341)[_0xac7b('0x8')](function(_0x347061){var _0x360a78=[];_0x347061[_0xac7b('0xa7')](function(_0x8aca6){var _0x1b0013;switch(_0x8aca6[_0xac7b('0xab')]){case'default':_0x1b0013=_[_0xac7b('0x91')](_0x3e176c[_0xac7b('0x9')],function(_0x29380f){return _0x29380f['id']===_0x8aca6[_0xac7b('0x7c')]&&_0x29380f[_0xac7b('0x12')]===_0xac7b('0xac');});break;case _0xac7b('0xad'):_0x1b0013=_[_0xac7b('0x91')](_0x3e176c[_0xac7b('0x9')],function(_0x473908){return _0x473908['id']===_0x8aca6[_0xac7b('0x7c')]&&_0x473908[_0xac7b('0x12')]===_0xac7b('0xae');});break;}if(_0x1b0013)_0x360a78[_0xac7b('0x98')](_0x8aca6);});_0x37969f[_0xac7b('0xaf')]=_0x360a78[_0xac7b('0x96')];_0x37969f[_0xac7b('0xb0')]=_0x360a78;return _0x37969f;});}else{if(!_[_0xac7b('0x90')](_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb1')])){_0x29d341[_0xac7b('0x85')]['id']=_0x29d341['where']['id']?_[_0xac7b('0x9c')](_0x29d341['where']['id'],_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb1')]):_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb1')];if(_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb2')]){_0x29d341[_0xac7b('0xa3')]=_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb2')];}}if(_0x2145e8[_0xac7b('0x8c')]['extraQueryConditions']){_0x29d341['where']=_[_0xac7b('0xa8')](_0x29d341[_0xac7b('0x85')],{'$and':_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb3')]});}return _0x1671d7[_0x5c7873[_0xac7b('0x15')]]['count']({'where':_0x29d341[_0xac7b('0x85')]})['then'](function(_0x423cec){_0x37969f[_0xac7b('0xaf')]=_0x423cec;if(_0x2145e8[_0xac7b('0x8c')]['includeAll']){if(_0x5c7873[_0xac7b('0x15')]===_0xac7b('0xb4')){_0x29d341['include']=[{'model':_0x1671d7['Tag'],'as':_0xac7b('0xb5'),'attributes':['id','name','color'],'required':_0x2145e8['query'][_0xac7b('0xb6')]?!![]:![]},{'model':_0x1671d7[_0xac7b('0x71')],'as':_0xac7b('0xb7'),'attributes':['id','name',_0xac7b('0xb8')],'through':_0x2145e8['query']['tag']?{'attributes':[],'where':{'TagId':_0x2145e8['query'][_0xac7b('0xb6')]||undefined}}:{},'required':_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb6')]?!![]:![]}];}else{_0x29d341[_0xac7b('0xaa')]=[{'all':!![]}];}}return _0x1671d7[_0x5c7873[_0xac7b('0x15')]][_0xac7b('0xc')](_0x29d341);})['then'](function(_0x363633){_0x37969f[_0xac7b('0xb0')]=_0x363633;if(_0x21842d===_0xac7b('0x5a')&&_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb9')]===_0xac7b('0xba')){var _0x431240=[];for(var _0x27182f=0x0;_0x27182f<_0x37969f['rows'][_0xac7b('0x96')];_0x27182f++){_0x431240[_0xac7b('0x98')](_0x616678('chat',_0x37969f[_0xac7b('0xb0')][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbc'),_0x37969f[_0xac7b('0xb0')][_0x27182f]['dataValues']));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbd'),_0x37969f['rows'][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbe'),_0x37969f[_0xac7b('0xb0')][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbf'),_0x37969f[_0xac7b('0xb0')][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xc0'),_0x37969f[_0xac7b('0xb0')][_0x27182f]['dataValues']));}return Promise[_0xac7b('0x93')](_0x431240)['then'](function(){return _0x37969f;});}return _0x37969f;});}});}}});};
\ No newline at end of file