Built motion from commit c49361c37b5f784889c8087ac6e0e91b7e6b561a. Version 3.0.0...
[motion-next.git] / server / api / chatWebsite / chatWebsite.controller.js
index 3791990..359521f 100644 (file)
@@ -1 +1 @@
-const a111_0x2952=['split','Command','includes','includeAll','MailAccount','device','CmList','isNil','replace','from\x20is\x20mandatory','getCustomerAvatar','order','customerAvatar','count','key','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','rows','addInteraction','showCustomerAvatar','findAll','ListId','nolimit','headers','role','getInteractions','ChatInteraction','removeDispositions','../../config/logger','sort','List','MailServerOut','Start','Tags','Contacts','increment','*,*,*,*','offset','agentAvatar','SendMail','service','./chatWebsite.socket','addApplications','customerIp','file','send','bulkCreate','include','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','end','account','contact','priority','host','server/files/images/avatars/system_avatar.png','x-real-ip','remote','vendor','%s\x20%s\x20%s','virtual','../../config/license/util','rawAttributes','root','true','no\x20available\x20attributes','lodash','mandatoryDispositionPause','orderBy','stack','getAgents','toPairs','addLogo','offlineForm','http','emit','custom','referer','register','Pause','Contact','ChatWebsites','CompanyId','jayson/promise','authentication','interval','Interval','destroy','type','connection','%s\x20%s','merge','UserId','getDispositions','findOne','tag','user-agent-parser','omit','index','../../rediscache','server/files/images/avatars/default_avatar.png','ChatWebsite','getAnswers','getAvatar','error','client','status','readFileSync','all','ONLINE','../../components/parsers/qs','threadId','options','util','keys','attributes','sequelize','push','result','email','createdAt','info','chat','startRouting','model','ChatWebsite,\x20%s,\x20%s','sendMail','download','x-forwarded-for','sendStatus','mapKeyOffline','request','user','pick','json','then','updatedAt','DESC','agent','limit','version','browser','Disposition','existsSync','getApplications','from','server/files/images/logos/','items','mustache','secure','chatLicenseExceeded','verticalAlignment','server/files/templates/chatOfflineMessage.ejs','CmContact','autoclose','lastName','get','autoAssociation','false','applications','created','ChatOfflineMessage','message','app','addCustomerAvatar','join','findAndCountAll','CannedAnswer','online','Intervals','Unable\x20to\x20retrieve\x20the\x20current\x20user','Smtp','UserProfileResource','offlineMessageBody','forcedOwnership','port','api','unshift','systemAvatar','../../config/environment','removeAgents','where','body\x20is\x20mandatory\x20and\x20not\x20empty','externalUrl','iftime\x20%s,%s','stringify','addAgents','forwardOfflineAddress','getLogo','render','params','pass','filter','fieldName','ContactId','set','getSnippet','removeAnswers','../../mysqldb','utf8','addProactiveActions','length','addAvatar','like','map','server/files/images/avatars/','internal','No\x20timezone','addDisposition','close','userChatWebsite:remove','name','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','cf-connecting-ip','query','VIRTUAL','ChatWebsiteId','ids','color','userProfileId','unknown','fromKey','User','format','defaults','getLicense','filters','body','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','inspect','indexOf','undefined','some','asc','fields','intersection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','filename','getResult','getProactiveActions','Owner','first','catch','mapKey','ChatApplication','ChatWebsite,\x20%s,\x20%s,\x20%s','sitepic','update','isArray','timezone','remoteAddress','Applications','describe','auth','ChatMessage','messageId','setUA','notify','difference','interaction'];(function(_0x4ee830,_0x295269){const _0x1a8b24=function(_0x12a92c){while(--_0x12a92c){_0x4ee830['push'](_0x4ee830['shift']());}};_0x1a8b24(++_0x295269);}(a111_0x2952,0x104));const a111_0x1a8b=function(_0x4ee830,_0x295269){_0x4ee830=_0x4ee830-0x0;let _0x1a8b24=a111_0x2952[_0x4ee830];return _0x1a8b24;};const _0x338c3c=a111_0x1a8b;'use strict';const Mustache=require(_0x338c3c('0x91')),util=require(_0x338c3c('0x6e')),path=require('path'),ejs=require('ejs'),fs=require('fs'),_=require(_0x338c3c('0x3f')),querystring=require('querystring'),qs=require(_0x338c3c('0x6b')),logger=require(_0x338c3c('0x1a'))(_0x338c3c('0xad')),config=require(_0x338c3c('0xb0')),db=require(_0x338c3c('0xc3'))['db'],{Op,ValidationError}=require(_0x338c3c('0x71')),{getSocket}=require(_0x338c3c('0x60')),socket=getSocket();require(_0x338c3c('0x27'))[_0x338c3c('0x4b')](socket);const jayson=require(_0x338c3c('0x50')),client=jayson[_0x338c3c('0x66')][_0x338c3c('0x47')]({'port':0x232c}),client9002=jayson[_0x338c3c('0x66')][_0x338c3c('0x47')]({'port':0x232a}),client9003=jayson[_0x338c3c('0x66')][_0x338c3c('0x47')]({'port':0x232b});function respondWithRpcPromise(_0x12a92c,_0x6f2591,_0x38dac4,_0x57adab){return new Promise(function(_0x14e803,_0x4954f8){const _0x53efae=a111_0x1a8b,_0x3517ef=_0x57adab||client;return _0x3517ef[_0x53efae('0x80')](_0x12a92c,_0x38dac4)[_0x53efae('0x84')](function(_0x2559ce){const _0x5d02d4=_0x53efae;logger[_0x5d02d4('0x76')](_0x5d02d4('0x7a'),_0x6f2591,'request\x20sent'),logger['debug'](_0x5d02d4('0xf3'),_0x6f2591,'request\x20sent',JSON['stringify'](_0x2559ce));if(_0x2559ce['error']){if(_0x2559ce[_0x5d02d4('0x65')]['code']===0x1f4)return logger[_0x5d02d4('0x65')](_0x5d02d4('0x7a'),_0x6f2591,_0x2559ce[_0x5d02d4('0x65')]['message']),_0x4954f8(_0x2559ce[_0x5d02d4('0x65')][_0x5d02d4('0x9f')]);return logger[_0x5d02d4('0x65')](_0x5d02d4('0x7a'),_0x6f2591,_0x2559ce[_0x5d02d4('0x65')][_0x5d02d4('0x9f')]),_0x14e803(_0x2559ce[_0x5d02d4('0x65')][_0x5d02d4('0x9f')]);}else logger[_0x5d02d4('0x76')](_0x5d02d4('0x7a'),_0x6f2591,'request\x20sent'),_0x14e803(_0x2559ce[_0x5d02d4('0x73')]['message']);})['catch'](function(_0x185601){const _0x27d9bf=_0x53efae;logger['error'](_0x27d9bf('0x7a'),_0x6f2591,_0x185601),_0x4954f8(_0x185601);});});}function respondWithStatusCode(_0x36fd41,_0x3a869f){return _0x3a869f=_0x3a869f||0xcc,function(_0x1e4b3c){const _0x36e6ce=a111_0x1a8b;if(_0x1e4b3c)return _0x36fd41[_0x36e6ce('0x7e')](_0x3a869f);return _0x36fd41[_0x36e6ce('0x67')](_0x3a869f)[_0x36e6ce('0x2f')]();};}function respondWithResult(_0x594110,_0x18a7d8){return _0x18a7d8=_0x18a7d8||0xc8,function(_0x65502f){const _0x4730ec=a111_0x1a8b;if(_0x65502f)return _0x594110[_0x4730ec('0x67')](_0x18a7d8)[_0x4730ec('0x83')](_0x65502f);};}function respondWithFilteredResult(_0x1aab05,_0x2c0a5d){return function(_0x67704){const _0x2ee69c=a111_0x1a8b;if(_0x67704){const _0x32f70e=_0x67704[_0x2ee69c('0xc')],_0x19d836=_0x2c0a5d['offset'];let _0x4f902e=_0x2c0a5d[_0x2ee69c('0x23')]+_0x2c0a5d['limit'],_0xbe745d;return _0x4f902e>=_0x32f70e?(_0x4f902e=_0x32f70e,_0xbe745d=0xc8):_0xbe745d=0xce,_0x1aab05['status'](_0xbe745d),_0x1aab05[_0x2ee69c('0xc0')]('Content-Range',_0x19d836+'-'+_0x4f902e+'/'+_0x32f70e)[_0x2ee69c('0x83')](_0x67704);}return null;};}function saveUpdates(_0x23abb9){return function(_0x27e4fc){const _0x385e7b=a111_0x1a8b;if(_0x27e4fc)return _0x27e4fc[_0x385e7b('0xf5')](_0x23abb9)[_0x385e7b('0x84')](function(_0x41b2c8){return _0x41b2c8;});return null;};}function removeEntity(_0xa4d5f7){return function(_0x20db8f){const _0x2f9dff=a111_0x1a8b;if(_0x20db8f)return _0x20db8f[_0x2f9dff('0x54')]()[_0x2f9dff('0x84')](function(){const _0x4c0cbf=_0x2f9dff,_0x43c5ea=_0x20db8f[_0x4c0cbf('0x99')]({'plain':!![]}),_0x1e8e96=_0x4c0cbf('0x4e');return db[_0x4c0cbf('0xa9')]['destroy']({'where':{'type':_0x1e8e96,'resourceId':_0x43c5ea['id']}})['then'](function(){return _0x20db8f;});})[_0x2f9dff('0x84')](function(){const _0x1ec439=_0x2f9dff;_0xa4d5f7[_0x1ec439('0x67')](0xcc)['end']();});};}function handleEntityNotFound(_0xa14389){return function(_0x4c2089){const _0x23cd0f=a111_0x1a8b;return!_0x4c2089&&_0xa14389[_0x23cd0f('0x7e')](0x194),_0x4c2089;};}function handleError(_0x45de0f,_0x2109ee){return _0x2109ee=_0x2109ee||0x1f4,function(_0x161c3b){const _0x225651=a111_0x1a8b;logger[_0x225651('0x65')](_0x161c3b[_0x225651('0x42')]),_0x161c3b[_0x225651('0xd0')]&&delete _0x161c3b[_0x225651('0xd0')],_0x45de0f[_0x225651('0x67')](_0x2109ee)[_0x225651('0x2b')](_0x161c3b);};}exports[_0x338c3c('0x5f')]=function(_0x37f541,_0x32ffbf){const _0x4cb590=_0x338c3c;let _0x3fe97a={'include':[{'model':db[_0x4cb590('0x4c')],'as':_0x4cb590('0x40')}]};const _0x390d53={},_0x203342={'count':0x0,'rows':[]},_0x4de306=_[_0x4cb590('0xc9')](db[_0x4cb590('0x62')][_0x4cb590('0x3b')],function(_0x1a40a8){const _0x22f706=_0x4cb590;return{'name':_0x1a40a8[_0x22f706('0xbe')],'type':_0x1a40a8[_0x22f706('0x55')][_0x22f706('0xd')]};});_0x390d53[_0x4cb590('0x79')]=_[_0x4cb590('0xc9')](_0x4de306,_0x4cb590('0xd0')),_0x390d53[_0x4cb590('0xd3')]=_[_0x4cb590('0x6f')](_0x37f541[_0x4cb590('0xd3')]),_0x390d53[_0x4cb590('0xdf')]=_[_0x4cb590('0xe8')](_0x390d53[_0x4cb590('0x79')],_0x390d53[_0x4cb590('0xd3')]),_0x3fe97a[_0x4cb590('0x70')]=_[_0x4cb590('0xe8')](_0x390d53['model'],qs[_0x4cb590('0xe7')](_0x37f541[_0x4cb590('0xd3')][_0x4cb590('0xe7')])),_0x3fe97a[_0x4cb590('0x70')]=_0x3fe97a[_0x4cb590('0x70')][_0x4cb590('0xc6')]?_0x3fe97a[_0x4cb590('0x70')]:_0x390d53[_0x4cb590('0x79')];typeof _0x37f541[_0x4cb590('0xd3')][_0x4cb590('0x14')]===_0x4cb590('0xe4')&&(_0x3fe97a[_0x4cb590('0x88')]=qs[_0x4cb590('0x88')](_0x37f541[_0x4cb590('0xd3')][_0x4cb590('0x88')]),_0x3fe97a[_0x4cb590('0x23')]=qs['offset'](_0x37f541[_0x4cb590('0xd3')][_0x4cb590('0x23')]));_0x3fe97a[_0x4cb590('0xa')]=qs['sort'](_0x37f541['query']['sort']),_0x3fe97a[_0x4cb590('0xb2')]=qs[_0x4cb590('0xdf')](_['pick'](_0x37f541['query'],_0x390d53[_0x4cb590('0xdf')]),_0x4de306);_0x37f541[_0x4cb590('0xd3')][_0x4cb590('0xbd')]&&(_0x3fe97a[_0x4cb590('0xb2')]=_[_0x4cb590('0x58')](_0x3fe97a[_0x4cb590('0xb2')],{[Op['or']]:_[_0x4cb590('0xc9')](_0x4de306,function(_0x29ec60){const _0x388173=_0x4cb590;if(_0x29ec60[_0x388173('0x55')]!==_0x388173('0xd4')){const _0x1daee4={};return _0x1daee4[_0x29ec60[_0x388173('0xd0')]]={[Op['like']]:'%'+_0x37f541[_0x388173('0xd3')][_0x388173('0xbd')]+'%'},_0x1daee4;}})}));_0x3fe97a=_['merge']({},_0x3fe97a,_0x37f541[_0x4cb590('0x6d')]);const _0x5399cb={'where':_0x3fe97a[_0x4cb590('0xb2')]};return db['ChatWebsite']['count'](_0x5399cb)[_0x4cb590('0x84')](function(_0x5186d5){const _0x440296=_0x4cb590;return _0x203342['count']=_0x5186d5,_0x37f541['query']['includeAll']&&(_0x3fe97a[_0x440296('0x2d')]=[{'all':!![]}]),db[_0x440296('0x62')][_0x440296('0x12')](_0x3fe97a);})[_0x4cb590('0x84')](function(_0x4d4690){const _0x44d23c=_0x4cb590;return _0x203342[_0x44d23c('0xf')]=_0x4d4690,_0x203342;})[_0x4cb590('0x84')](respondWithFilteredResult(_0x32ffbf,_0x3fe97a))[_0x4cb590('0xf0')](handleError(_0x32ffbf,null));},exports['show']=function(_0x902a21,_0x4dbf83){const _0x198945=_0x338c3c;let _0x3cb107={'raw':![],'where':{'id':_0x902a21[_0x198945('0xbb')]['id']},'include':[{'model':db[_0x198945('0x4c')],'as':_0x198945('0x40')}]};const _0x376695={};return _0x376695[_0x198945('0x79')]=_['keys'](db[_0x198945('0x62')][_0x198945('0x3b')]),_0x376695[_0x198945('0xd3')]=_['keys'](_0x902a21[_0x198945('0xd3')]),_0x376695[_0x198945('0xdf')]=_[_0x198945('0xe8')](_0x376695[_0x198945('0x79')],_0x376695[_0x198945('0xd3')]),_0x3cb107[_0x198945('0x70')]=_[_0x198945('0xe8')](_0x376695[_0x198945('0x79')],qs[_0x198945('0xe7')](_0x902a21[_0x198945('0xd3')][_0x198945('0xe7')])),_0x3cb107[_0x198945('0x70')]=_0x3cb107['attributes'][_0x198945('0xc6')]?_0x3cb107[_0x198945('0x70')]:_0x376695[_0x198945('0x79')],_0x902a21[_0x198945('0xd3')][_0x198945('0x2')]&&(_0x3cb107[_0x198945('0x2d')]=[{'all':!![]}]),_0x3cb107=_[_0x198945('0x58')]({},_0x3cb107,_0x902a21['options']),db[_0x198945('0x62')]['findOne'](_0x3cb107)['then'](handleEntityNotFound(_0x4dbf83,null))[_0x198945('0x84')](respondWithResult(_0x4dbf83,null))['catch'](handleError(_0x4dbf83,null));},exports[_0x338c3c('0xea')]=function(_0x114d01,_0x4012dd){const _0x27df7e=_0x338c3c;return db[_0x27df7e('0x62')]['create'](_0x114d01['body'],{})[_0x27df7e('0x84')](function(_0x240f95){const _0x27c38f=_0x27df7e,_0x4a8216=_0x114d01[_0x27c38f('0x81')][_0x27c38f('0x99')]({'plain':!![]});if(!_0x4a8216)throw new Error(_0x27c38f('0xa7'));if(_0x4a8216[_0x27c38f('0x16')]===_0x27c38f('0x81')){const _0x48f29a=_0x240f95[_0x27c38f('0x99')]({'plain':!![]}),_0x2f3086=_0x27c38f('0x4e');return db['UserProfileSection'][_0x27c38f('0x5b')]({'where':{'name':_0x2f3086,'userProfileId':_0x4a8216[_0x27c38f('0xd8')]},'raw':!![]})[_0x27c38f('0x84')](function(_0x369120){const _0x2629b6=_0x27c38f;return _0x369120&&_0x369120[_0x2629b6('0x9a')]===0x0?db[_0x2629b6('0xa9')]['create']({'name':_0x48f29a['name'],'resourceId':_0x48f29a['id'],'type':_0x369120[_0x2629b6('0xd0')],'sectionId':_0x369120['id']},{})[_0x2629b6('0x84')](function(){return _0x240f95;}):_0x240f95;})[_0x27c38f('0xf0')](function(_0x5c1f66){const _0x2ea924=_0x27c38f;logger[_0x2ea924('0x65')](_0x2ea924('0xe9'),_0x5c1f66);throw _0x5c1f66;});}return _0x240f95;})['then'](respondWithResult(_0x4012dd,0xc9))['catch'](handleError(_0x4012dd,null));},exports['update']=function(_0x362c82,_0x195d28){const _0x24eb79=_0x338c3c;return _0x362c82['body']['id']&&delete _0x362c82[_0x24eb79('0xe0')]['id'],db['ChatWebsite'][_0x24eb79('0x5b')]({'where':{'id':_0x362c82[_0x24eb79('0xbb')]['id']},'include':[{'model':db[_0x24eb79('0x4c')],'as':_0x24eb79('0x40')}]})[_0x24eb79('0x84')](handleEntityNotFound(_0x195d28,null))[_0x24eb79('0x84')](saveUpdates(_0x362c82['body'],null))[_0x24eb79('0x84')](respondWithResult(_0x195d28,null))[_0x24eb79('0xf0')](handleError(_0x195d28,null));},exports['destroy']=function(_0x1106ca,_0x4d311c){const _0x4b5397=_0x338c3c;return db[_0x4b5397('0x62')][_0x4b5397('0x5b')]({'where':{'id':_0x1106ca[_0x4b5397('0xbb')]['id']}})[_0x4b5397('0x84')](handleEntityNotFound(_0x4d311c,null))[_0x4b5397('0x84')](removeEntity(_0x4d311c,null))[_0x4b5397('0xf0')](handleError(_0x4d311c,null));},exports['describe']=function(_0x96e29d,_0x5508e6){const _0x3ed1d3=_0x338c3c;return db[_0x3ed1d3('0x62')][_0x3ed1d3('0xfa')]()[_0x3ed1d3('0x84')](respondWithResult(_0x5508e6,null))[_0x3ed1d3('0xf0')](handleError(_0x5508e6,null));},exports[_0x338c3c('0xcd')]=function(_0x39e67f,_0x17e861){const _0x15c96f=_0x338c3c;return _0x39e67f[_0x15c96f('0xe0')]['id']&&delete _0x39e67f['body']['id'],db[_0x15c96f('0x62')]['findOne']({'where':{'id':_0x39e67f['params']['id']}})[_0x15c96f('0x84')](handleEntityNotFound(_0x17e861,null))[_0x15c96f('0x84')](function(_0x3c585f){const _0x94fba2=_0x15c96f;if(_0x3c585f)return _0x39e67f['body'][_0x94fba2('0xd5')]=_0x3c585f['id'],db[_0x94fba2('0x8b')][_0x94fba2('0xea')](_0x39e67f['body']);})[_0x15c96f('0x84')](respondWithResult(_0x17e861,null))[_0x15c96f('0xf0')](handleError(_0x17e861,null));},exports[_0x338c3c('0x5a')]=function(_0x4d6577,_0x1217a3){const _0x39ba32=_0x338c3c;let _0x18a84e={'raw':![],'where':{}};const _0x5b8bfc={},_0x58ab50={'count':0x0,'rows':[]};return db[_0x39ba32('0x62')][_0x39ba32('0x5b')]({'where':{'id':_0x4d6577[_0x39ba32('0xbb')]['id']}})[_0x39ba32('0x84')](handleEntityNotFound(_0x1217a3,null))[_0x39ba32('0x84')](function(_0x576bf6){const _0x279067=_0x39ba32;if(_0x576bf6)return _0x5b8bfc['model']=_[_0x279067('0x6f')](db[_0x279067('0x8b')][_0x279067('0x3b')]),_0x5b8bfc[_0x279067('0xd3')]=_[_0x279067('0x6f')](_0x4d6577[_0x279067('0xd3')]),_0x5b8bfc[_0x279067('0xdf')]=_['intersection'](_0x5b8bfc['model'],_0x5b8bfc['query']),_0x18a84e[_0x279067('0x70')]=_[_0x279067('0xe8')](_0x5b8bfc['model'],qs[_0x279067('0xe7')](_0x4d6577[_0x279067('0xd3')][_0x279067('0xe7')])),_0x18a84e[_0x279067('0x70')]=_0x18a84e[_0x279067('0x70')][_0x279067('0xc6')]?_0x18a84e[_0x279067('0x70')]:_0x5b8bfc['model'],typeof _0x4d6577[_0x279067('0xd3')][_0x279067('0x14')]===_0x279067('0xe4')&&(_0x18a84e[_0x279067('0x88')]=qs[_0x279067('0x88')](_0x4d6577['query'][_0x279067('0x88')]),_0x18a84e[_0x279067('0x23')]=qs[_0x279067('0x23')](_0x4d6577[_0x279067('0xd3')]['offset'])),_0x18a84e[_0x279067('0xa')]=qs[_0x279067('0x1b')](_0x4d6577['query']['sort']),_0x18a84e[_0x279067('0xb2')]=qs[_0x279067('0xdf')](_[_0x279067('0x82')](_0x4d6577[_0x279067('0xd3')],_0x5b8bfc['filters'])),_0x18a84e['where']['ChatWebsiteId']=_0x576bf6['id'],_0x4d6577[_0x279067('0xd3')][_0x279067('0xbd')]&&(_0x18a84e[_0x279067('0xb2')]=_[_0x279067('0x58')](_0x18a84e[_0x279067('0xb2')],{[Op['or']]:_[_0x279067('0xc9')](_0x18a84e[_0x279067('0x70')],function(_0x823a9c){const _0x3eae7d=_0x279067,_0x3c48b4={};return _0x3c48b4[_0x823a9c]={[Op[_0x3eae7d('0xc8')]]:'%'+_0x4d6577[_0x3eae7d('0xd3')][_0x3eae7d('0xbd')]+'%'},_0x3c48b4;})})),_0x18a84e=_[_0x279067('0x58')]({},_0x18a84e,_0x4d6577[_0x279067('0x6d')]),db['Disposition'][_0x279067('0xc')]({'where':_0x18a84e[_0x279067('0xb2')]})['then'](function(_0x258d0c){const _0x329cbe=_0x279067;return _0x58ab50[_0x329cbe('0xc')]=_0x258d0c,_0x4d6577['query'][_0x329cbe('0x2')]&&(_0x18a84e[_0x329cbe('0x2d')]=[{'all':!![]}]),db[_0x329cbe('0x8b')]['findAll'](_0x18a84e);})[_0x279067('0x84')](function(_0x35f6d9){const _0x54cbc5=_0x279067;return _0x58ab50[_0x54cbc5('0xf')]=_0x35f6d9,_0x58ab50;});})[_0x39ba32('0x84')](respondWithFilteredResult(_0x1217a3,_0x18a84e))[_0x39ba32('0xf0')](handleError(_0x1217a3,null));},exports[_0x338c3c('0x19')]=function(_0x5ebc9b,_0x461081){const _0x6b807d=_0x338c3c;return db['ChatWebsite']['findOne']({'where':{'id':_0x5ebc9b[_0x6b807d('0xbb')]['id']}})['then'](handleEntityNotFound(_0x461081,null))['then'](function(_0x2fed2d){const _0x12ae7d=_0x6b807d;if(_0x2fed2d)return _0x2fed2d[_0x12ae7d('0x19')](_0x5ebc9b[_0x12ae7d('0xd3')]['ids']);})['then'](respondWithStatusCode(_0x461081,null))[_0x6b807d('0xf0')](handleError(_0x461081,null));},exports['addAnswer']=function(_0x28fa12,_0x3dbac2){const _0x4e3424=_0x338c3c;return _0x28fa12[_0x4e3424('0xe0')]['id']&&delete _0x28fa12[_0x4e3424('0xe0')]['id'],db['ChatWebsite'][_0x4e3424('0x5b')]({'where':{'id':_0x28fa12[_0x4e3424('0xbb')]['id']}})[_0x4e3424('0x84')](handleEntityNotFound(_0x3dbac2,null))['then'](function(_0x13089b){const _0x353450=_0x4e3424;if(_0x13089b)return _0x28fa12[_0x353450('0xe0')][_0x353450('0xd5')]=_0x13089b['id'],db[_0x353450('0xa4')]['create'](_0x28fa12['body']);})[_0x4e3424('0x84')](respondWithResult(_0x3dbac2,null))[_0x4e3424('0xf0')](handleError(_0x3dbac2,null));},exports[_0x338c3c('0x63')]=function(_0x5c6b93,_0x4fa8e8){const _0x13b3a9=_0x338c3c;let _0x219a90={'raw':![],'where':{}};const _0x26f701={},_0x22bf6c={'count':0x0,'rows':[]};return db[_0x13b3a9('0x62')]['findOne']({'where':{'id':_0x5c6b93[_0x13b3a9('0xbb')]['id']}})[_0x13b3a9('0x84')](handleEntityNotFound(_0x4fa8e8,null))[_0x13b3a9('0x84')](function(_0x3e041c){const _0x493816=_0x13b3a9;if(_0x3e041c)return _0x26f701[_0x493816('0x79')]=_[_0x493816('0x6f')](db['CannedAnswer'][_0x493816('0x3b')]),_0x26f701['query']=_[_0x493816('0x6f')](_0x5c6b93['query']),_0x26f701[_0x493816('0xdf')]=_[_0x493816('0xe8')](_0x26f701['model'],_0x26f701[_0x493816('0xd3')]),_0x219a90[_0x493816('0x70')]=_['intersection'](_0x26f701[_0x493816('0x79')],qs[_0x493816('0xe7')](_0x5c6b93['query'][_0x493816('0xe7')])),_0x219a90['attributes']=_0x219a90[_0x493816('0x70')][_0x493816('0xc6')]?_0x219a90[_0x493816('0x70')]:_0x26f701['model'],typeof _0x5c6b93[_0x493816('0xd3')]['nolimit']===_0x493816('0xe4')&&(_0x219a90['limit']=qs['limit'](_0x5c6b93[_0x493816('0xd3')][_0x493816('0x88')]),_0x219a90[_0x493816('0x23')]=qs['offset'](_0x5c6b93[_0x493816('0xd3')]['offset'])),_0x219a90[_0x493816('0xa')]=qs[_0x493816('0x1b')](_0x5c6b93[_0x493816('0xd3')][_0x493816('0x1b')]),_0x219a90[_0x493816('0xb2')]=qs[_0x493816('0xdf')](_[_0x493816('0x82')](_0x5c6b93[_0x493816('0xd3')],_0x26f701[_0x493816('0xdf')])),_0x219a90[_0x493816('0xb2')][_0x493816('0xd5')]=_0x3e041c['id'],_0x5c6b93['query']['filter']&&(_0x219a90[_0x493816('0xb2')]=_[_0x493816('0x58')](_0x219a90[_0x493816('0xb2')],{[Op['or']]:_[_0x493816('0xc9')](_0x219a90['attributes'],function(_0x2bd104){const _0x3f2166=_0x493816,_0x18acbe={};return _0x18acbe[_0x2bd104]={[Op[_0x3f2166('0xc8')]]:'%'+_0x5c6b93[_0x3f2166('0xd3')][_0x3f2166('0xbd')]+'%'},_0x18acbe;})})),_0x219a90=_[_0x493816('0x58')]({},_0x219a90,_0x5c6b93[_0x493816('0x6d')]),db['CannedAnswer'][_0x493816('0xc')]({'where':_0x219a90['where']})[_0x493816('0x84')](function(_0x1ce6d8){const _0x5ae743=_0x493816;return _0x22bf6c[_0x5ae743('0xc')]=_0x1ce6d8,_0x5c6b93[_0x5ae743('0xd3')][_0x5ae743('0x2')]&&(_0x219a90['include']=[{'all':!![]}]),db[_0x5ae743('0xa4')][_0x5ae743('0x12')](_0x219a90);})[_0x493816('0x84')](function(_0x57f8e1){return _0x22bf6c['rows']=_0x57f8e1,_0x22bf6c;});})[_0x13b3a9('0x84')](respondWithFilteredResult(_0x4fa8e8,_0x219a90))[_0x13b3a9('0xf0')](handleError(_0x4fa8e8,null));},exports[_0x338c3c('0xc2')]=function(_0x2e8cb5,_0x3bac3b){const _0x301fe9=_0x338c3c;return db['ChatWebsite'][_0x301fe9('0x5b')]({'where':{'id':_0x2e8cb5[_0x301fe9('0xbb')]['id']}})[_0x301fe9('0x84')](handleEntityNotFound(_0x3bac3b,null))[_0x301fe9('0x84')](function(_0xb6ef71){const _0x4ddfa3=_0x301fe9;if(_0xb6ef71)return _0xb6ef71['removeAnswers'](_0x2e8cb5[_0x4ddfa3('0xd3')][_0x4ddfa3('0xd6')]);})[_0x301fe9('0x84')](respondWithStatusCode(_0x3bac3b,null))[_0x301fe9('0xf0')](handleError(_0x3bac3b,null));},exports[_0x338c3c('0x45')]=function(_0x193008,_0x228948){const _0xac92dc=_0x338c3c;return _0x193008['body']['sitepic']=_0x193008['file'][_0xac92dc('0xeb')],db[_0xac92dc('0x62')][_0xac92dc('0x5b')]({'where':{'id':_0x193008[_0xac92dc('0xbb')]['id']}})[_0xac92dc('0x84')](handleEntityNotFound(_0x228948,null))[_0xac92dc('0x84')](saveUpdates(_0x193008[_0xac92dc('0xe0')],null))[_0xac92dc('0x84')](respondWithResult(_0x228948,null))['catch'](handleError(_0x228948,null));},exports[_0x338c3c('0xc7')]=function(_0x5080f6,_0x5b3bd1){const _0x35453d=_0x338c3c;return _0x5080f6[_0x35453d('0xe0')][_0x35453d('0x24')]=_0x5080f6[_0x35453d('0x2a')]['filename'],db[_0x35453d('0x62')]['findOne']({'where':{'id':_0x5080f6['params']['id']}})['then'](handleEntityNotFound(_0x5b3bd1,null))[_0x35453d('0x84')](saveUpdates(_0x5080f6[_0x35453d('0xe0')],null))[_0x35453d('0x84')](respondWithResult(_0x5b3bd1,null))['catch'](handleError(_0x5b3bd1,null));},exports[_0x338c3c('0xa1')]=function(_0x3624ab,_0x57338c){const _0x1b83a5=_0x338c3c;return _0x3624ab['body'][_0x1b83a5('0xb')]=_0x3624ab['file']['filename'],db[_0x1b83a5('0x62')][_0x1b83a5('0x5b')]({'where':{'id':_0x3624ab[_0x1b83a5('0xbb')]['id']}})[_0x1b83a5('0x84')](handleEntityNotFound(_0x57338c,null))[_0x1b83a5('0x84')](saveUpdates(_0x3624ab[_0x1b83a5('0xe0')],null))['then'](respondWithResult(_0x57338c,null))[_0x1b83a5('0xf0')](handleError(_0x57338c,null));},exports['addSystemAvatar']=function(_0x147313,_0x455a3e){const _0xf53248=_0x338c3c;return _0x147313[_0xf53248('0xe0')][_0xf53248('0xaf')]=_0x147313[_0xf53248('0x2a')][_0xf53248('0xeb')],db[_0xf53248('0x62')][_0xf53248('0x5b')]({'where':{'id':_0x147313['params']['id']}})[_0xf53248('0x84')](handleEntityNotFound(_0x455a3e,null))['then'](saveUpdates(_0x147313[_0xf53248('0xe0')],null))[_0xf53248('0x84')](respondWithResult(_0x455a3e,null))[_0xf53248('0xf0')](handleError(_0x455a3e,null));},exports[_0x338c3c('0xb9')]=function(_0x3683dd,_0x286464){const _0x57cc5f=_0x338c3c;let _0x10d233=path['join'](config[_0x57cc5f('0x3c')],'server/files/images/logos/default_logo.svg');const _0x5382a3={'where':{'id':_0x3683dd[_0x57cc5f('0xbb')]['id']},'attributes':['id','sitepic'],'raw':!![]};let _0x5174cc=![];return require(_0x57cc5f('0x3a'))[_0x57cc5f('0xde')]()[_0x57cc5f('0x84')](function(_0x508b3c){const _0x2cbd4f=_0x57cc5f;_0x508b3c&&(_0x5174cc=_0x508b3c[_0x2cbd4f('0x49')]);})[_0x57cc5f('0x84')](function(){const _0xbbcb18=_0x57cc5f;return db['ChatWebsite'][_0xbbcb18('0x5b')](_0x5382a3);})[_0x57cc5f('0x84')](handleEntityNotFound(_0x286464,null))['then'](function(_0x3c98f8){const _0x484d03=_0x57cc5f;if(_0x3c98f8)return!_['isNil'](_0x3c98f8[_0x484d03('0xf4')])&&(fs[_0x484d03('0x8c')](path[_0x484d03('0xa2')](config['root'],_0x484d03('0x8f'),_0x3c98f8['sitepic']))&&_0x5174cc&&(_0x10d233=path[_0x484d03('0xa2')](config[_0x484d03('0x3c')],'server/files/images/logos/',_0x3c98f8[_0x484d03('0xf4')]))),_0x286464[_0x484d03('0x7c')](_0x10d233);})[_0x57cc5f('0xf0')](handleError(_0x286464,null));},exports[_0x338c3c('0x64')]=function(_0xae031e,_0x4c01f4){const _0x53241e=_0x338c3c;let _0x5c2f67=path[_0x53241e('0xa2')](config[_0x53241e('0x3c')],_0x53241e('0x61'));const _0x46a69f={'where':{'id':_0xae031e[_0x53241e('0xbb')]['id']},'attributes':['id',_0x53241e('0x24')],'raw':!![]};return db[_0x53241e('0x62')][_0x53241e('0x5b')](_0x46a69f)[_0x53241e('0x84')](handleEntityNotFound(_0x4c01f4,null))[_0x53241e('0x84')](function(_0x429056){const _0x3e877c=_0x53241e;if(_0x429056)return!_[_0x3e877c('0x6')](_0x429056[_0x3e877c('0x24')])&&(fs['existsSync'](path[_0x3e877c('0xa2')](config[_0x3e877c('0x3c')],_0x3e877c('0xca'),_0x429056['agentAvatar']))&&(_0x5c2f67=path[_0x3e877c('0xa2')](config['root'],_0x3e877c('0xca'),_0x429056[_0x3e877c('0x24')]))),_0x4c01f4[_0x3e877c('0x7c')](_0x5c2f67);})[_0x53241e('0xf0')](handleError(_0x4c01f4,null));},exports[_0x338c3c('0x9')]=function(_0x412d82,_0x3cce49){const _0x4e80af=_0x338c3c;let _0x3b2526=path[_0x4e80af('0xa2')](config[_0x4e80af('0x3c')],'server/files/images/avatars/customer_avatar.png');const _0x4ab842={'where':{'id':_0x412d82[_0x4e80af('0xbb')]['id']},'attributes':['id',_0x4e80af('0xb'),_0x4e80af('0x11')],'raw':!![]};return db['ChatWebsite'][_0x4e80af('0x5b')](_0x4ab842)['then'](handleEntityNotFound(_0x3cce49,null))['then'](function(_0x2b2e08){const _0xac6517=_0x4e80af;if(_0x2b2e08)return!_[_0xac6517('0x6')](_0x2b2e08['customerAvatar'])&&(fs['existsSync'](path[_0xac6517('0xa2')](config[_0xac6517('0x3c')],_0xac6517('0xca'),_0x2b2e08[_0xac6517('0xb')]))&&_0x2b2e08[_0xac6517('0x11')]&&(_0x3b2526=path['join'](config[_0xac6517('0x3c')],'server/files/images/avatars/',_0x2b2e08[_0xac6517('0xb')]))),_0x3cce49['download'](_0x3b2526);})[_0x4e80af('0xf0')](handleError(_0x3cce49,null));},exports['getSystemAvatar']=function(_0x1851e7,_0x4d423c){const _0xe52d15=_0x338c3c;let _0x2d0f4f=path[_0xe52d15('0xa2')](config['root'],_0xe52d15('0x34'));const _0x479973={'where':{'id':_0x1851e7[_0xe52d15('0xbb')]['id']},'attributes':['id',_0xe52d15('0xaf')],'raw':!![]};return db[_0xe52d15('0x62')][_0xe52d15('0x5b')](_0x479973)[_0xe52d15('0x84')](handleEntityNotFound(_0x4d423c,null))['then'](function(_0x57c71d){const _0x1f2101=_0xe52d15;if(_0x57c71d)return!_[_0x1f2101('0x6')](_0x57c71d['systemAvatar'])&&(fs[_0x1f2101('0x8c')](path[_0x1f2101('0xa2')](config['root'],'server/files/images/avatars/',_0x57c71d[_0x1f2101('0xaf')]))&&(_0x2d0f4f=path['join'](config[_0x1f2101('0x3c')],_0x1f2101('0xca'),_0x57c71d[_0x1f2101('0xaf')]))),_0x4d423c[_0x1f2101('0x7c')](_0x2d0f4f);})[_0xe52d15('0xf0')](handleError(_0x4d423c,null));},exports['notify']=function(_0xdb6cf3,_0x5cca5c){const _0x208b39=_0x338c3c,_0x3c1ec1=require(_0x208b39('0x5d')),_0x1bb431=new _0x3c1ec1(),_0x27d019=_0x1bb431[_0x208b39('0xfe')](_0xdb6cf3[_0x208b39('0x15')]['user-agent'])[_0x208b39('0xec')](),_0x371282={'body':_0xdb6cf3[_0x208b39('0xe0')],'channel':_0x208b39('0x77')};let _0x2f7dbf=[],_0x49ff53=[];const _0x24dcf8={};let _0x414c43=![];return db[_0x208b39('0x96')][_0x208b39('0xfa')]()[_0x208b39('0x84')](function(_0x41688b){const _0x350274=_0x208b39;if(!_0x41688b)throw new ValidationError(_0x350274('0x3e'));_0x2f7dbf=_['difference'](_[_0x350274('0x6f')](_0x41688b),[_0x350274('0x75'),'updatedAt']),_0x49ff53=_[_0x350274('0x100')](_['keys'](_0x41688b),[_0x350274('0x75'),_0x350274('0x85'),_0x350274('0x4f'),_0x350274('0x13')]);_0xdb6cf3[_0x350274('0xe0')]['id']&&delete _0xdb6cf3[_0x350274('0xe0')]['id'];if(_[_0x350274('0x6')](_0xdb6cf3[_0x350274('0xe0')][_0x350274('0x8e')]))throw new ValidationError('from\x20is\x20mandatory');if(_['isNil'](_0xdb6cf3[_0x350274('0xe0')][_0x350274('0xe0')])||_0xdb6cf3['body'][_0x350274('0xe0')]==='')throw new ValidationError(_0x350274('0xb3'));if(_[_0x350274('0x6')](_0xdb6cf3[_0x350274('0xe0')]['mapKey']))throw new ValidationError(_0x350274('0xe1')+_0x49ff53);if(!_[_0x350274('0x1')](_0x49ff53,_0xdb6cf3[_0x350274('0xe0')][_0x350274('0xf1')]))throw new ValidationError(_0x350274('0x2e')+_0x49ff53);_0x24dcf8[_0xdb6cf3[_0x350274('0xe0')]['mapKey']]=_0xdb6cf3[_0x350274('0xe0')][_0x350274('0x8e')];})[_0x208b39('0x84')](function(){const _0xd83082=_0x208b39;return db[_0xd83082('0x62')][_0xd83082('0x5b')]({'where':{'id':_0xdb6cf3[_0xd83082('0xbb')]['id']},'include':[{'model':db[_0xd83082('0x5')],'as':_0xd83082('0x1c'),'include':[{'model':db[_0xd83082('0x96')],'as':_0xd83082('0x20'),'where':_0x24dcf8,'limit':0x1,'order':[[_0xd83082('0x85'),_0xd83082('0x86')]]}]},{'model':db[_0xd83082('0xf2')],'as':_0xd83082('0xf9')}]});})[_0x208b39('0x84')](handleEntityNotFound(_0x5cca5c,null))['then'](function(_0x5ea847){const _0x1be62b=_0x208b39;if(_0x5ea847&&_0x5ea847[_0x1be62b('0x1c')]){_0x371282[_0x1be62b('0x30')]=_0x5ea847,_0x371282[_0x1be62b('0x9c')]=_0x5ea847['Applications'],_0x371282['list']=_0x5ea847[_0x1be62b('0x1c')],_0x371282[_0x1be62b('0x9c')]=_[_0x1be62b('0x41')](_0x371282['applications'],[_0x1be62b('0x32')],[_0x1be62b('0xe6')]);_0x371282[_0x1be62b('0x30')][_0x1be62b('0xf9')]&&delete _0x371282[_0x1be62b('0x30')][_0x1be62b('0xf9')];if(_0x371282[_0x1be62b('0x30')]['List']&&_0x371282[_0x1be62b('0x30')][_0x1be62b('0x1c')]['Contacts'][_0x1be62b('0xc6')])return _0x371282[_0x1be62b('0x30')]['List'][_0x1be62b('0x20')][0x0];const _0x24fd20=_['defaults'](_0xdb6cf3[_0x1be62b('0xe0')],{'firstName':_0xdb6cf3['body'][_0x1be62b('0x8e')],'ListId':_0x5ea847[_0x1be62b('0x13')]});return _0x24fd20[_0xdb6cf3[_0x1be62b('0xe0')][_0x1be62b('0xf1')]]=_0xdb6cf3[_0x1be62b('0xe0')]['from'],db[_0x1be62b('0x96')]['create'](_0x24fd20,{'fields':_0x2f7dbf,'raw':!![]});}})[_0x208b39('0x84')](handleEntityNotFound(_0x5cca5c,null))['then'](function(_0x50134a){const _0x2fd9cc=_0x208b39;_0x371282[_0x2fd9cc('0x31')]=_0x50134a;let _0x4e1b98=_0xdb6cf3[_0x2fd9cc('0xe0')][_0x2fd9cc('0x29')];if(_0xdb6cf3[_0x2fd9cc('0x15')][_0x2fd9cc('0xd2')])_0x4e1b98=_0xdb6cf3[_0x2fd9cc('0x15')]['cf-connecting-ip'];else _0xdb6cf3[_0x2fd9cc('0x15')]['x-forwarded-for']&&(_0x4e1b98=_[_0x2fd9cc('0xef')](_0xdb6cf3[_0x2fd9cc('0x15')][_0x2fd9cc('0x7d')][_0x2fd9cc('0x102')](',')));if(_0x50134a){const _0x560d51={'ContactId':_0x50134a['id'],'ChatWebsiteId':_0xdb6cf3[_0x2fd9cc('0xbb')]['id'],'from':(_0x50134a['firstName']||'')+'\x20'+(_0x50134a[_0x2fd9cc('0x98')]||''),'customerIp':_0x4e1b98,'customerPort':_0xdb6cf3[_0x2fd9cc('0x15')]['x-real-port']?_0xdb6cf3[_0x2fd9cc('0x15')]['x-real-port']:null,'referer':_0xdb6cf3[_0x2fd9cc('0xe0')][_0x2fd9cc('0x4a')],'browserName':_0x27d019[_0x2fd9cc('0x8a')]['name']&&_0x27d019[_0x2fd9cc('0x8a')]['version']?util[_0x2fd9cc('0xdc')](_0x2fd9cc('0x57'),_0x27d019[_0x2fd9cc('0x8a')][_0x2fd9cc('0xd0')],_0x27d019[_0x2fd9cc('0x8a')][_0x2fd9cc('0x89')]):_0x2fd9cc('0xd9'),'browserVersion':_0x27d019[_0x2fd9cc('0x8a')]['version']||_0x2fd9cc('0xd9'),'osName':util[_0x2fd9cc('0xdc')](_0x2fd9cc('0x57'),_0x27d019['os']['name'],_0x27d019['os']['version']),'osVersion':_0x27d019['os'][_0x2fd9cc('0x89')],'deviceModel':_0x27d019[_0x2fd9cc('0x4')][_0x2fd9cc('0x79')]&&_0x27d019['device'][_0x2fd9cc('0x37')]?util[_0x2fd9cc('0xdc')](_0x2fd9cc('0x38'),_0x27d019[_0x2fd9cc('0x4')][_0x2fd9cc('0x79')],_0x27d019['device']['vendor'],_0x27d019[_0x2fd9cc('0x4')]['type']):null,'deviceVendor':_0x27d019['device']['vendor'],'deviceType':_0x27d019['device'][_0x2fd9cc('0x55')],'formData':JSON[_0x2fd9cc('0xb6')](_0xdb6cf3[_0x2fd9cc('0xe0')])},_0x5f4bd0={'ChatWebsiteId':_0xdb6cf3['params']['id'],'closed':![]};if(_0xdb6cf3[_0x2fd9cc('0xe0')][_0x2fd9cc('0x6c')])return _0x5f4bd0['threadId']=_0xdb6cf3[_0x2fd9cc('0xe0')][_0x2fd9cc('0x6c')],db['ChatInteraction'][_0x2fd9cc('0x5b')]({'where':_0x5f4bd0})['then'](function(_0x383ffb){const _0x3fd5c0=_0x2fd9cc;if(_0x383ffb)return[_0x383ffb,![]];return _0x560d51['threadId']=_0xdb6cf3[_0x3fd5c0('0xe0')][_0x3fd5c0('0x6c')],_0x560d51[_0x3fd5c0('0xb4')]=_0xdb6cf3[_0x3fd5c0('0xe0')][_0x3fd5c0('0xb4')],db[_0x3fd5c0('0x18')]['create'](_0x560d51)[_0x3fd5c0('0x84')](function(_0x50071e){return[_0x50071e,!![]];});});_0x5f4bd0[_0x2fd9cc('0xbf')]=_0x50134a['id'];if(_0xdb6cf3[_0x2fd9cc('0xe0')][_0x2fd9cc('0x101')]&&_0xdb6cf3['body'][_0x2fd9cc('0x101')]['id'])return _0x5f4bd0['id']=_0xdb6cf3['body'][_0x2fd9cc('0x101')]['id'],db[_0x2fd9cc('0x18')]['findOne']({'where':_0x5f4bd0})[_0x2fd9cc('0x84')](function(_0x2663e2){const _0x5cc1b0=_0x2fd9cc;if(_0x2663e2)return[_0x2663e2,![]];return db['ChatInteraction'][_0x5cc1b0('0xea')](_0x560d51)[_0x5cc1b0('0x84')](function(_0x1ed5a3){return[_0x1ed5a3,!![]];});});return db['ChatInteraction'][_0x2fd9cc('0xea')](_0x560d51)[_0x2fd9cc('0x84')](function(_0x17f057){return[_0x17f057,!![]];});}})[_0x208b39('0x84')](function([_0x5863da,_0xd54233]){const _0x585469=_0x208b39;if(_0x5863da){_0x414c43=_0xd54233;if(!_0xd54233){const _0x475f84={'from':(_0x371282['contact']['firstName']||'')+'\x20'+(_0x371282[_0x585469('0x31')][_0x585469('0x98')]||'')};return _0xdb6cf3[_0x585469('0xe0')][_0x585469('0x6c')]&&_0xdb6cf3['body'][_0x585469('0xfd')]&&_0xdb6cf3['body'][_0x585469('0x6c')]!=_0xdb6cf3[_0x585469('0xe0')][_0x585469('0xfd')]&&(_0x475f84[_0x585469('0x6c')]=_0xdb6cf3['body'][_0x585469('0xfd')]),_0x5863da['update'](_0x475f84);}else return _0x5863da;}})['then'](function(_0xe7d38c){const _0x5a2d1b=_0x208b39;return _0x371282[_0x5a2d1b('0x101')]=_0xe7d38c[_0x5a2d1b('0x99')]({'plain':!![]}),_0x371282['interaction'][_0x5a2d1b('0x9d')]=_0x414c43,_0x371282[_0x5a2d1b('0x101')][_0x5a2d1b('0x9d')]&&(_0x371282[_0x5a2d1b('0x30')][_0x5a2d1b('0x97')]&&_0x371282[_0x5a2d1b('0x9c')][_0x5a2d1b('0x72')]({'id':0x0,'priority':_0x371282[_0x5a2d1b('0x9c')][_0x5a2d1b('0xc6')]+0x1,'app':_0x5a2d1b('0xce'),'appdata':'unmanaged','interval':_0x5a2d1b('0x22')})),db[_0x5a2d1b('0xfc')][_0x5a2d1b('0xea')]({'body':_0xdb6cf3[_0x5a2d1b('0xe0')][_0x5a2d1b('0xe0')],'ChatWebsiteId':_0xdb6cf3['params']['id'],'ChatInteractionId':_0xe7d38c['id'],'direction':'in','ContactId':_0x371282[_0x5a2d1b('0x31')]['id'],'AttachmentId':_0xdb6cf3[_0x5a2d1b('0xe0')]['AttachmentId']});})[_0x208b39('0x84')](function(_0x5d7776){const _0x23de61=_0x208b39;_0x371282[_0x23de61('0x9f')]=_0x5d7776;if(_0x371282['interaction']['UserId'])return db[_0x23de61('0xdb')][_0x23de61('0x5b')]({'attributes':['id',_0x23de61('0xd0')],'where':{'id':_0x371282['interaction'][_0x23de61('0x59')]}})[_0x23de61('0x84')](function(_0x5abacd){const _0x58155e=_0x23de61;return _0x5abacd&&(_0x371282['applications'][_0x58155e('0xae')]({'id':0x0,'priority':0x0,'app':_0x58155e('0x87'),'appdata':_0x5abacd[_0x58155e('0xd0')]+','+(_0x371282[_0x58155e('0x30')]['waitForTheAssignedAgent']||0xa),'interval':_0x58155e('0x22')}),_0x371282[_0x58155e('0xab')]=!![]),respondWithRpcPromise(_0x58155e('0x1e'),_0x58155e('0x78'),_0x371282);});return respondWithRpcPromise('Start',_0x23de61('0x78'),_0x371282);})[_0x208b39('0x84')](function(_0x4d1c38){const _0x14731a=_0x208b39;return respondWithRpcPromise('EventManager','EventManager',{'event':_0x14731a('0xff'),'message':_0x4d1c38},client9002),_0x4d1c38;})[_0x208b39('0x84')](respondWithResult(_0x5cca5c,null))[_0x208b39('0xf0')](handleError(_0x5cca5c,null));},exports['offline']=function(_0xe12761,_0x4cda5c){const _0x5e4bc8=_0x338c3c;let _0x3d7675,_0xd4e544,_0xf97b27=[];const _0x22db36={};return db['CmContact'][_0x5e4bc8('0xfa')]()['then'](function(_0x330f48){const _0x3360d2=_0x5e4bc8;if(!_0x330f48)throw new ValidationError(_0x3360d2('0x3e'));_0xf97b27=_[_0x3360d2('0x100')](_[_0x3360d2('0x6f')](_0x330f48),[_0x3360d2('0x75'),_0x3360d2('0x85'),'CompanyId',_0x3360d2('0x13')]);_0xe12761[_0x3360d2('0xe0')]['id']&&delete _0xe12761['body']['id'];if(_['isNil'](_0xe12761[_0x3360d2('0xe0')][_0x3360d2('0x8e')]))throw _0x4cda5c[_0x3360d2('0x67')](0x1f4)[_0x3360d2('0x2b')](new ValidationError(_0x3360d2('0x8')));if(_['isNil'](_0xe12761[_0x3360d2('0xe0')][_0x3360d2('0xe0')])||_0xe12761[_0x3360d2('0xe0')]['body']==='')throw _0x4cda5c[_0x3360d2('0x67')](0x1f4)[_0x3360d2('0x2b')](new ValidationError(_0x3360d2('0xb3')));if(_[_0x3360d2('0x6')](_0xe12761['body'][_0x3360d2('0x7f')]))throw _0x4cda5c[_0x3360d2('0x67')](0x1f4)[_0x3360d2('0x2b')](new ValidationError(_0x3360d2('0xe')+_0xf97b27));if(!_['includes'](_0xf97b27,_0xe12761['body'][_0x3360d2('0x7f')]))throw _0x4cda5c[_0x3360d2('0x67')](0x1f4)['send'](new ValidationError('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf97b27));_0x22db36[_0xe12761['body'][_0x3360d2('0x7f')]]=_0xe12761[_0x3360d2('0xe0')]['from'];})[_0x5e4bc8('0x84')](function(){const _0x1b6588=_0x5e4bc8;return db[_0x1b6588('0x62')][_0x1b6588('0x5b')]({'where':{'id':_0xe12761[_0x1b6588('0xbb')]['id']},'include':[{'model':db[_0x1b6588('0x5')],'as':_0x1b6588('0x1c')}]});})[_0x5e4bc8('0x84')](handleEntityNotFound(_0x4cda5c,null))[_0x5e4bc8('0x84')](function(_0x450822){const _0xe6e5f7=_0x5e4bc8;if(_0x450822&&_0x450822[_0xe6e5f7('0x1c')]){_0xd4e544=_0x450822;const _0x1c7b75=_[_0xe6e5f7('0xdd')](_0xe12761['body'],{'firstName':_0xe12761[_0xe6e5f7('0xe0')]['from'],'phone':_0xe12761[_0xe6e5f7('0xe0')][_0xe6e5f7('0x8e')],'ListId':_0x450822[_0xe6e5f7('0x13')]});return _0x1c7b75[_0xe12761[_0xe6e5f7('0xe0')][_0xe6e5f7('0x7f')]]=_0xe12761[_0xe6e5f7('0xe0')][_0xe6e5f7('0x8e')],db[_0xe6e5f7('0x96')]['findOrCreate']({'where':_0x22db36,'defaults':_0x1c7b75});}})[_0x5e4bc8('0x84')](function([_0x11186c]){const _0x9bfc52=_0x5e4bc8;if(_0x11186c){const _0xc8412f=fs[_0x9bfc52('0x68')](path[_0x9bfc52('0xa2')](config[_0x9bfc52('0x3c')],_0x9bfc52('0x95')),'utf8'),_0x4a2c3b=ejs[_0x9bfc52('0xba')](_0xc8412f,{'body':_[_0x9bfc52('0x44')](_0xe12761['body'][_0x9bfc52('0xe0')]),'bodyTitle':_0xd4e544[_0x9bfc52('0xaa')]});return db['ChatOfflineMessage'][_0x9bfc52('0xea')]({'body':_0x4a2c3b,'ContactId':_0x11186c['id'],'ChatWebsiteId':_0xd4e544['id']});}})[_0x5e4bc8('0x84')](function(_0x1c9a5a){const _0x201f5a=_0x5e4bc8;if(_0x1c9a5a)return _0x3d7675=_0x1c9a5a,db[_0x201f5a('0x3')][_0x201f5a('0x5b')]({'where':{'service':!![]},'include':[{'model':db[_0x201f5a('0x1d')],'as':_0x201f5a('0xa8'),'raw':!![]}]});})[_0x5e4bc8('0x84')](function(_0x1e938c){const _0x310212=_0x5e4bc8;if(_0x1e938c&&_0x1e938c[_0x310212('0xa8')]&&_0xd4e544[_0x310212('0xb8')]){const _0x5ccb0b={'tls':{'rejectUnauthorized':![]}};return _0x1e938c[_0x310212('0xa8')][_0x310212('0x26')]?_0x5ccb0b[_0x310212('0x26')]=_0x1e938c[_0x310212('0xa8')][_0x310212('0x26')]:(_0x5ccb0b[_0x310212('0x33')]=_0x1e938c[_0x310212('0xa8')][_0x310212('0x33')],_0x5ccb0b[_0x310212('0xac')]=_0x1e938c['Smtp']['port'],_0x5ccb0b['secure']=_0x1e938c[_0x310212('0xa8')][_0x310212('0x92')]),_0x1e938c[_0x310212('0xa8')][_0x310212('0x51')]&&(_0x5ccb0b[_0x310212('0xfb')]={'user':_0x1e938c[_0x310212('0xa8')][_0x310212('0x81')],'pass':_0x1e938c['Smtp'][_0x310212('0xbc')]}),respondWithRpcPromise(_0x310212('0x25'),_0x310212('0x7b'),{'account':_0x5ccb0b,'message':{'from':util[_0x310212('0xdc')]('\x22%s\x22\x20<%s>',_0x1e938c[_0x310212('0xd0')],_0x1e938c[_0x310212('0x74')]||_0x1e938c['Smtp']['user']),'to':_0xd4e544[_0x310212('0xb8')],'subject':_0xd4e544['offlineMessageSubject'],'text':_0x3d7675[_0x310212('0xe0')]}},client9003)[_0x310212('0x84')](function(){return _0x3d7675;})[_0x310212('0xf0')](function(_0x4be339){const _0x12bb2b=_0x310212;console[_0x12bb2b('0x65')](_0x4be339);});}})['then'](function(){if(_0x3d7675)return _0x3d7675;})[_0x5e4bc8('0x84')](respondWithResult(_0x4cda5c,null))['catch'](handleError(_0x4cda5c,null));},exports[_0x338c3c('0x10')]=function(_0xe783f7,_0x44db67){const _0x4ad258=_0x338c3c;return db[_0x4ad258('0x18')][_0x4ad258('0x5b')]({'where':{'id':_0xe783f7['params']['id']}})[_0x4ad258('0x84')](function(_0x451626){const _0xad703c=_0x4ad258;if(_0x451626)return _0x451626[_0xad703c('0x10')](_0xe783f7[_0xad703c('0xe0')][_0xad703c('0xd6')],{'through':_[_0xad703c('0x5e')](_0xe783f7['body'],['ids','id'])});})[_0x4ad258('0x84')](respondWithResult(_0x44db67,null))[_0x4ad258('0xf0')](handleError(_0x44db67,null));},exports[_0x338c3c('0x17')]=function(_0x211e94,_0x8b1666){const _0x2c5756=_0x338c3c;let _0x42f40b={'raw':![],'where':{}};const _0x98d526={},_0xa053cb={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2c5756('0x5b')]({'where':{'id':_0x211e94['params']['id']}})[_0x2c5756('0x84')](handleEntityNotFound(_0x8b1666,null))['then'](function(_0x400f35){const _0x49f456=_0x2c5756;if(_0x400f35)return _0x98d526['model']=_[_0x49f456('0x6f')](db['ChatInteraction']['rawAttributes']),_0x98d526[_0x49f456('0xd3')]=_[_0x49f456('0x6f')](_0x211e94[_0x49f456('0xd3')]),_0x98d526['filters']=_[_0x49f456('0xe8')](_0x98d526['model'],_0x98d526[_0x49f456('0xd3')]),_0x42f40b[_0x49f456('0x70')]=_[_0x49f456('0xe8')](_0x98d526['model'],qs[_0x49f456('0xe7')](_0x211e94[_0x49f456('0xd3')]['fields'])),_0x42f40b[_0x49f456('0x70')]=_0x42f40b[_0x49f456('0x70')][_0x49f456('0xc6')]?_0x42f40b[_0x49f456('0x70')]:_0x98d526[_0x49f456('0x79')],typeof _0x211e94[_0x49f456('0xd3')][_0x49f456('0x14')]===_0x49f456('0xe4')&&(_0x42f40b[_0x49f456('0x88')]=qs[_0x49f456('0x88')](_0x211e94[_0x49f456('0xd3')][_0x49f456('0x88')]),_0x42f40b[_0x49f456('0x23')]=qs['offset'](_0x211e94[_0x49f456('0xd3')][_0x49f456('0x23')])),_0x42f40b['order']=qs['sort'](_0x211e94[_0x49f456('0xd3')][_0x49f456('0x1b')]),_0x42f40b[_0x49f456('0xb2')]=qs[_0x49f456('0xdf')](_[_0x49f456('0x82')](_0x211e94[_0x49f456('0xd3')],_0x98d526[_0x49f456('0xdf')])),_0x42f40b[_0x49f456('0xb2')][_0x49f456('0xd5')]=_0x400f35['id'],_0x211e94[_0x49f456('0xd3')][_0x49f456('0xbd')]&&(_0x42f40b[_0x49f456('0xb2')]=_[_0x49f456('0x58')](_0x42f40b[_0x49f456('0xb2')],{[Op['or']]:_['map'](_0x42f40b[_0x49f456('0x70')],function(_0xc21447){const _0x1e8052=_0x49f456,_0x82cbc6={};return _0x82cbc6[_0xc21447]={[Op['like']]:'%'+_0x211e94[_0x1e8052('0xd3')][_0x1e8052('0xbd')]+'%'},_0x82cbc6;})})),_0x42f40b=_[_0x49f456('0x58')]({},_0x42f40b,_0x211e94[_0x49f456('0x6d')]),db[_0x49f456('0x18')]['count']({'where':_0x42f40b[_0x49f456('0xb2')]})[_0x49f456('0x84')](function(_0x3cabab){const _0x194c3a=_0x49f456;return _0xa053cb[_0x194c3a('0xc')]=_0x3cabab,_0x211e94[_0x194c3a('0xd3')][_0x194c3a('0x2')]&&(_0x42f40b[_0x194c3a('0x2d')]=[{'model':db[_0x194c3a('0x96')],'as':_0x194c3a('0x4d'),'required':![]},{'model':db[_0x194c3a('0xdb')],'as':_0x194c3a('0xee'),'attributes':[_0x194c3a('0xd0'),'fullname',_0x194c3a('0xcb')],'required':![]},{'model':db['Tag'],'as':_0x194c3a('0x1f'),'attributes':['id',_0x194c3a('0xd0'),_0x194c3a('0xd7')],'where':_0x211e94[_0x194c3a('0xd3')][_0x194c3a('0x5c')]?{'id':_0x211e94[_0x194c3a('0xd3')][_0x194c3a('0x5c')]}:undefined,'required':_0x211e94['query'][_0x194c3a('0x5c')]?!![]:![]}]),db[_0x194c3a('0x18')][_0x194c3a('0x12')](_0x42f40b);})[_0x49f456('0x84')](function(_0x2fe19f){const _0x1c114a=_0x49f456;return _0xa053cb[_0x1c114a('0xf')]=_0x2fe19f,_0xa053cb;});})['then'](respondWithFilteredResult(_0x8b1666,_0x42f40b))['catch'](handleError(_0x8b1666,null));};function iftimePromise(_0x51b9a0,_0x18da7b){const _0xf88c43=_0x338c3c;return respondWithRpcPromise(_0xf88c43('0x0'),_0xf88c43('0xc1'),{'command':_0x18da7b[_0xf88c43('0xf7')]?util[_0xf88c43('0xdc')](_0xf88c43('0xb5'),_0x51b9a0[_0xf88c43('0x52')],_0x18da7b[_0xf88c43('0xf7')]):util['format']('iftime\x20%s',_0x51b9a0['interval'])},client9002)[_0xf88c43('0x84')](function(_0x55fd6d){const _0x1a3b72=_0xf88c43,_0x143a71=_0x55fd6d&&_0x55fd6d[_0x1a3b72('0xe3')](_0x1a3b72('0x3d'))>=0x0?!![]:![];return logger[_0x1a3b72('0x76')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x18da7b['id'],_0x51b9a0['id'],_0x51b9a0[_0x1a3b72('0x52')],_0x143a71?_0x1a3b72('0x6a'):'OFFLINE',_0x18da7b[_0x1a3b72('0xf7')]?_0x18da7b['timezone']:_0x1a3b72('0xcc')),_0x143a71;})[_0xf88c43('0xf0')](function(_0x3b8c44){const _0x49ff57=_0xf88c43;return logger[_0x49ff57('0x65')](_0x49ff57('0xd1'),_0x18da7b['id'],_0x51b9a0['id'],_0x51b9a0[_0x49ff57('0x52')],util[_0x49ff57('0xe2')](_0x3b8c44,{'showHidden':![],'depth':null}),_0x18da7b[_0x49ff57('0xf7')]?_0x18da7b[_0x49ff57('0xf7')]:'No\x20timezone'),![];});}exports['getSnippet']=function(_0x27f9b8,_0x437356){const _0x3f482d=_0x338c3c;let _0x5dece0=0x0,_0x34e4f3=0x0,_0x24938d=![],_0x18497d,_0x533815;return db[_0x3f482d('0x62')][_0x3f482d('0x5b')]({'where':{'id':_0x27f9b8[_0x3f482d('0xbb')]['id']},'include':[{'model':db[_0x3f482d('0x53')],'as':_0x3f482d('0x53'),'include':[{'model':db[_0x3f482d('0x53')],'as':_0x3f482d('0xa6'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x3f482d('0x84')](handleEntityNotFound(_0x437356,null))[_0x3f482d('0x84')](function(_0x20859d){if(_0x20859d)return _0x18497d=_0x20859d,_0x20859d['getProactiveActions']({'raw':!![]});})[_0x3f482d('0x84')](function(_0x2eb5cc){const _0x56bad4=_0x3f482d;return _0x18497d&&(_0x2eb5cc&&(_0x533815=_0x2eb5cc)),require(_0x56bad4('0x3a'))[_0x56bad4('0xde')]();})[_0x3f482d('0x84')](function(_0x18100f){const _0x43c1f1=_0x3f482d;_0x18100f&&(_0x34e4f3=_0x18100f[_0x43c1f1('0x39')],_0x24938d=_0x18100f['custom']);})[_0x3f482d('0x84')](function(){const _0x16be4a=_0x3f482d;return db[_0x16be4a('0x18')][_0x16be4a('0xc')]({'where':{'closed':![]}});})[_0x3f482d('0x84')](function(_0x23e12c){const _0x38761e=_0x3f482d;_0x5dece0=_0x23e12c;if(_0x34e4f3&&_0x23e12c>_0x34e4f3)return db['License'][_0x38761e('0x5b')]({'where':{'id':0x1}})['then'](function(_0xd8bd5e){const _0x1e784e=_0x38761e;_0xd8bd5e&&_0xd8bd5e[_0x1e784e('0x21')](_0x1e784e('0x93'));});})['then'](function(){const _0x36401c=_0x3f482d;if(_0x18497d['Interval']&&_0x18497d[_0x36401c('0x53')]['Intervals']){const _0x1f8640=[];for(let _0x51aed3=0x0;_0x51aed3<_0x18497d['Interval'][_0x36401c('0xa6')][_0x36401c('0xc6')];_0x51aed3++){const _0x4940e5=_0x18497d[_0x36401c('0x53')][_0x36401c('0xa6')][_0x51aed3][_0x36401c('0x99')]({'plain':!![]});_0x1f8640[_0x36401c('0x72')](iftimePromise(_0x4940e5,_0x18497d));}return Promise[_0x36401c('0x69')](_0x1f8640)[_0x36401c('0x84')](function(_0x353bbf){const _0x337a60=_0x36401c;return _[_0x337a60('0xe5')](_0x353bbf);});}else return!![];})[_0x3f482d('0x84')](function(_0x4dd5f9){const _0x30ca2b=_0x3f482d,_0x17b5c0=_0x27f9b8[_0x30ca2b('0xa0')][_0x30ca2b('0x99')]('chatVersion'),_0x5b6f2c=fs[_0x30ca2b('0x68')](path[_0x30ca2b('0xa2')](config['root'],'files/chat/iframe.js'),_0x30ca2b('0xc4')),_0x14756e={'chatVersion':_0x17b5c0,'remote':_0x18497d[_0x30ca2b('0x36')],'query':querystring[_0x30ca2b('0xb6')](_[_0x30ca2b('0x58')](_0x18497d[_0x30ca2b('0x99')]({'plain':!![]}),{'customerIp':_0x27f9b8[_0x30ca2b('0x15')][_0x30ca2b('0x7d')]||_0x27f9b8[_0x30ca2b('0x15')][_0x30ca2b('0x35')]||_0x27f9b8[_0x30ca2b('0x56')][_0x30ca2b('0xf8')]||_0x27f9b8['ip'],'referer':_0x27f9b8['headers'][_0x30ca2b('0x4a')],'openedInteractions':_0x5dece0,'maxInteractions':_0x34e4f3,'virtual':_0x24938d['virtual'],'online':_0x4dd5f9,'custom':_0x24938d}))[_0x30ca2b('0x7')](/'/g,'\x5c\x27')};_0x437356[_0x30ca2b('0x2b')](ejs[_0x30ca2b('0xba')](Mustache[_0x30ca2b('0xba')](_0x5b6f2c,_0x14756e),{'proactiveActions':_0x533815,'alignment':_0x18497d['alignment'],'verticalAlignment':_0x18497d[_0x30ca2b('0x94')],'div_color':_0x18497d[_0x30ca2b('0xd7')],'text_color':_0x18497d['textColor']}));})[_0x3f482d('0xf0')](handleError(_0x437356,null));},exports[_0x338c3c('0x28')]=function(_0x1a35b0,_0x4f1123){const _0x1ac6ed=_0x338c3c;return db[_0x1ac6ed('0x62')][_0x1ac6ed('0x5b')]({'where':{'id':_0x1a35b0[_0x1ac6ed('0xbb')]['id']}})[_0x1ac6ed('0x84')](handleEntityNotFound(_0x4f1123,null))[_0x1ac6ed('0x84')](function(_0x1145c2){const _0x25502b=_0x1ac6ed;if(_0x1145c2)return db[_0x25502b('0x71')]['transaction'](function(_0x5f3711){const _0x2c083e=_0x25502b;return db[_0x2c083e('0xf2')][_0x2c083e('0x54')]({'where':{'ChatWebsiteId':_0x1a35b0['params']['id']},'transaction':_0x5f3711})['then'](function(){const _0x4f62c9=_0x2c083e,_0x1b9a35=_[_0x4f62c9('0xc9')](_0x1a35b0[_0x4f62c9('0xe0')],function(_0x8b3a03){return _0x8b3a03['ChatWebsiteId']=_0x1a35b0['params']['id'],_0x8b3a03;});return db[_0x4f62c9('0xf2')][_0x4f62c9('0x2c')](_0x1b9a35,{'transaction':_0x5f3711});});})[_0x25502b('0x84')](function(){const _0x188b34=_0x25502b;return db['ChatApplication'][_0x188b34('0xa3')]({'where':{'ChatWebsiteId':_0x1a35b0[_0x188b34('0xbb')]['id']},'order':_0x188b34('0x32')});});})['then'](respondWithResult(_0x4f1123,null))['catch'](handleError(_0x4f1123,null));},exports[_0x338c3c('0x8d')]=function(_0x3dc51f,_0x1ca581){const _0x262ca5=_0x338c3c;let _0x1d9012={};const _0x39f75c={};let _0x560aba,_0x204cc8;return db[_0x262ca5('0x62')][_0x262ca5('0x5b')]({'where':{'id':_0x3dc51f['params']['id']}})['then'](handleEntityNotFound(_0x1ca581,null))['then'](function(_0x23ba9c){const _0x42657=_0x262ca5;if(_0x23ba9c)return _0x560aba=_0x23ba9c,_0x39f75c[_0x42657('0x79')]=_[_0x42657('0x6f')](db[_0x42657('0xf2')][_0x42657('0x3b')]),_0x39f75c['query']=_['keys'](_0x3dc51f[_0x42657('0xd3')]),_0x39f75c[_0x42657('0xdf')]=_[_0x42657('0xe8')](_0x39f75c[_0x42657('0x79')],_0x39f75c[_0x42657('0xd3')]),_0x1d9012[_0x42657('0x70')]=_['intersection'](_0x39f75c[_0x42657('0x79')],qs[_0x42657('0xe7')](_0x3dc51f[_0x42657('0xd3')][_0x42657('0xe7')])),_0x1d9012['attributes']=_0x1d9012[_0x42657('0x70')][_0x42657('0xc6')]?_0x1d9012[_0x42657('0x70')]:_0x39f75c['model'],_0x1d9012[_0x42657('0xa')]=qs[_0x42657('0x1b')](_0x3dc51f[_0x42657('0xd3')][_0x42657('0x1b')]),_0x1d9012[_0x42657('0xb2')]=qs[_0x42657('0xdf')](_[_0x42657('0x82')](_0x3dc51f[_0x42657('0xd3')],_0x39f75c[_0x42657('0xdf')])),_0x3dc51f[_0x42657('0xd3')][_0x42657('0xbd')]&&(_0x1d9012[_0x42657('0xb2')]=_['merge'](_0x1d9012[_0x42657('0xb2')],{[Op['or']]:_['map'](_0x1d9012['attributes'],function(_0x18a238){const _0x477702=_0x42657,_0xee08c8={};return _0xee08c8[_0x18a238]={[Op[_0x477702('0xc8')]]:'%'+_0x3dc51f['query'][_0x477702('0xbd')]+'%'},_0xee08c8;})})),_0x1d9012=_[_0x42657('0x58')]({},_0x1d9012,_0x3dc51f['options']),_0x560aba[_0x42657('0x8d')](_0x1d9012);})[_0x262ca5('0x84')](function(_0x126feb){const _0x56ba8e=_0x262ca5;if(_0x126feb)return _0x204cc8=_0x126feb[_0x56ba8e('0xc6')],typeof _0x3dc51f[_0x56ba8e('0xd3')][_0x56ba8e('0x14')]===_0x56ba8e('0xe4')&&(_0x1d9012[_0x56ba8e('0x88')]=qs[_0x56ba8e('0x88')](_0x3dc51f[_0x56ba8e('0xd3')][_0x56ba8e('0x88')]),_0x1d9012['offset']=qs[_0x56ba8e('0x23')](_0x3dc51f[_0x56ba8e('0xd3')][_0x56ba8e('0x23')])),_0x560aba[_0x56ba8e('0x8d')](_0x1d9012);})[_0x262ca5('0x84')](function(_0x44a34a){if(_0x44a34a)return _0x44a34a?{'count':_0x204cc8,'rows':_0x44a34a}:null;})[_0x262ca5('0x84')](respondWithResult(_0x1ca581,null))[_0x262ca5('0xf0')](handleError(_0x1ca581,null));},exports[_0x338c3c('0xc5')]=function(_0x8caefc,_0x2d209c){const _0x2bab2d=_0x338c3c;return db['chatProactiveAction'][_0x2bab2d('0x5b')]({'where':{'id':_0x8caefc[_0x2bab2d('0xbb')]['id']}})[_0x2bab2d('0x84')](function(_0x5a11fe){const _0x262c45=_0x2bab2d;if(_0x5a11fe)return _0x5a11fe[_0x262c45('0xc5')](_0x8caefc[_0x262c45('0xe0')][_0x262c45('0xd6')],{'through':_[_0x262c45('0x5e')](_0x8caefc[_0x262c45('0xe0')],[_0x262c45('0xd6'),'id'])});})[_0x2bab2d('0x84')](respondWithResult(_0x2d209c,null))[_0x2bab2d('0xf0')](handleError(_0x2d209c,null));},exports[_0x338c3c('0xed')]=function(_0x3078a7,_0x2d0507){const _0x35931b=_0x338c3c;let _0x2fb715={};const _0x4e7024={};let _0x270ac6,_0x6eb05b;return db[_0x35931b('0x62')]['findOne']({'where':{'id':_0x3078a7[_0x35931b('0xbb')]['id']}})[_0x35931b('0x84')](handleEntityNotFound(_0x2d0507,null))[_0x35931b('0x84')](function(_0x4afc0b){const _0x485fe2=_0x35931b;if(_0x4afc0b)return _0x270ac6=_0x4afc0b,_0x4e7024[_0x485fe2('0x79')]=_[_0x485fe2('0x6f')](db['ChatProactiveAction']['rawAttributes']),_0x4e7024[_0x485fe2('0xd3')]=_[_0x485fe2('0x6f')](_0x3078a7[_0x485fe2('0xd3')]),_0x4e7024['filters']=_['intersection'](_0x4e7024[_0x485fe2('0x79')],_0x4e7024[_0x485fe2('0xd3')]),_0x2fb715[_0x485fe2('0x70')]=_[_0x485fe2('0xe8')](_0x4e7024[_0x485fe2('0x79')],qs[_0x485fe2('0xe7')](_0x3078a7['query'][_0x485fe2('0xe7')])),_0x2fb715[_0x485fe2('0x70')]=_0x2fb715[_0x485fe2('0x70')][_0x485fe2('0xc6')]?_0x2fb715[_0x485fe2('0x70')]:_0x4e7024[_0x485fe2('0x79')],_0x2fb715[_0x485fe2('0xa')]=qs[_0x485fe2('0x1b')](_0x3078a7[_0x485fe2('0xd3')][_0x485fe2('0x1b')]),_0x2fb715[_0x485fe2('0xb2')]=qs[_0x485fe2('0xdf')](_[_0x485fe2('0x82')](_0x3078a7['query'],_0x4e7024[_0x485fe2('0xdf')])),_0x3078a7[_0x485fe2('0xd3')][_0x485fe2('0xbd')]&&(_0x2fb715[_0x485fe2('0xb2')]=_[_0x485fe2('0x58')](_0x2fb715[_0x485fe2('0xb2')],{[Op['or']]:_[_0x485fe2('0xc9')](_0x2fb715[_0x485fe2('0x70')],function(_0x3bc1b0){const _0x47ce97=_0x485fe2,_0x681657={};return _0x681657[_0x3bc1b0]={[Op[_0x47ce97('0xc8')]]:'%'+_0x3078a7[_0x47ce97('0xd3')]['filter']+'%'},_0x681657;})})),_0x2fb715=_['merge']({},_0x2fb715,_0x3078a7['options']),_0x270ac6[_0x485fe2('0xed')](_0x2fb715);})[_0x35931b('0x84')](function(_0x3b2823){const _0x1571de=_0x35931b;if(_0x3b2823)return _0x6eb05b=_0x3b2823['length'],typeof _0x3078a7[_0x1571de('0xd3')][_0x1571de('0x14')]==='undefined'&&(_0x2fb715['limit']=qs[_0x1571de('0x88')](_0x3078a7[_0x1571de('0xd3')]['limit']),_0x2fb715[_0x1571de('0x23')]=qs[_0x1571de('0x23')](_0x3078a7[_0x1571de('0xd3')]['offset'])),_0x270ac6[_0x1571de('0xed')](_0x2fb715);})[_0x35931b('0x84')](function(_0x45dbac){if(_0x45dbac)return _0x45dbac?{'count':_0x6eb05b,'rows':_0x45dbac}:null;})['then'](respondWithResult(_0x2d0507,null))['catch'](handleError(_0x2d0507,null));},exports['getFields']=function(_0x3ecdb0,_0x4ca57f){const _0x33c5fd=_0x338c3c,_0x3e90fc=_0x3ecdb0[_0x33c5fd('0xd3')][_0x33c5fd('0xa5')]===_0x33c5fd('0x9b')?_0x33c5fd('0x46'):'onlineForm';return db[_0x33c5fd('0x62')][_0x33c5fd('0x5b')]({'attributes':['id',_0x3e90fc],'where':{'id':_0x3ecdb0[_0x33c5fd('0xbb')]['id']}})[_0x33c5fd('0x84')](handleEntityNotFound(_0x4ca57f,null))[_0x33c5fd('0x84')](function(_0x440503){const _0x246226=_0x33c5fd;if(_0x440503){const _0x1cbada=_0x440503[_0x3e90fc],_0x20a30b=_0x1cbada&&_0x1cbada[_0x246226('0x90')]?_0x1cbada[_0x246226('0x90')]:[];_0x4ca57f['send']({'fromKey':_[_0x246226('0x6')](_0x1cbada[_0x246226('0xda')])?undefined:_0x1cbada['fromKey'],'count':_0x20a30b['length'],'rows':_0x20a30b});}})[_0x33c5fd('0xf0')](handleError(_0x4ca57f,null));},exports['getOfflineMessages']=function(_0x531712,_0x5a3b65){const _0x514e10=_0x338c3c;let _0x497e83={'raw':![],'where':{}};const _0x43e34e={},_0x85a2b1={'count':0x0,'rows':[]};return db[_0x514e10('0x62')][_0x514e10('0x5b')]({'where':{'id':_0x531712[_0x514e10('0xbb')]['id']}})[_0x514e10('0x84')](handleEntityNotFound(_0x5a3b65,null))['then'](function(_0x1ce48f){const _0x1260d0=_0x514e10;if(_0x1ce48f)return _0x43e34e[_0x1260d0('0x79')]=_[_0x1260d0('0x6f')](db['ChatOfflineMessage'][_0x1260d0('0x3b')]),_0x43e34e['query']=_[_0x1260d0('0x6f')](_0x531712[_0x1260d0('0xd3')]),_0x43e34e['filters']=_[_0x1260d0('0xe8')](_0x43e34e['model'],_0x43e34e['query']),_0x497e83[_0x1260d0('0x70')]=_[_0x1260d0('0xe8')](_0x43e34e[_0x1260d0('0x79')],qs[_0x1260d0('0xe7')](_0x531712[_0x1260d0('0xd3')][_0x1260d0('0xe7')])),_0x497e83['attributes']=_0x497e83[_0x1260d0('0x70')][_0x1260d0('0xc6')]?_0x497e83[_0x1260d0('0x70')]:_0x43e34e[_0x1260d0('0x79')],typeof _0x531712[_0x1260d0('0xd3')][_0x1260d0('0x14')]==='undefined'&&(_0x497e83[_0x1260d0('0x88')]=qs['limit'](_0x531712[_0x1260d0('0xd3')][_0x1260d0('0x88')]),_0x497e83[_0x1260d0('0x23')]=qs[_0x1260d0('0x23')](_0x531712['query'][_0x1260d0('0x23')])),_0x497e83['order']=qs['sort'](_0x531712[_0x1260d0('0xd3')][_0x1260d0('0x1b')]),_0x497e83['where']=qs[_0x1260d0('0xdf')](_['pick'](_0x531712[_0x1260d0('0xd3')],_0x43e34e[_0x1260d0('0xdf')])),_0x497e83[_0x1260d0('0xb2')][_0x1260d0('0xd5')]=_0x1ce48f['id'],_0x531712['query'][_0x1260d0('0xbd')]&&(_0x497e83[_0x1260d0('0xb2')]=_[_0x1260d0('0x58')](_0x497e83['where'],{[Op['or']]:_[_0x1260d0('0xc9')](_0x497e83[_0x1260d0('0x70')],function(_0xce66e1){const _0x2a4449=_0x1260d0,_0x214a64={};return _0x214a64[_0xce66e1]={[Op[_0x2a4449('0xc8')]]:'%'+_0x531712['query'][_0x2a4449('0xbd')]+'%'},_0x214a64;})})),_0x497e83=_[_0x1260d0('0x58')]({},_0x497e83,_0x531712[_0x1260d0('0x6d')]),db[_0x1260d0('0x9e')][_0x1260d0('0xc')]({'where':_0x497e83[_0x1260d0('0xb2')]})[_0x1260d0('0x84')](function(_0x1f4625){const _0x481afc=_0x1260d0;return _0x85a2b1['count']=_0x1f4625,_0x531712[_0x481afc('0xd3')]['includeAll']?_0x497e83[_0x481afc('0x2d')]=[{'all':!![]}]:_0x497e83[_0x481afc('0x2d')]=[{'model':db[_0x481afc('0x96')],'as':_0x481afc('0x4d'),'required':![]}],db[_0x481afc('0x9e')]['findAll'](_0x497e83);})[_0x1260d0('0x84')](function(_0x469325){const _0x3719d4=_0x1260d0;return _0x85a2b1[_0x3719d4('0xf')]=_0x469325,_0x85a2b1;});})[_0x514e10('0x84')](respondWithFilteredResult(_0x5a3b65,_0x497e83))[_0x514e10('0xf0')](handleError(_0x5a3b65,null));},exports[_0x338c3c('0xb7')]=function(_0x304c75,_0x191bad){const _0xba44e9=_0x338c3c;return db[_0xba44e9('0x62')][_0xba44e9('0x5b')]({'where':{'id':_0x304c75['params']['id']}})[_0xba44e9('0x84')](function(_0x3e5e1d){const _0x14832f=_0xba44e9;if(_0x3e5e1d)return _0x3e5e1d[_0x14832f('0xb7')](_0x304c75[_0x14832f('0xe0')][_0x14832f('0xd6')],{'through':_[_0x14832f('0x5e')](_0x304c75[_0x14832f('0xe0')],[_0x14832f('0xd6'),'id'])})[_0x14832f('0x84')](function(_0x3a9f66){const _0x208590=_0x14832f;for(let _0x7ac99b=0x0;_0x7ac99b<_0x304c75['body'][_0x208590('0xd6')][_0x208590('0xc6')];_0x7ac99b+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x304c75[_0x208590('0xe0')][_0x208590('0xd6')][_0x7ac99b],'ChatWebsiteId':_0x304c75[_0x208590('0xbb')]['id']});}return _0x3a9f66;});})[_0xba44e9('0x84')](respondWithResult(_0x191bad,null))['catch'](handleError(_0x191bad,null));},exports[_0x338c3c('0xb1')]=function(_0x501ae,_0x189057){const _0x216ad4=_0x338c3c;return db[_0x216ad4('0x62')]['findOne']({'where':{'id':_0x501ae[_0x216ad4('0xbb')]['id']}})[_0x216ad4('0x84')](handleEntityNotFound(_0x189057,null))[_0x216ad4('0x84')](function(_0x18e884){const _0x437e91=_0x216ad4;if(_0x18e884)return _0x18e884[_0x437e91('0xb1')](_0x501ae[_0x437e91('0xd3')][_0x437e91('0xd6')])['then'](function(){const _0x3ad4fc=_0x437e91;if(_[_0x3ad4fc('0xf6')](_0x501ae[_0x3ad4fc('0xd3')][_0x3ad4fc('0xd6')]))for(let _0x554688=0x0;_0x554688<_0x501ae[_0x3ad4fc('0xd3')][_0x3ad4fc('0xd6')]['length'];_0x554688+=0x1){socket[_0x3ad4fc('0x48')](_0x3ad4fc('0xcf'),{'UserId':Number(_0x501ae[_0x3ad4fc('0xd3')][_0x3ad4fc('0xd6')][_0x554688]),'ChatWebsiteId':Number(_0x501ae[_0x3ad4fc('0xbb')]['id'])});}else socket[_0x3ad4fc('0x48')](_0x3ad4fc('0xcf'),{'UserId':Number(_0x501ae[_0x3ad4fc('0xd3')][_0x3ad4fc('0xd6')]),'ChatWebsiteId':Number(_0x501ae[_0x3ad4fc('0xbb')]['id'])});});})[_0x216ad4('0x84')](respondWithStatusCode(_0x189057,null))[_0x216ad4('0xf0')](handleError(_0x189057,null));},exports[_0x338c3c('0x43')]=function(_0x37118e,_0x55119d){const _0x4736d5=_0x338c3c;let _0x4f9613={};const _0x37e122={};let _0x5d30c0,_0x46623c;return db['ChatWebsite'][_0x4736d5('0x5b')]({'where':{'id':_0x37118e[_0x4736d5('0xbb')]['id']}})[_0x4736d5('0x84')](handleEntityNotFound(_0x55119d,null))[_0x4736d5('0x84')](function(_0x50a891){const _0x1aa032=_0x4736d5;if(_0x50a891)return _0x5d30c0=_0x50a891,_0x37e122[_0x1aa032('0x79')]=_[_0x1aa032('0x6f')](db[_0x1aa032('0xdb')][_0x1aa032('0x3b')]),_0x37e122['query']=_[_0x1aa032('0x6f')](_0x37118e[_0x1aa032('0xd3')]),_0x37e122[_0x1aa032('0xdf')]=_[_0x1aa032('0xe8')](_0x37e122[_0x1aa032('0x79')],_0x37e122[_0x1aa032('0xd3')]),_0x4f9613[_0x1aa032('0x70')]=_[_0x1aa032('0xe8')](_0x37e122['model'],qs[_0x1aa032('0xe7')](_0x37118e['query'][_0x1aa032('0xe7')])),_0x4f9613[_0x1aa032('0x70')]=_0x4f9613['attributes'][_0x1aa032('0xc6')]?_0x4f9613[_0x1aa032('0x70')]:_0x37e122[_0x1aa032('0x79')],_0x4f9613[_0x1aa032('0xa')]=qs[_0x1aa032('0x1b')](_0x37118e['query']['sort']),_0x4f9613['where']=qs[_0x1aa032('0xdf')](_['pick'](_0x37118e[_0x1aa032('0xd3')],_0x37e122[_0x1aa032('0xdf')])),_0x37118e[_0x1aa032('0xd3')][_0x1aa032('0xbd')]&&(_0x4f9613[_0x1aa032('0xb2')]=_[_0x1aa032('0x58')](_0x4f9613['where'],{[Op['or']]:_[_0x1aa032('0xc9')](_0x4f9613[_0x1aa032('0x70')],function(_0x274a85){const _0x825549=_0x1aa032,_0x17fa67={};return _0x17fa67[_0x274a85]={[Op[_0x825549('0xc8')]]:'%'+_0x37118e[_0x825549('0xd3')][_0x825549('0xbd')]+'%'},_0x17fa67;})})),_0x4f9613=_[_0x1aa032('0x58')]({},_0x4f9613,_0x37118e[_0x1aa032('0x6d')]),_0x5d30c0['getAgents'](_0x4f9613);})['then'](function(_0x6e1858){const _0x259b1d=_0x4736d5;if(_0x6e1858)return _0x46623c=_0x6e1858['length'],typeof _0x37118e['query'][_0x259b1d('0x14')]===_0x259b1d('0xe4')&&(_0x4f9613[_0x259b1d('0x88')]=qs[_0x259b1d('0x88')](_0x37118e[_0x259b1d('0xd3')][_0x259b1d('0x88')]),_0x4f9613[_0x259b1d('0x23')]=qs[_0x259b1d('0x23')](_0x37118e['query'][_0x259b1d('0x23')])),_0x5d30c0[_0x259b1d('0x43')](_0x4f9613);})['then'](function(_0x362dc0){if(_0x362dc0)return _0x362dc0?{'count':_0x46623c,'rows':_0x362dc0}:null;})[_0x4736d5('0x84')](respondWithResult(_0x55119d,null))[_0x4736d5('0xf0')](handleError(_0x55119d,null));};
\ No newline at end of file
+const a111_0x3c61=['addInteraction','findOne','MailServerOut','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','pass','querystring','authentication','ChatWebsiteId','addProactiveActions','addAnswer','auth','List','request\x20sent','timezone','iftime\x20%s,%s','close','emit','ChatApplication','join','agent','getApplications','Contact','../../components/parsers/qs','map','../../config/environment','onlineForm','debug','addSystemAvatar','json','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','created','file','x-real-port','unshift','getLicense','No\x20timezone','isNil','messageId','lastName','show','UserProfileResource','../../rediscache','getProactiveActions','interaction','stringify','offset','offlineMessageBody','body','code','some','sort','firstName','priority','Pause','findAll','removeDispositions','error','mustache','no\x20available\x20attributes','sitepic','externalUrl','type','rows','offline','unmanaged','%s\x20%s','createdAt','request','userChatWebsite:remove','notify','indexOf','ejs','removeAgents','ChatInteraction','order','getDispositions','headers','push','app','addAgents','server/files/images/avatars/customer_avatar.png','rawAttributes','chatLicenseExceeded','body\x20is\x20mandatory\x20and\x20not\x20empty','utf8','get','download','send','update','internal','device','fieldName','server/files/images/logos/default_logo.svg','getAnswers','\x22%s\x22\x20<%s>','util','getCustomerAvatar','addAvatar','../../mysqldb','CannedAnswer','from','server/files/images/avatars/','findAndCountAll','server/files/images/logos/','catch','remote','browser','online','getSnippet','User','isArray','filters','getFields','Smtp','virtual','Intervals','first','false','autoclose','path','sequelize','register','mapKey','email','forwardOfflineAddress','params','autoAssociation','all','custom','role','x-forwarded-for','Tag','keys','updatedAt','./chatWebsite.socket','pick','sendStatus','MailAccount','list','x-real-ip','user','waitForTheAssignedAgent','agentAvatar','asc','unknown','nolimit','showCustomerAvatar','http','host','ids','items','then','filter','interval','describe','addLogo','port','where','Contacts','referer','addApplications','License','CompanyId','getAvatar','message','client','remoteAddress','query','OFFLINE','getAgents','like','defaults','systemAvatar','server/files/templates/chatOfflineMessage.ejs','CmContact','version','tag','getLogo','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','split','destroy','Unable\x20to\x20retrieve\x20the\x20current\x20user','alignment','customerIp','chatVersion','fields','filename','Applications','vendor','difference','getSystemAvatar','account','userChatWebsite:save','Command','*,*,*,*','format','end','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','undefined','attributes','getOfflineMessages','limit','startRouting','ChatMessage','Owner','ChatWebsite','server/files/images/avatars/system_avatar.png','stack','render','count','Content-Range','jayson/promise','merge','setUA','ListId','../../config/license/util','status','include','bulkCreate','applications','AttachmentId','textColor','from\x20is\x20mandatory','removeAnswers','cf-connecting-ip','name','offlineForm','existsSync','create','includes','contact','options','Interval','CmList','customerAvatar','length','omit','ChatOfflineMessage','service','model','getResult','../../config/logger','iftime\x20%s','threadId','mandatoryDispositionPause','ChatWebsite,\x20%s,\x20%s','Disposition','color','UserId','secure','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','intersection','forcedOwnership','root','info','getInteractions','Start','increment','includeAll'];(function(_0x7d1aaa,_0x3c61be){const _0xef2847=function(_0x4ffbca){while(--_0x4ffbca){_0x7d1aaa['push'](_0x7d1aaa['shift']());}};_0xef2847(++_0x3c61be);}(a111_0x3c61,0x12b));const a111_0xef28=function(_0x7d1aaa,_0x3c61be){_0x7d1aaa=_0x7d1aaa-0x0;let _0xef2847=a111_0x3c61[_0x7d1aaa];return _0xef2847;};const _0x3ad545=a111_0xef28;'use strict';const Mustache=require(_0x3ad545('0x12')),util=require(_0x3ad545('0x38')),path=require(_0x3ad545('0x50')),ejs=require(_0x3ad545('0x20')),fs=require('fs'),_=require('lodash'),querystring=require(_0x3ad545('0xe2')),qs=require(_0x3ad545('0xf3')),logger=require(_0x3ad545('0xcb'))('api'),config=require(_0x3ad545('0xf5')),db=require(_0x3ad545('0x3b'))['db'],{Op,ValidationError}=require(_0x3ad545('0x51')),{getSocket}=require(_0x3ad545('0x2')),socket=getSocket();require(_0x3ad545('0x5f'))[_0x3ad545('0x52')](socket);const jayson=require(_0x3ad545('0xad')),client=jayson[_0x3ad545('0x7e')][_0x3ad545('0x6c')]({'port':0x232c}),client9002=jayson[_0x3ad545('0x7e')]['http']({'port':0x232a}),client9003=jayson[_0x3ad545('0x7e')][_0x3ad545('0x6c')]({'port':0x232b});function respondWithRpcPromise(_0x4ffbca,_0x2ca7f8,_0xabc46e,_0x3b85cd){return new Promise(function(_0x137d55,_0x35a7cc){const _0x2156da=a111_0xef28,_0x1ee943=_0x3b85cd||client;return _0x1ee943[_0x2156da('0x1c')](_0x4ffbca,_0xabc46e)[_0x2156da('0x70')](function(_0x3d4d74){const _0x19236c=_0x2156da;logger['info'](_0x19236c('0xcf'),_0x2ca7f8,'request\x20sent'),logger[_0x19236c('0xf7')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2ca7f8,'request\x20sent',JSON[_0x19236c('0x5')](_0x3d4d74));if(_0x3d4d74[_0x19236c('0x11')]){if(_0x3d4d74['error'][_0x19236c('0x9')]===0x1f4)return logger[_0x19236c('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x2ca7f8,_0x3d4d74[_0x19236c('0x11')]['message']),_0x35a7cc(_0x3d4d74[_0x19236c('0x11')][_0x19236c('0x7d')]);return logger[_0x19236c('0x11')](_0x19236c('0xcf'),_0x2ca7f8,_0x3d4d74[_0x19236c('0x11')]['message']),_0x137d55(_0x3d4d74[_0x19236c('0x11')][_0x19236c('0x7d')]);}else logger[_0x19236c('0xd8')](_0x19236c('0xcf'),_0x2ca7f8,_0x19236c('0xe9')),_0x137d55(_0x3d4d74['result']['message']);})[_0x2156da('0x41')](function(_0x304414){const _0x61becd=_0x2156da;logger[_0x61becd('0x11')](_0x61becd('0xcf'),_0x2ca7f8,_0x304414),_0x35a7cc(_0x304414);});});}function respondWithStatusCode(_0x1164ff,_0x48d1f3){return _0x48d1f3=_0x48d1f3||0xcc,function(_0xfc77a2){const _0x565669=a111_0xef28;if(_0xfc77a2)return _0x1164ff[_0x565669('0x61')](_0x48d1f3);return _0x1164ff['status'](_0x48d1f3)[_0x565669('0x9e')]();};}function respondWithResult(_0x3bb217,_0x46cb9e){return _0x46cb9e=_0x46cb9e||0xc8,function(_0x4dc985){const _0x4ab835=a111_0xef28;if(_0x4dc985)return _0x3bb217[_0x4ab835('0xb2')](_0x46cb9e)[_0x4ab835('0xf9')](_0x4dc985);};}function respondWithFilteredResult(_0x33b6a9,_0x460ac2){return function(_0x408c7b){const _0x4e4823=a111_0xef28;if(_0x408c7b){const _0x5b2028=_0x408c7b[_0x4e4823('0xab')],_0x5be877=_0x460ac2[_0x4e4823('0x6')];let _0x2112ad=_0x460ac2[_0x4e4823('0x6')]+_0x460ac2['limit'],_0x547588;return _0x2112ad>=_0x5b2028?(_0x2112ad=_0x5b2028,_0x547588=0xc8):_0x547588=0xce,_0x33b6a9[_0x4e4823('0xb2')](_0x547588),_0x33b6a9['set'](_0x4e4823('0xac'),_0x5be877+'-'+_0x2112ad+'/'+_0x5b2028)[_0x4e4823('0xf9')](_0x408c7b);}return null;};}function saveUpdates(_0x785fca){return function(_0x36e22a){const _0xdaf5a=a111_0xef28;if(_0x36e22a)return _0x36e22a[_0xdaf5a('0x31')](_0x785fca)[_0xdaf5a('0x70')](function(_0x8d6cdb){return _0x8d6cdb;});return null;};}function removeEntity(_0x452ccc){return function(_0x2fc437){const _0x84e389=a111_0xef28;if(_0x2fc437)return _0x2fc437[_0x84e389('0x8e')]()['then'](function(){const _0x1a141c=_0x84e389,_0x1a76df=_0x2fc437['get']({'plain':!![]}),_0xa5fab4='ChatWebsites';return db[_0x1a141c('0x1')]['destroy']({'where':{'type':_0xa5fab4,'resourceId':_0x1a76df['id']}})[_0x1a141c('0x70')](function(){return _0x2fc437;});})[_0x84e389('0x70')](function(){const _0x2d5dce=_0x84e389;_0x452ccc[_0x2d5dce('0xb2')](0xcc)['end']();});};}function handleEntityNotFound(_0x420fd8){return function(_0xc5f810){const _0x5f373e=a111_0xef28;return!_0xc5f810&&_0x420fd8[_0x5f373e('0x61')](0x194),_0xc5f810;};}function handleError(_0x575d0e,_0x100f3d){return _0x100f3d=_0x100f3d||0x1f4,function(_0x43640a){const _0x285c23=a111_0xef28;logger[_0x285c23('0x11')](_0x43640a[_0x285c23('0xa9')]),_0x43640a[_0x285c23('0xbb')]&&delete _0x43640a['name'],_0x575d0e[_0x285c23('0xb2')](_0x100f3d)[_0x285c23('0x30')](_0x43640a);};}exports['index']=function(_0x1e89f6,_0x99a769){const _0x4f3f62=_0x3ad545;let _0x221151={'include':[{'model':db['Pause'],'as':_0x4f3f62('0xce')}]};const _0x2cdd04={},_0x5835c0={'count':0x0,'rows':[]},_0xc5ff72=_[_0x4f3f62('0xf4')](db[_0x4f3f62('0xa7')][_0x4f3f62('0x2a')],function(_0x3fa079){const _0x4f5774=_0x4f3f62;return{'name':_0x3fa079[_0x4f5774('0x34')],'type':_0x3fa079[_0x4f5774('0x16')]['key']};});_0x2cdd04[_0x4f3f62('0xc9')]=_[_0x4f3f62('0xf4')](_0xc5ff72,'name'),_0x2cdd04[_0x4f3f62('0x80')]=_[_0x4f3f62('0x5d')](_0x1e89f6['query']),_0x2cdd04[_0x4f3f62('0x48')]=_[_0x4f3f62('0xd5')](_0x2cdd04[_0x4f3f62('0xc9')],_0x2cdd04[_0x4f3f62('0x80')]),_0x221151[_0x4f3f62('0xa1')]=_[_0x4f3f62('0xd5')](_0x2cdd04['model'],qs['fields'](_0x1e89f6[_0x4f3f62('0x80')][_0x4f3f62('0x93')])),_0x221151[_0x4f3f62('0xa1')]=_0x221151[_0x4f3f62('0xa1')][_0x4f3f62('0xc5')]?_0x221151['attributes']:_0x2cdd04[_0x4f3f62('0xc9')];typeof _0x1e89f6['query'][_0x4f3f62('0x6a')]==='undefined'&&(_0x221151['limit']=qs[_0x4f3f62('0xa3')](_0x1e89f6[_0x4f3f62('0x80')][_0x4f3f62('0xa3')]),_0x221151[_0x4f3f62('0x6')]=qs[_0x4f3f62('0x6')](_0x1e89f6[_0x4f3f62('0x80')][_0x4f3f62('0x6')]));_0x221151[_0x4f3f62('0x23')]=qs[_0x4f3f62('0xb')](_0x1e89f6[_0x4f3f62('0x80')][_0x4f3f62('0xb')]),_0x221151[_0x4f3f62('0x76')]=qs[_0x4f3f62('0x48')](_[_0x4f3f62('0x60')](_0x1e89f6[_0x4f3f62('0x80')],_0x2cdd04[_0x4f3f62('0x48')]),_0xc5ff72);_0x1e89f6['query'][_0x4f3f62('0x71')]&&(_0x221151[_0x4f3f62('0x76')]=_[_0x4f3f62('0xae')](_0x221151[_0x4f3f62('0x76')],{[Op['or']]:_[_0x4f3f62('0xf4')](_0xc5ff72,function(_0x5bcad7){const _0x734d59=_0x4f3f62;if(_0x5bcad7[_0x734d59('0x16')]!=='VIRTUAL'){const _0x407140={};return _0x407140[_0x5bcad7[_0x734d59('0xbb')]]={[Op[_0x734d59('0x83')]]:'%'+_0x1e89f6[_0x734d59('0x80')][_0x734d59('0x71')]+'%'},_0x407140;}})}));_0x221151=_[_0x4f3f62('0xae')]({},_0x221151,_0x1e89f6[_0x4f3f62('0xc1')]);const _0x56ea21={'where':_0x221151['where']};return db[_0x4f3f62('0xa7')][_0x4f3f62('0xab')](_0x56ea21)['then'](function(_0x4ad2ed){const _0x550553=_0x4f3f62;return _0x5835c0['count']=_0x4ad2ed,_0x1e89f6[_0x550553('0x80')][_0x550553('0xdc')]&&(_0x221151[_0x550553('0xb3')]=[{'all':!![]}]),db['ChatWebsite'][_0x550553('0xf')](_0x221151);})[_0x4f3f62('0x70')](function(_0x168f03){return _0x5835c0['rows']=_0x168f03,_0x5835c0;})[_0x4f3f62('0x70')](respondWithFilteredResult(_0x99a769,_0x221151))[_0x4f3f62('0x41')](handleError(_0x99a769,null));},exports[_0x3ad545('0x0')]=function(_0xd4619f,_0x51b056){const _0x51f966=_0x3ad545;let _0x58827e={'raw':![],'where':{'id':_0xd4619f['params']['id']},'include':[{'model':db['Pause'],'as':_0x51f966('0xce')}]};const _0x219bc0={};return _0x219bc0[_0x51f966('0xc9')]=_[_0x51f966('0x5d')](db[_0x51f966('0xa7')][_0x51f966('0x2a')]),_0x219bc0[_0x51f966('0x80')]=_[_0x51f966('0x5d')](_0xd4619f['query']),_0x219bc0[_0x51f966('0x48')]=_[_0x51f966('0xd5')](_0x219bc0[_0x51f966('0xc9')],_0x219bc0[_0x51f966('0x80')]),_0x58827e[_0x51f966('0xa1')]=_[_0x51f966('0xd5')](_0x219bc0[_0x51f966('0xc9')],qs[_0x51f966('0x93')](_0xd4619f[_0x51f966('0x80')]['fields'])),_0x58827e[_0x51f966('0xa1')]=_0x58827e[_0x51f966('0xa1')][_0x51f966('0xc5')]?_0x58827e['attributes']:_0x219bc0[_0x51f966('0xc9')],_0xd4619f['query'][_0x51f966('0xdc')]&&(_0x58827e['include']=[{'all':!![]}]),_0x58827e=_[_0x51f966('0xae')]({},_0x58827e,_0xd4619f[_0x51f966('0xc1')]),db[_0x51f966('0xa7')][_0x51f966('0xde')](_0x58827e)[_0x51f966('0x70')](handleEntityNotFound(_0x51b056,null))['then'](respondWithResult(_0x51b056,null))['catch'](handleError(_0x51b056,null));},exports['create']=function(_0x489c41,_0x1d1cae){const _0x1e5c10=_0x3ad545;return db[_0x1e5c10('0xa7')][_0x1e5c10('0xbe')](_0x489c41[_0x1e5c10('0x8')],{})[_0x1e5c10('0x70')](function(_0x28d11a){const _0x448800=_0x1e5c10,_0x439bce=_0x489c41['user']['get']({'plain':!![]});if(!_0x439bce)throw new Error(_0x448800('0x8f'));if(_0x439bce[_0x448800('0x5a')]===_0x448800('0x65')){const _0x2226e9=_0x28d11a[_0x448800('0x2e')]({'plain':!![]}),_0x2709dd='ChatWebsites';return db['UserProfileSection'][_0x448800('0xde')]({'where':{'name':_0x2709dd,'userProfileId':_0x439bce['userProfileId']},'raw':!![]})[_0x448800('0x70')](function(_0x10a423){const _0x37baa2=_0x448800;return _0x10a423&&_0x10a423[_0x37baa2('0x57')]===0x0?db[_0x37baa2('0x1')][_0x37baa2('0xbe')]({'name':_0x2226e9[_0x37baa2('0xbb')],'resourceId':_0x2226e9['id'],'type':_0x10a423[_0x37baa2('0xbb')],'sectionId':_0x10a423['id']},{})[_0x37baa2('0x70')](function(){return _0x28d11a;}):_0x28d11a;})[_0x448800('0x41')](function(_0x4737b4){const _0x4e1168=_0x448800;logger['error'](_0x4e1168('0xfa'),_0x4737b4);throw _0x4737b4;});}return _0x28d11a;})[_0x1e5c10('0x70')](respondWithResult(_0x1d1cae,0xc9))[_0x1e5c10('0x41')](handleError(_0x1d1cae,null));},exports[_0x3ad545('0x31')]=function(_0x22ded2,_0x8d3294){const _0x1474a1=_0x3ad545;return _0x22ded2[_0x1474a1('0x8')]['id']&&delete _0x22ded2[_0x1474a1('0x8')]['id'],db['ChatWebsite']['findOne']({'where':{'id':_0x22ded2[_0x1474a1('0x56')]['id']},'include':[{'model':db[_0x1474a1('0xe')],'as':'mandatoryDispositionPause'}]})[_0x1474a1('0x70')](handleEntityNotFound(_0x8d3294,null))[_0x1474a1('0x70')](saveUpdates(_0x22ded2[_0x1474a1('0x8')],null))['then'](respondWithResult(_0x8d3294,null))['catch'](handleError(_0x8d3294,null));},exports[_0x3ad545('0x8e')]=function(_0x5c391d,_0x146cce){const _0x5e0756=_0x3ad545;return db[_0x5e0756('0xa7')][_0x5e0756('0xde')]({'where':{'id':_0x5c391d['params']['id']}})['then'](handleEntityNotFound(_0x146cce,null))[_0x5e0756('0x70')](removeEntity(_0x146cce,null))[_0x5e0756('0x41')](handleError(_0x146cce,null));},exports[_0x3ad545('0x73')]=function(_0x2f3536,_0x207c2d){const _0x10dc25=_0x3ad545;return db[_0x10dc25('0xa7')]['describe']()[_0x10dc25('0x70')](respondWithResult(_0x207c2d,null))[_0x10dc25('0x41')](handleError(_0x207c2d,null));},exports['addDisposition']=function(_0x50a922,_0x4e8e96){const _0x29ef39=_0x3ad545;return _0x50a922['body']['id']&&delete _0x50a922[_0x29ef39('0x8')]['id'],db['ChatWebsite']['findOne']({'where':{'id':_0x50a922[_0x29ef39('0x56')]['id']}})[_0x29ef39('0x70')](handleEntityNotFound(_0x4e8e96,null))[_0x29ef39('0x70')](function(_0x3c4b8b){const _0x159af7=_0x29ef39;if(_0x3c4b8b)return _0x50a922[_0x159af7('0x8')][_0x159af7('0xe4')]=_0x3c4b8b['id'],db[_0x159af7('0xd0')][_0x159af7('0xbe')](_0x50a922[_0x159af7('0x8')]);})[_0x29ef39('0x70')](respondWithResult(_0x4e8e96,null))[_0x29ef39('0x41')](handleError(_0x4e8e96,null));},exports[_0x3ad545('0x24')]=function(_0x8ae1d8,_0x55415b){const _0x11982b=_0x3ad545;let _0x58d151={'raw':![],'where':{}};const _0x2b0eea={},_0x1ab2c5={'count':0x0,'rows':[]};return db[_0x11982b('0xa7')]['findOne']({'where':{'id':_0x8ae1d8[_0x11982b('0x56')]['id']}})[_0x11982b('0x70')](handleEntityNotFound(_0x55415b,null))['then'](function(_0x38e0bc){const _0x1e80e8=_0x11982b;if(_0x38e0bc)return _0x2b0eea[_0x1e80e8('0xc9')]=_[_0x1e80e8('0x5d')](db[_0x1e80e8('0xd0')]['rawAttributes']),_0x2b0eea[_0x1e80e8('0x80')]=_[_0x1e80e8('0x5d')](_0x8ae1d8[_0x1e80e8('0x80')]),_0x2b0eea[_0x1e80e8('0x48')]=_['intersection'](_0x2b0eea[_0x1e80e8('0xc9')],_0x2b0eea['query']),_0x58d151[_0x1e80e8('0xa1')]=_['intersection'](_0x2b0eea[_0x1e80e8('0xc9')],qs[_0x1e80e8('0x93')](_0x8ae1d8['query'][_0x1e80e8('0x93')])),_0x58d151[_0x1e80e8('0xa1')]=_0x58d151['attributes'][_0x1e80e8('0xc5')]?_0x58d151[_0x1e80e8('0xa1')]:_0x2b0eea['model'],typeof _0x8ae1d8[_0x1e80e8('0x80')][_0x1e80e8('0x6a')]===_0x1e80e8('0xa0')&&(_0x58d151[_0x1e80e8('0xa3')]=qs['limit'](_0x8ae1d8['query'][_0x1e80e8('0xa3')]),_0x58d151['offset']=qs[_0x1e80e8('0x6')](_0x8ae1d8[_0x1e80e8('0x80')][_0x1e80e8('0x6')])),_0x58d151[_0x1e80e8('0x23')]=qs['sort'](_0x8ae1d8[_0x1e80e8('0x80')][_0x1e80e8('0xb')]),_0x58d151[_0x1e80e8('0x76')]=qs['filters'](_[_0x1e80e8('0x60')](_0x8ae1d8[_0x1e80e8('0x80')],_0x2b0eea[_0x1e80e8('0x48')])),_0x58d151[_0x1e80e8('0x76')][_0x1e80e8('0xe4')]=_0x38e0bc['id'],_0x8ae1d8['query'][_0x1e80e8('0x71')]&&(_0x58d151[_0x1e80e8('0x76')]=_[_0x1e80e8('0xae')](_0x58d151[_0x1e80e8('0x76')],{[Op['or']]:_[_0x1e80e8('0xf4')](_0x58d151[_0x1e80e8('0xa1')],function(_0xe756){const _0x1e38ca=_0x1e80e8,_0x603f5b={};return _0x603f5b[_0xe756]={[Op['like']]:'%'+_0x8ae1d8['query'][_0x1e38ca('0x71')]+'%'},_0x603f5b;})})),_0x58d151=_[_0x1e80e8('0xae')]({},_0x58d151,_0x8ae1d8['options']),db[_0x1e80e8('0xd0')][_0x1e80e8('0xab')]({'where':_0x58d151['where']})[_0x1e80e8('0x70')](function(_0xf08ccb){const _0x1abd91=_0x1e80e8;return _0x1ab2c5[_0x1abd91('0xab')]=_0xf08ccb,_0x8ae1d8[_0x1abd91('0x80')][_0x1abd91('0xdc')]&&(_0x58d151[_0x1abd91('0xb3')]=[{'all':!![]}]),db['Disposition'][_0x1abd91('0xf')](_0x58d151);})[_0x1e80e8('0x70')](function(_0xe80b4){return _0x1ab2c5['rows']=_0xe80b4,_0x1ab2c5;});})[_0x11982b('0x70')](respondWithFilteredResult(_0x55415b,_0x58d151))[_0x11982b('0x41')](handleError(_0x55415b,null));},exports['removeDispositions']=function(_0x6bb08a,_0x5b4f9f){const _0xf41c11=_0x3ad545;return db['ChatWebsite'][_0xf41c11('0xde')]({'where':{'id':_0x6bb08a['params']['id']}})[_0xf41c11('0x70')](handleEntityNotFound(_0x5b4f9f,null))[_0xf41c11('0x70')](function(_0x4cdd41){const _0x1b82bf=_0xf41c11;if(_0x4cdd41)return _0x4cdd41[_0x1b82bf('0x10')](_0x6bb08a[_0x1b82bf('0x80')]['ids']);})[_0xf41c11('0x70')](respondWithStatusCode(_0x5b4f9f,null))['catch'](handleError(_0x5b4f9f,null));},exports[_0x3ad545('0xe6')]=function(_0x4237e0,_0x5033dc){const _0x3b67ae=_0x3ad545;return _0x4237e0[_0x3b67ae('0x8')]['id']&&delete _0x4237e0[_0x3b67ae('0x8')]['id'],db['ChatWebsite']['findOne']({'where':{'id':_0x4237e0['params']['id']}})[_0x3b67ae('0x70')](handleEntityNotFound(_0x5033dc,null))[_0x3b67ae('0x70')](function(_0x193229){const _0x21d92f=_0x3b67ae;if(_0x193229)return _0x4237e0[_0x21d92f('0x8')][_0x21d92f('0xe4')]=_0x193229['id'],db[_0x21d92f('0x3c')][_0x21d92f('0xbe')](_0x4237e0[_0x21d92f('0x8')]);})[_0x3b67ae('0x70')](respondWithResult(_0x5033dc,null))[_0x3b67ae('0x41')](handleError(_0x5033dc,null));},exports[_0x3ad545('0x36')]=function(_0x2abe34,_0x460db3){const _0x398f09=_0x3ad545;let _0x19cdb5={'raw':![],'where':{}};const _0x444658={},_0x3fe772={'count':0x0,'rows':[]};return db[_0x398f09('0xa7')][_0x398f09('0xde')]({'where':{'id':_0x2abe34[_0x398f09('0x56')]['id']}})['then'](handleEntityNotFound(_0x460db3,null))[_0x398f09('0x70')](function(_0x2cbe88){const _0x21fa4a=_0x398f09;if(_0x2cbe88)return _0x444658['model']=_['keys'](db['CannedAnswer'][_0x21fa4a('0x2a')]),_0x444658[_0x21fa4a('0x80')]=_[_0x21fa4a('0x5d')](_0x2abe34['query']),_0x444658[_0x21fa4a('0x48')]=_['intersection'](_0x444658[_0x21fa4a('0xc9')],_0x444658[_0x21fa4a('0x80')]),_0x19cdb5[_0x21fa4a('0xa1')]=_[_0x21fa4a('0xd5')](_0x444658[_0x21fa4a('0xc9')],qs['fields'](_0x2abe34[_0x21fa4a('0x80')][_0x21fa4a('0x93')])),_0x19cdb5[_0x21fa4a('0xa1')]=_0x19cdb5[_0x21fa4a('0xa1')][_0x21fa4a('0xc5')]?_0x19cdb5[_0x21fa4a('0xa1')]:_0x444658[_0x21fa4a('0xc9')],typeof _0x2abe34[_0x21fa4a('0x80')]['nolimit']===_0x21fa4a('0xa0')&&(_0x19cdb5[_0x21fa4a('0xa3')]=qs[_0x21fa4a('0xa3')](_0x2abe34['query']['limit']),_0x19cdb5[_0x21fa4a('0x6')]=qs[_0x21fa4a('0x6')](_0x2abe34[_0x21fa4a('0x80')][_0x21fa4a('0x6')])),_0x19cdb5[_0x21fa4a('0x23')]=qs[_0x21fa4a('0xb')](_0x2abe34['query'][_0x21fa4a('0xb')]),_0x19cdb5[_0x21fa4a('0x76')]=qs[_0x21fa4a('0x48')](_[_0x21fa4a('0x60')](_0x2abe34[_0x21fa4a('0x80')],_0x444658[_0x21fa4a('0x48')])),_0x19cdb5['where'][_0x21fa4a('0xe4')]=_0x2cbe88['id'],_0x2abe34['query'][_0x21fa4a('0x71')]&&(_0x19cdb5[_0x21fa4a('0x76')]=_[_0x21fa4a('0xae')](_0x19cdb5[_0x21fa4a('0x76')],{[Op['or']]:_[_0x21fa4a('0xf4')](_0x19cdb5['attributes'],function(_0x2796f0){const _0x4a277c=_0x21fa4a,_0x27ddc9={};return _0x27ddc9[_0x2796f0]={[Op['like']]:'%'+_0x2abe34[_0x4a277c('0x80')]['filter']+'%'},_0x27ddc9;})})),_0x19cdb5=_[_0x21fa4a('0xae')]({},_0x19cdb5,_0x2abe34['options']),db[_0x21fa4a('0x3c')]['count']({'where':_0x19cdb5[_0x21fa4a('0x76')]})['then'](function(_0x312fcf){const _0x437637=_0x21fa4a;return _0x3fe772[_0x437637('0xab')]=_0x312fcf,_0x2abe34[_0x437637('0x80')][_0x437637('0xdc')]&&(_0x19cdb5[_0x437637('0xb3')]=[{'all':!![]}]),db['CannedAnswer'][_0x437637('0xf')](_0x19cdb5);})[_0x21fa4a('0x70')](function(_0x257a42){return _0x3fe772['rows']=_0x257a42,_0x3fe772;});})['then'](respondWithFilteredResult(_0x460db3,_0x19cdb5))[_0x398f09('0x41')](handleError(_0x460db3,null));},exports[_0x3ad545('0xb9')]=function(_0x525880,_0x1be996){const _0x1b4617=_0x3ad545;return db['ChatWebsite']['findOne']({'where':{'id':_0x525880[_0x1b4617('0x56')]['id']}})[_0x1b4617('0x70')](handleEntityNotFound(_0x1be996,null))[_0x1b4617('0x70')](function(_0x126a07){const _0xc26d87=_0x1b4617;if(_0x126a07)return _0x126a07[_0xc26d87('0xb9')](_0x525880['query'][_0xc26d87('0x6e')]);})[_0x1b4617('0x70')](respondWithStatusCode(_0x1be996,null))[_0x1b4617('0x41')](handleError(_0x1be996,null));},exports[_0x3ad545('0x74')]=function(_0x3b8f29,_0x2f60cb){const _0xe95cfd=_0x3ad545;return _0x3b8f29[_0xe95cfd('0x8')][_0xe95cfd('0x14')]=_0x3b8f29[_0xe95cfd('0xfc')][_0xe95cfd('0x94')],db['ChatWebsite'][_0xe95cfd('0xde')]({'where':{'id':_0x3b8f29['params']['id']}})['then'](handleEntityNotFound(_0x2f60cb,null))[_0xe95cfd('0x70')](saveUpdates(_0x3b8f29[_0xe95cfd('0x8')],null))[_0xe95cfd('0x70')](respondWithResult(_0x2f60cb,null))['catch'](handleError(_0x2f60cb,null));},exports[_0x3ad545('0x3a')]=function(_0x54c091,_0xdd62b3){const _0x4e2c98=_0x3ad545;return _0x54c091[_0x4e2c98('0x8')][_0x4e2c98('0x67')]=_0x54c091[_0x4e2c98('0xfc')][_0x4e2c98('0x94')],db[_0x4e2c98('0xa7')][_0x4e2c98('0xde')]({'where':{'id':_0x54c091['params']['id']}})[_0x4e2c98('0x70')](handleEntityNotFound(_0xdd62b3,null))['then'](saveUpdates(_0x54c091[_0x4e2c98('0x8')],null))[_0x4e2c98('0x70')](respondWithResult(_0xdd62b3,null))[_0x4e2c98('0x41')](handleError(_0xdd62b3,null));},exports['addCustomerAvatar']=function(_0x243173,_0x25fb0d){const _0x174c51=_0x3ad545;return _0x243173['body']['customerAvatar']=_0x243173[_0x174c51('0xfc')][_0x174c51('0x94')],db['ChatWebsite'][_0x174c51('0xde')]({'where':{'id':_0x243173[_0x174c51('0x56')]['id']}})[_0x174c51('0x70')](handleEntityNotFound(_0x25fb0d,null))[_0x174c51('0x70')](saveUpdates(_0x243173['body'],null))[_0x174c51('0x70')](respondWithResult(_0x25fb0d,null))[_0x174c51('0x41')](handleError(_0x25fb0d,null));},exports[_0x3ad545('0xf8')]=function(_0x47f8a4,_0x1e3de5){const _0x4899e2=_0x3ad545;return _0x47f8a4[_0x4899e2('0x8')][_0x4899e2('0x85')]=_0x47f8a4[_0x4899e2('0xfc')][_0x4899e2('0x94')],db['ChatWebsite'][_0x4899e2('0xde')]({'where':{'id':_0x47f8a4[_0x4899e2('0x56')]['id']}})[_0x4899e2('0x70')](handleEntityNotFound(_0x1e3de5,null))[_0x4899e2('0x70')](saveUpdates(_0x47f8a4['body'],null))['then'](respondWithResult(_0x1e3de5,null))[_0x4899e2('0x41')](handleError(_0x1e3de5,null));},exports[_0x3ad545('0x8a')]=function(_0x4ca5a5,_0x10bd31){const _0x3088ac=_0x3ad545;let _0x451aa0=path[_0x3088ac('0xef')](config[_0x3088ac('0xd7')],_0x3088ac('0x35'));const _0x4784ba={'where':{'id':_0x4ca5a5['params']['id']},'attributes':['id',_0x3088ac('0x14')],'raw':!![]};let _0x30daf8=![];return require('../../config/license/util')[_0x3088ac('0xff')]()[_0x3088ac('0x70')](function(_0x3ceb49){_0x3ceb49&&(_0x30daf8=_0x3ceb49['custom']);})[_0x3088ac('0x70')](function(){const _0x323863=_0x3088ac;return db['ChatWebsite'][_0x323863('0xde')](_0x4784ba);})[_0x3088ac('0x70')](handleEntityNotFound(_0x10bd31,null))[_0x3088ac('0x70')](function(_0xe613c1){const _0x534352=_0x3088ac;if(_0xe613c1)return!_[_0x534352('0x101')](_0xe613c1['sitepic'])&&(fs[_0x534352('0xbd')](path['join'](config[_0x534352('0xd7')],_0x534352('0x40'),_0xe613c1['sitepic']))&&_0x30daf8&&(_0x451aa0=path[_0x534352('0xef')](config['root'],_0x534352('0x40'),_0xe613c1[_0x534352('0x14')]))),_0x10bd31[_0x534352('0x2f')](_0x451aa0);})[_0x3088ac('0x41')](handleError(_0x10bd31,null));},exports[_0x3ad545('0x7c')]=function(_0x1b951,_0x3f1817){const _0x28f4f4=_0x3ad545;let _0x52e582=path[_0x28f4f4('0xef')](config[_0x28f4f4('0xd7')],'server/files/images/avatars/default_avatar.png');const _0x3e8744={'where':{'id':_0x1b951[_0x28f4f4('0x56')]['id']},'attributes':['id',_0x28f4f4('0x67')],'raw':!![]};return db[_0x28f4f4('0xa7')][_0x28f4f4('0xde')](_0x3e8744)[_0x28f4f4('0x70')](handleEntityNotFound(_0x3f1817,null))[_0x28f4f4('0x70')](function(_0x5d39c9){const _0x4121ac=_0x28f4f4;if(_0x5d39c9)return!_[_0x4121ac('0x101')](_0x5d39c9[_0x4121ac('0x67')])&&(fs['existsSync'](path[_0x4121ac('0xef')](config[_0x4121ac('0xd7')],_0x4121ac('0x3e'),_0x5d39c9[_0x4121ac('0x67')]))&&(_0x52e582=path[_0x4121ac('0xef')](config[_0x4121ac('0xd7')],_0x4121ac('0x3e'),_0x5d39c9[_0x4121ac('0x67')]))),_0x3f1817[_0x4121ac('0x2f')](_0x52e582);})['catch'](handleError(_0x3f1817,null));},exports[_0x3ad545('0x39')]=function(_0x72058c,_0x528b33){const _0x5665ce=_0x3ad545;let _0x1f63d6=path[_0x5665ce('0xef')](config['root'],_0x5665ce('0x29'));const _0x2dcd62={'where':{'id':_0x72058c[_0x5665ce('0x56')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x5665ce('0xa7')][_0x5665ce('0xde')](_0x2dcd62)['then'](handleEntityNotFound(_0x528b33,null))[_0x5665ce('0x70')](function(_0x3fd730){const _0x296f52=_0x5665ce;if(_0x3fd730)return!_[_0x296f52('0x101')](_0x3fd730[_0x296f52('0xc4')])&&(fs['existsSync'](path['join'](config[_0x296f52('0xd7')],_0x296f52('0x3e'),_0x3fd730['customerAvatar']))&&_0x3fd730[_0x296f52('0x6b')]&&(_0x1f63d6=path['join'](config['root'],'server/files/images/avatars/',_0x3fd730[_0x296f52('0xc4')]))),_0x528b33[_0x296f52('0x2f')](_0x1f63d6);})[_0x5665ce('0x41')](handleError(_0x528b33,null));},exports[_0x3ad545('0x98')]=function(_0x1654ca,_0x5a148b){const _0x50b552=_0x3ad545;let _0x5c37a6=path[_0x50b552('0xef')](config[_0x50b552('0xd7')],_0x50b552('0xa8'));const _0x3af1c4={'where':{'id':_0x1654ca[_0x50b552('0x56')]['id']},'attributes':['id',_0x50b552('0x85')],'raw':!![]};return db[_0x50b552('0xa7')][_0x50b552('0xde')](_0x3af1c4)['then'](handleEntityNotFound(_0x5a148b,null))[_0x50b552('0x70')](function(_0x4bc217){const _0x3b2a11=_0x50b552;if(_0x4bc217)return!_['isNil'](_0x4bc217[_0x3b2a11('0x85')])&&(fs[_0x3b2a11('0xbd')](path[_0x3b2a11('0xef')](config[_0x3b2a11('0xd7')],_0x3b2a11('0x3e'),_0x4bc217[_0x3b2a11('0x85')]))&&(_0x5c37a6=path[_0x3b2a11('0xef')](config[_0x3b2a11('0xd7')],'server/files/images/avatars/',_0x4bc217['systemAvatar']))),_0x5a148b['download'](_0x5c37a6);})['catch'](handleError(_0x5a148b,null));},exports[_0x3ad545('0x1e')]=function(_0x837984,_0x403c94){const _0x2d7b11=_0x3ad545,_0x133bca=require('user-agent-parser'),_0x474d9d=new _0x133bca(),_0x3ef5c6=_0x474d9d[_0x2d7b11('0xaf')](_0x837984['headers']['user-agent'])[_0x2d7b11('0xca')](),_0x107d69={'body':_0x837984[_0x2d7b11('0x8')],'channel':'chat'};let _0x40d513=[],_0x5957ab=[];const _0x26d45d={};let _0x3c9785=![];return db[_0x2d7b11('0x87')][_0x2d7b11('0x73')]()[_0x2d7b11('0x70')](function(_0x43229e){const _0x44aa42=_0x2d7b11;if(!_0x43229e)throw new ValidationError(_0x44aa42('0x13'));_0x40d513=_['difference'](_[_0x44aa42('0x5d')](_0x43229e),[_0x44aa42('0x1b'),_0x44aa42('0x5e')]),_0x5957ab=_[_0x44aa42('0x97')](_['keys'](_0x43229e),[_0x44aa42('0x1b'),_0x44aa42('0x5e'),_0x44aa42('0x7b'),'ListId']);_0x837984[_0x44aa42('0x8')]['id']&&delete _0x837984[_0x44aa42('0x8')]['id'];if(_[_0x44aa42('0x101')](_0x837984[_0x44aa42('0x8')][_0x44aa42('0x3d')]))throw new ValidationError('from\x20is\x20mandatory');if(_[_0x44aa42('0x101')](_0x837984[_0x44aa42('0x8')][_0x44aa42('0x8')])||_0x837984[_0x44aa42('0x8')][_0x44aa42('0x8')]==='')throw new ValidationError('body\x20is\x20mandatory\x20and\x20not\x20empty');if(_['isNil'](_0x837984['body'][_0x44aa42('0x53')]))throw new ValidationError('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5957ab);if(!_[_0x44aa42('0xbf')](_0x5957ab,_0x837984[_0x44aa42('0x8')][_0x44aa42('0x53')]))throw new ValidationError(_0x44aa42('0x9f')+_0x5957ab);_0x26d45d[_0x837984[_0x44aa42('0x8')][_0x44aa42('0x53')]]=_0x837984['body']['from'];})['then'](function(){const _0x1c2b5a=_0x2d7b11;return db[_0x1c2b5a('0xa7')][_0x1c2b5a('0xde')]({'where':{'id':_0x837984[_0x1c2b5a('0x56')]['id']},'include':[{'model':db[_0x1c2b5a('0xc3')],'as':_0x1c2b5a('0xe8'),'include':[{'model':db[_0x1c2b5a('0x87')],'as':_0x1c2b5a('0x77'),'where':_0x26d45d,'limit':0x1,'order':[[_0x1c2b5a('0x5e'),'DESC']]}]},{'model':db[_0x1c2b5a('0xee')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x403c94,null))[_0x2d7b11('0x70')](function(_0x3d26f2){const _0xf64c2b=_0x2d7b11;if(_0x3d26f2&&_0x3d26f2[_0xf64c2b('0xe8')]){_0x107d69[_0xf64c2b('0x99')]=_0x3d26f2,_0x107d69[_0xf64c2b('0xb5')]=_0x3d26f2[_0xf64c2b('0x95')],_0x107d69[_0xf64c2b('0x63')]=_0x3d26f2[_0xf64c2b('0xe8')],_0x107d69[_0xf64c2b('0xb5')]=_['orderBy'](_0x107d69[_0xf64c2b('0xb5')],[_0xf64c2b('0xd')],[_0xf64c2b('0x68')]);_0x107d69['account'][_0xf64c2b('0x95')]&&delete _0x107d69[_0xf64c2b('0x99')]['Applications'];if(_0x107d69[_0xf64c2b('0x99')][_0xf64c2b('0xe8')]&&_0x107d69[_0xf64c2b('0x99')][_0xf64c2b('0xe8')][_0xf64c2b('0x77')]['length'])return _0x107d69[_0xf64c2b('0x99')][_0xf64c2b('0xe8')][_0xf64c2b('0x77')][0x0];const _0x3950af=_[_0xf64c2b('0x84')](_0x837984[_0xf64c2b('0x8')],{'firstName':_0x837984[_0xf64c2b('0x8')][_0xf64c2b('0x3d')],'ListId':_0x3d26f2['ListId']});return _0x3950af[_0x837984[_0xf64c2b('0x8')][_0xf64c2b('0x53')]]=_0x837984[_0xf64c2b('0x8')]['from'],db[_0xf64c2b('0x87')][_0xf64c2b('0xbe')](_0x3950af,{'fields':_0x40d513,'raw':!![]});}})['then'](handleEntityNotFound(_0x403c94,null))[_0x2d7b11('0x70')](function(_0x54e3a4){const _0x11d24e=_0x2d7b11;_0x107d69[_0x11d24e('0xc0')]=_0x54e3a4;let _0x58c11b=_0x837984[_0x11d24e('0x8')][_0x11d24e('0x91')];if(_0x837984[_0x11d24e('0x25')][_0x11d24e('0xba')])_0x58c11b=_0x837984[_0x11d24e('0x25')][_0x11d24e('0xba')];else _0x837984[_0x11d24e('0x25')][_0x11d24e('0x5b')]&&(_0x58c11b=_[_0x11d24e('0x4d')](_0x837984[_0x11d24e('0x25')][_0x11d24e('0x5b')][_0x11d24e('0x8d')](',')));if(_0x54e3a4){const _0x313061={'ContactId':_0x54e3a4['id'],'ChatWebsiteId':_0x837984['params']['id'],'from':(_0x54e3a4[_0x11d24e('0xc')]||'')+'\x20'+(_0x54e3a4[_0x11d24e('0x103')]||''),'customerIp':_0x58c11b,'customerPort':_0x837984['headers'][_0x11d24e('0xfd')]?_0x837984[_0x11d24e('0x25')][_0x11d24e('0xfd')]:null,'referer':_0x837984[_0x11d24e('0x8')][_0x11d24e('0x78')],'browserName':_0x3ef5c6[_0x11d24e('0x43')]['name']&&_0x3ef5c6[_0x11d24e('0x43')][_0x11d24e('0x88')]?util[_0x11d24e('0x9d')](_0x11d24e('0x1a'),_0x3ef5c6[_0x11d24e('0x43')][_0x11d24e('0xbb')],_0x3ef5c6[_0x11d24e('0x43')][_0x11d24e('0x88')]):_0x11d24e('0x69'),'browserVersion':_0x3ef5c6[_0x11d24e('0x43')][_0x11d24e('0x88')]||_0x11d24e('0x69'),'osName':util[_0x11d24e('0x9d')](_0x11d24e('0x1a'),_0x3ef5c6['os'][_0x11d24e('0xbb')],_0x3ef5c6['os']['version']),'osVersion':_0x3ef5c6['os'][_0x11d24e('0x88')],'deviceModel':_0x3ef5c6[_0x11d24e('0x33')]['model']&&_0x3ef5c6[_0x11d24e('0x33')]['vendor']?util[_0x11d24e('0x9d')]('%s\x20%s\x20%s',_0x3ef5c6['device'][_0x11d24e('0xc9')],_0x3ef5c6[_0x11d24e('0x33')][_0x11d24e('0x96')],_0x3ef5c6[_0x11d24e('0x33')][_0x11d24e('0x16')]):null,'deviceVendor':_0x3ef5c6[_0x11d24e('0x33')][_0x11d24e('0x96')],'deviceType':_0x3ef5c6[_0x11d24e('0x33')][_0x11d24e('0x16')],'formData':JSON['stringify'](_0x837984[_0x11d24e('0x8')])},_0x221463={'ChatWebsiteId':_0x837984[_0x11d24e('0x56')]['id'],'closed':![]};if(_0x837984[_0x11d24e('0x8')][_0x11d24e('0xcd')])return _0x221463[_0x11d24e('0xcd')]=_0x837984[_0x11d24e('0x8')][_0x11d24e('0xcd')],db[_0x11d24e('0x22')][_0x11d24e('0xde')]({'where':_0x221463})['then'](function(_0x2434de){const _0x4de427=_0x11d24e;if(_0x2434de)return[_0x2434de,![]];return _0x313061['threadId']=_0x837984[_0x4de427('0x8')][_0x4de427('0xcd')],_0x313061[_0x4de427('0x15')]=_0x837984['body'][_0x4de427('0x15')],db[_0x4de427('0x22')]['create'](_0x313061)[_0x4de427('0x70')](function(_0x589d84){return[_0x589d84,!![]];});});_0x221463['ContactId']=_0x54e3a4['id'];if(_0x837984[_0x11d24e('0x8')][_0x11d24e('0x4')]&&_0x837984[_0x11d24e('0x8')][_0x11d24e('0x4')]['id'])return _0x221463['id']=_0x837984['body'][_0x11d24e('0x4')]['id'],db['ChatInteraction']['findOne']({'where':_0x221463})[_0x11d24e('0x70')](function(_0x2184be){const _0x468807=_0x11d24e;if(_0x2184be)return[_0x2184be,![]];return db['ChatInteraction'][_0x468807('0xbe')](_0x313061)[_0x468807('0x70')](function(_0xd860ea){return[_0xd860ea,!![]];});});return db[_0x11d24e('0x22')]['create'](_0x313061)['then'](function(_0x5bbc4a){return[_0x5bbc4a,!![]];});}})[_0x2d7b11('0x70')](function([_0x56fb67,_0x4ae96c]){const _0x2d68bf=_0x2d7b11;if(_0x56fb67){_0x3c9785=_0x4ae96c;if(!_0x4ae96c){const _0x36c31c={'from':(_0x107d69[_0x2d68bf('0xc0')]['firstName']||'')+'\x20'+(_0x107d69['contact'][_0x2d68bf('0x103')]||'')};return _0x837984[_0x2d68bf('0x8')]['threadId']&&_0x837984['body'][_0x2d68bf('0x102')]&&_0x837984[_0x2d68bf('0x8')][_0x2d68bf('0xcd')]!=_0x837984['body'][_0x2d68bf('0x102')]&&(_0x36c31c[_0x2d68bf('0xcd')]=_0x837984[_0x2d68bf('0x8')][_0x2d68bf('0x102')]),_0x56fb67[_0x2d68bf('0x31')](_0x36c31c);}else return _0x56fb67;}})['then'](function(_0x545076){const _0x5d2bec=_0x2d7b11;return _0x107d69['interaction']=_0x545076[_0x5d2bec('0x2e')]({'plain':!![]}),_0x107d69[_0x5d2bec('0x4')][_0x5d2bec('0xfb')]=_0x3c9785,_0x107d69[_0x5d2bec('0x4')][_0x5d2bec('0xfb')]&&(_0x107d69[_0x5d2bec('0x99')][_0x5d2bec('0x4f')]&&_0x107d69[_0x5d2bec('0xb5')][_0x5d2bec('0x26')]({'id':0x0,'priority':_0x107d69[_0x5d2bec('0xb5')]['length']+0x1,'app':_0x5d2bec('0xec'),'appdata':_0x5d2bec('0x19'),'interval':_0x5d2bec('0x9c')})),db[_0x5d2bec('0xa5')][_0x5d2bec('0xbe')]({'body':_0x837984[_0x5d2bec('0x8')][_0x5d2bec('0x8')],'ChatWebsiteId':_0x837984[_0x5d2bec('0x56')]['id'],'ChatInteractionId':_0x545076['id'],'direction':'in','ContactId':_0x107d69[_0x5d2bec('0xc0')]['id'],'AttachmentId':_0x837984[_0x5d2bec('0x8')][_0x5d2bec('0xb6')]});})[_0x2d7b11('0x70')](function(_0x12244e){const _0x47be5b=_0x2d7b11;_0x107d69[_0x47be5b('0x7d')]=_0x12244e;if(_0x107d69[_0x47be5b('0x4')][_0x47be5b('0xd2')])return db['User'][_0x47be5b('0xde')]({'attributes':['id',_0x47be5b('0xbb')],'where':{'id':_0x107d69[_0x47be5b('0x4')][_0x47be5b('0xd2')]}})[_0x47be5b('0x70')](function(_0x4fb8a3){const _0x284afa=_0x47be5b;return _0x4fb8a3&&(_0x107d69[_0x284afa('0xb5')][_0x284afa('0xfe')]({'id':0x0,'priority':0x0,'app':_0x284afa('0xf0'),'appdata':_0x4fb8a3[_0x284afa('0xbb')]+','+(_0x107d69[_0x284afa('0x99')][_0x284afa('0x66')]||0xa),'interval':_0x284afa('0x9c')}),_0x107d69[_0x284afa('0xd6')]=!![]),respondWithRpcPromise('Start',_0x284afa('0xa4'),_0x107d69);});return respondWithRpcPromise(_0x47be5b('0xda'),_0x47be5b('0xa4'),_0x107d69);})[_0x2d7b11('0x70')](function(_0x90cc8){const _0x3b374c=_0x2d7b11;return respondWithRpcPromise('EventManager','EventManager',{'event':_0x3b374c('0x1e'),'message':_0x90cc8},client9002),_0x90cc8;})[_0x2d7b11('0x70')](respondWithResult(_0x403c94,null))[_0x2d7b11('0x41')](handleError(_0x403c94,null));},exports[_0x3ad545('0x18')]=function(_0x5a4c0f,_0x3e377d){const _0x62719a=_0x3ad545;let _0xc587a8,_0x49bc00,_0xe7965d=[];const _0xdcc29={};return db[_0x62719a('0x87')][_0x62719a('0x73')]()[_0x62719a('0x70')](function(_0x55a97b){const _0x55680e=_0x62719a;if(!_0x55a97b)throw new ValidationError(_0x55680e('0x13'));_0xe7965d=_[_0x55680e('0x97')](_['keys'](_0x55a97b),[_0x55680e('0x1b'),_0x55680e('0x5e'),_0x55680e('0x7b'),_0x55680e('0xb0')]);_0x5a4c0f[_0x55680e('0x8')]['id']&&delete _0x5a4c0f['body']['id'];if(_[_0x55680e('0x101')](_0x5a4c0f[_0x55680e('0x8')][_0x55680e('0x3d')]))throw _0x3e377d['status'](0x1f4)['send'](new ValidationError(_0x55680e('0xb8')));if(_[_0x55680e('0x101')](_0x5a4c0f[_0x55680e('0x8')][_0x55680e('0x8')])||_0x5a4c0f[_0x55680e('0x8')][_0x55680e('0x8')]==='')throw _0x3e377d[_0x55680e('0xb2')](0x1f4)[_0x55680e('0x30')](new ValidationError(_0x55680e('0x2c')));if(_[_0x55680e('0x101')](_0x5a4c0f[_0x55680e('0x8')]['mapKeyOffline']))throw _0x3e377d[_0x55680e('0xb2')](0x1f4)['send'](new ValidationError(_0x55680e('0x8b')+_0xe7965d));if(!_['includes'](_0xe7965d,_0x5a4c0f[_0x55680e('0x8')][_0x55680e('0x8c')]))throw _0x3e377d[_0x55680e('0xb2')](0x1f4)[_0x55680e('0x30')](new ValidationError(_0x55680e('0xe0')+_0xe7965d));_0xdcc29[_0x5a4c0f[_0x55680e('0x8')]['mapKeyOffline']]=_0x5a4c0f['body'][_0x55680e('0x3d')];})[_0x62719a('0x70')](function(){const _0x4a6214=_0x62719a;return db[_0x4a6214('0xa7')][_0x4a6214('0xde')]({'where':{'id':_0x5a4c0f[_0x4a6214('0x56')]['id']},'include':[{'model':db[_0x4a6214('0xc3')],'as':'List'}]});})[_0x62719a('0x70')](handleEntityNotFound(_0x3e377d,null))[_0x62719a('0x70')](function(_0x1d74b5){const _0x4cb783=_0x62719a;if(_0x1d74b5&&_0x1d74b5[_0x4cb783('0xe8')]){_0x49bc00=_0x1d74b5;const _0x5d7d49=_[_0x4cb783('0x84')](_0x5a4c0f[_0x4cb783('0x8')],{'firstName':_0x5a4c0f['body']['from'],'phone':_0x5a4c0f[_0x4cb783('0x8')][_0x4cb783('0x3d')],'ListId':_0x1d74b5[_0x4cb783('0xb0')]});return _0x5d7d49[_0x5a4c0f[_0x4cb783('0x8')]['mapKeyOffline']]=_0x5a4c0f[_0x4cb783('0x8')]['from'],db[_0x4cb783('0x87')]['findOrCreate']({'where':_0xdcc29,'defaults':_0x5d7d49});}})[_0x62719a('0x70')](function([_0x271772]){const _0x538ee3=_0x62719a;if(_0x271772){const _0xebc8ab=fs['readFileSync'](path[_0x538ee3('0xef')](config[_0x538ee3('0xd7')],_0x538ee3('0x86')),_0x538ee3('0x2d')),_0x5d95d3=ejs[_0x538ee3('0xaa')](_0xebc8ab,{'body':_['toPairs'](_0x5a4c0f['body'][_0x538ee3('0x8')]),'bodyTitle':_0x49bc00[_0x538ee3('0x7')]});return db[_0x538ee3('0xc7')][_0x538ee3('0xbe')]({'body':_0x5d95d3,'ContactId':_0x271772['id'],'ChatWebsiteId':_0x49bc00['id']});}})[_0x62719a('0x70')](function(_0x4526dc){const _0x1b6b47=_0x62719a;if(_0x4526dc)return _0xc587a8=_0x4526dc,db[_0x1b6b47('0x62')][_0x1b6b47('0xde')]({'where':{'service':!![]},'include':[{'model':db[_0x1b6b47('0xdf')],'as':_0x1b6b47('0x4a'),'raw':!![]}]});})['then'](function(_0x2ba40c){const _0x15d8d8=_0x62719a;if(_0x2ba40c&&_0x2ba40c['Smtp']&&_0x49bc00[_0x15d8d8('0x55')]){const _0x5d1881={'tls':{'rejectUnauthorized':![]}};return _0x2ba40c[_0x15d8d8('0x4a')][_0x15d8d8('0xc8')]?_0x5d1881[_0x15d8d8('0xc8')]=_0x2ba40c[_0x15d8d8('0x4a')][_0x15d8d8('0xc8')]:(_0x5d1881[_0x15d8d8('0x6d')]=_0x2ba40c['Smtp'][_0x15d8d8('0x6d')],_0x5d1881[_0x15d8d8('0x75')]=_0x2ba40c[_0x15d8d8('0x4a')]['port'],_0x5d1881['secure']=_0x2ba40c[_0x15d8d8('0x4a')][_0x15d8d8('0xd3')]),_0x2ba40c['Smtp'][_0x15d8d8('0xe3')]&&(_0x5d1881[_0x15d8d8('0xe7')]={'user':_0x2ba40c[_0x15d8d8('0x4a')][_0x15d8d8('0x65')],'pass':_0x2ba40c[_0x15d8d8('0x4a')][_0x15d8d8('0xe1')]}),respondWithRpcPromise('SendMail','sendMail',{'account':_0x5d1881,'message':{'from':util[_0x15d8d8('0x9d')](_0x15d8d8('0x37'),_0x2ba40c[_0x15d8d8('0xbb')],_0x2ba40c[_0x15d8d8('0x54')]||_0x2ba40c['Smtp'][_0x15d8d8('0x65')]),'to':_0x49bc00[_0x15d8d8('0x55')],'subject':_0x49bc00['offlineMessageSubject'],'text':_0xc587a8['body']}},client9003)['then'](function(){return _0xc587a8;})[_0x15d8d8('0x41')](function(_0x481d39){const _0x34b96e=_0x15d8d8;console[_0x34b96e('0x11')](_0x481d39);});}})[_0x62719a('0x70')](function(){if(_0xc587a8)return _0xc587a8;})[_0x62719a('0x70')](respondWithResult(_0x3e377d,null))[_0x62719a('0x41')](handleError(_0x3e377d,null));},exports[_0x3ad545('0xdd')]=function(_0x26eefa,_0x578eae){const _0xee1f05=_0x3ad545;return db[_0xee1f05('0x22')]['findOne']({'where':{'id':_0x26eefa[_0xee1f05('0x56')]['id']}})[_0xee1f05('0x70')](function(_0x282e59){const _0x2451e0=_0xee1f05;if(_0x282e59)return _0x282e59['addInteraction'](_0x26eefa[_0x2451e0('0x8')][_0x2451e0('0x6e')],{'through':_[_0x2451e0('0xc6')](_0x26eefa[_0x2451e0('0x8')],[_0x2451e0('0x6e'),'id'])});})[_0xee1f05('0x70')](respondWithResult(_0x578eae,null))[_0xee1f05('0x41')](handleError(_0x578eae,null));},exports[_0x3ad545('0xd9')]=function(_0x29502a,_0x990976){const _0xe7c32e=_0x3ad545;let _0x92b96e={'raw':![],'where':{}};const _0x45c1c9={},_0x5a0271={'count':0x0,'rows':[]};return db[_0xe7c32e('0xa7')][_0xe7c32e('0xde')]({'where':{'id':_0x29502a[_0xe7c32e('0x56')]['id']}})['then'](handleEntityNotFound(_0x990976,null))[_0xe7c32e('0x70')](function(_0x4d2816){const _0x3d04a7=_0xe7c32e;if(_0x4d2816)return _0x45c1c9[_0x3d04a7('0xc9')]=_[_0x3d04a7('0x5d')](db[_0x3d04a7('0x22')]['rawAttributes']),_0x45c1c9[_0x3d04a7('0x80')]=_['keys'](_0x29502a['query']),_0x45c1c9[_0x3d04a7('0x48')]=_[_0x3d04a7('0xd5')](_0x45c1c9[_0x3d04a7('0xc9')],_0x45c1c9[_0x3d04a7('0x80')]),_0x92b96e[_0x3d04a7('0xa1')]=_[_0x3d04a7('0xd5')](_0x45c1c9[_0x3d04a7('0xc9')],qs[_0x3d04a7('0x93')](_0x29502a['query'][_0x3d04a7('0x93')])),_0x92b96e[_0x3d04a7('0xa1')]=_0x92b96e[_0x3d04a7('0xa1')]['length']?_0x92b96e[_0x3d04a7('0xa1')]:_0x45c1c9['model'],typeof _0x29502a['query']['nolimit']===_0x3d04a7('0xa0')&&(_0x92b96e['limit']=qs[_0x3d04a7('0xa3')](_0x29502a['query']['limit']),_0x92b96e['offset']=qs[_0x3d04a7('0x6')](_0x29502a[_0x3d04a7('0x80')][_0x3d04a7('0x6')])),_0x92b96e[_0x3d04a7('0x23')]=qs[_0x3d04a7('0xb')](_0x29502a[_0x3d04a7('0x80')][_0x3d04a7('0xb')]),_0x92b96e[_0x3d04a7('0x76')]=qs['filters'](_[_0x3d04a7('0x60')](_0x29502a[_0x3d04a7('0x80')],_0x45c1c9['filters'])),_0x92b96e[_0x3d04a7('0x76')][_0x3d04a7('0xe4')]=_0x4d2816['id'],_0x29502a[_0x3d04a7('0x80')][_0x3d04a7('0x71')]&&(_0x92b96e[_0x3d04a7('0x76')]=_['merge'](_0x92b96e[_0x3d04a7('0x76')],{[Op['or']]:_[_0x3d04a7('0xf4')](_0x92b96e['attributes'],function(_0x1b11bf){const _0x264d17=_0x3d04a7,_0x2fc09d={};return _0x2fc09d[_0x1b11bf]={[Op[_0x264d17('0x83')]]:'%'+_0x29502a['query'][_0x264d17('0x71')]+'%'},_0x2fc09d;})})),_0x92b96e=_[_0x3d04a7('0xae')]({},_0x92b96e,_0x29502a[_0x3d04a7('0xc1')]),db[_0x3d04a7('0x22')][_0x3d04a7('0xab')]({'where':_0x92b96e[_0x3d04a7('0x76')]})[_0x3d04a7('0x70')](function(_0x321b49){const _0x5dabcd=_0x3d04a7;return _0x5a0271[_0x5dabcd('0xab')]=_0x321b49,_0x29502a[_0x5dabcd('0x80')][_0x5dabcd('0xdc')]&&(_0x92b96e[_0x5dabcd('0xb3')]=[{'model':db[_0x5dabcd('0x87')],'as':_0x5dabcd('0xf2'),'required':![]},{'model':db[_0x5dabcd('0x46')],'as':_0x5dabcd('0xa6'),'attributes':[_0x5dabcd('0xbb'),'fullname',_0x5dabcd('0x32')],'required':![]},{'model':db[_0x5dabcd('0x5c')],'as':'Tags','attributes':['id',_0x5dabcd('0xbb'),_0x5dabcd('0xd1')],'where':_0x29502a[_0x5dabcd('0x80')][_0x5dabcd('0x89')]?{'id':_0x29502a['query']['tag']}:undefined,'required':_0x29502a[_0x5dabcd('0x80')][_0x5dabcd('0x89')]?!![]:![]}]),db[_0x5dabcd('0x22')][_0x5dabcd('0xf')](_0x92b96e);})['then'](function(_0x445271){const _0x1d90b6=_0x3d04a7;return _0x5a0271[_0x1d90b6('0x17')]=_0x445271,_0x5a0271;});})['then'](respondWithFilteredResult(_0x990976,_0x92b96e))[_0xe7c32e('0x41')](handleError(_0x990976,null));};function iftimePromise(_0x4581a5,_0x85bc17){const _0x117d69=_0x3ad545;return respondWithRpcPromise(_0x117d69('0x9b'),_0x117d69('0x45'),{'command':_0x85bc17[_0x117d69('0xea')]?util[_0x117d69('0x9d')](_0x117d69('0xeb'),_0x4581a5['interval'],_0x85bc17[_0x117d69('0xea')]):util['format'](_0x117d69('0xcc'),_0x4581a5['interval'])},client9002)['then'](function(_0x23f237){const _0x3b1163=_0x117d69,_0x23662a=_0x23f237&&_0x23f237[_0x3b1163('0x1f')]('true')>=0x0?!![]:![];return logger[_0x3b1163('0xd8')](_0x3b1163('0xd4'),_0x85bc17['id'],_0x4581a5['id'],_0x4581a5['interval'],_0x23662a?'ONLINE':_0x3b1163('0x81'),_0x85bc17[_0x3b1163('0xea')]?_0x85bc17['timezone']:_0x3b1163('0x100')),_0x23662a;})[_0x117d69('0x41')](function(_0x3dd184){const _0x59dbf7=_0x117d69;return logger[_0x59dbf7('0x11')](_0x59dbf7('0xd4'),_0x85bc17['id'],_0x4581a5['id'],_0x4581a5[_0x59dbf7('0x72')],util['inspect'](_0x3dd184,{'showHidden':![],'depth':null}),_0x85bc17[_0x59dbf7('0xea')]?_0x85bc17[_0x59dbf7('0xea')]:_0x59dbf7('0x100')),![];});}exports['getSnippet']=function(_0x5e0cfb,_0x172e19){const _0x45d4c2=_0x3ad545;let _0x2e5d98=0x0,_0x43e688=0x0,_0x3356a6=![],_0x1b4451,_0x159f01;return db[_0x45d4c2('0xa7')]['findOne']({'where':{'id':_0x5e0cfb[_0x45d4c2('0x56')]['id']},'include':[{'model':db['Interval'],'as':_0x45d4c2('0xc2'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x45d4c2('0x70')](handleEntityNotFound(_0x172e19,null))['then'](function(_0x16bd61){const _0x322ac8=_0x45d4c2;if(_0x16bd61)return _0x1b4451=_0x16bd61,_0x16bd61[_0x322ac8('0x3')]({'raw':!![]});})[_0x45d4c2('0x70')](function(_0x35502d){const _0x32f4a8=_0x45d4c2;return _0x1b4451&&(_0x35502d&&(_0x159f01=_0x35502d)),require(_0x32f4a8('0xb1'))[_0x32f4a8('0xff')]();})[_0x45d4c2('0x70')](function(_0x365679){const _0xb0edfc=_0x45d4c2;_0x365679&&(_0x43e688=_0x365679[_0xb0edfc('0x4b')],_0x3356a6=_0x365679[_0xb0edfc('0x59')]);})[_0x45d4c2('0x70')](function(){const _0x5f2cb3=_0x45d4c2;return db[_0x5f2cb3('0x22')]['count']({'where':{'closed':![]}});})[_0x45d4c2('0x70')](function(_0x12407e){const _0x40fa53=_0x45d4c2;_0x2e5d98=_0x12407e;if(_0x43e688&&_0x12407e>_0x43e688)return db[_0x40fa53('0x7a')][_0x40fa53('0xde')]({'where':{'id':0x1}})['then'](function(_0x283b6f){const _0x202f7c=_0x40fa53;_0x283b6f&&_0x283b6f[_0x202f7c('0xdb')](_0x202f7c('0x2b'));});})[_0x45d4c2('0x70')](function(){const _0x74bbea=_0x45d4c2;if(_0x1b4451[_0x74bbea('0xc2')]&&_0x1b4451['Interval'][_0x74bbea('0x4c')]){const _0x66dd6f=[];for(let _0x489f5e=0x0;_0x489f5e<_0x1b4451[_0x74bbea('0xc2')][_0x74bbea('0x4c')][_0x74bbea('0xc5')];_0x489f5e++){const _0x38550a=_0x1b4451['Interval']['Intervals'][_0x489f5e][_0x74bbea('0x2e')]({'plain':!![]});_0x66dd6f[_0x74bbea('0x26')](iftimePromise(_0x38550a,_0x1b4451));}return Promise[_0x74bbea('0x58')](_0x66dd6f)[_0x74bbea('0x70')](function(_0xeea695){const _0x113ec6=_0x74bbea;return _[_0x113ec6('0xa')](_0xeea695);});}else return!![];})[_0x45d4c2('0x70')](function(_0x29c578){const _0x3c55c6=_0x45d4c2,_0x3bc510=_0x5e0cfb[_0x3c55c6('0x27')][_0x3c55c6('0x2e')](_0x3c55c6('0x92')),_0x8c2329=fs['readFileSync'](path['join'](config[_0x3c55c6('0xd7')],'files/chat/iframe.js'),_0x3c55c6('0x2d')),_0x169296={'chatVersion':_0x3bc510,'remote':_0x1b4451[_0x3c55c6('0x42')],'query':querystring['stringify'](_[_0x3c55c6('0xae')](_0x1b4451[_0x3c55c6('0x2e')]({'plain':!![]}),{'customerIp':_0x5e0cfb[_0x3c55c6('0x25')][_0x3c55c6('0x5b')]||_0x5e0cfb['headers'][_0x3c55c6('0x64')]||_0x5e0cfb['connection'][_0x3c55c6('0x7f')]||_0x5e0cfb['ip'],'referer':_0x5e0cfb[_0x3c55c6('0x25')]['referer'],'openedInteractions':_0x2e5d98,'maxInteractions':_0x43e688,'virtual':_0x3356a6[_0x3c55c6('0x4b')],'online':_0x29c578,'custom':_0x3356a6}))['replace'](/'/g,'\x5c\x27')};_0x172e19[_0x3c55c6('0x30')](ejs['render'](Mustache[_0x3c55c6('0xaa')](_0x8c2329,_0x169296),{'proactiveActions':_0x159f01,'alignment':_0x1b4451[_0x3c55c6('0x90')],'verticalAlignment':_0x1b4451['verticalAlignment'],'div_color':_0x1b4451[_0x3c55c6('0xd1')],'text_color':_0x1b4451[_0x3c55c6('0xb7')]}));})['catch'](handleError(_0x172e19,null));},exports[_0x3ad545('0x79')]=function(_0xb8313b,_0x18ce0f){const _0x145aae=_0x3ad545;return db[_0x145aae('0xa7')][_0x145aae('0xde')]({'where':{'id':_0xb8313b[_0x145aae('0x56')]['id']}})[_0x145aae('0x70')](handleEntityNotFound(_0x18ce0f,null))[_0x145aae('0x70')](function(_0x6f3c31){const _0x30cb88=_0x145aae;if(_0x6f3c31)return db[_0x30cb88('0x51')]['transaction'](function(_0x230b83){const _0x1f0657=_0x30cb88;return db['ChatApplication'][_0x1f0657('0x8e')]({'where':{'ChatWebsiteId':_0xb8313b[_0x1f0657('0x56')]['id']},'transaction':_0x230b83})['then'](function(){const _0xfb9d64=_0x1f0657,_0x127a94=_[_0xfb9d64('0xf4')](_0xb8313b[_0xfb9d64('0x8')],function(_0x37bf8e){const _0x4d8291=_0xfb9d64;return _0x37bf8e[_0x4d8291('0xe4')]=_0xb8313b['params']['id'],_0x37bf8e;});return db[_0xfb9d64('0xee')][_0xfb9d64('0xb4')](_0x127a94,{'transaction':_0x230b83});});})[_0x30cb88('0x70')](function(){const _0x5e6826=_0x30cb88;return db['ChatApplication'][_0x5e6826('0x3f')]({'where':{'ChatWebsiteId':_0xb8313b['params']['id']},'order':_0x5e6826('0xd')});});})[_0x145aae('0x70')](respondWithResult(_0x18ce0f,null))[_0x145aae('0x41')](handleError(_0x18ce0f,null));},exports[_0x3ad545('0xf1')]=function(_0x395706,_0x981a0b){const _0x56ea9e=_0x3ad545;let _0x531a6e={};const _0x49f463={};let _0x5094dd,_0x113e6e;return db[_0x56ea9e('0xa7')][_0x56ea9e('0xde')]({'where':{'id':_0x395706['params']['id']}})[_0x56ea9e('0x70')](handleEntityNotFound(_0x981a0b,null))[_0x56ea9e('0x70')](function(_0x2c5c49){const _0x129dde=_0x56ea9e;if(_0x2c5c49)return _0x5094dd=_0x2c5c49,_0x49f463[_0x129dde('0xc9')]=_[_0x129dde('0x5d')](db['ChatApplication'][_0x129dde('0x2a')]),_0x49f463[_0x129dde('0x80')]=_['keys'](_0x395706[_0x129dde('0x80')]),_0x49f463[_0x129dde('0x48')]=_['intersection'](_0x49f463[_0x129dde('0xc9')],_0x49f463[_0x129dde('0x80')]),_0x531a6e[_0x129dde('0xa1')]=_[_0x129dde('0xd5')](_0x49f463['model'],qs[_0x129dde('0x93')](_0x395706[_0x129dde('0x80')]['fields'])),_0x531a6e[_0x129dde('0xa1')]=_0x531a6e[_0x129dde('0xa1')][_0x129dde('0xc5')]?_0x531a6e['attributes']:_0x49f463['model'],_0x531a6e[_0x129dde('0x23')]=qs['sort'](_0x395706[_0x129dde('0x80')][_0x129dde('0xb')]),_0x531a6e[_0x129dde('0x76')]=qs[_0x129dde('0x48')](_['pick'](_0x395706[_0x129dde('0x80')],_0x49f463[_0x129dde('0x48')])),_0x395706[_0x129dde('0x80')][_0x129dde('0x71')]&&(_0x531a6e[_0x129dde('0x76')]=_[_0x129dde('0xae')](_0x531a6e['where'],{[Op['or']]:_[_0x129dde('0xf4')](_0x531a6e[_0x129dde('0xa1')],function(_0x252b3b){const _0x1fc3b0=_0x129dde,_0x32f63c={};return _0x32f63c[_0x252b3b]={[Op['like']]:'%'+_0x395706[_0x1fc3b0('0x80')][_0x1fc3b0('0x71')]+'%'},_0x32f63c;})})),_0x531a6e=_['merge']({},_0x531a6e,_0x395706[_0x129dde('0xc1')]),_0x5094dd[_0x129dde('0xf1')](_0x531a6e);})['then'](function(_0x29b3f6){const _0xf5a269=_0x56ea9e;if(_0x29b3f6)return _0x113e6e=_0x29b3f6[_0xf5a269('0xc5')],typeof _0x395706[_0xf5a269('0x80')][_0xf5a269('0x6a')]===_0xf5a269('0xa0')&&(_0x531a6e[_0xf5a269('0xa3')]=qs[_0xf5a269('0xa3')](_0x395706[_0xf5a269('0x80')][_0xf5a269('0xa3')]),_0x531a6e[_0xf5a269('0x6')]=qs[_0xf5a269('0x6')](_0x395706['query'][_0xf5a269('0x6')])),_0x5094dd['getApplications'](_0x531a6e);})['then'](function(_0x3b0368){if(_0x3b0368)return _0x3b0368?{'count':_0x113e6e,'rows':_0x3b0368}:null;})[_0x56ea9e('0x70')](respondWithResult(_0x981a0b,null))[_0x56ea9e('0x41')](handleError(_0x981a0b,null));},exports['addProactiveActions']=function(_0x56d24a,_0x21b337){const _0x3efa17=_0x3ad545;return db['chatProactiveAction']['findOne']({'where':{'id':_0x56d24a[_0x3efa17('0x56')]['id']}})['then'](function(_0xc0213f){const _0xcc93f7=_0x3efa17;if(_0xc0213f)return _0xc0213f[_0xcc93f7('0xe5')](_0x56d24a[_0xcc93f7('0x8')][_0xcc93f7('0x6e')],{'through':_[_0xcc93f7('0xc6')](_0x56d24a[_0xcc93f7('0x8')],[_0xcc93f7('0x6e'),'id'])});})['then'](respondWithResult(_0x21b337,null))['catch'](handleError(_0x21b337,null));},exports[_0x3ad545('0x3')]=function(_0xe5f8db,_0x41af86){const _0x56780e=_0x3ad545;let _0x42a269={};const _0x57d6eb={};let _0x241f44,_0x300730;return db[_0x56780e('0xa7')][_0x56780e('0xde')]({'where':{'id':_0xe5f8db['params']['id']}})[_0x56780e('0x70')](handleEntityNotFound(_0x41af86,null))[_0x56780e('0x70')](function(_0x2d68ee){const _0x556918=_0x56780e;if(_0x2d68ee)return _0x241f44=_0x2d68ee,_0x57d6eb[_0x556918('0xc9')]=_[_0x556918('0x5d')](db['ChatProactiveAction'][_0x556918('0x2a')]),_0x57d6eb[_0x556918('0x80')]=_[_0x556918('0x5d')](_0xe5f8db[_0x556918('0x80')]),_0x57d6eb[_0x556918('0x48')]=_[_0x556918('0xd5')](_0x57d6eb['model'],_0x57d6eb[_0x556918('0x80')]),_0x42a269[_0x556918('0xa1')]=_['intersection'](_0x57d6eb[_0x556918('0xc9')],qs[_0x556918('0x93')](_0xe5f8db[_0x556918('0x80')][_0x556918('0x93')])),_0x42a269[_0x556918('0xa1')]=_0x42a269[_0x556918('0xa1')][_0x556918('0xc5')]?_0x42a269['attributes']:_0x57d6eb[_0x556918('0xc9')],_0x42a269['order']=qs[_0x556918('0xb')](_0xe5f8db[_0x556918('0x80')][_0x556918('0xb')]),_0x42a269['where']=qs[_0x556918('0x48')](_[_0x556918('0x60')](_0xe5f8db[_0x556918('0x80')],_0x57d6eb[_0x556918('0x48')])),_0xe5f8db[_0x556918('0x80')][_0x556918('0x71')]&&(_0x42a269['where']=_[_0x556918('0xae')](_0x42a269[_0x556918('0x76')],{[Op['or']]:_['map'](_0x42a269[_0x556918('0xa1')],function(_0x47daa3){const _0x169d53=_0x556918,_0xfeb032={};return _0xfeb032[_0x47daa3]={[Op[_0x169d53('0x83')]]:'%'+_0xe5f8db[_0x169d53('0x80')][_0x169d53('0x71')]+'%'},_0xfeb032;})})),_0x42a269=_[_0x556918('0xae')]({},_0x42a269,_0xe5f8db[_0x556918('0xc1')]),_0x241f44['getProactiveActions'](_0x42a269);})[_0x56780e('0x70')](function(_0x5d5f5b){const _0x2177fd=_0x56780e;if(_0x5d5f5b)return _0x300730=_0x5d5f5b[_0x2177fd('0xc5')],typeof _0xe5f8db[_0x2177fd('0x80')][_0x2177fd('0x6a')]==='undefined'&&(_0x42a269['limit']=qs[_0x2177fd('0xa3')](_0xe5f8db['query'][_0x2177fd('0xa3')]),_0x42a269[_0x2177fd('0x6')]=qs[_0x2177fd('0x6')](_0xe5f8db[_0x2177fd('0x80')][_0x2177fd('0x6')])),_0x241f44['getProactiveActions'](_0x42a269);})['then'](function(_0x20c634){if(_0x20c634)return _0x20c634?{'count':_0x300730,'rows':_0x20c634}:null;})[_0x56780e('0x70')](respondWithResult(_0x41af86,null))[_0x56780e('0x41')](handleError(_0x41af86,null));},exports[_0x3ad545('0x49')]=function(_0x180f07,_0xcb58f7){const _0x1541f4=_0x3ad545,_0xca505d=_0x180f07[_0x1541f4('0x80')][_0x1541f4('0x44')]===_0x1541f4('0x4e')?_0x1541f4('0xbc'):_0x1541f4('0xf6');return db[_0x1541f4('0xa7')][_0x1541f4('0xde')]({'attributes':['id',_0xca505d],'where':{'id':_0x180f07[_0x1541f4('0x56')]['id']}})[_0x1541f4('0x70')](handleEntityNotFound(_0xcb58f7,null))['then'](function(_0x11d3ed){const _0x4fb017=_0x1541f4;if(_0x11d3ed){const _0x491417=_0x11d3ed[_0xca505d],_0x3defb2=_0x491417&&_0x491417['items']?_0x491417[_0x4fb017('0x6f')]:[];_0xcb58f7[_0x4fb017('0x30')]({'fromKey':_[_0x4fb017('0x101')](_0x491417['fromKey'])?undefined:_0x491417['fromKey'],'count':_0x3defb2[_0x4fb017('0xc5')],'rows':_0x3defb2});}})[_0x1541f4('0x41')](handleError(_0xcb58f7,null));},exports[_0x3ad545('0xa2')]=function(_0x28de94,_0x3603d7){const _0x1df1bf=_0x3ad545;let _0x3dd26e={'raw':![],'where':{}};const _0x12fe48={},_0x26aaa6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1df1bf('0xde')]({'where':{'id':_0x28de94[_0x1df1bf('0x56')]['id']}})[_0x1df1bf('0x70')](handleEntityNotFound(_0x3603d7,null))[_0x1df1bf('0x70')](function(_0x3d0887){const _0x550137=_0x1df1bf;if(_0x3d0887)return _0x12fe48[_0x550137('0xc9')]=_[_0x550137('0x5d')](db[_0x550137('0xc7')][_0x550137('0x2a')]),_0x12fe48['query']=_['keys'](_0x28de94[_0x550137('0x80')]),_0x12fe48[_0x550137('0x48')]=_[_0x550137('0xd5')](_0x12fe48[_0x550137('0xc9')],_0x12fe48[_0x550137('0x80')]),_0x3dd26e[_0x550137('0xa1')]=_[_0x550137('0xd5')](_0x12fe48[_0x550137('0xc9')],qs[_0x550137('0x93')](_0x28de94[_0x550137('0x80')][_0x550137('0x93')])),_0x3dd26e[_0x550137('0xa1')]=_0x3dd26e[_0x550137('0xa1')]['length']?_0x3dd26e[_0x550137('0xa1')]:_0x12fe48[_0x550137('0xc9')],typeof _0x28de94[_0x550137('0x80')][_0x550137('0x6a')]===_0x550137('0xa0')&&(_0x3dd26e['limit']=qs[_0x550137('0xa3')](_0x28de94[_0x550137('0x80')][_0x550137('0xa3')]),_0x3dd26e[_0x550137('0x6')]=qs[_0x550137('0x6')](_0x28de94[_0x550137('0x80')]['offset'])),_0x3dd26e[_0x550137('0x23')]=qs['sort'](_0x28de94[_0x550137('0x80')][_0x550137('0xb')]),_0x3dd26e[_0x550137('0x76')]=qs['filters'](_[_0x550137('0x60')](_0x28de94[_0x550137('0x80')],_0x12fe48[_0x550137('0x48')])),_0x3dd26e['where'][_0x550137('0xe4')]=_0x3d0887['id'],_0x28de94['query']['filter']&&(_0x3dd26e[_0x550137('0x76')]=_[_0x550137('0xae')](_0x3dd26e[_0x550137('0x76')],{[Op['or']]:_[_0x550137('0xf4')](_0x3dd26e[_0x550137('0xa1')],function(_0x2e3d63){const _0x560f1d=_0x550137,_0xecb2f4={};return _0xecb2f4[_0x2e3d63]={[Op[_0x560f1d('0x83')]]:'%'+_0x28de94[_0x560f1d('0x80')][_0x560f1d('0x71')]+'%'},_0xecb2f4;})})),_0x3dd26e=_[_0x550137('0xae')]({},_0x3dd26e,_0x28de94[_0x550137('0xc1')]),db[_0x550137('0xc7')][_0x550137('0xab')]({'where':_0x3dd26e[_0x550137('0x76')]})[_0x550137('0x70')](function(_0x55782c){const _0x1daafd=_0x550137;return _0x26aaa6[_0x1daafd('0xab')]=_0x55782c,_0x28de94[_0x1daafd('0x80')][_0x1daafd('0xdc')]?_0x3dd26e['include']=[{'all':!![]}]:_0x3dd26e[_0x1daafd('0xb3')]=[{'model':db['CmContact'],'as':'Contact','required':![]}],db[_0x1daafd('0xc7')][_0x1daafd('0xf')](_0x3dd26e);})[_0x550137('0x70')](function(_0x4fd811){const _0x4c070e=_0x550137;return _0x26aaa6[_0x4c070e('0x17')]=_0x4fd811,_0x26aaa6;});})[_0x1df1bf('0x70')](respondWithFilteredResult(_0x3603d7,_0x3dd26e))[_0x1df1bf('0x41')](handleError(_0x3603d7,null));},exports['addAgents']=function(_0x2dad1f,_0x208a2a){const _0x2821a6=_0x3ad545;return db[_0x2821a6('0xa7')][_0x2821a6('0xde')]({'where':{'id':_0x2dad1f['params']['id']}})[_0x2821a6('0x70')](function(_0x2a58dd){const _0x48b22f=_0x2821a6;if(_0x2a58dd)return _0x2a58dd[_0x48b22f('0x28')](_0x2dad1f[_0x48b22f('0x8')][_0x48b22f('0x6e')],{'through':_[_0x48b22f('0xc6')](_0x2dad1f[_0x48b22f('0x8')],[_0x48b22f('0x6e'),'id'])})[_0x48b22f('0x70')](function(_0x38a61f){const _0xa9e2c=_0x48b22f;for(let _0x3571f2=0x0;_0x3571f2<_0x2dad1f[_0xa9e2c('0x8')]['ids'][_0xa9e2c('0xc5')];_0x3571f2+=0x1){socket[_0xa9e2c('0xed')](_0xa9e2c('0x9a'),{'UserId':_0x2dad1f[_0xa9e2c('0x8')][_0xa9e2c('0x6e')][_0x3571f2],'ChatWebsiteId':_0x2dad1f['params']['id']});}return _0x38a61f;});})[_0x2821a6('0x70')](respondWithResult(_0x208a2a,null))[_0x2821a6('0x41')](handleError(_0x208a2a,null));},exports['removeAgents']=function(_0x4021a0,_0x520a10){const _0x4f6d02=_0x3ad545;return db[_0x4f6d02('0xa7')]['findOne']({'where':{'id':_0x4021a0[_0x4f6d02('0x56')]['id']}})['then'](handleEntityNotFound(_0x520a10,null))['then'](function(_0x6f6515){const _0x3ea0bf=_0x4f6d02;if(_0x6f6515)return _0x6f6515[_0x3ea0bf('0x21')](_0x4021a0[_0x3ea0bf('0x80')][_0x3ea0bf('0x6e')])[_0x3ea0bf('0x70')](function(){const _0x5ceef4=_0x3ea0bf;if(_[_0x5ceef4('0x47')](_0x4021a0[_0x5ceef4('0x80')]['ids']))for(let _0x5af686=0x0;_0x5af686<_0x4021a0[_0x5ceef4('0x80')]['ids'][_0x5ceef4('0xc5')];_0x5af686+=0x1){socket[_0x5ceef4('0xed')]('userChatWebsite:remove',{'UserId':Number(_0x4021a0['query'][_0x5ceef4('0x6e')][_0x5af686]),'ChatWebsiteId':Number(_0x4021a0[_0x5ceef4('0x56')]['id'])});}else socket[_0x5ceef4('0xed')](_0x5ceef4('0x1d'),{'UserId':Number(_0x4021a0['query'][_0x5ceef4('0x6e')]),'ChatWebsiteId':Number(_0x4021a0['params']['id'])});});})['then'](respondWithStatusCode(_0x520a10,null))['catch'](handleError(_0x520a10,null));},exports[_0x3ad545('0x82')]=function(_0x567616,_0x1a54bf){const _0x25a1a3=_0x3ad545;let _0x38534f={};const _0x5734a1={};let _0x457ddb,_0x25de4a;return db[_0x25a1a3('0xa7')][_0x25a1a3('0xde')]({'where':{'id':_0x567616['params']['id']}})['then'](handleEntityNotFound(_0x1a54bf,null))[_0x25a1a3('0x70')](function(_0x3b7491){const _0x1f2b7e=_0x25a1a3;if(_0x3b7491)return _0x457ddb=_0x3b7491,_0x5734a1[_0x1f2b7e('0xc9')]=_[_0x1f2b7e('0x5d')](db[_0x1f2b7e('0x46')]['rawAttributes']),_0x5734a1[_0x1f2b7e('0x80')]=_[_0x1f2b7e('0x5d')](_0x567616['query']),_0x5734a1['filters']=_['intersection'](_0x5734a1['model'],_0x5734a1[_0x1f2b7e('0x80')]),_0x38534f[_0x1f2b7e('0xa1')]=_[_0x1f2b7e('0xd5')](_0x5734a1[_0x1f2b7e('0xc9')],qs[_0x1f2b7e('0x93')](_0x567616[_0x1f2b7e('0x80')]['fields'])),_0x38534f[_0x1f2b7e('0xa1')]=_0x38534f[_0x1f2b7e('0xa1')][_0x1f2b7e('0xc5')]?_0x38534f[_0x1f2b7e('0xa1')]:_0x5734a1['model'],_0x38534f['order']=qs[_0x1f2b7e('0xb')](_0x567616[_0x1f2b7e('0x80')]['sort']),_0x38534f[_0x1f2b7e('0x76')]=qs[_0x1f2b7e('0x48')](_['pick'](_0x567616['query'],_0x5734a1[_0x1f2b7e('0x48')])),_0x567616[_0x1f2b7e('0x80')][_0x1f2b7e('0x71')]&&(_0x38534f['where']=_['merge'](_0x38534f[_0x1f2b7e('0x76')],{[Op['or']]:_[_0x1f2b7e('0xf4')](_0x38534f['attributes'],function(_0x199a9b){const _0x184a35=_0x1f2b7e,_0x4dc372={};return _0x4dc372[_0x199a9b]={[Op['like']]:'%'+_0x567616['query'][_0x184a35('0x71')]+'%'},_0x4dc372;})})),_0x38534f=_[_0x1f2b7e('0xae')]({},_0x38534f,_0x567616[_0x1f2b7e('0xc1')]),_0x457ddb[_0x1f2b7e('0x82')](_0x38534f);})['then'](function(_0x3f3428){const _0x2886fc=_0x25a1a3;if(_0x3f3428)return _0x25de4a=_0x3f3428[_0x2886fc('0xc5')],typeof _0x567616[_0x2886fc('0x80')][_0x2886fc('0x6a')]==='undefined'&&(_0x38534f['limit']=qs[_0x2886fc('0xa3')](_0x567616[_0x2886fc('0x80')][_0x2886fc('0xa3')]),_0x38534f[_0x2886fc('0x6')]=qs['offset'](_0x567616['query']['offset'])),_0x457ddb[_0x2886fc('0x82')](_0x38534f);})[_0x25a1a3('0x70')](function(_0x5001b6){if(_0x5001b6)return _0x5001b6?{'count':_0x25de4a,'rows':_0x5001b6}:null;})['then'](respondWithResult(_0x1a54bf,null))[_0x25a1a3('0x41')](handleError(_0x1a54bf,null));};
\ No newline at end of file