Built motion from commit 7a4eb044.|2.5.36
[motion2.git] / server / api / userProfile / userProfile.model.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 _0x7bd0=['sounds','tags','Tag','templates','Template','Trigger','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','charAt','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','define','UserProfile','query','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','findAll','then','map','catch','field','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','role','Telephones','membername','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Schedule'];(function(_0x44e13b,_0x30fc1b){var _0xde1295=function(_0x9cc1db){while(--_0x9cc1db){_0x44e13b['push'](_0x44e13b['shift']());}};_0xde1295(++_0x30fc1b);}(_0x7bd0,0x111));var _0x07bd=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0x7bd0[_0x59342a];return _0x17abc9;};'use strict';var _=require(_0x07bd('0x0'));var attributes=require(_0x07bd('0x1'));var qs=require(_0x07bd('0x2'));var squel=require(_0x07bd('0x3'));module[_0x07bd('0x4')]=function(_0x1b76fd){var _0x38f4d1=_0x1b76fd[_0x07bd('0x5')];function _0x5beba7(_0x2d7245,_0x3b4f4f){return new Promise(function(_0x38f3f1,_0x313548){if(!_0x3b4f4f)return _0x38f3f1(null);var _0x3e8349=_0x3b4f4f[_0x07bd('0x6')]?{[_0x3b4f4f[_0x07bd('0x6')]['field']]:_0x3b4f4f[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x2d7245][_0x07bd('0x7')]({'where':_0x3e8349,'raw':!![]})[_0x07bd('0x8')](function(_0x323724){_0x3b4f4f['associatedResources']=_[_0x07bd('0x9')](_0x323724,'id');_0x38f3f1(_0x3b4f4f);})[_0x07bd('0xa')](function(_0x324a46){_0x313548(_0x324a46);});});}function _0x169b07(_0x489311,_0x3a45f3){return new Promise(function(_0x313ca5,_0x1b067a){var _0x222efa=_0x489311[_0x07bd('0x6')]?{[_0x489311[_0x07bd('0x6')][_0x07bd('0xb')]]:_0x489311[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x489311['model']][_0x07bd('0x7')]({'where':_0x222efa,'raw':!![]})[_0x07bd('0x8')](function(_0x1c59c2){_0x3a45f3[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x1c59c2,function(_0x2406b0){return _0x2406b0[_0x07bd('0xd')];});_0x313ca5(_0x3a45f3);})['catch'](function(_0x418444){_0x1b067a(_0x418444);});});}function _0x505839(_0x229bf1,_0x2dd97b,_0x31655a){if(!_0x2dd97b)return Promise[_0x07bd('0xe')](null);return new Promise(function(_0x8aa645,_0x4929d6){return _0x38f4d1[_0x07bd('0xf')][_0x07bd('0x7')]({'where':{'sectionId':_0x2dd97b['id']},'raw':!![]})['then'](function(_0x3e8ec4){if(_0x229bf1[_0x07bd('0xb')]&&_0x229bf1[_0x07bd('0xb')]!=='id'){_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x109dbc){return _0x109dbc[_0x229bf1[_0x07bd('0xb')]];});}else{if(_0x31655a===_0x07bd('0x10')){_0x2dd97b[_0x07bd('0xc')]=_['map'](_0x3e8ec4,function(_0x15c0b8){return{'id':_0x15c0b8[_0x07bd('0x11')],'type':_0x15c0b8[_0x07bd('0x12')]};});}else{_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x47bd50){return _0x47bd50['resourceId'];});}}_0x8aa645(_0x2dd97b);})[_0x07bd('0xa')](function(_0x51ca22){_0x4929d6(_0x51ca22);});});}function _0x2b0dee(_0x480c9c,_0x50bd12){var _0x4165bc={'parentSections':[]};switch(_0x480c9c[_0x07bd('0x13')]()){case _0x07bd('0x14'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x16');break;case _0x07bd('0x17'):_0x4165bc['childModel']=_0x07bd('0x18');break;case _0x07bd('0x19'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1a');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x1c'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1d');break;case _0x07bd('0x1e'):_0x4165bc['childModel']=_0x07bd('0x1f');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x20'),'field':'id','foreignKey':_0x07bd('0x21')}];break;case _0x07bd('0x22'):_0x4165bc[_0x07bd('0x15')]='CmList';break;case _0x07bd('0x23'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x24');break;case _0x07bd('0x25'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x26');break;case _0x07bd('0x27'):_0x4165bc[_0x07bd('0x15')]='ChatQueue';break;case'chatwebsites':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x28');break;case _0x07bd('0x29'):_0x4165bc['childModel']=_0x07bd('0x2a');break;case _0x07bd('0x2b'):_0x4165bc[_0x07bd('0x15')]='FaxAccount';break;case'inboundroutes':case _0x07bd('0x2c'):case _0x07bd('0x2d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2e');break;case'contexts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2f');break;case _0x07bd('0x30'):_0x4165bc['childModel']=_0x07bd('0x31');break;case _0x07bd('0x32'):_0x4165bc['childModel']=_0x07bd('0x33');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x34'),'field':_0x07bd('0xd'),'foreignKey':'membername','model':'User','filter':{'field':_0x07bd('0x35'),'value':['agent']}},{'name':_0x07bd('0x36'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x37'),'model':_0x07bd('0x38'),'filter':{'field':_0x07bd('0x35'),'value':[_0x07bd('0x39')]}},{'name':_0x07bd('0x3a'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3d')]}},{'name':_0x07bd('0x3e'),'field':'name','foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3f')]}}];break;case'musiconholds':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x40');break;case _0x07bd('0x41'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x42');break;case'voiceprefixes':_0x4165bc['childModel']=_0x07bd('0x43');break;case _0x07bd('0x44'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x45');break;case'mailqueues':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x46');break;case _0x07bd('0x47'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x48');break;case _0x07bd('0x49'):_0x4165bc[_0x07bd('0x15')]='MailSubstatus';break;case _0x07bd('0x4a'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4b');break;case _0x07bd('0x4c'):_0x4165bc[_0x07bd('0x15')]='OpenchannelAccount';break;case _0x07bd('0x4d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4e');break;case _0x07bd('0x4f'):_0x4165bc[_0x07bd('0x15')]='SmsAccount';break;case _0x07bd('0x50'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x51');break;case _0x07bd('0x52'):_0x4165bc['childModel']='WhatsappAccount';break;case _0x07bd('0x53'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x54');break;case _0x07bd('0x55'):case _0x07bd('0x56'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x3c');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x3a')},{'name':'QueueCampaigns'}];}break;case'users':case _0x07bd('0x57'):case _0x07bd('0x58'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x38');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x59'),'filter':{'field':'role','value':[_0x07bd('0x5a'),_0x07bd('0x5b')]},'ignore':!![]},{'name':_0x07bd('0x34')},{'name':_0x07bd('0x36')}];}break;case _0x07bd('0x5c'):_0x4165bc[_0x07bd('0x15')]='ZendeskAccount';break;case _0x07bd('0x5d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x5e');break;case _0x07bd('0x5f'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x60');break;case _0x07bd('0x61'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x62');break;case _0x07bd('0x63'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x64');break;case'zohoaccounts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x65');break;case _0x07bd('0x66'):_0x4165bc['childModel']='User';break;case _0x07bd('0x67'):_0x4165bc['childModel']=_0x07bd('0x68');break;case _0x07bd('0x69'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6a');break;case _0x07bd('0x6b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6c');break;case _0x07bd('0x6d'):_0x4165bc['childModel']=_0x07bd('0x6e');break;case _0x07bd('0x6f'):_0x4165bc[_0x07bd('0x15')]='Pause';break;case'scheduler':_0x4165bc['childModel']=_0x07bd('0x70');break;case _0x07bd('0x71'):_0x4165bc[_0x07bd('0x15')]='Sound';break;case _0x07bd('0x72'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x73');break;case _0x07bd('0x74'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x75');break;case'triggers':_0x4165bc['childModel']=_0x07bd('0x76');break;case'trunks':_0x4165bc['childModel']=_0x07bd('0x77');break;case _0x07bd('0x78'):_0x4165bc[_0x07bd('0x15')]='Variable';break;case _0x07bd('0x79'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x7a');break;case _0x07bd('0x7b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x10');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x7c'),'field':'id','foreignKey':_0x07bd('0x7d')}];break;case'metrics':_0x4165bc[_0x07bd('0x15')]='AnalyticMetric';break;}return _0x4165bc;}function _0x304796(_0x41fa36,_0x2b7907){var _0x4944e3=_0x41fa36[_0x07bd('0x7e')](0x0)['toUpperCase']()+_0x41fa36[_0x07bd('0x7f')](0x1);var _0x2ff31c={'type':_0x38f4d1[_0x07bd('0x80')][_0x07bd('0x81')]['SELECT'],'raw':!![]};return new Promise(function(_0x5dc6f6,_0x135e4e){var _0x5e4670=squel[_0x07bd('0x82')]()[_0x07bd('0xb')](_0x07bd('0x83')+_0x4944e3+_0x07bd('0x84'),'id')[_0x07bd('0xb')](_0x07bd('0x85'))['from'](_0x07bd('0x86')+_0x41fa36+_0x07bd('0x87'),'ui')[_0x07bd('0x88')](_0x07bd('0x89'),_0x2b7907['id']);return _0x38f4d1[_0x07bd('0x8a')]['query'](_0x5e4670[_0x07bd('0x8b')](),_0x2ff31c)[_0x07bd('0x8')](function(_0x278df2){_0x2b7907[_0x4944e3+'OpenTabs']=_0x278df2;_0x5dc6f6(_0x278df2);})[_0x07bd('0xa')](function(_0x585f90){_0x135e4e(_0x585f90);});});}return _0x1b76fd[_0x07bd('0x8c')](_0x07bd('0x8d'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x598367){var _0x34005e={'raw':![],'where':{}};var _0x1b5b4b={};var _0x2986c2={'count':0x0,'rows':[]};var _0x7c7408=_0x598367[_0x07bd('0x8e')]['section'];var _0x145482=_0x598367['query'][_0x07bd('0x8f')]||![];var _0x53b975=_0x2b0dee(_0x7c7408,_0x145482);if(!_0x53b975[_0x07bd('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x7c7408+'\x27');var _0x5419d1=[{'name':_0x7c7408}];if(!_[_0x07bd('0x90')](_0x53b975[_0x07bd('0x1b')]))_0x5419d1=_0x53b975[_0x07bd('0x1b')];var _0x14bcaf=[];for(var _0x475039=0x0;_0x475039<_0x5419d1[_0x07bd('0x91')];_0x475039++){_0x14bcaf[_0x07bd('0x92')](_0x38f4d1[_0x07bd('0x93')][_0x07bd('0x94')]({'where':{'userProfileId':_0x598367[_0x07bd('0x95')]['id'],'name':_0x5419d1[_0x475039]['name']},'raw':!![]}));}return Promise[_0x07bd('0x96')](_0x14bcaf)['then'](function(_0x43bcec){var _0x39360b=_[_0x07bd('0x6')](_0x43bcec,function(_0x5855e7){return _0x5855e7?_0x5855e7:undefined;});var _0x523cb0=_[_0x07bd('0x6')](_0x5419d1,[_0x07bd('0x97'),!![]]);var _0x3f7194=_[_0x07bd('0x90')](_0x39360b)&&_[_0x07bd('0x90')](_0x523cb0)?null:_[_0x07bd('0x98')](_0x523cb0,_0x39360b);if(!_0x3f7194)return null;var _0x4e630c=[];for(var _0xf256e1=0x0;_0xf256e1<_0x3f7194[_0x07bd('0x91')];_0xf256e1++){var _0x6bf34b=_['find'](_0x5419d1,function(_0x29a452){return _0x3f7194[_0xf256e1]?_0x29a452[_0x07bd('0xd')]===_0x3f7194[_0xf256e1][_0x07bd('0xd')]:null;});if(_0x6bf34b){if(_0x3f7194[_0xf256e1][_0x07bd('0x97')]){_0x4e630c['push'](_0x5beba7(_0x53b975[_0x07bd('0x15')],_0x3f7194[_0xf256e1]));}else{if(!_0x3f7194[_0xf256e1][_0x07bd('0x99')]){_0x4e630c[_0x07bd('0x92')](_0x505839(_0x6bf34b,_0x3f7194[_0xf256e1],_0x53b975[_0x07bd('0x15')]));}else{if(_0x6bf34b['model']){_0x4e630c[_0x07bd('0x92')](_0x169b07(_0x6bf34b,_0x3f7194[_0xf256e1]));}}}}}return Promise['all'](_0x4e630c);})[_0x07bd('0x8')](function(_0x15be68){var _0x128c30=_0x15be68;var _0x1968cd=null;if(_0x128c30){_0x1968cd=_0x128c30['length']===0x1?_0x128c30[0x0]:null;}if(!_0x1968cd&&!_0x128c30)return _0x2986c2;var _0x3e512e=_0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x9a')];_0x1b5b4b[_0x07bd('0x9b')]=_[_0x07bd('0x9c')](_0x3e512e);_0x1b5b4b[_0x07bd('0x8e')]=_[_0x07bd('0x9c')](_0x598367['query']);_0x1b5b4b[_0x07bd('0x9d')]=_[_0x07bd('0x9e')](_0x1b5b4b[_0x07bd('0x9b')],_0x1b5b4b[_0x07bd('0x8e')]);_0x34005e[_0x07bd('0x9f')]=_['intersection'](_0x1b5b4b[_0x07bd('0x9b')],qs[_0x07bd('0xa0')](_0x598367[_0x07bd('0x8e')]['fields']));_0x34005e[_0x07bd('0x9f')]=_0x34005e[_0x07bd('0x9f')][_0x07bd('0x91')]?_0x34005e[_0x07bd('0x9f')]:_0x1b5b4b[_0x07bd('0x9b')];if(!_0x598367['query']['hasOwnProperty'](_0x07bd('0xa1'))){_0x34005e[_0x07bd('0xa2')]=qs[_0x07bd('0xa2')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa2')]);_0x34005e[_0x07bd('0xa3')]=qs[_0x07bd('0xa3')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa3')]);}_0x34005e['order']=qs[_0x07bd('0xa4')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa4')]);_0x34005e[_0x07bd('0x88')]=qs[_0x07bd('0x9d')](_['pick'](_0x598367[_0x07bd('0x8e')],_0x1b5b4b['filters']));if(_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]){_0x34005e['where']=_[_0x07bd('0xa5')](_0x34005e['where'],{'$or':_['map'](_0x3e512e,function(_0x18a2b0){if(_0x18a2b0[_0x07bd('0x12')][_0x07bd('0xa6')]!==_0x07bd('0xa7')){var _0x1d64b0={};_0x1d64b0[_0x18a2b0['field']]={'$like':'%'+_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]+'%'};return _0x1d64b0;}})});}var _0x193c87=[];var _0x591fc3=null;var _0x9b9402={};if(_0x1968cd){_0x591fc3=_[_0x07bd('0x94')](_0x5419d1,['name',_0x1968cd[_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};if(_0x53b975['childModel']===_0x07bd('0x10')){_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_[_0x07bd('0x9')](_0x1968cd[_0x07bd('0xc')],'id');}else{_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x1968cd[_0x07bd('0xc')];}_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{_0x34005e[_0x07bd('0x88')]['id']=_0x1968cd['associatedResources'];}}else{for(var _0x780517=0x0;_0x780517<_0x128c30[_0x07bd('0x91')];_0x780517++){_0x591fc3=_['find'](_0x5419d1,[_0x07bd('0xd'),_0x128c30[_0x780517][_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x128c30[_0x780517]['associatedResources'];_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{if(!_0x34005e[_0x07bd('0x88')]['id'])_0x34005e[_0x07bd('0x88')]['id']=[];_0x128c30[_0x780517][_0x07bd('0xc')]['forEach'](function(_0x15a175){_0x34005e[_0x07bd('0x88')]['id'][_0x07bd('0x92')](_0x15a175);});}}}if(!_[_0x07bd('0x90')](_0x193c87)){_0x34005e[_0x07bd('0x88')]=_[_0x07bd('0xa5')](_0x34005e[_0x07bd('0x88')],{'$and':{'$or':_0x193c87}});}_0x34005e=_[_0x07bd('0xa5')]({},_0x34005e,_0x598367[_0x07bd('0xa9')]);if(_0x1968cd&&!_0x1968cd[_0x07bd('0x99')]&&_0x53b975[_0x07bd('0x15')]===_0x07bd('0x10')){if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e)[_0x07bd('0x8')](function(_0x5811ef){var _0x578808=[];_0x5811ef[_0x07bd('0xac')](function(_0x2aeceb){var _0x2704c7;switch(_0x2aeceb[_0x07bd('0xad')]){case _0x07bd('0xae'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x3727d7){return _0x3727d7['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x3727d7['type']===_0x07bd('0xaf');});break;case _0x07bd('0xb0'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x25658e){return _0x25658e['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x25658e[_0x07bd('0x12')]===_0x07bd('0xb1');});break;}if(_0x2704c7)_0x578808[_0x07bd('0x92')](_0x2aeceb);});_0x2986c2[_0x07bd('0xb2')]=_0x578808[_0x07bd('0x91')];_0x2986c2[_0x07bd('0xb3')]=_0x578808;return _0x2986c2;});}else{return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0xb2')]({'where':_0x34005e[_0x07bd('0x88')]})[_0x07bd('0x8')](function(_0x28b036){_0x2986c2[_0x07bd('0xb2')]=_0x28b036;if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){if(_0x53b975[_0x07bd('0x15')]===_0x07bd('0x1f')){_0x34005e['include']=[{'model':_0x38f4d1[_0x07bd('0x73')],'as':_0x07bd('0xb4'),'attributes':['id','name',_0x07bd('0xb5')],'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]},{'model':_0x38f4d1['Tag'],'as':_0x07bd('0xb7'),'attributes':['id',_0x07bd('0xd'),'color'],'through':_0x598367[_0x07bd('0x8e')][_0x07bd('0xb6')]?{'attributes':[],'where':{'TagId':_0x598367['query'][_0x07bd('0xb6')]||undefined}}:{},'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]}];}else{_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e);})[_0x07bd('0x8')](function(_0x3f8539){_0x2986c2[_0x07bd('0xb3')]=_0x3f8539;if(_0x7c7408==='Agents'&&_0x598367['query'][_0x07bd('0xb8')]===_0x07bd('0xb9')){var _0x3bf215=[];for(var _0x1c2766=0x0;_0x1c2766<_0x2986c2[_0x07bd('0xb3')][_0x07bd('0x91')];_0x1c2766++){_0x3bf215['push'](_0x304796(_0x07bd('0xba'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xbc'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbd'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbe'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbf'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xc0'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));}return Promise['all'](_0x3bf215)[_0x07bd('0x8')](function(){return _0x2986c2;});}return _0x2986c2;});}});}}});};