8e1f4d2ec3216e5e2c33bb1c8e607160adf3a9a3
[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 _0x33af=['isEmpty','length','push','UserProfileSection','find','params','ignore','autoAssociation','model','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','DefaultReports','custom','CustomReports','rows','count','Tags','color','tag','ThroughTags','true','dataValues','sms','fax','mail','whatsapp','./userProfile.attributes','squel','exports','models','filter','field','value','then','associatedResources','map','catch','findAll','name','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','SquareRecording','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicerecordings','membername','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','agents','telephones','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','tags','Tag','Template','triggers','Trigger','trunks','variables','Plugin','extractedreports','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27'];(function(_0x105e12,_0x3131d0){var _0x668c39=function(_0x248461){while(--_0x248461){_0x105e12['push'](_0x105e12['shift']());}};_0x668c39(++_0x3131d0);}(_0x33af,0xec));var _0xf33a=function(_0x383f90,_0x42edf5){_0x383f90=_0x383f90-0x0;var _0x101752=_0x33af[_0x383f90];return _0x101752;};'use strict';var _=require('lodash');var attributes=require(_0xf33a('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0xf33a('0x1'));module[_0xf33a('0x2')]=function(_0x267057){var _0x4303f1=_0x267057[_0xf33a('0x3')];function _0x25f156(_0x4c734e,_0x433e25){return new Promise(function(_0x44cfa5,_0x583e54){if(!_0x433e25)return _0x44cfa5(null);var _0xc0dd13=_0x433e25[_0xf33a('0x4')]?{[_0x433e25[_0xf33a('0x4')][_0xf33a('0x5')]]:_0x433e25[_0xf33a('0x4')][_0xf33a('0x6')]}:undefined;return _0x4303f1[_0x4c734e]['findAll']({'where':_0xc0dd13,'raw':!![]})[_0xf33a('0x7')](function(_0x14eb0e){_0x433e25[_0xf33a('0x8')]=_[_0xf33a('0x9')](_0x14eb0e,'id');_0x44cfa5(_0x433e25);})[_0xf33a('0xa')](function(_0x27f30a){_0x583e54(_0x27f30a);});});}function _0x5074a2(_0x4ea282,_0x31ccd8){return new Promise(function(_0xb47cde,_0x170468){var _0x22bd5c=_0x4ea282[_0xf33a('0x4')]?{[_0x4ea282['filter'][_0xf33a('0x5')]]:_0x4ea282[_0xf33a('0x4')]['value']}:undefined;return _0x4303f1[_0x4ea282['model']][_0xf33a('0xb')]({'where':_0x22bd5c,'raw':!![]})[_0xf33a('0x7')](function(_0x17043){_0x31ccd8[_0xf33a('0x8')]=_[_0xf33a('0x9')](_0x17043,function(_0xc01217){return _0xc01217[_0xf33a('0xc')];});_0xb47cde(_0x31ccd8);})[_0xf33a('0xa')](function(_0x507cb9){_0x170468(_0x507cb9);});});}function _0x441f59(_0x5b5f27,_0x75848d,_0x229389){if(!_0x75848d)return Promise['resolve'](null);return new Promise(function(_0x37e76c,_0x25c931){return _0x4303f1['UserProfileResource'][_0xf33a('0xb')]({'where':{'sectionId':_0x75848d['id']},'raw':!![]})[_0xf33a('0x7')](function(_0x38d69a){if(_0x5b5f27[_0xf33a('0x5')]&&_0x5b5f27['field']!=='id'){_0x75848d[_0xf33a('0x8')]=_[_0xf33a('0x9')](_0x38d69a,function(_0x2c295e){return _0x2c295e[_0x5b5f27[_0xf33a('0x5')]];});}else{if(_0x229389===_0xf33a('0xd')){_0x75848d[_0xf33a('0x8')]=_[_0xf33a('0x9')](_0x38d69a,function(_0x288275){return{'id':_0x288275[_0xf33a('0xe')],'type':_0x288275[_0xf33a('0xf')]};});}else{_0x75848d['associatedResources']=_[_0xf33a('0x9')](_0x38d69a,function(_0x272e60){return _0x272e60[_0xf33a('0xe')];});}}_0x37e76c(_0x75848d);})[_0xf33a('0xa')](function(_0x2ab756){_0x25c931(_0x2ab756);});});}function _0x51d3fd(_0x44654c,_0x5882ba){var _0x492986={'parentSections':[]};switch(_0x44654c[_0xf33a('0x10')]()){case _0xf33a('0x11'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x13');break;case'odbc':_0x492986[_0xf33a('0x12')]=_0xf33a('0x14');break;case'squarerecordings':_0x492986['childModel']=_0xf33a('0x15');_0x492986['parentSections']=[{'name':'SquareProjects','field':_0xf33a('0xc'),'foreignKey':'projectName'}];break;case _0xf33a('0x16'):_0x492986['childModel']=_0xf33a('0x17');break;case _0xf33a('0x18'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x19');_0x492986[_0xf33a('0x1a')]=[{'name':_0xf33a('0x1b'),'field':'id','foreignKey':_0xf33a('0x1c')}];break;case _0xf33a('0x1d'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x1e');break;case _0xf33a('0x1f'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x20');break;case _0xf33a('0x21'):_0x492986[_0xf33a('0x12')]='CmCustomField';break;case _0xf33a('0x22'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x23');break;case _0xf33a('0x24'):_0x492986['childModel']=_0xf33a('0x25');break;case _0xf33a('0x26'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x27');break;case _0xf33a('0x28'):_0x492986[_0xf33a('0x12')]='FaxAccount';break;case _0xf33a('0x29'):case _0xf33a('0x2a'):case _0xf33a('0x2b'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x2c');break;case'contexts':_0x492986['childModel']=_0xf33a('0x2d');break;case'voicemails':_0x492986['childModel']='VoiceMail';break;case _0xf33a('0x2e'):_0x492986[_0xf33a('0x12')]='VoiceRecording';_0x492986[_0xf33a('0x1a')]=[{'name':'Agents','field':_0xf33a('0xc'),'foreignKey':_0xf33a('0x2f'),'model':_0xf33a('0x30'),'filter':{'field':_0xf33a('0x31'),'value':[_0xf33a('0x32')]}},{'name':_0xf33a('0x33'),'field':'name','foreignKey':_0xf33a('0x2f'),'model':_0xf33a('0x30'),'filter':{'field':'role','value':[_0xf33a('0x34')]}},{'name':_0xf33a('0x35'),'field':_0xf33a('0xc'),'foreignKey':'queue','model':_0xf33a('0x36'),'filter':{'field':_0xf33a('0xf'),'value':[_0xf33a('0x37')]}},{'name':_0xf33a('0x38'),'field':_0xf33a('0xc'),'foreignKey':_0xf33a('0x39'),'model':_0xf33a('0x36'),'filter':{'field':_0xf33a('0xf'),'value':[_0xf33a('0x3a')]}}];break;case'musiconholds':_0x492986[_0xf33a('0x12')]=_0xf33a('0x3b');break;case'chanspies':_0x492986[_0xf33a('0x12')]='VoiceChanSpy';break;case'voiceprefixes':_0x492986[_0xf33a('0x12')]=_0xf33a('0x3c');break;case'ivrcampaigns':_0x492986[_0xf33a('0x12')]=_0xf33a('0x3d');break;case _0xf33a('0x3e'):_0x492986['childModel']=_0xf33a('0x3f');break;case _0xf33a('0x40'):_0x492986['childModel']=_0xf33a('0x41');break;case _0xf33a('0x42'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x43');break;case _0xf33a('0x44'):_0x492986['childModel']=_0xf33a('0x45');break;case _0xf33a('0x46'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x47');break;case _0xf33a('0x48'):_0x492986['childModel']=_0xf33a('0x49');break;case _0xf33a('0x4a'):_0x492986[_0xf33a('0x12')]='SmsAccount';break;case _0xf33a('0x4b'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x4c');break;case _0xf33a('0x4d'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x4e');break;case'teams':_0x492986[_0xf33a('0x12')]=_0xf33a('0x4f');break;case _0xf33a('0x50'):case _0xf33a('0x51'):_0x492986[_0xf33a('0x12')]='VoiceQueue';if(_0x5882ba){_0x492986[_0xf33a('0x1a')]=[{'name':_0xf33a('0x35')},{'name':_0xf33a('0x38')}];}break;case'users':case _0xf33a('0x52'):case _0xf33a('0x53'):_0x492986['childModel']='User';if(_0x5882ba){_0x492986[_0xf33a('0x1a')]=[{'name':'Users','filter':{'field':_0xf33a('0x31'),'value':[_0xf33a('0x54'),_0xf33a('0x55')]},'ignore':!![]},{'name':_0xf33a('0x56')},{'name':_0xf33a('0x33')}];}break;case _0xf33a('0x57'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x58');break;case _0xf33a('0x59'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x5a');break;case _0xf33a('0x5b'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x5c');break;case _0xf33a('0x5d'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x5e');break;case _0xf33a('0x5f'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x60');break;case _0xf33a('0x61'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x62');break;case _0xf33a('0x63'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x30');break;case _0xf33a('0x64'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x65');break;case'dispositions':_0x492986[_0xf33a('0x12')]=_0xf33a('0x66');break;case'customdashboards':_0x492986[_0xf33a('0x12')]=_0xf33a('0x67');break;case _0xf33a('0x68'):_0x492986['childModel']=_0xf33a('0x69');break;case _0xf33a('0x6a'):_0x492986[_0xf33a('0x12')]='Pause';break;case _0xf33a('0x6b'):_0x492986['childModel']=_0xf33a('0x6c');break;case _0xf33a('0x6d'):_0x492986['childModel']='Sound';break;case _0xf33a('0x6e'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x6f');break;case'templates':_0x492986[_0xf33a('0x12')]=_0xf33a('0x70');break;case _0xf33a('0x71'):_0x492986[_0xf33a('0x12')]=_0xf33a('0x72');break;case _0xf33a('0x73'):_0x492986[_0xf33a('0x12')]='Trunk';break;case _0xf33a('0x74'):_0x492986['childModel']='Variable';break;case'plugins':_0x492986[_0xf33a('0x12')]=_0xf33a('0x75');break;case _0xf33a('0x76'):_0x492986['childModel']=_0xf33a('0xd');_0x492986[_0xf33a('0x1a')]=[{'name':_0xf33a('0x77'),'field':'id','foreignKey':_0xf33a('0x78')}];break;case _0xf33a('0x79'):_0x492986['childModel']='AnalyticMetric';break;}return _0x492986;}function _0x576001(_0xd68561,_0x528ac4){var _0x2e685c=_0xd68561[_0xf33a('0x7a')](0x0)[_0xf33a('0x7b')]()+_0xd68561[_0xf33a('0x7c')](0x1);var _0xe5f799={'type':_0x4303f1[_0xf33a('0x7d')]['QueryTypes'][_0xf33a('0x7e')],'raw':!![]};return new Promise(function(_0xffd172,_0x176dee){var _0x4e48d6=squel[_0xf33a('0x7f')]()[_0xf33a('0x5')](_0xf33a('0x80')+_0x2e685c+_0xf33a('0x81'),'id')[_0xf33a('0x5')](_0xf33a('0x82'))[_0xf33a('0x83')](_0xf33a('0x84')+_0xd68561+_0xf33a('0x85'),'ui')[_0xf33a('0x86')](_0xf33a('0x87'),_0x528ac4['id']);return _0x4303f1[_0xf33a('0x88')][_0xf33a('0x89')](_0x4e48d6[_0xf33a('0x8a')](),_0xe5f799)['then'](function(_0x489cb2){_0x528ac4[_0x2e685c+_0xf33a('0x8b')]=_0x489cb2;_0xffd172(_0x489cb2);})[_0xf33a('0xa')](function(_0x225ace){_0x176dee(_0x225ace);});});}return _0x267057[_0xf33a('0x8c')](_0xf33a('0x8d'),attributes,{'tableName':_0xf33a('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xf54e7e){var _0x3af78b={'raw':![],'where':{}};var _0x5135b9={};var _0x467851={'count':0x0,'rows':[]};var _0x3cc18f=_0xf54e7e['query'][_0xf33a('0x8f')];var _0xdded60=_0xf54e7e[_0xf33a('0x89')][_0xf33a('0x90')]||![];var _0x3ffcca=_0x51d3fd(_0x3cc18f,_0xdded60);if(!_0x3ffcca[_0xf33a('0x12')])throw new Error(_0xf33a('0x91')+_0x3cc18f+'\x27');var _0x1c2116=[{'name':_0x3cc18f}];if(!_[_0xf33a('0x92')](_0x3ffcca['parentSections']))_0x1c2116=_0x3ffcca[_0xf33a('0x1a')];var _0x12fa25=[];for(var _0x575ad0=0x0;_0x575ad0<_0x1c2116[_0xf33a('0x93')];_0x575ad0++){_0x12fa25[_0xf33a('0x94')](_0x4303f1[_0xf33a('0x95')][_0xf33a('0x96')]({'where':{'userProfileId':_0xf54e7e[_0xf33a('0x97')]['id'],'name':_0x1c2116[_0x575ad0][_0xf33a('0xc')]},'raw':!![]}));}return Promise['all'](_0x12fa25)[_0xf33a('0x7')](function(_0x2258b7){var _0x11f7a1=_[_0xf33a('0x4')](_0x2258b7,function(_0x12cdeb){return _0x12cdeb?_0x12cdeb:undefined;});var _0x367c93=_[_0xf33a('0x4')](_0x1c2116,['ignore',!![]]);var _0x30c502=_[_0xf33a('0x92')](_0x11f7a1)&&_['isEmpty'](_0x367c93)?null:_['union'](_0x367c93,_0x11f7a1);if(!_0x30c502)return null;var _0x4c9da5=[];for(var _0x32ae48=0x0;_0x32ae48<_0x30c502[_0xf33a('0x93')];_0x32ae48++){var _0xe23c77=_[_0xf33a('0x96')](_0x1c2116,function(_0x2a9995){return _0x30c502[_0x32ae48]?_0x2a9995[_0xf33a('0xc')]===_0x30c502[_0x32ae48][_0xf33a('0xc')]:null;});if(_0xe23c77){if(_0x30c502[_0x32ae48][_0xf33a('0x98')]){_0x4c9da5[_0xf33a('0x94')](_0x25f156(_0x3ffcca[_0xf33a('0x12')],_0x30c502[_0x32ae48]));}else{if(!_0x30c502[_0x32ae48][_0xf33a('0x99')]){_0x4c9da5[_0xf33a('0x94')](_0x441f59(_0xe23c77,_0x30c502[_0x32ae48],_0x3ffcca['childModel']));}else{if(_0xe23c77[_0xf33a('0x9a')]){_0x4c9da5['push'](_0x5074a2(_0xe23c77,_0x30c502[_0x32ae48]));}}}}}return Promise['all'](_0x4c9da5);})[_0xf33a('0x7')](function(_0x25cc49){var _0x132764=_0x25cc49;var _0x596b2f=null;if(_0x132764){_0x596b2f=_0x132764['length']===0x1?_0x132764[0x0]:null;}if(!_0x596b2f&&!_0x132764)return _0x467851;var _0x10c8e8=_0x4303f1[_0x3ffcca['childModel']][_0xf33a('0x9b')];_0x5135b9[_0xf33a('0x9a')]=_[_0xf33a('0x9c')](_0x10c8e8);_0x5135b9[_0xf33a('0x89')]=_[_0xf33a('0x9c')](_0xf54e7e['query']);_0x5135b9['filters']=_[_0xf33a('0x9d')](_0x5135b9[_0xf33a('0x9a')],_0x5135b9[_0xf33a('0x89')]);_0x3af78b[_0xf33a('0x9e')]=_['intersection'](_0x5135b9[_0xf33a('0x9a')],qs[_0xf33a('0x9f')](_0xf54e7e['query'][_0xf33a('0x9f')]));_0x3af78b[_0xf33a('0x9e')]=_0x3af78b[_0xf33a('0x9e')]['length']?_0x3af78b[_0xf33a('0x9e')]:_0x5135b9[_0xf33a('0x9a')];if(!_0xf54e7e[_0xf33a('0x89')][_0xf33a('0xa0')]('nolimit')){_0x3af78b[_0xf33a('0xa1')]=qs[_0xf33a('0xa1')](_0xf54e7e[_0xf33a('0x89')]['limit']);_0x3af78b[_0xf33a('0xa2')]=qs[_0xf33a('0xa2')](_0xf54e7e[_0xf33a('0x89')][_0xf33a('0xa2')]);}_0x3af78b[_0xf33a('0xa3')]=qs[_0xf33a('0xa4')](_0xf54e7e[_0xf33a('0x89')][_0xf33a('0xa4')]);_0x3af78b[_0xf33a('0x86')]=qs[_0xf33a('0xa5')](_[_0xf33a('0xa6')](_0xf54e7e[_0xf33a('0x89')],_0x5135b9[_0xf33a('0xa5')]));if(_0xf54e7e[_0xf33a('0x89')][_0xf33a('0x4')]){_0x3af78b['where']=_[_0xf33a('0xa7')](_0x3af78b[_0xf33a('0x86')],{'$or':_[_0xf33a('0x9')](_0x10c8e8,function(_0x1769f8){if(_0x1769f8[_0xf33a('0xf')][_0xf33a('0xa8')]!==_0xf33a('0xa9')){var _0x2dc012={};_0x2dc012[_0x1769f8[_0xf33a('0x5')]]={'$like':'%'+_0xf54e7e[_0xf33a('0x89')][_0xf33a('0x4')]+'%'};return _0x2dc012;}})});}var _0x328ad3=[];var _0x3a8906=null;var _0x439c40={};if(_0x596b2f){_0x3a8906=_['find'](_0x1c2116,[_0xf33a('0xc'),_0x596b2f[_0xf33a('0xc')]]);if(_0x3a8906[_0xf33a('0x5')]){_0x439c40={};if(_0x3ffcca[_0xf33a('0x12')]==='AnalyticExtractedReport'){_0x439c40[_0x3a8906[_0xf33a('0xaa')]]=_[_0xf33a('0x9')](_0x596b2f[_0xf33a('0x8')],'id');}else{_0x439c40[_0x3a8906[_0xf33a('0xaa')]]=_0x596b2f[_0xf33a('0x8')];}_0x328ad3[_0xf33a('0x94')](_0x439c40);}else{_0x3af78b[_0xf33a('0x86')]['id']=_0x596b2f[_0xf33a('0x8')];}}else{for(var _0x50231b=0x0;_0x50231b<_0x132764[_0xf33a('0x93')];_0x50231b++){_0x3a8906=_[_0xf33a('0x96')](_0x1c2116,[_0xf33a('0xc'),_0x132764[_0x50231b][_0xf33a('0xc')]]);if(_0x3a8906['field']){_0x439c40={};_0x439c40[_0x3a8906['foreignKey']]=_0x132764[_0x50231b][_0xf33a('0x8')];_0x328ad3['push'](_0x439c40);}else{if(!_0x3af78b[_0xf33a('0x86')]['id'])_0x3af78b[_0xf33a('0x86')]['id']=[];_0x132764[_0x50231b][_0xf33a('0x8')][_0xf33a('0xab')](function(_0x4e484b){_0x3af78b['where']['id'][_0xf33a('0x94')](_0x4e484b);});}}}if(!_['isEmpty'](_0x328ad3)){_0x3af78b[_0xf33a('0x86')]=_[_0xf33a('0xa7')](_0x3af78b[_0xf33a('0x86')],{'$and':{'$or':_0x328ad3}});}_0x3af78b=_[_0xf33a('0xa7')]({},_0x3af78b,_0xf54e7e[_0xf33a('0xac')]);if(_0x596b2f&&!_0x596b2f[_0xf33a('0x99')]&&_0x3ffcca[_0xf33a('0x12')]===_0xf33a('0xd')){if(_0xf54e7e[_0xf33a('0x89')][_0xf33a('0xad')]){_0x3af78b[_0xf33a('0xae')]=[{'all':!![]}];}return _0x4303f1[_0x3ffcca[_0xf33a('0x12')]][_0xf33a('0xb')](_0x3af78b)[_0xf33a('0x7')](function(_0xc2e6ae){var _0x254c5c=[];_0xc2e6ae['forEach'](function(_0x28e7bc){var _0x59c9e9;switch(_0x28e7bc[_0xf33a('0xaf')]){case'default':_0x59c9e9=_['find'](_0x596b2f['associatedResources'],function(_0x25cd0c){return _0x25cd0c['id']===_0x28e7bc[_0xf33a('0x78')]&&_0x25cd0c['type']===_0xf33a('0xb0');});break;case _0xf33a('0xb1'):_0x59c9e9=_[_0xf33a('0x96')](_0x596b2f[_0xf33a('0x8')],function(_0x1df6ea){return _0x1df6ea['id']===_0x28e7bc[_0xf33a('0x78')]&&_0x1df6ea['type']===_0xf33a('0xb2');});break;}if(_0x59c9e9)_0x254c5c[_0xf33a('0x94')](_0x28e7bc);});_0x467851['count']=_0x254c5c[_0xf33a('0x93')];_0x467851[_0xf33a('0xb3')]=_0x254c5c;return _0x467851;});}else{return _0x4303f1[_0x3ffcca[_0xf33a('0x12')]]['count']({'where':_0x3af78b[_0xf33a('0x86')]})[_0xf33a('0x7')](function(_0xb2aa64){_0x467851[_0xf33a('0xb4')]=_0xb2aa64;if(_0xf54e7e[_0xf33a('0x89')]['includeAll']){if(_0x3ffcca[_0xf33a('0x12')]===_0xf33a('0x19')){_0x3af78b[_0xf33a('0xae')]=[{'model':_0x4303f1[_0xf33a('0x6f')],'as':_0xf33a('0xb5'),'attributes':['id','name',_0xf33a('0xb6')],'required':_0xf54e7e[_0xf33a('0x89')][_0xf33a('0xb7')]?!![]:![]},{'model':_0x4303f1[_0xf33a('0x6f')],'as':_0xf33a('0xb8'),'attributes':['id','name',_0xf33a('0xb6')],'through':_0xf54e7e['query']['tag']?{'attributes':[],'where':{'TagId':_0xf54e7e[_0xf33a('0x89')]['tag']||undefined}}:{},'required':_0xf54e7e[_0xf33a('0x89')][_0xf33a('0xb7')]?!![]:![]}];}else{_0x3af78b['include']=[{'all':!![]}];}}return _0x4303f1[_0x3ffcca[_0xf33a('0x12')]][_0xf33a('0xb')](_0x3af78b);})[_0xf33a('0x7')](function(_0x35b06f){_0x467851[_0xf33a('0xb3')]=_0x35b06f;if(_0x3cc18f===_0xf33a('0x56')&&_0xf54e7e[_0xf33a('0x89')]['openTabs']===_0xf33a('0xb9')){var _0x1d83a0=[];for(var _0x212f6d=0x0;_0x212f6d<_0x467851[_0xf33a('0xb3')]['length'];_0x212f6d++){_0x1d83a0[_0xf33a('0x94')](_0x576001('chat',_0x467851[_0xf33a('0xb3')][_0x212f6d][_0xf33a('0xba')]));_0x1d83a0[_0xf33a('0x94')](_0x576001(_0xf33a('0xbb'),_0x467851[_0xf33a('0xb3')][_0x212f6d]['dataValues']));_0x1d83a0[_0xf33a('0x94')](_0x576001(_0xf33a('0xbc'),_0x467851[_0xf33a('0xb3')][_0x212f6d][_0xf33a('0xba')]));_0x1d83a0[_0xf33a('0x94')](_0x576001(_0xf33a('0xbd'),_0x467851['rows'][_0x212f6d][_0xf33a('0xba')]));_0x1d83a0[_0xf33a('0x94')](_0x576001('openchannel',_0x467851[_0xf33a('0xb3')][_0x212f6d][_0xf33a('0xba')]));_0x1d83a0[_0xf33a('0x94')](_0x576001(_0xf33a('0xbe'),_0x467851['rows'][_0x212f6d]['dataValues']));}return Promise['all'](_0x1d83a0)[_0xf33a('0x7')](function(){return _0x467851;});}return _0x467851;});}});}}});};