Built motion from commit 52c8a02d.|2.6.29
[motion2.git] / server / api / userProfile / userProfile.model.js
index 894f20f..845bb49 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd4a2=['map','catch','model','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','VoiceQueue','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','Disposition','Dashboard','intervals','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','query','raw','section','isEmpty','length','push','UserProfileSection','find','all','ignore','autoAssociation','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','reportType','default','custom','count','rows','ids','CmContact','include','Tags','color','tag','ThroughTags','openTabs','chat','dataValues','mail','lodash','squel','models','filter','field','value','findAll','then','associatedResources'];(function(_0x19f1a7,_0x52289e){var _0x29fcdf=function(_0x4679ff){while(--_0x4679ff){_0x19f1a7['push'](_0x19f1a7['shift']());}};_0x29fcdf(++_0x52289e);}(_0xd4a2,0x173));var _0x2d4a=function(_0x3ea048,_0x394fe6){_0x3ea048=_0x3ea048-0x0;var _0x1d05f3=_0xd4a2[_0x3ea048];return _0x1d05f3;};'use strict';var _=require(_0x2d4a('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0x2d4a('0x1'));module['exports']=function(_0x2a8a71){var _0x57c5ca=_0x2a8a71[_0x2d4a('0x2')];function _0x5d435a(_0x32af9e,_0x40d744){return new Promise(function(_0x2624b5,_0x3a88e2){if(!_0x40d744)return _0x2624b5(null);var _0x1ca10b=_0x40d744['filter']?{[_0x40d744[_0x2d4a('0x3')][_0x2d4a('0x4')]]:_0x40d744[_0x2d4a('0x3')][_0x2d4a('0x5')]}:undefined;return _0x57c5ca[_0x32af9e][_0x2d4a('0x6')]({'where':_0x1ca10b,'raw':!![]})[_0x2d4a('0x7')](function(_0xb9f016){_0x40d744[_0x2d4a('0x8')]=_[_0x2d4a('0x9')](_0xb9f016,'id');_0x2624b5(_0x40d744);})[_0x2d4a('0xa')](function(_0x3abbbd){_0x3a88e2(_0x3abbbd);});});}function _0xce6af6(_0x4a9b14,_0x5f3c52){return new Promise(function(_0x4002de,_0x5bf7df){var _0xfd67d4=_0x4a9b14[_0x2d4a('0x3')]?{[_0x4a9b14[_0x2d4a('0x3')][_0x2d4a('0x4')]]:_0x4a9b14[_0x2d4a('0x3')][_0x2d4a('0x5')]}:undefined;return _0x57c5ca[_0x4a9b14[_0x2d4a('0xb')]][_0x2d4a('0x6')]({'where':_0xfd67d4,'raw':!![]})['then'](function(_0x4be8b4){_0x5f3c52[_0x2d4a('0x8')]=_['map'](_0x4be8b4,function(_0x11c64a){return _0x11c64a[_0x2d4a('0xc')];});_0x4002de(_0x5f3c52);})[_0x2d4a('0xa')](function(_0x3a3156){_0x5bf7df(_0x3a3156);});});}function _0x4c5287(_0x5f825d,_0x5a6378,_0x2838fa){if(!_0x5a6378)return Promise['resolve'](null);return new Promise(function(_0x435687,_0xd1dd52){return _0x57c5ca[_0x2d4a('0xd')][_0x2d4a('0x6')]({'where':{'sectionId':_0x5a6378['id']},'raw':!![]})['then'](function(_0x4fd169){if(_0x5f825d['field']&&_0x5f825d[_0x2d4a('0x4')]!=='id'){_0x5a6378[_0x2d4a('0x8')]=_[_0x2d4a('0x9')](_0x4fd169,function(_0x419df5){return _0x419df5[_0x5f825d[_0x2d4a('0x4')]];});}else{if(_0x2838fa===_0x2d4a('0xe')){_0x5a6378['associatedResources']=_['map'](_0x4fd169,function(_0x3eabe5){return{'id':_0x3eabe5[_0x2d4a('0xf')],'type':_0x3eabe5[_0x2d4a('0x10')]};});}else{_0x5a6378[_0x2d4a('0x8')]=_[_0x2d4a('0x9')](_0x4fd169,function(_0x2e7736){return _0x2e7736[_0x2d4a('0xf')];});}}_0x435687(_0x5a6378);})[_0x2d4a('0xa')](function(_0x5d5daa){_0xd1dd52(_0x5d5daa);});});}function _0x26e7b8(_0x3240a2,_0x2c3799){var _0x42d813={'parentSections':[]};switch(_0x3240a2[_0x2d4a('0x11')]()){case _0x2d4a('0x12'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x14');break;case'odbc':_0x42d813['childModel']='SquareOdbc';break;case _0x2d4a('0x15'):_0x42d813['childModel']=_0x2d4a('0x16');_0x42d813[_0x2d4a('0x17')]=[{'name':_0x2d4a('0x18'),'field':_0x2d4a('0xc'),'foreignKey':_0x2d4a('0x19')}];break;case _0x2d4a('0x1a'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x1b');break;case'contacts':_0x42d813[_0x2d4a('0x13')]='CmContact';_0x42d813[_0x2d4a('0x17')]=[{'name':_0x2d4a('0x1c'),'field':'id','foreignKey':_0x2d4a('0x1d')}];break;case _0x2d4a('0x1e'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x1f');break;case _0x2d4a('0x20'):_0x42d813[_0x2d4a('0x13')]='CmCompany';break;case _0x2d4a('0x21'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x22');break;case _0x2d4a('0x23'):_0x42d813[_0x2d4a('0x13')]='ChatQueue';break;case _0x2d4a('0x24'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x25');break;case _0x2d4a('0x26'):_0x42d813[_0x2d4a('0x13')]='FaxQueue';break;case _0x2d4a('0x27'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x28');break;case _0x2d4a('0x29'):case _0x2d4a('0x2a'):case _0x2d4a('0x2b'):_0x42d813['childModel']=_0x2d4a('0x2c');break;case _0x2d4a('0x2d'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x2e');break;case _0x2d4a('0x2f'):_0x42d813['childModel']=_0x2d4a('0x30');break;case _0x2d4a('0x31'):_0x42d813['childModel']=_0x2d4a('0x32');_0x42d813[_0x2d4a('0x17')]=[{'name':_0x2d4a('0x33'),'field':_0x2d4a('0xc'),'foreignKey':_0x2d4a('0x34'),'model':_0x2d4a('0x35'),'filter':{'field':'role','value':[_0x2d4a('0x36')]}},{'name':_0x2d4a('0x37'),'field':_0x2d4a('0xc'),'foreignKey':_0x2d4a('0x34'),'model':_0x2d4a('0x35'),'filter':{'field':_0x2d4a('0x38'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x2d4a('0xc'),'foreignKey':'queue','model':_0x2d4a('0x39'),'filter':{'field':_0x2d4a('0x10'),'value':['inbound']}},{'name':_0x2d4a('0x3a'),'field':_0x2d4a('0xc'),'foreignKey':_0x2d4a('0x3b'),'model':_0x2d4a('0x39'),'filter':{'field':_0x2d4a('0x10'),'value':[_0x2d4a('0x3c')]}}];break;case _0x2d4a('0x3d'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x3e');break;case _0x2d4a('0x3f'):_0x42d813[_0x2d4a('0x13')]='VoiceChanSpy';break;case _0x2d4a('0x40'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x41');break;case _0x2d4a('0x42'):_0x42d813[_0x2d4a('0x13')]='Campaign';break;case'mailqueues':_0x42d813['childModel']='MailQueue';break;case _0x2d4a('0x43'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x44');break;case _0x2d4a('0x45'):_0x42d813['childModel']=_0x2d4a('0x46');break;case _0x2d4a('0x47'):_0x42d813['childModel']=_0x2d4a('0x48');break;case _0x2d4a('0x49'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x4a');break;case _0x2d4a('0x4b'):_0x42d813[_0x2d4a('0x13')]='SmsQueue';break;case _0x2d4a('0x4c'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x4d');break;case _0x2d4a('0x4e'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x4f');break;case'whatsappaccounts':_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x50');break;case _0x2d4a('0x51'):_0x42d813['childModel']=_0x2d4a('0x52');break;case'voicequeues':case _0x2d4a('0x53'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x39');if(_0x2c3799){_0x42d813[_0x2d4a('0x17')]=[{'name':_0x2d4a('0x54')},{'name':'QueueCampaigns'}];}break;case'users':case _0x2d4a('0x55'):case _0x2d4a('0x56'):_0x42d813['childModel']=_0x2d4a('0x35');if(_0x2c3799){_0x42d813['parentSections']=[{'name':_0x2d4a('0x57'),'filter':{'field':_0x2d4a('0x38'),'value':[_0x2d4a('0x58'),'user']},'ignore':!![]},{'name':_0x2d4a('0x33')},{'name':'Telephones'}];}break;case _0x2d4a('0x59'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x5a');break;case _0x2d4a('0x5b'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x5c');break;case _0x2d4a('0x5d'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x5e');break;case _0x2d4a('0x5f'):_0x42d813[_0x2d4a('0x13')]='SugarcrmAccount';break;case _0x2d4a('0x60'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x61');break;case _0x2d4a('0x62'):_0x42d813[_0x2d4a('0x13')]='ZohoAccount';break;case _0x2d4a('0x63'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x35');break;case _0x2d4a('0x64'):_0x42d813[_0x2d4a('0x13')]='CannedAnswer';break;case'dispositions':_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x65');break;case'customdashboards':_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x66');break;case _0x2d4a('0x67'):_0x42d813[_0x2d4a('0x13')]='Interval';break;case _0x2d4a('0x68'):_0x42d813['childModel']=_0x2d4a('0x69');break;case _0x2d4a('0x6a'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x6b');break;case _0x2d4a('0x6c'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x6d');break;case _0x2d4a('0x6e'):_0x42d813['childModel']=_0x2d4a('0x6f');break;case _0x2d4a('0x70'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x71');break;case _0x2d4a('0x72'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x73');break;case _0x2d4a('0x74'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x75');break;case _0x2d4a('0x76'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x77');break;case _0x2d4a('0x78'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x79');break;case _0x2d4a('0x7a'):_0x42d813['childModel']=_0x2d4a('0xe');_0x42d813[_0x2d4a('0x17')]=[{'name':'Reports','field':'id','foreignKey':_0x2d4a('0x7b')}];break;case _0x2d4a('0x7c'):_0x42d813[_0x2d4a('0x13')]=_0x2d4a('0x7d');break;}return _0x42d813;}function _0x165c00(_0x206c30,_0x5ac4d1){var _0x1cf982=_0x206c30[_0x2d4a('0x7e')](0x0)[_0x2d4a('0x7f')]()+_0x206c30[_0x2d4a('0x80')](0x1);var _0x302323={'type':_0x57c5ca['Sequelize'][_0x2d4a('0x81')][_0x2d4a('0x82')],'raw':!![]};return new Promise(function(_0x48c1f9,_0xb5042d){var _0x3f42eb=squel[_0x2d4a('0x83')]()[_0x2d4a('0x4')](_0x2d4a('0x84')+_0x1cf982+_0x2d4a('0x85'),'id')[_0x2d4a('0x4')](_0x2d4a('0x86'))[_0x2d4a('0x87')](_0x2d4a('0x88')+_0x206c30+'_interactions','ui')[_0x2d4a('0x89')](_0x2d4a('0x8a'),_0x5ac4d1['id']);return _0x57c5ca[_0x2d4a('0x8b')]['query'](_0x3f42eb[_0x2d4a('0x8c')](),_0x302323)[_0x2d4a('0x7')](function(_0x153914){_0x5ac4d1[_0x1cf982+_0x2d4a('0x8d')]=_0x153914;_0x48c1f9(_0x153914);})[_0x2d4a('0xa')](function(_0x278bbc){_0xb5042d(_0x278bbc);});});}return _0x2a8a71[_0x2d4a('0x8e')](_0x2d4a('0x8f'),attributes,{'tableName':_0x2d4a('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x508648){var _0x21b8e9={'raw':_0x508648[_0x2d4a('0x91')][_0x2d4a('0x92')],'where':{}};var _0x17ef80={};var _0x2c50e7={'count':0x0,'rows':[]};var _0x2f77ee=_0x508648['query'][_0x2d4a('0x93')];var _0x3a675e=_0x508648[_0x2d4a('0x91')]['mergeResources']||![];var _0x465c89=_0x26e7b8(_0x2f77ee,_0x3a675e);if(!_0x465c89[_0x2d4a('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x2f77ee+'\x27');var _0x2b0e4c=[{'name':_0x2f77ee}];if(!_[_0x2d4a('0x94')](_0x465c89['parentSections']))_0x2b0e4c=_0x465c89[_0x2d4a('0x17')];var _0x5ad7f6=[];for(var _0x4d7271=0x0;_0x4d7271<_0x2b0e4c[_0x2d4a('0x95')];_0x4d7271++){_0x5ad7f6[_0x2d4a('0x96')](_0x57c5ca[_0x2d4a('0x97')][_0x2d4a('0x98')]({'where':{'userProfileId':_0x508648['params']['id'],'name':_0x2b0e4c[_0x4d7271][_0x2d4a('0xc')]},'raw':!![]}));}return Promise[_0x2d4a('0x99')](_0x5ad7f6)[_0x2d4a('0x7')](function(_0x303815){var _0x4ce85f=_['filter'](_0x303815,function(_0x34f1d0){return _0x34f1d0?_0x34f1d0:undefined;});var _0x56fecc=_[_0x2d4a('0x3')](_0x2b0e4c,[_0x2d4a('0x9a'),!![]]);var _0x9e6321=_[_0x2d4a('0x94')](_0x4ce85f)&&_[_0x2d4a('0x94')](_0x56fecc)?null:_['union'](_0x56fecc,_0x4ce85f);if(!_0x9e6321)return null;var _0x2b42aa=[];for(var _0x23fdb2=0x0;_0x23fdb2<_0x9e6321[_0x2d4a('0x95')];_0x23fdb2++){var _0x398439=_['find'](_0x2b0e4c,function(_0x299bdf){return _0x9e6321[_0x23fdb2]?_0x299bdf[_0x2d4a('0xc')]===_0x9e6321[_0x23fdb2][_0x2d4a('0xc')]:null;});if(_0x398439){if(_0x9e6321[_0x23fdb2][_0x2d4a('0x9a')]){_0x2b42aa['push'](_0x5d435a(_0x465c89[_0x2d4a('0x13')],_0x9e6321[_0x23fdb2]));}else{if(!_0x9e6321[_0x23fdb2][_0x2d4a('0x9b')]){_0x2b42aa['push'](_0x4c5287(_0x398439,_0x9e6321[_0x23fdb2],_0x465c89[_0x2d4a('0x13')]));}else{if(_0x398439[_0x2d4a('0xb')]){_0x2b42aa[_0x2d4a('0x96')](_0xce6af6(_0x398439,_0x9e6321[_0x23fdb2]));}}}}}return Promise['all'](_0x2b42aa);})[_0x2d4a('0x7')](function(_0x7552a3){var _0x41f2bd=_0x7552a3;var _0x33d274=null;if(_0x41f2bd){_0x33d274=_0x41f2bd[_0x2d4a('0x95')]===0x1?_0x41f2bd[0x0]:null;}if(!_0x33d274&&!_0x41f2bd)return _0x2c50e7;var _0xb6c864=_0x57c5ca[_0x465c89[_0x2d4a('0x13')]]['rawAttributes'];_0x17ef80[_0x2d4a('0xb')]=_[_0x2d4a('0x9c')](_0xb6c864);_0x17ef80[_0x2d4a('0x91')]=_[_0x2d4a('0x9c')](_0x508648[_0x2d4a('0x91')]);_0x17ef80['filters']=_[_0x2d4a('0x9d')](_0x17ef80['model'],_0x17ef80[_0x2d4a('0x91')]);_0x21b8e9[_0x2d4a('0x9e')]=_[_0x2d4a('0x9d')](_0x17ef80[_0x2d4a('0xb')],qs[_0x2d4a('0x9f')](_0x508648[_0x2d4a('0x91')][_0x2d4a('0x9f')]));_0x21b8e9[_0x2d4a('0x9e')]=_0x21b8e9[_0x2d4a('0x9e')][_0x2d4a('0x95')]?_0x21b8e9['attributes']:_0x17ef80[_0x2d4a('0xb')];if(!_0x508648['query'][_0x2d4a('0xa0')](_0x2d4a('0xa1'))){_0x21b8e9[_0x2d4a('0xa2')]=qs[_0x2d4a('0xa2')](_0x508648[_0x2d4a('0x91')][_0x2d4a('0xa2')]);_0x21b8e9[_0x2d4a('0xa3')]=qs[_0x2d4a('0xa3')](_0x508648[_0x2d4a('0x91')]['offset']);}_0x21b8e9[_0x2d4a('0xa4')]=qs[_0x2d4a('0xa5')](_0x508648[_0x2d4a('0x91')][_0x2d4a('0xa5')]);_0x21b8e9['where']=qs[_0x2d4a('0xa6')](_[_0x2d4a('0xa7')](_0x508648[_0x2d4a('0x91')],_0x17ef80[_0x2d4a('0xa6')]));if(_0x508648[_0x2d4a('0x91')][_0x2d4a('0x3')]){_0x21b8e9['where']=_[_0x2d4a('0xa8')](_0x21b8e9[_0x2d4a('0x89')],{'$or':_['map'](_0xb6c864,function(_0x42e4e5){if(_0x42e4e5[_0x2d4a('0x10')][_0x2d4a('0xa9')]!==_0x2d4a('0xaa')){var _0x429579={};_0x429579[_0x42e4e5[_0x2d4a('0x4')]]={'$like':'%'+_0x508648[_0x2d4a('0x91')][_0x2d4a('0x3')]+'%'};return _0x429579;}})});}var _0x251d79=[];var _0x70c4a0=null;var _0x567ced={};if(_0x33d274){_0x70c4a0=_[_0x2d4a('0x98')](_0x2b0e4c,['name',_0x33d274[_0x2d4a('0xc')]]);if(_0x70c4a0[_0x2d4a('0x4')]){_0x567ced={};if(_0x465c89[_0x2d4a('0x13')]===_0x2d4a('0xe')){_0x567ced[_0x70c4a0[_0x2d4a('0xab')]]=_[_0x2d4a('0x9')](_0x33d274[_0x2d4a('0x8')],'id');}else{_0x567ced[_0x70c4a0['foreignKey']]=_0x33d274[_0x2d4a('0x8')];}_0x251d79[_0x2d4a('0x96')](_0x567ced);}else{_0x21b8e9[_0x2d4a('0x89')]['id']=_0x33d274[_0x2d4a('0x8')];}}else{for(var _0x47377e=0x0;_0x47377e<_0x41f2bd['length'];_0x47377e++){_0x70c4a0=_['find'](_0x2b0e4c,['name',_0x41f2bd[_0x47377e][_0x2d4a('0xc')]]);if(_0x70c4a0[_0x2d4a('0x4')]){_0x567ced={};_0x567ced[_0x70c4a0[_0x2d4a('0xab')]]=_0x41f2bd[_0x47377e]['associatedResources'];_0x251d79[_0x2d4a('0x96')](_0x567ced);}else{if(!_0x21b8e9[_0x2d4a('0x89')]['id'])_0x21b8e9[_0x2d4a('0x89')]['id']=[];_0x41f2bd[_0x47377e][_0x2d4a('0x8')][_0x2d4a('0xac')](function(_0x1b1c7a){_0x21b8e9['where']['id'][_0x2d4a('0x96')](_0x1b1c7a);});}}}if(!_['isEmpty'](_0x251d79)){_0x21b8e9[_0x2d4a('0x89')]=_[_0x2d4a('0xa8')](_0x21b8e9['where'],{'$and':{'$or':_0x251d79}});}_0x21b8e9=_[_0x2d4a('0xa8')]({},_0x21b8e9,_0x508648['options']);if(_0x33d274&&!_0x33d274['autoAssociation']&&_0x465c89['childModel']===_0x2d4a('0xe')){if(_0x508648[_0x2d4a('0x91')][_0x2d4a('0xad')]){_0x21b8e9['include']=[{'all':!![]}];}return _0x57c5ca[_0x465c89[_0x2d4a('0x13')]][_0x2d4a('0x6')](_0x21b8e9)[_0x2d4a('0x7')](function(_0xb0e165){var _0x48f328=[];_0xb0e165[_0x2d4a('0xac')](function(_0x36e8a5){var _0x4cd04c;switch(_0x36e8a5[_0x2d4a('0xae')]){case _0x2d4a('0xaf'):_0x4cd04c=_['find'](_0x33d274[_0x2d4a('0x8')],function(_0x57ece5){return _0x57ece5['id']===_0x36e8a5['reportId']&&_0x57ece5[_0x2d4a('0x10')]==='DefaultReports';});break;case _0x2d4a('0xb0'):_0x4cd04c=_[_0x2d4a('0x98')](_0x33d274[_0x2d4a('0x8')],function(_0x44d3b3){return _0x44d3b3['id']===_0x36e8a5['reportId']&&_0x44d3b3[_0x2d4a('0x10')]==='CustomReports';});break;}if(_0x4cd04c)_0x48f328[_0x2d4a('0x96')](_0x36e8a5);});_0x2c50e7[_0x2d4a('0xb1')]=_0x48f328[_0x2d4a('0x95')];_0x2c50e7[_0x2d4a('0xb2')]=_0x48f328;return _0x2c50e7;});}else{if(!_[_0x2d4a('0x94')](_0x508648['query'][_0x2d4a('0xb3')])){_0x21b8e9[_0x2d4a('0x89')]['id']=_0x21b8e9[_0x2d4a('0x89')]['id']?_['intersection'](_0x21b8e9[_0x2d4a('0x89')]['id'],_0x508648['query']['ids']):_0x508648[_0x2d4a('0x91')][_0x2d4a('0xb3')];}return _0x57c5ca[_0x465c89[_0x2d4a('0x13')]][_0x2d4a('0xb1')]({'where':_0x21b8e9[_0x2d4a('0x89')]})[_0x2d4a('0x7')](function(_0x2bffb4){_0x2c50e7[_0x2d4a('0xb1')]=_0x2bffb4;if(_0x508648[_0x2d4a('0x91')][_0x2d4a('0xad')]){if(_0x465c89['childModel']===_0x2d4a('0xb4')){_0x21b8e9[_0x2d4a('0xb5')]=[{'model':_0x57c5ca[_0x2d4a('0x6f')],'as':_0x2d4a('0xb6'),'attributes':['id',_0x2d4a('0xc'),_0x2d4a('0xb7')],'required':_0x508648[_0x2d4a('0x91')][_0x2d4a('0xb8')]?!![]:![]},{'model':_0x57c5ca['Tag'],'as':_0x2d4a('0xb9'),'attributes':['id',_0x2d4a('0xc'),_0x2d4a('0xb7')],'through':_0x508648['query'][_0x2d4a('0xb8')]?{'attributes':[],'where':{'TagId':_0x508648['query'][_0x2d4a('0xb8')]||undefined}}:{},'required':_0x508648[_0x2d4a('0x91')][_0x2d4a('0xb8')]?!![]:![]}];}else{_0x21b8e9[_0x2d4a('0xb5')]=[{'all':!![]}];}}return _0x57c5ca[_0x465c89['childModel']][_0x2d4a('0x6')](_0x21b8e9);})['then'](function(_0x1a0ae7){_0x2c50e7[_0x2d4a('0xb2')]=_0x1a0ae7;if(_0x2f77ee===_0x2d4a('0x33')&&_0x508648['query'][_0x2d4a('0xba')]==='true'){var _0x34707d=[];for(var _0x165fff=0x0;_0x165fff<_0x2c50e7[_0x2d4a('0xb2')][_0x2d4a('0x95')];_0x165fff++){_0x34707d[_0x2d4a('0x96')](_0x165c00(_0x2d4a('0xbb'),_0x2c50e7[_0x2d4a('0xb2')][_0x165fff][_0x2d4a('0xbc')]));_0x34707d[_0x2d4a('0x96')](_0x165c00('sms',_0x2c50e7['rows'][_0x165fff]['dataValues']));_0x34707d[_0x2d4a('0x96')](_0x165c00('fax',_0x2c50e7[_0x2d4a('0xb2')][_0x165fff]['dataValues']));_0x34707d[_0x2d4a('0x96')](_0x165c00(_0x2d4a('0xbd'),_0x2c50e7['rows'][_0x165fff]['dataValues']));_0x34707d[_0x2d4a('0x96')](_0x165c00('openchannel',_0x2c50e7[_0x2d4a('0xb2')][_0x165fff][_0x2d4a('0xbc')]));_0x34707d[_0x2d4a('0x96')](_0x165c00('whatsapp',_0x2c50e7[_0x2d4a('0xb2')][_0x165fff][_0x2d4a('0xbc')]));}return Promise[_0x2d4a('0x99')](_0x34707d)[_0x2d4a('0x7')](function(){return _0x2c50e7;});}return _0x2c50e7;});}});}}});};
\ No newline at end of file
+var _0xd28f=['agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Schedule','sounds','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','length','push','UserProfileSection','params','ignore','isEmpty','union','find','autoAssociation','model','all','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','foreignKey','includeAll','include','forEach','reportType','default','DefaultReports','custom','count','ids','customSorting','extraQueryConditions','Tag','Tags','color','tag','ThroughTags','rows','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','catch','map','resolve','type','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareProjects','name','projectName','projects','CmContact','parentSections','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','FaxQueue','inboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','agent','role','telephone','queue','inbound','VoiceQueue','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','QueueCampaigns','users'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0xd28f,0x1eb));var _0xfd28=function(_0x2c0de9,_0x58f69a){_0x2c0de9=_0x2c0de9-0x0;var _0x4c592e=_0xd28f[_0x2c0de9];return _0x4c592e;};'use strict';var _=require(_0xfd28('0x0'));var attributes=require(_0xfd28('0x1'));var squel=require(_0xfd28('0x2'));module[_0xfd28('0x3')]=function(_0x415731){var _0x1bbb0b=_0x415731[_0xfd28('0x4')];function _0x1c49c7(_0x52c9c6,_0x2eaa59){return new Promise(function(_0x40b58b,_0x2f26c9){if(!_0x2eaa59)return _0x40b58b(null);var _0x59c004=_0x2eaa59[_0xfd28('0x5')]?{[_0x2eaa59[_0xfd28('0x5')][_0xfd28('0x6')]]:_0x2eaa59[_0xfd28('0x5')][_0xfd28('0x7')]}:undefined;return _0x1bbb0b[_0x52c9c6][_0xfd28('0x8')]({'where':_0x59c004,'raw':!![]})[_0xfd28('0x9')](function(_0x2bc52a){_0x2eaa59[_0xfd28('0xa')]=_['map'](_0x2bc52a,'id');_0x40b58b(_0x2eaa59);})[_0xfd28('0xb')](function(_0x3be3a9){_0x2f26c9(_0x3be3a9);});});}function _0xc31533(_0x33a376,_0x30a809){return new Promise(function(_0x1516b1,_0x3edf60){var _0x24f36d=_0x33a376['filter']?{[_0x33a376[_0xfd28('0x5')][_0xfd28('0x6')]]:_0x33a376[_0xfd28('0x5')][_0xfd28('0x7')]}:undefined;return _0x1bbb0b[_0x33a376['model']][_0xfd28('0x8')]({'where':_0x24f36d,'raw':!![]})[_0xfd28('0x9')](function(_0x265899){_0x30a809[_0xfd28('0xa')]=_[_0xfd28('0xc')](_0x265899,function(_0x29b55d){return _0x29b55d['name'];});_0x1516b1(_0x30a809);})[_0xfd28('0xb')](function(_0xac6c35){_0x3edf60(_0xac6c35);});});}function _0x199433(_0x59e410,_0x2ffdc7,_0x3725e8){if(!_0x2ffdc7)return Promise[_0xfd28('0xd')](null);return new Promise(function(_0x3c9d7b,_0x4c9ccd){return _0x1bbb0b['UserProfileResource'][_0xfd28('0x8')]({'where':{'sectionId':_0x2ffdc7['id']},'raw':!![]})[_0xfd28('0x9')](function(_0x13227b){if(_0x59e410[_0xfd28('0x6')]&&_0x59e410['field']!=='id'){_0x2ffdc7[_0xfd28('0xa')]=_['map'](_0x13227b,function(_0x447319){return _0x447319[_0x59e410[_0xfd28('0x6')]];});}else{if(_0x3725e8==='AnalyticExtractedReport'){_0x2ffdc7[_0xfd28('0xa')]=_['map'](_0x13227b,function(_0x54e00c){return{'id':_0x54e00c['resourceId'],'type':_0x54e00c[_0xfd28('0xe')]};});}else{_0x2ffdc7[_0xfd28('0xa')]=_[_0xfd28('0xc')](_0x13227b,function(_0x1b9c03){return _0x1b9c03[_0xfd28('0xf')];});}}_0x3c9d7b(_0x2ffdc7);})[_0xfd28('0xb')](function(_0x122c1d){_0x4c9ccd(_0x122c1d);});});}function _0xbc259b(_0x23a5ad,_0x479ef6){var _0x15a6a5={'parentSections':[]};switch(_0x23a5ad['toLowerCase']()){case _0xfd28('0x10'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x12');break;case _0xfd28('0x13'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x14');break;case'squarerecordings':_0x15a6a5[_0xfd28('0x11')]='SquareRecording';_0x15a6a5['parentSections']=[{'name':_0xfd28('0x15'),'field':_0xfd28('0x16'),'foreignKey':_0xfd28('0x17')}];break;case _0xfd28('0x18'):_0x15a6a5[_0xfd28('0x11')]='JscriptyProject';break;case'contacts':_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x19');_0x15a6a5[_0xfd28('0x1a')]=[{'name':_0xfd28('0x1b'),'field':'id','foreignKey':_0xfd28('0x1c')}];break;case _0xfd28('0x1d'):_0x15a6a5[_0xfd28('0x11')]='CmList';break;case _0xfd28('0x1e'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x1f');break;case _0xfd28('0x20'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x21');break;case'chatqueues':_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x22');break;case'chatwebsites':_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x23');break;case _0xfd28('0x24'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x25');break;case'faxaccounts':_0x15a6a5[_0xfd28('0x11')]='FaxAccount';break;case _0xfd28('0x26'):case'internalroutes':case'outboundroutes':_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x27');break;case _0xfd28('0x28'):_0x15a6a5[_0xfd28('0x11')]='VoiceContext';break;case _0xfd28('0x29'):_0x15a6a5['childModel']=_0xfd28('0x2a');break;case'voicerecordings':_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x2b');_0x15a6a5['parentSections']=[{'name':_0xfd28('0x2c'),'field':_0xfd28('0x16'),'foreignKey':_0xfd28('0x2d'),'model':_0xfd28('0x2e'),'filter':{'field':'role','value':[_0xfd28('0x2f')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':_0xfd28('0x2e'),'filter':{'field':_0xfd28('0x30'),'value':[_0xfd28('0x31')]}},{'name':'VoiceQueues','field':_0xfd28('0x16'),'foreignKey':_0xfd28('0x32'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xfd28('0x33')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xfd28('0x32'),'model':_0xfd28('0x34'),'filter':{'field':_0xfd28('0xe'),'value':['outbound']}}];break;case _0xfd28('0x35'):_0x15a6a5['childModel']=_0xfd28('0x36');break;case _0xfd28('0x37'):_0x15a6a5[_0xfd28('0x11')]='VoiceChanSpy';break;case _0xfd28('0x38'):_0x15a6a5['childModel']='VoicePrefix';break;case _0xfd28('0x39'):_0x15a6a5['childModel']=_0xfd28('0x3a');break;case _0xfd28('0x3b'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x3c');break;case _0xfd28('0x3d'):_0x15a6a5['childModel']=_0xfd28('0x3e');break;case'mailsubstatuses':_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x3f');break;case'openchannelqueues':_0x15a6a5['childModel']=_0xfd28('0x40');break;case _0xfd28('0x41'):_0x15a6a5[_0xfd28('0x11')]='OpenchannelAccount';break;case _0xfd28('0x42'):_0x15a6a5['childModel']='SmsQueue';break;case _0xfd28('0x43'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x44');break;case'whatsappqueues':_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x45');break;case _0xfd28('0x46'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x47');break;case _0xfd28('0x48'):_0x15a6a5['childModel']=_0xfd28('0x49');break;case _0xfd28('0x4a'):case _0xfd28('0x4b'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x34');if(_0x479ef6){_0x15a6a5['parentSections']=[{'name':_0xfd28('0x4c')},{'name':_0xfd28('0x4d')}];}break;case _0xfd28('0x4e'):case _0xfd28('0x4f'):case _0xfd28('0x50'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x2e');if(_0x479ef6){_0x15a6a5[_0xfd28('0x1a')]=[{'name':_0xfd28('0x51'),'filter':{'field':_0xfd28('0x30'),'value':[_0xfd28('0x52'),_0xfd28('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':_0xfd28('0x54')}];}break;case _0xfd28('0x55'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x56');break;case _0xfd28('0x57'):_0x15a6a5[_0xfd28('0x11')]='SalesforceAccount';break;case _0xfd28('0x58'):_0x15a6a5[_0xfd28('0x11')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x15a6a5['childModel']=_0xfd28('0x59');break;case _0xfd28('0x5a'):_0x15a6a5[_0xfd28('0x11')]='DeskAccount';break;case _0xfd28('0x5b'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x5c');break;case'vtigeraccounts':_0x15a6a5['childModel']=_0xfd28('0x2e');break;case _0xfd28('0x5d'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x5e');break;case _0xfd28('0x5f'):_0x15a6a5['childModel']=_0xfd28('0x60');break;case _0xfd28('0x61'):_0x15a6a5['childModel']=_0xfd28('0x62');break;case _0xfd28('0x63'):_0x15a6a5['childModel']=_0xfd28('0x64');break;case _0xfd28('0x65'):_0x15a6a5[_0xfd28('0x11')]='Pause';break;case'scheduler':_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x66');break;case _0xfd28('0x67'):_0x15a6a5[_0xfd28('0x11')]='Sound';break;case _0xfd28('0x68'):_0x15a6a5['childModel']='Tag';break;case _0xfd28('0x69'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x6a');break;case _0xfd28('0x6b'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x6c');break;case _0xfd28('0x6d'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x6e');break;case _0xfd28('0x6f'):_0x15a6a5[_0xfd28('0x11')]=_0xfd28('0x70');break;case _0xfd28('0x71'):_0x15a6a5[_0xfd28('0x11')]='Plugin';break;case'extractedreports':_0x15a6a5['childModel']=_0xfd28('0x72');_0x15a6a5['parentSections']=[{'name':_0xfd28('0x73'),'field':'id','foreignKey':_0xfd28('0x74')}];break;case _0xfd28('0x75'):_0x15a6a5['childModel']=_0xfd28('0x76');break;}return _0x15a6a5;}function _0x2de0d0(_0xecddcc,_0x3c885c){var _0xfdc879=_0xecddcc[_0xfd28('0x77')](0x0)[_0xfd28('0x78')]()+_0xecddcc[_0xfd28('0x79')](0x1);var _0x1a572a={'type':_0x1bbb0b[_0xfd28('0x7a')][_0xfd28('0x7b')][_0xfd28('0x7c')],'raw':!![]};return new Promise(function(_0x307bd3,_0x5545ac){var _0xb340ca=squel['select']()[_0xfd28('0x6')](_0xfd28('0x7d')+_0xfdc879+'InteractionId','id')[_0xfd28('0x6')](_0xfd28('0x7e'))['from'](_0xfd28('0x7f')+_0xecddcc+_0xfd28('0x80'),'ui')[_0xfd28('0x81')](_0xfd28('0x82'),_0x3c885c['id']);return _0x1bbb0b[_0xfd28('0x83')][_0xfd28('0x84')](_0xb340ca[_0xfd28('0x85')](),_0x1a572a)[_0xfd28('0x9')](function(_0x5420b8){_0x3c885c[_0xfdc879+_0xfd28('0x86')]=_0x5420b8;_0x307bd3(_0x5420b8);})[_0xfd28('0xb')](function(_0x5f1092){_0x5545ac(_0x5f1092);});});}return _0x415731['define'](_0xfd28('0x87'),attributes,{'tableName':_0xfd28('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4dd71e){var _0x5a5b55=require('../../components/parsers/qs');var _0x43e33a={'raw':_0x4dd71e[_0xfd28('0x84')][_0xfd28('0x89')],'where':{}};var _0x5d7afa={};var _0x2b5c85={'count':0x0,'rows':[]};var _0x1c2f6b=_0x4dd71e['query'][_0xfd28('0x8a')];var _0x17921b=_0x4dd71e['query']['mergeResources']||![];var _0x11d8c4=_0xbc259b(_0x1c2f6b,_0x17921b);if(!_0x11d8c4['childModel'])throw new Error(_0xfd28('0x8b')+_0x1c2f6b+'\x27');var _0x294e98=[{'name':_0x1c2f6b}];if(!_['isEmpty'](_0x11d8c4[_0xfd28('0x1a')]))_0x294e98=_0x11d8c4[_0xfd28('0x1a')];var _0x10c31f=[];for(var _0xf785ab=0x0;_0xf785ab<_0x294e98[_0xfd28('0x8c')];_0xf785ab++){_0x10c31f[_0xfd28('0x8d')](_0x1bbb0b[_0xfd28('0x8e')]['find']({'where':{'userProfileId':_0x4dd71e[_0xfd28('0x8f')]['id'],'name':_0x294e98[_0xf785ab]['name']},'raw':!![]}));}return Promise['all'](_0x10c31f)[_0xfd28('0x9')](function(_0x34c15e){var _0x38da54=_[_0xfd28('0x5')](_0x34c15e,function(_0x3c7cc3){return _0x3c7cc3?_0x3c7cc3:undefined;});var _0x3a2712=_['filter'](_0x294e98,[_0xfd28('0x90'),!![]]);var _0x2dca43=_[_0xfd28('0x91')](_0x38da54)&&_[_0xfd28('0x91')](_0x3a2712)?null:_[_0xfd28('0x92')](_0x3a2712,_0x38da54);if(!_0x2dca43)return null;var _0x2a52bd=[];for(var _0x193ae5=0x0;_0x193ae5<_0x2dca43['length'];_0x193ae5++){var _0x2447d0=_[_0xfd28('0x93')](_0x294e98,function(_0x4fe2ab){return _0x2dca43[_0x193ae5]?_0x4fe2ab['name']===_0x2dca43[_0x193ae5][_0xfd28('0x16')]:null;});if(_0x2447d0){if(_0x2dca43[_0x193ae5][_0xfd28('0x90')]){_0x2a52bd[_0xfd28('0x8d')](_0x1c49c7(_0x11d8c4[_0xfd28('0x11')],_0x2dca43[_0x193ae5]));}else{if(!_0x2dca43[_0x193ae5][_0xfd28('0x94')]){_0x2a52bd[_0xfd28('0x8d')](_0x199433(_0x2447d0,_0x2dca43[_0x193ae5],_0x11d8c4['childModel']));}else{if(_0x2447d0[_0xfd28('0x95')]){_0x2a52bd[_0xfd28('0x8d')](_0xc31533(_0x2447d0,_0x2dca43[_0x193ae5]));}}}}}return Promise[_0xfd28('0x96')](_0x2a52bd);})[_0xfd28('0x9')](function(_0xa7ed17){var _0x2a1251=_0xa7ed17;var _0x2c3e1c=null;if(_0x2a1251){_0x2c3e1c=_0x2a1251[_0xfd28('0x8c')]===0x1?_0x2a1251[0x0]:null;}if(!_0x2c3e1c&&!_0x2a1251)return _0x2b5c85;var _0x25b638=_0x1bbb0b[_0x11d8c4[_0xfd28('0x11')]][_0xfd28('0x97')];_0x5d7afa[_0xfd28('0x95')]=_[_0xfd28('0x98')](_0x25b638);_0x5d7afa[_0xfd28('0x84')]=_[_0xfd28('0x98')](_0x4dd71e[_0xfd28('0x84')]);_0x5d7afa[_0xfd28('0x99')]=_['intersection'](_0x5d7afa['model'],_0x5d7afa[_0xfd28('0x84')]);_0x43e33a[_0xfd28('0x9a')]=_[_0xfd28('0x9b')](_0x5d7afa[_0xfd28('0x95')],_0x5a5b55[_0xfd28('0x9c')](_0x4dd71e[_0xfd28('0x84')][_0xfd28('0x9c')]));_0x43e33a[_0xfd28('0x9a')]=_0x43e33a[_0xfd28('0x9a')]['length']?_0x43e33a['attributes']:_0x5d7afa[_0xfd28('0x95')];if(!_0x4dd71e[_0xfd28('0x84')][_0xfd28('0x9d')](_0xfd28('0x9e'))){_0x43e33a[_0xfd28('0x9f')]=_0x5a5b55[_0xfd28('0x9f')](_0x4dd71e[_0xfd28('0x84')]['limit']);_0x43e33a[_0xfd28('0xa0')]=_0x5a5b55[_0xfd28('0xa0')](_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xa0')]);}_0x43e33a[_0xfd28('0xa1')]=_0x5a5b55[_0xfd28('0xa2')](_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xa2')]);_0x43e33a[_0xfd28('0x81')]=_0x5a5b55[_0xfd28('0x99')](_['pick'](_0x4dd71e[_0xfd28('0x84')],_0x5d7afa['filters']));if(_0x4dd71e['query'][_0xfd28('0x5')]){_0x43e33a['where']=_[_0xfd28('0xa3')](_0x43e33a['where'],{'$or':_[_0xfd28('0xc')](_0x25b638,function(_0x133a2f){if(_0x133a2f[_0xfd28('0xe')]['key']!=='VIRTUAL'){var _0x3a96fb={};_0x3a96fb[_0x133a2f[_0xfd28('0x6')]]={'$like':'%'+_0x4dd71e[_0xfd28('0x84')][_0xfd28('0x5')]+'%'};return _0x3a96fb;}})});}var _0x5d6105=[];var _0x27d9ba=null;var _0x1f434c={};if(_0x2c3e1c){_0x27d9ba=_[_0xfd28('0x93')](_0x294e98,[_0xfd28('0x16'),_0x2c3e1c[_0xfd28('0x16')]]);if(_0x27d9ba[_0xfd28('0x6')]){_0x1f434c={};if(_0x11d8c4[_0xfd28('0x11')]===_0xfd28('0x72')){_0x1f434c[_0x27d9ba[_0xfd28('0xa4')]]=_[_0xfd28('0xc')](_0x2c3e1c[_0xfd28('0xa')],'id');}else{_0x1f434c[_0x27d9ba['foreignKey']]=_0x2c3e1c[_0xfd28('0xa')];}_0x5d6105['push'](_0x1f434c);}else{_0x43e33a[_0xfd28('0x81')]['id']=_0x2c3e1c[_0xfd28('0xa')];}}else{for(var _0x23fa1d=0x0;_0x23fa1d<_0x2a1251[_0xfd28('0x8c')];_0x23fa1d++){_0x27d9ba=_['find'](_0x294e98,[_0xfd28('0x16'),_0x2a1251[_0x23fa1d][_0xfd28('0x16')]]);if(_0x27d9ba['field']){_0x1f434c={};_0x1f434c[_0x27d9ba[_0xfd28('0xa4')]]=_0x2a1251[_0x23fa1d][_0xfd28('0xa')];_0x5d6105['push'](_0x1f434c);}else{if(!_0x43e33a[_0xfd28('0x81')]['id'])_0x43e33a[_0xfd28('0x81')]['id']=[];_0x2a1251[_0x23fa1d][_0xfd28('0xa')]['forEach'](function(_0x1b5723){_0x43e33a['where']['id']['push'](_0x1b5723);});}}}if(!_[_0xfd28('0x91')](_0x5d6105)){_0x43e33a['where']=_[_0xfd28('0xa3')](_0x43e33a[_0xfd28('0x81')],{'$and':{'$or':_0x5d6105}});}_0x43e33a=_[_0xfd28('0xa3')]({},_0x43e33a,_0x4dd71e['options']);if(_0x2c3e1c&&!_0x2c3e1c[_0xfd28('0x94')]&&_0x11d8c4['childModel']==='AnalyticExtractedReport'){if(_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xa5')]){_0x43e33a[_0xfd28('0xa6')]=[{'all':!![]}];}return _0x1bbb0b[_0x11d8c4['childModel']][_0xfd28('0x8')](_0x43e33a)[_0xfd28('0x9')](function(_0x195f8f){var _0x21caca=[];_0x195f8f[_0xfd28('0xa7')](function(_0x3649c9){var _0x3df600;switch(_0x3649c9[_0xfd28('0xa8')]){case _0xfd28('0xa9'):_0x3df600=_[_0xfd28('0x93')](_0x2c3e1c[_0xfd28('0xa')],function(_0x26b24a){return _0x26b24a['id']===_0x3649c9[_0xfd28('0x74')]&&_0x26b24a[_0xfd28('0xe')]===_0xfd28('0xaa');});break;case _0xfd28('0xab'):_0x3df600=_[_0xfd28('0x93')](_0x2c3e1c[_0xfd28('0xa')],function(_0x4aace8){return _0x4aace8['id']===_0x3649c9[_0xfd28('0x74')]&&_0x4aace8[_0xfd28('0xe')]==='CustomReports';});break;}if(_0x3df600)_0x21caca['push'](_0x3649c9);});_0x2b5c85[_0xfd28('0xac')]=_0x21caca['length'];_0x2b5c85['rows']=_0x21caca;return _0x2b5c85;});}else{if(!_[_0xfd28('0x91')](_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xad')])){_0x43e33a[_0xfd28('0x81')]['id']=_0x43e33a[_0xfd28('0x81')]['id']?_[_0xfd28('0x9b')](_0x43e33a[_0xfd28('0x81')]['id'],_0x4dd71e[_0xfd28('0x84')]['ids']):_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xad')];if(_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xae')]){_0x43e33a[_0xfd28('0xa1')]=_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xae')];}}if(_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xaf')]){_0x43e33a[_0xfd28('0x81')]=_[_0xfd28('0xa3')](_0x43e33a[_0xfd28('0x81')],{'$and':_0x4dd71e['query'][_0xfd28('0xaf')]});}return _0x1bbb0b[_0x11d8c4['childModel']][_0xfd28('0xac')]({'where':_0x43e33a[_0xfd28('0x81')]})[_0xfd28('0x9')](function(_0x130d52){_0x2b5c85[_0xfd28('0xac')]=_0x130d52;if(_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xa5')]){if(_0x11d8c4['childModel']===_0xfd28('0x19')){_0x43e33a[_0xfd28('0xa6')]=[{'model':_0x1bbb0b[_0xfd28('0xb0')],'as':_0xfd28('0xb1'),'attributes':['id',_0xfd28('0x16'),_0xfd28('0xb2')],'required':_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xb3')]?!![]:![]},{'model':_0x1bbb0b['Tag'],'as':_0xfd28('0xb4'),'attributes':['id',_0xfd28('0x16'),_0xfd28('0xb2')],'through':_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xb3')]?{'attributes':[],'where':{'TagId':_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xb3')]||undefined}}:{},'required':_0x4dd71e['query'][_0xfd28('0xb3')]?!![]:![]}];}else{_0x43e33a[_0xfd28('0xa6')]=[{'all':!![]}];}}return _0x1bbb0b[_0x11d8c4[_0xfd28('0x11')]][_0xfd28('0x8')](_0x43e33a);})[_0xfd28('0x9')](function(_0x4f31de){_0x2b5c85[_0xfd28('0xb5')]=_0x4f31de;if(_0x1c2f6b===_0xfd28('0x2c')&&_0x4dd71e[_0xfd28('0x84')][_0xfd28('0xb6')]===_0xfd28('0xb7')){var _0x41de23=[];for(var _0x39fa9a=0x0;_0x39fa9a<_0x2b5c85[_0xfd28('0xb5')][_0xfd28('0x8c')];_0x39fa9a++){_0x41de23[_0xfd28('0x8d')](_0x2de0d0('chat',_0x2b5c85[_0xfd28('0xb5')][_0x39fa9a][_0xfd28('0xb8')]));_0x41de23[_0xfd28('0x8d')](_0x2de0d0(_0xfd28('0xb9'),_0x2b5c85[_0xfd28('0xb5')][_0x39fa9a]['dataValues']));_0x41de23['push'](_0x2de0d0(_0xfd28('0xba'),_0x2b5c85[_0xfd28('0xb5')][_0x39fa9a][_0xfd28('0xb8')]));_0x41de23[_0xfd28('0x8d')](_0x2de0d0(_0xfd28('0xbb'),_0x2b5c85[_0xfd28('0xb5')][_0x39fa9a][_0xfd28('0xb8')]));_0x41de23[_0xfd28('0x8d')](_0x2de0d0(_0xfd28('0xbc'),_0x2b5c85[_0xfd28('0xb5')][_0x39fa9a][_0xfd28('0xb8')]));_0x41de23['push'](_0x2de0d0(_0xfd28('0xbd'),_0x2b5c85[_0xfd28('0xb5')][_0x39fa9a][_0xfd28('0xb8')]));}return Promise[_0xfd28('0x96')](_0x41de23)['then'](function(){return _0x2b5c85;});}return _0x2b5c85;});}});}}});};
\ No newline at end of file