From: Andrea Bianco
Date: Sun, 30 Jan 2022 19:05:16 +0000 (+0100)
Subject: Built motion from commit 85328c08.|2.5.50
X-Git-Tag: 2.5.50~1
X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=ebe00679b2d367c1cf2b2b91609ee1ce4bd8fb94;p=motion2.git
Built motion from commit 85328c08.|2.5.50
---
diff --git a/apidoc/api_project.js b/apidoc/api_project.js
index 935d50e..03a8516 100644
--- a/apidoc/api_project.js
+++ b/apidoc/api_project.js
@@ -17,7 +17,7 @@ define({
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
- "time": "2022-01-30T18:42:18.121Z",
+ "time": "2022-01-30T18:58:23.357Z",
"url": "http://apidocjs.com",
"version": "0.24.0"
}
diff --git a/apidoc/api_project.json b/apidoc/api_project.json
index ddee075..bf38bd2 100644
--- a/apidoc/api_project.json
+++ b/apidoc/api_project.json
@@ -17,7 +17,7 @@
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
- "time": "2022-01-30T18:42:18.121Z",
+ "time": "2022-01-30T18:58:23.357Z",
"url": "http://apidocjs.com",
"version": "0.24.0"
}
diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js
index 93e608c..f922399 100644
--- a/server/api/action/action.attributes.js
+++ b/server/api/action/action.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc7e7=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','browser'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xc7e7,0x13a));var _0x7c7e=function(_0x15e126,_0x56cc1d){_0x15e126=_0x15e126-0x0;var _0x27a50d=_0xc7e7[_0x15e126];return _0x27a50d;};'use strict';var Sequelize=require('sequelize');module[_0x7c7e('0x0')]={'name':{'type':Sequelize[_0x7c7e('0x1')],'get':function(_0x56b707){return this[_0x7c7e('0x2')](_0x7c7e('0x3'));}},'action':{'type':Sequelize[_0x7c7e('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7c7e('0x5'),'integration',_0x7c7e('0x6'),_0x7c7e('0x7'),'urlForward',_0x7c7e('0x8'),_0x7c7e('0x9'),_0x7c7e('0xa')]],'msg':_0x7c7e('0xb')}},'comment':_0x7c7e('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x7c7e('0x4')](0x1000),'comment':_0x7c7e('0xc')},'data3':{'type':Sequelize[_0x7c7e('0x4')](0x1000),'comment':_0x7c7e('0xd')},'data4':{'type':Sequelize[_0x7c7e('0x4')](0x1000),'comments':_0x7c7e('0xe')},'data5':{'type':Sequelize[_0x7c7e('0x4')](0x1000),'comments':_0x7c7e('0xf')},'data6':{'type':Sequelize[_0x7c7e('0x4')],'comments':_0x7c7e('0x10')},'data7':{'type':Sequelize[_0x7c7e('0x11')],'comments':_0x7c7e('0x12')}};
\ No newline at end of file
+var _0xdde1=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser'];(function(_0x538a38,_0x1843fb){var _0x137886=function(_0x5b76d2){while(--_0x5b76d2){_0x538a38['push'](_0x538a38['shift']());}};_0x137886(++_0x1843fb);}(_0xdde1,0x14a));var _0x1dde=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xdde1[_0x380307];return _0x9ea14b;};'use strict';var Sequelize=require(_0x1dde('0x0'));module[_0x1dde('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x411519){return this[_0x1dde('0x2')]('action');}},'action':{'type':Sequelize[_0x1dde('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1dde('0x4'),_0x1dde('0x5'),_0x1dde('0x6'),_0x1dde('0x7'),_0x1dde('0x8'),_0x1dde('0x9'),'bot',_0x1dde('0xa')]],'msg':_0x1dde('0xb')}},'comment':_0x1dde('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x1dde('0x3')](0x1000),'comment':_0x1dde('0xc')},'data3':{'type':Sequelize[_0x1dde('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x1dde('0xd')},'data5':{'type':Sequelize[_0x1dde('0x3')](0x1000),'comments':_0x1dde('0xe')},'data6':{'type':Sequelize[_0x1dde('0x3')],'comments':_0x1dde('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x1dde('0x10')}};
\ No newline at end of file
diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js
index 064f6b9..cf5daff 100644
--- a/server/api/action/action.controller.js
+++ b/server/api/action/action.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x73c7=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','then','destroy','end','stack','name','send','body','find','params','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','squel','crypto','desk.js','to-csv'];(function(_0x3353a6,_0x1c6e93){var _0x2fe073=function(_0x58838c){while(--_0x58838c){_0x3353a6['push'](_0x3353a6['shift']());}};_0x2fe073(++_0x1c6e93);}(_0x73c7,0x176));var _0x773c=function(_0x22f9e5,_0x1f7436){_0x22f9e5=_0x22f9e5-0x0;var _0xa6fe19=_0x73c7[_0x22f9e5];return _0xa6fe19;};'use strict';var emlformat=require(_0x773c('0x0'));var rimraf=require(_0x773c('0x1'));var zipdir=require(_0x773c('0x2'));var jsonpatch=require(_0x773c('0x3'));var rp=require(_0x773c('0x4'));var moment=require(_0x773c('0x5'));var BPromise=require(_0x773c('0x6'));var Mustache=require('mustache');var util=require(_0x773c('0x7'));var path=require('path');var sox=require(_0x773c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x773c('0x9'));var crypto=require(_0x773c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x773c('0xb'));var toCsv=require(_0x773c('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x773c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x773c('0xe'));var as=require(_0x773c('0xf'));var hardwareService=require(_0x773c('0x10'));var logger=require(_0x773c('0x11'))(_0x773c('0x12'));var utils=require(_0x773c('0x13'));var config=require(_0x773c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x773c('0x15'))['db'];function respondWithStatusCode(_0x3d0581,_0x500cdf){_0x500cdf=_0x500cdf||0xcc;return function(_0x8863a1){if(_0x8863a1){return _0x3d0581[_0x773c('0x16')](_0x500cdf);}return _0x3d0581['status'](_0x500cdf)['end']();};}function respondWithResult(_0x2c3711,_0x22cb7c){_0x22cb7c=_0x22cb7c||0xc8;return function(_0x255280){if(_0x255280){return _0x2c3711[_0x773c('0x17')](_0x22cb7c)['json'](_0x255280);}};}function respondWithFilteredResult(_0x11971f,_0x55a1df){return function(_0x3b5daf){if(_0x3b5daf){var _0x1547e1=typeof _0x55a1df[_0x773c('0x18')]===_0x773c('0x19')&&typeof _0x55a1df[_0x773c('0x1a')]===_0x773c('0x19');var _0x228b72=_0x3b5daf[_0x773c('0x1b')];var _0xaa8766=_0x1547e1?0x0:_0x55a1df[_0x773c('0x18')];var _0x3dfb6c=_0x1547e1?_0x3b5daf[_0x773c('0x1b')]:_0x55a1df['offset']+_0x55a1df['limit'];var _0x572f43;if(_0x3dfb6c>=_0x228b72){_0x3dfb6c=_0x228b72;_0x572f43=0xc8;}else{_0x572f43=0xce;}_0x11971f[_0x773c('0x17')](_0x572f43);return _0x11971f[_0x773c('0x1c')]('Content-Range',_0xaa8766+'-'+_0x3dfb6c+'/'+_0x228b72)[_0x773c('0x1d')](_0x3b5daf);}return null;};}function patchUpdates(_0x42e4bb){return function(_0xb84b4){try{jsonpatch[_0x773c('0x1e')](_0xb84b4,_0x42e4bb,!![]);}catch(_0x23640b){return BPromise[_0x773c('0x1f')](_0x23640b);}return _0xb84b4['save']();};}function saveUpdates(_0x3cdb0b,_0x533965){return function(_0x241ad4){if(_0x241ad4){return _0x241ad4['update'](_0x3cdb0b)[_0x773c('0x20')](function(_0x2797ae){return _0x2797ae;});}return null;};}function removeEntity(_0x1492ec,_0x2034a9){return function(_0x41bc1e){if(_0x41bc1e){return _0x41bc1e[_0x773c('0x21')]()[_0x773c('0x20')](function(){_0x1492ec['status'](0xcc)[_0x773c('0x22')]();});}};}function handleEntityNotFound(_0xe46588,_0x1dd7f5){return function(_0x2d3fb6){if(!_0x2d3fb6){_0xe46588[_0x773c('0x16')](0x194);}return _0x2d3fb6;};}function handleError(_0xb9aa38,_0xa54d89){_0xa54d89=_0xa54d89||0x1f4;return function(_0x425bd3){logger['error'](_0x425bd3[_0x773c('0x23')]);if(_0x425bd3[_0x773c('0x24')]){delete _0x425bd3[_0x773c('0x24')];}_0xb9aa38[_0x773c('0x17')](_0xa54d89)[_0x773c('0x25')](_0x425bd3);};}exports['update']=function(_0x42f611,_0x285da0){if(_0x42f611[_0x773c('0x26')]['id']){delete _0x42f611[_0x773c('0x26')]['id'];}return db['Action'][_0x773c('0x27')]({'where':{'id':_0x42f611[_0x773c('0x28')]['id']}})[_0x773c('0x20')](handleEntityNotFound(_0x285da0,null))[_0x773c('0x20')](saveUpdates(_0x42f611['body'],null))[_0x773c('0x20')](respondWithResult(_0x285da0,null))[_0x773c('0x29')](handleError(_0x285da0,null));};exports['destroy']=function(_0x4c2639,_0x4dc943){return db[_0x773c('0x2a')][_0x773c('0x27')]({'where':{'id':_0x4c2639['params']['id']}})['then'](handleEntityNotFound(_0x4dc943,null))[_0x773c('0x20')](removeEntity(_0x4dc943,null))['catch'](handleError(_0x4dc943,null));};
\ No newline at end of file
+var _0xe110=['destroy','then','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save'];(function(_0x569fef,_0x49c37a){var _0x11f20b=function(_0x3721d8){while(--_0x3721d8){_0x569fef['push'](_0x569fef['shift']());}};_0x11f20b(++_0x49c37a);}(_0xe110,0xcf));var _0x0e11=function(_0x2591e1,_0x1ef4f4){_0x2591e1=_0x2591e1-0x0;var _0x181343=_0xe110[_0x2591e1];return _0x181343;};'use strict';var emlformat=require(_0x0e11('0x0'));var rimraf=require(_0x0e11('0x1'));var zipdir=require(_0x0e11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e11('0x3'));var moment=require('moment');var BPromise=require(_0x0e11('0x4'));var Mustache=require(_0x0e11('0x5'));var util=require(_0x0e11('0x6'));var path=require(_0x0e11('0x7'));var sox=require(_0x0e11('0x8'));var csv=require(_0x0e11('0x9'));var ejs=require(_0x0e11('0xa'));var fs=require('fs');var fs_extra=require(_0x0e11('0xb'));var _=require(_0x0e11('0xc'));var squel=require('squel');var crypto=require(_0x0e11('0xd'));var jsforce=require(_0x0e11('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e11('0x9'));var querystring=require(_0x0e11('0xf'));var Papa=require(_0x0e11('0x10'));var Redis=require(_0x0e11('0x11'));var authService=require(_0x0e11('0x12'));var qs=require(_0x0e11('0x13'));var as=require(_0x0e11('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e11('0x15'))(_0x0e11('0x16'));var utils=require(_0x0e11('0x17'));var config=require(_0x0e11('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e11('0x19'))['db'];function respondWithStatusCode(_0x46c19e,_0xb12ac2){_0xb12ac2=_0xb12ac2||0xcc;return function(_0x63c9eb){if(_0x63c9eb){return _0x46c19e[_0x0e11('0x1a')](_0xb12ac2);}return _0x46c19e[_0x0e11('0x1b')](_0xb12ac2)[_0x0e11('0x1c')]();};}function respondWithResult(_0x14f941,_0x3a5cd2){_0x3a5cd2=_0x3a5cd2||0xc8;return function(_0x5767a0){if(_0x5767a0){return _0x14f941[_0x0e11('0x1b')](_0x3a5cd2)[_0x0e11('0x1d')](_0x5767a0);}};}function respondWithFilteredResult(_0x5d0c6e,_0x29fb1e){return function(_0x454224){if(_0x454224){var _0x3be52f=typeof _0x29fb1e['offset']===_0x0e11('0x1e')&&typeof _0x29fb1e[_0x0e11('0x1f')]==='undefined';var _0x350f7c=_0x454224[_0x0e11('0x20')];var _0x414e7b=_0x3be52f?0x0:_0x29fb1e[_0x0e11('0x21')];var _0x2b78d8=_0x3be52f?_0x454224[_0x0e11('0x20')]:_0x29fb1e['offset']+_0x29fb1e['limit'];var _0x519bbe;if(_0x2b78d8>=_0x350f7c){_0x2b78d8=_0x350f7c;_0x519bbe=0xc8;}else{_0x519bbe=0xce;}_0x5d0c6e[_0x0e11('0x1b')](_0x519bbe);return _0x5d0c6e[_0x0e11('0x22')]('Content-Range',_0x414e7b+'-'+_0x2b78d8+'/'+_0x350f7c)['json'](_0x454224);}return null;};}function patchUpdates(_0x487131){return function(_0x53e363){try{jsonpatch[_0x0e11('0x23')](_0x53e363,_0x487131,!![]);}catch(_0x2c5783){return BPromise[_0x0e11('0x24')](_0x2c5783);}return _0x53e363[_0x0e11('0x25')]();};}function saveUpdates(_0x2f5efc,_0x1898f1){return function(_0x2455d0){if(_0x2455d0){return _0x2455d0['update'](_0x2f5efc)['then'](function(_0x2595a5){return _0x2595a5;});}return null;};}function removeEntity(_0x447561,_0xe9cc42){return function(_0x16e374){if(_0x16e374){return _0x16e374[_0x0e11('0x26')]()[_0x0e11('0x27')](function(){_0x447561['status'](0xcc)[_0x0e11('0x1c')]();});}};}function handleEntityNotFound(_0xb1d939,_0x11f4f6){return function(_0x544dce){if(!_0x544dce){_0xb1d939[_0x0e11('0x1a')](0x194);}return _0x544dce;};}function handleError(_0x575930,_0x4c1dd1){_0x4c1dd1=_0x4c1dd1||0x1f4;return function(_0x56b918){logger['error'](_0x56b918[_0x0e11('0x28')]);if(_0x56b918['name']){delete _0x56b918[_0x0e11('0x29')];}_0x575930[_0x0e11('0x1b')](_0x4c1dd1)[_0x0e11('0x2a')](_0x56b918);};}exports[_0x0e11('0x2b')]=function(_0x7f52a6,_0x232fc9){if(_0x7f52a6[_0x0e11('0x2c')]['id']){delete _0x7f52a6[_0x0e11('0x2c')]['id'];}return db[_0x0e11('0x2d')][_0x0e11('0x2e')]({'where':{'id':_0x7f52a6[_0x0e11('0x2f')]['id']}})[_0x0e11('0x27')](handleEntityNotFound(_0x232fc9,null))[_0x0e11('0x27')](saveUpdates(_0x7f52a6[_0x0e11('0x2c')],null))['then'](respondWithResult(_0x232fc9,null))[_0x0e11('0x30')](handleError(_0x232fc9,null));};exports[_0x0e11('0x26')]=function(_0x17c7fb,_0x2440bf){return db[_0x0e11('0x2d')][_0x0e11('0x2e')]({'where':{'id':_0x17c7fb[_0x0e11('0x2f')]['id']}})[_0x0e11('0x27')](handleEntityNotFound(_0x2440bf,null))['then'](removeEntity(_0x2440bf,null))[_0x0e11('0x30')](handleError(_0x2440bf,null));};
\ No newline at end of file
diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js
index 5a46718..431be29 100644
--- a/server/api/action/action.model.js
+++ b/server/api/action/action.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5c12=['exports','tools_actions','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0x5c12,0xac));var _0x25c1=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x5c12[_0x2353fe];return _0x4d43f6;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require('./action.attributes');module[_0x25c1('0x8')]=function(_0x22ff28,_0x38ecbd){return _0x22ff28['define']('Action',attributes,{'tableName':_0x25c1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4d43=['exports','define','Action','tools_actions','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x18811b,_0x6bede4){var _0x2fbee4=function(_0x4dcf84){while(--_0x4dcf84){_0x18811b['push'](_0x18811b['shift']());}};_0x2fbee4(++_0x6bede4);}(_0x4d43,0x154));var _0x34d4=function(_0x9798fd,_0x37765d){_0x9798fd=_0x9798fd-0x0;var _0x41789e=_0x4d43[_0x9798fd];return _0x41789e;};'use strict';var _=require(_0x34d4('0x0'));var util=require(_0x34d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x34d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x34d4('0x3'));var fs=require('fs');var path=require(_0x34d4('0x4'));var rimraf=require(_0x34d4('0x5'));var config=require(_0x34d4('0x6'));var attributes=require(_0x34d4('0x7'));module[_0x34d4('0x8')]=function(_0x37b23d,_0x3aa141){return _0x37b23d[_0x34d4('0x9')](_0x34d4('0xa'),attributes,{'tableName':_0x34d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js
index 13c47df..157d6a1 100644
--- a/server/api/action/action.rpc.js
+++ b/server/api/action/action.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1cb81c,_0x429ed1){var _0x38a2af=function(_0x31c222){while(--_0x31c222){_0x1cb81c['push'](_0x1cb81c['shift']());}};_0x38a2af(++_0x429ed1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}
\ No newline at end of file
+var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x35612e,_0x1b738c){_0x35612e=_0x35612e-0x0;var _0x20d52d=_0x7a54[_0x35612e];return _0x20d52d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}
\ No newline at end of file
diff --git a/server/api/action/index.js b/server/api/action/index.js
index 481c55d..ea13cd6 100644
--- a/server/api/action/index.js
+++ b/server/api/action/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x6365=['express','Router','fs-extra','../../components/auth/service','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6365,0x1d9));var _0x5636=function(_0x3b1a41,_0x24f62e){_0x3b1a41=_0x3b1a41-0x0;var _0x598089=_0x6365[_0x3b1a41];return _0x598089;};'use strict';var multer=require(_0x5636('0x0'));var util=require('util');var path=require(_0x5636('0x1'));var timeout=require(_0x5636('0x2'));var express=require(_0x5636('0x3'));var router=express[_0x5636('0x4')]();var fs_extra=require(_0x5636('0x5'));var auth=require(_0x5636('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./action.controller');router[_0x5636('0x7')](_0x5636('0x8'),auth[_0x5636('0x9')](),controller[_0x5636('0xa')]);router[_0x5636('0xb')](_0x5636('0x8'),auth[_0x5636('0x9')](),controller[_0x5636('0xc')]);module[_0x5636('0xd')]=router;
\ No newline at end of file
+var _0xcf7f=['util','path','connect-timeout','express','Router','fs-extra','./action.controller','put','/:id','isAuthenticated','exports','multer'];(function(_0x32b5b1,_0x1da9ad){var _0x1fcc4c=function(_0x120e25){while(--_0x120e25){_0x32b5b1['push'](_0x32b5b1['shift']());}};_0x1fcc4c(++_0x1da9ad);}(_0xcf7f,0x1a3));var _0xfcf7=function(_0x37b9f7,_0x33e9a1){_0x37b9f7=_0x37b9f7-0x0;var _0x311feb=_0xcf7f[_0x37b9f7];return _0x311feb;};'use strict';var multer=require(_0xfcf7('0x0'));var util=require(_0xfcf7('0x1'));var path=require(_0xfcf7('0x2'));var timeout=require(_0xfcf7('0x3'));var express=require(_0xfcf7('0x4'));var router=express[_0xfcf7('0x5')]();var fs_extra=require(_0xfcf7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfcf7('0x7'));router[_0xfcf7('0x8')](_0xfcf7('0x9'),auth[_0xfcf7('0xa')](),controller['update']);router['delete']('/:id',auth[_0xfcf7('0xa')](),controller['destroy']);module[_0xfcf7('0xb')]=router;
\ No newline at end of file
diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js
index ba72406..7a905cf 100644
--- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js
+++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x385eb1,_0x497a94){var _0x5d40eb=function(_0x159029){while(--_0x159029){_0x385eb1['push'](_0x385eb1['shift']());}};_0x5d40eb(++_0x497a94);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0xf2ca[_0x507597];return _0x110a0f;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}};
\ No newline at end of file
+var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x1ec684,_0xee510d){var _0x4477ed=function(_0x13777d){while(--_0x13777d){_0x1ec684['push'](_0x1ec684['shift']());}};_0x4477ed(++_0xee510d);}(_0xac9d,0x14d));var _0xdac9=function(_0x5dc45d,_0x55f90f){_0x5dc45d=_0x5dc45d-0x0;var _0x4ce697=_0xac9d[_0x5dc45d];return _0x4ce697;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}};
\ No newline at end of file
diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js
index 4b91569..091c1da 100644
--- a/server/api/analyticCustomReport/analyticCustomReport.controller.js
+++ b/server/api/analyticCustomReport/analyticCustomReport.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x36ae=['AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','left_join','AnalyticMetric','debug','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','AnalyticCustomReport','rawAttributes','type','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','intersection','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','from','table','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','MIN(%s)','HOUR(%s)','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','MetricId','%s.%s\x20=\x20%s.%s','web','fullPath','%s-%s.%s','randomstring','generate','output','custom'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ae,0xb3));var _0xe36a=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0x36ae[_0x5ae8f7];return _0x54c636;};'use strict';var emlformat=require(_0xe36a('0x0'));var rimraf=require(_0xe36a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe36a('0x2'));var rp=require(_0xe36a('0x3'));var moment=require('moment');var BPromise=require(_0xe36a('0x4'));var Mustache=require(_0xe36a('0x5'));var util=require(_0xe36a('0x6'));var path=require(_0xe36a('0x7'));var sox=require(_0xe36a('0x8'));var csv=require(_0xe36a('0x9'));var ejs=require(_0xe36a('0xa'));var fs=require('fs');var fs_extra=require(_0xe36a('0xb'));var _=require(_0xe36a('0xc'));var squel=require(_0xe36a('0xd'));var crypto=require('crypto');var jsforce=require(_0xe36a('0xe'));var deskjs=require(_0xe36a('0xf'));var toCsv=require(_0xe36a('0x9'));var querystring=require(_0xe36a('0x10'));var Papa=require(_0xe36a('0x11'));var Redis=require(_0xe36a('0x12'));var authService=require(_0xe36a('0x13'));var qs=require(_0xe36a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe36a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe36a('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe36a('0x17'))['dbH'];function respondWithStatusCode(_0x273a4f,_0x42c8ee){_0x42c8ee=_0x42c8ee||0xcc;return function(_0x2865c7){if(_0x2865c7){return _0x273a4f[_0xe36a('0x18')](_0x42c8ee);}return _0x273a4f['status'](_0x42c8ee)[_0xe36a('0x19')]();};}function respondWithResult(_0x6492c5,_0x4d6887){_0x4d6887=_0x4d6887||0xc8;return function(_0x3ea0a6){if(_0x3ea0a6){return _0x6492c5['status'](_0x4d6887)[_0xe36a('0x1a')](_0x3ea0a6);}};}function respondWithFilteredResult(_0x57ecdf,_0x2517a6){return function(_0x703f42){if(_0x703f42){var _0xca4ac0=typeof _0x2517a6[_0xe36a('0x1b')]===_0xe36a('0x1c')&&typeof _0x2517a6['limit']===_0xe36a('0x1c');var _0x2a713b=_0x703f42[_0xe36a('0x1d')];var _0x652a6=_0xca4ac0?0x0:_0x2517a6[_0xe36a('0x1b')];var _0x155066=_0xca4ac0?_0x703f42[_0xe36a('0x1d')]:_0x2517a6[_0xe36a('0x1b')]+_0x2517a6[_0xe36a('0x1e')];var _0x55eecf;if(_0x155066>=_0x2a713b){_0x155066=_0x2a713b;_0x55eecf=0xc8;}else{_0x55eecf=0xce;}_0x57ecdf[_0xe36a('0x1f')](_0x55eecf);return _0x57ecdf[_0xe36a('0x20')](_0xe36a('0x21'),_0x652a6+'-'+_0x155066+'/'+_0x2a713b)[_0xe36a('0x1a')](_0x703f42);}return null;};}function patchUpdates(_0x37cafd){return function(_0xb654de){try{jsonpatch[_0xe36a('0x22')](_0xb654de,_0x37cafd,!![]);}catch(_0x189d71){return BPromise[_0xe36a('0x23')](_0x189d71);}return _0xb654de[_0xe36a('0x24')]();};}function saveUpdates(_0x35cc00,_0x5ed791){return function(_0x477066){if(_0x477066){return _0x477066[_0xe36a('0x25')](_0x35cc00)[_0xe36a('0x26')](function(_0x1522e5){return _0x1522e5;});}return null;};}function removeEntity(_0x47033e,_0x4cdb18){return function(_0x56a305){if(_0x56a305){return _0x56a305[_0xe36a('0x27')]()['then'](function(){var _0x102dd0=_0x56a305['get']({'plain':!![]});var _0x4bcb3a=_0xe36a('0x28');return db[_0xe36a('0x29')][_0xe36a('0x27')]({'where':{'type':_0x4bcb3a,'resourceId':_0x102dd0['id']}})['then'](function(){return _0x56a305;});})[_0xe36a('0x26')](function(){_0x47033e['status'](0xcc)[_0xe36a('0x19')]();});}};}function handleEntityNotFound(_0x217736,_0xc69655){return function(_0x894ca){if(!_0x894ca){_0x217736[_0xe36a('0x18')](0x194);}return _0x894ca;};}function handleError(_0x4ddab1,_0x2d7976){_0x2d7976=_0x2d7976||0x1f4;return function(_0x1a18b2){logger[_0xe36a('0x2a')](_0x1a18b2[_0xe36a('0x2b')]);if(_0x1a18b2[_0xe36a('0x2c')]){delete _0x1a18b2[_0xe36a('0x2c')];}_0x4ddab1[_0xe36a('0x1f')](_0x2d7976)[_0xe36a('0x2d')](_0x1a18b2);};}exports['index']=function(_0x2017d1,_0x43d155){var _0x3a7214={},_0x26a7a6={},_0x1a19eb={'count':0x0,'rows':[]};var _0x3056bc=_['map'](db[_0xe36a('0x2e')][_0xe36a('0x2f')],function(_0x208e8d){return{'name':_0x208e8d['fieldName'],'type':_0x208e8d[_0xe36a('0x30')]['key']};});_0x26a7a6[_0xe36a('0x31')]=_[_0xe36a('0x32')](_0x3056bc,_0xe36a('0x2c'));_0x26a7a6[_0xe36a('0x33')]=_['keys'](_0x2017d1['query']);_0x26a7a6[_0xe36a('0x34')]=_['intersection'](_0x26a7a6[_0xe36a('0x31')],_0x26a7a6[_0xe36a('0x33')]);_0x3a7214[_0xe36a('0x35')]=_['intersection'](_0x26a7a6[_0xe36a('0x31')],qs[_0xe36a('0x36')](_0x2017d1[_0xe36a('0x33')][_0xe36a('0x36')]));_0x3a7214[_0xe36a('0x35')]=_0x3a7214['attributes']['length']?_0x3a7214[_0xe36a('0x35')]:_0x26a7a6[_0xe36a('0x31')];if(!_0x2017d1[_0xe36a('0x33')][_0xe36a('0x37')](_0xe36a('0x38'))){_0x3a7214[_0xe36a('0x1e')]=qs[_0xe36a('0x1e')](_0x2017d1['query'][_0xe36a('0x1e')]);_0x3a7214['offset']=qs['offset'](_0x2017d1[_0xe36a('0x33')][_0xe36a('0x1b')]);}_0x3a7214[_0xe36a('0x39')]=qs[_0xe36a('0x3a')](_0x2017d1[_0xe36a('0x33')][_0xe36a('0x3a')]);_0x3a7214['where']=qs['filters'](_[_0xe36a('0x3b')](_0x2017d1[_0xe36a('0x33')],_0x26a7a6[_0xe36a('0x34')]),_0x3056bc);if(_0x2017d1[_0xe36a('0x33')][_0xe36a('0x3c')]){_0x3a7214[_0xe36a('0x3d')]=_[_0xe36a('0x3e')](_0x3a7214[_0xe36a('0x3d')],{'$or':_[_0xe36a('0x32')](_0x3056bc,function(_0x36169e){if(_0x36169e[_0xe36a('0x30')]!==_0xe36a('0x3f')){var _0x541181={};_0x541181[_0x36169e[_0xe36a('0x2c')]]={'$like':'%'+_0x2017d1['query']['filter']+'%'};return _0x541181;}})});}_0x3a7214=_[_0xe36a('0x3e')]({},_0x3a7214,_0x2017d1[_0xe36a('0x40')]);var _0xd5c9e4={'where':_0x3a7214[_0xe36a('0x3d')]};return db[_0xe36a('0x2e')][_0xe36a('0x1d')](_0xd5c9e4)['then'](function(_0x127cba){_0x1a19eb[_0xe36a('0x1d')]=_0x127cba;if(_0x2017d1[_0xe36a('0x33')][_0xe36a('0x41')]){_0x3a7214['include']=[{'all':!![]}];}return db[_0xe36a('0x2e')][_0xe36a('0x42')](_0x3a7214);})[_0xe36a('0x26')](function(_0x5cb4b9){_0x1a19eb[_0xe36a('0x43')]=_0x5cb4b9;return _0x1a19eb;})[_0xe36a('0x26')](respondWithFilteredResult(_0x43d155,_0x3a7214))[_0xe36a('0x44')](handleError(_0x43d155,null));};exports[_0xe36a('0x45')]=function(_0x12750a,_0xe0343d){var _0x38a38d={'raw':![],'where':{'id':_0x12750a[_0xe36a('0x46')]['id']}},_0x1cec8d={};_0x1cec8d[_0xe36a('0x31')]=_[_0xe36a('0x47')](db[_0xe36a('0x2e')][_0xe36a('0x2f')]);_0x1cec8d[_0xe36a('0x33')]=_[_0xe36a('0x47')](_0x12750a[_0xe36a('0x33')]);_0x1cec8d['filters']=_[_0xe36a('0x48')](_0x1cec8d[_0xe36a('0x31')],_0x1cec8d[_0xe36a('0x33')]);_0x38a38d[_0xe36a('0x35')]=_[_0xe36a('0x48')](_0x1cec8d[_0xe36a('0x31')],qs[_0xe36a('0x36')](_0x12750a['query'][_0xe36a('0x36')]));_0x38a38d[_0xe36a('0x35')]=_0x38a38d['attributes'][_0xe36a('0x49')]?_0x38a38d[_0xe36a('0x35')]:_0x1cec8d['model'];if(_0x12750a[_0xe36a('0x33')][_0xe36a('0x41')]){_0x38a38d[_0xe36a('0x4a')]=[{'all':!![]}];}_0x38a38d=_[_0xe36a('0x3e')]({},_0x38a38d,_0x12750a[_0xe36a('0x40')]);return db['AnalyticCustomReport'][_0xe36a('0x4b')](_0x38a38d)[_0xe36a('0x26')](handleEntityNotFound(_0xe0343d,null))[_0xe36a('0x26')](respondWithResult(_0xe0343d,null))[_0xe36a('0x44')](handleError(_0xe0343d,null));};exports[_0xe36a('0x4c')]=function(_0x5d1953,_0x1084c7){return db[_0xe36a('0x2e')][_0xe36a('0x4c')](_0x5d1953[_0xe36a('0x4d')],{})['then'](function(_0x6e84d){var _0x1d7a68=_0x5d1953[_0xe36a('0x4e')][_0xe36a('0x4f')]({'plain':!![]});if(!_0x1d7a68)throw new Error(_0xe36a('0x50'));if(_0x1d7a68[_0xe36a('0x51')]===_0xe36a('0x4e')){var _0x1a7c3d=_0x6e84d[_0xe36a('0x4f')]({'plain':!![]});var _0x22fab2='Reports';return db[_0xe36a('0x52')]['find']({'where':{'name':_0x22fab2,'userProfileId':_0x1d7a68['userProfileId']},'raw':!![]})[_0xe36a('0x26')](function(_0x10e7a6){if(_0x10e7a6&&_0x10e7a6[_0xe36a('0x53')]===0x0){return db[_0xe36a('0x29')][_0xe36a('0x4c')]({'name':_0x1a7c3d['name'],'resourceId':_0x1a7c3d['id'],'type':_0xe36a('0x28'),'sectionId':_0x10e7a6['id']},{})[_0xe36a('0x26')](function(){return _0x6e84d;});}else{return _0x6e84d;}})[_0xe36a('0x44')](function(_0x2eb2a7){logger['error'](_0xe36a('0x54'),_0x2eb2a7);throw _0x2eb2a7;});}return _0x6e84d;})[_0xe36a('0x26')](respondWithResult(_0x1084c7,0xc9))[_0xe36a('0x44')](handleError(_0x1084c7,null));};exports[_0xe36a('0x25')]=function(_0x506944,_0x38a23e){if(_0x506944['body']['id']){delete _0x506944[_0xe36a('0x4d')]['id'];}return db['AnalyticCustomReport'][_0xe36a('0x4b')]({'where':{'id':_0x506944[_0xe36a('0x46')]['id']}})[_0xe36a('0x26')](handleEntityNotFound(_0x38a23e,null))[_0xe36a('0x26')](saveUpdates(_0x506944[_0xe36a('0x4d')],null))['then'](respondWithResult(_0x38a23e,null))[_0xe36a('0x44')](handleError(_0x38a23e,null));};exports[_0xe36a('0x27')]=function(_0x186ee3,_0x36f4ba){return db[_0xe36a('0x2e')][_0xe36a('0x4b')]({'where':{'id':_0x186ee3[_0xe36a('0x46')]['id']}})[_0xe36a('0x26')](handleEntityNotFound(_0x36f4ba,null))[_0xe36a('0x26')](removeEntity(_0x36f4ba,null))[_0xe36a('0x44')](handleError(_0x36f4ba,null));};exports[_0xe36a('0x55')]=function(_0x376e2d,_0x4f0fb1){var _0x2dde62=0xa;var _0x147457=[_0xe36a('0x56'),'left_join','right_join',_0xe36a('0x57')];var _0xd07bd0={'SUM':_0xe36a('0x58'),'COUNT':_0xe36a('0x59'),'COUNT DISTINCT':_0xe36a('0x5a'),'MAX':_0xe36a('0x5b'),'MIN':'MIN(%s)','AVG':_0xe36a('0x5c'),'GROUP_CONCAT':_0xe36a('0x5d'),'GROUP_CONCAT ASC':_0xe36a('0x5e'),'GROUP_CONCAT DESC':_0xe36a('0x5f')};var _0x40f5f3={'SEC_TO_TIME':_0xe36a('0x60'),'DATE':_0xe36a('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xe36a('0x62'),'UNIX_TIMESTAMP':_0xe36a('0x63')};var _0x8368b7=function(_0x51ac1e){return!_[_0xe36a('0x64')]([_0xe36a('0x65'),_0xe36a('0x66'),_0xe36a('0x67'),_0xe36a('0x68')],_0x51ac1e);};var _0x223fa4=function(_0x4528ee){if(!_0x4528ee||!_0x4528ee[_0xe36a('0x69')]['length']){return'';}for(var _0x5163b2='(',_0x191195=0x0;_0x191195<_0x4528ee[_0xe36a('0x69')][_0xe36a('0x49')];_0x191195+=0x1){_0x191195>0x0&&(_0x5163b2+='\x20'+_0x4528ee[_0xe36a('0x6a')]+'\x20');_0x5163b2+=_0x4528ee[_0xe36a('0x69')][_0x191195][_0xe36a('0x6b')]?_0x223fa4(_0x4528ee[_0xe36a('0x69')][_0x191195][_0xe36a('0x6b')]):_0x4528ee['rules'][_0x191195][_0xe36a('0x6c')]+'\x20'+_0x4528ee[_0xe36a('0x69')][_0x191195][_0xe36a('0x6d')]+(_0x8368b7(_0x4528ee['rules'][_0x191195][_0xe36a('0x6d')])?'\x20'+_0x4528ee[_0xe36a('0x69')][_0x191195][_0xe36a('0x6e')]:'');}return _0x5163b2+')';};var _0x2c859d={'where':{'id':_0x376e2d[_0xe36a('0x46')]['id']}},_0x5ea26b,_0x3cbe67,_0x14e1c9,_0x597a79,_0x550097;_0x2c859d=_[_0xe36a('0x3e')]({},_0x2c859d,_0x376e2d[_0xe36a('0x40')]);return db[_0xe36a('0x2e')][_0xe36a('0x4b')](_0x2c859d)[_0xe36a('0x26')](function(_0xf71330){if(_0xf71330){_0x5ea26b=_0xf71330;return _0xf71330[_0xe36a('0x6f')]();}return null;})[_0xe36a('0x26')](function(_0x153d36){if(_0x153d36){if(!_0x153d36[_0xe36a('0x49')]){throw new db[(_0xe36a('0x70'))][(_0xe36a('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3cbe67=_0x153d36;return db['AnalyticMetric'][_0xe36a('0x42')]({'raw':!![]});}return null;})[_0xe36a('0x26')](function(_0x1888c6){if(_0x1888c6){_0x14e1c9=_['keyBy'](_0x1888c6,'id');var _0x5bf30b;var _0x5843bb=squel['select']();_0x5843bb[_0xe36a('0x72')](_0x5ea26b[_0xe36a('0x73')]);for(var _0x639ed8=0x0;_0x639ed8<_0x3cbe67[_0xe36a('0x49')];_0x639ed8+=0x1){_0x5bf30b=_0x3cbe67[_0x639ed8]['MetricId']?_0x14e1c9[_0x3cbe67[_0x639ed8]['MetricId']][_0xe36a('0x74')]:_0x3cbe67[_0x639ed8][_0xe36a('0x6c')];_0x5bf30b=_0x3cbe67[_0x639ed8][_0xe36a('0x75')]?_[_0xe36a('0x76')](_0xd07bd0[_0x3cbe67[_0x639ed8][_0xe36a('0x75')]],'%s',_0x5bf30b):_0x5bf30b;_0x5bf30b=_0x3cbe67[_0x639ed8][_0xe36a('0x77')]?_[_0xe36a('0x76')](_0x40f5f3[_0x3cbe67[_0x639ed8][_0xe36a('0x77')]],'%s',_0x5bf30b):_0x5bf30b;if(_0x3cbe67[_0x639ed8][_0xe36a('0x78')]){_0x5843bb[_0xe36a('0x6b')](_0x5bf30b);}_0x3cbe67[_0x639ed8][_0xe36a('0x79')]&&_0x5843bb[_0xe36a('0x39')](_0x5bf30b,_0x3cbe67[_0x639ed8]['orderBy']===_0xe36a('0x7a')?![]:!![]);_0x5843bb[_0xe36a('0x6c')](_0x5bf30b,_0x3cbe67[_0x639ed8][_0xe36a('0x7b')]||_0x5bf30b);}if(_0x5ea26b[_0xe36a('0x7c')]){_0x5ea26b[_0xe36a('0x7c')]=JSON[_0xe36a('0x7d')](_0x5ea26b[_0xe36a('0x7c')]);for(var _0x2f5d4f=0x0;_0x2f5d4f<_0x5ea26b[_0xe36a('0x7c')]['length'];_0x2f5d4f+=0x1){if(_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x30')]&&_[_0xe36a('0x64')](_0x147457,_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x30')])&&_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x7e')]&&_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x7f')]&&_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f]['foreignKey']){_0x5843bb[_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f]['type']](_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f]['foreignTable'],null,util[_0xe36a('0x77')]('%s.%s\x20=\x20%s.%s',_0x5ea26b[_0xe36a('0x73')],_0x5ea26b['joins'][_0x2f5d4f][_0xe36a('0x7e')],_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x7f')],_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x80')]));}}}if(_0x5ea26b[_0xe36a('0x81')]){_0x5ea26b[_0xe36a('0x81')]=JSON[_0xe36a('0x7d')](_0x5ea26b['conditions']);_0x5843bb['where'](_0x223fa4(_0x5ea26b['conditions']['group']));}_0x550097=_0x5843bb[_0xe36a('0x82')]();_0x5843bb[_0xe36a('0x1e')](_0x2dde62);_0x5843bb['offset'](0x0);logger['debug'](_0xe36a('0x83'),_0x5843bb[_0xe36a('0x84')]());return dbH[_0xe36a('0x85')][_0xe36a('0x33')](_0x5843bb['toString'](),{'type':dbH['sequelize'][_0xe36a('0x86')][_0xe36a('0x87')]});}})[_0xe36a('0x26')](respondWithResult(_0x4f0fb1,null))[_0xe36a('0x44')](handleError(_0x4f0fb1,null));};function runReport(_0x2e4d73,_0x5b114a,_0x51c207){var _0x24e5fd=_0x5b114a[_0xe36a('0x2c')];var _0x35cde8=0xa;var _0xffa2e8=[_0xe36a('0x56'),'left_join',_0xe36a('0x88'),_0xe36a('0x57')];var _0x2c6581={'SUM':_0xe36a('0x58'),'COUNT':_0xe36a('0x59'),'COUNT DISTINCT':_0xe36a('0x5a'),'MAX':_0xe36a('0x5b'),'MIN':_0xe36a('0x89'),'AVG':_0xe36a('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe36a('0x5e'),'GROUP_CONCAT DESC':_0xe36a('0x5f')};var _0x5d2b5b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe36a('0x61'),'HOUR':_0xe36a('0x8a'),'ROUND':_0xe36a('0x62'),'UNIX_TIMESTAMP':_0xe36a('0x63')};var _0x4633a9=function(_0xab4c5d){return!_['includes']([_0xe36a('0x65'),_0xe36a('0x66'),_0xe36a('0x67'),_0xe36a('0x68')],_0xab4c5d);};var _0x1386e9=function(_0x3af19a){if(!_0x3af19a||!_0x3af19a[_0xe36a('0x69')][_0xe36a('0x49')]){return'';}for(var _0xc0b5df='(',_0x1863f3=0x0;_0x1863f3<_0x3af19a[_0xe36a('0x69')][_0xe36a('0x49')];_0x1863f3+=0x1){_0x1863f3>0x0&&(_0xc0b5df+='\x20'+_0x3af19a[_0xe36a('0x6a')]+'\x20');_0xc0b5df+=_0x3af19a[_0xe36a('0x69')][_0x1863f3]['group']?_0x1386e9(_0x3af19a[_0xe36a('0x69')][_0x1863f3][_0xe36a('0x6b')]):_0x3af19a[_0xe36a('0x69')][_0x1863f3][_0xe36a('0x6c')]+'\x20'+_0x3af19a['rules'][_0x1863f3][_0xe36a('0x6d')]+(_0x4633a9(_0x3af19a[_0xe36a('0x69')][_0x1863f3]['condition'])?'\x20'+_0x3af19a[_0xe36a('0x69')][_0x1863f3][_0xe36a('0x6e')]:'');}return _0xc0b5df+')';};var _0x3468a6={'where':{'id':_0x2e4d73['id']}},_0x3c0337,_0x4a5d97,_0x5cda2d,_0x55596f,_0x52e0ca;_0x3468a6=_[_0xe36a('0x3e')]({},_0x3468a6,_0x51c207);return db['AnalyticCustomReport'][_0xe36a('0x4b')](_0x3468a6)[_0xe36a('0x26')](function(_0x30e3b5){if(_0x30e3b5){_0x3c0337=_0x30e3b5;return _0x30e3b5['getFields']();}return null;})['then'](function(_0x1e7ad9){if(_0x1e7ad9){if(!_0x1e7ad9[_0xe36a('0x49')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe36a('0x8b'),0x193);}_0x4a5d97=_0x1e7ad9;return db['AnalyticMetric'][_0xe36a('0x42')]({'raw':!![]});}return null;})['then'](function(_0x536c21){if(_0x536c21){_0x5cda2d=_[_0xe36a('0x8c')](_0x536c21,'id');var _0x2fbdbf;var _0x28b978=squel[_0xe36a('0x8d')]();_0x28b978[_0xe36a('0x72')](_0x3c0337[_0xe36a('0x73')]);for(var _0x5738b0=0x0;_0x5738b0<_0x4a5d97[_0xe36a('0x49')];_0x5738b0+=0x1){_0x2fbdbf=_0x4a5d97[_0x5738b0][_0xe36a('0x8e')]?_0x5cda2d[_0x4a5d97[_0x5738b0][_0xe36a('0x8e')]][_0xe36a('0x74')]:_0x4a5d97[_0x5738b0][_0xe36a('0x6c')];_0x2fbdbf=_0x4a5d97[_0x5738b0][_0xe36a('0x75')]?_['replace'](_0x2c6581[_0x4a5d97[_0x5738b0][_0xe36a('0x75')]],'%s',_0x2fbdbf):_0x2fbdbf;_0x2fbdbf=_0x4a5d97[_0x5738b0][_0xe36a('0x77')]?_['replace'](_0x5d2b5b[_0x4a5d97[_0x5738b0][_0xe36a('0x77')]],'%s',_0x2fbdbf):_0x2fbdbf;if(_0x4a5d97[_0x5738b0][_0xe36a('0x78')]){_0x28b978[_0xe36a('0x6b')](_0x2fbdbf);}_0x4a5d97[_0x5738b0]['orderBy']&&_0x28b978['order'](_0x2fbdbf,_0x4a5d97[_0x5738b0][_0xe36a('0x79')]===_0xe36a('0x7a')?![]:!![]);_0x28b978[_0xe36a('0x6c')](_0x2fbdbf,_0x4a5d97[_0x5738b0][_0xe36a('0x7b')]||_0x2fbdbf);}if(_0x3c0337[_0xe36a('0x7c')]){_0x3c0337[_0xe36a('0x7c')]=JSON[_0xe36a('0x7d')](_0x3c0337[_0xe36a('0x7c')]);for(var _0x11b16b=0x0;_0x11b16b<_0x3c0337[_0xe36a('0x7c')][_0xe36a('0x49')];_0x11b16b+=0x1){if(_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x30')]&&_['includes'](_0xffa2e8,_0x3c0337['joins'][_0x11b16b]['type'])&&_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x7e')]&&_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x7f')]&&_0x3c0337[_0xe36a('0x7c')][_0x11b16b]['foreignKey']){_0x28b978[_0x3c0337['joins'][_0x11b16b][_0xe36a('0x30')]](_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x7f')],null,util[_0xe36a('0x77')](_0xe36a('0x8f'),_0x3c0337['table'],_0x3c0337['joins'][_0x11b16b][_0xe36a('0x7e')],_0x3c0337['joins'][_0x11b16b][_0xe36a('0x7f')],_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x80')]));}}}if(_0x3c0337[_0xe36a('0x81')]){_0x3c0337['conditions']=JSON[_0xe36a('0x7d')](_0x3c0337[_0xe36a('0x81')]);_0x28b978['where'](_0x1386e9(_0x3c0337[_0xe36a('0x81')]['group']));}_0x52e0ca=_0x28b978['clone']();_0x28b978['limit'](_0x35cde8);_0x28b978[_0xe36a('0x1b')](0x0);return;}})[_0xe36a('0x26')](function(){if(_0x5b114a['output']===_0xe36a('0x90')){return null;}var _0x49296a=_[_0xe36a('0x3e')](_0x5b114a,{'name':_0x5b114a[_0xe36a('0x91')]||_0x5b114a[_0xe36a('0x2c')]||_0x3c0337[_0xe36a('0x2c')],'basename':_0x24e5fd,'savename':util[_0xe36a('0x77')](_0xe36a('0x92'),_0x5b114a[_0xe36a('0x2c')]||_0x3c0337[_0xe36a('0x2c')],require(_0xe36a('0x93'))[_0xe36a('0x94')](0x4),_0x5b114a[_0xe36a('0x95')]||'csv'),'reportId':_0x3c0337['id'],'reportType':_0xe36a('0x96')});return db[_0xe36a('0x97')]['create'](_0x49296a,{'raw':!![]});})['then'](function(_0x222dcc){if(_0x3c0337['table']===_0xe36a('0x98')){_0x52e0ca[_0xe36a('0x3d')](_0x3c0337[_0xe36a('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5b114a[_0xe36a('0x99')],_0x5b114a[_0xe36a('0x9a')]);}else{_0x52e0ca[_0xe36a('0x3d')](_0x3c0337['table']+_0xe36a('0x9b'),_0x5b114a[_0xe36a('0x99')],_0x5b114a[_0xe36a('0x9a')]);}if(_0x222dcc){logger['info']('Run\x20Query:',_0x52e0ca[_0xe36a('0x84')]());require(_0xe36a('0x9c'))[_0xe36a('0x9d')](path[_0xe36a('0x56')](__dirname,_0xe36a('0x9e'),_0x222dcc[_0xe36a('0x95')]),[_0x222dcc['id'],_0x52e0ca[_0xe36a('0x84')](),path[_0xe36a('0x56')](__dirname,_0xe36a('0x9f'),_0x222dcc['savename']),_0x24e5fd]);return _0x222dcc;}else{var _0x3106b7=squel['select']();_0x3106b7['from']('('+_0x52e0ca[_0xe36a('0x84')]()+')',_0xe36a('0xa0'));_0x3106b7[_0xe36a('0x6c')](_0xe36a('0xa1'),'count');_0x52e0ca[_0xe36a('0x1e')](_0x5b114a[_0xe36a('0x1e')]||_0x35cde8);_0x52e0ca[_0xe36a('0x1b')](_0x5b114a['offset']||0x0);return dbH['sequelize'][_0xe36a('0x33')](_0x3106b7[_0xe36a('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0xe36a('0x87')]})[_0xe36a('0x26')](function(_0x2d4d06){if(!_0x2d4d06[_0xe36a('0x49')]){_0x55596f=0x0;}else{_0x55596f=_0x2d4d06[0x0][_0xe36a('0x1d')]||0x0;}return dbH['sequelize'][_0xe36a('0x33')](_0x52e0ca[_0xe36a('0x84')](),{'type':dbH['sequelize'][_0xe36a('0x86')]['SELECT']});})[_0xe36a('0x26')](function(_0x15b9a5){return{'rows':_0x15b9a5||[],'count':_0x55596f};});}});}exports['run']=function(_0x4a08b2,_0x538af5){return runReport(_0x4a08b2[_0xe36a('0x46')],_0x4a08b2[_0xe36a('0x33')],_0x4a08b2['options'])[_0xe36a('0x26')](respondWithResult(_0x538af5,null))['catch'](handleError(_0x538af5,null));};exports['runReport']=runReport;exports['query']=function(_0x655b66,_0x49e7ed){var _0x531ec8=0xa;var _0x5cb8c9=['join',_0xe36a('0xa2'),_0xe36a('0x88'),'cross_join'];var _0x43019a={'SUM':'SUM(%s)','COUNT':_0xe36a('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe36a('0x5b'),'MIN':_0xe36a('0x89'),'AVG':_0xe36a('0x5c'),'GROUP_CONCAT':_0xe36a('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dad02={'SEC_TO_TIME':_0xe36a('0x60'),'DATE':_0xe36a('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xe36a('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2be918=function(_0xdef831){return!_[_0xe36a('0x64')]([_0xe36a('0x65'),_0xe36a('0x66'),_0xe36a('0x67'),_0xe36a('0x68')],_0xdef831);};var _0x68cc21=function(_0x3e6193){if(!_0x3e6193||!_0x3e6193['rules'][_0xe36a('0x49')]){return'';}for(var _0x13afa3='(',_0x50e357=0x0;_0x50e357<_0x3e6193[_0xe36a('0x69')][_0xe36a('0x49')];_0x50e357+=0x1){_0x50e357>0x0&&(_0x13afa3+='\x20'+_0x3e6193['operator']+'\x20');_0x13afa3+=_0x3e6193[_0xe36a('0x69')][_0x50e357][_0xe36a('0x6b')]?_0x68cc21(_0x3e6193[_0xe36a('0x69')][_0x50e357][_0xe36a('0x6b')]):_0x3e6193[_0xe36a('0x69')][_0x50e357][_0xe36a('0x6c')]+'\x20'+_0x3e6193[_0xe36a('0x69')][_0x50e357][_0xe36a('0x6d')]+(_0x2be918(_0x3e6193['rules'][_0x50e357][_0xe36a('0x6d')])?'\x20'+_0x3e6193[_0xe36a('0x69')][_0x50e357]['value']:'');}return _0x13afa3+')';};var _0x5d27f2={'where':{'id':_0x655b66[_0xe36a('0x46')]['id']}},_0x4a3f99,_0x3f4439,_0x5f1b29,_0x3d68be,_0x41e68a;_0x5d27f2=_['merge']({},_0x5d27f2,_0x655b66['options']);return db[_0xe36a('0x2e')][_0xe36a('0x4b')](_0x5d27f2)['then'](function(_0x2920a6){if(_0x2920a6){_0x4a3f99=_0x2920a6;return _0x2920a6[_0xe36a('0x6f')]();}return null;})[_0xe36a('0x26')](function(_0x6ed048){if(_0x6ed048){if(!_0x6ed048[_0xe36a('0x49')]){throw new db[(_0xe36a('0x70'))][(_0xe36a('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3f4439=_0x6ed048;return db[_0xe36a('0xa3')][_0xe36a('0x42')]({'raw':!![]});}return null;})['then'](function(_0x2f89f1){if(_0x2f89f1){_0x5f1b29=_[_0xe36a('0x8c')](_0x2f89f1,'id');var _0x18876b;var _0x27fad1=squel[_0xe36a('0x8d')]();_0x27fad1[_0xe36a('0x72')](_0x4a3f99['table']);for(var _0x385676=0x0;_0x385676<_0x3f4439[_0xe36a('0x49')];_0x385676+=0x1){_0x18876b=_0x3f4439[_0x385676][_0xe36a('0x8e')]?_0x5f1b29[_0x3f4439[_0x385676][_0xe36a('0x8e')]][_0xe36a('0x74')]:_0x3f4439[_0x385676]['field'];_0x18876b=_0x3f4439[_0x385676]['function']?_[_0xe36a('0x76')](_0x43019a[_0x3f4439[_0x385676][_0xe36a('0x75')]],'%s',_0x18876b):_0x18876b;_0x18876b=_0x3f4439[_0x385676]['format']?_[_0xe36a('0x76')](_0x5dad02[_0x3f4439[_0x385676][_0xe36a('0x77')]],'%s',_0x18876b):_0x18876b;if(_0x3f4439[_0x385676][_0xe36a('0x78')]){_0x27fad1[_0xe36a('0x6b')](_0x18876b);}_0x3f4439[_0x385676]['orderBy']&&_0x27fad1['order'](_0x18876b,_0x3f4439[_0x385676][_0xe36a('0x79')]===_0xe36a('0x7a')?![]:!![]);_0x27fad1[_0xe36a('0x6c')](_0x18876b,_0x3f4439[_0x385676][_0xe36a('0x7b')]||_0x18876b);}if(_0x4a3f99['joins']){_0x4a3f99['joins']=JSON[_0xe36a('0x7d')](_0x4a3f99[_0xe36a('0x7c')]);for(var _0x25d704=0x0;_0x25d704<_0x4a3f99[_0xe36a('0x7c')]['length'];_0x25d704+=0x1){if(_0x4a3f99['joins'][_0x25d704][_0xe36a('0x30')]&&_[_0xe36a('0x64')](_0x5cb8c9,_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x30')])&&_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x7e')]&&_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x7f')]&&_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x80')]){_0x27fad1[_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x30')]](_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x7f')],null,util[_0xe36a('0x77')](_0xe36a('0x8f'),_0x4a3f99['table'],_0x4a3f99[_0xe36a('0x7c')][_0x25d704]['parentKey'],_0x4a3f99['joins'][_0x25d704]['foreignTable'],_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x80')]));}}}if(_0x4a3f99[_0xe36a('0x81')]){_0x4a3f99[_0xe36a('0x81')]=JSON[_0xe36a('0x7d')](_0x4a3f99[_0xe36a('0x81')]);_0x27fad1[_0xe36a('0x3d')](_0x68cc21(_0x4a3f99['conditions'][_0xe36a('0x6b')]));}_0x41e68a=_0x27fad1[_0xe36a('0x82')]();_0x27fad1[_0xe36a('0x1e')](_0x531ec8);_0x27fad1[_0xe36a('0x1b')](0x0);logger[_0xe36a('0xa4')](_0xe36a('0x83'),_0x27fad1['toString']());return dbH[_0xe36a('0x85')][_0xe36a('0x33')](_0x27fad1[_0xe36a('0x84')](),{'type':dbH[_0xe36a('0x85')]['QueryTypes'][_0xe36a('0x87')]});}})[_0xe36a('0x26')](function(){return{'sql':_0x41e68a['toString']()};})[_0xe36a('0x26')](respondWithResult(_0x49e7ed,null))[_0xe36a('0x44')](handleError(_0x49e7ed,null));};
\ No newline at end of file
+var _0x98e5=['Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','left_join','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20EMPTY','foreignKey','output','web','fullPath','%s-%s.%s','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','COUNT(*)','QueryTypes','run','runReport','COUNT(DISTINCT\x20%s)','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','CustomReports','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','type','key','model','intersection','query','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','keys','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value'];(function(_0x1819a3,_0x142065){var _0x14f218=function(_0x4a7761){while(--_0x4a7761){_0x1819a3['push'](_0x1819a3['shift']());}};_0x14f218(++_0x142065);}(_0x98e5,0xd2));var _0x598e=function(_0x5b5ffe,_0x1c5874){_0x5b5ffe=_0x5b5ffe-0x0;var _0x2d12bc=_0x98e5[_0x5b5ffe];return _0x2d12bc;};'use strict';var emlformat=require(_0x598e('0x0'));var rimraf=require(_0x598e('0x1'));var zipdir=require(_0x598e('0x2'));var jsonpatch=require(_0x598e('0x3'));var rp=require('request-promise');var moment=require(_0x598e('0x4'));var BPromise=require(_0x598e('0x5'));var Mustache=require(_0x598e('0x6'));var util=require(_0x598e('0x7'));var path=require('path');var sox=require(_0x598e('0x8'));var csv=require(_0x598e('0x9'));var ejs=require(_0x598e('0xa'));var fs=require('fs');var fs_extra=require(_0x598e('0xb'));var _=require('lodash');var squel=require(_0x598e('0xc'));var crypto=require(_0x598e('0xd'));var jsforce=require(_0x598e('0xe'));var deskjs=require(_0x598e('0xf'));var toCsv=require(_0x598e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x598e('0x10'));var as=require(_0x598e('0x11'));var hardwareService=require(_0x598e('0x12'));var logger=require(_0x598e('0x13'))('api');var utils=require(_0x598e('0x14'));var config=require(_0x598e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x598e('0x16'))[_0x598e('0x17')];function respondWithStatusCode(_0x1e89f2,_0x34ef86){_0x34ef86=_0x34ef86||0xcc;return function(_0x3ca5c3){if(_0x3ca5c3){return _0x1e89f2['sendStatus'](_0x34ef86);}return _0x1e89f2[_0x598e('0x18')](_0x34ef86)[_0x598e('0x19')]();};}function respondWithResult(_0x1484f7,_0x4ca784){_0x4ca784=_0x4ca784||0xc8;return function(_0x4e9106){if(_0x4e9106){return _0x1484f7[_0x598e('0x18')](_0x4ca784)['json'](_0x4e9106);}};}function respondWithFilteredResult(_0x443155,_0x4bf97e){return function(_0x1a29bd){if(_0x1a29bd){var _0x30d714=typeof _0x4bf97e[_0x598e('0x1a')]===_0x598e('0x1b')&&typeof _0x4bf97e['limit']===_0x598e('0x1b');var _0x476358=_0x1a29bd[_0x598e('0x1c')];var _0x48cc3c=_0x30d714?0x0:_0x4bf97e[_0x598e('0x1a')];var _0x4e8331=_0x30d714?_0x1a29bd[_0x598e('0x1c')]:_0x4bf97e[_0x598e('0x1a')]+_0x4bf97e[_0x598e('0x1d')];var _0x45ac5b;if(_0x4e8331>=_0x476358){_0x4e8331=_0x476358;_0x45ac5b=0xc8;}else{_0x45ac5b=0xce;}_0x443155[_0x598e('0x18')](_0x45ac5b);return _0x443155[_0x598e('0x1e')](_0x598e('0x1f'),_0x48cc3c+'-'+_0x4e8331+'/'+_0x476358)[_0x598e('0x20')](_0x1a29bd);}return null;};}function patchUpdates(_0x4c57bf){return function(_0x2e4733){try{jsonpatch[_0x598e('0x21')](_0x2e4733,_0x4c57bf,!![]);}catch(_0xe87045){return BPromise['reject'](_0xe87045);}return _0x2e4733[_0x598e('0x22')]();};}function saveUpdates(_0x208234,_0x1b60f6){return function(_0x2870a5){if(_0x2870a5){return _0x2870a5[_0x598e('0x23')](_0x208234)[_0x598e('0x24')](function(_0x52c59e){return _0x52c59e;});}return null;};}function removeEntity(_0x3227e7,_0x436b20){return function(_0x18955b){if(_0x18955b){return _0x18955b[_0x598e('0x25')]()['then'](function(){var _0x2e414c=_0x18955b[_0x598e('0x26')]({'plain':!![]});var _0x22b521=_0x598e('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x22b521,'resourceId':_0x2e414c['id']}})[_0x598e('0x24')](function(){return _0x18955b;});})['then'](function(){_0x3227e7[_0x598e('0x18')](0xcc)[_0x598e('0x19')]();});}};}function handleEntityNotFound(_0x33bcc9,_0x2a27d8){return function(_0x3b73d0){if(!_0x3b73d0){_0x33bcc9[_0x598e('0x28')](0x194);}return _0x3b73d0;};}function handleError(_0x486f58,_0x2e7381){_0x2e7381=_0x2e7381||0x1f4;return function(_0x1a3842){logger[_0x598e('0x29')](_0x1a3842[_0x598e('0x2a')]);if(_0x1a3842[_0x598e('0x2b')]){delete _0x1a3842['name'];}_0x486f58[_0x598e('0x18')](_0x2e7381)[_0x598e('0x2c')](_0x1a3842);};}exports[_0x598e('0x2d')]=function(_0x2bba7d,_0xc503a2){var _0x56ce86={},_0x8f582={},_0x3281e4={'count':0x0,'rows':[]};var _0x28492d=_[_0x598e('0x2e')](db[_0x598e('0x2f')]['rawAttributes'],function(_0x2ecc72){return{'name':_0x2ecc72['fieldName'],'type':_0x2ecc72[_0x598e('0x30')][_0x598e('0x31')]};});_0x8f582[_0x598e('0x32')]=_[_0x598e('0x2e')](_0x28492d,'name');_0x8f582['query']=_['keys'](_0x2bba7d['query']);_0x8f582['filters']=_[_0x598e('0x33')](_0x8f582[_0x598e('0x32')],_0x8f582[_0x598e('0x34')]);_0x56ce86[_0x598e('0x35')]=_[_0x598e('0x33')](_0x8f582[_0x598e('0x32')],qs[_0x598e('0x36')](_0x2bba7d['query'][_0x598e('0x36')]));_0x56ce86[_0x598e('0x35')]=_0x56ce86[_0x598e('0x35')][_0x598e('0x37')]?_0x56ce86['attributes']:_0x8f582[_0x598e('0x32')];if(!_0x2bba7d[_0x598e('0x34')]['hasOwnProperty']('nolimit')){_0x56ce86[_0x598e('0x1d')]=qs[_0x598e('0x1d')](_0x2bba7d[_0x598e('0x34')]['limit']);_0x56ce86[_0x598e('0x1a')]=qs[_0x598e('0x1a')](_0x2bba7d[_0x598e('0x34')][_0x598e('0x1a')]);}_0x56ce86[_0x598e('0x38')]=qs['sort'](_0x2bba7d[_0x598e('0x34')][_0x598e('0x39')]);_0x56ce86[_0x598e('0x3a')]=qs[_0x598e('0x3b')](_[_0x598e('0x3c')](_0x2bba7d[_0x598e('0x34')],_0x8f582[_0x598e('0x3b')]),_0x28492d);if(_0x2bba7d[_0x598e('0x34')]['filter']){_0x56ce86[_0x598e('0x3a')]=_[_0x598e('0x3d')](_0x56ce86[_0x598e('0x3a')],{'$or':_[_0x598e('0x2e')](_0x28492d,function(_0x1f7425){if(_0x1f7425[_0x598e('0x30')]!==_0x598e('0x3e')){var _0x3b599e={};_0x3b599e[_0x1f7425['name']]={'$like':'%'+_0x2bba7d[_0x598e('0x34')][_0x598e('0x3f')]+'%'};return _0x3b599e;}})});}_0x56ce86=_['merge']({},_0x56ce86,_0x2bba7d[_0x598e('0x40')]);var _0x8e92dc={'where':_0x56ce86[_0x598e('0x3a')]};return db[_0x598e('0x2f')][_0x598e('0x1c')](_0x8e92dc)[_0x598e('0x24')](function(_0x4dd3a5){_0x3281e4[_0x598e('0x1c')]=_0x4dd3a5;if(_0x2bba7d[_0x598e('0x34')][_0x598e('0x41')]){_0x56ce86['include']=[{'all':!![]}];}return db[_0x598e('0x2f')][_0x598e('0x42')](_0x56ce86);})[_0x598e('0x24')](function(_0x48211c){_0x3281e4['rows']=_0x48211c;return _0x3281e4;})[_0x598e('0x24')](respondWithFilteredResult(_0xc503a2,_0x56ce86))['catch'](handleError(_0xc503a2,null));};exports[_0x598e('0x43')]=function(_0x22b113,_0x5dbeb7){var _0x9e20e7={'raw':![],'where':{'id':_0x22b113['params']['id']}},_0x3fdb68={};_0x3fdb68[_0x598e('0x32')]=_[_0x598e('0x44')](db[_0x598e('0x2f')]['rawAttributes']);_0x3fdb68[_0x598e('0x34')]=_['keys'](_0x22b113[_0x598e('0x34')]);_0x3fdb68[_0x598e('0x3b')]=_['intersection'](_0x3fdb68['model'],_0x3fdb68[_0x598e('0x34')]);_0x9e20e7[_0x598e('0x35')]=_[_0x598e('0x33')](_0x3fdb68[_0x598e('0x32')],qs[_0x598e('0x36')](_0x22b113['query'][_0x598e('0x36')]));_0x9e20e7['attributes']=_0x9e20e7[_0x598e('0x35')]['length']?_0x9e20e7[_0x598e('0x35')]:_0x3fdb68['model'];if(_0x22b113[_0x598e('0x34')][_0x598e('0x41')]){_0x9e20e7[_0x598e('0x45')]=[{'all':!![]}];}_0x9e20e7=_[_0x598e('0x3d')]({},_0x9e20e7,_0x22b113[_0x598e('0x40')]);return db['AnalyticCustomReport']['find'](_0x9e20e7)[_0x598e('0x24')](handleEntityNotFound(_0x5dbeb7,null))['then'](respondWithResult(_0x5dbeb7,null))[_0x598e('0x46')](handleError(_0x5dbeb7,null));};exports[_0x598e('0x47')]=function(_0x3cd7a2,_0x4b8327){return db[_0x598e('0x2f')][_0x598e('0x47')](_0x3cd7a2[_0x598e('0x48')],{})[_0x598e('0x24')](function(_0x10ca33){var _0x101b99=_0x3cd7a2[_0x598e('0x49')][_0x598e('0x26')]({'plain':!![]});if(!_0x101b99)throw new Error(_0x598e('0x4a'));if(_0x101b99[_0x598e('0x4b')]===_0x598e('0x49')){var _0x488d18=_0x10ca33['get']({'plain':!![]});var _0x4096b9=_0x598e('0x4c');return db[_0x598e('0x4d')][_0x598e('0x4e')]({'where':{'name':_0x4096b9,'userProfileId':_0x101b99[_0x598e('0x4f')]},'raw':!![]})[_0x598e('0x24')](function(_0x5e2d6b){if(_0x5e2d6b&&_0x5e2d6b[_0x598e('0x50')]===0x0){return db[_0x598e('0x51')][_0x598e('0x47')]({'name':_0x488d18[_0x598e('0x2b')],'resourceId':_0x488d18['id'],'type':_0x598e('0x27'),'sectionId':_0x5e2d6b['id']},{})[_0x598e('0x24')](function(){return _0x10ca33;});}else{return _0x10ca33;}})[_0x598e('0x46')](function(_0x41ab5b){logger[_0x598e('0x29')](_0x598e('0x52'),_0x41ab5b);throw _0x41ab5b;});}return _0x10ca33;})[_0x598e('0x24')](respondWithResult(_0x4b8327,0xc9))[_0x598e('0x46')](handleError(_0x4b8327,null));};exports[_0x598e('0x23')]=function(_0x2927fb,_0x1ee699){if(_0x2927fb[_0x598e('0x48')]['id']){delete _0x2927fb[_0x598e('0x48')]['id'];}return db[_0x598e('0x2f')][_0x598e('0x4e')]({'where':{'id':_0x2927fb[_0x598e('0x53')]['id']}})[_0x598e('0x24')](handleEntityNotFound(_0x1ee699,null))[_0x598e('0x24')](saveUpdates(_0x2927fb[_0x598e('0x48')],null))[_0x598e('0x24')](respondWithResult(_0x1ee699,null))[_0x598e('0x46')](handleError(_0x1ee699,null));};exports['destroy']=function(_0x13ea81,_0x1c5fe5){return db[_0x598e('0x2f')][_0x598e('0x4e')]({'where':{'id':_0x13ea81[_0x598e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1c5fe5,null))[_0x598e('0x24')](removeEntity(_0x1c5fe5,null))['catch'](handleError(_0x1c5fe5,null));};exports[_0x598e('0x54')]=function(_0x1200f1,_0x4387b1){var _0xc2677d=0xa;var _0xe0e641=['join','left_join',_0x598e('0x55'),_0x598e('0x56')];var _0x564412={'SUM':_0x598e('0x57'),'COUNT':_0x598e('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x598e('0x59'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x598e('0x5a')};var _0x4f3f06={'SEC_TO_TIME':_0x598e('0x5b'),'DATE':_0x598e('0x5c'),'HOUR':_0x598e('0x5d'),'ROUND':_0x598e('0x5e'),'UNIX_TIMESTAMP':_0x598e('0x5f')};var _0x3465fd=function(_0x461784){return!_[_0x598e('0x60')]([_0x598e('0x61'),_0x598e('0x62'),_0x598e('0x63'),'IS\x20NOT\x20EMPTY'],_0x461784);};var _0x3da027=function(_0x1c3e48){if(!_0x1c3e48||!_0x1c3e48[_0x598e('0x64')][_0x598e('0x37')]){return'';}for(var _0x286c54='(',_0x16504f=0x0;_0x16504f<_0x1c3e48['rules'][_0x598e('0x37')];_0x16504f+=0x1){_0x16504f>0x0&&(_0x286c54+='\x20'+_0x1c3e48[_0x598e('0x65')]+'\x20');_0x286c54+=_0x1c3e48['rules'][_0x16504f][_0x598e('0x66')]?_0x3da027(_0x1c3e48[_0x598e('0x64')][_0x16504f][_0x598e('0x66')]):_0x1c3e48[_0x598e('0x64')][_0x16504f][_0x598e('0x67')]+'\x20'+_0x1c3e48[_0x598e('0x64')][_0x16504f][_0x598e('0x68')]+(_0x3465fd(_0x1c3e48['rules'][_0x16504f][_0x598e('0x68')])?'\x20'+_0x1c3e48['rules'][_0x16504f][_0x598e('0x69')]:'');}return _0x286c54+')';};var _0x4f4291={'where':{'id':_0x1200f1[_0x598e('0x53')]['id']}},_0x2df2d8,_0x205562,_0x389b95,_0x532adc,_0x39ae36;_0x4f4291=_[_0x598e('0x3d')]({},_0x4f4291,_0x1200f1['options']);return db[_0x598e('0x2f')][_0x598e('0x4e')](_0x4f4291)[_0x598e('0x24')](function(_0x313744){if(_0x313744){_0x2df2d8=_0x313744;return _0x313744['getFields']();}return null;})[_0x598e('0x24')](function(_0x11fbc9){if(_0x11fbc9){if(!_0x11fbc9[_0x598e('0x37')]){throw new db[(_0x598e('0x6a'))][(_0x598e('0x6b'))](_0x598e('0x6c'),0x193);}_0x205562=_0x11fbc9;return db[_0x598e('0x6d')][_0x598e('0x42')]({'raw':!![]});}return null;})[_0x598e('0x24')](function(_0xe57600){if(_0xe57600){_0x389b95=_[_0x598e('0x6e')](_0xe57600,'id');var _0x2e62fd;var _0x27f46f=squel[_0x598e('0x6f')]();_0x27f46f[_0x598e('0x70')](_0x2df2d8[_0x598e('0x71')]);for(var _0x10ec80=0x0;_0x10ec80<_0x205562[_0x598e('0x37')];_0x10ec80+=0x1){_0x2e62fd=_0x205562[_0x10ec80][_0x598e('0x72')]?_0x389b95[_0x205562[_0x10ec80][_0x598e('0x72')]][_0x598e('0x73')]:_0x205562[_0x10ec80][_0x598e('0x67')];_0x2e62fd=_0x205562[_0x10ec80][_0x598e('0x74')]?_[_0x598e('0x75')](_0x564412[_0x205562[_0x10ec80][_0x598e('0x74')]],'%s',_0x2e62fd):_0x2e62fd;_0x2e62fd=_0x205562[_0x10ec80]['format']?_[_0x598e('0x75')](_0x4f3f06[_0x205562[_0x10ec80][_0x598e('0x76')]],'%s',_0x2e62fd):_0x2e62fd;if(_0x205562[_0x10ec80][_0x598e('0x77')]){_0x27f46f[_0x598e('0x66')](_0x2e62fd);}_0x205562[_0x10ec80]['orderBy']&&_0x27f46f[_0x598e('0x38')](_0x2e62fd,_0x205562[_0x10ec80][_0x598e('0x78')]===_0x598e('0x79')?![]:!![]);_0x27f46f[_0x598e('0x67')](_0x2e62fd,_0x205562[_0x10ec80][_0x598e('0x7a')]||_0x2e62fd);}if(_0x2df2d8[_0x598e('0x7b')]){_0x2df2d8['joins']=JSON[_0x598e('0x7c')](_0x2df2d8['joins']);for(var _0x491c4b=0x0;_0x491c4b<_0x2df2d8[_0x598e('0x7b')]['length'];_0x491c4b+=0x1){if(_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x30')]&&_[_0x598e('0x60')](_0xe0e641,_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x30')])&&_0x2df2d8['joins'][_0x491c4b][_0x598e('0x7d')]&&_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7e')]&&_0x2df2d8[_0x598e('0x7b')][_0x491c4b]['foreignKey']){_0x27f46f[_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x30')]](_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7e')],null,util[_0x598e('0x76')](_0x598e('0x7f'),_0x2df2d8[_0x598e('0x71')],_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7d')],_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7e')],_0x2df2d8[_0x598e('0x7b')][_0x491c4b]['foreignKey']));}}}if(_0x2df2d8[_0x598e('0x80')]){_0x2df2d8[_0x598e('0x80')]=JSON[_0x598e('0x7c')](_0x2df2d8[_0x598e('0x80')]);_0x27f46f[_0x598e('0x3a')](_0x3da027(_0x2df2d8[_0x598e('0x80')][_0x598e('0x66')]));}_0x39ae36=_0x27f46f[_0x598e('0x81')]();_0x27f46f[_0x598e('0x1d')](_0xc2677d);_0x27f46f['offset'](0x0);logger[_0x598e('0x82')](_0x598e('0x83'),_0x27f46f[_0x598e('0x84')]());return dbH[_0x598e('0x85')][_0x598e('0x34')](_0x27f46f[_0x598e('0x84')](),{'type':dbH[_0x598e('0x85')]['QueryTypes'][_0x598e('0x86')]});}})['then'](respondWithResult(_0x4387b1,null))[_0x598e('0x46')](handleError(_0x4387b1,null));};function runReport(_0x255b1f,_0x1785b4,_0x2f3fae){var _0x3e286a=_0x1785b4[_0x598e('0x2b')];var _0xbfca0c=0xa;var _0x42071b=[_0x598e('0x87'),_0x598e('0x88'),_0x598e('0x55'),'cross_join'];var _0x21d9f0={'SUM':_0x598e('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x598e('0x59'),'MIN':_0x598e('0x89'),'AVG':_0x598e('0x8a'),'GROUP_CONCAT':_0x598e('0x8b'),'GROUP_CONCAT ASC':_0x598e('0x8c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3c0458={'SEC_TO_TIME':_0x598e('0x5b'),'DATE':_0x598e('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x598e('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x240f30=function(_0x5d319d){return!_[_0x598e('0x60')]([_0x598e('0x61'),'IS\x20NOT\x20NULL',_0x598e('0x63'),_0x598e('0x8d')],_0x5d319d);};var _0x1c4d83=function(_0x10e868){if(!_0x10e868||!_0x10e868[_0x598e('0x64')][_0x598e('0x37')]){return'';}for(var _0x198495='(',_0x21f968=0x0;_0x21f968<_0x10e868['rules'][_0x598e('0x37')];_0x21f968+=0x1){_0x21f968>0x0&&(_0x198495+='\x20'+_0x10e868[_0x598e('0x65')]+'\x20');_0x198495+=_0x10e868[_0x598e('0x64')][_0x21f968][_0x598e('0x66')]?_0x1c4d83(_0x10e868[_0x598e('0x64')][_0x21f968]['group']):_0x10e868[_0x598e('0x64')][_0x21f968][_0x598e('0x67')]+'\x20'+_0x10e868[_0x598e('0x64')][_0x21f968]['condition']+(_0x240f30(_0x10e868['rules'][_0x21f968]['condition'])?'\x20'+_0x10e868[_0x598e('0x64')][_0x21f968]['value']:'');}return _0x198495+')';};var _0x521eb0={'where':{'id':_0x255b1f['id']}},_0x2ded26,_0x51297d,_0x46592f,_0x42dc6d,_0x234a56;_0x521eb0=_[_0x598e('0x3d')]({},_0x521eb0,_0x2f3fae);return db[_0x598e('0x2f')][_0x598e('0x4e')](_0x521eb0)[_0x598e('0x24')](function(_0x266665){if(_0x266665){_0x2ded26=_0x266665;return _0x266665['getFields']();}return null;})[_0x598e('0x24')](function(_0x251b48){if(_0x251b48){if(!_0x251b48[_0x598e('0x37')]){throw new db['Sequelize'][(_0x598e('0x6b'))](_0x598e('0x6c'),0x193);}_0x51297d=_0x251b48;return db[_0x598e('0x6d')][_0x598e('0x42')]({'raw':!![]});}return null;})[_0x598e('0x24')](function(_0x251b36){if(_0x251b36){_0x46592f=_['keyBy'](_0x251b36,'id');var _0x1bfe30;var _0x57140c=squel[_0x598e('0x6f')]();_0x57140c['from'](_0x2ded26[_0x598e('0x71')]);for(var _0x143c78=0x0;_0x143c78<_0x51297d[_0x598e('0x37')];_0x143c78+=0x1){_0x1bfe30=_0x51297d[_0x143c78][_0x598e('0x72')]?_0x46592f[_0x51297d[_0x143c78]['MetricId']]['metric']:_0x51297d[_0x143c78][_0x598e('0x67')];_0x1bfe30=_0x51297d[_0x143c78][_0x598e('0x74')]?_[_0x598e('0x75')](_0x21d9f0[_0x51297d[_0x143c78]['function']],'%s',_0x1bfe30):_0x1bfe30;_0x1bfe30=_0x51297d[_0x143c78]['format']?_[_0x598e('0x75')](_0x3c0458[_0x51297d[_0x143c78]['format']],'%s',_0x1bfe30):_0x1bfe30;if(_0x51297d[_0x143c78][_0x598e('0x77')]){_0x57140c['group'](_0x1bfe30);}_0x51297d[_0x143c78]['orderBy']&&_0x57140c[_0x598e('0x38')](_0x1bfe30,_0x51297d[_0x143c78][_0x598e('0x78')]==='DESC'?![]:!![]);_0x57140c[_0x598e('0x67')](_0x1bfe30,_0x51297d[_0x143c78][_0x598e('0x7a')]||_0x1bfe30);}if(_0x2ded26[_0x598e('0x7b')]){_0x2ded26[_0x598e('0x7b')]=JSON['parse'](_0x2ded26[_0x598e('0x7b')]);for(var _0x313713=0x0;_0x313713<_0x2ded26['joins'][_0x598e('0x37')];_0x313713+=0x1){if(_0x2ded26[_0x598e('0x7b')][_0x313713][_0x598e('0x30')]&&_[_0x598e('0x60')](_0x42071b,_0x2ded26[_0x598e('0x7b')][_0x313713][_0x598e('0x30')])&&_0x2ded26[_0x598e('0x7b')][_0x313713]['parentKey']&&_0x2ded26['joins'][_0x313713][_0x598e('0x7e')]&&_0x2ded26['joins'][_0x313713]['foreignKey']){_0x57140c[_0x2ded26[_0x598e('0x7b')][_0x313713][_0x598e('0x30')]](_0x2ded26['joins'][_0x313713]['foreignTable'],null,util[_0x598e('0x76')](_0x598e('0x7f'),_0x2ded26[_0x598e('0x71')],_0x2ded26['joins'][_0x313713]['parentKey'],_0x2ded26['joins'][_0x313713][_0x598e('0x7e')],_0x2ded26['joins'][_0x313713][_0x598e('0x8e')]));}}}if(_0x2ded26[_0x598e('0x80')]){_0x2ded26['conditions']=JSON[_0x598e('0x7c')](_0x2ded26[_0x598e('0x80')]);_0x57140c[_0x598e('0x3a')](_0x1c4d83(_0x2ded26[_0x598e('0x80')]['group']));}_0x234a56=_0x57140c[_0x598e('0x81')]();_0x57140c['limit'](_0xbfca0c);_0x57140c[_0x598e('0x1a')](0x0);return;}})[_0x598e('0x24')](function(){if(_0x1785b4[_0x598e('0x8f')]===_0x598e('0x90')){return null;}var _0xd95b54=_['merge'](_0x1785b4,{'name':_0x1785b4[_0x598e('0x91')]||_0x1785b4[_0x598e('0x2b')]||_0x2ded26[_0x598e('0x2b')],'basename':_0x3e286a,'savename':util[_0x598e('0x76')](_0x598e('0x92'),_0x1785b4[_0x598e('0x2b')]||_0x2ded26[_0x598e('0x2b')],require('randomstring')['generate'](0x4),_0x1785b4[_0x598e('0x8f')]||'csv'),'reportId':_0x2ded26['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x598e('0x47')](_0xd95b54,{'raw':!![]});})[_0x598e('0x24')](function(_0x6cb4c9){if(_0x2ded26[_0x598e('0x71')]===_0x598e('0x93')){_0x234a56[_0x598e('0x3a')](_0x2ded26[_0x598e('0x71')]+_0x598e('0x94'),_0x1785b4[_0x598e('0x95')],_0x1785b4[_0x598e('0x96')]);}else{_0x234a56[_0x598e('0x3a')](_0x2ded26[_0x598e('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1785b4['startDate'],_0x1785b4[_0x598e('0x96')]);}if(_0x6cb4c9){logger['info'](_0x598e('0x97'),_0x234a56[_0x598e('0x84')]());require('child_process')['fork'](path[_0x598e('0x87')](__dirname,'../../components/export/',_0x6cb4c9[_0x598e('0x8f')]),[_0x6cb4c9['id'],_0x234a56[_0x598e('0x84')](),path['join'](__dirname,'../../files/reports',_0x6cb4c9['savename']),_0x3e286a]);return _0x6cb4c9;}else{var _0x588a55=squel[_0x598e('0x6f')]();_0x588a55[_0x598e('0x70')]('('+_0x234a56[_0x598e('0x84')]()+')','countTable');_0x588a55[_0x598e('0x67')](_0x598e('0x98'),'count');_0x234a56[_0x598e('0x1d')](_0x1785b4[_0x598e('0x1d')]||_0xbfca0c);_0x234a56[_0x598e('0x1a')](_0x1785b4[_0x598e('0x1a')]||0x0);return dbH['sequelize'][_0x598e('0x34')](_0x588a55[_0x598e('0x84')](),{'type':dbH[_0x598e('0x85')][_0x598e('0x99')][_0x598e('0x86')]})[_0x598e('0x24')](function(_0x1fc7c5){if(!_0x1fc7c5[_0x598e('0x37')]){_0x42dc6d=0x0;}else{_0x42dc6d=_0x1fc7c5[0x0][_0x598e('0x1c')]||0x0;}return dbH[_0x598e('0x85')][_0x598e('0x34')](_0x234a56['toString'](),{'type':dbH[_0x598e('0x85')][_0x598e('0x99')][_0x598e('0x86')]});})['then'](function(_0x58a3e2){return{'rows':_0x58a3e2||[],'count':_0x42dc6d};});}});}exports[_0x598e('0x9a')]=function(_0x4f9c25,_0x2fd65c){return runReport(_0x4f9c25['params'],_0x4f9c25[_0x598e('0x34')],_0x4f9c25[_0x598e('0x40')])['then'](respondWithResult(_0x2fd65c,null))['catch'](handleError(_0x2fd65c,null));};exports[_0x598e('0x9b')]=runReport;exports['query']=function(_0x381539,_0x74c91){var _0x5ad460=0xa;var _0x51968c=['join',_0x598e('0x88'),'right_join','cross_join'];var _0x312405={'SUM':_0x598e('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x598e('0x9c'),'MAX':_0x598e('0x59'),'MIN':_0x598e('0x89'),'AVG':_0x598e('0x8a'),'GROUP_CONCAT':_0x598e('0x8b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x598e('0x5a')};var _0x889936={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x598e('0x5c'),'HOUR':_0x598e('0x5d'),'ROUND':_0x598e('0x5e'),'UNIX_TIMESTAMP':_0x598e('0x5f')};var _0x311610=function(_0x24651b){return!_[_0x598e('0x60')]([_0x598e('0x61'),_0x598e('0x62'),'IS\x20EMPTY',_0x598e('0x8d')],_0x24651b);};var _0x3353eb=function(_0x53b068){if(!_0x53b068||!_0x53b068[_0x598e('0x64')]['length']){return'';}for(var _0x2faa88='(',_0x3b39ae=0x0;_0x3b39ae<_0x53b068[_0x598e('0x64')][_0x598e('0x37')];_0x3b39ae+=0x1){_0x3b39ae>0x0&&(_0x2faa88+='\x20'+_0x53b068['operator']+'\x20');_0x2faa88+=_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x66')]?_0x3353eb(_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x66')]):_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x67')]+'\x20'+_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x68')]+(_0x311610(_0x53b068[_0x598e('0x64')][_0x3b39ae]['condition'])?'\x20'+_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x69')]:'');}return _0x2faa88+')';};var _0xadc912={'where':{'id':_0x381539[_0x598e('0x53')]['id']}},_0x3e1abf,_0x12e23b,_0x3a80cc,_0x272352,_0x1ab3b3;_0xadc912=_['merge']({},_0xadc912,_0x381539[_0x598e('0x40')]);return db[_0x598e('0x2f')][_0x598e('0x4e')](_0xadc912)['then'](function(_0x268d91){if(_0x268d91){_0x3e1abf=_0x268d91;return _0x268d91[_0x598e('0x9d')]();}return null;})[_0x598e('0x24')](function(_0x3273f6){if(_0x3273f6){if(!_0x3273f6[_0x598e('0x37')]){throw new db[(_0x598e('0x6a'))][(_0x598e('0x6b'))](_0x598e('0x6c'),0x193);}_0x12e23b=_0x3273f6;return db[_0x598e('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x522217){if(_0x522217){_0x3a80cc=_[_0x598e('0x6e')](_0x522217,'id');var _0x2405fb;var _0x29ddc3=squel[_0x598e('0x6f')]();_0x29ddc3[_0x598e('0x70')](_0x3e1abf[_0x598e('0x71')]);for(var _0x3f156f=0x0;_0x3f156f<_0x12e23b[_0x598e('0x37')];_0x3f156f+=0x1){_0x2405fb=_0x12e23b[_0x3f156f][_0x598e('0x72')]?_0x3a80cc[_0x12e23b[_0x3f156f][_0x598e('0x72')]][_0x598e('0x73')]:_0x12e23b[_0x3f156f][_0x598e('0x67')];_0x2405fb=_0x12e23b[_0x3f156f]['function']?_[_0x598e('0x75')](_0x312405[_0x12e23b[_0x3f156f][_0x598e('0x74')]],'%s',_0x2405fb):_0x2405fb;_0x2405fb=_0x12e23b[_0x3f156f][_0x598e('0x76')]?_['replace'](_0x889936[_0x12e23b[_0x3f156f][_0x598e('0x76')]],'%s',_0x2405fb):_0x2405fb;if(_0x12e23b[_0x3f156f][_0x598e('0x77')]){_0x29ddc3[_0x598e('0x66')](_0x2405fb);}_0x12e23b[_0x3f156f]['orderBy']&&_0x29ddc3[_0x598e('0x38')](_0x2405fb,_0x12e23b[_0x3f156f][_0x598e('0x78')]==='DESC'?![]:!![]);_0x29ddc3[_0x598e('0x67')](_0x2405fb,_0x12e23b[_0x3f156f][_0x598e('0x7a')]||_0x2405fb);}if(_0x3e1abf[_0x598e('0x7b')]){_0x3e1abf[_0x598e('0x7b')]=JSON[_0x598e('0x7c')](_0x3e1abf[_0x598e('0x7b')]);for(var _0x5d081a=0x0;_0x5d081a<_0x3e1abf[_0x598e('0x7b')]['length'];_0x5d081a+=0x1){if(_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x30')]&&_[_0x598e('0x60')](_0x51968c,_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x30')])&&_0x3e1abf[_0x598e('0x7b')][_0x5d081a]['parentKey']&&_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x7e')]&&_0x3e1abf['joins'][_0x5d081a]['foreignKey']){_0x29ddc3[_0x3e1abf['joins'][_0x5d081a][_0x598e('0x30')]](_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x7e')],null,util[_0x598e('0x76')](_0x598e('0x7f'),_0x3e1abf['table'],_0x3e1abf[_0x598e('0x7b')][_0x5d081a]['parentKey'],_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x7e')],_0x3e1abf['joins'][_0x5d081a][_0x598e('0x8e')]));}}}if(_0x3e1abf['conditions']){_0x3e1abf['conditions']=JSON[_0x598e('0x7c')](_0x3e1abf['conditions']);_0x29ddc3[_0x598e('0x3a')](_0x3353eb(_0x3e1abf['conditions'][_0x598e('0x66')]));}_0x1ab3b3=_0x29ddc3['clone']();_0x29ddc3[_0x598e('0x1d')](_0x5ad460);_0x29ddc3[_0x598e('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x29ddc3[_0x598e('0x84')]());return dbH[_0x598e('0x85')][_0x598e('0x34')](_0x29ddc3[_0x598e('0x84')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x598e('0x24')](function(){return{'sql':_0x1ab3b3[_0x598e('0x84')]()};})['then'](respondWithResult(_0x74c91,null))[_0x598e('0x46')](handleError(_0x74c91,null));};
\ No newline at end of file
diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js
index 658d00c..78b1df0 100644
--- a/server/api/analyticCustomReport/analyticCustomReport.model.js
+++ b/server/api/analyticCustomReport/analyticCustomReport.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x4d5a=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x1fb75c,_0x28e425){var _0x52455b=function(_0x4dc73e){while(--_0x4dc73e){_0x1fb75c['push'](_0x1fb75c['shift']());}};_0x52455b(++_0x28e425);}(_0x4d5a,0x1c2));var _0xa4d5=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x4d5a[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xa4d5('0x0'));var util=require(_0xa4d5('0x1'));var logger=require(_0xa4d5('0x2'))('api');var moment=require(_0xa4d5('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4d5('0x4'));var fs=require('fs');var path=require(_0xa4d5('0x5'));var rimraf=require('rimraf');var config=require(_0xa4d5('0x6'));var attributes=require(_0xa4d5('0x7'));module[_0xa4d5('0x8')]=function(_0x37593e,_0x57bcee){return _0x37593e[_0xa4d5('0x9')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x44cd=['AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x21d94c,_0x564a82){var _0x4772dc=function(_0x4d8107){while(--_0x4d8107){_0x21d94c['push'](_0x21d94c['shift']());}};_0x4772dc(++_0x564a82);}(_0x44cd,0xde));var _0xd44c=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0x44cd[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0xd44c('0x0'));var util=require('util');var logger=require(_0xd44c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd44c('0x2'));var rp=require(_0xd44c('0x3'));var fs=require('fs');var path=require(_0xd44c('0x4'));var rimraf=require(_0xd44c('0x5'));var config=require(_0xd44c('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xd44c('0x7')]=function(_0x3478d8,_0x1c5caf){return _0x3478d8['define'](_0xd44c('0x8'),attributes,{'tableName':_0xd44c('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js
index 7eea0c1..3363988 100644
--- a/server/api/analyticCustomReport/analyticCustomReport.rpc.js
+++ b/server/api/analyticCustomReport/analyticCustomReport.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd41f=['jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd41f,0xf1));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xfd41('0x0'));var moment=require(_0xfd41('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd41('0x2'));var fs=require('fs');var Redis=require(_0xfd41('0x3'));var db=require(_0xfd41('0x4'))['db'];var utils=require(_0xfd41('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfd41('0x6'));var client=jayson['client'][_0xfd41('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a1f71,_0x3c4ba2,_0x289c13){return new BPromise(function(_0x5e9bf2,_0x898a79){return client[_0xfd41('0x8')](_0x5a1f71,_0x289c13)[_0xfd41('0x9')](function(_0x4fdd6f){logger[_0xfd41('0xa')](_0xfd41('0xb'),_0x3c4ba2,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3c4ba2,'request\x20sent',JSON[_0xfd41('0xc')](_0x4fdd6f));if(_0x4fdd6f['error']){if(_0x4fdd6f['error'][_0xfd41('0xd')]===0x1f4){logger[_0xfd41('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3c4ba2,_0x4fdd6f[_0xfd41('0xe')]['message']);return _0x898a79(_0x4fdd6f['error'][_0xfd41('0xf')]);}logger[_0xfd41('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3c4ba2,_0x4fdd6f[_0xfd41('0xe')][_0xfd41('0xf')]);return _0x5e9bf2(_0x4fdd6f[_0xfd41('0xe')][_0xfd41('0xf')]);}else{logger[_0xfd41('0xa')](_0xfd41('0xb'),_0x3c4ba2,_0xfd41('0x10'));_0x5e9bf2(_0x4fdd6f[_0xfd41('0x11')][_0xfd41('0xf')]);}})[_0xfd41('0x12')](function(_0x5b9868){logger[_0xfd41('0xe')](_0xfd41('0xb'),_0x3c4ba2,_0x5b9868);_0x898a79(_0x5b9868);});});}
\ No newline at end of file
+var _0x89f9=['jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x89f9,0x19f));var _0x989f=function(_0x37f9ae,_0x577eaa){_0x37f9ae=_0x37f9ae-0x0;var _0x53fbb4=_0x89f9[_0x37f9ae];return _0x53fbb4;};'use strict';var _=require(_0x989f('0x0'));var util=require(_0x989f('0x1'));var moment=require(_0x989f('0x2'));var BPromise=require(_0x989f('0x3'));var rs=require(_0x989f('0x4'));var fs=require('fs');var Redis=require(_0x989f('0x5'));var db=require(_0x989f('0x6'))['db'];var utils=require(_0x989f('0x7'));var logger=require(_0x989f('0x8'))('rpc');var config=require(_0x989f('0x9'));var jayson=require(_0x989f('0xa'));var client=jayson[_0x989f('0xb')][_0x989f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x307247,_0x47d120,_0x2838cc){return new BPromise(function(_0x1e71b6,_0xb66a36){return client[_0x989f('0xd')](_0x307247,_0x2838cc)[_0x989f('0xe')](function(_0x30bf90){logger[_0x989f('0xf')](_0x989f('0x10'),_0x47d120,_0x989f('0x11'));logger[_0x989f('0x12')](_0x989f('0x13'),_0x47d120,_0x989f('0x11'),JSON[_0x989f('0x14')](_0x30bf90));if(_0x30bf90[_0x989f('0x15')]){if(_0x30bf90['error'][_0x989f('0x16')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x47d120,_0x30bf90['error'][_0x989f('0x17')]);return _0xb66a36(_0x30bf90['error'][_0x989f('0x17')]);}logger[_0x989f('0x15')](_0x989f('0x10'),_0x47d120,_0x30bf90[_0x989f('0x15')][_0x989f('0x17')]);return _0x1e71b6(_0x30bf90['error']['message']);}else{logger[_0x989f('0xf')](_0x989f('0x10'),_0x47d120,_0x989f('0x11'));_0x1e71b6(_0x30bf90[_0x989f('0x18')][_0x989f('0x17')]);}})['catch'](function(_0x291e61){logger['error'](_0x989f('0x10'),_0x47d120,_0x291e61);_0xb66a36(_0x291e61);});});}
\ No newline at end of file
diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js
index 11c8028..702da56 100644
--- a/server/api/analyticCustomReport/index.js
+++ b/server/api/analyticCustomReport/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc248=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','run','/:id/query','query','post','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xc248,0xfc));var _0x8c24=function(_0x3aeab4,_0x1e7f27){_0x3aeab4=_0x3aeab4-0x0;var _0x2c9286=_0xc248[_0x3aeab4];return _0x2c9286;};'use strict';var multer=require(_0x8c24('0x0'));var util=require(_0x8c24('0x1'));var path=require('path');var timeout=require(_0x8c24('0x2'));var express=require(_0x8c24('0x3'));var router=express[_0x8c24('0x4')]();var fs_extra=require(_0x8c24('0x5'));var auth=require(_0x8c24('0x6'));var interaction=require(_0x8c24('0x7'));var config=require(_0x8c24('0x8'));var controller=require(_0x8c24('0x9'));router[_0x8c24('0xa')]('/',auth[_0x8c24('0xb')](),controller[_0x8c24('0xc')]);router[_0x8c24('0xa')](_0x8c24('0xd'),auth[_0x8c24('0xb')](),controller[_0x8c24('0xe')]);router[_0x8c24('0xa')](_0x8c24('0xf'),auth['isAuthenticated'](),controller['preview']);router[_0x8c24('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0x8c24('0x10')]);router[_0x8c24('0xa')](_0x8c24('0x11'),auth[_0x8c24('0xb')](),controller[_0x8c24('0x12')]);router[_0x8c24('0x13')]('/',auth[_0x8c24('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8c24('0xb')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x8a33=['isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id'];(function(_0x6c649c,_0x5a5c9e){var _0x28e9e8=function(_0x365f29){while(--_0x365f29){_0x6c649c['push'](_0x6c649c['shift']());}};_0x28e9e8(++_0x5a5c9e);}(_0x8a33,0xee));var _0x38a3=function(_0x443f79,_0x33e446){_0x443f79=_0x443f79-0x0;var _0x3847e4=_0x8a33[_0x443f79];return _0x3847e4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x38a3('0x0'));var timeout=require(_0x38a3('0x1'));var express=require(_0x38a3('0x2'));var router=express[_0x38a3('0x3')]();var fs_extra=require(_0x38a3('0x4'));var auth=require(_0x38a3('0x5'));var interaction=require(_0x38a3('0x6'));var config=require(_0x38a3('0x7'));var controller=require(_0x38a3('0x8'));router[_0x38a3('0x9')]('/',auth['isAuthenticated'](),controller[_0x38a3('0xa')]);router[_0x38a3('0x9')](_0x38a3('0xb'),auth[_0x38a3('0xc')](),controller[_0x38a3('0xd')]);router[_0x38a3('0x9')](_0x38a3('0xe'),auth['isAuthenticated'](),controller[_0x38a3('0xf')]);router[_0x38a3('0x9')](_0x38a3('0x10'),auth[_0x38a3('0xc')](),controller[_0x38a3('0x11')]);router[_0x38a3('0x9')](_0x38a3('0x12'),auth['isAuthenticated'](),controller[_0x38a3('0x13')]);router[_0x38a3('0x14')]('/',auth['isAuthenticated'](),controller[_0x38a3('0x15')]);router[_0x38a3('0x16')](_0x38a3('0xb'),auth[_0x38a3('0xc')](),controller[_0x38a3('0x17')]);router['delete']('/:id',auth[_0x38a3('0xc')](),controller['destroy']);module[_0x38a3('0x18')]=router;
\ No newline at end of file
diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js
index 96adf6f..6719bb3 100644
--- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js
+++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x46ed,0x168));var _0xd46e=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x46ed[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}};
\ No newline at end of file
+var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x224ce8,_0x565691){var _0x5054a1=function(_0x5dde3f){while(--_0x5dde3f){_0x224ce8['push'](_0x224ce8['shift']());}};_0x5054a1(++_0x565691);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}};
\ No newline at end of file
diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js
index fe650e5..7be16a5 100644
--- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js
+++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x92850b,_0xc43190){var _0x138c1f=function(_0x1587a3){while(--_0x1587a3){_0x92850b['push'](_0x92850b['shift']());}};_0x138c1f(++_0xc43190);}(_0xf494,0x1c6));var _0x4f49=function(_0x2f7c43,_0x5ca843){_0x2f7c43=_0x2f7c43-0x0;var _0x3da68f=_0xf494[_0x2f7c43];return _0x3da68f;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));};
\ No newline at end of file
+var _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x326f,0xd1));var _0xf326=function(_0x1e6f3b,_0x58993b){_0x1e6f3b=_0x1e6f3b-0x0;var _0x577290=_0x326f[_0x1e6f3b];return _0x577290;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));};
\ No newline at end of file
diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js
index 68f7525..bcfb2da 100644
--- a/server/api/analyticDefaultReport/analyticDefaultReport.model.js
+++ b/server/api/analyticDefaultReport/analyticDefaultReport.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x21bd=['AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x21bd,0x1a6));var _0xd21b=function(_0x5b9f58,_0x4fc62d){_0x5b9f58=_0x5b9f58-0x0;var _0xb4365d=_0x21bd[_0x5b9f58];return _0xb4365d;};'use strict';var _=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var logger=require('../../config/logger')(_0xd21b('0x2'));var moment=require(_0xd21b('0x3'));var BPromise=require(_0xd21b('0x4'));var rp=require(_0xd21b('0x5'));var fs=require('fs');var path=require(_0xd21b('0x6'));var rimraf=require(_0xd21b('0x7'));var config=require(_0xd21b('0x8'));var attributes=require(_0xd21b('0x9'));module[_0xd21b('0xa')]=function(_0x35aa12,_0x9c62bb){return _0x35aa12[_0xd21b('0xb')](_0xd21b('0xc'),attributes,{'tableName':_0xd21b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x22a7=['../../config/logger','api','moment','bluebird','path','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x3a030a,_0x56f29a){var _0xcaf7b8=function(_0x3af88a){while(--_0x3af88a){_0x3a030a['push'](_0x3a030a['shift']());}};_0xcaf7b8(++_0x56f29a);}(_0x22a7,0x1ea));var _0x722a=function(_0x1dfb49,_0x3300db){_0x1dfb49=_0x1dfb49-0x0;var _0x7ea566=_0x22a7[_0x1dfb49];return _0x7ea566;};'use strict';var _=require(_0x722a('0x0'));var util=require(_0x722a('0x1'));var logger=require(_0x722a('0x2'))(_0x722a('0x3'));var moment=require(_0x722a('0x4'));var BPromise=require(_0x722a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x722a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x722a('0x7'));module[_0x722a('0x8')]=function(_0xb7d097,_0x57ad58){return _0xb7d097[_0x722a('0x9')](_0x722a('0xa'),attributes,{'tableName':_0x722a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js
index 029f11b..54f8102 100644
--- a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js
+++ b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x53e5=['info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x53e5,0x153));var _0x553e=function(_0x17a98c,_0x5251f5){_0x17a98c=_0x17a98c-0x0;var _0x1bfd30=_0x53e5[_0x17a98c];return _0x1bfd30;};'use strict';var _=require(_0x553e('0x0'));var util=require(_0x553e('0x1'));var moment=require(_0x553e('0x2'));var BPromise=require(_0x553e('0x3'));var rs=require(_0x553e('0x4'));var fs=require('fs');var Redis=require(_0x553e('0x5'));var db=require(_0x553e('0x6'))['db'];var utils=require(_0x553e('0x7'));var logger=require(_0x553e('0x8'))('rpc');var config=require(_0x553e('0x9'));var jayson=require(_0x553e('0xa'));var client=jayson[_0x553e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d4931,_0x3d07c3,_0x5357c2){return new BPromise(function(_0x57fee9,_0x3ab38c){return client['request'](_0x5d4931,_0x5357c2)[_0x553e('0xc')](function(_0x28b40a){logger[_0x553e('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d07c3,'request\x20sent');logger[_0x553e('0xe')](_0x553e('0xf'),_0x3d07c3,_0x553e('0x10'),JSON['stringify'](_0x28b40a));if(_0x28b40a['error']){if(_0x28b40a[_0x553e('0x11')]['code']===0x1f4){logger['error'](_0x553e('0x12'),_0x3d07c3,_0x28b40a[_0x553e('0x11')]['message']);return _0x3ab38c(_0x28b40a[_0x553e('0x11')][_0x553e('0x13')]);}logger[_0x553e('0x11')](_0x553e('0x12'),_0x3d07c3,_0x28b40a[_0x553e('0x11')][_0x553e('0x13')]);return _0x57fee9(_0x28b40a[_0x553e('0x11')]['message']);}else{logger[_0x553e('0xd')](_0x553e('0x12'),_0x3d07c3,'request\x20sent');_0x57fee9(_0x28b40a[_0x553e('0x14')][_0x553e('0x13')]);}})[_0x553e('0x15')](function(_0x792387){logger[_0x553e('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d07c3,_0x792387);_0x3ab38c(_0x792387);});});}
\ No newline at end of file
+var _0xfe33=['message','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x232e7a,_0x19997){var _0x445ddd=function(_0x43628d){while(--_0x43628d){_0x232e7a['push'](_0x232e7a['shift']());}};_0x445ddd(++_0x19997);}(_0xfe33,0x87));var _0x3fe3=function(_0x39e15b,_0x555185){_0x39e15b=_0x39e15b-0x0;var _0x4e5766=_0xfe33[_0x39e15b];return _0x4e5766;};'use strict';var _=require('lodash');var util=require(_0x3fe3('0x0'));var moment=require(_0x3fe3('0x1'));var BPromise=require(_0x3fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fe3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fe3('0x4'))(_0x3fe3('0x5'));var config=require(_0x3fe3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3fe3('0x7')][_0x3fe3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f37ff,_0x21b040,_0x9b80a1){return new BPromise(function(_0x3ef4d9,_0x15bc0d){return client[_0x3fe3('0x9')](_0x2f37ff,_0x9b80a1)[_0x3fe3('0xa')](function(_0x28c716){logger[_0x3fe3('0xb')](_0x3fe3('0xc'),_0x21b040,_0x3fe3('0xd'));logger[_0x3fe3('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x21b040,'request\x20sent',JSON[_0x3fe3('0xf')](_0x28c716));if(_0x28c716['error']){if(_0x28c716[_0x3fe3('0x10')]['code']===0x1f4){logger['error'](_0x3fe3('0xc'),_0x21b040,_0x28c716[_0x3fe3('0x10')][_0x3fe3('0x11')]);return _0x15bc0d(_0x28c716['error'][_0x3fe3('0x11')]);}logger[_0x3fe3('0x10')](_0x3fe3('0xc'),_0x21b040,_0x28c716['error'][_0x3fe3('0x11')]);return _0x3ef4d9(_0x28c716[_0x3fe3('0x10')][_0x3fe3('0x11')]);}else{logger[_0x3fe3('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x21b040,_0x3fe3('0xd'));_0x3ef4d9(_0x28c716['result']['message']);}})[_0x3fe3('0x12')](function(_0x4a9ae3){logger['error'](_0x3fe3('0xc'),_0x21b040,_0x4a9ae3);_0x15bc0d(_0x4a9ae3);});});}
\ No newline at end of file
diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js
index f78788c..e8f1325 100644
--- a/server/api/analyticDefaultReport/index.js
+++ b/server/api/analyticDefaultReport/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x83a0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','/:id','multer','util','path','connect-timeout','express'];(function(_0x1e5e1c,_0x2125e9){var _0x5e9656=function(_0x4c95e7){while(--_0x4c95e7){_0x1e5e1c['push'](_0x1e5e1c['shift']());}};_0x5e9656(++_0x2125e9);}(_0x83a0,0x181));var _0x083a=function(_0x585837,_0x49c11d){_0x585837=_0x585837-0x0;var _0x3a859e=_0x83a0[_0x585837];return _0x3a859e;};'use strict';var multer=require(_0x083a('0x0'));var util=require(_0x083a('0x1'));var path=require(_0x083a('0x2'));var timeout=require(_0x083a('0x3'));var express=require(_0x083a('0x4'));var router=express[_0x083a('0x5')]();var fs_extra=require(_0x083a('0x6'));var auth=require(_0x083a('0x7'));var interaction=require(_0x083a('0x8'));var config=require(_0x083a('0x9'));var controller=require(_0x083a('0xa'));router[_0x083a('0xb')]('/',auth['isAuthenticated'](),controller[_0x083a('0xc')]);router[_0x083a('0xb')]('/:id',auth[_0x083a('0xd')](),controller[_0x083a('0xe')]);router[_0x083a('0xb')](_0x083a('0xf'),auth[_0x083a('0xd')](),controller[_0x083a('0x10')]);router['get'](_0x083a('0x11'),auth[_0x083a('0xd')](),controller[_0x083a('0x12')]);router[_0x083a('0xb')](_0x083a('0x13'),auth['isAuthenticated'](),controller['query']);router[_0x083a('0x14')]('/',auth[_0x083a('0xd')](),controller[_0x083a('0x15')]);router[_0x083a('0x16')]('/:id',auth[_0x083a('0xd')](),controller[_0x083a('0x17')]);router[_0x083a('0x18')](_0x083a('0x19'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x2009=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x37dd5f,_0x104365){var _0x2fc2e7=function(_0x5b7d76){while(--_0x5b7d76){_0x37dd5f['push'](_0x37dd5f['shift']());}};_0x2fc2e7(++_0x104365);}(_0x2009,0xac));var _0x9200=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2009[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9200('0x0'));var util=require('util');var path=require(_0x9200('0x1'));var timeout=require(_0x9200('0x2'));var express=require(_0x9200('0x3'));var router=express[_0x9200('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9200('0x5'));var interaction=require(_0x9200('0x6'));var config=require(_0x9200('0x7'));var controller=require(_0x9200('0x8'));router[_0x9200('0x9')]('/',auth[_0x9200('0xa')](),controller[_0x9200('0xb')]);router[_0x9200('0x9')](_0x9200('0xc'),auth[_0x9200('0xa')](),controller[_0x9200('0xd')]);router[_0x9200('0x9')](_0x9200('0xe'),auth[_0x9200('0xa')](),controller[_0x9200('0xf')]);router[_0x9200('0x9')]('/:id/run',auth[_0x9200('0xa')](),controller[_0x9200('0x10')]);router['get'](_0x9200('0x11'),auth['isAuthenticated'](),controller[_0x9200('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x9200('0xa')](),controller[_0x9200('0x13')]);router[_0x9200('0x14')](_0x9200('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9200('0x15')]=router;
\ No newline at end of file
diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js
index 80e746b..f84e16f 100644
--- a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js
+++ b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xa4b8=['DATE','Loading','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf','xlsx'];(function(_0x240f68,_0x5769b9){var _0x1fe163=function(_0x4522b2){while(--_0x4522b2){_0x240f68['push'](_0x240f68['shift']());}};_0x1fe163(++_0x5769b9);}(_0xa4b8,0x1cd));var _0x8a4b=function(_0x245c42,_0x1953e7){_0x245c42=_0x245c42-0x0;var _0x243649=_0xa4b8[_0x245c42];return _0x243649;};'use strict';var Sequelize=require(_0x8a4b('0x0'));var moment=require(_0x8a4b('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x8a4b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x8a4b('0x3')](_0x8a4b('0x4'),_0x8a4b('0x5'),_0x8a4b('0x6')),'allowNull':![],'defaultValue':_0x8a4b('0x4')},'savename':{'type':Sequelize[_0x8a4b('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8a4b('0x7')]},'endDate':{'type':Sequelize[_0x8a4b('0x7')]},'status':{'type':Sequelize[_0x8a4b('0x2')],'defaultValue':_0x8a4b('0x8')},'type':{'type':Sequelize[_0x8a4b('0x3')]('manual',_0x8a4b('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x8a4b('0xa')](0xb)[_0x8a4b('0xb')]},'reportType':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xb341=['ENUM','pdf','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','STRING'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb341,0x18f));var _0x1b34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb341[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x1b34('0x0')],'allowNull':![]},'basename':{'type':Sequelize[_0x1b34('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0x1b34('0x1')]('csv',_0x1b34('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x1b34('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x1b34('0x4')]},'status':{'type':Sequelize[_0x1b34('0x0')],'defaultValue':_0x1b34('0x5')},'type':{'type':Sequelize[_0x1b34('0x1')](_0x1b34('0x6'),_0x1b34('0x7')),'allowNull':![],'defaultValue':_0x1b34('0x6')},'reportId':{'type':Sequelize[_0x1b34('0x8')](0xb)[_0x1b34('0x9')]},'reportType':{'type':Sequelize[_0x1b34('0x0')]}};
\ No newline at end of file
diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js
index 5ba0c1e..2b55794 100644
--- a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js
+++ b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x0fb1=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','type','includeAll','rows','catch','params','AnalyticExtractedReport','length','include','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','body','download','basename','savename','existsSync','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','server/files/reports','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','stack','name','send','index','map','fieldName'];(function(_0x1b13c8,_0x46c81f){var _0x707ce9=function(_0x40edab){while(--_0x40edab){_0x1b13c8['push'](_0x1b13c8['shift']());}};_0x707ce9(++_0x46c81f);}(_0x0fb1,0xe1));var _0x10fb=function(_0x301d02,_0x25bf0f){_0x301d02=_0x301d02-0x0;var _0x4ce8e5=_0x0fb1[_0x301d02];return _0x4ce8e5;};'use strict';var emlformat=require(_0x10fb('0x0'));var rimraf=require(_0x10fb('0x1'));var zipdir=require(_0x10fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x10fb('0x3'));var moment=require('moment');var BPromise=require(_0x10fb('0x4'));var Mustache=require('mustache');var util=require(_0x10fb('0x5'));var path=require(_0x10fb('0x6'));var sox=require(_0x10fb('0x7'));var csv=require('to-csv');var ejs=require(_0x10fb('0x8'));var fs=require('fs');var fs_extra=require(_0x10fb('0x9'));var _=require('lodash');var squel=require(_0x10fb('0xa'));var crypto=require(_0x10fb('0xb'));var jsforce=require(_0x10fb('0xc'));var deskjs=require(_0x10fb('0xd'));var toCsv=require(_0x10fb('0xe'));var querystring=require(_0x10fb('0xf'));var Papa=require(_0x10fb('0x10'));var Redis=require('ioredis');var authService=require(_0x10fb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x10fb('0x12'));var hardwareService=require(_0x10fb('0x13'));var logger=require('../../config/logger')(_0x10fb('0x14'));var utils=require(_0x10fb('0x15'));var config=require(_0x10fb('0x16'));var licenseUtil=require(_0x10fb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dcabf,_0x4f5d3c){_0x4f5d3c=_0x4f5d3c||0xcc;return function(_0x4c95f5){if(_0x4c95f5){return _0x5dcabf[_0x10fb('0x18')](_0x4f5d3c);}return _0x5dcabf[_0x10fb('0x19')](_0x4f5d3c)[_0x10fb('0x1a')]();};}function respondWithResult(_0x5224da,_0x17b0a3){_0x17b0a3=_0x17b0a3||0xc8;return function(_0x324516){if(_0x324516){return _0x5224da[_0x10fb('0x19')](_0x17b0a3)[_0x10fb('0x1b')](_0x324516);}};}function respondWithFilteredResult(_0x245a04,_0xfcb15d){return function(_0xafb92e){if(_0xafb92e){var _0x3b7414=typeof _0xfcb15d[_0x10fb('0x1c')]===_0x10fb('0x1d')&&typeof _0xfcb15d[_0x10fb('0x1e')]===_0x10fb('0x1d');var _0x1f422a=_0xafb92e[_0x10fb('0x1f')];var _0x3618db=_0x3b7414?0x0:_0xfcb15d[_0x10fb('0x1c')];var _0x389993=_0x3b7414?_0xafb92e[_0x10fb('0x1f')]:_0xfcb15d[_0x10fb('0x1c')]+_0xfcb15d[_0x10fb('0x1e')];var _0x26a742;if(_0x389993>=_0x1f422a){_0x389993=_0x1f422a;_0x26a742=0xc8;}else{_0x26a742=0xce;}_0x245a04[_0x10fb('0x19')](_0x26a742);return _0x245a04[_0x10fb('0x20')](_0x10fb('0x21'),_0x3618db+'-'+_0x389993+'/'+_0x1f422a)[_0x10fb('0x1b')](_0xafb92e);}return null;};}function patchUpdates(_0x2909c0){return function(_0x3b6e95){try{jsonpatch[_0x10fb('0x22')](_0x3b6e95,_0x2909c0,!![]);}catch(_0x2c4904){return BPromise[_0x10fb('0x23')](_0x2c4904);}return _0x3b6e95[_0x10fb('0x24')]();};}function saveUpdates(_0x5f0d1b,_0x8f2eb5){return function(_0x378a69){if(_0x378a69){return _0x378a69[_0x10fb('0x25')](_0x5f0d1b)[_0x10fb('0x26')](function(_0x334eda){return _0x334eda;});}return null;};}function removeEntity(_0x13a100,_0xbfb3b8){return function(_0xb9a1da){if(_0xb9a1da){return _0xb9a1da[_0x10fb('0x27')]()[_0x10fb('0x26')](function(){var _0x2b1e59=_0xb9a1da[_0x10fb('0x28')]({'plain':!![]});var _0x3eaa02=_0x10fb('0x29');return db['UserProfileResource'][_0x10fb('0x27')]({'where':{'type':_0x3eaa02,'resourceId':_0x2b1e59['id']}})['then'](function(){return _0xb9a1da;});})[_0x10fb('0x26')](function(){_0x13a100[_0x10fb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xac09b6,_0x46c33c){return function(_0x4171b6){if(!_0x4171b6){_0xac09b6[_0x10fb('0x18')](0x194);}return _0x4171b6;};}function handleError(_0x1ec224,_0x17fd94){_0x17fd94=_0x17fd94||0x1f4;return function(_0x4af9fa){logger['error'](_0x4af9fa[_0x10fb('0x2a')]);if(_0x4af9fa[_0x10fb('0x2b')]){delete _0x4af9fa[_0x10fb('0x2b')];}_0x1ec224[_0x10fb('0x19')](_0x17fd94)[_0x10fb('0x2c')](_0x4af9fa);};}exports[_0x10fb('0x2d')]=function(_0x521fe7,_0x2a99e0){var _0x496d6e={},_0x366b35={},_0x45ef3c={'count':0x0,'rows':[]};var _0x531417=_[_0x10fb('0x2e')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x49b53f){return{'name':_0x49b53f[_0x10fb('0x2f')],'type':_0x49b53f['type']['key']};});_0x366b35[_0x10fb('0x30')]=_[_0x10fb('0x2e')](_0x531417,'name');_0x366b35[_0x10fb('0x31')]=_[_0x10fb('0x32')](_0x521fe7[_0x10fb('0x31')]);_0x366b35[_0x10fb('0x33')]=_[_0x10fb('0x34')](_0x366b35['model'],_0x366b35[_0x10fb('0x31')]);_0x496d6e[_0x10fb('0x35')]=_[_0x10fb('0x34')](_0x366b35[_0x10fb('0x30')],qs[_0x10fb('0x36')](_0x521fe7[_0x10fb('0x31')]['fields']));_0x496d6e[_0x10fb('0x35')]=_0x496d6e[_0x10fb('0x35')]['length']?_0x496d6e[_0x10fb('0x35')]:_0x366b35[_0x10fb('0x30')];if(!_0x521fe7[_0x10fb('0x31')][_0x10fb('0x37')](_0x10fb('0x38'))){_0x496d6e[_0x10fb('0x1e')]=qs[_0x10fb('0x1e')](_0x521fe7[_0x10fb('0x31')][_0x10fb('0x1e')]);_0x496d6e[_0x10fb('0x1c')]=qs[_0x10fb('0x1c')](_0x521fe7['query'][_0x10fb('0x1c')]);}_0x496d6e[_0x10fb('0x39')]=qs['sort'](_0x521fe7[_0x10fb('0x31')]['sort']);_0x496d6e[_0x10fb('0x3a')]=qs['filters'](_[_0x10fb('0x3b')](_0x521fe7[_0x10fb('0x31')],_0x366b35[_0x10fb('0x33')]),_0x531417);if(_0x521fe7[_0x10fb('0x31')]['filter']){_0x496d6e[_0x10fb('0x3a')]=_['merge'](_0x496d6e[_0x10fb('0x3a')],{'$or':_[_0x10fb('0x2e')](_0x531417,function(_0x1841fe){if(_0x1841fe[_0x10fb('0x3c')]!=='VIRTUAL'){var _0x5283dd={};_0x5283dd[_0x1841fe[_0x10fb('0x2b')]]={'$like':'%'+_0x521fe7['query']['filter']+'%'};return _0x5283dd;}})});}_0x496d6e=_['merge']({},_0x496d6e,_0x521fe7['options']);var _0x3507fd={'where':_0x496d6e[_0x10fb('0x3a')]};return db['AnalyticExtractedReport'][_0x10fb('0x1f')](_0x3507fd)[_0x10fb('0x26')](function(_0x323225){_0x45ef3c['count']=_0x323225;if(_0x521fe7['query'][_0x10fb('0x3d')]){_0x496d6e['include']=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x496d6e);})[_0x10fb('0x26')](function(_0x21123c){_0x45ef3c[_0x10fb('0x3e')]=_0x21123c;return _0x45ef3c;})['then'](respondWithFilteredResult(_0x2a99e0,_0x496d6e))[_0x10fb('0x3f')](handleError(_0x2a99e0,null));};exports['show']=function(_0x296e93,_0x1095f3){var _0x358394={'raw':!![],'where':{'id':_0x296e93[_0x10fb('0x40')]['id']}},_0x2dece7={};_0x2dece7[_0x10fb('0x30')]=_[_0x10fb('0x32')](db[_0x10fb('0x41')]['rawAttributes']);_0x2dece7[_0x10fb('0x31')]=_[_0x10fb('0x32')](_0x296e93[_0x10fb('0x31')]);_0x2dece7[_0x10fb('0x33')]=_[_0x10fb('0x34')](_0x2dece7['model'],_0x2dece7[_0x10fb('0x31')]);_0x358394[_0x10fb('0x35')]=_[_0x10fb('0x34')](_0x2dece7[_0x10fb('0x30')],qs[_0x10fb('0x36')](_0x296e93[_0x10fb('0x31')]['fields']));_0x358394[_0x10fb('0x35')]=_0x358394[_0x10fb('0x35')][_0x10fb('0x42')]?_0x358394[_0x10fb('0x35')]:_0x2dece7[_0x10fb('0x30')];if(_0x296e93[_0x10fb('0x31')][_0x10fb('0x3d')]){_0x358394[_0x10fb('0x43')]=[{'all':!![]}];}_0x358394=_[_0x10fb('0x44')]({},_0x358394,_0x296e93[_0x10fb('0x45')]);return db[_0x10fb('0x41')]['find'](_0x358394)[_0x10fb('0x26')](handleEntityNotFound(_0x1095f3,null))[_0x10fb('0x26')](respondWithResult(_0x1095f3,null))[_0x10fb('0x3f')](handleError(_0x1095f3,null));};exports[_0x10fb('0x46')]=function(_0x414ed7,_0x125e0e){return db[_0x10fb('0x41')][_0x10fb('0x46')](_0x414ed7['body'],{})['then'](function(_0x406ee6){var _0x20d423=_0x414ed7[_0x10fb('0x47')][_0x10fb('0x28')]({'plain':!![]});if(!_0x20d423)throw new Error(_0x10fb('0x48'));if(_0x20d423['role']===_0x10fb('0x47')){var _0x17aa80=_0x406ee6[_0x10fb('0x28')]({'plain':!![]});var _0x4a9778='ExtractedReports';return db[_0x10fb('0x49')][_0x10fb('0x4a')]({'where':{'name':_0x4a9778,'userProfileId':_0x20d423[_0x10fb('0x4b')]},'raw':!![]})[_0x10fb('0x26')](function(_0x2337d0){if(_0x2337d0&&_0x2337d0[_0x10fb('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x17aa80[_0x10fb('0x2b')],'resourceId':_0x17aa80['id'],'type':_0x2337d0[_0x10fb('0x2b')],'sectionId':_0x2337d0['id']},{})[_0x10fb('0x26')](function(){return _0x406ee6;});}else{return _0x406ee6;}})[_0x10fb('0x3f')](function(_0x3bea93){logger[_0x10fb('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bea93);throw _0x3bea93;});}return _0x406ee6;})['then'](respondWithResult(_0x125e0e,0xc9))[_0x10fb('0x3f')](handleError(_0x125e0e,null));};exports[_0x10fb('0x25')]=function(_0x4df615,_0x28580f){if(_0x4df615[_0x10fb('0x4e')]['id']){delete _0x4df615[_0x10fb('0x4e')]['id'];}return db[_0x10fb('0x41')][_0x10fb('0x4a')]({'where':{'id':_0x4df615[_0x10fb('0x40')]['id']}})[_0x10fb('0x26')](handleEntityNotFound(_0x28580f,null))[_0x10fb('0x26')](saveUpdates(_0x4df615['body'],null))[_0x10fb('0x26')](respondWithResult(_0x28580f,null))[_0x10fb('0x3f')](handleError(_0x28580f,null));};exports[_0x10fb('0x27')]=function(_0x5a043c,_0x3c9796){return db[_0x10fb('0x41')]['find']({'where':{'id':_0x5a043c[_0x10fb('0x40')]['id']}})['then'](handleEntityNotFound(_0x3c9796,null))[_0x10fb('0x26')](removeEntity(_0x3c9796,null))[_0x10fb('0x3f')](handleError(_0x3c9796,null));};exports[_0x10fb('0x4f')]=function(_0x1ecf9a,_0x35c59e,_0x2b2f98){return db[_0x10fb('0x41')]['find']({'where':{'id':_0x1ecf9a[_0x10fb('0x40')]['id']},'attributes':['name',_0x10fb('0x50'),_0x10fb('0x51'),'output'],'raw':!![]})[_0x10fb('0x26')](handleEntityNotFound(_0x35c59e,null))[_0x10fb('0x26')](function(_0x43ed19){if(_0x43ed19){if(!fs[_0x10fb('0x52')](path['join'](config['root'],'server/files/reports',_0x43ed19[_0x10fb('0x51')]))){throw new db[(_0x10fb('0x53'))][(_0x10fb('0x54'))](_0x10fb('0x55'));}if(_0x1ecf9a[_0x10fb('0x31')]['exists']){return _0x35c59e[_0x10fb('0x18')](0xc8);}return _0x35c59e[_0x10fb('0x4f')](path[_0x10fb('0x56')](config['root'],_0x10fb('0x57'),_0x43ed19['savename']),util['format'](_0x10fb('0x58'),_0x43ed19[_0x10fb('0x50')]||_0x43ed19[_0x10fb('0x2b')],_0x43ed19[_0x10fb('0x59')][_0x10fb('0x5a')]()));}})[_0x10fb('0x3f')](handleError(_0x35c59e,null));};
\ No newline at end of file
+var _0x48af=['%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','then','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','user','role','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','download','format'];(function(_0x2ada28,_0x6125b8){var _0x5187c1=function(_0x26cb63){while(--_0x26cb63){_0x2ada28['push'](_0x2ada28['shift']());}};_0x5187c1(++_0x6125b8);}(_0x48af,0x129));var _0xf48a=function(_0x4d515d,_0x108c96){_0x4d515d=_0x4d515d-0x0;var _0x58fe07=_0x48af[_0x4d515d];return _0x58fe07;};'use strict';var emlformat=require(_0xf48a('0x0'));var rimraf=require(_0xf48a('0x1'));var zipdir=require(_0xf48a('0x2'));var jsonpatch=require(_0xf48a('0x3'));var rp=require('request-promise');var moment=require(_0xf48a('0x4'));var BPromise=require(_0xf48a('0x5'));var Mustache=require('mustache');var util=require(_0xf48a('0x6'));var path=require('path');var sox=require(_0xf48a('0x7'));var csv=require(_0xf48a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf48a('0x9'));var _=require(_0xf48a('0xa'));var squel=require(_0xf48a('0xb'));var crypto=require(_0xf48a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf48a('0xd'));var toCsv=require(_0xf48a('0x8'));var querystring=require(_0xf48a('0xe'));var Papa=require(_0xf48a('0xf'));var Redis=require('ioredis');var authService=require(_0xf48a('0x10'));var qs=require(_0xf48a('0x11'));var as=require(_0xf48a('0x12'));var hardwareService=require(_0xf48a('0x13'));var logger=require(_0xf48a('0x14'))(_0xf48a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf48a('0x16'));var db=require(_0xf48a('0x17'))['db'];function respondWithStatusCode(_0x3f3e1b,_0x3ba802){_0x3ba802=_0x3ba802||0xcc;return function(_0x488625){if(_0x488625){return _0x3f3e1b[_0xf48a('0x18')](_0x3ba802);}return _0x3f3e1b[_0xf48a('0x19')](_0x3ba802)[_0xf48a('0x1a')]();};}function respondWithResult(_0x32bf0d,_0x2ea357){_0x2ea357=_0x2ea357||0xc8;return function(_0x1fadbb){if(_0x1fadbb){return _0x32bf0d['status'](_0x2ea357)[_0xf48a('0x1b')](_0x1fadbb);}};}function respondWithFilteredResult(_0x1eddb1,_0x54fad1){return function(_0x129c94){if(_0x129c94){var _0x20b4d1=typeof _0x54fad1['offset']===_0xf48a('0x1c')&&typeof _0x54fad1[_0xf48a('0x1d')]===_0xf48a('0x1c');var _0x519d35=_0x129c94['count'];var _0xb53d2b=_0x20b4d1?0x0:_0x54fad1[_0xf48a('0x1e')];var _0x1b3716=_0x20b4d1?_0x129c94[_0xf48a('0x1f')]:_0x54fad1[_0xf48a('0x1e')]+_0x54fad1[_0xf48a('0x1d')];var _0x55d1fd;if(_0x1b3716>=_0x519d35){_0x1b3716=_0x519d35;_0x55d1fd=0xc8;}else{_0x55d1fd=0xce;}_0x1eddb1['status'](_0x55d1fd);return _0x1eddb1[_0xf48a('0x20')](_0xf48a('0x21'),_0xb53d2b+'-'+_0x1b3716+'/'+_0x519d35)[_0xf48a('0x1b')](_0x129c94);}return null;};}function patchUpdates(_0x13d44c){return function(_0x25846b){try{jsonpatch[_0xf48a('0x22')](_0x25846b,_0x13d44c,!![]);}catch(_0x2c402c){return BPromise['reject'](_0x2c402c);}return _0x25846b[_0xf48a('0x23')]();};}function saveUpdates(_0x2c7e3b,_0x4cc119){return function(_0x1b38f7){if(_0x1b38f7){return _0x1b38f7[_0xf48a('0x24')](_0x2c7e3b)['then'](function(_0x43346e){return _0x43346e;});}return null;};}function removeEntity(_0x4a97cb,_0x206485){return function(_0xd3fb2b){if(_0xd3fb2b){return _0xd3fb2b[_0xf48a('0x25')]()['then'](function(){var _0x11edd8=_0xd3fb2b[_0xf48a('0x26')]({'plain':!![]});var _0x778208='ExtractedReports';return db[_0xf48a('0x27')]['destroy']({'where':{'type':_0x778208,'resourceId':_0x11edd8['id']}})[_0xf48a('0x28')](function(){return _0xd3fb2b;});})[_0xf48a('0x28')](function(){_0x4a97cb[_0xf48a('0x19')](0xcc)[_0xf48a('0x1a')]();});}};}function handleEntityNotFound(_0x461235,_0x54e4a1){return function(_0x451105){if(!_0x451105){_0x461235[_0xf48a('0x18')](0x194);}return _0x451105;};}function handleError(_0x574345,_0x133252){_0x133252=_0x133252||0x1f4;return function(_0x23bc0b){logger[_0xf48a('0x29')](_0x23bc0b[_0xf48a('0x2a')]);if(_0x23bc0b[_0xf48a('0x2b')]){delete _0x23bc0b[_0xf48a('0x2b')];}_0x574345['status'](_0x133252)['send'](_0x23bc0b);};}exports[_0xf48a('0x2c')]=function(_0x49e260,_0x26f53c){var _0x3eb3ca={},_0x5a9e0d={},_0x5826c0={'count':0x0,'rows':[]};var _0x27255a=_[_0xf48a('0x2d')](db[_0xf48a('0x2e')][_0xf48a('0x2f')],function(_0x4ebc24){return{'name':_0x4ebc24[_0xf48a('0x30')],'type':_0x4ebc24[_0xf48a('0x31')][_0xf48a('0x32')]};});_0x5a9e0d[_0xf48a('0x33')]=_[_0xf48a('0x2d')](_0x27255a,'name');_0x5a9e0d[_0xf48a('0x34')]=_[_0xf48a('0x35')](_0x49e260[_0xf48a('0x34')]);_0x5a9e0d[_0xf48a('0x36')]=_[_0xf48a('0x37')](_0x5a9e0d[_0xf48a('0x33')],_0x5a9e0d[_0xf48a('0x34')]);_0x3eb3ca['attributes']=_['intersection'](_0x5a9e0d[_0xf48a('0x33')],qs[_0xf48a('0x38')](_0x49e260[_0xf48a('0x34')][_0xf48a('0x38')]));_0x3eb3ca[_0xf48a('0x39')]=_0x3eb3ca[_0xf48a('0x39')][_0xf48a('0x3a')]?_0x3eb3ca[_0xf48a('0x39')]:_0x5a9e0d[_0xf48a('0x33')];if(!_0x49e260[_0xf48a('0x34')]['hasOwnProperty'](_0xf48a('0x3b'))){_0x3eb3ca[_0xf48a('0x1d')]=qs[_0xf48a('0x1d')](_0x49e260[_0xf48a('0x34')]['limit']);_0x3eb3ca[_0xf48a('0x1e')]=qs[_0xf48a('0x1e')](_0x49e260['query'][_0xf48a('0x1e')]);}_0x3eb3ca[_0xf48a('0x3c')]=qs[_0xf48a('0x3d')](_0x49e260[_0xf48a('0x34')]['sort']);_0x3eb3ca[_0xf48a('0x3e')]=qs[_0xf48a('0x36')](_[_0xf48a('0x3f')](_0x49e260[_0xf48a('0x34')],_0x5a9e0d[_0xf48a('0x36')]),_0x27255a);if(_0x49e260[_0xf48a('0x34')][_0xf48a('0x40')]){_0x3eb3ca[_0xf48a('0x3e')]=_[_0xf48a('0x41')](_0x3eb3ca[_0xf48a('0x3e')],{'$or':_['map'](_0x27255a,function(_0x20cd0f){if(_0x20cd0f['type']!==_0xf48a('0x42')){var _0x177786={};_0x177786[_0x20cd0f['name']]={'$like':'%'+_0x49e260['query'][_0xf48a('0x40')]+'%'};return _0x177786;}})});}_0x3eb3ca=_[_0xf48a('0x41')]({},_0x3eb3ca,_0x49e260[_0xf48a('0x43')]);var _0x1f5c16={'where':_0x3eb3ca[_0xf48a('0x3e')]};return db['AnalyticExtractedReport'][_0xf48a('0x1f')](_0x1f5c16)['then'](function(_0x3da1ef){_0x5826c0[_0xf48a('0x1f')]=_0x3da1ef;if(_0x49e260[_0xf48a('0x34')][_0xf48a('0x44')]){_0x3eb3ca[_0xf48a('0x45')]=[{'all':!![]}];}return db[_0xf48a('0x2e')][_0xf48a('0x46')](_0x3eb3ca);})['then'](function(_0x4262a6){_0x5826c0['rows']=_0x4262a6;return _0x5826c0;})['then'](respondWithFilteredResult(_0x26f53c,_0x3eb3ca))['catch'](handleError(_0x26f53c,null));};exports[_0xf48a('0x47')]=function(_0x353310,_0x1460ae){var _0x5503ec={'raw':!![],'where':{'id':_0x353310[_0xf48a('0x48')]['id']}},_0x2da097={};_0x2da097[_0xf48a('0x33')]=_[_0xf48a('0x35')](db[_0xf48a('0x2e')][_0xf48a('0x2f')]);_0x2da097[_0xf48a('0x34')]=_[_0xf48a('0x35')](_0x353310[_0xf48a('0x34')]);_0x2da097[_0xf48a('0x36')]=_[_0xf48a('0x37')](_0x2da097[_0xf48a('0x33')],_0x2da097[_0xf48a('0x34')]);_0x5503ec['attributes']=_[_0xf48a('0x37')](_0x2da097[_0xf48a('0x33')],qs[_0xf48a('0x38')](_0x353310[_0xf48a('0x34')][_0xf48a('0x38')]));_0x5503ec['attributes']=_0x5503ec[_0xf48a('0x39')][_0xf48a('0x3a')]?_0x5503ec[_0xf48a('0x39')]:_0x2da097[_0xf48a('0x33')];if(_0x353310['query'][_0xf48a('0x44')]){_0x5503ec[_0xf48a('0x45')]=[{'all':!![]}];}_0x5503ec=_[_0xf48a('0x41')]({},_0x5503ec,_0x353310[_0xf48a('0x43')]);return db[_0xf48a('0x2e')]['find'](_0x5503ec)[_0xf48a('0x28')](handleEntityNotFound(_0x1460ae,null))['then'](respondWithResult(_0x1460ae,null))[_0xf48a('0x49')](handleError(_0x1460ae,null));};exports[_0xf48a('0x4a')]=function(_0x5f0d9a,_0x39b3c3){return db[_0xf48a('0x2e')][_0xf48a('0x4a')](_0x5f0d9a[_0xf48a('0x4b')],{})[_0xf48a('0x28')](function(_0x3d2f44){var _0x23a7b4=_0x5f0d9a[_0xf48a('0x4c')]['get']({'plain':!![]});if(!_0x23a7b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23a7b4[_0xf48a('0x4d')]===_0xf48a('0x4c')){var _0x308666=_0x3d2f44[_0xf48a('0x26')]({'plain':!![]});var _0x3a617e=_0xf48a('0x4e');return db[_0xf48a('0x4f')][_0xf48a('0x50')]({'where':{'name':_0x3a617e,'userProfileId':_0x23a7b4[_0xf48a('0x51')]},'raw':!![]})[_0xf48a('0x28')](function(_0x3a2124){if(_0x3a2124&&_0x3a2124[_0xf48a('0x52')]===0x0){return db[_0xf48a('0x27')][_0xf48a('0x4a')]({'name':_0x308666['name'],'resourceId':_0x308666['id'],'type':_0x3a2124[_0xf48a('0x2b')],'sectionId':_0x3a2124['id']},{})[_0xf48a('0x28')](function(){return _0x3d2f44;});}else{return _0x3d2f44;}})['catch'](function(_0x480c17){logger[_0xf48a('0x29')](_0xf48a('0x53'),_0x480c17);throw _0x480c17;});}return _0x3d2f44;})['then'](respondWithResult(_0x39b3c3,0xc9))['catch'](handleError(_0x39b3c3,null));};exports['update']=function(_0x5d858a,_0x3c47e0){if(_0x5d858a['body']['id']){delete _0x5d858a[_0xf48a('0x4b')]['id'];}return db[_0xf48a('0x2e')][_0xf48a('0x50')]({'where':{'id':_0x5d858a['params']['id']}})[_0xf48a('0x28')](handleEntityNotFound(_0x3c47e0,null))[_0xf48a('0x28')](saveUpdates(_0x5d858a['body'],null))[_0xf48a('0x28')](respondWithResult(_0x3c47e0,null))[_0xf48a('0x49')](handleError(_0x3c47e0,null));};exports[_0xf48a('0x25')]=function(_0x35bbaa,_0xb37a08){return db[_0xf48a('0x2e')][_0xf48a('0x50')]({'where':{'id':_0x35bbaa[_0xf48a('0x48')]['id']}})[_0xf48a('0x28')](handleEntityNotFound(_0xb37a08,null))[_0xf48a('0x28')](removeEntity(_0xb37a08,null))[_0xf48a('0x49')](handleError(_0xb37a08,null));};exports['download']=function(_0x855549,_0x4e0f68,_0xf35d85){return db[_0xf48a('0x2e')][_0xf48a('0x50')]({'where':{'id':_0x855549[_0xf48a('0x48')]['id']},'attributes':[_0xf48a('0x2b'),'basename',_0xf48a('0x54'),_0xf48a('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x4e0f68,null))['then'](function(_0x39a764){if(_0x39a764){if(!fs[_0xf48a('0x56')](path[_0xf48a('0x57')](config[_0xf48a('0x58')],_0xf48a('0x59'),_0x39a764[_0xf48a('0x54')]))){throw new db[(_0xf48a('0x5a'))][(_0xf48a('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x855549[_0xf48a('0x34')][_0xf48a('0x5c')]){return _0x4e0f68[_0xf48a('0x18')](0xc8);}return _0x4e0f68[_0xf48a('0x5d')](path[_0xf48a('0x57')](config['root'],'server/files/reports',_0x39a764[_0xf48a('0x54')]),util[_0xf48a('0x5e')](_0xf48a('0x5f'),_0x39a764[_0xf48a('0x60')]||_0x39a764['name'],_0x39a764[_0xf48a('0x55')][_0xf48a('0x61')]()));}})[_0xf48a('0x49')](handleError(_0x4e0f68,null));};
\ No newline at end of file
diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js
index eb869bb..363dda8 100644
--- a/server/api/analyticExtractedReport/analyticExtractedReport.model.js
+++ b/server/api/analyticExtractedReport/analyticExtractedReport.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5aba=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x3ce633,_0x431721){var _0xb00c0a=function(_0x2f3180){while(--_0x2f3180){_0x3ce633['push'](_0x3ce633['shift']());}};_0xb00c0a(++_0x431721);}(_0x5aba,0x1d1));var _0xa5ab=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x5aba[_0x616290];return _0x453879;};'use strict';var _=require(_0xa5ab('0x0'));var util=require(_0xa5ab('0x1'));var logger=require(_0xa5ab('0x2'))('api');var moment=require(_0xa5ab('0x3'));var BPromise=require(_0xa5ab('0x4'));var rp=require(_0xa5ab('0x5'));var fs=require('fs');var path=require(_0xa5ab('0x6'));var rimraf=require(_0xa5ab('0x7'));var config=require(_0xa5ab('0x8'));var attributes=require(_0xa5ab('0x9'));module[_0xa5ab('0xa')]=function(_0x112859,_0xda789d){return _0x112859[_0xa5ab('0xb')](_0xa5ab('0xc'),attributes,{'tableName':_0xa5ab('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5c09=['define','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x1ec3fa,_0x3e9940){var _0x349bee=function(_0x539e67){while(--_0x539e67){_0x1ec3fa['push'](_0x1ec3fa['shift']());}};_0x349bee(++_0x3e9940);}(_0x5c09,0x6a));var _0x95c0=function(_0x453c56,_0x14b10d){_0x453c56=_0x453c56-0x0;var _0x3a114d=_0x5c09[_0x453c56];return _0x3a114d;};'use strict';var _=require(_0x95c0('0x0'));var util=require(_0x95c0('0x1'));var logger=require(_0x95c0('0x2'))('api');var moment=require(_0x95c0('0x3'));var BPromise=require(_0x95c0('0x4'));var rp=require(_0x95c0('0x5'));var fs=require('fs');var path=require(_0x95c0('0x6'));var rimraf=require(_0x95c0('0x7'));var config=require(_0x95c0('0x8'));var attributes=require(_0x95c0('0x9'));module[_0x95c0('0xa')]=function(_0x22df75,_0x133672){return _0x22df75[_0x95c0('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0x95c0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js
index dec33dc..34a173a 100644
--- a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js
+++ b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc35d=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x103e39,_0x7db66){var _0x3e95c3=function(_0x10b2af){while(--_0x10b2af){_0x103e39['push'](_0x103e39['shift']());}};_0x3e95c3(++_0x7db66);}(_0xc35d,0x12e));var _0xdc35=function(_0x26a53e,_0x1b83f5){_0x26a53e=_0x26a53e-0x0;var _0x328de0=_0xc35d[_0x26a53e];return _0x328de0;};'use strict';var _=require(_0xdc35('0x0'));var util=require(_0xdc35('0x1'));var moment=require(_0xdc35('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc35('0x4'))['db'];var utils=require(_0xdc35('0x5'));var logger=require('../../config/logger')(_0xdc35('0x6'));var config=require(_0xdc35('0x7'));var jayson=require(_0xdc35('0x8'));var client=jayson['client'][_0xdc35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23cdff,_0x1aeb54,_0x56583c){return new BPromise(function(_0xe4b441,_0x1bb16d){return client[_0xdc35('0xa')](_0x23cdff,_0x56583c)['then'](function(_0x1e9d54){logger[_0xdc35('0xb')](_0xdc35('0xc'),_0x1aeb54,_0xdc35('0xd'));logger['debug'](_0xdc35('0xe'),_0x1aeb54,_0xdc35('0xd'),JSON[_0xdc35('0xf')](_0x1e9d54));if(_0x1e9d54[_0xdc35('0x10')]){if(_0x1e9d54['error'][_0xdc35('0x11')]===0x1f4){logger['error'](_0xdc35('0xc'),_0x1aeb54,_0x1e9d54[_0xdc35('0x10')][_0xdc35('0x12')]);return _0x1bb16d(_0x1e9d54[_0xdc35('0x10')][_0xdc35('0x12')]);}logger[_0xdc35('0x10')](_0xdc35('0xc'),_0x1aeb54,_0x1e9d54['error'][_0xdc35('0x12')]);return _0xe4b441(_0x1e9d54[_0xdc35('0x10')][_0xdc35('0x12')]);}else{logger['info'](_0xdc35('0xc'),_0x1aeb54,_0xdc35('0xd'));_0xe4b441(_0x1e9d54['result'][_0xdc35('0x12')]);}})[_0xdc35('0x13')](function(_0x43b3b3){logger[_0xdc35('0x10')](_0xdc35('0xc'),_0x1aeb54,_0x43b3b3);_0x1bb16d(_0x43b3b3);});});}
\ No newline at end of file
+var _0x90db=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1a5f54,_0x42b4fa){var _0x13f830=function(_0x17c2fb){while(--_0x17c2fb){_0x1a5f54['push'](_0x1a5f54['shift']());}};_0x13f830(++_0x42b4fa);}(_0x90db,0x179));var _0xb90d=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x90db[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xb90d('0x0'));var util=require(_0xb90d('0x1'));var moment=require(_0xb90d('0x2'));var BPromise=require(_0xb90d('0x3'));var rs=require(_0xb90d('0x4'));var fs=require('fs');var Redis=require(_0xb90d('0x5'));var db=require(_0xb90d('0x6'))['db'];var utils=require(_0xb90d('0x7'));var logger=require(_0xb90d('0x8'))('rpc');var config=require(_0xb90d('0x9'));var jayson=require(_0xb90d('0xa'));var client=jayson[_0xb90d('0xb')][_0xb90d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46fd49,_0x1b3e51,_0x4d3d15){return new BPromise(function(_0x41a338,_0x38e12c){return client[_0xb90d('0xd')](_0x46fd49,_0x4d3d15)['then'](function(_0x242743){logger[_0xb90d('0xe')](_0xb90d('0xf'),_0x1b3e51,_0xb90d('0x10'));logger['debug'](_0xb90d('0x11'),_0x1b3e51,_0xb90d('0x10'),JSON[_0xb90d('0x12')](_0x242743));if(_0x242743['error']){if(_0x242743[_0xb90d('0x13')][_0xb90d('0x14')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b3e51,_0x242743[_0xb90d('0x13')][_0xb90d('0x15')]);return _0x38e12c(_0x242743[_0xb90d('0x13')][_0xb90d('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b3e51,_0x242743[_0xb90d('0x13')][_0xb90d('0x15')]);return _0x41a338(_0x242743['error'][_0xb90d('0x15')]);}else{logger[_0xb90d('0xe')](_0xb90d('0xf'),_0x1b3e51,_0xb90d('0x10'));_0x41a338(_0x242743[_0xb90d('0x16')][_0xb90d('0x15')]);}})[_0xb90d('0x17')](function(_0x5c664d){logger[_0xb90d('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b3e51,_0x5c664d);_0x38e12c(_0x5c664d);});});}
\ No newline at end of file
diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js
index b4244b7..208ba0e 100644
--- a/server/api/analyticExtractedReport/index.js
+++ b/server/api/analyticExtractedReport/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xbb8b=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id/download','download','post','create','put','/:id','delete'];(function(_0x33c74d,_0x122066){var _0x47d4f0=function(_0x5ea937){while(--_0x5ea937){_0x33c74d['push'](_0x33c74d['shift']());}};_0x47d4f0(++_0x122066);}(_0xbb8b,0x151));var _0xbbb8=function(_0x3b02b7,_0xd2a9f0){_0x3b02b7=_0x3b02b7-0x0;var _0x5cf8d8=_0xbb8b[_0x3b02b7];return _0x5cf8d8;};'use strict';var multer=require(_0xbbb8('0x0'));var util=require(_0xbbb8('0x1'));var path=require(_0xbbb8('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbb8('0x3'));var router=express[_0xbbb8('0x4')]();var fs_extra=require(_0xbbb8('0x5'));var auth=require(_0xbbb8('0x6'));var interaction=require(_0xbbb8('0x7'));var config=require(_0xbbb8('0x8'));var controller=require(_0xbbb8('0x9'));router[_0xbbb8('0xa')]('/',auth[_0xbbb8('0xb')](),controller[_0xbbb8('0xc')]);router[_0xbbb8('0xa')]('/:id',auth[_0xbbb8('0xb')](),controller['show']);router[_0xbbb8('0xa')](_0xbbb8('0xd'),auth[_0xbbb8('0xb')](),controller[_0xbbb8('0xe')]);router[_0xbbb8('0xf')]('/',auth[_0xbbb8('0xb')](),controller[_0xbbb8('0x10')]);router[_0xbbb8('0x11')](_0xbbb8('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xbbb8('0x13')](_0xbbb8('0x12'),auth[_0xbbb8('0xb')](),controller['destroy']);module[_0xbbb8('0x14')]=router;
\ No newline at end of file
+var _0x65ca=['../../components/auth/service','../../components/interaction/service','get','index','show','isAuthenticated','download','post','create','put','delete','/:id','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x41ffbb,_0x3ed4a9){var _0x2dc5fd=function(_0x35cf91){while(--_0x35cf91){_0x41ffbb['push'](_0x41ffbb['shift']());}};_0x2dc5fd(++_0x3ed4a9);}(_0x65ca,0xb9));var _0xa65c=function(_0x3ed26c,_0xab6b81){_0x3ed26c=_0x3ed26c-0x0;var _0x20074a=_0x65ca[_0x3ed26c];return _0x20074a;};'use strict';var multer=require(_0xa65c('0x0'));var util=require(_0xa65c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa65c('0x2'));var router=express[_0xa65c('0x3')]();var fs_extra=require(_0xa65c('0x4'));var auth=require(_0xa65c('0x5'));var interaction=require(_0xa65c('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xa65c('0x7')]('/',auth['isAuthenticated'](),controller[_0xa65c('0x8')]);router[_0xa65c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa65c('0x9')]);router[_0xa65c('0x7')]('/:id/download',auth[_0xa65c('0xa')](),controller[_0xa65c('0xb')]);router[_0xa65c('0xc')]('/',auth[_0xa65c('0xa')](),controller[_0xa65c('0xd')]);router[_0xa65c('0xe')]('/:id',auth[_0xa65c('0xa')](),controller['update']);router[_0xa65c('0xf')](_0xa65c('0x10'),auth[_0xa65c('0xa')](),controller[_0xa65c('0x11')]);module[_0xa65c('0x12')]=router;
\ No newline at end of file
diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js
index ee208e2..e86381b 100644
--- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js
+++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xa09f=['STRING','BOOLEAN','exports','TEXT'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xa09f,0xc6));var _0xfa09=function(_0x4c6860,_0x4e0bdd){_0x4c6860=_0x4c6860-0x0;var _0x33bd13=_0xa09f[_0x4c6860];return _0x33bd13;};'use strict';var Sequelize=require('sequelize');module[_0xfa09('0x0')]={'field':{'type':Sequelize[_0xfa09('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xfa09('0x2')]},'groupBy':{'type':Sequelize[_0xfa09('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xfa09('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
+var _0x3b74=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x2e2555,_0x3b1ad5){var _0x13dec4=function(_0x1f7f6c){while(--_0x1f7f6c){_0x2e2555['push'](_0x2e2555['shift']());}};_0x13dec4(++_0x3b1ad5);}(_0x3b74,0xd1));var _0x43b7=function(_0x1804e0,_0x3e69b7){_0x1804e0=_0x1804e0-0x0;var _0x29b36b=_0x3b74[_0x1804e0];return _0x29b36b;};'use strict';var Sequelize=require(_0x43b7('0x0'));module[_0x43b7('0x1')]={'field':{'type':Sequelize[_0x43b7('0x2')]},'alias':{'type':Sequelize[_0x43b7('0x3')]},'function':{'type':Sequelize[_0x43b7('0x3')]},'format':{'type':Sequelize[_0x43b7('0x3')]},'groupBy':{'type':Sequelize[_0x43b7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x43b7('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js
index 1376047..6e5fb7a 100644
--- a/server/api/analyticFieldReport/analyticFieldReport.controller.js
+++ b/server/api/analyticFieldReport/analyticFieldReport.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x727a=['count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','fieldName','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x727a,0x125));var _0xa727=function(_0x49f3ea,_0x399a85){_0x49f3ea=_0x49f3ea-0x0;var _0x3ca709=_0x727a[_0x49f3ea];return _0x3ca709;};'use strict';var emlformat=require(_0xa727('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa727('0x1'));var rp=require(_0xa727('0x2'));var moment=require(_0xa727('0x3'));var BPromise=require(_0xa727('0x4'));var Mustache=require('mustache');var util=require(_0xa727('0x5'));var path=require(_0xa727('0x6'));var sox=require(_0xa727('0x7'));var csv=require(_0xa727('0x8'));var ejs=require(_0xa727('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa727('0xa'));var crypto=require(_0xa727('0xb'));var jsforce=require(_0xa727('0xc'));var deskjs=require(_0xa727('0xd'));var toCsv=require(_0xa727('0x8'));var querystring=require(_0xa727('0xe'));var Papa=require('papaparse');var Redis=require(_0xa727('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa727('0x10'));var as=require(_0xa727('0x11'));var hardwareService=require(_0xa727('0x12'));var logger=require(_0xa727('0x13'))(_0xa727('0x14'));var utils=require(_0xa727('0x15'));var config=require(_0xa727('0x16'));var licenseUtil=require(_0xa727('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358c30,_0x545da9){_0x545da9=_0x545da9||0xcc;return function(_0x37dac2){if(_0x37dac2){return _0x358c30[_0xa727('0x18')](_0x545da9);}return _0x358c30[_0xa727('0x19')](_0x545da9)[_0xa727('0x1a')]();};}function respondWithResult(_0xcb74e6,_0x47033f){_0x47033f=_0x47033f||0xc8;return function(_0x16362f){if(_0x16362f){return _0xcb74e6['status'](_0x47033f)[_0xa727('0x1b')](_0x16362f);}};}function respondWithFilteredResult(_0x5cee96,_0x21dba0){return function(_0x5369f6){if(_0x5369f6){var _0x35b531=typeof _0x21dba0[_0xa727('0x1c')]==='undefined'&&typeof _0x21dba0[_0xa727('0x1d')]===_0xa727('0x1e');var _0x44bb42=_0x5369f6['count'];var _0x418886=_0x35b531?0x0:_0x21dba0[_0xa727('0x1c')];var _0x5ad5c8=_0x35b531?_0x5369f6[_0xa727('0x1f')]:_0x21dba0[_0xa727('0x1c')]+_0x21dba0['limit'];var _0x1d48c1;if(_0x5ad5c8>=_0x44bb42){_0x5ad5c8=_0x44bb42;_0x1d48c1=0xc8;}else{_0x1d48c1=0xce;}_0x5cee96[_0xa727('0x19')](_0x1d48c1);return _0x5cee96[_0xa727('0x20')](_0xa727('0x21'),_0x418886+'-'+_0x5ad5c8+'/'+_0x44bb42)[_0xa727('0x1b')](_0x5369f6);}return null;};}function patchUpdates(_0x477904){return function(_0x45d4f7){try{jsonpatch[_0xa727('0x22')](_0x45d4f7,_0x477904,!![]);}catch(_0x53c921){return BPromise[_0xa727('0x23')](_0x53c921);}return _0x45d4f7[_0xa727('0x24')]();};}function saveUpdates(_0x3ba2da,_0x222eb2){return function(_0x137a51){if(_0x137a51){return _0x137a51['update'](_0x3ba2da)[_0xa727('0x25')](function(_0x2a84f8){return _0x2a84f8;});}return null;};}function removeEntity(_0x449850,_0x2ef050){return function(_0x345bd2){if(_0x345bd2){return _0x345bd2[_0xa727('0x26')]()[_0xa727('0x25')](function(){_0x449850[_0xa727('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b917e,_0x4677e1){return function(_0xaabc38){if(!_0xaabc38){_0x5b917e['sendStatus'](0x194);}return _0xaabc38;};}function handleError(_0x140b05,_0x2c10e){_0x2c10e=_0x2c10e||0x1f4;return function(_0x4cedd6){logger['error'](_0x4cedd6[_0xa727('0x27')]);if(_0x4cedd6[_0xa727('0x28')]){delete _0x4cedd6[_0xa727('0x28')];}_0x140b05[_0xa727('0x19')](_0x2c10e)[_0xa727('0x29')](_0x4cedd6);};}exports[_0xa727('0x2a')]=function(_0x31b085,_0x43c008){var _0x31b43f={},_0x5efed3={},_0x2fdc93={'count':0x0,'rows':[]};var _0x43739a=_[_0xa727('0x2b')](db['AnalyticFieldReport']['rawAttributes'],function(_0x4e3253){return{'name':_0x4e3253[_0xa727('0x2c')],'type':_0x4e3253['type']['key']};});_0x5efed3[_0xa727('0x2d')]=_['map'](_0x43739a,'name');_0x5efed3[_0xa727('0x2e')]=_[_0xa727('0x2f')](_0x31b085['query']);_0x5efed3[_0xa727('0x30')]=_['intersection'](_0x5efed3[_0xa727('0x2d')],_0x5efed3[_0xa727('0x2e')]);_0x31b43f[_0xa727('0x31')]=_[_0xa727('0x32')](_0x5efed3['model'],qs['fields'](_0x31b085['query']['fields']));_0x31b43f[_0xa727('0x31')]=_0x31b43f['attributes'][_0xa727('0x33')]?_0x31b43f[_0xa727('0x31')]:_0x5efed3['model'];if(!_0x31b085[_0xa727('0x2e')]['hasOwnProperty'](_0xa727('0x34'))){_0x31b43f['limit']=qs['limit'](_0x31b085[_0xa727('0x2e')][_0xa727('0x1d')]);_0x31b43f[_0xa727('0x1c')]=qs[_0xa727('0x1c')](_0x31b085['query']['offset']);}_0x31b43f[_0xa727('0x35')]=qs[_0xa727('0x36')](_0x31b085[_0xa727('0x2e')][_0xa727('0x36')]);_0x31b43f['where']=qs['filters'](_[_0xa727('0x37')](_0x31b085[_0xa727('0x2e')],_0x5efed3[_0xa727('0x30')]),_0x43739a);if(_0x31b085['query'][_0xa727('0x38')]){_0x31b43f[_0xa727('0x39')]=_['merge'](_0x31b43f[_0xa727('0x39')],{'$or':_[_0xa727('0x2b')](_0x43739a,function(_0x5e270c){if(_0x5e270c[_0xa727('0x3a')]!==_0xa727('0x3b')){var _0x472e49={};_0x472e49[_0x5e270c['name']]={'$like':'%'+_0x31b085[_0xa727('0x2e')][_0xa727('0x38')]+'%'};return _0x472e49;}})});}_0x31b43f=_[_0xa727('0x3c')]({},_0x31b43f,_0x31b085[_0xa727('0x3d')]);var _0x34e20e={'where':_0x31b43f[_0xa727('0x39')]};return db[_0xa727('0x3e')][_0xa727('0x1f')](_0x34e20e)[_0xa727('0x25')](function(_0xcc0161){_0x2fdc93[_0xa727('0x1f')]=_0xcc0161;if(_0x31b085[_0xa727('0x2e')][_0xa727('0x3f')]){_0x31b43f[_0xa727('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xa727('0x41')](_0x31b43f);})['then'](function(_0x4daa8d){_0x2fdc93[_0xa727('0x42')]=_0x4daa8d;return _0x2fdc93;})['then'](respondWithFilteredResult(_0x43c008,_0x31b43f))[_0xa727('0x43')](handleError(_0x43c008,null));};exports[_0xa727('0x44')]=function(_0x5e72d9,_0x32e065){var _0x39539f={'raw':![],'where':{'id':_0x5e72d9[_0xa727('0x45')]['id']}},_0x142af={};_0x142af[_0xa727('0x2d')]=_[_0xa727('0x2f')](db[_0xa727('0x3e')]['rawAttributes']);_0x142af[_0xa727('0x2e')]=_[_0xa727('0x2f')](_0x5e72d9['query']);_0x142af['filters']=_['intersection'](_0x142af[_0xa727('0x2d')],_0x142af[_0xa727('0x2e')]);_0x39539f[_0xa727('0x31')]=_[_0xa727('0x32')](_0x142af['model'],qs['fields'](_0x5e72d9[_0xa727('0x2e')][_0xa727('0x46')]));_0x39539f['attributes']=_0x39539f['attributes'][_0xa727('0x33')]?_0x39539f[_0xa727('0x31')]:_0x142af[_0xa727('0x2d')];if(_0x5e72d9[_0xa727('0x2e')][_0xa727('0x3f')]){_0x39539f[_0xa727('0x40')]=[{'all':!![]}];}_0x39539f=_[_0xa727('0x3c')]({},_0x39539f,_0x5e72d9['options']);return db['AnalyticFieldReport'][_0xa727('0x47')](_0x39539f)[_0xa727('0x25')](handleEntityNotFound(_0x32e065,null))[_0xa727('0x25')](respondWithResult(_0x32e065,null))[_0xa727('0x43')](handleError(_0x32e065,null));};exports['create']=function(_0x4f2905,_0x5bb4c1){return db['AnalyticFieldReport'][_0xa727('0x48')](_0x4f2905[_0xa727('0x49')],{})[_0xa727('0x25')](respondWithResult(_0x5bb4c1,0xc9))[_0xa727('0x43')](handleError(_0x5bb4c1,null));};exports['bulkCreate']=function(_0x5b122b,_0x13902a){return db[_0xa727('0x3e')][_0xa727('0x4a')](_0x5b122b['body'],{'raw':![],'individualHooks':!![]})[_0xa727('0x25')](respondWithResult(_0x13902a,0xc9))['catch'](handleError(_0x13902a,null));};exports['update']=function(_0x2de6ba,_0x4b3156){if(_0x2de6ba[_0xa727('0x49')]['id']){delete _0x2de6ba[_0xa727('0x49')]['id'];}return db[_0xa727('0x3e')][_0xa727('0x47')]({'where':{'id':_0x2de6ba[_0xa727('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b3156,null))['then'](saveUpdates(_0x2de6ba[_0xa727('0x49')],null))[_0xa727('0x25')](respondWithResult(_0x4b3156,null))[_0xa727('0x43')](handleError(_0x4b3156,null));};exports[_0xa727('0x26')]=function(_0x20b2f3,_0x850b){return db['AnalyticFieldReport'][_0xa727('0x47')]({'where':{'id':_0x20b2f3[_0xa727('0x45')]['id']}})[_0xa727('0x25')](handleEntityNotFound(_0x850b,null))['then'](removeEntity(_0x850b,null))[_0xa727('0x43')](handleError(_0x850b,null));};exports[_0xa727('0x4b')]=function(_0x5f0579,_0xa4e249){return db['AnalyticFieldReport'][_0xa727('0x26')]({'where':{'id':_0x5f0579[_0xa727('0x2e')][_0xa727('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xa727('0x25')](respondWithResult(_0xa4e249,0xcc))[_0xa727('0x43')](handleError(_0xa4e249,null));};exports[_0xa727('0x4d')]=function(_0x2ee65d,_0x890653,_0x3ad6b6){return db[_0xa727('0x4e')]['findOne']({'where':{'id':_0x2ee65d[_0xa727('0x45')]['id']}})[_0xa727('0x25')](handleEntityNotFound(_0x890653,null))[_0xa727('0x25')](function(_0x56a5ce){if(_0x56a5ce){return db[_0xa727('0x4f')][_0xa727('0x50')](function(_0x552af5){return db[_0xa727('0x3e')][_0xa727('0x26')]({'where':{'CustomReportId':_0x2ee65d[_0xa727('0x45')]['id']},'transaction':_0x552af5})['then'](function(_0xddde91){var _0x4cf23a=_[_0xa727('0x2b')](_0x2ee65d[_0xa727('0x49')],function(_0x516b0d){delete _0x516b0d['id'];_0x516b0d['CustomReportId']=_0x2ee65d[_0xa727('0x45')]['id'];return _0x516b0d;});return db[_0xa727('0x3e')][_0xa727('0x4a')](_0x4cf23a,{'transaction':_0x552af5});});})['then'](function(){return db[_0xa727('0x3e')]['findAll']({'where':{'CustomReportId':_0x2ee65d['params']['id']}});});}})[_0xa727('0x25')](respondWithResult(_0x890653,null))[_0xa727('0x43')](handleError(_0x890653,null));};
\ No newline at end of file
+var _0xc485=['nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','create','body','bulkCreate','find','params','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','status','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0xc485,0x105));var _0x5c48=function(_0xdb628e,_0x103e9a){_0xdb628e=_0xdb628e-0x0;var _0x493aa5=_0xc485[_0xdb628e];return _0x493aa5;};'use strict';var emlformat=require(_0x5c48('0x0'));var rimraf=require(_0x5c48('0x1'));var zipdir=require(_0x5c48('0x2'));var jsonpatch=require(_0x5c48('0x3'));var rp=require(_0x5c48('0x4'));var moment=require(_0x5c48('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c48('0x6'));var util=require(_0x5c48('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c48('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5c48('0x9'));var jsforce=require(_0x5c48('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5c48('0xb'));var querystring=require(_0x5c48('0xc'));var Papa=require(_0x5c48('0xd'));var Redis=require('ioredis');var authService=require(_0x5c48('0xe'));var qs=require(_0x5c48('0xf'));var as=require(_0x5c48('0x10'));var hardwareService=require(_0x5c48('0x11'));var logger=require(_0x5c48('0x12'))(_0x5c48('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c48('0x14'));var db=require(_0x5c48('0x15'))['db'];function respondWithStatusCode(_0x427684,_0x37f8d9){_0x37f8d9=_0x37f8d9||0xcc;return function(_0x3df1d1){if(_0x3df1d1){return _0x427684[_0x5c48('0x16')](_0x37f8d9);}return _0x427684['status'](_0x37f8d9)['end']();};}function respondWithResult(_0x36cb51,_0x1c116e){_0x1c116e=_0x1c116e||0xc8;return function(_0x1e93bc){if(_0x1e93bc){return _0x36cb51['status'](_0x1c116e)[_0x5c48('0x17')](_0x1e93bc);}};}function respondWithFilteredResult(_0x3dda19,_0x36371b){return function(_0x19dc50){if(_0x19dc50){var _0x17a784=typeof _0x36371b[_0x5c48('0x18')]==='undefined'&&typeof _0x36371b[_0x5c48('0x19')]===_0x5c48('0x1a');var _0x12c781=_0x19dc50[_0x5c48('0x1b')];var _0x1b1877=_0x17a784?0x0:_0x36371b[_0x5c48('0x18')];var _0x4f57dc=_0x17a784?_0x19dc50['count']:_0x36371b[_0x5c48('0x18')]+_0x36371b['limit'];var _0x1f1c9a;if(_0x4f57dc>=_0x12c781){_0x4f57dc=_0x12c781;_0x1f1c9a=0xc8;}else{_0x1f1c9a=0xce;}_0x3dda19['status'](_0x1f1c9a);return _0x3dda19['set'](_0x5c48('0x1c'),_0x1b1877+'-'+_0x4f57dc+'/'+_0x12c781)['json'](_0x19dc50);}return null;};}function patchUpdates(_0x3a7975){return function(_0x2adb1d){try{jsonpatch[_0x5c48('0x1d')](_0x2adb1d,_0x3a7975,!![]);}catch(_0xc28b4c){return BPromise[_0x5c48('0x1e')](_0xc28b4c);}return _0x2adb1d[_0x5c48('0x1f')]();};}function saveUpdates(_0x5eb373,_0x175fa7){return function(_0x28c09b){if(_0x28c09b){return _0x28c09b[_0x5c48('0x20')](_0x5eb373)[_0x5c48('0x21')](function(_0x36bc86){return _0x36bc86;});}return null;};}function removeEntity(_0x63c5b1,_0x37c5eb){return function(_0x237380){if(_0x237380){return _0x237380[_0x5c48('0x22')]()[_0x5c48('0x21')](function(){_0x63c5b1[_0x5c48('0x23')](0xcc)[_0x5c48('0x24')]();});}};}function handleEntityNotFound(_0x1c2474,_0x18e2fe){return function(_0x468e49){if(!_0x468e49){_0x1c2474[_0x5c48('0x16')](0x194);}return _0x468e49;};}function handleError(_0x47b309,_0x72662c){_0x72662c=_0x72662c||0x1f4;return function(_0x1ad680){logger[_0x5c48('0x25')](_0x1ad680[_0x5c48('0x26')]);if(_0x1ad680[_0x5c48('0x27')]){delete _0x1ad680[_0x5c48('0x27')];}_0x47b309[_0x5c48('0x23')](_0x72662c)[_0x5c48('0x28')](_0x1ad680);};}exports[_0x5c48('0x29')]=function(_0x2391d8,_0x16f33b){var _0x7c1e9c={},_0x4d1623={},_0x5a5bf7={'count':0x0,'rows':[]};var _0x2c3131=_[_0x5c48('0x2a')](db[_0x5c48('0x2b')][_0x5c48('0x2c')],function(_0x4ec341){return{'name':_0x4ec341[_0x5c48('0x2d')],'type':_0x4ec341[_0x5c48('0x2e')][_0x5c48('0x2f')]};});_0x4d1623['model']=_[_0x5c48('0x2a')](_0x2c3131,_0x5c48('0x27'));_0x4d1623[_0x5c48('0x30')]=_[_0x5c48('0x31')](_0x2391d8[_0x5c48('0x30')]);_0x4d1623[_0x5c48('0x32')]=_[_0x5c48('0x33')](_0x4d1623[_0x5c48('0x34')],_0x4d1623[_0x5c48('0x30')]);_0x7c1e9c[_0x5c48('0x35')]=_[_0x5c48('0x33')](_0x4d1623[_0x5c48('0x34')],qs[_0x5c48('0x36')](_0x2391d8['query']['fields']));_0x7c1e9c[_0x5c48('0x35')]=_0x7c1e9c[_0x5c48('0x35')]['length']?_0x7c1e9c[_0x5c48('0x35')]:_0x4d1623[_0x5c48('0x34')];if(!_0x2391d8[_0x5c48('0x30')]['hasOwnProperty'](_0x5c48('0x37'))){_0x7c1e9c[_0x5c48('0x19')]=qs['limit'](_0x2391d8[_0x5c48('0x30')][_0x5c48('0x19')]);_0x7c1e9c['offset']=qs['offset'](_0x2391d8[_0x5c48('0x30')][_0x5c48('0x18')]);}_0x7c1e9c['order']=qs[_0x5c48('0x38')](_0x2391d8[_0x5c48('0x30')]['sort']);_0x7c1e9c['where']=qs[_0x5c48('0x32')](_[_0x5c48('0x39')](_0x2391d8[_0x5c48('0x30')],_0x4d1623['filters']),_0x2c3131);if(_0x2391d8[_0x5c48('0x30')][_0x5c48('0x3a')]){_0x7c1e9c[_0x5c48('0x3b')]=_['merge'](_0x7c1e9c['where'],{'$or':_[_0x5c48('0x2a')](_0x2c3131,function(_0x22faaa){if(_0x22faaa[_0x5c48('0x2e')]!=='VIRTUAL'){var _0x43bdac={};_0x43bdac[_0x22faaa['name']]={'$like':'%'+_0x2391d8[_0x5c48('0x30')][_0x5c48('0x3a')]+'%'};return _0x43bdac;}})});}_0x7c1e9c=_[_0x5c48('0x3c')]({},_0x7c1e9c,_0x2391d8[_0x5c48('0x3d')]);var _0xe36d2b={'where':_0x7c1e9c[_0x5c48('0x3b')]};return db[_0x5c48('0x2b')][_0x5c48('0x1b')](_0xe36d2b)[_0x5c48('0x21')](function(_0x18b3b1){_0x5a5bf7['count']=_0x18b3b1;if(_0x2391d8[_0x5c48('0x30')][_0x5c48('0x3e')]){_0x7c1e9c[_0x5c48('0x3f')]=[{'all':!![]}];}return db[_0x5c48('0x2b')][_0x5c48('0x40')](_0x7c1e9c);})[_0x5c48('0x21')](function(_0x35cf29){_0x5a5bf7[_0x5c48('0x41')]=_0x35cf29;return _0x5a5bf7;})[_0x5c48('0x21')](respondWithFilteredResult(_0x16f33b,_0x7c1e9c))[_0x5c48('0x42')](handleError(_0x16f33b,null));};exports['show']=function(_0x14036a,_0x5b8a6d){var _0x129860={'raw':![],'where':{'id':_0x14036a['params']['id']}},_0x20bc00={};_0x20bc00[_0x5c48('0x34')]=_[_0x5c48('0x31')](db['AnalyticFieldReport'][_0x5c48('0x2c')]);_0x20bc00[_0x5c48('0x30')]=_[_0x5c48('0x31')](_0x14036a[_0x5c48('0x30')]);_0x20bc00[_0x5c48('0x32')]=_[_0x5c48('0x33')](_0x20bc00[_0x5c48('0x34')],_0x20bc00[_0x5c48('0x30')]);_0x129860[_0x5c48('0x35')]=_[_0x5c48('0x33')](_0x20bc00[_0x5c48('0x34')],qs['fields'](_0x14036a[_0x5c48('0x30')][_0x5c48('0x36')]));_0x129860[_0x5c48('0x35')]=_0x129860[_0x5c48('0x35')]['length']?_0x129860[_0x5c48('0x35')]:_0x20bc00['model'];if(_0x14036a['query']['includeAll']){_0x129860[_0x5c48('0x3f')]=[{'all':!![]}];}_0x129860=_[_0x5c48('0x3c')]({},_0x129860,_0x14036a[_0x5c48('0x3d')]);return db[_0x5c48('0x2b')]['find'](_0x129860)[_0x5c48('0x21')](handleEntityNotFound(_0x5b8a6d,null))[_0x5c48('0x21')](respondWithResult(_0x5b8a6d,null))[_0x5c48('0x42')](handleError(_0x5b8a6d,null));};exports[_0x5c48('0x43')]=function(_0x4e0380,_0x5f1de4){return db[_0x5c48('0x2b')][_0x5c48('0x43')](_0x4e0380[_0x5c48('0x44')],{})[_0x5c48('0x21')](respondWithResult(_0x5f1de4,0xc9))[_0x5c48('0x42')](handleError(_0x5f1de4,null));};exports[_0x5c48('0x45')]=function(_0x16de15,_0x17f77c){return db['AnalyticFieldReport']['bulkCreate'](_0x16de15['body'],{'raw':![],'individualHooks':!![]})[_0x5c48('0x21')](respondWithResult(_0x17f77c,0xc9))[_0x5c48('0x42')](handleError(_0x17f77c,null));};exports[_0x5c48('0x20')]=function(_0x58c0f1,_0x396409){if(_0x58c0f1[_0x5c48('0x44')]['id']){delete _0x58c0f1[_0x5c48('0x44')]['id'];}return db[_0x5c48('0x2b')]['find']({'where':{'id':_0x58c0f1['params']['id']}})['then'](handleEntityNotFound(_0x396409,null))[_0x5c48('0x21')](saveUpdates(_0x58c0f1['body'],null))[_0x5c48('0x21')](respondWithResult(_0x396409,null))['catch'](handleError(_0x396409,null));};exports['destroy']=function(_0x44c605,_0x13895d){return db[_0x5c48('0x2b')][_0x5c48('0x46')]({'where':{'id':_0x44c605[_0x5c48('0x47')]['id']}})[_0x5c48('0x21')](handleEntityNotFound(_0x13895d,null))['then'](removeEntity(_0x13895d,null))['catch'](handleError(_0x13895d,null));};exports[_0x5c48('0x48')]=function(_0x422f26,_0x4a9b31){return db['AnalyticFieldReport'][_0x5c48('0x22')]({'where':{'id':_0x422f26[_0x5c48('0x30')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4a9b31,0xcc))[_0x5c48('0x42')](handleError(_0x4a9b31,null));};exports[_0x5c48('0x49')]=function(_0xc74a0a,_0x76aeae,_0x4e5fcf){return db[_0x5c48('0x4a')][_0x5c48('0x4b')]({'where':{'id':_0xc74a0a[_0x5c48('0x47')]['id']}})['then'](handleEntityNotFound(_0x76aeae,null))[_0x5c48('0x21')](function(_0x1d3c75){if(_0x1d3c75){return db[_0x5c48('0x4c')][_0x5c48('0x4d')](function(_0x2f9338){return db['AnalyticFieldReport'][_0x5c48('0x22')]({'where':{'CustomReportId':_0xc74a0a[_0x5c48('0x47')]['id']},'transaction':_0x2f9338})[_0x5c48('0x21')](function(_0xa102c4){var _0x3509f4=_[_0x5c48('0x2a')](_0xc74a0a[_0x5c48('0x44')],function(_0x254d43){delete _0x254d43['id'];_0x254d43[_0x5c48('0x4e')]=_0xc74a0a[_0x5c48('0x47')]['id'];return _0x254d43;});return db['AnalyticFieldReport'][_0x5c48('0x45')](_0x3509f4,{'transaction':_0x2f9338});});})['then'](function(){return db[_0x5c48('0x2b')][_0x5c48('0x40')]({'where':{'CustomReportId':_0xc74a0a[_0x5c48('0x47')]['id']}});});}})[_0x5c48('0x21')](respondWithResult(_0x76aeae,null))['catch'](handleError(_0x76aeae,null));};
\ No newline at end of file
diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js
index d652ed9..0363054 100644
--- a/server/api/analyticFieldReport/analyticFieldReport.model.js
+++ b/server/api/analyticFieldReport/analyticFieldReport.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xcf3e=['util','../../config/logger','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x182709,_0x394059){var _0x30fd33=function(_0x155351){while(--_0x155351){_0x182709['push'](_0x182709['shift']());}};_0x30fd33(++_0x394059);}(_0xcf3e,0x1af));var _0xecf3=function(_0x5c7cf3,_0x4800f8){_0x5c7cf3=_0x5c7cf3-0x0;var _0x4a67c=_0xcf3e[_0x5c7cf3];return _0x4a67c;};'use strict';var _=require(_0xecf3('0x0'));var util=require(_0xecf3('0x1'));var logger=require(_0xecf3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xecf3('0x3'));var rp=require(_0xecf3('0x4'));var fs=require('fs');var path=require(_0xecf3('0x5'));var rimraf=require(_0xecf3('0x6'));var config=require('../../config/environment');var attributes=require(_0xecf3('0x7'));module[_0xecf3('0x8')]=function(_0x443584,_0x1bb103){return _0x443584[_0xecf3('0x9')](_0xecf3('0xa'),attributes,{'tableName':_0xecf3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc80e=['analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport'];(function(_0x204b09,_0x309f2a){var _0x38508d=function(_0x18d6f5){while(--_0x18d6f5){_0x204b09['push'](_0x204b09['shift']());}};_0x38508d(++_0x309f2a);}(_0xc80e,0x15d));var _0xec80=function(_0xb2320d,_0xe69d49){_0xb2320d=_0xb2320d-0x0;var _0x9db91a=_0xc80e[_0xb2320d];return _0x9db91a;};'use strict';var _=require(_0xec80('0x0'));var util=require(_0xec80('0x1'));var logger=require(_0xec80('0x2'))(_0xec80('0x3'));var moment=require('moment');var BPromise=require(_0xec80('0x4'));var rp=require(_0xec80('0x5'));var fs=require('fs');var path=require(_0xec80('0x6'));var rimraf=require('rimraf');var config=require(_0xec80('0x7'));var attributes=require(_0xec80('0x8'));module[_0xec80('0x9')]=function(_0x315a4f,_0x240161){return _0x315a4f['define'](_0xec80('0xa'),attributes,{'tableName':_0xec80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js
index 3c69fc9..fff1b72 100644
--- a/server/api/analyticFieldReport/analyticFieldReport.rpc.js
+++ b/server/api/analyticFieldReport/analyticFieldReport.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x3a2d=['../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xc21ae,_0x173f65){var _0x358c22=function(_0x2445d3){while(--_0x2445d3){_0xc21ae['push'](_0xc21ae['shift']());}};_0x358c22(++_0x173f65);}(_0x3a2d,0xeb));var _0xd3a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a2d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd3a2('0x0'));var util=require(_0xd3a2('0x1'));var moment=require(_0xd3a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3a2('0x3'));var db=require(_0xd3a2('0x4'))['db'];var utils=require(_0xd3a2('0x5'));var logger=require('../../config/logger')(_0xd3a2('0x6'));var config=require(_0xd3a2('0x7'));var jayson=require(_0xd3a2('0x8'));var client=jayson['client'][_0xd3a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18102c,_0x2173aa,_0x4c8ff7){return new BPromise(function(_0x1da390,_0x56da4e){return client[_0xd3a2('0xa')](_0x18102c,_0x4c8ff7)[_0xd3a2('0xb')](function(_0x341f9c){logger[_0xd3a2('0xc')](_0xd3a2('0xd'),_0x2173aa,_0xd3a2('0xe'));logger[_0xd3a2('0xf')](_0xd3a2('0x10'),_0x2173aa,'request\x20sent',JSON[_0xd3a2('0x11')](_0x341f9c));if(_0x341f9c['error']){if(_0x341f9c[_0xd3a2('0x12')][_0xd3a2('0x13')]===0x1f4){logger[_0xd3a2('0x12')](_0xd3a2('0xd'),_0x2173aa,_0x341f9c['error'][_0xd3a2('0x14')]);return _0x56da4e(_0x341f9c[_0xd3a2('0x12')][_0xd3a2('0x14')]);}logger[_0xd3a2('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2173aa,_0x341f9c['error']['message']);return _0x1da390(_0x341f9c[_0xd3a2('0x12')][_0xd3a2('0x14')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2173aa,_0xd3a2('0xe'));_0x1da390(_0x341f9c[_0xd3a2('0x15')]['message']);}})['catch'](function(_0x2cfca9){logger[_0xd3a2('0x12')](_0xd3a2('0xd'),_0x2173aa,_0x2cfca9);_0x56da4e(_0x2cfca9);});});}
\ No newline at end of file
+var _0x7a20=['request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xfa4dad,_0x1ae1c9){var _0x454a6d=function(_0x46629d){while(--_0x46629d){_0xfa4dad['push'](_0xfa4dad['shift']());}};_0x454a6d(++_0x1ae1c9);}(_0x7a20,0x64));var _0x07a2=function(_0x39a51b,_0x29a07e){_0x39a51b=_0x39a51b-0x0;var _0x2e882f=_0x7a20[_0x39a51b];return _0x2e882f;};'use strict';var _=require(_0x07a2('0x0'));var util=require(_0x07a2('0x1'));var moment=require(_0x07a2('0x2'));var BPromise=require(_0x07a2('0x3'));var rs=require(_0x07a2('0x4'));var fs=require('fs');var Redis=require(_0x07a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x07a2('0x6'));var logger=require(_0x07a2('0x7'))(_0x07a2('0x8'));var config=require(_0x07a2('0x9'));var jayson=require(_0x07a2('0xa'));var client=jayson[_0x07a2('0xb')][_0x07a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa24d82,_0x33fb70,_0x504732){return new BPromise(function(_0xc7d28a,_0x27b64f){return client[_0x07a2('0xd')](_0xa24d82,_0x504732)[_0x07a2('0xe')](function(_0x525a9c){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x33fb70,_0x07a2('0xf'));logger['debug'](_0x07a2('0x10'),_0x33fb70,_0x07a2('0xf'),JSON[_0x07a2('0x11')](_0x525a9c));if(_0x525a9c[_0x07a2('0x12')]){if(_0x525a9c[_0x07a2('0x12')]['code']===0x1f4){logger[_0x07a2('0x12')](_0x07a2('0x13'),_0x33fb70,_0x525a9c['error'][_0x07a2('0x14')]);return _0x27b64f(_0x525a9c['error'][_0x07a2('0x14')]);}logger[_0x07a2('0x12')](_0x07a2('0x13'),_0x33fb70,_0x525a9c[_0x07a2('0x12')][_0x07a2('0x14')]);return _0xc7d28a(_0x525a9c['error']['message']);}else{logger[_0x07a2('0x15')](_0x07a2('0x13'),_0x33fb70,_0x07a2('0xf'));_0xc7d28a(_0x525a9c[_0x07a2('0x16')]['message']);}})['catch'](function(_0x4fa504){logger[_0x07a2('0x12')](_0x07a2('0x13'),_0x33fb70,_0x4fa504);_0x27b64f(_0x4fa504);});});}
\ No newline at end of file
diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js
index 246f796..31fd7a8 100644
--- a/server/api/analyticFieldReport/index.js
+++ b/server/api/analyticFieldReport/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x7b9f1c,_0x36fcc1){var _0xd5f045=function(_0x140d04){while(--_0x140d04){_0x7b9f1c['push'](_0x7b9f1c['shift']());}};_0xd5f045(++_0x36fcc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router;
\ No newline at end of file
+var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x2381d5,_0x430612){var _0x4d4e0e=function(_0x553673){while(--_0x553673){_0x2381d5['push'](_0x2381d5['shift']());}};_0x4d4e0e(++_0x430612);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router;
\ No newline at end of file
diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js
index 1d42f7e..b54864d 100644
--- a/server/api/analyticMetric/analyticMetric.attributes.js
+++ b/server/api/analyticMetric/analyticMetric.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc36d=['sequelize','exports','STRING','name','TEXT'];(function(_0x2ec3a7,_0x1d5993){var _0x507f82=function(_0x5ce431){while(--_0x5ce431){_0x2ec3a7['push'](_0x2ec3a7['shift']());}};_0x507f82(++_0x1d5993);}(_0xc36d,0x7d));var _0xdc36=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xc36d[_0x6f1a87];return _0x2495c7;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'name':{'type':Sequelize[_0xdc36('0x2')],'allowNull':![],'unique':_0xdc36('0x3')},'table':{'type':Sequelize[_0xdc36('0x2')]},'metric':{'type':Sequelize[_0xdc36('0x4')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xa75b=['sequelize','name','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa75b,0x170));var _0xba75=function(_0x203a21,_0x274fa9){_0x203a21=_0x203a21-0x0;var _0x3ce90a=_0xa75b[_0x203a21];return _0x3ce90a;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xba75('0x1')},'table':{'type':Sequelize[_0xba75('0x2')]},'metric':{'type':Sequelize[_0xba75('0x3')]},'description':{'type':Sequelize[_0xba75('0x2')]}};
\ No newline at end of file
diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js
index c1bf2c8..7d38114 100644
--- a/server/api/analyticMetric/analyticMetric.controller.js
+++ b/server/api/analyticMetric/analyticMetric.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count'];(function(_0x242cae,_0x2c7699){var _0x2a45a8=function(_0x23db19){while(--_0x23db19){_0x242cae['push'](_0x242cae['shift']());}};_0x2a45a8(++_0x2c7699);}(_0x3e74,0x175));var _0x43e7=function(_0x295e66,_0x2be5ec){_0x295e66=_0x295e66-0x0;var _0x267a7d=_0x3e74[_0x295e66];return _0x267a7d;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));};
\ No newline at end of file
+var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x16669a,_0x168e42){var _0x3db0b7=function(_0x4a5893){while(--_0x4a5893){_0x16669a['push'](_0x16669a['shift']());}};_0x3db0b7(++_0x168e42);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x26b1b8,_0x35bfd4){_0x26b1b8=_0x26b1b8-0x0;var _0x401762=_0x7fbe[_0x26b1b8];return _0x401762;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));};
\ No newline at end of file
diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js
index 71bc066..37d4756 100644
--- a/server/api/analyticMetric/analyticMetric.model.js
+++ b/server/api/analyticMetric/analyticMetric.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xec46=['rimraf','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4f6a33,_0x4f43f5){var _0x16a50a=function(_0x14c812){while(--_0x14c812){_0x4f6a33['push'](_0x4f6a33['shift']());}};_0x16a50a(++_0x4f43f5);}(_0xec46,0x19c));var _0x6ec4=function(_0x15e56a,_0x5483d9){_0x15e56a=_0x15e56a-0x0;var _0x472c0d=_0xec46[_0x15e56a];return _0x472c0d;};'use strict';var _=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var logger=require(_0x6ec4('0x2'))(_0x6ec4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6ec4('0x4'));var fs=require('fs');var path=require(_0x6ec4('0x5'));var rimraf=require(_0x6ec4('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ec4('0x7'));module[_0x6ec4('0x8')]=function(_0x55b203,_0x533fda){return _0x55b203['define'](_0x6ec4('0x9'),attributes,{'tableName':_0x6ec4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x302c=['moment','path','rimraf','../../config/environment','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0x302c,0x15c));var _0xc302=function(_0x1fb2c6,_0x4a5110){_0x1fb2c6=_0x1fb2c6-0x0;var _0x187e7f=_0x302c[_0x1fb2c6];return _0x187e7f;};'use strict';var _=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var logger=require(_0xc302('0x2'))(_0xc302('0x3'));var moment=require(_0xc302('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc302('0x5'));var rimraf=require(_0xc302('0x6'));var config=require(_0xc302('0x7'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x13139e,_0x59ba1e){return _0x13139e[_0xc302('0x8')](_0xc302('0x9'),attributes,{'tableName':_0xc302('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js
index 0645302..0c55aaa 100644
--- a/server/api/analyticMetric/analyticMetric.rpc.js
+++ b/server/api/analyticMetric/analyticMetric.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x7224=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x30804d,_0x38b1a4){var _0x3bdf9f=function(_0x3f86cf){while(--_0x3f86cf){_0x30804d['push'](_0x30804d['shift']());}};_0x3bdf9f(++_0x38b1a4);}(_0x7224,0x167));var _0x4722=function(_0x4165d6,_0x3229f5){_0x4165d6=_0x4165d6-0x0;var _0x188c3e=_0x7224[_0x4165d6];return _0x188c3e;};'use strict';var _=require(_0x4722('0x0'));var util=require(_0x4722('0x1'));var moment=require(_0x4722('0x2'));var BPromise=require(_0x4722('0x3'));var rs=require(_0x4722('0x4'));var fs=require('fs');var Redis=require(_0x4722('0x5'));var db=require(_0x4722('0x6'))['db'];var utils=require(_0x4722('0x7'));var logger=require(_0x4722('0x8'))(_0x4722('0x9'));var config=require(_0x4722('0xa'));var jayson=require(_0x4722('0xb'));var client=jayson[_0x4722('0xc')][_0x4722('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c70bb,_0x6240a6,_0x2f92b8){return new BPromise(function(_0x32962b,_0x2f202e){return client[_0x4722('0xe')](_0x3c70bb,_0x2f92b8)[_0x4722('0xf')](function(_0x48f1d0){logger['info'](_0x4722('0x10'),_0x6240a6,_0x4722('0x11'));logger['debug'](_0x4722('0x12'),_0x6240a6,_0x4722('0x11'),JSON['stringify'](_0x48f1d0));if(_0x48f1d0[_0x4722('0x13')]){if(_0x48f1d0[_0x4722('0x13')][_0x4722('0x14')]===0x1f4){logger['error'](_0x4722('0x10'),_0x6240a6,_0x48f1d0[_0x4722('0x13')][_0x4722('0x15')]);return _0x2f202e(_0x48f1d0[_0x4722('0x13')][_0x4722('0x15')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x6240a6,_0x48f1d0[_0x4722('0x13')][_0x4722('0x15')]);return _0x32962b(_0x48f1d0['error'][_0x4722('0x15')]);}else{logger[_0x4722('0x16')]('AnalyticMetric,\x20%s,\x20%s',_0x6240a6,'request\x20sent');_0x32962b(_0x48f1d0[_0x4722('0x17')][_0x4722('0x15')]);}})[_0x4722('0x18')](function(_0xa3cdf1){logger['error'](_0x4722('0x10'),_0x6240a6,_0xa3cdf1);_0x2f202e(_0xa3cdf1);});});}
\ No newline at end of file
+var _0x2aa9=['../../config/logger','rpc','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x2aa9,0x18a));var _0x92aa=function(_0x305753,_0x299ca1){_0x305753=_0x305753-0x0;var _0x3ad6ff=_0x2aa9[_0x305753];return _0x3ad6ff;};'use strict';var _=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var moment=require(_0x92aa('0x2'));var BPromise=require(_0x92aa('0x3'));var rs=require(_0x92aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x92aa('0x6'))(_0x92aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x92aa('0x8')][_0x92aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x486b33,_0x7655b7,_0x3a0ec5){return new BPromise(function(_0x60d396,_0x361f52){return client['request'](_0x486b33,_0x3a0ec5)[_0x92aa('0xa')](function(_0x27b665){logger[_0x92aa('0xb')](_0x92aa('0xc'),_0x7655b7,_0x92aa('0xd'));logger[_0x92aa('0xe')](_0x92aa('0xf'),_0x7655b7,_0x92aa('0xd'),JSON[_0x92aa('0x10')](_0x27b665));if(_0x27b665['error']){if(_0x27b665[_0x92aa('0x11')]['code']===0x1f4){logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x27b665['error'][_0x92aa('0x12')]);return _0x361f52(_0x27b665[_0x92aa('0x11')][_0x92aa('0x12')]);}logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x27b665['error'][_0x92aa('0x12')]);return _0x60d396(_0x27b665[_0x92aa('0x11')][_0x92aa('0x12')]);}else{logger[_0x92aa('0xb')](_0x92aa('0xc'),_0x7655b7,_0x92aa('0xd'));_0x60d396(_0x27b665['result']['message']);}})[_0x92aa('0x13')](function(_0x35e1aa){logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x35e1aa);_0x361f52(_0x35e1aa);});});}
\ No newline at end of file
diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js
index 3a8f421..218b450 100644
--- a/server/api/analyticMetric/index.js
+++ b/server/api/analyticMetric/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xfd20=['util','express','Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports'];(function(_0x3f872a,_0x3ec864){var _0x13e5fd=function(_0x1db5a6){while(--_0x1db5a6){_0x3f872a['push'](_0x3f872a['shift']());}};_0x13e5fd(++_0x3ec864);}(_0xfd20,0x66));var _0x0fd2=function(_0x2df13f,_0x3a3921){_0x2df13f=_0x2df13f-0x0;var _0x5c8a3f=_0xfd20[_0x2df13f];return _0x5c8a3f;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fd2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fd2('0x4'));var controller=require(_0x0fd2('0x5'));router[_0x0fd2('0x6')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x8')]);router['get']('/:id',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x9')]);router[_0x0fd2('0xa')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xb')]);router[_0x0fd2('0xc')](_0x0fd2('0xd'),auth['isAuthenticated'](),controller[_0x0fd2('0xe')]);router[_0x0fd2('0xf')]('/:id',auth[_0x0fd2('0x7')](),controller['destroy']);module[_0x0fd2('0x10')]=router;
\ No newline at end of file
+var _0x5fd1=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy'];(function(_0x568172,_0x173414){var _0xda2d46=function(_0x2f2a03){while(--_0x2f2a03){_0x568172['push'](_0x568172['shift']());}};_0xda2d46(++_0x173414);}(_0x5fd1,0x155));var _0x15fd=function(_0x2fa263,_0x38401e){_0x2fa263=_0x2fa263-0x0;var _0x13f4ea=_0x5fd1[_0x2fa263];return _0x13f4ea;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./analyticMetric.controller');router[_0x15fd('0x7')]('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0x9')]);router[_0x15fd('0x7')](_0x15fd('0xa'),auth['isAuthenticated'](),controller[_0x15fd('0xb')]);router[_0x15fd('0xc')]('/',auth[_0x15fd('0x8')](),controller['create']);router[_0x15fd('0xd')]('/:id',auth[_0x15fd('0x8')](),controller[_0x15fd('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xf')]);module[_0x15fd('0x10')]=router;
\ No newline at end of file
diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js
index 1b498c3..4f392eb 100644
--- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js
+++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x062e=['TEXT','sequelize','exports'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x062e,0x1c6));var _0xe062=function(_0x4e1f1e,_0xc5b862){_0x4e1f1e=_0x4e1f1e-0x0;var _0x50d3de=_0x062e[_0x4e1f1e];return _0x50d3de;};'use strict';var Sequelize=require(_0xe062('0x0'));module[_0xe062('0x1')]={'tree':{'type':Sequelize[_0xe062('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x16c1=['sequelize','exports','TEXT'];(function(_0x48f85a,_0x1efd94){var _0x1bd655=function(_0x1a800d){while(--_0x1a800d){_0x48f85a['push'](_0x48f85a['shift']());}};_0x1bd655(++_0x1efd94);}(_0x16c1,0x66));var _0x116c=function(_0x46b079,_0x55b2bb){_0x46b079=_0x46b079-0x0;var _0x5c2a9f=_0x16c1[_0x46b079];return _0x5c2a9f;};'use strict';var Sequelize=require(_0x116c('0x0'));module[_0x116c('0x1')]={'tree':{'type':Sequelize[_0x116c('0x2')],'allowNull':![]}};
\ No newline at end of file
diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js
index 75eab4b..e399166 100644
--- a/server/api/analyticTreeReport/analyticTreeReport.controller.js
+++ b/server/api/analyticTreeReport/analyticTreeReport.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xf31a=['json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','AnalyticTreeReport','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','show','params','includeAll','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf31a,0x159));var _0xaf31=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xf31a[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require(_0xaf31('0x0'));var rimraf=require(_0xaf31('0x1'));var zipdir=require(_0xaf31('0x2'));var jsonpatch=require(_0xaf31('0x3'));var rp=require(_0xaf31('0x4'));var moment=require(_0xaf31('0x5'));var BPromise=require(_0xaf31('0x6'));var Mustache=require(_0xaf31('0x7'));var util=require(_0xaf31('0x8'));var path=require(_0xaf31('0x9'));var sox=require(_0xaf31('0xa'));var csv=require(_0xaf31('0xb'));var ejs=require(_0xaf31('0xc'));var fs=require('fs');var fs_extra=require(_0xaf31('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaf31('0xe'));var deskjs=require(_0xaf31('0xf'));var toCsv=require(_0xaf31('0xb'));var querystring=require(_0xaf31('0x10'));var Papa=require(_0xaf31('0x11'));var Redis=require(_0xaf31('0x12'));var authService=require(_0xaf31('0x13'));var qs=require(_0xaf31('0x14'));var as=require(_0xaf31('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf31('0x16'))(_0xaf31('0x17'));var utils=require(_0xaf31('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xaf31('0x19'));var db=require(_0xaf31('0x1a'))['db'];function respondWithStatusCode(_0xbca3e0,_0x2e3629){_0x2e3629=_0x2e3629||0xcc;return function(_0x1d8c65){if(_0x1d8c65){return _0xbca3e0[_0xaf31('0x1b')](_0x2e3629);}return _0xbca3e0[_0xaf31('0x1c')](_0x2e3629)[_0xaf31('0x1d')]();};}function respondWithResult(_0x25bd07,_0x58c279){_0x58c279=_0x58c279||0xc8;return function(_0xc04939){if(_0xc04939){return _0x25bd07[_0xaf31('0x1c')](_0x58c279)[_0xaf31('0x1e')](_0xc04939);}};}function respondWithFilteredResult(_0xd02d7,_0x2ca935){return function(_0x204153){if(_0x204153){var _0x59e97c=typeof _0x2ca935[_0xaf31('0x1f')]==='undefined'&&typeof _0x2ca935[_0xaf31('0x20')]==='undefined';var _0x4ac26f=_0x204153[_0xaf31('0x21')];var _0x542b8e=_0x59e97c?0x0:_0x2ca935[_0xaf31('0x1f')];var _0x470cc0=_0x59e97c?_0x204153['count']:_0x2ca935[_0xaf31('0x1f')]+_0x2ca935['limit'];var _0x5de237;if(_0x470cc0>=_0x4ac26f){_0x470cc0=_0x4ac26f;_0x5de237=0xc8;}else{_0x5de237=0xce;}_0xd02d7[_0xaf31('0x1c')](_0x5de237);return _0xd02d7['set'](_0xaf31('0x22'),_0x542b8e+'-'+_0x470cc0+'/'+_0x4ac26f)[_0xaf31('0x1e')](_0x204153);}return null;};}function patchUpdates(_0x10206e){return function(_0x23711f){try{jsonpatch[_0xaf31('0x23')](_0x23711f,_0x10206e,!![]);}catch(_0x3518a9){return BPromise[_0xaf31('0x24')](_0x3518a9);}return _0x23711f['save']();};}function saveUpdates(_0x5c1d99,_0x588e5e){return function(_0x479fc7){if(_0x479fc7){return _0x479fc7[_0xaf31('0x25')](_0x5c1d99)[_0xaf31('0x26')](function(_0x1de4ad){return _0x1de4ad;});}return null;};}function removeEntity(_0x1689be,_0xe307e7){return function(_0x1ded77){if(_0x1ded77){return _0x1ded77[_0xaf31('0x27')]()[_0xaf31('0x26')](function(){_0x1689be['status'](0xcc)[_0xaf31('0x1d')]();});}};}function handleEntityNotFound(_0x3ad1d6,_0xf5c7c3){return function(_0x5ca024){if(!_0x5ca024){_0x3ad1d6[_0xaf31('0x1b')](0x194);}return _0x5ca024;};}function handleError(_0x5d80bf,_0x34430d){_0x34430d=_0x34430d||0x1f4;return function(_0x4a3a9a){logger[_0xaf31('0x28')](_0x4a3a9a[_0xaf31('0x29')]);if(_0x4a3a9a[_0xaf31('0x2a')]){delete _0x4a3a9a[_0xaf31('0x2a')];}_0x5d80bf['status'](_0x34430d)['send'](_0x4a3a9a);};}exports[_0xaf31('0x2b')]=function(_0x3ce3a6,_0x596474){var _0x8526fb={},_0x42b8b3={},_0x5e6cd2={'count':0x0,'rows':[]};var _0x5e93b0=_['map'](db[_0xaf31('0x2c')]['rawAttributes'],function(_0x2a7276){return{'name':_0x2a7276[_0xaf31('0x2d')],'type':_0x2a7276[_0xaf31('0x2e')][_0xaf31('0x2f')]};});_0x42b8b3['model']=_[_0xaf31('0x30')](_0x5e93b0,'name');_0x42b8b3[_0xaf31('0x31')]=_[_0xaf31('0x32')](_0x3ce3a6[_0xaf31('0x31')]);_0x42b8b3[_0xaf31('0x33')]=_[_0xaf31('0x34')](_0x42b8b3[_0xaf31('0x35')],_0x42b8b3[_0xaf31('0x31')]);_0x8526fb[_0xaf31('0x36')]=_[_0xaf31('0x34')](_0x42b8b3['model'],qs[_0xaf31('0x37')](_0x3ce3a6[_0xaf31('0x31')][_0xaf31('0x37')]));_0x8526fb[_0xaf31('0x36')]=_0x8526fb[_0xaf31('0x36')][_0xaf31('0x38')]?_0x8526fb['attributes']:_0x42b8b3[_0xaf31('0x35')];if(!_0x3ce3a6['query'][_0xaf31('0x39')](_0xaf31('0x3a'))){_0x8526fb[_0xaf31('0x20')]=qs[_0xaf31('0x20')](_0x3ce3a6[_0xaf31('0x31')]['limit']);_0x8526fb[_0xaf31('0x1f')]=qs[_0xaf31('0x1f')](_0x3ce3a6[_0xaf31('0x31')][_0xaf31('0x1f')]);}_0x8526fb[_0xaf31('0x3b')]=qs[_0xaf31('0x3c')](_0x3ce3a6['query']['sort']);_0x8526fb[_0xaf31('0x3d')]=qs[_0xaf31('0x33')](_['pick'](_0x3ce3a6[_0xaf31('0x31')],_0x42b8b3[_0xaf31('0x33')]),_0x5e93b0);if(_0x3ce3a6[_0xaf31('0x31')][_0xaf31('0x3e')]){_0x8526fb[_0xaf31('0x3d')]=_[_0xaf31('0x3f')](_0x8526fb[_0xaf31('0x3d')],{'$or':_[_0xaf31('0x30')](_0x5e93b0,function(_0x561f0d){if(_0x561f0d[_0xaf31('0x2e')]!=='VIRTUAL'){var _0x287acf={};_0x287acf[_0x561f0d[_0xaf31('0x2a')]]={'$like':'%'+_0x3ce3a6[_0xaf31('0x31')][_0xaf31('0x3e')]+'%'};return _0x287acf;}})});}_0x8526fb=_[_0xaf31('0x3f')]({},_0x8526fb,_0x3ce3a6[_0xaf31('0x40')]);var _0x4bad7f={'where':_0x8526fb[_0xaf31('0x3d')]};return db[_0xaf31('0x2c')][_0xaf31('0x21')](_0x4bad7f)[_0xaf31('0x26')](function(_0x479b62){_0x5e6cd2[_0xaf31('0x21')]=_0x479b62;if(_0x3ce3a6[_0xaf31('0x31')]['includeAll']){_0x8526fb[_0xaf31('0x41')]=[{'all':!![]}];}return db[_0xaf31('0x2c')][_0xaf31('0x42')](_0x8526fb);})['then'](function(_0x279f2f){_0x5e6cd2[_0xaf31('0x43')]=_0x279f2f;return _0x5e6cd2;})[_0xaf31('0x26')](respondWithFilteredResult(_0x596474,_0x8526fb))['catch'](handleError(_0x596474,null));};exports[_0xaf31('0x44')]=function(_0x5cf301,_0x19ed61){var _0x22139f={'raw':!![],'where':{'id':_0x5cf301[_0xaf31('0x45')]['id']}},_0x5e3ada={};_0x5e3ada[_0xaf31('0x35')]=_[_0xaf31('0x32')](db[_0xaf31('0x2c')]['rawAttributes']);_0x5e3ada[_0xaf31('0x31')]=_[_0xaf31('0x32')](_0x5cf301[_0xaf31('0x31')]);_0x5e3ada['filters']=_['intersection'](_0x5e3ada['model'],_0x5e3ada['query']);_0x22139f[_0xaf31('0x36')]=_[_0xaf31('0x34')](_0x5e3ada[_0xaf31('0x35')],qs['fields'](_0x5cf301[_0xaf31('0x31')][_0xaf31('0x37')]));_0x22139f[_0xaf31('0x36')]=_0x22139f[_0xaf31('0x36')]['length']?_0x22139f[_0xaf31('0x36')]:_0x5e3ada[_0xaf31('0x35')];if(_0x5cf301[_0xaf31('0x31')][_0xaf31('0x46')]){_0x22139f[_0xaf31('0x41')]=[{'all':!![]}];}_0x22139f=_[_0xaf31('0x3f')]({},_0x22139f,_0x5cf301[_0xaf31('0x40')]);return db[_0xaf31('0x2c')]['find'](_0x22139f)[_0xaf31('0x26')](handleEntityNotFound(_0x19ed61,null))[_0xaf31('0x26')](respondWithResult(_0x19ed61,null))[_0xaf31('0x47')](handleError(_0x19ed61,null));};exports[_0xaf31('0x48')]=function(_0x4fe3fd,_0x5a3d8c){return db[_0xaf31('0x2c')][_0xaf31('0x48')](_0x4fe3fd['body'],{})[_0xaf31('0x26')](respondWithResult(_0x5a3d8c,0xc9))[_0xaf31('0x47')](handleError(_0x5a3d8c,null));};exports[_0xaf31('0x25')]=function(_0x517c85,_0x573a85){if(_0x517c85[_0xaf31('0x49')]['id']){delete _0x517c85['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x517c85[_0xaf31('0x45')]['id']}})[_0xaf31('0x26')](handleEntityNotFound(_0x573a85,null))[_0xaf31('0x26')](saveUpdates(_0x517c85[_0xaf31('0x49')],null))[_0xaf31('0x26')](respondWithResult(_0x573a85,null))[_0xaf31('0x47')](handleError(_0x573a85,null));};exports['destroy']=function(_0x26e9e7,_0x3b7dba){return db[_0xaf31('0x2c')][_0xaf31('0x4a')]({'where':{'id':_0x26e9e7[_0xaf31('0x45')]['id']}})[_0xaf31('0x26')](handleEntityNotFound(_0x3b7dba,null))['then'](removeEntity(_0x3b7dba,null))['catch'](handleError(_0x3b7dba,null));};
\ No newline at end of file
+var _0xb10f=['sox','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb10f,0x160));var _0xfb10=function(_0x551e5,_0x107952){_0x551e5=_0x551e5-0x0;var _0x2b6288=_0xb10f[_0x551e5];return _0x2b6288;};'use strict';var emlformat=require(_0xfb10('0x0'));var rimraf=require(_0xfb10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb10('0x2'));var rp=require('request-promise');var moment=require(_0xfb10('0x3'));var BPromise=require(_0xfb10('0x4'));var Mustache=require(_0xfb10('0x5'));var util=require(_0xfb10('0x6'));var path=require(_0xfb10('0x7'));var sox=require(_0xfb10('0x8'));var csv=require(_0xfb10('0x9'));var ejs=require(_0xfb10('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfb10('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfb10('0xc'));var toCsv=require(_0xfb10('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb10('0xd'));var authService=require(_0xfb10('0xe'));var qs=require(_0xfb10('0xf'));var as=require(_0xfb10('0x10'));var hardwareService=require(_0xfb10('0x11'));var logger=require('../../config/logger')(_0xfb10('0x12'));var utils=require(_0xfb10('0x13'));var config=require(_0xfb10('0x14'));var licenseUtil=require(_0xfb10('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x517e1e,_0x3df9ac){_0x3df9ac=_0x3df9ac||0xcc;return function(_0x3fe5b8){if(_0x3fe5b8){return _0x517e1e[_0xfb10('0x16')](_0x3df9ac);}return _0x517e1e[_0xfb10('0x17')](_0x3df9ac)[_0xfb10('0x18')]();};}function respondWithResult(_0x187ab8,_0x5b70b3){_0x5b70b3=_0x5b70b3||0xc8;return function(_0x436cb5){if(_0x436cb5){return _0x187ab8[_0xfb10('0x17')](_0x5b70b3)['json'](_0x436cb5);}};}function respondWithFilteredResult(_0x59e321,_0x3852bf){return function(_0x4cdb94){if(_0x4cdb94){var _0x3eb1d2=typeof _0x3852bf[_0xfb10('0x19')]===_0xfb10('0x1a')&&typeof _0x3852bf[_0xfb10('0x1b')]===_0xfb10('0x1a');var _0x456849=_0x4cdb94[_0xfb10('0x1c')];var _0x43b19b=_0x3eb1d2?0x0:_0x3852bf[_0xfb10('0x19')];var _0x4cf7bc=_0x3eb1d2?_0x4cdb94[_0xfb10('0x1c')]:_0x3852bf[_0xfb10('0x19')]+_0x3852bf[_0xfb10('0x1b')];var _0x573725;if(_0x4cf7bc>=_0x456849){_0x4cf7bc=_0x456849;_0x573725=0xc8;}else{_0x573725=0xce;}_0x59e321[_0xfb10('0x17')](_0x573725);return _0x59e321[_0xfb10('0x1d')](_0xfb10('0x1e'),_0x43b19b+'-'+_0x4cf7bc+'/'+_0x456849)[_0xfb10('0x1f')](_0x4cdb94);}return null;};}function patchUpdates(_0x243dc9){return function(_0x583bbd){try{jsonpatch[_0xfb10('0x20')](_0x583bbd,_0x243dc9,!![]);}catch(_0x1566d3){return BPromise[_0xfb10('0x21')](_0x1566d3);}return _0x583bbd[_0xfb10('0x22')]();};}function saveUpdates(_0x50a4af,_0x2c2315){return function(_0x546372){if(_0x546372){return _0x546372[_0xfb10('0x23')](_0x50a4af)[_0xfb10('0x24')](function(_0x8e2d70){return _0x8e2d70;});}return null;};}function removeEntity(_0x5a1062,_0x5f1a90){return function(_0x5347f0){if(_0x5347f0){return _0x5347f0[_0xfb10('0x25')]()[_0xfb10('0x24')](function(){_0x5a1062[_0xfb10('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ddf2,_0x1ff69e){return function(_0x445fc6){if(!_0x445fc6){_0x30ddf2[_0xfb10('0x16')](0x194);}return _0x445fc6;};}function handleError(_0xdd1ee0,_0x1246bf){_0x1246bf=_0x1246bf||0x1f4;return function(_0x49ca50){logger[_0xfb10('0x26')](_0x49ca50[_0xfb10('0x27')]);if(_0x49ca50[_0xfb10('0x28')]){delete _0x49ca50[_0xfb10('0x28')];}_0xdd1ee0[_0xfb10('0x17')](_0x1246bf)[_0xfb10('0x29')](_0x49ca50);};}exports[_0xfb10('0x2a')]=function(_0x2d4caf,_0x36735e){var _0x2cb4c0={},_0x583a70={},_0x2c054d={'count':0x0,'rows':[]};var _0x495b58=_['map'](db[_0xfb10('0x2b')][_0xfb10('0x2c')],function(_0x145d98){return{'name':_0x145d98[_0xfb10('0x2d')],'type':_0x145d98[_0xfb10('0x2e')][_0xfb10('0x2f')]};});_0x583a70[_0xfb10('0x30')]=_[_0xfb10('0x31')](_0x495b58,_0xfb10('0x28'));_0x583a70[_0xfb10('0x32')]=_[_0xfb10('0x33')](_0x2d4caf[_0xfb10('0x32')]);_0x583a70[_0xfb10('0x34')]=_['intersection'](_0x583a70[_0xfb10('0x30')],_0x583a70[_0xfb10('0x32')]);_0x2cb4c0['attributes']=_[_0xfb10('0x35')](_0x583a70[_0xfb10('0x30')],qs['fields'](_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x36')]));_0x2cb4c0['attributes']=_0x2cb4c0[_0xfb10('0x37')][_0xfb10('0x38')]?_0x2cb4c0[_0xfb10('0x37')]:_0x583a70[_0xfb10('0x30')];if(!_0x2d4caf['query']['hasOwnProperty'](_0xfb10('0x39'))){_0x2cb4c0['limit']=qs[_0xfb10('0x1b')](_0x2d4caf['query']['limit']);_0x2cb4c0[_0xfb10('0x19')]=qs[_0xfb10('0x19')](_0x2d4caf['query'][_0xfb10('0x19')]);}_0x2cb4c0['order']=qs['sort'](_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x3a')]);_0x2cb4c0[_0xfb10('0x3b')]=qs[_0xfb10('0x34')](_['pick'](_0x2d4caf[_0xfb10('0x32')],_0x583a70[_0xfb10('0x34')]),_0x495b58);if(_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x3c')]){_0x2cb4c0[_0xfb10('0x3b')]=_[_0xfb10('0x3d')](_0x2cb4c0[_0xfb10('0x3b')],{'$or':_[_0xfb10('0x31')](_0x495b58,function(_0x54976e){if(_0x54976e[_0xfb10('0x2e')]!=='VIRTUAL'){var _0x38575d={};_0x38575d[_0x54976e[_0xfb10('0x28')]]={'$like':'%'+_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x3c')]+'%'};return _0x38575d;}})});}_0x2cb4c0=_[_0xfb10('0x3d')]({},_0x2cb4c0,_0x2d4caf[_0xfb10('0x3e')]);var _0x451d4f={'where':_0x2cb4c0['where']};return db[_0xfb10('0x2b')][_0xfb10('0x1c')](_0x451d4f)[_0xfb10('0x24')](function(_0x587e2e){_0x2c054d[_0xfb10('0x1c')]=_0x587e2e;if(_0x2d4caf['query'][_0xfb10('0x3f')]){_0x2cb4c0[_0xfb10('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xfb10('0x41')](_0x2cb4c0);})['then'](function(_0x531360){_0x2c054d[_0xfb10('0x42')]=_0x531360;return _0x2c054d;})[_0xfb10('0x24')](respondWithFilteredResult(_0x36735e,_0x2cb4c0))[_0xfb10('0x43')](handleError(_0x36735e,null));};exports['show']=function(_0x996047,_0x51804f){var _0x1f84bd={'raw':!![],'where':{'id':_0x996047[_0xfb10('0x44')]['id']}},_0xea909e={};_0xea909e['model']=_[_0xfb10('0x33')](db[_0xfb10('0x2b')]['rawAttributes']);_0xea909e[_0xfb10('0x32')]=_[_0xfb10('0x33')](_0x996047[_0xfb10('0x32')]);_0xea909e[_0xfb10('0x34')]=_[_0xfb10('0x35')](_0xea909e[_0xfb10('0x30')],_0xea909e[_0xfb10('0x32')]);_0x1f84bd[_0xfb10('0x37')]=_[_0xfb10('0x35')](_0xea909e[_0xfb10('0x30')],qs['fields'](_0x996047[_0xfb10('0x32')][_0xfb10('0x36')]));_0x1f84bd[_0xfb10('0x37')]=_0x1f84bd['attributes'][_0xfb10('0x38')]?_0x1f84bd[_0xfb10('0x37')]:_0xea909e[_0xfb10('0x30')];if(_0x996047[_0xfb10('0x32')][_0xfb10('0x3f')]){_0x1f84bd[_0xfb10('0x40')]=[{'all':!![]}];}_0x1f84bd=_['merge']({},_0x1f84bd,_0x996047[_0xfb10('0x3e')]);return db[_0xfb10('0x2b')][_0xfb10('0x45')](_0x1f84bd)['then'](handleEntityNotFound(_0x51804f,null))[_0xfb10('0x24')](respondWithResult(_0x51804f,null))['catch'](handleError(_0x51804f,null));};exports[_0xfb10('0x46')]=function(_0x52a15b,_0x46d854){return db[_0xfb10('0x2b')][_0xfb10('0x46')](_0x52a15b['body'],{})[_0xfb10('0x24')](respondWithResult(_0x46d854,0xc9))[_0xfb10('0x43')](handleError(_0x46d854,null));};exports[_0xfb10('0x23')]=function(_0x1fdbc7,_0x423d52){if(_0x1fdbc7[_0xfb10('0x47')]['id']){delete _0x1fdbc7[_0xfb10('0x47')]['id'];}return db[_0xfb10('0x2b')]['find']({'where':{'id':_0x1fdbc7[_0xfb10('0x44')]['id']}})[_0xfb10('0x24')](handleEntityNotFound(_0x423d52,null))[_0xfb10('0x24')](saveUpdates(_0x1fdbc7[_0xfb10('0x47')],null))[_0xfb10('0x24')](respondWithResult(_0x423d52,null))[_0xfb10('0x43')](handleError(_0x423d52,null));};exports['destroy']=function(_0x56c770,_0x502b62){return db[_0xfb10('0x2b')][_0xfb10('0x45')]({'where':{'id':_0x56c770[_0xfb10('0x44')]['id']}})[_0xfb10('0x24')](handleEntityNotFound(_0x502b62,null))['then'](removeEntity(_0x502b62,null))[_0xfb10('0x43')](handleError(_0x502b62,null));};
\ No newline at end of file
diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js
index 543a8a1..a68f544 100644
--- a/server/api/analyticTreeReport/analyticTreeReport.model.js
+++ b/server/api/analyticTreeReport/analyticTreeReport.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd905=['request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','bluebird'];(function(_0x2cfad5,_0x15c56b){var _0x3568fb=function(_0x35179b){while(--_0x35179b){_0x2cfad5['push'](_0x2cfad5['shift']());}};_0x3568fb(++_0x15c56b);}(_0xd905,0x11b));var _0x5d90=function(_0x25ac47,_0x17c52e){_0x25ac47=_0x25ac47-0x0;var _0x11fda2=_0xd905[_0x25ac47];return _0x11fda2;};'use strict';var _=require('lodash');var util=require(_0x5d90('0x0'));var logger=require(_0x5d90('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5d90('0x2'));var rp=require(_0x5d90('0x3'));var fs=require('fs');var path=require(_0x5d90('0x4'));var rimraf=require('rimraf');var config=require(_0x5d90('0x5'));var attributes=require(_0x5d90('0x6'));module[_0x5d90('0x7')]=function(_0x19a847,_0x441639){return _0x19a847[_0x5d90('0x8')](_0x5d90('0x9'),attributes,{'tableName':_0x5d90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5afe=['exports','define','AnalyticTreeReport','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0xc70293,_0x2cc6f4){var _0x29036b=function(_0x225d0c){while(--_0x225d0c){_0xc70293['push'](_0xc70293['shift']());}};_0x29036b(++_0x2cc6f4);}(_0x5afe,0x10b));var _0xe5af=function(_0x2128d3,_0x420dfa){_0x2128d3=_0x2128d3-0x0;var _0x49fa00=_0x5afe[_0x2128d3];return _0x49fa00;};'use strict';var _=require('lodash');var util=require(_0xe5af('0x0'));var logger=require(_0xe5af('0x1'))(_0xe5af('0x2'));var moment=require('moment');var BPromise=require(_0xe5af('0x3'));var rp=require(_0xe5af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5af('0x5'));var config=require(_0xe5af('0x6'));var attributes=require(_0xe5af('0x7'));module[_0xe5af('0x8')]=function(_0xffac45,_0x719722){return _0xffac45[_0xe5af('0x9')](_0xe5af('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js
index a54b256..8c26b5b 100644
--- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js
+++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3889a2,_0x150b68){var _0xf6699f=function(_0x586c44){while(--_0x586c44){_0x3889a2['push'](_0x3889a2['shift']());}};_0xf6699f(++_0x150b68);}(_0x2ef3,0xba));var _0x32ef=function(_0x3394ba,_0x5b0737){_0x3394ba=_0x3394ba-0x0;var _0x39daff=_0x2ef3[_0x3394ba];return _0x39daff;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}
\ No newline at end of file
+var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x238a1a,_0x3b01f2){var _0x5bbacc=function(_0x13d7cb){while(--_0x13d7cb){_0x238a1a['push'](_0x238a1a['shift']());}};_0x5bbacc(++_0x3b01f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21d47d,_0x46cab0){_0x21d47d=_0x21d47d-0x0;var _0x395148=_0x5f2f[_0x21d47d];return _0x395148;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}
\ No newline at end of file
diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js
index 782d2fa..db4ccb6 100644
--- a/server/api/analyticTreeReport/index.js
+++ b/server/api/analyticTreeReport/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xe1cf=['create','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x50ad27,_0x984993){var _0x203d36=function(_0x42b068){while(--_0x42b068){_0x50ad27['push'](_0x50ad27['shift']());}};_0x203d36(++_0x984993);}(_0xe1cf,0x194));var _0xfe1c=function(_0x4dbf53,_0x3213ea){_0x4dbf53=_0x4dbf53-0x0;var _0x269abc=_0xe1cf[_0x4dbf53];return _0x269abc;};'use strict';var multer=require(_0xfe1c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfe1c('0x1'));var express=require(_0xfe1c('0x2'));var router=express['Router']();var fs_extra=require(_0xfe1c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfe1c('0x4'));var config=require(_0xfe1c('0x5'));var controller=require(_0xfe1c('0x6'));router[_0xfe1c('0x7')]('/',auth[_0xfe1c('0x8')](),controller[_0xfe1c('0x9')]);router['get'](_0xfe1c('0xa'),auth['isAuthenticated'](),controller[_0xfe1c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfe1c('0xc')]);router['put'](_0xfe1c('0xa'),auth[_0xfe1c('0x8')](),controller[_0xfe1c('0xd')]);router[_0xfe1c('0xe')](_0xfe1c('0xa'),auth[_0xfe1c('0x8')](),controller['destroy']);module[_0xfe1c('0xf')]=router;
\ No newline at end of file
+var _0x077b=['isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x665132,_0x5bbb19){var _0x312117=function(_0x152870){while(--_0x152870){_0x665132['push'](_0x665132['shift']());}};_0x312117(++_0x5bbb19);}(_0x077b,0xbd));var _0xb077=function(_0x4f41cf,_0xdf03fe){_0x4f41cf=_0x4f41cf-0x0;var _0x5e19d0=_0x077b[_0x4f41cf];return _0x5e19d0;};'use strict';var multer=require(_0xb077('0x0'));var util=require(_0xb077('0x1'));var path=require('path');var timeout=require(_0xb077('0x2'));var express=require(_0xb077('0x3'));var router=express[_0xb077('0x4')]();var fs_extra=require(_0xb077('0x5'));var auth=require(_0xb077('0x6'));var interaction=require(_0xb077('0x7'));var config=require(_0xb077('0x8'));var controller=require(_0xb077('0x9'));router[_0xb077('0xa')]('/',auth[_0xb077('0xb')](),controller['index']);router['get'](_0xb077('0xc'),auth[_0xb077('0xb')](),controller['show']);router[_0xb077('0xd')]('/',auth[_0xb077('0xb')](),controller[_0xb077('0xe')]);router[_0xb077('0xf')](_0xb077('0xc'),auth[_0xb077('0xb')](),controller[_0xb077('0x10')]);router[_0xb077('0x11')](_0xb077('0xc'),auth['isAuthenticated'](),controller[_0xb077('0x12')]);module[_0xb077('0x13')]=router;
\ No newline at end of file
diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js
index 8f224be..53b6197 100644
--- a/server/api/attachment/attachment.attributes.js
+++ b/server/api/attachment/attachment.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x4156=['STRING','sequelize','exports'];(function(_0x8b0ec1,_0x1c6b02){var _0x3c51ca=function(_0x4c3ffc){while(--_0x4c3ffc){_0x8b0ec1['push'](_0x8b0ec1['shift']());}};_0x3c51ca(++_0x1c6b02);}(_0x4156,0xf1));var _0x6415=function(_0x4258a3,_0x58b9bc){_0x4258a3=_0x4258a3-0x0;var _0x3a6232=_0x4156[_0x4258a3];return _0x3a6232;};'use strict';var Sequelize=require(_0x6415('0x0'));module[_0x6415('0x1')]={'name':{'type':Sequelize[_0x6415('0x2')]},'basename':{'type':Sequelize[_0x6415('0x2')]},'type':{'type':Sequelize[_0x6415('0x2')]}};
\ No newline at end of file
+var _0xc718=['sequelize','STRING'];(function(_0x597b7a,_0x5660e8){var _0xc37f49=function(_0x15053b){while(--_0x15053b){_0x597b7a['push'](_0x597b7a['shift']());}};_0xc37f49(++_0x5660e8);}(_0xc718,0xb6));var _0x8c71=function(_0x195eb3,_0x59180c){_0x195eb3=_0x195eb3-0x0;var _0x36ea03=_0xc718[_0x195eb3];return _0x36ea03;};'use strict';var Sequelize=require(_0x8c71('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c71('0x1')]},'basename':{'type':Sequelize[_0x8c71('0x1')]},'type':{'type':Sequelize['STRING']}};
\ No newline at end of file
diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js
index c0f6f1b..5347cb4 100644
--- a/server/api/attachment/attachment.controller.js
+++ b/server/api/attachment/attachment.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x4667=['filter','options','includeAll','include','findAll','rows','catch','show','params','find','clone','get','omit','updatedAt','body','createdAt','create','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL'];(function(_0x321399,_0x32957f){var _0x29b4a2=function(_0x2bf04f){while(--_0x2bf04f){_0x321399['push'](_0x321399['shift']());}};_0x29b4a2(++_0x32957f);}(_0x4667,0x12b));var _0x7466=function(_0x483cbe,_0x1832da){_0x483cbe=_0x483cbe-0x0;var _0x191c71=_0x4667[_0x483cbe];return _0x191c71;};'use strict';var emlformat=require(_0x7466('0x0'));var rimraf=require(_0x7466('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7466('0x2'));var moment=require('moment');var BPromise=require(_0x7466('0x3'));var Mustache=require(_0x7466('0x4'));var util=require(_0x7466('0x5'));var path=require('path');var sox=require(_0x7466('0x6'));var csv=require(_0x7466('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7466('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7466('0x9'));var jsforce=require(_0x7466('0xa'));var deskjs=require(_0x7466('0xb'));var toCsv=require(_0x7466('0x7'));var querystring=require('querystring');var Papa=require(_0x7466('0xc'));var Redis=require('ioredis');var authService=require(_0x7466('0xd'));var qs=require(_0x7466('0xe'));var as=require(_0x7466('0xf'));var hardwareService=require(_0x7466('0x10'));var logger=require(_0x7466('0x11'))(_0x7466('0x12'));var utils=require(_0x7466('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7466('0x14'));var db=require(_0x7466('0x15'))['db'];function respondWithStatusCode(_0x434485,_0x4fef86){_0x4fef86=_0x4fef86||0xcc;return function(_0x7dcbf8){if(_0x7dcbf8){return _0x434485[_0x7466('0x16')](_0x4fef86);}return _0x434485['status'](_0x4fef86)[_0x7466('0x17')]();};}function respondWithResult(_0x3ad738,_0x4e437a){_0x4e437a=_0x4e437a||0xc8;return function(_0x163237){if(_0x163237){return _0x3ad738['status'](_0x4e437a)['json'](_0x163237);}};}function respondWithFilteredResult(_0x59593a,_0x4e5c7b){return function(_0x1d674a){if(_0x1d674a){var _0x4a1ff4=typeof _0x4e5c7b[_0x7466('0x18')]===_0x7466('0x19')&&typeof _0x4e5c7b['limit']===_0x7466('0x19');var _0x18878a=_0x1d674a[_0x7466('0x1a')];var _0x1110db=_0x4a1ff4?0x0:_0x4e5c7b[_0x7466('0x18')];var _0x16b646=_0x4a1ff4?_0x1d674a[_0x7466('0x1a')]:_0x4e5c7b[_0x7466('0x18')]+_0x4e5c7b[_0x7466('0x1b')];var _0x514bae;if(_0x16b646>=_0x18878a){_0x16b646=_0x18878a;_0x514bae=0xc8;}else{_0x514bae=0xce;}_0x59593a[_0x7466('0x1c')](_0x514bae);return _0x59593a[_0x7466('0x1d')](_0x7466('0x1e'),_0x1110db+'-'+_0x16b646+'/'+_0x18878a)[_0x7466('0x1f')](_0x1d674a);}return null;};}function patchUpdates(_0x571ac2){return function(_0x1fe6a3){try{jsonpatch['apply'](_0x1fe6a3,_0x571ac2,!![]);}catch(_0x343ec8){return BPromise[_0x7466('0x20')](_0x343ec8);}return _0x1fe6a3[_0x7466('0x21')]();};}function saveUpdates(_0x56be55,_0x4ad0a0){return function(_0x522593){if(_0x522593){return _0x522593[_0x7466('0x22')](_0x56be55)[_0x7466('0x23')](function(_0x1a2762){return _0x1a2762;});}return null;};}function removeEntity(_0x1ca31f,_0x532960){return function(_0x29be30){if(_0x29be30){return _0x29be30[_0x7466('0x24')]()[_0x7466('0x23')](function(){_0x1ca31f[_0x7466('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1b93,_0x5a31ea){return function(_0x428719){if(!_0x428719){_0x5b1b93[_0x7466('0x16')](0x194);}return _0x428719;};}function handleError(_0x597087,_0x58c71e){_0x58c71e=_0x58c71e||0x1f4;return function(_0x3cbdaf){logger['error'](_0x3cbdaf['stack']);if(_0x3cbdaf[_0x7466('0x25')]){delete _0x3cbdaf[_0x7466('0x25')];}_0x597087[_0x7466('0x1c')](_0x58c71e)[_0x7466('0x26')](_0x3cbdaf);};}exports[_0x7466('0x27')]=function(_0x3c19b5,_0x1ff047){var _0x3006a6={},_0x377352={},_0x1e509c={'count':0x0,'rows':[]};var _0x58966a=_[_0x7466('0x28')](db[_0x7466('0x29')][_0x7466('0x2a')],function(_0x15fc25){return{'name':_0x15fc25[_0x7466('0x2b')],'type':_0x15fc25['type'][_0x7466('0x2c')]};});_0x377352[_0x7466('0x2d')]=_[_0x7466('0x28')](_0x58966a,_0x7466('0x25'));_0x377352[_0x7466('0x2e')]=_[_0x7466('0x2f')](_0x3c19b5[_0x7466('0x2e')]);_0x377352[_0x7466('0x30')]=_[_0x7466('0x31')](_0x377352[_0x7466('0x2d')],_0x377352['query']);_0x3006a6['attributes']=_[_0x7466('0x31')](_0x377352[_0x7466('0x2d')],qs['fields'](_0x3c19b5[_0x7466('0x2e')][_0x7466('0x32')]));_0x3006a6[_0x7466('0x33')]=_0x3006a6[_0x7466('0x33')][_0x7466('0x34')]?_0x3006a6[_0x7466('0x33')]:_0x377352[_0x7466('0x2d')];if(!_0x3c19b5[_0x7466('0x2e')][_0x7466('0x35')](_0x7466('0x36'))){_0x3006a6[_0x7466('0x1b')]=qs[_0x7466('0x1b')](_0x3c19b5['query'][_0x7466('0x1b')]);_0x3006a6['offset']=qs[_0x7466('0x18')](_0x3c19b5[_0x7466('0x2e')]['offset']);}_0x3006a6['order']=qs[_0x7466('0x37')](_0x3c19b5[_0x7466('0x2e')][_0x7466('0x37')]);_0x3006a6[_0x7466('0x38')]=qs[_0x7466('0x30')](_[_0x7466('0x39')](_0x3c19b5[_0x7466('0x2e')],_0x377352[_0x7466('0x30')]),_0x58966a);if(_0x3c19b5[_0x7466('0x2e')]['filter']){_0x3006a6[_0x7466('0x38')]=_[_0x7466('0x3a')](_0x3006a6['where'],{'$or':_['map'](_0x58966a,function(_0x36ee11){if(_0x36ee11[_0x7466('0x3b')]!==_0x7466('0x3c')){var _0x4b37a9={};_0x4b37a9[_0x36ee11[_0x7466('0x25')]]={'$like':'%'+_0x3c19b5[_0x7466('0x2e')][_0x7466('0x3d')]+'%'};return _0x4b37a9;}})});}_0x3006a6=_[_0x7466('0x3a')]({},_0x3006a6,_0x3c19b5[_0x7466('0x3e')]);var _0x30b0e6={'where':_0x3006a6[_0x7466('0x38')]};return db[_0x7466('0x29')]['count'](_0x30b0e6)[_0x7466('0x23')](function(_0x438917){_0x1e509c['count']=_0x438917;if(_0x3c19b5[_0x7466('0x2e')][_0x7466('0x3f')]){_0x3006a6[_0x7466('0x40')]=[{'all':!![]}];}return db[_0x7466('0x29')][_0x7466('0x41')](_0x3006a6);})['then'](function(_0xf5de24){_0x1e509c[_0x7466('0x42')]=_0xf5de24;return _0x1e509c;})['then'](respondWithFilteredResult(_0x1ff047,_0x3006a6))[_0x7466('0x43')](handleError(_0x1ff047,null));};exports[_0x7466('0x44')]=function(_0x22a8f6,_0xe09314){var _0x379dff={'raw':!![],'where':{'id':_0x22a8f6[_0x7466('0x45')]['id']}},_0xcdb9dc={};_0xcdb9dc[_0x7466('0x2d')]=_[_0x7466('0x2f')](db[_0x7466('0x29')][_0x7466('0x2a')]);_0xcdb9dc[_0x7466('0x2e')]=_['keys'](_0x22a8f6[_0x7466('0x2e')]);_0xcdb9dc[_0x7466('0x30')]=_[_0x7466('0x31')](_0xcdb9dc['model'],_0xcdb9dc[_0x7466('0x2e')]);_0x379dff[_0x7466('0x33')]=_[_0x7466('0x31')](_0xcdb9dc[_0x7466('0x2d')],qs['fields'](_0x22a8f6['query'][_0x7466('0x32')]));_0x379dff[_0x7466('0x33')]=_0x379dff['attributes'][_0x7466('0x34')]?_0x379dff['attributes']:_0xcdb9dc['model'];if(_0x22a8f6[_0x7466('0x2e')][_0x7466('0x3f')]){_0x379dff[_0x7466('0x40')]=[{'all':!![]}];}_0x379dff=_[_0x7466('0x3a')]({},_0x379dff,_0x22a8f6['options']);return db[_0x7466('0x29')][_0x7466('0x46')](_0x379dff)[_0x7466('0x23')](handleEntityNotFound(_0xe09314,null))[_0x7466('0x23')](respondWithResult(_0xe09314,null))['catch'](handleError(_0xe09314,null));};exports[_0x7466('0x47')]=function(_0x1b79ba,_0x2a443e){var _0x569c96={'where':{'id':_0x1b79ba[_0x7466('0x45')]['id']}},_0x4c1006={};_0x4c1006[_0x7466('0x2d')]=_[_0x7466('0x2f')](db[_0x7466('0x29')][_0x7466('0x2a')]);_0x569c96['attributes']=_[_0x7466('0x31')](_0x4c1006[_0x7466('0x2d')],qs[_0x7466('0x32')](_0x1b79ba['query'][_0x7466('0x32')]));_0x569c96[_0x7466('0x33')]=_0x569c96[_0x7466('0x33')][_0x7466('0x34')]?_0x569c96['attributes']:_0x4c1006[_0x7466('0x2d')];if(_0x1b79ba['query'][_0x7466('0x3f')]){_0x569c96[_0x7466('0x40')]=[{'all':!![]}];}_0x569c96=_['merge']({},_0x569c96,_0x1b79ba[_0x7466('0x3e')]);return db[_0x7466('0x29')][_0x7466('0x46')](_0x569c96)[_0x7466('0x23')](handleEntityNotFound(_0x2a443e,null))['then'](function(_0x386f5f){if(_0x386f5f){var _0x323ec6=_0x386f5f[_0x7466('0x48')]({'plain':!![]});_0x323ec6=qs[_0x7466('0x49')](_0x323ec6,['id','createdAt',_0x7466('0x4a')]);_0x1b79ba['body']=_['omit'](_0x1b79ba[_0x7466('0x4b')],['id',_0x7466('0x4c'),_0x7466('0x4a')]);return db['Attachment'][_0x7466('0x4d')](_['merge'](_0x323ec6,_0x1b79ba['body']),{'include':_0x1b79ba[_0x7466('0x2e')][_0x7466('0x3f')]?[{'all':!![]}]:undefined});}})[_0x7466('0x23')](respondWithResult(_0x2a443e,0xc9))[_0x7466('0x43')](handleError(_0x2a443e,null));};exports[_0x7466('0x22')]=function(_0x36db6a,_0x5387e4){if(_0x36db6a['body']['id']){delete _0x36db6a[_0x7466('0x4b')]['id'];}return db[_0x7466('0x29')][_0x7466('0x46')]({'where':{'id':_0x36db6a['params']['id']}})['then'](handleEntityNotFound(_0x5387e4,null))[_0x7466('0x23')](saveUpdates(_0x36db6a[_0x7466('0x4b')],null))[_0x7466('0x23')](respondWithResult(_0x5387e4,null))[_0x7466('0x43')](handleError(_0x5387e4,null));};exports[_0x7466('0x24')]=function(_0x552257,_0xd83f4a){return db[_0x7466('0x29')][_0x7466('0x46')]({'where':{'id':_0x552257[_0x7466('0x45')]['id']}})[_0x7466('0x23')](handleEntityNotFound(_0xd83f4a,null))[_0x7466('0x23')](removeEntity(_0xd83f4a,null))['catch'](handleError(_0xd83f4a,null));};exports['create']=function(_0x36cdbc,_0x9409c8,_0x1dbf7d){_0x36cdbc[_0x7466('0x4b')]['name']=_0x36cdbc['file'][_0x7466('0x4e')];_0x36cdbc[_0x7466('0x4b')][_0x7466('0x4f')]=_0x36cdbc[_0x7466('0x50')][_0x7466('0x51')];_0x36cdbc[_0x7466('0x4b')][_0x7466('0x3b')]=_0x36cdbc[_0x7466('0x50')][_0x7466('0x52')];return db['Attachment'][_0x7466('0x4d')](_0x36cdbc[_0x7466('0x4b')])[_0x7466('0x23')](respondWithResult(_0x9409c8,0xc9))[_0x7466('0x43')](handleError(_0x9409c8,null));};exports[_0x7466('0x53')]=function(_0x5a7a87,_0x16aa65,_0x172897){return db[_0x7466('0x29')][_0x7466('0x54')]({'where':{'id':_0x5a7a87['params']['id']},'raw':!![]})[_0x7466('0x23')](handleEntityNotFound(_0x16aa65,null))['then'](function(_0x161423){if(_0x161423){var _0x425dba=_0x161423[_0x7466('0x55')]!==null;var _0x595747=path[_0x7466('0x56')](config[_0x7466('0x57')],_0x7466('0x58'));if(_0x425dba){_0x595747=path[_0x7466('0x56')](_0x595747,_0x7466('0x59'));}var _0x27e7af=path[_0x7466('0x56')](_0x595747,_0x161423[_0x7466('0x4f')]);return _0x16aa65['download'](_0x27e7af);}})[_0x7466('0x43')](handleError(_0x16aa65,null));};
\ No newline at end of file
+var _0x946e=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','clone','get','updatedAt','body','createdAt','create','file','originalname','filename','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','basename','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0xc90440,_0x4cf80b){var _0x46ef96=function(_0x428ee0){while(--_0x428ee0){_0xc90440['push'](_0xc90440['shift']());}};_0x46ef96(++_0x4cf80b);}(_0x946e,0xae));var _0xe946=function(_0x1f878b,_0x1f894d){_0x1f878b=_0x1f878b-0x0;var _0x3fa595=_0x946e[_0x1f878b];return _0x3fa595;};'use strict';var emlformat=require(_0xe946('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe946('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe946('0x2'));var BPromise=require(_0xe946('0x3'));var Mustache=require(_0xe946('0x4'));var util=require(_0xe946('0x5'));var path=require(_0xe946('0x6'));var sox=require(_0xe946('0x7'));var csv=require(_0xe946('0x8'));var ejs=require(_0xe946('0x9'));var fs=require('fs');var fs_extra=require(_0xe946('0xa'));var _=require(_0xe946('0xb'));var squel=require(_0xe946('0xc'));var crypto=require(_0xe946('0xd'));var jsforce=require(_0xe946('0xe'));var deskjs=require(_0xe946('0xf'));var toCsv=require(_0xe946('0x8'));var querystring=require(_0xe946('0x10'));var Papa=require(_0xe946('0x11'));var Redis=require(_0xe946('0x12'));var authService=require(_0xe946('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe946('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe946('0x15'))(_0xe946('0x16'));var utils=require(_0xe946('0x17'));var config=require(_0xe946('0x18'));var licenseUtil=require(_0xe946('0x19'));var db=require(_0xe946('0x1a'))['db'];function respondWithStatusCode(_0x3232b1,_0x1cc8e7){_0x1cc8e7=_0x1cc8e7||0xcc;return function(_0x15f5cc){if(_0x15f5cc){return _0x3232b1[_0xe946('0x1b')](_0x1cc8e7);}return _0x3232b1[_0xe946('0x1c')](_0x1cc8e7)['end']();};}function respondWithResult(_0x40e2f4,_0x292863){_0x292863=_0x292863||0xc8;return function(_0x44404d){if(_0x44404d){return _0x40e2f4['status'](_0x292863)[_0xe946('0x1d')](_0x44404d);}};}function respondWithFilteredResult(_0x5caeb2,_0x4da63a){return function(_0x457ffd){if(_0x457ffd){var _0x2afe31=typeof _0x4da63a['offset']===_0xe946('0x1e')&&typeof _0x4da63a[_0xe946('0x1f')]==='undefined';var _0x49b8d2=_0x457ffd['count'];var _0x5d5feb=_0x2afe31?0x0:_0x4da63a[_0xe946('0x20')];var _0x6e9c58=_0x2afe31?_0x457ffd[_0xe946('0x21')]:_0x4da63a[_0xe946('0x20')]+_0x4da63a[_0xe946('0x1f')];var _0x442cc6;if(_0x6e9c58>=_0x49b8d2){_0x6e9c58=_0x49b8d2;_0x442cc6=0xc8;}else{_0x442cc6=0xce;}_0x5caeb2[_0xe946('0x1c')](_0x442cc6);return _0x5caeb2[_0xe946('0x22')](_0xe946('0x23'),_0x5d5feb+'-'+_0x6e9c58+'/'+_0x49b8d2)[_0xe946('0x1d')](_0x457ffd);}return null;};}function patchUpdates(_0x570632){return function(_0x4ff80b){try{jsonpatch['apply'](_0x4ff80b,_0x570632,!![]);}catch(_0x143551){return BPromise[_0xe946('0x24')](_0x143551);}return _0x4ff80b[_0xe946('0x25')]();};}function saveUpdates(_0x118307,_0x139f7c){return function(_0x1b09e0){if(_0x1b09e0){return _0x1b09e0[_0xe946('0x26')](_0x118307)[_0xe946('0x27')](function(_0x1e0496){return _0x1e0496;});}return null;};}function removeEntity(_0x293197,_0x5c9dcf){return function(_0x583c20){if(_0x583c20){return _0x583c20[_0xe946('0x28')]()[_0xe946('0x27')](function(){_0x293197[_0xe946('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5395a8,_0x325b03){return function(_0x15f995){if(!_0x15f995){_0x5395a8[_0xe946('0x1b')](0x194);}return _0x15f995;};}function handleError(_0x54a7a3,_0x5a7b26){_0x5a7b26=_0x5a7b26||0x1f4;return function(_0x97c5ca){logger['error'](_0x97c5ca[_0xe946('0x29')]);if(_0x97c5ca[_0xe946('0x2a')]){delete _0x97c5ca[_0xe946('0x2a')];}_0x54a7a3['status'](_0x5a7b26)[_0xe946('0x2b')](_0x97c5ca);};}exports['index']=function(_0x5da043,_0x5cac72){var _0x4fb148={},_0x10ef26={},_0x50aee6={'count':0x0,'rows':[]};var _0x1bf6b1=_[_0xe946('0x2c')](db[_0xe946('0x2d')][_0xe946('0x2e')],function(_0x36603e){return{'name':_0x36603e[_0xe946('0x2f')],'type':_0x36603e[_0xe946('0x30')][_0xe946('0x31')]};});_0x10ef26['model']=_[_0xe946('0x2c')](_0x1bf6b1,_0xe946('0x2a'));_0x10ef26[_0xe946('0x32')]=_[_0xe946('0x33')](_0x5da043[_0xe946('0x32')]);_0x10ef26[_0xe946('0x34')]=_[_0xe946('0x35')](_0x10ef26[_0xe946('0x36')],_0x10ef26[_0xe946('0x32')]);_0x4fb148[_0xe946('0x37')]=_[_0xe946('0x35')](_0x10ef26[_0xe946('0x36')],qs['fields'](_0x5da043[_0xe946('0x32')][_0xe946('0x38')]));_0x4fb148[_0xe946('0x37')]=_0x4fb148[_0xe946('0x37')]['length']?_0x4fb148[_0xe946('0x37')]:_0x10ef26['model'];if(!_0x5da043[_0xe946('0x32')][_0xe946('0x39')](_0xe946('0x3a'))){_0x4fb148[_0xe946('0x1f')]=qs[_0xe946('0x1f')](_0x5da043[_0xe946('0x32')]['limit']);_0x4fb148[_0xe946('0x20')]=qs[_0xe946('0x20')](_0x5da043[_0xe946('0x32')][_0xe946('0x20')]);}_0x4fb148[_0xe946('0x3b')]=qs[_0xe946('0x3c')](_0x5da043[_0xe946('0x32')][_0xe946('0x3c')]);_0x4fb148[_0xe946('0x3d')]=qs['filters'](_[_0xe946('0x3e')](_0x5da043[_0xe946('0x32')],_0x10ef26['filters']),_0x1bf6b1);if(_0x5da043[_0xe946('0x32')][_0xe946('0x3f')]){_0x4fb148[_0xe946('0x3d')]=_[_0xe946('0x40')](_0x4fb148[_0xe946('0x3d')],{'$or':_[_0xe946('0x2c')](_0x1bf6b1,function(_0x3da745){if(_0x3da745[_0xe946('0x30')]!==_0xe946('0x41')){var _0x234df1={};_0x234df1[_0x3da745[_0xe946('0x2a')]]={'$like':'%'+_0x5da043[_0xe946('0x32')]['filter']+'%'};return _0x234df1;}})});}_0x4fb148=_[_0xe946('0x40')]({},_0x4fb148,_0x5da043[_0xe946('0x42')]);var _0x3e1d67={'where':_0x4fb148[_0xe946('0x3d')]};return db['Attachment']['count'](_0x3e1d67)['then'](function(_0x22aaba){_0x50aee6[_0xe946('0x21')]=_0x22aaba;if(_0x5da043[_0xe946('0x32')][_0xe946('0x43')]){_0x4fb148[_0xe946('0x44')]=[{'all':!![]}];}return db[_0xe946('0x2d')][_0xe946('0x45')](_0x4fb148);})[_0xe946('0x27')](function(_0x486665){_0x50aee6['rows']=_0x486665;return _0x50aee6;})[_0xe946('0x27')](respondWithFilteredResult(_0x5cac72,_0x4fb148))[_0xe946('0x46')](handleError(_0x5cac72,null));};exports[_0xe946('0x47')]=function(_0x2c23f8,_0x110ff9){var _0x3aa609={'raw':!![],'where':{'id':_0x2c23f8[_0xe946('0x48')]['id']}},_0x1ac248={};_0x1ac248[_0xe946('0x36')]=_[_0xe946('0x33')](db[_0xe946('0x2d')][_0xe946('0x2e')]);_0x1ac248[_0xe946('0x32')]=_[_0xe946('0x33')](_0x2c23f8[_0xe946('0x32')]);_0x1ac248[_0xe946('0x34')]=_[_0xe946('0x35')](_0x1ac248[_0xe946('0x36')],_0x1ac248['query']);_0x3aa609[_0xe946('0x37')]=_[_0xe946('0x35')](_0x1ac248[_0xe946('0x36')],qs[_0xe946('0x38')](_0x2c23f8['query'][_0xe946('0x38')]));_0x3aa609[_0xe946('0x37')]=_0x3aa609[_0xe946('0x37')][_0xe946('0x49')]?_0x3aa609[_0xe946('0x37')]:_0x1ac248[_0xe946('0x36')];if(_0x2c23f8['query'][_0xe946('0x43')]){_0x3aa609[_0xe946('0x44')]=[{'all':!![]}];}_0x3aa609=_['merge']({},_0x3aa609,_0x2c23f8[_0xe946('0x42')]);return db[_0xe946('0x2d')][_0xe946('0x4a')](_0x3aa609)[_0xe946('0x27')](handleEntityNotFound(_0x110ff9,null))[_0xe946('0x27')](respondWithResult(_0x110ff9,null))[_0xe946('0x46')](handleError(_0x110ff9,null));};exports[_0xe946('0x4b')]=function(_0x17dad0,_0x21844f){var _0x8b1615={'where':{'id':_0x17dad0[_0xe946('0x48')]['id']}},_0x5487bc={};_0x5487bc[_0xe946('0x36')]=_[_0xe946('0x33')](db['Attachment'][_0xe946('0x2e')]);_0x8b1615[_0xe946('0x37')]=_[_0xe946('0x35')](_0x5487bc['model'],qs[_0xe946('0x38')](_0x17dad0[_0xe946('0x32')][_0xe946('0x38')]));_0x8b1615['attributes']=_0x8b1615[_0xe946('0x37')][_0xe946('0x49')]?_0x8b1615['attributes']:_0x5487bc[_0xe946('0x36')];if(_0x17dad0[_0xe946('0x32')]['includeAll']){_0x8b1615[_0xe946('0x44')]=[{'all':!![]}];}_0x8b1615=_[_0xe946('0x40')]({},_0x8b1615,_0x17dad0[_0xe946('0x42')]);return db[_0xe946('0x2d')][_0xe946('0x4a')](_0x8b1615)[_0xe946('0x27')](handleEntityNotFound(_0x21844f,null))[_0xe946('0x27')](function(_0x324140){if(_0x324140){var _0x5a8f62=_0x324140[_0xe946('0x4c')]({'plain':!![]});_0x5a8f62=qs['omit'](_0x5a8f62,['id','createdAt',_0xe946('0x4d')]);_0x17dad0[_0xe946('0x4e')]=_['omit'](_0x17dad0['body'],['id',_0xe946('0x4f'),_0xe946('0x4d')]);return db['Attachment'][_0xe946('0x50')](_[_0xe946('0x40')](_0x5a8f62,_0x17dad0[_0xe946('0x4e')]),{'include':_0x17dad0[_0xe946('0x32')][_0xe946('0x43')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x21844f,0xc9))[_0xe946('0x46')](handleError(_0x21844f,null));};exports[_0xe946('0x26')]=function(_0x126fab,_0x339ab2){if(_0x126fab['body']['id']){delete _0x126fab[_0xe946('0x4e')]['id'];}return db[_0xe946('0x2d')][_0xe946('0x4a')]({'where':{'id':_0x126fab[_0xe946('0x48')]['id']}})[_0xe946('0x27')](handleEntityNotFound(_0x339ab2,null))[_0xe946('0x27')](saveUpdates(_0x126fab[_0xe946('0x4e')],null))[_0xe946('0x27')](respondWithResult(_0x339ab2,null))[_0xe946('0x46')](handleError(_0x339ab2,null));};exports[_0xe946('0x28')]=function(_0xbac5c0,_0x5c832c){return db[_0xe946('0x2d')]['find']({'where':{'id':_0xbac5c0[_0xe946('0x48')]['id']}})[_0xe946('0x27')](handleEntityNotFound(_0x5c832c,null))['then'](removeEntity(_0x5c832c,null))['catch'](handleError(_0x5c832c,null));};exports[_0xe946('0x50')]=function(_0x26c754,_0xeb89e1,_0x2279a4){_0x26c754['body'][_0xe946('0x2a')]=_0x26c754[_0xe946('0x51')][_0xe946('0x52')];_0x26c754['body']['basename']=_0x26c754[_0xe946('0x51')][_0xe946('0x53')];_0x26c754['body'][_0xe946('0x30')]=_0x26c754[_0xe946('0x51')]['mimetype'];return db[_0xe946('0x2d')]['create'](_0x26c754[_0xe946('0x4e')])[_0xe946('0x27')](respondWithResult(_0xeb89e1,0xc9))[_0xe946('0x46')](handleError(_0xeb89e1,null));};exports[_0xe946('0x54')]=function(_0x369e02,_0x32333d,_0x34570e){return db[_0xe946('0x2d')][_0xe946('0x55')]({'where':{'id':_0x369e02[_0xe946('0x48')]['id']},'raw':!![]})[_0xe946('0x27')](handleEntityNotFound(_0x32333d,null))[_0xe946('0x27')](function(_0x24d6e7){if(_0x24d6e7){var _0x4825fc=_0x24d6e7[_0xe946('0x56')]!==null;var _0x61c191=path['join'](config[_0xe946('0x57')],_0xe946('0x58'));if(_0x4825fc){_0x61c191=path[_0xe946('0x59')](_0x61c191,'offline-chat/');}var _0xd6bc11=path[_0xe946('0x59')](_0x61c191,_0x24d6e7[_0xe946('0x5a')]);return _0x32333d['download'](_0xd6bc11);}})[_0xe946('0x46')](handleError(_0x32333d,null));};
\ No newline at end of file
diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js
index cae24a6..389b06f 100644
--- a/server/api/attachment/attachment.model.js
+++ b/server/api/attachment/attachment.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x24f2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./attachment.attributes','define','Attachment'];(function(_0x27c25f,_0x4ff5fe){var _0x2da4c4=function(_0x1f3c9a){while(--_0x1f3c9a){_0x27c25f['push'](_0x27c25f['shift']());}};_0x2da4c4(++_0x4ff5fe);}(_0x24f2,0x11e));var _0x224f=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0x24f2[_0x3e961c];return _0x474f9c;};'use strict';var _=require(_0x224f('0x0'));var util=require(_0x224f('0x1'));var logger=require(_0x224f('0x2'))(_0x224f('0x3'));var moment=require(_0x224f('0x4'));var BPromise=require(_0x224f('0x5'));var rp=require(_0x224f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x224f('0x7'));var config=require('../../config/environment');var attributes=require(_0x224f('0x8'));module['exports']=function(_0x4ddef1,_0xd2f71b){return _0x4ddef1[_0x224f('0x9')](_0x224f('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5248=['bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x232caf,_0x358822){var _0x4a5781=function(_0x33beeb){while(--_0x33beeb){_0x232caf['push'](_0x232caf['shift']());}};_0x4a5781(++_0x358822);}(_0x5248,0x1f4));var _0x8524=function(_0x1a31e5,_0x28b0da){_0x1a31e5=_0x1a31e5-0x0;var _0x14eff7=_0x5248[_0x1a31e5];return _0x14eff7;};'use strict';var _=require(_0x8524('0x0'));var util=require('util');var logger=require(_0x8524('0x1'))(_0x8524('0x2'));var moment=require(_0x8524('0x3'));var BPromise=require(_0x8524('0x4'));var rp=require(_0x8524('0x5'));var fs=require('fs');var path=require(_0x8524('0x6'));var rimraf=require(_0x8524('0x7'));var config=require(_0x8524('0x8'));var attributes=require(_0x8524('0x9'));module[_0x8524('0xa')]=function(_0x120e9d,_0x476c72){return _0x120e9d[_0x8524('0xb')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js
index 71a1437..3ee86cb 100644
--- a/server/api/attachment/attachment.rpc.js
+++ b/server/api/attachment/attachment.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x4517=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateAttachment','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4517,0x112));var _0x7451=function(_0x1d30b5,_0x5265f2){_0x1d30b5=_0x1d30b5-0x0;var _0x16c997=_0x4517[_0x1d30b5];return _0x16c997;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var moment=require(_0x7451('0x1'));var BPromise=require('bluebird');var rs=require(_0x7451('0x2'));var fs=require('fs');var Redis=require(_0x7451('0x3'));var db=require(_0x7451('0x4'))['db'];var utils=require(_0x7451('0x5'));var logger=require(_0x7451('0x6'))(_0x7451('0x7'));var config=require(_0x7451('0x8'));var jayson=require(_0x7451('0x9'));var client=jayson[_0x7451('0xa')][_0x7451('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac271,_0x1bfc08,_0x26306e){return new BPromise(function(_0x443b80,_0x2c2ace){return client[_0x7451('0xc')](_0x3ac271,_0x26306e)[_0x7451('0xd')](function(_0x4b7888){logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));logger[_0x7451('0x11')](_0x7451('0x12'),_0x1bfc08,_0x7451('0x10'),JSON[_0x7451('0x13')](_0x4b7888));if(_0x4b7888['error']){if(_0x4b7888['error'][_0x7451('0x14')]===0x1f4){logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')]['message']);return _0x2c2ace(_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);}logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);return _0x443b80(_0x4b7888[_0x7451('0x15')]['message']);}else{logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));_0x443b80(_0x4b7888['result']['message']);}})[_0x7451('0x17')](function(_0x1db688){logger[_0x7451('0x15')](_0x7451('0xf'),_0x1bfc08,_0x1db688);_0x2c2ace(_0x1db688);});});}exports[_0x7451('0x18')]=function(_0xd47ee4){var _0x31a4b2=this;return new Promise(function(_0x1120b1,_0x125ab1){return db['Attachment'][_0x7451('0x19')](_0xd47ee4[_0x7451('0x1a')],{'raw':_0xd47ee4[_0x7451('0x1b')]?_0xd47ee4['options'][_0x7451('0x1c')]===undefined?!![]:![]:!![]})[_0x7451('0xd')](function(_0x3ffb08){logger[_0x7451('0xe')](_0x7451('0x18'),_0xd47ee4);logger[_0x7451('0x11')](_0x7451('0x18'),_0xd47ee4,JSON['stringify'](_0x3ffb08));_0x1120b1(_0x3ffb08);})[_0x7451('0x17')](function(_0x309be0){logger['error'](_0x7451('0x18'),_0x309be0[_0x7451('0x16')],_0xd47ee4);_0x125ab1(_0x31a4b2[_0x7451('0x15')](0x1f4,_0x309be0['message']));});});};
\ No newline at end of file
+var _0xf874=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','moment','bluebird','randomstring'];(function(_0x1c80bd,_0x356976){var _0x15b7fc=function(_0x1ad2a){while(--_0x1ad2a){_0x1c80bd['push'](_0x1c80bd['shift']());}};_0x15b7fc(++_0x356976);}(_0xf874,0xed));var _0x4f87=function(_0x5465c3,_0x9698c4){_0x5465c3=_0x5465c3-0x0;var _0x2ee395=_0xf874[_0x5465c3];return _0x2ee395;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f87('0x0'));var BPromise=require(_0x4f87('0x1'));var rs=require(_0x4f87('0x2'));var fs=require('fs');var Redis=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var utils=require(_0x4f87('0x5'));var logger=require('../../config/logger')(_0x4f87('0x6'));var config=require(_0x4f87('0x7'));var jayson=require(_0x4f87('0x8'));var client=jayson[_0x4f87('0x9')][_0x4f87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fea6,_0x4a0662,_0x3a89e3){return new BPromise(function(_0x194853,_0x592008){return client[_0x4f87('0xb')](_0x44fea6,_0x3a89e3)[_0x4f87('0xc')](function(_0x4d8354){logger[_0x4f87('0xd')](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4a0662,_0x4f87('0xf'),JSON[_0x4f87('0x12')](_0x4d8354));if(_0x4d8354['error']){if(_0x4d8354['error'][_0x4f87('0x13')]===0x1f4){logger[_0x4f87('0x14')](_0x4f87('0xe'),_0x4a0662,_0x4d8354['error']['message']);return _0x592008(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}logger[_0x4f87('0x14')]('Attachment,\x20%s,\x20%s',_0x4a0662,_0x4d8354[_0x4f87('0x14')]['message']);return _0x194853(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}else{logger['info'](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));_0x194853(_0x4d8354[_0x4f87('0x16')][_0x4f87('0x15')]);}})[_0x4f87('0x17')](function(_0x3bd90f){logger['error'](_0x4f87('0xe'),_0x4a0662,_0x3bd90f);_0x592008(_0x3bd90f);});});}exports['CreateAttachment']=function(_0x10551e){var _0x6a3017=this;return new Promise(function(_0x46492d,_0x42c399){return db[_0x4f87('0x18')][_0x4f87('0x19')](_0x10551e[_0x4f87('0x1a')],{'raw':_0x10551e[_0x4f87('0x1b')]?_0x10551e[_0x4f87('0x1b')][_0x4f87('0x1c')]===undefined?!![]:![]:!![]})[_0x4f87('0xc')](function(_0x2c13a0){logger[_0x4f87('0xd')]('CreateAttachment',_0x10551e);logger['debug'](_0x4f87('0x1d'),_0x10551e,JSON[_0x4f87('0x12')](_0x2c13a0));_0x46492d(_0x2c13a0);})['catch'](function(_0x592edd){logger[_0x4f87('0x14')]('CreateAttachment',_0x592edd['message'],_0x10551e);_0x42c399(_0x6a3017[_0x4f87('0x14')](0x1f4,_0x592edd[_0x4f87('0x15')]));});});};
\ No newline at end of file
diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js
index bb66a02..ce38a5c 100644
--- a/server/api/attachment/index.js
+++ b/server/api/attachment/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x164d8d,_0x48184c){var _0x5c6b35=function(_0xe9cf76){while(--_0xe9cf76){_0x164d8d['push'](_0x164d8d['shift']());}};_0x5c6b35(++_0x48184c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x7eaa5d,_0x2fab26){_0x7eaa5d=_0x7eaa5d-0x0;var _0x327825=_0x5f2f[_0x7eaa5d];return _0x327825;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router;
\ No newline at end of file
+var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x0b0e,0x187));var _0xe0b0=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x0b0e[_0x54d49e];return _0x4af0f1;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router;
\ No newline at end of file
diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js
index 7530bda..4061a18 100644
--- a/server/api/authActiveDirectory/authActiveDirectory.controller.js
+++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc727=['role','admin','user','agent','then','name','disabled','blocked','blockedAt','add','getLicense','catch','status','send','message','ad-login','signToken','json','online','use','passport','passport-local','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/logger','api','undefined','activedirectory','url','domain','authenticate','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','password'];(function(_0x1e51b8,_0x46ae21){var _0x2b5c9a=function(_0xdbb7a){while(--_0xdbb7a){_0x1e51b8['push'](_0x1e51b8['shift']());}};_0x2b5c9a(++_0x46ae21);}(_0xc727,0x16c));var _0x7c72=function(_0x11816c,_0x136fde){_0x11816c=_0x11816c-0x0;var _0x5f27d0=_0xc727[_0x11816c];return _0x5f27d0;};'use strict';var passport=require(_0x7c72('0x0'));var LocalStrategy=require(_0x7c72('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0x7c72('0x2'));var BPromise=require(_0x7c72('0x3'));var util=require(_0x7c72('0x4'));var db=require(_0x7c72('0x5'))['db'];var authService=require(_0x7c72('0x6'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0x7c72('0x7'))(_0x7c72('0x8'));function isActiveDirectoryConfigured(_0x228abf){var _0x1dca72=![];if(typeof _0x228abf['activedirectory']!==_0x7c72('0x9')){_0x1dca72=_0x228abf['activedirectory']['baseDN']&&_0x228abf[_0x7c72('0xa')][_0x7c72('0xb')]&&_0x228abf['activedirectory'][_0x7c72('0xc')];}return _0x1dca72;}function adAuthenticate(_0x2af509,_0x1dbb92,_0x3aef80){return new BPromise(function(_0x4445e7,_0x2761fe){try{var _0x2b3d99=new ActiveDirectory(_0x2af509);_0x2b3d99[_0x7c72('0xd')](_0x1dbb92,_0x3aef80,function(_0x4ad971,_0x3fdacb){if(_0x4ad971){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x1dbb92,util[_0x7c72('0xe')](_0x4ad971,{'showHidden':![],'depth':null}));_0x2761fe(_0x7c72('0xf'));}else if(!_0x3fdacb){logger[_0x7c72('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x1dbb92);_0x2761fe(_0x7c72('0xf'));}else{_0x4445e7(_0x3fdacb);}});}catch(_0x485333){_0x2761fe(_0x485333);}});}function ActiveDirectoryAuthenticate(_0x579ebc,_0x5bc266,_0x2d4633,_0x120bf4){var _0x17bac7,_0x20e4a5;if(!isActiveDirectoryConfigured(config)){logger[_0x7c72('0x10')](_0x7c72('0x11'),_0x5bc266);return _0x120bf4(null,![],{'message':_0x7c72('0xf')});}return db[_0x7c72('0x12')][_0x7c72('0x13')]({'where':{'id':0x1},'attributes':[_0x7c72('0x14'),_0x7c72('0x15')],'raw':!![]})['then'](function(_0x353bbb){_0x17bac7=_0x353bbb;if(!_0x17bac7[_0x7c72('0x14')]){logger[_0x7c72('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x5bc266);throw new Error(_0x7c72('0xf'));}return _0x579ebc[_0x7c72('0x13')]({'logging':!![],'attributes':['id','name',_0x7c72('0x16'),'salt',_0x7c72('0x17'),'disabled','blocked','blockedAt','online'],'where':{'name':_0x5bc266,'role':{'$or':[_0x7c72('0x18'),_0x7c72('0x19'),_0x7c72('0x1a')]},'adSsoEnabled':!![]}});})[_0x7c72('0x1b')](function(_0x4cc47a){if(!_0x4cc47a||_0x4cc47a&&_0x4cc47a[_0x7c72('0x1c')]!==_0x5bc266){throw new Error(_0x7c72('0xf'));}_0x20e4a5=_0x4cc47a;var _0x37b379=_0x20e4a5[_0x7c72('0x1c')]+'@'+config[_0x7c72('0xa')][_0x7c72('0xc')];return adAuthenticate(config['activedirectory'],_0x37b379,_0x2d4633);})['then'](function(_0x1be2d6){if(_0x20e4a5[_0x7c72('0x1d')]){throw new Error(_0x7c72('0xf'));}if(_0x17bac7[_0x7c72('0x15')]>0x0){if(_0x20e4a5[_0x7c72('0x1e')]){if(moment(_0x20e4a5[_0x7c72('0x1f')])[_0x7c72('0x20')](_0x17bac7['blockDuration'],'minutes')>moment()){throw new Error(_0x7c72('0xf'));}return utils['clearBlockUser'](_0x20e4a5,0x0,![],null)[_0x7c72('0x1b')](function(){return utils['getLicense'](_0x20e4a5);})[_0x7c72('0x1b')](function(){return _0x120bf4(null,_0x20e4a5);});}else{return utils[_0x7c72('0x21')](_0x20e4a5)[_0x7c72('0x1b')](function(){return _0x120bf4(null,_0x20e4a5);});}}else{return utils[_0x7c72('0x21')](_0x20e4a5)[_0x7c72('0x1b')](function(){return _0x120bf4(null,_0x20e4a5);});}})[_0x7c72('0x22')](function(_0x1b9510){return _0x120bf4(null,![],_0x1b9510);});}function handleError(_0x410bc2,_0x68c10d,_0x261007){return _0x410bc2[_0x7c72('0x23')](_0x68c10d||0x1f4)[_0x7c72('0x24')]({'message':_0x261007?_0x261007[_0x7c72('0x25')]||_0x261007:''});}exports['login']=function(_0x44dcd0,_0x52f23d,_0x39f50d){passport['authenticate'](_0x7c72('0x26'),function(_0xdc225b,_0x26dcf6,_0x55d5ea){var _0x1f4925=_0xdc225b||_0x55d5ea;if(_0x1f4925){return handleError(_0x52f23d,0x191,_0x1f4925);}if(!_0x26dcf6){return handleError(_0x52f23d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4b389c={'payload':{'id':_0x26dcf6['id'],'role':_0x26dcf6['role']},'options':{'expiresIn':0x15180}};return authService[_0x7c72('0x27')](_0x4b389c)[_0x7c72('0x1b')](function(_0x5c39dc){_0x52f23d[_0x7c72('0x28')]({'id':_0x26dcf6['id'],'token':_0x5c39dc,'statusCall':'','isAlreadyLogged':_0x26dcf6[_0x7c72('0x29')]});});}})(_0x44dcd0,_0x52f23d,_0x39f50d);};passport[_0x7c72('0x2a')](_0x7c72('0x26'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x6a56d6,_0x44324d,_0x14c85){return ActiveDirectoryAuthenticate(db['User'],_0x6a56d6,_0x44324d,_0x14c85);}));
\ No newline at end of file
+var _0x194c=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','agent','minutes','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x194c,0x19b));var _0xc194=function(_0x4e8452,_0xf5645a){_0x4e8452=_0x4e8452-0x0;var _0x2b97f4=_0x194c[_0x4e8452];return _0x2b97f4;};'use strict';var passport=require(_0xc194('0x0'));var LocalStrategy=require(_0xc194('0x1'))[_0xc194('0x2')];var moment=require(_0xc194('0x3'));var ActiveDirectory=require(_0xc194('0x4'));var BPromise=require(_0xc194('0x5'));var util=require(_0xc194('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xc194('0x7'));var utils=require(_0xc194('0x8'));var config=require(_0xc194('0x9'));var logger=require(_0xc194('0xa'))(_0xc194('0xb'));function isActiveDirectoryConfigured(_0x330147){var _0x17462b=![];if(typeof _0x330147[_0xc194('0xc')]!==_0xc194('0xd')){_0x17462b=_0x330147[_0xc194('0xc')]['baseDN']&&_0x330147[_0xc194('0xc')]['url']&&_0x330147[_0xc194('0xc')][_0xc194('0xe')];}return _0x17462b;}function adAuthenticate(_0x7a75b9,_0x5bdc73,_0x3f547c){return new BPromise(function(_0x5608d8,_0x52124e){try{var _0x35c2c2=new ActiveDirectory(_0x7a75b9);_0x35c2c2[_0xc194('0xf')](_0x5bdc73,_0x3f547c,function(_0xb8bcd2,_0x585768){if(_0xb8bcd2){logger[_0xc194('0x10')](_0xc194('0x11'),_0x5bdc73,util[_0xc194('0x12')](_0xb8bcd2,{'showHidden':![],'depth':null}));_0x52124e(_0xc194('0x13'));}else if(!_0x585768){logger['error'](_0xc194('0x14'),_0x5bdc73);_0x52124e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5608d8(_0x585768);}});}catch(_0x14920a){_0x52124e(_0x14920a);}});}function ActiveDirectoryAuthenticate(_0x3b832d,_0x4222bd,_0x4ad6c2,_0x46a877){var _0x34a170,_0x4abcc7;if(!isActiveDirectoryConfigured(config)){logger[_0xc194('0x10')](_0xc194('0x15'),_0x4222bd);return _0x46a877(null,![],{'message':_0xc194('0x13')});}return db['Setting'][_0xc194('0x16')]({'where':{'id':0x1},'attributes':[_0xc194('0x17'),_0xc194('0x18')],'raw':!![]})[_0xc194('0x19')](function(_0x16789f){_0x34a170=_0x16789f;if(!_0x34a170[_0xc194('0x17')]){logger['error'](_0xc194('0x1a'),_0x4222bd);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3b832d[_0xc194('0x16')]({'logging':!![],'attributes':['id',_0xc194('0x1b'),_0xc194('0x1c'),_0xc194('0x1d'),_0xc194('0x1e'),_0xc194('0x1f'),_0xc194('0x20'),_0xc194('0x21'),_0xc194('0x22')],'where':{'name':_0x4222bd,'role':{'$or':['admin',_0xc194('0x23'),_0xc194('0x24')]},'adSsoEnabled':!![]}});})['then'](function(_0xdeb133){if(!_0xdeb133||_0xdeb133&&_0xdeb133[_0xc194('0x1b')]!==_0x4222bd){throw new Error(_0xc194('0x13'));}_0x4abcc7=_0xdeb133;var _0x13e98a=_0x4abcc7['name']+'@'+config[_0xc194('0xc')][_0xc194('0xe')];return adAuthenticate(config[_0xc194('0xc')],_0x13e98a,_0x4ad6c2);})[_0xc194('0x19')](function(_0x279adb){if(_0x4abcc7['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x34a170[_0xc194('0x18')]>0x0){if(_0x4abcc7[_0xc194('0x20')]){if(moment(_0x4abcc7[_0xc194('0x21')])['add'](_0x34a170[_0xc194('0x18')],_0xc194('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x4abcc7,0x0,![],null)[_0xc194('0x19')](function(){return utils[_0xc194('0x26')](_0x4abcc7);})['then'](function(){return _0x46a877(null,_0x4abcc7);});}else{return utils[_0xc194('0x26')](_0x4abcc7)['then'](function(){return _0x46a877(null,_0x4abcc7);});}}else{return utils[_0xc194('0x26')](_0x4abcc7)[_0xc194('0x19')](function(){return _0x46a877(null,_0x4abcc7);});}})[_0xc194('0x27')](function(_0x370f90){return _0x46a877(null,![],_0x370f90);});}function handleError(_0x1e30a9,_0x284d89,_0x567d7f){return _0x1e30a9[_0xc194('0x28')](_0x284d89||0x1f4)[_0xc194('0x29')]({'message':_0x567d7f?_0x567d7f['message']||_0x567d7f:''});}exports[_0xc194('0x2a')]=function(_0x364641,_0x9e77a1,_0x2bbb47){passport['authenticate'](_0xc194('0x2b'),function(_0x88598c,_0x54b6e9,_0x19cbbb){var _0x6ebb26=_0x88598c||_0x19cbbb;if(_0x6ebb26){return handleError(_0x9e77a1,0x191,_0x6ebb26);}if(!_0x54b6e9){return handleError(_0x9e77a1,0x194,{'message':_0xc194('0x2c')});}else{var _0x4f335a={'payload':{'id':_0x54b6e9['id'],'role':_0x54b6e9[_0xc194('0x1e')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4f335a)[_0xc194('0x19')](function(_0x45b007){_0x9e77a1[_0xc194('0x2d')]({'id':_0x54b6e9['id'],'token':_0x45b007,'statusCall':'','isAlreadyLogged':_0x54b6e9[_0xc194('0x22')]});});}})(_0x364641,_0x9e77a1,_0x2bbb47);};passport[_0xc194('0x2e')]('ad-login',new LocalStrategy({'usernameField':_0xc194('0x1b'),'passwordField':_0xc194('0x1c')},function(_0x19b599,_0x4a003b,_0xc2cb8e){return ActiveDirectoryAuthenticate(db[_0xc194('0x2f')],_0x19b599,_0x4a003b,_0xc2cb8e);}));
\ No newline at end of file
diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js
index 9acf6e9..d2acb13 100644
--- a/server/api/authActiveDirectory/index.js
+++ b/server/api/authActiveDirectory/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x176c=['./authActiveDirectory.controller','post','login','exports','express'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x176c,0x68));var _0xc176=function(_0x1d9897,_0x3a9d74){_0x1d9897=_0x1d9897-0x0;var _0x18f24d=_0x176c[_0x1d9897];return _0x18f24d;};'use strict';var express=require(_0xc176('0x0'));var router=express['Router']();var controller=require(_0xc176('0x1'));router[_0xc176('0x2')]('/',controller[_0xc176('0x3')]);module[_0xc176('0x4')]=router;
\ No newline at end of file
+var _0xf6eb=['express','login','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf6eb,0xb4));var _0xbf6e=function(_0x290700,_0x22b692){_0x290700=_0x290700-0x0;var _0x1cd47d=_0xf6eb[_0x290700];return _0x1cd47d;};'use strict';var express=require(_0xbf6e('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0xbf6e('0x1')]);module[_0xbf6e('0x2')]=router;
\ No newline at end of file
diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js
index fd03c3b..6f5d2b3 100644
--- a/server/api/authGoogle/authGoogle.controller.js
+++ b/server/api/authGoogle/authGoogle.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x7a54,0x106));var _0x47a5=function(_0x5e261f,_0x572205){_0x5e261f=_0x5e261f-0x0;var _0x2f1ea4=_0x7a54[_0x5e261f];return _0x2f1ea4;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});}));
\ No newline at end of file
+var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x4ff94f,_0x14c098){var _0x446781=function(_0x30372e){while(--_0x30372e){_0x4ff94f['push'](_0x4ff94f['shift']());}};_0x446781(++_0x14c098);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});}));
\ No newline at end of file
diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js
index 140cc4b..5ebb8a5 100644
--- a/server/api/authGoogle/index.js
+++ b/server/api/authGoogle/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x24ba=['../../components/auth/service','get','login','isMiddleware','express','Router','../user/user.controller.js'];(function(_0x48a6cb,_0x2f146f){var _0x12e4d8=function(_0x81faca){while(--_0x81faca){_0x48a6cb['push'](_0x48a6cb['shift']());}};_0x12e4d8(++_0x2f146f);}(_0x24ba,0xf2));var _0xa24b=function(_0x5d76ad,_0x26158d){_0x5d76ad=_0x5d76ad-0x0;var _0x4f7937=_0x24ba[_0x5d76ad];return _0x4f7937;};'use strict';var express=require(_0xa24b('0x0'));var passport=require('passport');var router=express[_0xa24b('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0xa24b('0x2'));var authService=require(_0xa24b('0x3'));router[_0xa24b('0x4')]('/',controller[_0xa24b('0x5')]);router[_0xa24b('0x4')]('/callback',controller['callback'],authService[_0xa24b('0x6')],userController[_0xa24b('0x5')],authService['setTokenCookie']);module['exports']=router;
\ No newline at end of file
+var _0xea1c=['callback','isMiddleware','setTokenCookie','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0xea1c,0xc1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var passport=require(_0xcea1('0x0'));var router=express[_0xcea1('0x1')]();var controller=require(_0xcea1('0x2'));var userController=require(_0xcea1('0x3'));var authService=require(_0xcea1('0x4'));router['get']('/',controller[_0xcea1('0x5')]);router[_0xcea1('0x6')]('/callback',controller[_0xcea1('0x7')],authService[_0xcea1('0x8')],userController[_0xcea1('0x5')],authService[_0xcea1('0x9')]);module['exports']=router;
\ No newline at end of file
diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js
index 21ee814..43f6564 100644
--- a/server/api/authLocal/authLocal.controller.js
+++ b/server/api/authLocal/authLocal.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x830b=['Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','save','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','add','minutes','clearBlockUser','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','getLicense','catch','find','email','MailServerOut'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x830b,0xd2));var _0xb830=function(_0x4b1bd3,_0x506647){_0x4b1bd3=_0x4b1bd3-0x0;var _0xacb11f=_0x830b[_0x4b1bd3];return _0xacb11f;};'use strict';var util=require(_0xb830('0x0'));var passport=require(_0xb830('0x1'));var LocalStrategy=require(_0xb830('0x2'))['Strategy'];var jayson=require(_0xb830('0x3'));var _=require(_0xb830('0x4'));var rs=require(_0xb830('0x5'));var moment=require(_0xb830('0x6'));var db=require(_0xb830('0x7'))['db'];var authService=require(_0xb830('0x8'));var utils=require(_0xb830('0x9'));var client=jayson[_0xb830('0xa')][_0xb830('0xb')]({'port':0x232b});function localAuthenticate(_0x58ad64,_0x3c3882,_0x20975e,_0x55475e){var _0x400c09,_0x25e56d;return db[_0xb830('0xc')][_0xb830('0xd')]({'where':{'id':0x1},'attributes':[_0xb830('0xe'),_0xb830('0xf')],'raw':!![]})[_0xb830('0x10')](function(_0x393054){_0x400c09=_0x393054;return _0x58ad64[_0xb830('0xd')]({'attributes':['id',_0xb830('0x11'),_0xb830('0x12'),'salt',_0xb830('0x13'),_0xb830('0x14'),_0xb830('0x15'),_0xb830('0x16'),_0xb830('0x17')],'where':{'name':_0x3c3882,'role':{'$or':[_0xb830('0x18'),_0xb830('0x19'),_0xb830('0x1a')]}}});})[_0xb830('0x10')](function(_0x24e083){if(!_0x24e083||_0x24e083&&_0x24e083[_0xb830('0x11')]!==_0x3c3882){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x25e56d=_0x24e083;return _0x25e56d;}})[_0xb830('0x10')](function(){_0x25e56d['authenticate'](_0x20975e,function(_0x52377b,_0x339b1f){var _0x856c44=_0x25e56d[_0xb830('0x17')]+0x1;if(_0x52377b){return _0x55475e(_0x52377b);}else if(!_0x339b1f){if(_0x25e56d['disabled']){return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x400c09[_0xb830('0xe')]>0x0){if(_0x25e56d[_0xb830('0x15')]){if(_0x400c09[_0xb830('0xf')]>0x0){if(moment(_0x25e56d[_0xb830('0x16')])[_0xb830('0x1b')](_0x400c09[_0xb830('0xf')],_0xb830('0x1c'))>moment()){return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb830('0x1d')](_0x25e56d,_0x856c44,![],null)[_0xb830('0x10')](function(){return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x856c44>=_0x400c09[_0xb830('0xe')]){return utils[_0xb830('0x1d')](_0x25e56d,0x0,!![],moment())[_0xb830('0x10')](function(){return _0x55475e(null,![],{'message':_0xb830('0x1e')});});}else{return utils[_0xb830('0x1d')](_0x25e56d,_0x856c44,![],null)[_0xb830('0x10')](function(){return _0x55475e(null,![],{'message':_0xb830('0x1e')});});}}}else{return _0x55475e(null,![],{'message':_0xb830('0x1e')});}}else{if(_0x25e56d[_0xb830('0x14')]){return _0x55475e(null,![],{'message':_0xb830('0x1e')});}else if(_0x400c09[_0xb830('0xe')]>0x0){if(_0x25e56d[_0xb830('0x15')]){if(_0x400c09[_0xb830('0xf')]>0x0){if(moment(_0x25e56d[_0xb830('0x16')])[_0xb830('0x1b')](_0x400c09[_0xb830('0xf')],_0xb830('0x1c'))>moment()){return _0x55475e(null,![],{'message':_0xb830('0x1e')});}else{return utils[_0xb830('0x1d')](_0x25e56d,0x0,![],null)['then'](function(){return utils[_0xb830('0x1f')](_0x25e56d);})[_0xb830('0x10')](function(){return _0x55475e(null,_0x25e56d);});}}else{return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xb830('0x1d')](_0x25e56d,0x0,![],null)[_0xb830('0x10')](function(){return utils['getLicense'](_0x25e56d);})[_0xb830('0x10')](function(){return _0x55475e(null,_0x25e56d);})[_0xb830('0x20')](function(_0x1bcca7){return _0x55475e(null,![],_0x1bcca7);});}}else{if(_0x25e56d[_0xb830('0x15')]){return _0x55475e(null,![],{'message':_0xb830('0x1e')});}else{return utils[_0xb830('0x1f')](_0x25e56d)['then'](function(){return _0x55475e(null,_0x25e56d);});}}}});})[_0xb830('0x20')](function(_0x4c5f0d){return _0x55475e(null,![],_0x4c5f0d);});}function sendServiceMail(_0x56dc52){return db['MailAccount'][_0xb830('0x21')]({'where':{'service':!![]},'attributes':['id',_0xb830('0x11'),_0xb830('0x22')],'include':[{'model':db[_0xb830('0x23')],'as':_0xb830('0x24'),'include':[{'model':db[_0xb830('0x25')],'as':_0xb830('0x25')}]}]})['then'](function(_0x2d53ef){if(!_0x2d53ef){throw new Error(_0xb830('0x26'));}var _0x2bf2a5=_0x2d53ef[_0xb830('0x27')]();var _0x3f662b={'account':_0x2bf2a5,'message':_[_0xb830('0x28')]({'from':util[_0xb830('0x29')](_0xb830('0x2a'),_0x2d53ef[_0xb830('0x11')],_0x2d53ef[_0xb830('0x22')]||_0x2d53ef['Smtp'][_0xb830('0x19')])},_0x56dc52)};return client[_0xb830('0x2b')](_0xb830('0x2c'),_0x3f662b);})[_0xb830('0x10')](function(_0x5a8a2a){if(_0x5a8a2a['error']){throw new Error(util[_0xb830('0x29')](_0xb830('0x2d'),_0x5a8a2a[_0xb830('0x2e')][_0xb830('0x2f')]||JSON[_0xb830('0x30')](_0x5a8a2a[_0xb830('0x2e')])));}return!![];});}function handleError(_0x4768a1,_0x54f215,_0x4c2fe4){return _0x4768a1[_0xb830('0x31')](_0x54f215||0x1f4)[_0xb830('0x32')]({'message':_0x4c2fe4?_0x4c2fe4['message']||_0x4c2fe4:''});}exports[_0xb830('0x33')]=function(_0x1df864,_0x825782,_0x3d2a5){passport['authenticate'](_0xb830('0x34'),function(_0x6e9d66,_0x9c8d9d,_0x45bd41){var _0x40354a=_0x6e9d66||_0x45bd41;if(_0x40354a){return handleError(_0x825782,0x191,_0x40354a);}if(!_0x9c8d9d){return handleError(_0x825782,0x194,{'message':_0xb830('0x35')});}else{var _0x4aceca={'payload':{'id':_0x9c8d9d['id'],'role':_0x9c8d9d['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4aceca)['then'](function(_0x9d9f6d){_0x825782[_0xb830('0x36')]({'id':_0x9c8d9d['id'],'token':_0x9d9f6d,'statusCall':'','isAlreadyLogged':_0x9c8d9d['online']});});}})(_0x1df864,_0x825782,_0x3d2a5);};exports[_0xb830('0x37')]=function(_0x3e1af5,_0x4b5d03){if(!_0x3e1af5[_0xb830('0x38')][_0xb830('0x22')]){return handleError(_0x4b5d03,0x1f4,{'message':_0xb830('0x39')});}var _0x3280b4=rs[_0xb830('0x3a')]();_0x3e1af5[_0xb830('0x38')][_0xb830('0x22')]=_0x3e1af5['body'][_0xb830('0x22')][_0xb830('0x3b')]()[_0xb830('0x3c')]();var _0x5e6ffd;return db[_0xb830('0xc')][_0xb830('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xb830('0x10')](function(_0xe260e1){_0x5e6ffd=_0xe260e1;return db['User'][_0xb830('0x21')]({'where':{'email':_0x3e1af5[_0xb830('0x38')]['email']}});})[_0xb830('0x10')](function(_0x55c179){if(!_0x55c179){throw new Error(_0xb830('0x3d'));}if(_0x55c179[_0xb830('0x14')]){throw new Error(_0xb830('0x3e'));}if(_0x55c179[_0xb830('0x15')]){if(moment(_0x55c179[_0xb830('0x16')])['add'](_0x5e6ffd[_0xb830('0xf')],_0xb830('0x1c'))>moment()){throw new Error(_0xb830('0x3f'));}else{_0x55c179[_0xb830('0x15')]=![];_0x55c179[_0xb830('0x16')]=null;}}_0x55c179[_0xb830('0x40')]=_0x3280b4;_0x55c179[_0xb830('0x41')]=Date[_0xb830('0x42')]()+0x36ee80;return _0x55c179['save']();})[_0xb830('0x10')](function(){return sendServiceMail({'to':_0x3e1af5[_0xb830('0x38')][_0xb830('0x22')],'subject':_0xb830('0x43'),'text':_0xb830('0x44')+_0xb830('0x45')+'https://'+_0x3e1af5['headers'][_0xb830('0x46')]+'/reset/'+_0x3280b4+'\x0a\x0a'+_0xb830('0x47')});})[_0xb830('0x10')](function(){_0x4b5d03[_0xb830('0x31')](0xc8)[_0xb830('0x32')]({'message':_0xb830('0x48')});})[_0xb830('0x20')](function(_0x2f4d50){return handleError(_0x4b5d03,0x1f4,_0x2f4d50);});};exports[_0xb830('0x49')]=function(_0x426ee9,_0x3b212e){return db['User']['find']({'where':{'resetPasswordToken':_0x426ee9['params'][_0xb830('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xb830('0x42')]()}}})[_0xb830('0x10')](function(_0x4ed9e1){if(!_0x4ed9e1){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xb830('0xd')]({'attributes':['id',_0xb830('0x4b'),_0xb830('0x4c'),_0xb830('0x4d')]})['then'](function(_0x6ded84){if(_0x6ded84[_0xb830('0x4b')])authService[_0xb830('0x4e')](_0x426ee9[_0xb830('0x38')][_0xb830('0x12')]);if(!_0x6ded84[_0xb830('0x4c')]||!_0x4ed9e1['previousPasswords'])return _0x4ed9e1;authService['validatePasswordHistory'](_0x426ee9[_0xb830('0x38')]['password'],_0x4ed9e1['previousPasswords'],_0x6ded84[_0xb830('0x4d')]);return _0x4ed9e1;})[_0xb830('0x10')](function(){_0x4ed9e1[_0xb830('0x12')]=_0x426ee9[_0xb830('0x38')][_0xb830('0x12')];_0x4ed9e1[_0xb830('0x40')]=null;_0x4ed9e1[_0xb830('0x41')]=null;return _0x4ed9e1[_0xb830('0x4f')]();});})[_0xb830('0x10')](function(){_0x3b212e[_0xb830('0x31')](0xc8)[_0xb830('0x32')]({'message':_0xb830('0x50')});})[_0xb830('0x20')](function(_0x170160){return handleError(_0x3b212e,0x1f4,_0x170160);});};passport[_0xb830('0x51')](_0xb830('0x34'),new LocalStrategy({'usernameField':_0xb830('0x11'),'passwordField':'password'},function(_0x5e3d0e,_0x129d23,_0x11282f){return localAuthenticate(db['User'],_0x5e3d0e,_0x129d23,_0x11282f);}));
\ No newline at end of file
+var _0x781e=['blocked','admin','user','agent','loginAttempts','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','catch','find','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','disabled'];(function(_0x3560de,_0x28b150){var _0x2d31c1=function(_0x1c13d9){while(--_0x1c13d9){_0x3560de['push'](_0x3560de['shift']());}};_0x2d31c1(++_0x28b150);}(_0x781e,0xda));var _0xe781=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x781e[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xe781('0x0'));var passport=require(_0xe781('0x1'));var LocalStrategy=require('passport-local')[_0xe781('0x2')];var jayson=require(_0xe781('0x3'));var _=require('lodash');var rs=require(_0xe781('0x4'));var moment=require(_0xe781('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0xe781('0x6'));var utils=require(_0xe781('0x7'));var client=jayson[_0xe781('0x8')][_0xe781('0x9')]({'port':0x232b});function localAuthenticate(_0x385920,_0x536217,_0x14b27e,_0x16e9bd){var _0x4ee18d,_0x12c128;return db[_0xe781('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xe781('0xb'),_0xe781('0xc')],'raw':!![]})[_0xe781('0xd')](function(_0x3bd40b){_0x4ee18d=_0x3bd40b;return _0x385920[_0xe781('0xe')]({'attributes':['id',_0xe781('0xf'),_0xe781('0x10'),_0xe781('0x11'),'role',_0xe781('0x12'),_0xe781('0x13'),'blockedAt','loginAttempts'],'where':{'name':_0x536217,'role':{'$or':[_0xe781('0x14'),_0xe781('0x15'),_0xe781('0x16')]}}});})[_0xe781('0xd')](function(_0x302319){if(!_0x302319||_0x302319&&_0x302319[_0xe781('0xf')]!==_0x536217){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x12c128=_0x302319;return _0x12c128;}})[_0xe781('0xd')](function(){_0x12c128['authenticate'](_0x14b27e,function(_0x58177d,_0x217032){var _0x37472e=_0x12c128[_0xe781('0x17')]+0x1;if(_0x58177d){return _0x16e9bd(_0x58177d);}else if(!_0x217032){if(_0x12c128['disabled']){return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ee18d[_0xe781('0xb')]>0x0){if(_0x12c128[_0xe781('0x13')]){if(_0x4ee18d[_0xe781('0xc')]>0x0){if(moment(_0x12c128[_0xe781('0x18')])[_0xe781('0x19')](_0x4ee18d[_0xe781('0xc')],_0xe781('0x1a'))>moment()){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}else{return utils[_0xe781('0x1c')](_0x12c128,_0x37472e,![],null)['then'](function(){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});});}}else{return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}}else{if(_0x37472e>=_0x4ee18d[_0xe781('0xb')]){return utils[_0xe781('0x1c')](_0x12c128,0x0,!![],moment())[_0xe781('0xd')](function(){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});});}else{return utils[_0xe781('0x1c')](_0x12c128,_0x37472e,![],null)[_0xe781('0xd')](function(){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});});}}}else{return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x12c128[_0xe781('0x12')]){return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ee18d['allowedLoginAttempts']>0x0){if(_0x12c128[_0xe781('0x13')]){if(_0x4ee18d[_0xe781('0xc')]>0x0){if(moment(_0x12c128[_0xe781('0x18')])[_0xe781('0x19')](_0x4ee18d[_0xe781('0xc')],_0xe781('0x1a'))>moment()){return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x12c128,0x0,![],null)[_0xe781('0xd')](function(){return utils[_0xe781('0x1d')](_0x12c128);})['then'](function(){return _0x16e9bd(null,_0x12c128);});}}else{return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}}else{return utils[_0xe781('0x1c')](_0x12c128,0x0,![],null)[_0xe781('0xd')](function(){return utils['getLicense'](_0x12c128);})[_0xe781('0xd')](function(){return _0x16e9bd(null,_0x12c128);})['catch'](function(_0x5ea9b8){return _0x16e9bd(null,![],_0x5ea9b8);});}}else{if(_0x12c128['blocked']){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}else{return utils['getLicense'](_0x12c128)[_0xe781('0xd')](function(){return _0x16e9bd(null,_0x12c128);});}}}});})['catch'](function(_0x188a44){return _0x16e9bd(null,![],_0x188a44);});}function sendServiceMail(_0x26e6ec){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id','name',_0xe781('0x1e')],'include':[{'model':db[_0xe781('0x1f')],'as':_0xe781('0x20'),'include':[{'model':db[_0xe781('0x21')],'as':'CloudProvider'}]}]})['then'](function(_0x366f6f){if(!_0x366f6f){throw new Error(_0xe781('0x22'));}var _0x3adf36=_0x366f6f['getSmtpOptions']();var _0xd58a56={'account':_0x3adf36,'message':_[_0xe781('0x23')]({'from':util[_0xe781('0x24')](_0xe781('0x25'),_0x366f6f[_0xe781('0xf')],_0x366f6f[_0xe781('0x1e')]||_0x366f6f['Smtp']['user'])},_0x26e6ec)};return client[_0xe781('0x26')](_0xe781('0x27'),_0xd58a56);})[_0xe781('0xd')](function(_0x29c834){if(_0x29c834[_0xe781('0x28')]){throw new Error(util['format'](_0xe781('0x29'),_0x29c834[_0xe781('0x28')][_0xe781('0x2a')]||JSON['stringify'](_0x29c834[_0xe781('0x28')])));}return!![];});}function handleError(_0x3bdc9e,_0x204b9a,_0x431292){return _0x3bdc9e[_0xe781('0x2b')](_0x204b9a||0x1f4)[_0xe781('0x2c')]({'message':_0x431292?_0x431292[_0xe781('0x2a')]||_0x431292:''});}exports[_0xe781('0x2d')]=function(_0x3eaa2c,_0x16dc43,_0x4ff6fa){passport[_0xe781('0x2e')](_0xe781('0x2f'),function(_0x2311b4,_0x7115f,_0x2b87fe){var _0x512581=_0x2311b4||_0x2b87fe;if(_0x512581){return handleError(_0x16dc43,0x191,_0x512581);}if(!_0x7115f){return handleError(_0x16dc43,0x194,{'message':_0xe781('0x30')});}else{var _0x8d7a26={'payload':{'id':_0x7115f['id'],'role':_0x7115f['role']},'options':{'expiresIn':0x15180}};return authService[_0xe781('0x31')](_0x8d7a26)[_0xe781('0xd')](function(_0x160b33){_0x16dc43[_0xe781('0x32')]({'id':_0x7115f['id'],'token':_0x160b33,'statusCall':'','isAlreadyLogged':_0x7115f['online']});});}})(_0x3eaa2c,_0x16dc43,_0x4ff6fa);};exports['forgot']=function(_0x4f9781,_0x5cc8e4){if(!_0x4f9781[_0xe781('0x33')][_0xe781('0x1e')]){return handleError(_0x5cc8e4,0x1f4,{'message':_0xe781('0x34')});}var _0x40b9d3=rs[_0xe781('0x35')]();_0x4f9781[_0xe781('0x33')][_0xe781('0x1e')]=_0x4f9781[_0xe781('0x33')][_0xe781('0x1e')][_0xe781('0x36')]()['toLowerCase']();var _0x55cdae;return db[_0xe781('0xa')][_0xe781('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe781('0xc')],'raw':!![]})[_0xe781('0xd')](function(_0x2c9560){_0x55cdae=_0x2c9560;return db[_0xe781('0x37')]['find']({'where':{'email':_0x4f9781['body'][_0xe781('0x1e')]}});})['then'](function(_0x519546){if(!_0x519546){throw new Error(_0xe781('0x38'));}if(_0x519546[_0xe781('0x12')]){throw new Error(_0xe781('0x39'));}if(_0x519546['blocked']){if(moment(_0x519546[_0xe781('0x18')])['add'](_0x55cdae['blockDuration'],'minutes')>moment()){throw new Error(_0xe781('0x3a'));}else{_0x519546[_0xe781('0x13')]=![];_0x519546[_0xe781('0x18')]=null;}}_0x519546[_0xe781('0x3b')]=_0x40b9d3;_0x519546['resetPasswordExpires']=Date[_0xe781('0x3c')]()+0x36ee80;return _0x519546[_0xe781('0x3d')]();})[_0xe781('0xd')](function(){return sendServiceMail({'to':_0x4f9781['body'][_0xe781('0x1e')],'subject':_0xe781('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xe781('0x3f')+_0xe781('0x40')+_0x4f9781['headers'][_0xe781('0x41')]+_0xe781('0x42')+_0x40b9d3+'\x0a\x0a'+_0xe781('0x43')});})[_0xe781('0xd')](function(){_0x5cc8e4[_0xe781('0x2b')](0xc8)[_0xe781('0x2c')]({'message':'Reset\x20Email\x20sent!'});})[_0xe781('0x44')](function(_0x3534f3){return handleError(_0x5cc8e4,0x1f4,_0x3534f3);});};exports['reset']=function(_0x23cb34,_0x21c9e7){return db['User'][_0xe781('0x45')]({'where':{'resetPasswordToken':_0x23cb34['params'][_0xe781('0x46')],'resetPasswordExpires':{'$gt':Date[_0xe781('0x3c')]()}}})[_0xe781('0xd')](function(_0x2689ff){if(!_0x2689ff){throw new Error(_0xe781('0x47'));}return db['Setting'][_0xe781('0xe')]({'attributes':['id',_0xe781('0x48'),_0xe781('0x49'),'passwordHistoryLimit']})[_0xe781('0xd')](function(_0xd397d4){if(_0xd397d4[_0xe781('0x48')])authService[_0xe781('0x4a')](_0x23cb34[_0xe781('0x33')][_0xe781('0x10')]);if(!_0xd397d4['enforcePasswordHistory']||!_0x2689ff[_0xe781('0x4b')])return _0x2689ff;authService['validatePasswordHistory'](_0x23cb34['body'][_0xe781('0x10')],_0x2689ff['previousPasswords'],_0xd397d4[_0xe781('0x4c')]);return _0x2689ff;})[_0xe781('0xd')](function(){_0x2689ff[_0xe781('0x10')]=_0x23cb34[_0xe781('0x33')][_0xe781('0x10')];_0x2689ff[_0xe781('0x3b')]=null;_0x2689ff['resetPasswordExpires']=null;return _0x2689ff[_0xe781('0x3d')]();});})[_0xe781('0xd')](function(){_0x21c9e7[_0xe781('0x2b')](0xc8)[_0xe781('0x2c')]({'message':_0xe781('0x4d')});})[_0xe781('0x44')](function(_0x822bcc){return handleError(_0x21c9e7,0x1f4,_0x822bcc);});};passport[_0xe781('0x4e')](_0xe781('0x2f'),new LocalStrategy({'usernameField':_0xe781('0xf'),'passwordField':_0xe781('0x10')},function(_0x52ad35,_0x1c538d,_0x81b56c){return localAuthenticate(db[_0xe781('0x37')],_0x52ad35,_0x1c538d,_0x81b56c);}));
\ No newline at end of file
diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js
index 6595179..64dfe63 100644
--- a/server/api/authLocal/index.js
+++ b/server/api/authLocal/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xe626=['express','Router','./authLocal.controller','post','login','/forgot','/reset/:token','reset','exports'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0xe626,0x1ef));var _0x6e62=function(_0x265e7a,_0x1fb3d1){_0x265e7a=_0x265e7a-0x0;var _0x56ae30=_0xe626[_0x265e7a];return _0x56ae30;};'use strict';var express=require(_0x6e62('0x0'));var router=express[_0x6e62('0x1')]();var controller=require(_0x6e62('0x2'));router[_0x6e62('0x3')]('/',controller[_0x6e62('0x4')]);router['post'](_0x6e62('0x5'),controller['forgot']);router[_0x6e62('0x3')](_0x6e62('0x6'),controller[_0x6e62('0x7')]);module[_0x6e62('0x8')]=router;
\ No newline at end of file
+var _0x22e0=['/forgot','forgot','/reset/:token','reset','exports','express','Router','login'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x22e0,0xa5));var _0x022e=function(_0x1953e7,_0x20a3d9){_0x1953e7=_0x1953e7-0x0;var _0x3b3d49=_0x22e0[_0x1953e7];return _0x3b3d49;};'use strict';var express=require(_0x022e('0x0'));var router=express[_0x022e('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0x022e('0x2')]);router['post'](_0x022e('0x3'),controller[_0x022e('0x4')]);router['post'](_0x022e('0x5'),controller[_0x022e('0x6')]);module[_0x022e('0x7')]=router;
\ No newline at end of file
diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js
index ebeb0c3..83580b3 100644
--- a/server/api/automation/automation.attributes.js
+++ b/server/api/automation/automation.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x3892=['STRING','INTEGER','sequelize','exports'];(function(_0x18d03a,_0x2fe246){var _0x26ff7d=function(_0x36e7b9){while(--_0x36e7b9){_0x18d03a['push'](_0x18d03a['shift']());}};_0x26ff7d(++_0x2fe246);}(_0x3892,0xe6));var _0x2389=function(_0x44cfab,_0xf35628){_0x44cfab=_0x44cfab-0x0;var _0x2fd092=_0x3892[_0x44cfab];return _0x2fd092;};'use strict';var Sequelize=require(_0x2389('0x0'));module[_0x2389('0x1')]={'name':{'type':Sequelize[_0x2389('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2389('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0xa}};
\ No newline at end of file
+var _0xb2ed=['STRING','BOOLEAN','INTEGER'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xb2ed,0xc0));var _0xdb2e=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xb2ed[_0x5317b5];return _0x3b7ce2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdb2e('0x0')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb2e('0x0')]},'status':{'type':Sequelize[_0xdb2e('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xdb2e('0x2')],'defaultValue':0xa}};
\ No newline at end of file
diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js
index f6121df..0bb0aad 100644
--- a/server/api/automation/automation.controller.js
+++ b/server/api/automation/automation.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x2aba=['map','addActions','getActions','findOne','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','Automation','includeAll','include','rows','catch','show','params','find','create','body','addConditions','Condition','ids','omit','getConditions'];(function(_0x36b5be,_0x25cbb9){var _0x186b09=function(_0x559d03){while(--_0x559d03){_0x36b5be['push'](_0x36b5be['shift']());}};_0x186b09(++_0x25cbb9);}(_0x2aba,0x151));var _0xa2ab=function(_0x335b1d,_0x4d5e1e){_0x335b1d=_0x335b1d-0x0;var _0x588161=_0x2aba[_0x335b1d];return _0x588161;};'use strict';var emlformat=require(_0xa2ab('0x0'));var rimraf=require(_0xa2ab('0x1'));var zipdir=require(_0xa2ab('0x2'));var jsonpatch=require(_0xa2ab('0x3'));var rp=require(_0xa2ab('0x4'));var moment=require('moment');var BPromise=require(_0xa2ab('0x5'));var Mustache=require(_0xa2ab('0x6'));var util=require(_0xa2ab('0x7'));var path=require('path');var sox=require(_0xa2ab('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2ab('0x9'));var squel=require(_0xa2ab('0xa'));var crypto=require(_0xa2ab('0xb'));var jsforce=require(_0xa2ab('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa2ab('0xd'));var querystring=require(_0xa2ab('0xe'));var Papa=require(_0xa2ab('0xf'));var Redis=require(_0xa2ab('0x10'));var authService=require(_0xa2ab('0x11'));var qs=require(_0xa2ab('0x12'));var as=require(_0xa2ab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2ab('0x14'))(_0xa2ab('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa2ab('0x16'));var db=require(_0xa2ab('0x17'))['db'];function respondWithStatusCode(_0x5f32e3,_0x1b8abe){_0x1b8abe=_0x1b8abe||0xcc;return function(_0x127350){if(_0x127350){return _0x5f32e3[_0xa2ab('0x18')](_0x1b8abe);}return _0x5f32e3[_0xa2ab('0x19')](_0x1b8abe)[_0xa2ab('0x1a')]();};}function respondWithResult(_0x4fb0cb,_0x505adb){_0x505adb=_0x505adb||0xc8;return function(_0x19ce04){if(_0x19ce04){return _0x4fb0cb['status'](_0x505adb)['json'](_0x19ce04);}};}function respondWithFilteredResult(_0x21a902,_0x1cfc17){return function(_0x5dfd9d){if(_0x5dfd9d){var _0x47e552=typeof _0x1cfc17['offset']===_0xa2ab('0x1b')&&typeof _0x1cfc17['limit']===_0xa2ab('0x1b');var _0x942ffd=_0x5dfd9d['count'];var _0x296f3a=_0x47e552?0x0:_0x1cfc17[_0xa2ab('0x1c')];var _0x208c4b=_0x47e552?_0x5dfd9d[_0xa2ab('0x1d')]:_0x1cfc17[_0xa2ab('0x1c')]+_0x1cfc17[_0xa2ab('0x1e')];var _0x460431;if(_0x208c4b>=_0x942ffd){_0x208c4b=_0x942ffd;_0x460431=0xc8;}else{_0x460431=0xce;}_0x21a902[_0xa2ab('0x19')](_0x460431);return _0x21a902[_0xa2ab('0x1f')](_0xa2ab('0x20'),_0x296f3a+'-'+_0x208c4b+'/'+_0x942ffd)[_0xa2ab('0x21')](_0x5dfd9d);}return null;};}function patchUpdates(_0x3a800b){return function(_0x182f16){try{jsonpatch[_0xa2ab('0x22')](_0x182f16,_0x3a800b,!![]);}catch(_0x27bfc7){return BPromise[_0xa2ab('0x23')](_0x27bfc7);}return _0x182f16[_0xa2ab('0x24')]();};}function saveUpdates(_0xf5025f,_0x473158){return function(_0x17c9de){if(_0x17c9de){return _0x17c9de[_0xa2ab('0x25')](_0xf5025f)[_0xa2ab('0x26')](function(_0x2c2fc4){return _0x2c2fc4;});}return null;};}function removeEntity(_0x55f6a2,_0x593c08){return function(_0x515659){if(_0x515659){return _0x515659[_0xa2ab('0x27')]()[_0xa2ab('0x26')](function(){_0x55f6a2[_0xa2ab('0x19')](0xcc)[_0xa2ab('0x1a')]();});}};}function handleEntityNotFound(_0x46d01b,_0x36b52c){return function(_0x245113){if(!_0x245113){_0x46d01b['sendStatus'](0x194);}return _0x245113;};}function handleError(_0x2f7644,_0x35603a){_0x35603a=_0x35603a||0x1f4;return function(_0x2df76d){logger['error'](_0x2df76d[_0xa2ab('0x28')]);if(_0x2df76d[_0xa2ab('0x29')]){delete _0x2df76d[_0xa2ab('0x29')];}_0x2f7644[_0xa2ab('0x19')](_0x35603a)['send'](_0x2df76d);};}exports[_0xa2ab('0x2a')]=function(_0x2e17b1,_0x38f9c1){var _0x33da9f={},_0x35d25f={},_0xa904b4={'count':0x0,'rows':[]};var _0x16ddfa=_['map'](db['Automation'][_0xa2ab('0x2b')],function(_0x414bbf){return{'name':_0x414bbf['fieldName'],'type':_0x414bbf[_0xa2ab('0x2c')][_0xa2ab('0x2d')]};});_0x35d25f[_0xa2ab('0x2e')]=_['map'](_0x16ddfa,_0xa2ab('0x29'));_0x35d25f[_0xa2ab('0x2f')]=_[_0xa2ab('0x30')](_0x2e17b1[_0xa2ab('0x2f')]);_0x35d25f[_0xa2ab('0x31')]=_[_0xa2ab('0x32')](_0x35d25f['model'],_0x35d25f[_0xa2ab('0x2f')]);_0x33da9f[_0xa2ab('0x33')]=_[_0xa2ab('0x32')](_0x35d25f[_0xa2ab('0x2e')],qs[_0xa2ab('0x34')](_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x34')]));_0x33da9f[_0xa2ab('0x33')]=_0x33da9f[_0xa2ab('0x33')][_0xa2ab('0x35')]?_0x33da9f[_0xa2ab('0x33')]:_0x35d25f[_0xa2ab('0x2e')];if(!_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x36')](_0xa2ab('0x37'))){_0x33da9f[_0xa2ab('0x1e')]=qs[_0xa2ab('0x1e')](_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x1e')]);_0x33da9f['offset']=qs[_0xa2ab('0x1c')](_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x1c')]);}_0x33da9f[_0xa2ab('0x38')]=qs['sort'](_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x39')]);_0x33da9f[_0xa2ab('0x3a')]=qs[_0xa2ab('0x31')](_[_0xa2ab('0x3b')](_0x2e17b1[_0xa2ab('0x2f')],_0x35d25f[_0xa2ab('0x31')]),_0x16ddfa);if(_0x2e17b1[_0xa2ab('0x2f')]['filter']){_0x33da9f[_0xa2ab('0x3a')]=_[_0xa2ab('0x3c')](_0x33da9f[_0xa2ab('0x3a')],{'$or':_['map'](_0x16ddfa,function(_0x40e297){if(_0x40e297['type']!=='VIRTUAL'){var _0x532144={};_0x532144[_0x40e297[_0xa2ab('0x29')]]={'$like':'%'+_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x3d')]+'%'};return _0x532144;}})});}_0x33da9f=_[_0xa2ab('0x3c')]({},_0x33da9f,_0x2e17b1[_0xa2ab('0x3e')]);var _0x392167={'where':_0x33da9f['where']};return db[_0xa2ab('0x3f')]['count'](_0x392167)[_0xa2ab('0x26')](function(_0x44093e){_0xa904b4[_0xa2ab('0x1d')]=_0x44093e;if(_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x40')]){_0x33da9f[_0xa2ab('0x41')]=[{'all':!![]}];}return db[_0xa2ab('0x3f')]['findAll'](_0x33da9f);})[_0xa2ab('0x26')](function(_0x19e374){_0xa904b4[_0xa2ab('0x42')]=_0x19e374;return _0xa904b4;})['then'](respondWithFilteredResult(_0x38f9c1,_0x33da9f))[_0xa2ab('0x43')](handleError(_0x38f9c1,null));};exports[_0xa2ab('0x44')]=function(_0x5253f3,_0x5a9a6a){var _0x46a5c7={'raw':![],'where':{'id':_0x5253f3[_0xa2ab('0x45')]['id']}},_0x3f7ba8={};_0x3f7ba8['model']=_['keys'](db[_0xa2ab('0x3f')][_0xa2ab('0x2b')]);_0x3f7ba8[_0xa2ab('0x2f')]=_[_0xa2ab('0x30')](_0x5253f3[_0xa2ab('0x2f')]);_0x3f7ba8[_0xa2ab('0x31')]=_[_0xa2ab('0x32')](_0x3f7ba8[_0xa2ab('0x2e')],_0x3f7ba8['query']);_0x46a5c7[_0xa2ab('0x33')]=_[_0xa2ab('0x32')](_0x3f7ba8['model'],qs['fields'](_0x5253f3[_0xa2ab('0x2f')][_0xa2ab('0x34')]));_0x46a5c7['attributes']=_0x46a5c7[_0xa2ab('0x33')][_0xa2ab('0x35')]?_0x46a5c7['attributes']:_0x3f7ba8[_0xa2ab('0x2e')];if(_0x5253f3[_0xa2ab('0x2f')][_0xa2ab('0x40')]){_0x46a5c7[_0xa2ab('0x41')]=[{'all':!![]}];}_0x46a5c7=_[_0xa2ab('0x3c')]({},_0x46a5c7,_0x5253f3[_0xa2ab('0x3e')]);return db[_0xa2ab('0x3f')][_0xa2ab('0x46')](_0x46a5c7)[_0xa2ab('0x26')](handleEntityNotFound(_0x5a9a6a,null))[_0xa2ab('0x26')](respondWithResult(_0x5a9a6a,null))[_0xa2ab('0x43')](handleError(_0x5a9a6a,null));};exports['create']=function(_0x35b699,_0x3bac97){return db['Automation'][_0xa2ab('0x47')](_0x35b699['body'],{})[_0xa2ab('0x26')](respondWithResult(_0x3bac97,0xc9))[_0xa2ab('0x43')](handleError(_0x3bac97,null));};exports[_0xa2ab('0x25')]=function(_0x2b894,_0x198380){if(_0x2b894[_0xa2ab('0x48')]['id']){delete _0x2b894[_0xa2ab('0x48')]['id'];}return db[_0xa2ab('0x3f')][_0xa2ab('0x46')]({'where':{'id':_0x2b894[_0xa2ab('0x45')]['id']}})['then'](handleEntityNotFound(_0x198380,null))['then'](saveUpdates(_0x2b894[_0xa2ab('0x48')],null))[_0xa2ab('0x26')](respondWithResult(_0x198380,null))[_0xa2ab('0x43')](handleError(_0x198380,null));};exports[_0xa2ab('0x27')]=function(_0x1a0488,_0x52633f){return db[_0xa2ab('0x3f')]['find']({'where':{'id':_0x1a0488[_0xa2ab('0x45')]['id']}})['then'](handleEntityNotFound(_0x52633f,null))[_0xa2ab('0x26')](removeEntity(_0x52633f,null))[_0xa2ab('0x43')](handleError(_0x52633f,null));};exports[_0xa2ab('0x49')]=function(_0x379579,_0x2b15e0,_0x115610){return db[_0xa2ab('0x4a')][_0xa2ab('0x46')]({'where':{'id':_0x379579[_0xa2ab('0x45')]['id']}})[_0xa2ab('0x26')](handleEntityNotFound(_0x2b15e0,null))[_0xa2ab('0x26')](function(_0x5e05ca){if(_0x5e05ca){return _0x5e05ca['addConditions'](_0x379579[_0xa2ab('0x48')][_0xa2ab('0x4b')],_[_0xa2ab('0x4c')](_0x379579[_0xa2ab('0x48')],[_0xa2ab('0x4b'),'id'])||{});}})[_0xa2ab('0x26')](respondWithResult(_0x2b15e0,null))[_0xa2ab('0x43')](handleError(_0x2b15e0,null));};exports[_0xa2ab('0x4d')]=function(_0x57b870,_0x27b352,_0x8c2b8b){var _0x341658={};var _0x478447={};var _0x28ba3c;var _0x12a6e1;return db[_0xa2ab('0x3f')]['findOne']({'where':{'id':_0x57b870[_0xa2ab('0x45')]['id']}})[_0xa2ab('0x26')](handleEntityNotFound(_0x27b352,null))[_0xa2ab('0x26')](function(_0x5c91e6){if(_0x5c91e6){_0x28ba3c=_0x5c91e6;_0x478447[_0xa2ab('0x2e')]=_[_0xa2ab('0x30')](db[_0xa2ab('0x4a')]['rawAttributes']);_0x478447[_0xa2ab('0x2f')]=_[_0xa2ab('0x30')](_0x57b870[_0xa2ab('0x2f')]);_0x478447[_0xa2ab('0x31')]=_[_0xa2ab('0x32')](_0x478447[_0xa2ab('0x2e')],_0x478447[_0xa2ab('0x2f')]);_0x341658[_0xa2ab('0x33')]=_[_0xa2ab('0x32')](_0x478447[_0xa2ab('0x2e')],qs[_0xa2ab('0x34')](_0x57b870[_0xa2ab('0x2f')]['fields']));_0x341658[_0xa2ab('0x33')]=_0x341658[_0xa2ab('0x33')][_0xa2ab('0x35')]?_0x341658[_0xa2ab('0x33')]:_0x478447[_0xa2ab('0x2e')];_0x341658[_0xa2ab('0x38')]=qs[_0xa2ab('0x39')](_0x57b870[_0xa2ab('0x2f')]['sort']);_0x341658[_0xa2ab('0x3a')]=qs[_0xa2ab('0x31')](_[_0xa2ab('0x3b')](_0x57b870[_0xa2ab('0x2f')],_0x478447[_0xa2ab('0x31')]));if(_0x57b870[_0xa2ab('0x2f')]['filter']){_0x341658['where']=_[_0xa2ab('0x3c')](_0x341658[_0xa2ab('0x3a')],{'$or':_[_0xa2ab('0x4e')](_0x341658[_0xa2ab('0x33')],function(_0x56ea74){var _0x19eb17={};_0x19eb17[_0x56ea74]={'$like':'%'+_0x57b870[_0xa2ab('0x2f')][_0xa2ab('0x3d')]+'%'};return _0x19eb17;})});}_0x341658=_[_0xa2ab('0x3c')]({},_0x341658,_0x57b870['options']);return _0x28ba3c[_0xa2ab('0x4d')](_0x341658);}})[_0xa2ab('0x26')](function(_0x439519){if(_0x439519){_0x12a6e1=_0x439519[_0xa2ab('0x35')];if(!_0x57b870[_0xa2ab('0x2f')]['hasOwnProperty'](_0xa2ab('0x37'))){_0x341658[_0xa2ab('0x1e')]=qs[_0xa2ab('0x1e')](_0x57b870[_0xa2ab('0x2f')]['limit']);_0x341658[_0xa2ab('0x1c')]=qs[_0xa2ab('0x1c')](_0x57b870[_0xa2ab('0x2f')][_0xa2ab('0x1c')]);}return _0x28ba3c[_0xa2ab('0x4d')](_0x341658);}})[_0xa2ab('0x26')](function(_0x3d304e){if(_0x3d304e){return _0x3d304e?{'count':_0x12a6e1,'rows':_0x3d304e}:null;}})[_0xa2ab('0x26')](respondWithResult(_0x27b352,null))['catch'](handleError(_0x27b352,null));};exports[_0xa2ab('0x4f')]=function(_0x146c01,_0x242192,_0x4d2857){return db['Action']['find']({'where':{'id':_0x146c01[_0xa2ab('0x45')]['id']}})[_0xa2ab('0x26')](handleEntityNotFound(_0x242192,null))[_0xa2ab('0x26')](function(_0x3e4f81){if(_0x3e4f81){return _0x3e4f81['addActions'](_0x146c01[_0xa2ab('0x48')][_0xa2ab('0x4b')],_[_0xa2ab('0x4c')](_0x146c01[_0xa2ab('0x48')],[_0xa2ab('0x4b'),'id'])||{});}})[_0xa2ab('0x26')](respondWithResult(_0x242192,null))[_0xa2ab('0x43')](handleError(_0x242192,null));};exports[_0xa2ab('0x50')]=function(_0x56d8dc,_0x4f707c,_0x392bc5){var _0x40a9e8={};var _0x34df09={};var _0x5e2abf;var _0x4d23a4;return db[_0xa2ab('0x3f')][_0xa2ab('0x51')]({'where':{'id':_0x56d8dc[_0xa2ab('0x45')]['id']}})[_0xa2ab('0x26')](handleEntityNotFound(_0x4f707c,null))[_0xa2ab('0x26')](function(_0x3235d5){if(_0x3235d5){_0x5e2abf=_0x3235d5;_0x34df09['model']=_[_0xa2ab('0x30')](db[_0xa2ab('0x52')][_0xa2ab('0x2b')]);_0x34df09['query']=_[_0xa2ab('0x30')](_0x56d8dc[_0xa2ab('0x2f')]);_0x34df09[_0xa2ab('0x31')]=_[_0xa2ab('0x32')](_0x34df09[_0xa2ab('0x2e')],_0x34df09[_0xa2ab('0x2f')]);_0x40a9e8['attributes']=_[_0xa2ab('0x32')](_0x34df09[_0xa2ab('0x2e')],qs['fields'](_0x56d8dc[_0xa2ab('0x2f')]['fields']));_0x40a9e8[_0xa2ab('0x33')]=_0x40a9e8['attributes'][_0xa2ab('0x35')]?_0x40a9e8['attributes']:_0x34df09[_0xa2ab('0x2e')];_0x40a9e8[_0xa2ab('0x38')]=qs['sort'](_0x56d8dc['query'][_0xa2ab('0x39')]);_0x40a9e8[_0xa2ab('0x3a')]=qs[_0xa2ab('0x31')](_['pick'](_0x56d8dc[_0xa2ab('0x2f')],_0x34df09['filters']));if(_0x56d8dc[_0xa2ab('0x2f')][_0xa2ab('0x3d')]){_0x40a9e8[_0xa2ab('0x3a')]=_[_0xa2ab('0x3c')](_0x40a9e8[_0xa2ab('0x3a')],{'$or':_[_0xa2ab('0x4e')](_0x40a9e8['attributes'],function(_0xe2ea0f){var _0x5c9ba8={};_0x5c9ba8[_0xe2ea0f]={'$like':'%'+_0x56d8dc['query'][_0xa2ab('0x3d')]+'%'};return _0x5c9ba8;})});}_0x40a9e8=_[_0xa2ab('0x3c')]({},_0x40a9e8,_0x56d8dc[_0xa2ab('0x3e')]);return _0x5e2abf[_0xa2ab('0x50')](_0x40a9e8);}})[_0xa2ab('0x26')](function(_0x3c6c1d){if(_0x3c6c1d){_0x4d23a4=_0x3c6c1d['length'];if(!_0x56d8dc['query'][_0xa2ab('0x36')](_0xa2ab('0x37'))){_0x40a9e8[_0xa2ab('0x1e')]=qs['limit'](_0x56d8dc['query'][_0xa2ab('0x1e')]);_0x40a9e8[_0xa2ab('0x1c')]=qs[_0xa2ab('0x1c')](_0x56d8dc['query'][_0xa2ab('0x1c')]);}return _0x5e2abf[_0xa2ab('0x50')](_0x40a9e8);}})[_0xa2ab('0x26')](function(_0x4afe95){if(_0x4afe95){return _0x4afe95?{'count':_0x4d23a4,'rows':_0x4afe95}:null;}})['then'](respondWithResult(_0x4f707c,null))[_0xa2ab('0x43')](handleError(_0x4f707c,null));};
\ No newline at end of file
+var _0x8068=['Condition','pick','getConditions','hasOwnProperty','addActions','Action','getActions','findOne','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','options','count','include','findAll','rows','catch','params','rawAttributes','includeAll','merge','create','body','destroy','find','addConditions','ids','omit'];(function(_0x54fb7a,_0x24dc21){var _0x981a80=function(_0x40324f){while(--_0x40324f){_0x54fb7a['push'](_0x54fb7a['shift']());}};_0x981a80(++_0x24dc21);}(_0x8068,0x15d));var _0x8806=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x8068[_0x333fc8];return _0x432439;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8806('0x0'));var zipdir=require(_0x8806('0x1'));var jsonpatch=require(_0x8806('0x2'));var rp=require(_0x8806('0x3'));var moment=require(_0x8806('0x4'));var BPromise=require(_0x8806('0x5'));var Mustache=require('mustache');var util=require(_0x8806('0x6'));var path=require('path');var sox=require(_0x8806('0x7'));var csv=require(_0x8806('0x8'));var ejs=require(_0x8806('0x9'));var fs=require('fs');var fs_extra=require(_0x8806('0xa'));var _=require(_0x8806('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8806('0xc'));var deskjs=require(_0x8806('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8806('0xe'));var Redis=require(_0x8806('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8806('0x10'));var as=require(_0x8806('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8806('0x12'))(_0x8806('0x13'));var utils=require(_0x8806('0x14'));var config=require(_0x8806('0x15'));var licenseUtil=require(_0x8806('0x16'));var db=require(_0x8806('0x17'))['db'];function respondWithStatusCode(_0x4858f0,_0x40453e){_0x40453e=_0x40453e||0xcc;return function(_0x1c9718){if(_0x1c9718){return _0x4858f0['sendStatus'](_0x40453e);}return _0x4858f0['status'](_0x40453e)[_0x8806('0x18')]();};}function respondWithResult(_0x1e56f2,_0x467360){_0x467360=_0x467360||0xc8;return function(_0x4171d1){if(_0x4171d1){return _0x1e56f2[_0x8806('0x19')](_0x467360)[_0x8806('0x1a')](_0x4171d1);}};}function respondWithFilteredResult(_0x1dbcc6,_0x53601e){return function(_0x139b81){if(_0x139b81){var _0x4ff617=typeof _0x53601e[_0x8806('0x1b')]===_0x8806('0x1c')&&typeof _0x53601e[_0x8806('0x1d')]===_0x8806('0x1c');var _0x47c869=_0x139b81['count'];var _0x5355ea=_0x4ff617?0x0:_0x53601e[_0x8806('0x1b')];var _0x50e741=_0x4ff617?_0x139b81['count']:_0x53601e[_0x8806('0x1b')]+_0x53601e['limit'];var _0x4f337d;if(_0x50e741>=_0x47c869){_0x50e741=_0x47c869;_0x4f337d=0xc8;}else{_0x4f337d=0xce;}_0x1dbcc6[_0x8806('0x19')](_0x4f337d);return _0x1dbcc6['set'](_0x8806('0x1e'),_0x5355ea+'-'+_0x50e741+'/'+_0x47c869)[_0x8806('0x1a')](_0x139b81);}return null;};}function patchUpdates(_0x4baca6){return function(_0x4db274){try{jsonpatch[_0x8806('0x1f')](_0x4db274,_0x4baca6,!![]);}catch(_0x3afeea){return BPromise[_0x8806('0x20')](_0x3afeea);}return _0x4db274[_0x8806('0x21')]();};}function saveUpdates(_0x3087c2,_0x734e44){return function(_0x19c3bd){if(_0x19c3bd){return _0x19c3bd[_0x8806('0x22')](_0x3087c2)[_0x8806('0x23')](function(_0x292534){return _0x292534;});}return null;};}function removeEntity(_0xe736dd,_0x38031b){return function(_0x5e7c72){if(_0x5e7c72){return _0x5e7c72['destroy']()[_0x8806('0x23')](function(){_0xe736dd[_0x8806('0x19')](0xcc)[_0x8806('0x18')]();});}};}function handleEntityNotFound(_0x13f220,_0x58709c){return function(_0x24abfa){if(!_0x24abfa){_0x13f220[_0x8806('0x24')](0x194);}return _0x24abfa;};}function handleError(_0x134eb6,_0x2dddfb){_0x2dddfb=_0x2dddfb||0x1f4;return function(_0x4b459c){logger['error'](_0x4b459c[_0x8806('0x25')]);if(_0x4b459c['name']){delete _0x4b459c[_0x8806('0x26')];}_0x134eb6[_0x8806('0x19')](_0x2dddfb)[_0x8806('0x27')](_0x4b459c);};}exports[_0x8806('0x28')]=function(_0x570f3b,_0x177268){var _0x4786c8={},_0x4e06b6={},_0x115cf4={'count':0x0,'rows':[]};var _0x8210c=_[_0x8806('0x29')](db[_0x8806('0x2a')]['rawAttributes'],function(_0x126f00){return{'name':_0x126f00[_0x8806('0x2b')],'type':_0x126f00[_0x8806('0x2c')][_0x8806('0x2d')]};});_0x4e06b6[_0x8806('0x2e')]=_[_0x8806('0x29')](_0x8210c,_0x8806('0x26'));_0x4e06b6[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x570f3b['query']);_0x4e06b6[_0x8806('0x31')]=_[_0x8806('0x32')](_0x4e06b6[_0x8806('0x2e')],_0x4e06b6['query']);_0x4786c8[_0x8806('0x33')]=_[_0x8806('0x32')](_0x4e06b6[_0x8806('0x2e')],qs[_0x8806('0x34')](_0x570f3b[_0x8806('0x2f')][_0x8806('0x34')]));_0x4786c8[_0x8806('0x33')]=_0x4786c8[_0x8806('0x33')][_0x8806('0x35')]?_0x4786c8[_0x8806('0x33')]:_0x4e06b6[_0x8806('0x2e')];if(!_0x570f3b['query']['hasOwnProperty'](_0x8806('0x36'))){_0x4786c8[_0x8806('0x1d')]=qs['limit'](_0x570f3b[_0x8806('0x2f')]['limit']);_0x4786c8[_0x8806('0x1b')]=qs[_0x8806('0x1b')](_0x570f3b['query']['offset']);}_0x4786c8['order']=qs[_0x8806('0x37')](_0x570f3b['query'][_0x8806('0x37')]);_0x4786c8[_0x8806('0x38')]=qs[_0x8806('0x31')](_['pick'](_0x570f3b[_0x8806('0x2f')],_0x4e06b6['filters']),_0x8210c);if(_0x570f3b['query'][_0x8806('0x39')]){_0x4786c8[_0x8806('0x38')]=_['merge'](_0x4786c8[_0x8806('0x38')],{'$or':_[_0x8806('0x29')](_0x8210c,function(_0x42acf8){if(_0x42acf8[_0x8806('0x2c')]!==_0x8806('0x3a')){var _0x4f0d33={};_0x4f0d33[_0x42acf8[_0x8806('0x26')]]={'$like':'%'+_0x570f3b[_0x8806('0x2f')][_0x8806('0x39')]+'%'};return _0x4f0d33;}})});}_0x4786c8=_['merge']({},_0x4786c8,_0x570f3b[_0x8806('0x3b')]);var _0x5d3ac7={'where':_0x4786c8['where']};return db['Automation'][_0x8806('0x3c')](_0x5d3ac7)[_0x8806('0x23')](function(_0x453419){_0x115cf4[_0x8806('0x3c')]=_0x453419;if(_0x570f3b[_0x8806('0x2f')]['includeAll']){_0x4786c8[_0x8806('0x3d')]=[{'all':!![]}];}return db[_0x8806('0x2a')][_0x8806('0x3e')](_0x4786c8);})[_0x8806('0x23')](function(_0x19f8a0){_0x115cf4[_0x8806('0x3f')]=_0x19f8a0;return _0x115cf4;})['then'](respondWithFilteredResult(_0x177268,_0x4786c8))[_0x8806('0x40')](handleError(_0x177268,null));};exports['show']=function(_0x188a37,_0x95b785){var _0x3eea2f={'raw':![],'where':{'id':_0x188a37[_0x8806('0x41')]['id']}},_0x160f95={};_0x160f95[_0x8806('0x2e')]=_[_0x8806('0x30')](db[_0x8806('0x2a')][_0x8806('0x42')]);_0x160f95[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x188a37[_0x8806('0x2f')]);_0x160f95['filters']=_[_0x8806('0x32')](_0x160f95[_0x8806('0x2e')],_0x160f95['query']);_0x3eea2f['attributes']=_[_0x8806('0x32')](_0x160f95[_0x8806('0x2e')],qs['fields'](_0x188a37['query'][_0x8806('0x34')]));_0x3eea2f[_0x8806('0x33')]=_0x3eea2f[_0x8806('0x33')]['length']?_0x3eea2f[_0x8806('0x33')]:_0x160f95[_0x8806('0x2e')];if(_0x188a37[_0x8806('0x2f')][_0x8806('0x43')]){_0x3eea2f[_0x8806('0x3d')]=[{'all':!![]}];}_0x3eea2f=_[_0x8806('0x44')]({},_0x3eea2f,_0x188a37[_0x8806('0x3b')]);return db[_0x8806('0x2a')]['find'](_0x3eea2f)[_0x8806('0x23')](handleEntityNotFound(_0x95b785,null))[_0x8806('0x23')](respondWithResult(_0x95b785,null))['catch'](handleError(_0x95b785,null));};exports[_0x8806('0x45')]=function(_0x2c27de,_0x3bf095){return db[_0x8806('0x2a')][_0x8806('0x45')](_0x2c27de[_0x8806('0x46')],{})[_0x8806('0x23')](respondWithResult(_0x3bf095,0xc9))[_0x8806('0x40')](handleError(_0x3bf095,null));};exports[_0x8806('0x22')]=function(_0x4237cb,_0x334fac){if(_0x4237cb[_0x8806('0x46')]['id']){delete _0x4237cb[_0x8806('0x46')]['id'];}return db[_0x8806('0x2a')]['find']({'where':{'id':_0x4237cb[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x334fac,null))[_0x8806('0x23')](saveUpdates(_0x4237cb[_0x8806('0x46')],null))[_0x8806('0x23')](respondWithResult(_0x334fac,null))[_0x8806('0x40')](handleError(_0x334fac,null));};exports[_0x8806('0x47')]=function(_0x571090,_0x423f67){return db['Automation'][_0x8806('0x48')]({'where':{'id':_0x571090[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x423f67,null))[_0x8806('0x23')](removeEntity(_0x423f67,null))['catch'](handleError(_0x423f67,null));};exports[_0x8806('0x49')]=function(_0x195074,_0x3ba4f4,_0x48705a){return db['Condition'][_0x8806('0x48')]({'where':{'id':_0x195074[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x3ba4f4,null))['then'](function(_0xe1b1f5){if(_0xe1b1f5){return _0xe1b1f5[_0x8806('0x49')](_0x195074['body'][_0x8806('0x4a')],_[_0x8806('0x4b')](_0x195074['body'],[_0x8806('0x4a'),'id'])||{});}})[_0x8806('0x23')](respondWithResult(_0x3ba4f4,null))[_0x8806('0x40')](handleError(_0x3ba4f4,null));};exports['getConditions']=function(_0x23b8dd,_0xdb21ac,_0x4148bf){var _0xe9eca2={};var _0x24fea2={};var _0x1cbf08;var _0x211220;return db[_0x8806('0x2a')]['findOne']({'where':{'id':_0x23b8dd[_0x8806('0x41')]['id']}})['then'](handleEntityNotFound(_0xdb21ac,null))[_0x8806('0x23')](function(_0x398836){if(_0x398836){_0x1cbf08=_0x398836;_0x24fea2[_0x8806('0x2e')]=_[_0x8806('0x30')](db[_0x8806('0x4c')][_0x8806('0x42')]);_0x24fea2[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x23b8dd[_0x8806('0x2f')]);_0x24fea2[_0x8806('0x31')]=_['intersection'](_0x24fea2[_0x8806('0x2e')],_0x24fea2[_0x8806('0x2f')]);_0xe9eca2[_0x8806('0x33')]=_[_0x8806('0x32')](_0x24fea2[_0x8806('0x2e')],qs[_0x8806('0x34')](_0x23b8dd['query'][_0x8806('0x34')]));_0xe9eca2[_0x8806('0x33')]=_0xe9eca2[_0x8806('0x33')]['length']?_0xe9eca2[_0x8806('0x33')]:_0x24fea2[_0x8806('0x2e')];_0xe9eca2['order']=qs['sort'](_0x23b8dd[_0x8806('0x2f')]['sort']);_0xe9eca2[_0x8806('0x38')]=qs[_0x8806('0x31')](_[_0x8806('0x4d')](_0x23b8dd[_0x8806('0x2f')],_0x24fea2[_0x8806('0x31')]));if(_0x23b8dd[_0x8806('0x2f')]['filter']){_0xe9eca2[_0x8806('0x38')]=_[_0x8806('0x44')](_0xe9eca2[_0x8806('0x38')],{'$or':_[_0x8806('0x29')](_0xe9eca2[_0x8806('0x33')],function(_0x3163e3){var _0x4435f6={};_0x4435f6[_0x3163e3]={'$like':'%'+_0x23b8dd[_0x8806('0x2f')][_0x8806('0x39')]+'%'};return _0x4435f6;})});}_0xe9eca2=_[_0x8806('0x44')]({},_0xe9eca2,_0x23b8dd[_0x8806('0x3b')]);return _0x1cbf08[_0x8806('0x4e')](_0xe9eca2);}})[_0x8806('0x23')](function(_0x157aba){if(_0x157aba){_0x211220=_0x157aba[_0x8806('0x35')];if(!_0x23b8dd[_0x8806('0x2f')][_0x8806('0x4f')](_0x8806('0x36'))){_0xe9eca2['limit']=qs[_0x8806('0x1d')](_0x23b8dd[_0x8806('0x2f')][_0x8806('0x1d')]);_0xe9eca2[_0x8806('0x1b')]=qs[_0x8806('0x1b')](_0x23b8dd[_0x8806('0x2f')][_0x8806('0x1b')]);}return _0x1cbf08[_0x8806('0x4e')](_0xe9eca2);}})[_0x8806('0x23')](function(_0x26254b){if(_0x26254b){return _0x26254b?{'count':_0x211220,'rows':_0x26254b}:null;}})[_0x8806('0x23')](respondWithResult(_0xdb21ac,null))[_0x8806('0x40')](handleError(_0xdb21ac,null));};exports[_0x8806('0x50')]=function(_0x51187a,_0x5e306,_0x1a8fc3){return db[_0x8806('0x51')]['find']({'where':{'id':_0x51187a[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x5e306,null))[_0x8806('0x23')](function(_0x5eba2f){if(_0x5eba2f){return _0x5eba2f['addActions'](_0x51187a[_0x8806('0x46')]['ids'],_[_0x8806('0x4b')](_0x51187a[_0x8806('0x46')],[_0x8806('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x5e306,null))[_0x8806('0x40')](handleError(_0x5e306,null));};exports[_0x8806('0x52')]=function(_0x443d2b,_0x5bf539,_0x430d72){var _0x144c9c={};var _0x505f6e={};var _0x11f13f;var _0x45a199;return db[_0x8806('0x2a')][_0x8806('0x53')]({'where':{'id':_0x443d2b[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x5bf539,null))[_0x8806('0x23')](function(_0x2a78ad){if(_0x2a78ad){_0x11f13f=_0x2a78ad;_0x505f6e['model']=_['keys'](db[_0x8806('0x51')][_0x8806('0x42')]);_0x505f6e[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x443d2b[_0x8806('0x2f')]);_0x505f6e[_0x8806('0x31')]=_[_0x8806('0x32')](_0x505f6e[_0x8806('0x2e')],_0x505f6e[_0x8806('0x2f')]);_0x144c9c[_0x8806('0x33')]=_[_0x8806('0x32')](_0x505f6e[_0x8806('0x2e')],qs[_0x8806('0x34')](_0x443d2b[_0x8806('0x2f')][_0x8806('0x34')]));_0x144c9c[_0x8806('0x33')]=_0x144c9c['attributes'][_0x8806('0x35')]?_0x144c9c['attributes']:_0x505f6e['model'];_0x144c9c[_0x8806('0x54')]=qs[_0x8806('0x37')](_0x443d2b['query'][_0x8806('0x37')]);_0x144c9c[_0x8806('0x38')]=qs['filters'](_['pick'](_0x443d2b['query'],_0x505f6e[_0x8806('0x31')]));if(_0x443d2b[_0x8806('0x2f')]['filter']){_0x144c9c[_0x8806('0x38')]=_['merge'](_0x144c9c['where'],{'$or':_[_0x8806('0x29')](_0x144c9c[_0x8806('0x33')],function(_0x465263){var _0x1963e4={};_0x1963e4[_0x465263]={'$like':'%'+_0x443d2b[_0x8806('0x2f')][_0x8806('0x39')]+'%'};return _0x1963e4;})});}_0x144c9c=_[_0x8806('0x44')]({},_0x144c9c,_0x443d2b[_0x8806('0x3b')]);return _0x11f13f['getActions'](_0x144c9c);}})[_0x8806('0x23')](function(_0x73d5dc){if(_0x73d5dc){_0x45a199=_0x73d5dc[_0x8806('0x35')];if(!_0x443d2b[_0x8806('0x2f')]['hasOwnProperty'](_0x8806('0x36'))){_0x144c9c[_0x8806('0x1d')]=qs[_0x8806('0x1d')](_0x443d2b[_0x8806('0x2f')][_0x8806('0x1d')]);_0x144c9c[_0x8806('0x1b')]=qs[_0x8806('0x1b')](_0x443d2b['query']['offset']);}return _0x11f13f['getActions'](_0x144c9c);}})[_0x8806('0x23')](function(_0x445fa1){if(_0x445fa1){return _0x445fa1?{'count':_0x45a199,'rows':_0x445fa1}:null;}})['then'](respondWithResult(_0x5bf539,null))['catch'](handleError(_0x5bf539,null));};
\ No newline at end of file
diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js
index c9c6822..8cbb004 100644
--- a/server/api/automation/automation.model.js
+++ b/server/api/automation/automation.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd7b6=['util','../../config/logger','request-promise','path','../../config/environment','./automation.attributes','exports','define','lodash'];(function(_0x1df9da,_0xd84bc1){var _0x25a0f1=function(_0x716b2c){while(--_0x716b2c){_0x1df9da['push'](_0x1df9da['shift']());}};_0x25a0f1(++_0xd84bc1);}(_0xd7b6,0xc5));var _0x6d7b=function(_0x4effac,_0x2c2237){_0x4effac=_0x4effac-0x0;var _0x3db5f9=_0xd7b6[_0x4effac];return _0x3db5f9;};'use strict';var _=require(_0x6d7b('0x0'));var util=require(_0x6d7b('0x1'));var logger=require(_0x6d7b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6d7b('0x3'));var fs=require('fs');var path=require(_0x6d7b('0x4'));var rimraf=require('rimraf');var config=require(_0x6d7b('0x5'));var attributes=require(_0x6d7b('0x6'));module[_0x6d7b('0x7')]=function(_0x4a2b16,_0x48b46f){return _0x4a2b16[_0x6d7b('0x8')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2b6f=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','Automation','util','../../config/logger'];(function(_0x4a5010,_0x625447){var _0x44f3d5=function(_0xdb2f58){while(--_0xdb2f58){_0x4a5010['push'](_0x4a5010['shift']());}};_0x44f3d5(++_0x625447);}(_0x2b6f,0x94));var _0xf2b6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x2b6f[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0xf2b6('0x0'));var logger=require(_0xf2b6('0x1'))(_0xf2b6('0x2'));var moment=require('moment');var BPromise=require(_0xf2b6('0x3'));var rp=require(_0xf2b6('0x4'));var fs=require('fs');var path=require(_0xf2b6('0x5'));var rimraf=require(_0xf2b6('0x6'));var config=require(_0xf2b6('0x7'));var attributes=require('./automation.attributes');module['exports']=function(_0x5b7b71,_0x1f2372){return _0x5b7b71[_0xf2b6('0x8')](_0xf2b6('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js
index a0ecbbb..5bd07e7 100644
--- a/server/api/automation/automation.rpc.js
+++ b/server/api/automation/automation.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x1410=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1410,0x130));var _0x0141=function(_0x572736,_0x1690c7){_0x572736=_0x572736-0x0;var _0x9912bd=_0x1410[_0x572736];return _0x9912bd;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0141('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0141('0x5'));var logger=require('../../config/logger')(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f701,_0x22b566,_0x25511f){return new BPromise(function(_0x2d8f15,_0x57cfbb){return client[_0x0141('0xb')](_0x24f701,_0x25511f)[_0x0141('0xc')](function(_0x2b4f13){logger[_0x0141('0xd')](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));logger[_0x0141('0x10')](_0x0141('0x11'),_0x22b566,'request\x20sent',JSON[_0x0141('0x12')](_0x2b4f13));if(_0x2b4f13[_0x0141('0x13')]){if(_0x2b4f13[_0x0141('0x13')][_0x0141('0x14')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x57cfbb(_0x2b4f13['error'][_0x0141('0x15')]);}logger[_0x0141('0x13')](_0x0141('0xe'),_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x2d8f15(_0x2b4f13['error'][_0x0141('0x15')]);}else{logger['info'](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));_0x2d8f15(_0x2b4f13[_0x0141('0x16')][_0x0141('0x15')]);}})[_0x0141('0x17')](function(_0x3c91e8){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x3c91e8);_0x57cfbb(_0x3c91e8);});});}
\ No newline at end of file
+var _0x0570=['request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x0570,0x172));var _0x0057=function(_0x5472cc,_0x35ef9c){_0x5472cc=_0x5472cc-0x0;var _0x4255cf=_0x0570[_0x5472cc];return _0x4255cf;};'use strict';var _=require('lodash');var util=require(_0x0057('0x0'));var moment=require(_0x0057('0x1'));var BPromise=require(_0x0057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0057('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0057('0x4'));var logger=require('../../config/logger')(_0x0057('0x5'));var config=require(_0x0057('0x6'));var jayson=require(_0x0057('0x7'));var client=jayson[_0x0057('0x8')][_0x0057('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5096e2,_0xc86734,_0x529f55){return new BPromise(function(_0x15d424,_0x2f9d7f){return client[_0x0057('0xa')](_0x5096e2,_0x529f55)[_0x0057('0xb')](function(_0x29b7c6){logger['info'](_0x0057('0xc'),_0xc86734,_0x0057('0xd'));logger[_0x0057('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'),JSON[_0x0057('0xf')](_0x29b7c6));if(_0x29b7c6['error']){if(_0x29b7c6['error'][_0x0057('0x10')]===0x1f4){logger[_0x0057('0x11')](_0x0057('0xc'),_0xc86734,_0x29b7c6['error'][_0x0057('0x12')]);return _0x2f9d7f(_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);}logger[_0x0057('0x11')]('Automation,\x20%s,\x20%s',_0xc86734,_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);return _0x15d424(_0x29b7c6['error'][_0x0057('0x12')]);}else{logger[_0x0057('0x13')]('Automation,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'));_0x15d424(_0x29b7c6['result'][_0x0057('0x12')]);}})['catch'](function(_0x4be851){logger[_0x0057('0x11')]('Automation,\x20%s,\x20%s',_0xc86734,_0x4be851);_0x2f9d7f(_0x4be851);});});}
\ No newline at end of file
diff --git a/server/api/automation/index.js b/server/api/automation/index.js
index 530a475..583c419 100644
--- a/server/api/automation/index.js
+++ b/server/api/automation/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x0fc2=['get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','post','create','addConditions','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller'];(function(_0x3c9e88,_0x3992e0){var _0x374fc1=function(_0x28bdc0){while(--_0x28bdc0){_0x3c9e88['push'](_0x3c9e88['shift']());}};_0x374fc1(++_0x3992e0);}(_0x0fc2,0x6e));var _0x20fc=function(_0x45fa5a,_0xcfb5bf){_0x45fa5a=_0x45fa5a-0x0;var _0x26cb6e=_0x0fc2[_0x45fa5a];return _0x26cb6e;};'use strict';var multer=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var path=require(_0x20fc('0x2'));var timeout=require(_0x20fc('0x3'));var express=require('express');var router=express[_0x20fc('0x4')]();var fs_extra=require(_0x20fc('0x5'));var auth=require(_0x20fc('0x6'));var interaction=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var controller=require(_0x20fc('0x9'));router[_0x20fc('0xa')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0xc')]);router[_0x20fc('0xa')](_0x20fc('0xd'),auth[_0x20fc('0xb')](),controller[_0x20fc('0xe')]);router[_0x20fc('0xa')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller['getConditions']);router[_0x20fc('0xa')](_0x20fc('0x10'),auth[_0x20fc('0xb')](),controller['getActions']);router[_0x20fc('0x11')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0x12')]);router[_0x20fc('0x11')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller[_0x20fc('0x13')]);router[_0x20fc('0x11')]('/:id/actions',auth[_0x20fc('0xb')](),controller['addActions']);router[_0x20fc('0x14')]('/:id',auth[_0x20fc('0xb')](),controller['update']);router[_0x20fc('0x15')](_0x20fc('0xd'),auth[_0x20fc('0xb')](),controller[_0x20fc('0x16')]);module[_0x20fc('0x17')]=router;
\ No newline at end of file
+var _0x16e4=['Router','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getActions','post','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x59190d,_0x1fe75c){var _0x3f28c3=function(_0x3069d1){while(--_0x3069d1){_0x59190d['push'](_0x59190d['shift']());}};_0x3f28c3(++_0x1fe75c);}(_0x16e4,0x97));var _0x416e=function(_0x576596,_0x1e85e3){_0x576596=_0x576596-0x0;var _0x5cd85a=_0x16e4[_0x576596];return _0x5cd85a;};'use strict';var multer=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var path=require(_0x416e('0x2'));var timeout=require(_0x416e('0x3'));var express=require(_0x416e('0x4'));var router=express[_0x416e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x416e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x416e('0x7'));var controller=require(_0x416e('0x8'));router['get']('/',auth[_0x416e('0x9')](),controller[_0x416e('0xa')]);router[_0x416e('0xb')](_0x416e('0xc'),auth[_0x416e('0x9')](),controller[_0x416e('0xd')]);router[_0x416e('0xb')](_0x416e('0xe'),auth[_0x416e('0x9')](),controller['getConditions']);router[_0x416e('0xb')]('/:id/actions',auth[_0x416e('0x9')](),controller[_0x416e('0xf')]);router[_0x416e('0x10')]('/',auth['isAuthenticated'](),controller[_0x416e('0x11')]);router[_0x416e('0x10')](_0x416e('0xe'),auth['isAuthenticated'](),controller[_0x416e('0x12')]);router['post'](_0x416e('0x13'),auth[_0x416e('0x9')](),controller[_0x416e('0x14')]);router[_0x416e('0x15')]('/:id',auth[_0x416e('0x9')](),controller[_0x416e('0x16')]);router[_0x416e('0x17')](_0x416e('0xc'),auth[_0x416e('0x9')](),controller[_0x416e('0x18')]);module[_0x416e('0x19')]=router;
\ No newline at end of file
diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js
index a001d57..f3f5c7f 100644
--- a/server/api/campaign/campaign.attributes.js
+++ b/server/api/campaign/campaign.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x0c01=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x0c01,0x10f));var _0x10c0=function(_0x233a82,_0x268519){_0x233a82=_0x233a82-0x0;var _0x4bfb74=_0x0c01[_0x233a82];return _0x4bfb74;};'use strict';var Sequelize=require(_0x10c0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x10c0('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x10c0('0x2')},'description':{'type':Sequelize[_0x10c0('0x3')]},'active':{'type':Sequelize[_0x10c0('0x4')],'defaultValue':0x0,'comment':_0x10c0('0x5')},'limitCalls':{'type':Sequelize[_0x10c0('0x6')](0x4)[_0x10c0('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x10c0('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x10c0('0x3')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x10c0('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'comment':_0x10c0('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x10c0('0xe')},'dialTimezone':{'type':Sequelize[_0x10c0('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x10c0('0x3')],'defaultValue':_0x10c0('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x10c0('0x10'),'never',_0x10c0('0x11')),'defaultValue':_0x10c0('0x10')},'dialAMDActive':{'type':Sequelize[_0x10c0('0x4')],'defaultValue':0x0,'comment':_0x10c0('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x10c0('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x10c0('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x10c0('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x10c0('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x10c0('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x10c0('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x10c0('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x10c0('0x1a'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x10c0('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x10c0('0x1b')},'dialCutDigit':{'type':Sequelize[_0x10c0('0x6')](0x3)[_0x10c0('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x10c0('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x25')}};
\ No newline at end of file
+var _0x99e7=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x534216,_0x3789b4){var _0x3731ce=function(_0x44c6d1){while(--_0x44c6d1){_0x534216['push'](_0x534216['shift']());}};_0x3731ce(++_0x3789b4);}(_0x99e7,0x1b5));var _0x799e=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0x99e7[_0x2bb3f6];return _0x62b339;};'use strict';var Sequelize=require(_0x799e('0x0'));module[_0x799e('0x1')]={'name':{'type':Sequelize[_0x799e('0x2')],'unique':_0x799e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x799e('0x4')](_0x799e('0x5')),'allowNull':![],'defaultValue':_0x799e('0x5')},'description':{'type':Sequelize[_0x799e('0x2')]},'active':{'type':Sequelize[_0x799e('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x799e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x799e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'comment':_0x799e('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x799e('0xf')},'dialTimezone':{'type':Sequelize[_0x799e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x799e('0x2')],'defaultValue':_0x799e('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x799e('0x4')](_0x799e('0x11'),'never','onlyIfOpen'),'defaultValue':_0x799e('0x11')},'dialAMDActive':{'type':Sequelize[_0x799e('0x6')],'defaultValue':0x0,'comment':_0x799e('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x799e('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x799e('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x799e('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x799e('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x799e('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x799e('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x799e('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x799e('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x799e('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x799e('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x799e('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x799e('0x1b'),_0x799e('0x1c')),'defaultValue':_0x799e('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x799e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x799e('0x1d')},'dialCutDigit':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x799e('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x28')}};
\ No newline at end of file
diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js
index fa1fc3d..9c00954 100644
--- a/server/api/campaign/campaign.controller.js
+++ b/server/api/campaign/campaign.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x1b0a=['Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','params','omit','createdAt','updatedAt','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','hasOwnProperty','pick','CmHopper','getHopperHistories','CmHopperHistory','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','scheduledAt','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','CampaignId\x20=\x20?','push','sequelize','all','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','stack','name','send','map','Campaign','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','body','user'];(function(_0x4a5d24,_0x13effb){var _0x47faf2=function(_0x1ab18c){while(--_0x1ab18c){_0x4a5d24['push'](_0x4a5d24['shift']());}};_0x47faf2(++_0x13effb);}(_0x1b0a,0x14b));var _0xa1b0=function(_0x1062d6,_0x300e87){_0x1062d6=_0x1062d6-0x0;var _0x234793=_0x1b0a[_0x1062d6];return _0x234793;};'use strict';var emlformat=require(_0xa1b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1b0('0x2'));var moment=require(_0xa1b0('0x3'));var BPromise=require(_0xa1b0('0x4'));var Mustache=require(_0xa1b0('0x5'));var util=require(_0xa1b0('0x6'));var path=require(_0xa1b0('0x7'));var sox=require(_0xa1b0('0x8'));var csv=require(_0xa1b0('0x9'));var ejs=require(_0xa1b0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa1b0('0xb'));var crypto=require(_0xa1b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa1b0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa1b0('0xe'));var Papa=require(_0xa1b0('0xf'));var Redis=require(_0xa1b0('0x10'));var authService=require(_0xa1b0('0x11'));var qs=require(_0xa1b0('0x12'));var as=require(_0xa1b0('0x13'));var hardwareService=require(_0xa1b0('0x14'));var logger=require(_0xa1b0('0x15'))(_0xa1b0('0x16'));var utils=require(_0xa1b0('0x17'));var config=require(_0xa1b0('0x18'));var licenseUtil=require(_0xa1b0('0x19'));var db=require(_0xa1b0('0x1a'))['db'];function respondWithStatusCode(_0x358705,_0x3b687b){_0x3b687b=_0x3b687b||0xcc;return function(_0x4b70fd){if(_0x4b70fd){return _0x358705[_0xa1b0('0x1b')](_0x3b687b);}return _0x358705[_0xa1b0('0x1c')](_0x3b687b)['end']();};}function respondWithResult(_0xea9a15,_0x2d1dcc){_0x2d1dcc=_0x2d1dcc||0xc8;return function(_0x4d3526){if(_0x4d3526){return _0xea9a15[_0xa1b0('0x1c')](_0x2d1dcc)[_0xa1b0('0x1d')](_0x4d3526);}};}function respondWithFilteredResult(_0x431a2e,_0x495960){return function(_0x27e5e3){if(_0x27e5e3){var _0x57a62a=typeof _0x495960[_0xa1b0('0x1e')]===_0xa1b0('0x1f')&&typeof _0x495960[_0xa1b0('0x20')]===_0xa1b0('0x1f');var _0x10c84c=_0x27e5e3[_0xa1b0('0x21')];var _0x1490d2=_0x57a62a?0x0:_0x495960[_0xa1b0('0x1e')];var _0x322368=_0x57a62a?_0x27e5e3['count']:_0x495960[_0xa1b0('0x1e')]+_0x495960[_0xa1b0('0x20')];var _0x594505;if(_0x322368>=_0x10c84c){_0x322368=_0x10c84c;_0x594505=0xc8;}else{_0x594505=0xce;}_0x431a2e[_0xa1b0('0x1c')](_0x594505);return _0x431a2e['set'](_0xa1b0('0x22'),_0x1490d2+'-'+_0x322368+'/'+_0x10c84c)['json'](_0x27e5e3);}return null;};}function patchUpdates(_0x4fe262){return function(_0x3ff8b0){try{jsonpatch['apply'](_0x3ff8b0,_0x4fe262,!![]);}catch(_0x361469){return BPromise[_0xa1b0('0x23')](_0x361469);}return _0x3ff8b0['save']();};}function saveUpdates(_0x10614f,_0x3b54d2){return function(_0x5bf006){if(_0x5bf006){return _0x5bf006[_0xa1b0('0x24')](_0x10614f)[_0xa1b0('0x25')](function(_0x329a1e){return _0x329a1e;});}return null;};}function removeEntity(_0x31dc36,_0xe39d60){return function(_0x258108){if(_0x258108){return _0x258108[_0xa1b0('0x26')]()[_0xa1b0('0x25')](function(){var _0x28297f=_0x258108[_0xa1b0('0x27')]({'plain':!![]});var _0x4e7b5e=_0xa1b0('0x28');return db[_0xa1b0('0x29')][_0xa1b0('0x26')]({'where':{'type':_0x4e7b5e,'resourceId':_0x28297f['id']}})[_0xa1b0('0x25')](function(){return _0x258108;});})[_0xa1b0('0x25')](function(){_0x31dc36[_0xa1b0('0x1c')](0xcc)[_0xa1b0('0x2a')]();});}};}function handleEntityNotFound(_0x1dc969,_0x36f3de){return function(_0x1bbca7){if(!_0x1bbca7){_0x1dc969[_0xa1b0('0x1b')](0x194);}return _0x1bbca7;};}function handleError(_0x3417a0,_0x4ecae6){_0x4ecae6=_0x4ecae6||0x1f4;return function(_0x1f925d){logger[_0xa1b0('0x2b')](_0x1f925d[_0xa1b0('0x2c')]);if(_0x1f925d[_0xa1b0('0x2d')]){delete _0x1f925d['name'];}_0x3417a0[_0xa1b0('0x1c')](_0x4ecae6)[_0xa1b0('0x2e')](_0x1f925d);};}exports['index']=function(_0xa554fe,_0x2205bd){var _0x267721={},_0x1a1d7a={},_0x540272={'count':0x0,'rows':[]};var _0x531acc=_[_0xa1b0('0x2f')](db[_0xa1b0('0x30')][_0xa1b0('0x31')],function(_0x22d2ef){return{'name':_0x22d2ef['fieldName'],'type':_0x22d2ef[_0xa1b0('0x32')][_0xa1b0('0x33')]};});_0x1a1d7a[_0xa1b0('0x34')]=_[_0xa1b0('0x2f')](_0x531acc,_0xa1b0('0x2d'));_0x1a1d7a[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0xa554fe['query']);_0x1a1d7a[_0xa1b0('0x37')]=_[_0xa1b0('0x38')](_0x1a1d7a['model'],_0x1a1d7a[_0xa1b0('0x35')]);_0x267721[_0xa1b0('0x39')]=_[_0xa1b0('0x38')](_0x1a1d7a[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x267721['attributes']=_0x267721[_0xa1b0('0x39')]['length']?_0x267721[_0xa1b0('0x39')]:_0x1a1d7a['model'];if(!_0xa554fe[_0xa1b0('0x35')]['hasOwnProperty'](_0xa1b0('0x3b'))){_0x267721[_0xa1b0('0x20')]=qs['limit'](_0xa554fe[_0xa1b0('0x35')]['limit']);_0x267721[_0xa1b0('0x1e')]=qs[_0xa1b0('0x1e')](_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x267721[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0xa554fe[_0xa1b0('0x35')]['sort']);_0x267721['where']=qs[_0xa1b0('0x37')](_['pick'](_0xa554fe[_0xa1b0('0x35')],_0x1a1d7a[_0xa1b0('0x37')]),_0x531acc);if(_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x267721[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0x267721[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0x531acc,function(_0x288312){if(_0x288312[_0xa1b0('0x32')]!==_0xa1b0('0x41')){var _0x18f2b1={};_0x18f2b1[_0x288312[_0xa1b0('0x2d')]]={'$like':'%'+_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x3e')]+'%'};return _0x18f2b1;}})});}_0x267721=_[_0xa1b0('0x40')]({},_0x267721,_0xa554fe[_0xa1b0('0x42')]);var _0x51bd11={'where':_0x267721[_0xa1b0('0x3f')]};return db['Campaign'][_0xa1b0('0x21')](_0x51bd11)[_0xa1b0('0x25')](function(_0x277b1d){_0x540272['count']=_0x277b1d;if(_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x267721[_0xa1b0('0x44')]=[{'all':!![]}];}return db[_0xa1b0('0x30')][_0xa1b0('0x45')](_0x267721);})[_0xa1b0('0x25')](function(_0x41884a){_0x540272[_0xa1b0('0x46')]=_0x41884a;return _0x540272;})[_0xa1b0('0x25')](respondWithFilteredResult(_0x2205bd,_0x267721))[_0xa1b0('0x47')](handleError(_0x2205bd,null));};exports[_0xa1b0('0x48')]=function(_0x52dc52,_0x47f20c){var _0x38bc73={'raw':![],'where':{'id':_0x52dc52['params']['id']}},_0xb4c8d7={};_0xb4c8d7[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db[_0xa1b0('0x30')][_0xa1b0('0x31')]);_0xb4c8d7['query']=_[_0xa1b0('0x36')](_0x52dc52[_0xa1b0('0x35')]);_0xb4c8d7['filters']=_[_0xa1b0('0x38')](_0xb4c8d7[_0xa1b0('0x34')],_0xb4c8d7[_0xa1b0('0x35')]);_0x38bc73[_0xa1b0('0x39')]=_[_0xa1b0('0x38')](_0xb4c8d7[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0x52dc52['query'][_0xa1b0('0x3a')]));_0x38bc73['attributes']=_0x38bc73['attributes'][_0xa1b0('0x49')]?_0x38bc73[_0xa1b0('0x39')]:_0xb4c8d7[_0xa1b0('0x34')];if(_0x52dc52[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x38bc73[_0xa1b0('0x44')]=[{'all':!![]}];}_0x38bc73=_['merge']({},_0x38bc73,_0x52dc52['options']);return db[_0xa1b0('0x30')]['find'](_0x38bc73)[_0xa1b0('0x25')](handleEntityNotFound(_0x47f20c,null))[_0xa1b0('0x25')](respondWithResult(_0x47f20c,null))[_0xa1b0('0x47')](handleError(_0x47f20c,null));};exports['create']=function(_0x2be27f,_0x5e4594){return db['Campaign'][_0xa1b0('0x4a')](_0x2be27f[_0xa1b0('0x4b')],{})[_0xa1b0('0x25')](function(_0x10a478){var _0x51987d=_0x2be27f[_0xa1b0('0x4c')][_0xa1b0('0x27')]({'plain':!![]});if(!_0x51987d)throw new Error(_0xa1b0('0x4d'));if(_0x51987d['role']===_0xa1b0('0x4c')){var _0x296831=_0x10a478[_0xa1b0('0x27')]({'plain':!![]});var _0x38aac0=_0xa1b0('0x28');return db['UserProfileSection'][_0xa1b0('0x4e')]({'where':{'name':_0x38aac0,'userProfileId':_0x51987d[_0xa1b0('0x4f')]},'raw':!![]})[_0xa1b0('0x25')](function(_0x1d54a1){if(_0x1d54a1&&_0x1d54a1[_0xa1b0('0x50')]===0x0){return db[_0xa1b0('0x29')][_0xa1b0('0x4a')]({'name':_0x296831[_0xa1b0('0x2d')],'resourceId':_0x296831['id'],'type':_0x1d54a1[_0xa1b0('0x2d')],'sectionId':_0x1d54a1['id']},{})['then'](function(){return _0x10a478;});}else{return _0x10a478;}})[_0xa1b0('0x47')](function(_0x33df99){logger[_0xa1b0('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33df99);throw _0x33df99;});}return _0x10a478;})[_0xa1b0('0x25')](respondWithResult(_0x5e4594,0xc9))[_0xa1b0('0x47')](handleError(_0x5e4594,null));};exports['clone']=function(_0x580d9a,_0x3122a8){var _0x275692={'where':{'id':_0x580d9a[_0xa1b0('0x51')]['id']}},_0x2b9aa1={};_0x2b9aa1[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db[_0xa1b0('0x30')]['rawAttributes']);_0x275692[_0xa1b0('0x39')]=_[_0xa1b0('0x38')](_0x2b9aa1['model'],qs[_0xa1b0('0x3a')](_0x580d9a[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x275692[_0xa1b0('0x39')]=_0x275692[_0xa1b0('0x39')]['length']?_0x275692['attributes']:_0x2b9aa1['model'];if(_0x580d9a[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x275692['include']=[{'all':!![]}];}_0x275692=_[_0xa1b0('0x40')]({},_0x275692,_0x580d9a['options']);return db[_0xa1b0('0x30')][_0xa1b0('0x4e')](_0x275692)[_0xa1b0('0x25')](handleEntityNotFound(_0x3122a8,null))[_0xa1b0('0x25')](function(_0x46a837){if(_0x46a837){var _0x1a7a12=_0x46a837[_0xa1b0('0x27')]({'plain':!![]});_0x1a7a12=qs[_0xa1b0('0x52')](_0x1a7a12,['id',_0xa1b0('0x53'),_0xa1b0('0x54')]);_0x580d9a[_0xa1b0('0x4b')]=_[_0xa1b0('0x52')](_0x580d9a['body'],['id',_0xa1b0('0x53'),_0xa1b0('0x54')]);return db[_0xa1b0('0x30')][_0xa1b0('0x4a')](_['merge'](_0x1a7a12,_0x580d9a['body']),{'include':_0x580d9a[_0xa1b0('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2f583a){var _0x271228=_0x580d9a[_0xa1b0('0x4c')][_0xa1b0('0x27')]({'plain':!![]});if(!_0x271228)throw new Error(_0xa1b0('0x4d'));if(_0x271228[_0xa1b0('0x55')]===_0xa1b0('0x4c')){var _0x3eafdd=_0x2f583a[_0xa1b0('0x27')]({'plain':!![]});var _0x5b6b2b='IvrCampaigns';return db[_0xa1b0('0x56')][_0xa1b0('0x4e')]({'where':{'name':_0x5b6b2b,'userProfileId':_0x271228[_0xa1b0('0x4f')]},'raw':!![]})['then'](function(_0x41f687){if(_0x41f687&&_0x41f687[_0xa1b0('0x50')]===0x0){return db[_0xa1b0('0x29')][_0xa1b0('0x4a')]({'name':_0x3eafdd[_0xa1b0('0x2d')],'resourceId':_0x3eafdd['id'],'type':_0x41f687[_0xa1b0('0x2d')],'sectionId':_0x41f687['id']},{})[_0xa1b0('0x25')](function(){return _0x2f583a;});}else{return _0x2f583a;}})[_0xa1b0('0x47')](function(_0x5db82c){logger[_0xa1b0('0x2b')](_0xa1b0('0x57'),_0x5db82c);throw _0x5db82c;});}return _0x2f583a;});}})[_0xa1b0('0x25')](respondWithResult(_0x3122a8,0xc9))[_0xa1b0('0x47')](handleError(_0x3122a8,null));};exports[_0xa1b0('0x24')]=function(_0x29bfc2,_0x4388d8){if(_0x29bfc2[_0xa1b0('0x4b')]['id']){delete _0x29bfc2[_0xa1b0('0x4b')]['id'];}return db[_0xa1b0('0x30')][_0xa1b0('0x4e')]({'where':{'id':_0x29bfc2['params']['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x4388d8,null))[_0xa1b0('0x25')](saveUpdates(_0x29bfc2[_0xa1b0('0x4b')],null))['then'](respondWithResult(_0x4388d8,null))[_0xa1b0('0x47')](handleError(_0x4388d8,null));};exports[_0xa1b0('0x26')]=function(_0x45ef33,_0x2f54cc){return db[_0xa1b0('0x30')][_0xa1b0('0x4e')]({'where':{'id':_0x45ef33[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x2f54cc,null))[_0xa1b0('0x25')](removeEntity(_0x2f54cc,null))['catch'](handleError(_0x2f54cc,null));};exports[_0xa1b0('0x58')]=function(_0x6f5ca5,_0x5a0896,_0x47d605){var _0x5dc3b2={'raw':!![],'where':{}};var _0x176b9a={};var _0x592405={'count':0x0,'rows':[]};return db['Campaign'][_0xa1b0('0x59')]({'where':{'id':_0x6f5ca5[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x5a0896,null))[_0xa1b0('0x25')](function(_0x26b035){if(_0x26b035){_0x176b9a[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db['CmHopper']['rawAttributes']);_0x176b9a[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0x6f5ca5[_0xa1b0('0x35')]);_0x176b9a['filters']=_['intersection'](_0x176b9a['model'],_0x176b9a[_0xa1b0('0x35')]);_0x5dc3b2['attributes']=_['intersection'](_0x176b9a[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0x6f5ca5[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x5dc3b2[_0xa1b0('0x39')]=_0x5dc3b2[_0xa1b0('0x39')][_0xa1b0('0x49')]?_0x5dc3b2[_0xa1b0('0x39')]:_0x176b9a['model'];if(!_0x6f5ca5[_0xa1b0('0x35')][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0x5dc3b2[_0xa1b0('0x20')]=qs[_0xa1b0('0x20')](_0x6f5ca5[_0xa1b0('0x35')]['limit']);_0x5dc3b2[_0xa1b0('0x1e')]=qs[_0xa1b0('0x1e')](_0x6f5ca5[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x5dc3b2[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x6f5ca5[_0xa1b0('0x35')]['sort']);_0x5dc3b2[_0xa1b0('0x3f')]=qs[_0xa1b0('0x37')](_[_0xa1b0('0x5b')](_0x6f5ca5[_0xa1b0('0x35')],_0x176b9a['filters']));_0x5dc3b2[_0xa1b0('0x3f')]['CampaignId']=_0x26b035['id'];if(_0x6f5ca5[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x5dc3b2[_0xa1b0('0x3f')]=_['merge'](_0x5dc3b2[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0x5dc3b2[_0xa1b0('0x39')],function(_0x463ef){var _0x514f0c={};_0x514f0c[_0x463ef]={'$like':'%'+_0x6f5ca5['query'][_0xa1b0('0x3e')]+'%'};return _0x514f0c;})});}_0x5dc3b2=_[_0xa1b0('0x40')]({},_0x5dc3b2,_0x6f5ca5[_0xa1b0('0x42')]);return db['CmHopper'][_0xa1b0('0x21')]({'where':_0x5dc3b2[_0xa1b0('0x3f')]})['then'](function(_0x1b081f){_0x592405['count']=_0x1b081f;if(_0x6f5ca5[_0xa1b0('0x35')]['includeAll']){_0x5dc3b2['include']=[{'all':!![]}];}return db[_0xa1b0('0x5c')][_0xa1b0('0x45')](_0x5dc3b2);})[_0xa1b0('0x25')](function(_0x3258ee){_0x592405[_0xa1b0('0x46')]=_0x3258ee;return _0x592405;});}})[_0xa1b0('0x25')](respondWithFilteredResult(_0x5a0896,_0x5dc3b2))[_0xa1b0('0x47')](handleError(_0x5a0896,null));};exports[_0xa1b0('0x5d')]=function(_0x4ee7ee,_0x256441,_0x36c5c4){var _0x3b5146={'raw':!![],'where':{}};var _0x303668={};var _0x4698ca={'count':0x0,'rows':[]};return db[_0xa1b0('0x30')][_0xa1b0('0x59')]({'where':{'id':_0x4ee7ee[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x256441,null))[_0xa1b0('0x25')](function(_0x8c3b39){if(_0x8c3b39){_0x303668[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db[_0xa1b0('0x5e')][_0xa1b0('0x31')]);_0x303668[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0x4ee7ee['query']);_0x303668['filters']=_['intersection'](_0x303668[_0xa1b0('0x34')],_0x303668[_0xa1b0('0x35')]);_0x3b5146[_0xa1b0('0x39')]=_[_0xa1b0('0x38')](_0x303668['model'],qs[_0xa1b0('0x3a')](_0x4ee7ee[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x3b5146[_0xa1b0('0x39')]=_0x3b5146['attributes'][_0xa1b0('0x49')]?_0x3b5146[_0xa1b0('0x39')]:_0x303668['model'];if(!_0x4ee7ee[_0xa1b0('0x35')]['hasOwnProperty'](_0xa1b0('0x3b'))){_0x3b5146['limit']=qs[_0xa1b0('0x20')](_0x4ee7ee['query'][_0xa1b0('0x20')]);_0x3b5146['offset']=qs[_0xa1b0('0x1e')](_0x4ee7ee[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x3b5146[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x4ee7ee['query']['sort']);_0x3b5146['where']=qs[_0xa1b0('0x37')](_['pick'](_0x4ee7ee[_0xa1b0('0x35')],_0x303668['filters']));_0x3b5146[_0xa1b0('0x3f')][_0xa1b0('0x5f')]=_0x8c3b39['id'];if(_0x4ee7ee[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x3b5146['where']=_[_0xa1b0('0x40')](_0x3b5146['where'],{'$or':_[_0xa1b0('0x2f')](_0x3b5146['attributes'],function(_0x3502e5){var _0x42eb2b={};_0x42eb2b[_0x3502e5]={'$like':'%'+_0x4ee7ee['query'][_0xa1b0('0x3e')]+'%'};return _0x42eb2b;})});}_0x3b5146=_[_0xa1b0('0x40')]({},_0x3b5146,_0x4ee7ee[_0xa1b0('0x42')]);return db[_0xa1b0('0x5e')][_0xa1b0('0x21')]({'where':_0x3b5146[_0xa1b0('0x3f')]})[_0xa1b0('0x25')](function(_0x14b199){_0x4698ca[_0xa1b0('0x21')]=_0x14b199;if(_0x4ee7ee[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x3b5146[_0xa1b0('0x44')]=[{'all':!![]}];}return db[_0xa1b0('0x5e')][_0xa1b0('0x45')](_0x3b5146);})[_0xa1b0('0x25')](function(_0x23ee83){_0x4698ca[_0xa1b0('0x46')]=_0x23ee83;return _0x4698ca;});}})[_0xa1b0('0x25')](respondWithFilteredResult(_0x256441,_0x3b5146))['catch'](handleError(_0x256441,null));};exports['getHopperFinals']=function(_0x4b6a3e,_0x128800,_0xd2ae73){var _0x4bdd33={'raw':!![],'where':{}};var _0x536db0={};var _0x44b9f3={'count':0x0,'rows':[]};return db[_0xa1b0('0x30')][_0xa1b0('0x59')]({'where':{'id':_0x4b6a3e[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x128800,null))[_0xa1b0('0x25')](function(_0x5c9a3f){if(_0x5c9a3f){_0x536db0[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db[_0xa1b0('0x60')][_0xa1b0('0x31')]);_0x536db0['query']=_[_0xa1b0('0x36')](_0x4b6a3e[_0xa1b0('0x35')]);_0x536db0[_0xa1b0('0x37')]=_[_0xa1b0('0x38')](_0x536db0['model'],_0x536db0[_0xa1b0('0x35')]);_0x4bdd33[_0xa1b0('0x39')]=_['intersection'](_0x536db0['model'],qs['fields'](_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x4bdd33[_0xa1b0('0x39')]=_0x4bdd33['attributes'][_0xa1b0('0x49')]?_0x4bdd33['attributes']:_0x536db0[_0xa1b0('0x34')];if(!_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0x4bdd33[_0xa1b0('0x20')]=qs[_0xa1b0('0x20')](_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x20')]);_0x4bdd33['offset']=qs[_0xa1b0('0x1e')](_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x4bdd33[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x3d')]);_0x4bdd33['where']=qs['filters'](_[_0xa1b0('0x5b')](_0x4b6a3e[_0xa1b0('0x35')],_0x536db0['filters']));_0x4bdd33[_0xa1b0('0x3f')][_0xa1b0('0x5f')]=_0x5c9a3f['id'];if(_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x4bdd33[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0x4bdd33[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0x4bdd33[_0xa1b0('0x39')],function(_0x4a8e74){var _0x42bc94={};_0x42bc94[_0x4a8e74]={'$like':'%'+_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x3e')]+'%'};return _0x42bc94;})});}_0x4bdd33=_[_0xa1b0('0x40')]({},_0x4bdd33,_0x4b6a3e[_0xa1b0('0x42')]);return db['CmHopperFinal']['count']({'where':_0x4bdd33[_0xa1b0('0x3f')]})['then'](function(_0x152aae){_0x44b9f3['count']=_0x152aae;if(_0x4b6a3e['query'][_0xa1b0('0x43')]){_0x4bdd33[_0xa1b0('0x44')]=[{'all':!![]}];}return db[_0xa1b0('0x60')][_0xa1b0('0x45')](_0x4bdd33);})[_0xa1b0('0x25')](function(_0x33e96b){_0x44b9f3[_0xa1b0('0x46')]=_0x33e96b;return _0x44b9f3;});}})[_0xa1b0('0x25')](respondWithFilteredResult(_0x128800,_0x4bdd33))[_0xa1b0('0x47')](handleError(_0x128800,null));};exports[_0xa1b0('0x61')]=function(_0x16e73f,_0x376a89,_0x59ee0e){var _0x4bb1d3={'raw':!![],'where':{}};var _0x457d89={};var _0x23d117={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x16e73f['params']['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x376a89,null))[_0xa1b0('0x25')](function(_0x1bd61c){if(_0x1bd61c){_0x457d89['model']=_[_0xa1b0('0x36')](db[_0xa1b0('0x62')]['rawAttributes']);_0x457d89[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0x16e73f[_0xa1b0('0x35')]);_0x457d89[_0xa1b0('0x37')]=_[_0xa1b0('0x38')](_0x457d89[_0xa1b0('0x34')],_0x457d89['query']);_0x4bb1d3[_0xa1b0('0x39')]=_['intersection'](_0x457d89[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x4bb1d3[_0xa1b0('0x39')]=_0x4bb1d3['attributes'][_0xa1b0('0x49')]?_0x4bb1d3['attributes']:_0x457d89['model'];if(!_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0x4bb1d3[_0xa1b0('0x20')]=qs['limit'](_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x20')]);_0x4bb1d3[_0xa1b0('0x1e')]=qs[_0xa1b0('0x1e')](_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x4bb1d3[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x3d')]);_0x4bb1d3[_0xa1b0('0x3f')]=qs[_0xa1b0('0x37')](_[_0xa1b0('0x5b')](_0x16e73f[_0xa1b0('0x35')],_0x457d89[_0xa1b0('0x37')]));_0x4bb1d3[_0xa1b0('0x3f')][_0xa1b0('0x5f')]=_0x1bd61c['id'];if(_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x4bb1d3[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0x4bb1d3[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0x4bb1d3['attributes'],function(_0x3b8f5d){var _0x1c3712={};_0x1c3712[_0x3b8f5d]={'$like':'%'+_0x16e73f[_0xa1b0('0x35')]['filter']+'%'};return _0x1c3712;})});}_0x4bb1d3=_['merge']({},_0x4bb1d3,_0x16e73f['options']);return db[_0xa1b0('0x62')][_0xa1b0('0x21')]({'where':_0x4bb1d3[_0xa1b0('0x3f')]})[_0xa1b0('0x25')](function(_0x1aa056){_0x23d117[_0xa1b0('0x21')]=_0x1aa056;if(_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x4bb1d3[_0xa1b0('0x44')]=[{'all':!![]}];}return db[_0xa1b0('0x62')]['findAll'](_0x4bb1d3);})[_0xa1b0('0x25')](function(_0x23b325){_0x23d117[_0xa1b0('0x46')]=_0x23b325;return _0x23d117;});}})[_0xa1b0('0x25')](respondWithFilteredResult(_0x376a89,_0x4bb1d3))[_0xa1b0('0x47')](handleError(_0x376a89,null));};exports['getLists']=function(_0x31eee2,_0x50e73e,_0x4c27b2){var _0x1adeea={};var _0x2c3606={};var _0x3e6db1;var _0x38f9f6;return db[_0xa1b0('0x30')][_0xa1b0('0x59')]({'where':{'id':_0x31eee2[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x50e73e,null))[_0xa1b0('0x25')](function(_0x2a9222){if(_0x2a9222){_0x3e6db1=_0x2a9222;_0x2c3606[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db['CmList']['rawAttributes']);_0x2c3606['query']=_[_0xa1b0('0x36')](_0x31eee2[_0xa1b0('0x35')]);_0x2c3606[_0xa1b0('0x37')]=_[_0xa1b0('0x38')](_0x2c3606[_0xa1b0('0x34')],_0x2c3606[_0xa1b0('0x35')]);_0x1adeea[_0xa1b0('0x39')]=_['intersection'](_0x2c3606[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0x31eee2[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x1adeea[_0xa1b0('0x39')]=_0x1adeea[_0xa1b0('0x39')][_0xa1b0('0x49')]?_0x1adeea[_0xa1b0('0x39')]:_0x2c3606[_0xa1b0('0x34')];_0x1adeea[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x31eee2[_0xa1b0('0x35')]['sort']);_0x1adeea['where']=qs[_0xa1b0('0x37')](_[_0xa1b0('0x5b')](_0x31eee2[_0xa1b0('0x35')],_0x2c3606[_0xa1b0('0x37')]));if(_0x31eee2['query'][_0xa1b0('0x3e')]){_0x1adeea[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0x1adeea['where'],{'$or':_[_0xa1b0('0x2f')](_0x1adeea['attributes'],function(_0x2d9768){var _0x374919={};_0x374919[_0x2d9768]={'$like':'%'+_0x31eee2['query'][_0xa1b0('0x3e')]+'%'};return _0x374919;})});}_0x1adeea=_[_0xa1b0('0x40')]({},_0x1adeea,_0x31eee2[_0xa1b0('0x42')]);return _0x3e6db1[_0xa1b0('0x63')](_0x1adeea);}})['then'](function(_0x3c9d65){if(_0x3c9d65){_0x38f9f6=_0x3c9d65[_0xa1b0('0x49')];if(!_0x31eee2[_0xa1b0('0x35')][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0x1adeea[_0xa1b0('0x20')]=qs[_0xa1b0('0x20')](_0x31eee2[_0xa1b0('0x35')]['limit']);_0x1adeea['offset']=qs['offset'](_0x31eee2['query'][_0xa1b0('0x1e')]);}return _0x3e6db1['getLists'](_0x1adeea);}})[_0xa1b0('0x25')](function(_0x4a32bc){if(_0x4a32bc){return _0x4a32bc?{'count':_0x38f9f6,'rows':_0x4a32bc}:null;}})[_0xa1b0('0x25')](respondWithResult(_0x50e73e,null))[_0xa1b0('0x47')](handleError(_0x50e73e,null));};exports[_0xa1b0('0x64')]=function(_0x4b7de7,_0x3c42db,_0x1b4f85){var _0x13540e,_0x5a7368;return db['Campaign']['find']({'where':{'id':_0x4b7de7[_0xa1b0('0x51')]['id']}})['then'](handleEntityNotFound(_0x3c42db,null))[_0xa1b0('0x25')](function(_0x51eda8){if(_0x51eda8){_0x5a7368=_0x51eda8;return _0x51eda8[_0xa1b0('0x64')](_0x4b7de7['body'][_0xa1b0('0x65')],_[_0xa1b0('0x52')](_0x4b7de7[_0xa1b0('0x4b')],[_0xa1b0('0x65'),'id'])||{});}return null;})[_0xa1b0('0x66')](function(_0x3f60b5){var _0x2b115d;_0x13540e=_0x3f60b5||[];var _0x1bc720=[];if(_0x3f60b5){for(var _0x17284f=0x0;_0x17284f<_0x3f60b5[_0xa1b0('0x49')];_0x17284f+=0x1){var _0x3c5029=_0x3f60b5[_0x17284f][_0xa1b0('0x27')]({'plain':!![]});_0x5a7368['dialCheckDuplicateType']=_0x4b7de7[_0xa1b0('0x4b')][_0xa1b0('0x67')]?_0x4b7de7[_0xa1b0('0x4b')][_0xa1b0('0x67')]:_0x5a7368['dialCheckDuplicateType'];switch(_0x5a7368[_0xa1b0('0x67')]){case _0xa1b0('0x68'):_0x2b115d=squel[_0xa1b0('0x69')]()[_0xa1b0('0x6a')](_0xa1b0('0x6b'))[_0xa1b0('0x6c')]([_0xa1b0('0x6d'),'scheduledAt',_0xa1b0('0x6e'),_0xa1b0('0x6f'),'CampaignId','createdAt',_0xa1b0('0x54')],squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x6d'),_0xa1b0('0x6d'))[_0xa1b0('0x71')]('NOW()',_0xa1b0('0x72'))['field']('id',_0xa1b0('0x6e'))[_0xa1b0('0x71')](_0x3c5029[_0xa1b0('0x73')]['toString'](),'ListId')['field'](_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')](),'CampaignId')['field']('NOW()','createdAt')[_0xa1b0('0x71')](_0xa1b0('0x75'),_0xa1b0('0x54'))['from'](_0xa1b0('0x76'))['where'](_0xa1b0('0x77'))[_0xa1b0('0x3f')](_0xa1b0('0x78'),_0x3c5029[_0xa1b0('0x73')][_0xa1b0('0x74')]())[_0xa1b0('0x3f')](_0xa1b0('0x79'))[_0xa1b0('0x3f')](_0xa1b0('0x7a'),squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x7b'))[_0xa1b0('0x7c')](_0xa1b0('0x7d'))[_0xa1b0('0x3f')]('CampaignId\x20=\x20?',_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')]()))['where'](_0xa1b0('0x7a'),squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x7e'))[_0xa1b0('0x7c')]('cm_hopper')[_0xa1b0('0x3f')]('CampaignId\x20=\x20?',_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')]())))['toString']();break;case _0xa1b0('0x7f'):_0x2b115d=squel[_0xa1b0('0x69')]()['into'](_0xa1b0('0x6b'))[_0xa1b0('0x6c')]([_0xa1b0('0x6d'),_0xa1b0('0x72'),_0xa1b0('0x6e'),_0xa1b0('0x6f'),_0xa1b0('0x5f'),_0xa1b0('0x53'),'updatedAt'],squel[_0xa1b0('0x70')]()['field']('phone',_0xa1b0('0x6d'))[_0xa1b0('0x71')]('NOW()','scheduledAt')[_0xa1b0('0x71')]('id','ContactId')[_0xa1b0('0x71')](_0x3c5029[_0xa1b0('0x73')][_0xa1b0('0x74')](),_0xa1b0('0x6f'))['field'](_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')](),_0xa1b0('0x5f'))[_0xa1b0('0x71')](_0xa1b0('0x75'),'createdAt')[_0xa1b0('0x71')](_0xa1b0('0x75'),_0xa1b0('0x54'))[_0xa1b0('0x7c')]('cm_contacts')[_0xa1b0('0x3f')](_0xa1b0('0x77'))[_0xa1b0('0x3f')](_0xa1b0('0x78'),_0x3c5029['CmListId'][_0xa1b0('0x74')]())[_0xa1b0('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x7e'))[_0xa1b0('0x7c')](_0xa1b0('0x6b'))[_0xa1b0('0x3f')](_0xa1b0('0x80'),_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')]())))['toString']();break;default:_0x2b115d=squel[_0xa1b0('0x69')]()[_0xa1b0('0x6a')](_0xa1b0('0x6b'))['fromQuery']([_0xa1b0('0x6d'),_0xa1b0('0x72'),_0xa1b0('0x6e'),_0xa1b0('0x6f'),_0xa1b0('0x5f'),_0xa1b0('0x53'),'updatedAt'],squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')]('phone','phone')['field'](_0xa1b0('0x75'),_0xa1b0('0x72'))[_0xa1b0('0x71')]('id',_0xa1b0('0x6e'))[_0xa1b0('0x71')](_0x3c5029[_0xa1b0('0x73')][_0xa1b0('0x74')](),_0xa1b0('0x6f'))['field'](_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')](),_0xa1b0('0x5f'))[_0xa1b0('0x71')]('NOW()','createdAt')[_0xa1b0('0x71')]('NOW()',_0xa1b0('0x54'))[_0xa1b0('0x7c')](_0xa1b0('0x76'))[_0xa1b0('0x3f')](_0xa1b0('0x77'))['where'](_0xa1b0('0x78'),_0x3c5029['CmListId']['toString']())['where'](_0xa1b0('0x79')))[_0xa1b0('0x74')]();}_0x1bc720[_0xa1b0('0x81')](db[_0xa1b0('0x82')][_0xa1b0('0x35')](_0x2b115d));}return BPromise[_0xa1b0('0x83')](_0x1bc720);}})[_0xa1b0('0x25')](function(){return _0x13540e;})[_0xa1b0('0x25')](respondWithResult(_0x3c42db,null))[_0xa1b0('0x47')](handleError(_0x3c42db,null));};exports['removeLists']=function(_0x4d12ae,_0x119deb,_0x5406c1){return db[_0xa1b0('0x30')]['find']({'where':{'id':_0x4d12ae[_0xa1b0('0x51')]['id']}})['then'](handleEntityNotFound(_0x119deb,null))[_0xa1b0('0x25')](function(_0x4872f1){if(_0x4872f1){return _0x4872f1['removeLists'](_0x4d12ae[_0xa1b0('0x35')][_0xa1b0('0x65')]);}})[_0xa1b0('0x25')](function(_0x291121){if(_0x291121){return db[_0xa1b0('0x5c')][_0xa1b0('0x26')]({'where':{'ListId':_0x4d12ae[_0xa1b0('0x35')]['ids'],'CampaignId':_0x4d12ae['params']['id']}})['then'](function(){return _0x291121;});}})[_0xa1b0('0x25')](respondWithStatusCode(_0x119deb,null))[_0xa1b0('0x47')](handleError(_0x119deb,null));};exports['getBlackLists']=function(_0x234b5e,_0x33161d,_0x526e3d){var _0xd931b6={};var _0x187e2f={};var _0x4e7cfa;var _0x10248;return db[_0xa1b0('0x30')][_0xa1b0('0x59')]({'where':{'id':_0x234b5e[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x33161d,null))[_0xa1b0('0x25')](function(_0x24313f){if(_0x24313f){_0x4e7cfa=_0x24313f;_0x187e2f[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db['CmList'][_0xa1b0('0x31')]);_0x187e2f[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0x234b5e[_0xa1b0('0x35')]);_0x187e2f['filters']=_[_0xa1b0('0x38')](_0x187e2f['model'],_0x187e2f['query']);_0xd931b6[_0xa1b0('0x39')]=_['intersection'](_0x187e2f[_0xa1b0('0x34')],qs['fields'](_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0xd931b6['attributes']=_0xd931b6[_0xa1b0('0x39')]['length']?_0xd931b6[_0xa1b0('0x39')]:_0x187e2f[_0xa1b0('0x34')];_0xd931b6['order']=qs[_0xa1b0('0x3d')](_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x3d')]);_0xd931b6[_0xa1b0('0x3f')]=qs[_0xa1b0('0x37')](_[_0xa1b0('0x5b')](_0x234b5e[_0xa1b0('0x35')],_0x187e2f[_0xa1b0('0x37')]));if(_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0xd931b6[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0xd931b6[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0xd931b6[_0xa1b0('0x39')],function(_0x5e393b){var _0x2f7515={};_0x2f7515[_0x5e393b]={'$like':'%'+_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x3e')]+'%'};return _0x2f7515;})});}_0xd931b6=_[_0xa1b0('0x40')]({},_0xd931b6,_0x234b5e['options']);return _0x4e7cfa['getBlackLists'](_0xd931b6);}})['then'](function(_0x2dd541){if(_0x2dd541){_0x10248=_0x2dd541[_0xa1b0('0x49')];if(!_0x234b5e['query'][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0xd931b6[_0xa1b0('0x20')]=qs[_0xa1b0('0x20')](_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x20')]);_0xd931b6[_0xa1b0('0x1e')]=qs[_0xa1b0('0x1e')](_0x234b5e[_0xa1b0('0x35')]['offset']);}return _0x4e7cfa[_0xa1b0('0x84')](_0xd931b6);}})[_0xa1b0('0x25')](function(_0x131aa7){if(_0x131aa7){return _0x131aa7?{'count':_0x10248,'rows':_0x131aa7}:null;}})[_0xa1b0('0x25')](respondWithResult(_0x33161d,null))[_0xa1b0('0x47')](handleError(_0x33161d,null));};exports['addBlackLists']=function(_0x1ac959,_0x1d70d7,_0x6c2c40){var _0x4c9a86,_0x3126ed;return db['Campaign'][_0xa1b0('0x4e')]({'where':{'id':_0x1ac959[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x1d70d7,null))['then'](function(_0x1558d3){if(_0x1558d3){_0x3126ed=_0x1558d3;return _0x1558d3[_0xa1b0('0x85')](_0x1ac959[_0xa1b0('0x4b')][_0xa1b0('0x65')],_[_0xa1b0('0x52')](_0x1ac959[_0xa1b0('0x4b')],[_0xa1b0('0x65'),'id'])||{});}return null;})[_0xa1b0('0x66')](function(_0x3104f0){var _0x5266b4;_0x4c9a86=_0x3104f0||[];var _0x987b27=[];if(_0x3104f0){for(var _0x1f9f53=0x0;_0x1f9f53<_0x3104f0['length'];_0x1f9f53+=0x1){var _0x44402e=_0x3104f0[_0x1f9f53]['get']({'plain':!![]});_0x5266b4=squel[_0xa1b0('0x69')]()[_0xa1b0('0x6a')](_0xa1b0('0x86'))[_0xa1b0('0x6c')]([_0xa1b0('0x6d'),_0xa1b0('0x6e'),_0xa1b0('0x6f'),_0xa1b0('0x5f'),_0xa1b0('0x53'),_0xa1b0('0x54')],squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x6d'),_0xa1b0('0x6d'))[_0xa1b0('0x71')]('id','ContactId')[_0xa1b0('0x71')](_0x44402e[_0xa1b0('0x73')]['toString'](),_0xa1b0('0x6f'))[_0xa1b0('0x71')](_0x1ac959[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')](),_0xa1b0('0x5f'))[_0xa1b0('0x71')](_0xa1b0('0x75'),_0xa1b0('0x53'))[_0xa1b0('0x71')](_0xa1b0('0x75'),_0xa1b0('0x54'))['from']('cm_contacts')[_0xa1b0('0x3f')](_0xa1b0('0x77'))[_0xa1b0('0x3f')]('ListId\x20=\x20?',_0x44402e[_0xa1b0('0x73')][_0xa1b0('0x74')]())['where'](_0xa1b0('0x79')))[_0xa1b0('0x74')]();_0x987b27[_0xa1b0('0x81')](db['sequelize']['query'](_0x5266b4));}return BPromise[_0xa1b0('0x83')](_0x987b27);}})[_0xa1b0('0x25')](function(){return _0x4c9a86;})['then'](respondWithResult(_0x1d70d7,null))[_0xa1b0('0x47')](handleError(_0x1d70d7,null));};exports[_0xa1b0('0x87')]=function(_0x3e4296,_0x29b522,_0x2681d4){return db[_0xa1b0('0x30')][_0xa1b0('0x4e')]({'where':{'id':_0x3e4296[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x29b522,null))[_0xa1b0('0x25')](function(_0x50f446){if(_0x50f446){return _0x50f446[_0xa1b0('0x87')](_0x3e4296[_0xa1b0('0x35')][_0xa1b0('0x65')]);}})['then'](function(_0x4ae882){if(_0x4ae882){return db[_0xa1b0('0x62')][_0xa1b0('0x26')]({'where':{'ListId':_0x3e4296[_0xa1b0('0x35')][_0xa1b0('0x65')],'CampaignId':_0x3e4296[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](function(){return _0x4ae882;});}})[_0xa1b0('0x25')](respondWithStatusCode(_0x29b522,null))[_0xa1b0('0x47')](handleError(_0x29b522,null));};
\ No newline at end of file
+var _0xa169=['CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','NOW()','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','push','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','sequelize','removeBlackLists','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','get','UserProfileResource','destroy','stack','name','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','Campaign','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','createdAt','error','getHoppers','findOne','CmHopper'];(function(_0x25cd2c,_0x57498e){var _0x1e364c=function(_0x35ac2e){while(--_0x35ac2e){_0x25cd2c['push'](_0x25cd2c['shift']());}};_0x1e364c(++_0x57498e);}(_0xa169,0x13b));var _0x9a16=function(_0x9c502c,_0x12f7d0){_0x9c502c=_0x9c502c-0x0;var _0x8a1834=_0xa169[_0x9c502c];return _0x8a1834;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a16('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9a16('0x1'));var BPromise=require(_0x9a16('0x2'));var Mustache=require('mustache');var util=require(_0x9a16('0x3'));var path=require(_0x9a16('0x4'));var sox=require(_0x9a16('0x5'));var csv=require(_0x9a16('0x6'));var ejs=require(_0x9a16('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a16('0x8'));var squel=require(_0x9a16('0x9'));var crypto=require(_0x9a16('0xa'));var jsforce=require(_0x9a16('0xb'));var deskjs=require(_0x9a16('0xc'));var toCsv=require(_0x9a16('0x6'));var querystring=require(_0x9a16('0xd'));var Papa=require(_0x9a16('0xe'));var Redis=require(_0x9a16('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9a16('0x10'));var as=require(_0x9a16('0x11'));var hardwareService=require(_0x9a16('0x12'));var logger=require(_0x9a16('0x13'))(_0x9a16('0x14'));var utils=require(_0x9a16('0x15'));var config=require(_0x9a16('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a16('0x17'))['db'];function respondWithStatusCode(_0x59bcd6,_0x4290c3){_0x4290c3=_0x4290c3||0xcc;return function(_0xab63fb){if(_0xab63fb){return _0x59bcd6[_0x9a16('0x18')](_0x4290c3);}return _0x59bcd6['status'](_0x4290c3)[_0x9a16('0x19')]();};}function respondWithResult(_0x3bfc04,_0x1e59d1){_0x1e59d1=_0x1e59d1||0xc8;return function(_0x2eb354){if(_0x2eb354){return _0x3bfc04['status'](_0x1e59d1)[_0x9a16('0x1a')](_0x2eb354);}};}function respondWithFilteredResult(_0x10253a,_0x27f834){return function(_0x293454){if(_0x293454){var _0x3e044b=typeof _0x27f834[_0x9a16('0x1b')]===_0x9a16('0x1c')&&typeof _0x27f834[_0x9a16('0x1d')]==='undefined';var _0x40bee0=_0x293454[_0x9a16('0x1e')];var _0x33e0bc=_0x3e044b?0x0:_0x27f834[_0x9a16('0x1b')];var _0x1b05e1=_0x3e044b?_0x293454[_0x9a16('0x1e')]:_0x27f834[_0x9a16('0x1b')]+_0x27f834[_0x9a16('0x1d')];var _0xb4d5d6;if(_0x1b05e1>=_0x40bee0){_0x1b05e1=_0x40bee0;_0xb4d5d6=0xc8;}else{_0xb4d5d6=0xce;}_0x10253a[_0x9a16('0x1f')](_0xb4d5d6);return _0x10253a[_0x9a16('0x20')](_0x9a16('0x21'),_0x33e0bc+'-'+_0x1b05e1+'/'+_0x40bee0)[_0x9a16('0x1a')](_0x293454);}return null;};}function patchUpdates(_0xffdcca){return function(_0x442665){try{jsonpatch['apply'](_0x442665,_0xffdcca,!![]);}catch(_0xaa94f4){return BPromise[_0x9a16('0x22')](_0xaa94f4);}return _0x442665['save']();};}function saveUpdates(_0xe7f027,_0x255756){return function(_0x4ef667){if(_0x4ef667){return _0x4ef667[_0x9a16('0x23')](_0xe7f027)[_0x9a16('0x24')](function(_0x43e018){return _0x43e018;});}return null;};}function removeEntity(_0x89c0bd,_0x3fa6e9){return function(_0x133952){if(_0x133952){return _0x133952['destroy']()[_0x9a16('0x24')](function(){var _0x424969=_0x133952[_0x9a16('0x25')]({'plain':!![]});var _0x20e276='IvrCampaigns';return db[_0x9a16('0x26')][_0x9a16('0x27')]({'where':{'type':_0x20e276,'resourceId':_0x424969['id']}})[_0x9a16('0x24')](function(){return _0x133952;});})[_0x9a16('0x24')](function(){_0x89c0bd[_0x9a16('0x1f')](0xcc)[_0x9a16('0x19')]();});}};}function handleEntityNotFound(_0x3424a2,_0x385ad1){return function(_0x3a550f){if(!_0x3a550f){_0x3424a2[_0x9a16('0x18')](0x194);}return _0x3a550f;};}function handleError(_0x16329b,_0x30fa0b){_0x30fa0b=_0x30fa0b||0x1f4;return function(_0x4c118a){logger['error'](_0x4c118a[_0x9a16('0x28')]);if(_0x4c118a[_0x9a16('0x29')]){delete _0x4c118a[_0x9a16('0x29')];}_0x16329b[_0x9a16('0x1f')](_0x30fa0b)['send'](_0x4c118a);};}exports[_0x9a16('0x2a')]=function(_0x483fc1,_0xb279af){var _0x13cc7f={},_0x167b25={},_0x233161={'count':0x0,'rows':[]};var _0x1ab751=_['map'](db['Campaign'][_0x9a16('0x2b')],function(_0x2b6a2e){return{'name':_0x2b6a2e['fieldName'],'type':_0x2b6a2e[_0x9a16('0x2c')]['key']};});_0x167b25[_0x9a16('0x2d')]=_[_0x9a16('0x2e')](_0x1ab751,'name');_0x167b25[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x483fc1[_0x9a16('0x2f')]);_0x167b25[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x167b25['model'],_0x167b25[_0x9a16('0x2f')]);_0x13cc7f[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x167b25[_0x9a16('0x2d')],qs['fields'](_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x13cc7f[_0x9a16('0x33')]=_0x13cc7f[_0x9a16('0x33')][_0x9a16('0x35')]?_0x13cc7f['attributes']:_0x167b25[_0x9a16('0x2d')];if(!_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x36')](_0x9a16('0x37'))){_0x13cc7f['limit']=qs[_0x9a16('0x1d')](_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0x13cc7f['offset']=qs[_0x9a16('0x1b')](_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0x13cc7f[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x483fc1['query'][_0x9a16('0x39')]);_0x13cc7f[_0x9a16('0x3a')]=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0x483fc1[_0x9a16('0x2f')],_0x167b25[_0x9a16('0x31')]),_0x1ab751);if(_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x13cc7f[_0x9a16('0x3a')]=_['merge'](_0x13cc7f[_0x9a16('0x3a')],{'$or':_['map'](_0x1ab751,function(_0x34e71d){if(_0x34e71d['type']!==_0x9a16('0x3d')){var _0x1da105={};_0x1da105[_0x34e71d[_0x9a16('0x29')]]={'$like':'%'+_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0x1da105;}})});}_0x13cc7f=_[_0x9a16('0x3e')]({},_0x13cc7f,_0x483fc1[_0x9a16('0x3f')]);var _0x25ce6c={'where':_0x13cc7f[_0x9a16('0x3a')]};return db['Campaign']['count'](_0x25ce6c)[_0x9a16('0x24')](function(_0x534bea){_0x233161['count']=_0x534bea;if(_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x13cc7f[_0x9a16('0x41')]=[{'all':!![]}];}return db[_0x9a16('0x42')][_0x9a16('0x43')](_0x13cc7f);})[_0x9a16('0x24')](function(_0x4bf1f2){_0x233161[_0x9a16('0x44')]=_0x4bf1f2;return _0x233161;})[_0x9a16('0x24')](respondWithFilteredResult(_0xb279af,_0x13cc7f))[_0x9a16('0x45')](handleError(_0xb279af,null));};exports[_0x9a16('0x46')]=function(_0x2759aa,_0x1b30b0){var _0x4afa39={'raw':![],'where':{'id':_0x2759aa[_0x9a16('0x47')]['id']}},_0x1b6497={};_0x1b6497['model']=_[_0x9a16('0x30')](db[_0x9a16('0x42')][_0x9a16('0x2b')]);_0x1b6497[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x2759aa[_0x9a16('0x2f')]);_0x1b6497['filters']=_[_0x9a16('0x32')](_0x1b6497[_0x9a16('0x2d')],_0x1b6497[_0x9a16('0x2f')]);_0x4afa39[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x1b6497[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x2759aa[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x4afa39['attributes']=_0x4afa39['attributes'][_0x9a16('0x35')]?_0x4afa39[_0x9a16('0x33')]:_0x1b6497[_0x9a16('0x2d')];if(_0x2759aa[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x4afa39[_0x9a16('0x41')]=[{'all':!![]}];}_0x4afa39=_[_0x9a16('0x3e')]({},_0x4afa39,_0x2759aa['options']);return db[_0x9a16('0x42')][_0x9a16('0x48')](_0x4afa39)['then'](handleEntityNotFound(_0x1b30b0,null))['then'](respondWithResult(_0x1b30b0,null))['catch'](handleError(_0x1b30b0,null));};exports['create']=function(_0xebb110,_0x26b126){return db[_0x9a16('0x42')][_0x9a16('0x49')](_0xebb110['body'],{})[_0x9a16('0x24')](function(_0x316665){var _0x1c1b92=_0xebb110['user'][_0x9a16('0x25')]({'plain':!![]});if(!_0x1c1b92)throw new Error(_0x9a16('0x4a'));if(_0x1c1b92[_0x9a16('0x4b')]===_0x9a16('0x4c')){var _0x1c4072=_0x316665[_0x9a16('0x25')]({'plain':!![]});var _0x46b0bf=_0x9a16('0x4d');return db[_0x9a16('0x4e')][_0x9a16('0x48')]({'where':{'name':_0x46b0bf,'userProfileId':_0x1c1b92[_0x9a16('0x4f')]},'raw':!![]})[_0x9a16('0x24')](function(_0x3156ab){if(_0x3156ab&&_0x3156ab['autoAssociation']===0x0){return db[_0x9a16('0x26')][_0x9a16('0x49')]({'name':_0x1c4072[_0x9a16('0x29')],'resourceId':_0x1c4072['id'],'type':_0x3156ab['name'],'sectionId':_0x3156ab['id']},{})[_0x9a16('0x24')](function(){return _0x316665;});}else{return _0x316665;}})[_0x9a16('0x45')](function(_0x2037f0){logger['error'](_0x9a16('0x50'),_0x2037f0);throw _0x2037f0;});}return _0x316665;})[_0x9a16('0x24')](respondWithResult(_0x26b126,0xc9))[_0x9a16('0x45')](handleError(_0x26b126,null));};exports[_0x9a16('0x51')]=function(_0x312895,_0x367ffa){var _0x4e18c1={'where':{'id':_0x312895[_0x9a16('0x47')]['id']}},_0x2dda7c={};_0x2dda7c[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x42')][_0x9a16('0x2b')]);_0x4e18c1['attributes']=_[_0x9a16('0x32')](_0x2dda7c[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x312895['query'][_0x9a16('0x34')]));_0x4e18c1[_0x9a16('0x33')]=_0x4e18c1[_0x9a16('0x33')]['length']?_0x4e18c1[_0x9a16('0x33')]:_0x2dda7c[_0x9a16('0x2d')];if(_0x312895[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x4e18c1['include']=[{'all':!![]}];}_0x4e18c1=_[_0x9a16('0x3e')]({},_0x4e18c1,_0x312895[_0x9a16('0x3f')]);return db['Campaign']['find'](_0x4e18c1)[_0x9a16('0x24')](handleEntityNotFound(_0x367ffa,null))[_0x9a16('0x24')](function(_0x3f339f){if(_0x3f339f){var _0x5b15eb=_0x3f339f[_0x9a16('0x25')]({'plain':!![]});_0x5b15eb=qs['omit'](_0x5b15eb,['id','createdAt',_0x9a16('0x52')]);_0x312895[_0x9a16('0x53')]=_[_0x9a16('0x54')](_0x312895[_0x9a16('0x53')],['id',_0x9a16('0x55'),_0x9a16('0x52')]);return db[_0x9a16('0x42')][_0x9a16('0x49')](_['merge'](_0x5b15eb,_0x312895[_0x9a16('0x53')]),{'include':_0x312895['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x50a3c7){var _0x4de5af=_0x312895['user'][_0x9a16('0x25')]({'plain':!![]});if(!_0x4de5af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4de5af[_0x9a16('0x4b')]===_0x9a16('0x4c')){var _0x3fa395=_0x50a3c7[_0x9a16('0x25')]({'plain':!![]});var _0x8eb4b7=_0x9a16('0x4d');return db[_0x9a16('0x4e')]['find']({'where':{'name':_0x8eb4b7,'userProfileId':_0x4de5af[_0x9a16('0x4f')]},'raw':!![]})[_0x9a16('0x24')](function(_0x1130c3){if(_0x1130c3&&_0x1130c3['autoAssociation']===0x0){return db[_0x9a16('0x26')][_0x9a16('0x49')]({'name':_0x3fa395[_0x9a16('0x29')],'resourceId':_0x3fa395['id'],'type':_0x1130c3['name'],'sectionId':_0x1130c3['id']},{})['then'](function(){return _0x50a3c7;});}else{return _0x50a3c7;}})[_0x9a16('0x45')](function(_0x8ee3c6){logger[_0x9a16('0x56')](_0x9a16('0x50'),_0x8ee3c6);throw _0x8ee3c6;});}return _0x50a3c7;});}})['then'](respondWithResult(_0x367ffa,0xc9))['catch'](handleError(_0x367ffa,null));};exports[_0x9a16('0x23')]=function(_0x5ec523,_0x21b422){if(_0x5ec523[_0x9a16('0x53')]['id']){delete _0x5ec523[_0x9a16('0x53')]['id'];}return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x5ec523['params']['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x21b422,null))['then'](saveUpdates(_0x5ec523[_0x9a16('0x53')],null))[_0x9a16('0x24')](respondWithResult(_0x21b422,null))['catch'](handleError(_0x21b422,null));};exports[_0x9a16('0x27')]=function(_0x2e78cd,_0x4a9b9e){return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x2e78cd[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x4a9b9e,null))['then'](removeEntity(_0x4a9b9e,null))[_0x9a16('0x45')](handleError(_0x4a9b9e,null));};exports[_0x9a16('0x57')]=function(_0x3f67a6,_0x3f3c35,_0x2ff8d4){var _0xc90f56={'raw':!![],'where':{}};var _0x3898b0={};var _0xdc6f8a={'count':0x0,'rows':[]};return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x3f67a6[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x3f3c35,null))[_0x9a16('0x24')](function(_0x556928){if(_0x556928){_0x3898b0[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x59')]['rawAttributes']);_0x3898b0['query']=_['keys'](_0x3f67a6['query']);_0x3898b0[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x3898b0[_0x9a16('0x2d')],_0x3898b0[_0x9a16('0x2f')]);_0xc90f56[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x3898b0[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x3f67a6['query'][_0x9a16('0x34')]));_0xc90f56[_0x9a16('0x33')]=_0xc90f56[_0x9a16('0x33')][_0x9a16('0x35')]?_0xc90f56[_0x9a16('0x33')]:_0x3898b0['model'];if(!_0x3f67a6['query'][_0x9a16('0x36')](_0x9a16('0x37'))){_0xc90f56[_0x9a16('0x1d')]=qs[_0x9a16('0x1d')](_0x3f67a6[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0xc90f56['offset']=qs[_0x9a16('0x1b')](_0x3f67a6[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0xc90f56[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x3f67a6[_0x9a16('0x2f')]['sort']);_0xc90f56[_0x9a16('0x3a')]=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0x3f67a6['query'],_0x3898b0[_0x9a16('0x31')]));_0xc90f56[_0x9a16('0x3a')][_0x9a16('0x5a')]=_0x556928['id'];if(_0x3f67a6[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0xc90f56[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0xc90f56[_0x9a16('0x3a')],{'$or':_['map'](_0xc90f56['attributes'],function(_0x1b91fc){var _0x5f088e={};_0x5f088e[_0x1b91fc]={'$like':'%'+_0x3f67a6['query'][_0x9a16('0x3c')]+'%'};return _0x5f088e;})});}_0xc90f56=_[_0x9a16('0x3e')]({},_0xc90f56,_0x3f67a6[_0x9a16('0x3f')]);return db[_0x9a16('0x59')][_0x9a16('0x1e')]({'where':_0xc90f56['where']})[_0x9a16('0x24')](function(_0x230f25){_0xdc6f8a[_0x9a16('0x1e')]=_0x230f25;if(_0x3f67a6[_0x9a16('0x2f')]['includeAll']){_0xc90f56[_0x9a16('0x41')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xc90f56);})['then'](function(_0x485a6c){_0xdc6f8a[_0x9a16('0x44')]=_0x485a6c;return _0xdc6f8a;});}})[_0x9a16('0x24')](respondWithFilteredResult(_0x3f3c35,_0xc90f56))[_0x9a16('0x45')](handleError(_0x3f3c35,null));};exports[_0x9a16('0x5b')]=function(_0x5b21e8,_0x5e58c7,_0x4c01df){var _0x35bb1e={'raw':!![],'where':{}};var _0x289262={};var _0x3cc496={'count':0x0,'rows':[]};return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x5b21e8[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x5e58c7,null))[_0x9a16('0x24')](function(_0x3d0de0){if(_0x3d0de0){_0x289262[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x5c')][_0x9a16('0x2b')]);_0x289262[_0x9a16('0x2f')]=_['keys'](_0x5b21e8['query']);_0x289262[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x289262[_0x9a16('0x2d')],_0x289262['query']);_0x35bb1e['attributes']=_[_0x9a16('0x32')](_0x289262['model'],qs[_0x9a16('0x34')](_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x35bb1e[_0x9a16('0x33')]=_0x35bb1e['attributes'][_0x9a16('0x35')]?_0x35bb1e[_0x9a16('0x33')]:_0x289262[_0x9a16('0x2d')];if(!_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x36')](_0x9a16('0x37'))){_0x35bb1e['limit']=qs[_0x9a16('0x1d')](_0x5b21e8['query'][_0x9a16('0x1d')]);_0x35bb1e['offset']=qs[_0x9a16('0x1b')](_0x5b21e8['query'][_0x9a16('0x1b')]);}_0x35bb1e[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x5b21e8[_0x9a16('0x2f')]['sort']);_0x35bb1e['where']=qs[_0x9a16('0x31')](_['pick'](_0x5b21e8['query'],_0x289262[_0x9a16('0x31')]));_0x35bb1e[_0x9a16('0x3a')][_0x9a16('0x5a')]=_0x3d0de0['id'];if(_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x35bb1e['where']=_[_0x9a16('0x3e')](_0x35bb1e[_0x9a16('0x3a')],{'$or':_[_0x9a16('0x2e')](_0x35bb1e[_0x9a16('0x33')],function(_0x3bb9bf){var _0xbaf780={};_0xbaf780[_0x3bb9bf]={'$like':'%'+_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0xbaf780;})});}_0x35bb1e=_['merge']({},_0x35bb1e,_0x5b21e8[_0x9a16('0x3f')]);return db[_0x9a16('0x5c')][_0x9a16('0x1e')]({'where':_0x35bb1e['where']})['then'](function(_0x15b936){_0x3cc496['count']=_0x15b936;if(_0x5b21e8[_0x9a16('0x2f')]['includeAll']){_0x35bb1e[_0x9a16('0x41')]=[{'all':!![]}];}return db[_0x9a16('0x5c')][_0x9a16('0x43')](_0x35bb1e);})['then'](function(_0x14ff36){_0x3cc496[_0x9a16('0x44')]=_0x14ff36;return _0x3cc496;});}})['then'](respondWithFilteredResult(_0x5e58c7,_0x35bb1e))[_0x9a16('0x45')](handleError(_0x5e58c7,null));};exports[_0x9a16('0x5d')]=function(_0x52442a,_0x4d8d8e,_0x173fe0){var _0xe6a16c={'raw':!![],'where':{}};var _0x493e66={};var _0x185cd8={'count':0x0,'rows':[]};return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x52442a[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x4d8d8e,null))[_0x9a16('0x24')](function(_0x44984a){if(_0x44984a){_0x493e66[_0x9a16('0x2d')]=_['keys'](db[_0x9a16('0x5e')]['rawAttributes']);_0x493e66[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x52442a['query']);_0x493e66[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x493e66[_0x9a16('0x2d')],_0x493e66[_0x9a16('0x2f')]);_0xe6a16c[_0x9a16('0x33')]=_['intersection'](_0x493e66['model'],qs['fields'](_0x52442a['query'][_0x9a16('0x34')]));_0xe6a16c[_0x9a16('0x33')]=_0xe6a16c[_0x9a16('0x33')][_0x9a16('0x35')]?_0xe6a16c[_0x9a16('0x33')]:_0x493e66[_0x9a16('0x2d')];if(!_0x52442a['query'][_0x9a16('0x36')]('nolimit')){_0xe6a16c[_0x9a16('0x1d')]=qs['limit'](_0x52442a[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0xe6a16c[_0x9a16('0x1b')]=qs[_0x9a16('0x1b')](_0x52442a[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0xe6a16c[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x52442a['query']['sort']);_0xe6a16c['where']=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0x52442a[_0x9a16('0x2f')],_0x493e66[_0x9a16('0x31')]));_0xe6a16c['where']['CampaignId']=_0x44984a['id'];if(_0x52442a[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0xe6a16c[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0xe6a16c[_0x9a16('0x3a')],{'$or':_[_0x9a16('0x2e')](_0xe6a16c[_0x9a16('0x33')],function(_0x1762a5){var _0x2edad0={};_0x2edad0[_0x1762a5]={'$like':'%'+_0x52442a[_0x9a16('0x2f')]['filter']+'%'};return _0x2edad0;})});}_0xe6a16c=_[_0x9a16('0x3e')]({},_0xe6a16c,_0x52442a[_0x9a16('0x3f')]);return db[_0x9a16('0x5e')]['count']({'where':_0xe6a16c['where']})[_0x9a16('0x24')](function(_0x32e50c){_0x185cd8[_0x9a16('0x1e')]=_0x32e50c;if(_0x52442a[_0x9a16('0x2f')][_0x9a16('0x40')]){_0xe6a16c['include']=[{'all':!![]}];}return db[_0x9a16('0x5e')][_0x9a16('0x43')](_0xe6a16c);})[_0x9a16('0x24')](function(_0x1d7d55){_0x185cd8[_0x9a16('0x44')]=_0x1d7d55;return _0x185cd8;});}})[_0x9a16('0x24')](respondWithFilteredResult(_0x4d8d8e,_0xe6a16c))[_0x9a16('0x45')](handleError(_0x4d8d8e,null));};exports[_0x9a16('0x5f')]=function(_0xeaddea,_0x3c59f9,_0x3e3dae){var _0x5d3899={'raw':!![],'where':{}};var _0x147753={};var _0x84a3c={'count':0x0,'rows':[]};return db['Campaign'][_0x9a16('0x58')]({'where':{'id':_0xeaddea[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x3c59f9,null))['then'](function(_0x46c526){if(_0x46c526){_0x147753[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x60')][_0x9a16('0x2b')]);_0x147753[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0xeaddea[_0x9a16('0x2f')]);_0x147753[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x147753[_0x9a16('0x2d')],_0x147753[_0x9a16('0x2f')]);_0x5d3899[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x147753[_0x9a16('0x2d')],qs['fields'](_0xeaddea[_0x9a16('0x2f')]['fields']));_0x5d3899[_0x9a16('0x33')]=_0x5d3899[_0x9a16('0x33')]['length']?_0x5d3899[_0x9a16('0x33')]:_0x147753[_0x9a16('0x2d')];if(!_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x36')](_0x9a16('0x37'))){_0x5d3899[_0x9a16('0x1d')]=qs[_0x9a16('0x1d')](_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0x5d3899['offset']=qs[_0x9a16('0x1b')](_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0x5d3899['order']=qs[_0x9a16('0x39')](_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x39')]);_0x5d3899[_0x9a16('0x3a')]=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0xeaddea['query'],_0x147753[_0x9a16('0x31')]));_0x5d3899[_0x9a16('0x3a')][_0x9a16('0x5a')]=_0x46c526['id'];if(_0xeaddea[_0x9a16('0x2f')]['filter']){_0x5d3899[_0x9a16('0x3a')]=_['merge'](_0x5d3899['where'],{'$or':_[_0x9a16('0x2e')](_0x5d3899[_0x9a16('0x33')],function(_0x4a6352){var _0x93a271={};_0x93a271[_0x4a6352]={'$like':'%'+_0xeaddea['query'][_0x9a16('0x3c')]+'%'};return _0x93a271;})});}_0x5d3899=_['merge']({},_0x5d3899,_0xeaddea['options']);return db[_0x9a16('0x60')][_0x9a16('0x1e')]({'where':_0x5d3899[_0x9a16('0x3a')]})[_0x9a16('0x24')](function(_0x402f7d){_0x84a3c[_0x9a16('0x1e')]=_0x402f7d;if(_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x5d3899['include']=[{'all':!![]}];}return db[_0x9a16('0x60')][_0x9a16('0x43')](_0x5d3899);})[_0x9a16('0x24')](function(_0x5100f2){_0x84a3c['rows']=_0x5100f2;return _0x84a3c;});}})[_0x9a16('0x24')](respondWithFilteredResult(_0x3c59f9,_0x5d3899))[_0x9a16('0x45')](handleError(_0x3c59f9,null));};exports[_0x9a16('0x61')]=function(_0x195a29,_0x49cebf,_0x141949){var _0x22e5d1={};var _0x159891={};var _0x592669;var _0xdaf8ad;return db[_0x9a16('0x42')]['findOne']({'where':{'id':_0x195a29['params']['id']}})['then'](handleEntityNotFound(_0x49cebf,null))[_0x9a16('0x24')](function(_0xf0eaa9){if(_0xf0eaa9){_0x592669=_0xf0eaa9;_0x159891[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db['CmList']['rawAttributes']);_0x159891[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x195a29[_0x9a16('0x2f')]);_0x159891[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x159891[_0x9a16('0x2d')],_0x159891['query']);_0x22e5d1['attributes']=_[_0x9a16('0x32')](_0x159891[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x195a29['query']['fields']));_0x22e5d1[_0x9a16('0x33')]=_0x22e5d1[_0x9a16('0x33')][_0x9a16('0x35')]?_0x22e5d1[_0x9a16('0x33')]:_0x159891['model'];_0x22e5d1[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x195a29[_0x9a16('0x2f')][_0x9a16('0x39')]);_0x22e5d1['where']=qs[_0x9a16('0x31')](_['pick'](_0x195a29[_0x9a16('0x2f')],_0x159891[_0x9a16('0x31')]));if(_0x195a29[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x22e5d1[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0x22e5d1['where'],{'$or':_[_0x9a16('0x2e')](_0x22e5d1[_0x9a16('0x33')],function(_0x260ba1){var _0x39127a={};_0x39127a[_0x260ba1]={'$like':'%'+_0x195a29[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0x39127a;})});}_0x22e5d1=_[_0x9a16('0x3e')]({},_0x22e5d1,_0x195a29[_0x9a16('0x3f')]);return _0x592669[_0x9a16('0x61')](_0x22e5d1);}})['then'](function(_0x284c15){if(_0x284c15){_0xdaf8ad=_0x284c15['length'];if(!_0x195a29[_0x9a16('0x2f')]['hasOwnProperty']('nolimit')){_0x22e5d1['limit']=qs[_0x9a16('0x1d')](_0x195a29[_0x9a16('0x2f')]['limit']);_0x22e5d1['offset']=qs[_0x9a16('0x1b')](_0x195a29[_0x9a16('0x2f')][_0x9a16('0x1b')]);}return _0x592669[_0x9a16('0x61')](_0x22e5d1);}})['then'](function(_0x2a8d2d){if(_0x2a8d2d){return _0x2a8d2d?{'count':_0xdaf8ad,'rows':_0x2a8d2d}:null;}})['then'](respondWithResult(_0x49cebf,null))['catch'](handleError(_0x49cebf,null));};exports[_0x9a16('0x62')]=function(_0x559581,_0x5b332b,_0x4be2e5){var _0x370523,_0x3af669;return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x559581[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x5b332b,null))[_0x9a16('0x24')](function(_0xba1c55){if(_0xba1c55){_0x3af669=_0xba1c55;return _0xba1c55[_0x9a16('0x62')](_0x559581[_0x9a16('0x53')]['ids'],_['omit'](_0x559581[_0x9a16('0x53')],[_0x9a16('0x63'),'id'])||{});}return null;})['spread'](function(_0x5eddb3){var _0x428a0e;_0x370523=_0x5eddb3||[];var _0x342278=[];if(_0x5eddb3){for(var _0x3fe33a=0x0;_0x3fe33a<_0x5eddb3[_0x9a16('0x35')];_0x3fe33a+=0x1){var _0xbfae=_0x5eddb3[_0x3fe33a][_0x9a16('0x25')]({'plain':!![]});_0x3af669['dialCheckDuplicateType']=_0x559581[_0x9a16('0x53')][_0x9a16('0x64')]?_0x559581[_0x9a16('0x53')][_0x9a16('0x64')]:_0x3af669[_0x9a16('0x64')];switch(_0x3af669[_0x9a16('0x64')]){case _0x9a16('0x65'):_0x428a0e=squel[_0x9a16('0x66')]()[_0x9a16('0x67')](_0x9a16('0x68'))[_0x9a16('0x69')]([_0x9a16('0x6a'),_0x9a16('0x6b'),_0x9a16('0x6c'),'ListId',_0x9a16('0x5a'),_0x9a16('0x55'),_0x9a16('0x52')],squel['select']()[_0x9a16('0x6d')]('phone','phone')[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x6b'))[_0x9a16('0x6d')]('id','ContactId')[_0x9a16('0x6d')](_0xbfae['CmListId'][_0x9a16('0x6f')](),_0x9a16('0x70'))[_0x9a16('0x6d')](_0x559581['params']['id']['toString'](),_0x9a16('0x5a'))['field'](_0x9a16('0x6e'),_0x9a16('0x55'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x52'))[_0x9a16('0x71')]('cm_contacts')[_0x9a16('0x3a')](_0x9a16('0x72'))[_0x9a16('0x3a')](_0x9a16('0x73'),_0xbfae[_0x9a16('0x74')]['toString']())['where'](_0x9a16('0x75'))[_0x9a16('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x77'))[_0x9a16('0x71')](_0x9a16('0x78'))[_0x9a16('0x3a')](_0x9a16('0x79'),_0x559581[_0x9a16('0x47')]['id'][_0x9a16('0x6f')]()))[_0x9a16('0x3a')](_0x9a16('0x7a'),squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x7b'))[_0x9a16('0x71')]('cm_hopper')['where'](_0x9a16('0x79'),_0x559581[_0x9a16('0x47')]['id'][_0x9a16('0x6f')]())))[_0x9a16('0x6f')]();break;case _0x9a16('0x7c'):_0x428a0e=squel[_0x9a16('0x66')]()['into']('cm_hopper')[_0x9a16('0x69')](['phone',_0x9a16('0x6b'),'ContactId',_0x9a16('0x70'),_0x9a16('0x5a'),_0x9a16('0x55'),_0x9a16('0x52')],squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x6a'),_0x9a16('0x6a'))['field'](_0x9a16('0x6e'),_0x9a16('0x6b'))[_0x9a16('0x6d')]('id',_0x9a16('0x6c'))[_0x9a16('0x6d')](_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')](),_0x9a16('0x70'))[_0x9a16('0x6d')](_0x559581['params']['id']['toString'](),'CampaignId')[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x55'))[_0x9a16('0x6d')]('NOW()',_0x9a16('0x52'))['from']('cm_contacts')['where'](_0x9a16('0x72'))[_0x9a16('0x3a')](_0x9a16('0x73'),_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')]())[_0x9a16('0x3a')](_0x9a16('0x75'))[_0x9a16('0x3a')](_0x9a16('0x7a'),squel['select']()[_0x9a16('0x6d')](_0x9a16('0x7b'))[_0x9a16('0x71')](_0x9a16('0x68'))[_0x9a16('0x3a')](_0x9a16('0x79'),_0x559581[_0x9a16('0x47')]['id'][_0x9a16('0x6f')]())))[_0x9a16('0x6f')]();break;default:_0x428a0e=squel[_0x9a16('0x66')]()[_0x9a16('0x67')](_0x9a16('0x68'))['fromQuery'](['phone',_0x9a16('0x6b'),_0x9a16('0x6c'),_0x9a16('0x70'),_0x9a16('0x5a'),'createdAt',_0x9a16('0x52')],squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x6a'),_0x9a16('0x6a'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x6b'))[_0x9a16('0x6d')]('id',_0x9a16('0x6c'))[_0x9a16('0x6d')](_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')](),'ListId')['field'](_0x559581['params']['id']['toString'](),'CampaignId')['field'](_0x9a16('0x6e'),_0x9a16('0x55'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x52'))[_0x9a16('0x71')](_0x9a16('0x7d'))[_0x9a16('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0x9a16('0x73'),_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')]())[_0x9a16('0x3a')](_0x9a16('0x75')))['toString']();}_0x342278[_0x9a16('0x7e')](db['sequelize'][_0x9a16('0x2f')](_0x428a0e));}return BPromise[_0x9a16('0x7f')](_0x342278);}})[_0x9a16('0x24')](function(){return _0x370523;})[_0x9a16('0x24')](respondWithResult(_0x5b332b,null))[_0x9a16('0x45')](handleError(_0x5b332b,null));};exports[_0x9a16('0x80')]=function(_0x40a0e2,_0x199255,_0xb8fc2d){return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x40a0e2[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x199255,null))[_0x9a16('0x24')](function(_0x21d101){if(_0x21d101){return _0x21d101['removeLists'](_0x40a0e2[_0x9a16('0x2f')][_0x9a16('0x63')]);}})['then'](function(_0x9a6a1a){if(_0x9a6a1a){return db[_0x9a16('0x59')]['destroy']({'where':{'ListId':_0x40a0e2[_0x9a16('0x2f')][_0x9a16('0x63')],'CampaignId':_0x40a0e2['params']['id']}})['then'](function(){return _0x9a6a1a;});}})[_0x9a16('0x24')](respondWithStatusCode(_0x199255,null))[_0x9a16('0x45')](handleError(_0x199255,null));};exports['getBlackLists']=function(_0x318553,_0x23e42f,_0xb5a6d3){var _0x29d474={};var _0x4db13e={};var _0x26c437;var _0x1a7e4c;return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x318553[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x23e42f,null))[_0x9a16('0x24')](function(_0x3e800a){if(_0x3e800a){_0x26c437=_0x3e800a;_0x4db13e[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db['CmList'][_0x9a16('0x2b')]);_0x4db13e[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x318553['query']);_0x4db13e[_0x9a16('0x31')]=_['intersection'](_0x4db13e[_0x9a16('0x2d')],_0x4db13e[_0x9a16('0x2f')]);_0x29d474[_0x9a16('0x33')]=_['intersection'](_0x4db13e[_0x9a16('0x2d')],qs['fields'](_0x318553[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x29d474[_0x9a16('0x33')]=_0x29d474['attributes'][_0x9a16('0x35')]?_0x29d474[_0x9a16('0x33')]:_0x4db13e[_0x9a16('0x2d')];_0x29d474[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x318553[_0x9a16('0x2f')][_0x9a16('0x39')]);_0x29d474[_0x9a16('0x3a')]=qs['filters'](_['pick'](_0x318553[_0x9a16('0x2f')],_0x4db13e[_0x9a16('0x31')]));if(_0x318553[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x29d474[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0x29d474[_0x9a16('0x3a')],{'$or':_[_0x9a16('0x2e')](_0x29d474[_0x9a16('0x33')],function(_0x3f77b2){var _0x2c23d2={};_0x2c23d2[_0x3f77b2]={'$like':'%'+_0x318553[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0x2c23d2;})});}_0x29d474=_[_0x9a16('0x3e')]({},_0x29d474,_0x318553['options']);return _0x26c437[_0x9a16('0x81')](_0x29d474);}})[_0x9a16('0x24')](function(_0x18d16d){if(_0x18d16d){_0x1a7e4c=_0x18d16d[_0x9a16('0x35')];if(!_0x318553[_0x9a16('0x2f')][_0x9a16('0x36')]('nolimit')){_0x29d474[_0x9a16('0x1d')]=qs[_0x9a16('0x1d')](_0x318553[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0x29d474[_0x9a16('0x1b')]=qs[_0x9a16('0x1b')](_0x318553['query'][_0x9a16('0x1b')]);}return _0x26c437[_0x9a16('0x81')](_0x29d474);}})[_0x9a16('0x24')](function(_0x4aa7a5){if(_0x4aa7a5){return _0x4aa7a5?{'count':_0x1a7e4c,'rows':_0x4aa7a5}:null;}})[_0x9a16('0x24')](respondWithResult(_0x23e42f,null))[_0x9a16('0x45')](handleError(_0x23e42f,null));};exports[_0x9a16('0x82')]=function(_0x442c2a,_0x577692,_0x3e8c12){var _0xcd787,_0x6a5bff;return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x442c2a['params']['id']}})['then'](handleEntityNotFound(_0x577692,null))['then'](function(_0xbb1d3b){if(_0xbb1d3b){_0x6a5bff=_0xbb1d3b;return _0xbb1d3b[_0x9a16('0x82')](_0x442c2a[_0x9a16('0x53')][_0x9a16('0x63')],_[_0x9a16('0x54')](_0x442c2a[_0x9a16('0x53')],[_0x9a16('0x63'),'id'])||{});}return null;})[_0x9a16('0x83')](function(_0x4817be){var _0x64f946;_0xcd787=_0x4817be||[];var _0x20777a=[];if(_0x4817be){for(var _0x5a553b=0x0;_0x5a553b<_0x4817be[_0x9a16('0x35')];_0x5a553b+=0x1){var _0xe45c1e=_0x4817be[_0x5a553b][_0x9a16('0x25')]({'plain':!![]});_0x64f946=squel[_0x9a16('0x66')]()[_0x9a16('0x67')](_0x9a16('0x84'))[_0x9a16('0x69')]([_0x9a16('0x6a'),_0x9a16('0x6c'),_0x9a16('0x70'),'CampaignId',_0x9a16('0x55'),'updatedAt'],squel['select']()[_0x9a16('0x6d')](_0x9a16('0x6a'),_0x9a16('0x6a'))[_0x9a16('0x6d')]('id',_0x9a16('0x6c'))['field'](_0xe45c1e['CmListId']['toString'](),_0x9a16('0x70'))['field'](_0x442c2a['params']['id'][_0x9a16('0x6f')](),_0x9a16('0x5a'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x55'))['field'](_0x9a16('0x6e'),'updatedAt')['from']('cm_contacts')[_0x9a16('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0x9a16('0x73'),_0xe45c1e[_0x9a16('0x74')]['toString']())[_0x9a16('0x3a')](_0x9a16('0x75')))[_0x9a16('0x6f')]();_0x20777a['push'](db[_0x9a16('0x85')]['query'](_0x64f946));}return BPromise['all'](_0x20777a);}})['then'](function(){return _0xcd787;})[_0x9a16('0x24')](respondWithResult(_0x577692,null))['catch'](handleError(_0x577692,null));};exports['removeBlackLists']=function(_0x171a01,_0x12b247,_0x30f28e){return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x171a01[_0x9a16('0x47')]['id']}})['then'](handleEntityNotFound(_0x12b247,null))[_0x9a16('0x24')](function(_0x3906d4){if(_0x3906d4){return _0x3906d4[_0x9a16('0x86')](_0x171a01[_0x9a16('0x2f')][_0x9a16('0x63')]);}})['then'](function(_0xaac4ab){if(_0xaac4ab){return db[_0x9a16('0x60')][_0x9a16('0x27')]({'where':{'ListId':_0x171a01['query'][_0x9a16('0x63')],'CampaignId':_0x171a01[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](function(){return _0xaac4ab;});}})[_0x9a16('0x24')](respondWithStatusCode(_0x12b247,null))[_0x9a16('0x45')](handleError(_0x12b247,null));};
\ No newline at end of file
diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js
index aaa0bfa..4d4ddaa 100644
--- a/server/api/campaign/campaign.model.js
+++ b/server/api/campaign/campaign.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x14e589,_0x5d5c97){var _0x4ceb8c=function(_0x55f065){while(--_0x55f065){_0x14e589['push'](_0x14e589['shift']());}};_0x4ceb8c(++_0x5d5c97);}(_0x7a54,0x106));var _0x47a5=function(_0x522bef,_0x4b6cae){_0x522bef=_0x522bef-0x0;var _0x38c629=_0x7a54[_0x522bef];return _0x38c629;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js
index 7cfa0ea..ddc5ee1 100644
--- a/server/api/campaign/campaign.rpc.js
+++ b/server/api/campaign/campaign.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc252=['raw','where','attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCampaign','Campaign','findAll','options'];(function(_0x14996e,_0x108636){var _0x2f0151=function(_0x20dd91){while(--_0x20dd91){_0x14996e['push'](_0x14996e['shift']());}};_0x2f0151(++_0x108636);}(_0xc252,0x118));var _0x2c25=function(_0x22650a,_0x4de8e4){_0x22650a=_0x22650a-0x0;var _0x87dc8d=_0xc252[_0x22650a];return _0x87dc8d;};'use strict';var _=require(_0x2c25('0x0'));var util=require(_0x2c25('0x1'));var moment=require(_0x2c25('0x2'));var BPromise=require(_0x2c25('0x3'));var rs=require(_0x2c25('0x4'));var fs=require('fs');var Redis=require(_0x2c25('0x5'));var db=require(_0x2c25('0x6'))['db'];var utils=require(_0x2c25('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2c25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2c25('0x9')][_0x2c25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39972f,_0x1ec60a,_0x5f1278){return new BPromise(function(_0x491314,_0x16f20){return client[_0x2c25('0xb')](_0x39972f,_0x5f1278)[_0x2c25('0xc')](function(_0x1f927e){logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1ec60a,_0x2c25('0xf'));logger['debug'](_0x2c25('0x10'),_0x1ec60a,'request\x20sent',JSON[_0x2c25('0x11')](_0x1f927e));if(_0x1f927e['error']){if(_0x1f927e[_0x2c25('0x12')][_0x2c25('0x13')]===0x1f4){logger['error'](_0x2c25('0xe'),_0x1ec60a,_0x1f927e[_0x2c25('0x12')]['message']);return _0x16f20(_0x1f927e['error'][_0x2c25('0x14')]);}logger[_0x2c25('0x12')](_0x2c25('0xe'),_0x1ec60a,_0x1f927e[_0x2c25('0x12')][_0x2c25('0x14')]);return _0x491314(_0x1f927e[_0x2c25('0x12')][_0x2c25('0x14')]);}else{logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1ec60a,'request\x20sent');_0x491314(_0x1f927e['result'][_0x2c25('0x14')]);}})[_0x2c25('0x15')](function(_0x8b04ce){logger['error'](_0x2c25('0xe'),_0x1ec60a,_0x8b04ce);_0x16f20(_0x8b04ce);});});}exports[_0x2c25('0x16')]=function(_0x28093a){var _0x19ff99=this;return new Promise(function(_0x4bfc1e,_0xe0af6){return db[_0x2c25('0x17')][_0x2c25('0x18')]({'raw':_0x28093a[_0x2c25('0x19')]?_0x28093a['options'][_0x2c25('0x1a')]===undefined?!![]:![]:!![],'where':_0x28093a['options']?_0x28093a['options'][_0x2c25('0x1b')]||null:null,'attributes':_0x28093a['options']?_0x28093a[_0x2c25('0x19')][_0x2c25('0x1c')]||null:null,'limit':_0x28093a[_0x2c25('0x19')]?_0x28093a[_0x2c25('0x19')][_0x2c25('0x1d')]||null:null,'include':_0x28093a[_0x2c25('0x19')]?_0x28093a[_0x2c25('0x19')][_0x2c25('0x1e')]?_[_0x2c25('0x1f')](_0x28093a[_0x2c25('0x19')][_0x2c25('0x1e')],function(_0x516ed1){return{'model':db[_0x516ed1['model']],'as':_0x516ed1['as'],'attributes':_0x516ed1[_0x2c25('0x1c')],'include':_0x516ed1['include']?_[_0x2c25('0x1f')](_0x516ed1[_0x2c25('0x1e')],function(_0x41c26b){return{'model':db[_0x41c26b[_0x2c25('0x20')]],'as':_0x41c26b['as'],'attributes':_0x41c26b[_0x2c25('0x1c')],'include':_0x41c26b['include']?_[_0x2c25('0x1f')](_0x41c26b[_0x2c25('0x1e')],function(_0x3f6906){return{'model':db[_0x3f6906['model']],'as':_0x3f6906['as'],'attributes':_0x3f6906[_0x2c25('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa7cbb6){logger[_0x2c25('0xd')]('GetCampaign',_0x28093a);logger[_0x2c25('0x21')](_0x2c25('0x16'),_0x28093a,JSON['stringify'](_0xa7cbb6));_0x4bfc1e(_0xa7cbb6);})[_0x2c25('0x15')](function(_0x4a8193){logger['error'](_0x2c25('0x16'),_0x4a8193[_0x2c25('0x14')],_0x28093a);_0xe0af6(_0x19ff99[_0x2c25('0x12')](0x1f4,_0x4a8193[_0x2c25('0x14')]));});});};
\ No newline at end of file
+var _0x4403=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCampaign','findAll','options','raw','where','attributes','include','model','map'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4403,0x179));var _0x3440=function(_0x136de0,_0xed928c){_0x136de0=_0x136de0-0x0;var _0x3a08df=_0x4403[_0x136de0];return _0x3a08df;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3440('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3440('0x1'));var db=require(_0x3440('0x2'))['db'];var utils=require(_0x3440('0x3'));var logger=require(_0x3440('0x4'))('rpc');var config=require(_0x3440('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3440('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3121bd,_0x338e48,_0x4abc5a){return new BPromise(function(_0x33a070,_0x59d581){return client[_0x3440('0x7')](_0x3121bd,_0x4abc5a)[_0x3440('0x8')](function(_0x4559cd){logger['info'](_0x3440('0x9'),_0x338e48,_0x3440('0xa'));logger[_0x3440('0xb')](_0x3440('0xc'),_0x338e48,_0x3440('0xa'),JSON[_0x3440('0xd')](_0x4559cd));if(_0x4559cd[_0x3440('0xe')]){if(_0x4559cd['error'][_0x3440('0xf')]===0x1f4){logger[_0x3440('0xe')](_0x3440('0x9'),_0x338e48,_0x4559cd['error'][_0x3440('0x10')]);return _0x59d581(_0x4559cd[_0x3440('0xe')][_0x3440('0x10')]);}logger[_0x3440('0xe')](_0x3440('0x9'),_0x338e48,_0x4559cd['error'][_0x3440('0x10')]);return _0x33a070(_0x4559cd['error'][_0x3440('0x10')]);}else{logger[_0x3440('0x11')](_0x3440('0x9'),_0x338e48,_0x3440('0xa'));_0x33a070(_0x4559cd[_0x3440('0x12')][_0x3440('0x10')]);}})[_0x3440('0x13')](function(_0xb66a69){logger['error'](_0x3440('0x9'),_0x338e48,_0xb66a69);_0x59d581(_0xb66a69);});});}exports[_0x3440('0x14')]=function(_0x43fd39){var _0x1c10fd=this;return new Promise(function(_0x31a8dd,_0x39ee81){return db['Campaign'][_0x3440('0x15')]({'raw':_0x43fd39[_0x3440('0x16')]?_0x43fd39[_0x3440('0x16')][_0x3440('0x17')]===undefined?!![]:![]:!![],'where':_0x43fd39[_0x3440('0x16')]?_0x43fd39[_0x3440('0x16')][_0x3440('0x18')]||null:null,'attributes':_0x43fd39[_0x3440('0x16')]?_0x43fd39[_0x3440('0x16')][_0x3440('0x19')]||null:null,'limit':_0x43fd39[_0x3440('0x16')]?_0x43fd39['options']['limit']||null:null,'include':_0x43fd39['options']?_0x43fd39[_0x3440('0x16')][_0x3440('0x1a')]?_['map'](_0x43fd39[_0x3440('0x16')][_0x3440('0x1a')],function(_0x33cfb5){return{'model':db[_0x33cfb5[_0x3440('0x1b')]],'as':_0x33cfb5['as'],'attributes':_0x33cfb5[_0x3440('0x19')],'include':_0x33cfb5['include']?_[_0x3440('0x1c')](_0x33cfb5[_0x3440('0x1a')],function(_0x3b9e75){return{'model':db[_0x3b9e75[_0x3440('0x1b')]],'as':_0x3b9e75['as'],'attributes':_0x3b9e75[_0x3440('0x19')],'include':_0x3b9e75['include']?_[_0x3440('0x1c')](_0x3b9e75[_0x3440('0x1a')],function(_0x1cfe3a){return{'model':db[_0x1cfe3a[_0x3440('0x1b')]],'as':_0x1cfe3a['as'],'attributes':_0x1cfe3a[_0x3440('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x391728){logger[_0x3440('0x11')](_0x3440('0x14'),_0x43fd39);logger[_0x3440('0xb')](_0x3440('0x14'),_0x43fd39,JSON[_0x3440('0xd')](_0x391728));_0x31a8dd(_0x391728);})[_0x3440('0x13')](function(_0x1f7fee){logger[_0x3440('0xe')](_0x3440('0x14'),_0x1f7fee[_0x3440('0x10')],_0x43fd39);_0x39ee81(_0x1c10fd['error'](0x1f4,_0x1f7fee['message']));});});};
\ No newline at end of file
diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js
index bf6aed5..83500fe 100644
--- a/server/api/campaign/index.js
+++ b/server/api/campaign/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x2463=['removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addBlackLists','put','update','delete'];(function(_0x4aaffa,_0x1cb820){var _0x332342=function(_0xf099d4){while(--_0xf099d4){_0x4aaffa['push'](_0x4aaffa['shift']());}};_0x332342(++_0x1cb820);}(_0x2463,0xf7));var _0x3246=function(_0x47dc4a,_0x370407){_0x47dc4a=_0x47dc4a-0x0;var _0x254a3a=_0x2463[_0x47dc4a];return _0x254a3a;};'use strict';var multer=require(_0x3246('0x0'));var util=require(_0x3246('0x1'));var path=require(_0x3246('0x2'));var timeout=require(_0x3246('0x3'));var express=require(_0x3246('0x4'));var router=express[_0x3246('0x5')]();var fs_extra=require(_0x3246('0x6'));var auth=require(_0x3246('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3246('0x8'));var controller=require('./campaign.controller');router['get']('/',auth[_0x3246('0x9')](),controller[_0x3246('0xa')]);router[_0x3246('0xb')](_0x3246('0xc'),auth['isAuthenticated'](),controller[_0x3246('0xd')]);router[_0x3246('0xb')](_0x3246('0xe'),auth[_0x3246('0x9')](),controller[_0x3246('0xf')]);router['get'](_0x3246('0x10'),auth[_0x3246('0x9')](),controller[_0x3246('0x11')]);router[_0x3246('0xb')](_0x3246('0x12'),auth[_0x3246('0x9')](),controller[_0x3246('0x13')]);router['get'](_0x3246('0x14'),auth['isAuthenticated'](),controller[_0x3246('0x15')]);router[_0x3246('0xb')]('/:id/lists',auth[_0x3246('0x9')](),controller['getLists']);router[_0x3246('0xb')](_0x3246('0x16'),auth[_0x3246('0x9')](),controller[_0x3246('0x17')]);router[_0x3246('0x18')]('/',auth['isAuthenticated'](),controller[_0x3246('0x19')]);router[_0x3246('0x18')](_0x3246('0x1a'),auth[_0x3246('0x9')](),controller[_0x3246('0x1b')]);router[_0x3246('0x18')](_0x3246('0x1c'),auth[_0x3246('0x9')](),controller['addLists']);router['post'](_0x3246('0x16'),auth['isAuthenticated'](),controller[_0x3246('0x1d')]);router[_0x3246('0x1e')](_0x3246('0xc'),auth[_0x3246('0x9')](),controller[_0x3246('0x1f')]);router[_0x3246('0x20')]('/:id',auth[_0x3246('0x9')](),controller['destroy']);router[_0x3246('0x20')](_0x3246('0x1c'),auth['isAuthenticated'](),controller[_0x3246('0x21')]);router[_0x3246('0x20')]('/:id/blacklists',auth[_0x3246('0x9')](),controller[_0x3246('0x22')]);module['exports']=router;
\ No newline at end of file
+var _0xa051=['./campaign.controller','isAuthenticated','index','/:id','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','put','update','destroy','delete','removeLists','removeBlackLists','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0xa051,0x156));var _0x1a05=function(_0x48d94e,_0xfbb342){_0x48d94e=_0x48d94e-0x0;var _0x1fd8e8=_0xa051[_0x48d94e];return _0x1fd8e8;};'use strict';var multer=require(_0x1a05('0x0'));var util=require('util');var path=require(_0x1a05('0x1'));var timeout=require('connect-timeout');var express=require(_0x1a05('0x2'));var router=express[_0x1a05('0x3')]();var fs_extra=require(_0x1a05('0x4'));var auth=require(_0x1a05('0x5'));var interaction=require(_0x1a05('0x6'));var config=require(_0x1a05('0x7'));var controller=require(_0x1a05('0x8'));router['get']('/',auth[_0x1a05('0x9')](),controller[_0x1a05('0xa')]);router['get'](_0x1a05('0xb'),auth[_0x1a05('0x9')](),controller[_0x1a05('0xc')]);router[_0x1a05('0xd')](_0x1a05('0xe'),auth[_0x1a05('0x9')](),controller[_0x1a05('0xf')]);router[_0x1a05('0xd')](_0x1a05('0x10'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x11')]);router[_0x1a05('0xd')](_0x1a05('0x12'),auth['isAuthenticated'](),controller[_0x1a05('0x13')]);router[_0x1a05('0xd')]('/:id/hopper_black',auth[_0x1a05('0x9')](),controller['getHopperBlacks']);router[_0x1a05('0xd')](_0x1a05('0x14'),auth['isAuthenticated'](),controller[_0x1a05('0x15')]);router[_0x1a05('0xd')](_0x1a05('0x16'),auth['isAuthenticated'](),controller[_0x1a05('0x17')]);router[_0x1a05('0x18')]('/',auth['isAuthenticated'](),controller[_0x1a05('0x19')]);router['post'](_0x1a05('0x1a'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x1b')]);router[_0x1a05('0x18')](_0x1a05('0x14'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0x1a05('0x16'),auth[_0x1a05('0x9')](),controller['addBlackLists']);router[_0x1a05('0x1c')](_0x1a05('0xb'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x1d')]);router['delete'](_0x1a05('0xb'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x1e')]);router[_0x1a05('0x1f')](_0x1a05('0x14'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x20')]);router[_0x1a05('0x1f')](_0x1a05('0x16'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x21')]);module[_0x1a05('0x22')]=router;
\ No newline at end of file
diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js
index 1f52519..c6465cf 100644
--- a/server/api/cannedAnswer/cannedAnswer.attributes.js
+++ b/server/api/cannedAnswer/cannedAnswer.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x4fa6=['STRING','VIRTUAL','sequelize','exports'];(function(_0x1cc9b2,_0xe77730){var _0x30b919=function(_0x122a33){while(--_0x122a33){_0x1cc9b2['push'](_0x1cc9b2['shift']());}};_0x30b919(++_0xe77730);}(_0x4fa6,0x162));var _0x64fa=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x4fa6[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x64fa('0x0'));module[_0x64fa('0x1')]={'key':{'type':Sequelize[_0x64fa('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x64fa('0x3')],'get':function(){return this['getDataValue']('key');}}};
\ No newline at end of file
+var _0xf0f6=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x482404,_0x15fb83){var _0x3e8826=function(_0x188b5e){while(--_0x188b5e){_0x482404['push'](_0x482404['shift']());}};_0x3e8826(++_0x15fb83);}(_0xf0f6,0x159));var _0x6f0f=function(_0x1ea797,_0x158bed){_0x1ea797=_0x1ea797-0x0;var _0x420fba=_0xf0f6[_0x1ea797];return _0x420fba;};'use strict';var Sequelize=require(_0x6f0f('0x0'));module[_0x6f0f('0x1')]={'key':{'type':Sequelize[_0x6f0f('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x6f0f('0x2')]},'name':{'type':Sequelize[_0x6f0f('0x3')],'get':function(){return this[_0x6f0f('0x4')](_0x6f0f('0x5'));}}};
\ No newline at end of file
diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js
index 164ab13..c426712 100644
--- a/server/api/cannedAnswer/cannedAnswer.controller.js
+++ b/server/api/cannedAnswer/cannedAnswer.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x0163=['apply','reject','update','destroy','get','CannedAnswers','then','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','CannedAnswer','includeAll','findAll','rows','show','params','include','options','find','catch','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','undefined','limit','count','offset','json'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x0163,0x136));var _0x3016=function(_0x4e41db,_0xf3e14c){_0x4e41db=_0x4e41db-0x0;var _0x6255cc=_0x0163[_0x4e41db];return _0x6255cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3016('0x0'));var zipdir=require(_0x3016('0x1'));var jsonpatch=require(_0x3016('0x2'));var rp=require(_0x3016('0x3'));var moment=require(_0x3016('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3016('0x5'));var util=require(_0x3016('0x6'));var path=require('path');var sox=require(_0x3016('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3016('0x8'));var _=require(_0x3016('0x9'));var squel=require(_0x3016('0xa'));var crypto=require(_0x3016('0xb'));var jsforce=require(_0x3016('0xc'));var deskjs=require(_0x3016('0xd'));var toCsv=require(_0x3016('0xe'));var querystring=require(_0x3016('0xf'));var Papa=require('papaparse');var Redis=require(_0x3016('0x10'));var authService=require(_0x3016('0x11'));var qs=require(_0x3016('0x12'));var as=require(_0x3016('0x13'));var hardwareService=require(_0x3016('0x14'));var logger=require('../../config/logger')(_0x3016('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x552fbf,_0x4aed71){_0x4aed71=_0x4aed71||0xcc;return function(_0x44055b){if(_0x44055b){return _0x552fbf[_0x3016('0x16')](_0x4aed71);}return _0x552fbf[_0x3016('0x17')](_0x4aed71)[_0x3016('0x18')]();};}function respondWithResult(_0x1c56ca,_0x36a673){_0x36a673=_0x36a673||0xc8;return function(_0x20b5b0){if(_0x20b5b0){return _0x1c56ca[_0x3016('0x17')](_0x36a673)['json'](_0x20b5b0);}};}function respondWithFilteredResult(_0x24d187,_0xe0ea99){return function(_0x1474ba){if(_0x1474ba){var _0x5834a5=typeof _0xe0ea99['offset']===_0x3016('0x19')&&typeof _0xe0ea99[_0x3016('0x1a')]==='undefined';var _0x91c30c=_0x1474ba[_0x3016('0x1b')];var _0x41871f=_0x5834a5?0x0:_0xe0ea99[_0x3016('0x1c')];var _0x306404=_0x5834a5?_0x1474ba['count']:_0xe0ea99['offset']+_0xe0ea99[_0x3016('0x1a')];var _0x192f7b;if(_0x306404>=_0x91c30c){_0x306404=_0x91c30c;_0x192f7b=0xc8;}else{_0x192f7b=0xce;}_0x24d187[_0x3016('0x17')](_0x192f7b);return _0x24d187['set']('Content-Range',_0x41871f+'-'+_0x306404+'/'+_0x91c30c)[_0x3016('0x1d')](_0x1474ba);}return null;};}function patchUpdates(_0x209e76){return function(_0x2528dc){try{jsonpatch[_0x3016('0x1e')](_0x2528dc,_0x209e76,!![]);}catch(_0x161bb8){return BPromise[_0x3016('0x1f')](_0x161bb8);}return _0x2528dc['save']();};}function saveUpdates(_0x5dcc36,_0x13c439){return function(_0x5f1927){if(_0x5f1927){return _0x5f1927[_0x3016('0x20')](_0x5dcc36)['then'](function(_0xc315fa){return _0xc315fa;});}return null;};}function removeEntity(_0x2f643d,_0x3fce13){return function(_0x374e9b){if(_0x374e9b){return _0x374e9b[_0x3016('0x21')]()['then'](function(){var _0x4900a0=_0x374e9b[_0x3016('0x22')]({'plain':!![]});var _0x30c351=_0x3016('0x23');return db['UserProfileResource'][_0x3016('0x21')]({'where':{'type':_0x30c351,'resourceId':_0x4900a0['id']}})[_0x3016('0x24')](function(){return _0x374e9b;});})[_0x3016('0x24')](function(){_0x2f643d[_0x3016('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec530,_0x538bd2){return function(_0x342424){if(!_0x342424){_0x5ec530[_0x3016('0x16')](0x194);}return _0x342424;};}function handleError(_0x5919ce,_0x59556b){_0x59556b=_0x59556b||0x1f4;return function(_0xbe60d9){logger['error'](_0xbe60d9['stack']);if(_0xbe60d9[_0x3016('0x25')]){delete _0xbe60d9['name'];}_0x5919ce[_0x3016('0x17')](_0x59556b)['send'](_0xbe60d9);};}exports[_0x3016('0x26')]=function(_0x405862,_0x3113e3){var _0x48ce62={},_0x35d6fc={},_0x39da7c={'count':0x0,'rows':[]};var _0x5aa594=_[_0x3016('0x27')](db['CannedAnswer'][_0x3016('0x28')],function(_0x264ec9){return{'name':_0x264ec9[_0x3016('0x29')],'type':_0x264ec9[_0x3016('0x2a')][_0x3016('0x2b')]};});_0x35d6fc[_0x3016('0x2c')]=_[_0x3016('0x27')](_0x5aa594,_0x3016('0x25'));_0x35d6fc[_0x3016('0x2d')]=_[_0x3016('0x2e')](_0x405862[_0x3016('0x2d')]);_0x35d6fc[_0x3016('0x2f')]=_['intersection'](_0x35d6fc[_0x3016('0x2c')],_0x35d6fc[_0x3016('0x2d')]);_0x48ce62['attributes']=_[_0x3016('0x30')](_0x35d6fc[_0x3016('0x2c')],qs['fields'](_0x405862['query'][_0x3016('0x31')]));_0x48ce62[_0x3016('0x32')]=_0x48ce62[_0x3016('0x32')][_0x3016('0x33')]?_0x48ce62[_0x3016('0x32')]:_0x35d6fc['model'];if(!_0x405862[_0x3016('0x2d')][_0x3016('0x34')](_0x3016('0x35'))){_0x48ce62[_0x3016('0x1a')]=qs[_0x3016('0x1a')](_0x405862[_0x3016('0x2d')][_0x3016('0x1a')]);_0x48ce62[_0x3016('0x1c')]=qs[_0x3016('0x1c')](_0x405862[_0x3016('0x2d')][_0x3016('0x1c')]);}_0x48ce62[_0x3016('0x36')]=qs[_0x3016('0x37')](_0x405862[_0x3016('0x2d')][_0x3016('0x37')]);_0x48ce62['where']=qs[_0x3016('0x2f')](_[_0x3016('0x38')](_0x405862['query'],_0x35d6fc[_0x3016('0x2f')]),_0x5aa594);if(_0x405862[_0x3016('0x2d')][_0x3016('0x39')]){_0x48ce62[_0x3016('0x3a')]=_[_0x3016('0x3b')](_0x48ce62[_0x3016('0x3a')],{'$or':[{'key':{'$like':'%'+_0x405862[_0x3016('0x2d')]['filter']+'%'}},{'value':{'$like':'%'+_0x405862[_0x3016('0x2d')][_0x3016('0x39')]+'%'}}]});}_0x48ce62=_[_0x3016('0x3b')]({},_0x48ce62,_0x405862['options']);var _0x4b6dca={'where':_0x48ce62['where']};return db[_0x3016('0x3c')][_0x3016('0x1b')](_0x4b6dca)[_0x3016('0x24')](function(_0x139e59){_0x39da7c['count']=_0x139e59;if(_0x405862[_0x3016('0x2d')][_0x3016('0x3d')]){_0x48ce62['include']=[{'all':!![]}];}return db[_0x3016('0x3c')][_0x3016('0x3e')](_0x48ce62);})[_0x3016('0x24')](function(_0x5184f3){_0x39da7c[_0x3016('0x3f')]=_0x5184f3;return _0x39da7c;})[_0x3016('0x24')](respondWithFilteredResult(_0x3113e3,_0x48ce62))['catch'](handleError(_0x3113e3,null));};exports[_0x3016('0x40')]=function(_0x1caeaa,_0x3a5b9c){var _0x1b0d98={'raw':!![],'where':{'id':_0x1caeaa[_0x3016('0x41')]['id']}},_0x509c71={};_0x509c71[_0x3016('0x2c')]=_[_0x3016('0x2e')](db[_0x3016('0x3c')][_0x3016('0x28')]);_0x509c71['query']=_[_0x3016('0x2e')](_0x1caeaa[_0x3016('0x2d')]);_0x509c71['filters']=_[_0x3016('0x30')](_0x509c71[_0x3016('0x2c')],_0x509c71[_0x3016('0x2d')]);_0x1b0d98[_0x3016('0x32')]=_[_0x3016('0x30')](_0x509c71['model'],qs['fields'](_0x1caeaa[_0x3016('0x2d')][_0x3016('0x31')]));_0x1b0d98[_0x3016('0x32')]=_0x1b0d98[_0x3016('0x32')]['length']?_0x1b0d98[_0x3016('0x32')]:_0x509c71[_0x3016('0x2c')];if(_0x1caeaa[_0x3016('0x2d')][_0x3016('0x3d')]){_0x1b0d98[_0x3016('0x42')]=[{'all':!![]}];}_0x1b0d98=_[_0x3016('0x3b')]({},_0x1b0d98,_0x1caeaa[_0x3016('0x43')]);return db[_0x3016('0x3c')][_0x3016('0x44')](_0x1b0d98)['then'](handleEntityNotFound(_0x3a5b9c,null))[_0x3016('0x24')](respondWithResult(_0x3a5b9c,null))[_0x3016('0x45')](handleError(_0x3a5b9c,null));};exports[_0x3016('0x20')]=function(_0x5b2ce6,_0x322e1a){if(_0x5b2ce6['body']['id']){delete _0x5b2ce6[_0x3016('0x46')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x5b2ce6[_0x3016('0x41')]['id']}})[_0x3016('0x24')](handleEntityNotFound(_0x322e1a,null))[_0x3016('0x24')](saveUpdates(_0x5b2ce6[_0x3016('0x46')],null))[_0x3016('0x24')](respondWithResult(_0x322e1a,null))['catch'](handleError(_0x322e1a,null));};exports[_0x3016('0x21')]=function(_0x805295,_0x2acd13){return db[_0x3016('0x3c')][_0x3016('0x44')]({'where':{'id':_0x805295[_0x3016('0x41')]['id']}})[_0x3016('0x24')](handleEntityNotFound(_0x2acd13,null))[_0x3016('0x24')](removeEntity(_0x2acd13,null))['catch'](handleError(_0x2acd13,null));};exports['create']=function(_0x55f823,_0x1a8572){var _0x15beae={'key':_0x55f823['body'][_0x3016('0x2b')]};if(_0x55f823[_0x3016('0x46')][_0x3016('0x47')]){_0x15beae[_0x3016('0x47')]=_0x55f823[_0x3016('0x46')][_0x3016('0x47')];}else if(_0x55f823[_0x3016('0x46')][_0x3016('0x48')]){_0x15beae['SmsAccountId']=_0x55f823[_0x3016('0x46')]['SmsAccountId'];}else if(_0x55f823[_0x3016('0x46')][_0x3016('0x49')]){_0x15beae[_0x3016('0x49')]=_0x55f823['body']['OpenchannelAccountId'];}else if(_0x55f823[_0x3016('0x46')]['ChatWebsiteId']){_0x15beae[_0x3016('0x4a')]=_0x55f823[_0x3016('0x46')][_0x3016('0x4a')];}return db[_0x3016('0x3c')][_0x3016('0x44')]({'where':_0x15beae})[_0x3016('0x24')](function(_0x21b8ea){if(_0x21b8ea){throw new db[(_0x3016('0x4b'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x3016('0x3c')][_0x3016('0x4c')](_0x55f823[_0x3016('0x46')]);})[_0x3016('0x24')](function(_0x349522){var _0x485577=_0x55f823[_0x3016('0x4d')]['get']({'plain':!![]});if(!_0x485577)throw new Error(_0x3016('0x4e'));if(_0x485577[_0x3016('0x4f')]===_0x3016('0x4d')){var _0x12e7d9=_0x349522[_0x3016('0x22')]({'plain':!![]});return db[_0x3016('0x50')][_0x3016('0x44')]({'where':{'name':_0x3016('0x23'),'userProfileId':_0x485577[_0x3016('0x51')]},'raw':!![]})[_0x3016('0x24')](function(_0x4457e0){if(_0x4457e0&&_0x4457e0[_0x3016('0x52')]===0x0){return db[_0x3016('0x53')][_0x3016('0x4c')]({'name':_0x12e7d9['name'],'resourceId':_0x12e7d9['id'],'type':_0x4457e0[_0x3016('0x25')],'sectionId':_0x4457e0['id']},{})[_0x3016('0x24')](function(){return _0x349522;});}else{return _0x349522;}})[_0x3016('0x45')](function(_0x28284b){logger['error'](_0x3016('0x54'),_0x28284b);throw _0x28284b;});}return _0x349522;})[_0x3016('0x24')](respondWithResult(_0x1a8572,0xc9))[_0x3016('0x45')](handleError(_0x1a8572,null));};
\ No newline at end of file
+var _0x78f0=['map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','include','CannedAnswer','findAll','show','options','find','catch','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','name','index','rawAttributes','type','key','model'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x78f0,0x75));var _0x078f=function(_0x170b3e,_0x46abbf){_0x170b3e=_0x170b3e-0x0;var _0xff2428=_0x78f0[_0x170b3e];return _0xff2428;};'use strict';var emlformat=require(_0x078f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x078f('0x1'));var rp=require(_0x078f('0x2'));var moment=require(_0x078f('0x3'));var BPromise=require(_0x078f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x078f('0x5'));var sox=require(_0x078f('0x6'));var csv=require(_0x078f('0x7'));var ejs=require(_0x078f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x078f('0x9'));var crypto=require(_0x078f('0xa'));var jsforce=require(_0x078f('0xb'));var deskjs=require(_0x078f('0xc'));var toCsv=require(_0x078f('0x7'));var querystring=require('querystring');var Papa=require(_0x078f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x078f('0xe'));var as=require(_0x078f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x078f('0x10'));var utils=require('../../config/utils');var config=require(_0x078f('0x11'));var licenseUtil=require(_0x078f('0x12'));var db=require(_0x078f('0x13'))['db'];function respondWithStatusCode(_0x34d250,_0x8c2cb5){_0x8c2cb5=_0x8c2cb5||0xcc;return function(_0x505cad){if(_0x505cad){return _0x34d250[_0x078f('0x14')](_0x8c2cb5);}return _0x34d250[_0x078f('0x15')](_0x8c2cb5)[_0x078f('0x16')]();};}function respondWithResult(_0x35e44d,_0x2dabf4){_0x2dabf4=_0x2dabf4||0xc8;return function(_0x2a5d84){if(_0x2a5d84){return _0x35e44d['status'](_0x2dabf4)[_0x078f('0x17')](_0x2a5d84);}};}function respondWithFilteredResult(_0x3b86d5,_0x4647b0){return function(_0x45ab09){if(_0x45ab09){var _0x1e8ecb=typeof _0x4647b0['offset']==='undefined'&&typeof _0x4647b0[_0x078f('0x18')]===_0x078f('0x19');var _0x4c44b8=_0x45ab09[_0x078f('0x1a')];var _0x4fca98=_0x1e8ecb?0x0:_0x4647b0[_0x078f('0x1b')];var _0xe0bb18=_0x1e8ecb?_0x45ab09['count']:_0x4647b0[_0x078f('0x1b')]+_0x4647b0['limit'];var _0x4f1eb0;if(_0xe0bb18>=_0x4c44b8){_0xe0bb18=_0x4c44b8;_0x4f1eb0=0xc8;}else{_0x4f1eb0=0xce;}_0x3b86d5[_0x078f('0x15')](_0x4f1eb0);return _0x3b86d5[_0x078f('0x1c')](_0x078f('0x1d'),_0x4fca98+'-'+_0xe0bb18+'/'+_0x4c44b8)[_0x078f('0x17')](_0x45ab09);}return null;};}function patchUpdates(_0xcbe3be){return function(_0x133047){try{jsonpatch[_0x078f('0x1e')](_0x133047,_0xcbe3be,!![]);}catch(_0x4f1452){return BPromise['reject'](_0x4f1452);}return _0x133047[_0x078f('0x1f')]();};}function saveUpdates(_0x2865e7,_0x3951d9){return function(_0x13c9b4){if(_0x13c9b4){return _0x13c9b4[_0x078f('0x20')](_0x2865e7)[_0x078f('0x21')](function(_0x1877d9){return _0x1877d9;});}return null;};}function removeEntity(_0x3af948,_0xfeefbb){return function(_0x10a87c){if(_0x10a87c){return _0x10a87c['destroy']()['then'](function(){var _0x51dea1=_0x10a87c[_0x078f('0x22')]({'plain':!![]});var _0x214dbd=_0x078f('0x23');return db[_0x078f('0x24')][_0x078f('0x25')]({'where':{'type':_0x214dbd,'resourceId':_0x51dea1['id']}})['then'](function(){return _0x10a87c;});})[_0x078f('0x21')](function(){_0x3af948[_0x078f('0x15')](0xcc)[_0x078f('0x16')]();});}};}function handleEntityNotFound(_0x162007,_0x4c4956){return function(_0x513f5f){if(!_0x513f5f){_0x162007[_0x078f('0x14')](0x194);}return _0x513f5f;};}function handleError(_0x3fa572,_0x564b92){_0x564b92=_0x564b92||0x1f4;return function(_0xa16216){logger[_0x078f('0x26')](_0xa16216['stack']);if(_0xa16216[_0x078f('0x27')]){delete _0xa16216[_0x078f('0x27')];}_0x3fa572['status'](_0x564b92)['send'](_0xa16216);};}exports[_0x078f('0x28')]=function(_0xe30a88,_0x5952ea){var _0x103f7f={},_0x292f60={},_0x40c028={'count':0x0,'rows':[]};var _0x5b4596=_['map'](db['CannedAnswer'][_0x078f('0x29')],function(_0x53b18e){return{'name':_0x53b18e['fieldName'],'type':_0x53b18e[_0x078f('0x2a')][_0x078f('0x2b')]};});_0x292f60[_0x078f('0x2c')]=_[_0x078f('0x2d')](_0x5b4596,_0x078f('0x27'));_0x292f60['query']=_[_0x078f('0x2e')](_0xe30a88[_0x078f('0x2f')]);_0x292f60[_0x078f('0x30')]=_[_0x078f('0x31')](_0x292f60[_0x078f('0x2c')],_0x292f60[_0x078f('0x2f')]);_0x103f7f[_0x078f('0x32')]=_[_0x078f('0x31')](_0x292f60[_0x078f('0x2c')],qs['fields'](_0xe30a88[_0x078f('0x2f')][_0x078f('0x33')]));_0x103f7f[_0x078f('0x32')]=_0x103f7f[_0x078f('0x32')][_0x078f('0x34')]?_0x103f7f[_0x078f('0x32')]:_0x292f60[_0x078f('0x2c')];if(!_0xe30a88['query']['hasOwnProperty'](_0x078f('0x35'))){_0x103f7f[_0x078f('0x18')]=qs['limit'](_0xe30a88[_0x078f('0x2f')][_0x078f('0x18')]);_0x103f7f[_0x078f('0x1b')]=qs[_0x078f('0x1b')](_0xe30a88['query']['offset']);}_0x103f7f[_0x078f('0x36')]=qs[_0x078f('0x37')](_0xe30a88[_0x078f('0x2f')][_0x078f('0x37')]);_0x103f7f[_0x078f('0x38')]=qs[_0x078f('0x30')](_[_0x078f('0x39')](_0xe30a88['query'],_0x292f60[_0x078f('0x30')]),_0x5b4596);if(_0xe30a88[_0x078f('0x2f')][_0x078f('0x3a')]){_0x103f7f[_0x078f('0x38')]=_[_0x078f('0x3b')](_0x103f7f[_0x078f('0x38')],{'$or':[{'key':{'$like':'%'+_0xe30a88[_0x078f('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0xe30a88['query'][_0x078f('0x3a')]+'%'}}]});}_0x103f7f=_[_0x078f('0x3b')]({},_0x103f7f,_0xe30a88['options']);var _0x2d154d={'where':_0x103f7f['where']};return db['CannedAnswer'][_0x078f('0x1a')](_0x2d154d)[_0x078f('0x21')](function(_0x4b8ff1){_0x40c028[_0x078f('0x1a')]=_0x4b8ff1;if(_0xe30a88[_0x078f('0x2f')]['includeAll']){_0x103f7f[_0x078f('0x3c')]=[{'all':!![]}];}return db[_0x078f('0x3d')][_0x078f('0x3e')](_0x103f7f);})[_0x078f('0x21')](function(_0x44973f){_0x40c028['rows']=_0x44973f;return _0x40c028;})[_0x078f('0x21')](respondWithFilteredResult(_0x5952ea,_0x103f7f))['catch'](handleError(_0x5952ea,null));};exports[_0x078f('0x3f')]=function(_0x5bc926,_0xd92888){var _0x26a1f8={'raw':!![],'where':{'id':_0x5bc926['params']['id']}},_0xf2b449={};_0xf2b449[_0x078f('0x2c')]=_[_0x078f('0x2e')](db[_0x078f('0x3d')][_0x078f('0x29')]);_0xf2b449['query']=_[_0x078f('0x2e')](_0x5bc926[_0x078f('0x2f')]);_0xf2b449[_0x078f('0x30')]=_[_0x078f('0x31')](_0xf2b449[_0x078f('0x2c')],_0xf2b449['query']);_0x26a1f8[_0x078f('0x32')]=_[_0x078f('0x31')](_0xf2b449[_0x078f('0x2c')],qs[_0x078f('0x33')](_0x5bc926['query'][_0x078f('0x33')]));_0x26a1f8[_0x078f('0x32')]=_0x26a1f8[_0x078f('0x32')]['length']?_0x26a1f8['attributes']:_0xf2b449['model'];if(_0x5bc926[_0x078f('0x2f')]['includeAll']){_0x26a1f8[_0x078f('0x3c')]=[{'all':!![]}];}_0x26a1f8=_[_0x078f('0x3b')]({},_0x26a1f8,_0x5bc926[_0x078f('0x40')]);return db[_0x078f('0x3d')][_0x078f('0x41')](_0x26a1f8)[_0x078f('0x21')](handleEntityNotFound(_0xd92888,null))['then'](respondWithResult(_0xd92888,null))[_0x078f('0x42')](handleError(_0xd92888,null));};exports[_0x078f('0x20')]=function(_0x38c205,_0x169434){if(_0x38c205[_0x078f('0x43')]['id']){delete _0x38c205[_0x078f('0x43')]['id'];}return db[_0x078f('0x3d')]['find']({'where':{'id':_0x38c205[_0x078f('0x44')]['id']}})[_0x078f('0x21')](handleEntityNotFound(_0x169434,null))[_0x078f('0x21')](saveUpdates(_0x38c205[_0x078f('0x43')],null))[_0x078f('0x21')](respondWithResult(_0x169434,null))[_0x078f('0x42')](handleError(_0x169434,null));};exports['destroy']=function(_0x53f2a8,_0xa159a2){return db[_0x078f('0x3d')][_0x078f('0x41')]({'where':{'id':_0x53f2a8[_0x078f('0x44')]['id']}})['then'](handleEntityNotFound(_0xa159a2,null))['then'](removeEntity(_0xa159a2,null))['catch'](handleError(_0xa159a2,null));};exports['create']=function(_0x247757,_0x1fa66a){var _0x364301={'key':_0x247757['body'][_0x078f('0x2b')]};if(_0x247757[_0x078f('0x43')]['MailAccountId']){_0x364301[_0x078f('0x45')]=_0x247757[_0x078f('0x43')]['MailAccountId'];}else if(_0x247757['body'][_0x078f('0x46')]){_0x364301[_0x078f('0x46')]=_0x247757[_0x078f('0x43')]['SmsAccountId'];}else if(_0x247757[_0x078f('0x43')][_0x078f('0x47')]){_0x364301['OpenchannelAccountId']=_0x247757[_0x078f('0x43')][_0x078f('0x47')];}else if(_0x247757[_0x078f('0x43')][_0x078f('0x48')]){_0x364301[_0x078f('0x48')]=_0x247757['body'][_0x078f('0x48')];}return db[_0x078f('0x3d')][_0x078f('0x41')]({'where':_0x364301})[_0x078f('0x21')](function(_0x23a14e){if(_0x23a14e){throw new db['Sequelize'][(_0x078f('0x49'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x078f('0x3d')][_0x078f('0x4a')](_0x247757[_0x078f('0x43')]);})[_0x078f('0x21')](function(_0x918295){var _0x4eb85a=_0x247757[_0x078f('0x4b')]['get']({'plain':!![]});if(!_0x4eb85a)throw new Error(_0x078f('0x4c'));if(_0x4eb85a[_0x078f('0x4d')]===_0x078f('0x4b')){var _0x3ad67c=_0x918295[_0x078f('0x22')]({'plain':!![]});return db[_0x078f('0x4e')][_0x078f('0x41')]({'where':{'name':_0x078f('0x23'),'userProfileId':_0x4eb85a[_0x078f('0x4f')]},'raw':!![]})[_0x078f('0x21')](function(_0x1b3605){if(_0x1b3605&&_0x1b3605[_0x078f('0x50')]===0x0){return db[_0x078f('0x24')][_0x078f('0x4a')]({'name':_0x3ad67c['name'],'resourceId':_0x3ad67c['id'],'type':_0x1b3605[_0x078f('0x27')],'sectionId':_0x1b3605['id']},{})[_0x078f('0x21')](function(){return _0x918295;});}else{return _0x918295;}})['catch'](function(_0xddf7d1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xddf7d1);throw _0xddf7d1;});}return _0x918295;})[_0x078f('0x21')](respondWithResult(_0x1fa66a,0xc9))[_0x078f('0x42')](handleError(_0x1fa66a,null));};
\ No newline at end of file
diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js
index eadd85d..782f257 100644
--- a/server/api/cannedAnswer/cannedAnswer.model.js
+++ b/server/api/cannedAnswer/cannedAnswer.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x06b8=['api','moment','bluebird','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','lodash','../../config/logger'];(function(_0xddc681,_0x261034){var _0xf33bab=function(_0x346fb4){while(--_0x346fb4){_0xddc681['push'](_0xddc681['shift']());}};_0xf33bab(++_0x261034);}(_0x06b8,0x17e));var _0x806b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06b8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x806b('0x0'));var util=require('util');var logger=require(_0x806b('0x1'))(_0x806b('0x2'));var moment=require(_0x806b('0x3'));var BPromise=require(_0x806b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x806b('0x5'));var rimraf=require(_0x806b('0x6'));var config=require('../../config/environment');var attributes=require(_0x806b('0x7'));module[_0x806b('0x8')]=function(_0x35ac2b,_0x1c0eed){return _0x35ac2b[_0x806b('0x9')](_0x806b('0xa'),attributes,{'tableName':_0x806b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x6cb4=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x1f0448,_0xa2865f){var _0x16fe78=function(_0x43517b){while(--_0x43517b){_0x1f0448['push'](_0x1f0448['shift']());}};_0x16fe78(++_0xa2865f);}(_0x6cb4,0x9c));var _0x46cb=function(_0x391ebe,_0x596823){_0x391ebe=_0x391ebe-0x0;var _0x5aac03=_0x6cb4[_0x391ebe];return _0x5aac03;};'use strict';var _=require(_0x46cb('0x0'));var util=require('util');var logger=require(_0x46cb('0x1'))('api');var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46cb('0x4'));var rimraf=require(_0x46cb('0x5'));var config=require(_0x46cb('0x6'));var attributes=require(_0x46cb('0x7'));module[_0x46cb('0x8')]=function(_0x566d65,_0x372630){return _0x566d65[_0x46cb('0x9')](_0x46cb('0xa'),attributes,{'tableName':_0x46cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46cb('0xc'),'collate':_0x46cb('0xd')});};
\ No newline at end of file
diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js
index b1fa760..240521a 100644
--- a/server/api/cannedAnswer/cannedAnswer.rpc.js
+++ b/server/api/cannedAnswer/cannedAnswer.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b9e96,_0x4b7504){var _0x1c1ccf=function(_0x2be7e3){while(--_0x2be7e3){_0x1b9e96['push'](_0x1b9e96['shift']());}};_0x1c1ccf(++_0x4b7504);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
+var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b7204,_0x1081df){var _0x1ea9b7=function(_0x153741){while(--_0x153741){_0x4b7204['push'](_0x4b7204['shift']());}};_0x1ea9b7(++_0x1081df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js
index 8a96a54..a9cceb6 100644
--- a/server/api/cannedAnswer/index.js
+++ b/server/api/cannedAnswer/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x6b09=['/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x45c67f,_0x269e16){var _0x4e6271=function(_0x238da8){while(--_0x238da8){_0x45c67f['push'](_0x45c67f['shift']());}};_0x4e6271(++_0x269e16);}(_0x6b09,0x1d4));var _0x96b0=function(_0x1d69e5,_0x2a29af){_0x1d69e5=_0x1d69e5-0x0;var _0x17da11=_0x6b09[_0x1d69e5];return _0x17da11;};'use strict';var multer=require(_0x96b0('0x0'));var util=require('util');var path=require(_0x96b0('0x1'));var timeout=require(_0x96b0('0x2'));var express=require(_0x96b0('0x3'));var router=express[_0x96b0('0x4')]();var fs_extra=require(_0x96b0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x96b0('0x6'));var config=require(_0x96b0('0x7'));var controller=require(_0x96b0('0x8'));router[_0x96b0('0x9')]('/',auth[_0x96b0('0xa')](),controller[_0x96b0('0xb')]);router[_0x96b0('0x9')](_0x96b0('0xc'),auth[_0x96b0('0xa')](),controller[_0x96b0('0xd')]);router[_0x96b0('0xe')]('/',auth[_0x96b0('0xa')](),controller['create']);router[_0x96b0('0xf')](_0x96b0('0xc'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x10')]);router[_0x96b0('0x11')](_0x96b0('0xc'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x12')]);module[_0x96b0('0x13')]=router;
\ No newline at end of file
+var _0x3eac=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','put'];(function(_0x1e4713,_0x558735){var _0x5cddcb=function(_0x14a8c5){while(--_0x14a8c5){_0x1e4713['push'](_0x1e4713['shift']());}};_0x5cddcb(++_0x558735);}(_0x3eac,0xb4));var _0xc3ea=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x3eac[_0x4b6778];return _0x22dbb9;};'use strict';var multer=require(_0xc3ea('0x0'));var util=require('util');var path=require(_0xc3ea('0x1'));var timeout=require(_0xc3ea('0x2'));var express=require(_0xc3ea('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc3ea('0x4'));var config=require(_0xc3ea('0x5'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xc3ea('0x6')](),controller[_0xc3ea('0x7')]);router[_0xc3ea('0x8')](_0xc3ea('0x9'),auth[_0xc3ea('0x6')](),controller[_0xc3ea('0xa')]);router['post']('/',auth[_0xc3ea('0x6')](),controller['create']);router[_0xc3ea('0xb')](_0xc3ea('0x9'),auth[_0xc3ea('0x6')](),controller[_0xc3ea('0xc')]);router[_0xc3ea('0xd')](_0xc3ea('0x9'),auth[_0xc3ea('0x6')](),controller[_0xc3ea('0xe')]);module[_0xc3ea('0xf')]=router;
\ No newline at end of file
diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js
index ac71bda..04c5cf3 100644
--- a/server/api/cdr/cdr.attributes.js
+++ b/server/api/cdr/cdr.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x902b=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x57bc2e,_0x43754f){var _0x2be43a=function(_0x267fd6){while(--_0x267fd6){_0x57bc2e['push'](_0x57bc2e['shift']());}};_0x2be43a(++_0x43754f);}(_0x902b,0x6a));var _0xb902=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x902b[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xb902('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xb902('0x1')],'allowNull':![],'defaultValue':_0xb902('0x2')},'clid':{'type':Sequelize[_0xb902('0x3')]},'src':{'type':Sequelize[_0xb902('0x3')]},'dst':{'type':Sequelize[_0xb902('0x3')]},'dcontext':{'type':Sequelize[_0xb902('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xb902('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb902('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb902('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xb902('0x3')]},'sequence':{'type':Sequelize[_0xb902('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xb902('0x3')]}};
\ No newline at end of file
+var _0xa0bc=['STRING','INTEGER','exports','DATE'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xca0b('0x0')]={'calldate':{'type':Sequelize[_0xca0b('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xca0b('0x2')]},'src':{'type':Sequelize[_0xca0b('0x2')]},'dst':{'type':Sequelize[_0xca0b('0x2')]},'dcontext':{'type':Sequelize[_0xca0b('0x2')]},'channel':{'type':Sequelize[_0xca0b('0x2')]},'dstchannel':{'type':Sequelize[_0xca0b('0x2')]},'lastapp':{'type':Sequelize[_0xca0b('0x2')]},'lastdata':{'type':Sequelize[_0xca0b('0x2')]},'duration':{'type':Sequelize[_0xca0b('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xca0b('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xca0b('0x2')]},'amaflags':{'type':Sequelize[_0xca0b('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xca0b('0x2')]},'userfield':{'type':Sequelize[_0xca0b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xca0b('0x2')]},'sequence':{'type':Sequelize[_0xca0b('0x2')]},'peeraccount':{'type':Sequelize[_0xca0b('0x2')]},'type':{'type':Sequelize[_0xca0b('0x2')]},'tag':{'type':Sequelize[_0xca0b('0x2')]}};
\ No newline at end of file
diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js
index 42b0f67..8db855d 100644
--- a/server/api/cdr/cdr.controller.js
+++ b/server/api/cdr/cdr.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x236d=['undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','destroy','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3086e3,_0x42bab4){var _0x46369a=function(_0x17c8c6){while(--_0x17c8c6){_0x3086e3['push'](_0x3086e3['shift']());}};_0x46369a(++_0x42bab4);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd236('0x0'));var rimraf=require(_0xd236('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd236('0x2'));var rp=require('request-promise');var moment=require(_0xd236('0x3'));var BPromise=require(_0xd236('0x4'));var Mustache=require(_0xd236('0x5'));var util=require(_0xd236('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd236('0x7'));var ejs=require(_0xd236('0x8'));var fs=require('fs');var fs_extra=require(_0xd236('0x9'));var _=require(_0xd236('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd236('0xb'));var deskjs=require(_0xd236('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd236('0xd'));var Papa=require(_0xd236('0xe'));var Redis=require('ioredis');var authService=require(_0xd236('0xf'));var qs=require(_0xd236('0x10'));var as=require(_0xd236('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd236('0x12'))(_0xd236('0x13'));var utils=require(_0xd236('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd236('0x15'));var db=require(_0xd236('0x16'))['db'];function respondWithStatusCode(_0x3d1076,_0x160cb1){_0x160cb1=_0x160cb1||0xcc;return function(_0x21f27b){if(_0x21f27b){return _0x3d1076[_0xd236('0x17')](_0x160cb1);}return _0x3d1076[_0xd236('0x18')](_0x160cb1)[_0xd236('0x19')]();};}function respondWithResult(_0x22435c,_0x3d7465){_0x3d7465=_0x3d7465||0xc8;return function(_0x348734){if(_0x348734){return _0x22435c[_0xd236('0x18')](_0x3d7465)[_0xd236('0x1a')](_0x348734);}};}function respondWithFilteredResult(_0x3b60a7,_0xd851b5){return function(_0x3b2535){if(_0x3b2535){var _0x2a076d=typeof _0xd851b5[_0xd236('0x1b')]===_0xd236('0x1c')&&typeof _0xd851b5[_0xd236('0x1d')]==='undefined';var _0x4f06c6=_0x3b2535[_0xd236('0x1e')];var _0x1b02a5=_0x2a076d?0x0:_0xd851b5['offset'];var _0x11c6ec=_0x2a076d?_0x3b2535[_0xd236('0x1e')]:_0xd851b5[_0xd236('0x1b')]+_0xd851b5['limit'];var _0x355b65;if(_0x11c6ec>=_0x4f06c6){_0x11c6ec=_0x4f06c6;_0x355b65=0xc8;}else{_0x355b65=0xce;}_0x3b60a7[_0xd236('0x18')](_0x355b65);return _0x3b60a7[_0xd236('0x1f')]('Content-Range',_0x1b02a5+'-'+_0x11c6ec+'/'+_0x4f06c6)[_0xd236('0x1a')](_0x3b2535);}return null;};}function patchUpdates(_0x3b0a27){return function(_0x26c758){try{jsonpatch[_0xd236('0x20')](_0x26c758,_0x3b0a27,!![]);}catch(_0x2f512d){return BPromise['reject'](_0x2f512d);}return _0x26c758[_0xd236('0x21')]();};}function saveUpdates(_0x30e7aa,_0x1e4ddb){return function(_0x3d1e4e){if(_0x3d1e4e){return _0x3d1e4e[_0xd236('0x22')](_0x30e7aa)['then'](function(_0x4a35d0){return _0x4a35d0;});}return null;};}function removeEntity(_0x257f27,_0x4be5ac){return function(_0x22924d){if(_0x22924d){return _0x22924d['destroy']()[_0xd236('0x23')](function(){_0x257f27[_0xd236('0x18')](0xcc)[_0xd236('0x19')]();});}};}function handleEntityNotFound(_0x49d822,_0x41049a){return function(_0x339b08){if(!_0x339b08){_0x49d822[_0xd236('0x17')](0x194);}return _0x339b08;};}function handleError(_0x13ba7a,_0x3a30d8){_0x3a30d8=_0x3a30d8||0x1f4;return function(_0x17f927){logger[_0xd236('0x24')](_0x17f927[_0xd236('0x25')]);if(_0x17f927[_0xd236('0x26')]){delete _0x17f927[_0xd236('0x26')];}_0x13ba7a[_0xd236('0x18')](_0x3a30d8)[_0xd236('0x27')](_0x17f927);};}exports[_0xd236('0x28')]=function(_0x23714d,_0x3108f4){var _0x28175d={},_0x436a19={},_0x471ed6={'count':0x0,'rows':[]};var _0x463fc8=_[_0xd236('0x29')](db[_0xd236('0x2a')][_0xd236('0x2b')],function(_0x3c1617){return{'name':_0x3c1617[_0xd236('0x2c')],'type':_0x3c1617[_0xd236('0x2d')][_0xd236('0x2e')]};});_0x436a19[_0xd236('0x2f')]=_[_0xd236('0x29')](_0x463fc8,_0xd236('0x26'));_0x436a19['query']=_[_0xd236('0x30')](_0x23714d['query']);_0x436a19[_0xd236('0x31')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],_0x436a19['query']);_0x28175d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x23714d[_0xd236('0x35')][_0xd236('0x34')]));_0x28175d[_0xd236('0x33')]=_0x28175d['attributes'][_0xd236('0x36')]?_0x28175d['attributes']:_0x436a19[_0xd236('0x2f')];if(!_0x23714d['query'][_0xd236('0x37')](_0xd236('0x38'))){_0x28175d[_0xd236('0x1d')]=qs[_0xd236('0x1d')](_0x23714d[_0xd236('0x35')][_0xd236('0x1d')]);_0x28175d[_0xd236('0x1b')]=qs[_0xd236('0x1b')](_0x23714d[_0xd236('0x35')][_0xd236('0x1b')]);}_0x28175d[_0xd236('0x39')]=qs[_0xd236('0x3a')](_0x23714d[_0xd236('0x35')]['sort']);_0x28175d[_0xd236('0x3b')]=qs[_0xd236('0x31')](_[_0xd236('0x3c')](_0x23714d['query'],_0x436a19[_0xd236('0x31')]),_0x463fc8);if(_0x23714d[_0xd236('0x35')][_0xd236('0x3d')]){_0x28175d[_0xd236('0x3b')]=_[_0xd236('0x3e')](_0x28175d[_0xd236('0x3b')],{'$or':_['map'](_0x463fc8,function(_0x696bed){if(_0x696bed[_0xd236('0x2d')]!==_0xd236('0x3f')){var _0x3c798f={};_0x3c798f[_0x696bed[_0xd236('0x26')]]={'$like':'%'+_0x23714d[_0xd236('0x35')]['filter']+'%'};return _0x3c798f;}})});}_0x28175d=_[_0xd236('0x3e')]({},_0x28175d,_0x23714d[_0xd236('0x40')]);var _0x2ba3ae={'where':_0x28175d['where']};return db[_0xd236('0x2a')]['count'](_0x2ba3ae)[_0xd236('0x23')](function(_0x5793bf){_0x471ed6['count']=_0x5793bf;if(_0x23714d[_0xd236('0x35')][_0xd236('0x41')]){_0x28175d[_0xd236('0x42')]=[{'all':!![]}];}return db[_0xd236('0x2a')][_0xd236('0x43')](_0x28175d);})['then'](function(_0x4d0d65){_0x471ed6[_0xd236('0x44')]=_0x4d0d65;return _0x471ed6;})[_0xd236('0x23')](respondWithFilteredResult(_0x3108f4,_0x28175d))['catch'](handleError(_0x3108f4,null));};exports[_0xd236('0x45')]=function(_0x342fd5,_0x2d815b){var _0x55007d={'raw':!![],'where':{'id':_0x342fd5['params']['id']}},_0x58a93a={};_0x58a93a[_0xd236('0x2f')]=_['keys'](db['Cdr'][_0xd236('0x2b')]);_0x58a93a[_0xd236('0x35')]=_[_0xd236('0x30')](_0x342fd5[_0xd236('0x35')]);_0x58a93a[_0xd236('0x31')]=_['intersection'](_0x58a93a['model'],_0x58a93a[_0xd236('0x35')]);_0x55007d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x58a93a[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x342fd5[_0xd236('0x35')]['fields']));_0x55007d[_0xd236('0x33')]=_0x55007d['attributes'][_0xd236('0x36')]?_0x55007d[_0xd236('0x33')]:_0x58a93a['model'];if(_0x342fd5['query']['includeAll']){_0x55007d['include']=[{'all':!![]}];}_0x55007d=_[_0xd236('0x3e')]({},_0x55007d,_0x342fd5[_0xd236('0x40')]);return db[_0xd236('0x2a')][_0xd236('0x46')](_0x55007d)[_0xd236('0x23')](handleEntityNotFound(_0x2d815b,null))['then'](respondWithResult(_0x2d815b,null))['catch'](handleError(_0x2d815b,null));};exports[_0xd236('0x47')]=function(_0x7c0650,_0xbf4ba9){return db[_0xd236('0x2a')][_0xd236('0x47')](_0x7c0650[_0xd236('0x48')],{})['then'](respondWithResult(_0xbf4ba9,0xc9))[_0xd236('0x49')](handleError(_0xbf4ba9,null));};exports['update']=function(_0x223a14,_0x2c8861){if(_0x223a14['body']['id']){delete _0x223a14[_0xd236('0x48')]['id'];}return db[_0xd236('0x2a')]['find']({'where':{'id':_0x223a14['params']['id']}})[_0xd236('0x23')](handleEntityNotFound(_0x2c8861,null))[_0xd236('0x23')](saveUpdates(_0x223a14[_0xd236('0x48')],null))[_0xd236('0x23')](respondWithResult(_0x2c8861,null))['catch'](handleError(_0x2c8861,null));};exports[_0xd236('0x4a')]=function(_0x43c12b,_0x3d8ca6){return db[_0xd236('0x2a')][_0xd236('0x46')]({'where':{'id':_0x43c12b[_0xd236('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d8ca6,null))['then'](removeEntity(_0x3d8ca6,null))[_0xd236('0x49')](handleError(_0x3d8ca6,null));};exports['describe']=function(_0xa39da6,_0x30c336){return db['Cdr'][_0xd236('0x4c')]()[_0xd236('0x23')](respondWithResult(_0x30c336,null))['catch'](handleError(_0x30c336,null));};
\ No newline at end of file
+var _0xd6d6=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type'];(function(_0x5800e9,_0xa9ef46){var _0x193060=function(_0x1ff026){while(--_0x1ff026){_0x5800e9['push'](_0x5800e9['shift']());}};_0x193060(++_0xa9ef46);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3878a0,_0x3a3d86){_0x3878a0=_0x3878a0-0x0;var _0x3cb4a4=_0xd6d6[_0x3878a0];return _0x3cb4a4;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x2d')](_0xde3272,'name');_0x8a9a84[_0x6d6d('0x34')]=_['keys'](_0x553645[_0x6d6d('0x34')]);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x553645['query'][_0x6d6d('0x38')]));_0x5273cd[_0x6d6d('0x37')]=_0x5273cd[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x5273cd[_0x6d6d('0x37')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x34')][_0x6d6d('0x3a')](_0x6d6d('0x3b'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1e')]);_0x5273cd[_0x6d6d('0x1f')]=qs['offset'](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1f')]);}_0x5273cd[_0x6d6d('0x3c')]=qs[_0x6d6d('0x3d')](_0x553645['query']['sort']);_0x5273cd[_0x6d6d('0x3e')]=qs[_0x6d6d('0x35')](_[_0x6d6d('0x3f')](_0x553645['query'],_0x8a9a84[_0x6d6d('0x35')]),_0xde3272);if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]){_0x5273cd[_0x6d6d('0x3e')]=_['merge'](_0x5273cd['where'],{'$or':_['map'](_0xde3272,function(_0x62620d){if(_0x62620d[_0x6d6d('0x31')]!==_0x6d6d('0x41')){var _0x22a49a={};_0x22a49a[_0x62620d['name']]={'$like':'%'+_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]+'%'};return _0x22a49a;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x3d632c={'where':_0x5273cd[_0x6d6d('0x3e')]};return db['Cdr'][_0x6d6d('0x20')](_0x3d632c)[_0x6d6d('0x27')](function(_0x42aff0){_0x57341f[_0x6d6d('0x20')]=_0x42aff0;if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x5273cd[_0x6d6d('0x45')]=[{'all':!![]}];}return db['Cdr'][_0x6d6d('0x46')](_0x5273cd);})[_0x6d6d('0x27')](function(_0x16e177){_0x57341f[_0x6d6d('0x47')]=_0x16e177;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))['catch'](handleError(_0x3edcce,null));};exports[_0x6d6d('0x48')]=function(_0x39f2a9,_0x55dba8){var _0x452de2={'raw':!![],'where':{'id':_0x39f2a9[_0x6d6d('0x49')]['id']}},_0x50dc17={};_0x50dc17[_0x6d6d('0x33')]=_['keys'](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x50dc17[_0x6d6d('0x34')]=_[_0x6d6d('0x4a')](_0x39f2a9[_0x6d6d('0x34')]);_0x50dc17['filters']=_['intersection'](_0x50dc17[_0x6d6d('0x33')],_0x50dc17['query']);_0x452de2['attributes']=_[_0x6d6d('0x36')](_0x50dc17[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x39f2a9['query'][_0x6d6d('0x38')]));_0x452de2['attributes']=_0x452de2[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x452de2[_0x6d6d('0x37')]:_0x50dc17[_0x6d6d('0x33')];if(_0x39f2a9[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x452de2[_0x6d6d('0x45')]=[{'all':!![]}];}_0x452de2=_['merge']({},_0x452de2,_0x39f2a9[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')](_0x452de2)[_0x6d6d('0x27')](handleEntityNotFound(_0x55dba8,null))[_0x6d6d('0x27')](respondWithResult(_0x55dba8,null))[_0x6d6d('0x4c')](handleError(_0x55dba8,null));};exports[_0x6d6d('0x4d')]=function(_0x1d2b20,_0x24cec2){return db['Cdr']['create'](_0x1d2b20[_0x6d6d('0x4e')],{})[_0x6d6d('0x27')](respondWithResult(_0x24cec2,0xc9))[_0x6d6d('0x4c')](handleError(_0x24cec2,null));};exports[_0x6d6d('0x26')]=function(_0xe2a20e,_0x492834){if(_0xe2a20e[_0x6d6d('0x4e')]['id']){delete _0xe2a20e[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0xe2a20e[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x492834,null))[_0x6d6d('0x27')](saveUpdates(_0xe2a20e[_0x6d6d('0x4e')],null))[_0x6d6d('0x27')](respondWithResult(_0x492834,null))[_0x6d6d('0x4c')](handleError(_0x492834,null));};exports[_0x6d6d('0x28')]=function(_0x175e26,_0x4d9811){return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0x175e26[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x4d9811,null))[_0x6d6d('0x27')](removeEntity(_0x4d9811,null))['catch'](handleError(_0x4d9811,null));};exports[_0x6d6d('0x4f')]=function(_0x36bc5a,_0x45340b){return db['Cdr']['describe']()[_0x6d6d('0x27')](respondWithResult(_0x45340b,null))['catch'](handleError(_0x45340b,null));};
\ No newline at end of file
diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js
index 8ea4b2b..7f4b328 100644
--- a/server/api/cdr/cdr.model.js
+++ b/server/api/cdr/cdr.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x33652d,_0x1914ed){var _0x4aa6ce=function(_0x1089ac){while(--_0x1089ac){_0x33652d['push'](_0x33652d['shift']());}};_0x4aa6ce(++_0x1914ed);}(_0x7a54,0x106));var _0x47a5=function(_0x3c65b1,_0x170c0d){_0x3c65b1=_0x3c65b1-0x0;var _0x9f9bbe=_0x7a54[_0x3c65b1];return _0x9f9bbe;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x50fb4e,_0x39559b){var _0x3bf8ba=function(_0x25a45b){while(--_0x25a45b){_0x50fb4e['push'](_0x50fb4e['shift']());}};_0x3bf8ba(++_0x39559b);}(_0x7a54,0x106));var _0x47a5=function(_0x45149f,_0x2ee534){_0x45149f=_0x45149f-0x0;var _0x473c1b=_0x7a54[_0x45149f];return _0x473c1b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});};
\ No newline at end of file
diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js
index 854383f..5fbe3bf 100644
--- a/server/api/cdr/cdr.rpc.js
+++ b/server/api/cdr/cdr.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x8030=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x8030,0x8a));var _0x0803=function(_0x66a2aa,_0x43001c){_0x66a2aa=_0x66a2aa-0x0;var _0x3933e7=_0x8030[_0x66a2aa];return _0x3933e7;};'use strict';var _=require('lodash');var util=require(_0x0803('0x0'));var moment=require(_0x0803('0x1'));var BPromise=require(_0x0803('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0803('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0803('0x4'));var logger=require(_0x0803('0x5'))(_0x0803('0x6'));var config=require(_0x0803('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0803('0x8')][_0x0803('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46075e,_0x43cba6,_0x5ec083){return new BPromise(function(_0x3a77c7,_0x293eed){return client[_0x0803('0xa')](_0x46075e,_0x5ec083)[_0x0803('0xb')](function(_0x25a605){logger[_0x0803('0xc')](_0x0803('0xd'),_0x43cba6,_0x0803('0xe'));logger[_0x0803('0xf')](_0x0803('0x10'),_0x43cba6,_0x0803('0xe'),JSON[_0x0803('0x11')](_0x25a605));if(_0x25a605[_0x0803('0x12')]){if(_0x25a605[_0x0803('0x12')][_0x0803('0x13')]===0x1f4){logger['error'](_0x0803('0xd'),_0x43cba6,_0x25a605[_0x0803('0x12')][_0x0803('0x14')]);return _0x293eed(_0x25a605['error'][_0x0803('0x14')]);}logger['error'](_0x0803('0xd'),_0x43cba6,_0x25a605[_0x0803('0x12')][_0x0803('0x14')]);return _0x3a77c7(_0x25a605['error']['message']);}else{logger[_0x0803('0xc')](_0x0803('0xd'),_0x43cba6,'request\x20sent');_0x3a77c7(_0x25a605[_0x0803('0x15')][_0x0803('0x14')]);}})[_0x0803('0x16')](function(_0x408e5e){logger[_0x0803('0x12')](_0x0803('0xd'),_0x43cba6,_0x408e5e);_0x293eed(_0x408e5e);});});}
\ No newline at end of file
+var _0xc118=['code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42e3e1,_0x1d45af){var _0x211a2b=function(_0x3ea9b4){while(--_0x3ea9b4){_0x42e3e1['push'](_0x42e3e1['shift']());}};_0x211a2b(++_0x1d45af);}(_0xc118,0x18a));var _0x8c11=function(_0x4d00be,_0x1315c2){_0x4d00be=_0x4d00be-0x0;var _0x4f26fa=_0xc118[_0x4d00be];return _0x4f26fa;};'use strict';var _=require('lodash');var util=require(_0x8c11('0x0'));var moment=require(_0x8c11('0x1'));var BPromise=require(_0x8c11('0x2'));var rs=require(_0x8c11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c11('0x4'))['db'];var utils=require(_0x8c11('0x5'));var logger=require('../../config/logger')(_0x8c11('0x6'));var config=require(_0x8c11('0x7'));var jayson=require(_0x8c11('0x8'));var client=jayson[_0x8c11('0x9')][_0x8c11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11e4f7,_0x36289c,_0x9bc943){return new BPromise(function(_0x3e93ce,_0x59f01f){return client[_0x8c11('0xb')](_0x11e4f7,_0x9bc943)[_0x8c11('0xc')](function(_0x4cc773){logger[_0x8c11('0xd')](_0x8c11('0xe'),_0x36289c,_0x8c11('0xf'));logger[_0x8c11('0x10')](_0x8c11('0x11'),_0x36289c,_0x8c11('0xf'),JSON[_0x8c11('0x12')](_0x4cc773));if(_0x4cc773[_0x8c11('0x13')]){if(_0x4cc773['error'][_0x8c11('0x14')]===0x1f4){logger[_0x8c11('0x13')](_0x8c11('0xe'),_0x36289c,_0x4cc773['error'][_0x8c11('0x15')]);return _0x59f01f(_0x4cc773['error'][_0x8c11('0x15')]);}logger[_0x8c11('0x13')](_0x8c11('0xe'),_0x36289c,_0x4cc773['error'][_0x8c11('0x15')]);return _0x3e93ce(_0x4cc773[_0x8c11('0x13')][_0x8c11('0x15')]);}else{logger[_0x8c11('0xd')](_0x8c11('0xe'),_0x36289c,_0x8c11('0xf'));_0x3e93ce(_0x4cc773[_0x8c11('0x16')][_0x8c11('0x15')]);}})['catch'](function(_0x3ac5ad){logger[_0x8c11('0x13')](_0x8c11('0xe'),_0x36289c,_0x3ac5ad);_0x59f01f(_0x3ac5ad);});});}
\ No newline at end of file
diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js
index 605ba8f..378eac7 100644
--- a/server/api/cdr/index.js
+++ b/server/api/cdr/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x235884,_0x1c4355){var _0x211158=function(_0x3d620c){while(--_0x3d620c){_0x235884['push'](_0x235884['shift']());}};_0x211158(++_0x1c4355);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router;
\ No newline at end of file
+var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x413838,_0x405f52){var _0x4ec54a=function(_0x568563){while(--_0x568563){_0x413838['push'](_0x413838['shift']());}};_0x4ec54a(++_0x405f52);}(_0xb10b,0x12a));var _0xbb10=function(_0x25f39c,_0x4f231a){_0x25f39c=_0x25f39c-0x0;var _0x19bb4a=_0xb10b[_0x25f39c];return _0x19bb4a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router;
\ No newline at end of file
diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js
index 0736351..fd0ab06 100644
--- a/server/api/chatApplication/chatApplication.attributes.js
+++ b/server/api/chatApplication/chatApplication.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd0b0=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xd0b0,0xbe));var _0x0d0b=function(_0x521d25,_0x1434b1){_0x521d25=_0x521d25-0x0;var _0x26f3b0=_0xd0b0[_0x521d25];return _0x26f3b0;};'use strict';var Sequelize=require(_0x0d0b('0x0'));module[_0x0d0b('0x1')]={'priority':{'type':Sequelize[_0x0d0b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0d0b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0d0b('0x3')],'defaultValue':_0x0d0b('0x4')}};
\ No newline at end of file
+var _0x2693=['exports','STRING','TEXT','sequelize'];(function(_0x33aefe,_0x371ccd){var _0x471d19=function(_0x566c26){while(--_0x566c26){_0x33aefe['push'](_0x33aefe['shift']());}};_0x471d19(++_0x371ccd);}(_0x2693,0x1ef));var _0x3269=function(_0x31571c,_0x1e9e35){_0x31571c=_0x31571c-0x0;var _0x410db2=_0x2693[_0x31571c];return _0x410db2;};'use strict';var Sequelize=require(_0x3269('0x0'));module[_0x3269('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3269('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3269('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3269('0x2')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js
index 233aec1..8851295 100644
--- a/server/api/chatApplication/chatApplication.controller.js
+++ b/server/api/chatApplication/chatApplication.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x876b=['set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','include','options','find','catch','body','params','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x29ab68,_0x5d1155){var _0x3c64d1=function(_0x25ef42){while(--_0x25ef42){_0x29ab68['push'](_0x29ab68['shift']());}};_0x3c64d1(++_0x5d1155);}(_0x876b,0x1ba));var _0xb876=function(_0x2c4594,_0x523e85){_0x2c4594=_0x2c4594-0x0;var _0x223db7=_0x876b[_0x2c4594];return _0x223db7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb876('0x0'));var jsonpatch=require(_0xb876('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb876('0x2'));var Mustache=require(_0xb876('0x3'));var util=require('util');var path=require(_0xb876('0x4'));var sox=require(_0xb876('0x5'));var csv=require(_0xb876('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb876('0x7'));var _=require(_0xb876('0x8'));var squel=require('squel');var crypto=require(_0xb876('0x9'));var jsforce=require(_0xb876('0xa'));var deskjs=require(_0xb876('0xb'));var toCsv=require(_0xb876('0x6'));var querystring=require('querystring');var Papa=require(_0xb876('0xc'));var Redis=require('ioredis');var authService=require(_0xb876('0xd'));var qs=require(_0xb876('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb876('0xf'));var utils=require('../../config/utils');var config=require(_0xb876('0x10'));var licenseUtil=require(_0xb876('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x84b7bb,_0x19fb7e){_0x19fb7e=_0x19fb7e||0xcc;return function(_0x2c2a0f){if(_0x2c2a0f){return _0x84b7bb[_0xb876('0x12')](_0x19fb7e);}return _0x84b7bb[_0xb876('0x13')](_0x19fb7e)[_0xb876('0x14')]();};}function respondWithResult(_0x39bc32,_0x31a5fa){_0x31a5fa=_0x31a5fa||0xc8;return function(_0x248165){if(_0x248165){return _0x39bc32[_0xb876('0x13')](_0x31a5fa)[_0xb876('0x15')](_0x248165);}};}function respondWithFilteredResult(_0x239804,_0x497380){return function(_0x33f264){if(_0x33f264){var _0x6bf9ad=typeof _0x497380[_0xb876('0x16')]===_0xb876('0x17')&&typeof _0x497380[_0xb876('0x18')]===_0xb876('0x17');var _0x526ea7=_0x33f264[_0xb876('0x19')];var _0x3da83a=_0x6bf9ad?0x0:_0x497380['offset'];var _0x5eb24a=_0x6bf9ad?_0x33f264[_0xb876('0x19')]:_0x497380[_0xb876('0x16')]+_0x497380[_0xb876('0x18')];var _0x587af4;if(_0x5eb24a>=_0x526ea7){_0x5eb24a=_0x526ea7;_0x587af4=0xc8;}else{_0x587af4=0xce;}_0x239804[_0xb876('0x13')](_0x587af4);return _0x239804[_0xb876('0x1a')](_0xb876('0x1b'),_0x3da83a+'-'+_0x5eb24a+'/'+_0x526ea7)[_0xb876('0x15')](_0x33f264);}return null;};}function patchUpdates(_0x10b085){return function(_0x4f9b80){try{jsonpatch['apply'](_0x4f9b80,_0x10b085,!![]);}catch(_0x4b4382){return BPromise[_0xb876('0x1c')](_0x4b4382);}return _0x4f9b80[_0xb876('0x1d')]();};}function saveUpdates(_0x36f701,_0x115f17){return function(_0x5d775c){if(_0x5d775c){return _0x5d775c[_0xb876('0x1e')](_0x36f701)[_0xb876('0x1f')](function(_0x20006c){return _0x20006c;});}return null;};}function removeEntity(_0x359b44,_0xe939c2){return function(_0x351dc3){if(_0x351dc3){return _0x351dc3[_0xb876('0x20')]()[_0xb876('0x1f')](function(){_0x359b44[_0xb876('0x13')](0xcc)[_0xb876('0x14')]();});}};}function handleEntityNotFound(_0x244e2b,_0x2f41ce){return function(_0x30a7f8){if(!_0x30a7f8){_0x244e2b[_0xb876('0x12')](0x194);}return _0x30a7f8;};}function handleError(_0xbd522f,_0x22d680){_0x22d680=_0x22d680||0x1f4;return function(_0x213c8a){logger['error'](_0x213c8a[_0xb876('0x21')]);if(_0x213c8a[_0xb876('0x22')]){delete _0x213c8a[_0xb876('0x22')];}_0xbd522f['status'](_0x22d680)[_0xb876('0x23')](_0x213c8a);};}exports[_0xb876('0x24')]=function(_0x11c061,_0x5a4ade){var _0x20bd3b={'raw':!![],'where':{'id':_0x11c061['params']['id']}},_0x45a8a5={};_0x45a8a5[_0xb876('0x25')]=_['keys'](db[_0xb876('0x26')][_0xb876('0x27')]);_0x45a8a5[_0xb876('0x28')]=_[_0xb876('0x29')](_0x11c061['query']);_0x45a8a5[_0xb876('0x2a')]=_[_0xb876('0x2b')](_0x45a8a5[_0xb876('0x25')],_0x45a8a5[_0xb876('0x28')]);_0x20bd3b[_0xb876('0x2c')]=_[_0xb876('0x2b')](_0x45a8a5[_0xb876('0x25')],qs['fields'](_0x11c061[_0xb876('0x28')][_0xb876('0x2d')]));_0x20bd3b[_0xb876('0x2c')]=_0x20bd3b['attributes']['length']?_0x20bd3b[_0xb876('0x2c')]:_0x45a8a5[_0xb876('0x25')];if(_0x11c061[_0xb876('0x28')]['includeAll']){_0x20bd3b[_0xb876('0x2e')]=[{'all':!![]}];}_0x20bd3b=_['merge']({},_0x20bd3b,_0x11c061[_0xb876('0x2f')]);return db[_0xb876('0x26')][_0xb876('0x30')](_0x20bd3b)['then'](handleEntityNotFound(_0x5a4ade,null))[_0xb876('0x1f')](respondWithResult(_0x5a4ade,null))[_0xb876('0x31')](handleError(_0x5a4ade,null));};exports[_0xb876('0x1e')]=function(_0xa17e24,_0x29b70e){if(_0xa17e24[_0xb876('0x32')]['id']){delete _0xa17e24[_0xb876('0x32')]['id'];}return db[_0xb876('0x26')]['find']({'where':{'id':_0xa17e24['params']['id']}})[_0xb876('0x1f')](handleEntityNotFound(_0x29b70e,null))[_0xb876('0x1f')](saveUpdates(_0xa17e24[_0xb876('0x32')],null))[_0xb876('0x1f')](respondWithResult(_0x29b70e,null))['catch'](handleError(_0x29b70e,null));};exports[_0xb876('0x20')]=function(_0x3d162c,_0x40cc32){return db[_0xb876('0x26')][_0xb876('0x30')]({'where':{'id':_0x3d162c[_0xb876('0x33')]['id']}})[_0xb876('0x1f')](handleEntityNotFound(_0x40cc32,null))[_0xb876('0x1f')](removeEntity(_0x40cc32,null))['catch'](handleError(_0x40cc32,null));};
\ No newline at end of file
+var _0x0e0f=['error','stack','name','send','show','model','ChatApplication','query','keys','filters','attributes','intersection','fields','includeAll','include','options','catch','update','body','find','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','status','undefined','limit','offset','save','then','destroy','end'];(function(_0x4beb44,_0x45c192){var _0x150dc0=function(_0x2ed5f5){while(--_0x2ed5f5){_0x4beb44['push'](_0x4beb44['shift']());}};_0x150dc0(++_0x45c192);}(_0x0e0f,0xe5));var _0xf0e0=function(_0x446122,_0x2210aa){_0x446122=_0x446122-0x0;var _0x4410c3=_0x0e0f[_0x446122];return _0x4410c3;};'use strict';var emlformat=require(_0xf0e0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0e0('0x1'));var rp=require(_0xf0e0('0x2'));var moment=require(_0xf0e0('0x3'));var BPromise=require(_0xf0e0('0x4'));var Mustache=require(_0xf0e0('0x5'));var util=require('util');var path=require(_0xf0e0('0x6'));var sox=require(_0xf0e0('0x7'));var csv=require('to-csv');var ejs=require(_0xf0e0('0x8'));var fs=require('fs');var fs_extra=require(_0xf0e0('0x9'));var _=require(_0xf0e0('0xa'));var squel=require(_0xf0e0('0xb'));var crypto=require(_0xf0e0('0xc'));var jsforce=require(_0xf0e0('0xd'));var deskjs=require(_0xf0e0('0xe'));var toCsv=require(_0xf0e0('0xf'));var querystring=require(_0xf0e0('0x10'));var Papa=require('papaparse');var Redis=require(_0xf0e0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf0e0('0x12'));var as=require(_0xf0e0('0x13'));var hardwareService=require(_0xf0e0('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0e0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x501c86,_0x24d3a9){_0x24d3a9=_0x24d3a9||0xcc;return function(_0x5bd0ab){if(_0x5bd0ab){return _0x501c86[_0xf0e0('0x16')](_0x24d3a9);}return _0x501c86[_0xf0e0('0x17')](_0x24d3a9)['end']();};}function respondWithResult(_0x552683,_0x457bfc){_0x457bfc=_0x457bfc||0xc8;return function(_0x5b3719){if(_0x5b3719){return _0x552683[_0xf0e0('0x17')](_0x457bfc)['json'](_0x5b3719);}};}function respondWithFilteredResult(_0x3357f0,_0x55e350){return function(_0x40d87b){if(_0x40d87b){var _0x186e92=typeof _0x55e350['offset']===_0xf0e0('0x18')&&typeof _0x55e350[_0xf0e0('0x19')]===_0xf0e0('0x18');var _0x36206d=_0x40d87b['count'];var _0x3d725b=_0x186e92?0x0:_0x55e350[_0xf0e0('0x1a')];var _0x5e221e=_0x186e92?_0x40d87b['count']:_0x55e350[_0xf0e0('0x1a')]+_0x55e350[_0xf0e0('0x19')];var _0x51c8c8;if(_0x5e221e>=_0x36206d){_0x5e221e=_0x36206d;_0x51c8c8=0xc8;}else{_0x51c8c8=0xce;}_0x3357f0[_0xf0e0('0x17')](_0x51c8c8);return _0x3357f0['set']('Content-Range',_0x3d725b+'-'+_0x5e221e+'/'+_0x36206d)['json'](_0x40d87b);}return null;};}function patchUpdates(_0x350649){return function(_0x3ed3f8){try{jsonpatch['apply'](_0x3ed3f8,_0x350649,!![]);}catch(_0x54e139){return BPromise['reject'](_0x54e139);}return _0x3ed3f8[_0xf0e0('0x1b')]();};}function saveUpdates(_0x52e518,_0x586ef0){return function(_0x48b789){if(_0x48b789){return _0x48b789['update'](_0x52e518)[_0xf0e0('0x1c')](function(_0x357e3a){return _0x357e3a;});}return null;};}function removeEntity(_0x1a1cdb,_0x211d1c){return function(_0x507c66){if(_0x507c66){return _0x507c66[_0xf0e0('0x1d')]()[_0xf0e0('0x1c')](function(){_0x1a1cdb['status'](0xcc)[_0xf0e0('0x1e')]();});}};}function handleEntityNotFound(_0x50cb6e,_0x379256){return function(_0x364675){if(!_0x364675){_0x50cb6e['sendStatus'](0x194);}return _0x364675;};}function handleError(_0xce3161,_0x3e7e3a){_0x3e7e3a=_0x3e7e3a||0x1f4;return function(_0x51c3e2){logger[_0xf0e0('0x1f')](_0x51c3e2[_0xf0e0('0x20')]);if(_0x51c3e2[_0xf0e0('0x21')]){delete _0x51c3e2[_0xf0e0('0x21')];}_0xce3161[_0xf0e0('0x17')](_0x3e7e3a)[_0xf0e0('0x22')](_0x51c3e2);};}exports[_0xf0e0('0x23')]=function(_0x3b4a3b,_0xfe6ec){var _0xb08e13={'raw':!![],'where':{'id':_0x3b4a3b['params']['id']}},_0x251a8b={};_0x251a8b[_0xf0e0('0x24')]=_['keys'](db[_0xf0e0('0x25')]['rawAttributes']);_0x251a8b[_0xf0e0('0x26')]=_[_0xf0e0('0x27')](_0x3b4a3b[_0xf0e0('0x26')]);_0x251a8b[_0xf0e0('0x28')]=_['intersection'](_0x251a8b[_0xf0e0('0x24')],_0x251a8b[_0xf0e0('0x26')]);_0xb08e13[_0xf0e0('0x29')]=_[_0xf0e0('0x2a')](_0x251a8b['model'],qs[_0xf0e0('0x2b')](_0x3b4a3b[_0xf0e0('0x26')][_0xf0e0('0x2b')]));_0xb08e13[_0xf0e0('0x29')]=_0xb08e13[_0xf0e0('0x29')]['length']?_0xb08e13[_0xf0e0('0x29')]:_0x251a8b[_0xf0e0('0x24')];if(_0x3b4a3b[_0xf0e0('0x26')][_0xf0e0('0x2c')]){_0xb08e13[_0xf0e0('0x2d')]=[{'all':!![]}];}_0xb08e13=_['merge']({},_0xb08e13,_0x3b4a3b[_0xf0e0('0x2e')]);return db[_0xf0e0('0x25')]['find'](_0xb08e13)[_0xf0e0('0x1c')](handleEntityNotFound(_0xfe6ec,null))[_0xf0e0('0x1c')](respondWithResult(_0xfe6ec,null))[_0xf0e0('0x2f')](handleError(_0xfe6ec,null));};exports[_0xf0e0('0x30')]=function(_0x89dbf3,_0x1105d7){if(_0x89dbf3[_0xf0e0('0x31')]['id']){delete _0x89dbf3['body']['id'];}return db[_0xf0e0('0x25')][_0xf0e0('0x32')]({'where':{'id':_0x89dbf3[_0xf0e0('0x33')]['id']}})[_0xf0e0('0x1c')](handleEntityNotFound(_0x1105d7,null))[_0xf0e0('0x1c')](saveUpdates(_0x89dbf3[_0xf0e0('0x31')],null))['then'](respondWithResult(_0x1105d7,null))['catch'](handleError(_0x1105d7,null));};exports[_0xf0e0('0x1d')]=function(_0x5addaf,_0x11113c){return db[_0xf0e0('0x25')][_0xf0e0('0x32')]({'where':{'id':_0x5addaf[_0xf0e0('0x33')]['id']}})['then'](handleEntityNotFound(_0x11113c,null))['then'](removeEntity(_0x11113c,null))[_0xf0e0('0x2f')](handleError(_0x11113c,null));};
\ No newline at end of file
diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js
index d2b6ad1..8b563ee 100644
--- a/server/api/chatApplication/chatApplication.model.js
+++ b/server/api/chatApplication/chatApplication.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x4706=['ChatApplication','chat_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x315f3a,_0x269ada){var _0x3139f8=function(_0x4696fc){while(--_0x4696fc){_0x315f3a['push'](_0x315f3a['shift']());}};_0x3139f8(++_0x269ada);}(_0x4706,0xf1));var _0x6470=function(_0x43f1f4,_0x2509a8){_0x43f1f4=_0x43f1f4-0x0;var _0x241794=_0x4706[_0x43f1f4];return _0x241794;};'use strict';var _=require('lodash');var util=require(_0x6470('0x0'));var logger=require(_0x6470('0x1'))(_0x6470('0x2'));var moment=require(_0x6470('0x3'));var BPromise=require(_0x6470('0x4'));var rp=require(_0x6470('0x5'));var fs=require('fs');var path=require(_0x6470('0x6'));var rimraf=require(_0x6470('0x7'));var config=require(_0x6470('0x8'));var attributes=require(_0x6470('0x9'));module[_0x6470('0xa')]=function(_0x4174f3,_0x329ea0){return _0x4174f3['define'](_0x6470('0xb'),attributes,{'tableName':_0x6470('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6470('0xd')});};
\ No newline at end of file
+var _0x05cd=['api','moment','request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x205123,_0x240ebe){var _0x5b69fb=function(_0x488aaf){while(--_0x488aaf){_0x205123['push'](_0x205123['shift']());}};_0x5b69fb(++_0x240ebe);}(_0x05cd,0x1bd));var _0xd05c=function(_0x266ca7,_0x15005f){_0x266ca7=_0x266ca7-0x0;var _0x2969ca=_0x05cd[_0x266ca7];return _0x2969ca;};'use strict';var _=require(_0xd05c('0x0'));var util=require(_0xd05c('0x1'));var logger=require(_0xd05c('0x2'))(_0xd05c('0x3'));var moment=require(_0xd05c('0x4'));var BPromise=require('bluebird');var rp=require(_0xd05c('0x5'));var fs=require('fs');var path=require(_0xd05c('0x6'));var rimraf=require('rimraf');var config=require(_0xd05c('0x7'));var attributes=require(_0xd05c('0x8'));module[_0xd05c('0x9')]=function(_0x55ed53,_0x572586){return _0x55ed53[_0xd05c('0xa')](_0xd05c('0xb'),attributes,{'tableName':_0xd05c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd05c('0xd')});};
\ No newline at end of file
diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js
index 66dcd26..71839fd 100644
--- a/server/api/chatApplication/chatApplication.rpc.js
+++ b/server/api/chatApplication/chatApplication.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x604b=['randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x604b,0x1cb));var _0xb604=function(_0x1e491b,_0x3877d5){_0x1e491b=_0x1e491b-0x0;var _0x4b984f=_0x604b[_0x1e491b];return _0x4b984f;};'use strict';var _=require(_0xb604('0x0'));var util=require(_0xb604('0x1'));var moment=require(_0xb604('0x2'));var BPromise=require('bluebird');var rs=require(_0xb604('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb604('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb604('0x5'))('rpc');var config=require(_0xb604('0x6'));var jayson=require(_0xb604('0x7'));var client=jayson[_0xb604('0x8')][_0xb604('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xeba047,_0x21ca4b,_0x3037dc){return new BPromise(function(_0x3312ed,_0x5ef651){return client[_0xb604('0xa')](_0xeba047,_0x3037dc)[_0xb604('0xb')](function(_0xf30e63){logger['info'](_0xb604('0xc'),_0x21ca4b,_0xb604('0xd'));logger[_0xb604('0xe')](_0xb604('0xf'),_0x21ca4b,_0xb604('0xd'),JSON[_0xb604('0x10')](_0xf30e63));if(_0xf30e63[_0xb604('0x11')]){if(_0xf30e63[_0xb604('0x11')][_0xb604('0x12')]===0x1f4){logger[_0xb604('0x11')](_0xb604('0xc'),_0x21ca4b,_0xf30e63[_0xb604('0x11')][_0xb604('0x13')]);return _0x5ef651(_0xf30e63[_0xb604('0x11')][_0xb604('0x13')]);}logger[_0xb604('0x11')](_0xb604('0xc'),_0x21ca4b,_0xf30e63[_0xb604('0x11')][_0xb604('0x13')]);return _0x3312ed(_0xf30e63[_0xb604('0x11')][_0xb604('0x13')]);}else{logger[_0xb604('0x14')]('ChatApplication,\x20%s,\x20%s',_0x21ca4b,_0xb604('0xd'));_0x3312ed(_0xf30e63['result'][_0xb604('0x13')]);}})[_0xb604('0x15')](function(_0x3b964a){logger['error']('ChatApplication,\x20%s,\x20%s',_0x21ca4b,_0x3b964a);_0x5ef651(_0x3b964a);});});}
\ No newline at end of file
+var _0xcbf8=['code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xcbf8,0x118));var _0x8cbf=function(_0x5b73ac,_0x4a1422){_0x5b73ac=_0x5b73ac-0x0;var _0x32bcdf=_0xcbf8[_0x5b73ac];return _0x32bcdf;};'use strict';var _=require(_0x8cbf('0x0'));var util=require(_0x8cbf('0x1'));var moment=require(_0x8cbf('0x2'));var BPromise=require(_0x8cbf('0x3'));var rs=require(_0x8cbf('0x4'));var fs=require('fs');var Redis=require(_0x8cbf('0x5'));var db=require(_0x8cbf('0x6'))['db'];var utils=require(_0x8cbf('0x7'));var logger=require(_0x8cbf('0x8'))(_0x8cbf('0x9'));var config=require(_0x8cbf('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8cbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4625cd,_0x3bbcfe,_0x2bb948){return new BPromise(function(_0x936320,_0x425ade){return client[_0x8cbf('0xc')](_0x4625cd,_0x2bb948)[_0x8cbf('0xd')](function(_0x5e1005){logger[_0x8cbf('0xe')]('ChatApplication,\x20%s,\x20%s',_0x3bbcfe,_0x8cbf('0xf'));logger[_0x8cbf('0x10')](_0x8cbf('0x11'),_0x3bbcfe,_0x8cbf('0xf'),JSON[_0x8cbf('0x12')](_0x5e1005));if(_0x5e1005[_0x8cbf('0x13')]){if(_0x5e1005[_0x8cbf('0x13')][_0x8cbf('0x14')]===0x1f4){logger[_0x8cbf('0x13')](_0x8cbf('0x15'),_0x3bbcfe,_0x5e1005[_0x8cbf('0x13')]['message']);return _0x425ade(_0x5e1005['error'][_0x8cbf('0x16')]);}logger[_0x8cbf('0x13')](_0x8cbf('0x15'),_0x3bbcfe,_0x5e1005[_0x8cbf('0x13')][_0x8cbf('0x16')]);return _0x936320(_0x5e1005['error'][_0x8cbf('0x16')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x3bbcfe,_0x8cbf('0xf'));_0x936320(_0x5e1005[_0x8cbf('0x17')][_0x8cbf('0x16')]);}})[_0x8cbf('0x18')](function(_0x25cc85){logger[_0x8cbf('0x13')](_0x8cbf('0x15'),_0x3bbcfe,_0x25cc85);_0x425ade(_0x25cc85);});});}
\ No newline at end of file
diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js
index 85926cf..99f9c00 100644
--- a/server/api/chatApplication/index.js
+++ b/server/api/chatApplication/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x6812=['../../config/environment','get','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x53fedc,_0x1a5126){var _0x576b8a=function(_0x40ca5b){while(--_0x40ca5b){_0x53fedc['push'](_0x53fedc['shift']());}};_0x576b8a(++_0x1a5126);}(_0x6812,0x17e));var _0x2681=function(_0x40b108,_0x3be04c){_0x40b108=_0x40b108-0x0;var _0x586363=_0x6812[_0x40b108];return _0x586363;};'use strict';var multer=require(_0x2681('0x0'));var util=require(_0x2681('0x1'));var path=require(_0x2681('0x2'));var timeout=require(_0x2681('0x3'));var express=require(_0x2681('0x4'));var router=express[_0x2681('0x5')]();var fs_extra=require(_0x2681('0x6'));var auth=require(_0x2681('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2681('0x8'));var controller=require('./chatApplication.controller');router[_0x2681('0x9')](_0x2681('0xa'),auth[_0x2681('0xb')](),controller['show']);router['put'](_0x2681('0xa'),auth['isAuthenticated'](),controller[_0x2681('0xc')]);router[_0x2681('0xd')](_0x2681('0xa'),auth[_0x2681('0xb')](),controller['destroy']);module[_0x2681('0xe')]=router;
\ No newline at end of file
+var _0xf1a1=['exports','multer','util','Router','fs-extra','/:id','isAuthenticated','put','delete','destroy'];(function(_0x269825,_0x271c62){var _0x2d7a7a=function(_0x6ad778){while(--_0x6ad778){_0x269825['push'](_0x269825['shift']());}};_0x2d7a7a(++_0x271c62);}(_0xf1a1,0xdd));var _0x1f1a=function(_0x39a42e,_0x594f2c){_0x39a42e=_0x39a42e-0x0;var _0x462d94=_0xf1a1[_0x39a42e];return _0x462d94;};'use strict';var multer=require(_0x1f1a('0x0'));var util=require(_0x1f1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f1a('0x2')]();var fs_extra=require(_0x1f1a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x1f1a('0x4'),auth[_0x1f1a('0x5')](),controller['show']);router[_0x1f1a('0x6')](_0x1f1a('0x4'),auth[_0x1f1a('0x5')](),controller['update']);router[_0x1f1a('0x7')]('/:id',auth[_0x1f1a('0x5')](),controller[_0x1f1a('0x8')]);module[_0x1f1a('0x9')]=router;
\ No newline at end of file
diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js
index d01c6a3..e99682f 100644
--- a/server/api/chatGroup/chatGroup.attributes.js
+++ b/server/api/chatGroup/chatGroup.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x3a1a=['exports','STRING','BOOLEAN'];(function(_0x519d70,_0xadec7b){var _0x1bb8d3=function(_0x5bb6c1){while(--_0x5bb6c1){_0x519d70['push'](_0x519d70['shift']());}};_0x1bb8d3(++_0xadec7b);}(_0x3a1a,0x15f));var _0xa3a1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3a1a[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0xa3a1('0x0')]={'name':{'type':Sequelize[_0xa3a1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3a1('0x1')]},'write':{'type':Sequelize[_0xa3a1('0x2')],'defaultValue':!![]}};
\ No newline at end of file
+var _0xfb67=['BOOLEAN','sequelize','exports','STRING'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0xfb67,0xdd));var _0x7fb6=function(_0x773a85,_0x11cd42){_0x773a85=_0x773a85-0x0;var _0x4dd465=_0xfb67[_0x773a85];return _0x4dd465;};'use strict';var Sequelize=require(_0x7fb6('0x0'));module[_0x7fb6('0x1')]={'name':{'type':Sequelize[_0x7fb6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7fb6('0x2')]},'write':{'type':Sequelize[_0x7fb6('0x3')],'defaultValue':!![]}};
\ No newline at end of file
diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js
index f72a122..b608454 100644
--- a/server/api/chatGroup/chatGroup.controller.js
+++ b/server/api/chatGroup/chatGroup.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc7ee=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','User','pick','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0xc7ee,0x180));var _0xec7e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc7ee[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec7e('0x0'));var zipdir=require(_0xec7e('0x1'));var jsonpatch=require(_0xec7e('0x2'));var rp=require('request-promise');var moment=require(_0xec7e('0x3'));var BPromise=require(_0xec7e('0x4'));var Mustache=require(_0xec7e('0x5'));var util=require(_0xec7e('0x6'));var path=require(_0xec7e('0x7'));var sox=require(_0xec7e('0x8'));var csv=require(_0xec7e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec7e('0xa'));var squel=require(_0xec7e('0xb'));var crypto=require(_0xec7e('0xc'));var jsforce=require(_0xec7e('0xd'));var deskjs=require(_0xec7e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xec7e('0xf'));var Papa=require(_0xec7e('0x10'));var Redis=require(_0xec7e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xec7e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec7e('0x13'))('api');var utils=require(_0xec7e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xec7e('0x15'))['db'];config[_0xec7e('0x16')]=_['defaults'](config[_0xec7e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xec7e('0x17'))(new Redis(config[_0xec7e('0x16')]));require(_0xec7e('0x18'))[_0xec7e('0x19')](socket);function respondWithStatusCode(_0x597a8d,_0x2365c4){_0x2365c4=_0x2365c4||0xcc;return function(_0x33143f){if(_0x33143f){return _0x597a8d[_0xec7e('0x1a')](_0x2365c4);}return _0x597a8d[_0xec7e('0x1b')](_0x2365c4)['end']();};}function respondWithResult(_0x313523,_0x4a7440){_0x4a7440=_0x4a7440||0xc8;return function(_0x1848ee){if(_0x1848ee){return _0x313523[_0xec7e('0x1b')](_0x4a7440)[_0xec7e('0x1c')](_0x1848ee);}};}function respondWithFilteredResult(_0x985800,_0xbc066a){return function(_0x5dfbff){if(_0x5dfbff){var _0x463b6b=typeof _0xbc066a['offset']===_0xec7e('0x1d')&&typeof _0xbc066a[_0xec7e('0x1e')]===_0xec7e('0x1d');var _0x162ab8=_0x5dfbff[_0xec7e('0x1f')];var _0x3854d6=_0x463b6b?0x0:_0xbc066a[_0xec7e('0x20')];var _0x12d0e5=_0x463b6b?_0x5dfbff[_0xec7e('0x1f')]:_0xbc066a['offset']+_0xbc066a[_0xec7e('0x1e')];var _0x2ec739;if(_0x12d0e5>=_0x162ab8){_0x12d0e5=_0x162ab8;_0x2ec739=0xc8;}else{_0x2ec739=0xce;}_0x985800[_0xec7e('0x1b')](_0x2ec739);return _0x985800[_0xec7e('0x21')](_0xec7e('0x22'),_0x3854d6+'-'+_0x12d0e5+'/'+_0x162ab8)[_0xec7e('0x1c')](_0x5dfbff);}return null;};}function patchUpdates(_0x316529){return function(_0x2c8dab){try{jsonpatch[_0xec7e('0x23')](_0x2c8dab,_0x316529,!![]);}catch(_0x73f89e){return BPromise[_0xec7e('0x24')](_0x73f89e);}return _0x2c8dab['save']();};}function saveUpdates(_0x2f8a70,_0x395354){return function(_0x1698a5){if(_0x1698a5){return _0x1698a5[_0xec7e('0x25')](_0x2f8a70)[_0xec7e('0x26')](function(_0x538158){return _0x538158;});}return null;};}function removeEntity(_0xcb7822,_0x1c7580){return function(_0x3c3abb){if(_0x3c3abb){return _0x3c3abb[_0xec7e('0x27')]()['then'](function(){_0xcb7822[_0xec7e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x520b84,_0x3cc823){return function(_0x5abf22){if(!_0x5abf22){_0x520b84[_0xec7e('0x1a')](0x194);}return _0x5abf22;};}function handleError(_0xad8dc3,_0x1dfcc1){_0x1dfcc1=_0x1dfcc1||0x1f4;return function(_0x149ffa){logger[_0xec7e('0x28')](_0x149ffa[_0xec7e('0x29')]);if(_0x149ffa[_0xec7e('0x2a')]){delete _0x149ffa[_0xec7e('0x2a')];}_0xad8dc3['status'](_0x1dfcc1)[_0xec7e('0x2b')](_0x149ffa);};}exports[_0xec7e('0x2c')]=function(_0x315f7d,_0x4b729f){var _0x237fe7={},_0x10546b={},_0xc7bb85={'count':0x0,'rows':[]};var _0x140b7f=_[_0xec7e('0x2d')](db[_0xec7e('0x2e')][_0xec7e('0x2f')],function(_0x4bc5c6){return{'name':_0x4bc5c6['fieldName'],'type':_0x4bc5c6[_0xec7e('0x30')][_0xec7e('0x31')]};});_0x10546b[_0xec7e('0x32')]=_[_0xec7e('0x2d')](_0x140b7f,_0xec7e('0x2a'));_0x10546b['query']=_[_0xec7e('0x33')](_0x315f7d['query']);_0x10546b[_0xec7e('0x34')]=_[_0xec7e('0x35')](_0x10546b[_0xec7e('0x32')],_0x10546b[_0xec7e('0x36')]);_0x237fe7['attributes']=_[_0xec7e('0x35')](_0x10546b[_0xec7e('0x32')],qs[_0xec7e('0x37')](_0x315f7d['query'][_0xec7e('0x37')]));_0x237fe7[_0xec7e('0x38')]=_0x237fe7[_0xec7e('0x38')][_0xec7e('0x39')]?_0x237fe7['attributes']:_0x10546b[_0xec7e('0x32')];if(!_0x315f7d[_0xec7e('0x36')][_0xec7e('0x3a')](_0xec7e('0x3b'))){_0x237fe7[_0xec7e('0x1e')]=qs[_0xec7e('0x1e')](_0x315f7d[_0xec7e('0x36')][_0xec7e('0x1e')]);_0x237fe7['offset']=qs[_0xec7e('0x20')](_0x315f7d[_0xec7e('0x36')][_0xec7e('0x20')]);}_0x237fe7[_0xec7e('0x3c')]=qs['sort'](_0x315f7d[_0xec7e('0x36')][_0xec7e('0x3d')]);_0x237fe7[_0xec7e('0x3e')]=qs[_0xec7e('0x34')](_['pick'](_0x315f7d[_0xec7e('0x36')],_0x10546b['filters']),_0x140b7f);if(_0x315f7d['query'][_0xec7e('0x3f')]){_0x237fe7[_0xec7e('0x3e')]=_['merge'](_0x237fe7[_0xec7e('0x3e')],{'$or':_[_0xec7e('0x2d')](_0x140b7f,function(_0x107105){if(_0x107105['type']!==_0xec7e('0x40')){var _0x55984c={};_0x55984c[_0x107105[_0xec7e('0x2a')]]={'$like':'%'+_0x315f7d[_0xec7e('0x36')]['filter']+'%'};return _0x55984c;}})});}_0x237fe7=_[_0xec7e('0x41')]({},_0x237fe7,_0x315f7d[_0xec7e('0x42')]);var _0x2af7c2={'where':_0x237fe7['where']};return db[_0xec7e('0x2e')]['count'](_0x2af7c2)[_0xec7e('0x26')](function(_0x594a7e){_0xc7bb85[_0xec7e('0x1f')]=_0x594a7e;if(_0x315f7d['query'][_0xec7e('0x43')]){_0x237fe7[_0xec7e('0x44')]=[{'all':!![]}];}return db[_0xec7e('0x2e')][_0xec7e('0x45')](_0x237fe7);})[_0xec7e('0x26')](function(_0x33715a){_0xc7bb85[_0xec7e('0x46')]=_0x33715a;return _0xc7bb85;})[_0xec7e('0x26')](respondWithFilteredResult(_0x4b729f,_0x237fe7))[_0xec7e('0x47')](handleError(_0x4b729f,null));};exports[_0xec7e('0x48')]=function(_0x2babde,_0x2feef7){var _0x23a16d={'raw':!![],'where':{'id':_0x2babde['params']['id']}},_0x695483={};_0x695483[_0xec7e('0x32')]=_[_0xec7e('0x33')](db[_0xec7e('0x2e')]['rawAttributes']);_0x695483['query']=_[_0xec7e('0x33')](_0x2babde['query']);_0x695483[_0xec7e('0x34')]=_[_0xec7e('0x35')](_0x695483[_0xec7e('0x32')],_0x695483[_0xec7e('0x36')]);_0x23a16d[_0xec7e('0x38')]=_[_0xec7e('0x35')](_0x695483['model'],qs[_0xec7e('0x37')](_0x2babde[_0xec7e('0x36')]['fields']));_0x23a16d[_0xec7e('0x38')]=_0x23a16d[_0xec7e('0x38')]['length']?_0x23a16d['attributes']:_0x695483[_0xec7e('0x32')];if(_0x2babde[_0xec7e('0x36')]['includeAll']){_0x23a16d['include']=[{'all':!![]}];}_0x23a16d=_['merge']({},_0x23a16d,_0x2babde[_0xec7e('0x42')]);return db[_0xec7e('0x2e')][_0xec7e('0x49')](_0x23a16d)[_0xec7e('0x26')](handleEntityNotFound(_0x2feef7,null))['then'](respondWithResult(_0x2feef7,null))[_0xec7e('0x47')](handleError(_0x2feef7,null));};exports[_0xec7e('0x4a')]=function(_0x1cce44,_0x2e386d){return db[_0xec7e('0x2e')][_0xec7e('0x4a')](_0x1cce44['body'],{})[_0xec7e('0x26')](respondWithResult(_0x2e386d,0xc9))[_0xec7e('0x47')](handleError(_0x2e386d,null));};exports[_0xec7e('0x25')]=function(_0x35f8e2,_0x3363a){if(_0x35f8e2[_0xec7e('0x4b')]['id']){delete _0x35f8e2['body']['id'];}return db[_0xec7e('0x2e')][_0xec7e('0x49')]({'where':{'id':_0x35f8e2[_0xec7e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3363a,null))[_0xec7e('0x26')](saveUpdates(_0x35f8e2[_0xec7e('0x4b')],null))[_0xec7e('0x26')](respondWithResult(_0x3363a,null))[_0xec7e('0x47')](handleError(_0x3363a,null));};exports['destroy']=function(_0x249aa6,_0xaee0a5){return db[_0xec7e('0x2e')]['find']({'where':{'id':_0x249aa6[_0xec7e('0x4c')]['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0xaee0a5,null))[_0xec7e('0x26')](removeEntity(_0xaee0a5,null))[_0xec7e('0x47')](handleError(_0xaee0a5,null));};exports['describe']=function(_0x4f6a8a,_0x4bd08d){return db[_0xec7e('0x2e')][_0xec7e('0x4d')]()['then'](respondWithResult(_0x4bd08d,null))[_0xec7e('0x47')](handleError(_0x4bd08d,null));};exports[_0xec7e('0x4e')]=function(_0x129b88,_0xdc1b0c,_0x2640ec){return db[_0xec7e('0x4f')][_0xec7e('0x1f')]({'where':{'ChatGroupId':_0x129b88[_0xec7e('0x4c')]['id'],'ToId':_0x129b88[_0xec7e('0x50')]['id'],'read':![]}})[_0xec7e('0x26')](function(_0x31fbcb){return{'id':_[_0xec7e('0x51')](_0x129b88['params']['id']),'count':_0x31fbcb};})[_0xec7e('0x26')](respondWithResult(_0xdc1b0c,null))[_0xec7e('0x47')](handleError(_0xdc1b0c,null));};exports[_0xec7e('0x52')]=function(_0xde83a3,_0x391b04,_0x2328d7){return db[_0xec7e('0x2e')][_0xec7e('0x49')]({'where':{'id':_0xde83a3[_0xec7e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x391b04,null))[_0xec7e('0x26')](function(_0xe24e24){if(_0xe24e24){return _0xe24e24[_0xec7e('0x52')](_0xde83a3[_0xec7e('0x4b')][_0xec7e('0x53')],_[_0xec7e('0x54')](_0xde83a3[_0xec7e('0x4b')],['ids','id'])||{});}})[_0xec7e('0x26')](respondWithResult(_0x391b04,null))[_0xec7e('0x47')](handleError(_0x391b04,null));};exports['getMembers']=function(_0x137cd8,_0x2e67d3,_0x3f0103){var _0x7cbf5d={};var _0x8d83fb={};var _0x3220ab;var _0x5d293e;return db[_0xec7e('0x2e')]['findOne']({'where':{'id':_0x137cd8[_0xec7e('0x4c')]['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0x2e67d3,null))[_0xec7e('0x26')](function(_0x4da5de){if(_0x4da5de){_0x3220ab=_0x4da5de;_0x8d83fb['model']=_[_0xec7e('0x33')](db[_0xec7e('0x55')][_0xec7e('0x2f')]);_0x8d83fb[_0xec7e('0x36')]=_[_0xec7e('0x33')](_0x137cd8['query']);_0x8d83fb[_0xec7e('0x34')]=_[_0xec7e('0x35')](_0x8d83fb[_0xec7e('0x32')],_0x8d83fb[_0xec7e('0x36')]);_0x7cbf5d[_0xec7e('0x38')]=_[_0xec7e('0x35')](_0x8d83fb[_0xec7e('0x32')],qs[_0xec7e('0x37')](_0x137cd8[_0xec7e('0x36')][_0xec7e('0x37')]));_0x7cbf5d[_0xec7e('0x38')]=_0x7cbf5d[_0xec7e('0x38')][_0xec7e('0x39')]?_0x7cbf5d[_0xec7e('0x38')]:_0x8d83fb[_0xec7e('0x32')];_0x7cbf5d[_0xec7e('0x3c')]=qs[_0xec7e('0x3d')](_0x137cd8[_0xec7e('0x36')][_0xec7e('0x3d')]);_0x7cbf5d[_0xec7e('0x3e')]=qs[_0xec7e('0x34')](_[_0xec7e('0x56')](_0x137cd8[_0xec7e('0x36')],_0x8d83fb[_0xec7e('0x34')]));if(_0x137cd8[_0xec7e('0x36')][_0xec7e('0x3f')]){_0x7cbf5d[_0xec7e('0x3e')]=_[_0xec7e('0x41')](_0x7cbf5d[_0xec7e('0x3e')],{'$or':_[_0xec7e('0x2d')](_0x7cbf5d['attributes'],function(_0x5e0c1c){var _0x545b05={};_0x545b05[_0x5e0c1c]={'$like':'%'+_0x137cd8[_0xec7e('0x36')]['filter']+'%'};return _0x545b05;})});}_0x7cbf5d=_['merge']({},_0x7cbf5d,_0x137cd8[_0xec7e('0x42')]);return _0x3220ab[_0xec7e('0x57')](_0x7cbf5d);}})[_0xec7e('0x26')](function(_0x43efda){if(_0x43efda){_0x5d293e=_0x43efda[_0xec7e('0x39')];if(!_0x137cd8['query'][_0xec7e('0x3a')](_0xec7e('0x3b'))){_0x7cbf5d[_0xec7e('0x1e')]=qs[_0xec7e('0x1e')](_0x137cd8[_0xec7e('0x36')][_0xec7e('0x1e')]);_0x7cbf5d[_0xec7e('0x20')]=qs[_0xec7e('0x20')](_0x137cd8[_0xec7e('0x36')][_0xec7e('0x20')]);}return _0x3220ab[_0xec7e('0x57')](_0x7cbf5d);}})[_0xec7e('0x26')](function(_0x5fd24d){if(_0x5fd24d){return _0x5fd24d?{'count':_0x5d293e,'rows':_0x5fd24d}:null;}})[_0xec7e('0x26')](respondWithResult(_0x2e67d3,null))[_0xec7e('0x47')](handleError(_0x2e67d3,null));};exports['removeMembers']=function(_0x5001e4,_0xb7139a,_0x5efaec){return db['ChatGroup'][_0xec7e('0x49')]({'where':{'id':_0x5001e4['params']['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0xb7139a,null))[_0xec7e('0x26')](function(_0x354bfe){if(_0x354bfe){return _0x354bfe[_0xec7e('0x58')](_0x5001e4[_0xec7e('0x36')][_0xec7e('0x53')]);}})[_0xec7e('0x26')](respondWithStatusCode(_0xb7139a,null))[_0xec7e('0x47')](handleError(_0xb7139a,null));};exports[_0xec7e('0x59')]=function(_0x1dde76,_0x5995ea,_0x1cbdb4){if(_0x1dde76[_0xec7e('0x4b')]['id']){delete _0x1dde76['body']['id'];}return db[_0xec7e('0x2e')][_0xec7e('0x49')]({'where':{'id':_0x1dde76['params']['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0x5995ea,null))[_0xec7e('0x26')](function(_0x1b0cd3){if(_0x1b0cd3){_0x1dde76['body'][_0xec7e('0x5a')]=_0x1b0cd3['id'];return db['ChatInternalMessage'][_0xec7e('0x4a')](_0x1dde76[_0xec7e('0x4b')]);}})[_0xec7e('0x26')](respondWithResult(_0x5995ea,null))[_0xec7e('0x47')](handleError(_0x5995ea,null));};exports[_0xec7e('0x5b')]=function(_0x27d832,_0x3b1bdb,_0x2b73dc){var _0x1bc3ac={};var _0x2b42ff={};var _0x512f60;var _0x2e0b93;return db[_0xec7e('0x2e')][_0xec7e('0x5c')]({'where':{'id':_0x27d832['params']['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0x3b1bdb,null))[_0xec7e('0x26')](function(_0x1bf2c7){if(_0x1bf2c7){_0x512f60=_0x1bf2c7;_0x2b42ff[_0xec7e('0x32')]=_[_0xec7e('0x33')](db[_0xec7e('0x4f')][_0xec7e('0x2f')]);_0x2b42ff['query']=_[_0xec7e('0x33')](_0x27d832[_0xec7e('0x36')]);_0x2b42ff[_0xec7e('0x34')]=_[_0xec7e('0x35')](_0x2b42ff['model'],_0x2b42ff['query']);_0x1bc3ac[_0xec7e('0x38')]=_[_0xec7e('0x35')](_0x2b42ff[_0xec7e('0x32')],qs[_0xec7e('0x37')](_0x27d832[_0xec7e('0x36')]['fields']));_0x1bc3ac[_0xec7e('0x38')]=_0x1bc3ac['attributes']['length']?_0x1bc3ac[_0xec7e('0x38')]:_0x2b42ff[_0xec7e('0x32')];_0x1bc3ac[_0xec7e('0x3c')]=qs[_0xec7e('0x3d')](_0x27d832[_0xec7e('0x36')][_0xec7e('0x3d')]);_0x1bc3ac['where']=qs[_0xec7e('0x34')](_[_0xec7e('0x56')](_0x27d832['query'],_0x2b42ff[_0xec7e('0x34')]));if(_0x27d832[_0xec7e('0x36')][_0xec7e('0x3f')]){_0x1bc3ac[_0xec7e('0x3e')]=_[_0xec7e('0x41')](_0x1bc3ac['where'],{'$or':_[_0xec7e('0x2d')](_0x1bc3ac['attributes'],function(_0xbdadb6){var _0x2a6bfe={};_0x2a6bfe[_0xbdadb6]={'$like':'%'+_0x27d832[_0xec7e('0x36')][_0xec7e('0x3f')]+'%'};return _0x2a6bfe;})});}if(_0x27d832[_0xec7e('0x36')][_0xec7e('0x5d')]){var _0x80d46c=_0x27d832[_0xec7e('0x36')][_0xec7e('0x5d')]['split'](',');var _0x3178a0={};_0x3178a0[_0x80d46c[0x0]]={'$gte':moment(_0x80d46c[0x1])[_0xec7e('0x5e')](_0xec7e('0x5f'))};_0x1bc3ac[_0xec7e('0x3e')]=_[_0xec7e('0x41')](_0x1bc3ac[_0xec7e('0x3e')],_0x3178a0);}_0x1bc3ac=_[_0xec7e('0x41')]({},_0x1bc3ac,_0x27d832['options']);return _0x512f60[_0xec7e('0x5b')](_0x1bc3ac);}})['then'](function(_0x341bd2){if(_0x341bd2){_0x2e0b93=_0x341bd2[_0xec7e('0x39')];if(!_0x27d832[_0xec7e('0x36')][_0xec7e('0x3a')](_0xec7e('0x3b'))){_0x1bc3ac['limit']=qs['limit'](_0x27d832[_0xec7e('0x36')][_0xec7e('0x1e')]);_0x1bc3ac[_0xec7e('0x20')]=qs[_0xec7e('0x20')](_0x27d832[_0xec7e('0x36')][_0xec7e('0x20')]);}return _0x512f60[_0xec7e('0x5b')](_0x1bc3ac);}})[_0xec7e('0x26')](function(_0x263f83){if(_0x263f83){return _0x263f83?{'count':_0x2e0b93,'rows':_0x263f83}:null;}})[_0xec7e('0x26')](respondWithResult(_0x3b1bdb,null))[_0xec7e('0x47')](handleError(_0x3b1bdb,null));};
\ No newline at end of file
+var _0x3fe7=['fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','rows','catch','show','params','fields','length','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3fe7,0xc4));var _0x73fe=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x3fe7[_0x2bd1ec];return _0x2f7577;};'use strict';var emlformat=require(_0x73fe('0x0'));var rimraf=require(_0x73fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73fe('0x2'));var rp=require(_0x73fe('0x3'));var moment=require(_0x73fe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x73fe('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x73fe('0x6'));var ejs=require(_0x73fe('0x7'));var fs=require('fs');var fs_extra=require(_0x73fe('0x8'));var _=require(_0x73fe('0x9'));var squel=require(_0x73fe('0xa'));var crypto=require(_0x73fe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x73fe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x73fe('0xd'));var Papa=require(_0x73fe('0xe'));var Redis=require(_0x73fe('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x73fe('0x10'));var as=require(_0x73fe('0x11'));var hardwareService=require(_0x73fe('0x12'));var logger=require(_0x73fe('0x13'))(_0x73fe('0x14'));var utils=require(_0x73fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x73fe('0x16'));var db=require(_0x73fe('0x17'))['db'];config[_0x73fe('0x18')]=_[_0x73fe('0x19')](config[_0x73fe('0x18')],{'host':_0x73fe('0x1a'),'port':0x18eb});var socket=require(_0x73fe('0x1b'))(new Redis(config[_0x73fe('0x18')]));require(_0x73fe('0x1c'))[_0x73fe('0x1d')](socket);function respondWithStatusCode(_0x38ef91,_0x4c934f){_0x4c934f=_0x4c934f||0xcc;return function(_0x29150d){if(_0x29150d){return _0x38ef91['sendStatus'](_0x4c934f);}return _0x38ef91[_0x73fe('0x1e')](_0x4c934f)[_0x73fe('0x1f')]();};}function respondWithResult(_0x253579,_0x53fd08){_0x53fd08=_0x53fd08||0xc8;return function(_0xa7c45d){if(_0xa7c45d){return _0x253579[_0x73fe('0x1e')](_0x53fd08)[_0x73fe('0x20')](_0xa7c45d);}};}function respondWithFilteredResult(_0x3df4e4,_0x531c14){return function(_0x4fafc0){if(_0x4fafc0){var _0x361791=typeof _0x531c14[_0x73fe('0x21')]===_0x73fe('0x22')&&typeof _0x531c14[_0x73fe('0x23')]===_0x73fe('0x22');var _0x4eaa32=_0x4fafc0[_0x73fe('0x24')];var _0x388a3c=_0x361791?0x0:_0x531c14[_0x73fe('0x21')];var _0x2b437f=_0x361791?_0x4fafc0[_0x73fe('0x24')]:_0x531c14[_0x73fe('0x21')]+_0x531c14[_0x73fe('0x23')];var _0x3f6627;if(_0x2b437f>=_0x4eaa32){_0x2b437f=_0x4eaa32;_0x3f6627=0xc8;}else{_0x3f6627=0xce;}_0x3df4e4[_0x73fe('0x1e')](_0x3f6627);return _0x3df4e4[_0x73fe('0x25')](_0x73fe('0x26'),_0x388a3c+'-'+_0x2b437f+'/'+_0x4eaa32)[_0x73fe('0x20')](_0x4fafc0);}return null;};}function patchUpdates(_0x4cd3f9){return function(_0xce58be){try{jsonpatch[_0x73fe('0x27')](_0xce58be,_0x4cd3f9,!![]);}catch(_0x4ece5c){return BPromise['reject'](_0x4ece5c);}return _0xce58be[_0x73fe('0x28')]();};}function saveUpdates(_0x48d620,_0x17c200){return function(_0x5d7370){if(_0x5d7370){return _0x5d7370[_0x73fe('0x29')](_0x48d620)[_0x73fe('0x2a')](function(_0x5be41a){return _0x5be41a;});}return null;};}function removeEntity(_0x54c01a,_0x231f86){return function(_0x49f76c){if(_0x49f76c){return _0x49f76c[_0x73fe('0x2b')]()[_0x73fe('0x2a')](function(){_0x54c01a[_0x73fe('0x1e')](0xcc)[_0x73fe('0x1f')]();});}};}function handleEntityNotFound(_0xa0782d,_0x2261b3){return function(_0x51a176){if(!_0x51a176){_0xa0782d[_0x73fe('0x2c')](0x194);}return _0x51a176;};}function handleError(_0x4c4641,_0x13e46e){_0x13e46e=_0x13e46e||0x1f4;return function(_0x140f5a){logger['error'](_0x140f5a[_0x73fe('0x2d')]);if(_0x140f5a[_0x73fe('0x2e')]){delete _0x140f5a[_0x73fe('0x2e')];}_0x4c4641[_0x73fe('0x1e')](_0x13e46e)[_0x73fe('0x2f')](_0x140f5a);};}exports[_0x73fe('0x30')]=function(_0x1d4d3f,_0x132fca){var _0x589a1a={},_0x18b30c={},_0x52d85f={'count':0x0,'rows':[]};var _0x186103=_[_0x73fe('0x31')](db[_0x73fe('0x32')][_0x73fe('0x33')],function(_0x3bc81e){return{'name':_0x3bc81e[_0x73fe('0x34')],'type':_0x3bc81e[_0x73fe('0x35')][_0x73fe('0x36')]};});_0x18b30c[_0x73fe('0x37')]=_[_0x73fe('0x31')](_0x186103,_0x73fe('0x2e'));_0x18b30c[_0x73fe('0x38')]=_[_0x73fe('0x39')](_0x1d4d3f['query']);_0x18b30c['filters']=_[_0x73fe('0x3a')](_0x18b30c[_0x73fe('0x37')],_0x18b30c['query']);_0x589a1a[_0x73fe('0x3b')]=_[_0x73fe('0x3a')](_0x18b30c[_0x73fe('0x37')],qs['fields'](_0x1d4d3f[_0x73fe('0x38')]['fields']));_0x589a1a['attributes']=_0x589a1a[_0x73fe('0x3b')]['length']?_0x589a1a[_0x73fe('0x3b')]:_0x18b30c[_0x73fe('0x37')];if(!_0x1d4d3f['query'][_0x73fe('0x3c')]('nolimit')){_0x589a1a['limit']=qs[_0x73fe('0x23')](_0x1d4d3f['query'][_0x73fe('0x23')]);_0x589a1a[_0x73fe('0x21')]=qs[_0x73fe('0x21')](_0x1d4d3f[_0x73fe('0x38')][_0x73fe('0x21')]);}_0x589a1a[_0x73fe('0x3d')]=qs[_0x73fe('0x3e')](_0x1d4d3f['query'][_0x73fe('0x3e')]);_0x589a1a[_0x73fe('0x3f')]=qs[_0x73fe('0x40')](_['pick'](_0x1d4d3f['query'],_0x18b30c[_0x73fe('0x40')]),_0x186103);if(_0x1d4d3f['query'][_0x73fe('0x41')]){_0x589a1a[_0x73fe('0x3f')]=_[_0x73fe('0x42')](_0x589a1a[_0x73fe('0x3f')],{'$or':_[_0x73fe('0x31')](_0x186103,function(_0x1fa431){if(_0x1fa431['type']!==_0x73fe('0x43')){var _0x12980d={};_0x12980d[_0x1fa431[_0x73fe('0x2e')]]={'$like':'%'+_0x1d4d3f[_0x73fe('0x38')][_0x73fe('0x41')]+'%'};return _0x12980d;}})});}_0x589a1a=_[_0x73fe('0x42')]({},_0x589a1a,_0x1d4d3f[_0x73fe('0x44')]);var _0x5f05d1={'where':_0x589a1a[_0x73fe('0x3f')]};return db[_0x73fe('0x32')][_0x73fe('0x24')](_0x5f05d1)[_0x73fe('0x2a')](function(_0x42372a){_0x52d85f[_0x73fe('0x24')]=_0x42372a;if(_0x1d4d3f[_0x73fe('0x38')]['includeAll']){_0x589a1a['include']=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x589a1a);})[_0x73fe('0x2a')](function(_0x1c6764){_0x52d85f[_0x73fe('0x45')]=_0x1c6764;return _0x52d85f;})[_0x73fe('0x2a')](respondWithFilteredResult(_0x132fca,_0x589a1a))[_0x73fe('0x46')](handleError(_0x132fca,null));};exports[_0x73fe('0x47')]=function(_0x8cc8dc,_0x12d862){var _0x3eda7d={'raw':!![],'where':{'id':_0x8cc8dc[_0x73fe('0x48')]['id']}},_0x1ffb60={};_0x1ffb60[_0x73fe('0x37')]=_['keys'](db[_0x73fe('0x32')][_0x73fe('0x33')]);_0x1ffb60[_0x73fe('0x38')]=_['keys'](_0x8cc8dc[_0x73fe('0x38')]);_0x1ffb60[_0x73fe('0x40')]=_[_0x73fe('0x3a')](_0x1ffb60[_0x73fe('0x37')],_0x1ffb60[_0x73fe('0x38')]);_0x3eda7d[_0x73fe('0x3b')]=_[_0x73fe('0x3a')](_0x1ffb60[_0x73fe('0x37')],qs['fields'](_0x8cc8dc['query'][_0x73fe('0x49')]));_0x3eda7d[_0x73fe('0x3b')]=_0x3eda7d['attributes'][_0x73fe('0x4a')]?_0x3eda7d['attributes']:_0x1ffb60[_0x73fe('0x37')];if(_0x8cc8dc[_0x73fe('0x38')][_0x73fe('0x4b')]){_0x3eda7d[_0x73fe('0x4c')]=[{'all':!![]}];}_0x3eda7d=_[_0x73fe('0x42')]({},_0x3eda7d,_0x8cc8dc[_0x73fe('0x44')]);return db['ChatGroup'][_0x73fe('0x4d')](_0x3eda7d)['then'](handleEntityNotFound(_0x12d862,null))[_0x73fe('0x2a')](respondWithResult(_0x12d862,null))[_0x73fe('0x46')](handleError(_0x12d862,null));};exports[_0x73fe('0x4e')]=function(_0x444ed7,_0x4afb9e){return db[_0x73fe('0x32')][_0x73fe('0x4e')](_0x444ed7[_0x73fe('0x4f')],{})['then'](respondWithResult(_0x4afb9e,0xc9))['catch'](handleError(_0x4afb9e,null));};exports[_0x73fe('0x29')]=function(_0x1785cb,_0xd0246d){if(_0x1785cb['body']['id']){delete _0x1785cb['body']['id'];}return db[_0x73fe('0x32')]['find']({'where':{'id':_0x1785cb[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0xd0246d,null))[_0x73fe('0x2a')](saveUpdates(_0x1785cb[_0x73fe('0x4f')],null))[_0x73fe('0x2a')](respondWithResult(_0xd0246d,null))[_0x73fe('0x46')](handleError(_0xd0246d,null));};exports['destroy']=function(_0x4462d3,_0x258acf){return db[_0x73fe('0x32')][_0x73fe('0x4d')]({'where':{'id':_0x4462d3[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x258acf,null))['then'](removeEntity(_0x258acf,null))['catch'](handleError(_0x258acf,null));};exports[_0x73fe('0x50')]=function(_0x3bf0da,_0x5cda19){return db[_0x73fe('0x32')][_0x73fe('0x50')]()[_0x73fe('0x2a')](respondWithResult(_0x5cda19,null))['catch'](handleError(_0x5cda19,null));};exports[_0x73fe('0x51')]=function(_0x3bf973,_0x23e3c8,_0x2be132){return db[_0x73fe('0x52')][_0x73fe('0x24')]({'where':{'ChatGroupId':_0x3bf973['params']['id'],'ToId':_0x3bf973['user']['id'],'read':![]}})['then'](function(_0x44cf3b){return{'id':_[_0x73fe('0x53')](_0x3bf973[_0x73fe('0x48')]['id']),'count':_0x44cf3b};})[_0x73fe('0x2a')](respondWithResult(_0x23e3c8,null))[_0x73fe('0x46')](handleError(_0x23e3c8,null));};exports['addMembers']=function(_0xa63ad4,_0x5242f6,_0xcd18e9){return db[_0x73fe('0x32')][_0x73fe('0x4d')]({'where':{'id':_0xa63ad4[_0x73fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x5242f6,null))['then'](function(_0x12174a){if(_0x12174a){return _0x12174a[_0x73fe('0x54')](_0xa63ad4[_0x73fe('0x4f')][_0x73fe('0x55')],_[_0x73fe('0x56')](_0xa63ad4[_0x73fe('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x5242f6,null))[_0x73fe('0x46')](handleError(_0x5242f6,null));};exports[_0x73fe('0x57')]=function(_0x32117c,_0x186f96,_0x5c567f){var _0x88af41={};var _0x276c93={};var _0x44b5e9;var _0x384551;return db['ChatGroup'][_0x73fe('0x58')]({'where':{'id':_0x32117c['params']['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x186f96,null))['then'](function(_0x7973b9){if(_0x7973b9){_0x44b5e9=_0x7973b9;_0x276c93['model']=_[_0x73fe('0x39')](db[_0x73fe('0x59')][_0x73fe('0x33')]);_0x276c93[_0x73fe('0x38')]=_[_0x73fe('0x39')](_0x32117c['query']);_0x276c93[_0x73fe('0x40')]=_[_0x73fe('0x3a')](_0x276c93[_0x73fe('0x37')],_0x276c93[_0x73fe('0x38')]);_0x88af41['attributes']=_[_0x73fe('0x3a')](_0x276c93[_0x73fe('0x37')],qs[_0x73fe('0x49')](_0x32117c['query']['fields']));_0x88af41[_0x73fe('0x3b')]=_0x88af41[_0x73fe('0x3b')][_0x73fe('0x4a')]?_0x88af41['attributes']:_0x276c93[_0x73fe('0x37')];_0x88af41[_0x73fe('0x3d')]=qs[_0x73fe('0x3e')](_0x32117c['query'][_0x73fe('0x3e')]);_0x88af41[_0x73fe('0x3f')]=qs[_0x73fe('0x40')](_[_0x73fe('0x5a')](_0x32117c[_0x73fe('0x38')],_0x276c93['filters']));if(_0x32117c[_0x73fe('0x38')]['filter']){_0x88af41[_0x73fe('0x3f')]=_[_0x73fe('0x42')](_0x88af41['where'],{'$or':_[_0x73fe('0x31')](_0x88af41[_0x73fe('0x3b')],function(_0x1f879a){var _0x1207da={};_0x1207da[_0x1f879a]={'$like':'%'+_0x32117c[_0x73fe('0x38')][_0x73fe('0x41')]+'%'};return _0x1207da;})});}_0x88af41=_[_0x73fe('0x42')]({},_0x88af41,_0x32117c[_0x73fe('0x44')]);return _0x44b5e9['getMembers'](_0x88af41);}})[_0x73fe('0x2a')](function(_0x2efc61){if(_0x2efc61){_0x384551=_0x2efc61[_0x73fe('0x4a')];if(!_0x32117c['query'][_0x73fe('0x3c')]('nolimit')){_0x88af41[_0x73fe('0x23')]=qs[_0x73fe('0x23')](_0x32117c[_0x73fe('0x38')][_0x73fe('0x23')]);_0x88af41[_0x73fe('0x21')]=qs[_0x73fe('0x21')](_0x32117c[_0x73fe('0x38')][_0x73fe('0x21')]);}return _0x44b5e9['getMembers'](_0x88af41);}})[_0x73fe('0x2a')](function(_0x27c4ef){if(_0x27c4ef){return _0x27c4ef?{'count':_0x384551,'rows':_0x27c4ef}:null;}})['then'](respondWithResult(_0x186f96,null))[_0x73fe('0x46')](handleError(_0x186f96,null));};exports[_0x73fe('0x5b')]=function(_0x30ecf7,_0x4aa862,_0x5470de){return db[_0x73fe('0x32')]['find']({'where':{'id':_0x30ecf7[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x4aa862,null))[_0x73fe('0x2a')](function(_0x530e31){if(_0x530e31){return _0x530e31[_0x73fe('0x5b')](_0x30ecf7['query'][_0x73fe('0x55')]);}})['then'](respondWithStatusCode(_0x4aa862,null))[_0x73fe('0x46')](handleError(_0x4aa862,null));};exports['addMessage']=function(_0x3ae69c,_0x15597d,_0x1e8c59){if(_0x3ae69c['body']['id']){delete _0x3ae69c[_0x73fe('0x4f')]['id'];}return db[_0x73fe('0x32')][_0x73fe('0x4d')]({'where':{'id':_0x3ae69c[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x15597d,null))[_0x73fe('0x2a')](function(_0x1debc4){if(_0x1debc4){_0x3ae69c[_0x73fe('0x4f')][_0x73fe('0x5c')]=_0x1debc4['id'];return db[_0x73fe('0x52')][_0x73fe('0x4e')](_0x3ae69c[_0x73fe('0x4f')]);}})['then'](respondWithResult(_0x15597d,null))['catch'](handleError(_0x15597d,null));};exports[_0x73fe('0x5d')]=function(_0x287eef,_0x1af16f,_0x1e1861){var _0x503167={};var _0x4b58fb={};var _0x31ee52;var _0x53183b;return db[_0x73fe('0x32')]['findOne']({'where':{'id':_0x287eef[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x1af16f,null))[_0x73fe('0x2a')](function(_0x2c3f69){if(_0x2c3f69){_0x31ee52=_0x2c3f69;_0x4b58fb[_0x73fe('0x37')]=_[_0x73fe('0x39')](db[_0x73fe('0x52')][_0x73fe('0x33')]);_0x4b58fb[_0x73fe('0x38')]=_[_0x73fe('0x39')](_0x287eef['query']);_0x4b58fb[_0x73fe('0x40')]=_[_0x73fe('0x3a')](_0x4b58fb['model'],_0x4b58fb['query']);_0x503167[_0x73fe('0x3b')]=_[_0x73fe('0x3a')](_0x4b58fb['model'],qs['fields'](_0x287eef['query'][_0x73fe('0x49')]));_0x503167[_0x73fe('0x3b')]=_0x503167[_0x73fe('0x3b')][_0x73fe('0x4a')]?_0x503167[_0x73fe('0x3b')]:_0x4b58fb['model'];_0x503167[_0x73fe('0x3d')]=qs[_0x73fe('0x3e')](_0x287eef[_0x73fe('0x38')][_0x73fe('0x3e')]);_0x503167[_0x73fe('0x3f')]=qs[_0x73fe('0x40')](_[_0x73fe('0x5a')](_0x287eef['query'],_0x4b58fb[_0x73fe('0x40')]));if(_0x287eef[_0x73fe('0x38')][_0x73fe('0x41')]){_0x503167[_0x73fe('0x3f')]=_[_0x73fe('0x42')](_0x503167['where'],{'$or':_[_0x73fe('0x31')](_0x503167['attributes'],function(_0x460b64){var _0x37c5b8={};_0x37c5b8[_0x460b64]={'$like':'%'+_0x287eef['query'][_0x73fe('0x41')]+'%'};return _0x37c5b8;})});}if(_0x287eef[_0x73fe('0x38')][_0x73fe('0x5e')]){var _0x3c89eb=_0x287eef['query'][_0x73fe('0x5e')][_0x73fe('0x5f')](',');var _0x397a5b={};_0x397a5b[_0x3c89eb[0x0]]={'$gte':moment(_0x3c89eb[0x1])[_0x73fe('0x60')](_0x73fe('0x61'))};_0x503167['where']=_[_0x73fe('0x42')](_0x503167['where'],_0x397a5b);}_0x503167=_[_0x73fe('0x42')]({},_0x503167,_0x287eef['options']);return _0x31ee52[_0x73fe('0x5d')](_0x503167);}})[_0x73fe('0x2a')](function(_0x451c4f){if(_0x451c4f){_0x53183b=_0x451c4f[_0x73fe('0x4a')];if(!_0x287eef['query'][_0x73fe('0x3c')](_0x73fe('0x62'))){_0x503167[_0x73fe('0x23')]=qs[_0x73fe('0x23')](_0x287eef[_0x73fe('0x38')][_0x73fe('0x23')]);_0x503167[_0x73fe('0x21')]=qs[_0x73fe('0x21')](_0x287eef[_0x73fe('0x38')][_0x73fe('0x21')]);}return _0x31ee52[_0x73fe('0x5d')](_0x503167);}})['then'](function(_0x1146ff){if(_0x1146ff){return _0x1146ff?{'count':_0x53183b,'rows':_0x1146ff}:null;}})[_0x73fe('0x2a')](respondWithResult(_0x1af16f,null))['catch'](handleError(_0x1af16f,null));};
\ No newline at end of file
diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js
index 4226c5b..15d71f2 100644
--- a/server/api/chatGroup/chatGroup.events.js
+++ b/server/api/chatGroup/chatGroup.events.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x675f=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2b5f04,_0x442d05){var _0x5445ae=function(_0x316801){while(--_0x316801){_0x2b5f04['push'](_0x2b5f04['shift']());}};_0x5445ae(++_0x442d05);}(_0x675f,0x149));var _0xf675=function(_0xde6ef1,_0xcff7a1){_0xde6ef1=_0xde6ef1-0x0;var _0x2f8492=_0x675f[_0xde6ef1];return _0x2f8492;};'use strict';var EventEmitter=require(_0xf675('0x0'));var ChatGroup=require(_0xf675('0x1'))['db'][_0xf675('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf675('0x3')](0x0);var events={'afterCreate':_0xf675('0x4'),'afterUpdate':_0xf675('0x5'),'afterDestroy':_0xf675('0x6')};function emitEvent(_0x1372bb){return function(_0x251abe,_0x463d13,_0x3e5daf){ChatGroupEvents['emit'](_0x1372bb+':'+_0x251abe['id'],_0x251abe);ChatGroupEvents[_0xf675('0x7')](_0x1372bb,_0x251abe);_0x3e5daf(null);};}for(var e in events){if(events[_0xf675('0x8')](e)){var event=events[e];ChatGroup[_0xf675('0x9')](e,emitEvent(event));}}module['exports']=ChatGroupEvents;
\ No newline at end of file
+var _0x8cad=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x3b8bde,_0x75252){var _0x17c714=function(_0x567c17){while(--_0x567c17){_0x3b8bde['push'](_0x3b8bde['shift']());}};_0x17c714(++_0x75252);}(_0x8cad,0xfe));var _0xd8ca=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x8cad[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require(_0xd8ca('0x0'));var ChatGroup=require(_0xd8ca('0x1'))['db'][_0xd8ca('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd8ca('0x3')](0x0);var events={'afterCreate':_0xd8ca('0x4'),'afterUpdate':_0xd8ca('0x5'),'afterDestroy':_0xd8ca('0x6')};function emitEvent(_0x10c3c8){return function(_0x1334ec,_0x1e29ce,_0x388aeb){ChatGroupEvents[_0xd8ca('0x7')](_0x10c3c8+':'+_0x1334ec['id'],_0x1334ec);ChatGroupEvents[_0xd8ca('0x7')](_0x10c3c8,_0x1334ec);_0x388aeb(null);};}for(var e in events){if(events[_0xd8ca('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xd8ca('0x9')]=ChatGroupEvents;
\ No newline at end of file
diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js
index 60f92fa..256d125 100644
--- a/server/api/chatGroup/chatGroup.model.js
+++ b/server/api/chatGroup/chatGroup.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xecb6=['ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x1d758d,_0x35a5a8){var _0x3572ca=function(_0x290904){while(--_0x290904){_0x1d758d['push'](_0x1d758d['shift']());}};_0x3572ca(++_0x35a5a8);}(_0xecb6,0xdf));var _0x6ecb=function(_0x4e85bf,_0x45e7e9){_0x4e85bf=_0x4e85bf-0x0;var _0x983070=_0xecb6[_0x4e85bf];return _0x983070;};'use strict';var _=require('lodash');var util=require(_0x6ecb('0x0'));var logger=require(_0x6ecb('0x1'))(_0x6ecb('0x2'));var moment=require(_0x6ecb('0x3'));var BPromise=require(_0x6ecb('0x4'));var rp=require(_0x6ecb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ecb('0x6'));var config=require(_0x6ecb('0x7'));var attributes=require(_0x6ecb('0x8'));module[_0x6ecb('0x9')]=function(_0x4f604c,_0x3e00f6){return _0x4f604c[_0x6ecb('0xa')](_0x6ecb('0xb'),attributes,{'tableName':_0x6ecb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf5bb=['../../config/logger','bluebird','request-promise','rimraf','exports','chat_groups','lodash','util'];(function(_0x3e15f4,_0x2d29a1){var _0x3bb93d=function(_0x396c8b){while(--_0x396c8b){_0x3e15f4['push'](_0x3e15f4['shift']());}};_0x3bb93d(++_0x2d29a1);}(_0xf5bb,0x6e));var _0xbf5b=function(_0x14d82f,_0x59df29){_0x14d82f=_0x14d82f-0x0;var _0x133722=_0xf5bb[_0x14d82f];return _0x133722;};'use strict';var _=require(_0xbf5b('0x0'));var util=require(_0xbf5b('0x1'));var logger=require(_0xbf5b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbf5b('0x3'));var rp=require(_0xbf5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf5b('0x5'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xbf5b('0x6')]=function(_0x4322e1,_0xd9e96a){return _0x4322e1['define']('ChatGroup',attributes,{'tableName':_0xbf5b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js
index 55d6c4a..07288c9 100644
--- a/server/api/chatGroup/chatGroup.rpc.js
+++ b/server/api/chatGroup/chatGroup.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xe953=['result','catch','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x41c24c,_0x5275ce){var _0xafb71a=function(_0x317294){while(--_0x317294){_0x41c24c['push'](_0x41c24c['shift']());}};_0xafb71a(++_0x5275ce);}(_0xe953,0x1d0));var _0x3e95=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0xe953[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e95('0x0'));var db=require(_0x3e95('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e95('0x2'))('rpc');var config=require(_0x3e95('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x3e95('0x4')][_0x3e95('0x5')]({'port':0x232a});config[_0x3e95('0x6')]=_[_0x3e95('0x7')](config[_0x3e95('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e95('0x8'))(new Redis(config[_0x3e95('0x6')]));require(_0x3e95('0x9'))['register'](socket);function respondWithRpcPromise(_0xf019c5,_0x12a756,_0x35ed18){return new BPromise(function(_0x459b58,_0x57c602){return client[_0x3e95('0xa')](_0xf019c5,_0x35ed18)['then'](function(_0x4719dc){logger[_0x3e95('0xb')](_0x3e95('0xc'),_0x12a756,_0x3e95('0xd'));logger[_0x3e95('0xe')](_0x3e95('0xf'),_0x12a756,'request\x20sent',JSON[_0x3e95('0x10')](_0x4719dc));if(_0x4719dc[_0x3e95('0x11')]){if(_0x4719dc['error'][_0x3e95('0x12')]===0x1f4){logger[_0x3e95('0x11')](_0x3e95('0xc'),_0x12a756,_0x4719dc[_0x3e95('0x11')]['message']);return _0x57c602(_0x4719dc[_0x3e95('0x11')][_0x3e95('0x13')]);}logger['error'](_0x3e95('0xc'),_0x12a756,_0x4719dc[_0x3e95('0x11')][_0x3e95('0x13')]);return _0x459b58(_0x4719dc[_0x3e95('0x11')]['message']);}else{logger[_0x3e95('0xb')]('ChatGroup,\x20%s,\x20%s',_0x12a756,_0x3e95('0xd'));_0x459b58(_0x4719dc[_0x3e95('0x14')]['message']);}})[_0x3e95('0x15')](function(_0x3e8b32){logger[_0x3e95('0x11')](_0x3e95('0xc'),_0x12a756,_0x3e8b32);_0x57c602(_0x3e8b32);});});}
\ No newline at end of file
+var _0x57d4=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./chatGroup.socket','register','request','then','info'];(function(_0x34a717,_0x2c828c){var _0x4cf768=function(_0x4db333){while(--_0x4db333){_0x34a717['push'](_0x34a717['shift']());}};_0x4cf768(++_0x2c828c);}(_0x57d4,0x78));var _0x457d=function(_0x5204b2,_0x4a531a){_0x5204b2=_0x5204b2-0x0;var _0x8b129c=_0x57d4[_0x5204b2];return _0x8b129c;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var moment=require('moment');var BPromise=require(_0x457d('0x2'));var rs=require(_0x457d('0x3'));var fs=require('fs');var Redis=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];var utils=require(_0x457d('0x6'));var logger=require(_0x457d('0x7'))(_0x457d('0x8'));var config=require(_0x457d('0x9'));var jayson=require(_0x457d('0xa'));var client=jayson[_0x457d('0xb')][_0x457d('0xc')]({'port':0x232a});config['redis']=_[_0x457d('0xd')](config[_0x457d('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x457d('0xe')]));require(_0x457d('0xf'))[_0x457d('0x10')](socket);function respondWithRpcPromise(_0x559024,_0x5bc628,_0x568a59){return new BPromise(function(_0x2214e6,_0x38ec93){return client[_0x457d('0x11')](_0x559024,_0x568a59)[_0x457d('0x12')](function(_0x25ae31){logger[_0x457d('0x13')](_0x457d('0x14'),_0x5bc628,_0x457d('0x15'));logger[_0x457d('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5bc628,_0x457d('0x15'),JSON[_0x457d('0x17')](_0x25ae31));if(_0x25ae31['error']){if(_0x25ae31['error'][_0x457d('0x18')]===0x1f4){logger[_0x457d('0x19')](_0x457d('0x14'),_0x5bc628,_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);return _0x38ec93(_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);}logger[_0x457d('0x19')]('ChatGroup,\x20%s,\x20%s',_0x5bc628,_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);return _0x2214e6(_0x25ae31[_0x457d('0x19')]['message']);}else{logger['info'](_0x457d('0x14'),_0x5bc628,'request\x20sent');_0x2214e6(_0x25ae31[_0x457d('0x1b')][_0x457d('0x1a')]);}})['catch'](function(_0x2a22b6){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5bc628,_0x2a22b6);_0x38ec93(_0x2a22b6);});});}
\ No newline at end of file
diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js
index 09c281f..1d03d43 100644
--- a/server/api/chatGroup/chatGroup.socket.js
+++ b/server/api/chatGroup/chatGroup.socket.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x9916=['save','remove','update','emit','removeListener','register','./chatGroup.events'];(function(_0x16a411,_0x4af997){var _0x239801=function(_0x2036b9){while(--_0x2036b9){_0x16a411['push'](_0x16a411['shift']());}};_0x239801(++_0x4af997);}(_0x9916,0x172));var _0x6991=function(_0x2ee522,_0x21b1ea){_0x2ee522=_0x2ee522-0x0;var _0x1f0028=_0x9916[_0x2ee522];return _0x1f0028;};'use strict';var ChatGroupEvents=require(_0x6991('0x0'));var events=[_0x6991('0x1'),_0x6991('0x2'),_0x6991('0x3')];function createListener(_0x3e5406,_0x1c6c65){return function(_0x1bbca5){_0x1c6c65[_0x6991('0x4')](_0x3e5406,_0x1bbca5);};}function removeListener(_0x5d51e6,_0x1846b4){return function(){ChatGroupEvents[_0x6991('0x5')](_0x5d51e6,_0x1846b4);};}exports[_0x6991('0x6')]=function(_0x1c8926){for(var _0x33d97b=0x0,_0x1684e8=events['length'];_0x33d97b<_0x1684e8;_0x33d97b++){var _0xbeabda=events[_0x33d97b];var _0x24f5b0=createListener('chatGroup:'+_0xbeabda,_0x1c8926);ChatGroupEvents['on'](_0xbeabda,_0x24f5b0);}};
\ No newline at end of file
+var _0x19dd=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x4ca4ba,_0x155385){var _0x1cf44d=function(_0x25f438){while(--_0x25f438){_0x4ca4ba['push'](_0x4ca4ba['shift']());}};_0x1cf44d(++_0x155385);}(_0x19dd,0xed));var _0xd19d=function(_0x4c108a,_0x446e7d){_0x4c108a=_0x4c108a-0x0;var _0x402892=_0x19dd[_0x4c108a];return _0x402892;};'use strict';var ChatGroupEvents=require(_0xd19d('0x0'));var events=[_0xd19d('0x1'),'remove',_0xd19d('0x2')];function createListener(_0xb4920c,_0x2c0c9f){return function(_0x1d6ecd){_0x2c0c9f[_0xd19d('0x3')](_0xb4920c,_0x1d6ecd);};}function removeListener(_0x255f24,_0x17767b){return function(){ChatGroupEvents[_0xd19d('0x4')](_0x255f24,_0x17767b);};}exports[_0xd19d('0x5')]=function(_0x49c6f1){for(var _0x528600=0x0,_0x16d31c=events[_0xd19d('0x6')];_0x528600<_0x16d31c;_0x528600++){var _0x4a8c63=events[_0x528600];var _0x47ad98=createListener(_0xd19d('0x7')+_0x4a8c63,_0x49c6f1);ChatGroupEvents['on'](_0x4a8c63,_0x47ad98);}};
\ No newline at end of file
diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js
index 32ab1ef..18a9199 100644
--- a/server/api/chatGroup/index.js
+++ b/server/api/chatGroup/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x2213=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','removeMembers','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x2213,0x1e0));var _0x3221=function(_0x5840c5,_0x2024ce){_0x5840c5=_0x5840c5-0x0;var _0x5d0e6a=_0x2213[_0x5840c5];return _0x5d0e6a;};'use strict';var multer=require('multer');var util=require(_0x3221('0x0'));var path=require(_0x3221('0x1'));var timeout=require(_0x3221('0x2'));var express=require('express');var router=express[_0x3221('0x3')]();var fs_extra=require(_0x3221('0x4'));var auth=require(_0x3221('0x5'));var interaction=require(_0x3221('0x6'));var config=require(_0x3221('0x7'));var controller=require('./chatGroup.controller');router[_0x3221('0x8')]('/',auth[_0x3221('0x9')](),controller[_0x3221('0xa')]);router['get'](_0x3221('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x3221('0xc'),auth[_0x3221('0x9')](),controller['show']);router[_0x3221('0x8')](_0x3221('0xd'),auth[_0x3221('0x9')](),controller[_0x3221('0xe')]);router[_0x3221('0x8')](_0x3221('0xf'),auth[_0x3221('0x9')](),controller['getMembers']);router[_0x3221('0x8')](_0x3221('0x10'),auth[_0x3221('0x9')](),controller[_0x3221('0x11')]);router[_0x3221('0x12')]('/',auth[_0x3221('0x9')](),controller[_0x3221('0x13')]);router['post']('/:id/members',auth[_0x3221('0x9')](),controller[_0x3221('0x14')]);router[_0x3221('0x12')](_0x3221('0x10'),auth[_0x3221('0x9')](),controller[_0x3221('0x15')]);router[_0x3221('0x16')](_0x3221('0xc'),auth[_0x3221('0x9')](),controller[_0x3221('0x17')]);router[_0x3221('0x18')](_0x3221('0xc'),auth[_0x3221('0x9')](),controller['destroy']);router['delete']('/:id/members',auth[_0x3221('0x9')](),controller[_0x3221('0x19')]);module[_0x3221('0x1a')]=router;
\ No newline at end of file
+var _0x5a23=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','destroy','exports','multer'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5a23,0xdf));var _0x35a2=function(_0x1eb25d,_0x65835a){_0x1eb25d=_0x1eb25d-0x0;var _0x22348c=_0x5a23[_0x1eb25d];return _0x22348c;};'use strict';var multer=require(_0x35a2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x35a2('0x1'));var router=express[_0x35a2('0x2')]();var fs_extra=require(_0x35a2('0x3'));var auth=require(_0x35a2('0x4'));var interaction=require(_0x35a2('0x5'));var config=require('../../config/environment');var controller=require(_0x35a2('0x6'));router[_0x35a2('0x7')]('/',auth[_0x35a2('0x8')](),controller[_0x35a2('0x9')]);router[_0x35a2('0x7')](_0x35a2('0xa'),auth[_0x35a2('0x8')](),controller['describe']);router[_0x35a2('0x7')](_0x35a2('0xb'),auth['isAuthenticated'](),controller[_0x35a2('0xc')]);router[_0x35a2('0x7')](_0x35a2('0xd'),auth['isAuthenticated'](),controller[_0x35a2('0xe')]);router[_0x35a2('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x35a2('0xf')]);router[_0x35a2('0x7')](_0x35a2('0x10'),auth[_0x35a2('0x8')](),controller[_0x35a2('0x11')]);router[_0x35a2('0x12')]('/',auth['isAuthenticated'](),controller[_0x35a2('0x13')]);router[_0x35a2('0x12')](_0x35a2('0x14'),auth[_0x35a2('0x8')](),controller[_0x35a2('0x15')]);router[_0x35a2('0x12')](_0x35a2('0x10'),auth['isAuthenticated'](),controller[_0x35a2('0x16')]);router[_0x35a2('0x17')]('/:id',auth[_0x35a2('0x8')](),controller[_0x35a2('0x18')]);router[_0x35a2('0x19')](_0x35a2('0xb'),auth[_0x35a2('0x8')](),controller[_0x35a2('0x1a')]);router[_0x35a2('0x19')](_0x35a2('0x14'),auth[_0x35a2('0x8')](),controller['removeMembers']);module[_0x35a2('0x1b')]=router;
\ No newline at end of file
diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js
index 9acdd8e..db3ad88 100644
--- a/server/api/chatInteraction/chatInteraction.attributes.js
+++ b/server/api/chatInteraction/chatInteraction.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x38d0=['DATE','STRING','ENUM','exports','BOOLEAN','INTEGER','star','thumb','TEXT'];(function(_0x8ce9e8,_0x967453){var _0x2acf86=function(_0x32a3c9){while(--_0x32a3c9){_0x8ce9e8['push'](_0x8ce9e8['shift']());}};_0x2acf86(++_0x967453);}(_0x38d0,0x123));var _0x038d=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x38d0[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require('sequelize');module[_0x038d('0x0')]={'closed':{'type':Sequelize[_0x038d('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x038d('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x038d('0x3'),_0x038d('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x038d('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x038d('0x6')]},'disposition':{'type':Sequelize[_0x038d('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x038d('0x7')]},'note':{'type':Sequelize[_0x038d('0x7')]},'browserName':{'type':Sequelize[_0x038d('0x7')]},'browserVersion':{'type':Sequelize[_0x038d('0x7')]},'osName':{'type':Sequelize[_0x038d('0x7')]},'osVersion':{'type':Sequelize[_0x038d('0x7')]},'deviceModel':{'type':Sequelize[_0x038d('0x7')]},'deviceVendor':{'type':Sequelize[_0x038d('0x7')]},'deviceType':{'type':Sequelize[_0x038d('0x7')]},'referer':{'type':Sequelize[_0x038d('0x5')]},'customerIp':{'type':Sequelize[_0x038d('0x7')]},'formData':{'type':Sequelize[_0x038d('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x038d('0x6')]},'lastMsgAt':{'type':Sequelize[_0x038d('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x038d('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x038d('0x7')]},'customerPort':{'type':Sequelize[_0x038d('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x038d('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x038d('0x1')],'defaultValue':![]}};
\ No newline at end of file
+var _0xe511=['DATE','long','ENUM','out','sequelize','exports','INTEGER','star','thumb','TEXT','STRING'];(function(_0x275c8f,_0x316886){var _0x47519b=function(_0x576942){while(--_0x576942){_0x275c8f['push'](_0x275c8f['shift']());}};_0x47519b(++_0x316886);}(_0xe511,0x16f));var _0x1e51=function(_0x2a99f1,_0x198fd7){_0x2a99f1=_0x2a99f1-0x0;var _0x6948e5=_0xe511[_0x2a99f1];return _0x6948e5;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1e51('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x1e51('0x3'),_0x1e51('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1e51('0x5')]},'pathTranscript':{'type':Sequelize[_0x1e51('0x5')]},'mailTranscript':{'type':Sequelize[_0x1e51('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1e51('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1e51('0x6')]},'thirdDisposition':{'type':Sequelize[_0x1e51('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x1e51('0x6')]},'osName':{'type':Sequelize[_0x1e51('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1e51('0x6')]},'deviceType':{'type':Sequelize[_0x1e51('0x6')]},'referer':{'type':Sequelize[_0x1e51('0x5')]},'customerIp':{'type':Sequelize[_0x1e51('0x6')]},'formData':{'type':Sequelize[_0x1e51('0x5')](_0x1e51('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x1e51('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1e51('0x9')]('in',_0x1e51('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1e51('0x6')]},'customerPort':{'type':Sequelize[_0x1e51('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x1e51('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js
index f61524b..fe09c43 100644
--- a/server/api/chatInteraction/chatInteraction.controller.js
+++ b/server/api/chatInteraction/chatInteraction.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd2ea=['Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','ChatInteractionId','filter','$gte','findAll','getMyMessages','include','addTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','server','tmp','files','attachments','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./chatInteraction.socket','register','client','http','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','destroy','name','send','render','merge','body','contact','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','unmanaged','total','closed','UserId','disposition','abandoned','answered','index','ChatInteraction','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','where','filters','pick','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','c.email','Contact.phone','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','rawAttributes','intersection','options','create','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut'];(function(_0x3d474,_0x5f50f7){var _0xca0cca=function(_0x195368){while(--_0x195368){_0x3d474['push'](_0x3d474['shift']());}};_0xca0cca(++_0x5f50f7);}(_0xd2ea,0x15f));var _0xad2e=function(_0xd18bb,_0x4dfdb9){_0xd18bb=_0xd18bb-0x0;var _0x5e9922=_0xd2ea[_0xd18bb];return _0x5e9922;};'use strict';var rimraf=require(_0xad2e('0x0'));var zipdir=require(_0xad2e('0x1'));var rp=require(_0xad2e('0x2'));var moment=require(_0xad2e('0x3'));var BPromise=require(_0xad2e('0x4'));var Mustache=require('mustache');var util=require(_0xad2e('0x5'));var path=require(_0xad2e('0x6'));var ejs=require(_0xad2e('0x7'));var fs=require('fs');var _=require(_0xad2e('0x8'));var squel=require(_0xad2e('0x9'));var Redis=require(_0xad2e('0xa'));var qs=require(_0xad2e('0xb'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xad2e('0xc'));var logger=require(_0xad2e('0xd'))(_0xad2e('0xe'));var config=require('../../config/environment');var db=require(_0xad2e('0xf'))['db'];config[_0xad2e('0x10')]=_['defaults'](config[_0xad2e('0x10')],{'host':'localhost','port':0x18eb});var socket=require(_0xad2e('0x11'))(new Redis(config[_0xad2e('0x10')]));require(_0xad2e('0x12'))[_0xad2e('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0xad2e('0x14')]['http']({'port':0x232b});var client9004=jayson[_0xad2e('0x14')][_0xad2e('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x433696,_0x42e2f2,_0x59a342,_0x27fb5a){return new BPromise(function(_0x59201f,_0x1a91ce){var _0x5772f0=_0x27fb5a||client;return _0x5772f0['request'](_0x433696,_0x59a342)['then'](function(_0x5c96a7){logger[_0xad2e('0x16')](_0xad2e('0x17'),_0x42e2f2,_0xad2e('0x18'));logger[_0xad2e('0x19')](_0xad2e('0x1a'),_0x42e2f2,_0xad2e('0x18'),JSON[_0xad2e('0x1b')](_0x5c96a7));if(_0x5c96a7[_0xad2e('0x1c')]){if(_0x5c96a7[_0xad2e('0x1c')][_0xad2e('0x1d')]===0x1f4){logger[_0xad2e('0x1c')](_0xad2e('0x17'),_0x42e2f2,_0x5c96a7[_0xad2e('0x1c')][_0xad2e('0x1e')]);return _0x1a91ce(_0x5c96a7[_0xad2e('0x1c')]['message']);}logger[_0xad2e('0x1c')](_0xad2e('0x17'),_0x42e2f2,_0x5c96a7['error']['message']);return _0x59201f(_0x5c96a7['error']['message']);}else{logger[_0xad2e('0x16')](_0xad2e('0x17'),_0x42e2f2,_0xad2e('0x18'));_0x59201f(_0x5c96a7[_0xad2e('0x1f')][_0xad2e('0x1e')]);}})[_0xad2e('0x20')](function(_0x29dc4f){logger[_0xad2e('0x1c')](_0xad2e('0x17'),_0x42e2f2,_0x29dc4f);_0x1a91ce(_0x29dc4f);});});}function respondWithStatusCode(_0x154d54,_0x40e1e4){_0x40e1e4=_0x40e1e4||0xcc;return function(_0x142631){if(_0x142631){return _0x154d54[_0xad2e('0x21')](_0x40e1e4);}return _0x154d54[_0xad2e('0x22')](_0x40e1e4)[_0xad2e('0x23')]();};}function respondWithResult(_0x2e1c95,_0x59630b){_0x59630b=_0x59630b||0xc8;return function(_0x2e727c){if(_0x2e727c){return _0x2e1c95[_0xad2e('0x22')](_0x59630b)[_0xad2e('0x24')](_0x2e727c);}};}function respondWithFilteredResult(_0x350c66,_0x2f9370){return function(_0x58acc8){if(_0x58acc8){var _0x1161d5=typeof _0x2f9370[_0xad2e('0x25')]===_0xad2e('0x26')&&typeof _0x2f9370['limit']===_0xad2e('0x26');var _0x5d675f=_0x58acc8[_0xad2e('0x27')];var _0x28ef72=_0x1161d5?0x0:_0x2f9370[_0xad2e('0x25')];var _0x11bfa9=_0x1161d5?_0x58acc8[_0xad2e('0x27')]:_0x2f9370[_0xad2e('0x25')]+_0x2f9370[_0xad2e('0x28')];var _0x454c04;if(_0x11bfa9>=_0x5d675f){_0x11bfa9=_0x5d675f;_0x454c04=0xc8;}else{_0x454c04=0xce;}_0x350c66[_0xad2e('0x22')](_0x454c04);return _0x350c66[_0xad2e('0x29')]('Content-Range',_0x28ef72+'-'+_0x11bfa9+'/'+_0x5d675f)[_0xad2e('0x24')](_0x58acc8);}return null;};}function saveUpdates(_0xfd2087){return function(_0x2a0dc7){if(_0x2a0dc7){return _0x2a0dc7[_0xad2e('0x2a')](_0xfd2087)[_0xad2e('0x2b')](function(_0x9b4a23){return _0x9b4a23;});}return null;};}function removeEntity(_0x409f58){return function(_0x3e3d86){if(_0x3e3d86){return _0x3e3d86[_0xad2e('0x2c')]()[_0xad2e('0x2b')](function(){_0x409f58[_0xad2e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3099fd){return function(_0x55e1dc){if(!_0x55e1dc){_0x3099fd[_0xad2e('0x21')](0x194);}return _0x55e1dc;};}function handleError(_0x3a6419,_0x5ac436){_0x5ac436=_0x5ac436||0x1f4;return function(_0x19d0fa){logger[_0xad2e('0x1c')](_0x19d0fa['stack']);if(_0x19d0fa[_0xad2e('0x2d')]){delete _0x19d0fa[_0xad2e('0x2d')];}_0x3a6419['status'](_0x5ac436)[_0xad2e('0x2e')](_0x19d0fa);};}function getMustacheRender(_0x100b35,_0x569b9c){return Mustache[_0xad2e('0x2f')](_0x100b35,_[_0xad2e('0x30')](_0x569b9c[_0xad2e('0x31')],{'contact':_0x569b9c[_0xad2e('0x32')],'message':_0x569b9c[_0xad2e('0x1e')],'agent':_0x569b9c[_0xad2e('0x33')],'interaction':_0x569b9c[_0xad2e('0x34')],'account':_0x569b9c['account']}))||'';}function getInteractionUsers(_0x41a022,_0x5b4386){return new BPromise(function(_0x49db79,_0x161402){try{if(_0x5b4386[_0x41a022['id']]){_0x41a022[_0xad2e('0x35')]=_[_0xad2e('0x36')](_0x5b4386[_0x41a022['id']],function(_0x14d8d6){return{'id':_0x14d8d6['id'],'fullname':_0x14d8d6[_0xad2e('0x37')]};});}}catch(_0xf4ae70){_0x161402(_0xf4ae70);}_0x49db79(_0x41a022);});}function getInteractionTags(_0x4fe4f6,_0x5d6ac1){return new BPromise(function(_0x924f10,_0x4b53d6){try{if(_0x4fe4f6[_0xad2e('0x38')]){_0x4fe4f6[_0xad2e('0x39')]=[];_0x4fe4f6[_0xad2e('0x38')][_0xad2e('0x3a')](',')[_0xad2e('0x3b')](function(_0x5d55f9){_0x4fe4f6[_0xad2e('0x39')][_0xad2e('0x3c')](_0x5d6ac1[_0x5d55f9]);});}delete _0x4fe4f6['TagIds'];}catch(_0x596eee){_0x4b53d6(_0x596eee);}_0x924f10(_0x4fe4f6);});}function updateChatInteraction(_0x5ba338,_0x274fd8,_0x54dac3){return new BPromise(function(_0x5f29a5,_0x2d0018){return getInteractionUsers(_0x5ba338,_0x54dac3)[_0xad2e('0x2b')](function(_0x271a49){return getInteractionTags(_0x271a49,_0x274fd8);})[_0xad2e('0x2b')](function(_0x6f4fbc){return getStateInteraction(_0x6f4fbc);})[_0xad2e('0x2b')](function(_0x382665){_0x5f29a5(_0x382665);})['catch'](function(_0xec9e1a){_0x2d0018(_0xec9e1a);});});}function getStateInteraction(_0x341f51){return new BPromise(function(_0x46684d){_0x341f51[_0xad2e('0x3d')]=0x0;_0x341f51[_0xad2e('0x3e')]=0x0;_0x341f51['answered']=0x0;_0x341f51[_0xad2e('0x3f')]=0x0;_0x341f51['abandoned']=0x0;_0x341f51[_0xad2e('0x40')]=0x0;if(!_0x341f51[_0xad2e('0x41')]&&!_0x341f51[_0xad2e('0x42')]){_0x341f51[_0xad2e('0x3d')]+=0x1;}if(!_0x341f51[_0xad2e('0x41')]&&_0x341f51[_0xad2e('0x42')]){_0x341f51[_0xad2e('0x3e')]+=0x1;if(_0x341f51[_0xad2e('0x3d')]){_0x341f51[_0xad2e('0x3d')]-=0x1;}}if(_0x341f51[_0xad2e('0x41')]&&_0x341f51[_0xad2e('0x43')]===_0xad2e('0x44')){_0x341f51[_0xad2e('0x44')]+=0x1;if(_0x341f51[_0xad2e('0x3d')]){_0x341f51[_0xad2e('0x3d')]-=0x1;}}else if(_0x341f51[_0xad2e('0x41')]&&!_0x341f51[_0xad2e('0x42')]&&_0x341f51[_0xad2e('0x43')]){_0x341f51[_0xad2e('0x3f')]+=0x1;if(_0x341f51[_0xad2e('0x3d')]){_0x341f51['waiting']-=0x1;}}else if(_0x341f51[_0xad2e('0x41')]&&_0x341f51[_0xad2e('0x42')]){_0x341f51[_0xad2e('0x45')]+=0x1;if(_0x341f51[_0xad2e('0x3e')]){_0x341f51[_0xad2e('0x3e')]-=0x1;}}_0x341f51[_0xad2e('0x40')]+=0x1;_0x46684d(_0x341f51);});}exports[_0xad2e('0x46')]=function(_0x4c99ec,_0x15e253){var _0x579a26={},_0x1f2f49={},_0x2ad66e={'count':0x0,'rows':[]};var _0x36b103=_[_0xad2e('0x36')](db[_0xad2e('0x47')]['rawAttributes'],function(_0xf80dd8){return{'name':_0xf80dd8[_0xad2e('0x48')],'type':_0xf80dd8[_0xad2e('0x49')][_0xad2e('0x4a')]};});_0x1f2f49[_0xad2e('0x4b')]=_['map'](_0x36b103,_0xad2e('0x2d'));_0x1f2f49[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x4c99ec[_0xad2e('0x4c')]);_0x1f2f49['filters']=_['intersection'](_0x1f2f49[_0xad2e('0x4b')],_0x1f2f49[_0xad2e('0x4c')]);_0x579a26['attributes']=_['intersection'](_0x1f2f49[_0xad2e('0x4b')],qs['fields'](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x4e')]));_0x579a26['attributes']=_0x579a26[_0xad2e('0x4f')][_0xad2e('0x50')]?_0x579a26[_0xad2e('0x4f')]:_0x1f2f49[_0xad2e('0x4b')];if(!_0x4c99ec['query']['hasOwnProperty'](_0xad2e('0x51'))){_0x579a26[_0xad2e('0x28')]=qs[_0xad2e('0x28')](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x28')]);_0x579a26[_0xad2e('0x25')]=qs[_0xad2e('0x25')](_0x4c99ec[_0xad2e('0x4c')]['offset']);}_0x579a26[_0xad2e('0x52')]=qs['sort'](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x53')]);_0x579a26[_0xad2e('0x54')]=qs[_0xad2e('0x55')](_[_0xad2e('0x56')](_0x4c99ec[_0xad2e('0x4c')],_0x1f2f49[_0xad2e('0x55')]),_0x36b103);var _0x4aeb4a=[];var _0x411956=squel['select']()[_0xad2e('0x57')]('id')[_0xad2e('0x57')](_0xad2e('0x2d'))[_0xad2e('0x57')]('color')[_0xad2e('0x58')](_0xad2e('0x59'));var _0x56e633=squel[_0xad2e('0x5a')]()['field'](_0xad2e('0x5b'))[_0xad2e('0x57')](_0xad2e('0x5c'))[_0xad2e('0x57')](_0xad2e('0x5d'))[_0xad2e('0x58')](_0xad2e('0x5e'),'ui')[_0xad2e('0x5f')](_0xad2e('0x60'),'u','u.id\x20=\x20ui.UserId');var _0xe2d4ac=squel[_0xad2e('0x5a')]()[_0xad2e('0x58')](_0xad2e('0x61'),'i')['left_join']('cm_contacts','c',_0xad2e('0x62'))[_0xad2e('0x5f')](_0xad2e('0x60'),'o',_0xad2e('0x63'))[_0xad2e('0x5f')](_0xad2e('0x64'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xad2e('0x5f')](_0xad2e('0x65'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xad2e('0x5f')](_0xad2e('0x66'),'it',_0xad2e('0x67'))[_0xad2e('0x5f')](_0xad2e('0x59'),'t',_0xad2e('0x68'));var _0x1ce266=squel[_0xad2e('0x69')]();var _0x745c47=[];var _0x124eaf=squel['expr']();var _0x583c12;if(_0x4c99ec[_0xad2e('0x4c')]['search']){_0x583c12=as['parseSearch'](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x6a')]);var _0x3bfa74=_0x583c12['sqlOperator'];for(var _0x114ed5=0x0;_0x114ed5<_0x583c12[_0xad2e('0x6b')][_0xad2e('0x50')];_0x114ed5++){var _0x470bda=_0x583c12[_0xad2e('0x6b')][_0x114ed5];var _0x5d538c='i';var _0x22554f=_['find'](_0x36b103,['name',_0x470bda['field']]);if(!_0x22554f){switch(_0x470bda['field']){case _0xad2e('0x6c'):if(_0x470bda[_0xad2e('0x6d')]==0x1){_0xe2d4ac[_0xad2e('0x6e')]('`'+_0x470bda[_0xad2e('0x57')]+_0xad2e('0x6f'));}else{_0xe2d4ac[_0xad2e('0x6e')]('`'+_0x470bda[_0xad2e('0x57')]+_0xad2e('0x70'));}break;case _0xad2e('0x71'):if(_0x470bda[_0xad2e('0x72')]===_0xad2e('0x73')){if(_0x470bda['value'][_0xad2e('0x3a')]('\x20')[_0xad2e('0x50')]>0x1){_0x1ce266[_0x3bfa74]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x470bda[_0xad2e('0x6d')]),null);}else{var _0x49a7d9='%'+_0x470bda[_0xad2e('0x6d')]+'%';_0x1ce266[_0x3bfa74](_0xad2e('0x74'),_0x49a7d9,_0x49a7d9,_0x49a7d9);}}else{_0x22554f=_[_0xad2e('0x75')](_0x36b103,[_0xad2e('0x2d'),_0xad2e('0x76')]);_0x470bda[_0xad2e('0x57')]=_0xad2e('0x76');_0x46bf5e=as[_0xad2e('0x77')](_0x5d538c,_0x22554f['type'],_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e['value']['start'],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);}break;case'Tag':var _0x33846a=_0x470bda[_0xad2e('0x6d')][_0xad2e('0x3a')](',')['map'](function(_0x1e5f05){return Number(_0x1e5f05);});_0x33846a['forEach'](function(_0x1469a2){_0x124eaf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1469a2+',%');});_0x745c47=_[_0xad2e('0x79')](_0x745c47,_0x33846a);break;case _0xad2e('0x7a'):if(_0x470bda[_0xad2e('0x72')]===_0xad2e('0x73')){_0x1ce266[_0x3bfa74](_0xad2e('0x7b'),'%'+_0x470bda[_0xad2e('0x6d')]+'%',null);}else{_0x22554f=_['find'](_0x36b103,['name',_0xad2e('0x42')]);_0x470bda[_0xad2e('0x57')]=_0xad2e('0x42');_0x46bf5e=as[_0xad2e('0x77')](_0x5d538c,_0x22554f['type'],_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x7c')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);}break;case _0xad2e('0x31'):_0x46bf5e=as[_0xad2e('0x77')]('me',null,_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e[_0xad2e('0x6d')]['start'],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);break;}}else{var _0x46bf5e=as['buildExpression'](_0x5d538c,_0x22554f[_0xad2e('0x49')],_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x7c')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);}}}else{var _0x4cf84e=_(_0x4c99ec['query'])['keys']()['map'](function(_0xa426c8){return _[_0xad2e('0x7d')](_0x36b103,['name',_0xa426c8])?_0xa426c8:undefined;})[_0xad2e('0x7e')]()[_0xad2e('0x6d')]();if(!_[_0xad2e('0x7f')](_0x4cf84e)){_0x4cf84e[_0xad2e('0x3b')](function(_0x13491c){if(_0x13491c===_0xad2e('0x80')){_0xe2d4ac[_0xad2e('0x54')](_0xad2e('0x81'),[]['concat'](_0x4c99ec['query'][_0x13491c]));}else if(_0x13491c==='createdAt'){var _0x4eb716=JSON['parse'](_0x4c99ec[_0xad2e('0x4c')][_0x13491c])['$gte'];var _0x3bdc76=JSON[_0xad2e('0x82')](_0x4c99ec[_0xad2e('0x4c')][_0x13491c])['$lte'];_0xe2d4ac['where'](_0xad2e('0x83'),_0x4eb716,_0x3bdc76);}else{if(_0x4c99ec['query'][_0x13491c]==='null'){_0xe2d4ac[_0xad2e('0x54')]('i.'+_0x13491c+_0xad2e('0x84'));}else{_0xe2d4ac[_0xad2e('0x54')]('i.'+_0x13491c+_0xad2e('0x85'),_0x4c99ec[_0xad2e('0x4c')][_0x13491c]);}}});}if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x86')]){if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x86')]==0x1){_0xe2d4ac[_0xad2e('0x6e')]('`unreadMessages`\x20=\x200');}else{_0xe2d4ac['having'](_0xad2e('0x87'));}}if(_0x4c99ec[_0xad2e('0x4c')]['tag']){_0x745c47=_[_0xad2e('0x88')](_0x4c99ec[_0xad2e('0x4c')]['tag'])?_0x4c99ec['query'][_0xad2e('0x89')]:new Array(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x89')]);_0x745c47[_0xad2e('0x3b')](function(_0x11421f){_0x124eaf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x11421f+',%');});}if(_0x4c99ec[_0xad2e('0x4c')]['filter']){var _0x76b71a=_0x4c99ec[_0xad2e('0x4c')]['filter'][_0xad2e('0x8a')]('\x5c','\x5c\x5c')[_0xad2e('0x8a')](/'/g,'\x27\x27');if(qs[_0xad2e('0x8b')](_0x76b71a)){_0x1ce266['or']('i.id\x20LIKE\x20?',_0x76b71a+'%');}else{_0x1ce266['or'](_0xad2e('0x8c'),qs[_0xad2e('0x8d')](_0x76b71a))['or'](_0xad2e('0x8e'),_0x76b71a+'%');}}}_0xe2d4ac[_0xad2e('0x54')](_0x1ce266);_0xe2d4ac[_0xad2e('0x8f')]('i.id');var _0x2ea2d8={'type':db['Sequelize'][_0xad2e('0x90')][_0xad2e('0x91')],'raw':!![]};var _0x10672d=_0xe2d4ac[_0xad2e('0x92')]();_0x10672d[_0xad2e('0x57')](_0xad2e('0x93'));_0x10672d[_0xad2e('0x57')](_0xad2e('0x94'),_0xad2e('0x6c'));if(_0x579a26[_0xad2e('0x52')]){_0x579a26[_0xad2e('0x52')][_0xad2e('0x3b')](function(_0x4a7a2e){var _0x1f2c13=_0x4a7a2e[0x0]===_0xad2e('0x95')?_0x4a7a2e[0x0]:'i.'+_0x4a7a2e[0x0];_0xe2d4ac[_0xad2e('0x52')](_0x1f2c13,_0x4a7a2e[0x1]===_0xad2e('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x745c47)){_0xe2d4ac[_0xad2e('0x6e')](_0x124eaf);_0x10672d[_0xad2e('0x54')](_0xad2e('0x97'),_0x745c47);}BPromise[_0xad2e('0x98')]()['then'](function(){if(!_0x583c12){if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x80')])return;_0x10672d[_0xad2e('0x54')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0xe2d4ac[_0xad2e('0x54')](_0xad2e('0x99'));return;}if(_0x4c99ec[_0xad2e('0x9a')][_0xad2e('0x9b')]!=='agent')return;return _0x4c99ec[_0xad2e('0x9a')][_0xad2e('0x9c')]({'attributes':['id'],'raw':!![]})[_0xad2e('0x2b')](function(_0xc55f6a){if(_[_0xad2e('0x7f')](_0xc55f6a)){_0x10672d[_0xad2e('0x54')](_0xad2e('0x9d'));_0xe2d4ac[_0xad2e('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x10672d[_0xad2e('0x54')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0xc55f6a,'id'));_0xe2d4ac[_0xad2e('0x54')](_0xad2e('0x81'),_[_0xad2e('0x36')](_0xc55f6a,'id'));}});})[_0xad2e('0x2b')](function(){if(_0x4c99ec[_0xad2e('0x9a')][_0xad2e('0x9b')]===_0xad2e('0x33')&&!_0x583c12&&!_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x80')])return[];return db[_0xad2e('0x9e')][_0xad2e('0x4c')](_0x10672d[_0xad2e('0x9f')](),_0x2ea2d8);})['then'](function(_0x2f029b){_0x2ad66e[_0xad2e('0x27')]=_0x2f029b[_0xad2e('0x50')];if(_0x2ad66e[_0xad2e('0x27')]===0x0)return[];return db[_0xad2e('0x9e')][_0xad2e('0x4c')](_0x411956[_0xad2e('0x9f')](),_0x2ea2d8)[_0xad2e('0x2b')](function(_0x35d060){_0x4aeb4a=_[_0xad2e('0xa0')](_0x35d060,'id');_0x2ea2d8=_['merge'](_0x2ea2d8,{'model':db[_0xad2e('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x4e')]){_0x579a26[_0xad2e('0x4f')]['forEach'](function(_0x3c95ac){_0xe2d4ac['field']('i.'+_0x3c95ac);});}else{_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0x94'),_0xad2e('0x6c'));_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa1'),_0xad2e('0xa2'));_0xe2d4ac[_0xad2e('0x57')]('a.mandatoryDisposition',_0xad2e('0xa3'));_0xe2d4ac[_0xad2e('0x57')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0xe2d4ac[_0xad2e('0x57')]('i.*');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa4'),'Contact.firstName');_0xe2d4ac['field'](_0xad2e('0xa5'),'Contact.lastName');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa6'),'Contact.email');_0xe2d4ac[_0xad2e('0x57')]('c.phone',_0xad2e('0xa7'));_0xe2d4ac[_0xad2e('0x57')]('c.mobile','Contact.mobile');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa8'),'Contact.fax');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa9'),'Owner.fullname');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xaa'),_0xad2e('0xab'));_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xac'),'TagIds');}if(_0x579a26[_0xad2e('0x28')])_0xe2d4ac[_0xad2e('0x28')](_0x579a26[_0xad2e('0x28')]);if(_0x579a26[_0xad2e('0x25')])_0xe2d4ac['offset'](_0x579a26[_0xad2e('0x25')]);return db['sequelize'][_0xad2e('0x4c')](_0xe2d4ac['toString'](),_0x2ea2d8);})[_0xad2e('0x2b')](function(_0x3692ec){if(_0x3692ec[_0xad2e('0x50')]>0x0)_0x56e633[_0xad2e('0x54')]('ui.ChatInteractionId\x20IN\x20?',_[_0xad2e('0x36')](_0x3692ec,'id'));return db[_0xad2e('0x9e')][_0xad2e('0x4c')](_0x56e633[_0xad2e('0x9f')](),_0x2ea2d8)['then'](function(_0x6a83f7){var _0x23f261=_[_0xad2e('0xad')](_0x6a83f7,'ChatInteractionId');var _0x45c0f6=[];_0x3692ec[_0xad2e('0x3b')](function(_0x10337a){_0x45c0f6['push'](updateChatInteraction(_0x10337a,_0x4aeb4a,_0x23f261));});return BPromise[_0xad2e('0xae')](_0x45c0f6);});});})[_0xad2e('0x2b')](function(_0x44708f){_0x2ad66e[_0xad2e('0xaf')]=_0x44708f;return _0x2ad66e;})[_0xad2e('0x2b')](respondWithFilteredResult(_0x15e253,_0x579a26))[_0xad2e('0x20')](handleError(_0x15e253,null));};exports['show']=function(_0x519618,_0x3f6971){var _0x114ff1={'raw':![],'where':{'id':_0x519618['params']['id']}},_0x495392={};_0x495392[_0xad2e('0x4b')]=_[_0xad2e('0x4d')](db[_0xad2e('0x47')][_0xad2e('0xb0')]);_0x495392[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x519618['query']);_0x495392['filters']=_[_0xad2e('0xb1')](_0x495392[_0xad2e('0x4b')],_0x495392[_0xad2e('0x4c')]);_0x114ff1['attributes']=_[_0xad2e('0xb1')](_0x495392[_0xad2e('0x4b')],qs[_0xad2e('0x4e')](_0x519618['query'][_0xad2e('0x4e')]));_0x114ff1['attributes']=_0x114ff1[_0xad2e('0x4f')][_0xad2e('0x50')]?_0x114ff1[_0xad2e('0x4f')]:_0x495392[_0xad2e('0x4b')];if(_0x519618[_0xad2e('0x4c')]['includeAll']){_0x114ff1['include']=[{'all':!![]}];}_0x114ff1=_['merge']({},_0x114ff1,_0x519618[_0xad2e('0xb2')]);return db[_0xad2e('0x47')][_0xad2e('0x75')](_0x114ff1)[_0xad2e('0x2b')](handleEntityNotFound(_0x3f6971,null))['then'](respondWithResult(_0x3f6971,null))[_0xad2e('0x20')](handleError(_0x3f6971,null));};exports[_0xad2e('0xb3')]=function(_0x413235,_0x4c5051){return db[_0xad2e('0x47')]['create'](_0x413235[_0xad2e('0x31')],{})[_0xad2e('0x2b')](respondWithResult(_0x4c5051,0xc9))[_0xad2e('0x20')](handleError(_0x4c5051,null));};exports[_0xad2e('0x2a')]=function(_0x284cd4,_0x1f49ee){if(_0x284cd4[_0xad2e('0x31')]['id']){delete _0x284cd4[_0xad2e('0x31')]['id'];}return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0x284cd4[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x1f49ee,null))[_0xad2e('0x2b')](saveUpdates(_0x284cd4[_0xad2e('0x31')],null))[_0xad2e('0x2b')](respondWithResult(_0x1f49ee,null))[_0xad2e('0x20')](handleError(_0x1f49ee,null));};exports['destroy']=function(_0x2d358a,_0x39f3d7){return db['ChatInteraction'][_0xad2e('0x75')]({'where':{'id':_0x2d358a['params']['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x39f3d7,null))[_0xad2e('0x2b')](removeEntity(_0x39f3d7,null))[_0xad2e('0x20')](handleError(_0x39f3d7,null));};exports['describe']=function(_0x5345fe,_0x40dd77){return db['ChatInteraction'][_0xad2e('0xb5')]()[_0xad2e('0x2b')](respondWithResult(_0x40dd77,null))['catch'](handleError(_0x40dd77,null));};exports[_0xad2e('0xb6')]=function(_0x271306,_0x34685b){var _0x3a447a=_0x271306['params']['id'];var _0x574f67;var _0x4ef473;var _0x843547;return db[_0xad2e('0x47')][_0xad2e('0xb7')]({'where':{'id':_0x3a447a}})[_0xad2e('0x2b')](function(_0x3a70de){_0x574f67=_0x3a70de;return db[_0xad2e('0xb8')]['findOne']({'where':{'id':_0x3a70de[_0xad2e('0x80')]},'attributes':['id','vidaooApiKey',_0xad2e('0xb9'),_0xad2e('0xba'),_0xad2e('0xbb'),_0xad2e('0xbc')],'raw':!![]});})[_0xad2e('0x2b')](function(_0x2fe953){if(_0x2fe953&&_0x2fe953[_0xad2e('0xbd')]&&_0x2fe953[_0xad2e('0xb9')]){_0x4ef473=_0x2fe953;var _0x4a14de={'interaction':{'id':_0x3a447a},'agent':{'id':_0x271306['user']['id'],'name':_0x271306[_0xad2e('0x9a')][_0xad2e('0x2d')],'fullname':_0x271306['user'][_0xad2e('0x37')],'email':_0x271306[_0xad2e('0x9a')][_0xad2e('0xbe')]},'contact':_0x271306[_0xad2e('0x31')][_0xad2e('0x32')],'account':_0x271306[_0xad2e('0x31')]['account']};var _0x528e42={'rejectUnauthorized':![],'method':_0xad2e('0xbf'),'url':_0xad2e('0xc0'),'headers':{'X-APIKEY':_0x2fe953[_0xad2e('0xbd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x271306['user']['email']],'buttons':null,'topic':_0x4ef473[_0xad2e('0xba')],'note':_[_0xad2e('0xc1')](_0x4ef473[_0xad2e('0xbb')])?null:getMustacheRender(_0x4ef473[_0xad2e('0xbb')],_0x4a14de),'metadata':null},'redirect':_0xad2e('0xc2'),'json':!![]};try{if(!_[_0xad2e('0xc1')](_0x4ef473[_0xad2e('0xbc')])){var _0xf710d=getMustacheRender(_0x4ef473[_0xad2e('0xbc')],_0x4a14de);var _0x2a59af=JSON['parse'](_0xf710d);_0x528e42['body'][_0xad2e('0xc3')]=_0x2a59af;}}catch(_0x447f04){throw new db[(_0xad2e('0xc4'))][(_0xad2e('0xc5'))](_0xad2e('0xc6'));}return rp(_0x528e42);}else{throw new db['Sequelize'][(_0xad2e('0xc5'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x529069){_0x843547=_0x529069;if(_0x843547['id']){var _0x209d06={'body':_0x843547[_0xad2e('0xc7')],'ChatWebsiteId':_0x4ef473['id'],'ChatInteractionId':_0x574f67['id'],'direction':'out','UserId':_0x271306['user']['id']};return db[_0xad2e('0xc8')][_0xad2e('0xb3')](_0x209d06,{});}else{throw new db['Sequelize'][(_0xad2e('0xc5'))](_0xad2e('0xc9'));}})[_0xad2e('0x2b')](function(){return _0x574f67[_0xad2e('0xca')]({'vidaooSessionId':_0x843547['id']});})[_0xad2e('0x2b')](respondWithResult(_0x34685b,null))['catch'](handleError(_0x34685b,null));};exports[_0xad2e('0xcb')]=function(_0x3b2c9a,_0x1f7222){if(_0x3b2c9a[_0xad2e('0x31')]['id']){delete _0x3b2c9a[_0xad2e('0x31')]['id'];}return db[_0xad2e('0x47')]['find']({'where':{'id':_0x3b2c9a[_0xad2e('0xb4')]['id']},'include':[{'model':db[_0xad2e('0xcc')],'as':'Contact'}]})[_0xad2e('0x2b')](handleEntityNotFound(_0x1f7222,null))['then'](saveUpdates(_0x3b2c9a[_0xad2e('0x31')],null))[_0xad2e('0x2b')](respondWithResult(_0x1f7222,null))[_0xad2e('0x20')](handleError(_0x1f7222,null));};exports[_0xad2e('0xcd')]=function(_0x5888fb,_0x1c4530){if(_0x5888fb[_0xad2e('0x31')]['id']){delete _0x5888fb[_0xad2e('0x31')]['id'];}return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0x5888fb[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](function(_0x1afe03){if(!_0x1afe03){logger[_0xad2e('0x1c')](_0xad2e('0xce'),_0xad2e('0xcd'),0x194,_0xad2e('0xcf'));_0x1c4530[_0xad2e('0x21')](0x194);}else{if(_0x1afe03[_0xad2e('0x42')]){throw new db[(_0xad2e('0xc4'))][(_0xad2e('0xc5'))](_0xad2e('0xd0'));}}return _0x1afe03;})[_0xad2e('0x2b')](function(_0x5f1aaf){if(_0x5f1aaf){return _0x5f1aaf[_0xad2e('0x2a')]({'closed':_0x5888fb[_0xad2e('0x31')][_0xad2e('0x41')],'disposition':_0x5888fb['body']['disposition']})[_0xad2e('0x2b')](function(_0x55b7de){return _0x55b7de;});}})[_0xad2e('0x2b')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x5888fb[_0xad2e('0x31')],client9004);})[_0xad2e('0x2b')](respondWithResult(_0x1c4530,null))[_0xad2e('0x20')](handleError(_0x1c4530,null));};exports[_0xad2e('0xd1')]=function(_0x394518,_0xa25ed2){_0x394518['body']['name']=_0x394518[_0xad2e('0xd2')][_0xad2e('0xd3')];_0x394518[_0xad2e('0x31')]['basename']=_0x394518['file'][_0xad2e('0xd4')];_0x394518[_0xad2e('0x31')]['type']=_0x394518[_0xad2e('0xd2')]['mimetype'];return db[_0xad2e('0xd5')][_0xad2e('0xb3')](_0x394518[_0xad2e('0x31')])[_0xad2e('0x2b')](respondWithResult(_0xa25ed2,0xc9))[_0xad2e('0x20')](handleError(_0xa25ed2,null));};exports[_0xad2e('0xd6')]=function(_0x57ed5c,_0x1e9ade){return db[_0xad2e('0x47')]['findOne']({'where':{'id':_0x57ed5c[_0xad2e('0xb4')]['id']},'raw':!![]})[_0xad2e('0x2b')](handleEntityNotFound(_0x1e9ade,null))[_0xad2e('0x2b')](function(_0x360d04){if(_0x360d04){if(_0x360d04[_0xad2e('0x41')]){return _0x1e9ade[_0xad2e('0x22')](0x193)[_0xad2e('0x24')]({'status':0x193,'message':'Unauthorized'});}return db[_0xad2e('0xd5')]['findOne']({'where':{'id':_0x57ed5c[_0xad2e('0x4c')][_0xad2e('0xd7')]},'raw':!![]})[_0xad2e('0x2b')](handleEntityNotFound(_0x1e9ade,null));}})[_0xad2e('0x2b')](function(_0x1466fd){if(_0x1466fd){var _0x9b10b=_0x1466fd[_0xad2e('0xd8')]!==null;var _0x4f546b=path['join'](config[_0xad2e('0xd9')],_0xad2e('0xda'));if(_0x9b10b){_0x4f546b=path[_0xad2e('0xdb')](_0x4f546b,_0xad2e('0xdc'));}var _0x255aa0=path[_0xad2e('0xdb')](_0x4f546b,_0x1466fd[_0xad2e('0xdd')]);return _0x1e9ade[_0xad2e('0xde')](_0x255aa0);}})['catch'](handleError(_0x1e9ade,null));};exports['close']=function(_0xa94b3f,_0x203105){var _0x4d18b4=null;var _0x15a98d=null;var _0x2c5621=null;if(_0xa94b3f[_0xad2e('0x31')]['id']){delete _0xa94b3f[_0xad2e('0x31')]['id'];}if(_0xa94b3f[_0xad2e('0x31')][_0xad2e('0xdf')]){_0x2c5621=path[_0xad2e('0xdb')](config[_0xad2e('0xd9')],_0xad2e('0xe0'),util[_0xad2e('0xe1')]('transcript-%s.txt',Date[_0xad2e('0xe2')]()));_0xa94b3f[_0xad2e('0x31')][_0xad2e('0xe3')]=_0x2c5621;}return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0xa94b3f[_0xad2e('0xb4')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0xad2e('0x7a')}]}]})[_0xad2e('0x2b')](handleEntityNotFound(_0x203105,null))['then'](saveUpdates(_0xa94b3f['body'],null))['then'](function(_0x36fa66){if(_0x36fa66){_0x4d18b4=_0x36fa66;return db['ChatWebsite'][_0xad2e('0x75')]({'where':{'id':_0x4d18b4[_0xad2e('0x80')]}});}})['then'](function(_0x3a7e1f){if(_0x3a7e1f){_0x15a98d=_0x3a7e1f;return db[_0xad2e('0xcc')][_0xad2e('0x75')]({'where':{'id':_0x4d18b4[_0xad2e('0x76')]}});}})[_0xad2e('0x2b')](function(_0x2a9579){if(_0x2a9579){if(_0x2c5621){var _0x423e41=null;for(var _0x56aa85=0x1;_0x56aa85<_0x4d18b4['Messages'][_0xad2e('0x50')];++_0x56aa85){_0x423e41=_0x4d18b4[_0xad2e('0xe4')][_0x56aa85];var _0x3efa33=_0x423e41['UserId']?util[_0xad2e('0xe1')](_0xad2e('0xe5'),_0x15a98d[_0xad2e('0xe6')],_0x423e41[_0xad2e('0x42')]):'System';var _0x31250b=_0xa94b3f[_0xad2e('0x31')][_0xad2e('0xe7')]||util[_0xad2e('0xe1')](_0xad2e('0xe5'),_0xad2e('0xe8'),_0x423e41[_0xad2e('0x76')]);switch(_0x15a98d[_0xad2e('0xe9')]){case _0xad2e('0xea'):_0x3efa33=_0x423e41[_0xad2e('0x42')]?util[_0xad2e('0xe1')](_0xad2e('0xe5'),_0x15a98d[_0xad2e('0xe6')],_0x423e41['UserId']):_0xad2e('0xeb');break;case _0xad2e('0xec'):_0x3efa33=_0x423e41[_0xad2e('0x42')]?_0x423e41[_0xad2e('0x7a')][_0xad2e('0xed')]||_0x423e41['User'][_0xad2e('0x37')]:_0xad2e('0xeb');break;case _0xad2e('0xee'):_0x3efa33=_0x423e41[_0xad2e('0x42')]?_0x423e41['User'][_0xad2e('0x37')]:_0xad2e('0xeb');break;default:_0x3efa33=_0x423e41[_0xad2e('0x42')]?util[_0xad2e('0xe1')]('%s%d',_0x15a98d['agentAlias'],_0x423e41[_0xad2e('0x42')]):_0xad2e('0xeb');}var _0x2a1fd3=util['format'](_0xad2e('0xef'),moment(_0x423e41[_0xad2e('0xf0')])[_0xad2e('0xe1')](_0xad2e('0xf1')),_0x423e41[_0xad2e('0xf2')]==='in'?_0x31250b:_0x3efa33,_0x423e41[_0xad2e('0x31')]);if(!_0x423e41[_0xad2e('0xf3')]){fs[_0xad2e('0xf4')](_0x2c5621,_0x2a1fd3);}}return db[_0xad2e('0xf5')][_0xad2e('0xb7')]({'where':{'service':!![]},'include':[{'model':db[_0xad2e('0xf6')],'as':_0xad2e('0xf7'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xad2e('0xf8'),'raw':!![]}]}]});}}})[_0xad2e('0x2b')](function(_0x7ab79a){if(!_0x7ab79a||!_0x7ab79a[_0xad2e('0xf7')]||!_0xa94b3f[_0xad2e('0x31')])return _0x4d18b4;var _0x19dde7=_0x7ab79a['getSmtpOptions']();return respondWithRpcPromise(_0xad2e('0xf9'),_0xad2e('0xfa'),{'account':_0x19dde7,'message':{'from':util[_0xad2e('0xe1')](_0xad2e('0xfb'),_0x7ab79a[_0xad2e('0x2d')],_0x7ab79a[_0xad2e('0xbe')]||_0x7ab79a[_0xad2e('0xf7')][_0xad2e('0x9a')]),'to':_0xa94b3f[_0xad2e('0x31')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xad2e('0xe1')](_0xad2e('0xfc'),_0xa94b3f['body'][_0xad2e('0xdf')]),'attachments':[{'path':_0x2c5621}]}})['then'](function(){return _0x4d18b4;})[_0xad2e('0x20')](function(_0x33de0b){logger['error'](_0x33de0b);});})['then'](respondWithStatusCode(_0x203105,0xc8))['catch'](handleError(_0x203105,null));};exports[_0xad2e('0xfd')]=function(_0x55947c,_0x1392f0){return db[_0xad2e('0xc8')][_0xad2e('0x75')]({'where':{'id':_0x55947c['params']['id']}})['then'](handleEntityNotFound(_0x1392f0,null))['then'](function(_0x167f32){if(_0x167f32){return _0x167f32['addMessage'](_0x55947c[_0xad2e('0x31')][_0xad2e('0xfe')],_[_0xad2e('0xff')](_0x55947c['body'],[_0xad2e('0xfe'),'id'])||{});}})[_0xad2e('0x2b')](respondWithResult(_0x1392f0,null))['catch'](handleError(_0x1392f0,null));};exports[_0xad2e('0x100')]=function(_0x14ed73,_0x54391f){var _0x52584a={'raw':![],'where':{}};var _0x4ce397={};var _0x2e5acc={'count':0x0,'rows':[]};return db[_0xad2e('0x47')][_0xad2e('0xb7')]({'where':{'id':_0x14ed73[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x54391f,null))[_0xad2e('0x2b')](function(_0x2f59fd){if(_0x2f59fd){_0x4ce397[_0xad2e('0x4b')]=_[_0xad2e('0x4d')](db[_0xad2e('0xc8')][_0xad2e('0xb0')]);_0x4ce397[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x14ed73['query']);_0x4ce397[_0xad2e('0x55')]=_[_0xad2e('0xb1')](_0x4ce397['model'],_0x4ce397[_0xad2e('0x4c')]);_0x52584a[_0xad2e('0x4f')]=_[_0xad2e('0xb1')](_0x4ce397['model'],qs[_0xad2e('0x4e')](_0x14ed73['query'][_0xad2e('0x4e')]));_0x52584a[_0xad2e('0x4f')]=_0x52584a[_0xad2e('0x4f')][_0xad2e('0x50')]?_0x52584a[_0xad2e('0x4f')]:_0x4ce397[_0xad2e('0x4b')];if(!_0x14ed73['query'][_0xad2e('0x101')](_0xad2e('0x51'))){_0x52584a[_0xad2e('0x28')]=qs[_0xad2e('0x28')](_0x14ed73['query']['limit']);_0x52584a['offset']=qs['offset'](_0x14ed73[_0xad2e('0x4c')]['offset']);}_0x52584a[_0xad2e('0x52')]=qs[_0xad2e('0x53')](_0x14ed73['query'][_0xad2e('0x53')]);_0x52584a[_0xad2e('0x54')]=qs[_0xad2e('0x55')](_[_0xad2e('0x56')](_0x14ed73[_0xad2e('0x4c')],_0x4ce397[_0xad2e('0x55')]));_0x52584a[_0xad2e('0x54')][_0xad2e('0x102')]=_0x2f59fd['id'];if(_0x14ed73['query']['filter']){_0x52584a[_0xad2e('0x54')]=_[_0xad2e('0x30')](_0x52584a[_0xad2e('0x54')],{'$or':_[_0xad2e('0x36')](_0x52584a[_0xad2e('0x4f')],function(_0x5b9636){var _0x5c9dc0={};_0x5c9dc0[_0x5b9636]={'$like':'%'+_0x14ed73[_0xad2e('0x4c')][_0xad2e('0x103')]+'%'};return _0x5c9dc0;})});}if(_0x14ed73['query'][_0xad2e('0x104')]){var _0x4c70b8=_0x14ed73[_0xad2e('0x4c')][_0xad2e('0x104')][_0xad2e('0x3a')](',');var _0x180166={};_0x180166[_0x4c70b8[0x0]]={'$gte':moment(_0x4c70b8[0x1])[_0xad2e('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x52584a[_0xad2e('0x54')]=_['merge'](_0x52584a['where'],_0x180166);}_0x52584a=_[_0xad2e('0x30')]({},_0x52584a,_0x14ed73[_0xad2e('0xb2')]);return db[_0xad2e('0xc8')][_0xad2e('0x27')]({'where':_0x52584a[_0xad2e('0x54')]})[_0xad2e('0x2b')](function(_0x14b851){_0x2e5acc['count']=_0x14b851;if(_0x14ed73[_0xad2e('0x4c')]['includeAll']){_0x52584a['include']=[{'all':!![]}];}return db['ChatMessage'][_0xad2e('0x105')](_0x52584a);})[_0xad2e('0x2b')](function(_0x4f28e2){_0x2e5acc['rows']=_0x4f28e2;return _0x2e5acc;});}})[_0xad2e('0x2b')](respondWithFilteredResult(_0x54391f,_0x52584a))[_0xad2e('0x20')](handleError(_0x54391f,null));};exports[_0xad2e('0x106')]=function(_0x59df92,_0x34bbc6){var _0x54feb5={'where':{}},_0x4a6fa3={},_0x4d4a27={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xad2e('0xb7')]({'where':{'id':_0x59df92['params']['id']}})['then'](handleEntityNotFound(_0x34bbc6,null))[_0xad2e('0x2b')](function(_0x2dcb83){if(_0x2dcb83){_0x4a6fa3[_0xad2e('0x4b')]=_['keys'](db['ChatMessage'][_0xad2e('0xb0')]);_0x4a6fa3[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x59df92['query']);_0x4a6fa3[_0xad2e('0x55')]=_[_0xad2e('0xb1')](_0x4a6fa3['model'],_0x4a6fa3[_0xad2e('0x4c')]);_0x54feb5[_0xad2e('0x4f')]=_[_0xad2e('0xb1')](_0x4a6fa3[_0xad2e('0x4b')],qs[_0xad2e('0x4e')](_0x59df92[_0xad2e('0x4c')][_0xad2e('0x4e')]));_0x54feb5[_0xad2e('0x4f')]=_0x54feb5['attributes'][_0xad2e('0x50')]?_0x54feb5['attributes']:_0x4a6fa3[_0xad2e('0x4b')];if(!_0x59df92[_0xad2e('0x4c')]['hasOwnProperty']('nolimit')){_0x54feb5[_0xad2e('0x28')]=qs[_0xad2e('0x28')](_0x59df92[_0xad2e('0x4c')][_0xad2e('0x28')]);_0x54feb5['offset']=qs[_0xad2e('0x25')](_0x59df92['query'][_0xad2e('0x25')]);}_0x54feb5[_0xad2e('0x52')]=qs[_0xad2e('0x53')](_0x59df92[_0xad2e('0x4c')][_0xad2e('0x53')]);_0x54feb5[_0xad2e('0x54')]=qs[_0xad2e('0x55')](_[_0xad2e('0x56')](_0x59df92[_0xad2e('0x4c')],_0x4a6fa3[_0xad2e('0x55')]));_0x54feb5[_0xad2e('0x54')][_0xad2e('0x102')]=_0x2dcb83['id'];if(_0x59df92['query'][_0xad2e('0x103')]){_0x54feb5[_0xad2e('0x54')]=_['merge'](_0x54feb5[_0xad2e('0x54')],{'$or':_[_0xad2e('0x36')](_0x54feb5[_0xad2e('0x4f')],function(_0x5a85a4){var _0x20bca3={};_0x20bca3[_0x5a85a4]={'$like':'%'+_0x59df92[_0xad2e('0x4c')]['filter']+'%'};return _0x20bca3;})});}_0x54feb5[_0xad2e('0x54')][_0xad2e('0xf3')]=![];if(_0x59df92[_0xad2e('0x4c')]['id']){_0x54feb5[_0xad2e('0x54')]['id']={'$gt':_0x59df92[_0xad2e('0x4c')]['id']};}_0x54feb5=_[_0xad2e('0x30')]({},_0x54feb5,_0x59df92[_0xad2e('0xb2')]);return db['ChatMessage']['count']({'where':_0x54feb5['where']})[_0xad2e('0x2b')](function(_0x1cfdda){_0x4d4a27[_0xad2e('0x27')]=_0x1cfdda;_0x54feb5[_0xad2e('0x107')]=[];if(_0x59df92['query']['includeAgent']){_0x54feb5[_0xad2e('0x107')][_0xad2e('0x3c')]({'model':db['User'],'as':_0xad2e('0x7a'),'attributes':['id',_0xad2e('0x37'),'alias']});}if(_0x59df92[_0xad2e('0x4c')]['includeAll']){_0x54feb5[_0xad2e('0x107')]=[{'all':!![]}];}return db[_0xad2e('0xc8')]['findAll'](_0x54feb5);})[_0xad2e('0x2b')](function(_0x2cf359){_0x4d4a27['rows']=_0x2cf359;return _0x4d4a27;});}})['then'](respondWithFilteredResult(_0x34bbc6,_0x54feb5))[_0xad2e('0x20')](handleError(_0x34bbc6,null));};exports[_0xad2e('0x108')]=function(_0x492b7e,_0xad9fab){return db['ChatInteraction'][_0xad2e('0x75')]({'where':{'id':_0x492b7e[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0xad9fab,null))[_0xad2e('0x2b')](function(_0x2331f1){if(_0x2331f1){return _0x2331f1['setTags'](_0x492b7e['body'][_0xad2e('0xfe')],_[_0xad2e('0xff')](_0x492b7e[_0xad2e('0x31')],['ids','id'])||{})[_0xad2e('0x109')](function(){return db[_0xad2e('0x10a')][_0xad2e('0x105')]({'attributes':['id',_0xad2e('0x2d'),_0xad2e('0x10b')],'where':{'id':_0x492b7e[_0xad2e('0x31')][_0xad2e('0xfe')]}});})[_0xad2e('0x2b')](function(_0x21964b){socket[_0xad2e('0x10c')](_0xad2e('0x10d'),{'id':Number(_0x492b7e['params']['id']),'tags':_0x21964b||[]});return{'id':Number(_0x492b7e[_0xad2e('0xb4')]['id']),'tags':_0x21964b||[]};});}})[_0xad2e('0x2b')](respondWithResult(_0xad9fab,null))['catch'](handleError(_0xad9fab,null));};exports[_0xad2e('0x10e')]=function(_0x8bb3c4,_0x453fa7){return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0x8bb3c4['params']['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x453fa7,null))[_0xad2e('0x2b')](function(_0x27ad41){if(_0x27ad41){return _0x27ad41[_0xad2e('0x10e')](_0x8bb3c4[_0xad2e('0x4c')][_0xad2e('0xfe')]);}})[_0xad2e('0x2b')](respondWithStatusCode(_0x453fa7,null))[_0xad2e('0x20')](handleError(_0x453fa7,null));};exports[_0xad2e('0xde')]=function(_0x40e752,_0x4c7c51){var _0x12a370=moment()['unix']()[_0xad2e('0x9f')]();var _0x853563=path[_0xad2e('0xdb')](config[_0xad2e('0xd9')],_0xad2e('0x10f'),'files',_0xad2e('0x110'));var _0x10eb76=path[_0xad2e('0xdb')](config['root'],_0xad2e('0x10f'),_0xad2e('0x111'),_0xad2e('0x112'));var _0x2dbfbd=path['join'](_0x853563,_0x12a370);var _0x56ac2d=util[_0xad2e('0xe1')]('transcript-%d-%s.zip',_0x40e752[_0xad2e('0xb4')]['id'],_0x12a370);var _0xf892e9=path[_0xad2e('0xdb')](_0x853563,_0x56ac2d);var _0x414763=[];_0x414763[_0xad2e('0x3c')]({'model':db[_0xad2e('0x7a')],'as':_0xad2e('0x7a'),'attributes':['id',_0xad2e('0x37')],'raw':!![]});_0x414763[_0xad2e('0x3c')]({'model':db[_0xad2e('0xcc')],'as':'Contact','attributes':['id',_0xad2e('0x113'),_0xad2e('0x114')],'raw':!![]});if(_0x40e752[_0xad2e('0x4c')][_0xad2e('0x112')]){_0x414763['push']({'model':db[_0xad2e('0xd5')],'as':_0xad2e('0xd5'),'raw':!![]});}var _0x366ebe=[{'model':db['ChatMessage'],'as':_0xad2e('0xe4'),'attributes':['id',_0xad2e('0x31'),'createdAt',_0xad2e('0xf2'),_0xad2e('0xf3'),_0xad2e('0x86')],'include':_0x414763}];_0x366ebe[_0xad2e('0x3c')]({'model':db[_0xad2e('0xb8')],'as':_0xad2e('0x115'),'attributes':['id','name']});_0x366ebe[_0xad2e('0x3c')]({'model':db[_0xad2e('0x7a')],'as':_0xad2e('0x116'),'attributes':['id',_0xad2e('0x37')]});return db[_0xad2e('0x47')]['find']({'where':{'id':_0x40e752[_0xad2e('0xb4')]['id']},'include':_0x366ebe})[_0xad2e('0x2b')](handleEntityNotFound(_0x4c7c51,null))[_0xad2e('0x2b')](function(_0x6d6ab1){if(_0x6d6ab1){var _0x2e8154=_0x6d6ab1[_0xad2e('0x117')]({'plain':!![]});fs[_0xad2e('0x118')](_0x2dbfbd);var _0x1d7adc={'channel':_0xad2e('0x119'),'account':_0x2e8154['Account'][_0xad2e('0x2d')],'agent':_0x2e8154[_0xad2e('0x116')]?_0x2e8154[_0xad2e('0x116')][_0xad2e('0x37')]:_0xad2e('0x11a'),'createdAt':moment(_0x2e8154[_0xad2e('0xf0')])['format'](_0xad2e('0x11b'))[_0xad2e('0x9f')](),'closedAt':_0x2e8154[_0xad2e('0x41')]?moment(_0x2e8154[_0xad2e('0x11c')])[_0xad2e('0xe1')](_0xad2e('0x11b'))[_0xad2e('0x9f')]():'','disposition':_0x2e8154[_0xad2e('0x43')],'chatInfo':{'browser':_0x2e8154[_0xad2e('0x11d')],'os':_0x2e8154[_0xad2e('0x11e')],'referer':_0x2e8154[_0xad2e('0x11f')],'customerIp':_0x2e8154[_0xad2e('0x120')],'customerPort':_0x2e8154[_0xad2e('0x121')]?_0x2e8154[_0xad2e('0x121')]:'N.A.'},'messages':_(_0x2e8154[_0xad2e('0xe4')])[_0xad2e('0x122')]()[_0xad2e('0x103')]({'secret':![]})['map'](function(_0x4fbe64){if(_0x4fbe64[_0xad2e('0xd5')]){var _0x424b02=path[_0xad2e('0xdb')](_0x10eb76,_0x4fbe64['Attachment'][_0xad2e('0xdd')]);if(fs['existsSync'](_0x424b02)){fs['createReadStream'](_0x424b02)[_0xad2e('0x123')](fs[_0xad2e('0x124')](path[_0xad2e('0xdb')](_0x2dbfbd,_0x4fbe64[_0xad2e('0xd5')][_0xad2e('0xdd')])));}}return{'date':moment(_0x4fbe64[_0xad2e('0xf0')])['format'](_0xad2e('0x11b'))[_0xad2e('0x9f')](),'sender':_0x4fbe64['direction']===_0xad2e('0x125')?_0x4fbe64[_0xad2e('0x7a')]?_0x4fbe64[_0xad2e('0x7a')][_0xad2e('0x37')]:'System':_0x4fbe64[_0xad2e('0x71')][_0xad2e('0x113')]+(_0x4fbe64['Contact'][_0xad2e('0x114')]?'\x20'+_0x4fbe64['Contact']['lastName']:''),'body':_0x4fbe64[_0xad2e('0xd5')]?_0x4fbe64[_0xad2e('0xd5')][_0xad2e('0xdd')]:_0x4fbe64[_0xad2e('0x31')],'direction':_0x4fbe64[_0xad2e('0xf2')]===_0xad2e('0x125')?'A':'C','secret':_0x4fbe64[_0xad2e('0xf3')],'read':_0x4fbe64[_0xad2e('0x86')],'attachment':_0x4fbe64['Attachment']};})[_0xad2e('0x6d')]()};return ejs[_0xad2e('0x126')](path[_0xad2e('0xdb')](config[_0xad2e('0xd9')],_0xad2e('0x10f'),_0xad2e('0x127'),_0xad2e('0x128')),{'interaction':_0x1d7adc})[_0xad2e('0x2b')](function(_0x25057b){var _0x30ac7f=path['join'](_0x2dbfbd,'transcript-'+_0x2e8154['id']+'-'+_0x12a370+'.pdf');var _0x5839ae={'path':_0x30ac7f,'channel':'Chat','interactionId':_0x2e8154['id']};return pdf[_0xad2e('0x129')](_0x25057b,_0x5839ae);})[_0xad2e('0x2b')](function(){return new Promise(function(_0x4db1d3,_0x50c6a0){zipdir(_0x2dbfbd,{'saveTo':_0xf892e9},function(_0x300d87,_0x1afd35){if(_0x300d87)return _0x50c6a0(_0x300d87);return _0x4db1d3(_0x1afd35);});})[_0xad2e('0x2b')](function(){return new BPromise(function(_0x231853,_0x1a60d6){rimraf(_0x2dbfbd,function(_0x2812f9){if(_0x2812f9)_0x1a60d6(_0x2812f9);return _0x231853();});});})['then'](function(){return _0x4c7c51[_0xad2e('0xde')](_0xf892e9,_0x56ac2d,function(_0x3ff14a){if(_0x3ff14a){logger[_0xad2e('0x1c')]('err',_0x3ff14a);}else{fs[_0xad2e('0x12a')](_0xf892e9);}});});});}else{return _0x4c7c51[_0xad2e('0x21')](0xc8);}})[_0xad2e('0x20')](handleError(_0x4c7c51,null));};
\ No newline at end of file
+var _0x55e0=['nolimit','order','sort','where','select','field','color','tools_tags','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','from','chat_interactions','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','rows','catch','show','params','includeAll','include','options','create','describe','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','follow','isNull','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','ContactId','%s%d','System','customer','format','Visitor','agentIdentifier','agentAlias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','pick','secret','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','Account','Owner','mkdirSync','Chat','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','createWriteStream','out','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','util','path','ejs','lodash','squel','ioredis','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','name','render','merge','body','contact','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','index','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0x475516,_0x1a8b71){var _0x2732f2=function(_0x5ab274){while(--_0x5ab274){_0x475516['push'](_0x475516['shift']());}};_0x2732f2(++_0x1a8b71);}(_0x55e0,0xdc));var _0x055e=function(_0x3e29bf,_0xc3b103){_0x3e29bf=_0x3e29bf-0x0;var _0x2c1601=_0x55e0[_0x3e29bf];return _0x2c1601;};'use strict';var rimraf=require(_0x055e('0x0'));var zipdir=require(_0x055e('0x1'));var rp=require(_0x055e('0x2'));var moment=require(_0x055e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x055e('0x4'));var path=require(_0x055e('0x5'));var ejs=require(_0x055e('0x6'));var fs=require('fs');var _=require(_0x055e('0x7'));var squel=require(_0x055e('0x8'));var Redis=require(_0x055e('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x055e('0xa'));var logger=require('../../config/logger')(_0x055e('0xb'));var config=require(_0x055e('0xc'));var db=require(_0x055e('0xd'))['db'];config[_0x055e('0xe')]=_[_0x055e('0xf')](config['redis'],{'host':_0x055e('0x10'),'port':0x18eb});var socket=require(_0x055e('0x11'))(new Redis(config[_0x055e('0xe')]));require(_0x055e('0x12'))[_0x055e('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x055e('0x14')]({'port':0x232b});var client9004=jayson['client'][_0x055e('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x466da3,_0x72d424,_0x101bc3,_0xc98c6a){return new BPromise(function(_0x31c649,_0x236a2b){var _0x4bca5d=_0xc98c6a||client;return _0x4bca5d[_0x055e('0x15')](_0x466da3,_0x101bc3)[_0x055e('0x16')](function(_0x3cfd14){logger[_0x055e('0x17')](_0x055e('0x18'),_0x72d424,'request\x20sent');logger[_0x055e('0x19')](_0x055e('0x1a'),_0x72d424,_0x055e('0x1b'),JSON['stringify'](_0x3cfd14));if(_0x3cfd14[_0x055e('0x1c')]){if(_0x3cfd14[_0x055e('0x1c')][_0x055e('0x1d')]===0x1f4){logger[_0x055e('0x1c')](_0x055e('0x18'),_0x72d424,_0x3cfd14['error'][_0x055e('0x1e')]);return _0x236a2b(_0x3cfd14[_0x055e('0x1c')][_0x055e('0x1e')]);}logger[_0x055e('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x72d424,_0x3cfd14[_0x055e('0x1c')][_0x055e('0x1e')]);return _0x31c649(_0x3cfd14['error'][_0x055e('0x1e')]);}else{logger[_0x055e('0x17')](_0x055e('0x18'),_0x72d424,_0x055e('0x1b'));_0x31c649(_0x3cfd14[_0x055e('0x1f')][_0x055e('0x1e')]);}})['catch'](function(_0x31c355){logger[_0x055e('0x1c')](_0x055e('0x18'),_0x72d424,_0x31c355);_0x236a2b(_0x31c355);});});}function respondWithStatusCode(_0x5930ff,_0x3f444a){_0x3f444a=_0x3f444a||0xcc;return function(_0x2da6b){if(_0x2da6b){return _0x5930ff[_0x055e('0x20')](_0x3f444a);}return _0x5930ff[_0x055e('0x21')](_0x3f444a)['end']();};}function respondWithResult(_0x71a6e1,_0x56c372){_0x56c372=_0x56c372||0xc8;return function(_0x33ffdf){if(_0x33ffdf){return _0x71a6e1[_0x055e('0x21')](_0x56c372)[_0x055e('0x22')](_0x33ffdf);}};}function respondWithFilteredResult(_0x1a76c6,_0x40c62a){return function(_0x4c653c){if(_0x4c653c){var _0x58caf9=typeof _0x40c62a[_0x055e('0x23')]===_0x055e('0x24')&&typeof _0x40c62a[_0x055e('0x25')]==='undefined';var _0x408e38=_0x4c653c[_0x055e('0x26')];var _0x42f2df=_0x58caf9?0x0:_0x40c62a[_0x055e('0x23')];var _0x59539d=_0x58caf9?_0x4c653c[_0x055e('0x26')]:_0x40c62a['offset']+_0x40c62a[_0x055e('0x25')];var _0x35def0;if(_0x59539d>=_0x408e38){_0x59539d=_0x408e38;_0x35def0=0xc8;}else{_0x35def0=0xce;}_0x1a76c6[_0x055e('0x21')](_0x35def0);return _0x1a76c6[_0x055e('0x27')](_0x055e('0x28'),_0x42f2df+'-'+_0x59539d+'/'+_0x408e38)['json'](_0x4c653c);}return null;};}function saveUpdates(_0x99a372){return function(_0x453e5e){if(_0x453e5e){return _0x453e5e[_0x055e('0x29')](_0x99a372)[_0x055e('0x16')](function(_0x36abb2){return _0x36abb2;});}return null;};}function removeEntity(_0x225c88){return function(_0x59f8c4){if(_0x59f8c4){return _0x59f8c4[_0x055e('0x2a')]()['then'](function(){_0x225c88[_0x055e('0x21')](0xcc)[_0x055e('0x2b')]();});}};}function handleEntityNotFound(_0x5cfeea){return function(_0xd9298d){if(!_0xd9298d){_0x5cfeea[_0x055e('0x20')](0x194);}return _0xd9298d;};}function handleError(_0x524344,_0x20717b){_0x20717b=_0x20717b||0x1f4;return function(_0x23c611){logger[_0x055e('0x1c')](_0x23c611['stack']);if(_0x23c611['name']){delete _0x23c611[_0x055e('0x2c')];}_0x524344['status'](_0x20717b)['send'](_0x23c611);};}function getMustacheRender(_0x55a1ee,_0x31ee60){return Mustache[_0x055e('0x2d')](_0x55a1ee,_[_0x055e('0x2e')](_0x31ee60[_0x055e('0x2f')],{'contact':_0x31ee60[_0x055e('0x30')],'message':_0x31ee60[_0x055e('0x1e')],'agent':_0x31ee60[_0x055e('0x31')],'interaction':_0x31ee60[_0x055e('0x32')],'account':_0x31ee60[_0x055e('0x33')]}))||'';}function getInteractionUsers(_0x2f60fa,_0x2f839c){return new BPromise(function(_0x263a81,_0x54539e){try{if(_0x2f839c[_0x2f60fa['id']]){_0x2f60fa['Users']=_[_0x055e('0x34')](_0x2f839c[_0x2f60fa['id']],function(_0x47790a){return{'id':_0x47790a['id'],'fullname':_0x47790a[_0x055e('0x35')]};});}}catch(_0xf3abf6){_0x54539e(_0xf3abf6);}_0x263a81(_0x2f60fa);});}function getInteractionTags(_0x34d5f2,_0x21aaad){return new BPromise(function(_0xb08e29,_0x4f24f8){try{if(_0x34d5f2[_0x055e('0x36')]){_0x34d5f2[_0x055e('0x37')]=[];_0x34d5f2[_0x055e('0x36')][_0x055e('0x38')](',')[_0x055e('0x39')](function(_0x585b8a){_0x34d5f2[_0x055e('0x37')][_0x055e('0x3a')](_0x21aaad[_0x585b8a]);});}delete _0x34d5f2['TagIds'];}catch(_0x39ecd7){_0x4f24f8(_0x39ecd7);}_0xb08e29(_0x34d5f2);});}function updateChatInteraction(_0x1a109f,_0x4a97ab,_0x99688b){return new BPromise(function(_0x2d7815,_0x4e424b){return getInteractionUsers(_0x1a109f,_0x99688b)[_0x055e('0x16')](function(_0x233423){return getInteractionTags(_0x233423,_0x4a97ab);})['then'](function(_0x1012a4){return getStateInteraction(_0x1012a4);})[_0x055e('0x16')](function(_0x1478c2){_0x2d7815(_0x1478c2);})['catch'](function(_0x1715ed){_0x4e424b(_0x1715ed);});});}function getStateInteraction(_0x1dd07b){return new BPromise(function(_0x574ea0){_0x1dd07b[_0x055e('0x3b')]=0x0;_0x1dd07b[_0x055e('0x3c')]=0x0;_0x1dd07b[_0x055e('0x3d')]=0x0;_0x1dd07b['unmanaged']=0x0;_0x1dd07b[_0x055e('0x3e')]=0x0;_0x1dd07b[_0x055e('0x3f')]=0x0;if(!_0x1dd07b[_0x055e('0x40')]&&!_0x1dd07b['UserId']){_0x1dd07b['waiting']+=0x1;}if(!_0x1dd07b[_0x055e('0x40')]&&_0x1dd07b[_0x055e('0x41')]){_0x1dd07b['talking']+=0x1;if(_0x1dd07b[_0x055e('0x3b')]){_0x1dd07b['waiting']-=0x1;}}if(_0x1dd07b[_0x055e('0x40')]&&_0x1dd07b['disposition']===_0x055e('0x3e')){_0x1dd07b[_0x055e('0x3e')]+=0x1;if(_0x1dd07b[_0x055e('0x3b')]){_0x1dd07b['waiting']-=0x1;}}else if(_0x1dd07b['closed']&&!_0x1dd07b[_0x055e('0x41')]&&_0x1dd07b[_0x055e('0x42')]){_0x1dd07b[_0x055e('0x43')]+=0x1;if(_0x1dd07b[_0x055e('0x3b')]){_0x1dd07b['waiting']-=0x1;}}else if(_0x1dd07b['closed']&&_0x1dd07b[_0x055e('0x41')]){_0x1dd07b[_0x055e('0x3d')]+=0x1;if(_0x1dd07b['talking']){_0x1dd07b[_0x055e('0x3c')]-=0x1;}}_0x1dd07b[_0x055e('0x3f')]+=0x1;_0x574ea0(_0x1dd07b);});}exports[_0x055e('0x44')]=function(_0x20eb76,_0x19e29c){var _0x1f3c73={},_0x479f4e={},_0x297edd={'count':0x0,'rows':[]};var _0x118a0e=_['map'](db[_0x055e('0x45')][_0x055e('0x46')],function(_0x341c46){return{'name':_0x341c46[_0x055e('0x47')],'type':_0x341c46[_0x055e('0x48')][_0x055e('0x49')]};});_0x479f4e[_0x055e('0x4a')]=_['map'](_0x118a0e,_0x055e('0x2c'));_0x479f4e['query']=_[_0x055e('0x4b')](_0x20eb76[_0x055e('0x4c')]);_0x479f4e[_0x055e('0x4d')]=_['intersection'](_0x479f4e['model'],_0x479f4e[_0x055e('0x4c')]);_0x1f3c73[_0x055e('0x4e')]=_[_0x055e('0x4f')](_0x479f4e[_0x055e('0x4a')],qs[_0x055e('0x50')](_0x20eb76[_0x055e('0x4c')][_0x055e('0x50')]));_0x1f3c73[_0x055e('0x4e')]=_0x1f3c73[_0x055e('0x4e')]['length']?_0x1f3c73[_0x055e('0x4e')]:_0x479f4e[_0x055e('0x4a')];if(!_0x20eb76[_0x055e('0x4c')][_0x055e('0x51')](_0x055e('0x52'))){_0x1f3c73['limit']=qs[_0x055e('0x25')](_0x20eb76[_0x055e('0x4c')][_0x055e('0x25')]);_0x1f3c73['offset']=qs[_0x055e('0x23')](_0x20eb76['query'][_0x055e('0x23')]);}_0x1f3c73[_0x055e('0x53')]=qs['sort'](_0x20eb76[_0x055e('0x4c')][_0x055e('0x54')]);_0x1f3c73[_0x055e('0x55')]=qs['filters'](_['pick'](_0x20eb76[_0x055e('0x4c')],_0x479f4e[_0x055e('0x4d')]),_0x118a0e);var _0x393717=[];var _0x248e5f=squel[_0x055e('0x56')]()[_0x055e('0x57')]('id')[_0x055e('0x57')](_0x055e('0x2c'))[_0x055e('0x57')](_0x055e('0x58'))['from'](_0x055e('0x59'));var _0x7f03ed=squel[_0x055e('0x56')]()[_0x055e('0x57')]('u.id')[_0x055e('0x57')](_0x055e('0x5a'))[_0x055e('0x57')](_0x055e('0x5b'))['from']('user_has_chat_interactions','ui')[_0x055e('0x5c')](_0x055e('0x5d'),'u',_0x055e('0x5e'));var _0x2fbb1c=squel[_0x055e('0x56')]()[_0x055e('0x5f')](_0x055e('0x60'),'i')[_0x055e('0x5c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x055e('0x5c')](_0x055e('0x5d'),'o','o.id\x20=\x20i.UserId')[_0x055e('0x5c')](_0x055e('0x61'),'a',_0x055e('0x62'))[_0x055e('0x5c')]('chat_messages','me',_0x055e('0x63'))[_0x055e('0x5c')](_0x055e('0x64'),'it',_0x055e('0x65'))[_0x055e('0x5c')](_0x055e('0x59'),'t',_0x055e('0x66'));var _0x31935b=squel['expr']();var _0x3cb600=[];var _0x23794c=squel['expr']();var _0x29b754;if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x67')]){_0x29b754=as[_0x055e('0x68')](_0x20eb76['query'][_0x055e('0x67')]);var _0x18b7f7=_0x29b754[_0x055e('0x69')];for(var _0x4deec3=0x0;_0x4deec3<_0x29b754[_0x055e('0x6a')][_0x055e('0x6b')];_0x4deec3++){var _0xf2c62d=_0x29b754[_0x055e('0x6a')][_0x4deec3];var _0xcc4661='i';var _0x584e60=_[_0x055e('0x6c')](_0x118a0e,[_0x055e('0x2c'),_0xf2c62d[_0x055e('0x57')]]);if(!_0x584e60){switch(_0xf2c62d[_0x055e('0x57')]){case _0x055e('0x6d'):if(_0xf2c62d['value']==0x1){_0x2fbb1c[_0x055e('0x6e')]('`'+_0xf2c62d[_0x055e('0x57')]+_0x055e('0x6f'));}else{_0x2fbb1c['having']('`'+_0xf2c62d[_0x055e('0x57')]+_0x055e('0x70'));}break;case _0x055e('0x71'):if(_0xf2c62d[_0x055e('0x72')]===_0x055e('0x73')){if(_0xf2c62d['value'][_0x055e('0x38')]('\x20')['length']>0x1){_0x31935b[_0x18b7f7](_0x055e('0x74'),qs[_0x055e('0x75')](_0xf2c62d['value']),null);}else{var _0x3137bb='%'+_0xf2c62d[_0x055e('0x76')]+'%';_0x31935b[_0x18b7f7](_0x055e('0x77'),_0x3137bb,_0x3137bb,_0x3137bb);}}else{_0x584e60=_[_0x055e('0x6c')](_0x118a0e,['name','ContactId']);_0xf2c62d[_0x055e('0x57')]='ContactId';_0x200ed2=as[_0x055e('0x78')](_0xcc4661,_0x584e60[_0x055e('0x48')],_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')][_0x055e('0x7a')],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);}break;case _0x055e('0x7b'):var _0x3de5f1=_0xf2c62d[_0x055e('0x76')]['split'](',')['map'](function(_0xb8b2a0){return Number(_0xb8b2a0);});_0x3de5f1[_0x055e('0x39')](function(_0x52a6e9){_0x23794c['or'](_0x055e('0x7c'),'%,'+_0x52a6e9+',%');});_0x3cb600=_['union'](_0x3cb600,_0x3de5f1);break;case _0x055e('0x7d'):if(_0xf2c62d[_0x055e('0x72')]===_0x055e('0x73')){_0x31935b[_0x18b7f7](_0x055e('0x7e'),'%'+_0xf2c62d[_0x055e('0x76')]+'%',null);}else{_0x584e60=_[_0x055e('0x6c')](_0x118a0e,[_0x055e('0x2c'),_0x055e('0x41')]);_0xf2c62d['field']=_0x055e('0x41');_0x200ed2=as[_0x055e('0x78')](_0xcc4661,_0x584e60[_0x055e('0x48')],_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')][_0x055e('0x7a')],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);}break;case _0x055e('0x2f'):_0x200ed2=as['buildExpression']('me',null,_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')]['start'],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);break;}}else{var _0x200ed2=as[_0x055e('0x78')](_0xcc4661,_0x584e60['type'],_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')][_0x055e('0x7a')],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);}}}else{var _0x525d4f=_(_0x20eb76[_0x055e('0x4c')])[_0x055e('0x4b')]()[_0x055e('0x34')](function(_0xe21a0e){return _['some'](_0x118a0e,[_0x055e('0x2c'),_0xe21a0e])?_0xe21a0e:undefined;})[_0x055e('0x7f')]()[_0x055e('0x76')]();if(!_[_0x055e('0x80')](_0x525d4f)){_0x525d4f[_0x055e('0x39')](function(_0x59e669){if(_0x59e669===_0x055e('0x81')){_0x2fbb1c[_0x055e('0x55')](_0x055e('0x82'),[][_0x055e('0x83')](_0x20eb76['query'][_0x59e669]));}else if(_0x59e669===_0x055e('0x84')){var _0x94e3e=JSON[_0x055e('0x85')](_0x20eb76[_0x055e('0x4c')][_0x59e669])['$gte'];var _0x22f4db=JSON[_0x055e('0x85')](_0x20eb76[_0x055e('0x4c')][_0x59e669])[_0x055e('0x86')];_0x2fbb1c[_0x055e('0x55')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x94e3e,_0x22f4db);}else{if(_0x20eb76[_0x055e('0x4c')][_0x59e669]===_0x055e('0x87')){_0x2fbb1c[_0x055e('0x55')]('i.'+_0x59e669+'\x20IS\x20NULL');}else{_0x2fbb1c['where']('i.'+_0x59e669+_0x055e('0x88'),_0x20eb76['query'][_0x59e669]);}}});}if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x89')]){if(_0x20eb76['query'][_0x055e('0x89')]==0x1){_0x2fbb1c[_0x055e('0x6e')](_0x055e('0x8a'));}else{_0x2fbb1c[_0x055e('0x6e')](_0x055e('0x8b'));}}if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')]){_0x3cb600=_[_0x055e('0x8d')](_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')])?_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')]:new Array(_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')]);_0x3cb600[_0x055e('0x39')](function(_0xba91c3){_0x23794c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xba91c3+',%');});}if(_0x20eb76[_0x055e('0x4c')]['filter']){var _0x5d2993=_0x20eb76[_0x055e('0x4c')][_0x055e('0x8e')][_0x055e('0x8f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x055e('0x90')](_0x5d2993)){_0x31935b['or'](_0x055e('0x91'),_0x5d2993+'%');}else{_0x31935b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x055e('0x75')](_0x5d2993))['or'](_0x055e('0x92'),_0x5d2993+'%');}}}_0x2fbb1c['where'](_0x31935b);_0x2fbb1c[_0x055e('0x93')]('i.id');var _0xc825b0={'type':db[_0x055e('0x94')][_0x055e('0x95')][_0x055e('0x96')],'raw':!![]};var _0x49db81=_0x2fbb1c['clone']();_0x49db81['field'](_0x055e('0x97'));_0x49db81['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x055e('0x6d'));if(_0x1f3c73['order']){_0x1f3c73[_0x055e('0x53')][_0x055e('0x39')](function(_0x15a107){var _0x1c3a1a=_0x15a107[0x0]==='contactName'?_0x15a107[0x0]:'i.'+_0x15a107[0x0];_0x2fbb1c['order'](_0x1c3a1a,_0x15a107[0x1]===_0x055e('0x98')?![]:!![]);});}if(!_[_0x055e('0x80')](_0x3cb600)){_0x2fbb1c[_0x055e('0x6e')](_0x23794c);_0x49db81[_0x055e('0x55')](_0x055e('0x99'),_0x3cb600);}BPromise[_0x055e('0x9a')]()[_0x055e('0x16')](function(){if(!_0x29b754){if(_0x20eb76['query'][_0x055e('0x81')])return;_0x49db81['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x2fbb1c[_0x055e('0x55')](_0x055e('0x9b'));return;}if(_0x20eb76[_0x055e('0x9c')]['role']!==_0x055e('0x31'))return;return _0x20eb76[_0x055e('0x9c')][_0x055e('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x785c9c){if(_[_0x055e('0x80')](_0x785c9c)){_0x49db81[_0x055e('0x55')](_0x055e('0x9e'));_0x2fbb1c[_0x055e('0x55')](_0x055e('0x9e'));}else{_0x49db81[_0x055e('0x55')](_0x055e('0x82'),_[_0x055e('0x34')](_0x785c9c,'id'));_0x2fbb1c[_0x055e('0x55')](_0x055e('0x82'),_[_0x055e('0x34')](_0x785c9c,'id'));}});})[_0x055e('0x16')](function(){if(_0x20eb76[_0x055e('0x9c')][_0x055e('0x9f')]===_0x055e('0x31')&&!_0x29b754&&!_0x20eb76['query'][_0x055e('0x81')])return[];return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x49db81['toString'](),_0xc825b0);})['then'](function(_0x4fd7e2){_0x297edd[_0x055e('0x26')]=_0x4fd7e2[_0x055e('0x6b')];if(_0x297edd[_0x055e('0x26')]===0x0)return[];return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x248e5f[_0x055e('0xa1')](),_0xc825b0)[_0x055e('0x16')](function(_0x2f9a0f){_0x393717=_['keyBy'](_0x2f9a0f,'id');_0xc825b0=_[_0x055e('0x2e')](_0xc825b0,{'model':db[_0x055e('0x45')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x50')]){_0x1f3c73[_0x055e('0x4e')][_0x055e('0x39')](function(_0x46e8f4){_0x2fbb1c[_0x055e('0x57')]('i.'+_0x46e8f4);});}else{_0x2fbb1c[_0x055e('0x57')](_0x055e('0xa2'),_0x055e('0x6d'));_0x2fbb1c[_0x055e('0x57')]('a.key','Account.key');_0x2fbb1c[_0x055e('0x57')](_0x055e('0xa3'),_0x055e('0xa4'));_0x2fbb1c['field'](_0x055e('0xa5'),_0x055e('0xa6'));_0x2fbb1c[_0x055e('0x57')]('i.*');_0x2fbb1c[_0x055e('0x57')]('c.firstName',_0x055e('0xa7'));_0x2fbb1c['field'](_0x055e('0xa8'),_0x055e('0xa9'));_0x2fbb1c['field']('c.email',_0x055e('0xaa'));_0x2fbb1c['field']('c.phone',_0x055e('0xab'));_0x2fbb1c[_0x055e('0x57')](_0x055e('0xac'),_0x055e('0xad'));_0x2fbb1c[_0x055e('0x57')]('c.fax',_0x055e('0xae'));_0x2fbb1c[_0x055e('0x57')]('o.fullname',_0x055e('0xaf'));_0x2fbb1c[_0x055e('0x57')](_0x055e('0xb0'),_0x055e('0xb1'));_0x2fbb1c[_0x055e('0x57')](_0x055e('0xb2'),_0x055e('0x36'));}if(_0x1f3c73[_0x055e('0x25')])_0x2fbb1c['limit'](_0x1f3c73[_0x055e('0x25')]);if(_0x1f3c73[_0x055e('0x23')])_0x2fbb1c[_0x055e('0x23')](_0x1f3c73[_0x055e('0x23')]);return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x2fbb1c[_0x055e('0xa1')](),_0xc825b0);})[_0x055e('0x16')](function(_0x21ae7c){if(_0x21ae7c[_0x055e('0x6b')]>0x0)_0x7f03ed[_0x055e('0x55')]('ui.ChatInteractionId\x20IN\x20?',_[_0x055e('0x34')](_0x21ae7c,'id'));return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x7f03ed['toString'](),_0xc825b0)['then'](function(_0x35e203){var _0x27b463=_[_0x055e('0xb3')](_0x35e203,_0x055e('0xb4'));var _0xe63e29=[];_0x21ae7c[_0x055e('0x39')](function(_0x505cc4){_0xe63e29[_0x055e('0x3a')](updateChatInteraction(_0x505cc4,_0x393717,_0x27b463));});return BPromise[_0x055e('0xb5')](_0xe63e29);});});})[_0x055e('0x16')](function(_0x324a3d){_0x297edd[_0x055e('0xb6')]=_0x324a3d;return _0x297edd;})[_0x055e('0x16')](respondWithFilteredResult(_0x19e29c,_0x1f3c73))[_0x055e('0xb7')](handleError(_0x19e29c,null));};exports[_0x055e('0xb8')]=function(_0x207f31,_0x4abd2e){var _0x58bf27={'raw':![],'where':{'id':_0x207f31[_0x055e('0xb9')]['id']}},_0x478da3={};_0x478da3[_0x055e('0x4a')]=_[_0x055e('0x4b')](db['ChatInteraction'][_0x055e('0x46')]);_0x478da3[_0x055e('0x4c')]=_[_0x055e('0x4b')](_0x207f31[_0x055e('0x4c')]);_0x478da3[_0x055e('0x4d')]=_[_0x055e('0x4f')](_0x478da3[_0x055e('0x4a')],_0x478da3[_0x055e('0x4c')]);_0x58bf27['attributes']=_[_0x055e('0x4f')](_0x478da3[_0x055e('0x4a')],qs['fields'](_0x207f31['query'][_0x055e('0x50')]));_0x58bf27[_0x055e('0x4e')]=_0x58bf27[_0x055e('0x4e')][_0x055e('0x6b')]?_0x58bf27['attributes']:_0x478da3['model'];if(_0x207f31[_0x055e('0x4c')][_0x055e('0xba')]){_0x58bf27[_0x055e('0xbb')]=[{'all':!![]}];}_0x58bf27=_[_0x055e('0x2e')]({},_0x58bf27,_0x207f31[_0x055e('0xbc')]);return db['ChatInteraction'][_0x055e('0x6c')](_0x58bf27)[_0x055e('0x16')](handleEntityNotFound(_0x4abd2e,null))['then'](respondWithResult(_0x4abd2e,null))[_0x055e('0xb7')](handleError(_0x4abd2e,null));};exports['create']=function(_0x495d7d,_0x47f131){return db[_0x055e('0x45')][_0x055e('0xbd')](_0x495d7d['body'],{})[_0x055e('0x16')](respondWithResult(_0x47f131,0xc9))[_0x055e('0xb7')](handleError(_0x47f131,null));};exports['update']=function(_0xae5b5a,_0x5dffc3){if(_0xae5b5a[_0x055e('0x2f')]['id']){delete _0xae5b5a['body']['id'];}return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0xae5b5a[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x5dffc3,null))['then'](saveUpdates(_0xae5b5a[_0x055e('0x2f')],null))[_0x055e('0x16')](respondWithResult(_0x5dffc3,null))['catch'](handleError(_0x5dffc3,null));};exports[_0x055e('0x2a')]=function(_0x116f84,_0x174a30){return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x116f84[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x174a30,null))[_0x055e('0x16')](removeEntity(_0x174a30,null))[_0x055e('0xb7')](handleError(_0x174a30,null));};exports[_0x055e('0xbe')]=function(_0x1bd652,_0x32bf47){return db[_0x055e('0x45')][_0x055e('0xbe')]()[_0x055e('0x16')](respondWithResult(_0x32bf47,null))[_0x055e('0xb7')](handleError(_0x32bf47,null));};exports['createVidaooSession']=function(_0x2d5bf8,_0x484ee0){var _0x204fef=_0x2d5bf8[_0x055e('0xb9')]['id'];var _0x5ca835;var _0xfb3b6d;var _0x5ee76f;return db[_0x055e('0x45')]['findOne']({'where':{'id':_0x204fef}})[_0x055e('0x16')](function(_0x127c91){_0x5ca835=_0x127c91;return db['ChatWebsite'][_0x055e('0xbf')]({'where':{'id':_0x127c91[_0x055e('0x81')]},'attributes':['id',_0x055e('0xc0'),'vidaooEscalation',_0x055e('0xc1'),_0x055e('0xc2'),_0x055e('0xc3')],'raw':!![]});})[_0x055e('0x16')](function(_0x9d0c0f){if(_0x9d0c0f&&_0x9d0c0f[_0x055e('0xc0')]&&_0x9d0c0f['vidaooEscalation']){_0xfb3b6d=_0x9d0c0f;var _0x41b2af={'interaction':{'id':_0x204fef},'agent':{'id':_0x2d5bf8['user']['id'],'name':_0x2d5bf8[_0x055e('0x9c')][_0x055e('0x2c')],'fullname':_0x2d5bf8['user']['fullname'],'email':_0x2d5bf8[_0x055e('0x9c')]['email']},'contact':_0x2d5bf8['body'][_0x055e('0x30')],'account':_0x2d5bf8['body'][_0x055e('0x33')]};var _0x51c37b={'rejectUnauthorized':![],'method':_0x055e('0xc4'),'url':_0x055e('0xc5'),'headers':{'X-APIKEY':_0x9d0c0f[_0x055e('0xc0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2d5bf8[_0x055e('0x9c')][_0x055e('0xc6')]],'buttons':null,'topic':_0xfb3b6d['vidaooTopic'],'note':_['isNull'](_0xfb3b6d[_0x055e('0xc2')])?null:getMustacheRender(_0xfb3b6d[_0x055e('0xc2')],_0x41b2af),'metadata':null},'redirect':_0x055e('0xc7'),'json':!![]};try{if(!_[_0x055e('0xc8')](_0xfb3b6d['vidaooMetadata'])){var _0x2b4096=getMustacheRender(_0xfb3b6d[_0x055e('0xc3')],_0x41b2af);var _0x5ed6a5=JSON[_0x055e('0x85')](_0x2b4096);_0x51c37b[_0x055e('0x2f')][_0x055e('0xc9')]=_0x5ed6a5;}}catch(_0x45a14b){throw new db[(_0x055e('0x94'))][(_0x055e('0xca'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x51c37b);}else{throw new db[(_0x055e('0x94'))][(_0x055e('0xca'))](_0x055e('0xcb'));}})['then'](function(_0x38a846){_0x5ee76f=_0x38a846;if(_0x5ee76f['id']){var _0x7d100={'body':_0x5ee76f[_0x055e('0xcc')],'ChatWebsiteId':_0xfb3b6d['id'],'ChatInteractionId':_0x5ca835['id'],'direction':'out','UserId':_0x2d5bf8['user']['id']};return db[_0x055e('0xcd')][_0x055e('0xbd')](_0x7d100,{});}else{throw new db['Sequelize']['ValidationError'](_0x055e('0xce'));}})['then'](function(){return _0x5ca835[_0x055e('0xcf')]({'vidaooSessionId':_0x5ee76f['id']});})[_0x055e('0x16')](respondWithResult(_0x484ee0,null))[_0x055e('0xb7')](handleError(_0x484ee0,null));};exports['customUpdate']=function(_0x1423f4,_0x31db97){if(_0x1423f4[_0x055e('0x2f')]['id']){delete _0x1423f4['body']['id'];}return db[_0x055e('0x45')]['find']({'where':{'id':_0x1423f4[_0x055e('0xb9')]['id']},'include':[{'model':db[_0x055e('0xd0')],'as':_0x055e('0x71')}]})[_0x055e('0x16')](handleEntityNotFound(_0x31db97,null))[_0x055e('0x16')](saveUpdates(_0x1423f4[_0x055e('0x2f')],null))[_0x055e('0x16')](respondWithResult(_0x31db97,null))[_0x055e('0xb7')](handleError(_0x31db97,null));};exports[_0x055e('0xd1')]=function(_0x2b3b85,_0xb88a07){if(_0x2b3b85['body']['id']){delete _0x2b3b85['body']['id'];}return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x2b3b85[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](function(_0x2704a1){if(!_0x2704a1){logger[_0x055e('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x055e('0xd1'),0x194,_0x055e('0xd2'));_0xb88a07[_0x055e('0x20')](0x194);}else{if(_0x2704a1[_0x055e('0x41')]){throw new db[(_0x055e('0x94'))][(_0x055e('0xca'))](_0x055e('0xd3'));}}return _0x2704a1;})[_0x055e('0x16')](function(_0x4900bc){if(_0x4900bc){return _0x4900bc[_0x055e('0x29')]({'closed':_0x2b3b85[_0x055e('0x2f')]['closed'],'disposition':_0x2b3b85[_0x055e('0x2f')][_0x055e('0x42')]})['then'](function(_0x2a3726){return _0x2a3726;});}})[_0x055e('0x16')](function(){return respondWithRpcPromise(_0x055e('0xd4'),'abandon',_0x2b3b85[_0x055e('0x2f')],client9004);})['then'](respondWithResult(_0xb88a07,null))['catch'](handleError(_0xb88a07,null));};exports[_0x055e('0xd5')]=function(_0x400ab5,_0x324439){_0x400ab5[_0x055e('0x2f')][_0x055e('0x2c')]=_0x400ab5[_0x055e('0xd6')][_0x055e('0xd7')];_0x400ab5[_0x055e('0x2f')][_0x055e('0xd8')]=_0x400ab5[_0x055e('0xd6')][_0x055e('0xd9')];_0x400ab5[_0x055e('0x2f')]['type']=_0x400ab5[_0x055e('0xd6')][_0x055e('0xda')];return db[_0x055e('0xdb')][_0x055e('0xbd')](_0x400ab5[_0x055e('0x2f')])[_0x055e('0x16')](respondWithResult(_0x324439,0xc9))[_0x055e('0xb7')](handleError(_0x324439,null));};exports['attachmentDownload']=function(_0xfbb46b,_0x148aae){return db[_0x055e('0x45')][_0x055e('0xbf')]({'where':{'id':_0xfbb46b[_0x055e('0xb9')]['id']},'raw':!![]})[_0x055e('0x16')](handleEntityNotFound(_0x148aae,null))[_0x055e('0x16')](function(_0x36ae94){if(_0x36ae94){if(_0x36ae94[_0x055e('0x40')]){return _0x148aae[_0x055e('0x21')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x055e('0xdb')][_0x055e('0xbf')]({'where':{'id':_0xfbb46b[_0x055e('0x4c')][_0x055e('0xdc')]},'raw':!![]})[_0x055e('0x16')](handleEntityNotFound(_0x148aae,null));}})['then'](function(_0xa60f8e){if(_0xa60f8e){var _0x115d2b=_0xa60f8e[_0x055e('0xdd')]!==null;var _0x1d00ab=path[_0x055e('0xde')](config['root'],_0x055e('0xdf'));if(_0x115d2b){_0x1d00ab=path[_0x055e('0xde')](_0x1d00ab,_0x055e('0xe0'));}var _0x444324=path[_0x055e('0xde')](_0x1d00ab,_0xa60f8e[_0x055e('0xd8')]);return _0x148aae[_0x055e('0xe1')](_0x444324);}})[_0x055e('0xb7')](handleError(_0x148aae,null));};exports[_0x055e('0xe2')]=function(_0x42077b,_0x6aeb60){var _0x5b00e4=null;var _0x2fb64a=null;var _0x4d3029=null;if(_0x42077b[_0x055e('0x2f')]['id']){delete _0x42077b[_0x055e('0x2f')]['id'];}if(_0x42077b['body']['mailTranscript']){_0x4d3029=path['join'](config[_0x055e('0xe3')],_0x055e('0xe4'),util['format'](_0x055e('0xe5'),Date[_0x055e('0xe6')]()));_0x42077b[_0x055e('0x2f')][_0x055e('0xe7')]=_0x4d3029;}return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x42077b['params']['id']},'include':[{'model':db[_0x055e('0xcd')],'as':_0x055e('0xe8'),'include':[{'model':db['User'],'as':_0x055e('0x7d')}]}]})[_0x055e('0x16')](handleEntityNotFound(_0x6aeb60,null))['then'](saveUpdates(_0x42077b[_0x055e('0x2f')],null))[_0x055e('0x16')](function(_0x49db7a){if(_0x49db7a){_0x5b00e4=_0x49db7a;return db[_0x055e('0xe9')]['find']({'where':{'id':_0x5b00e4[_0x055e('0x81')]}});}})['then'](function(_0xb60055){if(_0xb60055){_0x2fb64a=_0xb60055;return db['CmContact'][_0x055e('0x6c')]({'where':{'id':_0x5b00e4[_0x055e('0xea')]}});}})[_0x055e('0x16')](function(_0x25011f){if(_0x25011f){if(_0x4d3029){var _0xe83c1f=null;for(var _0x3084c7=0x1;_0x3084c7<_0x5b00e4[_0x055e('0xe8')][_0x055e('0x6b')];++_0x3084c7){_0xe83c1f=_0x5b00e4['Messages'][_0x3084c7];var _0x1dc506=_0xe83c1f['UserId']?util['format'](_0x055e('0xeb'),_0x2fb64a['agentAlias'],_0xe83c1f[_0x055e('0x41')]):_0x055e('0xec');var _0x2c4cc6=_0x42077b[_0x055e('0x2f')][_0x055e('0xed')]||util[_0x055e('0xee')](_0x055e('0xeb'),_0x055e('0xef'),_0xe83c1f[_0x055e('0xea')]);switch(_0x2fb64a[_0x055e('0xf0')]){case'website_alias':_0x1dc506=_0xe83c1f[_0x055e('0x41')]?util[_0x055e('0xee')](_0x055e('0xeb'),_0x2fb64a[_0x055e('0xf1')],_0xe83c1f[_0x055e('0x41')]):_0x055e('0xec');break;case _0x055e('0xf2'):_0x1dc506=_0xe83c1f['UserId']?_0xe83c1f[_0x055e('0x7d')][_0x055e('0xf3')]||_0xe83c1f['User']['fullname']:_0x055e('0xec');break;case'agent_fullname':_0x1dc506=_0xe83c1f[_0x055e('0x41')]?_0xe83c1f['User'][_0x055e('0x35')]:'System';break;default:_0x1dc506=_0xe83c1f[_0x055e('0x41')]?util[_0x055e('0xee')](_0x055e('0xeb'),_0x2fb64a['agentAlias'],_0xe83c1f[_0x055e('0x41')]):_0x055e('0xec');}var _0x43038c=util[_0x055e('0xee')](_0x055e('0xf4'),moment(_0xe83c1f[_0x055e('0x84')])[_0x055e('0xee')](_0x055e('0xf5')),_0xe83c1f[_0x055e('0xf6')]==='in'?_0x2c4cc6:_0x1dc506,_0xe83c1f['body']);if(!_0xe83c1f['secret']){fs[_0x055e('0xf7')](_0x4d3029,_0x43038c);}}return db[_0x055e('0xf8')][_0x055e('0xbf')]({'where':{'service':!![]},'include':[{'model':db[_0x055e('0xf9')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x055e('0xfa')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x055e('0x16')](function(_0x133c5a){if(!_0x133c5a||!_0x133c5a[_0x055e('0xfb')]||!_0x42077b[_0x055e('0x2f')])return _0x5b00e4;var _0x5c9dfb=_0x133c5a[_0x055e('0xfc')]();return respondWithRpcPromise(_0x055e('0xfd'),_0x055e('0xfe'),{'account':_0x5c9dfb,'message':{'from':util[_0x055e('0xee')](_0x055e('0xff'),_0x133c5a[_0x055e('0x2c')],_0x133c5a['email']||_0x133c5a[_0x055e('0xfb')][_0x055e('0x9c')]),'to':_0x42077b[_0x055e('0x2f')][_0x055e('0x100')],'subject':'Mail\x20Transcript','text':util[_0x055e('0xee')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x42077b['body'][_0x055e('0x100')]),'attachments':[{'path':_0x4d3029}]}})['then'](function(){return _0x5b00e4;})['catch'](function(_0x11025e){logger[_0x055e('0x1c')](_0x11025e);});})['then'](respondWithStatusCode(_0x6aeb60,0xc8))['catch'](handleError(_0x6aeb60,null));};exports[_0x055e('0x101')]=function(_0x1458fc,_0x5be45a){return db[_0x055e('0xcd')][_0x055e('0x6c')]({'where':{'id':_0x1458fc['params']['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x5be45a,null))[_0x055e('0x16')](function(_0x1ac372){if(_0x1ac372){return _0x1ac372[_0x055e('0x101')](_0x1458fc[_0x055e('0x2f')][_0x055e('0x102')],_[_0x055e('0x103')](_0x1458fc['body'],[_0x055e('0x102'),'id'])||{});}})['then'](respondWithResult(_0x5be45a,null))['catch'](handleError(_0x5be45a,null));};exports[_0x055e('0x104')]=function(_0x3168db,_0x293731){var _0x3b58fa={'raw':![],'where':{}};var _0x47bc47={};var _0x5c9091={'count':0x0,'rows':[]};return db[_0x055e('0x45')][_0x055e('0xbf')]({'where':{'id':_0x3168db['params']['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x293731,null))[_0x055e('0x16')](function(_0x5b3e5f){if(_0x5b3e5f){_0x47bc47[_0x055e('0x4a')]=_[_0x055e('0x4b')](db[_0x055e('0xcd')]['rawAttributes']);_0x47bc47['query']=_[_0x055e('0x4b')](_0x3168db['query']);_0x47bc47[_0x055e('0x4d')]=_['intersection'](_0x47bc47['model'],_0x47bc47[_0x055e('0x4c')]);_0x3b58fa[_0x055e('0x4e')]=_[_0x055e('0x4f')](_0x47bc47[_0x055e('0x4a')],qs['fields'](_0x3168db[_0x055e('0x4c')]['fields']));_0x3b58fa['attributes']=_0x3b58fa[_0x055e('0x4e')][_0x055e('0x6b')]?_0x3b58fa[_0x055e('0x4e')]:_0x47bc47[_0x055e('0x4a')];if(!_0x3168db[_0x055e('0x4c')][_0x055e('0x51')]('nolimit')){_0x3b58fa[_0x055e('0x25')]=qs[_0x055e('0x25')](_0x3168db[_0x055e('0x4c')][_0x055e('0x25')]);_0x3b58fa[_0x055e('0x23')]=qs['offset'](_0x3168db[_0x055e('0x4c')]['offset']);}_0x3b58fa['order']=qs[_0x055e('0x54')](_0x3168db['query'][_0x055e('0x54')]);_0x3b58fa[_0x055e('0x55')]=qs[_0x055e('0x4d')](_['pick'](_0x3168db[_0x055e('0x4c')],_0x47bc47[_0x055e('0x4d')]));_0x3b58fa['where'][_0x055e('0xb4')]=_0x5b3e5f['id'];if(_0x3168db[_0x055e('0x4c')][_0x055e('0x8e')]){_0x3b58fa[_0x055e('0x55')]=_[_0x055e('0x2e')](_0x3b58fa[_0x055e('0x55')],{'$or':_[_0x055e('0x34')](_0x3b58fa[_0x055e('0x4e')],function(_0x2a9661){var _0x5e7e2e={};_0x5e7e2e[_0x2a9661]={'$like':'%'+_0x3168db['query']['filter']+'%'};return _0x5e7e2e;})});}if(_0x3168db['query'][_0x055e('0x105')]){var _0x496b08=_0x3168db[_0x055e('0x4c')]['$gte']['split'](',');var _0x366512={};_0x366512[_0x496b08[0x0]]={'$gte':moment(_0x496b08[0x1])[_0x055e('0xee')](_0x055e('0x106'))};_0x3b58fa[_0x055e('0x55')]=_[_0x055e('0x2e')](_0x3b58fa[_0x055e('0x55')],_0x366512);}_0x3b58fa=_['merge']({},_0x3b58fa,_0x3168db['options']);return db[_0x055e('0xcd')][_0x055e('0x26')]({'where':_0x3b58fa[_0x055e('0x55')]})[_0x055e('0x16')](function(_0x56456b){_0x5c9091[_0x055e('0x26')]=_0x56456b;if(_0x3168db[_0x055e('0x4c')][_0x055e('0xba')]){_0x3b58fa[_0x055e('0xbb')]=[{'all':!![]}];}return db[_0x055e('0xcd')][_0x055e('0x107')](_0x3b58fa);})[_0x055e('0x16')](function(_0x5ad564){_0x5c9091[_0x055e('0xb6')]=_0x5ad564;return _0x5c9091;});}})[_0x055e('0x16')](respondWithFilteredResult(_0x293731,_0x3b58fa))[_0x055e('0xb7')](handleError(_0x293731,null));};exports[_0x055e('0x108')]=function(_0x52414e,_0x1b69f8){var _0xdaddd0={'where':{}},_0x5b7239={},_0x456ce6={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x055e('0xbf')]({'where':{'id':_0x52414e[_0x055e('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1b69f8,null))['then'](function(_0x3f6e40){if(_0x3f6e40){_0x5b7239[_0x055e('0x4a')]=_[_0x055e('0x4b')](db[_0x055e('0xcd')]['rawAttributes']);_0x5b7239[_0x055e('0x4c')]=_[_0x055e('0x4b')](_0x52414e['query']);_0x5b7239[_0x055e('0x4d')]=_[_0x055e('0x4f')](_0x5b7239[_0x055e('0x4a')],_0x5b7239[_0x055e('0x4c')]);_0xdaddd0[_0x055e('0x4e')]=_[_0x055e('0x4f')](_0x5b7239[_0x055e('0x4a')],qs['fields'](_0x52414e[_0x055e('0x4c')][_0x055e('0x50')]));_0xdaddd0['attributes']=_0xdaddd0['attributes'][_0x055e('0x6b')]?_0xdaddd0[_0x055e('0x4e')]:_0x5b7239['model'];if(!_0x52414e['query']['hasOwnProperty'](_0x055e('0x52'))){_0xdaddd0[_0x055e('0x25')]=qs[_0x055e('0x25')](_0x52414e[_0x055e('0x4c')]['limit']);_0xdaddd0[_0x055e('0x23')]=qs[_0x055e('0x23')](_0x52414e[_0x055e('0x4c')][_0x055e('0x23')]);}_0xdaddd0[_0x055e('0x53')]=qs[_0x055e('0x54')](_0x52414e[_0x055e('0x4c')][_0x055e('0x54')]);_0xdaddd0[_0x055e('0x55')]=qs[_0x055e('0x4d')](_[_0x055e('0x109')](_0x52414e['query'],_0x5b7239[_0x055e('0x4d')]));_0xdaddd0[_0x055e('0x55')][_0x055e('0xb4')]=_0x3f6e40['id'];if(_0x52414e[_0x055e('0x4c')]['filter']){_0xdaddd0['where']=_['merge'](_0xdaddd0['where'],{'$or':_['map'](_0xdaddd0['attributes'],function(_0x348631){var _0x57d1a6={};_0x57d1a6[_0x348631]={'$like':'%'+_0x52414e['query']['filter']+'%'};return _0x57d1a6;})});}_0xdaddd0['where'][_0x055e('0x10a')]=![];if(_0x52414e['query']['id']){_0xdaddd0[_0x055e('0x55')]['id']={'$gt':_0x52414e['query']['id']};}_0xdaddd0=_[_0x055e('0x2e')]({},_0xdaddd0,_0x52414e['options']);return db[_0x055e('0xcd')]['count']({'where':_0xdaddd0[_0x055e('0x55')]})[_0x055e('0x16')](function(_0x411090){_0x456ce6['count']=_0x411090;_0xdaddd0[_0x055e('0xbb')]=[];if(_0x52414e['query'][_0x055e('0x10b')]){_0xdaddd0[_0x055e('0xbb')][_0x055e('0x3a')]({'model':db[_0x055e('0x7d')],'as':_0x055e('0x7d'),'attributes':['id','fullname',_0x055e('0xf3')]});}if(_0x52414e['query'][_0x055e('0xba')]){_0xdaddd0[_0x055e('0xbb')]=[{'all':!![]}];}return db[_0x055e('0xcd')][_0x055e('0x107')](_0xdaddd0);})['then'](function(_0x597e1d){_0x456ce6[_0x055e('0xb6')]=_0x597e1d;return _0x456ce6;});}})[_0x055e('0x16')](respondWithFilteredResult(_0x1b69f8,_0xdaddd0))[_0x055e('0xb7')](handleError(_0x1b69f8,null));};exports[_0x055e('0x10c')]=function(_0x5c7de1,_0x1f14d1){return db['ChatInteraction'][_0x055e('0x6c')]({'where':{'id':_0x5c7de1[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x1f14d1,null))[_0x055e('0x16')](function(_0x419b3d){if(_0x419b3d){return _0x419b3d[_0x055e('0x10d')](_0x5c7de1['body'][_0x055e('0x102')],_[_0x055e('0x103')](_0x5c7de1[_0x055e('0x2f')],['ids','id'])||{})[_0x055e('0x10e')](function(){return db[_0x055e('0x7b')][_0x055e('0x107')]({'attributes':['id',_0x055e('0x2c'),'color'],'where':{'id':_0x5c7de1[_0x055e('0x2f')]['ids']}});})[_0x055e('0x16')](function(_0x342b10){socket[_0x055e('0x10f')](_0x055e('0x110'),{'id':Number(_0x5c7de1[_0x055e('0xb9')]['id']),'tags':_0x342b10||[]});return{'id':Number(_0x5c7de1[_0x055e('0xb9')]['id']),'tags':_0x342b10||[]};});}})['then'](respondWithResult(_0x1f14d1,null))[_0x055e('0xb7')](handleError(_0x1f14d1,null));};exports[_0x055e('0x111')]=function(_0x2fdf9b,_0x27e111){return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x2fdf9b['params']['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x27e111,null))['then'](function(_0x1feb0f){if(_0x1feb0f){return _0x1feb0f[_0x055e('0x111')](_0x2fdf9b[_0x055e('0x4c')]['ids']);}})[_0x055e('0x16')](respondWithStatusCode(_0x27e111,null))[_0x055e('0xb7')](handleError(_0x27e111,null));};exports['download']=function(_0x199b86,_0x4c8dcf){var _0x433494=moment()[_0x055e('0x112')]()[_0x055e('0xa1')]();var _0x2c1052=path[_0x055e('0xde')](config[_0x055e('0xe3')],_0x055e('0x113'),_0x055e('0x114'),_0x055e('0x115'));var _0xebbb8c=path['join'](config[_0x055e('0xe3')],_0x055e('0x113'),_0x055e('0x114'),_0x055e('0x116'));var _0x43cf78=path[_0x055e('0xde')](_0x2c1052,_0x433494);var _0x3b27ba=util[_0x055e('0xee')](_0x055e('0x117'),_0x199b86[_0x055e('0xb9')]['id'],_0x433494);var _0x56cd75=path[_0x055e('0xde')](_0x2c1052,_0x3b27ba);var _0xc967a1=[];_0xc967a1[_0x055e('0x3a')]({'model':db[_0x055e('0x7d')],'as':_0x055e('0x7d'),'attributes':['id',_0x055e('0x35')],'raw':!![]});_0xc967a1[_0x055e('0x3a')]({'model':db['CmContact'],'as':_0x055e('0x71'),'attributes':['id',_0x055e('0x118'),'lastName'],'raw':!![]});if(_0x199b86[_0x055e('0x4c')][_0x055e('0x116')]){_0xc967a1['push']({'model':db[_0x055e('0xdb')],'as':_0x055e('0xdb'),'raw':!![]});}var _0x41313e=[{'model':db[_0x055e('0xcd')],'as':_0x055e('0xe8'),'attributes':['id',_0x055e('0x2f'),_0x055e('0x84'),'direction',_0x055e('0x10a'),_0x055e('0x89')],'include':_0xc967a1}];_0x41313e['push']({'model':db[_0x055e('0xe9')],'as':_0x055e('0x119'),'attributes':['id','name']});_0x41313e[_0x055e('0x3a')]({'model':db[_0x055e('0x7d')],'as':_0x055e('0x11a'),'attributes':['id',_0x055e('0x35')]});return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x199b86['params']['id']},'include':_0x41313e})['then'](handleEntityNotFound(_0x4c8dcf,null))['then'](function(_0x43b91c){if(_0x43b91c){var _0x26028f=_0x43b91c['get']({'plain':!![]});fs[_0x055e('0x11b')](_0x43cf78);var _0x1167e6={'channel':_0x055e('0x11c'),'account':_0x26028f[_0x055e('0x119')][_0x055e('0x2c')],'agent':_0x26028f[_0x055e('0x11a')]?_0x26028f[_0x055e('0x11a')]['fullname']:'N.A.','createdAt':moment(_0x26028f[_0x055e('0x84')])['format'](_0x055e('0x106'))[_0x055e('0xa1')](),'closedAt':_0x26028f['closed']?moment(_0x26028f['closedAt'])[_0x055e('0xee')](_0x055e('0x106'))['toString']():'','disposition':_0x26028f[_0x055e('0x42')],'chatInfo':{'browser':_0x26028f['browserName'],'os':_0x26028f['osName'],'referer':_0x26028f[_0x055e('0x11d')],'customerIp':_0x26028f[_0x055e('0x11e')],'customerPort':_0x26028f[_0x055e('0x11f')]?_0x26028f[_0x055e('0x11f')]:_0x055e('0x120')},'messages':_(_0x26028f[_0x055e('0xe8')])[_0x055e('0x121')]()[_0x055e('0x8e')]({'secret':![]})['map'](function(_0x45acae){if(_0x45acae[_0x055e('0xdb')]){var _0x1b3fc7=path[_0x055e('0xde')](_0xebbb8c,_0x45acae['Attachment'][_0x055e('0xd8')]);if(fs[_0x055e('0x122')](_0x1b3fc7)){fs[_0x055e('0x123')](_0x1b3fc7)['pipe'](fs[_0x055e('0x124')](path[_0x055e('0xde')](_0x43cf78,_0x45acae[_0x055e('0xdb')]['basename'])));}}return{'date':moment(_0x45acae['createdAt'])[_0x055e('0xee')](_0x055e('0x106'))[_0x055e('0xa1')](),'sender':_0x45acae['direction']===_0x055e('0x125')?_0x45acae[_0x055e('0x7d')]?_0x45acae['User'][_0x055e('0x35')]:_0x055e('0xec'):_0x45acae[_0x055e('0x71')][_0x055e('0x118')]+(_0x45acae[_0x055e('0x71')][_0x055e('0x126')]?'\x20'+_0x45acae[_0x055e('0x71')][_0x055e('0x126')]:''),'body':_0x45acae['Attachment']?_0x45acae[_0x055e('0xdb')][_0x055e('0xd8')]:_0x45acae[_0x055e('0x2f')],'direction':_0x45acae[_0x055e('0xf6')]===_0x055e('0x125')?'A':'C','secret':_0x45acae[_0x055e('0x10a')],'read':_0x45acae[_0x055e('0x89')],'attachment':_0x45acae[_0x055e('0xdb')]};})['value']()};return ejs[_0x055e('0x127')](path['join'](config[_0x055e('0xe3')],_0x055e('0x113'),_0x055e('0x128'),_0x055e('0x129')),{'interaction':_0x1167e6})[_0x055e('0x16')](function(_0x1990c8){var _0x45b0dd=path[_0x055e('0xde')](_0x43cf78,_0x055e('0x12a')+_0x26028f['id']+'-'+_0x433494+_0x055e('0x12b'));var _0x4fac37={'path':_0x45b0dd,'channel':_0x055e('0x11c'),'interactionId':_0x26028f['id']};return pdf['createPdfFromHTML'](_0x1990c8,_0x4fac37);})['then'](function(){return new Promise(function(_0x551a21,_0x365f1c){zipdir(_0x43cf78,{'saveTo':_0x56cd75},function(_0x2bd1a9,_0x2a888e){if(_0x2bd1a9)return _0x365f1c(_0x2bd1a9);return _0x551a21(_0x2a888e);});})[_0x055e('0x16')](function(){return new BPromise(function(_0x3420fc,_0x9b5222){rimraf(_0x43cf78,function(_0xce341b){if(_0xce341b)_0x9b5222(_0xce341b);return _0x3420fc();});});})['then'](function(){return _0x4c8dcf[_0x055e('0xe1')](_0x56cd75,_0x3b27ba,function(_0x8509c7){if(_0x8509c7){logger['error'](_0x055e('0x12c'),_0x8509c7);}else{fs[_0x055e('0x12d')](_0x56cd75);}});});});}else{return _0x4c8dcf[_0x055e('0x20')](0xc8);}})[_0x055e('0xb7')](handleError(_0x4c8dcf,null));};
\ No newline at end of file
diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js
index 2915bf5..0ea600f 100644
--- a/server/api/chatInteraction/chatInteraction.events.js
+++ b/server/api/chatInteraction/chatInteraction.events.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x60e0=['../../mysqldb','ChatInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty','hook','events'];(function(_0x80d57,_0x20ae16){var _0x37381d=function(_0x5b3f32){while(--_0x5b3f32){_0x80d57['push'](_0x80d57['shift']());}};_0x37381d(++_0x20ae16);}(_0x60e0,0x12b));var _0x060e=function(_0x104aed,_0x4c7f3f){_0x104aed=_0x104aed-0x0;var _0x31da6a=_0x60e0[_0x104aed];return _0x31da6a;};'use strict';var EventEmitter=require(_0x060e('0x0'));var ChatInteraction=require(_0x060e('0x1'))['db'][_0x060e('0x2')];var ChatMessage=require(_0x060e('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x060e('0x3')](0x0);var events={'afterCreate':_0x060e('0x4'),'afterUpdate':'update','afterDestroy':_0x060e('0x5')};function emitEvent(_0x1d9d0e){return function(_0x28ae80,_0x11f887,_0xff3353){_0x28ae80[_0x060e('0x6')]({'attributes':['id'],'raw':!![]})[_0x060e('0x7')](function(_0x457359){_0x28ae80[_0x060e('0x8')](_0x060e('0x9'),_0x457359['map'](function(_0x409599){return{'id':_0x409599['id']};}));return ChatMessage[_0x060e('0xa')]({'where':{'ChatInteractionId':_0x28ae80['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2e65f4){_0x28ae80[_0x060e('0x8')]('unreadMessages',_0x2e65f4[_0x060e('0xb')]);ChatInteractionEvents[_0x060e('0xc')](_0x1d9d0e+':'+_0x28ae80['id'],_0x28ae80);ChatInteractionEvents['emit'](_0x1d9d0e,_0x28ae80);_0xff3353(null);})['catch'](_0xff3353(null));};}for(var e in events){if(events[_0x060e('0xd')](e)){var event=events[e];ChatInteraction[_0x060e('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents;
\ No newline at end of file
+var _0xb558=['ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','then','length','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction'];(function(_0x3a0019,_0x393997){var _0x135e81=function(_0x2ee99a){while(--_0x2ee99a){_0x3a0019['push'](_0x3a0019['shift']());}};_0x135e81(++_0x393997);}(_0xb558,0x11d));var _0x8b55=function(_0x3470bb,_0x34e3de){_0x3470bb=_0x3470bb-0x0;var _0x51fe56=_0xb558[_0x3470bb];return _0x51fe56;};'use strict';var EventEmitter=require(_0x8b55('0x0'));var ChatInteraction=require(_0x8b55('0x1'))['db'][_0x8b55('0x2')];var ChatMessage=require(_0x8b55('0x1'))['db'][_0x8b55('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8b55('0x4')](0x0);var events={'afterCreate':_0x8b55('0x5'),'afterUpdate':_0x8b55('0x6'),'afterDestroy':_0x8b55('0x7')};function emitEvent(_0x14f451){return function(_0x5cd075,_0x1186b0,_0x51f856){_0x5cd075[_0x8b55('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x72e5f5){_0x5cd075[_0x8b55('0x9')]('Users',_0x72e5f5[_0x8b55('0xa')](function(_0xca360f){return{'id':_0xca360f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x5cd075['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b55('0xb')](function(_0x2ee81d){_0x5cd075[_0x8b55('0x9')]('unreadMessages',_0x2ee81d[_0x8b55('0xc')]);ChatInteractionEvents[_0x8b55('0xd')](_0x14f451+':'+_0x5cd075['id'],_0x5cd075);ChatInteractionEvents[_0x8b55('0xd')](_0x14f451,_0x5cd075);_0x51f856(null);})['catch'](_0x51f856(null));};}for(var e in events){if(events[_0x8b55('0xe')](e)){var event=events[e];ChatInteraction[_0x8b55('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents;
\ No newline at end of file
diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js
index d8552bd..68e4908 100644
--- a/server/api/chatInteraction/chatInteraction.model.js
+++ b/server/api/chatInteraction/chatInteraction.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5cfb=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed'];(function(_0xd692d4,_0x52efa4){var _0x567410=function(_0x478d92){while(--_0x478d92){_0xd692d4['push'](_0xd692d4['shift']());}};_0x567410(++_0x52efa4);}(_0x5cfb,0xaa));var _0xb5cf=function(_0x1ba6ad,_0x13e6e9){_0x1ba6ad=_0x1ba6ad-0x0;var _0x3cf481=_0x5cfb[_0x1ba6ad];return _0x3cf481;};'use strict';var _=require(_0xb5cf('0x0'));var util=require(_0xb5cf('0x1'));var logger=require('../../config/logger')(_0xb5cf('0x2'));var moment=require('moment');var BPromise=require(_0xb5cf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5cf('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb5cf('0x5'));module['exports']=function(_0x313562,_0x29bd83){return _0x313562[_0xb5cf('0x6')](_0xb5cf('0x7'),attributes,{'tableName':_0xb5cf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4bba55,_0x2189de,_0x3bfa10){if(_0x4bba55['changed'](_0xb5cf('0x9'))){_0x4bba55[_0xb5cf('0xa')]=moment()[_0xb5cf('0xb')](_0xb5cf('0xc'));}_0x3bfa10(null,_0x4bba55);}},'charset':_0xb5cf('0xd'),'collate':_0xb5cf('0xe')});};
\ No newline at end of file
+var _0x5539=['chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define'];(function(_0x44eb28,_0x4c4308){var _0x4da0d9=function(_0x2e5c21){while(--_0x2e5c21){_0x44eb28['push'](_0x44eb28['shift']());}};_0x4da0d9(++_0x4c4308);}(_0x5539,0x97));var _0x9553=function(_0x7dd4f6,_0x25fd40){_0x7dd4f6=_0x7dd4f6-0x0;var _0x10809e=_0x5539[_0x7dd4f6];return _0x10809e;};'use strict';var _=require(_0x9553('0x0'));var util=require(_0x9553('0x1'));var logger=require(_0x9553('0x2'))(_0x9553('0x3'));var moment=require(_0x9553('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9553('0x5'));var rimraf=require(_0x9553('0x6'));var config=require(_0x9553('0x7'));var attributes=require(_0x9553('0x8'));module[_0x9553('0x9')]=function(_0x4ebf20,_0xa886ac){return _0x4ebf20[_0x9553('0xa')]('ChatInteraction',attributes,{'tableName':_0x9553('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41fb17,_0x1d5a47,_0x3412c0){if(_0x41fb17[_0x9553('0xc')](_0x9553('0xd'))){_0x41fb17[_0x9553('0xe')]=moment()[_0x9553('0xf')](_0x9553('0x10'));}_0x3412c0(null,_0x41fb17);}},'charset':'utf8mb4','collate':_0x9553('0x11')});};
\ No newline at end of file
diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js
index 380c3d5..d2c2088 100644
--- a/server/api/chatInteraction/chatInteraction.rpc.js
+++ b/server/api/chatInteraction/chatInteraction.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x57e3=['attributes','limit','AddTagsToChatInteraction','find','where','addTags','omit','info','AddTags','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57e3,0xb1));var _0x357e=function(_0x188aa0,_0x109706){_0x188aa0=_0x188aa0-0x0;var _0x6528e5=_0x57e3[_0x188aa0];return _0x6528e5;};'use strict';var _=require('lodash');var util=require(_0x357e('0x0'));var moment=require(_0x357e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x357e('0x2'));var db=require(_0x357e('0x3'))['db'];var utils=require(_0x357e('0x4'));var logger=require(_0x357e('0x5'))(_0x357e('0x6'));var config=require(_0x357e('0x7'));var jayson=require(_0x357e('0x8'));var client=jayson[_0x357e('0x9')][_0x357e('0xa')]({'port':0x232a});config[_0x357e('0xb')]=_['defaults'](config[_0x357e('0xb')],{'host':_0x357e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x357e('0xb')]));require(_0x357e('0xd'))[_0x357e('0xe')](socket);function respondWithRpcPromise(_0x59e7ec,_0x466802,_0x1c5966){return new BPromise(function(_0x249dba,_0x33697e){return client[_0x357e('0xf')](_0x59e7ec,_0x1c5966)[_0x357e('0x10')](function(_0x43bede){logger['info'](_0x357e('0x11'),_0x466802,_0x357e('0x12'));logger[_0x357e('0x13')](_0x357e('0x14'),_0x466802,'request\x20sent',JSON[_0x357e('0x15')](_0x43bede));if(_0x43bede[_0x357e('0x16')]){if(_0x43bede[_0x357e('0x16')][_0x357e('0x17')]===0x1f4){logger[_0x357e('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x466802,_0x43bede[_0x357e('0x16')][_0x357e('0x18')]);return _0x33697e(_0x43bede[_0x357e('0x16')][_0x357e('0x18')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x466802,_0x43bede['error']['message']);return _0x249dba(_0x43bede[_0x357e('0x16')][_0x357e('0x18')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x466802,'request\x20sent');_0x249dba(_0x43bede[_0x357e('0x19')][_0x357e('0x18')]);}})[_0x357e('0x1a')](function(_0x33abac){logger['error'](_0x357e('0x11'),_0x466802,_0x33abac);_0x33697e(_0x33abac);});});}exports[_0x357e('0x1b')]=function(_0x2b7bb8){var _0x3be5ba=this;return new Promise(function(_0x433a76,_0x1e1caf){return db[_0x357e('0x1c')][_0x357e('0x1d')](_0x2b7bb8[_0x357e('0x1e')],{'raw':_0x2b7bb8[_0x357e('0x1f')]?_0x2b7bb8['options'][_0x357e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b7bb8[_0x357e('0x1f')]?_0x2b7bb8[_0x357e('0x1f')]['where']||null:null,'attributes':_0x2b7bb8[_0x357e('0x1f')]?_0x2b7bb8['options'][_0x357e('0x21')]||null:null,'limit':_0x2b7bb8[_0x357e('0x1f')]?_0x2b7bb8[_0x357e('0x1f')][_0x357e('0x22')]||null:null})[_0x357e('0x10')](function(_0x1543df){logger['info'](_0x357e('0x1b'),_0x2b7bb8);logger[_0x357e('0x13')](_0x357e('0x1b'),_0x2b7bb8,JSON['stringify'](_0x1543df));_0x433a76(_0x1543df);})[_0x357e('0x1a')](function(_0x4fc5cd){logger[_0x357e('0x16')](_0x357e('0x1b'),_0x4fc5cd['message'],_0x2b7bb8);_0x1e1caf(_0x3be5ba[_0x357e('0x16')](0x1f4,_0x4fc5cd[_0x357e('0x18')]));});});};exports[_0x357e('0x23')]=function(_0x3ad75c){return new Promise(function(_0x24da7e,_0x25feaa){return db[_0x357e('0x1c')][_0x357e('0x24')]({'where':_0x3ad75c['options']?_0x3ad75c['options'][_0x357e('0x25')]||null:null})[_0x357e('0x10')](function(_0x4ff253){if(_0x4ff253){return _0x4ff253[_0x357e('0x26')](_0x3ad75c[_0x357e('0x1e')]['ids'],_[_0x357e('0x27')](_0x3ad75c[_0x357e('0x1e')],['ids','id'])||{});}})['spread'](function(_0x160077){logger[_0x357e('0x28')](_0x357e('0x29'),_0x3ad75c);logger['debug'](_0x357e('0x29'),_0x3ad75c,JSON[_0x357e('0x15')](_0x160077));_0x24da7e(_0x160077);})[_0x357e('0x1a')](function(_0x571bc0){logger[_0x357e('0x16')](_0x357e('0x29'),_0x571bc0[_0x357e('0x18')],_0x3ad75c);_0x25feaa(_this[_0x357e('0x16')](0x1f4,_0x571bc0['message']));});});};
\ No newline at end of file
+var _0x2e38=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','then','AddTagsToChatInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring'];(function(_0x456f1c,_0x4453d5){var _0x51918c=function(_0x12ce55){while(--_0x12ce55){_0x456f1c['push'](_0x456f1c['shift']());}};_0x51918c(++_0x4453d5);}(_0x2e38,0x1be));var _0x82e3=function(_0x4c9ee6,_0x90caf9){_0x4c9ee6=_0x4c9ee6-0x0;var _0x130ee8=_0x2e38[_0x4c9ee6];return _0x130ee8;};'use strict';var _=require(_0x82e3('0x0'));var util=require(_0x82e3('0x1'));var moment=require('moment');var BPromise=require(_0x82e3('0x2'));var rs=require(_0x82e3('0x3'));var fs=require('fs');var Redis=require(_0x82e3('0x4'));var db=require(_0x82e3('0x5'))['db'];var utils=require(_0x82e3('0x6'));var logger=require(_0x82e3('0x7'))(_0x82e3('0x8'));var config=require(_0x82e3('0x9'));var jayson=require(_0x82e3('0xa'));var client=jayson[_0x82e3('0xb')][_0x82e3('0xc')]({'port':0x232a});config[_0x82e3('0xd')]=_['defaults'](config[_0x82e3('0xd')],{'host':_0x82e3('0xe'),'port':0x18eb});var socket=require(_0x82e3('0xf'))(new Redis(config[_0x82e3('0xd')]));require(_0x82e3('0x10'))[_0x82e3('0x11')](socket);function respondWithRpcPromise(_0xd16f14,_0x40bf12,_0x56e175){return new BPromise(function(_0x47290,_0x4e8cd4){return client[_0x82e3('0x12')](_0xd16f14,_0x56e175)['then'](function(_0x46dfc3){logger['info'](_0x82e3('0x13'),_0x40bf12,_0x82e3('0x14'));logger[_0x82e3('0x15')](_0x82e3('0x16'),_0x40bf12,_0x82e3('0x14'),JSON[_0x82e3('0x17')](_0x46dfc3));if(_0x46dfc3[_0x82e3('0x18')]){if(_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x19')]===0x1f4){logger['error'](_0x82e3('0x13'),_0x40bf12,_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x1a')]);return _0x4e8cd4(_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x1a')]);}logger[_0x82e3('0x18')](_0x82e3('0x13'),_0x40bf12,_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x1a')]);return _0x47290(_0x46dfc3[_0x82e3('0x18')]['message']);}else{logger[_0x82e3('0x1b')](_0x82e3('0x13'),_0x40bf12,'request\x20sent');_0x47290(_0x46dfc3[_0x82e3('0x1c')]['message']);}})[_0x82e3('0x1d')](function(_0x3781c5){logger[_0x82e3('0x18')](_0x82e3('0x13'),_0x40bf12,_0x3781c5);_0x4e8cd4(_0x3781c5);});});}exports[_0x82e3('0x1e')]=function(_0x707dc8){var _0x470711=this;return new Promise(function(_0x28bfba,_0x2bfc32){return db[_0x82e3('0x1f')][_0x82e3('0x20')](_0x707dc8['body'],{'raw':_0x707dc8[_0x82e3('0x21')]?_0x707dc8[_0x82e3('0x21')][_0x82e3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x707dc8[_0x82e3('0x21')]?_0x707dc8[_0x82e3('0x21')][_0x82e3('0x23')]||null:null,'attributes':_0x707dc8[_0x82e3('0x21')]?_0x707dc8[_0x82e3('0x21')][_0x82e3('0x24')]||null:null,'limit':_0x707dc8['options']?_0x707dc8[_0x82e3('0x21')]['limit']||null:null})[_0x82e3('0x25')](function(_0x45756c){logger[_0x82e3('0x1b')]('UpdateChatInteraction',_0x707dc8);logger[_0x82e3('0x15')](_0x82e3('0x1e'),_0x707dc8,JSON['stringify'](_0x45756c));_0x28bfba(_0x45756c);})['catch'](function(_0x12449b){logger[_0x82e3('0x18')](_0x82e3('0x1e'),_0x12449b['message'],_0x707dc8);_0x2bfc32(_0x470711['error'](0x1f4,_0x12449b[_0x82e3('0x1a')]));});});};exports[_0x82e3('0x26')]=function(_0x3efef6){return new Promise(function(_0x49da7a,_0x43918b){return db[_0x82e3('0x1f')]['find']({'where':_0x3efef6[_0x82e3('0x21')]?_0x3efef6['options'][_0x82e3('0x23')]||null:null})[_0x82e3('0x25')](function(_0x33b764){if(_0x33b764){return _0x33b764[_0x82e3('0x27')](_0x3efef6[_0x82e3('0x28')][_0x82e3('0x29')],_[_0x82e3('0x2a')](_0x3efef6[_0x82e3('0x28')],[_0x82e3('0x29'),'id'])||{});}})[_0x82e3('0x2b')](function(_0x37d4dc){logger['info'](_0x82e3('0x2c'),_0x3efef6);logger[_0x82e3('0x15')]('AddTags',_0x3efef6,JSON[_0x82e3('0x17')](_0x37d4dc));_0x49da7a(_0x37d4dc);})[_0x82e3('0x1d')](function(_0x435c29){logger[_0x82e3('0x18')](_0x82e3('0x2c'),_0x435c29['message'],_0x3efef6);_0x43918b(_this[_0x82e3('0x18')](0x1f4,_0x435c29['message']));});});};
\ No newline at end of file
diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js
index c343ce3..eb753c4 100644
--- a/server/api/chatInteraction/chatInteraction.socket.js
+++ b/server/api/chatInteraction/chatInteraction.socket.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x2a8f=['remove','update','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x4f1482,_0x3309a2){var _0x512d2b=function(_0x3459d8){while(--_0x3459d8){_0x4f1482['push'](_0x4f1482['shift']());}};_0x512d2b(++_0x3309a2);}(_0x2a8f,0x16d));var _0xf2a8=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x2a8f[_0x2b9b7f];return _0x4ed19a;};'use strict';var ChatInteractionEvents=require(_0xf2a8('0x0'));var events=['save',_0xf2a8('0x1'),_0xf2a8('0x2')];function createListener(_0x1e1823,_0x471b01){return function(_0x5f184e){_0x471b01['emit'](_0x1e1823,_0x5f184e);};}function removeListener(_0x1a0472,_0x52c491){return function(){ChatInteractionEvents['removeListener'](_0x1a0472,_0x52c491);};}exports[_0xf2a8('0x3')]=function(_0x1ba3d0){for(var _0x294dd9=0x0,_0x16d713=events[_0xf2a8('0x4')];_0x294dd9<_0x16d713;_0x294dd9++){var _0x3e811a=events[_0x294dd9];var _0x23874a=createListener(_0xf2a8('0x5')+_0x3e811a,_0x1ba3d0);ChatInteractionEvents['on'](_0x3e811a,_0x23874a);}};
\ No newline at end of file
+var _0x4349=['update','emit','length','chatInteraction:','save'];(function(_0x4ba1e7,_0x23b5ef){var _0xafdfb6=function(_0x1c6ca8){while(--_0x1c6ca8){_0x4ba1e7['push'](_0x4ba1e7['shift']());}};_0xafdfb6(++_0x23b5ef);}(_0x4349,0x1c6));var _0x9434=function(_0x4c6327,_0xcbdd4b){_0x4c6327=_0x4c6327-0x0;var _0x3c8bc1=_0x4349[_0x4c6327];return _0x3c8bc1;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x9434('0x0'),'remove',_0x9434('0x1')];function createListener(_0x428503,_0x2ef439){return function(_0x2c46cc){_0x2ef439[_0x9434('0x2')](_0x428503,_0x2c46cc);};}function removeListener(_0x15817c,_0x46c92d){return function(){ChatInteractionEvents['removeListener'](_0x15817c,_0x46c92d);};}exports['register']=function(_0xa89207){for(var _0x5b80b0=0x0,_0x29a394=events[_0x9434('0x3')];_0x5b80b0<_0x29a394;_0x5b80b0++){var _0x24af73=events[_0x5b80b0];var _0x4270b1=createListener(_0x9434('0x4')+_0x24af73,_0xa89207);ChatInteractionEvents['on'](_0x24af73,_0x4270b1);}};
\ No newline at end of file
diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js
index 21fcf05..cbd981f 100644
--- a/server/api/chatInteraction/index.js
+++ b/server/api/chatInteraction/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc9f6=['join','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage'];(function(_0x40a30e,_0x5af2e6){var _0x4e6ef5=function(_0x521bbb){while(--_0x521bbb){_0x40a30e['push'](_0x40a30e['shift']());}};_0x4e6ef5(++_0x5af2e6);}(_0xc9f6,0x83));var _0x6c9f=function(_0x1e0a3a,_0x3135fc){_0x1e0a3a=_0x1e0a3a-0x0;var _0x1a426d=_0xc9f6[_0x1e0a3a];return _0x1a426d;};'use strict';var multer=require(_0x6c9f('0x0'));var util=require(_0x6c9f('0x1'));var path=require(_0x6c9f('0x2'));var timeout=require(_0x6c9f('0x3'));var express=require('express');var router=express[_0x6c9f('0x4')]();var fs_extra=require(_0x6c9f('0x5'));var auth=require(_0x6c9f('0x6'));var interaction=require(_0x6c9f('0x7'));var config=require(_0x6c9f('0x8'));var controller=require(_0x6c9f('0x9'));router[_0x6c9f('0xa')]('/',auth[_0x6c9f('0xb')](),controller[_0x6c9f('0xc')]);router[_0x6c9f('0xa')]('/describe',auth[_0x6c9f('0xb')](),controller[_0x6c9f('0xd')]);router['get']('/:id',auth[_0x6c9f('0xe')](),controller[_0x6c9f('0xf')]);router[_0x6c9f('0xa')](_0x6c9f('0x10'),auth[_0x6c9f('0xe')](),controller['attachmentDownload']);router['get']('/:id/messages',auth[_0x6c9f('0xb')](),controller['getMessages']);router[_0x6c9f('0xa')](_0x6c9f('0x11'),auth[_0x6c9f('0xe')](),controller[_0x6c9f('0x12')]);router[_0x6c9f('0xa')]('/:id/download',auth[_0x6c9f('0xb')](),controller[_0x6c9f('0x13')]);router[_0x6c9f('0x14')]('/',auth[_0x6c9f('0xb')](),controller[_0x6c9f('0x15')]);router[_0x6c9f('0x14')](_0x6c9f('0x16'),auth[_0x6c9f('0xb')](),controller[_0x6c9f('0x17')]);var upload=multer({'storage':multer[_0x6c9f('0x18')]({'destination':function(_0x2ec8c5,_0x55d1df,_0x322b13){_0x322b13(null,path[_0x6c9f('0x19')](config[_0x6c9f('0x1a')],_0x6c9f('0x1b')));},'filename':function(_0x348883,_0x444e4a,_0x3f39e2){_0x3f39e2(null,util['format'](_0x6c9f('0x1c'),Date[_0x6c9f('0x1d')](),_0x444e4a[_0x6c9f('0x1e')][_0x6c9f('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6c9f('0x14')]('/:id/attachment_upload',upload[_0x6c9f('0x20')](_0x6c9f('0x21')),controller[_0x6c9f('0x22')]);router[_0x6c9f('0x14')](_0x6c9f('0x23'),auth['isChatInteractionAuthorized'](),controller[_0x6c9f('0x24')]);router[_0x6c9f('0x14')](_0x6c9f('0x25'),auth['isAuthenticated'](),interaction[_0x6c9f('0x26')](_0x6c9f('0x27'),_0x6c9f('0x28')),controller[_0x6c9f('0x29')]);router[_0x6c9f('0x2a')]('/:id',auth[_0x6c9f('0xb')](),interaction[_0x6c9f('0x26')]('chat','chatinteraction:update'),controller[_0x6c9f('0x2b')]);router['put'](_0x6c9f('0x2c'),controller['customUpdate']);router['put'](_0x6c9f('0x2d'),auth[_0x6c9f('0xe')](),controller[_0x6c9f('0x2e')]);router[_0x6c9f('0x2a')](_0x6c9f('0x2f'),controller['close']);router[_0x6c9f('0x30')]('/:id',auth[_0x6c9f('0xb')](),interaction[_0x6c9f('0x26')](_0x6c9f('0x27'),_0x6c9f('0x31')),controller[_0x6c9f('0x32')]);router[_0x6c9f('0x30')](_0x6c9f('0x25'),auth['isAuthenticated'](),controller['removeTags']);module[_0x6c9f('0x33')]=router;
\ No newline at end of file
+var _0x1a77=['isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','/:id/messages','addMessage','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','put','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0xa670ec,_0x14fc26){var _0x117e86=function(_0x46d765){while(--_0x46d765){_0xa670ec['push'](_0xa670ec['shift']());}};_0x117e86(++_0x14fc26);}(_0x1a77,0x12c));var _0x71a7=function(_0x31fac5,_0x48230e){_0x31fac5=_0x31fac5-0x0;var _0x1521db=_0x1a77[_0x31fac5];return _0x1521db;};'use strict';var multer=require(_0x71a7('0x0'));var util=require(_0x71a7('0x1'));var path=require(_0x71a7('0x2'));var timeout=require('connect-timeout');var express=require(_0x71a7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x71a7('0x4'));var interaction=require(_0x71a7('0x5'));var config=require(_0x71a7('0x6'));var controller=require(_0x71a7('0x7'));router[_0x71a7('0x8')]('/',auth[_0x71a7('0x9')](),controller[_0x71a7('0xa')]);router[_0x71a7('0x8')](_0x71a7('0xb'),auth[_0x71a7('0x9')](),controller['describe']);router[_0x71a7('0x8')]('/:id',auth[_0x71a7('0xc')](),controller[_0x71a7('0xd')]);router['get'](_0x71a7('0xe'),auth[_0x71a7('0xc')](),controller['attachmentDownload']);router[_0x71a7('0x8')]('/:id/messages',auth[_0x71a7('0x9')](),controller[_0x71a7('0xf')]);router[_0x71a7('0x8')](_0x71a7('0x10'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x71a7('0x8')](_0x71a7('0x11'),auth['isAuthenticated'](),controller[_0x71a7('0x12')]);router[_0x71a7('0x13')]('/',auth[_0x71a7('0x9')](),controller[_0x71a7('0x14')]);router[_0x71a7('0x13')](_0x71a7('0x15'),auth[_0x71a7('0x9')](),controller[_0x71a7('0x16')]);var upload=multer({'storage':multer[_0x71a7('0x17')]({'destination':function(_0x36a5be,_0x160b4d,_0x47a47e){_0x47a47e(null,path[_0x71a7('0x18')](config[_0x71a7('0x19')],_0x71a7('0x1a')));},'filename':function(_0x3f59f7,_0x2fe6d9,_0x2317ca){_0x2317ca(null,util[_0x71a7('0x1b')](_0x71a7('0x1c'),Date[_0x71a7('0x1d')](),_0x2fe6d9[_0x71a7('0x1e')][_0x71a7('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x71a7('0x13')]('/:id/attachment_upload',upload[_0x71a7('0x20')]('file'),controller['attachmentUpload']);router['post'](_0x71a7('0x21'),auth[_0x71a7('0xc')](),controller[_0x71a7('0x22')]);router[_0x71a7('0x13')]('/:id/tags',auth[_0x71a7('0x9')](),interaction['tracked'](_0x71a7('0x23'),_0x71a7('0x24')),controller[_0x71a7('0x25')]);router['put']('/:id',auth[_0x71a7('0x9')](),interaction['tracked'](_0x71a7('0x23'),_0x71a7('0x26')),controller[_0x71a7('0x27')]);router['put'](_0x71a7('0x28'),controller[_0x71a7('0x29')]);router['put'](_0x71a7('0x2a'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x71a7('0x2b')](_0x71a7('0x2c'),controller[_0x71a7('0x2d')]);router[_0x71a7('0x2e')](_0x71a7('0x2f'),auth[_0x71a7('0x9')](),interaction['tracked']('chat',_0x71a7('0x30')),controller[_0x71a7('0x31')]);router[_0x71a7('0x2e')](_0x71a7('0x32'),auth[_0x71a7('0x9')](),controller[_0x71a7('0x33')]);module['exports']=router;
\ No newline at end of file
diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js
index fc9007b..4a49058 100644
--- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js
+++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5125=['BOOLEAN','sequelize','medium'];(function(_0x1a1de1,_0x57c036){var _0x213534=function(_0x1cfc86){while(--_0x1cfc86){_0x1a1de1['push'](_0x1a1de1['shift']());}};_0x213534(++_0x57c036);}(_0x5125,0x109));var _0x5512=function(_0x50b72e,_0x4c8e49){_0x50b72e=_0x50b72e-0x0;var _0x476f92=_0x5125[_0x50b72e];return _0x476f92;};'use strict';var Sequelize=require(_0x5512('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5512('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5512('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x6aeb=['medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x53955a,_0x1177fd){var _0x146e46=function(_0x5b1535){while(--_0x5b1535){_0x53955a['push'](_0x53955a['shift']());}};_0x146e46(++_0x1177fd);}(_0x6aeb,0x139));var _0xb6ae=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x6aeb[_0x2e6dbf];return _0x2680e5;};'use strict';var Sequelize=require(_0xb6ae('0x0'));module[_0xb6ae('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb6ae('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb6ae('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb6ae('0x4')]}};
\ No newline at end of file
diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js
index 6a01fc7..b32fdde 100644
--- a/server/api/chatInternalMessage/chatInternalMessage.controller.js
+++ b/server/api/chatInternalMessage/chatInternalMessage.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x94f5=['find','create','body','describe','createdAt','lastMessage','lastMessageAt','format','getUsers','User','role','userpic','online','lastLoginAt','showWebBar','VoiceQueue','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','filter','messages','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','map','ChatInternalMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x8707c,_0x5d9ffa){var _0x54fea9=function(_0x2dd5d5){while(--_0x2dd5d5){_0x8707c['push'](_0x8707c['shift']());}};_0x54fea9(++_0x5d9ffa);}(_0x94f5,0x8d));var _0x594f=function(_0x18965b,_0x311cd4){_0x18965b=_0x18965b-0x0;var _0x37f9b8=_0x94f5[_0x18965b];return _0x37f9b8;};'use strict';var emlformat=require(_0x594f('0x0'));var rimraf=require(_0x594f('0x1'));var zipdir=require(_0x594f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x594f('0x3'));var moment=require(_0x594f('0x4'));var BPromise=require(_0x594f('0x5'));var Mustache=require('mustache');var util=require(_0x594f('0x6'));var path=require(_0x594f('0x7'));var sox=require(_0x594f('0x8'));var csv=require('to-csv');var ejs=require(_0x594f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x594f('0xa'));var squel=require('squel');var crypto=require(_0x594f('0xb'));var jsforce=require(_0x594f('0xc'));var deskjs=require(_0x594f('0xd'));var toCsv=require(_0x594f('0xe'));var querystring=require('querystring');var Papa=require(_0x594f('0xf'));var Redis=require(_0x594f('0x10'));var authService=require(_0x594f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x594f('0x12'));var hardwareService=require(_0x594f('0x13'));var logger=require('../../config/logger')(_0x594f('0x14'));var utils=require(_0x594f('0x15'));var config=require(_0x594f('0x16'));var licenseUtil=require(_0x594f('0x17'));var db=require(_0x594f('0x18'))['db'];config[_0x594f('0x19')]=_[_0x594f('0x1a')](config[_0x594f('0x19')],{'host':_0x594f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x594f('0x1c')](socket);function respondWithStatusCode(_0x87aff8,_0x462ef9){_0x462ef9=_0x462ef9||0xcc;return function(_0x29f8c1){if(_0x29f8c1){return _0x87aff8[_0x594f('0x1d')](_0x462ef9);}return _0x87aff8[_0x594f('0x1e')](_0x462ef9)['end']();};}function respondWithResult(_0x1f9adb,_0x57361c){_0x57361c=_0x57361c||0xc8;return function(_0x5935a7){if(_0x5935a7){return _0x1f9adb[_0x594f('0x1e')](_0x57361c)['json'](_0x5935a7);}};}function respondWithFilteredResult(_0x810761,_0x12089f){return function(_0x32148f){if(_0x32148f){var _0x1117b5=typeof _0x12089f[_0x594f('0x1f')]===_0x594f('0x20')&&typeof _0x12089f['limit']===_0x594f('0x20');var _0x20954d=_0x32148f[_0x594f('0x21')];var _0x1215c8=_0x1117b5?0x0:_0x12089f[_0x594f('0x1f')];var _0x1416b6=_0x1117b5?_0x32148f[_0x594f('0x21')]:_0x12089f['offset']+_0x12089f[_0x594f('0x22')];var _0x4ed3e9;if(_0x1416b6>=_0x20954d){_0x1416b6=_0x20954d;_0x4ed3e9=0xc8;}else{_0x4ed3e9=0xce;}_0x810761['status'](_0x4ed3e9);return _0x810761[_0x594f('0x23')](_0x594f('0x24'),_0x1215c8+'-'+_0x1416b6+'/'+_0x20954d)[_0x594f('0x25')](_0x32148f);}return null;};}function patchUpdates(_0x6d3bb2){return function(_0x495d71){try{jsonpatch[_0x594f('0x26')](_0x495d71,_0x6d3bb2,!![]);}catch(_0x48fee1){return BPromise['reject'](_0x48fee1);}return _0x495d71[_0x594f('0x27')]();};}function saveUpdates(_0x1091e6,_0x2b798c){return function(_0x23bf84){if(_0x23bf84){return _0x23bf84[_0x594f('0x28')](_0x1091e6)[_0x594f('0x29')](function(_0x4814b8){return _0x4814b8;});}return null;};}function removeEntity(_0x2bfbd3,_0x2f469b){return function(_0x165e40){if(_0x165e40){return _0x165e40[_0x594f('0x2a')]()['then'](function(){_0x2bfbd3['status'](0xcc)[_0x594f('0x2b')]();});}};}function handleEntityNotFound(_0x4882fd,_0x4a352a){return function(_0x431337){if(!_0x431337){_0x4882fd[_0x594f('0x1d')](0x194);}return _0x431337;};}function handleError(_0x331b2e,_0x577aec){_0x577aec=_0x577aec||0x1f4;return function(_0xbf2bcb){logger[_0x594f('0x2c')](_0xbf2bcb[_0x594f('0x2d')]);if(_0xbf2bcb[_0x594f('0x2e')]){delete _0xbf2bcb[_0x594f('0x2e')];}_0x331b2e['status'](_0x577aec)['send'](_0xbf2bcb);};}exports['index']=function(_0xd28632,_0xc17d0f){var _0x44ac16={},_0x5d2fb9={},_0xb4ef6a={'count':0x0,'rows':[]};var _0x301a00=_[_0x594f('0x2f')](db[_0x594f('0x30')][_0x594f('0x31')],function(_0x373f33){return{'name':_0x373f33['fieldName'],'type':_0x373f33[_0x594f('0x32')][_0x594f('0x33')]};});_0x5d2fb9[_0x594f('0x34')]=_['map'](_0x301a00,_0x594f('0x2e'));_0x5d2fb9['query']=_[_0x594f('0x35')](_0xd28632[_0x594f('0x36')]);_0x5d2fb9[_0x594f('0x37')]=_['intersection'](_0x5d2fb9[_0x594f('0x34')],_0x5d2fb9[_0x594f('0x36')]);_0x44ac16['attributes']=_[_0x594f('0x38')](_0x5d2fb9[_0x594f('0x34')],qs['fields'](_0xd28632['query']['fields']));_0x44ac16['attributes']=_0x44ac16[_0x594f('0x39')][_0x594f('0x3a')]?_0x44ac16['attributes']:_0x5d2fb9[_0x594f('0x34')];if(!_0xd28632[_0x594f('0x36')][_0x594f('0x3b')]('nolimit')){_0x44ac16[_0x594f('0x22')]=qs[_0x594f('0x22')](_0xd28632['query'][_0x594f('0x22')]);_0x44ac16[_0x594f('0x1f')]=qs[_0x594f('0x1f')](_0xd28632[_0x594f('0x36')]['offset']);}_0x44ac16[_0x594f('0x3c')]=qs[_0x594f('0x3d')](_0xd28632[_0x594f('0x36')][_0x594f('0x3d')]);_0x44ac16[_0x594f('0x3e')]=qs[_0x594f('0x37')](_[_0x594f('0x3f')](_0xd28632[_0x594f('0x36')],_0x5d2fb9[_0x594f('0x37')]),_0x301a00);if(_0xd28632[_0x594f('0x36')]['filter']){_0x44ac16['where']=_[_0x594f('0x40')](_0x44ac16[_0x594f('0x3e')],{'$or':_[_0x594f('0x2f')](_0x301a00,function(_0x2f28a3){if(_0x2f28a3[_0x594f('0x32')]!==_0x594f('0x41')){var _0x1646f7={};_0x1646f7[_0x2f28a3[_0x594f('0x2e')]]={'$like':'%'+_0xd28632[_0x594f('0x36')]['filter']+'%'};return _0x1646f7;}})});}_0x44ac16=_['merge']({},_0x44ac16,_0xd28632[_0x594f('0x42')]);var _0x5773c3={'where':_0x44ac16[_0x594f('0x3e')]};return db[_0x594f('0x30')]['count'](_0x5773c3)[_0x594f('0x29')](function(_0xd7b8f2){_0xb4ef6a[_0x594f('0x21')]=_0xd7b8f2;if(_0xd28632[_0x594f('0x36')][_0x594f('0x43')]){_0x44ac16[_0x594f('0x44')]=[{'all':!![]}];}return db[_0x594f('0x30')][_0x594f('0x45')](_0x44ac16);})[_0x594f('0x29')](function(_0x436994){_0xb4ef6a[_0x594f('0x46')]=_0x436994;return _0xb4ef6a;})[_0x594f('0x29')](respondWithFilteredResult(_0xc17d0f,_0x44ac16))[_0x594f('0x47')](handleError(_0xc17d0f,null));};exports[_0x594f('0x48')]=function(_0x16505b,_0xcf3298){var _0x954ff1={'raw':!![],'where':{'id':_0x16505b[_0x594f('0x49')]['id']}},_0x36fbd4={};_0x36fbd4[_0x594f('0x34')]=_['keys'](db[_0x594f('0x30')][_0x594f('0x31')]);_0x36fbd4['query']=_[_0x594f('0x35')](_0x16505b[_0x594f('0x36')]);_0x36fbd4['filters']=_['intersection'](_0x36fbd4['model'],_0x36fbd4[_0x594f('0x36')]);_0x954ff1[_0x594f('0x39')]=_[_0x594f('0x38')](_0x36fbd4[_0x594f('0x34')],qs[_0x594f('0x4a')](_0x16505b['query'][_0x594f('0x4a')]));_0x954ff1[_0x594f('0x39')]=_0x954ff1[_0x594f('0x39')][_0x594f('0x3a')]?_0x954ff1[_0x594f('0x39')]:_0x36fbd4['model'];if(_0x16505b[_0x594f('0x36')][_0x594f('0x43')]){_0x954ff1[_0x594f('0x44')]=[{'all':!![]}];}_0x954ff1=_[_0x594f('0x40')]({},_0x954ff1,_0x16505b[_0x594f('0x42')]);return db[_0x594f('0x30')][_0x594f('0x4b')](_0x954ff1)[_0x594f('0x29')](handleEntityNotFound(_0xcf3298,null))[_0x594f('0x29')](respondWithResult(_0xcf3298,null))['catch'](handleError(_0xcf3298,null));};exports[_0x594f('0x4c')]=function(_0x1cf184,_0x8f653d){return db[_0x594f('0x30')][_0x594f('0x4c')](_0x1cf184['body'],{})[_0x594f('0x29')](respondWithResult(_0x8f653d,0xc9))[_0x594f('0x47')](handleError(_0x8f653d,null));};exports[_0x594f('0x28')]=function(_0x4a36ec,_0x253e51){if(_0x4a36ec[_0x594f('0x4d')]['id']){delete _0x4a36ec[_0x594f('0x4d')]['id'];}return db[_0x594f('0x30')][_0x594f('0x4b')]({'where':{'id':_0x4a36ec[_0x594f('0x49')]['id']}})[_0x594f('0x29')](handleEntityNotFound(_0x253e51,null))['then'](saveUpdates(_0x4a36ec['body'],null))[_0x594f('0x29')](respondWithResult(_0x253e51,null))[_0x594f('0x47')](handleError(_0x253e51,null));};exports[_0x594f('0x2a')]=function(_0xc15599,_0x1a9393){return db[_0x594f('0x30')][_0x594f('0x4b')]({'where':{'id':_0xc15599[_0x594f('0x49')]['id']}})[_0x594f('0x29')](handleEntityNotFound(_0x1a9393,null))[_0x594f('0x29')](removeEntity(_0x1a9393,null))['catch'](handleError(_0x1a9393,null));};exports[_0x594f('0x4e')]=function(_0x347d39,_0x4f011c){return db[_0x594f('0x30')][_0x594f('0x4e')]()[_0x594f('0x29')](respondWithResult(_0x4f011c,null))[_0x594f('0x47')](handleError(_0x4f011c,null));};function wrapUser(_0x3eb880){return function(_0x5ca379){var _0x3bd0e5=_0x3eb880['get']({'plain':!![]});_0x3bd0e5['messages']=[];if(_0x5ca379){_0x3bd0e5['lastMessageAt']=_0x5ca379[_0x594f('0x4f')];_0x3bd0e5[_0x594f('0x50')]=_0x5ca379;}else{_0x3bd0e5[_0x594f('0x51')]=moment(0x0)[_0x594f('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bd0e5['lastMessage']={};}return _0x3bd0e5;};}exports[_0x594f('0x53')]=function(_0x3cb4ba,_0x32728e,_0x2889d3){var _0x2e0a6a=[];return db[_0x594f('0x54')][_0x594f('0x45')]({'where':{'role':['agent','admin','user']},'attributes':['id','fullname',_0x594f('0x2e'),_0x594f('0x55'),_0x594f('0x56'),'internal',_0x594f('0x57'),_0x594f('0x58'),'allowmessenger',_0x594f('0x59')],'order':qs[_0x594f('0x3d')]('-online'),'include':[{'model':db[_0x594f('0x5a')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x594f('0x29')](function(_0x4e8bce){if(_0x4e8bce){var _0x146958=_0x3cb4ba[_0x594f('0x5b')][_0x594f('0x5c')]({'plain':!![]});if(!_0x146958)throw new Error(_0x594f('0x5d'));if(_0x146958[_0x594f('0x55')]==='user'){return db[_0x594f('0x5e')][_0x594f('0x4b')]({'where':{'name':'Agents','userProfileId':_0x146958[_0x594f('0x5f')]},'raw':!![]})['then'](function(_0xc93553){if(_0xc93553){if(_0xc93553[_0x594f('0x60')]===0x0){return db[_0x594f('0x61')][_0x594f('0x45')]({'where':{'sectionId':_0xc93553['id']},'raw':!![]})['then'](function(_0x10de78){var _0x2428a6=[];if(_[_0x594f('0x62')](_0x10de78)){_0x2428a6=_['filter'](_0x4e8bce,function(_0x19f442){if(_0x19f442[_0x594f('0x55')]!=='agent'){return _0x19f442;}});return _0x2428a6;}else{for(var _0x30c6f5=0x0;_0x30c6f5<_0x4e8bce[_0x594f('0x3a')];_0x30c6f5++){var _0x3b76cc=_0x4e8bce[_0x30c6f5];if(_0x3b76cc[_0x594f('0x55')]===_0x594f('0x63')){var _0x4dcfd7=_[_0x594f('0x4b')](_0x10de78,function(_0xda19d3){return _0xda19d3[_0x594f('0x64')]===_0x3b76cc['id'];});if(_0x4dcfd7)_0x2428a6[_0x594f('0x65')](_0x3b76cc);}else{_0x2428a6[_0x594f('0x65')](_0x3b76cc);}}return _0x2428a6;}});}else{return _0x4e8bce;}}else{var _0x57bf15=_[_0x594f('0x66')](_0x4e8bce,function(_0x5307b4){if(_0x5307b4[_0x594f('0x55')]!=='agent'){return _0x5307b4;}});return _0x57bf15;}});}else{return _0x4e8bce;}}})[_0x594f('0x29')](function(_0xd46278){var _0x5129db=[];if(_0xd46278){_0x2e0a6a=_0xd46278;for(var _0x36f142=0x0;_0x36f142<_0xd46278[_0x594f('0x3a')];_0x36f142+=0x1){_0x2e0a6a[_0x36f142][_0x594f('0x67')]=[];_0x5129db[_0x594f('0x65')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x3cb4ba[_0x594f('0x5b')]['id'],_0xd46278[_0x36f142]['id']],'ToId':[_0x3cb4ba['user']['id'],_0xd46278[_0x36f142]['id']],'ChatGroupId':null},'attributes':['id',_0x594f('0x4f'),_0x594f('0x68'),_0x594f('0x69'),'read','body'],'order':qs[_0x594f('0x3d')](_0x594f('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x594f('0x29')](wrapUser(_0xd46278[_0x36f142])));}return BPromise[_0x594f('0x6b')](_0x5129db);}return[];})[_0x594f('0x29')](function(_0x596bcf){return{'rows':_0x596bcf,'count':_0x596bcf['length']};})['then'](respondWithResult(_0x32728e,null))[_0x594f('0x47')](handleError(_0x32728e,null));};
\ No newline at end of file
+var _0x0783=['update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','messages','createdAt','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','internal','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x290fc9,_0x3069fe){var _0x31c8bd=function(_0x4bec21){while(--_0x4bec21){_0x290fc9['push'](_0x290fc9['shift']());}};_0x31c8bd(++_0x3069fe);}(_0x0783,0x126));var _0x3078=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0783[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3078('0x0'));var zipdir=require(_0x3078('0x1'));var jsonpatch=require(_0x3078('0x2'));var rp=require(_0x3078('0x3'));var moment=require('moment');var BPromise=require(_0x3078('0x4'));var Mustache=require(_0x3078('0x5'));var util=require(_0x3078('0x6'));var path=require(_0x3078('0x7'));var sox=require(_0x3078('0x8'));var csv=require(_0x3078('0x9'));var ejs=require(_0x3078('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3078('0xb'));var squel=require(_0x3078('0xc'));var crypto=require(_0x3078('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3078('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3078('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3078('0xf'));var as=require(_0x3078('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3078('0x11'))('api');var utils=require(_0x3078('0x12'));var config=require(_0x3078('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3078('0x14'))['db'];config[_0x3078('0x15')]=_[_0x3078('0x16')](config['redis'],{'host':_0x3078('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3078('0x15')]));require(_0x3078('0x18'))[_0x3078('0x19')](socket);function respondWithStatusCode(_0xf5b54b,_0x201d14){_0x201d14=_0x201d14||0xcc;return function(_0x43ae65){if(_0x43ae65){return _0xf5b54b[_0x3078('0x1a')](_0x201d14);}return _0xf5b54b[_0x3078('0x1b')](_0x201d14)[_0x3078('0x1c')]();};}function respondWithResult(_0x349a5e,_0x146f95){_0x146f95=_0x146f95||0xc8;return function(_0x5183ec){if(_0x5183ec){return _0x349a5e[_0x3078('0x1b')](_0x146f95)[_0x3078('0x1d')](_0x5183ec);}};}function respondWithFilteredResult(_0x269a33,_0x5a412f){return function(_0xd4f3b){if(_0xd4f3b){var _0x3330a3=typeof _0x5a412f['offset']===_0x3078('0x1e')&&typeof _0x5a412f[_0x3078('0x1f')]===_0x3078('0x1e');var _0x24bb34=_0xd4f3b[_0x3078('0x20')];var _0x16062c=_0x3330a3?0x0:_0x5a412f[_0x3078('0x21')];var _0x8f91e4=_0x3330a3?_0xd4f3b['count']:_0x5a412f[_0x3078('0x21')]+_0x5a412f[_0x3078('0x1f')];var _0x1a8b13;if(_0x8f91e4>=_0x24bb34){_0x8f91e4=_0x24bb34;_0x1a8b13=0xc8;}else{_0x1a8b13=0xce;}_0x269a33[_0x3078('0x1b')](_0x1a8b13);return _0x269a33[_0x3078('0x22')](_0x3078('0x23'),_0x16062c+'-'+_0x8f91e4+'/'+_0x24bb34)[_0x3078('0x1d')](_0xd4f3b);}return null;};}function patchUpdates(_0x47acdb){return function(_0x5e0993){try{jsonpatch[_0x3078('0x24')](_0x5e0993,_0x47acdb,!![]);}catch(_0x58c806){return BPromise[_0x3078('0x25')](_0x58c806);}return _0x5e0993[_0x3078('0x26')]();};}function saveUpdates(_0x44df8b,_0x165ffb){return function(_0x2b0789){if(_0x2b0789){return _0x2b0789[_0x3078('0x27')](_0x44df8b)[_0x3078('0x28')](function(_0x116ae6){return _0x116ae6;});}return null;};}function removeEntity(_0x37322f,_0x3199a8){return function(_0x4400a3){if(_0x4400a3){return _0x4400a3[_0x3078('0x29')]()[_0x3078('0x28')](function(){_0x37322f[_0x3078('0x1b')](0xcc)[_0x3078('0x1c')]();});}};}function handleEntityNotFound(_0x360d87,_0x3aa993){return function(_0x231b4f){if(!_0x231b4f){_0x360d87[_0x3078('0x1a')](0x194);}return _0x231b4f;};}function handleError(_0x590047,_0x4c7b4f){_0x4c7b4f=_0x4c7b4f||0x1f4;return function(_0x1fea41){logger[_0x3078('0x2a')](_0x1fea41[_0x3078('0x2b')]);if(_0x1fea41[_0x3078('0x2c')]){delete _0x1fea41[_0x3078('0x2c')];}_0x590047['status'](_0x4c7b4f)[_0x3078('0x2d')](_0x1fea41);};}exports[_0x3078('0x2e')]=function(_0x19943e,_0x3a04e9){var _0x52c6dd={},_0x1bcb8e={},_0x202a36={'count':0x0,'rows':[]};var _0x4442b2=_[_0x3078('0x2f')](db[_0x3078('0x30')][_0x3078('0x31')],function(_0x58d4fb){return{'name':_0x58d4fb[_0x3078('0x32')],'type':_0x58d4fb[_0x3078('0x33')]['key']};});_0x1bcb8e[_0x3078('0x34')]=_[_0x3078('0x2f')](_0x4442b2,_0x3078('0x2c'));_0x1bcb8e[_0x3078('0x35')]=_[_0x3078('0x36')](_0x19943e['query']);_0x1bcb8e['filters']=_['intersection'](_0x1bcb8e[_0x3078('0x34')],_0x1bcb8e[_0x3078('0x35')]);_0x52c6dd['attributes']=_[_0x3078('0x37')](_0x1bcb8e['model'],qs[_0x3078('0x38')](_0x19943e[_0x3078('0x35')][_0x3078('0x38')]));_0x52c6dd[_0x3078('0x39')]=_0x52c6dd[_0x3078('0x39')][_0x3078('0x3a')]?_0x52c6dd[_0x3078('0x39')]:_0x1bcb8e[_0x3078('0x34')];if(!_0x19943e[_0x3078('0x35')][_0x3078('0x3b')](_0x3078('0x3c'))){_0x52c6dd['limit']=qs[_0x3078('0x1f')](_0x19943e[_0x3078('0x35')][_0x3078('0x1f')]);_0x52c6dd[_0x3078('0x21')]=qs[_0x3078('0x21')](_0x19943e[_0x3078('0x35')][_0x3078('0x21')]);}_0x52c6dd[_0x3078('0x3d')]=qs[_0x3078('0x3e')](_0x19943e[_0x3078('0x35')][_0x3078('0x3e')]);_0x52c6dd[_0x3078('0x3f')]=qs[_0x3078('0x40')](_[_0x3078('0x41')](_0x19943e[_0x3078('0x35')],_0x1bcb8e[_0x3078('0x40')]),_0x4442b2);if(_0x19943e[_0x3078('0x35')][_0x3078('0x42')]){_0x52c6dd[_0x3078('0x3f')]=_[_0x3078('0x43')](_0x52c6dd[_0x3078('0x3f')],{'$or':_[_0x3078('0x2f')](_0x4442b2,function(_0x3428f5){if(_0x3428f5['type']!==_0x3078('0x44')){var _0xaa9fe2={};_0xaa9fe2[_0x3428f5[_0x3078('0x2c')]]={'$like':'%'+_0x19943e[_0x3078('0x35')]['filter']+'%'};return _0xaa9fe2;}})});}_0x52c6dd=_[_0x3078('0x43')]({},_0x52c6dd,_0x19943e[_0x3078('0x45')]);var _0x2a29a5={'where':_0x52c6dd[_0x3078('0x3f')]};return db['ChatInternalMessage'][_0x3078('0x20')](_0x2a29a5)[_0x3078('0x28')](function(_0x1c0897){_0x202a36[_0x3078('0x20')]=_0x1c0897;if(_0x19943e['query']['includeAll']){_0x52c6dd[_0x3078('0x46')]=[{'all':!![]}];}return db[_0x3078('0x30')][_0x3078('0x47')](_0x52c6dd);})[_0x3078('0x28')](function(_0x303a03){_0x202a36[_0x3078('0x48')]=_0x303a03;return _0x202a36;})['then'](respondWithFilteredResult(_0x3a04e9,_0x52c6dd))[_0x3078('0x49')](handleError(_0x3a04e9,null));};exports[_0x3078('0x4a')]=function(_0x25ac2b,_0x2eeb27){var _0x2b6a46={'raw':!![],'where':{'id':_0x25ac2b[_0x3078('0x4b')]['id']}},_0x138178={};_0x138178[_0x3078('0x34')]=_['keys'](db[_0x3078('0x30')][_0x3078('0x31')]);_0x138178[_0x3078('0x35')]=_[_0x3078('0x36')](_0x25ac2b[_0x3078('0x35')]);_0x138178[_0x3078('0x40')]=_[_0x3078('0x37')](_0x138178[_0x3078('0x34')],_0x138178[_0x3078('0x35')]);_0x2b6a46[_0x3078('0x39')]=_[_0x3078('0x37')](_0x138178['model'],qs[_0x3078('0x38')](_0x25ac2b['query'][_0x3078('0x38')]));_0x2b6a46['attributes']=_0x2b6a46[_0x3078('0x39')][_0x3078('0x3a')]?_0x2b6a46[_0x3078('0x39')]:_0x138178[_0x3078('0x34')];if(_0x25ac2b[_0x3078('0x35')][_0x3078('0x4c')]){_0x2b6a46[_0x3078('0x46')]=[{'all':!![]}];}_0x2b6a46=_[_0x3078('0x43')]({},_0x2b6a46,_0x25ac2b[_0x3078('0x45')]);return db[_0x3078('0x30')]['find'](_0x2b6a46)[_0x3078('0x28')](handleEntityNotFound(_0x2eeb27,null))[_0x3078('0x28')](respondWithResult(_0x2eeb27,null))[_0x3078('0x49')](handleError(_0x2eeb27,null));};exports[_0x3078('0x4d')]=function(_0x35636d,_0x65cf2a){return db[_0x3078('0x30')][_0x3078('0x4d')](_0x35636d[_0x3078('0x4e')],{})[_0x3078('0x28')](respondWithResult(_0x65cf2a,0xc9))[_0x3078('0x49')](handleError(_0x65cf2a,null));};exports[_0x3078('0x27')]=function(_0xb1d79,_0x2ff04c){if(_0xb1d79[_0x3078('0x4e')]['id']){delete _0xb1d79[_0x3078('0x4e')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0xb1d79['params']['id']}})[_0x3078('0x28')](handleEntityNotFound(_0x2ff04c,null))[_0x3078('0x28')](saveUpdates(_0xb1d79[_0x3078('0x4e')],null))['then'](respondWithResult(_0x2ff04c,null))[_0x3078('0x49')](handleError(_0x2ff04c,null));};exports[_0x3078('0x29')]=function(_0x2deb69,_0x47c7c4){return db[_0x3078('0x30')][_0x3078('0x4f')]({'where':{'id':_0x2deb69[_0x3078('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47c7c4,null))['then'](removeEntity(_0x47c7c4,null))[_0x3078('0x49')](handleError(_0x47c7c4,null));};exports[_0x3078('0x50')]=function(_0x3256c0,_0x2e483c){return db[_0x3078('0x30')][_0x3078('0x50')]()[_0x3078('0x28')](respondWithResult(_0x2e483c,null))['catch'](handleError(_0x2e483c,null));};function wrapUser(_0x12cfe1){return function(_0x2d5213){var _0x2e5205=_0x12cfe1['get']({'plain':!![]});_0x2e5205[_0x3078('0x51')]=[];if(_0x2d5213){_0x2e5205['lastMessageAt']=_0x2d5213[_0x3078('0x52')];_0x2e5205['lastMessage']=_0x2d5213;}else{_0x2e5205[_0x3078('0x53')]=moment(0x0)['format'](_0x3078('0x54'));_0x2e5205[_0x3078('0x55')]={};}return _0x2e5205;};}exports[_0x3078('0x56')]=function(_0x7f3bf,_0x46bec6,_0x37818a){var _0x12dc28=[];return db['User']['findAll']({'where':{'role':[_0x3078('0x57'),_0x3078('0x58'),_0x3078('0x59')]},'attributes':['id',_0x3078('0x5a'),_0x3078('0x2c'),_0x3078('0x5b'),'userpic',_0x3078('0x5c'),'online',_0x3078('0x5d'),'allowmessenger',_0x3078('0x5e')],'order':qs[_0x3078('0x3e')](_0x3078('0x5f')),'include':[{'model':db[_0x3078('0x60')],'as':_0x3078('0x61'),'attributes':['id',_0x3078('0x2c'),_0x3078('0x33')],'through':{'attributes':[]}}]})[_0x3078('0x28')](function(_0x1d8ce1){if(_0x1d8ce1){var _0x5c89f7=_0x7f3bf[_0x3078('0x59')][_0x3078('0x62')]({'plain':!![]});if(!_0x5c89f7)throw new Error(_0x3078('0x63'));if(_0x5c89f7['role']===_0x3078('0x59')){return db[_0x3078('0x64')][_0x3078('0x4f')]({'where':{'name':_0x3078('0x65'),'userProfileId':_0x5c89f7[_0x3078('0x66')]},'raw':!![]})[_0x3078('0x28')](function(_0x22e032){if(_0x22e032){if(_0x22e032[_0x3078('0x67')]===0x0){return db[_0x3078('0x68')][_0x3078('0x47')]({'where':{'sectionId':_0x22e032['id']},'raw':!![]})[_0x3078('0x28')](function(_0xbef07f){var _0x35734d=[];if(_['isEmpty'](_0xbef07f)){_0x35734d=_['filter'](_0x1d8ce1,function(_0x1682ad){if(_0x1682ad[_0x3078('0x5b')]!==_0x3078('0x57')){return _0x1682ad;}});return _0x35734d;}else{for(var _0x404c31=0x0;_0x404c31<_0x1d8ce1[_0x3078('0x3a')];_0x404c31++){var _0x3fe74c=_0x1d8ce1[_0x404c31];if(_0x3fe74c[_0x3078('0x5b')]===_0x3078('0x57')){var _0x554223=_[_0x3078('0x4f')](_0xbef07f,function(_0x4260ca){return _0x4260ca[_0x3078('0x69')]===_0x3fe74c['id'];});if(_0x554223)_0x35734d[_0x3078('0x6a')](_0x3fe74c);}else{_0x35734d[_0x3078('0x6a')](_0x3fe74c);}}return _0x35734d;}});}else{return _0x1d8ce1;}}else{var _0x5d7030=_[_0x3078('0x42')](_0x1d8ce1,function(_0x369476){if(_0x369476[_0x3078('0x5b')]!==_0x3078('0x57')){return _0x369476;}});return _0x5d7030;}});}else{return _0x1d8ce1;}}})[_0x3078('0x28')](function(_0x356ab9){var _0x59506e=[];if(_0x356ab9){_0x12dc28=_0x356ab9;for(var _0x3ea1e7=0x0;_0x3ea1e7<_0x356ab9[_0x3078('0x3a')];_0x3ea1e7+=0x1){_0x12dc28[_0x3ea1e7][_0x3078('0x51')]=[];_0x59506e[_0x3078('0x6a')](db[_0x3078('0x30')][_0x3078('0x4f')]({'where':{'FromId':[_0x7f3bf[_0x3078('0x59')]['id'],_0x356ab9[_0x3ea1e7]['id']],'ToId':[_0x7f3bf[_0x3078('0x59')]['id'],_0x356ab9[_0x3ea1e7]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x3078('0x6b'),_0x3078('0x6c'),_0x3078('0x4e')],'order':qs[_0x3078('0x3e')](_0x3078('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3078('0x28')](wrapUser(_0x356ab9[_0x3ea1e7])));}return BPromise[_0x3078('0x6e')](_0x59506e);}return[];})[_0x3078('0x28')](function(_0x315c9d){return{'rows':_0x315c9d,'count':_0x315c9d['length']};})['then'](respondWithResult(_0x46bec6,null))[_0x3078('0x49')](handleError(_0x46bec6,null));};
\ No newline at end of file
diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js
index b90ceed..d3e994c 100644
--- a/server/api/chatInternalMessage/chatInternalMessage.events.js
+++ b/server/api/chatInternalMessage/chatInternalMessage.events.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x4ef9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','save','update','remove'];(function(_0xb305f3,_0x4d9926){var _0x1a418a=function(_0x6b026){while(--_0x6b026){_0xb305f3['push'](_0xb305f3['shift']());}};_0x1a418a(++_0x4d9926);}(_0x4ef9,0x144));var _0x94ef=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x4ef9[_0x57486e];return _0x5f110b;};'use strict';var EventEmitter=require(_0x94ef('0x0'));var ChatInternalMessage=require(_0x94ef('0x1'))['db'][_0x94ef('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x94ef('0x3'),'afterUpdate':_0x94ef('0x4'),'afterDestroy':_0x94ef('0x5')};function emitEvent(_0x53eae1){return function(_0x1a8030,_0x2cb58e,_0x4b2398){ChatInternalMessageEvents[_0x94ef('0x6')](_0x53eae1+':'+_0x1a8030['id'],_0x1a8030);ChatInternalMessageEvents[_0x94ef('0x6')](_0x53eae1,_0x1a8030);_0x4b2398(null);};}for(var e in events){if(events[_0x94ef('0x7')](e)){var event=events[e];ChatInternalMessage[_0x94ef('0x8')](e,emitEvent(event));}}module[_0x94ef('0x9')]=ChatInternalMessageEvents;
\ No newline at end of file
+var _0x076b=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','hook'];(function(_0x5902a0,_0x5bc8f6){var _0x3d3022=function(_0x4adcd0){while(--_0x4adcd0){_0x5902a0['push'](_0x5902a0['shift']());}};_0x3d3022(++_0x5bc8f6);}(_0x076b,0x1c1));var _0xb076=function(_0x5e207d,_0xe1b62a){_0x5e207d=_0x5e207d-0x0;var _0x263d1a=_0x076b[_0x5e207d];return _0x263d1a;};'use strict';var EventEmitter=require(_0xb076('0x0'));var ChatInternalMessage=require(_0xb076('0x1'))['db'][_0xb076('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb076('0x3')](0x0);var events={'afterCreate':_0xb076('0x4'),'afterUpdate':_0xb076('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5da5dd){return function(_0x1817f6,_0x3168a5,_0x3d872a){ChatInternalMessageEvents['emit'](_0x5da5dd+':'+_0x1817f6['id'],_0x1817f6);ChatInternalMessageEvents['emit'](_0x5da5dd,_0x1817f6);_0x3d872a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xb076('0x6')](e,emitEvent(event));}}module[_0xb076('0x7')]=ChatInternalMessageEvents;
\ No newline at end of file
diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js
index 5aec1d4..216fe19 100644
--- a/server/api/chatInternalMessage/chatInternalMessage.model.js
+++ b/server/api/chatInternalMessage/chatInternalMessage.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xf826=['utf8mb4','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage'];(function(_0x574d9b,_0x2063da){var _0x31d2a5=function(_0x97ce4c){while(--_0x97ce4c){_0x574d9b['push'](_0x574d9b['shift']());}};_0x31d2a5(++_0x2063da);}(_0xf826,0x1c3));var _0x6f82=function(_0x45a230,_0x4823ad){_0x45a230=_0x45a230-0x0;var _0x41779d=_0xf826[_0x45a230];return _0x41779d;};'use strict';var _=require(_0x6f82('0x0'));var util=require(_0x6f82('0x1'));var logger=require(_0x6f82('0x2'))('api');var moment=require(_0x6f82('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f82('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f82('0x5'));var attributes=require(_0x6f82('0x6'));module[_0x6f82('0x7')]=function(_0x5c699b,_0x2b8d2e){return _0x5c699b['define'](_0x6f82('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f82('0x9'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x0984=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash'];(function(_0x6a91d0,_0x208f52){var _0x1abb82=function(_0x3bfb53){while(--_0x3bfb53){_0x6a91d0['push'](_0x6a91d0['shift']());}};_0x1abb82(++_0x208f52);}(_0x0984,0x6d));var _0x4098=function(_0xa22606,_0x497098){_0xa22606=_0xa22606-0x0;var _0x5252d2=_0x0984[_0xa22606];return _0x5252d2;};'use strict';var _=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var logger=require(_0x4098('0x2'))(_0x4098('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4098('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4098('0x5'));var config=require(_0x4098('0x6'));var attributes=require(_0x4098('0x7'));module['exports']=function(_0x58814f,_0x47aa57){return _0x58814f['define'](_0x4098('0x8'),attributes,{'tableName':_0x4098('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4098('0xa')});};
\ No newline at end of file
diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js
index 6da7ce8..7113374 100644
--- a/server/api/chatInternalMessage/chatInternalMessage.rpc.js
+++ b/server/api/chatInternalMessage/chatInternalMessage.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x1d44=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x8d69f4,_0x1c3f4b){var _0x5a3daa=function(_0x59e86d){while(--_0x59e86d){_0x8d69f4['push'](_0x8d69f4['shift']());}};_0x5a3daa(++_0x1c3f4b);}(_0x1d44,0xad));var _0x41d4=function(_0x3ebb04,_0x1a63a6){_0x3ebb04=_0x3ebb04-0x0;var _0x535db0=_0x1d44[_0x3ebb04];return _0x535db0;};'use strict';var _=require(_0x41d4('0x0'));var util=require(_0x41d4('0x1'));var moment=require(_0x41d4('0x2'));var BPromise=require(_0x41d4('0x3'));var rs=require(_0x41d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41d4('0x5'))['db'];var utils=require(_0x41d4('0x6'));var logger=require('../../config/logger')(_0x41d4('0x7'));var config=require(_0x41d4('0x8'));var jayson=require(_0x41d4('0x9'));var client=jayson[_0x41d4('0xa')][_0x41d4('0xb')]({'port':0x232a});config[_0x41d4('0xc')]=_[_0x41d4('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x41d4('0xe'))(new Redis(config['redis']));require(_0x41d4('0xf'))[_0x41d4('0x10')](socket);function respondWithRpcPromise(_0x99b8c4,_0x1b059f,_0x483fe1){return new BPromise(function(_0x4578ed,_0x21c6fe){return client[_0x41d4('0x11')](_0x99b8c4,_0x483fe1)[_0x41d4('0x12')](function(_0x2781ad){logger[_0x41d4('0x13')](_0x41d4('0x14'),_0x1b059f,_0x41d4('0x15'));logger[_0x41d4('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1b059f,_0x41d4('0x15'),JSON[_0x41d4('0x17')](_0x2781ad));if(_0x2781ad[_0x41d4('0x18')]){if(_0x2781ad['error']['code']===0x1f4){logger['error'](_0x41d4('0x14'),_0x1b059f,_0x2781ad[_0x41d4('0x18')][_0x41d4('0x19')]);return _0x21c6fe(_0x2781ad[_0x41d4('0x18')][_0x41d4('0x19')]);}logger[_0x41d4('0x18')](_0x41d4('0x14'),_0x1b059f,_0x2781ad[_0x41d4('0x18')][_0x41d4('0x19')]);return _0x4578ed(_0x2781ad['error'][_0x41d4('0x19')]);}else{logger[_0x41d4('0x13')](_0x41d4('0x14'),_0x1b059f,_0x41d4('0x15'));_0x4578ed(_0x2781ad[_0x41d4('0x1a')]['message']);}})[_0x41d4('0x1b')](function(_0x339310){logger[_0x41d4('0x18')](_0x41d4('0x14'),_0x1b059f,_0x339310);_0x21c6fe(_0x339310);});});}
\ No newline at end of file
+var _0xf8b5=['info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x4441b1,_0x17bf98){var _0x3d510f=function(_0x2eed93){while(--_0x2eed93){_0x4441b1['push'](_0x4441b1['shift']());}};_0x3d510f(++_0x17bf98);}(_0xf8b5,0x1c4));var _0x5f8b=function(_0xf970f0,_0x3360b6){_0xf970f0=_0xf970f0-0x0;var _0xd1f8aa=_0xf8b5[_0xf970f0];return _0xd1f8aa;};'use strict';var _=require(_0x5f8b('0x0'));var util=require(_0x5f8b('0x1'));var moment=require('moment');var BPromise=require(_0x5f8b('0x2'));var rs=require(_0x5f8b('0x3'));var fs=require('fs');var Redis=require(_0x5f8b('0x4'));var db=require(_0x5f8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f8b('0x6'))(_0x5f8b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f8b('0x8'));var client=jayson[_0x5f8b('0x9')]['http']({'port':0x232a});config[_0x5f8b('0xa')]=_['defaults'](config[_0x5f8b('0xa')],{'host':_0x5f8b('0xb'),'port':0x18eb});var socket=require(_0x5f8b('0xc'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5f8b('0xd')](socket);function respondWithRpcPromise(_0x2460bf,_0x353d6e,_0x2aecbc){return new BPromise(function(_0x4e67ba,_0x50a623){return client[_0x5f8b('0xe')](_0x2460bf,_0x2aecbc)[_0x5f8b('0xf')](function(_0x558812){logger[_0x5f8b('0x10')](_0x5f8b('0x11'),_0x353d6e,'request\x20sent');logger['debug'](_0x5f8b('0x12'),_0x353d6e,_0x5f8b('0x13'),JSON[_0x5f8b('0x14')](_0x558812));if(_0x558812[_0x5f8b('0x15')]){if(_0x558812['error'][_0x5f8b('0x16')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x353d6e,_0x558812[_0x5f8b('0x15')][_0x5f8b('0x17')]);return _0x50a623(_0x558812[_0x5f8b('0x15')][_0x5f8b('0x17')]);}logger[_0x5f8b('0x15')](_0x5f8b('0x11'),_0x353d6e,_0x558812['error'][_0x5f8b('0x17')]);return _0x4e67ba(_0x558812[_0x5f8b('0x15')][_0x5f8b('0x17')]);}else{logger['info'](_0x5f8b('0x11'),_0x353d6e,_0x5f8b('0x13'));_0x4e67ba(_0x558812[_0x5f8b('0x18')][_0x5f8b('0x17')]);}})[_0x5f8b('0x19')](function(_0x11b58a){logger[_0x5f8b('0x15')](_0x5f8b('0x11'),_0x353d6e,_0x11b58a);_0x50a623(_0x11b58a);});});}
\ No newline at end of file
diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js
index a8af9fa..0dda5b0 100644
--- a/server/api/chatInternalMessage/chatInternalMessage.socket.js
+++ b/server/api/chatInternalMessage/chatInternalMessage.socket.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x15db=['update','removeListener','length','./chatInternalMessage.events','save','remove'];(function(_0x32ad36,_0x5c18c0){var _0x1972e3=function(_0x9ba9f0){while(--_0x9ba9f0){_0x32ad36['push'](_0x32ad36['shift']());}};_0x1972e3(++_0x5c18c0);}(_0x15db,0xf9));var _0xb15d=function(_0x4a76d7,_0x1dc4ed){_0x4a76d7=_0x4a76d7-0x0;var _0x368d2b=_0x15db[_0x4a76d7];return _0x368d2b;};'use strict';var ChatInternalMessageEvents=require(_0xb15d('0x0'));var events=[_0xb15d('0x1'),_0xb15d('0x2'),_0xb15d('0x3')];function createListener(_0x2550ad,_0x17b750){return function(_0x4a7538){_0x17b750['emit'](_0x2550ad,_0x4a7538);};}function removeListener(_0x59b9aa,_0x494bcc){return function(){ChatInternalMessageEvents[_0xb15d('0x4')](_0x59b9aa,_0x494bcc);};}exports['register']=function(_0x1b44d6){for(var _0x10f944=0x0,_0x5255f=events[_0xb15d('0x5')];_0x10f944<_0x5255f;_0x10f944++){var _0x82c188=events[_0x10f944];var _0x337e06=createListener('chatInternalMessage:'+_0x82c188,_0x1b44d6);ChatInternalMessageEvents['on'](_0x82c188,_0x337e06);}};
\ No newline at end of file
+var _0x9707=['./chatInternalMessage.events','save','update','emit','removeListener','length','chatInternalMessage:'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9707,0xbd));var _0x7970=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9707[_0x122ef9];return _0x42fba0;};'use strict';var ChatInternalMessageEvents=require(_0x7970('0x0'));var events=[_0x7970('0x1'),'remove',_0x7970('0x2')];function createListener(_0x31b202,_0x1a1fd1){return function(_0x45953d){_0x1a1fd1[_0x7970('0x3')](_0x31b202,_0x45953d);};}function removeListener(_0x22e828,_0x357285){return function(){ChatInternalMessageEvents[_0x7970('0x4')](_0x22e828,_0x357285);};}exports['register']=function(_0xa33d8e){for(var _0x12c4d9=0x0,_0x2c6b6d=events[_0x7970('0x5')];_0x12c4d9<_0x2c6b6d;_0x12c4d9++){var _0x520375=events[_0x12c4d9];var _0x19e8da=createListener(_0x7970('0x6')+_0x520375,_0xa33d8e);ChatInternalMessageEvents['on'](_0x520375,_0x19e8da);}};
\ No newline at end of file
diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js
index bc80af6..5654453 100644
--- a/server/api/chatInternalMessage/index.js
+++ b/server/api/chatInternalMessage/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc98f=['update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/users','/:id','show','post','create','put'];(function(_0x2384a2,_0x1effc5){var _0x28e214=function(_0x5dea58){while(--_0x5dea58){_0x2384a2['push'](_0x2384a2['shift']());}};_0x28e214(++_0x1effc5);}(_0xc98f,0x1a5));var _0xfc98=function(_0x33b856,_0x2035d1){_0x33b856=_0x33b856-0x0;var _0x29481e=_0xc98f[_0x33b856];return _0x29481e;};'use strict';var multer=require(_0xfc98('0x0'));var util=require('util');var path=require(_0xfc98('0x1'));var timeout=require(_0xfc98('0x2'));var express=require(_0xfc98('0x3'));var router=express[_0xfc98('0x4')]();var fs_extra=require(_0xfc98('0x5'));var auth=require(_0xfc98('0x6'));var interaction=require(_0xfc98('0x7'));var config=require(_0xfc98('0x8'));var controller=require('./chatInternalMessage.controller');router[_0xfc98('0x9')]('/',auth[_0xfc98('0xa')](),controller[_0xfc98('0xb')]);router['get']('/describe',auth[_0xfc98('0xa')](),controller[_0xfc98('0xc')]);router[_0xfc98('0x9')](_0xfc98('0xd'),auth[_0xfc98('0xa')](),controller['getUsers']);router[_0xfc98('0x9')](_0xfc98('0xe'),auth[_0xfc98('0xa')](),controller[_0xfc98('0xf')]);router[_0xfc98('0x10')]('/',auth[_0xfc98('0xa')](),controller[_0xfc98('0x11')]);router[_0xfc98('0x12')]('/:id',controller[_0xfc98('0x13')]);router[_0xfc98('0x14')]('/:id',auth[_0xfc98('0xa')](),controller['destroy']);module[_0xfc98('0x15')]=router;
\ No newline at end of file
+var _0xc0c2=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','/:id'];(function(_0x2065f7,_0x2f3111){var _0xdbb6fe=function(_0x53e4a9){while(--_0x53e4a9){_0x2065f7['push'](_0x2065f7['shift']());}};_0xdbb6fe(++_0x2f3111);}(_0xc0c2,0x74));var _0x2c0c=function(_0x2e3ebb,_0x5afc59){_0x2e3ebb=_0x2e3ebb-0x0;var _0x8f027f=_0xc0c2[_0x2e3ebb];return _0x8f027f;};'use strict';var multer=require('multer');var util=require(_0x2c0c('0x0'));var path=require(_0x2c0c('0x1'));var timeout=require(_0x2c0c('0x2'));var express=require(_0x2c0c('0x3'));var router=express[_0x2c0c('0x4')]();var fs_extra=require(_0x2c0c('0x5'));var auth=require(_0x2c0c('0x6'));var interaction=require(_0x2c0c('0x7'));var config=require(_0x2c0c('0x8'));var controller=require(_0x2c0c('0x9'));router[_0x2c0c('0xa')]('/',auth[_0x2c0c('0xb')](),controller['index']);router[_0x2c0c('0xa')](_0x2c0c('0xc'),auth[_0x2c0c('0xb')](),controller[_0x2c0c('0xd')]);router['get']('/users',auth[_0x2c0c('0xb')](),controller[_0x2c0c('0xe')]);router['get'](_0x2c0c('0xf'),auth[_0x2c0c('0xb')](),controller['show']);router['post']('/',auth[_0x2c0c('0xb')](),controller[_0x2c0c('0x10')]);router[_0x2c0c('0x11')](_0x2c0c('0xf'),controller[_0x2c0c('0x12')]);router[_0x2c0c('0x13')]('/:id',auth[_0x2c0c('0xb')](),controller[_0x2c0c('0x14')]);module[_0x2c0c('0x15')]=router;
\ No newline at end of file
diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js
index e42b32a..b6e879e 100644
--- a/server/api/chatMessage/chatMessage.attributes.js
+++ b/server/api/chatMessage/chatMessage.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x8eba=['exports','BOOLEAN','ENUM','out','STRING','TEXT','sequelize'];(function(_0x3c05f8,_0x21a4ef){var _0x21d5e3=function(_0x40a07c){while(--_0x40a07c){_0x3c05f8['push'](_0x3c05f8['shift']());}};_0x21d5e3(++_0x21a4ef);}(_0x8eba,0xc3));var _0xa8eb=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x8eba[_0x1f7201];return _0x289fd2;};'use strict';var Sequelize=require(_0xa8eb('0x0'));module[_0xa8eb('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa8eb('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8eb('0x3')]('in',_0xa8eb('0x4')),'defaultValue':_0xa8eb('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa8eb('0x5')]},'providerResponse':{'type':Sequelize[_0xa8eb('0x6')]}};
\ No newline at end of file
+var _0xdd6e=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xdd6e,0xa5));var _0xedd6=function(_0x85dc6e,_0x4c0f9b){_0x85dc6e=_0x85dc6e-0x0;var _0x160547=_0xdd6e[_0x85dc6e];return _0x160547;};'use strict';var Sequelize=require(_0xedd6('0x0'));module[_0xedd6('0x1')]={'body':{'type':Sequelize[_0xedd6('0x2')](_0xedd6('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xedd6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xedd6('0x5')]('in',_0xedd6('0x6')),'defaultValue':_0xedd6('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js
index 2af49b0..6076999 100644
--- a/server/api/chatMessage/chatMessage.controller.js
+++ b/server/api/chatMessage/chatMessage.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x9a4a=['fullname','email','internal','interface','SIP/%s','motionChannel','channel','EventManager','acceptmessage','parse','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','event','rejectmessage','formData','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User'];(function(_0x560389,_0x2e440a){var _0x217c99=function(_0x123845){while(--_0x123845){_0x560389['push'](_0x560389['shift']());}};_0x217c99(++_0x2e440a);}(_0x9a4a,0x18f));var _0xa9a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a4a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa9a4('0x0'));var rimraf=require(_0xa9a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9a4('0x2'));var rp=require('request-promise');var moment=require(_0xa9a4('0x3'));var BPromise=require(_0xa9a4('0x4'));var Mustache=require('mustache');var util=require(_0xa9a4('0x5'));var path=require('path');var sox=require(_0xa9a4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9a4('0x7'));var squel=require(_0xa9a4('0x8'));var crypto=require(_0xa9a4('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa9a4('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9a4('0xb'));var authService=require(_0xa9a4('0xc'));var qs=require(_0xa9a4('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9a4('0xe'))(_0xa9a4('0xf'));var utils=require('../../config/utils');var config=require(_0xa9a4('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9a4('0x11'))['db'];config[_0xa9a4('0x12')]=_[_0xa9a4('0x13')](config[_0xa9a4('0x12')],{'host':_0xa9a4('0x14'),'port':0x18eb});var socket=require(_0xa9a4('0x15'))(new Redis(config[_0xa9a4('0x12')]));require(_0xa9a4('0x16'))[_0xa9a4('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xa9a4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x44b292,_0x36f1fb,_0x27f565,_0x481757){return new BPromise(function(_0x3dd817,_0x351383){var _0x5a9d9e=_0x481757||client;return _0x5a9d9e[_0xa9a4('0x19')](_0x44b292,_0x27f565)[_0xa9a4('0x1a')](function(_0x2822a5){logger[_0xa9a4('0x1b')](_0xa9a4('0x1c'),_0x36f1fb,_0xa9a4('0x1d'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x36f1fb,_0xa9a4('0x1d'),JSON[_0xa9a4('0x1e')](_0x2822a5));if(_0x2822a5['error']){if(_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x20')]===0x1f4){logger[_0xa9a4('0x1f')](_0xa9a4('0x1c'),_0x36f1fb,_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x21')]);return _0x351383(_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x21')]);}logger[_0xa9a4('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x36f1fb,_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x21')]);return _0x3dd817(_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x21')]);}else{logger['info'](_0xa9a4('0x1c'),_0x36f1fb,_0xa9a4('0x1d'));_0x3dd817(_0x2822a5[_0xa9a4('0x22')][_0xa9a4('0x21')]);}})['catch'](function(_0x4173cd){logger[_0xa9a4('0x1f')](_0xa9a4('0x1c'),_0x36f1fb,_0x4173cd);_0x351383(_0x4173cd);});});}function respondWithStatusCode(_0x1f8369,_0x1a2c14){_0x1a2c14=_0x1a2c14||0xcc;return function(_0x44e910){if(_0x44e910){return _0x1f8369[_0xa9a4('0x23')](_0x1a2c14);}return _0x1f8369[_0xa9a4('0x24')](_0x1a2c14)['end']();};}function respondWithResult(_0x4c63f3,_0x103678){_0x103678=_0x103678||0xc8;return function(_0x78b145){if(_0x78b145){return _0x4c63f3[_0xa9a4('0x24')](_0x103678)[_0xa9a4('0x25')](_0x78b145);}};}function respondWithFilteredResult(_0x297104,_0x54e60d){return function(_0x567f45){if(_0x567f45){var _0x5634a9=typeof _0x54e60d[_0xa9a4('0x26')]===_0xa9a4('0x27')&&typeof _0x54e60d[_0xa9a4('0x28')]===_0xa9a4('0x27');var _0x599bcc=_0x567f45[_0xa9a4('0x29')];var _0x1b461e=_0x5634a9?0x0:_0x54e60d['offset'];var _0x92192e=_0x5634a9?_0x567f45['count']:_0x54e60d[_0xa9a4('0x26')]+_0x54e60d['limit'];var _0x96a00b;if(_0x92192e>=_0x599bcc){_0x92192e=_0x599bcc;_0x96a00b=0xc8;}else{_0x96a00b=0xce;}_0x297104[_0xa9a4('0x24')](_0x96a00b);return _0x297104[_0xa9a4('0x2a')](_0xa9a4('0x2b'),_0x1b461e+'-'+_0x92192e+'/'+_0x599bcc)['json'](_0x567f45);}return null;};}function patchUpdates(_0x2c0c8b){return function(_0x4ea02b){try{jsonpatch[_0xa9a4('0x2c')](_0x4ea02b,_0x2c0c8b,!![]);}catch(_0x45214b){return BPromise[_0xa9a4('0x2d')](_0x45214b);}return _0x4ea02b[_0xa9a4('0x2e')]();};}function saveUpdates(_0x1fd523,_0x154eff){return function(_0xac9678){if(_0xac9678){return _0xac9678[_0xa9a4('0x2f')](_0x1fd523)['then'](function(_0x4ca8a5){return _0x4ca8a5;});}return null;};}function removeEntity(_0xc7c7d1,_0x79692b){return function(_0x35a2f7){if(_0x35a2f7){return _0x35a2f7[_0xa9a4('0x30')]()[_0xa9a4('0x1a')](function(){_0xc7c7d1['status'](0xcc)[_0xa9a4('0x31')]();});}};}function handleEntityNotFound(_0x53b5d1,_0x3966f9){return function(_0x668d76){if(!_0x668d76){_0x53b5d1[_0xa9a4('0x23')](0x194);}return _0x668d76;};}function handleError(_0x2b15fb,_0x25ccc6){_0x25ccc6=_0x25ccc6||0x1f4;return function(_0x5e43c9){logger[_0xa9a4('0x1f')](_0x5e43c9[_0xa9a4('0x32')]);if(_0x5e43c9[_0xa9a4('0x33')]){delete _0x5e43c9[_0xa9a4('0x33')];}_0x2b15fb[_0xa9a4('0x24')](_0x25ccc6)[_0xa9a4('0x34')](_0x5e43c9);};}exports[_0xa9a4('0x35')]=function(_0x250da5,_0x151bb8){var _0x39610={},_0x165d82={},_0xdd581d={'count':0x0,'rows':[]};var _0x1a5a12=_[_0xa9a4('0x36')](db[_0xa9a4('0x37')][_0xa9a4('0x38')],function(_0x16569e){return{'name':_0x16569e['fieldName'],'type':_0x16569e[_0xa9a4('0x39')][_0xa9a4('0x3a')]};});_0x165d82['model']=_[_0xa9a4('0x36')](_0x1a5a12,_0xa9a4('0x33'));_0x165d82[_0xa9a4('0x3b')]=_[_0xa9a4('0x3c')](_0x250da5[_0xa9a4('0x3b')]);_0x165d82['filters']=_[_0xa9a4('0x3d')](_0x165d82[_0xa9a4('0x3e')],_0x165d82[_0xa9a4('0x3b')]);_0x39610['attributes']=_[_0xa9a4('0x3d')](_0x165d82['model'],qs['fields'](_0x250da5[_0xa9a4('0x3b')][_0xa9a4('0x3f')]));_0x39610['attributes']=_0x39610[_0xa9a4('0x40')][_0xa9a4('0x41')]?_0x39610[_0xa9a4('0x40')]:_0x165d82[_0xa9a4('0x3e')];if(!_0x250da5[_0xa9a4('0x3b')]['hasOwnProperty'](_0xa9a4('0x42'))){_0x39610[_0xa9a4('0x28')]=qs[_0xa9a4('0x28')](_0x250da5['query']['limit']);_0x39610[_0xa9a4('0x26')]=qs[_0xa9a4('0x26')](_0x250da5['query'][_0xa9a4('0x26')]);}_0x39610[_0xa9a4('0x43')]=qs[_0xa9a4('0x44')](_0x250da5[_0xa9a4('0x3b')][_0xa9a4('0x44')]);_0x39610[_0xa9a4('0x45')]=qs[_0xa9a4('0x46')](_['pick'](_0x250da5[_0xa9a4('0x3b')],_0x165d82[_0xa9a4('0x46')]),_0x1a5a12);if(_0x250da5[_0xa9a4('0x3b')][_0xa9a4('0x47')]){_0x39610[_0xa9a4('0x45')]=_[_0xa9a4('0x48')](_0x39610[_0xa9a4('0x45')],{'$or':_['map'](_0x1a5a12,function(_0x5b0c3e){if(_0x5b0c3e['type']!=='VIRTUAL'){var _0x33f4d3={};_0x33f4d3[_0x5b0c3e[_0xa9a4('0x33')]]={'$like':'%'+_0x250da5[_0xa9a4('0x3b')][_0xa9a4('0x47')]+'%'};return _0x33f4d3;}})});}_0x39610=_[_0xa9a4('0x48')]({},_0x39610,_0x250da5[_0xa9a4('0x49')]);var _0xb03670={'where':_0x39610['where']};return db['ChatMessage'][_0xa9a4('0x29')](_0xb03670)[_0xa9a4('0x1a')](function(_0x32df48){_0xdd581d[_0xa9a4('0x29')]=_0x32df48;if(_0x250da5[_0xa9a4('0x3b')]['includeAll']){_0x39610[_0xa9a4('0x4a')]=[{'all':!![]}];}return db[_0xa9a4('0x37')][_0xa9a4('0x4b')](_0x39610);})['then'](function(_0x4c41ef){_0xdd581d[_0xa9a4('0x4c')]=_0x4c41ef;return _0xdd581d;})[_0xa9a4('0x1a')](respondWithFilteredResult(_0x151bb8,_0x39610))[_0xa9a4('0x4d')](handleError(_0x151bb8,null));};exports[_0xa9a4('0x4e')]=function(_0xb47060,_0x463236){var _0x2c2965={'raw':!![],'where':{'id':_0xb47060[_0xa9a4('0x4f')]['id']}},_0x95a8da={};_0x95a8da[_0xa9a4('0x3e')]=_[_0xa9a4('0x3c')](db[_0xa9a4('0x37')]['rawAttributes']);_0x95a8da[_0xa9a4('0x3b')]=_['keys'](_0xb47060[_0xa9a4('0x3b')]);_0x95a8da['filters']=_[_0xa9a4('0x3d')](_0x95a8da[_0xa9a4('0x3e')],_0x95a8da[_0xa9a4('0x3b')]);_0x2c2965['attributes']=_[_0xa9a4('0x3d')](_0x95a8da['model'],qs['fields'](_0xb47060[_0xa9a4('0x3b')][_0xa9a4('0x3f')]));_0x2c2965[_0xa9a4('0x40')]=_0x2c2965[_0xa9a4('0x40')][_0xa9a4('0x41')]?_0x2c2965[_0xa9a4('0x40')]:_0x95a8da[_0xa9a4('0x3e')];if(_0xb47060[_0xa9a4('0x3b')]['includeAll']){_0x2c2965['include']=[{'all':!![]}];}_0x2c2965=_[_0xa9a4('0x48')]({},_0x2c2965,_0xb47060[_0xa9a4('0x49')]);return db['ChatMessage'][_0xa9a4('0x50')](_0x2c2965)[_0xa9a4('0x1a')](handleEntityNotFound(_0x463236,null))[_0xa9a4('0x1a')](respondWithResult(_0x463236,null))[_0xa9a4('0x4d')](handleError(_0x463236,null));};exports[_0xa9a4('0x51')]=function(_0x2448bf,_0x44a819){return db['ChatMessage'][_0xa9a4('0x51')](_0x2448bf[_0xa9a4('0x52')],{})[_0xa9a4('0x1a')](respondWithResult(_0x44a819,0xc9))[_0xa9a4('0x4d')](handleError(_0x44a819,null));};exports['update']=function(_0x404ed9,_0x266411){if(_0x404ed9['body']['id']){delete _0x404ed9[_0xa9a4('0x52')]['id'];}return db['ChatMessage'][_0xa9a4('0x50')]({'where':{'id':_0x404ed9[_0xa9a4('0x4f')]['id']}})[_0xa9a4('0x1a')](handleEntityNotFound(_0x266411,null))[_0xa9a4('0x1a')](saveUpdates(_0x404ed9[_0xa9a4('0x52')],null))[_0xa9a4('0x1a')](respondWithResult(_0x266411,null))[_0xa9a4('0x4d')](handleError(_0x266411,null));};exports[_0xa9a4('0x30')]=function(_0x2dc8c8,_0x5c1cef){return db[_0xa9a4('0x37')]['find']({'where':{'id':_0x2dc8c8['params']['id']}})[_0xa9a4('0x1a')](handleEntityNotFound(_0x5c1cef,null))[_0xa9a4('0x1a')](removeEntity(_0x5c1cef,null))['catch'](handleError(_0x5c1cef,null));};exports[_0xa9a4('0x53')]=function(_0x40e084,_0x43428d){return db[_0xa9a4('0x37')]['describe']()[_0xa9a4('0x1a')](respondWithResult(_0x43428d,null))[_0xa9a4('0x4d')](handleError(_0x43428d,null));};var interaction_log=require('../../config/logger')(_0xa9a4('0x54'));exports[_0xa9a4('0x55')]=function(_0x33e46c,_0x45188d,_0x392323){var _0x3551dc={'agent':{},'channel':_0xa9a4('0x56')};if(_0x33e46c[_0xa9a4('0x52')]['id']){delete _0x33e46c['body']['id'];}_0x33e46c['body'][_0xa9a4('0x57')]=!![];_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x58')]=moment()[_0xa9a4('0x59')](_0xa9a4('0x5a'));_0x33e46c['body']['UserId']=_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x5b')]||_0x33e46c[_0xa9a4('0x5c')]['id'];_0x3551dc['agent']['id']=_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x5b')];return db[_0xa9a4('0x37')]['find']({'where':{'id':_0x33e46c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x45188d,null))['then'](saveUpdates(_0x33e46c[_0xa9a4('0x52')],null))[_0xa9a4('0x1a')](function(_0x3f0021){if(_0x3f0021){_0x3551dc[_0xa9a4('0x21')]=_0x3f0021[_0xa9a4('0x5d')]({'plain':!![]});return db['ChatInteraction'][_0xa9a4('0x50')]({'where':{'id':_0x3f0021[_0xa9a4('0x5e')]}});}return null;})[_0xa9a4('0x1a')](handleEntityNotFound(_0x45188d,null))['then'](function(_0x53fa74){if(_0x53fa74){return _0x53fa74[_0xa9a4('0x2f')]({'UserId':_0x33e46c['body']['UserId'],'read1stAt':_[_0xa9a4('0x5f')](_0x53fa74['read1stAt'])?moment()[_0xa9a4('0x59')](_0xa9a4('0x5a')):undefined});}return null;})['then'](function(_0x26fa79){if(_0x26fa79){_0x3551dc[_0xa9a4('0x60')]=_0x26fa79['get']({'plain':!![]});interaction_log['info'](_0xa9a4('0x61'),_0x33e46c[_0xa9a4('0x5c')]['id'],_0x33e46c[_0xa9a4('0x5c')][_0xa9a4('0x33')],_0x33e46c['user']['role'],_0x3551dc[_0xa9a4('0x60')]['id'],_0x33e46c[_0xa9a4('0x52')]?JSON[_0xa9a4('0x1e')](_0x33e46c[_0xa9a4('0x52')]):_0xa9a4('0x62'));return respondWithRpcPromise(_0xa9a4('0x63'),_0xa9a4('0x64'),_0x3551dc);}return null;})[_0xa9a4('0x1a')](function(_0x11088f){var _0x2593e8=_0xa9a4('0x65')+_0x11088f['message'][_0xa9a4('0x66')];return db[_0xa9a4('0x67')][_0xa9a4('0x3b')](_0x2593e8,{'type':db[_0xa9a4('0x68')][_0xa9a4('0x69')][_0xa9a4('0x6a')],'raw':!![]})['then'](function(_0x56a47d){return _0x56a47d;});})[_0xa9a4('0x1a')](function(_0x3497c8){if(_0x3497c8){_0x3551dc[_0xa9a4('0x21')][_0xa9a4('0x6b')]=_0x3497c8[0x0];if(!_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x5b')])return;return db[_0xa9a4('0x6c')][_0xa9a4('0x50')]({'where':{'id':_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x5b')],'role':'agent'},'attributes':['id',_0xa9a4('0x33'),_0xa9a4('0x6d'),_0xa9a4('0x6e'),_0xa9a4('0x6f')],'raw':!![]});}return null;})['then'](function(_0x45a9e0){if(!_0x45a9e0)return null;_0x3551dc['message']['agent']=_0x45a9e0;return _0x3551dc;})['then'](function(_0x340072){if(_0x340072){if(_0x33e46c[_0xa9a4('0x52')]['manual']){_0x3551dc[_0xa9a4('0x21')][_0xa9a4('0x70')]=util[_0xa9a4('0x59')](_0xa9a4('0x71'),_0x33e46c[_0xa9a4('0x5c')]['name']);_0x3551dc[_0xa9a4('0x21')]['channel']=_0x3551dc['channel'];_0x3551dc[_0xa9a4('0x21')][_0xa9a4('0x72')]=_0x3551dc[_0xa9a4('0x73')];_0x3551dc[_0xa9a4('0x21')]['event']=_0xa9a4('0x55');return respondWithRpcPromise(_0xa9a4('0x74'),_0xa9a4('0x74'),{'event':_0xa9a4('0x75'),'message':_[_0xa9a4('0x48')](_0x3551dc[_0xa9a4('0x21')],JSON[_0xa9a4('0x76')](_0x3551dc[_0xa9a4('0x60')]['formData']))},client9002)[_0xa9a4('0x1a')](function(){return _0x3551dc;});}return _0x3551dc;}return null;})[_0xa9a4('0x1a')](respondWithResult(_0x45188d,null))[_0xa9a4('0x4d')](handleError(_0x45188d,null));};var interaction_log=require(_0xa9a4('0xe'))(_0xa9a4('0x54'));exports[_0xa9a4('0x2d')]=function(_0x540b8d,_0x5395c9,_0x52bb91){var _0x5c4d43={'agent':{},'channel':_0xa9a4('0x56')};if(_0x540b8d[_0xa9a4('0x52')]['id']){delete _0x540b8d['body']['id'];}_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')]=_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')]||_0x540b8d[_0xa9a4('0x5c')]['id'];_0x5c4d43[_0xa9a4('0x77')]['id']=_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')];return db[_0xa9a4('0x37')][_0xa9a4('0x50')]({'where':{'id':_0x540b8d['params']['id'],'UserId':null}})[_0xa9a4('0x1a')](handleEntityNotFound(_0x5395c9,null))[_0xa9a4('0x1a')](function(_0x7b2891){if(_0x7b2891){_0x5c4d43['message']=_0x7b2891[_0xa9a4('0x5d')]({'plain':!![]});return db['ChatInteraction'][_0xa9a4('0x50')]({'where':{'id':_0x7b2891[_0xa9a4('0x5e')]}});}return null;})[_0xa9a4('0x1a')](handleEntityNotFound(_0x5395c9,null))[_0xa9a4('0x1a')](function(_0x57fb9f){if(_0x57fb9f){_0x5c4d43[_0xa9a4('0x60')]=_0x57fb9f['get']({'plain':!![]});interaction_log[_0xa9a4('0x1b')](_0xa9a4('0x78'),_0x540b8d[_0xa9a4('0x5c')]['id'],_0x540b8d['user'][_0xa9a4('0x33')],_0x540b8d['user'][_0xa9a4('0x79')],_0x5c4d43['interaction']['id'],_0x540b8d[_0xa9a4('0x52')]?JSON[_0xa9a4('0x1e')](_0x540b8d[_0xa9a4('0x52')]):_0xa9a4('0x62'));return respondWithRpcPromise(_0xa9a4('0x7a'),_0xa9a4('0x7b'),_0x5c4d43);}return null;})['then'](function(_0x168fc0){var _0x141019='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x168fc0[_0xa9a4('0x21')][_0xa9a4('0x66')];return db[_0xa9a4('0x67')][_0xa9a4('0x3b')](_0x141019,{'type':db[_0xa9a4('0x68')]['QueryTypes'][_0xa9a4('0x6a')],'raw':!![]})['then'](function(_0x1c34a2){return _0x1c34a2;});})[_0xa9a4('0x1a')](function(_0x358187){if(_0x358187){_0x5c4d43[_0xa9a4('0x21')]['contact']=_0x358187[0x0];if(!_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')])return;return db['User']['find']({'where':{'id':_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')],'role':_0xa9a4('0x77')},'attributes':['id',_0xa9a4('0x33'),_0xa9a4('0x6d'),_0xa9a4('0x6e'),'internal'],'raw':!![]});}return null;})[_0xa9a4('0x1a')](function(_0x43a2c7){if(!_0x43a2c7)return null;_0x5c4d43[_0xa9a4('0x21')][_0xa9a4('0x77')]=_0x43a2c7;return _0x5c4d43;})['then'](function(_0x4b6c06){if(_0x4b6c06){_0x4b6c06['message']['interface']=util['format'](_0xa9a4('0x71'),_0x540b8d['user'][_0xa9a4('0x33')]);_0x4b6c06[_0xa9a4('0x21')]['channel']=_0x5c4d43['channel'];_0x4b6c06[_0xa9a4('0x21')][_0xa9a4('0x72')]=_0x5c4d43[_0xa9a4('0x73')];_0x4b6c06[_0xa9a4('0x21')][_0xa9a4('0x7c')]=_0xa9a4('0x2d');respondWithRpcPromise(_0xa9a4('0x74'),_0xa9a4('0x74'),{'event':_0xa9a4('0x7d'),'message':_[_0xa9a4('0x48')](_0x5c4d43[_0xa9a4('0x21')],JSON[_0xa9a4('0x76')](_0x5c4d43['interaction'][_0xa9a4('0x7e')]))},client9002);return _0x5c4d43;}return null;})[_0xa9a4('0x1a')](respondWithResult(_0x5395c9,null))['catch'](handleError(_0x5395c9,null));};
\ No newline at end of file
+var _0x009e=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ChatMessage','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','email','manual','interface','SIP/%s','channel','event','accept','acceptmessage','parse','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','internal','motionChannel','EventManager','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x009e,0x100));var _0xe009=function(_0x374c1c,_0x522606){_0x374c1c=_0x374c1c-0x0;var _0x1c1c33=_0x009e[_0x374c1c];return _0x1c1c33;};'use strict';var emlformat=require(_0xe009('0x0'));var rimraf=require(_0xe009('0x1'));var zipdir=require(_0xe009('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe009('0x3'));var moment=require(_0xe009('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe009('0x5'));var util=require(_0xe009('0x6'));var path=require('path');var sox=require(_0xe009('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe009('0x8'));var _=require(_0xe009('0x9'));var squel=require(_0xe009('0xa'));var crypto=require(_0xe009('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe009('0xc'));var querystring=require('querystring');var Papa=require(_0xe009('0xd'));var Redis=require(_0xe009('0xe'));var authService=require(_0xe009('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe009('0x10'));var hardwareService=require(_0xe009('0x11'));var logger=require(_0xe009('0x12'))('api');var utils=require(_0xe009('0x13'));var config=require(_0xe009('0x14'));var licenseUtil=require(_0xe009('0x15'));var db=require(_0xe009('0x16'))['db'];config[_0xe009('0x17')]=_[_0xe009('0x18')](config[_0xe009('0x17')],{'host':_0xe009('0x19'),'port':0x18eb});var socket=require(_0xe009('0x1a'))(new Redis(config[_0xe009('0x17')]));require('./chatMessage.socket')[_0xe009('0x1b')](socket);var jayson=require(_0xe009('0x1c'));var client=jayson[_0xe009('0x1d')][_0xe009('0x1e')]({'port':0x232c});var client9002=jayson[_0xe009('0x1d')][_0xe009('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xc196a1,_0x376b50,_0x2d6eef,_0x1bb718){return new BPromise(function(_0x5608e2,_0x5c6e16){var _0x1be21f=_0x1bb718||client;return _0x1be21f[_0xe009('0x1f')](_0xc196a1,_0x2d6eef)[_0xe009('0x20')](function(_0x17a24d){logger[_0xe009('0x21')]('ChatMessage,\x20%s,\x20%s',_0x376b50,_0xe009('0x22'));logger[_0xe009('0x23')](_0xe009('0x24'),_0x376b50,_0xe009('0x22'),JSON[_0xe009('0x25')](_0x17a24d));if(_0x17a24d['error']){if(_0x17a24d[_0xe009('0x26')][_0xe009('0x27')]===0x1f4){logger['error'](_0xe009('0x28'),_0x376b50,_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);return _0x5c6e16(_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);}logger[_0xe009('0x26')](_0xe009('0x28'),_0x376b50,_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);return _0x5608e2(_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);}else{logger[_0xe009('0x21')](_0xe009('0x28'),_0x376b50,_0xe009('0x22'));_0x5608e2(_0x17a24d[_0xe009('0x2a')][_0xe009('0x29')]);}})[_0xe009('0x2b')](function(_0x20cb17){logger[_0xe009('0x26')]('ChatMessage,\x20%s,\x20%s',_0x376b50,_0x20cb17);_0x5c6e16(_0x20cb17);});});}function respondWithStatusCode(_0x144ba6,_0x8d7c8a){_0x8d7c8a=_0x8d7c8a||0xcc;return function(_0x27645f){if(_0x27645f){return _0x144ba6[_0xe009('0x2c')](_0x8d7c8a);}return _0x144ba6[_0xe009('0x2d')](_0x8d7c8a)[_0xe009('0x2e')]();};}function respondWithResult(_0x20a0b3,_0x1b5057){_0x1b5057=_0x1b5057||0xc8;return function(_0x4aff80){if(_0x4aff80){return _0x20a0b3[_0xe009('0x2d')](_0x1b5057)[_0xe009('0x2f')](_0x4aff80);}};}function respondWithFilteredResult(_0x29af6d,_0x9e7158){return function(_0x226102){if(_0x226102){var _0x64f245=typeof _0x9e7158[_0xe009('0x30')]==='undefined'&&typeof _0x9e7158[_0xe009('0x31')]==='undefined';var _0x310c83=_0x226102[_0xe009('0x32')];var _0x36a4d2=_0x64f245?0x0:_0x9e7158[_0xe009('0x30')];var _0x47a759=_0x64f245?_0x226102[_0xe009('0x32')]:_0x9e7158['offset']+_0x9e7158[_0xe009('0x31')];var _0xa1619b;if(_0x47a759>=_0x310c83){_0x47a759=_0x310c83;_0xa1619b=0xc8;}else{_0xa1619b=0xce;}_0x29af6d['status'](_0xa1619b);return _0x29af6d[_0xe009('0x33')](_0xe009('0x34'),_0x36a4d2+'-'+_0x47a759+'/'+_0x310c83)[_0xe009('0x2f')](_0x226102);}return null;};}function patchUpdates(_0x107bc6){return function(_0x30860c){try{jsonpatch[_0xe009('0x35')](_0x30860c,_0x107bc6,!![]);}catch(_0x44cdd6){return BPromise[_0xe009('0x36')](_0x44cdd6);}return _0x30860c[_0xe009('0x37')]();};}function saveUpdates(_0xc1873e,_0x43265d){return function(_0x240912){if(_0x240912){return _0x240912[_0xe009('0x38')](_0xc1873e)[_0xe009('0x20')](function(_0x2a1030){return _0x2a1030;});}return null;};}function removeEntity(_0x2a40d5,_0x2d3af4){return function(_0x57cff8){if(_0x57cff8){return _0x57cff8[_0xe009('0x39')]()[_0xe009('0x20')](function(){_0x2a40d5['status'](0xcc)[_0xe009('0x2e')]();});}};}function handleEntityNotFound(_0x3836e6,_0x213ee9){return function(_0xdcea0e){if(!_0xdcea0e){_0x3836e6[_0xe009('0x2c')](0x194);}return _0xdcea0e;};}function handleError(_0x3bd0ed,_0x95f08c){_0x95f08c=_0x95f08c||0x1f4;return function(_0x49c1d4){logger['error'](_0x49c1d4['stack']);if(_0x49c1d4[_0xe009('0x3a')]){delete _0x49c1d4['name'];}_0x3bd0ed[_0xe009('0x2d')](_0x95f08c)[_0xe009('0x3b')](_0x49c1d4);};}exports[_0xe009('0x3c')]=function(_0x48d2af,_0x83152){var _0xa637a2={},_0x5d9ddb={},_0x513008={'count':0x0,'rows':[]};var _0x3a220b=_[_0xe009('0x3d')](db[_0xe009('0x3e')]['rawAttributes'],function(_0x108453){return{'name':_0x108453['fieldName'],'type':_0x108453[_0xe009('0x3f')][_0xe009('0x40')]};});_0x5d9ddb[_0xe009('0x41')]=_['map'](_0x3a220b,_0xe009('0x3a'));_0x5d9ddb['query']=_[_0xe009('0x42')](_0x48d2af['query']);_0x5d9ddb[_0xe009('0x43')]=_['intersection'](_0x5d9ddb[_0xe009('0x41')],_0x5d9ddb[_0xe009('0x44')]);_0xa637a2[_0xe009('0x45')]=_[_0xe009('0x46')](_0x5d9ddb[_0xe009('0x41')],qs[_0xe009('0x47')](_0x48d2af['query']['fields']));_0xa637a2[_0xe009('0x45')]=_0xa637a2[_0xe009('0x45')][_0xe009('0x48')]?_0xa637a2['attributes']:_0x5d9ddb['model'];if(!_0x48d2af['query'][_0xe009('0x49')](_0xe009('0x4a'))){_0xa637a2['limit']=qs[_0xe009('0x31')](_0x48d2af[_0xe009('0x44')]['limit']);_0xa637a2[_0xe009('0x30')]=qs[_0xe009('0x30')](_0x48d2af[_0xe009('0x44')][_0xe009('0x30')]);}_0xa637a2[_0xe009('0x4b')]=qs[_0xe009('0x4c')](_0x48d2af[_0xe009('0x44')]['sort']);_0xa637a2[_0xe009('0x4d')]=qs[_0xe009('0x43')](_[_0xe009('0x4e')](_0x48d2af[_0xe009('0x44')],_0x5d9ddb['filters']),_0x3a220b);if(_0x48d2af['query'][_0xe009('0x4f')]){_0xa637a2['where']=_[_0xe009('0x50')](_0xa637a2[_0xe009('0x4d')],{'$or':_['map'](_0x3a220b,function(_0x3e563d){if(_0x3e563d['type']!==_0xe009('0x51')){var _0x5babb8={};_0x5babb8[_0x3e563d[_0xe009('0x3a')]]={'$like':'%'+_0x48d2af[_0xe009('0x44')]['filter']+'%'};return _0x5babb8;}})});}_0xa637a2=_[_0xe009('0x50')]({},_0xa637a2,_0x48d2af[_0xe009('0x52')]);var _0x35737c={'where':_0xa637a2[_0xe009('0x4d')]};return db['ChatMessage']['count'](_0x35737c)[_0xe009('0x20')](function(_0x578aa3){_0x513008['count']=_0x578aa3;if(_0x48d2af[_0xe009('0x44')]['includeAll']){_0xa637a2[_0xe009('0x53')]=[{'all':!![]}];}return db[_0xe009('0x3e')][_0xe009('0x54')](_0xa637a2);})[_0xe009('0x20')](function(_0x4f153a){_0x513008[_0xe009('0x55')]=_0x4f153a;return _0x513008;})[_0xe009('0x20')](respondWithFilteredResult(_0x83152,_0xa637a2))[_0xe009('0x2b')](handleError(_0x83152,null));};exports[_0xe009('0x56')]=function(_0x25a9ca,_0x409340){var _0xba677d={'raw':!![],'where':{'id':_0x25a9ca[_0xe009('0x57')]['id']}},_0xc3ed02={};_0xc3ed02[_0xe009('0x41')]=_['keys'](db[_0xe009('0x3e')][_0xe009('0x58')]);_0xc3ed02[_0xe009('0x44')]=_['keys'](_0x25a9ca[_0xe009('0x44')]);_0xc3ed02['filters']=_[_0xe009('0x46')](_0xc3ed02[_0xe009('0x41')],_0xc3ed02['query']);_0xba677d[_0xe009('0x45')]=_[_0xe009('0x46')](_0xc3ed02[_0xe009('0x41')],qs[_0xe009('0x47')](_0x25a9ca['query']['fields']));_0xba677d[_0xe009('0x45')]=_0xba677d[_0xe009('0x45')][_0xe009('0x48')]?_0xba677d[_0xe009('0x45')]:_0xc3ed02[_0xe009('0x41')];if(_0x25a9ca[_0xe009('0x44')][_0xe009('0x59')]){_0xba677d['include']=[{'all':!![]}];}_0xba677d=_[_0xe009('0x50')]({},_0xba677d,_0x25a9ca[_0xe009('0x52')]);return db['ChatMessage'][_0xe009('0x5a')](_0xba677d)['then'](handleEntityNotFound(_0x409340,null))['then'](respondWithResult(_0x409340,null))[_0xe009('0x2b')](handleError(_0x409340,null));};exports[_0xe009('0x5b')]=function(_0x4228d5,_0x43555d){return db[_0xe009('0x3e')]['create'](_0x4228d5[_0xe009('0x5c')],{})[_0xe009('0x20')](respondWithResult(_0x43555d,0xc9))['catch'](handleError(_0x43555d,null));};exports[_0xe009('0x38')]=function(_0x396fa3,_0x52f454){if(_0x396fa3['body']['id']){delete _0x396fa3['body']['id'];}return db[_0xe009('0x3e')][_0xe009('0x5a')]({'where':{'id':_0x396fa3[_0xe009('0x57')]['id']}})[_0xe009('0x20')](handleEntityNotFound(_0x52f454,null))['then'](saveUpdates(_0x396fa3['body'],null))[_0xe009('0x20')](respondWithResult(_0x52f454,null))['catch'](handleError(_0x52f454,null));};exports[_0xe009('0x39')]=function(_0x4fe9ed,_0x2ed100){return db[_0xe009('0x3e')][_0xe009('0x5a')]({'where':{'id':_0x4fe9ed['params']['id']}})[_0xe009('0x20')](handleEntityNotFound(_0x2ed100,null))[_0xe009('0x20')](removeEntity(_0x2ed100,null))[_0xe009('0x2b')](handleError(_0x2ed100,null));};exports[_0xe009('0x5d')]=function(_0x2d1531,_0x50c29b){return db[_0xe009('0x3e')][_0xe009('0x5d')]()['then'](respondWithResult(_0x50c29b,null))['catch'](handleError(_0x50c29b,null));};var interaction_log=require('../../config/logger')(_0xe009('0x5e'));exports['accept']=function(_0x1ec3a0,_0x274353,_0x5ae96d){var _0x5eb828={'agent':{},'channel':_0xe009('0x5f')};if(_0x1ec3a0[_0xe009('0x5c')]['id']){delete _0x1ec3a0[_0xe009('0x5c')]['id'];}_0x1ec3a0['body'][_0xe009('0x60')]=!![];_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x61')]=moment()[_0xe009('0x62')](_0xe009('0x63'));_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')]=_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')]||_0x1ec3a0[_0xe009('0x65')]['id'];_0x5eb828[_0xe009('0x66')]['id']=_0x1ec3a0[_0xe009('0x5c')]['UserId'];return db[_0xe009('0x3e')]['find']({'where':{'id':_0x1ec3a0[_0xe009('0x57')]['id'],'UserId':null}})[_0xe009('0x20')](handleEntityNotFound(_0x274353,null))['then'](saveUpdates(_0x1ec3a0[_0xe009('0x5c')],null))['then'](function(_0x5e5d8a){if(_0x5e5d8a){_0x5eb828[_0xe009('0x29')]=_0x5e5d8a[_0xe009('0x67')]({'plain':!![]});return db[_0xe009('0x68')][_0xe009('0x5a')]({'where':{'id':_0x5e5d8a['ChatInteractionId']}});}return null;})[_0xe009('0x20')](handleEntityNotFound(_0x274353,null))[_0xe009('0x20')](function(_0x268a58){if(_0x268a58){return _0x268a58[_0xe009('0x38')]({'UserId':_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')],'read1stAt':_['isNil'](_0x268a58[_0xe009('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe009('0x20')](function(_0x2480d1){if(_0x2480d1){_0x5eb828['interaction']=_0x2480d1[_0xe009('0x67')]({'plain':!![]});interaction_log['info'](_0xe009('0x6a'),_0x1ec3a0[_0xe009('0x65')]['id'],_0x1ec3a0[_0xe009('0x65')][_0xe009('0x3a')],_0x1ec3a0[_0xe009('0x65')][_0xe009('0x6b')],_0x5eb828['interaction']['id'],_0x1ec3a0['body']?JSON['stringify'](_0x1ec3a0[_0xe009('0x5c')]):_0xe009('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5eb828);}return null;})[_0xe009('0x20')](function(_0x5008e6){var _0x320a3b=_0xe009('0x6d')+_0x5008e6[_0xe009('0x29')]['ContactId'];return db['sequelize'][_0xe009('0x44')](_0x320a3b,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xe009('0x20')](function(_0x19f8b8){return _0x19f8b8;});})[_0xe009('0x20')](function(_0x5194d9){if(_0x5194d9){_0x5eb828[_0xe009('0x29')][_0xe009('0x6e')]=_0x5194d9[0x0];if(!_0x1ec3a0[_0xe009('0x5c')]['UserId'])return;return db[_0xe009('0x6f')][_0xe009('0x5a')]({'where':{'id':_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')],'role':_0xe009('0x66')},'attributes':['id',_0xe009('0x3a'),'fullname',_0xe009('0x70'),'internal'],'raw':!![]});}return null;})[_0xe009('0x20')](function(_0x5b1cfd){if(!_0x5b1cfd)return null;_0x5eb828['message'][_0xe009('0x66')]=_0x5b1cfd;return _0x5eb828;})[_0xe009('0x20')](function(_0x393728){if(_0x393728){if(_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x71')]){_0x5eb828[_0xe009('0x29')][_0xe009('0x72')]=util[_0xe009('0x62')](_0xe009('0x73'),_0x1ec3a0[_0xe009('0x65')][_0xe009('0x3a')]);_0x5eb828[_0xe009('0x29')][_0xe009('0x74')]=_0x5eb828[_0xe009('0x74')];_0x5eb828[_0xe009('0x29')]['motionChannel']=_0x5eb828[_0xe009('0x74')];_0x5eb828[_0xe009('0x29')][_0xe009('0x75')]=_0xe009('0x76');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xe009('0x77'),'message':_[_0xe009('0x50')](_0x5eb828['message'],JSON[_0xe009('0x78')](_0x5eb828['interaction']['formData']))},client9002)['then'](function(){return _0x5eb828;});}return _0x5eb828;}return null;})[_0xe009('0x20')](respondWithResult(_0x274353,null))[_0xe009('0x2b')](handleError(_0x274353,null));};var interaction_log=require(_0xe009('0x12'))(_0xe009('0x5e'));exports[_0xe009('0x36')]=function(_0x485913,_0xbc1f52,_0x3f9980){var _0x1f3806={'agent':{},'channel':_0xe009('0x5f')};if(_0x485913[_0xe009('0x5c')]['id']){delete _0x485913[_0xe009('0x5c')]['id'];}_0x485913['body'][_0xe009('0x64')]=_0x485913['body'][_0xe009('0x64')]||_0x485913[_0xe009('0x65')]['id'];_0x1f3806[_0xe009('0x66')]['id']=_0x485913[_0xe009('0x5c')][_0xe009('0x64')];return db['ChatMessage']['find']({'where':{'id':_0x485913[_0xe009('0x57')]['id'],'UserId':null}})[_0xe009('0x20')](handleEntityNotFound(_0xbc1f52,null))[_0xe009('0x20')](function(_0x54c962){if(_0x54c962){_0x1f3806[_0xe009('0x29')]=_0x54c962['get']({'plain':!![]});return db[_0xe009('0x68')][_0xe009('0x5a')]({'where':{'id':_0x54c962[_0xe009('0x79')]}});}return null;})[_0xe009('0x20')](handleEntityNotFound(_0xbc1f52,null))['then'](function(_0x3b34f3){if(_0x3b34f3){_0x1f3806['interaction']=_0x3b34f3[_0xe009('0x67')]({'plain':!![]});interaction_log[_0xe009('0x21')](_0xe009('0x7a'),_0x485913[_0xe009('0x65')]['id'],_0x485913['user'][_0xe009('0x3a')],_0x485913[_0xe009('0x65')]['role'],_0x1f3806[_0xe009('0x7b')]['id'],_0x485913[_0xe009('0x5c')]?JSON[_0xe009('0x25')](_0x485913[_0xe009('0x5c')]):_0xe009('0x6c'));return respondWithRpcPromise(_0xe009('0x7c'),_0xe009('0x7d'),_0x1f3806);}return null;})[_0xe009('0x20')](function(_0x239596){var _0x73b9b0=_0xe009('0x6d')+_0x239596[_0xe009('0x29')]['ContactId'];return db['sequelize'][_0xe009('0x44')](_0x73b9b0,{'type':db[_0xe009('0x7e')][_0xe009('0x7f')][_0xe009('0x80')],'raw':!![]})['then'](function(_0xb27ecf){return _0xb27ecf;});})[_0xe009('0x20')](function(_0x164c01){if(_0x164c01){_0x1f3806[_0xe009('0x29')]['contact']=_0x164c01[0x0];if(!_0x485913[_0xe009('0x5c')][_0xe009('0x64')])return;return db[_0xe009('0x6f')][_0xe009('0x5a')]({'where':{'id':_0x485913['body'][_0xe009('0x64')],'role':_0xe009('0x66')},'attributes':['id','name',_0xe009('0x81'),_0xe009('0x70'),_0xe009('0x82')],'raw':!![]});}return null;})[_0xe009('0x20')](function(_0x3bbb7a){if(!_0x3bbb7a)return null;_0x1f3806[_0xe009('0x29')][_0xe009('0x66')]=_0x3bbb7a;return _0x1f3806;})['then'](function(_0x31cbfd){if(_0x31cbfd){_0x31cbfd[_0xe009('0x29')][_0xe009('0x72')]=util[_0xe009('0x62')](_0xe009('0x73'),_0x485913[_0xe009('0x65')][_0xe009('0x3a')]);_0x31cbfd[_0xe009('0x29')][_0xe009('0x74')]=_0x1f3806[_0xe009('0x74')];_0x31cbfd[_0xe009('0x29')][_0xe009('0x83')]=_0x1f3806[_0xe009('0x74')];_0x31cbfd[_0xe009('0x29')][_0xe009('0x75')]='reject';respondWithRpcPromise(_0xe009('0x84'),'EventManager',{'event':_0xe009('0x85'),'message':_[_0xe009('0x50')](_0x1f3806[_0xe009('0x29')],JSON[_0xe009('0x78')](_0x1f3806[_0xe009('0x7b')]['formData']))},client9002);return _0x1f3806;}return null;})[_0xe009('0x20')](respondWithResult(_0xbc1f52,null))[_0xe009('0x2b')](handleError(_0xbc1f52,null));};
\ No newline at end of file
diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js
index cfe6e44..0463c86 100644
--- a/server/api/chatMessage/chatMessage.events.js
+++ b/server/api/chatMessage/chatMessage.events.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xbdc3=['remove','emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update'];(function(_0x1290e6,_0xfc37c6){var _0x16391b=function(_0x358324){while(--_0x358324){_0x1290e6['push'](_0x1290e6['shift']());}};_0x16391b(++_0xfc37c6);}(_0xbdc3,0xfc));var _0x3bdc=function(_0x4e0882,_0x4f72ef){_0x4e0882=_0x4e0882-0x0;var _0x29adb7=_0xbdc3[_0x4e0882];return _0x29adb7;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x3bdc('0x0'))['db'][_0x3bdc('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3bdc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3bdc('0x3'),'afterDestroy':_0x3bdc('0x4')};function emitEvent(_0x1a2c98){return function(_0x4f50a2,_0x35db02,_0x379ccb){ChatMessageEvents['emit'](_0x1a2c98+':'+_0x4f50a2['id'],_0x4f50a2);ChatMessageEvents[_0x3bdc('0x5')](_0x1a2c98,_0x4f50a2);_0x379ccb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x3bdc('0x6')](e,emitEvent(event));}}module[_0x3bdc('0x7')]=ChatMessageEvents;
\ No newline at end of file
+var _0xb98a=['ChatMessage','setMaxListeners','update','remove','emit','events'];(function(_0x5e48ba,_0x5dd869){var _0x27076e=function(_0x5e6d75){while(--_0x5e6d75){_0x5e48ba['push'](_0x5e48ba['shift']());}};_0x27076e(++_0x5dd869);}(_0xb98a,0x1f1));var _0xab98=function(_0x1235a8,_0x2db48e){_0x1235a8=_0x1235a8-0x0;var _0x41a2cf=_0xb98a[_0x1235a8];return _0x41a2cf;};'use strict';var EventEmitter=require(_0xab98('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xab98('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xab98('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xab98('0x3'),'afterDestroy':_0xab98('0x4')};function emitEvent(_0x1ae6a0){return function(_0x4c4631,_0x2a2f1e,_0x4cfae4){ChatMessageEvents['emit'](_0x1ae6a0+':'+_0x4c4631['id'],_0x4c4631);ChatMessageEvents[_0xab98('0x5')](_0x1ae6a0,_0x4c4631);_0x4cfae4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents;
\ No newline at end of file
diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js
index 6bee575..b7f515d 100644
--- a/server/api/chatMessage/chatMessage.model.js
+++ b/server/api/chatMessage/chatMessage.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xe9d5=['out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','direction','toLowerCase'];(function(_0x4385b6,_0x22cea0){var _0x7a3252=function(_0x5a3470){while(--_0x5a3470){_0x4385b6['push'](_0x4385b6['shift']());}};_0x7a3252(++_0x22cea0);}(_0xe9d5,0x191));var _0x5e9d=function(_0x42e2a0,_0xd2a7e1){_0x42e2a0=_0x42e2a0-0x0;var _0x3dbf06=_0xe9d5[_0x42e2a0];return _0x3dbf06;};'use strict';var _=require(_0x5e9d('0x0'));var util=require(_0x5e9d('0x1'));var logger=require(_0x5e9d('0x2'))(_0x5e9d('0x3'));var moment=require(_0x5e9d('0x4'));var BPromise=require('bluebird');var rp=require(_0x5e9d('0x5'));var fs=require('fs');var path=require(_0x5e9d('0x6'));var rimraf=require(_0x5e9d('0x7'));var config=require(_0x5e9d('0x8'));var attributes=require(_0x5e9d('0x9'));module[_0x5e9d('0xa')]=function(_0x22cedf,_0x2c156f){return _0x22cedf[_0x5e9d('0xb')](_0x5e9d('0xc'),attributes,{'tableName':_0x5e9d('0xd'),'paranoid':![],'indexes':[{'name':_0x5e9d('0xe'),'fields':['body'],'type':_0x5e9d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2747b9,_0x8bdc65,_0x43a167){var _0x11d50b=_0x22cedf[_0x5e9d('0x10')];var _0x206aaa=_0x2747b9['get']({'plain':!![]});if(_0x206aaa[_0x5e9d('0x11')][_0x5e9d('0x12')]()==='in'||_0x206aaa['direction'][_0x5e9d('0x12')]()===_0x5e9d('0x13')&&!_0x206aaa[_0x5e9d('0x14')]&&!_[_0x5e9d('0x15')](_0x206aaa[_0x5e9d('0x16')])){_0x11d50b[_0x5e9d('0x17')][_0x5e9d('0x18')]({'where':{'id':_0x206aaa[_0x5e9d('0x19')]}})[_0x5e9d('0x1a')](function(_0x224167){if(_0x224167){_0x224167['update']({'lastMsgAt':_0x206aaa['createdAt'],'lastMsgDirection':_0x206aaa[_0x5e9d('0x11')][_0x5e9d('0x12')]()});}})[_0x5e9d('0x1b')](function(_0x564037){console['error'](_0x564037);});}_0x43a167();}},'charset':_0x5e9d('0x1c'),'collate':_0x5e9d('0x1d')});};
\ No newline at end of file
+var _0x330c=['update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteractionId','then'];(function(_0x383875,_0x45b02b){var _0x128fc2=function(_0x247f99){while(--_0x247f99){_0x383875['push'](_0x383875['shift']());}};_0x128fc2(++_0x45b02b);}(_0x330c,0x186));var _0xc330=function(_0x56f0f8,_0x28d84a){_0x56f0f8=_0x56f0f8-0x0;var _0x29c23c=_0x330c[_0x56f0f8];return _0x29c23c;};'use strict';var _=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var logger=require(_0xc330('0x2'))(_0xc330('0x3'));var moment=require('moment');var BPromise=require(_0xc330('0x4'));var rp=require(_0xc330('0x5'));var fs=require('fs');var path=require(_0xc330('0x6'));var rimraf=require(_0xc330('0x7'));var config=require(_0xc330('0x8'));var attributes=require(_0xc330('0x9'));module['exports']=function(_0x4f49fb,_0x53d0ca){return _0x4f49fb[_0xc330('0xa')](_0xc330('0xb'),attributes,{'tableName':_0xc330('0xc'),'paranoid':![],'indexes':[{'name':_0xc330('0xd'),'fields':[_0xc330('0xe')],'type':_0xc330('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bebaa,_0x48480e,_0x150c7d){var _0x4c1a5f=_0x4f49fb[_0xc330('0x10')];var _0x49ad4c=_0x1bebaa[_0xc330('0x11')]({'plain':!![]});if(_0x49ad4c[_0xc330('0x12')][_0xc330('0x13')]()==='in'||_0x49ad4c[_0xc330('0x12')][_0xc330('0x13')]()===_0xc330('0x14')&&!_0x49ad4c[_0xc330('0x15')]&&!_[_0xc330('0x16')](_0x49ad4c[_0xc330('0x17')])){_0x4c1a5f['ChatInteraction']['findOne']({'where':{'id':_0x49ad4c[_0xc330('0x18')]}})[_0xc330('0x19')](function(_0x5066d8){if(_0x5066d8){_0x5066d8[_0xc330('0x1a')]({'lastMsgAt':_0x49ad4c[_0xc330('0x1b')],'lastMsgDirection':_0x49ad4c[_0xc330('0x12')][_0xc330('0x13')]()});}})[_0xc330('0x1c')](function(_0xdd6f7f){console[_0xc330('0x1d')](_0xdd6f7f);});}_0x150c7d();}},'charset':_0xc330('0x1e'),'collate':_0xc330('0x1f')});};
\ No newline at end of file
diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js
index 7f6d3c9..888ff0f 100644
--- a/server/api/chatMessage/chatMessage.rpc.js
+++ b/server/api/chatMessage/chatMessage.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x28f9=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util'];(function(_0x43371b,_0x1cb4cf){var _0x19cd26=function(_0x5f43bf){while(--_0x5f43bf){_0x43371b['push'](_0x43371b['shift']());}};_0x19cd26(++_0x1cb4cf);}(_0x28f9,0x174));var _0x928f=function(_0x13e655,_0x14669a){_0x13e655=_0x13e655-0x0;var _0xb47447=_0x28f9[_0x13e655];return _0xb47447;};'use strict';var _=require(_0x928f('0x0'));var util=require(_0x928f('0x1'));var moment=require(_0x928f('0x2'));var BPromise=require(_0x928f('0x3'));var rs=require(_0x928f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x928f('0x5'));var logger=require(_0x928f('0x6'))(_0x928f('0x7'));var config=require(_0x928f('0x8'));var jayson=require(_0x928f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x928f('0xa')]=_[_0x928f('0xb')](config['redis'],{'host':_0x928f('0xc'),'port':0x18eb});var socket=require(_0x928f('0xd'))(new Redis(config[_0x928f('0xa')]));require(_0x928f('0xe'))[_0x928f('0xf')](socket);function respondWithRpcPromise(_0x34481f,_0xa862b2,_0x3b92f6){return new BPromise(function(_0xaee291,_0x1d4d24){return client[_0x928f('0x10')](_0x34481f,_0x3b92f6)[_0x928f('0x11')](function(_0x4bbddd){logger[_0x928f('0x12')]('ChatMessage,\x20%s,\x20%s',_0xa862b2,_0x928f('0x13'));logger[_0x928f('0x14')](_0x928f('0x15'),_0xa862b2,_0x928f('0x13'),JSON[_0x928f('0x16')](_0x4bbddd));if(_0x4bbddd[_0x928f('0x17')]){if(_0x4bbddd['error'][_0x928f('0x18')]===0x1f4){logger[_0x928f('0x17')]('ChatMessage,\x20%s,\x20%s',_0xa862b2,_0x4bbddd[_0x928f('0x17')][_0x928f('0x19')]);return _0x1d4d24(_0x4bbddd[_0x928f('0x17')][_0x928f('0x19')]);}logger[_0x928f('0x17')](_0x928f('0x1a'),_0xa862b2,_0x4bbddd[_0x928f('0x17')][_0x928f('0x19')]);return _0xaee291(_0x4bbddd[_0x928f('0x17')][_0x928f('0x19')]);}else{logger[_0x928f('0x12')](_0x928f('0x1a'),_0xa862b2,_0x928f('0x13'));_0xaee291(_0x4bbddd['result'][_0x928f('0x19')]);}})[_0x928f('0x1b')](function(_0x1b92ed){logger[_0x928f('0x17')](_0x928f('0x1a'),_0xa862b2,_0x1b92ed);_0x1d4d24(_0x1b92ed);});});}exports[_0x928f('0x1c')]=function(_0x1eb22e){var _0x485caf=this;return new Promise(function(_0xe946c,_0xd630a2){return db[_0x928f('0x1d')][_0x928f('0x1e')](_0x1eb22e[_0x928f('0x1f')],{'raw':_0x1eb22e['options']?_0x1eb22e[_0x928f('0x20')][_0x928f('0x21')]===undefined?!![]:![]:!![]})[_0x928f('0x11')](function(_0x2e5b25){logger[_0x928f('0x12')](_0x928f('0x1c'),_0x1eb22e);logger[_0x928f('0x14')](_0x928f('0x1c'),_0x1eb22e,JSON[_0x928f('0x16')](_0x2e5b25));_0xe946c(_0x2e5b25);})['catch'](function(_0xfee195){logger[_0x928f('0x17')]('CreateChatMessage',_0xfee195['message'],_0x1eb22e);_0xd630a2(_0x485caf[_0x928f('0x17')](0x1f4,_0xfee195[_0x928f('0x19')]));});});};
\ No newline at end of file
+var _0x3cb7=['redis','defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','body','options','debug','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1f62c9,_0x57a575){var _0x150b84=function(_0x48d237){while(--_0x48d237){_0x1f62c9['push'](_0x1f62c9['shift']());}};_0x150b84(++_0x57a575);}(_0x3cb7,0xcf));var _0x73cb=function(_0x5d68a2,_0x4304cf){_0x5d68a2=_0x5d68a2-0x0;var _0x5b3088=_0x3cb7[_0x5d68a2];return _0x5b3088;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73cb('0x0'));var BPromise=require('bluebird');var rs=require(_0x73cb('0x1'));var fs=require('fs');var Redis=require(_0x73cb('0x2'));var db=require(_0x73cb('0x3'))['db'];var utils=require(_0x73cb('0x4'));var logger=require(_0x73cb('0x5'))(_0x73cb('0x6'));var config=require(_0x73cb('0x7'));var jayson=require(_0x73cb('0x8'));var client=jayson['client'][_0x73cb('0x9')]({'port':0x232a});config[_0x73cb('0xa')]=_[_0x73cb('0xb')](config[_0x73cb('0xa')],{'host':_0x73cb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73cb('0xa')]));require(_0x73cb('0xd'))[_0x73cb('0xe')](socket);function respondWithRpcPromise(_0x29deae,_0x1826dd,_0xc1a63e){return new BPromise(function(_0x43eab2,_0x501542){return client[_0x73cb('0xf')](_0x29deae,_0xc1a63e)[_0x73cb('0x10')](function(_0x35900e){logger[_0x73cb('0x11')](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));logger['debug'](_0x73cb('0x14'),_0x1826dd,_0x73cb('0x13'),JSON[_0x73cb('0x15')](_0x35900e));if(_0x35900e[_0x73cb('0x16')]){if(_0x35900e[_0x73cb('0x16')][_0x73cb('0x17')]===0x1f4){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x501542(_0x35900e['error']['message']);}logger['error'](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x43eab2(_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);}else{logger['info'](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));_0x43eab2(_0x35900e[_0x73cb('0x19')][_0x73cb('0x18')]);}})[_0x73cb('0x1a')](function(_0x28ee3b){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x28ee3b);_0x501542(_0x28ee3b);});});}exports[_0x73cb('0x1b')]=function(_0x31fb89){var _0x50a5c4=this;return new Promise(function(_0xe092aa,_0x18d19e){return db['ChatMessage']['create'](_0x31fb89[_0x73cb('0x1c')],{'raw':_0x31fb89[_0x73cb('0x1d')]?_0x31fb89[_0x73cb('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x73cb('0x10')](function(_0x4885e9){logger['info'](_0x73cb('0x1b'),_0x31fb89);logger[_0x73cb('0x1e')]('CreateChatMessage',_0x31fb89,JSON[_0x73cb('0x15')](_0x4885e9));_0xe092aa(_0x4885e9);})[_0x73cb('0x1a')](function(_0x24bae0){logger['error'](_0x73cb('0x1b'),_0x24bae0[_0x73cb('0x18')],_0x31fb89);_0x18d19e(_0x50a5c4[_0x73cb('0x16')](0x1f4,_0x24bae0[_0x73cb('0x18')]));});});};
\ No newline at end of file
diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js
index 18ab84f..7ef8b49 100644
--- a/server/api/chatMessage/chatMessage.socket.js
+++ b/server/api/chatMessage/chatMessage.socket.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd6d2=['save','update','removeListener','length','chatMessage:','./chatMessage.events'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x49290b,_0x3916bf){_0x49290b=_0x49290b-0x0;var _0x23a179=_0xd6d2[_0x49290b];return _0x23a179;};'use strict';var ChatMessageEvents=require(_0x2d6d('0x0'));var events=[_0x2d6d('0x1'),'remove',_0x2d6d('0x2')];function createListener(_0x224caa,_0x5b4a5b){return function(_0x2c2dd9){_0x5b4a5b['emit'](_0x224caa,_0x2c2dd9);};}function removeListener(_0x1c5e54,_0x3ee519){return function(){ChatMessageEvents[_0x2d6d('0x3')](_0x1c5e54,_0x3ee519);};}exports['register']=function(_0xfcdb1d){for(var _0x132361=0x0,_0xf59b20=events[_0x2d6d('0x4')];_0x132361<_0xf59b20;_0x132361++){var _0x4002b7=events[_0x132361];var _0x42d802=createListener(_0x2d6d('0x5')+_0x4002b7,_0xfcdb1d);ChatMessageEvents['on'](_0x4002b7,_0x42d802);}};
\ No newline at end of file
+var _0x19da=['update','register','length','save'];(function(_0x3771c8,_0x4f1814){var _0x54917f=function(_0x5287d3){while(--_0x5287d3){_0x3771c8['push'](_0x3771c8['shift']());}};_0x54917f(++_0x4f1814);}(_0x19da,0x9f));var _0xa19d=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x19da[_0x59bcb1];return _0x4a737f;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa19d('0x0'),'remove',_0xa19d('0x1')];function createListener(_0x5ba569,_0x3a48f4){return function(_0x17f1c6){_0x3a48f4['emit'](_0x5ba569,_0x17f1c6);};}function removeListener(_0x179db7,_0x28ec9a){return function(){ChatMessageEvents['removeListener'](_0x179db7,_0x28ec9a);};}exports[_0xa19d('0x2')]=function(_0x330adb){for(var _0x1f6e10=0x0,_0x14dc68=events[_0xa19d('0x3')];_0x1f6e10<_0x14dc68;_0x1f6e10++){var _0x4b4627=events[_0x1f6e10];var _0x197c4e=createListener('chatMessage:'+_0x4b4627,_0x330adb);ChatMessageEvents['on'](_0x4b4627,_0x197c4e);}};
\ No newline at end of file
diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js
index 25ee71d..7dc0c69 100644
--- a/server/api/chatMessage/index.js
+++ b/server/api/chatMessage/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x464b=['create','put','/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat'];(function(_0x4a4fd1,_0x538e3d){var _0x490c2e=function(_0xc903d6){while(--_0xc903d6){_0x4a4fd1['push'](_0x4a4fd1['shift']());}};_0x490c2e(++_0x538e3d);}(_0x464b,0x1d4));var _0xb464=function(_0x3e1c5d,_0x49b4fa){_0x3e1c5d=_0x3e1c5d-0x0;var _0x52979e=_0x464b[_0x3e1c5d];return _0x52979e;};'use strict';var multer=require(_0xb464('0x0'));var util=require(_0xb464('0x1'));var path=require(_0xb464('0x2'));var timeout=require(_0xb464('0x3'));var express=require('express');var router=express[_0xb464('0x4')]();var fs_extra=require(_0xb464('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb464('0x6'));var controller=require('./chatMessage.controller');router[_0xb464('0x7')]('/',auth[_0xb464('0x8')](),controller[_0xb464('0x9')]);router['get'](_0xb464('0xa'),auth[_0xb464('0x8')](),controller[_0xb464('0xb')]);router[_0xb464('0x7')](_0xb464('0xc'),auth[_0xb464('0x8')](),controller['show']);router[_0xb464('0xd')]('/',auth[_0xb464('0x8')](),interaction[_0xb464('0xe')](_0xb464('0xf'),'chatmessage:create'),controller[_0xb464('0x10')]);router['put'](_0xb464('0xc'),controller['update']);router[_0xb464('0x11')](_0xb464('0x12'),auth[_0xb464('0x8')](),controller[_0xb464('0x13')]);router['put'](_0xb464('0x14'),auth[_0xb464('0x8')](),controller[_0xb464('0x15')]);router['delete'](_0xb464('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x87d1=['put','/:id/accept','accept','reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','describe','/:id','tracked','chat'];(function(_0x22e8a9,_0x148d2b){var _0x46f0b2=function(_0x3b3079){while(--_0x3b3079){_0x22e8a9['push'](_0x22e8a9['shift']());}};_0x46f0b2(++_0x148d2b);}(_0x87d1,0x1bf));var _0x187d=function(_0x1be453,_0x4328ae){_0x1be453=_0x1be453-0x0;var _0x569960=_0x87d1[_0x1be453];return _0x569960;};'use strict';var multer=require(_0x187d('0x0'));var util=require('util');var path=require(_0x187d('0x1'));var timeout=require(_0x187d('0x2'));var express=require('express');var router=express[_0x187d('0x3')]();var fs_extra=require(_0x187d('0x4'));var auth=require(_0x187d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x187d('0x6'));router[_0x187d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x187d('0x7')]('/describe',auth[_0x187d('0x8')](),controller[_0x187d('0x9')]);router['get'](_0x187d('0xa'),auth[_0x187d('0x8')](),controller['show']);router['post']('/',auth[_0x187d('0x8')](),interaction[_0x187d('0xb')](_0x187d('0xc'),'chatmessage:create'),controller['create']);router[_0x187d('0xd')]('/:id',controller['update']);router['put'](_0x187d('0xe'),auth[_0x187d('0x8')](),controller[_0x187d('0xf')]);router[_0x187d('0xd')]('/:id/reject',auth['isAuthenticated'](),controller[_0x187d('0x10')]);router[_0x187d('0x11')](_0x187d('0xa'),auth['isAuthenticated'](),controller[_0x187d('0x12')]);module[_0x187d('0x13')]=router;
\ No newline at end of file
diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js
index f92eaa6..ba7609d 100644
--- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js
+++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0xa388be,_0x2ff1ae){var _0x4d03ef=function(_0x3f0ab7){while(--_0x3f0ab7){_0xa388be['push'](_0xa388be['shift']());}};_0x4d03ef(++_0x2ff1ae);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5e1297,_0x4a2705){_0x5e1297=_0x5e1297-0x0;var _0x7f80d=_0x5f2f[_0x5e1297];return _0x7f80d;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}};
\ No newline at end of file
+var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x23183c,_0x46de69){var _0x231ba2=function(_0x1c4eb5){while(--_0x1c4eb5){_0x23183c['push'](_0x23183c['shift']());}};_0x231ba2(++_0x46de69);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3dc688,_0x4c604b){_0x3dc688=_0x3dc688-0x0;var _0x26cea2=_0x5f2f[_0x3dc688];return _0x26cea2;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}};
\ No newline at end of file
diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js
index b2fc182..e2bc9ce 100644
--- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js
+++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x7a54,0x106));var _0x47a5=function(_0x4f2596,_0x43a807){_0x4f2596=_0x4f2596-0x0;var _0x1be403=_0x7a54[_0x4f2596];return _0x1be403;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));};
\ No newline at end of file
+var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x7a54,0x106));var _0x47a5=function(_0x66f9f7,_0x4ee763){_0x66f9f7=_0x66f9f7-0x0;var _0x51948f=_0x7a54[_0x66f9f7];return _0x51948f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));};
\ No newline at end of file
diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js
index fc8f4e6..5ae0e9d 100644
--- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js
+++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x35a1=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatOfflineMessage','save'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x35a1,0x1ad));var _0x135a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x35a1[_0x422905];return _0x33dc6c;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x135a('0x0'))['db'][_0x135a('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x135a('0x2'),'afterUpdate':_0x135a('0x3'),'afterDestroy':_0x135a('0x4')};function emitEvent(_0x4bf63e){return function(_0x416949,_0x31b116,_0x4db0fc){ChatOfflineMessageEvents[_0x135a('0x5')](_0x4bf63e+':'+_0x416949['id'],_0x416949);ChatOfflineMessageEvents['emit'](_0x4bf63e,_0x416949);_0x4db0fc(null);};}for(var e in events){if(events[_0x135a('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x135a('0x7')](e,emitEvent(event));}}module[_0x135a('0x8')]=ChatOfflineMessageEvents;
\ No newline at end of file
+var _0x9b09=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x9b09,0xfd));var _0x99b0=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x9b09[_0x1559a5];return _0x17a783;};'use strict';var EventEmitter=require(_0x99b0('0x0'));var ChatOfflineMessage=require(_0x99b0('0x1'))['db'][_0x99b0('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x99b0('0x3')};function emitEvent(_0x38c7be){return function(_0x163d3b,_0x30f596,_0x120ca5){ChatOfflineMessageEvents[_0x99b0('0x4')](_0x38c7be+':'+_0x163d3b['id'],_0x163d3b);ChatOfflineMessageEvents[_0x99b0('0x4')](_0x38c7be,_0x163d3b);_0x120ca5(null);};}for(var e in events){if(events[_0x99b0('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x99b0('0x6')](e,emitEvent(event));}}module[_0x99b0('0x7')]=ChatOfflineMessageEvents;
\ No newline at end of file
diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js
index 5c50f02..afb5525 100644
--- a/server/api/chatOfflineMessage/chatOfflineMessage.model.js
+++ b/server/api/chatOfflineMessage/chatOfflineMessage.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x55a2=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x58bda4,_0x1c83fe){var _0x1e7305=function(_0x25f958){while(--_0x25f958){_0x58bda4['push'](_0x58bda4['shift']());}};_0x1e7305(++_0x1c83fe);}(_0x55a2,0x7e));var _0x255a=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x55a2[_0x548627];return _0x844a84;};'use strict';var attributes=require(_0x255a('0x0'));module[_0x255a('0x1')]=function(_0x3e22c5){return _0x3e22c5[_0x255a('0x2')](_0x255a('0x3'),attributes,{'tableName':_0x255a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x255a('0x5'),'collate':_0x255a('0x6')});};
\ No newline at end of file
+var _0x085c=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x42a3c0,_0x522753){var _0x1da011=function(_0x24cda7){while(--_0x24cda7){_0x42a3c0['push'](_0x42a3c0['shift']());}};_0x1da011(++_0x522753);}(_0x085c,0x13e));var _0xc085=function(_0x33ea9e,_0x2f0d10){_0x33ea9e=_0x33ea9e-0x0;var _0x3ac557=_0x085c[_0x33ea9e];return _0x3ac557;};'use strict';var attributes=require(_0xc085('0x0'));module[_0xc085('0x1')]=function(_0x4fe6bd){return _0x4fe6bd['define'](_0xc085('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc085('0x3'),'collate':_0xc085('0x4')});};
\ No newline at end of file
diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js
index f002207..7996092 100644
--- a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js
+++ b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x8987=['result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent'];(function(_0x42754d,_0x33a711){var _0x2190d0=function(_0xd2083){while(--_0xd2083){_0x42754d['push'](_0x42754d['shift']());}};_0x2190d0(++_0x33a711);}(_0x8987,0xc9));var _0x7898=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x8987[_0x1265ed];return _0x5ac459;};'use strict';var _=require('lodash');var util=require(_0x7898('0x0'));var moment=require(_0x7898('0x1'));var BPromise=require(_0x7898('0x2'));var rs=require(_0x7898('0x3'));var fs=require('fs');var Redis=require(_0x7898('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7898('0x5'));var logger=require(_0x7898('0x6'))(_0x7898('0x7'));var config=require(_0x7898('0x8'));var jayson=require(_0x7898('0x9'));var client=jayson[_0x7898('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd71b66,_0x2d9ea6,_0x35d16c){return new BPromise(function(_0x56347f,_0x2a88c2){return client[_0x7898('0xb')](_0xd71b66,_0x35d16c)['then'](function(_0x8db27){logger[_0x7898('0xc')](_0x7898('0xd'),_0x2d9ea6,'request\x20sent');logger[_0x7898('0xe')](_0x7898('0xf'),_0x2d9ea6,'request\x20sent',JSON['stringify'](_0x8db27));if(_0x8db27[_0x7898('0x10')]){if(_0x8db27['error']['code']===0x1f4){logger[_0x7898('0x10')](_0x7898('0xd'),_0x2d9ea6,_0x8db27[_0x7898('0x10')][_0x7898('0x11')]);return _0x2a88c2(_0x8db27[_0x7898('0x10')]['message']);}logger[_0x7898('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d9ea6,_0x8db27[_0x7898('0x10')][_0x7898('0x11')]);return _0x56347f(_0x8db27[_0x7898('0x10')][_0x7898('0x11')]);}else{logger[_0x7898('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d9ea6,_0x7898('0x12'));_0x56347f(_0x8db27[_0x7898('0x13')][_0x7898('0x11')]);}})['catch'](function(_0x26cb5a){logger['error'](_0x7898('0xd'),_0x2d9ea6,_0x26cb5a);_0x2a88c2(_0x26cb5a);});});}
\ No newline at end of file
+var _0xb13b=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0xb13b,0x1de));var _0xbb13=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xb13b[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xbb13('0x0'));var util=require(_0xbb13('0x1'));var moment=require(_0xbb13('0x2'));var BPromise=require(_0xbb13('0x3'));var rs=require(_0xbb13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb13('0x5'))['db'];var utils=require(_0xbb13('0x6'));var logger=require('../../config/logger')(_0xbb13('0x7'));var config=require(_0xbb13('0x8'));var jayson=require(_0xbb13('0x9'));var client=jayson[_0xbb13('0xa')][_0xbb13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd4a4bd,_0x1067a5,_0x3be2d2){return new BPromise(function(_0x56dc8f,_0x58d7d0){return client[_0xbb13('0xc')](_0xd4a4bd,_0x3be2d2)[_0xbb13('0xd')](function(_0x1c71b9){logger[_0xbb13('0xe')](_0xbb13('0xf'),_0x1067a5,_0xbb13('0x10'));logger[_0xbb13('0x11')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1067a5,_0xbb13('0x10'),JSON[_0xbb13('0x12')](_0x1c71b9));if(_0x1c71b9[_0xbb13('0x13')]){if(_0x1c71b9['error'][_0xbb13('0x14')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1067a5,_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);return _0x58d7d0(_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);}logger['error'](_0xbb13('0xf'),_0x1067a5,_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);return _0x56dc8f(_0x1c71b9['error'][_0xbb13('0x15')]);}else{logger['info'](_0xbb13('0xf'),_0x1067a5,'request\x20sent');_0x56dc8f(_0x1c71b9[_0xbb13('0x16')][_0xbb13('0x15')]);}})[_0xbb13('0x17')](function(_0x53602a){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1067a5,_0x53602a);_0x58d7d0(_0x53602a);});});}
\ No newline at end of file
diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js
index a1372ec..2ee7f38 100644
--- a/server/api/chatOfflineMessage/index.js
+++ b/server/api/chatOfflineMessage/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xe910=['update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put'];(function(_0x26adb2,_0x7bb3f8){var _0x39b09b=function(_0x3fa344){while(--_0x3fa344){_0x26adb2['push'](_0x26adb2['shift']());}};_0x39b09b(++_0x7bb3f8);}(_0xe910,0x1a7));var _0x0e91=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xe910[_0x1e4150];return _0x1ce3ee;};'use strict';var multer=require('multer');var util=require(_0x0e91('0x0'));var path=require(_0x0e91('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e91('0x2'));var router=express[_0x0e91('0x3')]();var fs_extra=require(_0x0e91('0x4'));var auth=require(_0x0e91('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e91('0x6'));var controller=require(_0x0e91('0x7'));router['get']('/',auth[_0x0e91('0x8')](),controller['index']);router[_0x0e91('0x9')](_0x0e91('0xa'),auth[_0x0e91('0x8')](),controller[_0x0e91('0xb')]);router[_0x0e91('0x9')](_0x0e91('0xc'),auth['isAuthenticated'](),controller[_0x0e91('0xd')]);router[_0x0e91('0xe')]('/',auth['isAuthenticated'](),controller[_0x0e91('0xf')]);router[_0x0e91('0x10')](_0x0e91('0xc'),auth[_0x0e91('0x8')](),controller[_0x0e91('0x11')]);router[_0x0e91('0x12')](_0x0e91('0xc'),auth[_0x0e91('0x8')](),controller[_0x0e91('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x0b93=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b93,0x15f));var _0x30b9=function(_0x49534b,_0x147009){_0x49534b=_0x49534b-0x0;var _0x22517e=_0x0b93[_0x49534b];return _0x22517e;};'use strict';var multer=require('multer');var util=require(_0x30b9('0x0'));var path=require('path');var timeout=require(_0x30b9('0x1'));var express=require(_0x30b9('0x2'));var router=express[_0x30b9('0x3')]();var fs_extra=require(_0x30b9('0x4'));var auth=require(_0x30b9('0x5'));var interaction=require(_0x30b9('0x6'));var config=require(_0x30b9('0x7'));var controller=require(_0x30b9('0x8'));router[_0x30b9('0x9')]('/',auth[_0x30b9('0xa')](),controller[_0x30b9('0xb')]);router[_0x30b9('0x9')](_0x30b9('0xc'),auth[_0x30b9('0xa')](),controller[_0x30b9('0xd')]);router[_0x30b9('0x9')](_0x30b9('0xe'),auth['isAuthenticated'](),controller[_0x30b9('0xf')]);router[_0x30b9('0x10')]('/',auth['isAuthenticated'](),controller[_0x30b9('0x11')]);router[_0x30b9('0x12')](_0x30b9('0xe'),auth[_0x30b9('0xa')](),controller['update']);router[_0x30b9('0x13')](_0x30b9('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x30b9('0x14')]=router;
\ No newline at end of file
diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js
index 3d4f5e8..c125392 100644
--- a/server/api/chatProactiveAction/chatProactiveAction.attributes.js
+++ b/server/api/chatProactiveAction/chatProactiveAction.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xb543=['STRING','ENUM','mouseOver','timeout','sequelize','exports'];(function(_0x4a3684,_0x167231){var _0x227b6f=function(_0x515864){while(--_0x515864){_0x4a3684['push'](_0x4a3684['shift']());}};_0x227b6f(++_0x167231);}(_0xb543,0x7c));var _0x3b54=function(_0x3a8a05,_0xbf58dc){_0x3a8a05=_0x3a8a05-0x0;var _0x1f7fa1=_0xb543[_0x3a8a05];return _0x1f7fa1;};'use strict';var Sequelize=require(_0x3b54('0x0'));module[_0x3b54('0x1')]={'name':{'type':Sequelize[_0x3b54('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3b54('0x3')](_0x3b54('0x4'),_0x3b54('0x5')),'defaultValue':_0x3b54('0x4')},'selector':{'type':Sequelize[_0x3b54('0x2')]},'timeout':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0xe9a9=['exports','STRING','ENUM','mouseOver','timeout'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe9a9,0x1b3));var _0x9e9a=function(_0x5fb411,_0x5e0a38){_0x5fb411=_0x5fb411-0x0;var _0xb5443d=_0xe9a9[_0x5fb411];return _0xb5443d;};'use strict';var Sequelize=require('sequelize');module[_0x9e9a('0x0')]={'name':{'type':Sequelize[_0x9e9a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9e9a('0x2')](_0x9e9a('0x3'),_0x9e9a('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x9e9a('0x1')]},'timeout':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js
index 486b58d..bf7850e 100644
--- a/server/api/chatProactiveAction/chatProactiveAction.controller.js
+++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x8a28=['options','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','params','ChatProactiveAction','rawAttributes','query','keys','filters','model','attributes','intersection','fields','includeAll','merge'];(function(_0x1cd708,_0x19f60d){var _0x2899d3=function(_0x256399){while(--_0x256399){_0x1cd708['push'](_0x1cd708['shift']());}};_0x2899d3(++_0x19f60d);}(_0x8a28,0xfd));var _0x88a2=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x8a28[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x88a2('0x0'));var rimraf=require(_0x88a2('0x1'));var zipdir=require(_0x88a2('0x2'));var jsonpatch=require(_0x88a2('0x3'));var rp=require(_0x88a2('0x4'));var moment=require(_0x88a2('0x5'));var BPromise=require(_0x88a2('0x6'));var Mustache=require(_0x88a2('0x7'));var util=require('util');var path=require(_0x88a2('0x8'));var sox=require(_0x88a2('0x9'));var csv=require(_0x88a2('0xa'));var ejs=require(_0x88a2('0xb'));var fs=require('fs');var fs_extra=require(_0x88a2('0xc'));var _=require('lodash');var squel=require(_0x88a2('0xd'));var crypto=require('crypto');var jsforce=require(_0x88a2('0xe'));var deskjs=require(_0x88a2('0xf'));var toCsv=require(_0x88a2('0xa'));var querystring=require(_0x88a2('0x10'));var Papa=require(_0x88a2('0x11'));var Redis=require(_0x88a2('0x12'));var authService=require(_0x88a2('0x13'));var qs=require(_0x88a2('0x14'));var as=require(_0x88a2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x88a2('0x16'));var utils=require(_0x88a2('0x17'));var config=require(_0x88a2('0x18'));var licenseUtil=require(_0x88a2('0x19'));var db=require(_0x88a2('0x1a'))['db'];function respondWithStatusCode(_0x4887fc,_0x210a52){_0x210a52=_0x210a52||0xcc;return function(_0x1a4056){if(_0x1a4056){return _0x4887fc[_0x88a2('0x1b')](_0x210a52);}return _0x4887fc[_0x88a2('0x1c')](_0x210a52)['end']();};}function respondWithResult(_0x923706,_0x407ef0){_0x407ef0=_0x407ef0||0xc8;return function(_0x3b83ce){if(_0x3b83ce){return _0x923706['status'](_0x407ef0)[_0x88a2('0x1d')](_0x3b83ce);}};}function respondWithFilteredResult(_0x207b12,_0x462b7b){return function(_0x42facc){if(_0x42facc){var _0x1beccd=typeof _0x462b7b[_0x88a2('0x1e')]===_0x88a2('0x1f')&&typeof _0x462b7b[_0x88a2('0x20')]===_0x88a2('0x1f');var _0x417bf8=_0x42facc[_0x88a2('0x21')];var _0x3c030e=_0x1beccd?0x0:_0x462b7b[_0x88a2('0x1e')];var _0x29dc1b=_0x1beccd?_0x42facc[_0x88a2('0x21')]:_0x462b7b[_0x88a2('0x1e')]+_0x462b7b[_0x88a2('0x20')];var _0x46ed82;if(_0x29dc1b>=_0x417bf8){_0x29dc1b=_0x417bf8;_0x46ed82=0xc8;}else{_0x46ed82=0xce;}_0x207b12['status'](_0x46ed82);return _0x207b12[_0x88a2('0x22')](_0x88a2('0x23'),_0x3c030e+'-'+_0x29dc1b+'/'+_0x417bf8)['json'](_0x42facc);}return null;};}function patchUpdates(_0x499891){return function(_0x7a054c){try{jsonpatch[_0x88a2('0x24')](_0x7a054c,_0x499891,!![]);}catch(_0x102139){return BPromise[_0x88a2('0x25')](_0x102139);}return _0x7a054c[_0x88a2('0x26')]();};}function saveUpdates(_0x54c6ed,_0x3b6401){return function(_0xda54c4){if(_0xda54c4){return _0xda54c4[_0x88a2('0x27')](_0x54c6ed)[_0x88a2('0x28')](function(_0x4be832){return _0x4be832;});}return null;};}function removeEntity(_0x1f104c,_0x527744){return function(_0x5bbd79){if(_0x5bbd79){return _0x5bbd79[_0x88a2('0x29')]()[_0x88a2('0x28')](function(){_0x1f104c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1343fc,_0xac4afe){return function(_0x5be767){if(!_0x5be767){_0x1343fc[_0x88a2('0x1b')](0x194);}return _0x5be767;};}function handleError(_0x4427a1,_0x2ba881){_0x2ba881=_0x2ba881||0x1f4;return function(_0x2474fc){logger['error'](_0x2474fc[_0x88a2('0x2a')]);if(_0x2474fc['name']){delete _0x2474fc[_0x88a2('0x2b')];}_0x4427a1[_0x88a2('0x1c')](_0x2ba881)[_0x88a2('0x2c')](_0x2474fc);};}exports['show']=function(_0x165259,_0x3eca1a){var _0x4c441a={'raw':!![],'where':{'id':_0x165259[_0x88a2('0x2d')]['id']}},_0x21bd1b={};_0x21bd1b['model']=_['keys'](db[_0x88a2('0x2e')][_0x88a2('0x2f')]);_0x21bd1b[_0x88a2('0x30')]=_[_0x88a2('0x31')](_0x165259[_0x88a2('0x30')]);_0x21bd1b[_0x88a2('0x32')]=_['intersection'](_0x21bd1b[_0x88a2('0x33')],_0x21bd1b[_0x88a2('0x30')]);_0x4c441a[_0x88a2('0x34')]=_[_0x88a2('0x35')](_0x21bd1b[_0x88a2('0x33')],qs[_0x88a2('0x36')](_0x165259[_0x88a2('0x30')][_0x88a2('0x36')]));_0x4c441a[_0x88a2('0x34')]=_0x4c441a[_0x88a2('0x34')]['length']?_0x4c441a['attributes']:_0x21bd1b[_0x88a2('0x33')];if(_0x165259[_0x88a2('0x30')][_0x88a2('0x37')]){_0x4c441a['include']=[{'all':!![]}];}_0x4c441a=_[_0x88a2('0x38')]({},_0x4c441a,_0x165259[_0x88a2('0x39')]);return db['ChatProactiveAction'][_0x88a2('0x3a')](_0x4c441a)[_0x88a2('0x28')](handleEntityNotFound(_0x3eca1a,null))[_0x88a2('0x28')](respondWithResult(_0x3eca1a,null))['catch'](handleError(_0x3eca1a,null));};exports['create']=function(_0xd8b70b,_0x14a616){return db['ChatProactiveAction'][_0x88a2('0x3b')](_0xd8b70b[_0x88a2('0x3c')],{})[_0x88a2('0x28')](respondWithResult(_0x14a616,0xc9))[_0x88a2('0x3d')](handleError(_0x14a616,null));};exports[_0x88a2('0x27')]=function(_0xabe2b1,_0x367044){if(_0xabe2b1[_0x88a2('0x3c')]['id']){delete _0xabe2b1['body']['id'];}return db[_0x88a2('0x2e')][_0x88a2('0x3a')]({'where':{'id':_0xabe2b1['params']['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x367044,null))[_0x88a2('0x28')](saveUpdates(_0xabe2b1[_0x88a2('0x3c')],null))[_0x88a2('0x28')](respondWithResult(_0x367044,null))[_0x88a2('0x3d')](handleError(_0x367044,null));};exports[_0x88a2('0x29')]=function(_0x2357ad,_0x21828b){return db[_0x88a2('0x2e')][_0x88a2('0x3a')]({'where':{'id':_0x2357ad[_0x88a2('0x2d')]['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x21828b,null))[_0x88a2('0x28')](removeEntity(_0x21828b,null))[_0x88a2('0x3d')](handleError(_0x21828b,null));};
\ No newline at end of file
+var _0x4016=['then','destroy','error','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','rimraf','zip-dir','bluebird','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x4016,0x131));var _0x6401=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4016[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6401('0x0'));var zipdir=require(_0x6401('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6401('0x2'));var Mustache=require('mustache');var util=require(_0x6401('0x3'));var path=require(_0x6401('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6401('0x5'));var fs=require('fs');var fs_extra=require(_0x6401('0x6'));var _=require('lodash');var squel=require(_0x6401('0x7'));var crypto=require('crypto');var jsforce=require(_0x6401('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6401('0x9'));var querystring=require(_0x6401('0xa'));var Papa=require(_0x6401('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6401('0xc'));var as=require(_0x6401('0xd'));var hardwareService=require(_0x6401('0xe'));var logger=require('../../config/logger')(_0x6401('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6401('0x10'));var db=require(_0x6401('0x11'))['db'];function respondWithStatusCode(_0x26ec93,_0x45e88a){_0x45e88a=_0x45e88a||0xcc;return function(_0xf7fc5){if(_0xf7fc5){return _0x26ec93[_0x6401('0x12')](_0x45e88a);}return _0x26ec93[_0x6401('0x13')](_0x45e88a)[_0x6401('0x14')]();};}function respondWithResult(_0x381c17,_0x1f6edf){_0x1f6edf=_0x1f6edf||0xc8;return function(_0x45fcea){if(_0x45fcea){return _0x381c17[_0x6401('0x13')](_0x1f6edf)[_0x6401('0x15')](_0x45fcea);}};}function respondWithFilteredResult(_0x29fedc,_0x4c740a){return function(_0x1b510e){if(_0x1b510e){var _0x1fd3b8=typeof _0x4c740a[_0x6401('0x16')]===_0x6401('0x17')&&typeof _0x4c740a[_0x6401('0x18')]===_0x6401('0x17');var _0x4521b6=_0x1b510e['count'];var _0x55ca87=_0x1fd3b8?0x0:_0x4c740a[_0x6401('0x16')];var _0x50eda7=_0x1fd3b8?_0x1b510e[_0x6401('0x19')]:_0x4c740a[_0x6401('0x16')]+_0x4c740a[_0x6401('0x18')];var _0x3c3a6c;if(_0x50eda7>=_0x4521b6){_0x50eda7=_0x4521b6;_0x3c3a6c=0xc8;}else{_0x3c3a6c=0xce;}_0x29fedc[_0x6401('0x13')](_0x3c3a6c);return _0x29fedc[_0x6401('0x1a')](_0x6401('0x1b'),_0x55ca87+'-'+_0x50eda7+'/'+_0x4521b6)['json'](_0x1b510e);}return null;};}function patchUpdates(_0x10fd3c){return function(_0x44525b){try{jsonpatch[_0x6401('0x1c')](_0x44525b,_0x10fd3c,!![]);}catch(_0x1757ab){return BPromise['reject'](_0x1757ab);}return _0x44525b[_0x6401('0x1d')]();};}function saveUpdates(_0x343d25,_0x4ed76d){return function(_0x20b445){if(_0x20b445){return _0x20b445[_0x6401('0x1e')](_0x343d25)[_0x6401('0x1f')](function(_0xdea921){return _0xdea921;});}return null;};}function removeEntity(_0x19d6a0,_0x39bca3){return function(_0xed5d29){if(_0xed5d29){return _0xed5d29[_0x6401('0x20')]()[_0x6401('0x1f')](function(){_0x19d6a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55818a,_0xee5737){return function(_0x12f19a){if(!_0x12f19a){_0x55818a[_0x6401('0x12')](0x194);}return _0x12f19a;};}function handleError(_0x4e6d9f,_0x3b1d99){_0x3b1d99=_0x3b1d99||0x1f4;return function(_0x102f69){logger[_0x6401('0x21')](_0x102f69[_0x6401('0x22')]);if(_0x102f69['name']){delete _0x102f69['name'];}_0x4e6d9f[_0x6401('0x13')](_0x3b1d99)[_0x6401('0x23')](_0x102f69);};}exports[_0x6401('0x24')]=function(_0x466a35,_0x549b8c){var _0x7f6e88={'raw':!![],'where':{'id':_0x466a35[_0x6401('0x25')]['id']}},_0x43e089={};_0x43e089[_0x6401('0x26')]=_[_0x6401('0x27')](db[_0x6401('0x28')][_0x6401('0x29')]);_0x43e089[_0x6401('0x2a')]=_['keys'](_0x466a35[_0x6401('0x2a')]);_0x43e089[_0x6401('0x2b')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],_0x43e089['query']);_0x7f6e88[_0x6401('0x2d')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],qs['fields'](_0x466a35['query'][_0x6401('0x2e')]));_0x7f6e88['attributes']=_0x7f6e88[_0x6401('0x2d')][_0x6401('0x2f')]?_0x7f6e88[_0x6401('0x2d')]:_0x43e089[_0x6401('0x26')];if(_0x466a35[_0x6401('0x2a')][_0x6401('0x30')]){_0x7f6e88[_0x6401('0x31')]=[{'all':!![]}];}_0x7f6e88=_[_0x6401('0x32')]({},_0x7f6e88,_0x466a35[_0x6401('0x33')]);return db['ChatProactiveAction'][_0x6401('0x34')](_0x7f6e88)[_0x6401('0x1f')](handleEntityNotFound(_0x549b8c,null))[_0x6401('0x1f')](respondWithResult(_0x549b8c,null))[_0x6401('0x35')](handleError(_0x549b8c,null));};exports[_0x6401('0x36')]=function(_0x556354,_0xd7a00f){return db[_0x6401('0x28')]['create'](_0x556354[_0x6401('0x37')],{})['then'](respondWithResult(_0xd7a00f,0xc9))[_0x6401('0x35')](handleError(_0xd7a00f,null));};exports[_0x6401('0x1e')]=function(_0x5317f8,_0x444339){if(_0x5317f8[_0x6401('0x37')]['id']){delete _0x5317f8[_0x6401('0x37')]['id'];}return db[_0x6401('0x28')]['find']({'where':{'id':_0x5317f8[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x444339,null))[_0x6401('0x1f')](saveUpdates(_0x5317f8['body'],null))[_0x6401('0x1f')](respondWithResult(_0x444339,null))[_0x6401('0x35')](handleError(_0x444339,null));};exports['destroy']=function(_0x79d73f,_0x337d1c){return db[_0x6401('0x28')][_0x6401('0x34')]({'where':{'id':_0x79d73f[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x337d1c,null))[_0x6401('0x1f')](removeEntity(_0x337d1c,null))[_0x6401('0x35')](handleError(_0x337d1c,null));};
\ No newline at end of file
diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js
index cf525cb..a831cfa 100644
--- a/server/api/chatProactiveAction/chatProactiveAction.model.js
+++ b/server/api/chatProactiveAction/chatProactiveAction.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xfd80=['chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0xfe3ab1,_0x22b418){var _0x38b498=function(_0x36499f){while(--_0x36499f){_0xfe3ab1['push'](_0xfe3ab1['shift']());}};_0x38b498(++_0x22b418);}(_0xfd80,0xa9));var _0x0fd8=function(_0x3ff771,_0x41c013){_0x3ff771=_0x3ff771-0x0;var _0xe4eb51=_0xfd80[_0x3ff771];return _0xe4eb51;};'use strict';var _=require(_0x0fd8('0x0'));var util=require('util');var logger=require(_0x0fd8('0x1'))(_0x0fd8('0x2'));var moment=require(_0x0fd8('0x3'));var BPromise=require(_0x0fd8('0x4'));var rp=require(_0x0fd8('0x5'));var fs=require('fs');var path=require(_0x0fd8('0x6'));var rimraf=require(_0x0fd8('0x7'));var config=require(_0x0fd8('0x8'));var attributes=require(_0x0fd8('0x9'));module[_0x0fd8('0xa')]=function(_0x36927f,_0x155b9f){return _0x36927f[_0x0fd8('0xb')](_0x0fd8('0xc'),attributes,{'tableName':_0x0fd8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7be2=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x36858d,_0x4e1f31){var _0x59ea81=function(_0x2533ca){while(--_0x2533ca){_0x36858d['push'](_0x36858d['shift']());}};_0x59ea81(++_0x4e1f31);}(_0x7be2,0xdd));var _0x27be=function(_0x3e417d,_0xaf2086){_0x3e417d=_0x3e417d-0x0;var _0x5c2ede=_0x7be2[_0x3e417d];return _0x5c2ede;};'use strict';var _=require(_0x27be('0x0'));var util=require(_0x27be('0x1'));var logger=require(_0x27be('0x2'))('api');var moment=require(_0x27be('0x3'));var BPromise=require(_0x27be('0x4'));var rp=require(_0x27be('0x5'));var fs=require('fs');var path=require(_0x27be('0x6'));var rimraf=require(_0x27be('0x7'));var config=require('../../config/environment');var attributes=require(_0x27be('0x8'));module[_0x27be('0x9')]=function(_0x3da188,_0x31b74e){return _0x3da188[_0x27be('0xa')](_0x27be('0xb'),attributes,{'tableName':_0x27be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js
index e4ba4e9..5a67505 100644
--- a/server/api/chatProactiveAction/chatProactiveAction.rpc.js
+++ b/server/api/chatProactiveAction/chatProactiveAction.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x7314=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7314,0x1b6));var _0x4731=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7314[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4731('0x0'));var util=require(_0x4731('0x1'));var moment=require(_0x4731('0x2'));var BPromise=require(_0x4731('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4731('0x4'));var db=require(_0x4731('0x5'))['db'];var utils=require(_0x4731('0x6'));var logger=require(_0x4731('0x7'))(_0x4731('0x8'));var config=require(_0x4731('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4731('0xa')][_0x4731('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4861c7,_0xe9f83c,_0x4bd579){return new BPromise(function(_0x3c0ba3,_0x3d9d88){return client[_0x4731('0xc')](_0x4861c7,_0x4bd579)[_0x4731('0xd')](function(_0x58e43){logger[_0x4731('0xe')](_0x4731('0xf'),_0xe9f83c,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0xe9f83c,_0x4731('0x10'),JSON[_0x4731('0x11')](_0x58e43));if(_0x58e43[_0x4731('0x12')]){if(_0x58e43['error']['code']===0x1f4){logger[_0x4731('0x12')](_0x4731('0xf'),_0xe9f83c,_0x58e43[_0x4731('0x12')][_0x4731('0x13')]);return _0x3d9d88(_0x58e43['error'][_0x4731('0x13')]);}logger[_0x4731('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0xe9f83c,_0x58e43[_0x4731('0x12')][_0x4731('0x13')]);return _0x3c0ba3(_0x58e43[_0x4731('0x12')][_0x4731('0x13')]);}else{logger[_0x4731('0xe')](_0x4731('0xf'),_0xe9f83c,_0x4731('0x10'));_0x3c0ba3(_0x58e43[_0x4731('0x14')]['message']);}})[_0x4731('0x15')](function(_0x15da4a){logger['error'](_0x4731('0xf'),_0xe9f83c,_0x15da4a);_0x3d9d88(_0x15da4a);});});}
\ No newline at end of file
+var _0x46ee=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x46ee,0x6b));var _0xe46e=function(_0x3545aa,_0x59c5a6){_0x3545aa=_0x3545aa-0x0;var _0x513534=_0x46ee[_0x3545aa];return _0x513534;};'use strict';var _=require(_0xe46e('0x0'));var util=require(_0xe46e('0x1'));var moment=require(_0xe46e('0x2'));var BPromise=require(_0xe46e('0x3'));var rs=require(_0xe46e('0x4'));var fs=require('fs');var Redis=require(_0xe46e('0x5'));var db=require(_0xe46e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe46e('0x7'));var client=jayson[_0xe46e('0x8')][_0xe46e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cbf01,_0x2bd6db,_0x503d16){return new BPromise(function(_0x417fa7,_0x209d13){return client[_0xe46e('0xa')](_0x5cbf01,_0x503d16)['then'](function(_0x317a04){logger[_0xe46e('0xb')](_0xe46e('0xc'),_0x2bd6db,'request\x20sent');logger['debug'](_0xe46e('0xd'),_0x2bd6db,_0xe46e('0xe'),JSON['stringify'](_0x317a04));if(_0x317a04[_0xe46e('0xf')]){if(_0x317a04[_0xe46e('0xf')][_0xe46e('0x10')]===0x1f4){logger[_0xe46e('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bd6db,_0x317a04[_0xe46e('0xf')][_0xe46e('0x11')]);return _0x209d13(_0x317a04[_0xe46e('0xf')][_0xe46e('0x11')]);}logger[_0xe46e('0xf')](_0xe46e('0xc'),_0x2bd6db,_0x317a04['error'][_0xe46e('0x11')]);return _0x417fa7(_0x317a04['error'][_0xe46e('0x11')]);}else{logger[_0xe46e('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bd6db,_0xe46e('0xe'));_0x417fa7(_0x317a04[_0xe46e('0x12')][_0xe46e('0x11')]);}})[_0xe46e('0x13')](function(_0x4d359a){logger[_0xe46e('0xf')](_0xe46e('0xc'),_0x2bd6db,_0x4d359a);_0x209d13(_0x4d359a);});});}
\ No newline at end of file
diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js
index eb20606..e05a691 100644
--- a/server/api/chatProactiveAction/index.js
+++ b/server/api/chatProactiveAction/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x2eadce,_0x310a08){var _0x25cd1d=function(_0xc7dd49){while(--_0xc7dd49){_0x2eadce['push'](_0x2eadce['shift']());}};_0x25cd1d(++_0x310a08);}(_0xeda8,0x104));var _0x8eda=function(_0x5a0018,_0x4ea1b1){_0x5a0018=_0x5a0018-0x0;var _0x5354c1=_0xeda8[_0x5a0018];return _0x5354c1;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('0x11')]=router;
\ No newline at end of file
+var _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x038b,0x114));var _0xb038=function(_0xb091a1,_0x310718){_0xb091a1=_0xb091a1-0x0;var _0x262451=_0x038b[_0xb091a1];return _0x262451;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router;
\ No newline at end of file
diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js
index f5bcaf6..28958eb 100644
--- a/server/api/chatQueue/chatQueue.attributes.js
+++ b/server/api/chatQueue/chatQueue.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xa682=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x3a62f3,_0x387ae2){var _0x486ebf=function(_0x2dc4eb){while(--_0x2dc4eb){_0x3a62f3['push'](_0x3a62f3['shift']());}};_0x486ebf(++_0x387ae2);}(_0xa682,0x1b3));var _0x2a68=function(_0xba4e2d,_0x2077a3){_0xba4e2d=_0xba4e2d-0x0;var _0x4d988c=_0xa682[_0xba4e2d];return _0x4d988c;};'use strict';var Sequelize=require('sequelize');module[_0x2a68('0x0')]={'name':{'type':Sequelize[_0x2a68('0x1')],'unique':_0x2a68('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2a68('0x1')]},'timeout':{'type':Sequelize[_0x2a68('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a68('0x4')](_0x2a68('0x5'),_0x2a68('0x6'),_0x2a68('0x7'))}};
\ No newline at end of file
+var _0x09bc=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x09bc,0x1ba));var _0xc09b=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x09bc[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require(_0xc09b('0x0'));module[_0xc09b('0x1')]={'name':{'type':Sequelize[_0xc09b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc09b('0x2')]},'timeout':{'type':Sequelize[_0xc09b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc09b('0x4'),_0xc09b('0x5'),_0xc09b('0x6'))}};
\ No newline at end of file
diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js
index 16a41e3..4d01f40 100644
--- a/server/api/chatQueue/chatQueue.controller.js
+++ b/server/api/chatQueue/chatQueue.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xca59=['removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','http','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','UserId','updatedAt','createdAt','format','SIP','chatPause','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value'];(function(_0x7cc7c3,_0x5d2075){var _0x40d43d=function(_0x5965da){while(--_0x5965da){_0x7cc7c3['push'](_0x7cc7c3['shift']());}};_0x40d43d(++_0x5d2075);}(_0xca59,0x1cd));var _0x9ca5=function(_0x46c6f9,_0x39d9c4){_0x46c6f9=_0x46c6f9-0x0;var _0x4f9bd2=_0xca59[_0x46c6f9];return _0x4f9bd2;};'use strict';var emlformat=require(_0x9ca5('0x0'));var rimraf=require(_0x9ca5('0x1'));var zipdir=require(_0x9ca5('0x2'));var jsonpatch=require(_0x9ca5('0x3'));var rp=require(_0x9ca5('0x4'));var moment=require(_0x9ca5('0x5'));var BPromise=require(_0x9ca5('0x6'));var Mustache=require(_0x9ca5('0x7'));var util=require(_0x9ca5('0x8'));var path=require(_0x9ca5('0x9'));var sox=require(_0x9ca5('0xa'));var csv=require(_0x9ca5('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ca5('0xc'));var _=require('lodash');var squel=require(_0x9ca5('0xd'));var crypto=require(_0x9ca5('0xe'));var jsforce=require(_0x9ca5('0xf'));var deskjs=require(_0x9ca5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9ca5('0x11'));var Redis=require(_0x9ca5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ca5('0x13'));var logger=require(_0x9ca5('0x14'))(_0x9ca5('0x15'));var utils=require(_0x9ca5('0x16'));var config=require(_0x9ca5('0x17'));var licenseUtil=require(_0x9ca5('0x18'));var db=require(_0x9ca5('0x19'))['db'];config[_0x9ca5('0x1a')]=_['defaults'](config[_0x9ca5('0x1a')],{'host':_0x9ca5('0x1b'),'port':0x18eb});var socket=require(_0x9ca5('0x1c'))(new Redis(config[_0x9ca5('0x1a')]));require(_0x9ca5('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9ca5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xc6d6e7,_0x5d2019,_0x25e4e7,_0x10452f){return new BPromise(function(_0x469742,_0x54c610){var _0x54076a=_0x10452f||client;return _0x54076a['request'](_0xc6d6e7,_0x25e4e7)[_0x9ca5('0x1f')](function(_0x110cac){logger[_0x9ca5('0x20')](_0x9ca5('0x21'),_0x5d2019,'request\x20sent');logger[_0x9ca5('0x22')](_0x9ca5('0x23'),_0x5d2019,_0x9ca5('0x24'),JSON[_0x9ca5('0x25')](_0x110cac));if(_0x110cac[_0x9ca5('0x26')]){if(_0x110cac[_0x9ca5('0x26')][_0x9ca5('0x27')]===0x1f4){logger[_0x9ca5('0x26')](_0x9ca5('0x21'),_0x5d2019,_0x110cac[_0x9ca5('0x26')][_0x9ca5('0x28')]);return _0x54c610(_0x110cac['error'][_0x9ca5('0x28')]);}logger[_0x9ca5('0x26')](_0x9ca5('0x21'),_0x5d2019,_0x110cac['error'][_0x9ca5('0x28')]);return _0x469742(_0x110cac[_0x9ca5('0x26')][_0x9ca5('0x28')]);}else{logger[_0x9ca5('0x20')](_0x9ca5('0x21'),_0x5d2019,_0x9ca5('0x24'));_0x469742(_0x110cac[_0x9ca5('0x29')][_0x9ca5('0x28')]);}})[_0x9ca5('0x2a')](function(_0x4e5501){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5d2019,_0x4e5501);_0x54c610(_0x4e5501);});});}function respondWithStatusCode(_0x3be1e0,_0x56ef16){_0x56ef16=_0x56ef16||0xcc;return function(_0x582427){if(_0x582427){return _0x3be1e0[_0x9ca5('0x2b')](_0x56ef16);}return _0x3be1e0[_0x9ca5('0x2c')](_0x56ef16)['end']();};}function respondWithResult(_0x575a5a,_0x33e6fa){_0x33e6fa=_0x33e6fa||0xc8;return function(_0x5e45ae){if(_0x5e45ae){return _0x575a5a[_0x9ca5('0x2c')](_0x33e6fa)[_0x9ca5('0x2d')](_0x5e45ae);}};}function respondWithFilteredResult(_0x20e1d9,_0x4fb728){return function(_0xbe6384){if(_0xbe6384){var _0x2ee84b=typeof _0x4fb728[_0x9ca5('0x2e')]===_0x9ca5('0x2f')&&typeof _0x4fb728[_0x9ca5('0x30')]===_0x9ca5('0x2f');var _0xae526c=_0xbe6384[_0x9ca5('0x31')];var _0x12bd5c=_0x2ee84b?0x0:_0x4fb728[_0x9ca5('0x2e')];var _0x2930de=_0x2ee84b?_0xbe6384[_0x9ca5('0x31')]:_0x4fb728['offset']+_0x4fb728[_0x9ca5('0x30')];var _0x16e07e;if(_0x2930de>=_0xae526c){_0x2930de=_0xae526c;_0x16e07e=0xc8;}else{_0x16e07e=0xce;}_0x20e1d9[_0x9ca5('0x2c')](_0x16e07e);return _0x20e1d9[_0x9ca5('0x32')](_0x9ca5('0x33'),_0x12bd5c+'-'+_0x2930de+'/'+_0xae526c)[_0x9ca5('0x2d')](_0xbe6384);}return null;};}function patchUpdates(_0x50a43e){return function(_0x575d4b){try{jsonpatch[_0x9ca5('0x34')](_0x575d4b,_0x50a43e,!![]);}catch(_0x13cf8b){return BPromise['reject'](_0x13cf8b);}return _0x575d4b[_0x9ca5('0x35')]();};}function saveUpdates(_0x4e9f6c,_0xb48913){return function(_0x14e68f){if(_0x14e68f){return _0x14e68f[_0x9ca5('0x36')](_0x4e9f6c)[_0x9ca5('0x1f')](function(_0x4b285d){return _0x4b285d;});}return null;};}function removeEntity(_0x119262,_0x281053){return function(_0x216c28){if(_0x216c28){return _0x216c28[_0x9ca5('0x37')]()[_0x9ca5('0x1f')](function(){var _0x2ea5ed=_0x216c28[_0x9ca5('0x38')]({'plain':!![]});var _0x532057=_0x9ca5('0x39');return db[_0x9ca5('0x3a')]['destroy']({'where':{'type':_0x532057,'resourceId':_0x2ea5ed['id']}})[_0x9ca5('0x1f')](function(){return _0x216c28;});})[_0x9ca5('0x1f')](function(){_0x119262[_0x9ca5('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x243b81,_0x497acb){return function(_0x41d0ee){if(!_0x41d0ee){_0x243b81[_0x9ca5('0x2b')](0x194);}return _0x41d0ee;};}function handleError(_0x26ad6f,_0xde62e3){_0xde62e3=_0xde62e3||0x1f4;return function(_0x2174a3){logger[_0x9ca5('0x26')](_0x2174a3['stack']);if(_0x2174a3['name']){delete _0x2174a3[_0x9ca5('0x3b')];}_0x26ad6f[_0x9ca5('0x2c')](_0xde62e3)['send'](_0x2174a3);};}exports[_0x9ca5('0x3c')]=function(_0x25ae80,_0x46b317){var _0x3ef2f2={},_0x1494d9={},_0x121462={'count':0x0,'rows':[]};var _0x262012=_[_0x9ca5('0x3d')](db[_0x9ca5('0x3e')][_0x9ca5('0x3f')],function(_0x29b519){return{'name':_0x29b519[_0x9ca5('0x40')],'type':_0x29b519[_0x9ca5('0x41')][_0x9ca5('0x42')]};});_0x1494d9['model']=_[_0x9ca5('0x3d')](_0x262012,_0x9ca5('0x3b'));_0x1494d9[_0x9ca5('0x43')]=_[_0x9ca5('0x44')](_0x25ae80['query']);_0x1494d9[_0x9ca5('0x45')]=_['intersection'](_0x1494d9['model'],_0x1494d9[_0x9ca5('0x43')]);_0x3ef2f2[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x1494d9['model'],qs[_0x9ca5('0x48')](_0x25ae80['query'][_0x9ca5('0x48')]));_0x3ef2f2[_0x9ca5('0x46')]=_0x3ef2f2[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x3ef2f2[_0x9ca5('0x46')]:_0x1494d9[_0x9ca5('0x4a')];if(!_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x4b')](_0x9ca5('0x4c'))){_0x3ef2f2[_0x9ca5('0x30')]=qs['limit'](_0x25ae80['query'][_0x9ca5('0x30')]);_0x3ef2f2[_0x9ca5('0x2e')]=qs[_0x9ca5('0x2e')](_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x2e')]);}_0x3ef2f2[_0x9ca5('0x4d')]=qs[_0x9ca5('0x4e')](_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x4e')]);_0x3ef2f2[_0x9ca5('0x4f')]=qs[_0x9ca5('0x45')](_[_0x9ca5('0x50')](_0x25ae80[_0x9ca5('0x43')],_0x1494d9[_0x9ca5('0x45')]),_0x262012);if(_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x51')]){_0x3ef2f2[_0x9ca5('0x4f')]=_[_0x9ca5('0x52')](_0x3ef2f2[_0x9ca5('0x4f')],{'$or':_['map'](_0x262012,function(_0x1277bc){if(_0x1277bc[_0x9ca5('0x41')]!==_0x9ca5('0x53')){var _0x183ed1={};_0x183ed1[_0x1277bc[_0x9ca5('0x3b')]]={'$like':'%'+_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x51')]+'%'};return _0x183ed1;}})});}_0x3ef2f2=_[_0x9ca5('0x52')]({},_0x3ef2f2,_0x25ae80[_0x9ca5('0x54')]);var _0x534d17={'where':_0x3ef2f2[_0x9ca5('0x4f')]};return db[_0x9ca5('0x3e')][_0x9ca5('0x31')](_0x534d17)[_0x9ca5('0x1f')](function(_0x426060){_0x121462[_0x9ca5('0x31')]=_0x426060;if(_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x55')]){_0x3ef2f2['include']=[{'all':!![]}];}return db[_0x9ca5('0x3e')][_0x9ca5('0x56')](_0x3ef2f2);})[_0x9ca5('0x1f')](function(_0x55daca){_0x121462[_0x9ca5('0x57')]=_0x55daca;return _0x121462;})[_0x9ca5('0x1f')](respondWithFilteredResult(_0x46b317,_0x3ef2f2))[_0x9ca5('0x2a')](handleError(_0x46b317,null));};exports[_0x9ca5('0x58')]=function(_0x52d927,_0xad049e){var _0x3d93f0={'raw':!![],'where':{'id':_0x52d927[_0x9ca5('0x59')]['id']}},_0x587a90={};_0x587a90[_0x9ca5('0x4a')]=_[_0x9ca5('0x44')](db[_0x9ca5('0x3e')][_0x9ca5('0x3f')]);_0x587a90[_0x9ca5('0x43')]=_[_0x9ca5('0x44')](_0x52d927['query']);_0x587a90['filters']=_['intersection'](_0x587a90['model'],_0x587a90['query']);_0x3d93f0[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x587a90[_0x9ca5('0x4a')],qs['fields'](_0x52d927['query'][_0x9ca5('0x48')]));_0x3d93f0[_0x9ca5('0x46')]=_0x3d93f0[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x3d93f0[_0x9ca5('0x46')]:_0x587a90[_0x9ca5('0x4a')];if(_0x52d927[_0x9ca5('0x43')][_0x9ca5('0x55')]){_0x3d93f0[_0x9ca5('0x5a')]=[{'all':!![]}];}_0x3d93f0=_['merge']({},_0x3d93f0,_0x52d927[_0x9ca5('0x54')]);return db[_0x9ca5('0x3e')][_0x9ca5('0x5b')](_0x3d93f0)[_0x9ca5('0x1f')](handleEntityNotFound(_0xad049e,null))[_0x9ca5('0x1f')](respondWithResult(_0xad049e,null))['catch'](handleError(_0xad049e,null));};exports['create']=function(_0x165e51,_0x337a16){return db['ChatQueue'][_0x9ca5('0x5c')](_0x165e51['body'],{})[_0x9ca5('0x1f')](function(_0xb1612e){var _0x42246b=_0x165e51['user'][_0x9ca5('0x38')]({'plain':!![]});if(!_0x42246b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42246b[_0x9ca5('0x5d')]===_0x9ca5('0x5e')){var _0x7f0ae0=_0xb1612e[_0x9ca5('0x38')]({'plain':!![]});var _0x2e080f=_0x9ca5('0x39');return db[_0x9ca5('0x5f')][_0x9ca5('0x5b')]({'where':{'name':_0x2e080f,'userProfileId':_0x42246b['userProfileId']},'raw':!![]})['then'](function(_0x3b5500){if(_0x3b5500&&_0x3b5500[_0x9ca5('0x60')]===0x0){return db[_0x9ca5('0x3a')][_0x9ca5('0x5c')]({'name':_0x7f0ae0[_0x9ca5('0x3b')],'resourceId':_0x7f0ae0['id'],'type':_0x3b5500[_0x9ca5('0x3b')],'sectionId':_0x3b5500['id']},{})[_0x9ca5('0x1f')](function(){return _0xb1612e;});}else{return _0xb1612e;}})[_0x9ca5('0x2a')](function(_0x252561){logger[_0x9ca5('0x26')](_0x9ca5('0x61'),_0x252561);throw _0x252561;});}return _0xb1612e;})[_0x9ca5('0x1f')](respondWithResult(_0x337a16,0xc9))[_0x9ca5('0x2a')](handleError(_0x337a16,null));};exports[_0x9ca5('0x36')]=function(_0x11470f,_0x57b603){if(_0x11470f[_0x9ca5('0x62')]['id']){delete _0x11470f['body']['id'];}return db[_0x9ca5('0x3e')][_0x9ca5('0x5b')]({'where':{'id':_0x11470f[_0x9ca5('0x59')]['id']}})['then'](handleEntityNotFound(_0x57b603,null))[_0x9ca5('0x1f')](saveUpdates(_0x11470f[_0x9ca5('0x62')],null))[_0x9ca5('0x1f')](respondWithResult(_0x57b603,null))['catch'](handleError(_0x57b603,null));};exports[_0x9ca5('0x37')]=function(_0x44c885,_0x9f0639){return db[_0x9ca5('0x3e')]['find']({'where':{'id':_0x44c885[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](handleEntityNotFound(_0x9f0639,null))[_0x9ca5('0x1f')](removeEntity(_0x9f0639,null))[_0x9ca5('0x2a')](handleError(_0x9f0639,null));};exports[_0x9ca5('0x63')]=function(_0x250847,_0x3e15e4){return db[_0x9ca5('0x3e')]['describe']()[_0x9ca5('0x1f')](respondWithResult(_0x3e15e4,null))['catch'](handleError(_0x3e15e4,null));};exports[_0x9ca5('0x64')]=function(_0x20e569,_0x156527,_0x367f21){var _0x2bb168={'raw':!![],'where':{}},_0x452a78={},_0x241f68;return db['ChatQueue'][_0x9ca5('0x65')]({'where':{'id':_0x20e569[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](handleEntityNotFound(_0x156527,null))['then'](function(_0x4bfaf7){if(_0x4bfaf7){_0x241f68=_0x4bfaf7['get']({'plain':!![]});_0x452a78[_0x9ca5('0x4a')]=_[_0x9ca5('0x44')](db[_0x9ca5('0x66')][_0x9ca5('0x3f')]);_0x452a78['query']=_[_0x9ca5('0x44')](_0x20e569['query']);_0x452a78[_0x9ca5('0x45')]=_[_0x9ca5('0x47')](_0x452a78[_0x9ca5('0x4a')],_0x452a78[_0x9ca5('0x43')]);_0x2bb168[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x452a78[_0x9ca5('0x4a')],qs['fields'](_0x20e569[_0x9ca5('0x43')][_0x9ca5('0x48')]));_0x2bb168['attributes']=_0x2bb168[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x2bb168[_0x9ca5('0x46')]:_0x452a78[_0x9ca5('0x4a')];if(!_0x20e569[_0x9ca5('0x43')]['hasOwnProperty'](_0x9ca5('0x4c'))){_0x2bb168[_0x9ca5('0x30')]=qs['limit'](_0x20e569[_0x9ca5('0x43')]['limit']);_0x2bb168['offset']=qs[_0x9ca5('0x2e')](_0x20e569[_0x9ca5('0x43')][_0x9ca5('0x2e')]);}_0x2bb168[_0x9ca5('0x4d')]=qs[_0x9ca5('0x4e')](_0x20e569[_0x9ca5('0x43')][_0x9ca5('0x4e')]);_0x2bb168[_0x9ca5('0x4f')]=qs[_0x9ca5('0x45')](_['pick'](_0x20e569['query'],_0x452a78[_0x9ca5('0x45')]));_0x2bb168['where'][_0x9ca5('0x67')]=_0x4bfaf7['id'];if(_0x20e569[_0x9ca5('0x43')]['filter']){_0x2bb168[_0x9ca5('0x4f')]=_[_0x9ca5('0x52')](_0x2bb168['where'],{'$or':_[_0x9ca5('0x3d')](_0x2bb168[_0x9ca5('0x46')],function(_0xd62db8){var _0x4f9e1a={};_0x4f9e1a[_0xd62db8]={'$like':'%'+_0x20e569[_0x9ca5('0x43')][_0x9ca5('0x51')]+'%'};return _0x4f9e1a;})});}_0x2bb168=_['merge']({},_0x2bb168,_0x20e569[_0x9ca5('0x54')]);return db[_0x9ca5('0x66')][_0x9ca5('0x56')](_0x2bb168);}})[_0x9ca5('0x1f')](function(_0x58c343){if(_0x58c343){return db[_0x9ca5('0x68')]['findAndCountAll']({'where':{'id':_[_0x9ca5('0x3d')](_0x58c343,_0x9ca5('0x69')),'role':'agent'},'attributes':['id',_0x9ca5('0x3b'),'chatPause',_0x9ca5('0x6a'),_0x9ca5('0x6b')]});}})['then'](function(_0x112601){if(_0x112601){return{'count':_0x112601[_0x9ca5('0x31')],'rows':_[_0x9ca5('0x3d')](_0x112601['rows'],function(_0x12c154){return{'membername':_0x12c154[_0x9ca5('0x3b')],'UserId':_0x12c154['id'],'queue_name':_0x241f68[_0x9ca5('0x3b')],'ChatQueueId':_0x241f68['id'],'interface':util[_0x9ca5('0x6c')]('%s/%s',_0x9ca5('0x6d'),_0x12c154[_0x9ca5('0x3b')]),'penalty':0x0,'paused':_0x12c154[_0x9ca5('0x6e')],'createdAt':_0x12c154[_0x9ca5('0x6b')],'updatedAt':_0x12c154['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9ca5('0x1f')](respondWithFilteredResult(_0x156527,_0x2bb168))['catch'](handleError(_0x156527,null));};exports[_0x9ca5('0x6f')]=function(_0x1d9640,_0x21ded8,_0x1f8d89){var _0x20bda1={};var _0x5ccf3d={};var _0x4c4bf7;var _0x2257cf;return db[_0x9ca5('0x3e')][_0x9ca5('0x65')]({'where':{'id':_0x1d9640[_0x9ca5('0x59')]['id']}})['then'](handleEntityNotFound(_0x21ded8,null))[_0x9ca5('0x1f')](function(_0x7a08fd){if(_0x7a08fd){_0x4c4bf7=_0x7a08fd;_0x5ccf3d[_0x9ca5('0x4a')]=_[_0x9ca5('0x44')](db['Team']['rawAttributes']);_0x5ccf3d['query']=_[_0x9ca5('0x44')](_0x1d9640['query']);_0x5ccf3d[_0x9ca5('0x45')]=_[_0x9ca5('0x47')](_0x5ccf3d['model'],_0x5ccf3d[_0x9ca5('0x43')]);_0x20bda1[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x5ccf3d[_0x9ca5('0x4a')],qs[_0x9ca5('0x48')](_0x1d9640[_0x9ca5('0x43')]['fields']));_0x20bda1[_0x9ca5('0x46')]=_0x20bda1[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x20bda1[_0x9ca5('0x46')]:_0x5ccf3d[_0x9ca5('0x4a')];_0x20bda1['order']=qs[_0x9ca5('0x4e')](_0x1d9640[_0x9ca5('0x43')][_0x9ca5('0x4e')]);_0x20bda1['where']=qs[_0x9ca5('0x45')](_[_0x9ca5('0x50')](_0x1d9640[_0x9ca5('0x43')],_0x5ccf3d['filters']));if(_0x1d9640[_0x9ca5('0x43')][_0x9ca5('0x51')]){_0x20bda1[_0x9ca5('0x4f')]=_[_0x9ca5('0x52')](_0x20bda1['where'],{'$or':_[_0x9ca5('0x3d')](_0x20bda1[_0x9ca5('0x46')],function(_0x536df9){var _0x32d898={};_0x32d898[_0x536df9]={'$like':'%'+_0x1d9640['query'][_0x9ca5('0x51')]+'%'};return _0x32d898;})});}_0x20bda1=_['merge']({},_0x20bda1,_0x1d9640['options']);return _0x4c4bf7[_0x9ca5('0x6f')](_0x20bda1);}})[_0x9ca5('0x1f')](function(_0x5d53eb){if(_0x5d53eb){_0x2257cf=_0x5d53eb[_0x9ca5('0x49')];if(!_0x1d9640[_0x9ca5('0x43')]['hasOwnProperty'](_0x9ca5('0x4c'))){_0x20bda1[_0x9ca5('0x30')]=qs[_0x9ca5('0x30')](_0x1d9640[_0x9ca5('0x43')][_0x9ca5('0x30')]);_0x20bda1[_0x9ca5('0x2e')]=qs[_0x9ca5('0x2e')](_0x1d9640[_0x9ca5('0x43')][_0x9ca5('0x2e')]);}return _0x4c4bf7[_0x9ca5('0x6f')](_0x20bda1);}})[_0x9ca5('0x1f')](function(_0x13b6d3){if(_0x13b6d3){return _0x13b6d3?{'count':_0x2257cf,'rows':_0x13b6d3}:null;}})['then'](respondWithResult(_0x21ded8,null))[_0x9ca5('0x2a')](handleError(_0x21ded8,null));};exports[_0x9ca5('0x70')]=function(_0x2b558b,_0x5e1441,_0x10bacd){var _0x34e82d=_0x2b558b[_0x9ca5('0x62')][_0x9ca5('0x71')];return db[_0x9ca5('0x72')][_0x9ca5('0x56')]({'where':{'id':_0x34e82d},'attributes':['id'],'include':[{'model':db[_0x9ca5('0x68')],'as':_0x9ca5('0x73'),'attributes':['id','name',_0x9ca5('0x74'),_0x9ca5('0x75'),_0x9ca5('0x76')],'raw':!![]}]})[_0x9ca5('0x1f')](function(_0x4f3306){if(_0x4f3306){var _0x3b1a68=_[_0x9ca5('0x77')](_0x4f3306,function(_0x17c22c){var _0x28a0a8=_0x17c22c[_0x9ca5('0x38')]({'plain':!![]});return _0x28a0a8[_0x9ca5('0x73')];});return db[_0x9ca5('0x3e')]['find']({'where':{'id':_0x2b558b[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](function(_0x3c4c70){return db[_0x9ca5('0x78')][_0x9ca5('0x79')](function(_0x5e08b5){return _0x3c4c70[_0x9ca5('0x70')](_0x34e82d,{'transaction':_0x5e08b5})[_0x9ca5('0x1f')](function(){return BPromise['each'](_0x3b1a68,function(_0x174b31){return db[_0x9ca5('0x66')][_0x9ca5('0x7a')]({'where':{'UserId':_0x174b31['id'],'ChatQueueId':_0x2b558b[_0x9ca5('0x59')]['id']},'transaction':_0x5e08b5});});})['then'](function(){_0x3b1a68[_0x9ca5('0x7b')](function(_0x5e26c1){socket['emit']('userChatQueue:save',{'UserId':_0x5e26c1['id'],'ChatQueueId':_0x3c4c70['id']});});});});});}})[_0x9ca5('0x1f')](respondWithStatusCode(_0x5e1441,null))[_0x9ca5('0x2a')](handleError(_0x5e1441,null));};exports[_0x9ca5('0x7c')]=function(_0x2cf3df,_0x158b14,_0x2c94b1){return db[_0x9ca5('0x72')][_0x9ca5('0x56')]({'where':{'id':_0x2cf3df[_0x9ca5('0x43')][_0x9ca5('0x71')]},'attributes':['id'],'include':[{'model':db[_0x9ca5('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9ca5('0x1f')](handleEntityNotFound(_0x158b14,null))[_0x9ca5('0x1f')](function(_0x214b8a){var _0x357008=_['map'](_0x214b8a,'id');var _0x46fffa=[];var _0x57705b=[];var _0x2f89d2=squel[_0x9ca5('0x7d')]();_0x2f89d2[_0x9ca5('0x7e')](_0x9ca5('0x7f'))[_0x9ca5('0x80')](_0x9ca5('0x81'),'tq')['join'](_0x9ca5('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9ca5('0x4f')]('ChatQueueId\x20=\x20?',_0x2cf3df['params']['id']);for(var _0x31e1f3=0x0;_0x31e1f3<_0x214b8a['length'];_0x31e1f3+=0x1){let _0x4522a3=_0x214b8a[_0x31e1f3];for(var _0x36cdd4=0x0;_0x36cdd4<_0x4522a3[_0x9ca5('0x73')][_0x9ca5('0x49')];_0x36cdd4+=0x1){let _0x24e8d1=_0x4522a3[_0x9ca5('0x73')][_0x36cdd4];var _0x4e9ccb=_0x2f89d2[_0x9ca5('0x83')]();_0x4e9ccb[_0x9ca5('0x4f')](_0x9ca5('0x84'),_0x24e8d1['id']);_0x57705b[_0x9ca5('0x85')](db[_0x9ca5('0x78')][_0x9ca5('0x43')](_0x4e9ccb[_0x9ca5('0x86')](),{'type':db[_0x9ca5('0x78')][_0x9ca5('0x87')][_0x9ca5('0x88')]})[_0x9ca5('0x1f')](function(_0xcc0dff){if(_0xcc0dff['length']===0x1){return _0x24e8d1['id'];}else{var _0x5ccde6=_[_0x9ca5('0x89')](_[_0x9ca5('0x3d')](_0xcc0dff,_0x9ca5('0x8a')),function(_0x5e3647){return _['includes'](_0x357008,_0x5e3647);});if(_0x5ccde6){return _0x24e8d1['id'];}}}));}}return BPromise[_0x9ca5('0x8b')](_0x57705b)[_0x9ca5('0x1f')](function(_0x4649ea){_0x46fffa=_(_0x46fffa)[_0x9ca5('0x8c')](_0x4649ea)[_0x9ca5('0x8d')]()[_0x9ca5('0x8e')]();return db['ChatQueue'][_0x9ca5('0x5b')]({'where':{'id':_0x2cf3df['params']['id']}})[_0x9ca5('0x1f')](function(_0x128a5d){return db[_0x9ca5('0x78')]['transaction'](function(_0x17ddf1){return _0x128a5d[_0x9ca5('0x7c')](_0x2cf3df[_0x9ca5('0x43')][_0x9ca5('0x71')],{'transaction':_0x17ddf1})[_0x9ca5('0x1f')](function(){if(!_['isEmpty'](_0x46fffa)){return _0x128a5d[_0x9ca5('0x8f')](_0x46fffa,{'transaction':_0x17ddf1});}})['then'](function(){_0x46fffa[_0x9ca5('0x7b')](function(_0x37eb83){socket[_0x9ca5('0x90')](_0x9ca5('0x91'),{'UserId':_0x37eb83,'ChatQueueId':_0x128a5d['id']});});});});});});})[_0x9ca5('0x1f')](respondWithStatusCode(_0x158b14,null))[_0x9ca5('0x2a')](handleError(_0x158b14,null));};exports['addAgents']=function(_0x39f27c,_0x19d076,_0x4f4c32){return db[_0x9ca5('0x3e')][_0x9ca5('0x5b')]({'where':{'id':_0x39f27c[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](handleEntityNotFound(_0x19d076,null))[_0x9ca5('0x1f')](function(_0x3507fc){if(_0x3507fc){return _0x3507fc[_0x9ca5('0x92')](_0x39f27c[_0x9ca5('0x62')][_0x9ca5('0x71')],_[_0x9ca5('0x93')](_0x39f27c[_0x9ca5('0x62')],[_0x9ca5('0x71'),'id'])||{})[_0x9ca5('0x94')](function(_0x31f368){for(var _0x2be27c=0x0;_0x2be27c<_0x39f27c['body'][_0x9ca5('0x71')][_0x9ca5('0x49')];_0x2be27c+=0x1){socket[_0x9ca5('0x90')]('userChatQueue:save',{'UserId':Number(_0x39f27c['body'][_0x9ca5('0x71')][_0x2be27c]),'ChatQueueId':Number(_0x39f27c[_0x9ca5('0x59')]['id'])});}return _0x31f368;});}})[_0x9ca5('0x1f')](respondWithResult(_0x19d076,null))[_0x9ca5('0x2a')](handleError(_0x19d076,null));};exports[_0x9ca5('0x8f')]=function(_0x5cefc1,_0x18cee8,_0x1a1485){return db[_0x9ca5('0x3e')][_0x9ca5('0x5b')]({'where':{'id':_0x5cefc1[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](handleEntityNotFound(_0x18cee8,null))[_0x9ca5('0x1f')](function(_0x59b0f8){if(_0x59b0f8){return _0x59b0f8[_0x9ca5('0x8f')](_0x5cefc1[_0x9ca5('0x43')]['ids'])[_0x9ca5('0x1f')](function(){if(_[_0x9ca5('0x95')](_0x5cefc1[_0x9ca5('0x43')][_0x9ca5('0x71')])){for(var _0x4509f3=0x0;_0x4509f3<_0x5cefc1[_0x9ca5('0x43')][_0x9ca5('0x71')][_0x9ca5('0x49')];_0x4509f3+=0x1){socket[_0x9ca5('0x90')](_0x9ca5('0x91'),{'UserId':Number(_0x5cefc1['query']['ids'][_0x4509f3]),'ChatQueueId':Number(_0x5cefc1[_0x9ca5('0x59')]['id'])});}}else{socket['emit'](_0x9ca5('0x91'),{'UserId':Number(_0x5cefc1[_0x9ca5('0x43')][_0x9ca5('0x71')]),'ChatQueueId':Number(_0x5cefc1[_0x9ca5('0x59')]['id'])});}});}})[_0x9ca5('0x1f')](respondWithStatusCode(_0x18cee8,null))[_0x9ca5('0x2a')](handleError(_0x18cee8,null));};exports['getAgents']=function(_0x340cdc,_0x315ba1,_0x430123){var _0x5ba063={};var _0x2bdcf7={};var _0xed0861;var _0x582594;return db[_0x9ca5('0x3e')][_0x9ca5('0x65')]({'where':{'id':_0x340cdc[_0x9ca5('0x59')]['id']}})['then'](handleEntityNotFound(_0x315ba1,null))[_0x9ca5('0x1f')](function(_0x995578){if(_0x995578){_0xed0861=_0x995578;_0x2bdcf7['model']=_[_0x9ca5('0x44')](db['User'][_0x9ca5('0x3f')]);_0x2bdcf7[_0x9ca5('0x43')]=_['keys'](_0x340cdc[_0x9ca5('0x43')]);_0x2bdcf7[_0x9ca5('0x45')]=_[_0x9ca5('0x47')](_0x2bdcf7[_0x9ca5('0x4a')],_0x2bdcf7[_0x9ca5('0x43')]);_0x5ba063[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x2bdcf7[_0x9ca5('0x4a')],qs[_0x9ca5('0x48')](_0x340cdc['query']['fields']));_0x5ba063[_0x9ca5('0x46')]=_0x5ba063[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x5ba063['attributes']:_0x2bdcf7[_0x9ca5('0x4a')];_0x5ba063[_0x9ca5('0x4d')]=qs['sort'](_0x340cdc[_0x9ca5('0x43')]['sort']);_0x5ba063[_0x9ca5('0x4f')]=qs[_0x9ca5('0x45')](_[_0x9ca5('0x50')](_0x340cdc[_0x9ca5('0x43')],_0x2bdcf7[_0x9ca5('0x45')]));if(_0x340cdc[_0x9ca5('0x43')][_0x9ca5('0x51')]){_0x5ba063[_0x9ca5('0x4f')]=_[_0x9ca5('0x52')](_0x5ba063[_0x9ca5('0x4f')],{'$or':_[_0x9ca5('0x3d')](_0x5ba063[_0x9ca5('0x46')],function(_0x4d04b6){var _0x19ebad={};_0x19ebad[_0x4d04b6]={'$like':'%'+_0x340cdc['query']['filter']+'%'};return _0x19ebad;})});}_0x5ba063=_[_0x9ca5('0x52')]({},_0x5ba063,_0x340cdc[_0x9ca5('0x54')]);return _0xed0861[_0x9ca5('0x96')](_0x5ba063);}})[_0x9ca5('0x1f')](function(_0x51bc80){if(_0x51bc80){_0x582594=_0x51bc80[_0x9ca5('0x49')];if(!_0x340cdc[_0x9ca5('0x43')][_0x9ca5('0x4b')](_0x9ca5('0x4c'))){_0x5ba063[_0x9ca5('0x30')]=qs[_0x9ca5('0x30')](_0x340cdc[_0x9ca5('0x43')][_0x9ca5('0x30')]);_0x5ba063[_0x9ca5('0x2e')]=qs[_0x9ca5('0x2e')](_0x340cdc[_0x9ca5('0x43')][_0x9ca5('0x2e')]);}return _0xed0861[_0x9ca5('0x96')](_0x5ba063);}})[_0x9ca5('0x1f')](function(_0x3192b8){if(_0x3192b8){return _0x3192b8?{'count':_0x582594,'rows':_0x3192b8}:null;}})['then'](respondWithResult(_0x315ba1,null))[_0x9ca5('0x2a')](handleError(_0x315ba1,null));};
\ No newline at end of file
+var _0x50c2=['UserChatQueue','nolimit','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','chatPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userChatQueue:remove','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','end','status','json','offset','undefined','limit','count','set','apply','reject','then','ChatQueues','UserProfileResource','destroy','sendStatus','stack','name','send','map','ChatQueue','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','length','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne'];(function(_0xe8668f,_0x42446c){var _0xf3d4ff=function(_0x5447d6){while(--_0x5447d6){_0xe8668f['push'](_0xe8668f['shift']());}};_0xf3d4ff(++_0x42446c);}(_0x50c2,0x1e8));var _0x250c=function(_0x4a7244,_0x2eb6d3){_0x4a7244=_0x4a7244-0x0;var _0x551233=_0x50c2[_0x4a7244];return _0x551233;};'use strict';var emlformat=require(_0x250c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x250c('0x1'));var jsonpatch=require(_0x250c('0x2'));var rp=require('request-promise');var moment=require(_0x250c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x250c('0x4'));var util=require(_0x250c('0x5'));var path=require(_0x250c('0x6'));var sox=require(_0x250c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x250c('0x8'));var _=require(_0x250c('0x9'));var squel=require(_0x250c('0xa'));var crypto=require(_0x250c('0xb'));var jsforce=require(_0x250c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x250c('0xd'));var Redis=require('ioredis');var authService=require(_0x250c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x250c('0xf'));var hardwareService=require(_0x250c('0x10'));var logger=require(_0x250c('0x11'))('api');var utils=require(_0x250c('0x12'));var config=require(_0x250c('0x13'));var licenseUtil=require(_0x250c('0x14'));var db=require(_0x250c('0x15'))['db'];config[_0x250c('0x16')]=_[_0x250c('0x17')](config[_0x250c('0x16')],{'host':_0x250c('0x18'),'port':0x18eb});var socket=require(_0x250c('0x19'))(new Redis(config['redis']));require(_0x250c('0x1a'))[_0x250c('0x1b')](socket);var jayson=require(_0x250c('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb44357,_0x1d7263,_0x1a90db,_0x59f7fe){return new BPromise(function(_0x1c90b3,_0x2fdf70){var _0x3f36bb=_0x59f7fe||client;return _0x3f36bb['request'](_0xb44357,_0x1a90db)['then'](function(_0x2feecf){logger['info'](_0x250c('0x1d'),_0x1d7263,'request\x20sent');logger[_0x250c('0x1e')](_0x250c('0x1f'),_0x1d7263,'request\x20sent',JSON[_0x250c('0x20')](_0x2feecf));if(_0x2feecf[_0x250c('0x21')]){if(_0x2feecf['error'][_0x250c('0x22')]===0x1f4){logger[_0x250c('0x21')](_0x250c('0x1d'),_0x1d7263,_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);return _0x2fdf70(_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);}logger[_0x250c('0x21')](_0x250c('0x1d'),_0x1d7263,_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);return _0x1c90b3(_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);}else{logger[_0x250c('0x24')]('ChatQueue,\x20%s,\x20%s',_0x1d7263,_0x250c('0x25'));_0x1c90b3(_0x2feecf[_0x250c('0x26')][_0x250c('0x23')]);}})[_0x250c('0x27')](function(_0x24204a){logger['error'](_0x250c('0x1d'),_0x1d7263,_0x24204a);_0x2fdf70(_0x24204a);});});}function respondWithStatusCode(_0x40239c,_0x2b3fce){_0x2b3fce=_0x2b3fce||0xcc;return function(_0x4a5ab1){if(_0x4a5ab1){return _0x40239c['sendStatus'](_0x2b3fce);}return _0x40239c['status'](_0x2b3fce)[_0x250c('0x28')]();};}function respondWithResult(_0x595900,_0x2bb0f8){_0x2bb0f8=_0x2bb0f8||0xc8;return function(_0x38c2a5){if(_0x38c2a5){return _0x595900[_0x250c('0x29')](_0x2bb0f8)[_0x250c('0x2a')](_0x38c2a5);}};}function respondWithFilteredResult(_0xaca396,_0x4c388d){return function(_0x4a2ea1){if(_0x4a2ea1){var _0x24d97f=typeof _0x4c388d[_0x250c('0x2b')]===_0x250c('0x2c')&&typeof _0x4c388d[_0x250c('0x2d')]==='undefined';var _0x376af7=_0x4a2ea1[_0x250c('0x2e')];var _0x353ee5=_0x24d97f?0x0:_0x4c388d[_0x250c('0x2b')];var _0x53e3c0=_0x24d97f?_0x4a2ea1['count']:_0x4c388d['offset']+_0x4c388d['limit'];var _0x1d0685;if(_0x53e3c0>=_0x376af7){_0x53e3c0=_0x376af7;_0x1d0685=0xc8;}else{_0x1d0685=0xce;}_0xaca396['status'](_0x1d0685);return _0xaca396[_0x250c('0x2f')]('Content-Range',_0x353ee5+'-'+_0x53e3c0+'/'+_0x376af7)[_0x250c('0x2a')](_0x4a2ea1);}return null;};}function patchUpdates(_0x590bd8){return function(_0x2645a9){try{jsonpatch[_0x250c('0x30')](_0x2645a9,_0x590bd8,!![]);}catch(_0x176b6a){return BPromise[_0x250c('0x31')](_0x176b6a);}return _0x2645a9['save']();};}function saveUpdates(_0x1bebfb,_0x2a8691){return function(_0x276ddf){if(_0x276ddf){return _0x276ddf['update'](_0x1bebfb)[_0x250c('0x32')](function(_0x208c04){return _0x208c04;});}return null;};}function removeEntity(_0x387119,_0x40e18f){return function(_0xaad7e5){if(_0xaad7e5){return _0xaad7e5['destroy']()['then'](function(){var _0x549a53=_0xaad7e5['get']({'plain':!![]});var _0x38d75b=_0x250c('0x33');return db[_0x250c('0x34')][_0x250c('0x35')]({'where':{'type':_0x38d75b,'resourceId':_0x549a53['id']}})['then'](function(){return _0xaad7e5;});})[_0x250c('0x32')](function(){_0x387119[_0x250c('0x29')](0xcc)[_0x250c('0x28')]();});}};}function handleEntityNotFound(_0x19e43c,_0x50189c){return function(_0x3b3c2b){if(!_0x3b3c2b){_0x19e43c[_0x250c('0x36')](0x194);}return _0x3b3c2b;};}function handleError(_0x19cc86,_0x4d26d7){_0x4d26d7=_0x4d26d7||0x1f4;return function(_0x2b6e0e){logger[_0x250c('0x21')](_0x2b6e0e[_0x250c('0x37')]);if(_0x2b6e0e[_0x250c('0x38')]){delete _0x2b6e0e[_0x250c('0x38')];}_0x19cc86[_0x250c('0x29')](_0x4d26d7)[_0x250c('0x39')](_0x2b6e0e);};}exports['index']=function(_0x3744a4,_0x442de6){var _0x1501ff={},_0x3fe6db={},_0x38b6a4={'count':0x0,'rows':[]};var _0x408673=_[_0x250c('0x3a')](db[_0x250c('0x3b')][_0x250c('0x3c')],function(_0xda987d){return{'name':_0xda987d[_0x250c('0x3d')],'type':_0xda987d['type'][_0x250c('0x3e')]};});_0x3fe6db[_0x250c('0x3f')]=_[_0x250c('0x3a')](_0x408673,_0x250c('0x38'));_0x3fe6db[_0x250c('0x40')]=_['keys'](_0x3744a4['query']);_0x3fe6db[_0x250c('0x41')]=_[_0x250c('0x42')](_0x3fe6db['model'],_0x3fe6db['query']);_0x1501ff['attributes']=_[_0x250c('0x42')](_0x3fe6db[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x3744a4['query']['fields']));_0x1501ff[_0x250c('0x44')]=_0x1501ff[_0x250c('0x44')]['length']?_0x1501ff['attributes']:_0x3fe6db[_0x250c('0x3f')];if(!_0x3744a4[_0x250c('0x40')][_0x250c('0x45')]('nolimit')){_0x1501ff[_0x250c('0x2d')]=qs[_0x250c('0x2d')](_0x3744a4[_0x250c('0x40')]['limit']);_0x1501ff['offset']=qs[_0x250c('0x2b')](_0x3744a4[_0x250c('0x40')][_0x250c('0x2b')]);}_0x1501ff[_0x250c('0x46')]=qs[_0x250c('0x47')](_0x3744a4[_0x250c('0x40')][_0x250c('0x47')]);_0x1501ff[_0x250c('0x48')]=qs['filters'](_[_0x250c('0x49')](_0x3744a4[_0x250c('0x40')],_0x3fe6db['filters']),_0x408673);if(_0x3744a4[_0x250c('0x40')][_0x250c('0x4a')]){_0x1501ff['where']=_['merge'](_0x1501ff[_0x250c('0x48')],{'$or':_[_0x250c('0x3a')](_0x408673,function(_0x20440b){if(_0x20440b['type']!==_0x250c('0x4b')){var _0x4f8521={};_0x4f8521[_0x20440b[_0x250c('0x38')]]={'$like':'%'+_0x3744a4['query'][_0x250c('0x4a')]+'%'};return _0x4f8521;}})});}_0x1501ff=_['merge']({},_0x1501ff,_0x3744a4['options']);var _0x40a7aa={'where':_0x1501ff[_0x250c('0x48')]};return db[_0x250c('0x3b')][_0x250c('0x2e')](_0x40a7aa)['then'](function(_0xe0a317){_0x38b6a4['count']=_0xe0a317;if(_0x3744a4[_0x250c('0x40')][_0x250c('0x4c')]){_0x1501ff[_0x250c('0x4d')]=[{'all':!![]}];}return db['ChatQueue'][_0x250c('0x4e')](_0x1501ff);})[_0x250c('0x32')](function(_0x30c2a2){_0x38b6a4[_0x250c('0x4f')]=_0x30c2a2;return _0x38b6a4;})['then'](respondWithFilteredResult(_0x442de6,_0x1501ff))[_0x250c('0x27')](handleError(_0x442de6,null));};exports[_0x250c('0x50')]=function(_0x2d05d6,_0x1a56e8){var _0x512dd5={'raw':!![],'where':{'id':_0x2d05d6[_0x250c('0x51')]['id']}},_0x4b6886={};_0x4b6886[_0x250c('0x3f')]=_[_0x250c('0x52')](db[_0x250c('0x3b')][_0x250c('0x3c')]);_0x4b6886['query']=_['keys'](_0x2d05d6[_0x250c('0x40')]);_0x4b6886[_0x250c('0x41')]=_[_0x250c('0x42')](_0x4b6886[_0x250c('0x3f')],_0x4b6886[_0x250c('0x40')]);_0x512dd5[_0x250c('0x44')]=_[_0x250c('0x42')](_0x4b6886[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x2d05d6[_0x250c('0x40')]['fields']));_0x512dd5[_0x250c('0x44')]=_0x512dd5['attributes'][_0x250c('0x53')]?_0x512dd5[_0x250c('0x44')]:_0x4b6886[_0x250c('0x3f')];if(_0x2d05d6[_0x250c('0x40')][_0x250c('0x4c')]){_0x512dd5['include']=[{'all':!![]}];}_0x512dd5=_[_0x250c('0x54')]({},_0x512dd5,_0x2d05d6[_0x250c('0x55')]);return db[_0x250c('0x3b')][_0x250c('0x56')](_0x512dd5)[_0x250c('0x32')](handleEntityNotFound(_0x1a56e8,null))[_0x250c('0x32')](respondWithResult(_0x1a56e8,null))[_0x250c('0x27')](handleError(_0x1a56e8,null));};exports[_0x250c('0x57')]=function(_0x4bfd34,_0x5549e5){return db[_0x250c('0x3b')][_0x250c('0x57')](_0x4bfd34[_0x250c('0x58')],{})[_0x250c('0x32')](function(_0x39fb27){var _0x385365=_0x4bfd34[_0x250c('0x59')][_0x250c('0x5a')]({'plain':!![]});if(!_0x385365)throw new Error(_0x250c('0x5b'));if(_0x385365['role']===_0x250c('0x59')){var _0x3441a8=_0x39fb27[_0x250c('0x5a')]({'plain':!![]});var _0x376f00='ChatQueues';return db[_0x250c('0x5c')]['find']({'where':{'name':_0x376f00,'userProfileId':_0x385365[_0x250c('0x5d')]},'raw':!![]})[_0x250c('0x32')](function(_0x4c59e5){if(_0x4c59e5&&_0x4c59e5[_0x250c('0x5e')]===0x0){return db[_0x250c('0x34')]['create']({'name':_0x3441a8[_0x250c('0x38')],'resourceId':_0x3441a8['id'],'type':_0x4c59e5[_0x250c('0x38')],'sectionId':_0x4c59e5['id']},{})[_0x250c('0x32')](function(){return _0x39fb27;});}else{return _0x39fb27;}})['catch'](function(_0x412217){logger[_0x250c('0x21')](_0x250c('0x5f'),_0x412217);throw _0x412217;});}return _0x39fb27;})[_0x250c('0x32')](respondWithResult(_0x5549e5,0xc9))[_0x250c('0x27')](handleError(_0x5549e5,null));};exports[_0x250c('0x60')]=function(_0x2fd085,_0x43872b){if(_0x2fd085[_0x250c('0x58')]['id']){delete _0x2fd085['body']['id'];}return db[_0x250c('0x3b')]['find']({'where':{'id':_0x2fd085[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x43872b,null))[_0x250c('0x32')](saveUpdates(_0x2fd085[_0x250c('0x58')],null))['then'](respondWithResult(_0x43872b,null))[_0x250c('0x27')](handleError(_0x43872b,null));};exports[_0x250c('0x35')]=function(_0x3cddd2,_0x1d32ad){return db[_0x250c('0x3b')]['find']({'where':{'id':_0x3cddd2[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x1d32ad,null))[_0x250c('0x32')](removeEntity(_0x1d32ad,null))[_0x250c('0x27')](handleError(_0x1d32ad,null));};exports[_0x250c('0x61')]=function(_0x2596b8,_0x4bc91a){return db[_0x250c('0x3b')][_0x250c('0x61')]()[_0x250c('0x32')](respondWithResult(_0x4bc91a,null))[_0x250c('0x27')](handleError(_0x4bc91a,null));};exports[_0x250c('0x62')]=function(_0x1b2976,_0x1cb3ac,_0x26bcbd){var _0x3f1b7a={'raw':!![],'where':{}},_0xc6569={},_0x2d8ddd;return db[_0x250c('0x3b')][_0x250c('0x63')]({'where':{'id':_0x1b2976['params']['id']}})['then'](handleEntityNotFound(_0x1cb3ac,null))[_0x250c('0x32')](function(_0x247f75){if(_0x247f75){_0x2d8ddd=_0x247f75[_0x250c('0x5a')]({'plain':!![]});_0xc6569[_0x250c('0x3f')]=_['keys'](db[_0x250c('0x64')][_0x250c('0x3c')]);_0xc6569['query']=_[_0x250c('0x52')](_0x1b2976[_0x250c('0x40')]);_0xc6569[_0x250c('0x41')]=_['intersection'](_0xc6569[_0x250c('0x3f')],_0xc6569[_0x250c('0x40')]);_0x3f1b7a['attributes']=_['intersection'](_0xc6569['model'],qs[_0x250c('0x43')](_0x1b2976[_0x250c('0x40')][_0x250c('0x43')]));_0x3f1b7a[_0x250c('0x44')]=_0x3f1b7a[_0x250c('0x44')][_0x250c('0x53')]?_0x3f1b7a[_0x250c('0x44')]:_0xc6569[_0x250c('0x3f')];if(!_0x1b2976['query'][_0x250c('0x45')](_0x250c('0x65'))){_0x3f1b7a[_0x250c('0x2d')]=qs[_0x250c('0x2d')](_0x1b2976['query'][_0x250c('0x2d')]);_0x3f1b7a['offset']=qs['offset'](_0x1b2976[_0x250c('0x40')]['offset']);}_0x3f1b7a['order']=qs['sort'](_0x1b2976['query'][_0x250c('0x47')]);_0x3f1b7a['where']=qs[_0x250c('0x41')](_[_0x250c('0x49')](_0x1b2976[_0x250c('0x40')],_0xc6569[_0x250c('0x41')]));_0x3f1b7a[_0x250c('0x48')]['ChatQueueId']=_0x247f75['id'];if(_0x1b2976[_0x250c('0x40')][_0x250c('0x4a')]){_0x3f1b7a['where']=_[_0x250c('0x54')](_0x3f1b7a[_0x250c('0x48')],{'$or':_['map'](_0x3f1b7a[_0x250c('0x44')],function(_0x3e479f){var _0x22e983={};_0x22e983[_0x3e479f]={'$like':'%'+_0x1b2976['query'][_0x250c('0x4a')]+'%'};return _0x22e983;})});}_0x3f1b7a=_[_0x250c('0x54')]({},_0x3f1b7a,_0x1b2976['options']);return db[_0x250c('0x64')][_0x250c('0x4e')](_0x3f1b7a);}})[_0x250c('0x32')](function(_0x1e8698){if(_0x1e8698){return db[_0x250c('0x66')][_0x250c('0x67')]({'where':{'id':_[_0x250c('0x3a')](_0x1e8698,_0x250c('0x68')),'role':_0x250c('0x69')},'attributes':['id','name','chatPause',_0x250c('0x6a'),_0x250c('0x6b')]});}})[_0x250c('0x32')](function(_0x14b892){if(_0x14b892){return{'count':_0x14b892[_0x250c('0x2e')],'rows':_[_0x250c('0x3a')](_0x14b892[_0x250c('0x4f')],function(_0x3d2574){return{'membername':_0x3d2574[_0x250c('0x38')],'UserId':_0x3d2574['id'],'queue_name':_0x2d8ddd[_0x250c('0x38')],'ChatQueueId':_0x2d8ddd['id'],'interface':util[_0x250c('0x6c')]('%s/%s',_0x250c('0x6d'),_0x3d2574['name']),'penalty':0x0,'paused':_0x3d2574[_0x250c('0x6e')],'createdAt':_0x3d2574[_0x250c('0x6b')],'updatedAt':_0x3d2574[_0x250c('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x250c('0x32')](respondWithFilteredResult(_0x1cb3ac,_0x3f1b7a))['catch'](handleError(_0x1cb3ac,null));};exports[_0x250c('0x6f')]=function(_0x43160d,_0x99aeef,_0x28a684){var _0x61a35={};var _0xf28a3b={};var _0x7bc1a6;var _0x302996;return db[_0x250c('0x3b')]['findOne']({'where':{'id':_0x43160d[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x99aeef,null))['then'](function(_0x4b3687){if(_0x4b3687){_0x7bc1a6=_0x4b3687;_0xf28a3b[_0x250c('0x3f')]=_[_0x250c('0x52')](db[_0x250c('0x70')][_0x250c('0x3c')]);_0xf28a3b[_0x250c('0x40')]=_[_0x250c('0x52')](_0x43160d[_0x250c('0x40')]);_0xf28a3b['filters']=_[_0x250c('0x42')](_0xf28a3b['model'],_0xf28a3b[_0x250c('0x40')]);_0x61a35[_0x250c('0x44')]=_[_0x250c('0x42')](_0xf28a3b[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x43160d[_0x250c('0x40')]['fields']));_0x61a35[_0x250c('0x44')]=_0x61a35[_0x250c('0x44')][_0x250c('0x53')]?_0x61a35[_0x250c('0x44')]:_0xf28a3b[_0x250c('0x3f')];_0x61a35[_0x250c('0x46')]=qs[_0x250c('0x47')](_0x43160d[_0x250c('0x40')][_0x250c('0x47')]);_0x61a35[_0x250c('0x48')]=qs['filters'](_[_0x250c('0x49')](_0x43160d[_0x250c('0x40')],_0xf28a3b[_0x250c('0x41')]));if(_0x43160d[_0x250c('0x40')][_0x250c('0x4a')]){_0x61a35[_0x250c('0x48')]=_['merge'](_0x61a35[_0x250c('0x48')],{'$or':_[_0x250c('0x3a')](_0x61a35['attributes'],function(_0x50feda){var _0x73b10={};_0x73b10[_0x50feda]={'$like':'%'+_0x43160d[_0x250c('0x40')]['filter']+'%'};return _0x73b10;})});}_0x61a35=_[_0x250c('0x54')]({},_0x61a35,_0x43160d[_0x250c('0x55')]);return _0x7bc1a6[_0x250c('0x6f')](_0x61a35);}})[_0x250c('0x32')](function(_0x52effa){if(_0x52effa){_0x302996=_0x52effa[_0x250c('0x53')];if(!_0x43160d['query'][_0x250c('0x45')](_0x250c('0x65'))){_0x61a35[_0x250c('0x2d')]=qs['limit'](_0x43160d[_0x250c('0x40')]['limit']);_0x61a35[_0x250c('0x2b')]=qs[_0x250c('0x2b')](_0x43160d[_0x250c('0x40')][_0x250c('0x2b')]);}return _0x7bc1a6['getTeams'](_0x61a35);}})[_0x250c('0x32')](function(_0x5a4131){if(_0x5a4131){return _0x5a4131?{'count':_0x302996,'rows':_0x5a4131}:null;}})[_0x250c('0x32')](respondWithResult(_0x99aeef,null))[_0x250c('0x27')](handleError(_0x99aeef,null));};exports[_0x250c('0x71')]=function(_0xd31f5,_0x353b93,_0x25017e){var _0x1b2052=_0xd31f5[_0x250c('0x58')][_0x250c('0x72')];return db[_0x250c('0x70')]['findAll']({'where':{'id':_0x1b2052},'attributes':['id'],'include':[{'model':db['User'],'as':_0x250c('0x73'),'attributes':['id',_0x250c('0x38'),_0x250c('0x74'),_0x250c('0x75'),'interface'],'raw':!![]}]})[_0x250c('0x32')](function(_0x30130a){if(_0x30130a){var _0x7c3a0c=_[_0x250c('0x76')](_0x30130a,function(_0x4d7402){var _0x2fd7a5=_0x4d7402['get']({'plain':!![]});return _0x2fd7a5[_0x250c('0x73')];});return db['ChatQueue'][_0x250c('0x56')]({'where':{'id':_0xd31f5[_0x250c('0x51')]['id']}})['then'](function(_0x259adb){return db[_0x250c('0x77')][_0x250c('0x78')](function(_0x1befbe){return _0x259adb[_0x250c('0x71')](_0x1b2052,{'transaction':_0x1befbe})[_0x250c('0x32')](function(){return BPromise[_0x250c('0x79')](_0x7c3a0c,function(_0x4d9ae0){return db[_0x250c('0x64')][_0x250c('0x7a')]({'where':{'UserId':_0x4d9ae0['id'],'ChatQueueId':_0xd31f5['params']['id']},'transaction':_0x1befbe});});})[_0x250c('0x32')](function(){_0x7c3a0c[_0x250c('0x7b')](function(_0x5b46be){socket[_0x250c('0x7c')](_0x250c('0x7d'),{'UserId':_0x5b46be['id'],'ChatQueueId':_0x259adb['id']});});});});});}})[_0x250c('0x32')](respondWithStatusCode(_0x353b93,null))['catch'](handleError(_0x353b93,null));};exports[_0x250c('0x7e')]=function(_0x53d06d,_0x474be3,_0x1f517c){return db[_0x250c('0x70')][_0x250c('0x4e')]({'where':{'id':_0x53d06d[_0x250c('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0x250c('0x66')],'as':_0x250c('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x474be3,null))[_0x250c('0x32')](function(_0x3dcfb3){var _0x118712=_['map'](_0x3dcfb3,'id');var _0x5065f0=[];var _0x48d631=[];var _0x3cc2ae=squel['select']();_0x3cc2ae[_0x250c('0x7f')](_0x250c('0x80'))['from']('team_has_chat_queues','tq')[_0x250c('0x81')](_0x250c('0x82'),'ut',_0x250c('0x83'))[_0x250c('0x48')]('ChatQueueId\x20=\x20?',_0x53d06d[_0x250c('0x51')]['id']);for(var _0x1d974d=0x0;_0x1d974d<_0x3dcfb3[_0x250c('0x53')];_0x1d974d+=0x1){let _0x140fa1=_0x3dcfb3[_0x1d974d];for(var _0x35855d=0x0;_0x35855d<_0x140fa1[_0x250c('0x73')][_0x250c('0x53')];_0x35855d+=0x1){let _0x572408=_0x140fa1[_0x250c('0x73')][_0x35855d];var _0x2c9c10=_0x3cc2ae[_0x250c('0x84')]();_0x2c9c10[_0x250c('0x48')]('ut.UserId\x20=\x20?',_0x572408['id']);_0x48d631['push'](db['sequelize'][_0x250c('0x40')](_0x2c9c10[_0x250c('0x85')](),{'type':db['sequelize']['QueryTypes'][_0x250c('0x86')]})['then'](function(_0x2a30c9){if(_0x2a30c9[_0x250c('0x53')]===0x1){return _0x572408['id'];}else{var _0x5e7274=_[_0x250c('0x87')](_['map'](_0x2a30c9,_0x250c('0x88')),function(_0x53d14f){return _[_0x250c('0x89')](_0x118712,_0x53d14f);});if(_0x5e7274){return _0x572408['id'];}}}));}}return BPromise[_0x250c('0x8a')](_0x48d631)[_0x250c('0x32')](function(_0x25220f){_0x5065f0=_(_0x5065f0)[_0x250c('0x8b')](_0x25220f)['compact']()['value']();return db[_0x250c('0x3b')][_0x250c('0x56')]({'where':{'id':_0x53d06d['params']['id']}})[_0x250c('0x32')](function(_0x4b9e34){return db[_0x250c('0x77')][_0x250c('0x78')](function(_0xd9e69f){return _0x4b9e34[_0x250c('0x7e')](_0x53d06d[_0x250c('0x40')][_0x250c('0x72')],{'transaction':_0xd9e69f})[_0x250c('0x32')](function(){if(!_[_0x250c('0x8c')](_0x5065f0)){return _0x4b9e34[_0x250c('0x8d')](_0x5065f0,{'transaction':_0xd9e69f});}})['then'](function(){_0x5065f0[_0x250c('0x7b')](function(_0x37c10d){socket['emit'](_0x250c('0x8e'),{'UserId':_0x37c10d,'ChatQueueId':_0x4b9e34['id']});});});});});});})[_0x250c('0x32')](respondWithStatusCode(_0x474be3,null))[_0x250c('0x27')](handleError(_0x474be3,null));};exports['addAgents']=function(_0x4f8fcd,_0x4bcc6f,_0x42253f){return db['ChatQueue'][_0x250c('0x56')]({'where':{'id':_0x4f8fcd[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x4bcc6f,null))[_0x250c('0x32')](function(_0x2a1604){if(_0x2a1604){return _0x2a1604['addAgents'](_0x4f8fcd[_0x250c('0x58')]['ids'],_[_0x250c('0x8f')](_0x4f8fcd[_0x250c('0x58')],[_0x250c('0x72'),'id'])||{})[_0x250c('0x90')](function(_0x128f27){for(var _0x564e8f=0x0;_0x564e8f<_0x4f8fcd[_0x250c('0x58')][_0x250c('0x72')][_0x250c('0x53')];_0x564e8f+=0x1){socket[_0x250c('0x7c')]('userChatQueue:save',{'UserId':Number(_0x4f8fcd[_0x250c('0x58')][_0x250c('0x72')][_0x564e8f]),'ChatQueueId':Number(_0x4f8fcd[_0x250c('0x51')]['id'])});}return _0x128f27;});}})[_0x250c('0x32')](respondWithResult(_0x4bcc6f,null))[_0x250c('0x27')](handleError(_0x4bcc6f,null));};exports[_0x250c('0x8d')]=function(_0x1249a7,_0x27c807,_0x20f128){return db[_0x250c('0x3b')][_0x250c('0x56')]({'where':{'id':_0x1249a7[_0x250c('0x51')]['id']}})['then'](handleEntityNotFound(_0x27c807,null))['then'](function(_0x2632ae){if(_0x2632ae){return _0x2632ae[_0x250c('0x8d')](_0x1249a7['query'][_0x250c('0x72')])[_0x250c('0x32')](function(){if(_[_0x250c('0x91')](_0x1249a7[_0x250c('0x40')][_0x250c('0x72')])){for(var _0x1e3d0b=0x0;_0x1e3d0b<_0x1249a7[_0x250c('0x40')]['ids']['length'];_0x1e3d0b+=0x1){socket[_0x250c('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x1249a7[_0x250c('0x40')][_0x250c('0x72')][_0x1e3d0b]),'ChatQueueId':Number(_0x1249a7[_0x250c('0x51')]['id'])});}}else{socket[_0x250c('0x7c')](_0x250c('0x8e'),{'UserId':Number(_0x1249a7['query']['ids']),'ChatQueueId':Number(_0x1249a7[_0x250c('0x51')]['id'])});}});}})[_0x250c('0x32')](respondWithStatusCode(_0x27c807,null))[_0x250c('0x27')](handleError(_0x27c807,null));};exports['getAgents']=function(_0x115164,_0x27e479,_0x16ef29){var _0x20027f={};var _0x2c3470={};var _0x23d101;var _0x1299e4;return db[_0x250c('0x3b')][_0x250c('0x63')]({'where':{'id':_0x115164['params']['id']}})['then'](handleEntityNotFound(_0x27e479,null))[_0x250c('0x32')](function(_0x1ee55d){if(_0x1ee55d){_0x23d101=_0x1ee55d;_0x2c3470[_0x250c('0x3f')]=_[_0x250c('0x52')](db[_0x250c('0x66')][_0x250c('0x3c')]);_0x2c3470[_0x250c('0x40')]=_[_0x250c('0x52')](_0x115164[_0x250c('0x40')]);_0x2c3470[_0x250c('0x41')]=_[_0x250c('0x42')](_0x2c3470[_0x250c('0x3f')],_0x2c3470[_0x250c('0x40')]);_0x20027f[_0x250c('0x44')]=_['intersection'](_0x2c3470[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x115164[_0x250c('0x40')]['fields']));_0x20027f['attributes']=_0x20027f[_0x250c('0x44')][_0x250c('0x53')]?_0x20027f[_0x250c('0x44')]:_0x2c3470[_0x250c('0x3f')];_0x20027f[_0x250c('0x46')]=qs[_0x250c('0x47')](_0x115164[_0x250c('0x40')][_0x250c('0x47')]);_0x20027f[_0x250c('0x48')]=qs[_0x250c('0x41')](_['pick'](_0x115164['query'],_0x2c3470[_0x250c('0x41')]));if(_0x115164[_0x250c('0x40')]['filter']){_0x20027f[_0x250c('0x48')]=_['merge'](_0x20027f[_0x250c('0x48')],{'$or':_[_0x250c('0x3a')](_0x20027f[_0x250c('0x44')],function(_0x1bf9f0){var _0x49e578={};_0x49e578[_0x1bf9f0]={'$like':'%'+_0x115164[_0x250c('0x40')][_0x250c('0x4a')]+'%'};return _0x49e578;})});}_0x20027f=_[_0x250c('0x54')]({},_0x20027f,_0x115164[_0x250c('0x55')]);return _0x23d101['getAgents'](_0x20027f);}})['then'](function(_0x4c60b2){if(_0x4c60b2){_0x1299e4=_0x4c60b2[_0x250c('0x53')];if(!_0x115164[_0x250c('0x40')]['hasOwnProperty'](_0x250c('0x65'))){_0x20027f[_0x250c('0x2d')]=qs['limit'](_0x115164[_0x250c('0x40')][_0x250c('0x2d')]);_0x20027f[_0x250c('0x2b')]=qs[_0x250c('0x2b')](_0x115164[_0x250c('0x40')][_0x250c('0x2b')]);}return _0x23d101[_0x250c('0x92')](_0x20027f);}})['then'](function(_0xe39f25){if(_0xe39f25){return _0xe39f25?{'count':_0x1299e4,'rows':_0xe39f25}:null;}})['then'](respondWithResult(_0x27e479,null))[_0x250c('0x27')](handleError(_0x27e479,null));};
\ No newline at end of file
diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js
index 1b416bb..e1795aa 100644
--- a/server/api/chatQueue/chatQueue.events.js
+++ b/server/api/chatQueue/chatQueue.events.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x1dc2=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x1da9f9,_0x3b96e3){var _0x3d0bde=function(_0x51bfd3){while(--_0x51bfd3){_0x1da9f9['push'](_0x1da9f9['shift']());}};_0x3d0bde(++_0x3b96e3);}(_0x1dc2,0xb0));var _0x21dc=function(_0x1575d4,_0x3563da){_0x1575d4=_0x1575d4-0x0;var _0x17d732=_0x1dc2[_0x1575d4];return _0x17d732;};'use strict';var EventEmitter=require(_0x21dc('0x0'));var ChatQueue=require(_0x21dc('0x1'))['db'][_0x21dc('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x21dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x21dc('0x4'),'afterDestroy':_0x21dc('0x5')};function emitEvent(_0x135c72){return function(_0x328896,_0x2353e6,_0x6f8b79){ChatQueueEvents[_0x21dc('0x6')](_0x135c72+':'+_0x328896['id'],_0x328896);ChatQueueEvents[_0x21dc('0x6')](_0x135c72,_0x328896);_0x6f8b79(null);};}for(var e in events){if(events[_0x21dc('0x7')](e)){var event=events[e];ChatQueue[_0x21dc('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents;
\ No newline at end of file
+var _0x5430=['exports','../../mysqldb','setMaxListeners','remove','emit','hook'];(function(_0x3f6d5a,_0x2a83c8){var _0x33b363=function(_0x2da4c2){while(--_0x2da4c2){_0x3f6d5a['push'](_0x3f6d5a['shift']());}};_0x33b363(++_0x2a83c8);}(_0x5430,0xc7));var _0x0543=function(_0x4a9874,_0x48f997){_0x4a9874=_0x4a9874-0x0;var _0x26b791=_0x5430[_0x4a9874];return _0x26b791;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0543('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0543('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0543('0x2')};function emitEvent(_0x50274e){return function(_0x5cce70,_0x3b4e30,_0x377152){ChatQueueEvents['emit'](_0x50274e+':'+_0x5cce70['id'],_0x5cce70);ChatQueueEvents[_0x0543('0x3')](_0x50274e,_0x5cce70);_0x377152(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x0543('0x4')](e,emitEvent(event));}}module[_0x0543('0x5')]=ChatQueueEvents;
\ No newline at end of file
diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js
index d10bd5f..8506684 100644
--- a/server/api/chatQueue/chatQueue.model.js
+++ b/server/api/chatQueue/chatQueue.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x0999=['bluebird','request-promise','../../config/environment','./chatQueue.attributes','chat_queues','api'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x0999,0x9b));var _0x9099=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x0999[_0x387dc1];return _0x17567c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9099('0x0'));var moment=require('moment');var BPromise=require(_0x9099('0x1'));var rp=require(_0x9099('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9099('0x3'));var attributes=require(_0x9099('0x4'));module['exports']=function(_0x637c0c,_0x3d2597){return _0x637c0c['define']('ChatQueue',attributes,{'tableName':_0x9099('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd8ba=['exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x375c38,_0x1afa1d){var _0x37076c=function(_0x3a2d0f){while(--_0x3a2d0f){_0x375c38['push'](_0x375c38['shift']());}};_0x37076c(++_0x1afa1d);}(_0xd8ba,0xc7));var _0xad8b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd8ba[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xad8b('0x0'));var util=require(_0xad8b('0x1'));var logger=require(_0xad8b('0x2'))(_0xad8b('0x3'));var moment=require(_0xad8b('0x4'));var BPromise=require(_0xad8b('0x5'));var rp=require(_0xad8b('0x6'));var fs=require('fs');var path=require(_0xad8b('0x7'));var rimraf=require(_0xad8b('0x8'));var config=require(_0xad8b('0x9'));var attributes=require(_0xad8b('0xa'));module[_0xad8b('0xb')]=function(_0x5b8fe6,_0xe75eba){return _0x5b8fe6[_0xad8b('0xc')](_0xad8b('0xd'),attributes,{'tableName':_0xad8b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js
index 6a3bd27..391a5b4 100644
--- a/server/api/chatQueue/chatQueue.rpc.js
+++ b/server/api/chatQueue/chatQueue.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd7a0=['debug','find','raw','ShowChatQueue','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xd7a0,0x163));var _0x0d7a=function(_0x2c58b1,_0x26b3bf){_0x2c58b1=_0x2c58b1-0x0;var _0x32fd71=_0xd7a0[_0x2c58b1];return _0x32fd71;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var moment=require('moment');var BPromise=require(_0x0d7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d7a('0x3'));var db=require(_0x0d7a('0x4'))['db'];var utils=require(_0x0d7a('0x5'));var logger=require(_0x0d7a('0x6'))(_0x0d7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d7a('0x8'));var client=jayson[_0x0d7a('0x9')][_0x0d7a('0xa')]({'port':0x232a});config[_0x0d7a('0xb')]=_[_0x0d7a('0xc')](config[_0x0d7a('0xb')],{'host':_0x0d7a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d7a('0xb')]));require(_0x0d7a('0xe'))[_0x0d7a('0xf')](socket);function respondWithRpcPromise(_0x4688bf,_0x5107c7,_0x410bdd){return new BPromise(function(_0x842056,_0x5064ac){return client[_0x0d7a('0x10')](_0x4688bf,_0x410bdd)[_0x0d7a('0x11')](function(_0x4275a9){logger[_0x0d7a('0x12')](_0x0d7a('0x13'),_0x5107c7,'request\x20sent');logger['debug'](_0x0d7a('0x14'),_0x5107c7,_0x0d7a('0x15'),JSON[_0x0d7a('0x16')](_0x4275a9));if(_0x4275a9['error']){if(_0x4275a9[_0x0d7a('0x17')]['code']===0x1f4){logger['error'](_0x0d7a('0x13'),_0x5107c7,_0x4275a9['error'][_0x0d7a('0x18')]);return _0x5064ac(_0x4275a9[_0x0d7a('0x17')][_0x0d7a('0x18')]);}logger[_0x0d7a('0x17')]('ChatQueue,\x20%s,\x20%s',_0x5107c7,_0x4275a9[_0x0d7a('0x17')][_0x0d7a('0x18')]);return _0x842056(_0x4275a9['error'][_0x0d7a('0x18')]);}else{logger[_0x0d7a('0x12')](_0x0d7a('0x13'),_0x5107c7,_0x0d7a('0x15'));_0x842056(_0x4275a9['result'][_0x0d7a('0x18')]);}})['catch'](function(_0x569285){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5107c7,_0x569285);_0x5064ac(_0x569285);});});}exports[_0x0d7a('0x19')]=function(_0x4c303f){var _0x1c117e=this;return new Promise(function(_0x2264c3,_0x4c997f){return db[_0x0d7a('0x1a')][_0x0d7a('0x1b')]({'raw':_0x4c303f[_0x0d7a('0x1c')]?_0x4c303f[_0x0d7a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4c303f[_0x0d7a('0x1c')]?_0x4c303f[_0x0d7a('0x1c')][_0x0d7a('0x1d')]||null:null,'attributes':_0x4c303f['options']?_0x4c303f['options'][_0x0d7a('0x1e')]||null:null,'limit':_0x4c303f[_0x0d7a('0x1c')]?_0x4c303f[_0x0d7a('0x1c')][_0x0d7a('0x1f')]||null:null,'include':_0x4c303f[_0x0d7a('0x1c')]?_0x4c303f['options'][_0x0d7a('0x20')]?_[_0x0d7a('0x21')](_0x4c303f[_0x0d7a('0x1c')][_0x0d7a('0x20')],function(_0x53fe77){return{'model':db[_0x53fe77['model']],'as':_0x53fe77['as'],'attributes':_0x53fe77[_0x0d7a('0x1e')],'include':_0x53fe77[_0x0d7a('0x20')]?_[_0x0d7a('0x21')](_0x53fe77[_0x0d7a('0x20')],function(_0x2d3631){return{'model':db[_0x2d3631[_0x0d7a('0x22')]],'as':_0x2d3631['as'],'attributes':_0x2d3631[_0x0d7a('0x1e')],'include':_0x2d3631[_0x0d7a('0x20')]?_['map'](_0x2d3631[_0x0d7a('0x20')],function(_0x5e6e05){return{'model':db[_0x5e6e05[_0x0d7a('0x22')]],'as':_0x5e6e05['as'],'attributes':_0x5e6e05[_0x0d7a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d7a('0x11')](function(_0x1ca942){logger[_0x0d7a('0x12')]('GetChatQueue',_0x4c303f);logger[_0x0d7a('0x23')](_0x0d7a('0x19'),_0x4c303f,JSON[_0x0d7a('0x16')](_0x1ca942));_0x2264c3(_0x1ca942);})['catch'](function(_0x223160){logger[_0x0d7a('0x17')]('GetChatQueue',_0x223160[_0x0d7a('0x18')],_0x4c303f);_0x4c997f(_0x1c117e[_0x0d7a('0x17')](0x1f4,_0x223160[_0x0d7a('0x18')]));});});};exports['ShowChatQueue']=function(_0x1229f5){var _0x482c9f=this;return new Promise(function(_0x2a15df,_0x3d976c){return db['ChatQueue'][_0x0d7a('0x24')]({'raw':_0x1229f5[_0x0d7a('0x1c')]?_0x1229f5[_0x0d7a('0x1c')][_0x0d7a('0x25')]===undefined?!![]:![]:!![],'where':_0x1229f5[_0x0d7a('0x1c')]?_0x1229f5[_0x0d7a('0x1c')][_0x0d7a('0x1d')]||null:null,'attributes':_0x1229f5['options']?_0x1229f5[_0x0d7a('0x1c')][_0x0d7a('0x1e')]||null:null,'include':_0x1229f5['options']?_0x1229f5[_0x0d7a('0x1c')]['include']?_['map'](_0x1229f5[_0x0d7a('0x1c')][_0x0d7a('0x20')],function(_0xfebcb9){return{'model':db[_0xfebcb9['model']],'as':_0xfebcb9['as'],'attributes':_0xfebcb9[_0x0d7a('0x1e')],'include':_0xfebcb9[_0x0d7a('0x20')]?_[_0x0d7a('0x21')](_0xfebcb9[_0x0d7a('0x20')],function(_0x2d06b8){return{'model':db[_0x2d06b8[_0x0d7a('0x22')]],'as':_0x2d06b8['as'],'attributes':_0x2d06b8[_0x0d7a('0x1e')],'include':_0x2d06b8[_0x0d7a('0x20')]?_[_0x0d7a('0x21')](_0x2d06b8[_0x0d7a('0x20')],function(_0x1ca02b){return{'model':db[_0x1ca02b[_0x0d7a('0x22')]],'as':_0x1ca02b['as'],'attributes':_0x1ca02b[_0x0d7a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cd533){logger[_0x0d7a('0x12')](_0x0d7a('0x26'),_0x1229f5);logger['debug'](_0x0d7a('0x26'),_0x1229f5,JSON[_0x0d7a('0x16')](_0x5cd533));_0x2a15df(_0x5cd533);})['catch'](function(_0x3b3add){logger[_0x0d7a('0x17')]('ShowChatQueue',_0x3b3add[_0x0d7a('0x18')],_0x1229f5);_0x3d976c(_0x482c9f['error'](0x1f4,_0x3b3add[_0x0d7a('0x18')]));});});};
\ No newline at end of file
+var _0xebc4=['./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','info','GetChatQueue','ChatQueue','then','ShowChatQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis','socket.io-emitter'];(function(_0x1b6f3d,_0x52bddf){var _0x2a3d6d=function(_0x348d0d){while(--_0x348d0d){_0x1b6f3d['push'](_0x1b6f3d['shift']());}};_0x2a3d6d(++_0x52bddf);}(_0xebc4,0xf9));var _0x4ebc=function(_0x34e106,_0x91d313){_0x34e106=_0x34e106-0x0;var _0x23a796=_0xebc4[_0x34e106];return _0x23a796;};'use strict';var _=require('lodash');var util=require(_0x4ebc('0x0'));var moment=require(_0x4ebc('0x1'));var BPromise=require(_0x4ebc('0x2'));var rs=require(_0x4ebc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ebc('0x4'))['db'];var utils=require(_0x4ebc('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ebc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4ebc('0x7')]['http']({'port':0x232a});config[_0x4ebc('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ebc('0x9'))(new Redis(config[_0x4ebc('0x8')]));require(_0x4ebc('0xa'))[_0x4ebc('0xb')](socket);function respondWithRpcPromise(_0x46e0dc,_0x5d6a99,_0x27a221){return new BPromise(function(_0x1b5dbc,_0x12e3c6){return client[_0x4ebc('0xc')](_0x46e0dc,_0x27a221)['then'](function(_0x1522b9){logger['info'](_0x4ebc('0xd'),_0x5d6a99,_0x4ebc('0xe'));logger[_0x4ebc('0xf')](_0x4ebc('0x10'),_0x5d6a99,'request\x20sent',JSON[_0x4ebc('0x11')](_0x1522b9));if(_0x1522b9['error']){if(_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x13')]===0x1f4){logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x14')]);return _0x12e3c6(_0x1522b9['error'][_0x4ebc('0x14')]);}logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x1522b9[_0x4ebc('0x12')]['message']);return _0x1b5dbc(_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x14')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x5d6a99,_0x4ebc('0xe'));_0x1b5dbc(_0x1522b9[_0x4ebc('0x15')]['message']);}})[_0x4ebc('0x16')](function(_0x28571e){logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x28571e);_0x12e3c6(_0x28571e);});});}exports['GetChatQueue']=function(_0x59251b){var _0x249dcf=this;return new Promise(function(_0x3e6195,_0x137ec9){return db['ChatQueue'][_0x4ebc('0x17')]({'raw':_0x59251b['options']?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x19')]===undefined?!![]:![]:!![],'where':_0x59251b['options']?_0x59251b['options'][_0x4ebc('0x1a')]||null:null,'attributes':_0x59251b['options']?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1b')]||null:null,'limit':_0x59251b[_0x4ebc('0x18')]?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1c')]||null:null,'include':_0x59251b[_0x4ebc('0x18')]?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x59251b[_0x4ebc('0x18')]['include'],function(_0x376a83){return{'model':db[_0x376a83[_0x4ebc('0x1f')]],'as':_0x376a83['as'],'attributes':_0x376a83[_0x4ebc('0x1b')],'include':_0x376a83[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x376a83[_0x4ebc('0x1d')],function(_0x165924){return{'model':db[_0x165924[_0x4ebc('0x1f')]],'as':_0x165924['as'],'attributes':_0x165924[_0x4ebc('0x1b')],'include':_0x165924[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x165924['include'],function(_0x10b09a){return{'model':db[_0x10b09a[_0x4ebc('0x1f')]],'as':_0x10b09a['as'],'attributes':_0x10b09a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42590d){logger[_0x4ebc('0x20')](_0x4ebc('0x21'),_0x59251b);logger[_0x4ebc('0xf')](_0x4ebc('0x21'),_0x59251b,JSON[_0x4ebc('0x11')](_0x42590d));_0x3e6195(_0x42590d);})[_0x4ebc('0x16')](function(_0x1d3d15){logger[_0x4ebc('0x12')]('GetChatQueue',_0x1d3d15[_0x4ebc('0x14')],_0x59251b);_0x137ec9(_0x249dcf[_0x4ebc('0x12')](0x1f4,_0x1d3d15[_0x4ebc('0x14')]));});});};exports['ShowChatQueue']=function(_0x3f9c40){var _0xbf2673=this;return new Promise(function(_0x141869,_0x3da50a){return db[_0x4ebc('0x22')]['find']({'raw':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1a')]||null:null,'attributes':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1b')]||null:null,'include':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1d')]?_['map'](_0x3f9c40['options'][_0x4ebc('0x1d')],function(_0x136d78){return{'model':db[_0x136d78[_0x4ebc('0x1f')]],'as':_0x136d78['as'],'attributes':_0x136d78[_0x4ebc('0x1b')],'include':_0x136d78[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x136d78[_0x4ebc('0x1d')],function(_0x4af0ec){return{'model':db[_0x4af0ec[_0x4ebc('0x1f')]],'as':_0x4af0ec['as'],'attributes':_0x4af0ec['attributes'],'include':_0x4af0ec['include']?_[_0x4ebc('0x1e')](_0x4af0ec[_0x4ebc('0x1d')],function(_0x34b276){return{'model':db[_0x34b276[_0x4ebc('0x1f')]],'as':_0x34b276['as'],'attributes':_0x34b276[_0x4ebc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4ebc('0x23')](function(_0x4fcfb6){logger[_0x4ebc('0x20')]('ShowChatQueue',_0x3f9c40);logger['debug'](_0x4ebc('0x24'),_0x3f9c40,JSON[_0x4ebc('0x11')](_0x4fcfb6));_0x141869(_0x4fcfb6);})[_0x4ebc('0x16')](function(_0x28ab22){logger[_0x4ebc('0x12')](_0x4ebc('0x24'),_0x28ab22[_0x4ebc('0x14')],_0x3f9c40);_0x3da50a(_0xbf2673['error'](0x1f4,_0x28ab22['message']));});});};
\ No newline at end of file
diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js
index ea9b046..c28b02f 100644
--- a/server/api/chatQueue/chatQueue.socket.js
+++ b/server/api/chatQueue/chatQueue.socket.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xcb99=['chatQueue:','./chatQueue.events','remove','emit','removeListener','length'];(function(_0x3c72ae,_0x4e342c){var _0x27dada=function(_0x3a5dbf){while(--_0x3a5dbf){_0x3c72ae['push'](_0x3c72ae['shift']());}};_0x27dada(++_0x4e342c);}(_0xcb99,0x8b));var _0x9cb9=function(_0x36375a,_0x43ede3){_0x36375a=_0x36375a-0x0;var _0xe646d0=_0xcb99[_0x36375a];return _0xe646d0;};'use strict';var ChatQueueEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatQueueEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatQueueEvents['on'](_0x1bf9b7,_0x1dd62f);}};
\ No newline at end of file
+var _0x5c12=['removeListener','chatQueue:','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c12,0x188));var _0x25c1=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x5c12[_0x81e39d];return _0x548fbb;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x25c1('0x0'),_0x25c1('0x1'),'update'];function createListener(_0x44bc2e,_0x1991e5){return function(_0x4042fe){_0x1991e5[_0x25c1('0x2')](_0x44bc2e,_0x4042fe);};}function removeListener(_0x2c5df0,_0x21ec20){return function(){ChatQueueEvents[_0x25c1('0x3')](_0x2c5df0,_0x21ec20);};}exports['register']=function(_0x204287){for(var _0x42ac16=0x0,_0x382922=events['length'];_0x42ac16<_0x382922;_0x42ac16++){var _0x5c69b1=events[_0x42ac16];var _0x24981c=createListener(_0x25c1('0x4')+_0x5c69b1,_0x204287);ChatQueueEvents['on'](_0x5c69b1,_0x24981c);}};
\ No newline at end of file
diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js
index 0ff0a15..cfcd139 100644
--- a/server/api/chatQueue/index.js
+++ b/server/api/chatQueue/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3351d8,_0x2d2e79){var _0x23bdce=function(_0x40cf8c){while(--_0x40cf8c){_0x3351d8['push'](_0x3351d8['shift']());}};_0x23bdce(++_0x2d2e79);}(_0x008c,0x188));var _0xc008=function(_0x4727f1,_0x2ff773){_0x4727f1=_0x4727f1-0x0;var _0x2977ce=_0x008c[_0x4727f1];return _0x2977ce;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
+var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0x5fc3[_0x36feb2];return _0x292b43;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router;
\ No newline at end of file
diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js
index 690293c..f017f19 100644
--- a/server/api/chatQueueReport/chatQueueReport.attributes.js
+++ b/server/api/chatQueueReport/chatQueueReport.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x92c7=['exports','STRING','DATE','moment','sequelize'];(function(_0x582f75,_0x24cc69){var _0x312ce5=function(_0x196c4b){while(--_0x196c4b){_0x582f75['push'](_0x582f75['shift']());}};_0x312ce5(++_0x24cc69);}(_0x92c7,0x7b));var _0x792c=function(_0x5b0ab4,_0x3e7c0b){_0x5b0ab4=_0x5b0ab4-0x0;var _0x3b8f55=_0x92c7[_0x5b0ab4];return _0x3b8f55;};'use strict';var moment=require(_0x792c('0x0'));var Sequelize=require(_0x792c('0x1'));module[_0x792c('0x2')]={'uniqueid':{'type':Sequelize[_0x792c('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x792c('0x4')]},'leaveAt':{'type':Sequelize[_0x792c('0x4')]},'acceptAt':{'type':Sequelize[_0x792c('0x4')]},'exitAt':{'type':Sequelize[_0x792c('0x4')]},'reason':{'type':Sequelize[_0x792c('0x3')]}};
\ No newline at end of file
+var _0x5b2d=['moment','exports','STRING','DATE'];(function(_0x1a3c0e,_0x1dea68){var _0xdab41=function(_0x3be01a){while(--_0x3be01a){_0x1a3c0e['push'](_0x1a3c0e['shift']());}};_0xdab41(++_0x1dea68);}(_0x5b2d,0x140));var _0xd5b2=function(_0x11d7ac,_0x1aefb4){_0x11d7ac=_0x11d7ac-0x0;var _0xff1914=_0x5b2d[_0x11d7ac];return _0xff1914;};'use strict';var moment=require(_0xd5b2('0x0'));var Sequelize=require('sequelize');module[_0xd5b2('0x1')]={'uniqueid':{'type':Sequelize[_0xd5b2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd5b2('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd5b2('0x3')]},'acceptAt':{'type':Sequelize[_0xd5b2('0x3')]},'exitAt':{'type':Sequelize[_0xd5b2('0x3')]},'reason':{'type':Sequelize[_0xd5b2('0x2')]}};
\ No newline at end of file
diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js
index c0762f1..2e8a55e 100644
--- a/server/api/chatQueueReport/chatQueueReport.controller.js
+++ b/server/api/chatQueueReport/chatQueueReport.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc373=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','rows','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','limit','set','apply','reject','then','error','name','send','index','ChatQueueReport','rawAttributes','type'];(function(_0x411bcb,_0x48247e){var _0x377884=function(_0x7598bb){while(--_0x7598bb){_0x411bcb['push'](_0x411bcb['shift']());}};_0x377884(++_0x48247e);}(_0xc373,0x1c7));var _0x3c37=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0xc373[_0x5538d5];return _0x323b1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c37('0x0'));var zipdir=require(_0x3c37('0x1'));var jsonpatch=require(_0x3c37('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3c37('0x3'));var Mustache=require(_0x3c37('0x4'));var util=require(_0x3c37('0x5'));var path=require(_0x3c37('0x6'));var sox=require(_0x3c37('0x7'));var csv=require(_0x3c37('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c37('0x9'));var squel=require(_0x3c37('0xa'));var crypto=require(_0x3c37('0xb'));var jsforce=require(_0x3c37('0xc'));var deskjs=require(_0x3c37('0xd'));var toCsv=require(_0x3c37('0x8'));var querystring=require(_0x3c37('0xe'));var Papa=require(_0x3c37('0xf'));var Redis=require(_0x3c37('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3c37('0x11'));var hardwareService=require(_0x3c37('0x12'));var logger=require(_0x3c37('0x13'))(_0x3c37('0x14'));var utils=require(_0x3c37('0x15'));var config=require(_0x3c37('0x16'));var licenseUtil=require(_0x3c37('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc333c2,_0x454f92){_0x454f92=_0x454f92||0xcc;return function(_0x458002){if(_0x458002){return _0xc333c2['sendStatus'](_0x454f92);}return _0xc333c2['status'](_0x454f92)[_0x3c37('0x18')]();};}function respondWithResult(_0x57c33f,_0x52ab1f){_0x52ab1f=_0x52ab1f||0xc8;return function(_0x37904b){if(_0x37904b){return _0x57c33f[_0x3c37('0x19')](_0x52ab1f)[_0x3c37('0x1a')](_0x37904b);}};}function respondWithFilteredResult(_0x1b70a6,_0x1268b3){return function(_0x22e851){if(_0x22e851){var _0x25d36e=typeof _0x1268b3[_0x3c37('0x1b')]===_0x3c37('0x1c')&&typeof _0x1268b3['limit']===_0x3c37('0x1c');var _0x214a0b=_0x22e851['count'];var _0x55761e=_0x25d36e?0x0:_0x1268b3[_0x3c37('0x1b')];var _0x12a47c=_0x25d36e?_0x22e851[_0x3c37('0x1d')]:_0x1268b3[_0x3c37('0x1b')]+_0x1268b3[_0x3c37('0x1e')];var _0x2b0f25;if(_0x12a47c>=_0x214a0b){_0x12a47c=_0x214a0b;_0x2b0f25=0xc8;}else{_0x2b0f25=0xce;}_0x1b70a6['status'](_0x2b0f25);return _0x1b70a6[_0x3c37('0x1f')]('Content-Range',_0x55761e+'-'+_0x12a47c+'/'+_0x214a0b)['json'](_0x22e851);}return null;};}function patchUpdates(_0x3bc0bb){return function(_0x2882ba){try{jsonpatch[_0x3c37('0x20')](_0x2882ba,_0x3bc0bb,!![]);}catch(_0x7fe4f0){return BPromise[_0x3c37('0x21')](_0x7fe4f0);}return _0x2882ba['save']();};}function saveUpdates(_0x27f83e,_0x54776f){return function(_0x3399a7){if(_0x3399a7){return _0x3399a7['update'](_0x27f83e)[_0x3c37('0x22')](function(_0x2e4226){return _0x2e4226;});}return null;};}function removeEntity(_0x348802,_0x574890){return function(_0x51d25d){if(_0x51d25d){return _0x51d25d['destroy']()['then'](function(){_0x348802['status'](0xcc)[_0x3c37('0x18')]();});}};}function handleEntityNotFound(_0xb334d0,_0x1655c1){return function(_0x3ab6bd){if(!_0x3ab6bd){_0xb334d0['sendStatus'](0x194);}return _0x3ab6bd;};}function handleError(_0x52b5d9,_0x565902){_0x565902=_0x565902||0x1f4;return function(_0x65ac66){logger[_0x3c37('0x23')](_0x65ac66['stack']);if(_0x65ac66['name']){delete _0x65ac66[_0x3c37('0x24')];}_0x52b5d9[_0x3c37('0x19')](_0x565902)[_0x3c37('0x25')](_0x65ac66);};}exports[_0x3c37('0x26')]=function(_0x64474f,_0x56d9c2){var _0x1ce403={},_0x3abacf={},_0x415999={'count':0x0,'rows':[]};var _0xf1d5cb=_['map'](db[_0x3c37('0x27')][_0x3c37('0x28')],function(_0x531931){return{'name':_0x531931['fieldName'],'type':_0x531931[_0x3c37('0x29')][_0x3c37('0x2a')]};});_0x3abacf[_0x3c37('0x2b')]=_['map'](_0xf1d5cb,_0x3c37('0x24'));_0x3abacf['query']=_[_0x3c37('0x2c')](_0x64474f[_0x3c37('0x2d')]);_0x3abacf[_0x3c37('0x2e')]=_[_0x3c37('0x2f')](_0x3abacf[_0x3c37('0x2b')],_0x3abacf[_0x3c37('0x2d')]);_0x1ce403[_0x3c37('0x30')]=_[_0x3c37('0x2f')](_0x3abacf[_0x3c37('0x2b')],qs[_0x3c37('0x31')](_0x64474f['query']['fields']));_0x1ce403['attributes']=_0x1ce403[_0x3c37('0x30')][_0x3c37('0x32')]?_0x1ce403[_0x3c37('0x30')]:_0x3abacf[_0x3c37('0x2b')];if(!_0x64474f[_0x3c37('0x2d')][_0x3c37('0x33')](_0x3c37('0x34'))){_0x1ce403[_0x3c37('0x1e')]=qs[_0x3c37('0x1e')](_0x64474f[_0x3c37('0x2d')][_0x3c37('0x1e')]);_0x1ce403[_0x3c37('0x1b')]=qs['offset'](_0x64474f[_0x3c37('0x2d')][_0x3c37('0x1b')]);}_0x1ce403['order']=qs['sort'](_0x64474f[_0x3c37('0x2d')][_0x3c37('0x35')]);_0x1ce403[_0x3c37('0x36')]=qs[_0x3c37('0x2e')](_[_0x3c37('0x37')](_0x64474f[_0x3c37('0x2d')],_0x3abacf[_0x3c37('0x2e')]),_0xf1d5cb);if(_0x64474f[_0x3c37('0x2d')][_0x3c37('0x38')]){_0x1ce403['where']=_[_0x3c37('0x39')](_0x1ce403[_0x3c37('0x36')],{'$or':_[_0x3c37('0x3a')](_0xf1d5cb,function(_0x280e81){if(_0x280e81[_0x3c37('0x29')]!==_0x3c37('0x3b')){var _0xf76905={};_0xf76905[_0x280e81[_0x3c37('0x24')]]={'$like':'%'+_0x64474f[_0x3c37('0x2d')][_0x3c37('0x38')]+'%'};return _0xf76905;}})});}_0x1ce403=_['merge']({},_0x1ce403,_0x64474f[_0x3c37('0x3c')]);var _0x18acc3={'where':_0x1ce403[_0x3c37('0x36')]};return db[_0x3c37('0x27')][_0x3c37('0x1d')](_0x18acc3)['then'](function(_0x2ac3ca){_0x415999[_0x3c37('0x1d')]=_0x2ac3ca;if(_0x64474f[_0x3c37('0x2d')][_0x3c37('0x3d')]){_0x1ce403['include']=[{'all':!![]}];}return db[_0x3c37('0x27')]['findAll'](_0x1ce403);})[_0x3c37('0x22')](function(_0x51687d){_0x415999[_0x3c37('0x3e')]=_0x51687d;return _0x415999;})[_0x3c37('0x22')](respondWithFilteredResult(_0x56d9c2,_0x1ce403))[_0x3c37('0x3f')](handleError(_0x56d9c2,null));};exports['show']=function(_0x3bf68a,_0x34096f){var _0x2e82d0={'raw':!![],'where':{'id':_0x3bf68a[_0x3c37('0x40')]['id']}},_0x2a4300={};_0x2a4300['model']=_[_0x3c37('0x2c')](db[_0x3c37('0x27')][_0x3c37('0x28')]);_0x2a4300[_0x3c37('0x2d')]=_[_0x3c37('0x2c')](_0x3bf68a[_0x3c37('0x2d')]);_0x2a4300[_0x3c37('0x2e')]=_['intersection'](_0x2a4300[_0x3c37('0x2b')],_0x2a4300[_0x3c37('0x2d')]);_0x2e82d0[_0x3c37('0x30')]=_['intersection'](_0x2a4300[_0x3c37('0x2b')],qs['fields'](_0x3bf68a[_0x3c37('0x2d')][_0x3c37('0x31')]));_0x2e82d0[_0x3c37('0x30')]=_0x2e82d0[_0x3c37('0x30')]['length']?_0x2e82d0['attributes']:_0x2a4300['model'];if(_0x3bf68a[_0x3c37('0x2d')][_0x3c37('0x3d')]){_0x2e82d0['include']=[{'all':!![]}];}_0x2e82d0=_['merge']({},_0x2e82d0,_0x3bf68a[_0x3c37('0x3c')]);return db['ChatQueueReport'][_0x3c37('0x41')](_0x2e82d0)[_0x3c37('0x22')](handleEntityNotFound(_0x34096f,null))[_0x3c37('0x22')](respondWithResult(_0x34096f,null))[_0x3c37('0x3f')](handleError(_0x34096f,null));};exports[_0x3c37('0x42')]=function(_0x300d58,_0x436b28){return db[_0x3c37('0x27')][_0x3c37('0x42')](_0x300d58[_0x3c37('0x43')],{})[_0x3c37('0x22')](respondWithResult(_0x436b28,0xc9))['catch'](handleError(_0x436b28,null));};exports[_0x3c37('0x44')]=function(_0x1869ad,_0x4b8351){if(_0x1869ad[_0x3c37('0x43')]['id']){delete _0x1869ad[_0x3c37('0x43')]['id'];}return db[_0x3c37('0x27')]['find']({'where':{'id':_0x1869ad[_0x3c37('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b8351,null))[_0x3c37('0x22')](saveUpdates(_0x1869ad[_0x3c37('0x43')],null))[_0x3c37('0x22')](respondWithResult(_0x4b8351,null))['catch'](handleError(_0x4b8351,null));};exports[_0x3c37('0x45')]=function(_0x415bac,_0x1dc208){return db[_0x3c37('0x27')][_0x3c37('0x41')]({'where':{'id':_0x415bac[_0x3c37('0x40')]['id']}})[_0x3c37('0x22')](handleEntityNotFound(_0x1dc208,null))[_0x3c37('0x22')](removeEntity(_0x1dc208,null))[_0x3c37('0x3f')](handleError(_0x1dc208,null));};exports[_0x3c37('0x46')]=function(_0x31d553,_0x2aee66){return db[_0x3c37('0x27')]['describe']()[_0x3c37('0x22')](respondWithResult(_0x2aee66,null))[_0x3c37('0x3f')](handleError(_0x2aee66,null));};
\ No newline at end of file
+var _0x084b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','keys','fields','include','create','body','find','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x4b9c74,_0x1b66bb){var _0x229a46=function(_0x2edf37){while(--_0x2edf37){_0x4b9c74['push'](_0x4b9c74['shift']());}};_0x229a46(++_0x1b66bb);}(_0x084b,0xd5));var _0xb084=function(_0x1234e5,_0x599458){_0x1234e5=_0x1234e5-0x0;var _0x1a351e=_0x084b[_0x1234e5];return _0x1a351e;};'use strict';var emlformat=require(_0xb084('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb084('0x1'));var moment=require(_0xb084('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb084('0x3'));var util=require(_0xb084('0x4'));var path=require(_0xb084('0x5'));var sox=require('sox');var csv=require(_0xb084('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb084('0x7'));var _=require(_0xb084('0x8'));var squel=require(_0xb084('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb084('0xa'));var toCsv=require(_0xb084('0x6'));var querystring=require(_0xb084('0xb'));var Papa=require(_0xb084('0xc'));var Redis=require(_0xb084('0xd'));var authService=require(_0xb084('0xe'));var qs=require(_0xb084('0xf'));var as=require(_0xb084('0x10'));var hardwareService=require(_0xb084('0x11'));var logger=require(_0xb084('0x12'))(_0xb084('0x13'));var utils=require(_0xb084('0x14'));var config=require(_0xb084('0x15'));var licenseUtil=require(_0xb084('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51aee2,_0x3582a0){_0x3582a0=_0x3582a0||0xcc;return function(_0x514829){if(_0x514829){return _0x51aee2['sendStatus'](_0x3582a0);}return _0x51aee2[_0xb084('0x17')](_0x3582a0)[_0xb084('0x18')]();};}function respondWithResult(_0x5bae3a,_0x4da0fb){_0x4da0fb=_0x4da0fb||0xc8;return function(_0x44be03){if(_0x44be03){return _0x5bae3a[_0xb084('0x17')](_0x4da0fb)[_0xb084('0x19')](_0x44be03);}};}function respondWithFilteredResult(_0x28ad2d,_0xc6df71){return function(_0x5a5d11){if(_0x5a5d11){var _0x240838=typeof _0xc6df71[_0xb084('0x1a')]===_0xb084('0x1b')&&typeof _0xc6df71[_0xb084('0x1c')]===_0xb084('0x1b');var _0x2cce88=_0x5a5d11[_0xb084('0x1d')];var _0x42657a=_0x240838?0x0:_0xc6df71[_0xb084('0x1a')];var _0x19d426=_0x240838?_0x5a5d11['count']:_0xc6df71['offset']+_0xc6df71['limit'];var _0x5b076b;if(_0x19d426>=_0x2cce88){_0x19d426=_0x2cce88;_0x5b076b=0xc8;}else{_0x5b076b=0xce;}_0x28ad2d[_0xb084('0x17')](_0x5b076b);return _0x28ad2d['set'](_0xb084('0x1e'),_0x42657a+'-'+_0x19d426+'/'+_0x2cce88)[_0xb084('0x19')](_0x5a5d11);}return null;};}function patchUpdates(_0x228ef1){return function(_0x2e8789){try{jsonpatch[_0xb084('0x1f')](_0x2e8789,_0x228ef1,!![]);}catch(_0x434690){return BPromise[_0xb084('0x20')](_0x434690);}return _0x2e8789[_0xb084('0x21')]();};}function saveUpdates(_0x517dc0,_0x5dfc7f){return function(_0x171dd5){if(_0x171dd5){return _0x171dd5[_0xb084('0x22')](_0x517dc0)[_0xb084('0x23')](function(_0x28d074){return _0x28d074;});}return null;};}function removeEntity(_0x5dced1,_0x4795d9){return function(_0x3ef50e){if(_0x3ef50e){return _0x3ef50e[_0xb084('0x24')]()['then'](function(){_0x5dced1[_0xb084('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4983,_0x22059f){return function(_0x5d9314){if(!_0x5d9314){_0x1f4983[_0xb084('0x25')](0x194);}return _0x5d9314;};}function handleError(_0x3d467e,_0x1ecb58){_0x1ecb58=_0x1ecb58||0x1f4;return function(_0x4ce54c){logger[_0xb084('0x26')](_0x4ce54c['stack']);if(_0x4ce54c[_0xb084('0x27')]){delete _0x4ce54c[_0xb084('0x27')];}_0x3d467e['status'](_0x1ecb58)[_0xb084('0x28')](_0x4ce54c);};}exports[_0xb084('0x29')]=function(_0x49cbd6,_0x4587e7){var _0x1a7726={},_0x57406f={},_0x1ad27b={'count':0x0,'rows':[]};var _0x2795cf=_['map'](db[_0xb084('0x2a')][_0xb084('0x2b')],function(_0x330a35){return{'name':_0x330a35[_0xb084('0x2c')],'type':_0x330a35[_0xb084('0x2d')]['key']};});_0x57406f[_0xb084('0x2e')]=_[_0xb084('0x2f')](_0x2795cf,_0xb084('0x27'));_0x57406f[_0xb084('0x30')]=_['keys'](_0x49cbd6[_0xb084('0x30')]);_0x57406f[_0xb084('0x31')]=_[_0xb084('0x32')](_0x57406f[_0xb084('0x2e')],_0x57406f[_0xb084('0x30')]);_0x1a7726['attributes']=_['intersection'](_0x57406f[_0xb084('0x2e')],qs['fields'](_0x49cbd6[_0xb084('0x30')]['fields']));_0x1a7726[_0xb084('0x33')]=_0x1a7726[_0xb084('0x33')][_0xb084('0x34')]?_0x1a7726[_0xb084('0x33')]:_0x57406f['model'];if(!_0x49cbd6[_0xb084('0x30')][_0xb084('0x35')](_0xb084('0x36'))){_0x1a7726[_0xb084('0x1c')]=qs[_0xb084('0x1c')](_0x49cbd6['query'][_0xb084('0x1c')]);_0x1a7726[_0xb084('0x1a')]=qs['offset'](_0x49cbd6['query'][_0xb084('0x1a')]);}_0x1a7726[_0xb084('0x37')]=qs[_0xb084('0x38')](_0x49cbd6[_0xb084('0x30')][_0xb084('0x38')]);_0x1a7726[_0xb084('0x39')]=qs[_0xb084('0x31')](_[_0xb084('0x3a')](_0x49cbd6['query'],_0x57406f[_0xb084('0x31')]),_0x2795cf);if(_0x49cbd6[_0xb084('0x30')]['filter']){_0x1a7726[_0xb084('0x39')]=_['merge'](_0x1a7726[_0xb084('0x39')],{'$or':_[_0xb084('0x2f')](_0x2795cf,function(_0xad9187){if(_0xad9187[_0xb084('0x2d')]!==_0xb084('0x3b')){var _0x2254a3={};_0x2254a3[_0xad9187[_0xb084('0x27')]]={'$like':'%'+_0x49cbd6[_0xb084('0x30')][_0xb084('0x3c')]+'%'};return _0x2254a3;}})});}_0x1a7726=_[_0xb084('0x3d')]({},_0x1a7726,_0x49cbd6[_0xb084('0x3e')]);var _0x77b2cc={'where':_0x1a7726[_0xb084('0x39')]};return db[_0xb084('0x2a')][_0xb084('0x1d')](_0x77b2cc)[_0xb084('0x23')](function(_0x584b34){_0x1ad27b['count']=_0x584b34;if(_0x49cbd6[_0xb084('0x30')][_0xb084('0x3f')]){_0x1a7726['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xb084('0x40')](_0x1a7726);})[_0xb084('0x23')](function(_0x1de365){_0x1ad27b['rows']=_0x1de365;return _0x1ad27b;})[_0xb084('0x23')](respondWithFilteredResult(_0x4587e7,_0x1a7726))[_0xb084('0x41')](handleError(_0x4587e7,null));};exports[_0xb084('0x42')]=function(_0x526c47,_0xc63ca9){var _0x13b059={'raw':!![],'where':{'id':_0x526c47[_0xb084('0x43')]['id']}},_0x3f38f9={};_0x3f38f9['model']=_[_0xb084('0x44')](db[_0xb084('0x2a')][_0xb084('0x2b')]);_0x3f38f9[_0xb084('0x30')]=_['keys'](_0x526c47[_0xb084('0x30')]);_0x3f38f9[_0xb084('0x31')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],_0x3f38f9[_0xb084('0x30')]);_0x13b059[_0xb084('0x33')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],qs[_0xb084('0x45')](_0x526c47[_0xb084('0x30')][_0xb084('0x45')]));_0x13b059[_0xb084('0x33')]=_0x13b059[_0xb084('0x33')][_0xb084('0x34')]?_0x13b059[_0xb084('0x33')]:_0x3f38f9['model'];if(_0x526c47[_0xb084('0x30')][_0xb084('0x3f')]){_0x13b059[_0xb084('0x46')]=[{'all':!![]}];}_0x13b059=_[_0xb084('0x3d')]({},_0x13b059,_0x526c47[_0xb084('0x3e')]);return db[_0xb084('0x2a')]['find'](_0x13b059)[_0xb084('0x23')](handleEntityNotFound(_0xc63ca9,null))[_0xb084('0x23')](respondWithResult(_0xc63ca9,null))[_0xb084('0x41')](handleError(_0xc63ca9,null));};exports[_0xb084('0x47')]=function(_0x1a95e4,_0x305f4a){return db[_0xb084('0x2a')]['create'](_0x1a95e4[_0xb084('0x48')],{})[_0xb084('0x23')](respondWithResult(_0x305f4a,0xc9))[_0xb084('0x41')](handleError(_0x305f4a,null));};exports[_0xb084('0x22')]=function(_0x32014e,_0xb1fdeb){if(_0x32014e[_0xb084('0x48')]['id']){delete _0x32014e[_0xb084('0x48')]['id'];}return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x32014e[_0xb084('0x43')]['id']}})['then'](handleEntityNotFound(_0xb1fdeb,null))[_0xb084('0x23')](saveUpdates(_0x32014e[_0xb084('0x48')],null))[_0xb084('0x23')](respondWithResult(_0xb1fdeb,null))[_0xb084('0x41')](handleError(_0xb1fdeb,null));};exports[_0xb084('0x24')]=function(_0x4bad1b,_0x2d5ebd){return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x4bad1b[_0xb084('0x43')]['id']}})[_0xb084('0x23')](handleEntityNotFound(_0x2d5ebd,null))[_0xb084('0x23')](removeEntity(_0x2d5ebd,null))[_0xb084('0x41')](handleError(_0x2d5ebd,null));};exports[_0xb084('0x4a')]=function(_0x2d9239,_0x557649){return db['ChatQueueReport']['describe']()[_0xb084('0x23')](respondWithResult(_0x557649,null))[_0xb084('0x41')](handleError(_0x557649,null));};
\ No newline at end of file
diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js
index 7b06355..3240e58 100644
--- a/server/api/chatQueueReport/chatQueueReport.model.js
+++ b/server/api/chatQueueReport/chatQueueReport.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x1e3fdd,_0x495be6){var _0x33512e=function(_0x3f445d){while(--_0x3f445d){_0x1e3fdd['push'](_0x1e3fdd['shift']());}};_0x33512e(++_0x495be6);}(_0x757a,0xde));var _0xa757=function(_0x45260d,_0x48ed1f){_0x45260d=_0x45260d-0x0;var _0x2f8c4d=_0x757a[_0x45260d];return _0x2f8c4d;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x421879,_0x4a00c2){var _0x3bec6f=function(_0x338e76){while(--_0x338e76){_0x421879['push'](_0x421879['shift']());}};_0x3bec6f(++_0x4a00c2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb7e7[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js
index 86edd90..c2828a8 100644
--- a/server/api/chatQueueReport/chatQueueReport.rpc.js
+++ b/server/api/chatQueueReport/chatQueueReport.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xb7aa=['result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x206341,_0x3dd809){var _0x554768=function(_0x41219a){while(--_0x41219a){_0x206341['push'](_0x206341['shift']());}};_0x554768(++_0x3dd809);}(_0xb7aa,0x11a));var _0xab7a=function(_0x3e0591,_0x358d1b){_0x3e0591=_0x3e0591-0x0;var _0x5e1293=_0xb7aa[_0x3e0591];return _0x5e1293;};'use strict';var _=require(_0xab7a('0x0'));var util=require(_0xab7a('0x1'));var moment=require(_0xab7a('0x2'));var BPromise=require(_0xab7a('0x3'));var rs=require(_0xab7a('0x4'));var fs=require('fs');var Redis=require(_0xab7a('0x5'));var db=require(_0xab7a('0x6'))['db'];var utils=require(_0xab7a('0x7'));var logger=require(_0xab7a('0x8'))(_0xab7a('0x9'));var config=require('../../config/environment');var jayson=require(_0xab7a('0xa'));var client=jayson[_0xab7a('0xb')][_0xab7a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29ef15,_0x4e775f,_0x99ac82){return new BPromise(function(_0x1e3b23,_0x520d21){return client[_0xab7a('0xd')](_0x29ef15,_0x99ac82)[_0xab7a('0xe')](function(_0x40e6e6){logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));logger[_0xab7a('0x12')](_0xab7a('0x13'),_0x4e775f,_0xab7a('0x11'),JSON[_0xab7a('0x14')](_0x40e6e6));if(_0x40e6e6['error']){if(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x16')]===0x1f4){logger[_0xab7a('0x15')](_0xab7a('0x10'),_0x4e775f,_0x40e6e6['error'][_0xab7a('0x17')]);return _0x520d21(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);}logger[_0xab7a('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x4e775f,_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);return _0x1e3b23(_0x40e6e6['error'][_0xab7a('0x17')]);}else{logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));_0x1e3b23(_0x40e6e6[_0xab7a('0x18')]['message']);}})[_0xab7a('0x19')](function(_0x19eeb7){logger['error'](_0xab7a('0x10'),_0x4e775f,_0x19eeb7);_0x520d21(_0x19eeb7);});});}exports[_0xab7a('0x1a')]=function(_0x187f51){var _0xc3bb41=this;return new Promise(function(_0x10b630,_0x14b2b5){return db[_0xab7a('0x1b')]['create'](_0x187f51[_0xab7a('0x1c')],{'raw':_0x187f51[_0xab7a('0x1d')]?_0x187f51[_0xab7a('0x1d')][_0xab7a('0x1e')]===undefined?!![]:![]:!![]})[_0xab7a('0xe')](function(_0x37e3bc){logger[_0xab7a('0xf')](_0xab7a('0x1a'),_0x187f51);logger[_0xab7a('0x12')](_0xab7a('0x1a'),_0x187f51,JSON[_0xab7a('0x14')](_0x37e3bc));_0x10b630(_0x37e3bc);})['catch'](function(_0x4b65f0){logger['error'](_0xab7a('0x1a'),_0x4b65f0[_0xab7a('0x17')],_0x187f51);_0x14b2b5(_0xc3bb41[_0xab7a('0x15')](0x1f4,_0x4b65f0[_0xab7a('0x17')]));});});};exports[_0xab7a('0x1f')]=function(_0x8c1e1f){var _0x3324f2=this;return new Promise(function(_0x533680,_0x4d2ad4){return db[_0xab7a('0x1b')]['update'](_0x8c1e1f['body'],{'raw':_0x8c1e1f[_0xab7a('0x1d')]?_0x8c1e1f['options'][_0xab7a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8c1e1f[_0xab7a('0x1d')]?_0x8c1e1f[_0xab7a('0x1d')][_0xab7a('0x20')]||null:null,'attributes':_0x8c1e1f[_0xab7a('0x1d')]?_0x8c1e1f['options'][_0xab7a('0x21')]||null:null,'limit':_0x8c1e1f[_0xab7a('0x1d')]?_0x8c1e1f[_0xab7a('0x1d')]['limit']||null:null})[_0xab7a('0xe')](function(_0x311dfa){logger[_0xab7a('0xf')]('UpdateChatQueueReport',_0x8c1e1f);logger['debug'](_0xab7a('0x1f'),_0x8c1e1f,JSON['stringify'](_0x311dfa));_0x533680(_0x311dfa);})[_0xab7a('0x19')](function(_0x3dfbaf){logger['error'](_0xab7a('0x1f'),_0x3dfbaf[_0xab7a('0x17')],_0x8c1e1f);_0x4d2ad4(_0x3324f2[_0xab7a('0x15')](0x1f4,_0x3dfbaf[_0xab7a('0x17')]));});});};
\ No newline at end of file
+var _0xc67c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x426854,_0xb8fb57){var _0x1f0aea=function(_0x124dba){while(--_0x124dba){_0x426854['push'](_0x426854['shift']());}};_0x1f0aea(++_0xb8fb57);}(_0xc67c,0x17b));var _0xcc67=function(_0x7b60c7,_0x50a43c){_0x7b60c7=_0x7b60c7-0x0;var _0x533781=_0xc67c[_0x7b60c7];return _0x533781;};'use strict';var _=require(_0xcc67('0x0'));var util=require(_0xcc67('0x1'));var moment=require(_0xcc67('0x2'));var BPromise=require(_0xcc67('0x3'));var rs=require(_0xcc67('0x4'));var fs=require('fs');var Redis=require(_0xcc67('0x5'));var db=require(_0xcc67('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc67('0x7'))(_0xcc67('0x8'));var config=require(_0xcc67('0x9'));var jayson=require(_0xcc67('0xa'));var client=jayson[_0xcc67('0xb')][_0xcc67('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xac838d,_0x2cb2da,_0x46b9a5){return new BPromise(function(_0x5d0c1d,_0x92d497){return client[_0xcc67('0xd')](_0xac838d,_0x46b9a5)['then'](function(_0x18282d){logger[_0xcc67('0xe')](_0xcc67('0xf'),_0x2cb2da,_0xcc67('0x10'));logger[_0xcc67('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x2cb2da,_0xcc67('0x10'),JSON[_0xcc67('0x12')](_0x18282d));if(_0x18282d[_0xcc67('0x13')]){if(_0x18282d[_0xcc67('0x13')]['code']===0x1f4){logger['error'](_0xcc67('0xf'),_0x2cb2da,_0x18282d[_0xcc67('0x13')][_0xcc67('0x14')]);return _0x92d497(_0x18282d['error'][_0xcc67('0x14')]);}logger[_0xcc67('0x13')](_0xcc67('0xf'),_0x2cb2da,_0x18282d['error'][_0xcc67('0x14')]);return _0x5d0c1d(_0x18282d[_0xcc67('0x13')][_0xcc67('0x14')]);}else{logger[_0xcc67('0xe')](_0xcc67('0xf'),_0x2cb2da,_0xcc67('0x10'));_0x5d0c1d(_0x18282d[_0xcc67('0x15')][_0xcc67('0x14')]);}})[_0xcc67('0x16')](function(_0x4c09dc){logger[_0xcc67('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x2cb2da,_0x4c09dc);_0x92d497(_0x4c09dc);});});}exports[_0xcc67('0x17')]=function(_0x57c1d6){var _0x153737=this;return new Promise(function(_0x26453c,_0x423bd8){return db['ChatQueueReport'][_0xcc67('0x18')](_0x57c1d6[_0xcc67('0x19')],{'raw':_0x57c1d6[_0xcc67('0x1a')]?_0x57c1d6[_0xcc67('0x1a')][_0xcc67('0x1b')]===undefined?!![]:![]:!![]})[_0xcc67('0x1c')](function(_0x617e7b){logger[_0xcc67('0xe')](_0xcc67('0x17'),_0x57c1d6);logger[_0xcc67('0x11')]('CreateChatQueueReport',_0x57c1d6,JSON[_0xcc67('0x12')](_0x617e7b));_0x26453c(_0x617e7b);})['catch'](function(_0x12b59a){logger[_0xcc67('0x13')]('CreateChatQueueReport',_0x12b59a[_0xcc67('0x14')],_0x57c1d6);_0x423bd8(_0x153737[_0xcc67('0x13')](0x1f4,_0x12b59a[_0xcc67('0x14')]));});});};exports[_0xcc67('0x1d')]=function(_0x1dfe93){var _0x91da96=this;return new Promise(function(_0x23bea2,_0x4c6b30){return db[_0xcc67('0x1e')][_0xcc67('0x1f')](_0x1dfe93[_0xcc67('0x19')],{'raw':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93['options'][_0xcc67('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93[_0xcc67('0x1a')][_0xcc67('0x20')]||null:null,'attributes':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93[_0xcc67('0x1a')][_0xcc67('0x21')]||null:null,'limit':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93['options'][_0xcc67('0x22')]||null:null})[_0xcc67('0x1c')](function(_0x274b84){logger[_0xcc67('0xe')](_0xcc67('0x1d'),_0x1dfe93);logger['debug'](_0xcc67('0x1d'),_0x1dfe93,JSON[_0xcc67('0x12')](_0x274b84));_0x23bea2(_0x274b84);})['catch'](function(_0x24dbde){logger[_0xcc67('0x13')](_0xcc67('0x1d'),_0x24dbde[_0xcc67('0x14')],_0x1dfe93);_0x4c6b30(_0x91da96[_0xcc67('0x13')](0x1f4,_0x24dbde[_0xcc67('0x14')]));});});};
\ No newline at end of file
diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js
index cbd6abe..a751dd1 100644
--- a/server/api/chatQueueReport/index.js
+++ b/server/api/chatQueueReport/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xa47e=['express','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','/describe','isAuthenticated','get','/:id','show','post','create','put','update','delete','multer','util','path'];(function(_0x4ed2a8,_0xdb07fd){var _0x2a50c2=function(_0x200ad2){while(--_0x200ad2){_0x4ed2a8['push'](_0x4ed2a8['shift']());}};_0x2a50c2(++_0xdb07fd);}(_0xa47e,0x85));var _0xea47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa47e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xea47('0x0'));var util=require(_0xea47('0x1'));var path=require(_0xea47('0x2'));var timeout=require('connect-timeout');var express=require(_0xea47('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xea47('0x4'));var interaction=require(_0xea47('0x5'));var config=require('../../config/environment');var controller=require(_0xea47('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xea47('0x7'),auth[_0xea47('0x8')](),controller['describe']);router[_0xea47('0x9')](_0xea47('0xa'),auth[_0xea47('0x8')](),controller[_0xea47('0xb')]);router[_0xea47('0xc')]('/',auth[_0xea47('0x8')](),controller[_0xea47('0xd')]);router[_0xea47('0xe')](_0xea47('0xa'),auth[_0xea47('0x8')](),controller[_0xea47('0xf')]);router[_0xea47('0x10')]('/:id',auth[_0xea47('0x8')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x0629=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x0629,0xee));var _0x9062=function(_0x5e70a6,_0x31169f){_0x5e70a6=_0x5e70a6-0x0;var _0xd1a237=_0x0629[_0x5e70a6];return _0xd1a237;};'use strict';var multer=require(_0x9062('0x0'));var util=require(_0x9062('0x1'));var path=require(_0x9062('0x2'));var timeout=require(_0x9062('0x3'));var express=require(_0x9062('0x4'));var router=express[_0x9062('0x5')]();var fs_extra=require(_0x9062('0x6'));var auth=require(_0x9062('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9062('0x8'));var controller=require(_0x9062('0x9'));router[_0x9062('0xa')]('/',auth[_0x9062('0xb')](),controller[_0x9062('0xc')]);router[_0x9062('0xa')](_0x9062('0xd'),auth[_0x9062('0xb')](),controller[_0x9062('0xe')]);router[_0x9062('0xa')]('/:id',auth[_0x9062('0xb')](),controller['show']);router[_0x9062('0xf')]('/',auth[_0x9062('0xb')](),controller[_0x9062('0x10')]);router[_0x9062('0x11')](_0x9062('0x12'),auth[_0x9062('0xb')](),controller[_0x9062('0x13')]);router[_0x9062('0x14')]('/:id',auth[_0x9062('0xb')](),controller[_0x9062('0x15')]);module[_0x9062('0x16')]=router;
\ No newline at end of file
diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js
index 557b61e..894e684 100644
--- a/server/api/chatTransferReport/chatTransferReport.attributes.js
+++ b/server/api/chatTransferReport/chatTransferReport.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x54092b,_0x5b1a5e){_0x54092b=_0x54092b-0x0;var _0x31f926=_0x9bde[_0x54092b];return _0x31f926;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}};
\ No newline at end of file
+var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x385f81,_0x394333){var _0x390b9e=function(_0x5541b7){while(--_0x5541b7){_0x385f81['push'](_0x385f81['shift']());}};_0x390b9e(++_0x394333);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}};
\ No newline at end of file
diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js
index 1e24e3b..5227b9d 100644
--- a/server/api/chatTransferReport/chatTransferReport.controller.js
+++ b/server/api/chatTransferReport/chatTransferReport.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x4936=['apply','reject','save','then','destroy','end','error','name','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','length','create','body','find','params','describe','eml-format','rimraf','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','Content-Range'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x4936,0x14d));var _0x6493=function(_0x5ae663,_0x42522a){_0x5ae663=_0x5ae663-0x0;var _0x366149=_0x4936[_0x5ae663];return _0x366149;};'use strict';var emlformat=require(_0x6493('0x0'));var rimraf=require(_0x6493('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6493('0x2'));var moment=require(_0x6493('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6493('0x4'));var util=require('util');var path=require(_0x6493('0x5'));var sox=require(_0x6493('0x6'));var csv=require('to-csv');var ejs=require(_0x6493('0x7'));var fs=require('fs');var fs_extra=require(_0x6493('0x8'));var _=require(_0x6493('0x9'));var squel=require(_0x6493('0xa'));var crypto=require(_0x6493('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6493('0xc'));var toCsv=require(_0x6493('0xd'));var querystring=require(_0x6493('0xe'));var Papa=require(_0x6493('0xf'));var Redis=require(_0x6493('0x10'));var authService=require(_0x6493('0x11'));var qs=require(_0x6493('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6493('0x13'))(_0x6493('0x14'));var utils=require('../../config/utils');var config=require(_0x6493('0x15'));var licenseUtil=require(_0x6493('0x16'));var db=require(_0x6493('0x17'))['db'];function respondWithStatusCode(_0x3c5417,_0x334272){_0x334272=_0x334272||0xcc;return function(_0x227526){if(_0x227526){return _0x3c5417[_0x6493('0x18')](_0x334272);}return _0x3c5417['status'](_0x334272)['end']();};}function respondWithResult(_0x297d48,_0x75dba4){_0x75dba4=_0x75dba4||0xc8;return function(_0x894587){if(_0x894587){return _0x297d48[_0x6493('0x19')](_0x75dba4)[_0x6493('0x1a')](_0x894587);}};}function respondWithFilteredResult(_0x1a077e,_0x35c0c8){return function(_0x1a21f2){if(_0x1a21f2){var _0xaaa388=typeof _0x35c0c8['offset']==='undefined'&&typeof _0x35c0c8[_0x6493('0x1b')]===_0x6493('0x1c');var _0x1223ac=_0x1a21f2['count'];var _0xa38f4f=_0xaaa388?0x0:_0x35c0c8[_0x6493('0x1d')];var _0x50bbca=_0xaaa388?_0x1a21f2[_0x6493('0x1e')]:_0x35c0c8[_0x6493('0x1d')]+_0x35c0c8[_0x6493('0x1b')];var _0x291f88;if(_0x50bbca>=_0x1223ac){_0x50bbca=_0x1223ac;_0x291f88=0xc8;}else{_0x291f88=0xce;}_0x1a077e[_0x6493('0x19')](_0x291f88);return _0x1a077e['set'](_0x6493('0x1f'),_0xa38f4f+'-'+_0x50bbca+'/'+_0x1223ac)[_0x6493('0x1a')](_0x1a21f2);}return null;};}function patchUpdates(_0x55ff6f){return function(_0x5ef8bc){try{jsonpatch[_0x6493('0x20')](_0x5ef8bc,_0x55ff6f,!![]);}catch(_0x4990eb){return BPromise[_0x6493('0x21')](_0x4990eb);}return _0x5ef8bc[_0x6493('0x22')]();};}function saveUpdates(_0x3ce83a,_0x3974d0){return function(_0x585a02){if(_0x585a02){return _0x585a02['update'](_0x3ce83a)[_0x6493('0x23')](function(_0x3fdaaa){return _0x3fdaaa;});}return null;};}function removeEntity(_0x1487c1,_0xef93fc){return function(_0x546a38){if(_0x546a38){return _0x546a38[_0x6493('0x24')]()[_0x6493('0x23')](function(){_0x1487c1[_0x6493('0x19')](0xcc)[_0x6493('0x25')]();});}};}function handleEntityNotFound(_0x312129,_0x5a8a90){return function(_0x1cdee2){if(!_0x1cdee2){_0x312129[_0x6493('0x18')](0x194);}return _0x1cdee2;};}function handleError(_0x188433,_0x18820e){_0x18820e=_0x18820e||0x1f4;return function(_0x50af03){logger[_0x6493('0x26')](_0x50af03['stack']);if(_0x50af03['name']){delete _0x50af03[_0x6493('0x27')];}_0x188433[_0x6493('0x19')](_0x18820e)['send'](_0x50af03);};}exports[_0x6493('0x28')]=function(_0x44df9a,_0x43a3e0){var _0x57f81d={},_0x5936c2={},_0x5b0968={'count':0x0,'rows':[]};var _0x2ff711=_['map'](db[_0x6493('0x29')][_0x6493('0x2a')],function(_0x468368){return{'name':_0x468368[_0x6493('0x2b')],'type':_0x468368[_0x6493('0x2c')][_0x6493('0x2d')]};});_0x5936c2[_0x6493('0x2e')]=_[_0x6493('0x2f')](_0x2ff711,_0x6493('0x27'));_0x5936c2[_0x6493('0x30')]=_[_0x6493('0x31')](_0x44df9a[_0x6493('0x30')]);_0x5936c2[_0x6493('0x32')]=_[_0x6493('0x33')](_0x5936c2[_0x6493('0x2e')],_0x5936c2[_0x6493('0x30')]);_0x57f81d[_0x6493('0x34')]=_[_0x6493('0x33')](_0x5936c2[_0x6493('0x2e')],qs[_0x6493('0x35')](_0x44df9a[_0x6493('0x30')][_0x6493('0x35')]));_0x57f81d['attributes']=_0x57f81d[_0x6493('0x34')]['length']?_0x57f81d[_0x6493('0x34')]:_0x5936c2[_0x6493('0x2e')];if(!_0x44df9a[_0x6493('0x30')][_0x6493('0x36')](_0x6493('0x37'))){_0x57f81d[_0x6493('0x1b')]=qs[_0x6493('0x1b')](_0x44df9a[_0x6493('0x30')][_0x6493('0x1b')]);_0x57f81d[_0x6493('0x1d')]=qs[_0x6493('0x1d')](_0x44df9a['query'][_0x6493('0x1d')]);}_0x57f81d[_0x6493('0x38')]=qs[_0x6493('0x39')](_0x44df9a[_0x6493('0x30')]['sort']);_0x57f81d['where']=qs[_0x6493('0x32')](_[_0x6493('0x3a')](_0x44df9a['query'],_0x5936c2[_0x6493('0x32')]),_0x2ff711);if(_0x44df9a[_0x6493('0x30')][_0x6493('0x3b')]){_0x57f81d[_0x6493('0x3c')]=_[_0x6493('0x3d')](_0x57f81d[_0x6493('0x3c')],{'$or':_[_0x6493('0x2f')](_0x2ff711,function(_0x24cdba){if(_0x24cdba[_0x6493('0x2c')]!=='VIRTUAL'){var _0x3158b5={};_0x3158b5[_0x24cdba[_0x6493('0x27')]]={'$like':'%'+_0x44df9a[_0x6493('0x30')][_0x6493('0x3b')]+'%'};return _0x3158b5;}})});}_0x57f81d=_[_0x6493('0x3d')]({},_0x57f81d,_0x44df9a[_0x6493('0x3e')]);var _0xdf1465={'where':_0x57f81d[_0x6493('0x3c')]};return db[_0x6493('0x29')]['count'](_0xdf1465)['then'](function(_0x3cddd8){_0x5b0968[_0x6493('0x1e')]=_0x3cddd8;if(_0x44df9a['query'][_0x6493('0x3f')]){_0x57f81d['include']=[{'all':!![]}];}return db[_0x6493('0x29')]['findAll'](_0x57f81d);})[_0x6493('0x23')](function(_0x158678){_0x5b0968[_0x6493('0x40')]=_0x158678;return _0x5b0968;})['then'](respondWithFilteredResult(_0x43a3e0,_0x57f81d))[_0x6493('0x41')](handleError(_0x43a3e0,null));};exports[_0x6493('0x42')]=function(_0x15bc29,_0x24f0d6){var _0x183b62={'raw':!![],'where':{'id':_0x15bc29['params']['id']}},_0x16e6f6={};_0x16e6f6[_0x6493('0x2e')]=_[_0x6493('0x31')](db[_0x6493('0x29')][_0x6493('0x2a')]);_0x16e6f6['query']=_[_0x6493('0x31')](_0x15bc29[_0x6493('0x30')]);_0x16e6f6['filters']=_['intersection'](_0x16e6f6[_0x6493('0x2e')],_0x16e6f6[_0x6493('0x30')]);_0x183b62['attributes']=_[_0x6493('0x33')](_0x16e6f6[_0x6493('0x2e')],qs['fields'](_0x15bc29[_0x6493('0x30')]['fields']));_0x183b62[_0x6493('0x34')]=_0x183b62[_0x6493('0x34')][_0x6493('0x43')]?_0x183b62[_0x6493('0x34')]:_0x16e6f6[_0x6493('0x2e')];if(_0x15bc29[_0x6493('0x30')]['includeAll']){_0x183b62['include']=[{'all':!![]}];}_0x183b62=_[_0x6493('0x3d')]({},_0x183b62,_0x15bc29['options']);return db['ChatTransferReport']['find'](_0x183b62)[_0x6493('0x23')](handleEntityNotFound(_0x24f0d6,null))[_0x6493('0x23')](respondWithResult(_0x24f0d6,null))[_0x6493('0x41')](handleError(_0x24f0d6,null));};exports[_0x6493('0x44')]=function(_0x275874,_0x368e05){return db[_0x6493('0x29')][_0x6493('0x44')](_0x275874[_0x6493('0x45')],{})[_0x6493('0x23')](respondWithResult(_0x368e05,0xc9))[_0x6493('0x41')](handleError(_0x368e05,null));};exports['update']=function(_0x3dd7ce,_0x52b302){if(_0x3dd7ce[_0x6493('0x45')]['id']){delete _0x3dd7ce[_0x6493('0x45')]['id'];}return db[_0x6493('0x29')][_0x6493('0x46')]({'where':{'id':_0x3dd7ce[_0x6493('0x47')]['id']}})['then'](handleEntityNotFound(_0x52b302,null))[_0x6493('0x23')](saveUpdates(_0x3dd7ce['body'],null))[_0x6493('0x23')](respondWithResult(_0x52b302,null))[_0x6493('0x41')](handleError(_0x52b302,null));};exports[_0x6493('0x24')]=function(_0x422d59,_0x263abf){return db[_0x6493('0x29')][_0x6493('0x46')]({'where':{'id':_0x422d59['params']['id']}})['then'](handleEntityNotFound(_0x263abf,null))[_0x6493('0x23')](removeEntity(_0x263abf,null))[_0x6493('0x41')](handleError(_0x263abf,null));};exports[_0x6493('0x48')]=function(_0x4e7cb5,_0x3ea199){return db['ChatTransferReport']['describe']()[_0x6493('0x23')](respondWithResult(_0x3ea199,null))[_0x6493('0x41')](handleError(_0x3ea199,null));};
\ No newline at end of file
+var _0x4e06=['offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','params','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x3902b8,_0x4b013a){var _0x345127=function(_0x333616){while(--_0x333616){_0x3902b8['push'](_0x3902b8['shift']());}};_0x345127(++_0x4b013a);}(_0x4e06,0x76));var _0x64e0=function(_0x278f0e,_0x107e6e){_0x278f0e=_0x278f0e-0x0;var _0x5b8c27=_0x4e06[_0x278f0e];return _0x5b8c27;};'use strict';var emlformat=require(_0x64e0('0x0'));var rimraf=require(_0x64e0('0x1'));var zipdir=require(_0x64e0('0x2'));var jsonpatch=require(_0x64e0('0x3'));var rp=require('request-promise');var moment=require(_0x64e0('0x4'));var BPromise=require(_0x64e0('0x5'));var Mustache=require(_0x64e0('0x6'));var util=require(_0x64e0('0x7'));var path=require(_0x64e0('0x8'));var sox=require(_0x64e0('0x9'));var csv=require(_0x64e0('0xa'));var ejs=require(_0x64e0('0xb'));var fs=require('fs');var fs_extra=require(_0x64e0('0xc'));var _=require(_0x64e0('0xd'));var squel=require('squel');var crypto=require(_0x64e0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x64e0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x64e0('0x10'));var authService=require(_0x64e0('0x11'));var qs=require(_0x64e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64e0('0x13'));var logger=require(_0x64e0('0x14'))(_0x64e0('0x15'));var utils=require(_0x64e0('0x16'));var config=require(_0x64e0('0x17'));var licenseUtil=require(_0x64e0('0x18'));var db=require(_0x64e0('0x19'))['db'];function respondWithStatusCode(_0x1a943b,_0x417c95){_0x417c95=_0x417c95||0xcc;return function(_0x25bc9d){if(_0x25bc9d){return _0x1a943b[_0x64e0('0x1a')](_0x417c95);}return _0x1a943b[_0x64e0('0x1b')](_0x417c95)[_0x64e0('0x1c')]();};}function respondWithResult(_0x3d52bb,_0x698c25){_0x698c25=_0x698c25||0xc8;return function(_0x305f79){if(_0x305f79){return _0x3d52bb[_0x64e0('0x1b')](_0x698c25)[_0x64e0('0x1d')](_0x305f79);}};}function respondWithFilteredResult(_0x18c03d,_0x162dcf){return function(_0x1c2b95){if(_0x1c2b95){var _0x105908=typeof _0x162dcf[_0x64e0('0x1e')]===_0x64e0('0x1f')&&typeof _0x162dcf[_0x64e0('0x20')]===_0x64e0('0x1f');var _0x4c635c=_0x1c2b95['count'];var _0x4d3418=_0x105908?0x0:_0x162dcf[_0x64e0('0x1e')];var _0x30991f=_0x105908?_0x1c2b95[_0x64e0('0x21')]:_0x162dcf['offset']+_0x162dcf[_0x64e0('0x20')];var _0x35bdce;if(_0x30991f>=_0x4c635c){_0x30991f=_0x4c635c;_0x35bdce=0xc8;}else{_0x35bdce=0xce;}_0x18c03d['status'](_0x35bdce);return _0x18c03d[_0x64e0('0x22')](_0x64e0('0x23'),_0x4d3418+'-'+_0x30991f+'/'+_0x4c635c)['json'](_0x1c2b95);}return null;};}function patchUpdates(_0x218979){return function(_0x52a546){try{jsonpatch['apply'](_0x52a546,_0x218979,!![]);}catch(_0x54eb5b){return BPromise[_0x64e0('0x24')](_0x54eb5b);}return _0x52a546[_0x64e0('0x25')]();};}function saveUpdates(_0x4456d4,_0x908d24){return function(_0x587d42){if(_0x587d42){return _0x587d42['update'](_0x4456d4)[_0x64e0('0x26')](function(_0x3dac28){return _0x3dac28;});}return null;};}function removeEntity(_0xd71736,_0x228977){return function(_0x1ea4c6){if(_0x1ea4c6){return _0x1ea4c6[_0x64e0('0x27')]()[_0x64e0('0x26')](function(){_0xd71736['status'](0xcc)[_0x64e0('0x1c')]();});}};}function handleEntityNotFound(_0x5c0ecc,_0x4ba4bf){return function(_0x59981a){if(!_0x59981a){_0x5c0ecc[_0x64e0('0x1a')](0x194);}return _0x59981a;};}function handleError(_0x6f5c39,_0x4f7b0a){_0x4f7b0a=_0x4f7b0a||0x1f4;return function(_0x2e8ab4){logger[_0x64e0('0x28')](_0x2e8ab4['stack']);if(_0x2e8ab4[_0x64e0('0x29')]){delete _0x2e8ab4[_0x64e0('0x29')];}_0x6f5c39[_0x64e0('0x1b')](_0x4f7b0a)[_0x64e0('0x2a')](_0x2e8ab4);};}exports[_0x64e0('0x2b')]=function(_0x222a62,_0x1d2486){var _0x2e1406={},_0x5a06f5={},_0xcecffb={'count':0x0,'rows':[]};var _0x591459=_[_0x64e0('0x2c')](db[_0x64e0('0x2d')][_0x64e0('0x2e')],function(_0x24f30c){return{'name':_0x24f30c[_0x64e0('0x2f')],'type':_0x24f30c[_0x64e0('0x30')]['key']};});_0x5a06f5[_0x64e0('0x31')]=_[_0x64e0('0x2c')](_0x591459,_0x64e0('0x29'));_0x5a06f5[_0x64e0('0x32')]=_[_0x64e0('0x33')](_0x222a62[_0x64e0('0x32')]);_0x5a06f5['filters']=_[_0x64e0('0x34')](_0x5a06f5[_0x64e0('0x31')],_0x5a06f5[_0x64e0('0x32')]);_0x2e1406[_0x64e0('0x35')]=_[_0x64e0('0x34')](_0x5a06f5[_0x64e0('0x31')],qs[_0x64e0('0x36')](_0x222a62[_0x64e0('0x32')][_0x64e0('0x36')]));_0x2e1406[_0x64e0('0x35')]=_0x2e1406[_0x64e0('0x35')][_0x64e0('0x37')]?_0x2e1406[_0x64e0('0x35')]:_0x5a06f5[_0x64e0('0x31')];if(!_0x222a62[_0x64e0('0x32')]['hasOwnProperty']('nolimit')){_0x2e1406[_0x64e0('0x20')]=qs['limit'](_0x222a62[_0x64e0('0x32')][_0x64e0('0x20')]);_0x2e1406[_0x64e0('0x1e')]=qs[_0x64e0('0x1e')](_0x222a62[_0x64e0('0x32')][_0x64e0('0x1e')]);}_0x2e1406[_0x64e0('0x38')]=qs[_0x64e0('0x39')](_0x222a62[_0x64e0('0x32')][_0x64e0('0x39')]);_0x2e1406[_0x64e0('0x3a')]=qs[_0x64e0('0x3b')](_[_0x64e0('0x3c')](_0x222a62[_0x64e0('0x32')],_0x5a06f5['filters']),_0x591459);if(_0x222a62[_0x64e0('0x32')]['filter']){_0x2e1406['where']=_[_0x64e0('0x3d')](_0x2e1406['where'],{'$or':_[_0x64e0('0x2c')](_0x591459,function(_0x353d89){if(_0x353d89[_0x64e0('0x30')]!==_0x64e0('0x3e')){var _0x3d000a={};_0x3d000a[_0x353d89[_0x64e0('0x29')]]={'$like':'%'+_0x222a62[_0x64e0('0x32')][_0x64e0('0x3f')]+'%'};return _0x3d000a;}})});}_0x2e1406=_[_0x64e0('0x3d')]({},_0x2e1406,_0x222a62[_0x64e0('0x40')]);var _0x7684ae={'where':_0x2e1406[_0x64e0('0x3a')]};return db[_0x64e0('0x2d')][_0x64e0('0x21')](_0x7684ae)[_0x64e0('0x26')](function(_0x5da451){_0xcecffb[_0x64e0('0x21')]=_0x5da451;if(_0x222a62[_0x64e0('0x32')][_0x64e0('0x41')]){_0x2e1406[_0x64e0('0x42')]=[{'all':!![]}];}return db[_0x64e0('0x2d')]['findAll'](_0x2e1406);})['then'](function(_0x30b56d){_0xcecffb['rows']=_0x30b56d;return _0xcecffb;})[_0x64e0('0x26')](respondWithFilteredResult(_0x1d2486,_0x2e1406))['catch'](handleError(_0x1d2486,null));};exports['show']=function(_0x170d99,_0x155c7a){var _0x1a2f89={'raw':!![],'where':{'id':_0x170d99[_0x64e0('0x43')]['id']}},_0x52600d={};_0x52600d[_0x64e0('0x31')]=_['keys'](db[_0x64e0('0x2d')][_0x64e0('0x2e')]);_0x52600d[_0x64e0('0x32')]=_[_0x64e0('0x33')](_0x170d99[_0x64e0('0x32')]);_0x52600d['filters']=_[_0x64e0('0x34')](_0x52600d[_0x64e0('0x31')],_0x52600d['query']);_0x1a2f89[_0x64e0('0x35')]=_[_0x64e0('0x34')](_0x52600d['model'],qs[_0x64e0('0x36')](_0x170d99['query']['fields']));_0x1a2f89[_0x64e0('0x35')]=_0x1a2f89[_0x64e0('0x35')]['length']?_0x1a2f89['attributes']:_0x52600d[_0x64e0('0x31')];if(_0x170d99[_0x64e0('0x32')]['includeAll']){_0x1a2f89[_0x64e0('0x42')]=[{'all':!![]}];}_0x1a2f89=_[_0x64e0('0x3d')]({},_0x1a2f89,_0x170d99[_0x64e0('0x40')]);return db[_0x64e0('0x2d')]['find'](_0x1a2f89)[_0x64e0('0x26')](handleEntityNotFound(_0x155c7a,null))[_0x64e0('0x26')](respondWithResult(_0x155c7a,null))[_0x64e0('0x44')](handleError(_0x155c7a,null));};exports['create']=function(_0x2f3a04,_0x228197){return db[_0x64e0('0x2d')][_0x64e0('0x45')](_0x2f3a04[_0x64e0('0x46')],{})['then'](respondWithResult(_0x228197,0xc9))[_0x64e0('0x44')](handleError(_0x228197,null));};exports[_0x64e0('0x47')]=function(_0x1e4cd6,_0x5dbd6f){if(_0x1e4cd6[_0x64e0('0x46')]['id']){delete _0x1e4cd6[_0x64e0('0x46')]['id'];}return db['ChatTransferReport'][_0x64e0('0x48')]({'where':{'id':_0x1e4cd6[_0x64e0('0x43')]['id']}})[_0x64e0('0x26')](handleEntityNotFound(_0x5dbd6f,null))[_0x64e0('0x26')](saveUpdates(_0x1e4cd6[_0x64e0('0x46')],null))[_0x64e0('0x26')](respondWithResult(_0x5dbd6f,null))[_0x64e0('0x44')](handleError(_0x5dbd6f,null));};exports[_0x64e0('0x27')]=function(_0x473b70,_0x10fa8a){return db[_0x64e0('0x2d')][_0x64e0('0x48')]({'where':{'id':_0x473b70['params']['id']}})[_0x64e0('0x26')](handleEntityNotFound(_0x10fa8a,null))[_0x64e0('0x26')](removeEntity(_0x10fa8a,null))[_0x64e0('0x44')](handleError(_0x10fa8a,null));};exports[_0x64e0('0x49')]=function(_0x3447f1,_0x2cf2c5){return db[_0x64e0('0x2d')]['describe']()[_0x64e0('0x26')](respondWithResult(_0x2cf2c5,null))[_0x64e0('0x44')](handleError(_0x2cf2c5,null));};
\ No newline at end of file
diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js
index 603d074..f9e5f40 100644
--- a/server/api/chatTransferReport/chatTransferReport.model.js
+++ b/server/api/chatTransferReport/chatTransferReport.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x2689=['request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x2f7ba5,_0x10df8d){var _0x2d0d5a=function(_0x293497){while(--_0x293497){_0x2f7ba5['push'](_0x2f7ba5['shift']());}};_0x2d0d5a(++_0x10df8d);}(_0x2689,0xb1));var _0x9268=function(_0x1a2643,_0x42939c){_0x1a2643=_0x1a2643-0x0;var _0x4e5c3c=_0x2689[_0x1a2643];return _0x4e5c3c;};'use strict';var _=require(_0x9268('0x0'));var util=require(_0x9268('0x1'));var logger=require(_0x9268('0x2'))(_0x9268('0x3'));var moment=require('moment');var BPromise=require(_0x9268('0x4'));var rp=require(_0x9268('0x5'));var fs=require('fs');var path=require(_0x9268('0x6'));var rimraf=require('rimraf');var config=require(_0x9268('0x7'));var attributes=require(_0x9268('0x8'));module[_0x9268('0x9')]=function(_0x5f4dec,_0x5ecad5){return _0x5f4dec['define'](_0x9268('0xa'),attributes,{'tableName':_0x9268('0xb'),'paranoid':![],'indexes':[{'name':_0x9268('0xc'),'fields':[_0x9268('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xe937=['./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38be62,_0xc0275f){var _0x2da447=function(_0x2f06f9){while(--_0x2f06f9){_0x38be62['push'](_0x38be62['shift']());}};_0x2da447(++_0xc0275f);}(_0xe937,0x15a));var _0x7e93=function(_0x51a4b1,_0x374955){_0x51a4b1=_0x51a4b1-0x0;var _0x305c71=_0xe937[_0x51a4b1];return _0x305c71;};'use strict';var _=require('lodash');var util=require(_0x7e93('0x0'));var logger=require(_0x7e93('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7e93('0x2'));var rp=require(_0x7e93('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e93('0x4'));var config=require(_0x7e93('0x5'));var attributes=require(_0x7e93('0x6'));module[_0x7e93('0x7')]=function(_0x1afaff,_0x34e382){return _0x1afaff[_0x7e93('0x8')]('ChatTransferReport',attributes,{'tableName':_0x7e93('0x9'),'paranoid':![],'indexes':[{'name':_0x7e93('0xa'),'fields':[_0x7e93('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js
index 99c3ede..b8ff214 100644
--- a/server/api/chatTransferReport/chatTransferReport.rpc.js
+++ b/server/api/chatTransferReport/chatTransferReport.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xc61c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x344bd7,_0x38a213){var _0x2a2b98=function(_0x1624be){while(--_0x1624be){_0x344bd7['push'](_0x344bd7['shift']());}};_0x2a2b98(++_0x38a213);}(_0xc61c,0x73));var _0xcc61=function(_0x50004c,_0x55215d){_0x50004c=_0x50004c-0x0;var _0x3c8b0=_0xc61c[_0x50004c];return _0x3c8b0;};'use strict';var _=require(_0xcc61('0x0'));var util=require(_0xcc61('0x1'));var moment=require(_0xcc61('0x2'));var BPromise=require(_0xcc61('0x3'));var rs=require(_0xcc61('0x4'));var fs=require('fs');var Redis=require(_0xcc61('0x5'));var db=require(_0xcc61('0x6'))['db'];var utils=require(_0xcc61('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xcc61('0x8'));var jayson=require(_0xcc61('0x9'));var client=jayson[_0xcc61('0xa')][_0xcc61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29bc4f,_0x1af7f3,_0x2a5073){return new BPromise(function(_0x43649c,_0x5b69fd){return client[_0xcc61('0xc')](_0x29bc4f,_0x2a5073)['then'](function(_0xfd1517){logger[_0xcc61('0xd')](_0xcc61('0xe'),_0x1af7f3,'request\x20sent');logger['debug'](_0xcc61('0xf'),_0x1af7f3,_0xcc61('0x10'),JSON[_0xcc61('0x11')](_0xfd1517));if(_0xfd1517['error']){if(_0xfd1517[_0xcc61('0x12')][_0xcc61('0x13')]===0x1f4){logger[_0xcc61('0x12')](_0xcc61('0xe'),_0x1af7f3,_0xfd1517['error'][_0xcc61('0x14')]);return _0x5b69fd(_0xfd1517[_0xcc61('0x12')]['message']);}logger[_0xcc61('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x1af7f3,_0xfd1517['error'][_0xcc61('0x14')]);return _0x43649c(_0xfd1517[_0xcc61('0x12')]['message']);}else{logger[_0xcc61('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x1af7f3,_0xcc61('0x10'));_0x43649c(_0xfd1517[_0xcc61('0x15')][_0xcc61('0x14')]);}})[_0xcc61('0x16')](function(_0x5e6926){logger[_0xcc61('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x1af7f3,_0x5e6926);_0x5b69fd(_0x5e6926);});});}
\ No newline at end of file
+var _0xd01b=['stringify','error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd01b,0x112));var _0xbd01=function(_0xd3db80,_0x59dbd8){_0xd3db80=_0xd3db80-0x0;var _0x154baf=_0xd01b[_0xd3db80];return _0x154baf;};'use strict';var _=require('lodash');var util=require(_0xbd01('0x0'));var moment=require('moment');var BPromise=require(_0xbd01('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd01('0x2'));var db=require(_0xbd01('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd01('0x4'))(_0xbd01('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd01('0x6')][_0xbd01('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f9ce5,_0x27fce7,_0x4e9952){return new BPromise(function(_0x178399,_0x2e2f2b){return client[_0xbd01('0x8')](_0x4f9ce5,_0x4e9952)['then'](function(_0x2111bb){logger[_0xbd01('0x9')](_0xbd01('0xa'),_0x27fce7,_0xbd01('0xb'));logger[_0xbd01('0xc')](_0xbd01('0xd'),_0x27fce7,_0xbd01('0xb'),JSON[_0xbd01('0xe')](_0x2111bb));if(_0x2111bb[_0xbd01('0xf')]){if(_0x2111bb[_0xbd01('0xf')]['code']===0x1f4){logger[_0xbd01('0xf')](_0xbd01('0xa'),_0x27fce7,_0x2111bb[_0xbd01('0xf')][_0xbd01('0x10')]);return _0x2e2f2b(_0x2111bb['error']['message']);}logger[_0xbd01('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x27fce7,_0x2111bb[_0xbd01('0xf')][_0xbd01('0x10')]);return _0x178399(_0x2111bb[_0xbd01('0xf')][_0xbd01('0x10')]);}else{logger[_0xbd01('0x9')]('ChatTransferReport,\x20%s,\x20%s',_0x27fce7,_0xbd01('0xb'));_0x178399(_0x2111bb['result']['message']);}})[_0xbd01('0x11')](function(_0x11e1c3){logger['error'](_0xbd01('0xa'),_0x27fce7,_0x11e1c3);_0x2e2f2b(_0x11e1c3);});});}
\ No newline at end of file
diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js
index 866d2bc..c91b7c0 100644
--- a/server/api/chatTransferReport/index.js
+++ b/server/api/chatTransferReport/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5f99=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','util','connect-timeout'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x5f99,0x1de));var _0x95f9=function(_0x337a1f,_0xe4b905){_0x337a1f=_0x337a1f-0x0;var _0x320f53=_0x5f99[_0x337a1f];return _0x320f53;};'use strict';var multer=require('multer');var util=require(_0x95f9('0x0'));var path=require('path');var timeout=require(_0x95f9('0x1'));var express=require(_0x95f9('0x2'));var router=express[_0x95f9('0x3')]();var fs_extra=require(_0x95f9('0x4'));var auth=require(_0x95f9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x95f9('0x6'));var controller=require('./chatTransferReport.controller');router[_0x95f9('0x7')]('/',auth[_0x95f9('0x8')](),controller[_0x95f9('0x9')]);router['get'](_0x95f9('0xa'),auth[_0x95f9('0x8')](),controller['describe']);router['get'](_0x95f9('0xb'),auth['isAuthenticated'](),controller[_0x95f9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x95f9('0xd')](_0x95f9('0xb'),auth[_0x95f9('0x8')](),controller[_0x95f9('0xe')]);router[_0x95f9('0xf')](_0x95f9('0xb'),auth[_0x95f9('0x8')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x054d=['/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','isAuthenticated','show','create','update','delete'];(function(_0x312cb2,_0x45f3b2){var _0xe10bef=function(_0x5ab658){while(--_0x5ab658){_0x312cb2['push'](_0x312cb2['shift']());}};_0xe10bef(++_0x45f3b2);}(_0x054d,0x120));var _0xd054=function(_0x5a0213,_0x4ff666){_0x5a0213=_0x5a0213-0x0;var _0x10af77=_0x054d[_0x5a0213];return _0x10af77;};'use strict';var multer=require('multer');var util=require(_0xd054('0x0'));var path=require(_0xd054('0x1'));var timeout=require(_0xd054('0x2'));var express=require(_0xd054('0x3'));var router=express[_0xd054('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd054('0x5'));var interaction=require(_0xd054('0x6'));var config=require(_0xd054('0x7'));var controller=require('./chatTransferReport.controller');router[_0xd054('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd054('0x8')](_0xd054('0x9'),auth['isAuthenticated'](),controller[_0xd054('0xa')]);router[_0xd054('0x8')]('/:id',auth[_0xd054('0xb')](),controller[_0xd054('0xc')]);router['post']('/',auth[_0xd054('0xb')](),controller[_0xd054('0xd')]);router['put']('/:id',auth[_0xd054('0xb')](),controller[_0xd054('0xe')]);router[_0xd054('0xf')](_0xd054('0x10'),auth[_0xd054('0xb')](),controller[_0xd054('0x11')]);module[_0xd054('0x12')]=router;
\ No newline at end of file
diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js
index 5a12a64..4ed7b72 100644
--- a/server/api/chatWebsite/chatWebsite.attributes.js
+++ b/server/api/chatWebsite/chatWebsite.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd2ea=['Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#011F6A','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea'];(function(_0x3fca05,_0x56d103){var _0x350b97=function(_0x5648ce){while(--_0x5648ce){_0x3fca05['push'](_0x3fca05['shift']());}};_0x350b97(++_0x56d103);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1c859a,_0x16c29b){_0x1c859a=_0x1c859a-0x0;var _0xb01c7a=_0xd2ea[_0x1c859a];return _0xb01c7a;};'use strict';var Sequelize=require(_0xad2e('0x0'));var rs=require(_0xad2e('0x1'));module[_0xad2e('0x2')]={'name':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xad2e('0x3')]},'mapKey':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'mapKeyOffline':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'key':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xad2e('0x3')]},'animation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xad2e('0x8')]('rounded',_0xad2e('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xa')},'start_chat_button':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xad2e('0xe')]},'closingQuestion':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x11')},'noteTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x12')},'placeholderMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x13')},'closingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x14')},'closingMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x16')},'ratingType':{'type':Sequelize[_0xad2e('0x8')](_0xad2e('0x17'),_0xad2e('0x18')),'defaultValue':_0xad2e('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xad2e('0xe')],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':_0xad2e('0x1a'),'variable':null,'config':{'placeholder':_0xad2e('0x1b'),'type':_0xad2e('0x1c'),'required':!![]},'props':{'title':_0xad2e('0x1b'),'helpText':''}},{'type':_0xad2e('0x1a'),'props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x1e'))?JSON[_0xad2e('0x1f')](this[_0xad2e('0x1d')](_0xad2e('0x1e'))):{};},'set':function(_0x58acc8){return this[_0xad2e('0x20')](_0xad2e('0x1e'),JSON[_0xad2e('0x19')](_0x58acc8));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':'input','props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':_0xad2e('0x4')},'variable':null},{'type':_0xad2e('0x21'),'config':{'placeholder':_0xad2e('0x22')},'props':{'title':_0xad2e('0x22'),'helpText':_0xad2e('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x24'))?JSON[_0xad2e('0x1f')](this['getDataValue'](_0xad2e('0x24'))):{};},'set':function(_0xfd2087){return this[_0xad2e('0x20')](_0xad2e('0x24'),JSON[_0xad2e('0x19')](_0xfd2087));}},'token':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':function(){return rs[_0xad2e('0x25')]();}},'autoclose':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xad2e('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xad2e('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x26')},'waitingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xad2e('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xad2e('0x2b');}},'notificationSound':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xad2e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2e')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2f')},'defaultTitle':{'type':Sequelize[_0xad2e('0x3')]},'customerAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xad2e('0x6')],'comment':_0xad2e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'comment':_0xad2e('0x32'),'set':function(_0x6f4fbc){if(!_0x6f4fbc)this[_0xad2e('0x20')](_0xad2e('0x33'),null);this['setDataValue'](_0xad2e('0x34'),_0x6f4fbc);}},'vidaooEscalation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xad2e('0x3')]},'vidaooTopic':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x35')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xad2e('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xad2e('0xe')]}};
\ No newline at end of file
+var _0xcb91=['INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Send','Skip','thumb','star','stringify','input','name','text','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xcb91[_0x33155c];return _0x5becf7;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1cb9('0x0')]={'name':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'unique':_0x1cb9('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x3')},'key':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x4')},'customerAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1cb9('0x1')]},'animation':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1cb9('0x9')]('rounded',_0x1cb9('0xa')),'defaultValue':_0x1cb9('0xb')},'header_online':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xc')},'start_chat_button':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xd')},'download_transcript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1cb9('0xf')]},'closingQuestion':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x11')},'noteTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x12')},'placeholderMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x13')},'closingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x14')},'skipMessageButton':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'conditionAgreement':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x1cb9('0x9')]('star',_0x1cb9('0x16')),'defaultValue':_0x1cb9('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'variable':null,'config':{'placeholder':_0x1cb9('0x1a'),'type':_0x1cb9('0x1b'),'required':!![]},'props':{'title':_0x1cb9('0x1a'),'helpText':''}},{'type':_0x1cb9('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1cb9('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x1cb9('0x1c'))?JSON[_0x1cb9('0x1d')](this[_0x1cb9('0x1e')](_0x1cb9('0x1c'))):{};},'set':function(_0x43a100){return this['setDataValue'](_0x1cb9('0x1c'),JSON[_0x1cb9('0x18')](_0x43a100));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'props':{'title':_0x1cb9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x1cb9('0x3'),'type':_0x1cb9('0x3')},'variable':null},{'type':_0x1cb9('0x1f'),'config':{'placeholder':_0x1cb9('0x20')},'props':{'title':_0x1cb9('0x20'),'helpText':_0x1cb9('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x1cb9('0x1e')]('offlineForm')?JSON[_0x1cb9('0x1d')](this['getDataValue'](_0x1cb9('0x22'))):{};},'set':function(_0x4efebc){return this[_0x1cb9('0x23')](_0x1cb9('0x22'),JSON[_0x1cb9('0x18')](_0x4efebc));}},'token':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1cb9('0x1')]},'forwardOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x24')},'offlineMessageBody':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x26')},'skipUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'sendUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1cb9('0x1')]},'notificationTemplate':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':function(){return _0x1cb9('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x29')},'verticalAlignment':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2a')},'defaultTitle':{'type':Sequelize[_0x1cb9('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2b')},'systemAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'comment':_0x1cb9('0x2c'),'set':function(_0x7a0d8b){if(!_0x7a0d8b)this[_0x1cb9('0x23')](_0x1cb9('0x2d'),null);this[_0x1cb9('0x23')](_0x1cb9('0x2e'),_0x7a0d8b);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x1cb9('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x1cb9('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1cb9('0xf')]}};
\ No newline at end of file
diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js
index 62fc0d5..86a789a 100644
--- a/server/api/chatWebsite/chatWebsite.controller.js
+++ b/server/api/chatWebsite/chatWebsite.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xf6ef=['join','custom','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','user-agent','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','asc','ListId','contact','customerIp','headers','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','firstName','messageId','created','close','*,*,*,*','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','files','no\x20available\x20attributes','CompanyId','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','originalname','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','findOne','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','remove','addInteraction','omit','Contact','User','internal','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','increment','chatLicenseExceeded','all','some','readFileSync','remote','x-real-ip','remoteAddress','replace','render','alignment','verticalAlignment','labelText','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','destroy','then','get','ChatWebsites','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','ChatWebsite','include','findAll','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','filter','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','includeAll','rows','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo'];(function(_0x5e3c7c,_0x2d533d){var _0x352d5c=function(_0x26a4d8){while(--_0x26a4d8){_0x5e3c7c['push'](_0x5e3c7c['shift']());}};_0x352d5c(++_0x2d533d);}(_0xf6ef,0xb7));var _0xff6e=function(_0x1569fc,_0x115095){_0x1569fc=_0x1569fc-0x0;var _0x277783=_0xf6ef[_0x1569fc];return _0x277783;};'use strict';var BPromise=require(_0xff6e('0x0'));var Mustache=require(_0xff6e('0x1'));var util=require('util');var path=require(_0xff6e('0x2'));var ejs=require(_0xff6e('0x3'));var fs=require('fs');var fs_extra=require(_0xff6e('0x4'));var _=require(_0xff6e('0x5'));var querystring=require(_0xff6e('0x6'));var Redis=require(_0xff6e('0x7'));var qs=require(_0xff6e('0x8'));var logger=require(_0xff6e('0x9'))(_0xff6e('0xa'));var config=require(_0xff6e('0xb'));var db=require(_0xff6e('0xc'))['db'];config['redis']=_[_0xff6e('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff6e('0xe'))(new Redis(config[_0xff6e('0xf')]));require(_0xff6e('0x10'))[_0xff6e('0x11')](socket);var htmlToText=require(_0xff6e('0x12'));var jayson=require(_0xff6e('0x13'));var client=jayson[_0xff6e('0x14')][_0xff6e('0x15')]({'port':0x232c});var client9002=jayson[_0xff6e('0x14')][_0xff6e('0x15')]({'port':0x232a});var client9003=jayson[_0xff6e('0x14')][_0xff6e('0x15')]({'port':0x232b});var client9001=jayson[_0xff6e('0x14')][_0xff6e('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x2207e6,_0x3d0589,_0x39e326,_0x10897c){return new BPromise(function(_0x4bc343,_0x7e7b8e){var _0x1e0843=_0x10897c||client;return _0x1e0843[_0xff6e('0x16')](_0x2207e6,_0x39e326)['then'](function(_0x562ee4){logger[_0xff6e('0x17')](_0xff6e('0x18'),_0x3d0589,'request\x20sent');logger[_0xff6e('0x19')](_0xff6e('0x1a'),_0x3d0589,_0xff6e('0x1b'),JSON[_0xff6e('0x1c')](_0x562ee4));if(_0x562ee4[_0xff6e('0x1d')]){if(_0x562ee4[_0xff6e('0x1d')][_0xff6e('0x1e')]===0x1f4){logger['error'](_0xff6e('0x18'),_0x3d0589,_0x562ee4[_0xff6e('0x1d')]['message']);return _0x7e7b8e(_0x562ee4[_0xff6e('0x1d')][_0xff6e('0x1f')]);}logger['error'](_0xff6e('0x18'),_0x3d0589,_0x562ee4['error']['message']);return _0x4bc343(_0x562ee4[_0xff6e('0x1d')]['message']);}else{logger['info'](_0xff6e('0x18'),_0x3d0589,'request\x20sent');_0x4bc343(_0x562ee4['result'][_0xff6e('0x1f')]);}})[_0xff6e('0x20')](function(_0x1de941){logger[_0xff6e('0x1d')](_0xff6e('0x18'),_0x3d0589,_0x1de941);_0x7e7b8e(_0x1de941);});});}function respondWithStatusCode(_0x46395c,_0x1434e0){_0x1434e0=_0x1434e0||0xcc;return function(_0x442cba){if(_0x442cba){return _0x46395c[_0xff6e('0x21')](_0x1434e0);}return _0x46395c[_0xff6e('0x22')](_0x1434e0)[_0xff6e('0x23')]();};}function respondWithResult(_0x4fe3e9,_0x5c0cf1){_0x5c0cf1=_0x5c0cf1||0xc8;return function(_0x5a4166){if(_0x5a4166){return _0x4fe3e9[_0xff6e('0x22')](_0x5c0cf1)[_0xff6e('0x24')](_0x5a4166);}};}function respondWithFilteredResult(_0x2f9f33,_0x67a508){return function(_0x16f3c4){if(_0x16f3c4){var _0x4368cf=typeof _0x67a508[_0xff6e('0x25')]===_0xff6e('0x26')&&typeof _0x67a508['limit']===_0xff6e('0x26');var _0x3a068c=_0x16f3c4['count'];var _0x7b1e0d=_0x4368cf?0x0:_0x67a508[_0xff6e('0x25')];var _0x767387=_0x4368cf?_0x16f3c4[_0xff6e('0x27')]:_0x67a508[_0xff6e('0x25')]+_0x67a508[_0xff6e('0x28')];var _0x5cca92;if(_0x767387>=_0x3a068c){_0x767387=_0x3a068c;_0x5cca92=0xc8;}else{_0x5cca92=0xce;}_0x2f9f33['status'](_0x5cca92);return _0x2f9f33['set'](_0xff6e('0x29'),_0x7b1e0d+'-'+_0x767387+'/'+_0x3a068c)['json'](_0x16f3c4);}return null;};}function saveUpdates(_0xf4b274){return function(_0x5790da){if(_0x5790da){return _0x5790da[_0xff6e('0x2a')](_0xf4b274)['then'](function(_0x4fe414){return _0x4fe414;});}return null;};}function removeEntity(_0x506342){return function(_0x39bcda){if(_0x39bcda){return _0x39bcda[_0xff6e('0x2b')]()[_0xff6e('0x2c')](function(){var _0x11d0a4=_0x39bcda[_0xff6e('0x2d')]({'plain':!![]});var _0x116fa1=_0xff6e('0x2e');return db[_0xff6e('0x2f')]['destroy']({'where':{'type':_0x116fa1,'resourceId':_0x11d0a4['id']}})['then'](function(){return _0x39bcda;});})['then'](function(){_0x506342['status'](0xcc)[_0xff6e('0x23')]();});}};}function handleEntityNotFound(_0x336fc6){return function(_0x2959f7){if(!_0x2959f7){_0x336fc6[_0xff6e('0x21')](0x194);}return _0x2959f7;};}function handleError(_0x328bb2,_0xfc8108){_0xfc8108=_0xfc8108||0x1f4;return function(_0x4ae7aa){logger['error'](_0x4ae7aa[_0xff6e('0x30')]);if(_0x4ae7aa[_0xff6e('0x31')]){delete _0x4ae7aa[_0xff6e('0x31')];}_0x328bb2['status'](_0xfc8108)['send'](_0x4ae7aa);};}exports['index']=function(_0xbbfa03,_0x32bd6e){var _0x37acaf={'include':[{'model':db[_0xff6e('0x32')],'as':_0xff6e('0x33')}]},_0x47e4b1={},_0x17d17d={'count':0x0,'rows':[]};var _0x16cb12=_[_0xff6e('0x34')](db['ChatWebsite'][_0xff6e('0x35')],function(_0x521aa3){return{'name':_0x521aa3[_0xff6e('0x36')],'type':_0x521aa3[_0xff6e('0x37')][_0xff6e('0x38')]};});_0x47e4b1['model']=_['map'](_0x16cb12,_0xff6e('0x31'));_0x47e4b1['query']=_['keys'](_0xbbfa03[_0xff6e('0x39')]);_0x47e4b1[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x47e4b1['model'],_0x47e4b1[_0xff6e('0x39')]);_0x37acaf['attributes']=_[_0xff6e('0x3b')](_0x47e4b1[_0xff6e('0x3c')],qs[_0xff6e('0x3d')](_0xbbfa03[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x37acaf[_0xff6e('0x3e')]=_0x37acaf['attributes'][_0xff6e('0x3f')]?_0x37acaf[_0xff6e('0x3e')]:_0x47e4b1[_0xff6e('0x3c')];if(!_0xbbfa03[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x37acaf['limit']=qs[_0xff6e('0x28')](_0xbbfa03['query']['limit']);_0x37acaf[_0xff6e('0x25')]=qs[_0xff6e('0x25')](_0xbbfa03[_0xff6e('0x39')]['offset']);}_0x37acaf[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0xbbfa03[_0xff6e('0x39')][_0xff6e('0x43')]);_0x37acaf[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0xbbfa03['query'],_0x47e4b1[_0xff6e('0x3a')]),_0x16cb12);if(_0xbbfa03[_0xff6e('0x39')]['filter']){_0x37acaf[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x37acaf[_0xff6e('0x44')],{'$or':_[_0xff6e('0x34')](_0x16cb12,function(_0x54fad9){if(_0x54fad9['type']!==_0xff6e('0x47')){var _0x5ca2a8={};_0x5ca2a8[_0x54fad9[_0xff6e('0x31')]]={'$like':'%'+_0xbbfa03[_0xff6e('0x39')]['filter']+'%'};return _0x5ca2a8;}})});}_0x37acaf=_[_0xff6e('0x46')]({},_0x37acaf,_0xbbfa03['options']);var _0x31abdc={'where':_0x37acaf[_0xff6e('0x44')]};return db[_0xff6e('0x48')][_0xff6e('0x27')](_0x31abdc)[_0xff6e('0x2c')](function(_0xfa48f8){_0x17d17d[_0xff6e('0x27')]=_0xfa48f8;if(_0xbbfa03[_0xff6e('0x39')]['includeAll']){_0x37acaf[_0xff6e('0x49')]=[{'all':!![]}];}return db['ChatWebsite'][_0xff6e('0x4a')](_0x37acaf);})[_0xff6e('0x2c')](function(_0x163ddd){_0x17d17d['rows']=_0x163ddd;return _0x17d17d;})[_0xff6e('0x2c')](respondWithFilteredResult(_0x32bd6e,_0x37acaf))[_0xff6e('0x20')](handleError(_0x32bd6e,null));};exports[_0xff6e('0x4b')]=function(_0x3f2a64,_0x4cdf44){var _0x51a6b1={'raw':![],'where':{'id':_0x3f2a64[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0x32')],'as':'mandatoryDispositionPause'}]},_0x180db1={};_0x180db1[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x48')][_0xff6e('0x35')]);_0x180db1['query']=_[_0xff6e('0x4d')](_0x3f2a64['query']);_0x180db1[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x180db1[_0xff6e('0x3c')],_0x180db1[_0xff6e('0x39')]);_0x51a6b1[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x180db1[_0xff6e('0x3c')],qs['fields'](_0x3f2a64['query'][_0xff6e('0x3d')]));_0x51a6b1[_0xff6e('0x3e')]=_0x51a6b1['attributes'][_0xff6e('0x3f')]?_0x51a6b1[_0xff6e('0x3e')]:_0x180db1[_0xff6e('0x3c')];if(_0x3f2a64['query']['includeAll']){_0x51a6b1[_0xff6e('0x49')]=[{'all':!![]}];}_0x51a6b1=_[_0xff6e('0x46')]({},_0x51a6b1,_0x3f2a64['options']);return db['ChatWebsite']['find'](_0x51a6b1)[_0xff6e('0x2c')](handleEntityNotFound(_0x4cdf44,null))[_0xff6e('0x2c')](respondWithResult(_0x4cdf44,null))['catch'](handleError(_0x4cdf44,null));};exports[_0xff6e('0x4e')]=function(_0x4f3ee2,_0x57fe29){return db[_0xff6e('0x48')][_0xff6e('0x4e')](_0x4f3ee2['body'],{})['then'](function(_0x3f3402){var _0x229520=_0x4f3ee2[_0xff6e('0x4f')][_0xff6e('0x2d')]({'plain':!![]});if(!_0x229520)throw new Error(_0xff6e('0x50'));if(_0x229520[_0xff6e('0x51')]===_0xff6e('0x4f')){var _0x4193a3=_0x3f3402[_0xff6e('0x2d')]({'plain':!![]});var _0x35786b=_0xff6e('0x2e');return db[_0xff6e('0x52')]['find']({'where':{'name':_0x35786b,'userProfileId':_0x229520[_0xff6e('0x53')]},'raw':!![]})[_0xff6e('0x2c')](function(_0x10e86e){if(_0x10e86e&&_0x10e86e[_0xff6e('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4193a3[_0xff6e('0x31')],'resourceId':_0x4193a3['id'],'type':_0x10e86e['name'],'sectionId':_0x10e86e['id']},{})['then'](function(){return _0x3f3402;});}else{return _0x3f3402;}})[_0xff6e('0x20')](function(_0x4c15da){logger[_0xff6e('0x1d')](_0xff6e('0x55'),_0x4c15da);throw _0x4c15da;});}return _0x3f3402;})[_0xff6e('0x2c')](respondWithResult(_0x57fe29,0xc9))[_0xff6e('0x20')](handleError(_0x57fe29,null));};exports['update']=function(_0x25ae40,_0x313aa5){if(_0x25ae40['body']['id']){delete _0x25ae40['body']['id'];}return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x25ae40[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0x32')],'as':_0xff6e('0x33')}]})['then'](handleEntityNotFound(_0x313aa5,null))[_0xff6e('0x2c')](saveUpdates(_0x25ae40[_0xff6e('0x57')],null))[_0xff6e('0x2c')](respondWithResult(_0x313aa5,null))[_0xff6e('0x20')](handleError(_0x313aa5,null));};exports[_0xff6e('0x2b')]=function(_0x5ea82f,_0x176ea6){return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x5ea82f['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x176ea6,null))[_0xff6e('0x2c')](removeEntity(_0x176ea6,null))[_0xff6e('0x20')](handleError(_0x176ea6,null));};exports[_0xff6e('0x58')]=function(_0x514ed9,_0x2eee5a){return db[_0xff6e('0x48')][_0xff6e('0x58')]()[_0xff6e('0x2c')](respondWithResult(_0x2eee5a,null))[_0xff6e('0x20')](handleError(_0x2eee5a,null));};exports[_0xff6e('0x59')]=function(_0x4ec4ee,_0x2a784e){if(_0x4ec4ee[_0xff6e('0x57')]['id']){delete _0x4ec4ee[_0xff6e('0x57')]['id'];}return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x4ec4ee[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x2a784e,null))[_0xff6e('0x2c')](function(_0x50cb5c){if(_0x50cb5c){_0x4ec4ee['body'][_0xff6e('0x5a')]=_0x50cb5c['id'];return db[_0xff6e('0x5b')][_0xff6e('0x4e')](_0x4ec4ee[_0xff6e('0x57')]);}})[_0xff6e('0x2c')](respondWithResult(_0x2a784e,null))['catch'](handleError(_0x2a784e,null));};exports[_0xff6e('0x5c')]=function(_0x1363ad,_0xe0ba1f){var _0x43ef02={'raw':![],'where':{}};var _0x1d0537={};var _0x108579={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1363ad[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0xe0ba1f,null))[_0xff6e('0x2c')](function(_0x313a68){if(_0x313a68){_0x1d0537[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x5b')][_0xff6e('0x35')]);_0x1d0537['query']=_['keys'](_0x1363ad[_0xff6e('0x39')]);_0x1d0537[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x1d0537[_0xff6e('0x3c')],_0x1d0537[_0xff6e('0x39')]);_0x43ef02[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x1d0537[_0xff6e('0x3c')],qs[_0xff6e('0x3d')](_0x1363ad[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x43ef02[_0xff6e('0x3e')]=_0x43ef02['attributes'][_0xff6e('0x3f')]?_0x43ef02[_0xff6e('0x3e')]:_0x1d0537[_0xff6e('0x3c')];if(!_0x1363ad[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x43ef02['limit']=qs[_0xff6e('0x28')](_0x1363ad[_0xff6e('0x39')]['limit']);_0x43ef02[_0xff6e('0x25')]=qs['offset'](_0x1363ad[_0xff6e('0x39')]['offset']);}_0x43ef02['order']=qs['sort'](_0x1363ad[_0xff6e('0x39')]['sort']);_0x43ef02[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0x1363ad['query'],_0x1d0537[_0xff6e('0x3a')]));_0x43ef02['where']['ChatWebsiteId']=_0x313a68['id'];if(_0x1363ad[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x43ef02[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x43ef02[_0xff6e('0x44')],{'$or':_[_0xff6e('0x34')](_0x43ef02['attributes'],function(_0x3bb4d8){var _0x483e81={};_0x483e81[_0x3bb4d8]={'$like':'%'+_0x1363ad[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x483e81;})});}_0x43ef02=_['merge']({},_0x43ef02,_0x1363ad[_0xff6e('0x5e')]);return db[_0xff6e('0x5b')][_0xff6e('0x27')]({'where':_0x43ef02['where']})[_0xff6e('0x2c')](function(_0x4aec2f){_0x108579['count']=_0x4aec2f;if(_0x1363ad[_0xff6e('0x39')]['includeAll']){_0x43ef02[_0xff6e('0x49')]=[{'all':!![]}];}return db[_0xff6e('0x5b')][_0xff6e('0x4a')](_0x43ef02);})['then'](function(_0x151277){_0x108579['rows']=_0x151277;return _0x108579;});}})[_0xff6e('0x2c')](respondWithFilteredResult(_0xe0ba1f,_0x43ef02))[_0xff6e('0x20')](handleError(_0xe0ba1f,null));};exports['removeDispositions']=function(_0x4872a7,_0x11b610){return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x4872a7['params']['id']}})['then'](handleEntityNotFound(_0x11b610,null))['then'](function(_0x40c826){if(_0x40c826){return _0x40c826[_0xff6e('0x5f')](_0x4872a7[_0xff6e('0x39')][_0xff6e('0x60')]);}})['then'](respondWithStatusCode(_0x11b610,null))['catch'](handleError(_0x11b610,null));};exports[_0xff6e('0x61')]=function(_0x5b99fa,_0x1e9591){if(_0x5b99fa[_0xff6e('0x57')]['id']){delete _0x5b99fa[_0xff6e('0x57')]['id'];}return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x5b99fa[_0xff6e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e9591,null))[_0xff6e('0x2c')](function(_0x42b143){if(_0x42b143){_0x5b99fa['body'][_0xff6e('0x5a')]=_0x42b143['id'];return db[_0xff6e('0x62')][_0xff6e('0x4e')](_0x5b99fa[_0xff6e('0x57')]);}})[_0xff6e('0x2c')](respondWithResult(_0x1e9591,null))[_0xff6e('0x20')](handleError(_0x1e9591,null));};exports[_0xff6e('0x63')]=function(_0xcdfddb,_0x42805d){var _0x433e50={'raw':![],'where':{}};var _0x4adcf1={};var _0x58da08={'count':0x0,'rows':[]};return db[_0xff6e('0x48')]['findOne']({'where':{'id':_0xcdfddb[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x42805d,null))[_0xff6e('0x2c')](function(_0x496aea){if(_0x496aea){_0x4adcf1[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x62')]['rawAttributes']);_0x4adcf1[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0xcdfddb[_0xff6e('0x39')]);_0x4adcf1[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x4adcf1['model'],_0x4adcf1[_0xff6e('0x39')]);_0x433e50[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x4adcf1[_0xff6e('0x3c')],qs[_0xff6e('0x3d')](_0xcdfddb[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x433e50['attributes']=_0x433e50[_0xff6e('0x3e')]['length']?_0x433e50[_0xff6e('0x3e')]:_0x4adcf1[_0xff6e('0x3c')];if(!_0xcdfddb[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x433e50[_0xff6e('0x28')]=qs[_0xff6e('0x28')](_0xcdfddb[_0xff6e('0x39')]['limit']);_0x433e50[_0xff6e('0x25')]=qs['offset'](_0xcdfddb['query'][_0xff6e('0x25')]);}_0x433e50[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0xcdfddb[_0xff6e('0x39')][_0xff6e('0x43')]);_0x433e50[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0xcdfddb[_0xff6e('0x39')],_0x4adcf1[_0xff6e('0x3a')]));_0x433e50[_0xff6e('0x44')][_0xff6e('0x5a')]=_0x496aea['id'];if(_0xcdfddb['query'][_0xff6e('0x5d')]){_0x433e50[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x433e50[_0xff6e('0x44')],{'$or':_['map'](_0x433e50[_0xff6e('0x3e')],function(_0x5e07fb){var _0x5294d2={};_0x5294d2[_0x5e07fb]={'$like':'%'+_0xcdfddb['query'][_0xff6e('0x5d')]+'%'};return _0x5294d2;})});}_0x433e50=_[_0xff6e('0x46')]({},_0x433e50,_0xcdfddb[_0xff6e('0x5e')]);return db[_0xff6e('0x62')]['count']({'where':_0x433e50[_0xff6e('0x44')]})[_0xff6e('0x2c')](function(_0x168530){_0x58da08[_0xff6e('0x27')]=_0x168530;if(_0xcdfddb[_0xff6e('0x39')][_0xff6e('0x64')]){_0x433e50['include']=[{'all':!![]}];}return db[_0xff6e('0x62')][_0xff6e('0x4a')](_0x433e50);})[_0xff6e('0x2c')](function(_0x5c7c0a){_0x58da08[_0xff6e('0x65')]=_0x5c7c0a;return _0x58da08;});}})[_0xff6e('0x2c')](respondWithFilteredResult(_0x42805d,_0x433e50))[_0xff6e('0x20')](handleError(_0x42805d,null));};exports[_0xff6e('0x66')]=function(_0x4e5bc1,_0x23a26d){return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x4e5bc1[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x23a26d,null))[_0xff6e('0x2c')](function(_0x3b74f6){if(_0x3b74f6){return _0x3b74f6[_0xff6e('0x66')](_0x4e5bc1['query'][_0xff6e('0x60')]);}})[_0xff6e('0x2c')](respondWithStatusCode(_0x23a26d,null))['catch'](handleError(_0x23a26d,null));};exports[_0xff6e('0x67')]=function(_0x13412e,_0x30dee9){_0x13412e['body'][_0xff6e('0x68')]=_0x13412e['file'][_0xff6e('0x69')];return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x13412e[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x30dee9,null))['then'](saveUpdates(_0x13412e[_0xff6e('0x57')],null))[_0xff6e('0x2c')](respondWithResult(_0x30dee9,null))['catch'](handleError(_0x30dee9,null));};exports['addAvatar']=function(_0x4bee00,_0x573016){_0x4bee00[_0xff6e('0x57')][_0xff6e('0x6a')]=_0x4bee00[_0xff6e('0x6b')]['filename'];return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x4bee00[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x573016,null))[_0xff6e('0x2c')](saveUpdates(_0x4bee00[_0xff6e('0x57')],null))[_0xff6e('0x2c')](respondWithResult(_0x573016,null))[_0xff6e('0x20')](handleError(_0x573016,null));};exports[_0xff6e('0x6c')]=function(_0x4768fb,_0x1f4b08){_0x4768fb[_0xff6e('0x57')][_0xff6e('0x6d')]=_0x4768fb['file'][_0xff6e('0x69')];return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x4768fb[_0xff6e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f4b08,null))[_0xff6e('0x2c')](saveUpdates(_0x4768fb[_0xff6e('0x57')],null))['then'](respondWithResult(_0x1f4b08,null))[_0xff6e('0x20')](handleError(_0x1f4b08,null));};exports[_0xff6e('0x6e')]=function(_0x5c7c2f,_0x566818){_0x5c7c2f[_0xff6e('0x57')]['systemAvatar']=_0x5c7c2f[_0xff6e('0x6b')][_0xff6e('0x69')];return db[_0xff6e('0x48')]['find']({'where':{'id':_0x5c7c2f['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x566818,null))[_0xff6e('0x2c')](saveUpdates(_0x5c7c2f[_0xff6e('0x57')],null))[_0xff6e('0x2c')](respondWithResult(_0x566818,null))[_0xff6e('0x20')](handleError(_0x566818,null));};exports[_0xff6e('0x6f')]=function(_0x368e34,_0x591232){var _0x4390f1=path[_0xff6e('0x70')](config['root'],'server/files/images/logos/default_logo.svg');var _0x34bfc1={'where':{'id':_0x368e34[_0xff6e('0x4c')]['id']},'attributes':['id',_0xff6e('0x68')],'raw':!![]};var _0x456b6d=![];return require('../../config/license/util')['getLicense']()[_0xff6e('0x2c')](function(_0x5ba45c){if(_0x5ba45c){_0x456b6d=_0x5ba45c[_0xff6e('0x71')];}})[_0xff6e('0x2c')](function(){return db[_0xff6e('0x48')][_0xff6e('0x56')](_0x34bfc1);})[_0xff6e('0x2c')](handleEntityNotFound(_0x591232,null))['then'](function(_0x5558ea){if(_0x5558ea){if(!_['isNil'](_0x5558ea[_0xff6e('0x68')])){if(fs['existsSync'](path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x73'),_0x5558ea[_0xff6e('0x68')]))&&_0x456b6d){_0x4390f1=path['join'](config['root'],_0xff6e('0x73'),_0x5558ea[_0xff6e('0x68')]);}}return _0x591232[_0xff6e('0x74')](_0x4390f1);}})['catch'](handleError(_0x591232,null));};exports[_0xff6e('0x75')]=function(_0x1dffb1,_0x14cb8b){var _0x430a14=path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x76'));var _0x2051e8={'where':{'id':_0x1dffb1['params']['id']},'attributes':['id',_0xff6e('0x6a')],'raw':!![]};return db[_0xff6e('0x48')][_0xff6e('0x56')](_0x2051e8)[_0xff6e('0x2c')](handleEntityNotFound(_0x14cb8b,null))[_0xff6e('0x2c')](function(_0xec37b){if(_0xec37b){if(!_[_0xff6e('0x77')](_0xec37b[_0xff6e('0x6a')])){if(fs[_0xff6e('0x78')](path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x79'),_0xec37b[_0xff6e('0x6a')]))){_0x430a14=path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x79'),_0xec37b[_0xff6e('0x6a')]);}}return _0x14cb8b[_0xff6e('0x74')](_0x430a14);}})[_0xff6e('0x20')](handleError(_0x14cb8b,null));};exports[_0xff6e('0x7a')]=function(_0x5998c9,_0x291612){var _0x2f3d7c=path[_0xff6e('0x70')](config[_0xff6e('0x72')],'server/files/images/avatars/customer_avatar.png');var _0x20577d={'where':{'id':_0x5998c9['params']['id']},'attributes':['id',_0xff6e('0x6d'),_0xff6e('0x7b')],'raw':!![]};return db[_0xff6e('0x48')][_0xff6e('0x56')](_0x20577d)[_0xff6e('0x2c')](handleEntityNotFound(_0x291612,null))[_0xff6e('0x2c')](function(_0x389c8c){if(_0x389c8c){if(!_[_0xff6e('0x77')](_0x389c8c[_0xff6e('0x6d')])){if(fs[_0xff6e('0x78')](path['join'](config[_0xff6e('0x72')],'server/files/images/avatars/',_0x389c8c[_0xff6e('0x6d')]))&&_0x389c8c[_0xff6e('0x7b')]){_0x2f3d7c=path[_0xff6e('0x70')](config['root'],'server/files/images/avatars/',_0x389c8c[_0xff6e('0x6d')]);}}return _0x291612['download'](_0x2f3d7c);}})['catch'](handleError(_0x291612,null));};exports['getSystemAvatar']=function(_0x4add1f,_0x419ae6){var _0x2d7cfd=path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x7c'));var _0x42d9f7={'where':{'id':_0x4add1f[_0xff6e('0x4c')]['id']},'attributes':['id',_0xff6e('0x7d')],'raw':!![]};return db[_0xff6e('0x48')][_0xff6e('0x56')](_0x42d9f7)[_0xff6e('0x2c')](handleEntityNotFound(_0x419ae6,null))[_0xff6e('0x2c')](function(_0x555552){if(_0x555552){if(!_['isNil'](_0x555552[_0xff6e('0x7d')])){if(fs[_0xff6e('0x78')](path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x79'),_0x555552[_0xff6e('0x7d')]))){_0x2d7cfd=path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x79'),_0x555552[_0xff6e('0x7d')]);}}return _0x419ae6[_0xff6e('0x74')](_0x2d7cfd);}})['catch'](handleError(_0x419ae6,null));};exports[_0xff6e('0x7e')]=function(_0x3a6c88,_0x5bb1af){var _0x1d471f=require(_0xff6e('0x7f'));var _0x30dec5=new _0x1d471f();var _0x46dbe7=_0x30dec5['setUA'](_0x3a6c88['headers'][_0xff6e('0x80')])['getResult']();var _0x50a199={'body':_0x3a6c88['body'],'channel':_0xff6e('0x81')};var _0x1df2a9=[];var _0x1dae1f=[];var _0x1d5cb4={};var _0x2949d7=![];return db[_0xff6e('0x82')][_0xff6e('0x58')]()[_0xff6e('0x2c')](function(_0x23df81){if(!_0x23df81){throw new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))]('no\x20available\x20attributes');}_0x1df2a9=_[_0xff6e('0x85')](_['keys'](_0x23df81),[_0xff6e('0x86'),_0xff6e('0x87')]);_0x1dae1f=_[_0xff6e('0x85')](_[_0xff6e('0x4d')](_0x23df81),[_0xff6e('0x86'),_0xff6e('0x87'),'CompanyId','ListId']);if(_0x3a6c88['body']['id']){delete _0x3a6c88['body']['id'];}if(_[_0xff6e('0x77')](_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x88')])){throw new db[(_0xff6e('0x83'))]['ValidationError'](_0xff6e('0x89'));}if(_[_0xff6e('0x77')](_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x57')])||_0x3a6c88[_0xff6e('0x57')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xff6e('0x77')](_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x8a')])){throw new db['Sequelize'][(_0xff6e('0x84'))](_0xff6e('0x8b')+_0x1dae1f);}if(!_[_0xff6e('0x8c')](_0x1dae1f,_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x8a')])){throw new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))](_0xff6e('0x8d')+_0x1dae1f);}_0x1d5cb4[_0x3a6c88['body'][_0xff6e('0x8a')]]=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x88')];})[_0xff6e('0x2c')](function(){return db[_0xff6e('0x48')]['find']({'where':{'id':_0x3a6c88[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0x8e')],'as':_0xff6e('0x8f'),'include':[{'model':db[_0xff6e('0x82')],'as':_0xff6e('0x90'),'where':_0x1d5cb4,'limit':0x1,'order':[[_0xff6e('0x87'),_0xff6e('0x91')]]}]},{'model':db[_0xff6e('0x92')],'as':_0xff6e('0x93')}]});})[_0xff6e('0x2c')](handleEntityNotFound(_0x5bb1af,null))[_0xff6e('0x2c')](function(_0x617be2){if(_0x617be2&&_0x617be2[_0xff6e('0x8f')]){_0x50a199[_0xff6e('0x94')]=_0x617be2;_0x50a199[_0xff6e('0x95')]=_0x617be2[_0xff6e('0x93')];_0x50a199['list']=_0x617be2[_0xff6e('0x8f')];_0x50a199[_0xff6e('0x95')]=_['orderBy'](_0x50a199['applications'],['priority'],[_0xff6e('0x96')]);if(_0x50a199['account']['Applications']){delete _0x50a199[_0xff6e('0x94')][_0xff6e('0x93')];}if(_0x50a199[_0xff6e('0x94')]['List']&&_0x50a199['account'][_0xff6e('0x8f')][_0xff6e('0x90')][_0xff6e('0x3f')]){return _0x50a199[_0xff6e('0x94')][_0xff6e('0x8f')][_0xff6e('0x90')][0x0];}var _0x1a55f9=_['defaults'](_0x3a6c88[_0xff6e('0x57')],{'firstName':_0x3a6c88[_0xff6e('0x57')]['from'],'ListId':_0x617be2[_0xff6e('0x97')]});_0x1a55f9[_0x3a6c88['body'][_0xff6e('0x8a')]]=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x88')];return db['CmContact'][_0xff6e('0x4e')](_0x1a55f9,{'fields':_0x1df2a9,'raw':!![]});}})[_0xff6e('0x2c')](handleEntityNotFound(_0x5bb1af,null))[_0xff6e('0x2c')](function(_0x576f7e){_0x50a199[_0xff6e('0x98')]=_0x576f7e;var _0x340dca=_0x3a6c88['body'][_0xff6e('0x99')];if(_0x3a6c88['headers']['cf-connecting-ip']){_0x340dca=_0x3a6c88[_0xff6e('0x9a')]['cf-connecting-ip'];}else if(_0x3a6c88[_0xff6e('0x9a')][_0xff6e('0x9b')]){_0x340dca=_[_0xff6e('0x9c')](_0x3a6c88[_0xff6e('0x9a')][_0xff6e('0x9b')][_0xff6e('0x9d')](','));}if(_0x576f7e){var _0x47e04c={'ContactId':_0x576f7e['id'],'ChatWebsiteId':_0x3a6c88[_0xff6e('0x4c')]['id'],'from':(_0x576f7e['firstName']||'')+'\x20'+(_0x576f7e[_0xff6e('0x9e')]||''),'customerIp':_0x340dca,'customerPort':_0x3a6c88[_0xff6e('0x9a')][_0xff6e('0x9f')]?_0x3a6c88[_0xff6e('0x9a')]['x-real-port']:null,'referer':_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xa0')],'browserName':_0x46dbe7['browser'][_0xff6e('0x31')]&&_0x46dbe7[_0xff6e('0xa1')][_0xff6e('0xa2')]?util[_0xff6e('0xa3')](_0xff6e('0xa4'),_0x46dbe7[_0xff6e('0xa1')]['name'],_0x46dbe7['browser'][_0xff6e('0xa2')]):_0xff6e('0xa5'),'browserVersion':_0x46dbe7[_0xff6e('0xa1')]['version']||_0xff6e('0xa5'),'osName':util['format'](_0xff6e('0xa4'),_0x46dbe7['os'][_0xff6e('0x31')],_0x46dbe7['os'][_0xff6e('0xa2')]),'osVersion':_0x46dbe7['os']['version'],'deviceModel':_0x46dbe7[_0xff6e('0xa6')][_0xff6e('0x3c')]&&_0x46dbe7[_0xff6e('0xa6')][_0xff6e('0xa7')]?util['format'](_0xff6e('0xa8'),_0x46dbe7[_0xff6e('0xa6')][_0xff6e('0x3c')],_0x46dbe7[_0xff6e('0xa6')]['vendor'],_0x46dbe7[_0xff6e('0xa6')][_0xff6e('0x37')]):null,'deviceVendor':_0x46dbe7['device'][_0xff6e('0xa7')],'deviceType':_0x46dbe7['device'][_0xff6e('0x37')],'formData':JSON['stringify'](_0x3a6c88[_0xff6e('0x57')])};var _0x18a802={'ChatWebsiteId':_0x3a6c88[_0xff6e('0x4c')]['id'],'closed':![]};if(_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xa9')]){_0x18a802[_0xff6e('0xa9')]=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xa9')];return db['ChatInteraction'][_0xff6e('0x56')]({'where':_0x18a802})[_0xff6e('0x2c')](function(_0x2b9af8){if(_0x2b9af8){return[_0x2b9af8,![]];}_0x47e04c[_0xff6e('0xa9')]=_0x3a6c88['body'][_0xff6e('0xa9')];_0x47e04c[_0xff6e('0xaa')]=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xaa')];return db[_0xff6e('0xab')][_0xff6e('0x4e')](_0x47e04c)[_0xff6e('0x2c')](function(_0x1d6a19){return[_0x1d6a19,!![]];});});}_0x18a802[_0xff6e('0xac')]=_0x576f7e['id'];if(_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xad')]&&_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xad')]['id']){_0x18a802['id']=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xad')]['id'];return db[_0xff6e('0xab')][_0xff6e('0x56')]({'where':_0x18a802})[_0xff6e('0x2c')](function(_0x5801d3){if(_0x5801d3){return[_0x5801d3,![]];}return db['ChatInteraction'][_0xff6e('0x4e')](_0x47e04c)[_0xff6e('0x2c')](function(_0x34e369){return[_0x34e369,!![]];});});}return db[_0xff6e('0xab')][_0xff6e('0x4e')](_0x47e04c)[_0xff6e('0x2c')](function(_0x290489){return[_0x290489,!![]];});}})[_0xff6e('0xae')](function(_0x3df9a1,_0x2b4e5b){if(_0x3df9a1){_0x2949d7=_0x2b4e5b;if(!_0x2b4e5b){var _0x229a73={'from':(_0x50a199[_0xff6e('0x98')][_0xff6e('0xaf')]||'')+'\x20'+(_0x50a199['contact']['lastName']||'')};if(_0x3a6c88[_0xff6e('0x57')]['threadId']&&_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xb0')]&&_0x3a6c88['body'][_0xff6e('0xa9')]!=_0x3a6c88['body']['messageId']){_0x229a73['threadId']=_0x3a6c88['body'][_0xff6e('0xb0')];}return _0x3df9a1[_0xff6e('0x2a')](_0x229a73);}else{return _0x3df9a1;}}})[_0xff6e('0x2c')](function(_0x15e128){_0x50a199['interaction']=_0x15e128[_0xff6e('0x2d')]({'plain':!![]});_0x50a199['interaction'][_0xff6e('0xb1')]=_0x2949d7;if(_0x50a199['interaction']['created']){if(_0x50a199[_0xff6e('0x94')]['autoclose']){_0x50a199[_0xff6e('0x95')]['push']({'id':0x0,'priority':_0x50a199[_0xff6e('0x95')]['length']+0x1,'app':_0xff6e('0xb2'),'appdata':'unmanaged','interval':_0xff6e('0xb3')});}}return db['ChatMessage'][_0xff6e('0x4e')]({'body':_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x57')],'ChatWebsiteId':_0x3a6c88['params']['id'],'ChatInteractionId':_0x15e128['id'],'direction':'in','ContactId':_0x50a199[_0xff6e('0x98')]['id'],'AttachmentId':_0x3a6c88['body']['AttachmentId']});})['then'](function(_0x22807d){_0x50a199[_0xff6e('0x1f')]=_0x22807d;if(_0x50a199['interaction']['UserId']){return db['User'][_0xff6e('0x56')]({'attributes':['id',_0xff6e('0x31')],'where':{'id':_0x50a199[_0xff6e('0xad')]['UserId']}})['then'](function(_0x28c20e){if(_0x28c20e){_0x50a199[_0xff6e('0x95')][_0xff6e('0xb4')]({'id':0x0,'priority':0x0,'app':_0xff6e('0xb5'),'appdata':_0x28c20e['name']+','+(_0x50a199['account'][_0xff6e('0xb6')]||0xa),'interval':_0xff6e('0xb3')});_0x50a199[_0xff6e('0xb7')]=!![];}return respondWithRpcPromise('Start',_0xff6e('0xb8'),_0x50a199);});}return respondWithRpcPromise(_0xff6e('0xb9'),_0xff6e('0xb8'),_0x50a199);})['then'](function(_0x5b3555){respondWithRpcPromise(_0xff6e('0xba'),'EventManager',{'event':'notify','message':_0x5b3555},client9002);return _0x5b3555;})[_0xff6e('0x2c')](respondWithResult(_0x5bb1af,null))['catch'](handleError(_0x5bb1af,null));};exports['offline']=function(_0x52baeb,_0x21a42c){var _0x103518,_0x4ab522,_0x208105;var _0x2083c9=[];var _0x5ae46b={};var _0x3ee9e5=_0x52baeb[_0xff6e('0xbb')]||[];var _0x2b4177=[];var _0x28142c;return db[_0xff6e('0x82')][_0xff6e('0x58')]()[_0xff6e('0x2c')](function(_0x2b040f){if(!_0x2b040f){throw new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))](_0xff6e('0xbc'));}_0x2083c9=_[_0xff6e('0x85')](_[_0xff6e('0x4d')](_0x2b040f),[_0xff6e('0x86'),_0xff6e('0x87'),_0xff6e('0xbd'),_0xff6e('0x97')]);if(_0x52baeb[_0xff6e('0x57')]['id']){delete _0x52baeb[_0xff6e('0x57')]['id'];}if(_['isNil'](_0x52baeb[_0xff6e('0x57')][_0xff6e('0x88')])){throw _0x21a42c[_0xff6e('0x22')](0x1f4)[_0xff6e('0xbe')](new db[(_0xff6e('0x83'))]['ValidationError'](_0xff6e('0x89')));}if(_['isNil'](_0x52baeb[_0xff6e('0x57')][_0xff6e('0x57')])||_0x52baeb[_0xff6e('0x57')]['body']===''){throw _0x21a42c[_0xff6e('0x22')](0x1f4)['send'](new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))](_0xff6e('0xbf')));}if(_['isNil'](_0x52baeb[_0xff6e('0x57')][_0xff6e('0xc0')])){throw _0x21a42c['status'](0x1f4)['send'](new db[(_0xff6e('0x83'))]['ValidationError'](_0xff6e('0xc1')+_0x2083c9));}if(!_[_0xff6e('0x8c')](_0x2083c9,_0x52baeb[_0xff6e('0x57')][_0xff6e('0xc0')])){throw _0x21a42c[_0xff6e('0x22')](0x1f4)[_0xff6e('0xbe')](new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))](_0xff6e('0xc2')+_0x2083c9));}_0x5ae46b[_0x52baeb[_0xff6e('0x57')][_0xff6e('0xc0')]]=_0x52baeb[_0xff6e('0x57')]['from'];})[_0xff6e('0x2c')](function(){return db[_0xff6e('0x48')]['find']({'where':{'id':_0x52baeb[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0x8e')],'as':_0xff6e('0x8f')},{'model':db[_0xff6e('0xc3')],'as':_0xff6e('0xc3')}]});})[_0xff6e('0x2c')](handleEntityNotFound(_0x21a42c,null))[_0xff6e('0x2c')](function(_0x2c8ea2){if(_0x2c8ea2&&_0x2c8ea2[_0xff6e('0x8f')]){_0x4ab522=_0x2c8ea2;var _0x508c83=_[_0xff6e('0xd')](_0x52baeb[_0xff6e('0x57')],{'firstName':_0x52baeb[_0xff6e('0x57')][_0xff6e('0x88')],'phone':_0x52baeb[_0xff6e('0x57')][_0xff6e('0x88')],'ListId':_0x2c8ea2[_0xff6e('0x97')]});_0x508c83[_0x52baeb[_0xff6e('0x57')][_0xff6e('0xc0')]]=_0x52baeb['body'][_0xff6e('0x88')];return db[_0xff6e('0x82')][_0xff6e('0xc4')]({'where':_0x5ae46b,'defaults':_0x508c83});}})[_0xff6e('0xae')](function(_0x289d6e){if(_0x289d6e){_0x208105=_0x289d6e;var _0x581984=fs['readFileSync'](path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0xc5')),_0xff6e('0xc6'));var _0x44d515=ejs['render'](_0x581984,{'body':_[_0xff6e('0xc7')](_0x52baeb['body'][_0xff6e('0x57')]),'bodyTitle':_0x4ab522['offlineMessageBody']});return db['ChatOfflineMessage'][_0xff6e('0x4e')]({'body':_0x44d515,'plainBody':htmlToText['fromString'](_0x44d515),'ContactId':_0x289d6e['id'],'ChatWebsiteId':_0x4ab522['id']});}})[_0xff6e('0x2c')](function(_0x46eb06){_0x28142c=_0x46eb06;if(_0x3ee9e5[_0xff6e('0x3f')]){var _0x2752e8=_0x3ee9e5[_0xff6e('0x34')](function(_0x48fc45){return{'name':_0x48fc45[_0xff6e('0xc8')],'basename':_0x48fc45[_0xff6e('0x69')],'type':_0x48fc45['mimetype'],'ChatOfflineMessageId':_0x46eb06['id']};});_0x2b4177=_0x2752e8[_0xff6e('0x34')](_0xb650cf=>{var _0x2d5c0d={'filename':_0xb650cf[_0xff6e('0x31')],'path':path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0xc9'),'files',_0xff6e('0xca'),_0xff6e('0xcb'),_0xb650cf[_0xff6e('0xcc')])};return _0x2d5c0d;});if(!_0x4ab522[_0xff6e('0xcd')]){return db[_0xff6e('0xce')][_0xff6e('0xcf')](function(_0x526a5c){return db[_0xff6e('0xd0')][_0xff6e('0xd1')](_0x2752e8,{'transaction':_0x526a5c});});}}})[_0xff6e('0x2c')](function(){if(_0x28142c){_0x103518=_0x28142c;return db[_0xff6e('0xc3')][_0xff6e('0xd2')]({'where':{'service':!![]},'include':[{'model':db[_0xff6e('0xd3')],'as':_0xff6e('0xd4'),'raw':!![],'include':[{'model':db[_0xff6e('0xd5')],'as':_0xff6e('0xd5'),'raw':!![]}]}]});}})[_0xff6e('0x2c')](function(_0x55e96b){if(_0x55e96b&&_0x55e96b[_0xff6e('0xd4')]&&_0x4ab522['forwardOffline']&&_0x4ab522[_0xff6e('0xd6')]){var _0x4057d8=_0x55e96b['getSmtpOptions']();return respondWithRpcPromise(_0xff6e('0xd7'),_0xff6e('0xd8'),{'account':_0x4057d8,'message':{'from':util['format'](_0xff6e('0xd9'),_0x55e96b[_0xff6e('0x31')],_0x55e96b[_0xff6e('0xda')]||_0x55e96b[_0xff6e('0xd4')][_0xff6e('0x4f')]),'to':_0x4ab522[_0xff6e('0xd6')],'subject':_0x4ab522['offlineMessageSubject'],'html':_0x103518['body'],'attachments':_0x2b4177}},client9003)['then'](function(){return _0x103518;})[_0xff6e('0x20')](function(_0x1f8967){logger[_0xff6e('0x1d')](_0x1f8967);});}})[_0xff6e('0x2c')](function(){if(_0x4ab522&&_0x4ab522[_0xff6e('0xcd')]&&_0x4ab522[_0xff6e('0xdb')]){var _0x38e70c=[];if(_0x3ee9e5[_0xff6e('0x3f')]){_0x38e70c=_0x3ee9e5[_0xff6e('0x34')](function(_0x55ad18){return{'name':_0x55ad18[_0xff6e('0xc8')],'basename':_0x55ad18[_0xff6e('0x69')],'type':_0x55ad18[_0xff6e('0xdc')],'ChatOfflineMessageId':_0x28142c['id']};});}var _0x5a8210;if(!_[_0xff6e('0x77')](_0x4ab522[_0xff6e('0xdd')])){var _0x3478b1=_[_0xff6e('0x34')](_0x52baeb['body'],function(_0x2c0fb6){return _0x2c0fb6;});var _0x302dee=_['toPairsIn'](_0x3478b1)[0x0];var _0xa9bde8=_[_0xff6e('0xde')](_0x302dee,function(_0x3b1b7d){return _0x3b1b7d;});_0x5a8210=_0xa9bde8[0x1][_0x4ab522['subjectOffline']];}var _0x2c100d={'from':_0x208105['email'],'firstName':_0x208105['firstName'],'lastName':_0x208105[_0xff6e('0x9e')],'mapKey':_0xff6e('0xda'),'message':{'from':_0x208105[_0xff6e('0xda')],'to':_0x4ab522[_0xff6e('0xc3')][_0xff6e('0xda')],'cc':'','subject':_[_0xff6e('0x77')](_0x5a8210)?_0x4ab522[_0xff6e('0xdf')]:_0x5a8210,'messageId':'','sentAt':new Date(),'attach':_0x38e70c['length'],'attachments':_0x38e70c,'originChannel':'Chat','ChatWebsiteId':_0x4ab522['id'],'ChatOfflineMessageId':_0x103518['id'],'originTo':_0x4ab522[_0xff6e('0xc3')][_0xff6e('0xda')]},'body':_0x103518[_0xff6e('0x57')]};var _0x5718e1={'account':{'id':_0x4ab522[_0xff6e('0xdb')]},'body':_0x2c100d,'log':_0xff6e('0xe0')};return respondWithRpcPromise(_0xff6e('0xe0'),_0xff6e('0xe1'),_0x5718e1,client9001)['then'](function(){return _0x103518;})[_0xff6e('0x20')](function(_0x1298b9){logger[_0xff6e('0x1d')](_0x1298b9);});}return;})[_0xff6e('0x2c')](function(){if(_0x103518){return _0x103518;}})[_0xff6e('0x2c')](respondWithResult(_0x21a42c,null))['catch'](function(_0x5aa4fb){logger[_0xff6e('0x1d')](_0xff6e('0x20'),_0x5aa4fb);for(var _0x2234ed of _0x3ee9e5){var _0xfab537=path[_0xff6e('0x70')](config['root'],_0xff6e('0xc9'),_0xff6e('0xbb'),'attachments','offline-chat',_0x2234ed[_0xff6e('0x69')]);fs_extra[_0xff6e('0xe2')](_0xfab537)[_0xff6e('0x20')](function(_0x54e871){logger[_0xff6e('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0xfab537,_0x54e871);});}});};exports[_0xff6e('0xe3')]=function(_0x14f4fe,_0x3cdff9){return db[_0xff6e('0xab')][_0xff6e('0x56')]({'where':{'id':_0x14f4fe['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x3cdff9,null))['then'](function(_0x5af42f){if(_0x5af42f){return _0x5af42f[_0xff6e('0xe3')](_0x14f4fe['body'][_0xff6e('0x60')],_[_0xff6e('0xe4')](_0x14f4fe[_0xff6e('0x57')],[_0xff6e('0x60'),'id'])||{});}})[_0xff6e('0x2c')](respondWithResult(_0x3cdff9,null))[_0xff6e('0x20')](handleError(_0x3cdff9,null));};exports['getInteractions']=function(_0xafa35f,_0x3726cb){var _0x58d459={'raw':![],'where':{}};var _0x1053a9={};var _0x195977={'count':0x0,'rows':[]};return db[_0xff6e('0x48')][_0xff6e('0xd2')]({'where':{'id':_0xafa35f['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x3726cb,null))[_0xff6e('0x2c')](function(_0x2acaaf){if(_0x2acaaf){_0x1053a9[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0xab')]['rawAttributes']);_0x1053a9[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0xafa35f[_0xff6e('0x39')]);_0x1053a9[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x1053a9[_0xff6e('0x3c')],_0x1053a9['query']);_0x58d459[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x1053a9[_0xff6e('0x3c')],qs[_0xff6e('0x3d')](_0xafa35f[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x58d459[_0xff6e('0x3e')]=_0x58d459[_0xff6e('0x3e')]['length']?_0x58d459[_0xff6e('0x3e')]:_0x1053a9['model'];if(!_0xafa35f[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x58d459[_0xff6e('0x28')]=qs[_0xff6e('0x28')](_0xafa35f[_0xff6e('0x39')]['limit']);_0x58d459[_0xff6e('0x25')]=qs['offset'](_0xafa35f[_0xff6e('0x39')][_0xff6e('0x25')]);}_0x58d459['order']=qs[_0xff6e('0x43')](_0xafa35f[_0xff6e('0x39')]['sort']);_0x58d459[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0xafa35f[_0xff6e('0x39')],_0x1053a9[_0xff6e('0x3a')]));_0x58d459['where']['ChatWebsiteId']=_0x2acaaf['id'];if(_0xafa35f[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x58d459[_0xff6e('0x44')]=_['merge'](_0x58d459['where'],{'$or':_[_0xff6e('0x34')](_0x58d459[_0xff6e('0x3e')],function(_0x5c431c){var _0x4954d3={};_0x4954d3[_0x5c431c]={'$like':'%'+_0xafa35f[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x4954d3;})});}_0x58d459=_['merge']({},_0x58d459,_0xafa35f[_0xff6e('0x5e')]);return db['ChatInteraction']['count']({'where':_0x58d459[_0xff6e('0x44')]})['then'](function(_0x2cf8fe){_0x195977[_0xff6e('0x27')]=_0x2cf8fe;if(_0xafa35f[_0xff6e('0x39')]['includeAll']){_0x58d459[_0xff6e('0x49')]=[{'model':db[_0xff6e('0x82')],'as':_0xff6e('0xe5'),'required':![]},{'model':db[_0xff6e('0xe6')],'as':'Owner','attributes':[_0xff6e('0x31'),'fullname',_0xff6e('0xe7')],'required':![]},{'model':db['Tag'],'as':_0xff6e('0xe8'),'attributes':['id','name',_0xff6e('0xe9')],'where':_0xafa35f['query'][_0xff6e('0xea')]?{'id':_0xafa35f[_0xff6e('0x39')]['tag']}:undefined,'required':_0xafa35f[_0xff6e('0x39')]['tag']?!![]:![]}];}return db[_0xff6e('0xab')]['findAll'](_0x58d459);})['then'](function(_0x8d7d43){_0x195977[_0xff6e('0x65')]=_0x8d7d43;return _0x195977;});}})[_0xff6e('0x2c')](respondWithFilteredResult(_0x3726cb,_0x58d459))['catch'](handleError(_0x3726cb,null));};function iftimePromise(_0x394cf6,_0x16fb43){return respondWithRpcPromise(_0xff6e('0xeb'),'getSnippet',{'command':_0x16fb43[_0xff6e('0xec')]?util['format'](_0xff6e('0xed'),_0x394cf6[_0xff6e('0xee')],_0x16fb43[_0xff6e('0xec')]):util['format'](_0xff6e('0xef'),_0x394cf6[_0xff6e('0xee')])},client9002)[_0xff6e('0x2c')](function(_0x3fa8d4){var _0x43126f=_0x3fa8d4&&_0x3fa8d4[_0xff6e('0xf0')](_0xff6e('0xf1'))>=0x0?!![]:![];logger[_0xff6e('0x17')](_0xff6e('0xf2'),_0x16fb43['id'],_0x394cf6['id'],_0x394cf6[_0xff6e('0xee')],_0x43126f?_0xff6e('0xf3'):_0xff6e('0xf4'),_0x16fb43[_0xff6e('0xec')]?_0x16fb43[_0xff6e('0xec')]:_0xff6e('0xf5'));return _0x43126f;})[_0xff6e('0x20')](function(_0x4c3228){logger[_0xff6e('0x1d')](_0xff6e('0xf2'),_0x16fb43['id'],_0x394cf6['id'],_0x394cf6['interval'],util[_0xff6e('0xf6')](_0x4c3228,{'showHidden':![],'depth':null}),_0x16fb43[_0xff6e('0xec')]?_0x16fb43[_0xff6e('0xec')]:_0xff6e('0xf5'));return![];});}exports[_0xff6e('0xf7')]=function(_0x1a8b29,_0x1abb92){var _0x29381c=0x0;var _0x228cf8=0x0;var _0x486d4c=![];var _0x5bdabd;var _0x369d27;return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x1a8b29[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0xf8')],'as':_0xff6e('0xf8'),'include':[{'model':db['Interval'],'as':_0xff6e('0xf9'),'attributes':['id',_0xff6e('0xee')],'raw':!![]}]}]})[_0xff6e('0x2c')](handleEntityNotFound(_0x1abb92,null))[_0xff6e('0x2c')](function(_0xb424ba){if(_0xb424ba){_0x5bdabd=_0xb424ba;return _0xb424ba[_0xff6e('0xfa')]({'raw':!![]});}})['then'](function(_0x23c13a){if(_0x5bdabd){if(_0x23c13a){_0x369d27=_0x23c13a;}}return require(_0xff6e('0xfb'))['getLicense']();})['then'](function(_0x360d7e){if(_0x360d7e){_0x228cf8=_0x360d7e[_0xff6e('0xfc')];_0x486d4c=_0x360d7e[_0xff6e('0x71')];}})[_0xff6e('0x2c')](function(){return db[_0xff6e('0xab')][_0xff6e('0x27')]({'where':{'closed':![]}});})[_0xff6e('0x2c')](function(_0x196d13){_0x29381c=_0x196d13;if(_0x228cf8&&_0x196d13>_0x228cf8){return db['License'][_0xff6e('0xd2')]({'where':{'id':0x1}})[_0xff6e('0x2c')](function(_0xe4f9a2){if(_0xe4f9a2){_0xe4f9a2[_0xff6e('0xfd')](_0xff6e('0xfe'));}});}})['then'](function(){if(_0x5bdabd[_0xff6e('0xf8')]&&_0x5bdabd[_0xff6e('0xf8')][_0xff6e('0xf9')]){var _0x2c571e=[];for(var _0x10ea92=0x0;_0x10ea92<_0x5bdabd[_0xff6e('0xf8')][_0xff6e('0xf9')][_0xff6e('0x3f')];_0x10ea92++){var _0x11b846=_0x5bdabd[_0xff6e('0xf8')][_0xff6e('0xf9')][_0x10ea92]['get']({'plain':!![]});_0x2c571e['push'](iftimePromise(_0x11b846,_0x5bdabd));}return BPromise[_0xff6e('0xff')](_0x2c571e)['then'](function(_0x29eb33){return _[_0xff6e('0x100')](_0x29eb33);});}else{return!![];}})[_0xff6e('0x2c')](function(_0x3d807a){var _0x208689=fs[_0xff6e('0x101')](path[_0xff6e('0x70')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x1a9d6c={'remote':_0x5bdabd[_0xff6e('0x102')],'query':querystring[_0xff6e('0x1c')](_[_0xff6e('0x46')](_0x5bdabd[_0xff6e('0x2d')]({'plain':!![]}),{'customerIp':_0x1a8b29[_0xff6e('0x9a')][_0xff6e('0x9b')]||_0x1a8b29[_0xff6e('0x9a')][_0xff6e('0x103')]||_0x1a8b29['connection'][_0xff6e('0x104')]||_0x1a8b29['ip'],'referer':_0x1a8b29[_0xff6e('0x9a')][_0xff6e('0xa0')],'openedInteractions':_0x29381c,'maxInteractions':_0x228cf8,'virtual':_0x486d4c['virtual'],'online':_0x3d807a,'custom':_0x486d4c}))[_0xff6e('0x105')](/'/g,'\x5c\x27')};_0x1abb92[_0xff6e('0xbe')](ejs[_0xff6e('0x106')](Mustache[_0xff6e('0x106')](_0x208689,_0x1a9d6c),{'proactiveActions':_0x369d27,'alignment':_0x5bdabd[_0xff6e('0x107')],'verticalAlignment':_0x5bdabd[_0xff6e('0x108')],'div_color':_0x5bdabd[_0xff6e('0xe9')],'labelText':_0x5bdabd[_0xff6e('0x109')],'text_color':_0x5bdabd['textColor'],'text_button_color':_0x5bdabd['textButtonColor'],'button_color':_0x5bdabd['color_button'],'background_color':_0x5bdabd[_0xff6e('0x10a')],'hideWhenOffline':_0x5bdabd[_0xff6e('0x10b')],'interval':_0x5bdabd[_0xff6e('0x10c')]}));})[_0xff6e('0x20')](handleError(_0x1abb92,null));};exports[_0xff6e('0x10d')]=function(_0x2e8882,_0xaeb895){var _0x4e47de=_0x2e8882[_0xff6e('0x4c')]['id'];var _0x56f3c6=_0x2e8882[_0xff6e('0x57')];var _0x13c98b=0xc8;var _0xf1609e=null;return db[_0xff6e('0xce')][_0xff6e('0xcf')]({'isolationLevel':db[_0xff6e('0xce')]['Transaction'][_0xff6e('0x10e')][_0xff6e('0x10f')]},function(_0x2a7893){return db['ChatWebsite'][_0xff6e('0xd2')]({'where':{'id':_0x4e47de},'transaction':_0x2a7893})[_0xff6e('0x2c')](function(_0x550b56){if(_0x550b56){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x4e47de},'transaction':_0x2a7893})[_0xff6e('0x2c')](function(){var _0x451ad6=_[_0xff6e('0x34')](_0x56f3c6,function(_0x50c49b){_0x50c49b[_0xff6e('0x5a')]=_0x4e47de;return _0x50c49b;});return db[_0xff6e('0x92')][_0xff6e('0xd1')](_0x451ad6,{'transaction':_0x2a7893});});}else{_0x13c98b=0x194;_0xf1609e=[];}});})[_0xff6e('0x2c')](function(){if(_0x13c98b!==0x194){return db[_0xff6e('0x92')][_0xff6e('0x110')]({'where':{'ChatWebsiteId':_0x4e47de},'order':_0xff6e('0x111')})[_0xff6e('0x2c')](function(_0x30090f){_0xf1609e=_0x30090f;});}})[_0xff6e('0x20')](function(_0x2d99d6){_0x13c98b=0x1f4;logger[_0xff6e('0x1d')](_0x2d99d6['stack']);if(_0x2d99d6[_0xff6e('0x31')]){delete _0x2d99d6[_0xff6e('0x31')];}_0xf1609e=_0x2d99d6;})[_0xff6e('0x112')](function(){if(_0xf1609e===null){_0xaeb895[_0xff6e('0x21')](_0x13c98b);}else{if(_0x13c98b===0x1f4){_0xaeb895[_0xff6e('0x22')](_0x13c98b)[_0xff6e('0xbe')](_0xf1609e);}else{_0xaeb895[_0xff6e('0x22')](_0x13c98b)[_0xff6e('0x24')](_0xf1609e);}}});};exports[_0xff6e('0x113')]=function(_0x2eae09,_0x5f04df){var _0x2bac27={};var _0x414c33={};var _0x86a5ce;var _0x4ea737;return db[_0xff6e('0x48')][_0xff6e('0xd2')]({'where':{'id':_0x2eae09[_0xff6e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5f04df,null))[_0xff6e('0x2c')](function(_0x215ac1){if(_0x215ac1){_0x86a5ce=_0x215ac1;_0x414c33[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x92')][_0xff6e('0x35')]);_0x414c33[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0x2eae09[_0xff6e('0x39')]);_0x414c33[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x414c33['model'],_0x414c33[_0xff6e('0x39')]);_0x2bac27[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x414c33['model'],qs['fields'](_0x2eae09['query'][_0xff6e('0x3d')]));_0x2bac27[_0xff6e('0x3e')]=_0x2bac27['attributes']['length']?_0x2bac27['attributes']:_0x414c33[_0xff6e('0x3c')];_0x2bac27[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0x2eae09['query']['sort']);_0x2bac27[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0x2eae09['query'],_0x414c33['filters']));if(_0x2eae09[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x2bac27[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x2bac27[_0xff6e('0x44')],{'$or':_[_0xff6e('0x34')](_0x2bac27[_0xff6e('0x3e')],function(_0x25d403){var _0x1a5838={};_0x1a5838[_0x25d403]={'$like':'%'+_0x2eae09[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x1a5838;})});}_0x2bac27=_[_0xff6e('0x46')]({},_0x2bac27,_0x2eae09[_0xff6e('0x5e')]);return _0x86a5ce[_0xff6e('0x113')](_0x2bac27);}})[_0xff6e('0x2c')](function(_0x21ee5b){if(_0x21ee5b){_0x4ea737=_0x21ee5b[_0xff6e('0x3f')];if(!_0x2eae09[_0xff6e('0x39')][_0xff6e('0x40')]('nolimit')){_0x2bac27['limit']=qs[_0xff6e('0x28')](_0x2eae09['query'][_0xff6e('0x28')]);_0x2bac27[_0xff6e('0x25')]=qs[_0xff6e('0x25')](_0x2eae09[_0xff6e('0x39')]['offset']);}return _0x86a5ce[_0xff6e('0x113')](_0x2bac27);}})[_0xff6e('0x2c')](function(_0x15efa4){if(_0x15efa4){return _0x15efa4?{'count':_0x4ea737,'rows':_0x15efa4}:null;}})[_0xff6e('0x2c')](respondWithResult(_0x5f04df,null))[_0xff6e('0x20')](handleError(_0x5f04df,null));};exports[_0xff6e('0x114')]=function(_0x459831,_0x3ff6e7){return db[_0xff6e('0x115')][_0xff6e('0x56')]({'where':{'id':_0x459831[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x3ff6e7,null))['then'](function(_0xd62685){if(_0xd62685){return _0xd62685['addProactiveActions'](_0x459831[_0xff6e('0x57')][_0xff6e('0x60')],_[_0xff6e('0xe4')](_0x459831[_0xff6e('0x57')],['ids','id'])||{});}})[_0xff6e('0x2c')](respondWithResult(_0x3ff6e7,null))['catch'](handleError(_0x3ff6e7,null));};exports['getProactiveActions']=function(_0xf21bf7,_0x9c6bb6){var _0x3d6de6={};var _0x3a4913={};var _0x14e413;var _0x4bc71f;return db[_0xff6e('0x48')][_0xff6e('0xd2')]({'where':{'id':_0xf21bf7['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x9c6bb6,null))[_0xff6e('0x2c')](function(_0x3e7179){if(_0x3e7179){_0x14e413=_0x3e7179;_0x3a4913['model']=_[_0xff6e('0x4d')](db[_0xff6e('0x116')]['rawAttributes']);_0x3a4913[_0xff6e('0x39')]=_['keys'](_0xf21bf7[_0xff6e('0x39')]);_0x3a4913[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x3a4913[_0xff6e('0x3c')],_0x3a4913[_0xff6e('0x39')]);_0x3d6de6[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x3a4913['model'],qs[_0xff6e('0x3d')](_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x3d6de6[_0xff6e('0x3e')]=_0x3d6de6['attributes'][_0xff6e('0x3f')]?_0x3d6de6['attributes']:_0x3a4913['model'];_0x3d6de6[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x43')]);_0x3d6de6[_0xff6e('0x44')]=qs['filters'](_['pick'](_0xf21bf7[_0xff6e('0x39')],_0x3a4913[_0xff6e('0x3a')]));if(_0xf21bf7[_0xff6e('0x39')]['filter']){_0x3d6de6[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x3d6de6[_0xff6e('0x44')],{'$or':_[_0xff6e('0x34')](_0x3d6de6[_0xff6e('0x3e')],function(_0x651f8c){var _0x40564d={};_0x40564d[_0x651f8c]={'$like':'%'+_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x40564d;})});}_0x3d6de6=_[_0xff6e('0x46')]({},_0x3d6de6,_0xf21bf7[_0xff6e('0x5e')]);return _0x14e413[_0xff6e('0xfa')](_0x3d6de6);}})['then'](function(_0x188ae0){if(_0x188ae0){_0x4bc71f=_0x188ae0[_0xff6e('0x3f')];if(!_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x3d6de6[_0xff6e('0x28')]=qs[_0xff6e('0x28')](_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x28')]);_0x3d6de6[_0xff6e('0x25')]=qs[_0xff6e('0x25')](_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x25')]);}return _0x14e413['getProactiveActions'](_0x3d6de6);}})[_0xff6e('0x2c')](function(_0x23191f){if(_0x23191f){return _0x23191f?{'count':_0x4bc71f,'rows':_0x23191f}:null;}})['then'](respondWithResult(_0x9c6bb6,null))[_0xff6e('0x20')](handleError(_0x9c6bb6,null));};exports[_0xff6e('0x117')]=function(_0x5e5b4e,_0x483839){var _0x56a65b=_0x5e5b4e[_0xff6e('0x39')][_0xff6e('0x118')]===_0xff6e('0x119')?_0xff6e('0x11a'):_0xff6e('0x11b');return db['ChatWebsite'][_0xff6e('0x56')]({'attributes':['id',_0x56a65b],'where':{'id':_0x5e5b4e[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x483839,null))['then'](function(_0x408e3f){if(_0x408e3f){var _0x2484d2=_0x408e3f[_0x56a65b];var _0x45d38d=_0x2484d2&&_0x2484d2[_0xff6e('0x11c')]?_0x2484d2[_0xff6e('0x11c')]:[];_0x483839[_0xff6e('0xbe')]({'fromKey':_['isNil'](_0x2484d2['fromKey'])?undefined:_0x2484d2[_0xff6e('0x11d')],'count':_0x45d38d[_0xff6e('0x3f')],'rows':_0x45d38d});}})[_0xff6e('0x20')](handleError(_0x483839,null));};exports[_0xff6e('0x11e')]=function(_0x3988b3,_0x200ce0){var _0x77ccce={'raw':![],'where':{}};var _0x10e917={};var _0x49b45a={'count':0x0,'rows':[]};return db[_0xff6e('0x48')][_0xff6e('0xd2')]({'where':{'id':_0x3988b3['params']['id']}})['then'](handleEntityNotFound(_0x200ce0,null))['then'](function(_0x366a4f){if(_0x366a4f){_0x10e917[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x11f')][_0xff6e('0x35')]);_0x10e917[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0x3988b3[_0xff6e('0x39')]);_0x10e917['filters']=_[_0xff6e('0x3b')](_0x10e917['model'],_0x10e917[_0xff6e('0x39')]);_0x77ccce[_0xff6e('0x3e')]=_['intersection'](_0x10e917[_0xff6e('0x3c')],qs['fields'](_0x3988b3[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x77ccce[_0xff6e('0x3e')]=_0x77ccce['attributes'][_0xff6e('0x3f')]?_0x77ccce['attributes']:_0x10e917['model'];if(!_0x3988b3[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x77ccce[_0xff6e('0x28')]=qs[_0xff6e('0x28')](_0x3988b3[_0xff6e('0x39')][_0xff6e('0x28')]);_0x77ccce[_0xff6e('0x25')]=qs['offset'](_0x3988b3[_0xff6e('0x39')]['offset']);}_0x77ccce[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0x3988b3['query'][_0xff6e('0x43')]);_0x77ccce[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0x3988b3[_0xff6e('0x39')],_0x10e917[_0xff6e('0x3a')]));_0x77ccce['where'][_0xff6e('0x5a')]=_0x366a4f['id'];if(_0x3988b3[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x77ccce[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x77ccce[_0xff6e('0x44')],{'$or':_['map'](_0x77ccce[_0xff6e('0x3e')],function(_0x165665){var _0x4fe841={};_0x4fe841[_0x165665]={'$like':'%'+_0x3988b3[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x4fe841;})});}_0x77ccce=_[_0xff6e('0x46')]({},_0x77ccce,_0x3988b3[_0xff6e('0x5e')]);return db['ChatOfflineMessage'][_0xff6e('0x27')]({'where':_0x77ccce['where']})[_0xff6e('0x2c')](function(_0x56fd15){_0x49b45a[_0xff6e('0x27')]=_0x56fd15;if(_0x3988b3[_0xff6e('0x39')]['includeAll']){_0x77ccce[_0xff6e('0x49')]=[{'all':!![]}];}else{_0x77ccce[_0xff6e('0x49')]=[{'model':db['CmContact'],'as':_0xff6e('0xe5'),'required':![]},{'model':db[_0xff6e('0xd0')],'as':'Attachments','required':![]}];}return db[_0xff6e('0x11f')][_0xff6e('0x4a')](_0x77ccce);})['then'](function(_0xab1197){_0x49b45a[_0xff6e('0x65')]=_0xab1197;return _0x49b45a;});}})[_0xff6e('0x2c')](respondWithFilteredResult(_0x200ce0,_0x77ccce))[_0xff6e('0x20')](handleError(_0x200ce0,null));};exports[_0xff6e('0x120')]=function(_0x328418,_0x1267f4){return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x328418[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x1267f4,null))[_0xff6e('0x2c')](function(_0x2504ba){if(_0x2504ba){return _0x2504ba['addAgents'](_0x328418[_0xff6e('0x57')][_0xff6e('0x60')],_[_0xff6e('0xe4')](_0x328418['body'],[_0xff6e('0x60'),'id'])||{})['spread'](function(_0x2cbefc){for(var _0x3c1c83=0x0;_0x3c1c83<_0x328418[_0xff6e('0x57')][_0xff6e('0x60')]['length'];_0x3c1c83+=0x1){socket['emit'](_0xff6e('0x121'),{'UserId':Number(_0x328418['body']['ids'][_0x3c1c83]),'ChatWebsiteId':Number(_0x328418[_0xff6e('0x4c')]['id'])});}return _0x2cbefc;});}})['then'](respondWithResult(_0x1267f4,null))[_0xff6e('0x20')](handleError(_0x1267f4,null));};exports[_0xff6e('0x122')]=function(_0x59a05e,_0x1e64a2){return db[_0xff6e('0x48')]['find']({'where':{'id':_0x59a05e[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x1e64a2,null))['then'](function(_0x1249fa){if(_0x1249fa){return _0x1249fa[_0xff6e('0x122')](_0x59a05e[_0xff6e('0x39')][_0xff6e('0x60')])[_0xff6e('0x2c')](function(){if(_[_0xff6e('0x123')](_0x59a05e[_0xff6e('0x39')][_0xff6e('0x60')])){for(var _0x124862=0x0;_0x124862<_0x59a05e[_0xff6e('0x39')]['ids']['length'];_0x124862+=0x1){socket[_0xff6e('0x124')](_0xff6e('0x125'),{'UserId':Number(_0x59a05e[_0xff6e('0x39')]['ids'][_0x124862]),'ChatWebsiteId':Number(_0x59a05e[_0xff6e('0x4c')]['id'])});}}else{socket[_0xff6e('0x124')](_0xff6e('0x125'),{'UserId':Number(_0x59a05e[_0xff6e('0x39')][_0xff6e('0x60')]),'ChatWebsiteId':Number(_0x59a05e[_0xff6e('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e64a2,null))[_0xff6e('0x20')](handleError(_0x1e64a2,null));};exports[_0xff6e('0x126')]=function(_0x26df71,_0xe5b7a3){var _0x39793f={};var _0x518ccd={};var _0x5851de;var _0x4730e3;return db['ChatWebsite'][_0xff6e('0xd2')]({'where':{'id':_0x26df71['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0xe5b7a3,null))['then'](function(_0x25711e){if(_0x25711e){_0x5851de=_0x25711e;_0x518ccd[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0xe6')][_0xff6e('0x35')]);_0x518ccd[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0x26df71['query']);_0x518ccd['filters']=_[_0xff6e('0x3b')](_0x518ccd['model'],_0x518ccd[_0xff6e('0x39')]);_0x39793f['attributes']=_[_0xff6e('0x3b')](_0x518ccd[_0xff6e('0x3c')],qs['fields'](_0x26df71[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x39793f['attributes']=_0x39793f['attributes'][_0xff6e('0x3f')]?_0x39793f[_0xff6e('0x3e')]:_0x518ccd['model'];_0x39793f[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0x26df71[_0xff6e('0x39')][_0xff6e('0x43')]);_0x39793f[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0x26df71[_0xff6e('0x39')],_0x518ccd[_0xff6e('0x3a')]));if(_0x26df71[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x39793f['where']=_[_0xff6e('0x46')](_0x39793f['where'],{'$or':_[_0xff6e('0x34')](_0x39793f['attributes'],function(_0x2424a8){var _0x32de44={};_0x32de44[_0x2424a8]={'$like':'%'+_0x26df71['query']['filter']+'%'};return _0x32de44;})});}_0x39793f=_['merge']({},_0x39793f,_0x26df71['options']);return _0x5851de[_0xff6e('0x126')](_0x39793f);}})['then'](function(_0xb45225){if(_0xb45225){_0x4730e3=_0xb45225[_0xff6e('0x3f')];if(!_0x26df71['query']['hasOwnProperty']('nolimit')){_0x39793f['limit']=qs['limit'](_0x26df71['query'][_0xff6e('0x28')]);_0x39793f[_0xff6e('0x25')]=qs[_0xff6e('0x25')](_0x26df71[_0xff6e('0x39')][_0xff6e('0x25')]);}return _0x5851de[_0xff6e('0x126')](_0x39793f);}})[_0xff6e('0x2c')](function(_0x343f8b){if(_0x343f8b){return _0x343f8b?{'count':_0x4730e3,'rows':_0x343f8b}:null;}})[_0xff6e('0x2c')](respondWithResult(_0xe5b7a3,null))['catch'](handleError(_0xe5b7a3,null));};
\ No newline at end of file
+var _0x49e3=['no\x20available\x20attributes','difference','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','updatedAt','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','messageId','created','push','close','*,*,*,*','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','createdAt','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','NotifyMailAccount','notifyMail','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','remoteAddress','render','alignment','verticalAlignment','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','omit','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','count','limit','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','end','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','order','options','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','rawAttributes','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0x49e3,0x1ce));var _0x349e=function(_0xc9d31b,_0x1554a7){_0xc9d31b=_0xc9d31b-0x0;var _0x1bc442=_0x49e3[_0xc9d31b];return _0x1bc442;};'use strict';var BPromise=require(_0x349e('0x0'));var Mustache=require(_0x349e('0x1'));var util=require('util');var path=require(_0x349e('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require('querystring');var Redis=require(_0x349e('0x3'));var qs=require(_0x349e('0x4'));var logger=require(_0x349e('0x5'))(_0x349e('0x6'));var config=require(_0x349e('0x7'));var db=require(_0x349e('0x8'))['db'];config['redis']=_[_0x349e('0x9')](config[_0x349e('0xa')],{'host':_0x349e('0xb'),'port':0x18eb});var socket=require(_0x349e('0xc'))(new Redis(config[_0x349e('0xa')]));require(_0x349e('0xd'))[_0x349e('0xe')](socket);var htmlToText=require(_0x349e('0xf'));var jayson=require('jayson/promise');var client=jayson[_0x349e('0x10')]['http']({'port':0x232c});var client9002=jayson[_0x349e('0x10')][_0x349e('0x11')]({'port':0x232a});var client9003=jayson['client'][_0x349e('0x11')]({'port':0x232b});var client9001=jayson[_0x349e('0x10')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3211ea,_0x46c8e9,_0x209184,_0x1a7a9a){return new BPromise(function(_0x41b65a,_0x1de36d){var _0x1d9e82=_0x1a7a9a||client;return _0x1d9e82[_0x349e('0x12')](_0x3211ea,_0x209184)[_0x349e('0x13')](function(_0x1a56fd){logger[_0x349e('0x14')](_0x349e('0x15'),_0x46c8e9,_0x349e('0x16'));logger[_0x349e('0x17')](_0x349e('0x18'),_0x46c8e9,'request\x20sent',JSON[_0x349e('0x19')](_0x1a56fd));if(_0x1a56fd[_0x349e('0x1a')]){if(_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1b')]===0x1f4){logger[_0x349e('0x1a')](_0x349e('0x15'),_0x46c8e9,_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1c')]);return _0x1de36d(_0x1a56fd['error']['message']);}logger[_0x349e('0x1a')](_0x349e('0x15'),_0x46c8e9,_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1c')]);return _0x41b65a(_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1c')]);}else{logger[_0x349e('0x14')](_0x349e('0x15'),_0x46c8e9,_0x349e('0x16'));_0x41b65a(_0x1a56fd[_0x349e('0x1d')][_0x349e('0x1c')]);}})['catch'](function(_0x47ac78){logger[_0x349e('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x46c8e9,_0x47ac78);_0x1de36d(_0x47ac78);});});}function respondWithStatusCode(_0x3283bc,_0xdaca79){_0xdaca79=_0xdaca79||0xcc;return function(_0x208b8b){if(_0x208b8b){return _0x3283bc[_0x349e('0x1e')](_0xdaca79);}return _0x3283bc['status'](_0xdaca79)['end']();};}function respondWithResult(_0x54bce0,_0x188e18){_0x188e18=_0x188e18||0xc8;return function(_0x558bb7){if(_0x558bb7){return _0x54bce0[_0x349e('0x1f')](_0x188e18)[_0x349e('0x20')](_0x558bb7);}};}function respondWithFilteredResult(_0x2e1710,_0x43a218){return function(_0xd79a46){if(_0xd79a46){var _0x319d68=typeof _0x43a218[_0x349e('0x21')]==='undefined'&&typeof _0x43a218['limit']==='undefined';var _0x4610e0=_0xd79a46[_0x349e('0x22')];var _0x4c112a=_0x319d68?0x0:_0x43a218[_0x349e('0x21')];var _0x2fcd57=_0x319d68?_0xd79a46[_0x349e('0x22')]:_0x43a218[_0x349e('0x21')]+_0x43a218[_0x349e('0x23')];var _0x58b364;if(_0x2fcd57>=_0x4610e0){_0x2fcd57=_0x4610e0;_0x58b364=0xc8;}else{_0x58b364=0xce;}_0x2e1710[_0x349e('0x1f')](_0x58b364);return _0x2e1710[_0x349e('0x24')](_0x349e('0x25'),_0x4c112a+'-'+_0x2fcd57+'/'+_0x4610e0)[_0x349e('0x20')](_0xd79a46);}return null;};}function saveUpdates(_0x5ae29c){return function(_0xaf1b8){if(_0xaf1b8){return _0xaf1b8[_0x349e('0x26')](_0x5ae29c)['then'](function(_0x48aa70){return _0x48aa70;});}return null;};}function removeEntity(_0x1a4cf2){return function(_0x31944f){if(_0x31944f){return _0x31944f[_0x349e('0x27')]()['then'](function(){var _0xb56f9b=_0x31944f[_0x349e('0x28')]({'plain':!![]});var _0x4be34d=_0x349e('0x29');return db[_0x349e('0x2a')][_0x349e('0x27')]({'where':{'type':_0x4be34d,'resourceId':_0xb56f9b['id']}})['then'](function(){return _0x31944f;});})[_0x349e('0x13')](function(){_0x1a4cf2[_0x349e('0x1f')](0xcc)[_0x349e('0x2b')]();});}};}function handleEntityNotFound(_0x44c17b){return function(_0xae5811){if(!_0xae5811){_0x44c17b[_0x349e('0x1e')](0x194);}return _0xae5811;};}function handleError(_0x15823d,_0x1003a2){_0x1003a2=_0x1003a2||0x1f4;return function(_0x2db35f){logger[_0x349e('0x1a')](_0x2db35f['stack']);if(_0x2db35f[_0x349e('0x2c')]){delete _0x2db35f[_0x349e('0x2c')];}_0x15823d[_0x349e('0x1f')](_0x1003a2)[_0x349e('0x2d')](_0x2db35f);};}exports['index']=function(_0x2aeb27,_0x296619){var _0x36c2d7={'include':[{'model':db[_0x349e('0x2e')],'as':_0x349e('0x2f')}]},_0x4842a4={},_0x556d24={'count':0x0,'rows':[]};var _0xef7ba7=_[_0x349e('0x30')](db[_0x349e('0x31')]['rawAttributes'],function(_0x3f8c5c){return{'name':_0x3f8c5c[_0x349e('0x32')],'type':_0x3f8c5c[_0x349e('0x33')][_0x349e('0x34')]};});_0x4842a4['model']=_['map'](_0xef7ba7,'name');_0x4842a4[_0x349e('0x35')]=_[_0x349e('0x36')](_0x2aeb27[_0x349e('0x35')]);_0x4842a4[_0x349e('0x37')]=_[_0x349e('0x38')](_0x4842a4[_0x349e('0x39')],_0x4842a4[_0x349e('0x35')]);_0x36c2d7['attributes']=_[_0x349e('0x38')](_0x4842a4['model'],qs[_0x349e('0x3a')](_0x2aeb27[_0x349e('0x35')][_0x349e('0x3a')]));_0x36c2d7[_0x349e('0x3b')]=_0x36c2d7[_0x349e('0x3b')][_0x349e('0x3c')]?_0x36c2d7[_0x349e('0x3b')]:_0x4842a4['model'];if(!_0x2aeb27[_0x349e('0x35')]['hasOwnProperty'](_0x349e('0x3d'))){_0x36c2d7[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x2aeb27['query'][_0x349e('0x23')]);_0x36c2d7[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x2aeb27[_0x349e('0x35')][_0x349e('0x21')]);}_0x36c2d7['order']=qs[_0x349e('0x3e')](_0x2aeb27[_0x349e('0x35')][_0x349e('0x3e')]);_0x36c2d7[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x2aeb27[_0x349e('0x35')],_0x4842a4['filters']),_0xef7ba7);if(_0x2aeb27[_0x349e('0x35')][_0x349e('0x41')]){_0x36c2d7[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x36c2d7[_0x349e('0x3f')],{'$or':_['map'](_0xef7ba7,function(_0x5a43cd){if(_0x5a43cd['type']!==_0x349e('0x43')){var _0xc40996={};_0xc40996[_0x5a43cd[_0x349e('0x2c')]]={'$like':'%'+_0x2aeb27[_0x349e('0x35')]['filter']+'%'};return _0xc40996;}})});}_0x36c2d7=_[_0x349e('0x42')]({},_0x36c2d7,_0x2aeb27['options']);var _0x198385={'where':_0x36c2d7[_0x349e('0x3f')]};return db[_0x349e('0x31')][_0x349e('0x22')](_0x198385)[_0x349e('0x13')](function(_0x37882d){_0x556d24[_0x349e('0x22')]=_0x37882d;if(_0x2aeb27[_0x349e('0x35')]['includeAll']){_0x36c2d7[_0x349e('0x44')]=[{'all':!![]}];}return db[_0x349e('0x31')][_0x349e('0x45')](_0x36c2d7);})[_0x349e('0x13')](function(_0x51a691){_0x556d24[_0x349e('0x46')]=_0x51a691;return _0x556d24;})['then'](respondWithFilteredResult(_0x296619,_0x36c2d7))[_0x349e('0x47')](handleError(_0x296619,null));};exports[_0x349e('0x48')]=function(_0x47fc02,_0x499f6b){var _0x40fae6={'raw':![],'where':{'id':_0x47fc02[_0x349e('0x49')]['id']},'include':[{'model':db[_0x349e('0x2e')],'as':_0x349e('0x2f')}]},_0xd9bd7e={};_0xd9bd7e['model']=_[_0x349e('0x36')](db[_0x349e('0x31')]['rawAttributes']);_0xd9bd7e['query']=_[_0x349e('0x36')](_0x47fc02[_0x349e('0x35')]);_0xd9bd7e[_0x349e('0x37')]=_[_0x349e('0x38')](_0xd9bd7e[_0x349e('0x39')],_0xd9bd7e[_0x349e('0x35')]);_0x40fae6['attributes']=_['intersection'](_0xd9bd7e[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x47fc02[_0x349e('0x35')]['fields']));_0x40fae6[_0x349e('0x3b')]=_0x40fae6[_0x349e('0x3b')]['length']?_0x40fae6['attributes']:_0xd9bd7e[_0x349e('0x39')];if(_0x47fc02['query'][_0x349e('0x4a')]){_0x40fae6['include']=[{'all':!![]}];}_0x40fae6=_[_0x349e('0x42')]({},_0x40fae6,_0x47fc02['options']);return db[_0x349e('0x31')]['find'](_0x40fae6)[_0x349e('0x13')](handleEntityNotFound(_0x499f6b,null))[_0x349e('0x13')](respondWithResult(_0x499f6b,null))[_0x349e('0x47')](handleError(_0x499f6b,null));};exports['create']=function(_0x647d22,_0x12eb63){return db[_0x349e('0x31')]['create'](_0x647d22[_0x349e('0x4b')],{})['then'](function(_0x3e6a74){var _0x44d03d=_0x647d22[_0x349e('0x4c')]['get']({'plain':!![]});if(!_0x44d03d)throw new Error(_0x349e('0x4d'));if(_0x44d03d[_0x349e('0x4e')]==='user'){var _0x3ae0b9=_0x3e6a74['get']({'plain':!![]});var _0x7f9868=_0x349e('0x29');return db[_0x349e('0x4f')][_0x349e('0x50')]({'where':{'name':_0x7f9868,'userProfileId':_0x44d03d[_0x349e('0x51')]},'raw':!![]})['then'](function(_0x469931){if(_0x469931&&_0x469931['autoAssociation']===0x0){return db[_0x349e('0x2a')][_0x349e('0x52')]({'name':_0x3ae0b9[_0x349e('0x2c')],'resourceId':_0x3ae0b9['id'],'type':_0x469931[_0x349e('0x2c')],'sectionId':_0x469931['id']},{})[_0x349e('0x13')](function(){return _0x3e6a74;});}else{return _0x3e6a74;}})[_0x349e('0x47')](function(_0x1f709c){logger[_0x349e('0x1a')](_0x349e('0x53'),_0x1f709c);throw _0x1f709c;});}return _0x3e6a74;})[_0x349e('0x13')](respondWithResult(_0x12eb63,0xc9))[_0x349e('0x47')](handleError(_0x12eb63,null));};exports['update']=function(_0x112da8,_0x48b5e4){if(_0x112da8[_0x349e('0x4b')]['id']){delete _0x112da8[_0x349e('0x4b')]['id'];}return db[_0x349e('0x31')]['find']({'where':{'id':_0x112da8['params']['id']},'include':[{'model':db[_0x349e('0x2e')],'as':_0x349e('0x2f')}]})[_0x349e('0x13')](handleEntityNotFound(_0x48b5e4,null))[_0x349e('0x13')](saveUpdates(_0x112da8['body'],null))[_0x349e('0x13')](respondWithResult(_0x48b5e4,null))['catch'](handleError(_0x48b5e4,null));};exports[_0x349e('0x27')]=function(_0x3ed95a,_0x550e0a){return db['ChatWebsite']['find']({'where':{'id':_0x3ed95a[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x550e0a,null))[_0x349e('0x13')](removeEntity(_0x550e0a,null))[_0x349e('0x47')](handleError(_0x550e0a,null));};exports[_0x349e('0x54')]=function(_0x7e03b3,_0x3011ce){return db[_0x349e('0x31')][_0x349e('0x54')]()['then'](respondWithResult(_0x3011ce,null))[_0x349e('0x47')](handleError(_0x3011ce,null));};exports['addDisposition']=function(_0xe813e2,_0x4c5580){if(_0xe813e2[_0x349e('0x4b')]['id']){delete _0xe813e2[_0x349e('0x4b')]['id'];}return db['ChatWebsite'][_0x349e('0x50')]({'where':{'id':_0xe813e2[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c5580,null))[_0x349e('0x13')](function(_0x53d3d4){if(_0x53d3d4){_0xe813e2[_0x349e('0x4b')][_0x349e('0x55')]=_0x53d3d4['id'];return db[_0x349e('0x56')][_0x349e('0x52')](_0xe813e2[_0x349e('0x4b')]);}})['then'](respondWithResult(_0x4c5580,null))[_0x349e('0x47')](handleError(_0x4c5580,null));};exports[_0x349e('0x57')]=function(_0xe12d3,_0x49e064){var _0x5db83e={'raw':![],'where':{}};var _0x392560={};var _0xfd0be4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x349e('0x58')]({'where':{'id':_0xe12d3[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x49e064,null))[_0x349e('0x13')](function(_0x3b22e5){if(_0x3b22e5){_0x392560[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0x56')]['rawAttributes']);_0x392560[_0x349e('0x35')]=_[_0x349e('0x36')](_0xe12d3[_0x349e('0x35')]);_0x392560['filters']=_[_0x349e('0x38')](_0x392560['model'],_0x392560[_0x349e('0x35')]);_0x5db83e['attributes']=_['intersection'](_0x392560[_0x349e('0x39')],qs[_0x349e('0x3a')](_0xe12d3[_0x349e('0x35')][_0x349e('0x3a')]));_0x5db83e['attributes']=_0x5db83e['attributes'][_0x349e('0x3c')]?_0x5db83e['attributes']:_0x392560[_0x349e('0x39')];if(!_0xe12d3['query'][_0x349e('0x59')](_0x349e('0x3d'))){_0x5db83e[_0x349e('0x23')]=qs[_0x349e('0x23')](_0xe12d3[_0x349e('0x35')][_0x349e('0x23')]);_0x5db83e['offset']=qs[_0x349e('0x21')](_0xe12d3[_0x349e('0x35')][_0x349e('0x21')]);}_0x5db83e[_0x349e('0x5a')]=qs['sort'](_0xe12d3[_0x349e('0x35')][_0x349e('0x3e')]);_0x5db83e[_0x349e('0x3f')]=qs['filters'](_[_0x349e('0x40')](_0xe12d3[_0x349e('0x35')],_0x392560[_0x349e('0x37')]));_0x5db83e[_0x349e('0x3f')][_0x349e('0x55')]=_0x3b22e5['id'];if(_0xe12d3[_0x349e('0x35')][_0x349e('0x41')]){_0x5db83e[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x5db83e[_0x349e('0x3f')],{'$or':_['map'](_0x5db83e[_0x349e('0x3b')],function(_0x432bca){var _0x2f97bf={};_0x2f97bf[_0x432bca]={'$like':'%'+_0xe12d3[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x2f97bf;})});}_0x5db83e=_['merge']({},_0x5db83e,_0xe12d3[_0x349e('0x5b')]);return db[_0x349e('0x56')][_0x349e('0x22')]({'where':_0x5db83e[_0x349e('0x3f')]})[_0x349e('0x13')](function(_0x5284d1){_0xfd0be4[_0x349e('0x22')]=_0x5284d1;if(_0xe12d3[_0x349e('0x35')][_0x349e('0x4a')]){_0x5db83e[_0x349e('0x44')]=[{'all':!![]}];}return db[_0x349e('0x56')][_0x349e('0x45')](_0x5db83e);})[_0x349e('0x13')](function(_0x5e01e7){_0xfd0be4[_0x349e('0x46')]=_0x5e01e7;return _0xfd0be4;});}})['then'](respondWithFilteredResult(_0x49e064,_0x5db83e))[_0x349e('0x47')](handleError(_0x49e064,null));};exports['removeDispositions']=function(_0x24b5dd,_0x1afa3a){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x24b5dd[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x1afa3a,null))[_0x349e('0x13')](function(_0x5df967){if(_0x5df967){return _0x5df967[_0x349e('0x5c')](_0x24b5dd[_0x349e('0x35')][_0x349e('0x5d')]);}})[_0x349e('0x13')](respondWithStatusCode(_0x1afa3a,null))[_0x349e('0x47')](handleError(_0x1afa3a,null));};exports[_0x349e('0x5e')]=function(_0x35ea51,_0x2fc377){if(_0x35ea51[_0x349e('0x4b')]['id']){delete _0x35ea51[_0x349e('0x4b')]['id'];}return db[_0x349e('0x31')]['find']({'where':{'id':_0x35ea51[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x2fc377,null))[_0x349e('0x13')](function(_0x223cb6){if(_0x223cb6){_0x35ea51[_0x349e('0x4b')][_0x349e('0x55')]=_0x223cb6['id'];return db['CannedAnswer']['create'](_0x35ea51[_0x349e('0x4b')]);}})[_0x349e('0x13')](respondWithResult(_0x2fc377,null))['catch'](handleError(_0x2fc377,null));};exports[_0x349e('0x5f')]=function(_0x39afbe,_0x302b73){var _0x4c512e={'raw':![],'where':{}};var _0x2f7423={};var _0x17a023={'count':0x0,'rows':[]};return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x39afbe[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x302b73,null))[_0x349e('0x13')](function(_0x1927c7){if(_0x1927c7){_0x2f7423[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0x60')][_0x349e('0x61')]);_0x2f7423[_0x349e('0x35')]=_[_0x349e('0x36')](_0x39afbe[_0x349e('0x35')]);_0x2f7423[_0x349e('0x37')]=_['intersection'](_0x2f7423[_0x349e('0x39')],_0x2f7423[_0x349e('0x35')]);_0x4c512e[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x2f7423[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x39afbe[_0x349e('0x35')][_0x349e('0x3a')]));_0x4c512e['attributes']=_0x4c512e['attributes'][_0x349e('0x3c')]?_0x4c512e[_0x349e('0x3b')]:_0x2f7423['model'];if(!_0x39afbe['query']['hasOwnProperty'](_0x349e('0x3d'))){_0x4c512e[_0x349e('0x23')]=qs['limit'](_0x39afbe[_0x349e('0x35')][_0x349e('0x23')]);_0x4c512e[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x39afbe[_0x349e('0x35')]['offset']);}_0x4c512e[_0x349e('0x5a')]=qs['sort'](_0x39afbe[_0x349e('0x35')][_0x349e('0x3e')]);_0x4c512e[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x39afbe[_0x349e('0x35')],_0x2f7423['filters']));_0x4c512e[_0x349e('0x3f')][_0x349e('0x55')]=_0x1927c7['id'];if(_0x39afbe[_0x349e('0x35')][_0x349e('0x41')]){_0x4c512e[_0x349e('0x3f')]=_['merge'](_0x4c512e[_0x349e('0x3f')],{'$or':_[_0x349e('0x30')](_0x4c512e[_0x349e('0x3b')],function(_0x5248e8){var _0x153b7f={};_0x153b7f[_0x5248e8]={'$like':'%'+_0x39afbe[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x153b7f;})});}_0x4c512e=_['merge']({},_0x4c512e,_0x39afbe['options']);return db['CannedAnswer'][_0x349e('0x22')]({'where':_0x4c512e[_0x349e('0x3f')]})[_0x349e('0x13')](function(_0x3f2495){_0x17a023['count']=_0x3f2495;if(_0x39afbe[_0x349e('0x35')]['includeAll']){_0x4c512e['include']=[{'all':!![]}];}return db[_0x349e('0x60')][_0x349e('0x45')](_0x4c512e);})[_0x349e('0x13')](function(_0x2087f1){_0x17a023[_0x349e('0x46')]=_0x2087f1;return _0x17a023;});}})[_0x349e('0x13')](respondWithFilteredResult(_0x302b73,_0x4c512e))[_0x349e('0x47')](handleError(_0x302b73,null));};exports[_0x349e('0x62')]=function(_0x28cedf,_0x1006ea){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x28cedf[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x1006ea,null))[_0x349e('0x13')](function(_0x4ace29){if(_0x4ace29){return _0x4ace29['removeAnswers'](_0x28cedf[_0x349e('0x35')][_0x349e('0x5d')]);}})[_0x349e('0x13')](respondWithStatusCode(_0x1006ea,null))[_0x349e('0x47')](handleError(_0x1006ea,null));};exports[_0x349e('0x63')]=function(_0x50bb54,_0x576f0c){_0x50bb54[_0x349e('0x4b')][_0x349e('0x64')]=_0x50bb54['file'][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x50bb54[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x576f0c,null))[_0x349e('0x13')](saveUpdates(_0x50bb54[_0x349e('0x4b')],null))['then'](respondWithResult(_0x576f0c,null))[_0x349e('0x47')](handleError(_0x576f0c,null));};exports[_0x349e('0x66')]=function(_0x166842,_0xc7e7de){_0x166842[_0x349e('0x4b')][_0x349e('0x67')]=_0x166842[_0x349e('0x68')][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x166842['params']['id']}})[_0x349e('0x13')](handleEntityNotFound(_0xc7e7de,null))[_0x349e('0x13')](saveUpdates(_0x166842[_0x349e('0x4b')],null))[_0x349e('0x13')](respondWithResult(_0xc7e7de,null))['catch'](handleError(_0xc7e7de,null));};exports[_0x349e('0x69')]=function(_0x21f65d,_0x3a2e2a){_0x21f65d[_0x349e('0x4b')]['customerAvatar']=_0x21f65d[_0x349e('0x68')][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x21f65d[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x3a2e2a,null))[_0x349e('0x13')](saveUpdates(_0x21f65d[_0x349e('0x4b')],null))[_0x349e('0x13')](respondWithResult(_0x3a2e2a,null))['catch'](handleError(_0x3a2e2a,null));};exports[_0x349e('0x6a')]=function(_0x2e78cf,_0x10e628){_0x2e78cf[_0x349e('0x4b')][_0x349e('0x6b')]=_0x2e78cf[_0x349e('0x68')][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x2e78cf['params']['id']}})['then'](handleEntityNotFound(_0x10e628,null))[_0x349e('0x13')](saveUpdates(_0x2e78cf['body'],null))[_0x349e('0x13')](respondWithResult(_0x10e628,null))[_0x349e('0x47')](handleError(_0x10e628,null));};exports[_0x349e('0x6c')]=function(_0x141cfb,_0x586bd0){var _0x2d5945=path['join'](config[_0x349e('0x6d')],_0x349e('0x6e'));var _0x490a01={'where':{'id':_0x141cfb['params']['id']},'attributes':['id',_0x349e('0x64')],'raw':!![]};var _0x5d68e3=![];return require('../../config/license/util')[_0x349e('0x6f')]()[_0x349e('0x13')](function(_0x25dfbf){if(_0x25dfbf){_0x5d68e3=_0x25dfbf[_0x349e('0x70')];}})['then'](function(){return db[_0x349e('0x31')][_0x349e('0x50')](_0x490a01);})[_0x349e('0x13')](handleEntityNotFound(_0x586bd0,null))[_0x349e('0x13')](function(_0x29d583){if(_0x29d583){if(!_[_0x349e('0x71')](_0x29d583[_0x349e('0x64')])){if(fs[_0x349e('0x72')](path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x74'),_0x29d583[_0x349e('0x64')]))&&_0x5d68e3){_0x2d5945=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x74'),_0x29d583['sitepic']);}}return _0x586bd0[_0x349e('0x75')](_0x2d5945);}})[_0x349e('0x47')](handleError(_0x586bd0,null));};exports['getAvatar']=function(_0x5bf46d,_0x1f7cbc){var _0x23ffa7=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x76'));var _0x462ced={'where':{'id':_0x5bf46d[_0x349e('0x49')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x349e('0x31')][_0x349e('0x50')](_0x462ced)['then'](handleEntityNotFound(_0x1f7cbc,null))[_0x349e('0x13')](function(_0x4fc076){if(_0x4fc076){if(!_[_0x349e('0x71')](_0x4fc076['agentAvatar'])){if(fs[_0x349e('0x72')](path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x4fc076[_0x349e('0x67')]))){_0x23ffa7=path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x4fc076[_0x349e('0x67')]);}}return _0x1f7cbc[_0x349e('0x75')](_0x23ffa7);}})[_0x349e('0x47')](handleError(_0x1f7cbc,null));};exports[_0x349e('0x78')]=function(_0x5a6520,_0x30b69d){var _0x21b78c=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x79'));var _0x1293e9={'where':{'id':_0x5a6520[_0x349e('0x49')]['id']},'attributes':['id','customerAvatar',_0x349e('0x7a')],'raw':!![]};return db[_0x349e('0x31')][_0x349e('0x50')](_0x1293e9)[_0x349e('0x13')](handleEntityNotFound(_0x30b69d,null))[_0x349e('0x13')](function(_0x61075b){if(_0x61075b){if(!_['isNil'](_0x61075b['customerAvatar'])){if(fs[_0x349e('0x72')](path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x61075b[_0x349e('0x7b')]))&&_0x61075b[_0x349e('0x7a')]){_0x21b78c=path[_0x349e('0x73')](config['root'],_0x349e('0x77'),_0x61075b[_0x349e('0x7b')]);}}return _0x30b69d[_0x349e('0x75')](_0x21b78c);}})[_0x349e('0x47')](handleError(_0x30b69d,null));};exports[_0x349e('0x7c')]=function(_0x373003,_0x27fccb){var _0x3778d8=path['join'](config['root'],_0x349e('0x7d'));var _0x4d711e={'where':{'id':_0x373003[_0x349e('0x49')]['id']},'attributes':['id',_0x349e('0x6b')],'raw':!![]};return db['ChatWebsite'][_0x349e('0x50')](_0x4d711e)[_0x349e('0x13')](handleEntityNotFound(_0x27fccb,null))[_0x349e('0x13')](function(_0x150451){if(_0x150451){if(!_[_0x349e('0x71')](_0x150451[_0x349e('0x6b')])){if(fs[_0x349e('0x72')](path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x150451['systemAvatar']))){_0x3778d8=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x77'),_0x150451[_0x349e('0x6b')]);}}return _0x27fccb[_0x349e('0x75')](_0x3778d8);}})[_0x349e('0x47')](handleError(_0x27fccb,null));};exports[_0x349e('0x7e')]=function(_0x199844,_0x1739f8){var _0x3fa3ed=require(_0x349e('0x7f'));var _0x2c54b9=new _0x3fa3ed();var _0x2dd88c=_0x2c54b9[_0x349e('0x80')](_0x199844[_0x349e('0x81')][_0x349e('0x82')])[_0x349e('0x83')]();var _0x28ebd1={'body':_0x199844[_0x349e('0x4b')],'channel':_0x349e('0x84')};var _0x17a9be=[];var _0x1d59c6=[];var _0x12672f={};var _0x394c31=![];return db[_0x349e('0x85')][_0x349e('0x54')]()[_0x349e('0x13')](function(_0x5e7251){if(!_0x5e7251){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x88'));}_0x17a9be=_[_0x349e('0x89')](_['keys'](_0x5e7251),['createdAt','updatedAt']);_0x1d59c6=_['difference'](_['keys'](_0x5e7251),['createdAt','updatedAt',_0x349e('0x8a'),_0x349e('0x8b')]);if(_0x199844[_0x349e('0x4b')]['id']){delete _0x199844['body']['id'];}if(_[_0x349e('0x71')](_0x199844[_0x349e('0x4b')][_0x349e('0x8c')])){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x8d'));}if(_[_0x349e('0x71')](_0x199844[_0x349e('0x4b')][_0x349e('0x4b')])||_0x199844['body'][_0x349e('0x4b')]===''){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x8e'));}if(_[_0x349e('0x71')](_0x199844[_0x349e('0x4b')][_0x349e('0x8f')])){throw new db[(_0x349e('0x86'))]['ValidationError'](_0x349e('0x90')+_0x1d59c6);}if(!_[_0x349e('0x91')](_0x1d59c6,_0x199844[_0x349e('0x4b')][_0x349e('0x8f')])){throw new db['Sequelize'][(_0x349e('0x87'))](_0x349e('0x92')+_0x1d59c6);}_0x12672f[_0x199844[_0x349e('0x4b')][_0x349e('0x8f')]]=_0x199844[_0x349e('0x4b')][_0x349e('0x8c')];})['then'](function(){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x199844[_0x349e('0x49')]['id']},'include':[{'model':db['CmList'],'as':_0x349e('0x93'),'include':[{'model':db[_0x349e('0x85')],'as':_0x349e('0x94'),'where':_0x12672f,'limit':0x1,'order':[[_0x349e('0x95'),_0x349e('0x96')]]}]},{'model':db[_0x349e('0x97')],'as':_0x349e('0x98')}]});})[_0x349e('0x13')](handleEntityNotFound(_0x1739f8,null))[_0x349e('0x13')](function(_0x5cad2c){if(_0x5cad2c&&_0x5cad2c[_0x349e('0x93')]){_0x28ebd1[_0x349e('0x99')]=_0x5cad2c;_0x28ebd1[_0x349e('0x9a')]=_0x5cad2c['Applications'];_0x28ebd1[_0x349e('0x9b')]=_0x5cad2c[_0x349e('0x93')];_0x28ebd1['applications']=_[_0x349e('0x9c')](_0x28ebd1[_0x349e('0x9a')],[_0x349e('0x9d')],[_0x349e('0x9e')]);if(_0x28ebd1[_0x349e('0x99')][_0x349e('0x98')]){delete _0x28ebd1['account'][_0x349e('0x98')];}if(_0x28ebd1[_0x349e('0x99')][_0x349e('0x93')]&&_0x28ebd1[_0x349e('0x99')]['List']['Contacts'][_0x349e('0x3c')]){return _0x28ebd1[_0x349e('0x99')]['List'][_0x349e('0x94')][0x0];}var _0x13c863=_[_0x349e('0x9')](_0x199844[_0x349e('0x4b')],{'firstName':_0x199844[_0x349e('0x4b')][_0x349e('0x8c')],'ListId':_0x5cad2c[_0x349e('0x8b')]});_0x13c863[_0x199844['body']['mapKey']]=_0x199844[_0x349e('0x4b')][_0x349e('0x8c')];return db['CmContact'][_0x349e('0x52')](_0x13c863,{'fields':_0x17a9be,'raw':!![]});}})[_0x349e('0x13')](handleEntityNotFound(_0x1739f8,null))[_0x349e('0x13')](function(_0x28af59){_0x28ebd1[_0x349e('0x9f')]=_0x28af59;var _0x45b78a=_0x199844['body'][_0x349e('0xa0')];if(_0x199844['headers']['cf-connecting-ip']){_0x45b78a=_0x199844[_0x349e('0x81')][_0x349e('0xa1')];}else if(_0x199844[_0x349e('0x81')][_0x349e('0xa2')]){_0x45b78a=_['first'](_0x199844[_0x349e('0x81')][_0x349e('0xa2')][_0x349e('0xa3')](','));}if(_0x28af59){var _0x53ab06={'ContactId':_0x28af59['id'],'ChatWebsiteId':_0x199844[_0x349e('0x49')]['id'],'from':(_0x28af59[_0x349e('0xa4')]||'')+'\x20'+(_0x28af59[_0x349e('0xa5')]||''),'customerIp':_0x45b78a,'customerPort':_0x199844[_0x349e('0x81')][_0x349e('0xa6')]?_0x199844[_0x349e('0x81')]['x-real-port']:null,'referer':_0x199844['body'][_0x349e('0xa7')],'browserName':_0x2dd88c[_0x349e('0xa8')]['name']&&_0x2dd88c[_0x349e('0xa8')][_0x349e('0xa9')]?util[_0x349e('0xaa')](_0x349e('0xab'),_0x2dd88c['browser']['name'],_0x2dd88c[_0x349e('0xa8')][_0x349e('0xa9')]):_0x349e('0xac'),'browserVersion':_0x2dd88c[_0x349e('0xa8')]['version']||_0x349e('0xac'),'osName':util[_0x349e('0xaa')](_0x349e('0xab'),_0x2dd88c['os'][_0x349e('0x2c')],_0x2dd88c['os'][_0x349e('0xa9')]),'osVersion':_0x2dd88c['os'][_0x349e('0xa9')],'deviceModel':_0x2dd88c[_0x349e('0xad')][_0x349e('0x39')]&&_0x2dd88c[_0x349e('0xad')][_0x349e('0xae')]?util[_0x349e('0xaa')]('%s\x20%s\x20%s',_0x2dd88c[_0x349e('0xad')]['model'],_0x2dd88c['device'][_0x349e('0xae')],_0x2dd88c['device'][_0x349e('0x33')]):null,'deviceVendor':_0x2dd88c[_0x349e('0xad')][_0x349e('0xae')],'deviceType':_0x2dd88c['device'][_0x349e('0x33')],'formData':JSON['stringify'](_0x199844[_0x349e('0x4b')])};var _0x30a6fe={'ChatWebsiteId':_0x199844['params']['id'],'closed':![]};if(_0x199844['body'][_0x349e('0xaf')]){_0x30a6fe['threadId']=_0x199844[_0x349e('0x4b')]['threadId'];return db[_0x349e('0xb0')][_0x349e('0x50')]({'where':_0x30a6fe})[_0x349e('0x13')](function(_0x2f687e){if(_0x2f687e){return[_0x2f687e,![]];}_0x53ab06['threadId']=_0x199844[_0x349e('0x4b')]['threadId'];_0x53ab06[_0x349e('0xb1')]=_0x199844[_0x349e('0x4b')][_0x349e('0xb1')];return db['ChatInteraction']['create'](_0x53ab06)[_0x349e('0x13')](function(_0x379550){return[_0x379550,!![]];});});}_0x30a6fe['ContactId']=_0x28af59['id'];if(_0x199844[_0x349e('0x4b')][_0x349e('0xb2')]&&_0x199844[_0x349e('0x4b')][_0x349e('0xb2')]['id']){_0x30a6fe['id']=_0x199844['body'][_0x349e('0xb2')]['id'];return db['ChatInteraction']['find']({'where':_0x30a6fe})[_0x349e('0x13')](function(_0x5c89c1){if(_0x5c89c1){return[_0x5c89c1,![]];}return db[_0x349e('0xb0')][_0x349e('0x52')](_0x53ab06)[_0x349e('0x13')](function(_0x45c626){return[_0x45c626,!![]];});});}return db[_0x349e('0xb0')][_0x349e('0x52')](_0x53ab06)[_0x349e('0x13')](function(_0x3b0808){return[_0x3b0808,!![]];});}})['spread'](function(_0xa09a2e,_0x35e267){if(_0xa09a2e){_0x394c31=_0x35e267;if(!_0x35e267){var _0x285233={'from':(_0x28ebd1[_0x349e('0x9f')]['firstName']||'')+'\x20'+(_0x28ebd1[_0x349e('0x9f')][_0x349e('0xa5')]||'')};if(_0x199844[_0x349e('0x4b')][_0x349e('0xaf')]&&_0x199844[_0x349e('0x4b')][_0x349e('0xb3')]&&_0x199844[_0x349e('0x4b')][_0x349e('0xaf')]!=_0x199844['body'][_0x349e('0xb3')]){_0x285233[_0x349e('0xaf')]=_0x199844[_0x349e('0x4b')][_0x349e('0xb3')];}return _0xa09a2e['update'](_0x285233);}else{return _0xa09a2e;}}})[_0x349e('0x13')](function(_0x8a0f78){_0x28ebd1[_0x349e('0xb2')]=_0x8a0f78[_0x349e('0x28')]({'plain':!![]});_0x28ebd1[_0x349e('0xb2')][_0x349e('0xb4')]=_0x394c31;if(_0x28ebd1[_0x349e('0xb2')][_0x349e('0xb4')]){if(_0x28ebd1[_0x349e('0x99')]['autoclose']){_0x28ebd1[_0x349e('0x9a')][_0x349e('0xb5')]({'id':0x0,'priority':_0x28ebd1[_0x349e('0x9a')][_0x349e('0x3c')]+0x1,'app':_0x349e('0xb6'),'appdata':'unmanaged','interval':_0x349e('0xb7')});}}return db['ChatMessage'][_0x349e('0x52')]({'body':_0x199844[_0x349e('0x4b')][_0x349e('0x4b')],'ChatWebsiteId':_0x199844[_0x349e('0x49')]['id'],'ChatInteractionId':_0x8a0f78['id'],'direction':'in','ContactId':_0x28ebd1[_0x349e('0x9f')]['id'],'AttachmentId':_0x199844[_0x349e('0x4b')]['AttachmentId']});})['then'](function(_0x523506){_0x28ebd1[_0x349e('0x1c')]=_0x523506;if(_0x28ebd1['interaction'][_0x349e('0xb8')]){return db[_0x349e('0xb9')][_0x349e('0x50')]({'attributes':['id','name'],'where':{'id':_0x28ebd1['interaction'][_0x349e('0xb8')]}})[_0x349e('0x13')](function(_0x5f3ff4){if(_0x5f3ff4){_0x28ebd1[_0x349e('0x9a')][_0x349e('0xba')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5f3ff4[_0x349e('0x2c')]+','+(_0x28ebd1[_0x349e('0x99')][_0x349e('0xbb')]||0xa),'interval':_0x349e('0xb7')});_0x28ebd1[_0x349e('0xbc')]=!![];}return respondWithRpcPromise('Start',_0x349e('0xbd'),_0x28ebd1);});}return respondWithRpcPromise(_0x349e('0xbe'),_0x349e('0xbd'),_0x28ebd1);})[_0x349e('0x13')](function(_0x4aab49){respondWithRpcPromise(_0x349e('0xbf'),_0x349e('0xbf'),{'event':_0x349e('0x7e'),'message':_0x4aab49},client9002);return _0x4aab49;})['then'](respondWithResult(_0x1739f8,null))[_0x349e('0x47')](handleError(_0x1739f8,null));};exports[_0x349e('0xc0')]=function(_0x35ba6b,_0x2409cb){var _0xc97dc6,_0x4c5aff,_0xd08627;var _0x49e7a6=[];var _0x1c4013={};var _0x447660=_0x35ba6b[_0x349e('0xc1')]||[];var _0x550e36=[];var _0x110581;return db[_0x349e('0x85')][_0x349e('0x54')]()['then'](function(_0x5346bd){if(!_0x5346bd){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))]('no\x20available\x20attributes');}_0x49e7a6=_[_0x349e('0x89')](_[_0x349e('0x36')](_0x5346bd),[_0x349e('0xc2'),'updatedAt',_0x349e('0x8a'),_0x349e('0x8b')]);if(_0x35ba6b[_0x349e('0x4b')]['id']){delete _0x35ba6b[_0x349e('0x4b')]['id'];}if(_[_0x349e('0x71')](_0x35ba6b[_0x349e('0x4b')]['from'])){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x8d')));}if(_[_0x349e('0x71')](_0x35ba6b[_0x349e('0x4b')]['body'])||_0x35ba6b[_0x349e('0x4b')][_0x349e('0x4b')]===''){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))][(_0x349e('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x35ba6b[_0x349e('0x4b')][_0x349e('0xc3')])){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))]['ValidationError'](_0x349e('0xc4')+_0x49e7a6));}if(!_[_0x349e('0x91')](_0x49e7a6,_0x35ba6b[_0x349e('0x4b')][_0x349e('0xc3')])){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))]['ValidationError'](_0x349e('0xc5')+_0x49e7a6));}_0x1c4013[_0x35ba6b[_0x349e('0x4b')]['mapKeyOffline']]=_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')];})['then'](function(){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x35ba6b[_0x349e('0x49')]['id']},'include':[{'model':db[_0x349e('0xc6')],'as':_0x349e('0x93')},{'model':db[_0x349e('0xc7')],'as':_0x349e('0xc7')}]});})[_0x349e('0x13')](handleEntityNotFound(_0x2409cb,null))[_0x349e('0x13')](function(_0xb4a4a){if(_0xb4a4a&&_0xb4a4a[_0x349e('0x93')]){_0x4c5aff=_0xb4a4a;var _0x1d38b6=_[_0x349e('0x9')](_0x35ba6b[_0x349e('0x4b')],{'firstName':_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')],'phone':_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')],'ListId':_0xb4a4a[_0x349e('0x8b')]});_0x1d38b6[_0x35ba6b['body'][_0x349e('0xc3')]]=_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')];return db[_0x349e('0x85')][_0x349e('0xc8')]({'where':_0x1c4013,'defaults':_0x1d38b6});}})[_0x349e('0xc9')](function(_0x44c0ef){if(_0x44c0ef){_0xd08627=_0x44c0ef;var _0x22ce44=fs[_0x349e('0xca')](path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0xcb')),_0x349e('0xcc'));var _0x1425e5=ejs['render'](_0x22ce44,{'body':_[_0x349e('0xcd')](_0x35ba6b[_0x349e('0x4b')]['body']),'bodyTitle':_0x4c5aff[_0x349e('0xce')]});return db[_0x349e('0xcf')][_0x349e('0x52')]({'body':_0x1425e5,'plainBody':htmlToText[_0x349e('0xd0')](_0x1425e5),'ContactId':_0x44c0ef['id'],'ChatWebsiteId':_0x4c5aff['id']});}})['then'](function(_0xbb12e7){_0x110581=_0xbb12e7;if(_0x447660[_0x349e('0x3c')]){var _0x495cc6=_0x447660[_0x349e('0x30')](function(_0x36a9a9){return{'name':_0x36a9a9[_0x349e('0xd1')],'basename':_0x36a9a9[_0x349e('0x65')],'type':_0x36a9a9[_0x349e('0xd2')],'ChatOfflineMessageId':_0xbb12e7['id']};});_0x550e36=_0x495cc6[_0x349e('0x30')](_0x21ddc5=>{var _0x4a42fb={'filename':_0x21ddc5[_0x349e('0x2c')],'path':path[_0x349e('0x73')](config['root'],_0x349e('0xd3'),_0x349e('0xc1'),'attachments',_0x349e('0xd4'),_0x21ddc5[_0x349e('0xd5')])};return _0x4a42fb;});if(!_0x4c5aff[_0x349e('0xd6')]){return db[_0x349e('0xd7')][_0x349e('0xd8')](function(_0x490ff1){return db[_0x349e('0xd9')][_0x349e('0xda')](_0x495cc6,{'transaction':_0x490ff1});});}}})[_0x349e('0x13')](function(){if(_0x110581){_0xc97dc6=_0x110581;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x349e('0xdb')],'as':_0x349e('0xdc'),'raw':!![],'include':[{'model':db[_0x349e('0xdd')],'as':_0x349e('0xdd'),'raw':!![]}]}]});}})['then'](function(_0x5b0f17){if(_0x5b0f17&&_0x5b0f17[_0x349e('0xdc')]&&_0x4c5aff[_0x349e('0xde')]&&_0x4c5aff[_0x349e('0xdf')]){var _0x4109be=_0x5b0f17[_0x349e('0xe0')]();return respondWithRpcPromise(_0x349e('0xe1'),_0x349e('0xe2'),{'account':_0x4109be,'message':{'from':util[_0x349e('0xaa')](_0x349e('0xe3'),_0x5b0f17[_0x349e('0x2c')],_0x5b0f17[_0x349e('0xe4')]||_0x5b0f17[_0x349e('0xdc')][_0x349e('0x4c')]),'to':_0x4c5aff[_0x349e('0xdf')],'subject':_0x4c5aff[_0x349e('0xe5')],'html':_0xc97dc6[_0x349e('0x4b')],'attachments':_0x550e36}},client9003)[_0x349e('0x13')](function(){return _0xc97dc6;})['catch'](function(_0x1fc787){logger[_0x349e('0x1a')](_0x1fc787);});}})[_0x349e('0x13')](function(){if(_0x4c5aff&&_0x4c5aff[_0x349e('0xd6')]&&_0x4c5aff[_0x349e('0xe6')]){var _0x4c8081=[];if(_0x447660[_0x349e('0x3c')]){_0x4c8081=_0x447660['map'](function(_0x12d010){return{'name':_0x12d010['originalname'],'basename':_0x12d010[_0x349e('0x65')],'type':_0x12d010[_0x349e('0xd2')],'ChatOfflineMessageId':_0x110581['id']};});}var _0x26169d;if(!_[_0x349e('0x71')](_0x4c5aff[_0x349e('0xe7')])){var _0x12b819=_[_0x349e('0x30')](_0x35ba6b[_0x349e('0x4b')],function(_0x363ca0){return _0x363ca0;});var _0x1256cb=_['toPairsIn'](_0x12b819)[0x0];var _0x5c225f=_[_0x349e('0xe8')](_0x1256cb,function(_0x11532a){return _0x11532a;});_0x26169d=_0x5c225f[0x1][_0x4c5aff[_0x349e('0xe7')]];}var _0x530b28={'from':_0xd08627['email'],'firstName':_0xd08627[_0x349e('0xa4')],'lastName':_0xd08627['lastName'],'mapKey':'email','message':{'from':_0xd08627[_0x349e('0xe4')],'to':_0x4c5aff[_0x349e('0xc7')][_0x349e('0xe4')],'cc':'','subject':_[_0x349e('0x71')](_0x26169d)?_0x4c5aff[_0x349e('0xe5')]:_0x26169d,'messageId':'','sentAt':new Date(),'attach':_0x4c8081['length'],'attachments':_0x4c8081,'originChannel':'Chat','ChatWebsiteId':_0x4c5aff['id'],'ChatOfflineMessageId':_0xc97dc6['id'],'originTo':_0x4c5aff['MailAccount'][_0x349e('0xe4')]},'body':_0xc97dc6[_0x349e('0x4b')]};var _0x56e974={'account':{'id':_0x4c5aff[_0x349e('0xe6')]},'body':_0x530b28,'log':_0x349e('0xe9')};return respondWithRpcPromise(_0x349e('0xe9'),_0x349e('0xea'),_0x56e974,client9001)[_0x349e('0x13')](function(){return _0xc97dc6;})[_0x349e('0x47')](function(_0x1fa04e){logger[_0x349e('0x1a')](_0x1fa04e);});}return;})[_0x349e('0x13')](function(){if(_0xc97dc6){return _0xc97dc6;}})[_0x349e('0x13')](respondWithResult(_0x2409cb,null))[_0x349e('0x47')](function(_0x45283b){logger[_0x349e('0x1a')](_0x349e('0x47'),_0x45283b);for(var _0x4f67d6 of _0x447660){var _0x16af1a=path['join'](config[_0x349e('0x6d')],_0x349e('0xd3'),'files','attachments',_0x349e('0xd4'),_0x4f67d6[_0x349e('0x65')]);fs_extra['remove'](_0x16af1a)[_0x349e('0x47')](function(_0x237d5e){logger[_0x349e('0x1a')]('Could\x20not\x20remove\x20attachment\x20file',_0x16af1a,_0x237d5e);});}});};exports[_0x349e('0xeb')]=function(_0x116486,_0x83b849){return db[_0x349e('0xb0')][_0x349e('0x50')]({'where':{'id':_0x116486[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x83b849,null))[_0x349e('0x13')](function(_0x4a3a78){if(_0x4a3a78){return _0x4a3a78[_0x349e('0xeb')](_0x116486[_0x349e('0x4b')]['ids'],_['omit'](_0x116486[_0x349e('0x4b')],['ids','id'])||{});}})[_0x349e('0x13')](respondWithResult(_0x83b849,null))[_0x349e('0x47')](handleError(_0x83b849,null));};exports[_0x349e('0xec')]=function(_0x214c00,_0x57f90a){var _0x5ca8ee={'raw':![],'where':{}};var _0x2d6ac6={};var _0x31e7b0={'count':0x0,'rows':[]};return db[_0x349e('0x31')]['findOne']({'where':{'id':_0x214c00[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x57f90a,null))[_0x349e('0x13')](function(_0x30ebdc){if(_0x30ebdc){_0x2d6ac6[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0xb0')][_0x349e('0x61')]);_0x2d6ac6['query']=_[_0x349e('0x36')](_0x214c00['query']);_0x2d6ac6[_0x349e('0x37')]=_[_0x349e('0x38')](_0x2d6ac6[_0x349e('0x39')],_0x2d6ac6[_0x349e('0x35')]);_0x5ca8ee[_0x349e('0x3b')]=_['intersection'](_0x2d6ac6[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x214c00[_0x349e('0x35')][_0x349e('0x3a')]));_0x5ca8ee[_0x349e('0x3b')]=_0x5ca8ee['attributes'][_0x349e('0x3c')]?_0x5ca8ee[_0x349e('0x3b')]:_0x2d6ac6[_0x349e('0x39')];if(!_0x214c00[_0x349e('0x35')][_0x349e('0x59')]('nolimit')){_0x5ca8ee[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x214c00[_0x349e('0x35')][_0x349e('0x23')]);_0x5ca8ee['offset']=qs[_0x349e('0x21')](_0x214c00[_0x349e('0x35')][_0x349e('0x21')]);}_0x5ca8ee[_0x349e('0x5a')]=qs['sort'](_0x214c00[_0x349e('0x35')][_0x349e('0x3e')]);_0x5ca8ee['where']=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x214c00[_0x349e('0x35')],_0x2d6ac6[_0x349e('0x37')]));_0x5ca8ee[_0x349e('0x3f')][_0x349e('0x55')]=_0x30ebdc['id'];if(_0x214c00['query'][_0x349e('0x41')]){_0x5ca8ee['where']=_[_0x349e('0x42')](_0x5ca8ee[_0x349e('0x3f')],{'$or':_[_0x349e('0x30')](_0x5ca8ee['attributes'],function(_0x8f9dce){var _0x3a8c4c={};_0x3a8c4c[_0x8f9dce]={'$like':'%'+_0x214c00[_0x349e('0x35')]['filter']+'%'};return _0x3a8c4c;})});}_0x5ca8ee=_['merge']({},_0x5ca8ee,_0x214c00[_0x349e('0x5b')]);return db['ChatInteraction'][_0x349e('0x22')]({'where':_0x5ca8ee[_0x349e('0x3f')]})['then'](function(_0x46ba31){_0x31e7b0[_0x349e('0x22')]=_0x46ba31;if(_0x214c00[_0x349e('0x35')]['includeAll']){_0x5ca8ee[_0x349e('0x44')]=[{'model':db['CmContact'],'as':_0x349e('0xed'),'required':![]},{'model':db[_0x349e('0xb9')],'as':_0x349e('0xee'),'attributes':['name',_0x349e('0xef'),_0x349e('0xf0')],'required':![]},{'model':db['Tag'],'as':_0x349e('0xf1'),'attributes':['id',_0x349e('0x2c'),_0x349e('0xf2')],'where':_0x214c00['query'][_0x349e('0xf3')]?{'id':_0x214c00[_0x349e('0x35')][_0x349e('0xf3')]}:undefined,'required':_0x214c00[_0x349e('0x35')][_0x349e('0xf3')]?!![]:![]}];}return db[_0x349e('0xb0')][_0x349e('0x45')](_0x5ca8ee);})[_0x349e('0x13')](function(_0x13a125){_0x31e7b0[_0x349e('0x46')]=_0x13a125;return _0x31e7b0;});}})[_0x349e('0x13')](respondWithFilteredResult(_0x57f90a,_0x5ca8ee))[_0x349e('0x47')](handleError(_0x57f90a,null));};function iftimePromise(_0x44ff12,_0x41dc25){return respondWithRpcPromise(_0x349e('0xf4'),_0x349e('0xf5'),{'command':_0x41dc25[_0x349e('0xf6')]?util[_0x349e('0xaa')]('iftime\x20%s,%s',_0x44ff12[_0x349e('0xf7')],_0x41dc25[_0x349e('0xf6')]):util[_0x349e('0xaa')](_0x349e('0xf8'),_0x44ff12[_0x349e('0xf7')])},client9002)[_0x349e('0x13')](function(_0x4153a6){var _0x30f316=_0x4153a6&&_0x4153a6[_0x349e('0xf9')](_0x349e('0xfa'))>=0x0?!![]:![];logger['info'](_0x349e('0xfb'),_0x41dc25['id'],_0x44ff12['id'],_0x44ff12[_0x349e('0xf7')],_0x30f316?_0x349e('0xfc'):_0x349e('0xfd'),_0x41dc25[_0x349e('0xf6')]?_0x41dc25['timezone']:_0x349e('0xfe'));return _0x30f316;})['catch'](function(_0x4f6468){logger['error'](_0x349e('0xfb'),_0x41dc25['id'],_0x44ff12['id'],_0x44ff12[_0x349e('0xf7')],util[_0x349e('0xff')](_0x4f6468,{'showHidden':![],'depth':null}),_0x41dc25[_0x349e('0xf6')]?_0x41dc25[_0x349e('0xf6')]:_0x349e('0xfe'));return![];});}exports['getSnippet']=function(_0x20a007,_0x2faa4e){var _0xdcb99=0x0;var _0x1d8c8e=0x0;var _0x1485bd=![];var _0x2659b6;var _0x6e8323;return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x20a007[_0x349e('0x49')]['id']},'include':[{'model':db[_0x349e('0x100')],'as':_0x349e('0x100'),'include':[{'model':db[_0x349e('0x100')],'as':_0x349e('0x101'),'attributes':['id',_0x349e('0xf7')],'raw':!![]}]}]})[_0x349e('0x13')](handleEntityNotFound(_0x2faa4e,null))[_0x349e('0x13')](function(_0x2a48df){if(_0x2a48df){_0x2659b6=_0x2a48df;return _0x2a48df[_0x349e('0x102')]({'raw':!![]});}})[_0x349e('0x13')](function(_0x89e063){if(_0x2659b6){if(_0x89e063){_0x6e8323=_0x89e063;}}return require(_0x349e('0x103'))['getLicense']();})[_0x349e('0x13')](function(_0x3e4d9d){if(_0x3e4d9d){_0x1d8c8e=_0x3e4d9d[_0x349e('0x104')];_0x1485bd=_0x3e4d9d['custom'];}})[_0x349e('0x13')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x3911aa){_0xdcb99=_0x3911aa;if(_0x1d8c8e&&_0x3911aa>_0x1d8c8e){return db[_0x349e('0x105')][_0x349e('0x58')]({'where':{'id':0x1}})[_0x349e('0x13')](function(_0xba8e5a){if(_0xba8e5a){_0xba8e5a[_0x349e('0x106')](_0x349e('0x107'));}});}})[_0x349e('0x13')](function(){if(_0x2659b6[_0x349e('0x100')]&&_0x2659b6[_0x349e('0x100')][_0x349e('0x101')]){var _0x199b08=[];for(var _0x555c57=0x0;_0x555c57<_0x2659b6[_0x349e('0x100')]['Intervals'][_0x349e('0x3c')];_0x555c57++){var _0xcf4d2a=_0x2659b6[_0x349e('0x100')][_0x349e('0x101')][_0x555c57][_0x349e('0x28')]({'plain':!![]});_0x199b08[_0x349e('0xb5')](iftimePromise(_0xcf4d2a,_0x2659b6));}return BPromise[_0x349e('0x108')](_0x199b08)[_0x349e('0x13')](function(_0x362f2b){return _['some'](_0x362f2b);});}else{return!![];}})[_0x349e('0x13')](function(_0x5ef9a6){var _0x3c5d97=fs[_0x349e('0xca')](path['join'](config['root'],_0x349e('0x109')),_0x349e('0xcc'));var _0x572303={'remote':_0x2659b6[_0x349e('0x10a')],'query':querystring[_0x349e('0x19')](_[_0x349e('0x42')](_0x2659b6[_0x349e('0x28')]({'plain':!![]}),{'customerIp':_0x20a007[_0x349e('0x81')][_0x349e('0xa2')]||_0x20a007[_0x349e('0x81')]['x-real-ip']||_0x20a007['connection'][_0x349e('0x10b')]||_0x20a007['ip'],'referer':_0x20a007[_0x349e('0x81')][_0x349e('0xa7')],'openedInteractions':_0xdcb99,'maxInteractions':_0x1d8c8e,'virtual':_0x1485bd[_0x349e('0x104')],'online':_0x5ef9a6,'custom':_0x1485bd}))['replace'](/'/g,'\x5c\x27')};_0x2faa4e[_0x349e('0x2d')](ejs[_0x349e('0x10c')](Mustache[_0x349e('0x10c')](_0x3c5d97,_0x572303),{'proactiveActions':_0x6e8323,'alignment':_0x2659b6[_0x349e('0x10d')],'verticalAlignment':_0x2659b6[_0x349e('0x10e')],'div_color':_0x2659b6[_0x349e('0xf2')],'labelText':_0x2659b6['labelText'],'text_color':_0x2659b6['textColor'],'text_button_color':_0x2659b6[_0x349e('0x10f')],'button_color':_0x2659b6[_0x349e('0x110')],'background_color':_0x2659b6[_0x349e('0x111')],'hideWhenOffline':_0x2659b6[_0x349e('0x112')],'interval':_0x2659b6[_0x349e('0x113')]}));})[_0x349e('0x47')](handleError(_0x2faa4e,null));};exports['addApplications']=function(_0x8293d9,_0x59a823){var _0x26e8b5=_0x8293d9[_0x349e('0x49')]['id'];var _0x6bd0cd=_0x8293d9[_0x349e('0x4b')];var _0x4a95c4=0xc8;var _0x4a1f92=null;return db['sequelize'][_0x349e('0xd8')]({'isolationLevel':db['sequelize'][_0x349e('0x114')][_0x349e('0x115')][_0x349e('0x116')]},function(_0xdb1721){return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x26e8b5},'transaction':_0xdb1721})['then'](function(_0x13f59d){if(_0x13f59d){return db['ChatApplication'][_0x349e('0x27')]({'where':{'ChatWebsiteId':_0x26e8b5},'transaction':_0xdb1721})[_0x349e('0x13')](function(){var _0x77901c=_[_0x349e('0x30')](_0x6bd0cd,function(_0x52467b){_0x52467b[_0x349e('0x55')]=_0x26e8b5;return _0x52467b;});return db['ChatApplication'][_0x349e('0xda')](_0x77901c,{'transaction':_0xdb1721});});}else{_0x4a95c4=0x194;_0x4a1f92=[];}});})['then'](function(){if(_0x4a95c4!==0x194){return db[_0x349e('0x97')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x26e8b5},'order':_0x349e('0x9d')})['then'](function(_0x26fa8a){_0x4a1f92=_0x26fa8a;});}})[_0x349e('0x47')](function(_0x720286){_0x4a95c4=0x1f4;logger[_0x349e('0x1a')](_0x720286['stack']);if(_0x720286['name']){delete _0x720286[_0x349e('0x2c')];}_0x4a1f92=_0x720286;})[_0x349e('0x117')](function(){if(_0x4a1f92===null){_0x59a823['sendStatus'](_0x4a95c4);}else{if(_0x4a95c4===0x1f4){_0x59a823[_0x349e('0x1f')](_0x4a95c4)[_0x349e('0x2d')](_0x4a1f92);}else{_0x59a823['status'](_0x4a95c4)[_0x349e('0x20')](_0x4a1f92);}}});};exports[_0x349e('0x118')]=function(_0x4b90cd,_0x305e04){var _0x3c09e1={};var _0x5bf096={};var _0x241fd4;var _0x2a8933;return db['ChatWebsite']['findOne']({'where':{'id':_0x4b90cd[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x305e04,null))['then'](function(_0xe36937){if(_0xe36937){_0x241fd4=_0xe36937;_0x5bf096[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0x97')][_0x349e('0x61')]);_0x5bf096[_0x349e('0x35')]=_['keys'](_0x4b90cd[_0x349e('0x35')]);_0x5bf096[_0x349e('0x37')]=_[_0x349e('0x38')](_0x5bf096[_0x349e('0x39')],_0x5bf096[_0x349e('0x35')]);_0x3c09e1[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x5bf096['model'],qs[_0x349e('0x3a')](_0x4b90cd['query'][_0x349e('0x3a')]));_0x3c09e1[_0x349e('0x3b')]=_0x3c09e1[_0x349e('0x3b')]['length']?_0x3c09e1['attributes']:_0x5bf096[_0x349e('0x39')];_0x3c09e1[_0x349e('0x5a')]=qs[_0x349e('0x3e')](_0x4b90cd[_0x349e('0x35')][_0x349e('0x3e')]);_0x3c09e1[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x4b90cd[_0x349e('0x35')],_0x5bf096['filters']));if(_0x4b90cd[_0x349e('0x35')][_0x349e('0x41')]){_0x3c09e1['where']=_['merge'](_0x3c09e1[_0x349e('0x3f')],{'$or':_[_0x349e('0x30')](_0x3c09e1['attributes'],function(_0x4d4112){var _0x55a88f={};_0x55a88f[_0x4d4112]={'$like':'%'+_0x4b90cd[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x55a88f;})});}_0x3c09e1=_[_0x349e('0x42')]({},_0x3c09e1,_0x4b90cd[_0x349e('0x5b')]);return _0x241fd4[_0x349e('0x118')](_0x3c09e1);}})[_0x349e('0x13')](function(_0x4eb664){if(_0x4eb664){_0x2a8933=_0x4eb664[_0x349e('0x3c')];if(!_0x4b90cd[_0x349e('0x35')][_0x349e('0x59')](_0x349e('0x3d'))){_0x3c09e1[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x4b90cd['query'][_0x349e('0x23')]);_0x3c09e1[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x4b90cd[_0x349e('0x35')][_0x349e('0x21')]);}return _0x241fd4[_0x349e('0x118')](_0x3c09e1);}})[_0x349e('0x13')](function(_0x36c128){if(_0x36c128){return _0x36c128?{'count':_0x2a8933,'rows':_0x36c128}:null;}})[_0x349e('0x13')](respondWithResult(_0x305e04,null))[_0x349e('0x47')](handleError(_0x305e04,null));};exports[_0x349e('0x119')]=function(_0x30e64f,_0x4c0153){return db[_0x349e('0x11a')][_0x349e('0x50')]({'where':{'id':_0x30e64f[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c0153,null))[_0x349e('0x13')](function(_0x24b688){if(_0x24b688){return _0x24b688[_0x349e('0x119')](_0x30e64f['body']['ids'],_[_0x349e('0x11b')](_0x30e64f[_0x349e('0x4b')],[_0x349e('0x5d'),'id'])||{});}})[_0x349e('0x13')](respondWithResult(_0x4c0153,null))['catch'](handleError(_0x4c0153,null));};exports[_0x349e('0x102')]=function(_0x5c1d49,_0x4b2044){var _0x21e9c9={};var _0x49485b={};var _0x277e12;var _0xf852f8;return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x5c1d49[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x4b2044,null))[_0x349e('0x13')](function(_0x4b56bc){if(_0x4b56bc){_0x277e12=_0x4b56bc;_0x49485b[_0x349e('0x39')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x49485b[_0x349e('0x35')]=_[_0x349e('0x36')](_0x5c1d49[_0x349e('0x35')]);_0x49485b[_0x349e('0x37')]=_['intersection'](_0x49485b[_0x349e('0x39')],_0x49485b[_0x349e('0x35')]);_0x21e9c9[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x49485b[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x5c1d49[_0x349e('0x35')][_0x349e('0x3a')]));_0x21e9c9['attributes']=_0x21e9c9['attributes'][_0x349e('0x3c')]?_0x21e9c9[_0x349e('0x3b')]:_0x49485b[_0x349e('0x39')];_0x21e9c9['order']=qs[_0x349e('0x3e')](_0x5c1d49[_0x349e('0x35')][_0x349e('0x3e')]);_0x21e9c9[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x5c1d49[_0x349e('0x35')],_0x49485b[_0x349e('0x37')]));if(_0x5c1d49[_0x349e('0x35')][_0x349e('0x41')]){_0x21e9c9['where']=_[_0x349e('0x42')](_0x21e9c9['where'],{'$or':_['map'](_0x21e9c9[_0x349e('0x3b')],function(_0x43efb0){var _0x51cdda={};_0x51cdda[_0x43efb0]={'$like':'%'+_0x5c1d49[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x51cdda;})});}_0x21e9c9=_[_0x349e('0x42')]({},_0x21e9c9,_0x5c1d49['options']);return _0x277e12[_0x349e('0x102')](_0x21e9c9);}})[_0x349e('0x13')](function(_0x56198f){if(_0x56198f){_0xf852f8=_0x56198f[_0x349e('0x3c')];if(!_0x5c1d49['query'][_0x349e('0x59')](_0x349e('0x3d'))){_0x21e9c9[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x5c1d49[_0x349e('0x35')][_0x349e('0x23')]);_0x21e9c9[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x5c1d49[_0x349e('0x35')]['offset']);}return _0x277e12[_0x349e('0x102')](_0x21e9c9);}})[_0x349e('0x13')](function(_0x11dba5){if(_0x11dba5){return _0x11dba5?{'count':_0xf852f8,'rows':_0x11dba5}:null;}})['then'](respondWithResult(_0x4b2044,null))[_0x349e('0x47')](handleError(_0x4b2044,null));};exports[_0x349e('0x11c')]=function(_0x243937,_0xfd06d7){var _0x5c7b9d=_0x243937[_0x349e('0x35')][_0x349e('0x11d')]===_0x349e('0x11e')?_0x349e('0x11f'):_0x349e('0x120');return db[_0x349e('0x31')][_0x349e('0x50')]({'attributes':['id',_0x5c7b9d],'where':{'id':_0x243937[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0xfd06d7,null))[_0x349e('0x13')](function(_0x1a7d41){if(_0x1a7d41){var _0x78e426=_0x1a7d41[_0x5c7b9d];var _0x328a1c=_0x78e426&&_0x78e426[_0x349e('0x121')]?_0x78e426['items']:[];_0xfd06d7[_0x349e('0x2d')]({'fromKey':_['isNil'](_0x78e426[_0x349e('0x122')])?undefined:_0x78e426[_0x349e('0x122')],'count':_0x328a1c[_0x349e('0x3c')],'rows':_0x328a1c});}})['catch'](handleError(_0xfd06d7,null));};exports['getOfflineMessages']=function(_0xc17f3d,_0x47fdc1){var _0x4996c2={'raw':![],'where':{}};var _0x138fb7={};var _0xd8e0a6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x349e('0x58')]({'where':{'id':_0xc17f3d[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x47fdc1,null))[_0x349e('0x13')](function(_0x29aa4c){if(_0x29aa4c){_0x138fb7['model']=_[_0x349e('0x36')](db[_0x349e('0xcf')][_0x349e('0x61')]);_0x138fb7[_0x349e('0x35')]=_['keys'](_0xc17f3d[_0x349e('0x35')]);_0x138fb7[_0x349e('0x37')]=_['intersection'](_0x138fb7[_0x349e('0x39')],_0x138fb7['query']);_0x4996c2[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x138fb7['model'],qs['fields'](_0xc17f3d[_0x349e('0x35')][_0x349e('0x3a')]));_0x4996c2[_0x349e('0x3b')]=_0x4996c2[_0x349e('0x3b')]['length']?_0x4996c2[_0x349e('0x3b')]:_0x138fb7['model'];if(!_0xc17f3d[_0x349e('0x35')][_0x349e('0x59')]('nolimit')){_0x4996c2[_0x349e('0x23')]=qs[_0x349e('0x23')](_0xc17f3d[_0x349e('0x35')]['limit']);_0x4996c2['offset']=qs[_0x349e('0x21')](_0xc17f3d[_0x349e('0x35')][_0x349e('0x21')]);}_0x4996c2['order']=qs[_0x349e('0x3e')](_0xc17f3d[_0x349e('0x35')][_0x349e('0x3e')]);_0x4996c2[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0xc17f3d[_0x349e('0x35')],_0x138fb7['filters']));_0x4996c2[_0x349e('0x3f')][_0x349e('0x55')]=_0x29aa4c['id'];if(_0xc17f3d[_0x349e('0x35')][_0x349e('0x41')]){_0x4996c2[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x4996c2['where'],{'$or':_[_0x349e('0x30')](_0x4996c2[_0x349e('0x3b')],function(_0x2e83e2){var _0xf981e8={};_0xf981e8[_0x2e83e2]={'$like':'%'+_0xc17f3d[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0xf981e8;})});}_0x4996c2=_[_0x349e('0x42')]({},_0x4996c2,_0xc17f3d[_0x349e('0x5b')]);return db[_0x349e('0xcf')][_0x349e('0x22')]({'where':_0x4996c2[_0x349e('0x3f')]})[_0x349e('0x13')](function(_0x4f6832){_0xd8e0a6[_0x349e('0x22')]=_0x4f6832;if(_0xc17f3d[_0x349e('0x35')][_0x349e('0x4a')]){_0x4996c2[_0x349e('0x44')]=[{'all':!![]}];}else{_0x4996c2['include']=[{'model':db['CmContact'],'as':_0x349e('0xed'),'required':![]},{'model':db[_0x349e('0xd9')],'as':_0x349e('0x123'),'required':![]}];}return db['ChatOfflineMessage'][_0x349e('0x45')](_0x4996c2);})[_0x349e('0x13')](function(_0x4c592a){_0xd8e0a6[_0x349e('0x46')]=_0x4c592a;return _0xd8e0a6;});}})[_0x349e('0x13')](respondWithFilteredResult(_0x47fdc1,_0x4996c2))[_0x349e('0x47')](handleError(_0x47fdc1,null));};exports['addAgents']=function(_0x3ca516,_0x3394f5){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x3ca516[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x3394f5,null))[_0x349e('0x13')](function(_0x505f46){if(_0x505f46){return _0x505f46[_0x349e('0x124')](_0x3ca516[_0x349e('0x4b')][_0x349e('0x5d')],_[_0x349e('0x11b')](_0x3ca516['body'],[_0x349e('0x5d'),'id'])||{})['spread'](function(_0x11e32a){for(var _0x2366b4=0x0;_0x2366b4<_0x3ca516[_0x349e('0x4b')][_0x349e('0x5d')]['length'];_0x2366b4+=0x1){socket[_0x349e('0x125')](_0x349e('0x126'),{'UserId':Number(_0x3ca516[_0x349e('0x4b')][_0x349e('0x5d')][_0x2366b4]),'ChatWebsiteId':Number(_0x3ca516[_0x349e('0x49')]['id'])});}return _0x11e32a;});}})[_0x349e('0x13')](respondWithResult(_0x3394f5,null))[_0x349e('0x47')](handleError(_0x3394f5,null));};exports[_0x349e('0x127')]=function(_0x57e537,_0x2dce5f){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x57e537[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x2dce5f,null))[_0x349e('0x13')](function(_0x543aa7){if(_0x543aa7){return _0x543aa7[_0x349e('0x127')](_0x57e537[_0x349e('0x35')][_0x349e('0x5d')])[_0x349e('0x13')](function(){if(_[_0x349e('0x128')](_0x57e537[_0x349e('0x35')][_0x349e('0x5d')])){for(var _0xc0ecdb=0x0;_0xc0ecdb<_0x57e537['query'][_0x349e('0x5d')]['length'];_0xc0ecdb+=0x1){socket[_0x349e('0x125')](_0x349e('0x129'),{'UserId':Number(_0x57e537[_0x349e('0x35')][_0x349e('0x5d')][_0xc0ecdb]),'ChatWebsiteId':Number(_0x57e537['params']['id'])});}}else{socket[_0x349e('0x125')](_0x349e('0x129'),{'UserId':Number(_0x57e537[_0x349e('0x35')][_0x349e('0x5d')]),'ChatWebsiteId':Number(_0x57e537[_0x349e('0x49')]['id'])});}});}})[_0x349e('0x13')](respondWithStatusCode(_0x2dce5f,null))[_0x349e('0x47')](handleError(_0x2dce5f,null));};exports[_0x349e('0x12a')]=function(_0x29a87c,_0x45156f){var _0x3cb3be={};var _0x44bc51={};var _0x50c044;var _0x3bf043;return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x29a87c[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x45156f,null))[_0x349e('0x13')](function(_0x5324a6){if(_0x5324a6){_0x50c044=_0x5324a6;_0x44bc51[_0x349e('0x39')]=_['keys'](db[_0x349e('0xb9')]['rawAttributes']);_0x44bc51['query']=_[_0x349e('0x36')](_0x29a87c[_0x349e('0x35')]);_0x44bc51[_0x349e('0x37')]=_[_0x349e('0x38')](_0x44bc51[_0x349e('0x39')],_0x44bc51[_0x349e('0x35')]);_0x3cb3be[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x44bc51[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x29a87c['query'][_0x349e('0x3a')]));_0x3cb3be[_0x349e('0x3b')]=_0x3cb3be[_0x349e('0x3b')][_0x349e('0x3c')]?_0x3cb3be['attributes']:_0x44bc51[_0x349e('0x39')];_0x3cb3be[_0x349e('0x5a')]=qs[_0x349e('0x3e')](_0x29a87c['query'][_0x349e('0x3e')]);_0x3cb3be[_0x349e('0x3f')]=qs['filters'](_['pick'](_0x29a87c[_0x349e('0x35')],_0x44bc51[_0x349e('0x37')]));if(_0x29a87c[_0x349e('0x35')][_0x349e('0x41')]){_0x3cb3be[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x3cb3be[_0x349e('0x3f')],{'$or':_['map'](_0x3cb3be['attributes'],function(_0x5dbf6b){var _0x13479b={};_0x13479b[_0x5dbf6b]={'$like':'%'+_0x29a87c[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x13479b;})});}_0x3cb3be=_[_0x349e('0x42')]({},_0x3cb3be,_0x29a87c[_0x349e('0x5b')]);return _0x50c044[_0x349e('0x12a')](_0x3cb3be);}})['then'](function(_0x2ec315){if(_0x2ec315){_0x3bf043=_0x2ec315[_0x349e('0x3c')];if(!_0x29a87c['query']['hasOwnProperty'](_0x349e('0x3d'))){_0x3cb3be[_0x349e('0x23')]=qs['limit'](_0x29a87c['query'][_0x349e('0x23')]);_0x3cb3be[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x29a87c[_0x349e('0x35')]['offset']);}return _0x50c044[_0x349e('0x12a')](_0x3cb3be);}})[_0x349e('0x13')](function(_0x5259aa){if(_0x5259aa){return _0x5259aa?{'count':_0x3bf043,'rows':_0x5259aa}:null;}})['then'](respondWithResult(_0x45156f,null))[_0x349e('0x47')](handleError(_0x45156f,null));};
\ No newline at end of file
diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js
index 25668ef..5874d65 100644
--- a/server/api/chatWebsite/chatWebsite.events.js
+++ b/server/api/chatWebsite/chatWebsite.events.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x3663=['../../mysqldb','ChatWebsite','save','update','emit','hasOwnProperty','hook','events'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0x3663,0x1cf));var _0x3366=function(_0x58f012,_0x2dce4e){_0x58f012=_0x58f012-0x0;var _0x3d7842=_0x3663[_0x58f012];return _0x3d7842;};'use strict';var EventEmitter=require(_0x3366('0x0'));var ChatWebsite=require(_0x3366('0x1'))['db'][_0x3366('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3366('0x3'),'afterUpdate':_0x3366('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2daeb7){return function(_0x206d65,_0x2c87e1,_0x16593e){ChatWebsiteEvents[_0x3366('0x5')](_0x2daeb7+':'+_0x206d65['id'],_0x206d65);ChatWebsiteEvents['emit'](_0x2daeb7,_0x206d65);_0x16593e(null);};}for(var e in events){if(events[_0x3366('0x6')](e)){var event=events[e];ChatWebsite[_0x3366('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents;
\ No newline at end of file
+var _0x269f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','save','remove'];(function(_0x83420c,_0x50fd91){var _0x1057d7=function(_0x80befc){while(--_0x80befc){_0x83420c['push'](_0x83420c['shift']());}};_0x1057d7(++_0x50fd91);}(_0x269f,0xee));var _0xf269=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x269f[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xf269('0x0'));var ChatWebsite=require(_0xf269('0x1'))['db'][_0xf269('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf269('0x3'),'afterUpdate':'update','afterDestroy':_0xf269('0x4')};function emitEvent(_0x35e943){return function(_0x230d12,_0x22032a,_0x1f9a64){ChatWebsiteEvents['emit'](_0x35e943+':'+_0x230d12['id'],_0x230d12);ChatWebsiteEvents[_0xf269('0x5')](_0x35e943,_0x230d12);_0x1f9a64(null);};}for(var e in events){if(events[_0xf269('0x6')](e)){var event=events[e];ChatWebsite[_0xf269('0x7')](e,emitEvent(event));}}module[_0xf269('0x8')]=ChatWebsiteEvents;
\ No newline at end of file
diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js
index df52b86..717610a 100644
--- a/server/api/chatWebsite/chatWebsite.model.js
+++ b/server/api/chatWebsite/chatWebsite.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5ec6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util'];(function(_0x1377b2,_0x2017a6){var _0x92c9c8=function(_0x12db87){while(--_0x12db87){_0x1377b2['push'](_0x1377b2['shift']());}};_0x92c9c8(++_0x2017a6);}(_0x5ec6,0xd0));var _0x65ec=function(_0xa3271b,_0x5cccfa){_0xa3271b=_0xa3271b-0x0;var _0xf33eb9=_0x5ec6[_0xa3271b];return _0xf33eb9;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var logger=require(_0x65ec('0x2'))(_0x65ec('0x3'));var moment=require(_0x65ec('0x4'));var BPromise=require(_0x65ec('0x5'));var rp=require(_0x65ec('0x6'));var fs=require('fs');var path=require(_0x65ec('0x7'));var rimraf=require(_0x65ec('0x8'));var config=require(_0x65ec('0x9'));var attributes=require(_0x65ec('0xa'));module[_0x65ec('0xb')]=function(_0x3d6373,_0x3b1e42){return _0x3d6373['define'](_0x65ec('0xc'),attributes,{'tableName':_0x65ec('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbce6=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','ChatWebsite','chat_websites'];(function(_0x1012f0,_0xed36f7){var _0x5d0f7f=function(_0x3f16ec){while(--_0x3f16ec){_0x1012f0['push'](_0x1012f0['shift']());}};_0x5d0f7f(++_0xed36f7);}(_0xbce6,0x176));var _0x6bce=function(_0x1c24e9,_0x3a8e49){_0x1c24e9=_0x1c24e9-0x0;var _0xe4fdb2=_0xbce6[_0x1c24e9];return _0xe4fdb2;};'use strict';var _=require('lodash');var util=require(_0x6bce('0x0'));var logger=require(_0x6bce('0x1'))(_0x6bce('0x2'));var moment=require(_0x6bce('0x3'));var BPromise=require(_0x6bce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bce('0x5'));var rimraf=require('rimraf');var config=require(_0x6bce('0x6'));var attributes=require('./chatWebsite.attributes');module[_0x6bce('0x7')]=function(_0x1ef6a7,_0x2733d6){return _0x1ef6a7[_0x6bce('0x8')](_0x6bce('0x9'),attributes,{'tableName':_0x6bce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js
index f3bc82e..c4f2ba5 100644
--- a/server/api/chatWebsite/chatWebsite.rpc.js
+++ b/server/api/chatWebsite/chatWebsite.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x8b83=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b83,0xd3));var _0x38b8=function(_0x563120,_0x54bcc8){_0x563120=_0x563120-0x0;var _0x3538ce=_0x8b83[_0x563120];return _0x3538ce;};'use strict';var _=require('lodash');var util=require(_0x38b8('0x0'));var moment=require(_0x38b8('0x1'));var BPromise=require(_0x38b8('0x2'));var rs=require(_0x38b8('0x3'));var fs=require('fs');var Redis=require(_0x38b8('0x4'));var db=require(_0x38b8('0x5'))['db'];var utils=require(_0x38b8('0x6'));var logger=require(_0x38b8('0x7'))(_0x38b8('0x8'));var config=require(_0x38b8('0x9'));var jayson=require(_0x38b8('0xa'));var client=jayson[_0x38b8('0xb')][_0x38b8('0xc')]({'port':0x232a});config[_0x38b8('0xd')]=_[_0x38b8('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x38b8('0xf'))(new Redis(config['redis']));require(_0x38b8('0x10'))[_0x38b8('0x11')](socket);function respondWithRpcPromise(_0x22e83f,_0x140067,_0x1b0173){return new BPromise(function(_0xacd7fa,_0x35b80e){return client[_0x38b8('0x12')](_0x22e83f,_0x1b0173)[_0x38b8('0x13')](function(_0x1bfdb9){logger[_0x38b8('0x14')](_0x38b8('0x15'),_0x140067,_0x38b8('0x16'));logger[_0x38b8('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x140067,_0x38b8('0x16'),JSON[_0x38b8('0x18')](_0x1bfdb9));if(_0x1bfdb9[_0x38b8('0x19')]){if(_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1a')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x140067,_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1b')]);return _0x35b80e(_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1b')]);}logger[_0x38b8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x140067,_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1b')]);return _0xacd7fa(_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1b')]);}else{logger['info'](_0x38b8('0x15'),_0x140067,_0x38b8('0x16'));_0xacd7fa(_0x1bfdb9[_0x38b8('0x1c')][_0x38b8('0x1b')]);}})[_0x38b8('0x1d')](function(_0x42ec1f){logger[_0x38b8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x140067,_0x42ec1f);_0x35b80e(_0x42ec1f);});});}
\ No newline at end of file
+var _0x3960=['defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client'];(function(_0x35ad5c,_0x58ccf7){var _0x2bd8aa=function(_0x426bdf){while(--_0x426bdf){_0x35ad5c['push'](_0x35ad5c['shift']());}};_0x2bd8aa(++_0x58ccf7);}(_0x3960,0xaf));var _0x0396=function(_0x3de8c5,_0x434f8f){_0x3de8c5=_0x3de8c5-0x0;var _0x48a800=_0x3960[_0x3de8c5];return _0x48a800;};'use strict';var _=require(_0x0396('0x0'));var util=require(_0x0396('0x1'));var moment=require(_0x0396('0x2'));var BPromise=require(_0x0396('0x3'));var rs=require(_0x0396('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0396('0x5'))(_0x0396('0x6'));var config=require(_0x0396('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0396('0x8')]['http']({'port':0x232a});config['redis']=_[_0x0396('0x9')](config[_0x0396('0xa')],{'host':_0x0396('0xb'),'port':0x18eb});var socket=require(_0x0396('0xc'))(new Redis(config['redis']));require(_0x0396('0xd'))['register'](socket);function respondWithRpcPromise(_0x19be2b,_0x5c1cce,_0x1510c1){return new BPromise(function(_0x2f8d51,_0xfeb61a){return client[_0x0396('0xe')](_0x19be2b,_0x1510c1)[_0x0396('0xf')](function(_0xf02a22){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5c1cce,_0x0396('0x10'));logger[_0x0396('0x11')](_0x0396('0x12'),_0x5c1cce,_0x0396('0x10'),JSON['stringify'](_0xf02a22));if(_0xf02a22[_0x0396('0x13')]){if(_0xf02a22['error'][_0x0396('0x14')]===0x1f4){logger[_0x0396('0x13')](_0x0396('0x15'),_0x5c1cce,_0xf02a22[_0x0396('0x13')][_0x0396('0x16')]);return _0xfeb61a(_0xf02a22[_0x0396('0x13')]['message']);}logger[_0x0396('0x13')](_0x0396('0x15'),_0x5c1cce,_0xf02a22[_0x0396('0x13')]['message']);return _0x2f8d51(_0xf02a22[_0x0396('0x13')][_0x0396('0x16')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5c1cce,_0x0396('0x10'));_0x2f8d51(_0xf02a22['result'][_0x0396('0x16')]);}})['catch'](function(_0x3f1e39){logger[_0x0396('0x13')](_0x0396('0x15'),_0x5c1cce,_0x3f1e39);_0xfeb61a(_0x3f1e39);});});}
\ No newline at end of file
diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js
index aaaae37..2b7ccf6 100644
--- a/server/api/chatWebsite/chatWebsite.socket.js
+++ b/server/api/chatWebsite/chatWebsite.socket.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x11f9=['length','chatWebsite:','save','remove'];(function(_0x206338,_0x2d800b){var _0x2b87f2=function(_0x436c1c){while(--_0x436c1c){_0x206338['push'](_0x206338['shift']());}};_0x2b87f2(++_0x2d800b);}(_0x11f9,0x172));var _0x911f=function(_0xe9963a,_0x668b){_0xe9963a=_0xe9963a-0x0;var _0x13c8a3=_0x11f9[_0xe9963a];return _0x13c8a3;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x911f('0x0'),_0x911f('0x1'),'update'];function createListener(_0x100c7f,_0x4af327){return function(_0xf090d8){_0x4af327['emit'](_0x100c7f,_0xf090d8);};}function removeListener(_0x2dd0bf,_0x3447e2){return function(){ChatWebsiteEvents['removeListener'](_0x2dd0bf,_0x3447e2);};}exports['register']=function(_0x3af9f9){for(var _0x2ee3b3=0x0,_0x5b53c1=events[_0x911f('0x2')];_0x2ee3b3<_0x5b53c1;_0x2ee3b3++){var _0x120edc=events[_0x2ee3b3];var _0x555b2a=createListener(_0x911f('0x3')+_0x120edc,_0x3af9f9);ChatWebsiteEvents['on'](_0x120edc,_0x555b2a);}};
\ No newline at end of file
+var _0x513f=['length','chatWebsite:','./chatWebsite.events','save','remove','update','removeListener','register'];(function(_0x4fb334,_0x4ca8c9){var _0x56dc84=function(_0x470d7b){while(--_0x470d7b){_0x4fb334['push'](_0x4fb334['shift']());}};_0x56dc84(++_0x4ca8c9);}(_0x513f,0x12a));var _0xf513=function(_0x214ec1,_0x5ace17){_0x214ec1=_0x214ec1-0x0;var _0x54e5f5=_0x513f[_0x214ec1];return _0x54e5f5;};'use strict';var ChatWebsiteEvents=require(_0xf513('0x0'));var events=[_0xf513('0x1'),_0xf513('0x2'),_0xf513('0x3')];function createListener(_0x40c4d7,_0x54cb8a){return function(_0x5a87f3){_0x54cb8a['emit'](_0x40c4d7,_0x5a87f3);};}function removeListener(_0x18639a,_0x2cc3fa){return function(){ChatWebsiteEvents[_0xf513('0x4')](_0x18639a,_0x2cc3fa);};}exports[_0xf513('0x5')]=function(_0x1e94de){for(var _0x15a461=0x0,_0x4202e0=events[_0xf513('0x6')];_0x15a461<_0x4202e0;_0x15a461++){var _0x3c1733=events[_0x15a461];var _0x888a12=createListener(_0xf513('0x7')+_0x3c1733,_0x1e94de);ChatWebsiteEvents['on'](_0x3c1733,_0x888a12);}};
\ No newline at end of file
diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js
index 3ceaa14..c8b2580 100644
--- a/server/api/chatWebsite/index.js
+++ b/server/api/chatWebsite/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xe575=['server/files/images/logos/','format','%s-%s','originalname','file','diskStorage','server/files/images/avatars/','now','single','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','replace','extname','any','offline','addInteraction','addApplications','addProactiveActions','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','join','root'];(function(_0x123bab,_0x1fd456){var _0x46a65d=function(_0x1edb61){while(--_0x1edb61){_0x123bab['push'](_0x123bab['shift']());}};_0x46a65d(++_0x1fd456);}(_0xe575,0x1ba));var _0x5e57=function(_0x415b19,_0x40aea5){_0x415b19=_0x415b19-0x0;var _0x1ae77e=_0xe575[_0x415b19];return _0x1ae77e;};'use strict';var multer=require(_0x5e57('0x0'));var util=require('util');var path=require(_0x5e57('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e57('0x2'));var router=express[_0x5e57('0x3')]();var fs_extra=require(_0x5e57('0x4'));var auth=require(_0x5e57('0x5'));var interaction=require(_0x5e57('0x6'));var config=require(_0x5e57('0x7'));var controller=require('./chatWebsite.controller');router[_0x5e57('0x8')]('/',auth[_0x5e57('0x9')](),controller['index']);router[_0x5e57('0x8')](_0x5e57('0xa'),auth[_0x5e57('0x9')](),controller[_0x5e57('0xb')]);router[_0x5e57('0x8')](_0x5e57('0xc'),auth['isAuthenticated'](),controller[_0x5e57('0xd')]);router['get'](_0x5e57('0xe'),auth[_0x5e57('0x9')](),controller['getDispositions']);router[_0x5e57('0x8')](_0x5e57('0xf'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x10')]);router[_0x5e57('0x8')]('/:id/logo',controller[_0x5e57('0x11')]);router[_0x5e57('0x8')](_0x5e57('0x12'),controller['getAvatar']);router[_0x5e57('0x8')](_0x5e57('0x13'),controller['getCustomerAvatar']);router['get'](_0x5e57('0x14'),controller[_0x5e57('0x15')]);router[_0x5e57('0x8')](_0x5e57('0x16'),auth['isAuthenticated'](),controller[_0x5e57('0x17')]);router['get'](_0x5e57('0x18'),controller[_0x5e57('0x19')]);router['get'](_0x5e57('0x1a'),auth['isAuthenticated'](),controller[_0x5e57('0x1b')]);router[_0x5e57('0x8')](_0x5e57('0x1c'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x1d')]);router[_0x5e57('0x8')](_0x5e57('0x1e'),controller[_0x5e57('0x1f')]);router[_0x5e57('0x8')](_0x5e57('0x20'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x21')]);router[_0x5e57('0x8')](_0x5e57('0x22'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x23')]);router[_0x5e57('0x24')]('/',auth['isAuthenticated'](),controller[_0x5e57('0x25')]);router[_0x5e57('0x24')](_0x5e57('0xe'),auth[_0x5e57('0x9')](),controller['addDisposition']);router[_0x5e57('0x24')](_0x5e57('0xf'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5da115,_0x233eff,_0x258813){_0x258813(null,path[_0x5e57('0x27')](config[_0x5e57('0x28')],_0x5e57('0x29')));},'filename':function(_0x46540f,_0x53f93f,_0x494af9){_0x494af9(null,util[_0x5e57('0x2a')](_0x5e57('0x2b'),Date['now'](),_0x53f93f[_0x5e57('0x2c')]));}})});router['post']('/:id/logo',upload['single'](_0x5e57('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x12abde,_0x30466f,_0xac5deb){_0xac5deb(null,path['join'](config[_0x5e57('0x28')],_0x5e57('0x2f')));},'filename':function(_0x7fc62,_0x1a1276,_0x540279){_0x540279(null,util['format'](_0x5e57('0x2b'),Date[_0x5e57('0x30')](),_0x1a1276[_0x5e57('0x2c')]));}})});router[_0x5e57('0x24')](_0x5e57('0x12'),upload[_0x5e57('0x31')](_0x5e57('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x35e2c5,_0x52c49c,_0x2222e9){_0x2222e9(null,path[_0x5e57('0x27')](config[_0x5e57('0x28')],_0x5e57('0x2f')));},'filename':function(_0x3e7b6f,_0x28cfa5,_0x103fa0){_0x103fa0(null,util[_0x5e57('0x2a')](_0x5e57('0x2b'),Date[_0x5e57('0x30')](),_0x28cfa5[_0x5e57('0x2c')]));}})});router['post'](_0x5e57('0x13'),upload['single'](_0x5e57('0x2d')),controller[_0x5e57('0x32')]);var upload=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x50616c,_0x1c6d21,_0x366b0d){_0x366b0d(null,path[_0x5e57('0x27')](config[_0x5e57('0x28')],_0x5e57('0x2f')));},'filename':function(_0x4d2aff,_0x19ef03,_0x1fef29){_0x1fef29(null,util[_0x5e57('0x2a')]('%s-%s',Date[_0x5e57('0x30')](),_0x19ef03[_0x5e57('0x2c')]));}})});router[_0x5e57('0x24')](_0x5e57('0x14'),upload['single'](_0x5e57('0x2d')),controller[_0x5e57('0x33')]);router[_0x5e57('0x24')]('/:id/notify',controller[_0x5e57('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x5da44c,_0x592de2,_0x792790){const _0x285188=path['join'](config[_0x5e57('0x28')],_0x5e57('0x35'),_0x5e57('0x36'),_0x5e57('0x37'));fs_extra['ensureDir'](_0x285188,function(){_0x792790(null,_0x285188);});},'filename':function(_0x23f94a,_0x4fc695,_0x3e29b0){const _0x3d547e=_0x4fc695[_0x5e57('0x2c')][_0x5e57('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2597f0=path[_0x5e57('0x39')](_0x3d547e);const _0x45ffcc=Date[_0x5e57('0x30')]()+'-'+_0x3d547e['replace'](_0x2597f0,'')+_0x2597f0;_0x3e29b0(null,_0x45ffcc);}})});router[_0x5e57('0x24')]('/:id/offline',offlineUploadMulter[_0x5e57('0x3a')](),controller[_0x5e57('0x3b')]);router['post'](_0x5e57('0x16'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x3c')]);router[_0x5e57('0x24')](_0x5e57('0x1a'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x3d')]);router['post'](_0x5e57('0x1c'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x3e')]);router[_0x5e57('0x24')](_0x5e57('0x22'),auth[_0x5e57('0x9')](),controller['addAgents']);router[_0x5e57('0x3f')](_0x5e57('0xc'),auth[_0x5e57('0x9')](),controller['update']);router[_0x5e57('0x40')](_0x5e57('0xc'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x41')]);router['delete'](_0x5e57('0xe'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x42')]);router[_0x5e57('0x40')](_0x5e57('0xf'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x43')]);router[_0x5e57('0x40')](_0x5e57('0x22'),auth[_0x5e57('0x9')](),controller['removeAgents']);module[_0x5e57('0x44')]=router;
\ No newline at end of file
+var _0x9f94=['offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','/describe','describe','/:id','show','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments'];(function(_0x53fb41,_0x500026){var _0x3f3cbd=function(_0x261510){while(--_0x261510){_0x53fb41['push'](_0x53fb41['shift']());}};_0x3f3cbd(++_0x500026);}(_0x9f94,0x1db));var _0x49f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9f94[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x49f9('0x0'));var util=require('util');var path=require(_0x49f9('0x1'));var timeout=require(_0x49f9('0x2'));var express=require(_0x49f9('0x3'));var router=express[_0x49f9('0x4')]();var fs_extra=require(_0x49f9('0x5'));var auth=require(_0x49f9('0x6'));var interaction=require(_0x49f9('0x7'));var config=require('../../config/environment');var controller=require(_0x49f9('0x8'));router['get']('/',auth[_0x49f9('0x9')](),controller['index']);router['get'](_0x49f9('0xa'),auth['isAuthenticated'](),controller[_0x49f9('0xb')]);router['get'](_0x49f9('0xc'),auth[_0x49f9('0x9')](),controller[_0x49f9('0xd')]);router[_0x49f9('0xe')](_0x49f9('0xf'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x10')]);router[_0x49f9('0xe')](_0x49f9('0x11'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x12')]);router['get'](_0x49f9('0x13'),controller[_0x49f9('0x14')]);router['get'](_0x49f9('0x15'),controller[_0x49f9('0x16')]);router[_0x49f9('0xe')](_0x49f9('0x17'),controller['getCustomerAvatar']);router[_0x49f9('0xe')]('/:id/system_avatar',controller[_0x49f9('0x18')]);router[_0x49f9('0xe')](_0x49f9('0x19'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x1a')]);router['get'](_0x49f9('0x1b'),controller['getSnippet']);router['get']('/:id/applications',auth[_0x49f9('0x9')](),controller[_0x49f9('0x1c')]);router[_0x49f9('0xe')]('/:id/proactive_actions',auth[_0x49f9('0x9')](),controller[_0x49f9('0x1d')]);router[_0x49f9('0xe')](_0x49f9('0x1e'),controller[_0x49f9('0x1f')]);router[_0x49f9('0xe')](_0x49f9('0x20'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x21')]);router[_0x49f9('0xe')](_0x49f9('0x22'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x23')]);router[_0x49f9('0x24')]('/',auth['isAuthenticated'](),controller[_0x49f9('0x25')]);router[_0x49f9('0x24')](_0x49f9('0xf'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x26')]);router['post'](_0x49f9('0x11'),auth[_0x49f9('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x4cde16,_0x2298c8,_0x42af43){_0x42af43(null,path[_0x49f9('0x28')](config[_0x49f9('0x29')],'server/files/images/logos/'));},'filename':function(_0x21f8d1,_0xcdfb65,_0xbf230a){_0xbf230a(null,util[_0x49f9('0x2a')](_0x49f9('0x2b'),Date[_0x49f9('0x2c')](),_0xcdfb65[_0x49f9('0x2d')]));}})});router[_0x49f9('0x24')]('/:id/logo',upload[_0x49f9('0x2e')](_0x49f9('0x2f')),controller[_0x49f9('0x30')]);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x147b0b,_0x1358e8,_0x119eff){_0x119eff(null,path[_0x49f9('0x28')](config['root'],_0x49f9('0x31')));},'filename':function(_0x387a85,_0x712830,_0x158738){_0x158738(null,util[_0x49f9('0x2a')](_0x49f9('0x2b'),Date[_0x49f9('0x2c')](),_0x712830[_0x49f9('0x2d')]));}})});router['post'](_0x49f9('0x15'),upload['single'](_0x49f9('0x2f')),controller[_0x49f9('0x32')]);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x194718,_0x13d5a3,_0x47ff42){_0x47ff42(null,path[_0x49f9('0x28')](config['root'],_0x49f9('0x31')));},'filename':function(_0x15501c,_0x2dd588,_0x5ba3fe){_0x5ba3fe(null,util[_0x49f9('0x2a')](_0x49f9('0x2b'),Date['now'](),_0x2dd588[_0x49f9('0x2d')]));}})});router[_0x49f9('0x24')](_0x49f9('0x17'),upload[_0x49f9('0x2e')](_0x49f9('0x2f')),controller[_0x49f9('0x33')]);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x6d2ed4,_0x383ca2,_0x3a1162){_0x3a1162(null,path['join'](config[_0x49f9('0x29')],_0x49f9('0x31')));},'filename':function(_0x5d32d7,_0x40f334,_0x1eeb1c){_0x1eeb1c(null,util['format'](_0x49f9('0x2b'),Date['now'](),_0x40f334[_0x49f9('0x2d')]));}})});router['post'](_0x49f9('0x34'),upload[_0x49f9('0x2e')](_0x49f9('0x2f')),controller[_0x49f9('0x35')]);router[_0x49f9('0x24')](_0x49f9('0x36'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x2a03de,_0x4ee4cd,_0x5642f8){const _0x50f107=path[_0x49f9('0x28')](config[_0x49f9('0x29')],_0x49f9('0x37'),_0x49f9('0x38'),_0x49f9('0x39'));fs_extra[_0x49f9('0x3a')](_0x50f107,function(){_0x5642f8(null,_0x50f107);});},'filename':function(_0x2c75d1,_0x33d1e0,_0x56a6d3){const _0x3ababf=_0x33d1e0['originalname'][_0x49f9('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x456995=path[_0x49f9('0x3c')](_0x3ababf);const _0x4cb9f6=Date[_0x49f9('0x2c')]()+'-'+_0x3ababf[_0x49f9('0x3b')](_0x456995,'')+_0x456995;_0x56a6d3(null,_0x4cb9f6);}})});router['post'](_0x49f9('0x3d'),offlineUploadMulter['any'](),controller[_0x49f9('0x3e')]);router[_0x49f9('0x24')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x49f9('0x3f')]);router[_0x49f9('0x24')](_0x49f9('0x40'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x41')]);router[_0x49f9('0x24')](_0x49f9('0x42'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x43')]);router[_0x49f9('0x24')]('/:id/users',auth[_0x49f9('0x9')](),controller[_0x49f9('0x44')]);router[_0x49f9('0x45')](_0x49f9('0xc'),auth['isAuthenticated'](),controller[_0x49f9('0x46')]);router[_0x49f9('0x47')]('/:id',auth[_0x49f9('0x9')](),controller[_0x49f9('0x48')]);router[_0x49f9('0x47')](_0x49f9('0xf'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x49')]);router[_0x49f9('0x47')](_0x49f9('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x49f9('0x22'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x4a')]);module[_0x49f9('0x4b')]=router;
\ No newline at end of file
diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js
index e3a6cde..c305c2d 100644
--- a/server/api/client-side-logs.js
+++ b/server/api/client-side-logs.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x6fe5=['express','../components/auth/service','../config/environment','Router','env','production','app','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports'];(function(_0x217cdf,_0x429cc0){var _0x2c81fd=function(_0x55e21d){while(--_0x55e21d){_0x217cdf['push'](_0x217cdf['shift']());}};_0x2c81fd(++_0x429cc0);}(_0x6fe5,0x84));var _0x56fe=function(_0x48d264,_0x3916e6){_0x48d264=_0x48d264-0x0;var _0x2f651d=_0x6fe5[_0x48d264];return _0x2f651d;};var beaverLogger=require('beaver-logger/server');var express=require(_0x56fe('0x0'));var auth=require(_0x56fe('0x1'));var config=require(_0x56fe('0x2'));var router=express[_0x56fe('0x3')]();var isProduction=config[_0x56fe('0x4')]===_0x56fe('0x5')||![];function clientSideLogs(_0x3254a4,_0x163801,_0x2e45ea){var _0x1a13bd=_0x3254a4[_0x56fe('0x6')]['get']('client-side-logger');if(!_0x1a13bd){throw new Error(_0x56fe('0x7'));}return beaverLogger[_0x56fe('0x8')]({'uri':'/client-logs','logger':_0x1a13bd,'enableCors':!isProduction})(_0x3254a4,_0x163801,_0x2e45ea);}router['use'](auth[_0x56fe('0x9')](),clientSideLogs);module[_0x56fe('0xa')]=router;
\ No newline at end of file
+var _0xff1b=['../components/auth/service','../config/environment','Router','env','production','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','express'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xff1b,0x143));var _0xbff1=function(_0x44b19b,_0x5d33cc){_0x44b19b=_0x44b19b-0x0;var _0x2d7858=_0xff1b[_0x44b19b];return _0x2d7858;};var beaverLogger=require(_0xbff1('0x0'));var express=require(_0xbff1('0x1'));var auth=require(_0xbff1('0x2'));var config=require(_0xbff1('0x3'));var router=express[_0xbff1('0x4')]();var isProduction=config[_0xbff1('0x5')]===_0xbff1('0x6')||![];function clientSideLogs(_0x2abac4,_0x2d2a09,_0x169a02){var _0x13b8f1=_0x2abac4['app'][_0xbff1('0x7')]('client-side-logger');if(!_0x13b8f1){throw new Error(_0xbff1('0x8'));}return beaverLogger[_0xbff1('0x9')]({'uri':'/client-logs','logger':_0x13b8f1,'enableCors':!isProduction})(_0x2abac4,_0x2d2a09,_0x169a02);}router[_0xbff1('0xa')](auth[_0xbff1('0xb')](),clientSideLogs);module[_0xbff1('0xc')]=router;
\ No newline at end of file
diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js
index 68356c6..3560a9c 100644
--- a/server/api/cloudProvider/cloudProvider.attributes.js
+++ b/server/api/cloudProvider/cloudProvider.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xb161=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant'];(function(_0x40af8e,_0xbcb4a1){var _0x3b4adc=function(_0x3c9eb3){while(--_0x3c9eb3){_0x40af8e['push'](_0x40af8e['shift']());}};_0x3b4adc(++_0xbcb4a1);}(_0xb161,0xd8));var _0x1b16=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0xb161[_0x2ce6d5];return _0x32d272;};'use strict';var Sequelize=require('sequelize');module[_0x1b16('0x0')]={'name':{'type':Sequelize[_0x1b16('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1b16('0x2')](_0x1b16('0x3'),_0x1b16('0x4'),_0x1b16('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x1b16('0x2')](_0x1b16('0x6'),_0x1b16('0x7'))},'data1':{'type':Sequelize[_0x1b16('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x1b16('0x1')],'comment':_0x1b16('0x8')},'data3':{'type':Sequelize[_0x1b16('0x1')],'comment':_0x1b16('0x9')},'data4':{'type':Sequelize[_0x1b16('0x1')],'comment':_0x1b16('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0x1b16('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0x1b16('0xc')},'data7':{'type':Sequelize[_0x1b16('0xd')],'comment':_0x1b16('0xe')}};
\ No newline at end of file
+var _0xcbad=['Dynamics365','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365'];(function(_0x168c0f,_0x579bd4){var _0xaa8902=function(_0x4ae39f){while(--_0x4ae39f){_0x168c0f['push'](_0x168c0f['shift']());}};_0xaa8902(++_0x579bd4);}(_0xcbad,0x110));var _0xdcba=function(_0x5993a5,_0x88f176){_0x5993a5=_0x5993a5-0x0;var _0x2d7a42=_0xcbad[_0x5993a5];return _0x2d7a42;};'use strict';var Sequelize=require(_0xdcba('0x0'));module[_0xdcba('0x1')]={'name':{'type':Sequelize[_0xdcba('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xdcba('0x3')](_0xdcba('0x4'),_0xdcba('0x5'),_0xdcba('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xdcba('0x3')](_0xdcba('0x7'),_0xdcba('0x8'))},'data1':{'type':Sequelize[_0xdcba('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xdcba('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xdcba('0x2')],'comment':_0xdcba('0x9')},'data5':{'type':Sequelize[_0xdcba('0xa')],'comment':_0xdcba('0xb')},'data6':{'type':Sequelize[_0xdcba('0xa')],'comment':_0xdcba('0xc')},'data7':{'type':Sequelize[_0xdcba('0xa')],'comment':_0xdcba('0xd')}};
\ No newline at end of file
diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js
index 4b71ef0..ccc9993 100644
--- a/server/api/cloudProvider/cloudProvider.controller.js
+++ b/server/api/cloudProvider/cloudProvider.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xe7aa=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','includeAll','find','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','body','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','update','then','destroy','end','error','name','send','padEnd','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters'];(function(_0x3d8d0a,_0x11bb87){var _0x5b9df5=function(_0x3ecba2){while(--_0x3ecba2){_0x3d8d0a['push'](_0x3d8d0a['shift']());}};_0x5b9df5(++_0x11bb87);}(_0xe7aa,0x159));var _0xae7a=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xe7aa[_0x521929];return _0x632436;};'use strict';var _=require(_0xae7a('0x0'));var Redis=require(_0xae7a('0x1'));var qs=require(_0xae7a('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0xae7a('0x3'));var logger=require(_0xae7a('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0xae7a('0x5'));config[_0xae7a('0x6')]=_[_0xae7a('0x7')](config[_0xae7a('0x6')],{'host':_0xae7a('0x8'),'port':0x18eb});var socket=require(_0xae7a('0x9'))(new Redis(config[_0xae7a('0x6')]));var redis=new Redis(config[_0xae7a('0x6')]);function respondWithStatusCode(_0x156809,_0x2ebf4b){_0x2ebf4b=_0x2ebf4b||0xcc;return function(_0x3f39d7){if(_0x3f39d7){return _0x156809[_0xae7a('0xa')](_0x2ebf4b);}return _0x156809[_0xae7a('0xb')](_0x2ebf4b)['end']();};}function respondWithResult(_0xb103bc,_0x8335a){_0x8335a=_0x8335a||0xc8;return function(_0x40da80){if(_0x40da80){return _0xb103bc[_0xae7a('0xb')](_0x8335a)[_0xae7a('0xc')](_0x40da80);}};}function respondWithFilteredResult(_0x11c4ab,_0x4d8c51){return function(_0x1cb9c0){if(_0x1cb9c0){var _0x11c8b3=typeof _0x4d8c51['offset']===_0xae7a('0xd')&&typeof _0x4d8c51[_0xae7a('0xe')]===_0xae7a('0xd');var _0x4f31a5=_0x1cb9c0[_0xae7a('0xf')];var _0x520025=_0x11c8b3?0x0:_0x4d8c51[_0xae7a('0x10')];var _0x4e96db=_0x11c8b3?_0x1cb9c0['count']:_0x4d8c51[_0xae7a('0x10')]+_0x4d8c51[_0xae7a('0xe')];var _0x2d8c9c;if(_0x4e96db>=_0x4f31a5){_0x4e96db=_0x4f31a5;_0x2d8c9c=0xc8;}else{_0x2d8c9c=0xce;}_0x11c4ab[_0xae7a('0xb')](_0x2d8c9c);return _0x11c4ab['set']('Content-Range',_0x520025+'-'+_0x4e96db+'/'+_0x4f31a5)['json'](_0x1cb9c0);}return null;};}function saveUpdates(_0x39e999){return function(_0x736ce8){if(_0x736ce8){return _0x736ce8[_0xae7a('0x11')](_0x39e999)[_0xae7a('0x12')](function(_0x444e21){return _0x444e21;});}return null;};}function removeEntity(_0x576fc6){return function(_0x254894){if(_0x254894){return _0x254894[_0xae7a('0x13')]()['then'](function(){_0x576fc6[_0xae7a('0xb')](0xcc)[_0xae7a('0x14')]();});}};}function handleEntityNotFound(_0x477abe){return function(_0x2525a7){if(!_0x2525a7){_0x477abe[_0xae7a('0xa')](0x194);}return _0x2525a7;};}function handleError(_0x101a97,_0x5ad11e){_0x5ad11e=_0x5ad11e||0x1f4;return function(_0x263844){logger[_0xae7a('0x15')](_0x263844['stack']);if(_0x263844[_0xae7a('0x16')]){delete _0x263844[_0xae7a('0x16')];}_0x101a97[_0xae7a('0xb')](_0x5ad11e)[_0xae7a('0x17')](_0x263844);};}function maskClientSecret(_0x48e79c){return _[_0xae7a('0x18')](_0x48e79c['slice'](0x0,0x3),0x14,'*');}exports[_0xae7a('0x19')]=function(_0x509dfc,_0x8075f5){var _0x10372f={},_0x895f9e={},_0x27ee05={'count':0x0,'rows':[]};var _0x22f996=_[_0xae7a('0x1a')](db[_0xae7a('0x1b')][_0xae7a('0x1c')],function(_0x3eb3c4){return{'name':_0x3eb3c4['fieldName'],'type':_0x3eb3c4[_0xae7a('0x1d')][_0xae7a('0x1e')]};});_0x895f9e[_0xae7a('0x1f')]=_['map'](_0x22f996,_0xae7a('0x16'));_0x895f9e[_0xae7a('0x20')]=_[_0xae7a('0x21')](_0x509dfc[_0xae7a('0x20')]);_0x895f9e[_0xae7a('0x22')]=_[_0xae7a('0x23')](_0x895f9e[_0xae7a('0x1f')],_0x895f9e[_0xae7a('0x20')]);_0x10372f[_0xae7a('0x24')]=_[_0xae7a('0x23')](_0x895f9e[_0xae7a('0x1f')],qs['fields'](_0x509dfc[_0xae7a('0x20')][_0xae7a('0x25')]));_0x10372f[_0xae7a('0x24')]=_0x10372f[_0xae7a('0x24')][_0xae7a('0x26')]?_0x10372f[_0xae7a('0x24')]:_0x895f9e['model'];if(!_0x509dfc['query'][_0xae7a('0x27')](_0xae7a('0x28'))){_0x10372f[_0xae7a('0xe')]=qs['limit'](_0x509dfc['query'][_0xae7a('0xe')]);_0x10372f[_0xae7a('0x10')]=qs['offset'](_0x509dfc[_0xae7a('0x20')][_0xae7a('0x10')]);}_0x10372f[_0xae7a('0x29')]=qs[_0xae7a('0x2a')](_0x509dfc[_0xae7a('0x20')][_0xae7a('0x2a')]);_0x10372f[_0xae7a('0x2b')]=qs[_0xae7a('0x22')](_[_0xae7a('0x2c')](_0x509dfc[_0xae7a('0x20')],_0x895f9e[_0xae7a('0x22')]),_0x22f996);if(_0x509dfc[_0xae7a('0x20')][_0xae7a('0x2d')]){_0x10372f[_0xae7a('0x2b')]=_[_0xae7a('0x2e')](_0x10372f['where'],{'$or':_[_0xae7a('0x1a')](_0x22f996,function(_0x8768ad){if(_0x8768ad[_0xae7a('0x1d')]!==_0xae7a('0x2f')){var _0x4e942a={};_0x4e942a[_0x8768ad['name']]={'$like':'%'+_0x509dfc[_0xae7a('0x20')][_0xae7a('0x2d')]+'%'};return _0x4e942a;}})});}_0x10372f=_['merge']({},_0x10372f,_0x509dfc[_0xae7a('0x30')]);var _0x4b3593={'where':_0x10372f[_0xae7a('0x2b')]};return db[_0xae7a('0x1b')][_0xae7a('0xf')](_0x4b3593)[_0xae7a('0x12')](function(_0x5ce046){_0x27ee05[_0xae7a('0xf')]=_0x5ce046;if(_0x509dfc[_0xae7a('0x20')]['includeAll']){_0x10372f[_0xae7a('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0xae7a('0x32')](_0x10372f);})['then'](function(_0x3d11c6){_0x27ee05[_0xae7a('0x33')]=_['map'](_0x3d11c6,function(_0x517be3){if(_0x517be3[_0xae7a('0x34')]===_0xae7a('0x35')){var _0x32a8f0=encryptor[_0xae7a('0x36')](_0x517be3[_0xae7a('0x37')]);_0x517be3[_0xae7a('0x37')]=maskClientSecret(_0x32a8f0);}return _0x517be3;});return _0x27ee05;})[_0xae7a('0x12')](respondWithFilteredResult(_0x8075f5,_0x10372f))[_0xae7a('0x38')](handleError(_0x8075f5,null));};exports[_0xae7a('0x39')]=function(_0x2fd633,_0xb501c7){var _0x3c49bc={'raw':!![],'where':{'id':_0x2fd633[_0xae7a('0x3a')]['id']}},_0x3fb126={};_0x3fb126[_0xae7a('0x1f')]=_[_0xae7a('0x21')](db[_0xae7a('0x1b')][_0xae7a('0x1c')]);_0x3fb126[_0xae7a('0x20')]=_[_0xae7a('0x21')](_0x2fd633['query']);_0x3fb126[_0xae7a('0x22')]=_[_0xae7a('0x23')](_0x3fb126[_0xae7a('0x1f')],_0x3fb126[_0xae7a('0x20')]);_0x3c49bc[_0xae7a('0x24')]=_[_0xae7a('0x23')](_0x3fb126['model'],qs[_0xae7a('0x25')](_0x2fd633['query'][_0xae7a('0x25')]));_0x3c49bc[_0xae7a('0x24')]=_0x3c49bc[_0xae7a('0x24')]['length']?_0x3c49bc[_0xae7a('0x24')]:_0x3fb126['model'];if(_0x2fd633[_0xae7a('0x20')][_0xae7a('0x3b')]){_0x3c49bc[_0xae7a('0x31')]=[{'all':!![]}];}_0x3c49bc=_[_0xae7a('0x2e')]({},_0x3c49bc,_0x2fd633[_0xae7a('0x30')]);return db[_0xae7a('0x1b')][_0xae7a('0x3c')](_0x3c49bc)[_0xae7a('0x12')](handleEntityNotFound(_0xb501c7,null))[_0xae7a('0x12')](function(_0x352666){if(_0x352666[_0xae7a('0x34')]==='MicrosoftAzure'){var _0x206366=encryptor[_0xae7a('0x36')](_0x352666['data3']);_0x352666[_0xae7a('0x37')]=maskClientSecret(_0x206366);}return _0x352666;})['then'](respondWithResult(_0xb501c7,null))[_0xae7a('0x38')](handleError(_0xb501c7,null));};exports[_0xae7a('0x3d')]=function(_0xd9193b,_0x223982){if(!_0xd9193b['body'][_0xae7a('0x16')])throw new Error(_0xae7a('0x3e'));if(!_0xd9193b['body']['service'])throw new Error(_0xae7a('0x3f'));var _0xd17e0f=db['CloudProvider'][_0xae7a('0x1c')]['service'][_0xae7a('0x40')];if(!_0xd17e0f['includes'](_0xd9193b['body']['service']))throw new Error(_0xae7a('0x41')+_0xd17e0f[_0xae7a('0x42')](',\x20'));if(_0xd9193b['body'][_0xae7a('0x34')]==='MicrosoftAzure'&&_0xd9193b[_0xae7a('0x43')][_0xae7a('0x37')]){_0xd9193b[_0xae7a('0x43')][_0xae7a('0x37')]=encryptor[_0xae7a('0x44')](_0xd9193b[_0xae7a('0x43')][_0xae7a('0x37')]);}return db['CloudProvider']['create'](_0xd9193b[_0xae7a('0x43')],{})[_0xae7a('0x12')](respondWithResult(_0x223982,0xc9))['catch'](handleError(_0x223982,null));};exports[_0xae7a('0x11')]=function(_0x1ac0bf,_0x9666bd){if(_0x1ac0bf[_0xae7a('0x43')]['id']){delete _0x1ac0bf[_0xae7a('0x43')]['id'];}return db[_0xae7a('0x1b')][_0xae7a('0x3c')]({'where':{'id':_0x1ac0bf['params']['id']}})[_0xae7a('0x12')](handleEntityNotFound(_0x9666bd,null))[_0xae7a('0x12')](function(_0x1c0cf9){if(_0x1c0cf9['service']===_0xae7a('0x35')&&_0x1ac0bf[_0xae7a('0x43')][_0xae7a('0x37')]){_0x1ac0bf[_0xae7a('0x43')][_0xae7a('0x37')]=encryptor['encryptString'](_0x1ac0bf[_0xae7a('0x43')][_0xae7a('0x37')]);}return _0x1c0cf9;})[_0xae7a('0x12')](saveUpdates(_0x1ac0bf['body'],null))[_0xae7a('0x12')](respondWithResult(_0x9666bd,null))[_0xae7a('0x38')](handleError(_0x9666bd,null));};exports[_0xae7a('0x13')]=function(_0x2b5f1f,_0x2d3c56){return db[_0xae7a('0x1b')][_0xae7a('0x3c')]({'where':{'id':_0x2b5f1f[_0xae7a('0x3a')]['id']}})[_0xae7a('0x12')](handleEntityNotFound(_0x2d3c56,null))[_0xae7a('0x12')](removeEntity(_0x2d3c56,null))[_0xae7a('0x38')](handleError(_0x2d3c56,null));};exports[_0xae7a('0x45')]=function(_0x11f053,_0x47cd94){return db[_0xae7a('0x1b')]['findOne']({'where':{'id':_0x11f053['params']['id']},'raw':!![]})[_0xae7a('0x12')](function(_0x667b7e){if(!_0x667b7e)return _0x47cd94[_0xae7a('0xa')](0x194);return{'url':oauth[_0xae7a('0x46')](_0x667b7e,_0x11f053[_0xae7a('0x47')]['id'])};})['then'](respondWithResult(_0x47cd94,null))[_0xae7a('0x38')](handleError(_0x47cd94,null));};exports['oauth2MicrosoftCallback']=function(_0x2c4533,_0x22900c){var _0x1f4fa4=_0x2c4533[_0xae7a('0x43')];var _0x196c50;var _0x851d51;if(_0x1f4fa4[_0xae7a('0x15')])throw _0x1f4fa4;redis['get'](_0x1f4fa4[_0xae7a('0x48')])[_0xae7a('0x12')](function(_0x615ce0){if(!_0x615ce0)throw new Error(_0xae7a('0x49'));_0x196c50=JSON[_0xae7a('0x4a')](_0x615ce0);var _0x46b256=Buffer[_0xae7a('0x4b')](_0x1f4fa4['state'],_0xae7a('0x4c'))[_0xae7a('0x4d')](_0xae7a('0x4e'));_0x851d51=JSON[_0xae7a('0x4a')](_0x46b256);if(!oauth[_0xae7a('0x4f')](_0x1f4fa4[_0xae7a('0x50')],_0x196c50[_0xae7a('0x51')]))throw new Error(_0xae7a('0x52'));redis['del'](_0x1f4fa4['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x1f4fa4['code'],_0x196c50);})[_0xae7a('0x12')](function(_0x2c7a6c){_0x196c50[_0xae7a('0x53')]=_0x2c7a6c[_0xae7a('0x54')];_0x196c50[_0xae7a('0x55')]=_0x2c7a6c[_0xae7a('0x56')];return db['CloudProvider']['update']({'data5':_0x196c50[_0xae7a('0x53')],'data6':_0x196c50[_0xae7a('0x55')]},{'where':{'id':_0x196c50['id']}});})[_0xae7a('0x12')](function(){oauth[_0xae7a('0x57')](_0x196c50);socket[_0xae7a('0x58')](_0xae7a('0x59'),{'id':_0x851d51['id']});return;})['then'](respondWithStatusCode(_0x22900c,null))[_0xae7a('0x38')](function(_0x221a4e){if(_0x851d51){socket['emit'](_0xae7a('0x5a'),{'id':_0x851d51['id']});}if(!_0x196c50){logger[_0xae7a('0x15')](_0xae7a('0x5b'),_0x221a4e);return _0x22900c[_0xae7a('0xb')](0x1f4)['send'](_0x221a4e[_0xae7a('0x5c')]);}logger['error'](_0xae7a('0x5d'),_0x196c50['id'],JSON[_0xae7a('0x5e')](_0x221a4e));});};
\ No newline at end of file
+var _0xca8c=['fieldName','type','key','name','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','includeAll','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','localhost','socket.io-emitter','redis','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','send','padEnd','slice','map','CloudProvider','rawAttributes'];(function(_0x24ce5a,_0x25d7e9){var _0x595ae3=function(_0xf756e7){while(--_0xf756e7){_0x24ce5a['push'](_0x24ce5a['shift']());}};_0x595ae3(++_0x25d7e9);}(_0xca8c,0x102));var _0xcca8=function(_0x1558bc,_0x191ffb){_0x1558bc=_0x1558bc-0x0;var _0xfe234d=_0xca8c[_0x1558bc];return _0xfe234d;};'use strict';var _=require('lodash');var Redis=require(_0xcca8('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xcca8('0x1'));var config=require(_0xcca8('0x2'));var logger=require(_0xcca8('0x3'))(_0xcca8('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0xcca8('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0xcca8('0x6'),'port':0x18eb});var socket=require(_0xcca8('0x7'))(new Redis(config[_0xcca8('0x8')]));var redis=new Redis(config[_0xcca8('0x8')]);function respondWithStatusCode(_0x7a93d,_0x27c349){_0x27c349=_0x27c349||0xcc;return function(_0x3be8d6){if(_0x3be8d6){return _0x7a93d[_0xcca8('0x9')](_0x27c349);}return _0x7a93d[_0xcca8('0xa')](_0x27c349)[_0xcca8('0xb')]();};}function respondWithResult(_0x148c49,_0x4fc523){_0x4fc523=_0x4fc523||0xc8;return function(_0x4bcd31){if(_0x4bcd31){return _0x148c49['status'](_0x4fc523)[_0xcca8('0xc')](_0x4bcd31);}};}function respondWithFilteredResult(_0x50c614,_0x5ae436){return function(_0x4c38db){if(_0x4c38db){var _0x13e622=typeof _0x5ae436[_0xcca8('0xd')]===_0xcca8('0xe')&&typeof _0x5ae436['limit']===_0xcca8('0xe');var _0xe41aef=_0x4c38db['count'];var _0xb03554=_0x13e622?0x0:_0x5ae436[_0xcca8('0xd')];var _0x285bbe=_0x13e622?_0x4c38db[_0xcca8('0xf')]:_0x5ae436['offset']+_0x5ae436[_0xcca8('0x10')];var _0x128a59;if(_0x285bbe>=_0xe41aef){_0x285bbe=_0xe41aef;_0x128a59=0xc8;}else{_0x128a59=0xce;}_0x50c614[_0xcca8('0xa')](_0x128a59);return _0x50c614[_0xcca8('0x11')](_0xcca8('0x12'),_0xb03554+'-'+_0x285bbe+'/'+_0xe41aef)[_0xcca8('0xc')](_0x4c38db);}return null;};}function saveUpdates(_0x207245){return function(_0x34cd6e){if(_0x34cd6e){return _0x34cd6e[_0xcca8('0x13')](_0x207245)[_0xcca8('0x14')](function(_0x419d1f){return _0x419d1f;});}return null;};}function removeEntity(_0x4740b8){return function(_0x51cfea){if(_0x51cfea){return _0x51cfea[_0xcca8('0x15')]()[_0xcca8('0x14')](function(){_0x4740b8[_0xcca8('0xa')](0xcc)[_0xcca8('0xb')]();});}};}function handleEntityNotFound(_0x5a402a){return function(_0x56dcc1){if(!_0x56dcc1){_0x5a402a[_0xcca8('0x9')](0x194);}return _0x56dcc1;};}function handleError(_0x341bb1,_0x180a3b){_0x180a3b=_0x180a3b||0x1f4;return function(_0xe9d3b0){logger[_0xcca8('0x16')](_0xe9d3b0[_0xcca8('0x17')]);if(_0xe9d3b0['name']){delete _0xe9d3b0['name'];}_0x341bb1['status'](_0x180a3b)[_0xcca8('0x18')](_0xe9d3b0);};}function maskClientSecret(_0x210a6d){return _[_0xcca8('0x19')](_0x210a6d[_0xcca8('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x4b05cc,_0xa57c76){var _0x48249c={},_0x2b76ff={},_0x4dd515={'count':0x0,'rows':[]};var _0x1172cf=_[_0xcca8('0x1b')](db[_0xcca8('0x1c')][_0xcca8('0x1d')],function(_0x5c93bb){return{'name':_0x5c93bb[_0xcca8('0x1e')],'type':_0x5c93bb[_0xcca8('0x1f')][_0xcca8('0x20')]};});_0x2b76ff['model']=_[_0xcca8('0x1b')](_0x1172cf,_0xcca8('0x21'));_0x2b76ff[_0xcca8('0x22')]=_['keys'](_0x4b05cc['query']);_0x2b76ff['filters']=_[_0xcca8('0x23')](_0x2b76ff[_0xcca8('0x24')],_0x2b76ff[_0xcca8('0x22')]);_0x48249c[_0xcca8('0x25')]=_[_0xcca8('0x23')](_0x2b76ff[_0xcca8('0x24')],qs[_0xcca8('0x26')](_0x4b05cc['query'][_0xcca8('0x26')]));_0x48249c[_0xcca8('0x25')]=_0x48249c['attributes'][_0xcca8('0x27')]?_0x48249c[_0xcca8('0x25')]:_0x2b76ff[_0xcca8('0x24')];if(!_0x4b05cc[_0xcca8('0x22')][_0xcca8('0x28')](_0xcca8('0x29'))){_0x48249c[_0xcca8('0x10')]=qs[_0xcca8('0x10')](_0x4b05cc['query']['limit']);_0x48249c[_0xcca8('0xd')]=qs[_0xcca8('0xd')](_0x4b05cc[_0xcca8('0x22')][_0xcca8('0xd')]);}_0x48249c[_0xcca8('0x2a')]=qs['sort'](_0x4b05cc[_0xcca8('0x22')][_0xcca8('0x2b')]);_0x48249c['where']=qs[_0xcca8('0x2c')](_['pick'](_0x4b05cc['query'],_0x2b76ff[_0xcca8('0x2c')]),_0x1172cf);if(_0x4b05cc[_0xcca8('0x22')][_0xcca8('0x2d')]){_0x48249c[_0xcca8('0x2e')]=_[_0xcca8('0x2f')](_0x48249c['where'],{'$or':_[_0xcca8('0x1b')](_0x1172cf,function(_0x2206dc){if(_0x2206dc[_0xcca8('0x1f')]!==_0xcca8('0x30')){var _0x348421={};_0x348421[_0x2206dc[_0xcca8('0x21')]]={'$like':'%'+_0x4b05cc[_0xcca8('0x22')]['filter']+'%'};return _0x348421;}})});}_0x48249c=_[_0xcca8('0x2f')]({},_0x48249c,_0x4b05cc[_0xcca8('0x31')]);var _0x285edf={'where':_0x48249c[_0xcca8('0x2e')]};return db[_0xcca8('0x1c')][_0xcca8('0xf')](_0x285edf)[_0xcca8('0x14')](function(_0x5162fb){_0x4dd515[_0xcca8('0xf')]=_0x5162fb;if(_0x4b05cc['query']['includeAll']){_0x48249c['include']=[{'all':!![]}];}return db['CloudProvider'][_0xcca8('0x32')](_0x48249c);})[_0xcca8('0x14')](function(_0x34e769){_0x4dd515[_0xcca8('0x33')]=_[_0xcca8('0x1b')](_0x34e769,function(_0x5edb87){if(_0x5edb87[_0xcca8('0x34')]===_0xcca8('0x35')){var _0x4195a3=encryptor[_0xcca8('0x36')](_0x5edb87[_0xcca8('0x37')]);_0x5edb87[_0xcca8('0x37')]=maskClientSecret(_0x4195a3);}return _0x5edb87;});return _0x4dd515;})[_0xcca8('0x14')](respondWithFilteredResult(_0xa57c76,_0x48249c))[_0xcca8('0x38')](handleError(_0xa57c76,null));};exports[_0xcca8('0x39')]=function(_0x598e41,_0x1e182f){var _0x14bdec={'raw':!![],'where':{'id':_0x598e41[_0xcca8('0x3a')]['id']}},_0x33c369={};_0x33c369[_0xcca8('0x24')]=_[_0xcca8('0x3b')](db[_0xcca8('0x1c')][_0xcca8('0x1d')]);_0x33c369[_0xcca8('0x22')]=_[_0xcca8('0x3b')](_0x598e41['query']);_0x33c369[_0xcca8('0x2c')]=_[_0xcca8('0x23')](_0x33c369['model'],_0x33c369[_0xcca8('0x22')]);_0x14bdec[_0xcca8('0x25')]=_[_0xcca8('0x23')](_0x33c369[_0xcca8('0x24')],qs['fields'](_0x598e41[_0xcca8('0x22')]['fields']));_0x14bdec[_0xcca8('0x25')]=_0x14bdec[_0xcca8('0x25')][_0xcca8('0x27')]?_0x14bdec[_0xcca8('0x25')]:_0x33c369[_0xcca8('0x24')];if(_0x598e41[_0xcca8('0x22')][_0xcca8('0x3c')]){_0x14bdec['include']=[{'all':!![]}];}_0x14bdec=_[_0xcca8('0x2f')]({},_0x14bdec,_0x598e41['options']);return db[_0xcca8('0x1c')][_0xcca8('0x3d')](_0x14bdec)[_0xcca8('0x14')](handleEntityNotFound(_0x1e182f,null))['then'](function(_0x59fd63){if(_0x59fd63[_0xcca8('0x34')]==='MicrosoftAzure'){var _0x4f6fe2=encryptor['decryptString'](_0x59fd63[_0xcca8('0x37')]);_0x59fd63[_0xcca8('0x37')]=maskClientSecret(_0x4f6fe2);}return _0x59fd63;})[_0xcca8('0x14')](respondWithResult(_0x1e182f,null))[_0xcca8('0x38')](handleError(_0x1e182f,null));};exports[_0xcca8('0x3e')]=function(_0x255a2f,_0x5d7214){if(!_0x255a2f[_0xcca8('0x3f')]['name'])throw new Error(_0xcca8('0x40'));if(!_0x255a2f[_0xcca8('0x3f')]['service'])throw new Error(_0xcca8('0x41'));var _0x5b7718=db['CloudProvider'][_0xcca8('0x1d')][_0xcca8('0x34')]['values'];if(!_0x5b7718[_0xcca8('0x42')](_0x255a2f[_0xcca8('0x3f')][_0xcca8('0x34')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x5b7718[_0xcca8('0x43')](',\x20'));if(_0x255a2f[_0xcca8('0x3f')][_0xcca8('0x34')]==='MicrosoftAzure'&&_0x255a2f[_0xcca8('0x3f')][_0xcca8('0x37')]){_0x255a2f[_0xcca8('0x3f')]['data3']=encryptor[_0xcca8('0x44')](_0x255a2f[_0xcca8('0x3f')]['data3']);}return db['CloudProvider']['create'](_0x255a2f[_0xcca8('0x3f')],{})[_0xcca8('0x14')](respondWithResult(_0x5d7214,0xc9))[_0xcca8('0x38')](handleError(_0x5d7214,null));};exports[_0xcca8('0x13')]=function(_0xc903d2,_0x5e03e5){if(_0xc903d2['body']['id']){delete _0xc903d2[_0xcca8('0x3f')]['id'];}return db[_0xcca8('0x1c')][_0xcca8('0x3d')]({'where':{'id':_0xc903d2[_0xcca8('0x3a')]['id']}})[_0xcca8('0x14')](handleEntityNotFound(_0x5e03e5,null))[_0xcca8('0x14')](function(_0x9ad335){if(_0x9ad335[_0xcca8('0x34')]===_0xcca8('0x35')&&_0xc903d2[_0xcca8('0x3f')][_0xcca8('0x37')]){_0xc903d2[_0xcca8('0x3f')][_0xcca8('0x37')]=encryptor[_0xcca8('0x44')](_0xc903d2[_0xcca8('0x3f')][_0xcca8('0x37')]);}return _0x9ad335;})[_0xcca8('0x14')](saveUpdates(_0xc903d2[_0xcca8('0x3f')],null))[_0xcca8('0x14')](respondWithResult(_0x5e03e5,null))[_0xcca8('0x38')](handleError(_0x5e03e5,null));};exports[_0xcca8('0x15')]=function(_0x2a2312,_0x19b266){return db[_0xcca8('0x1c')][_0xcca8('0x3d')]({'where':{'id':_0x2a2312[_0xcca8('0x3a')]['id']}})[_0xcca8('0x14')](handleEntityNotFound(_0x19b266,null))['then'](removeEntity(_0x19b266,null))[_0xcca8('0x38')](handleError(_0x19b266,null));};exports[_0xcca8('0x45')]=function(_0x4aa6e1,_0x34a944){return db[_0xcca8('0x1c')][_0xcca8('0x46')]({'where':{'id':_0x4aa6e1[_0xcca8('0x3a')]['id']},'raw':!![]})['then'](function(_0x348125){if(!_0x348125)return _0x34a944[_0xcca8('0x9')](0x194);return{'url':oauth[_0xcca8('0x47')](_0x348125,_0x4aa6e1['user']['id'])};})[_0xcca8('0x14')](respondWithResult(_0x34a944,null))['catch'](handleError(_0x34a944,null));};exports[_0xcca8('0x48')]=function(_0x51b1fd,_0x2806d1){var _0x1abefa=_0x51b1fd[_0xcca8('0x3f')];var _0x232d53;var _0x5a4fcf;if(_0x1abefa[_0xcca8('0x16')])throw _0x1abefa;redis[_0xcca8('0x49')](_0x1abefa[_0xcca8('0x4a')])['then'](function(_0xba8b76){if(!_0xba8b76)throw new Error(_0xcca8('0x4b'));_0x232d53=JSON['parse'](_0xba8b76);var _0x470cc3=Buffer[_0xcca8('0x4c')](_0x1abefa[_0xcca8('0x4a')],'base64')['toString'](_0xcca8('0x4d'));_0x5a4fcf=JSON[_0xcca8('0x4e')](_0x470cc3);if(!oauth[_0xcca8('0x4f')](_0x1abefa[_0xcca8('0x50')],_0x232d53[_0xcca8('0x51')]))throw new Error(_0xcca8('0x52'));redis[_0xcca8('0x53')](_0x1abefa[_0xcca8('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1abefa[_0xcca8('0x54')],_0x232d53);})[_0xcca8('0x14')](function(_0x4dcca6){_0x232d53[_0xcca8('0x55')]=_0x4dcca6[_0xcca8('0x56')];_0x232d53[_0xcca8('0x57')]=_0x4dcca6[_0xcca8('0x58')];return db['CloudProvider'][_0xcca8('0x13')]({'data5':_0x232d53[_0xcca8('0x55')],'data6':_0x232d53[_0xcca8('0x57')]},{'where':{'id':_0x232d53['id']}});})[_0xcca8('0x14')](function(){oauth[_0xcca8('0x59')](_0x232d53);socket[_0xcca8('0x5a')](_0xcca8('0x5b'),{'id':_0x5a4fcf['id']});return;})[_0xcca8('0x14')](respondWithStatusCode(_0x2806d1,null))[_0xcca8('0x38')](function(_0xeb321d){if(_0x5a4fcf){socket[_0xcca8('0x5a')](_0xcca8('0x5c'),{'id':_0x5a4fcf['id']});}if(!_0x232d53){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0xeb321d);return _0x2806d1['status'](0x1f4)[_0xcca8('0x18')](_0xeb321d[_0xcca8('0x5d')]);}logger[_0xcca8('0x16')](_0xcca8('0x5e'),_0x232d53['id'],JSON[_0xcca8('0x5f')](_0xeb321d));});};
\ No newline at end of file
diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js
index 5c75f21..4a107c8 100644
--- a/server/api/cloudProvider/cloudProvider.model.js
+++ b/server/api/cloudProvider/cloudProvider.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xda9c=['../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x34b6ba,_0x2ebe76){var _0x34779a=function(_0x1e509f){while(--_0x1e509f){_0x34b6ba['push'](_0x34b6ba['shift']());}};_0x34779a(++_0x2ebe76);}(_0xda9c,0x113));var _0xcda9=function(_0x25efb3,_0x417166){_0x25efb3=_0x25efb3-0x0;var _0x15e1f9=_0xda9c[_0x25efb3];return _0x15e1f9;};'use strict';var _=require(_0xcda9('0x0'));var util=require(_0xcda9('0x1'));var logger=require(_0xcda9('0x2'))('api');var moment=require(_0xcda9('0x3'));var BPromise=require(_0xcda9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcda9('0x5'));var attributes=require(_0xcda9('0x6'));module[_0xcda9('0x7')]=function(_0x4171f3,_0x52cd4b){return _0x4171f3['define'](_0xcda9('0x8'),attributes,{'tableName':_0xcda9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd867=['./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x467180,_0x44b5c6){var _0x573b61=function(_0x48df01){while(--_0x48df01){_0x467180['push'](_0x467180['shift']());}};_0x573b61(++_0x44b5c6);}(_0xd867,0x1bc));var _0x7d86=function(_0x24c63a,_0x3017dd){_0x24c63a=_0x24c63a-0x0;var _0x27e88e=_0xd867[_0x24c63a];return _0x27e88e;};'use strict';var _=require(_0x7d86('0x0'));var util=require(_0x7d86('0x1'));var logger=require(_0x7d86('0x2'))(_0x7d86('0x3'));var moment=require('moment');var BPromise=require(_0x7d86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d86('0x5'));var config=require(_0x7d86('0x6'));var attributes=require(_0x7d86('0x7'));module[_0x7d86('0x8')]=function(_0x23481a,_0x3db015){return _0x23481a[_0x7d86('0x9')](_0x7d86('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js
index 3a702d2..79aaf15 100644
--- a/server/api/cloudProvider/cloudProvider.oauth.js
+++ b/server/api/cloudProvider/cloudProvider.oauth.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xa767=['response_mode','form_post','scope','state','prompt','login','key','oauth2Claims','oauth2/','data1','set','payload','iss','issuer','audience','nonce','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','POST','{TENANT_ID}','intervals','bind','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','map','Dynamics365','push','data7','/.default','type','Outlook365','data2','code','id_token','from','stringify','toString','base64','hex','response_type','data4'];(function(_0x2717c9,_0x3166f1){var _0x553f1a=function(_0xadab68){while(--_0xadab68){_0x2717c9['push'](_0x2717c9['shift']());}};_0x553f1a(++_0x3166f1);}(_0xa767,0x156));var _0x7a76=function(_0x509af6,_0x348740){_0x509af6=_0x509af6-0x0;var _0x54edde=_0xa767[_0x509af6];return _0x54edde;};'use strict';var _=require(_0x7a76('0x0'));var crypto=require(_0x7a76('0x1'));var jwt=require(_0x7a76('0x2'));var moment=require(_0x7a76('0x3'));var Redis=require(_0x7a76('0x4'));var rp=require(_0x7a76('0x5'));var util=require(_0x7a76('0x6'));var encryptor=require('../../components/encryptor');var config=require(_0x7a76('0x7'));var logger=require(_0x7a76('0x8'))('api');var schedule=require(_0x7a76('0x9'));var db=require(_0x7a76('0xa'))['db'];config['redis']=_[_0x7a76('0xb')](config[_0x7a76('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x7a76('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x7a76('0xe'),_0x7a76('0xf'),_0x7a76('0x10'),_0x7a76('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0x7a76('0x12')],'Dynamics365':[_0x7a76('0x13'),_0x7a76('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x7a76('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x467eb8){var _0x1bd5b2=_[_0x7a76('0x15')](AZURE_AUTH_SCOPES[_0x467eb8['type']]);if(_0x467eb8['type']===_0x7a76('0x16'))_0x1bd5b2[_0x7a76('0x17')](_0x467eb8[_0x7a76('0x18')]+_0x7a76('0x19'));return _0x1bd5b2['join']('\x20');}function getAccessTokenScope(_0x6a7fc4){if(_0x6a7fc4[_0x7a76('0x1a')]===_0x7a76('0x1b'))return _0x7a76('0x11');if(_0x6a7fc4['type']===_0x7a76('0x16'))return _0x6a7fc4[_0x7a76('0x18')]+_0x7a76('0x19');}function generateMicrosoftAuthorizationUrl(_0x10680c,_0x41f2d2){var _0x58243e=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x10680c[_0x7a76('0x1c')]);var _0xb8bcfd=[_0x7a76('0x1d'),_0x7a76('0x1e')];var _0x3fad82=Buffer[_0x7a76('0x1f')](JSON[_0x7a76('0x20')]({'id':_0x41f2d2}))[_0x7a76('0x21')](_0x7a76('0x22'));var _0x5df7c8=crypto['randomBytes'](0x10)['toString'](_0x7a76('0x23'));var _0x131dbe=getAuthorizationScopes(_0x10680c);var _0x1de4e2=[{'key':'client_id','value':_0x10680c['data1']},{'key':_0x7a76('0x24'),'value':encodeURIComponent(_0xb8bcfd['join']('\x20'))},{'key':'redirect_uri','value':_0x10680c[_0x7a76('0x25')]},{'key':_0x7a76('0x26'),'value':_0x7a76('0x27')},{'key':_0x7a76('0x28'),'value':encodeURIComponent(_0x131dbe)},{'key':_0x7a76('0x29'),'value':_0x3fad82},{'key':'nonce','value':_0x5df7c8},{'key':_0x7a76('0x2a'),'value':_0x7a76('0x2b')}];var _0x404c6f=_0x58243e+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7a76('0x15')](_0x1de4e2,function(_0x5323fc){return _0x5323fc[_0x7a76('0x2c')]+'='+_0x5323fc['value'];})['join']('&');_0x10680c[_0x7a76('0x2d')]={'issuer':_0x58243e['replace'](_0x7a76('0x2e'),''),'audience':_0x10680c[_0x7a76('0x2f')],'state':_0x3fad82,'nonce':_0x5df7c8};redis[_0x7a76('0x30')](_0x3fad82,JSON['stringify'](_0x10680c));return _0x404c6f;}function isValidIdToken(_0x2b2bb3,_0x55312f){try{var _0x43839=jwt['decode'](_0x2b2bb3,{'complete':!![]});var _0x18fdc0=_0x43839[_0x7a76('0x31')];if(_0x18fdc0[_0x7a76('0x32')]!==_0x55312f[_0x7a76('0x33')])return![];if(_0x18fdc0['aud']!==_0x55312f[_0x7a76('0x34')])return![];if(_0x18fdc0['nonce']!==_0x55312f[_0x7a76('0x35')])return![];if(moment()['isAfter'](moment['unix'](_0x18fdc0[_0x7a76('0x36')])))return![];return!![];}catch(_0x9d4378){throw _0x9d4378;}}function refreshOauth2MicrosoftAccessToken(_0xe38bb9){return Promise[_0x7a76('0x37')]()[_0x7a76('0x38')](function(){if(_0xe38bb9['data3'])return _0xe38bb9;return db[_0x7a76('0x39')][_0x7a76('0x3a')]({'where':{'id':_0xe38bb9['id']},'raw':!![]});})[_0x7a76('0x38')](function(_0x2d6440){var _0x4cdbda={'grant_type':_0x7a76('0x3b'),'refresh_token':_0x2d6440[_0x7a76('0x3c')],'scope':getAccessTokenScope(_0x2d6440),'redirect_uri':_0x2d6440['data4'],'client_id':_0x2d6440[_0x7a76('0x2f')],'client_secret':encryptor[_0x7a76('0x3d')](_0x2d6440['data3'])};var _0x34daa2={'method':'POST','uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x2d6440[_0x7a76('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4cdbda,'json':!![]};return rp(_0x34daa2);})[_0x7a76('0x38')](function(_0x4bec94){_0xe38bb9[_0x7a76('0x3e')]=_0x4bec94[_0x7a76('0x3f')];_0xe38bb9['data6']=_0x4bec94['refresh_token'];return db['CloudProvider'][_0x7a76('0x40')]({'data5':_0xe38bb9[_0x7a76('0x3e')],'data6':_0xe38bb9[_0x7a76('0x3c')]},{'where':{'id':_0xe38bb9['id']}});})['then'](function(){return _0xe38bb9;})[_0x7a76('0x41')](function(_0x2a66d1){logger[_0x7a76('0x42')](_0x7a76('0x43'),_0xe38bb9['id'],_0x2a66d1);});}function getOauth2MicrosoftAccessToken(_0x3cba68,_0x4f1c47){var _0xa2e1bb={'grant_type':_0x7a76('0x44'),'code':_0x3cba68,'scope':getAccessTokenScope(_0x4f1c47),'redirect_uri':_0x4f1c47[_0x7a76('0x25')],'client_id':_0x4f1c47[_0x7a76('0x2f')],'client_secret':encryptor[_0x7a76('0x3d')](_0x4f1c47[_0x7a76('0x45')])};var _0x184145={'method':_0x7a76('0x46'),'uri':MICROSOFT_AUTH_URL['replace'](_0x7a76('0x47'),_0x4f1c47[_0x7a76('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xa2e1bb,'json':!![]};return rp(_0x184145);}function startRefreshInterval(_0x31beba){var _0x2cb25c=schedule[_0x7a76('0x48')];if(_0x2cb25c[_0x31beba['id']])clearInterval(_0x2cb25c[_0x31beba['id']]);_0x2cb25c[_0x31beba['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7a76('0x49')](this,{'id':_0x31beba['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7a76('0x48')]=_0x2cb25c;}function startAllRefreshIntervals(){return db[_0x7a76('0x39')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7a76('0x38')](function(_0x211d29){var _0x3d31e5=_0x211d29[_0x7a76('0x15')](function(_0x889231){return refreshOauth2MicrosoftAccessToken(_0x889231)[_0x7a76('0x38')](function(_0x444e6b){startRefreshInterval(_0x444e6b);});});return Promise['all'](_0x3d31e5);})['catch'](function(_0x265e86){var _0x330d5d=_0x265e86?util[_0x7a76('0x4a')](_0x265e86,{'showHidden':![],'depth':null}):'';logger[_0x7a76('0x42')](_0x7a76('0x4b'),_0x330d5d);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval};
\ No newline at end of file
+var _0x8143=['response_mode','form_post','scope','state','nonce','map','key','oauth2Claims','oauth2/','payload','iss','issuer','aud','audience','isAfter','exp','then','data3','CloudProvider','findOne','refresh_token','data6','data4','decryptString','replace','data5','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','catch','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','type','Dynamics365','push','/.default','Outlook365','data7','{TENANT_ID}','data2','code','id_token','from','stringify','base64','randomBytes','toString','hex','client_id','data1','join'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x8143,0x73));var _0x3814=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8143[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x3814('0x0'));var crypto=require('crypto');var jwt=require(_0x3814('0x1'));var moment=require('moment');var Redis=require(_0x3814('0x2'));var rp=require('request-promise');var util=require(_0x3814('0x3'));var encryptor=require(_0x3814('0x4'));var config=require(_0x3814('0x5'));var logger=require(_0x3814('0x6'))(_0x3814('0x7'));var schedule=require(_0x3814('0x8'));var db=require(_0x3814('0x9'))['db'];config[_0x3814('0xa')]=_[_0x3814('0xb')](config[_0x3814('0xa')],{'host':_0x3814('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x3814('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x3814('0xe'),_0x3814('0xf'),'email',_0x3814('0x10'),_0x3814('0x11'),_0x3814('0x12'),_0x3814('0x13')],'Dynamics365':[_0x3814('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4e93c6){var _0x29afce=_['map'](AZURE_AUTH_SCOPES[_0x4e93c6['type']]);if(_0x4e93c6[_0x3814('0x14')]===_0x3814('0x15'))_0x29afce[_0x3814('0x16')](_0x4e93c6['data7']+_0x3814('0x17'));return _0x29afce['join']('\x20');}function getAccessTokenScope(_0x126652){if(_0x126652['type']===_0x3814('0x18'))return _0x3814('0x11');if(_0x126652[_0x3814('0x14')]===_0x3814('0x15'))return _0x126652[_0x3814('0x19')]+_0x3814('0x17');}function generateMicrosoftAuthorizationUrl(_0x55bf86,_0x5cc6ef){var _0x4ed6bd=MICROSOFT_AUTH_URL['replace'](_0x3814('0x1a'),_0x55bf86[_0x3814('0x1b')]);var _0xfc2486=[_0x3814('0x1c'),_0x3814('0x1d')];var _0x4c2df5=Buffer[_0x3814('0x1e')](JSON[_0x3814('0x1f')]({'id':_0x5cc6ef}))['toString'](_0x3814('0x20'));var _0x58dd48=crypto[_0x3814('0x21')](0x10)[_0x3814('0x22')](_0x3814('0x23'));var _0x4aa74d=getAuthorizationScopes(_0x55bf86);var _0x120362=[{'key':_0x3814('0x24'),'value':_0x55bf86[_0x3814('0x25')]},{'key':'response_type','value':encodeURIComponent(_0xfc2486[_0x3814('0x26')]('\x20'))},{'key':'redirect_uri','value':_0x55bf86['data4']},{'key':_0x3814('0x27'),'value':_0x3814('0x28')},{'key':_0x3814('0x29'),'value':encodeURIComponent(_0x4aa74d)},{'key':_0x3814('0x2a'),'value':_0x4c2df5},{'key':_0x3814('0x2b'),'value':_0x58dd48},{'key':'prompt','value':'login'}];var _0x2700d0=_0x4ed6bd+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x3814('0x2c')](_0x120362,function(_0x4f6b54){return _0x4f6b54[_0x3814('0x2d')]+'='+_0x4f6b54['value'];})['join']('&');_0x55bf86[_0x3814('0x2e')]={'issuer':_0x4ed6bd['replace'](_0x3814('0x2f'),''),'audience':_0x55bf86[_0x3814('0x25')],'state':_0x4c2df5,'nonce':_0x58dd48};redis['set'](_0x4c2df5,JSON[_0x3814('0x1f')](_0x55bf86));return _0x2700d0;}function isValidIdToken(_0x29cca2,_0x1530d7){try{var _0x3d40c8=jwt['decode'](_0x29cca2,{'complete':!![]});var _0x4c864b=_0x3d40c8[_0x3814('0x30')];if(_0x4c864b[_0x3814('0x31')]!==_0x1530d7[_0x3814('0x32')])return![];if(_0x4c864b[_0x3814('0x33')]!==_0x1530d7[_0x3814('0x34')])return![];if(_0x4c864b[_0x3814('0x2b')]!==_0x1530d7[_0x3814('0x2b')])return![];if(moment()[_0x3814('0x35')](moment['unix'](_0x4c864b[_0x3814('0x36')])))return![];return!![];}catch(_0x54b461){throw _0x54b461;}}function refreshOauth2MicrosoftAccessToken(_0x53bf14){return Promise['resolve']()[_0x3814('0x37')](function(){if(_0x53bf14[_0x3814('0x38')])return _0x53bf14;return db[_0x3814('0x39')][_0x3814('0x3a')]({'where':{'id':_0x53bf14['id']},'raw':!![]});})[_0x3814('0x37')](function(_0x66e419){var _0x31e794={'grant_type':_0x3814('0x3b'),'refresh_token':_0x66e419[_0x3814('0x3c')],'scope':getAccessTokenScope(_0x66e419),'redirect_uri':_0x66e419[_0x3814('0x3d')],'client_id':_0x66e419[_0x3814('0x25')],'client_secret':encryptor[_0x3814('0x3e')](_0x66e419[_0x3814('0x38')])};var _0x27073f={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x3814('0x3f')]('{TENANT_ID}',_0x66e419['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x31e794,'json':!![]};return rp(_0x27073f);})['then'](function(_0x3f9d97){_0x53bf14[_0x3814('0x40')]=_0x3f9d97['access_token'];_0x53bf14[_0x3814('0x3c')]=_0x3f9d97[_0x3814('0x3b')];return db[_0x3814('0x39')][_0x3814('0x41')]({'data5':_0x53bf14[_0x3814('0x40')],'data6':_0x53bf14[_0x3814('0x3c')]},{'where':{'id':_0x53bf14['id']}});})[_0x3814('0x37')](function(){return _0x53bf14;})['catch'](function(_0x2239e1){logger['error'](_0x3814('0x42'),_0x53bf14['id'],_0x2239e1);});}function getOauth2MicrosoftAccessToken(_0x1e6e63,_0xe1d356){var _0x309c5a={'grant_type':_0x3814('0x43'),'code':_0x1e6e63,'scope':getAccessTokenScope(_0xe1d356),'redirect_uri':_0xe1d356[_0x3814('0x3d')],'client_id':_0xe1d356[_0x3814('0x25')],'client_secret':encryptor[_0x3814('0x3e')](_0xe1d356[_0x3814('0x38')])};var _0x468d8b={'method':_0x3814('0x44'),'uri':MICROSOFT_AUTH_URL[_0x3814('0x3f')](_0x3814('0x1a'),_0xe1d356[_0x3814('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x309c5a,'json':!![]};return rp(_0x468d8b);}function startRefreshInterval(_0x29423b){var _0x29ae83=schedule[_0x3814('0x45')];if(_0x29ae83[_0x29423b['id']])clearInterval(_0x29ae83[_0x29423b['id']]);_0x29ae83[_0x29423b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3814('0x46')](this,{'id':_0x29423b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3814('0x45')]=_0x29ae83;}function startAllRefreshIntervals(){return db[_0x3814('0x39')][_0x3814('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x3814('0x37')](function(_0x4325ac){var _0x5ac3ef=_0x4325ac[_0x3814('0x2c')](function(_0x43b7be){return refreshOauth2MicrosoftAccessToken(_0x43b7be)[_0x3814('0x37')](function(_0x2f91c7){startRefreshInterval(_0x2f91c7);});});return Promise[_0x3814('0x48')](_0x5ac3ef);})[_0x3814('0x49')](function(_0x16b8aa){var _0x480c8e=_0x16b8aa?util['inspect'](_0x16b8aa,{'showHidden':![],'depth':null}):'';logger[_0x3814('0x4a')](_0x3814('0x4b'),_0x480c8e);});}module[_0x3814('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval};
\ No newline at end of file
diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js
index dae8c40..3588bd4 100644
--- a/server/api/cloudProvider/cloudProvider.rpc.js
+++ b/server/api/cloudProvider/cloudProvider.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xdcdb=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdcdb,0x64));var _0xbdcd=function(_0x144ae9,_0x4f551f){_0x144ae9=_0x144ae9-0x0;var _0x2bae3d=_0xdcdb[_0x144ae9];return _0x2bae3d;};'use strict';var _=require(_0xbdcd('0x0'));var util=require(_0xbdcd('0x1'));var moment=require(_0xbdcd('0x2'));var BPromise=require(_0xbdcd('0x3'));var rs=require(_0xbdcd('0x4'));var fs=require('fs');var Redis=require(_0xbdcd('0x5'));var db=require(_0xbdcd('0x6'))['db'];var utils=require(_0xbdcd('0x7'));var logger=require(_0xbdcd('0x8'))(_0xbdcd('0x9'));var config=require(_0xbdcd('0xa'));var jayson=require(_0xbdcd('0xb'));var client=jayson[_0xbdcd('0xc')][_0xbdcd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3f2bbc,_0x8744ad,_0xbccbe2){return new BPromise(function(_0x338a29,_0x201493){return client[_0xbdcd('0xe')](_0x3f2bbc,_0xbccbe2)['then'](function(_0x6d798a){logger[_0xbdcd('0xf')]('CloudProvider,\x20%s,\x20%s',_0x8744ad,_0xbdcd('0x10'));logger[_0xbdcd('0x11')](_0xbdcd('0x12'),_0x8744ad,_0xbdcd('0x10'),JSON[_0xbdcd('0x13')](_0x6d798a));if(_0x6d798a[_0xbdcd('0x14')]){if(_0x6d798a[_0xbdcd('0x14')][_0xbdcd('0x15')]===0x1f4){logger['error'](_0xbdcd('0x16'),_0x8744ad,_0x6d798a['error'][_0xbdcd('0x17')]);return _0x201493(_0x6d798a['error']['message']);}logger[_0xbdcd('0x14')]('CloudProvider,\x20%s,\x20%s',_0x8744ad,_0x6d798a[_0xbdcd('0x14')][_0xbdcd('0x17')]);return _0x338a29(_0x6d798a['error'][_0xbdcd('0x17')]);}else{logger[_0xbdcd('0xf')](_0xbdcd('0x16'),_0x8744ad,_0xbdcd('0x10'));_0x338a29(_0x6d798a['result'][_0xbdcd('0x17')]);}})[_0xbdcd('0x18')](function(_0x2893d7){logger[_0xbdcd('0x14')](_0xbdcd('0x16'),_0x8744ad,_0x2893d7);_0x201493(_0x2893d7);});});}
\ No newline at end of file
+var _0x896e=['CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2bcdf4,_0x1a2f20){var _0x4a0f7a=function(_0x1e924f){while(--_0x1e924f){_0x2bcdf4['push'](_0x2bcdf4['shift']());}};_0x4a0f7a(++_0x1a2f20);}(_0x896e,0x1e9));var _0xe896=function(_0x122818,_0x4fab10){_0x122818=_0x122818-0x0;var _0x3d7e15=_0x896e[_0x122818];return _0x3d7e15;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('CloudProvider,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});}
\ No newline at end of file
diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js
index 0f4670c..97aae92 100644
--- a/server/api/cloudProvider/index.js
+++ b/server/api/cloudProvider/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x55476a,_0x30248d){var _0x3dc586=function(_0xdf6b76){while(--_0xdf6b76){_0x55476a['push'](_0x55476a['shift']());}};_0x3dc586(++_0x30248d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router;
\ No newline at end of file
+var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x4e4b9c,_0x5874d7){var _0x438597=function(_0xdc17fb){while(--_0xdc17fb){_0x4e4b9c['push'](_0x4e4b9c['shift']());}};_0x438597(++_0x5874d7);}(_0xdb28,0x106));var _0x8db2=function(_0x2034f2,_0x3c62e8){_0x2034f2=_0x2034f2-0x0;var _0x34947d=_0xdb28[_0x2034f2];return _0x34947d;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router;
\ No newline at end of file
diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js
index 9f0028a..aec1a49 100644
--- a/server/api/cmCompany/cmCompany.attributes.js
+++ b/server/api/cmCompany/cmCompany.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x3770=['STRING','sequelize','exports'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x3770,0x13c));var _0x0377=function(_0x510a7a,_0x542a25){_0x510a7a=_0x510a7a-0x0;var _0x3ff130=_0x3770[_0x510a7a];return _0x3ff130;};'use strict';var Sequelize=require(_0x0377('0x0'));module[_0x0377('0x1')]={'name':{'type':Sequelize[_0x0377('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x0377('0x2')]},'website':{'type':Sequelize[_0x0377('0x2')]},'phone':{'type':Sequelize[_0x0377('0x2')]},'fax':{'type':Sequelize[_0x0377('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x0377('0x2')]},'postalCode':{'type':Sequelize[_0x0377('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0377('0x2')]},'email':{'type':Sequelize[_0x0377('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x0377('0x2')]},'sPostalCode':{'type':Sequelize[_0x0377('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x0377('0x2')]},'description':{'type':Sequelize[_0x0377('0x2')]}};
\ No newline at end of file
+var _0x4278=['name','exports','STRING'];(function(_0x2bbab0,_0x26d5b1){var _0x2a0573=function(_0x1a6a70){while(--_0x1a6a70){_0x2bbab0['push'](_0x2bbab0['shift']());}};_0x2a0573(++_0x26d5b1);}(_0x4278,0x18d));var _0x8427=function(_0x4a7ea8,_0x29cf44){_0x4a7ea8=_0x4a7ea8-0x0;var _0x37d438=_0x4278[_0x4a7ea8];return _0x37d438;};'use strict';var Sequelize=require('sequelize');module[_0x8427('0x0')]={'name':{'type':Sequelize[_0x8427('0x1')],'unique':_0x8427('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8427('0x1')]},'companyId':{'type':Sequelize[_0x8427('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8427('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8427('0x1')]},'postalCode':{'type':Sequelize[_0x8427('0x1')]},'city':{'type':Sequelize[_0x8427('0x1')]},'country':{'type':Sequelize[_0x8427('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8427('0x1')]},'sStreet':{'type':Sequelize[_0x8427('0x1')]},'sPostalCode':{'type':Sequelize[_0x8427('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x8427('0x1')]},'description':{'type':Sequelize[_0x8427('0x1')]}};
\ No newline at end of file
diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js
index 942cca3..0cb4a1c 100644
--- a/server/api/cmCompany/cmCompany.controller.js
+++ b/server/api/cmCompany/cmCompany.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x0486=['../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','stack','name','send','index','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','includeAll','include','CmCompany','findAll','catch','show','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','ids','getContacts','findOne','CmContact','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x0486,0x9e));var _0x6048=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x0486[_0x2a18b7];return _0x45e74e;};'use strict';var emlformat=require(_0x6048('0x0'));var rimraf=require(_0x6048('0x1'));var zipdir=require(_0x6048('0x2'));var jsonpatch=require(_0x6048('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6048('0x4'));var Mustache=require('mustache');var util=require(_0x6048('0x5'));var path=require('path');var sox=require(_0x6048('0x6'));var csv=require(_0x6048('0x7'));var ejs=require(_0x6048('0x8'));var fs=require('fs');var fs_extra=require(_0x6048('0x9'));var _=require(_0x6048('0xa'));var squel=require(_0x6048('0xb'));var crypto=require(_0x6048('0xc'));var jsforce=require(_0x6048('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6048('0x7'));var querystring=require('querystring');var Papa=require(_0x6048('0xe'));var Redis=require(_0x6048('0xf'));var authService=require(_0x6048('0x10'));var qs=require(_0x6048('0x11'));var as=require(_0x6048('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6048('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6048('0x14'));var licenseUtil=require(_0x6048('0x15'));var db=require(_0x6048('0x16'))['db'];function respondWithStatusCode(_0x112c43,_0x3cfba8){_0x3cfba8=_0x3cfba8||0xcc;return function(_0x3a04f5){if(_0x3a04f5){return _0x112c43['sendStatus'](_0x3cfba8);}return _0x112c43[_0x6048('0x17')](_0x3cfba8)[_0x6048('0x18')]();};}function respondWithResult(_0x54165d,_0x18ad75){_0x18ad75=_0x18ad75||0xc8;return function(_0x433b07){if(_0x433b07){return _0x54165d[_0x6048('0x17')](_0x18ad75)['json'](_0x433b07);}};}function respondWithFilteredResult(_0x22e626,_0x1a8c26){return function(_0x3242cf){if(_0x3242cf){var _0x1c4870=typeof _0x1a8c26[_0x6048('0x19')]===_0x6048('0x1a')&&typeof _0x1a8c26[_0x6048('0x1b')]===_0x6048('0x1a');var _0xfd99ab=_0x3242cf['count'];var _0x43c209=_0x1c4870?0x0:_0x1a8c26[_0x6048('0x19')];var _0x1d33b0=_0x1c4870?_0x3242cf[_0x6048('0x1c')]:_0x1a8c26[_0x6048('0x19')]+_0x1a8c26[_0x6048('0x1b')];var _0x2d206e;if(_0x1d33b0>=_0xfd99ab){_0x1d33b0=_0xfd99ab;_0x2d206e=0xc8;}else{_0x2d206e=0xce;}_0x22e626[_0x6048('0x17')](_0x2d206e);return _0x22e626[_0x6048('0x1d')](_0x6048('0x1e'),_0x43c209+'-'+_0x1d33b0+'/'+_0xfd99ab)[_0x6048('0x1f')](_0x3242cf);}return null;};}function patchUpdates(_0x294466){return function(_0x4b7452){try{jsonpatch[_0x6048('0x20')](_0x4b7452,_0x294466,!![]);}catch(_0x3b6817){return BPromise[_0x6048('0x21')](_0x3b6817);}return _0x4b7452[_0x6048('0x22')]();};}function saveUpdates(_0x34425f,_0x1e25a4){return function(_0x29d1aa){if(_0x29d1aa){return _0x29d1aa[_0x6048('0x23')](_0x34425f)[_0x6048('0x24')](function(_0x18a37f){return _0x18a37f;});}return null;};}function removeEntity(_0x1d7771,_0xf191fe){return function(_0x5d3636){if(_0x5d3636){return _0x5d3636[_0x6048('0x25')]()[_0x6048('0x24')](function(){var _0x5e986e=_0x5d3636[_0x6048('0x26')]({'plain':!![]});var _0x4091ed=_0x6048('0x27');return db[_0x6048('0x28')][_0x6048('0x25')]({'where':{'type':_0x4091ed,'resourceId':_0x5e986e['id']}})[_0x6048('0x24')](function(){return _0x5d3636;});})[_0x6048('0x24')](function(){_0x1d7771['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25dcae,_0x55cd37){return function(_0x5b59d9){if(!_0x5b59d9){_0x25dcae[_0x6048('0x29')](0x194);}return _0x5b59d9;};}function handleError(_0x30da42,_0x2d194f){_0x2d194f=_0x2d194f||0x1f4;return function(_0x181677){logger['error'](_0x181677[_0x6048('0x2a')]);if(_0x181677[_0x6048('0x2b')]){delete _0x181677[_0x6048('0x2b')];}_0x30da42[_0x6048('0x17')](_0x2d194f)[_0x6048('0x2c')](_0x181677);};}exports[_0x6048('0x2d')]=function(_0x7ca377,_0x5a28a8){var _0x2590e8={},_0x17c6ff={},_0x520450={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x6048('0x24')](function(_0x399642){_0x17c6ff[_0x6048('0x2e')]=_[_0x6048('0x2f')](_0x399642);_0x17c6ff[_0x6048('0x30')]=_[_0x6048('0x2f')](_0x7ca377[_0x6048('0x30')]);_0x17c6ff[_0x6048('0x31')]=_[_0x6048('0x32')](_0x17c6ff[_0x6048('0x2e')],_0x17c6ff['query']);_0x2590e8[_0x6048('0x33')]=_['intersection'](_0x17c6ff[_0x6048('0x2e')],qs['fields'](_0x7ca377[_0x6048('0x30')]['fields']));_0x2590e8[_0x6048('0x33')]=_0x2590e8[_0x6048('0x33')][_0x6048('0x34')]?_0x2590e8[_0x6048('0x33')]:_0x17c6ff[_0x6048('0x2e')];if(!_0x7ca377[_0x6048('0x30')][_0x6048('0x35')](_0x6048('0x36'))){_0x2590e8[_0x6048('0x1b')]=qs[_0x6048('0x1b')](_0x7ca377['query'][_0x6048('0x1b')]);_0x2590e8[_0x6048('0x19')]=qs[_0x6048('0x19')](_0x7ca377['query'][_0x6048('0x19')]);}_0x2590e8[_0x6048('0x37')]=qs['sort'](_0x7ca377[_0x6048('0x30')][_0x6048('0x38')]);_0x2590e8[_0x6048('0x39')]=qs['filters'](_[_0x6048('0x3a')](_0x7ca377[_0x6048('0x30')],_0x17c6ff[_0x6048('0x31')]),_0x399642);if(_0x7ca377[_0x6048('0x30')]['filter']){_0x2590e8[_0x6048('0x39')]=_[_0x6048('0x3b')](_0x2590e8[_0x6048('0x39')],{'$or':_[_0x6048('0x3c')](_0x2590e8[_0x6048('0x33')],function(_0x1f7bb8){var _0x4f9cc2={};_0x4f9cc2[_0x1f7bb8]={'$like':'%'+_0x7ca377['query'][_0x6048('0x3d')]+'%'};return _0x4f9cc2;})});}_0x2590e8=_[_0x6048('0x3b')]({},_0x2590e8,_0x7ca377[_0x6048('0x3e')]);var _0x171786={'where':_0x2590e8[_0x6048('0x39')]};return db['CmCompany'][_0x6048('0x1c')](_0x171786)[_0x6048('0x24')](function(_0x10b58a){_0x520450[_0x6048('0x1c')]=_0x10b58a;if(_0x7ca377[_0x6048('0x30')][_0x6048('0x3f')]){_0x2590e8[_0x6048('0x40')]=[{'all':!![]}];}return db[_0x6048('0x41')][_0x6048('0x42')](_0x2590e8);})[_0x6048('0x24')](function(_0x306284){_0x520450['rows']=_0x306284;return _0x520450;})[_0x6048('0x24')](respondWithFilteredResult(_0x5a28a8,_0x2590e8))[_0x6048('0x43')](handleError(_0x5a28a8,null));})[_0x6048('0x43')](handleError(_0x5a28a8,null));};exports[_0x6048('0x44')]=function(_0x591d5e,_0x400078){var _0x516afa={'raw':![],'where':{'id':_0x591d5e['params']['id']}},_0x5c6f1a={};_0x5c6f1a[_0x6048('0x2e')]=_['keys'](db[_0x6048('0x41')][_0x6048('0x45')]);_0x5c6f1a[_0x6048('0x30')]=_[_0x6048('0x2f')](_0x591d5e[_0x6048('0x30')]);_0x5c6f1a[_0x6048('0x31')]=_['intersection'](_0x5c6f1a[_0x6048('0x2e')],_0x5c6f1a[_0x6048('0x30')]);_0x516afa[_0x6048('0x33')]=_[_0x6048('0x32')](_0x5c6f1a['model'],qs[_0x6048('0x46')](_0x591d5e[_0x6048('0x30')][_0x6048('0x46')]));_0x516afa[_0x6048('0x33')]=_0x516afa[_0x6048('0x33')][_0x6048('0x34')]?_0x516afa['attributes']:_0x5c6f1a['model'];if(_0x591d5e[_0x6048('0x30')][_0x6048('0x3f')]){_0x516afa['include']=[{'all':!![]}];}_0x516afa=_[_0x6048('0x3b')]({},_0x516afa,_0x591d5e['options']);return db[_0x6048('0x41')][_0x6048('0x47')](_0x516afa)[_0x6048('0x24')](handleEntityNotFound(_0x400078,null))[_0x6048('0x24')](respondWithResult(_0x400078,null))[_0x6048('0x43')](handleError(_0x400078,null));};exports[_0x6048('0x48')]=function(_0x3343a2,_0xa8228d){return db[_0x6048('0x41')]['create'](_0x3343a2[_0x6048('0x49')],{})['then'](function(_0x420ec8){var _0x2e1d42=_0x3343a2[_0x6048('0x4a')][_0x6048('0x26')]({'plain':!![]});if(!_0x2e1d42)throw new Error(_0x6048('0x4b'));if(_0x2e1d42[_0x6048('0x4c')]==='user'){var _0xc1fc7c=_0x420ec8[_0x6048('0x26')]({'plain':!![]});var _0x370df2=_0x6048('0x27');return db[_0x6048('0x4d')][_0x6048('0x47')]({'where':{'name':_0x370df2,'userProfileId':_0x2e1d42['userProfileId']},'raw':!![]})[_0x6048('0x24')](function(_0x503480){if(_0x503480&&_0x503480[_0x6048('0x4e')]===0x0){return db[_0x6048('0x28')][_0x6048('0x48')]({'name':_0xc1fc7c['name'],'resourceId':_0xc1fc7c['id'],'type':_0x503480['name'],'sectionId':_0x503480['id']},{})[_0x6048('0x24')](function(){return _0x420ec8;});}else{return _0x420ec8;}})['catch'](function(_0x33336f){logger[_0x6048('0x4f')](_0x6048('0x50'),_0x33336f);throw _0x33336f;});}return _0x420ec8;})['then'](respondWithResult(_0xa8228d,0xc9))[_0x6048('0x43')](handleError(_0xa8228d,null));};exports[_0x6048('0x23')]=function(_0x3bde24,_0x1f4364){if(_0x3bde24[_0x6048('0x49')]['id']){delete _0x3bde24[_0x6048('0x49')]['id'];}return db[_0x6048('0x41')][_0x6048('0x47')]({'where':{'id':_0x3bde24[_0x6048('0x51')]['id']}})[_0x6048('0x24')](handleEntityNotFound(_0x1f4364,null))['then'](saveUpdates(_0x3bde24['body'],null))[_0x6048('0x24')](respondWithResult(_0x1f4364,null))[_0x6048('0x43')](handleError(_0x1f4364,null));};exports[_0x6048('0x25')]=function(_0x221e21,_0x55cce8){return db[_0x6048('0x41')][_0x6048('0x47')]({'where':{'id':_0x221e21[_0x6048('0x51')]['id']}})[_0x6048('0x24')](handleEntityNotFound(_0x55cce8,null))['then'](removeEntity(_0x55cce8,null))[_0x6048('0x43')](handleError(_0x55cce8,null));};exports[_0x6048('0x52')]=function(_0x42958f,_0x148b2b){return db[_0x6048('0x41')][_0x6048('0x52')]()['then'](respondWithResult(_0x148b2b,null))['catch'](handleError(_0x148b2b,null));};exports[_0x6048('0x53')]=function(_0x37ff29,_0x3beb69,_0x3aee9d){return db['CmContact'][_0x6048('0x47')]({'where':{'id':_0x37ff29[_0x6048('0x51')]['id']}})[_0x6048('0x24')](handleEntityNotFound(_0x3beb69,null))[_0x6048('0x24')](function(_0x55e8aa){if(_0x55e8aa){return _0x55e8aa[_0x6048('0x53')](_0x37ff29['body']['ids'],_['omit'](_0x37ff29[_0x6048('0x49')],[_0x6048('0x54'),'id'])||{});}})[_0x6048('0x24')](respondWithResult(_0x3beb69,null))[_0x6048('0x43')](handleError(_0x3beb69,null));};exports[_0x6048('0x55')]=function(_0x32e6c4,_0x40b1a4,_0x1e7948){var _0x533205={};var _0x22949e={};var _0x1ac43e;var _0x3dc9e4;return db['CmCompany'][_0x6048('0x56')]({'where':{'id':_0x32e6c4[_0x6048('0x51')]['id']}})[_0x6048('0x24')](handleEntityNotFound(_0x40b1a4,null))[_0x6048('0x24')](function(_0x4082ad){if(_0x4082ad){_0x1ac43e=_0x4082ad;_0x22949e[_0x6048('0x2e')]=_[_0x6048('0x2f')](db[_0x6048('0x57')][_0x6048('0x45')]);_0x22949e[_0x6048('0x30')]=_[_0x6048('0x2f')](_0x32e6c4[_0x6048('0x30')]);_0x22949e[_0x6048('0x31')]=_[_0x6048('0x32')](_0x22949e[_0x6048('0x2e')],_0x22949e['query']);_0x533205[_0x6048('0x33')]=_['intersection'](_0x22949e[_0x6048('0x2e')],qs[_0x6048('0x46')](_0x32e6c4[_0x6048('0x30')][_0x6048('0x46')]));_0x533205[_0x6048('0x33')]=_0x533205[_0x6048('0x33')]['length']?_0x533205['attributes']:_0x22949e[_0x6048('0x2e')];_0x533205['order']=qs[_0x6048('0x38')](_0x32e6c4['query']['sort']);_0x533205[_0x6048('0x39')]=qs[_0x6048('0x31')](_['pick'](_0x32e6c4[_0x6048('0x30')],_0x22949e[_0x6048('0x31')]));if(_0x32e6c4[_0x6048('0x30')]['filter']){_0x533205[_0x6048('0x39')]=_[_0x6048('0x3b')](_0x533205['where'],{'$or':_[_0x6048('0x3c')](_0x533205[_0x6048('0x33')],function(_0x93cb2){var _0x2367f2={};_0x2367f2[_0x93cb2]={'$like':'%'+_0x32e6c4[_0x6048('0x30')]['filter']+'%'};return _0x2367f2;})});}_0x533205=_[_0x6048('0x3b')]({},_0x533205,_0x32e6c4['options']);return _0x1ac43e[_0x6048('0x55')](_0x533205);}})['then'](function(_0x2422ea){if(_0x2422ea){_0x3dc9e4=_0x2422ea[_0x6048('0x34')];if(!_0x32e6c4[_0x6048('0x30')][_0x6048('0x35')](_0x6048('0x36'))){_0x533205[_0x6048('0x1b')]=qs[_0x6048('0x1b')](_0x32e6c4[_0x6048('0x30')][_0x6048('0x1b')]);_0x533205[_0x6048('0x19')]=qs[_0x6048('0x19')](_0x32e6c4[_0x6048('0x30')]['offset']);}return _0x1ac43e[_0x6048('0x55')](_0x533205);}})[_0x6048('0x24')](function(_0x5ea77f){if(_0x5ea77f){return _0x5ea77f?{'count':_0x3dc9e4,'rows':_0x5ea77f}:null;}})[_0x6048('0x24')](respondWithResult(_0x40b1a4,null))[_0x6048('0x43')](handleError(_0x40b1a4,null));};
\ No newline at end of file
+var _0x6c47=['fields','length','nolimit','sort','where','pick','filter','map','merge','includeAll','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','ids','getContacts','findOne','rawAttributes','order','hasOwnProperty','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','Companies','destroy','then','end','stack','send','CmCompany','describe','model','keys','filters','intersection','query','attributes'];(function(_0x5b72d5,_0xf47723){var _0x2e8fb4=function(_0x397eff){while(--_0x397eff){_0x5b72d5['push'](_0x5b72d5['shift']());}};_0x2e8fb4(++_0xf47723);}(_0x6c47,0x1cc));var _0x76c4=function(_0x58c7a9,_0x4ef324){_0x58c7a9=_0x58c7a9-0x0;var _0x46c842=_0x6c47[_0x58c7a9];return _0x46c842;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76c4('0x0'));var zipdir=require(_0x76c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76c4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x76c4('0x3'));var util=require(_0x76c4('0x4'));var path=require(_0x76c4('0x5'));var sox=require(_0x76c4('0x6'));var csv=require(_0x76c4('0x7'));var ejs=require(_0x76c4('0x8'));var fs=require('fs');var fs_extra=require(_0x76c4('0x9'));var _=require(_0x76c4('0xa'));var squel=require('squel');var crypto=require(_0x76c4('0xb'));var jsforce=require(_0x76c4('0xc'));var deskjs=require(_0x76c4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x76c4('0xe'));var Papa=require(_0x76c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x76c4('0x10'));var hardwareService=require(_0x76c4('0x11'));var logger=require(_0x76c4('0x12'))(_0x76c4('0x13'));var utils=require(_0x76c4('0x14'));var config=require(_0x76c4('0x15'));var licenseUtil=require(_0x76c4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bf600,_0x423a5e){_0x423a5e=_0x423a5e||0xcc;return function(_0x1ecbc7){if(_0x1ecbc7){return _0x4bf600[_0x76c4('0x17')](_0x423a5e);}return _0x4bf600[_0x76c4('0x18')](_0x423a5e)['end']();};}function respondWithResult(_0x194557,_0x39654f){_0x39654f=_0x39654f||0xc8;return function(_0x205bd7){if(_0x205bd7){return _0x194557[_0x76c4('0x18')](_0x39654f)[_0x76c4('0x19')](_0x205bd7);}};}function respondWithFilteredResult(_0x2964e5,_0x25bfe2){return function(_0x175e02){if(_0x175e02){var _0xbcec6b=typeof _0x25bfe2[_0x76c4('0x1a')]===_0x76c4('0x1b')&&typeof _0x25bfe2[_0x76c4('0x1c')]===_0x76c4('0x1b');var _0x44de0e=_0x175e02['count'];var _0x4c293c=_0xbcec6b?0x0:_0x25bfe2[_0x76c4('0x1a')];var _0x293378=_0xbcec6b?_0x175e02[_0x76c4('0x1d')]:_0x25bfe2['offset']+_0x25bfe2[_0x76c4('0x1c')];var _0x3cb3ae;if(_0x293378>=_0x44de0e){_0x293378=_0x44de0e;_0x3cb3ae=0xc8;}else{_0x3cb3ae=0xce;}_0x2964e5['status'](_0x3cb3ae);return _0x2964e5[_0x76c4('0x1e')](_0x76c4('0x1f'),_0x4c293c+'-'+_0x293378+'/'+_0x44de0e)[_0x76c4('0x19')](_0x175e02);}return null;};}function patchUpdates(_0x34b92c){return function(_0x461a09){try{jsonpatch[_0x76c4('0x20')](_0x461a09,_0x34b92c,!![]);}catch(_0x211175){return BPromise[_0x76c4('0x21')](_0x211175);}return _0x461a09['save']();};}function saveUpdates(_0x2e422d,_0x1c449b){return function(_0x1fdfb1){if(_0x1fdfb1){return _0x1fdfb1[_0x76c4('0x22')](_0x2e422d)['then'](function(_0x475c56){return _0x475c56;});}return null;};}function removeEntity(_0x4335e4,_0x52e928){return function(_0x4cf7eb){if(_0x4cf7eb){return _0x4cf7eb['destroy']()['then'](function(){var _0x15a2ed=_0x4cf7eb[_0x76c4('0x23')]({'plain':!![]});var _0x53ba7c=_0x76c4('0x24');return db['UserProfileResource'][_0x76c4('0x25')]({'where':{'type':_0x53ba7c,'resourceId':_0x15a2ed['id']}})[_0x76c4('0x26')](function(){return _0x4cf7eb;});})['then'](function(){_0x4335e4[_0x76c4('0x18')](0xcc)[_0x76c4('0x27')]();});}};}function handleEntityNotFound(_0x553246,_0x49cd2f){return function(_0xf0a816){if(!_0xf0a816){_0x553246[_0x76c4('0x17')](0x194);}return _0xf0a816;};}function handleError(_0x2f4cb6,_0x35e417){_0x35e417=_0x35e417||0x1f4;return function(_0x489952){logger['error'](_0x489952[_0x76c4('0x28')]);if(_0x489952['name']){delete _0x489952['name'];}_0x2f4cb6[_0x76c4('0x18')](_0x35e417)[_0x76c4('0x29')](_0x489952);};}exports['index']=function(_0x40ed2a,_0x4dbad7){var _0x39e33f={},_0x3eb8b2={},_0x2c2f42={'count':0x0,'rows':[]};return db[_0x76c4('0x2a')][_0x76c4('0x2b')]()['then'](function(_0x2eccbb){_0x3eb8b2[_0x76c4('0x2c')]=_[_0x76c4('0x2d')](_0x2eccbb);_0x3eb8b2['query']=_['keys'](_0x40ed2a['query']);_0x3eb8b2[_0x76c4('0x2e')]=_[_0x76c4('0x2f')](_0x3eb8b2[_0x76c4('0x2c')],_0x3eb8b2[_0x76c4('0x30')]);_0x39e33f[_0x76c4('0x31')]=_[_0x76c4('0x2f')](_0x3eb8b2[_0x76c4('0x2c')],qs[_0x76c4('0x32')](_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x32')]));_0x39e33f[_0x76c4('0x31')]=_0x39e33f[_0x76c4('0x31')][_0x76c4('0x33')]?_0x39e33f[_0x76c4('0x31')]:_0x3eb8b2['model'];if(!_0x40ed2a[_0x76c4('0x30')]['hasOwnProperty'](_0x76c4('0x34'))){_0x39e33f[_0x76c4('0x1c')]=qs['limit'](_0x40ed2a[_0x76c4('0x30')]['limit']);_0x39e33f[_0x76c4('0x1a')]=qs[_0x76c4('0x1a')](_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x1a')]);}_0x39e33f['order']=qs['sort'](_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x35')]);_0x39e33f[_0x76c4('0x36')]=qs[_0x76c4('0x2e')](_[_0x76c4('0x37')](_0x40ed2a[_0x76c4('0x30')],_0x3eb8b2[_0x76c4('0x2e')]),_0x2eccbb);if(_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x38')]){_0x39e33f[_0x76c4('0x36')]=_['merge'](_0x39e33f[_0x76c4('0x36')],{'$or':_[_0x76c4('0x39')](_0x39e33f[_0x76c4('0x31')],function(_0x31211f){var _0x5300ab={};_0x5300ab[_0x31211f]={'$like':'%'+_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x38')]+'%'};return _0x5300ab;})});}_0x39e33f=_[_0x76c4('0x3a')]({},_0x39e33f,_0x40ed2a['options']);var _0xee99d8={'where':_0x39e33f[_0x76c4('0x36')]};return db[_0x76c4('0x2a')][_0x76c4('0x1d')](_0xee99d8)[_0x76c4('0x26')](function(_0x81b05e){_0x2c2f42[_0x76c4('0x1d')]=_0x81b05e;if(_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x3b')]){_0x39e33f['include']=[{'all':!![]}];}return db[_0x76c4('0x2a')][_0x76c4('0x3c')](_0x39e33f);})[_0x76c4('0x26')](function(_0x3a0080){_0x2c2f42['rows']=_0x3a0080;return _0x2c2f42;})['then'](respondWithFilteredResult(_0x4dbad7,_0x39e33f))[_0x76c4('0x3d')](handleError(_0x4dbad7,null));})[_0x76c4('0x3d')](handleError(_0x4dbad7,null));};exports[_0x76c4('0x3e')]=function(_0x1f92ca,_0x2f4740){var _0x56d488={'raw':![],'where':{'id':_0x1f92ca[_0x76c4('0x3f')]['id']}},_0x513098={};_0x513098[_0x76c4('0x2c')]=_[_0x76c4('0x2d')](db[_0x76c4('0x2a')]['rawAttributes']);_0x513098['query']=_[_0x76c4('0x2d')](_0x1f92ca['query']);_0x513098[_0x76c4('0x2e')]=_[_0x76c4('0x2f')](_0x513098[_0x76c4('0x2c')],_0x513098[_0x76c4('0x30')]);_0x56d488['attributes']=_[_0x76c4('0x2f')](_0x513098[_0x76c4('0x2c')],qs['fields'](_0x1f92ca[_0x76c4('0x30')][_0x76c4('0x32')]));_0x56d488[_0x76c4('0x31')]=_0x56d488[_0x76c4('0x31')][_0x76c4('0x33')]?_0x56d488['attributes']:_0x513098[_0x76c4('0x2c')];if(_0x1f92ca[_0x76c4('0x30')][_0x76c4('0x3b')]){_0x56d488[_0x76c4('0x40')]=[{'all':!![]}];}_0x56d488=_['merge']({},_0x56d488,_0x1f92ca[_0x76c4('0x41')]);return db[_0x76c4('0x2a')][_0x76c4('0x42')](_0x56d488)[_0x76c4('0x26')](handleEntityNotFound(_0x2f4740,null))[_0x76c4('0x26')](respondWithResult(_0x2f4740,null))[_0x76c4('0x3d')](handleError(_0x2f4740,null));};exports[_0x76c4('0x43')]=function(_0x45fa98,_0x21e2bd){return db[_0x76c4('0x2a')][_0x76c4('0x43')](_0x45fa98[_0x76c4('0x44')],{})[_0x76c4('0x26')](function(_0x5c0cff){var _0x41cfe0=_0x45fa98[_0x76c4('0x45')][_0x76c4('0x23')]({'plain':!![]});if(!_0x41cfe0)throw new Error(_0x76c4('0x46'));if(_0x41cfe0[_0x76c4('0x47')]==='user'){var _0x300cea=_0x5c0cff[_0x76c4('0x23')]({'plain':!![]});var _0x1f9f62=_0x76c4('0x24');return db[_0x76c4('0x48')][_0x76c4('0x42')]({'where':{'name':_0x1f9f62,'userProfileId':_0x41cfe0[_0x76c4('0x49')]},'raw':!![]})[_0x76c4('0x26')](function(_0x6241be){if(_0x6241be&&_0x6241be['autoAssociation']===0x0){return db[_0x76c4('0x4a')][_0x76c4('0x43')]({'name':_0x300cea[_0x76c4('0x4b')],'resourceId':_0x300cea['id'],'type':_0x6241be['name'],'sectionId':_0x6241be['id']},{})[_0x76c4('0x26')](function(){return _0x5c0cff;});}else{return _0x5c0cff;}})['catch'](function(_0x15de53){logger[_0x76c4('0x4c')](_0x76c4('0x4d'),_0x15de53);throw _0x15de53;});}return _0x5c0cff;})[_0x76c4('0x26')](respondWithResult(_0x21e2bd,0xc9))['catch'](handleError(_0x21e2bd,null));};exports[_0x76c4('0x22')]=function(_0x555feb,_0x58e403){if(_0x555feb[_0x76c4('0x44')]['id']){delete _0x555feb[_0x76c4('0x44')]['id'];}return db['CmCompany'][_0x76c4('0x42')]({'where':{'id':_0x555feb['params']['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x58e403,null))['then'](saveUpdates(_0x555feb['body'],null))[_0x76c4('0x26')](respondWithResult(_0x58e403,null))[_0x76c4('0x3d')](handleError(_0x58e403,null));};exports['destroy']=function(_0x1e45f4,_0x4cd0df){return db[_0x76c4('0x2a')]['find']({'where':{'id':_0x1e45f4[_0x76c4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4cd0df,null))['then'](removeEntity(_0x4cd0df,null))['catch'](handleError(_0x4cd0df,null));};exports[_0x76c4('0x2b')]=function(_0x1cda07,_0x2a7a3c){return db['CmCompany'][_0x76c4('0x2b')]()['then'](respondWithResult(_0x2a7a3c,null))[_0x76c4('0x3d')](handleError(_0x2a7a3c,null));};exports['addContacts']=function(_0x210e96,_0x37c229,_0x1fd91b){return db[_0x76c4('0x4e')][_0x76c4('0x42')]({'where':{'id':_0x210e96[_0x76c4('0x3f')]['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x37c229,null))[_0x76c4('0x26')](function(_0x389c45){if(_0x389c45){return _0x389c45['addContacts'](_0x210e96[_0x76c4('0x44')][_0x76c4('0x4f')],_['omit'](_0x210e96[_0x76c4('0x44')],[_0x76c4('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x37c229,null))[_0x76c4('0x3d')](handleError(_0x37c229,null));};exports[_0x76c4('0x50')]=function(_0x2f6c7d,_0x230935,_0x3a111a){var _0xcae341={};var _0x3c3405={};var _0x558878;var _0x1468f6;return db[_0x76c4('0x2a')][_0x76c4('0x51')]({'where':{'id':_0x2f6c7d['params']['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x230935,null))['then'](function(_0x5ee59){if(_0x5ee59){_0x558878=_0x5ee59;_0x3c3405[_0x76c4('0x2c')]=_['keys'](db[_0x76c4('0x4e')][_0x76c4('0x52')]);_0x3c3405[_0x76c4('0x30')]=_[_0x76c4('0x2d')](_0x2f6c7d[_0x76c4('0x30')]);_0x3c3405[_0x76c4('0x2e')]=_[_0x76c4('0x2f')](_0x3c3405['model'],_0x3c3405[_0x76c4('0x30')]);_0xcae341[_0x76c4('0x31')]=_[_0x76c4('0x2f')](_0x3c3405[_0x76c4('0x2c')],qs[_0x76c4('0x32')](_0x2f6c7d[_0x76c4('0x30')]['fields']));_0xcae341[_0x76c4('0x31')]=_0xcae341['attributes'][_0x76c4('0x33')]?_0xcae341[_0x76c4('0x31')]:_0x3c3405[_0x76c4('0x2c')];_0xcae341[_0x76c4('0x53')]=qs[_0x76c4('0x35')](_0x2f6c7d['query'][_0x76c4('0x35')]);_0xcae341[_0x76c4('0x36')]=qs[_0x76c4('0x2e')](_['pick'](_0x2f6c7d[_0x76c4('0x30')],_0x3c3405[_0x76c4('0x2e')]));if(_0x2f6c7d[_0x76c4('0x30')][_0x76c4('0x38')]){_0xcae341[_0x76c4('0x36')]=_['merge'](_0xcae341[_0x76c4('0x36')],{'$or':_['map'](_0xcae341[_0x76c4('0x31')],function(_0x50f7e5){var _0x208922={};_0x208922[_0x50f7e5]={'$like':'%'+_0x2f6c7d['query'][_0x76c4('0x38')]+'%'};return _0x208922;})});}_0xcae341=_[_0x76c4('0x3a')]({},_0xcae341,_0x2f6c7d['options']);return _0x558878[_0x76c4('0x50')](_0xcae341);}})[_0x76c4('0x26')](function(_0x27c5b9){if(_0x27c5b9){_0x1468f6=_0x27c5b9['length'];if(!_0x2f6c7d[_0x76c4('0x30')][_0x76c4('0x54')](_0x76c4('0x34'))){_0xcae341['limit']=qs[_0x76c4('0x1c')](_0x2f6c7d[_0x76c4('0x30')]['limit']);_0xcae341[_0x76c4('0x1a')]=qs['offset'](_0x2f6c7d[_0x76c4('0x30')][_0x76c4('0x1a')]);}return _0x558878['getContacts'](_0xcae341);}})['then'](function(_0x4b8c66){if(_0x4b8c66){return _0x4b8c66?{'count':_0x1468f6,'rows':_0x4b8c66}:null;}})[_0x76c4('0x26')](respondWithResult(_0x230935,null))[_0x76c4('0x3d')](handleError(_0x230935,null));};
\ No newline at end of file
diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js
index 6a35dbf..e40f5d7 100644
--- a/server/api/cmCompany/cmCompany.model.js
+++ b/server/api/cmCompany/cmCompany.model.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x6c30=['exports','define','cm_companies','lodash','util','../../config/logger','api','bluebird','../../config/environment'];(function(_0x243f93,_0x5503eb){var _0x55cdaa=function(_0x5c79e6){while(--_0x5c79e6){_0x243f93['push'](_0x243f93['shift']());}};_0x55cdaa(++_0x5503eb);}(_0x6c30,0xe4));var _0x06c3=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x6c30[_0x119cd8];return _0x7072a3;};'use strict';var _=require(_0x06c3('0x0'));var util=require(_0x06c3('0x1'));var logger=require(_0x06c3('0x2'))(_0x06c3('0x3'));var moment=require('moment');var BPromise=require(_0x06c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x06c3('0x5'));var attributes=require('./cmCompany.attributes');module[_0x06c3('0x6')]=function(_0x1ac0d2,_0x247154){return _0x1ac0d2[_0x06c3('0x7')]('CmCompany',attributes,{'tableName':_0x06c3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x763e=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util'];(function(_0x1be5ca,_0x4d5966){var _0x255754=function(_0xe270c2){while(--_0xe270c2){_0x1be5ca['push'](_0x1be5ca['shift']());}};_0x255754(++_0x4d5966);}(_0x763e,0x184));var _0xe763=function(_0x56072d,_0x187f3d){_0x56072d=_0x56072d-0x0;var _0x5ef918=_0x763e[_0x56072d];return _0x5ef918;};'use strict';var _=require(_0xe763('0x0'));var util=require(_0xe763('0x1'));var logger=require(_0xe763('0x2'))(_0xe763('0x3'));var moment=require(_0xe763('0x4'));var BPromise=require('bluebird');var rp=require(_0xe763('0x5'));var fs=require('fs');var path=require(_0xe763('0x6'));var rimraf=require(_0xe763('0x7'));var config=require(_0xe763('0x8'));var attributes=require(_0xe763('0x9'));module['exports']=function(_0x44bdd2,_0x5106a1){return _0x44bdd2[_0xe763('0xa')](_0xe763('0xb'),attributes,{'tableName':_0xe763('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js
index 89b2921..3cc1afe 100644
--- a/server/api/cmCompany/cmCompany.rpc.js
+++ b/server/api/cmCompany/cmCompany.rpc.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xe1b7=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xe961d5,_0xabcb0d){var _0x3cf8c3=function(_0x273d93){while(--_0x273d93){_0xe961d5['push'](_0xe961d5['shift']());}};_0x3cf8c3(++_0xabcb0d);}(_0xe1b7,0x179));var _0x7e1b=function(_0x2219bd,_0x9cfd12){_0x2219bd=_0x2219bd-0x0;var _0xb72639=_0xe1b7[_0x2219bd];return _0xb72639;};'use strict';var _=require(_0x7e1b('0x0'));var util=require(_0x7e1b('0x1'));var moment=require(_0x7e1b('0x2'));var BPromise=require(_0x7e1b('0x3'));var rs=require(_0x7e1b('0x4'));var fs=require('fs');var Redis=require(_0x7e1b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e1b('0x6'));var logger=require(_0x7e1b('0x7'))(_0x7e1b('0x8'));var config=require(_0x7e1b('0x9'));var jayson=require(_0x7e1b('0xa'));var client=jayson[_0x7e1b('0xb')][_0x7e1b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x515fc2,_0xaf42c,_0x5c610e){return new BPromise(function(_0x2a4339,_0x14e303){return client[_0x7e1b('0xd')](_0x515fc2,_0x5c610e)[_0x7e1b('0xe')](function(_0x501a17){logger[_0x7e1b('0xf')](_0x7e1b('0x10'),_0xaf42c,_0x7e1b('0x11'));logger[_0x7e1b('0x12')](_0x7e1b('0x13'),_0xaf42c,'request\x20sent',JSON[_0x7e1b('0x14')](_0x501a17));if(_0x501a17[_0x7e1b('0x15')]){if(_0x501a17[_0x7e1b('0x15')]['code']===0x1f4){logger['error'](_0x7e1b('0x10'),_0xaf42c,_0x501a17['error'][_0x7e1b('0x16')]);return _0x14e303(_0x501a17['error']['message']);}logger[_0x7e1b('0x15')](_0x7e1b('0x10'),_0xaf42c,_0x501a17['error'][_0x7e1b('0x16')]);return _0x2a4339(_0x501a17[_0x7e1b('0x15')][_0x7e1b('0x16')]);}else{logger[_0x7e1b('0xf')](_0x7e1b('0x10'),_0xaf42c,_0x7e1b('0x11'));_0x2a4339(_0x501a17[_0x7e1b('0x17')]['message']);}})[_0x7e1b('0x18')](function(_0x4746bd){logger[_0x7e1b('0x15')](_0x7e1b('0x10'),_0xaf42c,_0x4746bd);_0x14e303(_0x4746bd);});});}
\ No newline at end of file
+var _0x7f11=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash'];(function(_0x3b516e,_0x565238){var _0x1a929c=function(_0xe2fab6){while(--_0xe2fab6){_0x3b516e['push'](_0x3b516e['shift']());}};_0x1a929c(++_0x565238);}(_0x7f11,0x175));var _0x17f1=function(_0x16495f,_0x5f2cac){_0x16495f=_0x16495f-0x0;var _0x957e3e=_0x7f11[_0x16495f];return _0x957e3e;};'use strict';var _=require(_0x17f1('0x0'));var util=require(_0x17f1('0x1'));var moment=require(_0x17f1('0x2'));var BPromise=require('bluebird');var rs=require(_0x17f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17f1('0x4'))['db'];var utils=require(_0x17f1('0x5'));var logger=require(_0x17f1('0x6'))(_0x17f1('0x7'));var config=require(_0x17f1('0x8'));var jayson=require(_0x17f1('0x9'));var client=jayson[_0x17f1('0xa')][_0x17f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ce48c,_0x1485a8,_0x1c7dff){return new BPromise(function(_0x5c4804,_0x32ad56){return client[_0x17f1('0xc')](_0x2ce48c,_0x1c7dff)[_0x17f1('0xd')](function(_0x7da095){logger[_0x17f1('0xe')](_0x17f1('0xf'),_0x1485a8,_0x17f1('0x10'));logger[_0x17f1('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1485a8,_0x17f1('0x10'),JSON[_0x17f1('0x12')](_0x7da095));if(_0x7da095['error']){if(_0x7da095[_0x17f1('0x13')]['code']===0x1f4){logger['error'](_0x17f1('0xf'),_0x1485a8,_0x7da095[_0x17f1('0x13')][_0x17f1('0x14')]);return _0x32ad56(_0x7da095[_0x17f1('0x13')][_0x17f1('0x14')]);}logger[_0x17f1('0x13')](_0x17f1('0xf'),_0x1485a8,_0x7da095[_0x17f1('0x13')][_0x17f1('0x14')]);return _0x5c4804(_0x7da095[_0x17f1('0x13')]['message']);}else{logger[_0x17f1('0xe')](_0x17f1('0xf'),_0x1485a8,_0x17f1('0x10'));_0x5c4804(_0x7da095['result'][_0x17f1('0x14')]);}})[_0x17f1('0x15')](function(_0x22c8eb){logger[_0x17f1('0x13')]('CmCompany,\x20%s,\x20%s',_0x1485a8,_0x22c8eb);_0x32ad56(_0x22c8eb);});});}
\ No newline at end of file
diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js
index cf7bab3..a39bb7f 100644
--- a/server/api/cmCompany/index.js
+++ b/server/api/cmCompany/index.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0xd2ee=['getContacts','post','addContacts','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','/describe','describe','get','show'];(function(_0x1a4f8d,_0x57ce58){var _0x436671=function(_0x477f72){while(--_0x477f72){_0x1a4f8d['push'](_0x1a4f8d['shift']());}};_0x436671(++_0x57ce58);}(_0xd2ee,0x1a7));var _0xed2e=function(_0x58c701,_0xd216a9){_0x58c701=_0x58c701-0x0;var _0x24a7ce=_0xd2ee[_0x58c701];return _0x24a7ce;};'use strict';var multer=require(_0xed2e('0x0'));var util=require(_0xed2e('0x1'));var path=require('path');var timeout=require(_0xed2e('0x2'));var express=require('express');var router=express[_0xed2e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xed2e('0x4'));var interaction=require(_0xed2e('0x5'));var config=require(_0xed2e('0x6'));var controller=require(_0xed2e('0x7'));router['get']('/',auth[_0xed2e('0x8')](),controller[_0xed2e('0x9')]);router['get'](_0xed2e('0xa'),auth[_0xed2e('0x8')](),controller[_0xed2e('0xb')]);router[_0xed2e('0xc')]('/:id',auth[_0xed2e('0x8')](),controller[_0xed2e('0xd')]);router[_0xed2e('0xc')]('/:id/contacts',auth[_0xed2e('0x8')](),controller[_0xed2e('0xe')]);router[_0xed2e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/contacts',auth[_0xed2e('0x8')](),controller[_0xed2e('0x10')]);router[_0xed2e('0x11')](_0xed2e('0x12'),auth['isAuthenticated'](),controller[_0xed2e('0x13')]);router[_0xed2e('0x14')]('/:id',auth[_0xed2e('0x8')](),controller[_0xed2e('0x15')]);module[_0xed2e('0x16')]=router;
\ No newline at end of file
+var _0xaf38=['get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create','addContacts','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xaa24f8,_0x19e09f){var _0x39c565=function(_0xde1729){while(--_0xde1729){_0xaa24f8['push'](_0xaa24f8['shift']());}};_0x39c565(++_0x19e09f);}(_0xaf38,0x10b));var _0x8af3=function(_0x36a5df,_0x3711be){_0x36a5df=_0x36a5df-0x0;var _0x4e671f=_0xaf38[_0x36a5df];return _0x4e671f;};'use strict';var multer=require(_0x8af3('0x0'));var util=require(_0x8af3('0x1'));var path=require(_0x8af3('0x2'));var timeout=require(_0x8af3('0x3'));var express=require(_0x8af3('0x4'));var router=express[_0x8af3('0x5')]();var fs_extra=require(_0x8af3('0x6'));var auth=require(_0x8af3('0x7'));var interaction=require(_0x8af3('0x8'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x8af3('0x9')]('/',auth[_0x8af3('0xa')](),controller[_0x8af3('0xb')]);router[_0x8af3('0x9')](_0x8af3('0xc'),auth[_0x8af3('0xa')](),controller[_0x8af3('0xd')]);router['get'](_0x8af3('0xe'),auth[_0x8af3('0xa')](),controller[_0x8af3('0xf')]);router[_0x8af3('0x9')]('/:id/contacts',auth[_0x8af3('0xa')](),controller[_0x8af3('0x10')]);router[_0x8af3('0x11')]('/',auth[_0x8af3('0xa')](),controller[_0x8af3('0x12')]);router[_0x8af3('0x11')]('/:id/contacts',auth[_0x8af3('0xa')](),controller[_0x8af3('0x13')]);router[_0x8af3('0x14')]('/:id',auth[_0x8af3('0xa')](),controller['update']);router['delete'](_0x8af3('0xe'),auth[_0x8af3('0xa')](),controller[_0x8af3('0x15')]);module[_0x8af3('0x16')]=router;
\ No newline at end of file
diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js
index 2d08bec..c0dc139 100644
--- a/server/api/cmContact/cmContact.attributes.js
+++ b/server/api/cmContact/cmContact.attributes.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x5f2f=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x2a428a,_0x507be7){var _0x501b4b=function(_0x592f03){while(--_0x592f03){_0x2a428a['push'](_0x2a428a['shift']());}};_0x501b4b(++_0x507be7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5f4f78,_0x19ed14){_0x5f4f78=_0x5f4f78-0x0;var _0x445ce5=_0x5f2f[_0x5f4f78];return _0x445ce5;};'use strict';var _=require(_0xf5f2('0x0'));var Sequelize=require(_0xf5f2('0x1'));module[_0xf5f2('0x2')]={'firstName':{'type':Sequelize[_0xf5f2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf5f2('0x3')]},'street':{'type':Sequelize[_0xf5f2('0x3')]},'postalCode':{'type':Sequelize[_0xf5f2('0x3')]},'city':{'type':Sequelize[_0xf5f2('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5f2('0x4')]},'phone':{'type':Sequelize[_0xf5f2('0x3')]},'mobile':{'type':Sequelize[_0xf5f2('0x3')]},'fax':{'type':Sequelize[_0xf5f2('0x3')]},'email':{'type':Sequelize[_0xf5f2('0x3')]},'url':{'type':Sequelize[_0xf5f2('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xf5f2('0x3')]},'twitter':{'type':Sequelize[_0xf5f2('0x3')]},'skype':{'type':Sequelize[_0xf5f2('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xf5f2('0x3')]},'line':{'type':Sequelize[_0xf5f2('0x3')]},'wechat':{'type':Sequelize[_0xf5f2('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xf5f2('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':Sequelize[_0xf5f2('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf5f2('0x5')]}};
\ No newline at end of file
+var _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x1050b5,_0x4e97c7){var _0x411620=function(_0x573cd0){while(--_0x573cd0){_0x1050b5['push'](_0x1050b5['shift']());}};_0x411620(++_0x4e97c7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x232cf2,_0x4ffb79){_0x232cf2=_0x232cf2-0x0;var _0x463cec=_0x0b0e[_0x232cf2];return _0x463cec;};'use strict';var _=require(_0xe0b0('0x0'));var Sequelize=require('sequelize');module[_0xe0b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b0('0x2')]},'street':{'type':Sequelize[_0xe0b0('0x2')]},'postalCode':{'type':Sequelize[_0xe0b0('0x2')]},'city':{'type':Sequelize[_0xe0b0('0x2')]},'country':{'type':Sequelize[_0xe0b0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe0b0('0x2')]},'description':{'type':Sequelize[_0xe0b0('0x3')]},'phone':{'type':Sequelize[_0xe0b0('0x2')]},'mobile':{'type':Sequelize[_0xe0b0('0x2')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'email':{'type':Sequelize[_0xe0b0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe0b0('0x2')]},'twitter':{'type':Sequelize[_0xe0b0('0x2')]},'skype':{'type':Sequelize[_0xe0b0('0x2')]},'teams':{'type':Sequelize[_0xe0b0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe0b0('0x2')]},'wechat':{'type':Sequelize[_0xe0b0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b0('0x4')]},'priority':{'type':Sequelize[_0xe0b0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':Sequelize[_0xe0b0('0x6')]},'dialTimezone':{'type':Sequelize[_0xe0b0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js
index a3de24d..cdc606e 100644
--- a/server/api/cmContact/cmContact.controller.js
+++ b/server/api/cmContact/cmContact.controller.js
@@ -15,4 +15,4 @@
// * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
// * *
// *************************************************************************
-var _0x3d2e=['Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','import','User','binding','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','mail','sms','fax','whatsapp','voice','-createdAt','includes','channel','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','callerid','starttime','duration','note','userDisposition','UserId','fullname','createdAt','findAndCountAll','startCase','Website','Account','closedAt','key','chat','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','openchannel','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','socket.io-emitter','./cmContact.socket','status','undefined','limit','count','offset','Content-Range','json','update','then','destroy','end','sendStatus','error','name','send','index','CmContact','describe','keys','length','startsWith','push','CmCustomField','trimStart','cf_','all','fieldType','model','query','fields','attributes','nolimit','order','sort','where','filters','pick','select','field','color','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','start','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','some','getLists','c.ListId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','c.firstName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','TagIds','Tags','catch','find','params','columnName','displayName','analytics','findAll','alias','values','body','from','get','mergeWith','isArray','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailMessage','MailInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','$or','spread','show','omit','format','cf_%d','$and','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','Tag','rawAttributes','intersection','setTags','findOne','ids','getHoppers','hasOwnProperty','ContactId','options','include','getHopperHistories','rows','getHopperFinals','getJscriptySessions','includeAll','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x3d2e,0x169));var _0xe3d2=function(_0x1c1ecc,_0x52ca15){_0x1c1ecc=_0x1c1ecc-0x0;var _0x39e611=_0x3d2e[_0x1c1ecc];return _0x39e611;};'use strict';var moment=require('moment');var BPromise=require(_0xe3d2('0x0'));var util=require(_0xe3d2('0x1'));var path=require(_0xe3d2('0x2'));var fs=require('fs');var _=require(_0xe3d2('0x3'));var squel=require(_0xe3d2('0x4'));var Papa=require(_0xe3d2('0x5'));var Redis=require(_0xe3d2('0x6'));var qs=require(_0xe3d2('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xe3d2('0x8'))('api');var config=require(_0xe3d2('0x9'));var shared=require(_0xe3d2('0xa'));var db=require(_0xe3d2('0xb'))['db'];config[_0xe3d2('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe3d2('0xd'))(new Redis(config['redis']));require(_0xe3d2('0xe'))['register'](socket);function respondWithResult(_0x1dd6b0,_0x3dacf1){_0x3dacf1=_0x3dacf1||0xc8;return function(_0xf3db8f){if(_0xf3db8f){return _0x1dd6b0[_0xe3d2('0xf')](_0x3dacf1)['json'](_0xf3db8f);}};}function respondWithFilteredResult(_0x5bbdab,_0x220847){return function(_0x223b40){if(_0x223b40){var _0x1a1465=typeof _0x220847['offset']===_0xe3d2('0x10')&&typeof _0x220847[_0xe3d2('0x11')]===_0xe3d2('0x10');var _0x331df1=_0x223b40[_0xe3d2('0x12')];var _0xa1e846=_0x1a1465?0x0:_0x220847['offset'];var _0x249e35=_0x1a1465?_0x223b40[_0xe3d2('0x12')]:_0x220847[_0xe3d2('0x13')]+_0x220847[_0xe3d2('0x11')];var _0x589f24;if(_0x249e35>=_0x331df1){_0x249e35=_0x331df1;_0x589f24=0xc8;}else{_0x589f24=0xce;}_0x5bbdab[_0xe3d2('0xf')](_0x589f24);return _0x5bbdab['set'](_0xe3d2('0x14'),_0xa1e846+'-'+_0x249e35+'/'+_0x331df1)[_0xe3d2('0x15')](_0x223b40);}return null;};}function saveUpdates(_0x1efabc){return function(_0x13b5e2){if(_0x13b5e2){return _0x13b5e2[_0xe3d2('0x16')](_0x1efabc)[_0xe3d2('0x17')](function(_0x577c60){return _0x577c60;});}return null;};}function removeEntity(_0x2e006c){return function(_0x4bd9a2){if(_0x4bd9a2){return _0x4bd9a2[_0xe3d2('0x18')]()[_0xe3d2('0x17')](function(){_0x2e006c[_0xe3d2('0xf')](0xcc)[_0xe3d2('0x19')]();});}};}function handleEntityNotFound(_0xe188e9){return function(_0xfad5a4){if(!_0xfad5a4){_0xe188e9[_0xe3d2('0x1a')](0x194);}return _0xfad5a4;};}function handleError(_0x277a27,_0x2d8d44){_0x2d8d44=_0x2d8d44||0x1f4;return function(_0x2926d3){logger[_0xe3d2('0x1b')](_0x2926d3['stack']);if(_0x2926d3[_0xe3d2('0x1c')]){delete _0x2926d3[_0xe3d2('0x1c')];}_0x277a27[_0xe3d2('0xf')](_0x2d8d44)[_0xe3d2('0x1d')](_0x2926d3);};}exports[_0xe3d2('0x1e')]=function(_0x196a45,_0x1433eb){var _0x557487={},_0x4023f4={},_0x583824={'count':0x0,'rows':[]};return db[_0xe3d2('0x1f')][_0xe3d2('0x20')]()[_0xe3d2('0x17')](function(_0x1acafa){var _0x3a598e=[];for(var _0x1e9ecd=0x0;_0x1e9ecd
','Attachments','Title','Data','user=','utf-8','toString','lodash','moment','randomstring','path','util','email','../../../config/environment','value','address','@xcally.com','head','name','indexOf','split','length','slice','join','Anonymous','isEmpty'];(function(_0x48d3ad,_0x290e43){var _0xa60d6e=function(_0x424a3e){while(--_0x424a3e){_0x48d3ad['push'](_0x48d3ad['shift']());}};_0xa60d6e(++_0x290e43);}(_0x3458,0x19d));var _0x8345=function(_0x19f07d,_0x670b92){_0x19f07d=_0x19f07d-0x0;var _0x60f613=_0x3458[_0x19f07d];return _0x60f613;};'use strict';var _=require(_0x8345('0x0'));var moment=require(_0x8345('0x1'));var random=require(_0x8345('0x2'));var fs=require('fs');var path=require(_0x8345('0x3'));var util=require(_0x8345('0x4'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0x8345('0x5'));var config=require(_0x8345('0x6'));function getAddress(_0x416f7a){var _0x4d250f=_['head'](_0x416f7a[_0x8345('0x7')]);return _0x4d250f&&_0x4d250f[_0x8345('0x8')]?_0x4d250f[_0x8345('0x8')]:'anonymous'+random['generate'](0x6)+_0x8345('0x9');}function getFirstName(_0x5eea57){var _0x54fca3=_[_0x8345('0xa')](_0x5eea57[_0x8345('0x7')]);if(_0x54fca3&&_0x54fca3[_0x8345('0xb')]){if(_0x54fca3[_0x8345('0xb')]==_0x54fca3[_0x8345('0x8')]){return _0x54fca3['name']['substring'](0x0,_0x54fca3[_0x8345('0xb')][_0x8345('0xc')]('@'));}var _0x13cf4c=_0x54fca3[_0x8345('0xb')][_0x8345('0xd')](/\s+/);return _0x13cf4c[_0x8345('0xe')]>0x1?_0x13cf4c[_0x8345('0xf')](0x0,-0x1)[_0x8345('0x10')]('\x20'):_0x54fca3[_0x8345('0xb')];}return _0x8345('0x11');}function getLastName(_0x43861e){var _0x4e84db=_[_0x8345('0xa')](_0x43861e[_0x8345('0x7')]);if(_0x4e84db&&_0x4e84db[_0x8345('0xb')]){var _0x49c205=_0x4e84db[_0x8345('0xb')]['split'](/\s+/);return _0x49c205['length']>0x1?_0x49c205['pop']():'';}return'';}function getMails(_0x223330,_0x704073){var _0x2a0e1a='';for(var _0x4977e9=0x0;_0x4977e9<_0x704073[_0x8345('0x7')][_0x8345('0xe')];_0x4977e9+=0x1){if(_0x704073[_0x8345('0x7')][_0x4977e9][_0x8345('0x8')]!==_0x223330){if(!_[_0x8345('0x12')](_0x2a0e1a)){_0x2a0e1a+=',';}_0x2a0e1a+=_0x704073['value'][_0x4977e9][_0x8345('0xb')]||_0x704073[_0x8345('0x7')][_0x4977e9][_0x8345('0x8')]||'';_0x2a0e1a+='\x20<';_0x2a0e1a+=_0x704073[_0x8345('0x7')][_0x4977e9][_0x8345('0x8')]?_0x704073[_0x8345('0x7')][_0x4977e9][_0x8345('0x8')]:'anonymous'+random[_0x8345('0x13')](0x6)+_0x8345('0x9');_0x2a0e1a+='>';}}return _0x2a0e1a;}function parseEmail(_0x2c025e,_0x61b172,_0x45e873){if(_0x61b172['html']){var _0x1d931a=/